Ejemplo n.º 1
0
	public function getSearchInput($defaultValue = "")
	{
		if (!$this->isPublished())
		{
			return "";
		}

		if ($this->params->get("tag_search", 0))
		{
			$document = JFactory::getDocument();
			JUDownloadFrontHelper::loadjQueryUI();
			$document->addStyleSheet(JUri::root() . 'components/com_judownload/assets/css/tagit-style.css');
			$document->addScript(JUri::root() . "components/com_judownload/assets/js/tagit.js");
			$tagScript = '
            jQuery(document).ready(function($){
                    $("#' . $this->getId() . '_tags").tagit({
                    tagSource:' . ($this->params->get('auto_suggest') ? $this->getTags() : '[]') . ',
                    initialTags: ' . $this->getInitialTags($defaultValue) . ',
                    tagsChanged: function(){ getTags($("#' . $this->getId() . '_tags").tagit("tags")); },
                    triggerKeys:["enter", "comma", "tab"],
                    minLength: 3,
                    maxLength: 50,
                    maxTags: 50,
                    sortable: "handle",
                    placeholder: " ' . $this->params->get("placeholder", "") . ' "
                });

                function getTags(tags) {
                    var newtags = [];
                    for (var i in tags){
	                    if (tags[i].label != undefined ){
	                        var tagvalue = tags[i].value.replace("|", "");
	                        newtags.push(tagvalue);
	                        $(tags[i].element[0]).find(".tagit-label").text(tagvalue);
	                    }
                    }
                    var newtags_str = newtags.join(",");
                    $("#' . $this->getId() . '").val(newtags_str);
                }
            });
            ';
			$document->addScriptDeclaration($tagScript);

			$this->setVariable('value', $this->value);

			return $this->fetch('searchinput.php', __CLASS__);
		}
		else
		{
			return parent::getSearchInput($defaultValue);
		}
	}
Ejemplo n.º 2
0
		// Load primary javascript
		$document->addScript(JUri::root(true) . "/components/com_judownload/assets/js/core.js");

		$JUDLTemplateDefaultHelper->loadTooltipster();

		// Load switch mode view
		if ($this->allow_user_select_view_mode)
		{
			$document->addScript(JUri::root(true) . "/components/com_judownload/assets/js/switch.js");
		}
		break;

	case 'form' :
		$document->addStyleSheet(JUri::root(true) . "/components/com_judownload/templates/" . $self_template . "/assets/css/view.form.css");

		JUDownloadFrontHelper::loadjQueryUI();
		$document->addScript(JUri::root(true) . "/components/com_judownload/assets/js/handlebars.min.js");
		$document->addScript(JUri::root(true) . "/components/com_judownload/assets/js/jquery.dragsort.min.js");
		$document->addStyleSheet(JUri::root(true) . "/components/com_judownload/assets/plupload/css/jquery.plupload.queue.css");
		$document->addScript(JUri::root(true) . "/components/com_judownload/assets/plupload/js/plupload.full.min.js");
		$document->addScript(JUri::root(true) . "/components/com_judownload/assets/plupload/js/jquery.plupload.queue.min.js");

		JUDownloadHelper::formValidation();

		// JText in forms/document.js
		JText::script('COM_JUDOWNLOAD_INVALID_IMAGE');
		JText::script('COM_JUDOWNLOAD_INVALID_FILE_NAME');
		JText::script('COM_JUDOWNLOAD_CAN_NOT_UPLOAD_FILE_BECAUSE_IT_IS_EMPTY');
		JText::script('COM_JUDOWNLOAD_CAN_NOT_UPLOAD_THIS_FILE_PLEASE_RECHECK_MIMETYPE_FILE');
		JText::script('COM_JUDOWNLOAD_CAN_NOT_TRANSFER_FILE');
		JText::script('COM_JUDOWNLOAD_OTHER_FILE_IS_UPLOADING_DO_YOU_WANT_TO_CANCEL_TO_UPLOAD_NEW_FILE');
