Пример #1
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     JHtml::_('jquery.framework');
     nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js');
     $file = $this->get('file');
     if (!$file) {
         $path = $this->get('path') == 'site' ? '' : '/administrator';
         $label = $this->get('label');
         $file = $this->get('alias', $label);
         $file = preg_replace('#[^a-z-]#', '', strtolower($file));
         $extension = $this->get('extension');
         switch ($extension) {
             case 'com':
                 $file = $path . '/components/com_' . $file . '/com_' . $file . '.xml';
                 break;
             case 'mod':
                 $file = $path . '/modules/mod_' . $file . '/mod_' . $file . '.xml';
                 break;
             case 'plg_editors-xtd':
                 $file = '/plugins/editors-xtd/' . $file . '.xml';
                 break;
             default:
                 $file = '/plugins/system/' . $file . '.xml';
                 break;
         }
         $label = JText::_($label) . ' (' . JText::_('NN_' . strtoupper($extension)) . ')';
     } else {
         $label = $this->get('label', 'the main extension');
     }
     nnFieldDependency::setMessage($file, $label);
     return '';
 }
Пример #2
0
 function getInput($params)
 {
     $this->params = $params;
     $option = JFactory::getApplication()->input->get('option');
     // do not place toggler stuff on JoomFish pages
     if ($option == 'com_joomfish') {
         return '';
     }
     $param = $this->get('param');
     $value = $this->get('value');
     $nofx = $this->get('nofx');
     $method = $this->get('method');
     $div = $this->get('div', 0);
     JHtml::_('jquery.framework');
     nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js');
     nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/toggler.min.js');
     $param = preg_replace('#^\\s*(.*?)\\s*$#', '\\1', $param);
     $param = preg_replace('#\\s*\\|\\s*#', '|', $param);
     $html = array();
     if ($param != '') {
         $param = preg_replace('#[^a-z0-9-\\.\\|\\@]#', '_', $param);
         $param = str_replace('@', '_', $param);
         $set_groups = explode('|', $param);
         $set_values = explode('|', $value);
         $ids = array();
         foreach ($set_groups as $i => $group) {
             $count = $i;
             if ($count >= count($set_values)) {
                 $count = 0;
             }
             $value = explode(',', $set_values[$count]);
             foreach ($value as $val) {
                 $ids[] = $group . '.' . $val;
             }
         }
         if (!$div) {
             $html[] = '</div></div>';
         }
         $html[] = '<div id="' . rand(1000000, 9999999) . '___' . implode('___', $ids) . '" class="nntoggler';
         if ($nofx) {
             $html[] = ' nntoggler_nofx';
         }
         if ($method == 'and') {
             $html[] = ' nntoggler_and';
         }
         $html[] = '">';
         if (!$div) {
             $html[] = '<div><div>';
         }
     } else {
         $html[] = '</div>';
     }
     return implode('', $html);
 }
Пример #3
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     JHtml::_('jquery.framework');
     nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js');
     $loading = "jQuery(\"#" . $this->id . "\").find(\"span\").attr(\"class\", \"icon-refresh icon-spin\")";
     $success = "jQuery(\"#" . $this->id . "\").find(\"span\").attr(\"class\", \"icon-ok\")";
     $error = "jQuery(\"#" . $this->id . "\").find(\"span\").attr(\"class\", \"icon-warning\");" . "jQuery(\"#message_" . $this->id . "\").addClass(\"alert alert-danger alert-inline\").html(data);";
     $script = "\n\t\t\tfunction loadAjax" . $this->id . "() {\n\t\t\t\t" . $loading . ";\n\t\t\t\tjQuery(\"#message_" . $this->id . "\").attr(\"class\", \"\").html(\"\");\n\t\t\t\tnnScripts.loadajax(\n\t\t\t\t\t'" . addslashes($this->get('url')) . "',\n\t\t\t\t\t'if(data == \"\") { " . $success . " } else { " . $error . " }',\n\t\t\t\t\t'" . $error . "'\n\t\t\t\t);\n\t\t\t}\n\t\t";
     JFactory::getDocument()->addScriptDeclaration($script);
     return '<button id="' . $this->id . '" class="btn" title="' . JText::_($this->get('description')) . '" onclick="loadAjax' . $this->id . '();return false;">' . '<span class="' . $this->get('icon', '') . '"></span> ' . JText::_($this->get('text', $this->get('label'))) . '</button>' . '<div id="message_' . $this->id . '"></div>';
 }
