]> git.mjollnir.org Git - moodle.git/commitdiff
New defaults for popup window settings, which is window off, but all
authormoodler <moodler>
Tue, 9 Dec 2003 04:00:33 +0000 (04:00 +0000)
committermoodler <moodler>
Tue, 9 Dec 2003 04:00:33 +0000 (04:00 +0000)
sub-settings on.

These default defaults can be defined on the page

  Admin -> Config -> Modules -> Resource -> Settings

mod/resource/config.html
mod/resource/details.php
mod/resource/lib.php

index 815a724ee401691f0d7ffc81a832f25d431f497d..b9234d508e1070833a17faadee5d52dadfc0e6ca 100644 (file)
     <?php print_string("configfilterexternalpages", "resource") ?>
     </td>
 </tr>
+<tr valign=top>
+       <td align=right><p>resource_popup:</td>
+       <td>
+    <?php
+        unset($choices);
+        $choices[""] = get_string("no");
+        $choices["checked"] = get_string("yes");
+        choose_from_menu ($choices, "resource_popup", $CFG->resource_popup, "");
+    ?>
+    </td>
+    <td>
+    <?php print_string("configpopup", "resource") ?>
+    </td>
+</tr>
+<?php foreach ($RESOURCE_WINDOW_OPTIONS as $optionname) {
+          $defaultvalue = "resource_popup$optionname";
+          echo "<tr valign=top>";
+             echo "<td align=right><p>$defaultvalue:</td>";
+             echo "<td>";
+          if ($optionname == "height" or $optionname == "width") {
+              echo "<input name=$defaultvalue type=text size=5 value=\"".$CFG->$defaultvalue."\">";
+          } else {
+              choose_from_menu ($choices, $defaultvalue, $CFG->$defaultvalue, "");
+          }
+          echo "</td>";
+          echo "<td>";
+          print_string("configpopup$optionname", "resource");
+          echo "</td>";
+          echo "</tr>";
+      }
+?>
 <tr>
     <td colspan=3 align=center>
        <input type="submit" value="<?php print_string("savechanges") ?>"></td>
index e0b88cf1fc287c6b33f4b6b2dc572f0c67a273bc..6be3670200d0303671032bba08b6b979e4cf803a 100644 (file)
                 foreach ($RESOURCE_WINDOW_OPTIONS as $optionname) {
                     $stringname = "str$optionname";
                     $$stringname = get_string("new$optionname", "resource");
-                    $window->$optionname = "";
+                    $defaultvalue = "resource_popup$optionname";
+                    $window->$optionname = $CFG->$defaultvalue;
                     $jsoption[] = "\"$optionname\"";
                 }
                 $alljsoptions = implode(",", $jsoption);
 
                 if ($form->instance) {     // Re-editing
                     if (!$form->alltext) {
-                        $newwindow = "";
-                        $window->resizable = "checked";  // Defaults
-                        $window->scrollbars = "checked";
-                        $window->status = "checked";
-                        $window->location = "checked";
-                        $window->width = 620;
-                        $window->height = 450;
+                        $newwindow = "";   // Disable the new window
                     } else {
                         $newwindow = "checked";
                         $rawoptions = explode(',', $form->alltext); 
                         }
                     }
                 } else {
-                    $newwindow = "checked";
-                    $window->resizable = "checked";
-                    $window->scrollbars = "checked";
-                    $window->status = "checked";
-                    $window->location = "checked";
-                    $window->width = 620;
-                    $window->height = 450;
+                    $newwindow = $CFG->resource_popup;
                 }
 
                 echo $alloptions;
                     <td align="right" nowrap>&nbsp;
                     </td>
                     <td>
-                        <p><?php echo "($strexample) $strexampleurl" ?></p>
+                        <p><font size="-1"><?php echo "($strexample) $strexampleurl" ?></font></p>
                     </td>
                 </tr>
                 <tr valign="top">
                 foreach ($RESOURCE_WINDOW_OPTIONS as $optionname) {
                     $stringname = "str$optionname";
                     $$stringname = get_string("new$optionname", "resource");
-                    $window->$optionname = "";
+                    $defaultvalue = "resource_popup$optionname";
+                    $window->$optionname = $CFG->$defaultvalue;
                     $jsoption[] = "\"$optionname\"";
                 }
                 $alljsoptions = implode(",", $jsoption);
 
                 if ($form->instance) {     // Re-editing
                     if (!$form->alltext) {
-                        $newwindow = "";
-                        $window->resizable = "checked";  // Defaults
-                        $window->scrollbars = "checked";
-                        $window->status = "checked";
-                        $window->location = "checked";
-                        $window->width = 620;
-                        $window->height = 450;
+                        $newwindow = "";   // Disable the new window
                     } else {
                         $newwindow = "checked";
                         $rawoptions = explode(',', $form->alltext); 
                         }
                     }
                 } else {
-                    $newwindow = "checked";
-                    $window->resizable = "checked";
-                    $window->scrollbars = "checked";
-                    $window->status = "checked";
-                    $window->location = "checked";
-                    $window->width = 620;
-                    $window->height = 450;
+                    $newwindow = $CFG->resource_popup;
                 }
 
                 echo $alloptions;
index b12a2ded0bf82d0139cf883b7f6a036eb5fef157..e4129d0494e14700b4d30660a72ae5f6256542cc 100644 (file)
@@ -37,6 +37,23 @@ if (!isset($CFG->resource_filterexternalpages)) {
 $RESOURCE_WINDOW_OPTIONS = array("resizable", "scrollbars", "directories", "location", 
                                  "menubar", "toolbar", "status", "height", "width");
 
+if (!isset($CFG->resource_popup)) {
+    set_config("resource_popup", "");
+}  
+
+foreach ($RESOURCE_WINDOW_OPTIONS as $popupoption) {
+    $popupoption = "resource_popup$popupoption";
+    if (!isset($CFG->$popupoption)) {
+        if ($popupoption == "resource_popupheight") {
+            set_config($popupoption, 450);
+        } else if ($popupoption == "resource_popupwidth") {
+            set_config($popupoption, 620);
+        } else {
+            set_config($popupoption, "checked");
+        }
+    }  
+}
+
 function resource_add_instance($resource) {
 // Given an object containing all the necessary data, 
 // (defined by the form in mod.html) this function