コード例 #1
0
 public static function addDependencies($view, $layout, $tmpl = '')
 {
     $doc = JFactory::getDocument();
     $script = $tmpl == 'ajax' ? false : true;
     Helper_Include::addStyleSheets(true);
     // Additional
     switch ($view) {
         case 'box':
             JCck::loadjQuery(true, true, array('cck.dev-3.3.0.min.js', 'jquery.ui.effects.min.js', 'jquery.json.min.js'));
             Helper_Include::addSmoothScrool(500);
             break;
         case 'folder':
             JCck::loadjQuery(true, true, true);
             break;
         case 'template':
             JCck::loadjQuery(true, true, true);
             Helper_Include::addJSTree('cck_tree', $script);
             break;
         case 'site':
             JCck::loadjQuery(true, true, true);
             break;
         case 'field':
             if ($script === true) {
                 JCck::loadjQuery(true, true, array('cck.dev-3.3.0.min.js'));
                 JCck::loadjQueryUI();
             }
             Helper_Include::addTooltip('span[title].qtip_cck', 'left center', 'right center', 'ui-tooltip-cck-indigo_dye ui-tooltip-shadow', $script, $tmpl);
             Helper_Include::addTooltip('img[title].qtip_cck', 'right center', 'left center', 'ui-tooltip-cck-indigo_dye ui-tooltip-shadow', false, $tmpl);
             break;
         case 'type':
         case 'search':
             if ($script === true) {
                 JCck::loadjQuery(true, true, array('cck.dev-3.3.0.min.js', 'jquery.biscuit.min.js'));
                 JCck::loadjQueryUI();
                 $doc->addStyleSheet(JROOT_CCK . '/administrator/components/com_' . CCK_NAME . '/assets/css/ui-construction.css');
                 $doc->addStyleSheet(JROOT_CCK . '/administrator/components/com_' . CCK_NAME . '/assets/styles/seblod/ui-construction.css');
             }
             Helper_Include::addColorbox_Live('930', '550', $script, 'cbox', ', onLoad: function(){ $("#cboxClose").remove();}');
             Helper_Include::addColorpicker($script);
             Helper_Include::addTooltip('', '', '', '', $script);
             break;
         case 'version':
             JCck::loadjQuery(true, true, true);
             break;
             // --------
         // --------
         case 'templates':
         case 'types':
         case 'fields':
         case 'searchs':
         case 'folders':
         case 'sites':
         case 'variations':
         case 'versions':
             if ($view == 'folders') {
                 JCck::loadjQuery(true, true, array('cck.dev-3.3.0.min.js'));
             } else {
                 JCck::loadjQuery();
             }
             if (JCck::on()) {
                 JHtml::_('bootstrap.tooltip');
                 JHtml::_('formbehavior.chosen', 'select:not(.no-chosen)');
             }
             Helper_Include::addLavalamp('#submenu');
             Helper_Include::addSmoothScrool();
             if ($view == 'fields') {
                 Helper_Include::addColorbox('500', '300', $script, 'cbox', ', onLoad: function(){ $("#cboxClose").remove();}');
             } elseif ($view == 'templates') {
                 Helper_Include::addColorbox('850', '585', $script);
             } elseif ($view == 'types' || $view == 'searchs') {
                 Helper_Include::addColorbox('850', '430', true, 'cbox_button', ', scrolling:false');
             } elseif ($view == 'variations') {
                 JHtml::_('behavior.framework', false);
             }
             if ($view == 'searchs' || $view == 'sites') {
                 $doc->addStyleSheet(JROOT_MEDIA_CCK . '/css/jquery.sly.css');
                 $doc->addScript(JROOT_MEDIA_CCK . '/js/jquery.sly.min.js');
             }
             break;
         case 'cck':
             $doc->addStyleSheet(JROOT_CCK . '/administrator/components/com_' . CCK_NAME . '/assets/css/cpanel.css');
             JCck::loadjQuery();
             Helper_Include::addColorbox('930', '430', true, 'cbox_button');
             Helper_Include::addLavalamp('#submenu');
             break;
         default:
             break;
     }
 }
