[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15781] logistic: start implement copy project
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15781] logistic: start implement copy project |
Date: |
Sun, 2 Oct 2016 17:40:34 +0000 (UTC) |
Revision: 15781
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15781
Author: sigurdne
Date: 2016-10-02 17:40:34 +0000 (Sun, 02 Oct 2016)
Log Message:
-----------
logistic: start implement copy project
Modified Paths:
--------------
trunk/logistic/inc/class.soproject.inc.php
trunk/logistic/inc/class.uiproject.inc.php
trunk/logistic/templates/base/project/project_item.xsl
Modified: trunk/logistic/inc/class.soproject.inc.php
===================================================================
--- trunk/logistic/inc/class.soproject.inc.php 2016-10-02 16:28:43 UTC (rev
15780)
+++ trunk/logistic/inc/class.soproject.inc.php 2016-10-02 17:40:34 UTC (rev
15781)
@@ -231,12 +231,16 @@
return $project;
}
+ public function copy_project_activities( $from, $to )
+ {
+ throw new Exception('Implement me');
+ }
public function get_projects()
{
$project_array = array();
$project_array[] = array(
'id' => '',
- 'name' => lang('all_types'),
+ 'name' => lang('select'),
'selected' => 1
);
$sql = "SELECT id, name FROM lg_project";
Modified: trunk/logistic/inc/class.uiproject.inc.php
===================================================================
--- trunk/logistic/inc/class.uiproject.inc.php 2016-10-02 16:28:43 UTC (rev
15780)
+++ trunk/logistic/inc/class.uiproject.inc.php 2016-10-02 17:40:34 UTC (rev
15781)
@@ -513,9 +513,11 @@
public function edit( $project = null )
{
$project_id = phpgw::get_var('id');
+ $activities = array();
if ($project_id && is_numeric($project_id))
{
$project = $this->so->get_single($project_id);
+ $activities =
createObject('logistic.soactivity')->get(0, 1, 'name', true, '', '',
array('project' => $project_id), true);
}
else
{
@@ -523,6 +525,10 @@
{
$project = new logistic_project();
}
+ else if($project->get_project_id())
+ {
+ $activities =
createObject('logistic.soactivity')->get(0, 1, 'name', true, '', '',
array('project' => $project->get_project_id()), true);
+ }
}
$project_types = $this->so->get_project_types();
@@ -534,10 +540,22 @@
}
}
+ $project_list = $this->so->get_projects();
+
+ foreach ($project_list as $key => $entry)
+ {
+ if($project_id && $entry['id'] == $project_id)
+ {
+ unset($project_list[$key]);
+ }
+ }
+
$data = array
(
'project' => $project,
'options' => $project_types,
+ 'project_list' => array('options' =>
$project_list),
+ 'activities' => !!$activities,
'editable' => true
);
@@ -570,6 +588,8 @@
if ($project->validate())
{
$project_id = $this->so->store($project);
+ $from_project_id =
phpgw::get_var('copy_project_activities', 'int');
+
$this->so->copy_project_activities($from_project_id,$project_id);
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiproject.view',
'id' => $project_id));
}
Modified: trunk/logistic/templates/base/project/project_item.xsl
===================================================================
--- trunk/logistic/templates/base/project/project_item.xsl 2016-10-02
16:28:43 UTC (rev 15780)
+++ trunk/logistic/templates/base/project/project_item.xsl 2016-10-02
17:40:34 UTC (rev 15781)
@@ -2,159 +2,236 @@
<!-- 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>
-<div>
- <xsl:choose>
- <xsl:when test="project/id != '' or project/id != 0">
- <h1>
- <xsl:value-of select="php:function('lang',
'Edit project')" />
- </h1>
- </xsl:when>
- <xsl:otherwise>
- <h1>
- <xsl:value-of select="php:function('lang', 'Add
project')" />
- </h1>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:variable name="date_format">
+ <xsl:value-of select="php:function('get_phpgw_info',
'user|preferences|common|dateformat')"/>
+ </xsl:variable>
+ <div>
+ <xsl:choose>
+ <xsl:when test="project/id != '' or project/id != 0">
+ <h1>
+ <xsl:value-of
select="php:function('lang', 'Edit project')" />
+ </h1>
+ </xsl:when>
+ <xsl:otherwise>
+ <h1>
+ <xsl:value-of
select="php:function('lang', 'Add project')" />
+ </h1>
+ </xsl:otherwise>
+ </xsl:choose>
- <div id="project_details" class="content-wrp">
- <div id="details">
- <xsl:variable name="action_url">
- <xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:logistic.uiproject.save')" />
- </xsl:variable>
- <form action="{$action_url}" method="post">
- <input type="hidden" name="id"
value="{project/id}">
- </input>
- <dl class="proplist-col">
- <dt>
- <label for="name"><xsl:value-of
select="php:function('lang','Project title')" /></label>
- </dt>
- <dd>
- <xsl:choose>
- <xsl:when test="editable">
- <xsl:if
test="project/error_msg_array/name != ''">
- <xsl:variable
name="error_msg"><xsl:value-of select="project/error_msg_array/name"
/></xsl:variable>
- <div
class='input_error_msg'><xsl:value-of select="php:function('lang', $error_msg)"
/></div>
- </xsl:if>
- <div
style="margin-left:0; margin-bottom: 3px;" class="help_text line"><xsl:value-of
select="php:function('lang','Give project name')" /></div>
- <input type="text"
name="name" id="name" value="{project/name}" size="100"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
select="project/name" />
- </xsl:otherwise>
- </xsl:choose>
- </dd>
- <dt>
- <label
for="project_type"><xsl:value-of select="php:function('lang','Project_type')"
/></label>
- </dt>
- <dd>
- <xsl:choose>
- <xsl:when test="editable">
- <xsl:if
test="project/error_msg_array/project_type_id != ''">
- <xsl:variable
name="error_msg"><xsl:value-of select="project/error_msg_array/project_type_id"
/></xsl:variable>
- <div
class='input_error_msg'><xsl:value-of select="php:function('lang', $error_msg)"
/></div>
- </xsl:if>
- <div
style="margin-left:0; margin-bottom: 3px;" class="help_text line"><xsl:value-of
select="php:function('lang','Give project type')" /></div>
- <select
id="project_type_id" name="project_type_id">
-
<xsl:apply-templates select="options"/>
- </select>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
select="project/project_type_label" />
- </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="project/error_msg_array/description != ''">
- <xsl:variable
name="error_msg"><xsl:value-of select="project/error_msg_array/description"
/></xsl:variable>
- <div
class='input_error_msg'><xsl:value-of select="php:function('lang', $error_msg)"
/></div>
- </xsl:if>
- <div
style="margin-left:0; margin-bottom: 3px;" class="help_text line"><xsl:value-of
select="php:function('lang','Give description to the project')" /></div>
- <textarea
id="description" name="description" rows="5" cols="60"><xsl:value-of
select="project/description" disable-output-escaping="yes"/></textarea>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
select="project/description" disable-output-escaping="yes"/>
- </xsl:otherwise>
- </xsl:choose>
- </dd>
- <dt>
- <label
for="start_date"><xsl:value-of select="php:function('lang','Start date')"
/></label>
- </dt>
- <dd>
+ <div id="project_details" class="content-wrp">
+ <div id="details">
+ <xsl:variable name="action_url">
+ <xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:logistic.uiproject.save')" />
+ </xsl:variable>
+ <form action="{$action_url}" method="post">
+ <input type="hidden" name="id"
value="{project/id}">
+ </input>
+ <dl class="proplist-col">
+ <dt>
+ <label for="name">
+ <xsl:value-of
select="php:function('lang','Project title')" />
+ </label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when
test="editable">
+ <xsl:if
test="project/error_msg_array/name != ''">
+
<xsl:variable name="error_msg">
+
<xsl:value-of select="project/error_msg_array/name" />
+
</xsl:variable>
+
<div class='input_error_msg'>
+
<xsl:value-of select="php:function('lang', $error_msg)" />
+
</div>
+
</xsl:if>
+ <div
style="margin-left:0; margin-bottom: 3px;" class="help_text line">
+
<xsl:value-of select="php:function('lang','Give project name')" />
+ </div>
+ <input
type="text" name="name" id="name" value="{project/name}" size="100"/>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:value-of select="project/name" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <dt>
+ <label
for="project_type">
+ <xsl:value-of
select="php:function('lang','Project_type')" />
+ </label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when
test="editable">
+ <xsl:if
test="project/error_msg_array/project_type_id != ''">
+
<xsl:variable name="error_msg">
+
<xsl:value-of select="project/error_msg_array/project_type_id" />
+
</xsl:variable>
+
<div class='input_error_msg'>
+
<xsl:value-of select="php:function('lang', $error_msg)" />
+
</div>
+
</xsl:if>
+ <div
style="margin-left:0; margin-bottom: 3px;" class="help_text line">
+
<xsl:value-of select="php:function('lang','Give project type')" />
+ </div>
+ <select
id="project_type_id" name="project_type_id">
+
<xsl:apply-templates select="options"/>
+
</select>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:value-of select="project/project_type_label" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <dt>
+ <label
for="copy_project_activities">
+ <xsl:value-of
select="php:function('lang','Copy activities from')" />
+ </label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when
test="editable = '1' and activities !='1' ">
+ <select
id="copy_project_activities" name="copy_project_activities">
+
<xsl:apply-templates select="project_list/options"/>
+
</select>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:value-of select="php:function('lang','not empty')" />
+ </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="project/error_msg_array/description != ''">
+
<xsl:variable name="error_msg">
+
<xsl:value-of select="project/error_msg_array/description" />
+
</xsl:variable>
+
<div class='input_error_msg'>
+
<xsl:value-of select="php:function('lang', $error_msg)" />
+
</div>
+
</xsl:if>
+ <div
style="margin-left:0; margin-bottom: 3px;" class="help_text line">
+
<xsl:value-of select="php:function('lang','Give description to the project')" />
+ </div>
+
<textarea id="description" name="description" rows="5" cols="60">
+
<xsl:value-of select="project/description" disable-output-escaping="yes"/>
+
</textarea>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:value-of select="project/description" disable-output-escaping="yes"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <dt>
+ <label for="start_date">
+ <xsl:value-of
select="php:function('lang','Start date')" />
+ </label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when
test="editable">
+ <xsl:if
test="project/error_msg_array/start_date != ''">
+
<xsl:variable name="error_msg">
+
<xsl:value-of select="project/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="project/start_date != ''">
+
<xsl:attribute name="value">
+
<xsl:value-of select="php:function('date', $date_format,
number(project/start_date))"/>
+
</xsl:attribute>
+
</xsl:if>
+ </input>
+ <span
class="help_text line">
+
<xsl:value-of select="php:function('lang','Give start date to project')" />
+ </span>
+ </xsl:when>
+ <xsl:otherwise>
+ <span>
+
<xsl:value-of select="php:function('date', $date_format,
number(project/start_date))"/>
+ </span>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <dt>
+ <label for="end_date">
+ <xsl:value-of
select="php:function('lang','End date')" />
+ </label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when
test="editable">
+ <xsl:if
test="project/error_msg_array/end_date != ''">
+
<xsl:variable name="error_msg">
+
<xsl:value-of select="project/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="project/end_date != ''">
+
<xsl:attribute name="value">
+
<xsl:value-of select="php:function('date', $date_format,
number(project/end_date))"/>
+
</xsl:attribute>
+
</xsl:if>
+ </input>
+ <span
class="help_text line">
+
<xsl:value-of select="php:function('lang','Give end date to project')" />
+ </span>
+ </xsl:when>
+ <xsl:otherwise>
+ <span>
+
<xsl:value-of select="php:function('date', $date_format,
number(project/end_date))"/>
+ </span>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ </dl>
+
+ <div class="form-buttons">
<xsl:choose>
<xsl:when
test="editable">
- <xsl:if
test="project/error_msg_array/start_date != ''">
-
<xsl:variable name="error_msg"><xsl:value-of
select="project/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="project/start_date != ''">
- <xsl:attribute
name="value"><xsl:value-of select="php:function('date', $date_format,
number(project/start_date))"/></xsl:attribute>
- </xsl:if>
- </input>
- <span class="help_text
line"><xsl:value-of select="php:function('lang','Give start date to project')"
/></span>
+ <xsl:variable
name="lang_save">
+
<xsl:value-of select="php:function('lang', 'save')" />
+ </xsl:variable>
+ <input
type="submit" name="save_project" value="{$lang_save}" title = "{$lang_save}" />
+
+ <xsl:variable
name="view_projects_url">
+
<xsl:value-of select="php:function('get_phpgw_link', '/index.php',
'menuaction:logistic.uiproject.index' )" />
+ </xsl:variable>
+ <a class="btn"
href="{$view_projects_url}">
+
<xsl:value-of select="php:function('lang', 'Cancel')" />
+ </a>
</xsl:when>
<xsl:otherwise>
- <span><xsl:value-of
select="php:function('date', $date_format, number(project/start_date))"/></span>
+ <xsl:variable
name="lang_edit">
+
<xsl:value-of select="php:function('lang', 'edit')" />
+ </xsl:variable>
+ <input
type="submit" name="edit_project" value="{$lang_edit}" title = "{$lang_edit}" />
+
+ <xsl:variable
name="view_projects_url_2">
+
<xsl:value-of select="php:function('get_phpgw_link', '/index.php',
'menuaction:logistic.uiproject.index' )" />
+ </xsl:variable>
+ <a class="btn"
href="{$view_projects_url_2}">
+
<xsl:value-of select="php:function('lang','Show project overview')" />
+ </a>
</xsl:otherwise>
</xsl:choose>
- </dd>
- <dt>
- <label
for="end_date"><xsl:value-of select="php:function('lang','End date')" /></label>
- </dt>
- <dd>
- <xsl:choose>
- <xsl:when
test="editable">
- <xsl:if
test="project/error_msg_array/end_date != ''">
-
<xsl:variable name="error_msg"><xsl:value-of
select="project/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="project/end_date != ''">
- <xsl:attribute
name="value"><xsl:value-of select="php:function('date', $date_format,
number(project/end_date))"/></xsl:attribute>
- </xsl:if>
- </input>
- <span class="help_text
line"><xsl:value-of select="php:function('lang','Give end date to project')"
/></span>
- </xsl:when>
- <xsl:otherwise>
- <span><xsl:value-of
select="php:function('date', $date_format, number(project/end_date))"/></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>
- <input type="submit"
name="save_project" value="{$lang_save}" title = "{$lang_save}" />
-
- <xsl:variable
name="view_projects_url">
- <xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:logistic.uiproject.index' )" />
- </xsl:variable>
- <a class="btn"
href="{$view_projects_url}"><xsl:value-of select="php:function('lang',
'Cancel')" /></a>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')"
/></xsl:variable>
- <input type="submit"
name="edit_project" value="{$lang_edit}" title = "{$lang_edit}" />
-
- <xsl:variable
name="view_projects_url_2">
- <xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:logistic.uiproject.index' )" />
- </xsl:variable>
- <a class="btn"
href="{$view_projects_url_2}"><xsl:value-of select="php:function('lang','Show
project overview')" /></a>
- </xsl:otherwise>
- </xsl:choose>
- </div>
- </form>
+ </div>
+ </form>
+ </div>
</div>
</div>
-</div>
-<xsl:call-template name="jquery_phpgw_i18n"/>
+ <xsl:call-template name="jquery_phpgw_i18n"/>
</xsl:template>
<xsl:template match="options">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15781] logistic: start implement copy project,
sigurdne <=