Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several changes to #2

Open
wants to merge 20 commits into
base: pkp/pkp-lib#2178-add-nav-menu-manage
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4caf3d6
pkp/pkp-lib#2178 NavigationMenu Added
defstat May 5, 2017
5fb7b37
pkp/pkp-lib#2178 minifiedScripts.txt changed
defstat Jun 12, 2017
c641f43
pkp/pkp-lib#2178 Handler name changed
defstat Jun 19, 2017
f9ed186
pkp/pkp-lib#2178 DB code implemented for navigationMenus
defstat Jun 19, 2017
33967f7
pkp/pkp-lib#2178 Add nav menu JS form handler
NateWr Jun 26, 2017
a04bd28
pkp/pkp-lib#2178 Default NavigationMenus support added
defstat Jul 7, 2017
159688b
pkp/pkp-lib#2178 Default NavigationMenuItems support added
defstat Jul 7, 2017
60955b4
pkp/pkp-lib#2178 NavigationMenus delete process added
defstat Jul 8, 2017
dcb6834
pkp/pkp-lib#2178 is_default bug fixed
defstat Jul 8, 2017
b35ebb4
pkp/pkp-lib#2178 Add default menu-areas to default navigationMenus
defstat Jul 8, 2017
b95948d
pkp/pkp-lib#2178 Add default navigationMenuItem Assignment support
defstat Jul 8, 2017
5ce6f53
pkp/pkp-lib#2178 Add default_id to NMIs
defstat Jul 9, 2017
226251a
pkp/pkp-lib#2178 Add support for announcements NMI
defstat Jul 9, 2017
3b441d1
pkp/pkp-lib#2178 Add default NavigationMenus and NavifationMenuItems …
defstat Sep 1, 2017
3db2d53
pkp/pkp-lib#2178 NavigationMenuItem Type added
defstat Aug 3, 2017
64f660b
pkp/pkp-lib#2178 NavigationMenuItem Type added
defstat Sep 17, 2017
85faaf5
XML dtd definition fix
defstat Sep 23, 2017
1949252
pkp/pkp-lib#2178 Add support for Site level NavigationMenu feature
defstat Sep 24, 2017
4798da1
Merge branch 'pkp/pkp-lib#2178-add-nav-menu-manage' of https://github…
NateWr Sep 26, 2017
f4d59f6
pkp/pkp-lib#2178 Several changes to nav menus.
NateWr Sep 28, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions classes/install/Upgrade.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2371,6 +2371,7 @@ function enabledSitePlugins() {
$result = $pluginSettings->update('DELETE FROM plugin_settings WHERE plugin_name = ? AND setting_name = \'enabled\' AND context_id <> 0', array($pluginName));
}
}

return true;
}

Expand Down Expand Up @@ -2430,7 +2431,22 @@ function moveCSSFiles() {
return true;
}

/**
* For 3.1.0 upgrade. DefaultMenus Defaults
*/
function installDefaultNavigationMenus() {
$journalDao = DAORegistry::getDAO('JournalDAO');
$navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO');

$journals = $journalDao->getAll();
while ($journal = $journals->next()) {
$navigationMenuDao->installSettings($journal->getId(), 'registry/navigationMenus.xml');
}

$navigationMenuDao->installSettings(CONTEXT_ID_NONE, 'registry/navigationMenus.xml');

return true;
}
}

?>
10 changes: 10 additions & 0 deletions classes/journal/JournalDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ function deleteById($journalId) {
$reviewFormDao = DAORegistry::getDAO('ReviewFormDAO');
$reviewFormDao->deleteByAssoc(ASSOC_TYPE_JOURNAL, $journalId);

// NavigationMenus
// TODO: when the NavigationMenu feature gets ported to OMP we could add the code to ContextDAO
$navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO');
$navigationMenuDao->deleteByContextId($journalId);

// NavigationMenuItems
// TODO: when the NavigationMenu feature gets ported to OMP we could add the code to ContextDAO
$navigationMenuItemDao = DAORegistry::getDAO('NavigationMenuItemDAO');
$navigationMenuItemDao->deleteByContextId($journalId);

parent::deleteById($journalId);
}

