Manuel Gall 9 hónapja
szülő
commit
e82a314c4d
3 módosított fájl, 119 hozzáadás és 124 törlés
  1. 43 43
      ui/index.html
  2. 17 17
      ui/js/Upload.js
  3. 59 64
      ui/js/ustore.js

+ 43 - 43
ui/index.html

@@ -1,16 +1,16 @@
 <!--
   This file is part of centurio.work/commands.
-  
+
   centurio.work/commands is free software: you can redistribute it and/or
   modify it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or (at your
   option) any later version.
-  
+
   centurio.work/commands is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
-  
+
   You should have received a copy of the GNU General Public License along with
   centurio.work/commands (file COPYING in the main directory).  If not, see
   <http://www.gnu.org/licenses/>.
@@ -21,7 +21,7 @@
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <title>Universal Storage</title>
-    
+
     <!-- libs, do not modify. When local than load local libs. -->
     <script type="text/javascript" src="/js_libs/jquery.min.js"></script>
     <script type="text/javascript" src="/js_libs/jquery.browser.js"></script>
@@ -35,30 +35,30 @@
     <script type="text/javascript" src="/js_libs/underscore.min.js"></script>
     <script type="text/javascript" src="/js_libs/jquery.caret.min.js"></script>
     <script type="text/javascript" src="/js_libs/jquery.cookie.js"></script>
-    
-    
+
+
     <script type="text/javascript" src="/js_libs/relaxngui.js"></script>
-    
+
     <script type="text/javascript" src="/js_libs/ui.js"></script>
     <script type="text/javascript" src="/js_libs/custommenu.js"></script>
-    
+
     <link   rel="stylesheet"      href="/js_libs/custommenu.css" type="text/css"/>
     <link   rel="stylesheet"      href="/js_libs/ui.css" type="text/css"/>
-    
+
     <link   rel="stylesheet"      href="/js_libs/relaxngui.css" type="text/css"/>
-    
+
     <!-- custom stuff, play arround  -->
     <link   rel="stylesheet"      href="css/ustore.css" type="text/css"/>
     <script type="text/javascript" src="js/ustore.js"></script>
-    
-    
+
+
     <script type="text/javascript" src="js/Upload.js"></script>
-    
+
     <link   rel="stylesheet"      href="/cdp_ui/ui.css" type="text/css"/>
     <link rel="icon" href="favicon.ico">
     <link rel="icon" type="image/png" sizes="96x96" href="favicon-96x96.png">
-    
-    
+
+
   </head>
 </body>
 
@@ -79,11 +79,11 @@
           <select id="selectfolders">
           </select>
         </div>
-        
-        
+
+
         <template id="cpyFolder">
           <div class="Folder">
-          
+
             <a  class="FolderImageLink" data-class='link' style="text-decoration: none;" href="#" onclick="">
               <span class="FolderImage" >🗀</span></br>
               <span class="FolderText" data-class='text'></span>
@@ -95,7 +95,7 @@
             </div>
           </div>
         </template>
-        
+
         <template id="cpyFolderNew">
           <div class="Folder">
             <a  class="FolderImageLink" data-class='link' style="text-decoration: none;" href="#" onclick="">
@@ -105,30 +105,30 @@
           </div>
         </template>
         </br>
-        
+
         <div id="Folders">
         </div>
-        
-        
+
+
         <!--
         <a href="#" onclick="saveexternalfolder()">Add External Folder</a>
         <div id="ExternalFolders">
         </div>
         -->
-        
-        
-        
-        
+
+
+
+
       </ui-area>
-      
+
       <ui-resizehandle data-belongs-to-tab="storage" data-label="drag to resize"></ui-resizehandle>
       <ui-area data-belongs-to-tab="storage" id="detailcolumn">
-        
-        
-        
-        
-        
-        
+
+
+
+
+
+
         <div id="content-wrap">
           <form id="imgUpload" class="box" method="post" action="../images/imageUpload.php" enctype="multipart/form-data">
 					  <div class="box__input">
