fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10540] property: More on condition survey


From: Sigurd Nes
Subject: [Fmsystem-commits] [10540] property: More on condition survey
Date: Mon, 26 Nov 2012 18:29:16 +0000

Revision: 10540
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10540
Author:   sigurdne
Date:     2012-11-26 18:29:14 +0000 (Mon, 26 Nov 2012)
Log Message:
-----------
property: More on condition survey

Modified Paths:
--------------
    trunk/property/inc/class.bocondition_survey.inc.php
    trunk/property/inc/class.uicondition_survey.inc.php
    trunk/property/js/portico/condition_survey_edit.js
    trunk/property/templates/base/condition_survey.xsl

Modified: trunk/property/inc/class.bocondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.bocondition_survey.inc.php 2012-11-26 17:48:52 UTC 
(rev 10539)
+++ trunk/property/inc/class.bocondition_survey.inc.php 2012-11-26 18:29:14 UTC 
(rev 10540)
@@ -45,6 +45,11 @@
                var $allrows;
                public $acl_location = '.project.condition_survey';
 
+               var $public_functions = array
+               (
+                       'addfiles'              => true
+               );
+
                function __construct($session=false)
                {
                        $this->so                       = 
CreateObject('property.socondition_survey');
@@ -126,6 +131,53 @@
                        return $column_list;
                }
 
+               public function addfiles()
+               {
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+
+                       $acl                    = & $GLOBALS['phpgw']->acl;
+                       $acl_add                = 
$acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
+                       $acl_edit               = 
$acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
+                       $id                             = phpgw::get_var('id', 
'int');
+                       $check                  = phpgw::get_var('check', 
'bool');
+                       $fileuploader   = CreateObject('property.fileuploader');
+
+                       if(!$acl_add && !$acl_edit)
+                       {
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+
+                       if(!$id)
+                       {
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+
+                       $test = true;
+                       if ($test)
+                       {
+                               if (!empty($_FILES))
+                               {
+                                       $tempFile = 
$_FILES['Filedata']['tmp_name'];
+                                       $targetPath = 
"{$GLOBALS['phpgw_info']['server']['temp_dir']}/";
+                                       $targetFile =  
str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
+                                       
move_uploaded_file($tempFile,$targetFile);
+                                       echo 
str_replace($GLOBALS['phpgw_info']['server']['temp_dir'],'',$targetFile);
+                               }
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+       
+                       if($check)
+                       {
+                               $fileuploader->check("condition_survey/{$id}");
+                       }
+                       else
+                       {
+                               $fileuploader->upload("condition_survey/{$id}");
+                       }
+               }
+
                public function read($data = array())
                {
                        $values = $this->so->read($data);

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2012-11-26 17:48:52 UTC 
(rev 10539)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2012-11-26 18:29:14 UTC 
(rev 10540)
@@ -322,6 +322,11 @@
                                'status_list'           => array('options' => 
execMethod('property.bogeneric.get_list',array('type' => 
'condition_survey_status', 'selected' => $values['status_id'], 'add_empty' => 
true))),
                                'editable'                      => $mode == 
'edit',
                                'tabs'                          => 
phpgwapi_yui::tabview_generate($tabs, $active_tab),
+                               'fileupload'                                    
=> true,
+                               'multiple_uploader'                             
=> true,
+                               'fileuploader_action'                   => 
"{menuaction:'property.fileuploader.add',"
+                                                                               
                                
."upload_target:'property.bocondition_survey.addfiles',"
+                                                                               
                                ."id:'{$id}'}",
                        );
 //_debug_array($data);die();
                        $GLOBALS['phpgw']->jqcal->add_listener('report_date');
@@ -332,7 +337,10 @@
                        self::add_javascript('phpgwapi', 'yui3', 
'yui/yui-min.js');
                        self::add_javascript('phpgwapi', 'yui3', 
'gallery-formvalidator/gallery-formvalidator-min.js');
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yui3/gallery-formvalidator/validatorCss.css');
-                       self::render_template_xsl(array('condition_survey'), 
$data);
+                       self::add_javascript('phpgwapi', 'tinybox2', 
'packed.js');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/tinybox2/style.css');
+
+                       
self::render_template_xsl(array('condition_survey','files'), $data);
                }
 
                public function save()

Modified: trunk/property/js/portico/condition_survey_edit.js
===================================================================
--- trunk/property/js/portico/condition_survey_edit.js  2012-11-26 17:48:52 UTC 
(rev 10539)
+++ trunk/property/js/portico/condition_survey_edit.js  2012-11-26 18:29:14 UTC 
(rev 10540)
@@ -52,3 +52,18 @@
                'coordinator_name', 'coordinator_id', 'coordinator_container');
        });
 
