[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8768] Merge 8740:8767 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8768] Merge 8740:8767 from trunk |
Date: |
Thu, 02 Feb 2012 13:03:11 +0000 |
Revision: 8768
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8768
Author: sigurdne
Date: 2012-02-02 13:03:11 +0000 (Thu, 02 Feb 2012)
Log Message:
-----------
Merge 8740:8767 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang
branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
branches/Version-1_0-branch/booking/inc/class.soevent.inc.php
branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
branches/Version-1_0-branch/booking/setup/phpgw_no.lang
branches/Version-1_0-branch/booking/templates/base/event_edit.xsl
branches/Version-1_0-branch/booking/templates/base/event_new.xsl
branches/Version-1_0-branch/booking/templates/base/organization_edit.xsl
branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
branches/Version-1_0-branch/controller/inc/hook_home.inc.php
branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
branches/Version-1_0-branch/controller/js/controller/ajax.js
branches/Version-1_0-branch/controller/setup/phpgw_no.lang
branches/Version-1_0-branch/controller/setup/setup.inc.php
branches/Version-1_0-branch/controller/setup/tables_current.inc.php
branches/Version-1_0-branch/controller/setup/tables_update.inc.php
branches/Version-1_0-branch/controller/templates/base/control_location/control_location_tabs.xsl
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_item.xsl
branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
branches/Version-1_0-branch/property/inc/class.soproject.inc.php
branches/Version-1_0-branch/property/inc/class.uientity.inc.php
branches/Version-1_0-branch/property/js/yahoo/entity.index.js
Added Paths:
-----------
branches/Version-1_0-branch/controller/inc/model/class.control_location.inc.php
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test_rubbish.js
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_location.xsl
Removed Paths:
-------------
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test.js
branches/Version-1_0-branch/controller/templates/base/control_location/add_location_to_control.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
+
/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
Modified:
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
===================================================================
---
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -82,8 +82,10 @@
unset($contact2);
if($type)
{
- //var_dump($type);
- $group_array = $so_group->get(null, null, null, null,
null, null, array('id' => $id, 'changed_groups' => 'true'));
+ $sogroup = activitycalendar_sogroup::get_instance();
+ $soactivity =
activitycalendar_soactivity::get_instance();
+ $socontact =
activitycalendar_socontactperson::get_instance();
+ $group_array = $sogroup->get(null, null, null, null,
null, null, array('id' => $id, 'changed_groups' => 'true'));
if(count($group_array) > 0){
$keys = array_keys($group_array);
$group = $group_array[$keys[0]];
@@ -109,10 +111,10 @@
$contact2['org_id'] = 0;
$contact2['group_id'] = $group->get_id();
- if($so_group->update_local($group))
+ if($sogroup->update_local($group))
{
-
$so_contact->update_local_contact_person($contact1);
-
$so_contact->update_local_contact_person($contact2);
+
$socontact->update_local_contact_person($contact1);
+
$socontact->update_local_contact_person($contact2);
$message = lang('messages_saved_form');
}
else
@@ -143,7 +145,7 @@
$contact2_email =
phpgw::get_var('contact2_email');
- $new_group_id =
$so_group->transfer_group($group_info);
+ $new_group_id =
$sogroup->transfer_group($group_info);
if($new_group_id)
{
//update activity with new org id
@@ -153,24 +155,24 @@
$contact1['phone'] = $contact1_phone;
$contact1['mail'] = $contact1_email;
$contact1['group_id'] = $new_group_id;
-
$so_activity->add_contact_person_group($contact1);
+
$soactivity->add_contact_person_group($contact1);
$contact2 = array();
$contact2['name'] = $contact2_name;
$contact2['phone'] = $contact2_phone;
$contact2['mail'] = $contact_mail_2;
$contact2['group_id'] = $new_group_id;
-
$so_activity->add_contact_person_group($contact2);
+
$soactivity->add_contact_person_group($contact2);
$message = lang('messages_saved_form');
//get affected activities and update
with new org id
- $update_activities =
$so_activity->get_activities_for_update($new_group_id, true);
+ $update_activities =
$soactivity->get_activities_for_update($new_group_id, true);
foreach($update_activities as $act)
{
$act->set_group_id($new_group_id);
$act->set_new_org(false);
- $so_activity->store($act);
+ $soactivity->store($act);
}
//set local group as stored
@@ -184,7 +186,7 @@
}
}
- $contact_persons =
$so_contact->get_local_contact_persons($group->get_id(), true);
+ $contact_persons =
$socontact->get_local_contact_persons($group->get_id(), true);
$cp1 = $contact_persons[0];
$cp2 = $contact_persons[1];
Modified: branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang
2012-02-02 13:03:11 UTC (rev 8768)
@@ -381,8 +381,8 @@
mail_body_update activitycalendar no Dette er en melding fra
Bergen kommune/AktivBy.<br/>I aktivitetsoversikten som ligger i kommuneportalen
på internett, står du registrert som kontaktperson for %1.<br/>Ber om at du
kontrollerer at data er korrekt, og eventuelt endrer.<br/>%2<br/><br/><br/> Mvh
%3 kulturkontor
mail_body_update_frontend activitycalendar no Dette er en
melding fra Bergen kommune/AktivBy.<br/>I aktivitetsoversikten som ligger i
kommuneportalen på internett, står du registrert som kontaktperson for
%1.<br/>Det har kommet inn et endringsønske på denne aktiviteten. Bruk lenken
under for å endre opplysningene om aktiviteten.<br/>%2<br/><br/><br/> Mvh %3
kulturkontor
mail_body_state_3 activitycalendar no Informasjon om din
aktivitet er registrert og vil bli publisert i kommuneportalen i løpet av
dagen.<br/>De som er registrert som kontaktpersoner får endre informasjonen,
dette gjøres via nettsiden:
https://www.bergen.kommune.no/tjenestetilbud/aktivitetsoversikt/<br/><br/><br/>
Mvh %1 kulturkontor
-mail_body_state_4 activitycalendar no Ditt tips er behandlet
og publisert i kommuneportalen. Mvh %1 kulturkontor
-mail_body_state_5 activitycalendar no Ditt tips er behandlet,
men vil ikke bli publisert i kommuneportalen. Mvh %1 kulturkontor
+mail_body_state_4 activitycalendar no Ditt tips er behandlet
og publisert i kommuneportalen.<br/><br/>Mvh %1 kulturkontor
+mail_body_state_5 activitycalendar no Ditt tips er behandlet,
men vil ikke bli publisert i kommuneportalen.<br/><br/>Mvh %1 kulturkontor
send_mail activitycalendar no Send e-post
marked_as activitycalendar no Status
address_number activitycalendar no Husnummer
Modified:
branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
2012-02-02 13:03:11 UTC (rev 8768)
@@ -86,7 +86,7 @@
activity_org_helptext_step1 activitycalendarfrontend no Velg
organisasjon aktiviteten som skal endres er tilknyttet i nedtrekksmenyen, du
kan søke ved å skrive inn navnet.
next activitycalendarfrontend no Neste
new_activity activitycalendarfrontend no Ny aktivitet
-update_request_sent activitycalendarfrontend no
Oppdateringsforespørsel er sendt for aktiviteten "%1" tilknyttet organisasjon
"%2"
+update_request_sent activitycalendarfrontend no
Oppdateringsforespørsel er sendt på e-post til kontaktperson for aktiviteten
"%1" tilknyttet organisasjon "%2"
edit_activity activitycalendarfrontend no Endre aktivitet
activity_edit_helptext activitycalendarfrontend no Velg
aktiviteten du ønsker å endre fra listen under.
send_change_request activitycalendarfrontend no Send inn
endringsønske
Modified: branches/Version-1_0-branch/booking/inc/class.soevent.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.soevent.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/booking/inc/class.soevent.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -268,7 +268,7 @@
function get_org($orgnumber)
{
- $sql = "SELECT id,name FROM bb_organization WHERE
customer_organization_number='".$orgnumber."'";
+ $sql = "SELECT id,name FROM bb_organization WHERE
organization_number='".$orgnumber."' OR
customer_organization_number='".$orgnumber."'";
$this->db->limit_query($sql,0, __LINE__, __FILE__, 1);
if($this->db->next_record())
Modified: branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -315,6 +315,41 @@
$event['is_public'] = 1;
$event['building_name'] =
$_POST['building_name'];
+ if ($_POST['organization_name'] ||
$_POST['org_id2']) {
+ if ($_POST['organization_name']) {
+
$event['customer_organization_name'] = $_POST['organization_name'];
+
$event['customer_organization_id'] = $_POST['organization_id'];
+ $organization =
$this->organization_bo->read_single(intval(phpgw::get_var('organization_id',
'POST')));
+ } else {
+ $orgid =
$this->bo->so->get_org($_POST['org_id2']);
+ $event['org_id2'] =
$_POST['org_id2'];
+
$event['customer_organization_name'] = $orgid['name'];
+
$event['customer_organization_id'] = $orgid['id'];
+ $organization =
$this->organization_bo->read_single(intval($orgid['id']));
+ }
+
+ if ($organization['customer_internal']
== 0) {
+
$_POST['customer_identifier_type'] = $organization['customer_identifier_type'];
+ $_POST['customer_internal'] =
$organization['customer_internal'];
+ if
(strlen($organization['customer_organization_number']) == 9) {
+
$_POST['customer_organization_number'] =
$organization['customer_organization_number'];
+ } else {
+
$errors['organization_number'] = lang('The organization number is wrong or not
present');
+ }
+ } else {
+
$_POST['customer_identifier_type'] = 'organization_number';
+ $_POST['customer_internal'] =
$organization['customer_internal'];
+ if
(strlen($organization['customer_number']) == 5) {
+
$_POST['customer_organization_number'] = $organization['customer_number'];
+ } else {
+
$errors['resource_number'] = lang('The resource number is wrong or not
present');
+ }
+ }
+ $_POST['contact_name'] =
$organization['contacts'][0]['name'];
+ $_POST['contact_email'] =
$organization['contacts'][0]['email'];
+ $_POST['contact_phone'] =
$organization['contacts'][0]['phone'];
+ }
+
if (!$_POST['application_id'])
{
$temp_errors = array();
@@ -352,28 +387,6 @@
}
}
}
- if ($_POST['organization_name']) {
- $event['customer_organization_name'] =
$_POST['organization_name'];
- $event['customer_organization_id'] =
$_POST['organization_id'];
- $organization =
$this->organization_bo->read_single(intval(phpgw::get_var('organization_id',
'POST')));
- if ($organization['customer_internal']
== 0) {
-
$event['customer_identifier_type'] = $organization['customer_identifier_type'];
- $event['customer_internal'] =
$organization['customer_internal'];
- if
(strlen($organization['customer_organization_number']) == 9) {
-
$event['customer_organization_number'] =
$organization['customer_organization_number'];
- } else {
-
$errors['organization_number'] = lang('The organization number is wrong or not
present');
- }
- } else {
-
$event['customer_identifier_type'] = 'organization_number';
- $event['customer_internal'] =
$organization['customer_internal'];
- if
(strlen($organization['customer_number']) == 5) {
-
$event['customer_organization_number'] = $organization['customer_number'];
- } else {
-
$errors['resource_number'] = lang('The resource number is wrong or not
present');
- }
- }
- }
if ($_POST['cost'] != 0 and
!$event['customer_organization_number'] and !$event['customer_ssn']) {
$errors['invoice_data'] = lang('There
is set a cost, but no invoice data is filled inn');
Modified: branches/Version-1_0-branch/booking/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/booking/setup/phpgw_no.lang 2012-02-02
13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/booking/setup/phpgw_no.lang 2012-02-02
13:03:11 UTC (rev 8768)
@@ -397,6 +397,7 @@
A Case officer will review your application as soon as possible. booking
no En saksbehandler vil behandle søknaden så fort som mulig.
customer_ssn contains an invalid Norwegian social security number (6 or 11
digits) booking no Fødselsdato/fødselsnummer er ikke gyldig. Nummeret
må bestå av 6 eller 11 siffer
customer_organization_number is invalid booking no
Organisasjonsnummer er ugyldig
+Organization_number booking no Organisasjonsnummer
Select an organization first booking no Velg organisasjon først
Add Resource booking no Ny ressurs
%1 e-mails were sent successfully booking no %1 e-poster ble sendt
@@ -405,6 +406,7 @@
contact_email booking no E-post
contact_name booking no Navn
customer_identifier_type booking no Fakturainformasjon
+Or booking no Eller
group_id booking no Gruppe/Lag
organization_id booking no Organisasjon
season_id booking no Sesong
@@ -542,3 +544,4 @@
There is a cost of %1 assosiated with the allocation you are useing booking
no Det er en kostnad på %1kr knyttet til den tildelingen du bruker.
Export booking no Eksport
Upload booking no Last opp
+Get all contact and invoice information from organization booking no
Hent all kontakt/faktura informasjon fra Organisasjon
Modified: branches/Version-1_0-branch/booking/templates/base/event_edit.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/event_edit.xsl
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/booking/templates/base/event_edit.xsl
2012-02-02 13:03:11 UTC (rev 8768)
@@ -204,19 +204,6 @@
<dl class="form-col">
<dt class="heading"><xsl:value-of
select="php:function('lang', 'Invoice information')" /></dt>
- <dt><label for="field_org"><xsl:value-of
select="php:function('lang', 'Organization')" /></label></dt>
- <dd>
- <div class="autocomplete">
- <input id="field_org_id" name="organization_id"
type="hidden">
- <xsl:attribute name="value"><xsl:value-of
select="event/customer_organization_id"/></xsl:attribute>
- </input>
- <input id="field_org_name" name="organization_name"
type="text">
- <xsl:attribute name="value"><xsl:value-of
select="event/customer_organization_name"/></xsl:attribute>
- </input>
- <div id="org_container"/>
- </div>
- </dd>
-
<xsl:copy-of
select="phpgw:booking_customer_identifier(event, '')"/>
<dt><label for="field_customer_internal"><xsl:value-of
select="php:function('lang', 'Internal Customer')"/></label></dt>
Modified: branches/Version-1_0-branch/booking/templates/base/event_new.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/event_new.xsl
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/booking/templates/base/event_new.xsl
2012-02-02 13:03:11 UTC (rev 8768)
@@ -135,6 +135,58 @@
</dd>
</dl>
<div class="clr"/>
+ <dl class="form-col">
+ <dt class="heading"><xsl:value-of
select="php:function('lang', 'Cost')" /></dt>
+ <dt><label for="field_cost"><xsl:value-of
select="php:function('lang', 'Cost')" /></label></dt>
+ <dd>
+ <input id="field_cost" name="cost" type="text">
+ <xsl:attribute name="value"><xsl:value-of
select="event/cost"/></xsl:attribute>
+ </input>
+ </dd>
+ </dl>
+ <dl class="form-col">
+ </dl>
+ <dl class="form-col">
+ <dt class="heading"><xsl:value-of
select="php:function('lang', 'send reminder for participants statistics')"
/></dt>
+ <dt style="visibility: hidden;">!</dt>
+ <dd>
+ <select name="reminder" id="field_reminder">
+ <xsl:choose>
+ <xsl:when test="event/reminder
= 1">
+ <option value="1"
selected="selected"><xsl:value-of select="php:function('lang', 'Send
reminder')" /></option>
+ <option
value="0"><xsl:value-of select="php:function('lang', 'Do not send reminder')"
/></option>
+ </xsl:when>
+ <xsl:otherwise
test="event/reminder = 0">
+ <option
value="1"><xsl:value-of select="php:function('lang', 'Send reminder')"
/></option>
+ <option value="0"
selected="selected"><xsl:value-of select="php:function('lang', 'Do not send
reminder')" /></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </select>
+ </dd>
+ </dl>
+ <div class="clr"/>
+ <dl class="form-col">
+ <dt class="heading"><xsl:value-of
select="php:function('lang', 'Get all contact and invoice information from
organization')" /></dt>
+ <dt><label for="field_org"><xsl:value-of
select="php:function('lang', 'Organization')" /></label></dt>
+ <dd>
+ <div class="autocomplete">
+ <input id="field_org_id" name="organization_id"
type="hidden">
+ <xsl:attribute name="value"><xsl:value-of
select="event/customer_organization_id"/></xsl:attribute>
+ </input>
+ <input id="field_org_name" name="organization_name"
type="text">
+ <xsl:attribute name="value"><xsl:value-of
select="event/customer_organization_name"/></xsl:attribute>
+ </input>
+ <div id="org_container"/>
+ </div>
+ <span><xsl:value-of
select="php:function('lang', 'Or')" /></span>
+ <dt><label for="field_org_id2"><xsl:value-of
select="php:function('lang', 'Organization_number')" /></label></dt>
+ <dd>
+ <input id="field_org_id2"
name="org_id2" type="text">
+ <xsl:attribute
name="value"><xsl:value-of select="event/org_id2"/></xsl:attribute>
+ </input>
+ </dd>
+ </dd>
+ </dl>
<dl class="form-col">
<dt class="heading"><xsl:value-of
select="php:function('lang', 'Contact information')" /></dt>
<dt><label for="field_contact_name"><xsl:value-of
select="php:function('lang', 'Name')" /></label></dt>
@@ -155,54 +207,17 @@
<xsl:attribute
name="value"><xsl:value-of select="event/contact_phone"/></xsl:attribute>
</input>
</dd>
- <dt><label for="field_cost"><xsl:value-of
select="php:function('lang', 'Cost')" /></label></dt>
- <dd>
- <input id="field_cost" name="cost" type="text">
- <xsl:attribute name="value"><xsl:value-of
select="event/cost"/></xsl:attribute>
- </input>
- </dd>
</dl>
<dl class="form-col">
<dt class="heading"><xsl:value-of
select="php:function('lang', 'Invoice information')" /></dt>
- <dt><label for="field_org"><xsl:value-of
select="php:function('lang', 'Organization')" /></label></dt>
- <dd>
- <div class="autocomplete">
- <input id="field_org_id" name="organization_id"
type="hidden">
- <xsl:attribute name="value"><xsl:value-of
select="event/organization_id"/></xsl:attribute>
- </input>
- <input id="field_org_name" name="organization_name"
type="text">
- <xsl:attribute name="value"><xsl:value-of
select="event/customer_organization_name"/></xsl:attribute>
- </input>
- <div id="org_container"/>
- </div>
- </dd>
-
<xsl:copy-of
select="phpgw:booking_customer_identifier(event, '')"/>
<dt><label for="field_customer_internal"><xsl:value-of
select="php:function('lang', 'Internal Customer')"/></label></dt>
<dd><xsl:copy-of
select="phpgw:option_checkbox(event/customer_internal,
'customer_internal')"/></dd>
</dl>
- <dl class="form-col">
- <dt class="heading"><xsl:value-of
select="php:function('lang', 'send reminder for participants statistics')"
/></dt>
- <dt style="visibility: hidden;">!</dt>
- <dd>
- <select name="reminder" id="field_reminder">
- <xsl:choose>
- <xsl:when test="event/reminder
= 1">
- <option value="1"
selected="selected"><xsl:value-of select="php:function('lang', 'Send
reminder')" /></option>
- <option
value="0"><xsl:value-of select="php:function('lang', 'Do not send reminder')"
/></option>
- </xsl:when>
- <xsl:otherwise
test="event/reminder = 0">
- <option
value="1"><xsl:value-of select="php:function('lang', 'Send reminder')"
/></option>
- <option value="0"
selected="selected"><xsl:value-of select="php:function('lang', 'Do not send
reminder')" /></option>
- </xsl:otherwise>
- </xsl:choose>
- </select>
- </dd>
- </dl>
<div class="form-buttons">
<input type="submit">
<xsl:attribute name="value"><xsl:value-of
select="php:function('lang', 'Create')"/></xsl:attribute>
Modified:
branches/Version-1_0-branch/booking/templates/base/organization_edit.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/organization_edit.xsl
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/booking/templates/base/organization_edit.xsl
2012-02-02 13:03:11 UTC (rev 8768)
@@ -99,25 +99,6 @@
<xsl:attribute name="value"><xsl:value-of
select="organization/email"/></xsl:attribute>
</input>
</dd>
- <dt style="margin-top: 40px;"><label
for="field_activity"><xsl:value-of select="php:function('lang', 'Activity')"
/></label></dt>
- <dd>
- <select name="activity_id" id="field_activity">
- <option value=""><xsl:value-of
select="php:function('lang', '-- select an activity --')" /></option>
- <xsl:for-each select="activities">
- <option>
- <xsl:if
test="../organization/activity_id = id">
- <xsl:attribute
name="selected">selected</xsl:attribute>
- </xsl:if>
- <xsl:attribute
name="value"><xsl:value-of select="id"/></xsl:attribute>
- <xsl:value-of
select="name"/>
- </option>
- </xsl:for-each>
- </select>
- </dd>
- <dt><label for="field_description"><xsl:value-of
select="php:function('lang', 'Description')" /></label></dt>
- <dd class="yui-skin-sam">
- <textarea id="field-description" name="description"
type="text"><xsl:value-of select="organization/description"/></textarea>
- </dd>
</dl>
<dl class="form-col">
<xsl:if test="currentapp = 'booking'">
@@ -187,8 +168,30 @@
</dd>
<!--</xsl:if>-->
</dl>
+ <div class="clr"/>
+ <dl class="form-col">
+ <dt style="margin-top: 40px;"><label
for="field_activity"><xsl:value-of select="php:function('lang', 'Activity')"
/></label></dt>
+ <dd>
+ <select name="activity_id" id="field_activity">
+ <option value=""><xsl:value-of
select="php:function('lang', '-- select an activity --')" /></option>
+ <xsl:for-each select="activities">
+ <option>
+ <xsl:if
test="../organization/activity_id = id">
+ <xsl:attribute
name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute
name="value"><xsl:value-of select="id"/></xsl:attribute>
+ <xsl:value-of
select="name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </dd>
+ <dt><label for="field_description"><xsl:value-of
select="php:function('lang', 'Description')" /></label></dt>
+ <dd class="yui-skin-sam">
+ <textarea id="field-description" name="description"
type="text"><xsl:value-of select="organization/description"/></textarea>
+ </dd>
+ </dl>
- <div style='clear:left; padding:0; margin:0'/>
+ <div class="clr"/>
<xsl:if test='new_form or organization/permission/write'>
Modified: branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -2,7 +2,7 @@
/**
* phpGroupWare - controller: a part of a Facilities Management System.
*
- * @author Erink Holm-Larsen <address@hidden>
+ * @author Erik 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.
@@ -261,13 +261,14 @@
}
}
- function get_planned_check_lists_for_control($control_id){
+ function get_planned_check_lists_for_control($control_id,
$location_code){
$sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, planned_date, ";
$sql .= "completed_date, component_id, location_code,
num_open_cases ";
$sql .= "FROM controller_check_list cl ";
- $sql .= "WHERE cl.control_id = $control_id ";
+ $sql .= "WHERE cl.control_id = $control_id ";
+ $sql .= "AND cl.location_code = '{$location_code}' ";
$sql .= "ORDER BY cl.id;";
-
+ //var_dump($sql);
$this->db->query($sql);
$check_list_id = 0;
@@ -386,7 +387,7 @@
$sql .= "cl.component_id as cl_component_id, cl.location_code
as cl_location_code, num_open_cases ";
$sql .= "FROM controller_control c ";
$sql .= "LEFT JOIN controller_check_list cl on cl.control_id =
c.id ";
- $sql .= "WHERE cl.location_code = $location_code ";
+ $sql .= "WHERE cl.location_code = '{$location_code}' ";
$sql .= "AND c.repeat_type = $repeat_type ";
$sql .= "AND deadline BETWEEN $from_date_ts AND $to_date_ts ";
$sql .= "ORDER BY c.id;";
@@ -447,7 +448,7 @@
$sql .= "cl.component_id as cl_component_id, cl.location_code
as cl_location_code, num_open_cases ";
$sql .= "FROM controller_control c ";
$sql .= "LEFT JOIN controller_check_list cl on cl.control_id =
c.id ";
- $sql .= "WHERE cl.location_code = $location_code ";
+ $sql .= "WHERE cl.location_code = '{$location_code} ";
if( is_numeric($repeat_type) )
$sql .= "AND c.repeat_type = $repeat_type ";
Modified: branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -31,6 +31,7 @@
phpgw::import_class('controller.socommon');
include_class('controller', 'control', 'inc/model/');
+ include_class('controller', 'control_location', 'inc/model/');
class controller_socontrol extends controller_socommon
{
@@ -228,10 +229,31 @@
}
}
- function add_location_to_control($control_id, $location_code)
+ function get_control_location($control_id, $location_code)
{
+ $sql = "SELECT * FROM controller_control_location_list
WHERE control_id = $control_id AND location_code = '$location_code'";
+
+ $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+
+ if($this->db->next_record()){
+ $control_location = new
controller_control_location($this->unmarshal($this->db->f('id', true), 'int'));
+
+
$control_location->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'string'));
+
$control_location->set_control_id($this->unmarshal($this->db->f('control_id',
true), 'int'));
+
+ return $control_location;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ function register_control_to_location($control_id,
$location_code)
+ {
$sql = "INSERT INTO controller_control_location_list
(control_id, location_code) values($control_id, $location_code)";
- $this->db->query($sql);
+
+ return $this->db->query($sql);
}
function add_component_to_control($control_id, $component_id)
@@ -307,7 +329,7 @@
$tables = "controller_control";
//$joins = " {$this->left_join} rental_document_types
ON (rental_document.type_id = rental_document_types.id)";
- $joins = " {$this->left_join} controller_control_area
ON (controller_control.control_area_id = controller_control_area.id)";
+ //$joins = " {$this->left_join} controller_control_area
ON (controller_control.control_area_id = controller_control_area.id)";
$joins .= " {$this->left_join} controller_procedure ON
(controller_control.procedure_id = controller_procedure.id)";
$joins .= " {$this->left_join} fm_responsibility_role
ON (controller_control.responsibility_id = fm_responsibility_role.id)";
@@ -317,7 +339,7 @@
}
else
{
- $cols = 'controller_control.id,
controller_control.title, controller_control.description,
controller_control.start_date, controller_control.end_date,
controller_control.procedure_id, controller_control.control_area_id,
controller_control.requirement_id, controller_control.costresponsibility_id,
controller_control.responsibility_id, controller_control.component_type_id,
controller_control.component_id, controller_control.location_code,
controller_control.repeat_type, controller_control.repeat_interval,
controller_control.enabled, controller_control_area.title AS control_area_name,
controller_procedure.title AS procedure_name, fm_responsibility_role.name AS
responsibility_name ';
+ $cols = 'controller_control.id,
controller_control.title, controller_control.description,
controller_control.start_date, controller_control.end_date,
controller_control.procedure_id, controller_control.control_area_id,
controller_control.requirement_id, controller_control.costresponsibility_id,
controller_control.responsibility_id, controller_control.component_type_id,
controller_control.component_id, controller_control.location_code,
controller_control.repeat_type, controller_control.repeat_interval,
controller_control.enabled, controller_procedure.title AS procedure_name,
fm_responsibility_role.name AS responsibility_name ';
}
$dir = $ascending ? 'ASC' : 'DESC';
@@ -351,7 +373,9 @@
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
true), 'int'));
$control->set_responsibility_name($this->unmarshal($this->db->f('responsibility_name',
true), 'string'));
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
true), 'int'));
-
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
true), 'string'));
+
//$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
true), 'string'));
+ $category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', 'int')));
+
$control->set_control_area_name($category[0]['name']);
//
$control->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
true), 'int'));
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
true), 'int'));
$control->set_component_id($this->unmarshal($this->db->f('component_id', true),
'int'));
@@ -373,11 +397,11 @@
{
$id = (int)$id;
- $joins = " {$this->left_join} controller_control_area
ON (c.control_area_id = controller_control_area.id)";
+ //$joins = " {$this->left_join} controller_control_area
ON (c.control_area_id = controller_control_area.id)";
$joins .= " {$this->left_join} controller_procedure ON
(c.procedure_id = controller_procedure.id)";
$joins .= " {$this->left_join} fm_responsibility_role
ON (c.responsibility_id = fm_responsibility_role.id)";
- $sql = "SELECT c.*, controller_control_area.title AS
control_area_name, controller_procedure.title AS procedure_name,
fm_responsibility_role.name AS responsibility_name FROM controller_control c
{$joins} WHERE c.id = " . $id;
+ $sql = "SELECT c.*, controller_procedure.title AS
procedure_name, fm_responsibility_role.name AS responsibility_name FROM
controller_control c {$joins} WHERE c.id = " . $id;
$this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
$this->db->next_record();
@@ -394,7 +418,9 @@
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
true), 'int'));
$control->set_responsibility_name($this->unmarshal($this->db->f('responsibility_name',
true), 'string'));
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
true), 'int'));
-
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
true), 'string'));
+
//$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
true), 'string'));
+ $category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', 'int')));
+ $control->set_control_area_name($category[0]['name']);
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
true), 'int'));
$control->set_component_id($this->unmarshal($this->db->f('component_id', true),
'int'));
$control->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'string'));
Modified:
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -121,9 +121,9 @@
$joins = " {$this->left_join} fm_building_part ON
(p.building_part_id = CAST(fm_building_part.id AS INT))";
$joins .= " {$this->left_join} controller_procedure
ON (p.procedure_id = controller_procedure.id)";
- $joins .= " {$this->left_join}
controller_control_area ON (p.control_area_id = controller_control_area.id)";
+ //$joins .= " {$this->left_join}
controller_control_area ON (p.control_area_id = controller_control_area.id)";
- $sql = "SELECT p.*, fm_building_part.descr AS
building_part_descr, controller_procedure.title as procedure_title,
controller_control_area.title as control_area_name FROM
controller_control_group p {$joins} WHERE p.id = " . $id;
+ $sql = "SELECT p.*, fm_building_part.descr AS
building_part_descr, controller_procedure.title as procedure_title FROM
controller_control_group p {$joins} WHERE p.id = " . $id;
$this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
$this->db->next_record();
@@ -132,7 +132,9 @@
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
$control_group->set_procedure_name($this->unmarshal($this->db->f('procedure_title'),
'string'));
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
-
$control_group->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
'string'));
+ $category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', 'int')));
+
$control_group->set_control_area_name($category[0]['name']);
+
//$control_group->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
'string'));
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
'int'));
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr'),
'string'));
@@ -304,7 +306,7 @@
$tables = "controller_control_group";
$joins = " {$this->left_join} fm_building_part ON
(building_part_id = CAST(fm_building_part.id AS INT))";
$joins .= " {$this->left_join} controller_procedure
ON (controller_control_group.procedure_id = controller_procedure.id)";
- $joins .= " {$this->left_join}
controller_control_area ON (controller_control_group.control_area_id =
controller_control_area.id)";
+// $joins .= " {$this->left_join}
controller_control_area ON (controller_control_group.control_area_id =
controller_control_area.id)";
//$joins .= " {$this->left_join}
rental_contract_composite ON (rental_contract_composite.composite_id =
rental_composite.id)";
//$joins .= " {$this->left_join} rental_contract ON
(rental_contract.id = rental_contract_composite.contract_id)";
@@ -315,8 +317,8 @@
else
{
$cols .= "controller_control_group.id,
group_name, controller_control_group.procedure_id,
controller_control_group.control_area_id as control_area_id, ";
- $cols .= "building_part_id,
fm_building_part.descr AS building_part_descr, controller_procedure.title as
procedure_title, ";
- $cols .= "controller_control_area.title as
control_area_name ";
+ $cols .= "building_part_id,
fm_building_part.descr AS building_part_descr, controller_procedure.title as
procedure_title ";
+ //$cols .= "controller_control_area.title as
control_area_name ";
}
$dir = $ascending ? 'ASC' : 'DESC';
$order = $sort_field ? "ORDER BY
{$this->marshal($sort_field, 'field')} $dir ": '';
@@ -335,7 +337,9 @@
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
$control_group->set_procedure_name($this->unmarshal($this->db->f('procedure_title'),
'string'));
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
-
$control_group->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
'string'));
+ $category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', 'int')));
+
$control_group->set_control_area_name($category[0]['name']);
+
//$control_group->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
'string'));
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
'int'));
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr'),
'string'));
}
Modified:
branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -134,6 +134,9 @@
$control_item->set_how_to_do($this->unmarshal($this->db->f('how_to_do', true),
'string'));
$control_item->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
true), 'int'));
$control_item->set_control_group_name($this->unmarshal($this->db->f('control_group_name',
true), 'string'));
+
$control_item->set_control_area_id($this->unmarshal($this->db->f('control_area_id')));
+ $category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', true), 'int'));
+
$control_item->set_control_area_name($category[0]['name']);
$control_item->set_type($this->unmarshal($this->db->f('type', true), 'string'));
return $control_item;
@@ -233,6 +236,11 @@
{
$filter_clauses[] =
"controller_control_item.control_group_id =
{$this->marshal($filters['control_groups'],'int')}";
}
+ if(isset($filters['control_areas']))
+ {
+ $filter_clauses[] =
"controller_control_item.control_area_id =
{$this->marshal($filters['control_areas'],'int')}";
+ }
+
if(count($filter_clauses))
{
@@ -251,7 +259,7 @@
}
else
{
- $cols = 'controller_control_item.id,
controller_control_item.title, required, what_to_do, how_to_do,
controller_control_item.control_group_id, controller_control_group.group_name
AS control_group_name';
+ $cols = 'controller_control_item.id,
controller_control_item.title, required, what_to_do, how_to_do,
controller_control_item.control_area_id,
controller_control_item.control_group_id, controller_control_group.group_name
AS control_group_name';
}
$dir = $ascending ? 'ASC' : 'DESC';
@@ -279,6 +287,9 @@
$control_item->set_what_to_do($this->unmarshal($this->db->f('what_to_do',
true), 'string'));
$control_item->set_how_to_do($this->unmarshal($this->db->f('how_to_do', true),
'string'));
$control_item->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
true), 'int'));
+
$control_item->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
true), 'int'));
+ $category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', true), 'int'));
+
$control_item->set_control_area_name($category[0]['name']);
$control_item->set_control_group_name($this->unmarshal($this->db->f('control_group_name',
true), 'string'));
}
Modified: branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -146,9 +146,8 @@
$documents = null;
- $joins = " {$this->left_join} controller_control_area
ON (p.control_area_id = controller_control_area.id)";
$joins .= " {$this->left_join} controller_document ON
(p.id = controller_document.procedure_id)";
- $sql = "SELECT p.*, controller_control_area.title AS
control_area_name, controller_document.id AS document_id,
controller_document.title AS document_title, controller_document.description as
document_description FROM controller_procedure p {$joins} WHERE p.id = " . $id;
+ $sql = "SELECT p.*, controller_document.id AS
document_id, controller_document.title AS document_title,
controller_document.description as document_description FROM
controller_procedure p {$joins} WHERE p.id = " . $id;
//var_dump($sql);
$this->db->query($sql, __LINE__, __FILE__);
while ($this->db->next_record()) {
@@ -165,8 +164,12 @@
$procedure->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
$procedure->set_revision_no($this->unmarshal($this->db->f('revision_no'),
'int'));
$procedure->set_revision_date($this->unmarshal($this->db->f('revision_date'),
'int'));
-
$procedure->set_control_area_id($this->unmarshal($this->db->f('control_aera_id',
'int')));
-
$procedure->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
'string')));
+
$procedure->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
'int')));
+
+ $category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', 'int')));
+
$procedure->set_control_area_name($category[0]['name']);
+
+
//$procedure->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
'string')));
}
if($this->db->f('document_id', true) != ''){
@@ -191,10 +194,8 @@
$counter = 0;
$documents = null;
-
- $joins = " {$this->left_join} controller_control_area
ON (p.control_area_id = controller_control_area.id)";
$joins .= " {$this->left_join} controller_document ON
(p.id = controller_document.procedure_id)";
- $sql = "SELECT p.*, controller_control_area.title AS
control_area_name, controller_document.id AS document_id,
controller_document.title AS document_title, controller_document.description as
document_description FROM controller_procedure p {$joins} WHERE p.id = " . $id;
+ $sql = "SELECT p.*, controller_document.id AS
document_id, controller_document.title AS document_title,
controller_document.description as document_description FROM
controller_procedure p {$joins} WHERE p.id = " . $id;
//var_dump($sql);
$this->db->query($sql, __LINE__, __FILE__);
while ($this->db->next_record()) {
@@ -211,8 +212,10 @@
$procedure->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
$procedure->set_revision_no($this->unmarshal($this->db->f('revision_no'),
'int'));
$procedure->set_revision_date($this->unmarshal($this->db->f('revision_date'),
'int'));
-
$procedure->set_control_area_id($this->unmarshal($this->db->f('control_aera_id',
'int')));
-
$procedure->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
'string')));
+
$procedure->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
'int')));
+ $category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', 'int')));
+
$procedure->set_control_area_name($category[0]['name']);
+
//$procedure->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
'string')));
}
if($this->db->f('document_id', true) != ''){
@@ -364,7 +367,9 @@
$procedure->set_revision_no($this->unmarshal($this->db->f('revision_no'),
'int'));
$procedure->set_revision_date(date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
$this->unmarshal($this->db->f('revision_date'), 'int')));
$procedure->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
-
$procedure->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
'string'));
+ $category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', 'int')));
+
$procedure->set_control_area_name($category_name = $category[0]['name']);
+
//$procedure->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
'string'));
$results[] = $procedure->toArray();;
}
@@ -439,7 +444,7 @@
$condition = join(' AND ', $clauses);
- $joins = " {$this->left_join} controller_control_area
ON (controller_procedure.control_area_id = controller_control_area.id)";
+ //$joins = " {$this->left_join} controller_control_area
ON (controller_procedure.control_area_id = controller_control_area.id)";
$tables = "controller_procedure";
@@ -449,7 +454,7 @@
}
else
{
- $cols .= "controller_procedure.id,
controller_procedure.title, controller_procedure.purpose,
controller_procedure.responsibility, controller_procedure.description,
controller_procedure.reference, controller_procedure.attachment,
controller_procedure.start_date, controller_procedure.end_date,
controller_procedure.procedure_id, controller_procedure.revision_no,
controller_procedure.revision_date, controller_control_area.title AS
control_area_name ";
+ $cols .= "controller_procedure.id,
controller_procedure.title, controller_procedure.purpose,
controller_procedure.responsibility, controller_procedure.description,
controller_procedure.reference, controller_procedure.attachment,
controller_procedure.start_date, controller_procedure.end_date,
controller_procedure.procedure_id, controller_procedure.revision_no,
controller_procedure.revision_date, controller_procedure.control_area_id ";
}
$dir = $ascending ? 'ASC' : 'DESC';
$order = $sort_field ? "ORDER BY
{$this->marshal($sort_field, 'field')} $dir ": '';
@@ -476,8 +481,10 @@
$procedure->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
$procedure->set_revision_no($this->unmarshal($this->db->f('revision_no'),
'int'));
$procedure->set_revision_date($this->unmarshal($this->db->f('revision_date'),
'int'));
-
$procedure->set_control_area_id($this->unmarshal($this->db->f('control_aera_id',
'int')));
-
$procedure->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
'string')));
+
$procedure->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
'int')));
+
//$procedure->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
'string')));
+ $category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', 'int')));
+
$procedure->set_control_area_name($category[0]['name']);
}
return $procedure;
Modified: branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -2,7 +2,7 @@
/**
* phpGroupWare - controller: a part of a Facilities Management System.
*
- * @author Erink Holm-Larsen <address@hidden>
+ * @author Erik 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.
@@ -39,7 +39,7 @@
include_class('controller', 'date_helper', 'inc/helper/');
include_class('controller', 'check_item', 'inc/model/');
- class controller_uicheck_list_for_location extends controller_uicommon
+ class controller_uicheck_list extends controller_uicommon
{
private $so;
private $so_control_area;
@@ -320,7 +320,7 @@
$check_list_id = $this->so->store($check_list);
- $this->redirect(array('menuaction' =>
'controller.uicheck_list_for_location.edit_check_list',
'check_list_id'=>$check_list_id));
+ $this->redirect(array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id'=>$check_list_id));
}
function create_case_message(){
Modified: branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -72,8 +72,6 @@
'generate_check_lists_for_control' => true,
'view_check_lists_for_control' => true,
'get_controls_by_control_area' => true,
- 'get_locations_for_control' =>
true,
- 'add_location_to_control' =>
true
);
public function __construct()
@@ -154,15 +152,10 @@
)
)
),
- array('type' =>
'filter',
- 'name' =>
'control_areas',
- 'text' => lang('Control_area'),
- 'list' =>
$this->so_control_area->get_control_area_select_array(),
- ),
//as categories
array('type' =>
'filter',
'name' =>
'control_areas',
- 'text' =>
lang('Control_area') . 2,
+ 'text' =>
lang('Control_area'),
'list' =>
$control_areas_array2,
),
array('type' =>
'filter',
@@ -594,9 +587,6 @@
return $tabs;
}
-
-
-
// Returns control list info as JSON
public function get_controls_by_control_area()
{
@@ -614,19 +604,27 @@
public function get_locations_for_control()
{
$control_id = phpgw::get_var('control_id');
- $locations_for_control_array =
$this->so->get_locations_for_control($control_id);
- foreach($locations_for_control_array as $location)
+ if(is_numeric($control_id) & $control_id > 0)
{
- $results['results'][]= $location;
- }
+ $locations_for_control_array =
$this->so->get_locations_for_control($control_id);
- $results['total_records'] = count(
$locations_for_control_array );
- $results['start'] = 1;
- $results['sort'] = 'location_code';
-
- array_walk($results['results'], array($this,
'add_actions'), array($type));
+ foreach($locations_for_control_array as
$location)
+ {
+ $results['results'][]= $location;
+ }
+
+ $results['total_records'] = count(
$locations_for_control_array );
+ $results['start'] = 1;
+ $results['sort'] = 'location_code';
+ array_walk($results['results'], array($this,
'add_actions'), array($type));
+ }
+ else
+ {
+ $results['total_records'] = 0;
+ }
+
return $this->yui_results($results);
}
@@ -645,14 +643,14 @@
$value['parameters'][] = "control_id";
}
- public function add_location_to_control()
+ public function register_control_to_location()
{
$control_id = phpgw::get_var('control_id');
$location_code = phpgw::get_var('location_code');
- $this->so->add_location_to_control($control_id,
$location_code);
+ $this->so->register_control_to_location($control_id,
$location_code);
}
-
+
public function query()
{
$params = array(
@@ -724,4 +722,5 @@
return $this->yui_results($results);
}
+
}
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -32,6 +32,7 @@
phpgw::import_class('property.boevent');
phpgw::import_class('controller.socontrol');
phpgw::import_class('controller.socontrol_item');
+ phpgw::import_class('controller.socontrol_item_list');
phpgw::import_class('controller.socontrol_group_list');
phpgw::import_class('controller.socontrol_area');
@@ -43,6 +44,7 @@
private $so_procedure;
private $so_control_area;
private $so_control_item;
+ private $so_control_item_list;
private $so_control_group_list;
public $public_functions = array
@@ -62,6 +64,7 @@
$this->so_procedure =
CreateObject('controller.soprocedure');
$this->so_control_area =
CreateObject('controller.socontrol_area');
$this->so_control_item =
CreateObject('controller.socontrol_item');
+ $this->so_control_item_list =
CreateObject('controller.socontrol_item_list');
$this->so_control_group_list =
CreateObject('controller.socontrol_group_list');
$GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::control_group";
}
@@ -71,6 +74,23 @@
if(phpgw::get_var('phpgw_return_as') == 'json') {
return $this->query();
}
+
+ // Sigurd: Start categories
+ $cats = CreateObject('phpgwapi.categories', -1,
'controller', '.control');
+ $cats->supress_info = true;
+
+ $control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','selected' =>
$control_area_id,'globals' => true,'use_acl' => $this->_category_acl));
+ array_unshift($control_areas['cat_list'],array
('cat_id'=>'','name'=> lang('select value')));
+ $control_areas_array2 = array();
+ foreach($control_areas['cat_list'] as $cat_list)
+ {
+ $control_areas_array2[] = array
+ (
+ 'id' => $cat_list['cat_id'],
+ 'name' => $cat_list['name'],
+ );
+ }
+ // END categories
self::add_javascript('controller', 'yahoo',
'datatable.js');
phpgwapi_yui::load_widget('datatable');
phpgwapi_yui::load_widget('paginator');
@@ -107,8 +127,8 @@
),
array('type' =>
'filter',
'name' =>
'control_areas',
- 'text' =>
lang('Control_area').':',
- 'list' =>
$this->so_control_area->get_control_area_select_array(),
+ 'text' =>
lang('Control_area'),
+ 'list' =>
$control_areas_array2,
),
array('type' => 'text',
'text' =>
lang('searchfield'),
@@ -148,11 +168,6 @@
'sotrable' =>
false
),
array(
- 'key' => 'control_area',
- 'label' =>
lang('Control area'),
- 'sortable' => false
- ),
- array(
'key' => 'procedure',
'label' =>
lang('Procedure'),
'sortable' => false
@@ -163,6 +178,11 @@
'sortable' => false
),
array(
+ 'key' => 'control_area',
+ 'label' =>
lang('Control area'),
+ 'sortable' => false
+ ),
+ array(
'key' => 'link',
'hidden' => true
)
@@ -272,8 +292,25 @@
$this->so_control_item->store($curr_control_item);
}
+
+ // Sigurd: START as categories
+ $cats = CreateObject('phpgwapi.categories',
-1, 'controller', '.control');
+ $cats->supress_info = true;
+
+ $control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl'
=> $this->_category_acl));
+
+ $control_area_array = array();
+ foreach($control_areas['cat_list'] as $cat_list)
+ {
+ $control_area_array[] = array
+ (
+ 'id' => $cat_list['cat_id'],
+ 'name' => $cat_list['name'],
+ );
+ }
+ // END as categories
- $control_area_array =
$this->so_control_area->get_control_area_array();
+ //$control_area_array =
$this->so_control_area->get_control_area_array();
$procedure_array =
$this->so_procedure->get_procedures();
@@ -283,7 +320,7 @@
$msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
}
- foreach ($control_area_array as $control_area)
+/* foreach ($control_area_array as $control_area)
{
if($control_group->get_control_area_id() && $control_area->get_id() ==
$control_group->get_control_area_id())
{
@@ -302,7 +339,7 @@
'name' =>
$control_area->get_title()
);
}
- }
+ }*/
foreach ($procedure_array as $procedure)
{
@@ -354,7 +391,7 @@
'img_go_home'
=> 'rental/templates/base/images/32x32/actions/go-home.png',
'editable'
=> true,
'procedure'
=> array('options' => $procedure_options),
- 'control_area'
=> array('options' => $control_area_options),
+ 'control_area'
=> array('options' => $control_area_array),
'control_group'
=> $control_group_array,
'control_items'
=> $control_items,
'selected_control_items' =>
$selected_control_items,
@@ -389,8 +426,24 @@
}
else
{
+ // Sigurd: START as categories
+ $cats = CreateObject('phpgwapi.categories',
-1, 'controller', '.control');
+ $cats->supress_info = true;
+
+ $control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl'
=> $this->_category_acl));
+
+ $control_area_array = array();
+ foreach($control_areas['cat_list'] as $cat_list)
+ {
+ $control_area_array[] = array
+ (
+ 'id' => $cat_list['cat_id'],
+ 'name' => $cat_list['name'],
+ );
+ }
+ // END as categories
- $control_area_array =
$this->so_control_area->get_control_area_array();
+ //$control_area_array =
$this->so_control_area->get_control_area_array();
$procedure_array =
$this->so_procedure->get_procedures();
@@ -400,7 +453,7 @@
$msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
}
- foreach ($control_area_array as $control_area)
+/* foreach ($control_area_array as $control_area)
{
if($control_group->get_control_area_id() && $control_area->get_id() ==
$control_group->get_control_area_id())
{
@@ -419,7 +472,7 @@
'name' =>
$control_area->get_title()
);
}
- }
+ }*/
foreach ($procedure_array as $procedure)
{
@@ -471,7 +524,7 @@
'img_go_home'
=> 'rental/templates/base/images/32x32/actions/go-home.png',
'editable'
=> true,
'procedure'
=> array('options' => $procedure_options),
- 'control_area'
=> array('options' => $control_area_options),
+ 'control_area'
=> array('options' => $control_area_array),
'control_group'
=> $control_group_array,
'control_items'
=> $control_items,
'selected_control_items' =>
$selected_control_items,
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -73,6 +73,22 @@
if(phpgw::get_var('phpgw_return_as') == 'json') {
return $this->query();
}
+ // Sigurd: Start categories
+ $cats = CreateObject('phpgwapi.categories', -1,
'controller', '.control');
+ $cats->supress_info = true;
+
+ $control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','selected' =>
$control_area_id,'globals' => true,'use_acl' => $this->_category_acl));
+ array_unshift($control_areas['cat_list'],array
('cat_id'=>'','name'=> lang('select value')));
+ $control_areas_array2 = array();
+ foreach($control_areas['cat_list'] as $cat_list)
+ {
+ $control_areas_array2[] = array
+ (
+ 'id' => $cat_list['cat_id'],
+ 'name' => $cat_list['name'],
+ );
+ }
+ // END categories
self::add_javascript('controller', 'yahoo',
'datatable.js');
phpgwapi_yui::load_widget('datatable');
phpgwapi_yui::load_widget('paginator');
@@ -114,8 +130,8 @@
),
array('type' =>
'filter',
'name' =>
'control_areas',
- 'text' =>
lang('Control_area').':',
- 'list' =>
$this->so_control_area->get_control_area_select_array(),
+ 'text' =>
lang('Control_area'),
+ 'list' =>
$control_areas_array2,
),
array('type' => 'text',
'text' =>
lang('searchfield'),
@@ -303,8 +319,23 @@
}
else
{
-
- $control_area_array =
$this->so_control_area->get_control_area_array();
+ //Sigurd: START as categories
+ $cats = CreateObject('phpgwapi.categories',
-1, 'controller', '.control');
+ $cats->supress_info = true;
+
+ $control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl'
=> $this->_category_acl));
+
+ $control_area_array = array();
+ foreach($control_areas['cat_list'] as $cat_list)
+ {
+ $control_area_array[] = array
+ (
+ 'id' => $cat_list['cat_id'],
+ 'name' => $cat_list['name'],
+ );
+ }
+ // END as categories
+ //$control_area_array =
$this->so_control_area->get_control_area_array();
$control_group_array =
$this->so_control_group->get_control_group_array();
@@ -314,7 +345,7 @@
$msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
}
- foreach ($control_area_array as $control_area)
+/* foreach ($control_area_array as $control_area)
{
$control_area_options[] = array
(
@@ -323,7 +354,7 @@
);
}
-
+*/
foreach ($control_group_array as $control_group)
{
$control_group_options[] = array
@@ -342,7 +373,7 @@
'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
'editable'
=> true,
'control_item' =>
$control_item_array,
- 'control_area' =>
array('options' => $control_area_options),
+ 'control_area' =>
array('options' => $control_area_array),
'control_group' =>
array('options' => $control_group_options),
);
@@ -459,7 +490,10 @@
$msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
$msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
}
-
+
+ $category =
execMethod('phpgwapi.categories.return_single',
$control_item->get_control_area_id());
+
$control_item->set_control_area_name($category[0]['name']);
+
$control_item_array = $control_item->toArray();
$data = array
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-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -59,7 +59,9 @@
var $public_functions = array(
'index' => true,
'view_locations_for_control' => true,
-
'add_location_to_control' => true,
+
'register_control_to_location' => true,
+
'register_control_to_location_2' => true,
+
'get_locations_for_control' => true
);
function __construct()
@@ -120,7 +122,7 @@
'label' =>
lang('View_locations_for_control')
), array(
'label' =>
lang('Add_locations_for_control'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol_location.add_location_to_control'))
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol_location.register_control_to_location'))
));
$data = array(
@@ -128,7 +130,7 @@
'view' =>
"view_locations_for_control",
'control_areas_array2' =>
$control_areas_array2,
'locations_table' => array(
- 'source' =>
self::link(array('menuaction' =>
'controller.uicontrol.get_locations_for_control', 'control_id' => $control_id
,'phpgw_return_as' => 'json')),
+ 'source' =>
self::link(array('menuaction' =>
'controller.uicontrol_location.get_locations_for_control', 'control_id' =>
$control_id ,'phpgw_return_as' => 'json')),
'field' => array(
array(
'key' => 'id',
@@ -178,7 +180,7 @@
self::render_template_xsl(array('control_location/control_location_tabs',
'control_location/view_locations_for_control', 'common' ), $data);
}
- function add_location_to_control()
+ function register_control_to_location()
{
if(phpgw::get_var('phpgw_return_as') == 'json') {
return $this->query();
@@ -214,8 +216,6 @@
$default_value = array ('id'=>'','name'=>lang('no
role'));
array_unshift ($responsibility_roles,$default_value);
- $control_areas_array =
$this->so_control_area->get_control_areas_as_array();
-
// Sigurd: START as categories
$cats = CreateObject('phpgwapi.categories', -1,
'controller', '.control');
$cats->supress_info = true;
@@ -244,7 +244,7 @@
$data = array(
'tabs'
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 1),
- 'view'
=> "add_location_to_control",
+ 'view'
=> "register_control_to_location",
'control_filters' =>
array(
'control_areas_array2' =>
$control_areas_array2,
'control_array'
=> $control_array
@@ -256,7 +256,7 @@
'part_of_town_list' =>
$part_of_town_list
),
'datatable' => array(
- 'source' =>
self::link(array('menuaction' => 'controller.uicontrol_location.index',
'phpgw_return_as' => 'json')),
+ 'source' =>
self::link(array('menuaction' => 'controller.uicontrol_location.index',
'phpgw_return_as' => 'json', 'view_type' => 'register_control')),
'field' => array(
array(
'key' =>
'location_code',
@@ -304,11 +304,38 @@
self::add_javascript('controller', 'controller',
'jquery.js');
self::add_javascript('controller', 'controller',
'ajax.js');
-
self::render_template_xsl(array('control_location/control_location_tabs',
'control_location/add_location_to_control', 'common'), $data);
+
self::render_template_xsl(array('control_location/control_location_tabs',
'control_location/register_control_to_location', 'common'), $data);
}
+ // Returns locations for a control
+ public function get_locations_for_control()
+ {
+ $control_id = phpgw::get_var('control_id');
+
+ if(is_numeric($control_id) & $control_id > 0)
+ {
+ $locations_for_control_array =
$this->so_control->get_locations_for_control($control_id);
+
+ foreach($locations_for_control_array as
$location)
+ {
+ $results['results'][]= $location;
+ }
+
+ $results['total_records'] = count(
$locations_for_control_array );
+ $results['start'] = 1;
+ $results['sort'] = 'location_code';
+ }
+ else
+ {
+ $results['total_records'] = 0;
+ }
+
+ return $this->yui_results($results);
+ }
+
public function query(){
$type_id = phpgw::get_var('type_id');
+ $view_type = phpgw::get_var('view_type');
$return_results = phpgw::get_var('results', 'int',
'REQUEST', 0);
$type_id = $type_id ? $type_id : 1;
@@ -337,7 +364,28 @@
return $this->yui_results($results);
}
+
+ public function register_control_to_location_2()
+ {
+ $control_id = phpgw::get_var('control_id');
+ $location_code = phpgw::get_var('location_code');
+ $control_location = null;
+ $control_location_id = 0;
+
+ $control_location =
$this->so_control->get_control_location($control_id, $location_code);
+
+ if($control_location == null ){
+
+ $control_location_id =
$this->so_control->register_control_to_location($control_id, $location_code);
+ }
+
+ if($control_location_id > 0)
+ return json_encode( array( "status" => "saved"
) );
+ else
+ return json_encode( array( "status" =>
"not_saved" ) );
+ }
+
public function add_actions(&$value, $key, $params)
{
unset($value['query_location']);
@@ -348,7 +396,7 @@
$value['parameters'] = array();
$value['ajax'][] = true;
- $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'controller.uicontrol.add_location_to_control', 'location_code' =>
$value['location_code'])));
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'controller.uicontrol_location.register_control_to_location_2','location_code'
=> $value['location_code'], 'phpgw_return_as' => 'json')));
$value['labels'][] = lang('add_location');
$value['parameters'][] = "control_id";
}
Modified: branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -190,7 +190,7 @@
$procedure->set_purpose(phpgw::get_var('purpose','html'));
$procedure->set_responsibility(phpgw::get_var('responsibility'));
$procedure->set_description(phpgw::get_var('description','html'));
-
$procedure->set_reference(phpgw::get_var('reference'));
+
$procedure->set_reference(phpgw::get_var('reference','html'));
$procedure->set_attachment(phpgw::get_var('attachment'));
$procedure->set_start_date(strtotime(phpgw::get_var('start_date_hidden')));
$procedure->set_end_date(strtotime(phpgw::get_var('end_date_hidden')));
@@ -253,7 +253,7 @@
$procedure->set_purpose(phpgw::get_var('purpose','html'));
$procedure->set_responsibility(phpgw::get_var('responsibility'));
$procedure->set_description(phpgw::get_var('description','html'));
-
$procedure->set_reference(phpgw::get_var('reference'));
+
$procedure->set_reference(phpgw::get_var('reference','html'));
$procedure->set_attachment(phpgw::get_var('attachment'));
$procedure->set_start_date(strtotime(phpgw::get_var('start_date_hidden')));
$procedure->set_end_date(strtotime(phpgw::get_var('end_date_hidden')));
@@ -366,7 +366,7 @@
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('controller') . '::' . lang('Procedure');
-
$this->use_yui_editor(array('responsibility','description'));
+
$this->use_yui_editor(array('responsibility','description', 'reference'));
self::render_template_xsl(array('procedure/procedure_tabs', 'common',
'procedure/procedure_item'), $data);
}
@@ -425,6 +425,10 @@
$msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
$msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
}
+
+ $category =
execMethod('phpgwapi.categories.return_single',
$procedure->get_control_area_id());
+
$procedure->set_control_area_name($category_name = $category[0]['name']);
+
$procedure_array = $procedure->toArray();
if($procedure->get_start_date() &&
$procedure->get_start_date() != null)
@@ -501,7 +505,10 @@
foreach ($control_groups as $control_group)
{
$group_procedure = $this->so->get_single(
$control_group->get_procedure_id() );
- $group_procedures_array[] =
array("control_group" => $control_group->toArray(), "procedure" =>
$group_procedure->toArray());
+ if(isset($group_procedure))
+ {
+ $group_procedures_array[] =
array("control_group" => $control_group->toArray(), "procedure" =>
$group_procedure->toArray());
+ }
}
$data = array
Modified: branches/Version-1_0-branch/controller/inc/hook_home.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/hook_home.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/inc/hook_home.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -129,7 +129,8 @@
{
$curr_location = $control_instance[0];
$current_control = $control_instance[1];
- $check_lists =
$so->get_planned_check_lists_for_control($current_control->get_id());
+ $check_lists =
$so->get_planned_check_lists_for_control($current_control->get_id(),
$curr_location);
+ //_debug_array($check_lists);
$location_array = execMethod('property.bolocation.read_single',
array('location_code' => $curr_location));
$location_name = $location_array["loc1_name"];
foreach($control_areas['cat_list'] as $area)
@@ -162,7 +163,7 @@
}
$tmp++;
}
- echo "\n".'<!-- BEGIN checklist info
-->'."\n".$portalbox1->draw()."\n".'<!-- END checklist info -->'."\n";
+ echo "\n".'<!-- BEGIN checklist info -->'."\n<div
class='controller_checklist' style='padding-left:
10px;'>".$portalbox1->draw()."</div>\n".'<!-- END checklist info -->'."\n";
$portalbox2 = CreateObject('phpgwapi.listbox', array
(
@@ -202,7 +203,7 @@
{
$curr_location = $control_instance[0];
$current_control = $control_instance[1];
- $check_lists =
$so->get_planned_check_lists_for_control($current_control->get_id());
+ $check_lists =
$so->get_planned_check_lists_for_control($current_control->get_id(),
$curr_location);
//$control_location =
$so_control->getLocationCodeFromControl($current_control->get_id());
$location_array = execMethod('property.bolocation.read_single',
array('location_code' => $curr_location));
$location_name = $location_array["loc1_name"];
@@ -233,7 +234,7 @@
($current_date, array
(
'text' =>
"{$location_name} - {$control_area_name} - {$current_control->get_title()} ::
{$next_date}",
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'date' => $current_date, 'control_id'
=> $current_control->get_id(), 'location_code' => '1101'))
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'date' => $current_date, 'control_id'
=> $current_control->get_id(), 'location_code' => $curr_location))
));
}
}
@@ -245,7 +246,7 @@
($current_date, array
(
'text' => "{$location_name} -
{$control_area_name} - {$current_control->get_title()} :: {$next_date}",
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'date' => $current_date, 'control_id'
=> $current_control->get_id(), 'location_code' => '1101'))
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'date' => $current_date, 'control_id'
=> $current_control->get_id(), 'location_code' => $curr_location))
));
}
}
@@ -262,4 +263,4 @@
}
$tmp++;
}
- echo "\n".'<!-- BEGIN assigned checklist info
-->'."\n".$portalbox2->draw()."\n".'<!-- END assigned checklist info -->'."\n";
+ echo "\n".'<!-- BEGIN assigned checklist info -->'."\n<div
class='controller_checklist' style='padding-left:
10px;'>".$portalbox2->draw()."</div>\n".'<!-- END assigned checklist info
-->'."\n";
Modified:
branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -2,7 +2,7 @@
/**
* phpGroupWare - controller: a part of a Facilities Management System.
*
- * @author Erink Holm-Larsen <address@hidden>
+ * @author Erik 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.
@@ -40,6 +40,9 @@
protected $what_to_do;
protected $how_to_do;
protected $control_group_id;
+ protected $control_group_name;
+ protected $control_area_id;
+ protected $control_area_name;
protected $type;
/**
@@ -102,6 +105,20 @@
public function get_control_group_name() { return
$this->control_group_name; }
+ public function set_control_area_id($control_area_id)
+ {
+ $this->control_area_id = $control_area_id;
+ }
+
+ public function get_control_area_id() { return
$this->control_area_id; }
+
+ public function set_control_area_name($control_area_name)
+ {
+ $this->control_area_name = $control_area_name;
+ }
+
+ public function get_control_area_name() { return
$this->control_area_name; }
+
public function set_type($type)
{
$this->type = $type;
@@ -133,6 +150,7 @@
$result['what_to_do'] = $this->get_what_to_do();
$result['how_to_do'] = $this->get_how_to_do();
$result['control_group'] =
$this->get_control_group_name();
+ $result['control_area'] =
$this->get_control_area_name();
return $result;
}
Copied:
branches/Version-1_0-branch/controller/inc/model/class.control_location.inc.php
(from rev 8767, trunk/controller/inc/model/class.control_location.inc.php)
===================================================================
---
branches/Version-1_0-branch/controller/inc/model/class.control_location.inc.php
(rev 0)
+++
branches/Version-1_0-branch/controller/inc/model/class.control_location.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -0,0 +1,70 @@
+<?php
+ /**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @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 property
+ * @subpackage controller
+ * @version $Id: class.control.inc.php 8647 2012-01-23 07:28:36Z vator $
+ */
+
+ include_class('controller', 'model', 'inc/model/');
+
+ class controller_control_location extends controller_model
+ {
+ protected $id;
+ protected $location_code;
+ protected $control_id;
+
+ /**
+ * Constructor. Takes an optional ID. If a contract is
created from outside
+ * the database the ID should be empty so the database can add
one according to its logic.
+ *
+ * @param int $id the id of this composite
+ */
+ public function __construct(int $id = null)
+ {
+ $this->id = (int)$id;
+ }
+
+ public function set_id($id)
+ {
+ $this->id = $id;
+ }
+
+ public function get_id() { return (int)$this->id; }
+
+ public function get_location_code() { return
$this->location_code; }
+
+ public function set_location_code($location_code)
+ {
+ $this->location_code = $location_code;
+ }
+
+ public function get_control_id() { return
(int)$this->control_id; }
+
+ public function set_control_id($control_id)
+ {
+ $this->control_id = (int)$control_id;
+ }
+ }
Modified: branches/Version-1_0-branch/controller/js/controller/ajax.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/ajax.js
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/js/controller/ajax.js
2012-02-02 13:03:11 UTC (rev 8768)
@@ -38,10 +38,10 @@
htmlString += "<option
value='" + obj[i].id + "'>" + obj[i].title + "</option>";
});
- $("#control_id").html( htmlString );
+ $("#control_id").innerHTML(
htmlString );
}else {
htmlString += "<option>Ingen
kontroller</option>"
- $("#control_id").html( htmlString );
+ $("#control_id").innerHTML( htmlString
);
}
}
});
Deleted:
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test.js
===================================================================
---
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test.js
2012-02-02 13:00:58 UTC (rev 8767)
+++
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test.js
2012-02-02 13:03:11 UTC (rev 8768)
@@ -1,516 +0,0 @@
-
-
-/**
- * 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: '<?php echo
lang("DATATABLE_MSG_EMPTY")?>',
- MSG_ERROR: '<?php echo
lang("DATATABLE_MSG_ERROR")?>',
- MSG_LOADING: '<?php echo
lang("DATATABLE_MSG_LOADING")?>'
- }
- );
-
- //... 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);
-
- //... 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;
- }
- }
-
- var request =
YAHOO.util.Connect.asyncRequest(
- 'GET',
- record.getData().actions[
task.index ],
- {
- success:
ajaxResponseSuccess,
- success:
ajaxResponseFailure,
- args: table
- });
- } else {
- window.location =
record.getData().actions[task.index];
- }
- }
- };
-
- // 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 +
"()");
-/*
-<?php
- if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']
> 0)
- {
- $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else {
- $user_rows_per_page = 10;
- }
-?>
-*/
- // ... create a paginator for this datasource
-
- var pag = new YAHOO.widget.Paginator({
- rowsPerPage: 10,
- alwaysVisible: true,
- rowsPerPageOptions: [5, 10, 25, 50, 100, 200],
- firstPageLinkLabel: "<<asdasd <?php echo
lang('first') ?>",
- previousPageLinkLabel: "< <?php echo
lang('previous') ?>",
- nextPageLinkLabel: "<?php echo lang('next') ?>
>",
- lastPageLinkLabel: "<?php echo lang('last') ?>
>>",
- template :
"{RowsPerPageDropdown}<?php echo lang('elements_pr_page')
?>.{CurrentPageReport}<br/> {FirstPageLink} {PreviousPageLink} {PageLinks}
{NextPageLink} {LastPageLink}",
- pageReportTemplate : "<?php echo
lang('shows_from') ?> {startRecord} <?php echo lang('to') ?> {endRecord} <?php
echo lang('of_total') ?> {totalRecords}.",
- containers: [source_properties.paginator]
- });
-
- 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});
- }
Copied:
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test_rubbish.js
(from rev 8767,
trunk/controller/js/controller/controller_datatable_test_rubbish.js)
===================================================================
---
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test_rubbish.js
(rev 0)
+++
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test_rubbish.js
2012-02-02 13:03:11 UTC (rev 8768)
@@ -0,0 +1,516 @@
+
+
+/**
+ * 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: '<?php echo
lang("DATATABLE_MSG_EMPTY")?>',
+ MSG_ERROR: '<?php echo
lang("DATATABLE_MSG_ERROR")?>',
+ MSG_LOADING: '<?php echo
lang("DATATABLE_MSG_LOADING")?>'
+ }
+ );
+
+ //... 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);
+
+ //... 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;
+ }
+ }
+
+ var request =
YAHOO.util.Connect.asyncRequest(
+ 'GET',
+ record.getData().actions[
task.index ],
+ {
+ success:
ajaxResponseSuccess,
+ success:
ajaxResponseFailure,
+ args: table
+ });
+ } else {
+ window.location =
record.getData().actions[task.index];
+ }
+ }
+ };
+
+ // 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 +
"()");
+/*
+<?php
+ if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']
> 0)
+ {
+ $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else {
+ $user_rows_per_page = 10;
+ }
+?>
+*/
+ // ... create a paginator for this datasource
+
+ var pag = new YAHOO.widget.Paginator({
+ rowsPerPage: 10,
+ alwaysVisible: true,
+ rowsPerPageOptions: [5, 10, 25, 50, 100, 200],
+ firstPageLinkLabel: "<<asdasd <?php echo
lang('first') ?>",
+ previousPageLinkLabel: "< <?php echo
lang('previous') ?>",
+ nextPageLinkLabel: "<?php echo lang('next') ?>
>",
+ lastPageLinkLabel: "<?php echo lang('last') ?>
>>",
+ template :
"{RowsPerPageDropdown}<?php echo lang('elements_pr_page')
?>.{CurrentPageReport}<br/> {FirstPageLink} {PreviousPageLink} {PageLinks}
{NextPageLink} {LastPageLink}",
+ pageReportTemplate : "<?php echo
lang('shows_from') ?> {startRecord} <?php echo lang('to') ?> {endRecord} <?php
echo lang('of_total') ?> {totalRecords}.",
+ containers: [source_properties.paginator]
+ });
+
+ 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});
+ }
Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2012-02-02
13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2012-02-02
13:03:11 UTC (rev 8768)
@@ -1,4 +1,4 @@
-add_check_list_to_location controller no Registrer sjekkliste
for bygg
+add_check_list_to_location controller no Registrer kontroll for
bygg
location_connections controller no Byggknytning
control controller no Kontroll
controller common no Kontroll
@@ -66,7 +66,7 @@
6 characters controller no 6 tegn
active controller no Aktiv
add controller no Legg til
-add_location controller no Legg enhet til kontrollen
+add_location controller no Registrer kontroll til bygg
all controller no Alle
all_locations controller no Enheter fra eiendomsregisteret
annually controller no Årlig
@@ -310,4 +310,5 @@
View_documents_for_procedure controller no Tilknyttede dokumenter
Document title controller no Dokumentets tittel
Document name controller no Filnavn
-Document description controller no Beskrivelse
\ No newline at end of file
+Document description controller no Beskrivelse
+select value controller no Velg
\ No newline at end of file
Modified: branches/Version-1_0-branch/controller/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/setup.inc.php 2012-02-02
13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/setup/setup.inc.php 2012-02-02
13:03:11 UTC (rev 8768)
@@ -1,6 +1,6 @@
<?php
$setup_info['controller']['name'] = 'controller';
- $setup_info['controller']['version'] = '0.1.23';
+ $setup_info['controller']['version'] = '0.1.25';
$setup_info['controller']['app_order'] = 100;
$setup_info['controller']['enable'] = 1;
$setup_info['controller']['app_group'] = 'office';
Modified: branches/Version-1_0-branch/controller/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_current.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/setup/tables_current.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -76,7 +76,7 @@
'planned_date' => array('type' => 'int',
'precision' => 8, 'nullable' => True),
'completed_date' => array('type' => 'int',
'precision' => 8, 'nullable' => True),
'component_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
- 'location_code' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
+ 'location_code' => array('type' => 'varchar',
'precision' => 30, 'nullable' => false),
'num_open_cases' => array('type' => 'int',
'precision' => 4, 'nullable' => True)
),
'pk' => array('id'),
@@ -91,7 +91,7 @@
'purpose' => array('type' => 'text', 'nullable'
=> True),
'responsibility' => array('type' => 'varchar',
'precision' => 255, 'nullable' => True),
'description' => array('type' => 'text',
'nullable' => True),
- 'reference' => array('type' => 'varchar',
'precision' => 255, 'nullable' => True),
+ 'reference' => array('type' => 'text',
'nullable' => True),
'attachment' => array('type' => 'varchar',
'precision' => 255, 'nullable' => True),
'start_date' => array('type' => 'int',
'precision' => 8, 'nullable' => True),
'end_date' => array('type' => 'int',
'precision' => 8, 'nullable' => True),
Modified: branches/Version-1_0-branch/controller/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_update.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/controller/setup/tables_update.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -496,3 +496,36 @@
return
$GLOBALS['setup_info']['controller']['currentver'];
}
}
+
+ $test[] = '0.1.23';
+ function controller_upgrade0_1_23()
+ {
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_procedure','reference',array(
+ 'type' => 'text',
+ 'nullable' => true
+ ));
+
+ $GLOBALS['setup_info']['controller']['currentver'] = '0.1.24';
+ return $GLOBALS['setup_info']['controller']['currentver'];
+ }
+
+ $test[] = '0.1.24';
+ function controller_upgrade0_1_24()
+ {
+
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+ //Drop and reinsert because og the datatype int can't be
altered to varchar
+
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_check_list', array(),
'location_code');
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_list','location_code',array(
+ 'type' => 'varchar',
+ 'precision' => 30,
+ 'nullable' => true
+ ));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['controller']['currentver'] =
'0.1.25';
+ return
$GLOBALS['setup_info']['controller']['currentver'];
+ }
+ }
Deleted:
branches/Version-1_0-branch/controller/templates/base/control_location/add_location_to_control.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_location/add_location_to_control.xsl
2012-02-02 13:00:58 UTC (rev 8767)
+++
branches/Version-1_0-branch/controller/templates/base/control_location/add_location_to_control.xsl
2012-02-02 13:03:11 UTC (rev 8768)
@@ -1,200 +0,0 @@
-<!-- $Id$ -->
-<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>
-
-<xsl:template name="add_location_to_control">
- <!-- 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="control_filters" />
- <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="control_filters" name="control_filters">
- <div style="margin: 10px;padding: 10px; width: 25%;">
-
- <!-- When control area is chosen, an ajax request is executed.
The operation fetches controls from db and populates the control list.
- The ajax opearation is handled in ajax.js -->
- <select style="float:left;" id="control_area_list"
name="control_area_list">
- <option value="">Velg kontrollområde</option>
- <xsl:for-each select="control_areas_array2">
- <option value="{id}">
- <xsl:value-of
disable-output-escaping="yes" select="name"/>
- </option>
- </xsl:for-each>
- </select>
-
- <form id="loc_form" action="" method="GET">
- <select id="control_id" name="control_id">
- <xsl:choose>
- <xsl:when
test="control_array/child::node()">
- <xsl:for-each
select="control_array">
- <xsl:variable
name="control_id"><xsl:value-of select="id"/></xsl:variable>
- <option
value="{$control_id}">
- <xsl:value-of
select="title"/>
- </option>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <option>
- Ingen kontroller
- </option>
- </xsl:otherwise>
- </xsl:choose>
- </select>
- </form>
- </div>
-</xsl:template>
-
-<xsl:template match="filter_form">
- <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">
- <div>
- <ul id="filters">
- <li>
- <select id="type_id" name="type_id">
- <option value="">
- <xsl:value-of select="php:function('lang',
'Choose_building_type')"/>
- </option>
- <xsl:for-each select="building_types">
- <xsl:variable
name="building_type_id"><xsl:value-of select="id"/></xsl:variable>
- <option value="{$building_type_id}">
- <xsl:value-of select="name"/>
- </option>
- </xsl:for-each>
- </select>
- </li>
- <li>
- <select id="cat_id" name="cat_id">
- <option value="">
- <xsl:value-of select="php:function('lang',
'Choose_building_category')"/>
- </option>
- <xsl:for-each select="category_types">
- <xsl:variable
name="category_type_id"><xsl:value-of select="id"/></xsl:variable>
- <option value="{$category_type_id}">
- <xsl:value-of select="name"/>
- </option>
- </xsl:for-each>
- </select>
- </li>
- <li>
- <select id="district_id" name="district_id">
- <option value="">
- <xsl:value-of
select="php:function('lang', 'Choose_district')"/>
- </option>
- <xsl:for-each select="district_list">
- <xsl:variable name="district_id"><xsl:value-of
select="id"/></xsl:variable>
- <option value="{$district_id}">
- <xsl:value-of select="name"/>
- </option>
- </xsl:for-each>
- </select>
- </li>
- <li>
- <select id="part_of_town_id" name="part_of_town_id">
- <option value="">
- <xsl:value-of
select="php:function('lang', 'Choose_part_of_town')"/>
- </option>
- <xsl:for-each select="part_of_town_list">
- <xsl:variable
name="part_of_town_id"><xsl:value-of select="id"/></xsl:variable>
- <option value="{$part_of_town_id}">
- <xsl:value-of select="name"/>
- </option>
- </xsl:for-each>
- </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>
-
- </div>
-</xsl:template>
-
-<xsl:template match="datatable">
- <div id="data_paginator"/>
- <div id="datatable-container"/>
- <xsl:call-template name="datasource-definition" />
-</xsl:template>
-
-
-<xsl:template name="datasource-definition">
- <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 = ['type_id', 'cat_id', 'district_id',
'part-of_town_list', 'responsibility_roles_list'];
- var main_container = 'datatable-container';
- var main_table_id = 'datatable';
- var main_pag = 'data_paginator';
- var related_table = new Array('locations_table');
-
- setDataSource(main_source, main_columnDefs, main_form,
main_filters, main_container, main_pag, main_table_id, related_table );
-
- </script>
-
-</xsl:template>
Modified:
branches/Version-1_0-branch/controller/templates/base/control_location/control_location_tabs.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_location/control_location_tabs.xsl
2012-02-02 13:00:58 UTC (rev 8767)
+++
branches/Version-1_0-branch/controller/templates/base/control_location/control_location_tabs.xsl
2012-02-02 13:03:11 UTC (rev 8768)
@@ -13,13 +13,13 @@
<xsl:call-template name="view_locations_for_control" />
</xsl:when>
- <xsl:when test="view = 'add_location_to_control'">
+ <xsl:when test="view = 'register_control_to_location'">
<div class="identifier-header">
- <h1><xsl:value-of select="php:function('lang',
'Add_location_to_control')"/></h1>
+ <h1>Legg kontroll til bygg</h1>
</div>
<!-- Prints tabs array -->
<xsl:value-of disable-output-escaping="yes"
select="tabs" />
- <xsl:call-template name="add_location_to_control" />
+ <xsl:call-template name="register_control_to_location"
/>
</xsl:when>
</xsl:choose>
</div>
Copied:
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_location.xsl
(from rev 8767,
trunk/controller/templates/base/control_location/register_control_to_location.xsl)
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_location.xsl
(rev 0)
+++
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_location.xsl
2012-02-02 13:03:11 UTC (rev 8768)
@@ -0,0 +1,200 @@
+<!-- $Id$ -->
+<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>
+
+<xsl:template name="register_control_to_location">
+ <!-- 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="control_filters" />
+ <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="control_filters" name="control_filters">
+ <div style="margin: 10px;padding: 10px; width: 25%;">
+
+ <!-- When control area is chosen, an ajax request is executed.
The operation fetches controls from db and populates the control list.
+ The ajax opearation is handled in ajax.js -->
+ <select style="float:left;" id="control_area_list"
name="control_area_list">
+ <option value="">Velg kontrollområde</option>
+ <xsl:for-each select="control_areas_array2">
+ <option value="{id}">
+ <xsl:value-of
disable-output-escaping="yes" select="name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+
+ <form id="loc_form" action="" method="GET">
+ <select id="control_id" name="control_id">
+ <xsl:choose>
+ <xsl:when
test="control_array/child::node()">
+ <xsl:for-each
select="control_array">
+ <xsl:variable
name="control_id"><xsl:value-of select="id"/></xsl:variable>
+ <option
value="{$control_id}">
+ <xsl:value-of
select="title"/>
+ </option>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <option>
+ Ingen kontroller
+ </option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </select>
+ </form>
+ </div>
+</xsl:template>
+
+<xsl:template match="filter_form">
+ <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">
+ <div>
+ <ul id="filters">
+ <li>
+ <select id="type_id" name="type_id">
+ <option value="">
+ <xsl:value-of select="php:function('lang',
'Choose_building_type')"/>
+ </option>
+ <xsl:for-each select="building_types">
+ <xsl:variable
name="building_type_id"><xsl:value-of select="id"/></xsl:variable>
+ <option value="{$building_type_id}">
+ <xsl:value-of select="name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </li>
+ <li>
+ <select id="cat_id" name="cat_id">
+ <option value="">
+ <xsl:value-of select="php:function('lang',
'Choose_building_category')"/>
+ </option>
+ <xsl:for-each select="category_types">
+ <xsl:variable
name="category_type_id"><xsl:value-of select="id"/></xsl:variable>
+ <option value="{$category_type_id}">
+ <xsl:value-of select="name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </li>
+ <li>
+ <select id="district_id" name="district_id">
+ <option value="">
+ <xsl:value-of
select="php:function('lang', 'Choose_district')"/>
+ </option>
+ <xsl:for-each select="district_list">
+ <xsl:variable name="district_id"><xsl:value-of
select="id"/></xsl:variable>
+ <option value="{$district_id}">
+ <xsl:value-of select="name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </li>
+ <li>
+ <select id="part_of_town_id" name="part_of_town_id">
+ <option value="">
+ <xsl:value-of
select="php:function('lang', 'Choose_part_of_town')"/>
+ </option>
+ <xsl:for-each select="part_of_town_list">
+ <xsl:variable
name="part_of_town_id"><xsl:value-of select="id"/></xsl:variable>
+ <option value="{$part_of_town_id}">
+ <xsl:value-of select="name"/>
+ </option>
+ </xsl:for-each>
+ </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>
+
+ </div>
+</xsl:template>
+
+<xsl:template match="datatable">
+ <div id="data_paginator"/>
+ <div id="datatable-container"/>
+ <xsl:call-template name="datasource-definition" />
+</xsl:template>
+
+
+<xsl:template name="datasource-definition">
+ <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 = ['type_id', 'cat_id', 'district_id',
'part-of_town_list', 'responsibility_roles_list'];
+ var main_container = 'datatable-container';
+ var main_table_id = 'datatable';
+ var main_pag = 'data_paginator';
+ var related_table = new Array('locations_table');
+
+ setDataSource(main_source, main_columnDefs, main_form,
main_filters, main_container, main_pag, main_table_id, related_table );
+
+ </script>
+
+</xsl:template>
Modified:
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_item.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_item.xsl
2012-02-02 13:00:58 UTC (rev 8767)
+++
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_item.xsl
2012-02-02 13:03:11 UTC (rev 8768)
@@ -137,26 +137,13 @@
<dd>
<xsl:choose>
<xsl:when test="editable">
- <input type="text"
name="reference" id="reference" value="{procedure/reference}" />
+ <textarea
id="reference" name="reference" rows="5" cols="60"><xsl:value-of
select="procedure/reference" disable-output-escaping="yes"/></textarea>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of
select="procedure/reference" />
+ <xsl:value-of
select="procedure/reference" disable-output-escaping="yes"/>
</xsl:otherwise>
</xsl:choose>
- </dd>
- <dt>
- <label for="attachment"><xsl:value-of
select="php:function('lang','Procedure Attachment')" /></label>
- </dt>
- <dd>
- <xsl:choose>
- <xsl:when test="editable">
- <input type="text"
name="attachment" id="attachment" value="{procedure/attachment}" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
select="procedure/attachment" />
- </xsl:otherwise>
- </xsl:choose>
- </dd>
+ </dd>
</dl>
<div class="form-buttons">
Modified: branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -77,6 +77,10 @@
{
$voucher_id = $this->query &&
ctype_digit($this->query) ? $this->query : 0;
}
+ else
+ {
+ $user_lid = 'all';
+ }
if($voucher_id)
{
Modified: branches/Version-1_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soproject.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -587,8 +587,6 @@
$project_list = array();
-
-
$count_cols_return=count($cols_return);
while ($this->db->next_record())
@@ -617,16 +615,48 @@
$project['query_location']['loc' .
($m+1)]=implode("-", array_slice($location, 0, ($m+1)));
}
- $sql_workder = 'SELECT
sum(fm_workorder.combined_cost) as combined_cost,'
- . ' (sum(fm_workorder.act_mtrl_cost) +
sum(fm_workorder.act_vendor_cost)) as actual_cost,'
- . ' sum(fm_workorder.billable_hours) as
billable_hours'
- . " FROM fm_workorder WHERE project_id =
'{$project['project_id']}'";
+ $project['combined_cost'] = 0;
+ $project['actual_cost'] = 0;
+ $project['billable_hours'] = 0;
+
+ $sql_workder = 'SELECT
paid_percent,contract_sum, calculation, budget,'
+ . ' (fm_workorder.act_mtrl_cost +
fm_workorder.act_vendor_cost) as actual_cost,'
+ . ' billable_hours,closed'
+ . " FROM fm_workorder {$this->join}
fm_workorder_status ON fm_workorder.status = fm_workorder_status.id"
+ . " WHERE project_id =
'{$project['project_id']}'";
+
$this->db->query($sql_workder);
- $this->db->next_record();
- $project['combined_cost'] =
(int)$this->db->f('combined_cost');
- $project['actual_cost'] =
(int)$this->db->f('actual_cost');
- $project['billable_hours'] =
(int)$this->db->f('billable_hours');
+ while ($this->db->next_record())
+ {
+ $paid_percent =
(int)$this->db->f('paid_percent');
+ if($this->db->f('closed'))
+ {
+ $_sum = 0;
+ }
+ else if($this->db->f('contract_sum') >
0)
+ {
+ $_sum =
$this->db->f('contract_sum');
+ }
+ else if($this->db->f('calculation') > 0)
+ {
+ $_sum =
$this->db->f('calculation');
+ }
+ else if($this->db->f('budget') > 0)
+ {
+ $_sum = $this->db->f('budget');
+ }
+ else
+ {
+ $_sum = 0;
+ }
+
+ $_sum = $_sum * (100 -
$paid_percent)/100;
+
+ $project['combined_cost'] +=
$_sum;
+ $project['actual_cost'] +=
(int)$this->db->f('actual_cost');
+ $project['billable_hours'] +=
(int)$this->db->f('billable_hours');
+ }
}
return $project_list;
@@ -865,7 +895,7 @@
if($project['budget'])
{
- $this->updat_budget($id, $project['year'],
$project['budget']);
+ $this->updat_budget($id,
$project['budget_year'], $project['budget']);
}
if($project['extra']['contact_phone'] &&
$project['extra']['tenant_id'])
@@ -1068,7 +1098,7 @@
if($project['budget'])
{
- $new_budget =
$this->updat_budget($project['id'], $project['year'], $project['budget']);
+ $new_budget =
$this->updat_budget($project['id'], $project['budget_year'],
$project['budget']);
}
if($project['extra']['contact_phone'] &&
$project['extra']['tenant_id'])
Modified: branches/Version-1_0-branch/property/inc/class.uientity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uientity.inc.php
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/property/inc/class.uientity.inc.php
2012-02-02 13:03:11 UTC (rev 8768)
@@ -715,14 +715,80 @@
$uicols = $this->bo->uicols;
+ $uicols['name'][] = 'img_id';
+ $uicols['descr'][] = 'dummy';
+ $uicols['sortable'][] = false;
+ $uicols['sort_field'][] = '';
+ $uicols['format'][] = '';
+ $uicols['formatter'][] = '';
+ $uicols['input_type'][] = 'hidden';
+
+ $uicols['name'][] = 'directory';
+ $uicols['descr'][] = 'directory';
+ $uicols['sortable'][] = false;
+ $uicols['sort_field'][] = '';
+ $uicols['format'][] = '';
+ $uicols['formatter'][] = '';
+ $uicols['input_type'][] = 'hidden';
+
+ $uicols['name'][] = 'file_name';
+ $uicols['descr'][] = lang('name');
+ $uicols['sortable'][] = false;
+ $uicols['sort_field'][] = '';
+ $uicols['format'][] = '';
+ $uicols['formatter'][] = '';
+ $uicols['input_type'][] = 'hidden';
+
+ $uicols['name'][] = 'picture';
+ $uicols['descr'][] = '';
+ $uicols['sortable'][] = false;
+ $uicols['sort_field'][] = '';
+ $uicols['format'][] = '';
+ $uicols['formatter'][] = 'show_picture';
+ $uicols['input_type'][] = '';
+
+ $vfs = CreateObject('phpgwapi.vfs');
+ $vfs->override_acl = 1;
+
+
+ $img_types = array
+ (
+ 'image/jpeg',
+ 'image/png',
+ 'image/gif'
+ );
+
$content = array();
$j=0;
if (isset($entity_list) && is_array($entity_list))
{
- foreach($entity_list as $entity_entry)
+ foreach($entity_list as &$entity_entry)
{
+ $_loc1 = isset($entity_entry['loc1'])
&& $entity_entry['loc1'] ? $entity_entry['loc1'] : 'dummy';
+
+ $_files = $vfs->ls(array(
+ 'string' =>
"/property/{$this->category_dir}/{$_loc1}/{$entity_entry['id']}",
+ 'relatives' =>
array(RELATIVE_NONE)));
+
+ if(isset($_files[0]) && $_files[0] &&
in_array($_files[0]['mime_type'], $img_types))
+ {
+ $entity_entry['file_name']
= urlencode($_files[0]['name']);
+ $entity_entry['directory']
= urlencode($_files[0]['directory']);
+ $entity_entry['img_id']
= $_files[0]['file_id'];
+ }
+
for
($i=0;$i<count($uicols['name']);$i++)
{
+
+ switch ($uicols['name'][$i])
+ {
+ case 'num':
+ case 'loc1':
+ case 'loc1_name':
+
$uicols['input_type'][$i] = 'hidden';
+ break;
+ }
+
if($uicols['input_type'][$i]!='hidden')
{
if(isset($entity_entry['query_location'][$uicols['name'][$i]]))
@@ -763,7 +829,7 @@
$j++;
}
}
-
+ $vfs->override_acl = 0;
//indica que de la fila seleccionada escogera de la
columna "id" el valor "id". Para agregarlo al URL
$parameters = array
(
Modified: branches/Version-1_0-branch/property/js/yahoo/entity.index.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/entity.index.js
2012-02-02 13:00:58 UTC (rev 8767)
+++ branches/Version-1_0-branch/property/js/yahoo/entity.index.js
2012-02-02 13:03:11 UTC (rev 8768)
@@ -109,6 +109,17 @@
}
}
+
+ var show_picture = function(elCell, oRecord, oColumn, oData)
+ {
+ if(oRecord.getData('img_id'))
+ {
+ var oArgs = {menuaction:'property.uigallery.view_file',
file:oRecord.getData('directory') + '/' + oRecord.getData('file_name')};
+ var sUrl = phpGWLink('index.php', oArgs);
+ elCell.innerHTML = "<a href=\""+sUrl+"\"
title=\""+oRecord.getData('file_name')+"\" id=\""+oRecord.getData('img_id')+"\"
rel=\"colorbox\" target=\"_blank\"><img src=\""+sUrl+"&thumb=1\"
alt=\""+oRecord.getData('file_name')+"\" /></a>";
+ }
+ }
+
/****************************************************************************************/
this.myParticularRenderEvent = function()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8768] Merge 8740:8767 from trunk,
Sigurd Nes <=