[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8913] bugfix after testing
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [8913] bugfix after testing |
Date: |
Fri, 17 Feb 2012 10:14:42 +0000 |
Revision: 8913
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8913
Author: erikhl
Date: 2012-02-17 10:14:42 +0000 (Fri, 17 Feb 2012)
Log Message:
-----------
bugfix after testing
Modified Paths:
--------------
trunk/controller/inc/class.socontrol_group.inc.php
trunk/controller/inc/class.soprocedure.inc.php
trunk/controller/inc/class.uicontrol_group.inc.php
trunk/controller/inc/class.uicontrol_item.inc.php
trunk/controller/js/controller/ajax.js
trunk/controller/templates/base/control_group/control_group.xsl
trunk/controller/templates/base/control_item/control_item.xsl
Modified: trunk/controller/inc/class.socontrol_group.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_group.inc.php 2012-02-17 09:58:39 UTC
(rev 8912)
+++ trunk/controller/inc/class.socontrol_group.inc.php 2012-02-17 10:14:42 UTC
(rev 8913)
@@ -379,6 +379,27 @@
}
}
+ function get_control_areas_by_control_group($control_group_id)
+ {
+ $sql = "SELECT control_area_id FROM
controller_control_group WHERE control_group_id=$control_group_id";
+ $this->db->query($sql);
+
+ while($this->db->next_record()) {
+ $control_area =
$this->unmarshal($this->db->f('control_area_id'), 'int');
+ $category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', 'int')));
+
+ $control_area_array[] = array($control_area =>
$category[0]['name']);
+ }
+
+ if( count( $control_area_array ) > 0 ){
+ return $control_area_array;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
public function get_control_group_component($noOfObjects =
null, $bim_type = null)
{
$filters = array();
@@ -448,4 +469,16 @@
return $results;
}
+
+ function get_all_control_groups_array()
+ {
+ $results = array();
+ $this->db->query("SELECT id, group_name FROM
controller_control_group ORDER BY group_name ASC", __LINE__, __FILE__);
+ while ($this->db->next_record())
+ {
+ $results[] = array('id' =>
$this->db->f('id', false),
+
'group_name' => $this->db->f('group_name', false));
+ }
+ return $results;
+ }
}
Modified: trunk/controller/inc/class.soprocedure.inc.php
===================================================================
--- trunk/controller/inc/class.soprocedure.inc.php 2012-02-17 09:58:39 UTC
(rev 8912)
+++ trunk/controller/inc/class.soprocedure.inc.php 2012-02-17 10:14:42 UTC
(rev 8913)
@@ -255,7 +255,7 @@
{
$results = array();
- $sql = "SELECT * FROM controller_procedure WHERE
control_area_id=$control_area_id";
+ $sql = "SELECT * FROM controller_procedure WHERE
control_area_id={$control_area_id} AND end_date IS NULL ORDER BY title ASC";
$this->db->query($sql);
while($this->db->next_record()) {
Modified: trunk/controller/inc/class.uicontrol_group.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_group.inc.php 2012-02-17 09:58:39 UTC
(rev 8912)
+++ trunk/controller/inc/class.uicontrol_group.inc.php 2012-02-17 10:14:42 UTC
(rev 8913)
@@ -100,32 +100,6 @@
'form' => array(
'toolbar' => array(
'item' => array(
- array('type' =>
'filter',
- 'name' =>
'status',
- 'text' =>
lang('Status').':',
- 'list' => array(
- array(
-
'id' => 'none',
-
'name' => lang('Not selected')
- ),
- array(
-
'id' => 'NEW',
-
'name' => lang('NEW')
- ),
- array(
-
'id' => 'PENDING',
-
'name' => lang('PENDING')
- ),
- array(
-
'id' => 'REJECTED',
-
'name' => lang('REJECTED')
- ),
- array(
-
'id' => 'ACCEPTED',
-
'name' => lang('ACCEPTED')
- )
- )
- ),
array('type' =>
'filter',
'name' =>
'control_areas',
'text' =>
lang('Control_area'),
@@ -299,6 +273,7 @@
$cats->supress_info = true;
$control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl'
=> $this->_category_acl));
+ array_unshift($control_areas['cat_list'],array
('cat_id'=>'','name'=> lang('select value')));
$control_area_array = array();
foreach($control_areas['cat_list'] as $cat_list)
@@ -312,9 +287,8 @@
// END as categories
//$control_area_array =
$this->so_control_area->get_control_area_array();
- $procedure_array =
$this->so_procedure->get_procedures();
+ $procedure_array =
$this->so_procedure->get_procedures(null,null,'title','ASC',null,null,null);
-
if($this->flash_msgs)
{
$msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
@@ -362,6 +336,7 @@
);
}
}
+ array_unshift($procedure_options,array
('id'=>'','name'=> lang('select value')));
$building_part_options =
$this->so->get_building_part_select_array($control_group->get_building_part_id());
@@ -403,6 +378,9 @@
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('controller') . '::' . lang('Control_group');
self::add_javascript('controller', 'yahoo',
'control_tabs.js');
+ self::add_javascript('controller',
'controller', 'jquery.js');
+ self::add_javascript('controller',
'controller', 'ajax.js');
+ self::add_javascript('controller',
'controller', 'jquery-ui.custom.min.js');
self::render_template_xsl(array('control_group/control_group_tabs','control_group/control_group','control_group/control_group_items'),
$data);
}
else if(isset($_POST['save_control_group_items']))
@@ -432,6 +410,7 @@
$cats->supress_info = true;
$control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl'
=> $this->_category_acl));
+ array_unshift($control_areas['cat_list'],array
('cat_id'=>'','name'=> lang('select value')));
$control_area_array = array();
foreach($control_areas['cat_list'] as $cat_list)
@@ -445,9 +424,8 @@
// END as categories
//$control_area_array =
$this->so_control_area->get_control_area_array();
- $procedure_array =
$this->so_procedure->get_procedures();
+ $procedure_array =
$this->so_procedure->get_procedures(null,null,'title','ASC',null,null,null);
-
if($this->flash_msgs)
{
$msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
@@ -495,6 +473,7 @@
);
}
}
+ array_unshift($procedure_options,array
('id'=>'','name'=> lang('select value')));
$building_part_options =
$this->so->get_building_part_select_array($control_group->get_building_part_id());
@@ -544,6 +523,9 @@
// $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'controller.item', 'controller' );
self::add_javascript('controller', 'yahoo',
'control_tabs.js');
+ self::add_javascript('controller',
'controller', 'jquery.js');
+ self::add_javascript('controller',
'controller', 'ajax.js');
+ self::add_javascript('controller',
'controller', 'jquery-ui.custom.min.js');
self::render_template_xsl(array('control_group/control_group_tabs','control_group/control_group','control_group/control_group_items'),
$data);
}
}
@@ -713,13 +695,46 @@
public function get_control_groups_by_control_area()
{
$control_area_id = phpgw::get_var('control_area_id');
+ if($control_area_id == "all")
+ {
+ //get all control groups
+ $control_groups_array =
$this->so->get_all_control_groups_array();
+ }
+ else
+ $control_groups_array =
$this->so->get_control_groups_by_control_area($control_area_id);
- $control_groups_array =
$this->so->get_control_groups_by_control_area($control_area_id);
-
if(count($control_groups_array)>0)
return json_encode( $control_groups_array );
else
return null;
}
+
+ public function get_control_area_by_control_group()
+ {
+ $control_group_id = phpgw::get_var('control_group_id');
+ if($control_group_id)
+ {
+ $control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl'
=> $this->_category_acl));
+
+ $control_area_array = array();
+ foreach($control_areas['cat_list'] as $cat_list)
+ {
+ $control_area_array[] = array
+ (
+ 'id' => $cat_list['cat_id'],
+ 'name' => $cat_list['name'],
+ );
+ }
+ }
+ else
+ {
+ $control_areas_array =
$this->so->get_control_areas_by_control_group($control_group_id);
+ }
+
+ if(count($control_areas_array)>0)
+ return json_encode( $control_areas_array );
+ else
+ return null;
+ }
}
Modified: trunk/controller/inc/class.uicontrol_item.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_item.inc.php 2012-02-17 09:58:39 UTC
(rev 8912)
+++ trunk/controller/inc/class.uicontrol_item.inc.php 2012-02-17 10:14:42 UTC
(rev 8913)
@@ -94,32 +94,6 @@
'form' => array(
'toolbar' => array(
'item' => array(
- array('type' =>
'filter',
- 'name' =>
'status',
- 'text' =>
lang('Status').':',
- 'list' => array(
- array(
-
'id' => 'none',
-
'name' => lang('Not selected')
- ),
- array(
-
'id' => 'NEW',
-
'name' => lang('NEW')
- ),
- array(
-
'id' => 'PENDING',
-
'name' => lang('PENDING')
- ),
- array(
-
'id' => 'REJECTED',
-
'name' => lang('REJECTED')
- ),
- array(
-
'id' => 'ACCEPTED',
-
'name' => lang('ACCEPTED')
- )
- )
- ),
array('type' =>
'filter',
'name' =>
'control_groups',
'text' =>
lang('Control_group').':',
@@ -141,11 +115,6 @@
),
array(
'type' =>
'link',
- 'value' =>
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
- 'href' =>
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
- ),
- array(
- 'type' =>
'link',
'value' =>
lang('New control item'),
'href' =>
self::link(array('menuaction' => 'controller.uicontrol_item.add')),
'class' =>
'new_item'
@@ -319,6 +288,7 @@
$cats->supress_info = true;
$control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl'
=> $this->_category_acl));
+ array_unshift($control_areas['cat_list'],array
('cat_id'=>'','name'=> lang('select value')));
$control_area_array = array();
foreach($control_areas['cat_list'] as $cat_list)
@@ -374,9 +344,14 @@
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('controller') . '::' . lang('Control_item');
-
$GLOBALS['phpgw']->richtext->replace_element('what_to_do');
+
/*$GLOBALS['phpgw']->richtext->replace_element('what_to_do');
$GLOBALS['phpgw']->richtext->replace_element('how_to_do');
- $GLOBALS['phpgw']->richtext->generate_script();
+
$GLOBALS['phpgw']->richtext->generate_script();*/
+
$this->use_yui_editor(array('what_to_do','how_to_do'));
+
+ self::add_javascript('controller',
'controller', 'jquery.js');
+ self::add_javascript('controller',
'controller', 'ajax.js');
+ self::add_javascript('controller',
'controller', 'jquery-ui.custom.min.js');
self::render_template_xsl('control_item/control_item', $data);
}
Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js 2012-02-17 09:58:39 UTC (rev
8912)
+++ trunk/controller/js/controller/ajax.js 2012-02-17 10:14:42 UTC (rev
8913)
@@ -157,8 +157,77 @@
});
});
+
+ // When control area is selected, controls are fetched from db and
control select list is populated
+ $("#control_area").change(function () {
+ var control_area_id = $(this).val();
+ if(control_area_id == '')
+ control_area_id = "all";
+
+ var oArgs =
{menuaction:'controller.uicontrol_group.get_control_groups_by_control_area',
phpgw_return_as:'json'};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+ //var requestUrl =
"index.php?menuaction=controller.uicontrol_group.get_control_groups_by_control_area&phpgw_return_as=json"
+
+ var htmlString = "";
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl + "&control_area_id=" +
control_area_id,
+ success: function(data) {
+ if( data != null){
+ htmlString = "<option>Velg
kontrollgruppe</option>"
+ var obj = jQuery.parseJSON(data);
+
+ $.each(obj, function(i) {
+ htmlString += "<option
value='" + obj[i].id + "'>" + obj[i].group_name + "</option>";
+ });
+
+ $("#control_group").html( htmlString
);
+ }else {
+ htmlString += "<option>Ingen
kontrollgrupper</option>"
+ $("#control_group").html( htmlString );
+ }
+ }
+ });
+
+ });
+ // When control area is selected, controls are fetched from db and
control select list is populated
+/* $("#control_group").change(function () {
+ var control_group_id = $(this).val();
+ var oArgs =
{menuaction:'controller.uicontrol_group.get_control_area_by_control_group',
phpgw_return_as:'json'};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ //var requestUrl =
"index.php?menuaction=controller.uicontrol_group.get_control_groups_by_control_area&phpgw_return_as=json"
+
+ var htmlString = "";
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl + "&control_group_id=" +
control_group_id,
+ success: function(data) {
+ if( data != null){
+ htmlString = "<option>Ingen
kontrollområde</option>"
+ var obj = jQuery.parseJSON(data);
+
+ $.each(obj, function(i) {
+ htmlString += "<option
value='" + obj[i].id + "'>" + obj[i].group_name + "</option>";
+ });
+
+ $("#control_group_id").html(
htmlString );
+ }else {
+ htmlString += "<option>Ingen
kontrollområder</option>"
+ $("#control_group_id").html( htmlString
);
+ }
+ }
+ });
+
+ });
+*/
+
// file: add_component_to_control.xsl
// When component category is selected, corresponding component types
are fetched from db and component type select list is populated
$("#ifc").change(function () {
Modified: trunk/controller/templates/base/control_group/control_group.xsl
===================================================================
--- trunk/controller/templates/base/control_group/control_group.xsl
2012-02-17 09:58:39 UTC (rev 8912)
+++ trunk/controller/templates/base/control_group/control_group.xsl
2012-02-17 10:14:42 UTC (rev 8913)
@@ -22,7 +22,7 @@
<dd>
<xsl:choose>
<xsl:when test="editable">
- <input type="text"
name="group_name" id="group_name" value="{control_group/group_name}" />
+ <input type="text"
name="group_name" id="group_name" value="{control_group/group_name}" size="80"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="control_group/group_name"/>
@@ -35,7 +35,7 @@
<dd>
<xsl:choose>
<xsl:when test="editable">
- <select
id="control_area" name="control_area">
+ <select
id="control_area_id" name="control_area">
<xsl:apply-templates select="control_area/options"/>
</select>
</xsl:when>
@@ -50,7 +50,7 @@
<dd>
<xsl:choose>
<xsl:when test="editable">
- <select id="procedure"
name="procedure">
+ <select
id="procedure_id" name="procedure">
<xsl:apply-templates select="procedure/options"/>
</select>
</xsl:when>
Modified: trunk/controller/templates/base/control_item/control_item.xsl
===================================================================
--- trunk/controller/templates/base/control_item/control_item.xsl
2012-02-17 09:58:39 UTC (rev 8912)
+++ trunk/controller/templates/base/control_item/control_item.xsl
2012-02-17 10:14:42 UTC (rev 8913)
@@ -30,7 +30,7 @@
<dd>
<xsl:choose>
<xsl:when test="editable">
- <input type="text"
name="title" id="title" value="{control_item/title}" />
+ <input type="text"
name="title" id="title" value="{control_item/title}" size="80"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="control_item/title"/>
@@ -120,33 +120,33 @@
</xsl:choose>
</dd>
<dt>
- <label
for="control_group">Kontrollgruppe</label>
+ <label
for="control_area">Kontrollområde</label>
</dt>
<dd>
<xsl:choose>
<xsl:when test="editable">
- <select
id="control_group" name="control_group">
- <option
value="0">Ingen valgt</option>
-
<xsl:apply-templates select="control_group/options"/>
+ <select
id="control_area" name="control_area">
+
<xsl:apply-templates select="control_area/options"/>
</select>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of
select="control_item/control_group_name" />
+ <xsl:value-of
select="control_item/control_area_name" />
</xsl:otherwise>
</xsl:choose>
</dd>
- <dt>
- <label
for="control_area">Kontrollområde</label>
+
<dt>
+ <label
for="control_group">Kontrollgruppe</label>
</dt>
<dd>
<xsl:choose>
<xsl:when test="editable">
- <select
id="control_area" name="control_area">
-
<xsl:apply-templates select="control_area/options"/>
+ <select
id="control_group" name="control_group">
+ <option
value="0">Ingen valgt</option>
+
<xsl:apply-templates select="control_group/options"/>
</select>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of
select="control_item/control_area_name" />
+ <xsl:value-of
select="control_item/control_group_name" />
</xsl:otherwise>
</xsl:choose>
</dd>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8913] bugfix after testing,
Erik Holm-Larsen <=