fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17044] more on eventplanner


From: sigurdne
Subject: [Fmsystem-commits] [17044] more on eventplanner
Date: Sat, 9 Sep 2017 11:42:34 -0400 (EDT)

Revision: 17044
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17044
Author:   sigurdne
Date:     2017-09-09 11:42:34 -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/setup/phpgw_no.lang
    trunk/eventplanner/templates/base/application.xsl
    trunk/eventplanner/templates/base/config.tpl
    trunk/eventplannerfrontend/inc/class.menu.inc.php
    trunk/eventplannerfrontend/js/portico/application.edit.js
    trunk/eventplannerfrontend/session.php
    trunk/eventplannerfrontend/setup/phpgw_no.lang
    trunk/eventplannerfrontend/templates/base/application.xsl
    trunk/eventplannerfrontend/templates/base/config.tpl
    trunk/phpgwapi/inc/class.jquery.inc.php
    trunk/phpgwapi/inc/class.login.inc.php
    trunk/phpgwapi/setup/phpgw_no.lang
    trunk/phpgwapi/setup/setup.inc.php
    trunk/phpgwapi/setup/tables_current.inc.php
    trunk/phpgwapi/setup/tables_update.inc.php
    trunk/phpgwapi/templates/base/files.xsl
    trunk/property/inc/class.multiuploader.inc.php

Modified: trunk/eventplanner/inc/class.uiapplication.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uiapplication.inc.php  2017-09-09 07:52:48 UTC 
(rev 17043)
+++ trunk/eventplanner/inc/class.uiapplication.inc.php  2017-09-09 15:42:34 UTC 
(rev 17044)
@@ -43,7 +43,9 @@
                        'edit' => true,
                        'save' => true,
                        'handle_multi_upload_file' => true,
-                       'build_multi_upload_file' => true
+                       'build_multi_upload_file' => true,
+                       'get_files'                             => true,
+                       'view_file'                             => true
                );
 
                protected
