]> git.mjollnir.org Git - moodle.git/commitdiff
- The admin can define default values for glossary and entries' settings via the...
authorwillcast <willcast>
Sun, 2 Nov 2003 01:48:44 +0000 (01:48 +0000)
committerwillcast <willcast>
Sun, 2 Nov 2003 01:48:44 +0000 (01:48 +0000)
lang/en/glossary.php
mod/glossary/TODO.txt
mod/glossary/config.html [new file with mode: 0644]
mod/glossary/edit.html
mod/glossary/edit.php
mod/glossary/mod.html

index 3f3b9ebc39a22713c090f112363b86d903bca85f..8c7dd3763d847219dd7641f16185070e3bf27f12 100644 (file)
@@ -25,6 +25,14 @@ $string['commentdeleted'] = "The comment has been deleted.";
 $string['commentupdated'] = "The comment has been updated.";
 $string['comments'] = "Comments";
 $string['commentson'] = "Comments on";
+$string['configstudents_can_post_entries'] = "Define if the students can or cannot post entries by default";
+$string['configallow_duplicated_entries'] = "Define if a glossary will allows duplicated entries by default";
+$string['configallow_comments'] = "Define if a glossary will accept comments on entries by default";
+$string['configautomatically_link_glossaries'] = "Define if a glossary should be automatically linked by default";
+$string['configdefault_approval_status'] = "Define the approval status by default of an entry posted by a student";
+$string['configautomatically_link_entry'] = "Define if an entry should be automatically linked by default";
+$string['configcase_sensitive'] = "Define if an entry, when linked, is case sensitive by default";
+$string['configmatch_whole_words'] = "Define if an entry, when linked, should match the case in the target text by default";
 $string['concept'] = "Concept";
 $string['concepts'] = "Concepts";
 $string['dateview'] = "Browse by date";
index 321d027b137ed5d2afc377d35fe37e52abcc58a2..bcff97cd7355b5134d6eca4d80611fc81cc2b079 100644 (file)
@@ -7,7 +7,7 @@ Things that are in the inkpot yet:
         * New glossary o just append entries to the current one?
         * With or withot categories?
 - Add Alias to concepts in order to use dynalinks on them.
-- Allow to set default values for glossaries and entries settings
+- Allow to set default values for glossaries and entries settings (done)
 - Allow grading of entries
     * Evaluation
     * Self-evaluation?
