diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/pom.xml new file mode 100644 index 00000000000..b05db2d5643 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/pom.xml @@ -0,0 +1,111 @@ + + + + application-mgt + org.wso2.carbon.devicemgt + 3.1.40-SNAPSHOT + + + 4.0.0 + org.wso2.carbon.device.application.mgt.addons + 3.1.40-SNAPSHOT + WSO2 Carbon - Application Management Add-Ons + WSO2 Carbon - Application Management Add-Ons + http://wso2.org + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + 1.4.0 + true + + + ${project.artifactId} + ${project.artifactId} + ${carbon.device.mgt.version} + Application Management Add-Ons Bundle + + com.google.gson, + io.swagger.annotations.*;resolution:=optional + + + org.wso2.carbon.device.application.mgt.addons.* + + + + + + + + + + org.apache.cxf + cxf-rt-frontend-jaxws + provided + + + org.apache.cxf + cxf-rt-frontend-jaxrs + provided + + + org.apache.cxf + cxf-rt-transports-http + provided + + + org.eclipse.osgi + org.eclipse.osgi + + + org.eclipse.equinox + org.eclipse.equinox.common + + + org.wso2.carbon + org.wso2.carbon.logging + + + commons-codec.wso2 + commons-codec + + + commons-io.wso2 + commons-io + + + io.swagger + swagger-annotations + provided + + + org.json.wso2 + json + + + com.google.code.gson + gson + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.application.mgt.common + + + javax.servlet + servlet-api + provided + + + org.hibernate + hibernate-validator + + + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/ApiOriginFilter.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/ApiOriginFilter.java similarity index 96% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/ApiOriginFilter.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/ApiOriginFilter.java index 5c5158c51f6..7b34c432328 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/ApiOriginFilter.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/ApiOriginFilter.java @@ -15,7 +15,8 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.device.application.mgt.store.api; +package org.wso2.carbon.device.application.mgt.addons; + import javax.servlet.Filter; import javax.servlet.FilterChain; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/FileStreamingOutput.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/FileStreamingOutput.java similarity index 85% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/FileStreamingOutput.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/FileStreamingOutput.java index 40ddf5b329f..ee89b209ed1 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/FileStreamingOutput.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/FileStreamingOutput.java @@ -1,5 +1,4 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +/* * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -16,17 +15,17 @@ * under the License. * */ +package org.wso2.carbon.device.application.mgt.addons; -package org.wso2.carbon.device.application.mgt.store.api; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.StreamingOutput; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.StreamingOutput; /** - * FileStreamingOutput to allow the user to send the files as Stream. + * org.wso2.carbon.device.application.mgt.addons.FileStreamingOutput to allow the user to send the files as Stream. */ public class FileStreamingOutput implements StreamingOutput { private InputStream inputStream; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/JSONMessageHandler.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/JSONMessageHandler.java similarity index 96% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/JSONMessageHandler.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/JSONMessageHandler.java index d116bf6bffb..3b6a778a942 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/JSONMessageHandler.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/JSONMessageHandler.java @@ -15,21 +15,12 @@ * specific language governing permissions and limitations * under the License. */ - -package org.wso2.carbon.device.application.mgt.store.api; - +package org.wso2.carbon.device.application.mgt.addons; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import org.wso2.carbon.device.application.mgt.common.jaxrs.AnnotationExclusionStrategy; +import org.wso2.carbon.device.application.mgt.addons.jaxrs.AnnotationExclusionStrategy; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; @@ -38,6 +29,13 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/MultipartCustomProvider.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/MultipartCustomProvider.java similarity index 95% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/MultipartCustomProvider.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/MultipartCustomProvider.java index 03771296b25..5e0bd801903 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/MultipartCustomProvider.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/MultipartCustomProvider.java @@ -1,4 +1,4 @@ -/* +package org.wso2.carbon.device.application.mgt.addons;/* * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -16,26 +16,24 @@ * */ -package org.wso2.carbon.device.application.mgt.store.api; - import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import org.apache.cxf.jaxrs.ext.multipart.Attachment; -import org.wso2.carbon.device.application.mgt.common.jaxrs.AnnotationExclusionStrategy; +import org.wso2.carbon.device.application.mgt.addons.jaxrs.AnnotationExclusionStrategy; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; import javax.ws.rs.Consumes; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; /** * Provider for the text/plain type of input. Particularly use-ful for the complex objects sent along with Multipart diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/ValidationInterceptor.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/ValidationInterceptor.java similarity index 97% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/ValidationInterceptor.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/ValidationInterceptor.java index 61b0a0200bf..a05ecd82e1c 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/ValidationInterceptor.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/ValidationInterceptor.java @@ -15,9 +15,7 @@ * specific language governing permissions and limitations * under the License. */ - - -package org.wso2.carbon.device.application.mgt.store.api; +package org.wso2.carbon.device.application.mgt.addons; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -119,6 +117,6 @@ public class ValidationInterceptor extends AbstractPhaseInterceptor { } } - public void handleFault(Message messageParam) { + public void handleFault(org.apache.cxf.message.Message messageParam) { } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/jaxrs/AnnotationExclusionStrategy.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/jaxrs/AnnotationExclusionStrategy.java similarity index 95% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/jaxrs/AnnotationExclusionStrategy.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/jaxrs/AnnotationExclusionStrategy.java index 3b35a8aeacd..1bb39f70875 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/jaxrs/AnnotationExclusionStrategy.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/jaxrs/AnnotationExclusionStrategy.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.common.jaxrs; +package org.wso2.carbon.device.application.mgt.addons.jaxrs; import com.google.gson.ExclusionStrategy; import com.google.gson.FieldAttributes; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/jaxrs/Exclude.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/jaxrs/Exclude.java similarity index 94% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/jaxrs/Exclude.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/jaxrs/Exclude.java index 81ed5ae202d..fc53d16a8b4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/jaxrs/Exclude.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/src/main/java/org/wso2/carbon/device/application/mgt/addons/jaxrs/Exclude.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.common.jaxrs; +package org.wso2.carbon.device.application.mgt.addons.jaxrs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml index 1bab17a3bfa..1da6eabd18f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml @@ -53,7 +53,9 @@ org.wso2.carbon.device.mgt.common.*;version="${carbon.device.mgt.version}", com.google.gson, - io.swagger.annotations.*;resolution:=optional + io.swagger.annotations.*;resolution:=optional, + com.fasterxml.jackson.annotation, + javax.validation.constraints org.wso2.carbon.device.application.mgt.common.* @@ -106,6 +108,10 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.common + + org.hibernate + hibernate-validator + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/beans/ErrorListItem.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ErrorListItem.java similarity index 96% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/beans/ErrorListItem.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ErrorListItem.java index 5fb80516834..3676e53da34 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/beans/ErrorListItem.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ErrorListItem.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.publisher.api.beans; +package org.wso2.carbon.device.application.mgt.common; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/beans/ErrorResponse.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ErrorResponse.java similarity index 96% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/beans/ErrorResponse.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ErrorResponse.java index 7727b7a6954..3f3a40219ee 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/beans/ErrorResponse.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ErrorResponse.java @@ -16,11 +16,12 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.publisher.api.beans; +package org.wso2.carbon.device.application.mgt.common; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import org.wso2.carbon.device.application.mgt.common.ErrorListItem; import java.util.ArrayList; import java.util.List; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Tag.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Tag.java index a3815b6f9cd..9227f2ebfd7 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Tag.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Tag.java @@ -19,17 +19,11 @@ */ package org.wso2.carbon.device.application.mgt.common; - -import org.wso2.carbon.device.application.mgt.common.jaxrs.Exclude; - -import java.util.Date; - /** * Application represents the an Application in Application Store. */ public class Tag { - @Exclude private int id; private String tenantId; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/UnrestrictedRole.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/UnrestrictedRole.java index 5171648eceb..5d2884e9386 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/UnrestrictedRole.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/UnrestrictedRole.java @@ -19,15 +19,11 @@ */ package org.wso2.carbon.device.application.mgt.common; - -import org.wso2.carbon.device.application.mgt.common.jaxrs.Exclude; - /** * Application represents the an Application in Application Store. */ public class UnrestrictedRole { - @Exclude private int id; private int tenantId; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/APIUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/APIUtil.java similarity index 81% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/APIUtil.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/APIUtil.java index a62ba819beb..594ca152882 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/APIUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/APIUtil.java @@ -16,13 +16,13 @@ * under the License. */ -package org.wso2.carbon.device.application.mgt.publisher.api; +package org.wso2.carbon.device.application.mgt.core.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.application.mgt.common.services.*; -import org.wso2.carbon.device.application.mgt.publisher.api.beans.ErrorResponse; +import org.wso2.carbon.device.application.mgt.common.ErrorResponse; import javax.ws.rs.core.Response; @@ -37,6 +37,7 @@ public class APIUtil { private static ApplicationManager applicationManager; private static ApplicationStorageManager applicationStorageManager; private static SubscriptionManager subscriptionManager; + private static ReviewManager reviewManager; public static ApplicationManager getApplicationManager() { if (applicationManager == null) { @@ -115,4 +116,27 @@ public class APIUtil { return subscriptionManager; } + /** + * To get the Review Manager from the osgi context. + * @return ReviewManager instance in the current osgi context. + */ + public static ReviewManager getReviewManager() { + if (reviewManager == null) { + synchronized (APIUtil.class) { + if (reviewManager == null) { + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + reviewManager = + (ReviewManager) ctx.getOSGiService(ReviewManager.class, null); + if (reviewManager == null) { + String msg = "Review Manager service has not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + } + } + } + + return reviewManager; + } + } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/pom.xml index 201d0eec779..09ab32a1d13 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/pom.xml @@ -30,8 +30,8 @@ org.wso2.carbon.device.application.mgt.publisher.api 3.1.40-SNAPSHOT war - WSO2 Carbon - Application Management API - WSO2 Carbon - Application Management API + WSO2 Carbon - Application Management Publisher API + WSO2 Carbon - Application Management Publisher API http://wso2.org @@ -218,12 +218,8 @@ jackson-annotations - org.hibernate - hibernate-validator - - - javax.ws.rs - javax.ws.rs-api + org.wso2.carbon.devicemgt + org.wso2.carbon.device.application.mgt.addons \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/ApiOriginFilter.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/ApiOriginFilter.java deleted file mode 100644 index 65c521244c3..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/ApiOriginFilter.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - */ -package org.wso2.carbon.device.application.mgt.publisher.api; - -import javax.servlet.*; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -public class ApiOriginFilter implements Filter { - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException { - HttpServletResponse res = (HttpServletResponse) response; - res.addHeader("Access-Control-Allow-Origin", "*"); - res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - res.addHeader("Access-Control-Allow-Headers", "Content-Type"); - chain.doFilter(request, response); - } - - public void destroy() { - //do nothing - } - - public void init(FilterConfig filterConfig) throws ServletException { - //do nothing - } -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/FileStreamingOutput.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/FileStreamingOutput.java deleted file mode 100644 index 3c6fc98bda9..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/FileStreamingOutput.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - * - */ - -package org.wso2.carbon.device.application.mgt.publisher.api; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.StreamingOutput; - -/** - * FileStreamingOutput to allow the user to send the files as Stream. - */ -public class FileStreamingOutput implements StreamingOutput { - private InputStream inputStream; - - public FileStreamingOutput(InputStream inputStream) { - this.inputStream = inputStream; - } - - @Override - public void write(OutputStream outputStream) throws IOException, WebApplicationException { - try { - byte[] buffer = new byte[inputStream.available()]; - inputStream.read(buffer); - outputStream.write(buffer); - outputStream.flush(); - } finally { - if (inputStream != null) { - inputStream.close(); - } - if (outputStream != null) { - outputStream.close(); - } - } - - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/JSONMessageHandler.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/JSONMessageHandler.java deleted file mode 100644 index 16137573e76..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/JSONMessageHandler.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - */ - -package org.wso2.carbon.device.application.mgt.publisher.api; - - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import org.wso2.carbon.device.application.mgt.common.jaxrs.AnnotationExclusionStrategy; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; -import javax.ws.rs.Consumes; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.MessageBodyReader; -import javax.ws.rs.ext.MessageBodyWriter; -import javax.ws.rs.ext.Provider; - -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; - -/** - * This provider is used to change a JSON object to complex object and inversely in request and response. - */ -@Provider -@Produces(APPLICATION_JSON) -@Consumes(APPLICATION_JSON) -public class JSONMessageHandler implements MessageBodyWriter, MessageBodyReader { - - private Gson gson; - private static final String UTF_8 = "UTF-8"; - - public boolean isReadable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return true; - } - - private Gson getGson() { - if (gson == null) { - final GsonBuilder gsonBuilder = new GsonBuilder() - .setDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz") - .setExclusionStrategies(new AnnotationExclusionStrategy()); - gson = gsonBuilder.create(); - } - return gson; - } - - public Object readFrom(Class objectClass, Type type, Annotation[] annotations, MediaType mediaType, - MultivaluedMap stringStringMultivaluedMap, InputStream entityStream) - throws IOException, WebApplicationException { - try (InputStreamReader reader = new InputStreamReader(entityStream, UTF_8)) { - return getGson().fromJson(reader, type); - } - } - - public boolean isWriteable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return true; - } - - public long getSize(Object o, Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return -1; - } - - public void writeTo(Object object, Class aClass, Type type, Annotation[] annotations, MediaType mediaType, - MultivaluedMap stringObjectMultivaluedMap, OutputStream entityStream) - throws IOException, WebApplicationException { - try (OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8)) { - getGson().toJson(object, type, writer); - } - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/MultipartCustomProvider.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/MultipartCustomProvider.java deleted file mode 100644 index cbe1ac3b8fe..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/MultipartCustomProvider.java +++ /dev/null @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -* WSO2 Inc. 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. -* -*/ - -package org.wso2.carbon.device.application.mgt.publisher.api; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import org.apache.cxf.jaxrs.ext.multipart.Attachment; -import org.wso2.carbon.device.application.mgt.common.jaxrs.AnnotationExclusionStrategy; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; -import javax.ws.rs.Consumes; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.MessageBodyReader; -import javax.ws.rs.ext.Provider; - -/** - * Provider for the text/plain type of input. Particularly use-ful for the complex objects sent along with Multipart - * request. - */ -@Provider -@Consumes(MediaType.TEXT_PLAIN) -public class MultipartCustomProvider implements MessageBodyReader { - private Gson gson; - - public MultipartCustomProvider() { - final GsonBuilder gsonBuilder = new GsonBuilder().setDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz") - .setExclusionStrategies(new AnnotationExclusionStrategy()); - gson = gsonBuilder.create(); - } - @Override - public boolean isReadable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return !aClass.equals(Attachment.class); - } - - @Override - public Object readFrom(Class objectClass, Type type, Annotation[] annotations, MediaType mediaType, - MultivaluedMap headers, InputStream inputStream) throws IOException, - WebApplicationException { - ByteArrayOutputStream result = new ByteArrayOutputStream(); - byte[] buffer = new byte[1024]; - int length; - while ((length = inputStream.read(buffer)) != -1) { - result.write(buffer, 0, length); - } - String jsonString = result.toString(); - JsonObject obj = new JsonParser().parse(jsonString).getAsJsonObject(); - return gson.fromJson(obj, type); - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/ValidationInterceptor.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/ValidationInterceptor.java deleted file mode 100644 index a7c436bfe38..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/ValidationInterceptor.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - */ - - -package org.wso2.carbon.device.application.mgt.publisher.api; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.cxf.interceptor.Fault; -import org.apache.cxf.jaxrs.lifecycle.ResourceProvider; -import org.apache.cxf.jaxrs.model.ClassResourceInfo; -import org.apache.cxf.jaxrs.model.OperationResourceInfo; -import org.apache.cxf.message.Message; -import org.apache.cxf.message.MessageContentsList; -import org.apache.cxf.phase.AbstractPhaseInterceptor; -import org.apache.cxf.phase.Phase; - -import javax.validation.*; -import javax.validation.executable.ExecutableValidator; -import java.lang.reflect.Method; -import java.util.List; -import java.util.Set; - -public class ValidationInterceptor extends AbstractPhaseInterceptor { - private Log log = LogFactory.getLog(getClass()); - private Validator validator = null; //validator interface is thread-safe - - public ValidationInterceptor() { - super(Phase.PRE_INVOKE); - ValidatorFactory defaultFactory = Validation.buildDefaultValidatorFactory(); - validator = defaultFactory.getValidator(); - if (validator == null) { - log.warn("Bean Validation provider could not be found, no validation will be performed"); - } else { - log.debug("Validation In-Interceptor initialized successfully"); - } - } - - @Override - public void handleMessage(Message message) throws Fault { - final OperationResourceInfo operationResource = message.getExchange().get(OperationResourceInfo.class); - if (operationResource == null) { - log.info("OperationResourceInfo is not available, skipping validation"); - return; - } - - final ClassResourceInfo classResource = operationResource.getClassResourceInfo(); - if (classResource == null) { - log.info("ClassResourceInfo is not available, skipping validation"); - return; - } - - final ResourceProvider resourceProvider = classResource.getResourceProvider(); - if (resourceProvider == null) { - log.info("ResourceProvider is not available, skipping validation"); - return; - } - - final List arguments = MessageContentsList.getContentsList(message); - final Method method = operationResource.getAnnotatedMethod(); - final Object instance = resourceProvider.getInstance(message); - if (method != null && arguments != null) { - //validate the parameters(arguments) over the invoked method - validate(method, arguments.toArray(), instance); - - //validate the fields of each argument - for (Object arg : arguments) { - if (arg != null) - validate(arg); - } - } - - } - - public void validate(final Method method, final Object[] arguments, final T instance) { - if (validator == null) { - log.warn("Bean Validation provider could not be found, no validation will be performed"); - return; - } - - ExecutableValidator methodValidator = validator.forExecutables(); - Set> violations = methodValidator.validateParameters(instance, - method, arguments); - - if (!violations.isEmpty()) { - throw new ConstraintViolationException(violations); - } - } - - public void validate(final T object) { - if (validator == null) { - log.warn("Bean Validation provider could be found, no validation will be performed"); - return; - } - - Set> violations = validator.validate(object); - - if (!violations.isEmpty()) { - throw new ConstraintViolationException(violations); - } - } - - public void handleFault(org.apache.cxf.message.Message messageParam) { - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/ApplicationManagementAPI.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/ApplicationManagementAPI.java index 4f5aa6ad7c0..9da0a697e7f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/ApplicationManagementAPI.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/ApplicationManagementAPI.java @@ -33,13 +33,12 @@ import org.apache.cxf.jaxrs.ext.multipart.Multipart; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.application.mgt.common.*; -import org.wso2.carbon.device.application.mgt.publisher.api.beans.ErrorResponse; +import org.wso2.carbon.device.application.mgt.common.ErrorResponse; import java.util.List; import javax.validation.Valid; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/impl/ApplicationManagementAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/impl/ApplicationManagementAPIImpl.java index 1751b2a11ae..bda214825a3 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/impl/ApplicationManagementAPIImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/impl/ApplicationManagementAPIImpl.java @@ -25,7 +25,7 @@ import org.apache.cxf.jaxrs.ext.multipart.Multipart; import org.wso2.carbon.device.application.mgt.common.*; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationStorageManagementException; import org.wso2.carbon.device.application.mgt.common.exception.RequestValidatingException; -import org.wso2.carbon.device.application.mgt.publisher.api.APIUtil; +import org.wso2.carbon.device.application.mgt.core.util.APIUtil; import org.wso2.carbon.device.application.mgt.publisher.api.services.ApplicationManagementAPI; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.exception.ResourceManagementException; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/webapp/WEB-INF/cxf-servlet.xml index a75863915b6..d1b5e7b247f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -48,17 +48,17 @@ - + - - + + - + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/webapp/WEB-INF/web.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/webapp/WEB-INF/web.xml index a5426c66e9e..07aad9fdf56 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/webapp/WEB-INF/web.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/webapp/WEB-INF/web.xml @@ -73,7 +73,7 @@ ApiOriginFilter - org.wso2.carbon.device.application.mgt.publisher.api.ApiOriginFilter + org.wso2.carbon.device.application.mgt.addons.ApiOriginFilter diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/pom.xml index eac65f09235..573832ae106 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/pom.xml @@ -30,8 +30,8 @@ org.wso2.carbon.device.application.mgt.store.api 3.1.40-SNAPSHOT war - WSO2 Carbon - Application Management API - WSO2 Carbon - Application Management API + WSO2 Carbon - Application Management Store API + WSO2 Carbon - Application Management Store API http://wso2.org @@ -173,6 +173,10 @@ org.wso2.carbon.device.application.mgt.common provided + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.application.mgt.addons + org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.common @@ -232,10 +236,6 @@ org.wso2.orbit.com.fasterxml.jackson.core jackson-annotations - - org.hibernate - hibernate-validator - javax.ws.rs javax.ws.rs-api diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/APIUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/APIUtil.java deleted file mode 100644 index 1811c066d05..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/APIUtil.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - */ - -package org.wso2.carbon.device.application.mgt.store.api; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.application.mgt.common.services.ReviewManager; -import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; -import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager; -import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager; -import org.wso2.carbon.device.application.mgt.publisher.api.beans.ErrorResponse; - -import javax.ws.rs.core.Response; - -/** - * Holds util methods required for Application-Mgt API component. - */ -public class APIUtil { - - private static Log log = LogFactory.getLog(APIUtil.class); - - private static ApplicationManager applicationManager; - private static ApplicationStorageManager applicationStorageManager; - private static SubscriptionManager subscriptionManager; - - public static ApplicationManager getApplicationManager() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ApplicationManager applicationManager = (ApplicationManager) ctx.getOSGiService(ApplicationManager.class, null); - if (applicationManager == null) { - String msg = "Application Manager service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return applicationManager; - } - - /** - * To get the Application Storage Manager from the osgi context. - * - * @return ApplicationStoreManager instance in the current osgi context. - */ - public static ApplicationStorageManager getApplicationStorageManager() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ApplicationStorageManager applicationStorageManager = (ApplicationStorageManager) ctx - .getOSGiService(ApplicationStorageManager.class, null); - if (applicationStorageManager == null) { - String msg = "Application Storage Manager service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return applicationStorageManager; - } - - - /** - * To get the Subscription Manager from the osgi context. - * - * @return SubscriptionManager instance in the current osgi context. - */ - public static SubscriptionManager getSubscriptionManager() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - SubscriptionManager subscriptionManager = (SubscriptionManager) ctx - .getOSGiService(SubscriptionManager.class, null); - if (subscriptionManager == null) { - String msg = "Subscription Manager service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return subscriptionManager; - } - - /** - * To get the Review Manager from the osgi context. - * - * @return ReviewManager instance in the current osgi context. - */ - - public static ReviewManager getReviewManager() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ReviewManager reviewManager = (ReviewManager) ctx.getOSGiService(ReviewManager.class, null); - if (reviewManager == null) { - String msg = "Comments Manager service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return reviewManager; - } - - public static Response getResponse(Exception ex, Response.Status status) { - return getResponse(ex.getMessage(), status); - } - - public static Response getResponse(String message, Response.Status status) { - ErrorResponse errorMessage = new ErrorResponse(); - errorMessage.setMessage(message); - if (status == null) { - status = Response.Status.INTERNAL_SERVER_ERROR; - } - errorMessage.setCode(status.getStatusCode()); - return Response.status(status).entity(errorMessage).build(); - } - -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/beans/ErrorListItem.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/beans/ErrorListItem.java deleted file mode 100644 index 5fb80516834..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/beans/ErrorListItem.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - * - */ -package org.wso2.carbon.device.application.mgt.publisher.api.beans; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import javax.validation.constraints.NotNull; - -/** - * Represents a single error item in the error response. - */ -@ApiModel(description = "Error List Item") -public class ErrorListItem { - - @NotNull - private String code = null; - @NotNull - private String message = null; - - @ApiModelProperty(required = true, value = "") - @JsonProperty("code") - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public ErrorListItem() { - } - - public ErrorListItem(String code, String msg) { - this.code = code; - this.message = msg; - } - - /** - * Description about individual errors occurred - */ - @ApiModelProperty(required = true, value = "Description about individual errors occurred") - @JsonProperty("message") - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("errorItem {\n"); - - sb.append(" code: ").append(code).append("\n"); - sb.append(" message: ").append(message).append("\n"); - sb.append("}\n"); - return sb.toString(); - } - -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/beans/ErrorResponse.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/beans/ErrorResponse.java deleted file mode 100644 index 3b78219b855..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/beans/ErrorResponse.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - * - */ -package org.wso2.carbon.device.application.mgt.publisher.api.beans; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.device.application.mgt.publisher.api.beans.ErrorListItem; - -import java.util.ArrayList; -import java.util.List; - -/** - * This represents a response that need to be send back to the client, when the request cannot be completed - * successfully. - */ -@ApiModel(description = "Error Response") -public class ErrorResponse { - - private Integer code = null; - private String message = null; - private String description = null; - private String moreInfo = null; - private List errorItems = new ArrayList<>(); - - @JsonProperty(value = "code") - @ApiModelProperty(required = true, value = "") - public Integer getCode() { - return code; - } - - public void setCode(Integer code) { - this.code = code; - } - - @JsonProperty(value = "message") - @ApiModelProperty(required = true, value = "ErrorResponse message.") - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - @JsonProperty(value = "description") - @ApiModelProperty(value = "A detail description about the error message.") - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty(value = "moreInfo") - @ApiModelProperty(value = "Preferably an url with more details about the error.") - public String getMoreInfo() { - return moreInfo; - } - - public void setMoreInfo(String moreInfo) { - this.moreInfo = moreInfo; - } - - public void addErrorListItem(ErrorListItem item) { - this.errorItems.add(item); - } - - /** - * If there are more than one error list them out. \nFor example, list out validation errors by each field. - */ - @JsonProperty(value = "errorItems") - @ApiModelProperty(value = "If there are more than one error list them out. \n" + - "For example, list out validation errors by each field.") - public List getErrorItems() { - return errorItems; - } - - public void setErrorItems(List error) { - this.errorItems = error; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/ApplicationManagementAPI.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/ApplicationManagementAPI.java index b2068ec6bee..dafaae51083 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/ApplicationManagementAPI.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/ApplicationManagementAPI.java @@ -31,7 +31,7 @@ import io.swagger.annotations.Tag; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.application.mgt.common.Filter; -import org.wso2.carbon.device.application.mgt.publisher.api.beans.ErrorResponse; +import org.wso2.carbon.device.application.mgt.common.ErrorResponse; import org.wso2.carbon.device.application.mgt.common.Application; import org.wso2.carbon.device.application.mgt.common.ApplicationList; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/ReviewManagementAPI.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/ReviewManagementAPI.java index 6c8852aba7e..3f889d6e20e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/ReviewManagementAPI.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/ReviewManagementAPI.java @@ -31,7 +31,7 @@ import io.swagger.annotations.ApiResponses; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.application.mgt.common.PaginationResult; -import org.wso2.carbon.device.application.mgt.publisher.api.beans.ErrorResponse; +import org.wso2.carbon.device.application.mgt.common.ErrorResponse; import org.wso2.carbon.device.application.mgt.common.Review; import javax.validation.Valid; import javax.ws.rs.Path; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java index a5d62ea604c..ae4a088df96 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java @@ -22,13 +22,13 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.application.mgt.common.AppLifecycleState; import org.wso2.carbon.device.application.mgt.common.ApplicationRelease; -import org.wso2.carbon.device.application.mgt.store.api.APIUtil; import org.wso2.carbon.device.application.mgt.common.Application; import org.wso2.carbon.device.application.mgt.common.ApplicationList; import org.wso2.carbon.device.application.mgt.common.Filter; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException; +import org.wso2.carbon.device.application.mgt.core.util.APIUtil; import org.wso2.carbon.device.application.mgt.store.api.services.ApplicationManagementAPI; import javax.validation.Valid; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/ReviewManagementAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/ReviewManagementAPIImpl.java index e788e5e8f1d..da6a6a72283 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/ReviewManagementAPIImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/ReviewManagementAPIImpl.java @@ -21,20 +21,18 @@ package org.wso2.carbon.device.application.mgt.store.api.services.impl; import io.swagger.annotations.ApiParam; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.application.mgt.common.Application; import org.wso2.carbon.device.application.mgt.common.PaginationResult; import org.wso2.carbon.device.application.mgt.common.Rating; import org.wso2.carbon.device.application.mgt.common.Review; import org.wso2.carbon.device.application.mgt.common.exception.RequestValidatingException; import org.wso2.carbon.device.application.mgt.common.exception.ReviewDoesNotExistException; -import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.application.mgt.common.services.ReviewManager; import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException; -import org.wso2.carbon.device.application.mgt.store.api.APIUtil; import org.wso2.carbon.device.application.mgt.store.api.services.ReviewManagementAPI; import org.wso2.carbon.device.application.mgt.common.PaginationRequest; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.exception.ReviewManagementException; +import org.wso2.carbon.device.application.mgt.core.util.APIUtil; import javax.ws.rs.DefaultValue; import javax.ws.rs.Path; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java index 716f40f4a4a..7a195de323f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java @@ -22,11 +22,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.application.mgt.common.ApplicationInstallResponse; import org.wso2.carbon.device.application.mgt.common.EnterpriseInstallationDetails; -import org.wso2.carbon.device.application.mgt.store.api.APIUtil; import org.wso2.carbon.device.application.mgt.store.api.services.SubscriptionManagementAPI; import org.wso2.carbon.device.application.mgt.common.InstallationDetails; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager; +import org.wso2.carbon.device.application.mgt.core.util.APIUtil; + import javax.validation.Valid; import javax.ws.rs.POST; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/webapp/WEB-INF/cxf-servlet.xml index accba127edb..da9e97cceab 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -49,19 +49,19 @@ - + - - + + - + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/webapp/WEB-INF/web.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/webapp/WEB-INF/web.xml index 40fb62988f6..07c845ba825 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/webapp/WEB-INF/web.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/webapp/WEB-INF/web.xml @@ -73,7 +73,7 @@ ApiOriginFilter - org.wso2.carbon.device.application.mgt.store.api.ApiOriginFilter + org.wso2.carbon.device.application.mgt.addons.ApiOriginFilter diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/test/java/org/wso2/carbon/device/application/mgt/store/api/services/ReviewManagementAPITest.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/test/java/org/wso2/carbon/device/application/mgt/store/api/services/ReviewManagementAPITest.java index c1c361d1669..2fefff1675e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/test/java/org/wso2/carbon/device/application/mgt/store/api/services/ReviewManagementAPITest.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/test/java/org/wso2/carbon/device/application/mgt/store/api/services/ReviewManagementAPITest.java @@ -22,27 +22,11 @@ import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Ignore; -import org.mockito.Mockito; -import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; -import org.testng.Assert; -import org.testng.IObjectFactory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.ObjectFactory; -import org.testng.annotations.Test; -import org.wso2.carbon.device.application.mgt.common.Review; -import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; -import org.wso2.carbon.device.application.mgt.common.exception.ReviewManagementException; import org.wso2.carbon.device.application.mgt.common.services.ReviewManager; -import org.wso2.carbon.device.application.mgt.store.api.APIUtil; -import org.wso2.carbon.device.application.mgt.store.api.services.impl.ReviewManagementAPIImpl; -import org.wso2.carbon.device.application.mgt.store.api.services.util.CommentMgtTestHelper; - -import javax.ws.rs.core.Response; - -import static org.mockito.MockitoAnnotations.initMocks; +import org.wso2.carbon.device.application.mgt.core.util.APIUtil; @PowerMockIgnore("javax.ws.rs.*") @SuppressStaticInitializationFor({ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/pom.xml deleted file mode 100644 index 07b50760d8d..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - application-mgt - org.wso2.carbon.devicemgt - 3.0.46-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.device.application.mgt.ui - pom - 3.0.46-SNAPSHOT - WSO2 Carbon - Application Management Base UI - WSO2 Carbon - Application Management Base UI - http://wso2.org - - - - - maven-assembly-plugin - 2.5.5 - - ${project.artifactId}-${carbon.device.mgt.version} - false - - src/assembly/src.xml - - - - - create-archive - package - - single - - - - - - - - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/assembly/src.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/assembly/src.xml deleted file mode 100644 index 86251cba504..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/assembly/src.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - src - - zip - - false - ${basedir}/src - - - - ${basedir}/src/main/resources/jaggeryapps/application-mgt - /jaggeryapps/application-mgt/ - true - - - - ${basedir}/src/main/resources/jaggeryapps/uuf-template-app - /jaggeryapps/appmgt-uuf-template-app/ - true - - - ${basedir}/src/main/resources/jaggery-modules - /jaggery-modules/ - true - - - \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/module.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/module.xml deleted file mode 100644 index 485112332c2..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/module.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/exception/exception.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/exception/exception.js deleted file mode 100644 index a80361dec0f..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/exception/exception.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) WSO2 Inc. (http://wso2.com) All Rights Reserved. - * - * 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. - */ - -/** - * Description: The response of the currently invoked api enpoint is organized - */ - -var exception = {}; -var log = new Log('exception_module'); - -(function(exception) { - /** - * - * @param message The exception description - * @param code HTTP STATUS CODE related to the exception - * @return The error object - */ - exception.buildExceptionObject = function(message, code) { - var error = {}; - error.message = message; - error.code = code; - return error; - }; - - exception.handleError = function (exception, type, code){ - var constants = require('rxt').constants; - - if (type == constants.THROW_EXCEPTION_TO_CLIENT) { - log.debug(exception); - var e = exceptionModule.buildExceptionObject(exception, code); - throw e; - } else if (type == constants.LOG_AND_THROW_EXCEPTION) { - log.error(exception); - throw exception; - } else if (type == constants.LOG_EXCEPTION_AND_TERMINATE) { - log.error(exception); - var msg = 'An error occurred while serving the request!'; - var e = exceptionModule.buildExceptionObject(msg, constants.STATUS_CODES.INTERNAL_SERVER_ERROR); - throw e; - } else if (type == constants.LOG_EXCEPTION_AND_CONTINUE) { - log.debug(exception); - } - else { - log.error(exception); - throw e; - } - }; -}(exception)) - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/file/file.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/file/file.js deleted file mode 100644 index f3aa6578f52..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/file/file.js +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - * - */ -var file = {}; -(function() { - var log = new Log('utils-file'); - var CONTENT_MAP = { - 'js': 'application/javascript', - 'css': 'text/css', - 'csv': 'text/csv', - 'html': 'text/html', - 'json': 'application/json', - 'png': 'image/png', - 'jpeg': 'image/jpeg', - 'gif': 'image/gif', - 'svg': 'image/svg+xml', - 'ttf': 'application/x-font-ttf', - 'eot': 'application/vnd.ms-fontobject', - 'woff': 'application/font-woff', - 'otf': 'application/x-font-otf', - 'zip': 'application/zip', - 'xml': 'text/xml', - 'xhtml': 'application/xhtml+xml', - 'pdf': 'application/pdf' - }; - /** - * The function checks whether a directory contains a particular file - * @param dir The directory in which the file must be checked - * @param file A File object if the file exists,else null - */ - file.getFileInDir = function(dir, fileName) { - var isFilePresent = false; - var files = dir.listFiles(); - for (var index in files) { - if (files[index].getName() == fileName) { - return files[index]; - } - } - return null; - }; - /** - * The function returns the file extension of a filename - * @param file - * @return: The extension of the file - */ - file.getExtension = function(file) { - var baseFileName = file.getName(); - //Break up the name by . - var baseNameComponents = baseFileName.split('.'); - var extension = baseNameComponents[baseNameComponents.length - 1]; - return extension; - }; - /** - * The function obtains the MIME type based on the extension - * @param The extension - * @return The mime type - */ - file.getMimeType = function(extension) { - return CONTENT_MAP[extension]; - }; - /** - * The function returns the name of the file without the file extension - * @param file A file object - * @return: The name of the file without the extension - */ - file.getFileName = function(file) { - //Get the name of the file - var baseFileName = file.getName(); - //Break up the name by . - var baseNameComponents = baseFileName.split('.'); - //Get all of the components except the last one - baseNameComponents.splice(baseNameComponents.length - 1, 1); - return baseNameComponents.join('.'); - }; - /** - * The function returns the contents of a directory as a JSON object.The name of the - * file is used as the property names without the extensions. - * NOTE: The method will not traverse sub folders. - * @param The directory to be inspected - * @return A JSON object which contains the files in the directory - */ - file.getDirectoryContents = function(dir) { - var dirContents = {}; - //Check if it is a directory - if (!dir.isDirectory()) { - log.info('Not a directory'); - return dirContents; - } - //Obtain a list of all files - var files = this.getAllFiles(dir); - var name; - log.info('Files: ' + files); - //Create the directory object with each file been a property - for (var index in files) { - dirContents[this.getFileName(files[index])] = files[index]; - } - return dirContents; - }; - /** - * The function obtains a list of files that are not directories - * @param dir The directory to be inspected - * @return An array with all of the files in the directory - */ - file.getAllFiles = function(dir) { - var filesInDir = []; - if (!dir.isDirectory()) { - return filesInDir; - } - //Obtain a list of all files - var files = dir.listFiles(); - for (var index in files) { - log.info('Checking file: ' + files[index].getName()); - //Check if the file is a directory - if (!files[index].isDirectory()) { - filesInDir.push(files[index]); - } - } - return filesInDir; - }; - /** - * The function returns a list of all file names in a directory - * @param dir The directory to be inspected - * @return {An array containing the name of all files in a directory - */ - file.getAllFileNames = function(dir) { - var files = dir.listFiles(); - var list = []; - var fileName; - for (var index in files) { - if (files[index].isDirectory()) { - fileName=this.getFileName(files[index].getName()); - list.push(fileName); - } - } - return list; - }; - /** - * The function returns a list of all sub directories in a given directory - * @param dir The root directory - * @return: An array containing all sub directories - */ - file.getAllSubDirs = function(dir) { - var files = dir.listFiles(); - var subDirs = []; - for (var index in files) { - if (files[index].isDirectory()) { - subDirs.push(files[index]); - } - } - return subDirs; - }; -}()); \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/patterns/patterns.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/patterns/patterns.js deleted file mode 100644 index f0e55bb2542..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/patterns/patterns.js +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - * - */ -var patterns = {}; - -(function () { - - var DEF_ERR_ARITY = 3; - var DEF_HANDLE_ARITY = 2; - var log = new Log('utils.patterns.GenericPipe'); - - function GenericPipe(options) { - this.errHandlerArity = DEF_ERR_ARITY || options.errArity; - this.handlerArity = DEF_HANDLE_ARITY || options.handlerArity; - this.plugins = []; - this.finalHandler = function () { - }; - } - - - /** - *The function registers the provided plugin - */ - GenericPipe.prototype.plug = function (plugin, options) { - var options = options || {}; - //Only a function - if (plugin instanceof Function) { - this.plugins.push({ - handle: plugin, - options: options - }); - } - //Is it a plugin object - else if (plugin instanceof Object) { - plugin.options = options; - this.plugins.push(plugin); - } - - return this; - }; - - GenericPipe.prototype.finally = function (plugin) { - this.finalHandler = plugin; - return this; - }; - - GenericPipe.prototype.resolve = function (data, req, res, session) { - var context = {}; - context.req = req; - context.res = res; - context.session = session; - context.data = data; - handle(context, this.plugins, this.errHandlerArity, this.handlerArity, this.finalHandler); - }; - - var handle = function (context, plugins, errArity, handlerArity, finallyHandler) { - var index = 0; - var currentPlugin; - - var recursiveHandle = function (err) { - - currentPlugin = plugins[index]; - - index++; - - //Check if there is a plugin - if (!currentPlugin) { - //log.warn('No plugin found at index: ' + index); - return; - } - - //Populate the options object for the plugin - context.options=currentPlugin.options;; - - //Check if an error has been provided - if (err) { - //Can the current plugin handle the err - if (currentPlugin.handle.length == errArity) { - try { - currentPlugin.handle(err, context,recursiveHandle); - } - catch (e) { - recursiveHandle(e); - } - } - else { - recursiveHandle(err); - } - } - //There is no error so try to invoke the current plugin - else { - if (currentPlugin.handle.length == handlerArity) { - try { - - - currentPlugin.handle(context,recursiveHandle); - } catch (e) { - recursiveHandle(e); - } - } - else { - recursiveHandle(); - } - } - }; - - recursiveHandle(); - finallyHandler(context); - }; - - patterns.GenericPipe = GenericPipe; - -}()); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/reflection/reflection.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/reflection/reflection.js deleted file mode 100644 index 77ff58d49e6..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/reflection/reflection.js +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - * - */ -var reflection = {}; -/** - * Description: The script encapsulates any reflection related utility functions - */ -(function() { - var log = new Log('utils-reflection'); - reflection.copyPropKeys = function(from, to) { - for (var key in from) { - if (from.hasOwnProperty(key)) { - to[key] = ''; - } - } - return to; - }; - /** - * The function recursively copies all property keys in an object - * @param from - * @param to - */ - reflection.copyAllPropKeys = function(from, to) { - recurse(from, to, function(from, to, key) { - if (from[key] instanceof Object) { - to[key] = from[key]; - } else { - to[key] = null; - } - }); - }; - reflection.copyAllPropValues = function(from, to) { - recurse(from, to, function(from, to, key) { - //Create an instance if the property does not exist - if (!to[key]) { - to[key] = {}; - } - //Copy the values over - if (!(from[key] instanceof Object)) { - to[key] = from[key]; - } else { - log.debug('Not copying values of key: ' + key); - } - }); - }; - /** - * The function will only copy public properties - * @param from - * @param to - */ - reflection.copyPublicPropValues = function(from, to) { - recurse(from, to, function(from, to, key) { - //Ignore any hidden properties - if (key.charAt(0) == '_') { - log.warn('Drop key: ' + key); - return; - } - //Create an instance if the property does not exist - if (!to[key]) { - to[key] = {}; - } - //Copy the values over - if (!(from[key] instanceof Object)) { - to[key] = from[key]; - } else { - log.warn('Not copying values of key: ' + key); - } - }); - }; - reflection.inspect = function(from, to, cb) { - recurse(from, to, cb); - }; - /** - * The function recursively traverses an object and then invokes the provided - * callback - * @param root - * @param clone - * @param cb - */ - var recurse = function(root, clone, cb) { - var key; - //Check if the root is an object - if (!(root instanceof Object)) { - return; - } else { - var keys = Object.keys(root); - //Go through all the other keys in the current root - for (var index in keys) { - key = keys[index]; - cb(root, clone, key); - recurse(root[key], clone[key], cb); - } - } - }; - reflection.copyProps = function(from, to) { - for (var key in from) { - if (from.hasOwnProperty(key)) { - to[key] = from[key]; - } - } - return to; - }; - reflection.getProps = function(obj) { - var props = {}; - for (var key in obj) { - if (!(obj[key] instanceof Function)) { - props[key] = obj[key]; - } - } - return props; - }; - reflection.printProps = function(obj) { - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - log.info('key: ' + key); - } - } - }; - /** - * The function determines if a property is hidden based on _ - * @param key - * @returns {boolean} - */ - reflection.isHiddenProp = function(key) { - if (key == '') { - return false; - } - return (key.charAt(0) == '_') ? true : false; - }; - var getDiff = function(a, b, diff) {}; - /** - * The function calculates the differences between two simple JSON objects - * @param a The object with which b is compared - * @param b The target of the comparison - * @return An object which records the differences between the two objects - */ - reflection.diff = function(a, b) {}; - /** - * The function merges the two provided objects to create a new - * object.In the case where b has the same property as a; the property of b - * will have precedence - * @param {[type]} a [description] - * @param {[type]} b [description] - * @return A new object having the properties of both object a and b - */ - reflection.merge = function(a, b) { - var newObj = {}; - //Copy the properties of a first - for (var key in a) { - newObj[key] = b[key]; - } - //Override with the properties of b - for (var key in b) { - newObj[key] = b[key]; - } - return newObj; - }; - /** - * The function allows a child class to override a select set of methods of - * a parent class.The original methods of the parent can be accessed - * using the this._super keyword - * @param {[type]} parent The parent class instance to be overriden - * @param {[type]} child The child class instance containing methods which will override the parent - */ - reflection.override = function(parent, child) { - //Make a clone of the parent - var super = parse(stringify(parent)); - for (var childKey in child) { - for (var parentKey in parent) { - //Only override those methods that are common - if (childKey === parentKey) { - var parentPtr = parent[parentKey]; - var childPtr = child[childKey]; - //Update the clone with the old parent method - super[parentKey] = parentPtr; - parent[parentKey] = childPtr; - /*parent[parentKey] = function() { - var result=childPtr.apply(this, arguments)||null; - return result; - };*/ - } - } - } - //Allow the child object to call methods of the parent - parent._super = super; - }; - reflection.overrideAll=function(parent,child){ - //Make a clone of the parent - var super = parse(stringify(parent)); - for (var childKey in child) { - for (var parentKey in parent) { - //Only override those methods that are common - if ( (child.hasOwnProperty(childKey))&&(parent.hasOwnProperty(parentKey)) ) { - var parentPtr = parent[parentKey]; - var childPtr = child[childKey]; - //Update the clone with the old parent method - super[parentKey] = parentPtr; - parent[parentKey] = childPtr; - /*parent[parentKey] = function() { - var result=childPtr.apply(this, arguments)||null; - return result; - };*/ - } - } - } - //Allow the child object to call methods of the parent - parent._super = super; - }; - reflection.isArray = function(object) { - if (Object.prototype.toString.call(object) === '[object Array]') { - return true; - } - return false; - }; -}()); \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/request/request.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/request/request.js deleted file mode 100644 index 4218da70fde..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/request/request.js +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - * - */ -var request = {}; -(function(request) { - var hasOwnProperty = function(obj, element) { - return Object.prototype.hasOwnProperty.call(obj, element); - }; - var isObject = function(object) {; - return typeof object === 'object'; - }; - /* - * ECMA Standard (ECMA-262 : 5.1 Edition)*/ - var decodes = function(encodedURI) { - return decodeURIComponent(encodedURI); - }; - request.getQueryOptions = function(queryString) { - var opt={}; - var sep = opt.sep || '&', - assign = opt.assign || '=', - compoArray = []; - var obj = {}; - var decodedURI = decodes(queryString); - decodedURI.split(sep).forEach(function(comp) { - comp.split(assign).some(function(element, index, array) { - if (hasOwnProperty(obj, element.toString())) { - compoArray.push(obj[element]); - compoArray.push(array[1]); - obj[element] = compoArray; - } else { - Object.defineProperty(obj, element, { - enumerable: true, - writable: true, - value: array[1] - }); - } - return true; - }); - }); - return obj; - }; -}(request)) \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/response/response.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/response/response.js deleted file mode 100644 index a8dae442470..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/response/response.js +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) WSO2 Inc. (http://wso2.com) All Rights Reserved. - * - * 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. - */ - -/** - * Description: The response of the currently invoked api endpoint is organized - */ - -var response = {}; -var log = new Log("response"); - -(function(response) { - - /** - * Build Error response - * @param resp jaggery-response object to retrieve to client - * @param code status code - * @param message message to the client side - * @return return response - */ - response.buildErrorResponse = function(resp,code,message) { - var content={}; - content.error = message; - resp = processResponse(resp,code,content); - return resp; - }; - - /** - * Build success response - * @param resp jaggery response object - * @param code status code - * @param data the result to client - * @return return response - */ - response.buildSuccessResponse= function(resp, code, data){ - var content={}; - content.data = data; - resp = processResponse(resp,code,content); - return resp; - }; - - /** - * process General response - * @param resp jaggery response - * @param code status code - * @param data success result - * @return resp jaggery response - */ - response.buildSuccessResponseForRxt= function(resp, code, data){ - resp.status = code; - resp.content = data; - return resp; - }; - - /** - * General response builder - * @param resp jaggery response - * @param code status code - * @param content what ever the content to be sent as response - * @return resp jaggery response - */ - function processResponse(resp, code, content){ - resp.status = code; - resp.contentType = 'application/json'; - resp.content = content; - return resp; - - }; - - /** - * - * @param resp - * @param code - * @param data - * @return The http response - */ - response.buildSuccessResponseForRxt= function(resp, code, data){ - resp.contentType = 'application/json'; - resp.status = code; - resp.content = data; - return resp; - }; - -}(response)) \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/time/time.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/time/time.js deleted file mode 100644 index 142d4fa73c3..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/time/time.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - * - */ -var time = {}; -(function(time) { - time.getCurrentTime = function(dateLength) { - var dateLength=dateLength||20; - var now = new String(new Date().valueOf()); - var length = now.length; - var prefix = dateLength; - var onsetVal = ''; - if (length != prefix) { - var onset = prefix - length; - for (var i = 0; i < onset; i++) { - onsetVal += '0'; - } - } - return onsetVal + now; - }; -}(time)); \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/url/url.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/url/url.js deleted file mode 100644 index 5f8154607ad..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/url/url.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - * - */ -var url = {}; -(function() { - var log=new Log('utils-url'); - url.popServerDetails = function(obj) { - var process = require('process'); - var localIP = process.getProperty('server.host'); - var httpPort = process.getProperty('http.port'); - var httpsPort = process.getProperty('https.port'); - var value = ''; - var carbonLocalIP = process.getProperty('carbon.local.ip'); - - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - value = obj[key]; - if ((typeof value === 'string') && value.indexOf('%https.host%') > -1) { - value=value.replace('%https.host%', 'https://' + localIP + ':' + httpsPort); - } else if ((typeof value === 'string') && value.indexOf('%http.host%') > -1) { - value=value.replace('%http.host%', 'http://' + localIP + ':' + httpPort); - } else if ((typeof value === 'string') && value.indexOf('%https.carbon.local.ip%') > -1) { - value=value.replace('%https.carbon.local.ip%', 'https://' + carbonLocalIP + ':' + httpsPort); - } else if ((typeof value === 'string') && value.indexOf('%http.carbon.local.ip%') > -1) { - value=value.replace('%http.carbon.local.ip%', 'http://' + carbonLocalIP + ':' + httpPort); - } - obj[key] = value; - } - } - return obj; - }; -}(url)); \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/xml/xml.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/xml/xml.js deleted file mode 100644 index 7caefe9d070..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/xml/xml.js +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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. - * - */ -var xml = {}; - -(function () { - - var log=new Log('util.xml') - - /* - The method is used to create a JSON object using - an xml object. - @xmlElement: An xml element object to be processed - @return: A pseudo object containing the properties of the - xml element. - */ - var createJSONObject = function (xmlElement) { - - var pseudo = {}; - - //Extract all attributes - var attributes = xmlElement.@*; - - //Fill the pseudo object with the attributes of the element - for (var attributeKey in attributes) { - var attribute = attributes[attributeKey]; - pseudo[attribute.localName()] = attribute.toString(); - } - - return pseudo; - }; - - /* - The function converts an E4X Xml object to a JSON object - This function has been adapted from the work of Oleg Podsechin available at - https://gist.github.com/olegp/642667 - It uses a slightly modified version of his algorithm , therefore - all credit should be attributed to Oleg Podsechin. - IMPORTANT: - 1. It does not create a 1..1 mapping due to the differences - between Xml and JSON.It is IMPORTANT that you verify the structure - of the object generated before using it. - 2. The input xml object must not contain the xml header information - This is a known bug 336551 (Mozilla Developer Network) - Source: https://developer.mozilla.org/en/docs/E4X - Please remove the header prior to sending the xml object for processing. - @root: A starting element in an E4X Xml object - @return: A JSON object mirroring the provided Xml object - */ - var recursiveConvertE4XtoJSON = function (root) { - - log.debug('Root: ' + root.localName()); - - //Obtain child nodes - var children = root.*; - - //The number of children - var numChildren = children.length(); - - //No children - if (numChildren == 0) { - - //Extract contents - return createJSONObject(root); - } - else { - - //Create an empty object - var rootObject = createJSONObject(root); - - //Could be multiple children - for (var childElementKey in children) { - - var child = children[childElementKey]; - - log.debug('Examining child: ' + child.localName()); - - //If the child just contains a single value then stop - if (child.localName() == undefined) { - - log.debug('Child is undefined: ' + child.toString()); - - //Change the object to just a key value pair - rootObject[root.localName()] = child.toString(); - return rootObject; - } - - //Make a recursive call to construct the child element - var createdObject = recursiveConvertE4XtoJSON(child); - - log.debug('Converted object: ' + stringify(createdObject)); - - //Check if the root object has the property - if (rootObject.hasOwnProperty(child.localName())) { - - log.debug('key: ' + child.localName() + ' already present.'); - rootObject[child.localName()].push(createdObject); - } - else { - - log.debug('key: ' + child.localName() + ' not present.'); - rootObject[child.localName()] = []; - rootObject[child.localName()].push(createdObject); - - } - } - - log.debug('root: ' + root.localName()); - - return rootObject; - } - }; - - /** - * The function is used to convert an E4X xml to JSON - * @param root - */ - xml.convertE4XtoJSON = function (root) { - return recursiveConvertE4XtoJSON(root); - }; - - -}()); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error400-cloud.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error400-cloud.html deleted file mode 100644 index 3007e7d0bed..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error400-cloud.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - -
-
-
- -
-
-

