/**
  * Settings page.
  *
  * @param SettingsController $sender
  */
 public function settingsController_hipChat_create($sender)
 {
     $sender->permission('Garden.Settings.Manage');
     $conf = new ConfigurationModule($sender);
     $conf->initialize(array('HipChat.Account' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('Account Name'), 'Options' => array('class' => 'InputBox LargeInput')), 'HipChat.Room' => array('Control' => 'TextBox', 'Type' => 'int', 'LabelCode' => t('Room ID'), 'Options' => array('class' => 'InputBox SmallInput')), 'HipChat.Token' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('Authorization Token'), 'Options' => array('class' => 'InputBox LargeInput'))));
     $sender->addSideMenu();
     $sender->setData('Title', sprintf(T('%s Settings'), 'HipChat'));
     $sender->ConfigurationModule = $conf;
     $conf->renderAll();
 }
Beispiel #2
0
 /**
  * The Index method of the VWP setting page.
  *
  * @param SettingsController $sender
  */
 public function Controller_Index($sender)
 {
     // Set required permission.
     $sender->permission('Garden.Settings.Manage');
     // Set up the configuration module.
     $configModule = new ConfigurationModule($sender);
     $configModule->initialize(array('VWP.Database.User' => array('LabelCode' => 'WordPress Database User', 'Control' => 'TextBox'), 'VWP.Database.Password' => array('LabelCode' => 'WordPress Database Password', 'Control' => 'TextBox'), 'VWP.Database.Name' => array('LabelCode' => 'WordPress Database Name', 'Control' => 'TextBox'), 'VWP.Database.Prefix' => array('LabelCode' => 'WordPress Database Prefix', 'Control' => 'TextBox')));
     $sender->ConfigurationModule = $configModule;
     $sender->title(T('VWP Settings'));
     $sender->addSideMenu('/settings/vwp');
     $sender->View = $sender->fetchViewLocation('vwp', 'settings', 'vwp');
     $sender->render();
 }
 /**
  *
  * @param SettingsController $Sender
  * @param array $Args
  */
 public function settingsController_editor_create($Sender, $Args)
 {
     $Sender->permission('Garden.Settings.Manage');
     $Cf = new ConfigurationModule($Sender);
     $Formats = array_combine($this->Formats, $this->Formats);
     $Cf->initialize(array('Garden.InputFormatter' => array('LabelCode' => 'Post Format', 'Control' => 'DropDown', 'Description' => '<p>Select the default format of the editor for posts in the community.</p> <p><small><strong>Note:</strong> the editor will auto-detect the format of old posts when editing them and load their original formatting rules. Aside from this exception, the selected post format below will take precedence.</small></p>', 'Items' => $Formats), 'Plugins.editor.ForceWysiwyg' => array('LabelCode' => 'Reinterpret All Posts As Wysiwyg', 'Control' => 'Checkbox', 'Description' => '<p>Check the below option to tell the editor to reinterpret all old posts as Wysiwyg.</p> <p><small><strong>Note:</strong> This setting will only take effect if Wysiwyg was chosen as the Post Format above. The purpose of this option is to normalize the editor format. If older posts edited with another format, such as markdown or BBCode, are loaded, this option will force Wysiwyg.</p>'), 'Garden.MobileInputFormatter' => array('LabelCode' => 'Mobile Format', 'Control' => 'DropDown', 'Description' => '<p>Specify an editing format for mobile devices. If mobile devices should have the same experience, specify the same one as above. If users report issues with mobile editing, this is a good option to change.</p>', 'Items' => $Formats, 'DefaultValue' => c('Garden.MobileInputFormatter'))));
     // Add some JS and CSS to blur out option when Wysiwyg not chosen.
     $c = Gdn::controller();
     $c->addJsFile('settings.js', 'plugins/editor');
     $Sender->addCssFile('settings.css', 'plugins/editor');
     $Sender->addSideMenu();
     $Sender->setData('Title', t('Advanced Editor Settings'));
     $Cf->renderAll();
 }
 /**
  * List all tags and allow searching
  *
  * @param SettingsController $Sender
  */
 public function settingsController_tagging_create($Sender, $Search = null, $Type = null, $Page = null)
 {
     $Sender->title('Tagging');
     $Sender->addSideMenu('settings/tagging');
     $Sender->addJSFile('tagadmin.js', 'plugins/Tagging');
     $SQL = Gdn::sql();
     // Get all tag types
     $TagModel = TagModel::instance();
     $TagTypes = $TagModel->getTagTypes();
     $Sender->Form->Method = 'get';
     $Sender->Form->InputPrefix = '';
     list($Offset, $Limit) = offsetLimit($Page, 100);
     $Sender->setData('_Limit', $Limit);
     if ($Search) {
         $SQL->like('FullName', $Search, 'right');
     }
     // This type doesn't actually exist, but it will represent the
     // blank types in the column.
     if (strtolower($Type) == 'tags') {
         $Type = '';
     }
     if (!$Search) {
         if ($Type !== null) {
             if ($Type === 'null') {
                 $Type = null;
             }
             $SQL->where('Type', $Type);
         } elseif ($Type == '') {
             $SQL->where('Type', '');
         }
     } else {
         $Type = 'Search Results';
         // This is made up, and exists so search results can be placed in
         // their own tab.
         $TagTypes[$Type] = array('key' => $Type);
     }
     $TagTypes = array_change_key_case($TagTypes, CASE_LOWER);
     // Store type for view
     $TagType = !empty($Type) ? $Type : 'Tags';
     $Sender->setData('_TagType', $TagType);
     // Store tag types
     $Sender->setData('_TagTypes', $TagTypes);
     // Determine if new tags can be added for the current type.
     $CanAddTags = !empty($TagTypes[$Type]['addtag']) && $TagTypes[$Type]['addtag'] ? 1 : 0;
     $CanAddTags &= CheckPermission('Plugins.Tagging.Add');
     $Sender->setData('_CanAddTags', $CanAddTags);
     $Data = $SQL->select('t.*')->from('Tag t')->orderBy('t.FullName', 'asc')->orderBy('t.CountDiscussions', 'desc')->limit($Limit, $Offset)->get()->resultArray();
     $Sender->setData('Tags', $Data);
     if ($Search) {
         $SQL->like('Name', $Search, 'right');
     }
     // Make sure search uses its own search type, so results appear
     // in their own tab.
     $Sender->Form->Action = url('/settings/tagging/?type=' . $TagType);
     // Search results pagination will mess up a bit, so don't provide a type
     // in the count.
     $RecordCountWhere = array('Type' => $Type);
     if ($Type == '') {
         $RecordCountWhere = array('Type' => '');
     }
     if ($Search) {
         $RecordCountWhere = array();
     }
     $Sender->setData('RecordCount', $SQL->getCount('Tag', $RecordCountWhere));
     $Sender->render('tagging', '', 'plugins/Tagging');
 }
 /**
  * AgeGate settings page.
  *
  * @param SettingsController $sender
  */
 public function settingsController_ageGate_create($sender)
 {
     $sender->permission('Garden.Settings.Manage');
     $sender->setData('Title', T('Age Gate Settings'));
     $sender->addSideMenu();
     if ($sender->Form->authenticatedPostBack()) {
         $minimumAge = $sender->Form->getValue('MinimumAge');
         $addConfirmation = $sender->Form->getValue('AddConfirmation');
         if (!is_numeric($minimumAge)) {
             $sender->Form->addError('Please enter a valid number.');
         }
         if ($sender->Form->errorCount() == 0) {
             saveToConfig('Plugins.AgeGate.MinimumAge', $minimumAge);
             saveToConfig('Plugins.AgeGate.AddConfirmation', $addConfirmation);
             $sender->informMessage(T('Saved'));
         }
     } else {
         $sender->Form->setData(array('MinimumAge' => C('Plugins.AgeGate.MinimumAge'), 'AddConfirmation' => C('Plugins.AgeGate.AddConfirmation')));
     }
     $sender->render($sender->fetchViewLocation('settings', '', 'plugins/AgeGate'));
 }
 /**
  *
  *
  * @param SettingsController $Sender
  * @param type $Args
  */
 public function settingsController_disqus_create($Sender, $Args)
 {
     $Sender->permission('Garden.Settings.Manage');
     if ($Sender->Form->authenticatedPostBack()) {
         $Model = new Gdn_AuthenticationProviderModel();
         $Sender->Form->setFormValue(Gdn_AuthenticationProviderModel::COLUMN_ALIAS, 'disqus');
         $Sender->Form->setFormValue(Gdn_AuthenticationProviderModel::COLUMN_NAME, 'Disqus');
         $Sender->Form->setModel($Model);
         if ($Sender->Form->save(array('PK' => Gdn_AuthenticationProviderModel::COLUMN_ALIAS))) {
             $Sender->informMessage(t("Your settings have been saved."));
         }
     } else {
         $Provider = (array) $this->provider();
         $Sender->Form->setData($Provider);
     }
     $Sender->addSideMenu();
     $Sender->setData('Title', sprintf(t('%s Settings'), 'Disqus'));
     $Sender->render('Settings', '', 'plugins/Disqus');
 }
 /**
  * Configure settings page in dashboard.
  *
  * @param SettingsController $sender
  * @param array $args
  */
 public function settingsController_emojiExtender_create($sender, $args)
 {
     $cf = new ConfigurationModule($sender);
     $items = array();
     foreach ($this->getEmojiSets() as $key => $emojiSet) {
         $manifest = $this->getManifest($emojiSet);
         $icon = isset($manifest['icon']) ? img($emojiSet['basePath'] . '/' . $manifest['icon'], array('alt' => $manifest['name'])) : '';
         $items[$key] = '@' . $icon . '<div emojiset-body>' . '<div><b>' . htmlspecialchars($manifest['name']) . '</b></div>' . (empty($manifest['author']) ? '' : '<div class="emojiset-author">' . sprintf(t('by %s'), $manifest['author']) . '</div>') . (empty($manifest['description']) ? '' : '<p class="emojiset-description">' . Gdn_Format::wysiwyg($manifest['description']) . '</p>') . '</div>';
     }
     $cf->initialize(array('Garden.EmojiSet' => array('LabelCode' => 'Emoji Set', 'Control' => 'radiolist', 'Description' => '<p>Which emoji set would you like to use?</p>', 'Items' => $items, 'Options' => array('list' => true, 'listclass' => 'emojiext-list', 'display' => 'after'))));
     $sender->addCssFile('settings.css', 'plugins/EmojiExtender');
     $sender->addSideMenu();
     $sender->setData('Title', sprintf(t('%s Settings'), 'Emoji'));
     $cf->renderAll();
 }
 /**
  * Settings page.
  *
  * @param SettingsController $Sender
  */
 public function settingsController_akismet_create($Sender)
 {
     // Allow for master hosted key
     $KeyDesc = 'Enter the key you obtained from <a href="http://akismet.com">akismet.com</a>';
     if (c('Plugins.Akismet.MasterKey')) {
         $KeyDesc = 'No key is required! You may optionally use your own.';
     }
     $Sender->permission('Garden.Settings.Manage');
     $Sender->setData('Title', t('Akismet Settings'));
     $Cf = new ConfigurationModule($Sender);
     // Do key validation so we don't break our entire site.
     // Always allow a blank key, because the plugin turns off in that scenario.
     if (Gdn::request()->isAuthenticatedPostBack()) {
         $key = $Cf->form()->getFormValue('Plugins.Akismet.Key');
         if ($key !== '' && !$this->validateKey($key)) {
             $Cf->form()->addError('Key is invalid.');
         }
     }
     // Settings to be shown.
     $options = ['Plugins.Akismet.Key' => ['Description' => $KeyDesc]];
     // Deprecated TypePad option should go away if it's not already set.
     if (c('Plugins.Akismet.Server')) {
         $options['Plugins.Akismet.Server'] = ['Description' => 'You can use either Akismet or TypePad antispam.', 'Control' => 'DropDown', 'Items' => ['' => 'Akismet', 'api.antispam.typepad.com' => 'TypePad']];
     }
     $Cf->initialize($options);
     $Sender->addSideMenu('settings/plugins');
     $Cf->renderAll();
 }
 /**
  * Settings page.
  *
  * @param SettingsController $sender
  */
 public function settingsController_sprintnotifier_create($sender)
 {
     $sender->permission('Garden.Settings.Manage');
     $conf = new ConfigurationModule($sender);
     $conf->initialize(array('SprintNotifier.Teamwork.BustCacheUrl' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('Remote URL for sprint tracker cache buster'), 'Options' => array('class' => 'InputBox LargeInput')), 'SprintNotifier.Teamwork.Secret' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('Secret Token'), 'Options' => array('class' => 'InputBox LargeInput')), 'Teamwork.Account' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('Teamwork Account Slug'), 'Options' => array('class' => 'InputBox LargeInput')), 'Teamwork.API.Token' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('Teamwork API Token'), 'Options' => array('class' => 'InputBox LargeInput')), 'SprintNotifier.HipChat.Token' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('HipChat API Token'), 'Options' => array('class' => 'InputBox LargeInput')), 'SprintNotifier.HipChat.RoomID' => array('Control' => 'TextBox', 'Type' => 'int', 'LabelCode' => t('HipChat RoomID to notify'), 'Options' => array('class' => 'InputBox LargeInput'))));
     $sender->addSideMenu();
     $sender->setData('Title', sprintf(T('%s Settings'), 'Sprint Notifier'));
     $sender->ConfigurationModule = $conf;
     $conf->renderAll();
 }
