function controlToHTML($name) { $html = "\n <div class=\"yui-skin-sam\">\n <div id=\"cal" . $name . "Container\"></div>\n <div id=\"calinput\">\n <input class=\"text\" type=\"text\" name=\"" . $name . "\" id=\"" . $name . "\" />\n <button class=\"button\" type=\"button\" id=\"update-" . $name . "\">Update Calendar</button>\n </div>\n </div>\n <div style=\"clear:both\"></div>\n "; $script = "\n YUI(EXPONENT.YUI3_CONFIG).use('node','yui2-calendar', function(Y) {\n var YAHOO=Y.YUI2;\n \n YAHOO.namespace(\"example.calendar\");\n\n YAHOO.example.calendar.init = function() {\n\n function handleSelect(type,args,obj) {\n var dates = args[0]; \n var date = dates[0];\n var year = date[0], month = date[1], day = date[2];\n\n var txtDate1 = document.getElementById(\"" . $name . "\");\n txtDate1.value = month + \"/\" + day + \"/\" + year;\n }\n\n function updateCal() {\n var txtDate1 = document.getElementById(\"" . $name . "\");\n\n if (txtDate1.value != \"\") {\n YAHOO.example.calendar.cal" . $name . ".select(txtDate1.value);\n var selectedDates = YAHOO.example.calendar.cal" . $name . ".getSelectedDates();\n var firstDate = selectedDates[0];\n YAHOO.example.calendar.cal" . $name . ".cfg.setProperty(\"pagedate\", (firstDate.getMonth()+1) + \"/\" + firstDate.getFullYear());\n YAHOO.example.calendar.cal" . $name . ".render();\n\n }\n }\n\n // For this example page, stop the Form from being submitted, and update the cal instead\n function handleSubmit(e) {\n updateCal();\n YAHOO.util.Event.preventDefault(e);\n }\n YAHOO.example.calendar.cal" . $name . " = new YAHOO.widget.Calendar(\"cal" . $name . "\",\"cal" . $name . "Container\",{selected:'" . date('m/d/Y', $this->default) . "'});\n YAHOO.example.calendar.cal" . $name . ".selectEvent.subscribe(handleSelect, YAHOO.example.calendar.cal" . $name . ", true);\n YAHOO.example.calendar.cal" . $name . ".select('" . date('m/d/Y', $this->default) . "');\n YAHOO.example.calendar.cal" . $name . ".render();\n YAHOO.util.Event.addListener(\"update-" . $name . "\", \"click\", updateCal);\n YAHOO.util.Event.addListener(\"dates-" . $name . "\", \"submit\", handleSubmit);\n }\n\n YAHOO.util.Event.onDOMReady(YAHOO.example.calendar.init);\n });\n \n "; expJavascript::pushToFoot(array("unique" => 'calpop-' . $name, "yui3mods" => 1, "content" => $script, "src" => "")); return $html; }
function controlToHTML($name) { // $html = '<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/editor/assets/skins/sam/simpleeditor.css" />'; $html = '<link rel="stylesheet" type="text/css" href="' . YUI2_PATH . 'editor/assets/skins/sam/simpleeditor.css" />'; $html .= '<div class="yui-skin-sam"><textarea name="' . $name . '" id="' . $name . '"'; $html .= " rows=\"" . $this->rows . "\" cols=\"" . $this->cols . "\""; if ($this->accesskey != "") { $html .= " accesskey=\"" . $this->accesskey . "\""; } if (!empty($this->class)) { $html .= " class=\"" . $this->class . "\""; } if ($this->tabindex >= 0) { $html .= " tabindex=\"" . $this->tabindex . "\""; } if (@$this->required) { $html .= ' required="' . rawurlencode($this->default) . '" caption="' . rawurlencode($this->caption) . '" '; } $html .= ">"; $html .= $this->default; $html .= "</textarea></div>"; $script = "\n\t\t(function() {\n \t\t\tvar Dom = YAHOO.util.Dom,\n \t\tEvent = YAHOO.util.Event;\n \n \t\t\tvar myConfig = {\n \t\t\theight: '95%',\n \t\t\twidth: '530px',\n \t\t\tdompath: true,\n\t\t\t\thandleSubmit: true,\n\t\t\t\tautoHeight: true\n \t\t\t};\n\n \t\t\tYAHOO.log('Create the Editor..', 'info', 'example');\n \t\t\tvar myEditor = new YAHOO.widget.SimpleEditor('" . $name . "', myConfig);\n \t\t\tmyEditor.render();\n\n\t\t})();"; expJavascript::pushToFoot(array("unique" => 'editor-' . $name, "yui2mods" => 'editor', "yui3mods" => null, "content" => $script, "src" => "")); return $html; }
/** * Smarty {script} block plugin * * Type: block<br> * Name: script<br> * Purpose: Set up a script block * * @param $params * @param $content * @param \Smarty $smarty * @param $repeat */ function smarty_block_script($params, $content, &$smarty, &$repeat) { if ($content) { global $userjsfiles; if (empty($params['unique'])) { die("<strong style='color:red'>" . gt("The 'unique' parameter is required for the {script} plugin.") . "</strong>"); } if ((isset($params['yui2mods']) || isset($params['yuimodules'])) && !strstr($content, "YUI(")) { $params['yui3mods'] = 1; $yui2mods = $params['yui2mods'] ? $params['yui2mods'] : $params['yuimodules']; $toreplace = array('"', "'", " "); $stripmodquotes = str_replace($toreplace, "", $yui2mods); $splitmods = explode(",", $stripmodquotes); $y3wrap = "YUI(EXPONENT.YUI3_CONFIG).use("; $y3wrap .= "'yui2-yahoo-dom-event', "; foreach ($splitmods as $key => $mod) { if ($mod == "menu") { $y3wrap .= "'yui2-container', "; } $y3wrap .= "'yui2-" . $mod . "', "; } $y3wrap .= "function(Y) {\r\n"; $y3wrap .= "var YAHOO=Y.YUI2;"; $y3wrap .= $content; $y3wrap .= "});"; $content = $y3wrap; } expJavascript::pushToFoot(array("unique" => $params['unique'], "yui3mods" => $params['yui3mods'], "content" => $content, "src" => $params['src'])); } }
function toHTML($label, $name) { $assets_path = SCRIPT_RELATIVE . 'framework/core/subsystems/forms/controls/assets/'; $subTypeName = empty($this->subtype) ? "expFile[]" : "expFile[" . $this->subtype . "][]"; $files = $this->buildImages(); $html = '<div id="filemanager' . $name . '" class="filemanager control' . (empty($this->class) ? "" : " " . $this->class) . '">'; //$html .= '<div id="displayfiles" class="displayfiles" style="padding:5px; border:1px solid #444"> </div>'; $html .= '<div class="hd"><label class="label">' . $label . ''; if ($this->limit != null) { $html .= ' | <small>' . gt('Limit') . ': <em class="limit">' . $this->limit . '</em></small>'; } if ($this->count < $this->limit) { $html .= ' | <a class="add" href="#" id="addfiles-' . $name . '">' . gt('Add Files') . '</a>'; } $html .= '</label></div>'; if (empty($files)) { $this->count = 0; $files = '<li class="blank">' . gt('You need to add some files') . '</li>'; } $html .= '<ul id="filelist' . $name . '" class="filelist">'; $html .= $files; $html .= '</ul>'; $html .= '<input type="hidden" name="' . $subTypeName . '" value="' . $subTypeName . '">'; $html .= '</div>'; $js = "\n YUI(EXPONENT.YUI3_CONFIG).use('dd-constrain','dd-proxy','dd-drop','json','io', function(Y) {\n var limit = " . $this->limit . ";\n var filesAdded = " . $this->count . ";\n var fl = Y.one('#filelist" . $name . "');\n \n // file picker window opener\n function openFilePickerWindow(e){\n e.halt();\n win = window.open('" . makeLink($params = array('controller' => 'file', 'action' => 'picker', 'ajax_action' => "1", 'update' => $name)) . "', 'IMAGE_BROWSER','left=20,top=20,scrollbars=yes,width=800,height=600,toolbar=no,resizable=yes,status=0');\n if (!win) {\n //Catch the popup blocker\n alert('" . gt('Please disable your popup blocker') . "!!');\n }\n };\n \n var listenForAdder = function(){\n var af = Y.one('#addfiles-" . $name . "');\n af.on('click',openFilePickerWindow);\n };\n \n var showEmptyLI = function(){\n var blank = Y.Node.create('<li class=\"blank\">" . gt('You need to add some files') . "</li>');\n fl.appendChild(blank);\n };\n \n if (limit > filesAdded) {\n listenForAdder();\n }\n \n // remove the file from the list\n fl.delegate('click',function(e){\n e.target.ancestor('li').remove();\n \n showFileAdder();\n },'.delete');\n \n var showFileAdder = function() {\n var sf = Y.one('#addfiles-" . $name . "');\n if (Y.Lang.isNull(sf)) {\n var afl = Y.Node.create('<a class=\"add\" href=\"#\" id=\"addfiles-" . $name . "\">" . gt('Add Files') . "</a>');\n Y.one('#filemanager" . $name . " .hd').append(afl);\n listenForAdder();\n }\n filesAdded--;\n if (filesAdded == 0) showEmptyLI();\n }\n\n //Drag Drop stuff\n \n //Listen for all drop:over events\n Y.DD.DDM.on('drop:over', function(e) {\n //Get a reference to out drag and drop nodes\n var drag = e.drag.get('node'),\n drop = e.drop.get('node');\n\n //Are we dropping on a li node?\n if (drop.get('tagName').toLowerCase() === 'li') {\n //Are we not going up?\n if (!goingUp) {\n drop = drop.get('nextSibling');\n }\n //Add the node to this list\n e.drop.get('node').get('parentNode').insertBefore(drag, drop);\n //Resize this nodes shim, so we can drop on it later.\n e.drop.sizeShim();\n }\n });\n //Listen for all drag:drag events\n Y.DD.DDM.on('drag:drag', function(e) {\n //Get the last y point\n var y = e.target.lastXY[1];\n //is it greater than the lastY var?\n if (y < lastY) {\n //We are going up\n goingUp = true;\n } else {\n //We are going down..\n goingUp = false;\n }\n //Cache for next check\n lastY = y;\n });\n //Listen for all drag:start events\n Y.DD.DDM.on('drag:start', function(e) {\n //Get our drag object\n var drag = e.target;\n //Set some styles here\n drag.get('node').setStyle('opacity', '.25');\n drag.get('dragNode').set('innerHTML', drag.get('node').get('innerHTML'));\n drag.get('dragNode').setStyles({\n opacity: '.85',\n borderColor: drag.get('node').getStyle('borderColor'),\n backgroundImage: drag.get('node').getStyle('backgroundImage')\n });\n });\n //Listen for a drag:end events\n Y.DD.DDM.on('drag:end', function(e) {\n var drag = e.target;\n //Put out styles back\n drag.get('node').setStyles({\n visibility: '',\n opacity: '1'\n });\n });\n //Listen for all drag:drophit events\n Y.DD.DDM.on('drag:drophit', function(e) {\n var drop = e.drop.get('node'),\n drag = e.drag.get('node');\n\n //if we are not on an li, we must have been dropped on a ul\n if (drop.get('tagName').toLowerCase() !== 'li') {\n if (!drop.contains(drag)) {\n drop.appendChild(drag);\n }\n }\n });\n\n //Static Vars\n var goingUp = false, lastY = 0;\n\n var initDragables = function(){\n\n //Get the list of li's in the lists and make them draggable\n var lis = Y.Node.all('#filelist" . $name . " li');\n if (lis){\n lis.each(function(v, k) {\n var dd = new Y.DD.Drag({\n node: v,\n proxy: true,\n moveOnEnd: false,\n target: {\n padding: '0 0 0 20'\n }\n }).plug(Y.Plugin.DDConstrained, {\n //Keep it inside the #list1 node\n constrain2node: '#filelist" . $name . "',\n stickY:true\n }).plug(Y.Plugin.DDProxy, {\n //Don't move the node at the end of the drag\n moveOnEnd: false,\n borderStyle:'0'\n });//.addHandle('.fpdrag');\n });\n }\n\n //var tar = new Y.DD.Drop({ node:Y.one('#filelist" . $name . "')});\n }\n \n initDragables();\n\n // calback function from open window\n EXPONENT.passBackFile" . $name . " = function(id) {\n\n var complete = function (ioId, o) {\n var df = Y.one('#filelist" . $name . "');\n var objson = Y.JSON.parse(o.responseText);\n var obj = objson.data;\n if (obj.mimetype!='image/png' && obj.mimetype!='image/gif' && obj.mimetype!='image/jpeg'){\n var filepic = '<img class=\"filepic\" src=\"'+EXPONENT.ICON_RELATIVE+'\"attachableitems/generic_22x22.png\">';\n } else {\n var filepic = '<img class=\"filepic\" src=\"'+EXPONENT.URL_FULL+'thumb.php?id='+obj.id+'&w=24&h=24&zc=1\">';\n }\n \n var html = '<li>';\n html += '<input type=\"hidden\" name=\"" . $subTypeName . "\" value=\"'+obj.id+'\">';\n html += '<a class=\"delete\" rel=\"imgdiv'+obj.id+'\" href=\"javascript:{}\">" . gt('delete') . "<\\/a>';\n html += filepic;\n html += '<span class=\"filename\">'+obj.filename+'<\\/span>';\n html += '<\\/li>';\n \n htmln = Y.Node.create(html); \n \n df.append(htmln);\n\n var dd = new Y.DD.Drag({\n node: htmln,\n proxy: true,\n moveOnEnd: false,\n target: {\n padding: '0 0 0 20'\n }\n }).plug(Y.Plugin.DDConstrained, {\n constrain2node: '#filelist" . $name . "',\n stickY:true\n }).plug(Y.Plugin.DDProxy, {\n moveOnEnd: false,\n borderStyle:'0'\n });\n\n \n var af = Y.one('#addfiles-" . $name . "');\n\n if (filesAdded==0) {\n fl.one('.blank').remove();\n }\n\n filesAdded++\n\n if (!Y.Lang.isNull(af) && limit==filesAdded) {\n af.remove();\n }\n\n //initDragables();\n };\n \n var cfg = {\n on:{\n success:complete\n }\n };\n Y.io(EXPONENT.URL_FULL+'index.php.php?controller=file&action=getFile&ajax_action=1&json=1&id='+id, cfg);\n //ej.fetch({action:'getFile',controller:'fileController',json:1,params:'&id='+id});\n }\n\n });\n "; // END PHP STRING LITERAL expCSS::pushToHead(array("unique" => "cal2", "link" => $assets_path . "files/attachable-files.css")); // exponent_javascript_toFoot("filepicker".$name,"json,connection","dd-constrain,dd-proxy,dd-drop",$js,""); expJavascript::pushToFoot(array("unique" => "filepicker" . $name, "yui3mods" => "1", "content" => $js, "src" => "")); return $html; }
/** * Smarty {yuimenu} function plugin * * Type: function<br> * Name: yuimenu<br> * Purpose: display a yui menu * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_yuimenu($params, &$smarty) { $menu = ' function buildmenu () { var oMenuSidenavJs = new YAHOO.widget.Menu("' . $params['buildon'] . '", { position: "static", hidedelay: 100, lazyload: true }); var aSubmenuData = ' . navigationmodule::navtojson() . '; oMenuSidenavJs.subscribe("beforeRender", function () { if (this.getRoot() == this) { for (i=0; i<=this.getItems().length; i++){ var j=i; // console.debug(aSubmenuData[j].itemdata.length); if (aSubmenuData[j].itemdata.length>0){ this.getItem(i).cfg.setProperty("submenu", aSubmenuData[j]); } } } }); oMenuSidenavJs.render(); } YAHOO.util.Event.onDOMReady(buildmenu); '; expJavascript::pushToFoot(array("unique" => "yuimenubar-" . $params['buildon'], "yui2mods" => "menu", "yui3mods" => $smarty->getTemplateVars('__name'), "content" => $menu, "src" => "")); }
function controlToHTML($name, $label) { $assets_path = SCRIPT_RELATIVE . 'framework/core/subsystems/forms/controls/assets/'; $html = '<div class="text-control control exp-skin" id="search_stringControl">'; $html .= empty($this->label) ? '' : '<label for="' . $name . '">' . $label . '</label>'; $html .= '<input type="text" class="text " size="20" value="' . $this->value . '" name="' . $name . '" id="' . $name . '"/> <div id="results' . $name . '"></div> </div> '; $script = "\n YUI(EXPONENT.YUI3_CONFIG).use('node','yui2-yahoo-dom-event','yui2-animation','yui2-autocomplete','yui2-connection','yui2-datasource', function(Y) {\n YAHOO = Y.YUI2;\n Y.one('#" . $name . "').on('click',function(e){e.target.set('value','');});\n\n // autocomplete\n var autocomplete = function() {\n // Use an XHRDataSource\n var oDS = new YAHOO.util.XHRDataSource(EXPONENT.URL_FULL+\"index.php\");\n // Set the responseType\n oDS.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;\n\n //oDS.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;\n // Define the schema of the delimited results\n oDS.responseSchema = {\n resultsList : \"data\",\n fields : [" . $this->schema . "]\n };\n\n // Enable caching\n oDS.maxCacheEntries = 5;\n\n // Instantiate the AutoComplete\n var oAC = new YAHOO.widget.AutoComplete(\"" . $name . "\", \"results" . $name . "\", oDS);\n oAC.generateRequest = function(sQuery) {\n return \"?ajax_action=1&json=1&controller=" . $this->controller . "&model=" . $this->searchmodel . "&searchoncol=" . $this->searchoncol . "&action=" . $this->action . "&query=\"+sQuery ;\n };\n \n " . $this->jsinject . "\n\n }();\n });\n "; // end JS // css expCSS::pushToHead(array("unique" => "ac0", "link" => $assets_path . "autocomplete/autocomplete.css")); expJavascript::pushToFoot(array("unique" => 'ac' . $name, "yui3mods" => 1, "content" => $script, "src" => "")); //exponent_javascript_toFoot('ac'.$name, "animation,autocomplete,connection,datasource", null, $script); return $html; }
function controlToHTML($name, $label) { $opts_template = get_template_for_action('common', 'configopts', null); $opts_template->assign('opts', $this->opts); $html = ' <div class="yui-skin-sam"> <div id="demo"> <div id="leftopts">'; $html .= $opts_template->render(); $html .= '</div> </div> </div> '; $script = "\n\t\t\tvar cp = new configPanel(" . $this->title . ", 'leftopts', '" . $this->welcome . "', 750, 450);\n\t\t cp.fire();\n\t\t"; expJavascript::pushToFoot(array("unique" => 'cfgmgr', "yui2mods" => 'dragdrop,element,animation,resize,layout', "yui3mods" => null, "content" => '//comment', "src" => PATH_RELATIVE . 'framework/core/assets/js/exp-layout.js')); return $html; }
function toHTML($label, $name) { $html = '<div id="list' . $name . '" class="list control">'; $html .= '<label>' . gt('Add') . ' ' . $label . '</label>'; $html .= '<input id="list-input-' . $name . '" name="list-input-' . $name . '">'; $html .= '<a class="addtolist" href="#">' . gt('Add to list') . '</a>'; $html .= '<h2>' . $label . '</h2>'; $html .= '<ul id="list-values-' . $name . '">'; if (count($this->value) > 0) { foreach ($this->value as $value) { $html .= '<li><input type="hidden" name="' . $name . '[]" value="' . $value . '">'; $html .= $value . '<a class="remove-from-list" href="#">remove?</a></li>'; } } else { '<h2 id="empty-list-' . $name . '">' . gt('There are no items yet.') . '</h2>'; } $html .= '</ul>'; $html .= '</div>'; $js = "\n var add = YAHOO.util.Dom.getElementsByClassName('addtolist', 'a');\n YAHOO.util.Event.on(add, 'click', function(e,o){\n YAHOO.util.Dom.setStyle('empty-list-" . $name . "', 'display', 'none');\n YAHOO.util.Event.stopEvent(e);\n var listitem = YAHOO.util.Dom.get('list-input-" . $name . "');\n var newli = document.createElement('li');\n var newLabel = document.createElement('span');\n newLabel.innerHTML = listitem.value + '<input type=\"hidden\" name=\"" . $name . "[]\" value=\"'+listitem.value+'\" />';\n var newRemove = document.createElement('a');\n newRemove.setAttribute('href','#');\n newRemove.innerHTML = ' " . gt('Remove') . "?';\n newli.appendChild(newLabel);\n newli.appendChild(newRemove);\n var list = YAHOO.util.Dom.get('list-values-" . $name . "');\n list.appendChild(newli);\n YAHOO.util.Event.on(newRemove, 'click', function(e,o){\n var list = YAHOO.util.Dom.get('list-values-" . $name . "');\n list.removeChild(this)\n },newli,true);\n listitem.value = '';\n //alert(listitem);\n });\n \n var existingRems = YAHOO.util.Dom.getElementsByClassName('remove-from-list', 'a');\n YAHOO.util.Event.on(existingRems, 'click', function(e,o){\n YAHOO.util.Event.stopEvent(e);\n var targ = YAHOO.util.Event.getTarget(e);\n var lItem = YAHOO.util.Dom. getAncestorByTagName(targ,'li');\n var list = YAHOO.util.Dom.get('list-values-" . $name . "');\n list.removeChild(lItem);\n });\n "; // END PHP STRING LITERAL expJavascript::pushToFoot(array("unique" => "listcontrol" . $name, "yui2mods" => "json,connection", "yui3mods" => "listcontrol-" . $name, "content" => $js, "src" => "")); return $html; }
/** * Smarty {yuimenubar} function plugin * * Type: function<br> * Name: yuimenubar<br> * Purpose: display a yui menu bar * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_yuimenubar($params, &$smarty) { $menu = ' function buildmenu () { var oMenuBar = new YAHOO.widget.MenuBar("' . $params['buildon'] . '", { constraintoviewport:false, postion:"dynamic", visible:true, zIndex:250, autosubmenudisplay: true, hidedelay: 750, lazyload: true }); var aSubmenuData = ' . navigationmodule::navtojson() . '; oMenuBar.subscribe("beforeRender", function () { if (this.getRoot() == this) { for (i=0; i<=this.getItems().length; i++){ var j=i; if (aSubmenuData[j].itemdata.length>0){ this.getItem(i).cfg.setProperty("submenu", aSubmenuData[j]); } } } }); oMenuBar.render(); } YAHOO.util.Event.onDOMReady(buildmenu); '; expJavascript::pushToFoot(array("unique" => "yuimenubar-" . $params['buildon'], "yui2mods" => "menu", "yui3mods" => $smarty->getTemplateVars('__name'), "content" => $menu, "src" => "")); }
public function makeHeaderCols($params) { global $router; if (!empty($this->columns) && is_array($this->columns)) { $this->header_columns = ''; // get the parameters used to make this page. if (!expTheme::inAction()) { unset($params['section']); if (empty($params['controller'])) { $params['controller'] = $this->controller; } if (empty($params['action'])) { $params['action'] = $this->action; } } $current = ''; if (isset($params['order'])) { $current = $params['order']; unset($params['order']); } else { $current = $this->order; } //loop over the columns and build out a list of <th>'s to be used in the page table foreach ($this->columns as $colname => $col) { // if this is the column we are sorting on right now we need to setup some class info $class = isset($this->class) ? $this->class : 'page'; $params['dir'] = 'ASC'; if ($col == $current) { $class = 'current'; $class .= ' ' . strtolower($this->order_direction); if (isset($_REQUEST['dir'])) { $params['dir'] = $_REQUEST['dir'] == 'ASC' ? 'DESC' : 'ASC'; } else { $params['dir'] = $this->order_direction == 'ASC' ? 'DESC' : 'ASC'; } } $params['order'] = $col; $this->header_columns .= '<th class="' . $class . '">'; // if this column is empty then it's not supposed to be a sortable column if (empty($col)) { $this->header_columns .= '<span>' . $colname . '</span>'; $this->columns[$colname] = ' '; } else { if ($colname == "actupon") { $this->header_columns .= '<input type=checkbox name=selall value=1 class="select-all"/>'; $js = "\r\n YUI(EXPONENT.YUI3_CONFIG).use('node', function(Y) {\r\n Y.all('input[type=checkbox]').on('click',function(e){\r\n if (e.target.test('.select-all')) {\r\n if (!e.target.get('checked')) {\r\n this.each(function(n){\r\n n.set('checked',false);\r\n });\r\n } else {\r\n this.each(function(n){\r\n n.set('checked',true);\r\n });\r\n };\r\n };\r\n });\r\n });\r\n "; expJavascript::pushToFoot(array("unique" => 'select-all', "yui3mods" => null, "content" => $js, "src" => "")); } else { unset($params['page']); $this->header_columns .= '<a href="' . $router->makeLink($params, null, null, true) . '" alt="sort by ' . $colname . '" rel="nofollow">' . $colname . '</a>'; } } $this->header_columns .= '</th>'; } } }
/** * Smarty {rating} function plugin * * Type: function<br> * Name: rating<br> * Purpose: display a rating * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_rating($params, &$smarty) { global $user, $db; expCSS::pushToHead(array("unique" => 'ratings', "link" => PATH_RELATIVE . "framework/modules/core/assets/css/ratings.css")); $params['subtype'] = isset($params['subtype']) ? $params['subtype'] : $params['content_type']; $total_rating = 0; if (!empty($params['record']->expRating[$params['subtype']])) { foreach ($params['record']->expRating[$params['subtype']] as $rating) { $total_rating = $total_rating + $rating->rating; if ($rating->poster == $user->id) { $myrate = $rating->rating; } } $rating_count = count($params['record']->expRating[$params['subtype']]); $total_average = number_format($total_rating / $rating_count, 1); } else { $rating_count = 0; $total_average = 0; } $avg_percent = round($total_average * 100 / 5) + 1; $html = ' <div class="star-rating"> <div id="rating-total-' . $params['subtype'] . '" class="star-stats"> <strong>' . $params['label'] . '</strong> <div id="user-rating-' . $params['subtype'] . '" class="star-bar"> <div id="star-average-' . $params['subtype'] . '" class="star-average" style="width:' . $avg_percent . '%"></div>'; if ($user->isLoggedIn()) { $html .= '<div id="my-ratings-' . $params['subtype'] . '" class="my-ratings"> <span rel="1" class="u-star st1' . ($myrate >= 1 ? " selected" : "") . '"> <span rel="2" class="u-star st2' . ($myrate >= 2 ? " selected" : "") . '"> <span rel="3" class="u-star st3' . ($myrate >= 3 ? " selected" : "") . '"> <span rel="4" class="u-star st4' . ($myrate >= 4 ? " selected" : "") . '"> <span rel="5" class="u-star st5' . ($myrate >= 5 ? " selected" : "") . '"> </span> </span> </span> </span> </span> </div>'; } if ($rating_count) { $html .= '</div><em><span class="avg">' . $total_average . '</span> ' . gt('avg. by') . ' <span class="raters">' . $rating_count . '</span> ' . gt('people') . '</em></div>'; } else { $html .= '</div><em><span class="raters">' . gt('Be the first to rate this item.') . '</em></div>'; } $rated = $db->selectValue('content_expRatings', 'expratings_id', "content_type='" . $params['content_type'] . "' AND subtype='" . $params['subtype'] . "' AND poster='" . $user->id . "'"); $rated_val = $db->selectValue('expRatings', 'rating', "id='" . $rated . "' AND poster='" . $user->id . "'"); $html .= ' <div class="rating-form"> <form id="ratingform-' . $params['subtype'] . '" action="index.php" method="post"> <input type="hidden" name="action" value="update" /> <input type="hidden" name="controller" value="expRating" /> <input type="hidden" name="content_type" value="' . $params['content_type'] . '" /> <input type="hidden" name="subtype" value="' . $params['subtype'] . '" /> <input type="hidden" name="content_id" value="' . $params['record']->id . '" />'; $control = new radiogroupcontrol(); // differentiate it from the old school forms $control->newschool = true; $control->cols = 0; $control->default = $rated_val; $control->items = array_combine(explode(',', "1,2,3,4,5"), explode(',', "1,2,3,4,5")); $html .= $control->toHTML('', 'rating'); $html .= '<button>Save Rating</button> </form> </div> </div> '; $content = "\n YUI(EXPONENT.YUI3_CONFIG).use('node','event','io', function(Y) {\n var myrating = '" . $myrate . "';\n var ratingcount = '" . $rating_count . "';\n var total_rating = '" . $total_rating . "';\n var total_average = '" . $total_average . "';\n var avg_percent = '" . $avg_percent . "';\n \n function update_totals(mynewrating) {\n if (myrating=='') {\n myrating = mynewrating;\n ratingcount = parseInt(ratingcount)+1\n Y.one('#rating-total-" . $params['subtype'] . " .raters').setContent(ratingcount);\n }\n total_rating = (total_rating==0) ? parseInt(mynewrating) : total_rating-myrating+parseInt(mynewrating);\n total_average = total_rating/ratingcount;\n avg_percent = total_average*100/5;\n Y.one('#rating-total-" . $params['subtype'] . " .avg').setContent(total_average.toFixed(1));\n Y.one('#star-average-" . $params['subtype'] . "').setStyle('width',Math.round(avg_percent)+1+'%');\n myrating = mynewrating;\n }\n \n var iocfg = {\n method: 'POST',\n data: 'json=1&ajax_action=1',\n form: {\n id: 'ratingform-" . $params['subtype'] . "',\n useDisabled: false\n }\n };\n function save_rating() {\n var url = EXPONENT.URL_FULL+'index.php';\n Y.io(url, iocfg);\n Y.on('io:success', onSuccess, this);\n Y.on('io:failure', onFailure, this);\n };\n function onSuccess(id,response,args) {\n\n };\n function onFailure(id,response,args) {\n alert('woops, something is broke...');\n };\n\n var myratings = Y.one('#my-ratings-" . $params['subtype'] . "');\n\n // handles what happens when you click on the stars\n myratings.delegate(\n {\n 'click' : function(e) {\n e.stopPropagation();\n e.container.all('.u-star').removeClass('selected');\n update_totals(e.target.getAttribute('rel'))\n e.target.addClass('selected').ancestors('.u-star').addClass('selected');\n var form = Y.one('#ratingform-" . $params['subtype'] . "');\n form.one('[value='+myrating+']').set('checked','checked');\n save_rating();\n //form.submit();\n }\n },'.u-star');\n\n // handles what happens when you hover over the stars if you've not rated this item before\n myratings.on(\n {\n 'mouseenter' : function(e) {\n myratings.all('.u-star').removeClass('selected');\n },\n 'mouseleave' : function(e) {\n if (myrating!='') {\n myratings.one('.u-star[rel='+myrating+']').addClass('selected').ancestors('.u-star').addClass('selected');\n }\n }\n });\n\n });\n "; if ($user->isLoggedIn()) { expJavascript::pushToFoot(array("unique" => 'ratings' . $params['subtype'], "yui3mods" => "yui", "content" => $content)); } echo $html; }
/** * Smarty {prod_images} function plugin * * Type: function<br> * Name: prod_images<br> * Purpose: display product images * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_prod_images($params, &$smarty) { //load up the img plugin require_once $smarty->_get_plugin_filepath('function', 'img'); $rec = $params['record']; if ($rec->main_image_functionality == 'iws') { $images = $rec->expFile['imagesforswatches']; } else { $images = $rec->expFile['mainimage']; } //ref for additional images so we can play with the array $additionalImages = !empty($rec->expFile['images']) ? $rec->expFile['images'] : array(); $mainImages = !empty($additionalImages) ? array_merge($images, $additionalImages) : $images; $mainthmb = !empty($rec->expFile['mainthumbnail'][0]) ? $rec->expFile['mainthumbnail'][0] : $mainImages[0]; $addImgs = array_merge(array($mainthmb), $additionalImages); //pulling in store configs. This is a placeholder for now, so we'll manually set them til we get that worked in. $config = $smarty->getTemplateVars('config'); // $config = array( // "listing-width"=>148, // "listing-height"=>148, // "disp-width"=>200, // "disp-height"=>250, // "thmb-box"=>40, // "swatch-box"=>30, // "swatch-pop"=>100 // ); switch ($params['display']) { case 'single': $html = '<a class="prod-img" href="' . makelink(array("controller" => "store", "action" => "showByTitle", "title" => $rec->title)) . '">'; $width = !empty($params['width']) ? $params['width'] : 100; $imgparams = array("constraint" => 1, "file_id" => $images[0]->id, "w" => $config["listingwidth"], "h" => $config["listingheight"], "return" => 1, "class" => "ecom-image"); if (!$images[0]->id) { unset($imgparams['file_id']); $imgparams['src'] = 'framework/modules/ecommerce/assets/images/no-image.jpg'; $imgparams['alt'] = gt('No image found for') . ' ' . $rec->title; } $img = smarty_function_img($imgparams, &$smarty); $html .= $img; $html .= '</a>'; break; case 'main': // if we have only 1 image to display, left do a little math to figure out how tall to make our display box if (count($addImgs) <= 1) { $config['displayheight'] = ceil($mainImages[0]->image_height * $config['displaywidth'] / $mainImages[0]->image_width); } if (count($addImgs) > 1) { $adi .= '<ul class="thumbnails">'; for ($i = 0; $i < count($addImgs); $i++) { $thumbparams = array("h" => $config['addthmbw'], "w" => $config['addthmbh'], "zc" => 1, "file_id" => $addImgs[$i]->id, "return" => 1, "class" => "thumnail"); $thmb .= '<li>' . smarty_function_img($thumbparams, &$smarty) . '</li>'; } $adi .= $thmb; $adi .= '</ul>'; } // shrink shrink the display window to fit the selected image if no height is set if ($config['displayheight'] == 0) { $config['displayheight'] = $config['displaywidth'] * $mainImages[0]->image_height / $mainImages[0]->image_width; } $html = '<div class="ecom-images loading-images" style="width:' . $config['displaywidth'] . 'px;">'; // if configured, the additional thumb images will display at the bottom $html .= $config['thumbsattop'] == 1 ? $adi : ''; $html .= '<ul class="enlarged" style="height:' . $config['displayheight'] . 'px;width:' . $config['displaywidth'] . 'px;">'; for ($i = 0; $i < count($mainImages); $i++) { $imgparams = array("w" => $config['displaywidth'], "file_id" => $mainImages[$i]->id, "return" => 1, "class" => "large-img"); $img .= '<li>' . smarty_function_img($imgparams, &$smarty) . '</li>'; } $html .= $img; $html .= '</ul>'; // if configured, the additional thumb images will display at the bottom $html .= $config['thumbsattop'] != 1 ? $adi : ''; $html .= '</div>'; // javascripting $js = "\n YUI(EXPONENT.YUI3_CONFIG).use('node','anim', function(Y) {\n // set up the images with correct z-indexes to put the first image on top\n var imgs = Y.all('.ecom-images img.large-img');\n var thumbs = Y.all('.thumbnails img');\n var swatches = Y.all('.swatches .swatch');\n\n //remove loading\n Y.one('.loading-images').removeClass('loading-images');\n\n var resetZ = function(n,y){\n n.setStyles({'zIndex':0,'display':'none'});\n n.set('id','exp-ecom-msi-'+y);\n }\n\n imgs.each(resetZ);\n imgs.item(0).setStyles({'zIndex':'1','display':'block'});\n \n swatches.each(function(n,y){\n n.set('id','exp-ecom-ms-'+y)\n });\n \n swatches.on('click',function(e){\n imgs.each(resetZ);\n var curImg = imgs.item(swatches.indexOf(e.target));\n var imgWin = curImg.ancestor('ul.enlarged');\n imgWin.setStyle('height',curImg.get('height')+'px');\n //animImgWin(imgWin,curImg.get('height'));\n curImg.setStyles({'zIndex':'1','display':'block'});\n });\n \n thumbs.on('click',function(e){\n imgs.each(resetZ);\n \n if (swatches.size()!=0) {\n var processedIndex = thumbs.indexOf(e.target)==0 ? 0 : swatches.size()+thumbs.indexOf(e.target)-1;\n } else {\n var processedIndex = thumbs.indexOf(e.target);\n }\n var curImg = imgs.item(processedIndex); \n curImg.ancestor('ul.enlarged').setStyle('height',curImg.get('height')+'px'); \n curImg.setStyles({'zIndex':'1','display':'block'});\n });\n \n // animation... too much for now, but we'll leave the code\n var animImgWin = function (node,h) {\n var hAnim = new Y.Anim({\n node: node,\n to: {height: h},\n easing:Y.Easing.easeOut,\n duration:0.5\n });\n hAnim.run();\n }\n \n });\n "; expJavascript::pushToFoot(array("unique" => 'imgswatches', "yui2mods" => null, "yui3mods" => null, "content" => $js, "src" => "")); break; case 'swatches': $html = '<ul class="swatches">'; $swatches = $rec->expFile['swatchimages']; for ($i = 0; $i < count($swatches); $i++) { $small = array("h" => $config['swatchsmh'], "w" => $config['swatchsmw'], "zc" => 1, "file_id" => $swatches[$i]->id, "return" => 1, "class" => 'swatch'); $med = array("h" => $config['swatchpoph'], "w" => $config['swatchpopw'], "zc" => 1, "file_id" => $swatches[$i]->id, "return" => 1); $swtch .= '<li>' . smarty_function_img($small, &$smarty); $swtch .= '<div>' . smarty_function_img($med, &$smarty) . '<strong>' . $swatches[$i]->title . '</strong></div>'; $swtch .= '</li>'; } $html .= $swtch; $html .= '</ul>'; break; } echo $html; }
/** * Smarty {ddrerank} function plugin * * Type: function<br> * Name: ddrerank<br> * Purpose: display item re-ranking popup * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_ddrerank($params, &$smarty) { global $db; $loc = $smarty->getTemplateVars('__loc'); $badvals = array("[", "]", ",", " ", "'", "\"", "&", "#", "%", "@", "!", "\$", "(", ")", "{", "}"); $uniqueid = str_replace($badvals, "", $loc->src) . $params['id']; $controller = !empty($params['controller']) ? $params['controller'] : $loc->mod; if ($params['sql']) { $sql = explode("LIMIT", $params['sql']); $params['items'] = $db->selectObjectsBySQL($sql[0]); } else { if ($params['items'][0]->id) { $model = empty($params['model']) ? $params['items'][0]->classname : $params['model']; $only = !empty($params['only']) ? ' AND ' . $params['only'] : ''; $obj = new $model(); $params['items'] = $obj->find('all', "location_data='" . serialize($loc) . "'" . $only, "rank"); } else { $params['items'] = array(); } } if (count($params['items']) >= 2) { expCSS::pushToHead(array("corecss" => "rerank,panel")); $sortfield = empty($params['sortfield']) ? 'title' : $params['sortfield']; //what was this even for? // attempt to translate the label if (!empty($params['label'])) { $params['label'] = gt($params['label']); } echo '<a id="rerank' . $uniqueid . '" class="reranklink" href="#">' . gt("Order") . ' ' . $params['label'] . '</a>'; $html = ' <div id="panel' . $uniqueid . '" class="exp-skin-panel exp-skin-rerank hide"> <div class="yui3-widget-hd">Order ' . $params['label'] . '</div> <div class="yui3-widget-bd"> <form method="post" action="' . URL_FULL . '"> <input type="hidden" name="model" value="' . $model . '" /> <input type="hidden" name="controller" value="' . $controller . '" /> <input type="hidden" name="lastpage" value="' . curPageURL() . '" /> <input type="hidden" name="src" value="' . $loc->src . '" />'; if (!empty($params['items'])) { // we may need to pass through an ID for some reason, like a category ID for products $html .= $params['id'] ? '<input type="hidden" name="id" value="' . $params['id'] . '" />' : ''; $html .= '<input type="hidden" name="action" value="manage_ranks" /> <ul id="listToOrder' . $uniqueid . '" style="' . (count($params['items'] < 12) ? "" : "height:350px") . ';overflow-y:auto;"> '; $odd = "even"; foreach ($params['items'] as $item) { $html .= ' <li class="' . $odd . '"> <input type="hidden" name="rerank[]" value="' . $item->id . '" /> <div class="fpdrag"></div>'; //Do we include the picture? It depends on if there is one set. $html .= $item->expFile[0]->id && $item->expFile[0]->is_image ? '<img class="filepic" src="' . URL_FULL . 'thumb.php?id=' . $item->expFile[0]->id . '&w=16&h=16&zc=1">' : ''; $html .= '<span class="label">' . (!empty($item->{$sortfield}) ? substr($item->{$sortfield}, 0, 40) : gt('Untitled')) . '</span> </li>'; $odd = $odd == "even" ? "odd" : "even"; } $html .= '</ul> <div class="yui3-widget-ft"> <button type="submit" class="awesome small ' . BTN_COLOR . '">' . gt('Save') . '</button> </div> </form> </div> </div> '; } else { $html .= '<strong>' . gt('Nothing to re-rank') . '</strong> </div> </div> '; } echo $html; $script = "\n YUI(EXPONENT.YUI3_CONFIG).use('node','dd','dd-plugin','panel', function(Y) {\n var panel = new Y.Panel({\n srcNode:'#panel" . $uniqueid . "',\n width : 500,\n visible : false,\n zIndex : 50,\n centered : false,\n render : 'body',\n // plugins : [Y.Plugin.Drag]\n }).plug(Y.Plugin.Drag);\n \n panel.dd.addHandle('.yui3-widget-hd');\n \n var panelContainer = Y.one('#panel" . $uniqueid . "').get('parentNode');\n panelContainer.addClass('exp-panel-container');\n Y.one('#panel" . $uniqueid . "').removeClass('hide');\n \n Y.one('#rerank" . $uniqueid . "').on('click',function(e){\n e.halt();\n panel.show();\n panel.set('centered',true);\n });\n\n //Static Vars\n var goingUp = false, lastY = 0;\n\n // the list\n var ul = '#listToOrder" . $uniqueid . "';\n\n //Get the list of li's in the lists and make them draggable\n var lis = Y.Node.all('#listToOrder" . $uniqueid . " li');\n// lis.each(function(v, k) {\n // var dragItem = new Y.DD.Drag({\n // node: v,\n // target: {\n // padding: '0 0 0 0'\n // }\n // }).plug(Y.Plugin.DDProxy, {\n // moveOnEnd: false\n // }).plug(Y.Plugin.DDConstrained, {\n // constrain2node: ul,\n // stickY:true\n // }).plug(Y.Plugin.DDNodeScroll, {\n // node: ul\n // }).addHandle('.fpdrag');\n\n var dragItems = new Y.DD.Delegate({\n container: ul,\n nodes: 'li',\n target: {\n padding: '0 0 0 0'\n }\n })\n \n dragItems.dd.plug(Y.Plugin.DDConstrained, {\n constrain2node: ul,\n stickY:true\n }).plug(Y.Plugin.DDProxy, {\n moveOnEnd: false\n }).plug(Y.Plugin.DDConstrained, {\n constrain2node: ul,\n stickY:true\n }).plug(Y.Plugin.DDNodeScroll, {\n node: ul\n }).addHandle('.fpdrag');\n\n dragItems.on('drop:over', function(e) {\n //Get a reference to out drag and drop nodes\n var drag = e.drag.get('node'),\n drop = e.drop.get('node');\n\n //Are we dropping on a li node?\n if (drop.get('tagName').toLowerCase() === 'li') {\n //Are we not going up?\n if (!goingUp) {\n drop = drop.get('nextSibling');\n }\n //Add the node to this list\n e.drop.get('node').get('parentNode').insertBefore(drag, drop);\n //Resize this nodes shim, so we can drop on it later.\n e.drop.sizeShim();\n }\n });\n //Listen for all drag:drag events\n dragItems.on('drag:drag', function(e) {\n //Get the last y point\n var y = e.target.lastXY[1];\n //is it greater than the lastY var?\n if (y < lastY) {\n //We are going up\n goingUp = true;\n } else {\n //We are going down..\n goingUp = false;\n }\n //Cache for next check\n lastY = y;\n Y.DD.DDM.syncActiveShims(true);\n });\n //Listen for all drag:start events\n dragItems.on('drag:start', function(e) {\n //Get our drag object\n var drag = e.target;\n //Set some styles here\n drag.get('node').setStyle('opacity', '.25');\n drag.get('dragNode').addClass('rerank-proxy').set('innerHTML', drag.get('node').get('innerHTML'));\n drag.get('dragNode').setStyles({\n opacity: '.5'\n // borderColor: drag.get('node').getStyle('borderColor'),\n // backgroundColor: drag.get('node').getStyle('backgroundColor')\n });\n });\n //Listen for a drag:end events\n dragItems.on('drag:end', function(e) {\n var drag = e.target;\n //Put out styles back\n drag.get('node').setStyles({\n visibility: '',\n opacity: '1'\n });\n });\n //Listen for all drag:drophit events\n dragItems.on('drag:drophit', function(e) {\n var drop = e.drop.get('node'),\n drag = e.drag.get('node');\n\n //if we are not on an li, we must have been dropped on a ul\n if (drop.get('tagName').toLowerCase() !== 'li') {\n if (!drop.contains(drag)) {\n drop.appendChild(drag);\n }\n }\n });\n// });\n\n //Create simple targets for the 2 lists..\n var tar = new Y.DD.Drop({\n node: ul\n }); \n });\n \n "; if (!expTheme::inPreview()) { expJavascript::pushToFoot(array("unique" => $uniqueid, "yui3mods" => 1, "content" => $script)); } } }
function controlToHTML($name) { $datectl = new yuicalendarcontrol($this->default, '', false); $timectl = new datetimecontrol($this->default, false); $datetime = date('l, F d, o g:i a', $this->default); $html = '<span id="dtdisplay-' . $name . '">' . $datetime . '</span>'; if (!$this->display_only) { $html .= '<input id="pub-' . $name . '" type="checkbox" name="' . $name . '"'; $html .= $this->checked ? ' checked>' . $this->edit_text : '>' . $this->edit_text; $html .= '<div '; $html .= $this->checked ? 'style="display:none"' : ''; $html .= ' id="datetime-' . $name . '">'; $html .= $this->showdate ? $datectl->controlToHTML($name . "date") : ""; $html .= '<div class="yuitime">'; $html .= $this->showtime ? $timectl->controlToHTML($name . "time") : ""; $html .= '</div>'; $html .= '</div>'; } $script = "\n YUI(EXPONENT.YUI3_CONFIG).use('node', function(Y) {\n Y.on('click',function(e){\n var cal = Y.one('#datetime-" . $name . "');\n if (cal.getStyle('display')=='none') {\n cal.setStyle('display','block');\n } else {\n cal.setStyle('display','none');\n }\n },'#pub-" . $name . "');\n });\n "; expJavascript::pushToFoot(array("unique" => "newsmod-" . $name, "yui3mods" => "1", "content" => $script)); return $html; }
/** * Smarty {getchromemenu} function plugin * * Type: function<br> * Name: getchromemenu<br> * Purpose: display the chrome menu * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_getchromemenu($params, &$smarty) { global $router, $user; $cloc = $smarty->getTemplateVars('__loc'); $module = $params['module']; $list = '<ul class="container-menu">'; $list .= '<li class="container-info">' . $module->action . ' / ' . str_replace($module->action . '_', '', $module->view) . '</li>'; if (!empty($params['rank']) && expPermissions::check('order_modules', $cloc)) { $uplink = $router->makeLink(array('module' => 'containermodule', 'src' => $cloc->src, 'action' => 'order', 'a' => $params['rank'] - 2, 'b' => $params['rank'] - 1)); $downlink = $router->makeLink(array('module' => 'containermodule', 'src' => $cloc->src, 'action' => 'order', 'a' => $params['rank'] - 1, 'b' => $params['rank'])); if ($params['rank'] != 1) { //dont show this up arrow if it's the first module in a container $list .= '<li><a href="' . $uplink . '" class="mod-up">' . gt("Move Module Up") . '</a></li>'; } if (!$params['last']) { //if this is the last module in a container don't show down arrow. $list .= '<li><a href="' . $downlink . '" class="mod-down">' . gt("Move Module Down") . '</a></li>'; } } $rerank = $params['rerank']; if ($rerank == 'false') { $rerank = 0; } else { $rerank = 1; } if ($user->isAdmin()) { $userlink = $router->makeLink(array('module' => expModules::getControllerName($module->info['class']), 'src' => $module->info['source'], 'action' => 'userperms', '_common' => 1)); $grouplink = $router->makeLink(array('module' => expModules::getControllerName($module->info['class']), 'src' => $module->info['source'], 'action' => 'groupperms', '_common' => 1)); $list .= '<li><a href="' . $userlink . '" class="user">' . gt("User Permissions") . '</a></li>'; $list .= '<li><a href="' . $grouplink . '" class="group">' . gt("Group Permissions") . '</a></li>'; } if (!empty($module->id) && expPermissions::check('edit_module', $cloc) && $module->permissions['administrate'] == 1) { $editlink = $router->makeLink(array('module' => 'containermodule', 'id' => $module->id, 'action' => 'edit', 'src' => $module->info['source'])); $list .= '<li><a href="' . $editlink . '" class="config-view">' . gt("Configure Action") . " & " . gt("View") . '</a></li>'; } if ($module->permissions['configure'] == 1) { if (expModules::controllerExists($module->info['class'])) { $configlink = $router->makeLink(array('module' => expModules::getControllerName($module->info['class']), 'src' => $module->info['source'], 'action' => 'configure', 'hcview' => $module->view)); $list .= '<li><a href="' . $configlink . '" class="config-mod">' . gt("Configure Settings") . '</a></li>'; } elseif ($module->info['hasConfig']) { $configlink = $router->makeLink(array('module' => $module->info['class'], 'src' => $module->info['source'], 'action' => 'configure', '_common' => 1)); $list .= '<li><a href="' . $configlink . '" class="config-mod">' . gt("Configure Settings") . '</a></li>'; } } if (!empty($module->id) && expPermissions::check('delete_module', $cloc)) { $deletelink = $router->makeLink(array('module' => 'containermodule', 'id' => $module->id, 'action' => 'delete', 'rerank' => $rerank)); $list .= '<li><a href="' . $deletelink . '" class="delete" onclick="alert(\'' . gt("This content is being sent to the Recycle Bin to be recovered later if you wish.") . '\')">' . gt("Remove Module") . '</a></li>'; } if (HELP_ACTIVE) { $helplink = help::makeHelpLink(expModules::getControllerName($module->info['class'])); $list .= '<li><a href="' . $helplink . '" class="helplink" target="_blank">' . gt("Get Help") . '</a></li>'; } $list .= '</ul>'; expCSS::pushToHead(array("unique" => "container-chrome", "link" => PATH_RELATIVE . "framework/modules/container/assets/css/admin-container.css")); expJavascript::pushToFoot(array("unique" => 'container-chrome', "yui3mods" => 'node', "src" => PATH_RELATIVE . "framework/core/assets/js/exp-container.js")); echo $list; }
function controlToHTML($name, $label) { $this->name = empty($this->name) ? $name : $this->name; $this->id = empty($this->id) ? $name : $this->id; $html = '<table height=100% class="quantity-tbl" cellspacing="0" cellpadding="0"><tr><td style="padding:3px;">'; $html .= '<input type="text" id="' . $this->id . '" name="' . $this->name . '" value="' . $this->default . '"'; if ($this->size) { $html .= ' size="' . $this->size . '"'; } $html .= ' class="' . $this->type . " " . $this->class . '"'; if ($this->tabindex >= 0) { $html .= ' tabindex="' . $this->tabindex . '"'; } if ($this->accesskey != "") { $html .= ' accesskey="' . $this->accesskey . '"'; } if ($this->filter != "") { $html .= " onkeypress=\"return " . $this->filter . "_filter.on_key_press(this, event);\" "; $html .= "onblur=\"" . $this->filter . "_filter.onblur(this);\" "; $html .= "onfocus=\"" . $this->filter . "_filter.onfocus(this);\" "; $html .= "onpaste=\"return " . $this->filter . "_filter.onpaste(this, event);\" "; } if ($this->disabled) { $html .= ' disabled'; } if (!empty($this->readonly)) { $html .= ' readonly="readonly"'; } $caption = isset($this->caption) ? $this->caption : str_replace(array(":", "*"), "", ucwords($label)); if (!empty($this->required)) { $html .= ' required="' . rawurlencode($this->default) . '" caption="' . $caption . '" '; } if (!empty($this->onclick)) { $html .= ' onclick="' . $this->onclick . '" '; } if (!empty($this->onchange)) { $html .= ' onchange="' . $this->onchange . '" '; } $html .= ' /></td>'; $html .= '<td width="14" style="padding:0;"> <table style="float:left;margin:0;"><tr><td style="padding:0;"> <a id="up-' . $this->id . ' " class="uptick" href="javascript:void(0);" style="float:left;"> <img style="margin:0;padding:0;font-size:0;line-height:0;float:left;" src="' . ICON_RELATIVE . 'quantity-up.png"' . XHTML_CLOSING . '> </a></td></tr><tr><td style="padding:0;"> <a id="down-' . $this->id . ' " class="downtick" href="javascript:void(0);" style="float:left;"> <img style="margin:0;padding:0;font-size:0;line-height:0;float:left;" src="' . ICON_RELATIVE . 'quantity-down.png"' . XHTML_CLOSING . '> </a></td></tr></table> </td></tr></table>'; // if this control is using an ajax action then lets set up a variable for the function call $ajaxaction = isset($this->ajaxaction) ? $this->ajaxaction . "(id, value);" : ''; // setup the JS to be used by this control. $script = "\n (function() {\n EXPONENT.onQuantityAdjusted = new YAHOO.util.CustomEvent('Quantity Adjusted');\n var upItems = YAHOO.util.Dom.getElementsByClassName('uptick');\n var downItems = YAHOO.util.Dom.getElementsByClassName('downtick');\n var values = YAHOO.util.Dom.getElementsByClassName('" . $this->type . "');\n YAHOO.util.Event.on(upItems, 'click', incrementQuantity);\n YAHOO.util.Event.on(downItems, 'click', decrementQuantity);\n YAHOO.util.Event.on(values, 'change', checkAjaxAction);\n \n function incrementQuantity(e) { \n YAHOO.util.Event.stopEvent(e);\n var el = YAHOO.util.Dom.getAncestorByTagName(YAHOO.util.Event.getTarget(e), 'a'); \n var qtyID = el.id.replace('up-', '').replace(' ', '');\n changeQuantity(qtyID, 1);\n };\n \n function decrementQuantity(e) { \n YAHOO.util.Event.stopEvent(e);\n var el = YAHOO.util.Dom.getAncestorByTagName(YAHOO.util.Event.getTarget(e), 'a'); \n var qtyID = el.id.replace('down-', '').replace(' ', '');\n changeQuantity(qtyID, -1);\n }\n \n function changeQuantity(qtyID, value) {\n var qtyBox = YAHOO.util.Dom.get(qtyID);\n var newval = parseInt(qtyBox.value) + parseInt(value);\n\t\t if (newval < 1) return 1;\n if (newval >= " . $this->min . " && newval <= " . $this->max . ") {\n qtyBox.value = newval;\n callAjaxAction(qtyBox.id, newval);\n }\n }\n\n function checkAjaxAction(e) {\n var qtyBox = YAHOO.util.Event.getTarget(e);\n if (qtyBox.value < " . $this->min . ") {\n qtyBox.value = " . $this->min . ";\n } else if (qtyBox.value > " . $this->max . ") {\n qtyBox.value = " . $this->max . ";\n }\n \n callAjaxAction(qtyBox.id, qtyBox.value);\n }\n\n function callAjaxAction(id, value) {\n " . $ajaxaction . "\n }\n })();\n "; $extfile = isset($this->loadjsfile) ? $this->loadjsfile : null; expJavascript::pushToFoot(array("unique" => 'qty', "yui2mods" => 'json,connection', "yui3mods" => null, "content" => $script, "src" => $extfile)); return $html; }
public static function panel($params) { $content = "<div class=\"pnlmsg\">" . htmlentities($params['content']) . "</div>"; $id = "exppanel" . $params['id']; $width = !empty($params['width']) ? $params['width'] : "300px"; $type = !empty($params['type']) ? $params['type'] : "info"; $dialog = !empty($params['dialog']) ? explode(":", $params['dialog']) : ""; $header = !empty($params['header']) ? $params['header'] : " "; $renderto = !empty($params['renderto']) ? $params['renderto'] : 'document.body'; $on = !empty($params['on']) ? $params['on'] : 'load'; $onnogo = !empty($params['onnogo']) ? $params['onnogo'] : ''; $onyesgo = !empty($params['onyesgo']) ? $params['onyesgo'] : ''; $trigger = !empty($params['trigger']) ? '"' . $params['trigger'] . '"' : 'selfpop'; $zindex = !empty($params['zindex']) ? $params['zindex'] : "50"; //$hide = !empty($params['hide']) ? $params['hide'] : "hide"; $fixedcenter = !empty($params['fixedcenter']) ? $params['fixedcenter'] : "true"; $fade = !empty($params['fade']) ? $params['fade'] : null; $modal = !empty($params['modal']) ? $params['modal'] : "true"; $draggable = empty($params['draggable']) ? "false" : $params['draggable']; $constraintoviewport = !empty($params['constraintoviewport']) ? $params['constraintoviewport'] : "true"; $fade = !empty($params['fade']) ? "effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:" . $params['fade'] . "}," : ""; $close = !empty($params['close']) ? $params['close'] : "true"; $script = ""; if (is_array($dialog)) { $script .= "\n var handleYes = function(e,o) {\n this.hide();"; if ($onyesgo != "") { $script .= "document.location = '" . trim($onyesgo) . "'"; } $script .= "};\n var handleNo = function(e,o) {\n this.hide();"; if ($onyesgo != "") { $script .= "var textlink = '" . trim($onnogo) . "';"; $script .= 'document.location = textlink.replace(/&/g,"&");'; } $script .= "};"; $script .= "var " . $id . " = new YAHOO.widget.SimpleDialog('" . $id . "', { "; $script .= "buttons: [ { text:'" . $dialog[0] . "', handler:handleYes, isDefault:true },{ text:'" . $dialog[1] . "', handler:handleNo } ],"; //$script .= "text: 'Do you want to continue?',"; } else { $script .= "var " . $id . " = new YAHOO.widget.Panel('" . $id . "', { "; } $script .= "fixedcenter:" . $fixedcenter . ",\n draggable:" . $draggable . ",\n modal:" . $modal . ",\n class:'exp-" . $type . " " . $hide . "',\n zIndex:" . $zindex . "," . $fade . "width:'" . $width . "',\n visible:false,\n constraintoviewport:" . $constraintoviewport . ",\n close:" . $close . " } );"; $script .= $id . ".setHeader('" . $header . "');"; $script .= "var pnlcontent = " . $content . ";"; $script .= $id . ".setBody('<span class=\"type-icon\"></span>'+pnlcontent);"; $script .= $id . ".setFooter('" . $footer . "</div>');"; $script .= $id . ".render(" . $renderto . ");"; $script .= "YAHOO.util.Dom.addClass('" . $id . "','exp-" . $type . "');"; if ($hide == false) { $script .= "YAHOO.util.Dom.addClass('" . $id . "','" . $hide . "');"; } switch ($trigger) { case 'selfpop': $script .= "YAHOO.util.Event.onDOMReady(" . $id . ".show, " . $id . ", true);"; break; default: $script .= "YAHOO.util.Event.on(" . $trigger . ", '" . $on . "', function(e,o){\n YAHOO.util.Event.stopEvent(e);\n o.show();\n }, " . $id . ", true);"; break; } expJavascript::pushToFoot(array("unique" => 'pop-' . $params['name'], "yui2mods" => 'animation,container', "yui3mods" => null, "content" => $script, "src" => "")); }
function controlToHTML($name) { global $db; $contentCSS = ''; $cssabs = BASE . 'themes/' . DISPLAY_THEME . '/editors/ckeditor/ckeditor.css'; $css = PATH_RELATIVE . 'themes/' . DISPLAY_THEME . '/editors/ckeditor/ckeditor.css'; if (THEME_STYLE != "" && is_file(BASE . 'themes/' . DISPLAY_THEME . '/editors/ckeditor/ckeditor_' . THEME_STYLE . '.css')) { $cssabs = BASE . 'themes/' . DISPLAY_THEME . '/editors/ckeditor/ckeditor_' . THEME_STYLE . '.css'; $css = PATH_RELATIVE . 'themes/' . DISPLAY_THEME . '/editors/ckeditor/ckeditor_' . THEME_STYLE . '.css'; } if (is_file($cssabs)) { $contentCSS = "contentsCss : '" . $css . "',"; } if (empty($this->toolbar)) { $settings = $db->selectObject('htmleditor_ckeditor', 'active=1'); } elseif ($this->toolbar != 0) { $settings = $db->selectObject('htmleditor_ckeditor', 'id=' . $this->toolbar); } if (!empty($settings)) { $tb = stripSlashes($settings->data); $skin = $settings->skin; $scayt_on = $settings->scayt_on ? 'true' : 'false'; $paste_word = $settings->paste_word ? 'pasteFromWordPromptCleanup : true,' : 'forcePasteAsPlainText : true,'; $plugins = stripSlashes($settings->plugins); $stylesset = stripSlashes($settings->stylesset); $formattags = stripSlashes($settings->formattags); $fontnames = stripSlashes($settings->fontnames); } // set defaults if (empty($tb)) { $tb = "\n \t ['Source','-','Preview','-','Templates'],\n ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print','SpellChecker','Scayt'],\n ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],\n '/',\n ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],\n ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],\n ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],\n ['Link','Unlink','Anchor'],\n ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],\n '/',\n ['Styles','Format','Font','FontSize'],\n ['TextColor','BGColor'],\n ['Maximize', 'ShowBlocks','-','About']"; } if (empty($skin)) { $skin = 'kama'; } if (empty($scayt_on)) { $scayt_on = 'true'; } if (empty($paste_word)) { $paste_word = 'forcePasteAsPlainText : true,'; } if (empty($plugins)) { $plugins = ''; } if (empty($stylesset)) { $stylesset = "'default'"; } if (empty($formattags)) { $formattags = "'p;h1;h2;h3;h4;h5;h6;pre;address;div'"; } if (empty($fontnames)) { $fontnames = "'Arial/Arial, Helvetica, sans-serif;' +\n 'Comic Sans MS/Comic Sans MS, cursive;' +\n 'Courier New/Courier New, Courier, monospace;' +\n 'Georgia/Georgia, serif;' +\n 'Lucida Sans Unicode/Lucida Sans Unicode, Lucida Grande, sans-serif;' +\n 'Tahoma/Tahoma, Geneva, sans-serif;' +\n 'Times New Roman/Times New Roman, Times, serif;' +\n 'Trebuchet MS/Trebuchet MS, Helvetica, sans-serif;' +\n 'Verdana/Verdana, Geneva, sans-serif'"; } $content = "\n\t YUI(EXPONENT.YUI3_CONFIG).use('yui', function(Y) {\n\t // Y.on('readyforcke', function () {\n \t \tEXPONENT.editor" . createValidId($name) . " = CKEDITOR.replace('" . createValidId($name) . "',\n \t\t\t\t{\n \t\t\t\t\tskin : '" . $skin . "',\n \t\t\t\t\ttoolbar : [" . $tb . "],\n \t\t\t\t\t" . $paste_word . "\n scayt_autoStartup : " . $scayt_on . ",\n filebrowserBrowseUrl : '" . makelink(array("controller" => "file", "action" => "picker", "ajax_action" => 1, "ck" => 1, "update" => "fck")) . "',\n filebrowserWindowWidth : '800',\n filebrowserWindowHeight : '600',\n \t\t\t\t\tfilebrowserLinkBrowseUrl : '" . PATH_RELATIVE . "external/editors/connector/CKeditor_link.php',\n filebrowserLinkWindowWidth : '320',\n filebrowserLinkWindowHeight : '600',\n \t\t\t\t\tfilebrowserImageBrowseLinkUrl : '" . PATH_RELATIVE . "external/editors/connector/CKeditor_link.php',\n \t\t\t\t\textraPlugins : 'stylesheetparser,autogrow,tableresize," . $plugins . "',\n \t\t\t\t\tautoGrow_maxHeight : 400,\n \t\t\t\t\tentities_additional : '',\n \t\t\t\t\t" . $contentCSS . "\n stylesSet : " . $stylesset . ",\n \t\t\t\t\tformat_tags : " . $formattags . ",\n font_names :\n " . $fontnames . ",\n \t\t\t\t\tuiColor : '#aaaaaa',\n \t\t\t\t\tbaseHref : '" . URL_FULL . "'\n });\n\n \t\t\t\tCKEDITOR.on( 'instanceReady', function( ev ) {\n \t\t\t\t\tvar blockTags = ['div','h1','h2','h3','h4','h5','h6','p','pre','ol','ul','li'];\n \t\t\t\t\tvar rules = {\n \t\t\t\t\t\tindent : false,\n \t\t\t\t\t\tbreakBeforeOpen : false,\n \t\t\t\t\t\tbreakAfterOpen : false,\n \t\t\t\t\t\tbreakBeforeClose : false,\n \t\t\t\t\t\tbreakAfterClose : true\n \t\t\t\t\t};\n \t\t\t\t\tfor (var i=0; i<blockTags.length; i++) {\n \t\t\t\t\t\tev.editor.dataProcessor.writer.setRules( blockTags[i], rules );\n \t\t\t\t\t}\n \t\t\t\t});\n\n // });\n\t });\n \n\t "; expJavascript::pushToFoot(array("unique" => "zzz-cke" . $name, "yui3mods" => "1", "content" => $content)); $html = "<script src=\"" . PATH_RELATIVE . "external/editors/ckeditor/ckeditor.js\"></script>"; $html .= "<textarea class=\"textarea\" id=\"" . createValidId($name) . "\" name=\"{$name}\""; $html .= " rows=\"" . $this->rows . "\" cols=\"" . $this->cols . "\""; if ($this->accesskey != "") { $html .= " accesskey=\"" . $this->accesskey . "\""; } if (!empty($this->class)) { $html .= " class=\"" . $this->class . "\""; } if ($this->tabindex >= 0) { $html .= " tabindex=\"" . $this->tabindex . "\""; } $html .= ">"; $html .= htmlentities($this->default, ENT_COMPAT, LANG_CHARSET); $html .= "</textarea>"; return $html; }
function controlToHTML($name, $label) { $assets_path = SCRIPT_RELATIVE . 'framework/core/subsystems/forms/controls/assets/'; $html = "\n <div id=\"cal-container-" . $name . "\" class=\"yui-skin-sam control calendar-control\">\n <label for=\"" . $name . "\" class=\"label\">" . $label . "</label><input size=26 type=\"text\" id=\"date-" . $name . "\" name=\"date-" . $name . "\" value=\"" . $this->default_date . "\" class=\"text datebox\" /> \n @ <input size=3 type=\"text\" id=\"time-h-" . $name . "\" name=\"time-h-" . $name . "\" value=\"" . $this->default_hour . "\" class=\"timebox\" maxlength=2/>\n : <input size=3 type=\"text\" id=\"time-m-" . $name . "\" name=\"time-m-" . $name . "\" value=\"" . $this->default_min . "\" class=\"timebox\" maxlength=2/>\n <select id=\"ampm-" . $name . "\" name=\"ampm-" . $name . "\">"; if ($this->default_ampm == "AM") { $html .= "<option selected>am</option><option>pm</option>"; } else { $html .= "<option>am</option><option selected>pm</option>"; } $html .= " \n </select>\n </div>\n <div style=\"clear:both\"></div>\n "; $script = "\n YUI(EXPONENT.YUI3_CONFIG).use('node','yui2-yahoo-dom-event','yui2-button','yui2-calendar','yui2-container','yui2-dragdrop','yui2-slider', function(Y) {\n var YAHOO=Y.YUI2;\n var Event = YAHOO.util.Event,\n Dom = YAHOO.util.Dom,\n dialog,\n calendar;\n\n // time input restriction to 12 hour\n Y.one('#time-h-" . $name . "').on('keyup',function(e){\n if (e.target.get('value')>12) {\n e.target.set('value',12);\n }\n \n if (e.target.get('value')<0) {\n e.target.set('value',0);\n }\n });\n \n // time input restriction to 12 hour\n Y.one('#time-m-" . $name . "').on('keyup',function(e){\n if (e.target.get('value')>59) {\n e.target.set('value',59);\n }\n \n if (e.target.get('value')<0) {\n e.target.set('value',0);\n }\n });\n \n\n Event.on(\"date-" . $name . "\", \"click\", function() {\n \n // Lazy Dialog Creation - Wait to create the Dialog, and setup document click listeners, until the first time the button is clicked.\n if (!dialog) {\n\n // Hide Calendar if we click anywhere in the document other than the calendar\n Event.on(document, \"click\", function(e) {\n var el = Event.getTarget(e);\n var dialogEl = dialog.element;\n // if (el != dialogEl && !Dom.isAncestor(dialogEl, el) && el != showBtn && !Dom.isAncestor(showBtn, el)) {\n // dialog.hide();\n // }\n });\n\n function resetHandler() {\n // Reset the current calendar page to the select date, or \n // to today if nothing is selected.\n var selDates = calendar.getSelectedDates();\n var resetDate;\n\n if (selDates.length > 0) {\n resetDate = selDates[0];\n } else {\n resetDate = calendar.today;\n }\n\n calendar.cfg.setProperty(\"pagedate\", resetDate);\n calendar.render();\n }\n\n function closeHandler() {\n dialog.hide();\n }\n\n var dialog = new YAHOO.widget.Dialog(\"container-" . $name . "\", {\n visible:false,\n context:[\"date-" . $name . "\", \"tl\", \"bl\"],\n buttons:[ {text:\"Reset\", handler: resetHandler, isDefault:true}, {text:\"Done\", handler: closeHandler}],\n draggable:false,\n width:310,\n close:true\n });\n dialog.setHeader('Pick A Date');\n dialog.setBody('<div id=\"cal-" . $name . "\" class=\"cal\"></div>');\n dialog.render(\"cal-container-" . $name . "\");\n YAHOO.util.Dom.addClass(\"container-" . $name . "\", 'calpop');\n \n dialog.showEvent.subscribe(function() {\n if (YAHOO.env.ua.ie) {\n // Since we're hiding the table using yui-overlay-hidden, we \n // want to let the dialog know that the content size has changed, when\n // shown\n dialog.fireEvent(\"changeContent\");\n }\n });\n }\n\n // Lazy Calendar Creation - Wait to create the Calendar until the first time the button is clicked.\n if (!calendar) {\n\n var calendar = new YAHOO.widget.Calendar(\"cal-" . $name . "\", {\n iframe:false, // Turn iframe off, since container has iframe support.\n hide_blank_weeks:true // Enable, to demonstrate how we handle changing height, using changeContent\n });\n calendar.render();\n \n calendar.selectEvent.subscribe(function() {\n if (calendar.getSelectedDates().length > 0) {\n\n var selDate = calendar.getSelectedDates()[0];\n\n // Pretty Date Output, using Calendar's Locale values: Friday, 8 February 2008\n var wStr = calendar.cfg.getProperty(\"WEEKDAYS_LONG\")[selDate.getDay()];\n var dStr = selDate.getDate();\n var mStr = calendar.cfg.getProperty(\"MONTHS_LONG\")[selDate.getMonth()];\n var yStr = selDate.getFullYear();\n\n Dom.get(\"date-" . $name . "\").value = wStr + \", \" + dStr + \" \" + mStr + \" \" + yStr;\n } else {\n Dom.get(\"date-" . $name . "\").value = \"\";\n }\n //dialog.hide();\n });\n\n calendar.renderEvent.subscribe(function() {\n // Tell Dialog it's contents have changed, which allows \n // container to redraw the underlay (for IE6/Safari2)\n dialog.fireEvent(\"changeContent\");\n });\n }\n\n var seldate = calendar.getSelectedDates();\n\n if (seldate.length > 0) {\n // Set the pagedate to show the selected date if it exists\n calendar.cfg.setProperty(\"pagedate\", seldate[0]);\n calendar.render();\n }\n\n dialog.show();\n });\n });\n "; // end JS // css expCSS::pushToHead(array("unique" => "cal0", "link" => YUI2_PATH . "button/assets/skins/sam/button.css")); expCSS::pushToHead(array("unique" => "cal1", "link" => YUI2_PATH . "calendar/assets/skins/sam/calendar.css")); expCSS::pushToHead(array("unique" => "cal2", "link" => $assets_path . "calendar/calendarcontrol.css")); expJavascript::pushToFoot(array("unique" => 'calpop' . $name, "yui3mods" => 1, "content" => $script)); return $html; }
# GPL: http://www.gnu.org/licenses/gpl.txt # ################################################## if (!defined('EXPONENT')) { exit(''); } global $user, $db; $my_version = gt("Exponent Version") . " : " . EXPONENT_VERSION_MAJOR . "." . EXPONENT_VERSION_MINOR . "." . EXPONENT_VERSION_REVISION . "<br />"; if (EXPONENT_VERSION_TYPE != '') { $my_type = gt("Release level") . " : " . EXPONENT_VERSION_TYPE . EXPONENT_VERSION_ITERATION . "<br />"; } else { $my_type = ''; } $my_releasedate = gt("Release date") . " : " . date("F-d-Y", EXPONENT_VERSION_BUILDDATE); $script = "\n// YUI(EXPONENT.YUI3_CONFIG).use('node', function(Y) {\n// \n// });\n\n"; expJavascript::pushToFoot(array("unique" => 'admin1', "yui3mods" => null, "content" => $script)); if ($user->isAdmin()) { $expAdminMenu = array('text' => '<img src="' . $this->asset_path . 'images/admintoolbar/expbar.png">', 'classname' => 'site', 'submenu' => array('id' => 'admin', 'itemdata' => array(array('classname' => 'info', 'text' => gt('About ExponentCMS'), "submenu" => array('id' => 'ver', 'itemdata' => array(array('classname' => 'moreinfo', 'text' => $my_version . $my_type . $my_releasedate . "<br />" . gt("PHP Version") . " : " . phpversion(), "disabled" => true), array('text' => gt("Exponent Documentation"), 'url' => '#', 'id' => 'docs-toolbar', 'classname' => 'docs'), array('text' => gt("Discuss Exponent"), 'url' => '#', 'id' => 'forums-toolbar', 'classname' => 'forums'), array('text' => gt("Report a bug"), 'url' => '#', 'id' => 'reportabug-toolbar', 'classname' => 'reportbug'))))))); } else { $expAdminMenu = array('text' => '<img src="' . $this->asset_path . 'images/admintoolbar/expbar.png">', 'classname' => 'site', 'submenu' => array('id' => 'admin', 'itemdata' => array(array('classname' => 'info', 'text' => gt('About ExponentCMS'), "submenu" => array('id' => 'ver', 'itemdata' => array(array('classname' => 'moreinfo', 'text' => $my_version . $my_type . $my_releasedate, "disabled" => true), array('text' => gt("Exponent Documentation"), 'url' => '#', 'id' => 'docs-toolbar', 'classname' => 'docs'), array('text' => gt("Discuss Exponent"), 'url' => '#', 'id' => 'forums-toolbar', 'classname' => 'forums'))))))); } if ($user->isAdmin()) { if (SMTP_USE_PHP_MAIL) { $expAdminMenu['submenu']['itemdata'][] = array('text' => gt("Configuration"), 'classname' => 'config', 'submenu' => array('id' => 'configure', 'itemdata' => array(array('text' => gt("Configure Website"), 'url' => makeLink(array('module' => 'administration', 'action' => 'configure_site'))), array('text' => gt('Regenerate Search Index'), 'classname' => 'search', 'url' => makeLink(array('module' => 'search', 'action' => 'spider')))))); } else { $expAdminMenu['submenu']['itemdata'][] = array('text' => gt('Configuration'), 'classname' => 'config', 'submenu' => array('id' => 'configure', 'itemdata' => array(array('text' => gt("Configure Website"), 'url' => makeLink(array('module' => 'administration', 'action' => 'configure_site'))), array('text' => gt('Test SMTP Mail Server Settings'), 'url' => makeLink(array('module' => 'administration', 'action' => 'test_smtp'))), array('text' => gt('Regenerate Search Index'), 'classname' => 'search', 'url' => makeLink(array('module' => 'search', 'action' => 'spider')))))); } } $groups = $db->selectObjects('groupmembership', 'member_id=' . $user->id . ' AND is_admin=1'); if ($user->isAdmin() || !empty($groups)) { $expAdminMenu['submenu']['itemdata'][] = array('text' => gt('User Management'), 'classname' => 'users', 'submenu' => array('id' => 'usermanagement', 'itemdata' => array(array('text' => gt('User Accounts'), 'url' => makeLink(array('controller' => 'users', 'action' => 'manage')), 'classname' => 'euser'), array('text' => gt('Group Accounts'), 'url' => makeLink(array('module' => 'users', 'action' => 'manage_groups')), 'classname' => 'egroup'), array('text' => gt('Profile Definitions'), 'url' => makeLink(array('module' => 'users', 'action' => 'manage_extensions'))), array('text' => gt('User Sessions'), 'url' => makeLink(array('module' => 'users', 'action' => 'manage_sessions'))))));
function toHTML($label, $name) { $link = expCore::makeLink(array("module" => $this->controller->baseclassname, "action" => "edit", "parent" => 0)); $html = ""; if ($this->menu == "true") { if ($this->addable) { $html = '<a class="add" href="' . $link . '">Add a Category</a> | '; } $html .= '<a href="#" id="expandall">Expand All</a> | '; $html .= '<a href="#" id="collapseall">Collapse All</a>'; } $html .= ' <div id="' . $this->id . '" class="nodetree"></div> <div class="loadingdiv">Loading Categories</div>'; foreach ($this->tags as $i => $val) { if (!empty($this->values) && in_array($val->id, $this->values)) { $this->tags[$i]->value = true; } else { $this->tags[$i]->value = false; } $this->tags[$i]->draggable = $this->draggable; $this->tags[$i]->checkable = $this->checkable; } $obj = json_encode($this->tags); $script = "\n\t\tEXPONENT.YUI3_CONFIG.modules = {\n 'exp-tree' : {\n fullpath: EXPONENT.PATH_RELATIVE+'framework/core/assets/js/exp-tree.js',\n requires : ['node','yui2-container','yui2-menu','yui2-treeview','yui2-animation','yui2-dragdrop','yui2-json','yui2-connection']\n }\n }\n\n \t\t//EXPONENT.YUI3_CONFIG.filter = \".js\";\n\n YUI(EXPONENT.YUI3_CONFIG).use('node','exp-tree', function(Y) {\n \t\t\tvar obj2json = " . $obj . ";\n\t\t\t\tEXPONENT.DragDropTree.init('" . $this->id . "',obj2json,'" . $this->modelname . "','" . $this->menu . "','" . $this->expandonstart . "');\n\t\t\t\tY.one('.nodetree').next().remove();\n\t\t\t});\n\t\t"; // exponent_javascript_toFoot('expddtree', 'treeview,menu,animation,dragdrop,json,container,connection', null, $script, PATH_RELATIVE.'framework/core/assets/js/exp-tree.js'); expJavascript::pushToFoot(array("unique" => 'expddtree', "yui3mods" => 1, "content" => $script)); return $html; }