Oops something went wrong

-

400 - Bad request

-
- -
-
- -
-
-
-
- - \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error400.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error400.html deleted file mode 100644 index 3b0349ef37f..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error400.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - Bad request - Error 400 - - - - - - -

Error 400

-

We are unable to understand the request and process it. Please re-check your request.

- - - - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error401-cloud.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error401-cloud.html deleted file mode 100644 index 8c195bd0f0a..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error401-cloud.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - -
-
-
- -
-
-

Oops something went wrong

-

401 - Unauthorized

-
- -
-
- -
-
-
-
- - \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error401.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error401.html deleted file mode 100644 index 0502d8fda61..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error401.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - Unauthorized - Error 401 - - - - - - -

Error 401

-

You do not have permission to access this page.Please contact your administrator and request permission.

- - - - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error403-cloud.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error403-cloud.html deleted file mode 100644 index d9d7d00b0c7..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error403-cloud.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - -
-
-
- -
-
-

Oops something went wrong

-

403 - Forbidden

-
- -
-
- -
-
-
-
- - \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error403.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error403.html deleted file mode 100644 index b4fbfdaceb4..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error403.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - Forbidden - Error 403 - - - - - - - -

Error 403

-

We cannot process this request.

- - - - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error404-cloud.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error404-cloud.html deleted file mode 100644 index 897eeb4821e..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error404-cloud.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - -
-
-
- -
-
-

