MDL-20534 lti: A9. Fixing issues with the course tool popup not disappearing.
authorChris Scribner <scriby@gmail.com>
Fri, 11 Nov 2011 18:31:09 +0000 (13:31 -0500)
committerChris Scribner <scriby@gmail.com>
Fri, 11 Nov 2011 18:31:09 +0000 (13:31 -0500)
mod/lti/instructor_edit_tool_type.php
mod/lti/mod_form.js

index ad4a88d..36c56b5 100644 (file)
@@ -46,8 +46,6 @@ if (!empty($typeid)) {
     }
 }
 
-echo $OUTPUT->header();
-
 $data = data_submitted();
 
 if (isset($data->submitbutton) && confirm_sesskey()) {
@@ -64,10 +62,12 @@ if (isset($data->submitbutton) && confirm_sesskey()) {
 
         //Output script to update the calling window.
         $script = "
-            <script type=\"text/javascript\">
-                window.opener.M.mod_lti.editor.updateToolType({$json});
-                window.close();
-            </script>
+            <html>
+                <script type=\"text/javascript\">
+                    window.opener.M.mod_lti.editor.updateToolType({$json});
+                    window.close();
+                </script>
+            </html>
         ";
 
         echo $script;
@@ -83,10 +83,12 @@ if (isset($data->submitbutton) && confirm_sesskey()) {
 
         //Output script to update the calling window.
         $script = "
-            <script type=\"text/javascript\">
-                window.opener.M.mod_lti.editor.addToolType({$json});
-                window.close();
-            </script>
+            <html>
+                <script type=\"text/javascript\">
+                    window.opener.M.mod_lti.editor.addToolType({$json});
+                    window.close();
+                </script>
+            </html>
         ";
 
         echo $script;
@@ -95,9 +97,11 @@ if (isset($data->submitbutton) && confirm_sesskey()) {
     }
 } else if (isset($data->cancel)) {
     $script = "
-        <script type=\"text/javascript\">
-            window.close();
-        </script>
+        <html>
+            <script type=\"text/javascript\">
+                window.close();
+            </script>
+        </html>
     ";
 
     echo $script;
@@ -110,6 +114,8 @@ if ($action == 'delete') {
     die;
 }
 
+echo $OUTPUT->header();
+
 echo $OUTPUT->heading(get_string('toolsetup', 'lti'));
 
 if ($action == 'add') {
index d9c94f3..46b8718 100644 (file)
             }
 
             var selectedToolType = typeSelector.get('value');
-            var selectedOption = typeSelector.one('option[value=' + selectedToolType + ']');
+            var selectedOption = typeSelector.one('option[value="' + selectedToolType + '"]');
 
-            //A specific tool type is selected (not "auto")"
+            //A specific tool type is selected (not "auto")
             if(selectedToolType > 0){
                 //If the entered domain matches the domain of the tool configuration...
                 var domainRegex = /(?:https?:\/\/)?(?:www\.)?([^\/]+)(?:\/|$)/i;
         getSelectedToolTypeOption: function(){
             var typeSelector = Y.one('#id_typeid');
 
-            return typeSelector.one('option[value=' + typeSelector.get('value') + ']');
+            return typeSelector.one('option[value="' + typeSelector.get('value') + '"]');
         },
 
         /**
 
             //Adding the new tool may affect which tool gets matched automatically
             this.clearToolCache();
-            this.updateAutomaticToolMatch();
+            this.updateAutomaticToolMatch(Y.one('#id_toolurl'));
+            this.updateAutomaticToolMatch(Y.one('#id_securetoolurl'));
         },
 
         updateToolType: function(toolType){
             var typeSelector = Y.one('#id_typeid');
 
-            var option = typeSelector.one('option[value=' + toolType.id + ']');
+            var option = typeSelector.one('option[value="' + toolType.id + '"]');
             option.set('text', toolType.name)
                   .set('domain', toolType.tooldomain);
 
             //Editing the tool may affect which tool gets matched automatically
             this.clearToolCache();
-            this.updateAutomaticToolMatch();
+            this.updateAutomaticToolMatch(Y.one('#id_toolurl'));
+            this.updateAutomaticToolMatch(Y.one('#id_securetoolurl'));
         },
 
         deleteTool: function(toolTypeId){
 
                         //Editing the tool may affect which tool gets matched automatically
                         self.clearToolCache();
-                        self.updateAutomaticToolMatch();
+                        self.updateAutomaticToolMatch(Y.one('#id_toolurl'));
+                        self.updateAutomaticToolMatch(Y.one('#id_securetoolurl'));
                     },
                     failure: function(){