From 914cb260dc0a5271ac2c019fc147d02dc6f0f584 Mon Sep 17 00:00:00 2001 From: willcast Date: Tue, 23 Sep 2003 12:34:47 +0000 Subject: [PATCH] - Corrections in EN language. Thanks to Przemek! - Added a "All categories" link to the category drop-down box in Category view. - Better display of categorized entries (more organized). - SelectLetter, Special and All captions are now properly showed when some of the their flags are not set. - Properly use of course module visibility (in case someone directly access the URL) --- lang/en/glossary.php | 15 ++-- .../help/glossary/allowduplicatedentries.html | 8 +- lang/en/help/glossary/displayformat.html | 20 ++--- lang/en/help/glossary/index.html | 30 ++++---- lang/en/help/glossary/mainglossary.html | 10 +-- lang/en/help/glossary/mods.html | 12 +-- lang/en/help/glossary/studentcanpost.html | 8 +- lang/es/glossary.php | 4 +- mod/glossary/db/mysql.php | 2 +- mod/glossary/edit.html | 9 +-- mod/glossary/edit.php | 30 ++++---- mod/glossary/lib.php | 73 ++++++++++++++----- mod/glossary/view.php | 55 +++++++++++--- 13 files changed, 172 insertions(+), 104 deletions(-) diff --git a/lang/en/glossary.php b/lang/en/glossary.php index 10130e3da4..03f63c30f0 100644 --- a/lang/en/glossary.php +++ b/lang/en/glossary.php @@ -23,27 +23,29 @@ $string['displayformat'] = "Display format"; $string['displayformatdefault'] = "Simple, dictionary style"; $string['displayformat1'] = "Full without author."; $string['displayformat2'] = "Full with author."; +$string['editentry'] = "Edit entry"; +$string['editcategories'] = "Edit categories"; $string['entries'] = "Entries"; $string['entrieswithoutcategory'] = "Entries without category"; $string['entry'] = "Entry"; -$string['editentry'] = "Edit entry"; -$string['editcategories'] = "Edit categories"; -$string['entryalreadyexist'] = "Entry already exist."; +$string['entryalreadyexist'] = "Entry already exists."; $string['entrydeleted'] = "Entry deleted."; $string['entryexported'] = "Entry succesfully exported."; +$string['explainspecial'] = "Special will show all concepts that do not begin with a letter.
"; +$string['explainalphabet'] = "Select the letter you want to look for.

"; +$string['explainall'] = "ALL will show all entries in one page."; $string['exporttomainglossary'] = "Export to main glossary"; $string['glossarytype'] = "Glossary Type"; $string['mainglossary'] = "Main glossary"; $string['modulename'] = "Glossary"; $string['modulenameplural'] = "Glossaries"; $string['newglossaryentries'] = "New glossary entries:"; -$string['nocategorized'] = "No categorized"; +$string['nocategorized'] = "Not categorized"; $string['noentries'] = "No entries found in this section"; $string['noentry'] = "No entry found."; $string['searchconcept'] = "Search:"; $string['searchindefinition'] = "Search in concept AND definitions?"; -$string['secundaryglossary'] = "Secundary glossary"; -$string['selectletter'] = "Select the letter you want to look for.

Special will show all concepts that does not begin with a letter.
ALL will show all entries in one page."; +$string['secundaryglossary'] = "Secondary glossary"; $string['showspecial'] = "Show 'Special' link"; $string['showalphabet'] = "Show alphabet"; $string['showall'] = "Show 'ALL' link"; @@ -53,4 +55,3 @@ $string['studentcanpost'] = "Students can add entries"; $string['writtenby'] = "By"; ?> - diff --git a/lang/en/help/glossary/allowduplicatedentries.html b/lang/en/help/glossary/allowduplicatedentries.html index 5678655f88..17c411eab1 100644 --- a/lang/en/help/glossary/allowduplicatedentries.html +++ b/lang/en/help/glossary/allowduplicatedentries.html @@ -1,4 +1,4 @@ -

