show checkbox as checked or not
darcs-hash:20080626182705-34904-893d72f480c330beb2d8f871da0d2cd9b902ffbf.gz
This commit is contained in:
parent
1152a0f680
commit
f5caccc827
@ -79,9 +79,11 @@ class ImsettingsAction extends SettingsAction {
|
|||||||
common_element('h2', NULL, _t('Preferences'));
|
common_element('h2', NULL, _t('Preferences'));
|
||||||
|
|
||||||
common_checkbox('jabbernotify',
|
common_checkbox('jabbernotify',
|
||||||
_t('Send me notices through Jabber/GTalk.'));
|
_t('Send me notices through Jabber/GTalk.'),
|
||||||
|
$user->jabbernotify);
|
||||||
common_checkbox('updatefrompresence',
|
common_checkbox('updatefrompresence',
|
||||||
_t('Post a notice when my Jabber/GTalk status changes.'));
|
_t('Post a notice when my Jabber/GTalk status changes.'),
|
||||||
|
$user->updatefrompresence);
|
||||||
common_submit('save', _t('Save'));
|
common_submit('save', _t('Save'));
|
||||||
|
|
||||||
common_element_end('form');
|
common_element_end('form');
|
||||||
|
@ -319,16 +319,18 @@ function common_input($id, $label, $value=NULL,$instructions=NULL) {
|
|||||||
common_element_end('p');
|
common_element_end('p');
|
||||||
}
|
}
|
||||||
|
|
||||||
function common_checkbox($id, $label, $instructions=NULL, $value='true')
|
function common_checkbox($id, $label, $checked=false, $instructions=NULL, $value='true')
|
||||||
{
|
{
|
||||||
common_element_start('p');
|
common_element_start('p');
|
||||||
$attrs = array('name' => $id,
|
$attrs = array('name' => $id,
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'id' => $id,
|
'id' => $id);
|
||||||
'value' => $value);
|
|
||||||
if ($value) {
|
if ($value) {
|
||||||
$attrs['value'] = htmlspecialchars($value);
|
$attrs['value'] = htmlspecialchars($value);
|
||||||
}
|
}
|
||||||
|
if ($checked) {
|
||||||
|
$attrs['checked'] = 'checked';
|
||||||
|
}
|
||||||
common_element('input', $attrs);
|
common_element('input', $attrs);
|
||||||
# XXX: use a <label>
|
# XXX: use a <label>
|
||||||
common_text(' ');
|
common_text(' ');
|
||||||
|
Loading…
Reference in New Issue
Block a user