]> git.mjollnir.org Git - moodle.git/commitdiff
Some fixes to move Javascript files to PHP script, so that we can
authormoodler <moodler>
Thu, 21 Sep 2006 17:17:00 +0000 (17:17 +0000)
committermoodler <moodler>
Thu, 21 Sep 2006 17:17:00 +0000 (17:17 +0000)
tweak the contents better.

This was supposed to fix MDL-6544 but it didn't work.  Checking it in
because it will help a fix later.

lib/ajax/ajaxlib.php
lib/ajax/block_classes.php [moved from lib/ajax/block_classes.js with 96% similarity]
lib/ajax/section_classes.php [moved from lib/ajax/section-resource_classes.js with 97% similarity]

index 8387dcb31ef0b645f22fdfb7ca722df839e8d144..bf00499c92b89ccd05e4df62f0408f0d607ba372 100644 (file)
@@ -20,8 +20,8 @@
         "yui_dragdrop" => "/lib/yui/dragdrop/dragdrop.js",
         "yui_logger" => "/lib/yui/logger/logger.js",
         "yui_connection" => "/lib/yui/connection/connection.js",        
-        "ajaxcourse_blocks" => "/lib/ajax/block_classes.js",
-        "ajaxcourse_sections" => "/lib/ajax/section-resource_classes.js",
+        "ajaxcourse_blocks" => "/lib/ajax/block_classes.php",
+        "ajaxcourse_sections" => "/lib/ajax/section_classes.php",
         "ajaxcourse_topic" => "/course/format/topics/ajaxcourse-topics.js",
         "ajaxcourse_week" => "/course/format/weeks/ajaxcourse-weeks.js"           
         );
similarity index 96%
rename from lib/ajax/block_classes.js
rename to lib/ajax/block_classes.php
index f413dd68ea6456fdac15f6f7b56dcfb71d1b22a5..9e041df1b44b87241de7f557ec3fdeaf170ad14b 100644 (file)
@@ -1,3 +1,19 @@
+<?php // $Id$
+
+/// Javascript file run through PHP so we can control it better
+
+    $nomoodlecookie = true;
+
+    require_once('../../config.php');
+
+    $lifetime = '86400';
+
+    @header('Content-type: text/javascript'); 
+    @header('Last-Modified: '. gmdate('D, d M Y H:i:s', time()) .' GMT');
+    @header('Cache-control: max-age='.$lifetime);
+    @header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .'GMT');
+    @header('Pragma: ');
+?>
 /*
  * library for ajaxcourse formats, the classes and related functions for drag and drop blocks
  * 
@@ -350,4 +366,4 @@ column_class.prototype.remove_block = function(el){
     }
     
     
-    
\ No newline at end of file
+    
similarity index 97%
rename from lib/ajax/section-resource_classes.js
rename to lib/ajax/section_classes.php
index edbb1bb2cb91ae43553609047db5fab195b33fa4..ff7327ad3be599ee7303f0c241824cfec116a1bf 100755 (executable)
@@ -1,3 +1,19 @@
+<?php // $Id$
+
+/// Javascript file run through PHP so we can control it better
+
+    $nomoodlecookie = true;
+
+    include('../../config.php');
+
+    $lifetime = '86400';
+
+    @header('Content-type: text/javascript'); 
+    @header('Last-Modified: '. gmdate('D, d M Y H:i:s', time()) .' GMT');
+    @header('Cache-control: max-age='.$lifetime);
+    @header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .'GMT');
+    @header('Pragma: ');
+?>
 /*
  * library for ajaxcourse formats, the classes and related functions for sections and resources
  * this library requires a 'main' object created in calling document 
@@ -482,9 +498,11 @@ resource_class.prototype.init_buttons = function(){
        //find edit button
        var updateButton = null;
        var buttons =  commandContainer.getElementsByTagName('a');
-       for(var x=0;x<buttons.length;x++)
-            if(buttons[x].title == 'Update')
+       for (var x=0;x<buttons.length;x++) {
+            if (buttons[x].title == '<?php print_string('update'); ?>') {
                 updateButton = buttons[x];
+            }
+       }
                      
        if(updateButton == null)
         YAHOO.log('Cannot find updateButton for '+this.getEl().id,'error');                     
@@ -671,4 +689,4 @@ activity_class.prototype.toggle_group = function(){
         
         main.connect('post','class=resource&field=groupmode',null,'value='+this.currentGroup+'&id='+this.id);
     }    
-   
\ No newline at end of file
+