fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17043] more on eventplanner


From: sigurdne
Subject: [Fmsystem-commits] [17043] more on eventplanner
Date: Sat, 9 Sep 2017 03:52:48 -0400 (EDT)

Revision: 17043
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17043
Author:   sigurdne
Date:     2017-09-09 03:52:48 -0400 (Sat, 09 Sep 2017)
Log Message:
-----------
more on eventplanner

Modified Paths:
--------------
    trunk/eventplanner/inc/class.uiapplication.inc.php
    trunk/eventplanner/js/portico/application.edit.js
    trunk/eventplanner/templates/base/application.xsl
    trunk/phpgwapi/templates/base/files.xsl

Modified: trunk/eventplanner/inc/class.uiapplication.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uiapplication.inc.php  2017-09-08 09:03:33 UTC 
(rev 17042)
+++ trunk/eventplanner/inc/class.uiapplication.inc.php  2017-09-09 07:52:48 UTC 
(rev 17043)
@@ -42,6 +42,8 @@
                        'view' => true,
                        'edit' => true,
                        'save' => true,
+                       'handle_multi_upload_file' => true,
+                       'build_multi_upload_file' => true
                );
 
                protected
@@ -259,6 +261,12 @@
                                'link' => '#demands',
                                'function' => "set_tab('demands')"
                        );
+                       $tabs['files'] = array(
+                               'label' => lang('files'),
+                               'link' => '#files',
+                               'function' => "set_tab('files')",
+                               'disable'       => $id ? false : true
+                       );
                        $tabs['calendar'] = array(
                                'label' => lang('calendar'),
                                'link' => '#calendar',
@@ -446,15 +454,70 @@
                                'wardrobe_list' =>  array('options' => 
$wardrobe_list),
                                'mode' => $mode,
                                'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
-                               'value_active_tab' => $active_tab
+                               'value_active_tab' => $active_tab,
+                               'multi_upload_parans' => 
"{menuaction:'property.uitts.build_multi_upload_file', id:'{$id}'}",
+                               'multiple_uploader' => true,
+
                        );
                        phpgwapi_jquery::formvalidator_generate(array('date', 
'security', 'file'));
                        phpgwapi_jquery::load_widget('autocomplete');
                        self::rich_text_editor('summary');
                        self::add_javascript($this->currentapp, 'portico', 
'application.edit.js');
-                       self::render_template_xsl(array('application', 
'datatable_inline'), array($mode => $data));
+                       self::render_template_xsl(array('application', 
'datatable_inline', 'files'), array($mode => $data));
                }
 
+               public function handle_multi_upload_file()
+               {
+                       $id = phpgw::get_var('id');
+
+                       phpgw::import_class('property.multiuploader');
+
+                       $options['base_dir'] = 'fmticket/'.$id;
+                       $options['upload_dir'] = 
$GLOBALS['phpgw_info']['server']['files_dir'].'/property/'.$options['base_dir'].'/';
+                       $options['script_url'] = 
html_entity_decode(self::link(array('menuaction' => 
'property.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' => 
'property.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));
+               }
                
                public function save()
                {

Modified: trunk/eventplanner/js/portico/application.edit.js
===================================================================
--- trunk/eventplanner/js/portico/application.edit.js   2017-09-08 09:03:33 UTC 
(rev 17042)
+++ trunk/eventplanner/js/portico/application.edit.js   2017-09-09 07:52:48 UTC 
(rev 17043)
@@ -439,33 +439,53 @@
        }
 };
 
-       $.formUtils.addValidator({
-               name: 'application_types',
-               validatorFunction: function (value, $el, config, language, 
$form)
+$.formUtils.addValidator({
+       name: 'application_types',
+       validatorFunction: function (value, $el, config, language, $form)
+       {
+               var n = 0;
+               $('#application_tbody_types input').each(function ()
                {
-                       var n = 0;
-                       $('#application_tbody_types input').each(function ()
+                       if ($(this).prop("checked"))
                        {
-                               if($(this).prop("checked"))
-                               {
-                                       n++;
-                               }
-                       });
-                       var v = (n > 0) ? true : false;
-
-                       if(v === false)
-                       {
-                               
$('#application_tbody_types').css("background-color", "#f2dede");
-                               $('#application_tbody_types').css("border", 
"#b94a48 1px solid");
+                               n++;
                        }
-                       else
-                       {
-                               
$('#application_tbody_types').css("background-color", "white");
-                               $('#application_tbody_types').css("border", 
"black");
-                       }
+               });
+               var v = (n > 0) ? true : false;
 
-                       return v;
-               },
-               errorMessage: 'Type is required',
-               errorMessageKey: 'application_types'
+               if (v === false)
+               {
+                       $('#application_tbody_types').css("background-color", 
"#f2dede");
+                       $('#application_tbody_types').css("border", "#b94a48 
1px solid");
+               }
+               else
+               {
+                       $('#application_tbody_types').css("background-color", 
"white");
+                       $('#application_tbody_types').css("border", "black");
+               }
+
+               return v;
+       },
+       errorMessage: 'Type is required',
+       errorMessageKey: 'application_types'
+});
+
+this.fileuploader = function ()
+{
+       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 ()
+{
+       base_java_url['action'] = 'get_files';
+       var oArgs = base_java_url;
+       var strURL = phpGWLink('index.php', oArgs, true);
+       JqueryPortico.updateinlineTableHelper(oTable2, strURL);
+};

Modified: trunk/eventplanner/templates/base/application.xsl
===================================================================
--- trunk/eventplanner/templates/base/application.xsl   2017-09-08 09:03:33 UTC 
(rev 17042)
+++ trunk/eventplanner/templates/base/application.xsl   2017-09-09 07:52:48 UTC 
(rev 17043)
@@ -722,6 +722,31 @@
                                                        </div>
                                                </fieldset>
                                        </div>
+
+                                       <div id='files'>
+                                                                               
                <script type="text/javascript">
+                                                                               
                        var multi_upload_parans = <xsl:value-of 
select="multi_upload_parans"/>;
+                                                                               
                </script>
+
+                                               <fieldset>
+                                                       <legend>
+                                                               <xsl:value-of 
select="php:function('lang', 'CV')"/>
+                                                       </legend>
+                                                                               
                <xsl:call-template name="file_upload"/>
+                                               </fieldset>
+
+                                               <fieldset>
+                                                       <legend>
+                                                               <xsl:value-of 
select="php:function('lang', 'documents')"/>
+                                                       </legend>
+                                                                               
                <xsl:call-template name="file_upload"/>
+
+                                               </fieldset>
+                                               
+                                       
+
+                                       </div>
+
                                        <div id='calendar'>
                                                <fieldset>
 

Modified: trunk/phpgwapi/templates/base/files.xsl
===================================================================
--- trunk/phpgwapi/templates/base/files.xsl     2017-09-08 09:03:33 UTC (rev 
17042)
+++ trunk/phpgwapi/templates/base/files.xsl     2017-09-09 07:52:48 UTC (rev 
17043)
@@ -13,18 +13,8 @@
 <!-- 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">
+               <xsl:choose>
+                       <xsl:when test="multiple_uploader!=''">
                                <label>
                                        <a href="javascript:fileuploader()">
                                                <xsl:attribute name="title">
@@ -33,9 +23,19 @@
                                                <xsl:value-of 
select="php:function('lang', 'upload multiple files')"/>
                                        </a>
                                </label>
-                       </div>
-               </xsl:when>
-       </xsl:choose>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <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>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </div>
 </xsl:template>
 
 <!-- New template-->




reply via email to

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