Ejemplo n.º 3
0
 protected function setDocument()
 {
     $isNew = $this->item->id == 0;
     $userId = JFactory::getUser()->id;
     $document = JFactory::getDocument();
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     $document->setTitle(JText::_('COM_JUDOWNLOAD_PAGE_' . ($checkedOut ? 'VIEW_DOCUMENT' : ($isNew ? 'ADD_DOCUMENT' : 'EDIT_DOCUMENT'))));
     JUDownloadFrontHelper::loadjQueryUI();
     $document->addStyleSheet(JUri::root() . "administrator/components/com_judownload/assets/css/approval.css");
     $document->addScript(JUri::root() . "components/com_judownload/assets/js/handlebars.min.js");
     $document->addStyleSheet(JUri::root() . 'components/com_judownload/assets/plupload/css/jquery.plupload.queue.css');
     $document->addScript(JUri::root() . "components/com_judownload/assets/plupload/js/plupload.full.min.js");
     $document->addScript(JUri::root() . "components/com_judownload/assets/plupload/js/jquery.plupload.queue.min.js");
     JUDownloadHelper::formValidation();
     $document->addScript(JUri::root() . $this->script);
     JText::script('COM_JUDOWNLOAD_INVALID_IMAGE');
     JText::script('COM_JUDOWNLOAD_INVALID_FILE_NAME');
     JText::script('COM_JUDOWNLOAD_CAN_NOT_UPLOAD_FILE_BECAUSE_IT_IS_EMPTY');
     JText::script('COM_JUDOWNLOAD_CAN_NOT_UPLOAD_THIS_FILE_PLEASE_RECHECK_MIMETYPE_FILE');
     JText::script('COM_JUDOWNLOAD_CAN_NOT_TRANSFER_FILE');
     JText::script('COM_JUDOWNLOAD_OTHER_FILE_IS_UPLOADING_DO_YOU_WANT_TO_CANCEL_TO_UPLOAD_NEW_FILE');
     JText::script('COM_JUDOWNLOAD_YOU_HAVE_TO_UPLOAD_AT_LEAST_ONE_FILE');
     JText::script('COM_JUDOWNLOAD_YOU_HAVE_NOT_ENTERED_SOURCE_URL');
     JText::script('COM_JUDOWNLOAD_CAN_NOT_UPLOAD_THIS_FILE_DOCUMENT_REACH_MAX_UPLOAD_FILES_N_FILES');
     JText::script('COM_JUDOWNLOAD_PLEASE_UPLOAD_A_FILE');
     JText::script('COM_JUDOWNLOAD_REMOVE');
     JText::script('COM_JUDOWNLOAD_CAN_NOT_ADD_IMAGE_BECAUSE_MAX_NUMBER_OF_IMAGE_IS_N');
     JText::script('COM_JUDOWNLOAD_CAN_NOT_RESTORE_THIS_FILE_DOCUMENT_REACH_MAX_UPLOAD_N_FILES');
     JText::script('COM_JUDOWNLOAD_TOGGLE_TO_PUBLISH');
     JText::script('COM_JUDOWNLOAD_TOGGLE_TO_UNPUBLISH');
     JText::script('COM_JUDOWNLOAD_CLICK_TO_REMOVE');
     JText::script('COM_JUDOWNLOAD_YOU_MUST_UPLOAD_AT_LEAST_ONE_IMAGE');
     JText::script('COM_JUDOWNLOAD_FILE_TITLE');
     JText::script('COM_JUDOWNLOAD_FILE_NAME');
     JText::script('COM_JUDOWNLOAD_DESCRIPTION');
     JText::script('COM_JUDOWNLOAD_FIELD_TITLE');
     JText::script('COM_JUDOWNLOAD_FIELD_DESCRIPTION');
     JText::script('COM_JUDOWNLOAD_FIELD_PUBLISHED');
     JText::script('COM_JUDOWNLOAD_UPDATE');
     JText::script('COM_JUDOWNLOAD_CANCEL');
 }