fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10263]


From: Torstein
Subject: [Fmsystem-commits] [10263]
Date: Thu, 18 Oct 2012 14:28:25 +0000

Revision: 10263
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10263
Author:   vator
Date:     2012-10-18 14:28:25 +0000 (Thu, 18 Oct 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/logistic/inc/class.sorequirement_value.inc.php
    trunk/logistic/inc/class.uirequirement.inc.php
    trunk/logistic/templates/base/css/base.css
    trunk/logistic/templates/base/requirement/requirement_item.xsl
    trunk/logistic/templates/base/requirement/requirement_values.xsl

Modified: trunk/logistic/inc/class.sorequirement_value.inc.php
===================================================================
--- trunk/logistic/inc/class.sorequirement_value.inc.php        2012-10-18 
13:50:48 UTC (rev 10262)
+++ trunk/logistic/inc/class.sorequirement_value.inc.php        2012-10-18 
14:28:25 UTC (rev 10263)
@@ -161,7 +161,7 @@
 
                        $dir = $ascending ? 'ASC' : 'DESC';
                        $order = $sort_field ? "ORDER BY 
{$this->marshal($sort_field, 'field')} $dir ": '';
-                       echo "SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}";
+
                        return "SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}";
                }
 

Modified: trunk/logistic/inc/class.uirequirement.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement.inc.php      2012-10-18 13:50:48 UTC 
(rev 10262)
+++ trunk/logistic/inc/class.uirequirement.inc.php      2012-10-18 14:28:25 UTC 
(rev 10263)
@@ -269,6 +269,8 @@
                        $requirement_id = phpgw::get_var('id');
                        $activity_id = phpgw::get_var('activity_id');
 
