fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10376]


From: Torstein
Subject: [Fmsystem-commits] [10376]
Date: Tue, 30 Oct 2012 07:59:09 +0000

Revision: 10376
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10376
Author:   vator
Date:     2012-10-30 07:59:09 +0000 (Tue, 30 Oct 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/logistic/inc/class.uiactivity.inc.php

Added Paths:
-----------
    trunk/logistic/templates/base/activity/activity_item_2.xsl

Modified: trunk/logistic/inc/class.uiactivity.inc.php
===================================================================
--- trunk/logistic/inc/class.uiactivity.inc.php 2012-10-30 07:58:54 UTC (rev 
10375)
+++ trunk/logistic/inc/class.uiactivity.inc.php 2012-10-30 07:59:09 UTC (rev 
10376)
@@ -224,20 +224,22 @@
                        {
                                $user_rows_per_page = 10;
                        }
+                       
                        // YUI variables for paging and sorting
                        $start_index = phpgw::get_var('startIndex', 'int');
                        $num_of_objects = phpgw::get_var('results', 'int', 
'GET', $user_rows_per_page);
                        $sort_field = phpgw::get_var('sort');
                        $sort_ascending = phpgw::get_var('dir') == 'desc' ? 
false : true;
+                       
                        // Form variables
                        $search_for = phpgw::get_var('query');
                        $search_type = phpgw::get_var('search_option');
+                       
                        // Create an empty result set
                        $result_objects = array();
                        $result_count = 0;
 
                        //Retrieve a contract identifier and load corresponding 
contract
-
                        $exp_param = phpgw::get_var('export');
                        $export = false;
                        if (isset($exp_param))
@@ -248,7 +250,7 @@
 
                        //Retrieve the type of query and perform type specific 
logic
                        $query_type = phpgw::get_var('type');
-                       //var_dump($query_type);
+
                        switch ($query_type)
                        {
                                default: // ... all activities, filters (active 
and vacant)
@@ -361,6 +363,33 @@
                public function view()
                {
                        $activity_id = phpgw::get_var('id');
+
+                       if ($activity_id && is_numeric($activity_id))
+                       {
+                               $activity = $this->so->get_single( $activity_id 
);
+                               
+                               $responsible_user = 
$this->so->get_responsible_user( $activity->get_responsible_user_id() );
+
+                               $activity->set_responsible_user_name( 
$responsible_user );
+                       }
+
+                       $data = array
+                       (
+                               'activity' => $activity
+                       );
+
+                       if($activity->get_parent_id() > 0)
+                       {
+                               $parent_activity = 
$this->so->get_single($activity->get_parent_id());
+                               $data['parent_activity'] = $parent_activity;
+                       }
+                       
+                       
self::render_template_xsl(array('activity/activity_item'), $data);
+               }
+               
+               public function view_2()
+               {
+                       $activity_id = phpgw::get_var('id');
                        $project_id = phpgw::get_var('project_id');
                        if (isset($_POST['edit_activity']))
                        {
@@ -400,8 +429,12 @@
                                        $data['parent_activity'] = 
$parent_activity->toArray();
                                }
                                
+                               echo $activity->get_id();
+                               
+                               $activity_children = 
$this->so->get($activity->get_id());
+                               
                                $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('logistic') . '::' . lang('Project');
-                               
self::render_template_xsl(array('activity/activity_item'), $data);
+                               
self::render_template_xsl(array('activity/activity_item_2'), $data);
                        }
                }
                

Added: trunk/logistic/templates/base/activity/activity_item_2.xsl
===================================================================
--- trunk/logistic/templates/base/activity/activity_item_2.xsl                  
        (rev 0)
