]> git.mjollnir.org Git - moodle.git/commitdiff
Another setting to allow a default URL in webpage and weblink
authormoodler <moodler>
Wed, 26 Nov 2003 11:47:51 +0000 (11:47 +0000)
committermoodler <moodler>
Wed, 26 Nov 2003 11:47:51 +0000 (11:47 +0000)
lang/en/resource.php
mod/resource/config.html
mod/resource/details.php
mod/resource/lib.php

index e60806377494b0b7581ce4a1a27d11bb0a574508..a41815c8c11aa8937d8feccdb99a51175d747436 100644 (file)
@@ -4,6 +4,7 @@
 
 $string['addresource'] = 'Add resource';
 $string['chooseafile'] = 'Choose or upload a file';
+$string['configdefaulturl'] = 'This value is used to prefill the URL form when creating a new URL-based resource.';
 $string['configframesize'] = 'When a web page or an uploaded file is displayed within a frame, this value is the size (in pixels) of the top frame (which contains the navigation).';
 $string['configwebsearch'] = 'When adding a URL as a webpage or weblink, this location is offered as a site to help the user search for the URL they want.';
 $string['editingaresource'] = 'Editing a resource';
index a9f865d8d85bc85b9704431d4374776dce6b7d7a..41b9234e7d0379f696bc8e65d5ad41db052fc3db 100644 (file)
     <?php print_string("configwebsearch", "resource") ?>
     </td>
 </tr>
+<tr valign=top>
+       <td align=right><p>resource_defaulturl:</td>
+       <td>
+    <input name=resource_defaulturl type=text size=30 value="<?php p($CFG->resource_defaulturl) ?>">
+    </td>
+    <td>
+    <?php print_string("configdefaulturl", "resource") ?>
+    </td>
+</tr>
 <tr>
     <td colspan=3 align=center>
        <input type="submit" value="<?php print_string("savechanges") ?>"></td>
index 9d3e94fe7d435a88753ec443ea26d507755b6e4e..e0b88cf1fc287c6b33f4b6b2dc572f0c67a273bc 100644 (file)
@@ -70,6 +70,9 @@
             case WEBPAGE:
                 $strexampleurl = get_string("exampleurl", "resource");
                 $strsearch     = get_string("search");
+                if (empty($form->reference)) {
+                    $form->reference = $CFG->resource_defaulturl;
+                }
                 ?>
                 <tr valign="top">
                     <td align="right" nowrap>
                 $strnewwindowopen = get_string("newwindowopen", "resource");
                 $strsearch        = get_string("search");
 
+                if (empty($form->reference)) {
+                    $form->reference = $CFG->resource_defaulturl;
+                }
+
                 foreach ($RESOURCE_WINDOW_OPTIONS as $optionname) {
                     $stringname = "str$optionname";
                     $$stringname = get_string("new$optionname", "resource");
index 328e8b90102d4f842ac22842b662de7d2c8758bd..85b7345d79b08ca69ea7a136b5bc262b7cde7525 100644 (file)
@@ -26,6 +26,10 @@ if (!isset($CFG->resource_websearch)) {
     set_config("resource_websearch", "http://google.com/");
 } 
 
+if (!isset($CFG->resource_defaulturl)) {
+    set_config("resource_defaulturl", "http://");
+} 
+
 $RESOURCE_WINDOW_OPTIONS = array("resizable", "scrollbars", "directories", "location", 
                                  "menubar", "toolbar", "status", "height", "width");