Пример #4
0
 function getInput($name, $id, $value, $params)
 {
     $this->name = $name;
     $this->id = $id;
     $this->value = $value;
     $this->params = $params;
     $class = trim('nn_color minicolors ' . $this->get('class'));
     $disabled = $this->get('disabled') ? ' disabled="disabled"' : '';
     nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/color.min.js');
     $this->value = strtolower(strtoupper(preg_replace('#[^a-z0-9]#si', '', $this->value)));
     return '<input type="text" name="' . $this->name . '" id="' . $this->id . '" class="' . $class . '" value="' . $this->value . '"' . $disabled . '>';
 }
Пример #5
0
 function getInput($name, $id, $value, $params)
 {
     $this->name = $name;
     $this->id = $id;
     $this->value = $value;
     $this->params = $params;
     $action = '';
     if ($this->get('inlist', 0) && $this->get('action')) {
         $this->name = $name . $id;
         $this->id = $name . $id;
         $action = ' onchange="' . $this->get('action') . '"';
     }
     JHtml::stylesheet('nnframework/colorpicker.min.css', false, true);
     nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/colorpicker.min.js');
     $class = ' class="' . trim('nncolorpicker chzn-done ' . $this->get('class')) . '"';
     $color = strtolower($this->value);
     if (!$color || in_array($color, array('none', 'transparent'))) {
         $color = 'none';
     } else {
         if ($color['0'] != '#') {
             $color = '#' . $color;
         }
     }
     $colors = $this->get('colors');
     if (empty($colors)) {
         $colors = array('none', '#049cdb', '#46a546', '#9d261d', '#ffc40d', '#f89406', '#c3325f', '#7a43b6', '#ffffff', '#999999', '#555555', '#000000');
     } else {
         $colors = explode(',', $colors);
     }
     $split = (int) $this->get('split');
     if (!$split) {
         $count = count($colors);
         if ($count % 5 == 0) {
             $split = 5;
         } else {
             if ($count % 4 == 0) {
                 $split = 4;
             }
         }
     }
     $split = $split ? $split : 3;
     $html = array();
     $html[] = '<select ' . $action . ' name="' . $this->name . '" id="' . $this->id . '"' . $class . ' style="visibility:hidden;width:22px;height:1px">';
     foreach ($colors as $i => $c) {
         $html[] = '<option' . ($c == $color ? ' selected="selected"' : '') . '>' . $c . '</option>';
         if (($i + 1) % $split == 0) {
             $html[] = '<option>-</option>';
         }
     }
     $html[] = '</select>';
     return implode('', $html);
 }
Пример #6
0
 function render(&$params)
 {
     jimport('joomla.filesystem.file');
     // Load plugin language
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
     nnFrameworkFunctions::loadLanguage('plg_system_nnframework');
     nnFrameworkFunctions::loadLanguage('plg_editors-xtd_sourcerer');
     nnFrameworkFunctions::loadLanguage('plg_system_sourcerer');
     JHtml::stylesheet('nnframework/style.min.css', false, true);
     nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js');
     JFactory::getDocument()->addStyleSheet('//code.jquery.com/ui/1.9.2/themes/smoothness/jquery-ui.css');
     JFactory::getDocument()->addScript('//code.jquery.com/ui/1.9.2/jquery-ui.js');
     $script = "\n\t\t\tvar sourcerer_syntax_word = '" . $params->syntax_word . "';\n\t\t\tvar sourcerer_editorname = '" . JFactory::getApplication()->input->getString('name', 'text') . "';\n\t\t\tvar sourcerer_default_addsourcetags = " . (int) $params->addsourcetags . ";\n\t\t\tvar sourcerer_root = '" . JURI::root(true) . "';\n\t\t";
     JFactory::getDocument()->addScriptDeclaration($script);
     JHtml::stylesheet('sourcerer/popup.min.css', false, true);
     JHtml::script('sourcerer/script.min.js', false, true);
     $params->code = '<!-- You can place html anywhere within the source tags --><br /><br /><br /><script language=&quot;javascript&quot; type=&quot;text/javascript&quot;><br />    // You can place JavaScript like this<br />    <br /></script><br /><?php<br />    // You can place PHP like this<br />    <br />?>';
     $params->code = str_replace('<br />', "\n", $params->code);
     echo $this->getHTML($params);
 }
