Ejemplo n.º 1
0
 function do_wysiwygs()
 {
     $editor_name = html_editor_name($this->site_info->id());
     $params = html_editor_params($this->site_info->id());
     if (strpos($editor_name, 'loki') === 0) {
         if (!empty($this->username) && ($user_id = get_user_id($this->username))) {
             if ($editor_name == 'loki') {
                 $params['widgets'] = array('strong', 'em', 'link');
             } else {
                 $params['widgets'] = array('strong', 'em', 'link', 'blockquote');
             }
             if (function_exists('reason_user_has_privs')) {
                 $params['user_is_admin'] = reason_user_has_privs($user_id, 'edit_html');
             }
         } else {
             if ($editor_name == 'loki') {
                 $params['widgets'] = array('strong', 'em');
             } else {
                 $params['widgets'] = array('strong', 'em', 'blockquote');
             }
             if (isset($params['paths'])) {
                 unset($params['paths']['site_feed']);
                 unset($params['paths']['finder_feed']);
                 unset($params['paths']['default_site_regexp']);
                 unset($params['paths']['default_type_regexp']);
             }
         }
     }
     $this->change_element_type('comment_content', $editor_name, $params);
 }
Ejemplo n.º 2
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";
     }
 }
Ejemplo n.º 3
0
 /**
  * Present an interface to edit / create content
  */
 function run_editable()
 {
     $inline_edit =& get_reason_inline_editing($this->page_id);
     $active = $inline_edit->active_for_module($this);
     $class = $active ? 'editable editing' : 'editable';
     echo '<div id="pageContent" class="' . $class . '">' . "\n";
     if ($active) {
         $form = new Disco();
         $form->strip_tags_from_user_input = true;
         $form->allowable_HTML_tags = REASON_DEFAULT_ALLOWED_TAGS;
         $form->actions = array('save' => 'Save', 'save_and_finish' => 'Save and Finish Editing');
         $form->add_element('editable_content', html_editor_name($this->site_id), html_editor_params($this->site_id, $this->get_html_editor_user_id()));
         $form->set_display_name('editable_content', ' ');
         $form->set_value('editable_content', $this->content);
         $form->add_callback(array(&$this, 'process_editable'), 'process');
         $form->add_callback(array(&$this, 'where_to_editable'), 'where_to');
         $form->run();
     } else {
         $url = carl_make_link($inline_edit->get_activation_params($this));
         if (!carl_empty_html($this->content)) {
             $link = '<p><a href="' . $url . '" class="editThis">Edit Content</a></p>';
             $pre = '<div class="editRegion">';
             $post = '</div>';
             $output = $pre . $this->content . $link . $post;
         } else {
             $link = '<p><a href="' . $url . '" class="editThis">Create Content</a></p>';
             $pre = '<div class="editRegion">';
             $post = '</div>';
             $output = $pre . $link . $post;
         }
         echo $output;
     }
     echo '</div>' . "\n";
 }
Ejemplo n.º 4
0
 function do_wysiwygs()
 {
     $editor_name = html_editor_name($this->site_info->id());
     $params = html_editor_params($this->site_info->id());
     if (function_exists('reason_user_has_privs') && strpos($editor_name, 'loki') === 0 && ($user_id = get_user_id($this->user_netID))) {
         $params['user_is_admin'] = reason_user_has_privs($user_id, 'edit_html');
     }
     $this->change_element_type('post_content', $editor_name, $params);
     $this->change_element_type('description', $editor_name, $params);
 }
