[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] [20847] update projects
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] [20847] update projects |
Date: |
Fri, 20 Nov 2009 10:28:45 +0000 |
Revision: 20847
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=20847
Author: sigurdne
Date: 2009-11-20 10:28:44 +0000 (Fri, 20 Nov 2009)
Log Message:
-----------
update projects
Modified Paths:
--------------
people/sigurdne/modules/projects/trunk/inc/class.boconfig.inc.php
people/sigurdne/modules/projects/trunk/inc/class.boprojects.inc.php
people/sigurdne/modules/projects/trunk/inc/class.bostatistics.inc.php
people/sigurdne/modules/projects/trunk/inc/class.ipc_projects.inc.php
people/sigurdne/modules/projects/trunk/inc/class.ofprojects.inc.php
people/sigurdne/modules/projects/trunk/inc/class.soconfig.inc.php
people/sigurdne/modules/projects/trunk/inc/class.soprojects.inc.php
people/sigurdne/modules/projects/trunk/inc/class.uiconfig.inc.php
people/sigurdne/modules/projects/trunk/inc/class.uiprojects.inc.php
people/sigurdne/modules/projects/trunk/inc/class.uistatistics.inc.php
people/sigurdne/modules/projects/trunk/inc/hook_deleteaccount.inc.php
people/sigurdne/modules/projects/trunk/setup/default_records.inc.php
people/sigurdne/modules/projects/trunk/setup/setup.inc.php
people/sigurdne/modules/projects/trunk/setup/tables_update.inc.php
people/sigurdne/modules/projects/trunk/templates/base/preference_acl_row.tpl
people/sigurdne/modules/projects/trunk/templates/base/preference_colspan.tpl
Added Paths:
-----------
people/sigurdne/modules/projects/trunk/inc/addressrepositories/
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoExchange.inc.php
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoLDAP.inc.php
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPAccount.inc.php
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPContact.inc.php
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPOrgaContact.inc.php
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addressrepository.inc.php
people/sigurdne/modules/projects/trunk/inc/class.menu.inc.php
people/sigurdne/modules/projects/trunk/inc/class.pbaddbook_email.inc.php
people/sigurdne/modules/projects/trunk/inc/class.pbaddbook_projects.inc.php
people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccount.inc.php
people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccount_projects.inc.php
people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccounts.inc.php
people/sigurdne/modules/projects/trunk/inc/class.pbaddressbook.inc.php
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook.tpl
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_contacts.tpl
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_contactsdetails.tpl
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_repository.tpl
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_result.tpl
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_resultAccounts.tpl
Added:
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoExchange.inc.php
===================================================================
---
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoExchange.inc.php
(rev 0)
+++
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoExchange.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,82 @@
+<?php
+ /**
+ * addRepoExchange
+ * @author Philipp Kamps <address@hidden>
+ * @copyright Copyright (C) 2000-2004 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General
Public License
+ * @package phpgwapi
+ * @version
+ */
+
include_once('projects/inc/addressrepositories/class.addRepoLDAP.inc.php');
+
+ class addRepoExchange extends addRepoLDAP
+ {
+
+ var $public_functions = array
+ (
+ 'get_list' => true,
+ 'get_categories' => true
+ );
+
+ /**
+ * exchange
+ *
+ * @param
+ */
+ function addRepoExchange($DSN)
+ {
+ parent::addRepoLDAP($DSN);
+ $this->filter =
array('(&(objectclass=organizationalPerson)(|(cn=a*)(cn=b*)(cn=c*)(cn=d*)(cn=e*)(cn=f*)(cn=g*)(cn=h*)(cn=i*)))',
+
'(&(objectclass=organizationalPerson)(|(cn=j*)(cn=k*)(cn=l*)(cn=m*)(cn=n*)(cn=o*)(cn=p*)(cn=q*)(cn=r*)))',
+
'(&(objectclass=organizationalPerson)(|(cn=s*)(cn=t*)(cn=u*)(cn=v*)(cn=w*)(cn=x*)(cn=y*)(cn=z*)))',
+
utf8_encode('(&(objectclass=organizationalPerson)(|(cn=\xE4*)(cn=\xF6*)(cn=\xFC*)))')
+ );
+ }
+
+ /**
+ * Get list
+ *
+ */
+ function get_list($category = 'ou=CIS,o=Probusiness', $filter =
null, $attributes = false)
+ {
+ if(!$this->connection)
+ {
+ if(!$this->connection = $this->LDAPConnect())
+ {
+ return false;
+ }
+ }
+ if($filter)
+ {
+ $this->filter = array($filter);
+ }
+ else
+ {
+ $allValues = array();
+ for($i=0; $i < count($this->filter); $i++)
+ {
+ if(!$attributes)
+ {
+ $sri =
ldap_search($this->connection, $category, $this->filter[$i]);
+ }
+ else
+ {
+ $sri =
ldap_search($this->connection, $category, $this->filter[$i],$attributes);
+ }
+ $values =
ldap_get_entries($this->connection, $sri);
+ unset($values['count']);
+ $allValues = array_merge($allValues,
$values);
+ }
+ }
+ return $allValues;
+ }
+
+ function get_categories()
+ {
+ }
+
+ function get_details($id)
+ {
+ }
+ }
+?>
Property changes on:
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoExchange.inc.php
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added:
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoLDAP.inc.php
===================================================================
---
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoLDAP.inc.php
(rev 0)
+++
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoLDAP.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,233 @@
+<?php
+ /**
+ * addRepoLDAP
+ * @author Philipp Kamps <address@hidden>
+ * @copyright Copyright (C) 2000-2004 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General
Public License
+ * @package phpgwapi
+ * @version
+ */
+
include_once('projects/inc/addressrepositories/class.addressrepository.inc.php');
+
+ class addRepoLDAP extends addressrepository
+ {
+
+ var $filter;
+
+ var $public_functions = array
+ (
+ 'get_list' => true,
+ 'get_categories' => true
+ );
+
+ /**
+ * exchange
+ *
+ * @param
+ */
+ function addRepoLDAP($DSN)
+ {
+ parent::addressrepository($DSN);
+ $this->filter = 'objectclass=person';
+ }
+
+ function LDAPConnect()
+ {
+ return ldap_connect($this->hostspec, $this->port);
+ }
+
+ /**
+ * Get list
+ *
+ */
+ function get_list($category = '', $filter = '', $attributes =
false)
+ {
+ if($attributes)
+ {
+ $this->set_attributes($attributes);
+ }
+ if($filter)
+ {
+ if(substr($filter, 0, 3) == 'id=')
+ {
+ $category = substr($filter, 3);
+ $this->attributes = '';
+ }
+ else
+ {
+ $this->filter = $filter;
+ }
+ }
+ if(!$category)
+ {
+ $category = $this->category;
+ }
+ if(!$this->connection)
+ {
+ if(!$this->connection = $this->LDAPConnect())
+ {
+ return false;
+ }
+ }
+ if($this->filter && $this->attributes)
+ {
+ $sri = ldap_search($this->connection,
$category, $this->filter, $this->attributes);
+ }
+ elseif($this->filter)
+ {
+ $sri = ldap_search($this->connection,
$category, $this->filter);
+ }
+ else
+ {
+ $sri = ldap_search($this->connection,
$category);
+ }
+ ldap_sort($this->connection, $sri, 'cn');
+ $allValues = ldap_get_entries($this->connection, $sri);
+ $return = array();
+ for($i=0; $i < count($allValues); $i++)
+ {
+ if($allValues[$i]['cn'][0])
+ {
+ // hack begin
+ $fullname =
utf8_decode($allValues[$i]['cn'][0]);
+ if(strpos($fullname, '@'))
+ {
+ $fullname = substr($fullname,
0, strpos($fullname, '@'));
+ }
+ // hack end
+ $return[] = array('id' =>
$allValues[$i]['dn'],
+ 'fullname' =>
$fullname,
+ 'email' =>
$allValues[$i]['mail'][0],
+ 'street' =>
utf8_decode($allValues[$i]['postaladdress'][0]),
+ 'postalcode' =>
$allValues[$i]['postalcode'][0],
+ 'city' =>
utf8_decode($allValues[$i]['l'][0]),
+ 'organization' =>
$allValues[$i]['o'][0],
+ 'department' =>
utf8_decode($allValues[$i]['ou'][0]),
+ 'telefone' =>
$allValues[$i]['telephonenumber'][0]
+ );
+ }
+ }
+ return $return;
+ }
+
+ function get_categories()
+ {
+ if(!$this->connection)
+ {
+ if(!$this->connection = $this->LDAPConnect())
+ {
+ return false;
+ }
+ }
+ $sri = ldap_search($this->connection, $this->category,
'objectclass=organizationalunit', array('dn', 'ou'));
+ if($sri)
+ {
+ $allValues =
ldap_get_entries($this->connection, $sri);
+ $return = array();
+ for($i=0; $i < count($allValues); $i++)
+ {
+ if($allValues[$i]['ou'][0])
+ {
+ $return[] = array('id' =>
$allValues[$i]['dn'],
+ 'name' =>
$allValues[$i]['ou'][0]
+ );
+ }
+ }
+ return $this->keep_hierachy($return);
+ }
+ return false;
+ }
+
+ function get_details($id)
+ {
+ }
+
+ function set_attributes($attributes)
+ {
+ $mappedAttributes = array();
+ for ($i=0; $i < count($attributes); $i++)
+ {
+ $mappedAttributes[] =
$this->map_attribute($attributes[$i]);
+ }
+ $this->attributes = $mappedAttributes;
+ }
+
+ function keep_hierachy($values)
+ {
+ $minlevel = 10000;
+ for($i=0; $i < count($values); $i++)
+ {
+ $level = count(explode(',', $values[$i]['id']));
+ if($level < $minlevel)
+ {
+ $minlevel = $level;
+ }
+ }
+ for($i=0; $i < count($values); $i++)
+ {
+ $values[$i]['name'] = str_repeat(' ',
count(explode(',', $values[$i]['id'])) - $minlevel ).$values[$i]['name'];
+ }
+ return $values;
+ }
+
+ function set_filter($filter)
+ {
+ $this->filter = 'objectclass=person';
+ for($i = 0; $i < count($filter); $i++)
+ {
+ $value =
utf8_encode($filter[$i][key($filter[$i])]);
+ $field = $this->map_attribute(key($filter[$i]));
+ if(strlen($value) && $field)
+ {
+ $this->filter =
'(&('.$this->filter.')('.$field.'='.$value.'))';
+ }
+ }
+ }
+
+ function map_attribute($attribute)
+ {
+ switch ($attribute)
+ {
+ case 'id':
+ return 'dn';
+ break;
+
+ case 'fullname':
+ return 'cn';
+ break;
+
+ case 'email':
+ return 'mail';
+ break;
+
+ case 'street':
+ return 'postaladdress';
+ break;
+
+ case 'postalcode':
+ return 'postalcode';
+ break;
+
+ case 'city':
+ return 'l';
+ break;
+
+ case 'organization':
+ return 'o';
+ break;
+
+ case 'department':
+ return 'ou';
+ break;
+
+ case 'telefon':
+ return 'telephonenumber';
+ break;
+
+ case 'lastname':
+ return 'sn';
+ break;
+ }
+ }
+ }
+?>
Property changes on:
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoLDAP.inc.php
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added:
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPAccount.inc.php
===================================================================
---
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPAccount.inc.php
(rev 0)
+++
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPAccount.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,176 @@
+<?php
+ /**
+ * addressrepository
+ * @author Philipp Kamps <address@hidden>
+ * @copyright Copyright (C) 2000-2004 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General
Public License
+ * @package phpgwapi
+ * @version
+ */
+
include_once('projects/inc/addressrepositories/class.addressrepository.inc.php');
+
+ class addRepoPHPAccount extends addressrepository
+ {
+
+ var $phpGWaccounts;
+ var $public_functions = array
+ (
+ 'get_list' => true,
+ 'get_categories' => true
+ );
+
+ /**
+ * exchange
+ *
+ * @param
+ */
+ function addRepoPHPAccount($dsn)
+ {
+ $parsdDSN = $this->parseDSN($dsn);
+ $this->type = 'phpGroupware';
+ $this->username = $parsdDSN['username'];
+
+ $this->attributes = array('id', 'status');
+ $this->phpGWaccounts =
CreateObject('phpgwapi.accounts');
+ }
+
+ /**
+ * Get list
+ *
+ */
+ function get_list($category = '', $filter = '', $attributes =
null)
+ {
+ if($attributes)
+ {
+ $this->attributes = $attributes;
+ }
+ if($category)
+ {
+ $this->set_category($category);
+ }
+ if(substr($filter, 0, 3) == 'id=')
+ {
+ return array($this->get_entry(substr($filter,
3), $this->attributes));
+ }
+ $accounts = $this->phpGWaccounts->get_list('accounts',
-1, '', '', $this->filter);
+ for($i = 0; $i < count($accounts); $i++)
+ {
+ if(!count($this->category) ||
in_array($accounts[$i]['account_id'], $this->category))
+ {
+ $entries[] = array('id' =>
$accounts[$i]['account_id'],
+ 'fullname' =>
$this->parseFullName($accounts[$i]['account_lastname'],
$accounts[$i]['account_firstname'])
+ );
+ }
+ }
+ $this->sortData($entries, 'list');
+ return $entries;
+ }
+
+ function get_entry($id, $attributes = null)
+ {
+ if($attributes)
+ {
+ $this->attributes = $attributes;
+ }
+ if((int)$id)
+ {
+ $this->phpGWaccounts->account_id = (int)$id;
+ $entry =
$this->phpGWaccounts->read_repository();
+ for ($i = 0; $i < count($this->attributes);
$i++)
+ {
+ if($this->attributes[$i] == 'fullname')
+ {
+ $return['fullname'] =
$this->parseFullName($entry['account_lastname'], $entry['account_firstname']);
+ }
+ elseif($this->attributes[$i] ==
'status')
+ {
+ if(strtoupper($entry['status'])
== 'A')
+ {
+ $return['status'] = 1;
+ }
+ else
+ {
+ $return['status'] = 0;
+ }
+ }
+ else
+ {
+ $return[$this->attributes[$i]]
= $entry[$this->map_attribute($this->attributes[$i])];
+ }
+ }
+ return $return;
+ }
+ return false;
+ }
+
+ function get_categories()
+ {
+ $groups = $this->phpGWaccounts->get_list('groups');
+ $categories[] = array('id' => 0,
+ 'name' => lang('all')
+ );
+ for($i = 0; $i < count($groups); $i++)
+ {
+ $categories[] = array('id' =>
$groups[$i]['account_id'],
+ 'name' =>
$groups[$i]['account_lid']
+ );
+ }
+ $this->sortData($categories, 'categories');
+ return $categories;
+ }
+
+ function set_id($id)
+ {
+ $this->id = $id;
+ }
+
+ function get_id()
+ {
+ return $this->id;
+ }
+
+ function get_details($id)
+ {
+ }
+
+ function set_category($category)
+ {
+ if((int)$category)
+ {
+ $members =
$this->phpGWaccounts->member((int)$category);
+ }
+ $this->category = array();
+ for($i=0; $i < count($members); $i++)
+ {
+ $this->category[] = $members[$i]['account_id'];
+ }
+ }
+
+ function map_attribute($attribute)
+ {
+ switch ($attribute)
+ {
+ case 'id':
+ return 'account_id';
+ break;
+
+ case 'lastname':
+ return 'account_lastname';
+ break;
+
+ case 'firstname':
+ return 'account_firstname';
+ break;
+
+ default:
+ return $attribute;
+ }
+ }
+
+ function set_filter($filter)
+ {
+ $this->filter =
str_replace('*','',$filter[0]['lastname']);
+ }
+
+ }
+?>
Property changes on:
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPAccount.inc.php
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added:
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPContact.inc.php
===================================================================
---
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPContact.inc.php
(rev 0)
+++
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPContact.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,263 @@
+<?php
+ /**
+ * addRepoPHPGroupware
+ * @author Philipp Kamps <address@hidden>
+ * @copyright Copyright (C) 2000-2004 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General
Public License
+ * @package phpgwapi
+ * @version
+ */
+
include_once('projects/inc/addressrepositories/class.addressrepository.inc.php');
+
+ class addRepoPHPContact extends addressrepository
+ {
+
+ var $connection;
+
+ var $public_functions = array
+ (
+ 'get_list' => true,
+ 'get_categories' => true
+ );
+
+ /**
+ * exchange
+ *
+ * @param
+ */
+ function addRepoPHPContact($dsn)
+ {
+ $parsdDSN = $this->parseDSN($dsn);
+ $this->type = 'phpGroupware';
+ $this->username = $parsdDSN['username'];
+
+ $this->attributes = array('contact_id',
'per_full_name', 'email', 'owner');
+ $this->phpGWcontacts =
CreateObject('phpgwapi.contacts');
+ }
+
+ /**
+ * Get list
+ *
+ */
+ function get_list($category = '', $filter = '', $attributes =
false)
+ {
+ if($filter)
+ {
+ if(substr($filter, 0, 3) == 'id=')
+ {
+ $this->set_filter(array(array('id' =>
substr($filter, 3))));
+ }
+ }
+ if($attributes)
+ {
+ $this->set_attributes($attributes);
+ }
+ if($category)
+ {
+ $this->set_category($category);
+ }
+
+
+ /* Tell me how the new contacts backend is working and
I use it.
+ * I spend hours to get it to work - noooooo way
+ * - the categorisation for contacts is definitly made
by a genius!
+ *
+ $this->filter =
$this->phpGWcontacts->criteria_for_index($GLOBALS['phpgw']->accounts->account_id);
+ $emailRecipient =
$this->phpGWcontacts->get_persons($this->attributes, '', '', '', '',
$this->filter);
+ */
+
+ $acl = CreateObject('phpgwapi.acl');
+ $grants = $acl->get_grants('addressbook');
+ $sql_grants = '(';
+ foreach($grants as $key => $value)
+ {
+ if(substr($grants[$key], -1, 1) == '1')
+ {
+ $sql_grants .=
'phpgw_contact_person.created_by ='.$key.' OR ';
+ }
+ }
+ $sql_grants .= ' 1 ) AND ';
+ //die($sql_grants);
+ $db = $GLOBALS['phpgw']->db;
+ $db2 = $GLOBALS['phpgw']->db; //poor db abstract layer
:-(
+ $sql = 'SELECT person_id, first_name, last_name,
department, add1, city, postal_code ';
+ $sql .= 'FROM phpgw_contact_person, phpgw_contact ';
+ $sql .= 'LEFT JOIN phpgw_contact_addr ON (
phpgw_contact_person.person_id = phpgw_contact_addr.contact_id AND
phpgw_contact_addr.preferred = "Y" ) ';
+ $sql .= 'WHERE phpgw_contact_person.person_id =
phpgw_contact.contact_id AND ';
+ //$sql .= ' ';
+ $sql .= $this->category;
+ $sql .= $this->filter;
+ $sql .= $sql_grants;
+ $sql .= '1';
+ //echo $sql;
+ $result = $db->query($sql,__LINE__,__FILE__);
+
+ $i = 0;
+ while ($db->next_record()) // i still a no clue how
this api works
+ {
+ $return[$i] = array('id' =>
$db->f('person_id'),
+ 'fullname' =>
$this->parseFullName($db->f('last_name'), $db->f('first_name')),
+ 'department' =>
$db->f('department'),
+ 'street' =>
$db->f('add1'),
+ 'city' =>
$db->f('city'),
+ 'postalcode' =>
$db->f('postal_code')
+ );
+
+ $sql = 'SELECT comm_descr_id, comm_data FROM
phpgw_contact_comm ';
+ $sql .= 'WHERE (comm_descr_id = 2 OR
comm_descr_id = 4) AND contact_id = '.$return[$i]['id'].' ';
+ $comms = $db2->query($sql,__LINE__,__FILE__);
+ while ($db2->next_record())
+ {
+ if($db2->f('comm_descr_id') == 2)
+ {
+ $return[$i]['email'] =
$db2->f('comm_data');
+ }
+ elseif ($db2->f('comm_descr_id') == 4)
+ {
+ $return[$i]['telefone'] =
$db2->f('comm_data');
+ }
+ }
+ $i++;
+ }
+ $this->sortData($return, 'list');
+ return $return;
+ }
+
+ function get_categories()
+ {
+ $db = $GLOBALS['phpgw']->db;
+
+ $sql =
+ (
+ 'SELECT ' .
+ 'cat_id AS id, ' .
+ 'cat_parent AS parent_id, ' .
+ 'cat_name AS text, ' .
+ 'cat_appname AS target, ' .
+ 'cat_description AS description '.
+ 'FROM phpgw_categories ' .
+ 'WHERE ( cat_access = "public" OR
cat_owner="'.$GLOBALS['phpgw']->accounts->account_id.'") AND (
cat_appname="phpgw" OR cat_appname="addressbook" ) '
+ );
+
+ //echo $sql;
+ $result = $db->query($sql,__LINE__,__FILE__);
+
+ //adding category all for no category selection
+ $categories[] = array('id' => 0,
+ 'name' => lang('all')
+ );
+ while ($db->next_record()) // i still a no clue how
this api works
+ {
+ $categories[] = array('id' => $db->f('id'),
+
'name' => $db->f('text'),
+
'parent' => $db->f('parent_id')
+ );
+ }
+ $this->sortData($categories, 'categories');
+ return $this->keep_hierachy($categories);
+ }
+
+ function get_details($id)
+ {
+ }
+
+ function set_attributes($attributes)
+ {
+ $mappedAttributes = array();
+ for ($i=0; $i < count($attributes); $i++)
+ {
+ }
+ $this->attributes = $mappedAttributes;
+ return true;
+ }
+
+ function set_category($category)
+ {
+ if($category)
+ {
+ $phpgwcats =
CreateObject('phpgwapi.categories');
+ $childs = $phpgwcats->get_childs($category,
$GLOBALS['phpgw']->accounts->account_id);
+ $categories = array_merge($childs,
array($category));
+ $str = '( ';
+ for($i=0; $i < count($categories); $i++)
+ {
+ $str .= 'cat_id LIKE
"%,'.$categories[$i].',%" OR cat_id='.$categories[$i].' ';
+ if($i != (count($categories) - 1))
+ {
+ $str .= 'OR ';
+ }
+ }
+ $str .= ') AND ';
+ $this->category = $str;
+ }
+ }
+
+ function set_filter($filter)
+ {
+ $this->filter = '';
+ for($i = 0; $i < count($filter); $i++)
+ {
+ $value = str_replace('*', '',
$filter[$i][key($filter[$i])]);
+ $field = $this->map_attribute(key($filter[$i]));
+ if(strlen($value) && $field)
+ {
+ switch($field)
+ {
+ case 'id':
+ $this->filter .=
$field.'="'.$value.'" AND ';
+ break;
+
+ default:
+ $this->filter .= $field.' LIKE
"%'.$value.'%" AND ';
+ }
+ }
+ }
+ }
+
+ function map_attribute($attribute)
+ {
+ switch ($attribute)
+ {
+ case 'id':
+ return 'phpgw_contact.contact_id';
+ break;
+
+ case 'fullname':
+ return 'per_full_name';
+ break;
+
+ case 'email':
+ return 'email';
+ break;
+
+ case 'street':
+ return 'addr_add1';
+ break;
+
+ case 'postalcode':
+ return 'addr_postal_code';
+ break;
+
+ case 'city':
+ return 'addr_city';
+ break;
+
+ case 'organization':
+ return 'org_name';
+ break;
+
+ case 'department':
+ return 'per_department';
+ break;
+
+ case 'telefone':
+ return 'tel_work';
+ break;
+
+ case 'lastname':
+ return 'last_name';
+ break;
+ }
+ }
+ }
+?>
Property changes on:
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPContact.inc.php
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added:
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPOrgaContact.inc.php
===================================================================
---
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPOrgaContact.inc.php
(rev 0)
+++
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPOrgaContact.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,257 @@
+<?php
+ /**
+ * addRepoPHPGroupware
+ * @author Philipp Kamps <address@hidden>
+ * @copyright Copyright (C) 2000-2004 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General
Public License
+ * @package phpgwapi
+ * @version
+ */
+
include_once('projects/inc/addressrepositories/class.addressrepository.inc.php');
+
+ class addRepoPHPOrgaContact extends addressrepository
+ {
+
+ var $connection;
+
+ var $public_functions = array
+ (
+ 'get_list' => true,
+ 'get_categories' => true
+ );
+
+ /**
+ * Adressbook Repository to display organisation to person
structure
+ *
+ * @param $dsn
+ */
+ function addRepoPHPOrgaContact($dsn)
+ {
+ $parsdDSN = $this->parseDSN($dsn);
+ $this->type = 'phpGroupware';
+ $this->username = $parsdDSN['username'];
+
+ $this->attributes = array('contact_id',
'per_full_name', 'email', 'owner');
+ $this->phpGWcontacts =
CreateObject('phpgwapi.contacts');
+ $this->category = 'WHERE 1 AND ';
+ }
+
+ /**
+ * Get list
+ *
+ */
+ function get_list($category = '', $filter = '', $attributes =
false)
+ {
+ if($filter)
+ {
+ if(substr($filter, 0, 3) == 'id=')
+ {
+ $this->set_filter(array(array('id' =>
substr($filter, 3))));
+ }
+ }
+ if($attributes)
+ {
+ $this->set_attributes($attributes);
+ }
+ if($category)
+ {
+ $this->set_category($category);
+ }
+
+
+ /* Tell me how the new contacts backend is working and
I use it.
+ * I spend hours to get it to work - noooooo way
+ * - the categorisation for contacts is definitly made
by a genius!
+ *
+ $this->filter =
$this->phpGWcontacts->criteria_for_index($GLOBALS['phpgw']->accounts->account_id);
+ $emailRecipient =
$this->phpGWcontacts->get_persons($this->attributes, '', '', '', '',
$this->filter);
+ */
+
+ $acl = CreateObject('phpgwapi.acl');
+ $grants = $acl->get_grants('addressbook');
+ $sql_grants = '(';
+ foreach($grants as $key => $value)
+ {
+ if(substr($grants[$key], -1, 1) == '1')
+ {
+ $sql_grants .=
'phpgw_contact_person.created_by ='.$key.' OR ';
+ }
+ }
+ $sql_grants .= ' 1 ) AND ';
+ //die($sql_grants);
+ $db = $GLOBALS['phpgw']->db;
+ $db2 = $GLOBALS['phpgw']->db; //poor db abstract layer
:-(
+ $sql = 'SELECT phpgw_contact_person.person_id,
first_name, last_name, department, add1, city, postal_code ';
+ $sql .= 'FROM phpgw_contact ';
+ $sql .= 'LEFT JOIN phpgw_contact_org_person ON
(phpgw_contact.contact_id = phpgw_contact_org_person.person_id) ';
+ $sql .= 'LEFT JOIN phpgw_contact_person ON
(phpgw_contact_org_person.person_id = phpgw_contact_person.person_id) ';
+ $sql .= 'LEFT JOIN phpgw_contact_addr ON (
phpgw_contact_person.person_id = phpgw_contact_addr.contact_id AND
phpgw_contact_addr.preferred = "Y" ) ';
+ $sql .= $this->category;
+ $sql .= $this->filter;
+ $sql .= $sql_grants;
+ $sql .= '1';
+ //echo $sql;
+
+ $result = $db->query($sql,__LINE__,__FILE__);
+
+ $i = 0;
+ while ($db->next_record()) // i still a no clue how
this api works
+ {
+ $return[$i] = array('id' =>
$db->f('person_id'),
+ 'fullname' =>
$this->parseFullName($db->f('last_name'), $db->f('first_name')),
+ 'department' =>
$db->f('department'),
+ 'street' =>
$db->f('add1'),
+ 'city' =>
$db->f('city'),
+ 'postalcode' =>
$db->f('postal_code')
+ );
+
+ $sql = 'SELECT comm_descr_id, comm_data FROM
phpgw_contact_comm ';
+ $sql .= 'WHERE (comm_descr_id = 2 OR
comm_descr_id = 4) AND contact_id = '.$return[$i]['id'].' ';
+ $comms = $db2->query($sql,__LINE__,__FILE__);
+ while ($db2->next_record())
+ {
+ if($db2->f('comm_descr_id') == 2)
+ {
+ $return[$i]['email'] =
$db2->f('comm_data');
+ }
+ elseif ($db2->f('comm_descr_id') == 4)
+ {
+ $return[$i]['telefone'] =
$db2->f('comm_data');
+ }
+ }
+ $i++;
+ }
+ $this->sortData($return, 'list');
+ return $return;
+ }
+
+ function get_categories()
+ {
+
+ $acl = CreateObject('phpgwapi.acl');
+ $grants = $acl->get_grants('addressbook');
+ $sql_grants = '(';
+ foreach($grants as $key => $value)
+ {
+ if(substr($grants[$key], -1, 1) == '1')
+ {
+ $sql_grants .=
'phpgw_contact_person.created_by ='.$key.' OR ';
+ }
+ }
+ $sql_grants .= ' 1 ) AND ';
+ //die($sql_grants);
+
+ $db = $GLOBALS['phpgw']->db;
+
+ $sql =
+ (
+ 'SELECT org_id, name '.
+ 'FROM phpgw_contact_org '.
+ 'WHERE active = "Y" '.
+ ' ORDER BY name'
+ );
+
+ //echo $sql;
+ $result = $db->query($sql,__LINE__,__FILE__);
+
+ while ($db->next_record()) // i still a no clue how
this api works
+ {
+ $categories[] = array('id' =>
$db->f('org_id'),
+
'name' => $db->f('name')
+ );
+ }
+ $this->sortData($categories, 'categories');
+ return $categories;
+ }
+
+ function get_details($id)
+ {
+ }
+
+ function set_attributes($attributes)
+ {
+ $mappedAttributes = array();
+ for ($i=0; $i < count($attributes); $i++)
+ {
+ }
+ $this->attributes = $mappedAttributes;
+ return true;
+ }
+
+ function set_category($category)
+ {
+ if($category)
+ {
+ $this->category = 'WHERE
phpgw_contact_org_person.org_id = '.$category.' AND ';
+ }
+ }
+
+ function set_filter($filter)
+ {
+ $this->filter = '';
+ for($i = 0; $i < count($filter); $i++)
+ {
+ $value = str_replace('*', '',
$filter[$i][key($filter[$i])]);
+ $field = $this->map_attribute(key($filter[$i]));
+ if(strlen($value) && $field)
+ {
+ switch($field)
+ {
+ case 'phpgw_contact.contact_id':
+ $this->filter .=
$field.'="'.$value.'" AND ';
+ break;
+
+ default:
+ $this->filter .= $field.' LIKE
"%'.$value.'%" AND ';
+ }
+ }
+ }
+ }
+
+ function map_attribute($attribute)
+ {
+ switch ($attribute)
+ {
+ case 'id':
+ return 'phpgw_contact.contact_id';
+ break;
+
+ case 'fullname':
+ return 'per_full_name';
+ break;
+
+ case 'email':
+ return 'email';
+ break;
+
+ case 'street':
+ return 'addr_add1';
+ break;
+
+ case 'postalcode':
+ return 'addr_postal_code';
+ break;
+
+ case 'city':
+ return 'addr_city';
+ break;
+
+ case 'organization':
+ return 'org_name';
+ break;
+
+ case 'department':
+ return 'per_department';
+ break;
+
+ case 'telefone':
+ return 'tel_work';
+ break;
+
+ case 'lastname':
+ return 'last_name';
+ break;
+ }
+ }
+ }
+?>
Property changes on:
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addRepoPHPOrgaContact.inc.php
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added:
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addressrepository.inc.php
===================================================================
---
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addressrepository.inc.php
(rev 0)
+++
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addressrepository.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,304 @@
+<?php
+ /**
+ * addressrepository
+ * @author Philipp Kamps <address@hidden>
+ * @copyright Copyright (C) 2000-2004 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General
Public License
+ * @package phpgwapi
+ * @version
+ */
+
+ class addressrepository
+ {
+
+ var $id;
+ var $connection;
+
+ var $fields_listInfo = array();
+ var $fields_emailRecipient = array('id','fullname','email');
+
+ var $public_functions = array
+ (
+ 'get_list' => true,
+ 'get_categories' => true
+ );
+
+ /**
+ * exchange
+ *
+ * @param
+ */
+ function addressrepository($dsn)
+ {
+ $parsdDSN = $this->parseDSN($dsn);
+ $this->type = $parsdDSN['phptype'];
+ $this->username = $parsdDSN['username'];
+ $this->password = $parsdDSN['password'];
+ $this->protocol = $parsdDSN['protocol'];
+ $this->hostspec = $parsdDSN['hostspec'];
+ $this->port = $parsdDSN['port'];
+ $this->category = $parsdDSN['database'];
+ }
+
+ /**
+ * Get list
+ *
+ */
+ function get_list($category = '', $filter = '', $attributes =
false)
+ {
+ }
+
+ function get_categories()
+ {
+ }
+
+ function set_id($id)
+ {
+ $this->id = $id;
+ }
+
+ function get_id()
+ {
+ return $this->id;
+ }
+
+ function get_details($id)
+ {
+ }
+
+ function set_category($category)
+ {
+ $this->category = $category;
+ }
+
+ function keep_hierachy($todolist)
+ {
+ for ($i = 0; $i < count($todolist); $i++)
+ {
+ //echo
$i.':'.$this->get_hierarchy_index($todolist,
$todolist[$i]['parent']).'.'.$todolist[$i]['id'].'<br>';
+
$todolist_hierarchy[$this->get_hierarchy_index($todolist,
$todolist[$i]['parent']).'.'.$todolist[$i]['id']] = $todolist[$i];
+ }
+ //echo '<br><br>';
+ ksort($todolist_hierarchy, SORT_STRING);
+
+ $return = array();
+ foreach($todolist_hierarchy as $key => $val)
+ {
+ $level = explode('.', $key);
+ for($i=0; $i < count($level); $i++)
+ {
+ if($level[$i])
+ {
+ $val['name'] = ' '.$val['name'];
+ }
+ }
+ $return[] = $val;
+ //echo $val['name']." <=".$key.'<br>';
+ }
+ return $return;
+ }
+
+ function get_hierarchy_index($todo, $index)
+ {
+ for ($i = 0; $i < count($todo); $i++)
+ {
+ if ($todo[$i]['id'] == $index)
+ {
+ if ($todo[$i]['parent'] != 0)
+ {
+ $return =
$this->get_hierarchy_index($todo,$todo[$i]['parent']).'.'.$todo[$i]['id'];
+ } else
+ {
+ $return = '.'.$todo[$i]['id'];
+ break;
+ }
+ }
+ }
+ return $return;
+ }
+
+ function parseFullName($last, $first = '', $middle = '', $title
= '')
+ {
+ return
$GLOBALS['phpgw']->common->display_fullname('',$first,$last);
+ }
+
+ function get_category()
+ {
+ return $this->category;
+ }
+ // }}}
+ // {{{ parseDSN()
+ /**
+ * Parse a data source name
+ *
+ * A array with the following keys will be returned:
+ * phptype: Database backend used in PHP (mysql, odbc etc.)
+ * dbsyntax: Database used with regards to SQL syntax etc.
+ * protocol: Communication protocol to use (tcp, unix etc.)
+ * hostspec: Host specification (hostname[:port])
+ * database: Database to use on the DBMS server
+ * username: User name for login
+ * password: Password for login
+ *
+ * The format of the supplied DSN is in its fullest form:
+ *
+ * phptype(dbsyntax)://username:address@hidden/database
+ *
+ * Most variations are allowed:
+ *
+ * phptype://username:address@hidden:110//usr/db_file.db
+ * phptype://username:address@hidden/database_name
+ * phptype://username:address@hidden
+ * phptype://address@hidden
+ * phptype://hostspec/database
+ * phptype://hostspec
+ * phptype(dbsyntax)
+ * phptype
+ *
+ * @param string $dsn Data Source Name to be parsed
+ *
+ * @return array an associative array
+ *
+ * @author Tomas V.V.Cox <address@hidden>
+ */
+ function parseDSN($dsn)
+ {
+ if (is_array($dsn)) {
+ return $dsn;
+ }
+
+ $parsed = array(
+ 'phptype' => false,
+ 'dbsyntax' => false,
+ 'username' => false,
+ 'password' => false,
+ 'protocol' => false,
+ 'hostspec' => false,
+ 'port' => false,
+ 'socket' => false,
+ 'database' => false
+ );
+
+ // Find phptype and dbsyntax
+ if (($pos = strpos($dsn, '://')) !== false) {
+ $str = substr($dsn, 0, $pos);
+ $dsn = substr($dsn, $pos + 3);
+ } else {
+ $str = $dsn;
+ $dsn = NULL;
+ }
+
+ // Get phptype and dbsyntax
+ // $str => phptype(dbsyntax)
+ if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
+ $parsed['phptype'] = $arr[1];
+ $parsed['dbsyntax'] = (empty($arr[2])) ? $arr[1] : $arr[2];
+ } else {
+ $parsed['phptype'] = $str;
+ $parsed['dbsyntax'] = $str;
+ }
+
+ if (empty($dsn)) {
+ return $parsed;
+ }
+
+ // Get (if found): username and password
+ // $dsn => username:address@hidden/database
+ if (($at = strrpos($dsn,'@')) !== false) {
+ $str = substr($dsn, 0, $at);
+ $dsn = substr($dsn, $at + 1);
+ if (($pos = strpos($str, ':')) !== false) {
+ $parsed['username'] = rawurldecode(substr($str, 0, $pos));
+ $parsed['password'] = rawurldecode(substr($str, $pos + 1));
+ } else {
+ $parsed['username'] = rawurldecode($str);
+ }
+ }
+
+ // Find protocol and hostspec
+
+ // $dsn => proto(proto_opts)/database
+ if (preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) {
+ $proto = $match[1];
+ $proto_opts = (!empty($match[2])) ? $match[2] : false;
+ $dsn = $match[3];
+
+ // $dsn => protocol+hostspec/database (old format)
+ } else {
+ if (strpos($dsn, '+') !== false) {
+ list($proto, $dsn) = explode('+', $dsn, 2);
+ }
+ if (strpos($dsn, '/') !== false) {
+ list($proto_opts, $dsn) = explode('/', $dsn, 2);
+ } else {
+ $proto_opts = $dsn;
+ $dsn = null;
+ }
+ }
+
+ // process the different protocol options
+ $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp';
+ $proto_opts = rawurldecode($proto_opts);
+ if ($parsed['protocol'] == 'tcp') {
+ if (strpos($proto_opts, ':') !== false) {
+ list($parsed['hostspec'], $parsed['port']) = explode(':',
$proto_opts);
+ } else {
+ $parsed['hostspec'] = $proto_opts;
+ }
+ } elseif ($parsed['protocol'] == 'unix') {
+ $parsed['socket'] = $proto_opts;
+ }
+
+ // Get dabase if any
+ // $dsn => database
+ if (!empty($dsn)) {
+ // /database
+ if (($pos = strpos($dsn, '?')) === false) {
+ $parsed['database'] = $dsn;
+ // /database?param1=value1¶m2=value2
+ } else {
+ $parsed['database'] = substr($dsn, 0, $pos);
+ $dsn = substr($dsn, $pos + 1);
+ if (strpos($dsn, '&') !== false) {
+ $opts = explode('&', $dsn);
+ } else { // database?param1=value1
+ $opts = array($dsn);
+ }
+ foreach ($opts as $opt) {
+ list($key, $value) = explode('=', $opt);
+ if (!isset($parsed[$key])) { // don't allow params
overwrite
+ $parsed[$key] = rawurldecode($value);
+ }
+ }
+ }
+ }
+
+ return $parsed;
+ }
+
+ function sortData(&$sortDataArray, $sortCompareMethod)
+ {
+ if(!is_array($sortDataArray))
+ return false;
+
+ switch($sortCompareMethod)
+ {
+ case 'list': $sortCompareMethod =
'sort_list'; break;
+ case 'categories': $sortCompareMethod =
'sort_categories'; break;
+ default: return false;
+ }
+
+ return usort($sortDataArray, array(get_class($this),
$sortCompareMethod));
+ }
+
+ function sort_list($a, $b)
+ {
+ return strcasecmp($a["fullname"], $b["fullname"]);
+ }
+
+ function sort_categories($a, $b)
+ {
+ return strcasecmp($a["name"], $b["name"]);
+ }
+ }
+?>
\ No newline at end of file
Property changes on:
people/sigurdne/modules/projects/trunk/inc/addressrepositories/class.addressrepository.inc.php
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ native
Modified: people/sigurdne/modules/projects/trunk/inc/class.boconfig.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.boconfig.inc.php
2009-11-20 10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/inc/class.boconfig.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -57,7 +57,7 @@
function save_prefs($prefs)
{
- $GLOBALS['phpgw']->preferences->read_repository();
+ $GLOBALS['phpgw']->preferences->read();
if(!is_array($prefs['cols']))
{
@@ -89,18 +89,16 @@
$emps = array_unique($emps);
for($i=0;$i<count($emps);$i++)
{
-
$GLOBALS['phpgw']->accounts->get_account_name($emps[$i],$lid,$fname,$lname);
- $fullname =
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname);
+ $user =
$GLOBALS['phpgw']->accounts->get($emps[$i]);
$empl[] = array
(
'account_id' =>
$emps[$i],
- 'account_lid' => $lid,
- 'account_firstname' =>
$fname,
- 'account_lastname' =>
$lname,
- 'account_fullname' =>
$fullname
+ 'account_lid' =>
$user->lid,
+ 'account_firstname' =>
$user->firstname,
+ 'account_lastname' =>
$user->lastname,
+ 'account_fullname' =>
(string) $user
);
- $lid = $fname = $lname = $fullname = '';
}
}
@@ -210,7 +208,7 @@
foreach($admins as $ad)
{
$accounts =
CreateObject('phpgwapi.accounts',$ad['account_id']);
- $accounts->read_repository();
+ $accounts->read();
$admin_data[] = array
(
'account_id' =>
$ad['account_id'],
@@ -484,7 +482,7 @@
break;
case 'save':
$config =
CreateObject('phpgwapi.config','projects');
- $config->read_repository();
+ $config->read();
$config->value('proid_help_msg',$params['proid_help_msg']);
$config->save_repository();
break;
@@ -504,7 +502,7 @@
}
$config = CreateObject('phpgwapi.config','projects');
- $config->read_repository();
+ $config->read();
switch($values['action'])
{
@@ -567,7 +565,7 @@
return false;
$config = CreateObject('phpgwapi.config','projects');
- $config->read_repository();
+ $config->read();
switch($values['action'])
{
@@ -648,7 +646,7 @@
return false;
$config = CreateObject('phpgwapi.config','projects');
- $config->read_repository();
+ $config->read();
switch($values['action'])
{
Modified: people/sigurdne/modules/projects/trunk/inc/class.boprojects.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.boprojects.inc.php
2009-11-20 10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/inc/class.boprojects.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -64,7 +64,7 @@
$this->siteconfig = $this->soprojects->siteconfig;
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->grants =
$GLOBALS['phpgw']->acl->get_grants('projects');
+ $this->grants =
$GLOBALS['phpgw']->acl->get_grants('projects', 'project');
$this->grants[$this->account] = PHPGW_ACL_READ +
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
$this->html_output = true;
@@ -368,7 +368,7 @@
{
$this->accounts =
CreateObject('phpgwapi.accounts',$account_id);
- $this->accounts->read_repository();
+ $this->accounts->read();
$cached_data[$this->accounts->data['account_id']]['account_id'] =
$this->accounts->data['account_id'];
$cached_data[$this->accounts->data['account_id']]['account_lid'] =
$this->accounts->data['account_lid'];
@@ -456,7 +456,7 @@
{
$myproject =
$this->soprojects->read_single_project($project_id);
- $empl =
$GLOBALS['phpgw']->acl->get_ids_for_location($project_id, 7, 'project_members');
+ $empl =
$GLOBALS['phpgw']->acl->get_ids_for_location(".project_members.{$project_id}",
7, 'projects');
if(!count($empl) || $empl[0] == '')
{
$empl = null;
@@ -481,6 +481,7 @@
function selected_employees( $data = 0 )
{
+ $empl = array();
$project_id = intval($data['project_id']);
$pro_parent = intval($data['pro_parent']);
@@ -541,22 +542,22 @@
continue;
//$this->accounts =
CreateObject('phpgwapi.accounts',$emps[$i]);
- //$this->accounts->read_repository();
+ //$this->accounts->read();
if( $data['roles_included'] == true )
{
$role_name =
$this->soprojects->return_value('role',$project_id,$emps[$i]);
}
-
$GLOBALS['phpgw']->accounts->get_account_name($emps[$i],$lid,$fname,$lname);
+ $user =
$GLOBALS['phpgw']->accounts->get($emps[$i]);
$empl[] = array
(
- 'account_id' => $emps[$i],
- 'account_lid' => $lid,
- 'account_firstname' => $fname,
- 'account_lastname' => $lname,
- 'account_fullname' =>
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname),
+ 'account_id' => $user->id,
+ 'account_lid' => $user->lid,
+ 'account_firstname' =>
$user->firstname,
+ 'account_lastname' =>
$user->lastname,
+ 'account_fullname' => (string)
$user,
'role_name' =>
isset($role_name)?$role_name:''
);
}
@@ -2128,7 +2129,8 @@
for( $i=0; $i < count($values['employees']);
$i++ )
{
-
$GLOBALS['phpgw']->acl->add_repository('project_members',$values['project_id'],$values['employees'][$i],7);
+
$GLOBALS['phpgw']->locations->add(".project_members.{$values['project_id']}",
"Project # {$values['project_id']}", 'projects', false);
+
$GLOBALS['phpgw']->acl->add_repository('projects',
".project_members.{$values['project_id']}", $values['employees'][$i], 7);
}
}
@@ -2530,13 +2532,13 @@
if( $send_alarm )
{
$prefs_co =
CreateObject('phpgwapi.preferences',$co);
- $prefs_co->read_repository();
+ $prefs_co->read();
$sender =
$prefs_co->email_address($co);
unset($prefs_co);
$prefs =
CreateObject('phpgwapi.preferences', $emp_events[$k]['account_id']);
- $prefs->read_repository();
+ $prefs->read();
$msgtype = '"projects";';
@@ -2813,6 +2815,7 @@
function get_granted_roles( $project_id )
{
+ $assigned = array();
$emps = $this->selected_employees($project_id);
$roles = $this->get_employee_roles($project_id);
@@ -2836,9 +2839,8 @@
'role_name' =>
$assigned_role
);
}
- return $assigned;
}
- return false;
+ return $assigned;
}
function list_events( $type = '' )
@@ -3288,20 +3290,15 @@
while( list($employee_id, $employee_projects) =
each($employees) )
{
$prefs =
CreateObject('phpgwapi.preferences', $employee_id);
- $prefs->read_repository();
+ $prefs->read();
if(
(isset($prefs->data['projects']['send_status_mail']) ) &&
($prefs->data['projects']['send_status_mail'] == false) )
{
continue;
}
- $employee_lid = '';
- $employee_pname = '';
- $employee_lname = '';
+ $fullname = (string)
$accounts->get($employee_id);
-
$accounts->get_account_name($employee_id, $employee_lid, $employee_pname,
$employee_lname);
- $fullname = $employee_pname.'
'.$employee_lname;
-
$employee_email =
$prefs->email_address($employee_id);
if( !$employee_email )
@@ -3478,14 +3475,13 @@
//echo '<pre>';
//print_r($acl_projectmembers);
- while( list($employee_id, $employee_projects) =
each($acl_projectmembers) )
+ foreach ( $acl_prohectmembers as $employee_id =>
$employee_projects )
{
$prefs = CreateObject('phpgwapi.preferences',
$employee_id);
- $prefs->read_repository();
+ $prefs->read();
$employee_lid = $employee_pname =
$employee_lname = '';
- $accounts->get_account_name($employee_id,
$employee_lid, $employee_pname, $employee_lname);
- $fullname = $employee_pname . ' ' .
$employee_lname;
+ $fullname = (string)
$accounts->get($employee_id);
$employee_email =
$prefs->email_address($employee_id);
Modified: people/sigurdne/modules/projects/trunk/inc/class.bostatistics.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.bostatistics.inc.php
2009-11-20 10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/inc/class.bostatistics.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -110,7 +110,7 @@
{
foreach($users as $user)
{
-
if(in_array($user['account_id'],$pro_employees))
+
if(in_array($user->id,$pro_employees))
{
$rights[] = $user;
}
Modified: people/sigurdne/modules/projects/trunk/inc/class.ipc_projects.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.ipc_projects.inc.php
2009-11-20 10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/inc/class.ipc_projects.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -13,19 +13,19 @@
* Fassade of the projects application.
* @package projects
*/
- class ipc_projects extends ipc_
+ class projects_ipc_projects extends phpgwapi_ipc_
{
/**
* @var object $bo application storage object
* @access private
*/
- var $boprojects;
+ protected $boprojects;
/**
* Constructor
*/
- function ipc_projects()
+ public function __construct()
{
$this->boprojects =&
CreateObject('projects.boprojects');
}
Added: people/sigurdne/modules/projects/trunk/inc/class.menu.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.menu.inc.php
(rev 0)
+++ people/sigurdne/modules/projects/trunk/inc/class.menu.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,316 @@
+<?php
+ /**
+ * Project Manager - Menus
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2009 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @package projects
+ * @subpackage core
+ * @version $Id$
+ */
+
+ /**
+ * Description
+ * @package projects
+ */
+
+ class projects_menu
+ {
+ var $sub;
+
+ var $public_functions = array
+ (
+ 'links' => true,
+ );
+
+ function projects_menu($sub='')
+ {
+ $this->sub = $sub;
+ }
+
+ /**
+ * Get the menus for the projects
+ *
+ * @return array available menus for the current user
+ */
+ public function get_menu()
+ {
+ $boprojects = CreateObject('projects.boprojects');
+
+ /* if( isset($boprojects->siteconfig['show_sidebox']) &&
($boprojects->siteconfig['show_sidebox'] == 'no') )
+ return;
+ }
+*/
+ $incoming_app =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
'projects';
+
+ $start_page = 'projects';
+ if (
isset($GLOBALS['phpgw_info']['user']['preferences']['projects']['default_start_page'])
+ &&
$GLOBALS['phpgw_info']['user']['preferences']['projects']['default_start_page']
)
+ {
+ $start_page =
$GLOBALS['phpgw_info']['user']['preferences']['projects']['default_start_page'];
+ }
+
+ $menus['navbar'] = array
+ (
+ 'projects' => array
+ (
+ 'text' => lang('projects'),
+ // 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
"projects.ui{$start_page}.index") ),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
"projects.uiprojects.list_projects") ),
+ 'image' => array('projects', 'navbar'),
+ 'order' => 35,
+ 'group' => 'facilities management'
+ ),
+ );
+
+ $menus['toolbar'] = array();
+
+ if (
isset($GLOBALS['phpgw_info']['user']['apps']['admin']) )
+ {
+ $menus['admin'] = array
+ (
+ 'configuration' => array
+ (
+ 'text' =>
$GLOBALS['phpgw']->translation->translate('Site Configuration', array(), true),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'admin.uiconfig.index','appname'=>
'projects'))
+ ),
+ 'worktime_statusmail' => array
+ (
+ 'text' =>
$GLOBALS['phpgw']->translation->translate('Worktime statusmail', array(), true),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',
array('menuaction'=>'projects.uiconfig.config_worktime_statusmail'))
+ ),
+ 'worktime_warnmail' => array
+ (
+ 'text' =>
$GLOBALS['phpgw']->translation->translate('Worktime warnmail', array(), true),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',
array('menuaction'=>'projects.uiconfig.config_worktime_warnmail'))
+ ),
+ 'workhours_booking' => array
+ (
+ 'text' =>
$GLOBALS['phpgw']->translation->translate('Workhours booking', array(), true),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',
array('menuaction'=>'projects.uiconfig.config_workhours_booking'))
+ ),
+ 'edit_locations' => array
+ (
+ 'text' =>
$GLOBALS['phpgw']->translation->translate('edit locations', array(), true),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',
array('menuaction'=>'projects.uiconfig.config_locations'))
+ ),
+
+ 'managing_committee' => array
+ (
+ 'text' => lang('managing
committee'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_admins','action'=>'pmanager'))
+ ),
+ 'administrators' => array
+ (
+ 'text' => lang('project
administrators'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_admins','action'=>'pad'))
+ ),
+ 'sales_department' => array
+ (
+ 'text' => lang('sales
department'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_admins','action'=>'psale'))
+ ),
+ 'categories' => array
+ (
+ 'text' => lang('Global
Categories'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'admin.uicategories.index','appname'=>
'projects'))
+ ),
+ 'project_id_help_msg' => array
+ (
+ 'text' => lang('edit project
id help msg'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_proid_help_msg'))
+ ),
+ 'acl' => array
+ (
+ 'text' => lang('Configure
Access Permissions'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'preferences.uiadmin_acl.list_acl', 'acl_app' => 'projects') )
+ )
+ );
+ }
+
+ if (
isset($GLOBALS['phpgw_info']['user']['apps']['preferences']) )
+ {
+ $menus['preferences'] = array();
+ $menus['preferences'][] = array
+ (
+ 'text' => lang('Preferences'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.preferences'))
+ );
+
+ $menus['preferences'][] = array
+ (
+ 'text' => lang('Grant Access'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'preferences.uiadmin_acl.aclprefs', 'acl_app'=> 'projects') )
+ );
+
+ $menus['preferences'][] = array
+ (
+ 'text' => lang('Edit categories'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'preferences.uicategories.index','cats_app'=>'projects','cats_level'=>'True','global_cats'=>'True'))
+ );
+
+ if ( $boprojects->isprojectadmin('pad') ||
$boprojects->isprojectadmin('pmanager') )
+ {
+ $menus['preferences'][] = array
+ (
+ 'text' => lang('Roles'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_roles','action'=>'role'))
+ );
+
+ $menus['preferences'][] = array
+ (
+ 'text' => lang('events'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_events'))
+ );
+
+ $menus['preferences'][] = array
+ (
+ 'text' => lang('surcharges'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'projects.uiconfig.list_surcharges'))
+ );
+ }
+
+ $menus['toolbar'][] = array
+ (
+ 'text' => lang('Preferences'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.preferences')),
+ // 'url' =>
$GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname' =>
'projects')),
+ 'image' => array('projects',
'preferences')
+ );
+ }
+
+ $statistics_children = array
+ (
+ 'work_hours' => array
+ (
+ 'text' => 'work hours statistics',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uistatistics.list_users_worktimes'))
+ ),
+ 'gantt_chart' => array
+ (
+ 'text' => 'Gantt Chart',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uistatistics.list_projects'))
+ ),
+ 'per employee' => array
+ (
+ 'text' => 'Projects per employee',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uistatistics.list_users'))
+ ),
+ 'per project' => array
+ (
+ 'text' => 'Employee per project',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uistatistics.list_projects'))
+ )
+ );
+
+
+ $menus['navigation'] = array
+ (
+ 'projects' => array
+ (
+ 'text' => 'Projects',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'projects.uiprojects.list_projects','action' => 'mains'))
+ ),
+ 'sub_projects' => array
+ (
+ 'text' => 'Sub projects',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'projects.uiprojects.list_projects','action' => 'subs'))
+ ),
+ 'work_hours' => array
+ (
+ 'text' => 'Work hours',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'projects.uiprojecthours.list_projects','action' => 'mains'))
+ ),
+ 'controlling_sheet' => array
+ (
+ 'text' => 'Controlling Sheet',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'projects.uiprojecthours.controlling_sheet'))
+ ),
+ 'time_tracker' => array
+ (
+ 'text' => 'time tracker',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'projects.uiprojecthours.ttracker'))
+ ),
+ 'statistics' => array
+ (
+ 'text' => 'Statistics',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'projects.uistatistics.list_projects','action' => 'mains')),
+ 'children' =>$statistics_children
+ )
+ );
+
+ if ( $boprojects->isprojectadmin('pad') ||
$boprojects->isprojectadmin('pmanager') )
+ {
+ $menus['navigation']['budget'] = array
+ (
+ 'text' => 'Budget',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.list_budget','action'=>'mains'))
+ );
+
+ switch( $boprojects->siteconfig['accounting'] )
+ {
+ case 'activity':
+
$menus['navigation']['activities'] = array
+ (
+ 'text' => 'Activities',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_activities','action'=>'act'))
+ );
+ break;
+ default:
+
$menus['navigation']['accounting'] = array
+ (
+ 'text' => 'Accounting',
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_accounting','action'=>'accounting'))
+ );
+ }
+ }
+
+
+
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
$incoming_app;
+ return $menus;
+ }
+
+ function links()
+ {
+
if(!isset($GLOBALS['phpgw_info']['user']['preferences']['projects']['horisontal_menus'])
||
$GLOBALS['phpgw_info']['user']['preferences']['projects']['horisontal_menus']
== 'no')
+ {
+ return;
+ }
+ $GLOBALS['phpgw']->xslttpl->add_file(array('menu'));
+ $menu_brutto = execMethod('projects.menu.get_menu');
+ $selection =
explode('::',$GLOBALS['phpgw_info']['flags']['menu_selection']);
+ $level=0;
+ $menu['navigation'] =
$this->get_sub_menu($menu_brutto['navigation'],$selection,$level);
+ return $menu;
+ }
+
+ function get_sub_menu($children = array(),
$selection=array(),$level='')
+ {
+ $level++;
+ $i=0;
+ foreach($children as $key => $vals)
+ {
+ $menu[] = $vals;
+ if($key == $selection[$level])
+ {
+ $menu[$i]['this'] = true;
+ if(isset($menu[$i]['children']))
+ {
+ $menu[$i]['children'] =
$this->get_sub_menu($menu[$i]['children'],$selection,$level);
+ }
+ }
+ else
+ {
+ if(isset($menu[$i]['children']))
+ {
+ unset($menu[$i]['children']);
+ }
+ }
+ $i++;
+ }
+ return $menu;
+ }
+ }
Property changes on:
people/sigurdne/modules/projects/trunk/inc/class.menu.inc.php
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ native
Modified: people/sigurdne/modules/projects/trunk/inc/class.ofprojects.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.ofprojects.inc.php
2009-11-20 10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/inc/class.ofprojects.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -1,53 +1,93 @@
<?php
/**
- * Project Manager
+ * Object Factory
+ *
* @author Dirk Schaller <address@hidden>
- * @copyright Copyright (C) 2003-2006 Free Software Foundation, Inc.
http://www.fsf.org/
- * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General
Public License
- * @package phpgwapi
- * @subpackage communication
- * @version $Id$
+ * @author Dave Hall <address@hidden>
+ * @copyright Copyright (C) 2003-2008 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU Lesser General
Public License v2 or later
+ * @package phpgroupware
+ * @subpackage phpgwapi
+ * @version $Id$
*/
- class ofprojects extends object_factory
+ /*
+ This program 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.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ /**
+ * Object factory
+ *
+ * @package phpgroupware
+ * @subpackage phpgwapi
+ */
+ class projects_ofprojects extends phpgwapi_object_factory
{
- /*!
- @function CreateObject
- @abstract Load a class and include the class file if not done
so already.
- @author mdean
- @author milosch
- @author (thanks to jengo and ralf)
- @discussion This function is used to create an instance of a
class, and if the class file has not been included it will do so.
- @syntax CreateObject('app.class', 'constructor_params');
- @example $phpgw->acl = CreateObject('phpgwapi.acl');
- @param $classname name of class
- @param $p1-$p16 class parameters (all optional)
+ /**
+ * Instantiate a class
+ *
+ * @param string $class name of class
+ * @param mixed $p1 paramater for constructor of class
(optional)
+ * @param mixed $p2 paramater for constructor of class
(optional)
+ * @param mixed $p3 paramater for constructor of class
(optional)
+ * @param mixed $p4 paramater for constructor of class
(optional)
+ * @param mixed $p5 paramater for constructor of class
(optional)
+ * @param mixed $p6 paramater for constructor of class
(optional)
+ * @param mixed $p7 paramater for constructor of class
(optional)
+ * @param mixed $p8 paramater for constructor of class
(optional)
+ * @param mixed $p9 paramater for constructor of class
(optional)
+ * @param mixed $p10 paramater for constructor of class
(optional)
+ * @param mixed $p11 paramater for constructor of class
(optional)
+ * @param mixed $p12 paramater for constructor of class
(optional)
+ * @param mixed $p13 paramater for constructor of class
(optional)
+ * @param mixed $p14 paramater for constructor of class
(optional)
+ * @param mixed $p15 paramater for constructor of class
(optional)
+ * @param mixed $p16 paramater for constructor of class
(optional)
+ *
+ * @return object the instantiated class
*/
- function CreateObject($class,
+ public static function createObject($class,
$p1='_UNDEF_',$p2='_UNDEF_',$p3='_UNDEF_',$p4='_UNDEF_',
$p5='_UNDEF_',$p6='_UNDEF_',$p7='_UNDEF_',$p8='_UNDEF_',
$p9='_UNDEF_',$p10='_UNDEF_',$p11='_UNDEF_',$p12='_UNDEF_',
$p13='_UNDEF_',$p14='_UNDEF_',$p15='_UNDEF_',$p16='_UNDEF_')
{
- $ci = parent::getClassInfo($class);
+ $ci = parent::get_class_info($class);
switch($ci['class'])
{
case 'checker':
- return
ofprojects::CreateCheckerObject();
- break;
+ return
ofprojects::create_checker_object();
+
default:
- return
parent::CreateObject($class,$p1,$p2,$p3,$p4,$p5,$p6,$p7,$p8,$p9,$p10,$p11,$p12,$p13,$p14,$p15,$p16);
+ return parent::CreateObject($class,
$p1, $p2, $p3, $p4, $p5, $p6,
+ $p7, $p8, $p9, $p10,
$p11, $p12, $p13, $p14, $p15, $p16);
}
}
- function CreateCheckerObject($params = array())
+ /**
+ * Instanstiate new project checker object
+ *
+ * @return object new project checker object - null if not found
+ */
+ public static function create_checker_object()
{
// get customer version setting
$soconfig =
CreateObject('projects.soconfig');
$siteconfig = $soconfig->get_site_config();
- if(isset($siteconfig['customer_version_id']))
+ if ( isset($siteconfig['customer_version_id']) )
{
$customer_version_id =
$siteconfig['customer_version_id'];
}
@@ -57,26 +97,25 @@
}
$loaded = false;
- if($customer_version_id && $customer_version_id !=
'standard')
- { // use customer version class
- $checkerClassName =
'checker_'.$customer_version_id;
- if(include_class('projects', $checkerClassName))
+ if ( $customer_version_id
+ && $customer_version_id != 'standard' )
+ {
+ // use customer version class
+ $checkerClassName =
"checker_{$customer_version_id}";
+ if ( include_class('projects',
$checkerClassName) )
{
$loaded = true;
}
}
- if(!$loaded)
+ if ( !$loaded )
{
$checkerClassName = 'checker';
- if(!include_class('projects',
$checkerClassName))
+ if ( !include_class('projects',
$checkerClassName) )
{
return null;
}
}
-
return new $checkerClassName();
}
-
}
-?>
Added: people/sigurdne/modules/projects/trunk/inc/class.pbaddbook_email.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.pbaddbook_email.inc.php
(rev 0)
+++ people/sigurdne/modules/projects/trunk/inc/class.pbaddbook_email.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,58 @@
+<?php
+ /**
+ * Addressbook Chooser
+ * @author Philipp Kamps <address@hidden>
+ * @copyright Portions Copyright (C) 2004 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.fsf.org/licenses/gpl.html GNU General Public
License
+ * @package phpgwapi
+ * @subpackage gui
+ * @version $Id:
+ */
+ include_once('phpgwapi/inc/class.uijsaddressbook.inc.php');
+
+ class uijsaddbook_email extends uijsaddressbook
+ {
+
+ //@function uijsaddressbook constructor
+ function uijsaddbook_email()
+ {
+ parent::uijsaddressbook();
+ }
+
+ function parse_result($list, $saveEntries)
+ {
+ for($i = 0; $i < count($list); $i++)
+ {
+ for($j = 0; $j <
count($saveEntries[$list[$i]]); $j++)
+ {
+ if($saveEntries[$list[$i]][$j]['name'])
+ {
+ $htmlEntries[$list[$i]][] =
$saveEntries[$list[$i]][$j]['name'];
+ }
+ }
+ if(count($htmlEntries[$list[$i]]))
+ {
+ switch($list[$i])
+ {
+ case "to":
+ $this->template->set_var('to',
"opener.document.getElementById('to').value = '".implode(',',
$htmlEntries[$list[$i]])."';");
+ break;
+
+ case "cc":
+ $this->template->set_var('cc',
"opener.document.getElementById('cc').value = '".implode(',',
$htmlEntries[$list[$i]])."';");
+ break;
+
+ case "bc":
+ $this->template->set_var('bc',
"opener.document.getElementById('bc').value = '".implode(',',
$htmlEntries[$list[$i]])."';");
+ break;
+ }
+ }
+ }
+
+ $this->template->set_file(array('result' =>
'pbaddressbook_result.tpl'));
+ $this->template->parse('out','result',true);
+ $this->template->p('out');
+ return true;
+ }
+ }
+?>
\ No newline at end of file
Property changes on:
people/sigurdne/modules/projects/trunk/inc/class.pbaddbook_email.inc.php
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ native
Added:
people/sigurdne/modules/projects/trunk/inc/class.pbaddbook_projects.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.pbaddbook_projects.inc.php
(rev 0)
+++ people/sigurdne/modules/projects/trunk/inc/class.pbaddbook_projects.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,98 @@
+<?php
+ /**
+ * Addressbook Chooser
+ * @author Philipp Kamps <address@hidden>
+ * @copyright Portions Copyright (C) 2004 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.fsf.org/licenses/gpl.html GNU General Public
License
+ * @package phpgwapi
+ * @subpackage gui
+ * @version $Id:
+ */
+ include_once('phpgwapi/inc/class.pbaddressbook.inc.php');
+
+ class pbaddbook_projects extends pbaddressbook
+ {
+
+ /**
+ * Popup Addressbook for Projects
+ *
+ * @package phpgwapi
+ * @subpackage uijsaddressbook
+ */
+ function pbaddbook_projects()
+ {
+ parent::pbaddressbook();
+ }
+
+ function get_saveEntry(&$repo, $id)
+ {
+ $attributes = array('fullname');
+ $this->resultRepo = $repo->id;
+ $list =
$repo->get_list($_REQUEST['category'],'id='.$id, $attributes);
+ $return = array('id' => $id,
+ 'name' => $list[0]['fullname']
+ );
+
+
+ if($repo->id == 'phpgwOrgaContact')
+ {
+ // need the org name as well
+ $db = $GLOBALS['phpgw']->db;
+
+ $sql =
+ (
+ 'SELECT org_id, name '.
+ 'FROM phpgw_contact_org '.
+ 'WHERE org_id = '.$_POST['category']
+ );
+ //echo $sql;
+ $result = $db->query($sql,__LINE__,__FILE__);
+
+ while ($db->next_record())
+ {
+ $return['orga'] = $db->f('name');
+ $return['orgaid'] = $db->f('org_id');
+ }
+ }
+ return $return;
+ }
+
+ function get_repositories()
+ {
+ $repositories[] = array('id' => 'phpgwOrgaContact',
+ 'value' => 'Organisationen'
+ );
+ $repositories[] = array('id' => 'phpgwcontact',
+ 'value' => 'Kontakte'
+ );
+
+ return $repositories;
+ }
+
+ function parse_result($list, $saveEntries)
+ {
+ for($i = 0; $i < count($list); $i++)
+ {
+ if($saveEntries[$list[$i]][0]['id'])
+ {
+ switch($list[$i])
+ {
+ case "to":
+ $javascript =
"opener.document.getElementById('".$_REQUEST['targettagto']."').value =
'".$saveEntries[$list[$i]][0]['name']."';";
+ $javascript .=
"opener.document.getElementById('customerid').value =
'".$saveEntries[$list[$i]][0]['id']."';";
+ $javascript .=
"opener.document.getElementById('organame').value =
'".$saveEntries[$list[$i]][0]['orga']."';";
+ $javascript .=
"opener.document.getElementById('orgaid').value =
'".$saveEntries[$list[$i]][0]['orgaid']."';";
+ $javascript .=
"opener.document.getElementById('customernr').value =
'".$saveEntries[$list[$i]][0]['id']."';";
+ $this->template->set_var('to',
$javascript);
+ break;
+ }
+ }
+ }
+
+ $this->template->set_file(array('result' =>
'pbaddressbook_result.tpl'));
+ $this->template->parse('out','result',true);
+ $this->template->p('out');
+ return true;
+ }
+ }
+?>
\ No newline at end of file
Property changes on:
people/sigurdne/modules/projects/trunk/inc/class.pbaddbook_projects.inc.php
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ native
Added: people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccount.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccount.inc.php
(rev 0)
+++ people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccount.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,45 @@
+<?php
+ /**
+ * Addressbook Chooser
+ * @author Philipp Kamps <address@hidden>
+ * @copyright Portions Copyright (C) 2004 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.fsf.org/licenses/gpl.html GNU General Public
License
+ * @package phpgwapi
+ * @subpackage gui
+ * @version $Id:
+ */
+ include_once('projects/inc/class.pbaddbookaccounts.inc.php');
+
+ class pbaddbookaccount extends pbaddbookaccounts
+ {
+
+ //@function uijsaddressbook constructor
+ function pbaddbookaccount()
+ {
+ parent::pbaddbookaccounts();
+ }
+
+ function parse_result($list, $saveEntries)
+ {
+ for($i = 0; $i < count($list); $i++)
+ {
+ if($saveEntries[$list[$i]][0]['id'])
+ {
+ switch($list[$i])
+ {
+ case "to":
+ $javascript =
"opener.document.getElementById('".$_REQUEST['targettagto']."').value =
'".$saveEntries[$list[$i]][0]['name']."';";
+ $this->template->set_var('to',
$javascript);
+ break;
+ }
+ }
+ }
+
+ $this->template->set_file(array('result' =>
'pbaddressbook_result.tpl'));
+ $this->template->parse('out','result',true);
+ $this->template->p('out');
+ return true;
+ }
+
+ }
+?>
Property changes on:
people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccount.inc.php
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added:
people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccount_projects.inc.php
===================================================================
---
people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccount_projects.inc.php
(rev 0)
+++
people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccount_projects.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,45 @@
+<?php
+ /**
+ * Addressbook Chooser
+ * @author Philipp Kamps <address@hidden>
+ * @copyright Portions Copyright (C) 2004 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.fsf.org/licenses/gpl.html GNU General Public
License
+ * @package phpgwapi
+ * @subpackage gui
+ * @version $Id:
+ */
+ include_once('projects/inc/class.pbaddbookaccount.inc.php');
+
+ class pbaddbookaccount_projects extends pbaddbookaccount
+ {
+
+ //@function uijsaddressbook constructor
+ function pbaddbookaccount_projects()
+ {
+ parent::pbaddbookaccount();
+ }
+
+ function parse_result($list, $saveEntries)
+ {
+ for($i = 0; $i < count($list); $i++)
+ {
+ if($saveEntries[$list[$i]][0]['id'])
+ {
+ switch($list[$i])
+ {
+ case "to":
+ $javascript =
"opener.document.getElementById('".$_REQUEST['targettagto']."').value =
'".$saveEntries[$list[$i]][0]['name']."';";
+ $javascript .=
"opener.document.getElementById('".$_REQUEST['targettagto']."id').value =
'".$saveEntries[$list[$i]][0]['id']."';";
+ $this->template->set_var('to',
$javascript);
+ break;
+ }
+ }
+ }
+
+ $this->template->set_file(array('result' =>
'pbaddressbook_result.tpl'));
+ $this->template->parse('out','result',true);
+ $this->template->p('out');
+ return true;
+ }
+
+ }
Property changes on:
people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccount_projects.inc.php
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added:
people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccounts.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccounts.inc.php
(rev 0)
+++ people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccounts.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,90 @@
+<?php
+ /**
+ * Addressbook Chooser
+ * @author Philipp Kamps <address@hidden>
+ * @copyright Portions Copyright (C) 2004 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.fsf.org/licenses/gpl.html GNU General Public
License
+ * @package phpgwapi
+ * @subpackage gui
+ * @version $Id:
+ */
+ include_once('projects/inc/class.pbaddressbook.inc.php');
+
+ class pbaddbookaccounts extends pbaddressbook
+ {
+
+ //@function uijsaddressbook constructor
+ function pbaddbookaccounts()
+ {
+ parent::pbaddressbook();
+ }
+
+ function get_saveEntry(&$repo, $id)
+ {
+ $attributes = array('fullname');
+ $list =
$repo->get_list($_REQUEST['category'],'id='.$id, $attributes);
+ return array ('id' => $id,
+ 'name' => $list[0]['fullname']
+ );
+ }
+
+ function parse_result($list, $saveEntries)
+ {
+ $javascript = '';
+ for($i = 0; $i < count($saveEntries['to']); $i++)
+ {
+ if($saveEntries['to'][$i]['id'])
+ {
+ $javascript .=
"option_".$saveEntries['to'][$i]['id']." = new
Array('".$saveEntries['to'][$i]['name']."',
'".$saveEntries['to'][$i]['id']."');\n";
+ $javascript .= "myarray[myarray.length]
= option_".$saveEntries['to'][$i]['id'].";\n";
+ }
+ }
+
+ $this->template->set_var('javascript', $javascript);
+ $this->template->set_file(array('result' =>
'pbaddressbook_resultAccounts.tpl'));
+ $this->template->parse('out','result',true);
+ $this->template->p('out');
+ return true;
+ }
+
+ function get_repositories()
+ {
+ $repositories[] = array('id' => 'phpgwaccount',
+ 'value' => 'Accounts'
+ );
+ return $repositories;
+ }
+
+ function parse_contactsDetail($values, $mode = 'german')
+ {
+ if($values['status'])
+ {
+ $status = 'aktiv';
+ }
+ else
+ {
+ $status = 'nicht aktiv';
+ }
+ $return = '<table>';
+ $return .= ' <tr>';
+ $return .= ' <td>';
+ $return .= 'ID:';
+ $return .= ' </td>';
+ $return .= ' <td>';
+ $return .= $values['id'];
+ $return .= ' </td>';
+ $return .= ' </tr>';
+ $return .= ' <tr>';
+ $return .= ' <td>';
+ $return .= 'Status:';
+ $return .= ' </td>';
+ $return .= ' <td>';
+ $return .= $status;
+ $return .= ' </td>';
+ $return .= ' </tr>';
+ $return .= '</table>';
+ return $return;
+ }
+
+ }
+?>
Property changes on:
people/sigurdne/modules/projects/trunk/inc/class.pbaddbookaccounts.inc.php
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: people/sigurdne/modules/projects/trunk/inc/class.pbaddressbook.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.pbaddressbook.inc.php
(rev 0)
+++ people/sigurdne/modules/projects/trunk/inc/class.pbaddressbook.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,383 @@
+<?php
+ /**
+ * Addressbook Chooser
+ * @author Philipp Kamps <address@hidden>
+ * @copyright Portions Copyright (C) 2004 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.fsf.org/licenses/gpl.html GNU General Public
License
+ * @package phpgwapi
+ * @subpackage gui
+ * @version $Id:
+ */
+
+ class pbaddressbook
+ {
+ var $public_functions=array ('show' => true,
+ 'show_contactsframe' => true,
+ 'show_contactsdetailframe' => true,
+ 'show_repositoryframe' => true,
+ 'show_contactsdetailframe'
+ );
+
+ var $template;
+ var $enable_contactsframe;
+ var $enable_contactsdetailframe;
+
+
+ /**
+ * Popup Window to select accounts or contacts
+ *
+ * @package phpgwapi
+ * @subpackage uijsaddressbook
+ */
+ function pbaddressbook()
+ {
+ $this->template = CreateObject('phpgwapi.Template');
+ //
$this->template->set_root($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi'));
+ $this->template->set_root(PHPGW_APP_TPL);
+ $this->repositories = $this->get_repositories();
+ $this->addRepo =&
$this->repository_factory($_REQUEST['repository']);
+ if(isset($_REQUEST['category']))
+ {
+ $this->enable_contactsframe = true;
+
$this->addRepo->set_category($_REQUEST['category']);
+ }
+ if(isset($_REQUEST['id']))
+ {
+ $this->enable_contactsdetailframe = true;
+ }
+ if($_REQUEST['prefilter'])
+ {
+
$this->addRepo->set_filter(array(array('lastname' => $_REQUEST['prefilter'])));
+ }
+ }
+
+ //@abstract public function merely outputs the parsed main
template
+ //@function show
+ //@abstract public function merely outputs the parsed main
template
+ function show()
+ {
+ if(!$_REQUEST['save'])
+ {
+ $to_visibility = $_REQUEST['hideto'] ?
'hidden' : 'visible';
+ $cc_visibility = $_REQUEST['hidecc'] ?
'hidden' : 'visible';;
+ $bcc_visibility = $_REQUEST['hidebcc'] ?
'hidden' : 'visible';
+ $prefilter_visibility =
$_REQUEST['hideprefilter'] ? 'hidden' : 'visible';
+ $details_visibility =
$_REQUEST['hidedetails'] ? 'hidden' : 'visible';
+
+// $GLOBALS['phpgw']->common->phpgw_header();
+ $this->template->set_file(array('main' =>
'pbaddressbook.tpl'));
+ $this->template->set_var('link_contactsframe',
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'projects.'.get_class($this).'.show_contactsframe')));
+
$this->template->set_var('link_repositoryframe',
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'projects.'.get_class($this).'.show_repositoryframe')));
+
$this->template->set_var('link_contactdetailsframe',
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'projects.'.get_class($this).'.show_contactsdetailframe')));
+ $this->template->set_var('l_select_repository',
lang('Select Repository'));
+ $this->template->set_var('l_select_contact',
lang('Select Contacts'));
+ $this->template->set_var('l_edit_recipients',
lang('Edit recipients'));
+ $this->template->set_var('to_visibility',
$to_visibility);
+ $this->template->set_var('to', lang('to'));
+ $this->template->set_var('cc_visibility',
$cc_visibility);
+ $this->template->set_var('cc', lang('cc'));
+ $this->template->set_var('bcc_visibility',
$bcc_visibility);
+ $this->template->set_var('bcc', lang('bcc'));
+
$this->template->set_var('prefilter_visibility', $prefilter_visibility);
+ $this->template->set_var('details_visibility',
$details_visibility);
+ $this->template->parse('out','main',true);
+ $this->template->p('out');
+ }
+ else // get the entries back to parent window
+ {
+ $this->template->set_var('targettagto',
$_REQUEST['targettagto']);
+
+ if(!$_REQUEST['hideto'])
+ {
+ $list[] = 'to';
+ }
+ if(!$_REQUEST['hidecc'])
+ {
+ $list[] = 'cc';
+ }
+ if(!$_REQUEST['hidebc'])
+ {
+ $list[] = 'bc';
+ }
+
+ $repositories = array();
+ for($i=0; $i < count($list); $i++)
+ {
+ for($j=0; $j <
count($_REQUEST[$list[$i]]); $j++)
+ {
+ $entry =
$_REQUEST[$list[$i]][$j];
+ $repoType = substr($entry, 0,
strpos($entry, '_'));
+ $id = substr($entry,
(strpos($entry, '_') + 1));
+ if(!array_key_exists($repoType,
$repositories))
+ {
+
$repositories[$repoType] = $this->repository_factory($repoType);
+ }
+ $saveEntries[$list[$i]][] =
$this->get_saveEntry($repositories[$repoType], $id);
+ }
+ }
+ $this->parse_result($list, $saveEntries);
+ }
+ $GLOBALS['phpgw']->common->phpgw_exit(False);
+ }
+
+ function show_repositoryframe()
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ $selected = array();
+ if($_REQUEST['repository'])
+ {
+ $selected[] = $_REQUEST['repository'];
+ }
+
+ $categories = $this->addRepo->get_categories();
+
+ $this->template->set_var('prefilter', lang('pre
filter'));
+ $this->template->set_file(array('repositoryframe' =>
'pbaddressbook_repository.tpl'));
+ $this->template->set_var('SBRepos',
$this->parseSelectBox('repository', $this->repositories, '1', $selected, null,
null, 'changeRepo(this)'));
+
+ $this->template->set_var('categories',
$this->parseSelectBox('categories', $categories, '20', array(), null, 'name',
'changeCategory(this)'));
+ $this->template->parse('out','repositoryframe',true);
+ $this->template->p('out');
+ $GLOBALS['phpgw']->common->phpgw_exit(false);
+ }
+
+ function show_contactsframe()
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ if($this->enable_contactsframe)
+ {
+ $contacts = $this->addRepo->get_list();
+ }
+
+ $this->template->set_file(array('contactsframe' =>
'pbaddressbook_contacts.tpl'));
+ $this->template->set_var('contacts',
$this->parseSelectBox('contacts', $contacts, '15', array(), null, 'fullname',
'show_contactdetails(this)', true));
+ $this->template->set_var('repository',
$this->addRepo->get_id());
+ $this->template->set_var('enable_preview', lang('Enable
detail preview'));
+ $this->template->set_var('all', lang('all'));
+ $this->template->parse('out','contactsframe',true);
+ $this->template->p('out');
+ $GLOBALS['phpgw']->common->phpgw_exit(False);
+ }
+
+ function show_contactsdetailframe()
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ //$attributes = array('street', 'postalcode', 'city',
'organization', 'department', 'telefone');
+ if($this->enable_contactsdetailframe)
+ {
+ $details =
$this->addRepo->get_list($_REQUEST['category'],'id='.$_REQUEST['id'],
$attributes);
+ }
+ $this->template->set_file(array('contactsdetailframe'
=> 'pbaddressbook_contactsdetails.tpl'));
+ if($details)
+ {
+ $this->template->set_var('contactsdetails',
$this->parse_contactsDetail($details[0]));
+ }
+
$this->template->parse('out','contactsdetailframe',true);
+ $this->template->p('out');
+ $GLOBALS['phpgw']->common->phpgw_exit(False);
+ }
+
+ function parse_contactsDetail($values, $mode = 'german')
+ {
+ $return = '<table>';
+ $return .= ' <tr>';
+ $return .= ' <td colspan="2">';
+ $return .= $values['department'];
+ $return .= ' </td>';
+ $return .= ' </tr>';
+ $return .= ' <tr>';
+ $return .= ' <td colspan="2">';
+ $return .= $values['organization'];
+ $return .= ' </td>';
+ $return .= ' </tr>';
+ $return .= ' <tr>';
+ $return .= ' <td colspan="2">';
+ $return .= $values['street'];
+ $return .= ' </td>';
+ $return .= ' </tr>';
+ $return .= ' <tr>';
+ $return .= ' <td>';
+ $return .= $values['postalcode'];
+ $return .= ' </td>';
+ $return .= ' <td>';
+ $return .= $values['city'];
+ $return .= ' </td>';
+ $return .= ' </tr>';
+ if($values['telefone'])
+ {
+ $return .= ' <tr>';
+ $return .= ' <td>';
+ $return .= 'Tel.';
+ $return .= ' </td>';
+ $return .= ' <td>';
+ $return .= $values['telefone'];
+ $return .= ' </td>';
+ $return .= ' </tr>';
+ }
+ $return .= '</table>';
+ return $return;
+ }
+
+ function parseSelectBox($id, $values, $size = null, $selected =
array(), $id_name = null, $value_name = null, $onchange=null, $multiple=false)
//invent the wheel, dude
+ {
+ if($size)
+ {
+ $html_size = 'size="'.$size.'" ';
+ }
+ if(!$id_name)
+ {
+ $id_name = 'id';
+ }
+ if(!$value_name)
+ {
+ $value_name = 'value';
+ }
+ if($onchange)
+ {
+ $html_onchange = 'onchange="'.$onchange.'"';
+ }
+ if($multiple)
+ {
+ $html_multiple = 'multiple ';
+ }
+ $return = '<select '.$html_size.'name="'.$id.'"
'.$html_multiple.$html_onchange.'>';
+ for($i=0; $i < count($values); $i++)
+ {
+ if(in_array($values[$i][$id_name], $selected))
+ {
+ $html_selected = 'selected ';
+ }
+ else
+ {
+ $html_selected = '';
+ }
+ $return .= '<option
value="'.$values[$i][$id_name].'" '.$html_selected.'
>'.$values[$i][$value_name].'</option>';
+ }
+ $return .= '</select>';
+ return $return;
+ }
+
+ function build_recipient($email, $fullname = null)
+ {
+ return '"'.$fullname.'" <'.$email.'>';
+ }
+
+ function repository_factory($key)
+ {
+ if(!$key)
+ {
+ $key = $this->repositories[0]['id'];
+ }
+ switch ($key)
+ {
+ case 'izn':
+
include_once('projects/inc/addressrepositories/class.addRepoLDAP.inc.php');
+ $repo = new
addRepoLDAP('ldap://'.'cn=admin,dc=probusiness,dc=de'.'@pbdbserver/ou=people,ou=hannover,dc=probusiness,dc=de');
+ $repo->set_id('izn');
+ break;
+
+ case 'mailalias':
+
include_once('projects/inc/addressrepositories/class.addRepoLDAP.inc.php');
+ $repo = new
addRepoLDAP('ldap://'.'cn=admin,dc=probusiness,dc=de'.'@nlkhtest:1389/ou=maildrops,dc=nlkhwunstorf,dc=niedersachsen,dc=de');
+ $repo->set_id('mailalias');
+ break;
+
+ case 'phpgwaccount':
+
include_once('projects/inc/addressrepositories/class.addRepoPHPAccount.inc.php');
+ $repo = new
addRepoPHPAccount('mysql://'.$GLOBALS['phpgw']->accounts->get_id().'@anything');
+ $repo->set_id('phpgwaccount');
+ break;
+
+ case 'phpgwOrgaContact':
+
include_once('projects/inc/addressrepositories/class.addRepoPHPOrgaContact.inc.php');
+ $repo = new
addRepoPHPOrgaContact('mysql://'.$GLOBALS['phpgw']->accounts->get_id().'@anything');
+ $repo->set_id('phpgwOrgaContact');
+ break;
+
+
+ default:
+
include_once('projects/inc/addressrepositories/class.addRepoPHPContact.inc.php');
+ $repo = new
addRepoPHPContact('mysql://'.$GLOBALS['phpgw']->accounts->get_id().'@anything');
+ $repo->set_id('phpgwcontact');
+ }
+ return $repo;
+ }
+
+ //@function forget_all
+ //@access public
+ //@abstract This function makes the bo class forget everything
in cache
+ //@discuss this function is directly called by email module. So
I have to
+ // keep it :-(
+ function
+ forget_all($non_interactive="")
+ {
+
+ $this->bo=CreateObject("phpgwapi.bojsaddressbook");
+ $this->bo->forget_destboxes();
+ $this->bo->forget_query();
+ //forget our own cache
+
$GLOBALS['phpgw']->session->appsession('jsuibook_sbox','phpgwapi',"");
+
$GLOBALS['phpgw']->session->appsession('jsuibook_acbox','phpgwapi',"");
+
$GLOBALS['phpgw']->session->appsession('jsuibook_catid','phpgwapi','');
+ if($non_interactive=="")
+ {
+ print
$this->final_js("","window.parent.all_forgoten();");
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ }
+
+ function get_saveEntry(&$repo, $id)
+ {
+ $attributes = array('fullname', 'email');
+ $list =
$repo->get_list($_REQUEST['category'],'id='.$id, $attributes);
+ return array ('id' => $id,
+ 'name' =>
$this->build_recipient($list[0]['email'], $list[0]['fullname'])
+ );
+ }
+
+ function get_repositories()
+ {
+ $repositories[] = array('id' => 'phpgwcontact',
+ 'value' => 'Kontakte'
+ );
+ return $repositories;
+ }
+
+ function parse_result($list, $saveEntries)
+ {
+ for($i = 0; $i < count($list); $i++)
+ {
+ for($j = 0; $j <
count($saveEntries[$list[$i]]); $j++)
+ {
+ if($saveEntries[$list[$i]][$j]['name'])
+ {
+ $htmlEntries[$list[$i]][] =
$saveEntries[$list[$i]][$j]['name'];
+ }
+ }
+ if(count($htmlEntries[$list[$i]]))
+ {
+ switch($list[$i])
+ {
+ case "to":
+ $this->template->set_var('to',
"opener.document.getElementById('".$_REQUEST['targettagto']."').value =
'".implode(',', $htmlEntries[$list[$i]])."';");
+ break;
+
+ case "cc":
+ $this->template->set_var('cc',
"opener.document.getElementById('".$_REQUEST['targettagcc']."').value =
'".implode(',', $htmlEntries[$list[$i]])."';");
+ break;
+
+ case "bc":
+ $this->template->set_var('bc',
"opener.document.getElementById('".$_REQUEST['targettagbc']."').value =
'".implode(',', $htmlEntries[$list[$i]])."';");
+ break;
+ }
+ }
+ }
+
+ $this->template->set_file(array('result' =>
'pbaddressbook_result.tpl'));
+ $this->template->parse('out','result',true);
+ $this->template->p('out');
+ return true;
+ }
+
+ }
+?>
Property changes on:
people/sigurdne/modules/projects/trunk/inc/class.pbaddressbook.inc.php
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Modified: people/sigurdne/modules/projects/trunk/inc/class.soconfig.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.soconfig.inc.php
2009-11-20 10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/inc/class.soconfig.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -32,7 +32,7 @@
$helpmsg = isset($params['helpmsg']) ?
$params['helpmsg'] : false;
$this->config =
CreateObject('phpgwapi.config','projects');
- $this->config->read_repository();
+ $this->config->read();
if ($this->config->config_data)
{
Modified: people/sigurdne/modules/projects/trunk/inc/class.soprojects.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.soprojects.inc.php
2009-11-20 10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/inc/class.soprojects.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -18,9 +18,11 @@
function soprojects()
{
- $this->db = $GLOBALS['phpgw']->db;
- $this->db2 = $this->db;
- $this->grants =
$GLOBALS['phpgw']->acl->get_grants('projects');
+ $this->db = &
$GLOBALS['phpgw']->db;
+ $this->db2 = clone($this->db);
+ $this->join = & $this->db->join;
+ $this->like = & $this->db->like;
+ $this->grants =
$GLOBALS['phpgw']->acl->get_grants('projects', 'project');
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
$this->currency =
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'];
$this->year =
$GLOBALS['phpgw']->common->show_date(time(),'Y');
@@ -239,11 +241,11 @@
if ( $limit && $action == 'mains' )
{
- $this->db2->query($sql . $parent_select,
__LINE__, __FILE__);
+ $this->db->query($sql . $parent_select,
__LINE__, __FILE__);
//echo 'query main: ' . $sql . $parent_select;
- $total = $this->db2->num_rows();
+ $total = $this->db->num_rows();
$this->db->limit_query($sql . $parent_select .
$ordermethod, $start,__LINE__,__FILE__);
}
@@ -383,7 +385,7 @@
'action' => isset( $values['action'] ) ?
$values['action'] : '',
'main' => isset( $values['main'] ) ?
$values['main'] : '',
'filter' => isset( $values['filter'] ) ?
$values['filter'] : '',
- 'column' => 'project_id, p_number,
level, title',
+ 'column' =>
'project_id,p_number,level,title',
'order' => 'title'
));
@@ -1028,6 +1030,8 @@
{
$project_id = intval( $project_id );
+ $project_delete = array($project_id);
+
if($subs)
{
$subpro = $this->read_projects(array('column'
=> 'project_id,level','limit' => false,'action' => 'subs','parent' =>
$project_id));
@@ -1037,6 +1041,7 @@
$i = 0;
foreach( $subpro as $sub )
{
+ $project_delete[] =
$sub['project_id'];
$s[$i] = $sub['project_id'];
++$i;
}
@@ -1050,8 +1055,10 @@
}
}
- $this->db->query("DELETE from phpgw_acl where
acl_appname='project_members' and acl_rights=7 and (acl_location=" .
$project_id . $sub_acl_delete
- .
')',__LINE__,__FILE__);
+ foreach($project_delete as $delete_id)
+ {
+
$GLOBALS['phpgw']->acl->delete_repository('projects',
".project_members.{$delete_id}");
+ }
if( $subs )
{
@@ -1371,21 +1378,32 @@
function delete_acl( $project_id )
{
- $this->db->query("DELETE from phpgw_acl where
acl_appname='project_members' AND acl_location=" . $project_id
- . ' AND
acl_rights=7',__LINE__,__FILE__);
+ $GLOBALS['phpgw']->acl->delete_repository('projects',
".project_members.{$project_id}");
}
function get_acl_projects()
{
- $this->db->query("SELECT acl_location FROM phpgw_acl,
phpgw_p_projects WHERE acl_appname='project_members' AND acl_rights=7 AND
acl_account="
- .
$this->account . " AND acl_location=project_id ORDER BY title", __LINE__,
__FILE__);
+// $this->db->query("SELECT acl_location FROM phpgw_acl,
phpgw_p_projects WHERE acl_appname='project_members' AND acl_rights=7 AND
acl_account="
+// .
$this->account . " AND acl_location=project_id ORDER BY title", __LINE__,
__FILE__);
+
+ $sql = 'SELECT phpgw_locations.name FROM
phpgw_locations'
+ . " {$this->join} phpgw_applications ON
phpgw_locations.app_id = phpgw_applications.app_id"
+ . " {$this->join} phpgw_acl ON
phpgw_locations.location_id = phpgw_acl.location_id"
+ . " WHERE phpgw_applications.app_name =
'projects'"
+ . " AND phpgw_locations.name
{$this->like} '.project_members.%'"
+ . " AND acl_rights=7 AND acl_account=
{$this->account}";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
// Did the query return any records?
if ( $this->db->next_record() )
{
while( $this->db->next_record() )
{
- $projects[] = $this->db->f(0);
+ $location = ltrim($this->db->f(0),
'.');
+ $parts = explode('.', $location);
+ $projects[] = $parts[1];
}
return $projects;
@@ -1444,7 +1462,9 @@
function member($project_id)
{
- $this->db->query("SELECT acl_account from phpgw_acl
where acl_appname = 'project_members' and acl_rights=7 and acl_location="
+ return
$GLOBALS['phpgw']->acl->check(".project_members.{$project_id}", 7, 'projects');
+
+/* $this->db->query("SELECT acl_account from phpgw_acl
where acl_appname = 'project_members' and acl_rights=7 and acl_location="
.
intval($project_id),__LINE__,__FILE__);
while($this->db->next_record())
@@ -1457,6 +1477,7 @@
return True;
}
return False;
+*/
}
function read_employee_roles($data)
@@ -1765,22 +1786,46 @@
$sql = "select
p_number,employee,cost_centre,sum(minutes),sum(t_journey) from phpgw_p_projects
join phpgw_p_hours on phpgw_p_projects.project_id = phpgw_p_hours.pro_main join
(select distinct account_id,cost_centre from phpgw_p_projectmembers where
type='accounting' and location_id = " . $location_id . " and ((sdate = 0) or
(sdate <= " . mktime(0,0,0,$month,1,$year) . ")) and ((edate = 0) or (edate >=
" . mktime(23,59,59,$month,cal_days_in_month(CAL_GREGORIAN,$month,$year),$year)
. "))) as pmembers on phpgw_p_hours.employee = pmembers.account_id where
phpgw_p_hours.start_date >= " . mktime(0,0,0,$month,1,$year) . " and
phpgw_p_hours.start_date <= " .
mktime(23,59,59,$month,cal_days_in_month(CAL_GREGORIAN,$month,$year),$year) . "
group by employee,cost_centre,p_number order by p_number,employee,cost_centre";
$this->db->query($sql, __LINE__,__FILE__);
$result = array();
- $i = 0;
- while ($this->db->next_record())
+ while ( $this->db->next_record() )
{
- $result[$i]['p_number'] =
$this->db->f('p_number');
-
$GLOBALS['phpgw']->accounts->get_account_name($this->db->f('employee'),$lid,$fname,$lname);
- $result[$i]['employee'] =
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname);
- $result[$i]['cost_centre'] =
$this->db->f('cost_centre');
- $result[$i]['minutes'] =
$this->db->f('sum(minutes)') / 60;
- $result[$i]['journey'] =
$this->db->f('sum(t_journey)') / 60;
- ++$i;
+ $result[] = array
+ (
+ 'p_number' =>
$this->db->f('p_number'),
+ 'employee_id' =>
$this->db->f('employee'),
+ 'cost_centre' =>
$this->db->f('cost_centre'),
+ 'minutes' =>
$this->db->f('sum(minutes)') / 60,
+ 'journey' =>
$this->db->f('sum(t_journey)') / 60
+ );
}
- return($result);
+
+ foreach ( $result as &$r )
+ {
+ $r['employee'] =
$GLOBALS['phpgw']->accounts->get($r['employee_id']);
+ unset($r['employee_id']);
+ }
+ return $result;
}
function get_acl_project_members($project_id = false)
{
+ $location = ".'project_members.{$project_id}";
+ $ids =
$GLOBALS['phpgw']->acl->get_ids_for_location($location, 7, 'projects');
+
+ $members = array();
+ foreach ($ids as $account_id)
+ {
+ $members[$account_id][] = $project_id;
+ }
+
+ if(!$project_id)
+ {
+ throw new Exception("FIXME: empty project_id
not handled");
+ }
+
+ return $members;
+
+/*
+
$sql = 'SELECT * FROM phpgw_acl ';
$sql .= 'WHERE acl_appname LIKE \'project_members\' ';
@@ -1806,6 +1851,7 @@
}
return $members;
+*/
}
}
Modified: people/sigurdne/modules/projects/trunk/inc/class.uiconfig.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.uiconfig.inc.php
2009-11-20 10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/inc/class.uiconfig.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -544,8 +544,7 @@
$GLOBALS['phpgw']->template->set_var('location_select',
$location_select);
-
$GLOBALS['phpgw']->accounts->get_account_name($values['account_id'], $lid,
$fname, $lname);
- $fullname =
$GLOBALS['phpgw']->common->display_fullname($lid, $fname, $lname);
+ $fullname = (string)
$GLOBALS['phpgw']->accounts->get($values['account_id']);
$GLOBALS['phpgw']->template->set_var('employee',
$fullname);
$GLOBALS['phpgw']->template->set_var('account_id',
$values['account_id']);
$GLOBALS['phpgw']->template->set_var('sdate_select',$jscal->input('sdate[str]',$values['sdate']));
@@ -1118,7 +1117,7 @@
$GLOBALS['phpgw']->template->set_var('limit',$values['limit']);
$GLOBALS['phpgw']->template->set_var('percent',$values['percent']);
-
$GLOBALS['phpgw']->template->pfp('out','event_list_t',True);
+ $GLOBALS['phpgw']->template->pfp('out','event_list_t');
}
// --------- SURCHARGES ----------------------
@@ -1211,7 +1210,7 @@
$GLOBALS['phpgw']->template->set_var('charge_id',$charge_id);
$GLOBALS['phpgw']->template->set_var('lang_save_surcharge',lang('save
surcharge'));
$GLOBALS['phpgw']->template->set_var('lang_new_surcharge',lang('new
surcharge'));
-
$GLOBALS['phpgw']->template->pfp('out','charge_list_t',True);
+ $GLOBALS['phpgw']->template->pfp('out','charge_list_t');
}
function config_proid_help_msg()
@@ -1242,7 +1241,7 @@
$GLOBALS['phpgw']->template->set_var('helpmsg',stripslashes($this->boconfig->config_proid_help_msg(array('action'
=> 'get'))));
$GLOBALS['phpgw']->template->set_var('help_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects_base.proid_help_popup')));
$GLOBALS['phpgw']->template->set_var('lang_show',lang('show help msg'));
-
$GLOBALS['phpgw']->template->pfp('out','proidhelp',True);
+ $GLOBALS['phpgw']->template->pfp('out','proidhelp');
}
/*function abook()
@@ -1378,9 +1377,8 @@
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('projects') . ': ' . lang('preferences');
$GLOBALS['phpgw']->common->phpgw_header();
- $GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
echo parse_navbar();
-
+ $GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
$GLOBALS['phpgw']->template->set_file(array('prefs' =>
'preferences.tpl'));
$this->set_app_langs();
@@ -1887,8 +1885,6 @@
$GLOBALS['phpgw']->template->set_var('cancel_button', '<input type="reset"
value="'.lang('reset').'">');
}
-
$GLOBALS['phpgw']->template->pfp('out','location_list_t',True);
+
$GLOBALS['phpgw']->template->pfp('out','location_list_t');
}
-
}
-?>
Modified: people/sigurdne/modules/projects/trunk/inc/class.uiprojects.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.uiprojects.inc.php
2009-11-20 10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/inc/class.uiprojects.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -348,7 +348,6 @@
{
foreach( $pro as $p )
{
- echo "testing<br />";
$this->nextmatchs->template_alternate_row_class($GLOBALS['phpgw']->template);
// --------------- template declaration for list records
-------------------------------------
@@ -1271,12 +1270,12 @@
$GLOBALS['phpgw']->template->set_var('message',$message);
$prefs = $this->boprojects->read_prefs();
-
$GLOBALS['phpgw']->template->set_var('addressbook_link',$GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'phpgwapi.pbaddbook_projects.show',
+
$GLOBALS['phpgw']->template->set_var('addressbook_link',$GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'projects.pbaddbook_projects.show',
'hidecc' => 1,
'hidebcc' => 1,
'targettagto' => 'customer'
)));
-
$GLOBALS['phpgw']->template->set_var('accounts_link',$GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'phpgwapi.pbaddbookaccount_projects.show',
+
$GLOBALS['phpgw']->template->set_var('accounts_link',$GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'projects.pbaddbookaccount_projects.show',
'hidecc' => 1,
'hidebcc' => 1,
'targettagto' => 'cordinator'
@@ -1286,7 +1285,7 @@
'hidebcc' => 1,
'targettagto' => 'staff'
)));
-
$GLOBALS['phpgw']->template->set_var('s_accounts_link',$GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'phpgwapi.pbaddbookaccount_projects.show',
+
$GLOBALS['phpgw']->template->set_var('s_accounts_link',$GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'projects.pbaddbookaccount_projects.show',
'hidecc' => 1,
'hidebcc' => 1,
'targettagto' => 'salesmanager'
@@ -1498,8 +1497,9 @@
$GLOBALS['phpgw']->template->fp('mainhandle','main',true);
*/
$values['coordinator'] =
isset($values['coordinator']) ? $values['coordinator'] :
$GLOBALS['phpgw_info']['user']['account_id']; // $parent['coordinator'];
-
$GLOBALS['phpgw']->accounts->get_account_name($values['coordinator'],$lid,$fname,$lname);
- $values['coordinatorout'] =
isset($values['coordinatorout']) ? $values['coordinatorout'] :
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname); //
$parent['coordinatorout'];
+ $coordinator =
$GLOBALS['phpgw']->accounts->get($values['coordinator']);
+
+ $values['coordinatorout'] =
isset($values['coordinatorout']) ? $values['coordinatorout'] : (string)
$coordinator;
$values['salesmanager'] =
isset($values['salesmanager'])?$values['salesmanager']:$parent['salesmanager'];
$values['parent']
= isset($values['parent'])?$values['parent']:$parent['project_id'];
$values['customer']
= isset($values['customer'])?$values['customer']:$parent['customer'];
@@ -1695,8 +1695,7 @@
$GLOBALS['phpgw']->template->set_var('accountid',$values['coordinator']);
if(!$values['coordinatorout'])
{
-
$GLOBALS['phpgw']->accounts->get_account_name($values['coordinator'],$lid,$fname,$lname);
-
$values['coordinatorout'] =
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname);
+
$values['coordinatorout'] = (string)
$GLOBALS['phpgw']->accounts->get($values['coordinator']);
}
$GLOBALS['phpgw']->template->set_var('accountname',$values['coordinatorout']);
}
@@ -1704,8 +1703,7 @@
{
$values['coordinator'] =
$GLOBALS['phpgw_info']['user']['account_id'];
$GLOBALS['phpgw']->template->set_var('accountid', $values['coordinator']);
-
$GLOBALS['phpgw']->accounts->get_account_name($values['coordinator'],$lid,$fname,$lname);
- $values['coordinatorout'] =
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname);
+ $values['coordinatorout'] =
(string) $GLOBALS['phpgw']->accounts->get($values['coordinator']);
$GLOBALS['phpgw']->template->set_var('accountname',$values['coordinatorout']);
}
@@ -1716,8 +1714,7 @@
$GLOBALS['phpgw']->template->set_var('salesmanagerid',$values['salesmanager']);
if(!$values['salesmanagerout'])
{
-
$GLOBALS['phpgw']->accounts->get_account_name($values['salesmanager'],$slid,$sfname,$slname);
-
$values['salesmanagerout'] =
$GLOBALS['phpgw']->common->display_fullname($slid,$sfname,$slname);
+
$values['salesmanagerout'] = (string)
$GLOBALS['phpgw']->accounts->get($values['salesmanager']);
}
$GLOBALS['phpgw']->template->set_var('salesmanagername',
$values['salesmanagerout']);
@@ -1741,10 +1738,12 @@
{
$account_id =
$values['employees'][$i];
if(!$account_id)
+ {
continue;
-
$GLOBALS['phpgw']->accounts->get_account_name($account_id,$lid,$fname,$lname);
- $fullname =
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname);
- $employee_list .=
'<option value="'.$account_id.'" SELECTED>'.$fullname.'</option>' . "\n";
+ }
+
+ $fullname = (string)
$GLOBALS['phpgw']->accounts->get($account_id);
+ $employee_list .=
'<option value="'.$account_id.'" selected>'.$fullname.'</option>' . "\n";
}
$GLOBALS['phpgw']->template->set_var('employee_list',$employee_list);
}
@@ -2094,9 +2093,7 @@
}
else
{
-
$GLOBALS['phpgw']->accounts->get_account_name($emp['account_id'],$lid,$fname,$lname);
- $fullname =
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname);
- $emp['emp_name'] = $fullname;
+ $emp['emp_name'] = (string)
$GLOBALS['phpgw']->accounts->get($emp['account_id']);
$emp['events'] = '';
$emp['role_name'] = '';
}
@@ -3361,24 +3358,37 @@
{
if($i == 0) // head
{
- $output .= '<thead>';
- $output .= '<tr>';
- $output .= '<td style="padding-left:
5px; background-color: #d3dce3; border-bottom: 2px solid #808080">';
- $output .= lang('Projects');
- $output .= '</td>';
+ $lang_projects = lang('projects');
+ $output .= <<<HTML
+ <thead>
+ <tr>
+ <td style="padding-left: 5px;
background-color: #d3dce3; border-bottom: 2px solid #808080">
+ {$lang_projects}
+ </td>
+
+HTML;
+
foreach($matrix[0]['employee'] as $key
=> $value)
{
+ $empname = (string)
$GLOBALS['phpgw']->accounts->get($key);
$allemployees[] = $key;
- $output .= '<td
style="background-color: #d3dce3; font-weight: bold; height: 30px;
padding-left: 5px; padding-right: 5px; border-bottom: 2px solid #808080;
vertical-align: bottom">';
-
$GLOBALS['phpgw']->accounts->get_account_name($key, $lid,$fname,$lname);
- $output .=
$GLOBALS['phpgw']->common->display_fullname($lid, $fname, $lname);
- $output .= '</td>';
+ $output .= <<<HTML
+ <td
style="background-color: #d3dce3; font-weight: bold; height: 30px;
padding-left: 5px; padding-right: 5px; border-bottom: 2px solid #808080;
vertical-align: bottom">
+ {$empname}
+ </td>
+
+HTML;
}
- $output .= '<td style="font-weight:
bold; background-color: #d3dce3; border-bottom: 2px solid #808080">';
- $output .= lang('Total');
- $output .= '</td>';
- $output .= '</tr>';
- $output .= '</thead>';
+
+ $lang_total = lang('total');
+ $output .= <<<HTML
+ <td style="font-weight: bold;
background-color: #d3dce3; border-bottom: 2px solid #808080">
+ {$lang_total}
+ </td>
+ </tr>
+ </thead>
+
+HTML;
}
$output .= '<tbody>';
Modified: people/sigurdne/modules/projects/trunk/inc/class.uistatistics.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.uistatistics.inc.php
2009-11-20 10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/inc/class.uistatistics.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -1200,10 +1200,7 @@
while (is_array($employees) &&
(list($no_use,$account_id) = each($employees)))
{
-
$GLOBALS['phpgw']->accounts->get_account_name($account_id,$lid,$fname,$lname);
- if(!$fname && !$lname)
- continue;
- $employees_list[$account_id] =
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname);
+ $employees_list[$account_id] = (string)
$GLOBALS['phpgw']->accounts->get($account_id);
}
if(count($employees_list))
@@ -1229,8 +1226,12 @@
{
// show only current user
$account_id =
$GLOBALS['phpgw_info']['user']['account_id'];
-
$GLOBALS['phpgw']->accounts->get_account_name($account_id,$lid,$fname,$lname);
- $select_employee_list = '<input type="hidden"
name="values[employee]" value="'.$account_id.'">'.
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname);
+ $employee_name = (string)
$GLOBALS['phpgw']->accounts->get($account_id);
+ $select_employee_list = <<<HTML
+ <input type="hidden" name="values[employee]"
value="{$account_id}">
+ {$employee_name}
+
+HTML;
}
$GLOBALS['phpgw']->template->set_var('select_employee_list',
$select_employee_list);
@@ -1397,7 +1398,7 @@
$prefs = CreateObject('phpgwapi.preferences', $values['employee']);
- $prefs->read_repository();
+ $prefs->read();
$sbox = createobject('phpgwapi.sbox');
$holidays = CreateObject('phpgwapi.calendar_holidays');
Modified: people/sigurdne/modules/projects/trunk/inc/hook_deleteaccount.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/hook_deleteaccount.inc.php
2009-11-20 10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/inc/hook_deleteaccount.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -10,15 +10,18 @@
* $Source:
/sources/phpgroupware/projects/inc/hook_deleteaccount.inc.php,v $
*/
+ $account_id = phpgw::get_var('account_id', 'int');
+ $new_owner = phpgw::get_var('new_owner', 'int');
+
// Delete all records for a user
$pro = CreateObject('projects.boprojects');
- if(intval($_POST['new_owner']) == 0)
+ if ( !$new_owner)
{
- $pro->delete_project(intval($_POST['account_id']),0,'account');
+ $pro->delete_project($account_id, 0, 'account');
}
else
{
-
$pro->change_owner(intval($_POST['account_id']),intval($_POST['new_owner']));
+ $pro->change_owner($account_id, $new_owner);
}
-?>
+ unset($pro);
Modified: people/sigurdne/modules/projects/trunk/setup/default_records.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/setup/default_records.inc.php
2009-11-20 10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/setup/default_records.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -36,3 +36,7 @@
D\xFCsseldorf D04 01 910360
M\xFCnchen D04 01 910476
*/
+
+ $GLOBALS['phpgw']->locations->add('.project', 'projects', 'projects',
$allow_grant = true);
+ $GLOBALS['phpgw']->locations->add('.project_members', 'Project
members', 'projects', false);
+
Modified: people/sigurdne/modules/projects/trunk/setup/setup.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/setup/setup.inc.php 2009-11-20
10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/setup/setup.inc.php 2009-11-20
10:28:44 UTC (rev 20847)
@@ -11,7 +11,8 @@
/* $Id$ */
$setup_info['projects']['name'] = 'projects';
- $setup_info['projects']['version'] = '0.8.7.055';
+ $setup_info['projects']['title'] = 'Projects';
+ $setup_info['projects']['version'] = '0.8.7.056';
$setup_info['projects']['app_order'] = 13;
$setup_info['projects']['enable'] = 1;
@@ -50,13 +51,14 @@
$setup_info['projects']['hooks'] = array
(
- 'preferences',
- 'admin',
+ // 'preferences',
+ // 'admin',
'manual',
- 'add_def_pref',
+ // 'add_def_pref',
'deleteaccount',
'home',
- 'sidebox_menu'
+ // 'sidebox_menu',
+ 'menu' => 'projects.menu.get_menu'
);
$setup_info['projects']['hooks']['getFolderContent'] =
'projects.boprojects.get_folder_content';
@@ -88,9 +90,9 @@
'versions' => Array('0.9.16','0.9.17')
);
- $setup_info['projects']['depends'][] = array
+/* $setup_info['projects']['depends'][] = array
(
'appname' => 'email',
'versions' => Array('0.9.13','0.9.17')
);
-?>
+*/
Modified: people/sigurdne/modules/projects/trunk/setup/tables_update.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/setup/tables_update.inc.php
2009-11-20 10:28:38 UTC (rev 20846)
+++ people/sigurdne/modules/projects/trunk/setup/tables_update.inc.php
2009-11-20 10:28:44 UTC (rev 20847)
@@ -1179,4 +1179,18 @@
$GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.055';
return $GLOBALS['setup_info']['projects']['currentver'];
}
-?>
+
+ $test[] = '0.8.7.055';
+ function projects_upgrade0_8_7_055()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+ $GLOBALS['phpgw']->locations->add('.project', 'projects',
'projects', $allow_grant = true);
+ $GLOBALS['phpgw']->locations->add('.project_members', 'Project
members', 'projects', false);
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['projects']['currentver'] =
'0.8.7.056';
+ return $GLOBALS['setup_info']['projects']['currentver'];
+ }
+
+ }
Added: people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook.tpl
===================================================================
--- people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook.tpl
(rev 0)
+++ people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook.tpl
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,193 @@
+<script>
+function changeRepo(repo)
+{
+ contactsform =
document.getElementById('contactsframe').contentWindow.document.contacts;
+ contactsform.repository.value = repo;
+}
+
+function changeCat(cat, preFilter)
+{
+ document.main.category.value = cat;
+ if(!document.getElementById('contactsframe').contentWindow)
+ {
+ contactsform =
document.getElementById('contactsframe').document.contacts;
+ }
+ else
+ {
+ contactsform =
document.getElementById('contactsframe').contentWindow.document.contacts;
+ }
+ contactsform.category.value = cat;
+ contactsform.prefilter.value = preFilter;
+ contactsform.submit();
+}
+
+function show_contactdetails(id, repository, category)
+{
+ cdform =
document.getElementById('contactsDetailframe').contentWindow.document.contactsdetail;
+ cdform.id.value = id;
+ cdform.repository.value = repository;
+ cdform.category.value = category;
+ cdform.submit();
+}
+
+function addContact(mode, optionelement)
+{
+ repository =
document.getElementById('contactsframe').contentWindow.document.contacts.repository.value;
+ newEntry = new
Option(optionelement.text,repository+'_'+optionelement.value,false,false);
+ if(mode == 'to')
+ {
+ document.main.to.options[document.main.to.length] = newEntry;
+ }
+ if(mode == 'cc')
+ {
+ document.main.cc.options[document.main.cc.length] = newEntry;
+ }
+ if(mode == 'bcc')
+ {
+ document.main.bc.options[document.main.bc.length] = newEntry;
+ }
+}
+
+function delContact()
+{
+ SBTO = document.main.to;
+ for ( var j=0 ; j < SBTO.length; j++ )
+ {
+ if(SBTO.options[j].selected)
+ {
+ SBTO.remove(SBTO.options[j].index);
+ j--;
+ }
+ }
+ SBTO = document.main.cc;
+ for ( var j=0 ; j < SBTO.length; j++ )
+ {
+ if(SBTO.options[j].selected)
+ {
+ SBTO.remove(SBTO.options[j].index);
+ j--;
+ }
+ }
+ SBTO = document.main.bc;
+ for ( var j=0 ; j < SBTO.length; j++ )
+ {
+ if(SBTO.options[j].selected)
+ {
+ SBTO.remove(SBTO.options[j].index);
+ j--;
+ }
+ }
+}
+
+function selectAllOptions()
+{
+ elements = document.getElementsByTagName('Select');
+ for ( var j=0 ; j < elements.length; j++ )
+ {
+ if ( elements.item(j).size > 1 ) {
+ for (var i=0; i < elements.item(j).options.length; i++) {
+ elements.item(j).options[i].selected = true;
+ }
+ }
+ }
+ return true;
+}
+
+ document.body.style.overflow='visible';
+
+</script>
+<form method="POST" name="main" onSubmit="selectAllOptions()">
+ <input name="category" id="category" type="hidden" value="" />
+ <table align="center">
+ <thead class="header">
+ <tr>
+ <td>
+ {l_select_repository}
+ </td>
+ <td>
+ {l_select_contact}
+ </td>
+ <td>
+ {l_edit_recipients}
+ </td>
+ </tr>
+ </thead>
+ <tfoot>
+ <tr>
+ <td colspan="3" class="header" style="height:
10px">
+ </td>
+ </tr>
+ </tfoot>
+ <tbody>
+ <tr>
+ <td class="bg_color1" style="height: 450px;">
+ <iframe id="repositoryframe"
name="repositoryframe" src="{link_repositoryframe}" frameborder="0"
style="height: 100%; width: 250px; border: 0px solid #FFFFFF; margin-top: 15px"
scrolling="No">Error loading frame</iframe>
+ </td>
+ <td class="bg_color1" style="height: 450px;">
+ <table class="noCollapse"
style="height: 100%; width: 100%">
+ <tr>
+ <td style="height:
100%;">
+ <iframe
id="contactsframe" name="contactsframe" src="{link_contactsframe}"
frameborder="0" style="height: 100%; width: 250px; border: 0px solid #FFFFFF;
margin-top: 15px" scrolling="No">
+ </iframe>
+ </td>
+ </tr>
+ <tr>
+ <td style="height:
100px;" align="center">
+ <iframe
id="contactsDetailframe" name="contactsDetailframe"
src="{link_contactdetailsframe}" frameborder="0" style="height: 105px; width:
200px; border: 1px solid #FFFFFF; border-collapse: collapse; margin: 0px;
padding: 0px" scrolling="No">
+ </iframe>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td class="bg_color1" style="height: 400px;
width: 250px;">
+ <table style="width: 240px"
align="center">
+ <tr style="visibility:
{to_visibility}">
+ <td colspan="2">
+ {to}
+ </td>
+ </tr>
+ <tr id="tr_to"
style="visibility: {to_visibility}">
+ <td colspan="2">
+ <select
size="7" id="to" name="to[]" style="min-width: 150px" multiple>
+ </select>
+ </td>
+ </tr>
+ <tr style="visibility:
{cc_visibility}">
+ <td colspan="2">
+ {cc}
+ </td>
+ </tr>
+ <tr id="tr_cc"
style="visibility: {cc_visibility}">
+ <td colspan="2">
+ <select
size="7" id="cc" name="cc[]" style="min-width: 150px" multiple>
+ </select>
+ </td>
+ </tr>
+ <tr style="visibility:
{bcc_visibility}">
+ <td colspan="2">
+ {bcc}
+ </td>
+ </tr>
+ <tr id="tr_bcc"
style="visibility: {bcc_visibility}">
+ <td colspan="2">
+ <select
size="7" id="bc" name="bc[]" style="min-width: 150px" multiple>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input
type="button" value="Entfernen" onclick="delContact()" />
+ </td>
+ <td>
+ <input
type="button" value="Abbrechen" onclick="window.close()" />
+ </td>
+ <td align="right">
+ <input
type="submit" value="Speichern" name="save"/>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+</form>
\ No newline at end of file
Added:
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_contacts.tpl
===================================================================
---
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_contacts.tpl
(rev 0)
+++
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_contacts.tpl
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,123 @@
+<script>
+function show_contactdetails(select)
+{
+ if(document.contacts.enableDetails.checked)
+ {
+
parent.show_contactdetails(select.options[select.selectedIndex].value,
document.contacts.repository.value, document.contacts.category.value);
+ }
+}
+
+function selectAll()
+{
+ entries = document.contacts.contacts.options;
+ for(var i = 0; i < entries.length; i++)
+ {
+ entries[i].selected = true;
+ }
+}
+
+function addcontact(mode)
+{
+ entries = document.contacts.contacts.options;
+ for(var i = 0; i < entries.length; i++)
+ {
+ if(entries[i].selected)
+ {
+ parent.addContact(mode, entries[i]);
+ }
+ }
+}
+
+function pbquicksearch(str)
+{
+ if(str != '')
+ {
+ pattern = new RegExp ('^' + str, 'i');
+ selectbox = document.contacts.contacts.options;
+
+ for (var i = 0; i < this.selectbox.length; i++)
+ {
+ if(!pattern.test(this.selectbox[i].text))
+ {
+ //this.selectbox[i].style.visibility = 'hidden';
+
document.contacts.contacts.remove(this.selectbox[i].index);
+ i--;
+ }
+ else
+ {
+ //this.selectbox[i].style.visibility =
'visible';
+ }
+ }
+ }
+ //if (pattern1.test (this.selectArr[i].text))
+ //document.forms[this.formname][this.selname].options[j++] =
+ //this.selectArr[i];
+ //document.forms[this.formname][this.selname].options.length = j;
+}
+</script>
+<style type="text/css">
+td.pbaddressbookContactsSB select { width: 200px }
+</style>
+<div class="bg_color1" style="height: 350px">
+<form method="POST" name="contacts">
+ <input name="repository" type="hidden" value="{repository}" />
+ <input name="category" type="hidden" value="{category}" />
+ <input name="prefilter" type="hidden" value="{prefilter}" />
+ <table style="width: 250px; border: 0px solid #000000">
+ <tr>
+ <td colspan="2">
+<!-- <input type="text" name="quicksearch"
onKeyup="pbquicksearch(this.value)"/> -->
+ </td>
+ </tr>
+ <tr>
+ <td class="pbaddressbookContactsSB">
+ {contacts}
+ </td>
+ <td>
+ <table>
+ <tr>
+ <td>
+ <input name="to"
type="button" value="an" onclick="addcontact(this.name)" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="cc"
type="button" value="cc" onclick="addcontact(this.name)" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="bcc"
type="button" value="bcc" onclick="addcontact(this.name)" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center">
+ <input type="button" name="all" value="{all}"
onclick="selectAll()" />
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <input type="checkbox" name="enableDetails"
value="1" checked />
+ {enable_preview}
+ </td>
+ </tr>
+ </table>
+</form>
+</div>
+<script>
+if(parent.document.getElementById('tr_to').style.visibility == 'hidden')
+{
+ document.contacts.to.style.visibility = 'hidden';
+}
+if(parent.document.getElementById('tr_cc').style.visibility == 'hidden')
+{
+ document.contacts.cc.style.visibility = 'hidden';
+}
+if(parent.document.getElementById('tr_bcc').style.visibility == 'hidden')
+{
+ document.contacts.bcc.style.visibility = 'hidden';
+}
+</script>
\ No newline at end of file
Added:
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_contactsdetails.tpl
===================================================================
---
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_contactsdetails.tpl
(rev 0)
+++
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_contactsdetails.tpl
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,12 @@
+<style type="text/css">
+ form.contactsdetail TABLE TD { font-size: x-small }
+</style>
+
+<div class="bg_color1" style="height: 100%; width: 250px">
+<form method="POST" name="contactsdetail" class="contactsdetail">
+ <input type="hidden" value="{id}" name="id" />
+ <input type="hidden" value="{repository}" name="repository" />
+ <input type="hidden" value="{category}" name="category" />
+ {contactsdetails}
+</form>
+</div>
\ No newline at end of file
Added:
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_repository.tpl
===================================================================
---
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_repository.tpl
(rev 0)
+++
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_repository.tpl
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,39 @@
+<script>
+function changeRepo(SBRepo)
+{
+ parent.changeRepo(SBRepo.options[SBRepo.selectedIndex].value);
+ SBRepo.form.submit();
+}
+
+function changeCategory(SBCategory)
+{
+ parent.changeCat(SBCategory.options[SBCategory.selectedIndex].value,
document.repository.prefilter.value);
+}
+</script>
+
+<style type="text/css">
+ td.pbaddressbookCategoriesSB select { width: 230px }
+</style>
+
+
+<div class="bg_color1" style="width: 250px; height: 450px">
+<form method="POST" name="repository">
+ <table>
+ <tr>
+ <td align="center">
+ {SBRepos}
+ </td>
+ </tr>
+ <tr>
+ <td style="height: 40px; vertical-align: center">
+ <input type="text" id="prefilter"
name="prefilter" /> {prefilter}
+ </td>
+ </tr>
+ <tr>
+ <td class="pbaddressbookCategoriesSB">
+ {categories}
+ </td>
+ </tr>
+ </table>
+</form>
+</div>
\ No newline at end of file
Added:
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_result.tpl
===================================================================
---
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_result.tpl
(rev 0)
+++
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_result.tpl
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,6 @@
+<script>
+{to}
+{cc}
+{bc}
+window.close();
+</script>
\ No newline at end of file
Added:
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_resultAccounts.tpl
===================================================================
---
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_resultAccounts.tpl
(rev 0)
+++
people/sigurdne/modules/projects/trunk/templates/base/pbaddressbook_resultAccounts.tpl
2009-11-20 10:28:44 UTC (rev 20847)
@@ -0,0 +1,6 @@
+<script>
+var myarray = new Array();
+{javascript}
+opener.writeOptions('{targettagto}', myarray );
+window.close();
+</script>
\ No newline at end of file
Modified:
people/sigurdne/modules/projects/trunk/templates/base/preference_acl_row.tpl
===================================================================
---
people/sigurdne/modules/projects/trunk/templates/base/preference_acl_row.tpl
2009-11-20 10:28:38 UTC (rev 20846)
+++
people/sigurdne/modules/projects/trunk/templates/base/preference_acl_row.tpl
2009-11-20 10:28:44 UTC (rev 20847)
@@ -1,5 +1,5 @@
<!-- $Id$ -->
-<tr bgcolor="{row_color}">
+<tr class="{row_class}">
<td>{user}</td>
<td align="center"><input type="checkbox" name="{read}"
value="Y"{read_selected}></td>
<td align="center"><input type="checkbox" name="{add}"
value="Y"{add_selected}></td>
Modified:
people/sigurdne/modules/projects/trunk/templates/base/preference_colspan.tpl
===================================================================
---
people/sigurdne/modules/projects/trunk/templates/base/preference_colspan.tpl
2009-11-20 10:28:38 UTC (rev 20846)
+++
people/sigurdne/modules/projects/trunk/templates/base/preference_colspan.tpl
2009-11-20 10:28:44 UTC (rev 20847)
@@ -1,5 +1,5 @@
<!-- $Id$ -->
-<tr bgcolor="{bg_color}">
+<tr class="th">
<td>{string}</td>
<td align="center">{lang_read}</td>
<td align="center">{lang_add}</td>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] [20847] update projects,
Sigurd Nes <=