[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [13460] more on controller
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [13460] more on controller |
Date: |
Thu, 18 Jun 2015 13:32:13 +0000 |
Revision: 13460
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13460
Author: sigurdne
Date: 2015-06-18 13:32:12 +0000 (Thu, 18 Jun 2015)
Log Message:
-----------
more on controller
Modified Paths:
--------------
trunk/controller/inc/class.uicomponent.inc.php
trunk/controller/templates/base/component.xsl
Modified: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php 2015-06-18 10:25:29 UTC
(rev 13459)
+++ trunk/controller/inc/class.uicomponent.inc.php 2015-06-18 13:32:12 UTC
(rev 13460)
@@ -168,6 +168,12 @@
'selected' => $_my_negative_self ==
($this->account * -1)
);
+ /*Unselect user if filter on component*/
+ if(phpgw::get_var('component_id', 'int'))
+ {
+ $default_value['selected'] = 0;
+ }
+
unset($_my_negative_self);
array_unshift ($user_list,$default_value);
array_unshift($user_list, array('id' => '', 'name' =>
lang('select')));
@@ -297,12 +303,12 @@
$fields = array
(
array(
- 'key' => 'selected',
+ 'key' => 'choose',
'label' => '',
'sortable' => false,
),
array(
- 'key' => 'component_id',
+ 'key' => 'component_url',
'label' => lang('component'),
'sortable' => true,
),
@@ -638,8 +644,11 @@
'active_tab' => 'controller'
);
- $data['component_id'] = '<a
href="'.$GLOBALS['phpgw']->link('/index.php',$component_link_data)."\"
target='_blank'>{$component_id}{$entry[0]['component']['xml_short_desc']}</a>";
+ $data['component_url'] = '<a
href="'.$GLOBALS['phpgw']->link('/index.php',$component_link_data)."\"
target='_blank'>{$component_id}{$entry[0]['component']['xml_short_desc']}</a>";
+ $data['component_id'] = $component_id;
+ $data['location_id'] = $location_id;
+
$max_repeat_type = 0;
$_data = array();
foreach($entry as $dataset)
@@ -687,8 +696,10 @@
unset($component_id);
unset($component);
+ $choose_master = false;
if($all_components && count($all_components))
{
+ $choose_master = true;
foreach($all_components as $component_id =>
$component)
{
$data = array();
@@ -705,7 +716,9 @@
$short_description =
$component['short_description'];
$short_description .= "[
{$component['location_name']} ]";
- $data['component_id'] = '<a
href="'.$GLOBALS['phpgw']->link('/index.php',$component_link_data)."\"
target='_blank'>{$component_id}
{$location_type_name[$location_id]}</br>{$short_description}</a>";
+ $data['component_url'] = '<a
href="'.$GLOBALS['phpgw']->link('/index.php',$component_link_data)."\"
target='_blank'>{$component_id}
{$location_type_name[$location_id]}</br>{$short_description}</a>";
+ $data['component_id'] = $component_id;
+ $data['location_id'] = $location_id;
$data['missing_control'] = true;
$values[] = $data;
@@ -719,7 +732,7 @@
$row = array();
$row_sum = array();
$row_sum_actual = array();//billable_hours
- $row['component_id'] = $entry['component_id'];
+ $row['component_url'] = $entry['component_url'];
$row['year'] = '';
$row['descr'] = '';
@@ -727,15 +740,19 @@
{
if($filter_component_str)
{
- $row['selected'] = '<input
id="selected_component" type="checkbox" name="selected_component" checked =
"checked" onclick="deselect_component();">';
+ $row['choose'] = '<input
id="selected_component" type="checkbox" name="selected_component" checked =
"checked" onclick="deselect_component();">';
}
- else
+ else if ($choose_master)
{
- $row['selected'] = '';
+ $row['choose'] = "<input
id=\"master_component\" type=\"radio\" name=\"master_component\" value =
\"{$entry['location_id']}_{$entry['component_id']}\" >";
}
$row['year'] = $year;
$row['descr'] =
"Frekvens<br/>Status<br/>Utførende<br/>Tidsbruk";
}
+ else if ($choose_master)
+ {
+ $row['choose'] = "<input
id=\"selected_components\" class=\"mychecks\" type=\"checkbox\"
name=\"selected_components[]\" value =
\"{$entry['location_id']}_{$entry['component_id']}\"
onclick=\"add_from_master({$entry['location_id']},{$entry['component_id']});\">";
+ }
$found_at_least_one = false;
for ( $_month=1; $_month < 13; $_month++ )
@@ -828,6 +845,18 @@
$result['time_sum_actual'][0] = $sum_year_actual;
$result['total_records'] = $total_records;
$result['location_filter'] = $location_filter;
+ if ($choose_master)
+ {
+ $lang_save = lang('add');
+ $lang_select = lang('select');
+ $result['checkall'] = "<input type=\"button\"
value = '{$lang_save}' title = '{$lang_save}'
onclick=\"add_from_master('mychecks');\">";
+ $result['checkall'] .= '</br>';
+ $result['checkall'] .= "<input
type=\"checkbox\" title = '{$lang_select}' onclick=\"checkAll('mychecks');\">";
+ }
+ else
+ {
+ $result['checkall'] = '';
+ }
return $result;
}
Modified: trunk/controller/templates/base/component.xsl
===================================================================
--- trunk/controller/templates/base/component.xsl 2015-06-18 10:25:29 UTC
(rev 13459)
+++ trunk/controller/templates/base/component.xsl 2015-06-18 13:32:12 UTC
(rev 13460)
@@ -258,6 +258,7 @@
var time_sum = data.time_sum;
var time_sum_actual =
data.time_sum_actual;
+
$("#checkall").html(data.checkall);
$("#total_records").html(data.total_records);
$("#sum_text").html('Sum');
$("#month0").html(time_sum[0] +
'/' + time_sum_actual[0]);
@@ -311,12 +312,67 @@
});
};
+
+ add_from_master = function(myclass)
+ {
+ var myRadio = $('input[name=master_component]');
+ var master_component = myRadio.filter(':checked').val();
+
+ if(!master_component)
+ {
+ alert('velg master');
+ return;
+ }
+
+ var selected = new Array();
+
+ $("." + myclass).each(function()
+ {
+ if($(this).prop("checked"))
+ {
+ selected.push( $(this).val() );
+ }
+ });
+
+ oArgs = {menuaction:
'controller.uicomponent.add_controll_from _master'};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ $.ajax({
+ type: 'POST',
+ data: {master_component:master_component,
target:selected},
+ dataType: 'json',
+ url: requestUrl,
+ success: function(data) {
+ if( data != null)
+ {
+ update_table();
+ }
+ }
+ });
+
+ };
+
+ checkAll = function(myclass)
+ {
+ $("." + myclass).each(function()
+ {
+ if($(this).prop("checked"))
+ {
+ $(this).prop("checked", false);
+ }
+ else
+ {
+ $(this).prop("checked", true);
+ }
+ });
+ };
+
]]>
</script>
<table id="components">
<thead>
<tr>
- <td id='selected'>
+ <td id='checkall'>
</td>
<td id='total_records'>
</td>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [13460] more on controller,
Sigurd Nes <=