fmsystem-commits
[Top][All Lists]
Advanced

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

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


From: Sigurd Nes
Subject: [Fmsystem-commits] [10577] property: More on condition survey
Date: Fri, 07 Dec 2012 14:29:40 +0000

Revision: 10577
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10577
Author:   sigurdne
Date:     2012-12-07 14:29:39 +0000 (Fri, 07 Dec 2012)
Log Message:
-----------
property: More on condition survey

Modified Paths:
--------------
    trunk/property/inc/class.borequest.inc.php
    trunk/property/inc/class.fileuploader.inc.php
    trunk/property/inc/class.socommon_core.inc.php
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/inc/class.uicondition_survey.inc.php
    trunk/property/inc/class.uientity.inc.php
    trunk/property/inc/class.uirequest.inc.php
    trunk/property/js/portico/condition_survey_edit.js
    trunk/property/js/yahoo/request.index.js
    trunk/property/templates/base/condition_survey.xsl

Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php  2012-12-06 18:25:36 UTC (rev 
10576)
+++ trunk/property/inc/class.borequest.inc.php  2012-12-07 14:29:39 UTC (rev 
10577)
@@ -87,6 +87,8 @@
                        $end_date               = phpgw::get_var('end_date');
                        $building_part  = phpgw::get_var('building_part');
 
+                       $this->condition_survey_id = 
phpgw::get_var('condition_survey_id', 'int', 'REQUEST', 0);
+
                        if(isset($_POST['start']) || isset($_GET['start']))
                        {
                                $this->start = $start;
@@ -443,7 +445,7 @@
                                'project_id' => 
$data['project_id'],'allrows'=>$data['allrows'],'list_descr' => 
$data['list_descr'],
                                'dry_run'=>$data['dry_run'], 'p_num' => 
$this->p_num,'start_date'=>$this->start_date,'end_date'=>$this->end_date,
                                'property_cat_id' => $this->property_cat_id, 
'building_part' => $this->building_part,
-                               'degree_id' => $this->degree_id, 
'attrib_filter' => $attrib_filter));
+                               'degree_id' => $this->degree_id, 
'attrib_filter' => $attrib_filter, 'condition_survey_id' => 
$this->condition_survey_id));
 
                        $this->total_records    = $this->so->total_records;
                        $this->sum_budget               = $this->so->sum_budget;
@@ -487,6 +489,7 @@
                                $this->uicols['formatter'][]    = '';
                                $this->uicols['classname'][]    = '';
                        }
+
                        return $request;
                }
 

Modified: trunk/property/inc/class.fileuploader.inc.php
===================================================================
--- trunk/property/inc/class.fileuploader.inc.php       2012-12-06 18:25:36 UTC 
(rev 10576)
+++ trunk/property/inc/class.fileuploader.inc.php       2012-12-07 14:29:39 UTC 
(rev 10577)
@@ -149,7 +149,17 @@
                                                                                
        {
                                                                                
                alert('Du må laste siden på nytt for å vise resultatet');
                                                                                
        }
-                                                                               
        parent.lightbox.hide();
+                                                                               
        try
+                                                                               
        {
+                                                                               
                if(!parent.lightbox_hide())
+                                                                               
                {
+                                                                               
                        parent.lightbox.hide();
+                                                                               
                }
+                                                                               
        }
+                                                                               
        catch (ex)
+                                                                               
        {
+                                                                               
        }
+
                                                                                
  }
                                                                        });
                                                                });

Modified: trunk/property/inc/class.socommon_core.inc.php
===================================================================
--- trunk/property/inc/class.socommon_core.inc.php      2012-12-06 18:25:36 UTC 
(rev 10576)
+++ trunk/property/inc/class.socommon_core.inc.php      2012-12-07 14:29:39 UTC 
(rev 10577)
@@ -76,7 +76,7 @@
                        $this->_db                      = & 
$GLOBALS['phpgw']->db;
                        $this->_join            = & $this->_db->join;
                        $this->_like            = & $this->_db->like;
-                       $this->_left_join       = & $this->db->_left_join;
+                       $this->_left_join       = & $this->_db->left_join;
                        $this->custom           = 
