Commit b7063ffa authored by Jono Mingard's avatar Jono Mingard
Browse files

Add descriptive alt text to Edit and Delete buttons (Bug #1276397)



Edit and Delete buttons should now have consistent, descriptive alt text -
where possible this includes the title of the object to be edited or deleted

Change-Id: Ic10775c961a27c8e1ce1fcc011be1f6c46ee9c1f
Signed-off-by: default avatarJono Mingard <jonom@catalyst.net.nz>
parent 0c63ffea
......@@ -103,6 +103,7 @@ foreach ($iframesources as $url => $name) {
'submit' => array(
'type' => 'image',
'src' => $THEME->get_url('images/btn_deleteremove.png'),
'alt' => get_string('deletespecific', 'mahara', $name),
'elementtitle' => get_string('delete'),
'confirm' => get_string('confirmdeletemenuitem', 'admin'),
),
......
......@@ -39,14 +39,18 @@ function groupcategories_submit(Pieform $form, $values) {
redirect(get_config('wwwroot') . 'admin/groups/groupcategories.php');
}
$strings = array('edit','delete','update','cancel','add','name','unknownerror');
$strings = array('edit', 'delete', 'update', 'cancel', 'add', 'name', 'unknownerror');
$adminstrings = array('confirmdeletecategory', 'deletefailed');
$argumentstrings = array('editspecific', 'deletespecific');
foreach ($strings as $string) {
$getstring[$string] = json_encode(get_string($string));
}
foreach ($adminstrings as $string) {
$getstring[$string] = json_encode(get_string($string, 'admin'));
}
foreach ($argumentstrings as $string) {
$getstring[$string] = json_encode(get_string($string, 'mahara', '%s'));
}
$thead = array(json_encode(get_string('name', 'admin')), '""');
$ijs = "var thead = TR(null,map(partial(TH,null),[" . implode($thead,",") . "]));\n";
......@@ -71,9 +75,11 @@ function displaymenuitems(itemlist) {
// Creates one table row
function formatrow (item) {
// item has id, type, name, link, linkedto
var edit = INPUT({'type':'image','src':config.theme['images/btn_edit.png'],'title':{$getstring['edit']}});
var edit = INPUT({'type':'image','src':config.theme['images/btn_edit.png'],
'title':{$getstring['edit']},'alt':{$getstring['editspecific']}.replace('%s', item.name)});
connect(edit, 'onclick', function (e) { e.stop(); edititem(item); });
var del = INPUT({'type':'image','src':config.theme['images/btn_deleteremove.png'],'title':{$getstring['delete']}});
var del = INPUT({'type':'image','src':config.theme['images/btn_deleteremove.png'],
'title':{$getstring['delete']},'alt':{$getstring['deletespecific']}.replace('%s', item.name)});
connect(del, 'onclick', function (e) { e.stop(); delitem(item.id); });
var cells = map(
partial(TD,null),
......
......@@ -47,7 +47,6 @@ $string['createasdraftdesc'] = 'This will create the journal entry, but it will
$string['createblog'] = 'Create journal';
$string['dataimportedfrom'] = 'Data imported from %s';
$string['defaultblogtitle'] = '%s\'s Journal';
$string['delete'] = 'Delete';
$string['deleteblog?'] = 'Are you sure you want to delete this journal?';
$string['deletebloghaspost?'] = array(
0 => 'This journal contains 1 entry. Are you sure you want to delete this journal?',
......
......@@ -284,7 +284,7 @@ class ArtefactTypeBlog extends ArtefactType {
foreach ($result as &$r) {
if (!$r->locked) {
$r->deleteform = ArtefactTypeBlog::delete_form($r->id);
$r->deleteform = ArtefactTypeBlog::delete_form($r->id, $r->title);
}
}
......@@ -395,7 +395,7 @@ class ArtefactTypeBlog extends ArtefactType {
AND bp.published = 1", array($this->get('id')));
}
public static function delete_form($id) {
public static function delete_form($id, $title = '') {
global $THEME;
$confirm = get_string('deleteblog?', 'artefact.blog');
......@@ -434,9 +434,10 @@ class ArtefactTypeBlog extends ArtefactType {
'submit' => array(
'type' => 'image',
'src' => $THEME->get_url('images/btn_deleteremove.png'),
'elementtitle' => get_string('delete', 'artefact.blog'),
'alt' => get_string('deletespecific', 'mahara', $title),
'elementtitle' => get_string('delete'),
'confirm' => $confirm,
'value' => get_string('delete', 'artefact.blog')
'value' => get_string('delete'),
),
),
));
......@@ -770,7 +771,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
if (is_null($viewoptions)) {
// My Blogs area: create forms for changing post status & deleting posts.
$post->changepoststatus = ArtefactTypeBlogpost::changepoststatus_form($post->id, $post->published);
$post->delete = ArtefactTypeBlogpost::delete_form($post->id);
$post->delete = ArtefactTypeBlogpost::delete_form($post->id, $post->title);
}
else {
$by = $post->author ? display_default_name($post->author) : $post->authorname;
......@@ -907,7 +908,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
));
}
public static function delete_form($id) {
public static function delete_form($id, $title) {
global $THEME;
return pieform(array(
'name' => 'delete_' . $id,
......@@ -924,9 +925,10 @@ class ArtefactTypeBlogPost extends ArtefactType {
'submit' => array(
'type' => 'image',
'src' => $THEME->get_url('images/btn_deleteremove.png'),
'elementtitle' => get_string('delete', 'artefact.blog'),
'alt' => get_string('deletespecific', 'mahara', $title),
'elementtitle' => get_string('delete'),
'confirm' => get_string('deleteblogpost?', 'artefact.blog'),
'value' => get_string('delete', 'artefact.blog'),
'value' => get_string('delete'),
),
),
));
......
......@@ -8,7 +8,7 @@
{if $blog->locked}
<span class="s dull">{str tag=submittedforassessment section=view}</span>
{else}
<a href="{$WWWROOT}artefact/blog/settings/index.php?id={$blog->id}" title="{str tag=settings}"><img src="{theme_url filename='images/btn_configure.png'}" alt="{str tag=settings}"></a>
<a href="{$WWWROOT}artefact/blog/settings/index.php?id={$blog->id}" title="{str tag=settings}"><img src="{theme_url filename='images/btn_configure.png'}" alt="{str(tag=settingsspecific arg1=$blog->title)|escape:html|safe}"></a>
{$blog->deleteform|safe}
{/if}
</span>
......
......@@ -19,7 +19,7 @@
{else}
<form name="edit_{$post->id}" action="{$WWWROOT}artefact/blog/post.php">
<input type="hidden" name="id" value="{$post->id}">
<input type="image" src="{theme_url filename="images/btn_edit.png"}" title="{str tag=edit}">
<input type="image" src="{theme_url filename="images/btn_edit.png"}" alt="{str(tag=editspecific arg1=$post->title)|escape:html|safe}" title="{str tag=edit}">
</form>
{$post->delete|safe}
{/if}
......
......@@ -26,6 +26,8 @@ $string['cannotextractfileinfoldersubmitted'] = 'You cannot extract a file in a
$string['changessaved'] = 'Changes saved';
$string['clickanddragtomovefile'] = 'Move %s by clicking and dragging or by pressing Space';
$string['moveto'] = 'Move to %s';
$string['editfolderspecific'] = 'Edit folder "%s"';
$string['deletefolderspecific'] = 'Delete folder "%s"';
$string['foldercontents'] = 'Folder contents';
$string['copyrightnotice'] = 'Copyright notice';
$string['create'] = 'Create';
......@@ -267,6 +269,7 @@ $string['wrongfiletypeforblock'] = 'The file you uploaded was not the correct ty
$string['Contents'] = 'Contents';
$string['Continue'] = 'Continue';
$string['Decompress'] = 'Decompress';
$string['decompressspecific'] = 'Decompress "%s"';
$string['nfolders'] = array(
'%s folder',
'%s folders',
......
......@@ -73,9 +73,20 @@
{if $file->locked}
<span class="dull">{str tag=Submitted section=view}</span>
{elseif !isset($file->can_edit) || $file->can_edit != 0}
{if $file->artefacttype == 'archive'}<a href="{$WWWROOT}artefact/file/extract.php?file={$file->id}"><img src="{theme_url filename="images/btn_extract.png"}" alt="{str tag=Unzip section=artefact.file}"/></a>{/if}
<input type="image" src="{theme_url filename="images/btn_edit.png"}" name="{$prefix}_edit[{$file->id}]" value="" title="{str tag=edit}" alt="{str tag=edit}" />
<input type="image" src="{theme_url filename="images/btn_deleteremove.png"}" name="{$prefix}_delete[{$file->id}]" value="" title="{str tag=delete}" alt="{str tag=delete}" />
{if $file->artefacttype == 'archive'}
<a href="{$WWWROOT}artefact/file/extract.php?file={$file->id}">
<img src="{theme_url filename="images/btn_extract.png"}" alt="{str(tag=decompressspecific section=artefact.file arg1=$displaytitle)|escape:html|safe}"/>
</a>
{/if}
{if $file->artefacttype == 'folder'}
{assign var=edittext value=str(tag=editfolderspecific section=artefact.file arg1=$displaytitle)}
{assign var=deletetext value=str(tag=deletefolderspecific section=artefact.file arg1=$displaytitle)}
{else}
{assign var=edittext value=str(tag=editspecific arg1=$displaytitle)}
{assign var=deletetext value=str(tag=deletespecific arg1=$displaytitle)}
{/if}
<input type="image" src="{theme_url filename="images/btn_edit.png"}" name="{$prefix}_edit[{$file->id}]" value="" title="{str tag=edit}" alt="{$edittext|escape:html|safe}" />
<input type="image" src="{theme_url filename="images/btn_deleteremove.png"}" name="{$prefix}_delete[{$file->id}]" value="" title="{str tag=delete}" alt="{$deletetext|escape:html|safe}" />
{/if}
{/if}
{if $selectable && ($file->artefacttype != 'folder' || $selectfolders) && $publishable && !$file->isparent}
......
......@@ -215,6 +215,7 @@ function deletenote_form($id, $notedata) {
'submit' => array(
'type' => 'image',
'src' => $THEME->get_url('images/btn_deleteremove.png'),
'alt' => get_string('deletespecific', 'mahara', $notedata->title),
'elementtitle' => get_string('delete'),
),
),
......
......@@ -69,7 +69,7 @@
{if $n->locked}
<span class="s dull">{str tag=Submitted section=view}</span>
{else}
<a href="{$WWWROOT}artefact/internal/editnote.php?id={$n->id}" title="{str tag=edit}"><img src="{theme_url filename='images/btn_edit.png'}" alt="{str tag=edit}"></a>
<a href="{$WWWROOT}artefact/internal/editnote.php?id={$n->id}" title="{str tag=edit}"><img src="{theme_url filename='images/btn_edit.png'}" alt="{str(tag=editspecific arg1=$n->title)|escape:html|safe}"></a>
{if $n->deleteform}{$n->deleteform|safe}{/if}
{/if}
</td>
......
......@@ -20,6 +20,7 @@ $string['deletethisplan'] = 'Delete plan: \'%s\'';
$string['editplan'] = 'Edit plan';
$string['editingplan'] = 'Editing plan';
$string['managetasks'] = 'Manage tasks';
$string['managetasksspecific'] = 'Manage tasks in "%s"';
$string['newplan'] = 'New plan';
$string['noplansaddone'] = 'No plans yet. %sAdd one%s!';
$string['noplans'] = 'No plans to display';
......
{foreach from=$plans.data item=plan}
<div class="{cycle values='r0,r1'} listrow">
<div class="fr planstatus">
<a href="{$WWWROOT}artefact/plans/edit/index.php?id={$plan->id}" title="{str tag="edit"}" ><img src="{theme_url filename='images/btn_edit.png'}" alt="{str tag=edit}"></a>
<a href="{$WWWROOT}artefact/plans/plan.php?id={$plan->id}" title="{str tag=managetasks section=artefact.plans}"><img src="{theme_url filename='images/btn_configure.png'}" alt="{str tag=managetasks}"></a>
<a href="{$WWWROOT}artefact/plans/delete/index.php?id={$plan->id}" title="{str tag="delete"}"><img src="{theme_url filename='images/btn_deleteremove.png'}" alt="{str tag=delete}"></a>
<a href="{$WWWROOT}artefact/plans/edit/index.php?id={$plan->id}" title="{str tag=edit}" >
<img src="{theme_url filename='images/btn_edit.png'}" alt="{str(tag=editspecific arg1=$plan->title)|escape:html|safe}">
</a>
<a href="{$WWWROOT}artefact/plans/plan.php?id={$plan->id}" title="{str tag=managetasks section=artefact.plans}">
<img src="{theme_url filename='images/btn_configure.png'}" alt="{str(tag=managetasksspecific section=artefact.plans arg1=$plan->title)|escape:html|safe}">
</a>
<a href="{$WWWROOT}artefact/plans/delete/index.php?id={$plan->id}" title="{str tag=delete}">
<img src="{theme_url filename='images/btn_deleteremove.png'}" alt="{str(tag=deletespecific arg1=$plan->title)|escape:html|safe}">
</a>
</div>
<h3 class="title"><a href="{$WWWROOT}artefact/plans/plan.php?id={$plan->id}">{$plan->title}</a></h3>
......
......@@ -17,7 +17,13 @@
{/if}
{/if}
<td class="buttonscell btns2 planscontrols"><a href="{$WWWROOT}artefact/plans/edit/task.php?id={$task->task}" title="{str tag=edit}"><img src="{theme_url filename='images/btn_edit.png'}" alt="{str tag=edit}"></a>
<a href="{$WWWROOT}artefact/plans/delete/task.php?id={$task->task}" title="{str tag=delete}"><img src="{theme_url filename='images/btn_deleteremove.png'}" alt="{str tag=delete}"></a></td>
<td class="buttonscell btns2 planscontrols">
<a href="{$WWWROOT}artefact/plans/edit/task.php?id={$task->task}" title="{str tag=edit}">
<img src="{theme_url filename='images/btn_edit.png'}" alt="{str(tag=editspecific arg1=$task->title)|escape:html|safe}">
</a>
<a href="{$WWWROOT}artefact/plans/delete/task.php?id={$task->task}" title="{str tag=delete}">
<img src="{theme_url filename='images/btn_deleteremove.png'}" alt="{str(tag=deletespecific arg1=$task->title)|escape:html|safe}">
</a>
</td>
</tr>
{/foreach}
......@@ -1016,8 +1016,12 @@ EOF;
static function get_artefacttype_js($compositetype) {
global $THEME;
$editstr = get_string('edit');
$delstr = get_string('delete');
$titlestring = call_static_method(generate_artefact_class_name($compositetype), 'get_tablerenderer_title_js_string');
$editstr = json_encode(get_string('edit'));
$delstr = json_encode(get_string('delete'));
$editjsstr = json_encode(get_string('editspecific', 'mahara', '%s')) . ".replace('%s', {$titlestring})";
$deljsstr = json_encode(get_string('deletespecific', 'mahara', '%s')) . ".replace('%s', {$titlestring})";
$imagemoveblockup = json_encode($THEME->get_url('images/btn_moveup.png'));
$imagemoveblockdown = json_encode($THEME->get_url('images/btn_movedown.png'));
$upstr = get_string('moveup', 'artefact.resume');
......@@ -1061,8 +1065,8 @@ EOF;
$js .= <<<EOF
function (r, d) {
var editlink = A({'href': 'editcomposite.php?id=' + r.id + '&artefact=' + r.artefact, 'title': '{$editstr}'}, IMG({'src': config.theme['images/btn_edit.png'], 'alt':'{$editstr}'}));
var dellink = A({'href': '', 'title': '{$delstr}'}, IMG({'src': config.theme['images/btn_deleteremove.png'], 'alt': '[x]'}));
var editlink = A({'href': 'editcomposite.php?id=' + r.id + '&artefact=' + r.artefact, 'title': {$editstr}}, IMG({'src': config.theme['images/btn_edit.png'], 'alt':{$editjsstr}}));
var dellink = A({'href': '', 'title': {$delstr}}, IMG({'src': config.theme['images/btn_deleteremove.png'], 'alt': {$deljsstr}}));
connect(dellink, 'onclick', function (e) {
e.stop();
return deleteComposite(d.type, r.id, r.artefact);
......
......@@ -45,9 +45,13 @@
<td align="center">{$n->count}</td>
<td class="right buttonscell btns2">
{if $n->exists}
<a id="goals_edit_{$n->artefacttype}" href="{$WWWROOT}artefact/resume/editgoalsandskills.php?id={$n->id}" title="{str tag=edit}"><img src="{theme_url filename='images/btn_edit.png'}" alt="{str tag=edit}"></a>
<a id="goals_edit_{$n->artefacttype}" href="{$WWWROOT}artefact/resume/editgoalsandskills.php?id={$n->id}" title="{str tag=edit}">
<img src="{theme_url filename='images/btn_edit.png'}" alt="{str tag=edit}">
</a>
{else}
<a id="goals_edit_{$n->artefacttype}" href="{$WWWROOT}artefact/resume/editgoalsandskills.php?type={$n->artefacttype}" title="{str tag=edit}"><img src="{theme_url filename='images/btn_edit.png'}" alt="{str tag=edit}"></a>
<a id="goals_edit_{$n->artefacttype}" href="{$WWWROOT}artefact/resume/editgoalsandskills.php?type={$n->artefacttype}" title="{str tag=edit}">
<img src="{theme_url filename='images/btn_edit.png'}" alt="{str tag=edit}">
</a>
{/if}
</td>
</tr>
......
......@@ -60,7 +60,7 @@ if (!$moderator || ($topic->group && !group_within_edit_window($topic->group)))
throw new AccessDeniedException(get_string('cantdeletetopic', 'interaction.forum'));
}
define('TITLE', $topic->title . ' - ' . get_string('deletetopicvariable', 'interaction.forum', $topic->subject));
define('TITLE', $topic->title . ' - ' . get_string('deletetopicspecific', 'interaction.forum', $topic->subject));
$form = pieform(array(
'name' => 'deletetopic',
......
......@@ -46,14 +46,16 @@ $string['deletepost'] = 'Delete post';
$string['deletepostsuccess'] = 'Post deleted successfully';
$string['deletepostsure'] = 'Are you sure you want to do this? It cannot be undone.';
$string['deletetopic'] = 'Delete topic';
$string['deletetopicvariable'] = 'Delete topic \'%s\'';
$string['deletetopicspecific'] = 'Delete topic "%s"';
$string['deletetopicsuccess'] = 'Topic deleted successfully';
$string['deletetopicsure'] = 'Are you sure you want to do this? It cannot be undone.';
$string['editpost'] = 'Edit post';
$string['editpostsuccess'] = 'Post edited successfully';
$string['editstothispost'] = 'Edits to this post:';
$string['edittitle'] = 'Edit forum';
$string['edittopic'] = 'Edit topic';
$string['edittopicspecific'] = 'Edit topic "%s"';
$string['edittopicsuccess'] = 'Topic edited successfully';
$string['forumname'] = 'Forum name';
$string['forumposthtmltemplate'] = "<div style=\"padding: 0.5em 0; border-bottom: 1px solid #999;\"><strong>Forum: %s (%s)</strong></div>
......
......@@ -36,8 +36,12 @@
<td class="nowrap s subscribetd">{if $forum->subscribe}{$forum->subscribe|safe}{/if}</td>
<td class="right btns2">
{if $admin}
<a href="{$WWWROOT}interaction/edit.php?id={$forum->id}&amp;returnto=index" class="icon btn-big-edit" title="{str tag=edit}"></a>
<a href="{$WWWROOT}interaction/delete.php?id={$forum->id}&amp;returnto=index" class="icon btn-big-del" title="{str tag=delete}"></a>
<a href="{$WWWROOT}interaction/edit.php?id={$forum->id}&amp;returnto=index" class="icon btn-big-edit" title="{str tag=edit}">
{str tag=editspecific arg1=$forum->title}
</a>
<a href="{$WWWROOT}interaction/delete.php?id={$forum->id}&amp;returnto=index" class="icon btn-big-del" title="{str tag=delete}">
{str tag=deletespecific arg1=$forum->title}
</a>
{/if}
</td>
</tr>
......
......@@ -29,8 +29,12 @@
</td>
{if $moderator}
<td class="right btns2">
<a href="{$WWWROOT}interaction/forum/edittopic.php?id={$topic->id}&amp;returnto=view" class="btn-big-edit" title="{str tag="edit"}"></a>
<a href="{$WWWROOT}interaction/forum/deletetopic.php?id={$topic->id}&amp;returnto=view" class="btn-big-del" title="{str tag="delete"}"></a>
<a href="{$WWWROOT}interaction/forum/edittopic.php?id={$topic->id}&amp;returnto=view" class="btn-big-edit" title="{str tag="edit"}">
{str tag=edittopicspecific section=interaction.forum arg1=$topic->subject}
</a>
<a href="{$WWWROOT}interaction/forum/deletetopic.php?id={$topic->id}&amp;returnto=view" class="btn-big-del" title="{str tag="delete"}">
{str tag=deletetopicspecific section=interaction.forum arg1=$topic->subject}
</a>
</td>
{/if}
</tr>
......
......@@ -1041,6 +1041,7 @@ $string['groupadmins'] = 'Administrators';
$string['grouptype'] = 'Group type';
$string['groupvisible'] = 'Visibility';
$string['groupmanage'] = 'Manage';
$string['groupmanagespecific'] = 'Manage "%s"';
$string['groupdelete'] = 'Delete';
$string['managegroupquotadescription'] = 'Use the form below to change the group file quota for this group.';
$string['managegroupdescription'] = 'Use the form below to promote and demote administrators for this group. If you remove a group administrator they will remain a group member.';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment