This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/master by this push:
     new fb88805  [OPENMEETINGS-2000] fileupload moved to webjars
fb88805 is described below

commit fb8880554086e6c26c9877ad68451c02f2b88fb6
Author: Maxim Solodovnik <solomax...@gmail.com>
AuthorDate: Thu Dec 24 12:57:01 2020 +0700

    [OPENMEETINGS-2000] fileupload moved to webjars
---
 .../src/main/assembly/components/templates.xml     |   3 -
 openmeetings-web/pom.xml                           |  37 +---
 .../util/upload/BootstrapFileUploadBehavior.java   |   9 +-
 .../openmeetings/web/util/upload/fileinput.css     | 234 ---------------------
 .../openmeetings/web/util/upload/fileinput.js      | 198 -----------------
 pom.xml                                            |   3 +-
 6 files changed, 12 insertions(+), 472 deletions(-)

diff --git a/openmeetings-server/src/main/assembly/components/templates.xml 
b/openmeetings-server/src/main/assembly/components/templates.xml
index 346d943..7e7ba2d 100644
--- a/openmeetings-server/src/main/assembly/components/templates.xml
+++ b/openmeetings-server/src/main/assembly/components/templates.xml
@@ -35,12 +35,9 @@
                                <exclude>**/raw-*.js</exclude>
                                <exclude>**/fabric.js</exclude>
                                <exclude>**/MathJax*.js</exclude>
-                               <exclude>**/fileinput.js</exclude>
-                               <exclude>**/fileinput.css</exclude>
                                <exclude>**/adapter-latest.js</exclude>
                                <exclude>**/kurento-utils.js</exclude>
                                <exclude>**/NoSleep.js</exclude>
-                               <exclude>**/network.js</exclude>
                        </excludes>
                </fileSet>
                <fileSet>
diff --git a/openmeetings-web/pom.xml b/openmeetings-web/pom.xml
index 8974e3b..c128ca1 100644
--- a/openmeetings-web/pom.xml
+++ b/openmeetings-web/pom.xml
@@ -200,28 +200,6 @@
                                                </configuration>
                                        </execution>
                                        <execution>
-                                               <id>fileinput-js</id>
-                                               <goals>
-                                                       <goal>minify</goal>
-                                               </goals>
-                                               <configuration>
-                                                       <charset>UTF-8</charset>
-                                                       
<jsSourceDir>../java/org/apache/openmeetings/web/util/upload</jsSourceDir>
-                                                       <jsSourceFiles>
-                                                               
<jsSourceFile>fileinput.js</jsSourceFile>
-                                                       </jsSourceFiles>
-                                                       
<jsFinalFile>omfileinput.js</jsFinalFile>
-                                                       
<jsTargetDir>../generated-sources/js/org/apache/openmeetings/web/util/upload</jsTargetDir>
-                                                       
<jsEngine>CLOSURE</jsEngine>
-                                                       
<cssSourceDir>../java/org/apache/openmeetings/web/util/upload</cssSourceDir>
-                                                       <cssSourceFiles>
-                                                               
<cssSourceFile>fileinput.css</cssSourceFile>
-                                                       </cssSourceFiles>
-                                                       
<cssFinalFile>omfileinput.css</cssFinalFile>
-                                                       
<cssTargetDir>../generated-sources/js/org/apache/openmeetings/web/util/upload</cssTargetDir>
-                                               </configuration>
-                                       </execution>
-                                       <execution>
                                                <id>room-js</id>
                                                <goals>
                                                        <goal>minify</goal>
@@ -307,8 +285,6 @@
                                                **/raw-*.js,
                                                **/fabric.js,
                                                **/MathJax*.js,
-                                               **/fileinput.js,
-                                               **/fileinput.css,
                                                **/adapter-latest.js,
                                                **/kurento-utils.js,
                                                **/NoSleep.js
@@ -318,8 +294,6 @@
                                                **/raw-*.js,
                                                **/fabric.js,
                                                **/MathJax*.js,
-                                               **/fileinput.js,
-                                               **/fileinput.css,
                                                **/adapter-latest.js,
                                                **/kurento-utils.js,
                                                **/NoSleep.js
@@ -340,8 +314,6 @@
                                                                
<exclude>**/raw-*.js</exclude>
                                                                
<exclude>**/fabric.js</exclude>
                                                                
<exclude>**/MathJax*.js</exclude>
-                                                               
<exclude>**/fileinput.js</exclude>
-                                                               
<exclude>**/fileinput.css</exclude>
                                                                
<exclude>**/adapter-latest.js</exclude>
                                                                