@@ -137,12 +137,12 @@
               <button class="box__button" type="submit">Upload</button>
             </div>
 					  <div class="box__uploading">Uploading&hellip;</div>
-					  <div class="box__success">Done! 
+					  <div class="box__success">Done!
               <a href="https://centurio.work/customers/evva/was/ui//?" class="box__restart" role="button">Upload more?</a>
             </div>
 					  <div class="box__error">Error! <span></span>.</div>
           </form>
-          
+
           <div id="MenuBar">
             <a class="showremoveitemsNot" href="javascript:selectRemoveItems();">⨯ Remove Multiple Items</a>
             <a class="showremoveitems" href="javascript:removeSelectedItems();">[Remove Selected Items]</a>
@@ -154,13 +154,13 @@
             <a class="showhowmany" href="javascript:showitems(1000);"> 1000</a>
             <a class="showhowmany" href="javascript:showitems(10000);"> 10000</a>
           </div>
-          
+
           <template id="DataItem">
             <div class="DataItem">
               <div class="spanwrapping">
                 <input data-class='multiRemovelink' class="showremoveitems" type="checkbox">
               <!--<span data-class='name' class="dataitemname"></span>-->
-                
+
                 <a data-class='name' class="mouseOver" href="#" title="Filename"></a>
               </div>
               <div data-class='image' class="DataImg">
@@ -173,21 +173,21 @@
               <a data-class='eventTrigger' href='#'style="visibility: hidden;" onclick=''>↧</a>
             </div>
           </template>
-          
+
         <div id="Data">
         </div>
         <div style ="clear:both"></div>
         </div>
-        
-        
+
+
         <div id="RemoveFolder">
           <a href="" id="removeFolderLink" >Remove folder and content!</a>
         </div>
-        
+
         <div id="overlay" onclick="overlayOff()">
-          <div id="overlaycontentsize"></div>        
+          <div id="overlaycontentsize"></div>
         </div>
-        
+
       </ui-area>
       <ui-area data-belongs-to-tab="amount" class="inactive">
       </ui-area>

+ 17 - 17
ui/js/Upload.js

@@ -25,7 +25,7 @@ function imageInit(){
 				},
 				triggerFormSubmit = function()
 				{
-          $('#imgUpload').submit(); 
+          $('#imgUpload').submit();
 					//var event = document.createEvent( 'HTMLEvents' );
 					//event.initEvent( 'submit', true, false );
 					//form.dispatchEvent( event );
@@ -78,7 +78,7 @@ function imageInit(){
 					droppedFiles = e.dataTransfer.files; // the files that were dropped
 					showFiles( droppedFiles );
 
-					
+
 					triggerFormSubmit();
           e.dataTransfer.files = [];
 									});
