X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fpathsadminpanel.php;h=57f82e799538c717d72af11d87b79e05a21022b8;hb=31c8416a8f97a7fa7bd8e84252403d00f669a759;hp=9155a7e42856ae19b61b405973c5de83aa3b3d5e;hpb=914bc9f9c5ce29584e00553104ac991e6e178e7b;p=quix0rs-gnu-social.git diff --git a/actions/pathsadminpanel.php b/actions/pathsadminpanel.php index 9155a7e428..57f82e7995 100644 --- a/actions/pathsadminpanel.php +++ b/actions/pathsadminpanel.php @@ -24,7 +24,7 @@ * @author Evan Prodromou * @author Zach Copley * @author Sarven Capadisli - * @copyright 2008-2010 StatusNet, Inc. + * @copyright 2008-2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -44,10 +44,8 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class PathsadminpanelAction extends AdminPanelAction { - /** * Returns the page title * @@ -56,6 +54,7 @@ class PathsadminpanelAction extends AdminPanelAction function title() { + // TRANS: Title for Paths admin panel. return _('Paths'); } @@ -64,10 +63,10 @@ class PathsadminpanelAction extends AdminPanelAction * * @return string instructions */ - function getInstructions() { - return _('Path and server settings for this StatusNet site.'); + // TRANS: Form instructions for Path admin panel. + return _('Path and server settings for this StatusNet site'); } /** @@ -75,7 +74,6 @@ class PathsadminpanelAction extends AdminPanelAction * * @return void */ - function showForm() { $form = new PathsAdminPanelForm($this); @@ -88,20 +86,19 @@ class PathsadminpanelAction extends AdminPanelAction * * @return void */ - function saveSettings() { static $settings = array( - 'site' => array('path', 'locale_path', 'ssl', 'sslserver'), - 'theme' => array('server', 'dir', 'path'), - 'avatar' => array('server', 'dir', 'path'), - 'background' => array('server', 'dir', 'path') - ); + 'site' => array('path', 'locale_path', 'ssl', 'sslserver'), + 'theme' => array('server', 'dir', 'path', 'sslserver', 'sslpath'), + 'avatar' => array('server', 'dir', 'path'), + 'attachments' => array('server', 'dir', 'path', 'sslserver', 'sslpath') + ); - // XXX: If we're only going to have one boolean on thi page we - // can remove some of the boolean processing code --Z + // XXX: If we're only going to have one boolean on thi page we + // can remove some of the boolean processing code --Z - static $booleans = array('site' => array('fancy')); + static $booleans = array('site' => array('fancy')); $values = array(); @@ -131,13 +128,13 @@ class PathsadminpanelAction extends AdminPanelAction } } - foreach ($booleans as $section => $parts) { - foreach ($parts as $setting) { + foreach ($booleans as $section => $parts) { + foreach ($parts as $setting) { Config::save($section, $setting, $values[$section][$setting]); } - } + } - $config->query('COMMIT'); + $config->query('COMMIT'); return; } @@ -147,26 +144,22 @@ class PathsadminpanelAction extends AdminPanelAction * * @return void */ - function validate(&$values) { - // Validate theme dir if (!empty($values['theme']['dir']) && !is_readable($values['theme']['dir'])) { - $this->clientError(sprintf(_("Theme directory not readable: %s"), $values['theme']['dir'])); + // TRANS: Client error in Paths admin panel. + // TRANS: %s is the directory that could not be read from. + $this->clientError(sprintf(_('Theme directory not readable: %s.'), $values['theme']['dir'])); } // Validate avatar dir if (empty($values['avatar']['dir']) || !is_writable($values['avatar']['dir'])) { - $this->clientError(sprintf(_("Avatar directory not writable: %s"), $values['avatar']['dir'])); - } - - // Validate background dir - - if (empty($values['background']['dir']) || !is_writable($values['background']['dir'])) { - $this->clientError(sprintf(_("Background directory not writable: %s"), $values['background']['dir'])); + // TRANS: Client error in Paths admin panel. + // TRANS: %s is the avatar directory that could not be written to. + $this->clientError(sprintf(_('Avatar directory not writable: %s.'), $values['avatar']['dir'])); } // Validate locales dir @@ -174,27 +167,28 @@ class PathsadminpanelAction extends AdminPanelAction // XXX: What else do we need to validate for lacales path here? --Z if (!empty($values['site']['locale_path']) && !is_readable($values['site']['locale_path'])) { - $this->clientError(sprintf(_("Locales directory not readable: %s"), $values['site']['locale_path'])); + // TRANS: Client error in Paths admin panel. + // TRANS: %s is the locales directory that could not be read from. + $this->clientError(sprintf(_('Locales directory not readable: %s.'), $values['site']['locale_path'])); } // Validate SSL setup if (mb_strlen($values['site']['sslserver']) > 255) { - $this->clientError(_("Invalid SSL server. The maximum length is 255 characters.")); + // TRANS: Client error in Paths admin panel. + // TRANS: %s is the SSL server URL that is too long. + $this->clientError(_('Invalid SSL server. The maximum length is 255 characters.')); } } - } class PathsAdminPanelForm extends AdminForm { - /** * ID of the form * * @return int ID of the form */ - function id() { return 'form_paths_admin_panel'; @@ -205,7 +199,6 @@ class PathsAdminPanelForm extends AdminForm * * @return string class of the form */ - function formClass() { return 'form_settings'; @@ -216,7 +209,6 @@ class PathsAdminPanelForm extends AdminForm * * @return string URL of the action */ - function action() { return common_local_url('pathsadminpanel'); @@ -227,69 +219,135 @@ class PathsAdminPanelForm extends AdminForm * * @return void */ - function formData() { - $this->out->elementStart('fieldset', array('id' => 'settings_paths_locale')); + $this->out->elementStart('fieldset', array('id' => 'settings_paths_locale')); + // TRANS: Fieldset legend in Paths admin panel. $this->out->element('legend', null, _('Site'), 'site'); $this->out->elementStart('ul', 'form_data'); - $this->li(); - $this->input('server', _('Server'), _('Site\'s server hostname.')); + $this->li(); + $this->input('server', + // TRANS: Field label in Paths admin panel. + _('Server'), + // TRANS: Field title in Paths admin panel. + _('Site\'s server hostname.')); $this->unli(); $this->li(); - $this->input('path', _('Path'), _('Site path')); + $this->input('path', + // TRANS: Field label in Paths admin panel. + _('Path'), + // TRANS: Field title in Paths admin panel. + _('Site path.')); $this->unli(); $this->li(); - $this->input('locale_path', _('Path to locales'), _('Directory path to locales'), 'site'); + $this->input('locale_path', + // TRANS: Field label in Paths admin panel. + _('Locale directory'), + // TRANS: Field title in Paths admin panel. + _('Directory path to locales.'), + 'site'); $this->unli(); - $this->li(); - $this->out->checkbox('fancy', _('Fancy URLs'), + $this->li(); + $this->out->checkbox('fancy', + // TRANS: Checkbox label in Paths admin panel. + _('Fancy URLs'), (bool) $this->value('fancy'), - _('Use fancy (more readable and memorable) URLs?')); - $this->unli(); + // TRANS: Field title in Paths admin panel. + _('Use fancy URLs (more readable and memorable)?')); + $this->unli(); $this->out->elementEnd('ul'); $this->out->elementEnd('fieldset'); $this->out->elementStart('fieldset', array('id' => 'settings_paths_theme')); - $this->out->element('legend', null, _('Theme')); + // TRANS: Fieldset legend in Paths admin panel. + $this->out->element('legend', null, _m('LEGEND','Theme')); $this->out->elementStart('ul', 'form_data'); $this->li(); - $this->input('server', _('Theme server'), 'Server for themes', 'theme'); + $this->input('server', + // TRANS: Field label in Paths admin panel. + _('Server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Server for themes.'), + 'theme'); + $this->unli(); + + $this->li(); + $this->input('path', + // TRANS: Field label in Paths admin panel. + _('Path'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Web path to themes.'), + 'theme'); + $this->unli(); + + $this->li(); + $this->input('sslserver', + // TRANS: Field label in Paths admin panel. + _('SSL server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('SSL server for themes (default: SSL server).'), + 'theme'); $this->unli(); $this->li(); - $this->input('path', _('Theme path'), 'Web path to themes', 'theme'); + $this->input('sslpath', + // TRANS: Field label in Paths admin panel. + _('SSL path'), + // TRANS: Tooltip for field label in Paths admin panel. + _('SSL path to themes (default: /theme/).'), + 'theme'); $this->unli(); $this->li(); - $this->input('dir', _('Theme directory'), 'Directory where themes are located', 'theme'); + $this->input('dir', + // TRANS: Field label in Paths admin panel. + _('Directory'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Directory where themes are located.'), + 'theme'); $this->unli(); $this->out->elementEnd('ul'); $this->out->elementEnd('fieldset'); $this->out->elementStart('fieldset', array('id' => 'settings_avatar-paths')); + // TRANS: Fieldset legend in Paths admin panel. $this->out->element('legend', null, _('Avatars')); $this->out->elementStart('ul', 'form_data'); $this->li(); - $this->input('server', _('Avatar server'), 'Server for avatars', 'avatar'); + $this->input('server', + // TRANS: Field label in Paths admin panel. + _('Avatar server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Server for avatars.'), + 'avatar'); $this->unli(); $this->li(); - $this->input('path', _('Avatar path'), 'Web path to avatars', 'avatar'); + $this->input('path', + // TRANS: Field label in Paths admin panel. + _('Avatar path'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Web path to avatars.'), + 'avatar'); $this->unli(); $this->li(); - $this->input('dir', _('Avatar directory'), 'Directory where avatars are located', 'avatar'); + $this->input('dir', + // TRANS: Field label in Paths admin panel. + _('Avatar directory'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Directory where avatars are located.'), + 'avatar'); $this->unli(); $this->out->elementEnd('ul'); @@ -297,47 +355,92 @@ class PathsAdminPanelForm extends AdminForm $this->out->elementEnd('fieldset'); $this->out->elementStart('fieldset', array('id' => - 'settings_design_background-paths')); - $this->out->element('legend', null, _('Backgrounds')); + 'settings_attachments-paths')); + + // TRANS: Fieldset legens in Paths admin panel. + $this->out->element('legend', null, _('Attachments')); $this->out->elementStart('ul', 'form_data'); $this->li(); - $this->input('server', _('Background server'), 'Server for backgrounds', 'background'); + $this->input('server', + // TRANS: Field label in Paths admin panel. + _('Server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Server for attachments.'), + 'attachments'); + $this->unli(); + + $this->li(); + $this->input('path', + // TRANS: Field label in Paths admin panel. + _('Path'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Web path to attachments.'), + 'attachments'); $this->unli(); $this->li(); - $this->input('path', _('Background path'), 'Web path to backgrounds', 'background'); + $this->input('sslserver', + // TRANS: Field label in Paths admin panel. + _('SSL server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Server for attachments on SSL pages.'), + 'attachments'); $this->unli(); $this->li(); - $this->input('dir', _('Background directory'), 'Directory where backgrounds are located', 'background'); + $this->input('sslpath', + // TRANS: Field label in Paths admin panel. + _('SSL path'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Web path to attachments on SSL pages.'), + 'attachments'); + $this->unli(); + + $this->li(); + $this->input('dir', + // TRANS: Field label in Paths admin panel. + _('Directory'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Directory where attachments are located.'), + 'attachments'); $this->unli(); $this->out->elementEnd('ul'); $this->out->elementEnd('fieldset'); $this->out->elementStart('fieldset', array('id' => 'settings_admin_ssl')); - $this->out->element('legend', null, _('SSL')); + // TRANS: Fieldset legend in Paths admin panel. + $this->out->element('legend', null, _m('LEGEND','SSL')); $this->out->elementStart('ul', 'form_data'); $this->li(); + + // TRANS: Drop down option in Paths admin panel (option for "When to use SSL"). $ssl = array('never' => _('Never'), + // TRANS: Drop down option in Paths admin panel (option for "When to use SSL"). 'sometimes' => _('Sometimes'), + // TRANS: Drop down option in Paths admin panel (option for "When to use SSL"). 'always' => _('Always')); - common_debug("site ssl = " . $this->value('site', 'ssl')); - - $this->out->dropdown('site-ssl', _('Use SSL'), - $ssl, _('When to use SSL'), - false, $this->value('ssl', 'site')); + $this->out->dropdown('site-ssl', + // TRANS: Drop down label in Paths admin panel. + _('Use SSL'), + // TRANS: Tooltip for field label in Paths admin panel. + $ssl, _('When to use SSL.'), + false, + $this->value('ssl', 'site')); $this->unli(); $this->li(); - $this->input('sslserver', _('SSL server'), - _('Server to direct SSL requests to'), 'site'); + $this->input('sslserver', + // TRANS: Field label in Paths admin panel. + _('SSL server'), + // TRANS: Tooltip for field label in Paths admin panel. + _('Server to direct SSL requests to.'), + 'site'); $this->unli(); $this->out->elementEnd('ul'); $this->out->elementEnd('fieldset'); - } /** @@ -345,11 +448,12 @@ class PathsAdminPanelForm extends AdminForm * * @return void */ - function formActions() { - $this->out->submit('save', _('Save'), 'submit', - 'save', _('Save paths')); + // TRANS: Button text to store form data in the Paths admin panel. + $this->out->submit('save', _m('BUTTON','Save'), 'submit', + // TRANS: Button title text to store form data in the Paths admin panel. + 'save', _('Save path settings.')); } /** @@ -365,10 +469,8 @@ class PathsAdminPanelForm extends AdminForm * * @return void */ - function input($setting, $title, $instructions, $section='site') { $this->out->input("$section-$setting", $title, $this->value($setting, $section), $instructions); } - }