Ejemplo n.º 5
0
 function init($args = array())
 {
     parent::init($args);
     if ($this->controller->get_current_step() != 'EditNewsletter') {
         return;
     }
     $site_id = (int) $_REQUEST['site_id'];
     $editor_name = html_editor_name($site_id);
     $params = html_editor_params($site_id, $this->controller->user_id);
     $this->add_element('newsletter_loki', $editor_name, $params);
     $this->set_display_name('newsletter_loki', ' ');
 }
 /**
  * Add vimeo-integrated-specific fields to the disco form.  
  */
 public function alter_data()
 {
     $this->manager->set_display_name('name', 'Title');
     $this->manager->set_display_name('datetime', 'Date Originally Recorded/Created');
     $this->manager->set_comments('datetime', form_comment('The date this work was made or released'));
     $this->manager->set_comments('description', form_comment('The brief description that will appear with the work'));
     $editor_name = html_editor_name($this->manager->admin_page->site_id);
     $wysiwyg_settings = html_editor_params($this->manager->admin_page->site_id, $this->manager->admin_page->user_id);
     $min_wysiwyg_settings = $wysiwyg_settings;
     if (strpos($editor_name, 'loki') === 0) {
         $min_wysiwyg_settings['widgets'] = array('strong', 'em', 'linebreak', 'lists', 'link');
         if (reason_user_has_privs($this->manager->admin_page->user_id, 'edit_html')) {
             $min_wysiwyg_settings['widgets'][] = 'source';
         }
     }
     $this->manager->change_element_type('description', $editor_name, $min_wysiwyg_settings);
     $this->manager->set_element_properties('description', array('rows' => 5));
     $this->manager->change_element_type('content', $editor_name, $wysiwyg_settings);
     $this->manager->set_element_properties('content', array('rows' => 12));
     $this->manager->set_comments('content', form_comment('Full content, such as a transcript of the media work. You can leave this blank if you don\'t have time to transcribe the content of the work.'));
     $this->manager->set_display_name('content', 'Transcript');
     $this->manager->change_element_type('rights_statement', $editor_name, $min_wysiwyg_settings);
     $this->manager->set_element_properties('rights_statement', array('rows' => 3));
     $this->manager->set_comments('rights_statement', form_comment('e.g. "Some rights reserved. ' . FULL_ORGANIZATION_NAME . ' licenses this work under the <a href="http://creativecommons.org/licenses/by/2.5/">Creative Commons Attribution 2.5 License</a>." or "Copyright Margaret Smith, 1983. All rights reserved. Used with permission." You may leave this field blank if you are not sure about what license applies to this work.'));
     $this->manager->set_display_name('show_hide', 'Show or Hide?');
     $this->manager->change_element_type('show_hide', 'radio_no_sort', array('options' => array('show' => 'Show this work on the public site', 'hide' => 'Hide this work from the public site')));
     $this->manager->add_required('show_hide');
     $show_hide_val = $this->manager->get_value('show_hide');
     if (empty($show_hide_val)) {
         $this->manager->set_value('show_hide', 'show');
     }
     $this->manager->set_display_name('author', 'Creator');
     $this->manager->set_comments('author', form_comment('The person or entity who made this work (e.g. director/producer)'));
     $this->manager->set_comments('keywords', form_comment('Help others find this by entering the key terms and ideas presented in this work.'));
     $this->manager->set_comments('transcript_status', form_comment('Choose "Published" when the transcript is finalized'));
     if ($this->manager->get_value('media_publication_datetime') && $this->manager->get_value('media_publication_datetime') != '0000-00-00 00:00:00') {
         $this->manager->change_element_type('media_publication_datetime', 'solidText', array('display_name' => 'Published'));
     }
     if (!empty($this->manager->fields_to_remove)) {
         foreach ($this->manager->fields_to_remove as $field) {
             $this->manager->remove_element($field);
         }
     }
     $this->manager->set_order($this->manager->field_order);
     $this->manager->change_element_type('tmp_file_name', 'protected');
     // Hide all of the integrated-related fields in the form
     $this->manager->change_element_type('entry_id', 'protected');
     $this->manager->change_element_type('av_type', 'protected');
     $this->manager->change_element_type('media_duration', 'protected');
     $this->manager->change_element_type('transcoding_status', 'protected');
     $this->manager->change_element_type('integration_library', 'protected');
     $this->manager->change_element_type('show_embed', 'protected');
     $this->manager->change_element_type('show_download', 'protected');
     $this->manager->change_element_type('salt', 'cloaked');
     $this->manager->change_element_type('original_filename', 'protected');
     $this->manager->form_enctype = 'multipart/form-data';
     $this->_add_restriction_selector();
     if (VIMEO_UPLOADING_ENABLED) {
         $this->_add_file_upload_element();
     }
     $this->_add_url_element();
     $this->_add_file_preview();
     $this->_add_embed_code();
     $this->do_basic_vimeo_field_modification();
     if (!empty($this->manager->fields_to_remove)) {
         foreach ($this->manager->fields_to_remove as $field) {
             $this->manager->remove_element($field);
         }
     }
     $this->manager->set_order(array('file_preview', 'name', 'upload_file', 'vimeo_url', 'email_notification', 'show_embed', 'embed_small', 'embed_medium', 'embed_large', 'download_links', 'link', 'replacement_header', 'file_info_header', 'av_type', 'description', 'keywords', 'datetime', 'author', 'content', 'transcript_status', 'rights_statement', 'media_duration', 'media_publication_datetime', 'access_header', 'show_hide', 'restricted_group', 'no_share'));
 }
