fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10568] property: more on condition survey


From: Sigurd Nes
Subject: [Fmsystem-commits] [10568] property: more on condition survey
Date: Tue, 04 Dec 2012 10:06:41 +0000

Revision: 10568
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10568
Author:   sigurdne
Date:     2012-12-04 10:06:40 +0000 (Tue, 04 Dec 2012)
Log Message:
-----------
property: more on condition survey

Modified Paths:
--------------
    trunk/property/inc/class.uicondition_survey.inc.php
    trunk/property/templates/base/condition_survey_import.xsl

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2012-12-04 10:06:20 UTC 
(rev 10567)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2012-12-04 10:06:40 UTC 
(rev 10568)
@@ -566,7 +566,7 @@
 
                public function import()
                {
-                       $id = phpgw::get_var('step', 'REQUEST', 'int');
+                       $id = phpgw::get_var('id', 'REQUEST', 'int');
                        $this->_handle_import($id);
                }
 
@@ -613,7 +613,8 @@
                                $sheets[] = array
                                (
                                        'id'    => $key,
-                                       'name'  => $sheet
+                                       'name'  => $sheet,
+                                       'selected' => $sheet_id == $key
                                );
                        }
 
@@ -623,7 +624,7 @@
 
 
 
-                       phpgwapi_yui::tabview_setup('survey_edit_tabview');
+//                     phpgwapi_yui::tabview_setup('survey_edit_tabview');
                        $tabs = array();
                        
                        switch ($step)
@@ -636,20 +637,18 @@
                                        break;
                                case 1:
                                        $active_tab = 'step_2';
-                                       $tabs['step_1'] = array('label' => 
lang('step_1'), 'link' => null);
+                                       $tabs['step_1'] = array('label' => 
lang('step_1'), 'link' => self::link(array('menuaction' => 
'property.uicondition_survey.import', 'id' =>$id, 'step' => 0, 'sheet_id' => 
$sheet_id, 'start_line' => $start_line )));
                                        $tabs['step_2'] = array('label' => 
lang('step_2'), 'link' => '#step_2');
                                        $tabs['step_3'] = array('label' => 
lang('step_3'), 'link' => null);
                                        break;
                                case 2:
                                        $active_tab = 'step_3';
-                                       $tabs['step_1'] = array('label' => 
lang('step_1'), 'link' => null);
-                                       $tabs['step_2'] = array('label' => 
lang('step_2'), 'link' => null);
+                                       $tabs['step_1'] = array('label' => 
lang('step_1'), 'link' => self::link(array('menuaction' => 
'property.uicondition_survey.import', 'id' =>$id, 'step' => 0, 'sheet_id' => 
$sheet_id, 'start_line' => $start_line )));
+                                       $tabs['step_2'] = array('label' => 
lang('step_2'), 'link' => self::link(array('menuaction' => 
'property.uicondition_survey.import', 'id' =>$id, 'step' => 1, 'sheet_id' => 
$sheet_id, 'start_line' => $start_line )));
                                        $tabs['step_3'] = array('label' => 
lang('step_3'), 'link' =>  '#step_3');
                                        break;
                        }
                        
-
-
 //-----------
 
 
@@ -674,32 +673,84 @@
                                                $_checked = 'checked="checked"';
                                        }
 
-                                       $_radio = "<input id=\"start_line\" 
type =\"radio\" {$_checked} name=\"start_line\" value=\"{$row_key}\">";
+                                       $_radio = "[{$row_key}]<input 
id=\"start_line\" type =\"radio\" {$_checked} name=\"start_line\" 
value=\"{$row_key}\">";
 
-                                       $html_table .= 
"<tr><td>{$_radio}</td><td>" . implode('</td><td>', array_values($row)) . 
'</td></tr>';
+                                       $html_table .= 
"<tr><td><pre>{$_radio}</pre></td><td>" . implode('</td><td>', 
array_values($row)) . '</td></tr>';
                                        $i++;
                                }
                        }                       
                        else if($data && $step == 2)
                        {
+                               $_options = array
+                               (
+                                       'Felt_1',
+                                       'Felt_2',
+                                       'Felt_3',
+                                       'Felt_4',
+                                       'Felt_5',
+                                       'Felt_6',
+                               );
+
+
+               /*
+                * Create a generic select list
+                *
+                * @param string $name string with name of the submitted var 
which holds the key of the selected item form array
+                * @param array $selected key(s) of already selected item(s) 
from $options, eg. '1' or '1,2' or array with keys
+                * @param array $options items to populate the <options>
+                * @param bool $no_lang by default all values are translated by 
calls to lang(), setting this to true disbales it
+                * @param string $attribs additional html attributed to be 
applied to <select>
+                * @param int $multiple the height of the <select>, if greater 
than 1, set to 1 to just enable multiple selections
+                * @return string the populated html select element
+                */
+                               phpgw::import_class('phpgwapi.sbox');
+
                                foreach($data[$start_line] as $_column => 
$_value)
                                {
+                                       $_listbox = 
phpgwapi_sbox::getArrayItem($_column, $selected= 'Felt_6', $_options, true );
+
                                        $_checkbox = "<input id=\"start_line\" 
type =\"checkbox\" {$_checked} name=\"column\" value=\"{$_column}\">";
-                                       $html_table .= 
"<tr><td>{$_value}</td><td>{$_checkbox}</td><tr>";
+                                       $html_table .= "<tr><td>[{$_column}] 
{$_value}</td><td>{$_listbox}</td><tr>";
                                }
                        }
 
                        $html_table .= '</table>';
 
 
