Commit e974c6ce authored by Penny Leach's avatar Penny Leach
Browse files

complete rework of page level contextual help. Introduces three new

constants - SECTION_PLUGINTYPE, SECTION_PLUGINNAME, SECTION_PAGE -
which are used to build up the page help thing instead of trying to parse
the url.  I have only added these constants to pages that had page help,
it would be a good idea to add checks for them to file_content_check
and definitely add them in when they're missing
parent 47a13ec6
......@@ -27,6 +27,9 @@
define('INTERNAL', 1);
define('MENUITEM', 'account');
define('SUBMENUITEM', 'activity');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'account');
define('SECTION_PAGE', 'activity');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
......
......@@ -27,6 +27,9 @@
define('INTERNAL', 1);
define('MENUITEM', 'account');
define('SUBMENUITEM', 'activityprefs');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'account');
define('SECTION_PAGE', 'activitypreferences');
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
require_once('pieforms/pieform.php');
......
......@@ -27,6 +27,9 @@
define('INTERNAL', 1);
define('MENUITEM', 'account');
define('SUBMENUITEM', 'accountprefs');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'account');
define('SECTION_PAGE', 'preferences');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once('pieforms/pieform.php');
......
......@@ -27,6 +27,9 @@
define('INTERNAL', 1);
define('MENUITEM', 'account');
define('SUBMENUITEM', 'watchlist');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'account');
define('SECTION_PAGE', 'watchlist');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
......
......@@ -26,6 +26,10 @@
define('INTERNAL', 1);
define('MENUITEM', 'myblogs');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'blog');
define('SECTION_PAGE', 'index');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('myblogs','artefact.blog'));
safe_require('artefact', 'blog');
......
<h3>My Blogs</h3>
<p>A web log or Blog is journal-like tool that allows you to record your thoughts and experiences. You can allow other users to post comments on your Blog allowing you to create a dialogue with your readers.</p>
<p>While a Blog itself is considered an Artefact, so are any individual Blog postings you create. This means both Blogs and Blog posts may be added to a View.</p><p>
Your Blogs area lists of all of your current Blogs. Click on the name of a Blog to add a new posting or edit the Blog settings. To create a new Blog select Add Blog.
</p>
......@@ -26,6 +26,10 @@
define('INTERNAL', 1);
define('MENUITEM', 'myblogs');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'blog');
define('SECTION_PAGE', 'view');
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
define('TITLE', get_string('viewblog','artefact.blog'));
safe_require('artefact', 'blog');
......
......@@ -26,6 +26,10 @@
define('INTERNAL', 1);
define('MENUITEM', 'myfiles');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'file');
define('SECTION_PAGE', 'index');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('myfiles', 'artefact.file'));
safe_require('artefact', 'file');
......
......@@ -26,6 +26,10 @@
define('INTERNAL', 1);
define('MENUITEM', 'myprofile');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'internal');
define('SECTION_PAGE', 'index');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('profile','artefact.internal'));
require_once('pieforms/pieform.php');
......
......@@ -26,6 +26,10 @@
define('INTERNAL', 1);
define('MENUITEM', 'myprofile');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'internal');
define('SECTION_PAGE', 'profileficons');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('profileicons', 'artefact.internal'));
$smarty = smarty(
......
......@@ -27,6 +27,9 @@
define('INTERNAL', true);
define('MENUITEM', 'myresume');
define('SUBMENUITEM', 'mygoals');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'resume');
define('SECTION_PAGE', 'goals');
require_once(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
......
......@@ -27,6 +27,9 @@
define('INTERNAL', true);
define('MENUITEM', 'myresume');
define('SUBMENUITEM', 'myresume');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'resume');
define('SECTION_PAGE', 'index');
require_once(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
......
......@@ -27,6 +27,9 @@
define('INTERNAL', true);
define('MENUITEM', 'myresume');
define('SUBMENUITEM', 'myskills');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'resume');
define('SECTION_PAGE', 'skills');
require_once(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
......
......@@ -26,6 +26,9 @@
define('INTERNAL', 1);
define('PUBLIC', 1);
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'site');
define('SECTION_PAGE', 'contact');
require('init.php');
require_once('pieforms/pieform.php');
$contactus = get_string('contactus');
......
......@@ -27,6 +27,10 @@
define('INTERNAL', 1);
define('MENUITEM', 'mycontacts');
define('SUBMENUITEM', 'mycommunities');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'contacts');
define('SECTION_PAGE', 'communities');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('mycommunities'));
......
......@@ -27,6 +27,10 @@
define('INTERNAL', 1);
define('MENUITEM', 'mycontacts');
define('SUBMENUITEM', 'myownedcommunities');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'contacts');
define('SECTION_PAGE', 'ownedcommunities');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('myownedcommunities'));
......
......@@ -27,6 +27,10 @@
define('INTERNAL', 1);
define('MENUITEM', 'mycontacts');
define('SUBMENUITEM', 'mygroups');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'contacts');
define('SECTION_PAGE', 'groups');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('mygroups'));
......
......@@ -27,6 +27,10 @@
define('INTERNAL', 1);
define('MENUITEM', 'mycontacts');
define('SUBMENUITEM', 'myfriends');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'contacts');
define('SECTION_PAGE', 'friends');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('myfriends'));
......
......@@ -26,6 +26,10 @@
define('INTERNAL', 1);
define('PUBLIC', 1);
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'site');
define('SECTION_PAGE', 'forgotpass');
require('init.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('forgotpassword'));
......
......@@ -177,7 +177,7 @@ function get_helpfile_location($plugintype, $pluginname, $form, $element, $page=
}
if ($page) {
$page = str_replace('-', '/', $page);
$file .= 'pages/' . $page . '.html';
$file .= 'pages/' . $pluginname . '/' . $page . '.html';
}
else if ($section) {
$file .= 'sections/' . $section . '.html';
......@@ -1516,7 +1516,7 @@ function get_performance_info() {
return $info;
}
function perf_to_log($info) {
function perf_to_log($info=null) {
if (!get_config('perftolog')) {
return true;
}
......
......@@ -483,7 +483,6 @@ function json_headers() {
function json_reply($error, $message) {
json_headers();
echo json_encode(array('error' => $error, 'message' => $message));
log_debug('calling from json_reply');
perf_to_log();
exit;
}
......@@ -1503,43 +1502,24 @@ function get_full_script_path() {
}
function has_page_help() {
// the path of the current script (used for page help)
$path = get_config('wwwroot');
$port = (isset($_SERVER['SERVER_PORT'])) ? $_SERVER['SERVER_PORT'] : '';
if ($port && substr($path, -strlen($port)) != $port) {
$path .= $port;
}
$scriptname = substr(urldecode(strip_querystring(get_full_script_path())), strlen($path));
if (strpos($scriptname, '.php') != (strlen($scriptname) - 4)) {
$scriptname .= 'index.php';
$pt = defined('SECTION_PLUGINTYPE') ? SECTION_PLUGINTYPE : null;
$pn = defined('SECTION_PLUGINNAME') ? SECTION_PLUGINNAME : null;
$sp = defined('SECTION_PAGE') ? SECTION_PAGE : null;
if (empty($pt) || ($pt != 'core' && empty($pn))) {
// we can't have a plugin type but no plugin name
return false;
}
$scriptname = substr($scriptname, 0, -4);
$firstdir = $scriptname;
if (false !== ($slashpos = strpos($scriptname, '/'))) {
$firstdir = substr($scriptname, 0, $slashpos);
}
if (in_array($firstdir, plugin_types())) {
$bits = explode('/', $scriptname);
if (count($bits) > 2) {
$plugintype = $bits[0];
$pluginname = $bits[1];
$scriptname = substr($scriptname, strlen($plugintype . '/' . $pluginname . '/'));
$pagehelp = get_config('docroot') . $plugintype . '/' . $pluginname . '/lang/en.utf8/help/pages/' .
$scriptname . '.html';
}
if (in_array($pt, plugin_types())) {
$pagehelp = get_config('docroot') . $pt . '/' . $pn . '/lang/en.utf8/help/pages/' . $sp . '.html';
}
if (empty($plugintype)) {
$plugintype = 'core';
$pluginname = 'pages';
$pagehelp = get_config('docroot') . 'lang/en.utf8/help/pages/' . $scriptname . '.html';
else {
$pagehelp = get_config('docroot') . 'lang/en.utf8/help/pages/' . $pn . '/' . $sp . '.html';
}
if (is_readable($pagehelp)) {
$scriptname = str_replace('/', '-', $scriptname);
return array($scriptname, get_help_icon($plugintype, $pluginname, '', '', $scriptname));
return array($sp, get_help_icon($pt, $pn, '', '', $sp));
}
return false;
}
......
......@@ -26,6 +26,9 @@
define('INTERNAL', 1);
define('PUBLIC', 1);
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'site');
define('SECTION_PAGE', 'register');
require('init.php');
define('TITLE', get_string('register'));
......
......@@ -26,6 +26,9 @@
define('INTERNAL', 1);
require('init.php');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'search');
define('SECTION_PAGE', 'search');
define('TITLE', get_string('search'));
// If there is no query posted, the 'results' section of the page will
......
......@@ -26,7 +26,11 @@
define('INTERNAL', 1);
define('MENUITEM', 'myviews');
// define('SUBMENUITEM', 'mygroups');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'view');
define('SECTION_PAGE', 'create1');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('createviewstep1', 'view'));
require_once('pieforms/pieform.php');
......
......@@ -25,6 +25,10 @@
*/
define('INTERNAL', 1);
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'view');
define('SECTION_PAGE', 'create2');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('createviewstep2', 'view'));
require_once('template.php');
......
......@@ -26,6 +26,10 @@
define('INTERNAL', 1);
define('MENUITEM', 'view');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'view');
define('SECTION_PAGE', 'create3');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('createviewstep3', 'view'));
require_once('template.php');
......
......@@ -26,6 +26,10 @@
define('INTERNAL', 1);
define('MENUITEM', 'view');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'view');
define('SECTION_PAGE', 'create4');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('createviewstep4', 'view'));
require_once('pieforms/pieform.php');
......
......@@ -26,6 +26,10 @@
define('INTERNAL', 1);
define('MENUITEM', 'view');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'view');
define('SECTION_PAGE', 'edit');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('editview', 'view'));
require_once('template.php');
......
......@@ -31,6 +31,10 @@
// which are collapsed when access to the view is edited
define('INTERNAL', 1);
define('MENUITEM', 'view');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'view');
define('SECTION_PAGE', 'editaccess');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('editaccess', 'view'));
require_once('pieforms/pieform.php');
......
......@@ -26,7 +26,10 @@
define('INTERNAL', 1);
define('MENUITEM', 'myviews');
// define('SUBMENUITEM', 'mygroups');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'view');
define('SECTION_PAGE', 'editmetadata');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('editmetadata', 'view'));
require_once('pieforms/pieform.php');
......
......@@ -26,6 +26,11 @@
define('INTERNAL', 1);
define('MENUITEM', 'myviews');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'view');
define('SECTION_PAGE', 'index');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('myviews'));
......
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