Ejemplo n.º 7
0
		function show_inline_editing_form()
		{
			echo '<div class="editable editing">';
			$item = new entity($this->current_item_id);
			$item_title = $item->get_value('release_title');
			$item_content = $item->get_value('content');
			$item_description = $item->get_value('description');
			$form = new Disco();
			$form->strip_tags_from_user_input = true;
			$form->allowable_HTML_tags = REASON_DEFAULT_ALLOWED_TAGS;
			$form->actions = array('save' => 'Save', 'save_and_finish' => 'Save and Finish Editing');
			
			$this->init_field($form, 'title_of_story', 'name', $item, 'text', 'solidtext');
			//$form->add_element('title_of_story', 'text');
			$form->set_display_name('title_of_story', 'Title');
			$form->set_value('title_of_story', $item_title);
			
			$this->init_field($form, 'editable_content', 'content', $item, html_editor_name($this->site_id), 'wysiwyg_disabled', html_editor_params($this->site_id, get_user_id($this->get_user_netid())));
			//$form->add_element('editable_content', html_editor_name($this->site_id), html_editor_params($this->site_id, get_user_id($this->get_user_netid())));
			$form->set_display_name('editable_content','Content');
			$form->set_value('editable_content', $item_content);
			
			$this->init_field($form, 'description_of_story', 'description', $item, html_editor_name($this->site_id), 'wysiwyg_disabled', html_editor_params($this->site_id, get_user_id($this->get_user_netid())));
			//$form->add_element('description_of_story', html_editor_name($this->site_id), html_editor_params($this->site_id, get_user_id($this->get_user_netid())));
			$form->set_display_name('description_of_story', 'Excerpt/Teaser (displayed on post listings; not required):');
			$form->set_value('description_of_story', $item_description);
			
			$form->add_callback(array(&$this, 'process_editable'),'process');
			$form->add_callback(array(&$this, 'where_to_editable'), 'where_to');
			$form->add_callback(array(&$this, 'run_error_checks_editable'), 'run_error_checks');
			$form->run();
			echo '</div>';
		}
 /**
  * Called in content manager's alter_data().
  */
 function alter_data()
 {
     $this->manager->set_display_name('name', 'Title');
     $this->manager->set_display_name('datetime', 'Date Originally Recorded/Created');
     $this->manager->add_comments('datetime', form_comment('The date this work was made or released'));
     $this->manager->add_comments('description', form_comment('The brief description that will appear with the work'));
     $editor_name = html_editor_name($this->manager->admin_page->site_id);
     $wysiwyg_settings = html_editor_params($this->manager->admin_page->site_id, $this->manager->admin_page->user_id);
     $min_wysiwyg_settings = $wysiwyg_settings;
     if (strpos($editor_name, 'loki') === 0) {
         $min_wysiwyg_settings['widgets'] = array('strong', 'em', 'linebreak', 'lists', 'link');
         if (reason_user_has_privs($this->manager->admin_page->user_id, 'edit_html')) {
             $min_wysiwyg_settings['widgets'][] = 'source';
         }
     }
     $this->manager->change_element_type('description', $editor_name, $min_wysiwyg_settings);
     $this->manager->set_element_properties('description', array('rows' => 5));
     $this->manager->change_element_type('content', $editor_name, $wysiwyg_settings);
     $this->manager->set_element_properties('content', array('rows' => 12));
     $this->manager->add_comments('content', form_comment('Full content, such as a transcript of the media work. You can leave this blank if you don\'t have time to transcribe the content of the work.'));
     $this->manager->set_display_name('content', 'Transcript');
     $this->manager->change_element_type('rights_statement', $editor_name, $min_wysiwyg_settings);
     $this->manager->set_element_properties('rights_statement', array('rows' => 3));
     $this->manager->add_comments('rights_statement', form_comment('e.g. "Some rights reserved. ' . FULL_ORGANIZATION_NAME . ' licenses this work under the <a href="http://creativecommons.org/licenses/by/2.5/">Creative Commons Attribution 2.5 License</a>." or "Copyright Margaret Smith, 1983. All rights reserved. Used with permission." You may leave this field blank if you are not sure about what license applies to this work.'));
     $this->manager->set_display_name('show_hide', 'Show or Hide?');
     $this->manager->change_element_type('show_hide', 'radio_no_sort', array('options' => array('show' => 'Show this work on the public site', 'hide' => 'Hide this work from the public site')));
     $this->manager->add_required('show_hide');
     $show_hide_val = $this->manager->get_value('show_hide');
     if (empty($show_hide_val)) {
         $this->manager->set_value('show_hide', 'show');
     }
     $this->manager->set_display_name('author', 'Creator');
     $this->manager->add_comments('author', form_comment('The person or entity who made this work (e.g. director/producer)'));
     $this->manager->add_comments('keywords', form_comment('Help others find this by entering the key terms and ideas presented in this work.'));
     $this->manager->add_comments('transcript_status', form_comment('Choose "Published" when the transcript is finalized'));
     if ($this->manager->get_value('media_publication_datetime') && $this->manager->get_value('media_publication_datetime') != '0000-00-00 00:00:00') {
         $this->manager->change_element_type('media_publication_datetime', 'solidText', array('display_name' => 'Published'));
     }
     if (!empty($this->manager->fields_to_remove)) {
         foreach ($this->manager->fields_to_remove as $field) {
             $this->manager->remove_element($field);
         }
     }
     $this->manager->set_order($this->manager->field_order);
     $this->manager->change_element_type('tmp_file_name', 'protected');
     // Hide all of the integrated-related fields in the form
     $this->manager->change_element_type('entry_id', 'protected');
     $this->manager->change_element_type('av_type', 'protected');
     $this->manager->change_element_type('media_duration', 'protected');
     $this->manager->change_element_type('transcoding_status', 'protected');
     $this->manager->change_element_type('integration_library', 'protected');
     $this->manager->change_element_type('email_notification', 'protected');
     $this->manager->change_element_type('show_embed', 'protected');
     $this->manager->change_element_type('show_download', 'protected');
     $this->manager->change_element_type('salt', 'cloaked');
     $this->manager->change_element_type('original_filename', 'protected');
     reason_include_once('classes/media/default/displayer_chrome/default.php');
     $displayer_chrome = new DefaultDefaultDisplayerChrome();
     $displayer_chrome->set_media_work(new entity($this->manager->get_value('id')));
     $displayer_chrome->set_media_height('small');
     $html_markup = $displayer_chrome->get_html_markup();
     $es = new entity_selector();
     $es->add_type(id_of('av_file'));
     $es->add_right_relationship($this->manager->get_value('id'), relationship_id_of('av_to_av_file'));
     $results = $es->run_one();
     if (count($results) > 0) {
         $this->manager->add_element('file_preview', 'commentWithLabel', array('text' => $html_markup));
         $this->manager->set_order(array('file_preview'));
     }
 }
