예제 #1
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";
 }
예제 #2
0
 function display_entity()
 {
     $this->start_table();
     $id = $this->_entity->id();
     // Full Size Image
     $full_name = reason_get_image_filename($id);
     $local_full_image_path = PHOTOSTOCK . $full_name;
     if (file_exists($local_full_image_path)) {
         $this->show_item_default('Full Image', '<img src="' . WEB_PHOTOSTOCK . $full_name . '" alt="Full Size Image" />');
     }
     // Thumbnail Image
     $tn_name = reason_get_image_filename($id, 'thumbnail');
     $local_tn_image_path = PHOTOSTOCK . $tn_name;
     if (file_exists($local_tn_image_path)) {
         $this->show_item_default('Thumbnail Image', '<img src="' . WEB_PHOTOSTOCK . $tn_name . '" alt="Thumbnail Image" />');
     }
     // Original Image if we are in the owner site
     $owner = $this->_entity->get_owner();
     if (!empty($owner) && $owner->id() == $this->admin_page->site_id) {
         $original_name = reason_get_image_filename($id, 'original');
         $local_original_image_path = PHOTOSTOCK . $original_name;
         if (file_exists($local_original_image_path)) {
             $this->show_item_default('Hi-Res Image', '<a href="' . WEB_PHOTOSTOCK . $original_name . '">View original image </a>');
         }
     }
     $this->show_item_default('Custom sizes', '<a href="' . carl_make_link(array('cur_module' => 'ImageSizer')) . '">Get this image at a custom size</a>');
     // Everything Else
     $this->show_all_values($this->_entity->get_values());
     $this->end_table();
 }
 /**
  * Returns the html markup used to display the size selector elements.
  *
  * @param $media_work
  * @param $initial_height the initial height the media work is displayed at
  * @return string html
  */
 public function get_size_selector_html($media_work, $initial_height)
 {
     $small_url = carl_make_link(array('displayer_height' => MEDIA_WORK_SMALL_HEIGHT));
     $medium_url = carl_make_link(array('displayer_height' => MEDIA_WORK_MEDIUM_HEIGHT));
     $large_url = carl_make_link(array('displayer_height' => MEDIA_WORK_LARGE_HEIGHT));
     if (MEDIA_WORK_SMALL_HEIGHT == $initial_height || strtolower($initial_height) == 'small') {
         $small_link = '<strong><a>Small <em>(' . MEDIA_WORK_SMALL_HEIGHT . 'p)</em></a></strong>' . "\n";
     } else {
         $small_link = '<a href="' . $small_url . '" >Small <em>(' . MEDIA_WORK_SMALL_HEIGHT . 'p)</em></a>' . "\n";
     }
     if (MEDIA_WORK_MEDIUM_HEIGHT == $initial_height || strtolower($initial_height) == 'medium') {
         $medium_link = '<strong><a>Medium <em>(' . MEDIA_WORK_MEDIUM_HEIGHT . 'p)</em></a></strong>' . "\n";
     } else {
         $medium_link = '<a href="' . $medium_url . '" >Medium <em>(' . MEDIA_WORK_MEDIUM_HEIGHT . 'p)</em></a>' . "\n";
     }
     if (MEDIA_WORK_LARGE_HEIGHT == $initial_height || strtolower($initial_height) == 'large') {
         $large_link = '<strong><a>Large <em>(' . MEDIA_WORK_LARGE_HEIGHT . 'p)</em></a></strong>' . "\n";
     } else {
         $large_link = '<a href="' . $large_url . '" >Large <em>(' . MEDIA_WORK_LARGE_HEIGHT . 'p)</em></a>' . "\n";
     }
     $html = '';
     $html .= '<div class="size_links">' . "\n";
     $html .= '<h4>Video Size:</h4>' . "\n";
     $html .= '<ul>' . "\n";
     $html .= '<li data-size="' . MEDIA_WORK_SMALL_HEIGHT . '" data-link="' . $small_url . '" class="small_link"><span class="buttonSize">' . $small_link . '</span></li>' . "\n";
     $html .= '<li data-size="' . MEDIA_WORK_MEDIUM_HEIGHT . '" data-link="' . $medium_url . '" class="medium_link"><span class="buttonSize">' . $medium_link . '</span></li>' . "\n";
     $html .= '<li data-size="' . MEDIA_WORK_LARGE_HEIGHT . '" data-link="' . $large_url . '" class="large_link"><span class="buttonSize">' . $large_link . '</span></li>' . "\n";
     $html .= '</ul>' . "\n";
     $html .= '</div>' . "\n";
     return $html;
 }