Expand Down
5 changes: 5 additions & 0 deletions classes/services/OJSServiceProvider.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,10 @@ public function register(Container $pimple) {
$pimple['section'] = function() {
return new SectionService();
};

// NavigationMenus service
$pimple['navigationMenu'] = function() {
return new \PKP\Services\NavigationMenuService();
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ function execute() {
$sectionDao->insertObject($section);

$journal->updateSetting('supportedLocales', $site->getSupportedLocales());

// load default navigationMenus.
$this->_loadDefaultNavigationMenus($journalId);

}
$journal->updateSetting('name', $this->getData('name'), 'string', true);
$journal->updateSetting('description', $this->getData('description'), 'string', true);
Expand Down
1 change: 1 addition & 0 deletions controllers/tab/settings/WebsiteSettingsTabHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function __construct() {
'languages' => 'controllers/tab/settings/languages/languages.tpl',
'plugins' => 'controllers/tab/settings/plugins/plugins.tpl',
'announcements' => 'lib.pkp.controllers.tab.settings.announcements.form.AnnouncementSettingsForm',
'navigationMenus' => 'lib.pkp.controllers.tab.settings.navigationMenus.form.NavigationMenuSettingsForm'
));
}

Expand Down
2 changes: 2 additions & 0 deletions dbscripts/xml/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<schema file="lib/pkp/xml/schema/metrics.xml" />
<schema file="lib/pkp/xml/schema/views.xml" />
<schema file="lib/pkp/xml/schema/libraryFiles.xml" />
<schema file="lib/pkp/xml/schema/navigationMenus.xml" />

<!-- OJS schema -->
<schema file="dbscripts/xml/ojs_schema.xml" />
Expand All @@ -45,4 +46,5 @@
<code function="createData"/>
<code function="createConfig"/>
<code function="addPluginVersions"/>
<code function="installDefaultNavigationMenus"/>
</install>
2 changes: 2 additions & 0 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<schema file="lib/pkp/xml/schema/metrics.xml" />
<schema file="lib/pkp/xml/schema/views.xml" />
<schema file="lib/pkp/xml/schema/libraryFiles.xml" />
<schema file="lib/pkp/xml/schema/navigationMenus.xml" />

<!-- OJS schema -->
<schema file="dbscripts/xml/ojs_schema.xml" />
Expand Down Expand Up @@ -172,6 +173,7 @@
<note file="docs/release-notes/README-3.1.0" />
<code function="installEmailTemplate" key="EDITOR_DECISION_INITIAL_DECLINE" locales="en_US" />
<code function="installEmailTemplate" key="EDITOR_RECOMMENDATION" locales="en_US" />
<code function="installDefaultNavigationMenus" />
</upgrade>

<!-- update plugin configuration - should be done as the final upgrade task -->
Expand Down
29 changes: 29 additions & 0 deletions plugins/themes/default/DefaultThemePlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,37 @@ public function init() {

// Load custom JavaScript for this theme
$this->addScript('default', 'js/main.js');

// Register navigationMenuItem Types
HookRegistry::register('NavigationMenus::displayType', array($this, 'registerNavigationMenuItemTypesDisplay'));
}

function registerNavigationMenuItemTypesDisplay($hookName, $args) {
$type = $args[1];
$display =& $args[0];
$display = false;
return $display;
}

function getNavigationMenuItemTypes() {
$request = Application::getRequest();
$router = $request->getRouter();
$context = $request->getContext();
$dispatcher = $router->getDispatcher();

if ($dispatcher) {
return array( // none and custom should be elsewhere - more centrally
"" => 'none',
$dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'issue', 'archive') => 'archiveIssue',
$dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'issue', 'current') => 'currentIssue',
'custom' => "custom",
);
} else {
return array();
}
}