+                       echo $requirement_id;
+                       
                        if ($requirement_id && is_numeric($requirement_id))
                        {
                                $requirement = 
$this->so->get_single($requirement_id);
@@ -412,7 +414,6 @@
  
                                
$this->so_requirement_value->delete_values($requirement_id);
                                
-                               
                                foreach($attributes_array as $attribute)
                                {
                                        $attribute_array = explode ( ":", 
$attribute );                                 
@@ -440,17 +441,84 @@
                                
                                $custom_attributes_array = array();
                                $custom_attributes_array = 
$this->get_custom_attributes($location_id, $activity_id);
+                                               
+                               $filters = array('requirement_id' => 
$requirement_id);
+                               $requirement_values_array = 
$this->so_requirement_value->get($start_index, $num_of_objects, $sort_field, 
$sort_ascending, $search_for, $search_type, $filters);
+       
+                               $custom = 
createObject('phpgwapi.custom_fields');
+
+                               if( count( $requirement_values_array ) > 0 )
+                               {
+                                       foreach($requirement_values_array as 
$requirement_value)
+                                       {
+                                               $location_id = 
$requirement->get_location_id(); 
+
+                                               $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+                                               $entity_arr = 
explode('.',$loc_arr['location']);
+               
+                                               $entity_id = $entity_arr[2];
+                                               $cat_id = $entity_arr[3];
+                                               $cust_attribute_id = 
$requirement_value->get_cust_attribute_id();
+                                                                               
        
+                                               $attrib_data = 
$custom->get('property', ".entity.{$entity_id}.{$cat_id}", $cust_attribute_id);
+               
+                                               
$temp_requirement_attributes_array[$cust_attribute_id][] = array(
+                                                       "id"                    
                                => $requirement_value->get_id(),
+                                                       "attrib_value"          
=> $requirement_value->get_value(),
+                                                       "operator"              
                => $requirement_value->get_operator(),
+                                                       "cust_attribute"        
=> $attrib_data
+                                               );
+                                       }
+                                       
+                                       
+                                       
foreach($temp_requirement_attributes_array as $req_attrib)
+                                       {
+                                               if( count( $req_attrib ) > 1 )
+                                               {
+                                                       if( 
$req_attrib[0]['operator'] == 'gt' )
+                                                       {
+                                                               $constraint_1 = 
$req_attrib[0];
+                                                               $constraint_2 = 
$req_attrib[1];
+                                                       }
+                                                       else
+                                                       {
+                                                               $constraint_1 = 
$req_attrib[1];
+                                                               $constraint_2 = 
$req_attrib[0];
+                                                       }
+                                               
+                                                       
$req_attrib[0]['operator'] = 'btw';
+                                                       
$req_attrib[0]['attrib_value'] = $constraint_1['attrib_value'] . ":" . 
$constraint_2['attrib_value'];
+                                                       
$requirement_attributes_array[] = $req_attrib[0];
+                                               }
+                                               else
+                                               {
+                                                       
$requirement_attributes_array[] = $req_attrib[0];       
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                                       foreach($custom_attributes_array as 
$cust_attrib)
+                                       {
+                                               $requirement_attributes_array[] 
= array(
+                                                       "id"                    
                                => "",
+                                                       "attrib_value"          
=> "",
+                                                       "operator"              
                => "",
+                                                       "cust_attribute"        
=> $cust_attrib
+                                               );
+                                       }
+                               }
                                
                                $tabs = $this->make_tab_menu($requirement_id);
                                
                                $data = array
                                (
-                                       'tabs'                                  
                                        => 
$GLOBALS['phpgw']->common->create_tabs($tabs, 1),
-                                       'view'                                  
                                        => "requirement_values",
-                                       'requirement'                           
                => $requirement,
-                                       'custom_attributes_array'       => 
$custom_attributes_array,
-                                       'distict_locations'                     
=> $distict_locations_array,
-                                       'editable'                              
                                => true,
+                                       'tabs'                                  
                                                                => 
$GLOBALS['phpgw']->common->create_tabs($tabs, 1),
+                                       'view'                                  
                                                                => 
"requirement_values",
+                                       'requirement'                           
                                        => $requirement,
+                                       'requirement_attributes_array'  => 
$requirement_attributes_array,
+                                       'distict_locations'                     
                        => $distict_locations_array,
+                                       'editable'                              
                                                        => true,
                                );
                                
                                if($activity_id > 0)
@@ -501,17 +569,39 @@
                                                                        
                                $attrib_data = $custom->get('property', 
".entity.{$entity_id}.{$cat_id}", $cust_attribute_id);
 
-
-                               $requirement_attributes_array[] = array(
-                                                                               
                                                                                
                                        "id"                                    
                => $requirement_value->get_id(),
-                                                                               
                                                                                
                                        "value"                                 
        => $requirement_value->get_value(),
-                                                                               
                                                                                
                                        "operator"                              
=> $requirement_value->get_operator(), 
-                                                                               
                                                                                
                                        "cust_attribute"        => $attrib_data
-                                                                               
                                                                                
                                );
+                               
$temp_requirement_attributes_array[$cust_attribute_id][] = array(
+                                       "id"                                    
                => $requirement_value->get_id(),
+                                       "attrib_value"                          
        => $requirement_value->get_value(),
+                                       "operator"                              
=> $requirement_value->get_operator(), 
+                                       "cust_attribute"        => $attrib_data
+                               );
                        }
-
-                       print_r($requirement_attributes_array);
                        
+                       foreach($temp_requirement_attributes_array as 
$req_attrib)
+                       {
+                               if( count( $req_attrib ) > 1 )
+                               {
+                                       if( $req_attrib[0]['operator'] == 'gt' )
+                                       {
+                                               $constraint_1 = $req_attrib[0];
+                                               $constraint_2 = $req_attrib[1];
+                                       }
+                                       else
+                                       {
+                                               $constraint_1 = $req_attrib[1];
+                                               $constraint_2 = $req_attrib[0];
+                                       }
+                               
+                                       $req_attrib[0]['operator'] = 'btw';
+                                       $req_attrib[0]['attrib_value'] = 
$constraint_1['attrib_value'] . ":" . $constraint_2['attrib_value'];
+                                       $requirement_attributes_array[] = 
$req_attrib[0];
+                               }
+                               else
+                               {
+                                       $requirement_attributes_array[] = 
$req_attrib[0];       
+                               }
+                       }
+                       
                        $tabs = $this->make_tab_menu($requirement_id);
                        
                        $data = array
@@ -566,25 +656,31 @@
                                return $attribute_requirement_array;            
                }
                
-               function make_tab_menu($control_id){
+               function make_tab_menu($requirement_id)
+               {
                        $tabs = array();
                        
                        if($requirement_id > 0){
                                
                                $requirement = 
$this->so->get_single($requirement_id);
                                
-                               $tabs[] = array(
+                               $tabs = array( 
+                                                  array(
                                                        'label' => "1: " . 
lang('Requirement details'),
-                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uirequirement.edit', 
-                                                                               
                                                                                
   'id' => $requirement->get_id()))
-                                               );
+                                                  'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'logistic.uirequirement.edit', 
+                                                                               
                                                                                
                                                                                
                         'id' => $requirement->get_id()))
+                                               ), array(
+                                                       'label' => "2: " . 
lang('Add constraints'),
+                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'logistic.uirequirement.add_requirement_values', 
+                                                                               
                                                                                
                                                                                
                         'requirement_id' => $requirement->get_id()))
+                                               ));
                        }else{
                                $tabs = array( 
                                                   array(
                                                        'label' => "1: " . 
lang('Requirement details')
                                                ), array(
                                                        'label' => "2: " . 
lang('Add constraints')
-                                               ));
+                               ));
                        }
                        
                        return $tabs;