Allow duplicated entries

- -

You can specify if the system should or should not accept duplicated entries in the current glossary. - +

Allow duplicated entries

+ +

You can specify if the system should or should not accept duplicated entries in the current glossary. + diff --git a/lang/en/help/glossary/displayformat.html b/lang/en/help/glossary/displayformat.html index 6497b4ec48..115d74e26b 100644 --- a/lang/en/help/glossary/displayformat.html +++ b/lang/en/help/glossary/displayformat.html @@ -1,10 +1,10 @@ -

Display format

- -

The system has three builed-in formats to display entries. You can create your own format if you want. -

The default view, is quite simple. It looks like a conventional dictionary. -

The second view, shows the entry in a forum-like format, without the author's data. -

And the third one, shows the entry also in a forum-like format but with the author's data. -


-

If you want to create your own format, you should create a .PHP file and give it a number as its name. See into mod/glossary/formats which should be the next number. -

Then, create a funcion called glossary_print_entry_by_format($course, $cm, $glossary, $entry) and dump all your creativity. -

The last stemp is to insert a new entry in every language lack you use called displayformat[number], and give it a meaninful description. \ No newline at end of file +

Display format

+ +

The system has three built-in formats to display entries. You can create your own format if you want. +

The default view is quite simple. It looks like a conventional dictionary. +

The second view shows the entry in a forum-like format, without the author's data. +

And the third one shows the entry also in a forum-like format but with the author's data. +


+

If you want to create your own format, you should create a .PHP file and give it a number as its name. See into mod/glossary/formats which should be the next number. +

Then, create a funcion called glossary_print_entry_by_format($course, $cm, $glossary, $entry) and dump all your creativity. +

The last stemp is to insert a new entry in every language pack you use called displayformat[number], and give it a meaningful description. diff --git a/lang/en/help/glossary/index.html b/lang/en/help/glossary/index.html index 4c4897ea9e..35e613b8d1 100644 --- a/lang/en/help/glossary/index.html +++ b/lang/en/help/glossary/index.html @@ -1,15 +1,15 @@ -

Glossary

- - - +

Glossary

+ + + diff --git a/lang/en/help/glossary/mainglossary.html b/lang/en/help/glossary/mainglossary.html index 9f8dc7121c..3bd1afcce3 100644 --- a/lang/en/help/glossary/mainglossary.html +++ b/lang/en/help/glossary/mainglossary.html @@ -1,5 +1,5 @@ -

Defining the main glossary of the course

- -

The system allows to export entries from any secondary glossary to the main one of the course. -

In order to do this, you should specify which glossary is the main one. -

Note: You can have only one glossary by course. \ No newline at end of file +

Defining the main glossary of the course

+ +

The system allows to export entries from any secondary glossary to the main one of the course. +

In order to do this, you should specify which glossary is the main one. +

Note: You can have only one main glossary per course. diff --git a/lang/en/help/glossary/mods.html b/lang/en/help/glossary/mods.html index 8c187953dd..a0d0da044c 100644 --- a/lang/en/help/glossary/mods.html +++ b/lang/en/help/glossary/mods.html @@ -1,6 +1,6 @@ -

 Glossary

- +

 Glossary

+ \ No newline at end of file diff --git a/lang/en/help/glossary/studentcanpost.html b/lang/en/help/glossary/studentcanpost.html index 9d9aa51f77..6d7af75445 100644 --- a/lang/en/help/glossary/studentcanpost.html +++ b/lang/en/help/glossary/studentcanpost.html @@ -1,4 +1,4 @@ -

Students can post entries

- -

You can specify if an user can or cannot add, edit or delete his/her own entries in this glossary. -

Note: A teacher could edit or delete any entry at any time. \ No newline at end of file +

Students can post entries

+ +

You can specify whether a user can or cannot add, edit or delete his/her own entries in this glossary. +

