[Jaws-commits] r13495 - in branches/0.8/html/include/Jaws: . Ajax

afz at jaws-project.com afz at jaws-project.com
Sat Aug 25 16:51:17 UTC 2012


Author: afz
Date: 2012-08-25 16:51:17 +0000 (Sat, 25 Aug 2012)
New Revision: 13495

Modified:
   branches/0.8/html/include/Jaws/Ajax/Ajax.js
   branches/0.8/html/include/Jaws/GadgetHTML.php
   branches/0.8/html/include/Jaws/Layout.php
Log:
Autoload js files needed for ajax methods

Modified: branches/0.8/html/include/Jaws/Ajax/Ajax.js
===================================================================
--- branches/0.8/html/include/Jaws/Ajax/Ajax.js	2012-08-25 14:38:16 UTC (rev 13494)
+++ branches/0.8/html/include/Jaws/Ajax/Ajax.js	2012-08-25 16:51:17 UTC (rev 13495)
@@ -1,4 +1,13 @@
 /**
+ * Shortcut function for using instead of getElementById
+ */
+if(typeof $ != 'function') {
+    function $(name, doc) {
+      return document.getElementById(name);
+    }
+}
+
+/**
  * Shortcut function for using instead of getElementsByName
  */
 function $N(name, doc) {

Modified: branches/0.8/html/include/Jaws/GadgetHTML.php
===================================================================
--- branches/0.8/html/include/Jaws/GadgetHTML.php	2012-08-25 14:38:16 UTC (rev 13494)
+++ branches/0.8/html/include/Jaws/GadgetHTML.php	2012-08-25 16:51:17 UTC (rev 13495)
@@ -236,9 +236,10 @@
     {
         $this->_usingAjax = true;
         $name = $this->GetName();
+        $GLOBALS['app']->Layout->AddScriptLink('include/Jaws/Ajax/Ajax.js');
         $GLOBALS['app']->Layout->AddScriptLink(BASE_SCRIPT.'?gadget='.
                                                $name.
-                                               '&action=Ajax&client&json');
+                                               '&action=Ajax&client&json');
 
         if (!empty($file) && file_exists(JAWS_PATH . 'gadgets/' . $name . '/resources/' . $file)) {
             $GLOBALS['app']->Layout->AddScriptLink('gadgets/' . $name . '/resources/' . $file);

Modified: branches/0.8/html/include/Jaws/Layout.php
===================================================================
--- branches/0.8/html/include/Jaws/Layout.php	2012-08-25 14:38:16 UTC (rev 13494)
+++ branches/0.8/html/include/Jaws/Layout.php	2012-08-25 16:51:17 UTC (rev 13495)
@@ -175,21 +175,11 @@
     }
 
     /**
-     */
-    function AddJSPrototypeHeadLink()
-    {
-        // Prototype, Scriptaculous and Response
-        $this->AddScriptLink('libraries/prototype/prototype.js');
-        $this->AddScriptLink('libraries/prototype/scriptaculous.js');
-        $this->AddScriptLink('include/Jaws/Ajax/Ajax.js');
-    }
-
-    /**
      * Loads the template
      *
      * @access  public
      */
-    function Load($ajaxEnabled = false)
+    function Load()
     {
         if ($GLOBALS['app']->Registry->Get('/config/site_status') == 'disabled' &&
             !$GLOBALS['app']->Session->IsSuperAdmin())
@@ -220,10 +210,6 @@
             }
         }
 
-        if ($ajaxEnabled || $GLOBALS['app']->Registry->Get('/config/frontend_ajaxed') == 'true') {
-            $this->AddJSPrototypeHeadLink();
-        }
-
         $this->_Template = new Jaws_Template();
         $this->_Template->Load('layout.html');
         $this->_Template->SetBlock('layout');
@@ -275,9 +261,10 @@
      */
     function LoadControlPanelHead()
     {
+        $this->AddScriptLink('libraries/prototype/prototype.js');
+        $this->AddScriptLink('libraries/prototype/scriptaculous.js');
         $this->AddHeadLink('gadgets/ControlPanel/resources/public.css', 'stylesheet', 'text/css');
         $this->AddHeadLink(PIWI_URL . 'piwidata/css/default.css', 'stylesheet', 'text/css');
-        $this->AddJSPrototypeHeadLink();
 
         $favicon = $GLOBALS['app']->Registry->Get('/config/site_favicon');
         if (!empty($favicon)) {



More information about the Jaws-commits mailing list