Modified: trunk/logistic/templates/base/css/base.css
===================================================================
--- trunk/logistic/templates/base/css/base.css  2012-10-18 13:50:48 UTC (rev 
10262)
+++ trunk/logistic/templates/base/css/base.css  2012-10-18 14:28:25 UTC (rev 
10263)
@@ -2251,4 +2251,6 @@
        width: 100px;   
 }
 
-
+#requirement_tabview .yui-navset {
+    margin: 0;
+}

Modified: trunk/logistic/templates/base/requirement/requirement_item.xsl
===================================================================
--- trunk/logistic/templates/base/requirement/requirement_item.xsl      
2012-10-18 13:50:48 UTC (rev 10262)
+++ trunk/logistic/templates/base/requirement/requirement_item.xsl      
2012-10-18 14:28:25 UTC (rev 10263)
@@ -4,103 +4,101 @@
 <xsl:template name="requirement_details" xmlns:php="http://php.net/xsl";>
 <xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')"/></xsl:variable>
 
-<div class="yui-navset yui-navset-top">
-               <div class="yui-content" style="padding: 20px;">
-               <div id="details">
-                       <form action="#" method="post">
-                               <input type="hidden" name="id" value = 
"{requirement/id}" />
-                               <input type="hidden" id="activity_id" 
name="activity_id" value="{activity/id}" />
-                                                       
-                               <dl class="proplist-col">
-                                       <dt>
-                                               <label 
for="start_date">Startdato</label>
-                                       </dt>
-                                       <dd>
-                                               <xsl:choose>
-                                                       <xsl:when 
test="editable">
-                                                               <input 
class="date" id="start_date" name="start_date" type="text">
-                                                       <xsl:if 
test="requirement/start_date != ''">
-                                                       <xsl:attribute 
name="value"><xsl:value-of select="php:function('date', $date_format, 
number(requirement/start_date))"/></xsl:attribute>
-                                                       </xsl:if>
-                                               </input>        
-                                                       </xsl:when>
-                                                       <xsl:otherwise>
-                                                       <span><xsl:value-of 
select="php:function('date', $date_format, 
number(requirement/start_date))"/></span>
-                                                       </xsl:otherwise>
-                                               </xsl:choose>
-                                       </dd>
-                                       <dt>
-                                               <label 
for="end_date">Sluttdato</label>
-                                       </dt>
-                                       <dd>
-                                               <xsl:choose>
-                                                       <xsl:when 
test="editable">
-                                                               <input 
class="date" id="end_date" name="end_date" type="text">
-                                                       <xsl:if 
test="requirement/end_date != ''">
-                                                       <xsl:attribute 
name="value"><xsl:value-of select="php:function('date', $date_format, 
number(requirement/end_date))"/></xsl:attribute>
-                                                       </xsl:if>
-                                               </input>        
-                                                       </xsl:when>
-                                                       <xsl:otherwise>
-                                                       <span><xsl:value-of 
select="php:function('date', $date_format, 
number(requirement/end_date))"/></span>
-                                                       </xsl:otherwise>
-                                               </xsl:choose>
-                                       </dd>
-                               
-                               
-                                       <dt>
-                                               <label 
for="no_of_items">Antall</label>
-                                       </dt>
-                                       <dd>
-                                               <xsl:choose>
-                                                       <xsl:when 
test="editable">
-                                                               <input 
style="width: 20px;" id="no_of_items" name="no_of_items" type="text" />
-                                                       </xsl:when>
-                                                       <xsl:otherwise>
-                                                       <span><xsl:value-of 
select="requirement/no_of_items"/></span>
-                                                       </xsl:otherwise>
-                                               </xsl:choose>
-                                       </dd>
-                               
+<div class="yui-content" style="padding: 20px;">
+       <div id="details">
+               <form action="#" method="post">
+                       <input type="hidden" name="id" value = 
"{requirement/id}" />
+                       <input type="hidden" id="activity_id" 
name="activity_id" value="{activity/id}" />
+                                               
+                       <dl class="proplist-col">
+                               <dt>
+                                       <label 
for="start_date">Startdato</label>
+                               </dt>
+                               <dd>
                                        <xsl:choose>
                                                <xsl:when test="editable">