예제 #4
0
 function run_editable()
 {
     // Show a small disco inline editing form if it is activated, display the title
     // and an activation button if not.
     $inline_edit =& get_reason_inline_editing($this->page_id);
     $active = $inline_edit->active_for_module($this);
     $class = $active ? 'editable editing' : 'editable';
     echo '<div class="' . $class . '">' . "\n";
     if ($inline_edit->active_for_module($this)) {
         $form = new Disco();
         $form->strip_tags_from_user_input = true;
         $form->allowable_HTML_tags = '';
         $form->add_element('page_title', 'text');
         $form->set_value('page_title', $this->parent->title);
         $form->add_required('page_title');
         $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));
         $link = '<p><a href="' . $url . '" class="editThis">Edit Page Title</a></p>' . "\n";
         $pre = '<div class="editRegion">' . "\n";
         $post = '</div>' . "\n";
         $output = $pre . $this->get_formatted_page_title() . $link . $post;
         echo $output;
     }
     echo '</div>' . "\n";
 }
 function step_pre_show_form()
 {
     echo '<h2>Create a Publication</h2>';
     if (!empty($this->site_publication_names_by_id)) {
         $pub_string = count($this->site_publication_names_by_id) == 1 ? 'publication' : 'publications';
         $link = carl_make_link(array('active_screen' => 2));
         echo '<p>...Or <a href="' . $link . '">attach news items to existing ' . $pub_string . '</a></p>';
     }
 }
 function on_every_time()
 {
     $this->change_element_type('event_date', 'solidtext');
     $this->set_value('event_date', prettify_mysql_datetime($this->request_array['date']));
     if ($this->show_date_change_link == true) {
         $link = carl_make_link(array('date' => '', 'slot_id' => ''));
         $this->add_comments('event_date', '<a href="' . $link . '">Register for a different date</a>');
     }
 }
예제 #7
0
 function get_cache_status()
 {
     $rpc = $this->get_reason_page_cache();
     if ($rpc->page_cache_exists() && !$rpc->page_cache_is_empty()) {
         $link = carl_make_link(array('kill_cache' => 1));
         return 'Cached. (<a href="' . $link . '">delete cache</a>)';
     } else {
         return 'Not cached.';
     }
 }
 function run()
 {
     $master_admin_link = carl_construct_link(array('site_id' => id_of('master_admin')));
     $link[] = '<a href="' . $master_admin_link . '">Return to master admin</a>';
     if ($this->authenticate() && $this->table_admin->get_table_row_action()) {
         $url2 = carl_make_link($this->table_admin->get_menu_links_base_with_filters());
         $link[] = '<a href="' . $url2 . '">Show allowable relationships list</a>';
     }
     echo implode(' | ', $link);
     if (!$this->authenticate()) {
         echo '<h3>You do not have the proper privileges to use this module</h3>';
     } else {
         $this->table_admin->run();
     }
 }
 function show_memory()
 {
     if ($this->helper->get_type_id() && $this->helper->get_search_term()) {
         $excluded = $this->helper->get_excluded();
         $excluded_string = !empty($excluded) ? implode(",", $excluded) : false;
         echo '<div id="excluded" style="float:right; border:1px solid #000; padding: 10px;">';
         echo '<h4>Excluded IDs</h4>';
         if ($excluded_string) {
             echo '<p>' . $excluded_string . '</p>';
             $clear_link = carl_make_link(array('clear_exclude' => "true"));
             echo '<p><a href="' . $clear_link . '">Clear excluded ids</a></p>';
         } else {
             echo '<p>No ids currently excluded for this type and set of fields.</p>';
         }
         echo '</div>';
     }
 }
 function step_init()
 {
     $this->site_id = $this->helper->get_site_id();
     if (!$this->site_id) {
         $this->redirect_to_screen(1);
     }
     $this->user_id = $this->helper->get_user_id();
     $this->site_name = $this->helper->get_site_name();
     $this->new_publication_link = carl_make_link(array('active_screen' => "3"));
     $this->site_publication_names_by_id = $this->helper->get_site_publication_names_by_id();
     $this->unattached_issue_names_by_id = $this->helper->get_unattached_issue_names_by_id();
     if (empty($this->site_publication_names_by_id)) {
         $this->redirect_to_screen("3");
     }
     if (empty($this->unattached_issue_names_by_id)) {
         $this->redirect_to_screen("2");
     }
 }
