]> git.andy128k.dev Git - ipf.git/commitdiff
admin: html5 filebrowser. multiple upload
authorAndrey Kutejko <andy128k@gmail.com>
Tue, 17 Dec 2013 18:22:09 +0000 (20:22 +0200)
committerAndrey Kutejko <andy128k@gmail.com>
Tue, 17 Dec 2013 18:22:09 +0000 (20:22 +0200)
ipf/admin/templates/admin/base_filebrowser.html
ipf/admin/templates/admin/filebrowser.html
ipf/admin/views.php

index 8381ba8f8c55abba9b4b0f44c6c806279120948d..a68ee559ea5597b27490718456c65a68fbaff44a 100644 (file)
@@ -1,20 +1,22 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!DOCTYPE html>
+<html lang="en">
 <head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   {block css}
-  <link rel="stylesheet" href="{$ADMIN_MEDIA_URL}css/base.css" />
+  <link rel="stylesheet" href="{$ADMIN_MEDIA_URL}css/base.css">
   {/block}
-  <link rel="stylesheet" type="text/css" href="{$ADMIN_MEDIA_URL}css/print.css" media="print" />
+  <link rel="stylesheet" type="text/css" href="{$ADMIN_MEDIA_URL}css/print.css" media="print">
   <title>{$page_title} - IPF Administration</title>
+  <script language="javascript" type="text/javascript" src="{$ADMIN_MEDIA_URL}js/jquery.js"></script>
 </head>
-
 <body style="padding:0; margin:0;">
-<script language="javascript" type="text/javascript" src="{$ADMIN_MEDIA_URL}js/jquery.js"></script>
-{block breadcrumb}{/block}
-<table cellpadding="0" cellspacing="0" width="100%"><tr>
-<td valign="top" style="width:250px; background:#f0f0f0; border-right:1px dashed #a0a0a0; padding:10px;">{block sidebar}{/block}</td>
-<td valign="top" style="padding:10px;">{block content}{/block}</td>
-</tr></table>
+  {block breadcrumb}{/block}
+  <table cellpadding="0" cellspacing="0" width="100%">
+    <tr>
+      <td valign="top" style="width:250px; background:#f0f0f0; border-right:1px dashed #a0a0a0; padding:10px;">{block sidebar}{/block}</td>
+      <td valign="top" style="padding:10px;">{block content}{/block}</td>
+    </tr>
+  </table>
 </body>
 </html>
+
index 68cd1251e8ad3f89545333590c1c59d71a3ad5b8..70bb9eb72fb4efbed0086d5edbbb59a57da9929e 100644 (file)
@@ -93,51 +93,53 @@ tinyMCEPopup.onInit.add(FileBrowserDialogue.init, FileBrowserDialogue);
 
 {block sidebar}
 <form method="post">
-<h3>Add Folder</h3>
-<input name="new_folder" />
-<div class="submit-row">
-<input class="default" type="submit" value="Create"/>
-</div>
+  <h3>Add Folder</h3>
+  <input name="new_folder">
+  <div class="submit-row">
+    <input class="default" type="submit" value="Create"/>
+  </div>
 </form>
 
 <form method="post" enctype="multipart/form-data">
-<h3 style="border-top:1px dashed #a0a0a0; padding-top:5px;">Upload File</h3>
-<input type="file" name="file" />
-<div class="submit-row">
-<input class="default" type="submit" value="Upload"/>
-</div>
+  <h3 style="border-top:1px dashed #a0a0a0; padding-top:5px;">Upload File</h3>
+  <input type="file" name="files[]" multiple="multiple">
+  <div class="submit-row">
+    <input class="default" type="submit" value="Upload">
+  </div>
 </form>
 
 <div id="picname" style="display:none;">
-<h3 style="border-top:1px dashed #a0a0a0; padding:5px 0;">File Option</h3>
-<form method="post">
-    <input type="hidden" name="old_name" id="id_old_name" />
-    <input type="hidden" name="curr_dir" id="id_curr_dir" />
-    <table cellpadding="0" cellspacing="0"><tr>
-    <td> <input name="new_name" id="id_new_name" /></td><td>
-    <div class="submit-row" style="float:left;"><input class="default" type="submit" value="Rename"/></div>
-    </td></tr></table>
-</form>
-
-<form method="post">
+  <h3 style="border-top:1px dashed #a0a0a0; padding:5px 0;">File Option</h3>
+  <form method="post">
+    <input type="hidden" name="old_name" id="id_old_name">
+    <input type="hidden" name="curr_dir" id="id_curr_dir">
+    <table cellpadding="0" cellspacing="0">
+      <tr>
+        <td><input name="new_name" id="id_new_name"></td>
+        <td><div class="submit-row" style="float:left;"><input class="default" type="submit" value="Rename"></div></td>
+      </tr>
+    </table>
+  </form>
+
+  <form method="post">
     <table cellpadding="0" cellspacing="0"><tr>
     <input type="hidden" name="action" value="move" />
     <input type="hidden" name="old_name" id="id_old_name2" />
     <td><select name="move">{foreach $dirtree as $dir}<option value="{$dir['path']}">{$dir['name']}</option>{/foreach}</select></td><td>
     <div class="submit-row" style="float:left;"><input class="default" type="submit" value="Move To"/></div>
     </td></tr></table>
-</form>
-
-
+  </form>
 </div>
+
 <h3 style="border-top:1px dashed #a0a0a0; padding:5px 0;">View File</h3>
 
 <div style="border:2px solid white; width:240px; text-align:center;">
-<img id="pic" src="{$ADMIN_MEDIA_URL}img/zero.gif" width="240" height="150" /></div>
-<div class="submit-row">
-<input type="button" value="Select & Close" onclick="FileBrowserDialogue.mySubmit()" />
+  <img id="pic" src="{$ADMIN_MEDIA_URL}img/zero.gif" width="240" height="150">
 </div>
 
+<div class="submit-row">
+  <input type="button" value="Select & Close" onclick="FileBrowserDialogue.mySubmit()">
+</div>
 {/block}
 
 {block content}
index b650d95233c75206e7af0dda5cd27729987dee98..845ad0ecbab495b4bfa8e2eb01ae7f9a98a26566 100644 (file)
@@ -383,9 +383,12 @@ function IPF_Admin_Views_FileBrowser($request, $match)
         if (@$request->POST['action']=='move'){
             @rename($_dir.$request->POST['old_name'], $upload_path.$request->POST['move'].DIRECTORY_SEPARATOR.$request->POST['old_name']);
         }
-        if (@$_FILES['file']){
-            $uploadfile = $_dir . basename($_FILES['file']['name']);
-            @move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile); 
+        if (@$_FILES['files']) {
+            $count = count($_FILES['files']['name']);
+            for ($i = 0; $i < $count; ++$i) {
+                $uploadfile = $_dir . basename($_FILES['files']['name'][$i]);
+                @move_uploaded_file($_FILES['files']['tmp_name'][$i], $uploadfile);
+            }
         }
     }