コード例 #2
0
ファイル: match.php プロジェクト: codigoaberto/SEBLOD
/**
* @version 			SEBLOD 3.x Core ~ $Id: match.php sebastienheraud $
* @package			SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder)
* @url				http://www.seblod.com
* @editor			Octopoos - www.octopoos.com
* @copyright		Copyright (C) 2013 SEBLOD. All Rights Reserved.
* @license 			GNU General Public License version 2 or later; see _LICENSE.php
**/
defined('_JEXEC') or die;
$name = $this->item->name;
$lang = JFactory::getLanguage();
$lang->load('plg_cck_field_field_x', JPATH_ADMINISTRATOR, null, false, true);
$lang->load('plg_cck_field_group_x', JPATH_ADMINISTRATOR, null, false, true);
Helper_Include::addDependencies('box', 'edit');
Helper_Include::addTooltip('span[title].qtip_cck', 'left center', 'right center');
$doc = JFactory::getDocument();
$doc->addStyleSheet(JROOT_MEDIA_CCK . '/scripts/jquery-colorbox/css/colorbox.css');
$doc->addScript(JROOT_MEDIA_CCK . '/scripts/jquery-colorbox/js/jquery.colorbox-min.js');
$js = '
			(function ($){
				JCck.Dev = {
					reset: function() {
						parent.jQuery("#' . $name . '_match_collection").val("");
						parent.jQuery("#' . $name . '_match_value").val("");
						parent.jQuery("#' . $name . '_match_options").val("");
						this.close();
					},
					submit: function() {
						var data = $("#match_collection").val();
						parent.jQuery("#' . $name . '_match_collection").val(data);
コード例 #3
0
ファイル: edit.php プロジェクト: densem-2013/exikom
						var data = $("#adminForm").serializeObject();
						var encoded = $.toJSON(data);
						parent.jQuery("#"+elem).val(encoded);
						this.close();
						return;
					}
    			}
				$(document).ready(function(){
					var elem = "pos-' . $this->item->id . '_variation_options";
					var encoded = parent.jQuery("#"+elem).val();
					var data = (encoded != "") ? $.evalJSON(encoded) : "";
					$.each(data, function(k, v) {
						$("#"+k).val( v );
					});
				});
			})(jQuery);
			';