@@ -129,9 +131,11 @@
                {
                        if (empty($this->permissions[PHPGW_ACL_READ]))
                        {
+
                                $message = '';
                                if($this->currentapp == 'eventplannerfrontend')
                                {
+                                       
$GLOBALS['phpgw']->redirect_link('login.php', array('after' => 
'eventplannerfrontend.uiapplication.index'));
                                        $message = lang('you need to log in to 
access this page.');
                                }
                                phpgw::no_access(false, $message);
@@ -144,8 +148,16 @@
 
                        phpgwapi_jquery::load_widget('autocomplete');
 
-                       $function_msg = lang('application');
+                       if($this->currentapp == 'eventplanner')
+                       {
+                               $function_msg = lang('application');
+                       }
+                       else
+                       {
+                               $function_msg = lang('my applications');
+                       }
 
+
                        $data = array(
                                'datatable_name' => $function_msg,
                                'form' => array(
@@ -167,11 +179,14 @@
                                )
                        );
 
-                       $filters = $this->_get_filters();
+                       if($this->currentapp == 'eventplanner')
+                       {
+                               $filters = $this->_get_filters();
 
-                       foreach ($filters as $filter)
-                       {
-                               array_unshift($data['form']['toolbar']['item'], 
$filter);
+                               foreach ($filters as $filter)
+                               {
+                                       
array_unshift($data['form']['toolbar']['item'], $filter);
+                               }
                        }
 
                        $parameters = array(
@@ -183,17 +198,6 @@
                                )
                        );
 
-/*                     $data['datatable']['actions'][] = array
-                               (
-                               'my_name' => 'view',
-                               'text' => lang('show'),
-                               'action' => self::link( array
-                                       (
-                                       'menuaction' => 
"{$this->currentapp}.uiapplication.view"
-                               )),
-                               'parameters' => json_encode($parameters)
-                       );
-*/
                        $data['datatable']['actions'][] = array
                                (
                                'my_name' => 'edit',
@@ -211,10 +215,19 @@
                        self::render_template_xsl('datatable_jquery', $data);
                }
 
-               /*
-                * Edit the price item with the id given in the http variable 
'id'
-                */
+               public function add()
+               {
+                       if (empty($this->permissions[PHPGW_ACL_ADD]))
+                       {
+                               if($this->currentapp == 'eventplannerfrontend')
+                               {
+                                       
$GLOBALS['phpgw']->redirect_link('login.php', array('after' => 
'eventplannerfrontend.uiapplication.add'));
+                               }
+                       }
 
+                       $this->edit();
+               }
+
                public function edit( $values = array(), $mode = 'edit' )
                {
                        $active_tab = !empty($values['active_tab']) ? 
$values['active_tab'] : phpgw::get_var('active_tab', 'string', 'REQUEST', 
'first_tab');
@@ -250,6 +263,8 @@
                        $config = CreateObject('phpgwapi.config', 
'eventplanner')->read();
                        $default_category = 
!empty($config['default_application_category']) ? 
$config['default_application_category'] : null;
 
+                       $application_files_text = 
!empty($config['application_files_text']) ? $config['application_files_text'] : 
null;
+
                        $tabs = array();
                        $tabs['first_tab'] = array(
                                'label' => lang('application'),
@@ -432,14 +447,68 @@
                                $wardrobe['selected'] = $wardrobe['id'] == 
$application->wardrobe ? 1: 0;
                        }
 
-//                     _debug_array($application_type_list);
-//                     _debug_array($application->types);
-//                     die();
+                       $file_def = array
+                       (
+                               array('key' => 'file_name', 'label' => 
lang('Filename'), 'sortable' => false,'resizeable' => true),
+                       );
+
+                       $datatable_def[] = array
+                               (
+                               'container' => 'datatable-container_2',
+                               'requestUrl' => 
json_encode(self::link(array('menuaction' => 
"{$this->currentapp}.uiapplication.get_files",
+                                       'id' => $id,
+                                       'section' => 'cv',
+                                       'phpgw_return_as' => 'json'))),
+                               'ColumnDefs' => $file_def,
+                               'data' => json_encode(array()),
+                               'config' => array(
+                                       array('disableFilter' => true),
+                                       array('disablePagination' => true)
+                               )
+                       );
+
+                       $file_def[] = array('key' => 'picture', 'label' => '', 
'sortable' => false,
+                                       'resizeable' => true, 'formatter' => 
'JqueryPortico.showPicture');
+
+                       $datatable_def[] = array
+                               (
+                               'container' => 'datatable-container_3',
+                               'requestUrl' => 
json_encode(self::link(array('menuaction' => 
"{$this->currentapp}.uiapplication.get_files",
+                                       'id' => $id,
+                                       'section' => 'documents',
+                                       'phpgw_return_as' => 'json'))),
+                               'ColumnDefs' => $file_def,
+                               'data' => json_encode(array()),
+                               'config' => array(
+                                       array('disableFilter' => true),
+                                       array('disablePagination' => true)
+                               )
+                       );
+
+
+                       $vendor_list = array();
+
+                       if($this->currentapp == 'eventplannerfrontend')
+                       {
+                               $vendors = 
createObject('eventplanner.bovendor')->read(array());
+                               foreach($vendors['results'] as $vendor)
+                               {
+                                       $vendor_list[] = array(
+                                               'id' => $vendor['id'],
+                                               'name' => $vendor['name'],
+                                               'selected' => $vendor['id'] ==  
$application->vendor_id ? 1 : 0,
+                                       );
+                               }
+
+                               array_unshift($vendor_list, array('id' => '', 
'name' => lang('select')));
+                       }
+
                        $data = array(
                                'datatable_def' => $datatable_def,
                                'form_action' => self::link(array('menuaction' 
=> "{$this->currentapp}.uiapplication.save")),
                                'cancel_url' => self::link(array('menuaction' 
=> "{$this->currentapp}.uiapplication.index",)),
                                'application' => $application,
+                               'vendor_list'   => array('options' => 
$vendor_list),
                                'new_vendor_url' => 
self::link(array('menuaction' => "{$this->currentapp}.uivendor.add")),
                                'list_case_officer' => array('options' => 
$case_officer_options),
                                'list_public_types'     => array('options' => 
$list_public_types),
@@ -455,9 +524,9 @@
                                'mode' => $mode,
                                'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
                                'value_active_tab' => $active_tab,
-                               'multi_upload_parans' => 
"{menuaction:'property.uitts.build_multi_upload_file', id:'{$id}'}",
+                               'multi_upload_parans' => 
"{menuaction:'{$this->currentapp}.uiapplication.build_multi_upload_file', 
id:'{$id}'}",
                                'multiple_uploader' => true,
-
+                               'application_files_text' => 
$application_files_text
                        );
                        phpgwapi_jquery::formvalidator_generate(array('date', 
'security', 'file'));
                        phpgwapi_jquery::load_widget('autocomplete');
@@ -466,15 +535,95 @@
                        self::render_template_xsl(array('application', 
'datatable_inline', 'files'), array($mode => $data));
                }
 
+               function get_files()
+               {
+                       $id = phpgw::get_var('id', 'int');
+                       $section = phpgw::get_var('section', 'string', 
'REQUEST', 'documents');
+
+                       if (empty($this->permissions[PHPGW_ACL_READ]))
+                       {
+                               return array();
+                       }
+
+                       $link_file_data = array
+                               (
+                               'menuaction' => 
"{$this->currentapp}.uiapplication.view_file",
+                       );
+
+
+                       $link_view_file = $GLOBALS['phpgw']->link('/index.php', 
$link_file_data);
+
+                       $vfs = CreateObject('phpgwapi.vfs');
+                       $vfs->override_acl = 1;
+
+                       $files = $vfs->ls(array(
+                               'string' => 
"/eventplanner/application/{$id}/$section",
+                               'relatives' => array(RELATIVE_NONE)));
+
+                       $vfs->override_acl = 0;
+
+                       $img_types = array(
+                               'image/jpeg',
+                               'image/png',
+                               'image/gif'
+                       );
+
+                       $content_files = array();
+
+                       $z = 0;
+                       foreach ($files as $_entry)
+                       {
+
+                               $content_files[] = array(
+                                       'file_name' => '<a href="' . 
$link_view_file . '&amp;file_id=' . $_entry['file_id'] . '" target="_blank" 
title="' . lang('click to view file') . '">' . $_entry['name'] . '</a>',
+                                       'delete_file' => '<input 
type="checkbox" name="values[file_action][]" value="' . $_entry['file_id'] . '" 
title="' . lang('Check to delete file') . '">',
+                               );
+                               if ( in_array($_entry['mime_type'], $img_types))
+                               {
+                                       $content_files[$z]['file_name'] = 
$_entry['name'];
+                                       $content_files[$z]['img_id'] = 
$_entry['file_id'];
+                                       $content_files[$z]['img_url'] = 
self::link(array(
+                                                       'menuaction' => 
"{$this->currentapp}.uiapplication.view_file",
+                                                       'file_id'       =>  
$_entry['file_id'],
+                                                       'file' => 
$_entry['directory'] . '/' . urlencode($_entry['name'])
+                                       ));
+                                       $content_files[$z]['thumbnail_flag'] = 
'thumb=1';
+                               }
+                               $z ++;
+                       }
+
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+
+                               $total_records = count($content_files);
+
+                               return array
+                                       (
+                                       'data' => $content_files,
+                                       'draw' => phpgw::get_var('draw', 'int'),
+                                       'recordsTotal' => $total_records,
+                                       'recordsFiltered' => $total_records
+                               );
+                       }
+                       return $content_files;
+               }
+
                public function handle_multi_upload_file()
                {
-                       $id = phpgw::get_var('id');
+                       if (empty($this->permissions[PHPGW_ACL_ADD]))
+                       {
+                               phpgw::no_access();
+                       }
 
+                       $section = phpgw::get_var('section', 'string', 
'REQUEST', 'documents');
+                       $id = phpgw::get_var('id', 'int');
+
                        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)));