+
+
+
+//
+                       $values = $this->bo->read_single( array('id' => $id,  
'view' => $mode == 'view') );
+
+                       if(isset($values['location_code']) && 
$values['location_code'])
+                       {
+                               $values['location_data'] = 
execMethod('property.solocation.read_single', $values['location_code']);
+                       }
+
+                       $bolocation     = CreateObject('property.bolocation');
+                       $location_data = $bolocation->initiate_ui_location(array
+                               (
+                                       'values'        => 
$values['location_data'],
+                                       'type_id'       => 2,
+                                       'lookup_type'   => 'view2',
+                                       'tenant'        => false,
+                                       'lookup_entity' => array(),
+                                       'entity_data'   => 
isset($values['p'])?$values['p']:''
+                               ));
+//
+
                        $data = array
                        (
-                               'survey'                                        
        => array('id'=>$id),
+                               'survey'                                        
        => $values,
+                               'location_data2'                                
=> $location_data,
                                'step'                                          
        => $step +1,
                                'sheet_id'                                      
        => $sheet_id,
+                               'start_line'                                    
=> $start_line,
                                'html_table'                                    
=> $html_table,
                                'sheets'                                        
        => array('options' => $sheets),
-                               'tabs'                                          
        => phpgwapi_yui::tabview_generate($tabs, $active_tab),
+               //              'tabs'                                          
        => phpgwapi_yui::tabview_generate($tabs, $active_tab),
+                               'tabs'                                          
        =>$GLOBALS['phpgw']->common->create_tabs($tabs, $active_tab),
                        );
 
 //_debug_array($data);die();

Modified: trunk/property/templates/base/condition_survey_import.xsl
===================================================================
--- trunk/property/templates/base/condition_survey_import.xsl   2012-12-04 
10:06:20 UTC (rev 10567)
+++ trunk/property/templates/base/condition_survey_import.xsl   2012-12-04 
10:06:40 UTC (rev 10568)
@@ -4,7 +4,7 @@
 <xsl:template match="data" xmlns:formvalidator="http://www.w3.org/TR/html4/"; 
xmlns:php="http://php.net/xsl";>
                <xsl:call-template name="yui_phpgw_i18n"/>
 
-               <div class="yui-navset" id="survey_edit_tabview">
+               <div class="yui-navset yui-navset-top" id="survey_edit_tabview">
        
                <h1>
                        <xsl:value-of select="php:function('lang', 'condition 
survey import')" />
@@ -17,28 +17,28 @@
 
                        <form name="form" id="form" action="{$action_url}" 
method="post" ENCTYPE="multipart/form-data">
                        <dl>
-                                       <xsl:choose>
-                                               <xsl:when test="msgbox_data != 
''">
-                                                               <dt>
-                                                                       
<xsl:call-template name="msgbox"/>
-                                                               </dt>
-                                               </xsl:when>
-                                       </xsl:choose>
+                                       <dt>
+                                               <label><xsl:value-of 
select="php:function('lang', 'id')" /></label>
+                                       </dt>
+                                       <dd>
+                                               <xsl:value-of 
select="survey/id"/>
+                                               <input type="hidden" name="id" 
value="{survey/id}"/>
+                                               <input type="hidden" 
name="step" value="{step}"/>
+                                               <input type="hidden" 
name="selected_sheet_id" value="{sheet_id}"/>
+                                       </dd>
 
                                        <xsl:choose>