createObject('property.custom_fields');
                }
 

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2012-12-06 18:25:36 UTC (rev 
10576)
+++ trunk/property/inc/class.sorequest.inc.php  2012-12-07 14:29:39 UTC (rev 
10577)
@@ -39,11 +39,13 @@
        {
                public $sum_budget = 0;
                public $sum_consume = 0;
+               public $uicols = array();
+
                protected $global_lock = false;
                function __construct()
                {
                        parent::__construct();
-                       $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+
                        $this->soproject        = 
CreateObject('property.soproject');
                        $this->historylog       = 
CreateObject('property.historylog','request');
                        $this->bocommon         = 
CreateObject('property.bocommon');
@@ -212,6 +214,7 @@
                        $building_part  = isset($data['building_part']) && 
$data['building_part'] ? (int)$data['building_part'] : 0;
                        $degree_id              = $data['degree_id'];
                        $attrib_filter  = $data['attrib_filter'] ? 
$data['attrib_filter'] : array();
+                       $condition_survey_id = $data['condition_survey_id'] ? 
(int) $data['condition_survey_id'] : 0;
 
                        $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.project.request');
                        $attribute_table = 'phpgw_cust_attribute';
@@ -453,12 +456,19 @@
                                $where = 'AND';
                        }
 
+
                        if ($cat_id > 0)
                        {
                                $filtermethod .= " $where 
fm_request.category='{$cat_id}'";
                                $where = 'AND';
                        }
 
+                       if ($condition_survey_id > 0)
+                       {
+                               $filtermethod .= " $where 
fm_request.condition_survey_id = '{$condition_survey_id}'";
+                               $where = 'AND';
+                       }
+
                        if ($status_id && $status_id != 'all')
                        {
 
@@ -582,7 +592,7 @@
 
                        $this->_db->query($sql2,__LINE__,__FILE__);
                        $this->_db->next_record();
-                       $this->total_records = $this->_db->f('cnt');
+                       $this->_total_records = $this->_db->f('cnt');
                        $this->sum_budget       = $this->_db->f('sum_budget');
 
                        $sql3 = "SELECT sum(fm_request_consume.amount) as 
sum_consume  FROM {$sql_arr[1]}";

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2012-12-06 18:25:36 UTC 
(rev 10576)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2012-12-07 14:29:39 UTC 
(rev 10577)
@@ -239,7 +239,6 @@
                        $result_data['sort'] = $params['sort'];
                        $result_data['dir'] = $params['dir'];
 
-                       $editable = phpgw::get_var('editable') == 'true' ? true 
: false;
 
                        if (!$export)
                        {
@@ -306,8 +305,8 @@
                        $tabs['generic']        = array('label' => 
lang('generic'), 'link' => '#generic');
                        $active_tab = 'generic';
                        $tabs['documents']      = array('label' => 
lang('documents'), 'link' => null);
+                       $tabs['related']        = array('label' => 
lang('related'), 'link' => null);
                        $tabs['import']         = array('label' => 
lang('import'), 'link' => null);
-                       $tabs['related']        = array('label' => 
lang('related'), 'link' => null);
 
                        if ($id)
                        {
@@ -402,10 +401,11 @@
                                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::add_javascript('phpgwapi', 'tinybox2', 
'packed.js');
-                               
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/tinybox2/style.css');
                        }
 
+                       self::add_javascript('phpgwapi', 'tinybox2', 
'packed.js');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/tinybox2/style.css');
+
 //                     $GLOBALS['phpgw_info']['server']['no_jscombine'] = true;
 
                        self::render_template_xsl(array('condition_survey'), 
$data);
@@ -483,7 +483,7 @@
 
                public function get_files()
                {
-                       $id     = phpgw::get_var('id', 'REQUEST', 'int');
+                       $id     = phpgw::get_var('id', 'int', 'REQUEST');
 
                        if( !$this->acl_read)
                        {
@@ -509,11 +509,33 @@
                        $vfs->override_acl = 0;
 
 
+//------ Start pagination
+
+                       $start = phpgw::get_var('startIndex', 'int', 'REQUEST', 
0);
+                       $total_records = count($files);
+
+                       $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int) 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;      
                
+
+                       if($allrows)
+                       {
+                               $out = $files;
+                       }
+                       else
+                       {
+                       //      $page = ceil( ( $start / $total_records ) * 
($total_records/ $num_rows) );
+                               $page = ceil( ( $start / $num_rows) );
+                               $files_part = array_chunk($files, $num_rows);
+                               $out = $files_part[$page];
+                       }
+
+//------ End pagination
+
+
                        $lang_view = lang('click to view file');
                        $lang_delete = lang('click to delete file');
 
                        $values = array();
-                       foreach($files as $_entry )
+                       foreach($out as $_entry )
                        {
                                $values[] = array
                                (
@@ -522,12 +544,24 @@
                                );
                        }                                                       
 
-                       return array('ResultSet'=> array('Result'=>$values), 
'totalResultsAvailable' => count($values));
+                       $data = array(
+                                'ResultSet' => array(
+                                       'totalResultsAvailable' => 
$total_records,
+                                       'startIndex' => $start,
+                                       'sortKey' => 'type', 
+                                       'sortDir' => "ASC", 
+                                       'Result' => $values,
+                                       'pageSize' => $num_rows,
+                                       'activePage' => floor($start / 
$num_rows) + 1
+                               )
+                       );
+                       return $data;
+
                }
 
                function get_related()
                {
-                       $id     = phpgw::get_var('id', 'REQUEST', 'int');
+                       $id     = phpgw::get_var('id', 'int', 'REQUEST');
 
                        if( !$this->acl_read)
                        {
@@ -560,7 +594,7 @@
 
 //------ Start pagination
 
-                       $start = phpgw::get_var('startIndex', 'REQUEST', 'int', 
0);
+                       $start = phpgw::get_var('startIndex', 'int', 'REQUEST', 
0);
                        $total_records = count($values);
 
                        $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int) 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;      
                
@@ -667,7 +701,7 @@
 
                public function import()
                {
-                       $id = phpgw::get_var('id', 'REQUEST', 'int');
+                       $id = phpgw::get_var('id', 'int', 'REQUEST');
                        $this->_handle_import($id);
                }
 
@@ -686,12 +720,12 @@
                                throw new 
Exception('uicondition_survey::_handle_import() - missing id');
                        }
 
-                       $step                   = phpgw::get_var('step', 
'REQUEST', 'int');
-                       $sheet_id               = phpgw::get_var('sheet_id', 
'REQUEST', 'int');
+                       $step                   = phpgw::get_var('step', 'int', 
'REQUEST');
+                       $sheet_id               = phpgw::get_var('sheet_id', 
'int', 'REQUEST');
                        
-                       $sheet_id = $sheet_id ? $sheet_id : 
phpgw::get_var('selected_sheet_id', 'REQUEST', 'int');
+                       $sheet_id = $sheet_id ? $sheet_id : 
phpgw::get_var('selected_sheet_id', 'int', 'REQUEST');
 
-                       if($start_line  = phpgw::get_var('start_line', 
'REQUEST', 'int'))
+                       if($start_line  = phpgw::get_var('start_line', 'int', 
'REQUEST'))
                        {
                                phpgwapi_cache::system_set('property', 
'import_sheet_start_line', $start_line);
                        }
@@ -1023,7 +1057,7 @@
 
                public function edit_survey_title()
                {
-                       $id = phpgw::get_var('id', 'POST', 'int');
+                       $id = phpgw::get_var('id', 'int', 'GET');
 
                        if(!$this->acl_edit)
                        {

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2012-12-06 18:25:36 UTC (rev 
10576)
+++ trunk/property/inc/class.uientity.inc.php   2012-12-07 14:29:39 UTC (rev 
10577)
@@ -198,6 +198,80 @@
                        
$fileuploader->upload("{$this->category_dir}/{$loc1}/{$id}");
                }
 
+
+               /**
+               * Function to get related via Ajax-call using api-version of yui
+               *
+               */
+               function get_related()
+               {
+                       $id     = phpgw::get_var('id', 'REQUEST', 'int');
+
+                       if( !$this->acl_read)
+                       {
+                               return;
+                       }
+               
+                       $interlink      = CreateObject('property.interlink');
+                       $target = $interlink->get_relation('property', 
$this->acl_location, $id, 'target');
+
+
+                       $values = array();
+                       if($target)
+                       {
+                               foreach($target as $_target_section)
+                               {
+                                       foreach ($_target_section['data'] as 
$_target_entry)
+                                       {
+                                               $values[] = array
+                                               (
+                                                       'url'           => "<a 
href=\"{$_target_entry['link']}\" > {$_target_entry['id']}</a>",
+                                                       'type'          => 
$_target_section['descr'],
+                                                       'title'         => 
$_target_entry['title'],
+                                                       'status'        => 
$_target_entry['statustext'],
+                                                       'user'          => 
$GLOBALS['phpgw']->accounts->get($_target_entry['account_id'])->__toString(),
+                                                       'entry_date'=> 
$GLOBALS['phpgw']->common->show_date($_target_entry['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+                                               );
+                                       }
+                               }
+                       }
+
+//------ Start pagination
+
+                       $start = phpgw::get_var('startIndex', 'REQUEST', 'int', 
0);
+                       $total_records = count($values);
+
+                       $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int) 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;      
                
+
+                       if($allrows)
+                       {
+                               $out = $values;
+                       }
+                       else
+                       {
+                               $page = ceil( ( $start / $total_records ) * 
($total_records/ $num_rows) );
+                               $values_part = array_chunk($values, $num_rows);
+                               $out = $values_part[$page];
+                       }
+
+//------ End pagination
+
+
+                       $data = array(
+                                'ResultSet' => array(
+                                       'totalResultsAvailable' => 
$total_records,
+                                       'startIndex' => $start,
+                                       'sortKey' => 'type', 
+                                       'sortDir' => "ASC", 
+                                       'Result' => $out,
+                                       'pageSize' => $num_rows,
+                                       'activePage' => floor($start / 
$num_rows) + 1
+                               )
+                       );
+                       return $data;
+               }
+
+
                function get_files()
                {
                        $id     = phpgw::get_var('id', 'int');

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2012-12-06 18:25:36 UTC (rev 
10576)
+++ trunk/property/inc/class.uirequest.inc.php  2012-12-07 14:29:39 UTC (rev 
10577)
@@ -46,6 +46,7 @@
                var $part_of_town_id;
                var $sub;
                var $currentapp;
+               var $nonavbar;
 
                var $public_functions = array
                        (
@@ -94,6 +95,16 @@
                        $this->building_part            = 
$this->bo->building_part;
                        $this->allrows                          = 
$this->bo->allrows;
                        $this->p_num                            = 
$this->bo->p_num;
+                       $this->condition_survey_id      = 
$this->bo->condition_survey_id;
+                       $this->nonavbar                         = 
phpgw::get_var('nonavbar', 'bool');
+
+                       if( $this->nonavbar )
+                       {
+                               $GLOBALS['phpgw_info']['flags']['nonavbar']     
        = true;
+                               $GLOBALS['phpgw_info']['flags']['noheader_xsl'] 
= true;
+                               $GLOBALS['phpgw_info']['flags']['nofooter']     
        = true;
+                               $GLOBALS['phpgw_info']['flags']['noframework']  
= true;
+                       }
                }
 
                function save_sessiondata()
@@ -226,6 +237,8 @@
                //                              'status_id'     => 
$this->status_id,
                                                'project_id'    => $project_id,
                //                              'query'         => $this->query,
+                                               'condition_survey_id'=> 
$this->condition_survey_id,
+                                               'nonavbar' => $this->nonavbar,
                                                'p_num'         => $this->p_num,
                                                'start_date'=> 
$this->start_date,
                                                'end_date'      => 
$this->end_date
@@ -242,6 +255,8 @@
                                        ."status_id:'{$this->status_id}',"
                                        ."degree_id:'{$this->degree_id}',"
                                        
."property_cat_id:'{$this->property_cat_id}',"
+                                       
."condition_survey_id:'{$this->condition_survey_id}',"
+                                       ."nonavbar:'{$this->nonavbar}',"
                                        ."district_id: '{$this->district_id}',"
                                        ."start_date:'{$this->start_date}',"
                                        ."end_date: '{$this->end_date}',"
@@ -304,6 +319,8 @@
                                                        (
                                                                'menuaction'    
        => 'property.uirequest.index',
                                                                'lookup'        
        => $lookup,
+                                                               
'condition_survey_id'=> $this->condition_survey_id,
+                                                               'nonavbar'      
                => $this->nonavbar,
                                                                
'property_cat_id'       => $this->property_cat_id,
                                                                'cat_id'        
                => $this->cat_id,
                                                                'filter'        
                => $this->filter,
@@ -881,6 +898,7 @@
                        // values for datatable
                        if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row']))
                        {
+//_debug_array($datatable['rows']);
                                foreach( $datatable['rows']['row'] as $row )
                                {
                                        $json_row = array();

Modified: trunk/property/js/portico/condition_survey_edit.js
===================================================================
--- trunk/property/js/portico/condition_survey_edit.js  2012-12-06 18:25:36 UTC 
(rev 10576)
+++ trunk/property/js/portico/condition_survey_edit.js  2012-12-07 14:29:39 UTC 
(rev 10577)
@@ -56,18 +56,21 @@
        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()}});
+               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(){refresh_files()}});
        }
 
 
-       function closeJS_local()
+       function refresh_files()
        {
-       //      var reqUrl = '<xsl:value-of select="//datatable/source"/>';
-       //      YAHOO.portico.inlineTableHelper('requirement-container', 
reqUrl, YAHOO.portico.columnDefs);
+               var oArgs = 
{menuaction:'property.uicondition_survey.get_files', id:survey_id};
+               var strURL = phpGWLink('index.php', oArgs, true);
+               YAHOO.portico.updateinlineTableHelper('datatable-container_0', 
strURL);
        }
-
-       function refresh_files()
+       
+       function lightbox_hide()
        {
-               alert('refresh_files');
+               TINY.box.hide();
+               return true;
        }
 
+

Modified: trunk/property/js/yahoo/request.index.js
===================================================================
--- trunk/property/js/yahoo/request.index.js    2012-12-06 18:25:36 UTC (rev 
10576)
+++ trunk/property/js/yahoo/request.index.js    2012-12-07 14:29:39 UTC (rev 
10577)
@@ -50,6 +50,7 @@
        var linktToRequest = function(elCell, oRecord, oColumn, oData)
        {
                elCell.innerHTML = "<a href="+sUrl_request+"&id="+oData+">" + 
oData + "</a>";
+//             elCell.innerHTML = "<a href=" + sUrl_request + "&id=" + oData + 
"&nonavbar=" + path_values.nonavbar + ">" + oData + "</a>";
        };
 
 

Modified: trunk/property/templates/base/condition_survey.xsl
===================================================================
--- trunk/property/templates/base/condition_survey.xsl  2012-12-06 18:25:36 UTC 
(rev 10576)
+++ trunk/property/templates/base/condition_survey.xsl  2012-12-07 14:29:39 UTC 
(rev 10577)
@@ -201,11 +201,20 @@
 
                        <div id="documents">
                                <script type="text/javascript">
+                                  
+                                  var survey_id = '<xsl:value-of 
select='survey/id'/>';
                                   var fileuploader_action = {
                                                
menuaction:'property.fileuploader.add',
                                                
upload_target:'property.bocondition_survey.addfiles',
-                                               id: '<xsl:value-of 
select='survey/id'/>'
+                                               id: survey_id
                                        };
+                                       
+                                       this.show_related_requests = function()
+                                       {
+                                               var oArgs = 
{menuaction:'property.uirequest.index', nonavbar:1, 
condition_survey_id:survey_id};
+                                               var requestUrl = 
phpGWLink('index.php', oArgs);
+                                               
TINY.box.show({iframe:requestUrl, 
boxid:'frameless',width:screen.width*.9,height:screen.height*.5,fixed:false,maskid:'darkmask',maskopacity:40,
 mask:true, animate:true, close: true});
+                                       }
                                </script>
 
                                <xsl:call-template name="datasource-definition" 
/>
@@ -226,6 +235,27 @@
                                        </xsl:choose>
                                </dl>
                        </div>
+                       <div id="related">
+                               <dl class="proplist-col">
+                                       <dt>
+                                               <label>
+                                                       <a 
href="javascript:show_related_requests()">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'details')"/>
+                                                               </xsl:attribute>
+                                                               <xsl:value-of 
select="php:function('lang', 'details')"/>
+                                                       </a>
+                                               </label>
+                                       </dt>
+
+                                       <dt>
+                                               <label><xsl:value-of 
select="php:function('lang', 'related')"/></label>
+                                       </dt>
+                                       <dd>
+                                               <div style="clear:both;" 
id="datatable-container_1"></div>
+                                       </dd>
+                               </dl>
+                       </div>
                        <div id="import">
                                <xsl:choose>
                                        <xsl:when test="editable = 1">
@@ -244,17 +274,7 @@
                                </xsl:when>
                        </xsl:choose>
                        </div>
-                       <div id="related">
-                               <dl class="proplist-col">
-                                       <dt>
-                                               <label><xsl:value-of 
select="php:function('lang', 'related')"/></label>
-                                       </dt>
-                                       <dd>
-                                               <div style="clear:both;" 
id="datatable-container_1"></div>
-                                       </dd>
-                               </dl>
                        </div>
-                       </div>
                                <dl class="proplist-col">
                                                <div class="form-buttons">
                                                        <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>




reply via email to

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