Ejemplo n.º 9
0
		function run_policy_metadata_form($policy)
		{
			echo '<a name="metadataEdit"></a>'."\n";
			$this->edit_policy = $policy;
			
			$form = new Disco();
			$form->strip_tags_from_user_input = true;
			$form->allowable_HTML_tags = REASON_DEFAULT_ALLOWED_TAGS;
			$form->actions = array('save' => 'Save', 'save_and_finish' => 'Save and Finish Editing');
			

			$this->init_field($form, 'approvals', $policy, html_editor_name($this->site_id), 'wysiwyg_disabled', html_editor_params($this->site_id, $this->get_html_editor_user_id()));
			$form->set_value('approvals', $policy->get_value('approvals'));
			$form->set_element_properties( 'approvals', array('rows'=>5));	
	
			$this->init_field($form, 'last_revised_date', $policy, 'textDate', 'solidtext');
			$form->set_value('last_revised_date', $policy->get_value('last_revised_date'));
		
			$this->init_field($form, 'last_reviewed_date', $policy, 'checkbox', 'solidtext');
			$form->set_display_name('last_reviewed_date', 'I have reviewed this policy');				
		
			$this->init_field($form, 'keywords', $policy, 'text', 'solidtext');
			$form->set_value('keywords', $policy->get_value('keywords'));
		
			/* This next chunk of code handles the logic for setting the initial values
			 of the audience checkboxes. */
			// First, build an array [audience name => index] for all possible audiences
			$this->audience_opts = array();
			$i = 0;
			foreach ($this->all_audiences as $audience)
			{
				$this->audience_opts[$audience->get_value('name')] = $i++;
			}
			
			// Now, retrieve the audiences that are currently associated with the policy we are currently editing
			$es = new entity_selector();
			$es->add_type(id_of('audience_type'));
			$es->add_right_relationship($policy->id(), relationship_id_of('policy_to_relevant_audience'));
			$this->related_audiences = $es->run_one();				
			
			// Lastly, build an array of the indexes of the audiences that are currently associated with this policy
			$checked_audiences = array();
			foreach ($this->related_audiences as $audience)
			{
				$checked_audiences[] = $this->audience_opts[$audience->get_value('name')];
			}
			// Then, add the names of the audiences to the checkboxgroup plasmature
			if ($policy->user_can_edit_relationship('policy_to_relevant_audience', $user = null, 'right'))
			{
				$form->add_element('audiences', 'checkboxgroup', array('options' => array_keys($this->audience_opts)));
				$form->set_value('audiences', $checked_audiences);
			}
			else
			{
				$form->add_element('audiences', 'solidtext');
				$names = array();
				foreach ($this->audience_opts as $name => $val)
				{
					if (in_array($val, $checked_audiences))
						$names[] = $name;
				}
				sort($names);
				$form->set_value('audiences', implode(' ', $names));
			}
			$form->add_required('audiences');
			
			$form->add_callback(array(&$this, '_process_policy_metadata'),'process');
			$form->add_callback(array(&$this, '_where_to_policy_metadata'), 'where_to');
			$form->run();	
		}