<exclude>**/kurento-utils.js</exclude>
                                                                
<exclude>**/NoSleep.js</exclude>
@@ -458,8 +430,6 @@
                                                                                
<exclude>**/raw-*.js</exclude>
                                                                                
<exclude>**/fabric.js</exclude>
                                                                                
<exclude>**/MathJax*.js</exclude>
-                                                                               
<exclude>**/fileinput.js</exclude>
-                                                                               
<exclude>**/fileinput.css</exclude>
                                                                                
<exclude>**/adapter-latest.js</exclude>
                                                                                
<exclude>**/kurento-utils.js</exclude>
                                                                                
<exclude>**/network.js</exclude>
@@ -493,8 +463,6 @@
                                                                                
<exclude>**/raw-*.js</exclude>
                                                                                
<exclude>**/fabric.js</exclude>
                                                                                
<exclude>**/MathJax*.js</exclude>
-                                                                               
<exclude>**/fileinput.js</exclude>
-                                                                               
<exclude>**/fileinput.css</exclude>
                                                                                
<exclude>**/adapter-latest.js</exclude>
                                                                                
<exclude>**/kurento-utils.js</exclude>
                                                                                
<exclude>**/network.js</exclude>
@@ -625,6 +593,11 @@
                        <artifactId>openmeetings-webservice</artifactId>
                </dependency>
                <dependency>
