Exemple #1
0
 /**
  * Hook for after routing application
  * 
  * @return  void
  */
 public function onAfterRoute()
 {
     if (!App::isAdmin() && !App::isSite()) {
         return;
     }
     $client = 'Site';
     if (App::isAdmin()) {
         $client = 'Admin';
         return;
     }
     // Check if active for this client (Site|Admin)
     if (!$this->params->get('activate' . $client) || Request::getVar('format') == 'pdf') {
         return;
     }
     Html::behavior('framework');
     if ($this->params->get('jqueryui')) {
         Html::behavior('framework', true);
     }
     if ($this->params->get('jqueryfb')) {
         Html::behavior('modal');
     }
     if ($this->params->get('noconflict' . $client)) {
         Document::addScript(Request::root(true) . '/core/assets/js/jquery.noconflict.js');
     }
 }
 /**
  * Displays the view
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  */
 public function display($tpl = null)
 {
     Html::behavior('framework');
     \Hubzero\Document\Assets::addComponentStylesheet('com_languages', 'overrider.css');
     \Hubzero\Document\Assets::addComponentScript('com_languages', 'overrider.js');
     //Document::addStyleSheet(Request::root().'media/overrider/css/overrider.css');
     //Document::addScript(Request::root().'media/overrider/js/overrider.js');
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     // Check for errors
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
         return;
     }
     // Check whether the cache has to be refreshed
     $cached_time = User::getState('com_languages.overrides.cachedtime.' . $this->state->get('filter.client') . '.' . $this->state->get('filter.language'), 0);
     if (time() - $cached_time > 60 * 5) {
         $this->state->set('cache_expired', true);
     }
     // Add strings for translations in Javascript
     JText::script('COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS');
     JText::script('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR');
     $this->addToolbar();
     parent::display($tpl);
 }
Exemple #3
0
 /**
  * Method to get the field label markup.
  *
  * @return  string  The field label markup.
  *
  * @since   2.5.5
  */
 protected function getLabel()
 {
     // Initialise variables.
     $label = '';
     if ($this->hidden) {
         return $label;
     }
     // Get the label text from the XML element, defaulting to the element name.
     $text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name'];
     $text = $this->translateLabel ? Lang::txt($text) : $text;
     // Set required to true as this field is not displayed at all if not required.
     $this->required = true;
     // Add CSS and JS for the TOS field
     $css = "#jform_profile_tos {width: 18em; margin: 0 !important; padding: 0 2px !important;}\n\t\t\t\t#jform_profile_tos input {margin:0 5px 0 0 !important; width:10px !important;}\n\t\t\t\t#jform_profile_tos label {margin:0 15px 0 0 !important; width:auto;}\n\t\t\t\t";
     Document::addStyleDeclaration($css);
     Html::behavior('modal');
     // Build the class for the label.
     $class = !empty($this->description) ? 'hasTip' : '';
     $class = $class . ' required';
     $class = !empty($this->labelClass) ? $class . ' ' . $this->labelClass : $class;
     // Add the opening label tag and main attributes attributes.
     $label .= '<label id="' . $this->id . '-lbl" for="' . $this->id . '" class="' . $class . '"';
     // If a description is specified, use it to build a tooltip.
     if (!empty($this->description)) {
         $label .= ' title="' . htmlspecialchars(trim($text, ':') . '::' . ($this->translateDescription ? Lang::txt($this->description) : $this->description), ENT_COMPAT, 'UTF-8') . '"';
     }
     $tosarticle = $this->element['article'] ? (int) $this->element['article'] : 1;
     $link = '<a class="modal" title="" href="index.php?option=com_content&amp;view=article&amp;layout=modal&amp;id=' . $tosarticle . '&amp;tmpl=component" rel="{handler: \'iframe\', size: {x:800, y:500}}">' . $text . '</a>';
     // Add the label text and closing tag.
     $label .= '>' . $link . '<span class="star">&#160;*</span></label>';
     return $label;
 }
 /**
  * Display the button
  *
  * @return array A two element array of (imageName, textToInsert)
  */
 public function onDisplay($name)
 {
     $template = App::get('template')->template;
     $link = 'index.php?option=com_content&amp;view=article&amp;layout=pagebreak&amp;tmpl=component&amp;e_name=' . $name;
     Html::behavior('modal');
     $button = new \Hubzero\Base\Object();
     $button->set('modal', true);
     $button->set('link', $link);
     $button->set('text', Lang::txt('PLG_EDITORSXTD_PAGEBREAK_BUTTON_PAGEBREAK'));
     $button->set('name', 'pagebreak');
     $button->set('options', "{handler: 'iframe', size: {x: 400, y: 100}}");
     return $button;
 }
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     // Load the javascript
     Html::behavior('framework');
     Html::behavior('modal', 'input.modal');
     // Build the script.
     $script = array();
     $script[] = '	function jSelectChart_' . $this->id . '(id, name, object) {';
     $script[] = '		$("#' . $this->id . '_id").val(id);';
     $script[] = '		$("#' . $this->id . '_name").val(name);';
     $script[] = '		$.fancybox.close();';
     $script[] = '	}';
     // Add the script to the document head.
     Document::addScriptDeclaration(implode("\n", $script));
     // Build the script.
     $script = array();
     $script[] = '	jQuery(document).ready(function($){';
     $script[] = '		var div = $("<div>").css("display", "none").prependTo($("#menu-types"));';
     $script[] = '		$("#menu-types").append(div);';
     $script[] = '	});';
     // Add the script to the document head.
     Document::addScriptDeclaration(implode("\n", $script));
     // Get the title of the linked chart
     $db = App::get('db');
     $db->setQuery('SELECT name' . ' FROM #__newsfeeds' . ' WHERE id = ' . (int) $this->value);
     $title = $db->loadResult();
     if ($error = $db->getErrorMsg()) {
         throw new Exception($error, 500);
     }
     if (empty($title)) {
         $title = Lang::txt('COM_NEWSFEEDS_SELECT_A_FEED');
     }
     $link = 'index.php?option=com_newsfeeds&amp;view=newsfeeds&amp;layout=modal&amp;tmpl=component&amp;function=jSelectChart_' . $this->id;
     Html::behavior('modal', 'a.modal');
     $html = "\n" . '<div class="fltlft"><input type="text" id="' . $this->id . '_name" value="' . htmlspecialchars($title, ENT_QUOTES, 'UTF-8') . '" disabled="disabled" /></div>';
     $html .= '<div class="button2-left"><div class="blank"><a class="modal" title="' . Lang::txt('COM_NEWSFEEDS_CHANGE_FEED_BUTTON') . '"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">' . Lang::txt('COM_NEWSFEEDS_CHANGE_FEED_BUTTON') . '</a></div></div>' . "\n";
     // The active newsfeed id field.
     if (0 == (int) $this->value) {
         $value = '';
     } else {
         $value = (int) $this->value;
     }
     // class='required' for client side validation
     $class = '';
     if ($this->required) {
         $class = ' class="required modal-value"';
     }
     $html .= '<input type="hidden" id="' . $this->id . '_id"' . $class . ' name="' . $this->name . '" value="' . $value . '" />';
     return $html;
 }
