Hide subscription controls for disabled services (IM, SMS)

This commit is contained in:
Jeffery To 2009-08-07 01:34:36 +08:00
parent 93f585446e
commit c261a645a1
1 changed files with 14 additions and 2 deletions

View File

@ -174,14 +174,26 @@ class SubscriptionsListItem extends SubscriptionListItem
return;
}
if (!common_config('xmpp', 'enabled') && !common_config('sms', 'enabled')) {
return;
}
$this->out->elementStart('form', array('id' => 'subedit-' . $this->profile->id,
'method' => 'post',
'class' => 'form_subscription_edit',
'action' => common_local_url('subedit')));
$this->out->hidden('token', common_session_token());
$this->out->hidden('profile', $this->profile->id);
$this->out->checkbox('jabber', _('Jabber'), $sub->jabber);
$this->out->checkbox('sms', _('SMS'), $sub->sms);
if (common_config('xmpp', 'enabled')) {
$this->out->checkbox('jabber', _('Jabber'), $sub->jabber);
} else {
$this->out->hidden('jabber', $sub->jabber);
}
if (common_config('sms', 'enabled')) {
$this->out->checkbox('sms', _('SMS'), $sub->sms);
} else {
$this->out->hidden('sms', $sub->sms);
}
$this->out->submit('save', _('Save'));
$this->out->elementEnd('form');
return;