+++ trunk/logistic/templates/base/activity/activity_item_2.xsl  2012-10-30 
07:59:09 UTC (rev 10376)
@@ -0,0 +1,209 @@
+<!-- $Id: activity_item.xsl 10305 2012-10-23 09:08:34Z vator $ -->
+<!-- item  -->
+
+<xsl:template match="data" 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>
+
+<xsl:call-template name="yui_phpgw_i18n"/>
+<div class="yui-navset yui-navset-top">
+               
+       <xsl:choose>
+               <xsl:when test="parent_activity/id &gt; 0">
+                       <h1> 
+                               <xsl:value-of select="parent_activity/name" 
disable-output-escaping="yes"/>::<xsl:value-of select="php:function('lang', 
'Add sub activity')" />
+                       </h1>
+               </xsl:when>
+               <xsl:otherwise>
+                       <h1> 
+                               <xsl:value-of select="php:function('lang', 'Add 
activity')" />
+                       </h1>
+               </xsl:otherwise>
+       </xsl:choose>
+       
+       <div class="content-wrp">
+               <div id="details">
+                       <xsl:variable name="action_url">
+                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:logistic.uiactivity.save')" />
+                       </xsl:variable>
+                       <form action="{$action_url}" method="post">
+                               <input type="hidden" name="id" value = 
"{activity/id}" />
+                               <input type="hidden" name="project_id" 
value="{activity/project_id}" />
+                               <input type="hidden" name="parent_id" 
value="{parent_activity/id}" />
+                               
+                               <dl class="proplist-col">
+                                       <xsl:if test="parent_activity/id &gt; 
0">
+                                       <dt>            
+                                               <xsl:if test="editable">
+                                                       <div 
style="margin-bottom: 1em;width: 88%;" class="select-box">
+                                                               <label>Velg en 
annen hovedaktivitet</label>
+                                                               <select 
id="select_activity" name="parent_activity_id" class="selectLocation">
+                                                                       
<option>Velg aktivitet</option>
+                                                                       
<xsl:for-each select="activities">
+                                                       <option value="{id}">
+                                                               <xsl:if 
test="activity/parent_id = id">
+                                                                       
<xsl:attribute name="selected">
+                                                                               
        selected
+                                                                               
        </xsl:attribute>
+                                                               </xsl:if>
+                                                       <xsl:value-of 
disable-output-escaping="yes" select="name"/>
+                                                       </option>
+                                                                 
</xsl:for-each>
+                                                               </select>       
                                