Exemple #6
0
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     // Load the modal behavior script.
     Html::behavior('modal', 'a.modal');
     // Build the script.
     $script = array();
     $script[] = '	function jSelectArticle_' . $this->id . '(id, title, catid, object) {';
     $script[] = '		$("#' . $this->id . '_id").val(id);';
     $script[] = '		$("#' . $this->id . '_name").val(title);';
     $script[] = '		$.fancybox.close();';
     $script[] = '	}';
     // Add the script to the document head.
     Document::addScriptDeclaration(implode("\n", $script));
     // Setup variables for display.
     $html = array();
     $link = 'index.php?option=com_content&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;function=jSelectArticle_' . $this->id;
     $db = App::get('db');
     $db->setQuery('SELECT title' . ' FROM #__content' . ' WHERE id = ' . (int) $this->value);
     $title = $db->loadResult();
     if ($error = $db->getErrorMsg()) {
         throw new Exception($error, 500);
     }
     if (empty($title)) {
         $title = Lang::txt('COM_CONTENT_SELECT_AN_ARTICLE');
     }
     $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
     // The current user display field.
     $html[] = '<div class="input-modal">';
     $html[] = '  <span class="input-cell">';
     $html[] = '    <input type="text" id="' . $this->id . '_name" value="' . $title . '" disabled="disabled" size="35" />';
     $html[] = '  </span>';
     // The user select button.
     $html[] = '  <span class="input-cell">';
     $html[] = '    <a class="modal button" title="' . Lang::txt('COM_CONTENT_CHANGE_ARTICLE') . '"  href="' . $link . '&amp;' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">' . Lang::txt('COM_CONTENT_CHANGE_ARTICLE_BUTTON') . '</a>';
     $html[] = '  </span>';
     $html[] = '</div>';
     // The active article id field.
     if (0 == (int) $this->value) {
         $value = '';
     } else {
         $value = (int) $this->value;
     }
     // class='required' for client side validation
     $class = '';
     if ($this->required) {
         $class = ' class="required modal-value"';
     }
     $html[] = '<input type="hidden" id="' . $this->id . '_id"' . $class . ' name="' . $this->name . '" value="' . $value . '" />';
     return implode("\n", $html);
 }
 function display($tpl = null)
 {
     Html::behavior('framework', true);
     \Hubzero\Document\Assets::addComponentScript('com_media', 'popup-imagemanager.js');
     \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'popup-imagemanager.css');
     // Display form for FTP credentials?
     // Don't set them here, as there are other functions called before this one if there is any file write operation
     $ftp = !JClientHelper::hasCredentials('ftp');
     $this->session = App::get('session');
     $this->config = Component::params('com_media');
     $this->state = $this->get('state');
     $this->folderList = $this->get('folderList');
     $this->require_ftp = $ftp;
     parent::display($tpl);
 }
