/** * The settings page for vanillicon. * * @param Gdn_Controller $sender */ public function settingsController_vanillicon_create($sender) { $sender->permission('Garden.Settings.Manage'); $cf = new ConfigurationModule($sender); $items = array('v1' => 'Vanillicon 1', 'v2' => 'Vanillicon 2 (beta)'); $cf->initialize(array('Plugins.Vanillicon.Type' => array('LabelCode' => 'Vanillicon Set', 'Control' => 'radiolist', 'Description' => 'Which vanillicon set do you want to use?', 'Items' => $items, 'Options' => array('list' => true, 'listclass' => 'icon-list', 'display' => 'after'), 'Default' => 'v1'))); $sender->addSideMenu(); $sender->setData('Title', sprintf(t('%s Settings'), 'Vanillicon')); $cf->renderAll(); }
/** * Edit a Tag * * @param Gdn_Controller $Sender */ public function controller_edit($Sender) { $Sender->addSideMenu('settings/tagging'); $Sender->title(t('Edit Tag')); $TagID = val(1, $Sender->RequestArgs); // Set the model on the form. $TagModel = new TagModel(); $Sender->Form->setModel($TagModel); $Tag = $TagModel->getID($TagID); $Sender->Form->setData($Tag); // Make sure the form knows which item we are editing. $Sender->Form->addHidden('TagID', $TagID); if ($Sender->Form->authenticatedPostBack()) { // Make sure the tag is valid $TagData = $Sender->Form->getFormValue('Name'); if (!TagModel::validateTag($TagData)) { $Sender->Form->addError('@' . t('ValidateTag', 'Tags cannot contain commas.')); } // Make sure that the tag name is not already in use. if ($TagModel->getWhere(array('TagID <>' => $TagID, 'Name' => $TagData))->numRows() > 0) { $Sender->setData('MergeTagVisible', true); if (!$Sender->Form->getFormValue('MergeTag')) { $Sender->Form->addError('The specified tag name is already in use.'); } } if ($Sender->Form->Save()) { $Sender->informMessage(t('Your changes have been saved.')); } } $Sender->render('addedit', '', 'plugins/Tagging'); }
/** * The settings page for vanillicon. * * @param Gdn_Controller $sender */ public function settingsController_vanillicon_create($sender) { $sender->permission('Garden.Settings.Manage'); $cf = new ConfigurationModule($sender); $items = array('v1' => 'Vanillicon 1', 'v2' => 'Vanillicon 2 (beta)'); $cachePath = self::getCachePath(); $writable = is_writable($cachePath); $txtNotWritable = '<p style="color: #c00;">' . T('<b>Warning:</b> the cache directory is not writable. If you want to use the cache mechanism, you have to enable write permissions for') . '</p><code>' . $cachePath . '</code><br><br><br>'; $txtProxyActive = '<p style="color: #090;">' . T('<b>Congratulations: The privacy of your users is respected!</b> All requests to vanillicon.com are made by your server and not by your users.') . '</p><br>'; $cf->initialize(array('Plugins.Vanillicon.Type' => array('LabelCode' => 'Vanillicon Proxy', 'Control' => 'radiolist', 'Description' => $txtProxyActive . ($writable ? '' : $txtNotWritable) . ' ' . T('Which vanillicon set do you want to use?'), 'Items' => $items, 'Options' => array('list' => true, 'listclass' => 'icon-list', 'display' => 'after'), 'Default' => 'v1'))); $sender->addSideMenu(); $sender->setData('Title', sprintf(t('%s Settings'), 'Vanillicon')); $cf->renderAll(); }