[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9045] Merge 9029:9044 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9045] Merge 9029:9044 from trunk |
Date: |
Tue, 27 Mar 2012 08:57:01 +0000 |
Revision: 9045
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9045
Author: sigurdne
Date: 2012-03-27 08:57:00 +0000 (Tue, 27 Mar 2012)
Log Message:
-----------
Merge 9029:9044 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
branches/Version-1_0-branch/activitycalendar/templates/base/activity_list_partial.php
branches/Version-1_0-branch/activitycalendar/templates/base/dashboard.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
branches/Version-1_0-branch/phpgwapi/inc/class.xslttemplates.inc.php
branches/Version-1_0-branch/property/inc/class.bolocation.inc.php
branches/Version-1_0-branch/property/inc/class.soproject.inc.php
branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
branches/Version-1_0-branch/registration/inc/class.bomanagefields.inc.php
branches/Version-1_0-branch/registration/inc/class.boreg.inc.php
branches/Version-1_0-branch/registration/inc/class.menu.inc.php
branches/Version-1_0-branch/registration/inc/class.somanagefields.inc.php
branches/Version-1_0-branch/registration/inc/class.soreg.inc.php
branches/Version-1_0-branch/registration/inc/class.uireg.inc.php
branches/Version-1_0-branch/registration/setup/phpgw_no.lang
branches/Version-1_0-branch/registration/setup/setup.inc.php
branches/Version-1_0-branch/registration/setup/tables_current.inc.php
branches/Version-1_0-branch/registration/setup/tables_update.inc.php
Added Paths:
-----------
branches/Version-1_0-branch/registration/inc/class.bopending.inc.php
branches/Version-1_0-branch/registration/inc/class.sopending.inc.php
branches/Version-1_0-branch/registration/inc/class.uicommon.inc.php
branches/Version-1_0-branch/registration/inc/class.uipending.inc.php
branches/Version-1_0-branch/registration/js/
branches/Version-1_0-branch/registration/templates/base/app_data.xsl
branches/Version-1_0-branch/registration/templates/base/common.xsl
branches/Version-1_0-branch/registration/templates/base/css/
branches/Version-1_0-branch/registration/templates/base/pending_users.xsl
branches/Version-1_0-branch/registration/templates/base/user_edit.xsl
branches/Version-1_0-branch/registration/templates/base/yui_booking_i18n.xsl
Property Changed:
----------------
branches/Version-1_0-branch/
Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
-
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028
+
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044
Modified:
branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -161,40 +161,77 @@
}
if(isset($filters['new_activities']))
{
- $filter_clauses[] = "activity.state=1 OR
activity.state=2";
- }
- if(isset($filters['activity_state']) &&
$filters['activity_state'] != 'all'){
- $activity_state =
$this->marshal($filters['activity_state'],'int');
- $filter_clauses[] = "activity.state =
{$activity_state}";
- }
- if(isset($filters['activity_org']) && $filters['activity_org']
!= '0'){
- $activity_org =
$this->marshal($filters['activity_org'],'int');
- $filter_clauses[] = "activity.organization_id =
{$activity_org}";
- }
- if(isset($filters['activity_category']) &&
$filters['activity_category'] != 'all'){
- $activity_category =
$this->marshal($filters['activity_category'],'int');
- $filter_clauses[] = "activity.category =
{$activity_category}";
- }
- if(isset($filters['activity_district'])){
- if($filters['activity_district'] != 'all')
+ if(!isset($filters['activity_state']) ||
(isset($filters['activity_state']) && $filters['activity_state'] == 'all')){
+ $filter_clauses[] = "activity.state=1 OR
activity.state=2";
+ }
+ if(isset($filters['activity_state']) &&
$filters['activity_state'] != 'all'){
+ $activity_state =
$this->marshal($filters['activity_state'],'int');
+ $filter_clauses[] = "activity.state =
{$activity_state}";
+ }
+ if(isset($filters['activity_org']) &&
$filters['activity_org'] != '0'){
+ $activity_org =
$this->marshal($filters['activity_org'],'int');
+ $filter_clauses[] = "activity.organization_id =
{$activity_org}";
+ }
+ if(isset($filters['activity_category']) &&
$filters['activity_category'] != 'all'){
+ $activity_category =
$this->marshal($filters['activity_category'],'int');
+ $filter_clauses[] = "activity.category =
{$activity_category}";
+ }
+ if(isset($filters['activity_district'])){
+ if($filters['activity_district'] != 'all')
+ {
+ $activity_district =
$this->marshal($filters['activity_district'],'int');
+ $filter_clauses[] = "activity.office =
'{$activity_district}'";
+ }
+ }
+ else
{
- $activity_district =
$this->marshal($filters['activity_district'],'int');
- $filter_clauses[] = "activity.office =
'{$activity_district}'";
+ $activity_district =
$this->get_office_from_user($filters['user_id']);
+ if($activity_district && $activity_district !=
'')
+ {
+ $filter_clauses[] = "activity.office =
'{$activity_district}'";
+ }
}
+ if(isset($filters['updated_date_hidden']) &&
$filters['updated_date_hidden'] != "")
+ {
+ $ts_query =
strtotime($filters['updated_date_hidden']); // target timestamp specified by
user
+ $filter_clauses[] = "activity.last_change_date
< {$ts_query}";
+ }
}
else
{
- $activity_district =
$this->get_office_from_user($filters['user_id']);
- if($activity_district && $activity_district != '')
+ if(isset($filters['activity_state']) &&
$filters['activity_state'] != 'all'){
+ $activity_state =
$this->marshal($filters['activity_state'],'int');
+ $filter_clauses[] = "activity.state =
{$activity_state}";
+ }
+ if(isset($filters['activity_org']) &&
$filters['activity_org'] != '0'){
+ $activity_org =
$this->marshal($filters['activity_org'],'int');
+ $filter_clauses[] = "activity.organization_id =
{$activity_org}";
+ }
+ if(isset($filters['activity_category']) &&
$filters['activity_category'] != 'all'){
+ $activity_category =
$this->marshal($filters['activity_category'],'int');
+ $filter_clauses[] = "activity.category =
{$activity_category}";
+ }
+ if(isset($filters['activity_district'])){
+ if($filters['activity_district'] != 'all')
+ {
+ $activity_district =
$this->marshal($filters['activity_district'],'int');
+ $filter_clauses[] = "activity.office =
'{$activity_district}'";
+ }
+ }
+ else
{
- $filter_clauses[] = "activity.office =
'{$activity_district}'";
+ $activity_district =
$this->get_office_from_user($filters['user_id']);
+ if($activity_district && $activity_district !=
'')
+ {
+ $filter_clauses[] = "activity.office =
'{$activity_district}'";
+ }
}
+ if(isset($filters['updated_date_hidden']) &&
$filters['updated_date_hidden'] != "")
+ {
+ $ts_query =
strtotime($filters['updated_date_hidden']); // target timestamp specified by
user
+ $filter_clauses[] = "activity.last_change_date
< {$ts_query}";
+ }
}
- if(isset($filters['updated_date_hidden']) &&
$filters['updated_date_hidden'] != "")
- {
- $ts_query = strtotime($filters['updated_date_hidden']);
// target timestamp specified by user
- $filter_clauses[] = "activity.last_change_date <
{$ts_query}";
- }
if(count($filter_clauses))
{
Modified:
branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -325,7 +325,7 @@
switch($query_type)
{
case 'new_activities':
- $filters = array('new_activities' => 'yes',
'activity_district' => phpgw::get_var('activity_district'), 'user_id' => $uid);
+ $filters = array('new_activities' => 'yes',
'activity_state' => phpgw::get_var('activity_state'), 'activity_category' =>
phpgw::get_var('activity_category'), 'activity_district' =>
phpgw::get_var('activity_district'), 'user_id' => $uid, 'updated_date_hidden'
=> phpgw::get_var('date_change_hidden'));
$result_objects =
activitycalendar_soactivity::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
$object_count =
activitycalendar_soactivity::get_instance()->get_count($search_for,
$search_type, $filters);
break;
Modified:
branches/Version-1_0-branch/activitycalendar/templates/base/activity_list_partial.php
===================================================================
---
branches/Version-1_0-branch/activitycalendar/templates/base/activity_list_partial.php
2012-03-27 08:54:12 UTC (rev 9044)
+++
branches/Version-1_0-branch/activitycalendar/templates/base/activity_list_partial.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -198,14 +198,14 @@
<fieldset>
<!-- Filters -->
- <label class="toolbar_element_label"
for="ctrl_toggle_activity_state"><?php echo lang('activity_state') ?></label>
- <select name="activity_state" id="<?php echo $list_id
?>_ctrl_toggle_activity_state">
- <option value="all"><?php echo lang('all') ?></option>
- <option value="1" <?php if($list_id ==
'new_activities'){ echo 'selected="selected"';}?>><?php echo lang('new')
?></option>
- <option value="2" ><?php echo lang('change') ?></option>
- <option value="3" ><?php echo lang('published')
?></option>
- <option value="5" ><?php echo lang('rejected')
?></option>
- </select>
+ <label class="toolbar_element_label"
for="ctrl_toggle_activity_state"><?php echo lang('activity_state') ?></label>
+ <select name="activity_state" id="<?php echo $list_id
?>_ctrl_toggle_activity_state">
+ <option value="all"><?php echo lang('all')
?></option>
+ <option value="1"><?php echo lang('new')
?></option>
+ <option value="2"><?php echo lang('change')
?></option>
+ <?php if(!$nofilter){ //remove state if on dashboard
?><option value="3" ><?php echo lang('published') ?></option><?php }?>
+ <?php if(!$nofilter){ //remove state if on dashboard
?><option value="5" ><?php echo lang('rejected') ?></option><?php }?>
+ </select>
<label class="toolbar_element_label"
for="ctrl_toggle_activity_district"><?php echo lang('office') ?></label>
<?php
$districts =
activitycalendar_soactivity::get_instance()->select_district_list();
Modified:
branches/Version-1_0-branch/activitycalendar/templates/base/dashboard.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/templates/base/dashboard.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/activitycalendar/templates/base/dashboard.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -27,5 +27,6 @@
$list_form = true;
$list_id = 'new_activities';
$url_add_on = '&type=new_activities';
+ $nofilter=true;
include('activity_list_partial.php');
?>
\ No newline at end of file
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -398,7 +398,7 @@
$this->bo->start = phpgw::get_var('startIndex');
$location_list = $this->bo->read(array('user_id' =>
$user_id, 'role_id' =>$role_id,
'type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,
-
'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run'
=>$dry_run));
+
'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run'
=>$dry_run, 'results' => $return_results));
//_debug_array($location_list);
$rows_total = $this->bo->read(array('type_id' =>
$type_id, 'allrows' => true));
Modified: branches/Version-1_0-branch/phpgwapi/inc/class.xslttemplates.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.xslttemplates.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.xslttemplates.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -84,7 +84,7 @@
*/
function halt($msg)
{
- die($msg);
+ throw new Exception($msg);
}
/**
Modified: branches/Version-1_0-branch/property/inc/class.bolocation.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bolocation.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/property/inc/class.bolocation.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -257,10 +257,10 @@
switch($data['lookup_type'])
{
case 'form':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('location_form'));
+
$GLOBALS['phpgw']->xslttpl->add_file(array('location_form'),ExecMethod('phpgwapi.phpgw.common.get_tpl_dir',
'property'));
break;
case 'view':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('location_view'));
+
$GLOBALS['phpgw']->xslttpl->add_file(array('location_view'),ExecMethod('phpgwapi.phpgw.common.get_tpl_dir',
'property'));
break;
}
}
Modified: branches/Version-1_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soproject.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -1443,7 +1443,8 @@
$this->db->query("UPDATE fm_project SET budget
= {$new_budget_new_project}, reserve = reserve + {$reserve_old_project} WHERE
id = {$new_project_id}" ,__LINE__,__FILE__);
$this->db->query("UPDATE fm_project SET budget
= 0, reserve = 0 WHERE id = " . (int)$project['id'] ,__LINE__,__FILE__);
$this->db->query("DELETE FROM fm_project_budget
WHERE project_id = " . (int)$project['id'] ,__LINE__,__FILE__);
-
$historylog->add('RM',(int)$project['id'],"Budsjett og alle bestillinger er
flyttet fra prosjekt {$project['id']} til prosjekt {$new_project_id}");
+
$historylog->add('RM',(int)$project['id'],"Budsjett og alle bestillinger er
overført fra prosjekt {$project['id']} til prosjekt {$new_project_id}");
+ $historylog->add('RM',$new_project_id,"Budsjett
og alle bestillinger er overført fra prosjekt {$project['id']} til prosjekt
{$new_project_id}");
}
$receipt['id'] = $project['id'];
Modified: branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -1712,7 +1712,7 @@
array
( // boton exportar
'type' => 'button',
- 'id' => 'done',
+ 'id' => 'btn_done',
'tab_index' => 2,
'value' => lang('done')
),
Modified: branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -1379,6 +1379,8 @@
$record_history = array();
if(isset($bypass_error) || ((!isset($receipt['error'])
|| $add_request) && !$bypass) && $id)
{
+ $_transfer_new_project =
isset($values['new_project_id']) && $values['new_project_id'] ? true : false;
+
$values = $this->bo->read_single($id);
if(!isset($values['origin']))
@@ -1386,7 +1388,7 @@
$values['origin'] = '';
}
- if(!isset($values['workorder_budget']) && $save
&& !$values['new_project_id'])
+ if(!isset($values['workorder_budget']) && $save
&& !$_transfer_new_project)
{
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uiworkorder.edit', 'project_id'=> $id));
}
Modified:
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
===================================================================
---
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
2012-03-27 08:54:12 UTC (rev 9044)
+++
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -267,8 +267,8 @@
{
if(isset($this->config->config_data['import']['check_archive']) &&
$this->config->config_data['import']['check_archive'])
{
- $this->check_archive();
- }
+ $this->check_archive();
+ }
$this->get_files();
$dirname =
$this->config->config_data['import']['local_path'];
@@ -329,7 +329,7 @@
}
else
{
- $this->db->transaction_abort();
+ $this->db->transaction_abort();
}
}
}
@@ -445,7 +445,7 @@
echo
"File remote: {$file_remote} was copied to local: $file_local<br/>";
if(
ssh2_sftp_unlink ($sftp, "{$directory_remote}/archive/{$file_name}" ))
{
-
echo "Deleted duplicate File remote:
{$directory_remote}/archive/{$file_name}<br/>";
+
echo "Deleted duplicate File remote:
{$directory_remote}/archive/{$file_name}<br/>";
}
if(
ssh2_sftp_rename ($sftp, $file_remote,
"{$directory_remote}/archive/{$file_name}" ))
{
@@ -507,7 +507,6 @@
$bilagsnr_ut = isset($_data['VOUCHERID']) ?
$_data['VOUCHERID'] : ''; // FIXME: innkommende bilagsnummer?
- $order_id =
$_data['PURCHASEORDERNO'];
$fakturanr =
$_data['SUPPLIERREF'];//$_data['KEY'];
$fakturadato =
date($this->dateformat,strtotime(str_replace('.', '-', $_data['INVOICEDATE'])));
$forfallsdato =
date($this->dateformat,strtotime(str_replace('.', '-', $_data['MATURITY'])));
@@ -523,12 +522,34 @@
$buffer[$i]['artid'] = 1;
}
- $kidnr = $_data['KIDNO'];
+ $kidnr
= $_data['KIDNO'];
+ $_order_id
= $_data['PURCHASEORDERNO'];
+ $merknad
= '';
+ $order_id
= '';
+ $buffer[$i]['project_id'] = '';
- if($order_id)
+ $order_info =
$this->get_order_info($_order_id); // henter default verdier selv om
$_order_id ikke er gyldig.
+
+ if(!$_order_id)
{
- $buffer[$i]['project_id'] =
$this->soXport->get_project($order_id);
+ $merknad = 'Mangler bestillingsnummer';
+ $this->receipt['error'][] = array('msg'
=> $merknad);
}
+ else if (!ctype_digit($_order_id))
+ {
+ $merknad = "bestillingsnummeret er på
feil format: '{$_order_id}'";
+ $this->receipt['error'][] = array('msg'
=> $merknad);
+ }
+ else if (!$order_info['order_exist'])
+ {
+ $merknad = 'bestillingsnummeret ikke
gyldig: ' . $_order_id;
+ $this->receipt['error'][] = array('msg'
=> $merknad);
+ }
+ else
+ {
+ $buffer[$i]['project_id'] =
$this->soXport->get_project($_order_id);
+ $order_id = $_order_id;
+ }
$buffer[$i]['external_ref'] =
$_data['SCANNINGNO'];
$buffer[$i]['pmwrkord_code'] = $order_id;
@@ -544,8 +565,8 @@
$buffer[$i]['bilagsnr_ut'] =
$bilagsnr_ut;
$buffer[$i]['referanse'] =
"ordre: {$order_id}";
- $order_info = $this->get_order_info($order_id);
+
$buffer[$i]['dimb'] = $order_info['dimb'];
$buffer[$i]['dima'] = $order_info['dima'];
$buffer[$i]['loc1'] = $order_info['loc1'];
@@ -580,7 +601,7 @@
$_bilagsnr_ut =
$this->db->f('bilagsnr_ut');
$bilagsnr = $this->db->f('bilagsnr');
$__bilagsnr = $_bilagsnr_ut ?
$_bilagsnr_ut : $bilagsnr;
-
+
if($_bilagsnr_ut)
{
$receipt =
$this->export->RullTilbake(false,false,$_bilagsnr_ut);
@@ -605,7 +626,7 @@
$sql = 'SELECT id FROM fm_vendor WHERE id = ' .
(int) $vendor_id;
$this->db->query($sql,__LINE__,__FILE__);
-
+
if(!$_data['SUPPLIER.CODE'])
{
$this->receipt['error'][] = array('msg'
=> "LeverandørId ikke angitt for faktura: {$_data['SCANNINGNO']}");
@@ -628,7 +649,7 @@
$rc =
$this->send->msg('email', $to, 'Ikke gyldig leverandør ved import av faktura
til Portico', $body, '', '', '','','','html');
if($rc)
{
-
$this->receipt['message'][] = array('msg'=> "epost sendt til {$to}");
+
$this->receipt['message'][] = array('msg'=> "epost sendt til {$to}");
}
}
catch (phpmailerException $e)
@@ -653,8 +674,6 @@
$buffer[$i]['kostra_id'] =
$this->default_kostra_id;//$this->soXport->get_kostra_id($buffer[$i]['loc1']);
- $merknad = '';
-
$buffer[$i]['merknad'] = $merknad;
$buffer[$i]['splitt'] = $this->splitt;
$buffer[$i]['kildeid'] = $this->kildeid;
@@ -742,7 +761,7 @@
}
return false;
}
-
+
$GLOBALS['phpgw']->db->Exception_On_Error = false;
return $bilagsnr;
}
@@ -764,7 +783,10 @@
$sql = "SELECT
fm_workorder.location_code,fm_workorder.vendor_id,fm_workorder.account_id,fm_workorder.ecodimb,
fm_workorder.user_id"
. " FROM fm_workorder {$this->join} fm_project ON
fm_workorder.project_id = fm_project.id WHERE fm_workorder.id = {$order_id}";
$this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
+ if( $this->db->next_record())
+ {
+ $order_info['order_exist'] = true;
+ }
if ($this->db->f('location_code'))
{
$parts =
explode('-',$this->db->f('location_code'));
Modified:
branches/Version-1_0-branch/registration/inc/class.bomanagefields.inc.php
===================================================================
--- branches/Version-1_0-branch/registration/inc/class.bomanagefields.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/registration/inc/class.bomanagefields.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -125,18 +125,14 @@
$fields = $this->so->get_field_list();
$rarray = array();
- if (is_array ($fields))
+ foreach ($fields as $num => $field_info)
{
- reset ($fields);
- while (list ($num, $field_info) = each
($fields))
- {
- /* Convert the stored database values
into comma delimited form */
+ /* Convert the stored database values into
comma delimited form */
- $field_values = unserialize
(base64_decode ($field_info['field_values']));
- $fields[$num]['field_values'] =
$field_values;
+ $field_values = unserialize (base64_decode
($field_info['field_values']));
+ $fields[$num]['field_values'] = $field_values;
- $rarray[$field_info['field_name']] =
$fields[$num];
- }
+ $rarray[$field_info['field_name']] =
$fields[$num];
}
return $rarray;
Copied: branches/Version-1_0-branch/registration/inc/class.bopending.inc.php
(from rev 9044, trunk/registration/inc/class.bopending.inc.php)
===================================================================
--- branches/Version-1_0-branch/registration/inc/class.bopending.inc.php
(rev 0)
+++ branches/Version-1_0-branch/registration/inc/class.bopending.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -0,0 +1,275 @@
+<?php
+ /**
+ * phpGroupWare - registration
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package registration
+ * @version $Id: class.bolocation.inc.php 8281 2011-12-13 09:24:03Z
sigurdne $
+ */
+
+ /**
+ * Description
+ * @package registration
+ */
+
+ class registration_bopending
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $lookup;
+ var $use_session;
+ var $total_records = 0;
+
+ /**
+ * @var object $custom reference to custom fields object
+ */
+
+ var $public_functions = array
+ (
+ 'read' => true,
+ 'read_single' => true,
+ 'save' => true,
+ 'delete' => true,
+ 'check_perms' => true
+ );
+
+ function __construct($session=false)
+ {
+ $this->so =
CreateObject('registration.sopending');
+
+ if ($session )
+ {
+ $this->read_sessiondata();
+ $this->use_session = true;
+ }
+
+ $start =
phpgw::get_var('start', 'int', 'REQUEST', 0);
+ $query =
phpgw::get_var('query');
+ $sort =
phpgw::get_var('dir');
+ $order =
phpgw::get_var('sort');
+ $filter =
phpgw::get_var('filter', 'int');
+ $status_id =
phpgw::get_var('status_id', 'int');
+ $allrows =
phpgw::get_var('allrows', 'bool');
+
+ $this->start = $start ? $start : 0;
+ $this->query = isset($query) &&
$query ? $query : '';
+ $this->filter = isset($filter) &&
$filter ? $filter : '';
+ $this->sort = isset($sort)
&& $sort ? $sort : $this->sort;
+ $this->order = isset($order) &&
$order ? $order : $this->order;
+ $this->status_id = isset($status_id) &&
$status_id ? $status_id : '';
+ $this->allrows = isset($allrows) &&
$allrows ? $allrows : '';
+ $this->acl_location = '.pending';
+ $this->location_code = isset($location_code) &&
$location_code ? $location_code : '';
+
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','pending_user');
+
+ $this->start =
isset($data['start'])?$data['start']:'';
+ $this->filter =
isset($data['filter'])?$data['filter']:'';
+ $this->sort =
isset($data['sort'])?$data['sort']:'';
+ $this->order =
isset($data['order'])?$data['order']:'';;
+ $this->status_id =
isset($data['status_id'])?$data['status_id']:'';
+ $this->query =
isset($data['query'])?$data['query']:'';
+ $this->status =
isset($data['status'])?$data['status']:'';
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','pending_user',$data);
+ }
+ }
+
+
+ function read($data = array())
+ {
+ $users = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+ 'filter' =>
$this->filter,'allrows'=>$data['allrows'],
+ 'status_id'=>$this->status_id,'results' =>
$data['results']));
+
+ foreach($users as &$user)
+ {
+ $user['reg_dla'] =
$GLOBALS['phpgw']->common->show_date($user['reg_dla']);
+ }
+
+ $this->total_records = $this->so->total_records;
+ $this->uicols = $this->so->uicols;
+
+ return $users;
+ }
+
+
+ function read_single($data='',$extra=array())
+ {
+ if(is_array($data))
+ {
+ $location_code = $data['location_code'];
+ $extra = $data['extra'];
+ }
+ else
+ {
+ $location_code = $data;
+ }
+
+ $location_array = explode('-',$location_code);
+ $type_id= count($location_array);
+
+ if (!$type_id)
+ {
+ return;
+ }
+
+ if(!isset($extra['noattrib']) || !$extra['noattrib'])
+ {
+ $values['attributes'] =
$this->custom->find('property','.location.' . $type_id, 0, '', 'ASC',
'attrib_sort', true, true);
+ $values =
$this->so->read_single($location_code, $values);
+ $values = $this->custom->prepare($values,
'property',".location.{$type_id}", $extra['view']);
+ }
+ else
+ {
+ $values =
$this->so->read_single($location_code);
+ }
+
+
+ if( isset($extra['tenant_id']) &&
$extra['tenant_id']!='lookup')
+ {
+ if($extra['tenant_id']>0)
+ {
+
$tenant_data=$this->bocommon->read_single_tenant($extra['tenant_id']);
+ $values['tenant_id'] =
$extra['tenant_id'];
+ $values['contact_phone'] =
$extra['contact_phone']?$extra['contact_phone']:$tenant_data['contact_phone'];
+ $values['last_name'] =
$tenant_data['last_name'];
+ $values['first_name'] =
$tenant_data['first_name'];
+ }
+ else
+ {
+ unset($values['tenant_id']);
+ unset($values['contact_phone']);
+ unset($values['last_name']);
+ unset($values['first_name']);
+ }
+ }
+
+ if(is_array($extra))
+ {
+ $values = $values + $extra;
+ }
+ return $values;
+ }
+
+
+ public function update_pending_user($values)
+ {
+ return $this->so->update_pending_user($values);
+ }
+
+ /**
+ * Approve a list of pending users
+ *
+ * @param array $values the array users to change status
+ *
+ * @return array receipt
+ */
+
+ function approve_users($values)
+ {
+ $receipt = $this->so->approve_users($values);
+
+ $criteria = array
+ (
+ 'appname' => 'registration',
+ 'location' => ".pending.approve",
+ 'allrows' => true
+ );
+
+ $custom_functions =
$GLOBALS['phpgw']->custom_functions->find($criteria);
+
+ foreach ( $custom_functions as $entry )
+ {
+ // prevent path traversal
+ if ( preg_match('/\.\./', $entry['file_name']) )
+ {
+ continue;
+ }
+
+ $file = PHPGW_SERVER_ROOT .
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+ if ( $entry['active'] && is_file($file) )
+ {
+ require_once $file;
+ }
+ }
+
+ return $receipt;
+ }
+ /**
+ * Edit single user
+ *
+ * @param array $values the array of values to edit
+ *
+ * @return array receipt
+ */
+
+
+ function edit($values)
+ {
+ $receipt = $this->so->edit($values);
+
+ $criteria = array
+ (
+ 'appname' => 'registration',
+ 'location' => ".pending.edit",
+ 'allrows' => true
+ );
+
+ $custom_functions =
$GLOBALS['phpgw']->custom_functions->find($criteria);
+
+ foreach ( $custom_functions as $entry )
+ {
+ // prevent path traversal
+ if ( preg_match('/\.\./', $entry['file_name']) )
+ {
+ continue;
+ }
+
+ $file = PHPGW_SERVER_ROOT .
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+ if ( $entry['active'] && is_file($file) )
+ {
+ require_once $file;
+ }
+ }
+
+ return $receipt;
+ }
+
+ function delete()
+ {
+ //$location_code =
phpgw::get_var('location_code','string','GET');
+ //$this->so->delete($location_code);
+ }
+ }
Modified: branches/Version-1_0-branch/registration/inc/class.boreg.inc.php
===================================================================
--- branches/Version-1_0-branch/registration/inc/class.boreg.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/registration/inc/class.boreg.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -117,6 +117,19 @@
$missing_fields[] = 'passwd_confirm';
}
+ if($r_reg['passwd'])
+ {
+ $account = new phpgwapi_user();
+ try
+ {
+
$account->validate_password($r_reg['passwd']);
+ }
+ catch(Exception $e)
+ {
+ $errors[] = $e->getMessage();
+ }
+ }
+
reset ($this->fields);
foreach ( $this->fields as $field_name => $field_info )
@@ -243,6 +256,20 @@
$ui->welcome_screen();
}
+ public function get_pending_user($reg_id)
+ {
+ $so = createobject('registration.soreg');
+ $reg_info = $so->valid_reg($reg_id);
+ if($reg_info['reg_info'])
+ {
+ $reg_info['reg_info'] =
unserialize(base64_decode($reg_info['reg_info']));
+ unset($reg_info['reg_info']['passwd']);
+ unset($reg_info['reg_info']['passwd_confirm']);
+ }
+
+ return $reg_info;
+ }
+
//
// username
//
Modified: branches/Version-1_0-branch/registration/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/registration/inc/class.menu.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/registration/inc/class.menu.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -25,11 +25,27 @@
*/
public function get_menu()
{
+ $menus = array();
+
$incoming_app =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$GLOBALS['phpgw_info']['flags']['currentapp'] =
'registration';
$menus['toolbar'] = array();
+
+ $menus['navbar'] = array
+ (
+ 'registration' => array
+ (
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'registration.uipending.index')),
+ 'text' => lang('registration'),
+ 'image' => array('admin',
'navbar'),
+ 'order' => -6,
+ 'group' => 'systools'
+ ),
+ );
+
+
if ( $GLOBALS['phpgw']->acl->check('run',
phpgwapi_acl::READ, 'admin')
|| $GLOBALS['phpgw']->acl->check('admin',
phpgwapi_acl::ADD, 'registration'))
{
@@ -48,6 +64,15 @@
);
}
+
+// $menus['navigation'] = array();
+ $menus['navigation']['pending'] = array
+ (
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'registration.uipending.index')),
+ 'text' => lang('Pending for approval'),
+ 'image' => array('property',
'location'),
+ );
+
$GLOBALS['phpgw_info']['flags']['currentapp'] =
$incoming_app;
return $menus;
}
Modified:
branches/Version-1_0-branch/registration/inc/class.somanagefields.inc.php
===================================================================
--- branches/Version-1_0-branch/registration/inc/class.somanagefields.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/registration/inc/class.somanagefields.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -28,27 +28,15 @@
function update_field ($field_info)
{
+
if ($field_info['field_values'])
{
$field_info['field_values'] = base64_encode
(serialize ($field_info['field_values']));
}
- $sql = "UPDATE phpgw_reg_fields SET ";
+ $value_set =
$this->db->validate_update($field_info);
- reset ($this->db_fields);
- foreach ( $this->db_fields as $num => $field )
- {
- if ($num)
- {
- $sql .= ", ";
- }
- $sql .= "$field='$field_info[$field]'";
- }
-
- $sql .= " WHERE field_name='$field_info[field_name]'";
- $rv = $this->db->query ($sql);
-
- return $rv;
+ return $this->db->query("UPDATE phpgw_reg_fields SET
{$value_set} WHERE field_name='{$field_info[field_name]}'",__LINE__,__FILE__);
}
function insert_field ($field_info)
@@ -58,34 +46,15 @@
$field_info['field_values'] = base64_encode
(serialize ($field_info['field_values']));
}
- $sql = "INSERT INTO phpgw_reg_fields (";
- $sql2 = "(";
+ $sql = "INSERT INTO phpgw_reg_fields (" . implode(', ',
array_keys($field_info)) . ') VALUES (' .
$this->db->validate_insert(array_values($field_info)) . ')';
+ $rv = $this->db->query($sql,__LINE__,__FILE__);
- reset ($this->db_fields);
- while (list ($num, $field) = each ($this->db_fields))
- {
- if ($num)
- {
- $sql .= ', ';
- $sql2 .= ', ';
- }
- $sql .= $field;
- $sql2 .= "'$field_info[$field]'";
- }
-
- $sql .= ') VALUES ';
- $sql2 .= ')';
-
- $sql .= $sql2;
-
- $rv = $this->db->query ($sql);
-
return $rv;
}
function remove_field ($field_info)
{
- $rv = $this->db->query ("DELETE FROM phpgw_reg_fields
WHERE field_name='$field_info[field_name]'");
+ $rv = $this->db->query ("DELETE FROM phpgw_reg_fields
WHERE field_name='{$field_info[field_name]}'");
return $rv;
}
@@ -93,19 +62,7 @@
function get_field_list ()
{
$rarray = array();
- $sql = "SELECT ";
-
- reset ($this->db_fields);
- while (list ($num, $db_field_name) = each
($this->db_fields))
- {
- if ($num)
- {
- $sql .= ', ';
- }
- $sql .= $db_field_name;
- }
-
- $sql .= " FROM phpgw_reg_fields ORDER BY field_order";
+ $sql = 'SELECT ' . implode(', ', $this->db_fields) . '
FROM phpgw_reg_fields ORDER BY field_order';
$this->db->query ($sql);
while ($this->db->next_record ())
{
Copied: branches/Version-1_0-branch/registration/inc/class.sopending.inc.php
(from rev 9044, trunk/registration/inc/class.sopending.inc.php)
===================================================================
--- branches/Version-1_0-branch/registration/inc/class.sopending.inc.php
(rev 0)
+++ branches/Version-1_0-branch/registration/inc/class.sopending.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -0,0 +1,182 @@
+<?php
+ /**
+ * phpGroupWare - registration
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package registration
+ * @version $Id: class.solocation.inc.php 8572 2012-01-15 14:16:40Z
sigurdne $
+ */
+
+ /**
+ * Description
+ * @package registration
+ */
+
+ class registration_sopending
+ {
+
+ var $bocommon;
+ var $total_records;
+ protected $global_lock = false;
+
+ function __construct()
+ {
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->db = & $GLOBALS['phpgw']->db;
+ $this->join = & $this->db->join;
+ $this->left_join = & $this->db->left_join;
+ $this->like = & $this->db->like;
+ }
+
+ public function read($data)
+ {
+ $start =
isset($data['start']) && $data['start'] ? $data['start'] : 0;
+ $filter =
isset($data['filter']) && $data['filter'] ? $data['filter'] : 0;
+ $query =
isset($data['query']) ? $data['query'] : '';
+ $sort =
isset($data['sort']) && $data['sort'] ? $data['sort'] : 'ASC';
+ $order =
isset($data['order']) && $data['order'] ? $data['order'] : 'reg_id';
+ $status_id =
isset($data['status_id']) && $data['status_id'] ? (int)$data['status_id'] : 0;
+ $allrows =
isset($data['allrows']) ? $data['allrows'] : '';
+ $results =
$data['results'] ? (int)$data['results'] : 0;
+
+ $ordermethod = " ORDER BY {$order} {$sort}";
+
+ $where= 'WHERE';
+ $filtermethod = '';
+
+ switch ($status_id)
+ {
+ case '1':
+ $filtermethod .= "$where reg_approved =
1";
+ $where= 'AND';
+ break;
+ case '2':
+ $filtermethod .= "$where reg_approved
IS NULL";
+ $where= 'AND';
+ break;
+ default:
+ // nothing
+ }
+
+ if($query)
+ {
+ $query = $this->db->db_addslashes($query);
+ $querymethod = "{$where} reg_lid {$this->like}
'%$query%'";
+ }
+
+ $sql = "SELECT * FROM phpgw_reg_accounts
{$filtermethod} {$querymethod}";
+
+ $values = array();
+ $this->db->query('SELECT count(*) AS cnt ' .
substr($sql,strripos($sql,' FROM')),__LINE__,__FILE__);
+ $this->db->next_record();
+ $this->total_records = $this->db->f('cnt');
+
+ if(!$allrows)
+ {
+ $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__,$results);
+ }
+ else
+ {
+ if($this->total_records > 200)
+ {
+ $_fetch_single = true;
+ }
+ else
+ {
+ $_fetch_single = false;
+ }
+ $this->db->query($sql .
$ordermethod,__LINE__,__FILE__, false, $_fetch_single );
+ unset($_fetch_single);
+ }
+
+ $j=0;
+
+ $values = array();
+
+ while ($this->db->next_record())
+ {
+ $values[] = array
+ (
+ 'reg_id' =>
$this->db->f('reg_id'),
+ 'reg_lid' =>
$this->db->f('reg_lid'),
+ 'reg_info' =>
$this->db->f('reg_info'),
+ 'reg_dla' =>
$this->db->f('reg_dla'),
+ 'reg_approved' =>
$this->db->f('reg_approved')
+ );
+
+ }
+ return $values;
+ }
+
+ public function approve_users($data)
+ {
+ $delete_approval = array();
+ $add_approval = array();
+ foreach($data['pending_users_orig'] as $id)
+ {
+ if(!in_array($id, $data['pending_users']))
+ {
+ $delete_approval[] = $id;
+ }
+ }
+
+ foreach($data['pending_users'] as $id)
+ {
+ if(!in_array($id, $data['pending_users_orig']))
+ {
+ $add_approval[] = $id;
+ }
+ }
+
+ $this->db->transaction_begin();
+ foreach ($delete_approval as $reg_id)
+ {
+ $this->db->query("UPDATE phpgw_reg_accounts SET
reg_approved = NULL WHERE reg_id = '{$reg_id}'",__LINE__,__FILE__);
+ }
+
+ foreach ($add_approval as $reg_id)
+ {
+ $this->db->query("UPDATE phpgw_reg_accounts SET
reg_approved = 1 WHERE reg_id = '{$reg_id}'",__LINE__,__FILE__);
+ }
+
+ return $this->db->transaction_commit();
+ }
+
+ public function update_pending_user($values)
+ {
+ $ret = false;
+ $this->db->transaction_begin();
+ if (isset($values['location']) && $values['location']
&& $values['id'])
+ {
+ $this->db->query("SELECT reg_info FROM
phpgw_reg_accounts WHERE reg_id = '{$values['id']}'",__LINE__,__FILE__);
+ if ($this->db->next_record())
+ {
+ $reg_info =
unserialize(base64_decode($this->db->f('reg_info')));
+ $reg_info['location_code'] =
implode('-', $values['location']);
+ }
+ $ret = $this->db->query("UPDATE
phpgw_reg_accounts SET reg_info='" . base64_encode(serialize($reg_info)) . "'
WHERE reg_id='{$values['id']}'",__LINE__,__FILE__);
+ }
+ $this->db->transaction_commit();
+ return $ret;
+ }
+
+ }
Modified: branches/Version-1_0-branch/registration/inc/class.soreg.inc.php
===================================================================
--- branches/Version-1_0-branch/registration/inc/class.soreg.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/registration/inc/class.soreg.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -17,7 +17,7 @@
/* $Id$ */
- class soreg
+ class registration_soreg
{
var $reg_id;
var $db;
@@ -34,13 +34,16 @@
function account_exists($account_lid)
{
$this->db->transaction_begin();
- $this->db->query("SELECT count(*) as cnt FROM
phpgw_reg_accounts WHERE reg_lid='$account_lid'",__LINE__,__FILE__);
- $this->db->next_record();
+ $this->db->query("SELECT reg_lid FROM
phpgw_reg_accounts WHERE reg_lid='$account_lid'",__LINE__,__FILE__);
+ if($this->db->next_record())
+ {
+ return true;
+ }
if ($GLOBALS['phpgw']->accounts->exists($account_lid)
|| $this->db->f('cnt'))
{
$this->db->transaction_commit();
- return True;
+ return true;
}
else
{
@@ -48,7 +51,7 @@
$this->db->query("insert into
phpgw_reg_accounts values ('','$account_lid','','" . time() .
"')",__LINE__,__FILE__);
$this->db->transaction_commit();
$GLOBALS['phpgw']->session->appsession('loginid','registration',$account_lid);
- return False;
+ return false;
}
}
@@ -90,7 +93,15 @@
$subject = $this->config['subject_confirm'] ?
lang($this->config['subject_confirm']) : lang('Account registration');
$noreply = $this->config['mail_nobody'] ? ('No reply <'
. $this->config['mail_nobody'] . '>') : ('No reply <noreply@' .
$GLOBALS['phpgw_info']['server']['hostname'] . '>');
-
$smtp->msg('email',$fields['email'],$subject,$GLOBALS['phpgw']->template->fp('out','message'),'','','',$noreply,'','html');
+ try
+ {
+
$smtp->msg('email',$fields['email'],$subject,$GLOBALS['phpgw']->template->fp('out','message'),'','','',$noreply,'','html');
+ }
+ catch(Exception $e)
+ {
+ //won't show because of redirect...
+ //_debug_array($e->getMessage());
+ }
return $this->reg_id;
}
@@ -205,10 +216,11 @@
if ($this->db->f('reg_id'))
{
return array(
- 'reg_id' => $this->db->f('reg_id'),
- 'reg_lid' => $this->db->f('reg_lid'),
- 'reg_info' => $this->db->f('reg_info'),
- 'reg_dla' => $this->db->f('reg_dla')
+ 'reg_id' =>
$this->db->f('reg_id'),
+ 'reg_lid' =>
$this->db->f('reg_lid'),
+ 'reg_info' =>
$this->db->f('reg_info'),
+ 'reg_dla' =>
$this->db->f('reg_dla'),
+ 'reg_approved' =>
$this->db->f('reg_approved')
);
}
else
Copied: branches/Version-1_0-branch/registration/inc/class.uicommon.inc.php
(from rev 9044, trunk/registration/inc/class.uicommon.inc.php)
===================================================================
--- branches/Version-1_0-branch/registration/inc/class.uicommon.inc.php
(rev 0)
+++ branches/Version-1_0-branch/registration/inc/class.uicommon.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -0,0 +1,806 @@
+<?php
+ /**
+ * phpGroupWare - registration
+ *
+ * @author Erink Holm-Larsen <address@hidden>
+ * @author Torstein Vadla <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package registration
+ * @version $Id: class.uicommon.inc.php 8830 2012-02-13 06:57:11Z erikhl
$
+ */
+
+ phpgw::import_class('phpgwapi.yui');
+
+ /**
+ * Cherry pick selected values into a new array
+ *
+ * @param array $array input array
+ * @param array $keys array of keys to pick
+ *
+ * @return array containg values from $array for the keys in $keys.
+ */
+ function extract_values($array, $keys, $options = array())
+ {
+ static $default_options = array(
+ 'prefix' => '',
+ 'suffix' => '',
+ 'preserve_prefix' => false,
+ 'preserve_suffix' => false
+ );
+
+ $options = array_merge($default_options, $options);
+
+ $result = array();
+ foreach($keys as $write_key)
+ {
+ $array_key =
$options['prefix'].$write_key.$options['suffix'];
+ if(isset($array[$array_key])) {
+ $result[($options['preserve_prefix'] ?
$options['prefix'] : '').$write_key.($options['preserve_suffix'] ?
$options['suffix'] : '')] = $array[$array_key];
+ }
+ }
+ return $result;
+ }
+
+ function array_set_default(&$array, $key, $value)
+ {
+ if(!isset($array[$key])) $array[$key] = $value;
+ }
+
+ /**
+ * Reformat an ISO timestamp into norwegian format
+ *
+ * @param string $date date
+ *
+ * @return string containg timestamp in norwegian format
+ */
+ function pretty_timestamp($date)
+ {
+ if (empty($date)) return "";
+
+ if(is_array($date) && is_object($date[0]) && $date[0]
instanceof DOMNode)
+ {
+ $date = $date[0]->nodeValue;
+ }
+ preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2})(
([0-9]{2}):([0-9]{2}))?/', $date, $match);
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ if($match[4])
+ {
+ $dateformat .= ' H:i';
+ $timestamp = mktime($match[5], $match[6], 0, $match[2],
$match[3], $match[1]);
+ }
+ else
+ {
+ $timestamp = mktime(0, 0, 0, $match[2], $match[3],
$match[1]);
+ }
+ $text = date($dateformat,$timestamp);
+
+ return $text;
+ }
+
+ /**
+ * Generates a javascript translator object/hash for the specified
fields.
+ */
+ function js_lang()
+ {
+ $keys = func_get_args();
+ $strings = array();
+ foreach($keys as $key)
+ {
+ $strings[$key] = is_string($key) ? lang($key) :
call_user_func_array('lang', $key);
+ }
+ return json_encode($strings);
+ }
+
+ /**
+ * Creates an array of translated strings.
+ */
+ function lang_array()
+ {
+ $keys = func_get_args();
+ foreach($keys as &$key)
+ {
+ $key = lang($key);
+ }
+ return $keys;
+ }
+
+ abstract class registration_uicommon
+ {
+ const UI_SESSION_FLASH = 'flash_msgs';
+
+ protected
+ $filesArray;
+
+ protected static
+ $old_exception_handler;
+
+ private
+ $ui_session_key,
+ $flash_msgs;
+
+
+ const LOCATION_ROOT = '.';
+ const LOCATION_SUPERUSER = '.usertype.superuser';
+// const LOCATION_ADMINISTRATOR = '.RESPONSIBILITY.ADMIN';
+ const LOCATION_USER = '.usertype.user';
+
+ public $dateFormat;
+
+ public $type_of_user;
+
+ // public $flash_msgs;
+
+ public function __construct()
+ {
+ self::set_active_menu('registration');
+
self::add_stylesheet('phpgwapi/js/yahoo/calendar/assets/skins/sam/calendar.css');
+
self::add_stylesheet('phpgwapi/js/yahoo/autocomplete/assets/skins/sam/autocomplete.css');
+
self::add_stylesheet('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+
self::add_stylesheet('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
self::add_stylesheet('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
self::add_stylesheet('phpgwapi/js/yahoo/treeview/assets/skins/sam/treeview.css');
+
//self::add_stylesheet('registration/templates/base/css/base.css');
+ self::add_javascript('controller', 'yahoo',
'common.js');//Use this one for now
+ $this->tmpl_search_path = array();
+ array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT .
'/phpgwapi/templates/base');
+ array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT .
'/phpgwapi/templates/' . $GLOBALS['phpgw_info']['server']['template_set']);
+ array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT .
'/' . $GLOBALS['phpgw_info']['flags']['currentapp'] . '/templates/base');
+ phpgwapi_yui::load_widget('datatable');
+ phpgwapi_yui::load_widget('history');
+ phpgwapi_yui::load_widget('paginator');
+ phpgwapi_yui::load_widget('menu');
+ phpgwapi_yui::load_widget('calendar');
+ phpgwapi_yui::load_widget('autocomplete');
+ phpgwapi_yui::load_widget('animation');
+
+ $this->url_prefix = str_replace('_', '.',
get_class($this));
+
+ $this->dateFormat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ $this->acl = & $GLOBALS['phpgw']->acl;
+ $this->locations = & $GLOBALS['phpgw']->locations;
+
+ $this->type_of_user = array(
+ MANAGER => $this->isManager(),
+ EXECUTIVE_OFFICER =>
$this->isExecutiveOfficer(),
+ ADMINISTRATOR => $this->isAdministrator()
+ );
+ //var_dump($this->type_of_user);
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($GLOBALS['phpgw_info']['flags']['currentapp']);
+ }
+
+ private function get_ui_session_key() {
+ return $this->ui_session_key;
+ }
+
+ private function restore_flash_msgs() {
+ if (($flash_msgs =
$this->session_get(self::UI_SESSION_FLASH))) {
+ if (is_array($flash_msgs)) {
+ $this->flash_msgs = $flash_msgs;
+
$this->session_set(self::UI_SESSION_FLASH, array());
+ return true;
+ }
+ }
+
+ $this->flash_msgs = array();
+ return false;
+ }
+
+ private function store_flash_msgs() {
+ return $this->session_set(self::UI_SESSION_FLASH,
$this->flash_msgs);
+ }
+
+ private function reset_flash_msgs() {
+ $this->flash_msgs = array();
+ $this->store_flash_msgs();
+ }
+
+ private function session_set($key, $data) {
+ return
phpgwapi_cache::session_set($this->get_ui_session_key(), $key, $data);
+ }
+
+ private function session_get($key) {
+ return
phpgwapi_cache::session_get($this->get_ui_session_key(), $key);
+ }
+
+ /**
+ * Provides a private session cache setter per ui class.
+ */
+ protected function ui_session_set($key, $data) {
+ return $this->session_set(get_class($this).'_'.$key,
$data);
+ }
+
+ /**
+ * Provides a private session cache getter per ui class .
+ */
+ protected function ui_session_get($key) {
+ return $this->session_get(get_class($this).'_'.$key);
+ }
+
+ protected function generate_secret($length = 10)
+ {
+ return
substr(base64_encode(rand(1000000000,9999999999)),0, $length);
+ }
+
+ public function add_js_event($event, $js) {
+ $GLOBALS['phpgw']->js->add_event($event, $js);
+ }
+
+ public function add_js_load_event($js) {
+ $this->add_js_event('load', $js);
+ }
+
+ /**
+ * Permission check. Proxy method for method check in
phpgwapi->acl
+ *
+ * @param $location
+ * @param $permission
+ * @return true if check is ok, false othewise
+ */
+ protected function hasPermissionOn($location =
registration_uicommon::LOCATION_ROOT, $permission = PHPGW_ACL_PRIVATE){
+ return
$this->acl->check($location,$permission,'registration');
+ }
+
+
+ /**
+ * Check to see if this user is an administrator
+ *
+ * @return true if private permission on root, false otherwise
+ */
+ protected function isAdministrator(){
+ return
$this->acl->check(registration_uicommon::LOCATION_ROOT,PHPGW_ACL_PRIVATE,'registration');
+ }
+
+ /**
+ * Check to see if the user is an executive officer
+ *
+ * @return true if at least add permission on fields of
responsibilities (locations: .RESPONSIBIITY.*)
+ */
+ protected function isExecutiveOfficer(){
+ return (
+
$this->acl->check(registration_uicommon::LOCATION_SUPERUSER,PHPGW_ACL_ADD,'registration')
||
+
$this->acl->check(registration_uicommon::LOCATION_USER,PHPGW_ACL_ADD,'registration')
+ );
+ }
+
+ /**
+ * Check to see if the user is a manager
+ *
+ * @return true if no read,add,delete,edit permission on fields
of responsibilities (locations: .RESPONSIBILITY.*)
+ */
+ protected function isManager(){
+ return !$this->isExecutiveOfficer();
+ }
+
+ public static function
process_registration_unauthorized_exceptions()
+ {
+ self::$old_exception_handler =
set_exception_handler(array(__CLASS__,
'handle_registration_unauthorized_exception'));
+ }
+
+ public static function
handle_registration_unauthorized_exception(Exception $e)
+ {
+ if ($e instanceof registration_unauthorized_exception)
+ {
+ $message = htmlentities('HTTP/1.0 401
Unauthorized - '.$e->getMessage(), null, self::encoding());
+ header($message);
+ echo
"<html><head><title>$message</title></head><body><strong>$message</strong></body></html>";
+ } else {
+ call_user_func(self::$old_exception_handler,
$e);
+ }
+ }
+
+ public function link($data)
+ {
+ return $GLOBALS['phpgw']->link('/index.php', $data);
+ }
+
+ public function redirect($link_data)
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
$link_data);
+ }
+
+ public function flash($msg, $type='success')
+ {
+ $this->flash_msgs[$msg] = $type == 'success';
+ }
+
+ public function flash_form_errors($errors)
+ {
+ foreach($errors as $field => $msg)
+ {
+ $this->flash_msgs[$msg] = false;
+ }
+ }
+
+ public function add_stylesheet($path)
+ {
+ $GLOBALS['phpgw']->css->add_external_file($path);
+ }
+
+ public function add_javascript($app, $pkg, $name)
+ {
+ return $GLOBALS['phpgw']->js->validate_file($pkg,
str_replace('.js', '', $name), $app);
+ }
+
+ public function set_active_menu($item)
+ {
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
$item;
+ }
+
+ /**
+ * A more flexible version of xslttemplate.add_file
+ */
+ public function add_template_file($tmpl)
+ {
+ if(is_array($tmpl))
+ {
+ foreach($tmpl as $t)
+ {
+ $this->add_template_file($t);
+ }
+ return;
+ }
+ foreach(array_reverse($this->tmpl_search_path) as $path)
+ {
+ $filename = $path . '/' . $tmpl . '.xsl';
+ if (file_exists($filename))
+ {
+
$GLOBALS['phpgw']->xslttpl->xslfiles[$tmpl] = $filename;
+ return;
+ }
+ }
+ echo "Template $tmpl not found in search path: ";
+ print_r($this->tmpl_search_path);
+ die;
+ }
+
+ public function render_template($output)
+ {
+ $GLOBALS['phpgw']->common->phpgw_header(true);
+ if($this->flash_msgs)
+ {
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+ foreach($msgbox_data as & $message)
+ {
+ echo "<div
class='{$message['msgbox_class']}'>";
+ echo $message['msgbox_text'];
+ echo '</div>';
+ }
+ }
+ echo htmlspecialchars_decode($output);
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+
+ public function add_yui_translation(&$data)
+ {
+ $this->add_template_file('yui_booking_i18n');
+ $previous = lang('prev');
+ $next = lang('next');
+
+ $data['yui_booking_i18n'] = array(
+ 'Calendar' => array(
+ 'WEEKDAYS_SHORT' =>
json_encode(lang_array('Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa')),
+ 'WEEKDAYS_FULL' =>
json_encode(lang_array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
'Friday', 'Saturday')),
+ 'MONTHS_LONG' =>
json_encode(lang_array('January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December')),
+ ),
+ 'DataTable' => array(
+ 'MSG_EMPTY' => json_encode(lang('No
records found.')),
+ 'MSG_LOADING' =>
json_encode(lang("Loading...")),
+ 'MSG_SORTASC' =>
json_encode(lang('Click to sort ascending')),
+ 'MSG_SORTDESC' =>
json_encode(lang('Click to sort descending')),
+ ),
+ 'setupDatePickerHelper' => array(
+ 'LBL_CHOOSE_DATE' =>
json_encode(lang('Choose a date')),
+ ),
+ 'setupPaginator' => array(
+ 'pageReportTemplate' =>
json_encode(lang("Showing items {startRecord} - {endRecord} of
{totalRecords}")),
+ 'previousPageLinkLabel' =>
json_encode("< {$previous}"),
+ 'nextPageLinkLabel' =>
json_encode("{$next} >"),
+ ),
+ 'common' => array(
+ 'LBL_NAME' => json_encode(lang('Name')),
+ 'LBL_TIME' => json_encode(lang('Time')),
+ 'LBL_WEEK' => json_encode(lang('Week')),
+ 'LBL_RESOURCE' =>
json_encode(lang('Resource')),
+ ),
+ );
+ }
+
+
+ public function add_template_helpers() {
+ $this->add_template_file('helpers');
+ }
+
+ public function render_template_xsl($files, $data)
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+
+ if($this->flash_msgs) {
+ $data['msgbox_data'] =
$GLOBALS['phpgw']->common->msgbox($this->flash_msgs);
+ } else {
+ $this->add_template_file('msgbox');
+ }
+
+ $this->reset_flash_msgs();
+
+ $this->add_yui_translation($data);
+ $data['webserver_url'] =
$GLOBALS['phpgw_info']['server']['webserver_url'];
+
+ $output = phpgw::get_var('output', 'string', 'REQUEST',
'html');
+ $GLOBALS['phpgw']->xslttpl->set_output($output);
+ $this->add_template_file($files);
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('data' => $data));
+ }
+
+
+ public function check_active($url)
+ {
+ if($_SERVER['REQUEST_METHOD'] == 'POST')
+ {
+ $activate = extract_values($_POST,
array("status", "activate_id"));
+
$this->bo->set_active(intval($activate['activate_id']),
intval($activate['status']));
+ $this->redirect(array('menuaction' => $url,
'id' => $activate['activate_id']));
+ }
+ }
+
+ // Add link key to a result array
+ public function _add_links(&$value, $key, $menuaction)
+ {
+ $unset = 0;
+ // FIXME: Fugly workaround
+ // I cannot figure out why this variable isn't set, but
it is needed
+ // by the ->link() method, otherwise we wind up in the
phpgroupware
+ // errorhandler which does lot of weird things and
breaks the output
+ if
(!isset($GLOBALS['phpgw_info']['server']['webserver_url'])) {
+
$GLOBALS['phpgw_info']['server']['webserver_url'] = "/";
+ $unset = 1;
+ }
+
+ $value['link'] = self::link(array('menuaction' =>
$menuaction, 'id' => $value['id']));
+
+ // FIXME: Fugly workaround
+ // I kid you not my friend. There is something very
wonky going on
+ // in phpgroupware which I cannot figure out.
+ // If this variable isn't unset() (if it wasn't set
before that is)
+ // then it will contain extra slashes and break URLs
+ if ($unset) {
+
unset($GLOBALS['phpgw_info']['server']['webserver_url']);
+ }
+ }
+
+ // Build a YUI result style array
+ public function yui_results($results)
+ {
+ if (!$results) {
+ $results['total_records'] = 0;
+ $result['results'] = array();
+ }
+
+ return array(
+ 'ResultSet' => array(
+ 'totalRecords' =>
$results['total_records'],
+ 'recordsReturned' =>
count($results['results']),
+ 'startIndex' =>
$results['start'],
+ 'sortKey' =>
$results['sort'],
+ 'sortDir' =>
$results['dir'],
+ 'Result' =>
$results['results']
+ )
+ );
+ }
+
+ public function use_yui_editor($targets)
+ {
+ /*
+
self::add_stylesheet('phpgwapi/js/yahoo/assets/skins/sam/skin.css');
+ self::add_javascript('yahoo', 'yahoo/editor',
'simpleeditor-min.js');
+ */
+ $lang_font_style = lang('Font Style');
+ $lang_lists = lang('Lists');
+ $lang_insert_item = lang('Insert Item');
+ $js = '';
+ foreach ( $targets as $target )
+ {
+ $js .= <<<SCRIPT
+ (function() {
+ var Dom = YAHOO.util.Dom,
+ Event = YAHOO.util.Event;
+
+ var editorConfig = {
+ toolbar:
+ {buttons: [
+ { group: 'textstyle',
label: '{$lang_font_style}',
+ buttons: [
+ { type:
'push', label: 'Fet CTRL + SHIFT + B', value: 'bold' }
+ ]
+ },
+ { type: 'separator' },
+ { group: 'indentlist',
label: '{$lang_lists}',
+ buttons: [
+ { type:
'push', label: 'Opprett punktliste', value: 'insertunorderedlist' },
+ { type:
'push', label: 'Opprett nummerert liste', value: 'insertorderedlist' }
+ ]
+ },
+ { type: 'separator' },
+ { group: 'insertitem',
label: '{$lang_insert_item}',
+ buttons: [
+ { type:
'push', label: 'HTML Lenke CTRL + SHIFT + L', value: 'createlink', disabled:
true },
+ { type:
'push', label: 'Sett inn bilde', value: 'insertimage' }
+ ]
+ },
+ { type: 'separator' },
+ { group: 'undoredo',
label: 'Angre/Gjenopprett',
+ buttons: [
+ { type:
'push', label: 'Angre', value: 'undo' },
+ { type:
'push', label: 'Gjenopprett', value: 'redo' }
+ ]
+ }
+ ]
+ },
+ height: '200px',
+ width: '700px',
+ animate: true,
+ dompath: true,
+ handleSubmit: true
+ };
+
+ var editorWidget = new
YAHOO.widget.Editor('{$target}', editorConfig);
+ editorWidget.render();
+ })();
+
+SCRIPT;
+ }
+
+
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/editor/assets/skins/sam/editor.css');
+ phpgw::import_class('phpgwapi.yui');
+ phpgwapi_yui::load_widget('editor');
+ $GLOBALS['phpgw']->js->add_event('load', $js);
+ }
+
+ /**
+ * Returns formatted version of gab id. The format of the
string returned
+ * is '[Cadastral unit number] / [Property unit number] /
[Leasehold unit number] / [Section unit number]'.
+ *
+ * @param $gab_id string with id to to format.
+ * @return string formatted version of the string passed to the
method,
+ * or the same string if the one passed is of an incorrect
format.
+ */
+ public static function get_nicely_formatted_gab_id(string
$gab_id)
+ {
+ if(strlen($gab_id) == 20)
+ {
+ $gab_id = substr($gab_id,4,5).' /
'.substr($gab_id,9,4).' / '.substr($gab_id,13,4).' / '.substr($gab_id,17,3);
+ }
+ return $gab_id;
+ }
+
+ public function render($template,$local_variables = array())
+ {
+ foreach($local_variables as $name => $value)
+ {
+ $$name = $value;
+
+ }
+
+ ob_start();
+ foreach(array_reverse($this->tmpl_search_path) as $path)
+ {
+ $filename = $path . '/' . $template;
+ if (file_exists($filename))
+ {
+ include($filename);
+ break;
+ }
+ }
+ $output = ob_get_contents();
+ ob_end_clean();
+ self::render_template($output);
+ }
+
+ /**
+ * Method for JSON queries.
+ *
+ * @return YUI result
+ */
+ public abstract function query();
+
+ /**
+ * Generate javascript for the extra column definitions for a
partial list
+ *
+ * @param $array_name the name of the javascript variable that
contains the column definitions
+ * @param $extra_cols the list of extra columns to set
+ * @return string javascript
+ */
+ public static function get_extra_column_defs($array_name,
$extra_cols = array())
+ {
+ $result = "";
+
+ foreach($extra_cols as $col){
+ $literal = '{';
+ $literal .= 'key: "' . $col['key'] . '",';
+ $literal .= 'label: "' . $col['label'] . '"';
+ if (isset($col['formatter'])) {
+ $literal .= ',formatter: ' .
$col['formatter'];
+ }
+ if (isset($col['parser'])) {
+ $literal .= ',parser: ' .
$col['parser'];
+ }
+ $literal .= '}';
+
+ if($col["index"]){
+ $result .=
"{$array_name}.splice(".$col["index"].", 0,".$literal.");";
+ } else {
+ $result .=
"{$array_name}.push($literal);";
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Generate javascript definitions for any editor widgets set
on columns for
+ * a partial list.
+ *
+ * @param $array_name the name of the javascript variable that
contains the column definitions
+ * @param $editors the list of editors, keyed by column key
+ * @return string javascript
+ */
+ public static function get_column_editors($array_name, $editors
= array())
+ {
+ $result = "for (var i in {$array_name}) {\n";
+ $result .= " switch ({$array_name}[i].key) {\n";
+ foreach ($editors as $field => $editor) {
+ $result .= " case '{$field}':\n";
+ $result .= "
{$array_name}[i].editor = {$editor};\n";
+ $result .= " break;\n";
+ }
+ $result .= " }\n";
+ $result .= "}";
+
+ return $result;
+ }
+
+ /**
+ * Returns a html-formatted error message if one is defined in
the
+ * list of validation errors on the object we're given. If no
+ * error is defined, an empty string is returned.
+ *
+ * @param $object the object to display errors for
+ * @param $field the name of the attribute to display errors for
+ * @return string a html formatted error message
+ */
+ public static function get_field_error($object, $field)
+ {
+ if(isset($object))
+ {
+ $errors = $object->get_validation_errors();
+
+ if ($errors[$field]) {
+ return '<label class="error" for="' .
$field . '">' . $errors[$field] . '</label>';
+ }
+ return '';
+ }
+ }
+
+ public static function get_messages($messages, $message_type)
+ {
+ $output = '';
+ if(is_array($messages) && count($messages) > 0) //
Array of messages
+ {
+ $output = "<div class=\"{$message_type}\">";
+ foreach($messages as $message)
+ {
+ $output .= "<p
class=\"message\">{$message}</p>";
+ }
+ $output .= "</div>";
+ }
+ else if($messages) {
+ $output = "<div class=\"{$message_type}\"><p
class=\"message\">{$messages}</p></div>";
+ }
+ return $output;
+ }
+ /**
+ * Returns a html-formatted error message to display on top of
the page. If
+ * no error is defined, an empty string is returned.
+ *
+ * @param $error the error to display
+ * @return string a html formatted error message
+ */
+ public static function get_page_error($errors)
+ {
+ return self::get_messages($errors, 'error');
+ }
+
+ /**
+ * Returns a html-formatted error message to display on top of
the page. If
+ * no error is defined, an empty string is returned.
+ *
+ * @param $error the error to display
+ * @return string a html formatted error message
+ */
+ public static function get_page_warning($warnings)
+ {
+ return self::get_messages($warnings, 'warning');
+ }
+
+ /**
+ * Returns a html-formatted info message to display on top of
the page. If
+ * no message is defined, an empty string is returned.
+ *
+ * @param $message the message to display
+ * @return string a html formatted info message
+ */
+ public static function get_page_message($messages)
+ {
+ return self::get_messages($messages, 'info');
+ }
+
+ /**
+ * Download xls, csv or similar file representation of a data
table
+ */
+ public function download()
+ {
+ $list = $this->query();
+ $list = $list['ResultSet']['Result'];
+
+ $keys = array();
+
+ if(count($list[0]) > 0) {
+ foreach($list[0] as $key => $value) {
+ if(!is_array($value)) {
+ array_push($keys, $key);
+ }
+ }
+ }
+
+ // Remove newlines from output
+ $count = count($list);
+ for($i = 0; $i < $count; $i++)
+ {
+ foreach ($list[$i] as $key => &$data)
+ {
+ $data = str_replace(array("\n","\r\n",
"<br>"),'',$data);
+ }
+ }
+
+ // Use keys as headings
+ $headings = array();
+ $count_keys = count($keys);
+ for($j=0;$j<$count_keys;$j++)
+ {
+ array_push($headings, lang($keys[$j]));
+ }
+
+ $property_common = CreateObject('property.bocommon');
+ $property_common->download($list, $keys, $headings);
+ }
+
+ /**
+ * Added because error reporting facilities in phpgw tries to
serialize the PDO
+ * instance in $this->db which causes an error. This method
removes $this->db from the
+ * serialized values to avoid this problem.
+ */
+ public function __sleep()
+ {
+ return array('table_name', 'fields');
+ }
+ }
Copied: branches/Version-1_0-branch/registration/inc/class.uipending.inc.php
(from rev 9044, trunk/registration/inc/class.uipending.inc.php)
===================================================================
--- branches/Version-1_0-branch/registration/inc/class.uipending.inc.php
(rev 0)
+++ branches/Version-1_0-branch/registration/inc/class.uipending.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -0,0 +1,320 @@
+<?php
+ /**
+ * phpGroupWare - registration
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package registration
+ * @version $Id: class.uicheck_list.inc.php 8628 2012-01-21 10:42:05Z
vator $
+ */
+
+ phpgw::import_class('phpgwapi.yui');
+ phpgw::import_class('registration.uicommon');
+/*
+ include_class('registration', 'check_list', 'inc/model/');
+ include_class('registration', 'date_generator', 'inc/component/');
+ include_class('registration', 'status_checker', 'inc/helper/');
+ include_class('registration', 'date_helper', 'inc/helper/');
+*/
+ class registration_uipending extends registration_uicommon
+ {
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $currentapp;
+ var $type_id;
+ var $location_code;
+
+ private $so_control_area;
+ private $so_control;
+ private $so_check_list;
+ private $so_control_item;
+ private $so_check_item;
+ private $so_procedure;
+
+ var $public_functions = array
+ (
+ 'index'
=> true,
+ 'query'
=> true,
+ 'edit'
=> true
+ );
+
+ function __construct()
+ {
+ parent::__construct();
+
+ $this->bo =
CreateObject('registration.bopending',true);
+ $this->bocommon =
CreateObject('property.bocommon');
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->status_id =
$this->bo->status_id;
+ $this->allrows =
$this->bo->allrows;
+
+ self::set_active_menu('registration::pending');
+ }
+
+ function index()
+ {
+ if($values = phpgw::get_var('values'))
+ {
+ $values['pending_users'] =
isset($values['pending_users']) && $values['pending_users'] ?
array_unique($values['pending_users']) : array();
+ $values['pending_users_orig'] =
isset($values['pending_users_orig']) && $values['pending_users_orig'] ?
array_unique($values['pending_users_orig']) : array();
+
+ $receipt = $this->bo->approve_users($values);
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'registration.uipending.index'));
+ }
+ else
+ {
+ if(phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ return $this->query();
+ }
+
+ $status_list = array
+ (
+ array
+ (
+ 'id' => 0,
+ 'name' => lang('Select status')
+ ),
+ array
+ (
+ 'id' => 1,
+ 'name' => lang('approved')
+ ),
+ array
+ (
+ 'id' => 2,
+ 'name' => lang('pending')
+ ),
+ );
+
+ $data = array(
+ 'filter_form'
=> array(
+ 'status_list'
=> array('options' => $status_list)
+ ),
+ 'datatable' => array(
+ 'source' =>
self::link(array('menuaction' => 'registration.uipending.query',
'phpgw_return_as' => 'json')),
+ 'field' => array(
+ array(
+ 'key' => 'id',
+ 'hidden' => true
+ ),
+ array(
+ 'key' =>
'reg_id',
+ 'label' =>
lang('id'),
+ 'sortable'
=> true,
+ 'formatter' =>
'formatLinkPending'
+ ),
+ array(
+ 'key' =>
'reg_lid',
+ 'label' =>
lang('user'),
+ 'sortable'
=> true
+ ),
+ array(
+ 'key' =>
'reg_dla',
+ 'label' =>
lang('time'),
+ 'sortable'
=> true
+ ),
+ array(
+ 'key' =>
'reg_approved',
+ 'label' =>
lang('approved'),
+ 'sortable'
=> true,
+ 'formatter' =>
'FormatterCenter'
+ ),
+ array(
+ 'key' =>
'location_code',
+ 'label' =>
lang('location'),
+ 'sortable'
=> false
+ ),
+
+ array(
+ 'key'
=> 'checked',
+ 'label'
=> lang('approve'),
+
'sortable' => false,
+
'formatter' => 'formatterCheckPending',
+
'className' => 'mychecks'
+ ),
+ array(
+ 'key' =>
'actions',
+ 'hidden' => true
+ ),
+ array(
+ 'key' =>
'labels',
+ 'hidden' => true
+ ),
+ array(
+ 'key' => 'ajax',
+ 'hidden' => true
+ ),array(
+ 'key' =>
'parameters',
+ 'hidden' => true
+ )
+ )
+ )
+ );
+
+ phpgwapi_yui::load_widget('paginator');
+
+ self::add_javascript('registration', 'yahoo',
'pending.index.js');
+// self::add_javascript('registration',
'registration', 'jquery.js');
+// self::add_javascript('registration',
'registration', 'ajax.js');
+
+
self::render_template_xsl(array('pending_users', 'common'), $data);
+ }
+ }
+
+
+ public function edit()
+ {
+ $id = phpgw::get_var('id', 'string');
+ $bo = createobject('registration.boreg');
+
+ if(isset($_POST['save']) && $id)
+ {
+ $values = phpgw::get_var('values');
+
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record','property');
+ $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity','property');
+
+ if(isset($insert_record_entity) &&
is_array($insert_record_entity))
+ {
+ for
($j=0;$j<count($insert_record_entity);$j++)
+ {
+
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
+ }
+ }
+
+ $values =
$this->bocommon->collect_locationdata($values,$insert_record);
+
+ $values['id'] = $id;
+
+ if($this->bo->update_pending_user($values))
+ {
+ $message = lang('messages_saved_form');
+ phpgwapi_cache::message_set($message,
'message');
+ }
+ else
+ {
+ $error = lang('messages_form_error');
+ phpgwapi_cache::message_set($message,
'error');
+ }
+
+ }
+
+ if (isset($_POST['cancel'])) // The user has pressed
the cancel button
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'registration.uipending.index'));
+ }
+
+ if($id)
+ {
+ $user = $bo->get_pending_user($id);
+ }
+
+ $fields = $bo->fields;
+
+ $user_data = array();
+ $user_data[] = array
+ (
+ 'text' => 'username',
+ 'value' => $user['reg_lid']
+ );
+
+ foreach ($fields as $key => $field_info)
+ {
+ if($user['reg_info'][$field_info['field_name']])
+ {
+ $user_data[] = array
+ (
+ 'text' =>
$field_info['field_text'],
+ 'value' =>
$user['reg_info'][$field_info['field_name']]
+ );
+ }
+ }
+
+ $bolocation = CreateObject('property.bolocation');
+ $user['location_data'] =
isset($user['reg_info']['location_code']) && $user['reg_info']['location_code']
? $bolocation->read_single($user['reg_info']['location_code'],array('view' =>
true)) : '';
+
+
+/*
+_debug_array($user);
+_debug_array($user_data);
+_debug_array($fields);
+die();
+*/
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' => $user['location_data'],
+ 'type_id' => -1,
+ 'no_link' => false, // disable lookup
links for location type less than type_id
+ 'tenant' => false,
+ 'lookup_type' => 'form',
+ 'lookup_entity' => false,
+ 'entity_data' => false
+ ));
+
+
+ $data = array
+ (
+ 'value_id' => $id,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'editable' => true,
+ 'user_data' =>
$user_data,
+ 'location_data' =>
$location_data
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('registration') . '::' . lang('edit user');
+
+ self::render_template_xsl('user_edit', $data);
+ }
+
+ public function query()
+ {
+ $status_id = phpgw::get_var('status_id');
+
+ $this->bo->start = phpgw::get_var('startIndex');
+
+ $user_list = $this->bo->read(array('user_id' =>
$user_id, 'role_id' =>$role_id,
'type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,
+
'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run'
=>$dry_run));
+
+ foreach($user_list as &$user)
+ {
+ $reg_info =
unserialize(base64_decode($user['reg_info']));
+ $user['location_code'] =
$reg_info['location_code'];
+ $results['results'][]= $user;
+ }
+ $results['total_records'] = $this->bo->total_records;
+ $results['start'] = $this->start;
+ $results['sort'] = 'location_code';
+ $results['dir'] = $this->bo->sort ? $this->bo->sort :
'ASC';
+
+ array_walk($results['results'], array($this,
'add_links'), array($type));
+
+ return $this->yui_results($results);
+ }
+ }
Modified: branches/Version-1_0-branch/registration/inc/class.uireg.inc.php
===================================================================
--- branches/Version-1_0-branch/registration/inc/class.uireg.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/registration/inc/class.uireg.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -209,16 +209,15 @@
}
$this->template->set_block ('form',
'other_fields_proto', 'other_fields_list');
-
reset ($this->fields);
- while (list ($num, $field_info) = each ($this->fields))
+ foreach ($this->fields as $num => $field_info)
{
$input_field = $this->get_input_field
($field_info, $post_values);
$var = array (
'missing_indicator' =>
$missing[$field_info['field_name']] ? '<font color="#CC0000">*</font>' : '',
'bold_start' =>
$field_info['field_required'] == 'Y' ? '<b>' : '',
'bold_end' =>
$field_info['field_required'] == 'Y' ? '</b>' : '',
- 'lang_displayed_text' => lang
($field_info['field_text']),
+ 'lang_displayed_text' => ltrim(lang
($field_info['field_text']),'!'),
'input_field' => $input_field
);
@@ -314,8 +313,6 @@
function get_input_field ($field_info, $post_values)
{
-// global $r_regs, $o_regs;
-
$post_value = $post_values[$field_info['field_name']];
$name = $field_info['field_name'];
@@ -368,11 +365,11 @@
else
{
$rstring = '<select name="' . $a . '['
. $name . ']"><option value=""> </option>';
- while (list (,$value) = each ($values))
+ foreach ($values as $value)
{
$value = trim ($value);
- unset ($selected);
+ $selected = '';
if ($value == $post_value)
{
$selected = "selected";
Modified: branches/Version-1_0-branch/registration/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/registration/setup/phpgw_no.lang
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/registration/setup/phpgw_no.lang
2012-03-27 08:57:00 UTC (rev 9045)
@@ -2,8 +2,11 @@
account registration registration no Ny bruker
address registration no Adresse
after you enter your username, instructions to change your password will be
sent to you by e-mail to the address you gave when you registered. registration
no Etter at du angir ditt brukernavn, vil du få en e-post til den
adressen du oppga ved registrering for å resette passordet
+Birthday registration no Fødselsdag
change password for user registration no Bytt passord for user
checkbox registration no Checkbox
+City registration no Poststed
+Country registration no Land
current fields: registration no Gjeldende felt:
dropdown registration no Dropdown
enter your new password registration no Skriv inn ditt nye
passord
@@ -24,8 +27,9 @@
textarea registration no Tekstfelt
the passwords you entered don't match registration no Passordene du
anga er ikke like
the two passwords are not the same registration no Passordene er
ikke de samme
+Select One registration no Velg fra liste
type registration no Type
-update/add registration no Update/Add
+update/add registration no Oppdater/Legg til
Username registration no Brukernavn
values (for dropdown only; comma separated) registration no Verdi
(bare for Dropdown; comma separert)
wrong session registration no Feil session
Modified: branches/Version-1_0-branch/registration/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/registration/setup/setup.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/registration/setup/setup.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -16,7 +16,7 @@
/* Basic information about this app */
$setup_info['registration']['name'] =
'registration';
- $setup_info['registration']['version'] = '0.8.2';
+ $setup_info['registration']['version'] = '0.8.3';
$setup_info['registration']['app_order'] = '90';
$setup_info['registration']['enable'] = 2;
$setup_info['registration']['app_group'] = 'other';
Modified: branches/Version-1_0-branch/registration/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/registration/setup/tables_current.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/registration/setup/tables_current.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -22,7 +22,8 @@
'reg_id' => array('type' => 'varchar',
'precision' => 32,'nullable' => False),
'reg_lid' => array('type' => 'varchar',
'precision' => 255,'nullable' => False),
'reg_info' => array('type' => 'text','nullable'
=> False),
- 'reg_dla' => array('type' => 'int', 'precision'
=> 4,'nullable' => False)
+ 'reg_dla' => array('type' => 'int', 'precision'
=> 4,'nullable' => False),
+ 'reg_approved' => array('type' => 'int',
'precision' => 2,'nullable' => true)
),
'pk' => array(),
'fk' => array(),
Modified: branches/Version-1_0-branch/registration/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/registration/setup/tables_update.inc.php
2012-03-27 08:54:12 UTC (rev 9044)
+++ branches/Version-1_0-branch/registration/setup/tables_update.inc.php
2012-03-27 08:57:00 UTC (rev 9045)
@@ -14,8 +14,6 @@
$test[] = '0.8.1';
function registration_upgrade0_8_1()
{
- global $setup_info, $phpgw_setup;
-
$phpgw_setup->oProc->CreateTable('phpgw_reg_fields', array(
'fd' => array(
'field_name' => array('type' => 'varchar',
'precision' => 255,'nullable' => False),
@@ -31,8 +29,20 @@
'uc' => array()
));
- $setup_info['registration']['currentver'] = '0.8.2';
- return $setup_info['registration']['currentver'];
+ $GLOBALS['setup_info']['registration']['currentver'] = '0.8.2';
+ return $GLOBALS['setup_info']['registration']['currentver'];
}
-?>
\ No newline at end of file
+ $test[] = '0.8.2';
+ function registration_upgrade0_8_2()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_reg_accounts','reg_approved',array('type'
=> 'int','precision' => 2, 'nullable' => True));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['registration']['currentver'] =
'0.8.3';
+ return
$GLOBALS['setup_info']['registration']['currentver'];
+ }
+ }
Copied: branches/Version-1_0-branch/registration/templates/base/app_data.xsl
(from rev 9044, trunk/registration/templates/base/app_data.xsl)
===================================================================
--- branches/Version-1_0-branch/registration/templates/base/app_data.xsl
(rev 0)
+++ branches/Version-1_0-branch/registration/templates/base/app_data.xsl
2012-03-27 08:57:00 UTC (rev 9045)
@@ -0,0 +1,4 @@
+<!-- $Id: app_data.xsl 8267 2011-12-11 12:27:18Z sigurdne $ -->
+ <xsl:template name="dummy">
+ </xsl:template>
+
Copied: branches/Version-1_0-branch/registration/templates/base/common.xsl
(from rev 9044, trunk/registration/templates/base/common.xsl)
===================================================================
--- branches/Version-1_0-branch/registration/templates/base/common.xsl
(rev 0)
+++ branches/Version-1_0-branch/registration/templates/base/common.xsl
2012-03-27 08:57:00 UTC (rev 9045)
@@ -0,0 +1,535 @@
+<!-- $Id: common.xsl 8307 2011-12-15 08:59:28Z vator $ -->
+<xsl:template name="common" xmlns:php="http://php.net/xsl">
+
+
+<script type="text/javascript">
+
+<![CDATA[
+
+/**
+ * Javascript for the controller module. Holds datasource init functions and
form helpers.
+ *
+ * Functions and objects within this file are kept in the YAHOO.controller
namespace.
+ */
+
+ YAHOO.namespace('controller');
+
+ // Holds data source setup funtions
+ YAHOO.controller.setupDatasource = new Array();
+
+ //Holds all data sources
+ YAHOO.controller.datatables = new Array();
+
+ counter = 0;
+ // Adds data source setup funtions
+ function setDataSource(source_url, column_defs, form_id, filter_ids,
container_id, paginator_id, datatable_id,rel_id, editor_action,
disable_left_click) {
+ YAHOO.controller.setupDatasource.push(
+ function() {
+ this.url = source_url;
+ this.columns = column_defs;
+ this.form = form_id;
+ this.filters = filter_ids;
+ this.container = container_id;
+ this.paginator = paginator_id;
+ this.tid = datatable_id;
+ this.related_datatable = rel_id;
+ this.editor_action = editor_action;
+ if(disable_left_click) {
+ this.disable_left_click = true;
+ } else {
+ this.disable_left_click = false;
+ }
+ }
+ );
+ }
+
+ // Reloads all data sources that are necessary based on the selected
related datatable
+ function reloadDataSources(selected_datatable){
+
+ //... hooks into the regular callback function
(onDataReturnInitializeTable) call to set empty payload array
+ var loaded = function ( sRequest , oResponse , oPayload ) {
+ var payload = new Array();
+ this.onDataReturnInitializeTable( sRequest , oResponse
, payload );
+ }
+
+ //... refresh the selected data tables
+
selected_datatable.getDataSource().sendRequest('',{success:loaded,
scope:selected_datatable});
+
+ //... traverse all datatables and refresh related (to the
selected) data tables
+ for(var i=0; i<YAHOO.controller.datatables.length; i++){
+ var datatable = YAHOO.controller.datatables[i];
+
+ for(var j=0;j<selected_datatable.related.length;j++){
+ var curr_related =
selected_datatable.related[j];
+
+ if(datatable.tid == curr_related){
+
datatable.getDataSource().sendRequest('',{success:loaded,scope: datatable});
+ }
+ }
+ }
+ }
+
+ var highlightEditableCell = function(oArgs) {
+ var elCell = oArgs.target;
+ if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
+ this.highlightCell(elCell);
+ }
+ };
+
+ // Wraps data sources setup logic
+ function dataSourceWrapper(source_properties,pag) {
+
+ this.properties = source_properties;
+ this.paginator = pag;
+
+ //... prepare base url
+ this.url = this.properties.url;
+ if(this.url[length-1] != '&') {
+ this.url += '&';
+ }
+
+ //... set up a new data source
+ this.source = new YAHOO.util.DataSource(this.url);
+
+ this.source.responseType = YAHOO.util.DataSource.TYPE_JSON;
+ this.source.connXhrMode = "queueRequests";
+
+ this.source.responseSchema = {
+ resultsList: "ResultSet.Result",
+ fields: this.properties.columns,
+ metaFields : {
+ totalRecords: "ResultSet.totalRecords"
+ }
+ };
+
+ //... set up a new data table
+
+ ]]>
+
+ this.table = new YAHOO.widget.DataTable(
+ this.properties.container,
+ this.properties.columns,
+ this.source,
+ {
+ paginator: this.paginator,
+ dynamicData: true,
+ MSG_EMPTY: '<xsl:value-of
select="php:function('lang', 'DATATABLE_MSG_EMPTY')"/>',
+ MSG_ERROR: '<xsl:value-of
select="php:function('lang', 'DATATABLE_MSG_ERROR')"/>',
+ MSG_LOADING: '<xsl:value-of
select="php:function('lang', 'DATATABLE_MSG_LOADING')"/>'
+ }
+ );
+
+ <![CDATA[
+
+ //... set table properties
+ this.table.related = this.properties.related_datatable;
+ this.table.tid = this.properties.tid;
+ this.table.container_id = this.properties.container;
+ this.table.editor_action = this.properties.editor_action;
+
+ //... push the data table on a stack
+ YAHOO.controller.datatables.push(this.table);
+
+ //... ?
+ this.table.handleDataReturnPayload = function(oRequest,
oResponse, oPayload) {
+ if(oPayload){
+ oPayload.totalRecords =
oResponse.meta.totalRecords;
+ return oPayload;
+ }
+ }
+
+ //... create context menu for each record after the table has
loaded the data
+ this.table.doAfterLoadData = function() {
+ onContextMenuBeforeShow = function(p_sType, p_aArgs)
+ {
+ var oTarget = this.contextEventTarget;
+ if (this.getRoot() == this)
+ {
+ if(oTarget.tagName != "TD")
+ {
+ oTarget =
YAHOO.util.Dom.getAncestorByTagName(oTarget, "td");
+ }
+ oSelectedTR =
YAHOO.util.Dom.getAncestorByTagName(oTarget, "tr");
+ oSelectedTR.style.backgroundColor =
'#AAC1D8' ;
+ oSelectedTR.style.color = "black";
+ YAHOO.util.Dom.addClass(oSelectedTR,
prefixSelected);
+ }
+ }
+
+ onContextMenuHide = function(p_sType, p_aArgs)
+ {
+ if (this.getRoot() == this && oSelectedTR)
+ {
+ oSelectedTR.style.backgroundColor = ""
;
+ oSelectedTR.style.color = "";
+ YAHOO.util.Dom.removeClass(oSelectedTR,
prefixSelected);
+ }
+ }
+
+ var records = this.getRecordSet();
+
+ var validRecords = 0;
+ for(var i=0; i<records.getLength(); i++) {
+ var record = records.getRecord(i);
+
+ if(record == null)
+ {
+ continue;
+ }
+ else
+ {
+ validRecords++;
+ }
+
+ // use a global counter to create unique names
(even for the same datatable) for all context menues on the page
+ var menuName = this.container_id + "_cm_" +
counter;
+ counter++;
+
+ //... add menu items with label and handler
function for click events
+ var labels = record.getData().labels;
+
+ //create a context menu that triggers on the
HTML row element
+ record.menu = new
YAHOO.widget.ContextMenu(menuName,{trigger:this.getTrEl(validRecords -1
),itemdata: labels, lazyload: true});
+
+ //... subscribe handler for click events
+
record.menu.clickEvent.subscribe(onContextMenuClick, this);
+ record.menu.subscribe("beforeShow",
onContextMenuBeforeShow);
+ record.menu.subscribe("hide",
onContextMenuHide);
+
+ //... render the menu on the related table row
+
record.menu.render(this.getTrEl(validRecords-1));
+ }
+
+
+ }
+
+ //... calback methods for handling ajax calls
+ var ajaxResponseSuccess = function(o){
+ reloadDataSources(this.args);
+ };
+
+ var ajaxResponseFailure = function(o){
+ reloadDataSources(this.args);
+ };
+
+ //...create a handler for context menu clicks
+ var onContextMenuClick = function(eventString, args, table) {
+ //... the argument holds the selected index number in
the context menu
+ var task = args[1];
+
+ //... only act on a data table
+ if(table instanceof YAHOO.widget.DataTable) {
+ //... retrieve the record based on the selected
table row
+ var row =
table.getTrEl(this.contextEventTarget);
+ var record = table.getRecord(row);
+ var requestUrl = "";
+
+ if(record.getData().parameters[task.index]){
+ var parameter_id =
record.getData().parameters[0];
+
+ var parameter_value =
YAHOO.util.Dom.get(parameter_id).value;
+ requestUrl = record.getData().actions[
task.index ] + "&" + parameter_id + "=" + parameter_value;
+ }
+
+ //... check whether this action should be an
AJAX call
+ if( record.getData().ajax[task.index] ) {
+
+ var alertStatus = false;
+
+ // Check if confirm box should be
displayed before request is executed
+ if( record.getData().alert != null )
+ alertStatus =
record.getData().alert[0];
+
+ if( alertStatus ){
+ // Display confirm box with
message
+ var alertMessage =
record.getData().alert[1];
+ var answer = confirm(
alertMessage );
+
+ // Abort request if user clicks
the abort button
+ if (!answer){
+ return false;
+ }
+ }
+
+ if(requestUrl){
+ var request =
YAHOO.util.Connect.asyncRequest(
+ 'GET',
+ requestUrl,
+ {
+ success:
ajaxResponseSuccess,
+ success:
ajaxResponseFailure,
+ args: table
+ });
+ }
+ } else {
+
+ window.location = requestUrl;
+ }
+ }
+ };
+
+ // Handle mouseover and click events for inline editing
+ this.table.subscribe("cellMouseoverEvent",
highlightEditableCell);
+ this.table.subscribe("cellMouseoutEvent",
this.table.onEventUnhighlightCell);
+ this.table.subscribe("cellClickEvent",
this.table.onEventShowCellEditor);
+
+ this.table.subscribe("editorSaveEvent", function(oArgs) {
+ var field = oArgs.editor.getColumn().field;
+ var value = oArgs.newData;
+ var id = oArgs.editor.getRecord().getData().id;
+ var action = oArgs.editor.getDataTable().editor_action;
+
+ // Translate to unix time if the editor is a calendar.
+ if (oArgs.editor._sType == 'date') {
+ var selectedDate =
oArgs.editor.calendar.getSelectedDates()[0];
+ //alert("selDate1: " + selectedDate);
+ // Make sure we're at midnight GMT
+ selectedDate = selectedDate.toString().split("
");
+ //for(var e=0;e<selectedDate.length;e++){
+ // alert("element " + e + ": " +
selectedDate[e]);
+ //}
+ if(selectedDate[3] == "00:00:00"){
+ // alert("seldate skal byttes!");
+ selectedDate =
selectedDate.slice(0,3).join(" ") + " " + selectedDate[5] + " 00:00:00 GMT";
+ }
+ else{
+ selectedDate =
selectedDate.slice(0,4).join(" ") + " 00:00:00 GMT";
+ }
+ //selectedDate =
selectedDate.toString().split(" ").slice(0, 4).join(" ") + " 00:00:00 GMT";
+ //alert("selDate2: " + selectedDate);
+ var value = Math.round(Date.parse(selectedDate)
/ 1000);
+ //alert("selDate3 value: " + value);
+ }
+
+ var request = YAHOO.util.Connect.asyncRequest(
+ 'GET',
+ 'index.php?menuaction=' + action +
"&field=" + field + "&value=" + value + "&id=" + id,
+ {
+ success: ajaxResponseSuccess,
+ failure: ajaxResponseFailure,
+ args:oArgs.editor.getDataTable()
+ }
+ );
+ });
+
+ // Don't set the row to be left-clickable if the table is
editable by inline editors.
+ // In that case we use cellClickEvents instead
+ var table_should_be_clickable = true;
+ for (i in this.properties.columns) {
+ if (this.properties.columns[i].editor) {
+ table_should_be_clickable = false;
+ }
+ }
+
+ if (table_should_be_clickable &&
!this.properties.disable_left_click) {
+ //... create a handler for regular clicks on a table row
+ this.table.subscribe("rowClickEvent", function(e,obj) {
+ YAHOO.util.Event.stopEvent(e);
+
+ //... trigger first action on row click
+ var row = obj.table.getTrEl(e.target);
+ if(row) {
+ var record = obj.table.getRecord(row);
+
+ //... check whether this action should
be an AJAX call
+ if(record.getData().ajax[0]) {
+ var request =
YAHOO.util.Connect.asyncRequest(
+ 'GET',
+ //... execute first
action
+
record.getData().actions[0],
+ {
+ success:
ajaxResponseSuccess,
+ failure:
ajaxResponseFailure,
+ args:obj.table
+ }
+ );
+ } else {
+ //... execute first action
+ window.location =
record.getData().actions[0];
+ }
+ }
+ },this);
+
+ //... highlight rows on mouseover. This too only
happens if the table is
+ // not editable.
+ this.table.subscribe("rowMouseoverEvent",
this.table.onEventHighlightRow);
+ this.table.subscribe("rowMouseoutEvent",
this.table.onEventUnhighlightRow);
+ }
+
+
+ //... create context menues when the table renders
+ this.table.subscribe("renderEvent",this.table.doAfterLoadData);
+
+ //... listen for form submits and filter changes
+
YAHOO.util.Event.addListener(this.properties.form,'submit',formListener,this,true);
+ YAHOO.util.Event.addListener(this.properties.filters,
'change',formListener,this,true);
+ }
+
+
+ // Set up data sources when the document has loaded
+ YAHOO.util.Event.addListener(window, "load", function() {
+ var i = 0;
+ while(YAHOO.controller.setupDatasource.length > 0){
+ //... create a variable name, assign set up function to
that variable and instantiate properties
+ variableName = "YAHOO.controller.datasource" + i;
+ eval(variableName + " =
YAHOO.controller.setupDatasource.shift()");
+ var source_properties = eval("new " + variableName +
"()");
+
+]]>
+ // ... create a paginator for this datasource
+
+ var pag = new YAHOO.widget.Paginator({
+ rowsPerPage: 10,
+ alwaysVisible: true,
+ rowsPerPageOptions: [5, 10, 25, 50, 100, 200],
+ firstPageLinkLabel: "<< <xsl:value-of
select="php:function('lang', 'first')"/>",
+ previousPageLinkLabel: "< <xsl:value-of
select="php:function('lang', 'previous')"/>",
+ nextPageLinkLabel: "<xsl:value-of
select="php:function('lang', 'next')"/> >",
+ lastPageLinkLabel: "<xsl:value-of
select="php:function('lang', 'last')"/> >>",
+ template :
"{RowsPerPageDropdown}<xsl:value-of select="php:function('lang',
'elements_pr_page')"/>.{CurrentPageReport}<br/> {FirstPageLink}
{PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}",
+ pageReportTemplate : "<xsl:value-of
select="php:function('lang', 'shows_from')"/> {startRecord} <xsl:value-of
select="php:function('lang', 'to')"/> {endRecord} <xsl:value-of
select="php:function('lang', 'of_total')"/> {totalRecords}.",
+ containers: [source_properties.paginator]
+ });
+
+<![CDATA[
+
+ pag.render();
+
+ //... send data source properties and paginator to
wrapper function
+ this.wrapper = new dataSourceWrapper(source_properties,
pag);
+ i+=1;
+/*
+ <?php
+ $populate = phpgw::get_var('populate_form');
+ if(isset($populate)){?>
+ var qs =
YAHOO.controller.serializeForm(source_properties.form);
+ this.wrapper.source.liveData =
this.wrapper.url + qs + '&';
+ this.wrapper.source.sendRequest('',
{success: function(sRequest, oResponse, oPayload) {
+
this.wrapper.table.onDataReturnInitializeTable(sRequest, oResponse,
this.wrapper.paginator);
+ }, scope: this});
+ <?php }
+ ?>
+*/
+ // XXX: Create generic column picker for all datasources
+
+ // Shows dialog, creating one when necessary
+ var newCols = true;
+ var showDlg = function(e) {
+ YAHOO.util.Event.stopEvent(e);
+
+ if(newCols) {
+ // Populate Dialog
+ // Using a template to create elements
for the SimpleDialog
+ var allColumns =
this.wrapper.table.getColumnSet().keys;
+ var elPicker =
YAHOO.util.Dom.get("dt-dlg-picker");
+ var elTemplateCol =
document.createElement("div");
+ YAHOO.util.Dom.addClass(elTemplateCol,
"dt-dlg-pickercol");
+ var elTemplateKey =
elTemplateCol.appendChild(document.createElement("span"));
+ YAHOO.util.Dom.addClass(elTemplateKey,
"dt-dlg-pickerkey");
+ var elTemplateBtns =
elTemplateCol.appendChild(document.createElement("span"));
+ YAHOO.util.Dom.addClass(elTemplateBtns,
"dt-dlg-pickerbtns");
+ var onclickObj = {fn:handleButtonClick,
obj:this, scope:false };
+
+ // Create one section in the
SimpleDialog for each Column
+ var elColumn, elKey, elButton,
oButtonGrp;
+
+ for(var
i=0,l=allColumns.length;i<l;i++) {
+ var oColumn = allColumns[i];
+ if(oColumn.label !=
'unselectable') { // We haven't marked the column as unselectable for the user
+ // Use the template
+ elColumn =
elTemplateCol.cloneNode(true);
+
+ // Write the Column key
+ elKey =
elColumn.firstChild;
+ elKey.innerHTML =
oColumn.label;
+
+ // Create a ButtonGroup
+ oButtonGrp = new
YAHOO.widget.ButtonGroup({
+ id:
"buttongrp"+i,
+ name:
oColumn.getKey(),
+ container:
elKey.nextSibling
+ });
+ oButtonGrp.addButtons([
+ { label: "Vis",
value: "Vis", checked: ((!oColumn.hidden)), onclick: onclickObj},
+ { label:
"Skjul", value: "Skjul", checked: ((oColumn.hidden)), onclick: onclickObj}
+ ]);
+
+
elPicker.appendChild(elColumn);
+ }
+ }
+
+ newCols = false;
+ }
+
+ myDlg.show();
+ };
+
+ var storeColumnsUrl = YAHOO.controller.storeColumnsUrl;
+ var hideDlg = function(e) {
+ this.hide();
+ // After we've hidden the dialog we send a post
call to store the columns the user has selected
+ var postData = 'values[save]=1';
+ var allColumns =
wrapper.table.getColumnSet().keys;
+ for(var i=0; i < allColumns.length; i++) {
+ if(!allColumns[i].hidden){
+ postData +=
'&values[columns][]=' + allColumns[i].getKey();
+ }
+ }
+
+ YAHOO.util.Connect.asyncRequest('POST',
storeColumnsUrl, null, postData);
+ };
+
+ var handleButtonClick = function(e, oSelf) {
+ var sKey = this.get("name");
+ if(this.get("value") === "Skjul") {
+ // Hides a Column
+ wrapper.table.hideColumn(sKey);
+ } else {
+ // Shows a Column
+ wrapper.table.showColumn(sKey);
+ }
+ };
+
+ // Create the SimpleDialog
+ YAHOO.util.Dom.removeClass("dt-dlg", "inprogress");
+ var myDlg = new YAHOO.widget.SimpleDialog("dt-dlg", {
+ width: "30em",
+ visible: false,
+ modal: false, // modal: true doesn't work for
some reason - the dialog becomes unclickable
+ buttons: [
+ {text:"Lukk", handler:hideDlg}
+ ],
+ fixedcenter: true,
+ constrainToViewport: true
+ });
+ myDlg.render();
+
+ // Nulls out myDlg to force a new one to be created
+ wrapper.table.subscribe("columnReorderEvent",
function(){
+ newCols = true;
+ YAHOO.util.Event.purgeElement("dt-dlg-picker",
true);
+ YAHOO.util.Dom.get("dt-dlg-picker").innerHTML =
"";
+ }, this, true);
+
+ // Hook up the SimpleDialog to the link
+ YAHOO.util.Event.addListener("dt-options-link",
"click", showDlg, this, true);
+ }
+ });
+
+ /*
+ * Listen for events in form. Serialize all form elements. Stop
+ * the original request and send new request.
+ */
+ function formListener(event){
+ YAHOO.util.Event.stopEvent(event);
+ var qs = YAHOO.portico.serializeForm(this.properties.form);
+ this.source.liveData = this.url + qs + '&';
+ this.source.sendRequest('', {success: function(sRequest,
oResponse, oPayload) {
+ this.table.onDataReturnInitializeTable(sRequest,
oResponse, this.paginator);
+ }, scope: this});
+ }
+
+]]>
+
+</script>
+</xsl:template>
Copied:
branches/Version-1_0-branch/registration/templates/base/pending_users.xsl (from
rev 9044, trunk/registration/templates/base/pending_users.xsl)
===================================================================
--- branches/Version-1_0-branch/registration/templates/base/pending_users.xsl
(rev 0)
+++ branches/Version-1_0-branch/registration/templates/base/pending_users.xsl
2012-03-27 08:57:00 UTC (rev 9045)
@@ -0,0 +1,147 @@
+<!-- $Id: pending_users.xsl 8854 2012-02-14 07:54:40Z vator $ -->
+
+<func:function name="phpgw:conditional">
+ <xsl:param name="test"/>
+ <xsl:param name="true"/>
+ <xsl:param name="false"/>
+
+ <func:result>
+ <xsl:choose>
+ <xsl:when test="$test">
+ <xsl:value-of select="$true"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$false"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </func:result>
+</func:function>
+
+<!-- separate tabs and inline tables-->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl">
+<div class="yui-navset yui-navset-top" id="pending_for_approval_tabview">
+ <div class="identifier-header">
+ <h1><xsl:value-of select="php:function('lang', 'Pending for
approval')"/></h1>
+ </div>
+ <xsl:call-template name="pending_users" />
+</div>
+
+</xsl:template>
+
+<xsl:template name="pending_users" xmlns:php="http://php.net/xsl">
+ <!-- IMPORTANT!!! Loads YUI javascript -->
+ <xsl:call-template name="common"/>
+
+ <div class="yui-content">
+ <div id="control_details">
+ <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:apply-templates select="filter_form" />
+ <xsl:apply-templates select="paging"/>
+ <xsl:apply-templates select="datatable"/>
+ <xsl:apply-templates select="form/list_actions"/>
+ </div>
+ </div>
+</xsl:template>
+
+
+<xsl:template match="filter_form" xmlns:php="http://php.net/xsl">
+
+ <form id="queryForm">
+ <xsl:attribute name="method">
+ <xsl:value-of select="phpgw:conditional(not(method),
'GET', method)"/>
+ </xsl:attribute>
+
+ <xsl:attribute name="action">
+ <xsl:value-of select="phpgw:conditional(not(action),
'', action)"/>
+ </xsl:attribute>
+ <xsl:call-template name="filter_list"/>
+ </form>
+
+ <form id="update_table_dummy" method='POST' action='' ></form>
+
+</xsl:template>
+
+<xsl:template name="filter_list" xmlns:php="http://php.net/xsl">
+ <ul id="filters">
+ <li>
+ <select id="status_id" name="status_id">
+ <xsl:apply-templates select="status_list/options"/>
+ </select>
+ </li>
+ </ul>
+ <ul id="search_list">
+ <li>
+ <input type="text" name="query" />
+ </li>
+ <li>
+ <xsl:variable name="lang_search"><xsl:value-of
select="php:function('lang', 'Search')" /></xsl:variable>
+ <input type="submit" name="search"
value="{$lang_search}" title = "{$lang_search}" />
+ </li>
+ </ul>
+</xsl:template>
+
+<xsl:template match="datatable" xmlns:php="http://php.net/xsl">
+ <div id="data_paginator"/>
+ <div class="error_msg" style="margin-left:20px;">Du må velge bruker for
godkjenning</div>
+ <div id="datatable-container"/>
+
+ <xsl:call-template name="datasource-definition" />
+ <xsl:variable name="label_submit"><xsl:value-of
select="php:function('lang', 'save')" /></xsl:variable>
+ <xsl:variable name="label_checkAll"><xsl:value-of
select="php:function('lang', 'invert_checkboxes')" /></xsl:variable>
+ <div><input type="button" id="select_all" value="{$label_checkAll}"
onclick="checkAll('mychecks')"/></div>
+
+ <form action="#" name="user_form" id="user_form" method="post">
+ <div class="user_submit"><input type="submit"
name="values[save_user]" id="save_user" value="{$label_submit}" onclick="return
onSave()"/></div>
+ </form>
+</xsl:template>
+
+
+<xsl:template name="datasource-definition" xmlns:php="http://php.net/xsl">
+ <script>
+ YAHOO.namespace('controller');
+
+ YAHOO.controller.columnDefs = [
+ <xsl:for-each select="//datatable/field">
+ {
+ key: "<xsl:value-of
select="key"/>",
+ <xsl:if test="label">
+ label: "<xsl:value-of
select="label"/>",
+ </xsl:if>
+ sortable: <xsl:value-of
select="phpgw:conditional(not(sortable = 0), 'true', 'false')"/>,
+ <xsl:if test="hidden">
+ hidden: true,
+ </xsl:if>
+ <xsl:if test="formatter">
+ formatter: <xsl:value-of
select="formatter"/>,
+ </xsl:if>
+ className: "<xsl:value-of
select="className"/>"
+ }<xsl:value-of
select="phpgw:conditional(not(position() = last()), ',', '')"/>
+ </xsl:for-each>
+ ];
+
+ var main_source = '<xsl:value-of select="source"/>';
+ var main_columnDefs = YAHOO.controller.columnDefs;
+ var main_form = 'queryForm';
+ var main_filters = ['status_id', 'responsibility_roles_list'];
+ var main_container = 'datatable-container';
+ var main_table_id = 'datatable';
+ var main_pag = 'data_paginator';
+ var related_table = new Array('users_table');
+
+ setDataSource(main_source, main_columnDefs, main_form,
main_filters, main_container, main_pag, main_table_id, related_table );
+
+ </script>
+
+</xsl:template>
+
+<!-- options for use with select-->
+<xsl:template match="options">
+ <option value="{id}">
+ <xsl:if test="selected != 0">
+ <xsl:attribute name="selected" value="selected"/>
+ </xsl:if>
+ <xsl:value-of disable-output-escaping="yes" select="name"/>
+ </option>
+</xsl:template>
+
Copied: branches/Version-1_0-branch/registration/templates/base/user_edit.xsl
(from rev 9044, trunk/registration/templates/base/user_edit.xsl)
===================================================================
--- branches/Version-1_0-branch/registration/templates/base/user_edit.xsl
(rev 0)
+++ branches/Version-1_0-branch/registration/templates/base/user_edit.xsl
2012-03-27 08:57:00 UTC (rev 9045)
@@ -0,0 +1,57 @@
+<!-- $Id: control_item.xsl 8913 2012-02-17 10:14:42Z erikhl $ -->
+<!-- item -->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl">
+
+<xsl:call-template name="yui_booking_i18n"/>
+<div class="identifier-header">
+<h1><img src="{img_go_home}" />
+ <xsl:value-of select="php:function('lang', 'edit user')" />
+</h1>
+</div>
+ <div class="yui-content">
+ <div id="details">
+ <form action="#" method="post" name="form">
+ <input type="hidden" name="id" value =
"{value_id}">
+ </input>
+ <table>
+ <xsl:for-each select="user_data">
+ <tr>
+ <td>
+ <xsl:value-of
select="text"/>
+ </td>
+ <td>
+ <xsl:value-of
select="value"/>
+ </td>
+ </tr>
+ </xsl:for-each>
+ <xsl:call-template
name="location_form"/>
+ </table>
+ <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>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')"
/></xsl:variable>
+ <input type="submit"
name="save" value="{$lang_save}" title = "{$lang_save}" />
+ <input type="submit"
name="cancel" value="{$lang_cancel}" title = "{$lang_cancel}" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')"
/></xsl:variable>
+ <input type="submit"
name="edit" value="{$lang_edit}" title = "{$lang_edit}" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </form>
+ </div>
+ </div>
+</xsl:template>
+
+<xsl:template match="options">
+ <option value="{id}">
+ <xsl:if test="selected != 0">
+ <xsl:attribute name="selected" value="selected" />
+ </xsl:if>
+ <xsl:value-of disable-output-escaping="yes" select="name"/>
+ </option>
+</xsl:template>
+
Copied:
branches/Version-1_0-branch/registration/templates/base/yui_booking_i18n.xsl
(from rev 9044, trunk/registration/templates/base/yui_booking_i18n.xsl)
===================================================================
---
branches/Version-1_0-branch/registration/templates/base/yui_booking_i18n.xsl
(rev 0)
+++
branches/Version-1_0-branch/registration/templates/base/yui_booking_i18n.xsl
2012-03-27 08:57:00 UTC (rev 9045)
@@ -0,0 +1,17 @@
+<!-- $Id: yui_booking_i18n.xsl 8267 2011-12-11 12:27:18Z sigurdne $ -->
+ <xsl:template name="yui_booking_i18n" xmlns:php="http://php.net/xsl">
+ <xsl:if test="yui_booking_i18n">
+ <script type="text/javascript">
+ YAHOO.portico.i18n = {};
+ <xsl:for-each select="yui_booking_i18n/*">
+ YAHOO.portico.i18n.<xsl:value-of
select="local-name()"/> = function(cfg)
+ {
+ cfg = cfg || {};
+ <xsl:for-each select="./*">
+ cfg["<xsl:value-of
select="local-name()"/>"] = <xsl:value-of disable-output-escaping="yes"
select="."/>;
+ </xsl:for-each>
+ };
+ </xsl:for-each>
+ </script>
+ </xsl:if>
+ </xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9045] Merge 9029:9044 from trunk,
Sigurd Nes <=