Exemple #8
0
 /**
  * Display an edit icon for the article.
  *
  * This icon will not display in a popup window, nor if the article is trashed.
  * Edit access checks must be performed in the calling code.
  *
  * @param	object	$article	The article in question.
  * @param	object	$params		The article parameters
  * @param	array	$attribs	Not used??
  *
  * @return	string	The HTML for the article edit icon.
  * @since	1.6
  */
 static function edit($article, $params, $attribs = array())
 {
     // Initialise variables.
     $userId = User::get('id');
     // Ignore if in a popup window.
     if ($params && $params->get('popup')) {
         return;
     }
     // Ignore if the state is negative (trashed).
     if ($article->state < 0) {
         return;
     }
     Html::behavior('tooltip');
     // Show checked_out icon if the article is checked out by a different user
     if (property_exists($article, 'checked_out') && property_exists($article, 'checked_out_time') && $article->checked_out > 0 && $article->checked_out != User::get('id')) {
         $checkoutUser = User::getInstance($article->checked_out);
         $button = Html::asset('image', 'checked_out.png', NULL, NULL, true);
         $date = Date::of($article->checked_out_time)->toLocal();
         $tooltip = Lang::txt('JLIB_HTML_CHECKED_OUT') . ' :: ' . Lang::txt('COM_CONTENT_CHECKED_OUT_BY', $checkoutUser->name) . ' <br /> ' . $date;
         return '<span class="hasTip" title="' . htmlspecialchars($tooltip, ENT_COMPAT, 'UTF-8') . '">' . $button . '</span>';
     }
     $url = 'index.php?option=com_content&task=article.edit&a_id=' . $article->id . '&return=' . base64_encode(urlencode(Request::current(true)));
     $icon = $article->state ? 'edit.png' : 'edit_unpublished.png';
     if (strtotime($article->publish_up) > strtotime(Date::of('now'))) {
         $icon = 'edit_unpublished.png';
     }
     $text = Lang::txt('JGLOBAL_EDIT');
     //Html::asset('image', $icon, Lang::txt('JGLOBAL_EDIT'), NULL, true);
     if ($article->state == 0) {
         $overlib = Lang::txt('JUNPUBLISHED');
     } else {
         $overlib = Lang::txt('JPUBLISHED');
     }
     $date = Date::of($article->created)->toLocal();
     $author = $article->created_by_alias ? $article->created_by_alias : $article->author;
     $overlib .= '&lt;br /&gt;';
     $overlib .= $date;
     $overlib .= '&lt;br /&gt;';
     $overlib .= Lang::txt('COM_CONTENT_WRITTEN_BY', htmlspecialchars($author, ENT_COMPAT, 'UTF-8'));
     $button = '<a href="' . Route::url($url) . '">' . $text . '</a>';
     $output = '<span class="hasTip" title="' . Lang::txt('COM_CONTENT_EDIT_ITEM') . ' :: ' . $overlib . '">' . $button . '</span>';
     return $output;
 }
Exemple #9
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $template = App::get('template')->template;
     $fieldName = $control_name . '[' . $name . ']';
     $article = JTable::getInstance('content');
     if ($value) {
         $article->load($value);
     } else {
         $article->title = Lang::txt('COM_CONTENT_SELECT_AN_ARTICLE');
     }
     $js = "\n\t\tfunction jSelectArticle_" . $name . "(id, title, catid, object) {\n\t\t\tdocument.getElementById(object + '_id').value = id;\n\t\t\tdocument.getElementById(object + '_name').value = title;\n\t\t\tSqueezeBox.close();\n\t\t}";
     Document::addScriptDeclaration($js);
     $link = 'index.php?option=com_content&amp;task=element&amp;tmpl=component&amp;function=jSelectArticle_' . $name;
     Html::behavior('modal', 'a.modal');
     $html = "\n" . '<div class="fltlft"><input type="text" id="' . $name . '_name" value="' . htmlspecialchars($article->title, ENT_QUOTES, 'UTF-8') . '" disabled="disabled" /></div>';
     //$html .= "\n &#160; <input class=\"inputbox modal-button\" type=\"button\" value=\"".Lang::txt('JSELECT')."\" />";
     $html .= '<div class="button2-left"><div class="blank"><a class="modal" title="' . Lang::txt('COM_CONTENT_SELECT_AN_ARTICLE') . '"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: 650, y: 375}}">' . Lang::txt('JSELECT') . '</a></div></div>' . "\n";
     $html .= "\n" . '<input type="hidden" id="' . $name . '_id" name="' . $fieldName . '" value="' . (int) $value . '" />';
     return $html;
 }
Exemple #10
0
 /**
  * Display the button
  *
  * @return array A four element array of (article_id, article_title, category_id, object)
  */
 public function onDisplay($name)
 {
     // Javascript to insert the link
     // View element calls jSelectArticle when an article is clicked
     // jSelectArticle creates the link tag, sends it to the editor,
     // and closes the select frame.
     $js = "\n\t\tfunction jSelectArticle(id, title, catid, object, link, lang) {\n\t\t\tvar hreflang = '';\n\t\t\tif (lang !== '') {\n\t\t\t\tvar hreflang = ' hreflang = \"' + lang + '\"';\n\t\t\t}\n\t\t\tvar tag = '<a' + hreflang + ' href=\"' + link + '\">' + title + '</a>';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\t\$.fancybox.close();\n\t\t}";
     Document::addScriptDeclaration($js);
     Html::behavior('modal');
     // Use the built-in element view to select the article.
     // Currently uses blank class.
     $link = 'index.php?option=com_content&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;' . Session::getFormToken() . '=1';
     $button = new \Hubzero\Base\Object();
     $button->set('modal', true);
     $button->set('link', $link);
     $button->set('text', Lang::txt('PLG_ARTICLE_BUTTON_ARTICLE'));
     $button->set('name', 'article');
     $button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}");
     return $button;
 }
