Commit 91747fb7 authored by Robert Lyon's avatar Robert Lyon

Bug 1782954: Adding new menu layout

behatnotneeded

Change-Id: I523b7989df426670690b0a086c553149dba26d84
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 0401ddc9
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups/institutions');
define('MENUITEM', 'engage/institutions');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'account');
define('SECTION_PAGE', 'institutions');
......
......@@ -275,6 +275,7 @@ JS;
}
$smarty = smarty(array('paginator','js/chartjs/Chart.min.js'));
setpageicon($smarty, 'icon-pie-chart');
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('institutiondata', $institutiondata);
$smarty->assign('type', $type);
......
......@@ -69,7 +69,7 @@ class PluginArtefactBlog extends PluginArtefact {
define('MENUITEM', 'groups/blogs');
}
else {
define('MENUITEM', 'content/blogs');
define('MENUITEM', 'create/blogs');
}
}
......@@ -80,12 +80,12 @@ class PluginArtefactBlog extends PluginArtefact {
public static function menu_items() {
global $USER;
$tab = array(
'path' => 'content/blogs',
'weight' => 40,
'path' => 'create/blogs',
'weight' => 30,
'url' => 'artefact/blog/index.php',
'title' => get_string('Blogs', 'artefact.blog'),
);
return array('content/blogs' => $tab);
return array('create/blogs' => $tab);
}
public static function get_cron() {
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'content/files');
define('MENUITEM', 'create/files');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('artefact', 'file');
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'content/files');
define('MENUITEM', 'create/files');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'file');
define('SECTION_PAGE', 'index');
......
......@@ -37,17 +37,23 @@ class PluginArtefactFile extends PluginArtefact {
public static function menu_items() {
return array(
'content/files' => array(
'path' => 'content/files',
'create/files' => array(
'path' => 'create/files',
'url' => 'artefact/file/index.php',
'title' => get_string('Files', 'artefact.file'),
'weight' => 30,
'weight' => 20,
),
'content/profileicons' => array(
'path' => 'content/profileicons',
);
}
public static function right_nav_menu_items() {
return array(
'profileicons' => array(
'path' => 'profileicons',
'url' => 'artefact/file/profileicons.php',
'title' => get_string('profileicons', 'artefact.file'),
'weight' => 20,
'weight' => 15,
'iconclass' => 'id-badge',
),
);
}
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'content/profileicons');
define('MENUITEM', 'profileicons');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'file');
define('SECTION_PAGE', 'profileicons');
......
......@@ -38,7 +38,7 @@ else if ($institution = $artefact->get('institution')) {
$goto .= '?institution=' . $institution;
}
else {
define('MENUITEM', 'content/notes');
define('MENUITEM', 'create/notes');
}
$folder = param_integer('folder', 0);
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'content/profile');
define('MENUITEM', 'profile');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'internal');
define('SECTION_PAGE', 'index');
......
......@@ -112,19 +112,25 @@ class PluginArtefactInternal extends PluginArtefact {
return get_field('artefact_installed', 'active', 'name', 'internal');
}
public static function menu_items() {
public static function right_nav_menu_items() {
return array(
'content/profile' => array(
'path' => 'content/profile',
'profile' => array(
'path' => 'profile',
'url' => 'artefact/internal/index.php',
'title' => get_string('profile', 'artefact.internal'),
'weight' => 10,
'iconclass' => 'id-card-o',
),
'content/notes' => array(
'path' => 'content/notes',
);
}
public static function menu_items() {
return array(
'create/notes' => array(
'path' => 'create/notes',
'url' => 'artefact/internal/notes.php',
'title' => get_string('Notes', 'artefact.internal'),
'weight' => 60,
'weight' => 40,
),
);
}
......
......@@ -56,7 +56,7 @@ else if ($institution = param_alpha('institution', null)) {
$params['institution'] = $institution;
}
else {
define('MENUITEM', 'content/notes');
define('MENUITEM', 'create/notes');
$pageheading = get_string('mynotes', 'artefact.internal');
$where = 'owner = ?';
$values = array($USER->get('id'));
......
......@@ -56,7 +56,7 @@ else if ($institution = param_alpha('institution', null)) {
$params['institution'] = $institution;
}
else {
define('MENUITEM', 'content/notes');
define('MENUITEM', 'create/notes');
$pageheading = get_string('mynotes', 'artefact.internal');
$where = 'owner = ?';
$values = array($USER->get('id'));
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', true);
define('MENUITEM', 'content/plans');
define('MENUITEM', 'create/plans');
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
safe_require('artefact','plans');
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', true);
define('MENUITEM', 'content/plans');
define('MENUITEM', 'create/plans');
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
safe_require('artefact','plans');
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', true);
define('MENUITEM', 'content/plans');
define('MENUITEM', 'create/plans');
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
require_once('pieforms/pieform/elements/calendar.php');
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', true);
define('MENUITEM', 'content/plans');
define('MENUITEM', 'create/plans');
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
require_once('pieforms/pieform/elements/calendar.php');
......
......@@ -11,7 +11,7 @@
define('INTERNAL', 1);
define('MENUITEM', 'content/plans');
define('MENUITEM', 'create/plans');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'plans');
define('SECTION_PAGE', 'index');
......
......@@ -34,11 +34,11 @@ class PluginArtefactPlans extends PluginArtefact {
public static function menu_items() {
return array(
'content/plans' => array(
'path' => 'content/plans',
'create/plans' => array(
'path' => 'create/plans',
'url' => 'artefact/plans/index.php',
'title' => get_string('Plans', 'artefact.plans'),
'weight' => 60,
'weight' => 50,
),
);
}
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'content/plans');
define('MENUITEM', 'create/plans');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'plans');
......
......@@ -11,7 +11,7 @@
define('INTERNAL', 1);
define('MENUITEM', 'content/plans');
define('MENUITEM', 'create/plans');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'plans');
define('SECTION_PAGE', 'plans');
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', true);
define('MENUITEM', 'content/resume');
define('MENUITEM', 'create/resume');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'resume');
define('SECTION_PAGE', 'index');
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', true);
define('MENUITEM', 'content/resume');
define('MENUITEM', 'create/resume');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'resume');
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', true);
define('MENUITEM', 'content/resume');
define('MENUITEM', 'create/resume');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'resume');
define('RESUME_SUBPAGE', 'goalsandskills');
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', true);
define('MENUITEM', 'content/resume');
define('MENUITEM', 'create/resume');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'resume');
define('SECTION_PAGE', 'index');
......
......@@ -9,7 +9,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'content/resume');
define('MENUITEM', 'create/resume');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'resume');
define('SECTION_PAGE', 'index');
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', true);
define('MENUITEM', 'content/resume');
define('MENUITEM', 'create/resume');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'resume');
define('SECTION_PAGE', 'index');
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', true);
define('MENUITEM', 'content/resume');
define('MENUITEM', 'create/resume');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'resume');
define('SECTION_PAGE', 'index');
......
......@@ -47,11 +47,11 @@ class PluginArtefactResume extends PluginArtefact {
public static function menu_items() {
return array(
'content/resume' => array(
'path' => 'content/resume',
'create/resume' => array(
'path' => 'create/resume',
'title' => get_string('resume', 'artefact.resume'),
'url' => 'artefact/resume/index.php',
'weight' => 50,
'weight' => 60,
),
);
}
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', true);
define('MENUITEM', 'content/resume');
define('MENUITEM', 'create/resume');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'resume');
define('SECTION_PAGE', 'index');
......
......@@ -115,6 +115,7 @@ class PluginAuthWebservice extends PluginAuth {
'title' => get_string('webservice', 'auth.webservice'),
'weight' => 75,
'accesskey' => 'w',
'iconclass' => 'puzzle-piece',
),
'webservices/config' => array(
'path' => 'webservices/config',
......
......@@ -47,7 +47,7 @@ else if (!empty($institutionname)) {
$urlparams['institution'] = $institutionname;
}
else {
define('MENUITEM', 'myportfolio/views');
define('MENUITEM', 'create/views');
$baseurl = get_config('wwwroot') . 'view/index.php';
}
define('TITLE', $collection->get('name'));
......
......@@ -71,7 +71,7 @@ else if (!empty($institutionname)) {
$urlparams['institution'] = $institutionname;
}
else {
define('MENUITEM', 'myportfolio/views');
define('MENUITEM', 'create/views');
define('TITLE', get_string('editcollection', 'collection'));
$baseurl = get_config('wwwroot') . 'view/index.php';
}
......
......@@ -79,7 +79,7 @@ else if (!empty($institutionname)) {
$urlparams['institution'] = $institutionname;
}
else {
define('MENUITEM', 'myportfolio/views');
define('MENUITEM', 'create/views');
define('TITLE', get_string('editviews', 'collection'));
$baseurl = get_config('wwwroot') . 'view/index.php';
}
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'myportfolio/export');
define('MENUITEM', 'manage/export');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once('view.php');
require_once('collection.php');
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups/find');
define('MENUITEM', 'engage/find');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('findgroups'));
require_once('group.php');
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups/mygroups');
define('MENUITEM', 'engage/mygroups');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('mygroups'));
define('SECTION_PLUGINTYPE', 'core');
......
......@@ -30,7 +30,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'myportfolio/import');
define('MENUITEM', 'manage/import');
require(dirname(dirname(__FILE__)) . '/init.php');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'import');
......
......@@ -378,8 +378,8 @@ EOF;
public static function menu_items() {
return array(
'groups/topics' => array(
'path' => 'groups/topics',
'engage/topics' => array(
'path' => 'engage/topics',
'url' => 'group/topics.php',
'title' => get_string('Topics', 'interaction.forum'),
'weight' => 70,
......
......@@ -1101,3 +1101,14 @@ jQuery(function($) {
});
}
});
/**
* Wire up menu so that links with submenu but no url just toggle the child collapse
*/
jQuery(function($) {
$('nav .menu-dropdown-toggle').on('click', function(e) {
e.stopPropagation();
e.preventDefault();
$(this).next().trigger('click');
});
});
......@@ -768,6 +768,9 @@ $string['overview'] = 'Overview';
$string['home'] = 'Home';
$string['Content'] = 'Content';
$string['myportfolio'] = 'Portfolio';
$string['Create'] = 'Create';
$string['Engage'] = 'Engage';
$string['Manage'] = 'Manage';
$string['settings'] = 'Settings';
$string['myfriends'] = 'My friends';
$string['findpeople'] = 'Find people';
......
......@@ -5991,10 +5991,10 @@ class View {
define('MENUITEM', $share ? 'manageinstitutions/share' : 'manageinstitutions/institutionviews');
}
else if ($collection) {
define('MENUITEM', 'myportfolio/collection');
define('MENUITEM', 'create/views');
}
else {
define('MENUITEM', $share ? 'myportfolio/share' : 'myportfolio/views');
define('MENUITEM', $share ? 'engage/share' : 'create/views');
}
}
......@@ -6014,7 +6014,7 @@ class View {
define('MENUITEM', 'manageinstitutions/institutionviews');
}
else {
define('MENUITEM', 'myportfolio/views');
define('MENUITEM', 'create/views');
}
}
......
This diff is collapsed.
......@@ -33,7 +33,8 @@ if ($readone) {
}
$unread = $USER->add_unread(-1);
$data = array(
'newunreadcount' => $unread
'newunreadcount' => $unread,
'newunreadcounttext' => get_string('unread', 'mahara', $unread)
);
json_reply(false, array('data' => $data));
}
......@@ -139,6 +140,7 @@ $newhtml = activitylistin_html($type, $limit, $offset);
if (isset($newunread)) {
$newhtml['newunreadcount'] = $newunread;
$newhtml['newunreadcounttext'] = get_string('unread', 'mahara', $newunread);
}
json_reply(false, (object) array('message' => $message, 'data' => $newhtml));
......@@ -52,7 +52,7 @@ class PluginModuleMultirecipientnotification extends PluginModule {
*
* @return array fully descripted new menuitems with menupath, title, url, etc.
*/
public static function right_nav_menu_items() {
public static function messages_menu_items() {
global $USER;
global $THEME;
safe_require('notification', 'internal');
......@@ -67,6 +67,7 @@ class PluginModuleMultirecipientnotification extends PluginModule {
'count' => $unread,
'unread' => get_string('unread', 'mahara', $unread),
'countclass' => 'unreadmessagecount',
'countclasssr' => 'unreadmessagecount-sr',
'linkid' => 'mail',
'weight' => 20,
'iconclass' => 'envelope'
......
......@@ -33,13 +33,11 @@ if ($designsiteskin) {
redirect();
}
define('MENUITEM', 'configsite/siteskins');
$goto = '/admin/site/skins.php';
$redirect = '/admin/site/skins.php';
$goto = get_config('wwwroot') . 'admin/site/skins.php';
}
else {
define('MENUITEM', 'myportfolio/skins');
$goto = '/skin/index.php';
$redirect = '/skin/index.php';
define('MENUITEM', 'create/skins');
$goto = get_config('wwwroot') . 'skin/index.php';
}
$id = param_integer('id', 0); // id of Skin to be edited...
$skindata = null;
......@@ -331,7 +329,7 @@ $elements['submitform'] = array(
'type' => 'submitcancel',
'class' => 'btn-primary',
'value' => array(get_string('save', 'mahara'), get_string('cancel', 'mahara')),
'goto' => get_config('wwwroot') . $goto,
'goto' => $goto,
);
$designskinform = pieform(array(
......@@ -393,7 +391,7 @@ function designskinform_validate(Pieform $form, $values) {
}
function designskinform_submit(Pieform $form, $values) {
global $USER, $SESSION, $redirect;
global $USER, $SESSION;
$siteskin = (isset($values['viewskin_access']) && ($values['viewskin_access'] == 'site'));
// Only an admin can create a site skin
......@@ -432,12 +430,13 @@ function designskinform_submit(Pieform $form, $values) {
$viewskin['type'] = $values['viewskin_access'];
$viewskin['viewskin'] = $skin;
$submitelement = $form->get_element('submitform');
Skin::create($viewskin);
if ($form->submitted_by_js()) {
$result = array(
'error' => false,
'message' => get_string('skinsaved', 'skin'),
'goto' => $redirect,
'goto' => $submitelement['goto'],
);
// Redirect back to the page from within the iframe
$SESSION->add_ok_msg($result['message']);
......
......@@ -36,7 +36,7 @@ if ($importsiteskins) {
define('MENUITEM', 'configsite/siteskins');
}
else {
define('MENUITEM', 'myportfolio/myskins');
define('MENUITEM', 'create/skins');
}
$form = pieform(array(
......
......@@ -11,7 +11,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'myportfolio/skins');
define('MENUITEM', 'create/skins');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'skin');
define('SECTION_PAGE', 'index');
......
......@@ -76,13 +76,25 @@ class BehatNavigation extends BehatBase {
$exception = new ExpectationException('The sub menu item "' . $menuitemtext . '" not found or invisible in "' . $menu . '"', $this->getSession());
$xpath = "//nav[@id='" . $menu . "']" .
"//li[contains(normalize-space(.), " . $menuitemtextliteral .")]" .
"//a[normalize-space(.)=" . $submenuitemtextliteral ."]";
"/ul/li[contains(normalize-space(.), " . $menuitemtextliteral .")]" .
"//li//a[normalize-space(.)=" . $submenuitemtextliteral ."]";
$node = $this->find('xpath', $xpath, $exception);
return $node;
}
/**
* Choose inbox from menu
*
* @Given /^I choose inbox$/
*/
public function i_choose_inbox() {
$exception = new ExpectationException('The menu item inbox not found or invisible', $this->getSession());