Skip to content

The Unified and Autonomous Development Platform

Refine team edit page Add new component Jasny FileUploadField Remove unused JQuery file upload and dropzone

steve092bdf44a879
diff --git a/commons.jackson/src/main/java/com/pmease/commons/jackson/JsOptions.java b/commons.jackson/src/main/java/com/pmease/commons/jackson/JsOptions.java
index 0edbaa5f0e..063f877a27 100644
--- a/commons.jackson/src/main/java/com/pmease/commons/jackson/JsOptions.java
+++ b/commons.jackson/src/main/java/com/pmease/commons/jackson/JsOptions.java
@@ -48,4 +48,7 @@ public class JsOptions implements Serializable {
return this;
}
+ public boolean isEmpty() {
+ return map.isEmpty();
+ }
}
diff --git a/gitop.web/pom.xml b/gitop.web/pom.xml
index 15f1f4572e..79e9edf088 100644
--- a/gitop.web/pom.xml
+++ b/gitop.web/pom.xml
@@ -175,12 +175,6 @@
<version>1.4.2</version>
</dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>3.0.15</version>
- </dependency>
-
</dependencies>
<repositories>
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/GitopWebApp.java b/gitop.web/src/main/java/com/pmease/gitop/web/GitopWebApp.java
index 90f71f0cac..4a0ded44d8 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/GitopWebApp.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/GitopWebApp.java
@@ -194,7 +194,7 @@ public class GitopWebApp extends AbstractWicketConfig {
new BeanValidationConfiguration().configure(this);
loadDefaultUserAvatarData();
-
+
new ShiroWicketPlugin()
.mountLoginPage("login", LoginPage.class)
.mountLogoutPage("logout", LogoutPage.class)
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css b/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css
index f7ca51a7f4..e499ebe87a 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css
@@ -139,6 +139,16 @@ section>.head h2, section>.head h3 { margin: 0; font-size: 18px; line-height: 24
section .padder, section > .body { padding: 20px 20px; }
section > .well { border-radius: 0; border-width: 0 0 1px 0; margin: 0; }
section>.head .actions { float: left; }
+section .actionbar { padding: 8px 20px; border-bottom: 1px solid #ddd; background: #f7f9fa; position: relative; }
+.actionbar .btn { color: #666;}
+.actionbar .btn:hover { color: #08f; }
+.actionbar .btn:focus,
+.actionbar .btn:active {
+ background: transparent;
+ box-shadow: none;
+}
+
+.actionbar .btn-delete-team:hover { color: #900; }
/** TABLE */
@@ -186,6 +196,7 @@ th.wicket_orderUp a, th.wicket_orderDown a { padding-left: 20px; }
/* ACCOUNT SETTINGS PAGE */
.owners-list > li > a { color: #666; }
+.avatar-form .fileinput .thumbnail { width: 200px; height: 200px; }
/* TEAM EDIT PAGE */
.permission-link { color: #666; }
@@ -288,14 +299,13 @@ ul.btn-list { list-style: none; margin: 0; }
.list-group-heading { padding-bottom: 12px; border-bottom: 1px solid #ddd; }
.member-item { float: left; width: 330px; padding: 10px 0; margin: 0 20px 0 0; border: none; border-bottom: 1px solid #eee; }
-.member-item .avatar { width: 75px; height: 75px; float: left; box-shadow: none; }
+.member-item .avatar { width: 72px; height: 72px; float: left; box-shadow: none; }
.member-item .avatar > img { background: transparent; border-radius: 50%;}
-.member-item .member-content { vertical-align: middle; margin-left: 90px; }
+.member-item .member-content { vertical-align: middle; margin-left: 90px; margin-right: 30px; overflow: hidden; white-space: nowrap; }
.member-item .list-group-item-heading { margin-bottom: 9px; }
-.member-content .list-group-item-heading a,
-.member-content .list-group-item-heading em { display: block; overflow: hidden; white-space: nowrap;}
+.member-content .list-group-item-heading em { display: block; }
.member-content .list-group-item-heading em { font-style: normal; color: #999; font-weight: normal; }
-.member-content .list-item-teams { overflow: hidden; white-space: nowrap; margin-right: 10px; }
+.member-content .list-item-teams { overflow: auto; overflow-y: hidden; overflow-x: auto; white-space: nowrap; margin-right: 10px; }
.member-content .list-item-teams .btn { position: relative; }
.member-content .list-item-teams a.btn > i { position: absolute;left: 50%;margin-left: -6px;top: 50%;margin-top: -8px;font-size: 16px; display: none; }
.member-content .list-item-teams a.btn:hover { background: #ff2a68; border-color: #ff2a68; }
@@ -314,6 +324,11 @@ ul.btn-list { list-style: none; margin: 0; }
.list-group-item.repo:hover > .list-group-item-actions > .img-link { color: #990000; }
+.list-members .list-group-item-actions { top: 20px; margin-top: 0;}
+.simple-teams-list .member-item .avatar { width: 48px; height: 48px; }
+.simple-teams-list .member-item .member-content { margin-left: 60px; padding-top: 5px; }
+.simple-teams-list .member-item .list-group-item-heading { margin: 0; }
+
/**
* PROJECT PAGE
*/
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/Alert.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/Alert.java
index a2a6597d8e..0e5114d51e 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/Alert.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/Alert.java
@@ -30,11 +30,11 @@ public class Alert extends GenericPanel<String> {
/**
* The {@code Type} enum defines all possible alert types.
*/
- public enum Type {
+ public static enum Type {
Error, Success, Info, Warning;
public String cssClassName() {
- return equals(Warning) ? "alert-block" : "alert-" + name().toLowerCase();
+ return "alert-" + name().toLowerCase();
}
public static Type from(String level) {
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/FileUploadField.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/FileUploadField.java
new file mode 100644
index 0000000000..476d098ad9
--- /dev/null
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/FileUploadField.java
@@ -0,0 +1,40 @@
+package com.pmease.gitop.web.common.wicket.bootstrap.jasny;
+
+import java.util.List;
+
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.markup.html.form.upload.FileUpload;
+import org.apache.wicket.model.IModel;
+
+/**
+ * An extension of Wicket's default FileUploadField that contributes <a
+ * href="http://jasny.github.com/bootstrap/javascript.html#fileupload"
+ * >Jasny</a>'s special CSS and JS resources for making &lt;input type="file"
+ * /&gt; looking nicer.
+ *
+ * <p>
+ * As markup use any of the recommended markup snippets at <a
+ * href="http://jasny.github.com/bootstrap/javascript.html#fileupload">Jasny
+ * File Upload</a>
+ * </p>
+ */
+@SuppressWarnings("serial")
+public class FileUploadField extends
+ org.apache.wicket.markup.html.form.upload.FileUploadField {
+ public FileUploadField(String id) {
+ super(id);
+ }
+
+ public FileUploadField(String id, IModel<List<FileUpload>> model) {
+ super(id, model);
+ }
+
+ @Override
+ public void renderHead(IHeaderResponse response) {
+ super.renderHead(response);
+
+ response.render(JavaScriptHeaderItem
+ .forReference(JasnyJsReference.INSTANCE));
+ }
+}
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/JasnyCssReference.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/JasnyCssReference.java
new file mode 100644
index 0000000000..bc3007aca5
--- /dev/null
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/JasnyCssReference.java
@@ -0,0 +1,16 @@
+package com.pmease.gitop.web.common.wicket.bootstrap.jasny;
+
+import org.apache.wicket.request.resource.CssResourceReference;
+
+/**
+ * A CSS reference that loads the CSS resources needed by Jasny Twitter
+ * Bootstrap components.
+ */
+@SuppressWarnings("serial")
+public class JasnyCssReference extends CssResourceReference {
+ public static final JasnyCssReference INSTANCE = new JasnyCssReference();
+
+ private JasnyCssReference() {
+ super(JasnyCssReference.class, "res/jasny.css");
+ }
+}
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/JasnyJsReference.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/JasnyJsReference.java
new file mode 100644
index 0000000000..8d7a09a151
--- /dev/null
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/JasnyJsReference.java
@@ -0,0 +1,32 @@
+package com.pmease.gitop.web.common.wicket.bootstrap.jasny;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.HeaderItem;
+import org.apache.wicket.resource.JQueryPluginResourceReference;
+
+/**
+ * A JavaScript reference that loads the JavaScript resources needed by Jasny
+ * Twitter Bootstrap components.
+ */
+@SuppressWarnings("serial")
+public class JasnyJsReference extends JQueryPluginResourceReference {
+ public static final JasnyJsReference INSTANCE = new JasnyJsReference();
+
+ private JasnyJsReference() {
+ super(JasnyJsReference.class, "res/jasny.js");
+ }
+
+ @Override
+ public Iterable<? extends HeaderItem> getDependencies() {
+ List<HeaderItem> deps = new ArrayList<HeaderItem>();
+ for (HeaderItem dep : super.getDependencies()) {
+ deps.add(dep);
+ }
+
+ deps.add(CssHeaderItem.forReference(JasnyCssReference.INSTANCE));
+ return deps;
+ }
+}
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/res/jasny.css b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/res/jasny.css
new file mode 100644
index 0000000000..bf02e88a29
--- /dev/null
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/res/jasny.css
@@ -0,0 +1,146 @@
+.hide-text {
+ font: 0/0 a;
+ color: transparent;
+ text-shadow: none;
+ background-color: transparent;
+ border: 0;
+}
+.input-block-level {
+ display: block;
+ width: 100%;
+ min-height: 30px;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+tr.rowlink td {
+ cursor: pointer;
+}
+tr.rowlink td.nolink {
+ cursor: auto;
+}
+.table tbody tr.rowlink:hover td {
+ background-color: #cfcfcf;
+}
+a.rowlink {
+ color: inherit;
+ font: inherit;
+ text-decoration: inherit;
+}
+.btn-file {
+ position: relative;
+ overflow: hidden;
+ vertical-align: middle;
+ }
+
+.btn-file > input {
+ position: absolute;
+ top: 0;
+ right: 0;
+ margin: 0;
+ font-size: 23px;
+ cursor: pointer;
+ opacity: 0;
+ filter: alpha(opacity=0);
+ transform: translate(-300px, 0) scale(4);
+ direction: ltr;
+ }
+
+.fileinput {
+ margin-bottom: 9px;
+ }
+
+.fileinput .uneditable-input {
+ display: inline-block;
+ margin-bottom: 0;
+ vertical-align: middle;
+ cursor: text;
+ }
+
+.fileinput .thumbnail {
+ display: inline-block;
+ margin-bottom: 5px;
+ overflow: hidden;
+ text-align: center;
+ vertical-align: middle;
+ }
+
+.fileinput .thumbnail > img {
+ max-height: 100%;
+ }
+
+.fileinput .btn {
+ vertical-align: middle;
+ }
+
+.fileinput-exists .fileinput-new,
+.fileinput-new .fileinput-exists {
+ display: none;
+ }
+
+.fileinput-inline .fileinput-controls {
+ display: inline;
+ }
+
+.thumbnail-borderless .thumbnail {
+ padding: 0;
+ border: none;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ }
+
+.fileinput-new .input-group .btn-file {
+ border-radius: 0 4px 4px 0;
+ }
+
+.fileinput-new .input-group .btn-file.btn-xs,
+.fileinput-new .input-group .btn-file.btn-sm {
+ border-radius: 0 3px 3px 0;
+ }
+
+.fileinput-new .input-group .btn-file.btn-lg {
+ border-radius: 0 6px 6px 0;
+ }
+
+.form-group.has-warning .fileinput .uneditable-input {
+ color: #c09853;
+ border-color: #fbeed5;
+}
+
+.form-group.has-warning .fileinput .fileupload-preview {
+ color: #c09853;
+}
+
+.form-group.has-warning .fileinput .thumbnail {
+ border-color: #fbeed5;
+}
+
+.form-group.has-error .fileinput .uneditable-input {
+ color: #b94a48;
+ border-color: #eed3d7;
+}
+
+.form-group.has-error .fileinput .fileupload-preview {
+ color: #b94a48;
+}
+
+.form-group.has-error .fileinput .thumbnail {
+ border-color: #eed3d7;
+}
+
+.form-group.has-success .fileinput .uneditable-input {
+ color: #468847;
+ border-color: #d6e9c6;
+}
+
+.form-group.has-success .fileinput .fileupload-preview {
+ color: #468847;
+}
+
+.form-group.has-success .fileinput .thumbnail {
+ border-color: #d6e9c6;
+}
+
+.input-group-addon:not(:first-child) {
+ border-left: 0;
+ }
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/res/jasny.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/res/jasny.js
new file mode 100644
index 0000000000..26efa0757b
--- /dev/null
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/bootstrap/jasny/res/jasny.js
@@ -0,0 +1,623 @@
+/* ============================================================
+ * Bootstrap: rowlink.js v3.0.0-p7
+ * http://jasny.github.io/bootstrap/javascript.html#rowlink
+ * ============================================================
+ * Copyright 2012 Jasny BV, Netherlands.
+ *
+ * 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.
+ * ============================================================ */
+
++function ($) { "use strict";
+
+ var Rowlink = function (element, options) {
+ this.$element = $(element)
+ this.options = $.extend({}, Rowlink.DEFAULTS, options)
+
+ this.$element.on('click.bs.rowlink', 'td:not(.rowlink-skip)', $.proxy(this.click, this))
+ }
+
+ Rowlink.DEFAULTS = {
+ target: "a"
+ }
+
+ Rowlink.prototype.click = function(e) {
+ var target = $(e.currentTarget).closest('tr').find(this.options.target)[0]
+ if ($(e.target)[0] === target) return
+
+ e.preventDefault();
+
+ if (target.click) {
+ target.click()
+ } else if(document.createEvent) {
+ var evt = document.createEvent("MouseEvents");
+ evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+ target.dispatchEvent(evt);
+ }
+ }
+
+
+ // ROWLINK PLUGIN DEFINITION
+ // ===========================
+
+ $.fn.rowlink = function (options) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('rowlink')
+ if (!data) $this.data('rowlink', (data = new Rowlink(this, options)))
+ })
+ }
+
+ $.fn.rowlink.Constructor = Rowlink
+
+
+ // ROWLINK NO CONFLICT
+ // ====================
+
+ $.fn.rowlink.noConflict = function () {
+ $.fn.inputmask = old
+ return this
+ }
+
+
+ // ROWLINK DATA-API
+ // ==================
+
+ $(document).on('click.bs.rowlink.data-api', '[data-link="row"]', function (e) {
+ var $this = $(this)
+ if ($this.data('rowlink')) return
+ $this.rowlink($this.data())
+ $(e.target).trigger('click.bs.rowlink')
+ })
+
+}(window.jQuery);
+
+/* ===========================================================
+ * Bootstrap: inputmask.js v3.0.0-p7
+ * http://jasny.github.io/bootstrap/javascript.html#inputmask
+ * Based on Masked Input plugin by Josh Bush (digitalbush.com)
+ * ===========================================================
+ * Copyright 2012 Jasny BV, Netherlands.
+ *
+ * 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.
+ * ========================================================== */
+
++function ($) { "use strict";
+
+ var isIphone = (window.orientation !== undefined)
+ var isAndroid = navigator.userAgent.toLowerCase().indexOf("android") > -1
+ var isIE = window.navigator.appName == 'Microsoft Internet Explorer'
+
+ // INPUTMASK PUBLIC CLASS DEFINITION
+ // =================================
+
+ var Inputmask = function (element, options) {
+ if (isAndroid) return // No support because caret positioning doesn't work on Android
+
+ this.$element = $(element)
+ this.options = $.extend({}, Inputmask.DEFAULS, options)
+ this.mask = String(this.options.mask)
+
+ this.init()
+ this.listen()
+
+ this.checkVal() //Perform initial check for existing values
+ }
+
+ Inputmask.DEFAULS = {
+ mask: "",
+ placeholder: "_",
+ definitions: {
+ '9': "[0-9]",
+ 'a': "[A-Za-z]",
+ '?': "[A-Za-z0-9]",
+ '*': "."
+ }
+ }
+
+ Inputmask.prototype.init = function() {
+ var defs = this.options.definitions
+ var len = this.mask.length
+
+ this.tests = []
+ this.partialPosition = this.mask.length
+ this.firstNonMaskPos = null
+
+ $.each(this.mask.split(""), $.proxy(function(i, c) {
+ if (c == '?') {
+ len--
+ this.partialPosition = i
+ } else if (defs[c]) {
+ this.tests.push(new RegExp(defs[c]))
+ if(this.firstNonMaskPos === null)
+ this.firstNonMaskPos = this.tests.length - 1
+ } else {
+ this.tests.push(null)
+ }
+ }, this))
+
+ this.buffer = $.map(this.mask.split(""), $.proxy(function(c, i) {
+ if (c != '?') return defs[c] ? this.options.placeholder : c
+ }, this))
+
+ this.focusText = this.$element.val()
+
+ this.$element.data("rawMaskFn", $.proxy(function() {
+ return $.map(this.buffer, function(c, i) {
+ return this.tests[i] && c != this.options.placeholder ? c : null
+ }).join('')
+ }, this))
+ }
+
+ Inputmask.prototype.listen = function() {
+ if (this.$element.attr("readonly")) return
+
+ var pasteEventName = (isIE ? 'paste' : 'input') + ".mask"
+
+ this.$element
+ .on("unmask.bs.inputmask", $.proxy(this.unmask, this))
+
+ .on("focus.bs.inputmask", $.proxy(this.focusEvent, this))
+ .on("blur.bs.inputmask", $.proxy(this.blurEvent, this))
+
+ .on("keydown.bs.inputmask", $.proxy(this.keydownEvent, this))
+ .on("keypress.bs.inputmask", $.proxy(this.keypressEvent, this))
+
+ .on(pasteEventName, $.proxy(this.pasteEvent, this))
+ }
+
+ //Helper Function for Caret positioning
+ Inputmask.prototype.caret = function(begin, end) {
+ if (this.$element.length === 0) return
+ if (typeof begin == 'number') {
+ end = (typeof end == 'number') ? end : begin
+ return this.$element.each(function() {
+ if (this.setSelectionRange) {
+ this.setSelectionRange(begin, end)
+ } else if (this.createTextRange) {
+ var range = this.createTextRange()
+ range.collapse(true)
+ range.moveEnd('character', end)
+ range.moveStart('character', begin)
+ range.select()
+ }
+ })
+ } else {
+ if (this.$element[0].setSelectionRange) {
+ begin = this.$element[0].selectionStart
+ end = this.$element[0].selectionEnd
+ } else if (document.selection && document.selection.createRange) {
+ var range = document.selection.createRange()
+ begin = 0 - range.duplicate().moveStart('character', -100000)
+ end = begin + range.text.length
+ }
+ return {
+ begin: begin,
+ end: end
+ }
+ }
+ }
+
+ Inputmask.prototype.seekNext = function(pos) {
+ var len = this.mask.length
+ while (++pos <= len && !this.tests[pos]);
+
+ return pos
+ }
+
+ Inputmask.prototype.seekPrev = function(pos) {
+ while (--pos >= 0 && !this.tests[pos]);
+
+ return pos
+ }
+
+ Inputmask.prototype.shiftL = function(begin,end) {
+ var len = this.mask.length
+
+ if(begin<0) return
+
+ for (var i = begin,j = this.seekNext(end); i < len; i++) {
+ if (this.tests[i]) {
+ if (j < len && this.tests[i].test(this.buffer[j])) {
+ this.buffer[i] = this.buffer[j]
+ this.buffer[j] = this.options.placeholder
+ } else
+ break
+ j = this.seekNext(j)
+ }
+ }
+ this.writeBuffer()
+ this.caret(Math.max(this.firstNonMaskPos, begin))
+ }
+
+ Inputmask.prototype.shiftR = function(pos) {
+ var len = this.mask.length
+
+ for (var i = pos, c = this.options.placeholder; i < len; i++) {
+ if (this.tests[i]) {
+ var j = this.seekNext(i)
+ var t = this.buffer[i]
+ this.buffer[i] = c
+ if (j < len && this.tests[j].test(t))
+ c = t
+ else
+ break
+ }
+ }
+ },
+
+ Inputmask.prototype.unmask = function() {
+ this.$element
+ .unbind(".mask")
+ .removeData("inputmask")
+ }
+
+ Inputmask.prototype.focusEvent = function() {
+ this.focusText = this.$element.val()
+ var len = this.mask.length
+ var pos = this.checkVal()
+ this.writeBuffer()
+
+ var that = this
+ var moveCaret = function() {
+ if (pos == len)
+ that.caret(0, pos)
+ else
+ that.caret(pos)
+ }
+
+ moveCaret()
+ setTimeout(moveCaret, 50)
+ }
+
+ Inputmask.prototype.blurEvent = function() {
+ this.checkVal()
+ if (this.$element.val() !== this.focusText)
+ this.$element.trigger('change')
+ }
+
+ Inputmask.prototype.keydownEvent = function(e) {
+ var k=e.which
+
+ //backspace, delete, and escape get special treatment
+ if (k == 8 || k == 46 || (isIphone && k == 127)) {
+ var pos = this.caret(),
+ begin = pos.begin,
+ end = pos.end
+
+ if (end-begin === 0) {
+ begin = k!=46 ? this.seekPrev(begin) : (end=this.seekNext(begin-1))
+ end = k==46 ? this.seekNext(end) : end
+ }
+ this.clearBuffer(begin, end)
+ this.shiftL(begin,end-1)
+
+ return false
+ } else if (k == 27) {//escape
+ this.$element.val(this.focusText)
+ this.caret(0, this.checkVal())
+ return false
+ }
+ }
+
+ Inputmask.prototype.keypressEvent = function(e) {
+ var len = this.mask.length
+
+ var k = e.which,
+ pos = this.caret()
+
+ if (e.ctrlKey || e.altKey || e.metaKey || k<32) {//Ignore
+ return true
+ } else if (k) {
+ if (pos.end - pos.begin !== 0) {
+ this.clearBuffer(pos.begin, pos.end)
+ this.shiftL(pos.begin, pos.end-1)
+ }
+
+ var p = this.seekNext(pos.begin - 1)
+ if (p < len) {
+ var c = String.fromCharCode(k)
+ if (this.tests[p].test(c)) {
+ this.shiftR(p)
+ this.buffer[p] = c
+ this.writeBuffer()
+ var next = this.seekNext(p)
+ this.caret(next)
+ }
+ }
+ return false
+ }
+ }
+
+ Inputmask.prototype.pasteEvent = function() {
+ var that = this
+
+ setTimeout(function() {
+ that.caret(that.checkVal(true))
+ }, 0)
+ }
+
+ Inputmask.prototype.clearBuffer = function(start, end) {
+ var len = this.mask.length
+
+ for (var i = start; i < end && i < len; i++) {
+ if (this.tests[i])
+ this.buffer[i] = this.options.placeholder
+ }
+ }
+
+ Inputmask.prototype.writeBuffer = function() {
+ return this.$element.val(this.buffer.join('')).val()
+ }
+
+ Inputmask.prototype.checkVal = function(allow) {
+ var len = this.mask.length
+ //try to place characters where they belong
+ var test = this.$element.val()
+ var lastMatch = -1
+
+ for (var i = 0, pos = 0; i < len; i++) {
+ if (this.tests[i]) {
+ this.buffer[i] = this.options.placeholder
+ while (pos++ < test.length) {
+ var c = test.charAt(pos - 1)
+ if (this.tests[i].test(c)) {
+ this.buffer[i] = c
+ lastMatch = i
+ break
+ }
+ }
+ if (pos > test.length)
+ break
+ } else if (this.buffer[i] == test.charAt(pos) && i != this.partialPosition) {
+ pos++
+ lastMatch = i
+ }
+ }
+ if (!allow && lastMatch + 1 < this.partialPosition) {
+ this.$element.val("")
+ this.clearBuffer(0, len)
+ } else if (allow || lastMatch + 1 >= this.partialPosition) {
+ this.writeBuffer()
+ if (!allow) this.$element.val(this.$element.val().substring(0, lastMatch + 1))
+ }
+ return (this.partialPosition ? i : this.firstNonMaskPos)
+ }
+
+
+ // INPUTMASK PLUGIN DEFINITION
+ // ===========================
+
+ var old = $.fn.inputmask
+
+ $.fn.inputmask = function (options) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('inputmask')
+
+ if (!data) $this.data('inputmask', (data = new Inputmask(this, options)))
+ })
+ }
+
+ $.fn.inputmask.Constructor = Inputmask
+
+
+ // INPUTMASK NO CONFLICT
+ // ====================
+
+ $.fn.inputmask.noConflict = function () {
+ $.fn.inputmask = old
+ return this
+ }
+
+
+ // INPUTMASK DATA-API
+ // ==================
+
+ $(document).on('focus.bs.inputmask.data-api', '[data-mask]', function (e) {
+ var $this = $(this)
+ if ($this.data('inputmask')) return
+ $this.inputmask($this.data())
+ })
+
+}(window.jQuery);
+
+/* ===========================================================
+ * Bootstrap: fileinput.js v3.0.0-p7
+ * http://jasny.github.com/bootstrap/javascript.html#fileinput
+ * ===========================================================
+ * Copyright 2012 Jasny BV, Netherlands.
+ *
+ * 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.
+ * ========================================================== */
+
++function ($) { "use strict";
+
+ var isIE = window.navigator.appName == 'Microsoft Internet Explorer'
+
+ // FILEUPLOAD PUBLIC CLASS DEFINITION
+ // =================================
+
+ var Fileupload = function (element, options) {
+ this.$element = $(element)
+
+ this.$input = this.$element.find(':file')
+ if (this.$input.length === 0) return
+
+ this.name = this.$input.attr('name') || options.name
+
+ this.$hidden = this.$element.find('input[type=hidden][name="'+this.name+'"]')
+ if (this.$hidden.length === 0) {
+ this.$hidden = $('<input type="hidden" />')
+ this.$element.prepend(this.$hidden)
+ }
+
+ this.$preview = this.$element.find('.fileinput-preview')
+ var height = this.$preview.css('height')
+ if (this.$preview.css('display') != 'inline' && height != '0px' && height != 'none') this.$preview.css('line-height', height)
+
+ this.original = {
+ exists: this.$element.hasClass('fileinput-exists'),
+ preview: this.$preview.html(),
+ hiddenVal: this.$hidden.val()
+ }
+
+ this.listen()
+ }
+
+ Fileupload.prototype.listen = function() {
+ this.$input.on('change.bs.fileinput', $.proxy(this.change, this))
+ $(this.$input[0].form).on('reset.bs.fileinput', $.proxy(this.reset, this))
+
+ this.$element.find('[data-trigger="fileinput"]').on('click.bs.fileinput', $.proxy(this.trigger, this))
+ this.$element.find('[data-dismiss="fileinput"]').on('click.bs.fileinput', $.proxy(this.clear, this))
+ },
+
+ Fileupload.prototype.change = function(e) {
+ if (e.target.files === undefined) e.target.files = e.target && e.target.value ? [ {name: e.target.value.replace(/^.+\\/, '')} ] : []
+ if (e.target.files.length === 0) return
+
+ this.$hidden.val('')
+ this.$hidden.attr('name', '')
+ this.$input.attr('name', this.name)
+
+ var file = e.target.files[0]
+
+ if (this.$preview.length > 0 && (typeof file.type !== "undefined" ? file.type.match('image.*') : file.name.match(/\.(gif|png|jpe?g)$/i)) && typeof FileReader !== "undefined") {
+ var reader = new FileReader()
+ var preview = this.$preview
+ var element = this.$element
+
+ reader.onload = function(re) {
+ var $img = $('<img>') // .attr('src', re.target.result)
+ $img[0].src = re.target.result
+ e.target.files[0].result = re.target.result
+
+ element.find('.fileinput-filename').text(file.name)
+
+ // if parent has max-height, using `(max-)height: 100%` on child doesn't take padding and border into account
+ if (preview.css('max-height') != 'none') $img.css('max-height', parseInt(preview.css('max-height'), 10) - parseInt(preview.css('padding-top'), 10) - parseInt(preview.css('padding-bottom'), 10) - parseInt(preview.css('border-top'), 10) - parseInt(preview.css('border-bottom'), 10))
+
+ preview.html($img)
+ element.addClass('fileinput-exists').removeClass('fileinput-new')
+
+ element.trigger('change.bs.fileinput', e.target.files)
+ }
+
+ reader.readAsDataURL(file)
+ } else {
+ this.$element.find('.fileinput-filename').text(file.name)
+ this.$preview.text(file.name)
+
+ this.$element.addClass('fileinput-exists').removeClass('fileinput-new')
+
+ this.$element.trigger('change.bs.fileinput')
+ }
+ },
+
+ Fileupload.prototype.clear = function(e) {
+ if (e) e.preventDefault()
+
+ this.$hidden.val('')
+ this.$hidden.attr('name', this.name)
+ this.$input.attr('name', '')
+
+ //ie8+ doesn't support changing the value of input with type=file so clone instead
+ if (isIE) {
+ var inputClone = this.$input.clone(true);
+ this.$input.after(inputClone);
+ this.$input.remove();
+ this.$input = inputClone;
+ } else {
+ this.$input.val('')
+ }
+
+ this.$preview.html('')
+ this.$element.find('.fileinput-filename').text('')
+ this.$element.addClass('fileinput-new').removeClass('fileinput-exists')
+
+ if (e !== false) {
+ this.$input.trigger('change')
+ this.$element.trigger('clear.bs.fileinput')
+ }
+ },
+
+ Fileupload.prototype.reset = function() {
+ this.clear(false)
+
+ this.$hidden.val(this.original.hiddenVal)
+ this.$preview.html(this.original.preview)
+ this.$element.find('.fileinput-filename').text('')
+
+ if (this.original.exists) this.$element.addClass('fileinput-exists').removeClass('fileinput-new')
+ else this.$element.addClass('fileinput-new').removeClass('fileinput-exists')
+
+ this.$element.trigger('reset.bs.fileinput')
+ },
+
+ Fileupload.prototype.trigger = function(e) {
+ this.$input.trigger('click')
+ e.preventDefault()
+ }
+
+
+ // FILEUPLOAD PLUGIN DEFINITION
+ // ===========================
+
+ $.fn.fileinput = function (options) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('fileinput')
+ if (!data) $this.data('fileinput', (data = new Fileupload(this, options)))
+ if (typeof options == 'string') data[options]()
+ })
+ }
+
+ $.fn.fileinput.Constructor = Fileupload
+
+
+ // FILEUPLOAD DATA-API
+ // ==================
+
+ $(document).on('click.fileinput.data-api', '[data-provides="fileinput"]', function (e) {
+ var $this = $(this)
+ if ($this.data('fileinput')) return
+ $this.fileinput($this.data())
+
+ var $target = $(e.target).closest('[data-dismiss="fileinput"],[data-trigger="fileinput"]');
+ if ($target.length > 0) {
+ e.preventDefault()
+ $target.trigger('click.bs.fileinput')
+ }
+ })
+
+}(window.jQuery);
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/dropzone/DropZoneBehavior.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/dropzone/DropZoneBehavior.java
deleted file mode 100644
index e575532851..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/dropzone/DropZoneBehavior.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.pmease.gitop.web.common.wicket.component.dropzone;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-
-@SuppressWarnings("serial")
-public class DropZoneBehavior extends Behavior {
-
- @Override
- public void renderHead(Component component, IHeaderResponse response) {
- super.renderHead(component, response);
- response.render(JavaScriptHeaderItem.forReference(DropZoneResourceReference.get()));
- }
-}
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/dropzone/DropZoneResourceReference.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/dropzone/DropZoneResourceReference.java
deleted file mode 100644
index 1b74324b7c..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/dropzone/DropZoneResourceReference.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.pmease.gitop.web.common.wicket.component.dropzone;
-
-import org.apache.wicket.request.resource.JavaScriptResourceReference;
-
-public class DropZoneResourceReference extends JavaScriptResourceReference {
-
- private static final long serialVersionUID = 1L;
-
- public DropZoneResourceReference() {
- super(DropZoneResourceReference.class, "dropzone.js");
- }
-
- private static final DropZoneResourceReference instance =
- new DropZoneResourceReference();
-
- public static DropZoneResourceReference get() {
- return instance;
- }
-}
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/dropzone/dropzone.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/dropzone/dropzone.js
deleted file mode 100644
index e670cccf20..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/dropzone/dropzone.js
+++ /dev/null
@@ -1,1758 +0,0 @@
-;(function(){
-
-/**
- * Require the given path.
- *
- * @param {String} path
- * @return {Object} exports
- * @api public
- */
-
-function require(path, parent, orig) {
- var resolved = require.resolve(path);
-
- // lookup failed
- if (null == resolved) {
- orig = orig || path;
- parent = parent || 'root';
- var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
- err.path = orig;
- err.parent = parent;
- err.require = true;
- throw err;
- }
-
- var module = require.modules[resolved];
-
- // perform real require()
- // by invoking the module's
- // registered function
- if (!module.exports) {
- module.exports = {};
- module.client = module.component = true;
- module.call(this, module.exports, require.relative(resolved), module);
- }
-
- return module.exports;
-}
-
-/**
- * Registered modules.
- */
-
-require.modules = {};
-
-/**
- * Registered aliases.
- */
-
-require.aliases = {};
-
-/**
- * Resolve `path`.
- *
- * Lookup:
- *
- * - PATH/index.js
- * - PATH.js
- * - PATH
- *
- * @param {String} path
- * @return {String} path or null
- * @api private
- */
-
-require.resolve = function(path) {
- if (path.charAt(0) === '/') path = path.slice(1);
-
- var paths = [
- path,
- path + '.js',
- path + '.json',
- path + '/index.js',
- path + '/index.json'
- ];
-
- for (var i = 0; i < paths.length; i++) {
- var path = paths[i];
- if (require.modules.hasOwnProperty(path)) return path;
- if (require.aliases.hasOwnProperty(path)) return require.aliases[path];
- }
-};
-
-/**
- * Normalize `path` relative to the current path.
- *
- * @param {String} curr
- * @param {String} path
- * @return {String}
- * @api private
- */
-
-require.normalize = function(curr, path) {
- var segs = [];
-
- if ('.' != path.charAt(0)) return path;
-
- curr = curr.split('/');
- path = path.split('/');
-
- for (var i = 0; i < path.length; ++i) {
- if ('..' == path[i]) {
- curr.pop();
- } else if ('.' != path[i] && '' != path[i]) {
- segs.push(path[i]);
- }
- }
-
- return curr.concat(segs).join('/');
-};
-
-/**
- * Register module at `path` with callback `definition`.
- *
- * @param {String} path
- * @param {Function} definition
- * @api private
- */
-
-require.register = function(path, definition) {
- require.modules[path] = definition;
-};
-
-/**
- * Alias a module definition.
- *
- * @param {String} from
- * @param {String} to
- * @api private
- */
-
-require.alias = function(from, to) {
- if (!require.modules.hasOwnProperty(from)) {
- throw new Error('Failed to alias "' + from + '", it does not exist');
- }
- require.aliases[to] = from;
-};
-
-/**
- * Return a require function relative to the `parent` path.
- *
- * @param {String} parent
- * @return {Function}
- * @api private
- */
-
-require.relative = function(parent) {
- var p = require.normalize(parent, '..');
-
- /**
- * lastIndexOf helper.
- */
-
- function lastIndexOf(arr, obj) {
- var i = arr.length;
- while (i--) {
- if (arr[i] === obj) return i;
- }
- return -1;
- }
-
- /**
- * The relative require() itself.
- */
-
- function localRequire(path) {
- var resolved = localRequire.resolve(path);
- return require(resolved, parent, path);
- }
-
- /**
- * Resolve relative to the parent.
- */
-
- localRequire.resolve = function(path) {
- var c = path.charAt(0);
- if ('/' == c) return path.slice(1);
- if ('.' == c) return require.normalize(p, path);
-
- // resolve deps by returning
- // the dep in the nearest "deps"
- // directory
- var segs = parent.split('/');
- var i = lastIndexOf(segs, 'deps') + 1;
- if (!i) i = 0;
- path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
- return path;
- };
-
- /**
- * Check if module is defined at `path`.
- */
-
- localRequire.exists = function(path) {
- return require.modules.hasOwnProperty(localRequire.resolve(path));
- };
-
- return localRequire;
-};
-require.register("component-emitter/index.js", function(exports, require, module){
-
-/**
- * Expose `Emitter`.
- */
-
-module.exports = Emitter;
-
-/**
- * Initialize a new `Emitter`.
- *
- * @api public
- */
-
-function Emitter(obj) {
- if (obj) return mixin(obj);
-};
-
-/**
- * Mixin the emitter properties.
- *
- * @param {Object} obj
- * @return {Object}
- * @api private
- */
-
-function mixin(obj) {
- for (var key in Emitter.prototype) {
- obj[key] = Emitter.prototype[key];
- }
- return obj;
-}
-
-/**
- * Listen on the given `event` with `fn`.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
-
-Emitter.prototype.on = function(event, fn){
- this._callbacks = this._callbacks || {};
- (this._callbacks[event] = this._callbacks[event] || [])
- .push(fn);
- return this;
-};
-
-/**
- * Adds an `event` listener that will be invoked a single
- * time then automatically removed.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
-
-Emitter.prototype.once = function(event, fn){
- var self = this;
- this._callbacks = this._callbacks || {};
-
- function on() {
- self.off(event, on);
- fn.apply(this, arguments);
- }
-
- fn._off = on;
- this.on(event, on);
- return this;
-};
-
-/**
- * Remove the given callback for `event` or all
- * registered callbacks.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
-
-Emitter.prototype.off =
-Emitter.prototype.removeListener =
-Emitter.prototype.removeAllListeners = function(event, fn){
- this._callbacks = this._callbacks || {};
- var callbacks = this._callbacks[event];
- if (!callbacks) return this;
-
- // remove all handlers
- if (1 == arguments.length) {
- delete this._callbacks[event];
- return this;
- }
-
- // remove specific handler
- var i = callbacks.indexOf(fn._off || fn);
- if (~i) callbacks.splice(i, 1);
- return this;
-};
-
-/**
- * Emit `event` with the given args.
- *
- * @param {String} event
- * @param {Mixed} ...
- * @return {Emitter}
- */
-
-Emitter.prototype.emit = function(event){
- this._callbacks = this._callbacks || {};
- var args = [].slice.call(arguments, 1)
- , callbacks = this._callbacks[event];
-
- if (callbacks) {
- callbacks = callbacks.slice(0);
- for (var i = 0, len = callbacks.length; i < len; ++i) {
- callbacks[i].apply(this, args);
- }
- }
-
- return this;
-};
-
-/**
- * Return array of callbacks for `event`.
- *
- * @param {String} event
- * @return {Array}
- * @api public
- */
-
-Emitter.prototype.listeners = function(event){
- this._callbacks = this._callbacks || {};
- return this._callbacks[event] || [];
-};
-
-/**
- * Check if this emitter has `event` handlers.
- *
- * @param {String} event
- * @return {Boolean}
- * @api public
- */
-
-Emitter.prototype.hasListeners = function(event){
- return !! this.listeners(event).length;
-};
-
-});
-require.register("dropzone/index.js", function(exports, require, module){
-
-
-/**
- * Exposing dropzone
- */
-module.exports = require("./lib/dropzone.js");
-
-});
-require.register("dropzone/lib/dropzone.js", function(exports, require, module){
-/*
-#
-# More info at [www.dropzonejs.com](http://www.dropzonejs.com)
-#
-# Copyright (c) 2012, Matias Meno
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-*/
-
-
-(function() {
- var Dropzone, Em, camelize, contentLoaded, noop, without,
- __hasProp = {}.hasOwnProperty,
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
- __slice = [].slice;
-
- Em = typeof Emitter !== "undefined" && Emitter !== null ? Emitter : require("emitter");
-
- noop = function() {};
-
- Dropzone = (function(_super) {
- var extend;
-
- __extends(Dropzone, _super);
-
- /*
- This is a list of all available events you can register on a dropzone object.
-
- You can register an event handler like this:
-
- dropzone.on("dragEnter", function() { });
- */
-
-
- Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "selectedfiles", "addedfile", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded"];
-
- Dropzone.prototype.defaultOptions = {
- url: null,
- method: "post",
- withCredentials: false,
- parallelUploads: 2,
- uploadMultiple: false,
- maxFilesize: 256,
- paramName: "file",
- createImageThumbnails: true,
- maxThumbnailFilesize: 10,
- thumbnailWidth: 100,
- thumbnailHeight: 100,
- maxFiles: null,
- params: {},
- clickable: true,
- ignoreHiddenFiles: true,
- acceptedFiles: null,
- acceptedMimeTypes: null,
- autoProcessQueue: true,
- addRemoveLinks: false,
- previewsContainer: null,
- dictDefaultMessage: "Drop files here to upload",
- dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
- dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
- dictFileTooBig: "File is too big ({{filesize}}MB). Max filesize: {{maxFilesize}}MB.",
- dictInvalidFileType: "You can't upload files of this type.",
- dictResponseError: "Server responded with {{statusCode}} code.",
- dictCancelUpload: "Cancel upload",
- dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?",
- dictRemoveFile: "Remove file",
- dictRemoveFileConfirmation: null,
- dictMaxFilesExceeded: "You can only upload {{maxFiles}} files.",
- accept: function(file, done) {
- return done();
- },
- init: function() {
- return noop;
- },
- forceFallback: false,
- fallback: function() {
- var child, messageElement, span, _i, _len, _ref;
- this.element.className = "" + this.element.className + " dz-browser-not-supported";
- _ref = this.element.getElementsByTagName("div");
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- child = _ref[_i];
- if (/(^| )dz-message($| )/.test(child.className)) {
- messageElement = child;
- child.className = "dz-message";
- continue;
- }
- }
- if (!messageElement) {
- messageElement = Dropzone.createElement("<div class=\"dz-message\"><span></span></div>");
- this.element.appendChild(messageElement);
- }
- span = messageElement.getElementsByTagName("span")[0];
- if (span) {
- span.textContent = this.options.dictFallbackMessage;
- }
- return this.element.appendChild(this.getFallbackForm());
- },
- resize: function(file) {
- var info, srcRatio, trgRatio;
- info = {
- srcX: 0,
- srcY: 0,
- srcWidth: file.width,
- srcHeight: file.height
- };
- srcRatio = file.width / file.height;
- trgRatio = this.options.thumbnailWidth / this.options.thumbnailHeight;
- if (file.height < this.options.thumbnailHeight || file.width < this.options.thumbnailWidth) {
- info.trgHeight = info.srcHeight;
- info.trgWidth = info.srcWidth;
- } else {
- if (srcRatio > trgRatio) {
- info.srcHeight = file.height;
- info.srcWidth = info.srcHeight * trgRatio;
- } else {
- info.srcWidth = file.width;
- info.srcHeight = info.srcWidth / trgRatio;
- }
- }
- info.srcX = (file.width - info.srcWidth) / 2;
- info.srcY = (file.height - info.srcHeight) / 2;
- return info;
- },
- /*
- Those functions register themselves to the events on init and handle all
- the user interface specific stuff. Overwriting them won't break the upload
- but can break the way it's displayed.
- You can overwrite them if you don't like the default behavior. If you just
- want to add an additional event handler, register it on the dropzone object
- and don't overwrite those options.
- */
-
- drop: function(e) {
- return this.element.classList.remove("dz-drag-hover");
- },
- dragstart: noop,
- dragend: function(e) {
- return this.element.classList.remove("dz-drag-hover");
- },
- dragenter: function(e) {
- return this.element.classList.add("dz-drag-hover");
- },
- dragover: function(e) {
- return this.element.classList.add("dz-drag-hover");
- },
- dragleave: function(e) {
- return this.element.classList.remove("dz-drag-hover");
- },
- selectedfiles: function(files) {
- if (this.element === this.previewsContainer) {
- return this.element.classList.add("dz-started");
- }
- },
- reset: function() {
- return this.element.classList.remove("dz-started");
- },
- addedfile: function(file) {
- var _this = this;
- file.previewElement = Dropzone.createElement(this.options.previewTemplate);
- file.previewTemplate = file.previewElement;
- this.previewsContainer.appendChild(file.previewElement);
- file.previewElement.querySelector("[data-dz-name]").textContent = file.name;
- file.previewElement.querySelector("[data-dz-size]").innerHTML = this.filesize(file.size);
- if (this.options.addRemoveLinks) {
- file._removeLink = Dropzone.createElement("<a class=\"dz-remove\" href=\"javascript:undefined;\">" + this.options.dictRemoveFile + "</a>");
- file._removeLink.addEventListener("click", function(e) {
- e.preventDefault();
- e.stopPropagation();
- if (file.status === Dropzone.UPLOADING) {
- return Dropzone.confirm(_this.options.dictCancelUploadConfirmation, function() {
- return _this.removeFile(file);
- });
- } else {
- if (_this.options.dictRemoveFileConfirmation) {
- return Dropzone.confirm(_this.options.dictRemoveFileConfirmation, function() {
- return _this.removeFile(file);
- });
- } else {
- return _this.removeFile(file);
- }
- }
- });
- file.previewElement.appendChild(file._removeLink);
- }
- return this._updateMaxFilesReachedClass();
- },
- removedfile: function(file) {
- var _ref;
- if ((_ref = file.previewElement) != null) {
- _ref.parentNode.removeChild(file.previewElement);
- }
- return this._updateMaxFilesReachedClass();
- },
- thumbnail: function(file, dataUrl) {
- var thumbnailElement;
- file.previewElement.classList.remove("dz-file-preview");
- file.previewElement.classList.add("dz-image-preview");
- thumbnailElement = file.previewElement.querySelector("[data-dz-thumbnail]");
- thumbnailElement.alt = file.name;
- return thumbnailElement.src = dataUrl;
- },
- error: function(file, message) {
- file.previewElement.classList.add("dz-error");
- return file.previewElement.querySelector("[data-dz-errormessage]").textContent = message;
- },
- errormultiple: noop,
- processing: function(file) {
- file.previewElement.classList.add("dz-processing");
- if (file._removeLink) {
- return file._removeLink.textContent = this.options.dictCancelUpload;
- }
- },
- processingmultiple: noop,
- uploadprogress: function(file, progress, bytesSent) {
- return file.previewElement.querySelector("[data-dz-uploadprogress]").style.width = "" + progress + "%";
- },
- totaluploadprogress: noop,
- sending: noop,
- sendingmultiple: noop,
- success: function(file) {
- return file.previewElement.classList.add("dz-success");
- },
- successmultiple: noop,
- canceled: function(file) {
- return this.emit("error", file, "Upload canceled.");
- },
- canceledmultiple: noop,
- complete: function(file) {
- if (file._removeLink) {
- return file._removeLink.textContent = this.options.dictRemoveFile;
- }
- },
- completemultiple: noop,
- maxfilesexceeded: noop,
- previewTemplate: "<div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-details\">\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n <div class=\"dz-size\" data-dz-size></div>\n <img data-dz-thumbnail />\n </div>\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n <div class=\"dz-success-mark\"><span>✔</span></div>\n <div class=\"dz-error-mark\"><span>✘</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>"
- };
-
- extend = function() {
- var key, object, objects, target, val, _i, _len;
- target = arguments[0], objects = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
- for (_i = 0, _len = objects.length; _i < _len; _i++) {
- object = objects[_i];
- for (key in object) {
- val = object[key];
- target[key] = val;
- }
- }
- return target;
- };
-
- function Dropzone(element, options) {
- var elementOptions, fallback, _ref;
- this.element = element;
- this.version = Dropzone.version;
- this.defaultOptions.previewTemplate = this.defaultOptions.previewTemplate.replace(/\n*/g, "");
- this.clickableElements = [];
- this.listeners = [];
- this.files = [];
- if (typeof this.element === "string") {
- this.element = document.querySelector(this.element);
- }
- if (!(this.element && (this.element.nodeType != null))) {
- throw new Error("Invalid dropzone element.");
- }
- if (this.element.dropzone) {
- throw new Error("Dropzone already attached.");
- }
- Dropzone.instances.push(this);
- element.dropzone = this;
- elementOptions = (_ref = Dropzone.optionsForElement(this.element)) != null ? _ref : {};
- this.options = extend({}, this.defaultOptions, elementOptions, options != null ? options : {});
- if (this.options.forceFallback || !Dropzone.isBrowserSupported()) {
- return this.options.fallback.call(this);
- }
- if (this.options.url == null) {
- this.options.url = this.element.getAttribute("action");
- }
- if (!this.options.url) {
- throw new Error("No URL provided.");
- }
- if (this.options.acceptedFiles && this.options.acceptedMimeTypes) {
- throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");
- }
- if (this.options.acceptedMimeTypes) {
- this.options.acceptedFiles = this.options.acceptedMimeTypes;
- delete this.options.acceptedMimeTypes;
- }
- this.options.method = this.options.method.toUpperCase();
- if ((fallback = this.getExistingFallback()) && fallback.parentNode) {
- fallback.parentNode.removeChild(fallback);
- }
- if (this.options.previewsContainer) {
- this.previewsContainer = Dropzone.getElement(this.options.previewsContainer, "previewsContainer");
- } else {
- this.previewsContainer = this.element;
- }
- if (this.options.clickable) {
- if (this.options.clickable === true) {
- this.clickableElements = [this.element];
- } else {
- this.clickableElements = Dropzone.getElements(this.options.clickable, "clickable");
- }
- }
- this.init();
- }
-
- Dropzone.prototype.getAcceptedFiles = function() {
- var file, _i, _len, _ref, _results;
- _ref = this.files;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- file = _ref[_i];
- if (file.accepted) {
- _results.push(file);
- }
- }
- return _results;
- };
-
- Dropzone.prototype.getRejectedFiles = function() {
- var file, _i, _len, _ref, _results;
- _ref = this.files;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- file = _ref[_i];
- if (!file.accepted) {
- _results.push(file);
- }
- }
- return _results;
- };
-
- Dropzone.prototype.getQueuedFiles = function() {
- var file, _i, _len, _ref, _results;
- _ref = this.files;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- file = _ref[_i];
- if (file.status === Dropzone.QUEUED) {
- _results.push(file);
- }
- }
- return _results;
- };
-
- Dropzone.prototype.getUploadingFiles = function() {
- var file, _i, _len, _ref, _results;
- _ref = this.files;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- file = _ref[_i];
- if (file.status === Dropzone.UPLOADING) {
- _results.push(file);
- }
- }
- return _results;
- };
-
- Dropzone.prototype.init = function() {
- var eventName, noPropagation, setupHiddenFileInput, _i, _len, _ref, _ref1,
- _this = this;
- if (this.element.tagName === "form") {
- this.element.setAttribute("enctype", "multipart/form-data");
- }
- if (this.element.classList.contains("dropzone") && !this.element.querySelector(".dz-message")) {
- this.element.appendChild(Dropzone.createElement("<div class=\"dz-default dz-message\"><span>" + this.options.dictDefaultMessage + "</span></div>"));
- }
- if (this.clickableElements.length) {
- setupHiddenFileInput = function() {
- if (_this.hiddenFileInput) {
- document.body.removeChild(_this.hiddenFileInput);
- }
- _this.hiddenFileInput = document.createElement("input");
- _this.hiddenFileInput.setAttribute("type", "file");
- _this.hiddenFileInput.setAttribute("multiple", "multiple");
- if (_this.options.acceptedFiles != null) {
- _this.hiddenFileInput.setAttribute("accept", _this.options.acceptedFiles);
- }
- _this.hiddenFileInput.style.visibility = "hidden";
- _this.hiddenFileInput.style.position = "absolute";
- _this.hiddenFileInput.style.top = "0";
- _this.hiddenFileInput.style.left = "0";
- _this.hiddenFileInput.style.height = "0";
- _this.hiddenFileInput.style.width = "0";
- document.body.appendChild(_this.hiddenFileInput);
- return _this.hiddenFileInput.addEventListener("change", function() {
- var files;
- files = _this.hiddenFileInput.files;
- if (files.length) {
- _this.emit("selectedfiles", files);
- _this.handleFiles(files);
- }
- return setupHiddenFileInput();
- });
- };
- setupHiddenFileInput();
- }
- this.URL = (_ref = window.URL) != null ? _ref : window.webkitURL;
- _ref1 = this.events;
- for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
- eventName = _ref1[_i];
- this.on(eventName, this.options[eventName]);
- }
- this.on("uploadprogress", function() {
- return _this.updateTotalUploadProgress();
- });
- this.on("removedfile", function() {
- return _this.updateTotalUploadProgress();
- });
- this.on("canceled", function(file) {
- return _this.emit("complete", file);
- });
- noPropagation = function(e) {
- e.stopPropagation();
- if (e.preventDefault) {
- return e.preventDefault();
- } else {
- return e.returnValue = false;
- }
- };
- this.listeners = [
- {
- element: this.element,
- events: {
- "dragstart": function(e) {
- return _this.emit("dragstart", e);
- },
- "dragenter": function(e) {
- noPropagation(e);
- return _this.emit("dragenter", e);
- },
- "dragover": function(e) {
- noPropagation(e);
- return _this.emit("dragover", e);
- },
- "dragleave": function(e) {
- return _this.emit("dragleave", e);
- },
- "drop": function(e) {
- noPropagation(e);
- return _this.drop(e);
- },
- "dragend": function(e) {
- return _this.emit("dragend", e);
- }
- }
- }
- ];
- this.clickableElements.forEach(function(clickableElement) {
- return _this.listeners.push({
- element: clickableElement,
- events: {
- "click": function(evt) {
- if ((clickableElement !== _this.element) || (evt.target === _this.element || Dropzone.elementInside(evt.target, _this.element.querySelector(".dz-message")))) {
- return _this.hiddenFileInput.click();
- }
- }
- }
- });
- });
- this.enable();
- return this.options.init.call(this);
- };
-
- Dropzone.prototype.destroy = function() {
- var _ref;
- this.disable();
- this.removeAllFiles(true);
- if ((_ref = this.hiddenFileInput) != null ? _ref.parentNode : void 0) {
- this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);
- this.hiddenFileInput = null;
- }
- return delete this.element.dropzone;
- };
-
- Dropzone.prototype.updateTotalUploadProgress = function() {
- var acceptedFiles, file, totalBytes, totalBytesSent, totalUploadProgress, _i, _len, _ref;
- totalBytesSent = 0;
- totalBytes = 0;
- acceptedFiles = this.getAcceptedFiles();
- if (acceptedFiles.length) {
- _ref = this.getAcceptedFiles();
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- file = _ref[_i];
- totalBytesSent += file.upload.bytesSent;
- totalBytes += file.upload.total;
- }
- totalUploadProgress = 100 * totalBytesSent / totalBytes;
- } else {
- totalUploadProgress = 100;
- }
- return this.emit("totaluploadprogress", totalUploadProgress, totalBytes, totalBytesSent);
- };
-
- Dropzone.prototype.getFallbackForm = function() {
- var existingFallback, fields, fieldsString, form;
- if (existingFallback = this.getExistingFallback()) {
- return existingFallback;
- }
- fieldsString = "<div class=\"dz-fallback\">";
- if (this.options.dictFallbackText) {
- fieldsString += "<p>" + this.options.dictFallbackText + "</p>";
- }
- fieldsString += "<input type=\"file\" name=\"" + this.options.paramName + (this.options.uploadMultiple ? "[]" : "") + "\" " + (this.options.uploadMultiple ? 'multiple="multiple"' : void 0) + " /><button type=\"submit\">Upload!</button></div>";
- fields = Dropzone.createElement(fieldsString);
- if (this.element.tagName !== "FORM") {
- form = Dropzone.createElement("<form action=\"" + this.options.url + "\" enctype=\"multipart/form-data\" method=\"" + this.options.method + "\"></form>");
- form.appendChild(fields);
- } else {
- this.element.setAttribute("enctype", "multipart/form-data");
- this.element.setAttribute("method", this.options.method);
- }
- return form != null ? form : fields;
- };
-
- Dropzone.prototype.getExistingFallback = function() {
- var fallback, getFallback, tagName, _i, _len, _ref;
- getFallback = function(elements) {
- var el, _i, _len;
- for (_i = 0, _len = elements.length; _i < _len; _i++) {
- el = elements[_i];
- if (/(^| )fallback($| )/.test(el.className)) {
- return el;
- }
- }
- };
- _ref = ["div", "form"];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- tagName = _ref[_i];
- if (fallback = getFallback(this.element.getElementsByTagName(tagName))) {
- return fallback;
- }
- }
- };
-
- Dropzone.prototype.setupEventListeners = function() {
- var elementListeners, event, listener, _i, _len, _ref, _results;
- _ref = this.listeners;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- elementListeners = _ref[_i];
- _results.push((function() {
- var _ref1, _results1;
- _ref1 = elementListeners.events;
- _results1 = [];
- for (event in _ref1) {
- listener = _ref1[event];
- _results1.push(elementListeners.element.addEventListener(event, listener, false));
- }
- return _results1;
- })());
- }
- return _results;
- };
-
- Dropzone.prototype.removeEventListeners = function() {
- var elementListeners, event, listener, _i, _len, _ref, _results;
- _ref = this.listeners;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- elementListeners = _ref[_i];
- _results.push((function() {
- var _ref1, _results1;
- _ref1 = elementListeners.events;
- _results1 = [];
- for (event in _ref1) {
- listener = _ref1[event];
- _results1.push(elementListeners.element.removeEventListener(event, listener, false));
- }
- return _results1;
- })());
- }
- return _results;
- };
-
- Dropzone.prototype.disable = function() {
- var file, _i, _len, _ref, _results;
- this.clickableElements.forEach(function(element) {
- return element.classList.remove("dz-clickable");
- });
- this.removeEventListeners();
- _ref = this.files;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- file = _ref[_i];
- _results.push(this.cancelUpload(file));
- }
- return _results;
- };
-
- Dropzone.prototype.enable = function() {
- this.clickableElements.forEach(function(element) {
- return element.classList.add("dz-clickable");
- });
- return this.setupEventListeners();
- };
-
- Dropzone.prototype.filesize = function(size) {
- var string;
- if (size >= 100000000000) {
- size = size / 100000000000;
- string = "TB";
- } else if (size >= 100000000) {
- size = size / 100000000;
- string = "GB";
- } else if (size >= 100000) {
- size = size / 100000;
- string = "MB";
- } else if (size >= 100) {
- size = size / 100;
- string = "KB";
- } else {
- size = size * 10;
- string = "b";
- }
- return "<strong>" + (Math.round(size) / 10) + "</strong> " + string;
- };
-
- Dropzone.prototype._updateMaxFilesReachedClass = function() {
- if (this.options.maxFiles && this.getAcceptedFiles().length >= this.options.maxFiles) {
- return this.element.classList.add("dz-max-files-reached");
- } else {
- return this.element.classList.remove("dz-max-files-reached");
- }
- };
-
- Dropzone.prototype.drop = function(e) {
- var files, items;
- if (!e.dataTransfer) {
- return;
- }
- this.emit("drop", e);
- files = e.dataTransfer.files;
- this.emit("selectedfiles", files);
- if (files.length) {
- items = e.dataTransfer.items;
- if (items && items.length && ((items[0].webkitGetAsEntry != null) || (items[0].getAsEntry != null))) {
- this.handleItems(items);
- } else {
- this.handleFiles(files);
- }
- }
- };
-
- Dropzone.prototype.handleFiles = function(files) {
- var file, _i, _len, _results;
- _results = [];
- for (_i = 0, _len = files.length; _i < _len; _i++) {
- file = files[_i];
- _results.push(this.addFile(file));
- }
- return _results;
- };
-
- Dropzone.prototype.handleItems = function(items) {
- var entry, item, _i, _len;
- for (_i = 0, _len = items.length; _i < _len; _i++) {
- item = items[_i];
- if (item.webkitGetAsEntry != null) {
- entry = item.webkitGetAsEntry();
- if (entry.isFile) {
- this.addFile(item.getAsFile());
- } else if (entry.isDirectory) {
- this.addDirectory(entry, entry.name);
- }
- } else {
- this.addFile(item.getAsFile());
- }
- }
- };
-
- Dropzone.prototype.accept = function(file, done) {
- if (file.size > this.options.maxFilesize * 1024 * 1024) {
- return done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize));
- } else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) {
- return done(this.options.dictInvalidFileType);
- } else if (this.options.maxFiles && this.getAcceptedFiles().length >= this.options.maxFiles) {
- done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}", this.options.maxFiles));
- return this.emit("maxfilesexceeded", file);
- } else {
- return this.options.accept.call(this, file, done);
- }
- };
-
- Dropzone.prototype.addFile = function(file) {
- var _this = this;
- file.upload = {
- progress: 0,
- total: file.size,
- bytesSent: 0
- };
- this.files.push(file);
- file.status = Dropzone.ADDED;
- this.emit("addedfile", file);
- if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) {
- this.createThumbnail(file);
- }
- return this.accept(file, function(error) {
- if (error) {
- file.accepted = false;
- return _this._errorProcessing([file], error);
- } else {
- return _this.enqueueFile(file);
- }
- });
- };
-
- Dropzone.prototype.enqueueFiles = function(files) {
- var file, _i, _len;
- for (_i = 0, _len = files.length; _i < _len; _i++) {
- file = files[_i];
- this.enqueueFile(file);
- }
- return null;
- };
-
- Dropzone.prototype.enqueueFile = function(file) {
- var _this = this;
- file.accepted = true;
- if (file.status === Dropzone.ADDED) {
- file.status = Dropzone.QUEUED;
- if (this.options.autoProcessQueue) {
- return setTimeout((function() {
- return _this.processQueue();
- }), 1);
- }
- } else {
- throw new Error("This file can't be queued because it has already been processed or was rejected.");
- }
- };
-
- Dropzone.prototype.addDirectory = function(entry, path) {
- var dirReader, entriesReader,
- _this = this;
- dirReader = entry.createReader();
- entriesReader = function(entries) {
- var _i, _len;
- for (_i = 0, _len = entries.length; _i < _len; _i++) {
- entry = entries[_i];
- if (entry.isFile) {
- entry.file(function(file) {
- if (_this.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') {
- return;
- }
- file.fullPath = "" + path + "/" + file.name;
- return _this.addFile(file);
- });
- } else if (entry.isDirectory) {
- _this.addDirectory(entry, "" + path + "/" + entry.name);
- }
- }
- };
- return dirReader.readEntries(entriesReader, function(error) {
- return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0;
- });
- };
-
- Dropzone.prototype.removeFile = function(file) {
- if (file.status === Dropzone.UPLOADING) {
- this.cancelUpload(file);
- }
- this.files = without(this.files, file);
- this.emit("removedfile", file);
- if (this.files.length === 0) {
- return this.emit("reset");
- }
- };
-
- Dropzone.prototype.removeAllFiles = function(cancelIfNecessary) {
- var file, _i, _len, _ref;
- if (cancelIfNecessary == null) {
- cancelIfNecessary = false;
- }
- _ref = this.files.slice();
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- file = _ref[_i];
- if (file.status !== Dropzone.UPLOADING || cancelIfNecessary) {
- this.removeFile(file);
- }
- }
- return null;
- };
-
- Dropzone.prototype.createThumbnail = function(file) {
- var fileReader,
- _this = this;
- fileReader = new FileReader;
- fileReader.onload = function() {
- var img;
- img = new Image;
- img.onload = function() {
- var canvas, ctx, resizeInfo, thumbnail, _ref, _ref1, _ref2, _ref3;
- file.width = img.width;
- file.height = img.height;
- resizeInfo = _this.options.resize.call(_this, file);
- if (resizeInfo.trgWidth == null) {
- resizeInfo.trgWidth = _this.options.thumbnailWidth;
- }
- if (resizeInfo.trgHeight == null) {
- resizeInfo.trgHeight = _this.options.thumbnailHeight;
- }
- canvas = document.createElement("canvas");
- ctx = canvas.getContext("2d");
- canvas.width = resizeInfo.trgWidth;
- canvas.height = resizeInfo.trgHeight;
- ctx.drawImage(img, (_ref = resizeInfo.srcX) != null ? _ref : 0, (_ref1 = resizeInfo.srcY) != null ? _ref1 : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, (_ref2 = resizeInfo.trgX) != null ? _ref2 : 0, (_ref3 = resizeInfo.trgY) != null ? _ref3 : 0, resizeInfo.trgWidth, resizeInfo.trgHeight);
- thumbnail = canvas.toDataURL("image/png");
- return _this.emit("thumbnail", file, thumbnail);
- };
- return img.src = fileReader.result;
- };
- return fileReader.readAsDataURL(file);
- };
-
- Dropzone.prototype.processQueue = function() {
- var i, parallelUploads, processingLength, queuedFiles;
- parallelUploads = this.options.parallelUploads;
- processingLength = this.getUploadingFiles().length;
- i = processingLength;
- if (processingLength >= parallelUploads) {
- return;
- }
- queuedFiles = this.getQueuedFiles();
- if (!(queuedFiles.length > 0)) {
- return;
- }
- if (this.options.uploadMultiple) {
- return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength));
- } else {
- while (i < parallelUploads) {
- if (!queuedFiles.length) {
- return;
- }
- this.processFile(queuedFiles.shift());
- i++;
- }
- }
- };
-
- Dropzone.prototype.processFile = function(file) {
- return this.processFiles([file]);
- };
-
- Dropzone.prototype.processFiles = function(files) {
- var file, _i, _len;
- for (_i = 0, _len = files.length; _i < _len; _i++) {
- file = files[_i];
- file.processing = true;
- file.status = Dropzone.UPLOADING;
- this.emit("processing", file);
- }
- if (this.options.uploadMultiple) {
- this.emit("processingmultiple", files);
- }
- return this.uploadFiles(files);
- };
-
- Dropzone.prototype._getFilesWithXhr = function(xhr) {
- var file, files;
- return files = (function() {
- var _i, _len, _ref, _results;
- _ref = this.files;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- file = _ref[_i];
- if (file.xhr === xhr) {
- _results.push(file);
- }
- }
- return _results;
- }).call(this);
- };
-
- Dropzone.prototype.cancelUpload = function(file) {
- var groupedFile, groupedFiles, _i, _j, _len, _len1, _ref;
- if (file.status === Dropzone.UPLOADING) {
- groupedFiles = this._getFilesWithXhr(file.xhr);
- for (_i = 0, _len = groupedFiles.length; _i < _len; _i++) {
- groupedFile = groupedFiles[_i];
- groupedFile.status = Dropzone.CANCELED;
- }
- file.xhr.abort();
- for (_j = 0, _len1 = groupedFiles.length; _j < _len1; _j++) {
- groupedFile = groupedFiles[_j];
- this.emit("canceled", groupedFile);
- }
- if (this.options.uploadMultiple) {
- this.emit("canceledmultiple", groupedFiles);
- }
- } else if ((_ref = file.status) === Dropzone.ADDED || _ref === Dropzone.QUEUED) {
- file.status = Dropzone.CANCELED;
- this.emit("canceled", file);
- if (this.options.uploadMultiple) {
- this.emit("canceledmultiple", [file]);
- }
- }
- if (this.options.autoProcessQueue) {
- return this.processQueue();
- }
- };
-
- Dropzone.prototype.uploadFile = function(file) {
- return this.uploadFiles([file]);
- };
-
- Dropzone.prototype.uploadFiles = function(files) {
- var file, formData, handleError, headerName, headerValue, headers, input, inputName, inputType, key, progressObj, response, updateProgress, value, xhr, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3,
- _this = this;
- xhr = new XMLHttpRequest();
- for (_i = 0, _len = files.length; _i < _len; _i++) {
- file = files[_i];
- file.xhr = xhr;
- }
- xhr.open(this.options.method, this.options.url, true);
- xhr.withCredentials = !!this.options.withCredentials;
- response = null;
- handleError = function() {
- var _j, _len1, _results;
- _results = [];
- for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
- file = files[_j];
- _results.push(_this._errorProcessing(files, response || _this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr));
- }
- return _results;
- };
- updateProgress = function(e) {
- var allFilesFinished, progress, _j, _k, _l, _len1, _len2, _len3, _results;
- if (e != null) {
- progress = 100 * e.loaded / e.total;
- for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
- file = files[_j];
- file.upload = {
- progress: progress,
- total: e.total,
- bytesSent: e.loaded
- };
- }
- } else {
- allFilesFinished = true;
- progress = 100;
- for (_k = 0, _len2 = files.length; _k < _len2; _k++) {
- file = files[_k];
- if (!(file.upload.progress === 100 && file.upload.bytesSent === file.upload.total)) {
- allFilesFinished = false;
- }
- file.upload.progress = progress;
- file.upload.bytesSent = file.upload.total;
- }
- if (allFilesFinished) {
- return;
- }
- }
- _results = [];
- for (_l = 0, _len3 = files.length; _l < _len3; _l++) {
- file = files[_l];
- _results.push(_this.emit("uploadprogress", file, progress, file.upload.bytesSent));
- }
- return _results;
- };
- xhr.onload = function(e) {
- var _ref;
- if (files[0].status === Dropzone.CANCELED) {
- return;
- }
- if (xhr.readyState !== 4) {
- return;
- }
- response = xhr.responseText;
- if (xhr.getResponseHeader("content-type") && ~xhr.getResponseHeader("content-type").indexOf("application/json")) {
- try {
- response = JSON.parse(response);
- } catch (_error) {
- e = _error;
- response = "Invalid JSON response from server.";
- }
- }
- updateProgress();
- if (!((200 <= (_ref = xhr.status) && _ref < 300))) {
- return handleError();
- } else {
- return _this._finished(files, response, e);
- }
- };
- xhr.onerror = function() {
- if (files[0].status === Dropzone.CANCELED) {
- return;
- }
- return handleError();
- };
- progressObj = (_ref = xhr.upload) != null ? _ref : xhr;
- progressObj.onprogress = updateProgress;
- headers = {
- "Accept": "application/json",
- "Cache-Control": "no-cache",
- "X-Requested-With": "XMLHttpRequest"
- };
- if (this.options.headers) {
- extend(headers, this.options.headers);
- }
- for (headerName in headers) {
- headerValue = headers[headerName];
- xhr.setRequestHeader(headerName, headerValue);
- }
- formData = new FormData();
- if (this.options.params) {
- _ref1 = this.options.params;
- for (key in _ref1) {
- value = _ref1[key];
- formData.append(key, value);
- }
- }
- for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
- file = files[_j];
- this.emit("sending", file, xhr, formData);
- }
- if (this.options.uploadMultiple) {
- this.emit("sendingmultiple", files, xhr, formData);
- }
- if (this.element.tagName === "FORM") {
- _ref2 = this.element.querySelectorAll("input, textarea, select, button");
- for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
- input = _ref2[_k];
- inputName = input.getAttribute("name");
- inputType = input.getAttribute("type");
- if (!inputType || ((_ref3 = inputType.toLowerCase()) !== "checkbox" && _ref3 !== "radio") || input.checked) {
- formData.append(inputName, input.value);
- }
- }
- }
- for (_l = 0, _len3 = files.length; _l < _len3; _l++) {
- file = files[_l];
- formData.append("" + this.options.paramName + (this.options.uploadMultiple ? "[]" : ""), file, file.name);
- }
- return xhr.send(formData);
- };
-
- Dropzone.prototype._finished = function(files, responseText, e) {
- var file, _i, _len;
- for (_i = 0, _len = files.length; _i < _len; _i++) {
- file = files[_i];
- file.status = Dropzone.SUCCESS;
- this.emit("success", file, responseText, e);
- this.emit("complete", file);
- }
- if (this.options.uploadMultiple) {
- this.emit("successmultiple", files, responseText, e);
- this.emit("completemultiple", files);
- }
- if (this.options.autoProcessQueue) {
- return this.processQueue();
- }
- };
-
- Dropzone.prototype._errorProcessing = function(files, message, xhr) {
- var file, _i, _len;
- for (_i = 0, _len = files.length; _i < _len; _i++) {
- file = files[_i];
- file.status = Dropzone.ERROR;
- this.emit("error", file, message, xhr);
- this.emit("complete", file);
- }
- if (this.options.uploadMultiple) {
- this.emit("errormultiple", files, message, xhr);
- this.emit("completemultiple", files);
- }
- if (this.options.autoProcessQueue) {
- return this.processQueue();
- }
- };
-
- return Dropzone;
-
- })(Em);
-
- Dropzone.version = "3.7.1";
-
- Dropzone.options = {};
-
- Dropzone.optionsForElement = function(element) {
- if (element.id) {
- return Dropzone.options[camelize(element.id)];
- } else {
- return void 0;
- }
- };
-
- Dropzone.instances = [];
-
- Dropzone.forElement = function(element) {
- if (typeof element === "string") {
- element = document.querySelector(element);
- }
- if ((element != null ? element.dropzone : void 0) == null) {
- throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");
- }
- return element.dropzone;
- };
-
- Dropzone.autoDiscover = true;
-
- Dropzone.discover = function() {
- var checkElements, dropzone, dropzones, _i, _len, _results;
- if (document.querySelectorAll) {
- dropzones = document.querySelectorAll(".dropzone");
- } else {
- dropzones = [];
- checkElements = function(elements) {
- var el, _i, _len, _results;
- _results = [];
- for (_i = 0, _len = elements.length; _i < _len; _i++) {
- el = elements[_i];
- if (/(^| )dropzone($| )/.test(el.className)) {
- _results.push(dropzones.push(el));
- } else {
- _results.push(void 0);
- }
- }
- return _results;
- };
- checkElements(document.getElementsByTagName("div"));
- checkElements(document.getElementsByTagName("form"));
- }
- _results = [];
- for (_i = 0, _len = dropzones.length; _i < _len; _i++) {
- dropzone = dropzones[_i];
- if (Dropzone.optionsForElement(dropzone) !== false) {
- _results.push(new Dropzone(dropzone));
- } else {
- _results.push(void 0);
- }
- }
- return _results;
- };
-
- Dropzone.blacklistedBrowsers = [/opera.*Macintosh.*version\/12/i];
-
- Dropzone.isBrowserSupported = function() {
- var capableBrowser, regex, _i, _len, _ref;
- capableBrowser = true;
- if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) {
- if (!("classList" in document.createElement("a"))) {
- capableBrowser = false;
- } else {
- _ref = Dropzone.blacklistedBrowsers;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- regex = _ref[_i];
- if (regex.test(navigator.userAgent)) {
- capableBrowser = false;
- continue;
- }
- }
- }
- } else {
- capableBrowser = false;
- }
- return capableBrowser;
- };
-
- without = function(list, rejectedItem) {
- var item, _i, _len, _results;
- _results = [];
- for (_i = 0, _len = list.length; _i < _len; _i++) {
- item = list[_i];
- if (item !== rejectedItem) {
- _results.push(item);
- }
- }
- return _results;
- };
-
- camelize = function(str) {
- return str.replace(/[\-_](\w)/g, function(match) {
- return match[1].toUpperCase();
- });
- };
-
- Dropzone.createElement = function(string) {
- var div;
- div = document.createElement("div");
- div.innerHTML = string;
- return div.childNodes[0];
- };
-
- Dropzone.elementInside = function(element, container) {
- if (element === container) {
- return true;
- }
- while (element = element.parentNode) {
- if (element === container) {
- return true;
- }
- }
- return false;
- };
-
- Dropzone.getElement = function(el, name) {
- var element;
- if (typeof el === "string") {
- element = document.querySelector(el);
- } else if (el.nodeType != null) {
- element = el;
- }
- if (element == null) {
- throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector or a plain HTML element.");
- }
- return element;
- };
-
- Dropzone.getElements = function(els, name) {
- var e, el, elements, _i, _j, _len, _len1, _ref;
- if (els instanceof Array) {
- elements = [];
- try {
- for (_i = 0, _len = els.length; _i < _len; _i++) {
- el = els[_i];
- elements.push(this.getElement(el, name));
- }
- } catch (_error) {
- e = _error;
- elements = null;
- }
- } else if (typeof els === "string") {
- elements = [];
- _ref = document.querySelectorAll(els);
- for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
- el = _ref[_j];
- elements.push(el);
- }
- } else if (els.nodeType != null) {
- elements = [els];
- }
- if (!((elements != null) && elements.length)) {
- throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");
- }
- return elements;
- };
-
- Dropzone.confirm = function(question, accepted, rejected) {
- if (window.confirm(question)) {
- return accepted();
- } else if (rejected != null) {
- return rejected();
- }
- };
-
- Dropzone.isValidFile = function(file, acceptedFiles) {
- var baseMimeType, mimeType, validType, _i, _len;
- if (!acceptedFiles) {
- return true;
- }
- acceptedFiles = acceptedFiles.split(",");
- mimeType = file.type;
- baseMimeType = mimeType.replace(/\/.*$/, "");
- for (_i = 0, _len = acceptedFiles.length; _i < _len; _i++) {
- validType = acceptedFiles[_i];
- validType = validType.trim();
- if (validType.charAt(0) === ".") {
- if (file.name.indexOf(validType, file.name.length - validType.length) !== -1) {
- return true;
- }
- } else if (/\/\*$/.test(validType)) {
- if (baseMimeType === validType.replace(/\/.*$/, "")) {
- return true;
- }
- } else {
- if (mimeType === validType) {
- return true;
- }
- }
- }
- return false;
- };
-
- if (typeof jQuery !== "undefined" && jQuery !== null) {
- jQuery.fn.dropzone = function(options) {
- return this.each(function() {
- return new Dropzone(this, options);
- });
- };
- }
-
- if (typeof module !== "undefined" && module !== null) {
- module.exports = Dropzone;
- } else {
- window.Dropzone = Dropzone;
- }
-
- Dropzone.ADDED = "added";
-
- Dropzone.QUEUED = "queued";
-
- Dropzone.ACCEPTED = Dropzone.QUEUED;
-
- Dropzone.UPLOADING = "uploading";
-
- Dropzone.PROCESSING = Dropzone.UPLOADING;
-
- Dropzone.CANCELED = "canceled";
-
- Dropzone.ERROR = "error";
-
- Dropzone.SUCCESS = "success";
-
- /*
- # contentloaded.js
- #
- # Author: Diego Perini (diego.perini at gmail.com)
- # Summary: cross-browser wrapper for DOMContentLoaded
- # Updated: 20101020
- # License: MIT
- # Version: 1.2
- #
- # URL:
- # http://javascript.nwbox.com/ContentLoaded/
- # http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
- */
-
-
- contentLoaded = function(win, fn) {
- var add, doc, done, init, poll, pre, rem, root, top;
- done = false;
- top = true;
- doc = win.document;
- root = doc.documentElement;
- add = (doc.addEventListener ? "addEventListener" : "attachEvent");
- rem = (doc.addEventListener ? "removeEventListener" : "detachEvent");
- pre = (doc.addEventListener ? "" : "on");
- init = function(e) {
- if (e.type === "readystatechange" && doc.readyState !== "complete") {
- return;
- }
- (e.type === "load" ? win : doc)[rem](pre + e.type, init, false);
- if (!done && (done = true)) {
- return fn.call(win, e.type || e);
- }
- };
- poll = function() {
- var e;
- try {
- root.doScroll("left");
- } catch (_error) {
- e = _error;
- setTimeout(poll, 50);
- return;
- }
- return init("poll");
- };
- if (doc.readyState !== "complete") {
- if (doc.createEventObject && root.doScroll) {
- try {
- top = !win.frameElement;
- } catch (_error) {}
- if (top) {
- poll();
- }
- }
- doc[add](pre + "DOMContentLoaded", init, false);
- doc[add](pre + "readystatechange", init, false);
- return win[add](pre + "load", init, false);
- }
- };
-
- Dropzone._autoDiscoverFunction = function() {
- if (Dropzone.autoDiscover) {
- return Dropzone.discover();
- }
- };
-
- contentLoaded(window, Dropzone._autoDiscoverFunction);
-
-}).call(this);
-
-});
-require.alias("component-emitter/index.js", "dropzone/deps/emitter/index.js");
-require.alias("component-emitter/index.js", "emitter/index.js");
-if (typeof exports == "object") {
- module.exports = require("dropzone");
-} else if (typeof define == "function" && define.amd) {
- define(function(){ return require("dropzone"); });
-} else {
- this["Dropzone"] = require("dropzone");
-}})();
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/FileUploadBar.html b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/FileUploadBar.html
deleted file mode 100644
index 36fb6c24c5..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/FileUploadBar.html
+++ /dev/null
@@ -1,125 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:wicket="http://wicket.apache.org">
-<wicket:panel>
- <form wicket:id="form" action="/rest/file/upload" method="POST" enctype="multipart/form-data">
- <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
- <div class="row fileupload-buttonbar">
- <div class="col-lg-7">
- <!-- The fileinput-button span is used to style the file input field as button -->
- <span class="btn btn-success fileinput-button"> <i
- class="glyphicon glyphicon-plus"></i> <span>Add files...</span> <input
- type="file" name="files" />
- </span>
- <button type="submit" class="btn btn-primary start">
- <i class="glyphicon glyphicon-upload"></i> <span>Start
- upload</span>
- </button>
- <button type="reset" class="btn btn-warning cancel">
- <i class="glyphicon glyphicon-ban-circle"></i> <span>Cancel
- upload</span>
- </button>
- <button type="button" class="btn btn-danger delete">
- <i class="glyphicon glyphicon-trash"></i> <span>Delete</span>
- </button>
- <input type="checkbox" class="toggle">
- <!-- The loading indicator is shown during file processing -->
- <span class="fileupload-loading"></span>
- </div>
- <!-- The global progress information -->
- <div class="col-lg-5 fileupload-progress fade">
- <!-- The global progress bar -->
- <div class="progress progress-striped active" role="progressbar"
- aria-valuemin="0" aria-valuemax="100">
- <div class="progress-bar progress-bar-success" style="width: 0%;"></div>
- </div>
- <!-- The extended global progress information -->
- <div class="progress-extended">&nbsp;</div>
- </div>
- </div>
- <!-- The table listing the files available for upload/download -->
- <table role="presentation" class="table table-striped">
- <tbody class="files"></tbody>
- </table>
- </form>
-
-<!-- The template to display files available for upload -->
-<script id="template-upload" type="text/x-tmpl">
-{% for (var i=0, file; file=o.files[i]; i++) { %}
- <tr class="template-upload fade">
- <td>
- <span class="preview"></span>
- </td>
- <td>
- <p class="name">{%=file.name%}</p>
- {% if (file.error) { %}
- <div><span class="label label-danger">Error</span> {%=file.error%}</div>
- {% } %}
- </td>
- <td>
- <p class="size">{%=o.formatFileSize(file.size)%}</p>
- {% if (!o.files.error) { %}
- <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
- {% } %}
- </td>
- <td>
- {% if (!o.files.error && !i && !o.options.autoUpload) { %}
- <button class="btn btn-primary start">
- <i class="glyphicon glyphicon-upload"></i>
- <span>Start</span>
- </button>
- {% } %}
- {% if (!i) { %}
- <button class="btn btn-warning cancel">
- <i class="glyphicon glyphicon-ban-circle"></i>
- <span>Cancel</span>
- </button>
- {% } %}
- </td>
- </tr>
-{% } %}
-</script>
-<!-- The template to display files available for download -->
-<script id="template-download" type="text/x-tmpl">
-{% for (var i=0, file; file=o.files[i]; i++) { %}
- <tr class="template-download fade">
- <td>
- <span class="preview">
- {% if (file.thumbnailUrl) { %}
- <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
- {% } %}
- </span>
- </td>
- <td>
- <p class="name">
- {% if (file.url) { %}
- <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
- {% } else { %}
- <span>{%=file.name%}</span>
- {% } %}
- </p>
- {% if (file.error) { %}
- <div><span class="label label-danger">Error</span> {%=file.error%}</div>
- {% } %}
- </td>
- <td>
- <span class="size">{%=o.formatFileSize(file.size)%}</span>
- </td>
- <td>
- {% if (file.deleteUrl) { %}
- <button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
- <i class="glyphicon glyphicon-trash"></i>
- <span>Delete</span>
- </button>
- <input type="checkbox" name="delete" value="1" class="toggle">
- {% } else { %}
- <button class="btn btn-warning cancel">
- <i class="glyphicon glyphicon-ban-circle"></i>
- <span>Cancel</span>
- </button>
- {% } %}
- </td>
- </tr>
-{% } %}
-</script>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/FileUploadBar.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/FileUploadBar.java
deleted file mode 100644
index b1a1b1d99d..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/FileUploadBar.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.pmease.gitop.web.common.wicket.component.fileupload;
-
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.panel.Panel;
-
-/**
- * This bar contributes the toolbar with "Add files", "Start upload",
- * "Cancel upload" and "Delete all" buttons.
- */
-public class FileUploadBar extends Panel {
-
- private static final long serialVersionUID = 1L;
-
- public FileUploadBar(String id) {
- super(id);
-
- WebMarkupContainer form = new WebMarkupContainer("form");
- add(form);
- form.add(new FileUploadResourceBehavior());
- }
-}
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/FileUploadResourceBehavior.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/FileUploadResourceBehavior.java
deleted file mode 100644
index de2da5cb97..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/FileUploadResourceBehavior.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package com.pmease.gitop.web.common.wicket.component.fileupload;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.markup.head.CssHeaderItem;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.request.resource.CssResourceReference;
-import org.apache.wicket.request.resource.JavaScriptResourceReference;
-import org.apache.wicket.request.resource.ResourceReference;
-
-import com.pmease.gitop.web.assets.AssetLocator;
-
-@SuppressWarnings("serial")
-public class FileUploadResourceBehavior extends Behavior {
-
- private static final ResourceReference FILEUPLOAD_JS =
- new JavaScriptResourceReference(
- FileUploadResourceBehavior.class,
- "res/js/jquery.fileupload.js");
-
- private static final ResourceReference IFRAME_TRANSPORT_JS =
- new JavaScriptResourceReference(
- FileUploadResourceBehavior.class,
- "res/js/jquery.iframe-transport.js");
-
- private static final ResourceReference FILEUPLOAD_UI_JS =
- new JavaScriptResourceReference(
- FileUploadResourceBehavior.class,
- "res/js/jquery.fileupload-ui.js");
-
- /**
- * The name of the request parameter used for the multipart
- * Ajax request
- */
- public static final String PARAM_NAME = "FILE-UPLOAD";
-
- /**
- * Configures the connected component to render its markup id
- * because it is needed to initialize the JavaScript widget.
- * @param component
- */
- @Override
- public void bind(Component component) {
- super.bind(component);
-
- component.setOutputMarkupId(true);
- }
-
- @Override
- public void renderHead(Component component, IHeaderResponse response) {
- super.renderHead(component, response);
-
- response.render(CssHeaderItem.forReference(new CssResourceReference(FileUploadResourceBehavior.class, "res/css/jquery.fileupload-ui.css")));
-
- response.render(JavaScriptHeaderItem.forReference(AssetLocator.JQUERY_UI_WIDGET_JS));
-// response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(FileUploadResourceBehavior.class, "res/js/tmpl.min.js")));
- response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(FileUploadResourceBehavior.class, "res/js/load-image.min.js")));
- response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(FileUploadResourceBehavior.class, "res/js/jquery.blueimp-gallery.min.js")));
- response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(FileUploadResourceBehavior.class, "res/js/canvas-to-blob.min.js")));
-
- response.render(JavaScriptHeaderItem.forReference(IFRAME_TRANSPORT_JS));
- response.render(JavaScriptHeaderItem.forReference(FILEUPLOAD_JS));
- response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(FileUploadResourceBehavior.class, "res/js/jquery.fileupload-process.js")));
- response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(FileUploadResourceBehavior.class, "res/js/jquery.fileupload-audio.js")));
- response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(FileUploadResourceBehavior.class, "res/js/jquery.fileupload-video.js")));
- response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(FileUploadResourceBehavior.class, "res/js/jquery.fileupload-image.js")));
- response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(FileUploadResourceBehavior.class, "res/js/jquery.fileupload-validate.js")));
- response.render(JavaScriptHeaderItem.forReference(FILEUPLOAD_UI_JS));
-
-
-// PackageTextTemplate jsTmpl = new PackageTextTemplate(FileUploadResourceBehavior.class,
-// "res/js/main.js");
-// try {
-// Map<String, Object> variables = new HashMap<String, Object>();
-//
-// variables.put("componentId", component.getMarkupId());
-// variables.put("url", "/rest/file/upload");
-// variables.put("paramName", PARAM_NAME);
-//
-// String s = jsTmpl.asString(variables);
-// response.render(JavaScriptHeaderItem.forScript(s, "fileupload"));
-// } finally {
-// IOUtils.closeQuietly(jsTmpl);
-// }
- }
-}
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/css/gallery.min.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/css/gallery.min.js
deleted file mode 100644
index c7a7f07461..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/css/gallery.min.js
+++ /dev/null
@@ -1 +0,0 @@
-@charset 'UTF-8';.blueimp-gallery,.blueimp-gallery>.slides>.slide>.slide-content{position:absolute;top:0;right:0;bottom:0;left:0;-moz-backface-visibility:hidden}.blueimp-gallery>.slides>.slide>.slide-content{margin:auto;max-width:100%;max-height:100%;opacity:1}.blueimp-gallery{position:fixed;z-index:9999;overflow:hidden;background:#000;background:rgba(0,0,0,.9);opacity:0;display:none;direction:ltr;-ms-touch-action:none}.blueimp-gallery-carousel{position:relative;z-index:auto;height:432px;max-width:768px;margin:1em auto;box-shadow:0 0 10px #000}.blueimp-gallery-display{display:block;opacity:1}.blueimp-gallery>.slides{position:relative;height:100%;overflow:hidden}.blueimp-gallery>.slides>.slide{position:relative;float:left;height:100%;text-align:center;-webkit-transition-timing-function:cubic-bezier(0.645,.045,.355,1);-moz-transition-timing-function:cubic-bezier(0.645,.045,.355,1);-ms-transition-timing-function:cubic-bezier(0.645,.045,.355,1);-o-transition-timing-function:cubic-bezier(0.645,.045,.355,1);transition-timing-function:cubic-bezier(0.645,.045,.355,1)}.blueimp-gallery,.blueimp-gallery>.slides>.slide>.slide-content{-webkit-transition:opacity .5s linear;-moz-transition:opacity .5s linear;-ms-transition:opacity .5s linear;-o-transition:opacity .5s linear;transition:opacity .5s linear}.blueimp-gallery>.slides>.slide-loading{background:url(../img/loading.gif) center no-repeat;background-size:64px 64px}.blueimp-gallery>.slides>.slide-loading>.slide-content{opacity:0}.blueimp-gallery>.slides>.slide-error{background:url(../img/error.png) center no-repeat}.blueimp-gallery>.slides>.slide-error>.slide-content{display:none}.blueimp-gallery>.prev,.blueimp-gallery>.next{position:absolute;top:50%;left:15px;width:40px;height:40px;margin-top:-23px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:60px;font-weight:100;line-height:30px;color:#fff;text-decoration:none;text-shadow:0 0 2px #000;text-align:center;background:#222;background:rgba(0,0,0,.5);-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;border:3px solid #fff;-webkit-border-radius:23px;-moz-border-radius:23px;border-radius:23px;opacity:.5;cursor:pointer;display:none}.blueimp-gallery>.next{left:auto;right:15px}.blueimp-gallery>.close,.blueimp-gallery>.title{position:absolute;top:15px;left:15px;margin:0 40px 0 0;font-size:20px;line-height:30px;color:#fff;text-shadow:0 0 2px #000;opacity:.8;display:none}.blueimp-gallery>.close{padding:15px;right:15px;left:auto;margin:-15px;font-size:30px;text-decoration:none;cursor:pointer}.blueimp-gallery>.play-pause{position:absolute;right:15px;bottom:15px;width:15px;height:15px;background:url(../img/play-pause.png) 0 0 no-repeat;cursor:pointer;opacity:.5;display:none}.blueimp-gallery-playing>.play-pause{background-position:-15px 0}.blueimp-gallery-controls>.prev,.blueimp-gallery-controls>.next,.blueimp-gallery-controls>.close,.blueimp-gallery-controls>.title,.blueimp-gallery-controls>.play-pause{display:block;-webkit-transform:translateZ(0);-moz-transform:translateZ(0);-ms-transform:translateZ(0);-o-transform:translateZ(0);transform:translateZ(0)}.blueimp-gallery-single>.prev,.blueimp-gallery-left>.prev,.blueimp-gallery-single>.next,.blueimp-gallery-right>.next,.blueimp-gallery-single>.play-pause{display:none}.blueimp-gallery>.slides>.slide>.slide-content,.blueimp-gallery>.prev,.blueimp-gallery>.next,.blueimp-gallery>.close,.blueimp-gallery>.play-pause{-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}body:last-child .blueimp-gallery>.slides>.slide-error{background-image:url(../img/error.svg)}body:last-child .blueimp-gallery>.play-pause{width:20px;height:20px;background-size:40px 20px;background-image:url(../img/play-pause.svg)}body:last-child .blueimp-gallery-playing>.play-pause{background-position:-20px 0}@media (max-width:767px){.blueimp-gallery-carousel{height:270px;max-width:480px}}*+html .blueimp-gallery>.slides>.slide{min-height:300px}*+html .blueimp-gallery>.slides>.slide>.slide-content{position:relative}.blueimp-gallery>.indicator{position:absolute;top:auto;right:15px;bottom:15px;left:15px;margin:0 40px;padding:0;list-style:none;text-align:center;line-height:10px;display:none}.blueimp-gallery>.indicator>li{display:inline-block;width:9px;height:9px;margin:6px 3px 0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;border:1px solid transparent;background:#ccc;background:rgba(255,255,255,.25) center no-repeat;border-radius:5px;box-shadow:0 0 2px #000;opacity:.5;cursor:pointer}.blueimp-gallery>.indicator>.active{background-color:#fff;border-color:#fff;opacity:.8}.blueimp-gallery-controls>.indicator{display:block;-webkit-transform:translateZ(0);-moz-transform:translateZ(0);-ms-transform:translateZ(0);-o-transform:translateZ(0);transform:translateZ(0)}.blueimp-gallery-single>.indicator{display:none}.blueimp-gallery>.indicator{-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}*+html .blueimp-gallery>.indicator>li{display:inline}.blueimp-gallery>.slides>.slide>.video-content>video,.blueimp-gallery>.slides>.slide>.video-content>img{position:absolute;top:0;right:0;bottom:0;left:0;-moz-backface-visibility:hidden}.blueimp-gallery>.slides>.slide>.video-content>video,.blueimp-gallery>.slides>.slide>.video-content>img{margin:auto;max-width:100%;max-height:100%;opacity:1}.blueimp-gallery>.slides>.slide>.video-content>a{position:absolute;top:50%;right:0;left:0;margin:-64px auto 0;width:128px;height:128px;background:url(../img/video-play.png) center no-repeat;opacity:.8;cursor:pointer}.blueimp-gallery>.slides>.slide>.video-playing>a,.blueimp-gallery>.slides>.slide>.video-playing>img{display:none}.blueimp-gallery>.slides>.slide>.video-content>video{display:none}.blueimp-gallery>.slides>.slide>.video-playing>video{display:block}.blueimp-gallery>.slides>.slide>.video-loading>a{background:url(../img/loading.gif) center no-repeat;background-size:64px 64px}body:last-child .blueimp-gallery>.slides>.slide>.video-content>a{background-image:url(../img/video-play.svg)}*+html .blueimp-gallery>.slides>.slide>.video-content{height:100%}*+html .blueimp-gallery>.slides>.slide>.video-content>a{left:50%;margin-left:-64px}
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/css/jquery.fileupload-ui.css b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/css/jquery.fileupload-ui.css
deleted file mode 100644
index f81b34c7b0..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/css/jquery.fileupload-ui.css
+++ /dev/null
@@ -1,68 +0,0 @@
-@charset "UTF-8";
-/*
- * jQuery File Upload UI Plugin CSS 8.8.1
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2010, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-.fileinput-button {
- position: relative;
- overflow: hidden;
-}
-.fileinput-button input {
- position: absolute;
- top: 0;
- right: 0;
- margin: 0;
- opacity: 0;
- filter: alpha(opacity=0);
- transform: translate(-300px, 0) scale(4);
- font-size: 23px;
- direction: ltr;
- cursor: pointer;
-}
-.fileupload-buttonbar .btn,
-.fileupload-buttonbar .toggle {
- margin-bottom: 5px;
-}
-.progress-animated .progress-bar,
-.progress-animated .bar {
- background: url(../img/progressbar.gif) !important;
- filter: none;
-}
-.fileupload-loading {
- float: right;
- width: 32px;
- height: 32px;
- background: url(../img/loading.gif) center no-repeat;
- background-size: contain;
- display: none;
-}
-.fileupload-processing .fileupload-loading {
- display: block;
-}
-.files audio,
-.files video {
- max-width: 300px;
-}
-
-@media (max-width: 767px) {
- .fileupload-buttonbar .toggle,
- .files .toggle,
- .files .btn span {
- display: none;
- }
- .files .name {
- width: 80px;
- word-wrap: break-word;
- }
- .files audio,
- .files video {
- max-width: 80px;
- }
-}
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/app.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/app.js
deleted file mode 100644
index 60a3fed49d..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/app.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * jQuery File Upload Plugin Angular JS Example 1.2.1
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2013, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint nomen: true, regexp: true */
-/*global window, angular */
-
-(function () {
- 'use strict';
-
- var isOnGitHub = window.location.hostname === 'blueimp.github.io',
- url = isOnGitHub ? '//jquery-file-upload.appspot.com/' : 'server/php/';
-
- angular.module('demo', [
- 'blueimp.fileupload'
- ])
- .config([
- '$httpProvider', 'fileUploadProvider',
- function ($httpProvider, fileUploadProvider) {
- delete $httpProvider.defaults.headers.common['X-Requested-With'];
- fileUploadProvider.defaults.redirect = window.location.href.replace(
- /\/[^\/]*$/,
- '/cors/result.html?%s'
- );
- if (isOnGitHub) {
- // Demo settings:
- angular.extend(fileUploadProvider.defaults, {
- // Enable image resizing, except for Android and Opera,
- // which actually support image resizing, but fail to
- // send Blob objects via XHR requests:
- disableImageResize: /Android(?!.*Chrome)|Opera/
- .test(window.navigator.userAgent),
- maxFileSize: 5000000,
- acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
- });
- }
- }
- ])
-
- .controller('DemoFileUploadController', [
- '$scope', '$http', '$filter', '$window',
- function ($scope, $http) {
- $scope.options = {
- url: url
- };
- if (!isOnGitHub) {
- $scope.loadingFiles = true;
- $http.get(url)
- .then(
- function (response) {
- $scope.loadingFiles = false;
- $scope.queue = response.data.files || [];
- },
- function () {
- $scope.loadingFiles = false;
- }
- );
- }
- }
- ])
-
- .controller('FileDestroyController', [
- '$scope', '$http',
- function ($scope, $http) {
- var file = $scope.file,
- state;
- if (file.url) {
- file.$state = function () {
- return state;
- };
- file.$destroy = function () {
- state = 'pending';
- return $http({
- url: file.deleteUrl,
- method: file.deleteType
- }).then(
- function () {
- state = 'resolved';
- $scope.clear(file);
- },
- function () {
- state = 'rejected';
- }
- );
- };
- } else if (!file.$cancel && !file._index) {
- file.$cancel = function () {
- $scope.clear(file);
- };
- }
- }
- ]);
-
-}());
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/canvas-to-blob.min.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/canvas-to-blob.min.js
deleted file mode 100644
index 7ee3553a06..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/canvas-to-blob.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(t){"use strict";var e=t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype,n=t.Blob&&function(){try{return Boolean(new Blob)}catch(t){return!1}}(),o=n&&t.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(t){return!1}}(),r=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,i=(n||r)&&t.atob&&t.ArrayBuffer&&t.Uint8Array&&function(t){var e,i,a,l,u,B;for(e=t.split(",")[0].indexOf("base64")>=0?atob(t.split(",")[1]):decodeURIComponent(t.split(",")[1]),i=new ArrayBuffer(e.length),a=new Uint8Array(i),l=0;l<e.length;l+=1)a[l]=e.charCodeAt(l);return u=t.split(",")[0].split(":")[1].split(";")[0],n?new Blob([o?a:i],{type:u}):(B=new r,B.append(i),B.getBlob(u))};t.HTMLCanvasElement&&!e.toBlob&&(e.mozGetAsFile?e.toBlob=function(t,n,o){o&&e.toDataURL&&i?t(i(this.toDataURL(n,o))):t(this.mozGetAsFile("blob",n))}:e.toDataURL&&i&&(e.toBlob=function(t,e,n){t(i(this.toDataURL(e,n)))})),"function"==typeof define&&define.amd?define(function(){return i}):t.dataURLtoBlob=i}(this);
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/cors/jquery.postmessage-transport.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/cors/jquery.postmessage-transport.js
deleted file mode 100644
index 2b4cbc5d24..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/cors/jquery.postmessage-transport.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * jQuery postMessage Transport Plugin 1.1.1
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2011, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint unparam: true, nomen: true */
-/*global define, window, document */
-
-(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define(['jquery'], factory);
- } else {
- // Browser globals:
- factory(window.jQuery);
- }
-}(function ($) {
- 'use strict';
-
- var counter = 0,
- names = [
- 'accepts',
- 'cache',
- 'contents',
- 'contentType',
- 'crossDomain',
- 'data',
- 'dataType',
- 'headers',
- 'ifModified',
- 'mimeType',
- 'password',
- 'processData',
- 'timeout',
- 'traditional',
- 'type',
- 'url',
- 'username'
- ],
- convert = function (p) {
- return p;
- };
-
- $.ajaxSetup({
- converters: {
- 'postmessage text': convert,
- 'postmessage json': convert,
- 'postmessage html': convert
- }
- });
-
- $.ajaxTransport('postmessage', function (options) {
- if (options.postMessage && window.postMessage) {
- var iframe,
- loc = $('<a>').prop('href', options.postMessage)[0],
- target = loc.protocol + '//' + loc.host,
- xhrUpload = options.xhr().upload;
- return {
- send: function (_, completeCallback) {
- counter += 1;
- var message = {
- id: 'postmessage-transport-' + counter
- },
- eventName = 'message.' + message.id;
- iframe = $(
- '<iframe style="display:none;" src="' +
- options.postMessage + '" name="' +
- message.id + '"></iframe>'
- ).bind('load', function () {
- $.each(names, function (i, name) {
- message[name] = options[name];
- });
- message.dataType = message.dataType.replace('postmessage ', '');
- $(window).bind(eventName, function (e) {
- e = e.originalEvent;
- var data = e.data,
- ev;
- if (e.origin === target && data.id === message.id) {
- if (data.type === 'progress') {
- ev = document.createEvent('Event');
- ev.initEvent(data.type, false, true);
- $.extend(ev, data);
- xhrUpload.dispatchEvent(ev);
- } else {
- completeCallback(
- data.status,
- data.statusText,
- {postmessage: data.result},
- data.headers
- );
- iframe.remove();
- $(window).unbind(eventName);
- }
- }
- });
- iframe[0].contentWindow.postMessage(
- message,
- target
- );
- }).appendTo(document.body);
- },
- abort: function () {
- if (iframe) {
- iframe.remove();
- }
- }
- };
- }
- });
-
-}));
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/cors/jquery.xdr-transport.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/cors/jquery.xdr-transport.js
deleted file mode 100644
index d769f452d5..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/cors/jquery.xdr-transport.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * jQuery XDomainRequest Transport Plugin 1.1.3
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2011, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- *
- * Based on Julian Aubourg's ajaxHooks xdr.js:
- * https://github.com/jaubourg/ajaxHooks/
- */
-
-/*jslint unparam: true */
-/*global define, window, XDomainRequest */
-
-(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define(['jquery'], factory);
- } else {
- // Browser globals:
- factory(window.jQuery);
- }
-}(function ($) {
- 'use strict';
- if (window.XDomainRequest && !$.support.cors) {
- $.ajaxTransport(function (s) {
- if (s.crossDomain && s.async) {
- if (s.timeout) {
- s.xdrTimeout = s.timeout;
- delete s.timeout;
- }
- var xdr;
- return {
- send: function (headers, completeCallback) {
- var addParamChar = /\?/.test(s.url) ? '&' : '?';
- function callback(status, statusText, responses, responseHeaders) {
- xdr.onload = xdr.onerror = xdr.ontimeout = $.noop;
- xdr = null;
- completeCallback(status, statusText, responses, responseHeaders);
- }
- xdr = new XDomainRequest();
- // XDomainRequest only supports GET and POST:
- if (s.type === 'DELETE') {
- s.url = s.url + addParamChar + '_method=DELETE';
- s.type = 'POST';
- } else if (s.type === 'PUT') {
- s.url = s.url + addParamChar + '_method=PUT';
- s.type = 'POST';
- } else if (s.type === 'PATCH') {
- s.url = s.url + addParamChar + '_method=PATCH';
- s.type = 'POST';
- }
- xdr.open(s.type, s.url);
- xdr.onload = function () {
- callback(
- 200,
- 'OK',
- {text: xdr.responseText},
- 'Content-Type: ' + xdr.contentType
- );
- };
- xdr.onerror = function () {
- callback(404, 'Not Found');
- };
- if (s.xdrTimeout) {
- xdr.ontimeout = function () {
- callback(0, 'timeout');
- };
- xdr.timeout = s.xdrTimeout;
- }
- xdr.send((s.hasContent && s.data) || null);
- },
- abort: function () {
- if (xdr) {
- xdr.onerror = $.noop();
- xdr.abort();
- }
- }
- };
- }
- });
- }
-}));
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.blueimp-gallery.min.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.blueimp-gallery.min.js
deleted file mode 100644
index 0de6b4a53d..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.blueimp-gallery.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(t){"use strict";"function"==typeof define&&define.amd?define(["./blueimp-helper"],t):(window.blueimp=window.blueimp||{},window.blueimp.Gallery=t(window.blueimp.helper||window.jQuery))}(function(t){"use strict";function e(t,i){return t&&t.length&&void 0!==document.body.style.maxHeight?this&&this.options===e.prototype.options?(this.list=t,this.num=t.length,this.initOptions(i),this.initialize(),void 0):new e(t,i):!1}return t.extend(e.prototype,{options:{container:"#blueimp-gallery",slidesContainer:"div",titleElement:"h3",displayClass:"blueimp-gallery-display",controlsClass:"blueimp-gallery-controls",singleClass:"blueimp-gallery-single",leftEdgeClass:"blueimp-gallery-left",rightEdgeClass:"blueimp-gallery-right",playingClass:"blueimp-gallery-playing",slideClass:"slide",slideLoadingClass:"slide-loading",slideErrorClass:"slide-error",slideContentClass:"slide-content",toggleClass:"toggle",prevClass:"prev",nextClass:"next",closeClass:"close",playPauseClass:"play-pause",typeProperty:"type",titleProperty:"title",urlProperty:"href",displayTransition:!0,clearSlides:!0,stretchImages:!1,toggleControlsOnReturn:!0,toggleSlideshowOnSpace:!0,enableKeyboardNavigation:!0,closeOnEscape:!0,closeOnSlideClick:!0,closeOnSwipeUpOrDown:!0,emulateTouchEvents:!0,hidePageScrollbars:!0,disableScroll:!0,carousel:!1,continuous:!0,unloadElements:!0,startSlideshow:!1,slideshowInterval:5e3,index:0,preloadRange:2,transitionSpeed:400,slideshowTransitionSpeed:void 0,event:void 0,onopen:void 0,onopened:void 0,onslide:void 0,onslideend:void 0,onslidecomplete:void 0,onclose:void 0,onclosed:void 0},carouselOptions:{hidePageScrollbars:!1,toggleControlsOnReturn:!1,toggleSlideshowOnSpace:!1,enableKeyboardNavigation:!1,closeOnEscape:!1,closeOnSlideClick:!1,closeOnSwipeUpOrDown:!1,disableScroll:!1,startSlideshow:!0},support:function(e){var i,s,n,o={touch:void 0!==window.ontouchstart||window.DocumentTouch&&document instanceof DocumentTouch},l={webkitTransition:{end:"webkitTransitionEnd",prefix:"-webkit-"},MozTransition:{end:"transitionend",prefix:"-moz-"},OTransition:{end:"otransitionend",prefix:"-o-"},transition:{end:"transitionend",prefix:""}},r=function(){document.body.appendChild(e),s&&(i=s.name.slice(0,-9)+"ransform",void 0!==e.style[i]&&(e.style[i]="translateZ(0)",n=window.getComputedStyle(e).getPropertyValue(s.prefix+"transform"),o.transform={prefix:s.prefix,name:i,translate:!0,translateZ:!!n&&"none"!==n})),void 0!==e.style.backgroundSize&&(e.style.backgroundSize="contain",o.backgroundSize={contain:"contain"===window.getComputedStyle(e).getPropertyValue("background-size")}),document.body.removeChild(e)};for(i in l)if(l.hasOwnProperty(i)&&void 0!==e.style[i]){s=l[i],s.name=i,o.transition=s;break}return document.body?r():t(document).on("DOMContentLoaded",r),o}(document.createElement("div")),requestAnimationFrame:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame,initialize:function(){return this.initStartIndex(),this.initWidget()===!1?!1:(this.initEventListeners(),this.onslide(this.index),this.ontransitionend(),this.options.startSlideshow&&this.play(),void 0)},slide:function(t,e){window.clearTimeout(this.timeout);var i,s,n,o=this.index;if(o!==t&&1!==this.num){if(e||(e=this.options.transitionSpeed),this.support.transition){for(this.options.continuous||(t=this.circle(t)),i=Math.abs(o-t)/(o-t),this.options.continuous&&(s=i,i=-this.positions[this.circle(t)]/this.slideWidth,i!==s&&(t=-i*this.num+t)),n=Math.abs(o-t)-1;n;)n-=1,this.move(this.circle((t>o?t:o)-n-1),this.slideWidth*i,0);t=this.circle(t),this.move(o,this.slideWidth*i,e),this.move(t,0,e),this.options.continuous&&this.move(this.circle(t-i),-(this.slideWidth*i),0)}else t=this.circle(t),this.animate(o*-this.slideWidth,t*-this.slideWidth,e);this.onslide(t)}},getIndex:function(){return this.index},getNumber:function(){return this.num},prev:function(){(this.options.continuous||this.index)&&this.slide(this.index-1)},next:function(){(this.options.continuous||this.index<this.num-1)&&this.slide(this.index+1)},play:function(t){var e=this;window.clearTimeout(this.timeout),this.interval=t||this.options.slideshowInterval,this.elements[this.index]>1&&(this.timeout=this.setTimeout(!this.requestAnimationFrame&&this.slide||function(t,i){e.animationFrameId=e.requestAnimationFrame.call(window,function(){e.slide(t,i)})},[this.index+1,this.options.slideshowTransitionSpeed],this.interval)),this.container.addClass(this.options.playingClass)},pause:function(){window.clearTimeout(this.timeout),this.interval=null,this.container.removeClass(this.options.playingClass)},add:function(t){var e;for(this.list=this.list.concat(t),this.num=this.list.length,this.num>2&&null===this.options.continuous&&(this.options.continuous=!0,this.container.removeClass(this.options.leftEdgeClass)),this.container.removeClass(this.options.rightEdgeClass).removeClass(this.options.singleClass),e=this.num-t.length;e<this.num;e+=1)this.addSlide(e),this.positionSlide(e);this.positions.length=this.num,this.initSlides(!0)},resetSlides:function(){this.slidesContainer.empty(),this.slides=[]},handleClose:function(){var t=this.options;this.destroyEventListeners(),this.pause(),this.container[0].style.display="none",this.container.removeClass(t.displayClass).removeClass(t.singleClass).removeClass(t.leftEdgeClass).removeClass(t.rightEdgeClass),t.hidePageScrollbars&&(document.body.style.overflow=this.bodyOverflowStyle),this.options.clearSlides&&this.resetSlides(),this.options.onclosed&&this.options.onclosed.call(this)},close:function(){var t=this,e=function(i){i.target===t.container[0]&&(t.container.off(t.support.transition.end,e),t.handleClose())};this.options.onclose&&this.options.onclose.call(this),this.support.transition&&this.options.displayTransition?(this.container.on(this.support.transition.end,e),this.container.removeClass(this.options.displayClass)):this.handleClose()},circle:function(t){return(this.num+t%this.num)%this.num},move:function(t,e,i){this.translateX(t,e,i),this.positions[t]=e},translate:function(t,e,i,s){var n=this.slides[t].style,o=this.support.transition,l=this.support.transform;n[o.name+"Duration"]=s+"ms",n[l.name]="translate("+e+"px, "+i+"px)"+(l.translateZ?" translateZ(0)":"")},translateX:function(t,e,i){this.translate(t,e,0,i)},translateY:function(t,e,i){this.translate(t,0,e,i)},animate:function(t,e,i){if(!i)return this.slidesContainer[0].style.left=e+"px",void 0;var s=this,n=(new Date).getTime(),o=window.setInterval(function(){var l=(new Date).getTime()-n;return l>i?(s.slidesContainer[0].style.left=e+"px",s.ontransitionend(),window.clearInterval(o),void 0):(s.slidesContainer[0].style.left=(e-t)*(Math.floor(100*(l/i))/100)+t+"px",void 0)},4)},preventDefault:function(t){t.preventDefault?t.preventDefault():t.returnValue=!1},onresize:function(){this.initSlides(!0)},onmousedown:function(t){t.which&&1===t.which&&(t.preventDefault(),(t.originalEvent||t).touches=[{pageX:t.pageX,pageY:t.pageY}],this.ontouchstart(t))},onmousemove:function(t){this.touchStart&&((t.originalEvent||t).touches=[{pageX:t.pageX,pageY:t.pageY}],this.ontouchmove(t))},onmouseup:function(t){this.touchStart&&(this.ontouchend(t),delete this.touchStart)},onmouseout:function(e){if(this.touchStart){var i=e.target,s=e.relatedTarget;(!s||s!==i&&!t.contains(i,s))&&this.onmouseup(e)}},ontouchstart:function(t){var e=(t.originalEvent||t).touches[0];this.touchStart={x:e.pageX,y:e.pageY,time:Date.now()},this.isScrolling=void 0,this.touchDelta={}},ontouchmove:function(t){var e,i,s=(t.originalEvent||t).touches[0],n=(t.originalEvent||t).scale,o=this.index;if(!(s.length>1||n&&1!==n))if(this.options.disableScroll&&t.preventDefault(),this.touchDelta={x:s.pageX-this.touchStart.x,y:s.pageY-this.touchStart.y},e=this.touchDelta.x,void 0===this.isScrolling&&(this.isScrolling=this.isScrolling||Math.abs(e)<Math.abs(this.touchDelta.y)),this.isScrolling)this.options.closeOnSwipeUpOrDown&&this.translateY(o,this.touchDelta.y+this.positions[o],0);else for(t.preventDefault(),window.clearTimeout(this.timeout),this.options.continuous?i=[this.circle(o+1),o,this.circle(o-1)]:(this.touchDelta.x=e/=!o&&e>0||o===this.num-1&&0>e?Math.abs(e)/this.slideWidth+1:1,i=[o],o&&i.push(o-1),o<this.num-1&&i.unshift(o+1));i.length;)o=i.pop(),this.translateX(o,e+this.positions[o],0)},ontouchend:function(){var t,e,i,s,n,o=this.index,l=this.options.transitionSpeed,r=this.slideWidth,a=Number(Date.now()-this.touchStart.time)<250,h=a&&Math.abs(this.touchDelta.x)>20||Math.abs(this.touchDelta.x)>r/2,d=!o&&this.touchDelta.x>0||o===this.num-1&&this.touchDelta.x<0,c=!h&&this.options.closeOnSwipeUpOrDown&&(a&&Math.abs(this.touchDelta.y)>20||Math.abs(this.touchDelta.y)>this.slideHeight/2);this.options.continuous&&(d=!1),t=this.touchDelta.x<0?-1:1,this.isScrolling?c?this.close():this.translateY(o,0,l):h&&!d?(e=o+t,i=o-t,s=r*t,n=-r*t,this.options.continuous?(this.move(this.circle(e),s,0),this.move(this.circle(o-2*t),n,0)):e>=0&&e<this.num&&this.move(e,s,0),this.move(o,this.positions[o]+s,l),this.move(this.circle(i),this.positions[this.circle(i)]+s,l),o=this.circle(i),this.onslide(o)):this.options.continuous?(this.move(this.circle(o-1),-r,l),this.move(o,0,l),this.move(this.circle(o+1),r,l)):(o&&this.move(o-1,-r,l),this.move(o,0,l),o<this.num-1&&this.move(o+1,r,l))},ontransitionend:function(t){var e=this.slides[this.index];t&&e!==t.target||(this.interval&&this.play(),this.setTimeout(this.options.onslideend,[this.index,e]))},oncomplete:function(e){var i,s=e.target||e.srcElement,n=s&&s.parentNode;s&&n&&(i=this.getNodeIndex(n),t(n).removeClass(this.options.slideLoadingClass),"error"===e.type?(t(n).addClass(this.options.slideErrorClass),this.elements[i]=3):this.elements[i]=2,s.clientHeight>this.container[0].clientHeight&&(s.style.maxHeight=this.container[0].clientHeight),this.interval&&this.slides[this.index]===n&&this.play(),this.setTimeout(this.options.onslidecomplete,[i,n]))},onload:function(t){this.oncomplete(t)},onerror:function(t){this.oncomplete(t)},onkeydown:function(t){switch(t.which||t.keyCode){case 13:this.options.toggleControlsOnReturn&&(this.preventDefault(t),this.toggleControls());break;case 27:this.options.closeOnEscape&&this.close();break;case 32:this.options.toggleSlideshowOnSpace&&(this.preventDefault(t),this.toggleSlideshow());break;case 37:this.options.enableKeyboardNavigation&&(this.preventDefault(t),this.prev());break;case 39:this.options.enableKeyboardNavigation&&(this.preventDefault(t),this.next())}},handleClick:function(e){var i=this.options,s=e.target||e.srcElement,n=s.parentNode,o=function(e){return t(s).hasClass(e)||t(n).hasClass(e)};n===this.slidesContainer[0]?(this.preventDefault(e),i.closeOnSlideClick?this.close():this.toggleControls()):n.parentNode&&n.parentNode===this.slidesContainer[0]?(this.preventDefault(e),this.toggleControls()):o(i.toggleClass)?(this.preventDefault(e),this.toggleControls()):o(i.prevClass)?(this.preventDefault(e),this.prev()):o(i.nextClass)?(this.preventDefault(e),this.next()):o(i.closeClass)?(this.preventDefault(e),this.close()):o(i.playPauseClass)&&(this.preventDefault(e),this.toggleSlideshow())},onclick:function(t){return this.options.emulateTouchEvents&&this.touchDelta&&(Math.abs(this.touchDelta.x)>20||Math.abs(this.touchDelta.y)>20)?(delete this.touchDelta,void 0):this.handleClick(t)},updateEdgeClasses:function(t){t?this.container.removeClass(this.options.leftEdgeClass):this.container.addClass(this.options.leftEdgeClass),t===this.num-1?this.container.addClass(this.options.rightEdgeClass):this.container.removeClass(this.options.rightEdgeClass)},handleSlide:function(t){this.options.continuous||this.updateEdgeClasses(t),this.loadElements(t),this.options.unloadElements&&this.unloadElements(t),this.setTitle(t)},onslide:function(t){this.index=t,this.handleSlide(t),this.setTimeout(this.options.onslide,[t,this.slides[t]])},setTitle:function(t){var e=this.slides[t].firstChild.title,i=this.titleElement;i.length&&(this.titleElement.empty(),e&&i[0].appendChild(document.createTextNode(e)))},setTimeout:function(t,e,i){var s=this;return t&&window.setTimeout(function(){t.apply(s,e||[])},i||0)},imageFactory:function(e,i){var s,n,o,l=this,r=this.imagePrototype.cloneNode(!1),a=e,h=this.options.stretchImages&&this.support.backgroundSize&&this.support.backgroundSize.contain,d=function(e){if(!s){if(e={type:e.type,target:n},!n.parentNode)return l.setTimeout(d,[e]);s=!0,t(r).off("load error",d),h&&"load"===e.type&&(n.style.background='url("'+a+'") center no-repeat',n.style.backgroundSize="contain"),i(e)}};return"string"!=typeof a&&(a=this.getItemProperty(e,this.options.urlProperty),o=this.getItemProperty(e,this.options.titleProperty)),h?n=this.elementPrototype.cloneNode(!1):(n=r,r.draggable=!1),o&&(n.title=o),t(r).on("load error",d),r.src=a,n},createElement:function(e,i){var s=e&&this.getItemProperty(e,this.options.typeProperty),n=s&&this[s.split("/")[0]+"Factory"]||this.imageFactory,o=e&&n.call(this,e,i);return o||(o=this.elementPrototype.cloneNode(!1),this.setTimeout(i,[{type:"error",target:o}])),t(o).addClass(this.options.slideContentClass),o},loadElement:function(e){this.elements[e]||(this.slides[e].firstChild?this.elements[e]=t(this.slides[e]).hasClass(this.options.slideErrorClass)?3:2:(this.elements[e]=1,t(this.slides[e]).addClass(this.options.slideLoadingClass),this.slides[e].appendChild(this.createElement(this.list[e],this.proxyListener))))},loadElements:function(t){var e,i=Math.min(this.num,2*this.options.preloadRange+1),s=t;for(e=0;i>e;e+=1)s+=e*(0===e%2?-1:1),s=this.circle(s),this.loadElement(s)},unloadElements:function(t){var e,i,s;for(e in this.elements)this.elements.hasOwnProperty(e)&&(s=Math.abs(t-e),s>this.options.preloadRange&&s+this.options.preloadRange<this.num&&(i=this.slides[e],i.removeChild(i.firstChild),delete this.elements[e]))},addSlide:function(t){var e=this.slidePrototype.cloneNode(!1);e.setAttribute("data-index",t),this.slidesContainer[0].appendChild(e),this.slides.push(e)},positionSlide:function(t){var e=this.slides[t];e.style.width=this.slideWidth+"px",this.support.transition&&(e.style.left=t*-this.slideWidth+"px",this.move(t,this.index>t?-this.slideWidth:this.index<t?this.slideWidth:0,0))},initSlides:function(e){var i,s;for(e||(this.positions=[],this.positions.length=this.num,this.elements={},this.imagePrototype=document.createElement("img"),this.elementPrototype=document.createElement("div"),this.slidePrototype=document.createElement("div"),t(this.slidePrototype).addClass(this.options.slideClass),this.slides=this.slidesContainer[0].children,i=this.options.clearSlides||this.slides.length!==this.num),this.slideWidth=this.container[0].offsetWidth,this.slideHeight=this.container[0].offsetHeight,this.slidesContainer[0].style.width=this.num*this.slideWidth+"px",i&&this.resetSlides(),s=0;s<this.num;s+=1)i&&this.addSlide(s),this.positionSlide(s);this.options.continuous&&this.support.transition&&(this.move(this.circle(this.index-1),-this.slideWidth,0),this.move(this.circle(this.index+1),this.slideWidth,0)),this.support.transition||(this.slidesContainer[0].style.left=this.index*-this.slideWidth+"px")},toggleControls:function(){var t=this.options.controlsClass;this.container.hasClass(t)?this.container.removeClass(t):this.container.addClass(t)},toggleSlideshow:function(){this.interval?this.pause():this.play()},getNodeIndex:function(t){return parseInt(t.getAttribute("data-index"),10)},getNestedProperty:function(t,e){return e.replace(/\[(?:'([^']+)'|"([^"]+)"|(\d+))\]|(?:(?:^|\.)([^\.\[]+))/g,function(e,i,s,n,o){var l=o||i||s||n&&parseInt(n,10);e&&t&&(t=t[l])}),t},getItemProperty:function(t,e){return t[e]||t.getAttribute&&t.getAttribute("data-"+e)||this.getNestedProperty(t,e)},initStartIndex:function(){var t,e=this.options.index,i=this.options.urlProperty;if(e&&"number"!=typeof e)for(t=0;t<this.num;t+=1)if(this.list[t]===e||this.getItemProperty(this.list[t],i)===this.getItemProperty(e,i)){e=t;break}this.index=this.circle(parseInt(e,10)||0)},initEventListeners:function(){var e=this,i=this.slidesContainer,s=function(t){var i=e.support.transition&&e.support.transition.end===t.type?"transitionend":t.type;e["on"+i](t)};t(window).on("resize",s),t(document.body).on("keydown",s),this.container.on("click",s),this.support.touch?i.on("touchstart touchmove touchend",s):this.options.emulateTouchEvents&&this.support.transition&&i.on("mousedown mousemove mouseup mouseout",s),this.support.transition&&i.on(this.support.transition.end,s),this.proxyListener=s},destroyEventListeners:function(){var e=this.slidesContainer,i=this.proxyListener;t(window).off("resize",i),t(document.body).off("keydown",i),this.container.off("click",i),this.support.touch?e.off("touchstart touchmove touchend",i):this.options.emulateTouchEvents&&this.support.transition&&e.off("mousedown mousemove mouseup mouseout",i),this.support.transition&&e.off(this.support.transition.end,i)},handleOpen:function(){this.options.onopened&&this.options.onopened.call(this)},initWidget:function(){var e=this,i=function(t){t.target===e.container[0]&&(e.container.off(e.support.transition.end,i),e.handleOpen())};return this.container=t(this.options.container),this.container.length?(this.slidesContainer=this.container.find(this.options.slidesContainer),this.slidesContainer.length?(this.titleElement=this.container.find(this.options.titleElement),1===this.num&&this.container.addClass(this.options.singleClass),this.options.onopen&&this.options.onopen.call(this),this.support.transition&&this.options.displayTransition?this.container.on(this.support.transition.end,i):this.handleOpen(),this.options.hidePageScrollbars&&(this.bodyOverflowStyle=document.body.style.overflow,document.body.style.overflow="hidden"),this.container[0].style.display="block",this.initSlides(),this.container.addClass(this.options.displayClass),void 0):!1):!1},initOptions:function(e){this.options=t.extend({},this.options),(e&&e.carousel||this.options.carousel&&(!e||e.carousel!==!1))&&t.extend(this.options,this.carouselOptions),t.extend(this.options,e),this.num<3&&(this.options.continuous=this.options.continuous?null:!1),this.support.transition||(this.options.emulateTouchEvents=!1),this.options.event&&this.preventDefault(this.options.event)}}),e}),function(t){"use strict";"function"==typeof define&&define.amd?define(["./blueimp-helper","./blueimp-gallery"],t):t(window.blueimp.helper||window.jQuery,window.blueimp.Gallery)}(function(t,e){"use strict";t.extend(e.prototype.options,{fullScreen:!1});var i=e.prototype.initialize,s=e.prototype.handleClose;return t.extend(e.prototype,{getFullScreenElement:function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement},requestFullScreen:function(t){t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.mozRequestFullScreen&&t.mozRequestFullScreen()},exitFullScreen:function(){document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.mozCancelFullScreen&&document.mozCancelFullScreen()},initialize:function(){i.call(this),this.options.fullScreen&&!this.getFullScreenElement()&&this.requestFullScreen(this.container[0])},handleClose:function(){this.getFullScreenElement()===this.container[0]&&this.exitFullScreen(),s.call(this)}}),e}),function(t){"use strict";"function"==typeof define&&define.amd?define(["./blueimp-helper","./blueimp-gallery"],t):t(window.blueimp.helper||window.jQuery,window.blueimp.Gallery)}(function(t,e){"use strict";t.extend(e.prototype.options,{indicatorContainer:"ol",activeIndicatorClass:"active",thumbnailProperty:"thumbnail",thumbnailIndicators:!0});var i=e.prototype.initSlides,s=e.prototype.addSlide,n=e.prototype.resetSlides,o=e.prototype.handleClick,l=e.prototype.handleSlide,r=e.prototype.handleClose;return t.extend(e.prototype,{createIndicator:function(e){var i,s,n=this.indicatorPrototype.cloneNode(!1),o=this.getItemProperty(e,this.options.titleProperty),l=this.options.thumbnailProperty;return this.options.thumbnailIndicators&&(s=e.getElementsByTagName&&t(e).find("img")[0],s?i=s.src:l&&(i=this.getItemProperty(e,l)),i&&(n.style.backgroundImage='url("'+i+'")')),o&&(n.title=o),n},addIndicator:function(t){if(this.indicatorContainer.length){var e=this.createIndicator(this.list[t]);e.setAttribute("data-index",t),this.indicatorContainer[0].appendChild(e),this.indicators.push(e)}},setActiveIndicator:function(e){this.indicators&&(this.activeIndicator&&this.activeIndicator.removeClass(this.options.activeIndicatorClass),this.activeIndicator=t(this.indicators[e]),this.activeIndicator.addClass(this.options.activeIndicatorClass))},initSlides:function(t){t||(this.indicatorContainer=this.container.find(this.options.indicatorContainer),this.indicatorContainer.length&&(this.indicatorPrototype=document.createElement("li"),this.indicators=this.indicatorContainer[0].children)),i.call(this,t)},addSlide:function(t){s.call(this,t),this.addIndicator(t)},resetSlides:function(){n.call(this),this.indicatorContainer.empty(),this.indicators=[]},handleClick:function(t){var e=t.target||t.srcElement,i=e.parentNode;if(i===this.indicatorContainer[0])this.preventDefault(t),this.slide(this.getNodeIndex(e));else{if(i.parentNode!==this.indicatorContainer[0])return o.call(this,t);this.preventDefault(t),this.slide(this.getNodeIndex(i))}},handleSlide:function(t){l.call(this,t),this.setActiveIndicator(t)},handleClose:function(){this.activeIndicator&&this.activeIndicator.removeClass(this.options.activeIndicatorClass),r.call(this)}}),e}),function(t){"use strict";"function"==typeof define&&define.amd?define(["./blueimp-helper","./blueimp-gallery"],t):t(window.blueimp.helper||window.jQuery,window.blueimp.Gallery)}(function(t,e){"use strict";return t.extend(e.prototype.options,{videoContentClass:"video-content",videoLoadingClass:"video-loading",videoPlayingClass:"video-playing",videoPosterProperty:"poster",videoSourcesProperty:"sources"}),e.prototype.videoFactory=function(e,i){var s,n,o,l,r,a=this,h=this.options,d=this.elementPrototype.cloneNode(!1),c=t(d),u=[{type:"error",target:d}],p=document.createElement("video"),m=this.getItemProperty(e,h.urlProperty),f=this.getItemProperty(e,h.typeProperty),g=this.getItemProperty(e,h.titleProperty),y=this.getItemProperty(e,h.videoPosterProperty),v=this.getItemProperty(e,h.videoSourcesProperty);if(c.addClass(h.videoContentClass),g&&(d.title=g),p.canPlayType)if(m&&f&&p.canPlayType(f))p.src=m;else if(v)for("string"==typeof v&&(v=t.parseJSON(v));v&&v.length;)if(n=v.shift(),m=this.getItemProperty(n,h.urlProperty),f=this.getItemProperty(n,h.typeProperty),m&&f&&p.canPlayType(f)){p.src=m;break}return y&&(p.setAttribute("poster",y),s=this.imagePrototype.cloneNode(!1),t(s).addClass(h.toggleClass),s.src=y,s.draggable=!1,d.appendChild(s)),o=document.createElement("a"),o.setAttribute("target","_blank"),o.setAttribute("download",g),o.href=m,p.src&&(p.controls=!0,t(p).on("error",function(){a.setTimeout(i,u)}).on("pause",function(){l=!1,c.removeClass(a.options.videoLoadingClass).removeClass(a.options.videoPlayingClass),r&&a.container.addClass(a.options.controlsClass),a.interval&&a.play()}).on("playing",function(){l=!1,c.removeClass(a.options.videoLoadingClass).addClass(a.options.videoPlayingClass),a.container.hasClass(a.options.controlsClass)?(r=!0,a.container.removeClass(a.options.controlsClass)):r=!1}).on("play",function(){window.clearTimeout(a.timeout),l=!0,c.addClass(a.options.videoLoadingClass)}),t(o).on("click",function(t){t.preventDefault(),l?p.pause():p.play()}),d.appendChild(p)),d.appendChild(o),this.setTimeout(i,[{type:"load",target:d}]),d},e}),function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","./blueimp-gallery.js"],t):t(window.jQuery,window.blueimp.Gallery)}(function(t,e){"use strict";t(document).on("click","[data-gallery]",function(i){var s=t(this).data("gallery"),n=t(s),o=n.length&&n||t(e.prototype.options.container),l=t.extend(o.data(),{container:o[0],index:this,event:i,onopen:function(){o.data("gallery",this).trigger("open")},onopened:function(){o.trigger("opened")},onslide:function(){o.trigger("slide",arguments)},onslideend:function(){o.trigger("slideend",arguments)},onslidecomplete:function(){o.trigger("slidecomplete",arguments)},onclose:function(){o.trigger("close")},onclosed:function(){o.trigger("closed").removeData("gallery")}}),r=t('[data-gallery="'+s+'"]');return l.filter&&(r=r.filter(l.filter)),new e(r,l)})});
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-angular.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-angular.js
deleted file mode 100644
index 8f4abac188..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-angular.js
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * jQuery File Upload AngularJS Plugin 1.4.4
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2013, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint nomen: true, unparam: true */
-/*global define, angular */
-
-(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define([
- 'jquery',
- 'angular',
- './jquery.fileupload-image',
- './jquery.fileupload-audio',
- './jquery.fileupload-video',
- './jquery.fileupload-validate'
- ], factory);
- } else {
- factory();
- }
-}(function () {
- 'use strict';
-
- angular.module('blueimp.fileupload', [])
-
- // The fileUpload service provides configuration options
- // for the fileUpload directive and default handlers for
- // File Upload events:
- .provider('fileUpload', function () {
- var scopeApply = function () {
- var scope = angular.element(this)
- .fileupload('option', 'scope')(),
- $timeout = angular.injector(['ng'])
- .get('$timeout');
- // Safe apply, makes sure $apply is called
- // asynchronously outside of the $digest cycle:
- $timeout(function () {
- scope.$apply();
- });
- },
- $config;
- $config = this.defaults = {
- handleResponse: function (e, data) {
- var files = data.result && data.result.files;
- if (files) {
- data.scope().replace(data.files, files);
- } else if (data.errorThrown ||
- data.textStatus === 'error') {
- data.files[0].error = data.errorThrown ||
- data.textStatus;
- }
- },
- add: function (e, data) {
- var scope = data.scope();
- data.process(function () {
- return scope.process(data);
- }).always(
- function () {
- var file = data.files[0],
- submit = function () {
- return data.submit();
- };
- angular.forEach(data.files, function (file, index) {
- file._index = index;
- file.$state = function () {
- return data.state();
- };
- file.$progress = function () {
- return data.progress();
- };
- file.$response = function () {
- return data.response();
- };
- });
- file.$cancel = function () {
- scope.clear(data.files);
- return data.abort();
- };
- if (file.$state() === 'rejected') {
- file._$submit = submit;
- } else {
- file.$submit = submit;
- }
- scope.$apply(function () {
- var method = scope.option('prependFiles') ?
- 'unshift' : 'push';
- Array.prototype[method].apply(
- scope.queue,
- data.files
- );
- if (file.$submit &&
- (scope.option('autoUpload') ||
- data.autoUpload) &&
- data.autoUpload !== false) {
- file.$submit();
- }
- });
- }
- );
- },
- progress: function (e, data) {
- data.scope().$apply();
- },
- done: function (e, data) {
- var that = this;
- data.scope().$apply(function () {
- data.handleResponse.call(that, e, data);
- });
- },
- fail: function (e, data) {
- var that = this;
- if (data.errorThrown === 'abort') {
- return;
- }
- if (data.dataType &&
- data.dataType.indexOf('json') === data.dataType.length - 4) {
- try {
- data.result = angular.fromJson(data.jqXHR.responseText);
- } catch (ignore) {}
- }
- data.scope().$apply(function () {
- data.handleResponse.call(that, e, data);
- });
- },
- stop: scopeApply,
- processstart: scopeApply,
- processstop: scopeApply,
- getNumberOfFiles: function () {
- return this.scope().queue.length;
- },
- dataType: 'json',
- autoUpload: false
- };
- this.$get = [
- function () {
- return {
- defaults: $config
- };
- }
- ];
- })
-
- // Format byte numbers to readable presentations:
- .provider('formatFileSizeFilter', function () {
- var $config = {
- // Byte units following the IEC format
- // http://en.wikipedia.org/wiki/Kilobyte
- units: [
- {size: 1000000000, suffix: ' GB'},
- {size: 1000000, suffix: ' MB'},
- {size: 1000, suffix: ' KB'}
- ]
- };
- this.defaults = $config;
- this.$get = function () {
- return function (bytes) {
- if (!angular.isNumber(bytes)) {
- return '';
- }
- var unit = true,
- i = 0,
- prefix,
- suffix;
- while (unit) {
- unit = $config.units[i];
- prefix = unit.prefix || '';
- suffix = unit.suffix || '';
- if (i === $config.units.length - 1 || bytes >= unit.size) {
- return prefix + (bytes / unit.size).toFixed(2) + suffix;
- }
- i += 1;
- }
- };
- };
- })
-
- // The FileUploadController initializes the fileupload widget and
- // provides scope methods to control the File Upload functionality:
- .controller('FileUploadController', [
- '$scope', '$element', '$attrs', '$window', 'fileUpload',
- function ($scope, $element, $attrs, $window, fileUpload) {
- var uploadMethods = {
- progress: function () {
- return $element.fileupload('progress');
- },
- active: function () {
- return $element.fileupload('active');
- },
- option: function (option, data) {
- return $element.fileupload('option', option, data);
- },
- add: function (data) {
- return $element.fileupload('add', data);
- },
- send: function (data) {
- return $element.fileupload('send', data);
- },
- process: function (data) {
- return $element.fileupload('process', data);
- },
- processing: function (data) {
- return $element.fileupload('processing', data);
- }
- };
- $scope.disabled = !$window.jQuery.support.fileInput;
- $scope.queue = $scope.queue || [];
- $scope.clear = function (files) {
- var queue = this.queue,
- i = queue.length,
- file = files,
- length = 1;
- if (angular.isArray(files)) {
- file = files[0];
- length = files.length;
- }
- while (i) {
- i -= 1;
- if (queue[i] === file) {
- return queue.splice(i, length);
- }
- }
- };
- $scope.replace = function (oldFiles, newFiles) {
- var queue = this.queue,
- file = oldFiles[0],
- i,
- j;
- for (i = 0; i < queue.length; i += 1) {
- if (queue[i] === file) {
- for (j = 0; j < newFiles.length; j += 1) {
- queue[i + j] = newFiles[j];
- }
- return;
- }
- }
- };
- $scope.applyOnQueue = function (method) {
- var list = this.queue.slice(0),
- i,
- file;
- for (i = 0; i < list.length; i += 1) {
- file = list[i];
- if (file[method]) {
- file[method]();
- }
- }
- };
- $scope.submit = function () {
- this.applyOnQueue('$submit');
- };
- $scope.cancel = function () {
- this.applyOnQueue('$cancel');
- };
- // Add upload methods to the scope:
- angular.extend($scope, uploadMethods);
- // The fileupload widget will initialize with
- // the options provided via "data-"-parameters,
- // as well as those given via options object:
- $element.fileupload(angular.extend(
- {scope: function () {
- return $scope;
- }},
- fileUpload.defaults
- )).on('fileuploadadd', function (e, data) {
- data.scope = $scope.option('scope');
- }).on([
- 'fileuploadadd',
- 'fileuploadsubmit',
- 'fileuploadsend',
- 'fileuploaddone',
- 'fileuploadfail',
- 'fileuploadalways',
- 'fileuploadprogress',
- 'fileuploadprogressall',
- 'fileuploadstart',
- 'fileuploadstop',
- 'fileuploadchange',
- 'fileuploadpaste',
- 'fileuploaddrop',
- 'fileuploaddragover',
- 'fileuploadchunksend',
- 'fileuploadchunkdone',
- 'fileuploadchunkfail',
- 'fileuploadchunkalways',
- 'fileuploadprocessstart',
- 'fileuploadprocess',
- 'fileuploadprocessdone',
- 'fileuploadprocessfail',
- 'fileuploadprocessalways',
- 'fileuploadprocessstop'
- ].join(' '), function (e, data) {
- if ($scope.$emit(e.type, data).defaultPrevented) {
- e.preventDefault();
- }
- }).on('remove', function () {
- // Remove upload methods from the scope,
- // when the widget is removed:
- var method;
- for (method in uploadMethods) {
- if (uploadMethods.hasOwnProperty(method)) {
- delete $scope[method];
- }
- }
- });
- // Observe option changes:
- $scope.$watch(
- $attrs.fileUpload,
- function (newOptions) {
- if (newOptions) {
- $element.fileupload('option', newOptions);
- }
- }
- );
- }
- ])
-
- // Provide File Upload progress feedback:
- .controller('FileUploadProgressController', [
- '$scope', '$attrs', '$parse',
- function ($scope, $attrs, $parse) {
- var fn = $parse($attrs.fileUploadProgress),
- update = function () {
- var progress = fn($scope);
- if (!progress || !progress.total) {
- return;
- }
- $scope.num = Math.floor(
- progress.loaded / progress.total * 100
- );
- };
- update();
- $scope.$watch(
- $attrs.fileUploadProgress + '.loaded',
- function (newValue, oldValue) {
- if (newValue !== oldValue) {
- update();
- }
- }
- );
- }
- ])
-
- // Display File Upload previews:
- .controller('FileUploadPreviewController', [
- '$scope', '$element', '$attrs', '$parse',
- function ($scope, $element, $attrs, $parse) {
- var fn = $parse($attrs.fileUploadPreview),
- file = fn($scope);
- if (file.preview) {
- $element.append(file.preview);
- }
- }
- ])
-
- .directive('fileUpload', function () {
- return {
- controller: 'FileUploadController'
- };
- })
-
- .directive('fileUploadProgress', function () {
- return {
- controller: 'FileUploadProgressController'
- };
- })
-
- .directive('fileUploadPreview', function () {
- return {
- controller: 'FileUploadPreviewController'
- };
- })
-
- // Enhance the HTML5 download attribute to
- // allow drag&drop of files to the desktop:
- .directive('download', function () {
- return function (scope, elm) {
- elm.on('dragstart', function (e) {
- try {
- e.originalEvent.dataTransfer.setData(
- 'DownloadURL',
- [
- 'application/octet-stream',
- elm.prop('download'),
- elm.prop('href')
- ].join(':')
- );
- } catch (ignore) {}
- });
- };
- });
-
-}));
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-audio.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-audio.js
deleted file mode 100644
index f59c2fa5fc..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-audio.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * jQuery File Upload Audio Preview Plugin 1.0.3
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2013, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint nomen: true, unparam: true, regexp: true */
-/*global define, window, document */
-
-(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define([
- 'jquery',
- 'load-image',
- './jquery.fileupload-process'
- ], factory);
- } else {
- // Browser globals:
- factory(
- window.jQuery,
- window.loadImage
- );
- }
-}(function ($, loadImage) {
- 'use strict';
-
- // Prepend to the default processQueue:
- $.blueimp.fileupload.prototype.options.processQueue.unshift(
- {
- action: 'loadAudio',
- // Use the action as prefix for the "@" options:
- prefix: true,
- fileTypes: '@',
- maxFileSize: '@',
- disabled: '@disableAudioPreview'
- },
- {
- action: 'setAudio',
- name: '@audioPreviewName',
- disabled: '@disableAudioPreview'
- }
- );
-
- // The File Upload Audio Preview plugin extends the fileupload widget
- // with audio preview functionality:
- $.widget('blueimp.fileupload', $.blueimp.fileupload, {
-
- options: {
- // The regular expression for the types of audio files to load,
- // matched against the file type:
- loadAudioFileTypes: /^audio\/.*$/
- },
-
- _audioElement: document.createElement('audio'),
-
- processActions: {
-
- // Loads the audio file given via data.files and data.index
- // as audio element if the browser supports playing it.
- // Accepts the options fileTypes (regular expression)
- // and maxFileSize (integer) to limit the files to load:
- loadAudio: function (data, options) {
- if (options.disabled) {
- return data;
- }
- var file = data.files[data.index],
- url,
- audio;
- if (this._audioElement.canPlayType &&
- this._audioElement.canPlayType(file.type) &&
- ($.type(options.maxFileSize) !== 'number' ||
- file.size <= options.maxFileSize) &&
- (!options.fileTypes ||
- options.fileTypes.test(file.type))) {
- url = loadImage.createObjectURL(file);
- if (url) {
- audio = this._audioElement.cloneNode(false);
- audio.src = url;
- audio.controls = true;
- data.audio = audio;
- return data;
- }
- }
- return data;
- },
-
- // Sets the audio element as a property of the file object:
- setAudio: function (data, options) {
- if (data.audio && !options.disabled) {
- data.files[data.index][options.name || 'preview'] = data.audio;
- }
- return data;
- }
-
- }
-
- });
-
-}));
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-image.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-image.js
deleted file mode 100644
index 84474a7b3b..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-image.js
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * jQuery File Upload Image Preview & Resize Plugin 1.2.3
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2013, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint nomen: true, unparam: true, regexp: true */
-/*global define, window, document, DataView, Blob, Uint8Array */
-
-(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define([
- 'jquery',
- 'load-image',
- 'load-image-meta',
- 'load-image-exif',
- 'load-image-ios',
- 'canvas-to-blob',
- './jquery.fileupload-process'
- ], factory);
- } else {
- // Browser globals:
- factory(
- window.jQuery,
- window.loadImage
- );
- }
-}(function ($, loadImage) {
- 'use strict';
-
- // Prepend to the default processQueue:
- $.blueimp.fileupload.prototype.options.processQueue.unshift(
- {
- action: 'loadImageMetaData',
- disableImageHead: '@',
- disableExif: '@',
- disableExifThumbnail: '@',
- disableExifSub: '@',
- disableExifGps: '@',
- disabled: '@disableImageMetaDataLoad'
- },
- {
- action: 'loadImage',
- // Use the action as prefix for the "@" options:
- prefix: true,
- fileTypes: '@',
- maxFileSize: '@',
- noRevoke: '@',
- disabled: '@disableImageLoad'
- },
- {
- action: 'resizeImage',
- // Use "image" as prefix for the "@" options:
- prefix: 'image',
- maxWidth: '@',
- maxHeight: '@',
- minWidth: '@',
- minHeight: '@',
- crop: '@',
- disabled: '@disableImageResize'
- },
- {
- action: 'saveImage',
- disabled: '@disableImageResize'
- },
- {
- action: 'saveImageMetaData',
- disabled: '@disableImageMetaDataSave'
- },
- {
- action: 'resizeImage',
- // Use "preview" as prefix for the "@" options:
- prefix: 'preview',
- maxWidth: '@',
- maxHeight: '@',
- minWidth: '@',
- minHeight: '@',
- crop: '@',
- orientation: '@',
- thumbnail: '@',
- canvas: '@',
- disabled: '@disableImagePreview'
- },
- {
- action: 'setImage',
- name: '@imagePreviewName',
- disabled: '@disableImagePreview'
- }
- );
-
- // The File Upload Resize plugin extends the fileupload widget
- // with image resize functionality:
- $.widget('blueimp.fileupload', $.blueimp.fileupload, {
-
- options: {
- // The regular expression for the types of images to load:
- // matched against the file type:
- loadImageFileTypes: /^image\/(gif|jpeg|png)$/,
- // The maximum file size of images to load:
- loadImageMaxFileSize: 10000000, // 10MB
- // The maximum width of resized images:
- imageMaxWidth: 1920,
- // The maximum height of resized images:
- imageMaxHeight: 1080,
- // Define if resized images should be cropped or only scaled:
- imageCrop: false,
- // Disable the resize image functionality by default:
- disableImageResize: true,
- // The maximum width of the preview images:
- previewMaxWidth: 80,
- // The maximum height of the preview images:
- previewMaxHeight: 80,
- // Defines the preview orientation (1-8) or takes the orientation
- // value from Exif data if set to true:
- previewOrientation: true,
- // Create the preview using the Exif data thumbnail:
- previewThumbnail: true,
- // Define if preview images should be cropped or only scaled:
- previewCrop: false,
- // Define if preview images should be resized as canvas elements:
- previewCanvas: true
- },
-
- processActions: {
-
- // Loads the image given via data.files and data.index
- // as img element if the browser supports canvas.
- // Accepts the options fileTypes (regular expression)
- // and maxFileSize (integer) to limit the files to load:
- loadImage: function (data, options) {
- if (options.disabled) {
- return data;
- }
- var that = this,
- file = data.files[data.index],
- dfd = $.Deferred();
- if (($.type(options.maxFileSize) === 'number' &&
- file.size > options.maxFileSize) ||
- (options.fileTypes &&
- !options.fileTypes.test(file.type)) ||
- !loadImage(
- file,
- function (img) {
- if (img.src) {
- data.img = img;
- }
- dfd.resolveWith(that, [data]);
- },
- options
- )) {
- return data;
- }
- return dfd.promise();
- },
-
- // Resizes the image given as data.canvas or data.img
- // and updates data.canvas or data.img with the resized image.
- // Accepts the options maxWidth, maxHeight, minWidth,
- // minHeight, canvas and crop:
- resizeImage: function (data, options) {
- if (options.disabled) {
- return data;
- }
- var that = this,
- dfd = $.Deferred(),
- resolve = function (newImg) {
- data[newImg.getContext ? 'canvas' : 'img'] = newImg;
- dfd.resolveWith(that, [data]);
- },
- thumbnail,
- img,
- newImg;
- options = $.extend({canvas: true}, options);
- if (data.exif) {
- if (options.orientation === true) {
- options.orientation = data.exif.get('Orientation');
- }
- if (options.thumbnail) {
- thumbnail = data.exif.get('Thumbnail');
- if (thumbnail) {
- loadImage(thumbnail, resolve, options);
- return dfd.promise();
- }
- }
- }
- img = (options.canvas && data.canvas) || data.img;
- if (img) {
- newImg = loadImage.scale(img, options);
- if (newImg.width !== img.width ||
- newImg.height !== img.height) {
- resolve(newImg);
- return dfd.promise();
- }
- }
- return data;
- },
-
- // Saves the processed image given as data.canvas
- // inplace at data.index of data.files:
- saveImage: function (data, options) {
- if (!data.canvas || options.disabled) {
- return data;
- }
- var that = this,
- file = data.files[data.index],
- name = file.name,
- dfd = $.Deferred(),
- callback = function (blob) {
- if (!blob.name) {
- if (file.type === blob.type) {
- blob.name = file.name;
- } else if (file.name) {
- blob.name = file.name.replace(
- /\..+$/,
- '.' + blob.type.substr(6)
- );
- }
- }
- // Store the created blob at the position
- // of the original file in the files list:
- data.files[data.index] = blob;
- dfd.resolveWith(that, [data]);
- };
- // Use canvas.mozGetAsFile directly, to retain the filename, as
- // Gecko doesn't support the filename option for FormData.append:
- if (data.canvas.mozGetAsFile) {
- callback(data.canvas.mozGetAsFile(
- (/^image\/(jpeg|png)$/.test(file.type) && name) ||
- ((name && name.replace(/\..+$/, '')) ||
- 'blob') + '.png',
- file.type
- ));
- } else if (data.canvas.toBlob) {
- data.canvas.toBlob(callback, file.type);
- } else {
- return data;
- }
- return dfd.promise();
- },
-
- loadImageMetaData: function (data, options) {
- if (options.disabled) {
- return data;
- }
- var that = this,
- dfd = $.Deferred();
- loadImage.parseMetaData(data.files[data.index], function (result) {
- $.extend(data, result);
- dfd.resolveWith(that, [data]);
- }, options);
- return dfd.promise();
- },
-
- saveImageMetaData: function (data, options) {
- if (!(data.imageHead && data.canvas &&
- data.canvas.toBlob && !options.disabled)) {
- return data;
- }
- var file = data.files[data.index],
- blob = new Blob([
- data.imageHead,
- // Resized images always have a head size of 20 bytes,
- // including the JPEG marker and a minimal JFIF header:
- this._blobSlice.call(file, 20)
- ], {type: file.type});
- blob.name = file.name;
- data.files[data.index] = blob;
- return data;
- },
-
- // Sets the resized version of the image as a property of the
- // file object, must be called after "saveImage":
- setImage: function (data, options) {
- var img = data.canvas || data.img;
- if (img && !options.disabled) {
- data.files[data.index][options.name || 'preview'] = img;
- }
- return data;
- }
-
- }
-
- });
-
-}));
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-jquery-ui.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-jquery-ui.js
deleted file mode 100755
index 05dd7a6117..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-jquery-ui.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * jQuery File Upload jQuery UI Plugin 8.7.0
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2013, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint nomen: true, unparam: true */
-/*global define, window */
-
-(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define(['jquery', './jquery.fileupload-ui'], factory);
- } else {
- // Browser globals:
- factory(window.jQuery);
- }
-}(function ($) {
- 'use strict';
-
- $.widget('blueimp.fileupload', $.blueimp.fileupload, {
-
- options: {
- progress: function (e, data) {
- if (data.context) {
- data.context.find('.progress').progressbar(
- 'option',
- 'value',
- parseInt(data.loaded / data.total * 100, 10)
- );
- }
- },
- progressall: function (e, data) {
- var $this = $(this);
- $this.find('.fileupload-progress')
- .find('.progress').progressbar(
- 'option',
- 'value',
- parseInt(data.loaded / data.total * 100, 10)
- ).end()
- .find('.progress-extended').each(function () {
- $(this).html(
- ($this.data('blueimp-fileupload') ||
- $this.data('fileupload'))
- ._renderExtendedProgress(data)
- );
- });
- }
- },
-
- _renderUpload: function (func, files) {
- var node = this._super(func, files),
- showIconText = $(window).width() > 480;
- node.find('.progress').empty().progressbar();
- node.find('.start').button({
- icons: {primary: 'ui-icon-circle-arrow-e'},
- text: showIconText
- });
- node.find('.cancel').button({
- icons: {primary: 'ui-icon-cancel'},
- text: showIconText
- });
- return node;
- },
-
- _renderDownload: function (func, files) {
- var node = this._super(func, files),
- showIconText = $(window).width() > 480;
- node.find('.delete').button({
- icons: {primary: 'ui-icon-trash'},
- text: showIconText
- });
- return node;
- },
-
- _transition: function (node) {
- var deferred = $.Deferred();
- if (node.hasClass('fade')) {
- node.fadeToggle(
- this.options.transitionDuration,
- this.options.transitionEasing,
- function () {
- deferred.resolveWith(node);
- }
- );
- } else {
- deferred.resolveWith(node);
- }
- return deferred;
- },
-
- _create: function () {
- this._super();
- this.element
- .find('.fileupload-buttonbar')
- .find('.fileinput-button').each(function () {
- var input = $(this).find('input:file').detach();
- $(this)
- .button({icons: {primary: 'ui-icon-plusthick'}})
- .append(input);
- })
- .end().find('.start')
- .button({icons: {primary: 'ui-icon-circle-arrow-e'}})
- .end().find('.cancel')
- .button({icons: {primary: 'ui-icon-cancel'}})
- .end().find('.delete')
- .button({icons: {primary: 'ui-icon-trash'}})
- .end().find('.progress').progressbar();
- },
-
- _destroy: function () {
- this.element
- .find('.fileupload-buttonbar')
- .find('.fileinput-button').each(function () {
- var input = $(this).find('input:file').detach();
- $(this)
- .button('destroy')
- .append(input);
- })
- .end().find('.start')
- .button('destroy')
- .end().find('.cancel')
- .button('destroy')
- .end().find('.delete')
- .button('destroy')
- .end().find('.progress').progressbar('destroy');
- this._super();
- }
-
- });
-
-}));
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-process.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-process.js
deleted file mode 100644
index 87042c3d57..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-process.js
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * jQuery File Upload Processing Plugin 1.2.2
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2012, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint nomen: true, unparam: true */
-/*global define, window */
-
-(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define([
- 'jquery',
- './jquery.fileupload'
- ], factory);
- } else {
- // Browser globals:
- factory(
- window.jQuery
- );
- }
-}(function ($) {
- 'use strict';
-
- var originalAdd = $.blueimp.fileupload.prototype.options.add;
-
- // The File Upload Processing plugin extends the fileupload widget
- // with file processing functionality:
- $.widget('blueimp.fileupload', $.blueimp.fileupload, {
-
- options: {
- // The list of processing actions:
- processQueue: [
- /*
- {
- action: 'log',
- type: 'debug'
- }
- */
- ],
- add: function (e, data) {
- var $this = $(this);
- data.process(function () {
- return $this.fileupload('process', data);
- });
- originalAdd.call(this, e, data);
- }
- },
-
- processActions: {
- /*
- log: function (data, options) {
- console[options.type](
- 'Processing "' + data.files[data.index].name + '"'
- );
- }
- */
- },
-
- _processFile: function (data) {
- var that = this,
- dfd = $.Deferred().resolveWith(that, [data]),
- chain = dfd.promise();
- this._trigger('process', null, data);
- $.each(data.processQueue, function (i, settings) {
- var func = function (data) {
- return that.processActions[settings.action].call(
- that,
- data,
- settings
- );
- };
- chain = chain.pipe(func, settings.always && func);
- });
- chain
- .done(function () {
- that._trigger('processdone', null, data);
- that._trigger('processalways', null, data);
- })
- .fail(function () {
- that._trigger('processfail', null, data);
- that._trigger('processalways', null, data);
- });
- return chain;
- },
-
- // Replaces the settings of each processQueue item that
- // are strings starting with an "@", using the remaining
- // substring as key for the option map,
- // e.g. "@autoUpload" is replaced with options.autoUpload:
- _transformProcessQueue: function (options) {
- var processQueue = [];
- $.each(options.processQueue, function () {
- var settings = {},
- action = this.action,
- prefix = this.prefix === true ? action : this.prefix;
- $.each(this, function (key, value) {
- if ($.type(value) === 'string' &&
- value.charAt(0) === '@') {
- settings[key] = options[
- value.slice(1) || (prefix ? prefix +
- key.charAt(0).toUpperCase() + key.slice(1) : key)
- ];
- } else {
- settings[key] = value;
- }
-
- });
- processQueue.push(settings);
- });
- options.processQueue = processQueue;
- },
-
- // Returns the number of files currently in the processsing queue:
- processing: function () {
- return this._processing;
- },
-
- // Processes the files given as files property of the data parameter,
- // returns a Promise object that allows to bind callbacks:
- process: function (data) {
- var that = this,
- options = $.extend({}, this.options, data);
- if (options.processQueue && options.processQueue.length) {
- this._transformProcessQueue(options);
- if (this._processing === 0) {
- this._trigger('processstart');
- }
- $.each(data.files, function (index) {
- var opts = index ? $.extend({}, options) : options,
- func = function () {
- return that._processFile(opts);
- };
- opts.index = index;
- that._processing += 1;
- that._processingQueue = that._processingQueue.pipe(func, func)
- .always(function () {
- that._processing -= 1;
- if (that._processing === 0) {
- that._trigger('processstop');
- }
- });
- });
- }
- return this._processingQueue;
- },
-
- _create: function () {
- this._super();
- this._processing = 0;
- this._processingQueue = $.Deferred().resolveWith(this)
- .promise();
- }
-
- });
-
-}));
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-ui.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-ui.js
deleted file mode 100644
index 4006a64b3d..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-ui.js
+++ /dev/null
@@ -1,647 +0,0 @@
-/*
- * jQuery File Upload User Interface Plugin 8.8.5
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2010, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint nomen: true, unparam: true, regexp: true */
-/*global define, window, URL, webkitURL, FileReader */
-
-(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define([
- 'jquery',
- 'tmpl',
- './jquery.fileupload-image',
- './jquery.fileupload-audio',
- './jquery.fileupload-video',
- './jquery.fileupload-validate'
- ], factory);
- } else {
- // Browser globals:
- factory(
- window.jQuery,
- window.tmpl
- );
- }
-}(function ($, tmpl, loadImage) {
- 'use strict';
-
- $.blueimp.fileupload.prototype._specialOptions.push(
- 'filesContainer',
- 'uploadTemplateId',
- 'downloadTemplateId'
- );
-
- // The UI version extends the file upload widget
- // and adds complete user interface interaction:
- $.widget('blueimp.fileupload', $.blueimp.fileupload, {
-
- options: {
- // By default, files added to the widget are uploaded as soon
- // as the user clicks on the start buttons. To enable automatic
- // uploads, set the following option to true:
- autoUpload: false,
- // The ID of the upload template:
- uploadTemplateId: 'template-upload',
- // The ID of the download template:
- downloadTemplateId: 'template-download',
- // The container for the list of files. If undefined, it is set to
- // an element with class "files" inside of the widget element:
- filesContainer: undefined,
- // By default, files are appended to the files container.
- // Set the following option to true, to prepend files instead:
- prependFiles: false,
- // The expected data type of the upload response, sets the dataType
- // option of the $.ajax upload requests:
- dataType: 'json',
-
- // Function returning the current number of files,
- // used by the maxNumberOfFiles validation:
- getNumberOfFiles: function () {
- return this.filesContainer.children().length;
- },
-
- // Callback to retrieve the list of files from the server response:
- getFilesFromResponse: function (data) {
- if (data.result && $.isArray(data.result.files)) {
- return data.result.files;
- }
- return [];
- },
-
- // The add callback is invoked as soon as files are added to the fileupload
- // widget (via file input selection, drag & drop or add API call).
- // See the basic file upload widget for more information:
- add: function (e, data) {
- var $this = $(this),
- that = $this.data('blueimp-fileupload') ||
- $this.data('fileupload'),
- options = that.options,
- files = data.files;
- data.process(function () {
- return $this.fileupload('process', data);
- }).always(function () {
- data.context = that._renderUpload(files).data('data', data);
- that._renderPreviews(data);
- options.filesContainer[
- options.prependFiles ? 'prepend' : 'append'
- ](data.context);
- that._forceReflow(data.context);
- that._transition(data.context).done(
- function () {
- if ((that._trigger('added', e, data) !== false) &&
- (options.autoUpload || data.autoUpload) &&
- data.autoUpload !== false && !data.files.error) {
- data.submit();
- }
- }
- );
- });
- },
- // Callback for the start of each file upload request:
- send: function (e, data) {
- var that = $(this).data('blueimp-fileupload') ||
- $(this).data('fileupload');
- if (data.context && data.dataType &&
- data.dataType.substr(0, 6) === 'iframe') {
- // Iframe Transport does not support progress events.
- // In lack of an indeterminate progress bar, we set
- // the progress to 100%, showing the full animated bar:
- data.context
- .find('.progress').addClass(
- !$.support.transition && 'progress-animated'
- )
- .attr('aria-valuenow', 100)
- .children().first().css(
- 'width',
- '100%'
- );
- }
- return that._trigger('sent', e, data);
- },
- // Callback for successful uploads:
- done: function (e, data) {
- var that = $(this).data('blueimp-fileupload') ||
- $(this).data('fileupload'),
- getFilesFromResponse = data.getFilesFromResponse ||
- that.options.getFilesFromResponse,
- files = getFilesFromResponse(data),
- template,
- deferred;
- if (data.context) {
- data.context.each(function (index) {
- var file = files[index] ||
- {error: 'Empty file upload result'};
- deferred = that._addFinishedDeferreds();
- that._transition($(this)).done(
- function () {
- var node = $(this);
- template = that._renderDownload([file])
- .replaceAll(node);
- that._forceReflow(template);
- that._transition(template).done(
- function () {
- data.context = $(this);
- that._trigger('completed', e, data);
- that._trigger('finished', e, data);
- deferred.resolve();
- }
- );
- }
- );
- });
- } else {
- template = that._renderDownload(files)[
- that.options.prependFiles ? 'prependTo' : 'appendTo'
- ](that.options.filesContainer);
- that._forceReflow(template);
- deferred = that._addFinishedDeferreds();
- that._transition(template).done(
- function () {
- data.context = $(this);
- that._trigger('completed', e, data);
- that._trigger('finished', e, data);
- deferred.resolve();
- }
- );
- }
- },
- // Callback for failed (abort or error) uploads:
- fail: function (e, data) {
- var that = $(this).data('blueimp-fileupload') ||
- $(this).data('fileupload'),
- template,
- deferred;
- if (data.context) {
- data.context.each(function (index) {
- if (data.errorThrown !== 'abort') {
- var file = data.files[index];
- file.error = file.error || data.errorThrown ||
- true;
- deferred = that._addFinishedDeferreds();
- that._transition($(this)).done(
- function () {
- var node = $(this);
- template = that._renderDownload([file])
- .replaceAll(node);
- that._forceReflow(template);
- that._transition(template).done(
- function () {
- data.context = $(this);
- that._trigger('failed', e, data);
- that._trigger('finished', e, data);
- deferred.resolve();
- }
- );
- }
- );
- } else {
- deferred = that._addFinishedDeferreds();
- that._transition($(this)).done(
- function () {
- $(this).remove();
- that._trigger('failed', e, data);
- that._trigger('finished', e, data);
- deferred.resolve();
- }
- );
- }
- });
- } else if (data.errorThrown !== 'abort') {
- data.context = that._renderUpload(data.files)[
- that.options.prependFiles ? 'prependTo' : 'appendTo'
- ](that.options.filesContainer)
- .data('data', data);
- that._forceReflow(data.context);
- deferred = that._addFinishedDeferreds();
- that._transition(data.context).done(
- function () {
- data.context = $(this);
- that._trigger('failed', e, data);
- that._trigger('finished', e, data);
- deferred.resolve();
- }
- );
- } else {
- that._trigger('failed', e, data);
- that._trigger('finished', e, data);
- that._addFinishedDeferreds().resolve();
- }
- },
- // Callback for upload progress events:
- progress: function (e, data) {
- var progress = Math.floor(data.loaded / data.total * 100);
- if (data.context) {
- data.context.each(function () {
- $(this).find('.progress')
- .attr('aria-valuenow', progress)
- .children().first().css(
- 'width',
- progress + '%'
- );
- });
- }
- },
- // Callback for global upload progress events:
- progressall: function (e, data) {
- var $this = $(this),
- progress = Math.floor(data.loaded / data.total * 100),
- globalProgressNode = $this.find('.fileupload-progress'),
- extendedProgressNode = globalProgressNode
- .find('.progress-extended');
- if (extendedProgressNode.length) {
- extendedProgressNode.html(
- ($this.data('blueimp-fileupload') || $this.data('fileupload'))
- ._renderExtendedProgress(data)
- );
- }
- globalProgressNode
- .find('.progress')
- .attr('aria-valuenow', progress)
- .children().first().css(
- 'width',
- progress + '%'
- );
- },
- // Callback for uploads start, equivalent to the global ajaxStart event:
- start: function (e) {
- var that = $(this).data('blueimp-fileupload') ||
- $(this).data('fileupload');
- that._resetFinishedDeferreds();
- that._transition($(this).find('.fileupload-progress')).done(
- function () {
- that._trigger('started', e);
- }
- );
- },
- // Callback for uploads stop, equivalent to the global ajaxStop event:
- stop: function (e) {
- var that = $(this).data('blueimp-fileupload') ||
- $(this).data('fileupload'),
- deferred = that._addFinishedDeferreds();
- $.when.apply($, that._getFinishedDeferreds())
- .done(function () {
- that._trigger('stopped', e);
- });
- that._transition($(this).find('.fileupload-progress')).done(
- function () {
- $(this).find('.progress')
- .attr('aria-valuenow', '0')
- .children().first().css('width', '0%');
- $(this).find('.progress-extended').html('&nbsp;');
- deferred.resolve();
- }
- );
- },
- processstart: function () {
- $(this).addClass('fileupload-processing');
- },
- processstop: function () {
- $(this).removeClass('fileupload-processing');
- },
- // Callback for file deletion:
- destroy: function (e, data) {
- var that = $(this).data('blueimp-fileupload') ||
- $(this).data('fileupload'),
- removeNode = function () {
- that._transition(data.context).done(
- function () {
- $(this).remove();
- that._trigger('destroyed', e, data);
- }
- );
- };
- if (data.url) {
- $.ajax(data).done(removeNode);
- } else {
- removeNode();
- }
- }
- },
-
- _resetFinishedDeferreds: function () {
- this._finishedUploads = [];
- },
-
- _addFinishedDeferreds: function (deferred) {
- if (!deferred) {
- deferred = $.Deferred();
- }
- this._finishedUploads.push(deferred);
- return deferred;
- },
-
- _getFinishedDeferreds: function () {
- return this._finishedUploads;
- },
-
- // Link handler, that allows to download files
- // by drag & drop of the links to the desktop:
- _enableDragToDesktop: function () {
- var link = $(this),
- url = link.prop('href'),
- name = link.prop('download'),
- type = 'application/octet-stream';
- link.bind('dragstart', function (e) {
- try {
- e.originalEvent.dataTransfer.setData(
- 'DownloadURL',
- [type, name, url].join(':')
- );
- } catch (ignore) {}
- });
- },
-
- _formatFileSize: function (bytes) {
- if (typeof bytes !== 'number') {
- return '';
- }
- if (bytes >= 1000000000) {
- return (bytes / 1000000000).toFixed(2) + ' GB';
- }
- if (bytes >= 1000000) {
- return (bytes / 1000000).toFixed(2) + ' MB';
- }
- return (bytes / 1000).toFixed(2) + ' KB';
- },
-
- _formatBitrate: function (bits) {
- if (typeof bits !== 'number') {
- return '';
- }
- if (bits >= 1000000000) {
- return (bits / 1000000000).toFixed(2) + ' Gbit/s';
- }
- if (bits >= 1000000) {
- return (bits / 1000000).toFixed(2) + ' Mbit/s';
- }
- if (bits >= 1000) {
- return (bits / 1000).toFixed(2) + ' kbit/s';
- }
- return bits.toFixed(2) + ' bit/s';
- },
-
- _formatTime: function (seconds) {
- var date = new Date(seconds * 1000),
- days = Math.floor(seconds / 86400);
- days = days ? days + 'd ' : '';
- return days +
- ('0' + date.getUTCHours()).slice(-2) + ':' +
- ('0' + date.getUTCMinutes()).slice(-2) + ':' +
- ('0' + date.getUTCSeconds()).slice(-2);
- },
-
- _formatPercentage: function (floatValue) {
- return (floatValue * 100).toFixed(2) + ' %';
- },
-
- _renderExtendedProgress: function (data) {
- return this._formatBitrate(data.bitrate) + ' | ' +
- this._formatTime(
- (data.total - data.loaded) * 8 / data.bitrate
- ) + ' | ' +
- this._formatPercentage(
- data.loaded / data.total
- ) + ' | ' +
- this._formatFileSize(data.loaded) + ' / ' +
- this._formatFileSize(data.total);
- },
-
- _renderTemplate: function (func, files) {
- if (!func) {
- return $();
- }
- var result = func({
- files: files,
- formatFileSize: this._formatFileSize,
- options: this.options
- });
- if (result instanceof $) {
- return result;
- }
- return $(this.options.templatesContainer).html(result).children();
- },
-
- _renderPreviews: function (data) {
- data.context.find('.preview').each(function (index, elm) {
- $(elm).append(data.files[index].preview);
- });
- },
-
- _renderUpload: function (files) {
- return this._renderTemplate(
- this.options.uploadTemplate,
- files
- );
- },
-
- _renderDownload: function (files) {
- return this._renderTemplate(
- this.options.downloadTemplate,
- files
- ).find('a[download]').each(this._enableDragToDesktop).end();
- },
-
- _startHandler: function (e) {
- e.preventDefault();
- var button = $(e.currentTarget),
- template = button.closest('.template-upload'),
- data = template.data('data');
- if (data && data.submit && !data.jqXHR && data.submit()) {
- button.prop('disabled', true);
- }
- },
-
- _cancelHandler: function (e) {
- e.preventDefault();
- var template = $(e.currentTarget)
- .closest('.template-upload,.template-download'),
- data = template.data('data') || {};
- if (!data.jqXHR) {
- data.context = data.context || template;
- data.errorThrown = 'abort';
- this._trigger('fail', e, data);
- } else {
- data.jqXHR.abort();
- }
- },
-
- _deleteHandler: function (e) {
- e.preventDefault();
- var button = $(e.currentTarget);
- this._trigger('destroy', e, $.extend({
- context: button.closest('.template-download'),
- type: 'DELETE'
- }, button.data()));
- },
-
- _forceReflow: function (node) {
- return $.support.transition && node.length &&
- node[0].offsetWidth;
- },
-
- _transition: function (node) {
- var dfd = $.Deferred();
- if ($.support.transition && node.hasClass('fade') && node.is(':visible')) {
- node.bind(
- $.support.transition.end,
- function (e) {
- // Make sure we don't respond to other transitions events
- // in the container element, e.g. from button elements:
- if (e.target === node[0]) {
- node.unbind($.support.transition.end);
- dfd.resolveWith(node);
- }
- }
- ).toggleClass('in');
- } else {
- node.toggleClass('in');
- dfd.resolveWith(node);
- }
- return dfd;
- },
-
- _initButtonBarEventHandlers: function () {
- var fileUploadButtonBar = this.element.find('.fileupload-buttonbar'),
- filesList = this.options.filesContainer;
- this._on(fileUploadButtonBar.find('.start'), {
- click: function (e) {
- e.preventDefault();
- filesList.find('.start').click();
- }
- });
- this._on(fileUploadButtonBar.find('.cancel'), {
- click: function (e) {
- e.preventDefault();
- filesList.find('.cancel').click();
- }
- });
- this._on(fileUploadButtonBar.find('.delete'), {
- click: function (e) {
- e.preventDefault();
- filesList.find('.toggle:checked')
- .closest('.template-download')
- .find('.delete').click();
- fileUploadButtonBar.find('.toggle')
- .prop('checked', false);
- }
- });
- this._on(fileUploadButtonBar.find('.toggle'), {
- change: function (e) {
- filesList.find('.toggle').prop(
- 'checked',
- $(e.currentTarget).is(':checked')
- );
- }
- });
- },
-
- _destroyButtonBarEventHandlers: function () {
- this._off(
- this.element.find('.fileupload-buttonbar')
- .find('.start, .cancel, .delete'),
- 'click'
- );
- this._off(
- this.element.find('.fileupload-buttonbar .toggle'),
- 'change.'
- );
- },
-
- _initEventHandlers: function () {
- this._super();
- this._on(this.options.filesContainer, {
- 'click .start': this._startHandler,
- 'click .cancel': this._cancelHandler,
- 'click .delete': this._deleteHandler
- });
- this._initButtonBarEventHandlers();
- },
-
- _destroyEventHandlers: function () {
- this._destroyButtonBarEventHandlers();
- this._off(this.options.filesContainer, 'click');
- this._super();
- },
-
- _enableFileInputButton: function () {
- this.element.find('.fileinput-button input')
- .prop('disabled', false)
- .parent().removeClass('disabled');
- },
-
- _disableFileInputButton: function () {
- this.element.find('.fileinput-button input')
- .prop('disabled', true)
- .parent().addClass('disabled');
- },
-
- _initTemplates: function () {
- var options = this.options;
- options.templatesContainer = this.document[0].createElement(
- options.filesContainer.prop('nodeName')
- );
- if (tmpl) {
- if (options.uploadTemplateId) {
- options.uploadTemplate = tmpl(options.uploadTemplateId);
- }
- if (options.downloadTemplateId) {
- options.downloadTemplate = tmpl(options.downloadTemplateId);
- }
- }
- },
-
- _initFilesContainer: function () {
- var options = this.options;
- if (options.filesContainer === undefined) {
- options.filesContainer = this.element.find('.files');
- } else if (!(options.filesContainer instanceof $)) {
- options.filesContainer = $(options.filesContainer);
- }
- },
-
- _initSpecialOptions: function () {
- this._super();
- this._initFilesContainer();
- this._initTemplates();
- },
-
- _create: function () {
- this._super();
- this._resetFinishedDeferreds();
- if (!$.support.fileInput) {
- this._disableFileInputButton();
- }
- },
-
- enable: function () {
- var wasDisabled = false;
- if (this.options.disabled) {
- wasDisabled = true;
- }
- this._super();
- if (wasDisabled) {
- this.element.find('input, button').prop('disabled', false);
- this._enableFileInputButton();
- }
- },
-
- disable: function () {
- if (!this.options.disabled) {
- this.element.find('input, button').prop('disabled', true);
- this._disableFileInputButton();
- }
- this._super();
- }
-
- });
-
-}));
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-validate.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-validate.js
deleted file mode 100644
index ee1c2f2ed4..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-validate.js
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * jQuery File Upload Validation Plugin 1.1.1
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2013, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint nomen: true, unparam: true, regexp: true */
-/*global define, window */
-
-(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define([
- 'jquery',
- './jquery.fileupload-process'
- ], factory);
- } else {
- // Browser globals:
- factory(
- window.jQuery
- );
- }
-}(function ($) {
- 'use strict';
-
- // Append to the default processQueue:
- $.blueimp.fileupload.prototype.options.processQueue.push(
- {
- action: 'validate',
- // Always trigger this action,
- // even if the previous action was rejected:
- always: true,
- // Options taken from the global options map:
- acceptFileTypes: '@',
- maxFileSize: '@',
- minFileSize: '@',
- maxNumberOfFiles: '@',
- disabled: '@disableValidation'
- }
- );
-
- // The File Upload Validation plugin extends the fileupload widget
- // with file validation functionality:
- $.widget('blueimp.fileupload', $.blueimp.fileupload, {
-
- options: {
- /*
- // The regular expression for allowed file types, matches
- // against either file type or file name:
- acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
- // The maximum allowed file size in bytes:
- maxFileSize: 10000000, // 10 MB
- // The minimum allowed file size in bytes:
- minFileSize: undefined, // No minimal file size
- // The limit of files to be uploaded:
- maxNumberOfFiles: 10,
- */
-
- // Function returning the current number of files,
- // has to be overriden for maxNumberOfFiles validation:
- getNumberOfFiles: $.noop,
-
- // Error and info messages:
- messages: {
- maxNumberOfFiles: 'Maximum number of files exceeded',
- acceptFileTypes: 'File type not allowed',
- maxFileSize: 'File is too large',
- minFileSize: 'File is too small'
- }
- },
-
- processActions: {
-
- validate: function (data, options) {
- if (options.disabled) {
- return data;
- }
- var dfd = $.Deferred(),
- settings = this.options,
- file = data.files[data.index];
- if ($.type(options.maxNumberOfFiles) === 'number' &&
- (settings.getNumberOfFiles() || 0) + data.files.length >
- options.maxNumberOfFiles) {
- file.error = settings.i18n('maxNumberOfFiles');
- } else if (options.acceptFileTypes &&
- !(options.acceptFileTypes.test(file.type) ||
- options.acceptFileTypes.test(file.name))) {
- file.error = settings.i18n('acceptFileTypes');
- } else if (options.maxFileSize && file.size >
- options.maxFileSize) {
- file.error = settings.i18n('maxFileSize');
- } else if ($.type(file.size) === 'number' &&
- file.size < options.minFileSize) {
- file.error = settings.i18n('minFileSize');
- } else {
- delete file.error;
- }
- if (file.error || data.files.error) {
- data.files.error = true;
- dfd.rejectWith(this, [data]);
- } else {
- dfd.resolveWith(this, [data]);
- }
- return dfd.promise();
- }
-
- }
-
- });
-
-}));
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-video.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-video.js
deleted file mode 100644
index c8b1019367..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload-video.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * jQuery File Upload Video Preview Plugin 1.0.3
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2013, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint nomen: true, unparam: true, regexp: true */
-/*global define, window, document */
-
-(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define([
- 'jquery',
- 'load-image',
- './jquery.fileupload-process'
- ], factory);
- } else {
- // Browser globals:
- factory(
- window.jQuery,
- window.loadImage
- );
- }
-}(function ($, loadImage) {
- 'use strict';
-
- // Prepend to the default processQueue:
- $.blueimp.fileupload.prototype.options.processQueue.unshift(
- {
- action: 'loadVideo',
- // Use the action as prefix for the "@" options:
- prefix: true,
- fileTypes: '@',
- maxFileSize: '@',
- disabled: '@disableVideoPreview'
- },
- {
- action: 'setVideo',
- name: '@videoPreviewName',
- disabled: '@disableVideoPreview'
- }
- );
-
- // The File Upload Video Preview plugin extends the fileupload widget
- // with video preview functionality:
- $.widget('blueimp.fileupload', $.blueimp.fileupload, {
-
- options: {
- // The regular expression for the types of video files to load,
- // matched against the file type:
- loadVideoFileTypes: /^video\/.*$/
- },
-
- _videoElement: document.createElement('video'),
-
- processActions: {
-
- // Loads the video file given via data.files and data.index
- // as video element if the browser supports playing it.
- // Accepts the options fileTypes (regular expression)
- // and maxFileSize (integer) to limit the files to load:
- loadVideo: function (data, options) {
- if (options.disabled) {
- return data;
- }
- var file = data.files[data.index],
- url,
- video;
- if (this._videoElement.canPlayType &&
- this._videoElement.canPlayType(file.type) &&
- ($.type(options.maxFileSize) !== 'number' ||
- file.size <= options.maxFileSize) &&
- (!options.fileTypes ||
- options.fileTypes.test(file.type))) {
- url = loadImage.createObjectURL(file);
- if (url) {
- video = this._videoElement.cloneNode(false);
- video.src = url;
- video.controls = true;
- data.video = video;
- return data;
- }
- }
- return data;
- },
-
- // Sets the video element as a property of the file object:
- setVideo: function (data, options) {
- if (data.video && !options.disabled) {
- data.files[data.index][options.name || 'preview'] = data.video;
- }
- return data;
- }
-
- }
-
- });
-
-}));
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload.js
deleted file mode 100644
index ddcfd42bc8..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.fileupload.js
+++ /dev/null
@@ -1,1333 +0,0 @@
-/*
- * jQuery File Upload Plugin 5.32.3
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2010, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint nomen: true, unparam: true, regexp: true */
-/*global define, window, document, location, File, Blob, FormData */
-
-(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define([
- 'jquery',
- 'jquery.ui.widget'
- ], factory);
- } else {
- // Browser globals:
- factory(window.jQuery);
- }
-}(function ($) {
- 'use strict';
-
- // Detect file input support, based on
- // http://viljamis.com/blog/2012/file-upload-support-on-mobile/
- $.support.fileInput = !(new RegExp(
- // Handle devices which give false positives for the feature detection:
- '(Android (1\\.[0156]|2\\.[01]))' +
- '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' +
- '|(w(eb)?OSBrowser)|(webOS)' +
- '|(Kindle/(1\\.0|2\\.[05]|3\\.0))'
- ).test(window.navigator.userAgent) ||
- // Feature detection for all other devices:
- $('<input type="file">').prop('disabled'));
-
- // The FileReader API is not actually used, but works as feature detection,
- // as e.g. Safari supports XHR file uploads via the FormData API,
- // but not non-multipart XHR file uploads:
- $.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader);
- $.support.xhrFormDataFileUpload = !!window.FormData;
-
- // Detect support for Blob slicing (required for chunked uploads):
- $.support.blobSlice = window.Blob && (Blob.prototype.slice ||
- Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
-
- // The fileupload widget listens for change events on file input fields defined
- // via fileInput setting and paste or drop events of the given dropZone.
- // In addition to the default jQuery Widget methods, the fileupload widget
- // exposes the "add" and "send" methods, to add or directly send files using
- // the fileupload API.
- // By default, files added via file input selection, paste, drag & drop or
- // "add" method are uploaded immediately, but it is possible to override
- // the "add" callback option to queue file uploads.
- $.widget('blueimp.fileupload', {
-
- options: {
- // The drop target element(s), by the default the complete document.
- // Set to null to disable drag & drop support:
- dropZone: $(document),
- // The paste target element(s), by the default the complete document.
- // Set to null to disable paste support:
- pasteZone: $(document),
- // The file input field(s), that are listened to for change events.
- // If undefined, it is set to the file input fields inside
- // of the widget element on plugin initialization.
- // Set to null to disable the change listener.
- fileInput: undefined,
- // By default, the file input field is replaced with a clone after
- // each input field change event. This is required for iframe transport
- // queues and allows change events to be fired for the same file
- // selection, but can be disabled by setting the following option to false:
- replaceFileInput: true,
- // The parameter name for the file form data (the request argument name).
- // If undefined or empty, the name property of the file input field is
- // used, or "files[]" if the file input name property is also empty,
- // can be a string or an array of strings:
- paramName: undefined,
- // By default, each file of a selection is uploaded using an individual
- // request for XHR type uploads. Set to false to upload file
- // selections in one request each:
- singleFileUploads: true,
- // To limit the number of files uploaded with one XHR request,
- // set the following option to an integer greater than 0:
- limitMultiFileUploads: undefined,
- // Set the following option to true to issue all file upload requests
- // in a sequential order:
- sequentialUploads: false,
- // To limit the number of concurrent uploads,
- // set the following option to an integer greater than 0:
- limitConcurrentUploads: undefined,
- // Set the following option to true to force iframe transport uploads:
- forceIframeTransport: false,
- // Set the following option to the location of a redirect url on the
- // origin server, for cross-domain iframe transport uploads:
- redirect: undefined,
- // The parameter name for the redirect url, sent as part of the form
- // data and set to 'redirect' if this option is empty:
- redirectParamName: undefined,
- // Set the following option to the location of a postMessage window,
- // to enable postMessage transport uploads:
- postMessage: undefined,
- // By default, XHR file uploads are sent as multipart/form-data.
- // The iframe transport is always using multipart/form-data.
- // Set to false to enable non-multipart XHR uploads:
- multipart: true,
- // To upload large files in smaller chunks, set the following option
- // to a preferred maximum chunk size. If set to 0, null or undefined,
- // or the browser does not support the required Blob API, files will
- // be uploaded as a whole.
- maxChunkSize: undefined,
- // When a non-multipart upload or a chunked multipart upload has been
- // aborted, this option can be used to resume the upload by setting
- // it to the size of the already uploaded bytes. This option is most
- // useful when modifying the options object inside of the "add" or
- // "send" callbacks, as the options are cloned for each file upload.
- uploadedBytes: undefined,
- // By default, failed (abort or error) file uploads are removed from the
- // global progress calculation. Set the following option to false to
- // prevent recalculating the global progress data:
- recalculateProgress: true,
- // Interval in milliseconds to calculate and trigger progress events:
- progressInterval: 100,
- // Interval in milliseconds to calculate progress bitrate:
- bitrateInterval: 500,
- // By default, uploads are started automatically when adding files:
- autoUpload: true,
-
- // Error and info messages:
- messages: {
- uploadedBytes: 'Uploaded bytes exceed file size'
- },
-
- // Translation function, gets the message key to be translated
- // and an object with context specific data as arguments:
- i18n: function (message, context) {
- message = this.messages[message] || message.toString();
- if (context) {
- $.each(context, function (key, value) {
- message = message.replace('{' + key + '}', value);
- });
- }
- return message;
- },
-
- // Additional form data to be sent along with the file uploads can be set
- // using this option, which accepts an array of objects with name and
- // value properties, a function returning such an array, a FormData
- // object (for XHR file uploads), or a simple object.
- // The form of the first fileInput is given as parameter to the function:
- formData: function (form) {
- return form.serializeArray();
- },
-
- // The add callback is invoked as soon as files are added to the fileupload
- // widget (via file input selection, drag & drop, paste or add API call).
- // If the singleFileUploads option is enabled, this callback will be
- // called once for each file in the selection for XHR file uploads, else
- // once for each file selection.
- //
- // The upload starts when the submit method is invoked on the data parameter.
- // The data object contains a files property holding the added files
- // and allows you to override plugin options as well as define ajax settings.
- //
- // Listeners for this callback can also be bound the following way:
- // .bind('fileuploadadd', func);
- //
- // data.submit() returns a Promise object and allows to attach additional
- // handlers using jQuery's Deferred callbacks:
- // data.submit().done(func).fail(func).always(func);
- add: function (e, data) {
- if (data.autoUpload || (data.autoUpload !== false &&
- $(this).fileupload('option', 'autoUpload'))) {
- data.process().done(function () {
- data.submit();
- });
- }
- },
-
- // Other callbacks:
-
- // Callback for the submit event of each file upload:
- // submit: function (e, data) {}, // .bind('fileuploadsubmit', func);
-
- // Callback for the start of each file upload request:
- // send: function (e, data) {}, // .bind('fileuploadsend', func);
-
- // Callback for successful uploads:
- // done: function (e, data) {}, // .bind('fileuploaddone', func);
-
- // Callback for failed (abort or error) uploads:
- // fail: function (e, data) {}, // .bind('fileuploadfail', func);
-
- // Callback for completed (success, abort or error) requests:
- // always: function (e, data) {}, // .bind('fileuploadalways', func);
-
- // Callback for upload progress events:
- // progress: function (e, data) {}, // .bind('fileuploadprogress', func);
-
- // Callback for global upload progress events:
- // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
-
- // Callback for uploads start, equivalent to the global ajaxStart event:
- // start: function (e) {}, // .bind('fileuploadstart', func);
-
- // Callback for uploads stop, equivalent to the global ajaxStop event:
- // stop: function (e) {}, // .bind('fileuploadstop', func);
-
- // Callback for change events of the fileInput(s):
- // change: function (e, data) {}, // .bind('fileuploadchange', func);
-
- // Callback for paste events to the pasteZone(s):
- // paste: function (e, data) {}, // .bind('fileuploadpaste', func);
-
- // Callback for drop events of the dropZone(s):
- // drop: function (e, data) {}, // .bind('fileuploaddrop', func);
-
- // Callback for dragover events of the dropZone(s):
- // dragover: function (e) {}, // .bind('fileuploaddragover', func);
-
- // Callback for the start of each chunk upload request:
- // chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func);
-
- // Callback for successful chunk uploads:
- // chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func);
-
- // Callback for failed (abort or error) chunk uploads:
- // chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func);
-
- // Callback for completed (success, abort or error) chunk upload requests:
- // chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func);
-
- // The plugin options are used as settings object for the ajax calls.
- // The following are jQuery ajax settings required for the file uploads:
- processData: false,
- contentType: false,
- cache: false
- },
-
- // A list of options that require reinitializing event listeners and/or
- // special initialization code:
- _specialOptions: [
- 'fileInput',
- 'dropZone',
- 'pasteZone',
- 'multipart',
- 'forceIframeTransport'
- ],
-
- _blobSlice: $.support.blobSlice && function () {
- var slice = this.slice || this.webkitSlice || this.mozSlice;
- return slice.apply(this, arguments);
- },
-
- _BitrateTimer: function () {
- this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime());
- this.loaded = 0;
- this.bitrate = 0;
- this.getBitrate = function (now, loaded, interval) {
- var timeDiff = now - this.timestamp;
- if (!this.bitrate || !interval || timeDiff > interval) {
- this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8;
- this.loaded = loaded;
- this.timestamp = now;
- }
- return this.bitrate;
- };
- },
-
- _isXHRUpload: function (options) {
- return !options.forceIframeTransport &&
- ((!options.multipart && $.support.xhrFileUpload) ||
- $.support.xhrFormDataFileUpload);
- },
-
- _getFormData: function (options) {
- var formData;
- if (typeof options.formData === 'function') {
- return options.formData(options.form);
- }
- if ($.isArray(options.formData)) {
- return options.formData;
- }
- if ($.type(options.formData) === 'object') {
- formData = [];
- $.each(options.formData, function (name, value) {
- formData.push({name: name, value: value});
- });
- return formData;
- }
- return [];
- },
-
- _getTotal: function (files) {
- var total = 0;
- $.each(files, function (index, file) {
- total += file.size || 1;
- });
- return total;
- },
-
- _initProgressObject: function (obj) {
- var progress = {
- loaded: 0,
- total: 0,
- bitrate: 0
- };
- if (obj._progress) {
- $.extend(obj._progress, progress);
- } else {
- obj._progress = progress;
- }
- },
-
- _initResponseObject: function (obj) {
- var prop;
- if (obj._response) {
- for (prop in obj._response) {
- if (obj._response.hasOwnProperty(prop)) {
- delete obj._response[prop];
- }
- }
- } else {
- obj._response = {};
- }
- },
-
- _onProgress: function (e, data) {
- if (e.lengthComputable) {
- var now = ((Date.now) ? Date.now() : (new Date()).getTime()),
- loaded;
- if (data._time && data.progressInterval &&
- (now - data._time < data.progressInterval) &&
- e.loaded !== e.total) {
- return;
- }
- data._time = now;
- loaded = Math.floor(
- e.loaded / e.total * (data.chunkSize || data._progress.total)
- ) + (data.uploadedBytes || 0);
- // Add the difference from the previously loaded state
- // to the global loaded counter:
- this._progress.loaded += (loaded - data._progress.loaded);
- this._progress.bitrate = this._bitrateTimer.getBitrate(
- now,
- this._progress.loaded,
- data.bitrateInterval
- );
- data._progress.loaded = data.loaded = loaded;
- data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate(
- now,
- loaded,
- data.bitrateInterval
- );
- // Trigger a custom progress event with a total data property set
- // to the file size(s) of the current upload and a loaded data
- // property calculated accordingly:
- this._trigger('progress', e, data);
- // Trigger a global progress event for all current file uploads,
- // including ajax calls queued for sequential file uploads:
- this._trigger('progressall', e, this._progress);
- }
- },
-
- _initProgressListener: function (options) {
- var that = this,
- xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
- // Accesss to the native XHR object is required to add event listeners
- // for the upload progress event:
- if (xhr.upload) {
- $(xhr.upload).bind('progress', function (e) {
- var oe = e.originalEvent;
- // Make sure the progress event properties get copied over:
- e.lengthComputable = oe.lengthComputable;
- e.loaded = oe.loaded;
- e.total = oe.total;
- that._onProgress(e, options);
- });
- options.xhr = function () {
- return xhr;
- };
- }
- },
-
- _isInstanceOf: function (type, obj) {
- // Cross-frame instanceof check
- return Object.prototype.toString.call(obj) === '[object ' + type + ']';
- },
-
- _initXHRData: function (options) {
- var that = this,
- formData,
- file = options.files[0],
- // Ignore non-multipart setting if not supported:
- multipart = options.multipart || !$.support.xhrFileUpload,
- paramName = options.paramName[0];
- options.headers = $.extend({}, options.headers);
- if (options.contentRange) {
- options.headers['Content-Range'] = options.contentRange;
- }
- if (!multipart || options.blob || !this._isInstanceOf('File', file)) {
- options.headers['Content-Disposition'] = 'attachment; filename="' +
- encodeURI(file.name) + '"';
- }
- if (!multipart) {
- options.contentType = file.type;
- options.data = options.blob || file;
- } else if ($.support.xhrFormDataFileUpload) {
- if (options.postMessage) {
- // window.postMessage does not allow sending FormData
- // objects, so we just add the File/Blob objects to
- // the formData array and let the postMessage window
- // create the FormData object out of this array:
- formData = this._getFormData(options);
- if (options.blob) {
- formData.push({
- name: paramName,
- value: options.blob
- });
- } else {
- $.each(options.files, function (index, file) {
- formData.push({
- name: options.paramName[index] || paramName,
- value: file
- });
- });
- }
- } else {
- if (that._isInstanceOf('FormData', options.formData)) {
- formData = options.formData;
- } else {
- formData = new FormData();
- $.each(this._getFormData(options), function (index, field) {
- formData.append(field.name, field.value);
- });
- }
- if (options.blob) {
- formData.append(paramName, options.blob, file.name);
- } else {
- $.each(options.files, function (index, file) {
- // This check allows the tests to run with
- // dummy objects:
- if (that._isInstanceOf('File', file) ||
- that._isInstanceOf('Blob', file)) {
- formData.append(
- options.paramName[index] || paramName,
- file,
- file.name
- );
- }
- });
- }
- }
- options.data = formData;
- }
- // Blob reference is not needed anymore, free memory:
- options.blob = null;
- },
-
- _initIframeSettings: function (options) {
- var targetHost = $('<a></a>').prop('href', options.url).prop('host');
- // Setting the dataType to iframe enables the iframe transport:
- options.dataType = 'iframe ' + (options.dataType || '');
- // The iframe transport accepts a serialized array as form data:
- options.formData = this._getFormData(options);
- // Add redirect url to form data on cross-domain uploads:
- if (options.redirect && targetHost && targetHost !== location.host) {
- options.formData.push({
- name: options.redirectParamName || 'redirect',
- value: options.redirect
- });
- }
- },
-
- _initDataSettings: function (options) {
- if (this._isXHRUpload(options)) {
- if (!this._chunkedUpload(options, true)) {
- if (!options.data) {
- this._initXHRData(options);
- }
- this._initProgressListener(options);
- }
- if (options.postMessage) {
- // Setting the dataType to postmessage enables the
- // postMessage transport:
- options.dataType = 'postmessage ' + (options.dataType || '');
- }
- } else {
- this._initIframeSettings(options);
- }
- },
-
- _getParamName: function (options) {
- var fileInput = $(options.fileInput),
- paramName = options.paramName;
- if (!paramName) {
- paramName = [];
- fileInput.each(function () {
- var input = $(this),
- name = input.prop('name') || 'files[]',
- i = (input.prop('files') || [1]).length;
- while (i) {
- paramName.push(name);
- i -= 1;
- }
- });
- if (!paramName.length) {
- paramName = [fileInput.prop('name') || 'files[]'];
- }
- } else if (!$.isArray(paramName)) {
- paramName = [paramName];
- }
- return paramName;
- },
-
- _initFormSettings: function (options) {
- // Retrieve missing options from the input field and the
- // associated form, if available:
- if (!options.form || !options.form.length) {
- options.form = $(options.fileInput.prop('form'));
- // If the given file input doesn't have an associated form,
- // use the default widget file input's form:
- if (!options.form.length) {
- options.form = $(this.options.fileInput.prop('form'));
- }
- }
- options.paramName = this._getParamName(options);
- if (!options.url) {
- options.url = options.form.prop('action') || location.href;
- }
- // The HTTP request method must be "POST" or "PUT":
- options.type = (options.type || options.form.prop('method') || '')
- .toUpperCase();
- if (options.type !== 'POST' && options.type !== 'PUT' &&
- options.type !== 'PATCH') {
- options.type = 'POST';
- }
- if (!options.formAcceptCharset) {
- options.formAcceptCharset = options.form.attr('accept-charset');
- }
- },
-
- _getAJAXSettings: function (data) {
- var options = $.extend({}, this.options, data);
- this._initFormSettings(options);
- this._initDataSettings(options);
- return options;
- },
-
- // jQuery 1.6 doesn't provide .state(),
- // while jQuery 1.8+ removed .isRejected() and .isResolved():
- _getDeferredState: function (deferred) {
- if (deferred.state) {
- return deferred.state();
- }
- if (deferred.isResolved()) {
- return 'resolved';
- }
- if (deferred.isRejected()) {
- return 'rejected';
- }
- return 'pending';
- },
-
- // Maps jqXHR callbacks to the equivalent
- // methods of the given Promise object:
- _enhancePromise: function (promise) {
- promise.success = promise.done;
- promise.error = promise.fail;
- promise.complete = promise.always;
- return promise;
- },
-
- // Creates and returns a Promise object enhanced with
- // the jqXHR methods abort, success, error and complete:
- _getXHRPromise: function (resolveOrReject, context, args) {
- var dfd = $.Deferred(),
- promise = dfd.promise();
- context = context || this.options.context || promise;
- if (resolveOrReject === true) {
- dfd.resolveWith(context, args);
- } else if (resolveOrReject === false) {
- dfd.rejectWith(context, args);
- }
- promise.abort = dfd.promise;
- return this._enhancePromise(promise);
- },
-
- // Adds convenience methods to the data callback argument:
- _addConvenienceMethods: function (e, data) {
- var that = this,
- getPromise = function (data) {
- return $.Deferred().resolveWith(that, [data]).promise();
- };
- data.process = function (resolveFunc, rejectFunc) {
- if (resolveFunc || rejectFunc) {
- data._processQueue = this._processQueue =
- (this._processQueue || getPromise(this))
- .pipe(resolveFunc, rejectFunc);
- }
- return this._processQueue || getPromise(this);
- };
- data.submit = function () {
- if (this.state() !== 'pending') {
- data.jqXHR = this.jqXHR =
- (that._trigger('submit', e, this) !== false) &&
- that._onSend(e, this);
- }
- return this.jqXHR || that._getXHRPromise();
- };
- data.abort = function () {
- if (this.jqXHR) {
- return this.jqXHR.abort();
- }
- return that._getXHRPromise();
- };
- data.state = function () {
- if (this.jqXHR) {
- return that._getDeferredState(this.jqXHR);
- }
- if (this._processQueue) {
- return that._getDeferredState(this._processQueue);
- }
- };
- data.progress = function () {
- return this._progress;
- };
- data.response = function () {
- return this._response;
- };
- },
-
- // Parses the Range header from the server response
- // and returns the uploaded bytes:
- _getUploadedBytes: function (jqXHR) {
- var range = jqXHR.getResponseHeader('Range'),
- parts = range && range.split('-'),
- upperBytesPos = parts && parts.length > 1 &&
- parseInt(parts[1], 10);
- return upperBytesPos && upperBytesPos + 1;
- },
-
- // Uploads a file in multiple, sequential requests
- // by splitting the file up in multiple blob chunks.
- // If the second parameter is true, only tests if the file
- // should be uploaded in chunks, but does not invoke any
- // upload requests:
- _chunkedUpload: function (options, testOnly) {
- options.uploadedBytes = options.uploadedBytes || 0;
- var that = this,
- file = options.files[0],
- fs = file.size,
- ub = options.uploadedBytes,
- mcs = options.maxChunkSize || fs,
- slice = this._blobSlice,
- dfd = $.Deferred(),
- promise = dfd.promise(),
- jqXHR,
- upload;
- if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
- options.data) {
- return false;
- }
- if (testOnly) {
- return true;
- }
- if (ub >= fs) {
- file.error = options.i18n('uploadedBytes');
- return this._getXHRPromise(
- false,
- options.context,
- [null, 'error', file.error]
- );
- }
- // The chunk upload method:
- upload = function () {
- // Clone the options object for each chunk upload:
- var o = $.extend({}, options),
- currentLoaded = o._progress.loaded;
- o.blob = slice.call(
- file,
- ub,
- ub + mcs,
- file.type
- );
- // Store the current chunk size, as the blob itself
- // will be dereferenced after data processing:
- o.chunkSize = o.blob.size;
- // Expose the chunk bytes position range:
- o.contentRange = 'bytes ' + ub + '-' +
- (ub + o.chunkSize - 1) + '/' + fs;
- // Process the upload data (the blob and potential form data):
- that._initXHRData(o);
- // Add progress listeners for this chunk upload:
- that._initProgressListener(o);
- jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) ||
- that._getXHRPromise(false, o.context))
- .done(function (result, textStatus, jqXHR) {
- ub = that._getUploadedBytes(jqXHR) ||
- (ub + o.chunkSize);
- // Create a progress event if no final progress event
- // with loaded equaling total has been triggered
- // for this chunk:
- if (currentLoaded + o.chunkSize - o._progress.loaded) {
- that._onProgress($.Event('progress', {
- lengthComputable: true,
- loaded: ub - o.uploadedBytes,
- total: ub - o.uploadedBytes
- }), o);
- }
- options.uploadedBytes = o.uploadedBytes = ub;
- o.result = result;
- o.textStatus = textStatus;
- o.jqXHR = jqXHR;
- that._trigger('chunkdone', null, o);
- that._trigger('chunkalways', null, o);
- if (ub < fs) {
- // File upload not yet complete,
- // continue with the next chunk:
- upload();
- } else {
- dfd.resolveWith(
- o.context,
- [result, textStatus, jqXHR]
- );
- }
- })
- .fail(function (jqXHR, textStatus, errorThrown) {
- o.jqXHR = jqXHR;
- o.textStatus = textStatus;
- o.errorThrown = errorThrown;
- that._trigger('chunkfail', null, o);
- that._trigger('chunkalways', null, o);
- dfd.rejectWith(
- o.context,
- [jqXHR, textStatus, errorThrown]
- );
- });
- };
- this._enhancePromise(promise);
- promise.abort = function () {
- return jqXHR.abort();
- };
- upload();
- return promise;
- },
-
- _beforeSend: function (e, data) {
- if (this._active === 0) {
- // the start callback is triggered when an upload starts
- // and no other uploads are currently running,
- // equivalent to the global ajaxStart event:
- this._trigger('start');
- // Set timer for global bitrate progress calculation:
- this._bitrateTimer = new this._BitrateTimer();
- // Reset the global progress values:
- this._progress.loaded = this._progress.total = 0;
- this._progress.bitrate = 0;
- }
- // Make sure the container objects for the .response() and
- // .progress() methods on the data object are available
- // and reset to their initial state:
- this._initResponseObject(data);
- this._initProgressObject(data);
- data._progress.loaded = data.loaded = data.uploadedBytes || 0;
- data._progress.total = data.total = this._getTotal(data.files) || 1;
- data._progress.bitrate = data.bitrate = 0;
- this._active += 1;
- // Initialize the global progress values:
- this._progress.loaded += data.loaded;
- this._progress.total += data.total;
- },
-
- _onDone: function (result, textStatus, jqXHR, options) {
- var total = options._progress.total,
- response = options._response;
- if (options._progress.loaded < total) {
- // Create a progress event if no final progress event
- // with loaded equaling total has been triggered:
- this._onProgress($.Event('progress', {
- lengthComputable: true,
- loaded: total,
- total: total
- }), options);
- }
- response.result = options.result = result;
- response.textStatus = options.textStatus = textStatus;
- response.jqXHR = options.jqXHR = jqXHR;
- this._trigger('done', null, options);
- },
-
- _onFail: function (jqXHR, textStatus, errorThrown, options) {
- var response = options._response;
- if (options.recalculateProgress) {
- // Remove the failed (error or abort) file upload from
- // the global progress calculation:
- this._progress.loaded -= options._progress.loaded;
- this._progress.total -= options._progress.total;
- }
- response.jqXHR = options.jqXHR = jqXHR;
- response.textStatus = options.textStatus = textStatus;
- response.errorThrown = options.errorThrown = errorThrown;
- this._trigger('fail', null, options);
- },
-
- _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
- // jqXHRorResult, textStatus and jqXHRorError are added to the
- // options object via done and fail callbacks
- this._trigger('always', null, options);
- },
-
- _onSend: function (e, data) {
- if (!data.submit) {
- this._addConvenienceMethods(e, data);
- }
- var that = this,
- jqXHR,
- aborted,
- slot,
- pipe,
- options = that._getAJAXSettings(data),
- send = function () {
- that._sending += 1;
- // Set timer for bitrate progress calculation:
- options._bitrateTimer = new that._BitrateTimer();
- jqXHR = jqXHR || (
- ((aborted || that._trigger('send', e, options) === false) &&
- that._getXHRPromise(false, options.context, aborted)) ||
- that._chunkedUpload(options) || $.ajax(options)
- ).done(function (result, textStatus, jqXHR) {
- that._onDone(result, textStatus, jqXHR, options);
- }).fail(function (jqXHR, textStatus, errorThrown) {
- that._onFail(jqXHR, textStatus, errorThrown, options);
- }).always(function (jqXHRorResult, textStatus, jqXHRorError) {
- that._onAlways(
- jqXHRorResult,
- textStatus,
- jqXHRorError,
- options
- );
- that._sending -= 1;
- that._active -= 1;
- if (options.limitConcurrentUploads &&
- options.limitConcurrentUploads > that._sending) {
- // Start the next queued upload,
- // that has not been aborted:
- var nextSlot = that._slots.shift();
- while (nextSlot) {
- if (that._getDeferredState(nextSlot) === 'pending') {
- nextSlot.resolve();
- break;
- }
- nextSlot = that._slots.shift();
- }
- }
- if (that._active === 0) {
- // The stop callback is triggered when all uploads have
- // been completed, equivalent to the global ajaxStop event:
- that._trigger('stop');
- }
- });
- return jqXHR;
- };
- this._beforeSend(e, options);
- if (this.options.sequentialUploads ||
- (this.options.limitConcurrentUploads &&
- this.options.limitConcurrentUploads <= this._sending)) {
- if (this.options.limitConcurrentUploads > 1) {
- slot = $.Deferred();
- this._slots.push(slot);
- pipe = slot.pipe(send);
- } else {
- this._sequence = this._sequence.pipe(send, send);
- pipe = this._sequence;
- }
- // Return the piped Promise object, enhanced with an abort method,
- // which is delegated to the jqXHR object of the current upload,
- // and jqXHR callbacks mapped to the equivalent Promise methods:
- pipe.abort = function () {
- aborted = [undefined, 'abort', 'abort'];
- if (!jqXHR) {
- if (slot) {
- slot.rejectWith(options.context, aborted);
- }
- return send();
- }
- return jqXHR.abort();
- };
- return this._enhancePromise(pipe);
- }
- return send();
- },
-
- _onAdd: function (e, data) {
- var that = this,
- result = true,
- options = $.extend({}, this.options, data),
- limit = options.limitMultiFileUploads,
- paramName = this._getParamName(options),
- paramNameSet,
- paramNameSlice,
- fileSet,
- i;
- if (!(options.singleFileUploads || limit) ||
- !this._isXHRUpload(options)) {
- fileSet = [data.files];
- paramNameSet = [paramName];
- } else if (!options.singleFileUploads && limit) {
- fileSet = [];
- paramNameSet = [];
- for (i = 0; i < data.files.length; i += limit) {
- fileSet.push(data.files.slice(i, i + limit));
- paramNameSlice = paramName.slice(i, i + limit);
- if (!paramNameSlice.length) {
- paramNameSlice = paramName;
- }
- paramNameSet.push(paramNameSlice);
- }
- } else {
- paramNameSet = paramName;
- }
- data.originalFiles = data.files;
- $.each(fileSet || data.files, function (index, element) {
- var newData = $.extend({}, data);
- newData.files = fileSet ? element : [element];
- newData.paramName = paramNameSet[index];
- that._initResponseObject(newData);
- that._initProgressObject(newData);
- that._addConvenienceMethods(e, newData);
- result = that._trigger('add', e, newData);
- return result;
- });
- return result;
- },
-
- _replaceFileInput: function (input) {
- var inputClone = input.clone(true);
- $('<form></form>').append(inputClone)[0].reset();
- // Detaching allows to insert the fileInput on another form
- // without loosing the file input value:
- input.after(inputClone).detach();
- // Avoid memory leaks with the detached file input:
- $.cleanData(input.unbind('remove'));
- // Replace the original file input element in the fileInput
- // elements set with the clone, which has been copied including
- // event handlers:
- this.options.fileInput = this.options.fileInput.map(function (i, el) {
- if (el === input[0]) {
- return inputClone[0];
- }
- return el;
- });
- // If the widget has been initialized on the file input itself,
- // override this.element with the file input clone:
- if (input[0] === this.element[0]) {
- this.element = inputClone;
- }
- },
-
- _handleFileTreeEntry: function (entry, path) {
- var that = this,
- dfd = $.Deferred(),
- errorHandler = function (e) {
- if (e && !e.entry) {
- e.entry = entry;
- }
- // Since $.when returns immediately if one
- // Deferred is rejected, we use resolve instead.
- // This allows valid files and invalid items
- // to be returned together in one set:
- dfd.resolve([e]);
- },
- dirReader;
- path = path || '';
- if (entry.isFile) {
- if (entry._file) {
- // Workaround for Chrome bug #149735
- entry._file.relativePath = path;
- dfd.resolve(entry._file);
- } else {
- entry.file(function (file) {
- file.relativePath = path;
- dfd.resolve(file);
- }, errorHandler);
- }
- } else if (entry.isDirectory) {
- dirReader = entry.createReader();
- dirReader.readEntries(function (entries) {
- that._handleFileTreeEntries(
- entries,
- path + entry.name + '/'
- ).done(function (files) {
- dfd.resolve(files);
- }).fail(errorHandler);
- }, errorHandler);
- } else {
- // Return an empy list for file system items
- // other than files or directories:
- dfd.resolve([]);
- }
- return dfd.promise();
- },
-
- _handleFileTreeEntries: function (entries, path) {
- var that = this;
- return $.when.apply(
- $,
- $.map(entries, function (entry) {
- return that._handleFileTreeEntry(entry, path);
- })
- ).pipe(function () {
- return Array.prototype.concat.apply(
- [],
- arguments
- );
- });
- },
-
- _getDroppedFiles: function (dataTransfer) {
- dataTransfer = dataTransfer || {};
- var items = dataTransfer.items;
- if (items && items.length && (items[0].webkitGetAsEntry ||
- items[0].getAsEntry)) {
- return this._handleFileTreeEntries(
- $.map(items, function (item) {
- var entry;
- if (item.webkitGetAsEntry) {
- entry = item.webkitGetAsEntry();
- if (entry) {
- // Workaround for Chrome bug #149735:
- entry._file = item.getAsFile();
- }
- return entry;
- }
- return item.getAsEntry();
- })
- );
- }
- return $.Deferred().resolve(
- $.makeArray(dataTransfer.files)
- ).promise();
- },
-
- _getSingleFileInputFiles: function (fileInput) {
- fileInput = $(fileInput);
- var entries = fileInput.prop('webkitEntries') ||
- fileInput.prop('entries'),
- files,
- value;
- if (entries && entries.length) {
- return this._handleFileTreeEntries(entries);
- }
- files = $.makeArray(fileInput.prop('files'));
- if (!files.length) {
- value = fileInput.prop('value');
- if (!value) {
- return $.Deferred().resolve([]).promise();
- }
- // If the files property is not available, the browser does not
- // support the File API and we add a pseudo File object with
- // the input value as name with path information removed:
- files = [{name: value.replace(/^.*\\/, '')}];
- } else if (files[0].name === undefined && files[0].fileName) {
- // File normalization for Safari 4 and Firefox 3:
- $.each(files, function (index, file) {
- file.name = file.fileName;
- file.size = file.fileSize;
- });
- }
- return $.Deferred().resolve(files).promise();
- },
-
- _getFileInputFiles: function (fileInput) {
- if (!(fileInput instanceof $) || fileInput.length === 1) {
- return this._getSingleFileInputFiles(fileInput);
- }
- return $.when.apply(
- $,
- $.map(fileInput, this._getSingleFileInputFiles)
- ).pipe(function () {
- return Array.prototype.concat.apply(
- [],
- arguments
- );
- });
- },
-
- _onChange: function (e) {
- var that = this,
- data = {
- fileInput: $(e.target),
- form: $(e.target.form)
- };
- this._getFileInputFiles(data.fileInput).always(function (files) {
- data.files = files;
- if (that.options.replaceFileInput) {
- that._replaceFileInput(data.fileInput);
- }
- if (that._trigger('change', e, data) !== false) {
- that._onAdd(e, data);
- }
- });
- },
-
- _onPaste: function (e) {
- var items = e.originalEvent && e.originalEvent.clipboardData &&
- e.originalEvent.clipboardData.items,
- data = {files: []};
- if (items && items.length) {
- $.each(items, function (index, item) {
- var file = item.getAsFile && item.getAsFile();
- if (file) {
- data.files.push(file);
- }
- });
- if (this._trigger('paste', e, data) === false ||
- this._onAdd(e, data) === false) {
- return false;
- }
- }
- },
-
- _onDrop: function (e) {
- e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
- var that = this,
- dataTransfer = e.dataTransfer,
- data = {};
- if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
- e.preventDefault();
- this._getDroppedFiles(dataTransfer).always(function (files) {
- data.files = files;
- if (that._trigger('drop', e, data) !== false) {
- that._onAdd(e, data);
- }
- });
- }
- },
-
- _onDragOver: function (e) {
- e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
- var dataTransfer = e.dataTransfer;
- if (dataTransfer) {
- if (this._trigger('dragover', e) === false) {
- return false;
- }
- if ($.inArray('Files', dataTransfer.types) !== -1) {
- dataTransfer.dropEffect = 'copy';
- e.preventDefault();
- }
- }
- },
-
- _initEventHandlers: function () {
- if (this._isXHRUpload(this.options)) {
- this._on(this.options.dropZone, {
- dragover: this._onDragOver,
- drop: this._onDrop
- });
- this._on(this.options.pasteZone, {
- paste: this._onPaste
- });
- }
- if ($.support.fileInput) {
- this._on(this.options.fileInput, {
- change: this._onChange
- });
- }
- },
-
- _destroyEventHandlers: function () {
- this._off(this.options.dropZone, 'dragover drop');
- this._off(this.options.pasteZone, 'paste');
- this._off(this.options.fileInput, 'change');
- },
-
- _setOption: function (key, value) {
- var reinit = $.inArray(key, this._specialOptions) !== -1;
- if (reinit) {
- this._destroyEventHandlers();
- }
- this._super(key, value);
- if (reinit) {
- this._initSpecialOptions();
- this._initEventHandlers();
- }
- },
-
- _initSpecialOptions: function () {
- var options = this.options;
- if (options.fileInput === undefined) {
- options.fileInput = this.element.is('input[type="file"]') ?
- this.element : this.element.find('input[type="file"]');
- } else if (!(options.fileInput instanceof $)) {
- options.fileInput = $(options.fileInput);
- }
- if (!(options.dropZone instanceof $)) {
- options.dropZone = $(options.dropZone);
- }
- if (!(options.pasteZone instanceof $)) {
- options.pasteZone = $(options.pasteZone);
- }
- },
-
- _getRegExp: function (str) {
- var parts = str.split('/'),
- modifiers = parts.pop();
- parts.shift();
- return new RegExp(parts.join('/'), modifiers);
- },
-
- _isRegExpOption: function (key, value) {
- return key !== 'url' && $.type(value) === 'string' &&
- /^\/.*\/[igm]{0,3}$/.test(value);
- },
-
- _initDataAttributes: function () {
- var that = this,
- options = this.options;
- // Initialize options set via HTML5 data-attributes:
- $.each(
- $(this.element[0].cloneNode(false)).data(),
- function (key, value) {
- if (that._isRegExpOption(key, value)) {
- value = that._getRegExp(value);
- }
- options[key] = value;
- }
- );
- },
-
- _create: function () {
- this._initDataAttributes();
- this._initSpecialOptions();
- this._slots = [];
- this._sequence = this._getXHRPromise(true);
- this._sending = this._active = 0;
- this._initProgressObject(this);
- this._initEventHandlers();
- },
-
- // This method is exposed to the widget API and allows to query
- // the number of active uploads:
- active: function () {
- return this._active;
- },
-
- // This method is exposed to the widget API and allows to query
- // the widget upload progress.
- // It returns an object with loaded, total and bitrate properties
- // for the running uploads:
- progress: function () {
- return this._progress;
- },
-
- // This method is exposed to the widget API and allows adding files
- // using the fileupload API. The data parameter accepts an object which
- // must have a files property and can contain additional options:
- // .fileupload('add', {files: filesList});
- add: function (data) {
- var that = this;
- if (!data || this.options.disabled) {
- return;
- }
- if (data.fileInput && !data.files) {
- this._getFileInputFiles(data.fileInput).always(function (files) {
- data.files = files;
- that._onAdd(null, data);
- });
- } else {
- data.files = $.makeArray(data.files);
- this._onAdd(null, data);
- }
- },
-
- // This method is exposed to the widget API and allows sending files
- // using the fileupload API. The data parameter accepts an object which
- // must have a files or fileInput property and can contain additional options:
- // .fileupload('send', {files: filesList});
- // The method returns a Promise object for the file upload call.
- send: function (data) {
- if (data && !this.options.disabled) {
- if (data.fileInput && !data.files) {
- var that = this,
- dfd = $.Deferred(),
- promise = dfd.promise(),
- jqXHR,
- aborted;
- promise.abort = function () {
- aborted = true;
- if (jqXHR) {
- return jqXHR.abort();
- }
- dfd.reject(null, 'abort', 'abort');
- return promise;
- };
- this._getFileInputFiles(data.fileInput).always(
- function (files) {
- if (aborted) {
- return;
- }
- if (!files.length) {
- dfd.reject();
- return;
- }
- data.files = files;
- jqXHR = that._onSend(null, data).then(
- function (result, textStatus, jqXHR) {
- dfd.resolve(result, textStatus, jqXHR);
- },
- function (jqXHR, textStatus, errorThrown) {
- dfd.reject(jqXHR, textStatus, errorThrown);
- }
- );
- }
- );
- return this._enhancePromise(promise);
- }
- data.files = $.makeArray(data.files);
- if (data.files.length) {
- return this._onSend(null, data);
- }
- }
- return this._getXHRPromise(false, data && data.context);
- }
-
- });
-
-}));
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.iframe-transport.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.iframe-transport.js
deleted file mode 100644
index 073c5fbe70..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/jquery.iframe-transport.js
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * jQuery Iframe Transport Plugin 1.7
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2011, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint unparam: true, nomen: true */
-/*global define, window, document */
-
-(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define(['jquery'], factory);
- } else {
- // Browser globals:
- factory(window.jQuery);
- }
-}(function ($) {
- 'use strict';
-
- // Helper variable to create unique names for the transport iframes:
- var counter = 0;
-
- // The iframe transport accepts three additional options:
- // options.fileInput: a jQuery collection of file input fields
- // options.paramName: the parameter name for the file form data,
- // overrides the name property of the file input field(s),
- // can be a string or an array of strings.
- // options.formData: an array of objects with name and value properties,
- // equivalent to the return data of .serializeArray(), e.g.:
- // [{name: 'a', value: 1}, {name: 'b', value: 2}]
- $.ajaxTransport('iframe', function (options) {
- if (options.async) {
- var form,
- iframe,
- addParamChar;
- return {
- send: function (_, completeCallback) {
- form = $('<form style="display:none;"></form>');
- form.attr('accept-charset', options.formAcceptCharset);
- addParamChar = /\?/.test(options.url) ? '&' : '?';
- // XDomainRequest only supports GET and POST:
- if (options.type === 'DELETE') {
- options.url = options.url + addParamChar + '_method=DELETE';
- options.type = 'POST';
- } else if (options.type === 'PUT') {
- options.url = options.url + addParamChar + '_method=PUT';
- options.type = 'POST';
- } else if (options.type === 'PATCH') {
- options.url = options.url + addParamChar + '_method=PATCH';
- options.type = 'POST';
- }
- // javascript:false as initial iframe src
- // prevents warning popups on HTTPS in IE6.
- // IE versions below IE8 cannot set the name property of
- // elements that have already been added to the DOM,
- // so we set the name along with the iframe HTML markup:
- counter += 1;
- iframe = $(
- '<iframe src="javascript:false;" name="iframe-transport-' +
- counter + '"></iframe>'
- ).bind('load', function () {
- var fileInputClones,
- paramNames = $.isArray(options.paramName) ?
- options.paramName : [options.paramName];
- iframe
- .unbind('load')
- .bind('load', function () {
- var response;
- // Wrap in a try/catch block to catch exceptions thrown
- // when trying to access cross-domain iframe contents:
- try {
- response = iframe.contents();
- // Google Chrome and Firefox do not throw an
- // exception when calling iframe.contents() on
- // cross-domain requests, so we unify the response:
- if (!response.length || !response[0].firstChild) {
- throw new Error();
- }
- } catch (e) {
- response = undefined;
- }
- // The complete callback returns the
- // iframe content document as response object:
- completeCallback(
- 200,
- 'success',
- {'iframe': response}
- );
- // Fix for IE endless progress bar activity bug
- // (happens on form submits to iframe targets):
- $('<iframe src="javascript:false;"></iframe>')
- .appendTo(form);
- window.setTimeout(function () {
- // Removing the form in a setTimeout call
- // allows Chrome's developer tools to display
- // the response result
- form.remove();
- }, 0);
- });
- form
- .prop('target', iframe.prop('name'))
- .prop('action', options.url)
- .prop('method', options.type);
- if (options.formData) {
- $.each(options.formData, function (index, field) {
- $('<input type="hidden"/>')
- .prop('name', field.name)
- .val(field.value)
- .appendTo(form);
- });
- }
- if (options.fileInput && options.fileInput.length &&
- options.type === 'POST') {
- fileInputClones = options.fileInput.clone();
- // Insert a clone for each file input field:
- options.fileInput.after(function (index) {
- return fileInputClones[index];
- });
- if (options.paramName) {
- options.fileInput.each(function (index) {
- $(this).prop(
- 'name',
- paramNames[index] || options.paramName
- );
- });
- }
- // Appending the file input fields to the hidden form
- // removes them from their original location:
- form
- .append(options.fileInput)
- .prop('enctype', 'multipart/form-data')
- // enctype must be set as encoding for IE:
- .prop('encoding', 'multipart/form-data');
- }
- form.submit();
- // Insert the file input fields at their original location
- // by replacing the clones with the originals:
- if (fileInputClones && fileInputClones.length) {
- options.fileInput.each(function (index, input) {
- var clone = $(fileInputClones[index]);
- $(input).prop('name', clone.prop('name'));
- clone.replaceWith(input);
- });
- }
- });
- form.append(iframe).appendTo(document.body);
- },
- abort: function () {
- if (iframe) {
- // javascript:false as iframe src aborts the request
- // and prevents warning popups on HTTPS in IE6.
- // concat is used to avoid the "Script URL" JSLint error:
- iframe
- .unbind('load')
- .prop('src', 'javascript'.concat(':false;'));
- }
- if (form) {
- form.remove();
- }
- }
- };
- }
- });
-
- // The iframe transport returns the iframe content document as response.
- // The following adds converters from iframe to text, json, html, xml
- // and script.
- // Please note that the Content-Type for JSON responses has to be text/plain
- // or text/html, if the browser doesn't include application/json in the
- // Accept header, else IE will show a download dialog.
- // The Content-Type for XML responses on the other hand has to be always
- // application/xml or text/xml, so IE properly parses the XML response.
- // See also
- // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
- $.ajaxSetup({
- converters: {
- 'iframe text': function (iframe) {
- return iframe && $(iframe[0].body).text();
- },
- 'iframe json': function (iframe) {
- return iframe && $.parseJSON($(iframe[0].body).text());
- },
- 'iframe html': function (iframe) {
- return iframe && $(iframe[0].body).html();
- },
- 'iframe xml': function (iframe) {
- var xmlDoc = iframe && iframe[0];
- return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
- $.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
- $(xmlDoc.body).html());
- },
- 'iframe script': function (iframe) {
- return iframe && $.globalEval($(iframe[0].body).text());
- }
- }
- });
-
-}));
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/load-image.min.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/load-image.min.js
deleted file mode 100644
index 8f04e85144..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/load-image.min.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(e){"use strict";var t=function(e,i,a){var n,r,o=document.createElement("img");if(o.onerror=i,o.onload=function(){!r||a&&a.noRevoke||t.revokeObjectURL(r),i&&i(t.scale(o,a))},t.isInstanceOf("Blob",e)||t.isInstanceOf("File",e))n=r=t.createObjectURL(e),o._type=e.type;else{if("string"!=typeof e)return!1;n=e,a&&a.crossOrigin&&(o.crossOrigin=a.crossOrigin)}return n?(o.src=n,o):t.readFile(e,function(e){var t=e.target;t&&t.result?o.src=t.result:i&&i(e)})},i=window.createObjectURL&&window||window.URL&&URL.revokeObjectURL&&URL||window.webkitURL&&webkitURL;t.isInstanceOf=function(e,t){return Object.prototype.toString.call(t)==="[object "+e+"]"},t.transformCoordinates=function(){},t.getTransformedOptions=function(e){return e},t.renderImageToCanvas=function(e,t,i,a,n,r,o,s,d,l){return e.getContext("2d").drawImage(t,i,a,n,r,o,s,d,l),e},t.hasCanvasOption=function(e){return e.canvas||e.crop},t.scale=function(e,i){i=i||{};var a,n,r,o,s,d,l,c,u,g=document.createElement("canvas"),f=e.getContext||t.hasCanvasOption(i)&&g.getContext,h=e.naturalWidth||e.width,m=e.naturalHeight||e.height,p=h,S=m,b=function(){var e=Math.max((r||p)/p,(o||S)/S);e>1&&(p=Math.ceil(p*e),S=Math.ceil(S*e))},v=function(){var e=Math.min((a||p)/p,(n||S)/S);1>e&&(p=Math.ceil(p*e),S=Math.ceil(S*e))};return f&&(i=t.getTransformedOptions(i),l=i.left||0,c=i.top||0,i.sourceWidth?(s=i.sourceWidth,void 0!==i.right&&void 0===i.left&&(l=h-s-i.right)):s=h-l-(i.right||0),i.sourceHeight?(d=i.sourceHeight,void 0!==i.bottom&&void 0===i.top&&(c=m-d-i.bottom)):d=m-c-(i.bottom||0),p=s,S=d),a=i.maxWidth,n=i.maxHeight,r=i.minWidth,o=i.minHeight,f&&a&&n&&i.crop?(p=a,S=n,u=s/d-a/n,0>u?(d=n*s/a,void 0===i.top&&void 0===i.bottom&&(c=(m-d)/2)):u>0&&(s=a*d/n,void 0===i.left&&void 0===i.right&&(l=(h-s)/2))):((i.contain||i.cover)&&(r=a=a||r,o=n=n||o),i.cover?(v(),b()):(b(),v())),f?(g.width=p,g.height=S,t.transformCoordinates(g,i),t.renderImageToCanvas(g,e,l,c,s,d,0,0,p,S)):(e.width=p,e.height=S,e)},t.createObjectURL=function(e){return i?i.createObjectURL(e):!1},t.revokeObjectURL=function(e){return i?i.revokeObjectURL(e):!1},t.readFile=function(e,t,i){if(window.FileReader){var a=new FileReader;if(a.onload=a.onerror=t,i=i||"readAsDataURL",a[i])return a[i](e),a}return!1},"function"==typeof define&&define.amd?define(function(){return t}):e.loadImage=t})(this),function(e){"use strict";"function"==typeof define&&define.amd?define(["load-image"],e):e(window.loadImage)}(function(e){"use strict";if(window.navigator&&window.navigator.platform&&/iP(hone|od|ad)/.test(window.navigator.platform)){var t=e.renderImageToCanvas;e.detectSubsampling=function(e){var t,i;return e.width*e.height>1048576?(t=document.createElement("canvas"),t.width=t.height=1,i=t.getContext("2d"),i.drawImage(e,-e.width+1,0),0===i.getImageData(0,0,1,1).data[3]):!1},e.detectVerticalSquash=function(e,t){var i,a,n,r,o,s=e.naturalHeight||e.height,d=document.createElement("canvas"),l=d.getContext("2d");for(t&&(s/=2),d.width=1,d.height=s,l.drawImage(e,0,0),i=l.getImageData(0,0,1,s).data,a=0,n=s,r=s;r>a;)o=i[4*(r-1)+3],0===o?n=r:a=r,r=n+a>>1;return r/s||1},e.renderImageToCanvas=function(i,a,n,r,o,s,d,l,c,u){if("image/jpeg"===a._type){var g,f,h,m,p=i.getContext("2d"),S=document.createElement("canvas"),b=1024,v=S.getContext("2d");if(S.width=b,S.height=b,p.save(),g=e.detectSubsampling(a),g&&(n/=2,r/=2,o/=2,s/=2),f=e.detectVerticalSquash(a,g),g||1!==f){for(r*=f,c=Math.ceil(b*c/o),u=Math.ceil(b*u/s/f),l=0,m=0;s>m;){for(d=0,h=0;o>h;)v.clearRect(0,0,b,b),v.drawImage(a,n,r,o,s,-h,-m,o,s),p.drawImage(S,0,0,b,b,d,l,c,u),h+=b,d+=c;m+=b,l+=u}return p.restore(),i}}return t(i,a,n,r,o,s,d,l,c,u)}}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["load-image"],e):e(window.loadImage)}(function(e){"use strict";var t=e.hasCanvasOption;e.hasCanvasOption=function(e){return t(e)||e.orientation},e.transformCoordinates=function(e,t){var i=e.getContext("2d"),a=e.width,n=e.height,r=t.orientation;if(r)switch(r>4&&(e.width=n,e.height=a),r){case 2:i.translate(a,0),i.scale(-1,1);break;case 3:i.translate(a,n),i.rotate(Math.PI);break;case 4:i.translate(0,n),i.scale(1,-1);break;case 5:i.rotate(.5*Math.PI),i.scale(1,-1);break;case 6:i.rotate(.5*Math.PI),i.translate(0,-n);break;case 7:i.rotate(.5*Math.PI),i.translate(a,-n),i.scale(-1,1);break;case 8:i.rotate(-.5*Math.PI),i.translate(-a,0)}},e.getTransformedOptions=function(e){if(!e.orientation||1===e.orientation)return e;var t,i={};for(t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);switch(e.orientation){case 2:i.left=e.right,i.right=e.left;break;case 3:i.left=e.right,i.top=e.bottom,i.right=e.left,i.bottom=e.top;break;case 4:i.top=e.bottom,i.bottom=e.top;break;case 5:i.left=e.top,i.top=e.left,i.right=e.bottom,i.bottom=e.right;break;case 6:i.left=e.top,i.top=e.right,i.right=e.bottom,i.bottom=e.left;break;case 7:i.left=e.bottom,i.top=e.right,i.right=e.top,i.bottom=e.left;break;case 8:i.left=e.bottom,i.top=e.left,i.right=e.top,i.bottom=e.right}return e.orientation>4&&(i.maxWidth=e.maxHeight,i.maxHeight=e.maxWidth,i.minWidth=e.minHeight,i.minHeight=e.minWidth,i.sourceWidth=e.sourceHeight,i.sourceHeight=e.sourceWidth),i}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["load-image"],e):e(window.loadImage)}(function(e){"use strict";var t=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice);e.blobSlice=t&&function(){var e=this.slice||this.webkitSlice||this.mozSlice;return e.apply(this,arguments)},e.metaDataParsers={jpeg:{65505:[]}},e.parseMetaData=function(t,i,a){a=a||{};var n=this,r=a.maxMetaDataSize||262144,o={},s=!(window.DataView&&t&&t.size>=12&&"image/jpeg"===t.type&&e.blobSlice);(s||!e.readFile(e.blobSlice.call(t,0,r),function(t){var r,s,d,l,c=t.target.result,u=new DataView(c),g=2,f=u.byteLength-4,h=g;if(65496===u.getUint16(0)){for(;f>g&&(r=u.getUint16(g),r>=65504&&65519>=r||65534===r);){if(s=u.getUint16(g+2)+2,g+s>u.byteLength){console.log("Invalid meta data: Invalid segment size.");break}if(d=e.metaDataParsers.jpeg[r])for(l=0;d.length>l;l+=1)d[l].call(n,u,g,s,o,a);g+=s,h=g}!a.disableImageHead&&h>6&&(o.imageHead=c.slice?c.slice(0,h):new Uint8Array(c).subarray(0,h))}else console.log("Invalid JPEG file: Missing JPEG marker.");i(o)},"readAsArrayBuffer"))&&i(o)}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["load-image","load-image-meta"],e):e(window.loadImage)}(function(e){"use strict";e.ExifMap=function(){return this},e.ExifMap.prototype.map={Orientation:274},e.ExifMap.prototype.get=function(e){return this[e]||this[this.map[e]]},e.getExifThumbnail=function(e,t,i){var a,n,r;if(!i||t+i>e.byteLength)return console.log("Invalid Exif data: Invalid thumbnail data."),void 0;for(a=[],n=0;i>n;n+=1)r=e.getUint8(t+n),a.push((16>r?"0":"")+r.toString(16));return"data:image/jpeg,%"+a.join("%")},e.exifTagTypes={1:{getValue:function(e,t){return e.getUint8(t)},size:1},2:{getValue:function(e,t){return String.fromCharCode(e.getUint8(t))},size:1,ascii:!0},3:{getValue:function(e,t,i){return e.getUint16(t,i)},size:2},4:{getValue:function(e,t,i){return e.getUint32(t,i)},size:4},5:{getValue:function(e,t,i){return e.getUint32(t,i)/e.getUint32(t+4,i)},size:8},9:{getValue:function(e,t,i){return e.getInt32(t,i)},size:4},10:{getValue:function(e,t,i){return e.getInt32(t,i)/e.getInt32(t+4,i)},size:8}},e.exifTagTypes[7]=e.exifTagTypes[1],e.getExifValue=function(t,i,a,n,r,o){var s,d,l,c,u,g,f=e.exifTagTypes[n];if(!f)return console.log("Invalid Exif data: Invalid tag type."),void 0;if(s=f.size*r,d=s>4?i+t.getUint32(a+8,o):a+8,d+s>t.byteLength)return console.log("Invalid Exif data: Invalid data offset."),void 0;if(1===r)return f.getValue(t,d,o);for(l=[],c=0;r>c;c+=1)l[c]=f.getValue(t,d+c*f.size,o);if(f.ascii){for(u="",c=0;l.length>c&&(g=l[c],"\0"!==g);c+=1)u+=g;return u}return l},e.parseExifTag=function(t,i,a,n,r){var o=t.getUint16(a,n);r.exif[o]=e.getExifValue(t,i,a,t.getUint16(a+2,n),t.getUint32(a+4,n),n)},e.parseExifTags=function(e,t,i,a,n){var r,o,s;if(i+6>e.byteLength)return console.log("Invalid Exif data: Invalid directory offset."),void 0;if(r=e.getUint16(i,a),o=i+2+12*r,o+4>e.byteLength)return console.log("Invalid Exif data: Invalid directory size."),void 0;for(s=0;r>s;s+=1)this.parseExifTag(e,t,i+2+12*s,a,n);return e.getUint32(o,a)},e.parseExifData=function(t,i,a,n,r){if(!r.disableExif){var o,s,d,l=i+10;if(1165519206===t.getUint32(i+4)){if(l+8>t.byteLength)return console.log("Invalid Exif data: Invalid segment size."),void 0;if(0!==t.getUint16(i+8))return console.log("Invalid Exif data: Missing byte alignment offset."),void 0;switch(t.getUint16(l)){case 18761:o=!0;break;case 19789:o=!1;break;default:return console.log("Invalid Exif data: Invalid byte alignment marker."),void 0}if(42!==t.getUint16(l+2,o))return console.log("Invalid Exif data: Missing TIFF marker."),void 0;s=t.getUint32(l+4,o),n.exif=new e.ExifMap,s=e.parseExifTags(t,l,l+s,o,n),s&&!r.disableExifThumbnail&&(d={exif:{}},s=e.parseExifTags(t,l,l+s,o,d),d.exif[513]&&(n.exif.Thumbnail=e.getExifThumbnail(t,l+d.exif[513],d.exif[514]))),n.exif[34665]&&!r.disableExifSub&&e.parseExifTags(t,l,l+n.exif[34665],o,n),n.exif[34853]&&!r.disableExifGps&&e.parseExifTags(t,l,l+n.exif[34853],o,n)}}},e.metaDataParsers.jpeg[65505].push(e.parseExifData)}),function(e){"use strict";"function"==typeof define&&define.amd?define(["load-image","load-image-exif"],e):e(window.loadImage)}(function(e){"use strict";var t,i,a;e.ExifMap.prototype.tags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright",36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",42240:"Gamma",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubSecTime",37521:"SubSecTimeOriginal",37522:"SubSecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"PhotographicSensitivity",34856:"OECF",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"CameraOwnerName",42033:"BodySerialNumber",42034:"LensSpecification",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"},e.ExifMap.prototype.stringValues={ExposureProgram:{0:"Undefined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Undefined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},ComponentsConfiguration:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"},Orientation:{1:"top-left",2:"top-right",3:"bottom-right",4:"bottom-left",5:"left-top",6:"right-top",7:"right-bottom",8:"left-bottom"}},e.ExifMap.prototype.getText=function(e){var t=this.get(e);switch(e){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":case"Orientation":return this.stringValues[e][t];case"ExifVersion":case"FlashpixVersion":return String.fromCharCode(t[0],t[1],t[2],t[3]);case"ComponentsConfiguration":return this.stringValues[e][t[0]]+this.stringValues[e][t[1]]+this.stringValues[e][t[2]]+this.stringValues[e][t[3]];case"GPSVersionID":return t[0]+"."+t[1]+"."+t[2]+"."+t[3]}return t+""},t=e.ExifMap.prototype.tags,i=e.ExifMap.prototype.map;for(a in t)t.hasOwnProperty(a)&&(i[t[a]]=a);e.ExifMap.prototype.getAll=function(){var e,i,a={};for(e in this)this.hasOwnProperty(e)&&(i=t[e],i&&(a[i]=this.getText(i)));return a}});
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/main.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/main.js
deleted file mode 100644
index 7bdf6d9016..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/main.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * jQuery File Upload Plugin JS Example 8.8.2
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2010, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint nomen: true, regexp: true */
-/*global $, window, blueimp */
-
-$(function () {
- 'use strict';
-
- // Initialize the jQuery File Upload widget:
- $('#${componentId}').fileupload({
- // Uncomment the following to send cross-domain cookies:
- //xhrFields: {withCredentials: true},
- url: '${url}'
- });
-
- // Load existing files:
- $('#${componentId}').addClass('fileupload-processing');
- $.ajax({
- // Uncomment the following to send cross-domain cookies:
- //xhrFields: {withCredentials: true},
- url: $('#${componentId}').fileupload('option', 'url'),
- dataType: 'json',
- context: $('#${componentId}')[0]
- }).always(function () {
- $(this).removeClass('fileupload-processing');
- }).done(function (result) {
- console.log('done');
- $(this).fileupload('option', 'done')
- .call(this, null, {result: result});
- });
-
-});
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/tmpl.min.js b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/tmpl.min.js
deleted file mode 100644
index bd82354436..0000000000
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/fileupload/res/js/tmpl.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(e){"use strict";var n=function(e,t){var c=/[^\w\-\.:]/.test(e)?new Function(n.arg+",tmpl","var _e=tmpl.encode"+n.helper+",_s='"+e.replace(n.regexp,n.func)+"';return _s;"):n.cache[e]=n.cache[e]||n(n.load(e));return t?c(t,n):function(e){return c(e,n)}};n.cache={},n.load=function(e){return document.getElementById(e).innerHTML},n.regexp=/([\s'\\])(?!(?:[^{]|\{(?!%))*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g,n.func=function(e,n,t,c,r,u){return n?{"\n":"\\n","\r":"\\r"," ":"\\t"," ":" "}[n]||"\\"+n:t?"="===t?"'+_e("+c+")+'":"'+("+c+"==null?'':"+c+")+'":r?"';":u?"_s+='":void 0},n.encReg=/[<>&"'\x00]/g,n.encMap={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;","'":"&#39;"},n.encode=function(e){return(null==e?"":""+e).replace(n.encReg,function(e){return n.encMap[e]||""})},n.arg="o",n.helper=",print=function(s,e){_s+=e?(s==null?'':s):_e(s);},include=function(s,d){_s+=tmpl(s,d);}","function"==typeof define&&define.amd?define(function(){return n}):e.tmpl=n}(this);
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/messenger/res/css/messenger-theme-flat.css b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/messenger/res/css/messenger-theme-flat.css
index 8e4c0a6576..101c622cab 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/messenger/res/css/messenger-theme-flat.css
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/component/messenger/res/css/messenger-theme-flat.css
@@ -359,6 +359,10 @@ ul.messenger-theme-flat .messenger-message.alert-info .messenger-message-inner:b
ul.messenger-theme-flat .messenger-message.alert-error .messenger-message-inner:before {
background: #dd6a45;
}
+ul.messenger-theme-flat .messenger-message.alert-warning .messenger-message-inner:before {
+ background: #dd6a45;
+}
+
/* line 32, ../../src/sass/messenger-spinner.scss */
ul.messenger-theme-flat .messenger-message.alert-error.messenger-retry-soon .messenger-spinner {
width: 32px;
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/util/JQuery.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/util/JQuery.java
new file mode 100644
index 0000000000..f52cb73937
--- /dev/null
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/util/JQuery.java
@@ -0,0 +1,469 @@
+package com.pmease.gitop.web.common.wicket.util;
+
+import java.util.List;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.core.util.string.JavaScriptUtils;
+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
+import org.apache.wicket.util.io.IClusterable;
+import org.apache.wicket.util.string.Strings;
+import org.apache.wicket.util.time.Duration;
+
+import com.google.common.base.Function;
+import com.google.common.base.Joiner;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.pmease.commons.jackson.JsOptions;
+
+/**
+ * Copied from https://github.com/l0rdn1kk0n/wicket-bootstrap
+ *
+ * The Jquery class helps to keep all javascript jquery scripts type safe.
+ *
+ * @author miha
+ */
+@SuppressWarnings("serial")
+public final class JQuery implements IClusterable {
+
+ /**
+ * Function that maps an {@link IFunction} to its string representation.
+ */
+ private static final Function<IFunction, String> FUNCTION_TRANSFORMER = new Function<IFunction, String>() {
+ @Override
+ public String apply(final IFunction function) {
+ return function != null ? function.build() : null;
+ }
+ };
+
+ /**
+ * helper method to allow a jquery like code style
+ *
+ * @param selector The jquery selector
+ * @return new Jquery instance
+ */
+ public static JQuery $(final String selector) {
+ return new JQuery(selector);
+ }
+
+ /**
+ * helper method to allow a jquery like code style
+ *
+ * @param component The markup id of given component is used as jquery selector
+ * @return new Jquery instance
+ */
+ public static JQuery $(final Component component) {
+ return $("#" + component.getMarkupId(true));
+ }
+
+ /**
+ * helper method to allow a jquery like code style
+ *
+ * @param component The markup id of given component is used as jquery selector
+ * @param additionalSelector an additional initial selector
+ * @return new Jquery instance
+ */
+ public static JQuery $(final Component component, final String... additionalSelector) {
+ final List<String> selector = Lists.newArrayList("#" + component.getMarkupId(true));
+
+ if (additionalSelector != null) {
+ selector.addAll(Lists.newArrayList(additionalSelector));
+ }
+
+ return $(Joiner.on(' ').join(selector));
+ }
+
+ public JQuery on(String events, JavaScriptInlineFunction handler) {
+ return chain(OnJqueryFunction.on(events, handler));
+ }
+
+ public JQuery on(String events, String selector, JavaScriptInlineFunction handler) {
+ return chain(OnJqueryFunction.on(events, selector, handler));
+ }
+
+ public JQuery closest(String selector) {
+ return chain(ClosestJqueryFunction.closest(selector));
+ }
+
+ private final String selector;
+ private final List<IFunction> functions;
+
+ /**
+ * Construct.
+ *
+ * @param selector the selector to use.
+ */
+ private JQuery(final String selector) {
+ this.selector = selector;
+ this.functions = Lists.newArrayList();
+ }
+
+ /**
+ * adds a chained function to this jquery instance
+ *
+ * @param function the function to add
+ * @return this instance for chaining
+ */
+ public JQuery chain(final IFunction function) {
+ functions.add(function);
+ return this;
+ }
+
+ /**
+ * adds a chained function to this jquery instance
+ *
+ * @param functionName the function to add
+ * @return this instance for chaining
+ */
+ public JQuery chain(final String functionName) {
+ functions.add(new SimpleFunction(functionName));
+ return this;
+ }
+
+ /**
+ * @return this jquery chain as string.
+ */
+ public String get() {
+ return "$('" + selector + "')" + createFunctionString() + ";";
+ }
+
+ /**
+ * @return this jquery script as {@link OnDomReadyHeaderItem} instance
+ */
+ public final OnDomReadyHeaderItem asDomReadyScript() {
+ return OnDomReadyHeaderItem.forScript(get());
+ }
+
+ /**
+ * @return all functions as joined string.
+ */
+ private String createFunctionString() {
+ return functions.isEmpty() ? "" : "." + Joiner.on('.').join(Iterables.transform(functions, FUNCTION_TRANSFORMER));
+ }
+
+ /**
+ * adds a chained function to this jquery instance
+ *
+ * @param functionName the function to add
+ * @param config the function configuration
+ * @return this instance for chaining
+ */
+ public JQuery chain(final String functionName, final JsOptions config) {
+ functions.add(new ConfigurableFunction(functionName, config));
+ return this;
+ }
+
+ /**
+ * simple interface to represent a jquery function.
+ */
+ public static interface IFunction extends IClusterable {
+
+ /**
+ * @return the function as javascript string.
+ */
+ String build();
+ }
+
+ private static String nullToEmpty(String str) {
+ return str == null ? "" : str;
+ }
+
+ /**
+ * simple class to represent a javascript function.
+ */
+ public static class JavaScriptInlineFunction extends AbstractFunction {
+ private final String functionBody;
+
+ /**
+ * Construct.
+ *
+ * @param functionBody the function body as string
+ */
+ public JavaScriptInlineFunction(final String functionBody) {
+ super("function");
+
+ this.functionBody = nullToEmpty(functionBody);
+ }
+
+ @Override
+ public String build() {
+ return super.build() + "{" + functionBody + "}";
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof JavaScriptInlineFunction) {
+ return functionBody.equals(((JavaScriptInlineFunction) o).functionBody);
+ } else if (o instanceof String) {
+ return functionBody.equals(o);
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return functionBody.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return functionBody;
+ }
+
+ /**
+ * @param value The value to stringify
+ * @return string representation of given value
+ */
+ public static String toString(final JavaScriptInlineFunction value) {
+ return value != null ? value.toString() : "null";
+ }
+ }
+
+ /**
+ * a simple function without params and body
+ */
+ public static final class SimpleFunction extends AbstractFunction {
+ /**
+ * Construct.
+ *
+ * @param functionName The function name of this {@link de.agilecoders.wicket.core.util.JQuery.IFunction} implementation
+ */
+ protected SimpleFunction(final String functionName) {
+ super(functionName);
+ }
+ }
+
+ /**
+ * a configurable function with one parameter (an {@link AbstractConfig}) and without body
+ */
+ public static final class ConfigurableFunction extends AbstractFunction {
+
+ /**
+ * Construct.
+ *
+ * @param functionName The function name of this {@link de.agilecoders.wicket.core.util.JQuery.IFunction} implementation
+ * @param config the function configuration
+ */
+ protected ConfigurableFunction(final String functionName, final JsOptions config) {
+ super(functionName);
+
+ if (!config.isEmpty()) {
+ addParameter(config.toString());
+ }
+ }
+ }
+
+ /**
+ * java abstraction of jquery each function
+ */
+ public static final class EachJqueryFunction extends AbstractFunction {
+
+ /**
+ * creates a new {@link EachJqueryFunction} instance that holds a given inline function.
+ *
+ * @param function The inline function to execute for each element
+ * @return new {@link EachJqueryFunction} instance
+ */
+ public static EachJqueryFunction each(final JavaScriptInlineFunction function) {
+ return new EachJqueryFunction(function);
+ }
+
+ /**
+ * Construct.
+ */
+ protected EachJqueryFunction(final JavaScriptInlineFunction function) {
+ super("each");
+
+ addParameter(toParameterValue(function));
+ }
+ }
+
+ /**
+ * java abstraction of jquery closest function
+ */
+ public static final class ClosestJqueryFunction extends AbstractFunction {
+
+ /**
+ * creates a new {@link ClosestJqueryFunction} instance
+ *
+ * @param selector The CSS selector to use the closest parent
+ * @return new {@link ClosestJqueryFunction} instance
+ */
+ public static ClosestJqueryFunction closest(final String selector) {
+ return new ClosestJqueryFunction(selector);
+ }
+
+ /**
+ * Construct.
+ */
+ protected ClosestJqueryFunction(final String selector) {
+ super("closest");
+
+ addParameter("'" + JavaScriptUtils.escapeQuotes(selector) + "'");
+ }
+ }
+
+ /**
+ * java abstraction of JQuery <em>on</em> function
+ */
+ public static final class OnJqueryFunction extends AbstractFunction {
+
+ /**
+ * creates a new {@link OnJqueryFunction} instance
+ *
+ * @param events The CSS selector for event delegation
+ * @return new {@link OnJqueryFunction} instance
+ */
+ public static OnJqueryFunction on(final String events, JavaScriptInlineFunction handler) {
+ return new OnJqueryFunction(events, null, handler);
+ }
+
+ /**
+ * creates a new {@link OnJqueryFunction} instance
+ *
+ * @param selector The CSS selector for event delegation
+ * @return new {@link OnJqueryFunction} instance
+ */
+ public static OnJqueryFunction on(final String events, final String selector, JavaScriptInlineFunction handler) {
+ return new OnJqueryFunction(events, selector, handler);
+ }
+
+ /**
+ * Construct.
+ */
+ // TODO Add support for 'data' parameter
+ protected OnJqueryFunction(final String events, final String selector, final JavaScriptInlineFunction handler) {
+ super("on");
+
+ addParameter("'" + events + "'");
+
+ if (!Strings.isEmpty(selector)) {
+ addParameter("'" + JavaScriptUtils.escapeQuotes(selector) + "'");
+ }
+
+ handler.addParameter("evt");
+ addParameter(toParameterValue(handler));
+ }
+ }
+
+ /**
+ * A simple implementation of {@link IFunction} that allows you to chain
+ * function parameters in a javascript safe way.
+ */
+ public static abstract class AbstractFunction implements IFunction {
+ private final String functionName;
+ private final List<String> parameters;
+
+ /**
+ * Construct.
+ *
+ * @param functionName The function name of this {@link IFunction} implementation
+ */
+ protected AbstractFunction(final String functionName) {
+ this.functionName = functionName;
+ this.parameters = Lists.newArrayList();
+ }
+
+ @Override
+ public String build() {
+ return functionName + "(" + buildParameters() + ")";
+ }
+
+ /**
+ * @return the separator
+ */
+ protected final char getSeparator() {
+ return ',';
+ }
+
+ /**
+ * @return a joined list of parameters as string
+ */
+ protected String buildParameters() {
+ return Joiner.on(getSeparator()).join(parameters);
+ }
+
+ /**
+ * adds a new parameter to parameter list
+ *
+ * @param parameter The parameter to add
+ */
+ protected final void addParameter(final String parameter) {
+ parameters.add(parameter);
+ }
+
+ /**
+ * transform given value to a javascript parameter value
+ *
+ * @param value The value to transform
+ * @return value as string
+ */
+ protected final String toParameterValue(final Object value) {
+ if (value instanceof Long) {
+ return toParameterValue((Long) value);
+ } else if (value instanceof Integer) {
+ return toParameterValue((Integer) value);
+ } else if (value instanceof Boolean) {
+ return toParameterValue((Boolean) value);
+ } else if (value instanceof Float) {
+ return toParameterValue((Float) value);
+ } else if (value instanceof JavaScriptInlineFunction) {
+ return toParameterValue((JavaScriptInlineFunction) value);
+ } else if (value instanceof Duration) {
+ return String.valueOf(((Duration) value).getMilliseconds());
+ }
+
+ return value != null ? "'" + String.valueOf(value) + "'" : "null";
+ }
+
+ /**
+ * transform given value to a javascript parameter value
+ *
+ * @param value The value to transform
+ * @return value as string
+ */
+ protected final String toParameterValue(final JavaScriptInlineFunction value) {
+ return value != null ? value.build() : "null";
+ }
+
+ /**
+ * transform given value to a javascript parameter value
+ *
+ * @param value The value to transform
+ * @return value as string
+ */
+ protected final String toParameterValue(final Long value) {
+ return Long.toString(value);
+ }
+
+ /**
+ * transform given value to a javascript parameter value
+ *
+ * @param value The value to transform
+ * @return value as string
+ */
+ protected final String toParameterValue(final Integer value) {
+ return Integer.toString(value);
+ }
+
+ /**
+ * transform given value to a javascript parameter value
+ *
+ * @param value The value to transform
+ * @return value as string
+ */
+ protected final String toParameterValue(final Float value) {
+ return Float.toString(value);
+ }
+
+ /**
+ * transform given value to a javascript parameter value
+ *
+ * @param value The value to transform
+ * @return value as string
+ */
+ protected final String toParameterValue(final Boolean value) {
+ return value != null ? Boolean.toString(value) : "null";
+ }
+ }
+}
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/util/WicketUtils.java b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/util/WicketUtils.java
similarity index 98%
rename from gitop.web/src/main/java/com/pmease/gitop/web/util/WicketUtils.java
rename to gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/util/WicketUtils.java
index a1caeccf26..fea7524d9c 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/util/WicketUtils.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/common/wicket/util/WicketUtils.java
@@ -1,4 +1,4 @@
-package com.pmease.gitop.web.util;
+package com.pmease.gitop.web.common.wicket.util;
import java.util.Map;
@@ -20,6 +20,7 @@ import org.apache.wicket.util.string.StringValue;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
+import com.pmease.gitop.web.util.CookieUtils;
public final class WicketUtils {
private WicketUtils() {
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/component/choice/UserChoiceProvider.java b/gitop.web/src/main/java/com/pmease/gitop/web/component/choice/UserChoiceProvider.java
index d9808cb1e5..7cdbab9847 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/component/choice/UserChoiceProvider.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/component/choice/UserChoiceProvider.java
@@ -17,9 +17,9 @@ import com.pmease.gitop.core.Gitop;
import com.pmease.gitop.core.manager.UserManager;
import com.pmease.gitop.model.User;
import com.pmease.gitop.web.GitopWebApp;
+import com.pmease.gitop.web.common.wicket.util.WicketUtils;
import com.pmease.gitop.web.component.avatar.AvatarImageResourceReference;
import com.pmease.gitop.web.util.Gravatar;
-import com.pmease.gitop.web.util.WicketUtils;
import com.vaynberg.wicket.select2.ChoiceProvider;
import com.vaynberg.wicket.select2.Response;
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/component/link/UserAvatarLink.java b/gitop.web/src/main/java/com/pmease/gitop/web/component/link/UserAvatarLink.java
index 26217acb20..fd0a678182 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/component/link/UserAvatarLink.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/component/link/UserAvatarLink.java
@@ -9,10 +9,10 @@ import org.apache.wicket.model.IModel;
import com.google.common.base.Preconditions;
import com.pmease.gitop.model.User;
+import com.pmease.gitop.web.common.wicket.util.WicketUtils;
import com.pmease.gitop.web.component.avatar.AvatarImage;
import com.pmease.gitop.web.page.PageSpec;
import com.pmease.gitop.web.page.account.home.AccountHomePage;
-import com.pmease.gitop.web.util.WicketUtils;
@SuppressWarnings("serial")
public class UserAvatarLink extends Panel {
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/PageSpec.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/PageSpec.java
index edd1c61c6a..808bad42f6 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/PageSpec.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/PageSpec.java
@@ -12,11 +12,11 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.pmease.gitop.model.Project;
import com.pmease.gitop.model.User;
+import com.pmease.gitop.web.common.wicket.util.WicketUtils;
import com.pmease.gitop.web.component.avatar.AvatarImage.AvatarImageType;
import com.pmease.gitop.web.page.account.home.AccountHomePage;
import com.pmease.gitop.web.page.project.source.ProjectHomePage;
import com.pmease.gitop.web.util.UrlUtils;
-import com.pmease.gitop.web.util.WicketUtils;
public class PageSpec {
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/members/AccountMembersSettingPage.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/members/AccountMembersSettingPage.html
index b6b9fc3082..becf7ce272 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/members/AccountMembersSettingPage.html
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/members/AccountMembersSettingPage.html
@@ -11,7 +11,7 @@
</section>
<wicket:fragment wicket:id="memberactionfrag">
- <a class="img-link remove-link" wicket:id="remove"><i class="icon-remove-sign"></i></a>
+ <a class="img-link remove-link" wicket:id="remove"><i class="icon icon-delete-circle"></i></a>
</wicket:fragment>
</wicket:extend>
</html>
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/members/MemberListView.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/members/MemberListView.java
index 34b51d23c0..35e58d3d85 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/members/MemberListView.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/members/MemberListView.java
@@ -104,7 +104,7 @@ public class MemberListView extends Panel {
return result;
}
- private Component createMemberTeams(String id, final IModel<User> user) {
+ protected Component createMemberTeams(String id, final IModel<User> user) {
final WebMarkupContainer teamsDiv = new WebMarkupContainer(id);
teamsDiv.setOutputMarkupId(true);
IModel<List<Membership>> teamsModel = new LoadableDetachableModel<List<Membership>>() {
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/password/AccountPasswordPage.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/password/AccountPasswordPage.html
index b32eaa0f67..1a086c9897 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/password/AccountPasswordPage.html
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/password/AccountPasswordPage.html
@@ -6,6 +6,7 @@
</div>
<div class="padder">
<form wicket:id="form" class="form-md">
+ <div wicket:id="feedback"></div>
<div wicket:id="oldPass"></div>
<div wicket:id="newPass"></div>
<div wicket:id="confirmPass"></div>
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/password/AccountPasswordPage.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/password/AccountPasswordPage.java
index fb658d9326..35fb255bb7 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/password/AccountPasswordPage.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/password/AccountPasswordPage.java
@@ -3,6 +3,7 @@ package com.pmease.gitop.web.page.account.setting.password;
import org.apache.shiro.authc.credential.PasswordService;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton;
+import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator;
import org.apache.wicket.model.PropertyModel;
@@ -14,7 +15,7 @@ import org.apache.wicket.validation.ValidationError;
import com.pmease.commons.loader.AppLoader;
import com.pmease.gitop.core.manager.UserManager;
import com.pmease.gitop.model.User;
-import com.pmease.gitop.web.common.wicket.component.messenger.Messenger;
+import com.pmease.gitop.web.common.wicket.bootstrap.NotificationPanel;
import com.pmease.gitop.web.common.wicket.form.passwordfield.PasswordFieldElement;
import com.pmease.gitop.web.model.UserModel;
import com.pmease.gitop.web.page.account.setting.AccountSettingPage;
@@ -40,6 +41,8 @@ public class AccountPasswordPage extends AccountSettingPage {
Form<User> form = new Form<User>("form", new UserModel(getAccount()));
add(form);
+
+ form.add(new NotificationPanel("feedback", new ComponentFeedbackMessageFilter(this)));
form.add(new PasswordFieldElement("oldPass", "Current Password",
new PropertyModel<String>(this, "oldPass"))
.add(new IValidator<String>() {
@@ -79,8 +82,8 @@ public class AccountPasswordPage extends AccountSettingPage {
oldPass = null;
newPass = null;
confirmPass = null;
+ form.success("Your password has been changed successfully.");
target.add(form);
- Messenger.success("Your password has been changed successfully.").run(target);
}
}
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/profile/AccountProfilePage.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/profile/AccountProfilePage.html
index b99e8137f0..3dcf63a4f3 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/profile/AccountProfilePage.html
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/profile/AccountProfilePage.html
@@ -6,7 +6,7 @@
</div>
<div class="padder">
<form wicket:id="form" class="form-md">
- <div wicket:id="feedback" class="form-feedback"></div>
+ <div wicket:id="feedback"></div>
<div wicket:id="displayName"></div>
<div wicket:id="email"></div>
<div class="submits">
@@ -22,11 +22,18 @@
<div class="padder">
<div class="clearfix">
<div class="left avatar avatar-xlarge" wicket:id="currentavatar"></div>
- <form wicket:id="avatarForm" class="form-md" style="padding-left: 150px;">
- <div wicket:id="feedback" class="form-feedback"></div>
- <p>
- <input type="file" wicket:id="fileInput" />
- </p>
+ <form wicket:id="avatarForm" class="form-md avatar-form" style="padding-left: 150px;">
+ <div wicket:id="feedback" class=""></div>
+
+ <div class="fileinput fileinput-new" data-provides="fileinput">
+ <div class="fileinput-preview thumbnail" data-trigger="fileinput"></div>
+ <div>
+ <a class="btn btn-default btn-file"><span class="fileinput-new">Select image</span><span class="fileinput-exists">Change</span>
+ <input type="file" wicket:id="fileInput" name="..."></a>
+ <a href="#" class="btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
+ </div>
+ </div>
+
<p class="text-muted">
Supported image types are png, gif, jpg and jpeg. The image size should be less than 2M bytes.
</p>
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/profile/AccountProfilePage.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/profile/AccountProfilePage.java
index 263a9a815c..a5e9f2ae4f 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/profile/AccountProfilePage.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/profile/AccountProfilePage.java
@@ -7,9 +7,9 @@ import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.bean.validation.PropertyValidator;
import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.upload.FileUpload;
-import org.apache.wicket.markup.html.form.upload.FileUploadField;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
@@ -25,9 +25,9 @@ import com.pmease.commons.util.FileUtils;
import com.pmease.gitop.core.manager.UserManager;
import com.pmease.gitop.model.User;
import com.pmease.gitop.web.SitePaths;
-import com.pmease.gitop.web.common.wicket.component.messenger.Messenger;
+import com.pmease.gitop.web.common.wicket.bootstrap.NotificationPanel;
+import com.pmease.gitop.web.common.wicket.bootstrap.jasny.FileUploadField;
import com.pmease.gitop.web.common.wicket.component.vex.AjaxConfirmButton;
-import com.pmease.gitop.web.common.wicket.form.FeedbackPanel;
import com.pmease.gitop.web.common.wicket.form.textfield.TextFieldElement;
import com.pmease.gitop.web.component.avatar.AvatarChanged;
import com.pmease.gitop.web.component.avatar.AvatarImage;
@@ -76,7 +76,7 @@ public class AccountProfilePage extends AccountSettingPage {
@SuppressWarnings("unchecked")
final IModel<User> model = (IModel<User>) getDefaultModel();
- add(new FeedbackPanel("feedback", this));
+ add(new NotificationPanel("feedback", new ComponentFeedbackMessageFilter(this)));
add(new TextFieldElement<String>("displayName", "Display Name",
new PropertyModel<String>(model, "displayName"))
.setRequired(false).add(new PropertyValidator<String>()));
@@ -94,8 +94,8 @@ public class AccountProfilePage extends AccountSettingPage {
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
User user = model.getObject();
AppLoader.getInstance(UserManager.class).save(user);
- Messenger.success("Account profile has been updated.")
- .run(target);
+ form.success("Account profile has been updated.");
+ target.add(form);
}
});
}
@@ -123,7 +123,7 @@ public class AccountProfilePage extends AccountSettingPage {
add(uploadField);
- add(new FeedbackPanel("feedback"));
+ add(new NotificationPanel("feedback", new ComponentFeedbackMessageFilter(this)));
add(new AjaxButton("submit", this) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
@@ -176,8 +176,8 @@ public class AccountProfilePage extends AccountSettingPage {
AppLoader.getInstance(UserManager.class).save(user);
send(getPage(), Broadcast.BREADTH, new AvatarChanged(target));
+ form.success("Your avatar has been updated successfully");
target.add(form);
- Messenger.success("Your avatar has been changed!").run(target);;
}
}
});
@@ -192,7 +192,7 @@ public class AccountProfilePage extends AccountSettingPage {
AppLoader.getInstance(UserManager.class).save(user);
send(getPage(), Broadcast.BREADTH, new AvatarChanged(target));
- Messenger.success("Your avatar has been reset to the default.").run(target);
+ form.success("Your avatar has been reset to the default.");
target.add(form);
}
});
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/EditTeamPage.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/EditTeamPage.html
index a7ced2ee5a..eeb6c89e3e 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/EditTeamPage.html
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/EditTeamPage.html
@@ -4,8 +4,23 @@
<div class="head">
<h2>
<wicket:container wicket:id="head">Edit Team</wicket:container>
+ <small wicket:id="teamname"></small>
</h2>
</div>
+ <div class="actionbar" role="toolbar">
+ <a wicket:id="backlink" class="btn"><i class="icon icon-long-arrow-left"></i> Back to list</a>
+ <div class="btn-group">
+ <a class="btn" href="javascript:void(0)" wicket:id="teamstoggle" data-toggle="dropdown"><i class="icon icon-pencil"></i> Edit team <span class="caret"></span></a>
+ <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
+ <li wicket:id="teams">
+ <a wicket:id="editlink"><span wicket:id="name"></span></a>
+ </li>
+ </ul>
+ </div>
+ <a wicket:id="addlink" class="btn"><i class="icon icon-plus"></i> New team</a>
+ <a class="btn btn-delete-team" wicket:id="deleteteamlink"><i class="icon icon-times"></i> Remove this team</a>
+ </div>
+
<div class="body">
<div wicket:id="editor"></div>
</div>
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/EditTeamPage.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/EditTeamPage.java
index ca5c8826fc..75e3fc7b0a 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/EditTeamPage.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/EditTeamPage.java
@@ -1,20 +1,34 @@
package com.pmease.gitop.web.page.account.setting.teams;
+import java.util.List;
+
import javax.persistence.EntityNotFoundException;
import org.apache.shiro.SecurityUtils;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.AbstractLink;
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.util.string.StringValue;
+import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
import com.pmease.gitop.core.Gitop;
import com.pmease.gitop.core.manager.TeamManager;
import com.pmease.gitop.model.Team;
import com.pmease.gitop.model.User;
import com.pmease.gitop.model.permission.ObjectPermission;
+import com.pmease.gitop.web.common.wicket.component.vex.AjaxConfirmLink;
import com.pmease.gitop.web.model.TeamModel;
import com.pmease.gitop.web.page.PageSpec;
import com.pmease.gitop.web.page.account.setting.AccountSettingPage;
@@ -60,7 +74,8 @@ public class EditTeamPage extends AccountSettingPage {
@Override
protected String getPageTitle() {
- return "Edit Team";
+ Team team = getTeam();
+ return team.isNew() ? "Create Team" : team.getOwner().getName() + "'s team " + team.getName();
}
@Override
@@ -76,6 +91,60 @@ public class EditTeamPage extends AccountSettingPage {
}
}));
+
+ add(new Label("teamname", new PropertyModel<String>(teamModel, "name")));
+ add(new BookmarkablePageLink<Void>("backlink", AccountTeamsPage.class,
+ AccountTeamsPage.newParams(getAccount())));
+
+ add(new BookmarkablePageLink<Void>("addlink", AddTeamPage.class,
+ AddTeamPage.newParams(getAccount())));
+
+ WebMarkupContainer teamstoggle = new WebMarkupContainer("teamstoggle");
+ add(teamstoggle);
+
+ IModel<List<Team>> teamsModel = new LoadableDetachableModel<List<Team>>() {
+
+ @Override
+ public List<Team> load() {
+ Team current = getTeam();
+ if (current.isNew()) {
+ return Lists.newArrayList(getAccount().getTeams());
+ } else {
+ List<Team> teams = Lists.newArrayList();
+ for (Team each : getAccount().getTeams()) {
+ if (!Objects.equal(each, current)) {
+ teams.add(each);
+ }
+ }
+
+ return teams;
+ }
+ }
+ };
+
+ ListView<Team> teamsView = new ListView<Team>("teams", teamsModel) {
+
+ @Override
+ protected void populateItem(ListItem<Team> item) {
+ Team team = item.getModelObject();
+ AbstractLink link = new BookmarkablePageLink<Void>("editlink", EditTeamPage.class, EditTeamPage.newParams(team));
+ link.add(new Label("name", team.getName()));
+ item.add(link);
+ }
+
+ };
+ add(teamsView);
+
+ add(new AjaxConfirmLink<Void>("deleteteamlink", Model.of("Are you sure you want to delete this team?")) {
+
+ @Override
+ public void onClick(AjaxRequestTarget target) {
+ Team team = getTeam();
+ Gitop.getInstance(TeamManager.class).delete(team);
+ setResponsePage(AccountTeamsPage.class, AccountTeamsPage.newParams(getAccount()));
+ }
+
+ });
}
protected Team getTeam() {
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamEditor.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamEditor.html
index 611ea7df8b..4cf576e159 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamEditor.html
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamEditor.html
@@ -1,7 +1,7 @@
<html xmlns:wicket>
<wicket:panel>
<form class="form-inline form-md" wicket:id="infoForm">
- <div wicket:id="feedback" class="form-feedback"></div>
+ <div wicket:id="feedback"></div>
<div class="form-group">
<label class="control-label">Name <span class="required">*</span></label>
<input type="text" class="form-control focusable" placeholder="Name" wicket:id="name" />
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamEditor.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamEditor.java
index c5eb29d310..d12fc2516e 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamEditor.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamEditor.java
@@ -23,25 +23,16 @@ import com.pmease.gitop.core.Gitop;
import com.pmease.gitop.core.manager.TeamManager;
import com.pmease.gitop.model.Team;
import com.pmease.gitop.model.permission.operation.GeneralOperation;
-import com.pmease.gitop.web.common.wicket.component.messenger.Messenger;
-import com.pmease.gitop.web.common.wicket.form.FeedbackPanel;
+import com.pmease.gitop.web.common.wicket.bootstrap.NotificationPanel;
@SuppressWarnings("serial")
public class TeamEditor extends Panel {
-// private GeneralOperation currentPermission;
-// private String name;
-
public TeamEditor(String id, IModel<Team> teamModel) {
super(id, teamModel);
-// this.userModel = userModel;
this.setOutputMarkupId(true);
}
-// private User getAccount() {
-// return userModel.getObject();
-// }
-
private Team getTeam() {
return (Team) getDefaultModelObject();
}
@@ -53,11 +44,6 @@ public class TeamEditor extends Panel {
protected void onInitialize() {
super.onInitialize();
-// this.name = getTeam().getName();
-// this.currentPermission = getTeam().getDefaultRepoPermission();
-
-// add(createInfoForm());
-
IModel<Team> teamModel = (IModel<Team>) getDefaultModel();
add(new TeamPropForm("infoForm", teamModel).setVisibilityAllowed(!getTeam().isOwners()));
membersDiv = new WebMarkupContainer("members") {
@@ -80,6 +66,8 @@ public class TeamEditor extends Panel {
private class TeamPropForm extends Form<Team> {
+ private String oldTeamName;
+
public TeamPropForm(String id, IModel<Team> model) {
super(id, model);
}
@@ -89,8 +77,8 @@ public class TeamEditor extends Panel {
super.onInitialize();
Team team = getTeam();
- final String oldName = team.getName();
- add(new FeedbackPanel("feedback"));
+ oldTeamName = team.getName();
+ add(new NotificationPanel("feedback", this));
add(new TextField<String>("name", new PropertyModel<String>(getDefaultModel(), "name"))
.add(new IValidator<String>() {
@@ -105,7 +93,7 @@ public class TeamEditor extends Panel {
return;
}
- if (!getTeam().isNew() && name.equalsIgnoreCase(oldName)) {
+ if (!getTeam().isNew() && name.equalsIgnoreCase(oldTeamName)) {
return; // name not change
}
@@ -162,129 +150,20 @@ public class TeamEditor extends Panel {
Team team = getTeam();
boolean isNew = team.isNew();
Gitop.getInstance(TeamManager.class).save(team);
- target.add(TeamEditor.this);
- Messenger.success(
+ form.success(
String.format("Team has been %s successfully.",
- isNew ? "created" : "updated")).run(target);
+ isNew ? "created" : "updated"));
+ oldTeamName = team.getName();
+ if (isNew) {
+ setResponsePage(EditTeamPage.class, EditTeamPage.newParams(team));
+ } else {
+ target.add(TeamEditor.this);
+ }
}
});
}
}
-// private Form<?> createInfoForm() {
-// Form<?> infoForm = new Form<Void>("infoForm");
-// add(infoForm);
-// infoForm.add(new FeedbackPanel("feedback"));
-// infoForm.add(new TextField<String>("name", new PropertyModel<String>(
-// this, "name")).add(new IValidator<String>() {
-//
-// @Override
-// public void validate(IValidatable<String> validatable) {
-// TeamManager tm = Gitop.getInstance(TeamManager.class);
-// Team team = tm.find(getAccount(), validatable.getValue());
-// Team current = getTeam();
-// if (team != null && !Objects.equal(team, current)) {
-// validatable.error(new ValidationError()
-// .setMessage("The team is already exist."));
-// }
-// }
-// }).setRequired(true));
-//
-// infoForm.add(createPermissionContainer());
-// AjaxButton btn = new AjaxButton("submit", infoForm) {
-// @Override
-// protected void onError(AjaxRequestTarget target, Form<?> form) {
-// target.add(form);
-// }
-//
-// @Override
-// protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
-// Team team = getTeam();
-// boolean isNew = team.isNew();
-// User owner = getAccount();
-// Preconditions.checkNotNull(owner, "owner");
-//
-// team.setName(name);
-// team.setAuthorizedOperation(currentPermission);
-// team.setOwner(owner);
-//
-// Gitop.getInstance(TeamManager.class).save(team);
-// target.add(TeamEditor.this);
-//
-// Messenger.success(
-// String.format("Team has been %s successfully.",
-// isNew ? "created" : "updated")).run(target);
-// }
-// };
-//
-// btn.add(new Label("label", new AbstractReadOnlyModel<String>() {
-//
-// @Override
-// public String getObject() {
-// return getTeam().isNew() ? "Create Team" : "Update Team";
-// }
-//
-// }));
-//
-// infoForm.add(btn);
-//
-// return infoForm;
-// }
-//
-// class PermissionLink extends AjaxLink<GeneralOperation> {
-//
-// PermissionLink(String id, IModel<GeneralOperation> permission) {
-// super(id, permission);
-// add(AttributeAppender.append("class",
-// new AbstractReadOnlyModel<String>() {
-//
-// @Override
-// public String getObject() {
-// return Objects.equal(currentPermission, getPermission()) ?
-// "active" : "";
-// }
-// }));
-// }
-//
-// @Override
-// public void onClick(AjaxRequestTarget target) {
-// if (Objects.equal(currentPermission, getPermission())) {
-// return;
-// }
-//
-// currentPermission = getPermission();
-// Team team = getTeam();
-// team.setAuthorizedOperation(currentPermission);
-// if (!team.isNew()) {
-// Gitop.getInstance(TeamManager.class).save(team);
-// }
-//
-// target.add(TeamEditor.this.get("infoForm:permissionContainer"));
-// }
-//
-// GeneralOperation getPermission() {
-// return (GeneralOperation) getDefaultModelObject();
-// }
-// }
-//
-// private Component createPermissionContainer() {
-// WebMarkupContainer permissionContainer = new WebMarkupContainer("permissionContainer");
-// permissionContainer.setOutputMarkupId(true);
-// permissionContainer.add(new ListView<GeneralOperation>("permissions",
-// ImmutableList.<GeneralOperation>of(GeneralOperation.READ, GeneralOperation.WRITE, GeneralOperation.ADMIN)) {
-//
-// @Override
-// protected void populateItem(ListItem<GeneralOperation> item) {
-// GeneralOperation permission = item.getModelObject();
-// AjaxLink<?> link = new PermissionLink("permission", Model.of(permission));
-// link.add(new Label("name", permission.toString()));
-// item.add(link);
-// }
-//
-// });
-// return permissionContainer;
-// }
-//
@Override
public void onDetach() {
super.onDetach();
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamMembersEditor.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamMembersEditor.html
index f338d0507f..07c791b4a6 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamMembersEditor.html
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamMembersEditor.html
@@ -1,17 +1,19 @@
<html xmlns:wicket>
<wicket:panel>
- <form class="form-inline" wicket:id="form">
- <div class="form-feedback" wicket:id="feedback"></div>
+ <form class="form-inline form-md" wicket:id="form">
<input wicket:id="userchoice" class="team-users-choice" type="hidden" style="width: 300px"></input>
<button type="submit" class="btn btn-default" wicket:id="submit">Add</button>
+ <p></p>
+ <div wicket:id="feedback"></div>
</form>
<hr/>
<div wicket:id="membersview">
- <div wicket:id="members"></div>
+ <div wicket:id="removeMemberFeedback"></div>
+ <div class="simple-teams-list" wicket:id="members"></div>
</div>
<wicket:fragment wicket:id="memberactionfrag">
- <a class="img-link remove-link" wicket:id="remove"><i class="icon-remove-sign"></i></a>
+ <a class="img-link remove-link" wicket:id="remove" data-toggle="tooltip" title="remove this user from this team"><i class="icon icon-delete-circle"></i></a>
</wicket:fragment>
</wicket:panel>
</html>
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamMembersEditor.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamMembersEditor.java
index 46217b7b42..38ad45d5c3 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamMembersEditor.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/account/setting/teams/TeamMembersEditor.java
@@ -10,6 +10,8 @@ import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
+import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.Fragment;
@@ -17,6 +19,7 @@ import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.util.WildcardListModel;
+import org.apache.wicket.util.time.Duration;
import org.hibernate.criterion.Restrictions;
import com.google.common.base.Objects;
@@ -27,8 +30,8 @@ import com.pmease.gitop.core.manager.MembershipManager;
import com.pmease.gitop.model.Membership;
import com.pmease.gitop.model.Team;
import com.pmease.gitop.model.User;
-import com.pmease.gitop.web.common.wicket.component.messenger.Messenger;
-import com.pmease.gitop.web.common.wicket.form.FeedbackPanel;
+import com.pmease.gitop.web.common.wicket.bootstrap.NotificationPanel;
+import com.pmease.gitop.web.common.wicket.util.JQuery;
import com.pmease.gitop.web.component.choice.UserMultiChoice;
import com.pmease.gitop.web.model.UserModel;
import com.pmease.gitop.web.page.account.setting.members.MemberListView;
@@ -40,10 +43,14 @@ public class TeamMembersEditor extends Panel {
super(id, model);
}
+ private Form<?> membersForm;
+
@Override
protected void onInitialize() {
super.onInitialize();
- add(newMembersForm());
+
+ this.membersForm = newMembersForm();
+ add(membersForm);
WebMarkupContainer membersDiv = new WebMarkupContainer("membersview");
membersDiv.setOutputMarkupId(true);
@@ -78,13 +85,16 @@ public class TeamMembersEditor extends Panel {
}
};
- membersDiv.add(newMembersListView(membersModel));
+ Component membersView = newMembersListView(membersModel);
+ membersDiv.add(membersView);
+ NotificationPanel removeMembersFeedback = new NotificationPanel("removeMemberFeedback", new ComponentFeedbackMessageFilter(membersDiv));
+ membersDiv.add(removeMembersFeedback);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private Form<?> newMembersForm() {
Form<?> form = new Form<Void>("form");
- form.add(new FeedbackPanel("feedback"));
+ form.add(new NotificationPanel("feedback", new ComponentFeedbackMessageFilter(form)).hideAfter(Duration.seconds(10)));
final IModel<Collection<User>> usersModel = new WildcardListModel(new ArrayList<User>());
form.add(new UserMultiChoice("userchoice", usersModel));
@@ -99,7 +109,7 @@ public class TeamMembersEditor extends Panel {
Set<User> users = Sets.newHashSet(usersModel.getObject());
if (users.isEmpty()) {
- form.error("Please add an user first");
+ form.warn("Please add an user first");
target.add(form);
return;
}
@@ -122,8 +132,14 @@ public class TeamMembersEditor extends Panel {
}
usersModel.setObject(new ArrayList<User>());
- target.add(form);
- onMembersChanged(target);
+ if (users.size() == 0) {
+ form.warn("Users were added before");
+ target.add(form);
+ } else {
+ form.success(users.size() + " new members added to this team");
+ target.add(form);
+ onMembersChanged(target);
+ }
}
});
@@ -132,6 +148,12 @@ public class TeamMembersEditor extends Panel {
private Component newMembersListView(IModel<List<User>> membersModel) {
return new MemberListView("members", new UserModel(getTeam().getOwner()), membersModel){
+
+ @Override
+ protected Component createMemberTeams(String id, final IModel<User> user) {
+ return new WebMarkupContainer(id).setVisibilityAllowed(false);
+ }
+
@Override
protected Component createActionsPanel(String id, IModel<User> model) {
Fragment frag = new Fragment(id, "memberactionfrag", TeamMembersEditor.this);
@@ -147,22 +169,30 @@ public class TeamMembersEditor extends Panel {
Restrictions.eq("team", team));
if (membership != null) {
Gitop.getInstance(MembershipManager.class).delete(membership);
- Messenger.warn(String.format("User [%s] is removed from team [%s]",
- user.getName(),
- team.getName()))
- .run(target);
+ // Use membersForm to show feedback?
+ //
+ membersForm.info(String.format("User %s is removed from the team",
+ user.getName()));
+ target.add(membersForm);
onMembersChanged(target);
}
}
- }.setVisibilityAllowed(!Objects.equal(getTeam().getOwner(), model.getObject())));
+ }.setVisibilityAllowed(
+ !(getTeam().isOwners() && Objects.equal(getTeam().getOwner(), model.getObject()))));
return frag;
}
}.setOutputMarkupId(true);
}
+
+ @Override
+ public void renderHead(IHeaderResponse response) {
+ super.renderHead(response);
+ }
private void onMembersChanged(AjaxRequestTarget target) {
target.add(get("membersview"));
+ target.appendJavaScript(JQuery.$("a.remove-link").chain("tooltip").get());
}
private Team getTeam() {
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/settings/CreateProjectPage.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/settings/CreateProjectPage.html
index 80b5666cac..f5aaf49d33 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/settings/CreateProjectPage.html
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/settings/CreateProjectPage.html
@@ -4,7 +4,7 @@
<h1>Create Project</h1>
<form wicket:id="form">
- <div wicket:id="feedback" class="form-feedback"></div>
+ <div wicket:id="feedback"></div>
<div wicket:id="owner"></div>
<div wicket:id="name"></div>
<div wicket:id="description"></div>
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/settings/CreateProjectPage.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/settings/CreateProjectPage.java
index 8db0eb06cb..a85834f1c3 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/settings/CreateProjectPage.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/settings/CreateProjectPage.java
@@ -6,6 +6,7 @@ import org.apache.shiro.authz.annotation.RequiresUser;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.bean.validation.PropertyValidator;
+import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
@@ -25,7 +26,7 @@ import com.pmease.gitop.core.manager.UserManager;
import com.pmease.gitop.model.Project;
import com.pmease.gitop.model.User;
import com.pmease.gitop.web.GitopHelper;
-import com.pmease.gitop.web.common.wicket.form.FeedbackPanel;
+import com.pmease.gitop.web.common.wicket.bootstrap.NotificationPanel;
import com.pmease.gitop.web.common.wicket.form.select.DropDownChoiceElement;
import com.pmease.gitop.web.common.wicket.form.textfield.TextFieldElement;
import com.pmease.gitop.web.model.ProjectModel;
@@ -68,7 +69,7 @@ public class CreateProjectPage extends AbstractLayoutPage {
Form<Project> form = new Form<Project>("form", projectModel);
add(form);
- form.add(new FeedbackPanel("feedback"));
+ form.add(new NotificationPanel("feedback", new ComponentFeedbackMessageFilter(form)));
form.add(new DropDownChoiceElement<String>("owner", "Project Owner",
new PropertyModel<String>(this, "owner"),
new AbstractReadOnlyModel<List<? extends String>>() {
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/SourceCommitPage.java b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/SourceCommitPage.java
index 6b4b01e8de..617b985f44 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/SourceCommitPage.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/source/commit/SourceCommitPage.java
@@ -134,7 +134,7 @@ public class SourceCommitPage extends ProjectCategoryPage {
AbstractLink link = new BookmarkablePageLink<Void>("link", SourceCommitPage.class,
SourceCommitPage.newParams(getProject(), sha));
item.add(link);
- link.add(new Label("sha", GitUtils.abbreviateSHA(sha, 8)));
+ link.add(new Label("sha", GitUtils.abbreviateSHA(sha)));
WebMarkupContainer connector = new WebMarkupContainer("connector");
int idx = item.getIndex();
connector.setVisibilityAllowed(idx > 0);
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/shiro/LoginPage.java b/gitop.web/src/main/java/com/pmease/gitop/web/shiro/LoginPage.java
index 0da0656f3c..04f1f4f295 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/shiro/LoginPage.java
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/shiro/LoginPage.java
@@ -14,10 +14,10 @@ import org.slf4j.LoggerFactory;
import com.pmease.gitop.web.GitopSession;
import com.pmease.gitop.web.common.wicket.form.FeedbackPanel;
import com.pmease.gitop.web.common.wicket.form.checkbox.CheckBoxElement;
+import com.pmease.gitop.web.common.wicket.util.WicketUtils;
import com.pmease.gitop.web.page.AbstractLayoutPage;
import com.pmease.gitop.web.page.PageSpec;
import com.pmease.gitop.web.page.account.home.AccountHomePage;
-import com.pmease.gitop.web.util.WicketUtils;
@SuppressWarnings("serial")
public class LoginPage extends AbstractLayoutPage {
diff --git a/gitop.web/src/test/java/com/pmease/gitop/web/util/CommandTest.java b/gitop.web/src/test/java/com/pmease/gitop/web/util/CommandTest.java
deleted file mode 100644
index 8b071e0309..0000000000
--- a/gitop.web/src/test/java/com/pmease/gitop/web/util/CommandTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.pmease.gitop.web.util;
-
-import org.codehaus.plexus.util.cli.CommandLineException;
-import org.codehaus.plexus.util.cli.CommandLineUtils;
-import org.codehaus.plexus.util.cli.Commandline;
-import org.codehaus.plexus.util.cli.DefaultConsumer;
-import org.codehaus.plexus.util.cli.StreamConsumer;
-import org.junit.Test;
-
-public class CommandTest {
-
- @Test public void testCommand() throws CommandLineException {
- Commandline cl = new Commandline();
- cl.setExecutable("/usr/local/bin/git");
- cl.addArguments(new String[] { "show", "4a187e7" , "VS2012.2 TFS Server ENU.iso" });
- CommandLineUtils.executeCommandLine(cl, new StreamConsumer() {
-
- @Override
- public void consumeLine(String line) {
-
- }
-
- }, new DefaultConsumer());
- }
-}