Note: A teacher can edit or delete any entry at any time. \ No newline at end of file diff --git a/lang/es/glossary.php b/lang/es/glossary.php index 81ca2d6b1d..4ef422fb56 100644 --- a/lang/es/glossary.php +++ b/lang/es/glossary.php @@ -31,6 +31,9 @@ $string['entry'] = "Entrada"; $string['entryalreadyexist'] = "Esta entrada ya existe."; $string['entrydeleted'] = "Entrada borrada."; $string['entryexported'] = "Entrada exportada con éxito."; +$string['explainspecial'] = "Especial mostrará todos los conceptos que comiencen con símbolos.
"; +$string['explainalphabet'] = "Seleccione la letra que desea buscar.

"; +$string['explainall'] = "TODAS mostrará todas las entradas en una página."; $string['exporttomainglossary'] = "Exportar todo el glosario"; $string['glossarytype'] = "Tipo de glosario"; $string['mainglossary'] = "Glosario principal"; @@ -43,7 +46,6 @@ $string['noentry'] = "No se econtr $string['searchconcept'] = "Buscar:"; $string['searchindefinition'] = "¿Buscar en conceptos Y definiciones?"; $string['secundaryglossary'] = "Glosario secundario"; -$string['selectletter'] = "Seleccione la letra que desea buscar.