+                       <groupId>org.webjars</groupId>
+                       <artifactId>jasny-bootstrap</artifactId>
+                       <version>${jasny-bootstrap.version}</version>
+               </dependency>
+               <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-core</artifactId>
                </dependency>
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/upload/BootstrapFileUploadBehavior.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/upload/BootstrapFileUploadBehavior.java
index 53e95f4..0595130 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/upload/BootstrapFileUploadBehavior.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/upload/BootstrapFileUploadBehavior.java
@@ -23,16 +23,17 @@ 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 
de.agilecoders.wicket.webjars.request.resource.WebjarsCssResourceReference;
+import 
de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference;
+
 public class BootstrapFileUploadBehavior extends Behavior {
        private static final long serialVersionUID = 1L;
        private static final ResourceReference BOOTSTRAP_FILEINPUT_JS_REFERENCE
-                       = new 
JavaScriptResourceReference(BootstrapFileUploadBehavior.class, 
"omfileinput.js");
+                       = new 
WebjarsJavaScriptResourceReference("/jasny-bootstrap/current/js/jasny-bootstrap.js");
        private static final ResourceReference BOOTSTRAP_FILEINPUT_CSS_REFERENCE
-                       = new 
CssResourceReference(BootstrapFileUploadBehavior.class, "omfileinput.css");
+                       = new 
WebjarsCssResourceReference("/jasny-bootstrap/current/css/jasny-bootstrap.css");
        public static final BootstrapFileUploadBehavior INSTANCE = new 
BootstrapFileUploadBehavior();
 
        private BootstrapFileUploadBehavior() {
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/upload/fileinput.css
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/upload/fileinput.css
deleted file mode 100644
index dd35723..0000000
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/upload/fileinput.css
+++ /dev/null
@@ -1,234 +0,0 @@
-/*!
- * Jasny Bootstrap v3.1.0 (http://jasny.github.com/bootstrap)
- * Copyright 2011-2014 Arnold Daniels.
- * Licensed under the Apache License, Version 2.0 (the "License"); 
(https://github.com/jasny/bootstrap/blob/master/LICENSE)
- */
-
-.btn-labeled {
-  padding-top: 0;
-  padding-bottom: 0;
-}
-.btn-label {
-  position: relative;
-  background: transparent;
-  background: rgba(0, 0, 0, 0.15);
-  display: inline-block;
-  padding: 6px 12px;
-  left: -12px;
-  border-radius: 3px 0 0 3px;
-}
-.btn-label.btn-label-right {
-  left: auto;
-  right: -12px;
-  border-radius: 0 3px 3px 0;
-}
-.btn-lg .btn-label {
-  padding: 10px 16px;
-  left: -16px;
-  border-radius: 5px 0 0 5px;
-}
-.btn-lg .btn-label.btn-label-right {
-  left: auto;
-  right: -16px;
-  border-radius: 0 5px 5px 0;
-}
-.btn-sm .btn-label {
-  padding: 5px 10px;
-  left: -10px;
-  border-radius: 2px 0 0 2px;
-}
-.btn-sm .btn-label.btn-label-right {
-  left: auto;
-  right: -10px;
-  border-radius: 0 2px 2px 0;
-}
-.btn-xs .btn-label {
-  padding: 1px 5px;
-  left: -5px;
-  border-radius: 2px 0 0 2px;
-}
-.btn-xs .btn-label.btn-label-right {
-  left: auto;
-  right: -5px;
-  border-radius: 0 2px 2px 0;
-}
-.nav-tabs-bottom {
-  border-bottom: 0;
-  border-top: 1px solid #dddddd;
-}
-.nav-tabs-bottom > li {
-  margin-bottom: 0;
-  margin-top: -1px;
-}
-.nav-tabs-bottom > li > a {
-  border-radius: 0 0 4px 4px;
-}
-.nav-tabs-bottom > li > a:hover,
-.nav-tabs-bottom > li > a:focus,
-.nav-tabs-bottom > li.active > a,
-.nav-tabs-bottom > li.active > a:hover,
-.nav-tabs-bottom > li.active > a:focus {
-  border: 1px solid #dddddd;
-  border-top-color: transparent;
-}
-.nav-tabs-left {
-  border-bottom: 0;
-  border-right: 1px solid #dddddd;
-}
-.nav-tabs-left > li {
-  margin-bottom: 0;
-  margin-right: -1px;
-  float: none;
-}
-.nav-tabs-left > li > a {
-  border-radius: 4px 0 0 4px;
-  margin-right: 0;
-  margin-bottom: 2px;
-}
-.nav-tabs-left > li > a:hover,
-.nav-tabs-left > li > a:focus,
-.nav-tabs-left > li.active > a,
-.nav-tabs-left > li.active > a:hover,
-.nav-tabs-left > li.active > a:focus {
-  border: 1px solid #dddddd;
-  border-right-color: transparent;
-}
-.row > .nav-tabs-left {
-  padding-right: 0;
-  padding-left: 15px;
-  margin-right: -1px;
-  position: relative;
-  z-index: 1;
-}
-.row > .nav-tabs-left + .tab-content {
-  border-left: 1px solid #dddddd;
-}
-.nav-tabs-right {
-  border-bottom: 0;
-  border-left: 1px solid #dddddd;
-}
-.nav-tabs-right > li {
-  margin-bottom: 0;
-  margin-left: -1px;
-  float: none;
-}
-.nav-tabs-right > li > a {
-  border-radius: 0 4px 4px 0;
-  margin-left: 0;
-  margin-bottom: 2px;
-}
-.nav-tabs-right > li > a:hover,
-.nav-tabs-right > li > a:focus,
-.nav-tabs-right > li.active > a,
-.nav-tabs-right > li.active > a:hover,
-.nav-tabs-right > li.active > a:focus {
-  border: 1px solid #dddddd;
-  border-left-color: transparent;
-}
-.row > .nav-tabs-right {
-  padding-left: 0;
-  padding-right: 15px;
-}
-.btn-file {
-  overflow: hidden;
-  position: relative;
-  vertical-align: middle;
-}
-.btn-file > input {
-  position: absolute;
-  top: 0;
-  right: 0;
-  margin: 0;
-  opacity: 0;
-  filter: alpha(opacity=0);
-  font-size: 23px;
-  height: 100%;
-  width: 100%;
-  direction: ltr;
-  cursor: pointer;
-}
-.fileinput {
-  margin-bottom: 9px;
-  display: inline-block;
-}
-.fileinput .form-control {
-  padding-top: 7px;
-  padding-bottom: 5px;
-  display: inline-block;
-  margin-bottom: 0px;
-  vertical-align: middle;
-  cursor: text;
-}
-.fileinput .thumbnail {
-  overflow: hidden;
-  display: inline-block;
-  margin-bottom: 5px;
-  vertical-align: middle;
-  text-align: center;
-}
-.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;
-}
-.fileinput-filename {
-  vertical-align: middle;
-  display: inline-block;
-  overflow: hidden;
-}
-.form-control .fileinput-filename {
-  vertical-align: bottom;
-}
-.fileinput.input-group {
-  display: table;
-}
-.fileinput.input-group > * {
-  position: relative;
-  z-index: 2;
-}
-.fileinput.input-group > .btn-file {
-  z-index: 1;
-}
-.fileinput-new.input-group .btn-file,
-.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-xs,
-.fileinput-new.input-group .btn-file.btn-sm,
-.fileinput-new .input-group .btn-file.btn-sm {
-  border-radius: 0 3px 3px 0;
-}
-.fileinput-new.input-group .btn-file.btn-lg,
-.fileinput-new .input-group .btn-file.btn-lg {
-  border-radius: 0 6px 6px 0;
-}
-.form-group.has-warning .fileinput .fileinput-preview {
-  color: #8a6d3b;
-}
-.form-group.has-warning .fileinput .thumbnail {
-  border-color: #faebcc;
-}
-.form-group.has-error .fileinput .fileinput-preview {
-  color: #a94442;
-}
-.form-group.has-error .fileinput .thumbnail {
-  border-color: #ebccd1;
-}
-.form-group.has-success .fileinput .fileinput-preview {
-  color: #3c763d;
-}
-.form-group.has-success .fileinput .thumbnail {
-  border-color: #d6e9c6;
-}
-.input-group-addon:not(:first-child) {
-  border-left: 0;
-}
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/upload/fileinput.js
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/upload/fileinput.js
deleted file mode 100644
index f4a9d97..0000000
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/upload/fileinput.js
+++ /dev/null
@@ -1,198 +0,0 @@
-/* ===========================================================
- * Bootstrap: fileinput.js v3.1.3
- * http://jasny.github.com/bootstrap/javascript/#fileinput
- * ===========================================================
- * Copyright 2012-2014 Arnold Daniels
- *
- * 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 Fileinput = 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">').insertBefore(this.$input)
-    }
-
-    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()
-  }
-  
-  Fileinput.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))
-  },
-
-  Fileinput.prototype.change = function(e) {
-    var files = e.target.files === undefined ? (e.target && e.target.value ? 
[{ name: e.target.value.replace(/^.+\\/, '')}] : []) : e.target.files
-    
-    e.stopPropagation()
-
-    if (files.length === 0) {
-      this.clear()
-      return
-    }
-
-    this.$hidden.val('')
-    this.$hidden.attr('name', '')
-    this.$input.attr('name', this.name)
-
-    var file = files[0]
-
-    if (this.$preview.length > 0 && (typeof file.type !== "undefined" ? 
file.type.match(/^image\/(gif|png|jpeg)$/) : 
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>')
-        $img[0].src = re.target.result
-        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', 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')
-    }
-  },
-
-  Fileinput.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 !== undefined) {
-      this.$input.trigger('change')
-      this.$element.trigger('clear.bs.fileinput')
-    }
-  },
-
-  Fileinput.prototype.reset = function() {
-    this.clear()
-
-    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')
-  },
-
-  Fileinput.prototype.trigger = function(e) {
-    this.$input.trigger('click')
-    e.preventDefault()
-  }
-
-  
-  // FILEUPLOAD PLUGIN DEFINITION
-  // ===========================
-
-  var old = $.fn.fileinput
-  
-  $.fn.fileinput = function (options) {
-    return this.each(function () {
-      var $this = $(this),
-          data = $this.data('bs.fileinput')
-      if (!data) $this.data('bs.fileinput', (data = new Fileinput(this, 
options)))
-      if (typeof options == 'string') data[options]()
-    })
-  }
-
-  $.fn.fileinput.Constructor = Fileinput
-
-
-  // FILEINPUT NO CONFLICT
-  // ====================
-
-  $.fn.fileinput.noConflict = function () {
-    $.fn.fileinput = old
-    return this
-  }
-
-
-  // FILEUPLOAD DATA-API
-  // ==================
-
-  $(document).on('click.fileinput.data-api', '[data-provides="fileinput"]', 
function (e) {
-    var $this = $(this)
-    if ($this.data('bs.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);
diff --git a/pom.xml b/pom.xml
index 732fb07..3ec8417 100644
--- a/pom.xml
+++ b/pom.xml
@@ -120,8 +120,9 @@
                <quartz.version>2.3.2</quartz.version>
                <kurento.version>6.15.0</kurento.version>
                <jain-sip.version>1.2.307</jain-sip.version><!-- other versions 
are broken! -->
+               <jasny-bootstrap.version>3.1.3-2</jasny-bootstrap.version>
                <!--  Exclude all generated code  -->
-               <sonar.exclusions>file:**/generated-sources/**, 
file:**/jquery-ui.css, file:**/fabric.js, file:**/cssemoticons.js, 
file:**/adapter-latest.js, file:**/kurento-utils.js, file:**/NoSleep.js, 
file:**/fileinput*.js, file:**/MathJax.js, file:**/network.js</sonar.exclusions>
+               <sonar.exclusions>file:**/generated-sources/**, 
file:**/jquery-ui.css, file:**/fabric.js, file:**/cssemoticons.js, 
file:**/adapter-latest.js, file:**/kurento-utils.js, file:**/NoSleep.js, 
file:**/MathJax.js</sonar.exclusions>
                <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
                <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
                
<sonar.junit.reportPaths>target/surefire-reports</sonar.junit.reportPaths>

Reply via email to