Пример #7
0
 public static function getUpdateLink($alias, $version)
 {
     $is_pro = strpos($version, 'PRO') !== false;
     if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_nonumbermanager/nonumbermanager.xml')) {
         $url = $is_pro ? 'http://www.nonumber.nl/' . $alias . '#download' : JRoute::_('index.php?option=com_installer&view=update');
         return array($url, '');
     }
     $config = JComponentHelper::getParams('com_nonumbermanager');
     $key = trim($config->get('key'));
     if ($is_pro && !$key) {
         return array('index.php?option=com_nonumbermanager', '');
     }
     JHtml::_('bootstrap.framework');
     JHtml::_('behavior.modal');
     jimport('joomla.filesystem.file');
     nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js');
     JFactory::getDocument()->addScriptDeclaration("\n\t\t\tvar NNEM_TIMEOUT = " . (int) $config->get('timeout', 5) . ";\n\t\t\tvar NNEM_TOKEN = '" . JSession::getFormToken() . "';\n\t\t");
     nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nonumbermanager/js/script.min.js');
     $url = 'http://download.nonumber.nl?ext=' . $alias . '&j=3';
     if ($is_pro) {
         $url .= '&k=' . strtolower(substr($key, 0, 8) . md5(substr($key, 8)));
     }
     return array('', 'nnManager.openModal(\'update\', [\'' . $alias . '\'], [\'' . $url . '\'], true);');
 }
