From f79fface79cfeba1af1097487eec0eb8d03ec427 Mon Sep 17 00:00:00 2001
From: moodler <moodler>
Date: Fri, 27 Aug 2004 09:50:11 +0000
Subject: [PATCH] Merged changes from STABLE to add new collapsible sections to
 mod edit forms

---
 mod/resource/type/file/file.html |  3 +-
 mod/resource/type/html/html.html | 54 ++++++++++++++++++++++++++------
 mod/resource/type/text/text.html | 53 ++++++++++++++++++++++++++-----
 3 files changed, 91 insertions(+), 19 deletions(-)

diff --git a/mod/resource/type/file/file.html b/mod/resource/type/file/file.html
index b33a7f2b91..3fc635cc20 100644
--- a/mod/resource/type/file/file.html
+++ b/mod/resource/type/file/file.html
@@ -108,8 +108,9 @@
 
 </table>
 
-</td></tr>
+    </div>
 
+</td></tr>
 
 <tr>
     <td align="right"><p><b><?php print_string("parameters", "resource") ?>:</b></p></td>
diff --git a/mod/resource/type/html/html.html b/mod/resource/type/html/html.html
index fb06350310..2d82c12ac3 100644
--- a/mod/resource/type/html/html.html
+++ b/mod/resource/type/html/html.html
@@ -1,3 +1,19 @@
+<script language="javascript">
+    function showhide (id) {
+        divobj = document.getElementById(id);
+        butobj = document.getElementById(id+'button');
+        if (divobj.style.display != 'none') {
+            divobj.style.display = 'none';
+            butobj.value = '<?php print_string("showsettings") ?>';
+        } else {
+            divobj.style.display = 'block';
+            butobj.value = '<?php print_string("hidesettings") ?>';
+        }
+    }
+</script>
+
+
+
 <tr valign="top">
     <td align="right" nowrap>
         <p><b><?php print_string("fulltext", "resource") ?>:</b></p><br />
@@ -14,31 +30,38 @@
 
 <tr><td colspan="2"><hr /></td></tr>
 
-<tr valign="top">
-    <td align="right" nowrap>
-        <p><b><?php print_string("pagewindow", "resource") ?>:</b></p>
+<tr>
+    <td align="right"><p><b><?php print_string("display", "resource") ?>:</b></p></td>
+    <td>
+        <input type="button" value="hide settings" id="windowsettingsbutton" onClick="javascript: return showhide('windowsettings');" />
     </td>
+</tr>
+<tr><td colspan="2">
 
-    <td>
+    <div id="windowsettings">
+
+<table align="center">
+
+
+<tr valign="top">
+
+    <td colspan="2">
         <script>
             var popupitems = [<?php echo $popupoptions; ?>];
             var allitems = [<?php echo $alloptions; ?>];
         </script>
         <input type="radio" name="windowpopup" value=0 <?php echo ($windowtype != "popup") ? "checked" : "" ?> 
         onClick="return lockoptions('form', 'windowpopup[1]', popupitems);">
-        <?php print_string("pagedisplay", "resource") ?>
+        <b title="<?php print_string("pagedisplay", "resource") ?>"><?php print_string("pagewindow", "resource") ?></b>
     </td>
 </tr>
 
 <tr valign="top">
-    <td align="right" nowrap>
-        <p><b><?php p($strnewwindow) ?>:</b></p>
-    </td>
     
-    <td>
+    <td colspan="2">
         <input name="windowpopup" type=radio value=1 <?php echo ($windowtype == "popup") ? "checked" : "" ?>
         onclick=" return lockoptions('form', 'windowpopup[1]', popupitems);">
-        <?php p($strnewwindowopen) ?>
+        <b title="<?php p($strnewwindowopen) ?>"><?php p($strnewwindow) ?></b>
         <ul>
         <?php
             foreach ($window as $name => $value) {
@@ -70,3 +93,14 @@
     </td>
 </tr>
 
+</table>
+
+    </div>
+
+</td></tr>
+
+
+<script language="javascript">
+    showhide('windowsettings');
+</script>
+
diff --git a/mod/resource/type/text/text.html b/mod/resource/type/text/text.html
index 9384fbd084..c8fc4b4581 100644
--- a/mod/resource/type/text/text.html
+++ b/mod/resource/type/text/text.html
@@ -1,3 +1,19 @@
+<script language="javascript">
+    function showhide (id) {
+        divobj = document.getElementById(id);
+        butobj = document.getElementById(id+'button');
+        if (divobj.style.display != 'none') {
+            divobj.style.display = 'none';
+            butobj.value = '<?php print_string("showsettings") ?>';
+        } else {
+            divobj.style.display = 'block';
+            butobj.value = '<?php print_string("hidesettings") ?>';
+        }
+    }
+</script>
+
+
+
 <tr valign="top">
     <td align="right" nowrap>
         <p><b><?php print_string("fulltext", "resource") ?>:</b></p><br />
@@ -24,30 +40,40 @@
 
 <tr><td colspan="2"><hr /></td></tr>
 
-<tr valign="top">
-    <td align="right" nowrap>
-        <p><b><?php print_string("pagewindow", "resource") ?>:</b></p>
-    </td>
 
+<tr>
+    <td align="right"><p><b><?php print_string("display", "resource") ?>:</b></p></td>
     <td>
+        <input type="button" value="hide settings" id="windowsettingsbutton" onClick="javascript: return showhide('windowsettings');" />
+    </td>
+</tr>   
+<tr><td colspan="2">
+
+    <div id="windowsettings">
+        
+<table align="center">
+        
+
+<tr valign="top">
+
+    <td colspan="2">
         <script>
             var popupitems = [<?php echo $popupoptions; ?>];
             var allitems = [<?php echo $alloptions; ?>];
         </script>
         <input type="radio" name="windowpopup" value=0 <?php echo ($windowtype != "popup") ? "checked" : "" ?> 
         onClick="return lockoptions('form', 'windowpopup[1]', popupitems);">
+        <b title="<?php print_string("pagedisplay", "resource") ?>"><?php print_string("pagewindow", "resource") ?></b>
         <?php print_string("pagedisplay", "resource") ?>
     </td>
 </tr>
 
 <tr valign="top">
-    <td align="right" nowrap>
-        <p><b><?php p($strnewwindow) ?>:</b></p>
-    </td>
     
-    <td>
+    <td colspan="2">
         <input name="windowpopup" type=radio value=1 <?php echo ($windowtype == "popup") ? "checked" : "" ?>
         onclick=" return lockoptions('form', 'windowpopup[1]', popupitems);">
+        <b title="<?php p($strnewwindowopen) ?>"><?php p($strnewwindow) ?></b>
         <?php p($strnewwindowopen) ?>
         <ul>
         <?php
@@ -80,3 +106,14 @@
     </td>
 </tr>
 
+</table>
+
+    </div>
+
+</td></tr>
+
+
+<script language="javascript">
+    showhide('windowsettings');
+</script>
+
-- 
2.39.5