-                                               <dt>
-                                                       <label>Velg hvilken 
kategori behovet gjelder</label>
-                                               </dt>
-                                                       <dd>
-                                                               <select 
name="location_id" id="location_id">
-                                                                       <option 
value="">Velg kategori</option>
-                                                                       
<xsl:for-each select="distict_locations">
-                                                                               
<option value="{location_id}">
-                                                                               
        <xsl:value-of select="descr"/>
-                                                                               
</option>
-                                                                       
</xsl:for-each>
-                                                               </select>
-                                                               <div 
id="attributes"></div>
-                                                       </dd>                   
                
+                                                       <input class="date" 
id="start_date" name="start_date" type="text">
+                                               <xsl:if 
test="requirement/start_date != ''">
+                                               <xsl:attribute 
name="value"><xsl:value-of select="php:function('date', $date_format, 
number(requirement/start_date))"/></xsl:attribute>
+                                               </xsl:if>
+                                       </input>        
                                                </xsl:when>
                                                <xsl:otherwise>
-                                                       <xsl:value-of 
select="location/descr" />
+                                               <span><xsl:value-of 
select="php:function('date', $date_format, 
number(requirement/start_date))"/></span>
                                                </xsl:otherwise>
                                        </xsl:choose>
-                               </dl>
-                               
-                               <div class="form-buttons">
+                               </dd>
+                               <dt>
+                                       <label for="end_date">Sluttdato</label>
+                               </dt>
+                               <dd>
                                        <xsl:choose>
                                                <xsl:when test="editable">
-                                                       <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
-                                                       <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
-                                                       <input type="submit" 
name="save_requirement" value="{$lang_save}" title = "{$lang_save}" />
-                                                       <input type="submit" 
name="cancel_requirement" value="{$lang_cancel}" title = "{$lang_cancel}" />
+                                                       <input class="date" 
id="end_date" name="end_date" type="text">
+                                               <xsl:if 
test="requirement/end_date != ''">
+                                               <xsl:attribute 
name="value"><xsl:value-of select="php:function('date', $date_format, 
number(requirement/end_date))"/></xsl:attribute>
+                                               </xsl:if>
+                                       </input>        
                                                </xsl:when>
                                                <xsl:otherwise>
-                                                       <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
-                                                       <input type="submit" 
name="edit_requirement" value="{$lang_edit}" title = "{$lang_edit}" />
+                                               <span><xsl:value-of 
select="php:function('date', $date_format, 
number(requirement/end_date))"/></span>
                                                </xsl:otherwise>
                                        </xsl:choose>
