[MRM-1639] History navigation

Submitted by Eric Barboni.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1359579 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-07-10 10:39:29 +00:00
parent 02911adccc
commit 94489731e3
5 changed files with 2127 additions and 101 deletions

View File

@ -32,6 +32,7 @@
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="js/sammy.0.7.1.js"></script>
<script type="text/javascript" src="js/require.2.0.2.js"></script>
@ -102,6 +103,10 @@
require.config({
baseUrl: "js/",
urlArgs: ""+appendJsNoCacheUrl(),
shim: {
'sammy':['jquery'],
'archiva.main':["jquery","sammy"]
},
paths: {
"i18n":"jquery.i18n.properties-1.0.9",
"jquery": "jquery-1.7.2",
@ -124,6 +129,7 @@
"jquery.fileupload.ui":"jquery.fileupload-ui-6.6.3",
"tmpl": "tmpl.min",
"prettify": "prettify",
"sammy": "sammy.0.7.1",
"jqueryFileTree": "jqueryFileTree-1.0.1",
"redback": "redback/redback",
"redback.roles": "redback/roles",
@ -145,7 +151,7 @@
require(['domReady!','jquery','i18n','startup'], function (domReady) {
require(['jquery','i18n','sammy','startup','domReady!'], function (domReady) {
loadi18n(function () {
$.ajax({
url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(),
@ -155,7 +161,7 @@
window.archivaJavascriptLog=data.javascriptLog;
window.archivaRuntimeInfo=data;
require(['domReady!','archiva.main'],function (domReady) {
require(['sammy','archiva.main','domReady!'],function (domReady) {
$.log("startArchivaApplication");
startArchivaApplication();
$("#loadingDiv").hide();

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
define("archiva.main",["jquery","jquery.ui","jquery.cookie","bootstrap","archiva.search",
define("archiva.main",["jquery","sammy","jquery.ui","jquery.cookie","bootstrap","archiva.search",
"jquery.validate","jquery.json","knockout","redback.templates","archiva.templates",
"redback.roles","redback","archiva.general-admin","archiva.repositories",
"archiva.network-proxies","archiva.proxy-connectors","archiva.repository-groups","archiva.artifacts-management"],
@ -291,22 +291,69 @@ function() {
}
MainMenuViewModel=function() {
var self = this;
this.artifactMenuItems = [
{ text : $.i18n.prop('menu.artifacts') , id: null},
{ text : $.i18n.prop('menu.artifacts.search') , id: "menu-find-search-a", href: "#Search" , func: function(){displaySearch(this)}},
{ text : $.i18n.prop('menu.artifacts.browse') , id: "menu-find-browse-a", href: "#Browse" , func: function(){displayBrowse(true)}},
{ text : $.i18n.prop('menu.artifacts.upload') , id: "menu-find-upload-a", href: "#Upload" , redback: "{permissions: ['archiva-upload-repository']}", func: function(){displayUploadArtifact(true)}}
];
this.administrationMenuItems = [
{ text : $.i18n.prop('menu.administration') , id: null},
{ text : $.i18n.prop('menu.repository.groups') , id: "mmenu-repository-groups-list-a" , href: "#RepositoryGroup" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoryGroups()}},
{ text : $.i18n.prop('menu.repositories') , id: "menu-repositories-list-a" , href: "#RepositoryList" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoriesGrid()}},
{ text : $.i18n.prop('menu.proxy-connectors') , id: "menu-proxy-connectors-list-a" , href: "#ProxyConnectors" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayProxyConnectors()}},
{ text : $.i18n.prop('menu.network-proxies') , id: "menu-network-proxies-list-a" , href: "#NetProxies" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayNetworkProxies()}},
{ text : $.i18n.prop('menu.legacy-artifact-support') , id: "menu-legacy-support-list-a" , href: "#Legacy" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayLegacyArtifactPathSupport()}},
{ text : $.i18n.prop('menu.repository-scanning') , id: "menu-repository-scanning-list-a" , href: "#ScanningList" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoryScanning()}},
{ text : $.i18n.prop('menu.network-configuration') , id: "menu-network-configuration-list-a" , href: "#Network" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayNetworkConfiguration()}},
{ text : $.i18n.prop('menu.system-status') , id: "menu-system-status-list-a" , href: "#Status" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displaySystemStatus()}},
{ text : $.i18n.prop('menu.appearance-configuration') , id: "menu-appearance-list-a" , href: "#Appearance" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayAppearanceConfiguration()}},
{ text : $.i18n.prop('menu.ui-configuration') , id: "menu-ui-configuration-list-a" , href: "#UIConfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayUiConfiguration()}}
]
this.usersMenuItems = [
{ text : $.i18n.prop('menu.users') , id: null},
{ text : $.i18n.prop('menu.users.manage') , id: "menu-users-list-a", href: "#Users" , redback: "{permissions: ['archiva-manage-users']}", func: function(){displayUsersGrid()}},
{ text : $.i18n.prop('menu.users.roles') , id: "menu-roles-list-a", href: "#Roles" , redback: "{permissions: ['archiva-manage-users']}", func: function(){displayRolesGrid()}}
]
this.activeMenuId = ko.observable();
Sammy(function () {
this.get('#:folder', function () {
self.activeMenuId(this.params.folder);
ko.utils.arrayFirst(self.artifactMenuItems.concat(self.usersMenuItems, self.administrationMenuItems), function(p) {
if ( p.href == "#"+self.activeMenuId()) {
p.func();
}
});
});
this.get('', function () { this.app.runRoute('get', '#Search') });
} ).run();
}
startArchivaApplication=function(){
$.log("startArchivaApplication");
$('#topbar-menu-container').html($("#topbar_menu_tmpl" ).tmpl());
$('#sidebar-content').html($("#main_menu_tmpl").tmpl());
ko.bindingHandlers.redbackP = {
init: function(element, valueAccessor) {
$(element).attr("redback-permissions",valueAccessor);
}
};
ko.applyBindings(new MainMenuViewModel());
hideElementWithKarma();
checkSecurityLinks();
checkCreateAdminLink();
$('#footer-content').html($('#footer-tmpl').tmpl(window.archivaRuntimeInfo));
// create handlers on menu entries to add class active on click
var alinkNodes=$("#sidebar-content #main-menu").find("li a");
alinkNodes.on("click",function(){
alinkNodes.parent("li").removeClass("active");
$(this).parent("li").addClass("active");
})
$( "#quick-search-autocomplete" ).autocomplete({
minLength: 3,

View File

@ -17,7 +17,7 @@
* under the License.
*/
define("startup",["jquery","utils"],
define("startup",["jquery","sammy","utils"],
function() {
// define a container object with various datas

File diff suppressed because it is too large Load Diff

View File

@ -19,68 +19,38 @@
<script type="text/html" id="main_menu_tmpl">
<div id="main-menu">
<ul class="nav nav-list">
<li class="nav-header archiva-nav-header">${$.i18n.prop('menu.artifacts')}</li>
<li>
<a href="#" id="menu-find-search-a" onclick="displaySearch(this)">${$.i18n.prop('menu.artifacts.search')}</a>
<ul class="nav nav-list" data-bind="foreach: artifactMenuItems">
<!-- ko ifnot: id -->
<li class="nav-header archiva-nav-header" data-bind="text: text"></li>
<!-- /ko -->
<!-- ko if: id -->
<li data-bind='redbackP: $data.redback, css: { active: $data.href == "#"+$root.activeMenuId() }'>
<a data-bind="text: text, attr: { id: id, href: href}"></a>
</li>
<li>
<a href="#" id="menu-find-browse-a" onclick="displayBrowse(true)">${$.i18n.prop('menu.artifacts.browse')}</a>
</li>
<li>
<a href="#" id="menu-find-upload-a" redback-permissions="{permissions: ['archiva-upload-repository']}" onclick="displayUploadArtifact(true)">
${$.i18n.prop('menu.artifacts.upload')}
</a>
</li>
</ul>
<ul class="nav nav-list" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<li class="nav-header archiva-nav-header">${$.i18n.prop('menu.administration')}</li>
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-repository-groups-list-a" onclick="displayRepositoryGroups()">${$.i18n.prop('menu.repository.groups')}</a>
</li>
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-repositories-list-a" onclick="displayRepositoriesGrid()">${$.i18n.prop('menu.repositories')}</a>
</li>
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-proxy-connectors-list-a" onclick="displayProxyConnectors()">${$.i18n.prop('menu.proxy-connectors')}</a>
</li>
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-network-proxies-list-a" onclick="displayNetworkProxies()">${$.i18n.prop('menu.network-proxies')}</a>
</li>
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-legacy-support-list-a" onclick="displayLegacyArtifactPathSupport()">${$.i18n.prop('menu.legacy-artifact-support')}</a>
</li>
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-repository-scanning-list-a" onclick="displayRepositoryScanning()">${$.i18n.prop('menu.repository-scanning')}</a>
</li>
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-network-configuration-list-a" onclick="displayNetworkConfiguration()">${$.i18n.prop('menu.network-configuration')}</a>
</li>
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-system-status-list-a" onclick="displaySystemStatus()">${$.i18n.prop('menu.system-status')}</a>
</li>
<li style="display:none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-appearance-list-a" onclick="displayAppearanceConfiguration()">${$.i18n.prop('menu.appearance-configuration')}</a>
</li>
<li style="display:none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-ui-configuration-list-a" onclick="displayUiConfiguration()">${$.i18n.prop('menu.ui-configuration')}</a>
</li>
<li style="display:none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-report-list-a" onclick="displayReportsPage()">${$.i18n.prop('menu.reports')}</a>
</li>
<!-- /ko -->
</ul>
<ul class="nav nav-list" redback-permissions="{permissions: ['archiva-manage-users']}">
<li class="nav-header">${$.i18n.prop('menu.users')}</li>
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-users']}">
<a href="#" id="menu-users-list-a" onclick="displayUsersGrid()">${$.i18n.prop('menu.users.manage')}</a>
<ul class="nav nav-list" redback-permissions="{permissions: ['archiva-manage-configuration']}" data-bind="foreach: administrationMenuItems">
<!-- ko ifnot: id -->
<li class="nav-header archiva-nav-header" data-bind="text: text"></li>
<!-- /ko -->
<!-- ko if: id -->
<li data-bind='redbackP: $data.redback, css: { active: $data.href == "#"+$root.activeMenuId() }'>
<a data-bind="text: text, attr: { id: id, href: href}"></a>
</li>
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-users']}">
<a href="#" id="menu-roles-list-a" onclick="displayRolesGrid()">${$.i18n.prop('menu.users.roles')}</a>
<!-- /ko -->
</ul>
<ul class="nav nav-list" redback-permissions="{permissions: ['archiva-manage-users']}" data-bind="foreach: usersMenuItems">
<!-- ko ifnot: id -->
<li class="nav-header archiva-nav-header" data-bind="text: text"></li>
<!-- /ko -->
<!-- ko if: id -->
<li data-bind='redbackP: $data.redback, css: { active: $data.href == "#"+$root.activeMenuId() }'>
<a data-bind="text: text, attr: { id: id, href: href}"></a>
</li>
<!-- /ko -->
</ul>
</div>