예제 #11
0
 function on_every_time()
 {
     if ($this->disabled_for_maintenance()) {
         echo '<p>Posting is temporarily disabled because the website is in maintenance mode. Please try again later.</p>';
         $this->show_form = false;
         return false;
     }
     if ($this->hold_posts_for_review) {
         $this->actions['Submit'] = 'Submit Post (Moderated)';
     }
     // nwhite make a nice link that only clears add item and return text that identifies publication type
     $pub_type = ($pt = $this->publication->get_value('publication_type')) ? strtolower($pt) : 'publication';
     $link = carl_make_link(array('add_item' => ''));
     $this->change_element_type('dont_post', 'comment', array('text' => '<a href="' . $link . '">Return to ' . $pub_type . ' without posting</a>'));
     if (!empty($this->user_netID)) {
         $this->set_value('author', $this->user_netID);
     }
     $this->do_wysiwygs();
     $this->do_categories();
     $this->do_issues();
     $this->do_sections();
     $this->set_order($this->get_order_array());
 }
예제 #12
0
 /**
  * Account type is not set - we force selection of a valid account type.
  */
 function no_show_form()
 {
     $options = $this->social_helper()->get_available_integrators();
     if (!empty($options)) {
         echo '<div class="socialAccountTypeSelector">';
         echo '<p>Which social account would you like to create?</p>';
         echo '<ul>';
         foreach ($options as $k => $v) {
             $link = carl_make_link(array('account_type' => $k));
             $image = '';
             if ($integrator = $this->social_helper()->get_integrator($k, 'SocialAccountPlatform')) {
                 if (method_exists($integrator, 'get_platform_icon')) {
                     $image = '<img src="' . htmlspecialchars($integrator->get_platform_icon()) . '" alt="' . htmlspecialchars($v) . ' icon" height="25" width="25" /> ';
                 }
             }
             echo '<li><a href="' . $link . '">' . $image . $v . '</a></li>';
         }
         echo '</ul>';
         echo '</div>';
     } else {
         echo '<p>This installation of Reason CMS does not have any social account options enabled.</p>';
     }
 }
 /**
  * Adds a preview of the media work to the form.
  */
 function _add_file_preview()
 {
     if ($this->manager->get_value('transcoding_status') == 'ready') {
         $entity = new entity($this->manager->get_value('id'));
         $embed_markup = '';
         $this->displayer_chrome->set_media_height('small');
         $this->displayer_chrome->set_google_analytics(false);
         $embed_markup .= $this->displayer_chrome->get_html_markup();
         if ($this->manager->get_value('av_type') == 'Video') {
             $image_picker_url = carl_make_link(array('cur_module' => 'ZencoderMediaImagePicker'));
             $image_picker_link = '<br/><a href="' . $image_picker_url . '"><strong>Choose a thumbnail for this video</strong></a>';
             $embed_markup .= $image_picker_link;
         }
         if (!empty($embed_markup)) {
             $this->manager->add_element('file_preview', 'commentWithLabel', array('text' => $embed_markup));
             $this->manager->set_display_name('file_preview', 'Preview');
         }
     }
 }