Ejemplo n.º 10
0
 function alter_data()
 {
     $site = new entity($this->get_value('site_id'));
     if ($site->get_value('unique_name') == 'sfs_site' && !$this->get_value('job_category')) {
         $this->set_value('job_category', 'Student');
     } elseif ($site->get_value('unique_name') == 'human_resources_office_site' && !$this->get_value('job_category')) {
         $this->set_value('job_category', 'Staff');
     } elseif ($site->get_value('unique_name') == 'dean_of_the_college_office' && !$this->get_value('job_category')) {
         $this->set_value('job_category', 'Faculty');
     }
     if ($this->get_value('job_category') != 'Student') {
         //hide fields applicable to student jobs
         $this->change_element_type('supervisor', 'hidden');
         $this->change_element_type('term_job', 'hidden');
         $this->change_element_type('break_job', 'hidden');
         $this->change_element_type('dept_charge_number', 'hidden');
         $this->remove_element('author');
     }
     $this->change_element_type('content', html_editor_name($this->admin_page->site_id), html_editor_params($this->admin_page->site_id, $this->admin_page->user_id));
     $this->add_element('hr1', 'hr');
     $this->add_element('hr2', 'hr');
     $this->add_element('hr3', 'hr');
     $this->set_display_name('name', 'Title');
     $this->set_display_name('job_category', 'Position Type');
     $this->set_display_name('position_start', 'Position starts on');
     $this->set_comments('position_start', form_comment('mm/dd/yyyy'));
     $this->set_display_name('content', 'Position Information');
     $this->set_comments('content', form_comment('This should include things like the purpose of the position, an overview, the responsibilities, hours required, minimum qualifications, desired qualities, contact information, and other notes.'));
     $this->set_display_name('duration', 'How long should job be posted?');
     $this->set_display_name('posting_start', 'Posting starts on');
     $this->set_comments('posting_start', form_comment('mm/dd/yyyy'));
     $this->set_comments('duration', form_comment('Number of days'));
     $this->set_display_name('show_hide', 'Show or hide posting?');
     if (!$this->get_value('show_hide')) {
         $this->set_value('show_hide', 'show');
     }
     $this->add_required('tenure_track');
     $this->add_required('posting_start');
     $this->add_required('duration');
     $this->add_required('show_hide');
     $this->add_required('content');
     $this->add_required('job_category');
     if (!$this->get_value('tenure_track')) {
         $this->set_value('tenure_track', 'no');
     }
     if ($site->get_value('unique_name') == 'human_resources_office_site') {
         $this->change_element_type('tenure_track', 'hidden');
     } elseif ($site->get_value('unique_name') == 'dean_of_the_college_office') {
         $this->change_element_type('office', 'hidden');
     }
     $this->set_order(array('name', 'title_extension', 'office', 'position_start', 'job_category', 'hr1', 'content', 'tenure_track', 'hr2', 'posting_start', 'duration', 'show_hide', 'hr3'));
     if ($this->get_value('job_category') == 'Student') {
         $this->add_element('comment1', 'comment', array('text' => 'Position is available:'));
         $this->change_element_type('title_extension', 'hidden');
         $this->change_element_type('tenure_track', 'hidden');
         $this->set_display_name('author', 'Post Submitted By');
         $this->set_display_name('name', 'Position Title');
         $this->set_display_name('office', 'Department or Office');
         $this->set_display_name('term_job', 'During Term');
         $this->set_display_name('break_job', 'During Break');
         $this->set_display_name('content', 'Description');
         $this->set_display_name('dept_charge_number', 'Department Charge Number');
         if (!$this->get_value('duration')) {
             $this->set_value('duration', '30');
         }
         if (!$this->get_value('posting_start')) {
             $this->set_value('posting_start', time());
         }
         $this->set_order(array('name', 'office', 'dept_charge_number', 'supervisor', 'job_category', 'content', 'hr1', 'position_start', 'comment1', 'term_job', 'break_job', 'hr2', 'posting_start', 'duration', 'show_hide', 'author', 'hr3', 'unique_name'));
     }
 }