Пример #8
0
    static function selectlist(&$options, $name, $value, $id, $size = 0, $multiple = 0, $simple = 0)
    {
        if (empty($options)) {
            return '<fieldset class="radio">' . JText::_('NN_NO_ITEMS_FOUND') . '</fieldset>';
        }
        require_once JPATH_PLUGINS . '/system/nnframework/helpers/parameters.php';
        $parameters = nnParameters::getInstance();
        $params = $parameters->getPluginParams('nnframework');
        if (!is_array($value)) {
            $value = explode(',', $value);
        }
        $count = 0;
        if ($options != -1) {
            foreach ($options as $option) {
                $count++;
                if (isset($option->links)) {
                    $count += count($option->links);
                }
                if ($count > $params->max_list_count) {
                    break;
                }
            }
        }
        if ($options == -1 || $count > $params->max_list_count) {
            if (is_array($value)) {
                $value = implode(',', $value);
            }
            if (!$value) {
                $input = '<textarea name="' . $name . '" id="' . $id . '" cols="40" rows="5" />' . $value . '</textarea>';
            } else {
                $input = '<input type="text" name="' . $name . '" id="' . $id . '" value="' . $value . '" size="60" />';
            }
            return '<fieldset class="radio"><label for="' . $id . '">' . JText::_('NN_ITEM_IDS') . ':</label>' . $input . '</fieldset>';
        }
        if (!$multiple) {
            $first_level = isset($options['0']->level) ? $options['0']->level : 0;
            foreach ($options as &$option) {
                if (!isset($option->level)) {
                    continue;
                }
                $repeat = $option->level - $first_level > 0 ? $option->level - $first_level : 0;
                $option->text = str_repeat(' - ', $repeat) . $option->text;
            }
            $html = JHtml::_('select.genericlist', $options, $name, 'class="inputbox"', 'value', 'text', $value);
            return self::handlePreparedStyles($html);
        }
        $size = (int) $size ?: 300;
        if ($simple) {
            $attr = 'style="width: ' . $size . 'px"';
            $attr .= $multiple ? ' multiple="multiple"' : '';
            $html = JHtml::_('select.genericlist', $options, $name, trim($attr), 'value', 'text', $value, $id);
            return self::handlePreparedStyles($html);
        }
        require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
        JFactory::getLanguage()->load('com_modules', JPATH_ADMINISTRATOR);
        JHtml::stylesheet('nnframework/multiselect.min.css', false, true);
        nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/multiselect.min.js');
        $html = array();
        $html[] = '<div class="well well-small nn_multiselect" id="' . $id . '">';
        $html[] = '
			<div class="form-inline nn_multiselect-controls">
				<span class="small">' . JText::_('JSELECT') . ':
					<a class="nn_multiselect-checkall" href="javascript://">' . JText::_('JALL') . '</a>,
					<a class="nn_multiselect-uncheckall" href="javascript://">' . JText::_('JNONE') . '</a>,
					<a class="nn_multiselect-toggleall" href="javascript://">' . JText::_('NN_TOGGLE') . '</a>
				</span>
				<span class="width-20">|</span>
				<span class="small">' . JText::_('NN_EXPAND') . ':
					<a class="nn_multiselect-expandall" href="javascript://">' . JText::_('JALL') . '</a>,
					<a class="nn_multiselect-collapseall" href="javascript://">' . JText::_('JNONE') . '</a>
				</span>
				<span class="width-20">|</span>
				<span class="small">' . JText::_('JSHOW') . ':
					<a class="nn_multiselect-showall" href="javascript://">' . JText::_('JALL') . '</a>,
					<a class="nn_multiselect-showselected" href="javascript://">' . JText::_('NN_SELECTED') . '</a>
				</span>
				<span class="nn_multiselect-maxmin">
				<span class="width-20">|</span>
				<span class="small">
					<a class="nn_multiselect-maximize" href="javascript://">' . JText::_('NN_MAXIMIZE') . '</a>
					<a class="nn_multiselect-minimize" style="display:none;" href="javascript://">' . JText::_('NN_MINIMIZE') . '</a>
				</span>
				</span>
				<input type="text" name=""nn_multiselect-filter" class="nn_multiselect-filter input-medium search-query pull-right" size="16"
					autocomplete="off" placeholder="' . JText::_('JSEARCH_FILTER') . '" aria-invalid="false" tabindex="-1">
			</div>

			<div class="clearfix"></div>

			<hr class="hr-condensed" />';
        $o = array();
        foreach ($options as $option) {
            $option->level = isset($option->level) ? $option->level : 0;
            $o[] = $option;
            if (isset($option->links)) {
                foreach ($option->links as $link) {
                    $link->level = $option->level + (isset($link->level) ? $link->level : 1);
                    $o[] = $link;
                }
            }
        }
        $html[] = '<ul class="nn_multiselect-ul" style="max-height:300px;min-width:' . $size . 'px;overflow-x: hidden;">';
        $prevlevel = 0;
        foreach ($o as $i => $option) {
            if ($prevlevel < $option->level) {
                // correct wrong level indentations
                $option->level = $prevlevel + 1;
                $html[] = '<ul class="nn_multiselect-sub">';
            } else {
                if ($prevlevel > $option->level) {
                    $html[] = str_repeat('</li></ul>', $prevlevel - $option->level);
                } else {
                    if ($i) {
                        $html[] = '</li>';
                    }
                }
            }
            $labelclass = trim('pull-left ' . (isset($option->labelclass) ? $option->labelclass : ''));
            $html[] = '<li>';
            $item = '<div class="' . trim('nn_multiselect-item pull-left ' . (isset($option->class) ? $option->class : '')) . '">';
            if (isset($option->title)) {
                $labelclass .= ' nav-header';
            }
            if (isset($option->title) && (!isset($option->value) || !$option->value)) {
                $item .= '<label class="' . $labelclass . '">' . $option->title . '</label>';
            } else {
                $selected = in_array($option->value, $value) ? ' checked="checked"' : '';
                $disabled = isset($option->disable) && $option->disable ? ' readonly="readonly" style="visibility:hidden"' : '';
                $item .= '<input type="checkbox" class="pull-left" name="' . $name . '" id="' . $id . $option->value . '" value="' . $option->value . '"' . $selected . $disabled . ' />
					<label for="' . $id . $option->value . '" class="' . $labelclass . '">' . $option->text . '</label>';
            }
            $item .= '</div>';
            $html[] = $item;
            if (!isset($o[$i + 1]) && $option->level > 0) {
                $html[] = str_repeat('</li></ul>', (int) $option->level);
            }
            $prevlevel = $option->level;
        }
        $html[] = '</ul>';
        $html[] = '
			<div style="display:none;" class="nn_multiselect-menu-block">
				<div class="pull-left nav-hover nn_multiselect-menu">
					<div class="btn-group">
						<a href="#" data-toggle="dropdown" class="dropdown-toggle btn btn-micro">
							<span class="caret"></span>
						</a>
						<ul class="dropdown-menu">
							<li class="nav-header">' . JText::_('COM_MODULES_SUBITEMS') . '</li>
							<li class="divider"></li>
							<li class=""><a class="checkall" href="javascript://"><span class="icon-checkbox"></span> ' . JText::_('JSELECT') . '</a>
							</li>
							<li><a class="uncheckall" href="javascript://"><span class="icon-checkbox-unchecked"></span> ' . JText::_('COM_MODULES_DESELECT') . '</a>
							</li>
							<div class="nn_multiselect-menu-expand">
								<li class="divider"></li>
								<li><a class="expandall" href="javascript://"><span class="icon-plus"></span> ' . JText::_('NN_EXPAND') . '</a></li>
								<li><a class="collapseall" href="javascript://"><span class="icon-minus"></span> ' . JText::_('NN_COLLAPSE') . '</a></li>
							</div>
						</ul>
					</div>
				</div>
			</div>';
        $html[] = '</div>';
        $html = implode('', $html);
        return self::handlePreparedStyles($html);
    }