예제 #14
0
 function get_display_value_name($value, &$item, $summary_mode)
 {
     if ($summary_mode) {
         $item_name = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
         $link_to_item = carl_make_link(array('item_id' => $item->id()));
         return '<a href="' . $link_to_item . '">' . $item_name . '</a>';
     } else {
         return $value;
     }
 }
예제 #15
0
    function run()
    {
        $form = $this->get_form();
        // thor_core needs the XML from the form entities thor_content field, and the table name the data is stored in
        $xml = $form->get_value('thor_content');
        $table_name = 'form_' . $form->id();
        $thor_core = new ThorCore($xml, $table_name);
        $thor_values = $thor_core->get_rows();
        // Loop through the database information to gather the poll results
        $pretty_values = array();
        if ($thor_values != "") {
            foreach ($thor_values as $t_v) {
                foreach ($t_v as $key => $value) {
                    if ($key != "id" && $key != "submitted_by" && $key != "submitter_ip" && $key != "date_created" && $key != "date_modified") {
                        $pretty_values[] = $value;
                    }
                }
            }
        }
        // Get the total number of results and then find the total results for each option
        $responses = array_count_values($pretty_values);
        $accumulator = array();
        foreach ($responses as $response) {
            $accumulator[] = $response;
        }
        // Get the label for each option
        $name = array();
        foreach ($responses as $key => $value) {
            $name[] = $key;
        }
        // Calculate the total and get the percentage for each option
        $total = 0;
        $per = array();
        foreach ($accumulator as $key => $value) {
            $total += $value;
        }
        if ($total > 0) {
            for ($i = 0; $i <= count($accumulator) - 1; $i++) {
                $per[$i] = round($accumulator[$i] / $total * 100) . "%";
            }
        }
        if (!$this->show_results()) {
            echo '<p><a href="' . carl_make_link(array('show_results' => 1, 'submission_key' => '')) . '">Show Results</a></p>';
        } else {
            echo '<p><a href="' . carl_make_link(array('show_results' => 0, 'submission_key' => '')) . '">Hide Results</a></p>';
        }
        if ($this->show_results()) {
            if ($this->sidebar) {
                echo '<div id="interactive" class="graph">';
            } else {
                echo '<div id="graph1" class="graph">';
            }
            for ($i = 0; $i <= count($accumulator) - 1; $i++) {
                echo '<table width="300px" border="solid" cellpadding="5px">
				<tr>
				<td width="50px">' . reason_htmlspecialchars($per[$i]) . ' </td><td> ' . reason_htmlspecialchars($name[$i]) . '</td>
				</tr>
				</table>';
            }
            echo '</div>';
            if ($this->sidebar) {
                echo '<div id="hover"></div>';
            }
            echo '<div id="responses"><p><strong>Total responses: ' . $total . '</strong></p></div>';
        }
        $datas = array();
        $lbls = array();
        for ($i = 0; $i <= count($accumulator) - 1; $i++) {
            $datas[$i] = $accumulator[$i];
            $lbls[$i] = $name[$i];
        }
        // Transfer the labels and totals for each option to polls.js
        echo '<script type="text/javascript">' . "\n";
        echo 'var data = new Array();' . "\n";
        echo 'var lbl = new Array();' . "\n";
        echo 'var color = new Array();' . "\n";
        for ($i = 0; $i <= count($datas) - 1; $i++) {
            $color = isset($this->params['custom_colors'][$i]) ? $this->params['custom_colors'][$i] : "#" . dechex(rand(0, 10000000));
            echo 'color[' . $i . '] = "' . addslashes(htmlspecialchars($color)) . '" ;' . "\n";
            echo 'data[' . $i . '] =' . addslashes(htmlspecialchars($datas[$i])) . ';' . "\n";
            echo 'lbl[' . $i . '] = "' . addslashes(htmlspecialchars($lbls[$i])) . '" ;' . "\n";
        }
        echo '</script>' . "\n";
    }
