MDL-36830 usability: Glossary and database small design improvements
authorFrederic Massart <fred@moodle.com>
Mon, 26 Nov 2012 06:02:44 +0000 (14:02 +0800)
committerFrederic Massart <fred@moodle.com>
Fri, 30 Nov 2012 08:48:46 +0000 (16:48 +0800)
mod/data/lib.php
mod/glossary/lib.php
mod/glossary/pix/export.png [new file with mode: 0644]
mod/glossary/pix/export.svg [new file with mode: 0644]
mod/glossary/styles.css
pix/t/approve.png [new file with mode: 0644]
pix/t/approve.svg [new file with mode: 0644]
theme/upgrade.txt

index 2d120ca..b26d77d 100644 (file)
@@ -1251,8 +1251,12 @@ function data_print_template($template, $records, $data, $search='', $page=0, $r
         $replacement [] = userdate($record->timemodified);
 
         $patterns[]='##approve##';
-        if (has_capability('mod/data:approve', $context) && ($data->approval) && (!$record->approved)){
-            $replacement[] = '<span class="approve"><a href="'.$CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&amp;approve='.$record->id.'&amp;sesskey='.sesskey().'"><img src="'.$OUTPUT->pix_url('i/approve') . '" class="iconsmall" alt="'.get_string('approve').'" /></a></span>';
+        if (has_capability('mod/data:approve', $context) && ($data->approval) && (!$record->approved)) {
+            $approveurl = new moodle_url('/mod/data/view.php',
+                    array('d' => $data->id, 'approve' => $record->id, 'sesskey' => sesskey()));
+            $approveicon = new pix_icon('t/approve', get_string('approve'), '', array('class' => 'iconsmall'));
+            $replacement[] = html_writer::tag('span', $OUTPUT->action_icon($approveurl, $approveicon),
+                    array('class' => 'approve'));
         } else {
             $replacement[] = '';
         }
index dd0518c..7fa2109 100644 (file)
@@ -1234,7 +1234,8 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h
 
     if (!$entry->approved) {
         $output = true;
-        $return .= get_string('entryishidden','glossary');
+        $return .= html_writer::tag('span', get_string('entryishidden','glossary'),
+            array('class' => 'glossary-hidden-note'));
     }
 
     $iscurrentuser = ($entry->userid == $USER->id);
@@ -1245,7 +1246,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h
             $mainglossary = $DB->get_record('glossary', array('mainglossary'=>1,'course'=>$course->id));
             if ( $mainglossary ) {  // if there is a main glossary defined, allow to export the current entry
                 $output = true;
-                $return .= ' <a class="action-icon" title="'.get_string('exporttomainglossary','glossary') . '" href="exportentry.php?id='.$entry->id.'&amp;prevmode='.$mode.'&amp;hook='.urlencode($hook).'"><img src="'.$OUTPUT->pix_url('export', 'glossary').'" class="smallicon" alt="'.get_string('exporttomainglossary','glossary').$altsuffix.'" /></a>';
+                $return .= '<a class="action-icon" title="'.get_string('exporttomainglossary','glossary') . '" href="exportentry.php?id='.$entry->id.'&amp;prevmode='.$mode.'&amp;hook='.urlencode($hook).'"><img src="'.$OUTPUT->pix_url('export', 'glossary').'" class="smallicon" alt="'.get_string('exporttomainglossary','glossary').$altsuffix.'" /></a>';
             }
         }
 
@@ -1292,8 +1293,6 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h
 
         $return .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
     }
