Exemplo n.º 1
0
 /**
  * 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 3
0
 /**
  *
  * @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();
 }
 /**
  * Configure settings page in dashboard.
  *
  * @param SettingsController $sender
  * @param array $args
  */
 public function settingsController_emojiExtender_create($sender, $args)
 {
     $sender->permission('Garden.Settings.Manage');
     $cf = new ConfigurationModule($sender);
     $items = array();
     foreach ($this->getEmojiSets() as $key => $emojiSet) {
         $manifest = $this->getManifest($emojiSet);
         $selected = '<svg class="icon icon-svg-checkmark" viewBox="0 0 17 17"><use xlink:href="#checkmark" /></svg>';
         $icon = isset($manifest['icon']) ? img($emojiSet['basePath'] . '/' . $manifest['icon'], array('alt' => $manifest['name'], 'class' => 'label-selector-image')) : '';
         $items[$key] = '@<div class="image-wrap">' . $icon . '<div class="overlay">' . '<div class="buttons">' . '<a class="btn btn-overlay">' . t('Select') . '</a>' . '</div>' . '<div class="selected">' . $selected . '</div>' . '</div>' . '</div>' . '<div emojiset-body>' . '<div><b>' . htmlspecialchars($manifest['name']) . '</b></div>' . (empty($manifest['author']) ? '' : '<div class="emojiset-author info">' . 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', 'Items' => $items, 'Options' => array('list' => true, 'list-item-class' => 'label-selector-item', 'listclass' => 'emojiext-list label-selector', 'display' => 'after', 'class' => 'label-selector-input', 'no-grid' => true))));
     $sender->setData('Title', t('Choose Your Emoji Set'));
     $cf->renderAll();
 }
Exemplo n.º 5
0
 /**
  * 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'));
 }
Exemplo n.º 6
0
 /**
  * Override the index of the dashboard's settings controller in the to render new statistics.
  *
  * @param SettingsController $sender Instance of the dashboard's settings controller.
  */
 public function settingsController_home_create($sender)
 {
     $statsUrl = $this->AnalyticsServer;
     if (!stringBeginsWith($statsUrl, 'http:') && !stringBeginsWith($statsUrl, 'https:')) {
         $statsUrl = Gdn::request()->scheme() . "://{$statsUrl}";
     }
     Gdn_Theme::section('DashboardHome');
     $sender->setData('IsWidePage', true);
     // Tell the page where to find the Vanilla Analytics provider
     $sender->addDefinition('VanillaStatsUrl', $statsUrl);
     $sender->setData('VanillaStatsUrl', $statsUrl);
     // Load javascript & css, check permissions, and load side menu for this page.
     $sender->addJsFile('settings.js');
     $sender->title(t('Dashboard'));
     $sender->RequiredAdminPermissions = ['Garden.Settings.View', 'Garden.Settings.Manage', 'Garden.Community.Manage'];
     $sender->fireEvent('DefineAdminPermissions');
     $sender->permission($sender->RequiredAdminPermissions, '', false);
     $sender->setHighlightRoute('dashboard/settings');
     if (!Gdn_Statistics::checkIsEnabled() && Gdn_Statistics::checkIsLocalhost()) {
         $sender->render('dashboardlocalhost', '', 'plugins/VanillaStats');
     } else {
         $sender->addCssFile('picker.css', 'plugins/VanillaStats');
         $sender->addCssFile('vendors/c3.min.css', 'plugins/VanillaStats');
         $sender->addJsFile('vanillastats.js', 'plugins/VanillaStats');
         $sender->addJsFile('picker.js', 'plugins/VanillaStats');
         $sender->addJsFile('d3.min.js');
         $sender->addJsFile('c3.min.js');
         $sender->addDefinition('VanillaID', Gdn::installationID());
         $sender->addDefinition('AuthToken', Gdn_Statistics::generateToken());
         $sender->addDefinition('ExpandText', t('more'));
         $sender->addDefinition('CollapseText', t('less'));
         // Render the custom dashboard view
         $sender->render('dashboard', '', 'plugins/VanillaStats');
     }
 }
Exemplo n.º 7
0
 /**
  *
  *
  * @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');
 }
Exemplo n.º 8
0
 /**
  * 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();
 }
Exemplo n.º 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");
 }
Exemplo n.º 11
0
 /**
  *
  *
  * @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;
     }
 }