-                                               <xsl:when test="survey/id!=''">
-                                                               <dt>
-                                                                       
<label><xsl:value-of select="php:function('lang', 'id')" /></label>
-                                                               </dt>
-                                                               <dd>
-                                                                       
<xsl:value-of select="survey/id"/>
-                                                                       <input 
type="hidden" name="id" value="{survey/id}"/>
-                                                                       <input 
type="hidden" name="step" value="{step}"/>
-                                                                       <input 
type="hidden" name="selected_sheet_id" value="{sheet_id}"/>
-                                                               </dd>
+                                               <xsl:when 
test="location_data2!=''">
+                                                       <xsl:call-template 
name="location_view2"/>
                                                </xsl:when>
                                        </xsl:choose>
 
+                                       <dt>
+                                               <label for="name"><xsl:value-of 
select="php:function('lang', 'name')" /></label>
+                                       </dt>
+                                       <dd>
+                                               <xsl:value-of 
select="survey/title" />
+                                       </dd>
 
                                </dl>
                                <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
@@ -47,29 +47,17 @@
                                                <xsl:when test="step=1">
                                                        <xsl:call-template 
name="import_step_1"/>
                                                </xsl:when>
-                                               <xsl:otherwise>
-                                                       <div id="step_1" 
class="content-wrp">
-                                                       </div>
-                                               </xsl:otherwise>
                                        </xsl:choose>
 
                                        <xsl:choose>
                                                <xsl:when test="step=2">
                                                        <xsl:call-template 
name="import_step_2"/>
                                                </xsl:when>
-                                               <xsl:otherwise>
-                                                       <div id="step_2" 
class="content-wrp">
-                                                       </div>
-                                               </xsl:otherwise>
                                        </xsl:choose>
                                        <xsl:choose>
                                                <xsl:when test="step=3">
                                                        <xsl:call-template 
name="import_step_3"/>
                                                </xsl:when>
-                                               <xsl:otherwise>
-                                                       <div id="step_3" 
class="content-wrp">
-                                                       </div>
-                                               </xsl:otherwise>
                                        </xsl:choose>
 
                                </div>
@@ -125,9 +113,8 @@
 
 
 <xsl:template name="import_step_1" 
xmlns:formvalidator="http://www.w3.org/TR/html4/"; 
xmlns:php="http://php.net/xsl";>
-       <div id="step_1" class="content-wrp">
                <dl class="proplist-col">
-                       <dt>
+               <dt>
                        <label for="status"><xsl:value-of 
select="php:function('lang', 'sheets')" /></label>
                </dt>
                <dd>
@@ -136,33 +123,57 @@
                        </select>
                </dd>
                </dl>
-       </div>
+       
 </xsl:template>
 
 <xsl:template name="import_step_2" xmlns:php="http://php.net/xsl";>
-       <div id="step_2" class="content-wrp">
-               <dl class="proplist-col">
-                       <dt>
+       <dl class="proplist-col">
+
+               <dt>
+                       <label for="status"><xsl:value-of 
select="php:function('lang', 'sheets')" /></label>
+               </dt>
+               <dd>
+                       <xsl:for-each select="sheets/options">
+                               <xsl:if test="selected = 'selected' or selected 
= 1">
+                                       <xsl:value-of 
disable-output-escaping="yes" select="name"/>
+                               </xsl:if>
+                       </xsl:for-each>
+               </dd>
+
+               <dt>
                        <label for="status"><xsl:value-of 
select="php:function('lang', 'table')" /></label>
                </dt>
                <dd>
                        <xsl:value-of disable-output-escaping="yes" 
select="html_table"/>
                </dd>
-               </dl>
-       </div>
+       </dl>
 </xsl:template>
 
 <xsl:template name="import_step_3" xmlns:php="http://php.net/xsl";>
-       <div id="step_2" class="content-wrp">
-               <dl class="proplist-col">
-                       <dt>
-                       <label for="status"><xsl:value-of 
select="php:function('lang', 'table')" /></label>
+       <dl class="proplist-col">
+               <dt>
+                       <label><xsl:value-of select="php:function('lang', 
'sheets')" /></label>
                </dt>
                <dd>
+                       <xsl:for-each select="sheets/options">
+                               <xsl:if test="selected = 'selected' or selected 
= 1">
+                                       <xsl:value-of 
disable-output-escaping="yes" select="name"/>
+                               </xsl:if>
+                       </xsl:for-each>
+               </dd>
+               <dt>
+                       <label><xsl:value-of select="php:function('lang', 
'line')" /></label>
+               </dt>
+               <dd>
+                       <xsl:value-of select="start_line"/>
+               </dd>
+               <dt>
+                       <label><xsl:value-of select="php:function('lang', 
'columns')" /></label>
+               </dt>
+               <dd>
                        <xsl:value-of disable-output-escaping="yes" 
select="html_table"/>
                </dd>
-               </dl>
-       </div>
+       </dl>
 </xsl:template>
 
 




reply via email to

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