fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [17359] helpdesk: multiple upload


From: sigurdne
Subject: [Fmsystem-commits] [17359] helpdesk: multiple upload
Date: Fri, 24 Nov 2017 05:45:38 -0500 (EST)

Revision: 17359
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17359
Author:   sigurdne
Date:     2017-11-24 05:45:37 -0500 (Fri, 24 Nov 2017)
Log Message:
-----------
helpdesk: multiple upload

Modified Paths:
--------------
    trunk/helpdesk/inc/class.uitts.inc.php
    trunk/helpdesk/js/portico/tts.view.js
    trunk/helpdesk/templates/base/config.tpl
    trunk/helpdesk/templates/base/tts.xsl
    trunk/property/inc/class.multiuploader.inc.php

Removed Paths:
-------------
    trunk/helpdesk/templates/base/files.xsl

Modified: trunk/helpdesk/inc/class.uitts.inc.php
===================================================================
--- trunk/helpdesk/inc/class.uitts.inc.php      2017-11-23 14:38:52 UTC (rev 
17358)
+++ trunk/helpdesk/inc/class.uitts.inc.php      2017-11-24 10:45:37 UTC (rev 
17359)
@@ -52,7 +52,9 @@
                                'update_data'           => true,
                                'upload_clip'           => true,
                                'view_image'            => true,
