mirror of https://github.com/apache/archiva.git
Merge archiva-MRM-1756 to trunk
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1488654 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
commit
71ab6d0e46
|
@ -0,0 +1,47 @@
|
|||
package org.apache.archiva.rest.api.services;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.redback.authorization.RedbackAuthorization;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
/**
|
||||
* contains some services for plugins
|
||||
*
|
||||
* @author Eric Barboni
|
||||
* @since 1.4-M4
|
||||
*/
|
||||
@Path( "/pluginsService/" )
|
||||
public interface PluginsService
|
||||
{
|
||||
|
||||
@Path( "getAdminPlugins" )
|
||||
@GET
|
||||
@Produces(
|
||||
{
|
||||
MediaType.TEXT_PLAIN
|
||||
} )
|
||||
@RedbackAuthorization( noRestriction = true )
|
||||
String getAdminPlugins()
|
||||
throws ArchivaRestServiceException;
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package org.apache.archiva.rest.services;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import org.apache.archiva.rest.api.services.PluginsService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
/**
|
||||
* @author Eric Barboni
|
||||
*/
|
||||
@Service( "pluginsService#rest" )
|
||||
public class DefaultPluginsServices
|
||||
implements PluginsService
|
||||
{
|
||||
|
||||
private List<String> repositoryType = new ArrayList<String>();
|
||||
private List<String> adminFeatures = new ArrayList<String>();
|
||||
private ApplicationContext appCont;
|
||||
private Logger log = LoggerFactory.getLogger( getClass() );
|
||||
|
||||
@Inject
|
||||
public DefaultPluginsServices( ApplicationContext applicationContext )
|
||||
{
|
||||
this.appCont = applicationContext;
|
||||
}
|
||||
|
||||
private void feed( List<String> repository, String key ) throws ArchivaRestServiceException
|
||||
{
|
||||
log.info( "Feeding: {}", key );
|
||||
repository.clear();
|
||||
Resource[] xmlResources;
|
||||
try
|
||||
{
|
||||
xmlResources = appCont.getResources( "/**/" + key + "/**/main.js" );
|
||||
for ( Resource rc : xmlResources )
|
||||
{
|
||||
String tmp = rc.getURL().toString();
|
||||
tmp = tmp.substring( tmp.lastIndexOf( key ) + key.length() + 1, tmp.length() - 8 );
|
||||
repository.add( "archiva/admin/" + key + "/" + tmp + "/main" );
|
||||
}
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
|
||||
throw new ArchivaRestServiceException( e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdminPlugins()
|
||||
throws ArchivaRestServiceException
|
||||
{
|
||||
// rebuild
|
||||
feed( repositoryType, "repository" );
|
||||
feed( adminFeatures, "features" );
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for ( String repoType : repositoryType )
|
||||
{
|
||||
sb.append( repoType ).append( "|" );
|
||||
}
|
||||
for ( String repoType : adminFeatures )
|
||||
{
|
||||
sb.append( repoType ).append( "|" );
|
||||
}
|
||||
log.debug( "getAdminPlugins: {}", sb.toString() );
|
||||
if ( sb.length() > 1 )
|
||||
{
|
||||
return sb.substring( 0, sb.length() - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -68,6 +68,7 @@
|
|||
<ref bean="searchService#rest"/>
|
||||
<ref bean="commonServices#rest"/>
|
||||
<ref bean="browseService#rest"/>
|
||||
<ref bean="pluginsService#rest"/>
|
||||
<ref bean="systemStatusService#rest"/>
|
||||
<ref bean="reportRepositoriesService#rest" />
|
||||
<ref bean="mergeRepositoriesService#rest"/>
|
||||
|
|
|
@ -53,6 +53,7 @@ import javax.ws.rs.core.MediaType;
|
|||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import org.apache.archiva.rest.api.services.PluginsService;
|
||||
|
||||
/**
|
||||
* @author Olivier Lamy
|
||||
|
@ -165,6 +166,14 @@ public abstract class AbstractArchivaRestTest
|
|||
{
|
||||
return getService( PingService.class, null );
|
||||
}
|
||||
|
||||
protected PluginsService getPluginsService()
|
||||
{
|
||||
PluginsService service = getService( PluginsService.class, null );
|
||||
WebClient.client( service ).accept( MediaType.TEXT_PLAIN );
|
||||
WebClient.client( service ).type( MediaType.TEXT_PLAIN );
|
||||
return service;
|
||||
}
|
||||
|
||||
protected RemoteRepositoriesService getRemoteRepositoriesService()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package org.apache.archiva.rest.services;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import org.apache.archiva.rest.api.services.PluginsService;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Olivier Lamy
|
||||
* @since 1.4-M1
|
||||
*/
|
||||
public class PluginServiceTest
|
||||
extends AbstractArchivaRestTest
|
||||
{
|
||||
|
||||
@Test
|
||||
public void testGetPluginAdmin()
|
||||
throws Exception
|
||||
{
|
||||
// 1000000L
|
||||
|
||||
PluginsService res = getPluginsService();
|
||||
String value = res.getAdminPlugins();
|
||||
assertEquals( "", value );
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<actions>
|
||||
<action>
|
||||
<actionName>CUSTOM-T</actionName>
|
||||
<displayName>T</displayName>
|
||||
<goals>
|
||||
<goal>tomcat7:run</goal>
|
||||
<goal>-pl</goal>
|
||||
<goal>:archiva-webapp</goal>
|
||||
<goal>-am</goal>
|
||||
</goals>
|
||||
</action>
|
||||
</actions>
|
|
@ -869,6 +869,7 @@
|
|||
<artifactId>apache-rat-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>nbactions.xml</exclude>
|
||||
<exclude>src/main/webapp/css/*.css</exclude>
|
||||
<exclude>src/main/webapp/js/*.js</exclude>
|
||||
<exclude>src/site/resources/css/*.css</exclude>
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
body {
|
||||
background-color: #a0a0a0;
|
||||
}
|
||||
/* medium-spinner */
|
||||
#medium-spinner {
|
||||
z-index: 20001;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery-ui-1.9.2.custom.min.js"></script>
|
||||
<script type="text/javascript" src="js/sammy.0.7.4.js"></script>
|
||||
<script type="text/javascript" data-main="js/archiva/archiva.js" src="js/require.2.1.5.js"></script>
|
||||
<script type="text/javascript" data-main="js/archiva/archiva.js" src="js/require.2.1.6.js"></script>
|
||||
|
||||
<title>Apache Archiva</title>
|
||||
|
||||
|
|
|
@ -16,288 +16,19 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout","knockout.simpleGrid",
|
||||
define("archiva/admin/features/generaladmin/main",["jquery","i18n","utils","jquery.tmpl","knockout","knockout.simpleGrid",
|
||||
"knockout.sortable","jquery.ui","jquery.validate","bootstrap","select2","knockout.select2"]
|
||||
, function(jquery,i18n,utils,jqueryTmpl,ko,simpleGrid,sortable,jqueryUi,validate,bootstrap,select2) {
|
||||
|
||||
//-------------------------
|
||||
// legacy path part
|
||||
//-------------------------
|
||||
|
||||
LegacyArtifactPath=function(path,groupId,artifactId,version,classifier,type,update){
|
||||
//private String path;
|
||||
this.path=ko.observable(path);
|
||||
|
||||
/**
|
||||
* The artifact reference, as " [groupId] :
|
||||
* [artifactId] : [version] : [classifier] : [type] ".
|
||||
*/
|
||||
//private String artifact;
|
||||
//this.artifact=ko.observable(artifact);
|
||||
this.update=update;
|
||||
//private String groupId;
|
||||
this.groupId=ko.observable(groupId);
|
||||
|
||||
//private String artifactId;
|
||||
this.artifactId=ko.observable(artifactId);
|
||||
|
||||
//private String version;
|
||||
this.version=ko.observable(version);
|
||||
|
||||
//private String classifier;
|
||||
this.classifier=ko.observable(classifier);
|
||||
|
||||
//private String type;
|
||||
this.type=ko.observable(type);
|
||||
|
||||
this.modified=ko.observable();
|
||||
|
||||
this.artifact = ko.computed(function() {
|
||||
var artifactValue="";
|
||||
if (this.groupId()){
|
||||
artifactValue+=this.groupId();
|
||||
}
|
||||
if (this.artifactId()){
|
||||
artifactValue+=":"+this.artifactId();
|
||||
}
|
||||
if (this.version()){
|
||||
artifactValue+=":"+this.version();
|
||||
}
|
||||
if (this.classifier()){
|
||||
artifactValue+=":"+this.classifier();
|
||||
}
|
||||
if (this.type()){
|
||||
artifactValue+=":"+this.type();
|
||||
}
|
||||
return artifactValue;
|
||||
}, this);
|
||||
showMenu = function( administrationMenuItems) {
|
||||
administrationMenuItems.push({ text : $.i18n.prop('menu.repository-scanning') , order:2000, id: "menu-repository-scanning-list-a" , href: "#scanningList" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoryScanning();}});
|
||||
administrationMenuItems.push({ text : $.i18n.prop('menu.runtime-configuration') , order:2010, id: "menu-runtime-configuration-list-a" , href: "#runtimeconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRuntimeConfiguration();}});
|
||||
administrationMenuItems.push({ text : $.i18n.prop('menu.system-status') , order:2020, id: "menu-system-status-list-a" , href: "#status" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displaySystemStatus();}});
|
||||
administrationMenuItems.push({ text : $.i18n.prop('menu.ui-configuration') , order:2030, id: "menu-ui-configuration-list-a" , href: "#uiconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayUiConfiguration();}});
|
||||
administrationMenuItems.push({ text : $.i18n.prop('menu.reports') , order:2040, id: "menu-report-list-a" , href: "#reports" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayReportsPage();}});
|
||||
|
||||
};
|
||||
|
||||
mapLegacyArtifactPaths=function(data){
|
||||
if (data){
|
||||
return $.isArray(data)? $.map(data,function(item){
|
||||
return mapLegacyArtifactPath(item);
|
||||
}):[mapLegacyArtifactPath(data)];
|
||||
}
|
||||
return [];
|
||||
};
|
||||
|
||||
mapLegacyArtifactPath=function(data){
|
||||
return data?new LegacyArtifactPath(data.path,data.groupId,data.artifactId,data.version,data.classifier,data.type):null;
|
||||
};
|
||||
|
||||
activateLegacyArtifactPathFormValidation=function(){
|
||||
var theForm=$("#main-content" ).find("#legacy-artifact-paths-edit-form");
|
||||
var validator = theForm.validate({
|
||||
showErrors: function(validator, errorMap, errorList) {
|
||||
customShowError("#main-content #legacy-artifact-paths-edit-form",validator,errorMap,errorMap);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
LegacyArtifactPathViewModel=function(legacyArtifactPath,update,legacyArtifactPathsViewModel){
|
||||
var self=this;
|
||||
this.update=update;
|
||||
this.legacyArtifactPath=legacyArtifactPath;
|
||||
this.legacyArtifactPathsViewModel=legacyArtifactPathsViewModel;
|
||||
|
||||
this.display=function(){
|
||||
var mainContent=$("#main-content");
|
||||
ko.applyBindings(self,mainContent.find("#legacy-artifact-paths-edit" ).get(0));
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("edit"));
|
||||
activateLegacyArtifactPathFormValidation();
|
||||
activateLegacyArtifactPathsEditTab();
|
||||
};
|
||||
|
||||
displayGrid=function(){
|
||||
activateLegacyArtifactPathsGridTab();
|
||||
};
|
||||
|
||||
calculatePath=function(){
|
||||
var path="";
|
||||
if (self.legacyArtifactPath.groupId()){
|
||||
path+=self.legacyArtifactPath.groupId()+"/jars/";
|
||||
}
|
||||
if (self.legacyArtifactPath.artifactId()){
|
||||
path+=self.legacyArtifactPath.artifactId();
|
||||
}
|
||||
if (self.legacyArtifactPath.version()){
|
||||
path+="-"+self.legacyArtifactPath.version();
|
||||
}
|
||||
if (self.legacyArtifactPath.classifier()){
|
||||
path+="-"+self.legacyArtifactPath.classifier();
|
||||
}
|
||||
if (self.legacyArtifactPath.type()){
|
||||
path+="."+self.legacyArtifactPath.type();
|
||||
}
|
||||
self.legacyArtifactPath.path(path);
|
||||
};
|
||||
|
||||
this.save=function(){
|
||||
var theForm=$("#main-content" ).find("#legacy-artifact-paths-edit-form");
|
||||
if (!theForm.valid()){
|
||||
return;
|
||||
}
|
||||
// do that on server side
|
||||
/*if (theForm.find("#artifact" ).val()
|
||||
!=theForm.find("#path" ).val()){
|
||||
var errorList=[{
|
||||
message: $.i18n.prop("path must match artifact"),
|
||||
element: theForm.find("#path" ).get(0)
|
||||
}];
|
||||
customShowError("#main-content #legacy-artifact-paths-edit-form", null, null, errorList);
|
||||
return;
|
||||
}*/
|
||||
// TODO call id exists if add ?
|
||||
clearUserMessages();
|
||||
$.log("save ok");
|
||||
if (self.update){
|
||||
$.log("update");
|
||||
}else {
|
||||
$.ajax("restServices/archivaServices/archivaAdministrationService/addLegacyArtifactPath",
|
||||
{
|
||||
type: "POST",
|
||||
contentType: 'application/json',
|
||||
data: ko.toJSON(self.legacyArtifactPath),
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
self.legacyArtifactPath.modified(false);
|
||||
self.legacyArtifactPathsViewModel.legacyArtifactPaths.push(self.legacyArtifactPath);
|
||||
displaySuccessMessage($.i18n.prop('legacy-artifact-path.added',self.legacyArtifactPath.path()));
|
||||
activateLegacyArtifactPathsGridTab();
|
||||
},
|
||||
error: function(data) {
|
||||
var res = $.parseJSON(data.responseText);
|
||||
displayRestError(res);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
LegacyArtifactPathsViewModel=function(){
|
||||
var self=this;
|
||||
this.legacyArtifactPaths=ko.observableArray([]);
|
||||
|
||||
this.gridViewModel = new ko.simpleGrid.viewModel({
|
||||
data: self.legacyArtifactPaths,
|
||||
columns: [
|
||||
{
|
||||
headerText: $.i18n.prop('legacy-artifact-paths.path'),
|
||||
rowText: "path"
|
||||
},
|
||||
{
|
||||
headerText: $.i18n.prop('legacy-artifact-paths.artifact'),
|
||||
rowText: "artifact"
|
||||
}
|
||||
],
|
||||
pageSize: 5,
|
||||
gridUpdateCallBack: function(networkProxy){
|
||||
$("#main-content").find("#legacy-artifact-paths-table" ).find("[title]").tooltip();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
editLegacyArtifactPath=function(legacyArtifactPath){
|
||||
var legacyArtifactPathViewModel=new LegacyArtifactPathViewModel(legacyArtifactPath,true);
|
||||
legacyArtifactPathViewModel.display();
|
||||
};
|
||||
|
||||
removeLegacyArtifactPath=function(legacyArtifactPath){
|
||||
|
||||
openDialogConfirm(
|
||||
function(){
|
||||
|
||||
$.ajax("restServices/archivaServices/archivaAdministrationService/deleteLegacyArtifactPath?path="+encodeURIComponent(legacyArtifactPath.path()),
|
||||
{
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
self.legacyArtifactPaths.remove(legacyArtifactPath);
|
||||
displaySuccessMessage($.i18n.prop('legacy-artifact-path.removed',legacyArtifactPath.path()));
|
||||
activateLegacyArtifactPathsGridTab();
|
||||
},
|
||||
error: function(data) {
|
||||
var res = $.parseJSON(data.responseText);
|
||||
displayRestError(res);
|
||||
},
|
||||
complete: function(){
|
||||
closeDialogConfirm();
|
||||
}
|
||||
}
|
||||
);
|
||||
}, $.i18n.prop('ok'), $.i18n.prop('cancel'), $.i18n.prop('legacy-artifact-path.delete.confirm',legacyArtifactPath.path()),
|
||||
$("#legacy-artifact-path-delete-warning-tmpl" ).tmpl(legacyArtifactPath));
|
||||
|
||||
};
|
||||
|
||||
updateLegacyArtifactPath=function(legacyArtifactPath){
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
displayLegacyArtifactPathSupport=function(){
|
||||
screenChange();
|
||||
var mainContent=$("#main-content");
|
||||
mainContent.html(mediumSpinnerImg());
|
||||
|
||||
$.ajax("restServices/archivaServices/archivaAdministrationService/getLegacyArtifactPaths", {
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data){
|
||||
mainContent.html($("#legacy-artifact-path-main").tmpl());
|
||||
var legacyArtifactPathsViewModel=new LegacyArtifactPathsViewModel();
|
||||
var legacyPaths=mapLegacyArtifactPaths(data);
|
||||
$.log("legacyPaths:"+legacyPaths.length);
|
||||
legacyArtifactPathsViewModel.legacyArtifactPaths(legacyPaths);
|
||||
ko.applyBindings(legacyArtifactPathsViewModel,mainContent.find("#legacy-artifact-paths-view" ).get(0));
|
||||
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs").on('show', function (e) {
|
||||
if ($(e.target).attr("href")=="#legacy-artifact-paths-edit") {
|
||||
var viewModel = new LegacyArtifactPathViewModel(new LegacyArtifactPath(),false,legacyArtifactPathsViewModel);
|
||||
viewModel.display();
|
||||
activateLegacyArtifactPathFormValidation();
|
||||
clearUserMessages();
|
||||
}
|
||||
if ($(e.target).attr("href")=="#legacy-artifact-paths-view") {
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("add"));
|
||||
clearUserMessages();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
activateLegacyArtifactPathsGridTab();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
activateLegacyArtifactPathsGridTab=function(){
|
||||
var mainContent = $("#main-content");
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit").removeClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-edit").removeClass("active");
|
||||
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-grid").addClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-view").addClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("add"));
|
||||
|
||||
};
|
||||
|
||||
activateLegacyArtifactPathsEditTab=function(){
|
||||
var mainContent = $("#main-content");
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-grid").removeClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-view").removeClass("active");
|
||||
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit").addClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-edit").addClass("active");
|
||||
};
|
||||
|
||||
|
||||
|
||||
//---------------------------
|
||||
// repository scanning part
|
||||
//---------------------------
|
||||
|
@ -2056,28 +1787,6 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
return new CacheConfiguration(data.timeToIdleSeconds,data.timeToLiveSeconds,data.maxElementsInMemory,data.maxElementsOnDisk);
|
||||
}
|
||||
|
||||
CookieInformation=function(path,domain,secure,timeout,rememberMeEnabled){
|
||||
//private String path;
|
||||
this.path=path;
|
||||
|
||||
//private String domain;
|
||||
this.domain=domain;
|
||||
|
||||
//private String secure;
|
||||
this.secure=secure;
|
||||
|
||||
//private String timeout;
|
||||
this.timeout=timeout;
|
||||
|
||||
//private boolean rememberMeEnabled;
|
||||
this.rememberMeEnabled=rememberMeEnabled;
|
||||
}
|
||||
|
||||
mapCookieInformation=function(data){
|
||||
if(!data){
|
||||
return new CookieInformation();
|
||||
}
|
||||
return new CookieInformation(data.path,data.domain,data.secure,data.timeout,data.rememberMeEnabled);
|
||||
}
|
||||
|
||||
|
||||
});
|
|
@ -16,10 +16,15 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
define("archiva.network-proxies",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout"
|
||||
define("archiva/admin/features/networkproxies/main",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout"
|
||||
,"knockout.simpleGrid"], function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
|
||||
|
||||
|
||||
showMenu = function(administrationMenuItems) {
|
||||
administrationMenuItems.push(
|
||||
{ text : $.i18n.prop('menu.network-proxies') ,order:1000, id: "menu-network-proxies-list-a" , href: "#networkproxies" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayNetworkProxies()}}
|
||||
);
|
||||
}
|
||||
|
||||
NetworkProxy=function(id,protocol,host,port,username,password,useNtlm){
|
||||
var self=this;
|
||||
//private String id;
|
|
@ -0,0 +1,318 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
define("archiva/admin/repository/legacy/main", ["jquery", 'i18n','knockout'],
|
||||
function(jquery,i18n,ko) {
|
||||
|
||||
showMenu = function(administrationMenuItems) {
|
||||
administrationMenuItems.push(
|
||||
{
|
||||
text: $.i18n.prop('menu.legacy-artifact-support'),
|
||||
order:600,
|
||||
id: "menu-legacy-support-list-a",
|
||||
href: "#legacy",
|
||||
redback: "{permissions: ['archiva-manage-configuration']}",
|
||||
func: function() {
|
||||
displayLegacyArtifactPathSupport();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
//-------------------------
|
||||
// legacy path part
|
||||
//-------------------------
|
||||
|
||||
LegacyArtifactPath = function(path, groupId, artifactId, version, classifier, type, update) {
|
||||
//private String path;
|
||||
this.path = ko.observable(path);
|
||||
|
||||
/**
|
||||
* The artifact reference, as " [groupId] :
|
||||
* [artifactId] : [version] : [classifier] : [type] ".
|
||||
*/
|
||||
//private String artifact;
|
||||
//this.artifact=ko.observable(artifact);
|
||||
this.update = update;
|
||||
//private String groupId;
|
||||
this.groupId = ko.observable(groupId);
|
||||
|
||||
//private String artifactId;
|
||||
this.artifactId = ko.observable(artifactId);
|
||||
|
||||
//private String version;
|
||||
this.version = ko.observable(version);
|
||||
|
||||
//private String classifier;
|
||||
this.classifier = ko.observable(classifier);
|
||||
|
||||
//private String type;
|
||||
this.type = ko.observable(type);
|
||||
|
||||
this.modified = ko.observable();
|
||||
|
||||
this.artifact = ko.computed(function() {
|
||||
var artifactValue = "";
|
||||
if (this.groupId()) {
|
||||
artifactValue += this.groupId();
|
||||
}
|
||||
if (this.artifactId()) {
|
||||
artifactValue += ":" + this.artifactId();
|
||||
}
|
||||
if (this.version()) {
|
||||
artifactValue += ":" + this.version();
|
||||
}
|
||||
if (this.classifier()) {
|
||||
artifactValue += ":" + this.classifier();
|
||||
}
|
||||
if (this.type()) {
|
||||
artifactValue += ":" + this.type();
|
||||
}
|
||||
return artifactValue;
|
||||
}, this);
|
||||
};
|
||||
|
||||
mapLegacyArtifactPaths = function(data) {
|
||||
if (data) {
|
||||
return $.isArray(data) ? $.map(data, function(item) {
|
||||
return mapLegacyArtifactPath(item);
|
||||
}) : [mapLegacyArtifactPath(data)];
|
||||
}
|
||||
return [];
|
||||
};
|
||||
|
||||
mapLegacyArtifactPath = function(data) {
|
||||
return data ? new LegacyArtifactPath(data.path, data.groupId, data.artifactId, data.version, data.classifier, data.type) : null;
|
||||
};
|
||||
|
||||
activateLegacyArtifactPathFormValidation = function() {
|
||||
var theForm = $("#main-content").find("#legacy-artifact-paths-edit-form");
|
||||
var validator = theForm.validate({
|
||||
showErrors: function(validator, errorMap, errorList) {
|
||||
customShowError("#main-content #legacy-artifact-paths-edit-form", validator, errorMap, errorMap);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
LegacyArtifactPathViewModel = function(legacyArtifactPath, update, legacyArtifactPathsViewModel) {
|
||||
var self = this;
|
||||
this.update = update;
|
||||
this.legacyArtifactPath = legacyArtifactPath;
|
||||
this.legacyArtifactPathsViewModel = legacyArtifactPathsViewModel;
|
||||
|
||||
this.display = function() {
|
||||
var mainContent = $("#main-content");
|
||||
ko.applyBindings(self, mainContent.find("#legacy-artifact-paths-edit").get(0));
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("edit"));
|
||||
activateLegacyArtifactPathFormValidation();
|
||||
activateLegacyArtifactPathsEditTab();
|
||||
};
|
||||
|
||||
displayGrid = function() {
|
||||
activateLegacyArtifactPathsGridTab();
|
||||
};
|
||||
|
||||
calculatePath = function() {
|
||||
var path = "";
|
||||
if (self.legacyArtifactPath.groupId()) {
|
||||
path += self.legacyArtifactPath.groupId() + "/jars/";
|
||||
}
|
||||
if (self.legacyArtifactPath.artifactId()) {
|
||||
path += self.legacyArtifactPath.artifactId();
|
||||
}
|
||||
if (self.legacyArtifactPath.version()) {
|
||||
path += "-" + self.legacyArtifactPath.version();
|
||||
}
|
||||
if (self.legacyArtifactPath.classifier()) {
|
||||
path += "-" + self.legacyArtifactPath.classifier();
|
||||
}
|
||||
if (self.legacyArtifactPath.type()) {
|
||||
path += "." + self.legacyArtifactPath.type();
|
||||
}
|
||||
self.legacyArtifactPath.path(path);
|
||||
};
|
||||
|
||||
this.save = function() {
|
||||
var theForm = $("#main-content").find("#legacy-artifact-paths-edit-form");
|
||||
if (!theForm.valid()) {
|
||||
return;
|
||||
}
|
||||
// do that on server side
|
||||
/*if (theForm.find("#artifact" ).val()
|
||||
!=theForm.find("#path" ).val()){
|
||||
var errorList=[{
|
||||
message: $.i18n.prop("path must match artifact"),
|
||||
element: theForm.find("#path" ).get(0)
|
||||
}];
|
||||
customShowError("#main-content #legacy-artifact-paths-edit-form", null, null, errorList);
|
||||
return;
|
||||
}*/
|
||||
// TODO call id exists if add ?
|
||||
clearUserMessages();
|
||||
$.log("save ok");
|
||||
if (self.update) {
|
||||
$.log("update");
|
||||
} else {
|
||||
$.ajax("restServices/archivaServices/archivaAdministrationService/addLegacyArtifactPath",
|
||||
{
|
||||
type: "POST",
|
||||
contentType: 'application/json',
|
||||
data: ko.toJSON(self.legacyArtifactPath),
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
self.legacyArtifactPath.modified(false);
|
||||
self.legacyArtifactPathsViewModel.legacyArtifactPaths.push(self.legacyArtifactPath);
|
||||
displaySuccessMessage($.i18n.prop('legacy-artifact-path.added', self.legacyArtifactPath.path()));
|
||||
activateLegacyArtifactPathsGridTab();
|
||||
},
|
||||
error: function(data) {
|
||||
var res = $.parseJSON(data.responseText);
|
||||
displayRestError(res);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
LegacyArtifactPathsViewModel = function() {
|
||||
var self = this;
|
||||
this.legacyArtifactPaths = ko.observableArray([]);
|
||||
|
||||
this.gridViewModel = new ko.simpleGrid.viewModel({
|
||||
data: self.legacyArtifactPaths,
|
||||
columns: [
|
||||
{
|
||||
headerText: $.i18n.prop('legacy-artifact-paths.path'),
|
||||
rowText: "path"
|
||||
},
|
||||
{
|
||||
headerText: $.i18n.prop('legacy-artifact-paths.artifact'),
|
||||
rowText: "artifact"
|
||||
}
|
||||
],
|
||||
pageSize: 5,
|
||||
gridUpdateCallBack: function(networkProxy) {
|
||||
$("#main-content").find("#legacy-artifact-paths-table").find("[title]").tooltip();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
editLegacyArtifactPath = function(legacyArtifactPath) {
|
||||
var legacyArtifactPathViewModel = new LegacyArtifactPathViewModel(legacyArtifactPath, true);
|
||||
legacyArtifactPathViewModel.display();
|
||||
};
|
||||
|
||||
removeLegacyArtifactPath = function(legacyArtifactPath) {
|
||||
|
||||
openDialogConfirm(
|
||||
function() {
|
||||
|
||||
$.ajax("restServices/archivaServices/archivaAdministrationService/deleteLegacyArtifactPath?path=" + encodeURIComponent(legacyArtifactPath.path()),
|
||||
{
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
self.legacyArtifactPaths.remove(legacyArtifactPath);
|
||||
displaySuccessMessage($.i18n.prop('legacy-artifact-path.removed', legacyArtifactPath.path()));
|
||||
activateLegacyArtifactPathsGridTab();
|
||||
},
|
||||
error: function(data) {
|
||||
var res = $.parseJSON(data.responseText);
|
||||
displayRestError(res);
|
||||
},
|
||||
complete: function() {
|
||||
closeDialogConfirm();
|
||||
}
|
||||
}
|
||||
);
|
||||
}, $.i18n.prop('ok'), $.i18n.prop('cancel'), $.i18n.prop('legacy-artifact-path.delete.confirm', legacyArtifactPath.path()),
|
||||
$("#legacy-artifact-path-delete-warning-tmpl").tmpl(legacyArtifactPath));
|
||||
|
||||
};
|
||||
|
||||
updateLegacyArtifactPath = function(legacyArtifactPath) {
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
displayLegacyArtifactPathSupport = function() {
|
||||
screenChange();
|
||||
var mainContent = $("#main-content");
|
||||
mainContent.html(mediumSpinnerImg());
|
||||
|
||||
$.ajax("restServices/archivaServices/archivaAdministrationService/getLegacyArtifactPaths", {
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
mainContent.html($("#legacy-artifact-path-main").tmpl());
|
||||
var legacyArtifactPathsViewModel = new LegacyArtifactPathsViewModel();
|
||||
var legacyPaths = mapLegacyArtifactPaths(data);
|
||||
$.log("legacyPaths:" + legacyPaths.length);
|
||||
legacyArtifactPathsViewModel.legacyArtifactPaths(legacyPaths);
|
||||
ko.applyBindings(legacyArtifactPathsViewModel, mainContent.find("#legacy-artifact-paths-view").get(0));
|
||||
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs").on('show', function(e) {
|
||||
if ($(e.target).attr("href") == "#legacy-artifact-paths-edit") {
|
||||
var viewModel = new LegacyArtifactPathViewModel(new LegacyArtifactPath(), false, legacyArtifactPathsViewModel);
|
||||
viewModel.display();
|
||||
activateLegacyArtifactPathFormValidation();
|
||||
clearUserMessages();
|
||||
}
|
||||
if ($(e.target).attr("href") == "#legacy-artifact-paths-view") {
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("add"));
|
||||
clearUserMessages();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
activateLegacyArtifactPathsGridTab();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
activateLegacyArtifactPathsGridTab = function() {
|
||||
var mainContent = $("#main-content");
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit").removeClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-edit").removeClass("active");
|
||||
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-grid").addClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-view").addClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("add"));
|
||||
|
||||
};
|
||||
|
||||
activateLegacyArtifactPathsEditTab = function() {
|
||||
var mainContent = $("#main-content");
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-grid").removeClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-view").removeClass("active");
|
||||
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit").addClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-edit").addClass("active");
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
);
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
define("archiva/admin/repository/maven2/main",["jquery",'i18n',"archiva/admin/repository/maven2/repository-groups","archiva/admin/repository/maven2/proxy-connectors-rules","archiva/admin/repository/maven2/proxy-connectors"],
|
||||
function() {
|
||||
showMenu = function(administrationMenuItems) {
|
||||
administrationMenuItems.push(
|
||||
{text: $.i18n.prop('menu.repository.groups'),
|
||||
order:500,
|
||||
id: "menu-repository-groups-list-a",
|
||||
href: "#repositorygroup",
|
||||
redback: "{permissions: ['archiva-manage-configuration']}",
|
||||
func: function() {
|
||||
displayRepositoryGroups();
|
||||
}
|
||||
});
|
||||
administrationMenuItems.push({text: $.i18n.prop('menu.repositories'), order:510, id: "menu-repositories-list-a", href: "#repositorylist", redback: "{permissions: ['archiva-manage-configuration']}", func: function() {
|
||||
displayRepositoriesGrid();
|
||||
}});
|
||||
administrationMenuItems.push({text: $.i18n.prop('menu.proxy-connectors'), order:520, id: "menu-proxy-connectors-list-a", href: "#proxyconnectors", redback: "{permissions: ['archiva-manage-configuration']}", func: function() {
|
||||
displayProxyConnectors();
|
||||
}});
|
||||
administrationMenuItems.push({text: $.i18n.prop('menu.proxy-connectors-rules'), order:530, id: "menu.proxy-connectors-rules-list-a", href: "#proxyconnectorsrules", redback: "{permissions: ['archiva-manage-configuration']}", func: function() {
|
||||
displayProxyConnectorsRules();
|
||||
}});
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
);
|
|
@ -16,8 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstrap","jquery.ui","knockout"
|
||||
,"knockout.simpleGrid","knockout.sortable","archiva.proxy-connectors"],
|
||||
define("archiva/admin/repository/maven2/proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstrap","jquery.ui","knockout"
|
||||
,"knockout.simpleGrid","knockout.sortable","archiva/admin/repository/maven2/proxy-connectors"],
|
||||
function(jquery,i18n,jqueryTmpl,bootstrap,jqueryUi,ko) {
|
||||
|
||||
ProxyConnectorRulesViewModel=function(proxyConnectorRules,proxyConnectors){
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
define("archiva.proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout"
|
||||
define("archiva/admin/repository/maven2/proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout"
|
||||
,"knockout.simpleGrid","knockout.sortable","select2"],
|
||||
function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout","knockout.simpleGrid"],
|
||||
define("archiva/admin/repository/maven2/repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout","knockout.simpleGrid"],
|
||||
function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
|
||||
|
||||
// FIXME this must be dynamic if we do a plugin mechanism with dynamic repositories types
|
|
@ -16,8 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
define("archiva.repository-groups",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","jquery.ui","knockout"
|
||||
,"knockout.simpleGrid","knockout.sortable"],
|
||||
define("archiva/admin/repository/maven2/repository-groups",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","jquery.ui","knockout"
|
||||
,"knockout.simpleGrid","knockout.sortable","archiva/admin/repository/maven2/repositories"],
|
||||
function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
|
||||
|
||||
RepositoryGroup=function(id,repositories,mergedIndexPath,mergedIndexTtl){
|
||||
|
@ -249,7 +249,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
|
|||
}
|
||||
);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
this.addRepositoryGroup=function(repositoryGroup){
|
||||
clearUserMessages();
|
|
@ -88,21 +88,25 @@ $.ajax({
|
|||
"redback.user": "redback/user",
|
||||
"redback.users": "redback/users",
|
||||
"redback.templates": "redback/redback-tmpl",
|
||||
"archiva.general-admin":"archiva/general-admin",
|
||||
"archiva.cookie-information":"archiva/cookie-information",
|
||||
"archiva.templates": "archiva/main-tmpl",
|
||||
"archiva.repositories": "archiva/repositories",
|
||||
"archiva.network-proxies": "archiva/network-proxies",
|
||||
"archiva.proxy-connectors": "archiva/proxy-connectors",
|
||||
"archiva.repository-groups": "archiva/repository-groups",
|
||||
// "archiva.repositories": "archiva/repositories",
|
||||
// "archiva.network-proxies": "archiva/network-proxies",
|
||||
// "archiva.proxy-connectors": "archiva/proxy-connectors",
|
||||
// "archiva.repository-groups": "archiva/repository-groups",
|
||||
"archiva.artifacts-management": "archiva/artifacts-management",
|
||||
"archiva.search": "archiva/search",
|
||||
"archiva.proxy-connectors-rules": "archiva/proxy-connectors-rules",
|
||||
// "archiva.proxy-connectors-rules": "archiva/proxy-connectors-rules",
|
||||
"archiva.docs": "archiva/docs",
|
||||
"archiva.main": "archiva/main"
|
||||
}
|
||||
});
|
||||
|
||||
requirejs(['jquery','jquery.tmpl','jquery.ui','i18n','sammy','startup','utils','domReady!','archiva.main','archiva.general-admin'], function () {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
requirejs(['jquery','jquery.tmpl','jquery.ui','i18n','sammy','startup','utils','domReady!','archiva.main','archiva.cookie-information'], function () {
|
||||
loadi18n(function () {
|
||||
$.ajax({
|
||||
url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(),
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright 2013 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
define("archiva.cookie-information",function() {
|
||||
CookieInformation=function(path,domain,secure,timeout,rememberMeEnabled){
|
||||
//private String path;
|
||||
this.path=path;
|
||||
|
||||
//private String domain;
|
||||
this.domain=domain;
|
||||
|
||||
//private String secure;
|
||||
this.secure=secure;
|
||||
|
||||
//private String timeout;
|
||||
this.timeout=timeout;
|
||||
|
||||
//private boolean rememberMeEnabled;
|
||||
this.rememberMeEnabled=rememberMeEnabled;
|
||||
}
|
||||
|
||||
mapCookieInformation=function(data){
|
||||
if(!data){
|
||||
return new CookieInformation();
|
||||
}
|
||||
return new CookieInformation(data.path,data.domain,data.secure,data.timeout,data.rememberMeEnabled);
|
||||
}
|
||||
|
||||
});
|
|
@ -18,9 +18,7 @@
|
|||
*/
|
||||
define("archiva.main",["jquery","jquery.ui","sammy","jquery.tmpl",'i18n',"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",
|
||||
"archiva.proxy-connectors-rules","archiva.docs"],
|
||||
"redback.roles","redback","archiva.artifacts-management","archiva.docs"],
|
||||
function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryValidate,jqueryJson,ko) {
|
||||
|
||||
/**
|
||||
|
@ -224,25 +222,36 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
|
|||
{ text : $.i18n.prop('menu.artifacts.upload') , id: "menu-find-upload-a", href: "#upload" , redback: "{permissions: ['archiva-upload-repository']}", func: function(){displayUploadArtifact(true)}}
|
||||
]);
|
||||
this.administrationMenuItems = ko.observableArray([
|
||||
{ text : $.i18n.prop('menu.administration') , id: null},
|
||||
{ text : $.i18n.prop('menu.repository.groups') , id: "menu-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.proxy-connectors-rules') , id: "menu.proxy-connectors-rules-list-a" , href: "#proxyconnectorsrules" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayProxyConnectorsRules()}},
|
||||
{ text : $.i18n.prop('menu.network-proxies') , id: "menu-network-proxies-list-a" , href: "#networkproxies" , 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.runtime-configuration') , id: "menu-runtime-configuration-list-a" , href: "#runtimeconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRuntimeConfiguration()}},
|
||||
{ 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.ui-configuration') , id: "menu-ui-configuration-list-a" , href: "#uiconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayUiConfiguration()}},
|
||||
{ text : $.i18n.prop('menu.reports') , id: "menu-report-list-a" , href: "#reports" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayReportsPage()}}
|
||||
]);
|
||||
|
||||
this.usersMenuItems = ko.observableArray([
|
||||
{text: $.i18n.prop('menu.administration'), id: null ,order : 1} ]);
|
||||
|
||||
var pluginsURL = "restServices/archivaServices/pluginsService/getAdminPlugins";
|
||||
$.ajax(pluginsURL, {
|
||||
type: "GET",
|
||||
dataType: 'text',
|
||||
|
||||
success: function(data) {
|
||||
$.each(data.split("|"), function(key, value) {
|
||||
require([value], function() {
|
||||
showMenu(self.administrationMenuItems);
|
||||
// sort menu according to order field
|
||||
//
|
||||
self.administrationMenuItems.sort(function(left, right) {
|
||||
return left.order == right.order ? 0 : (left.order < right.order ? -1 : 1)
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
this.usersMenuItems = ko.observableArray([
|
||||
{ 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()}},
|
||||
{ text : $.i18n.prop('menu.users-runtime-configuration') , id: "menu-redback-runtime-configuration-list-a" , href: "#redbackruntimeconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRedbackRuntimeConfiguration()}}
|
||||
{ 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();}},
|
||||
{ text : $.i18n.prop('menu.users-runtime-configuration') , id: "menu-redback-runtime-configuration-list-a" , href: "#redbackruntimeconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRedbackRuntimeConfiguration();}}
|
||||
]);
|
||||
|
||||
this.docsMenuItems = ko.observableArray([
|
||||
|
@ -767,7 +776,7 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
|
|||
$("#main-content" ).html($("#welcome" ).tmpl({runtimeInfo: window.archivaRuntimeInfo}));
|
||||
drawQuickSearchAutocomplete("#quick-search-autocomplete-welcome");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
userLoggedCallbackFn=function(user){
|
||||
$.log("userLoggedCallbackFn:"+ (user?user.username():null));
|
||||
|
@ -891,18 +900,18 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
|
|||
}
|
||||
);
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
$.log("select artifactId:"+ui.item.artifactId);
|
||||
window.sammyArchivaApplication.setLocation("#quicksearch~"+ui.item.artifactId);
|
||||
}
|
||||
}).data( "autocomplete" )._renderItem = function( ul, item ) {
|
||||
return $( "<li></li>" )
|
||||
.data( "item.autocomplete", item )
|
||||
.append( "<a>" + item.artifactId + "</a>" )
|
||||
.appendTo( ul );
|
||||
};
|
||||
select: function(event, ui) {
|
||||
$.log("select artifactId:" + ui.item.artifactId);
|
||||
window.sammyArchivaApplication.setLocation("#quicksearch~" + ui.item.artifactId);
|
||||
}
|
||||
}).data("autocomplete")._renderItem = function(ul, item) {
|
||||
return $("<li></li>")
|
||||
.data("item.autocomplete", item)
|
||||
.append("<a>" + item.artifactId + "</a>")
|
||||
.appendTo(ul);
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
RequireJS 2.1.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||||
Available via the MIT or new BSD license.
|
||||
see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
var requirejs,require,define;
|
||||
(function(ba){function J(b){return"[object Function]"===N.call(b)}function K(b){return"[object Array]"===N.call(b)}function z(b,c){if(b){var d;for(d=0;d<b.length&&(!b[d]||!c(b[d],d,b));d+=1);}}function O(b,c){if(b){var d;for(d=b.length-1;-1<d&&(!b[d]||!c(b[d],d,b));d-=1);}}function t(b,c){return ha.call(b,c)}function m(b,c){return t(b,c)&&b[c]}function H(b,c){for(var d in b)if(t(b,d)&&c(b[d],d))break}function S(b,c,d,m){c&&H(c,function(c,l){if(d||!t(b,l))m&&"string"!==typeof c?(b[l]||(b[l]={}),S(b[l],
|
||||
c,d,m)):b[l]=c});return b}function v(b,c){return function(){return c.apply(b,arguments)}}function ca(b){throw b;}function da(b){if(!b)return b;var c=ba;z(b.split("."),function(b){c=c[b]});return c}function B(b,c,d,m){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=m;d&&(c.originalError=d);return c}function ia(b){function c(a,f,C){var e,n,b,c,d,T,k,g=f&&f.split("/");e=g;var l=j.map,h=l&&l["*"];if(a&&"."===a.charAt(0))if(f){e=m(j.pkgs,f)?g=[f]:g.slice(0,g.length-
|
||||
1);f=a=e.concat(a.split("/"));for(e=0;f[e];e+=1)if(n=f[e],"."===n)f.splice(e,1),e-=1;else if(".."===n)if(1===e&&(".."===f[2]||".."===f[0]))break;else 0<e&&(f.splice(e-1,2),e-=2);e=m(j.pkgs,f=a[0]);a=a.join("/");e&&a===f+"/"+e.main&&(a=f)}else 0===a.indexOf("./")&&(a=a.substring(2));if(C&&l&&(g||h)){f=a.split("/");for(e=f.length;0<e;e-=1){b=f.slice(0,e).join("/");if(g)for(n=g.length;0<n;n-=1)if(C=m(l,g.slice(0,n).join("/")))if(C=m(C,b)){c=C;d=e;break}if(c)break;!T&&(h&&m(h,b))&&(T=m(h,b),k=e)}!c&&
|
||||
T&&(c=T,d=k);c&&(f.splice(0,d,c),a=f.join("/"))}return a}function d(a){A&&z(document.getElementsByTagName("script"),function(f){if(f.getAttribute("data-requiremodule")===a&&f.getAttribute("data-requirecontext")===k.contextName)return f.parentNode.removeChild(f),!0})}function p(a){var f=m(j.paths,a);if(f&&K(f)&&1<f.length)return d(a),f.shift(),k.require.undef(a),k.require([a]),!0}function g(a){var f,b=a?a.indexOf("!"):-1;-1<b&&(f=a.substring(0,b),a=a.substring(b+1,a.length));return[f,a]}function l(a,
|
||||
f,b,e){var n,D,i=null,d=f?f.name:null,l=a,h=!0,j="";a||(h=!1,a="_@r"+(N+=1));a=g(a);i=a[0];a=a[1];i&&(i=c(i,d,e),D=m(r,i));a&&(i?j=D&&D.normalize?D.normalize(a,function(a){return c(a,d,e)}):c(a,d,e):(j=c(a,d,e),a=g(j),i=a[0],j=a[1],b=!0,n=k.nameToUrl(j)));b=i&&!D&&!b?"_unnormalized"+(O+=1):"";return{prefix:i,name:j,parentMap:f,unnormalized:!!b,url:n,originalName:l,isDefine:h,id:(i?i+"!"+j:j)+b}}function s(a){var f=a.id,b=m(q,f);b||(b=q[f]=new k.Module(a));return b}function u(a,f,b){var e=a.id,n=m(q,
|
||||
e);if(t(r,e)&&(!n||n.defineEmitComplete))"defined"===f&&b(r[e]);else if(n=s(a),n.error&&"error"===f)b(n.error);else n.on(f,b)}function w(a,f){var b=a.requireModules,e=!1;if(f)f(a);else if(z(b,function(f){if(f=m(q,f))f.error=a,f.events.error&&(e=!0,f.emit("error",a))}),!e)h.onError(a)}function x(){U.length&&(ja.apply(I,[I.length-1,0].concat(U)),U=[])}function y(a){delete q[a];delete W[a]}function G(a,f,b){var e=a.map.id;a.error?a.emit("error",a.error):(f[e]=!0,z(a.depMaps,function(e,c){var d=e.id,
|
||||
g=m(q,d);g&&(!a.depMatched[c]&&!b[d])&&(m(f,d)?(a.defineDep(c,r[d]),a.check()):G(g,f,b))}),b[e]=!0)}function E(){var a,f,b,e,n=(b=1E3*j.waitSeconds)&&k.startTime+b<(new Date).getTime(),c=[],i=[],g=!1,l=!0;if(!X){X=!0;H(W,function(b){a=b.map;f=a.id;if(b.enabled&&(a.isDefine||i.push(b),!b.error))if(!b.inited&&n)p(f)?g=e=!0:(c.push(f),d(f));else if(!b.inited&&(b.fetched&&a.isDefine)&&(g=!0,!a.prefix))return l=!1});if(n&&c.length)return b=B("timeout","Load timeout for modules: "+c,null,c),b.contextName=
|
||||
k.contextName,w(b);l&&z(i,function(a){G(a,{},{})});if((!n||e)&&g)if((A||ea)&&!Y)Y=setTimeout(function(){Y=0;E()},50);X=!1}}function F(a){t(r,a[0])||s(l(a[0],null,!0)).init(a[1],a[2])}function L(a){var a=a.currentTarget||a.srcElement,b=k.onScriptLoad;a.detachEvent&&!Z?a.detachEvent("onreadystatechange",b):a.removeEventListener("load",b,!1);b=k.onScriptError;(!a.detachEvent||Z)&&a.removeEventListener("error",b,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}function M(){var a;for(x();I.length;){a=
|
||||
I.shift();if(null===a[0])return w(B("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));F(a)}}var X,$,k,P,Y,j={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{},config:{}},q={},W={},aa={},I=[],r={},V={},N=1,O=1;P={require:function(a){return a.require?a.require:a.require=k.makeRequire(a.map)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports?a.exports:a.exports=r[a.map.id]={}},module:function(a){return a.module?a.module:a.module={id:a.map.id,uri:a.map.url,config:function(){var b=
|
||||
m(j.pkgs,a.map.id);return(b?m(j.config,a.map.id+"/"+b.main):m(j.config,a.map.id))||{}},exports:r[a.map.id]}}};$=function(a){this.events=m(aa,a.id)||{};this.map=a;this.shim=m(j.shim,a.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};$.prototype={init:function(a,b,c,e){e=e||{};if(!this.inited){this.factory=b;if(c)this.on("error",c);else this.events.error&&(c=v(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.errback=c;this.inited=
|
||||
!0;this.ignore=e.ignore;e.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,b){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=b)},fetch:function(){if(!this.fetched){this.fetched=!0;k.startTime=(new Date).getTime();var a=this.map;if(this.shim)k.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],v(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=
|
||||
this.map.url;V[a]||(V[a]=!0,k.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,b,c=this.map.id;b=this.depExports;var e=this.exports,n=this.factory;if(this.inited)if(this.error)this.emit("error",this.error);else{if(!this.defining){this.defining=!0;if(1>this.depCount&&!this.defined){if(J(n)){if(this.events.error&&this.map.isDefine||h.onError!==ca)try{e=k.execCb(c,n,b,e)}catch(d){a=d}else e=k.execCb(c,n,b,e);this.map.isDefine&&((b=this.module)&&void 0!==b.exports&&b.exports!==
|
||||
this.exports?e=b.exports:void 0===e&&this.usingExports&&(e=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else e=n;this.exports=e;if(this.map.isDefine&&!this.ignore&&(r[c]=e,h.onResourceLoad))h.onResourceLoad(k,this.map,this.depMaps);y(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=
|
||||
!0)}}else this.fetch()}},callPlugin:function(){var a=this.map,b=a.id,d=l(a.prefix);this.depMaps.push(d);u(d,"defined",v(this,function(e){var n,d;d=this.map.name;var g=this.map.parentMap?this.map.parentMap.name:null,C=k.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(e.normalize&&(d=e.normalize(d,function(a){return c(a,g,!0)})||""),e=l(a.prefix+"!"+d,this.map.parentMap),u(e,"defined",v(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),
|
||||
d=m(q,e.id)){this.depMaps.push(e);if(this.events.error)d.on("error",v(this,function(a){this.emit("error",a)}));d.enable()}}else n=v(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),n.error=v(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];H(q,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),n.fromText=v(this,function(e,c){var d=a.name,g=l(d),i=Q;c&&(e=c);i&&(Q=!1);s(g);t(j.config,b)&&(j.config[d]=j.config[b]);try{h.exec(e)}catch(D){return w(B("fromtexteval",
|
||||
"fromText eval for "+b+" failed: "+D,D,[b]))}i&&(Q=!0);this.depMaps.push(g);k.completeLoad(d);C([d],n)}),e.load(a.name,C,n,j)}));k.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;z(this.depMaps,v(this,function(a,b){var c,e;if("string"===typeof a){a=l(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=m(P,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;u(a,"defined",v(this,function(a){this.defineDep(b,
|
||||
a);this.check()}));this.errback&&u(a,"error",v(this,this.errback))}c=a.id;e=q[c];!t(P,c)&&(e&&!e.enabled)&&k.enable(a,this)}));H(this.pluginMaps,v(this,function(a){var b=m(q,a.id);b&&!b.enabled&&k.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){z(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};k={config:j,contextName:b,registry:q,defined:r,urlFetched:V,defQueue:I,Module:$,makeModuleMap:l,
|
||||
nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=j.pkgs,c=j.shim,e={paths:!0,config:!0,map:!0};H(a,function(a,b){e[b]?"map"===b?(j.map||(j.map={}),S(j[b],a,!0,!0)):S(j[b],a,!0):j[b]=a});a.shim&&(H(a.shim,function(a,b){K(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=k.makeShimExports(a);c[b]=a}),j.shim=c);a.packages&&(z(a.packages,function(a){a="string"===typeof a?{name:a}:a;b[a.name]={name:a.name,
|
||||
location:a.location||a.name,main:(a.main||"main").replace(ka,"").replace(fa,"")}}),j.pkgs=b);H(q,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=l(b))});if(a.deps||a.callback)k.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ba,arguments));return b||a.exports&&da(a.exports)}},makeRequire:function(a,f){function d(e,c,g){var i,j;f.enableBuildCallback&&(c&&J(c))&&(c.__requireJsBuild=!0);if("string"===typeof e){if(J(c))return w(B("requireargs",
|
||||
"Invalid require call"),g);if(a&&t(P,e))return P[e](q[a.id]);if(h.get)return h.get(k,e,a,d);i=l(e,a,!1,!0);i=i.id;return!t(r,i)?w(B("notloaded",'Module name "'+i+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):r[i]}M();k.nextTick(function(){M();j=s(l(null,a));j.skipMap=f.skipMap;j.init(e,c,g,{enabled:!0});E()});return d}f=f||{};S(d,{isBrowser:A,toUrl:function(b){var d,f=b.lastIndexOf("."),g=b.split("/")[0];if(-1!==f&&(!("."===g||".."===g)||1<f))d=b.substring(f,b.length),b=
|
||||
b.substring(0,f);return k.nameToUrl(c(b,a&&a.id,!0),d,!0)},defined:function(b){return t(r,l(b,a,!1,!0).id)},specified:function(b){b=l(b,a,!1,!0).id;return t(r,b)||t(q,b)}});a||(d.undef=function(b){x();var c=l(b,a,!0),d=m(q,b);delete r[b];delete V[c.url];delete aa[b];d&&(d.events.defined&&(aa[b]=d.events),y(b))});return d},enable:function(a){m(q,a.id)&&s(a).enable()},completeLoad:function(a){var b,c,e=m(j.shim,a)||{},d=e.exports;for(x();I.length;){c=I.shift();if(null===c[0]){c[0]=a;if(b)break;b=!0}else c[0]===
|
||||
a&&(b=!0);F(c)}c=m(q,a);if(!b&&!t(r,a)&&c&&!c.inited){if(j.enforceDefine&&(!d||!da(d)))return p(a)?void 0:w(B("nodefine","No define call for "+a,null,[a]));F([a,e.deps||[],e.exportsFn])}E()},nameToUrl:function(a,b,c){var d,g,l,i,k,p;if(h.jsExtRegExp.test(a))i=a+(b||"");else{d=j.paths;g=j.pkgs;i=a.split("/");for(k=i.length;0<k;k-=1)if(p=i.slice(0,k).join("/"),l=m(g,p),p=m(d,p)){K(p)&&(p=p[0]);i.splice(0,k,p);break}else if(l){a=a===l.name?l.location+"/"+l.main:l.location;i.splice(0,k,a);break}i=i.join("/");
|
||||
i+=b||(/\?/.test(i)||c?"":".js");i=("/"===i.charAt(0)||i.match(/^[\w\+\.\-]+:/)?"":j.baseUrl)+i}return j.urlArgs?i+((-1===i.indexOf("?")?"?":"&")+j.urlArgs):i},load:function(a,b){h.load(k,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){if("load"===a.type||la.test((a.currentTarget||a.srcElement).readyState))R=null,a=L(a),k.completeLoad(a.id)},onScriptError:function(a){var b=L(a);if(!p(b.id))return w(B("scripterror","Script error for: "+b.id,a,[b.id]))}};k.require=k.makeRequire();
|
||||
return k}var h,x,y,E,L,F,R,M,s,ga,ma=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,na=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,fa=/\.js$/,ka=/^\.\//;x=Object.prototype;var N=x.toString,ha=x.hasOwnProperty,ja=Array.prototype.splice,A=!!("undefined"!==typeof window&&navigator&&window.document),ea=!A&&"undefined"!==typeof importScripts,la=A&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,Z="undefined"!==typeof opera&&"[object Opera]"===opera.toString(),G={},u={},U=[],Q=
|
||||
!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(J(requirejs))return;u=requirejs;requirejs=void 0}"undefined"!==typeof require&&!J(require)&&(u=require,require=void 0);h=requirejs=function(b,c,d,p){var g,l="_";!K(b)&&"string"!==typeof b&&(g=b,K(c)?(b=c,c=d,d=p):b=[]);g&&g.context&&(l=g.context);(p=m(G,l))||(p=G[l]=h.s.newContext(l));g&&p.configure(g);return p.require(b,c,d)};h.config=function(b){return h(b)};h.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,
|
||||
4)}:function(b){b()};require||(require=h);h.version="2.1.6";h.jsExtRegExp=/^\/|:|\?|\.js$/;h.isBrowser=A;x=h.s={contexts:G,newContext:ia};h({});z(["toUrl","undef","defined","specified"],function(b){h[b]=function(){var c=G._;return c.require[b].apply(c,arguments)}});if(A&&(y=x.head=document.getElementsByTagName("head")[0],E=document.getElementsByTagName("base")[0]))y=x.head=E.parentNode;h.onError=ca;h.load=function(b,c,d){var h=b&&b.config||{},g;if(A)return g=h.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml",
|
||||
"html:script"):document.createElement("script"),g.type=h.scriptType||"text/javascript",g.charset="utf-8",g.async=!0,g.setAttribute("data-requirecontext",b.contextName),g.setAttribute("data-requiremodule",c),g.attachEvent&&!(g.attachEvent.toString&&0>g.attachEvent.toString().indexOf("[native code"))&&!Z?(Q=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)):(g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,M=g,E?y.insertBefore(g,E):y.appendChild(g),
|
||||
M=null,g;if(ea)try{importScripts(d),b.completeLoad(c)}catch(l){b.onError(B("importscripts","importScripts failed for "+c+" at "+d,l,[c]))}};A&&O(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(L=b.getAttribute("data-main"))return s=L,u.baseUrl||(F=s.split("/"),s=F.pop(),ga=F.length?F.join("/")+"/":"./",u.baseUrl=ga),s=s.replace(fa,""),h.jsExtRegExp.test(s)&&(s=L),u.deps=u.deps?u.deps.concat(s):[s],!0});define=function(b,c,d){var h,g;"string"!==typeof b&&(d=c,c=b,b=null);
|
||||
K(c)||(d=c,c=null);!c&&J(d)&&(c=[],d.length&&(d.toString().replace(ma,"").replace(na,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(Q){if(!(h=M))R&&"interactive"===R.readyState||O(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return R=b}),h=R;h&&(b||(b=h.getAttribute("data-requiremodule")),g=G[h.getAttribute("data-requirecontext")])}(g?g.defQueue:U).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};
|
||||
h(u)}})(this);
|
Loading…
Reference in New Issue