Exemple #11
0
 /**
  * Display the button
  *
  * @param   string   $name
  * @param   string   $asset
  * @param   integer  $author
  * @return  array    A two element array of (imageName, textToInsert)
  */
 public function onDisplay($name, $asset, $author)
 {
     $params = Component::params('com_media');
     $extension = Request::getCmd('option');
     if ($asset == '') {
         $asset = $extension;
     }
     if (User::authorise('core.edit', $asset) || User::authorise('core.create', $asset) || count(User::getAuthorisedCategories($asset, 'core.create')) > 0 || User::authorise('core.edit.own', $asset) && $author == User::get('id') || count(User::getAuthorisedCategories($extension, 'core.edit')) > 0 || count(User::getAuthorisedCategories($extension, 'core.edit.own')) > 0 && $author == User::get('id')) {
         $link = 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;e_name=' . $name . '&amp;asset=' . $asset . '&amp;author=' . $author;
         Html::behavior('modal');
         $button = new \Hubzero\Base\Object();
         $button->set('modal', true);
         $button->set('link', $link);
         $button->set('text', Lang::txt('PLG_IMAGE_BUTTON_IMAGE'));
         $button->set('name', 'image');
         $button->set('options', "{handler: 'iframe', size: {x: 800, y: 500}}");
         return $button;
     }
     return false;
 }
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     // Get the client id.
     $clientId = $this->element['client_id'];
     if (!isset($clientId)) {
         $clientName = $this->element['client'];
         if (isset($clientName)) {
             $client = JApplicationHelper::getClientInfo($clientName, true);
             $clientId = $client->id;
         }
     }
     if (!isset($clientId) && $this->form instanceof JForm) {
         $clientId = $this->form->getValue('client_id');
     }
     $clientId = (int) $clientId;
     // Load the modal behavior script.
     Html::behavior('modal', 'a.modal');
     // Build the script.
     $script = array();
     $script[] = '	function jSelectPosition_' . $this->id . '(name) {';
     $script[] = '		$("#' . $this->id . '").val(name);';
     $script[] = '		$.fancybox.close();';
     $script[] = '	}';
     // Add the script to the document head.
     Document::addScriptDeclaration(implode("\n", $script));
     // Setup variables for display.
     $html = array();
     $link = 'index.php?option=com_modules&amp;view=positions&amp;layout=modal&amp;tmpl=component&amp;function=jSelectPosition_' . $this->id . '&amp;client_id=' . $clientId;
     // The current user display field.
     //$html[] = '<div class="fltlft">';
     $html[] = '<div class="input-modal">';
     $html[] = '<span class="input-cell">';
     $html[] = parent::getInput();
     $html[] = '</span>';
     // The user select button.
     $html[] = '<span class="input-cell">';
     $html[] = '<a class="button modal" title="' . Lang::txt('COM_MODULES_CHANGE_POSITION_TITLE') . '"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">' . Lang::txt('COM_MODULES_CHANGE_POSITION_BUTTON') . '</a>';
     $html[] = '</span>';
     $html[] = '</div>';
     return implode("\n", $html);
 }
