Commit 5b9a4e7f authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Add form element title to help icon accessible text (Bug #1482448)"

parents 3ff470c8 d4013947
......@@ -46,7 +46,7 @@ $string['description'] = 'Description';
$string['remove'] = 'Remove';
$string['Close'] = 'Close';
$string['Help'] = 'Help';
$string['Helpicon'] = 'Help icon';
$string['helpfor'] = 'Help for "%s"';
$string['closehelp'] = 'Close help';
$string['applychanges'] = 'Apply changes';
$string['general'] = 'General';
......
......@@ -2133,35 +2133,54 @@ function getoptions_country() {
}
/**
* Returns HTML string with help icon image that can be used on a page.
* Returns an HTML string with a help icon image that can be used on a page.
* When the icon is clicked, a dialog box will be shown with contextual help
* for the element or page the icon is connected to.
*
* @param string $plugintype
* @param string $pluginname
* @param string $form
* @param string $element
* @param string $page
* @param string $section
* All parameters except $title determine where the help text will be found.
* For example:
* <code>
* // Returns the help text in artefact/blog/lang/[lang]/help/forms/editpost.draft.html
* get_help_icon('artefact', 'blog', 'editpost', 'draft');
* // Returns the help text in artefact/internal/lang/[lang]/help/pages/index.html
* get_help_icon('artefact', 'internal', '', '', 'index');
* </code>
*
* @param string $plugintype the type of plugin to find help text for
* @param string $pluginname the name of the plugin to find help text for
* @param string $form the ID of the form this help icon is connected to
* @param string $element the ID of the form element this help icon is connected to
* @param string $page the page this help icon describes
* @param string $section the section this help icon describes
* @param string $title the title/label of the element this help icon is connected to
*
* @return string HTML with help icon element
*/
function get_help_icon($plugintype, $pluginname, $form, $element, $page='', $section='') {
function get_help_icon($plugintype, $pluginname, $form, $element, $page='', $section='', $title=null) {
global $THEME;
return ' <span class="help"><a href="" title="' . get_string('Helpicon') . '" onclick="'.
if ($title) {
$content = get_string('helpfor', 'mahara', $title);
}
else {
$content = get_string('Help');
}
return ' <span class="help"><a href="" title="' . get_string('Help') . '" onclick="'.
hsc(
'contextualHelp(' . json_encode($form) . ',' .
json_encode($element) . ',' . json_encode($plugintype) . ',' .
json_encode($pluginname) . ',' . json_encode($page) . ',' .
json_encode($section)
. ',this); return false;'
) . '"><span class="icon icon-info-circle"></span><span class="sr-only">'. get_string('Help') . '</span></a></span>';
) . '"><span class="icon icon-info-circle"></span><span class="sr-only">'. $content . '</span></a></span>';
}
function pieform_get_help(Pieform $form, $element) {
$plugintype = isset($element['helpplugintype']) ? $element['helpplugintype'] : $form->get_property('plugintype');
$pluginname = isset($element['helppluginname']) ? $element['helppluginname'] : $form->get_property('pluginname');
$formname = isset($element['helpformname']) ? $element['helpformname'] : $form->get_name();
return get_help_icon($plugintype, $pluginname, $formname, $element['name']);
return get_help_icon($plugintype, $pluginname, $formname, $element['name'], '', '', $element['title']);
}
/**
......
......@@ -10,21 +10,21 @@
| userA | Kupuhipa1 | test01@example.com | Pete | Mc | mahara | internal | member |
When I log in as "userA" with password "Kupuhipa1"
And I choose "Pages" in "Portfolio"
And I click on "Help icon"
And I click on "Help"
And I should see "A page contains a selection of artefacts"
And I choose "Collections" in "Portfolio"
And I click on "Help icon"
And I click on "Help"
And I should see "A collection is a set of pages that are linked to one another and have the same access permissions."
And I choose "Shared by me" in "Portfolio"
And I click on "Help icon"
And I click on "Help"
And I should see "When you have created portfolio pages and collections, you may wish to share them with others, e.g. to receive feedback."
And I choose "Shared with me" in "Portfolio"
And I click on "Help icon"
And I click on "Help"
And I should see "On this page you can list the most recently modified or commented on pages that have been shared with"
And I choose "Export" in "Portfolio"
# Note: The export page is not available if the export plugins is not installed and the zip command is not installed
And I click on "Help icon"
And I click on "Help"
And I should see "You can export your portfolio to keep your files and content offline."
And I choose "Import" in "Portfolio"
And I click on "Help icon"
And I click on "Help"
Then I should see "You can import your (or any valid Leap2a) portfolio from another Mahara site yourself."
......@@ -17,12 +17,12 @@ Scenario: Accessing help icons under Skin tabs (Bug 1411070)
Given I log in as "userA" with password "Kupuhipa1"
And I follow "Portfolio"
And I choose "Skins" in "Portfolio"
When I click on "Help icon"
When I click on "Help"
And I should see "Skins help you customise the look of your portfolio pages to give them a personal touch." in the "div#helpstop" element
And I follow "Create skin"
And I click on "Help icon"
And I click on "Help"
Then I should see "You can design your own skin" in the "div#helpstop" element
And I choose "Skins" in "Portfolio"
And I follow "Import skin(s)"
And I click on "Help icon"
And I click on "Help"
And I should see "You can import skins from other Mahara sites." in the "div#helpstop" element
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