-                               </div>
-                       </form>
-               </div>
+                               </dd>
+                       
+                       
+                               <dt>
+                                       <label for="no_of_items">Antall</label>
+                               </dt>
+                               <dd>
+                                       <xsl:choose>
+                                               <xsl:when test="editable">
+                                                       <input style="width: 
20px;" id="no_of_items" name="no_of_items" type="text" />
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                               <span><xsl:value-of 
select="requirement/no_of_items"/></span>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </dd>
+                       
+                               <xsl:choose>
+                                       <xsl:when test="editable">
+                                       <dt>
+                                               <label>Velg hvilken kategori 
behovet gjelder</label>
+                                       </dt>
+                                               <dd>
+                                                       <select 
name="location_id" id="location_id">
+                                                               <option 
value="">Velg kategori</option>
+                                                               <xsl:for-each 
select="distict_locations">
+                                                                       <option 
value="{location_id}">
+                                                                               
<xsl:value-of select="descr"/>
+                                                                       
</option>
+                                                               </xsl:for-each>
+                                                       </select>
+                                                       <div 
id="attributes"></div>
+                                               </dd>                           
        
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <xsl:value-of 
select="location/descr" />
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </dl>
+                       
+                       <div class="form-buttons">
+                               <xsl:choose>
+                                       <xsl:when test="editable">
+                                               <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
+                                               <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
+                                               <input type="submit" 
name="save_requirement" value="{$lang_save}" title = "{$lang_save}" />
+                                               <input type="submit" 
name="cancel_requirement" value="{$lang_cancel}" title = "{$lang_cancel}" />
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
+                                               <input type="submit" 
name="edit_requirement" value="{$lang_edit}" title = "{$lang_edit}" />
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </div>
+               </form>
        </div>
 </div>
 </xsl:template>

Modified: trunk/logistic/templates/base/requirement/requirement_values.xsl
===================================================================
--- trunk/logistic/templates/base/requirement/requirement_values.xsl    
2012-10-18 13:50:48 UTC (rev 10262)
+++ trunk/logistic/templates/base/requirement/requirement_values.xsl    
2012-10-18 14:28:25 UTC (rev 10263)
@@ -4,114 +4,185 @@
 <xsl:template name="requirement_values" xmlns:php="http://php.net/xsl";>
 <xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')"/></xsl:variable>
 
-<div class="yui-navset yui-navset-top">
-       <div class="yui-content" style="padding: 20px;">
-               <div id="details">
-                       <form id="frm-requirement-values" action="#" 
method="post">
-                               <input type="hidden" name="requirement_id" 
value = "{requirement/id}" />
-                                                                               
        
-                               <dl class="proplist-col">
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                               <dt>
-                                                       <label>Legg til 
kriterier</label>
-                                               </dt>
-                                                       <dd>
-                                                       <div id="attributes">
-                                                               <xsl:for-each 
select="custom_attributes_array">
-                                                                       <div 
class="attribute">
+<div class="yui-content" style="padding: 20px;">
+       <div id="details">
+               <form id="frm-requirement-values" action="#" method="post">
+                       <input type="hidden" name="requirement_id" value = 
"{requirement/id}" />
+                                                                               
+                       <dl class="proplist-col">
+                               <xsl:choose>
+                                       <xsl:when test="editable">
+                                       <dt>
+                                               <label>Legg til 
kriterier</label>
+                                       </dt>
+                                               <dd>
+                                               <div id="attributes">
+                                                       <xsl:for-each 
select="requirement_attributes_array">
+                                                               <div 
class="attribute">
                                                                        
<xsl:choose>
-                                                                               
<xsl:when test="column_info/type = 'T'">
-                                                                               
                <label><xsl:value-of select="input_text"/></label>
+                                                                               
<xsl:when test="cust_attribute/column_info/type = 'T'">
+                                                                               
                <label><xsl:value-of 
select="cust_attribute/input_text"/></label>
                                                                                
                <input class="operator" type='hidden' name="operator" 
value='eq' />
-                                                                               
                <input class="attrib_info" type='text' name="{column_name}" 
value='' />
+                                                                               
                <input class="attrib_info" type='text' 
name="{cust_attribute/column_name}" value='{attrib_value}' />
                                                                                
</xsl:when>
-                                                                               
<xsl:when test="column_info/type = 'V' or column_info/type = 'I'">
-                                                                               
        <label><xsl:value-of select="input_text"/></label>
-                                                                               
        <input class="constraint_1" style="display:none;margin-right: 10px;" 
type='text' name="{column_name}" value='' />
+                                                                               
<xsl:when test="cust_attribute/column_info/type = 'V' or 
cust_attribute/column_info/type = 'I'">
+                                                                               
        <label><xsl:value-of select="cust_attribute/input_text"/></label>
