]> git.mjollnir.org Git - moodle.git/commitdiff
When searching for resources, use button instead of link.
authormoodler <moodler>
Sun, 15 Feb 2004 08:04:33 +0000 (08:04 +0000)
committermoodler <moodler>
Sun, 15 Feb 2004 08:04:33 +0000 (08:04 +0000)
lib/weblib.php
mod/resource/details.php

index 0f6645eac1a0406729543c35c9f25e33b45c0297..00190692661c391f53ccc7630d58a5264e894b91 100644 (file)
@@ -295,6 +295,25 @@ function link_to_popup_window ($url, $name="popup", $linkname="click here",
 }
 
 
+function button_to_popup_window ($url, $name="popup", $linkname="click here", 
+                                 $height=400, $width=500, $title="Popup window", $options="none") {
+/// This will create a HTML link that will work on both 
+/// Javascript and non-javascript browsers.
+/// Relies on the Javascript function openpopup in javascript.php
+/// $url must be relative to home page  eg /mod/survey/stuff.php
+
+    global $CFG;
+
+    if ($options == "none") {
+        $options = "menubar=0,location=0,scrollbars,resizable,width=$width,height=$height";
+    }
+    $fullscreen = 0;
+
+    echo "<input type=\"button\" name=\"popupwindow\" title=\"$title\" value=\"$linkname ...\" ".
+         "onClick=\"return openpopup('$url', '$name', '$options', $fullscreen);\">\n";
+}
+
+
 function close_window_button() {
 /// Prints a simple button to close a window
 
index a67694472b0881decc1730dff53347af4d53979b..108e2bce6995f50f2893c7cb2c8e1bbbfa557be7 100644 (file)
                     <td>
                         <input name="reference" size="80" value="<?php  p($form->reference) ?>">
                         <?php 
-                          echo "<font size=\"-1\">";
-                          echo "<a target=\"websearch\" href=\"$CFG->resource_websearch\" ".
-                                "onClick=\"return window.open('$CFG->resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');\">$strsearch</a>\n";
-                          echo "</font>";
+                          echo "<input type=button name=searchbutton value=\"$strsearch ...\" ".
+                                "onClick=\"return window.open('$CFG->resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');\">\n";
                         ?>
                     </td>
                 </tr>
                     <td>
                         <input name="reference" size="80" value="<?php p($form->reference) ?>">
                         <?php 
-                          echo "<font size=\"-1\">";
-                          echo "<a target=\"websearch\" href=\"$CFG->resource_websearch\" ".
-                                "onClick=\"return window.open('$CFG->resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');\">$strsearch</a>\n";
-                          echo "</font>";
+                          echo "<input type=button name=searchbutton value=\"$strsearch ...\" ".
+                                "onClick=\"return window.open('$CFG->resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');\">\n";
                         ?>
                     </td>
                 </tr>
                     <td>
                         <?php
                           echo "<input name=\"reference\" size=\"50\" value=\"$form->reference\">&nbsp;";
-                          echo "<font size=\"-1\">";
-                          link_to_popup_window ("/mod/resource/coursefiles.php?id=$course->id", 
-                                                "coursefiles", $strchooseafile, 500, 750, $strchooseafile);
-                          echo "</font>";
+                          button_to_popup_window ("/mod/resource/coursefiles.php?id=$course->id", 
+                                                  "coursefiles", $strchooseafile, 500, 750, $strchooseafile);
                         ?>
                     </td>
                 </tr>