Exemple #13
0
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     // Initialise variables.
     $html = array();
     $recordId = (int) $this->form->getValue('id');
     $size = ($v = $this->element['size']) ? ' size="' . $v . '"' : '';
     $class = ($v = $this->element['class']) ? ' class="' . $v . '"' : 'class="text_area"';
     // Get a reverse lookup of the base link URL to Title
     $model = JModelLegacy::getInstance('menutypes', 'menusModel');
     $rlu = $model->getReverseLookup();
     switch ($this->value) {
         case 'url':
             $value = Lang::txt('COM_MENUS_TYPE_EXTERNAL_URL');
             break;
         case 'alias':
             $value = Lang::txt('COM_MENUS_TYPE_ALIAS');
             break;
         case 'separator':
             $value = Lang::txt('COM_MENUS_TYPE_SEPARATOR');
             break;
         default:
             $link = $this->form->getValue('link');
             // Clean the link back to the option, view and layout
             $value = Lang::txt(\Hubzero\Utility\Arr::getValue($rlu, MenusHelper::getLinkKey($link)));
             break;
     }
     // Load the javascript and css
     Html::behavior('framework');
     Html::behavior('modal');
     Document::addScriptDeclaration("\n\t\t\tjQuery(document).ready(function(\$){\n\t\t\t\t\$('input.modal').fancybox({\n\t\t\t\t\tarrows: false,\n\t\t\t\t\ttype: 'iframe',\n\t\t\t\t\tautoSize: false,\n\t\t\t\t\tfitToView: false,\n\t\t\t\t\twidth: 600,\n\t\t\t\t\theight: 450,\n\t\t\t\t\thref: '" . Route::url('index.php?option=com_menus&view=menutypes&tmpl=component&recordId=' . $recordId, false) . "'\n\t\t\t\t});\n\t\t\t});\n\t\t");
     $html[] = '<div class="input-modal">';
     $html[] = '<span class="input-cell">';
     $html[] = '<input type="text" id="' . $this->id . '" readonly="readonly" disabled="disabled" value="' . $value . '"' . $size . $class . ' />';
     $html[] = '</span><span class="input-cell">';
     $html[] = '<input type="button" class="modal" value="' . Lang::txt('JSELECT') . '" />';
     $html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />';
     $html[] = '</span>';
     $html[] = '</div>';
     return implode("\n", $html);
 }
 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     $cachable = true;
     Html::behavior('caption');
     // Set the default view name and format from the Request.
     // Note we are using a_id to avoid collisions with the router and the return page.
     // Frontend is a bit messier than the backend.
     $id = Request::getInt('a_id');
     $vName = Request::getCmd('view', 'categories');
     Request::setVar('view', $vName);
     if (User::get('id') || $_SERVER['REQUEST_METHOD'] == 'POST' && ($vName == 'category' && Request::getCmd('layout') != 'blog' || $vName == 'archive')) {
         $cachable = false;
     }
     $safeurlparams = array('catid' => 'INT', 'id' => 'INT', 'cid' => 'ARRAY', 'year' => 'INT', 'month' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT', 'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter-search' => 'STRING', 'print' => 'BOOLEAN', 'lang' => 'CMD', 'Itemid' => 'INT');
     // Check for edit form.
     if ($vName == 'form' && !$this->checkEditId('com_content.edit.article', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         return App::abort(403, Lang::txt('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
     }
     parent::display($cachable, $safeurlparams);
     return $this;
 }
 function display($tpl = null)
 {
     $config = Component::params('com_media');
     $style = Request::getState('media.list.layout', 'layout', 'thumbs', 'word');
     Document::setBuffer($this->loadTemplate('navigation'), 'modules', 'submenu');
     Html::behavior('framework', true);
     \Hubzero\Document\Assets::addComponentScript('com_media', 'mediamanager.js');
     \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'mediamanager.css');
     Html::behavior('modal');
     Document::addScriptDeclaration("\n\t\tjQuery(document).ready(function(\$){\n\t\t\tdocument.preview = \$.fancybox;\n\t\t});");
     Html::asset('script', 'system/jquery.treeview.js', true, true, false, false);
     Html::asset('stylesheet', 'system/jquery.treeview.css', array(), true);
     if (Lang::isRTL()) {
         Html::asset('stylesheet', 'media/jquery.treeview_rtl.css', array(), true);
     }
     if (DIRECTORY_SEPARATOR == '\\') {
         $base = str_replace(DIRECTORY_SEPARATOR, "\\\\", COM_MEDIA_BASE);
     } else {
         $base = COM_MEDIA_BASE;
     }
     $js = "\n\t\t\tvar basepath = '" . $base . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t";
     Document::addScriptDeclaration($js);
     // Display form for FTP credentials?
     // Don't set them here, as there are other functions called before this one if there is any file write operation
     $ftp = !JClientHelper::hasCredentials('ftp');
     $session = App::get('session');
     $state = $this->get('state');
     $this->assignRef('session', $session);
     $this->assignRef('config', $config);
     $this->assignRef('state', $state);
     $this->require_ftp = $ftp;
     $this->folders_id = ' id="media-tree"';
     $this->folders = $this->get('folderTree');
     // Set the toolbar
     $this->addToolbar();
     parent::display($tpl);
     echo Html::behavior('keepalive');
 }
 /**
  * Method to catch the onAfterDispatch event.
  *
  * This is where we setup the click-through content highlighting for.
  * The highlighting is done with JavaScript so we just
  * need to check a few parameters and the JHtml behavior will do the rest.
  *
  * @return  boolean  True on success
  *
  * @since   2.5
  */
 public function onAfterDispatch()
 {
     // Check that we are in the site application.
     if (!App::isSite()) {
         return true;
     }
     // Set the variables
     $extension = Request::getCmd('option', '');
     // Check if the highlighter is enabled.
     if (!Component::params($extension)->get('highlight_terms', 1)) {
         return true;
     }
     // Check if the highlighter should be activated in this environment.
     if (Document::getType() !== 'html' || Request::getCmd('tmpl', '') === 'component') {
         return true;
     }
     // Get the terms to highlight from the request.
     $terms = Request::getVar('highlight', null, 'base64');
     $terms = $terms ? json_decode(base64_decode($terms)) : null;
     // Check the terms.
     if (empty($terms)) {
         return true;
     }
     // Clean the terms array
     $filter = JFilterInput::getInstance();
     $cleanTerms = array();
     foreach ($terms as $term) {
         $cleanTerms[] = htmlspecialchars($filter->clean($term, 'string'));
     }
     // Activate the highlighter.
     Html::behavior('highlighter', $cleanTerms);
     // Adjust the component buffer.
     $buf = Document::getBuffer('component');
     $buf = '<br id="highlighter-start" />' . $buf . '<br id="highlighter-end" />';
     Document::setBuffer($buf, 'component');
     return true;
 }
 function display($tpl = null)
 {
     // Do not allow cache
     App::get('response')->headers->set('Cache-Control', 'no-cache', false);
     App::get('response')->headers->set('Pragma', 'no-cache');
     $style = Request::getState('media.list.layout', 'layout', 'thumbs', 'word');
     Html::behavior('framework', true);
     //Document::addStyleSheet('../media/media/css/medialist-'.$style.'.css');
     \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'medialist-' . $style . '.css');
     if (Lang::isRTL()) {
         //Document::addStyleSheet('../media/media/css/medialist-'.$style.'_rtl.css');
         \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'medialist-' . $style . '_rtl.css');
     }
     Document::addScriptDeclaration("\n\t\tjQuery(document).ready(function(\$){\n\t\t\twindow.parent.document.updateUploader();\n\t\t\t\$('a.img-preview').on('click', function(e) {\n\t\t\t\te.preventDefault();\n\t\t\t\twindow.top.document.preview.open(\$(this).attr('href'));\n\t\t\t});\n\t\t});");
     $images = $this->get('images');
     $documents = $this->get('documents');
     $folders = $this->get('folders');
     $state = $this->get('state');
     // Check for invalid folder name
     if (empty($state->folder)) {
         $dirname = Request::getVar('folder', '', '', 'string');
         if (!empty($dirname)) {
             $dirname = htmlspecialchars($dirname, ENT_COMPAT, 'UTF-8');
             if (Lang::hasKey('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME')) {
                 throw new Exception(Lang::txt('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME', $dirname), 100);
             } else {
                 throw new Exception(sprintf('Unable to browse:&#160;%s. Directory name must only contain alphanumeric characters and no spaces.', $dirname), 100);
             }
         }
     }
     $this->baseURL = Request::root();
     $this->assignRef('images', $images);
     $this->assignRef('documents', $documents);
     $this->assignRef('folders', $folders);
     $this->assignRef('state', $state);
     parent::display($tpl);
 }