+                       $options['fakebase'] = "/eventplanner";
+                       $options['base_dir'] = "application/{$id}/{$section}";
+                       $options['upload_dir'] = 
$GLOBALS['phpgw_info']['server']['files_dir'].'/eventplanner/'.$options['base_dir'].'/';
+                       $options['script_url'] = 
html_entity_decode(self::link(array('menuaction' => 
"{$this->currentapp}.uiapplication.handle_multi_upload_file", 'id' => $id, 
'section' => $section)));
                        $upload_handler = new property_multiuploader($options, 
false);
 
                        switch ($_SERVER['REQUEST_METHOD']) {
@@ -504,11 +653,13 @@
                {
                        phpgwapi_jquery::init_multi_upload_file();
                        $id = phpgw::get_var('id', 'int');
+                       $section = phpgw::get_var('section', 'string', 
'REQUEST', 'documents');
 
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $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));
+                       $multi_upload_action = self::link(array('menuaction' => 
"{$this->currentapp}.uiapplication.handle_multi_upload_file", 'id' => $id, 
'section' => $section));
 
                        $data = array
                                (
@@ -518,7 +669,7 @@
                        $GLOBALS['phpgw']->xslttpl->add_file(array('files', 
'multi_upload_file'));
                        $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('multi_upload' => $data));
                }
-               
+
                public function save()
                {
                        parent::save();

Modified: trunk/eventplanner/js/portico/application.edit.js
===================================================================
--- trunk/eventplanner/js/portico/application.edit.js   2017-09-09 07:52:48 UTC 
(rev 17043)
+++ trunk/eventplanner/js/portico/application.edit.js   2017-09-09 15:42:34 UTC 
(rev 17044)
@@ -470,22 +470,25 @@
        errorMessageKey: 'application_types'
 });
 
-this.fileuploader = function ()
+this.fileuploader = function (section)
 {
+       multi_upload_parans.section = section;
        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()
+                       refresh_files(section)
                }
        });
 };
 
-this.refresh_files = function ()
+this.refresh_files = function (section)
 {
-       base_java_url['action'] = 'get_files';
-       var oArgs = base_java_url;
-       var strURL = phpGWLink('index.php', oArgs, true);
-       JqueryPortico.updateinlineTableHelper(oTable2, strURL);
+       var container = 'datatable-container_3';;
+       if(section === 'cv')
+       {
+               container = 'datatable-container_2';
+       }
+       JqueryPortico.updateinlineTableHelper(container);
 };

Modified: trunk/eventplanner/setup/phpgw_no.lang
===================================================================
--- trunk/eventplanner/setup/phpgw_no.lang      2017-09-09 07:52:48 UTC (rev 
17043)
+++ trunk/eventplanner/setup/phpgw_no.lang      2017-09-09 15:42:34 UTC (rev 
17044)
@@ -159,4 +159,5 @@
 application public type        eventplanner    no       Nær/Bredde-tilbud
 application public type non public     eventplanner    no      Nærtilbud (et 
arrangement der kun noen få brukere/beboere på en institusjon kan delta, f.eks. 
et skrivekurs, malekurs)
 application public type public eventplanner    no       Breddetilbud (et 
arrangement der alle brukere/beboere på en institusjon kan delta)
-
+my applications        eventplanner    no      Mine søknader
+new application        eventplanner    no      Ny søknad
\ No newline at end of file

Modified: trunk/eventplanner/templates/base/application.xsl
===================================================================
--- trunk/eventplanner/templates/base/application.xsl   2017-09-09 07:52:48 UTC 
(rev 17043)
+++ trunk/eventplanner/templates/base/application.xsl   2017-09-09 15:42:34 UTC 
(rev 17044)
@@ -724,15 +724,39 @@
                                        </div>
 
                                        <div id='files'>
-                                                                               
                <script type="text/javascript">
-                                                                               
                        var multi_upload_parans = <xsl:value-of 
select="multi_upload_parans"/>;
-                                                                               
                </script>
-
+                                               <script type="text/javascript">
+                                                       var multi_upload_parans 
= <xsl:value-of select="multi_upload_parans"/>;
+                                               </script>
+                                               <xsl:value-of 
disable-output-escaping="yes" select="application_files_text"/>
                                                <fieldset>
                                                        <legend>