Beispiel #10
0
 /**
  * Render the settings menu in the dashboard
  *
  * This function sets up and renders a settings page where the API
  * configuration can be changed.
  *
  * @since  0.1.0
  * @access public
  * @param  SettingsController $sender
  * @return void
  */
 public function SettingsController_API_create($sender)
 {
     $sender->permission("Garden.Settings.Manage");
     $form = $sender->Form;
     if ($form->authenticatedPostBack()) {
         $secret = c("API.Secret");
         $regen = $form->buttonExists(t("API.Settings.Refresh.Label"));
         if ($regen) {
             $secret = APIAuth::generateUniqueID();
         }
         $save = [];
         $save["API.Secret"] = $secret;
         if ($form->errorCount() == 0) {
             saveToConfig($save);
             if ($regen) {
                 $icon = "<span class=\"InformSprite Refresh\"></span>";
                 $text = t("API.Settings.Refresh.Notification");
                 $class = "Dismissable HasSprite";
                 $sender->informMessage($icon . $text, $class);
             }
         }
     } else {
         $data = [];
         $data["Secret"] = c("API.Secret");
         $form->setData($data);
     }
     $sender->addSideMenu();
     $sender->setData("Title", t("API.Settings.Title"));
     $sender->render("API", "settings", "api");
 }
 /**
  *
  *
  * @param SettingsController $Sender
  * @param array $Args
  */
 public function settingsController_jsConnect_create($Sender, $Args = array())
 {
     $Sender->addJsFile('jsconnect-settings.js', 'plugins/jsconnect');
     $Sender->permission('Garden.Settings.Manage');
     $Sender->addSideMenu();
     switch (strtolower(val(0, $Args))) {
         case 'addedit':
             $this->settings_addEdit($Sender, $Args);
             break;
         case 'delete':
             $this->settings_delete($Sender, $Args);
             break;
         default:
             $this->settings_index($Sender, $Args);
             break;
     }
 }