Especial mostrará todos los conceptos que comiencen con símbolos.
TODAS mostrará todas las entradas en una página."; $string['showspecial'] = "Mostrar enlace 'Especial'"; $string['showalphabet'] = "Mostrar alfabeto"; $string['showall'] = "Mostrar enlace 'TODAS'"; diff --git a/mod/glossary/db/mysql.php b/mod/glossary/db/mysql.php index fdf5f753ee..10e386dbd4 100644 --- a/mod/glossary/db/mysql.php +++ b/mod/glossary/db/mysql.php @@ -57,7 +57,7 @@ function glossary_upgrade($oldversion) { if ( $oldversion < 2003092102 ) { execute_sql("ALTER TABLE `{$CFG->prefix}glossary_entries_categories` DROP PRIMARY KEY "); - execute_sql("ALTER TABLE `{$CFG->prefix}glossary_entries_categories` ADD `ID` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST"); + execute_sql("ALTER TABLE `{$CFG->prefix}glossary_entries_categories` ADD `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST"); } return true; diff --git a/mod/glossary/edit.html b/mod/glossary/edit.html index a96c03f9f5..5482caf73c 100644 --- a/mod/glossary/edit.html +++ b/mod/glossary/edit.html @@ -15,13 +15,8 @@ id); - echo ""; + echo "

$strselectletter"; + if ($glossary->showalphabet) { + $output .= get_string("explainalphabet","glossary"); + } + if ($glossary->showspecial) { + $output .= get_string("explainspecial","glossary"); + } + if ($glossary->showall) { + $output .= get_string("explainall","glossary"); + } + + echo "
$output

"; if ( $glossary->showspecial ) { if ( $l == "SPECIAL" ) { - echo "

$strspecial | "; + echo "$strspecial | "; } else { - echo "

wwwroot/mod/glossary/view.php?id=$cm->id&l=SPECIAL\">$strspecial | "; + echo "wwwroot/mod/glossary/view.php?id=$cm->id&l=SPECIAL\">$strspecial | "; } } @@ -645,7 +670,7 @@ global $CFG, $THEME; } } } -function glossary_print_categories_menu($course, $cm, $glossary, $category) { +function glossary_print_categories_menu($course, $cm, $glossary, $cat, $category) { global $CFG, $THEME; echo ""; echo ""; @@ -663,11 +688,19 @@ global $CFG, $THEME; if ( $category ) { echo $category->name; } else { - echo get_string("entrieswithoutcategory","glossary"); + if ( $cat < 0 ) { + echo get_string("entrieswithoutcategory","glossary"); + $selected = "-1"; + } elseif ( $cat == 0 ) { + echo get_string("allcategories","glossary"); + $selected = "0"; + } } echo ""; echo ""; diff --git a/mod/glossary/view.php b/mod/glossary/view.php index b3c31c138a..2ab900ec3b 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -28,7 +28,7 @@ } require_login($course->id); - if ( !$course->visible ) { + if (!$cm->visible and !isteacher($course->id)) { notice(get_string("activityiscurrentlyhidden")); } @@ -57,11 +57,11 @@ $l = ""; $currentview = strtolower($currentview); if ( $currentview ) { - if ( $cat ) { + if ( $cat > 0 ) { $category = get_record("glossary_categories","id",$cat); - } - if ( !$category ) { - $cat = ""; + if ( !$category ) { + $cat = ""; + } } } } @@ -97,7 +97,7 @@
"; - $menu[0] = get_string("nocategorized","glossary"); + $menu["0"] = get_string("allcategories","glossary"); + $menu["-1"] = get_string("nocategorized","glossary"); +// $menu[""] = "-----------------------------------------"; $categories = get_records("glossary_categories", "glossaryid", $glossary->id, "name ASC"); if ( $categories ) { @@ -680,7 +713,7 @@ global $CFG, $THEME; } } - echo popup_form("$CFG->wwwroot/mod/glossary/view.php?id=$cm->id¤tview=categories&cat=", $menu, "catmenu", $selected, get_string("jumpto"), + echo popup_form("$CFG->wwwroot/mod/glossary/view.php?id=$cm->id¤tview=categories&cat=", $menu, "catmenu", $selected, "", "", "", false); echo " "; - if (isteacher($course->id) or $glossary->studentcanpost) { + if (isteacher($course->id) or ($glossary->studentcanpost) and !isguest($course->id)) { $options = array ("id" => "$cm->id"); print_single_button("edit.php", $options, $straddentry ); } @@ -119,7 +119,8 @@ print_tabbed_table_start($data, $CurrentTab, $tCFG); echo "
"; if ( $currentview ) { - glossary_print_categories_menu($course, $cm, $glossary, $category); + glossary_print_categories_menu($course, $cm, $glossary, $cat, $category); + $currentcategory = ""; } else { glossary_print_alphabet_menu($cm, $glossary, $l); @@ -137,7 +138,17 @@ $allentries = glossary_search_entries($searchterms, $glossary, $includedefinition); } elseif ( $eid ) { // looking for an entry $allentries = get_records("glossary_entries", "id", $eid); - } else { // looking for terms that begin with a specify letter + } elseif ( $currentview and $cat == 0 ) { // Browsing all categories + $sql = "SELECT gec.id gecid, gc.name, gc.id CID, ge.* + FROM {$CFG->prefix}glossary_entries ge, + {$CFG->prefix}glossary_entries_categories gec, + {$CFG->prefix}glossary_categories gc + WHERE ge.glossaryid = '$glossary->id' AND + gec.entryid = ge.id AND + gc.id = gec.categoryid + ORDER BY gc.name, ge.concept"; + $allentries = get_records_sql( $sql ); + } else { // looking for terms that begin with a specify letter or entries with no category associated $allentries = get_records("glossary_entries", "glossaryid", $glossary->id,"concept ASC"); } @@ -179,9 +190,31 @@ $DumpToScreen = 1; } } else { - if ( ! record_exists("glossary_entries_categories","entryid",$entry->id) ) { - $DumpToScreen = 1; - } + if ( $cat < 0 ) { // No categorized + if ( ! record_exists("glossary_entries_categories","entryid",$entry->id) ) { + $DumpToScreen = 1; + } + } else { // All categories + if ( $currentcategory != $entry->CID ) { + $currentcategory = $entry->CID; + if ( $glossary->displayformat == 0 ) { + if ( $DumpedDefinitions > 0) { + echo "

"; + } + echo "\n

cellheading2\">"; + } + echo "$entry->name"; + } + + if ( $glossary->displayformat == 0 ) { + echo "\n
"; + if ( $DumpedDefinitions > 0) { + echo "\n
"; + } + } + + $DumpToScreen = 1; + } } } else { $DumpToScreen = 1; -- 2.39.5