+       this.fileuploader = function()
+       {
+               var requestUrl = phpGWLink('index.php', fileuploader_action);
+               TINY.box.show({iframe:requestUrl, 
boxid:'frameless',width:750,height:450,fixed:false,maskid:'darkmask',maskopacity:40,
 mask:true, animate:true, close: true,closejs:function(){closeJS_local()}});
+       }
+
+
+       function closeJS_local()
+       {
+               var reqUrl = '<xsl:value-of select="//datatable/source"/>';
+               YAHOO.portico.inlineTableHelper('requirement-container', 
reqUrl, YAHOO.portico.columnDefs);
+       }
+
+
+

Modified: trunk/property/templates/base/condition_survey.xsl
===================================================================
--- trunk/property/templates/base/condition_survey.xsl  2012-11-26 17:48:52 UTC 
(rev 10539)
+++ trunk/property/templates/base/condition_survey.xsl  2012-11-26 18:29:14 UTC 
(rev 10540)
@@ -232,37 +232,28 @@
                                        </div>
 
                        <div id="documents">
+                               <script type="text/javascript">
+                                       var fileuploader_action = <xsl:value-of 
select="fileuploader_action"/>;
+                               </script>
+                               <table cellpadding="2" cellspacing="2" 
width="80%" align="center">
+                                       <!-- <xsl:call-template 
name="file_list"/> -->
+                                       <tr>
+                                               <td align="left" valign="top">
+                                                       <xsl:value-of 
select="php:function('lang', 'files')"/>
+                                               </td>
+                                               <td>
+                                                       <div 
id="datatable-container_0"/>
+                                               </td>
+                                       </tr>
+                                       <xsl:call-template name="file_upload"/>
+                               </table>
+
                        </div>
                        <div id="import">
                        </div>
 
 
                                        <xsl:choose>
-                                               <xsl:when test="files!='' or 
fileupload = 1">
-                                                       <div id="files">
-                                                               <script 
type="text/javascript">
-                                                                       var 
fileuploader_action = <xsl:value-of select="fileuploader_action"/>;
-                                                               </script>
-                                                               <table 
cellpadding="2" cellspacing="2" width="80%" align="center">
-                                                                       <!-- 
<xsl:call-template name="file_list"/> -->
-                                                                       <tr>
-                                                                               
<td align="left" valign="top">
-                                                                               
        <xsl:value-of select="//lang_files"/>
-                                                                               
</td>
-                                                                               
<td>
-                                                                               
        <div id="datatable-container_0"/>
-                                                                               
</td>
-                                                                       </tr>
-                                                                       
<xsl:choose>
-                                                                               
<xsl:when test="cat_list='' and fileupload = 1 and mode = 'edit'">
-                                                                               
        <xsl:call-template name="file_upload"/>
-                                                                               
</xsl:when>
-                                                                       
</xsl:choose>
-                                                               </table>
-                                                       </div>
-                                               </xsl:when>
-                                       </xsl:choose>
-                                       <xsl:choose>
                                                <xsl:when test="documents != 
''">
                                                        <div id="document">
                                                                <!-- Some style 
for the expand/contract section-->




reply via email to

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