diff --git a/mod/glossary/config.html b/mod/glossary/config.html
new file mode 100644 (file)
index 0000000..7140996
--- /dev/null
@@ -0,0 +1,188 @@
+<?php 
+    $yes = get_string("yes");
+    $no  = get_string("no");
+?>
+<form method="post" action="module.php" name="form">
+
+<table cellpadding=9 cellspacing=0 >
+<tr valign=top>
+    <td colspan = 3 align=center><strong>Glossary Level Default Settings</strong></td>
+</tr>
+<tr valign=top>
+    <td align=right><p>students_can_post_entries:</td>
+    <td>
+    <SELECT size=1 name=students_can_post_entries>
+<?php 
+    $yselected = "";
+    $nselected = "";
+    if ($CFG->students_can_post_entries) {
+        $yselected = " SELECTED ";
+    } else {
+        $nselected = " SELECTED ";
+    }
+?>
+    <OPTION value=1 <?php p($yselected) ?>><?php p($yes)?></OPTION>
+    <OPTION value=0 <?php p($nselected) ?>><?php p($no)?></OPTION>
+    </SELECT>
+    </td>
+    <td>
+    <?php print_string("configstudents_can_post_entries", "glossary") ?>
+    </td>
+</tr>
+<tr valign=top>
+    <td align=right><p>allow_duplicated_entries:</td>
+    <td>
+    <SELECT size=1 name=allow_duplicated_entries>
+<?php 
+    $yselected = "";
+    $nselected = "";
+    if ($CFG->allow_duplicated_entries) {
+        $yselected = " SELECTED ";
+    } else {
+        $nselected = " SELECTED ";
+    }
+?>
+    <OPTION value=1 <?php p($yselected) ?>><?php p($yes)?></OPTION>
+    <OPTION value=0 <?php p($nselected) ?>><?php p($no)?></OPTION>
+    </SELECT>
+    </td>
+    <td>
+    <?php print_string("configallow_duplicated_entries", "glossary") ?>
+    </td>
+</tr>
+<tr valign=top>
+    <td align=right><p>allow_comments:</td>
+    <td>
+    <SELECT size=1 name=allow_comments>
+<?php 
+    $yselected = "";
+    $nselected = "";
+    if ($CFG->allow_comments) {
+        $yselected = " SELECTED ";
+    } else {
+        $nselected = " SELECTED ";
+    }
+?>
+    <OPTION value=1 <?php p($yselected) ?>><?php p($yes)?></OPTION>
+    <OPTION value=0 <?php p($nselected) ?>><?php p($no)?></OPTION>
+    </SELECT>
+    </td>
+    <td>
+    <?php print_string("configallow_comments", "glossary") ?>
+    </td>
+</tr>
+<tr valign=top>
+    <td align=right><p>automatically_link_glossaries:</td>
+    <td>
+    <SELECT size=1 name=automatically_link_glossaries>
+<?php 
+    $yselected = "";
+    $nselected = "";
+    if ($CFG->automatically_link_glossaries) {
+        $yselected = " SELECTED ";
+    } else {
+        $nselected = " SELECTED ";
+    }
+?>
+    <OPTION value=1 <?php p($yselected) ?>><?php p($yes)?></OPTION>
+    <OPTION value=0 <?php p($nselected) ?>><?php p($no)?></OPTION>
+    </SELECT>
+    </td>
+    <td>
+    <?php print_string("configautomatically_link_glossaries", "glossary") ?>
+    </td>
+</tr>
+<tr valign=top>
+    <td align=right><p>default_approval_status:</td>
+    <td>
+    <SELECT size=1 name=default_approval_status>
+<?php 
+    $yselected = "";
+    $nselected = "";
+    if ($CFG->default_approval_status) {
+        $yselected = " SELECTED ";
+    } else {
+        $nselected = " SELECTED ";
+    }
+?>
+    <OPTION value=1 <?php p($yselected) ?>><?php p($yes)?></OPTION>
+    <OPTION value=0 <?php p($nselected) ?>><?php p($no)?></OPTION>
+    </SELECT>
+    </td>
+    <td>
+    <?php print_string("configdefault_approval_status", "glossary") ?>
+    </td>
+</tr>
+<tr valign=top>
+    <td colspan = 3 align=center><strong>Entry Level Default Settings</strong></td>
+</tr>
+<tr valign=top>
+    <td align=right><p>automatically_link_entry:</td>
+    <td>
+    <SELECT size=1 name=automatically_link_entry>
+<?php 
+    $yselected = "";
+    $nselected = "";
+    if ($CFG->automatically_link_entry) {
+        $yselected = " SELECTED ";
+    } else {
+        $nselected = " SELECTED ";
+    }
+?>
+    <OPTION value=1 <?php p($yselected) ?>><?php p($yes)?></OPTION>
+    <OPTION value=0 <?php p($nselected) ?>><?php p($no)?></OPTION>
+    </SELECT>
+    </td>
+    <td>
+    <?php print_string("configautomatically_link_entry", "glossary") ?>
+    </td>
+</tr>
+<tr valign=top>
+    <td align=right><p>case_sensitive:</td>
+    <td>
+    <SELECT size=1 name=case_sensitive>
+<?php 
+    $yselected = "";
+    $nselected = "";
+    if ($CFG->case_sensitive) {
+        $yselected = " SELECTED ";
+    } else {
+        $nselected = " SELECTED ";
+    }
+?>
+    <OPTION value=1 <?php p($yselected) ?>><?php p($yes)?></OPTION>
+    <OPTION value=0 <?php p($nselected) ?>><?php p($no)?></OPTION>
+    </SELECT>
+    </td>
+    <td>
+    <?php print_string("configcase_sensitive", "glossary") ?>
+    </td>
+</tr>
+<tr valign=top>
+    <td align=right><p>match_whole_words:</td>
+    <td>
+    <SELECT size=1 name=match_whole_words>
+<?php 
+    $yselected = "";
+    $nselected = "";
+    if ($CFG->match_whole_words) {
+        $yselected = " SELECTED ";
+    } else {
+        $nselected = " SELECTED ";
+    }
+?>
+    <OPTION value=1 <?php p($yselected) ?>><?php p($yes)?></OPTION>
+    <OPTION value=0 <?php p($nselected) ?>><?php p($no)?></OPTION>
+    </SELECT>
+    </td>
+    <td>
+    <?php print_string("configmatch_whole_words", "glossary") ?>
+    </td>
+</tr>
+<tr>
+    <td colspan=3 align=center>
+    <input type="submit" value="<?php print_string("savechanges") ?>"></td>
+</tr>
+</table>
+
+</form>
index 86f381042b6b25f3b1fcd6ffaa18577e92c3d157..dfcbd44518dff2d9fc43c8277f39676d7b474eea 100644 (file)
@@ -1,3 +1,6 @@
+<?PHP
+    global $CFG;
+?>
 <center>
 <form name="form" method="post" <?=$onsubmit ?> action="edit.php" enctype="multipart/form-data">
 <table  class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
@@ -52,6 +55,8 @@ if (isset($errors)) {
         if ($newentry->usedynalink) {
             $selected = "checked";
         }
+    } elseif ( $CFG->automatically_link_entry ) {
+        $selected = "checked";
     }
 ?> 
     <input type="checkbox" name="usedynalink" value=1 <?php p($selected) ?> onclick="return lockoptions('form','usedynalink', items)"> <?php helpbutton("usedynalink", get_string("usedynalink", "glossary"), "glossary") ?>