-                                                               <xsl:value-of 
select="php:function('lang', 'CV')"/>
+                                                               
<xsl:text>Curriculum vitae</xsl:text>
                                                        </legend>
-                                                                               
                <xsl:call-template name="file_upload"/>
+                                                       <xsl:call-template 
name="file_upload">
+                                                               <xsl:with-param 
name="section">cv</xsl:with-param>
+                                                       </xsl:call-template>
+
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'files')"/>
+                                                               </label>
+                                                               <div 
class="pure-custom">
+                                                                       
<xsl:for-each select="datatable_def">
+                                                                               
<xsl:if test="container = 'datatable-container_2'">
+                                                                               
        <xsl:call-template name="table_setup">
+                                                                               
                <xsl:with-param name="container" select ='container'/>
+                                                                               
                <xsl:with-param name="requestUrl" select ='requestUrl'/>
+                                                                               
                <xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+                                                                               
                <xsl:with-param name="data" select ='data'/>
+                                                                               
                <xsl:with-param name="config" select ='config'/>
+                                                                               
        </xsl:call-template>
+                                                                               
</xsl:if>
+                                                                       
</xsl:for-each>
+                                                               </div>
+                                                       </div>
+
+
+
                                                </fieldset>
 
                                                <fieldset>
@@ -739,7 +763,27 @@
                                                        <legend>
                                                                <xsl:value-of 
select="php:function('lang', 'documents')"/>
                                                        </legend>
-                                                                               
                <xsl:call-template name="file_upload"/>
+                                                       <xsl:call-template 
name="file_upload">
+                                                               <xsl:with-param 
name="section">documents</xsl:with-param>
+                                                       </xsl:call-template>
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'files')"/>
+                                                               </label>
+                                                               <div 
class="pure-custom">
+                                                                       
<xsl:for-each select="datatable_def">
+                                                                               
<xsl:if test="container = 'datatable-container_3'">
+                                                                               
        <xsl:call-template name="table_setup">
+                                                                               
                <xsl:with-param name="container" select ='container'/>
+                                                                               
                <xsl:with-param name="requestUrl" select ='requestUrl'/>
+                                                                               
                <xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+                                                                               
                <xsl:with-param name="data" select ='data'/>
+                                                                               
                <xsl:with-param name="config" select ='config'/>
+                                                                               
        </xsl:call-template>
+                                                                               
</xsl:if>
+                                                                       
</xsl:for-each>
+                                                               </div>
+                                                       </div>
 
                                                </fieldset>
                                                

Modified: trunk/eventplanner/templates/base/config.tpl
===================================================================
--- trunk/eventplanner/templates/base/config.tpl        2017-09-09 07:52:48 UTC 
(rev 17043)
+++ trunk/eventplanner/templates/base/config.tpl        2017-09-09 15:42:34 UTC 
(rev 17044)
@@ -62,7 +62,18 @@
                                <textarea  
name="newsettings[customer_canceled_text]">{value_customer_canceled_text}</textarea>
                        </td>
                </tr>
+               <tr>
+                       <td>{lang_application_files_text}:</td>
+                       <td>
+                               <textarea  
name="newsettings[application_files_text]">{value_application_files_text}</textarea>
+                       </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 -->
 

