header('Content-Type: '.$type);
+ $this->extraHeaders();
+
$this->startXML('html',
'-//W3C//DTD XHTML 1.0 Strict//EN',
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
- // FIXME: correct language for interface
-
- $language = common_language();
+ $language = $this->getLanguage();
$this->elementStart('html', array('xmlns' => 'http://www.w3.org/1999/xhtml',
'xml:lang' => $language,
'lang' => $language));
}
+ function getLanguage()
+ {
+ // FIXME: correct language for interface
+ return common_language();
+ }
+
/**
* Ends an HTML document
*
$this->endXML();
}
+ /**
+ * To specify additional HTTP headers for the action
+ *
+ * @return void
+ */
+ function extraHeaders()
+ {
+ // Needs to be overloaded
+ }
+
/**
* Output an HTML text input element
*
function input($id, $label, $value=null, $instructions=null)
{
- $this->elementStart('p');
$this->element('label', array('for' => $id), $label);
$attrs = array('name' => $id,
'type' => 'text',
- 'class' => 'input_text',
'id' => $id);
if ($value) {
- $attrs['value'] = htmlspecialchars($value);
+ $attrs['value'] = $value;
}
$this->element('input', $attrs);
if ($instructions) {
- $this->element('span', 'input_instructions', $instructions);
+ $this->element('p', 'form_guide', $instructions);
}
- $this->elementEnd('p');
}
/**
function checkbox($id, $label, $checked=false, $instructions=null,
$value='true', $disabled=false)
{
- $this->elementStart('p');
$attrs = array('name' => $id,
'type' => 'checkbox',
'class' => 'checkbox',
'id' => $id);
if ($value) {
- $attrs['value'] = htmlspecialchars($value);
+ $attrs['value'] = $value;
}
if ($checked) {
$attrs['checked'] = 'checked';
}
$this->element('input', $attrs);
$this->text(' ');
- $this->element('label', array('class' => 'checkbox_label',
+ $this->element('label', array('class' => 'checkbox',
'for' => $id),
$label);
$this->text(' ');
if ($instructions) {
- $this->element('span', 'input_instructions', $instructions);
+ $this->element('p', 'form_guide', $instructions);
}
- $this->elementEnd('p');
}
/**
function dropdown($id, $label, $content, $instructions=null,
$blank_select=false, $selected=null)
{
- $this->elementStart('p');
$this->element('label', array('for' => $id), $label);
$this->elementStart('select', array('id' => $id, 'name' => $id));
if ($blank_select) {
foreach ($content as $value => $option) {
if ($value == $selected) {
$this->element('option', array('value' => $value,
- 'selected' => $value),
+ 'selected' => 'selected'),
$option);
} else {
$this->element('option', array('value' => $value), $option);
}
$this->elementEnd('select');
if ($instructions) {
- $this->element('span', 'input_instructions', $instructions);
+ $this->element('p', 'form_guide', $instructions);
}
- $this->elementEnd('p');
}
/**
function password($id, $label, $instructions=null)
{
- $this->elementStart('p');
$this->element('label', array('for' => $id), $label);
$attrs = array('name' => $id,
'type' => 'password',
'id' => $id);
$this->element('input', $attrs);
if ($instructions) {
- $this->element('span', 'input_instructions', $instructions);
+ $this->element('p', 'form_guide', $instructions);
}
- $this->elementEnd('p');
}
/**
* @todo add a $name parameter
*/
- function submit($id, $label, $cls='submit', $name=null)
+ function submit($id, $label, $cls='submit', $name=null, $title=null)
{
- $this->elementStart('p');
$this->element('input', array('type' => 'submit',
'id' => $id,
'name' => ($name) ? $name : $id,
'class' => $cls,
- 'value' => $label));
- $this->elementEnd('p');
+ 'value' => $label,
+ 'title' => $title));
}
/**
function textarea($id, $label, $content=null, $instructions=null)
{
- $this->elementStart('p');
$this->element('label', array('for' => $id), $label);
$this->element('textarea', array('rows' => 3,
'cols' => 40,
'id' => $id),
($content) ? $content : '');
if ($instructions) {
- $this->element('span', 'input_instructions', $instructions);
+ $this->element('p', 'form_guide', $instructions);
}
- $this->elementEnd('p');
}
}