Skip to content

Commit

Permalink
MDL-36830 usability: Glossary and database small design improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Massart committed Nov 30, 2012
1 parent 2d74d1a commit 851d3b7
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 7 deletions.
8 changes: 6 additions & 2 deletions mod/data/lib.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1251,8 +1251,12 @@ function data_print_template($template, $records, $data, $search='', $page=0, $r
$replacement [] = userdate($record->timemodified); $replacement [] = userdate($record->timemodified);


$patterns[]='##approve##'; $patterns[]='##approve##';
if (has_capability('mod/data:approve', $context) && ($data->approval) && (!$record->approved)){ 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>'; $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 { } else {
$replacement[] = ''; $replacement[] = '';
} }
Expand Down
13 changes: 8 additions & 5 deletions mod/glossary/lib.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1234,7 +1234,8 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h


if (!$entry->approved) { if (!$entry->approved) {
$output = true; $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); $iscurrentuser = ($entry->userid == $USER->id);
Expand All @@ -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)); $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 if ( $mainglossary ) { // if there is a main glossary defined, allow to export the current entry
$output = true; $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>';
} }
} }


Expand Down Expand Up @@ -1292,8 +1293,6 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h


$return .= $button->to_html(PORTFOLIO_ADD_ICON_LINK); $return .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
} }
$return .= "&nbsp;&nbsp;"; // just to make up a little the output in Mozilla ;)

$return .= '</span>'; $return .= '</span>';


if (!empty($CFG->usecomments) && has_capability('mod/glossary:comment', $context) and $glossary->allowcomments) { if (!empty($CFG->usecomments) && has_capability('mod/glossary:comment', $context) and $glossary->allowcomments) {
Expand Down Expand Up @@ -1394,7 +1393,11 @@ function glossary_print_entry_approval($cm, $entry, $mode, $align="right", $ins
if ($insidetable) { if ($insidetable) {
echo '<table class="glossaryapproval" align="'.$align.'"><tr><td align="'.$align.'">'; 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) { if ($insidetable) {
echo '</td></tr></table>'; echo '</td></tr></table>';
} }
Expand Down
Binary file added mod/glossary/pix/export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions mod/glossary/pix/export.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mod/glossary/styles.css
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.path-mod-glossary .glossarypost .entrylowersection .aliases {text-align:center;} .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 .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 .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 {margin-left:auto;margin-right:auto;}
.path-mod-glossary .glossarydisplay .tabs {width: 100%;margin-bottom: 0px;} .path-mod-glossary .glossarydisplay .tabs {width: 100%;margin-bottom: 0px;}
Expand Down
Binary file added pix/t/approve.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions pix/t/approve.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions theme/upgrade.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ deprecation:
* i/tick_amber_big: Use i/caution or i/grade_partiallycorrect * 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. * 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. * t/addgreen: Use t/add instead.
* i/approve: Use t/approve instead


optional changes: optional changes:
* new optional boolean parameter $withlinks for public function login_info() in lib/outputrenderers.php (MDL-31365) * new optional boolean parameter $withlinks for public function login_info() in lib/outputrenderers.php (MDL-31365)
Expand All @@ -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 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/valid, i/caution and i/invalid for generic statuses.
* new icons i/grade_correct, i/grade_partiallycorrect and i/grade_incorrect for grades. * new icons i/grade_correct, i/grade_partiallycorrect and i/grade_incorrect for grades.
* new icon t/approve (12x12).


=== 2.3 === === 2.3 ===


Expand Down

0 comments on commit 851d3b7

Please sign in to comment.