+                                                                               
        
+                                                                               
        <xsl:choose>
+                                                                               
                <xsl:when test="operator = 'btw'">
+                                                                               
                        <xsl:variable name="gt-attrib-value"><xsl:value-of 
select="substring-before(attrib_value, ':')" /></xsl:variable>
+                                                                               
                        <input class="constraint_1" style="margin-right: 10px;" 
type='text' name="{cust_attribute/column_name}" value="{$gt-attrib-value}" />
+                                                                               
                </xsl:when>
+                                                                               
                <xsl:otherwise>
+                                                                               
                        <xsl:variable name="gt-attrib-value"><xsl:value-of 
select="substring-before(attrib_value, ':')" /></xsl:variable>
+                                                                               
                        <input class="constraint_1" style="margin-right: 
10px;display:none;" type='text' name="{cust_attribute/column_name}" 
value="{$gt-attrib-value}" />
+                                                                               
                </xsl:otherwise>
+                                                                               
        </xsl:choose>
+                                                                               
                                                                                
                                
                                                                                
        <select class="operator" name="operator">
-                                                                               
                <option value="eq"><xsl:text>Lik</xsl:text></option>
-                                                                               
                <option value="lt"><xsl:text>Mindre enn</xsl:text></option>
-                                                                               
                <option value="gt"><xsl:text>Større enn</xsl:text></option>
-                                                                               
                <option value="btw"><xsl:text>Mellom</xsl:text></option>
+                                                                               
                <xsl:choose>
+                                                                               
                        <xsl:when test="operator = 'eq'">
+                                                                               
                                <option selected='true' 
value="eq"><xsl:text>Lik</xsl:text></option>    
+                                                                               
                        </xsl:when>
+                                                                               
                        <xsl:otherwise>
+                                                                               
                                <option 
value="eq"><xsl:text>Lik</xsl:text></option>
+                                                                               
                        </xsl:otherwise>
+                                                                               
                </xsl:choose>
+                                                                               
                <xsl:choose>
+                                                                               
                        <xsl:when test="operator = 'lt'">
+                                                                               
                                <option selected='true' 
value="lt"><xsl:text>Mindre enn</xsl:text></option>     
+                                                                               
                        </xsl:when>
+                                                                               
                        <xsl:otherwise>
+                                                                               
                                <option value="lt"><xsl:text>Mindre 
enn</xsl:text></option>
+                                                                               
                        </xsl:otherwise>
+                                                                               
                </xsl:choose>
+                                                                               
                <xsl:choose>
+                                                                               
                        <xsl:when test="operator = 'gt'">
+                                                                               
                                <option selected='true' 
value="gt"><xsl:text>Større enn</xsl:text></option>
+                                                                               
                        </xsl:when>
+                                                                               
                        <xsl:otherwise>
+                                                                               
                                <option value="gt"><xsl:text>Større 
enn</xsl:text></option>
+                                                                               
                        </xsl:otherwise>
+                                                                               
                </xsl:choose>
+                                                                               
                <xsl:choose>
+                                                                               
                        <xsl:when test="operator = 'btw'">
+                                                                               
                                <option selected='true' 
value="btw"><xsl:text>Mellom</xsl:text></option>
+                                                                               
                        </xsl:when>
+                                                                               
                        <xsl:otherwise>
+                                                                               
                                <option 
value="btw"><xsl:text>Mellom</xsl:text></option>
+                                                                               
                        </xsl:otherwise>
+                                                                               
                </xsl:choose>
                                                                                
        </select>
-                                                                               
        <input class="attrib_info" style="margin-left: 10px;" type='text' 
name="{column_name}" value='' />
+                                                                               
        
+                                                                               
        <xsl:choose>
+                                                                               
                <xsl:when test="operator = 'btw'">
+                                                                               
                        <xsl:variable name="lt-attrib-value"><xsl:value-of 
select="substring-after(attrib_value, ':')" /></xsl:variable>
+                                                                               
                        <input class="constraint_2" style="margin-left: 10px;" 
type='text' name="{cust_attribute/column_name}" value="{$lt-attrib-value}" />
+                                                                               
                </xsl:when>
