Example #1
0
 /**
  * Configuration form for the Charcoal theme
  **/
 public function action_theme_ui($theme)
 {
     $ui = new FormUI(__CLASS__);
     // This is a fudge as I only need to add a little bit of styling to make things look nice.
     $ui->append('static', 'style', '<style type="text/css">#charcoal .formcontrol { line-height: 2.2em; }</style>');
     $ui->append('checkbox', 'show_title_image', __CLASS__ . '__show_title_image', _t('Show Title Image:'), 'optionscontrol_checkbox');
     $ui->show_title_image->helptext = _t('Check to show the title image, uncheck to display the title text.');
     $ui->append('text', 'home_label', __CLASS__ . '__home_label', _t('Home label:'), 'optionscontrol_text');
     $ui->home_label->helptext = _t('Set to whatever you want your first tab text to be.');
     $ui->append('checkbox', 'show_entry_paperclip', __CLASS__ . '__show_entry_paperclip', _t('Show Entry Paperclip:'), 'optionscontrol_checkbox');
     $ui->show_entry_paperclip->helptext = _t('Check to show the paperclip graphic in posts, uncheck to hide it.');
     $ui->append('checkbox', 'show_page_paperclip', __CLASS__ . '__show_page_paperclip', _t('Show Page Paperclip:'), 'optionscontrol_checkbox');
     $ui->show_page_paperclip->helptext = _t('Check to show the paperclip graphic in pages, uncheck to hide it.');
     $ui->append('checkbox', 'show_powered', __CLASS__ . '__show_powered', _t('Show Powered By:'), 'optionscontrol_checkbox');
     $ui->show_powered->helptext = _t('Check to show the "powered by Habari" graphic in the sidebar, uncheck to hide it.');
     $ui->append('checkbox', 'display_login', __CLASS__ . '__display_login', _t('Display Login:'******'optionscontrol_checkbox');
     $ui->display_login->helptext = _t('Check to show the Login/Logout link in the navigation bar, uncheck to hide it.');
     $ui->append('checkbox', 'tags_in_multiple', __CLASS__ . '__tags_in_multiple', _t('Tags in Multiple Posts Page:'), 'optionscontrol_checkbox');
     $ui->tags_in_multiple->helptext = _t('Check to show the post tags in the multiple posts pages (search, tags, archives), uncheck to hide them.');
     $ui->append('checkbox', 'show_post_nav', __CLASS__ . '__show_post_nav', _t('Show Post Navigation:'), 'optionscontrol_checkbox');
     $ui->show_post_nav->helptext = _t('Set to true to show single post navigation links, false to hide them.');
     $ui->append('text', 'tags_count', __CLASS__ . '__tags_count', _t('Tag Cloud Count:'), 'optionscontrol_text');
     $ui->tags_count->helptext = _t('Set to the number of tags to display on the default "cloud".');
     // Save
     $ui->append('submit', 'save', _t('Save'));
     $ui->set_option('success_message', _t('Options saved'));
     $ui->out();
 }
Example #2
0
 /**
  * Respond to the user selecting an action on the plugin page
  * @param string $plugin_id The string id of the acted-upon plugin
  * @param string $action The action string supplied via the filter_plugin_config hook
  **/
 public function action_plugin_ui($plugin_id, $action)
 {
     if ($plugin_id === $this->plugin_id()) {
         switch ($action) {
             case _t('Configure', $this->class_name):
                 $ui = new FormUI($this->class_name);
                 $type = $ui->append('select', 'type', 'option:' . $this->class_name . '__type', _t('Photostream Type', $this->class_name));
                 $type->options = array('public' => _t('Public photos & video', $this->class_name), 'user' => _t('Public photos & video from you', $this->class_name), 'friends' => _t('Your friends’ photostream', $this->class_name), 'faves' => _t('Public favorites from you', $this->class_name), 'group' => _t('Group pool', $this->class_name));
                 $type->add_validator('validate_required');
                 $user_id = $ui->append('text', 'user_id', 'option:' . $this->class_name . '__user_id', _t('Flickr ID (You can get it from <a href="http://idgettr.com">idGettr</a>)', $this->class_name));
                 $user_id->add_validator('validate_flickr_id');
                 $num_item = $ui->append('text', 'num_item', 'option:' . $this->class_name . '__num_item', _t('&#8470; of Photos', $this->class_name));
                 $num_item->add_validator('validate_uint');
                 $num_item->add_validator('validate_required');
                 $size = $ui->append('select', 'size', 'option:' . $this->class_name . '__size', _t('Photo Size', $this->class_name));
                 $size->options = array('square' => _t('Square', $this->class_name), 'thumbnail' => _t('Thumbnail', $this->class_name), 'small' => _t('Small', $this->class_name), 'medium' => _t('Medium', $this->class_name), 'large' => _t('Large', $this->class_name), 'original' => _t('Original', $this->class_name));
                 $size->add_validator('validate_required');
                 $tags = $ui->append('text', 'tags', 'option:' . $this->class_name . '__tags', _t('Tags (comma separated, no space)', $this->class_name));
                 $cache_expiry = $ui->append('text', 'cache_expiry', 'option:' . $this->class_name . '__cache_expiry', _t('Cache Expiry (in seconds)', $this->class_name));
                 $cache_expiry->add_validator('validate_uint');
                 $cache_expiry->add_validator('validate_required');
                 // When the form is successfully completed, call $this->updated_config()
                 $ui->append('submit', 'save', _t('Save', $this->class_name));
                 $ui->set_option('success_message', _t('Options saved', $this->class_name));
                 $ui->out();
                 break;
         }
     }
 }
 public function get_form($group = null)
 {
     if ($group == null) {
         $group = Options::get('register__group');
         if ($group == null) {
             $group = 'anonymous';
         }
     }
     $form = new FormUI('registration');
     $form->class[] = 'registration';
     $form->append('text', 'email', 'null:null', _t('Email', __CLASS__), 'formcontrol_text');
     $form->email->add_validator('validate_email');
     $form->append('text', 'username', 'null:null', _t('Username', __CLASS__), 'formcontrol_text');
     $form->username->add_validator('validate_required');
     $form->username->add_validator('validate_username');
     $form->append('password', 'password', 'null:null', _t('Password', __CLASS__), 'formcontrol_password');
     $form->password->add_validator('validate_required');
     $form->append('password', 'password_confirmation', 'null:null', _t('Confirm Password', __CLASS__), 'formcontrol_password');
     $form->password_confirmation->add_validator('validate_required');
     $form->password_confirmation->add_validator('validate_same', $form->password);
     // Store the group to be added. This is stored locally, not retrieved from unsafe data.
     $form->set_option('group_name', $group);
     // Create the Register button
     $form->append('submit', 'register', _t('Register', __CLASS__), 'formcontrol_submit');
     $form->on_success(array($this, 'register_user'));
     // Return the form object
     return $form;
 }
Example #4
0
 public function configure()
 {
     $form = new FormUI('slugsync');
     $form->append('checkbox', 'draft_updates', 'slugsync__draftupdates', _t('Only update when post status is draft: ', 'slugsync'));
     $form->append('submit', 'save', 'Save');
     $form->set_option('success_message', _t('Slugsync options saved.', 'slugsync'));
     return $form;
 }
 public function configure()
 {
     $ui = new FormUI(strtolower(get_class($this)));
     $css_location = $ui->append('text', 'css_location', 'option:freestyleadmin__css_location', _t('FreeStyle CSS Location', 'FreeStyleAdmin'));
     $css_location->add_validator('validate_required');
     $ui->append('submit', 'save', _t('Save', 'FreeStyleAdmin'));
     $ui->set_option('success_message', _t('Configuration saved', 'FreeStyleAdmin'));
     return $ui;
 }
 public function configure()
 {
     $form = new FormUI('preapproved');
     $form->append('text', 'approved_count', 'option:preapproved__approved_count', _t('Required number of approved comments: '));
     $form->approved_count->add_validator(array($this, 'validate_integer'));
     $form->append('submit', 'save', _t('Save'));
     $form->set_option('success_message', _t('Configuration saved'));
     $form->out();
 }
 public function configure()
 {
     $form = new FormUI('threaded_comment');
     $depth = $form->append('text', 'threaded_depth', 'threaded_comment__depth', _t('Max depth of thread:'));
     $depth->add_validator('validate_regex', '/^[0-9]*$/', _t('Please enter a valid positive integer.'));
     $form->append('submit', 'save', _t('Save'));
     $form->set_option('success_message', _t('Configuration saved'));
     return $form;
 }
 public function action_plugin_ui_configure()
 {
     $ui = new FormUI('autoclose');
     $age_in_days = $ui->append('text', 'age_in_days', 'autoclose__age_in_days', _t('Post age (days) for autoclose', 'autoclose'));
     $age_in_days->add_validator('validate_required');
     $ui->append('submit', 'save', _t('Save', 'autoclose'));
     $ui->set_option('success_message', _t('Configuration saved', 'autoclose'));
     $ui->on_success(array($this, 'updated_config'));
     $ui->out();
 }
Example #9
0
 /**
  * Respond to the user selecting an action on the theme page
  */
 public function action_theme_ui($theme)
 {
     $ui = new FormUI(strtolower(get_class($this)));
     $ui->append('text', 'home_tab', 'option:' . $this->class_name . '__home_tab', _t('Link Text to Home'));
     $ui->home_tab->add_validator('validate_required');
     $ui->append('checkbox', 'show_author', 'option:' . $this->class_name . '__show_author', _t('Display author in posts'));
     // Save
     $ui->append('submit', 'save', _t('Save'));
     $ui->set_option('success_message', _t('Options saved'));
     $ui->out();
 }
Example #10
0
 public function get_form()
 {
     $users = Users::get_all();
     $users = Utils::array_map_field($users, 'username', 'id');
     $form = new FormUI('sudo');
     $form->append(new FormControlSelect('userlist', 'null:null', 'Become User:'******'submit', 'Submit'));
     $form->set_option('form_action', URL::get('sudo'));
     $form->onsubmit = 'return dosudo.setuser();';
     return $form;
 }
Example #11
0
 /**
  * Respond to the user selecting 'configure' on the themes page
  *
  */
 public function action_theme_ui()
 {
     $form = new FormUI('simplerer_theme');
     $copyright_notice = $form->append('text', 'copyright_notice', 'simplerer__copyright_notice', _t('Copyright Notice'));
     $copyright_notice->template = 'optionscontrol_text';
     $copyright_notice->class = 'clear';
     $copyright_notice->raw = true;
     $copyright_notice->helptext = _t('Use %year to substitute in the current year.');
     $form->append('submit', 'save', 'Save');
     $form->set_option('success_message', _t('Theme Settings Updated'));
     $form->out();
 }
Example #12
0
 public function action_theme_ui($theme)
 {
     $ui = new FormUI(__CLASS__);
     // Potential Static home page
     $page = $ui->append('select', 'page', 'criticalhit__home', _t('The page to show for the home page: ', 'staticfront'));
     $page->options['--none--'] = _t('Show Normal Posts', 'staticfront');
     foreach (Posts::get(array('content_type' => Post::type('page'), 'nolimit' => 1)) as $post) {
         $page->options[$post->slug] = $post->title;
     }
     // Save
     $ui->append('submit', 'save', _t('Save'));
     $ui->set_option('success_message', _t('Options saved'));
     $ui->out();
 }
Example #13
0
 public function action_plugin_ui($plugin_id, $action)
 {
     if ($plugin_id == $this->plugin_id()) {
         switch ($action) {
             case _t('Configure'):
                 $ui = new FormUI(strtolower(get_class($this)));
                 $ui->append('text', 'username', 'gallr__username', _t('User ID:'));
                 $ui->append('submit', 'save', _t('Save'));
                 $ui->set_option('success_message', _t('Options saved'));
                 $ui->out();
                 break;
         }
     }
 }
 /**
  * Respond to the user selecting an action on the plugin page
  * @param string $plugin_id The string id of the acted-upon plugin
  * @param string $action The action string supplied via the filter_plugin_config hook
  **/
 public function action_plugin_ui($plugin_id, $action)
 {
     if ($plugin_id === $this->plugin_id()) {
         switch ($action) {
             case _t('Configure', $this->class_name):
                 $ui = new FormUI($this->class_name);
                 $ui->append('select', 'color_scheme', 'option:' . $this->class_name . '__color_scheme', _t('Color Scheme', $this->class_name), self::get_color_schemes());
                 // When the form is successfully completed, call $this->updated_config()
                 $ui->append('submit', 'save', _t('Save', $this->class_name));
                 $ui->set_option('success_message', _t('Options saved', $this->class_name));
                 $ui->out();
                 break;
         }
     }
 }
 public function action_plugin_ui($plugin_id, $action)
 {
     if ($plugin_id == $this->plugin_id()) {
         switch ($action) {
             case _t('Configure'):
                 $ui = new FormUI(strtolower(get_class($this)));
                 $technorati_apikey = $ui->append('text', 'apikey', 'option:technorati__apikey', _t('Technorati API Key (Get it from ') . '<a href="http://www.technorati.com/developers/apikey.html">' . _t('Developer Center') . '</a>)');
                 $technorati_apikey->add_validator('validate_required');
                 $ui->append('submit', 'save', _t('Save'));
                 $ui->set_option('success_message', _t('Configuration saved'));
                 $ui->out();
                 break;
         }
     }
 }
 public function action_plugin_ui($plugin_id, $action)
 {
     if ($plugin_id == $this->plugin_id()) {
         switch ($action) {
             case _t('Configure'):
                 $form = new FormUI(strtolower(get_class($this)));
                 $form->append('label', 'message_label', _t('Default message used as a link in posts and feeds.', 'spoilers'));
                 $form->append('text', 'message', 'spoiler__message', _t('Spoiler message:', 'spoilers'));
                 $form->append('submit', 'save', _t('Save'));
                 $form->set_option('success_message', _t('Options saved'));
                 $form->out();
                 break;
         }
     }
 }
 public function action_admin_theme_get_crontab(AdminHandler $handler, Theme $theme)
 {
     if (isset($handler->handler_vars['action'])) {
         switch ($handler->handler_vars['action']) {
             case 'delete':
                 $cron = CronTab::get_cronjob((int) $handler->handler_vars['cron_id']);
                 if ($cron instanceof CronJob && $cron->delete()) {
                     Session::notice(_t('Deleted cron job "%s"', array($cron->name), 'crontabmanager'));
                 } else {
                     Session::error(_t('Could not delete Cron Job with id "%s"', array($handler->handler_vars['cron_id']), 'crontabmanager'));
                 }
                 break;
             case 'run':
                 $cron = CronTab::get_cronjob((int) $handler->handler_vars['cron_id']);
                 // it's possible that the cron has already run and been deleted
                 if (!$cron) {
                     Session::error(_t('Cron Job appears to have already run and no longer exists.', 'crontabmanager'));
                 } else {
                     $cron->next_run = HabariDateTime::date_create('now');
                     $cron->update();
                     Options::set('next_cron', $cron->next_run->int);
                     Session::notice(_t('Executing Cron Job "%s"', array($cron->name), 'crontabmanager'));
                 }
                 break;
         }
     }
     $form = new FormUI('crontab-new');
     $form->set_option('form_action', URL::get('admin', 'page=crontab'));
     $form->class[] = 'form comment';
     $tabs = $form->append('tabs', 'publish_controls');
     $new = $tabs->append('fieldset', 'settings', _t('Add Cronjob', 'crontabmanage'));
     $name = $new->append('text', 'cron_name', 'null:null', _t('Name', 'crontabmanager'), 'tabcontrol_text');
     $callback = $new->append('text', 'callback', 'null:null', _t('Callback', 'crontabmanager'), 'tabcontrol_text');
     $increment = $new->append('text', 'increment', 'null:null', _t('Interval', 'crontabmanager'), 'tabcontrol_text');
     $start_time = $new->append('text', 'start_time', 'null:null', _t('Start Time', 'crontabmanager'), 'tabcontrol_text');
     $end_time = $new->append('text', 'end_time', 'null:null', _t('End Time', 'crontabmanager'), 'tabcontrol_text');
     $description = $new->append('text', 'description', 'null:null', _t('Description', 'crontabmanager'), 'tabcontrol_text');
     $cron_classes = array(CronJob::CRON_SYSTEM => _t('System', 'crontabmanager'), CronJob::CRON_THEME => _t('Theme', 'crontabmanager'), CronJob::CRON_PLUGIN => _t('Plugin', 'crontabmanager'), CronJob::CRON_CUSTOM => _t('Custom', 'crontabmanager'));
     $cron_class = $new->append('select', 'cron_class', 'null:null', _t('Cron Class', 'crontabmanager'), $cron_classes, 'tabcontrol_select');
     $cron_class->value = CronJob::CRON_CUSTOM;
     $new->append('submit', 'save', _t('Save', 'crontabmanager'));
     $form->on_success(array($this, 'formui_submit'));
     $theme->form = $form->get();
     $crons = DB::get_results('SELECT * FROM {crontab}', array(), 'CronJob');
     $theme->crons = $crons;
 }
 /**
  * Respond to the user selecting configure on the plugin page
  **/
 public function configure()
 {
     $ui = new FormUI($this->class_name);
     $ui->append('text', 'coords', 'option:' . $this->class_name . '__coords', _t('Default Coordinates', $this->class_name));
     $ui->append('text', 'zoom', 'option:' . $this->class_name . '__zoom', _t('Default Zoom', $this->class_name));
     $ui->append('text', 'jumptoZoom', 'option:' . $this->class_name . '__jumptoZoom', _t('Jump to Zoom', $this->class_name));
     $ui->append('select', 'mapTypeId', 'option:' . $this->class_name . '__mapTypeId', _t('Map Type'), 'optionscontrol_select');
     $ui->mapTypeId->options = $this->arrMapTypeId;
     $ui->append('select', 'mapControlType', 'option:' . $this->class_name . '__mapControlType', _t('Map Control Type'));
     $ui->mapControlType->options = $this->arrMapControlType;
     $ui->append('checkbox', 'mapNavControl', 'option:' . $this->class_name . '__mapNavControl', _t('Show Navigation Controls?'));
     $ui->append('select', 'mapNavControlStyle', 'option:' . $this->class_name . '__mapNavControlStyle', _t('Navigation Control Style'));
     $ui->mapNavControlStyle->options = $this->arrMapNavControlStyle;
     $ui->append('submit', 'save', _t('Save', $this->class_name));
     $ui->set_option('success_message', _t('Options saved', $this->class_name));
     return $ui;
 }
 /**
  * Respond to the user selecting an action on the plugin page
  * @param string $plugin_id The string id of the acted-upon plugin
  * @param string $action The action string supplied via the filter_plugin_config hook
  **/
 public function action_plugin_ui($plugin_id, $action)
 {
     if ($plugin_id === $this->plugin_id()) {
         switch ($action) {
             case _t('Configure', 'pageless'):
                 $ui = new FormUI('pageless');
                 $num_item = $ui->append('text', 'num_item', 'option:' . 'pageless__num_item', _t('How many posts to load each time?', 'pageless'));
                 $num_item->add_validator('validate_uint');
                 $num_item->add_validator('validate_required');
                 // When the form is successfully completed, call $this->updated_config( )
                 $ui->append('submit', 'save', _t('Save', 'pageless'));
                 $ui->set_option('success_message', _t('Options saved', 'pageless'));
                 $ui->out();
                 break;
         }
     }
 }
 /**
  * New configuration routine
  **/
 public function configure()
 {
     $ui = new FormUI($this->class_name);
     $user_id = $ui->append('text', 'user_id', 'option:' . $this->class_name . '__user_id', _t('Brightkite Username', $this->class_name));
     $user_id->add_validator('validate_bk_username');
     $user_id->add_validator('validate_required');
     $google_api_key = $ui->append('text', 'google_api_key', 'option:' . $this->class_name . '__google_api_key', _t('Google Maps API Key', $this->class_name));
     $map_image_size = $ui->append('text', 'map_image_size', 'option:' . $this->class_name . '__map_image_size', _t('Size of map image', $this->class_name));
     $map_image_size->add_validator('validate_regex', '/\\d+x\\d+/');
     $map_image_size->add_validator('validate_required');
     $cache_expiry = $ui->append('text', 'cache_expiry', 'option:' . $this->class_name . '__cache_expiry', _t('Cache Expiry (in seconds)', $this->class_name));
     $cache_expiry->add_validator('validate_uint');
     $cache_expiry->add_validator('validate_required');
     // When the form is successfully completed, call $this->updated_config()
     $ui->append('submit', 'save', _t('Save', $this->class_name));
     $ui->set_option('success_message', _t('Options saved', $this->class_name));
     return $ui;
 }
 /**
  * Respond to the user selecting an action on the plugin page
  * @param string $plugin_id The string id of the acted-upon plugin
  * @param string $action The action string supplied via the filter_plugin_config hook
  **/
 public function action_plugin_ui($plugin_id, $action)
 {
     if ($plugin_id == $this->plugin_id()) {
         switch ($action) {
             case _t('Configure', $this->class_name):
                 $ui = new FormUI($this->class_name);
                 $ui->append('text', 'username', 'option:' . $this->class_name . '__username', _t('Last.fm Username', $this->class_name));
                 $ui->username->add_validator(array($this, 'validate_username'));
                 $ui->username->add_validator('validate_required');
                 $ui->append('text', 'cache', 'option:' . $this->class_name . '__cache', _t('Cache Expiry (in seconds)', $this->class_name));
                 $ui->cache->add_validator(array($this, 'validate_uint'));
                 $ui->append('submit', 'save', _t('Save', $this->class_name));
                 $ui->set_option('success_message', _t('Options saved', $this->class_name));
                 $ui->out();
                 break;
         }
     }
 }
 /**
  * UI for plugin button
  */
 public function action_plugin_ui($plugin_id, $action)
 {
     if ($plugin_id == $this->plugin_id()) {
         switch ($action) {
             case _t(self::ACTION_CONFIGURE):
                 $ui = new FormUI(strtolower(__CLASS__));
                 $path = $ui->append('text', 'exportpath', self::OPTIONS_LOCALPATH, _t('Export Path:'));
                 $ui->exportpath->add_validator(array(__CLASS__, 'check_path'));
                 $ui->append('submit', 'save', _t('Save'));
                 $ui->set_option('success_message', _t('TextExport Settings Saved'));
                 $ui->out();
                 break;
             case _t(self::ACTION_EXPORT_ALL):
                 $this->export_all();
                 break;
         }
     }
 }
 public function action_plugin_ui($plugin_id, $action)
 {
     if ($plugin_id == $this->plugin_id()) {
         switch ($action) {
             case _t('Configure'):
                 $form = new FormUI(strtolower(get_class($this)));
                 // You can't go past the first/last post message
                 $form->append('text', 'paging_error', 'option:key_nav_paging_error', _t('Message to display when a user tries to go past the first or last post'));
                 // Selector for posts
                 $form->append('text', 'selector', 'option:key_nav_selector', _t('jQuery selector to identify posts.'));
                 // Scroll delay
                 // TODO Validate as a number, or perhaps a selector
                 $form->append('text', 'delay', 'option:key_nav_delay', _t('Scroll delay (ms)'));
                 $form->append('submit', 'save', _t('Save'));
                 $form->set_option('success_message', _t('Configuration saved'));
                 $form->out();
                 break;
         }
     }
 }
 /**
  * Respond to the user selecting an action on the plugin page
  * @param string $plugin_id The string id of the acted-upon plugin
  * @param string $action The action string supplied via the filter_plugin_config hook
  **/
 public function action_plugin_ui($plugin_id, $action)
 {
     if ($plugin_id === $this->plugin_id()) {
         switch ($action) {
             case _t('Configure', $this->class_name):
                 $ui = new FormUI($this->class_name);
                 $type = $ui->append('select', 'type', 'option:' . $this->class_name . '__type', _t('Ohloh badge type', $this->class_name));
                 $type->options = array('detailed' => _t('Detailed', $this->class_name), 'rank' => _t('Rank', $this->class_name), 'tiny' => _t('Tiny', $this->class_name));
                 $type->add_validator('validate_required');
                 $user_id = $ui->append('text', 'user_id', 'option:' . $this->class_name . '__user_id', _t('Your numeric ohloh id', $this->class_name));
                 $user_id->add_validator('validate_ohloh_id');
                 $alt_text = $ui->append('text', 'alt_text', 'option:' . $this->class_name . '__alt_text', _t('Alt text for image', $this->class_name));
                 $alt_text->add_validator('validate_required');
                 $ui->append('submit', 'save', _t('Save', $this->class_name));
                 $ui->set_option('success_message', _t('Options saved', $this->class_name));
                 $ui->out();
                 break;
         }
     }
 }
 public function action_plugin_ui($plugin_id, $action)
 {
     if ($plugin_id == $this->plugin_id()) {
         switch ($action) {
             case _t('Configure'):
                 $ui = new FormUI(strtolower(get_class($this)));
                 $ui->append('text', 'siteid', 'getclicky__siteid', _t('Site ID:'));
                 $ui->append('text', 'sitekey', 'getclicky__sitekey', _t('Site Key:'));
                 $ui->append('text', 'sitedb', 'getclicky__sitedb', _t('Site DB:'));
                 $ui->append('checkbox', 'loggedin', 'getclicky__loggedin', _t('Don\'t track this user?:'));
                 $ui->append('text', 'cachetime', 'getclicky__cachetime', _t('Cache Dashboard statistics for (seconds):'));
                 $ui->append('submit', 'save', _t('Save'));
                 $ui->set_option('success_message', _t('GetClicky Settings Saved'));
                 $ui->out();
                 break;
             case _t('Clear Cache'):
                 $this->clearCache();
                 break;
         }
     }
 }
Example #26
0
 /**
  * Respond to the user selecting an action on the plugin page
  * @param string $plugin_id The string id of the acted-upon plugin
  * @param string $action The action string supplied via the filter_plugin_config hook
  **/
 public function action_plugin_ui($plugin_id, $action)
 {
     if ($plugin_id === $this->plugin_id()) {
         switch ($action) {
             case _t('Configure', $this->class_name):
                 $ui = new FormUI($this->class_name);
                 $user_id = $ui->append('text', 'user_id', 'option:' . $this->class_name . '__user_id', _t('Delicious Username', $this->class_name));
                 $user_id->add_validator('validate_username');
                 $user_id->add_validator('validate_required');
                 $tags = $ui->append('text', 'tags', 'option:' . $this->class_name . '__tags', _t('Tags (seperate by space)', $this->class_name));
                 $num_item = $ui->append('text', 'num_item', 'option:' . $this->class_name . '__num_item', _t('&#8470; of Posts', $this->class_name));
                 $num_item->add_validator('validate_uint');
                 $num_item->add_validator('validate_required');
                 $cache_expiry = $ui->append('text', 'cache_expiry', 'option:' . $this->class_name . '__cache_expiry', _t('Cache Expiry (in seconds)', $this->class_name));
                 $cache_expiry->add_validator('validate_uint');
                 $cache_expiry->add_validator('validate_required');
                 // When the form is successfully completed, call $this->updated_config()
                 $ui->append('submit', 'save', _t('Save', $this->class_name));
                 $ui->set_option('success_message', _t('Options saved', $this->class_name));
                 $ui->out();
                 break;
         }
     }
 }
Example #27
0
 /**
  * Respond to the user selecting an action on the plugin page
  * @param string $plugin_id The string id of the acted-upon plugin
  * @param string $action The action string supplied via the filter_plugin_config hook
  **/
 public function action_plugin_ui($plugin_id, $action)
 {
     if ($plugin_id == $this->plugin_id()) {
         switch ($action) {
             case _t('Configure', $this->class_name):
                 $ui = new FormUI(strtolower(get_class($this)));
                 // Username
                 $ui->append('text', 'username', 'option:' . $this->class_name . '__username', _t('Jaiku Username', $this->class_name));
                 $ui->username->add_validator(array($this, 'validate_username'));
                 $ui->username->add_validator('validate_required');
                 // How many presences to show?
                 $ui->append('text', 'limit', 'option:' . $this->class_name . '__limit', _t('&#8470; of Presences', $this->class_name));
                 $ui->limit->add_validator(array($this, 'validate_uint'));
                 // Cache
                 $ui->append('text', 'cache', 'option:' . $this->class_name . '__cache', _t('Cache Expiry (in seconds)', $this->class_name));
                 $ui->cache->add_validator(array($this, 'validate_uint'));
                 // Save
                 $ui->append('submit', 'save', _t('Save', $this->class_name));
                 $ui->set_option('success_message', _t('Options saved', $this->class_name));
                 $ui->out();
                 break;
         }
     }
 }
 /**
  * Executes when the admin plugins page wants to display the UI for a particular plugin action.
  * Displays the plugin's UI.
  *
  * @param string $plugin_id The unique id of a plugin
  * @param string $action The action to display
  **/
 public function action_plugin_ui($plugin_id, $action)
 {
     // Display the UI for this plugin?
     if ($plugin_id == $this->plugin_id()) {
         // Depending on the action specified, do different things
         switch ($action) {
             case _t('Configure'):
                 $ui = new FormUI(get_class($this));
                 $ui->append('text', 'hide_tags', 'option:' . 'fluffytag__hide', _t('Tag(s) to be hidden (seperate with ",")'));
                 $ui->append('text', 'steps_tag', 'option:' . 'fluffytag__steps', _t('No. of steps (if you change this you will also need to change fluffytag.css accordingly)'));
                 $ui->append('text', 'hide_prefix', 'option:' . 'fluffytag__prefix', _t('Other plugin might use prefixed tags for different reasons. If you want to hide those from the tag cloud add the prefixes here. (seperate with ",")'));
                 $ui->append('text', 'cache_expire', 'option:' . 'fluffytag__expire', _t('Time the cache should save result (sec)'));
                 $ui->append('submit', 'save', _t('Save'));
                 $ui->set_option('success_message', _t('Configuration saved'));
                 $ui->on_success(array($this, 'updated_config'));
                 $ui->out();
                 break;
             case _t('Clear Cache'):
                 Cache::expire($this->cache_name);
                 echo '<p>' . _t('Cache has been cleared.') . '</p>';
                 break;
         }
     }
 }
Example #29
0
	/**
	 * Manage this post's comment form
	 *
	 * @param String context // What is $context for ?
	 * @return FormUI The comment form for this post
	 */
	public function comment_form( $context = 'public' )
	{
		// Handle comment submissions and default commenter id values
		$cookie = 'comment_' . Options::get( 'GUID' );
		$commenter_name = '';
		$commenter_email = '';
		$commenter_url = '';
		$commenter_content = '';
		$user = User::identify();
		if ( isset( $_SESSION['comment'] ) ) {
			$details = Session::get_set( 'comment' );
			$commenter_name = $details['name'];
			$commenter_email = $details['email'];
			$commenter_url = $details['url'];
			$commenter_content = $details['content'];
		}
		elseif ( $user->loggedin ) {
			$commenter_name = $user->displayname;
			$commenter_email = $user->email;
			$commenter_url = Site::get_url( 'habari' );
		}
		elseif ( isset( $_COOKIE[$cookie] ) ) {
			// limit to 3 elements so a # in the URL stays appended
			$commenter = explode( '#', $_COOKIE[ $cookie ], 3 );
			
			// make sure there are always at least 3 elements
			$commenter = array_pad( $commenter, 3, null );
			
			list( $commenter_name, $commenter_email, $commenter_url ) = $commenter;
		}

		// Now start the form.
		$form = new FormUI( 'comment-' . $context, 'comment' );
		$form->class[] = $context;
		$form->class[] = 'commentform';
		$form->set_option( 'form_action', URL::get( 'submit_feedback', array( 'id' => $this->id ) ) );

		// Create the Name field
		$form->append(
			'text',
			'cf_commenter',
			'null:null',
			_t( 'Name <span class="required">*Required</span>' ),
			'formcontrol_text'
		)->add_validator( 'validate_required', _t( 'The Name field value is required' ) )
		->id = 'comment_name';
		$form->cf_commenter->tabindex = 1;
		$form->cf_commenter->value = $commenter_name;

		// Create the Email field
		$form->append(
			'text',
			'cf_email',
			'null:null',
			_t( 'Email' ),
			'formcontrol_text'
		)->add_validator( 'validate_email', _t( 'The Email field value must be a valid email address' ) )
		->id = 'comment_email';
		$form->cf_email->tabindex = 2;
		if ( Options::get( 'comments_require_id' ) == 1 ) {
			$form->cf_email->add_validator(  'validate_required', _t( 'The Email field value must be a valid email address' ) );
			$form->cf_email->caption = _t( 'Email <span class="required">*Required</span>' );
		}
		$form->cf_email->value = $commenter_email;

		// Create the URL field
		$form->append(
			'text',
			'cf_url',
			'null:null',
			_t( 'Website' ),
			'formcontrol_text'
		)->add_validator( 'validate_url', _t( 'The Web Site field value must be a valid URL' ) )
		->id = 'comment_url';
		$form->cf_url->tabindex = 3;
		$form->cf_url->value = $commenter_url;

		// Create the Comment field
		$form->append(
			'text',
			'cf_content',
			'null:null',
			_t( 'Comment' ),
			'formcontrol_textarea'
		)->add_validator( 'validate_required', _t( 'The Content field value is required' ) )
		->id = 'comment_content';
		$form->cf_content->tabindex = 4;
		$form->cf_content->value = $commenter_content;

		// Create the Submit button
		$form->append( 'submit', 'cf_submit', _t( 'Submit' ), 'formcontrol_submit' );
		$form->cf_submit->tabindex = 5;

		// Add required hidden controls
		/*
		$form->append( 'hidden', 'content_type', 'null:null' );
		$form->content_type->value = $this->content_type;
		$form->append( 'hidden', 'post_id', 'null:null' );
		$form->post_id->id = 'id';
		$form->post_id->value = $this->id;
		$form->append( 'hidden', 'slug', 'null:null' );
		$form->slug->value = $this->slug;
		*/

		// Let plugins alter this form
		Plugins::act( 'form_comment', $form, $this, $context );

		// Return the form object
		return $form;
	}
Example #30
0
 /**
  * Executes when the admin plugins page wants to display the UI for a particular plugin action.
  * Displays the plugin's UI.
  *
  * @param string $plugin_id The unique id of a plugin
  * @param string $action The action to display
  */
 public function action_plugin_ui($plugin_id, $action)
 {
     // Display the UI for this plugin?
     if ($plugin_id == $this->plugin_id()) {
         // Depending on the action specified, do different things
         switch ($action) {
             case _t('Configure'):
                 $ui = new FormUI($this->class_name);
                 $num_tag = $ui->append('text', 'num_tag', 'option:' . $this->class_name . '__num_tag', _t('No. of tags shown (blank for all tags)'));
                 $hide_tags = $ui->append('textmulti', 'hide_tags', 'option:' . $this->class_name . '__hide_tags', _t('Tag(s) to be hidden'));
                 $tag_by_color = $ui->append('select', 'tag_by_color', 'option:' . $this->class_name . '__tag_by_color', _t('Popularity by Color?'));
                 $tag_by_color->options = array('' => '', 'Y' => 'Yes', 'N' => 'No');
                 $tag_by_color->add_validator('validate_tag_by_color');
                 $least_color = $ui->append('text', 'least_color', 'option:' . $this->class_name . '__least_color', _t('Color of least popular tag (in hex value, e.g. #444444)'));
                 $least_color->add_validator('validate_color_code');
                 $most_color = $ui->append('text', 'most_color', 'option:' . $this->class_name . '__most_color', _t('Color of most popular tag (in hex value, e.g. #cccccc)'));
                 $most_color->add_validator('validate_color_code');
                 $tag_by_size = $ui->append('select', 'tag_by_size', 'option:' . $this->class_name . '__tag_by_size', _t('Popularity by Size?'));
                 $tag_by_size->options = array('' => '', 'Y' => 'Yes', 'N' => 'No');
                 $tag_by_size->add_validator('validate_tag_by_size');
                 $least_size = $ui->append('text', 'least_size', 'option:' . $this->class_name . '__least_size', _t('Size of least popular tag'));
                 $least_size->add_validator('validate_size');
                 $most_size = $ui->append('text', 'most_size', 'option:' . $this->class_name . '__most_size', _t('Size of most popular tag'));
                 $most_size->add_validator('validate_size');
                 $font_unit = $ui->append('select', 'font_unit', 'option:' . $this->class_name . '__font_unit', _t('Font Unit'));
                 $font_unit->options = array('' => '', '%' => '%', 'em' => 'em', 'px' => 'px');
                 $font_unit->add_validator('validate_size');
                 $ui->append('submit', 'save', _t('Save'));
                 $ui->set_option('success_message', _t('Configuration saved'));
                 $ui->on_success(array($this, 'updated_config'));
                 $ui->out();
                 break;
             case _t('Clear Cache'):
                 $this->expire_cache();
                 echo '<p>' . _t('Cache has been cleared.') . '</p>';
                 break;
         }
     }
 }