Ejemplo n.º 11
0
 function alter_data()
 {
     // Hide fields that are not used
     $this->change_element_type('keywords', 'hidden');
     if ($this->is_element('commenting_state')) {
         $this->change_element_type('commenting_state', 'hidden');
     }
     if ($this->is_element('pagination_state')) {
         $this->change_element_type('pagination_state', 'hidden');
     }
     if ($this->is_element('enable_comment_notification')) {
         $this->change_element_type('enable_comment_notification', 'hidden');
     }
     if ($this->is_element('enable_front_end_posting')) {
         $this->change_element_type('enable_front_end_posting', 'hidden');
     }
     // Name
     $this->set_display_name('name', 'Publication Name');
     // Publication type
     $this->add_required('publication_type');
     if (!$this->get_value('publication_type')) {
         $this->set_value('publication_type', 'blog');
     }
     // Posts per page
     $this->add_required('posts_per_page');
     // Date format
     $this->set_comments('date_format', form_comment('Posts on this publication will use the date format that you select to show the date (and/or) time of publication.'));
     $this->change_element_type('date_format', 'select_no_sort', array('options' => array('F j, Y \\a\\t g:i a' => date('F j, Y \\a\\t g:i a'), 'n/d/y \\a\\t g:i a' => date('n/d/y \\a\\t g:i a'), 'l, F j, Y' => date('l, F j, Y'), 'F j, Y' => date('F j, Y'), 'n/d/y' => date('n/d/y'), 'n.d.y' => date('n.d.y'), 'j F Y' => date('j F Y'), 'j F Y \\a\\t  g:i a' => date('j F Y \\a\\t  g:i a'), 'j F Y \\a\\t  g:i a' => date('j F Y \\a\\t  H:i'))));
     // RSS
     $this->add_element('rss_comment', 'comment', array('text' => '<h4>RSS</h4>'));
     $this->add_comments('rss_comment', form_comment('RSS is a way for people to suscribe to your publication and be informed when there are new posts.'));
     $this->set_display_name('blog_feed_string', 'RSS feed URL');
     $this->add_required('blog_feed_string');
     $this->add_comments('blog_feed_string', form_comment('The URL snippet that this blog / publication will use for its RSS feed.'));
     $this->set_display_name('blog_feed_include_content', 'RSS Format');
     $this->change_element_type('blog_feed_include_content', 'radio', array('options' => array('no' => 'Descriptions only (Suscribers must click to see full content)', 'yes' => 'Publish full content in RSS')));
     if (defined('PUBLICATION_HIDE_FEED_DESCRIPTION_CHECKBOX') && PUBLICATION_HIDE_FEED_DESCRIPTION_CHECKBOX) {
         $this->change_element_type('blog_feed_include_content', 'cloaked');
     }
     if (!$this->get_value('blog_feed_include_content')) {
         if (!$this->is_new_entity() || !defined('PUBLICATION_FEED_DEFAULT_TO_CONTENT') || !PUBLICATION_FEED_DEFAULT_TO_CONTENT) {
             $this->set_value('blog_feed_include_content', 'no');
         } else {
             $this->set_value('blog_feed_include_content', 'yes');
         }
     }
     if ($this->is_new_entity() || reason_user_has_privs($this->admin_page->user_id, 'edit_fragile_slugs')) {
         $this->add_comments('blog_feed_string', form_comment('Only lowercase letters and underscores are allowed in this field.'));
         if (!reason_user_has_privs($this->admin_page->user_id, 'edit_fragile_slugs')) {
             $this->add_comments('blog_feed_string', form_comment('After this publication has been "finished" the first time, this URL snippet will not be editable. So choose wisely.'));
         } else {
             $this->add_comments('blog_feed_string', form_comment('You may edit this field because you are a Reason admin.  However, if you change the URL, the feed will break in any newsreaders that are currently subscribed to this publication.'));
         }
     } else {
         $this->change_element_type('blog_feed_string', 'solidtext');
         $this->add_comments('blog_feed_string', form_comment('This field is now fixed so that newsreaders can rely on a stable URL.'));
     }
     // Description
     $this->change_element_type('description', html_editor_name($this->admin_page->site_id), html_editor_params($this->admin_page->site_id, $this->admin_page->user_id));
     // Social sharing
     $this->add_element('social_sharing_comment', 'comment', array('text' => '<h4>Social Sharing</h4>'));
     $this->add_comments('social_sharing_comment', form_comment('Would you like to provide links to share your content on social networks?'));
     $this->set_display_name('enable_social_sharing', '&nbsp;');
     $this->change_element_type('enable_social_sharing', 'radio', array('options' => array('no' => 'Don\'t provide buttons to share posts', 'yes' => 'Provide buttons to share posts on social networks')));
     if (!$this->get_value('enable_social_sharing')) {
         if (!$this->is_new_entity() || !defined('PUBLICATION_SOCIAL_SHARING_DEFAULT') || !PUBLICATION_SOCIAL_SHARING_DEFAULT) {
             $this->set_value('enable_social_sharing', 'no');
         } else {
             $this->set_value('enable_social_sharing', 'yes');
         }
     }
     // Front-end posting
     $this->add_element('posting_comment', 'comment', array('text' => '<h4>Posting on the public site</h4>'));
     $this->add_required('hold_posts_for_review');
     $this->change_element_type('hold_posts_for_review', 'radio', array('options' => array('no' => 'Publish posts automatically', 'yes' => 'Hold posts for review')));
     $this->set_display_name('hold_posts_for_review', 'New Post Moderation');
     $this->add_element('allow_front_end_posting', 'checkbox');
     $this->add_comments('allow_front_end_posting', form_comment('Check to enable simple posting on the publication'));
     $this->set_display_name('notify_upon_post', 'New Post Notification');
     $this->add_comments('notify_upon_post', form_comment('Who should be notified when a post is added to this publication? Enter usernames or email addresses, separated by commas. Leave this field blank if you don\'t want any notification to be sent.'));
     // Commenting
     $this->add_element('comment_comment', 'comment', array('text' => '<h4>Commenting</h4>'));
     $this->add_element('allow_comments', 'checkbox');
     $this->add_required('hold_comments_for_review');
     $this->change_element_type('hold_comments_for_review', 'radio', array('options' => array('no' => 'Publish comments automatically', 'yes' => 'Hold comments for review')));
     $this->set_display_name('hold_comments_for_review', 'Comment Moderation');
     $this->set_display_name('notify_upon_comment', 'New Comment Notification');
     $this->add_comments('notify_upon_comment', form_comment('Who should be notified when a comment is added to this publication? Enter usernames or email addresses, separated by commas. Leave this field blank if you don\'t want any notification to be sent.'));
     // Posting & commenting defaults
     if (site_borrows_entity($this->get_value('site_id'), id_of('nobody_group')) || site_owns_entity($this->get_value('site_id'), id_of('nobody_group'))) {
         $nobody_group = new entity(id_of('nobody_group'));
         if (!$this->entity->has_left_relation_with_entity($nobody_group, 'publication_to_authorized_posting_group')) {
             $this->set_value('allow_front_end_posting', 'true');
         }
         if (!$this->entity->has_left_relation_with_entity($nobody_group, 'publication_to_authorized_commenting_group')) {
             $this->set_value('allow_comments', 'true');
         }
     } else {
         $this->set_value('allow_comments', 'true');
         $this->set_value('allow_front_end_posting', 'true');
     }
     if (!$this->get_value('hold_comments_for_review')) {
         $this->set_value('hold_comments_for_review', 'no');
     }
     if (!$this->get_value('hold_posts_for_review')) {
         $this->set_value('hold_posts_for_review', 'no');
     }
     // Issues & Sections
     $this->add_element('issue_section_comment', 'comment', array('text' => '<h4>Issues and sections</h4>'));
     $this->set_display_name('has_issues', 'Issues');
     $this->change_element_type('has_issues', 'radio', array('options' => array('no' => 'No Issues (Display posts as they are published)', 'yes' => 'Group posts into issues, like a printed magazine (note that you will need to set up at least one issue before any posts will appear)')));
     if (!$this->get_value('has_issues')) {
         $this->set_value('has_issues', 'no');
     }
     $this->set_display_name('has_sections', 'Sections');
     $this->change_element_type('has_sections', 'radio', array('options' => array('no' => 'No sections (Display posts by date)', 'yes' => 'Display posts under section headings (note that you will need to create sections for your publication)')));
     if (!$this->get_value('has_sections')) {
         $this->set_value('has_sections', 'no');
     }
     // Reminders
     $this->add_element('reminder_comment', 'comment', array('text' => '<h4>Reminders</h4>'));
     $this->set_display_name('reminder_days', 'Days Before Reminder');
     $this->add_comments('reminder_days', form_comment('How many days of inactivity before Reason sends an email reminder? Leave blank or enter 0 to disable this feature.'));
     $this->set_display_name('reminder_emails', 'Send Reminders To');
     $this->add_comments('reminder_emails', form_comment('The emails or usernames of people who should be reminded'));
     $this->add_comments('reminder_comment', form_comment(' Reason can send an email reminder if it has been a while since the last post.'));
     if (!defined('PUBLICATION_REMINDER_CRON_SET_UP') || !PUBLICATION_REMINDER_CRON_SET_UP) {
         $this->change_element_type('reminder_days', 'hidden');
         $this->change_element_type('reminder_emails', 'hidden');
         $this->change_element_type('reminder_comment', 'hidden');
     }
     //Sharing among reason sites
     if (!$this->element_is_hidden('no_share')) {
         $this->add_element('share_comment', 'comment', array('text' => '<h4>Sharing Among Reason Sites</h4>'));
     }
     $this->set_order(array('name', 'publication_type', 'posts_per_page', 'date_format', 'description', 'rss_comment', 'blog_feed_string', 'blog_feed_include_content', 'social_sharing_comment', 'enable_social_sharing', 'posting_comment', 'allow_front_end_posting', 'notify_upon_post', 'hold_posts_for_review', 'comment_comment', 'allow_comments', 'notify_upon_comment', 'hold_comments_for_review', 'issue_section_comment', 'has_issues', 'has_sections', 'reminder_comment', 'reminder_days', 'reminder_emails', 'share_comment', 'no_share', 'unique_name'));
 }
Ejemplo n.º 12
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;
 }