예제 #16
0
		function display_sub_policy_editable($policy, $cur_policy_edit_id, $inline_edit)
		{
			echo '<div class="editable">';
			
			// if this policy is the one currently being edited, we display a disco form.  Othewise,
			// we display the policy normally with inline editing css elements.
			if ($inline_edit->active_for_module($this) && $cur_policy_edit_id == $policy->id())
			{
				echo '<div class="policy sub_policy">'."\n";
				$this->run_policy_data_form($policy, false);
				echo '</div>'."\n";
			}
			else
			{
				echo '<div class="policy sub_policy editRegion">'."\n";
				echo '<a id="'.$policy->id().'" name="'.$policy->id().'"></a>';
				echo "<h4 class='policyName'>" . 	$policy->get_value('name') . "</h4>\n";
				echo '<div class="policyContent">'.$policy->get_value('content') . '</div>';
				
				$activation_params = $inline_edit->get_activation_params($this);
				$activation_params['edit_id'] = $policy->id();
				$url = carl_make_link($activation_params);
				echo '<p><a href="'.$url.'#'.$policy->id().'" class="editThis">Edit Section</a></p>'."\n";
				echo '</div>'."\n";	
			}
			$this->display_sub_policies($policy, true, $cur_policy_edit_id, $inline_edit);
			echo '</div>';
		}
예제 #17
0
	/**
	 * Show a link to enable benchmarks, or if enabled, the benchmarks themselves with a link to turn them off
	 * 
	 * This is called by generate_page.php after page generation if is_developer returns true.
	 */
	function display_benchmark_section()
	{
		if ($this->should_benchmark())
		{
			$timer =& $this->_get_timer();
			$timer->report_all();
			$link = carl_make_link(array('reason_benchmark' => ""));
			echo '<p><a href="'. $link . '">disable benchmarks</a></p>'."\n";
		}
		else
		{
			$link = carl_make_link(array('reason_benchmark' => 1));
			echo '<p><a href="'. $link . '">enable benchmarks</a></p>'."\n";
		}
		//$encoded_target = urlencode(carl_make_link(array('_force_mime_type'=>'xhtml'),'','',false));
		//echo '<p>Validate Markup: <a href="http://validator.w3.org/check?verbose=1&amp;uri='.$encoded_target.'">W3C</a> | <a href="http://html5.validator.nu/?doc='.$encoded_target.'">validator.nu</a></p>'."\n";
	}
예제 #18
0
	/**
	 * @todo remove the substring search for transform after thor_core is updated so that checkbox transform fields are cloaked
	 */
	function on_every_time_edit()
	{
		$id = $this->get_action_id();
		echo '<h3>Editing row id ' . $id . '</h3>';
		$link = carl_make_link(array('table_row_action' => '', 'table_action_id' => ''));
		echo '<p><a href="'.$link.'">Return to summary form data</a></p>';
		if ($this->show_hidden_fields_in_edit_view)
		{
			$elements = $this->get_element_names();
			foreach ($elements as $element_name)
			{
				$elm = $this->get_element($element_name);
				if ($elm->type == 'hidden' && (substr($elm->name, 0, 10) != 'transform[')) $this->change_element_type($element_name, 'text');
			}
		}
	}
예제 #19
0
	/**
	 * Account type is not set - we force selection of a valid account type.
	 */
	function no_show_form()
	{
		$options = $this->social_helper()->get_available_integrators();
		if (!empty($options))
		{
			echo '<p>Which social account would you like to create?</p>';
			echo '<ul>';
			foreach ($options as $k => $v)
			{
				$link = carl_make_link(array('account_type' => $k));
				echo '<li><a href="'.$link.'">'.$v.'</a></li>';
			}
			echo '</ul>';
		}
		else echo '<p>This installation of Reason CMS does not have any social account options enabled.</p>';
	}
예제 #20
0
		function get_inline_editing_info()
		{
			$inline_edit =& get_reason_inline_editing($this->page_id);
			
			$url = carl_make_link($inline_edit->get_activation_params($this));
			$available = $inline_edit->available_for_module($this);
			$active = $inline_edit->active_for_module($this);
			
			return array('url' => $url, 'available' => $available, 'active' => $active);
		}
