Пример #1
0
 function make_editor_form()
 {
     $form = new disco();
     $editor_name = html_editor_name($this->site_id);
     $params = html_editor_params($this->site_id);
     if (strpos($editor_name, 'loki') === 0) {
         unset($params['paths']['site_feed']);
         unset($params['paths']['finder_feed']);
         unset($params['paths']['default_site_regexp']);
         unset($params['paths']['default_type_regexp']);
         $params['widgets'] .= ' +source +debug';
     }
     $form->add_element('demo', $editor_name, $params);
     $form->set_display_name('demo', ' ');
     $form->set_actions(array('Submit'));
     $form->run();
     if ($form->get_value('demo')) {
         echo '<h3>Output</h3>' . "\n";
         echo '<p>(For security reasons, this may differ from the Raw and Tidied markup -- it has been run through <a href="http://htmlpurifier.org/">HTML Purifier</a>)</p>';
         echo '<div class="echoBack">' . "\n";
         echo carl_get_safer_html($form->get_value('demo'));
         echo '</div>' . "\n";
         echo '<h3>Tidied Markup</h3>' . "\n";
         echo '<p>This is what you submitted after being run through <a href="http://tidy.sourceforge.net/">Tidy</a></p>';
         echo '<div class="echoBack">' . "\n";
         echo nl2br(htmlspecialchars($form->get_value('demo')));
         echo '</div>' . "\n";
         echo '<h3>Raw Markup</h3>' . "\n";
         echo '<p>This is exactly what you submitted</p>';
         echo '<div class="echoBack">' . "\n";
         echo nl2br(htmlspecialchars(conditional_stripslashes($_POST['demo'])));
         echo '</div>' . "\n";
     }
 }
Пример #2
0
 /**
  * Run the event similarity form
  * 
  * @return void
  */
 function run()
 {
     if (!$this->_should_run) {
         echo '<p>' . $this->_no_run_msg . '</p>' . "\n";
         return;
     }
     $d = new disco();
     $d->add_element('referer', 'hidden', array('userland_changeable' => true));
     if ($_SERVER['HTTP_REFERER']) {
         $d->set_value('referer', $_SERVER['HTTP_REFERER']);
     }
     $d->set_actions(array('split' => 'Split Into Separate Event Items'));
     $d->add_callback(array(&$this, 'event_split_callback'), 'process');
     $d->add_callback(array(&$this, 'get_event_info_html'), 'pre_show_form');
     $d->add_callback(array(&$this, 'get_cancel_html'), 'post_show_form');
     $d->add_callback(array(&$this, 'get_event_split_report'), 'no_show_form');
     $d->run();
 }
Пример #3
0
 function run()
 {
     if (!reason_user_has_privs($this->admin_page->user_id, 'view_sensitive_data')) {
         echo 'Sorry; you do not have the rights to view this information.';
         return;
     }
     // get audiences in REason
     $es = new entity_selector();
     $es->add_type(id_of('audience_type'));
     $audiences = $es->run_one();
     $options = array();
     foreach ($audiences as $aud) {
         $options[$aud->get_value('directory_service_value')] = $aud->get_value('name');
     }
     $d = new disco();
     $d->add_element('active_since', 'textdatetime');
     $d->add_element('affiliations', 'checkboxgroup', array('options' => $options));
     $d->set_display_name('affiliations', 'Audiences');
     $d->add_comments('affiliations', form_comment('Leaving these checkboxes blank won\'t filter the results.'));
     $d->set_actions(array('run' => 'Run'));
     $d->run();
     if ($d->get_value('active_since')) {
         $user_ids = $this->_get_active_user_ids($d->get_value('active_since'));
         echo count($user_ids) . ' Reason users modified at least one item since ' . prettify_mysql_datetime($d->get_value('active_since')) . '<br />';
         if ($d->get_value('affiliations')) {
             $affiliations = array_values($d->get_value('affiliations'));
         } else {
             $affiliations = array();
         }
         $users = $this->_get_active_users_from_ids($user_ids, $affiliations);
         echo '<br />' . count($users) . ' of the above users currently have access to at least one site<br />';
         if (!empty($users)) {
             echo '<textarea rows="12">' . "\n";
             $usernames = array();
             foreach ($users as $user) {
                 $usernames[$user->id()] = $user->get_value('name');
             }
             echo implode(', ', $usernames);
             echo '</textarea>' . "\n";
         }
         $emails = $this->_get_email_addresses_from_users($users);
         echo '<br />' . count($emails) . ' of the users with site access have an email addresses in the directory<br />';
         if (!empty($emails)) {
             echo '<textarea rows="12">' . "\n";
             echo implode(', ', $emails);
             echo '</textarea>' . "\n";
         }
     }
 }