+                                                       </div>
+                                                       </xsl:if>
+                                               </dt>
+                                       </xsl:if>       
+                                       <dt>
+                                               <label for="name"><xsl:value-of 
select="php:function('lang','Activity name')" /></label>
+                                       </dt>
+                                       <dd>
+                                       <xsl:choose>
+                                               <xsl:when test="editable">
+                                                       <xsl:if 
test="activity/error_msg_array/name != ''">
+                                                               <xsl:variable 
name="error_msg"><xsl:value-of select="activity/error_msg_array/name" 
/></xsl:variable>
+                                                               <div 
class='input_error_msg'><xsl:value-of select="php:function('lang', $error_msg)" 
/></div>
+                                                       </xsl:if>
+                                                       <input type="text" 
name="name" id="name" value="{activity/name}" size="100"/>
+                                                       <span class="help_text 
line">Angi startdato for aktiviteten</span>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of 
select="activity/name" />
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                                       </dd>
+                                       <dt>
+                                               <label 
for="description"><xsl:value-of select="php:function('lang', 'Description')" 
/></label>
+                                       </dt>
+                                       <dd>
+                                       <xsl:choose>
+                                               <xsl:when test="editable">
+                                                       <xsl:if 
test="activity/error_msg_array/description != ''">
+                                                               <xsl:variable 
name="error_msg"><xsl:value-of select="activity/error_msg_array/description" 
/></xsl:variable>
+                                                               <div 
class='input_error_msg'><xsl:value-of select="php:function('lang', $error_msg)" 
/></div>
+                                                       </xsl:if>
+                                                       <textarea 
id="description" name="description" rows="5" cols="60"><xsl:value-of 
select="activity/description" disable-output-escaping="yes"/></textarea>
+                                                       <span class="help_text 
line">Angi startdato for aktiviteten</span>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of 
select="activity/description" disable-output-escaping="yes"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                                       </dd>
+                                       <dt>
+                                               <label 
for="start_date">Startdato</label>
+                                       </dt>
+                                       <dd>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <xsl:if 
test="activity/error_msg_array/start_date != ''">
+                                                                       
<xsl:variable name="error_msg"><xsl:value-of 
select="activity/error_msg_array/start_date" /></xsl:variable>
+                                                                       <div 
class='input_error_msg'><xsl:value-of select="php:function('lang', $error_msg)" 
/></div>
+                                                               </xsl:if>
+                                                               <input 
class="date" id="start_date" name="start_date" type="text">
+                                                       <xsl:if 
test="activity/start_date != ''">
+                                                       <xsl:attribute 
name="value"><xsl:value-of select="php:function('date', $date_format, 
number(activity/start_date))"/></xsl:attribute>
+                                                       </xsl:if>
+                                               </input>
+                                               <span class="help_text 
line">Angi startdato for aktiviteten</span>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                       <span><xsl:value-of 
select="php:function('date', $date_format, 
number(activity/start_date))"/></span>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                       </dd>
+                                       <dt>
+                                               <label 
for="end_date">Sluttdato</label>
+                                       </dt>
+                                       <dd>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <xsl:if 
test="activity/error_msg_array/end_date != ''">
+                                                                       
<xsl:variable name="error_msg"><xsl:value-of 
select="activity/error_msg_array/end_date" /></xsl:variable>
+                                                                       <div 
class='input_error_msg'><xsl:value-of select="php:function('lang', $error_msg)" 
/></div>
+                                                               </xsl:if>
+                                                               <input 
class="date" id="end_date" name="end_date" type="text">
+                                                       <xsl:if 
test="activity/end_date != ''">
+                                                       <xsl:attribute 
name="value"><xsl:value-of select="php:function('date', $date_format, 
number(activity/end_date))"/></xsl:attribute>
+                                                       </xsl:if>
+                                               </input>
+                                               <span class="help_text 
line">Angi startdato for aktiviteten</span>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                       <span><xsl:value-of 
select="php:function('date', $date_format, number(activity/end_date))"/></span>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                       </dd>
+                                       <dt>
+                                               <label 
for="end_date">Ansvarlig</label>
+                                       </dt>
+                                       <dd>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <xsl:if 
test="activity/error_msg_array/responsible_user_id != ''">
+                                                                       
<xsl:variable name="error_msg"><xsl:value-of 
select="activity/error_msg_array/responsible_user_id" /></xsl:variable>
+                                                                       <div 
class='input_error_msg'><xsl:value-of select="php:function('lang', $error_msg)" 
/></div>
+                                                               </xsl:if>
+                                                               <select 
name="responsible_user_id">
+                                                                       <option 
value="">Velg ansvarlig bruker</option>
+                                               <xsl:for-each 
select="responsible_users">
+                                                       <xsl:variable 
name="full_name">
+                                                               <xsl:value-of 
disable-output-escaping="yes" select="account_firstname"/><xsl:text> </xsl:text>
+                                                               <xsl:value-of 
disable-output-escaping="yes" select="account_lastname"/>
+                                                       </xsl:variable>
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="//activity/responsible_user_id = account_id">
+                                                                               
                <option selected="selected" value="{account_id}">
+                                                                               
<xsl:value-of disable-output-escaping="yes" select="$full_name"/>
+                                                                       
</option>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       <option 
value="{account_id}">
+                                                                               
<xsl:value-of disable-output-escaping="yes" select="$full_name"/>
+                                                                       
</option>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+                                               </xsl:for-each>
+                                             </select>
+                                             <span class="help_text line">Angi 
startdato for aktiviteten</span>
+                                             </xsl:when>
+                                                       <xsl:otherwise>
+                                                       <span><xsl:value-of 
select="activity/responsible_user_name"/></span>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                       </dd>
+                               </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_activity" value="{$lang_save}" title = "{$lang_save}" />
+                                                       <input type="submit" 
name="cancel_activity" value="{$lang_cancel}" title = "{$lang_cancel}" />
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:variable 
name="params">
+                                                               
<xsl:text>menuaction:logistic.uiactivity.edit, id:</xsl:text>
+                                                               <xsl:value-of 
select="activity/id" />
+                                                       </xsl:variable>
+                                                       <xsl:variable 
name="edit_url">
+                                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', $params )" />
+                                                       </xsl:variable>
+                                                       <a class="btn" 
href="{$edit_url}"><xsl:value-of select="php:function('lang', 'edit')" /></a>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </div>
+                       </form>
+               </div>
+       </div>
+</div>
+</xsl:template>
+
+<xsl:template match="options">
+       <option value="{id}">
+               <xsl:if test="selected">
+                       <xsl:attribute name="selected" value="selected" />
+               </xsl:if>
+               <xsl:value-of disable-output-escaping="yes" select="name"/>
+       </option>
+</xsl:template>


Property changes on: trunk/logistic/templates/base/activity/activity_item_2.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain




reply via email to

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