Commit 4a0c666a authored by Penny Leach's avatar Penny Leach
Browse files

merged contextual help rework and profile field help from stable

parent 7a8e51cb
......@@ -85,6 +85,10 @@ foreach ( $element_list as $element => $type ) {
$elements[$element]['defaultvalue'] = 'nz';
}
if (get_helpfile_location('artefact', 'internal', 'profileform', $element)) {
$elements[$element]['help'] = true;
}
if (isset($profilefields[$element])) {
$elements[$element]['defaultvalue'] = $profilefields[$element];
}
......@@ -271,6 +275,7 @@ function profileform_submit(Pieform $form, $values) {
}
$smarty = smarty(array(), array(), array(
'mahara' => array('cantremovedefaultemail'),
));
......
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login</title>
</head>
<body bgcolor="#FFFFFF">
<h3><strong>Blog Address</strong></h3>
<p> If you have a personal blog hosted external to this site, you may wish to list it within your Profile.</p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login</title>
</head>
<body bgcolor="#FFFFFF">
<h3><strong>Email address</strong></h3>
<p>Although the email address given during registration is your primary contact address, you may have several email addresses listed on the site and use any validated address as a contact address within a View.&nbsp; </p>
<p>Add new addresses using the Add Email button.&nbsp; Once you have saved your Profile a message will be sent to the new email address.&nbsp; This message will contain a link which once followed, will confirm your email address is valid.&nbsp; This confirmation email is valid for 24 hours only. &nbsp;After this time you will need to repeat the Add Email process.</p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login</title>
</head>
<body bgcolor="#FFFFFF">
<h3><strong>Industry</strong></h3>
<p>Where relevant you may wish to list which Industry you work in, for example Education, Information Technology, Business and Administration etc.</p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login</title>
</head>
<body bgcolor="#FFFFFF">
<h3><strong>Introduction</strong></h3>
<p> You may wish to write in a brief Introduction of yourself. This might include your area of study, your interests and hobbies, how you are using your ePortfolio etc.</p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login</title>
</head>
<body bgcolor="#FFFFFF">
<h3><strong>Occupation</strong></h3>
<p>Where relevant you may wish to give your current job or Occupation.</p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login</title>
</head>
<body bgcolor="#FFFFFF">
<h3><strong>Official Website Address</strong></h3>
<p>Use the Official Website Address field for your work or organisation&rsquo;s website or blog address.</p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login</title>
</head>
<body bgcolor="#FFFFFF">
<h3><strong>Preferred Name</strong></h3>
<p>If you do not wish for your full name to be displayed to other users on the site, you can set yourself a Preferred Name.&nbsp; Your Preferred Name may be anything you like and replaces your full name display to everyone but Site Administrators and Staff</p>
<h3>&nbsp;</h3>
<h3>&nbsp;</h3>
</body>
</html>
......@@ -39,71 +39,7 @@ $section = param_alphanumext('section', null);
$form = param_alphanumext('form', null);
$element = param_alphanumext('element', null);
$location = get_config('docroot') ;
$file = 'help/';
if ($plugintype != 'core') {
$location .= $plugintype . '/' . $pluginname . '/lang/';
}
else {
$location .= 'lang/';
}
if ($page) {
$page = str_replace('-', '/', $page);
$file .= 'pages/' . $page . '.html';
}
else if ($section) {
$file .= 'sections/' . $section . '.html';
}
else if (!empty($form) && !empty($element)) {
$file .= 'forms/' . $form . '.' . $element . '.html';
}
else if (!empty($form) && empty($element)) {
$file .= 'forms/' . $form . '.html';
}
else {
if ($page) {
json_reply('local', get_string('nohelpfoundpage'));
}
json_reply('local', get_string('nohelpfound'));
}
// now we have to try and locate the help file
$lang = current_language();
if ($lang == 'en.utf8') {
$trieden = true;
}
else {
$trieden = false;
}
// try the current language
$langfile = $location . $lang . '/' . $file;
if (is_readable($langfile)) {
$data = file_get_contents($langfile);
}
// if it's not found, try the parent language if there is one...
if (empty($data) && empty($trieden)) {
$langfile = $location . $lang . '/langconfig.php';
if ($parentlang = get_string_from_file('parentlanguage', $langfile)) {
if ($parentlang == 'en.utf8') {
$trieden = true;
}
$langfile = $location . $parentlang . '/' . $file;
if (is_readable($langfile)) {
$data = file_get_contents($langfile);
}
}
}
// if it's STILL not found, and we haven't already tried english ...
if (empty($data) && empty($trieden)) {
$langfile = $location . 'en.utf8/' . $file;
if (is_readable($langfile)) {
$data = file_get_contents($langfile);
}
}
$data = get_helpfile($plugintype, $pluginname, $form, $element, $page, $section);
if (empty($data)) {
json_reply('local', get_string('nohelpfound'));
......
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login</title>
</head>
<body bgcolor="#FFFFFF">
<h3><strong>Main Menu</strong></h3>
<p>The Main Menu provides you with important resources and information.&nbsp; There are two menus in use within the system &ndash;&nbsp; publicly available resources for non-logged in users and resources for logged in users.&nbsp; Items within these two menus will likely differ.</p>
</body>
</html>
......@@ -157,6 +157,81 @@ function get_string($identifier, $section='mahara') {
return get_string_location($identifier, $section, $variables);
}
function get_helpfile($plugintype, $pluginname, $form, $element, $page=null, $section=null) {
if ($langfile = get_helpfile_location($plugintype, $pluginname, $form, $element, $page, $section)) {
return file_get_contents($langfile);
}
return false;
}
function get_helpfile_location($plugintype, $pluginname, $form, $element, $page=null, $section=null) {
$location = get_config('docroot') ;
$file = 'help/';
if ($plugintype != 'core') {
$location .= $plugintype . '/' . $pluginname . '/lang/';
}
else {
$location .= 'lang/';
}
if ($page) {
$page = str_replace('-', '/', $page);
$file .= 'pages/' . $page . '.html';
}
else if ($section) {
$file .= 'sections/' . $section . '.html';
}
else if (!empty($form) && !empty($element)) {
$file .= 'forms/' . $form . '.' . $element . '.html';
}
else if (!empty($form) && empty($element)) {
$file .= 'forms/' . $form . '.html';
}
else {
return false;
}
// now we have to try and locate the help file
$lang = current_language();
if ($lang == 'en.utf8') {
$trieden = true;
}
else {
$trieden = false;
}
// try the current language
$langfile = $location . $lang . '/' . $file;
log_debug($langfile);
if (is_readable($langfile)) {
return $langfile;
}
// if it's not found, try the parent language if there is one...
if (empty($data) && empty($trieden)) {
$langfile = $location . $lang . '/langconfig.php';
if ($parentlang = get_string_from_file('parentlanguage', $langfile)) {
if ($parentlang == 'en.utf8') {
$trieden = true;
}
$langfile = $location . $parentlang . '/' . $file;
if (is_readable($langfile)) {
return $langfile;
}
}
}
// if it's STILL not found, and we haven't already tried english ...
if (empty($data) && empty($trieden)) {
$langfile = $location . 'en.utf8/' . $file;
if (is_readable($langfile)) {
return $langfile;
}
}
return false;
}
// get a string without sprintfing it.
function get_raw_string($identifier, $section='mahara') {
// For a raw string we don't want to format any arguments using
......
<h3>{str tag="mainmenu"}</h3>
<h3>{str tag="mainmenu"}{contextualhelp plugintype='core' pluginname='mainmenu' section='mainmenu'}</h3>
{if $data}
<ul id="sitemenu">
{foreach from=$data item=item}
......
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