Exemple #18
0
 * THE SOFTWARE.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @author    Sam Wilson <*****@*****.**>
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access
defined('_HZEXEC_') or die;
require_once PATH_CORE . DS . 'components' . DS . 'com_time' . DS . 'models' . DS . 'task.php';
require_once PATH_CORE . DS . 'components' . DS . 'com_time' . DS . 'models' . DS . 'hub.php';
use Components\Time\Models\Task;
use Components\Time\Models\Hub;
Html::behavior('core');
$this->css()->js();
?>

<fieldset>
	<legend><?php 
echo Lang::txt('PLG_SUPPORT_TIME');
?>
</legend>

	<div class="plg_support_time">
		<div class="grid">
			<div class="col span6">
				<div class="time-group">
					<span><?php 
echo Lang::txt('PLG_SUPPORT_TIME_TIME');
Exemple #19
0
defined('_HZEXEC_') or die;
Toolbar::title(Lang::txt('COM_EVENTS_MANAGER'), 'event.png');
Toolbar::preferences('com_events', '550');
Toolbar::spacer();
Toolbar::custom('addpage', 'new', 'COM_EVENTS_PAGES_ADD', 'COM_EVENTS_PAGES_ADD', true, false);
Toolbar::custom('respondents', 'user', 'COM_EVENTS_VIEW_RESPONDENTS', 'COM_EVENTS_VIEW_RESPONDENTS', true, false);
Toolbar::spacer();
Toolbar::publishList();
Toolbar::unpublishList();
Toolbar::spacer();
Toolbar::addNew();
Toolbar::editList();
Toolbar::deleteList();
Toolbar::spacer();
Toolbar::help('events');
Html::behavior('tooltip');
?>

<script type="text/javascript">
function submitbutton(pressbutton)
{
	var form = document.getElementById('adminForm');
	if (pressbutton == 'cancel') {
		submitform(pressbutton);
		return;
	}
	// do field validation
	submitform(pressbutton);
}
</script>
Exemple #20
0
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @author    Shawn Rice <*****@*****.**>
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
defined('_HZEXEC_') or die;
$this->css();
//Html::behavior('chart', 'resize');
Html::behavior('chart', 'pie');
$total = $this->draftInternal + $this->draftUser + $this->pending + $this->published + $this->unpublished + $this->removed;
$this->draft = $this->draftInternal + $this->draftUser;
?>
<div class="mod_resources">
	<div class="overview-container">
		<div id="resources-container<?php 
echo $this->module->id;
?>
" class="chrt"></div>
		<?php 