$doc->addScriptDeclaration($js);
require_once JPATH_ADMINISTRATOR . '/components/' . CCK_COM . '/helpers/helper_workshop.php';
Helper_Include::addTooltip('label[title]', 'top left', 'bottom left');
JFactory::getLanguage()->load('files_var_cck_' . $this->item->name . '.sys', JPATH_SITE);
JFactory::getLanguage()->load('files_var_cck_seb_css3.sys', JPATH_SITE);
$template = isset($this->item->type) && $this->item->type != '' ? $this->item->type : 'seb_one';
$path = JPATH_SITE . '/templates/' . $template . '/variations/' . $this->item->name . '/options.xml';
if (!file_exists($path)) {
    $path = JPATH_LIBRARIES_CCK . '/rendering/variations/' . $this->item->name . '/options.xml';
} else {
    JFactory::getLanguage()->load('tpl_' . $template, JPATH_SITE);
}
$xml = JPath::clean($path);
Helper_Workshop::getTemplateParams($xml, '//form');
コード例 #4
0
    public static function initScript($type, &$elem, $options = array())
    {
        $doc = JFactory::getDocument();
        $css = '';
        $js = '';
        $js2 = '';
        $js3 = '';
        if ($type == 'field') {
            if (isset($options['doTranslation'])) {
                if (is_array($options['doTranslation'])) {
                    $flag = ' ';
                    $function = 'after';
                    $selector = $options['doTranslation']['id'];
                    if (is_null($elem->bool8)) {
                        $elem->bool8 = $options['doTranslation']['value'];
                    }
                } else {
                    $flag = '';
                    $function = 'before';
                    $selector = 'sortable_core_options';
                    if (is_null($elem->bool8)) {
                        $elem->bool8 = $options['doTranslation'];
                    }
                }
                if ($elem->bool8 == 1) {
                    $c0 = '';
                    $c1 = 'checked="checked"';
                    $class = 'publish icon-flag';
                } else {
                    $c0 = 'checked="checked"';
                    $c1 = '';
                    $class = 'unpublish icon-flag';
                }
                $btn = JCck::on() ? 'btn btn-micro ' : '';
                $flag .= '<a href="javascript: void(0);" id="bool8" class="' . $btn . 'jgrid"><span class="hasTooltip state ' . $class . '" title="' . JText::_('COM_CCK_TRANSLATE_OPTIONS') . '"></span></a>' . '<input type="radio" id="bool80" name="bool8" value="0" ' . $c0 . ' style="display:none;" />' . '<input type="radio" id="bool81" name="bool8" value="1" ' . $c1 . ' style="display:none;" />';
                $js2 .= '$("#' . $selector . '").' . $function . '("' . addslashes($flag) . '");';
                if (JCck::on()) {
                    $js2 .= '$("a#bool8 .hasTooltip").tooltip({});';
                }
                $js2 .= '$("#bool8").click(function(){ if ( $("#bool80").prop("checked") == true ) {' . '$("#bool8 span").removeClass("unpublish").addClass("publish"); $("#bool81").prop("checked", true); $("#bool80").prop("checked", false); } else {' . '$("#bool8 span").removeClass("publish").addClass("unpublish"); $("#bool81").prop("checked", false); $("#bool80").prop("checked", true); } });';
            }
            if (isset($options['hasOptions']) && $options['hasOptions'] === true) {
                $html = '';
                if (isset($options['customAttr'])) {
                    $label = isset($options['customAttrLabel']) ? $options['customAttrLabel'] : JText::_('COM_CCK_CUSTOM_ATTRIBUTES');
                    $html .= '<input type="checkbox" id="toggle_attr" name="toggle_attr" value="1" />' . '<label for="toggle_attr" class="toggle_attr">' . $label . '</label>';
                    $attribs = '';
                    if (is_array($options['customAttr'])) {
                        $keys = array();
                        $js3 = 'var disp = ($("#toggle_attr").prop("checked") !== false) ? \'style="display: block"\' : "";';
                        $n = 0;
                        foreach ($options['customAttr'] as $i => $customAttr) {
                            $attribs .= '<div class="attr">' . '<input type="text" id="attr__\'+k+\'" name="json[options2][options][\'+k+\'][' . $customAttr . ']" value="\'+val[' . $i . ']+\'"' . ' class="inputbox mini" size="10" />' . '</div>';
                            $keys[] = $customAttr;
                            $js3 .= '$("#sortable_core_options>div:last input:text[name=\'string[options][]\']").parent().append(\'<div class="attr"\'+disp+\'><input type="text" id="attr__0" name="json[options2][options][\'+(++cur)+\'][' . $customAttr . ']" value="" class="inputbox mini" size="10" /></div>\');';
                        }
                        $keys = implode(',', $keys);
                    } elseif ($options['customAttr']) {
                        $js3 = 'var disp = ($("#toggle_attr").prop("checked") !== false) ? \'style="display: block"\' : "";';
                        $n = (int) $options['customAttr'];
                        $attribs = '<div class="clr"></div><div class="attr">';
                        for ($i = 0; $i < $n; $i++) {
                            $css = ($i + 2) % 3 == 0 ? ' middle' : '';
                            $attribs .= '<input type="text" id="attr__\'+k+\'_' . ($i + 1) . '" name="json[options2][options][\'+k+\'][attr][]" value="\'+val[' . $i . ']+\'" class="inputbox input-mini mini2' . $css . '" size="8" />';
                        }
                        $attribs .= '</div>';
                        $location = $elem->location ? explode('||', $elem->location) : array(0 => '', 1 => '', 2 => '');
                        $html .= '<div class="clr"></div><div class="attr">';
                        for ($i = 0; $i < $n; $i++) {
                            $css = ($i + 2) % 3 == 0 ? ' middle' : '';
                            $html .= '<input type="text" id="location' . ($i + 1) . '" name="string[location][]" class="inputbox input-mini mini2' . $css . '" size="8" value="' . htmlspecialchars(@$location[$i]) . '" />';
                        }
                        $html .= '</div>';
                        $js3 .= 'var content = \'<div class="clr"></div><div class="attr"\'+disp+\'>';
                        for ($i = 0; $i < $n; $i++) {
                            if ($i == 0) {
                                $js3 .= '<input type="text" id="attr__0_1" name="json[options2][options][\'+(++cur)+\'][attr][]" value="" class="inputbox input-mini mini2" size="8" />';
                            } else {
                                $css = ($i + 2) % 3 == 0 ? ' middle' : '';
                                $js3 .= '<input type="text" id="attr__0_1" name="json[options2][options][\'+(cur)+\'][attr][]" value="" class="inputbox input-mini mini2' . $css . '" size="8" />';
                            }
                        }
                        $js3 .= '</div>\';';
                        $keys = '';
                    }
                    if (!isset($options['options'])) {
                        $options['options'] = JCckDev::fromJSON($elem->options2);
                    }
                    if (isset($options['options']['options'])) {
                        $opts = json_encode($options['options']['options']);
                    } else {
                        $opts = '{}';
                    }
                    $js = '
								var keys = "' . $keys . '";
								var len = 0; var len2 = "' . $n . '";
								if (keys!="") {keys = keys.split(","); len = keys.length;}
								var val = []; for(i=0;i<len2;i++){val[i] = "";}
								var values = $.parseJSON("' . addslashes($opts) . '");
								if (values.length>0) {
									$("div#sortable_core_options input[name=\'string[options][]\']").each(function(k, v) {
										if (len) {
											if (values[k]) {for(i=0; i<len; i++) {if (values[k][keys[i]] !== undefined) {val[i] = values[k][keys[i]];}}}
										} else {
											if (values[k]) {
												for(i=0;i<len2;i++){if (values[k].attr[i] !== undefined) {val[i] = values[k].attr[i];}}
											}
										}
										$(this).parent().append(\'' . $attribs . '\');
									});											
								} else {
									$("div#sortable_core_options input[name=\'string[options][]\']").each(function(k, v) {
										$(this).parent().append(\'' . $attribs . '\');
									});	
								}
								';
                    $js2 .= '$("div#layer").on("change", "input#toggle_attr", function() { $("div.attr, #location").toggle(); });';
                }
                if (isset($options['fieldPicker'])) {
                    $fields = JCckDatabase::loadObjectList('SELECT a.title as text, a.name as value FROM #__cck_core_fields AS a' . ' WHERE a.published = 1 AND a.storage !="dev" AND a.name != "' . $elem->name . '" ORDER BY text');
                    $fields = is_array($fields) ? array_merge(array(JHtml::_('select.option', '', '- ' . JText::_('COM_CCK_ADD_A_FIELD') . ' -')), $fields) : array();
                    $elem->init['fieldPicker'] = JHtml::_('select.genericlist', $fields, 'fields_list', 'size="1" class="inputbox select" style="max-width:175px;"', 'value', 'text', '', 'fields_list');
                    $isNew = !$elem->options ? 1 : 0;
                    $js2 .= 'var cur = 9999; var isNew = ' . $isNew . ';
								$("ul.adminformlist").on("change", "select#fields_list", function() {
									var val = $(this).val();
									if (val) {
										$("#sortable_core_options>div:last .button-add-core_options").click();
										$("#sortable_core_options>div:last input:text[name=\'string[options][]\']").val(val);
										' . $js3 . '
									}
									if (isNew) {
										var attr = "input:text[name=\'json\\[options2\\]\\[options\\]\\[0\\]\\[direction\\]\']";
										if ($(attr).length) { $(attr).remove(); }
									} isNew = 0;
								});
								';
                    if (!$elem->options) {
                        //$js2	.=	'$("#sortable_core_options>div:last .button-add-core_options").click();';
                    }
                    $css .= '.button-add{display:none;}';
                    if (!$elem->options) {
                        $css .= '#collection-group-wrap-core_options__0{display:none;}';
                    }
                    $js3 = '';
                } else {
                    $js3 = '(function($){ var cur = 9999; $.fn.JCckFieldxAddAfter = function() {' . $js3 . ' $(this).next().find(".collection-group-form").append(content);} })(jQuery);';
                }
                if ($html) {
                    $html = '<div class="clr"></div><div>' . $html . '</div>';
                    $js = 'if ($("#sortable_core_options")) { ' . $js . ' $("#sortable_core_options").parent().append("' . addslashes($html) . '"); }';
                }
            }
            if ($css) {
                echo '<style type="text/css">' . $css . '</style>';
            }
            if ($js || $js2) {
                echo '<script type="text/javascript">' . 'jQuery(document).ready(function($){' . $js . $js2 . '});' . $js3 . '</script>';
            }
            return;
        }
        if ($elem->name) {
            JFactory::getLanguage()->load('plg_cck_field_' . $type . '_' . $elem->name, JPATH_ADMINISTRATOR, null, false, true);
        }
        Helper_Include::addTooltip('span[title].qtip_cck', 'left center', 'right center');
        if ($type == 'validation') {
            return;
        }
        $js2 = '';
        $js3 = '';
        if ($type == 'typo') {
            $js2 = 'if($("#typo_label").length) { $("#typo_label").val(parent.jQuery("#"+eid+"_typo_label").val()); }';
            $js3 = 'if($("#typo_label").length) { parent.jQuery("#"+eid+"_typo_label").val($("#typo_label").val()); } excluded[0] = "typo_label"';
        }
        $js = '
				(function ($){
					JCck.Dev = {
						reset: function() {
							var elem = "' . $elem->id . '_' . $type . '_options";
							parent.jQuery("#"+elem).val("");
							this.close();
						},
						submit: function() {
							if ( $("#adminForm").validationEngine("validate") === true ) {
								var eid = "' . $elem->id . '";
								var elem = "' . $elem->id . '_' . $type . '_options";
								var data = {};
								var excluded = [];
								' . $js3 . '
								$.each(cck_dev, function(k, v) {
									if(jQuery.inArray(v, excluded) == -1) {
										if(!$("#"+v).length) {
											var temp = [];
											$("[name=\\""+v+"\\[\\]\\"]").each(function(i) {
												temp[i] = $(this).val();
											});
											data[v] = temp.join("||");
										} else {
											data[v] = $("#"+v).myVal();
										}
									}
								});
								var encoded = $.toJSON(data);
								parent.jQuery("#"+elem).val(encoded);
								this.close();
								return;
							}
						}
					}
					$(document).ready(function(){
						var eid = "' . $elem->id . '";
						var elem = "' . $elem->id . '_' . $type . '_options";
						var encoded = parent.jQuery("#"+elem).val();
						var data = ( encoded != "" ) ? $.evalJSON(encoded) : "";
						$.each(data, function(k, v) {
							if(!$("#"+k).length) {
								var temp = v.split("||");
								var len = temp.length;
								for(i = 0; i < len; i++) {
									if ( i+1 < len ) { $("#sortable_core_dev_texts>div:last .button-add-core_dev_texts").click(); }
									$("[name=\\""+k+"\\[\\]\\"]:eq("+i+")").myVal(temp[i]);
								}
							} else {
								$("#"+k).myVal( v );
							}
						});
						' . $js2 . '
					});
				})(jQuery); 
			';
        $doc->addScriptDeclaration($js);
    }