Пример #4
0
 function set_disco_obj($types)
 {
     $d = new disco();
     $types = array();
     foreach ($this->types as $type) {
         $types = $types + array($type->get_value('id') => $type->get_value('name'));
     }
     $d->add_element('types', 'select_multiple', array('options' => $types));
     $d->set_display_name('types', 'Types to search:');
     $d->set_comments('types', form_comment('<a id="select_all" href="#all">Select all</a>'));
     $d->add_element('max', 'radio_inline_no_sort', array('options' => array('yes' => 'Yes', 'no' => 'No')));
     $d->set_display_name('max', 'Limit number of orphans to find:');
     $d->set_comments('max', form_comment('Searching for all orphaned entities can take a while. Limiting the number to find speeds the search.'));
     $d->set_value('max', 'yes');
     $d->add_element('max_num', 'text', array('size' => '5'));
     $d->set_display_name('max_num', 'Maximum number:');
     $d->set_value('max_num', '50');
     $d->add_element('cur_module', 'hidden');
     $d->set_value('cur_module', 'OrphanManager');
     $d->add_required('types', 'max');
     $d->add_element('mode', 'hidden');
     $d->set_value('mode', 'manager');
     $d->set_actions(array('run' => 'Find Orphaned Entities'));
     function check_phase_callback(&$disco)
     {
         if ($disco->successfully_submitted()) {
             $disco->show_form = false;
         }
     }
     $d->add_callback('check_phase_callback', 'where_to');
     $this->d = $d;
 }
Пример #5
0
 /**
  * Run the module
  */
 function run()
 {
     $sites = $this->_get_sites();
     if (empty($sites)) {
         echo '<p>You must have editing access to at least one live Reason site for this module to work</p>' . "\n";
         return;
     }
     $users = $this->_get_users();
     if (empty($users)) {
         echo '<p>No users available.</p>' . "\n";
         return;
     }
     echo '<div id="reviewChangesModule">' . "\n";
     $d = new disco();
     $d->add_element('start_date', 'textdate', array('prepopulate' => true, 'year_max' => carl_date('Y'), 'year_min' => '1000'));
     $d->add_required('start_date');
     $d->add_element('end_date', 'textdate', array('year_max' => carl_date('Y'), 'year_min' => '1000'));
     $d->add_comments('end_date', form_comment('If no end date given, changes will be shown for just the start date'));
     $d->add_element('type', 'select', array('options' => $this->_prep_for_disco($this->_get_types())));
     if (!empty($this->admin_page->request['type_id'])) {
         $d->set_value('type', $this->admin_page->request['type_id']);
     }
     $d->add_element('site', 'select', array('options' => $this->_prep_for_disco($sites)));
     if (!empty($this->admin_page->request['site_id'])) {
         $d->set_value('site', $this->admin_page->request['site_id']);
     }
     $d->add_element('user', 'select', array('options' => $this->_prep_for_disco($users)));
     if (!empty($this->admin_page->request['user'])) {
         $d->set_value('user', $this->admin_page->request['user']);
     }
     $d->add_element('sort', 'select', array('options' => array('DESC' => 'Descending', 'ASC' => 'Ascending')));
     $d->set_actions(array('review' => 'Review'));
     $d->run();
     if ($d->successfully_submitted()) {
         $end_date = $d->get_value('end_date') ? $d->get_value('end_date') : $d->get_value('start_date');
         if ($end_date < $d->get_value('start_date')) {
             echo 'Please pick a end date on or after the start date.';
         } else {
             echo $this->_get_changes_markup($d->get_value('start_date'), $end_date, $d->get_value('type'), $d->get_value('site'), $d->get_value('user'), $d->get_value('sort'));
         }
     }
     echo '</div>' . "\n";
 }
Пример #6
0
 function _get_editing_form($blurb)
 {
     $form = new disco();
     $form->strip_tags_from_user_input = true;
     $form->allowable_HTML_tags = REASON_DEFAULT_ALLOWED_TAGS;
     $form->add_element('blurb_edit_text', html_editor_name($this->site_id), html_editor_params($this->site_id, $this->get_html_editor_user_id()));
     $form->set_display_name('blurb_edit_text', ' ');
     $form->set_value('blurb_edit_text', $blurb->get_value('content'));
     $form->set_actions(array('save' => 'Save', 'save_and_finish' => 'Save and Finish Editing'));
     $form->add_callback(array(&$this, 'save_blurb_callback'), 'process');
     $form->add_callback(array(&$this, 'where_to_callback'), 'where_to');
     ob_start();
     $form->run();
     $form_output = ob_get_clean();
     return $form_output;
 }