Modified: trunk/eventplannerfrontend/inc/class.menu.inc.php
===================================================================
--- trunk/eventplannerfrontend/inc/class.menu.inc.php   2017-09-09 07:52:48 UTC 
(rev 17043)
+++ trunk/eventplannerfrontend/inc/class.menu.inc.php   2017-09-09 15:42:34 UTC 
(rev 17044)
@@ -99,26 +99,37 @@
                        }
 
                        $menus['navigation'] = array(
-                               'application' => array(
-                                       'text' => lang('application'),
-                                       'url' => 
phpgwapi_uicommon_jquery::link( array('menuaction' => 
'eventplannerfrontend.uiapplication.index'))
-                               ),
                                'events' => array(
                                        'text' => lang('events'),
                                        'url' => 
phpgwapi_uicommon_jquery::link( array('menuaction' => 
"eventplannerfrontend.uievents.index")),
                                        'image' => array('events', 'navbar'),
                                ),
+                               'vendor' => array(
+                                       'text' => lang('vendor'),
+                                       'url' =>  
phpgwapi_uicommon_jquery::link(  array('menuaction' => 
"eventplannerfrontend.uivendor.index")),
+                                       'image' => array('vendor', 'navbar'),
+                               ),
+                               'application' => array(
+                                       'text' => lang('my applications'),
+                                       'url' => 
phpgwapi_uicommon_jquery::link( array('menuaction' => 
'eventplannerfrontend.uiapplication.index')),
+                                       'children'      => array(
+                                               'new_application' => array(
+                                               'text' => lang('new 
application'),
+                                               'url' => 
phpgwapi_uicommon_jquery::link( array('menuaction' => 
'eventplannerfrontend.uiapplication.add'))
+                                               )
+                                       )
+                               ),
                                'customer' => array(
                                        'text' => lang('customer'),
                                        'url' =>  
phpgwapi_uicommon_jquery::link(  array('menuaction' => 
"eventplannerfrontend.uicustomer.index")),
                                        'image' => array('customer', 'navbar'),
                                ),
-                               'vendor' => array(
-                                       'text' => lang('vendor'),
-                                       'url' =>  
phpgwapi_uicommon_jquery::link(  array('menuaction' => 
"eventplannerfrontend.uivendor.index")),
-                                       'image' => array('vendor', 'navbar'),
-                               ),
-/*                             'booking' => array(
+                               'new_user' => array(
+                                       'text' => lang('new user'),
+                                       'url' => 
$GLOBALS['phpgw']->link('/registration/main.php', array()),
+                                       'image' => array('user', 'navbar'),
+                               )
+                               /*                              'booking' => 
array(
                                        'text' => lang('booking'),
                                        'url' =>  
phpgwapi_uicommon_jquery::link(  array('menuaction' => 
"eventplannerfrontend.uibooking.index")),
                                        'image' => array('customer', 'navbar'),

Modified: trunk/eventplannerfrontend/js/portico/application.edit.js
===================================================================
--- trunk/eventplannerfrontend/js/portico/application.edit.js   2017-09-09 
07:52:48 UTC (rev 17043)
+++ trunk/eventplannerfrontend/js/portico/application.edit.js   2017-09-09 
15:42:34 UTC (rev 17044)
@@ -7,24 +7,16 @@
 
 $(window).on('load', function ()
 {
-       vendor_id = $('#vendor_id').val();
-       if (vendor_id)
+       $("#vendor_id").change(function ()
        {
-               vendor_id_selection = vendor_id;
-       }
-       $("#vendor_name").on("autocompleteselect", function (event, ui)
-       {
-               var vendor_id = ui.item.value;
-               if (vendor_id != vendor_id_selection)
-               {
-                       populateVendorContact(vendor_id);
-               }
+               populateVendorContact();
        });
+
 });
 
-function populateVendorContact(vendor_id)
+function populateVendorContact()
 {
-       vendor_id = vendor_id || $('#vendor_id').val();
+       var vendor_id = $('#vendor_id').val();
 
        if (!vendor_id)
        {
@@ -429,3 +421,58 @@
                        );
        }
 };
+
+
+$.formUtils.addValidator({
+       name: 'application_types',
+       validatorFunction: function (value, $el, config, language, $form)
+       {
+               var n = 0;
+               $('#application_tbody_types input').each(function ()
+               {
+                       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");
+               }
+               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 (section)
+{
+       multi_upload_parans.section = section;
+       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(section)
+               }
+       });
+};
+
+this.refresh_files = function (section)
+{
+       var container = 'datatable-container_3';;
+       if(section === 'cv')
+       {
+               container = 'datatable-container_2';
+       }
+       JqueryPortico.updateinlineTableHelper(container);
+};

Modified: trunk/eventplannerfrontend/session.php
===================================================================
--- trunk/eventplannerfrontend/session.php      2017-09-09 07:52:48 UTC (rev 
17043)
+++ trunk/eventplannerfrontend/session.php      2017-09-09 15:42:34 UTC (rev 
17044)
@@ -66,6 +66,7 @@
 HTML;
                        $GLOBALS['phpgw']->common->phpgw_exit(True);
                }
+               ExecMethod('phpgwapi.menu.clear');
        }
 
        $GLOBALS['phpgw_info']['flags']['currentapp'] = 'eventplannerfrontend';

Modified: trunk/eventplannerfrontend/setup/phpgw_no.lang
===================================================================
--- trunk/eventplannerfrontend/setup/phpgw_no.lang      2017-09-09 07:52:48 UTC 
(rev 17043)
+++ trunk/eventplannerfrontend/setup/phpgw_no.lang      2017-09-09 15:42:34 UTC 
(rev 17044)
@@ -1 +1,3 @@
-eventplannerfrontend   common  no      TurneplanleggerFrontend
\ No newline at end of file
+eventplannerfrontend   common  no      TurneplanleggerFrontend
+new user       eventplannerfrontend    no      Ny bruker
+my applications        eventplannerfrontend    no      Mine søknader
\ No newline at end of file

Modified: trunk/eventplannerfrontend/templates/base/application.xsl
===================================================================
--- trunk/eventplannerfrontend/templates/base/application.xsl   2017-09-09 
07:52:48 UTC (rev 17043)
+++ trunk/eventplannerfrontend/templates/base/application.xsl   2017-09-09 
15:42:34 UTC (rev 17044)
@@ -52,19 +52,6 @@
                                                        <xsl:variable 
name="lang_save">
                                                                <xsl:value-of 
select="php:function('lang', 'next')"/>
                                                        </xsl:variable>
-                                                       <!--xsl:choose>
-                                                               <xsl:when 
test="application/id > 0">
-                                                                       
<xsl:variable name="lang_save">
-                                                                               
<xsl:value-of select="php:function('lang', 'save')"/>
-                                                                       
</xsl:variable>
-                                                               </xsl:when>
-                                                               <xsl:otherwise>
-                                                                       
<xsl:variable name="lang_save">
-                                                                               
<xsl:value-of select="php:function('lang', 'next')"/>
-                                                                       
</xsl:variable>
-                                                               </xsl:otherwise>
-                                                       </xsl:choose-->
-
                                                        <table width="200px">
                                                                <tbody>
                                                                        <tr>
@@ -111,6 +98,8 @@
                                                                </label>
                                                                
<xsl:call-template name="categories"/>
                                                        </div>
+
+
                                                        <div 
class="pure-control-group">
                                                                <xsl:variable 
name="lang_vendor">
                                                                        
<xsl:value-of select="php:function('lang', 'vendor name')"/>
@@ -118,6 +107,33 @@
                                                                <label>
                                                                        
<xsl:value-of select="$lang_vendor"/>
                                                                </label>
+
+
+                                                               <select 
id="vendor_id" name="vendor_id" class="pure-input-1-2" >
+                                                                       
<xsl:attribute name="data-validation">
+                                                                               
<xsl:text>required</xsl:text>
+                                                                       
</xsl:attribute>
+                                                                       
<xsl:attribute name="data-validation-error-msg">
+                                                                               
<xsl:value-of select="$lang_vendor"/>
+                                                                       
</xsl:attribute>
+                                                                       
<xsl:apply-templates select="vendor_list/options"/>
+                                                               </select>
+
+                                                               <xsl:text> 
</xsl:text>
+                                                               <a 
href="{new_vendor_url}" target="_blank">
+                                                                       
<xsl:value-of select="php:function('lang', 'new')"/>
+                                                                       
<xsl:text> </xsl:text>
+                                                                       
<xsl:value-of select="php:function('lang', 'vendor')"/>
+                                                               </a>
+                                                       </div>
+<!--
+                                                       <div 
class="pure-control-group">
+                                                               <xsl:variable 
name="lang_vendor">
+                                                                       
<xsl:value-of select="php:function('lang', 'vendor name')"/>
+                                                               </xsl:variable>
+                                                               <label>
+                                                                       
<xsl:value-of select="$lang_vendor"/>
+                                                               </label>
                                                                <input 
type="hidden" id="vendor_id" name="vendor_id"  value="{application/vendor_id}">
                                                                        
<xsl:attribute name="data-validation">
                                                                                
<xsl:text>required</xsl:text>
@@ -137,15 +153,16 @@
                                                                                
<xsl:text>required</xsl:text>
                                                                        
</xsl:attribute>
                                                                </input>
-                                                               <!--
+                                                       
+                                                               
                                                                <xsl:text> 
</xsl:text>
                                                                <a 
href="{new_vendor_url}" target="_blank">
                                                                        
<xsl:value-of select="php:function('lang', 'new')"/>
                                                                        
<xsl:text> </xsl:text>
                                                                        
<xsl:value-of select="php:function('lang', 'vendor')"/>
-                                                               </a>-->
+                                                               </a>
                                                                <div 
id="vendor_container"/>
-                                                       </div>
+                                                       </div>  -->
                                                        <div 
class="pure-control-group">
                                                                <label>
                                                                        
<xsl:value-of select="php:function('lang', 'contact name')"/>
@@ -251,7 +268,7 @@
                                                                                
                </th>
                                                                                
        </tr>
                                                                                
</thead>
-                                                                               
<tbody>
+                                                                               
<tbody id="application_tbody_types">
                                                                                
        <xsl:for-each select="application_type_list">
                                                                                
                <tr>
                                                                                
                        <td>
@@ -269,7 +286,11 @@
                                                                                
</tbody>
                                                                        </table>
                                                                </div>
-
+                                                               <input 
type="text" data-validation="application_types" size="1" style="visibility: 
hidden;">
+                                                                       
<xsl:attribute name="data-validation-error-msg">
+                                                                               
<xsl:value-of select="php:function('lang', 'program type')"/>
+                                                                       
</xsl:attribute>
+                                                               </input>
                                                        </div>
 
                                                        <div 
class="pure-control-group">
@@ -619,6 +640,66 @@
                                                        </div>
                                                </fieldset>
                                        </div>
+                                       <div id='files'>
+                                               <script type="text/javascript">
+                                                       var multi_upload_parans 
= <xsl:value-of select="multi_upload_parans"/>;
+                                               </script>
+                                               <xsl:value-of 
disable-output-escaping="yes" select="application_files_text"/>
+                                               <fieldset>
+                                                       <legend>
+                                                               
<xsl:text>Curriculum vitae</xsl:text>
+                                                       </legend>
+                                                       <xsl:call-template 
name="file_upload">
+                                                               <xsl:with-param 
name="section">cv</xsl:with-param>
+                                                       </xsl:call-template>
+
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'files')"/>
+                                                               </label>
+                                                               <div 
class="pure-custom">
+                                                                       
<xsl:for-each select="datatable_def">
+                                                                               
<xsl:if test="container = 'datatable-container_2'">
+                                                                               
        <xsl:call-template name="table_setup">
+                                                                               
                <xsl:with-param name="container" select ='container'/>
+                                                                               
                <xsl:with-param name="requestUrl" select ='requestUrl'/>
+                                                                               
                <xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+                                                                               
                <xsl:with-param name="data" select ='data'/>
+                                                                               
                <xsl:with-param name="config" select ='config'/>
+                                                                               
        </xsl:call-template>
+                                                                               
</xsl:if>
+                                                                       
</xsl:for-each>
+                                                               </div>
+                                                       </div>
+                                               </fieldset>
+                                               <fieldset>
+                                                       <legend>
+                                                               <xsl:value-of 
select="php:function('lang', 'documents')"/>
+                                                       </legend>
+                                                       <xsl:call-template 
name="file_upload">
+                                                               <xsl:with-param 
name="section">documents</xsl:with-param>
+                                                       </xsl:call-template>
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'files')"/>
+                                                               </label>
+                                                               <div 
class="pure-custom">
+                                                                       
<xsl:for-each select="datatable_def">
+                                                                               
<xsl:if test="container = 'datatable-container_3'">
+                                                                               
        <xsl:call-template name="table_setup">
+                                                                               
                <xsl:with-param name="container" select ='container'/>
+                                                                               
                <xsl:with-param name="requestUrl" select ='requestUrl'/>
+                                                                               
                <xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+                                                                               
                <xsl:with-param name="data" select ='data'/>
+                                                                               
                <xsl:with-param name="config" select ='config'/>
+                                                                               
        </xsl:call-template>
+                                                                               
</xsl:if>
+                                                                       
</xsl:for-each>
+                                                               </div>
+                                                       </div>
+                                               </fieldset>
+                                       </div>
+
                                        <div id='calendar'>
                                                <fieldset>
 

Modified: trunk/eventplannerfrontend/templates/base/config.tpl
===================================================================
--- trunk/eventplannerfrontend/templates/base/config.tpl        2017-09-09 
07:52:48 UTC (rev 17043)
+++ trunk/eventplannerfrontend/templates/base/config.tpl        2017-09-09 
15:42:34 UTC (rev 17044)
@@ -123,6 +123,10 @@
                        </td>
                        <td><input name="newsettings[bookingfrontend_host]" 
value="{value_bookingfrontend_host}"></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 -->

Modified: trunk/phpgwapi/inc/class.jquery.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.jquery.inc.php     2017-09-09 07:52:48 UTC (rev 
17043)
+++ trunk/phpgwapi/inc/class.jquery.inc.php     2017-09-09 15:42:34 UTC (rev 
17044)
@@ -104,7 +104,7 @@
                                                "js/{$_jquery_core}{$_type}",
                                                'datetimepicker' => array(
                                                        
"js/jquery.datetimepicker.full{$_type}",
-                                                       
"i18n/DateTimePicker-i18n"
+               //                                      
"i18n/DateTimePicker-i18n"
                                                )
                                        );
                                        
$GLOBALS['phpgw']->css->add_external_file("phpgwapi/js/datetimepicker/css/jquery.datetimepicker.min.css");

Modified: trunk/phpgwapi/inc/class.login.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.login.inc.php      2017-09-09 07:52:48 UTC (rev 
17043)
+++ trunk/phpgwapi/inc/class.login.inc.php      2017-09-09 15:42:34 UTC (rev 
17044)
@@ -71,10 +71,10 @@
                                $GLOBALS['phpgw_info']['login_right_message'] = 
'';
                        }
 
-                       if(!phpgw::get_var('after','raw', 'COOKIE'))
+                       if(!phpgw::get_var('after','string', 'COOKIE'))
                        {
-                               $after = phpgw::get_var('after', 'string');
-                               
$GLOBALS['phpgw']->session->phpgw_setcookie('after',phpgw::get_var('after', 
'raw'),$cookietime=0);
+                               $after = phpgw::get_var('after', 'bool');
+                               
$GLOBALS['phpgw']->session->phpgw_setcookie('after',phpgw::get_var('after', 
'string'),$cookietime=0);
                        }
                        else
                        {
@@ -81,7 +81,6 @@
                                $after = true;
                        }
 
-
                        if (isset($_REQUEST['skip_remote']) && 
$_REQUEST['skip_remote']) // In case a user failed logged in via SSO - get 
another try
                        {
                                $GLOBALS['phpgw_info']['server']['auth_type'] = 
$GLOBALS['phpgw_remote_user_fallback'];
@@ -413,7 +412,7 @@
 
                function redirect_after($frontend = '')
                {
-                       $redirect = json_decode(phpgw::get_var('after','raw', 
'COOKIE'),true);
+                       $redirect = phpgw::get_var('after','string', 'COOKIE');
                //      _debug_array($_COOKIE);
                //      _debug_array($after);
                //      die();
@@ -434,6 +433,10 @@
                                
$GLOBALS['phpgw']->session->phpgw_setcookie('after', false, 0);
                                
$GLOBALS['phpgw']->redirect_link("{$frontend}/index.php", $redirect_data);
                        }
+                       else if ($redirect)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link("{$frontend}/index.php", array('menuaction' => 
$redirect));
+                       }
                        else
                        {
                                //failsafe

Modified: trunk/phpgwapi/setup/phpgw_no.lang
===================================================================
--- trunk/phpgwapi/setup/phpgw_no.lang  2017-09-09 07:52:48 UTC (rev 17043)
+++ trunk/phpgwapi/setup/phpgw_no.lang  2017-09-09 15:42:34 UTC (rev 17044)
@@ -183,8 +183,14 @@
 week   common  no      Uke
 week day       common  no      Ukedag
 upload file    common  no      Last opp fil
-upload multiple files  common  no      Last opp flere filer
+upload multiple files  common  no      Last opp filer
 upload files   common  no      Last opp filer
+delete file    common  no      Slett fil
+add files      common  no      Legg til filer
+start upload   common  no      Start opplasting
+cancel upload  common  no      Stopp opplasting
+invalid file extension common  no      Ugyldig filtype
+number files   common  no      Antall filer
 (filtered from _max_ total entries)    common  no      (filtrert fra _max_ 
poster)
 bim    common  no      Bim
 categories     common  no      Kategorier

Modified: trunk/phpgwapi/setup/setup.inc.php
===================================================================
--- trunk/phpgwapi/setup/setup.inc.php  2017-09-09 07:52:48 UTC (rev 17043)
+++ trunk/phpgwapi/setup/setup.inc.php  2017-09-09 15:42:34 UTC (rev 17044)
@@ -12,7 +12,7 @@
        // Basic information about this app
        $setup_info['phpgwapi']['name']      = 'phpgwapi';
        $setup_info['phpgwapi']['title']     = 'phpgwapi';
-       $setup_info['phpgwapi']['version']   = '0.9.17.556';
+       $setup_info['phpgwapi']['version']   = '0.9.17.557';
        $setup_info['phpgwapi']['versions']['current_header'] = '1.31';
        $setup_info['phpgwapi']['versions']['system'] = '2.0';
        $setup_info['phpgwapi']['enable']    = 3;

Modified: trunk/phpgwapi/setup/tables_current.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_current.inc.php 2017-09-09 07:52:48 UTC (rev 
17043)
+++ trunk/phpgwapi/setup/tables_current.inc.php 2017-09-09 15:42:34 UTC (rev 
17044)
@@ -139,8 +139,8 @@
                ),
                'phpgw_access_log' => array(
                        'fd' => array(
-                               'sessionid' => array('type' => 
'char','precision' => '32','nullable' => False),
-                               'loginid' => array('type' => 
'varchar','precision' => 30,'nullable' => False),
+                               'sessionid' => array('type' => 
'char','precision' => 64,'nullable' => False),
+                               'loginid' => array('type' => 
'varchar','precision' => 100,'nullable' => False),
                                'ip' => array('type' => 'varchar','precision' 
=> 100,'nullable' => False,'default' => '::1'),
                                'li' => array('type' => 'int','precision' => 
4,'nullable' => False),
                                'lo' => array('type' => 'int','precision' => 
4,'nullable' => True,'default' => '0'),

Modified: trunk/phpgwapi/setup/tables_update.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_update.inc.php  2017-09-09 07:52:48 UTC (rev 
17043)
+++ trunk/phpgwapi/setup/tables_update.inc.php  2017-09-09 15:42:34 UTC (rev 
17044)
@@ -3572,3 +3572,18 @@
                        return $GLOBALS['setup_info']['phpgwapi']['currentver'];
                }
        }
+
+       $test[] = '0.9.17.556';
+       function phpgwapi_upgrade0_9_17_556()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_access_log','sessionid',array('type'
 => 'char', 'precision' => 64, 'nullable' => False));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_access_log','loginid',array('type'
 => 'varchar', 'precision' => 100, 'nullable' => False));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['phpgwapi']['currentver'] = 
'0.9.17.557';
+                       return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+               }
+
+       }

Modified: trunk/phpgwapi/templates/base/files.xsl
===================================================================
--- trunk/phpgwapi/templates/base/files.xsl     2017-09-09 07:52:48 UTC (rev 
17043)
+++ trunk/phpgwapi/templates/base/files.xsl     2017-09-09 15:42:34 UTC (rev 
17044)
@@ -12,11 +12,13 @@
 
 <!-- New template-->
 <xsl:template xmlns:php="http://php.net/xsl"; name="file_upload">
+       <xsl:param name="section" />
+       
        <div class="pure-control-group">
                <xsl:choose>
                        <xsl:when test="multiple_uploader!=''">
                                <label>
-                                       <a href="javascript:fileuploader()">
+                                       <a 
href="javascript:fileuploader('{$section}')">
                                                <xsl:attribute name="title">
                                                        <xsl:value-of 
select="php:function('lang', 'upload multiple files')"/>
                                                </xsl:attribute>

Modified: trunk/property/inc/class.multiuploader.inc.php
===================================================================
--- trunk/property/inc/class.multiuploader.inc.php      2017-09-09 07:52:48 UTC 
(rev 17043)
+++ trunk/property/inc/class.multiuploader.inc.php      2017-09-09 15:42:34 UTC 
(rev 17044)
@@ -162,10 +162,16 @@
 
                        $max_file_size_in_bytes = 2147483647; // 2GB in bytes
 
-                       $config = CreateObject('phpgwapi.config', 'property');
-                       $config->read();
-                       $uploader_filetypes = 
isset($config->config_data['uploader_filetypes']) ? 
$config->config_data['uploader_filetypes'] : 'jpg,gif,png';
+                       $currentapp = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
 
+                       $config = CreateObject('phpgwapi.config', 
$currentapp)->read();
+                       if(empty($config['uploader_filetypes']))
+                       {
+                               $config = CreateObject('phpgwapi.config', 
'property')->read();
+                       }
+
+                       $uploader_filetypes = 
isset($config['uploader_filetypes']) ? $config['uploader_filetypes'] : 
'jpg,gif,png';
+
                        //$extension_whitelist = array("jpg", "gif", "png");    
// Allowed file extensions
                        $extension_whitelist = explode(',', 
$uploader_filetypes);
 
@@ -327,6 +333,12 @@
                                        }
                                        else
                                        {
+                                               $thumbfile = 
"{$this->bofiles->rootdir}/{$this->bofiles->fakebase}/{$this->options['base_dir']}/{$file_name}.thumb";
+
+                                               if(is_file($thumbfile))
+                                               {
+                                                       unlink($thumbfile);
+                                               }
                                                
//phpgwapi_cache::message_set(lang('file deleted') . ' :' . $file, 'message');
                                                $success = true;
                                        }




reply via email to

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