+                                                                               
                <xsl:otherwise>
+                                                                               
                        <input class="attrib_info" style="margin-left: 10px;" 
type='text' name="{cust_attribute/column_name}" value="{attrib_value}" />
+                                                                               
                </xsl:otherwise>
+                                                                               
        </xsl:choose>
                                                                                
</xsl:when>
-                                                                               
<xsl:when test="column_info/type = 'LB'">
-                                                                               
                <label><xsl:value-of select="input_text"/></label>
+                                                                               
<xsl:when test="cust_attribute/column_info/type = 'LB'">
+                                                                               
                <label><xsl:value-of 
select="cust_attribute/input_text"/></label>
                                                                                
                <input class="operator" type='hidden' name="operator" 
value='eq' />
-                                                                               
                <select class="attrib_info" name="{column_name}">
-                                                                               
                        <xsl:for-each select="choice">
-                                                                               
                                <option value="{value}">
-                                                                               
                                        <xsl:value-of select="value"/>
-                                                                               
                                </option>
+                                                                               
                <select class="attrib_info" name="{cust_attribute/column_name}">
+                                                                               
                        <xsl:for-each select="cust_attribute/choice">
+                                                                               
                                <xsl:choose>
+                                                                               
                                        <xsl:when test="value = //attrib_value">
+                                                                               
                                                <option selected='true' 
value="{value}">
+                                                                               
                                                        <xsl:value-of 
select="value"/>
+                                                                               
                                                </option>
+                                                                               
                                        </xsl:when>
+                                                                               
                                        <xsl:otherwise>
+                                                                               
                                                <option value="{value}">
+                                                                               
                                                        <xsl:value-of 
select="value"/>
+                                                                               
                                                </option>
+                                                                               
                                        </xsl:otherwise>        
+                                                                               
                                </xsl:choose>
                                                                                
                        </xsl:for-each>
                                                                                
                </select>
                                                                                
</xsl:when>
                                                                        
</xsl:choose>
-                                                                       <input 
type="hidden" class="cust_attribute_id" name="cust_attribute_id" value="{id}" />
+                                                                       <input 
type="hidden" class="cust_attribute_id" name="cust_attribute_id" 
value="{cust_attribute/id}" />
                                                                        <input 
type="hidden" class="cust_attributes" name="cust_attributes[]" value="" />
-                                                                       </div>
-                                                               </xsl:for-each>
-                                                       </div>
-                                                       </dd>                   
                
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                               <dt>
-                                                       <label>Kriterier for 
behovet</label>
-                                               </dt>
-                                                       <dd>
-                                                       <div id="attributes">
-                                                               <xsl:for-each 
select="requirement_attributes_array">
-                                                                       <div 
class="attribute">
+                                                               </div>
+                                                       </xsl:for-each>
+                                               </div>
+                                               </dd>                           
        
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                       <dt>
+                                               <label>Kriterier for 
behovet</label>
+                                       </dt>
+                                               <dd>
+                                               <div id="attributes">
+                                                       <xsl:for-each 
select="requirement_attributes_array">
+                                                               <div 
class="attribute">
                                                                        <label 
style="margin-left:10px;"><xsl:value-of select="cust_attribute/input_text" 
/></label>
-                                                                               
<xsl:choose>
-                                                                               
        <xsl:when test="cust_attribute/column_info/type = 'T'">
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="cust_attribute/column_info/type = 'T'">
+                                                                               
        <span style="margin-left:10px;"><xsl:value-of select="attrib_value" 
/></span>
+                                                                               
</xsl:when>
+                                                                               
<xsl:when test="cust_attribute/column_info/type = 'V' or 
cust_attribute/column_info/type = 'I'">
+                                        
+                                                                               
                <xsl:if test="operator = 'btw'">
+                                                                               
                        <span style="margin-left:10px;"><xsl:value-of 
select="substring-before(attrib_value, ':')" /></span>
+                                                                               
                </xsl:if>
+                                                                               
+                                                                               
                <xsl:choose>
+                                                                               
                        <xsl:when test="operator = 'eq'">
+                                                                               
                                <span style="margin-left:10px;">Lik</span>
+                                                                               
                        </xsl:when>