예제 #21
0
 function run()
 {
     $inline_edit = get_reason_inline_editing($this->page_id);
     $classes = array('loginLinkModule');
     $classes[] = $this->get_user_netid() ? 'authenticated' : 'unauthenticated';
     echo '<div class="' . implode(' ', $classes) . '">';
     if ($this->has_admin_edit_privs()) {
         if ($inline_edit->is_enabled()) {
             echo '<div class="editDiv inlineEnabled">' . "\n";
             echo '<span class="clarifyingText">In Reason Admin: </span>' . "\n";
         } else {
             echo '<div class="editDiv">' . "\n";
         }
         echo '<a href="' . $this->get_edit_page_link() . '" class="editLink editPageLink">Edit Page</a> <span class="editDivider">&#183;</span> ' . "\n";
         echo '<a href="' . $this->get_edit_site_link() . '" class="editLink editSiteLink">Edit Site</a>' . "\n";
         echo '</div>';
     }
     if ($inline_edit->reason_allows_inline_editing() && $inline_edit->is_enabled() || $inline_edit->is_available()) {
         $classes = array('inlineEditDiv');
         if ($inline_edit->is_enabled()) {
             $link = carl_make_link(array('inline_editing_availability' => 'disable'));
             $link_text = 'Stop Editing';
             $classes[] = 'inlineEnabled';
         } else {
             $link = carl_make_link(array('inline_editing_availability' => 'enable'));
             $link_text = 'Edit in Place';
         }
         $inline_html = '<div class="' . implode(' ', $classes) . '">' . "\n";
         $inline_html .= '<a href="' . $link . '" class="inlineEditLink">' . $link_text . '</a>' . "\n";
         $inline_html .= '</div>';
         echo $inline_html;
     }
     echo '<p id="footerLoginLink">';
     echo $this->get_user_netid() ? '<span class="username">' . $this->get_user_netid() . '</span>: ' : '';
     echo $this->get_user_netid() ? '<a href="' . $this->get_login_url() . '?logout=1" class="logout">Logout</a>' : '<a href="' . $this->get_login_url() . '" class="login">Login</a>';
     echo '</p>' . "\n";
     echo '</div>' . "\n";
 }
 function where_to()
 {
     return carl_make_link(array('user_setting' => ''));
 }
예제 #23
0
 function get_edit_preview_links($entity)
 {
     $owner = $entity->get_owner();
     if (empty($owner)) {
         return '<span class="edit_preview_links">Unable to edit or preview -- no owner site</span>' . "\n";
     }
     $markup = '';
     $markup .= '<span class="edit_preview_links">' . "\n";
     $values = array('site_id' => $entity->get_owner()->id(), 'type_id' => $entity->get_value('type'), 'id' => $entity->id(), 'cur_module' => 'Editor');
     $url = carl_make_link($values);
     $markup .= '(<a href="' . $url . '">Edit</a> | ' . "\n";
     $values['cur_module'] = 'Preview';
     $url = carl_make_link($values);
     $markup .= '<a href="' . $url . '">Preview</a>)' . "\n";
     $markup .= '</span>' . "\n";
     return $markup;
 }