@@ -92,21 +92,21 @@ function imageInit(){
 
 				form.classList.add( 'is-uploading' );
 				form.classList.remove( 'is-error' );
-				
+
 				var station = $('#pattern_station').text();
 				var pattern = $('#pattern_ID').text();
 				var curCount = $('#image_count').text();
 				var language = $('#image_language option:selected').text();
-				
-				
+
+
 
 				if( isAdvancedUpload ) // ajax file upload for modern browsers
 				{
 					e.preventDefault();
 					// gathering the form data
 					var ajaxData;
-          
-					
+
+
 					var i = 0;
 					if( droppedFiles )
 					{
@@ -119,8 +119,8 @@ function imageInit(){
 					else{
 						ajaxData = new FormData( form );
 					}
-					
-					
+
+
 					// ajax request
 					var ajax = new XMLHttpRequest();
 					ajax.open( form.getAttribute( 'method' ), form.getAttribute( 'action' ), false );
@@ -131,12 +131,12 @@ function imageInit(){
 						if( ajax.status >= 200 && ajax.status < 400 )
 						{
 							listData($("#selectfolders").val())
-							
+
 							input.value = "";
 							//form.classList.add('is-success');
-							
+
 							//old upload php: saveImages(station, pattern, curCount, language, ajax.responseText);
-							
+
 							/*
 							var data = JSON.parse( ajax.responseText );
 							form.classList.add( data.success == true ? 'is-success' : 'is-error' );
@@ -151,9 +151,9 @@ function imageInit(){
 						form.classList.remove( 'is-uploading' );
 						alert( 'Error. Please, try again!' );
 					};
-          
-          
-          
+
+
+
           var object = {};
 ajaxData.forEach(function(value, key){
     object[key] = value;
@@ -165,7 +165,7 @@ ajaxData.forEach(function(value, key){
 					ajax.send( ajaxData );
           form.classList.remove( 'is-uploading' );
 					form.classList.remove( 'is-error', 'is-success' );
-          
+
           e.target.files = [];
 					input.value = "";
           droppedFiles = false;
@@ -218,4 +218,4 @@ ajaxData.forEach(function(value, key){
 
 $(document).ready(function() {
 		imageInit();
-});
+});

+ 59 - 64
ui/js/ustore.js

@@ -26,39 +26,39 @@ function listFolders(folder = ""){
   $('#CurFolder').text("");
   toggleRemoveLinks(true);
   getAllFolders();
-  
+
   if(folder != "" && folder != "." && folder != ".."){
     $("#selectfolders").val(folder);
   }
   else{
     $("#selectfolders").val(".");
   }
-  
+
   $.ajax({
 	  type: "GET",
 	  url: "../server/folders/" + folder,
 	  dataType: "json",
 	  success: function(data) {
-      
-      
+
+
       if(folder != "" && folder != "." && folder != ".."){
         var clone = document.importNode(document.querySelector('#cpyFolder').content,true);
         $('[data-class=text]',clone).text("..");
-        $('[data-class=link]',clone).attr('onclick','listFolders("' + folder.substr(0, folder.lastIndexOf("/")) + '")'); 
+        $('[data-class=link]',clone).attr('onclick','listFolders("' + folder.substr(0, folder.lastIndexOf("/")) + '")');
         // dont show remove link on .. folder
         $('[data-class=removefolder]',clone).remove()
         $('#Folders').append(clone);
       }
-      
-      
-      
+
+
+
       $.each( data, function( key, value ) {
         var clone = document.importNode(document.querySelector('#cpyFolder').content,true);
-        
+
         //remove /
         value = value.slice(0,-1)
         $('[data-class=text]',clone).text(value);
-        
+
         if(folder == ""){
           $('[data-class=link]',clone).attr('onclick','listFolders("' + value + '")');
           $('[data-class=removefolder]',clone).attr('onclick','deleteFolder("' + value + '")');
@@ -69,7 +69,7 @@ function listFolders(folder = ""){
         }
         $('#Folders').append(clone);
       });
-      
+
       //new Folder
       var clone = document.importNode(document.querySelector('#cpyFolderNew').content,true);
       $('[data-class=text]',clone).text("+");
@@ -77,7 +77,7 @@ function listFolders(folder = ""){
       $('#Folders').append(clone);
     }
   });
-  
+
   listData(folder)
 }
 
@@ -92,7 +92,7 @@ function createFolder(folder = ""){
         listFolders(folder)
       }
     });
-  }  
+  }
 }
 
 function deleteFolder(datalink) {
@@ -102,7 +102,7 @@ function deleteFolder(datalink) {
       url: "../server/folders/" + datalink,
       success: function(res) {
         listFolders(datalink.substr(0, datalink.lastIndexOf("/")))
-      } 
+      }
     });
   }
 }
@@ -113,14 +113,14 @@ function listData(folder = "", anzahl = 100){
   const imageext = ["png", "jpg", "svg", "JPG", "PNG", "SVG"]
   const movieext = ["mp4"]
   $('#imgUpload').attr("action", "../server/data/" + folder);
-  
+
   $.ajax({
 	  type: "GET",
 	  url: "../server/images/" + folder + "?anzahl=" + anzahl,
 	  dataType: "json",
 	  success: function(data) {
       $.each( data, function( key, value ) {
-        
+
         var ext = value.substr(value.lastIndexOf('.') + 1);
         if(folder == ""){
           fullfolder =  value
@@ -128,11 +128,11 @@ function listData(folder = "", anzahl = 100){
         else{
           fullfolder =  folder + "/" + value;
         }
-        
+
         var clone = document.importNode(document.querySelector('#DataItem').content,true);
         $('[data-class=name]',clone).text(value);
         $('[data-class=name]',clone).attr('title', value);
-        
+
         //Image
         if(imageext.includes(ext)){
           $('[data-class=image]',clone).append("<img src='./../storage/"+ fullfolder + "' alt=''>")
@@ -143,36 +143,36 @@ function listData(folder = "", anzahl = 100){
         else{
           $('[data-class=image]',clone).append("<div class='imageAlternative'>🗎</div>")
         }
-        
+
         $('[data-class=image]',clone).attr('onclick',"overlayOn('" + fullfolder + "')");
-        
+
 		    $('[data-class=inspect]',clone).attr('href','../storage/' + fullfolder + '');
 		    $('[data-class=delete]',clone).attr('href','javascript:deleteData("' + fullfolder + '");');
 		    $('[data-class=multiRemovelink]',clone).attr('name', fullfolder );
-        
+
 		    $('[data-class=getLink]',clone).attr('href','javascript:copy2Clipboard("' + fullfolder + '");');
-        
+
 		    $('[data-class=rename]',clone).attr('href','javascript:rename("' + fullfolder + '", "' + value.slice(0, - (ext.length +1)) +'");');
-        
+
 		    $('[data-class=createSymlink]',clone).attr('href','javascript:createSymlink("' + fullfolder + '", "' + value.slice(0, - (ext.length +1)) +'");');
-        
-        
-        
+
+
+
         var queryString = window.location.search;
         var urlParams = new URLSearchParams(queryString);
-        
+
         if(urlParams.has('iframe')){
           $('[data-class=eventTrigger]',clone).css("visibility", "visible")
 		      $('[data-class=eventTrigger]',clone).attr('href','javascript:triggerEvent("' + fullfolder + '");');
-          
+
           console.log("I am an Iframe")
         }
-        
+
         $('#Data').append(clone);
       });
     }
   });
-  
+
   if(folder != "" && folder != "." && folder != ".."){
     $('#RemoveFolder').css("display", "block")
     $('#removeFolderLink').attr('href','javascript:deleteFolder("' + folder + '");');
@@ -184,7 +184,7 @@ function listData(folder = "", anzahl = 100){
 function triggerEvent(data) {
   //get url
   var datalink = new URL("../storage/" + data, document.baseURI).href;
-  
+
   ref = $(test);
   setTimeout(function(){
     ref.triggerHandler('getUrl', {"url": datalink});
@@ -197,9 +197,9 @@ function overlayOn(data) {
   const imageext = ["png", "jpg", "svg", "PNG", "JPG", "SVG"]
   const movieext = ["mp4"]
   var ext = url.substr(url.lastIndexOf('.') + 1);
-  
+
   if(imageext.includes(ext)){
-    $('#overlaycontentsize').append("<img id='overlaycontent' src=" + url + "></img>");    
+    $('#overlaycontentsize').append("<img id='overlaycontent' src=" + url + "></img>");
   }
   else if(movieext.includes(ext)){
     $('#overlaycontentsize').append("<video id='overlaycontent' controls> <source src=" + url + " type=\"video/mp4\">Your browser does not support the video tag.</video>");
@@ -227,7 +227,7 @@ function toggleRemoveLinks(setoff = false) {
 
 
 function selectRemoveItems() {
-  toggleRemoveLinks() 
+  toggleRemoveLinks()
 }
 
 function unselectAll(){
@@ -252,13 +252,13 @@ function removeSelectedItems(){
   $("#Data input[type=checkbox]:checked").each(function(index, data){
     removedItems.push($(data).attr("name"));
   });
-  
+
   if (confirm('Deleting: ' + removedItems)) {
     $("#Data input[type=checkbox]:checked").each(function(index, data){
       //only refresh item list when last item is removed
       deleteDataItem($(data).attr("name"), index === ($("#Data input[type=checkbox]:checked").length -1))
     });
-    toggleRemoveLinks() 
+    toggleRemoveLinks()
   }
 }
 
@@ -275,7 +275,7 @@ function deleteDataItem(datalink, refresh = true) {
       success: function(res) {
         if(refresh)
           listFolders(datalink.substr(0, datalink.lastIndexOf("/")))
-      } 
+      }
     });
 }
 
@@ -294,11 +294,11 @@ function copy2Clipboard(datalink) {
 function createSymlink(datalink, oldfilename) {
 
   var filename = prompt("Please enter symlink filename");
-  
-  
-  
+
+
+
   if (filename != null && filename != "") {
-    var sendfilename = {"filename": filename, "oldfilename": oldfilename}    
+    var sendfilename = {"filename": filename, "oldfilename": oldfilename}
     $.ajax({
       type: "POST",
       data: JSON.stringify(sendfilename),
@@ -312,13 +312,13 @@ function createSymlink(datalink, oldfilename) {
       }
     });
   }
-  
-  
+
+
 }
 
 function rename(datalink, oldfilename) {
   var filename = prompt("Please enter new filename, without file extension.", oldfilename);
-  
+
   if (filename != null && filename != "") {
     var sendfilename = {"link": datalink, "oldfilename": oldfilename, "newfilename": filename}
     $.ajax({
@@ -335,8 +335,8 @@ function rename(datalink, oldfilename) {
       }
     });
   }
-  
-  
+
+
 }
 
 
@@ -351,7 +351,7 @@ function getAllFolders(folder = ""){ //Get DB 2 HTML //has to be synchronus in o
 	  success: function(data) {
       $.each( data, function( key, value ) {
         $('#selectfolders').append("<option>" + value.slice(0,-1) +"</option>")
-        
+
       });
     }
   });
@@ -371,7 +371,7 @@ function saveexternalfolder(folder = ""){
       success: function(res) {
       }
     });
-  }  
+  }
 }
 
 function listExternalFolders(folder = ""){
@@ -381,10 +381,10 @@ function listExternalFolders(folder = ""){
       type: "GET",
       url: "../server/externalFolder",
       dataType: "json",
-      success: function(data) { 
-        $.each( data, function( key, value ) {          
+      success: function(data) {
+        $.each( data, function( key, value ) {
           var clone = document.importNode(document.querySelector('#cpyFolder').content,true);
-          
+
           //remove /
           value = value.slice(0,-1)
           $('[data-class=text]',clone).text(value);
@@ -396,24 +396,24 @@ function listExternalFolders(folder = ""){
   }
   else{
     $('#Folders').text("");
-    
-    
-    
+
+
+
     //alert($.get(folder));
-    
+
     /*
       $.ajax({
       type: "GET",
       url: folder,
       crossDomain: true,
-      success: function(data) {  
+      success: function(data) {
       alert(data);
       }
       });
     */
-    
+
   }
-  
+
   //listData(folder)
 }
 
@@ -437,14 +437,9 @@ var getUrlParameter = function getUrlParameter(sParam) {
 $(document).ready(function() {
   var path = getUrlParameter('path');
   if(!path){
-   path = ""; 
+   path = "";
   }
   listFolders(path);
   //listExternalFolders();
   getAllFolders(path);
 });
-
-
-
-
-