/**
* Get the name of the settings file to be installed on new journal
* creation.
Expand Down
2 changes: 2 additions & 0 deletions registry/minifiedScripts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ lib/pkp/js/controllers/wizard/fileUpload/FileUploadWizardHandler.js
lib/pkp/js/controllers/wizard/fileUpload/form/FileUploadFormHandler.js
lib/pkp/js/controllers/wizard/fileUpload/form/RevisionConfirmationHandler.js
lib/pkp/js/controllers/grid/filter/form/FilterFormHandler.js
lib/pkp/js/controllers/grid/navigationMenus/form/NavigationMenuFormHandler.js
lib/pkp/js/controllers/grid/navigationMenus/form/NavigationMenuItemsFormHandler.js
lib/pkp/js/controllers/grid/representations/form/RepresentationFormHandler.js
lib/pkp/js/controllers/grid/settings/user/form/UserDetailsFormHandler.js
lib/pkp/js/controllers/grid/settings/roles/form/UserGroupFormHandler.js
Expand Down
40 changes: 40 additions & 0 deletions registry/navigationMenus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
* registry/navigationMenus.xml
*
* Copyright (c) 2014-2017 Simon Fraser University
* Copyright (c) 2003-2017 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* Default NavigationMenus XML file.
*
-->

<!DOCTYPE navigationMenus SYSTEM "../lib/pkp/dtd/navigationMenus.dtd">

<navigationMenus>
<navigationMenu title="User" area="user" site="1">
<navigationMenuItem title="navigation.register" type="NMI_TYPE_USER_REGISTER" site="1" />
<navigationMenuItem title="navigation.login" type="NMI_TYPE_USER_LOGIN" site="1" />

<navigationMenuItem title="loggedInUsername" type="NMI_TYPE_USER_DASHBOARD" site="1">
<navigationMenuItem title="navigation.dashboard" type="NMI_TYPE_USER_DASHBOARD" site="1" />
<navigationMenuItem title="common.viewProfile" type="NMI_TYPE_USER_PROFILE" site="1" />
<navigationMenuItem title="navigation.admin" type="NMI_TYPE_ADMINISTRATION" site="1" />
<navigationMenuItem title="user.logOut" type="NMI_TYPE_USER_LOGOUT" site="1" />
</navigationMenuItem>
</navigationMenu>

<navigationMenu title="Primary" area="primary">
<navigationMenuItem title="navigation.current" type="NMI_TYPE_CURRENT" />
<navigationMenuItem title="navigation.archives" type="NMI_TYPE_ARCHIVES" />
<navigationMenuItem title="manager.announcements" type="NMI_TYPE_ANNOUNCEMENTS" />
<navigationMenuItem title="navigation.about" type="NMI_TYPE_ABOUT">
<navigationMenuItem title="about.aboutContext" type="NMI_TYPE_ABOUT" />
<navigationMenuItem title="navigation.submissions" type="NMI_TYPE_SUBMISSIONS" />
<navigationMenuItem title="about.editorialTeam" type="NMI_TYPE_EDITORIAL_TEAM" />
<navigationMenuItem title="about.contact" type="NMI_TYPE_CONTACT" />
</navigationMenuItem>
</navigationMenu>
</navigationMenus>
1 change: 1 addition & 0 deletions templates/admin/settings.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<li><a name="siteSetup" href="{url router=$smarty.const.ROUTE_COMPONENT component="tab.settings.AdminSettingsTabHandler" op="showTab" tab="siteSetup"}">{translate key="admin.siteSetup"}</a></li>
<li><a name="adminLanguages" href="{url router=$smarty.const.ROUTE_COMPONENT component="tab.settings.AdminSettingsTabHandler" op="showTab" tab="languages"}">{translate key="common.languages"}</a></li>
<li><a name="adminPlugins" href="{url router=$smarty.const.ROUTE_COMPONENT component="tab.settings.AdminSettingsTabHandler" op="showTab" tab="plugins"}">{translate key="common.plugins"}</a></li>
<li><a href="{url router=$smarty.const.ROUTE_COMPONENT component="tab.settings.AdminSettingsTabHandler" op="showTab" tab="navigationMenus"}">{translate key="manager.navigationMenus"}</a></li>
</ul>
</div>

Expand Down
1 change: 1 addition & 0 deletions templates/management/settings/website.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<li><a href="{url router=$smarty.const.ROUTE_COMPONENT component="tab.settings.WebsiteSettingsTabHandler" op="showTab" tab="languages"}">{translate key="common.languages"}</a></li>
<li><a name="plugins" href="{url router=$smarty.const.ROUTE_COMPONENT component="tab.settings.WebsiteSettingsTabHandler" op="showTab" tab="plugins"}">{translate key="common.plugins"}</a></li>
<li><a href="{url router=$smarty.const.ROUTE_COMPONENT component="tab.settings.WebsiteSettingsTabHandler" op="showTab" tab="announcements"}">{translate key="manager.announcements"}</a>
<li><a href="{url router=$smarty.const.ROUTE_COMPONENT component="tab.settings.WebsiteSettingsTabHandler" op="showTab" tab="navigationMenus"}">{translate key="manager.navigationMenus"}</a>
{call_hook name="Templates::Management::Settings::website"}
</ul>
</div>
Expand Down