public function getInput() { if (!defined('YJSGRUN')) { echo '<h1 style="color:red;">' . JText::_('YJSG_PLUGIN_NOT_FOUND') . '</h1>'; return; } $document = YjsgDochead::getDocument(); $document->addJsInhead("var comp_dis ='" . JText::_('YJSG_COMPONENT_DISABLED') . "';"); $yjsg = Yjsg::getInstance(); $YjsgCurrentVersion = $yjsg->version; $YjsgHasUpdate = $yjsg->hasupdate; $YjsgLatestVersion = $yjsg->getUpdateVersion(); $template_folder = basename(dirname(dirname(__FILE__))); $params_obj = $this->form->getValue('params'); $params = new JRegistry(); $params->loadObject($params_obj); $comp_dis = '<div id="option-resut">'; if ($params->get('component_switch')) { $comp_dis .= JText::_('YJSG_COMPONENT_DISABLED'); } $comp_dis .= '</div>'; $yjsgManageLink = 'index.php?option=com_plugins&view=plugins&filter_folder=system&filter_search=Yjsg'; $yjsgText = '' . JText::_('YJSG_INS_PUB') . " <strong>v" . $YjsgCurrentVersion . "</strong> " . JText::_('YJSG_INS_PUB2') . ' <a href="' . $yjsgManageLink . '">' . JText::_('YJSC_MAN_EXT') . '</a>'; if ($YjsgHasUpdate == 1) { $updateclass = ' updateavailable'; } else { $updateclass = ''; } // yjsg $syshtml = '<div class="yj_system_check">'; $syshtml .= '<div id="yjsgBox" class="systemBox' . $updateclass . '">'; $syshtml .= '<h2 id="yjmmpTitle" class="systemBoxTitle yjsgtips" data-original-title="' . JText::_('YJSG_CHECK') . '" data-content="' . JText::_('YJSG_CHECK_TIP') . '">' . JText::_('YJSG_CHECK') . '</h2>'; if ($YjsgHasUpdate == 1) { $syshtml .= '<div class="infoText"><span class="showIcon"></span> '; $syshtml .= JText::_('UPDATE_AVAILABLE_TEXT') . '<strong>' . $YjsgCurrentVersion . '</strong>'; $syshtml .= JText::_('UPDATE_AVAILABLE_TEXT2') . '<strong>' . $YjsgLatestVersion . '</strong>'; $syshtml .= '<a href="index.php?option=com_installer&view=update">' . JText::_('UPDATE_AVAILABLE_TEXT3') . '</a>'; $syshtml .= '</div>'; } else { $syshtml .= '<div class="infoText"><span class="showIcon"></span>' . $yjsgText . '</div>'; } $syshtml .= '</div>'; $syshtml .= '<div id="settmsgBox" class="systemBox hide">'; $syshtml .= '<h2 id="yjjbpTitle" class="systemBoxTitle yjsgtips" data-original-title="' . JText::_('YJSG_SETT_MSG') . '" data-content="' . JText::_('YJSG_SETT_MSG_TIP') . '">' . JText::_('YJSG_SETT_MSG') . '</h2>'; $syshtml .= '<div class="infoText"><span class="showIcon"></span>' . $comp_dis . '</div>'; $syshtml .= '</div>'; $syshtml .= '</div>'; // close yj_system_check // Output echo $syshtml; }
/*======================================================================*\ || #################################################################### || || # Package - YJSG Framework || || # Copyright (C) since 2007 Youjoomla.com. All Rights Reserved. || || # license - PHP files are licensed under GNU/GPL V2 || || # license - CSS - JS - IMAGE files are Copyrighted material || || # bound by Proprietary License of Youjoomla.com || || # for more information visit http://www.youjoomla.com/license.html || || # Redistribution and modification of this software || || # is bounded by its licenses || || # websites - http://www.youjoomla.com | http://www.yjsimplegrid.com || || #################################################################### || \*======================================================================*/ // No direct access. defined('_JEXEC') or die; $yjsgDoc = YjsgDochead::getDocument(); $yjsgDoc->addPageTitle($this->title); $yjsgDoc->addLinks(YJSGSITE_PLG_PATH . 'assets/images/favicon.ico', 'shortcut icon', 'image/vnd.microsoft.icon'); ?> <!DOCTYPE html> <html xml:lang="<?php echo $this->language; ?> " lang="<?php echo $this->language; ?> " dir="<?php echo $this->direction; ?> "> <head>
function onContentPrepareForm($form, $data) { if (!$form instanceof JForm) { $this->_subject->setError('JERROR_NOT_A_FORM'); return false; } if ($this->yjsg->yjtmpl()) { //YJSG mega menu if ($form->getName() == 'com_menus.item') { JForm::addFormPath(JPATH_PLUGINS . YJDS . 'system' . YJDS . 'yjsg' . YJDS . 'includes' . YJDS . 'yjsgmegamenu'); $form->loadFile('yjsg_mega_menu_params', false); } // Yjsg module additional params if ($form->getName() == 'com_modules.module') { if ($data && $data->client_id != 0) { return; } JForm::addFormPath(JPATH_PLUGINS . YJDS . 'system' . YJDS . 'yjsg' . YJDS . 'includes' . YJDS . 'yjsgmoduleoptions'); $form->loadFile('yjsg_module_options', false); $this->addShortcodes(); // Yjsg module additional params from template if (JFolder::exists(YJSGCUSTOMFOLDER . "yjsgmoduleoptions")) { JForm::addFormPath(YJSGCUSTOMFOLDER . "yjsgmoduleoptions"); $form->loadFile('yjsg_module_options', false, false, true); } } // Module menu params if ($form->getName() == 'com_modules.module') { if ($data && $data->module != 'mod_menu') { return; } $form->loadFile('yjsg_menu_module_options', false); } // Microdata article if ($form->getName() == 'com_content.article') { JForm::addFormPath(JPATH_PLUGINS . YJDS . 'system' . YJDS . 'yjsg' . YJDS . 'includes' . YJDS . 'yjsgmicrodata'); $form->loadFile('yjsg_article_microdata', false); $this->addShortcodes(); } // Microdata category if ($form->getName() == 'com_menus.item' && $data['type'] == 'component' && strstr($data['link'], 'com_content')) { if (!strstr($data['link'], 'view=category&layout=blog') && !strstr($data['link'], 'view=featured')) { return; } JForm::addFormPath(JPATH_PLUGINS . YJDS . 'system' . YJDS . 'yjsg' . YJDS . 'includes' . YJDS . 'yjsgmicrodata'); $form->loadFile('yjsg_category_microdata', false); } // Yjsg article if ($form->getName() == 'com_content.article') { JForm::addFormPath(JPATH_PLUGINS . YJDS . 'system' . YJDS . 'yjsg' . YJDS . 'includes' . YJDS . 'yjsgarticle'); $form->loadFile('yjsg_article', false); // Yjsg article additional params from template if (JFolder::exists(YJSGCUSTOMFOLDER . "yjsgarticle")) { JForm::addFormPath(YJSGCUSTOMFOLDER . "yjsgarticle"); $form->loadFile('yjsg_article', false, false, true); } } } // template form if ($this->run_plg == 1 && $this->templateView) { // Template defaults JForm::addFormPath(JPATH_PLUGINS . YJDS . 'system' . YJDS . 'yjsg' . YJDS . 'includes' . YJDS . 'xml'); if ($this->yjsg->preplugin($this->edited_template)) { $form->loadFile('default-options-legacy', false, false, true); } else { $form->loadFile('default-options', false, false, true); } $file = JPATH_SITE . YJDS . "templates" . YJDS . $this->edited_template . YJDS . "template-settings.xml"; $xml = JFactory::getXML($file, true); $form->load($xml, false, false, true); // load YjsgDochead class for template admin JLoader::register('YjsgDochead', YJSGPATH . 'includes/yjsgcore/classes/yjsg.dochead.class.php', true); $yjsgDoc = YjsgDochead::getDocument(); if ($this->yjsg->hasUpdate() == 1) { $yjsgDoc->addJsInhead("var yjsgHasUpdate = 1;"); } else { $yjsgDoc->addJsInhead("var yjsgHasUpdate = 0;"); } //skip "reset to default" action for the following field types , they don't have default values $tpl_default = array(); $skip_types = array('yjsgversion', 'yjsgtextblank', 'yjsgparamtitle', 'yjsgparamtitle2', 'yjhandler', 'yjsgtime', 'yjsgmultitext', 'yjsglogo', 'menuitem', 'yjsgcheck'); $db_default = Yjsg::getDbParams($this->Int('id')); foreach ($form->getGroup('params') as $field) { if (!in_array(strtolower($field->type), $skip_types)) { $tpl_default[$field->fieldname] = $field->value; } } $layout_file = YJSGTEMPLATEPATH . "css" . YJDS . "layout.css"; $fontc = $this->edited_template . '_' . filesize($layout_file) . filemtime($layout_file); // from JHtml::_('behavior.keepalive'); $config = JFactory::getConfig(); $lifetime = $config->get('lifetime') * 60000; $refreshTime = $lifetime <= 60000 ? 30000 : $lifetime - 60000; // Refresh time is 1 minute less than the liftime assigned in the configuration.php file. // the longest refresh period is one hour to prevent integer overflow. if ($refreshTime > 3600000 || $refreshTime <= 0) { $refreshTime = 3600000; } // now we ready. add yjsg admin head tags $yjsgDoc->addMeta('viewport', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'); $yjsgDoc->addCss(YJSGSITE_PLG_PATH . 'assets/bootstrap3/css/bootstrap.min.css'); $yjsgDoc->addCss(YJSGSITE_PLG_PATH . 'admin/css/yjsg.css'); $yjsgDoc->addJs(YJSGSITE_PLG_PATH . 'assets/src/libraries/jquery.min.js'); $yjsgDoc->addJs(YJSGSITE_PLG_PATH . 'assets/bootstrap3/js/bootstrap.min.js'); $yjsgDoc->addJs(YJSGSITE_PLG_PATH . 'assets/src/bootstrap-multiselect.js'); $yjsgDoc->addJs(YJSGSITE_PLG_PATH . 'admin/src/yjsg.admin.plugins.js'); $yjsgDoc->addJs(YJSGSITE_PLG_PATH . 'admin/src/yjsg.admin.js'); $yjsgDoc->addJsInhead('var tplDefaults=' . json_encode($tpl_default) . ';var dbDefaults=' . $db_default . ';var fontc="' . $fontc . '";'); $yjsgDoc->addJsInhead('var yjsglayout_array=' . YJSGLAYOUT . ';'); $yjsgDoc->addJsInhead('var refreshTime=' . $refreshTime . ';'); } }
/** * Method to get the field input markup for a media selector. * Use attributes to identify specific created_by and asset_id fields * * @return string The field input markup. * * @since 1.6 */ protected function getInput() { $asset = $this->asset; if ($asset == '') { $asset = JFactory::getApplication()->input->get('option'); } if (!self::$initialised) { $script[] = "\n\t\t\t\t(function (\$) {\n\t\t\t\t\t \$(document).on('ready',function () {\n\t\t\t\t\t\t \n\t\t\t\t\t\t\t\$('.TipPreview').tooltip({\n\t\t\t\t\t\t\t\t'html': true,\n\t\t\t\t\t\t\t\t'placement': 'bottom',\n\t\t\t\t\t\t\t\t'container': 'body'\n\t\t\t\t\t\t\t });\n\t\t\t\t\t\n\t\t\t\t\t\t\t\$('.TipPreview').on('show.bs.tooltip', function () {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t var findImg = \$(this).parent().parent().parent().find('input').val();\n\t\t\t\t\t\t\t if(findImg !=''){\n\t\t\t\t\t\t\t\t findImg ='<img src=\"" . JUri::root() . "'+findImg+'\" />';\n\t\t\t\t\t\t\t\t\t\$(this).attr('data-original-title', findImg);\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\$('.resetMedia').on('click', function (event) {\n\t\t\t\t\t\t\t\t event.preventDefault();\n\t\t\t\t\t\t\t\t var parent = \$(this).parent().parent().parent();\n\t\t\t\t\t\t\t\t parent.find('input').val('');\n\t\t\t\t\t\t\t\t parent.find('.TipPreview').attr('data-original-title', '" . JText::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY') . "');\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('.mediaInput').on('change', function (event) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tvar parent = \$(this).parent().parent().parent();\n\t\t\t\t\t\t\t\tif(\$(this).val() !=''){\n\t\t\t\t\t\t\t\t\tfindImg ='<img src=\"" . JUri::root() . "'+\$(this).val()+'\" />';\n\t\t\t\t\t\t\t\t\tparent.find('.TipPreview').attr('data-original-title', findImg);\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\tparent.find('.TipPreview').attr('data-original-title', '" . JText::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY') . "');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t})(jQuery);\n\t\t\t"; // Add the script to the document head. $yjsgDoc = YjsgDochead::getDocument(); $yjsgDoc->addJsInhead(implode("\n", $script)); self::$initialised = true; } $html = array(); // custom class $attrClass = ''; if (!empty($this->element['class'])) { $attrClass = ' ' . $this->element['class']; } if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value)) { $folder = explode('/', $this->value); $folder = array_diff_assoc($folder, explode('/', JComponentHelper::getParams('com_media')->get('image_path', 'images'))); array_pop($folder); $folder = implode('/', $folder); } elseif (file_exists(JPATH_ROOT . '/' . JComponentHelper::getParams('com_media')->get('image_path', 'images') . '/' . $this->directory)) { $folder = $this->directory; } else { $folder = ''; } // input $html[] = '<div id="' . $this->element['name'] . '_holder" class="inputGroupHolder' . $attrClass . '">'; $html[] = '<div class="input-group">'; $html[] = '<span class="input-group-btn">'; $html[] = '<span class="btn btn-default btn-sm TipPreview" title="' . JText::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY') . '">'; $html[] = '<i class="fa fa-eye"></i>'; $html[] = '</span>'; $html[] = '</span>'; $html[] = '<input type="text" name="' . $this->name . '" id="' . $this->id . '" class="form-control mediaInput" readonly="readonly" placeholder="' . JText::_('YJSG_SELECT_IMAGE') . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '">'; $html[] = '<span class="input-group-btn">'; $html[] = '<button id="' . $this->element['name'] . '_openm" class="btn btn-default btn-sm" data-toggle="modal" data-target="#Modal_' . $this->element['name'] . '">'; $html[] = 'Select'; $html[] = '</button>'; $html[] = '<button class="btn btn-default btn-sm resetMedia">'; $html[] = '<i class="fa fa-times"></i>'; $html[] = '</button>'; $html[] = '</span>'; $html[] = '</div>'; $html[] = '</div>'; $html[] = ''; $html[] = ''; //modal iframe $html[] = '<div class="modal fade modaliframe" id="Modal_' . $this->element['name'] . '" tabindex="-1" role="dialog" aria-labelledby="Modal_' . $this->element['name'] . '" aria-hidden="true" data-iframesrc="' . $this->link . 'index.php?option=com_media&view=images&tmpl=component&asset=' . $asset . '&author=yjsg&fieldid=' . $this->id . '&folder=' . $folder . '">'; $html[] = '<div class="modal-dialog">'; $html[] = '<div class="modal-content">'; $html[] = '<div class="modal-header">'; $html[] = '<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>'; $html[] = '<h5 class="modal-title">' . JText::_('YJSG_SELECT_IMAGE') . '</h5>'; $html[] = '</div>'; $html[] = '<div class="modal-body">'; $html[] = '</div>'; $html[] = '<div class="modal-footer">'; $html[] = '<button type="button" class="btn btn-default" data-dismiss="modal">' . JText::_('YJSG_CLOSE') . '</button>'; $html[] = '</div>'; $html[] = '</div><!-- /.modal-content -->'; $html[] = '</div><!-- /.modal-dialog -->'; $html[] = '</div><!-- /.modal -->'; return implode("\n", $html); }