Пример #9
0
    $hasContentFieldName = 'content';
}
// Get Params Fieldsets
$this->fieldsets = $this->form->getFieldsets('params');
$this->hidden_fields = '';
$script = "\nJoomla.submitbutton = function(task)\n{\n\tif (task == 'module.cancel' || document.formvalidator.isValid(document.id('module-form'))) {";
if ($hasContent) {
    $script .= $this->form->getField($hasContentFieldName)->save();
}
$script .= "\tJoomla.submitform(task, document.getElementById('module-form'));\n\t\t\t\tif (self != top)\n\t\t\t\t{\n\t\t\t\t\twindow.top.setTimeout('window.parent.SqueezeBox.close()', 1000);\n\t\t\t\t}\n\t\t\t}\n\t};";
if (JFactory::getUser()->authorise('core.admin')) {
    $script .= "\n\tjQuery(document).ready(function()\n\t{\n\t\t// add alert on remove assignment buttons\n\t\tjQuery('button.nn_remove_assignment').click(function()\n\t\t{\n\t\t\tif(confirm('" . str_replace('<br />', '\\n', addslashes(JText::_('AMM_DISABLE_ASSIGNMENT'))) . "')) {\n\t\t\t\tjQuery('div#toolbar-options button').click();\n\t\t\t}\n\t\t});\n\t});";
}
JFactory::getDocument()->addScriptDeclaration($script);
nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js');
nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/toggler.min.js');
//JFactory::getDocument()->addStyleSheetVersion(JURI::root(true) . '/media/nnframework/css/frontend.min.css');
?>

<form action="<?php 
echo JRoute::_('index.php?option=com_advancedmodules&layout=edit&id=' . (int) $this->item->id);
?>
" method="post" name="adminForm" id="module-form" class="form-validate edit">

	<!-- Begin Content -->
	<div class="btn-toolbar">
		<div class="btn-group">
			<button type="button" class="btn btn-primary"
				onclick="Joomla.submitbutton('module.apply')">
				<i class="icon-apply"></i>
				<?php 
Пример #10
0
require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
$ids = array();
foreach ($this->items as $item) {
    $ids[] = $item->id;
}
$config = JComponentHelper::getParams('com_nonumbermanager');
$check_data = $config->get('check_data', 1);
$hide_notinstalled = $config->get('hide_notinstalled', 0);
JHtml::stylesheet('nnframework/style.min.css', false, true);
nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js');
$key = trim($config->get('key'));
$js_key = $key ? strtolower(substr($key, 0, 8) . md5(substr($key, 8))) : '';
$script = "\n\tvar NNEM_IDS = ['" . implode("', '", $ids) . "'];\n\tvar NNEM_NOUPDATE = '" . addslashes(JText::_('NNEM_ALERT_NO_ITEMS_TO_UPDATE')) . "';\n\tvar NNEM_NONESELECTED = '" . addslashes(JText::_('NNEM_ALERT_NO_ITEMS_SELECTED')) . "';\n\tvar NNEM_FAIL = '" . addslashes(JText::_('NNEM_ALERT_FAIL')) . "';\n\tvar NNEM_CHANGELOG = '" . addslashes(JText::_('NN_CHANGELOG')) . "';\n\tvar NNEM_TIMEOUT = " . (int) $config->get('timeout', 5) . ";\n\tvar NNEM_TOKEN = '" . JSession::getFormToken() . "';\n\tvar NNEM_KEY = '" . $js_key . "';\n";
JFactory::getDocument()->addScriptDeclaration($script);
JHtml::stylesheet('nonumbermanager/style.min.css', false, true);
nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nonumbermanager/js/script.min.js');
$script = "\n\tjQuery(document).ready(function() {\n\t\tnnManager.refreshData(" . ($check_data ? 1 : 0) . ");\n\t});\n";
JFactory::getDocument()->addScriptDeclaration($script);
$loading = '<div class="progress progress-striped active" style="min-width: 60px;"><div class="bar" style="width: 100%;"></div></div>';
?>
	<div id="nnkey" <?php 
echo $key || !$config->get('show_key_field', 1) ? ' style="display:none;"' : '';
?>
>
		<form action="<?php 
echo JRoute::_('index.php?option=com_nonumbermanager');
?>
" method="post" name="adminForm" id="adminForm" class="form-horizontal">
			<div class="well">
				<h4><?php 
echo JText::_('NNEM_DOWNLOAD_KEY');