예제 #24
0
 function show_user()
 {
     // if behind HTTP authentication the session lasts until the browser is closed and logout will not do anything
     $show_logout = !isset($_SERVER['REMOTE_USER']);
     $user = new entity($this->authenticated_user_id);
     if (reason_user_has_privs($this->authenticated_user_id, 'pose_as_other_user')) {
         $es = new entity_selector();
         $es->add_type(id_of('user'));
         $es->set_order('name ASC');
         $es->limit_tables();
         $es->limit_fields('name');
         $users = $es->run_one();
         echo '<form action="?" class="jumpNavigation" name="userSwitchSelect" method="get">' . "\n";
         echo '<label for="user_switch_select">User</label>: ';
         echo '<select name="user_id" class="jumpDestination siteMenu" id="user_switch_select">' . "\n";
         echo '<option value="">--</option>' . "\n";
         foreach (array_keys($users) as $user_id) {
             echo '<option value="' . $user_id . '"';
             if ($user_id == $this->user_id) {
                 echo ' selected="selected"';
             }
             echo '>' . $users[$user_id]->get_value('name') . '</option>' . "\n";
         }
         echo '</select>';
         $this->echo_hidden_fields('user_id');
         echo '<input type="submit" class="jumpNavigationGo" value="go" />' . "\n";
         if ($this->user_id != $this->authenticated_user_id) {
             if (isset($users[$this->authenticated_user_id])) {
                 $username = $users[$this->authenticated_user_id]->get_value('name');
             } else {
                 $username = '******';
             }
             echo '<a class="stopPosing" href="' . carl_make_link(array('user_id' => $this->authenticated_user_id)) . '" title="Stop posing as another user">' . htmlspecialchars($username) . '</a>' . "\n";
         }
         if ($show_logout) {
             echo ' <strong><a href="' . REASON_LOGIN_URL . '?logout=true" class="bannerLink">Logout</a></strong>';
         }
         echo '</form>';
     } else {
         echo 'You are <strong>' . $user->get_value('name') . '</strong>';
         if ($show_logout) {
             echo ': <strong><a href="' . REASON_LOGIN_URL . '?logout=true" class="bannerLink">Logout</a></strong>';
         }
     }
 }
예제 #25
0
		/**
		 *
		 */
		function get_bottom_links_html()
		{
			$netid = reason_check_authentication();
			$ret = '<div class="loginlogout">';
			$qs_array = ($netid) ? array('logout' => 'true', 'dest_page' => get_current_url()) : array('dest_page' => get_current_url());
			$qs = carl_make_link($qs_array, '', 'qs_only', true, false);
			if ($netid) $ret .= 'Logged in: '.$netid.' <a href="'.REASON_LOGIN_URL.$qs.'">Log Out</a>';
			else $ret .= '<a href="'.REASON_LOGIN_URL.$qs.'">Log In</a>';
			$ret .= '</div>';
			return $ret;
		}
예제 #26
0
	function pre_show_form_view()
	{
		$id = $this->get_id();
		echo '<h3>Viewing row id ' . $id . '</h3>';
		$link = carl_make_link(array('table_row_action' => '', 'table_action_id' => ''));
		echo '<p><a href="'.$link.'">Return to summary form data</a></p>';
	}
예제 #27
0
    function get_issue_links_markup()
    {
        $issues_by_date = $this->passed_vars['issues_by_date'];
        //krsort($issues_by_date);
        $links_to_issues = $this->passed_vars['links_to_issues'];
        $markup_string = '';
        $cur_issue_id = '';
        if (!empty($this->passed_vars['current_issue'])) {
            $cur_issue_id = $this->passed_vars['current_issue']->id();
        }
        if (count($issues_by_date) > 1) {
            $markup_string .= '<div class="issueMenu">' . "\n";
            $markup_string .= '<form action="' . htmlspecialchars(get_current_url(), ENT_QUOTES, 'UTF-8') . '">' . "\n";
            $markup_string .= '<label for="pubIssueMenuElement" class="issueLabel">Issue:</label>' . "\n";
            $markup_string .= '<script type="text/javascript">' . "\n";
            $markup_string .= '/* <![CDATA[ */' . "\n";
            $markup_string .= '
			if (jQuery)
			{
				$(document).ready(function(){
					$(".issueMenu input[type=\'submit\']").hide();
					$(".issueMenu select[name=\'issue_id\']").change(function(){
						$(this).parent("form").submit();
					});
				});
			}';
            $markup_string .= '/* ]]> */' . "\n";
            $markup_string .= '</script>';
            $markup_string .= '<select name="issue_id" id="pubIssueMenuElement">' . "\n";
            if (!$cur_issue_id) {
                $markup_string .= '<option value="' . $cur_issue_id . '" selected="selected">Select Issue</option>' . "\n";
            }
            foreach ($issues_by_date as $id => $issue) {
                $selected = $cur_issue_id == $id ? ' selected="selected"' : '';
                $markup_string .= '<option value="' . $id . '"' . $selected . '>' . strip_tags($this->_get_issue_label($issue)) . '</option>' . "\n";
            }
            $markup_string .= '</select>' . "\n";
            $markup_string .= $this->passed_vars['text_only'] == 1 ? '<input type="hidden" name="textonly" value="1">' : '';
            $markup_string .= '<input type="submit" value="Go" />' . "\n";
            $markup_string .= '</form>' . "\n";
            $link = carl_make_link(array('issue_id' => 0));
            $markup_string .= '<div class="allIssuesLink"><a href="' . $link . '">List all issues</a></div>';
            $markup_string .= '</div>' . "\n";
        }
        return $markup_string;
    }
