From 83891eda00513240669f070b6120d7982e535b52 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 9 Dec 2003 04:00:33 +0000 Subject: [PATCH] New defaults for popup window settings, which is window off, but all sub-settings on. These default defaults can be defined on the page Admin -> Config -> Modules -> Resource -> Settings --- mod/resource/config.html | 31 +++++++++++++++++++++++++++++++ mod/resource/details.php | 40 +++++++++------------------------------- mod/resource/lib.php | 17 +++++++++++++++++ 3 files changed, 57 insertions(+), 31 deletions(-) diff --git a/mod/resource/config.html b/mod/resource/config.html index 815a724ee4..b9234d508e 100644 --- a/mod/resource/config.html +++ b/mod/resource/config.html @@ -42,6 +42,37 @@ + +

resource_popup: + + resource_popup, ""); + ?> + + + + + +"; + echo "

$defaultvalue:"; + echo ""; + if ($optionname == "height" or $optionname == "width") { + echo "$defaultvalue."\">"; + } else { + choose_from_menu ($choices, $defaultvalue, $CFG->$defaultvalue, ""); + } + echo ""; + echo ""; + print_string("configpopup$optionname", "resource"); + echo ""; + echo ""; + } +?> "> diff --git a/mod/resource/details.php b/mod/resource/details.php index e0b88cf1fc..6be3670200 100644 --- a/mod/resource/details.php +++ b/mod/resource/details.php @@ -113,20 +113,15 @@ 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); @@ -142,13 +137,7 @@ } } } 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; @@ -173,7 +162,7 @@   -

+

@@ -233,20 +222,15 @@ 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); @@ -262,13 +246,7 @@ } } } 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; diff --git a/mod/resource/lib.php b/mod/resource/lib.php index b12a2ded0b..e4129d0494 100644 --- a/mod/resource/lib.php +++ b/mod/resource/lib.php @@ -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 -- 2.39.5