-                               'get_reverse_assignee'=>true
+                               'get_reverse_assignee'=>true,
+                               'handle_multi_upload_file' => true,
+                               'build_multi_upload_file' => true
                        );
 
                /**
@@ -546,6 +548,60 @@
                        }
                }
 
+               public function handle_multi_upload_file()
+               {
+                       $id = phpgw::get_var('id');
+
+                       phpgw::import_class('property.multiuploader');
+
+                       $options['fakebase'] = "/helpdesk";
+                       $options['base_dir'] = $id;
+                       $options['upload_dir'] = 
$GLOBALS['phpgw_info']['server']['files_dir'].'/helpdesk/'.$options['base_dir'].'/';
+                       $options['script_url'] = 
html_entity_decode(self::link(array('menuaction' => 
'helpdesk.uitts.handle_multi_upload_file', 'id' => $id)));
+                       $upload_handler = new property_multiuploader($options, 
false);
+
+                       switch ($_SERVER['REQUEST_METHOD']) {
+                               case 'OPTIONS':
+                               case 'HEAD':
+                                       $upload_handler->head();
+                                       break;
+                               case 'GET':
+                                       $upload_handler->get();
+                                       break;
+                               case 'PATCH':
+                               case 'PUT':
+                               case 'POST':
+                                       $upload_handler->add_file();
+                                       break;
+                               case 'DELETE':
+                                       $upload_handler->delete_file();
+                                       break;
+                               default:
+                                       $upload_handler->header('HTTP/1.1 405 
Method Not Allowed');
+                       }
+
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+
+               public function build_multi_upload_file()
+               {
+                       phpgwapi_jquery::init_multi_upload_file();
+                       $id = phpgw::get_var('id', 'int');
+
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+
+                       $multi_upload_action = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'helpdesk.uitts.handle_multi_upload_file', 'id' => $id));
+
+                       $data = array
+                               (
+                               'multi_upload_action' => $multi_upload_action
+                       );
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('files', 
'multi_upload_file'));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('multi_upload' => $data));
+               }
+
                function columns()
                {
                        $receipt = array();
@@ -1613,7 +1669,7 @@
 
                        $link_file_data = array
                                (
-                               'menuaction' => 'property.uitts.view_file',
+                               'menuaction' => 'helpdesk.uitts.view_file',
                        );
 
 
@@ -2158,8 +2214,9 @@
                                'contact_phone' => $ticket['contact_phone'],
                                'pref_send_mail' => 
isset($GLOBALS['phpgw_info']['user']['preferences']['helpdesk']['tts_user_mailnotification'])
 ? 
$GLOBALS['phpgw_info']['user']['preferences']['helpdesk']['tts_user_mailnotification']
 : '',
                                'fileupload' => 
true,//isset($this->bo->config->config_data['fmttsfileupload']) ? 
$this->bo->config->config_data['fmttsfileupload'] : '',
-       //                      'multiple_uploader' => true,
-                               'fileuploader_action' => 
"{menuaction:'property.fileuploader.add',upload_target:'helpdesk.botts.addfiles',id:'{$id}'}",
+                               'multiple_uploader' => true,
+                               'multi_upload_parans' => 
"{menuaction:'helpdesk.uitts.build_multi_upload_file', id:'{$id}'}",
+//                             'fileuploader_action' => 
"{menuaction:'property.fileuploader.add',upload_target:'helpdesk.botts.addfiles',id:'{$id}'}",
                                'link_to_files' => 
isset($this->bo->config->config_data['files_url']) ? 
$this->bo->config->config_data['files_url'] : '',
                                'files' => isset($ticket['files']) ? 
$ticket['files'] : '',
                                'lang_filename' => lang('Filename'),

Modified: trunk/helpdesk/js/portico/tts.view.js
===================================================================
--- trunk/helpdesk/js/portico/tts.view.js       2017-11-23 14:38:52 UTC (rev 
17358)
+++ trunk/helpdesk/js/portico/tts.view.js       2017-11-24 10:45:37 UTC (rev 
17359)
@@ -96,11 +96,16 @@
        }
 }
 
-
 this.fileuploader = function ()
 {
-       var sUrl = phpGWLink('index.php', fileuploader_action);
-       TINY.box.show({iframe: sUrl, boxid: "frameless", width: 750, height: 
450, fixed: false, maskid: "darkmask", maskopacity: 40, mask: true, animate: 
true, close: true}); //refresh_files is called after upload
+       var sUrl = phpGWLink('index.php', multi_upload_parans);
+       TINY.box.show({iframe: sUrl, boxid: 'frameless', width: 750, height: 
450, fixed: false, maskid: 'darkmask', maskopacity: 40, mask: true, animate: 
true,
+               close: true,
+               closejs: function ()
+               {
+                       refresh_files()
+               }
+       });
 };
 
 this.refresh_files = function ()

Modified: trunk/helpdesk/templates/base/config.tpl
===================================================================
--- trunk/helpdesk/templates/base/config.tpl    2017-11-23 14:38:52 UTC (rev 
17358)
+++ trunk/helpdesk/templates/base/config.tpl    2017-11-24 10:45:37 UTC (rev 
17359)
@@ -57,14 +57,14 @@
                                {lang_default}: {lang_Open}</td>
                        <td><input name="newsettings[tts_lang_open]" 
value="{value_tts_lang_open}"></td>
                </tr>
-                       <tr>
-                               <td>{lang_reopen_status}:</td>
-                               <td>
-                                       <select 
name="newsettings[reopen_status]">
-                                               {hook_reopen_status}
-                                       </select>
-                               </td>
-                       <tr>
+               <tr>
+                       <td>{lang_reopen_status}:</td>
+                       <td>
+                               <select name="newsettings[reopen_status]">
+                                       {hook_reopen_status}
+                               </select>
+                       </td>
+               <tr>
                <tr class="pure-table-odd">
                        <td >{lang_TTS_disable_assign_to_user_on_add}:</td>
                        <td>
@@ -232,6 +232,10 @@
                                </select>
                        </td>
                </tr>
+               <tr>
+                       <td>{lang_uploader_filetypes}: jpg,gif,png</td>
+                       <td><input name="newsettings[uploader_filetypes]" 
value="{value_uploader_filetypes}"></td>
+               </tr>
 
                <!-- END body -->
                <!-- BEGIN footer -->

Deleted: trunk/helpdesk/templates/base/files.xsl
===================================================================
--- trunk/helpdesk/templates/base/files.xsl     2017-11-23 14:38:52 UTC (rev 
17358)
+++ trunk/helpdesk/templates/base/files.xsl     2017-11-24 10:45:37 UTC (rev 
17359)
@@ -1,53 +0,0 @@
-
-<!-- $Id: files.xsl 15892 2016-10-24 13:50:59Z sigurdne $ -->
-
-<xsl:template name="multi_upload">
-       <xsl:apply-templates select="multi_upload"/>
-</xsl:template>
-
-<xsl:template xmlns:php="http://php.net/xsl"; match="multi_upload">
-       <xsl:call-template name="multi_upload_file"/>
-</xsl:template>
-
-
-<!-- New template-->
-<xsl:template xmlns:php="http://php.net/xsl"; name="file_upload">
-       <div class="pure-control-group">
-               <label>
-                       <xsl:value-of select="php:function('lang', 'upload 
files')"/>
-               </label>
-               <input type="file" name="file" size="40" class="pure-input-1-2" 
>
-                       <xsl:attribute name="title">
-                               <xsl:value-of select="php:function('lang', 
'Select file to upload')"/>
-                       </xsl:attribute>
-               </input>
-       </div>
-       <xsl:choose>
-               <xsl:when test="multiple_uploader!=''">
-                       <div class="pure-control-group">
-                               <label>
-                                       <a href="javascript:fileuploader()">
-                                               <xsl:attribute name="title">
-                                                       <xsl:value-of 
select="php:function('lang', 'upload multiple files')"/>
-                                               </xsl:attribute>
-                                               <xsl:value-of 
select="php:function('lang', 'upload multiple files')"/>
-                                       </a>
-                               </label>
-                       </div>
-               </xsl:when>
-       </xsl:choose>
-</xsl:template>
-
-<!-- New template-->
-<xsl:template xmlns:php="http://php.net/xsl"; name="jasper_upload">
-       <div class="pure-control-group">
-               <label>
-                       <xsl:value-of select="php:function('lang', 'jasper 
upload')"/>
-               </label>
-               <input type="file" name="jasperfile" size="40">
-                       <xsl:attribute name="title">
-                               <xsl:value-of select="php:function('lang', 
'upload a jasper definition file')"/>
-                       </xsl:attribute>
-               </input>
-       </div>
-</xsl:template>

Modified: trunk/helpdesk/templates/base/tts.xsl
===================================================================
--- trunk/helpdesk/templates/base/tts.xsl       2017-11-23 14:38:52 UTC (rev 
17358)
+++ trunk/helpdesk/templates/base/tts.xsl       2017-11-24 10:45:37 UTC (rev 
17359)
@@ -595,7 +595,7 @@
                                        <xsl:choose>
                                                <xsl:when test="fileupload = 1">
                                                        <script 
type="text/javascript">
-                                                               var 
fileuploader_action = <xsl:value-of select="fileuploader_action"/>;
+                                                               var 
multi_upload_parans = <xsl:value-of select="multi_upload_parans"/>;
                                                        </script>
                                                        <xsl:call-template 
name="file_upload"/>
                                                </xsl:when>

Modified: trunk/property/inc/class.multiuploader.inc.php
===================================================================
--- trunk/property/inc/class.multiuploader.inc.php      2017-11-23 14:38:52 UTC 
(rev 17358)
+++ trunk/property/inc/class.multiuploader.inc.php      2017-11-24 10:45:37 UTC 
(rev 17359)
@@ -362,7 +362,26 @@
                        return $this->generate_response($response, 
$print_response);
                }
                
-               public function generate_response($content, $print_response = 
true) {
+               public function generate_response($_content, $print_response = 
true) {
+
+                       $content = array();
+                       /**
+                        * Filter out thumbs as individual entries
+                        */
+
+                       if(!empty($_content['files']))
+                       {
+                               $content['files'] = array();
+                               foreach ($_content['files'] as $file)
+                               {
+                                       if(substr($file->name, -5) == 'thumb')
+                                       {
+                                               continue;
+                                       }
+                                       $content['files'][] = $file;
+                               }
+                       }
+
                        $this->response = $content;
                        
                        if ($print_response) 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]