예제 #28
0
 function get_editing_explanation()
 {
     $sources = array();
     if ($this->params['get_site_courses']) {
         $sources[] = 'courses borrowed by this Reason site.';
     }
     if ($this->params['get_page_courses']) {
         $sources[] = 'courses associated with this page in the Reason admin.';
     }
     foreach ($this->params['get_courses_by_tags'] as $tag) {
         $sources[] = 'courses tagged with the category "' . $tag . '"';
     }
     if ($this->params['get_courses_by_page_categories']) {
         if ($cats = $this->get_page_categories()) {
             $sources[] = 'courses that share the categories associated with this page (' . join(', ', $cats) . ').';
         }
     }
     foreach ($this->params['get_courses_by_subjects'] as $subj) {
         $sources[] = 'courses in the academic subject "' . $subj . '"';
     }
     if ($this->params['get_courses_by_site_subjects']) {
         if ($subjects = $this->get_site_subjects()) {
             $sources[] = 'courses that share the same academic subject as this Reason site (' . join(', ', $subjects) . ').';
         }
     }
     $string = '<div class="explain">';
     if (count($sources) > 1) {
         $string .= '<p>Courses can appear on this page in more than one way. This page is currently displaying: ';
         $string .= '<ul>' . "\n";
         foreach ($sources as $source) {
             $string .= '<li>' . $source . '</li>' . "\n";
         }
         $string .= '</ul>' . "\n";
         $string .= '</parse_url>' . "\n";
     } else {
         $string .= '<p>This page is currently displaying ' . $sources[0] . '</p>';
     }
     $string .= '<p>If you need to change how courses are selected for this page, please contact a Reason administrator.</p>';
     $string .= '<p class="edit"><a class="editThis" href="' . carl_make_link(array('inline_edit' => null)) . '">Save and Finish</a></p>' . "\n";
     $string .= '</div>';
     return $string;
 }
예제 #29
0
function carl_make_query_string($new_request_vars)
{
    return carl_make_link($new_request_vars, '', 'qs_only', true, true);
}
예제 #30
0
                echo '<li class="' . join(' ', $classes) . '">';
                $params['id'] = $event->get_value('id');
                if (substr($event->get_value('datetime'), 11) != '00:00:00') {
                    $time = prettify_mysql_datetime($event->get_value('datetime'), 'g:ia');
                } else {
                    $time = 'All day';
                }
                if ($event->get_value('show_hide') == 'tentative') {
                    $time .= '<br /><span class="label">tentative</span>';
                }
                echo '<span class="preview_time">' . $time . ' </span>';
                echo '<span class="preview_name">';
                // Get the owner site for the event; we don't want events from the current site to look borrowable
                $owner = $event->get_owner();
                if ($params['site_id'] != $owner->id()) {
                    echo '<a class="nav" href="#" onclick = \'borrow_confirm("' . carl_make_link($params, $_REQUEST['path']) . '", ' . $event->get_value('id') . '); return false;\' title="Add this event to your calendar">';
                    echo $event->get_value('name') . '</a>';
                } else {
                    echo $event->get_value('name');
                }
                echo '</li>' . "\n";
            }
            echo '</ul>';
        } else {
            echo '<p>No events found.</p>';
        }
        echo '<a href="/calendar/?date=' . $date . '" target="_blank">Full Calendar</a>';
        echo '<div id="borrow_confirm">
		<div id="event_detail"></div>
		<hr>
		<p>Click below to borrow this event and place it on your site.