[ Index ]

PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12)

title

Body

[close]

/include/inc_front/lib/ -> js.mootools-1.4.default.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2012 Oliver Georgi <oliver@phpwcms.de> // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  
  24  /**
  25   * Initialize Slimbox CSS and JavaScript for MooTools 1.3+
  26   */
  27  function initSlimbox() {
  28      initJSLib();
  29      $GLOBALS['block']['custom_htmlhead']['lightbox.css'] = '  <link href="'.TEMPLATE_PATH.'lib/slimbox/slimbox.css" rel="stylesheet" type="text/css" media="screen" />';
  30      $GLOBALS['block']['custom_htmlhead']['slimbox.js'] = getJavaScriptSourceLink(TEMPLATE_PATH.'lib/slimbox/slimbox.mootools-1.3.js');
  31  }
  32  
  33  /**
  34   * Initialize Frontend Edit DomReady JavaScript
  35   */
  36  function init_frontend_edit_js() {
  37      
  38      initJSLib();
  39      $GLOBALS['block']['js_ondomready'][] = '        var felink_status = 0;
  40          $$("a.fe-link").each(function(r) { r.setStyle("display", "none"); });
  41          $("fe-link").addEvent("click", function() {
  42              if(felink_status == 1) {
  43                  $$("a.fe-link").each(function(r) { r.setStyle("display", "none"); });
  44                  $("fe-link").removeClass("enabled"); $("fe-link").addClass("disabled");    felink_status = 0;
  45              } else {
  46                  $$("a.fe-link").each(function(r) { r.setStyle("display", ""); });
  47                  $("fe-link").removeClass("disabled"); $("fe-link").addClass("enabled");    felink_status = 1;
  48              }
  49          });';
  50      
  51  }
  52  
  53  /**
  54   * Create JavaScript Domready Section
  55   */
  56  function jsOnDomReady($js='', $return=false, $prefix='  ') {
  57      
  58      if($js) {
  59          
  60          initJSLib();
  61          
  62          $_js  = $prefix . '<script type="text/javascript">'.LF.SCRIPT_CDATA_START.LF;
  63          $_js .= '    window.addEvent("domready", function() {' . LF. $js . LF . '    });';
  64          $_js .= LF.SCRIPT_CDATA_END.LF.$prefix.'</script>';
  65          
  66          if($return) {
  67              return $_js;
  68          }
  69          
  70          $GLOBALS['block']['custom_htmlhead'][md5($js)] = $_js;
  71      }
  72  }
  73  
  74  /**
  75   * Create JavaScript UnLoad Section
  76   */
  77  function jsOnUnLoad($js='', $return=false, $prefix='  ') {
  78      
  79      if($js) {
  80          
  81          initJSLib();
  82          
  83          $_js  = $prefix . '<script type="text/javascript">'.LF.SCRIPT_CDATA_START.LF;
  84          $_js .= '    window.addEvent("unload", function() {' . LF . $js . LF . '    });';
  85          $_js .= LF.SCRIPT_CDATA_END.LF.$prefix.'</script>';
  86          
  87          if($return) {
  88              return $_js;
  89          }
  90          
  91          $GLOBALS['block']['custom_htmlhead'][md5($js)] = $_js;
  92      }
  93  }
  94  
  95  
  96  /**
  97   * Simple MooTools Plugin Loader
  98   */
  99  function initJSPlugin($plugin='', $more=false) {
 100      // enhance teplate JS parser for MooTools More
 101      // sample: <!-- JS: MORE:Fx/Fx.Elements,Fx/Fx.Accordion -->
 102      if(is_string($plugin) && $more === false && substr(strtoupper($plugin), 0, 5) == 'MORE:') {
 103          $plugin    = trim(substr($plugin, 5));
 104          $more    = true;
 105      }
 106      if($more === false) {
 107          $plugin = 'mootools.'.$plugin.'.js';
 108          if(empty($GLOBALS['block']['custom_htmlhead'][$plugin])) {
 109              initJSLib();
 110              $GLOBALS['block']['custom_htmlhead'][$plugin] = getJavaScriptSourceLink(TEMPLATE_PATH.'lib/mootools/plugin-1.4/'.$plugin);
 111          }
 112      } else {
 113          // Load MooTools More Plugins - simple Wrapper 'Fx/Fx.Slide,Fx/Fx.Scroll...'
 114          // it does not check dependents
 115          if(!is_array($plugin)) {
 116              $plugin = convertStringToArray($plugin);
 117          }
 118          if(count($plugin)) {
 119              initJSLib();
 120              // add mootools more core
 121              array_unshift($plugin, 'More/More');
 122              foreach($plugin as $more) {
 123                  if(empty($GLOBALS['block']['custom_htmlhead'][$more]) && is_file(PHPWCMS_TEMPLATE.'lib/mootools/more-1.4/'.$more.'.js')) {
 124                      $GLOBALS['block']['custom_htmlhead'][$more] = getJavaScriptSourceLink(TEMPLATE_PATH.'lib/mootools/more-1.4/'.$more.'.js');
 125                  }
 126              }
 127          }
 128      }    
 129      return TRUE;
 130  }
 131  
 132  ?>


Generated: Sun Jan 29 16:31:14 2012 Cross-referenced by PHPXref 0.7.1