Do not show the URL shortener selection drop down if no shorteners are available

This commit is contained in:
Craig Andrews 2009-11-11 17:05:24 -05:00
parent 1c4bacf7bc
commit 23290f746f

View File

@ -96,6 +96,7 @@ class OthersettingsAction extends AccountSettingsAction
common_local_url('othersettings'))); common_local_url('othersettings')));
$this->elementStart('fieldset'); $this->elementStart('fieldset');
$this->hidden('token', common_session_token()); $this->hidden('token', common_session_token());
$this->elementStart('ul', 'form_data');
Event::handle('GetUrlShorteners', array(&$shorteners)); Event::handle('GetUrlShorteners', array(&$shorteners));
foreach($shorteners as $name=>$value) foreach($shorteners as $name=>$value)
@ -105,14 +106,16 @@ class OthersettingsAction extends AccountSettingsAction
$services[$name].=_(' (free service)'); $services[$name].=_(' (free service)');
} }
} }
if($services)
{
asort($services); asort($services);
$this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->dropdown('urlshorteningservice', _('Shorten URLs with'), $this->dropdown('urlshorteningservice', _('Shorten URLs with'),
$services, _('Automatic shortening service to use.'), $services, _('Automatic shortening service to use.'),
false, $user->urlshorteningservice); false, $user->urlshorteningservice);
$this->elementEnd('li'); $this->elementEnd('li');
}
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('viewdesigns', _('View profile designs'), $this->checkbox('viewdesigns', _('View profile designs'),
$user->viewdesigns, _('Show or hide profile designs.')); $user->viewdesigns, _('Show or hide profile designs.'));