+                                                                               
                        <xsl:when test="operator = 'gt'">
+                                                                               
                                <span style="margin-left:10px;">Større 
enn</span>
+                                                                               
                        </xsl:when>
+                                                                               
                        <xsl:when test="operator = 'lt'">
+                                                                               
                                <span style="margin-left:10px;">Mindre 
enn</span>
+                                                                               
                        </xsl:when>
+                                                                               
                        <xsl:when test="operator = 'btw'">
+                                                                               
                                <span style="margin-left:10px;">Mellom</span>
+                                                                               
                        </xsl:when>
+                                                                               
                </xsl:choose>
                                                                                
                
-                                                                               
                <span style="margin-left:10px;"><xsl:value-of select="value" 
/></span>
-                                                                               
        </xsl:when>
-                                                                               
        <xsl:when test="cust_attribute/column_info/type = 'V' or 
cust_attribute/column_info/type = 'I'">
-                                                                               
                        <xsl:choose>
-                                                                               
                                <xsl:when test="operator = 'eq'">
-                                                                               
                                        <span 
style="margin-left:10px;">lik</span>
-                                                                               
                                </xsl:when>
-                                                                               
                                <xsl:when test="operator = 'gt'">
-                                                                               
                                        <span style="margin-left:10px;">større 
enn</span>
-                                                                               
                                </xsl:when>
-                                                                               
                                <xsl:when test="operator = 'lt'">
-                                                                               
                                        <span style="margin-left:10px;">mindre 
enn</span>
-                                                                               
                                </xsl:when>
-                                                                               
                        </xsl:choose>
-                                                                               
                <span style="margin-left:10px;"><xsl:value-of select="value" 
/></span>
-                                                                               
        </xsl:when>
-                                                                               
        <xsl:when test="cust_attribute/column_info/type = 'LB'">
-                                                                               
                <span style="margin-left:10px;"><xsl:value-of select="value" 
/></span>
-                                                                               
        </xsl:when>
-                                                                               
</xsl:choose>
-                                                                       </div>
-                                                               </xsl:for-each>
-                                                       </div>
-                                                       </dd>   
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </dl>
-                               
-                               <div class="form-buttons">
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
-                                                       <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
-                                                       <input type="submit" 
name="save_requirement_values" value="{$lang_save}" title = "{$lang_save}" />
-                                                       <input type="submit" 
name="cancel_requirement_values" value="{$lang_cancel}" title = 
"{$lang_cancel}" />
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
-                                                       <input type="submit" 
name="edit_requirement_values" value="{$lang_edit}" title = "{$lang_edit}" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </div>
-                       </form>
-               </div>
+                                                                               
        <xsl:choose>
+                                                                               
                <xsl:when test="operator = 'btw'">
+                                                                               
                <span style="margin-left:10px;"><xsl:value-of 
select="substring-after(attrib_value, ':')" /></span>
+                                                                               
                </xsl:when>
+                                                                               
                <xsl:otherwise>
+                                                                               
                                <span style="margin-left:10px;"><xsl:value-of 
select="attrib_value" /></span>
+                                                                               
                </xsl:otherwise>
+                                                                               
        </xsl:choose>
+                                       
+                                                                               
</xsl:when>
+                                                                               
<xsl:when test="cust_attribute/column_info/type = 'LB'">
+                                                                               
        <span style="margin-left:10px;"><xsl:value-of select="attrib_value" 
/></span>
+                                                                               
</xsl:when>
+                                                                       
</xsl:choose>
+                                                               </div>
+                                                       </xsl:for-each>
+                                               </div>
+                                               </dd>   
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </dl>
+                       
+                       <div class="form-buttons">
+                               <xsl:choose>
+                                       <xsl:when test="editable">
+                                               <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
+                                               <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
+                                               <input type="submit" 
name="save_requirement_values" value="{$lang_save}" title = "{$lang_save}" />
+                                               <input type="submit" 
name="cancel_requirement_values" value="{$lang_cancel}" title = 
"{$lang_cancel}" />
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
+                                               <input type="submit" 
name="edit_requirement_values" value="{$lang_edit}" title = "{$lang_edit}" />
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </div>
+               </form>
        </div>
 </div>
 </xsl:template>




reply via email to

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