[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10357] custom fields
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10357] custom fields |
Date: |
Fri, 26 Oct 2012 12:06:36 +0000 |
Revision: 10357
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10357
Author: sigurdne
Date: 2012-10-26 12:06:36 +0000 (Fri, 26 Oct 2012)
Log Message:
-----------
custom fields
Modified Paths:
--------------
trunk/phpgwapi/inc/class.custom_fields.inc.php
trunk/property/inc/class.boadmin_entity.inc.php
trunk/property/inc/class.soadmin_entity.inc.php
trunk/property/inc/class.uiadmin_entity.inc.php
trunk/property/templates/base/admin_entity.xsl
Modified: trunk/phpgwapi/inc/class.custom_fields.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.custom_fields.inc.php 2012-10-26 11:19:17 UTC
(rev 10356)
+++ trunk/phpgwapi/inc/class.custom_fields.inc.php 2012-10-26 12:06:36 UTC
(rev 10357)
@@ -172,10 +172,11 @@
(
'location_id' => $location_id,
'id' => 0,
- 'name' =>
$this->_db->db_addslashes(strtolower($group['group_name'])),
- 'descr' =>
$this->_db->db_addslashes($group['descr']),
- 'remark' =>
$this->_db->db_addslashes($group['remark']),
+ 'name' =>
$this->_db->db_addslashes(strtolower($group['group_name'])),
+ 'descr' =>
$this->_db->db_addslashes($group['descr']),
+ 'remark' =>
$this->_db->db_addslashes($group['remark']),
'group_sort' => 0,
+ 'parent_id' => $group['parent_id']
);
@@ -625,7 +626,8 @@
(
'name' =>
$this->_db->db_addslashes($group['group_name']),
'descr' =>
$this->_db->db_addslashes($group['descr']),
- 'remark' =>
$this->_db->db_addslashes($group['remark'])
+ 'remark' =>
$this->_db->db_addslashes($group['remark']),
+ 'parent_id' => $group['parent_id']
);
$value_set =
$this->_db->validate_update($value_set);
@@ -1172,7 +1174,8 @@
'group_sort' => (int)
$this->_db->f('group_sort'),
'name' =>
$this->_db->f('name', true),
'descr' =>
$this->_db->f('descr', true),
- 'remark' =>
$this->_db->f('remark', true)
+ 'remark' =>
$this->_db->f('remark', true),
+ 'parent_id' =>
$this->_db->f('parent_id'),
);
}
@@ -1208,7 +1211,8 @@
'group_name' => $this->_db->f('name', true),
'descr' =>
$this->_db->f('descr', true),
'remark' =>
$this->_db->f('remark', true),
- 'group_sort' => $this->_db->f('group_sort')
+ 'group_sort' => $this->_db->f('group_sort'),
+ 'parent_id' =>
$this->_db->f('parent_id'),
);
return $group;
Modified: trunk/property/inc/class.boadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.boadmin_entity.inc.php 2012-10-26 11:19:17 UTC
(rev 10356)
+++ trunk/property/inc/class.boadmin_entity.inc.php 2012-10-26 12:06:36 UTC
(rev 10357)
@@ -598,14 +598,14 @@
return $this->so->get_path( $entity_id, $node );
}
- function read_category_tree2( $entity_id )
+ function read_category_tree2( $entity_id, $table )
{
- return $this->so->read_category_tree2( $entity_id );
+ return $this->so->read_category_tree2( $entity_id,
$table );
}
- function get_children2( $entity_id, $parent, $level, $reset =
false )
+ function get_children2( $entity_id, $parent, $level, $reset =
false, $table )
{
- return $this->so->get_children2( $entity_id, $parent,
$level, $reset );
+ return $this->so->get_children2( $entity_id, $parent,
$level, $reset, $table );
}
function convert_to_eav()
Modified: trunk/property/inc/class.soadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.soadmin_entity.inc.php 2012-10-26 11:19:17 UTC
(rev 10356)
+++ trunk/property/inc/class.soadmin_entity.inc.php 2012-10-26 12:06:36 UTC
(rev 10357)
@@ -209,15 +209,25 @@
}
- function get_children2($entity_id, $parent, $level, $reset =
false)
+ function get_children2($entity_id, $parent, $level, $reset =
false, $table)
{
if($reset)
{
$this->category_tree = array();
}
+
+ if(!$table)
+ {
+ $table = "fm_{$this->type}_category";
+ $filtermethod = 'WHERE entity_id =' . (int)$id;
+ }
+ else
+ {
+ $filtermethod = 'WHERE location_id =' .
(int)$id;
+ }
+
$db = clone($this->db);
- $table = "fm_{$this->type}_category";
- $sql = "SELECT * FROM {$table} WHERE entity_id =
{$entity_id} AND parent_id = {$parent} ORDER BY name ASC";
+ $sql = "SELECT * FROM {$table} $filtermethod AND
parent_id = {$parent} ORDER BY name ASC";
$db->query($sql,__LINE__,__FILE__);
while ($db->next_record())
@@ -234,11 +244,19 @@
return $this->category_tree;
}
- public function read_category_tree2($entity_id)
+ public function read_category_tree2($id, $table = '')
{
- $table = "fm_{$this->type}_category";
+ if(!$table)
+ {
+ $table = "fm_{$this->type}_category";
+ $filtermethod = 'WHERE entity_id =' . (int)$id;
+ }
+ else
+ {
+ $filtermethod = 'WHERE location_id =' .
(int)$id;
+ }
- $sql = "SELECT * FROM $table WHERE entity_id=$entity_id
AND (parent_id = 0 OR parent_id IS NULL) ORDER BY name ASC";
+ $sql = "SELECT * FROM $table $filtermethod AND
(parent_id = 0 OR parent_id IS NULL) ORDER BY name ASC";
$this->db->query($sql,__LINE__,__FILE__);
@@ -261,7 +279,7 @@
'id' => $category['id'],
'name' => $category['name']
);
- $this->get_children2($entity_id,
$category['id'], 1);
+ $this->get_children2($id, $category['id'], 1,
false, $table);
}
return $this->category_tree;
}
Modified: trunk/property/inc/class.uiadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.uiadmin_entity.inc.php 2012-10-26 11:19:17 UTC
(rev 10356)
+++ trunk/property/inc/class.uiadmin_entity.inc.php 2012-10-26 12:06:36 UTC
(rev 10357)
@@ -1447,16 +1447,18 @@
$attrib_list =
$this->bo->read_attrib_group($entity_id,$cat_id);
$uicols['name'][0] = 'id';
$uicols['descr'][0] = lang('id');
- $uicols['name'][1] = 'name';
- $uicols['descr'][1] = lang('Name');
- $uicols['name'][2] = 'descr';
- $uicols['descr'][2] = lang('Descr');
- $uicols['name'][3] = 'group_sort';
- $uicols['descr'][3] = lang('sorting');
- $uicols['name'][4] = 'up';
- $uicols['descr'][4] = lang('up');
- $uicols['name'][5] = 'down';
- $uicols['descr'][5] = lang('down');
+ $uicols['name'][1] = 'parent_id';
+ $uicols['descr'][1] = lang('parent');
+ $uicols['name'][2] = 'name';
+ $uicols['descr'][2] = lang('Name');
+ $uicols['name'][3] = 'descr';
+ $uicols['descr'][3] = lang('Descr');
+ $uicols['name'][4] = 'group_sort';
+ $uicols['descr'][4] = lang('sorting');
+ $uicols['name'][5] = 'up';
+ $uicols['descr'][5] = lang('up');
+ $uicols['name'][6] = 'down';
+ $uicols['descr'][6] = lang('down');
$j = 0;
$count_uicols_name = count($uicols['name']);
@@ -2192,6 +2194,30 @@
$action='add';
}
+
+ $location_id =
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type],
".{$this->type}.{$entity_id}.{$cat_id}");
+ $parent_list =
$this->bocommon->select_list($values['parent_id'],
$this->bo->read_category_tree2($location_id, 'phpgw_cust_attribute_group'));
+
+ if($id)
+ {
+ $exclude = array($id);
+ $children =
$this->bo->get_children2($location_id, $id, 0,true,
'phpgw_cust_attribute_group');
+
+ foreach($children as $child)
+ {
+ $exclude[] = $child['id'];
+ }
+
+ $k = count($parent_list);
+ for ($i=0; $i<$k; $i++)
+ {
+ if
(in_array($parent_list[$i]['id'],$exclude))
+ {
+ unset($parent_list[$i]);
+ }
+ }
+ }
+
$link_data = array
(
'menuaction' =>
'property.uiadmin_entity.edit_attrib_group',
@@ -2237,7 +2263,8 @@
'value_remark'
=> $values['remark'],
'lang_done_attribtext'
=> lang('Back to the list'),
- 'lang_save_attribtext'
=> lang('Save the attribute')
+ 'lang_save_attribtext'
=> lang('Save the attribute'),
+ 'parent_list'
=> $parent_list
);
//_debug_array($values);
Modified: trunk/property/templates/base/admin_entity.xsl
===================================================================
--- trunk/property/templates/base/admin_entity.xsl 2012-10-26 11:19:17 UTC
(rev 10356)
+++ trunk/property/templates/base/admin_entity.xsl 2012-10-26 12:06:36 UTC
(rev 10357)
@@ -1225,7 +1225,7 @@
</xsl:template>
<!-- add attribute group / edit attribute group -->
- <xsl:template match="edit_attrib_group">
+ <xsl:template match="edit_attrib_group" xmlns:php="http://php.net/xsl">
<div align="left">
<table cellpadding="2" cellspacing="2" width="80%"
align="center">
<xsl:choose>
@@ -1269,6 +1269,24 @@
</tr>
</xsl:when>
</xsl:choose>
+ <xsl:choose>
+ <xsl:when test="parent_list !=
''">
+ <tr>
+ <td>
+
<xsl:value-of select="php:function('lang', 'parent')"/>
+ </td>
+ <td
valign="top">
+ <select
id="parent_id" name="values[parent_id]">
+
<option value="">
+
<xsl:value-of select="php:function('lang', 'select parent')"/>
+
</option>
+
<xsl:apply-templates select="parent_list"/>
+
</select>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
<tr>
<td valign="top">
<xsl:value-of
select="lang_group_name"/>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10357] custom fields,
Sigurd Nes <=