[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9318] property: dimb acl
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9318] property: dimb acl |
Date: |
Tue, 08 May 2012 14:25:07 +0000 |
Revision: 9318
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9318
Author: sigurdne
Date: 2012-05-08 14:25:06 +0000 (Tue, 08 May 2012)
Log Message:
-----------
property: dimb acl
Modified Paths:
--------------
trunk/property/inc/class.bodimb_role_user.inc.php
trunk/property/inc/class.sodimb_role_user.inc.php
trunk/property/inc/class.uidimb_role_user.inc.php
trunk/property/js/portico/ajax_dimb_role_user.js
trunk/property/templates/base/dimb_role_user.xsl
Modified: trunk/property/inc/class.bodimb_role_user.inc.php
===================================================================
--- trunk/property/inc/class.bodimb_role_user.inc.php 2012-05-08 11:51:34 UTC
(rev 9317)
+++ trunk/property/inc/class.bodimb_role_user.inc.php 2012-05-08 14:25:06 UTC
(rev 9318)
@@ -43,7 +43,7 @@
}
- function read($data)
+ public function read($data)
{
static $users = array();
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
@@ -65,6 +65,11 @@
}
return $values;
+ }
+ public function edit($data)
+ {
+ $values = $this->so->edit($data);
+ return $values;
}
}
Modified: trunk/property/inc/class.sodimb_role_user.inc.php
===================================================================
--- trunk/property/inc/class.sodimb_role_user.inc.php 2012-05-08 11:51:34 UTC
(rev 9317)
+++ trunk/property/inc/class.sodimb_role_user.inc.php 2012-05-08 14:25:06 UTC
(rev 9318)
@@ -170,4 +170,13 @@
return $values;
}
+
+ public function edit($data)
+ {
+ _debug_array($data);
+ die();
+ return $values;
+ }
+
+
}
Modified: trunk/property/inc/class.uidimb_role_user.inc.php
===================================================================
--- trunk/property/inc/class.uidimb_role_user.inc.php 2012-05-08 11:51:34 UTC
(rev 9317)
+++ trunk/property/inc/class.uidimb_role_user.inc.php 2012-05-08 14:25:06 UTC
(rev 9318)
@@ -255,8 +255,8 @@
'update_action'
=> self::link(array('menuaction' => 'property.uidimb_role_user.edit'))
);
- $GLOBALS['phpgw']->jqcal->add_listener('start_date');
- $GLOBALS['phpgw']->jqcal->add_listener('end_date');
+ $GLOBALS['phpgw']->jqcal->add_listener('active_from');
+ $GLOBALS['phpgw']->jqcal->add_listener('active_to');
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
@@ -313,4 +313,51 @@
return json_encode($values);
}
+ public function edit()
+ {
+ $user_id = phpgw::get_var('user_id', 'int');
+ $dimb_id = phpgw::get_var('dimb_id', 'int');
+ $role_id = phpgw::get_var('role_id', 'int');
+ $query = phpgw::get_var('query');
+
+ if($values = phpgw::get_var('values'))
+ {
+ if(!$GLOBALS['phpgw']->acl->check('.admin',
PHPGW_ACL_EDIT, 'property'))
+ {
+ $receipt['error'][]=true;
+ phpgwapi_cache::message_set(lang('you
are not approved for this task'), 'error');
+ }
+ if(!$receipt['error'])
+ {
+ if($this->bo->edit($values))
+ {
+ $result = array
+ (
+ 'status' =>
'updated'
+ );
+ }
+ else
+ {
+ $result = array
+ (
+ 'status' =>
'error'
+ );
+ }
+ }
+ }
+
+ if(phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ if( $receipt =
phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))
+ {
+
phpgwapi_cache::session_clear('phpgwapi', 'phpgw_messages');
+ $result['receipt'] = $receipt;
+ }
+ return $result;
+ }
+ else
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'property.uidimb_role_user.index', 'user_id' => $user_id,
'dimb_id' => $dimb_id, 'role_id' => $role_id, 'query' => $query));
+ }
+ }
}
Modified: trunk/property/js/portico/ajax_dimb_role_user.js
===================================================================
--- trunk/property/js/portico/ajax_dimb_role_user.js 2012-05-08 11:51:34 UTC
(rev 9317)
+++ trunk/property/js/portico/ajax_dimb_role_user.js 2012-05-08 14:25:06 UTC
(rev 9318)
@@ -21,95 +21,10 @@
update_dimb_role_user_table();
});
+ $("#acl_form").live("submit", function(e){
+ return;
- $("#voucher_id_filter").change(function () {
-
- $("#voucher_id").val( '' );
- $("#voucher_id_text").html( '' );
- $("#line_id").val( '' );
- $("#line_text").val( '' );
- $("#order_id").val( '' );
- $("#project_group").val( '' );
- $("#invoice_id").html( '' );
- $("#kid_nr").html( '' );
- $("#vendor").html('' );
-// $("#janitor").html( '' );
-// $("#supervisor").html( '' );
-// $("#budget_responsible").html( '' );
- $("#close_order_orig").val( '' );
- $("#my_initials").val( '' );
- $("#sign_orig").val( '' );
- $("#invoice_date").html( '' );
- $("#payment_date").html( '' );
- $("#b_account_id").val( '' );
-// $("#amount").html( '' );
-// $("#approved_amount").html( '' );
- $("#currency").html( '' );
- $("#oppsynsmannid").html( '' );
- $("#saksbehandlerid").html( '' );
- $("#budsjettansvarligid").html( '' );
- $("#remark").html( '' );
- $("#process_log").html( '' );
- $("#dim_a").val('' );
- $("#dim_b").html( "<option>Velg</option>" );
- $("#dim_e").html( "<option>Velg</option>" );
- $("#period").html( "<option>Velg</option>" );
- $("#periodization").html( "<option>Velg</option>" );
- $("#periodization_start").html( "<option>Velg</option>" );
- $("#process_code").html( "<option>Velg</option>" );
- $("#tax_code").html( "<option>0</option>" );
- $("#approve_as").html( "<option>Velg</option>" );
- $("#order_text").html( 'Bestilling' );
- $("#invoice_id_text").html('FakturaNr');
- $("#close_order").html( '' );
- $("#close_order_orig").val( '' );
- $("#park_order").html( '' );
- $("#receipt").html('');
-
- var voucher_id = $(this).val();
- var oArgs = {menuaction:'property.uiinvoice2.get_first_line'};
- var requestUrl = phpGWLink('index.php', oArgs, true);
-
- var line_id = 0;
-
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl + "&voucher_id=" + voucher_id,
- success: function(data) {
- if( data != null)
- {
- line_id = data['line_id'];
- base_java_url['line_id'] = line_id;
- base_java_url['voucher_id_filter'] =
voucher_id;
- execute_async(myDataTable_0);
- update_form_values(line_id, 0);
- }
- }
- });
-
-
- // document.getElementById('image_content').src = '';
- });
-
- $("#approve_line").live("click", function(e){
- $("#receipt").html('');
- var line_id = $(this).val();
- var voucher_id_orig = $("#voucher_id").val();
- update_form_values(line_id, voucher_id_orig);
- });
-
-
- $("#voucher_form").live("submit", function(e){
e.preventDefault();
- var line_id = $("#line_id").val();
- var voucher_id_orig = $("#voucher_id").val();
- if(!line_id)
- {
- alert('Du må velge linje i bilag');
- return;
- }
-
var thisForm = $(this);
var submitBnt = $(thisForm).find("input[type='submit']");
var requestUrl = $(thisForm).attr("action");
@@ -131,16 +46,8 @@
if(obj.status == "updated")
{
$(submitBnt).val("Lagret");
- /*
- var oArgs =
{menuaction:'property.uiinvoice2.get_vouchers'};
- var requestUrl =
phpGWLink('index.php', oArgs, true);
- requestUrl = requestUrl +
"&voucher_id_filter=" + $("#voucher_id").val();
-
execute_async(myDataTable_0,requestUrl);
- */
-
-
base_java_url['voucher_id_filter'] = $("#voucher_id").val();
- base_java_url['line_id'] =
line_id;
- execute_async(myDataTable_0);
+ var oArgs =
{menuaction:'property.uidimb_role_user.query', dimb_id:$("#dimb_id").val(),
user_id:$("#user_id").val(),role_id:$("#role_id").val(),query:$("#query").val()};
+
execute_async(myDataTable_0,oArgs);
}
else
{
@@ -149,7 +56,7 @@
// Changes text on save button back to original
window.setTimeout(function() {
- $(submitBnt).val('Lagre Linje');
+ $(submitBnt).val('Lagre');
$(submitBnt).addClass("not_active");
}, 1000);
@@ -184,326 +91,6 @@
});
-function update_form_values( line_id, voucher_id_orig ){
- var oArgs = {menuaction:'property.uiinvoice2.get_single_line'};
- var requestUrl = phpGWLink('index.php', oArgs, true);
-
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl + "&line_id=" + line_id,
- success: function(data) {
- if(data.sessionExpired)
- {
- alert('Sesjonen er utløpt - du må logge inn på
nytt');
- return;
- }
- var voucher = data['voucher'];
- if( voucher != null && voucher.length > 0)
- {
- $("#line_id").val( line_id );
-
- var update_image = false;
-
- if(voucher_id_orig != voucher[0].voucher_id)
- {
- update_image = true;
- }
- $("#voucher_id").val( voucher[0].voucher_id );
- if( voucher[0].voucher_out_id )
- {
- $("#voucher_id_text").html(
voucher[0].voucher_out_id );
- }
- else
- {
- $("#voucher_id_text").html(
voucher[0].voucher_id );
- }
-
- $("#order_id").val( voucher[0].order_id );
-
- if(voucher[0].order_id)
- {
- var oArgs_order =
{menuaction:'property.uiinvoice.view_order', order_id: voucher[0].order_id};
- var requestUrl_order =
phpGWLink('index.php', oArgs_order);
-// var htmlString_order = " <a target=
\"_blank\" href=\"" + requestUrl_order + "\" title=\"" + voucher[0].status +
"\" > Bestilling</a>";
-
- var htmlString_order = " <a
href=\"javascript:load_order(" + voucher[0].order_id + ");\" title=\"" +
voucher[0].status + "\" > Bestilling</a>";
-
- $("#order_text").html( htmlString_order
);
- }
- else
- {
- $("#order_text").html( 'Bestilling' );
- }
-
- $("#project_group").val(
voucher[0].project_group );
-
- if(update_image)
- {
- if(voucher[0].external_ref)
- {
-
$("#invoice_id_text").html(voucher[0].external_ref );
-
document.getElementById('image_content').src = voucher[0].image_url;
- }
- else
- {
-
$("#invoice_id_text").html('FakturaNr');
-
document.getElementById('image_content').src = '';
- }
- }
-
- $("#invoice_id").html( voucher[0].invoice_id );
- $("#kid_nr").html( voucher[0].kid_nr );
- $("#vendor").html( voucher[0].vendor );
- $("#invoice_date").html(
voucher[0].invoice_date );
- $("#payment_date").html(
voucher[0].payment_date );
- $("#b_account_id").val( voucher[0].b_account_id
);
- $("#dim_a").val( voucher[0].dim_a );
- $("#currency").html( voucher[0].currency );
- $("#process_log").html(
data['generic'].process_log );
- $("#my_initials").val(
data['generic'].my_initials );
- $("#sign_orig").val( data['generic'].sign_orig
);
- $("#line_text").val( voucher[0].line_text );
-
- if(voucher[0].merknad)
- {
- var oArgs_remark =
{menuaction:'property.uiinvoice.remark', id: voucher[0].id};
- var requestUrl_remark =
phpGWLink('index.php', oArgs_remark);
- var htmlString = " <a
href=\"javascript:openwindow('" +requestUrl_remark + "','550','400')\" >
Remark</a>";
-
- $("#remark").html( htmlString );
- }
-//---------
- var checked_park_invoice = "";
- var park_invoice_status = "";
- if(voucher[0].parked)
- {
- checked_park_invoice = "checked =
\"checked\"";
- var park_invoice_status = " X";
- }
- var htmlString_park_invoice = "<input
type=\"checkbox\" name=\"values[park_invoice]\" value=\"1\" title=\"park
invoice\"" + checked_park_invoice + "></input>" + park_invoice_status;
- $("#park_order").html( htmlString_park_invoice
);
-//---------
- var checked_close_order = "";
- var close_order_status = " " +
voucher[0].status;
- if(voucher[0].closed)
- {
- checked_close_order = "checked =
\"checked\"";
- }
- var htmlString_close_order = "<input
type=\"checkbox\" name=\"values[close_order]\" value=\"1\" title=\"close
order\"" + checked_close_order + "></input>" + close_order_status;
- $("#close_order").html( htmlString_close_order
);
- $("#close_order_orig").val( voucher[0].closed );
-//---------
-
-
if(typeof(data['generic']['dimb_list']['options']) != 'undefined')
- {
- var htmlString = "";
- var obj =
data['generic']['dimb_list']['options'];
-
- $.each(obj, function(i) {
- var selected = '';
- if(obj[i].id ==
voucher[0].dim_b)
- {
- selected = ' selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#dim_b").html( htmlString );
- }
-
if(typeof(data['generic']['dime_list']['options']) != 'undefined')
- {
- var htmlString = "";
- var obj =
data['generic']['dime_list']['options'];
-
- $.each(obj, function(i) {
- var selected = '';
- if(obj[i].id ==
voucher[0].dim_e)
- {
- selected = ' selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#dim_e").html( htmlString );
- }
-
if(typeof(data['generic']['tax_code_list']['options']) != 'undefined')
- {
- var htmlString = "";
-
- htmlString = "<option>Velg</option>"
-
- var obj =
data['generic']['tax_code_list']['options'];
-
- $.each(obj, function(i) {
- var selected = '';
- if(obj[i].id ==
voucher[0].tax_code)
- {
- selected = ' selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#tax_code").html( htmlString );
- }
-
-
if(typeof(data['generic']['period_list']['options']) != 'undefined')
- {
- var htmlString = "";
- var obj =
data['generic']['period_list']['options'];
-
- $.each(obj, function(i) {
- var selected = '';
- if(obj[i].id ==
voucher[0].period)
- {
- selected = ' selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
- $("#period").html( htmlString );
- }
-
if(typeof(data['generic']['periodization_list']['options']) != 'undefined')
- {
- var htmlString = "";
-
- var obj =
data['generic']['periodization_list']['options'];
-
- $.each(obj, function(i) {
- var selected = '';
- if(obj[i].id ==
voucher[0].periodization)
- {
- selected = ' selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#periodization").html( htmlString );
- }
-
if(typeof(data['generic']['periodization_start_list']['options']) !=
'undefined')
- {
- var htmlString = "";
-
- var obj =
data['generic']['periodization_start_list']['options'];
-
- $.each(obj, function(i) {
- var selected = '';
- if(obj[i].id ==
voucher[0].periodization_start)
- {
- selected = ' selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#periodization_start").html(
htmlString );
- }
-
-
if(typeof(data['generic']['process_code_list']['options']) != 'undefined')
- {
- var htmlString = "";
-
- var obj =
data['generic']['process_code_list']['options'];
- $.each(obj, function(i) {
- var selected = '';
- if(obj[i].id ==
voucher[0].process_code)
- {
- selected = ' selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#process_code").html( htmlString );
- }
-
- if(typeof(data['generic']['approved_list']) !=
'undefined')
- {
- for ( var i = 0; i <
data['generic']['approved_list'].length; ++i )
- {
- var role_sign =
data['generic']['approved_list'][i].role_sign;
-
- var role_initials =
data['generic']['approved_list'][i].initials;
-
- if(
data['generic']['approved_list'][i].date )
- {
- var htmlString =
role_initials + ": " + data['generic']['approved_list'][i].date;
- }
- else
- {
- var htmlString =
"<select id=\"_" + role_sign + "\" name=\"values[forward][" + role_sign +
"]\">";
- var obj =
data['generic']['approved_list'][i]['user_list'].options;
- $.each(obj, function(i)
{
- var selected =
'';
- if(obj[i].id ==
role_initials)
- {
-
selected = ' selected';
- }
- htmlString +=
"<option value='" + obj[i].id + "'" + selected + ">" + obj[i].name +
"</option>";
- });
- htmlString +=
"</select>";
- }
-
- $("#" + role_sign).html(
htmlString );
- }
- }
-
-
if(typeof(data['generic']['approve_list']['options']) != 'undefined')
- {
- var htmlString = "";
-
- var obj =
data['generic']['approve_list']['options'];
-
- $.each(obj, function(i) {
- var selected = '';
- if(typeof(obj[i].selected) !=
'undefined' && obj[i].selected == 1)
- {
- selected = ' selected';
- }
- htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#approve_as").html( htmlString );
- }
- }
- else
- {
- $("#line_text").val( '' );
- $("#voucher_id").val( '' );
- $("#voucher_id_text").html( '' );
- $("#order_id").val( '' );
- $("#project_group").val( '' );
- $("#invoice_id").html( '' );
- $("#kid_nr").html( '' );
- $("#vendor").html('' );
- $("#close_order_orig").val( '' );
- $("#my_initials").val( '' );
- $("#sign_orig").val( '' );
- $("#invoice_date").html( '' );
- $("#payment_date").html( '' );
- $("#b_account_id").val( '' );
- $("#currency").html( '' );
- $("#oppsynsmannid").html( '' );
- $("#saksbehandlerid").html( '' );
- $("#budsjettansvarligid").html( '' );
- $("#remark").html( '' );
- $("#process_log").html( '' );
- $("#dim_a").val('' );
- $("#dim_b").html( "<option>Velg</option>" );
- $("#dim_e").html( "<option>Velg</option>" );
- $("#period").html( "<option>Velg</option>" );
- $("#periodization").html(
"<option>Velg</option>" );
- $("#periodization_start").html(
"<option>Velg</option>" );
- $("#process_code").html(
"<option>Velg</option>" );
- $("#tax_code").html( "<option>0</option>" );
- $("#approve_as").html( "<option>Velg</option>"
);
- $("#order_text").html( 'Bestilling' );
- $("#invoice_id_text").html('FakturaNr');
- $("#receipt").html('');
- document.getElementById('image_content').src =
'';
- }
- }
- });
-}
-
-
function update_dimb_role_user_table()
{
var oArgs = {menuaction:'property.uidimb_role_user.query',
dimb_id:$("#dimb_id").val(),
user_id:$("#user_id").val(),role_id:$("#role_id").val(),query:$("#query").val()};
@@ -511,48 +98,5 @@
}
-//------------
-function load_order( id ){
- var oArgs = {menuaction: 'property.uiinvoice.view_order', order_id: id,
nonavbar: true, lean: true};
- var requestUrl = phpGWLink('index.php', oArgs);
- TINY.box.show({iframe:requestUrl,
boxid:'frameless',width:750,height:450,fixed:false,maskid:'darkmask',maskopacity:40,
mask:true, animate:true, close: true,closejs:function(){closeJS_local()}});
-// $("#curtain").show();
-// $("#popupBox").fadeIn("slow");
-// var htmlString = "";
-// htmlString += "<iframe width=\"100%\" height=\"100%\" src = \"" +
requestUrl + "\" ><p>Your browser does not support iframes.</p></iframe>";
-// $("#popupBox").html( htmlString );
-}
-
-function closeJS_local()
-{
- var line_id = $("#line_id").val( );
- var voucher_id_orig = $("#voucher_id").val();
- $("#curtain").hide();
- $("#popupBox").hide();
- update_form_values(line_id, voucher_id_orig)
-}
-
-function closeJS_remote()
-{
- TINY.box.hide();
-/*
- var line_id = $("#line_id").val( );
- var voucher_id_orig = $("#voucher_id").val();
- $("#curtain").hide();
- $("#popupBox").hide();
- update_form_values(line_id, voucher_id_orig)
-*/
-}
-
-function hide_popupBox( ){
- var line_id = $("#line_id").val( );
- var voucher_id_orig = $("#voucher_id").val();
- $("#curtain").hide();
- $("#popupBox").hide();
- update_form_values(line_id, voucher_id_orig);
-}
-
-
-
Modified: trunk/property/templates/base/dimb_role_user.xsl
===================================================================
--- trunk/property/templates/base/dimb_role_user.xsl 2012-05-08 11:51:34 UTC
(rev 9317)
+++ trunk/property/templates/base/dimb_role_user.xsl 2012-05-08 14:25:06 UTC
(rev 9318)
@@ -77,7 +77,7 @@
<table align = "center"
width="95%">
<xsl:apply-templates
select="filter_form" />
</table>
- <form action="{update_action}"
name="voucher_form" id="voucher_form" method="post">
+ <form action="{update_action}"
name="acl_form" id="acl_form" method="post">
<table align = "center"
width="95%">
<xsl:call-template name="role_fields" />
<tr>
@@ -152,7 +152,7 @@
<xsl:value-of select="php:function('lang',
'date from')" />
</td>
<td>
- <input type="text" name="values[start_date]"
id="start_date" value="{voucher_info/voucher/line_text}"/>
+ <input type="text" name="values[active_from]"
id="active_from" value=""/>
</td>
</tr>
<tr class ='row_off'>
@@ -160,7 +160,7 @@
<xsl:value-of select="php:function('lang',
'date to')" />
</td>
<td>
- <input type="text" name="values[end_date]"
id="end_date" value="{voucher_info/voucher/line_text}"/>
+ <input type="text" name="values[active_to]"
id="active_to" value=""/>
</td>
</tr>
</xsl:template>
@@ -177,7 +177,7 @@
<xsl:call-template name="datasource-definition" />
<div id="receipt"></div>
<xsl:variable name="label_submit"><xsl:value-of
select="php:function('lang', 'save')" /></xsl:variable>
- <div class="row_on"><input type="submit" name="values[update_voucher]"
id="frm_update_voucher" value="{$label_submit}"/></div>
+ <div class="row_on"><input type="submit" name="update_acl"
id="frm_update_acl" value="{$label_submit}"/></div>
</xsl:template>
<xsl:template name="datasource-definition" xmlns:php="http://php.net/xsl">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9318] property: dimb acl,
Sigurd Nes <=