[ Index ]

PHP Cross Reference of phpwcms V1.4.7 _r403 (01.11.10)

title

Body

[close]

/include/inc_front/lib/ -> js.mootools-1.1.inc.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2010 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  define('PHPWCMS_JSLIB', 'mootools-1.1');
  24  
  25  /**
  26   * Init Mootools 1.1.x Library
  27   */
  28  function initJSLib() {
  29      if(empty($GLOBALS['block']['custom_htmlhead']['mootools.js'])) {
  30          if(!USE_GOOGLE_AJAX_LIB) {
  31              $GLOBALS['block']['custom_htmlhead']['mootools.js'] = getJavaScriptSourceLink(TEMPLATE_PATH.'lib/mootools/mootools-1.1-yc.js');
  32          } else {
  33              $GLOBALS['block']['custom_htmlhead']['mootools.js'] = getJavaScriptSourceLink(USE_GOOGLE_AJAX_LIB.'mootools/1.1/mootools-yui-compressed.js');
  34          }
  35      }
  36      return TRUE;
  37  }
  38  
  39  /**
  40   * Initialize Slimbox CSS and JavaScript for MooTools 1.1
  41   */
  42  function initSlimbox() {
  43      initJSLib();
  44      $GLOBALS['block']['custom_htmlhead']['lightbox.css'] = '  <link href="'.TEMPLATE_PATH.'lib/slimbox/slimbox.css" rel="stylesheet" type="text/css" media="screen" />';
  45      $GLOBALS['block']['custom_htmlhead']['slimbox.js'] = getJavaScriptSourceLink(TEMPLATE_PATH.'lib/slimbox/slimbox.mootools-1.1.js');
  46  }
  47  
  48  /**
  49   * Initialize Frontend Edit DomReady JavaScript
  50   */
  51  function init_frontend_edit_js() {
  52      
  53      initJSLib();
  54      $GLOBALS['block']['js_ondomready'][] = '        var felink_status = 0;
  55          $$("a.fe-link").each(function(r) { r.setStyle("display", "none"); });
  56          $("fe-link").addEvent("click", function() {
  57              if(felink_status == 1) {
  58                  $$("a.fe-link").each(function(r) { r.setStyle("display", "none"); });
  59                  $("fe-link").removeClass("enabled"); $("fe-link").addClass("disabled");    felink_status = 0;
  60              } else {
  61                  $$("a.fe-link").each(function(r) { r.setStyle("display", ""); });
  62                  $("fe-link").removeClass("disabled"); $("fe-link").addClass("enabled");    felink_status = 1;
  63              }
  64          });';
  65      
  66  }
  67  
  68  /**
  69   * Create JavaScript Domready Section
  70   */
  71  function jsOnDomReady($js='', $return=false, $prefix='  ') {
  72      
  73      if($js) {
  74          
  75          initJSLib();
  76          
  77          $_js  = $prefix . '<script type="text/javascript">'.LF.SCRIPT_CDATA_START.LF;
  78          $_js .= '    window.addEvent("domready", function() {' . LF . $js . LF . '    });';
  79          $_js .= LF.SCRIPT_CDATA_END.LF.$prefix.'</script>';
  80          
  81          if($return) {
  82              return $_js;
  83          }
  84          
  85          $GLOBALS['block']['custom_htmlhead'][] = $_js;
  86      }
  87  }
  88  
  89  /**
  90   * Create JavaScript UnLoad Section
  91   */
  92  function jsOnUnLoad($js='', $return=false, $prefix='  ') {
  93      
  94      if($js) {
  95          
  96          initJSLib();
  97          
  98          $_js  = $prefix . '<script type="text/javascript">'.LF.SCRIPT_CDATA_START.LF;
  99          $_js .= '    window.addEvent("unload", function() {' . LF . $js . LF . '    });';
 100          $_js .= LF.SCRIPT_CDATA_END.LF.$prefix.'</script>';
 101          
 102          if($return) {
 103              return $_js;
 104          }
 105          
 106          $GLOBALS['block']['custom_htmlhead'][] = $_js;
 107      }
 108  }
 109  
 110  /**
 111   * Simple MooTools Plugin Loader
 112   */
 113  function initJSPlugin($plugin='') {
 114      $plugin = 'mootools.'.$plugin.'.js';
 115      if(empty($GLOBALS['block']['custom_htmlhead'][$plugin])) {
 116          initJSLib();
 117          $GLOBALS['block']['custom_htmlhead'][$plugin] = getJavaScriptSourceLink(TEMPLATE_PATH.'lib/mootools/plugin-1.1/'.$plugin);
 118      }
 119      return TRUE;
 120  }
 121  
 122  ?>


Generated: Tue Nov 16 22:51:00 2010 Cross-referenced by PHPXref 0.7