- The admin can define default values for glossary and entries' settings via the admin modules interface.

This commit is contained in:
willcast
2003-11-02 01:48:44 +00:00
parent 4f4ca7b5e1
commit cb2f5705ec
6 changed files with 232 additions and 27 deletions
+8
View 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";
+1 -1
View 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?
+188
View File
@@ -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>
+17 -4
View 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>
-6
View 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.
+18 -16
View 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.
global $CFG;
if (!isset($form->studentcanpost)) {
$form->studentcanpost = $CFG->students_can_post_entries;
}
if (!isset($form->allowduplicatedentries)) {
$form->allowduplicatedentries = $CFG->allow_duplicated_entries;
}
if (!isset($form->allowcomments)) {
$form->allowcomments = 1;
$form->allowcomments = $CFG->allow_comments;
}
if (!isset($form->usedynalink)) {
$form->usedynalink = $CFG->automatically_link_glossaries;
}
if (!isset($form->defaultapproval)) {
$form->defaultapproval = $CFG->default_approval_status;
}
if (!isset($form->mainglossary)) {
$form->mainglossary = 0;
}
if (!isset($form->allowduplicatedentries)) {
$form->allowduplicatedentries = 0;
}
if (!isset($form->defaultapproval)) {
$form->defaultapproval = 1;
}
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>