@@ -61,19 +66,23 @@ if (isset($errors)) {
     <td align=right><p><b><?php echo get_string("casesensitive","glossary") ?>:</b></p></td>
     <td>
     <select size="1" name="casesensitive">
-     <option value="1" <?php
+     <option value=1 <?php
       if ( isset($newentry->casesensitive) ) {
           if ( $newentry->casesensitive ) {
              echo "selected";
           }
+      } elseif ( $CFG->case_sensitive ) {
+          echo "selected";
       }
       ?> 
       ><?php echo get_string("yes") ?></option>
-     <option value="0" <?php
+     <option value=0 <?php
       if ( isset($newentry->casesensitive) ) {
           if ( !$newentry->casesensitive ) {
              echo "selected";
           }
+      } elseif ( !$CFG->case_sensitive ) {
+          echo "selected";
       }
       ?>><?php echo get_string("no") ?>
      </option>
@@ -84,19 +93,23 @@ if (isset($errors)) {
     <td align=right><p><b><?php echo get_string("fullmatch","glossary") ?>:</b></p></td>
     <td>
     <select size="1" name="fullmatch">
-     <option value="1" <?php
+     <option value=1 <?php
       if ( isset($newentry->fullmatch) ) {
           if ( $newentry->fullmatch ) {
              echo "selected";
           }
+      } elseif ( $CFG->match_whole_words ) {
+          echo "selected";
       }
       ?> 
       ><?php echo get_string("yes") ?></option>
-     <option value="0" <?php
+     <option value=0 <?php
       if ( isset($newentry->fullmatch) ) {
           if ( !$newentry->fullmatch ) {
              echo "selected";
           }
+      } elseif ( !$CFG->match_whole_words ) {
+          echo "selected";
       }
       ?>><?php echo get_string("no") ?>
      </option>
index 059c8c8df6305e8be1b1bb62df15c067ae2ba249..e3c1cb61dabc91025cd4e5ae6f228f2b147daa98 100644 (file)
@@ -166,12 +166,6 @@ if ( $confirm ) {
         $newentry->usedynalink = $form->usedynalink;
         $newentry->casesensitive = $form->casesensitive;
         $newentry->fullmatch = $form->fullmatch;
-    } else {
-        $newentry->concept = "";
-        $newentry->definition = "";
-        $newentry->usedynalink = 1;
-        $newentry->casesensitive = 0;
-        $newentry->fullmatch = 1;
     }
 }
 /// Otherwise fill and print the form.
index f60b5f325093ef50d681cc3673eae76f751d0bb7..fa297ee88800e816764f1e3f7ff3b3436e2ebe9a 100644 (file)
@@ -2,21 +2,32 @@
 <!-- It is used from /course/mod.php.  The whole instance is available as $form. -->
 <?PHP
 /// stablishing hard-coded default parameters... Will be replaced soon by global settings.
-if (!isset($form->allowcomments)) {
-    $form->allowcomments = 1;
-}
-if (!isset($form->mainglossary)) {
-    $form->mainglossary = 0;
+global $CFG;
+
+if (!isset($form->studentcanpost)) {
+    $form->studentcanpost = $CFG->students_can_post_entries;
 }
 if (!isset($form->allowduplicatedentries)) {
-    $form->allowduplicatedentries = 0;
+    $form->allowduplicatedentries = $CFG->allow_duplicated_entries;
+}
+if (!isset($form->allowcomments)) {
+    $form->allowcomments = $CFG->allow_comments;
+}
+if (!isset($form->usedynalink)) {
+    $form->usedynalink = $CFG->automatically_link_glossaries;
 }
 if (!isset($form->defaultapproval)) {
-    $form->defaultapproval = 1;
+    $form->defaultapproval = $CFG->default_approval_status;
+}
+if (!isset($form->mainglossary)) {
+    $form->mainglossary = 0;
 }
 if (!isset($form->displayformat)) {
     $form->displayformat = 0;
 }
+if ( !isset($form->globalglossary) ) {
+    $form->globalglossary = 0;
+}
 if (!isset($form->intro)) {
     $form->intro = "";
 }
@@ -32,15 +43,6 @@ if (!isset($form->showalphabet)) {
 if (!isset($form->showspecial)) {
     $form->showspecial = 1;
 }
-if (!isset($form->studentcanpost)) {
-    $form->studentcanpost = 0;
-}
-if (!isset($form->usedynalink)) {
-    $form->usedynalink = 1;
-}
-if ( !isset($form->globalglossary) ) {
-    $form->globalglossary = 0;
-}
 ?>
 <FORM name="form" method="post" action="<?=$ME ?>">
 <CENTER>