if ($total > 0) {
    ?>
		<script type="text/javascript">
		if (!jq) {
			var jq = $;
Exemple #21
0
 /**
  *
  * @return  string
  */
 private function _displayButtons($name, $buttons, $asset, $author)
 {
     // Load modal popup behavior
     Html::behavior('modal', 'a.modal-button');
     $return = '';
     $results[] = $this->onGetInsertMethod($name);
     foreach ($results as $result) {
         if (is_string($result) && trim($result)) {
             $return .= $result;
         }
     }
     if (is_array($buttons) || is_bool($buttons) && $buttons) {
         $results = $this->_subject->getButtons($name, $buttons, $asset, $author);
         // This will allow plugins to attach buttons or change the behavior on the fly using AJAX
         $return .= "\n<div id=\"editor-xtd-buttons\">\n";
         foreach ($results as $button) {
             // Results should be an object
             if ($button->get('name')) {
                 $modal = $button->get('modal') ? ' class="modal-button"' : null;
                 $href = $button->get('link') ? ' href="' . Request::base() . $button->get('link') . '"' : null;
                 $onclick = $button->get('onclick') ? ' onclick="' . $button->get('onclick') . '"' : 'onclick="IeCursorFix(); return false;"';
                 $title = $button->get('title') ? $button->get('title') : $button->get('text');
                 $return .= '<div class="button2-left"><div class="' . $button->get('name') . '"><a' . $modal . ' title="' . $title . '"' . $href . $onclick . ' rel="' . $button->get('options') . '">' . $button->get('text') . "</a></div></div>\n";
             }
         }
         $return .= "</div>\n";
     }
     return $return;
 }
Exemple #22
0
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access
defined('_HZEXEC_') or die;
$canDo = Components\Cron\Helpers\Permissions::getActions('component');
$text = $this->task == 'edit' ? Lang::txt('JACTION_EDIT') : Lang::txt('JACTION_CREATE');
Toolbar::title(Lang::txt('COM_CRON') . ': ' . $text, 'cron');
if ($canDo->get('core.edit')) {
    Toolbar::apply();
    Toolbar::save();
    Toolbar::spacer();
}
Toolbar::cancel();
Toolbar::spacer();
Toolbar::help('job');
Html::behavior('calendar');
?>
<script type="text/javascript">
function submitbutton(pressbutton)
{
	var form = document.adminForm;

	if (pressbutton == 'cancel') {
		submitform( pressbutton );
		return;
	}

	// do field validation
	if (document.getElementById('field-title').value == ''){
		alert( '<?php 
echo Lang::txt('CON_CRON_ERROR_MISSING_TITLE');
Exemple #23
0
    $media_dir = dirname($manifest);
    $manifest = json_decode(file_get_contents($manifest));
    if (is_null($manifest)) {
        $type = 'none';
        $error = Lang::txt('COM_COURSES_VIDEO_ERROR_INVALID_JSON');
    } else {
        $type = isset($manifest->presentation->slides) ? 'hubpresenter' : 'html5';
    }
} else {
    if (in_array(substr($this->model->get('url'), -3), array('mov', 'mp4', 'm4v', 'ogg', 'ogv', 'webm'))) {
        $type = 'standalone';
    } else {
        $type = 'none';
    }
}
Html::behavior('framework', true);
// If the video type is 'hubpresenter', perform next steps
if ($type == 'hubpresenter') {
    // Check if path exists
    if (is_dir($media_dir)) {
        // Get all files matching  /.mp4|.webs|.ogv|.m4v|.mp3/
        $media = Filesystem::files($media_dir, '.mp4|.webm|.ogv|.m4v|.mp3', false, false);
        $ext = array();
        foreach ($media as $m) {
            $pieces = explode('.', $m);
            $ext[] = array_pop($pieces);
        }
        // If we dont have all the necessary media formats
        if (in_array('mp4', $ext) && count($ext) < 3 || in_array('mp3', $ext) && count($ext) < 2) {
            $this->setError(Lang::txt('COM_COURSES_VIDEO_ERROR_MISSING_FORMATS'));
        }
Exemple #24
0
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access.
defined('_HZEXEC_') or die;
Html::behavior('framework');
\Hubzero\Document\Assets::addSystemScript('jquery.datetimepicker');
\Hubzero\Document\Assets::addSystemStylesheet('jquery.datetimepicker.css');
$text = $this->task == 'edit' ? Lang::txt('JACTION_EDIT') : Lang::txt('JACTION_CREATE');
$mwdb = \Components\Tools\Helpers\Utils::getMWDBO();
$zones = with(new \Components\Tools\Tables\Zones($mwdb))->find('all');
?>

<script>
function submitbutton(pressbutton)
{
	var form = document.adminForm;

	if (pressbutton == 'cancel') {
		submitform(pressbutton);
		return;
Exemple #25
0
<?php

/**
 * @package		Joomla.Administrator
 * @subpackage	com_languages
 * @copyright	Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
// no direct access
defined('_HZEXEC_') or die;
Html::addIncludePath(JPATH_COMPONENT . '/helpers/html');
Html::behavior('tooltip');
Html::behavior('formvalidation');
$canDo = LanguagesHelper::getActions();
?>
<script type="text/javascript">
	Joomla.submitbutton = function(task)
	{
		if (task == 'language.cancel' || document.formvalidator.isValid($('#item-form'))) {
			Joomla.submitform(task, document.getElementById('item-form'));
		}
	}
</script>

<form action="<?php 
echo Route::url('index.php?option=com_languages&layout=edit&lang_id=' . (int) $this->item->lang_id);
?>
" method="post" name="adminForm" id="item-form" class="form-validate">
	<div class="grid">
		<div class="col span7">
			<fieldset class="adminform">
Exemple #26
0
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @author    Shawn Rice <*****@*****.**>
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access
defined('_HZEXEC_') or die;
Html::behavior('framework', true);
Html::behavior('modal');
$this->addScript($this->baseurl . '/templates/' . $this->template . '/js/hub.js?v=' . filemtime(__DIR__ . '/js/hub.js'));
$menu = App::get('menu');
$browser = new \Hubzero\Browser\Detector();
$cls = array($this->direction, $browser->name(), $browser->name() . $browser->major(), $menu->getActive() == $menu->getDefault() ? 'home' : '');
$this->setTitle(Config::get('sitename') . ' - ' . $this->getTitle());
?>
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html dir="<?php 
echo $this->direction;
?>
" lang="<?php 
echo $this->language;
?>
" class="<?php 
echo $this->direction;
Exemple #27
0
defined('_HZEXEC_') or die;
$canDo = Components\Members\Helpers\Admin::getActions('component');
$text = $this->task == 'edit' ? Lang::txt('JACTION_EDIT') : Lang::txt('JACTION_CREATE');
Toolbar::title(Lang::txt('COM_MEMBERS') . ': ' . $text, 'user');
if ($canDo->get('core.edit') || $canDo->get('core.create')) {
    Toolbar::apply();
    Toolbar::save();
    Toolbar::spacer();
}
if ($canDo->get('core.create') && $canDo->get('core.manage')) {
    Toolbar::save2new();
}
Toolbar::cancel();
Toolbar::divider();
Toolbar::help('user');
Html::behavior('switcher', 'submenu');
?>
<script type="text/javascript">
function submitbutton(pressbutton)
{
	var form = document.adminForm;

	if (pressbutton == 'cancel') {
		submitform(pressbutton);
		return;
	}

	submitform(pressbutton);
}
</script>
Exemple #28
0
if ($canDo->get('core.create')) {
    Toolbar::addNew();
}
if ($canDo->get('core.edit')) {
    Toolbar::editList();
}
if ($canDo->get('core.delete')) {
    Toolbar::deleteList('COM_GROUPS_PAGES_DELETE_CONFIRM', 'delete');
}
Toolbar::spacer();
Toolbar::custom('manage', 'config', 'config', 'COM_GROUPS_MANAGE', false);
Toolbar::spacer();
Toolbar::help('pages');
$this->css();
// include modal for raw version links
Html::behavior('modal', 'a.version, a.preview', array('handler' => 'iframe', 'fullScreen' => true));
?>

<script type="text/javascript">
function submitbutton(pressbutton)
{
	submitform(pressbutton);
}
</script>

<?php 
require_once __DIR__ . DS . 'menu.php';
?>

<?php 
if ($this->needsAttention->count() > 0) {
Exemple #29
0
<?php

/**
 * @package		Joomla.Administrator
 * @subpackage	com_modules
 * @copyright	Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
// No direct access.
defined('_HZEXEC_') or die;
Html::behavior('tooltip');
Html::behavior('multiselect');
$client = $this->state->get('filter.client_id') ? 'administrator' : 'site';
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$canOrder = User::authorise('core.edit.state', 'com_modules');
$saveOrder = $listOrder == 'ordering';
?>
<form action="<?php 
echo Route::url('index.php?option=com_modules');
?>
" method="post" name="adminForm" id="adminForm">
	<fieldset id="filter-bar">
		<div class="filter-search fltlft">
			<label class="filter-search-lbl" for="filter_search"><?php 
echo Lang::txt('JSEARCH_FILTER_LABEL');
?>
</label>
			<input type="text" name="filter_search" id="filter_search" value="<?php 
echo $this->escape($this->state->get('filter.search'));
?>
">
				<?php 
        // Compute the correct link
        switch ($target) {
            case 1:
                // open in a new window
                echo '<a href="' . htmlspecialchars($link) . '" target="_blank"  rel="nofollow">' . htmlspecialchars($label) . '</a>';
                break;
            case 2:
                // open in a popup window
                $attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=600';
                echo "<a href=\"" . htmlspecialchars($link) . "\" onclick=\"window.open(this.href, 'targetWindow', '" . $attribs . "'); return false;\">" . htmlspecialchars($label) . '</a>';
                break;
            case 3:
                // open in a modal window
                Html::behavior('modal', 'a.modal');
                ?>
							<a class="modal" href="<?php 
                echo htmlspecialchars($link);
                ?>
"  rel="{handler: 'iframe', size: {x:600, y:600}}">
								<?php 
                echo htmlspecialchars($label) . ' </a>';
                break;
            default:
                // open in parent window
                echo '<a href="' . htmlspecialchars($link) . '" rel="nofollow">' . htmlspecialchars($label) . ' </a>';
                break;
        }
        ?>
				</li>