-    $return .= "&nbsp;&nbsp;"; // just to make up a little the output in Mozilla ;)
-
     $return .= '</span>';
 
     if (!empty($CFG->usecomments) && has_capability('mod/glossary:comment', $context) and $glossary->allowcomments) {
@@ -1394,7 +1393,11 @@ function  glossary_print_entry_approval($cm, $entry, $mode, $align="right", $ins
         if ($insidetable) {
             echo '<table class="glossaryapproval" align="'.$align.'"><tr><td align="'.$align.'">';
         }
-        echo '<a title="'.get_string('approve','glossary').'" href="approve.php?eid='.$entry->id.'&amp;mode='.$mode.'&amp;sesskey='.sesskey().'"><img align="'.$align.'" src="'.$OUTPUT->pix_url('i/approve') . '" style="border:0px; width:34px; height:34px" alt="'.get_string('approve','glossary').'" /></a>';
+        echo $OUTPUT->action_icon(
+            new moodle_url('approve.php', array('eid' => $entry->id, 'mode' => $mode, 'sesskey' => sesskey())),
+            new pix_icon('t/approve', get_string('approve','glossary'), '',
+                array('class' => 'iconsmall', 'align' => $align))
+        );
         if ($insidetable) {
             echo '</td></tr></table>';
         }
diff --git a/mod/glossary/pix/export.png b/mod/glossary/pix/export.png
new file mode 100644 (file)
index 0000000..fd8cbbe
Binary files /dev/null and b/mod/glossary/pix/export.png differ
diff --git a/mod/glossary/pix/export.svg b/mod/glossary/pix/export.svg
new file mode 100644 (file)
index 0000000..9197663
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In  -->\r
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [\r
+       <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">\r
+]>\r
+<svg version="1.1"\r
+        xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"\r
+        x="0px" y="0px" width="12px" height="12px" viewBox="0 0 12 12" style="overflow:visible;enable-background:new 0 0 12 12;"\r
+        xml:space="preserve" preserveAspectRatio="xMinYMid meet">\r
+<defs>\r
+</defs>\r
+<path style="fill:#999999;" d="M11,4.5H7.5V1c0-0.5-0.5-1-1-1h-1c-0.5,0-1,0.5-1,1v3.5L1,4.5c-0.5,0-1,0.5-1,1v1c0,0.5,0.5,1,1,1\r
+       h3.5V11c0,0.5,0.5,1,1,1h1c0.5,0,1-0.5,1-1V7.5H11c0.6,0,1-0.5,1-1l0-1C12,5,11.6,4.5,11,4.5z"/>\r
+</svg>\r
index b08d4c2..21b14a1 100644 (file)
@@ -7,6 +7,7 @@
 .path-mod-glossary .glossarypost .entrylowersection .aliases {text-align:center;}
 .path-mod-glossary .glossarypost .entrylowersection .icons {text-align:right;padding-right: 5px;}
 .path-mod-glossary .glossarypost .entrylowersection .ratings {text-align:right;padding-right: 5px;padding-bottom: 2px;}
+.path-mod-glossary .glossarypost .glossary-hidden-note { margin: 0 .45em; }
 
 .path-mod-glossary .glossarydisplay {margin-left:auto;margin-right:auto;}
 .path-mod-glossary .glossarydisplay .tabs {width: 100%;margin-bottom: 0px;}
diff --git a/pix/t/approve.png b/pix/t/approve.png
new file mode 100644 (file)
index 0000000..43540a5
Binary files /dev/null and b/pix/t/approve.png differ
diff --git a/pix/t/approve.svg b/pix/t/approve.svg
new file mode 100644 (file)
index 0000000..b29d965
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In  -->\r
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [\r
+       <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">\r
+]>\r
+<svg version="1.1"\r
+        xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"\r
+        x="0px" y="0px" width="12px" height="12px" viewBox="0 0 12 12" style="overflow:visible;enable-background:new 0 0 12 12;"\r
+        xml:space="preserve">\r
+<defs>\r
+</defs>\r
+<path style="fill:#999999;" d="M11.4,0.6l-0.9-0.5C10.1-0.1,9.5,0,9.2,0.5L4.7,8.2L2,6.6C1.5,6.3,0.9,6.5,0.6,7L0.1,7.8\r
+       C-0.1,8.3,0,8.9,0.5,9.2L5,11.8c0.1,0.1,0.3,0.1,0.4,0.1c0.4,0.1,0.8-0.1,1-0.5L11.8,2C12.1,1.5,11.9,0.9,11.4,0.6z"/>\r
+</svg>\r
index 0c57b65..8e2e316 100644 (file)
@@ -22,6 +22,7 @@ deprecation:
 * i/tick_amber_big: Use i/caution or i/grade_partiallycorrect
 * No more small versions of i/cross_red_small, i/tick_green_small and i/tick_amber_small, use their big equivalent.
 * t/addgreen: Use t/add instead.
+* i/approve: Use t/approve instead
 
 optional changes:
 * new optional boolean parameter $withlinks for public function login_info() in lib/outputrenderers.php (MDL-31365)
@@ -44,6 +45,7 @@ optional changes:
 * new classes 'icon-pre' and 'icon-post' supposedly to be used when the icon is positioned before or after the text. This is not really used yet, but it's a start towards some standardisation of the icon selectors.
 * new icons i/valid, i/caution and i/invalid for generic statuses.
 * new icons i/grade_correct, i/grade_partiallycorrect and i/grade_incorrect for grades.
+* new icon t/approve (12x12).
 
 === 2.3 ===