Oops something went wrong

-

404 - Page Not Found

-
- -
-
- -
-
-
-
- - \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error404.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error404.html deleted file mode 100644 index d2a9cd03652..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error404.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - Page not found - Error 404 - - - - - - -

Error 404

-

We can't find what you are looking for.

- - - - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error405-cloud.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error405-cloud.html deleted file mode 100644 index bc3d5bdd570..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error405-cloud.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - -
-
-
- -
-
-

Oops something went wrong

-

405 - Method Not Allowed

-
- -
-
- -
-
-
-
- - \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error405.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error405.html deleted file mode 100644 index dd1b7812469..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error405.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - Method not allowed - Error 405 - - - - - - -

Error 405

-

Method not allowed.

- - - - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error500-cloud.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error500-cloud.html deleted file mode 100644 index 1ece4cc29dc..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error500-cloud.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - -
-
-
- -
-
-

Oops something went wrong

-

500 - Internal Server Error

-
- -
-
- -
-
-
-
- - \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error500.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error500.html deleted file mode 100644 index 4ec7b172283..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error500.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - Internal Server Error - Error 500 - - - - - -

Error 500

-

Something went wrong and we're trying to fix it.

- - - - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/jaggery.conf b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/jaggery.conf deleted file mode 100644 index b7f5e6c5ba2..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/jaggery.conf +++ /dev/null @@ -1,100 +0,0 @@ -{ - "displayName": "Carbon Application Management App", - "logLevel": "info", - "urlMappings": [ - { - "url": "/uuf/login", - "path": "/lib/modules/auth/login.jag" - }, - { - "url": "/uuf/logout", - "path": "/lib/modules/auth/logout.jag" - }, - { - "url": "/uuf/sso/acs", - "path": "/lib/modules/auth/acs.jag" - }, - { - "url": "/public/*", - "path": "/lib/static-files.jag" - }, - { - "url": "/unit/*", - "path": "/lib/units.jag" - }, - { - "url": "/*", - "path": "/lib/pages.jag" - } - ], - "errorPages": { - "500": "/error-pages/error500.html", - "404": "/error-pages/error404.html", - "401": "/error-pages/error401.html", - "405": "/error-pages/error405.html", - "403": "/error-pages/error403.html", - "400": "/error-pages/error400.html" - }, - "filters": [ - { - "name": "ContentTypeBasedCachePreventionFilter", - "class": "org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter", - "params" : [ - {"name" : "patterns", "value" : "text/html\" ,application/json\" ,text/plain"}, - {"name" : "filterAction", "value" : "enforce"}, - {"name" : "httpHeaders", "value" : "Cache-Control: no-store, no-cache, must-revalidate, private"} - ] - }, - { - "name":"HttpHeaderSecurityFilter", - "class":"org.apache.catalina.filters.HttpHeaderSecurityFilter", - "params" : [{"name" : "hstsEnabled", "value" : "false"}] - }, - { - "name" : "CSRFGuard", - "class" : "org.owasp.csrfguard.CsrfGuardFilter" - } - - ], - "filterMappings": [ - { - "name":"HttpHeaderSecurityFilter", - "url":"*" - }, - { - "name" : "CSRFGuard", - "url" : "/*" - }, - { - "name":"ContentTypeBasedCachePreventionFilter", - "url":"*" - } - - ], - "listeners" : [ - { - "class" : "org.owasp.csrfguard.CsrfGuardServletContextListener" - }, - { - "class" : "org.owasp.csrfguard.CsrfGuardHttpSessionListener" - } - ], - "servlets" : [ - { - "name" : "JavaScriptServlet", - "class" : "org.owasp.csrfguard.servlet.JavaScriptServlet" - } - ], - "servletMappings" : [ - { - "name" : "JavaScriptServlet", - "url" : "/csrf.js" - } - ], - "contextParams" : [ - { - "name" : "Owasp.CsrfGuard.Config", - "value" : "repository/conf/security/Owasp.CsrfGuard.dashboard.properties" - } - ] -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/app-conf.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/app-conf.json deleted file mode 100644 index 63bcd3f5f18..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/app-conf.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "appName": "UUF Template App", - "cachingEnabled": false, - "debuggingEnabled": false, - "permissionRoot": "/", - "loginPage": "uuf.page.sign-in", - "adminServicesUrl": "https://${server.ip}:${server.https_port}/admin/services/", - "authModule": { - "enabled": true, - "login": { - "onSuccess": { - "script": "/app/modules/login.js", - "page": "uuf.page.home" - }, - "onFail": { - "script": "/app/modules/login.js", - "page": "uuf.page.sign-in" - } - }, - "logout": { - "onSuccess": { - "script": "/app/modules/logout.js", - "page": "uuf.page.sign-in" - }, - "onFail": { - "script": "/app/modules/logout.js", - "page": "uuf.page.home" - } - }, - "sso": { - "enabled": false, - "issuer": "uuf", - "responseSigningEnabled": true, - "keyStoreName": "repository/resources/security/wso2carbon.jks", - "keyStorePassword": "wso2carbon", - "identityProviderAlias": "wso2carbon", - "identityProviderUrl": "https://${server.ip}:${server.https_port}/samlsso", - "intermediatePage": "uuf.page.sso-intermediate" - } - }, - "errorPages": { - "404": "uuf.page.error", - "default": "uuf.page.error" - } -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/uuf-conf.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/uuf-conf.json deleted file mode 100644 index 72d2df1edfd..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/uuf-conf.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "displayName": "UUF Template App", - "logLevel": "debug" -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.default.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.default.hbs deleted file mode 100644 index a67a3e63eba..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.default.hbs +++ /dev/null @@ -1,67 +0,0 @@ -{{!-- -* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -* -* WSO2 Inc. 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. ---}} - - - - - - - - - {{#defineZone "title"}}WSO2 Template{{/defineZone}} - {{defineZone "favicon"}} - {{defineZone "topCss"}} - {{defineZone "topJs"}} - - - -{{defineZone "header"}} - - - - - - - -{{defineZone "sidePanes"}} - - - -
- {{defineZone "contentTitle"}} -
-
- {{defineZone "content"}} -
-
-
- - - -
-
- {{defineZone "footer"}} -
-
- - -{{defineZone "bottomJs"}} - - \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.sign-in.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.sign-in.hbs deleted file mode 100644 index 3283927e565..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.sign-in.hbs +++ /dev/null @@ -1,56 +0,0 @@ -{{!-- -* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -* -* WSO2 Inc. 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. ---}} - - - - - - - - - {{#defineZone "title"}}WSO2 Template{{/defineZone}} - {{defineZone "favicon"}} - {{defineZone "topCss"}} - {{defineZone "topJs"}} - - - -{{defineZone "header"}} - - - -
-
-
- {{defineZone "content"}} -
-
-
- - - -
-
- {{defineZone "footer"}} -
-
- - -{{defineZone "bottomJs"}} - - \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.hbs deleted file mode 100644 index a4a31d008cb..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.hbs +++ /dev/null @@ -1,38 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. 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. -}} -{{#zone "title"}}Error | {{@app.conf.appName}}{{/zone}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -{{/zone}} - -{{#zone "content"}} -
    -

    An Error Occurred!

    - -
    -
    HTTP Status : {{@page.params.status}}
    - -

    {{@page.params.message}}

    -
    -
    -{{/zone}} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.json deleted file mode 100644 index c60eb52075f..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/error/default", - "layout": "uuf.layout.default", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/public/js/sign-in-validations.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/public/js/sign-in-validations.js deleted file mode 100644 index 2db2c795f7c..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/public/js/sign-in-validations.js +++ /dev/null @@ -1,24 +0,0 @@ -$(document).ready(function(){ - $("#signInForm").validate({ - rules: { - username: { - required: true, - minlength: 3 - }, - password: { - required: true, - minlength: 3 - } - }, - messages: { - username: { - required: "Please enter a username", - minlength: "Your username must consist of at least 3 characters" - }, - password: { - required: "Please provide a password", - minlength: "Your password must be at least 3 characters long" - } - } - }); -}); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.hbs deleted file mode 100644 index ba781f71b35..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.hbs +++ /dev/null @@ -1,63 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. 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. -}} -{{#zone "title"}}Sign In | {{@app.conf.appName}}{{/zone}} - -{{~#zone "content"}} -
    -
    -
    -

    - {{#defineZone "signIn-title" scope="protected"}}Sign In to UUF Template App{{/defineZone}} -

    -
    -
    - {{#if message}} -
    - {{message}}! -
    - {{/if}} -
    -
    - -
    -
    - -
    - {{#if referer}} - - {{/if}} -
    - -
    - {{defineZone "signInForm-below" scope="protected"}} -
    -
    -
    -
    -{{/zone}} - -{{! sign-in form validation}} -{{~unit "uuf.unit.lib.form-validation"}} -{{~#zone "bottomJs"}} - {{~js "js/sign-in-validations.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.js deleted file mode 100644 index 939e7c82b02..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.js +++ /dev/null @@ -1,30 +0,0 @@ -function onRequest(context) { - var authModuleConfigs = context.app.conf["authModule"]; - if (authModuleConfigs && (authModuleConfigs["enabled"].toString() == "true")) { - // Auth module is enabled. - if (context.user) { - // User is already logged in. - response.sendRedirect(context.app.context + "/"); - exit(); - } else { - // User is not logged in. - var ssoConfigs = authModuleConfigs["sso"]; - if (ssoConfigs && (ssoConfigs["enabled"].toString() == "true")) { - // SSO is enabled in Auth module. - var redirectUri = context.app.context + "/uuf/login"; - var queryString = request.getQueryString(); - if (queryString && (queryString.length > 0)) { - redirectUri = redirectUri + "?" + queryString; - } - response.sendRedirect(encodeURI(redirectUri)); - exit(); - } else { - // Generic login process is enabled. - return { - message: request.getParameter("error"), - referer: request.getParameter("referer") - }; - } - } - } -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.json deleted file mode 100644 index 4bafc2dbb9b..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/signin", - "layout": "uuf.layout.sign-in", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.hbs deleted file mode 100644 index 23e70695fc8..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.hbs +++ /dev/null @@ -1,18 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. 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. -}} -{{! This template won't be rendered. So nothing is here }} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.js deleted file mode 100644 index 527c977335f..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.js +++ /dev/null @@ -1,16 +0,0 @@ -function onRequest(context) { - var authModuleConfigs = context.app.conf["authModule"]; - if (authModuleConfigs && (authModuleConfigs["enabled"].toString() == "true")) { - // Auth module is enabled. - if (context.user) { - // User is logged in. - response.sendRedirect(context.app.context + "/uuf/logout"); - exit(); - } else { - // User is already logged out. - response.sendRedirect(context.app.context + "/"); - exit(); - } - } - -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.json deleted file mode 100644 index 0667f6f06de..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/signout", - "layout": "uuf.layout.sign-in" -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.hbs deleted file mode 100644 index 73de91e94dd..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.hbs +++ /dev/null @@ -1,45 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. 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. -}} -{{#zone "title"}}Sign In | {{@app.conf.appName}}{{/zone}} - -{{unit "uuf.unit.theme"}} -{{unit "uuf.unit.header.logo"}}{{unit "uuf.unit.header"}} -{{unit "uuf.unit.footer"}} - -{{#zone "content"}} -
    -

    - You are now being redirected to Identity Server. If the redirection fails, please click - on the button below. -

    - -
    -
    - - - - -
    -
    -
    -{{/zone}} - -{{#zone "bottomJs"}} - -{{/zone}} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.json deleted file mode 100644 index e3c6cdde287..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "uri": "//", - "layout": "uuf.layout.sign-in", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.hbs deleted file mode 100644 index 51a365f77e5..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.hbs +++ /dev/null @@ -1,27 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. 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. -}} - \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.js deleted file mode 100644 index aa4e1482f46..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.js +++ /dev/null @@ -1,15 +0,0 @@ -function onRequest(context) { - var type = context.unit.params.type; - switch (type) { - case "success": - return {icon: "ok"}; - case "info": - return {icon: "info"}; - case "warning": - return {icon: "warning"}; - case "danger": - return {icon: "error"}; - default: - return {icon: "ok"}; - } -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.json deleted file mode 100644 index f2f22da9a90..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "version": "1.0.0", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.hbs deleted file mode 100644 index 4e564175537..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.hbs +++ /dev/null @@ -1,24 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. 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. -}} -{{#zone "favicon"}} - {{#if isCloud}} - - {{else}} - - {{/if}} -{{/zone}} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.js deleted file mode 100644 index 76da4c18f01..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.js +++ /dev/null @@ -1,8 +0,0 @@ -function onRequest(context) { - - var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var viewModel = {}; - viewModel.isCloud = deviceMgtProps.isCloud; - return viewModel; - -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.json deleted file mode 100644 index 6e8b1666ca7..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": "1.0.0", - "pushedUris": [ - "/", - "/{+any}" - ], - "isAnonymous": true -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/cloud-favicon.png b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/cloud-favicon.png deleted file mode 100644 index e9d327e6134..00000000000 Binary files a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/cloud-favicon.png and /dev/null differ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/favicon.png b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/favicon.png deleted file mode 100644 index a1deab3581b..00000000000 Binary files a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/favicon.png and /dev/null differ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs deleted file mode 100644 index e726ab6dd75..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs +++ /dev/null @@ -1,23 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. 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. -}} -{{#zone "footer"}} -

    - WSO2 | © 2015 - Inc. -

    -{{/zone}} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.json deleted file mode 100644 index 6e8b1666ca7..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": "1.0.0", - "pushedUris": [ - "/", - "/{+any}" - ], - "isAnonymous": true -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.hbs deleted file mode 100644 index 4ce5f300d4b..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.hbs +++ /dev/null @@ -1,27 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. 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. -}} -{{#zone "brand"}} - - -

    - 
 - {{#defineZone "productNameResponsive"}}UUI Tmpl. App{{/defineZone}} -

    -
    -{{/zone}} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.json deleted file mode 100644 index 38acf5dc9c1..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": "1.0.0", - "index": 9100, - "pushedUris": [ - "/", - "/{+any}" - ], - "isAnonymous": true -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/public/img/logo.png b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/public/img/logo.png deleted file mode 100644 index 8fc1947a6ab..00000000000 Binary files a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/public/img/logo.png and /dev/null differ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.hbs deleted file mode 100644 index d14d5dfed6b..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.hbs +++ /dev/null @@ -1,39 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. 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. -}} -{{#zone "userMenu"}} - -{{/zone}} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.json deleted file mode 100644 index 614b0890bdb..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": "1.0.0", - "index": 9110, - "pushedUris": [ - "/", - "/{+any}" - ] -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs deleted file mode 100644 index af3e248189d..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs +++ /dev/null @@ -1,32 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. 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. -}} -{{#zone "header"}} -
    -
    -
    - {{defineZone "brand"}} -
    -
    - {{defineZone "cloudMenu"}} -
    -
    - {{defineZone "userMenu"}} -
    -
    -
    -{{/zone}} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.json deleted file mode 100644 index 8a3fe9c7c8f..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": "1.0.0", - "index": 9199, - "pushedUris": [ - "/", - "/{+any}" - ], - "isAnonymous": true -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.hbs deleted file mode 100644 index e2e188f5a2b..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.hbs +++ /dev/null @@ -1,27 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. 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. -}} -{{#zone "topCss"}} - {{~css "data-tables_1.10.7/extensions/Bootstrap/css/dataTables.bootstrap.css"}} - {{~css "data-tables_1.10.7/extensions/Responsive/css/dataTables.responsive.css"}} -{{/zone}} - -{{~#zone "bottomJs"}} - {{~js "data-tables_1.10.7/media/js/jquery.dataTables.min.js"}} - {{~js "data-tables_1.10.7/extensions/Bootstrap/js/dataTables.bootstrap.js"}} - {{~js "data-tables_1.10.7/extensions/Responsive/js/dataTables.responsive.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.json deleted file mode 100644 index f2f22da9a90..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "version": "1.0.0", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.css deleted file mode 100644 index cab59b3a059..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.css +++ /dev/null @@ -1,24 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * AutoFill styles - */ - -div.AutoFill_filler { - display: none; - position: absolute; - height: 14px; - width: 14px; - background: url(../images/filler.png) no-repeat center center; - z-index: 1002; -} - -div.AutoFill_border { - display: none; - position: absolute; - background-color: #0063dc; - z-index: 1001; - - box-shadow: 0px 0px 5px #76b4ff; - -moz-box-shadow: 0px 0px 5px #76b4ff; - -webkit-box-shadow: 0px 0px 5px #76b4ff; -} - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.min.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.min.css deleted file mode 100644 index b485f2163fc..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.min.css +++ /dev/null @@ -1 +0,0 @@ -div.AutoFill_filler{display:none;position:absolute;height:14px;width:14px;background:url(../images/filler.png) no-repeat center center;z-index:1002}div.AutoFill_border{display:none;position:absolute;background-color:#0063dc;z-index:1001;box-shadow:0px 0px 5px #76b4ff;-moz-box-shadow:0px 0px 5px #76b4ff;-webkit-box-shadow:0px 0px 5px #76b4ff} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/images/filler.png b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/images/filler.png deleted file mode 100644 index f2af65d8c38..00000000000 Binary files a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/images/filler.png and /dev/null differ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/js/dataTables.autoFill.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/js/dataTables.autoFill.js deleted file mode 100644 index 6bbfa35b937..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/js/dataTables.autoFill.js +++ /dev/null @@ -1,855 +0,0 @@ -/*! AutoFill 1.2.1 - * ©2008-2014 SpryMedia Ltd - datatables.net/license - */ - -/** - * @summary AutoFill - * @description Add Excel like click and drag auto-fill options to DataTables - * @version 1.2.1 - * @file dataTables.autoFill.js - * @author SpryMedia Ltd (www.sprymedia.co.uk) - * @contact www.sprymedia.co.uk/contact - * @copyright Copyright 2010-2014 SpryMedia Ltd. - * - * This source file is free software, available under the following license: - * MIT license - http://datatables.net/license/mit - * - * This source file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. - * - * For details please refer to: http://www.datatables.net - */ - -(function( window, document, undefined ) { - -var factory = function( $, DataTable ) { -"use strict"; - -/** - * AutoFill provides Excel like auto-fill features for a DataTable - * - * @class AutoFill - * @constructor - * @param {object} oTD DataTables settings object - * @param {object} oConfig Configuration object for AutoFill - */ -var AutoFill = function( oDT, oConfig ) -{ - /* Sanity check that we are a new instance */ - if ( ! (this instanceof AutoFill) ) { - throw( "Warning: AutoFill must be initialised with the keyword 'new'" ); - } - - if ( ! $.fn.dataTableExt.fnVersionCheck('1.7.0') ) { - throw( "Warning: AutoFill requires DataTables 1.7 or greater"); - } - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public class variables - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - this.c = {}; - - /** - * @namespace Settings object which contains customisable information for AutoFill instance - */ - this.s = { - /** - * @namespace Cached information about the little dragging icon (the filler) - */ - "filler": { - "height": 0, - "width": 0 - }, - - /** - * @namespace Cached information about the border display - */ - "border": { - "width": 2 - }, - - /** - * @namespace Store for live information for the current drag - */ - "drag": { - "startX": -1, - "startY": -1, - "startTd": null, - "endTd": null, - "dragging": false - }, - - /** - * @namespace Data cache for information that we need for scrolling the screen when we near - * the edges - */ - "screen": { - "interval": null, - "y": 0, - "height": 0, - "scrollTop": 0 - }, - - /** - * @namespace Data cache for the position of the DataTables scrolling element (when scrolling - * is enabled) - */ - "scroller": { - "top": 0, - "bottom": 0 - }, - - /** - * @namespace Information stored for each column. An array of objects - */ - "columns": [] - }; - - - /** - * @namespace Common and useful DOM elements for the class instance - */ - this.dom = { - "table": null, - "filler": null, - "borderTop": null, - "borderRight": null, - "borderBottom": null, - "borderLeft": null, - "currentTarget": null - }; - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public class methods - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Retreieve the settings object from an instance - * @method fnSettings - * @returns {object} AutoFill settings object - */ - this.fnSettings = function () { - return this.s; - }; - - - /* Constructor logic */ - this._fnInit( oDT, oConfig ); - return this; -}; - - - -AutoFill.prototype = { - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Private methods (they are of course public in JS, but recommended as private) - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Initialisation - * @method _fnInit - * @param {object} dt DataTables settings object - * @param {object} config Configuration object for AutoFill - * @returns void - */ - "_fnInit": function ( dt, config ) - { - var - that = this, - i, iLen; - - // Use DataTables API to get the settings allowing selectors, instances - // etc to be used, or for backwards compatibility get from the old - // fnSettings method - this.s.dt = DataTable.Api ? - new DataTable.Api( dt ).settings()[0] : - dt.fnSettings(); - this.s.init = config || {}; - this.dom.table = this.s.dt.nTable; - - $.extend( true, this.c, AutoFill.defaults, config ); - - /* Add and configure the columns */ - this._initColumns(); - - /* Auto Fill click and drag icon */ - var filler = $('
    ', { - 'class': 'AutoFill_filler' - } ) - .appendTo( 'body' ); - this.dom.filler = filler[0]; - - // Get the height / width of the click element - this.s.filler.height = filler.height(); - this.s.filler.width = filler.width(); - filler[0].style.display = "none"; - - /* Border display - one div for each side. We can't just use a single - * one with a border, as we want the events to effectively pass through - * the transparent bit of the box - */ - var border; - var appender = document.body; - if ( that.s.dt.oScroll.sY !== "" ) { - that.s.dt.nTable.parentNode.style.position = "relative"; - appender = that.s.dt.nTable.parentNode; - } - - border = $('
    ', { - "class": "AutoFill_border" - } ); - this.dom.borderTop = border.clone().appendTo( appender )[0]; - this.dom.borderRight = border.clone().appendTo( appender )[0]; - this.dom.borderBottom = border.clone().appendTo( appender )[0]; - this.dom.borderLeft = border.clone().appendTo( appender )[0]; - - /* Events */ - filler.on( 'mousedown.DTAF', function (e) { - this.onselectstart = function() { return false; }; - that._fnFillerDragStart.call( that, e ); - return false; - } ); - - $('tbody', this.dom.table).on( - 'mouseover.DTAF mouseout.DTAF', - '>tr>td, >tr>th', - function (e) { - that._fnFillerDisplay.call( that, e ); - } - ); - - $(this.dom.table).on( 'destroy.dt.DTAF', function () { - filler.off( 'mousedown.DTAF' ).remove(); - $('tbody', this.dom.table).off( 'mouseover.DTAF mouseout.DTAF' ); - } ); - }, - - - _initColumns: function ( ) - { - var that = this; - var i, ien; - var dt = this.s.dt; - var config = this.s.init; - - for ( i=0, ien=dt.aoColumns.length ; i offsetEnd.left) { - x1 = offsetEnd.left - border; - x2 = offsetStart.left + $(nStart).outerWidth(); - width = offsetStart.left + $(nStart).outerWidth() - offsetEnd.left + (2*border); - } - - if ( this.s.dt.oScroll.sY !== "" ) - { - /* The border elements are inside the DT scroller - so position relative to that */ - var - offsetScroll = $(this.s.dt.nTable.parentNode).offset(), - scrollTop = $(this.s.dt.nTable.parentNode).scrollTop(), - scrollLeft = $(this.s.dt.nTable.parentNode).scrollLeft(); - - x1 -= offsetScroll.left - scrollLeft; - x2 -= offsetScroll.left - scrollLeft; - y1 -= offsetScroll.top - scrollTop; - y2 -= offsetScroll.top - scrollTop; - } - - /* Top */ - oStyle = this.dom.borderTop.style; - oStyle.top = y1+"px"; - oStyle.left = x1+"px"; - oStyle.height = this.s.border.width+"px"; - oStyle.width = width+"px"; - - /* Bottom */ - oStyle = this.dom.borderBottom.style; - oStyle.top = y2+"px"; - oStyle.left = x1+"px"; - oStyle.height = this.s.border.width+"px"; - oStyle.width = width+"px"; - - /* Left */ - oStyle = this.dom.borderLeft.style; - oStyle.top = y1+"px"; - oStyle.left = x1+"px"; - oStyle.height = height+"px"; - oStyle.width = this.s.border.width+"px"; - - /* Right */ - oStyle = this.dom.borderRight.style; - oStyle.top = y1+"px"; - oStyle.left = x2+"px"; - oStyle.height = height+"px"; - oStyle.width = this.s.border.width+"px"; - }, - - - /** - * Mouse down event handler for starting a drag - * @method _fnFillerDragStart - * @param {Object} e Event object - * @returns void - */ - "_fnFillerDragStart": function (e) - { - var that = this; - var startingTd = this.dom.currentTarget; - - this.s.drag.dragging = true; - - that.dom.borderTop.style.display = "block"; - that.dom.borderRight.style.display = "block"; - that.dom.borderBottom.style.display = "block"; - that.dom.borderLeft.style.display = "block"; - - var coords = this._fnTargetCoords( startingTd ); - this.s.drag.startX = coords.x; - this.s.drag.startY = coords.y; - - this.s.drag.startTd = startingTd; - this.s.drag.endTd = startingTd; - - this._fnUpdateBorder( startingTd, startingTd ); - - $(document).bind('mousemove.AutoFill', function (e) { - that._fnFillerDragMove.call( that, e ); - } ); - - $(document).bind('mouseup.AutoFill', function (e) { - that._fnFillerFinish.call( that, e ); - } ); - - /* Scrolling information cache */ - this.s.screen.y = e.pageY; - this.s.screen.height = $(window).height(); - this.s.screen.scrollTop = $(document).scrollTop(); - - if ( this.s.dt.oScroll.sY !== "" ) - { - this.s.scroller.top = $(this.s.dt.nTable.parentNode).offset().top; - this.s.scroller.bottom = this.s.scroller.top + $(this.s.dt.nTable.parentNode).height(); - } - - /* Scrolling handler - we set an interval (which is cancelled on mouse up) which will fire - * regularly and see if we need to do any scrolling - */ - this.s.screen.interval = setInterval( function () { - var iScrollTop = $(document).scrollTop(); - var iScrollDelta = iScrollTop - that.s.screen.scrollTop; - that.s.screen.y += iScrollDelta; - - if ( that.s.screen.height - that.s.screen.y + iScrollTop < 50 ) - { - $('html, body').animate( { - "scrollTop": iScrollTop + 50 - }, 240, 'linear' ); - } - else if ( that.s.screen.y - iScrollTop < 50 ) - { - $('html, body').animate( { - "scrollTop": iScrollTop - 50 - }, 240, 'linear' ); - } - - if ( that.s.dt.oScroll.sY !== "" ) - { - if ( that.s.screen.y > that.s.scroller.bottom - 50 ) - { - $(that.s.dt.nTable.parentNode).animate( { - "scrollTop": $(that.s.dt.nTable.parentNode).scrollTop() + 50 - }, 240, 'linear' ); - } - else if ( that.s.screen.y < that.s.scroller.top + 50 ) - { - $(that.s.dt.nTable.parentNode).animate( { - "scrollTop": $(that.s.dt.nTable.parentNode).scrollTop() - 50 - }, 240, 'linear' ); - } - } - }, 250 ); - }, - - - /** - * Mouse move event handler for during a move. See if we want to update the display based on the - * new cursor position - * @method _fnFillerDragMove - * @param {Object} e Event object - * @returns void - */ - "_fnFillerDragMove": function (e) - { - if ( e.target && e.target.nodeName.toUpperCase() == "TD" && - e.target != this.s.drag.endTd ) - { - var coords = this._fnTargetCoords( e.target ); - - if ( this.c.mode == "y" && coords.x != this.s.drag.startX ) - { - e.target = $('tbody>tr:eq('+coords.y+')>td:eq('+this.s.drag.startX+')', this.dom.table)[0]; - } - if ( this.c.mode == "x" && coords.y != this.s.drag.startY ) - { - e.target = $('tbody>tr:eq('+this.s.drag.startY+')>td:eq('+coords.x+')', this.dom.table)[0]; - } - - if ( this.c.mode == "either") - { - if(coords.x != this.s.drag.startX ) - { - e.target = $('tbody>tr:eq('+this.s.drag.startY+')>td:eq('+coords.x+')', this.dom.table)[0]; - } - else if ( coords.y != this.s.drag.startY ) { - e.target = $('tbody>tr:eq('+coords.y+')>td:eq('+this.s.drag.startX+')', this.dom.table)[0]; - } - } - - // update coords - if ( this.c.mode !== "both" ) { - coords = this._fnTargetCoords( e.target ); - } - - var drag = this.s.drag; - drag.endTd = e.target; - - if ( coords.y >= this.s.drag.startY ) { - this._fnUpdateBorder( drag.startTd, drag.endTd ); - } - else { - this._fnUpdateBorder( drag.endTd, drag.startTd ); - } - this._fnFillerPosition( e.target ); - } - - /* Update the screen information so we can perform scrolling */ - this.s.screen.y = e.pageY; - this.s.screen.scrollTop = $(document).scrollTop(); - - if ( this.s.dt.oScroll.sY !== "" ) - { - this.s.scroller.scrollTop = $(this.s.dt.nTable.parentNode).scrollTop(); - this.s.scroller.top = $(this.s.dt.nTable.parentNode).offset().top; - this.s.scroller.bottom = this.s.scroller.top + $(this.s.dt.nTable.parentNode).height(); - } - }, - - - /** - * Mouse release handler - end the drag and take action to update the cells with the needed values - * @method _fnFillerFinish - * @param {Object} e Event object - * @returns void - */ - "_fnFillerFinish": function (e) - { - var that = this, i, iLen, j; - - $(document).unbind('mousemove.AutoFill mouseup.AutoFill'); - - this.dom.borderTop.style.display = "none"; - this.dom.borderRight.style.display = "none"; - this.dom.borderBottom.style.display = "none"; - this.dom.borderLeft.style.display = "none"; - - this.s.drag.dragging = false; - - clearInterval( this.s.screen.interval ); - - var cells = []; - var table = this.dom.table; - var coordsStart = this._fnTargetCoords( this.s.drag.startTd ); - var coordsEnd = this._fnTargetCoords( this.s.drag.endTd ); - var columnIndex = function ( visIdx ) { - return that.s.dt.oApi._fnVisibleToColumnIndex( that.s.dt, visIdx ); - }; - - // xxx - urgh - there must be a way of reducing this... - if ( coordsStart.y <= coordsEnd.y ) { - for ( i=coordsStart.y ; i<=coordsEnd.y ; i++ ) { - if ( coordsStart.x <= coordsEnd.x ) { - for ( j=coordsStart.x ; j<=coordsEnd.x ; j++ ) { - cells.push( { - node: $('tbody>tr:eq('+i+')>td:eq('+j+')', table)[0], - x: j - coordsStart.x, - y: i - coordsStart.y, - colIdx: columnIndex( j ) - } ); - } - } - else { - for ( j=coordsStart.x ; j>=coordsEnd.x ; j-- ) { - cells.push( { - node: $('tbody>tr:eq('+i+')>td:eq('+j+')', table)[0], - x: j - coordsStart.x, - y: i - coordsStart.y, - colIdx: columnIndex( j ) - } ); - } - } - } - } - else { - for ( i=coordsStart.y ; i>=coordsEnd.y ; i-- ) { - if ( coordsStart.x <= coordsEnd.x ) { - for ( j=coordsStart.x ; j<=coordsEnd.x ; j++ ) { - cells.push( { - node: $('tbody>tr:eq('+i+')>td:eq('+j+')', table)[0], - x: j - coordsStart.x, - y: i - coordsStart.y, - colIdx: columnIndex( j ) - } ); - } - } - else { - for ( j=coordsStart.x ; j>=coordsEnd.x ; j-- ) { - cells.push( { - node: $('tbody>tr:eq('+i+')>td:eq('+j+')', table)[0], - x: coordsStart.x - j, - y: coordsStart.y - i, - colIdx: columnIndex( j ) - } ); - } - } - } - } - - // An auto-fill requires 2 or more cells - if ( cells.length <= 1 ) { - return; - } - - var edited = []; - var previous; - - for ( i=0, iLen=cells.length ; i",{"class":"AutoFill_filler"}).appendTo("body");this.dom.filler=e[0];this.s.filler.height=e.height();this.s.filler.width=e.width();e[0].style.display= -"none";var g,f=j.body;""!==a.s.dt.oScroll.sY&&(a.s.dt.nTable.parentNode.style.position="relative",f=a.s.dt.nTable.parentNode);g=c("
    ",{"class":"AutoFill_border"});this.dom.borderTop=g.clone().appendTo(f)[0];this.dom.borderRight=g.clone().appendTo(f)[0];this.dom.borderBottom=g.clone().appendTo(f)[0];this.dom.borderLeft=g.clone().appendTo(f)[0];e.on("mousedown.DTAF",function(b){this.onselectstart=function(){return false};a._fnFillerDragStart.call(a,b);return false});c("tbody",this.dom.table).on("mouseover.DTAF mouseout.DTAF", -">tr>td, >tr>th",function(b){a._fnFillerDisplay.call(a,b)});c(this.dom.table).on("destroy.dt.DTAF",function(){e.off("mousedown.DTAF").remove();c("tbody",this.dom.table).off("mouseover.DTAF mouseout.DTAF")})},_initColumns:function(){var d=this,b,a,e=this.s.dt,g=this.s.init;b=0;for(a=e.aoColumns.length;bg.left&&(f=g.left-a,i=e.left+c(d).outerWidth(),j=e.left+c(d).outerWidth()-g.left+2*a);""!==this.s.dt.oScroll.sY&&(a=c(this.s.dt.nTable.parentNode).offset(),e=c(this.s.dt.nTable.parentNode).scrollTop(), -g=c(this.s.dt.nTable.parentNode).scrollLeft(),f-=a.left-g,i-=a.left-g,n-=a.top-e,h-=a.top-e);a=this.dom.borderTop.style;a.top=n+"px";a.left=f+"px";a.height=this.s.border.width+"px";a.width=j+"px";a=this.dom.borderBottom.style;a.top=h+"px";a.left=f+"px";a.height=this.s.border.width+"px";a.width=j+"px";a=this.dom.borderLeft.style;a.top=n+"px";a.left=f+"px";a.height=k+"px";a.width=this.s.border.width+"px";a=this.dom.borderRight.style;a.top=n+"px";a.left=i+"px";a.height=k+"px";a.width=this.s.border.width+ -"px"},_fnFillerDragStart:function(d){var b=this,a=this.dom.currentTarget;this.s.drag.dragging=!0;b.dom.borderTop.style.display="block";b.dom.borderRight.style.display="block";b.dom.borderBottom.style.display="block";b.dom.borderLeft.style.display="block";var e=this._fnTargetCoords(a);this.s.drag.startX=e.x;this.s.drag.startY=e.y;this.s.drag.startTd=a;this.s.drag.endTd=a;this._fnUpdateBorder(a,a);c(j).bind("mousemove.AutoFill",function(a){b._fnFillerDragMove.call(b,a)});c(j).bind("mouseup.AutoFill", -function(a){b._fnFillerFinish.call(b,a)});this.s.screen.y=d.pageY;this.s.screen.height=c(o).height();this.s.screen.scrollTop=c(j).scrollTop();""!==this.s.dt.oScroll.sY&&(this.s.scroller.top=c(this.s.dt.nTable.parentNode).offset().top,this.s.scroller.bottom=this.s.scroller.top+c(this.s.dt.nTable.parentNode).height());this.s.screen.interval=setInterval(function(){var a=c(j).scrollTop();b.s.screen.y=b.s.screen.y+(a-b.s.screen.scrollTop);b.s.screen.height-b.s.screen.y+a<50?c("html, body").animate({scrollTop:a+ -50},240,"linear"):b.s.screen.y-a<50&&c("html, body").animate({scrollTop:a-50},240,"linear");b.s.dt.oScroll.sY!==""&&(b.s.screen.y>b.s.scroller.bottom-50?c(b.s.dt.nTable.parentNode).animate({scrollTop:c(b.s.dt.nTable.parentNode).scrollTop()+50},240,"linear"):b.s.screen.ytr:eq("+b.y+")>td:eq("+this.s.drag.startX+")",this.dom.table)[0]);"x"==this.c.mode&&b.y!=this.s.drag.startY&&(d.target=c("tbody>tr:eq("+this.s.drag.startY+")>td:eq("+b.x+")",this.dom.table)[0]);"either"==this.c.mode&&(b.x!=this.s.drag.startX?d.target=c("tbody>tr:eq("+this.s.drag.startY+")>td:eq("+b.x+")",this.dom.table)[0]:b.y!=this.s.drag.startY&&(d.target=c("tbody>tr:eq("+b.y+")>td:eq("+this.s.drag.startX+ -")",this.dom.table)[0]));"both"!==this.c.mode&&(b=this._fnTargetCoords(d.target));var a=this.s.drag;a.endTd=d.target;b.y>=this.s.drag.startY?this._fnUpdateBorder(a.startTd,a.endTd):this._fnUpdateBorder(a.endTd,a.startTd);this._fnFillerPosition(d.target)}this.s.screen.y=d.pageY;this.s.screen.scrollTop=c(j).scrollTop();""!==this.s.dt.oScroll.sY&&(this.s.scroller.scrollTop=c(this.s.dt.nTable.parentNode).scrollTop(),this.s.scroller.top=c(this.s.dt.nTable.parentNode).offset().top,this.s.scroller.bottom= -this.s.scroller.top+c(this.s.dt.nTable.parentNode).height())},_fnFillerFinish:function(){var d=this,b,a;c(j).unbind("mousemove.AutoFill mouseup.AutoFill");this.dom.borderTop.style.display="none";this.dom.borderRight.style.display="none";this.dom.borderBottom.style.display="none";this.dom.borderLeft.style.display="none";this.s.drag.dragging=!1;clearInterval(this.s.screen.interval);var e=[],g=this.dom.table,f=this._fnTargetCoords(this.s.drag.startTd),i=this._fnTargetCoords(this.s.drag.endTd),h=function(a){return d.s.dt.oApi._fnVisibleToColumnIndex(d.s.dt, -a)};if(f.y<=i.y)for(b=f.y;b<=i.y;b++)if(f.x<=i.x)for(a=f.x;a<=i.x;a++)e.push({node:c("tbody>tr:eq("+b+")>td:eq("+a+")",g)[0],x:a-f.x,y:b-f.y,colIdx:h(a)});else for(a=f.x;a>=i.x;a--)e.push({node:c("tbody>tr:eq("+b+")>td:eq("+a+")",g)[0],x:a-f.x,y:b-f.y,colIdx:h(a)});else for(b=f.y;b>=i.y;b--)if(f.x<=i.x)for(a=f.x;a<=i.x;a++)e.push({node:c("tbody>tr:eq("+b+")>td:eq("+a+")",g)[0],x:a-f.x,y:b-f.y,colIdx:h(a)});else for(a=f.x;a>=i.x;a--)e.push({node:c("tbody>tr:eq("+b+")>td:eq("+a+")",g)[0],x:f.x-a,y:f.y- -b,colIdx:h(a)});if(!(1>=e.length)){var g=[],m;b=0;for(a=e.length;bg||0>f?-1:1)):a===m?b:a}}};return h};"function"===typeof define&&define.amd? -define(["jquery","datatables"],l):"object"===typeof exports?l(require("jquery"),require("datatables")):jQuery&&!jQuery.fn.dataTable.AutoFill&&l(jQuery,jQuery.fn.dataTable)})(window,document); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/css/dataTables.bootstrap.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/css/dataTables.bootstrap.css deleted file mode 100644 index 2ccacaff890..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/css/dataTables.bootstrap.css +++ /dev/null @@ -1,372 +0,0 @@ -div.dataTables_length label { - font-weight: normal; - text-align: left; - white-space: nowrap; -} - -div.dataTables_length select { - width: 75px; - display: inline-block; -} - -div.dataTables_filter { - text-align: right; -} - -div.dataTables_filter label { - font-weight: normal; - white-space: nowrap; - text-align: left; -} - -div.dataTables_filter input { - margin-left: 0.5em; - display: inline-block; - width: auto; -} - -div.dataTables_info { - padding-top: 8px; - white-space: nowrap; -} - -div.dataTables_paginate { - margin: 0; - white-space: nowrap; - text-align: right; -} - -div.dataTables_paginate ul.pagination { - margin: 2px 0; - white-space: nowrap; -} - -@media screen and (max-width: 767px) { - div.dataTables_wrapper > div.row > div, - div.dataTables_length, - div.dataTables_filter, - div.dataTables_info, - div.dataTables_paginate { - text-align: center; - } - - div.DTTT { - margin-bottom: 0.5em; - } -} - - -table.dataTable td, -table.dataTable th { - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; -} - - -table.dataTable { - clear: both; - margin-top: 6px !important; - margin-bottom: 6px !important; - max-width: none !important; -} - -table.dataTable thead .sorting, -table.dataTable thead .sorting_asc, -table.dataTable thead .sorting_desc, -table.dataTable thead .sorting_asc_disabled, -table.dataTable thead .sorting_desc_disabled { - cursor: pointer; - position: relative; -} - -table.dataTable thead .sorting:after, -table.dataTable thead .sorting_asc:after, -table.dataTable thead .sorting_desc:after { - position: absolute; - top: 8px; - right: 8px; - display: block; - font-family: 'Glyphicons Halflings'; - opacity: 0.5; -} -table.dataTable thead .sorting:after { - opacity: 0.2; - content: "\e150"; /* sort */ -} -table.dataTable thead .sorting_asc:after { - content: "\e155"; /* sort-by-attributes */ -} -table.dataTable thead .sorting_desc:after { - content: "\e156"; /* sort-by-attributes-alt */ -} -div.dataTables_scrollBody table.dataTable thead .sorting:after, -div.dataTables_scrollBody table.dataTable thead .sorting_asc:after, -div.dataTables_scrollBody table.dataTable thead .sorting_desc:after { - display: none; -} - -table.dataTable thead .sorting_asc_disabled:after, -table.dataTable thead .sorting_desc_disabled:after { - color: #eee; -} - -table.dataTable thead > tr > th { - padding-right: 30px; -} - -table.dataTable th:active { - outline: none; -} - - -/* Condensed */ -table.dataTable.table-condensed thead > tr > th { - padding-right: 20px; -} - -table.dataTable.table-condensed thead .sorting:after, -table.dataTable.table-condensed thead .sorting_asc:after, -table.dataTable.table-condensed thead .sorting_desc:after { - top: 6px; - right: 6px; -} - -/* Scrolling */ -div.dataTables_scrollHead table { - margin-bottom: 0 !important; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; -} - -div.dataTables_scrollHead table thead tr:last-child th:first-child, -div.dataTables_scrollHead table thead tr:last-child td:first-child { - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.dataTables_scrollBody table { - border-top: none; - margin-top: 0 !important; - margin-bottom: 0 !important; -} - -div.dataTables_scrollBody tbody tr:first-child th, -div.dataTables_scrollBody tbody tr:first-child td { - border-top: none; -} - -div.dataTables_scrollFoot table { - margin-top: 0 !important; - border-top: none; -} - -/* Frustratingly the border-collapse:collapse used by Bootstrap makes the column - width calculations when using scrolling impossible to align columns. We have - to use separate - */ -table.table-bordered.dataTable { - border-collapse: separate !important; -} -table.table-bordered thead th, -table.table-bordered thead td { - border-left-width: 0; - border-top-width: 0; -} -table.table-bordered tbody th, -table.table-bordered tbody td { - border-left-width: 0; - border-bottom-width: 0; -} -table.table-bordered tfoot th, -table.table-bordered tfoot td { - border-left-width: 0; - border-bottom-width: 0; -} -table.table-bordered th:last-child, -table.table-bordered td:last-child { - border-right-width: 0; -} -div.dataTables_scrollHead table.table-bordered { - border-bottom-width: 0; -} - - - - -/* - * TableTools styles - */ -.table.dataTable tbody tr.active td, -.table.dataTable tbody tr.active th { - background-color: #08C; - color: white; -} - -.table.dataTable tbody tr.active:hover td, -.table.dataTable tbody tr.active:hover th { - background-color: #0075b0 !important; -} - -.table.dataTable tbody tr.active th > a, -.table.dataTable tbody tr.active td > a { - color: white; -} - -.table-striped.dataTable tbody tr.active:nth-child(odd) td, -.table-striped.dataTable tbody tr.active:nth-child(odd) th { - background-color: #017ebc; -} - -table.DTTT_selectable tbody tr { - cursor: pointer; -} - -div.DTTT .btn:hover { - text-decoration: none !important; -} - -ul.DTTT_dropdown.dropdown-menu { - z-index: 2003; -} - -ul.DTTT_dropdown.dropdown-menu a { - color: #333 !important; /* needed only when demo_page.css is included */ -} - -ul.DTTT_dropdown.dropdown-menu li { - position: relative; -} - -ul.DTTT_dropdown.dropdown-menu li:hover a { - background-color: #0088cc; - color: white !important; -} - -div.DTTT_collection_background { - z-index: 2002; -} - -/* TableTools information display */ -div.DTTT_print_info { - position: fixed; - top: 50%; - left: 50%; - width: 400px; - height: 150px; - margin-left: -200px; - margin-top: -75px; - text-align: center; - color: #333; - padding: 10px 30px; - opacity: 0.95; - - background-color: white; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 6px; - - -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); -} - -div.DTTT_print_info h6 { - font-weight: normal; - font-size: 28px; - line-height: 28px; - margin: 1em; -} - -div.DTTT_print_info p { - font-size: 14px; - line-height: 20px; -} - -div.dataTables_processing { - position: absolute; - top: 50%; - left: 50%; - width: 100%; - height: 60px; - margin-left: -50%; - margin-top: -25px; - padding-top: 20px; - padding-bottom: 20px; - text-align: center; - font-size: 1.2em; - background-color: white; - background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(25%, rgba(255,255,255,0.9)), color-stop(75%, rgba(255,255,255,0.9)), color-stop(100%, rgba(255,255,255,0))); - background: -webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); - background: -moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); - background: -ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); - background: -o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); - background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); -} - - - -/* - * FixedColumns styles - */ -div.DTFC_LeftHeadWrapper table, -div.DTFC_LeftFootWrapper table, -div.DTFC_RightHeadWrapper table, -div.DTFC_RightFootWrapper table, -table.DTFC_Cloned tr.even { - background-color: white; - margin-bottom: 0; -} - -div.DTFC_RightHeadWrapper table , -div.DTFC_LeftHeadWrapper table { - border-bottom: none !important; - margin-bottom: 0 !important; - border-top-right-radius: 0 !important; - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.DTFC_RightHeadWrapper table thead tr:last-child th:first-child, -div.DTFC_RightHeadWrapper table thead tr:last-child td:first-child, -div.DTFC_LeftHeadWrapper table thead tr:last-child th:first-child, -div.DTFC_LeftHeadWrapper table thead tr:last-child td:first-child { - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.DTFC_RightBodyWrapper table, -div.DTFC_LeftBodyWrapper table { - border-top: none; - margin: 0 !important; -} - -div.DTFC_RightBodyWrapper tbody tr:first-child th, -div.DTFC_RightBodyWrapper tbody tr:first-child td, -div.DTFC_LeftBodyWrapper tbody tr:first-child th, -div.DTFC_LeftBodyWrapper tbody tr:first-child td { - border-top: none; -} - -div.DTFC_RightFootWrapper table, -div.DTFC_LeftFootWrapper table { - border-top: none; - margin-top: 0 !important; -} - - -div.DTFC_LeftBodyWrapper table.dataTable thead .sorting:after, -div.DTFC_LeftBodyWrapper table.dataTable thead .sorting_asc:after, -div.DTFC_LeftBodyWrapper table.dataTable thead .sorting_desc:after, -div.DTFC_RightBodyWrapper table.dataTable thead .sorting:after, -div.DTFC_RightBodyWrapper table.dataTable thead .sorting_asc:after, -div.DTFC_RightBodyWrapper table.dataTable thead .sorting_desc:after { - display: none; -} - - -/* - * FixedHeader styles - */ -div.FixedHeader_Cloned table { - margin: 0 !important -} - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/js/dataTables.bootstrap.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/js/dataTables.bootstrap.js deleted file mode 100644 index dcc561fcfd9..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/js/dataTables.bootstrap.js +++ /dev/null @@ -1,206 +0,0 @@ -/*! DataTables Bootstrap 3 integration - * ©2011-2014 SpryMedia Ltd - datatables.net/license - */ - -/** - * DataTables integration for Bootstrap 3. This requires Bootstrap 3 and - * DataTables 1.10 or newer. - * - * This file sets the defaults and adds options to DataTables to style its - * controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap - * for further information. - */ -(function(window, document, undefined){ - -var factory = function( $, DataTable ) { -"use strict"; - - -/* Set the defaults for DataTables initialisation */ -$.extend( true, DataTable.defaults, { - dom: - "<'row'<'col-sm-6'l><'col-sm-6'f>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", - renderer: 'bootstrap' -} ); - - -/* Default class modification */ -$.extend( DataTable.ext.classes, { - sWrapper: "dataTables_wrapper form-inline dt-bootstrap", - sFilterInput: "form-control input-sm", - sLengthSelect: "form-control input-sm" -} ); - - -/* Bootstrap paging button renderer */ -DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) { - var api = new DataTable.Api( settings ); - var classes = settings.oClasses; - var lang = settings.oLanguage.oPaginate; - var btnDisplay, btnClass, counter=0; - - var attach = function( container, buttons ) { - var i, ien, node, button; - var clickHandler = function ( e ) { - e.preventDefault(); - if ( !$(e.currentTarget).hasClass('disabled') ) { - api.page( e.data.action ).draw( false ); - } - }; - - for ( i=0, ien=buttons.length ; i 0 ? - '' : ' disabled'); - break; - - case 'previous': - btnDisplay = lang.sPrevious; - btnClass = button + (page > 0 ? - '' : ' disabled'); - break; - - case 'next': - btnDisplay = lang.sNext; - btnClass = button + (page < pages-1 ? - '' : ' disabled'); - break; - - case 'last': - btnDisplay = lang.sLast; - btnClass = button + (page < pages-1 ? - '' : ' disabled'); - break; - - default: - btnDisplay = button + 1; - btnClass = page === button ? - 'active' : ''; - break; - } - - if ( btnDisplay ) { - node = $('
  • ', { - 'class': classes.sPageButton+' '+btnClass, - 'id': idx === 0 && typeof button === 'string' ? - settings.sTableId +'_'+ button : - null - } ) - .append( $('', { - 'href': '#', - 'aria-controls': settings.sTableId, - 'data-dt-idx': counter, - 'tabindex': settings.iTabIndex - } ) - .html( btnDisplay ) - ) - .appendTo( container ); - - settings.oApi._fnBindAction( - node, {action: button}, clickHandler - ); - - counter++; - } - } - } - }; - - // IE9 throws an 'unknown error' if document.activeElement is used - // inside an iframe or frame. - var activeEl; - - try { - // Because this approach is destroying and recreating the paging - // elements, focus is lost on the select button which is bad for - // accessibility. So we want to restore focus once the draw has - // completed - activeEl = $(document.activeElement).data('dt-idx'); - } - catch (e) {} - - attach( - $(host).empty().html('
      ').children('ul'), - buttons - ); - - if ( activeEl ) { - $(host).find( '[data-dt-idx='+activeEl+']' ).focus(); - } -}; - - -/* - * TableTools Bootstrap compatibility - * Required TableTools 2.1+ - */ -if ( DataTable.TableTools ) { - // Set the classes that TableTools uses to something suitable for Bootstrap - $.extend( true, DataTable.TableTools.classes, { - "container": "DTTT btn-group", - "buttons": { - "normal": "btn btn-default", - "disabled": "disabled" - }, - "collection": { - "container": "DTTT_dropdown dropdown-menu", - "buttons": { - "normal": "", - "disabled": "disabled" - } - }, - "print": { - "info": "DTTT_print_info" - }, - "select": { - "row": "active" - } - } ); - - // Have the collection use a bootstrap compatible drop down - $.extend( true, DataTable.TableTools.DEFAULTS.oTags, { - "collection": { - "container": "ul", - "button": "li", - "liner": "a" - } - } ); -} - -}; // /factory - - -// Define as an AMD module if possible -if ( typeof define === 'function' && define.amd ) { - define( ['jquery', 'datatables'], factory ); -} -else if ( typeof exports === 'object' ) { - // Node/CommonJS - factory( require('jquery'), require('datatables') ); -} -else if ( jQuery ) { - // Otherwise simply initialise as normal, stopping multiple evaluation - factory( jQuery, jQuery.fn.dataTable ); -} - - -})(window, document); - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.css deleted file mode 100644 index bdd6aa0b9ad..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.css +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Namespace DTCR - "DataTables ColReorder" plug-in - */ - -table.DTCR_clonedTable { - background-color: rgba(255, 255, 255, 0.7); - z-index: 202; -} - -div.DTCR_pointer { - width: 1px; - background-color: #0259C4; - z-index: 201; -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.min.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.min.css deleted file mode 100644 index 77b230e0136..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.min.css +++ /dev/null @@ -1 +0,0 @@ -table.DTCR_clonedTable{background-color:rgba(255,255,255,0.7);z-index:202}div.DTCR_pointer{width:1px;background-color:#0259C4;z-index:201} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/images/insert.png b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/images/insert.png deleted file mode 100644 index 15d5522da64..00000000000 Binary files a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/images/insert.png and /dev/null differ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/js/dataTables.colReorder.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/js/dataTables.colReorder.js deleted file mode 100644 index c3b2f1e2adc..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/js/dataTables.colReorder.js +++ /dev/null @@ -1,1372 +0,0 @@ -/*! ColReorder 1.1.3 - * ©2010-2014 SpryMedia Ltd - datatables.net/license - */ - -/** - * @summary ColReorder - * @description Provide the ability to reorder columns in a DataTable - * @version 1.1.3 - * @file dataTables.colReorder.js - * @author SpryMedia Ltd (www.sprymedia.co.uk) - * @contact www.sprymedia.co.uk/contact - * @copyright Copyright 2010-2014 SpryMedia Ltd. - * - * This source file is free software, available under the following license: - * MIT license - http://datatables.net/license/mit - * - * This source file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. - * - * For details please refer to: http://www.datatables.net - */ - -(function(window, document, undefined) { - - -/** - * Switch the key value pairing of an index array to be value key (i.e. the old value is now the - * key). For example consider [ 2, 0, 1 ] this would be returned as [ 1, 2, 0 ]. - * @method fnInvertKeyValues - * @param array aIn Array to switch around - * @returns array - */ -function fnInvertKeyValues( aIn ) -{ - var aRet=[]; - for ( var i=0, iLen=aIn.length ; i= iCols ) - { - this.oApi._fnLog( oSettings, 1, "ColReorder 'from' index is out of bounds: "+iFrom ); - return; - } - - if ( iTo < 0 || iTo >= iCols ) - { - this.oApi._fnLog( oSettings, 1, "ColReorder 'to' index is out of bounds: "+iTo ); - return; - } - - /* - * Calculate the new column array index, so we have a mapping between the old and new - */ - var aiMapping = []; - for ( i=0, iLen=iCols ; i this.s.fixed-1 && i < iLen - this.s.fixedRight ) - { - this._fnMouseListener( i, this.s.dt.aoColumns[i].nTh ); - } - - /* Mark the original column order for later reference */ - this.s.dt.aoColumns[i]._ColReorder_iOrigCol = i; - } - - /* State saving */ - this.s.dt.oApi._fnCallbackReg( this.s.dt, 'aoStateSaveParams', function (oS, oData) { - that._fnStateSave.call( that, oData ); - }, "ColReorder_State" ); - - /* An initial column order has been specified */ - var aiOrder = null; - if ( this.s.init.aiOrder ) - { - aiOrder = this.s.init.aiOrder.slice(); - } - - /* State loading, overrides the column order given */ - if ( this.s.dt.oLoadedState && typeof this.s.dt.oLoadedState.ColReorder != 'undefined' && - this.s.dt.oLoadedState.ColReorder.length == this.s.dt.aoColumns.length ) - { - aiOrder = this.s.dt.oLoadedState.ColReorder; - } - - /* If we have an order to apply - do so */ - if ( aiOrder ) - { - /* We might be called during or after the DataTables initialisation. If before, then we need - * to wait until the draw is done, if after, then do what we need to do right away - */ - if ( !that.s.dt._bInitComplete ) - { - var bDone = false; - this.s.dt.aoDrawCallback.push( { - "fn": function () { - if ( !that.s.dt._bInitComplete && !bDone ) - { - bDone = true; - var resort = fnInvertKeyValues( aiOrder ); - that._fnOrderColumns.call( that, resort ); - } - }, - "sName": "ColReorder_Pre" - } ); - } - else - { - var resort = fnInvertKeyValues( aiOrder ); - that._fnOrderColumns.call( that, resort ); - } - } - else { - this._fnSetColumnIndexes(); - } - }, - - - /** - * Set the column order from an array - * @method _fnOrderColumns - * @param array a An array of integers which dictate the column order that should be applied - * @returns void - * @private - */ - "_fnOrderColumns": function ( a ) - { - if ( a.length != this.s.dt.aoColumns.length ) - { - this.s.dt.oInstance.oApi._fnLog( this.s.dt, 1, "ColReorder - array reorder does not "+ - "match known number of columns. Skipping." ); - return; - } - - for ( var i=0, iLen=a.length ; i
  • ') - .addClass( 'DTCR_pointer' ) - .css( { - position: 'absolute', - top: scrolling ? - $('div.dataTables_scroll', this.s.dt.nTableWrapper).offset().top : - $(this.s.dt.nTable).offset().top, - height : scrolling ? - $('div.dataTables_scroll', this.s.dt.nTableWrapper).height() : - $(this.s.dt.nTable).height() - } ) - .appendTo( 'body' ); - }, - - /** - * Clean up ColReorder memory references and event handlers - * @method _fnDestroy - * @returns void - * @private - */ - "_fnDestroy": function () - { - var i, iLen; - - for ( i=0, iLen=this.s.dt.aoDrawCallback.length ; ib||b>=n)this.oApi._fnLog(a,1,"ColReorder 'from' index is out of bounds: "+b);else if(0>e||e>=n)this.oApi._fnLog(a,1,"ColReorder 'to' index is out of bounds: "+e);else{f=[];c=0;for(g=n;cthis.s.fixed-1&&eMath.pow(Math.pow(a.pageX-this.s.mouse.startX,2)+Math.pow(a.pageY-this.s.mouse.startY,2),0.5))return;this._fnCreateDragNode()}this.dom.drag.css({left:a.pageX-this.s.mouse.offsetX,top:a.pageY-this.s.mouse.offsetY});for(var b=!1,e=this.s.mouse.toIndex,d=1,c=this.s.aoTargets.length;d
    ").addClass("DTCR_pointer").css({position:"absolute",top:a?d("div.dataTables_scroll",this.s.dt.nTableWrapper).offset().top:d(this.s.dt.nTable).offset().top,height:a?d("div.dataTables_scroll",this.s.dt.nTableWrapper).height(): -d(this.s.dt.nTable).height()}).appendTo("body")},_fnDestroy:function(){var a,b;a=0;for(b=this.s.dt.aoDrawCallback.length;a
    ')[0], -g=c.childNodes[0],f=c.childNodes[1];this.dom.grid.dt.parentNode.insertBefore(c,this.dom.grid.dt);c.appendChild(this.dom.grid.dt);this.dom.grid.wrapper=c;0b.clientWidth&&(c.x=!0);a.offsetHeight>b.clientHeight&&(c.y=!0);return c},_fnDraw:function(a){this._fnGridLayout();this._fnCloneLeft(a);this._fnCloneRight(a);null!==this.s.fnDrawCallback&&this.s.fnDrawCallback.call(this,this.dom.clone.left,this.dom.clone.right);d(this).trigger("draw.dtfc",{leftClone:this.dom.clone.left,rightClone:this.dom.clone.right})},_fnCloneRight:function(a){if(!(0>= -this.s.iRightColumns)){var b,c=[];for(b=this.s.iTableColumns-this.s.iRightColumns;b=this.s.iLeftColumns)){var b,c=[];for(b=0;bthead",a.header);k.empty();e=0;for(h=n.length;ethead",a.header)[0]);e=0;for(h=n.length;etbody>tr",f.dom.body).css("height","auto");null!==a.body&&(a.body.parentNode.removeChild(a.body),a.body=null);a.body=d(this.dom.body).clone(!0)[0];a.body.className+=" DTFC_Cloned";a.body.style.paddingBottom=l.oScroll.iBarWidth+"px";a.body.style.marginBottom=2*l.oScroll.iBarWidth+"px";null!==a.body.getAttribute("id")&&a.body.removeAttribute("id");d(">thead>tr",a.body).empty();d(">tfoot", -a.body).remove();var p=d("tbody",a.body)[0];d(p).empty();if(0thead>tr",a.body)[0];for(o=0;otbody>tr",f.dom.body).each(function(a){var b=this.cloneNode(false);b.removeAttribute("id");a=f.s.dt.aoData[f.s.dt.oFeatures.bServerSide===false?f.s.dt.aiDisplay[f.s.dt._iDisplayStart+ -a]:a].anCells||d(this).children("td, th");for(o=0;o0){m=d(a[j]).clone(true,true)[0];b.appendChild(m)}}p.appendChild(b)})}else d(">tbody>tr",f.dom.body).each(function(){m=this.cloneNode(true);m.className=m.className+" DTFC_NoData";d("td",m).html("");p.appendChild(m)});a.body.style.width="100%";a.body.style.margin="0";a.body.style.padding="0";l.oScroller!==t&&(h=l.oScroller.dom.force,b.forcer?b.forcer.style.height=h.style.height:(b.forcer=h.cloneNode(!0),b.liner.appendChild(b.forcer))); -b.liner.appendChild(a.body);this._fnEqualiseHeights("tbody",f.dom.body,a.body);if(null!==l.nTFoot){if(g){null!==a.footer&&a.footer.parentNode.removeChild(a.footer);a.footer=d(this.dom.footer).clone(!0,!0)[0];a.footer.className+=" DTFC_Cloned";a.footer.style.width="100%";b.foot.appendChild(a.footer);n=this._fnCopyLayout(l.aoFooter,c);b=d(">tfoot",a.footer);b.empty();e=0;for(h=n.length;etfoot",a.footer)[0]);e=0;for(h=n.length;ethead",a.header)[0]);d(b).each(function(a){j=c[a];this.style.width=f.s.aiInnerWidths[j]+"px"});null!==f.s.dt.nTFoot&&(b=l.oApi._fnGetUniqueThs(l,d(">tfoot",a.footer)[0]),d(b).each(function(a){j=c[a];this.style.width=f.s.aiInnerWidths[j]+"px"}))},_fnGetTrNodes:function(a){for(var b= -[],c=0,d=a.childNodes.length;c"+a+">tr:eq(0)",b).children(":first");a.outerHeight();a.height();for(var e=this._fnGetTrNodes(e),b=this._fnGetTrNodes(c),h=[],c=0,a=b.length;cg?f:g,"semiauto"==this.s.sHeightMatch&& -(e[c]._DTTC_iHeight=g),h.push(g);c=0;for(a=b.length;ctfoot', s.nTable).length > 0) ? true : false; - - /* Add the 'sides' that are fixed */ - if ( s.oSides.top ) - { - s.aoCache.push( that._fnCloneTable( "fixedHeader", "FixedHeader_Header", that._fnCloneThead ) ); - } - if ( s.oSides.bottom ) - { - s.aoCache.push( that._fnCloneTable( "fixedFooter", "FixedHeader_Footer", that._fnCloneTfoot ) ); - } - if ( s.oSides.left ) - { - s.aoCache.push( that._fnCloneTable( "fixedLeft", "FixedHeader_Left", that._fnCloneTLeft, s.oSides.left ) ); - } - if ( s.oSides.right ) - { - s.aoCache.push( that._fnCloneTable( "fixedRight", "FixedHeader_Right", that._fnCloneTRight, s.oSides.right ) ); - } - - /* Event listeners for window movement */ - FixedHeader.afnScroll.push( function () { - that._fnUpdatePositions.call(that); - } ); - - $(window).resize( function () { - FixedHeader.fnMeasure(); - that._fnUpdateClones.call(that); - that._fnUpdatePositions.call(that); - } ); - - $(s.nTable) - .on('column-reorder.dt', function () { - FixedHeader.fnMeasure(); - that._fnUpdateClones( true ); - that._fnUpdatePositions(); - } ) - .on('column-visibility.dt', function () { - FixedHeader.fnMeasure(); - that._fnUpdateClones( true ); - that._fnUpdatePositions(); - } ); - - /* Get things right to start with */ - FixedHeader.fnMeasure(); - that._fnUpdateClones(); - that._fnUpdatePositions(); - - s.bInitComplete = true; - }, - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Support functions - */ - - /* - * Function: fnInitSettings - * Purpose: Take the user's settings and copy them to our local store - * Returns: - - * Inputs: object:s - the local settings object - * object:oInit - the user's settings object - */ - fnInitSettings: function ( s, oInit ) - { - if ( oInit !== undefined ) - { - if ( oInit.top !== undefined ) { - s.oSides.top = oInit.top; - } - if ( oInit.bottom !== undefined ) { - s.oSides.bottom = oInit.bottom; - } - if ( typeof oInit.left == 'boolean' ) { - s.oSides.left = oInit.left ? 1 : 0; - } - else if ( oInit.left !== undefined ) { - s.oSides.left = oInit.left; - } - if ( typeof oInit.right == 'boolean' ) { - s.oSides.right = oInit.right ? 1 : 0; - } - else if ( oInit.right !== undefined ) { - s.oSides.right = oInit.right; - } - - if ( oInit.zTop !== undefined ) { - s.oZIndexes.top = oInit.zTop; - } - if ( oInit.zBottom !== undefined ) { - s.oZIndexes.bottom = oInit.zBottom; - } - if ( oInit.zLeft !== undefined ) { - s.oZIndexes.left = oInit.zLeft; - } - if ( oInit.zRight !== undefined ) { - s.oZIndexes.right = oInit.zRight; - } - - if ( oInit.offsetTop !== undefined ) { - s.oOffset.top = oInit.offsetTop; - } - if ( oInit.alwaysCloneTop !== undefined ) { - s.oCloneOnDraw.top = oInit.alwaysCloneTop; - } - if ( oInit.alwaysCloneBottom !== undefined ) { - s.oCloneOnDraw.bottom = oInit.alwaysCloneBottom; - } - if ( oInit.alwaysCloneLeft !== undefined ) { - s.oCloneOnDraw.left = oInit.alwaysCloneLeft; - } - if ( oInit.alwaysCloneRight !== undefined ) { - s.oCloneOnDraw.right = oInit.alwaysCloneRight; - } - } - }, - - /* - * Function: _fnCloneTable - * Purpose: Clone the table node and do basic initialisation - * Returns: - - * Inputs: - - */ - _fnCloneTable: function ( sType, sClass, fnClone, iCells ) - { - var s = this.fnGetSettings(); - var nCTable; - - /* We know that the table _MUST_ has a DIV wrapped around it, because this is simply how - * DataTables works. Therefore, we can set this to be relatively position (if it is not - * alreadu absolute, and use this as the base point for the cloned header - */ - if ( $(s.nTable.parentNode).css('position') != "absolute" ) - { - s.nTable.parentNode.style.position = "relative"; - } - - /* Just a shallow clone will do - we only want the table node */ - nCTable = s.nTable.cloneNode( false ); - nCTable.removeAttribute( 'id' ); - - var nDiv = document.createElement( 'div' ); - nDiv.style.position = "absolute"; - nDiv.style.top = "0px"; - nDiv.style.left = "0px"; - nDiv.className += " FixedHeader_Cloned "+sType+" "+sClass; - - /* Set the zIndexes */ - if ( sType == "fixedHeader" ) - { - nDiv.style.zIndex = s.oZIndexes.top; - } - if ( sType == "fixedFooter" ) - { - nDiv.style.zIndex = s.oZIndexes.bottom; - } - if ( sType == "fixedLeft" ) - { - nDiv.style.zIndex = s.oZIndexes.left; - } - else if ( sType == "fixedRight" ) - { - nDiv.style.zIndex = s.oZIndexes.right; - } - - /* remove margins since we are going to position it absolutely */ - nCTable.style.margin = "0"; - - /* Insert the newly cloned table into the DOM, on top of the "real" header */ - nDiv.appendChild( nCTable ); - document.body.appendChild( nDiv ); - - return { - "nNode": nCTable, - "nWrapper": nDiv, - "sType": sType, - "sPosition": "", - "sTop": "", - "sLeft": "", - "fnClone": fnClone, - "iCells": iCells - }; - }, - - /* - * Function: _fnMeasure - * Purpose: Get the current positioning of the table in the DOM - * Returns: - - * Inputs: - - */ - _fnMeasure: function () - { - var - s = this.fnGetSettings(), - m = s.oMes, - jqTable = $(s.nTable), - oOffset = jqTable.offset(), - iParentScrollTop = this._fnSumScroll( s.nTable.parentNode, 'scrollTop' ), - iParentScrollLeft = this._fnSumScroll( s.nTable.parentNode, 'scrollLeft' ); - - m.iTableWidth = jqTable.outerWidth(); - m.iTableHeight = jqTable.outerHeight(); - m.iTableLeft = oOffset.left + s.nTable.parentNode.scrollLeft; - m.iTableTop = oOffset.top + iParentScrollTop; - m.iTableRight = m.iTableLeft + m.iTableWidth; - m.iTableRight = FixedHeader.oDoc.iWidth - m.iTableLeft - m.iTableWidth; - m.iTableBottom = FixedHeader.oDoc.iHeight - m.iTableTop - m.iTableHeight; - }, - - /* - * Function: _fnSumScroll - * Purpose: Sum node parameters all the way to the top - * Returns: int: sum - * Inputs: node:n - node to consider - * string:side - scrollTop or scrollLeft - */ - _fnSumScroll: function ( n, side ) - { - var i = n[side]; - while ( n = n.parentNode ) - { - if ( n.nodeName == 'HTML' || n.nodeName == 'BODY' ) - { - break; - } - i = n[side]; - } - return i; - }, - - /* - * Function: _fnUpdatePositions - * Purpose: Loop over the fixed elements for this table and update their positions - * Returns: - - * Inputs: - - */ - _fnUpdatePositions: function () - { - var s = this.fnGetSettings(); - this._fnMeasure(); - - for ( var i=0, iLen=s.aoCache.length ; i oWin.iScrollTop + s.oOffset.top ) - { - /* Above the table */ - this._fnUpdateCache( oCache, 'sPosition', "absolute", 'position', nTable.style ); - this._fnUpdateCache( oCache, 'sTop', oMes.iTableTop+"px", 'top', nTable.style ); - this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style ); - } - else if ( oWin.iScrollTop + s.oOffset.top > oMes.iTableTop+iTbodyHeight ) - { - /* At the bottom of the table */ - this._fnUpdateCache( oCache, 'sPosition', "absolute", 'position', nTable.style ); - this._fnUpdateCache( oCache, 'sTop', (oMes.iTableTop+iTbodyHeight)+"px", 'top', nTable.style ); - this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style ); - } - else - { - /* In the middle of the table */ - this._fnUpdateCache( oCache, 'sPosition', 'fixed', 'position', nTable.style ); - this._fnUpdateCache( oCache, 'sTop', s.oOffset.top+"px", 'top', nTable.style ); - this._fnUpdateCache( oCache, 'sLeft', (oMes.iTableLeft-oWin.iScrollLeft)+"px", 'left', nTable.style ); - } - }, - - /* - * Function: _fnUpdateCache - * Purpose: Check the cache and update cache and value if needed - * Returns: - - * Inputs: object:oCache - local cache object - * string:sCache - cache property - * string:sSet - value to set - * string:sProperty - object property to set - * object:oObj - object to update - */ - _fnUpdateCache: function ( oCache, sCache, sSet, sProperty, oObj ) - { - if ( oCache[sCache] != sSet ) - { - oObj[sProperty] = sSet; - oCache[sCache] = sSet; - } - }, - - - - /** - * Copy the classes of all child nodes from one element to another. This implies - * that the two have identical structure - no error checking is performed to that - * fact. - * @param {element} source Node to copy classes from - * @param {element} dest Node to copy classes too - */ - _fnClassUpdate: function ( source, dest ) - { - var that = this; - - if ( source.nodeName.toUpperCase() === "TR" || source.nodeName.toUpperCase() === "TH" || - source.nodeName.toUpperCase() === "TD" || source.nodeName.toUpperCase() === "SPAN" ) - { - dest.className = source.className; - } - - $(source).children().each( function (i) { - that._fnClassUpdate( $(source).children()[i], $(dest).children()[i] ); - } ); - }, - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Cloning functions - */ - - /* - * Function: _fnCloneThead - * Purpose: Clone the thead element - * Returns: - - * Inputs: object:oCache - the cached values for this fixed element - */ - _fnCloneThead: function ( oCache ) - { - var s = this.fnGetSettings(); - var nTable = oCache.nNode; - - if ( s.bInitComplete && !s.oCloneOnDraw.top ) - { - this._fnClassUpdate( $('thead', s.nTable)[0], $('thead', nTable)[0] ); - return; - } - - /* Set the wrapper width to match that of the cloned table */ - var iDtWidth = $(s.nTable).outerWidth(); - oCache.nWrapper.style.width = iDtWidth+"px"; - nTable.style.width = iDtWidth+"px"; - - /* Remove any children the cloned table has */ - while ( nTable.childNodes.length > 0 ) - { - $('thead th', nTable).unbind( 'click' ); - nTable.removeChild( nTable.childNodes[0] ); - } - - /* Clone the DataTables header */ - var nThead = $('thead', s.nTable).clone(true)[0]; - nTable.appendChild( nThead ); - - /* Copy the widths across - apparently a clone isn't good enough for this */ - var a = []; - var b = []; - - $("thead>tr th", s.nTable).each( function (i) { - a.push( $(this).width() ); - } ); - - $("thead>tr td", s.nTable).each( function (i) { - b.push( $(this).width() ); - } ); - - $("thead>tr th", s.nTable).each( function (i) { - $("thead>tr th:eq("+i+")", nTable).width( a[i] ); - $(this).width( a[i] ); - } ); - - $("thead>tr td", s.nTable).each( function (i) { - $("thead>tr td:eq("+i+")", nTable).width( b[i] ); - $(this).width( b[i] ); - } ); - - // Stop DataTables 1.9 from putting a focus ring on the headers when - // clicked to sort - $('th.sorting, th.sorting_desc, th.sorting_asc', nTable).bind( 'click', function () { - this.blur(); - } ); - }, - - /* - * Function: _fnCloneTfoot - * Purpose: Clone the tfoot element - * Returns: - - * Inputs: object:oCache - the cached values for this fixed element - */ - _fnCloneTfoot: function ( oCache ) - { - var s = this.fnGetSettings(); - var nTable = oCache.nNode; - - /* Set the wrapper width to match that of the cloned table */ - oCache.nWrapper.style.width = $(s.nTable).outerWidth()+"px"; - - /* Remove any children the cloned table has */ - while ( nTable.childNodes.length > 0 ) - { - nTable.removeChild( nTable.childNodes[0] ); - } - - /* Clone the DataTables footer */ - var nTfoot = $('tfoot', s.nTable).clone(true)[0]; - nTable.appendChild( nTfoot ); - - /* Copy the widths across - apparently a clone isn't good enough for this */ - $("tfoot:eq(0)>tr th", s.nTable).each( function (i) { - $("tfoot:eq(0)>tr th:eq("+i+")", nTable).width( $(this).width() ); - } ); - - $("tfoot:eq(0)>tr td", s.nTable).each( function (i) { - $("tfoot:eq(0)>tr td:eq("+i+")", nTable).width( $(this).width() ); - } ); - }, - - /* - * Function: _fnCloneTLeft - * Purpose: Clone the left column(s) - * Returns: - - * Inputs: object:oCache - the cached values for this fixed element - */ - _fnCloneTLeft: function ( oCache ) - { - var s = this.fnGetSettings(); - var nTable = oCache.nNode; - var nBody = $('tbody', s.nTable)[0]; - - /* Remove any children the cloned table has */ - while ( nTable.childNodes.length > 0 ) - { - nTable.removeChild( nTable.childNodes[0] ); - } - - /* Is this the most efficient way to do this - it looks horrible... */ - nTable.appendChild( $("thead", s.nTable).clone(true)[0] ); - nTable.appendChild( $("tbody", s.nTable).clone(true)[0] ); - if ( s.bFooter ) - { - nTable.appendChild( $("tfoot", s.nTable).clone(true)[0] ); - } - - /* Remove unneeded cells */ - var sSelector = 'gt(' + (oCache.iCells - 1) + ')'; - $('thead tr', nTable).each( function (k) { - $('th:' + sSelector, this).remove(); - } ); - - $('tfoot tr', nTable).each( function (k) { - $('th:' + sSelector, this).remove(); - } ); - - $('tbody tr', nTable).each( function (k) { - $('td:' + sSelector, this).remove(); - } ); - - this.fnEqualiseHeights( 'thead', nBody.parentNode, nTable ); - this.fnEqualiseHeights( 'tbody', nBody.parentNode, nTable ); - this.fnEqualiseHeights( 'tfoot', nBody.parentNode, nTable ); - - var iWidth = 0; - for (var i = 0; i < oCache.iCells; i++) { - iWidth += $('thead tr th:eq(' + i + ')', s.nTable).outerWidth(); - } - nTable.style.width = iWidth+"px"; - oCache.nWrapper.style.width = iWidth+"px"; - }, - - /* - * Function: _fnCloneTRight - * Purpose: Clone the right most column(s) - * Returns: - - * Inputs: object:oCache - the cached values for this fixed element - */ - _fnCloneTRight: function ( oCache ) - { - var s = this.fnGetSettings(); - var nBody = $('tbody', s.nTable)[0]; - var nTable = oCache.nNode; - var iCols = $('tbody tr:eq(0) td', s.nTable).length; - - /* Remove any children the cloned table has */ - while ( nTable.childNodes.length > 0 ) - { - nTable.removeChild( nTable.childNodes[0] ); - } - - /* Is this the most efficient way to do this - it looks horrible... */ - nTable.appendChild( $("thead", s.nTable).clone(true)[0] ); - nTable.appendChild( $("tbody", s.nTable).clone(true)[0] ); - if ( s.bFooter ) - { - nTable.appendChild( $("tfoot", s.nTable).clone(true)[0] ); - } - $('thead tr th:lt('+(iCols-oCache.iCells)+')', nTable).remove(); - $('tfoot tr th:lt('+(iCols-oCache.iCells)+')', nTable).remove(); - - /* Remove unneeded cells */ - $('tbody tr', nTable).each( function (k) { - $('td:lt('+(iCols-oCache.iCells)+')', this).remove(); - } ); - - this.fnEqualiseHeights( 'thead', nBody.parentNode, nTable ); - this.fnEqualiseHeights( 'tbody', nBody.parentNode, nTable ); - this.fnEqualiseHeights( 'tfoot', nBody.parentNode, nTable ); - - var iWidth = 0; - for (var i = 0; i < oCache.iCells; i++) { - iWidth += $('thead tr th:eq('+(iCols-1-i)+')', s.nTable).outerWidth(); - } - nTable.style.width = iWidth+"px"; - oCache.nWrapper.style.width = iWidth+"px"; - }, - - - /** - * Equalise the heights of the rows in a given table node in a cross browser way. Note that this - * is more or less lifted as is from FixedColumns - * @method fnEqualiseHeights - * @returns void - * @param {string} parent Node type - thead, tbody or tfoot - * @param {element} original Original node to take the heights from - * @param {element} clone Copy the heights to - * @private - */ - "fnEqualiseHeights": function ( parent, original, clone ) - { - var that = this; - var originals = $(parent +' tr', original); - var height; - - $(parent+' tr', clone).each( function (k) { - height = originals.eq( k ).css('height'); - - // This is nasty :-(. IE has a sub-pixel error even when setting - // the height below (the Firefox fix) which causes the fixed column - // to go out of alignment. Need to add a pixel before the assignment - // Can this be feature detected? Not sure how... - if ( navigator.appName == 'Microsoft Internet Explorer' ) { - height = parseInt( height, 10 ) + 1; - } - - $(this).css( 'height', height ); - - // For Firefox to work, we need to also set the height of the - // original row, to the value that we read from it! Otherwise there - // is a sub-pixel rounding error - originals.eq( k ).css( 'height', height ); - } ); - } -}; - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Static properties and methods - * We use these for speed! This information is common to all instances of FixedHeader, so no - * point if having them calculated and stored for each different instance. - */ - -/* - * Variable: oWin - * Purpose: Store information about the window positioning - * Scope: FixedHeader - */ -FixedHeader.oWin = { - "iScrollTop": 0, - "iScrollRight": 0, - "iScrollBottom": 0, - "iScrollLeft": 0, - "iHeight": 0, - "iWidth": 0 -}; - -/* - * Variable: oDoc - * Purpose: Store information about the document size - * Scope: FixedHeader - */ -FixedHeader.oDoc = { - "iHeight": 0, - "iWidth": 0 -}; - -/* - * Variable: afnScroll - * Purpose: Array of functions that are to be used for the scrolling components - * Scope: FixedHeader - */ -FixedHeader.afnScroll = []; - -/* - * Function: fnMeasure - * Purpose: Update the measurements for the window and document - * Returns: - - * Inputs: - - */ -FixedHeader.fnMeasure = function () -{ - var - jqWin = $(window), - jqDoc = $(document), - oWin = FixedHeader.oWin, - oDoc = FixedHeader.oDoc; - - oDoc.iHeight = jqDoc.height(); - oDoc.iWidth = jqDoc.width(); - - oWin.iHeight = jqWin.height(); - oWin.iWidth = jqWin.width(); - oWin.iScrollTop = jqWin.scrollTop(); - oWin.iScrollLeft = jqWin.scrollLeft(); - oWin.iScrollRight = oDoc.iWidth - oWin.iScrollLeft - oWin.iWidth; - oWin.iScrollBottom = oDoc.iHeight - oWin.iScrollTop - oWin.iHeight; -}; - - -FixedHeader.version = "2.1.2"; - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Global processing - */ - -/* - * Just one 'scroll' event handler in FixedHeader, which calls the required components. This is - * done as an optimisation, to reduce calculation and proagation time - */ -$(window).scroll( function () { - FixedHeader.fnMeasure(); - - for ( var i=0, iLen=FixedHeader.afnScroll.length ; itfoot",c.nTable).length?!0:!1,c.oSides.top&&c.aoCache.push(d._fnCloneTable("fixedHeader","FixedHeader_Header",d._fnCloneThead)),c.oSides.bottom&&c.aoCache.push(d._fnCloneTable("fixedFooter","FixedHeader_Footer",d._fnCloneTfoot)),c.oSides.left&&c.aoCache.push(d._fnCloneTable("fixedLeft","FixedHeader_Left",d._fnCloneTLeft,c.oSides.left)), -c.oSides.right&&c.aoCache.push(d._fnCloneTable("fixedRight","FixedHeader_Right",d._fnCloneTRight,c.oSides.right)),FixedHeader.afnScroll.push(function(){d._fnUpdatePositions.call(d)}),e(j).resize(function(){FixedHeader.fnMeasure();d._fnUpdateClones.call(d);d._fnUpdatePositions.call(d)}),e(c.nTable).on("column-reorder.dt",function(){FixedHeader.fnMeasure();d._fnUpdateClones(!0);d._fnUpdatePositions()}).on("column-visibility.dt",function(){FixedHeader.fnMeasure();d._fnUpdateClones(!0);d._fnUpdatePositions()}), -FixedHeader.fnMeasure(),d._fnUpdateClones(),d._fnUpdatePositions(),c.bInitComplete=!0)},fnInitSettings:function(a,b){if(b!==h&&(b.top!==h&&(a.oSides.top=b.top),b.bottom!==h&&(a.oSides.bottom=b.bottom),"boolean"==typeof b.left?a.oSides.left=b.left?1:0:b.left!==h&&(a.oSides.left=b.left),"boolean"==typeof b.right?a.oSides.right=b.right?1:0:b.right!==h&&(a.oSides.right=b.right),b.zTop!==h&&(a.oZIndexes.top=b.zTop),b.zBottom!==h&&(a.oZIndexes.bottom=b.zBottom),b.zLeft!==h&&(a.oZIndexes.left=b.zLeft),b.zRight!== -h&&(a.oZIndexes.right=b.zRight),b.offsetTop!==h&&(a.oOffset.top=b.offsetTop),b.alwaysCloneTop!==h&&(a.oCloneOnDraw.top=b.alwaysCloneTop),b.alwaysCloneBottom!==h&&(a.oCloneOnDraw.bottom=b.alwaysCloneBottom),b.alwaysCloneLeft!==h&&(a.oCloneOnDraw.left=b.alwaysCloneLeft),b.alwaysCloneRight!==h))a.oCloneOnDraw.right=b.alwaysCloneRight},_fnCloneTable:function(a,b,c,d){var f=this.fnGetSettings(),g;"absolute"!=e(f.nTable.parentNode).css("position")&&(f.nTable.parentNode.style.position="relative");g=f.nTable.cloneNode(!1); -g.removeAttribute("id");var i=k.createElement("div");i.style.position="absolute";i.style.top="0px";i.style.left="0px";i.className+=" FixedHeader_Cloned "+a+" "+b;"fixedHeader"==a&&(i.style.zIndex=f.oZIndexes.top);"fixedFooter"==a&&(i.style.zIndex=f.oZIndexes.bottom);"fixedLeft"==a?i.style.zIndex=f.oZIndexes.left:"fixedRight"==a&&(i.style.zIndex=f.oZIndexes.right);g.style.margin="0";i.appendChild(g);k.body.appendChild(i);return{nNode:g,nWrapper:i,sType:a,sPosition:"",sTop:"",sLeft:"",fnClone:c,iCells:d}}, -_fnMeasure:function(){var a=this.fnGetSettings(),b=a.oMes,c=e(a.nTable),d=c.offset(),f=this._fnSumScroll(a.nTable.parentNode,"scrollTop");this._fnSumScroll(a.nTable.parentNode,"scrollLeft");b.iTableWidth=c.outerWidth();b.iTableHeight=c.outerHeight();b.iTableLeft=d.left+a.nTable.parentNode.scrollLeft;b.iTableTop=d.top+f;b.iTableRight=b.iTableLeft+b.iTableWidth;b.iTableRight=FixedHeader.oDoc.iWidth-b.iTableLeft-b.iTableWidth;b.iTableBottom=FixedHeader.oDoc.iHeight-b.iTableTop-b.iTableHeight},_fnSumScroll:function(a, -b){for(var c=a[b];(a=a.parentNode)&&!("HTML"==a.nodeName||"BODY"==a.nodeName);)c=a[b];return c},_fnUpdatePositions:function(){var a=this.fnGetSettings();this._fnMeasure();for(var b=0,c=a.aoCache.length;bd.iScrollTop+b.oOffset.top?(this._fnUpdateCache(a,"sPosition","absolute","position",e.style),this._fnUpdateCache(a,"sTop",c.iTableTop+"px","top",e.style),this._fnUpdateCache(a,"sLeft",c.iTableLeft+"px","left",e.style)):d.iScrollTop+b.oOffset.top>c.iTableTop+ -g?(this._fnUpdateCache(a,"sPosition","absolute","position",e.style),this._fnUpdateCache(a,"sTop",c.iTableTop+g+"px","top",e.style),this._fnUpdateCache(a,"sLeft",c.iTableLeft+"px","left",e.style)):(this._fnUpdateCache(a,"sPosition","fixed","position",e.style),this._fnUpdateCache(a,"sTop",b.oOffset.top+"px","top",e.style),this._fnUpdateCache(a,"sLeft",c.iTableLeft-d.iScrollLeft+"px","left",e.style))},_fnUpdateCache:function(a,b,c,d,e){a[b]!=c&&(e[d]=c,a[b]=c)},_fnClassUpdate:function(a,b){var c=this; -if("TR"===a.nodeName.toUpperCase()||"TH"===a.nodeName.toUpperCase()||"TD"===a.nodeName.toUpperCase()||"SPAN"===a.nodeName.toUpperCase())b.className=a.className;e(a).children().each(function(d){c._fnClassUpdate(e(a).children()[d],e(b).children()[d])})},_fnCloneThead:function(a){var b=this.fnGetSettings(),c=a.nNode;if(b.bInitComplete&&!b.oCloneOnDraw.top)this._fnClassUpdate(e("thead",b.nTable)[0],e("thead",c)[0]);else{var d=e(b.nTable).outerWidth();a.nWrapper.style.width=d+"px";for(c.style.width=d+ -"px";0tr th",b.nTable).each(function(){f.push(e(this).width())});e("thead>tr td",b.nTable).each(function(){g.push(e(this).width())});e("thead>tr th",b.nTable).each(function(a){e("thead>tr th:eq("+a+")",c).width(f[a]);e(this).width(f[a])});e("thead>tr td",b.nTable).each(function(a){e("thead>tr td:eq("+a+")",c).width(g[a]);e(this).width(g[a])}); -e("th.sorting, th.sorting_desc, th.sorting_asc",c).bind("click",function(){this.blur()})}},_fnCloneTfoot:function(a){var b=this.fnGetSettings(),c=a.nNode;for(a.nWrapper.style.width=e(b.nTable).outerWidth()+"px";0tr th",b.nTable).each(function(a){e("tfoot:eq(0)>tr th:eq("+a+")",c).width(e(this).width())});e("tfoot:eq(0)>tr td",b.nTable).each(function(a){e("tfoot:eq(0)>tr td:eq("+ -a+")",c).width(e(this).width())})},_fnCloneTLeft:function(a){for(var b=this.fnGetSettings(),c=a.nNode,d=e("tbody",b.nTable)[0];0= oSettings.fnDisplayEnd() ) - { - if ( oSettings._iDisplayLength >= 0 ) - { - /* Make sure we are not over running the display array */ - if ( oSettings._iDisplayStart + oSettings._iDisplayLength < oSettings.fnRecordsDisplay() ) - { - oSettings._iDisplayStart += oSettings._iDisplayLength; - } - } - else - { - oSettings._iDisplayStart = 0; - } - _oDatatable.oApi._fnCalculateEnd( oSettings ); - } - - /* Page backwards */ - while ( iRow < oSettings._iDisplayStart ) - { - oSettings._iDisplayStart = oSettings._iDisplayLength>=0 ? - oSettings._iDisplayStart - oSettings._iDisplayLength : - 0; - - if ( oSettings._iDisplayStart < 0 ) - { - oSettings._iDisplayStart = 0; - } - _oDatatable.oApi._fnCalculateEnd( oSettings ); - } - - /* Re-draw the table */ - _oDatatable.oApi._fnDraw( oSettings ); - - /* Restore the key capture */ - _bKeyCapture = bKeyCaptureCache; - } - - /* Cache the information that we are interested in */ - var aNewPos = _fnCoordsFromCell( nTarget ); - _nOldFocus = nTarget; - _iOldX = aNewPos[0]; - _iOldY = aNewPos[1]; - - var iViewportHeight, iViewportWidth, iScrollTop, iScrollLeft, iHeight, iWidth, aiPos; - if ( bAutoScroll ) - { - /* Scroll the viewport such that the new cell is fully visible in the rendered window */ - iViewportHeight = $(window).height(); - iViewportWidth = $(window).width(); - iScrollTop = $(document).scrollTop(); - iScrollLeft = $(document).scrollLeft(); - iHeight = nTarget.offsetHeight; - iWidth = nTarget.offsetWidth; - aiPos = _fnGetPos( nTarget ); - - /* Take account of scrolling in DataTables 1.7 - remove scrolling since that would add to - * the positioning calculation - */ - if ( _oDatatable && typeof oSettings.oScroll != 'undefined' && - (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "") ) - { - aiPos[1] -= $(oSettings.nTable.parentNode).scrollTop(); - aiPos[0] -= $(oSettings.nTable.parentNode).scrollLeft(); - } - - /* Correct viewport positioning for vertical scrolling */ - if ( aiPos[1]+iHeight > iScrollTop+iViewportHeight ) - { - /* Displayed element if off the bottom of the viewport */ - _fnSetScrollTop( aiPos[1]+iHeight - iViewportHeight ); - } - else if ( aiPos[1] < iScrollTop ) - { - /* Displayed element if off the top of the viewport */ - _fnSetScrollTop( aiPos[1] ); - } - - /* Correct viewport positioning for horizontal scrolling */ - if ( aiPos[0]+iWidth > iScrollLeft+iViewportWidth ) - { - /* Displayed element is off the bottom of the viewport */ - _fnSetScrollLeft( aiPos[0]+iWidth - iViewportWidth ); - } - else if ( aiPos[0] < iScrollLeft ) - { - /* Displayed element if off the Left of the viewport */ - _fnSetScrollLeft( aiPos[0] ); - } - } - - /* Take account of scrolling in DataTables 1.7 */ - if ( _oDatatable && typeof oSettings.oScroll != 'undefined' && - (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "") ) - { - var dtScrollBody = oSettings.nTable.parentNode; - iViewportHeight = dtScrollBody.clientHeight; - iViewportWidth = dtScrollBody.clientWidth; - iScrollTop = dtScrollBody.scrollTop; - iScrollLeft = dtScrollBody.scrollLeft; - iHeight = nTarget.offsetHeight; - iWidth = nTarget.offsetWidth; - - /* Correct for vertical scrolling */ - if ( nTarget.offsetTop + iHeight > iViewportHeight+iScrollTop ) - { - dtScrollBody.scrollTop = (nTarget.offsetTop + iHeight) - iViewportHeight; - } - else if ( nTarget.offsetTop < iScrollTop ) - { - dtScrollBody.scrollTop = nTarget.offsetTop; - } - - /* Correct for horizontal scrolling */ - if ( nTarget.offsetLeft + iWidth > iViewportWidth+iScrollLeft ) - { - dtScrollBody.scrollLeft = (nTarget.offsetLeft + iWidth) - iViewportWidth; - } - else if ( nTarget.offsetLeft < iScrollLeft ) - { - dtScrollBody.scrollLeft = nTarget.offsetLeft; - } - } - - /* Focused - so we want to capture the keys */ - _fnCaptureKeys(); - - /* Fire of the focus event if there is one */ - _fnEventFire( "focus", _iOldX, _iOldY ); - } - - - /* - * Function: _fnBlur - * Purpose: Blur focus from the whole table - * Returns: - - * Inputs: - - */ - function _fnBlur() - { - _fnRemoveFocus( _nOldFocus ); - _iOldX = null; - _iOldY = null; - _nOldFocus = null; - _fnReleaseKeys(); - } - - - /* - * Function: _fnRemoveFocus - * Purpose: Remove focus from a cell and fire any blur events which are attached - * Returns: - - * Inputs: node:nTarget - cell of interest - */ - function _fnRemoveFocus( nTarget ) - { - $(nTarget).removeClass( _sFocusClass ); - $(nTarget).parent().removeClass( _sFocusClass ); - _fnEventFire( "blur", _iOldX, _iOldY ); - } - - - /* - * Function: _fnClick - * Purpose: Focus on the element that has been clicked on by the user - * Returns: - - * Inputs: event:e - click event - */ - function _fnClick ( e ) - { - var nTarget = this; - while ( nTarget.nodeName != "TD" ) - { - nTarget = nTarget.parentNode; - } - - _fnSetFocus( nTarget ); - _fnCaptureKeys(); - } - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Key events - */ - - /* - * Function: _fnKey - * Purpose: Deal with a key events, be it moving the focus or return etc. - * Returns: bool: - allow browser default action - * Inputs: event:e - key event - */ - function _fnKey ( e ) - { - /* If user or system has blocked KeyTable from doing anything, just ignore this event */ - if ( _that.block || !_bKeyCapture ) - { - return true; - } - - /* If a modifier key is pressed (exapct shift), ignore the event */ - if ( e.metaKey || e.altKey || e.ctrlKey ) - { - return true; - } - var - x, y, - iTableWidth = _nBody.getElementsByTagName('tr')[0].getElementsByTagName('td').length, - iTableHeight; - - /* Get table height and width - done here so as to be dynamic (if table is updated) */ - if ( _oDatatable ) - { - /* - * Locate the current node in the DataTable overriding the old positions - the reason for - * is is that there might have been some DataTables interaction between the last focus and - * now - */ - iTableHeight = _oDatatable.aiDisplay.length; - - var aDtPos = _fnFindDtCell( _nOldFocus ); - if ( aDtPos === null ) - { - /* If the table has been updated such that the focused cell can't be seen - do nothing */ - return; - } - _iOldX = aDtPos[ 0 ]; - _iOldY = aDtPos[ 1 ]; - } - else - { - iTableHeight = _nBody.getElementsByTagName('tr').length; - } - - /* Capture shift+tab to match the left arrow key */ - var iKey = (e.keyCode == 9 && e.shiftKey) ? -1 : e.keyCode; - - switch( iKey ) - { - case 13: /* return */ - e.preventDefault(); - e.stopPropagation(); - _fnEventFire( "action", _iOldX, _iOldY ); - return true; - - case 27: /* esc */ - if ( !_fnEventFire( "esc", _iOldX, _iOldY ) ) - { - /* Only lose focus if there isn't an escape handler on the cell */ - _fnBlur(); - return; - } - x = _iOldX; - y = _iOldY; - break; - - case -1: - case 37: /* left arrow */ - if ( _iOldX > 0 ) { - x = _iOldX - 1; - y = _iOldY; - } else if ( _iOldY > 0 ) { - x = iTableWidth-1; - y = _iOldY - 1; - } else { - /* at start of table */ - if ( iKey == -1 && _bForm ) - { - /* If we are in a form, return focus to the 'input' element such that tabbing will - * follow correctly in the browser - */ - _bInputFocused = true; - _nInput.focus(); - - /* This timeout is a little nasty - but IE appears to have some asyhnc behaviour for - * focus - */ - setTimeout( function(){ _bInputFocused = false; }, 0 ); - _bKeyCapture = false; - _fnBlur(); - return true; - } - else - { - return false; - } - } - break; - - case 38: /* up arrow */ - if ( _iOldY > 0 ) { - x = _iOldX; - y = _iOldY - 1; - } else { - return false; - } - break; - - case 36: /* home */ - x = _iOldX; - y = 0; - break; - - case 33: /* page up */ - x = _iOldX; - y = _iOldY - 10; - if (y < 0) { - y = 0; - } - break; - - case 9: /* tab */ - case 39: /* right arrow */ - if ( _iOldX < iTableWidth-1 ) { - x = _iOldX + 1; - y = _iOldY; - } else if ( _iOldY < iTableHeight-1 ) { - x = 0; - y = _iOldY + 1; - } else { - /* at end of table */ - if ( iKey == 9 && _bForm ) - { - /* If we are in a form, return focus to the 'input' element such that tabbing will - * follow correctly in the browser - */ - _bInputFocused = true; - _nInput.focus(); - - /* This timeout is a little nasty - but IE appears to have some asyhnc behaviour for - * focus - */ - setTimeout( function(){ _bInputFocused = false; }, 0 ); - _bKeyCapture = false; - _fnBlur(); - return true; - } - else - { - return false; - } - } - break; - - case 40: /* down arrow */ - if ( _iOldY < iTableHeight-1 ) { - x = _iOldX; - y = _iOldY + 1; - } else { - return false; - } - break; - - case 35: /* end */ - x = _iOldX; - y = iTableHeight-1; - break; - - case 34: /* page down */ - x = _iOldX; - y = _iOldY+10; - if (y > iTableHeight-1) { - y = iTableHeight-1; - } - break; - - default: /* Nothing we are interested in */ - return true; - } - - _fnSetFocus( _fnCellFromCoords(x, y) ); - return false; - } - - - /* - * Function: _fnCaptureKeys - * Purpose: Start capturing key events for this table - * Returns: - - * Inputs: - - */ - function _fnCaptureKeys( ) - { - if ( !_bKeyCapture ) - { - _bKeyCapture = true; - } - } - - - /* - * Function: _fnReleaseKeys - * Purpose: Stop capturing key events for this table - * Returns: - - * Inputs: - - */ - function _fnReleaseKeys( ) - { - _bKeyCapture = false; - } - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Support functions - */ - - /* - * Function: _fnCellFromCoords - * Purpose: Calulate the target TD cell from x and y coordinates - * Returns: node: - TD target - * Inputs: int:x - x coordinate - * int:y - y coordinate - */ - function _fnCellFromCoords( x, y ) - { - if ( _oDatatable ) - { - if ( typeof _oDatatable.aoData[ _oDatatable.aiDisplay[ y ] ] != 'undefined' ) - { - return _oDatatable.aoData[ _oDatatable.aiDisplay[ y ] ].nTr.getElementsByTagName('td')[x]; - } - else - { - return null; - } - } - else - { - return $('tr:eq('+y+')>td:eq('+x+')', _nBody )[0]; - } - } - - - /* - * Function: _fnCoordsFromCell - * Purpose: Calculate the x and y position in a table from a TD cell - * Returns: array[2] int: [x, y] - * Inputs: node:n - TD cell of interest - * Notes: Not actually interested in this for DataTables since it might go out of date - */ - function _fnCoordsFromCell( n ) - { - if ( _oDatatable ) - { - return [ - $('td', n.parentNode).index(n), - $('tr', n.parentNode.parentNode).index(n.parentNode) + _oDatatable._iDisplayStart - ]; - } - else - { - return [ - $('td', n.parentNode).index(n), - $('tr', n.parentNode.parentNode).index(n.parentNode) - ]; - } - } - - - /* - * Function: _fnSetScrollTop - * Purpose: Set the vertical scrolling position - * Returns: - - * Inputs: int:iPos - scrolltop - * Notes: This is so nasty, but without browser detection you can't tell which you should set - * So on browsers that support both, the scroll top will be set twice. I can live with - * that :-) - */ - function _fnSetScrollTop( iPos ) - { - document.documentElement.scrollTop = iPos; - document.body.scrollTop = iPos; - } - - - /* - * Function: _fnSetScrollLeft - * Purpose: Set the horizontal scrolling position - * Returns: - - * Inputs: int:iPos - scrollleft - */ - function _fnSetScrollLeft( iPos ) - { - document.documentElement.scrollLeft = iPos; - document.body.scrollLeft = iPos; - } - - - /* - * Function: _fnGetPos - * Purpose: Get the position of an object on the rendered page - * Returns: array[2] int: [left, right] - * Inputs: node:obj - element of interest - */ - function _fnGetPos ( obj ) - { - var iLeft = 0; - var iTop = 0; - - if (obj.offsetParent) - { - iLeft = obj.offsetLeft; - iTop = obj.offsetTop; - obj = obj.offsetParent; - while (obj) - { - iLeft += obj.offsetLeft; - iTop += obj.offsetTop; - obj = obj.offsetParent; - } - } - return [iLeft,iTop]; - } - - - /* - * Function: _fnFindDtCell - * Purpose: Get the coords. of a cell from the DataTables internal information - * Returns: array[2] int: [x, y] coords. or null if not found - * Inputs: node:nTarget - the node of interest - */ - function _fnFindDtCell( nTarget ) - { - for ( var i=0, iLen=_oDatatable.aiDisplay.length ; i
    '; - } - else { - // all other browsers get an EMBED tag - html += ''; - } - return html; - }, - - hide: function() { - // temporarily hide floater offscreen - if (this.div) { - this.div.style.left = '-2000px'; - } - }, - - show: function() { - // show ourselves after a call to hide() - this.reposition(); - }, - - destroy: function() { - // destroy control and floater - if (this.domElement && this.div) { - this.hide(); - this.div.innerHTML = ''; - - var body = document.getElementsByTagName('body')[0]; - try { body.removeChild( this.div ); } catch(e) {} - - this.domElement = null; - this.div = null; - } - }, - - reposition: function(elem) { - // reposition our floating div, optionally to new container - // warning: container CANNOT change size, only position - if (elem) { - this.domElement = ZeroClipboard_TableTools.$(elem); - if (!this.domElement) { - this.hide(); - } - } - - if (this.domElement && this.div) { - var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement); - var style = this.div.style; - style.left = '' + box.left + 'px'; - style.top = '' + box.top + 'px'; - } - }, - - clearText: function() { - // clear the text to be copy / saved - this.clipText = ''; - if (this.ready) { - this.movie.clearText(); - } - }, - - appendText: function(newText) { - // append text to that which is to be copied / saved - this.clipText += newText; - if (this.ready) { this.movie.appendText(newText) ;} - }, - - setText: function(newText) { - // set text to be copied to be copied / saved - this.clipText = newText; - if (this.ready) { this.movie.setText(newText) ;} - }, - - setCharSet: function(charSet) { - // set the character set (UTF16LE or UTF8) - this.charSet = charSet; - if (this.ready) { this.movie.setCharSet(charSet) ;} - }, - - setBomInc: function(bomInc) { - // set if the BOM should be included or not - this.incBom = bomInc; - if (this.ready) { this.movie.setBomInc(bomInc) ;} - }, - - setFileName: function(newText) { - // set the file name - this.fileName = newText; - if (this.ready) { - this.movie.setFileName(newText); - } - }, - - setAction: function(newText) { - // set action (save or copy) - this.action = newText; - if (this.ready) { - this.movie.setAction(newText); - } - }, - - addEventListener: function(eventName, func) { - // add user event listener for event - // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel - eventName = eventName.toString().toLowerCase().replace(/^on/, ''); - if (!this.handlers[eventName]) { - this.handlers[eventName] = []; - } - this.handlers[eventName].push(func); - }, - - setHandCursor: function(enabled) { - // enable hand cursor (true), or default arrow cursor (false) - this.handCursorEnabled = enabled; - if (this.ready) { - this.movie.setHandCursor(enabled); - } - }, - - setCSSEffects: function(enabled) { - // enable or disable CSS effects on DOM container - this.cssEffects = !!enabled; - }, - - receiveEvent: function(eventName, args) { - var self; - - // receive event from flash - eventName = eventName.toString().toLowerCase().replace(/^on/, ''); - - // special behavior for certain events - switch (eventName) { - case 'load': - // movie claims it is ready, but in IE this isn't always the case... - // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function - this.movie = document.getElementById(this.movieId); - if (!this.movie) { - self = this; - setTimeout( function() { self.receiveEvent('load', null); }, 1 ); - return; - } - - // firefox on pc needs a "kick" in order to set these in certain cases - if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) { - self = this; - setTimeout( function() { self.receiveEvent('load', null); }, 100 ); - this.ready = true; - return; - } - - this.ready = true; - this.movie.clearText(); - this.movie.appendText( this.clipText ); - this.movie.setFileName( this.fileName ); - this.movie.setAction( this.action ); - this.movie.setCharSet( this.charSet ); - this.movie.setBomInc( this.incBom ); - this.movie.setHandCursor( this.handCursorEnabled ); - break; - - case 'mouseover': - if (this.domElement && this.cssEffects) { - //this.domElement.addClass('hover'); - if (this.recoverActive) { - this.domElement.addClass('active'); - } - } - break; - - case 'mouseout': - if (this.domElement && this.cssEffects) { - this.recoverActive = false; - if (this.domElement.hasClass('active')) { - this.domElement.removeClass('active'); - this.recoverActive = true; - } - //this.domElement.removeClass('hover'); - } - break; - - case 'mousedown': - if (this.domElement && this.cssEffects) { - this.domElement.addClass('active'); - } - break; - - case 'mouseup': - if (this.domElement && this.cssEffects) { - this.domElement.removeClass('active'); - this.recoverActive = false; - } - break; - } // switch eventName - - if (this.handlers[eventName]) { - for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) { - var func = this.handlers[eventName][idx]; - - if (typeof(func) == 'function') { - // actual function reference - func(this, args); - } - else if ((typeof(func) == 'object') && (func.length == 2)) { - // PHP style object + method, i.e. [myObject, 'myMethod'] - func[0][ func[1] ](this, args); - } - else if (typeof(func) == 'string') { - // name of function - window[func](this, args); - } - } // foreach event handler defined - } // user defined handler for event - } - -}; - -// For the Flash binding to work, ZeroClipboard_TableTools must be on the global -// object list -window.ZeroClipboard_TableTools = ZeroClipboard_TableTools; -//include TableTools.js -/* TableTools - * 2009-2015 SpryMedia Ltd - datatables.net/license - */ - -/*globals TableTools,ZeroClipboard_TableTools*/ - - -(function($, window, document) { - -/** - * TableTools provides flexible buttons and other tools for a DataTables enhanced table - * @class TableTools - * @constructor - * @param {Object} oDT DataTables instance. When using DataTables 1.10 this can - * also be a jQuery collection, jQuery selector, table node, DataTables API - * instance or DataTables settings object. - * @param {Object} oOpts TableTools options - * @param {String} oOpts.sSwfPath ZeroClipboard SWF path - * @param {String} oOpts.sRowSelect Row selection options - 'none', 'single', 'multi' or 'os' - * @param {Function} oOpts.fnPreRowSelect Callback function just prior to row selection - * @param {Function} oOpts.fnRowSelected Callback function just after row selection - * @param {Function} oOpts.fnRowDeselected Callback function when row is deselected - * @param {Array} oOpts.aButtons List of buttons to be used - */ -TableTools = function( oDT, oOpts ) -{ - /* Santiy check that we are a new instance */ - if ( ! this instanceof TableTools ) - { - alert( "Warning: TableTools must be initialised with the keyword 'new'" ); - } - - // In 1.10 we can use the API to get the settings object from a number of - // sources - var dtSettings = $.fn.dataTable.Api ? - new $.fn.dataTable.Api( oDT ).settings()[0] : - oDT.fnSettings(); - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public class variables - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * @namespace Settings object which contains customisable information for TableTools instance - */ - this.s = { - /** - * Store 'this' so the instance can be retrieved from the settings object - * @property that - * @type object - * @default this - */ - "that": this, - - /** - * DataTables settings objects - * @property dt - * @type object - * @default From the oDT init option - */ - "dt": dtSettings, - - /** - * @namespace Print specific information - */ - "print": { - /** - * DataTables draw 'start' point before the printing display was shown - * @property saveStart - * @type int - * @default -1 - */ - "saveStart": -1, - - /** - * DataTables draw 'length' point before the printing display was shown - * @property saveLength - * @type int - * @default -1 - */ - "saveLength": -1, - - /** - * Page scrolling point before the printing display was shown so it can be restored - * @property saveScroll - * @type int - * @default -1 - */ - "saveScroll": -1, - - /** - * Wrapped function to end the print display (to maintain scope) - * @property funcEnd - * @type Function - * @default function () {} - */ - "funcEnd": function () {} - }, - - /** - * A unique ID is assigned to each button in each instance - * @property buttonCounter - * @type int - * @default 0 - */ - "buttonCounter": 0, - - /** - * @namespace Select rows specific information - */ - "select": { - /** - * Select type - can be 'none', 'single' or 'multi' - * @property type - * @type string - * @default "" - */ - "type": "", - - /** - * Array of nodes which are currently selected - * @property selected - * @type array - * @default [] - */ - "selected": [], - - /** - * Function to run before the selection can take place. Will cancel the select if the - * function returns false - * @property preRowSelect - * @type Function - * @default null - */ - "preRowSelect": null, - - /** - * Function to run when a row is selected - * @property postSelected - * @type Function - * @default null - */ - "postSelected": null, - - /** - * Function to run when a row is deselected - * @property postDeselected - * @type Function - * @default null - */ - "postDeselected": null, - - /** - * Indicate if all rows are selected (needed for server-side processing) - * @property all - * @type boolean - * @default false - */ - "all": false, - - /** - * Class name to add to selected TR nodes - * @property selectedClass - * @type String - * @default "" - */ - "selectedClass": "" - }, - - /** - * Store of the user input customisation object - * @property custom - * @type object - * @default {} - */ - "custom": {}, - - /** - * SWF movie path - * @property swfPath - * @type string - * @default "" - */ - "swfPath": "", - - /** - * Default button set - * @property buttonSet - * @type array - * @default [] - */ - "buttonSet": [], - - /** - * When there is more than one TableTools instance for a DataTable, there must be a - * master which controls events (row selection etc) - * @property master - * @type boolean - * @default false - */ - "master": false, - - /** - * Tag names that are used for creating collections and buttons - * @namesapce - */ - "tags": {} - }; - - - /** - * @namespace Common and useful DOM elements for the class instance - */ - this.dom = { - /** - * DIV element that is create and all TableTools buttons (and their children) put into - * @property container - * @type node - * @default null - */ - "container": null, - - /** - * The table node to which TableTools will be applied - * @property table - * @type node - * @default null - */ - "table": null, - - /** - * @namespace Nodes used for the print display - */ - "print": { - /** - * Nodes which have been removed from the display by setting them to display none - * @property hidden - * @type array - * @default [] - */ - "hidden": [], - - /** - * The information display saying telling the user about the print display - * @property message - * @type node - * @default null - */ - "message": null - }, - - /** - * @namespace Nodes used for a collection display. This contains the currently used collection - */ - "collection": { - /** - * The div wrapper containing the buttons in the collection (i.e. the menu) - * @property collection - * @type node - * @default null - */ - "collection": null, - - /** - * Background display to provide focus and capture events - * @property background - * @type node - * @default null - */ - "background": null - } - }; - - /** - * @namespace Name space for the classes that this TableTools instance will use - * @extends TableTools.classes - */ - this.classes = $.extend( true, {}, TableTools.classes ); - if ( this.s.dt.bJUI ) - { - $.extend( true, this.classes, TableTools.classes_themeroller ); - } - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public class methods - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Retreieve the settings object from an instance - * @method fnSettings - * @returns {object} TableTools settings object - */ - this.fnSettings = function () { - return this.s; - }; - - - /* Constructor logic */ - if ( typeof oOpts == 'undefined' ) - { - oOpts = {}; - } - - - TableTools._aInstances.push( this ); - this._fnConstruct( oOpts ); - - return this; -}; - - - -TableTools.prototype = { - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public methods - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Retreieve the settings object from an instance - * @returns {array} List of TR nodes which are currently selected - * @param {boolean} [filtered=false] Get only selected rows which are - * available given the filtering applied to the table. By default - * this is false - i.e. all rows, regardless of filtering are - selected. - */ - "fnGetSelected": function ( filtered ) - { - var - out = [], - data = this.s.dt.aoData, - displayed = this.s.dt.aiDisplay, - i, iLen; - - if ( filtered ) - { - // Only consider filtered rows - for ( i=0, iLen=displayed.length ; i 0 ) - { - sTitle = anTitle[0].innerHTML; - } - } - - /* Strip characters which the OS will object to - checking for UTF8 support in the scripting - * engine - */ - if ( "\u00A1".toString().length < 4 ) { - return sTitle.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g, ""); - } else { - return sTitle.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g, ""); - } - }, - - - /** - * Calculate a unity array with the column width by proportion for a set of columns to be - * included for a button. This is particularly useful for PDF creation, where we can use the - * column widths calculated by the browser to size the columns in the PDF. - * @param {Object} oConfig Button configuration object - * @returns {Array} Unity array of column ratios - */ - "fnCalcColRatios": function ( oConfig ) - { - var - aoCols = this.s.dt.aoColumns, - aColumnsInc = this._fnColumnTargets( oConfig.mColumns ), - aColWidths = [], - iWidth = 0, iTotal = 0, i, iLen; - - for ( i=0, iLen=aColumnsInc.length ; i