phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] projects index.php doc/CHANGELOG doc/USING help...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] projects index.php doc/CHANGELOG doc/USING help...
Date: Tue, 05 Dec 2006 19:40:57 +0000

CVSROOT:        /sources/phpgroupware
Module name:    projects
Changes by:     Sigurd Nes <sigurdne>   06/12/05 19:40:56

Modified files:
        .              : index.php 
        doc            : CHANGELOG USING 
        help           : index.php 
        inc            : class.boconfig.inc.php 
                         class.boprojecthours.inc.php 
                         class.boprojects.inc.php 
                         class.bostatistics.inc.php 
                         class.soconfig.inc.php 
                         class.soprojecthours.inc.php 
                         class.soprojects.inc.php 
                         class.sostatistics.inc.php 
                         class.uiconfig.inc.php 
                         class.uiprojecthours.inc.php 
                         class.uiprojects.inc.php 
                         class.uiprojects_base.inc.php 
                         class.uistatistics.inc.php 
                         hook_add_def_pref.inc.php hook_admin.inc.php 
                         hook_deleteaccount.inc.php hook_home.inc.php 
                         hook_manual.inc.php hook_preferences.inc.php 
                         hook_sidebox_menu.inc.php 
        setup          : default_records.inc.php phpgw_br.lang 
                         phpgw_da.lang phpgw_de.lang phpgw_en.lang 
                         phpgw_es.lang phpgw_fr.lang phpgw_it.lang 
                         phpgw_nl.lang phpgw_pl.lang phpgw_pt.lang 
                         phpgw_sv.lang setup.inc.php 
                         tables_baseline.inc.php tables_current.inc.php 
                         tables_update.inc.php 
        templates/base : addressbook.tpl archive.tpl booked.tpl 
                         config.tpl config_locations.tpl 
                         controlling_import_result.tpl delete.tpl 
                         export_diamant.tpl form.tpl form_admin.tpl 
                         form_emp_factor.tpl form_emp_roles.tpl 
                         formactivity.tpl header.tpl home_list.tpl 
                         hours_controlling.tpl hours_formhours.tpl 
                         hours_import_controlling.tpl 
                         hours_listhours.tpl hours_view.tpl list.tpl 
                         list_admin.tpl list_budget.tpl 
                         list_employees.tpl list_events.tpl 
                         list_mstones.tpl list_pro_hours.tpl 
                         list_roles.tpl list_surcharges.tpl 
                         list_tree.tpl listactivities.tpl 
                         preference_acl.tpl preference_acl_row.tpl 
                         preference_colspan.tpl preferences.tpl 
                         project_activity.tpl projects_header.tpl 
                         report_list.tpl report_wizard.tpl 
                         stats_gant.tpl stats_gant_popup.tpl 
                         stats_project_employees.tpl 
                         stats_projectlist.tpl stats_projectstat.tpl 
                         stats_userlist.tpl stats_userlist_worktimes.tpl 
                         stats_userstat.tpl ttracker.tpl 
                         ttracker_form.tpl view.tpl 
        templates/base/css: style.css 
Added files:
        css            : style.css 
        inc            : class.attached_files.inc.php 
                         class.checker.inc.php class.checker_pb.inc.php 
                         class.ipc_projects.inc.php 
                         class.ofprojects.inc.php 
                         class.phpOpenOffice.inc.php 
                         class.reportOOo.inc.php zip.lib.php 
        inc/pclzip     : gnu-lgpl.txt pclzip.lib.php readme.txt 
        templates/base/images: booked1.png button_act_report.png 
                               button_export_diamant.png 
                               button_pro_activities.png 
                               button_pro_add.png button_pro_add_sub.jpg 
                               button_pro_budget.jpg button_pro_edit.png 
                               button_pro_employees.png 
                               button_pro_ganttchart.png 
                               button_pro_hours.png button_pro_list.png 
                               button_pro_parent.gif 
                               button_pro_parent.png button_pro_view.png 
                               button_wt_add.png button_wt_cs.jpg 
                               button_wt_list.png button_wt_stat.gif 
                               button_wt_stat.png button_wt_tt.jpg 
                               delete.png document.png help.png 
                               navbar.gif users.png 
        templates/idots/images: aufbau.png booked1.png delete.png 
                                document.png help.png 
        templates/probusiness/images: aufbau.png booked1.png 
                                      document.png 

Log message:
        ported the probusiness version to HEAD

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/projects/index.php?cvsroot=phpgroupware&r1=1.57&r2=1.58
http://cvs.savannah.gnu.org/viewcvs/projects/css/style.css?cvsroot=phpgroupware&rev=1.4
http://cvs.savannah.gnu.org/viewcvs/projects/doc/CHANGELOG?cvsroot=phpgroupware&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/projects/doc/USING?cvsroot=phpgroupware&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/projects/help/index.php?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.boconfig.inc.php?cvsroot=phpgroupware&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.boprojecthours.inc.php?cvsroot=phpgroupware&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.boprojects.inc.php?cvsroot=phpgroupware&r1=1.167&r2=1.168
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.bostatistics.inc.php?cvsroot=phpgroupware&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.soconfig.inc.php?cvsroot=phpgroupware&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.soprojecthours.inc.php?cvsroot=phpgroupware&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.soprojects.inc.php?cvsroot=phpgroupware&r1=1.118&r2=1.119
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.sostatistics.inc.php?cvsroot=phpgroupware&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.uiconfig.inc.php?cvsroot=phpgroupware&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.uiprojecthours.inc.php?cvsroot=phpgroupware&r1=1.93&r2=1.94
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.uiprojects.inc.php?cvsroot=phpgroupware&r1=1.169&r2=1.170
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.uiprojects_base.inc.php?cvsroot=phpgroupware&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.uistatistics.inc.php?cvsroot=phpgroupware&r1=1.66&r2=1.67
http://cvs.savannah.gnu.org/viewcvs/projects/inc/hook_add_def_pref.inc.php?cvsroot=phpgroupware&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/projects/inc/hook_admin.inc.php?cvsroot=phpgroupware&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/projects/inc/hook_deleteaccount.inc.php?cvsroot=phpgroupware&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/projects/inc/hook_home.inc.php?cvsroot=phpgroupware&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/projects/inc/hook_manual.inc.php?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/projects/inc/hook_preferences.inc.php?cvsroot=phpgroupware&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/projects/inc/hook_sidebox_menu.inc.php?cvsroot=phpgroupware&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.attached_files.inc.php?cvsroot=phpgroupware&rev=1.4
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.checker.inc.php?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.checker_pb.inc.php?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.ipc_projects.inc.php?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.ofprojects.inc.php?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.phpOpenOffice.inc.php?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/inc/class.reportOOo.inc.php?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/inc/zip.lib.php?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/inc/pclzip/gnu-lgpl.txt?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/inc/pclzip/pclzip.lib.php?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/inc/pclzip/readme.txt?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/setup/default_records.inc.php?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/projects/setup/phpgw_br.lang?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/projects/setup/phpgw_da.lang?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/projects/setup/phpgw_de.lang?cvsroot=phpgroupware&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/projects/setup/phpgw_en.lang?cvsroot=phpgroupware&r1=1.57&r2=1.58
http://cvs.savannah.gnu.org/viewcvs/projects/setup/phpgw_es.lang?cvsroot=phpgroupware&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/projects/setup/phpgw_fr.lang?cvsroot=phpgroupware&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/projects/setup/phpgw_it.lang?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/projects/setup/phpgw_nl.lang?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/setup/phpgw_pl.lang?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/projects/setup/phpgw_pt.lang?cvsroot=phpgroupware&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/projects/setup/phpgw_sv.lang?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/projects/setup/setup.inc.php?cvsroot=phpgroupware&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/projects/setup/tables_baseline.inc.php?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/projects/setup/tables_current.inc.php?cvsroot=phpgroupware&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/projects/setup/tables_update.inc.php?cvsroot=phpgroupware&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/addressbook.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/archive.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/booked.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/config.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/config_locations.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/controlling_import_result.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/delete.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/export_diamant.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/form.tpl?cvsroot=phpgroupware&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/form_admin.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/form_emp_factor.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/form_emp_roles.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/formactivity.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/header.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/home_list.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/hours_controlling.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/hours_formhours.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/hours_import_controlling.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/hours_listhours.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/hours_view.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/list.tpl?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/list_admin.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/list_budget.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/list_employees.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/list_events.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/list_mstones.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/list_pro_hours.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/list_roles.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/list_surcharges.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/list_tree.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/listactivities.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/preference_acl.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/preference_acl_row.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/preference_colspan.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/preferences.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/project_activity.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/projects_header.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/report_list.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/report_wizard.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/stats_gant.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/stats_gant_popup.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/stats_project_employees.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/stats_projectlist.tpl?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/stats_projectstat.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/stats_userlist.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/stats_userlist_worktimes.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/stats_userstat.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/ttracker.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/ttracker_form.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/view.tpl?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/css/style.css?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/booked1.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_act_report.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_export_diamant.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_pro_activities.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_pro_add.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_pro_add_sub.jpg?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_pro_budget.jpg?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_pro_edit.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_pro_employees.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_pro_ganttchart.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_pro_hours.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_pro_list.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_pro_parent.gif?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_pro_parent.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_pro_view.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_wt_add.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_wt_cs.jpg?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_wt_list.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_wt_stat.gif?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_wt_stat.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/button_wt_tt.jpg?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/delete.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/document.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/help.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/navbar.gif?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/base/images/users.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/idots/images/aufbau.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/idots/images/booked1.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/idots/images/delete.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/idots/images/document.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/idots/images/help.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/probusiness/images/aufbau.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/probusiness/images/booked1.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/projects/templates/probusiness/images/document.png?cvsroot=phpgroupware&rev=1.1

Patches:
Index: index.php
===================================================================
RCS file: /sources/phpgroupware/projects/index.php,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- index.php   25 Nov 2006 16:26:26 -0000      1.57
+++ index.php   5 Dec 2006 19:40:44 -0000       1.58
@@ -1,14 +1,28 @@
 <?php
-       /**
-       * Project Manager
-       *
-       * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @package projects
-       * @version $Id: index.php,v 1.57 2006/11/25 16:26:26 sigurdne Exp $
-       * $Source: /sources/phpgroupware/projects/index.php,v $
-       */
+       /*******************************************************************\
+       * phpGroupWare - Projects                                           *
+       * http://www.phpgroupware.org                                       *
+       *                                                                   *
+       * Project Manager                                                   *
+       * Written by Bettina Gille address@hidden                   *
+       * -----------------------------------------------                   *
+       * Copyright (C) 2000, 2001 Bettina Gille                            *
+       *                                                                   *
+       * 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, write to the Free Software       *
+       * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.         *
+       \*******************************************************************/
+       /* $Id: index.php,v 1.58 2006/12/05 19:40:44 sigurdne Exp $ */
 
        $GLOBALS['phpgw_info']['flags'] = array
        (

Index: doc/CHANGELOG
===================================================================
RCS file: /sources/phpgroupware/projects/doc/CHANGELOG,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- doc/CHANGELOG       28 May 2001 21:42:37 -0000      1.21
+++ doc/CHANGELOG       5 Dec 2006 19:40:45 -0000       1.22
@@ -1,4 +1,4 @@
-+ $Id: CHANGELOG,v 1.21 2001/05/28 21:42:37 bettina Exp $
++ $Id: CHANGELOG,v 1.22 2006/12/05 19:40:45 sigurdne Exp $
 
 11/23/2000: Initial release on sourceforge - version 0.8.1
 11/25/2000: included projecthours in projects

Index: doc/USING
===================================================================
RCS file: /sources/phpgroupware/projects/doc/USING,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- doc/USING   16 Jul 2002 13:06:45 -0000      1.11
+++ doc/USING   5 Dec 2006 19:40:45 -0000       1.12
@@ -1,4 +1,4 @@
-+ $Id: USING,v 1.11 2002/07/16 13:06:45 ceb Exp $
++ $Id: USING,v 1.12 2006/12/05 19:40:45 sigurdne Exp $
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
 +                             quick instruction                              +
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Index: help/index.php
===================================================================
RCS file: /sources/phpgroupware/projects/help/index.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- help/index.php      8 Apr 2005 15:52:57 -0000       1.3
+++ help/index.php      5 Dec 2006 19:40:45 -0000       1.4
@@ -1,15 +1,14 @@
 <?php
-       /**
-       * Project Manager - User manual
-       *
-       * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @package projects
-       * @subpackage help
-       * @version $Id: index.php,v 1.3 2005/04/08 15:52:57 ceb Exp $
-       * $Source: /sources/phpgroupware/projects/help/index.php,v $
-       */
+       
/**************************************************************************\
+       * phpGroupWare - User manual                                            
   *
+       * http://www.phpgroupware.org                                           
   *
+       * --------------------------------------------                          
   *
+       *  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.                                           
   *
+       
\**************************************************************************/
+       /* $Id: index.php,v 1.4 2006/12/05 19:40:45 sigurdne Exp $ */
 
        $phpgw_flags = Array('currentapp' => 'manual');
 

Index: inc/class.boconfig.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/class.boconfig.inc.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- inc/class.boconfig.inc.php  27 Nov 2006 21:36:26 -0000      1.25
+++ inc/class.boconfig.inc.php  5 Dec 2006 19:40:45 -0000       1.26
@@ -6,7 +6,7 @@
        * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: class.boconfig.inc.php,v 1.25 2006/11/27 21:36:26 
sigurdne Exp $
+       * @version $Id: class.boconfig.inc.php,v 1.26 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: /sources/phpgroupware/projects/inc/class.boconfig.inc.php,v $
        */
 
@@ -19,7 +19,6 @@
                var $order;
                var $sort;
                var $cat_id;
-               var $limit;
 
                var $public_functions = array
                (
@@ -68,14 +67,14 @@
                        {
                                $prefs['cscols'] = array();
                        }
-                       if(!is_array($prefs['mail_type']))
+                       if(!isset($prefs['send_status_mail']))
                        {
-                               $prefs['mail_type'] = array();
+                               $prefs['send_status_mail'] = true;
                        }
 
                        
$GLOBALS['phpgw']->preferences->change('projects','columns',implode(',',$prefs['cols']));
                        
$GLOBALS['phpgw']->preferences->change('projects','cscolumns',implode(',',$prefs['cscols']));
-                       
$GLOBALS['phpgw']->preferences->change('projects','mailTypeEntries',implode(',',$prefs['mail_type']));
+                       
$GLOBALS['phpgw']->preferences->change('projects','send_status_mail',$prefs['send_status_mail']);
                        
$GLOBALS['phpgw']->preferences->change('projects','mainscreen_showevents',$prefs['mainscreen_showevents']);
     
 
                        $GLOBALS['phpgw']->preferences->save_repository(True);
@@ -84,27 +83,40 @@
                function selected_employees()
                {
                        $emps = $this->boprojects->read_projects_acl();
-                       if (is_array($emps))
+                       $empl = array();
+                       if(is_array($emps))
                        {
+                               $emps = array_unique($emps);
                                for($i=0;$i<count($emps);$i++)
                                {
-                                       $this->accounts = 
CreateObject('phpgwapi.accounts',$emps[$i]);
-                                       $this->accounts->read_repository();
+                                       
$GLOBALS['phpgw']->accounts->get_account_name($emps[$i],$lid,$fname,$lname);
+                                       $fullname = 
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname);
 
                                        $empl[] = array
                                        (
-                                               'account_id'            => 
$this->accounts->data['account_id'],
-                                               'account_lid'           => 
$this->accounts->data['account_lid'],
-                                               'account_firstname'     => 
$this->accounts->data['firstname'],
-                                               'account_lastname'      => 
$this->accounts->data['lastname']
+                                               'account_id'            => 
$emps[$i],
+                                               'account_lid'           => $lid,
+                                               'account_firstname'     => 
$fname,
+                                               'account_lastname'      => 
$lname,
+                                               'account_fullname'      => 
$fullname
                                        );
+                                       $lid = $fname = $lname = $fullname = '';
                                }
                        }
-                       asort($empl);
-                       reset($empl);
+
+                       if(is_array($empl))
+                       {
+                               usort($empl, array('boconfig', 
'cmp_employees'));
+                       }
+
                        return $empl;
                }
 
+               function cmp_employees($a, $b) 
+               {
+                       return strcasecmp($a['account_fullname'], 
$b['account_fullname']);
+               }
+
                function read_accounting_factors($data = 0)
                {
                        $factors = 
$this->soconfig->read_employees(array('start' => $this->start,'sort' => 
$this->sort,'order' => $this->order,
@@ -117,6 +129,7 @@
                                {
                                        $edate = 
$emp['edate']>0?$this->boprojects->format_date($emp['edate']):'';
                                        $sdate = 
$emp['sdate']>0?$this->boprojects->format_date($emp['sdate']):'';
+                                       $location = 
$this->get_single_location($emp['location_id']);
 
                                        $emps[] = array
                                        (
@@ -127,6 +140,7 @@
                                                'd_accounting'          => 
$emp['d_accounting'],
                                                'weekly_workhours'      => 
$emp['weekly_workhours'],
                                                'cost_centre'           => 
$emp['cost_centre'],
+                                               'location'              => 
$location,
                                                'sdate'                         
=> $emp['sdate'],
                                                'edate'                         
=> $emp['edate'],
                                                'sdate_formatted'       => 
$sdate['date_formatted'],
@@ -185,16 +199,15 @@
 
                function list_admins($action)
                {
-                       $admins = 
$this->boprojects->soconfig->read_admins($action);
+                       $admins = 
$this->boprojects->soconfig->read_admins($action,$type='');
 
                        //_debug_array($admins);
 
                        $this->total_records = 
$this->boprojects->soconfig->total_records;
 
-                       $admin_data = false;
                        if(is_array($admins))
                        {
-                               foreach($admins as $key => $ad)
+                               foreach($admins as $ad)
                                {
                                        $accounts = 
CreateObject('phpgwapi.accounts',$ad['account_id']);
                                        $accounts->read_repository();
@@ -204,7 +217,7 @@
                                                'lid'                   => 
$accounts->data['account_lid'],
                                                'firstname'             => 
$accounts->data['firstname'],
                                                'lastname'              => 
$accounts->data['lastname'],
-                                               'type'                  => 
$ad['type']
+                                               'type'                  => 
$accounts->get_type($ad['account_id'])
                                        );
                                        unset($accounts);
                                }
@@ -230,9 +243,8 @@
 
                        $alladmins = 
$type=='user'?$aclusers['users']:$aclusers['groups'];
 
-                       if (isset($alladmins) && is_array($alladmins))
+                       if (is_array($alladmins))
                        {
-                               $selected_admins = '';
                                for($i=0;$i<count($alladmins);++$i)
                                {
                                        $selected_admins .= '<option value="' . 
$alladmins[$i] . '"';
@@ -280,25 +292,21 @@
                                case 'accounting':
                                        //_debug_array($values);
 
-                                       if(!$values['edate'] && 
$values['sdate'])
-                                       {
-                                               $error[] = lang('please set the 
end date');
-                                       }
-                                       else if(!$values['sdate'] && 
$values['edate'])
+                                       if(!$values['sdate'])
                                        {
                                                $error[] = lang('please set the 
start date');
+                                               $overlap = False;
                                        }
-                                       else if($values['sdate'] && 
$values['edate'])
+                                       elseif($values['sdate'] && 
$values['edate'])
                                        {
                                                $existing = 
$this->read_accounting_factors(array('limit' => False,'account_id' => 
$values['account_id'],'id' => $values['id']));
 
                                                if(is_array($existing))
                                                {
                                                        
//_debug_array($existing);
-
                                                        foreach($existing as 
$exists)
                                                        {
-                                                               
if($values['sdate'] <= $exists['sdate'] && $values['edate'] >= $exists['edate'])
+                                                               
if($exists['edate'] && $values['sdate'] <= $exists['sdate'] && $values['edate'] 
>= $exists['edate'])
                                                                {
                                                                        
$overlap = True;
                                                                }
@@ -315,12 +323,38 @@
                                                                        
$overlap = True;
                                                                }
                                                        }
-                                                       if($overlap)
+                                               }
+                                       }
+                                       elseif($values['sdate'] && 
!$values['edate'])
                                                        {
-                                                               $error[] = 
lang('the choosen timeframe interleaves an already existing timeframe');
+                                               $existing = 
$this->read_accounting_factors(array('limit' => False,'account_id' => 
$values['account_id'],'id' => $values['id']));
+
+                                               if(is_array($existing))
+                                               {
+                                                       
//_debug_array($existing);
+                                                       foreach($existing as 
$exists)
+                                                       {
+                                                               
if(($exists['sdate'] <= $values['sdate']) && ($values['sdate'] <= 
$exists['edate']))
+                                                               {
+                                                                       
$overlap = True;
                                                        }
+                                                               
elseif(($exists['sdate'] <= $values['sdate']) && !$exists['edate'])
+                                                               {
+                                                                       
$overlap = True;
+                                                               }
+                                                               
elseif($values['sdate'] <= $exists['sdate'])
+                                                               {
+                                                                       
$overlap = True;
                                                }
                                        }
+                                               }
+                                       }
+
+                                       if($overlap)
+                                       {
+                                               $error[] = lang('the choosen 
timeframe interleaves an already existing timeframe');
+                                       }
+                                       
                                        if 
(!is_numeric($values['weekly_workhours']))
                                        {
                                                $error[] = lang('please set the 
weekly workhours');
@@ -336,9 +370,9 @@
                                                $error[] = lang('Description 
can not exceed 250 characters in length');
                                        }
 
-                                       if (!isset($values['choose']) || 
!$values['choose'])
+                                       if (! $values['choose'])
                                        {
-                                               if (!isset($values['number']) 
|| !$values['number'])
+                                               if (! $values['number'])
                                                {
                                                        $error[] = lang('Please 
enter an ID');
                                                }
@@ -365,7 +399,7 @@
 
                                        if 
($this->boprojects->siteconfig['activity_bill'] == 'wu')
                                        {
-                                               if (!isset($values['minperae']) 
|| (!$values['minperae']) || ($values['minperae'] == 0))
+                                               if ((! $values['minperae']) || 
($values['minperae'] == 0))
                                                {
                                                        $error[] = lang('please 
enter the minutes per workunit');
                                                }
@@ -373,7 +407,7 @@
                                        break;
                        }
 
-                       if (isset($error) && is_array($error))
+                       if (is_array($error))
                        {
                                return $error;
                        }
@@ -390,12 +424,12 @@
 
                function save_activity($values)
                {
-                       if (isset($values['choose']) && $values['choose'])
+                       if ($values['choose'])
                        {
                                $values['number'] = 
$this->boprojects->soprojects->create_activityid();
                        }
 
-                       if (isset($values['activity_id']) && 
$values['activity_id'])
+                       if ($values['activity_id'])
                        {
                                if ($values['activity_id'] && 
intval($values['activity_id']) > 0)
                                {
@@ -403,9 +437,7 @@
 
                                        if ($values['minperae'])
                                        {
-       
-       // Fix this !! - obsolete ?
-       //                                      
$this->boprojects->sohours->update_hours_act($values['activity_id'],$values['minperae']);
+                                               
$this->boprojects->sohours->update_hours_act($values['activity_id'],$values['minperae']);
                                        }
                                }
                        }
@@ -540,18 +572,25 @@
                        switch($values['action'])
                        {
                                case 'get':
+                                       $warnmail = array();
                                        
if(isset($config->config_data['worktime_warnmail']))
-                                               $warnmail_type = 
$config->config_data['worktime_warnmail'];
+                                               $warnmail['type'] = 
$config->config_data['worktime_warnmail'];
                                        else
-                                               $warnmail_type = -1;
-                                       return $warnmail_type;
+                                               $warnmail['type'] = -1;
+                                       
if(isset($config->config_data['warnmail_email_address']))
+                                               
$warnmail['warnmail_email_address'] = 
$config->config_data['warnmail_email_address'];
+                                       else
+                                               
$warnmail['warnmail_email_address'] = '';
+                                       return $warnmail;
                                break;
                                case 'save':
                                        if(!isset($values['warnmail_type']))
                                                return false;
-
                                        $warnmail_type = 
intval($values['warnmail_type']);
+                                       $warnmail_email_address  = 
$values['warnmail_email_address'];
+
                                        $config->value('worktime_warnmail', 
$warnmail_type);
+                                       
$config->value('warnmail_email_address', $warnmail_email_address);
                                        $config->save_repository();
 
                                        // set async service
@@ -660,7 +699,8 @@
 
                                                $holidays = 
CreateObject('phpgwapi.calendar_holidays');
                                                $sbox = 
createobject('phpgwapi.sbox');
-                                               $country = 
ucfirst($GLOBALS['phpgw']->translation->retranslate($sbox->country_array[$GLOBALS['phpgw']->preferences->data['common']['country']]));
+//                                             $country = 
ucfirst($GLOBALS['phpgw']->translation->retranslate($sbox->country_array[$GLOBALS['phpgw']->preferences->data['common']['country']]));
+                                               $country = 
ucfirst(lang($sbox->country_array[$GLOBALS['phpgw']->preferences->data['common']['country']]));
                                                $federal_state = 
$holidays->federal_states[$country][$GLOBALS['phpgw']->preferences->data['common']['federalstate']];
 // Achtung: bisher existiert nur germany!
                                                $religion = 
$holidays->religions[$GLOBALS['phpgw']->preferences->data['common']['religion']];
 
@@ -672,12 +712,11 @@
                                                $workdays = $book_type;
                                                
                                                // time of booking in this month
-                                               $new_days = 
$holidays->add_number_of_workdays(1,$now_m,$now_y,$workdays,$country,$federal_state,$religion);
 
+                                               $new_days = 
$holidays->add_number_of_workdays(1,$now_m,$now_y,$workdays,$country,$federal_state,$religion);
                                                $new_d = $new_days['newday'];
                                                $new_m = $new_days['newmonth'];
                                                $new_y = $new_days['newyear'];
-                                               
                                                unset($new_days);
 
                                                $ts_book = 
mktime(0,0,0,$new_m,$new_d,$new_y)-1;
@@ -700,7 +739,6 @@
                                                        $new_d = 
$new_days['newday'];
                                                        $new_m = 
$new_days['newmonth'];
                                                        $new_y = 
$new_days['newyear'];
-                                               
                                                        unset($new_days);
 
                                                        $ts_book = 
mktime(0,0,0,$new_m,$new_d,$new_y)-1;
@@ -742,5 +780,66 @@
                                break;
                        }
                }
+               
+               function save_location($location_data)
+               {
+                       $location_data['location_name'] = 
trim($location_data['location_name']);
+                       $location_data['location_ident'] = 
trim($location_data['location_ident']);
+                       $location_data['location_custnum'] = 
trim($location_data['location_custnum']);
+                       $this->soconfig->save_location($location_data);
+                       $this->get_locations(true);
+               }
+
+               function get_locations($reload=false)
+               {
+                       if($this->location_loaded && is_array($this->locations) 
&& !$reload)
+                       {
+                               return $this->locations;
+                       }
+                       
+                       $this->locations = $this->soconfig->get_locations();
+                       $this->location_loaded = true;
+                       return $this->locations;
+               }
+               
+               function get_single_location($location_id, $reload=false)
+               {
+                       $location_id = intval($location_id);
+                       if(isset($this->locations[$location_id]) && !$reload)
+                       {
+                               return $this->locations[$location_id];
+                       }
+
+                       $location = 
$this->soconfig->get_single_location($location_id);
+                       if(isset($location['location_id']))
+                       {
+                               $this->locations[$location['location_id']] = 
$location;
+                               $this->location_idents[$location_ident] = 
$location;
+                       }
+
+                       return $location;
+               }
+
+               function get_location_for_ident($location_ident, $reload=false)
+               {
+                       if(isset($this->location_idents[$location_ident]) && 
!$reload)
+                       {
+                               return $this->location_idents[$location_ident];
+                       }
+
+                       $location = 
$this->soconfig->get_location_for_ident($location_ident);
+                       if(isset($location['location_id']))
+                       {
+                               $this->location_idents[$location_ident] = 
$location;
+                       }
+                       
+                       return $location;
+               }
+
+               function delete_location($location_id)
+               {
+                       $this->soconfig->delete_location($location_id);
+                       $this->get_locations(true);
+               }
        }
 ?>

Index: inc/class.boprojecthours.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/class.boprojecthours.inc.php,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- inc/class.boprojecthours.inc.php    27 Nov 2006 21:36:26 -0000      1.42
+++ inc/class.boprojecthours.inc.php    5 Dec 2006 19:40:45 -0000       1.43
@@ -3,10 +3,10 @@
        * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: class.boprojecthours.inc.php,v 1.42 2006/11/27 21:36:26 
sigurdne Exp $
+       * @version $Id: class.boprojecthours.inc.php,v 1.43 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/class.boprojecthours.inc.php,v $
        */
 
@@ -19,7 +19,6 @@
                var $sort;
                var $status;
                var $project_id;
-               var $state;
 
                var $public_functions = array
                (
@@ -87,9 +86,7 @@
 
                function edit_perms($pro)
                {
-                       $pro['action']          = 
(isset($pro['action'])?$pro['action']:'edit');
-                       $pro['booked']          = 
(isset($pro['booked'])?$pro['booked']:'');
-                       $pro['adminonly']       = 
(isset($pro['adminonly'])?$pro['adminonly']:'');
+                       $pro['action'] = 
isset($pro['action'])?$pro['action']:'edit';
 
                        switch($pro['action'])
                        {
@@ -99,7 +96,7 @@
 
                        if (($pro['status'] != 'billed') && ($pro['status'] != 
'closed') && ($pro['booked'] != 'Y'))
                        {
-                               if (isset($pro['employee']) && $pro['employee'] 
== $this->account && !$pro['adminonly'])
+                               if ($pro['employee'] == $this->account && 
!$pro['adminonly'])
                                {
                                        return True;
                                }
@@ -138,7 +135,7 @@
                                $hour = date('H',$hdate);
                                $min = date('i',$hdate);
 
-                               $hdate = $hdate + (60*60) * 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])?$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']:0);
+                               $hdate = $hdate + (60*60) * 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
                                $htime['date'] = 
$GLOBALS['phpgw']->common->show_date($hdate,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                                $htime['time'] = 
$GLOBALS['phpgw']->common->formattime($hour,$min);
                        }
@@ -186,7 +183,6 @@
                function list_hours($start = 0, $end = 0)
                {
                        $filter = $this->filter;
-                       $hours = false;
                        $hours_list = $this->sohours->read_hours(array('start' 
=> $this->start,
                                                                       'limit' 
=> $this->limit,
                                                                       'query' 
=> $this->query,
@@ -210,11 +206,12 @@
                                        'activity_title'        => 
$this->siteconfig['accounting']=='activity'?$this->boprojects->return_value('act',$hour['activity_id']):'',
                                        'status'                        => 
$hour['status'],
                                        'statusout'                     => 
lang($hour['status']),
-                                       'sdate'                         => 
(isset($hour['start_date'])?$hour['start_date']:''),
-                                       'edate'                         => 
(isset($hour['end_date'])?$hour['end_date']:''),
-                                       'minutes'                       => 
(isset($hour['minutes'])?$hour['minutes']:''),
+                                       'sdate'                         => 
$hour['start_date'],
+                                       'edate'                         => 
$hour['end_date'],
+                                       'minutes'                       => 
$hour['minutes'],
                                        'wh'                            => 
$this->sohours->format_wh($hour['minutes']),
-                                       't_journey'                     => 
$this->sohours->min2time($hour['t_journey']),
+                                       'wh_t_journey'  => 
$this->sohours->format_wh($hour['t_journey']),
+                                       't_journey'                     => 
$this->sohours->min2str($hour['t_journey']),
                                        'wh_all'                        => 
$this->sohours->format_wh($hour['minutes']+$hour['t_journey']),
                                        'employee'                      => 
$hour['employee'],
                                        'employeeout'           => 
$GLOBALS['phpgw']->common->grab_owner_name($hour['employee']),
@@ -302,7 +299,9 @@
 
                        if($this->siteconfig['hoursbookingnull'] == 'no')
                        {
-                               if(intval($values['hours']) == 0 && 
intval($values['minutes']) == 0)
+                               if( (intval($values['hours']) == 0 && 
intval($values['minutes']) == 0) &&
+                             (intval($values['t_journey_h']) == 0 && 
intval($values['t_journey_m']) == 0)
+                           )
                                {
                                        $error[] = lang('please enter the work 
time');
                                }
@@ -644,7 +643,6 @@
 
                        if(is_array($project_list))
                        {
-                               $hours =false;
                                foreach($project_list as $key => $pro)
                                {
                                        $hours[$key] = array
@@ -671,7 +669,8 @@
                                                                'edate'         
                => $track['edate'],
                                                                
'edate_formatted'       => $this->format_htime($track['edate']),
                                                                'remark'        
                => nl2br($GLOBALS['phpgw']->strip_html($track['remark'])),
-                                                               'wh'            
                => $this->sohours->format_wh($track['minutes'])
+                                                               'wh'            
                => $this->sohours->format_wh($track['minutes']),
+                                                               'journey'     
=> $this->sohours->format_wh($track['t_journey'])
                                                        );
                                                }
                                        }
@@ -706,6 +705,7 @@
                                'track_id'                      => 
$hours['track_id'],
                                'project_id'            => $hours['project_id'],
                                'wh'                            => 
$hours['minutes']>0?$this->sohours->format_wh($hours['minutes']):0,
+                               't_journey'     => 
$hours['t_journey']>0?$this->sohours->format_wh($hours['t_journey']):0,
                                'hours_descr'           => 
$GLOBALS['phpgw']->strip_html($hours['hours_descr']),
                                'sdate'                         => 
$hours['sdate'],
                                'edate'                         => 
$hours['edate'],
@@ -739,8 +739,6 @@
                
                function build_controlling_matrix($account_id, $start_date, 
$end_date)
                {
-                       
-                       $matrix = array();
                        if($account_id != 
$GLOBALS['phpgw_info']['user']['account_id'])
                        { // read projects for account_id
                                $this->boprojects->soprojects->account = 
$account_id;
@@ -754,6 +752,11 @@
                        $start_date = mktime(0, 0, 0, date("m", $start_date), 
date("d", $start_date), date("Y", $start_date));
                        foreach($projects as $key => $value)
                        {
+                               if(($value['status'] == 'archive') || 
($value['status'] == 'nonactive'))
+                               {
+                                       continue;
+                               }
+
                                $j = $start_date;
                                while($j <= $end_date)
                                {
@@ -776,7 +779,9 @@
                                {
                                        if($matrix[$i]['id'] == 
$hoursResult->f(1))
                                        {
+                               //              
$matrix[$i]['days'][$hoursResult->f(0)] = $hoursResult->f(2);
                                                
$matrix[$i]['days'][date("Ymd",$hoursResult->f(0))] = $hoursResult->f(2);
+
                                                break;
                                        }
                                }
@@ -795,7 +800,7 @@
                {
                        $projects = 
$this->boprojects->soprojects->get_projects_tree();
                        $export  = 
lang('User').":\t".$GLOBALS['phpgw_info']['user']['account_lid']."\t".$GLOBALS['phpgw_info']['user']['account_id']."\n\n\n";
-                       $export .= "\t".lang('Project')."\t".lang('job 
id')."\t".lang('Customer')."\t";
+                       $export .= "\t".lang('Project')."\t".lang('project 
id')."\t".lang('Customer')."\t";
                        for($j = $start; $j <= $end; $j += 86400)
                        {
                                $export .= "\t".date('d.m.Y', $j);
@@ -804,6 +809,11 @@
 
                        foreach($projects as $key => $value)
                        {
+                               if(($value['status'] == 'archive') || 
($value['status'] == 'nonactive'))
+                               {
+                                       continue;
+                               }
+
                                $org = '';
                                if($value['customer_org'] != 0)
                                {
@@ -817,7 +827,7 @@
                                $export .= $value['id']."\t".str_repeat('   ', 
(substr_count($key, '.') - 1)).$value['title']."\t";
                                $export .= 
$value['pnumber']."\t".$org."\t".lang('work time');
                                $export .= "\n";
-                               $export .= "\t\t\t\t".lang('time of journey');
+                               $export .= "\t\t\t\t".lang('travel time');
                                $export .= "\n";
                                $export .= "\t\t\t\t".lang('description');
                                $export .= "\n";
@@ -982,7 +992,16 @@
 
                function build_acitivity_matrix($projectID, $start = 0, $end = 
0)
                {
-                       $projects = 
$this->boprojects->soprojects->get_projects_tree($projectID, 
array('project_id', 'parent', 'title', 'p_number', 'direct_work', 'p_number', 
'end_date', 'time_planned', 'e_budget', 'acc_factor', 'acc_factor_d'));
+                       if ($this->boprojects->isprojectadmin('pad') || 
$this->boprojects->isprojectadmin('pmanager'))
+                       {
+                               $coordinator = 
$this->boprojects->return_value('co', $projectID);
+                       }
+                       else
+                       {
+                               $coordinator = -1;
+                       }
+                       
+                       $projects = 
$this->boprojects->soprojects->get_projects_tree($projectID, 
array('project_id', 'parent', 'title', 'p_number', 'direct_work', 'p_number', 
'end_date', 'time_planned', 'e_budget', 'acc_factor', 'acc_factor_d'), 
$coordinator);
                        $this->filter = 'employee';
                        $i=0;
                        foreach($projects as $key => $value)
@@ -1006,7 +1025,9 @@
                                                                                
                          'description' => $employee_hours[$k]['hours_descr'],
                                                                                
                          'statusout'   => $employee_hours[$k]['status'],
                                                                                
                          'minutes'     => $employee_hours[$k]['minutes'],
-                                                                               
                          'minutesout'  => 
$employee_hours[$k]['wh']['whours_formatted'].':'.$employee_hours[$k]['wh']['wmin_formatted'],
+                                                                               
                          'minutesout'  => $employee_hours[$k]['wh']['whwm'],
+                                                                               
                          't_minutes'     => 
$employee_hours[$k]['wh_t_journey']['wminutes'],
+                                                                               
                          't_minutesout'  => 
$employee_hours[$k]['wh_t_journey']['whwm'],
                                                                                
                          'date'        => 
$employee_hours[$k]['sdate_formatted']['date'],
                                                                                
                          'start'       => 
$employee_hours[$k]['sdate_formatted']['time'],
                                                                                
                          'end'         => 
$employee_hours[$k]['edate_formatted']['time']
@@ -1018,5 +1039,74 @@
                        }
                        return $matrix;
                }
+
+               function get_emp_worktimes($employee, $start, $end)
+               {
+                       $emp_worktimes = array();
+                       $result = $this->sohours->get_emp_worktimes($employee, 
$start, $end);
+                       if($result)
+                       {
+                               while($result->next_record())
+                               {
+                                       
$emp_worktimes[$result->f('project_id')] = array(
+                                               'sum_minutes_worktime' => 
intval($result->f('sum_minutes_worktime')),
+                                               'sum_minutes_journey'  => 
intval($result->f('sum_minutes_journey')),
+                                               'sum_minutes_all'      => 
intval($result->f('sum_minutes_all'))
+                                       );
+                               }
+                       }
+                       return $emp_worktimes;
+               }
+               
+               function get_emp_activities($project_id, $sdate, $edate, 
$account_id)
+               {
+               
+                       $params = array(
+                                       'project_id' => $project_id,
+                                       'filter' => 'employee',
+                                       'status' => 'all',
+                                       'limit' => false,
+                                       'order' => 'end_date',
+                                       'employee' => $account_id
+                               );
+
+                       $subs = $this->boprojects->get_sub_projects($params);
+                       $x = 0;
+                       
+                       for($i=0;$i<=(count($subs));$i++)
+                       {
+                               $values_hours = array(
+                                       'project_id' => $subs[$i]['project_id'],
+                                       'filter' => 'employee',
+                                       'action' => 'all',
+                                       'limit' => false,
+                                       'order' => 'end_date',
+                                       'employee' => $account_id
+                               );
+                               $hours[$i] = 
$this->sohours->read_hours($values_hours);
+                                                               
+                               for($j=0;$j<=(count($hours[$i]));$j++)
+                               {       
+                                       if(($hours[$i][$j]['sdate'] >= $sdate) 
&& ($hours[$i][$j]['edate'] <= $edate) && ($hours[$i][$j]['billable'] == 'Y'))
+                                       {
+                                               $values[$x] = array(
+                                                       'date'          => 
$hours[$i][$j]['sdate'], //date("d.m.Y", $hours[$i][$j]['sdate']),
+                                                       'begin'         => 
$hours[$i][$j]['sdate'], //date("H:i", $hours[$i][$j]['sdate']),
+                                                       'end'           => 
$hours[$i][$j]['edate'], //date("H:i", $hours[$i][$j]['edate']),
+                                                       'duration'      => 
$hours[$i][$j]['minutes'],
+                                                       'drivetime'     => 
$hours[$i][$j]['t_journey'],
+                                                       'distance'      => 
$hours[$i][$j]['km_distance'],
+                                                       'descr'         => 
$hours[$i][$j]['hours_descr'],
+                                                       'notes'         => 
$hours[$i][$j]['remark'],
+                                                       'surcharge' => 
$hours[$i][$j]['surcharge']);
+                                               $x++;
+                                       }
+                               }
+
+                       }
+                       $activities = 
$this->boprojects->array_natsort_list($values,'date');
+                       return $activities;
+
+               }
        }
 ?>

Index: inc/class.boprojects.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/class.boprojects.inc.php,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -b -r1.167 -r1.168
--- inc/class.boprojects.inc.php        28 Nov 2006 17:54:50 -0000      1.167
+++ inc/class.boprojects.inc.php        5 Dec 2006 19:40:45 -0000       1.168
@@ -3,10 +3,10 @@
        * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: class.boprojects.inc.php,v 1.167 2006/11/28 17:54:50 
sigurdne Exp $
+       * @version $Id: class.boprojects.inc.php,v 1.168 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/class.boprojects.inc.php,v $
        */
 
@@ -21,9 +21,7 @@
                var $cat_id;
                var $status;
                var $html_output;
-               var $bohours;
-               var $project_id;
-               var $limit;
+               var $check;
 
                var $public_functions = array
                (
@@ -47,7 +45,8 @@
                        'async_worktime_warnmail'                       => True,
                        'async_workhours_booking'                       => True,
                        'test_async_worktime_statusmail'        => True,
-                       'test_async_worktime_warnmail'          => True
+                       'test_async_worktime_warnmail'          => True,
+                       'test_async_workhours_booking'          => True
                );
 
                function boprojects($is_active=False, $action = '')
@@ -122,7 +121,7 @@
                                }
                                else
                                {
-                                       $this->project_id = false;
+                                       unset($this->project_id);
                                }
 
                                /*if($_project_id)
@@ -159,7 +158,6 @@
 
                function type($action)
                {
-                       $column ='';
                        switch ($action)
                        {
                                case 'mains'            : $column = 
'projects_mains'; break;
@@ -192,15 +190,15 @@
                        $column = $this->type($action);
                        $data = 
$GLOBALS['phpgw']->session->appsession('session_data',$column);
 
-                       $this->start            = 
(isset($data['start'])?$data['start']:'');
-                       $this->query            = 
(isset($data['query'])?$data['query']:'');
-                       $this->filter           = 
(isset($data['filter'])?$data['filter']:'');
-                       $this->order            = 
(isset($data['order'])?$data['order']:'');
-                       $this->sort                     = 
(isset($data['sort'])?$data['sort']:'');
-                       $this->cat_id           = 
(isset($data['cat_id'])?$data['cat_id']:'');
-                       $this->status           = 
(isset($data['status'])?$data['status']:'');
-                       $this->state            = 
(isset($data['state'])?$data['state']:'');
-                       $this->project_id       = 
(isset($data['project_id'])?$data['project_id']:'');
+                       $this->start            = (isset($data['start']) && 
$data['start']?$data['start']:'');
+                       $this->query            = (isset($data['query']) && 
$data['query']?$data['query']:'');
+                       $this->filter           = (isset($data['filter']) && 
$data['filter']?$data['filter']:'');
+                       $this->order            = (isset($data['order']) && 
$data['order']?$data['order']:'');
+                       $this->sort                     = 
(isset($data['sort'])&&$data['sort']?$data['sort']:'');
+                       $this->cat_id           = 
(isset($data['cat_id'])&&$data['cat_id']?$data['cat_id']:'');
+                       $this->status           = 
(isset($data['status'])&&$data['status']?$data['status']:'');
+                       $this->state            = 
(isset($data['state'])&&$data['state']?$data['state']:'');
+                       $this->project_id       = 
(isset($data['project_id'])&&$data['project_id']?$data['project_id']:'');
                }
 
                function check_perms($has, $needed)
@@ -218,16 +216,16 @@
                                default:                $acl = PHPGW_ACL_EDIT;
                        }
 
-                       if(isset($pro['project_id']) && $pro['project_id'] && 
!$pro['coordinator'])
+                       if($pro['project_id'] && !$pro['coordinator'])
                        {
                                $pro['coordinator']     = 
$this->soprojects->return_value('co',$pro['project_id']);
                        }
 
-                       if((isset($this->grants[$pro['coordinator']]) && 
$this->check_perms($this->grants[$pro['coordinator']],$acl)) || 
$pro['coordinator'] == $this->account)
+                       
if($this->check_perms($this->grants[$pro['coordinator']],$acl) || 
$pro['coordinator'] == $this->account)
                        {
                                return True;
                        }
-                       if($this->isprojectadmin())
+                       if($this->isprojectadmin('pad') || 
$this->isprojectadmin('pmanager'))
                        {
                                return True;
                        }
@@ -235,13 +233,13 @@
                        switch($pro['action'])
                        {
                                case 'subs':
-                                       if(isset($pro['main_co']) && 
$pro['main_co'])
+                                       if($pro['main_co'])
                                        {
                                                $main_co = $pro['main_co'];
                                        }
                                        else
                                        {
-                                               if(isset($pro['project_id']) && 
$pro['project_id'] && !$pro['main'])
+                                               if($pro['project_id'] && 
!$pro['main'])
                                                {
                                                        $pro['main'] = 
$this->soprojects->return_value('main',$pro['project_id']);
                                                }
@@ -302,27 +300,27 @@
                                        {
                                                return True;
                                        }
-                                       else if($this->isprojectadmin() && 
!is_array($cat))
+                                       else if($this->isprojectadmin('pad') || 
$this->isprojectadmin('pmanager') && !is_array($cat))
                                        {
                                                return True;
                                        }
                                        break;
                                case 'subs':
-                                       
if(isset($this->grants[$pro['coordinator']]) && 
($this->check_perms($this->grants[$pro['coordinator']],PHPGW_ACL_ADD) || 
$pro['coordinator'] == $this->account))
+                                       
if($this->check_perms($this->grants[$pro['coordinator']],PHPGW_ACL_ADD) || 
$pro['coordinator'] == $this->account)
                                        {
                                                return True;
                                        }
                                        //$main_co = 
$this->soprojects->return_value('co',$pro['main']);
-                                       if(isset($pro['main_co']) && 
($this->check_perms($this->grants[$pro['main_co']],PHPGW_ACL_ADD) || 
$pro['main_co'] == $this->account))
+                                       
if($this->check_perms($this->grants[$pro['main_co']],PHPGW_ACL_ADD) || 
$pro['main_co'] == $this->account)
                                        {
                                                return True;
                                        }
                                        $parent_co = 
$this->soprojects->return_value('co',$pro['parent']);
-                                       if(isset($this->grants[$parent_co]) && 
($this->check_perms($this->grants[$parent_co],PHPGW_ACL_ADD) || $parent_co == 
$this->account))
+                                       
if($this->check_perms($this->grants[$parent_co],PHPGW_ACL_ADD) || $parent_co == 
$this->account)
                                        {
                                                return True;
                                        }
-                                       if($this->isprojectadmin())
+                                       if($this->isprojectadmin('pad') || 
$this->isprojectadmin('pmanager'))
                                        {
                                                return True;
                                        }
@@ -409,38 +407,31 @@
                        }
                }
 
-               function read_projectsmembers_acl($project_id = False)
+               function read_projectsmembers_acl($project_id = false)
                {
                        $members = 
$this->soprojects->get_acl_project_members($project_id);
                        return $members;
                }
 
+               // a lot of work-arounds added - fips
                function get_acl_for_project($project_id = 0)
                {
-            /*if(intval($project_id) > 0)                                      
                                                                                
                       
-            {                                                                  
                                                                                
                     
-                return 
$GLOBALS['phpgw']->acl->get_ids_for_location($project_id, 7,'project_members'); 
                                                                                
               
-            }                                                                  
                                                                                
                     
-            return False; */
-
-
-                       while((!isset($empl) || !count($empl))>0 && $project_id)
+                       while(!count($empl) && $project_id)
                        {
                                $myproject = 
$this->soprojects->read_single_project($project_id);
 
                                $empl = 
$GLOBALS['phpgw']->acl->get_ids_for_location($project_id, 7, 'project_members');
-               //              if(!count($empl) || $empl[0] == '')
-                               if(!isset($empl) || !count($empl)>0 || $empl[0] 
== '')
+                               if(!count($empl) || $empl[0] == '')
                                {
                                        $empl = null;
                                        $project_id = $myproject['parent'];
                                }
                        }
-                       if(isset($empl) && count($empl)>0)
+                       if(count($empl))
                        {
                                return $empl;
                        }
-                       return False;
+                       return false;
                }
 
                function get_employee_projects($account_id = 0)
@@ -455,17 +446,11 @@
                function selected_employees($data = 0)
                {
                        $project_id = intval($data['project_id']);
-                       $pro_parent = 
(isset($data['pro_parent'])?intval($data['pro_parent']):'');
+                       $pro_parent = intval($data['pro_parent']);
 
-                       if(isset($data['action']) && $data['action'] == 'mains')
-                       {
-                               $emps = $this->read_projects_acl();
-                       }
-                       elseif(intval($project_id) > 0)
+                       if(intval($project_id) > 0)
                        {
                                $emps = $this->get_acl_for_project($project_id);
-
-                               //_debug_array($emps);
                        }
                        else
                        {
@@ -488,14 +473,14 @@
                                                }
                                        }
                                }
-                               if(isset($emp) && is_array($emp))
+                               if(is_array($emp))
                                {
                                        $emps = array();
                                        $emps = $emp;
                                }
                        }
 
-                       /*if($data['admins_included'] == True)
+                       if($data['admins_included'] == True)
                        {
                                $co = 
$this->soprojects->return_value('co',$project_id?$project_id:$pro_parent);
 
@@ -505,11 +490,13 @@
                                        $i = count($emps);
                                        $emps[$i] = $co;
                                }
-                               elseif(!is_array($emps))
-                               {
-                                       $emps[0] = $co;
+                               // BUG: doppelte Einträge für Projekt-Leiter
+                               // daher wurde nachfolgender Code 
auskommentieert
+                               //else
+                               //{
+                               //      $emps[0] = $co;
+                               //}
                                }
-                       }*/
                        //_debug_array($emps);
 
                        for($i=0;$i<count($emps);$i++)
@@ -520,7 +507,7 @@
                                //$this->accounts = 
CreateObject('phpgwapi.accounts',$emps[$i]);
                                //$this->accounts->read_repository();
 
-                               if(isset($data['roles_included']) && 
$data['roles_included'] == True)
+                               if($data['roles_included'] == True)
                                {
                                        $role_name = 
$this->soprojects->return_value('role',$project_id,$emps[$i]);
                                }
@@ -588,9 +575,6 @@
                function get_activity_budget($params)
                {
                        $subs = $this->get_sub_projects($params);
-                       $sum_budget = '';
-                       $sum_ptime = '';
-                       
                        if(is_array($subs))
                        {
                                $i = 0;
@@ -598,7 +582,7 @@
                                {
                                        $sub_pro[$i] = $sub['project_id'];
                                        $i++;
-                                       if(isset($sub['parent']) && 
$sub['parent'] == $params['project_id'])
+                                       if($sub['parent'] == 
$params['project_id'])
                                        {
                                                $sum_budget += $sub['budget'];
                                                $sum_ptime += 
$sub['time_planned'];
@@ -667,7 +651,7 @@
                        }
                        else
                        {
-                               if(!isset($params['billable']) || 
!$params['billable'])
+                               if(!$params['billable'])
                                {
                                        $params['billable'] = 
$this->return_value('billable',$params['project_id']);
                                }
@@ -692,7 +676,7 @@
 
                                                $sub_pro[$i] = 
$sub['project_id'];
                                                ++$i;
-                                               if(isset($sub['parent']) && 
$sub['parent'] == $params['project_id'])
+                                               if($sub['parent'] == 
$params['project_id'])
                                                {
                                                        $sum_budget += 
$sub['budget']+$sub['budget_childs'];
                                                        $sum_ptime += 
$sub['time_planned']+$sub['time_planned_childs'];
@@ -702,7 +686,7 @@
                                        $acc['is_leaf'] = ($i==1);
                                }
 
-                               if(isset($params['page']) && $params['page'] == 
'planned')
+                               if($params['page'] == 'planned')
                                {
                                        $acc['pbudget_jobs']    = $sum_budget;
                                        $ptimejobs                              
= $this->sohours->format_wh($sum_ptime);
@@ -774,8 +758,6 @@
 
                                $h_jobs_bill = 
$this->sohours->get_time_used(array('project_array' => $sub_pro_bill)); // 
project is billable
 
-                               $uhours_jobs_bill = 0;
-                               $uhours_jobs_nobill = 0;
                                if(is_array($h_jobs_bill))
                                {
                                        foreach($h_jobs_bill as $hjb)
@@ -795,7 +777,7 @@
                                        $uhours_jobs_bill = $uhours_jobs_nobill 
= 0;
                                }
 
-                               $h_jobs_nobill = 
(isset($sub_pro_nobill)?$this->sohours->get_time_used(array('project_array' => 
$sub_pro_nobill)):''); // project is not billable
+                               $h_jobs_nobill = 
$this->sohours->get_time_used(array('project_array' => $sub_pro_nobill)); // 
project is not billable
 
                                if(is_array($h_jobs_nobill))
                                {
@@ -829,7 +811,7 @@
                                $acc['nb_budget'] = 0;
                                $acc['u_budget'] = 0;
 
-                               if(isset($params['page']) && $params['page'] == 
'budget')
+                               if($params['page'] == 'budget')
                                {
                                        switch($params['accounting'])
                                        {
@@ -982,9 +964,6 @@
 
                function get_sub_projects($params)
                {
-                       $column = '';
-                       if(isset($params['page']) && $params['page'])
-                       {
                                switch($params['page'])
                                {
                                        case 'planned':                 $column 
= 'project_id,parent,level,budget,time_planned'; break;
@@ -992,14 +971,13 @@
 //                                     case 'budget':                  $column 
= 'project_id,accounting,acc_factor,billable,level'; break;
                                        case 'budget':                  $column 
= 'project_id,parent,accounting,acc_factor,billable,level,budget,time_planned'; 
break;
                                }
-                       }
                        $subs = $this->soprojects->read_projects(array('column' 
=> $column,'limit' => False,'action' => 'subs','parent' => 
$params['project_id']));
 
                        $i = count($subs);
                        $subs[$i]['project_id'] = $params['project_id'];
-                       $subs[$i]['accounting'] = 
(isset($params['accounting'])?$params['accounting']:'');
-                       $subs[$i]['billable'] = 
(isset($params['billable'])?$params['billable']:'');
-                       $subs[$i]['acc_factor'] = 
(isset($params['project_accounting_factor'])?$params['project_accounting_factor']:'');
+                       $subs[$i]['accounting'] = $params['accounting'];
+                       $subs[$i]['billable'] = $params['billable'];
+                       $subs[$i]['acc_factor'] = 
$params['project_accounting_factor'];
 
                        //_debug_array($subs);
                        return $subs;
@@ -1057,21 +1035,16 @@
 
                function list_projects($params)
                {
-                       $projects = false;
-                       if(isset($params['function']) && $params['function'] == 
'gantt')
+                       if($params['function'] == 'gantt')
                        {
                                $pro_list = 
$this->soprojects->read_gantt_projects(array('project_id' => 
$params['project_id'],'parent_array' => $params['parent_array']));
                        }
                        else
                        {
-                               if($this->order == 'coordinator' || 
$this->order == 'customer')
-                               {
-                                       $this->limit = false;
-                               }
                                $pro_list = 
$this->soprojects->read_projects(array
                                                                        (
                                                                                
'start'                 => $this->start,
-                                                                               
'limit'                 => $this->limit,
+                                       'limit'                 => 
isset($params['limit']) ? $params['limit'] : $this->limit,
                                                                                
'query'                 => $this->query,
                                                                                
'filter'                => $this->filter,
                                                                                
'sort'                  => $this->sort,
@@ -1079,9 +1052,9 @@
                                                                                
'status'                => $this->status,
                                                                                
'cat_id'                => ($params['action'] == 'mains'?$this->cat_id:0),
                                                                                
'action'                => $params['action'],
-                                                                               
'parent'                => (isset($params['parent'])?$params['parent']:''),
-                                                                               
'main'                  => (isset($params['main'])?$params['main']:''),
-                                                                               
'project_id'    => (isset($params['project_id'])?$params['project_id']:'')
+                                       'parent'                => 
$params['parent'],
+                                       'main'                  => 
$params['main'],
+                                       'project_id'    => $params['project_id']
                                                                        ));
                        }
 
@@ -1131,7 +1104,7 @@
                                                }
                                        }
 
-                                       if((isset($params['page']) && 
$params['page'] == 'budget') || (isset($params['page']) &&$params['page'] == 
'hours'))
+                                       if($params['page'] == 'budget' || 
$params['page'] == 'hours')
                                        {
                                                $params['project_id']           
                        = $pro['project_id'];
                                                $params['accounting']           
                        = $pro['accounting'];
@@ -1141,20 +1114,17 @@
                                                $acc = 
$this->get_budget($params);
                                        }
 
-                                       $ptime_pro = $pro['ptime'] - 
(isset($acc['ptime_jobs_min'])?$acc['ptime_jobs_min']:0);
-                                       $uhours_pro_wminutes = 
(isset($acc['uhours_pro_wminutes'])?$acc['uhours_pro_wminutes']:'');
+                                       $ptime_pro = $pro['ptime'] - 
$acc['ptime_jobs_min'];
+                                       $phours_pro = 
$this->colored($this->sohours->min2str($ptime_pro), $ptime_pro, 
$acc['uhours_pro_wminutes'], 'hours');
                                        
-                                       $phours_pro = 
$this->colored($this->sohours->min2str($ptime_pro), $ptime_pro, 
$uhours_pro_wminutes, 'hours');
+                                       $uhours_pro             = 
$this->colored($this->sohours->min2str($acc['uhours_pro_wminutes']), 
$ptime_pro, $acc['uhours_pro_wminutes'], 'hours');
                                        
-                                       $uhours_pro             = 
$this->colored($this->sohours->min2str($uhours_pro_wminutes), $ptime_pro, 
$uhours_pro_wminutes, 'hours');
+                                       $uhours_jobs    = 
$this->colored(str_replace(".", 
":",sprintf("%01.2f",$acc['uhours_jobs'])),$pro['ptime'],$acc['uhours_jobs_wminutes'],'hours');
 
-                                       $uhours_jobs    = 
$this->colored(str_replace(".", 
":",sprintf("%01.2f",(isset($acc['uhours_jobs'])?$acc['uhours_jobs']:''))),$pro['ptime'],(isset($acc['uhours_jobs_wminutes'])?$acc['uhours_jobs_wminutes']:''),'hours');
-
-                                       $ubudget_pro    = 
(isset($acc['u_budget'])?$acc['u_budget']:'');
-                                       $ubudget_jobs   = 
(isset($acc['u_budget_jobs'])?$acc['u_budget_jobs']:'');
+                                       $ubudget_pro    = $acc['u_budget'];
+                                       $ubudget_jobs   = $acc['u_budget_jobs'];
 
                                        $space = '';
-                                       $spaceset = '';
                                        if ($pro['level'] > 0 && 
!isset($params['no_formatted_level']))
                                        {
                                                $space = 
($this->html_output?'&nbsp;.&nbsp;':'.');
@@ -1168,7 +1138,10 @@
                                                'title'                         
=> $spaceset . $GLOBALS['phpgw']->strip_html($pro['title']),
                                                'number'                        
=> $GLOBALS['phpgw']->strip_html($pro['number']),
                                                'investment_nr'         => 
$GLOBALS['phpgw']->strip_html($pro['investment_nr']),
+                                               'coordinator'           => 
$pro['coordinator'],
                                                'coordinatorout'        => 
$GLOBALS['phpgw']->common->grab_owner_name($pro['coordinator']),
+                                               'salesmanager'          => 
$pro['salesmanager'],
+                                               'salesmanagerout'       => 
$GLOBALS['phpgw']->common->grab_owner_name($pro['salesmanager']),
                                                'customerout'           => 
$customerout,
                                                'customerorgout'                
=> $customerorgout,
                                                'customer_nr'           => 
$GLOBALS['phpgw']->strip_html($pro['customer_nr']),
@@ -1176,6 +1149,8 @@
                                                'edateout'                      
=> $this->formatted_edate($pro['edate']),
                                                'sdate'                         
=> $pro['sdate'],
                                                'edate'                         
=> $pro['edate'],
+                                               'psdate'     => $pro['psdate'],
+                                               'pedate'     => $pro['pedate'],
                                                'psdateout'                     
=> $this->formatted_edate($pro['psdate'],False),
                                                'pedateout'                     
=> $this->formatted_edate($pro['pedate'],False),
                                                'previousout'           => 
$this->return_value('pro',$pro['previous']),
@@ -1196,58 +1171,58 @@
                                                'mstones'                       
=> (isset($params['mstones_stat'])?$mstones:$mlist),
                                                'main'                          
=> $pro['main'],
                                                'parent'                        
=> $pro['parent'],
-                                               'coordinator'           => 
$pro['coordinator'],
                                                'previous'                      
=> $pro['previous'],
                                                'status'                        
=> $pro['status'],
                                                'level'                         
=> $pro['level'],
+                                               'cat'                           
        => $pro['cat'],
                                                'uhours_pro'            => 
$uhours_pro,      //$acc['uhours_pro']?$acc['uhours_pro']:'0:00',
-                                               'uhours_pro_nobill'     => 
(isset($acc['uhours_pro_nobill'])?$acc['uhours_pro_nobill']:'0:00'),
-                                               'uhours_pro_bill'       => 
(isset($acc['uhours_pro_bill'])?$acc['uhours_pro_bill']:'0:00'),
+                                               'uhours_pro_nobill'     => 
$acc['uhours_pro_nobill']?$acc['uhours_pro_nobill']:'0:00',
+                                               'uhours_pro_bill'       => 
$acc['uhours_pro_bill']?$acc['uhours_pro_bill']:'0:00',
                                                'uhours_jobs'           => 
$uhours_jobs,     //$acc['uhours_jobs']?$acc['uhours_jobs']:'0:00',
-                                               'uhours_jobs_nobill'=> 
(isset($acc['uhours_jobs_nobill'])?str_replace(".", 
":",sprintf("%01.2f",$acc['uhours_jobs_nobill'])):'0:00'),
-                                               'uhours_jobs_bill'      => 
(isset($acc['uhours_jobs_bill'])?str_replace(".", 
":",sprintf("%01.2f",$acc['uhours_jobs_bill'])):'0:00'),
-                                               'ahours_pro'            => 
(isset($ahours_pro)?$ahours_pro:''),
-                                               'ahours_jobs'           => 
(isset($ahours_jobs)?$ahours_jobs:''),
+                                               'uhours_jobs_nobill'=> 
$acc['uhours_jobs_nobill']?str_replace(".", 
":",sprintf("%01.2f",$acc['uhours_jobs_nobill'])):'0:00',
+                                               'uhours_jobs_bill'      => 
$acc['uhours_jobs_bill']?str_replace(".", 
":",sprintf("%01.2f",$acc['uhours_jobs_bill'])):'0:00',
+                                               'ahours_pro'            => 
$ahours_pro,
+                                               'ahours_jobs'           => 
$ahours_jobs,
                                                'u_budget'                      
=> $ubudget_pro,     //$acc['u_budget']?$acc['u_budget']:'0.00',
                                                'u_budget_jobs'         => 
$ubudget_jobs,    //$acc['u_budget_jobs']?$acc['u_budget_jobs']:'0.00',
-                                               'a_budget'                      
=> $pro['budget']-(isset($acc['u_budget'])?$acc['u_budget']:0),
-                                               'a_budget_jobs'         => 
$pro['budget']-(isset($acc['u_budget_jobs'])?$acc['u_budget_jobs']:0),
-                                               'b_budget'                      
=> (isset($acc['b_budget'])?$acc['b_budget']:'0.00'),
-                                               'b_budget_jobs'         => 
(isset($acc['b_budget_jobs'])?$acc['b_budget_jobs']:'0.00'),
+                                               'a_budget'                      
=> $pro['budget']-$acc['u_budget'],
+                                               'a_budget_jobs'         => 
$pro['budget']-$acc['u_budget_jobs'],
+                                               'b_budget'                      
=> $acc['b_budget']?$acc['b_budget']:'0.00',
+                                               'b_budget_jobs'         => 
$acc['b_budget_jobs']?$acc['b_budget_jobs']:'0.00',
                                                
                                                /* AS: new version values with 
a stricter naming scheme (others should be deprecated but may still be in use 
somewhere) */
-                                               'item_planned_time'     => 
$pro['ptime'] - (isset($acc['ptime_jobs_min'])?$acc['ptime_jobs_min']:0),
-                                               'item_used_time'        => 
(isset($acc['utime_item'])?$acc['utime_item']:''),
-                                               'item_bill_time'        => 
(isset($acc['utime_item_bill'])?$acc['utime_item_bill']:''),
-                                               'item_nobill_time'      => 
(isset($acc['utime_item_nobill'])?$acc['utime_item_nobill']:''),
-                                               'item_avail_time'       => 
(isset($acc['atime_item'])?$acc['atime_item']:''),
-                                               'sum_planned_time'      => 
(isset($pro['ptime'])?$pro['ptime']:''),
-                                               'sum_used_time'         => 
(isset($acc['utime_sum'])?$acc['utime_sum']:''),
-                                               'sum_bill_time'         => 
(isset($acc['utime_sum_bill'])?$acc['utime_sum_bill']:''),
-                                               'sum_nobill_time'       => 
(isset($acc['utime_sum_nobill'])?$acc['utime_sum_nobill']:''),
-                                               'sum_avail_time'        => 
(isset($acc['atime_sum'])?$acc['atime_sum']:''),
-                                               'is_leaf'                       
=> (isset($acc['is_leaf'])?$acc['is_leaf']:''),
+                                               'item_planned_time'     => 
$pro['ptime'] - $acc['ptime_jobs_min'],
+                                               'item_used_time'        => 
$acc['utime_item'],
+                                               'item_bill_time'        => 
$acc['utime_item_bill'],
+                                               'item_nobill_time'      => 
$acc['utime_item_nobill'],
+                                               'item_avail_time'       => 
$acc['atime_item'],
+                                               'sum_planned_time'      => 
$pro['ptime'],
+                                               'sum_used_time'         => 
$acc['utime_sum'],
+                                               'sum_bill_time'         => 
$acc['utime_sum_bill'],
+                                               'sum_nobill_time'       => 
$acc['utime_sum_nobill'],
+                                               'sum_avail_time'        => 
$acc['atime_sum'],
+                                               'is_leaf'                       
=> $acc['is_leaf'],
 
-                                               'item_planned_budget' => 
$pro['budget']-(isset($acc['pbudget_jobs'])?$acc['pbudget_jobs']:0),
+                                               'item_planned_budget' => 
$pro['budget']-$acc['pbudget_jobs'],
                                                'item_used_budget'    => 
$ubudget_pro,
-                                               'item_bill_budget'    => 
(isset($acc['b_budget'])?$acc['b_budget']:'0.00'),
-                                               'item_nobill_budget'    => 
(isset($acc['nb_budget'])?$acc['nb_budget']:'0.00'),
-                                               'item_avail_budget'   => 
$pro['budget']-(isset($acc['pbudget_jobs'])?$acc['pbudget_jobs']:0)-(isset($acc['u_budget'])?$acc['u_budget']:0),
+                                               'item_bill_budget'    => 
$acc['b_budget']?$acc['b_budget']:'0.00',
+                                               'item_nobill_budget'    => 
$acc['nb_budget']?$acc['nb_budget']:'0.00',
+                                               'item_avail_budget'   => 
$pro['budget']-$acc['pbudget_jobs']-$acc['u_budget'],
                                                'sum_planned_budget'  => 
$pro['budget'],
                                                'sum_used_budget'    => 
$ubudget_jobs,
-                                               'sum_bill_budget'    => 
(isset($acc['b_budget_jobs'])?$acc['b_budget_jobs']:'0.00'),
-                                               'sum_nobill_budget'    => 
(isset($acc['nb_budget_jobs'])?$acc['nb_budget_jobs']:'0.00'),
-                                               'sum_avail_budget'   => 
$pro['budget']-(isset($acc['u_budget_jobs'])?$acc['u_budget_jobs']:0),
+                                               'sum_bill_budget'    => 
$acc['b_budget_jobs']?$acc['b_budget_jobs']:'0.00',
+                                               'sum_nobill_budget'    => 
$acc['nb_budget_jobs']?$acc['nb_budget_jobs']:'0.00',
+                                               'sum_avail_budget'   => 
$pro['budget']-$acc['u_budget_jobs'],
 
 /*
 planned_subs=planned_sum-planned_item
 used_subs=used_sum-used_item
 */
-                                               'sum_time_status'       => 
$this->is_red($pro['ptime'], (isset($acc['utime_sum'])?$acc['utime_sum']:''), 
'time') ? 'red' : 
($this->is_red((isset($acc['ptime_jobs_min'])?$acc['ptime_jobs_min']:''), 
(isset($acc['utime_sum'])?$acc['utime_sum']:'')-(isset($acc['utime_item'])?$acc['utime_item']:0),
 'time') ? 'yellow':'green'),
-                                               'item_time_status'      => 
$this->is_red($pro['ptime'] - 
(isset($acc['ptime_jobs_min'])?$acc['ptime_jobs_min']:0), 
(isset($acc['utime_item'])?$acc['utime_item']:''), 'time') ? 'red' : 
($this->is_red((isset($acc['ptime_jobs_min'])?$acc['ptime_jobs_min']:''), 
(isset($acc['utime_sum'])?$acc['utime_sum']:'')-(isset($acc['utime_item'])?$acc['utime_item']:0),
 'time') ? 'yellow':'green'),
+                                               'sum_time_status'       => 
$this->is_red($pro['ptime'], $acc['utime_sum'], 'time') ? 'red' : 
($this->is_red($acc['ptime_jobs_min'], $acc['utime_sum']-$acc['utime_item'], 
'time') ? 'yellow':'green'),
+                                               'item_time_status'      => 
$this->is_red($pro['ptime'] - $acc['ptime_jobs_min'], $acc['utime_item'], 
'time') ? 'red' : ($this->is_red($acc['ptime_jobs_min'], 
$acc['utime_sum']-$acc['utime_item'], 'time') ? 'yellow':'green'),
                                                
-                                               'sum_budget_status'     => 
$this->is_red($pro['budget'], $ubudget_jobs, 'budget') ? 'red' : 
($this->is_red((isset($acc['pbudget_jobs'])?$acc['pbudget_jobs']:''), 
$ubudget_jobs-$ubudget_pro, 'budget') ? 'yellow':'green'),
-                                               'item_budget_status'=> 
$this->is_red($pro['budget']-(isset($acc['pbudget_jobs'])?$acc['pbudget_jobs']:0),
 $ubudget_pro, 'budget') ? 'red' : 
($this->is_red((isset($acc['pbudget_jobs'])?$acc['pbudget_jobs']:''), 
$ubudget_jobs-$ubudget_pro, 'budget') ? 'yellow':'green')
+                                               'sum_budget_status'     => 
$this->is_red($pro['budget'], $ubudget_jobs, 'budget') ? 'red' : 
($this->is_red($acc['pbudget_jobs'], $ubudget_jobs-$ubudget_pro, 'budget') ? 
'yellow':'green'),
+                                               'item_budget_status'=> 
$this->is_red($pro['budget']-$acc['pbudget_jobs'], $ubudget_pro, 'budget') ? 
'red' : ($this->is_red($acc['pbudget_jobs'], $ubudget_jobs-$ubudget_pro, 
'budget') ? 'yellow':'green')
                                        );
                                }
                        }
@@ -1285,25 +1260,18 @@
 
                function format_date($date = 0)
                {
+                       $d = array();
                        if($date > 0)
                        {
-                               $d = array
-                               (
-                                       'date'                          => 
$date + (60*60) * 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])?$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']:0),
-                                       'date_formatted'        => 
$GLOBALS['phpgw']->common->show_date($date,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
-                                       'day'                           => 
(isset($values['edate'])?date('d',$values['edate']):''),
-                                       'month'                         => 
(isset($values['edate'])?date('m',$values['edate']):''),
-                                       'year'                          => 
(isset($values['edate'])?date('Y',$values['edate']):'')
-                               );
-                               return $d;
+                               $d['date'] = $date + (60*60) * 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
+                               $d['date_formatted'] = 
$GLOBALS['phpgw']->common->show_date($date,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                        }
-                       return False;
+                       return $d;
                }
 
                function formatted_edate($edate = 0,$colored = True,$type = 
'project')
                {
                        $edate = intval($edate);
-                       $edateout = '';
 
                        $month  = 
$GLOBALS['phpgw']->common->show_date(time(),'n');
                        $day    = 
$GLOBALS['phpgw']->common->show_date(time(),'d');
@@ -1311,7 +1279,7 @@
 
                        if ($edate > 0)
                        {
-                               $edate = $edate + (60*60) * 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])?$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']:0);
+                               $edate = $edate + (60*60) * 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
                                $edateout = 
$GLOBALS['phpgw']->common->show_date($edate,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                        }
                        if($this->html_output && $colored)
@@ -1324,6 +1292,10 @@
 
                                $event_extra = 
$this->soconfig->get_event_extra($event);
 
+                               /*if 
(mktime(2,0,0,$month,$day+($event_extra*2),$year) >= $edate)
+                               {
+                                       $edateout = '<font color="ECC200"><b>' 
. $edateout . '</b></font>';
+                               }*/
                                if 
(mktime(12,0,0,$month,$day+$event_extra,$year) >= $edate)
                                {
                                        $edateout = '<font color="CC0000"><b>' 
. $edateout . '</b></font>';
@@ -1363,13 +1335,13 @@
                                $atime = 
$this->sohours->format_wh($pro['ptime']-$acc['ptime_jobs_min']);
                        }
 
-                       $uhours_pro             = 
$this->colored((isset($acc['uhours_pro'])?$acc['uhours_pro']:''),$pro['ptime'],(isset($acc['uhours_pro_wminutes'])?$acc['uhours_pro_wminutes']:''),'hours');
-                       $uhours_jobs    = 
$this->colored((isset($acc['uhours_jobs'])?$acc['uhours_jobs']:''),$pro['ptime'],(isset($acc['uhours_jobs_wminutes'])?$acc['uhours_jobs_wminutes']:''),'hours');
+                       $uhours_pro             = 
$this->colored($acc['uhours_pro'],$pro['ptime'],$acc['uhours_pro_wminutes'],'hours');
+                       $uhours_jobs    = 
$this->colored($acc['uhours_jobs'],$pro['ptime'],$acc['uhours_jobs_wminutes'],'hours');
 
-                       $ubudget_pro    = 
$this->colored((isset($acc['u_budget'])?$acc['u_budget']:''),$pro['budget'],(isset($acc['u_budget'])?$acc['u_budget']:''));
-                       $ubudget_jobs   = 
$this->colored((isset($acc['u_budget_jobs'])?$acc['u_budget_jobs']:''),$pro['budget'],(isset($acc['u_budget_jobs'])?$acc['u_budget_jobs']:''));
-                       $ubudget_pro    = 
(isset($acc['u_budget'])?$acc['u_budget']:'');
-                       $ubudget_jobs   = 
(isset($acc['u_budget_jobs'])?$acc['u_budget_jobs']:'');
+                       $ubudget_pro    = 
$this->colored($acc['u_budget'],$pro['budget'],$acc['u_budget']);
+                       $ubudget_jobs   = 
$this->colored($acc['u_budget_jobs'],$pro['budget'],$acc['u_budget_jobs']);
+                       $ubudget_pro    = $acc['u_budget'];
+                       $ubudget_jobs   = $acc['u_budget_jobs'];
 
                        $project = array
                        (
@@ -1389,8 +1361,8 @@
                                'e_budget_childs'               => 
$pro['e_budget_childs'],
                                'pbudget_jobs'          => 
$acc['pbudget_jobs']?$acc['pbudget_jobs']:'0.00',
                                'ap_budget_jobs'        => 
$pro['budget']-$acc['pbudget_jobs'],
-                               'a_budget'                      => 
$pro['budget']-(isset($acc['u_budget'])?$acc['u_budget']:0),
-                               'a_budget_jobs'         => 
$pro['budget']-(isset($acc['u_budget_jobs'])?$acc['u_budget_jobs']:0),
+                               'a_budget'                      => 
$pro['budget']-$acc['u_budget'],
+                               'a_budget_jobs'         => 
$pro['budget']-$acc['u_budget_jobs'],
                                'u_budget'                      => 
$ubudget_pro,       //$acc['u_budget']?$acc['u_budget']:'0.00',
                                'u_budget_jobs'         => $ubudget_jobs,      
//$acc['u_budget_jobs']?$acc['u_budget_jobs']:'0.00',
                                'project_id'            => $pro['project_id'],
@@ -1400,6 +1372,8 @@
                                'access'                        => 
$pro['access'],
                                'coordinator'           => $pro['coordinator'],
                                'coordinatorout'        => 
$GLOBALS['phpgw']->common->grab_owner_name($pro['coordinator']),
+                               'salesmanager' => $pro['salesmanager'],
+                               'salesmanagerout'       => 
$pro['salesmanager']?$GLOBALS['phpgw']->common->grab_owner_name($pro['salesmanager']):'',
                                'customer'                      => 
$pro['customer'],
                                'customer_org'                  => 
$pro['customer_org'],
                                'status'                        => 
$pro['status'],
@@ -1419,18 +1393,19 @@
                                'plan_bottom_up' => (($pro['plan_bottom_up'] == 
'Y')?'Y':'N'),
                                'direct_work'           =>  
(($pro['direct_work'] == 'Y')?'Y':'N'),
                                'uhours_pro'            => $uhours_pro,         
 //$acc['uhours_pro']?$acc['uhours_pro']:'0:00',
-                               'uhours_pro_nobill'     => 
(isset($acc['uhours_pro_nobill'])?$acc['uhours_pro_nobill']:'0:00'),
-                               'uhours_pro_bill'       => 
(isset($acc['uhours_pro_bill'])?$acc['uhours_pro_bill']:'0:00'),
+                               'uhours_pro_nobill'     => 
$acc['uhours_pro_nobill']?$acc['uhours_pro_nobill']:'0:00',
+                               'uhours_pro_bill'       => 
$acc['uhours_pro_bill']?$acc['uhours_pro_bill']:'0:00',
                                'uhours_jobs'           => $uhours_jobs,        
  //$acc['uhours_jobs']?$acc['uhours_jobs']:'0:00',
-                               'uhours_jobs_nobill'=> 
(isset($acc['uhours_jobs_nobill'])?$acc['uhours_jobs_nobill']:'0:00'),
-                               'uhours_jobs_bill'      => 
(isset($acc['uhours_jobs_bill'])?$acc['uhours_jobs_bill']:'0:00'),
-                               'uhours_jobs_wminutes'  => 
(isset($acc['uhours_jobs_wminutes'])?$acc['uhours_jobs_wminutes']:0),
-                               'ahours_pro'            => 
(isset($acc['ahours_pro'])?$acc['ahours_pro']:'0:00'),
-                               'ahours_jobs'           => 
(isset($acc['ahours_jobs'])?$acc['ahours_jobs']:'0:00'),
+                               'uhours_jobs_nobill'=> 
$acc['uhours_jobs_nobill']?$acc['uhours_jobs_nobill']:'0:00',
+                               'uhours_jobs_bill'      => 
$acc['uhours_jobs_bill']?$acc['uhours_jobs_bill']:'0:00',
+                               'uhours_jobs_wminutes'  => 
$acc['uhours_jobs_wminutes']?$acc['uhours_jobs_wminutes']:0,
+                               'ahours_pro'            => 
$acc['ahours_pro']?$acc['ahours_pro']:'0:00',
+                               'ahours_jobs'           => 
$acc['ahours_jobs']?$acc['ahours_jobs']:'0:00',
                                'priority'                      => 
$pro['priority'],
                                'inv_method'            => 
$GLOBALS['phpgw']->strip_html($pro['inv_method']),
                                'discount'                      => 
$pro['discount'],
-                               'discount_type'         => $pro['discount_type']
+                               'discount_type'         => 
$pro['discount_type'],
+                               'level'         => $pro['level']
                        );
 
                        $date = $this->format_date($pro['edate']);
@@ -1509,6 +1484,14 @@
 
                function check_values($action, $values)
                {
+                       $prefs = $this->read_prefs();
+
+                       if($values['psdate'] == '')
+                               $error[] = lang('please enter planned start 
date');
+                               
+                       if($values['pedate'] == '')
+                               $error[] = lang('please enter planned end 
date');
+
                        if (strlen($values['descr']) > 8000)
                        {
                                $error[] = lang('Description can not exceed 
8000 characters in length');
@@ -1521,25 +1504,70 @@
 
                        if (strlen(trim($values['title'])) == 0)
                        {
-                               $error[] = lang('Please enter a title');
+                               $error[] = lang('please enter a title');
                        }
                        else if(strlen($values['title']) > 250)
                        {
                                $error[] = lang('title can not exceed 250 
characters in length');
                        }
 
-                       if (!isset($values['choose']) || !$values['choose'])
+                       if (!$values['choose'])
+                       {
+                               $is_error = false;
+
+                               if(!$this->isprojectadmin('pad'))
+                               {
+                                       $this->check = 
CreateObject('projects.checker');
+
+                                       
if(!$this->check->checkProjectNr($values['number']))
+                                       {
+                                               $error[] = 
$this->check->getLastErrorMsg();
+                                               $is_error = true;
+                                       }
+                               }
+
+                               if(!$is_error && 
$this->siteconfig['permit_double_project_id'] == 'no')
+                               {
+                                       // check if a main project with the 
same projects number exists
+                                       if($action == 'subs')
                        {
-                               if (!isset($values['number']) || 
!$values['number'])
+                                               $main = 
$this->return_value('main',$values['parent']);
+                                       }
+                                       else
+                                       {
+                                               if(isset($values['project_id']) 
&& ($values['project_id']>0))
                                {
-                                       $error[] = lang('Please enter the 
project id');
+                                                       $main = 
$this->return_value('main',$values['project_id']);
                                }
                                else
                                {
-                                       if (strlen($values['number']) > 250)
+                                                       $main = 0;
+                                               }
+                                       }
+
+                                       $check_project_number = array(
+                                               'check'      => 
'main_project_number',
+                                               'column_val' => 
'"'.$values['number'].'"',
+                                               'project_id' => $main
+                                       );
+
+                                       if(!$this->isprojectadmin('pad'))
+                                       {
+                                               $project_number_exists = 
$this->exists($check_project_number);
+                                               if($project_number_exists)
                                        {
-                                               $error[] = lang('id can not 
exceed 250 characters in length');
+                                                       $error[] = 
lang('project id already exists');
+                                               }
+                                       }
                                        }
+
+                       }
+
+                       if($this->siteconfig['categorie_required'] == 'yes')
+                       {
+                               if(!$values['cat'])
+                               {
+                                       $error[] = lang('please select a 
categorie for the project');
                                }
                        }
 
@@ -1559,7 +1587,7 @@
                                }
                                else
                                {
-                                       if($values['accounting'] == 'project' 
&& ($values['project_accounting_factor'] == 0) && 
(!isset($values['project_accounting_factor_d']) || 
$values['project_accounting_factor_d'] == 0))
+                                       if($values['accounting'] == 'project' 
&& ($values['project_accounting_factor'] == 0) && 
($values['project_accounting_factor_d'] == 0))
                                        {
                                                $error[] = lang('please set the 
accounting factor for the project');
                                        }
@@ -1658,38 +1686,26 @@
                                        }
                                }
 
-                               $ptime_parent = $parent['ptime_min'];  
//$this->soprojects->return_value('ptime',$values['parent']);
-                               if($values['project_id'])
-                               {
-                                       $sum_ptime = 
$this->soprojects->get_planned_value(array('action' => 'tparent','parent_id' => 
$values['parent']
-                                                                               
                                ,'project_id' => $values['project_id']));
-
-                               }
-                               else
-                               {
-                                       $sum_ptime = 0;
-                               }
-                               
+                               // use given values for project and project 
child instead of extra sql queries
+                               $ptime_parent = 
$parent['ptime_min']-$parent['ptime_min_childs']+$project['ptime_min']; // 
+pro[] because this is the old project value that become free when saving the 
project data
                                $pminutes = intval($values['ptime'])*60;
-                               if (($pminutes+$sum_ptime) > $ptime_parent)
+                               if ($pminutes > $ptime_parent)
                                {
-                                       $error[] = lang('planned time sum of 
all sub projects is bigger than the planned time of the main project');
+                                       $error[] = lang('planned time is bigger 
than the planned time of the parent project').' 
('.intval($pminutes/60).':'.sprintf("%02d",intval($pminutes%60)).' > 
'.intval($ptime_parent/60).':'.sprintf("%02d",intval($ptime_parent%60)).')';
                                }
 
-                               $budget_parent = $parent['budget'];  
//$this->soprojects->return_value('budget',$values['parent']);
-                               $sum_budget    = 
$this->soprojects->get_planned_value(array('action' => 'bparent','parent_id' => 
$values['parent']
-                                                                               
                                                        ,'project_id' => 
$values['project_id']));
-                               if (($values['budget']+$sum_budget) > 
$budget_parent)
+                               // use given values for project and project 
child instead of extra sql queries
+                               $budget_parent = 
$parent['budget']-$parent['budget_childs']+$project['budget']; // +pro[] 
because this is the old project value that become free when saving the project 
data
+                               if ($values['budget'] > $budget_parent)
                                {
-                                       $error[] = lang('budget sum of all sub 
projects is bigger than the budget of the main project');
+                                       $error[] = lang('budget is bigger than 
the budget of the parent project').' ('.sprintf("%1.02f", (float) 
$values['budget']).' '.$prefs['currency'].' > '.sprintf("%1.02f", (float) 
$budget_parent).' '.$prefs['currency'].')';
                                }
 
-                               $ebudget_parent = $parent['e_budget'];  
//$this->soprojects->return_value('e_budget',$values['parent']);
-                               $sum_ebudget    = 
$this->soprojects->get_planned_value(array('action' => 'ebparent','parent_id' 
=> $values['parent']
-                                                                               
                                                        ,'project_id' => 
$values['project_id']));
-                               if (($values['e_budget']+$sum_ebudget) > 
$ebudget_parent)
+                               // use given values for project and project 
child instead of extra sql queries
+                               $ebudget_parent = 
$parent['e_budget']-$parent['e_budget_childs']+$project['e_budget']; // +pro[] 
because this is the old project value that become free when saving the project 
data
+                               if ($values['e_budget'] > $ebudget_parent)
                                {
-                                       $error[] = lang('extra budget sum of 
all sub projects is bigger than the extra budget of the main project');
+                                       $error[] = lang('extra budget is bigger 
than the extra budget of the parent project').' ('.sprintf("%1.02f", (float) 
$values['e_budget']).' '.$prefs['currency'].' > '.sprintf("%1.02f", (float) 
$ebudget_parent).' '.$prefs['currency'].')';
                                }
                        }
 
@@ -1733,70 +1749,75 @@
                                        $edate = $subData['edate'];
                                if(isset($subData['pedate']) && 
($subData['pedate'] > $pedate))
                                        $pedate = $subData['pedate'];
-                               $ptime    += 
(isset($subData['ptime'])?$subData['ptime']:0);
-                               $budget   += 
(isset($subData['budget'])?$subData['budget']:0);
-                               $e_budget += 
(isset($subData['e_budget'])?$subData['e_budget']:0);
+                               $ptime    += $subData['ptime'];
+                               $budget   += $subData['budget'];
+                               $e_budget += $subData['e_budget'];
                        }
 
-                       if((isset($values['smonth']) && $values['smonth'])
-                               || (isset($values['sday']) && $values['sday'])
-                               || (isset($values['syear']) && 
$values['syear']))
+                       if($values['sdate'])
                        {
-                               if($sdate < 
mktime(12,0,0,$values['smonth'],$values['sday'],$values['syear']))
+                               if($sdate < $values['sdate'])
                                {
                                        $error[] = lang('start date can not be 
after sub projects start date');
                                }
                        }
                        
-                       if((isset($values['psmonth']) && $values['psmonth'])
-                               || (isset($values['psday']) && $values['psday'])
-                               || (isset($values['psyear']) && 
$values['psyear']))
+                       if($values['psdate'])
                        {
-                               if($psdate < 
mktime(12,0,0,$values['psmonth'],$values['psday'],$values['psyear']))
+                               if($psdate < $values['psdate'])
                                {
                                        $error[] = lang('planned start date can 
not be after sub projects planned start date');
                                }
                        }
 
-                       if((isset($values['emonth']) && $values['emonth'])
-                               || (isset($values['eday']) && $values['eday'])
-                               || (isset($values['eyear']) && 
$values['eyear']))
+                       if($values['edate'])
                        {
-                               if($edate > 
mktime(12,0,0,$values['emonth'],$values['eday'],$values['eyear']))
+                               if($edate > $values['edate'])
                                {
                                        $error[] = lang('end date can not be 
before sub projects end date');
                                }
                        }
                        
-                       if((isset($values['pemonth']) && $values['pemonth'])
-                               || (isset($values['peday']) && $values['peday'])
-                               || (isset($values['peyear']) && 
$values['peyear']))
+                       if($values['pedate'])
                        {
-                               if($pedate > 
mktime(12,0,0,$values['pemonth'],$values['peday'],$values['peyear']))
+                               if($pedate > $values['pedate'])
                                {
                                        $error[] = lang('planned end date can 
not be before sub projects planned end date');
                                }
                        }
 
-                       if(isset($values['plan_bottom_up']) && 
$values['plan_bottom_up'] == 'N')
+                       if($values['plan_bottom_up'] == 'N')
                        {
-                               if($ptime > (intval($values['ptime'])*60))
+                               $value_ptime_min = intval($values['ptime'])*60;
+                               if($value_ptime_min<0)
                                {
-                                       $error[] = lang('planned time can not 
be lesser then planned time sum of all sub projects');
+                                       $error[] = lang('planned time can not 
be lesser then 0');
+                               }
+                               elseif($ptime > $value_ptime_min)
+                               {
+                                       $error[] = lang('planned time can not 
be lesser then planned time sum of all sub projects').' 
('.intval($value_ptime_min/60).':'.sprintf("%02d",intval($value_ptime_min%60)).'
 < '.intval($ptime/60).':'.sprintf("%02d",intval($ptime%60)).')';
                                }
                                
-                               if($budget > $values['budget'])
+                               if($values['budget']<0)
+                               {
+                                       $error[] = lang('budget can not be 
lesser then 0');
+                               }
+                               elseif($budget > $values['budget'])
                                {
-                                       $error[] = lang('budget can not be 
lesser then budget sum of all sub projects');
+                                       $error[] = lang('budget can not be 
lesser then budget sum of all sub projects').' ('.$values['budget'].' 
'.$prefs['currency'].' < '.$budget.' '.$prefs['currency'].')';
                                }
                                
-                               if($e_budget > $values['e_budget'])
+                               if($values['e_budget']<0)
                                {
-                                       $error[] = lang('extra budget can not 
be lesser then extra budget sum of all sub projects');
+                                       $error[] = lang('extra budget can not 
be lesser then 0');
+                               }
+                               elseif($e_budget > $values['e_budget'])
+                               {
+                                       $error[] = lang('extra budget can not 
be lesser then extra budget sum of all sub projects').' 
('.$values['e_budget'].' '.$prefs['currency'].' < '.$e_budget.' 
'.$prefs['currency'].')';
                                }
                        }
 
-                       if (isset($error) && is_array($error))
+                       if (is_array($error))
                        {
                                return $error;
                        }
@@ -1804,7 +1825,7 @@
 
                function save_project($action, $values)
                {
-                       if (isset($values['choose']) && $values['choose'])
+                       if ($values['choose'])
                        {
                                switch($action)
                                {
@@ -1825,7 +1846,7 @@
                        $values['sdate'] = intval($values['sdate']);
                        $values['edate'] = intval($values['edate']);
 
-                       if (!$values['previous'] && isset($values['parent']) && 
$values['parent'])
+                       if (!$values['previous'] && $values['parent'])
                        {
                                $values['previous'] = 
$this->return_value('previous',$values['parent']);
                        }
@@ -1833,32 +1854,6 @@
                        $values['ptime']  = intval($values['ptime']);
                        $values['budget'] = round($values['budget'], 2);
 
-                       if (isset($values['accounting']) && 
$values['accounting'] == 'project')
-                       {
-                               if ($values['project_accounting_factor'] || 
$values['project_accounting_factor_d'])
-                               {
-                                       switch($values['radio_acc_factor'])
-                                       {
-                                               case 'day':             
$values['project_accounting_factor']    = 
$values['project_accounting_factor_d']/$this->siteconfig['hwday']; break;
-                                               default:                
$values['project_accounting_factor_d']  = 
$values['project_accounting_factor']*$this->siteconfig['hwday']; break;
-                                       }
-
-                                       if(($values['budgetradio'] == 'm') && 
($values['project_accounting_factor'] > 0))
-                                       {                       
-                                                       $values['ptime'] = 
intval($values['budget'] / $values['project_accounting_factor']);
-                                       }
-                                       elseif($values['budgetradio'] == 'h')
-                                       {
-                                               $values['budget'] = 
$values['ptime'] * $values['project_accounting_factor'];
-                                       }
-                                       else
-                                       {
-                                               $values['ptime'] = 0;
-                                               $values['budget'] = 0.0;
-                                       }
-                               }
-                       }
-
                        $values['ptime'] = $values['ptime'] * 60;
 
                        //echo 'start boprojects: save_project ->';
@@ -1888,6 +1883,11 @@
                                $values['discount'] = 0.0;
                        }
 
+                       if (!isset($values['salesmanager']))
+                       {
+                               $values['salesmanager'] = 0;
+                       }
+
                        $values['project_name'] = $values['title'] . ' [' . 
$values['number'] . ']'; 
                        if (intval($values['project_id']) > 0)
                        {
@@ -1928,10 +1928,9 @@
 
                                $this->send_alarm(array('project_name' => 
$values['project_name'],'event_type' => 'changes of project data','project_id' 
=> $values['project_id']));
 
-                               $values['old_coordinator'] = 
(isset($values['old_coordinator'])?$values['old_coordinator']:'');
                                if($values['coordinator'] != 
$values['old_coordinator'])
                                {
-                                       $this->send_alarm(array('account_id' => 
$values['coordinator'],'events' => 
array((isset($event_id)?$event_id:'')),'project_name' => 
$values['project_name'],
+                                       $this->send_alarm(array('account_id' => 
$values['coordinator'],'events' => array($event_id),'project_name' => 
$values['project_name'],
                                                                                
        'event_type' => 'assignment to role','project_id' => 
$values['project_id']));
                                }
                        }
@@ -1945,7 +1944,7 @@
 
                                $values['project_id'] = 
$this->soprojects->add_project($values);
 
-                               // if parent isset its a new sub project else 
its a new main project
+                               // if parent isset we its a new sub project 
else its a new main project
                                if(isset($values['parent']) && 
($values['parent']>0))
                                { // for a new subproject update the parent 
project
                                        // calc new_value - old_value (old 
values doesnt exists!)
@@ -1960,12 +1959,12 @@
 
                        $values['project_id'] = intval($values['project_id']);
 
-                       $values['old_edate'] = 
(isset($values['old_edate'])?intval($values['old_edate']):0);
+                       $values['old_edate'] = intval($values['old_edate']);
                        $async = CreateObject('phpgwapi.asyncservice');
                        if($values['edate'] > 0 && $values['old_edate'] != 
$values['edate'])
                        {
                                $event_extra = 
$this->soconfig->get_event_extra('project date due');
-                               $next = 
mktime(date('H',time()),date('i',time())+5,0,(isset($values['emonth'])?$values['emonth']:0),(isset($values['eday'])?$values['eday']:0)-$event_extra,(isset($values['eyear'])?$values['eyear']:0));
+                               $next = 
mktime(date('H',time()),date('i',time())+5,0,$values['emonth'],$values['eday']-$event_extra,$values['eyear']);
 
                                $edate = $this->format_date($values['edate']);
                                $async->write(array('id' => 'projects-' . 
$values['project_id'], 'next' => $next,'times' => array('year' => 
date('Y',$next),
@@ -2005,6 +2004,7 @@
                                // update direct work setting for all jobs of 
this project
                                
$this->direct_work_set_job_setting($values['project_id'], 
$values['direct_work']);
                        }
+
                        return $values['project_id'];
                }
 
@@ -2093,19 +2093,19 @@
                                {
                                        if ($values['edate'] > $pro_edate)
                                        {
-                                               $error[] = lang('milestone date 
due can not be after projects end date');
+                                               $error[] = lang('milestone date 
can not be after projects date due');
                                        }
                                }
                                if ($pro_sdate > 0)
                                {
                                        if ($values['edate'] < $pro_sdate)
                                        {
-                                               $error[] = lang('milestone date 
due can not be before projects start date');
+                                               $error[] = lang('milestone date 
can not be before projects date due');
                                        }
                                }
                        }
 
-                       if(isset($error) && is_array($error))
+                       if(is_array($error))
                        {
                                return $error;
                        }
@@ -2117,9 +2117,13 @@
 
                function save_mstone($values)
                {
+                       if ($values['emonth'] || $values['eday'] || 
$values['eyear'])
+                       {
+                               $values['edate'] = 
mktime(12,0,0,$values['emonth'],$values['eday'],$values['eyear']);
+                       }
                        $values['edate'] = intval($values['edate']);
 
-                       if (isset($values['s_id']) && intval($values['s_id']) > 
0)
+                       if (intval($values['s_id']) > 0)
                        {
                                $this->soprojects->edit_mstone($values);
                        }
@@ -2129,24 +2133,27 @@
                        }
 
                        $values['old_edate'] = intval($values['old_edate']);
+                       $async = CreateObject('phpgwapi.asyncservice');
                        if($values['edate'] > 0 && $values['old_edate'] != 
$values['edate'])
                        {
-                               $async = CreateObject('phpgwapi.asyncservice');
                                $co = 
$this->soprojects->return_value('co',$values['project_id']);
                                $event_extra = 
$this->soconfig->get_event_extra('milestone date due');
+                               $next = 
mktime(date('H',time()),date('i',time())+5,0,$values['emonth'],$values['eday']-$event_extra,$values['eyear']);
 
                                $edate = $this->format_date($values['edate']);
-
-                               $next = 
mktime(date('H',time()),date('i',time())+5,0,$edate['month'],$edate['day']-$event_extra,$edate['year']);
-
                                $async->write(array('id' => 'ms-' . 
$values['s_id'] . '-project-' . $values['project_id'], 'next' => $next,'times' 
=> array('year' => date('Y',$next),
                                                                        'month' 
=> date('m',$next),'day' => date('d',$next),'hour' => date('H',$next),'min' => 
date('i',$next))
                                                                        
,'account_id' => $co,'method' => 'projects.boprojects.send_alarm',
                                                                        'data' 
=> array('project_id' => $values['project_id'],'event_type' => 'milestone date 
due',
                                                                        'edate' 
=> $edate['date_formatted'],'ms_title' => $values['title'])));
-
-                               unset($async);
                        }
+                       if($values['edate'] == 0)
+                       {
+                               $aid = 'ms-' . $values['s_id'] . '-project-' . 
$values['project_id'];
+                               $async->delete($aid);
+                       }
+                       unset($async);
+
                        return $values['s_id'];
                }
 
@@ -2188,7 +2195,7 @@
 
                        $notify_hours   = 
$this->soprojects->check_alarm($values['project_id'],'hours');
                        $notify_budget  = 
$this->soprojects->check_alarm($values['project_id'],'budget');
-                       $returncode = '';
+
                        for($k=0;$k<count($emp_events);$k++)
                        {
                                
for($i=0;$i<count($emp_events[$k]['events']);$i++)
@@ -2422,7 +2429,7 @@
                        return $activities_list;
                }
 
-               function isprojectadmin($action = 'project_admin')
+               function isprojectadmin($action = 'pad')
                {
                        return 
$this->soprojects->soconfig->isprojectadmin($action);
                }
@@ -2448,24 +2455,23 @@
                                $prefs['cscolumns'] = array('title');
                        }
                        
-                       if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['projects']['mailTypeEntries']))
+                       if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['projects']['send_status_mail']))
                        {
-                               $prefs['mailTypeEntries'] = 
explode(',',$GLOBALS['phpgw_info']['user']['preferences']['projects']['mailTypeEntries']);
+                               $prefs['send_status_mail'] = (bool) 
($GLOBALS['phpgw_info']['user']['preferences']['projects']['send_status_mail']);
                        }
                        else if($default)
                        {
-                               $prefs['mailTypeEntries'] = array('');
+                               $prefs['send_status_mail'] = true;
                        }
 
                        $prefs['currency'] = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'];
-                       $prefs['mainscreen_showevents'] = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['projects']['mainscreen_showevents'])?$GLOBALS['phpgw_info']['user']['preferences']['projects']['mainscreen_showevents']:'');
+                       $prefs['mainscreen_showevents'] = 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['mainscreen_showevents'];
 
                        return $prefs;
                }
 
                function check_prefs()
                {
-                       $error = false;
                        $prefs = $this->read_prefs(False);
 
                        if (! isset($prefs['currency']))
@@ -2558,7 +2564,7 @@
                                        $send_role = True;
                                }
 
-                               if(isset($send_role) && $send_role)
+                               if($send_role)
                                {
                                        $values['event_type'] = 'assignment to 
role';
                                        $this->send_alarm($values);
@@ -2666,9 +2672,8 @@
                        $id             = $action . '_id';
                        $name   = $action . '_name';
 
-                       if(isset($list) && is_array($list))
+                       if(is_array($list))
                        {
-                               $list_list ='';
                                foreach($list as $li)
                                {
                                        $list_list .= '<option value="' . 
$li[$id] . '"';
@@ -2740,6 +2745,7 @@
 
                        if(is_array($projects))
                        {
+                               usort($projects, array('boprojects', 
'cmp_projects_folders_content'));
                                foreach($projects as $pro)
                                {
                                        if($pro['project_id'] == 
$active_project_id)
@@ -2771,10 +2777,14 @@
                                );
                        }
                        
-                       ksort($return);
                        return array('content' => $return);
                }
 
+               function cmp_projects_folders_content($a, $b) 
+               {
+                       return strcasecmp($a['title'], $b['title']);
+               }
+
                /**
                * Update a project plan bottom up setting in sub projects.
                * @param integer $main_project_id main project to update the 
plan bottom up setting
@@ -2784,7 +2794,9 @@
                function plan_bottom_up_set_job_setting($main_project_id, 
$plan_bottom_up)
                {
                        if($plan_bottom_up != 'Y')
+                       {
                                $plan_bottom_up = 'N';
+                       }
 
                        
$this->soprojects->plan_bottom_up_set_job_setting($main_project_id, 
$plan_bottom_up);
                }
@@ -2842,13 +2854,47 @@
                                $pro['e_budget'] = $pro['e_budget'] + 
$update_values['e_budget'];
                        }
 
-                       // bottom up: update accounting factor if factor 
project is active
-                       if(($pro['plan_bottom_up'] == 'Y') && 
($pro['accounting'] == 'project'))
+                       // 4. bottom up: update accounting factor if factor 
project is active
+                       if(($pro['plan_bottom_up'] == 'Y') && 
($pro['accounting'] == 'project') && (intval($pro['ptime']) > 0))
                        {
                                $pro['project_accounting_factor']   = 
$pro['budget']/intval($pro['ptime']/60);
                                $pro['project_accounting_factor_d'] = 
$pro['project_accounting_factor']*$this->siteconfig['hwday'];
                        }
 
+                       // 5. bottom up: update (p)sdate (p)edate
+                       if($pro['plan_bottom_up'] == 'Y')
+                       {
+                               $time     = time();
+                               $sdate    = $time;  // start date
+                               $psdate   = $time;  // planed start date
+                               $edate    = $time;  // end date
+                               $pedate   = $time;  // planed end date
+
+                               // get sub projects
+                               $subs = 
$this->get_sub_projects(array('project_id' => $project_id));
+
+                               // for each sub project calculate calculate 
budget and planned time
+                               while(list($subNum, $subData) = each($subs))
+                               {
+                                       // get planned dates (earliest start 
and latest end date)
+                                       // and sum of workhours and budget
+                                       if(isset($subData['sdate']) && 
($subData['sdate'] < $sdate))
+                                               $sdate = $subData['sdate'];
+                                       if(isset($subData['psdate']) && 
($subData['psdate'] < $psdate))
+                                               $psdate = $subData['psdate'];
+                                       if(isset($subData['edate']) && 
($subData['edate'] > $edate))
+                                               $edate = $subData['edate'];
+                                       if(isset($subData['pedate']) && 
($subData['pedate'] > $pedate))
+                                               $pedate = $subData['pedate'];
+                               }
+
+                               // update values
+                               $pro['sdate']  = ($sdate  != $time) ? $sdate  : 
$pro['sdate'];
+                               $pro['psdate'] = ($psdate != $time) ? $psdate : 
$pro['psdate'];
+                               $pro['edate']  = ($edate  != $time) ? $edate  : 
$pro['edate'];
+                               $pro['pedate'] = ($pedate != $time) ? $pedate : 
$pro['$pedate'];
+                       }
+
                        // save project
                        $this->soprojects->edit_project($pro);
 
@@ -2886,12 +2932,11 @@
                {
                        set_time_limit(0);
 
-                       if(($data == false) || !is_array($data) ||
+                       if( !$data || !is_array($data) ||
                           !isset($data['book_type']) || 
!isset($data['book_month']) || !isset($data['book_year'])
                          )
                                return false;
 
-
                        $book_type = $data['book_type'];
                        if($book_type == 0)
                                return false;
@@ -2903,6 +2948,8 @@
                        $book_month_days = cal_days_in_month(CAL_GREGORIAN, 
$book_month, $book_year);
                        $book_end = 
mktime(23,59,59,$book_month,$book_month_days,$book_year);
 
+                       //echo date('Y-m-d H:i:s', $book_start). ' - 
'.date('Y-m-d H:i:s', $book_end).'<br>';
+
                        // call booking method
                        $book_values = array(
                                'sdate' =>      $book_start,
@@ -2912,57 +2959,59 @@
                        // calculate next booking date
                        $holidays = CreateObject('phpgwapi.calendar_holidays');
                        $sbox = CreateObject('phpgwapi.sbox');
-                       $country = 
ucfirst($GLOBALS['phpgw']->translation->retranslate($sbox->country_array[$GLOBALS['phpgw']->preferences->data['common']['country']]));
+//                     $country = 
ucfirst($GLOBALS['phpgw']->translation->retranslate($sbox->country_array[$GLOBALS['phpgw']->preferences->data['common']['country']]));
+                       $country = 
ucfirst(lang($sbox->country_array[$GLOBALS['phpgw']->preferences->data['common']['country']]));
                        $federal_state = 
$holidays->federal_states[$country][$GLOBALS['phpgw']->preferences->data['common']['federalstate']];
 // Achtung: bisher existiert nur germany!
                        $religion = 
$holidays->religions[$GLOBALS['phpgw']->preferences->data['common']['religion']];
 
+                       // calc next booking month and year
                        if($book_month == 12)
                        {
-                               $next_m = 1;
-                               $next_y = $book_year + 1;
+                               $next_book_month = 1;
+                               $next_book_year  = $book_year + 1;
                        }
                        else
                        {
-                               $next_m = $book_month + 1;
-                               $next_y = $book_year;
+                               $next_book_month = $book_month + 1;
+                               $next_book_year  = $book_year;
+                       }
+
+                       // calc next async date for run booking
+                       if($next_book_month == 12)
+                       {
+                               $next_async_month = 1;
+                               $next_async_year  = $next_book_year + 1;
+                       }
+                       else
+                       {
+                               $next_async_month = $next_book_month + 1;
+                               $next_async_year  = $next_book_year;
                        }
 
                        $workdays = $book_type;
-                       $new_days = 
$holidays->add_number_of_workdays(1,$next_m,$next_y,$workdays,$country,$federal_state,$religion);
+                       //echo 
'<br>add_number_of_workdays(1,'.$next_async_month.','.$next_async_year.','.$workdays.','.$country.','.$federal_state.','.$religion.',&$new_d,&$new_m,&$new_y)<br>';
+
+                       $new_days = 
$holidays->add_number_of_workdays(1,$next_async_month,$next_async_year,$workdays,$country,$federal_state,$religion);
                        $new_d = $new_days['newday'];
                        $new_m = $new_days['newmonth'];
                        $new_y = $new_days['newyear'];
                        unset($new_days);
                        
                        $ts_book = mktime(0,0,0,$new_m,$new_d,$new_y)-1;
-
-                       // calc book month
-                       $book_run_m = date('n', $ts_book);
-                       $book_run_y = date('Y', $ts_book);
-                       if($book_run_m == 1)
-                       {
-                               // book december last year
-                               $book_for_month = 12;
-                               $book_for_year  = $book_run_y - 1;
-                       }
-                       else
-                       {
-                               $book_for_month = $book_run_m - 1;
-                               $book_for_year  = $book_run_y;
-                       }
+                       //echo date('Y-m-d H:i:s', $ts_book).'<br>';
                        
                        $async = CreateObject('phpgwapi.asyncservice');
                        $aid = 'projects-workhours-booking-';
                        $async_data = array(
-                               'id' => $aid.$book_for_year.'-'.$book_for_month,
+                               'id' => 
$aid.$next_book_year.'-'.$next_book_month,
                                'next' => $ts_book,
                                'times' => $ts_book,
                                'account_id' => 
$GLOBALS['phpgw_info']['user']['account_id'],
                                'method' => 
'projects.boprojects.async_workhours_booking',
                                'data' => array(
                                        'book_type'  => $book_type,
-                                       'book_year'  => $book_for_year,
-                                       'book_month' => $book_for_month
+                                       'book_year'  => $next_book_year,
+                                       'book_month' => $next_book_month
                                )
                        );
 
@@ -3002,8 +3051,8 @@
                                        $prefs = 
CreateObject('phpgwapi.preferences', $employee_id);
                                        $prefs->read_repository();
 
-                                       if( 
(isset($prefs->data['projects']['mailTypeEntries'])) &&
-                                           
($prefs->data['projects']['mailTypeEntries'] == 'off'))
+                                       if( 
(isset($prefs->data['projects']['send_status_mail'])) &&
+                                           
($prefs->data['projects']['send_status_mail'] == false))
                                        {
                                                continue;
                                        }
@@ -3227,7 +3276,8 @@
                                        $pref_religion = 0; // Atheistisch
                                }
 
-                               $country = 
ucfirst($GLOBALS['phpgw']->translation->retranslate($sbox->country_array[$pref_country]));
+//                             $country = 
ucfirst($GLOBALS['phpgw']->translation->retranslate($sbox->country_array[$pref_country]));
+                               $country = 
ucfirst(lang($sbox->country_array[$pref_country]));
                                $federal_state = 
$holidays->federal_states[$country][$pref_f_state]; // Achtung: bisher 
existiert nur germany!
                                $religion = 
$holidays->religions[$pref_religion];
 
@@ -3255,7 +3305,6 @@
                                
                                // get employee booked workhours
                                $worktimes = 
$this->get_emp_worktimes($employee_id, $sdate, $edate);
-
                                if(!$worktimes || 
!(count($worktimes['projects']) > 0) || ($worktimes['sum_minutes_all']==0))
                                {
                                        continue;
@@ -3320,9 +3369,16 @@
 
                                $to = $employee_email;
                                $subject = 
$GLOBALS['phpgw']->send->encode_subject($subject);
-                               $bcc = 'address@hidden,address@hidden';
                                
-                               $returncode  = 
$GLOBALS['phpgw']->send->msg('email',$to,$subject,$body,'','',$bcc,'',$sender);
+                               $boconfig       = 
CreateObject('projects.boconfig');
+                               
+                               $values['action'] = 'get';
+                               $warnmail = 
$boconfig->config_worktime_warnmail($values);
+                                                               
+                               $cc = $warnmail['warnmail_email_address'];
+                               $bcc = '';
+
+                               $returncode  = 
$GLOBALS['phpgw']->send->msg('email',$to,$subject,$body,'',$cc,$bcc,'',$sender);
                                if (!$returncode)       // not nice, but better 
than failing silently
                                {
                                        error_log('fail to send warn mail 
('.$employee_id.' - '.$employee_email.') for '.$fullname);
@@ -3379,7 +3435,8 @@
                        /* no use until need or KH fix add_number_of_workdays_
                        $holidays = CreateObject('phpgwapi.calendar_holidays');
                        $sbox = createobject('phpgwapi.sbox');
-                       $country = 
ucfirst($GLOBALS['phpgw']->translation->retranslate($sbox->country_array[$GLOBALS['phpgw']->preferences->data['common']['country']]));
+//                     $country = 
ucfirst($GLOBALS['phpgw']->translation->retranslate($sbox->country_array[$GLOBALS['phpgw']->preferences->data['common']['country']]));
+                       $country = 
ucfirst(lang($sbox->country_array[$GLOBALS['phpgw']->preferences->data['common']['country']]));
                        $federal_state = 
$holidays->federal_states[$country][$GLOBALS['phpgw']->preferences->data['common']['federalstate']];
 // Achtung: bisher existiert nur germany!
                        $religion = 
$holidays->religions[$GLOBALS['phpgw']->preferences->data['common']['religion']];
 
@@ -3394,15 +3451,12 @@
                        // calculate day for warnmail sending by add number of 
workdays to first day of month
 
                        $new_days = 
$holidays->add_number_of_workdays(1,$warnmail_month,$warnmail_year,$num_work_days,$country,$federal_state,$religion);
-
                        $warnmail_day = $new_days['newday'];
                        $warnmail_month = $new_days['newmonth'];
                        $warnmail_year = $new_days['newyear'];
-
                        unset($new_days);
 
                        */
-
                        // use first day of next month for send mail
                        if($warnmail_month == 12)
                        {
@@ -3416,25 +3470,7 @@
                        }
                        
                        $warnmail_day = 1;
-                       return 
mktime(0,0,0,$warnmail_month,$warnmail_day,$warnmail_year);
-               }
-
-               function get_emp_worktimes($employee, $start, $end)
-               {
-                       $emp_worktimes = array();
-                       $result = $this->sohours->get_emp_worktimes($employee, 
$start, $end);
-                       if($result)
-                       {
-                               while($result->next_record())
-                               {
-                                       
$emp_worktimes[$result->f('project_id')] = array(
-                                               'sum_minutes_worktime' => 
intval($result->f('sum_minutes_worktime')),
-                                               'sum_minutes_journey'  => 
intval($result->f('sum_minutes_journey')),
-                                               'sum_minutes_all'      => 
intval($result->f('sum_minutes_all'))
-                                       );
-                               }
-                       }
-                       return $emp_worktimes;
+                       return 
mktime(23,59,59,$warnmail_month,$warnmail_day,$warnmail_year);
                }
 
                /**
@@ -3444,7 +3480,7 @@
                * @param integer $end_date timestamp of end date
                * @return array contains all projects of employee and the 
tracked worktimes
                */
-               function list_emp_worktimes($employee_id, $start_date=0, 
$end_date=0)
+               function get_emp_worktimes($employee_id, $start_date=0, 
$end_date=0)
                {
                        $worktimes = array();
                        $worktimes['sum_minutes_worktime'] = 0;
@@ -3452,7 +3488,8 @@
                        $worktimes['sum_minutes_all'] = 0;
                        $worktimes['projects'] = array();
                        
-                       $emp_worktimes = $this->get_emp_worktimes($employee_id, 
$start_date, $end_date);
+                       $bohours = CreateObject('projects.boprojecthours');
+                       $emp_worktimes = 
$bohours->get_emp_worktimes($employee_id, $start_date, $end_date);
                        if ($emp_worktimes === false)
                        {
                                return $worktimes;
@@ -3470,11 +3507,6 @@
                                        continue;
                                }
 
-                               if($project['status'] != 'active')
-                               {
-                                       continue;
-                               }
-
                                // create project output
                                $project_data = array(
                                        'project_main'    => $project['main'],
@@ -3510,7 +3542,6 @@
                        return $worktimes;
                }
 
-
                /**
                * Update the async service for the worktime status mail.
                * @param string $mail_type specifies the type of status mail 
repetition (off | weekly | monthly).
@@ -3575,7 +3606,7 @@
                        $h = intval($minutes / 60);
                        $m = intval($minutes % 60);
                        $time_str = sprintf("%02.2d:%02.2d", $h, $m); // hh:mm
-                       return $this->format_string($time_str, 6, '', ' ', 
STR_PAD_LEFT);
+                       return $this->format_string($time_str, 7, '', ' ', 
STR_PAD_LEFT);
                }
                
                /**
@@ -3629,24 +3660,26 @@
                *
                * @param integer $month Month for which to get the cost 
accounting
                * @param integer $year Year for which to get the cost accounting
+               * @param integer $location_id primary key of location for which 
to get the cost accounting
                * @return string Diamant "Betriebsdatenerfassung (BDE)" import 
format
                */
-               function get_cost_accounting_diamant($month,$year)
+               function get_cost_accounting_diamant($month,$year,$location_id)
                {
                        $bde = '';
                        $serial = 1;
-                       
-            $list = $this->soprojects->get_project_hours($month,$year);
+                       $location_data = 
$this->soconfig->get_single_location($location_id);
+                       $list = 
$this->soprojects->get_project_hours($month,$year,$location_id);
             $max = count($list);
                        for ($i = 0; $i < $max; ++$i)
                        {
-                               if (ereg('^I',$list[$i]['p_number']))
+                               if (ereg('^I',$list[$i]['p_number'])) // Intern
                                {
                                        $credit_cost_centre = 
$list[$i]['cost_centre']; // Kostenstelle (Mitarbeiter)
                                        if (intval($credit_cost_centre) != 0)
                                        {
                                                $cost_unit = ''; // 
Kostenträger (Projekt)
                                                $charge_cost_centre = 902; // 
Interne-IT
+                                               // AG übergreifende Buchungen?
                                                if ($list[$i]['minutes'] > 0)
                                                {
                                                        $voucher_number = 
date('Ymd') . $serial; // Belegnummer YYYYMMDDnum
@@ -3665,13 +3698,14 @@
                                                }
                                        }
                                }
-                               else if (ereg('^S',$list[$i]['p_number']))
+                               else if (ereg('^S',$list[$i]['p_number'])) // 
PreSales
                                {
                                        $credit_cost_centre = 
$list[$i]['cost_centre']; // Kostenstelle (Mitarbeiter)
                                        if (intval($credit_cost_centre) != 0)
                                        {
                                                $cost_unit = ''; // 
Kostenträger (Projekt)
                                                $charge_cost_centre = 220; // 
Presales
+                                               // AG übergreifende Buchungen?
                                                if ($list[$i]['minutes'] > 0)
                                                {
                                                        $voucher_number = 
date('Ymd') . $serial; // Belegnummer YYYYMMDDnum
@@ -3690,18 +3724,24 @@
                                                }
                                        }
                                }
-                               else if (ereg('^P',$list[$i]['p_number']))
+                               else if (ereg('^P',$list[$i]['p_number'])) // 
Projekt
                                {
                                        $credit_cost_centre = 
$list[$i]['cost_centre']; // Kostenstelle (Mitarbeiter)
                                        if (intval($credit_cost_centre) != 0)
                                        {
+                                               $charge_cost_centre = '';
                                                $cost_unit = 
substr($list[$i]['p_number'],1); // Kostenträger (Projekt)
-                                               if 
(((int)substr($cost_unit,0,2)) < 4)
+                                               $office = 
substr($cost_unit,2,2); // Niederlassungsnummer
+                                         if ($office != 
$location_data['location_ident'])
+                                               {
+                                                       $location = 
$this->soconfig->get_location_for_ident($office);
+                                                       $cost_unit =  '04' . 
$location['location_ident'] . '9' . $location['location_custnum']; // Problem 
mit Jahreszahl bei Geschäftsjahresübergreifenden Projekten!
+                                               }
+                                               if 
(((int)substr($cost_unit,0,2)) < 4) // Altes Nummernsystem
                                                {
                                                        $cost_unit = 
substr($cost_unit,4);
                                                }
                                                $cost_unit = 
(substr($cost_unit,0,1) == '0') ? substr($cost_unit,1) : $cost_unit;
-                                               $charge_cost_centre = '';
                                                if ($list[$i]['minutes'] > 0)
                                                {
                                                        $voucher_number = 
date('Ymd') . $serial; // Belegnummer YYYYMMDDnum
@@ -3720,18 +3760,24 @@
                                                }
                                        }
                                }
-                               else if (ereg('^D',$list[$i]['p_number']))
+                               else if (ereg('^D',$list[$i]['p_number'])) // 
Dienstleistung
                                {
                                        $credit_cost_centre = 
$list[$i]['cost_centre']; // Kostenstelle (Mitarbeiter)
                                        if (intval($credit_cost_centre) != 0)
                                        {
+                                               $charge_cost_centre = '';
                                                $cost_unit = 
substr($list[$i]['p_number'],1); // Kostenträger (Kunde)
-                                               if 
(((int)substr($cost_unit,0,2)) < 4)
+                                               $office = 
substr($cost_unit,2,2); // Niederlassungsnummer
+                                           if ($office != 
$location_data['location_ident'])
+                                               {
+                                                       $location = 
$this->soconfig->get_location_for_ident($office);
+                                                       $cost_unit =  '04' . 
$location['location_ident'] . '9' . $location['location_custnum']; // Problem 
mit Jahreszahl bei Geschäftsjahresübergreifenden Projekten!
+                                               }
+                                               if 
(((int)substr($cost_unit,0,2)) < 4) // Altes Nummernsystem
                                                {
                                                        $cost_unit = 
substr($cost_unit,4);
                                                }
                                                $cost_unit = 
(substr($cost_unit,0,1) == '0') ? substr($cost_unit,1) : $cost_unit;
-                                               $charge_cost_centre = '';
                                                if ($list[$i]['minutes'] > 0)
                                                {
                                                        $voucher_number = 
date('Ymd') . $serial; // Belegnummer YYYYMMDDnum
@@ -3804,6 +3850,68 @@
                        return $return;
                }
 
+
+               /**
+               * Get cost accounting information in Diamant format
+               *
+               * @param integer $month Month for which to get the cost 
accounting
+               * @param integer $year Year for which to get the cost accounting
+               * @param integer $location_id primary key of location for which 
to get the cost accounting
+               * @return string Diamant "Betriebsdatenerfassung (BDE)" import 
format
+               */
+               function 
get_cost_accounting_diamant_A($month,$year,$location_id)
+               {
+                       $bde = '';
+                       $serial = 1;
+                       $location_data = 
$this->soconfig->get_single_location($location_id);
+                       $list = 
$this->soprojects->get_project_hours($month,$year,$location_id);
+                       $max = count($list);
+                       for ($i = 0; $i < $max; ++$i)
+                       {
+                               if (ereg('^A',$list[$i]['p_number'])) // Projekt
+                               {
+                                       $credit_cost_centre = 
$list[$i]['cost_centre']; // Kostenstelle (Mitarbeiter)
+                                       if (intval($credit_cost_centre) != 0)
+                                       {
+                                               $charge_cost_centre = '';
+                                               $cost_unit = 
substr($list[$i]['p_number'],1); // Kostenträger (Projekt)
+                                               $office = 
substr($cost_unit,2,2); // Niederlassungsnummer
+                                         if ($office != 
$location_data['location_ident'])
+                                               {
+                                                       $location = 
$this->soconfig->get_location_for_ident($office);
+                                                       $cost_unit =  '04' . 
$location['location_ident'] . '9' . $location['location_custnum']; // Problem 
mit Jahreszahl bei Geschäftsjahresübergreifenden Projekten!
+                                               }
+                                               if 
(((int)substr($cost_unit,0,2)) < 4) // Altes Nummernsystem
+                                               {
+                                                       $cost_unit = 
substr($cost_unit,4);
+                                               }
+                                               $cost_unit = 
(substr($cost_unit,0,1) == '0') ? substr($cost_unit,1) : $cost_unit;
+                                               if ($list[$i]['minutes'] > 0)
+                                               {
+                                                       $voucher_number = 
date('Ymd') . $serial; // Belegnummer YYYYMMDDnum
+                                                       $amount = 
$list[$i]['minutes']; // Menge (Stunden)
+                                                       $posting_text = 
substr('"Arbeit ' . $list[$i]['employee'],0,31) . '"'; // Buchungstext 
(Arbeitszeit vs. Reisezeit)
+                                                       $bde .= 
$this->generate_cost_accounting_record_diamant($month,$year,$voucher_number,$credit_cost_centre,$charge_cost_centre,$cost_unit,$amount,$posting_text);
+                                                       ++$serial;
+                                               }
+                                               if ($list[$i]['journey'] > 0)
+                                               {
+                                                       $voucher_number = 
date('Ymd') . $serial; // Belegnummer YYYYMMDDnum
+                                                       $amount = 
$list[$i]['journey']; // Menge (Stunden)
+                                                       $posting_text = 
substr('"Reise ' . $list[$i]['employee'],0,31) . '"'; // Buchungstext 
(Arbeitszeit vs. Reisezeit)
+                                                       $bde .= 
$this->generate_cost_accounting_record_diamant($month,$year,$voucher_number,$credit_cost_centre,$charge_cost_centre,$cost_unit,$amount,$posting_text);
+                                                       ++$serial;
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                                       /* alle anderen Tätigkeiten */
+                               }
+                       }
+                       return($bde);  
+               }
+
                function test_async_worktime_statusmail()
                {
                        if(isset($_GET['year']))
@@ -3825,6 +3933,7 @@
                                'mail_type'  => 'weekly',
                                'last_date'  => (mktime(0,0,0,$m,$d,$y) - 
(60*60*24*7))
                        );
+
                        $this->async_worktime_statusmail($data);
                }
 
@@ -3848,9 +3957,77 @@
                        $this->async_worktime_warnmail($data);
                }
 
+               function test_async_workhours_booking()
+               {
+                       if(isset($_GET['month']))
+                               $m = $_GET['month'];
+                       else
+                               $m = date("m")-1;
+
+                       if(isset($_GET['year']))
+                               $y = $_GET['year'];
+                       else
+                               $y = date("Y");
+                       
+                       if(isset($_GET['type']))
+                               $t = $_GET['type'];
+                       else
+                               $t = 3;
+
+                       $data = array(
+                               'book_type'  => $t,
+                               'book_year'  => $y,
+                               'book_month' => $m
+                       );
+
+                       $this->async_workhours_booking($data);
+               }
+
                function get_site_config($params = 0)
                {
                        return $this->soconfig->get_site_config($params);
                }
+               
+               function array_natsort_list($array)
+               {
+                       // for all arguments without the first starting at end 
of list
+                       for ($i=func_num_args();$i>1;$i--)
+                       {
+                               // get column to sort by
+                               $sort_by = func_get_arg($i-1);
+                               // clear arrays
+                               $new_array = array();
+                               $temporary_array = array();
+                               // walk through original array
+                               foreach($array as $original_key => 
$original_value)
+                               {
+                                       // and save only values
+                                       $temporary_array[] = 
$original_value[$sort_by];
+                               }
+                               // sort array on values
+                               natsort($temporary_array);
+                               // delete double values
+                               $temporary_array = 
array_unique($temporary_array);
+                               // walk through temporary array
+                               $x = 0;
+                               foreach($temporary_array as $temporary_value)
+                               {
+                                       // walk through original array
+                                       foreach($array as $original_key => 
$original_value)
+                                       {
+                                               // and search for entries 
having the right value
+                                               if($temporary_value == 
$original_value[$sort_by])
+                                               {
+                                               // save in new array
+                                               $new_array[$x] = 
$original_value;
+                                               $x++;
+                                               }
+                                       }
+                               }
+                       // update original array
+                       $array = $new_array;
+                       }
+               return $array;
+               }
        }
 ?>

Index: inc/class.bostatistics.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/class.bostatistics.inc.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- inc/class.bostatistics.inc.php      26 Nov 2006 22:21:13 -0000      1.29
+++ inc/class.bostatistics.inc.php      5 Dec 2006 19:40:45 -0000       1.30
@@ -3,10 +3,10 @@
        * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: class.bostatistics.inc.php,v 1.29 2006/11/26 22:21:13 
sigurdne Exp $
+       * @version $Id: class.bostatistics.inc.php,v 1.30 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/class.bostatistics.inc.php,v $
        */
 
@@ -18,7 +18,6 @@
                var $order;
                var $sort;
                var $type;
-               var $status;
 
                var $public_functions = array
                (
@@ -152,6 +151,7 @@
                        $height                 = $params['height'];
                        $gantt_popup    = $params['gantt_popup'];
                        $parent_array   = $params['parent_array'];
+                       $viewreal = (isset($params['viewtype']) && 
($params['viewtype'] == 'planned')) ? false : true;
 
                        if(!is_array($parent_array))
                        {
@@ -193,8 +193,6 @@
                                }
                        }
 
-                       //_debug_array($projects);
-
                        if(is_array($projects))
                        {
                                $num_pro = count($projects) - 1;
@@ -213,18 +211,6 @@
                                {
                                        if(is_array($pro['mstones']))
                                        {
-                                               /*foreach($pro['mstones'] as 
$ms)
-                                               {
-                                                       $spro[] = array
-                                                       (
-                                                               'title'         
        => str_repeat(' ',$spro['level']) . '[MS]' . $ms['title'],
-                                                               'extracolor'    
=> 'yellow',
-                                                               'sdate'         
        => $pro['sdate'],
-                                                               'edate'         
        => $ms['edate'],
-                                                               'pro_id'        
        => $pro['project_id']
-                                                       );
-                                               }*/
-
                                                $color_legend['milestone'] = 
array('title'      => lang('milestone'),
                                                                                
                        'extracolor'    => 'yellow');
                                        }
@@ -237,18 +223,27 @@
                                                (
                                                        'title'                 
=> str_repeat(' ',$spro['level']) . '[!]' . $previous['title'],
                                                        'extracolor'    => 
'darkorange',
-                                                       'sdate'                 
=> $previous['sdate'],
-                                                       'edate'                 
=> $previous['edate'],
+                                                       'sdate'                 
=> $viewreal?$previous['sdate']:$previous['psdate'],
+                                                       'edate'                 
=> $viewreal?$previous['edate']:$previous['pedate'],
                                                        'pro_id'                
=> $previous['project_id'],
-                                                       'f_sdate'               
=> $pro['sdate']
+                                                       'f_sdate'               
=> $viewreal?$pro['sdate']:$pro['psdate']
                                                );
 
                                                $color_legend['previous'] = 
array('title'       => '[!]' . lang('previous project'),
                                                                                
                        'extracolor'    => 'darkorange');
                                        }
 
+                                       if($viewreal)
+                                       {
                                        $pedate = 
$pro['edate']?$pro['edate']:mktime(12,0,0,date('m'),date('d'),date('Y'));
-                                       $period = 
$this->graph->date_format($pro['sdate'],$pedate);
+                                               $psdate = $pro['sdate'];
+                                       }
+                                       else
+                                       {
+                                               $pedate = 
$pro['pedate']?$pro['pedate']:mktime(12,0,0,date('m'),date('d'),date('Y'));
+                                               $psdate = $pro['psdate'];
+                                       }
+                                       $period = 
$this->graph->date_format($psdate,$pedate);
                                        //echo 'PERIOD: ' . $period . "\n";
 
                                        if($pro['uhours_jobs'] > 0 && 
$pro['phours'] > 0)
@@ -265,7 +260,7 @@
                                        $progress_date = 
mktime(12,0,0,date('m',$pro['sdate']),date('d',$pro['sdate'])+$progress,date('Y',$pro['sdate']));
 
 
-                                       
if($this->boprojects->exists(array('check' => 'parent','project_id' => 
$pro['project_id'])))
+                                       
if($this->boprojects->exists('','par','',$pro['project_id']))
                                        {
                                                $usemap = 
(in_array($pro['project_id'],$parent_array)?'open':'closed');
                                        }
@@ -298,19 +293,19 @@
                                $k = 0;
                                for($i=0;$i<$num_legend;++$i)
                                {
-                                       if(isset($color_legend[$i]) && 
is_array($color_legend[$i]))
+                                       if(is_array($color_legend[$i]))
                                        {
                                                $color[$k] = $color_legend[$i];
                                                $k++;
                                        }
                                }
-                               if(isset($color_legend['previous']) && 
is_array($color_legend['previous']))
+                               if(is_array($color_legend['previous']))
                                {
                                        $num = count($color);
                                        $color[$num] = 
$color_legend['previous'];
                                }
 
-                               if(isset($color_legend['milestone']) && 
is_array($color_legend['milestone']))
+                               if(is_array($color_legend['milestone']))
                                {
                                        $num = count($color);
                                        $color[$num] = 
$color_legend['milestone'];
@@ -323,10 +318,10 @@
                                //set_x_text
                                $this->graph->format_data($sdate,$edate);
 
-                               $sdate = $sdate + (60*60) * 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])?$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']:0);
+                               $sdate = $sdate + (60*60) * 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
                                $sdateout = 
$GLOBALS['phpgw']->common->show_date($sdate,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
 
-                               $edate = $edate + (60*60) * 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])?$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']:0);
+                               $edate = $edate + (60*60) * 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
                                $edateout = 
$GLOBALS['phpgw']->common->show_date($edate,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
 
                                $this->graph->title = lang('Gantt chart from %1 
to %2',$sdateout,$edateout);

Index: inc/class.soconfig.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/class.soconfig.inc.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- inc/class.soconfig.inc.php  28 Nov 2006 17:54:50 -0000      1.28
+++ inc/class.soconfig.inc.php  5 Dec 2006 19:40:45 -0000       1.29
@@ -3,10 +3,10 @@
        * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: class.soconfig.inc.php,v 1.28 2006/11/28 17:54:50 
sigurdne Exp $
+       * @version $Id: class.soconfig.inc.php,v 1.29 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: /sources/phpgroupware/projects/inc/class.soconfig.inc.php,v $
        */
 
@@ -15,6 +15,8 @@
                var $db;
                var $db2;
                var $currency;
+               var $locations;
+               var $location_idents;
 
                function soconfig()
                {
@@ -27,7 +29,7 @@
                function get_site_config($params = 0)
                {
                        $default = $params['default']?$params['default']:True;
-                       $helpmsg = 
(isset($params['helpmsg'])?$params['helpmsg']:False);
+                       $helpmsg = $params['helpmsg']?$params['helpmsg']:False;
 
                        $this->config = 
CreateObject('phpgwapi.config','projects');
                        $this->config->read_repository();
@@ -79,7 +81,6 @@
                                                        . 'WHERE 
phpgw_p_projectactivities.project_id=' . $project_id . ' AND 
phpgw_p_activities.id='
                                                        . 
'phpgw_p_projectactivities.activity_id' . $bill_filter,__LINE__,__FILE__);
 
-                       $act = false;
                        while ($this->db->next_record())
                        {
                                $act[] = array
@@ -110,13 +111,9 @@
                        }
 
                        $this->db->query('SELECT id,a_number,descr,billperae 
FROM phpgw_p_activities ORDER BY descr asc');
-                       
-                       $activities_list = '';
                        while ($this->db->next_record())
                        {
                                $activities_list .= '<option value="' . 
$this->db->f('id') . '"';
-                               if(isset($selected) && is_array($selected))
-                               {
                                        for ($i=0;$i<count($selected);$i++)
                                        {
                                                if($selected[$i]['activity_id'] 
== $this->db->f('id'))
@@ -124,7 +121,6 @@
                                                        $activities_list .= ' 
selected';
                                                }
                                        }
-                               }
                                $activities_list .= '>' . 
$GLOBALS['phpgw']->strip_html($this->db->f('descr')) . ' ['
                                                                                
. $GLOBALS['phpgw']->strip_html($this->db->f('a_number')) . ']';
                                if($billable)
@@ -156,13 +152,9 @@
 
                        $this->db->query('SELECT a.id, a.a_number, a.descr, 
a.billperae, pa.activity_id FROM phpgw_p_activities as a, 
phpgw_p_projectactivities as pa'
                                                        . ' WHERE 
pa.project_id=' . intval($pro_parent) . $bill_filter . ' AND 
pa.activity_id=a.id ORDER BY a.descr asc');
-
-                       $activities_list = '';
                        while ($this->db->next_record())
                        {
                                $activities_list .= '<option value="' . 
$this->db->f('id') . '"';
-                               if(isset($selected) && is_array($selected))
-                               {
                                        for ($i=0;$i<count($selected);$i++)
                                        {
                                                if($selected[$i]['activity_id'] 
== $this->db->f('id'))
@@ -170,9 +162,8 @@
                                                        $activities_list .= ' 
selected';
                                                }
                                        }
-                               }
 
-                               if (!isset($selected) || !is_array($selected))
+                               if (! is_array($selected))
                                {
                                        $activities_list .= ' selected';
                                }
@@ -195,7 +186,6 @@
                        $this->db->query('SELECT 
activity_id,a_number,descr,billperae,billable FROM 
phpgw_p_projectactivities,phpgw_p_activities WHERE project_id ='
                                                        . intval($project_id) . 
' AND phpgw_p_projectactivities.activity_id=phpgw_p_activities.id order by 
descr asc',__LINE__,__FILE__);
 
-                       $hours_act = '';
                        while ($this->db->next_record())
                        {
                                $hours_act .= '<option value="' . 
$this->db->f('activity_id') . '"';
@@ -252,10 +242,10 @@
 
                function exists($values)
                {
-                       $pa_id  = isset($values['pa_id']) && $values['pa_id'] 
?$values['pa_id']:0;
-                       $number = isset($values['number']) && $values['number'] 
?$values['number']:'';
-                       $action = isset($values['action']) && $values['action'] 
? $values['action']:'activity';
-                       $check  = isset($values['check']) && $values['check'] 
?$values['check']:'';
+                       $pa_id  = isset($values['pa_id'])?$values['pa_id']:0;
+                       $number = isset($values['number'])?$values['number']:'';
+                       $action = 
isset($values['action'])?$values['action']:'activitiy';
+                       $check  = isset($values['check'])?$values['check']:'';
 
                        $pa_id = intval($pa_id);
 
@@ -288,89 +278,135 @@
                        }
                }
 
-               function read_admins($action = 'project_admin',$type = '')
+               function read_admins($action = 'pad',$type = '')
+               {
+                       switch($type)
                {
-                       if($action != 'project_admin' && $action != 
'project_salesman')
+                               case 'user':
+                                       switch($action)
                        {
-                               $action = 'project_admin';
+                                               case 'pmanager':        $filter 
= "type='ma'"; break;
+                                               case 'psale':           $filter 
= "type='sa'"; break;
+                                               case 'pad':                     
$filter = "type='aa'"; break;
                        }
-
-                       $typeselect = '';
-                       if($type != '')
+                                       break;
+                               case 'group':
+                                       switch($action)
+                                       {
+                                               case 'pmanager':        $filter 
= "type='mg'"; break;
+                                               case 'psale':           $filter 
= "type='sg'"; break;
+                                               case 'pad':                     
$filter = "type='ag'"; break;
+                                       }
+                                       break;
+                               case 'all': $filter = "(type != 'accounting' 
AND type != 'role')"; break;
+                               default:
+                                       switch($action)
                        {
-                               $typeselect = " AND acl_location='" . $type . 
"'";
+                                               case 'pmanager':        $filter 
= "type='ma' or type='mg'"; break;
+                                               case 'psale':           $filter 
= "type='sa' or type='sg'"; break;
+                                               case 'pad':                     
$filter = "type='aa' or type='ag'"; break;
+                                       }
+                                       break;
                        }
 
-                       $sql = "select acl_account, acl_location from phpgw_acl 
WHERE acl_appname='" . $action . "'";
-                       $this->db->query($sql . $typeselect,__LINE__,__FILE__);
+                       $sql = 'select account_id,type from 
phpgw_p_projectmembers WHERE ' . $filter;
+                       $this->db->query($sql);
                        $this->total_records = $this->db->num_rows();
-                       $admins = array();
                        while ($this->db->next_record())
                        {
-                               $admins[] = array('account_id' => 
$this->db->f('acl_account'),
-                                                                               
'type' => $this->db->f('acl_location'));
+                               $admins[] = array('account_id' => 
$this->db->f('account_id'),
+                                                                               
'type' => $this->db->f('type'));
                        }
                        return $admins;
                }
 
-               function isprojectadmin($action = 'project_admin')
-               {
-                       if($action != 'project_admin' && $action != 
'project_salesman')
+               function isprojectadmin($action = 'pad')
                        {
-                               $action = 'project_admin';
-                       }
-
                        $admin_groups = 
$GLOBALS['phpgw']->accounts->membership($this->account);
                        $admins = $this->read_admins($action);
 
                        //_debug_array($admins);
 
-                       for($i=0;$i<count($admins);++$i)
+                       for ($i=0;$i<count($admins);$i++)
                        {
-                               if ($admins[$i]['type'] == 'user' && 
$admins[$i]['account_id'] == $this->account)
+                               switch($action)
                                {
-                                       return True;
+                                       case 'pmanager':
+                                               $type_a = 'ma';
+                                               $type_g = 'mg';
+                                               break;
+                                       case 'psale':
+                                               $type_a = 'sa';
+                                               $type_g = 'sg';
+                                               break;
+                                       default:
+                                               $type_a = 'aa';
+                                               $type_g = 'ag';
+                                               break;
                                }
-                               elseif($admins[$i]['type'] == 'group')
+
+                               if ($admins[$i]['type'] == $type_a && 
$admins[$i]['account_id'] == $this->account)
+                               {
+                                       return true;
+                               }
+                               elseif ($admins[$i]['type'] == $type_g)
                                {
                                        if (is_array($admin_groups))
                                        {
-                                               for 
($j=0;$j<count($admin_groups);++$j)
+                                               for 
($j=0;$j<count($admin_groups);$j++)
                                                {
                                                        if 
($admin_groups[$j]['account_id'] == $admins[$i]['account_id'])
-                                                               return True;
+                                                               return true;
                                                }
                                        }
                                }
                                else
                                {
-                                       return False;
+                                       return false;
                                }
                        }
                }
 
-               function edit_admins($action = 'project_admin',$users = 0, 
$groups = 0)
+               function edit_admins($action,$users = '', $groups = '')
                {
-                       if($action != 'project_admin' && $action != 
'project_salesman')
+                       switch($action)
                        {
-                               $action = 'project_admin';
+                               case 'psale':           $filter = "sa' OR 
type='sg"; break;
+                               case 'pmanager':        $filter = "ma' OR 
type='mg"; break;
+                               default:                        $filter = "aa' 
OR type='ag"; break;
                        }
 
-                       $this->db->query("DELETE from phpgw_acl WHERE 
acl_appname='" . $action . "'",__LINE__,__FILE__);
+                       $this->db->query("DELETE from phpgw_p_projectmembers 
WHERE type='" . $filter . "'",__LINE__,__FILE__);
 
                        if (is_array($users))
                        {
+                               switch($action)
+                               {
+                                       case 'psale':           $type = 'sa'; 
break;
+                                       case 'pmanager':        $type = 'ma'; 
break;
+                                       default:                        $type = 
'aa'; break;
+                               }
+
                                while($activ=each($users))
                                {
-                                       $this->db->query("INSERT into phpgw_acl 
values ('" . $action . "','user'," . $activ[1] . ',1)',__LINE__,__FILE__);
+                                       $this->db->query('insert into 
phpgw_p_projectmembers (project_id, account_id,type) values (0,' . $activ[1] . 
",'"
+                                                                       . $type 
. "')",__LINE__,__FILE__);
                                }
                        }
 
                        if (is_array($groups))
                        {
+                               switch($action)
+                               {
+                                       case 'psale':           $type = 'sg'; 
break;
+                                       case 'pmanager':        $type = 'mg'; 
break;
+                                       default:                        $type = 
'ag'; break;
+                               }
+
                                while($activ=each($groups))
                                {
-                                       $this->db->query("INSERT into phpgw_acl 
values ('" . $action . "','group'," . $activ[1] . ',1)',__LINE__,__FILE__);
+                                       $this->db->query('insert into 
phpgw_p_projectmembers (project_id, account_id,type) values (0,' . $activ[1] . 
",'"
+                                                                       . $type 
. "')",__LINE__,__FILE__);
                                }
                        }
                }
@@ -379,14 +415,13 @@
                {
                        $start  = isset($values['start'])?$values['start']:0;
                        $limit  = isset($values['limit'])?$values['limit']:True;
-                       $sort   = isset($values['sort']) && 
$values['sort']?$values['sort']:'ASC';
-                       $order  = isset($values['order']) && 
$values['order']?$values['order']:'a_number';
+                       $sort   = isset($values['sort'])?$values['sort']:'ASC';
+                       $order  = 
isset($values['order'])?$values['order']:'a_number';
                        $cat_id = isset($values['cat_id'])?$values['cat_id']:0;
 
                        $query  = $this->db->db_addslashes($values['query']);
 
                        $ordermethod = " order by $order $sort";
-                       $filtermethod = '';
 
                        if ($query)
                        {
@@ -418,7 +453,6 @@
                                $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
 
-                       $act = false;
                        $i = 0;
                        while ($this->db->next_record())
                        {
@@ -507,7 +541,8 @@
                                        'sdate'                 => 
$this->db->f('sdate'),
                                        'edate'                 => 
$this->db->f('edate'),
                                        'weekly_workhours'      => 
$this->db->f('weekly_workhours'),
-                                       'cost_centre'   => 
$this->db->f('cost_centre')
+                                       'cost_centre'   => 
$this->db->f('cost_centre'),
+                                       'location_id' => 
$this->db->f('location_id')
                                );
                        }
                        return $emps;
@@ -562,20 +597,21 @@
                        $values['id']                   = intval($values['id']);
                        $values['accounting']   = $values['accounting'] + 0.0;
                        $values['d_accounting'] = $values['d_accounting'] + 0.0;
+                       $values['location_id']  = 
intval($values['location_id']);
 
                        if($values['id'] > 0)
                        {
                                $this->db->query('UPDATE phpgw_p_projectmembers 
set accounting=' . $values['accounting'] . ', d_accounting=' . 
$values['d_accounting']. ', sdate='
                                                                . 
intval($values['sdate']) . ', edate=' . intval($values['edate']) 
-                                                               . ', 
weekly_workhours=' . $values['weekly_workhours'] . ', cost_centre=' . 
$values['cost_centre']
+                                                               . ', 
weekly_workhours=' . $values['weekly_workhours'] . ', cost_centre=' . 
$values['cost_centre'] . ', location_id='.$values['location_id']
                                                                . ' where 
account_id=' . intval($values['account_id'])
                                                                . " and 
type='accounting' and id=" . $values['id'],__LINE__,__FILE__);
                        }
                        else
                        {
-                               $this->db->query('INSERT into 
phpgw_p_projectmembers 
(account_id,type,accounting,d_accounting,sdate,edate,weekly_workhours,cost_centre)
 values(' . intval($values['account_id'])
+                               $this->db->query('INSERT into 
phpgw_p_projectmembers 
(account_id,type,accounting,d_accounting,sdate,edate,weekly_workhours,cost_centre,location_id)
 values(' . intval($values['account_id'])
                                                                . 
",'accounting'," . $values['accounting'] . ',' . $values['d_accounting'] . ',' 
. intval($values['sdate']) . ','
-                                                               . 
intval($values['edate'])  . ',' . $values['weekly_workhours'] . ',' . 
$values['cost_centre']
+                                                               . 
intval($values['edate'])  . ',' . $values['weekly_workhours'] . ',' . 
$values['cost_centre'] . ',' . $values['location_id']
                                                                . 
')',__LINE__,__FILE__);
                        }
                }
@@ -596,8 +632,6 @@
                        $query  = $this->db->db_addslashes($values['query']);
 
                        $ordermethod = " order by role_name $sort";
-                       $querymethod = '';
-                       $roles = false;
 
                        if ($query)
                        {
@@ -636,7 +670,6 @@
 
                function list_events($type = '')
                {
-                       $type_select = '';
                        if($type)
                        {
                                $type_select = " where event_type='$type'";
@@ -683,7 +716,6 @@
                                $select = ' order by charge_name asc';
                        }
 
-                       $charges = false;
                        $this->db->query('SELECT * from phpgw_p_surcharges' . 
$select,__LINE__,__FILE__);
 
                        while($this->db->next_record())
@@ -714,5 +746,90 @@
                                                                . 
$values['charge_percent'] . ')',__LINE__,__FILE__);
                        }
                }
+
+               function save_location($values)
+               {
+                       $values['location_id'] = intval($values['location_id']);
+                       if($values['location_id'] > 0)
+                       {
+                               $sql = "UPDATE phpgw_p_locations SET 
location_name='" . $values['location_name'] . "', location_ident='" . 
$values['location_ident'] . "', 
location_custnum='".$values['location_custnum']."' WHERE 
location_id=".$values['location_id'];
+                       }
+                       else
+                       {
+                               $sql = "INSERT INTO phpgw_p_locations 
(location_name, location_ident, location_custnum) VALUES ('" . 
$values['location_name'] . "', '" . $values['location_ident'] . "', '" . 
$values['location_custnum'] . "')";
+                       }
+                       $this->db->query($sql, __LINE__, __FILE__);
+               }
+
+               function get_locations()
+               {
+                       $locations = array();
+                       $sql = 'SELECT * FROM phpgw_p_locations';
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       while($this->db->next_record())
+                       {
+                               $location_id = $this->db->f('location_id');
+                               $locations[$location_id] = array(
+                                       'location_id'      => $location_id,
+                                       'location_name'    => 
$this->db->f('location_name'),
+                                       'location_ident'   => 
$this->db->f('location_ident'),
+                                       'location_custnum' => 
$this->db->f('location_custnum')
+                               );
+                       }
+
+                       return $locations;
+               }
+               
+               function get_single_location($location_id)
+               {
+                       $location = array();
+                       if($location_id > 0)
+                       {
+                               $this->db->query('SELECT * FROM 
phpgw_p_locations WHERE location_id = ' . $location_id, __LINE__, __FILE__);
+                               if($this->db->next_record())
+                               {
+                                       $location = array(
+                                               'location_id'      => 
$this->db->f('location_id'),
+                                               'location_name'    => 
$this->db->f('location_name'),
+                                               'location_ident'   => 
$this->db->f('location_ident'),
+                                               'location_custnum' => 
$this->db->f('location_custnum')
+                                       );
+                               }
+                       }
+
+                       return $location;
+               }
+
+               function get_location_for_ident($location_ident)
+               {
+                       $location = array();
+                       if($location_ident)
+                       {
+                               $sql = "SELECT * FROM phpgw_p_locations WHERE 
location_ident='".$location_ident."'";
+                               $this->db->query($sql, __LINE__, __FILE__);
+                               if($this->db->next_record())
+                               {
+                                       $location = array(
+                                               'location_id'      => 
$this->db->f('location_id'),
+                                               'location_name'    => 
$this->db->f('location_name'),
+                                               'location_ident'   => 
$this->db->f('location_ident'),
+                                               'location_custnum' => 
$this->db->f('location_custnum')
+                                       );
+                               }
+                       }
+
+                       return $location;
+               }
+
+               function delete_location($location_id)
+               {
+                       $location_id = intval($location_id);
+                       if($location_id > 0)
+                       {
+                               $sql = 'DELETE FROM phpgw_p_locations WHERE 
location_id='.$location_id;
+                               $this->db->query($sql, __LINE__, __FILE__);
+                       }
+               }
+
        }
 ?>

Index: inc/class.soprojecthours.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/class.soprojecthours.inc.php,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- inc/class.soprojecthours.inc.php    27 Nov 2006 21:36:26 -0000      1.44
+++ inc/class.soprojecthours.inc.php    5 Dec 2006 19:40:45 -0000       1.45
@@ -3,10 +3,10 @@
        * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: class.soprojecthours.inc.php,v 1.44 2006/11/27 21:36:26 
sigurdne Exp $
+       * @version $Id: class.soprojecthours.inc.php,v 1.45 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/class.soprojecthours.inc.php,v $
        */
 
@@ -155,13 +155,10 @@
                function read_single_hours($hours_id)
                {
                        $this->db->query('SELECT * from phpgw_p_hours WHERE 
id=' . intval($hours_id),__LINE__,__FILE__);
-                       $p_hours = $this->db2hours();
-                       if(isset($p_hours) && count($p_hours)>0)
-                       {                       
-                               list($hours) = $p_hours;
+                       list($hours) = $this->db2hours();
+
                                return $hours;
                        }
-               }
 
                function add_hours($values)
                {
@@ -175,7 +172,9 @@
                                                        . 
intval($values['activity_id']) . ',' . time() . ',' . intval($values['sdate']) 
. ',' . intval($values['edate']) . ",'"
                                                        . 
$values['hours_descr'] . "','" . $values['remark'] . "','" . 
(isset($values['billable'])?'N':'Y') . "'," . intval($values['w_minutes'])
                                                        . ",'" . 
$values['status'] . "'," . intval($values['employee']) . ',' . 
intval($values['pro_parent']) . ',' . intval($values['pro_main'])
-                                                       . ',' . 
$values['km_distance'] . ',' . $values['t_journey'] . ',' . 
intval($values['surcharge']) . ",'N')",__LINE__,__FILE__); 
+                                                       . ',' . 
$values['km_distance'] . ',' . $values['t_journey'] . ',' . 
intval($values['surcharge']) . ',"N")',__LINE__,__FILE__); 
+                       // auto update project start date if it is not sset
+                       $this->db->query('UPDATE phpgw_p_projects SET 
start_date = '.intval($values['sdate']).' WHERE project_id = 
'.intval($values['project_id']).' AND start_date = 0');
                }
 
                function edit_hours($values)
@@ -185,10 +184,10 @@
                        $values['km_distance']  = $values['km_distance'] + 0.0;
                        $values['t_journey']    = $values['t_journey'] + 0.0;
 
-                       $this->db->query('UPDATE phpgw_p_hours SET 
activity_id=' . intval($values['activity_id']) . ',entry_date=' . time() . 
',start_date='
+                       $this->db->query('UPDATE phpgw_p_hours SET 
project_id='.$values['project_id'].', activity_id=' . 
intval($values['activity_id']) . ',entry_date=' . time() . ',start_date='
                                                        . 
intval($values['sdate']) . ',end_date=' . intval($values['edate']) . 
",hours_descr='" . $values['hours_descr'] . "',remark='"
                                                        . $values['remark'] . 
"', billable='" . (isset($values['billable'])?'N':'Y') . "', minutes=" . 
intval($values['w_minutes'])
-                                                       . ",status='" . 
$values['status'] . "',employee=" . intval($values['employee']) . ', 
km_distance=' . $values['km_distance']
+                                                       . ",status='" . 
$values['status'] . "',employee=" . intval($values['employee']) . ', 
pro_parent='.$values['pro_parent'].',pro_main='.$values['pro_main'].', 
km_distance=' . $values['km_distance']
                                                        . ', t_journey=' . 
$values['t_journey'] . ', surcharge=' . intval($values['surcharge']) . ' where 
id=' . intval($values['hours_id']),__LINE__,__FILE__);
                }
 
@@ -235,30 +234,37 @@
                                        'wminutes'                      => 
$minutes
                                );
 
-                               if((0 < abs($wh['wmin_formatted'])) && 
(abs($wh['wmin_formatted']) <= 9))
+                               if((0 <= abs($wh['wmin_formatted'])) && 
(abs($wh['wmin_formatted']) <= 9))
                                {
                                        $wh['wmin_formatted']   = '0' . 
abs($wh['wmin_formatted']);
                                }
 
-                               $wh['whwm']     = $wh['whours_formatted'] . '.' 
. $wh['wmin_formatted'];
+                               $wh['whwm']     = $wh['whours_formatted'] . ':' 
. $wh['wmin_formatted'];
                        }
                        else
                        {
                                $wh = array
                                (
                                        'whours_formatted'      => 0,
-                                       'wmin_formatted'        => 0,
+                                       'wmin_formatted'        => '00',
                                        'wminutes'                      => 0,
-                                       'whwm'                          => 0.0
+                                       'whwm'                          => 
'0:00'
                                );
                        }
                        return $wh;
                }
                
-               function min2time($string)
-               {
-                       $time = ((int)($string / 60)) . ':' . (($string % 60) 
== '0' ? '00' : sprintf("%02d",($string % 60)));
-                       return $time;
+               function min2str($min) {
+                       return sprintf('%s%d:%02d', $min<0?'-':'', 
abs($min)/60, abs($min)%60);
+               }
+
+               function str2min($s) {
+                       if (ereg('(-?)([0-9]+):([0-9][0-9])', $s, $h)) {
+                               return $h[1].($h[2]*60+$h[3]);
+                       }
+                       else {
+                               return(0);
+                       }
                }
 
                function calculate_activity_budget($params = 0)
@@ -371,10 +377,10 @@
 
                function get_time_used($params = 0)
                {
-                       $project_id             = 
(isset($params['project_id'])?intval($params['project_id']):'');
-                       $project_array  = 
(isset($params['project_array'])?$params['project_array']:'');
-                       $hours                  = 
(isset($params['hours'])?$params['hours']:True);
-                       $action                 = 
(isset($params['action'])?$params['action']:'subs');
+                       $project_id             = intval($params['project_id']);
+                       $project_array  = $params['project_array'];
+                       $hours                  = 
isset($params['hours'])?$params['hours']:True;
+                       $action                 = 
$params['action']?$params['action']:'subs';
 
                        $columns = 
'id,minutes,t_journey,billable,surcharge,employee';
                        $this->column_array = explode(',',$columns);
@@ -486,7 +492,6 @@
 
                function db2track()
                {
-                       $track = false;
                        while ($this->db->next_record())
                        {
                                $track[] = array
@@ -625,13 +630,14 @@
                                        $this->db->next_record();
                                        $sdate = $this->db->f('start_date');
                                        $edate = $this->db->f('end_date');
-
+                                       $hours_descr = 
$this->db->f('hours_descr');
+                                       if(!$hours_descr)
+                                       {
+                                               $hours_descr = 
$values['hours_descr']?$values['hours_descr']:$values['action'];
+                                       }
                                        $wtime          = 
$this->format_ttime($edate - $sdate);
                                        $work_time      = 
($wtime['hrs']*60)+$wtime['mins'];
 
-                                       $descr                  = 
$this->db->f('hours_descr');
-                                       $hours_descr    = 
$descr?$descr:$values['hours_descr'];
-
                                        $this->db->query('UPDATE 
phpgw_p_ttracker set minutes=' . $work_time . ' where track_id=' . 
$max,__LINE__,__FILE__);
 
                                        $this->db->query('INSERT into 
phpgw_p_ttracker 
(project_id,activity_id,start_date,end_date,employee,status,hours_descr,remark,billable)
 '
@@ -657,7 +663,7 @@
                                                                        
.'remark,t_journey,km_distance,stopped,surcharge,billable) values(' . 
$project_id . ',' . intval($values['activity_id'])
                                                                        . ',' . 
$this->account . ',' . intval($values['sdate']) . ',' . 
intval($values['edate']) . ','
                                                                        . 
intval($values['w_minutes']) . ",'" . $values['hours_descr'] . "','" . 
$values['action'] . "','" . $values['remark']
-                                                                       . "'," 
. $values['t_journey'] . ',' . $values['km_distance'] . ",'Y'," . 
$values['surcharge'] . ",'" . $values['billable'] . "')", __LINE__,__FILE__);
+                                                                       . "'," 
. $values['t_journey'] . ',' . $values['km_distance'] . ",'Y'," . 
intval($values['surcharge']) . ",'" . $values['billable'] . "')", 
__LINE__,__FILE__);
 
                                        //return 
$this->db->get_last_insert_id('phpgw_p_ttracker','track_id');
                        }
@@ -718,7 +724,7 @@
                function get_dayhours($employee, $start_date, $end_date)
                {
                        // Nice SQL-Statement Kai
-//                     $sql  = 'SELECT 
UNIX_TIMESTAMP(FROM_UNIXTIME(start_date,"%Y%m%d")) as day, project_id, 
sum(minutes) + sum(t_journey) '; // Mysql only
+//                     $sql  = 'SELECT 
UNIX_TIMESTAMP(FROM_UNIXTIME(start_date,"%Y%m%d")) as day, project_id, 
sum(minutes) + sum(t_journey) ';
                        $sql  = 'SELECT start_date as day, project_id, 
sum(minutes) + sum(t_journey) ';
                        $sql .= 'FROM phpgw_p_hours ';
                        $sql .= 'WHERE employee='.(int)$employee.' AND 
start_date >= '.(int)$start_date.' AND start_date <= '.((int)$end_date + 
86400).' ';
@@ -731,12 +737,15 @@
 
                function get_emp_worktimes($employee, $start_date=0, 
$end_date=0)
                {
+                       $start_date = mktime( 0, 0, 0, date("m", $start_date), 
date("d", $start_date), date("y", $start_date));
+                       $end_date   = mktime(23,59,59, date("m", $end_date)  , 
date("d", $end_date)  , date("y", $end_date  ));
+
                        $sql  = 'SELECT phpgw_p_hours.project_id AS project_id, 
';
                        $sql .= '       SUM(minutes) AS sum_minutes_worktime, ';
                        $sql .= '       SUM(t_journey) AS sum_minutes_journey, 
';
                        $sql .= '       SUM(minutes+t_journey) AS 
sum_minutes_all ';
                        $sql .= 'FROM phpgw_p_hours, phpgw_p_projects ';
-                       $sql .= 'WHERE phpgw_p_hours.start_date >= 
'.(int)$start_date.' AND phpgw_p_hours.start_date <= '.((int)$end_date + 
86400).' ';
+                       $sql .= 'WHERE phpgw_p_hours.start_date >= 
'.(int)$start_date.' AND phpgw_p_hours.start_date <= '.((int)$end_date).' ';
                        $sql .= 'AND employee='.(int)$employee.' ';
                        $sql .= 'AND phpgw_p_hours.project_id = 
phpgw_p_projects.project_id ';
                        $sql .= 'GROUP BY phpgw_p_hours.project_id ';
@@ -746,21 +755,5 @@
                        return $this->db;
                }
 
-               function min2str($min)
-               {
-                       return sprintf('%s%d:%02d', $min<0?'-':'', 
abs($min)/60, abs($min)%60);
-               }
-       
-               function str2min($s)
-               {
-                       if (ereg('(-?)([0-9]+):([0-9][0-9])', $s, $h))
-                       {
-                               return $h[1].($h[2]*60+$h[3]);
-                       }
-                       else
-                       {
-                               return(0);
-                       }
-               }
        }
 ?>

Index: inc/class.soprojects.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/class.soprojects.inc.php,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -b -r1.118 -r1.119
--- inc/class.soprojects.inc.php        28 Nov 2006 17:54:50 -0000      1.118
+++ inc/class.soprojects.inc.php        5 Dec 2006 19:40:45 -0000       1.119
@@ -3,10 +3,10 @@
        * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: class.soprojects.inc.php,v 1.118 2006/11/28 17:54:50 
sigurdne Exp $
+       * @version $Id: class.soprojects.inc.php,v 1.119 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/class.soprojects.inc.php,v $
        */
 
@@ -43,7 +43,6 @@
 
                function db2projects($column = False)
                {
-                       $projects = array();
                        $i = 0;
                        while ($this->db->next_record())
                        {
@@ -88,6 +87,7 @@
                                                'level'                         
                        => $this->db->f('level'),
                                                'previous'                      
                => $this->db->f('previous'),
                                                'customer_nr'                   
        => $this->db->f('customer_nr'),
+                                               'salesmanager'                  
=> $this->db->f('salesmanager'),
                                                'url'                           
                                => $this->db->f('url'),
                                                'reference'                     
                => $this->db->f('reference'),
                                                'result'                        
                        => $this->db->f('result'),
@@ -104,7 +104,9 @@
                                                'discount_type'                 
=> $this->db->f('discount_type'),
                                                'inv_method'                    
        => $this->db->f('inv_method'),
                                                'plan_bottom_up'                
=> $this->db->f('plan_bottom_up'),
-                                               'direct_work'                   
        => $this->db->f('direct_work')
+                                               'direct_work'                   
        => $this->db->f('direct_work'),
+                                               'level'                         
      => $this->db->f('level'),
+                                               'acc_type'                      
                => $this->db->f('acc_type')
                                        );
                                }
                        }
@@ -112,8 +114,7 @@
                }
 
                function read_projects($values)
-               {
-                       $start          = 
(isset($values['start'])?intval($values['start']):0);
+               {
                        $start          = intval($values['start']);
                        $limit          = 
(isset($values['limit'])?$values['limit']:true);
                        $filter         = (isset($values['filter']) && 
$values['filter']?$values['filter']:'none');
                        $sort           = (isset($values['sort']) && 
$values['sort']?$values['sort']:'ASC');
@@ -121,29 +122,34 @@
                        $status         = 
isset($values['status'])?$values['status']:'active';
                        $action         = 
(isset($values['action'])?$values['action']:'mains');
 
-                       $cat_id         = 
(isset($values['cat_id'])?intval($values['cat_id']):0);
-                       $main           = 
(isset($values['main'])?intval($values['main']):0);
-                       $parent         = 
(isset($values['parent'])?intval($values['parent']):0);
-                       $project_id     = 
(isset($values['project_id'])?intval($values['project_id']):0);
+                       $cat_id         = intval($values['cat_id']);
+                       $main           = intval($values['main']);
+                       $parent         = intval($values['parent']);
+                       $project_id     = intval($values['project_id']);
                        $column         = 
(isset($values['column'])?$values['column']:False);
-                       $employee       = 
(isset($values['employee'])?$values['employee']:'');
+                       $employee       = $values['employee'];
 
-                       $query  = 
(isset($values['query'])?$this->db->db_addslashes($values['query']):'');
+                       $query  = $this->db->db_addslashes($values['query']);
 
                        if ($status)
                        {
                                $statussort = " AND status = '" . $status . "' 
";
                        }
-                       else
+//                     else
+//                     {
+//                             $statussort = " AND status != 'archive' ";
+//                     }
+/*                     
+                       if($order == 'coordinator')
                        {
-                               $statussort = " AND status != 'archive' ";
+                               $order = 'phpgw_accounts.account_lastname';
                        }
-
+*/
                        $ordermethod = " order by $order $sort";
 
                        if ($filter == 'none' || $filter == 'noadmin')
                        {
-                               if ($filter == 'none' && 
($this->soconfig->isprojectadmin() || 
$this->soconfig->isprojectadmin('project_salesman')))
+                               if ($filter == 'none' && 
($this->soconfig->isprojectadmin('pad') || 
$this->soconfig->isprojectadmin('pmanager') || 
$this->soconfig->isprojectadmin('psale')))
                                {
                                        $filtermethod = " ( access != 'private' 
OR coordinator = " . $this->account . ' )';
                                }
@@ -172,6 +178,14 @@
                        {
                                $filtermethod = ' coordinator=' . 
$this->account;
                        }
+                       elseif ($filter == 'anonym')
+                       {
+                               $filtermethod = " access = 'anonym' ";
+                       }
+                       elseif ($filter == 'employee')
+                       {
+                               $filtermethod = ' employee =' . $employee;
+                       }
                        else
                        {
                                $filtermethod = ' coordinator=' . 
$this->account . " AND access='private'";
@@ -191,7 +205,6 @@
                                case 'mainsubsorted':   $parent_select = ' AND 
project_id=' . $project_id; break;
                        }
 
-                       $querymethod='';
                        if ($query)
                        {
                                $querymethod = " AND (title like '%$query%' OR 
p_number like '%$query%' OR descr like '%$query%') ";
@@ -227,7 +240,6 @@
                                for ($i=0;$i < $num_pro;$i++)
                                {
                                        $sub_select = ' AND parent=' . 
$pro[$i]['project_id'] . ' AND level=' . ($pro[$i]['level']+1);
-
                                        $this->db->query($sql . $sub_select . 
$ordermethod,__LINE__,__FILE__);
                                        $total += $this->db->num_rows();
                                        $subpro = $this->db2projects($column);
@@ -263,13 +275,13 @@
                                $k=0;
                                for($i=$start;$i<$max;++$i)
                                {
-                                       if(isset($pro[$i]) && 
is_array($pro[$i]))
+                                       if(is_array($pro[$i]))
                                        {
                                                $spro[$k] = $pro[$i];
                                                ++$k;
                                        }
                                }
-                               if(isset($spro) && is_array($spro))
+                               if(is_array($spro))
                                {
                                        $pro = $spro;
                                }
@@ -327,7 +339,6 @@
                                        }
                                }
                        }
-                       $this->total_records = $num_pro;
                        return $pro;
                }
 
@@ -335,13 +346,9 @@
                {
                        $this->db->query('SELECT * from phpgw_p_projects WHERE 
project_id=' . intval($project_id),__LINE__,__FILE__);
 
-                       $pro = $this->db2projects();
-                       if(is_array($pro) && count($pro)>0)
-                       {
-                               list($project) = $pro;
+                       list($project) = $this->db2projects();
                                return $project;
                        }                       
-               }
 
                function select_project_list($values)
                {
@@ -350,19 +357,15 @@
                        $pro = $this->read_projects(array
                                                (
                                                        'limit'         => 
false,
-                                                       'status'        => 
(isset($values['status'])?$values['status']:''),
+                                                       'status'        => 
$values['status'],
                                                        'action'        => 
(isset($values['action'])?$values['action']:'mains'),
-                                                       'main'          => 
(isset($values['main'])?$values['main']:''),
-                                                       'filter'        => 
(isset($values['filter'])?$values['filter']:''),
-                                                       'column'        => 
'project_id,p_number,level,title'
+                                                       'main'          => 
$values['main'],
+                                                       'filter'        => 
$values['filter'],
+                                                       'column'        => 
'project_id,p_number,level,title',
+                                                       'order'         => 
'title'
                                                ));
 
-                       if(is_array($pro) && isset($values['action']) && 
(($values['action'] == 'mains') || ($values['action'] == 'mainandsubs')))
-                       {
-                               usort($pro, array("soprojects", "cmp_pro"));
-                       }
-
-                       if(isset($values['self']) && $values['self'])
+                       if($values['self'])
                        {
                                for ($i=0;$i<count($pro);$i++)
                                {
@@ -379,7 +382,7 @@
                                foreach($pro as $p)
                                {
                                        $s .= '<option value="' . 
$p['project_id'] . '"';
-                                       if (isset($values['selected']) && 
$p['project_id'] == $values['selected'])
+                                       if ($p['project_id'] == 
$values['selected'])
                                        {
                                                $s .= ' selected';
                                        }
@@ -390,18 +393,13 @@
                                                $s .= '&nbsp;.&nbsp;';
                                        }
 
-                                       $s .= 
$GLOBALS['phpgw']->strip_html($p['title']) . ' [ ' . 
$GLOBALS['phpgw']->strip_html(isset($p['number'])?$p['number']:$p['p_number']) 
. ' ]';
+                                       $s .= 
$GLOBALS['phpgw']->strip_html($p['title']) . ' [ ' . 
$GLOBALS['phpgw']->strip_html($p['number']?$p['number']:$p['p_number']) . ' ]';
                                        $s .= '</option>';
                                }
                        }
                        return $formatted?$s:$pro;
                }
 
-               function cmp_pro ($a, $b) 
-               {
-               return strcasecmp($a['level'].$a['title'], 
$b['level'].$b['title']);
-               }
-
                function add_project($values)
                {                       
                        $values['descr']                        = 
$this->db->db_addslashes($values['descr']);
@@ -421,9 +419,9 @@
                        $values['e_budget']                     = 
$values['e_budget'] + 0.0;
                        $values['e_budget_childs']             = 
$values['e_budget_childs'] + 0.0;
                        $values['discount']                     = 
$values['discount'] + 0.0;
-                       $values['project_accounting_factor'] = 
(isset($values['project_accounting_factor'])?$values['project_accounting_factor']:0)
 + 0.0;
-                       $values['project_accounting_factor_d'] = 
(isset($values['project_accounting_factor_d'])?$values['project_accounting_factor_d']:0)
 + 0.0;
-                       $values['parent']                       = 
(isset($values['parent'])?intval($values['parent']):0);
+                       $values['project_accounting_factor'] = 
$values['project_accounting_factor'] + 0.0;
+                       $values['project_accounting_factor_d'] = 
$values['project_accounting_factor_d'] + 0.0;
+                       $values['parent']                       = 
intval($values['parent']);
 
                        if ($values['parent'] > 0)
                        {
@@ -437,17 +435,17 @@
                        $this->db->query('INSERT into phpgw_p_projects 
(owner,access,category,entry_date,start_date,end_date,coordinator,customer,status,'
                                                        . 
'descr,title,budget,budget_childs,p_number,parent,time_planned,time_planned_childs,date_created,processor,investment_nr,main,level,previous,'
                                                        . 
'customer_nr,url,reference,result,test,quality,accounting,acc_factor,acc_factor_d,billable,inv_method,psdate,pedate,priority,e_budget,e_budget_childs,
-                                                       
discount,discount_type,plan_bottom_up,customer_org,direct_work) VALUES ('
+                                                       
discount,discount_type,plan_bottom_up,customer_org,direct_work,salesmanager,acc_type)
 VALUES ('
                                                        . $this->account . ",'" 
. (isset($values['access'])?$values['access']:'public') . "'," . 
intval($values['cat']) . ',' . time() . ','
                                                        . 
intval($values['sdate']) . ',' . intval($values['edate']) . ',' . 
intval($values['coordinator']) . ',' . intval($values['customer']) . ",'"
                                                        . $values['status'] . 
"','" . $values['descr'] . "','" . $values['title'] . "'," . $values['budget'] 
. "," . $values['budget_childs'] . ",'" . $values['number'] . "',"
                                                        . $values['parent'] . 
',' . intval($values['ptime']) . ',' . intval($values['ptime_childs']) . ',' . 
time() . ',' . $this->account . ",'" . $values['investment_nr']
-                                                       . "'," . 
(isset($values['main'])?intval($values['main']):0) . ',' . 
(isset($values['level'])?intval($values['level']):0) . ',' . 
intval($values['previous']) . ",'"
+                                                       . "'," . 
intval($values['main']) . ',' . intval($values['level']) . ',' . 
intval($values['previous']) . ",'"
                                                        . 
$values['customer_nr'] . "','" . $values['url'] . "','" . $values['reference'] 
. "','" . $values['result'] . "','"
-                                                       . $values['test'] . 
"','" . $values['quality'] . "','" . 
(isset($values['accounting'])?$values['accounting']:'') . "'," . 
$values['project_accounting_factor']
-                                                       . ',' . 
$values['project_accounting_factor_d'] . ",'". (isset($values['billable']) && 
$values['billable']?'N':'Y') . "','" . $values['inv_method'] . "',"
+                                                       . $values['test'] . 
"','" . $values['quality'] . "','" . $values['accounting'] . "'," . 
$values['project_accounting_factor']
+                                                       . ',' . 
$values['project_accounting_factor_d'] . ",'". ($values['billable']?'Y':'N') . 
"','" . $values['inv_method'] . "',"
                                                        . 
intval($values['psdate']) . ',' . intval($values['pedate']) . ',' . 
intval($values['priority']) . ',' . $values['e_budget'] . ',' . 
$values['e_budget_childs'] . ','
-                                                       . $values['discount'] . 
",'" . $values['discount_type'] . "', '".$values['plan_bottom_up']."', 
".intval($values['customer_org']).", 
'".$values['direct_work']."')",__LINE__,__FILE__);
+                                                       . $values['discount'] . 
",'" . $values['discount_type'] . "', '".$values['plan_bottom_up']."', 
".intval($values['customer_org']).", '".$values['direct_work']."', 
'".intval($values['salesmanager'])."', 
'".$values['acc_type']."')",__LINE__,__FILE__);
 
                        $p_id = 
$this->db->get_last_insert_id($table,'project_id');
                        $this->db->unlock();
@@ -584,7 +582,7 @@
                        $values['url']                          = 
$this->db->db_addslashes($values['url']);
                        $values['reference']            = 
$this->db->db_addslashes($values['reference']);
                        $values['inv_method']           = 
$this->db->db_addslashes($values['inv_method']);
-                       $values['parent']                       = 
(isset($values['parent'])?intval($values['parent']):0);
+                       $values['parent']                       = 
intval($values['parent']);
                        $values['edate']                        = 
intval($values['edate']);
 
                        $values['budget']                       = 
$values['budget'] + 0.0;
@@ -592,21 +590,31 @@
                        $values['e_budget']                     = 
$values['e_budget'] + 0.0;
                        $values['e_budget_childs']             = 
$values['e_budget_childs'] + 0.0;
                        $values['discount']                     = 
$values['discount'] + 0.0;
-                       $values['project_accounting_factor'] = 
(isset($values['project_accounting_factor'])?$values['project_accounting_factor']:'')
 + 0.0;
-                       $values['project_accounting_factor_d'] = 
(isset($values['project_accounting_factor_d'])?$values['project_accounting_factor_d']:'')
 + 0.0;
-                       if(isset($values['billable']) && $values['billable'] == 
'N')
+                       $values['project_accounting_factor'] = 
$values['project_accounting_factor'] + 0.0;
+                       $values['project_accounting_factor_d'] = 
$values['project_accounting_factor_d'] + 0.0;
+
+                       if(is_string($values['billable']))
+                       {
+                               if($values['billable'] == 'N')
                        {
                                $values['billable'] = false;
                        }
-                       elseif(isset($values['billable']) && 
$values['billable'] == 'Y')
+                               else
                        {
                                $values['billable'] = true;
                        }
+                       }
+
+                       if(!is_string($values['acc_type']))
+                       {
+                               $values['acc_type'] = 'T';
+                       }
 
                        if (isset($values['old_parent']) && 
$values['old_parent'] != $values['parent'])
                        {
                                $this->reparent($values);
                        }
+
                        if (!isset($values['main']) || !isset($values['level']))
                        {
                                if ($values['parent'] > 0)
@@ -622,14 +630,14 @@
 
                        $this->db->query("UPDATE phpgw_p_projects set access='" 
. (isset($values['access'])?$values['access']:'public') . "', category=" . 
intval($values['cat']) . ", entry_date="
                                                        . time() . ", 
start_date=" . intval($values['sdate']) . ", end_date=" . $values['edate'] . ", 
coordinator="
-                                                       . 
intval($values['coordinator']) . ", customer=" . intval($values['customer']) . 
", status='" . $values['status'] . "', descr='"
+                                                       . 
intval($values['coordinator']) . ", 
salesmanager=".intval($values['salesmanager']).", customer=" . 
intval($values['customer']) . ", status='" . $values['status'] . "', descr='"
                                                        . $values['descr'] . 
"', title='" . $values['title'] . "', budget=" . $values['budget'] . ", 
budget_childs=" . $values['budget_childs'] . ", p_number='"
                                                        . $values['number'] . 
"', time_planned=" . intval($values['ptime']) . ", time_planned_childs=" . 
intval($values['ptime_childs']) . ', processor=' . $this->account . ", 
investment_nr='"
                                                        . 
$values['investment_nr'] . "', inv_method='" . $values['inv_method'] . "', 
parent=" . $values['parent'] . ', main=' . intval($values['main'])
-                                                       . ', level=' . 
(isset($values['level'])?intval($values['level']):0) . ', previous=' . 
intval($values['previous']) . ", customer_nr='" . $values['customer_nr']
+                                                       . ', level=' . 
intval($values['level']) . ', previous=' . intval($values['previous']) . ", 
customer_nr='" . $values['customer_nr']
                                                        . "', url='" . 
$values['url'] . "', reference='" . $values['reference'] . "', result='" . 
$values['result'] . "', test='"
-                                                       . $values['test'] . "', 
quality='" . $values['quality'] . "', accounting='" . 
(isset($values['accounting'])?$values['accounting']:'') . "', acc_factor="
-                                                       . 
$values['project_accounting_factor'] . ', acc_factor_d=' . 
$values['project_accounting_factor_d'] . ",billable='" . 
(isset($values['billable']) && $values['billable']?'N':'Y')
+                                                       . $values['test'] . "', 
quality='" . $values['quality'] . "', accounting='" . $values['accounting'] . 
"', acc_type='".$values['acc_type']."', acc_factor="
+                                                       . 
$values['project_accounting_factor'] . ', acc_factor_d=' . 
$values['project_accounting_factor_d'] . ",billable='" . 
($values['billable']?'Y':'N')
                                                        . "', discount_type='" 
. $values['discount_type'] . "',psdate=" . intval($values['psdate']) . ', 
pedate=' . intval($values['pedate']) . ', priority='
                                                        . 
intval($values['priority']) . ", e_budget=" . $values['e_budget'] . ", 
e_budget_childs=" . $values['e_budget_childs'] . ", discount=" . 
$values['discount'] .", plan_bottom_up='" . $values['plan_bottom_up']
                                                        . "', 
customer_org=".intval($values['customer_org']). ", direct_work='" . 
$values['direct_work'] . "' where project_id=" . 
$values['project_id'],__LINE__,__FILE__);
@@ -639,12 +647,12 @@
                                $this->db->query("Update phpgw_p_projects set 
status='archive' WHERE parent=" . $values['project_id'],__LINE__,__FILE__);
                        }
                        
-                       if(isset($values['oldstatus']) && $values['oldstatus'] 
== 'archive' && $values['status'] != 'archive')
+                       if($values['oldstatus'] && $values['oldstatus'] == 
'archive' && $values['status'] != 'archive')
                        {
                                $this->db->query("Update phpgw_p_projects set 
status='" . $values['status'] . "' WHERE parent=" . 
$values['project_id'],__LINE__,__FILE__);
                        }
 
-                       $values['old_edate'] = 
(isset($values['old_edate'])?intval($values['old_edate']):0);
+                       $values['old_edate'] = intval($values['old_edate']);
                        if ($values['old_edate'] > 0 && $values['edate'] > 0 && 
$values['old_edate'] != $values['edate'])
                        {
                                $this->db->query('SELECT 
project_id,title,p_number,start_date,end_date from phpgw_p_projects where 
previous=' . $values['project_id'],__LINE__,__FILE__);
@@ -727,7 +735,6 @@
                {
                        $pro_id         = intval($pro_id);
                        $account_id     = intval($account_id);
-                       $bla = '';
                        if ($action == 'act')
                        {                       
                                $this->db->query('SELECT a_number,descr from 
phpgw_p_activities where id=' . $pro_id,__LINE__,__FILE__);
@@ -754,14 +761,6 @@
                                        $bla = $this->db->f('charge_percent');
                                }
                        }
-                       else if($action == 'charge')
-                       {
-                               $this->db->query('SELECT charge_percent from 
phpgw_p_surcharges where charge_id=' . $pro_id,__LINE__,__FILE__);
-                               if($this->db->next_record())
-                               {
-                                       $bla = $this->db->f('charge_percent');
-                               }
-                       }
                        else
                        {
                                switch ($action)
@@ -789,6 +788,7 @@
                                        case 'direct_work':     $column = 
'direct_work'; break;
                                        case 'title':   $column = 'title'; 
break;
                                        case 'coordinator': $column = 
'coordinator'; break;
+                                       case 'cat': $column = 'category'; break;
                                }
 
                                $this->db->query('SELECT ' . $column . ' from 
phpgw_p_projects where project_id=' . $pro_id,__LINE__,__FILE__);
@@ -814,24 +814,31 @@
                function exists($params)
                {
                        $project_id     = intval($params['project_id']);
-                       $column_val     = 
isset($params['column_val'])?$params['column_val']:$project_id;
-                       $check          = 
isset($params['check'])?$params['check']:'project_id';
+                       $column_val     = 
$params['column_val']?$params['column_val']:$project_id;
+                       $check          = 
$params['check']?$params['check']:'project_id';
 
-                       $editexists = '';
                        switch($check)
                        {
                                case 'number':
                                        $column = 'p_number';
+                                       $equal  = '=';
                                        if ($project_id > 0)
                                        {
                                                $editexists = ' and project_id 
!=' . $project_id;
                                        }
                                        break;
+                               case 'main_project_number':
+                                       $column     = 'p_number';
+                                       $equal      = ' LIKE ';
+                                       $editexists = ' and parent = 0 and main 
!= '.$project_id;
+                                       break;
                                case 'parent':
                                        $column = 'parent';
+                                       $equal  = '=';
                                        break;
                                default:
                                        $column = 'project_id';
+                                       $equal  = '=';
                        }
                        $this->db->query('SELECT count(*) from phpgw_p_projects 
where ' . $column . '=' . $column_val . $editexists,__LINE__,__FILE__);
                        $this->db->next_record();
@@ -1024,17 +1031,9 @@
                        if ($account_id > 0)
                        {
                                $this->db->query('delete from phpgw_categories 
where cat_owner=' . $account_id . " AND 
cat_appname='projects'",__LINE__,__FILE__);
-
-                               $this->db->query('delete from phpgw_acl where 
acl_account=' . $account_id . " AND (acl_appname='project_members' OR 
acl_appname='project_admin' "
-                                                               . "OR 
acl_appname='project_salesman')",__LINE__,__FILE__);
-
-                               $this->db->query('delete from 
phpgw_p_projectmembers where account_id=' . $account_id,__LINE__,__FILE__);
-
                                $this->db->query('delete from phpgw_p_hours 
where employee=' . $account_id,__LINE__,__FILE__);
-                               $this->db->query('delete from phpgw_p_ttracker 
where employee=' . $account_id,__LINE__,__FILE__);
-
-                               /* needs work to avoid deleting project if subs 
with different coordinator */
                                $this->db->query('select project_id from 
phpgw_p_projects where coordinator=' . $account_id,__LINE__,__FILE__);
+
                                while ($this->db->next_record())
                                {
                                        $drop_list[] = 
$this->db->f('project_id');
@@ -1046,8 +1045,10 @@
 //                                     _debug_array($drop_list);
 //                                     exit;
 
-                                       $this->db->query('DELETE from 
phpgw_p_projects where project_id in (' . implode(',',$drop_list) . 
')',__LINE__,__FILE__);
-                                       $this->db->query('DELETE from 
phpgw_p_mstones where project_id in (' . implode(',',$drop_list) . 
')',__LINE__,__FILE__);
+                                       $subdelete = ' OR parent in (' . 
implode(',',$drop_list) . ')';
+
+                                       $this->db->query('DELETE from 
phpgw_p_projects where project_id in (' . implode(',',$drop_list) . ')'
+                                                                       . 
$subdelete,__LINE__,__FILE__);
 
                                        $this->db->query('select id from 
phpgw_p_delivery where project_id in (' . implode(',',$drop_list) . 
')',__LINE__,__FILE__);
 
@@ -1100,17 +1101,10 @@
 
                        $this->db->query('UPDATE phpgw_p_projects set 
coordinator=' . $new . ' where coordinator=' . $old,__LINE__,__FILE__);
                        $this->db->query('UPDATE phpgw_p_hours set employee=' . 
$new . ' where employee=' . $old,__LINE__,__FILE__);
-                       $this->db->query('UPDATE phpgw_p_ttracker set 
employee=' . $new . ' where employee=' . $old,__LINE__,__FILE__);
-
-                       $this->db->query('UPDATE phpgw_p_projectmembers set 
account_id=' . $new . ' where (account_id=' . $old . " AND 
type='role')",__LINE__,__FILE__);
-
+                       $this->db->query('UPDATE phpgw_p_projectmembers set 
account_id=' . $new . ' where (account_id=' . $old . " AND 
type='aa')",__LINE__,__FILE__);
                        $this->db->query('UPDATE phpgw_p_invoice set owner=' . 
$new . ' where owner=' . $old,__LINE__,__FILE__);
                        $this->db->query('UPDATE phpgw_p_delivery set owner=' . 
$new . ' where owner=' . $old,__LINE__,__FILE__);
-
                        $this->db->query('UPDATE phpgw_categories set 
cat_owner=' . $new . ' where cat_owner=' . $old . " AND 
cat_appname='projects'",__LINE__,__FILE__);
-
-                       $this->db->query('UPDATE phpgw_acl set acl_account=' . 
$new . ' where acl_account=' . $old . " AND (acl_appname='project_members' OR 
acl_appname='project_admin' "
-                                                       . "OR 
acl_appname='project_salesman')",__LINE__,__FILE__);
                }
 
 
@@ -1233,7 +1227,6 @@
                {
                        $this->db->query("SELECT * FROM phpgw_p_mstones WHERE 
project_id=" . intval($project_id),__LINE__,__FILE__);
 
-                       $stones = false;
                        while($this->db->next_record())
                        {
                                $stones[] = array
@@ -1288,10 +1281,9 @@
 
                function get_acl_projects()
                {
-                       $this->db->query("SELECT acl_location from phpgw_acl 
where acl_appname = 'project_members' and acl_rights=7 and acl_account="
-                                                               . 
$this->account,__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__);
 
-                       $projects = false;
                        while($this->db->next_record())
                        {
                                $projects[] = $this->db->f(0);
@@ -1366,14 +1358,12 @@
                {
                        $project_id = intval($data['project_id']);
                        $column         = 
isset($data['column'])?$data['column']:'*';
-                       $account_id     = 
(isset($data['account_id'])?intval($data['account_id']):'');
-                       $event_type     = 
(isset($data['event_type'])?$data['event_type']:'');
+                       $account_id     = intval($data['account_id']);
+                       $event_type     = 
$data['event_type']?$data['event_type']:'';
 
                        //echo 'SOPROJECTS->read->employee_roles: DATA ';
                        //_debug_array($data);
 
-                       $emp_select = '';
-                       $roles = false;
                        if($account_id > 0)
                        {
                                $emp_select = ' and account_id=' . $account_id;
@@ -1408,7 +1398,7 @@
                                        $event_type = explode(',',$event_type);
                                }
 
-                               for($i=0;$i<count($event_type);$i++)
+                               for($i=0;$i<=count($event_type);$i++)
                                {
                                        $event_id = $this->item2id(array('item' 
=> $event_type[$i]));
 
@@ -1426,7 +1416,7 @@
                                                }
                                        }
                                }
-                               $roles = (isset($eroles) && 
is_array($eroles)?$eroles:False);
+                               $roles = is_array($eroles)?$eroles:False;
                        }
 
                        //echo 'SOPROJECTS->read_employee_roles: ROLES ';
@@ -1531,15 +1521,15 @@
 
                function plan_bottom_up_set_job_setting($main_project_id, 
$plan_bottom_up)
                {
-                       $this->db->query("UPDATE phpgw_p_projects SET 
plan_bottom_up='" . $plan_bottom_up . "' WHERE main=" . $main_project_id, 
__LINE__,__FILE__);
+                       $this->db->query('UPDATE phpgw_p_projects SET 
plan_bottom_up="' . $plan_bottom_up . '" WHERE main=' . $main_project_id, 
__LINE__,__FILE__);
                }
                
                function direct_work_set_job_setting($main_project_id, 
$direct_work)
                {
-                       $this->db->query("UPDATE phpgw_p_projects SET 
direct_work='" . $direct_work . "' WHERE main=" . $main_project_id, 
__LINE__,__FILE__);
+                       $this->db->query('UPDATE phpgw_p_projects SET 
direct_work="' . $direct_work . '" WHERE main=' . $main_project_id, 
__LINE__,__FILE__);
                }
 
-               function get_projects_tree($mainProject = null, $fields = 
array('project_id', 'parent', 'title', 'p_number', 'direct_work', 'p_number', 
'end_date', 'customer_org'), $employee=-1)
+               function get_projects_tree($mainProject = null, $fields = 
array('project_id', 'parent', 'title', 'p_number', 'direct_work', 'end_date', 
'customer_org', 'status'), $employee=-1)
                {
                        if($employee == -1)
                        {
@@ -1555,10 +1545,16 @@
                        //elseif($this->member)
                        if($this->member)
                        {
+/*
                                $this->db->query('SELECT '.implode($fields, 
',').' FROM phpgw_p_projects '.
-                                                "WHERE status = 'active' AND 
(".
+                                                'WHERE (status = "active" OR 
status = "nonactive") AND ('.
                                                        'coordinator = 
'.$employee.' OR '.
-                                                       "(access != 'private' 
AND project_id in(" . implode(',',$this->member) . '))) ');
+                                                       '(access != "private" 
AND project_id IN(' . implode(',',$this->member) . ')))');
+*/
+                               $this->db->query('SELECT * FROM 
phpgw_p_projects '.
+                                                'WHERE ('.
+                                                       'coordinator = 
'.$employee. " OR "
+                                                       ."(access != 'private' 
AND project_id IN(" . implode(',',$this->member) . ')))');
                        }
                        else
                        {
@@ -1568,29 +1564,30 @@
                        $i = 0;
                        while($this->db->next_record())
                        {
-                               $projects[$i]['id']            = 
$this->db->f(0);
-                               $projects[$i]['parent']        = 
$this->db->f(1);
-                               $projects[$i]['title']         = 
$this->db->f(2);
-                               $projects[$i]['direct']        = 
$this->db->f(4);
-                               $projects[$i]['pnumber']       = 
$this->db->f(5);
-                               $projects[$i]['enddate']       = 
$this->db->f(6);
+                               $projects[$i]['id']            = 
$this->db->f('project_id');
+                               $projects[$i]['parent']        = 
$this->db->f('parent');
+                               $projects[$i]['title']         = 
$this->db->f('title');
+                               $projects[$i]['direct']        = 
$this->db->f('direct_work');
+                               $projects[$i]['pnumber']       = 
$this->db->f('p_number');
+                               $projects[$i]['enddate']       = 
$this->db->f('end_date');
                                $projects[$i]['customer_org']  = 
$this->db->f('customer_org');
+                               $projects[$i]['status']        = 
$this->db->f('status');
                                
-                               if($this->db->f(9) > 0)
+                               if($this->db->f('acc_factor') > 0)
                                {
-                                       $projects[$i]['budget_factor'] = 
$this->db->f(9);
+                                       $projects[$i]['budget_factor'] = 
$this->db->f('acc_factor');
                                }
                                else
                                {
-                                       $projects[$i]['budget_factor'] = 
$this->db->f(10) / 8;
+                                       $projects[$i]['budget_factor'] = 
$this->db->f('acc_factor_d') / 8;
                                }
-                               if($this->db->f(7) > 0)
+                               if($this->db->f('time_planned') > 0)
                                {
-                                       $projects[$i]['budget'] = 
$this->db->f(7) * $projects[$i]['budget_factor'] / 60;
+                                       $projects[$i]['budget'] = 
$this->db->f('time_planned') * $projects[$i]['budget_factor'] / 60;
                                }
                                else
                                {
-                                       $projects[$i]['budget'] = 
$this->db->f(8);
+                                       $projects[$i]['budget'] = 
$this->db->f('budget');
                                }
                                ++$i;
                        }
@@ -1598,14 +1595,15 @@
                        $this->tmp = $projects;
                        for($i = 0; $i < count($projects); ++$i)
                        {
-                               $presort = $projects[$i]['direct'] == 'Y' ? '1' 
: '2';
+                               //$presort = $projects[$i]['direct'] == 'Y' ? 
'1' : '2';
                                //echo 
$presort.'.'.$this->get_tree_index($projects[$i]['id'], 
$projects[$i]['parent'])."<br>";
                                $index = 
$this->get_tree_index($projects[$i]['id'], $projects[$i]['parent']);
                                $indexparts = explode('.', $index);
 
                                if(!$mainProject || array_search((int) 
$mainProject, $indexparts) !== FALSE)
                                {
-                                       $projectstree[$presort.'.'.$index] = 
$projects[$i];
+                                       //$projectstree[$presort.'.'.$index] = 
$projects[$i];
+                                       $projectstree['0.'.$index] = 
$projects[$i];
                                }
                        }
                        ksort($projectstree);
@@ -1652,13 +1650,15 @@
                *
                * @param integer $month Month for which to get the project hours
                * @param integer $year Year for which to get the project hours
+               * @param integer $location_id primary key of location for which 
to get the cost accounting
                * @return array Project hours for different "credit cost 
centres"
                * divided inot project hours and travel hours. 
$result[$cost_centre]['project']; 
                * $result[$cost_centre]['travel']
                */
-               function get_project_hours($month,$year)
+               function get_project_hours($month,$year,$location_id)
                {
-                       $this->db->query("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 ((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", 
__LINE__,__FILE__);
+                       $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())

Index: inc/class.sostatistics.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/class.sostatistics.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- inc/class.sostatistics.inc.php      8 Apr 2005 15:52:58 -0000       1.13
+++ inc/class.sostatistics.inc.php      5 Dec 2006 19:40:45 -0000       1.14
@@ -3,10 +3,10 @@
        * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: class.sostatistics.inc.php,v 1.13 2005/04/08 15:52:58 
ceb Exp $
+       * @version $Id: class.sostatistics.inc.php,v 1.14 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/class.sostatistics.inc.php,v $
        */
 

Index: inc/class.uiconfig.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/class.uiconfig.inc.php,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- inc/class.uiconfig.inc.php  27 Nov 2006 21:52:57 -0000      1.36
+++ inc/class.uiconfig.inc.php  5 Dec 2006 19:40:45 -0000       1.37
@@ -3,10 +3,10 @@
        * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: class.uiconfig.inc.php,v 1.36 2006/11/27 21:52:57 
sigurdne Exp $
+       * @version $Id: class.uiconfig.inc.php,v 1.37 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: /sources/phpgroupware/projects/inc/class.uiconfig.inc.php,v $
        */
 
@@ -25,19 +25,20 @@
                        'list_activities'                               => True,
                        'list_admins'                                   => True,
                        'list_roles'                                    => True,
-                       'list_employees'                                => True,
+                       'config_accounting'       => True,
                        'edit_admins'                                   => True,
                        //'abook'                                               
        => True,
                        'preferences'                                   => True,
                        'delete_pa'                                             
=> True,
-                       'list_employees'                                => True,
                        'list_events'                                   => True,
                        'edit_employee_factor'                  => True,
                        'list_surcharges'                               => True,
                        'config_worktime_statusmail'    => True,
                        'config_workhours_booking'              => True,
                        'config_worktime_warnmail'              => True,
-                       'config_proid_help_msg'                 => True
+                       'config_proid_help_msg'       => True,
+                       'config_employees'            => True,
+                       'config_locations'            => True
                );
 
                function uiconfig()
@@ -79,9 +80,9 @@
 
                function set_app_langs()
                {
-                       
$GLOBALS['phpgw']->template->set_var('th_bg',(isset($GLOBALS['phpgw_info']['theme']['th_bg'])?$GLOBALS['phpgw_info']['theme']['th_bg']:''));
-                       
$GLOBALS['phpgw']->template->set_var('row_on',(isset($GLOBALS['phpgw_info']['theme']['row_on'])?$GLOBALS['phpgw_info']['theme']['row_on']:''));
-                       
$GLOBALS['phpgw']->template->set_var('row_off',(isset($GLOBALS['phpgw_info']['theme']['row_off'])?$GLOBALS['phpgw_info']['theme']['row_off']:''));
+                       
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
+                       
$GLOBALS['phpgw']->template->set_var('row_on',$GLOBALS['phpgw_info']['theme']['row_on']);
+                       
$GLOBALS['phpgw']->template->set_var('row_off',$GLOBALS['phpgw_info']['theme']['row_off']);
 
                        
$GLOBALS['phpgw']->template->set_var('lang_category',lang('Category'));
                        
$GLOBALS['phpgw']->template->set_var('lang_select',lang('Select'));
@@ -100,6 +101,7 @@
                        
$GLOBALS['phpgw']->template->set_var('lang_access',lang('access'));
 
                        
$GLOBALS['phpgw']->template->set_var('lang_projects',lang('Projects'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_jobs',lang('Jobs'));
                        
$GLOBALS['phpgw']->template->set_var('lang_ttracker',lang('time tracker'));
                        
$GLOBALS['phpgw']->template->set_var('lang_archiv',lang('archive'));
                        
$GLOBALS['phpgw']->template->set_var('lang_statistics',lang('Statistics'));
@@ -163,8 +165,7 @@
                        
$GLOBALS['phpgw']->template->set_var('opt_weekly_desc',lang('weekly'));
                        
$GLOBALS['phpgw']->template->set_var('opt_monthly_desc',lang('monthly'));
 
-                       
$GLOBALS['phpgw']->template->set_var('lang_admins',lang('project 
administrators'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_salesmen',lang('sales department'));
+                       
$GLOBALS['phpgw']->template->set_var('cc_receiver',lang('cc-reciever 
(separating through commas)'));
                }
 
                function display_app_header()
@@ -184,8 +185,8 @@
                                                        
$GLOBALS['phpgw']->template->set_var('lang_accounting',lang('Activities'));
                                                        break;
                                                default:
-                                                       
$GLOBALS['phpgw']->template->set_var('link_accounting',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_employees','action'=>'accounting')));
-                                                       
$GLOBALS['phpgw']->template->set_var('lang_accounting',lang('Accounting'));
+                                                       
//$GLOBALS['phpgw']->template->set_var('link_accounting',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_accounting','action'=>'accounting')));
+                                                       
//$GLOBALS['phpgw']->template->set_var('lang_accounting',lang('Accounting'));
                                        }
                                        
$GLOBALS['phpgw']->template->fp('admin_header','projects_admin_header');
                                }
@@ -202,6 +203,7 @@
                        $this->set_app_langs();
                        $GLOBALS['phpgw']->common->phpgw_header();
                        echo parse_navbar();
+                       $GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
                }
 
                function accounts_popup()
@@ -234,25 +236,37 @@
                        return $s;
                }
 
-               function list_employees()
+               function config_accounting()
                {
                        $id                     = $_GET['id'];
                        $values         = $_POST['values'];
+                       $done           = $_POST['done'];
                        $sdate          = get_var('sdate',array('GET','POST'));
                        $edate          = get_var('edate',array('GET','POST'));
 
+                       if($done)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+                       }
+
                        $link_data = array
                        (
-                               'menuaction'    => 
'projects.uiconfig.list_employees',
+                               'menuaction'    => 
'projects.uiconfig.config_accounting',
                                'action'                => 'accounting'
                        );
 
                        $jscal = CreateObject('phpgwapi.jscalendar');
 
+                       if(!$values['sdate'])
+                       {
+                               $values['sdate'] = mktime(0, 0, 0);
+                       }
+
                        if (!is_numeric($values['cost_centre']))
                        {
                                $values['cost_centre'] = 0;
                        }
+
                        if (!is_numeric($values['weekly_workhours']))
                        {
                                $values['weekly_workhours'] = 40;
@@ -266,12 +280,17 @@
                                        $start_array            = 
$jscal->input2date($sdate['str']);
                                        $values['sdate']        = 
$start_array['raw'];
                                }
+
                                //_debug_array($start_array);
-                               if(is_array($edate))
+                               if(isset($edate['str']) && ($edate['str'] != 
''))
                                {
                                        $end_array                      = 
$jscal->input2date($edate['str']);
                                        $values['edate']        = 
intval($end_array['raw']) + 86399; // 23:59:59 for enddate
                                }
+                               else
+                               {
+                                       $values['edate'] = '';
+                               }
 
                                $error = 
$this->boconfig->check_pa_values($values,'accounting');
                                if(is_array($error))
@@ -292,15 +311,15 @@
                        }
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . lang('accounting');
-
-                       $this->display_app_header();
+                       $GLOBALS['phpgw']->common->phpgw_header();
+                       echo parse_navbar();
+                       $GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
+                       $this->set_app_langs();
 
                        
$GLOBALS['phpgw']->template->set_file(array('emp_list_t' => 
'list_employees.tpl'));
                        
$GLOBALS['phpgw']->template->set_block('emp_list_t','emp_list','list');
                        
$GLOBALS['phpgw']->template->set_block('emp_list_t','emp_tframe','flist');
 
-                       
//$GLOBALS['phpgw']->template->set_var('search_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
-                       
//$GLOBALS['phpgw']->template->set_var('search_list',$this->nextmatchs->search(array('query'
 => $this->query)));
                        
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
 
                        $emps = $this->boconfig->read_accounting_factors();
@@ -328,7 +347,10 @@
                        
$GLOBALS['phpgw']->template->set_var('currency',$GLOBALS['phpgw_info']['user']['preferences']['common']['currency']);
 
                        
$GLOBALS['phpgw']->template->set_var('lang_accounting',lang('accounting'));
+                       $GLOBALS['phpgw']->template->set_var('lang_location', 
lang('location'));
+
 // -------------------------- end header declaration 
--------------------------------------
+                       $emp_exists = array();
 
                        if(is_array($emps))
                        {
@@ -336,6 +358,16 @@
                                {
                                        
$this->nextmatchs->template_alternate_row_class($GLOBALS['phpgw']->template);
 
+                                       $emp_exists[$emps[$i]['account_id']] = 
true;
+                                       
if(isset($emps[$i]['location']['location_id']))
+                                       {
+                                               $location_name = 
$emps[$i]['location']['location_name'];
+                                       }
+                                       else
+                                       {
+                                               $location_name = '';
+                                       }
+                                       
                                        
$GLOBALS['phpgw']->template->set_var(array
                                        (
                                                'emp_name'                      
        => $emps[$i]['account_name'],
@@ -344,8 +376,9 @@
                                                'sdate_formatted'               
=> $emps[$i]['sdate_formatted'],
                                                'edate_formatted'               
=> $emps[$i]['edate_formatted'],
                                                'weekly_workhours_num'  => 
$emps[$i]['weekly_workhours'],
+                                               'location_name'        => 
$location_name,
                                                'cost_centre_num'               
=> $emps[$i]['cost_centre'],
-                                               'delete_emp'                    
=> 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_employees',
+                                               'delete_emp'                    
=> 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_accounting',
                                                                                
                                                                                
                                'id'=> $emps[$i]['id'],
                                                                                
                                                                                
                                'delete'=>'True')),
                                                'delete_img'                    
=> $GLOBALS['phpgw']->common->image('phpgwapi','delete'),
@@ -362,13 +395,43 @@
                        
$GLOBALS['phpgw']->template->set_var('d_accounting',$values['d_accounting']);
                        
$GLOBALS['phpgw']->template->set_var('weekly_workhours_num',$values['weekly_workhours']);
                        
$GLOBALS['phpgw']->template->set_var('cost_centre_num',$values['cost_centre']);
-                       
$GLOBALS['phpgw']->template->set_var('lang_add_factor',lang('add factor'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_add_factor',lang('add'));
                        
$GLOBALS['phpgw']->template->set_var('emp_select',$this->employee_format($values['account_id']));
 
+                       $location_select = '<option value="0"></option>';
+                       $locations = $this->boconfig->get_locations();
+                       foreach($locations as $location)
+                       {
+                               if($values['location_id'] == 
$location['location_id'])
+                               {
+                                       $selected = ' selected="selected"';
+                               }
+                               else
+                               {
+                                       $selected = '';
+                               }
+                               $location_select .= '<option 
value="'.$location['location_id'].'"'.$selected.'>'.$location['location_name'].'</option>';
+                       }
+
+                       $GLOBALS['phpgw']->template->set_var('location_select', 
$location_select);
+
                        
$GLOBALS['phpgw']->template->set_var('sdate_select',$jscal->input('sdate[str]',$values['sdate']));
                        
$GLOBALS['phpgw']->template->set_var('edate_select',$jscal->input('edate[str]',$values['edate']));
 
-                       // button for showing monthly diamant data
+                       $all_emps = $this->boconfig->selected_employees();
+                       $missing_emps = '';
+                       while (is_array($all_emps) && (list($null,$account) = 
each($all_emps)))
+                       {
+                               if(isset($emp_exists[$account['account_id']]))
+                               {
+                                       continue;
+                               }
+
+                               $fullname = 
$GLOBALS['phpgw']->common->display_fullname($account['account_lid'],$account['account_firstname'],$account['account_lastname']);
+                               $missing_emps .= '<option 
value="'.$account['account_id'].'">'.$fullname.'</option>';
+                       }
+                       
$GLOBALS['phpgw']->template->set_var('lang_employees_not_in_list', 
lang('employee without entry'));
+                       
$GLOBALS['phpgw']->template->set_var('employees_not_in_list', $missing_emps);
 
                        $this->save_sessiondata('accounting');
                        $GLOBALS['phpgw']->template->set_var('flist','');
@@ -379,8 +442,20 @@
                {
                        $id                     = 
get_var('id',array('GET','POST'));
                        $values         = $_POST['values'];
+                       $cancel         = $_POST['cancel'];
                        $sdate          = get_var('sdate',array('GET','POST'));
                        $edate          = get_var('edate',array('GET','POST'));
+                       $location       = 
get_var('location',array('GET','POST'));
+
+                       if($cancel)
+                       {
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'projects.uiconfig.config_accounting'
+                               );
+                               $action_url = 
$GLOBALS['phpgw']->link('/index.php',$link_data);
+                               $GLOBALS['phpgw']->redirect($action_url);
+                       }
 
                        $link_data = array
                        (
@@ -397,11 +472,15 @@
                                        $values['sdate']        = 
$start_array['raw'];
                                }
                                //_debug_array($start_array);
-                               if(is_array($edate))
+                               if(isset($edate['str']) && ($edate['str'] != 
''))
                                {
                                        $end_array                      = 
$jscal->input2date($edate['str']);
                                        $values['edate']        = 
$end_array['raw'] + 86399; // 23:59:59 for enddate;
                                }
+                               else
+                               {
+                                       $values['edate'] = '';
+                               }
                                $values['id'] = $id;
                                //_debug_array($values);
                                $error = 
$this->boconfig->check_pa_values($values,'accounting');
@@ -412,14 +491,16 @@
                                else
                                {
                                        
$this->boconfig->save_accounting_factor($values);
-                                       $link_data['menuaction'] = 
'projects.uiconfig.list_employees';
+                                       $link_data['menuaction'] = 
'projects.uiconfig.config_accounting';
                                        
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                                }
                        }
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . lang('accounting');
-
-                       $this->display_app_header();
+                       $GLOBALS['phpgw']->common->phpgw_header();
+                       echo parse_navbar();
+                       $GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
+                       $this->set_app_langs();
 
                        $GLOBALS['phpgw']->template->set_file(array('emp_form' 
=> 'form_emp_factor.tpl'));
                        
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
@@ -436,9 +517,36 @@
                        
$GLOBALS['phpgw']->template->set_var('cost_centre',lang('cost centre'));
                        
$GLOBALS['phpgw']->template->set_var('weekly_workhours_num',$values['weekly_workhours']);
                        
$GLOBALS['phpgw']->template->set_var('cost_centre_num',$values['cost_centre']);
-                       
$GLOBALS['phpgw']->template->set_var('emp_select',$this->employee_format($values['account_id']));
+                       
$GLOBALS['phpgw']->template->set_var('lang_location',lang('location'));
+                       
+                       $location_select = '<option value="0"></option>';
+                       $locations = $this->boconfig->get_locations();
+                       foreach($locations as $location)
+                       {
+                               if($values['location_id'] == 
$location['location_id'])
+                               {
+                                       $selected = ' selected="selected"';
+                               }
+                               else
+                               {
+                                       $selected = '';
+                               }
+                               $location_select .= '<option 
value="'.$location['location_id'].'"'.$selected.'>'.$location['location_name'].'</option>';
+                       }
+                       
+                       
$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);
+                       $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']));
+
+                       if($values['edate'] == 0)
+                       {
+                               $values['edate'] = '';
+                       }
                        
$GLOBALS['phpgw']->template->set_var('edate_select',$jscal->input('edate[str]',$values['edate']));
 
                        $GLOBALS['phpgw']->template->pfp('out','emp_form',True);
@@ -508,9 +616,6 @@
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . lang('list activities');
                        $this->display_app_header();
-                       unset($GLOBALS['phpgw']->template->file);
-                       unset($GLOBALS['phpgw']->template->varkeys);
-                       unset($GLOBALS['phpgw']->template->varvals);
 
                        
$GLOBALS['phpgw']->template->set_file(array('activities_list_t' => 
'listactivities.tpl'));
                        
$GLOBALS['phpgw']->template->set_block('activities_list_t','activities_list','list');
@@ -539,7 +644,7 @@
             
$GLOBALS['phpgw']->template->set_var('search_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
             
$GLOBALS['phpgw']->template->set_var('search_list',$this->nextmatchs->search(array('query'
 => $this->query)));
 
-                       
switch((isset($this->siteconfig['activity_bill'])?$this->siteconfig['activity_bill']:''))
+                       switch($prefs['bill'])
                        {
                                case 'wu':      $bill = lang('Bill per 
workunit'); break;
                                case 'h':       $bill = lang('Bill per hour'); 
break;
@@ -553,7 +658,7 @@
                        
$GLOBALS['phpgw']->template->set_var('sort_descr',$this->nextmatchs->show_sort_order($this->sort,'descr',$this->order,'/index.php',lang('Description')));
                        
$GLOBALS['phpgw']->template->set_var('sort_billperae',$this->nextmatchs->show_sort_order($this->sort,'billperae',$this->order,'/index.php',$bill));
 
-                       if (isset($this->siteconfig['activity_bill']) && 
$this->siteconfig['activity_bill'] == 'wu')
+                       if ($prefs['bill'] == 'wu')
                        {
                                
$GLOBALS['phpgw']->template->set_var('sort_minperae','<td width="10%" 
align="right">' . $this->nextmatchs->show_sort_order($this->sort,'minperae',
                                                                        
$this->order,'/index.php',lang('Minutes per workunit') . '</td>'));
@@ -576,7 +681,7 @@
                                                                                
'descr' => $descr,
                                                                        
'billperae' => $act[$i]['billperae']));
 
-                               if (isset($this->siteconfig['activity_bill']) 
&& $this->siteconfig['activity_bill'] == 'wu')
+                               if ($prefs['bill'] == 'wu')
                                {
                                        
$GLOBALS['phpgw']->template->set_var('minperae','<td align="right">' . 
$act[$i]['minperae'] . '</td>');
                                }
@@ -621,7 +726,7 @@
                                'action'                => 'act'
                        );
 
-                       if (isset($_POST['save']) && $_POST['save'])
+                       if ($_POST['save'])
                        {
                                $this->cat_id                   = 
($values['cat']?$values['cat']:'');
                                $values['activity_id']  = $activity_id;
@@ -638,7 +743,7 @@
                                }
                        }
 
-                       if(isset($_POST['cancel']) && $_POST['cancel'])
+                       if($_POST['cancel'])
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
@@ -670,37 +775,37 @@
                        }
 
                        
$GLOBALS['phpgw']->template->set_var('cats_list',$this->boconfig->boprojects->cats->formatted_list('select','all',$this->cat_id,True));
-                       
$GLOBALS['phpgw']->template->set_var('num',$GLOBALS['phpgw']->strip_html((isset($values['number'])?$values['number']:'')));
-                       $descr  = 
$GLOBALS['phpgw']->strip_html((isset($values['descr'])?$values['descr']:''));
+                       
$GLOBALS['phpgw']->template->set_var('num',$GLOBALS['phpgw']->strip_html($values['number']));
+                       $descr  = 
$GLOBALS['phpgw']->strip_html($values['descr']);
                        if (! $descr) $descr = '&nbsp;';
                        $GLOBALS['phpgw']->template->set_var('descr',$descr);
 
-                       if (isset($values['remarkreq']) && $values['remarkreq'] 
== 'N'):
+                       if ($values['remarkreq'] == 'N'):
                                $stat_sel[0]=' selected';
-                       elseif (isset($values['remarkreq']) && 
$values['remarkreq'] == 'Y'):
+                       elseif ($values['remarkreq'] == 'Y'):
                                $stat_sel[1]=' selected';
                        endif;
 
-                       $remarkreq_list = '<option value="N"' . 
(isset($stat_sel[0])?$stat_sel[0]:'') . '>' . lang('No') . '</option>' . "\n"
-                                       . '<option value="Y"' . 
(isset($stat_sel[1])?$stat_sel[1]:'') . '>' . lang('Yes') . '</option>' . "\n";
+                       $remarkreq_list = '<option value="N"' . $stat_sel[0] . 
'>' . lang('No') . '</option>' . "\n"
+                                       . '<option value="Y"' . $stat_sel[1] . 
'>' . lang('Yes') . '</option>' . "\n";
 
                        
$GLOBALS['phpgw']->template->set_var('remarkreq_list',$remarkreq_list);
 
-                       if (isset($this->siteconfig['activity_bill']) && 
$this->siteconfig['activity_bill'] == 'wu')
+                       if ($prefs['bill'] == 'wu')
                        {
                        
$GLOBALS['phpgw']->template->set_var('lang_billperae',lang('Bill per 
workunit'));
                                
$GLOBALS['phpgw']->template->set_var('lang_minperae',lang('Minutes per 
workunit'));
-                               
$GLOBALS['phpgw']->template->set_var('minperae','<input type="text" 
name="values[minperae]" value="' . 
(isset($values['minperae'])?$values['minperae']:'') . '">');
+                               
$GLOBALS['phpgw']->template->set_var('minperae','<input type="text" 
name="values[minperae]" value="' . $values['minperae'] . '">');
                        }
                        else
                        {
                        
$GLOBALS['phpgw']->template->set_var('lang_billperae',lang('Bill per hour'));
                        }
 
-                       
$GLOBALS['phpgw']->template->set_var('billperae',(isset($values['billperae'])?$values['billperae']:''));
+                       
$GLOBALS['phpgw']->template->set_var('billperae',$values['billperae']);
 
                        $link_data['menuaction']        = 
'projects.uiconfig.delete_pa';
-                       $link_data['pa_id']     = 
(isset($values['activity_id'])?$values['activity_id']:'');
+                       $link_data['pa_id']     = $values[$i]['activity_id'];
                        
$GLOBALS['phpgw']->template->set_var('deleteurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
                        
$GLOBALS['phpgw']->template->set_var('lang_delete',lang('Delete'));
 
@@ -718,45 +823,37 @@
                                'action'                => $action
                        );
 
-                       if (isset($_POST['add']) && $_POST['add'])
+                       if ($_POST['add'])
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
 
-                       if (isset($_POST['done']) && $_POST['done'])
+                       if ($_POST['done'])
                        {
                                
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
                        }
 
                        switch($action)
                        {
-                               case 'project_salesman':        $header_info    
        = lang('salesmen list'); 
-                                                                               
        $selected_salesman      = ' SELECTED';
-                                                                               
        break;
-                               default:                                        
$header_info    = lang('administrator list');
-                                                                               
        $selected_admin = ' SELECTED';
-                                                                               
        break;
+                               case 'psale':           $header_info = 
lang('salesmen list'); break;
+                               case 'pmanager':        $header_info = 
lang('manager list'); break;
+                               default:                        $header_info = 
lang('administrator list'); break;
                        }
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . $header_info;
-                       $GLOBALS['phpgw']->common->phpgw_header(True);
+                       $GLOBALS['phpgw']->common->phpgw_header();
+                       echo parse_navbar();
                        $GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
-                       unset($GLOBALS['phpgw']->template->file);
-                       unset($GLOBALS['phpgw']->template->varkeys);
-                       unset($GLOBALS['phpgw']->template->varvals);
-
                        $this->set_app_langs();
 
                        
$GLOBALS['phpgw']->template->set_file(array('admin_list_t' => 
'list_admin.tpl'));
                        
$GLOBALS['phpgw']->template->set_block('admin_list_t','admin_list','list');
                        
$GLOBALS['phpgw']->template->set_block('admin_list_t','group_list','glist');
-                       
$GLOBALS['phpgw']->template->set_block('admin_list_t','group_th','gth');
 
+                       
$GLOBALS['phpgw']->template->set_var('search_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
                        
$GLOBALS['phpgw']->template->set_var('search_list',$this->nextmatchs->search(array('query'
 => $this->query)));
                        $link_data['menuaction'] = 
'projects.uiconfig.list_admins';
                        
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
-                       
$GLOBALS['phpgw']->template->set_var('selected_admin',(isset($selected_admin)?$selected_admin:''));
-                       
$GLOBALS['phpgw']->template->set_var('selected_salesman',(isset($selected_salesman)?$selected_salesman:''));
 
                        $admins = $this->boconfig->list_admins($action);
 
@@ -781,11 +878,12 @@
                        
$GLOBALS['phpgw']->template->set_var('lang_group',lang('group'));
 // -------------------------- end header declaration 
--------------------------------------
 
-                       for ($i=0;$i<count($admins);++$i)
+                       for ($i=0;$i<count($admins);$i++)
                        {
                                
$this->nextmatchs->template_alternate_row_class($GLOBALS['phpgw']->template);
+                               $lid = $admins[$i]['lid'];
 
-                               if ($admins[$i]['type']=='user')
+                               if ($admins[$i]['type']=='u')
                                {
                                        
$GLOBALS['phpgw']->template->set_var(array
                                        (
@@ -795,20 +893,13 @@
                                        ));
                                        
$GLOBALS['phpgw']->template->fp('list','admin_list',True);
                                }
-                               if ($admins[$i]['type']=='group')
+                               if ($admins[$i]['type']=='g')
                                {
-                                       $group_th = True;
                                        
$GLOBALS['phpgw']->template->set_var('lid',$admins[$i]['lid']);
                                        
$GLOBALS['phpgw']->template->fp('glist','group_list',True);
                                }
                        }
 
-                       if(isset($group_th) && $group_th)
-                       {
-                               
$GLOBALS['phpgw']->template->fp('gth','group_th',True);
-                       }
-
-                       //$GLOBALS['phpgw']->template->set_var('gth','');
                        
$GLOBALS['phpgw']->template->pfp('out','admin_list_t',True);
                        $this->save_sessiondata($action);
                }
@@ -825,26 +916,29 @@
                                'action'                => $action
                        );
 
-                       if (isset($_POST['save']) && $_POST['save'])
+                       if ($_POST['save'])
                        {
                                
$this->boconfig->edit_admins($action,$users,$groups);
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
 
-                       if (isset($_POST['cancel']) && $_POST['cancel'])
+                       if ($_POST['cancel'])
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
 
                        switch($action)
                        {
-                               case 'project_salesman':        $header_info = 
lang('edit salesmen list'); break;
-                               default:                                        
$header_info = lang('edit administrator list'); break;
+                               case 'psale':           $header_info = 
lang('edit salesmen list'); break;
+                               case 'pmanager':        $header_info = 
lang('edit manager list'); break;
+                               default:                        lang('edit 
administrator list'); break;
                        }
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . $header_info;
-                       $GLOBALS['phpgw']->common->phpgw_header(True);
+                       $GLOBALS['phpgw']->common->phpgw_header();
+                       echo parse_navbar();
                        $GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
+                       
                        $this->set_app_langs();
 
                        $GLOBALS['phpgw']->template->set_file(array('admin_add' 
=> 'form_admin.tpl'));
@@ -872,7 +966,7 @@
                                'action'                => 'role'
                        );
 
-                       if (isset($_POST['save']) && $_POST['save'])
+                       if ($_POST['save'])
                        {
                                $error = 
$this->boconfig->check_pa_values(array('role_name' => $role_name),'role');
                                if(is_array($error))
@@ -886,13 +980,13 @@
                                }
                        }
 
-                       if (isset($_GET['delete']) && $_GET['delete'])
+                       if ($_GET['delete'])
                        {
                                $this->boconfig->delete_pa('role',$role_id);
                                
$GLOBALS['phpgw']->template->set_var('message',lang('role has been deleted'));
                        }
 
-                       if (isset($_POST['done']) && $_POST['done'])
+                       if ($_POST['done'])
                        {
                                
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
                        }
@@ -929,22 +1023,17 @@
 
 // -------------------------- end header declaration 
--------------------------------------
 
-                       if(isset($roles) && is_array($roles))
-                       {
-                               for($i=0;$i<count($roles);++$i)
+                       for ($i=0;$i<count($roles);$i++)
                                {
                                        
$this->nextmatchs->template_alternate_row_class($GLOBALS['phpgw']->template);
-                                       
$GLOBALS['phpgw']->template->set_var(array
-                                       (
-                                               'role_name'             => 
$roles[$i]['role_name'],
-                                               'delete_role'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_roles',
+
+                               
$GLOBALS['phpgw']->template->set_var('role_name',$roles[$i]['role_name']);
+                               
$GLOBALS['phpgw']->template->set_var('delete_role',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_roles',
                                                                                
                                                                                
                'role_id'=> $roles[$i]['role_id'],
-                                                                               
                                                                                
                'delete'=>'True')),
-                                               'delete_img'    => 
$GLOBALS['phpgw']->common->image('phpgwapi','delete')
-                                       ));
+                                                                               
                                                                                
                                'delete'=>'True')));
+
                                        
$GLOBALS['phpgw']->template->fp('list','roles_list',True);
                                }
-                       }
                        
$GLOBALS['phpgw']->template->set_var('lang_add_role',lang('add role'));
                        $this->save_sessiondata('role');
                        
$GLOBALS['phpgw']->template->pfp('out','roles_list_t',True);
@@ -960,13 +1049,13 @@
                                'menuaction'    => 
'projects.uiconfig.list_events'
                        );
 
-                       if (isset($_POST['save']) && $_POST['save'])
+                       if ($_POST['save'])
                        {
                                $this->boconfig->save_event($values);
                                
$GLOBALS['phpgw']->template->set_var('message',lang('event extra has been 
saved'));
                        }
 
-                       if (isset($_POST['done']) && $_POST['done'])
+                       if ($_POST['done'])
                        {
                                
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
                        }
@@ -1025,7 +1114,7 @@
 
                        //_debug_array($values);
 
-                       if (isset($_POST['save']) && $_POST['save'])
+                       if ($_POST['save'])
                        {
                                if(strlen(trim($values['charge_name'])) == 0)
                                {
@@ -1033,7 +1122,7 @@
                                }
                                else
                                {
-                                       if(isset($_POST['new_charge']) && 
$_POST['new_charge'])
+                                       if($_POST['new_charge'])
                                        {
                                                $values['charge_id'] = 0;
                                        }
@@ -1042,17 +1131,17 @@
                                }
                        }
 
-                       if (isset($_POST['done']) && $_POST['done'])
+                       if ($_POST['done'])
                        {
                                
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
                        }
 
-                       if(isset($_GET['edit']) && $_GET['edit'])
+                       if($_GET['edit'])
                        {
                                list($values) = 
$this->boconfig->boprojects->list_surcharges($charge_id);
                        }
 
-                       if(isset($_GET['delete']) && $_GET['delete'])
+                       if($_GET['delete'])
                        {
                                $this->boconfig->delete_pa('charge',$charge_id);
                                
$GLOBALS['phpgw']->template->set_var('message',lang('surcharge has been 
deleted'));
@@ -1076,7 +1165,7 @@
 
                        $charges = 
$this->boconfig->boprojects->list_surcharges();
 
-                       if(isset($charges) && is_array($charges))
+                       if(is_array($charges))
                        {
                                foreach($charges as $charge)
                                {
@@ -1087,7 +1176,7 @@
                                                'charge_name'                   
=> $charge['charge_name'],
                                                'charge_percent'                
=> $charge['charge_percent'],
                                                'delete_url'                    
=> 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_surcharges',
-                                                                               
                                                                                
                        'charge_id'=> $charge['charge_id'],
+                                                                               
                                                                                
                        'charge_id'=>$charge['charge_id'],
                                                                                
                                                                                
                        'delete'=>'True')),
                                                'edit_url'                      
        => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_surcharges',
                                                                                
                                                                                
                        'charge_id'=> $charge['charge_id'],
@@ -1111,12 +1200,12 @@
 
                function config_proid_help_msg()
                {
-                       if(isset($_POST['save']) && $_POST['save'])
+                       if($_POST['save'])
                        {
                                
$this->boconfig->config_proid_help_msg(array('action' => 
'save','proid_help_msg' => $_POST['proid_help_msg']));
                        }
 
-                       if(isset($_POST['cancel']) && $_POST['cancel'])
+                       if($_POST['cancel'])
                        {
                                
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
                        }
@@ -1224,7 +1313,7 @@
 
                        for ($i=0;$i<count($entries);$i++)
                        {
-                               
$GLOBALS['phpgw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_class($tr_color));
+                               
$GLOBALS['phpgw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_color($tr_color));
                                $firstname = $entries[$i]['per_first_name'];
                                if (!$firstname) { $firstname = '&nbsp;'; }
                                $lastname = $entries[$i]['per_last_name'];
@@ -1252,13 +1341,13 @@
                {
                        //_debug_array($_POST['prefs']);
                        
//_debug_array($GLOBALS['phpgw_info']['user']['preferences']);
-                       if (isset($_POST['save']) && $_POST['save'])
+                       if ($_POST['save'])
                        {
                                $this->boconfig->save_prefs($_POST['prefs']);
                                
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
                        }
 
-                       if (isset($_POST['done']) && $_POST['done'])
+                       if ($_POST['done'])
                        {
                                
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
                        }
@@ -1270,8 +1359,9 @@
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . lang('preferences');
 
-                       $GLOBALS['phpgw']->common->phpgw_header(True);
+                       $GLOBALS['phpgw']->common->phpgw_header();
                        $GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
+                       echo parse_navbar();
 
                        $GLOBALS['phpgw']->template->set_file(array('prefs' => 
'preferences.tpl'));
                        $this->set_app_langs();
@@ -1293,6 +1383,9 @@
                                         array('id'   => 'coordinatorout',
                                               'name' => lang('coordinator')
                                              ),
+                                        array('id'   => 'salesmanagerout',
+                                              'name' => lang('sales manager')
+                                             ),
                                         array('id'   => 'customerout',
                                               'name' => lang('customer')
                                              ),
@@ -1360,16 +1453,7 @@
                                               'name' => lang('date due')
                                              )
                                        );
-                       $mailTypeEntries = array(
-                                    array('id'                 => 'off',
-                                          'name'       => lang('off')
-                                          ),
-                                    array('id'         => 'on',
-                                          'name'       => lang('active')
-                                          )
-                                    );
 
-                       $sel ='';
                        for ($i = 0; $i < count($columns); $i++)
                        {
                                $selected = '';
@@ -1380,7 +1464,6 @@
                                $sel .= '<option value="'.$columns[$i]['id'].'" 
'.$selected.'>'.$columns[$i]['name'].'</option>'."\n";
                        }
                        
-                       $cssel ='';
                        for ($i = 0; $i < count($cscolumns); $i++)
                        {
                                $selected = '';
@@ -1396,22 +1479,10 @@
                        
$GLOBALS['phpgw']->template->set_var('lang_select_cs_columns',lang('columns to 
show in the controlling sheet'));
                        
$GLOBALS['phpgw']->template->set_var('column_cs_select',$cssel);
                        
$GLOBALS['phpgw']->template->set_var('lang_show_projects_on_mainscreen',lang('show
 projects on mainscreen'));
-                       
$GLOBALS['phpgw']->template->set_var('mainscreen_checked',($prefs['mainscreen_showevents']==True?'
 CHECKED':''));
+                       
$GLOBALS['phpgw']->template->set_var('mainscreen_checked',($prefs['mainscreen_showevents']==True?'
 checked="checked"':''));
                        
$GLOBALS['phpgw']->template->set_var('worktime_statusmail_desc',lang('worktime 
statusmail'));
+                       
$GLOBALS['phpgw']->template->set_var('send_status_mail_checked', 
($prefs['send_status_mail']==True?' checked="checked"':''));
 
-                       $mailTypeSelected = '';
-                       for($i = 0; $i < count($mailTypeEntries); $i++)
-                       {
-                               $selected = '';
-                                                                               
        
-                               if(is_array($prefs['mailTypeEntries']) && 
in_array($mailTypeEntries[$i]['id'], $prefs['mailTypeEntries']))
-                               {
-                                       $selected = 'selected="selected"';
-                               }
-                               $mailTypeSelected .= '<option 
value="'.$mailTypeEntries[$i]['id'].'" '.$selected.' 
/>'.$mailTypeEntries[$i]['name'].'</option>'.'\n';
-                       }
-                       
-                       
$GLOBALS['phpgw']->template->set_var('mailTypeSelected',$mailTypeSelected);
                        $GLOBALS['phpgw']->template->pfp('out','prefs');
                }
 
@@ -1549,14 +1620,17 @@
                function config_worktime_warnmail()
                {
                        $warnmail_type = 
get_var('warnmail_type',array('POST','GET'));
+                       $warnmail_email_address = 
get_var('email_warnmail_address', array('POST','GET'));
+                                       
                        $message = '&nbsp;';
 
                        $this->set_app_langs();
                        
                        if (isset($_POST['save']))
                        {
-                               $values = array('action' => 'save', 
'warnmail_type' => $warnmail_type);
-                               
if($this->boconfig->config_worktime_warnmail($values) == True)
+                               $values = array('action' => 'save', 
'warnmail_type' => $warnmail_type, 'warnmail_email_address' => 
$warnmail_email_address);
+                                                       
+                               
if($this->boconfig->config_worktime_warnmail($values) == true)
                                        $message = lang('setting has been 
saved');
                                else
                                        $message = lang('setting has not been 
saved');
@@ -1583,7 +1657,10 @@
                        
$GLOBALS['phpgw']->template->set_var('message',$message);
 
                        $values = array('action' => 'get');
-                       $warnmail_type_selected = 
$this->boconfig->config_worktime_warnmail($values);
+
+                       $warnmail = 
$this->boconfig->config_worktime_warnmail($values);
+                       $warnmail_type_selected = $warnmail['type'];
+                       $warnmail_email_address = 
$warnmail['warnmail_email_address'];
 
                        // create option list for selectbox
                        // first option for disable warnmail
@@ -1620,8 +1697,178 @@
                        
                        $selectbox = "<select 
name=\"warnmail_type\">\n".$option_list."</select>";
                        
$GLOBALS['phpgw']->template->set_var('warnmail_type_selectbox', $selectbox);
+                       
$GLOBALS['phpgw']->template->set_var('warnmail_email_address', 
$warnmail_email_address);
 
                        $GLOBALS['phpgw']->template->pfp('out','config');
                }
+
+               function config_locations()
+               {
+                       $save   = get_var('save',array('POST'));
+                       $done   = get_var('done',array('POST'));
+                       $edit   = get_var('edit',array('GET'));
+                       $delete = get_var('delete',array('GET'));
+                       $location_id = 
intval(get_var('location_id',array('GET')));
+                       $message = '';
+                       $error = array();
+                       $submit = false;
+
+                       if($done)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+                       }
+
+                       $link_data = array('menuaction' => 
'projects.uiconfig.config_locations');
+                       $action_url = 
$GLOBALS['phpgw']->link('/index.php',$link_data);
+
+                       if($save)
+                       {
+                               $values = get_var('values',array('POST'));
+                               $values['location_id'] = 
intval($values['location_id']);
+                               $values['location_name'] = 
trim($values['location_name']);
+                               $values['location_ident'] = 
trim($values['location_ident']);
+                               $values['location_custnum'] = 
trim($values['location_custnum']);
+
+                               if(!$values['location_name'])
+                               {
+                                       $error[] = lang('please insert a 
location name');
+                               }
+
+                               $exist_location = 
$this->boconfig->get_location_for_ident($values['location_ident']);
+
+                               if(isset($exist_location['location_id']) && 
($exist_location['location_id'] != $values['location_id']))
+                               {
+                                       $exist_location_id = 
$exist_location['location_id'];
+                                       $error[] = lang('location ident 
exists');
+                               }
+                               else
+                               {
+                                       $exist_location_id = 0;
+                               }
+                               
+                               if(count($error) > 0)
+                               { // error 
+                                       $message = 
$GLOBALS['phpgw']->common->error_list($error);
+                                       $submit = true;
+                                       if($values['location_id'] > 0)
+                                       { // edit existing location
+                                               $location_id = 
$values['location_id'];                                          
+                                               $save = 0;
+                                               $edit = 1;
+                                       }
+                               }
+                               else
+                               {
+                                       $this->boconfig->save_location($values);
+                                       
//$GLOBALS['phpgw']->redirect($action_url);
+                                       $message = lang('location saved');
+                                       $values = array(
+                                               'location_name' => '',
+                                               'location_ident' => '',
+                                               'location_custnum' => '',
+                                               'location_id' => 0
+                                       );
+                               }
+                       }
+                       elseif($delete && ($location_id > 0))
+                       {
+                               $this->boconfig->delete_location($location_id);
+                               $message = lang('location deleted');
+                       }
+                       else
+                       {
+                               $values = array(
+                                       'location_name' => '',
+                                       'location_ident' => '',
+                                       'location_custnum' => '',
+                                       'location_id' => 0
+                               );
+                       }
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . lang('edit locations');
+                       $GLOBALS['phpgw']->common->phpgw_header();
+                       echo parse_navbar();
+                       $GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
+                       $this->set_app_langs();
+
+                       
$GLOBALS['phpgw']->template->set_file(array('location_list_t' => 
'config_locations.tpl'));
+                       
$GLOBALS['phpgw']->template->set_block('location_list_t','location_list','list');
+                       $GLOBALS['phpgw']->template->set_var('message', 
$message);
+
+                       $GLOBALS['phpgw']->template->set_var('action_url', 
$action_url);
+
+                       $GLOBALS['phpgw']->template->set_var('lang_location', 
lang('location'));
+                       $GLOBALS['phpgw']->template->set_var('lang_ident', 
'ID');
+                       $GLOBALS['phpgw']->template->set_var('lang_custnum', 
lang('customer nr'));
+
+                       $locations = $this->boconfig->get_locations();
+
+                       if(is_array($locations))
+                       {
+                               foreach($locations as $location)
+                               {
+                                       
$this->nextmatchs->template_alternate_row_class($GLOBALS['phpgw']->template);
+                                       
+                                       if($location_id == 
$location['location_id'])
+                                       {
+                                               $location['location_name'] = 
'<i>'.$location['location_name'].'</i>';
+                                               $location['location_ident'] = 
'<i>'.$location['location_ident'].'</i>';
+                                               $location['location_custnum'] = 
'<i>'.$location['location_custnum'].'</i>';
+                                       }
+
+                                       if($exist_location_id == 
$location['location_id'])
+                                       {
+                                               $location['location_name'] = 
'<b>'.$location['location_name'].'</b>';
+                                               $location['location_ident'] = 
'<b>'.$location['location_ident'].'</b>';
+                                               $location['location_custnum'] = 
'<B>'.$location['location_custnum'].'</b>';
+                                       }
+
+                                       
$GLOBALS['phpgw']->template->set_var(array
+                                       (
+                                               'location_id'     => 
$location['location_id'],
+                                               'location_name'   => 
$location['location_name'],
+                                               'location_ident'  => 
$location['location_ident'],
+                                               'location_custnum' => 
$location['location_custnum'],
+                                               'delete_url'                    
=> 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_locations',
+                                                                               
                                                                                
                        'location_id'=> $location['location_id'],
+                                                                               
                                                                                
                        'delete'=>1)),
+                                               'edit_url'                      
        => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_locations',
+                                                                               
                                                                                
                        'location_id'=> $location['location_id'],
+                                                                               
                                                                                
                        'edit'=>1)),
+                                               'edit_img'                      
=> $GLOBALS['phpgw']->common->image('phpgwapi','edit'),
+                                               'lang_edit_location'    => 
lang('edit location'),
+                                               'delete_img'                    
=> $GLOBALS['phpgw']->common->image('phpgwapi','delete'),
+                                               'lang_delete_location'  => 
lang('delete location')
+                                       ));
+                                       
$GLOBALS['phpgw']->template->fp('list','location_list',True);
+                               }
+                       }
+
+                       if($edit && !$submit && ($location_id > 0))
+                       {
+                               $values = 
$this->boconfig->get_single_location($location_id);
+                       }
+
+                       
$GLOBALS['phpgw']->template->set_var('input_location_name',$values['location_name']);
+                       
$GLOBALS['phpgw']->template->set_var('input_location_ident',$values['location_ident']);
+                       
$GLOBALS['phpgw']->template->set_var('input_location_custnum',$values['location_custnum']);
+                       
$GLOBALS['phpgw']->template->set_var('input_location_id',$values['location_id']);
+
+                       if($edit)
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('lang_submit_action',lang('edit'));
+                               
$GLOBALS['phpgw']->template->set_var('lang_location_button',lang('save'));
+                               
$GLOBALS['phpgw']->template->set_var('cancel_button', '<input type="button" 
value="'.lang('cancel').'" onClick="location.href=\''.$action_url.'\'">');
+                       }
+                       else
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('lang_submit_action',lang('add'));
+                               
$GLOBALS['phpgw']->template->set_var('lang_location_button',lang('add'));
+                               
$GLOBALS['phpgw']->template->set_var('cancel_button', '<input type="reset" 
value="'.lang('reset').'">');
+                       }
+
+                       
$GLOBALS['phpgw']->template->pfp('out','location_list_t',True);
+               }
+
        }
 ?>

Index: inc/class.uiprojecthours.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/class.uiprojecthours.inc.php,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -b -r1.93 -r1.94
--- inc/class.uiprojecthours.inc.php    29 Nov 2006 21:31:07 -0000      1.93
+++ inc/class.uiprojecthours.inc.php    5 Dec 2006 19:40:45 -0000       1.94
@@ -3,10 +3,11 @@
        * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @author Philipp Kamps address@hidden
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: class.uiprojecthours.inc.php,v 1.93 2006/11/29 21:31:07 
sigurdne Exp $
+       * @version $Id: class.uiprojecthours.inc.php,v 1.94 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/class.uiprojecthours.inc.php,v $
        */
 
@@ -49,7 +50,7 @@
                        $this->grants                                   = 
$GLOBALS['phpgw']->acl->get_grants('projects');
                        $this->grants[$this->account]   = PHPGW_ACL_READ + 
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
 
-                       //$this->attached_files                 = 
CreateObject('projects.attached_files');
+                       $this->attached_files                   = 
CreateObject('projects.attached_files');
 
                        $this->start                                    = 
$this->bohours->start;
                        $this->query                                    = 
$this->bohours->query;
@@ -87,7 +88,7 @@
                        $pro_main       = 
get_var('pro_main',array('POST','GET'));
                        $project_id     = 
get_var('project_id',array('POST','GET'));
 
-                       if (isset($_GET['cat_id']) && $_GET['cat_id'])
+                       if ($_GET['cat_id'])
                        {
                                $this->cat_id = $_GET['cat_id'];
                        }
@@ -109,12 +110,15 @@
                        (
                                'menuaction' => 
'projects.uiprojecthours.list_projects',
                                'pro_main'   => $pro_main,
-                               'action'     => $action
+                               'action'     => $action,
+                               'status'     => $this->status,
+                               'project_id' => $project_id
                        );
 
                        if ($action == 'mainsubsorted') 
                        {
-                               $pro = 
$this->boprojects->list_projects(array('action' => $action,'project_id' => 
$pro_main,'page' => 'hours'));
+                               $this->boprojects->status = false; // 
workaround for full tree view support
+                               $pro = 
$this->boprojects->list_projects(array('action' => $action,'project_id' => 
$pro_main,'page' => 'hours', 'limit' => false));
                        }
                        else 
                        {
@@ -123,8 +127,9 @@
 
                        //if($action=='subs' && !is_array($pro))
                        //{
-                       //              
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=projects.uiprojecthours.list_hours&project_id='
-                       //                                                      
                        . $pro_main . '&action=hours');
+                       //              
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>'projects.uiprojecthours.list_hours',
+                       //                                                      
                                                        'project_id'=> 
$pro_main,
+                       //                                                      
                                                        'action'=>'hours'));
                        //}
 
                        //$GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . lang('list projects')
@@ -140,7 +145,9 @@
                        {
                                $main = 
$this->boprojects->read_single_project($pro_main,'hours');
                                
$GLOBALS['phpgw']->template->set_var('title_main',$main['title']);
-                               
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project','action'=>'mains','project_id'=>$pro_main)));
+                               
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project',
+                                                                               
                                                                                
                                        'action'=>'mains',
+                                                                               
                                                                                
                                        'project_id'=>$pro_main)));
                                
$GLOBALS['phpgw']->template->set_var('coordinator_main',$main['coordinatorout']);
                                
$GLOBALS['phpgw']->template->set_var('number_main',$main['number']);
                                
$GLOBALS['phpgw']->template->set_var('customer_main',$main['customerout']);
@@ -165,14 +172,20 @@
 
                        //if ($action == 'mains')
                        //{
-                               $action_list= '<select name="cat_id" 
onChange="this.form.submit();"><option value="none">' . lang('Select category') 
. '</option>' . "\n"
-                                                       . 
$this->boprojects->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
+                       //      $action_list= '<select name="cat_id" 
onChange="this.form.submit();"><option value="none">' . lang('Select category') 
. '</option>' . "\n"
+                       //                              . 
$this->boprojects->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
                        //}
                        //else
                        //{
                        //      $action_list= '<select name="pro_main" 
onChange="this.form.submit();"><option value="">' . lang('Select main project') 
. '</option>' . "\n"
                        //                              . 
$this->boprojects->select_project_list(array('status' => $this->status, 
'selected' => $pro_main)) . '</select>';
                        //}
+                       if($pro_main)
+                       {
+                               $cat_id = 
$this->boprojects->return_value('cat', $pro_main);
+                               $action_list = lang('category').': 
'.$this->boprojects->cats->id2name($cat_id);
+                               $action_list = '<input style="border: solid 2px 
#d0d0d0;" readonly="readonly" size="60" type="text" 
value="&nbsp;'.$action_list.'">';
+                       }
 
                        
$GLOBALS['phpgw']->template->set_var('action_list',$action_list);
                        
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
@@ -237,7 +250,7 @@
 // ------------------------- end record declaration ------------------------
 
 // --------------- template declaration for Add Form --------------------------
-
+/*
                        if ($action=='subs' && $pro_main && is_array($main) && 
$this->bohours->add_perms(array('main' => $pro_main,'main_co' => 
$main['coordinator'])))
                        {
                                $link_data['menuaction'] = 
'projects.uiprojecthours.edit_hours';
@@ -264,10 +277,17 @@
                        
$GLOBALS['phpgw']->template->set_var('view_controlling_sheet','<form 
method="POST" action="' . $GLOBALS['phpgw']->link('/index.php',$link_data)
                                                                                
                                        . '"><input type="hidden" 
name="datum[start]" value="'.$start.'"><input type="hidden" name="datum[end]" 
value="'.$end.'"><input type="submit" name="view" value="' . lang('View 
controlling sheet') . '"></form>');
 
-                       //$this->project_id = $pro_main;
+                       $this->project_id = $pro_main;
+                       if ($this->bohours->add_perms(array('main' => 
$pro_main,'main_co' => $main['coordinator'])) && $pro_main > 0)
+                       {
+                               $link_data['menuaction']        = 
'projects.uiprojecthours.edit_hours';
+                               $link_data['project_id']        = $pro_main;
+                               
$GLOBALS['phpgw']->template->set_var('action','<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data)
+                                                                               
                                                . '"><input type="submit" 
value="' . lang('Add hours to main project') . '"></form>');
+                       }
 
 // ----------------------- end Add form declaration 
----------------------------
-
+*/
                        $this->save_sessiondata($action);
                        
$GLOBALS['phpgw']->template->pfp('out','projects_list_t',True);
                }
@@ -283,7 +303,23 @@
                        $jscal = CreateObject('phpgwapi.jscalendar');   // 
before phpgw_header() !!!
 
                        $sdate = get_var('sdate',array('POST','GET'));
-                       if($sdate)
+                       $edate = get_var('edate',array('POST','GET'));
+
+                       if($_REQUEST['submit'])
+                       {
+                               
$GLOBALS['phpgw']->session->appsession('session_data', 'projectsStartDate', 
$jscal->input2date($sdate));
+                               
$GLOBALS['phpgw']->session->appsession('session_data', 'projectsEndDate',  
$jscal->input2date($edate));
+                       }
+
+                       $sdateSession =  
$GLOBALS['phpgw']->session->appsession('session_data','projectsStartDate');
+
+                       $sdate = $sdateSession['raw'];
+
+                       if(is_numeric($sdate))
+                       {
+                               $start = $sdate;
+                       }
+                       elseif($sdate && !is_numeric($sdate))
                        {
                                $start_array = $jscal->input2date($sdate);
                                $start = 
mktime(0,0,0,$start_array['month'],$start_array['day'],$start_array['year']);
@@ -293,8 +329,14 @@
                                $start = mktime(0,0,0,date('m'),1,date('Y'));
                        }
                        
-                       $edate = get_var('edate',array('POST','GET'));
-                       if($edate)
+                       $edateSession =  
$GLOBALS['phpgw']->session->appsession('session_data','projectsEndDate');
+                       $edate = $edateSession['raw'];
+
+                       if(is_numeric($edate))
+                       {
+                               $end = $edate;
+                       }
+                       elseif($edate && !is_numeric($edate))
                        {
                                $end_array = $jscal->input2date($edate);
                                $end = 
mktime(23,59,59,$end_array['month'],$end_array['day'],$end_array['year']);
@@ -322,9 +364,9 @@
                                'action'                => 'hours'
                        );
 
-                       if($this->project_id > 0)
+                       if($this->project_id)
                        {
-                               //$this->attached_files = 
CreateObject('projects.attached_files');
+                               $this->attached_files = 
CreateObject('projects.attached_files');
                                $main = 
$this->boprojects->read_single_project($this->boprojects->return_value('main',$this->project_id),'hours');
                                
$GLOBALS['phpgw']->template->set_var('title_main',$main['title']);
                                
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project',
@@ -338,7 +380,7 @@
                                
$GLOBALS['phpgw']->template->set_var('ptime_main',str_replace(".", ":", 
sprintf("%1.02f",$main['ptime'])));
                                
$GLOBALS['phpgw']->template->set_var('atime_main',str_replace(".", ":", 
sprintf("%1.02f",$main['ahours_jobs'])));
                                
$GLOBALS['phpgw']->template->parse('main','project_main',True);
-                               
//$GLOBALS['phpgw']->template->set_var('attachment',$this->attached_files->get_files($this->project_id));
+                               
$GLOBALS['phpgw']->template->set_var('attachment',$this->attached_files->get_files($this->project_id));
                                
$GLOBALS['phpgw']->template->set_var('lang_files',lang('Files'));
                        }
 
@@ -350,7 +392,7 @@
 
                        
$GLOBALS['phpgw']->template->set_var('search_list',$this->nextmatchs->search(array('query'
 => $this->query)));
 
-                       if ( (isset($main['coordinator']) && 
$main['coordinator'] == $GLOBALS['phpgw_info']['user']['account_id'])
+                       if ( ($main['coordinator'] == 
$GLOBALS['phpgw_info']['user']['account_id'])
                          || 
($this->boprojects->return_value('coordinator',$this->project_id) == 
$GLOBALS['phpgw_info']['user']['account_id'])
                          || ($this->boprojects->isprojectadmin('pad'))
                          || ($this->boprojects->isprojectadmin('pmanager'))
@@ -403,13 +445,14 @@
                                default: $state_sel[0]=' selected'; 
$this->state = 'all';
                        }
 
-                       $state_list = '<option value="all"' . 
(isset($state_sel[0])?$state_sel[0]:'') . '>' . lang('Show all') . '</option>' 
. "\n"
-                                   . '<option value="open"' . 
(isset($state_sel[1])?$state_sel[1]:'') . '>' . lang('Open') . '</option>' . 
"\n"
-                                   . '<option value="done"' . 
(isset($state_sel[2])?$state_sel[2]:'') . '>' . lang('Done') . '</option>' . 
"\n"
-                                   . '<option value="billed"' . 
(isset($state_sel[3])?$state_sel[3]:'') . '>' . lang('Billed') . '</option>' . 
"\n";
+                       $state_list = '<option value="all"' . $state_sel[0] . 
'>' . lang('Show all') . '</option>' . "\n"
+                                                                       . 
'<option value="open"' . $state_sel[1] . '>' . lang('Open') . '</option>' . "\n"
+                                                                       . 
'<option value="done"' . $state_sel[2] . '>' . lang('Done') . '</option>' . "\n"
+                                                                       . 
'<option value="billed"' . $state_sel[3] . '>' . lang('Billed') . '</option>' . 
"\n";
 
                        
$GLOBALS['phpgw']->template->set_var('state_list',$state_list);
                        $this->bohours->state = $this->state;
+                       $this->bohours->limit = false;
 
                        $hours = $this->bohours->list_hours($start, $end);
 
@@ -437,8 +480,6 @@
 
 // -------------- end header declaration 
---------------------------------------
 
-                       if(isset($hours) && is_array($hours))
-                       {
                                for ($i=0;$i<count($hours);$i++)
                                {
                                        
$this->nextmatchs->template_alternate_row_class($GLOBALS['phpgw']->template);
@@ -494,7 +535,7 @@
                                                                                
                        'start_date'  => $start_date,
                                                                                
                        'start_time'  => $hours[$i]['sdate_formatted']['time'],
                                                                                
                        'end_time'    => $hours[$i]['edate_formatted']['time'],
-                                                                               
                        'wh'          => str_replace('.', ':', 
sprintf("%1.02f",$hours[$i]['wh']['whwm'])),
+                                                                               
                        'wh'          => $hours[$i]['wh']['whwm'],
                                                                                
                        't_journey'   => $hours[$i]['t_journey']));
 
                                        $link_data['menuaction'] = 
'projects.uiprojecthours.view_hours';
@@ -512,12 +553,10 @@
 // --------------------------- end record declaration 
-----------------------------------
 
                                }
-                       }
 
-                       if($this->project_id > 0)
-                       {
                                $ptime_pro = 
$this->boprojects->return_value('ptime',$this->project_id);
                                $acc = 
$this->boprojects->get_budget(array('project_id' => $this->project_id,'ptime' 
=> $ptime_pro));
+
                                
$GLOBALS['phpgw']->template->set_var('uhours_pro',$this->boprojects->colored($acc['uhours_pro'],$ptime_pro,$acc['uhours_pro_wminutes'],'hours'));
                                
$GLOBALS['phpgw']->template->set_var('uhours_jobs',$this->boprojects->colored($acc['uhours_jobs'],$ptime_pro,$acc['uhours_jobs_wminutes'],'hours'));
                                
$GLOBALS['phpgw']->template->set_var('ahours_jobs',str_replace(".", ":", 
sprintf("%1.02f",$acc['ahours_jobs'])));
@@ -532,8 +571,6 @@
                                }
 
                                unset($link_data);
-                       }
-
                        $link_data['menuaction'] = 
'projects.uiprojecthours.controlling_sheet';
                        
$GLOBALS['phpgw']->template->set_var('view_controlling_sheet','<form 
method="POST" action="' . $GLOBALS['phpgw']->link('/index.php',$link_data)
                                                                                
                                        . '"><input type="hidden" 
name="datum[start]" value="'.$start.'"><input type="hidden" name="datum[end]" 
value="'.$end.'"><input type="submit" name="view" value="' . lang('View 
controlling sheet') . '"></form>');
@@ -581,18 +618,15 @@
                                }
                        }
 
-                       $values['t_journey'] = 
intval((isset($values['t_journey_h'])?$values['t_journey_h']:0)*60 + 
(isset($values['t_journey_m'])?$values['t_journey_m']:0));
+                       $values['t_journey'] = intval($values['t_journey_h']*60 
+ $values['t_journey_m']);
                        //_debug_array($values);
 
-                       $this->project_id = 
(isset($values['project_id'])?intval($values['project_id']):0);
-                       if((isset($values['start']) && $values['start']) 
-                       || (isset($values['stop']) && $values['stop']) 
-                       || (isset($values['continue']) && $values['continue']) 
-                       || (isset($values['pause']) && $values['pause']))
+                       $this->project_id = intval($values['project_id']);
+                       if($values['start'] || $values['stop'] || 
$values['continue'] || $values['pause'])
                        {
                                $error = 
$this->bohours->check_ttracker($values);
 
-                               if (isset($error) && is_array($error))
+                               if (is_array($error))
                                {
                                        
$GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
                                }
@@ -601,7 +635,7 @@
                                        $this->bohours->ttracker($values);
                                }
                        }
-                       elseif(isset($values['apply']) && $values['apply'])
+                       elseif($values['apply'])
                        {
                                $values['action']       = 'apply';
                                $values['ttracker'] = True;
@@ -619,12 +653,12 @@
                                        $this->bohours->save_hours($values);
                                }
                        }
-                       elseif(isset($values['save']) && $values['save'])
+                       elseif($values['save'])
                        {
                                $values['action'] = 'save';
                                $this->bohours->ttracker($values);
                        }
-                       elseif(isset($_GET['delete']) && $_GET['delete'])
+                       elseif($_GET['delete'])
                        {
                           $this->bohours->delete_hours(array('action' => 
'track','id' => $_GET['track_id']));
                        }
@@ -660,20 +694,20 @@
 
                        
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
 
-                       
$GLOBALS['phpgw']->template->set_var('remark',(isset($values['remark'])?$values['remark']:''));
-                       
$GLOBALS['phpgw']->template->set_var('hours',sprintf("%02d",(isset($values['hours'])?$values['hours']:'')));
-                       
$GLOBALS['phpgw']->template->set_var('minutes',sprintf("%02d",(isset($values['minutes'])?$values['minutes']:'')));
-                       
$GLOBALS['phpgw']->template->set_var('km_distance',sprintf("%01.2f",(isset($values['km_distance'])?$values['km_distance']:'')));
+                       
$GLOBALS['phpgw']->template->set_var('remark',$values['remark']);
+                       
$GLOBALS['phpgw']->template->set_var('hours',sprintf("%02d",$values['hours']));
+                       
$GLOBALS['phpgw']->template->set_var('minutes',sprintf("%02d",$values['minutes']));
+                       
$GLOBALS['phpgw']->template->set_var('km_distance',sprintf("%01.2f",$values['km_distance']));
                        
$GLOBALS['phpgw']->template->set_var('t_journey_h',sprintf("%02d", 
floor($values['t_journey']/60)));
                        
$GLOBALS['phpgw']->template->set_var('t_journey_m',sprintf("%02d", 
intval($values['t_journey']%60)));
-                       
$GLOBALS['phpgw']->template->set_var('surcharge_list',$this->boprojects->action_format((isset($values['surcharge'])?$values['surcharge']:''),'charge'));
+                       
$GLOBALS['phpgw']->template->set_var('surcharge_list',$this->boprojects->action_format($values['surcharge'],'charge'));
 
-                       $start = 
isset($start_val)?$start_val:mktime(12,0,0,date('m'),date('d'),date('Y'));
+                       $start = 
$start_val?$start_val:mktime(12,0,0,date('m'),date('d'),date('Y'));
                        
$GLOBALS['phpgw']->template->set_var('start_date_select',$jscal->input('sdate[str]',$start));
 
                        if($this->siteconfig['hoursbookingday'] == 'yes')
                        {
-                               $end = 
isset($end_val)?$end_val:mktime(12,0,0,date('m'),date('d'),date('Y'));
+                               $end = 
$end_val?$end_val:mktime(12,0,0,date('m'),date('d'),date('Y'));
                                
$GLOBALS['phpgw']->template->set_var('end_date_select',$jscal->input('edate[str]',$end));
 
                                
$GLOBALS['phpgw']->template->fp('datehandle','booking_date',True);
@@ -685,12 +719,12 @@
 
                        if($this->siteconfig['accounting'] == 'activity')
                        {
-                               
$GLOBALS['phpgw']->template->set_var('activity_list',$this->boprojects->select_hours_activities($this->project_id,(isset($values['activity_id'])?$values['activity_id']:'')));
+                               
$GLOBALS['phpgw']->template->set_var('activity_list',$this->boprojects->select_hours_activities($this->project_id,$values['activity_id']));
                                
$GLOBALS['phpgw']->template->fp('activityhandle','activity',True);
                        }
                        else
                        {
-                               
$GLOBALS['phpgw']->template->set_var('hours_descr',(isset($values['hours_descr'])?$values['hours_descr']:''));
+                               
$GLOBALS['phpgw']->template->set_var('hours_descr',$values['hours_descr']);
                                
$GLOBALS['phpgw']->template->fp('actownhandle','act_own',True);
                        }
 
@@ -712,8 +746,6 @@
 
                                
$GLOBALS['phpgw']->template->set_var('thours_list','');
 
-                               if(isset($track['hours']) && 
is_array($track['hours']))
-                               {
                                        for($i=0;$i<count($track['hours']);$i++)
                                        {
                                                
$this->nextmatchs->template_alternate_row_class($GLOBALS['phpgw']->template);
@@ -729,6 +761,15 @@
                                                        $wh = 
$track['hours'][$i]['wh']['whours_formatted'] . '.' . 
sprintf("%02d",$track['hours'][$i]['wh']['wmin_formatted']);
                                                }
        
+                                       
if($track['hours'][$i]['journey']['whours_formatted'] == 0 && 
$track['hours'][$i]['wh']['wmin_formatted'] == 0)
+                                       {
+                                               $journey = '';
+                                       }
+                                       else
+                                       {
+                                               $journey = 
$track['hours'][$i]['journey']['whours_formatted'] . '.' . 
sprintf("%02d",$track['journey'][$i]['wh']['wmin_formatted']);
+                                       }
+
                                                
switch($track['hours'][$i]['status'])
                                                {
                                                        case 'apply':   $at = 
$track['hours'][$i]['sdate_formatted']['date']; break;
@@ -743,15 +784,18 @@
                                                                                
                        'apply_time'    => $at,
                                                                                
                        'end_time'              => 
($track['hours'][$i]['status']!='apply'?($track['hours'][$i]['edate']>0?$track['hours'][$i]['edate_formatted']['time']:
                                                                                
                                                                
''):$track['hours'][$i]['edate_formatted']['date']),
-                                                                               
                        'wh'                    => $wh,
-                                                                               
                        'delete_url'    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.ttracker','delete'=>'True','track_id'=>
 $track['hours'][$i]['track_id'])),
-                                                                               
                        'edit_url'              => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.edit_ttracker','track_id'=>
 $track['hours'][$i]['track_id'])),
+                                                                               
                        'wh'                    => str_replace(".", ":", 
sprintf("%1.02f", $wh)),
+                                                                               
                        'journey'     => str_replace(".", ":", 
sprintf("%1.02f", $journey)),
+                                                                               
                        'delete_url'    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.ttracker',
+                                                                               
                                                                                
                                                                        
'delete'=>'True',
+                                                                               
                                                                                
                                                                        
'track_id'=>$track['hours'][$i]['track_id'])),
+                                                                               
                        'edit_url'              => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.edit_ttracker',
+                                                                               
                                                                                
                                                                        
'track_id'=> $track['hours'][$i]['track_id'])),
                                                                                
                        'delete_img'    => 
$GLOBALS['phpgw']->common->image('phpgwapi','delete'),
                                                                                
                        'lang_delete'   => lang('delete')));
 
                                                
$GLOBALS['phpgw']->template->fp('thours_list','ttracker_list',True);
                                        }
-                               }
                                
$GLOBALS['phpgw']->template->fp('track','ttracker',True);
                        }
 
@@ -987,8 +1031,8 @@
                        
$GLOBALS['phpgw']->template->set_var('minutes',$values['wh']['wmin_formatted']);
 
                        
$GLOBALS['phpgw']->template->set_var('km_distance',sprintf("%01.2f",$values['km_distance']));
-                       
$GLOBALS['phpgw']->template->set_var('t_journey_h',sprintf("%02d", 
floor($values['t_journey']/60)));
-                       
$GLOBALS['phpgw']->template->set_var('t_journey_m',sprintf("%02d", 
intval($values['t_journey']%60)));
+                       $GLOBALS['phpgw']->template->set_var('t_journey_h', 
$values['t_journey']['whours_formatted']);
+                       $GLOBALS['phpgw']->template->set_var('t_journey_m', 
$values['t_journey']['wmin_formatted']);
                        
$GLOBALS['phpgw']->template->set_var('surcharge_list',$this->boprojects->action_format($values['surcharge'],'charge'));
 
                        
//$GLOBALS['phpgw']->template->set_var('project_name',$GLOBALS['phpgw']->strip_html($this->boprojects->return_value('pro',$this->project_id)));
@@ -1005,8 +1049,8 @@
                                default         :       $stat_sel[1]=' 
selected'; break;
                        }
 
-                       $status_list = '<option value="open"' . 
(isset($stat_sel[0])?$stat_sel[0]:'') . '>' . lang('Open') . '</option>' . "\n"
-                                               . '<option value="done"' . 
(isset($stat_sel[1])?$stat_sel[1]:'') . '>' . lang('Done') . '</option>' . "\n";
+                       $status_list = '<option value="open"' . $stat_sel[0] . 
'>' . lang('Open') . '</option>' . "\n"
+                                               . '<option value="done"' . 
$stat_sel[1] . '>' . lang('Done') . '</option>' . "\n";
 
                        return $status_list;
                }
@@ -1052,9 +1096,9 @@
 
                        $link_data = array
                        (
-                               'menuaction'    => 
'projects.uiprojecthours.list_hours',
+                               'menuaction'    => 
'projects.uiprojecthours.controlling_sheet',
                                'hours_id'              => $hours_id,
-                               'project_id'    => $values['project_id'],
+                               //'project_id'  => $values['project_id'],
                                'pro_main'              => $pro_main,
                                'delivery_id'   => $delivery_id,
                                'invoice_id'    => $invoice_id
@@ -1077,12 +1121,11 @@
                                }
                        }
 
-                       if (isset($_POST['save']) && $_POST['save'])
+                       if ($_POST['save'])
                        {                               
                                $values['t_journey'] = 
intval($values['t_journey_h']*60 + $values['t_journey_m']);
                                $values['hours']   = abs($values['hours']);
                                $values['minutes'] = abs($values['minutes']);
-
                                if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] == '12')
                                {
                                        if ($values['shour'] && 
($values['shour'] != 0) && ($values['shour'] != 12))
@@ -1160,21 +1203,23 @@
                                else
                                {
                                        $this->bohours->save_hours($values);
+                                       $link_data['project_id'] = 
$values['project_id'];
                                        if($link_data['menuaction'] == 
'projects.uiprojecthours.edit_hours')
                                        {
                                                $link_data['menuaction'] = 
'projects.uiprojecthours.list_hours';
                                        }
-                                       
                                        
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                                }
                        }
-                       elseif(isset($_POST['cancel']) && $_POST['cancel'])
+                       elseif($_POST['cancel'])
                        {
                                //$link_data['menuaction'] = 
'projects.uiprojecthours.list_hours';
+                               $link_data['project_id'] = 
$values['project_id'];
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
-                       elseif(isset($_POST['delete']) && $_POST['delete'])
+                       elseif($_POST['delete'])
                        {
+                               $link_data['project_id'] = 
$values['project_id'];
                                $link_data['menuaction'] = 
'projects.uiprojecthours.delete_hours';
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
@@ -1215,7 +1260,7 @@
                                
$GLOBALS['phpgw']->template->fp('mainhandle','main',True);
                        }
 
-                       if ($hours_id && (!isset($_POST['save']) || 
!$_POST['save']))
+                       if ($hours_id && !$_POST['save'])
                        {
                                $values                         = 
$this->bohours->read_single_hours($hours_id);
                                $activity_id            = 
$values['activity_id'];
@@ -1225,21 +1270,21 @@
                                //_debug_array($values);
                        }
 
-                       if(isset($start_val) && $start_val)
+                       if($start_val)
                        {
                                $start = $start_val;
                        }
-                       elseif((!isset($start_val) || !$start_val) && 
isset($_REQUEST['day']) && $_REQUEST['day'])
+                       elseif(!$start_val && $_REQUEST['day'])
                        {
                                $start = $_REQUEST['day'];
                        }
                        else
                        {
-                               $start = 
(isset($values['sdate'])?mktime(0,0,0,date('m',$values['sdate']),date('d',$values['sdate']),date('Y',$values['sdate'])):mktime(0,0,0,date('m'),date('d'),date('Y')));
+                               $start = 
($values['sdate']?mktime(0,0,0,date('m',$values['sdate']),date('d',$values['sdate']),date('Y',$values['sdate'])):mktime(0,0,0,date('m'),date('d'),date('Y')));
                        }
 
-                       $shour = 
isset($values['sdate'])?date('H',$values['sdate']):'08';
-                       $smin  = 
isset($values['sdate'])?date('i',$values['sdate']):'00';
+                       $shour = 
$values['sdate']?date('H',$values['sdate']):'08';
+                       $smin  = 
$values['sdate']?date('i',$values['sdate']):'00';
 
                        
$GLOBALS['phpgw']->template->set_var('start_date_select',$jscal->input('sdate[str]',$start));
 
@@ -1275,8 +1320,8 @@
                        $GLOBALS['phpgw']->template->set_var('shour', 
sprintf("%02d", $shour));
                        $GLOBALS['phpgw']->template->set_var('smin', 
sprintf("%02d", $smin));
 
-                       $end = 
isset($end_val)?$end_val:(isset($values['edate'])?mktime(0,0,0,date('m',$values['edate']),date('d',$values['edate']),date('Y',$values['edate'])):mktime(0,0,0,date('m'),date('d'),date('Y')));
-                       if((!isset($values['edate']) || 
(!intval(date('H',$values['edate'])) && !intval(date('i',$values['edate'])))) 
&& (isset($minutes) && $minutes > 0))
+                       $end = 
$end_val?$end_val:($values['edate']?mktime(0,0,0,date('m',$values['edate']),date('d',$values['edate']),date('Y',$values['edate'])):mktime(0,0,0,date('m'),date('d'),date('Y')));
+                       if(!intval(date('H',$values['edate'])) && 
!intval(date('i',$values['edate'])) && ($minutes > 0))
                        {
                                $s_minutes      = $shour * 60 + $smin;
                                $e_minutes      = $s_minutes + $minutes;
@@ -1285,8 +1330,8 @@
                        }
                        else
                        {
-                               $ehour  = 
isset($values['edate'])?date('H',$values['edate']):'17';
-                               $emin   = 
isset($values['edate'])?date('i',$values['edate']):'00';
+                               $ehour  = 
$values['edate']?date('H',$values['edate']):'17';
+                               $emin   = 
$values['edate']?date('i',$values['edate']):'00';
                        }
 
                        
$GLOBALS['phpgw']->template->set_var('end_date_select',$jscal->input('edate[str]',$end));
@@ -1321,31 +1366,31 @@
                        $GLOBALS['phpgw']->template->set_var('ehour', 
sprintf("%02d", $ehour));
                        $GLOBALS['phpgw']->template->set_var('emin', 
sprintf("%02d", $emin));
 
-                       if($this->siteconfig['hoursbookingday'] == 'yes')
-                       {
-                               
$GLOBALS['phpgw']->template->fp('datehandle','booking_date',True);
-                       }
-                       else
-                       {
-                               
$GLOBALS['phpgw']->template->fp('timehandle','booking_time',True);
-                       }
-
-                       
$GLOBALS['phpgw']->template->set_var('status_list',$this->status_format((isset($values['status'])?$values['status']:'')));
-                       
$GLOBALS['phpgw']->template->set_var('remark',(isset($values['remark'])?$values['remark']:''));
-                       
$GLOBALS['phpgw']->template->set_var('hours_descr',(isset($values['hours_descr'])?$values['hours_descr']:''));
+                       
$GLOBALS['phpgw']->template->set_var('status_list',$this->status_format($values['status']));
+                       
$GLOBALS['phpgw']->template->set_var('remark',$values['remark']);
+                       
$GLOBALS['phpgw']->template->set_var('hours_descr',$values['hours_descr']);
 
-                       $GLOBALS['phpgw']->template->set_var('hours', 
sprintf("%02d",(isset($values['hours'])?$values['hours']:'')));
-                       $GLOBALS['phpgw']->template->set_var('minutes', 
sprintf("%02d",(isset($values['minutes'])?$values['minutes']:'')));
+                       $GLOBALS['phpgw']->template->set_var('hours', 
sprintf('%02d',intval($values['hours'])));
+                       $GLOBALS['phpgw']->template->set_var('minutes', 
sprintf('%02d',$values['minutes']));
 
                        
$GLOBALS['phpgw']->template->set_var('project_name',$GLOBALS['phpgw']->strip_html($this->boprojects->return_value('pro',$this->project_id)));
 
                        
$GLOBALS['phpgw']->template->set_var('hours_billable_checked',($values['billable']=='N'?'
 CHECKED':''));
-                       
$GLOBALS['phpgw']->template->set_var('km_distance',sprintf("%01.2f",(isset($values['km_distance'])?$values['km_distance']:'')));
+                       
$GLOBALS['phpgw']->template->set_var('km_distance',sprintf("%01.2f",$values['km_distance']));
                        
-                       $GLOBALS['phpgw']->template->set_var('t_journey_h', 
sprintf('%02d', 
(isset($values['t_journey'])?floor($values['t_journey']/60):'')));
-                       $GLOBALS['phpgw']->template->set_var('t_journey_m', 
sprintf('%02d', 
(isset($values['t_journey'])?intval($values['t_journey']%60):'')));
+                       $GLOBALS['phpgw']->template->set_var('t_journey_h', 
sprintf('%02d', floor($values['t_journey']/60)));
+                       $GLOBALS['phpgw']->template->set_var('t_journey_m', 
sprintf('%02d', intval($values['t_journey']%60)));
 
-                       
$GLOBALS['phpgw']->template->set_var('surcharge_list',$this->boprojects->action_format((isset($values['surcharge'])?$values['surcharge']:''),'charge'));
+                       
$GLOBALS['phpgw']->template->set_var('surcharge_list',$this->boprojects->action_format($values['surcharge'],'charge'));
+
+                       if ($this->siteconfig['hoursbookingday'] == 'yes')
+                       {
+                               
$GLOBALS['phpgw']->template->fp('datehandle','booking_date',True);
+                       }
+                       else
+                       {
+                               
$GLOBALS['phpgw']->template->fp('timehandle','booking_time',True);
+                       }
 
                        if($this->siteconfig['accounting'] == 'activity')
                        {
@@ -1363,18 +1408,32 @@
                                
$GLOBALS['phpgw']->template->set_var('lang_pro_parent',lang('Main project:'));
                        }*/
 
-                       if ($this->bohours->edit_perms(array('adminonly' => 
True,'status' => (isset($values['status'])?$values['status']:''),'main_co' => 
$main['coordinator'])))
+                       if ($this->bohours->edit_perms(array('adminonly' => 
True,'status' => $values['status'],'main_co' => $main['coordinator'])))
                        {
-                               
$GLOBALS['phpgw']->template->set_var('employee','<select 
name="values[employee]">' . $this->ui_base->employee_format(array('selected' => 
(isset($values['employee'])?$values['employee']:$this->account),
+                               $options = 
$this->ui_base->employee_format(array('type'            => 'selectbox',
+                                                                               
                                                                                
                                                                 'selected'     
   => ($values['employee']?$values['employee']:$this->account),
                                                                                
                                                                                
                                                                                
                                        'admins_included' => True,
-                                                                               
                                                                                
                                                                                
                                        'project_id' => $values['project_id']))
-                                                                               
                                                        . '</select>');
+                                                                               
                                                                                
                                                                 'project_id'   
   => $values['project_id']
+                                                                               
                                                                                
                                                                )
+                                                                               
                                                                                
                                        );
+
+                               
$GLOBALS['phpgw']->template->set_var('employee','<select 
name="values[employee]">'.$options.'</select>');
                        }
                        else
                        {
                                
$GLOBALS['phpgw']->template->set_var('employee',$values['employeeout']?$values['employeeout']:$GLOBALS['phpgw']->common->grab_owner_name($this->account));
                        }
 
+                       $project_options = 
$this->boprojects->select_project_list(array(
+                               'filter' => 'none',
+                               'action' => 'all',
+                               'limit' => False,
+                               'status' => 'active',
+                               'selected' => $values['project_id']
+                       ));
+                               
+                       $GLOBALS['phpgw']->template->set_var('project_options', 
$project_options);
+
                        if ($hours_id && 
$this->bohours->edit_perms(array('action' => 'delete','status' => 
$values['status'],'main_co' => $main['coordinator'], 'booked' => 
$values['booked'], 'employee' => $values['employee'])))
                        {
                                
$GLOBALS['phpgw']->template->set_var('delete','<input type="submit" 
name="delete" value="' . lang('Delete') .'">');
@@ -1440,7 +1499,7 @@
                        {
                                $main = 
$this->boprojects->read_single_project($pro_main,'hours');
                                
$GLOBALS['phpgw']->template->set_var('pro_main',$main['title']);
-                               
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project','action'=>'mains','project_id'=>$pro_main)));
+                               
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project','action'=>'mains','project_id'=>
 $pro_main)));
                                
$GLOBALS['phpgw']->template->set_var('number_main',$main['number']);
                                
$GLOBALS['phpgw']->template->set_var('coordinator_main',$main['coordinatorout']);
                                
$GLOBALS['phpgw']->template->set_var('customer_main',$main['customerout']);
@@ -1495,15 +1554,17 @@
                                'project_id'    => $project_id
                        );
 
-                       if ($_POST['yes'] || $_POST['no'])
+                       if ($_POST['no'])
                        {
-                               $link_data['menuaction'] = 
'projects.uiprojecthours.list_hours';
-                               if($_POST['yes'])
+                               $link_data['menuaction'] = 
'projects.uiprojecthours.edit_hours';
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+                       
+                       if ($_POST['yes'])
                                {
+                               $link_data['menuaction'] = 
'projects.uiprojecthours.list_hours';
                                        $this->bohours->delete_hours(array('id' 
=> $hours_id));
                                        unset($link_data['hours_id']);
-                               }
-
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
 
@@ -1567,33 +1628,30 @@
                        $GLOBALS['phpgw']->template->pfp('out','hours_booked');
                }
                
+
                function controlling_sheet()
                {
+                       set_time_limit(120);
                        $jscal                  = 
CreateObject('phpgwapi.jscalendar');  // before phpgw_header() !!!
-                       $start_array    = 
$jscal->input2date((isset($_REQUEST['datum']['start'])?$_REQUEST['datum']['start']:''));
-                       $end_array              = 
$jscal->input2date((isset($_REQUEST['datum']['end'])?$_REQUEST['datum']['end']:''));
-
+                       if($_REQUEST['datum'])
+                       {
+                               
$GLOBALS['phpgw']->session->appsession('session_data', 'projectsCSheetSDate', 
$jscal->input2date($_REQUEST['datum']['start']));
+                               
$GLOBALS['phpgw']->session->appsession('session_data', 'projectsCSheetEDate', 
$jscal->input2date($_REQUEST['datum']['end']));
+                       }
+                       $start_array = 
$GLOBALS['phpgw']->session->appsession('session_data','projectsCSheetSDate');
+                       $end_array = 
$GLOBALS['phpgw']->session->appsession('session_data','projectsCSheetEDate');
                        // Workaround for new actions
                        if(get_var('export', array('POST')))
                        {
                                $this->export_controlling_sheet($start_array, 
$end_array);
                        }
-
                        if(get_var('import', array('POST')))
                        {
                                
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=>'projects.uiprojecthours.import_controlling_sheet')));
                        }
-
                        $values = get_var('view', array('POST', 'GET'));
-
-                       //$GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . lang('controlling sheet')
-                       //                                                . 
$this->admin_header_info();
-
                        $this->ui_base->display_app_header();
-
-
                        
$GLOBALS['phpgw']->template->set_file(array('controlling' => 
'hours_controlling.tpl'));
-
                        if ($this->boprojects->isprojectadmin('pad') || 
$this->boprojects->isprojectadmin('pmanager'))
                        {
                                $employee       = get_var('employee', 
array('POST','GET'));
@@ -1601,11 +1659,7 @@
                                {
                                        $employee       = 
$GLOBALS['phpgw_info']['user']['account_id'];
                                }
-
-                               $format_data = array(
-                                       'selected'     => array($employee)
-                               );
-
+                               $format_data = array('selected' => 
array($employee));
                                $filter_employee  = '<select name="employee">';
                                $filter_employee .=     
$this->ui_base->employee_format($format_data);
                                $filter_employee .= '</select>';
@@ -1619,154 +1673,226 @@
                        $GLOBALS['phpgw']->template->set_var('l_view_sheet', 
lang('View Sheet'));
                        $GLOBALS['phpgw']->template->set_var('l_export_sheet', 
lang('Export Sheet'));
                        $GLOBALS['phpgw']->template->set_var('l_import_sheet', 
lang('Import Sheet'));
-
                        $start = $start_array['raw'] > 1 ? $start_array['raw'] 
: mktime(0,0,0,date('m'),date('d') - (date('w')-1),date('Y'));
-                       $end   = $end_array['raw'] > 1 ?   $end_array['raw']   
: mktime(23,59,59,date('m'),date('d') + (7 - date('w')),date('Y'));
-
-                       
$GLOBALS['phpgw']->template->set_var('sdate_select',$jscal->input('datum[start]',
 $start));
-                       
$GLOBALS['phpgw']->template->set_var('edate_select',$jscal->input('datum[end]', 
$end));
+                       $end   = $end_array['raw'] > 1 ?   $end_array['raw']   
: mktime(0,0,0,date('m'),date('d') + (7 - date('w')),date('Y'));
+                       if($start > $end)
+                       {
+                               $temp  = $end;
+                               $end   = $start;
+                               $start = $temp;
+                       }
 
-                       $GLOBALS['phpgw']->template->set_var('view_hours_link', 
$GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=>'projects.uiprojecthours.edit_hours')));
+                       $GLOBALS['phpgw']->template->set_var(array(
+              'sdate_select' => $jscal->input('datum[start]', $start),
+              'edate_select' => $jscal->input('datum[end]', $end),
+              'view_hours_link' => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.edit_hours'))
+            ));
                        $calholidays = 
CreateObject('phpgwapi.calendar_holidays');
-
                        $matrix = 
$this->bohours->build_controlling_matrix($employee, $start, $end);
                        $prefs = $this->boprojects->read_prefs(True);
                        $rowtitles = $prefs['cscolumns'];
+                       if ((count($rowtitles) == 0) || !$rowtitles[0])
+                       {
+                               $rowtitles[0] = 'title';
+                       }
+                       if (count($matrix) > 0)
+                       {
                                
-                       if(count($matrix) > 0)
+                /************************* Head/Body *****************/
+                       
$GLOBALS['phpgw']->template->set_block('controlling','blk_row_title0','blk_row_title0_i');
+                
$GLOBALS['phpgw']->template->set_block('controlling','matrix_day','matrix_day_i');
+                
$GLOBALS['phpgw']->template->set_block('controlling','body_row','body_row_i');
+                
$GLOBALS['phpgw']->template->set_block('body_row','row_title','row_title_j');
+                
$GLOBALS['phpgw']->template->set_block('body_row','content_cell','content_cell_j');
+                
$GLOBALS['phpgw']->template->set_var('th_bg_theme',$GLOBALS['phpgw_info']['theme']['th_bg']);
+                $line = 0;
+                $row  = 0;
+                               for ($i = 0; $i < count($rowtitles); ++$i)
                        {
-                               
$GLOBALS['phpgw']->template->set_var('th_bg_theme', 
$GLOBALS['phpgw_info']['theme']['th_bg']);
-                               
$GLOBALS['phpgw']->template->set_block('controlling', 'blk_row_title0', 
'blk_row_titles0_i');
-                               for($i = 0; $i < count($rowtitles); $i++)
+                                       switch($rowtitles[$i])
                                {
-                                       
$GLOBALS['phpgw']->template->set_var('l_rowTitles', lang($rowtitles[$i]));
-                                       
$GLOBALS['phpgw']->template->parse('blk_row_titles0_i','blk_row_title0', True);
+                                               case 'number':
+                                                       $row_title = 
lang('project id');
+                                                   break;
+                                               case 'edateout':
+                                                       $row_title = lang('date 
due');
+                                                   break;
+                                               case 'title':
+                                                       $row_title = 
lang('title');
+                                                   break;
+                                               default:
+                                                       $row_title = '';
                                }
-                               
$GLOBALS['phpgw']->template->parse('blk_row_titles0','blk_row_titles0_i', 
False);
-                               
$GLOBALS['phpgw']->template->set_var('blk_row_titles0_i','');
+                                       
$GLOBALS['phpgw']->template->set_var(array(
+                      'l_rowTitles' => $row_title,
+                      'cell_row' => $row++,
 
-                               
$GLOBALS['phpgw']->template->set_block('controlling', 'matrix_day', 
'matrix_day_i');
-                               foreach($matrix[0]['days'] as $key => $value)
+                      'pnumber' => '{pnumber' . $i . '}',
+                      'title' => '{title' . $i . '}',
+                      'enddate' => '{enddate' . $i . '}'
+                    ));
+                    $GLOBALS['phpgw']->template->set_var('cell_line',0);
+                                       
$GLOBALS['phpgw']->template->parse('blk_row_title0_i','blk_row_title0',true);
+                    $GLOBALS['phpgw']->template->unset_var('cell_line');
+                    
$GLOBALS['phpgw']->template->set_var('cell_row','{cell_row' . $i . '}');
+                    
$GLOBALS['phpgw']->template->parse('row_title_i','row_title',true);
+                               }
+                // continue with $i (row)
+                               foreach ($matrix[0]['days'] as $key => $value)
                                {
-                                       $holidaystyle = '';
-                                       if(!$calholidays->is_workday($key))
+                                       if (!$calholidays->is_workday($key))
                                        {
                                                $daytotal[$key]['should'] = 0;
-                                               $holidaystyle = 
'class="holiday" ';
-                                       }       else
+                                               $holidaystyle = 
'class="holiday"';
+                                       }
+                                       else
                                        {
                                                $daytotal[$key]['should'] = 480;
+                        $holidaystyle = '';
                                        }                               
-                                       
$GLOBALS['phpgw']->template->set_var('holidaystyle', $holidaystyle);
-                                       
$GLOBALS['phpgw']->template->set_var('date', date('d.m', $key));
-                                       
$GLOBALS['phpgw']->template->parse('matrix_day_i','matrix_day', True);
+                                       
$GLOBALS['phpgw']->template->set_var(array(
+                      'holidaystyle' => $holidaystyle,
+                      'date' => date('d.m', $key),
+                      'cell_row' => $row++,
+                      
+                      'matrix_value' => '{matrix_value' . $i . '}',
+                      'content_value' => '{content_value' . $i . '}',
+                      'content_tooltip' => '{content_tooltip' . $i . '}'
+                    ));
+                    $GLOBALS['phpgw']->template->set_var('cell_line',0);
+                                       
$GLOBALS['phpgw']->template->parse('matrix_day_i','matrix_day',true);
+                    $GLOBALS['phpgw']->template->unset_var('cell_line');
+                    
$GLOBALS['phpgw']->template->set_var('cell_row','{cell_row' . $i . '}');
+                    
$GLOBALS['phpgw']->template->parse('content_cell_i','content_cell',true);
+                    ++$i;
                                }
-                               
$GLOBALS['phpgw']->template->parse('matrix_days','matrix_day_i', False);
-                               
$GLOBALS['phpgw']->template->set_var('matrix_day_i','');
-                       
                                $GLOBALS['phpgw']->template->set_var('l_total', 
lang('Total'));
-                               
-/************************* Body **********************/
-                               
-                               
$GLOBALS['phpgw']->template->set_block('controlling', 'body_row', 
'body_rows_i');
-
-//Fix this two next items in template
-                       //      
$GLOBALS['phpgw']->template->set_block('controlling', 'row_title', 
'row_titles_i');
-                       //      
$GLOBALS['phpgw']->template->set_block('controlling', 'content_cell', 
'content_cells_i');
-
-                               for($i = 0; $i < count($matrix); $i++)
-                               {
-                                       if($i%2)
-                                       {                                       
        
-                                               
$GLOBALS['phpgw']->template->set_var('row_color', 'background-color: #FFFFFF'); 
-                                       }
-                                       else
+                /************************* Body **********************/
+                for($i = 0; $i < count($matrix); ++$i)
                                        {                                       
        
-                                               
$GLOBALS['phpgw']->template->set_var('row_color', 'background-color: #EEEEEE');
-                                       }
-                                       for($j = 0; $j < count($rowtitles); 
$j++)
+                  ++$line;
+                  $row = 0;
+                  // row titles: name, number, endtime
+                  $GLOBALS['phpgw']->template->set_var(array(
+                    'row_color' => 'background-color:#' . (($i % 2) ? 'FFFFFF' 
: 'EEEEEE'),
+                    'cell_line' => $line,
+                    'matrix_link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=>'projects.uiprojecthours.list_hours','project_id'=> 
$matrix[$i]['id']))
+                  ));
+                  for ($j = 0; $j < count($rowtitles); ++$j)
                                        {                               
-                                               
$GLOBALS['phpgw']->template->set_var('matrix_link', 
$GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=>'projects.uiprojecthours.list_hours','project_id'=>$matrix[$i]['id'])));
-
-                                               switch($rowtitles[$j])
+                    $GLOBALS['phpgw']->template->set_var('cell_row' . 
$j,$row++);
+                    switch ($rowtitles[$j])
                                                {
                                                        case 'number':          
                                                
-                                                               
$GLOBALS['phpgw']->template->set_var('pnumber', $matrix[$i]['pnumber']);
+                        $GLOBALS['phpgw']->template->set_var(array(
+                          'pnumber' . $j => $matrix[$i]['pnumber'],
+                          'title' . $j => '',
+                          'enddate' . $j => ''
+                        ));
                                                                break;
-                                                       
                                                        case 'edateout':
-                                                               
if($matrix[$i]['enddate'] > 0)
-                                                               {               
                                                                
-                                                                       
$GLOBALS['phpgw']->template->set_var('enddate', 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$matrix[$i]['enddate']));
-                                                               }
+                        $GLOBALS['phpgw']->template->set_var(array(
+                          'pnumber' . $j => '',
+                          'title' . $j => '',
+                          'enddate' . $j => ($matrix[$i]['enddate'] > 0) ? 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$matrix[$i]['enddate'])
 : ''
+                        ));
                                                                break;
-                                                                               
                                        
+                      case 'title':
                                                        default:                
                                                
-                                                               
$GLOBALS['phpgw']->template->set_var('title', $matrix[$i]['title']);
+                        $GLOBALS['phpgw']->template->set_var(array(
+                          'pnumber' . $j => '',
+                          'title' . $j => $matrix[$i]['title'],
+                          'enddate' . $j => ''
+                        ));
                                                } 
-                                               
-                                               
$GLOBALS['phpgw']->template->parse('row_titles_i','row_title', True);
                                        }
-                                       
$GLOBALS['phpgw']->template->parse('row_titles','row_titles_i', False);
-                                       
$GLOBALS['phpgw']->template->set_var('row_titles_i','');                        
                        
-       
+                  
$GLOBALS['phpgw']->template->parse('row_title_j','row_title_i',false);
+                  // row columns
+                  // continue with $j (row)
                                        foreach($matrix[$i]['days'] as $key => 
$value)
                                        {
                                                $daytotal[$key]['booked'] += 
$value;
                                                $matrix[$i]['days']['total'] += 
$value;
-                                                                               
                
-                                               
$GLOBALS['phpgw']->template->set_var('matrix_value', $matrix[$i]['id'].', 
'.$key);
-                                               
$GLOBALS['phpgw']->template->set_var('content_value', 
$this->bohours->format_minutes($value) != '' ? 
$this->bohours->format_minutes($value) : '&nbsp;');
-                                               
$GLOBALS['phpgw']->template->parse('content_cells_i','content_cell', True);
-                                       }
-                                       
$GLOBALS['phpgw']->template->parse('content_cells','content_cells_i', False);
-                                       
$GLOBALS['phpgw']->template->set_var('content_cells_i','');
-                                                                               
-                                       
$GLOBALS['phpgw']->template->set_var('row_total_value', 
$this->bohours->format_minutes($matrix[$i]['days']['total']));
-                                                                               
-                                       
$GLOBALS['phpgw']->template->parse('body_rows_i','body_row', True);
+                    if(is_integer($key))
+                    {
+                      $tooltip = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$key)
 . ' : ' . trim(str_replace('&nbsp;',' ',$matrix[$i]['title']));
                                }
-                               
$GLOBALS['phpgw']->template->parse('body_rows','body_rows_i', False);
-                               
$GLOBALS['phpgw']->template->set_var('body_rows_i',''); 
-
-/******************* foot ************************/    
-                       
-                               
$GLOBALS['phpgw']->template->set_var('theme_th_bg',     
$GLOBALS['phpgw_info']['theme']['th_bg']);
-                               
$GLOBALS['phpgw']->template->set_var('rowtitles', count($rowtitles));
-                               $GLOBALS['phpgw']->template->set_var('l_total', 
lang('Total'));
-                               
-                               
$GLOBALS['phpgw']->template->set_block('controlling', 'daytotal', 
'daytotals_i');
-                               foreach($daytotal as $key => $value)
+                    else
                                {
-                                       $booked_total += $value['booked'];
-                                                                               
-                                       
$GLOBALS['phpgw']->template->set_var('format_minutes', 
$this->bohours->format_minutes($value['booked']));
-                                       
$GLOBALS['phpgw']->template->parse('daytotals_i','daytotal', True);
+                      $tooltip = '';
                                }
-                               
$GLOBALS['phpgw']->template->parse('daytotals','daytotals_i', False);
-                               
$GLOBALS['phpgw']->template->set_var('daytotals_i','');
-                                                               
-                               
$GLOBALS['phpgw']->template->set_var('booked_total', 
$this->bohours->format_minutes($booked_total));
-                               
$GLOBALS['phpgw']->template->set_var('theme_bg', 
$GLOBALS['phpgw_info']['theme']['th_bg']);
-                               
$GLOBALS['phpgw']->template->set_var('rowtitles', count($rowtitles));
-                               
$GLOBALS['phpgw']->template->set_var('l_overtime', lang('Overtime'));
-                               
-                               
$GLOBALS['phpgw']->template->set_block('controlling', 'daytotal2', 
'daystotal2_i');
+                    $GLOBALS['phpgw']->template->set_var(array(
+                      'matrix_value' . $j => $matrix[$i]['id'] . ', ' . $key,
+                      'content_value'. $j => 
($this->bohours->format_minutes($value) != '') ? 
$this->bohours->format_minutes($value) : '&nbsp;',
+                      'content_tooltip' . $j => $tooltip,
+                      'cell_row' . $j => $row++
+                    ));
+                    ++$j;
+                  }
+                  
$GLOBALS['phpgw']->template->parse('content_cell_j','content_cell_i',false);
+                  $GLOBALS['phpgw']->template->set_var(array(
+                    'content_tooltip' => lang('total').' '.lang('project').' 
'.$matrix[$i]['title'],
+                    'row_total_value' => 
$this->bohours->format_minutes($matrix[$i]['days']['total']),
+                    'cell_line' => $line,
+                    'cell_row' => $row++
+                  ));
+                  
$GLOBALS['phpgw']->template->parse('body_row_i','body_row',true);
+                  $GLOBALS['phpgw']->template->set_var(array(
+                    'row_title_j' => '',
+                    'content_cell_j' => ''
+                  ));
+                }
+                //************************* Foot **********************/
+                               $GLOBALS['phpgw']->template->set_var(array(
+                  'theme_th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
+                  'rowtitles' => count($rowtitles),
+                  'l_total' => lang('Total'),
+                  'total_cell_line' => 0,
+                  'total_cell_row' => --$row,
+                ));
+                               
$GLOBALS['phpgw']->template->set_block('controlling', 'daytotal', 'daytotal_i');
+                $GLOBALS['phpgw']->template->set_block('controlling', 
'daytotal2', 'daytotal2_i');
+                               $line_total_2 = ++$line;
+                               $line_total   = ++$line;
+                               $row = 1;
                                foreach($daytotal as $key => $value)
                                {
+                    // Booked
+                                       $booked_total += $value['booked'];
+                    $tooltip = lang('Total').' : 
'.date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$key);
+                                       
$GLOBALS['phpgw']->template->set_var(array(
+                      'format_minutes' => 
$this->bohours->format_minutes($value['booked']),
+                      'content_tooltip' => $tooltip,
+                      'cell_line' => $line_total,
+                      'cell_row' => $row++
+                    ));
+                                       
$GLOBALS['phpgw']->template->parse('daytotal_i','daytotal', True);
+                    // Difference
                                        $should_total += $value['should'];
-                                       
-                                       
$GLOBALS['phpgw']->template->set_var('format_minutes', 
$this->bohours->format_minutes($value['booked'] - $value['should']));
-                                       
$GLOBALS['phpgw']->template->parse('daystotal2_i','daytotal2', True);
+                    $tooltip = lang('Overtime').' : 
'.date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$key);
+                    $GLOBALS['phpgw']->template->set_var(array(
+                      'format_minutes' => 
$this->bohours->format_minutes($value['booked'] - $value['should']),
+                      'content_tooltip' => $tooltip,
+                      'cell_line' => $line_total_2
+                    ));
+                    
$GLOBALS['phpgw']->template->parse('daytotal2_i','daytotal2', True);
                                }
-                               
$GLOBALS['phpgw']->template->parse('daystotal2','daystotal2_i', False);
-                               
$GLOBALS['phpgw']->template->set_var('daystotal2_i','');
-                               
-                               
$GLOBALS['phpgw']->template->set_var('booked_total2', 
$this->bohours->format_minutes($booked_total - $should_total));
+                               $GLOBALS['phpgw']->template->set_var(array(
+                  'booked_total' => 
$this->bohours->format_minutes($booked_total),
+                  'theme_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
+                  'rowtitles' => count($rowtitles),
+                  'l_overtime' => lang('Overtime'),
+                  'booked_cell_line' => $line_total,
+                  'booked_cell_row' => 0,
+                  'booked_total2' => 
$this->bohours->format_minutes($booked_total - $should_total),
+                  'booked2_cell_line' => $line_total_2,
+                  'booked2_cell_row' => 0
+                ));
                        }
-                       $GLOBALS['phpgw']->template->pfp('out','controlling', 
False);
+                       
$GLOBALS['phpgw']->template->pfp('out','controlling',false);
                }
 
+
                function export_controlling_sheet($start_array, $end_array)
                {
                        $export = 
$this->bohours->export_controlling_sheet($start_array['raw'],
@@ -1778,6 +1904,7 @@
                        $GLOBALS['phpgw']->common->phpgw_exit();
                }
                
+
                function import_controlling_sheet()
                {
                        //$GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . lang('import controlling sheet')
@@ -1831,7 +1958,7 @@
                                        $out .= lang('work time');
                                        $out .= '</td>';
                                        $out .= '<td>';
-                                       $out .= lang('time of journey');
+                                       $out .= lang('travel time');
                                        $out .= '</td>';
                                        $out .= '<td>';
                                        $out .= lang('description');
@@ -1948,13 +2075,13 @@
                        
$GLOBALS['phpgw']->template->set_file(array('controlling' => 
'hours_import_controlling.tpl'));
                        $GLOBALS['phpgw']->template->set_var('l_upload', 
lang('upload'));
                        $GLOBALS['phpgw']->template->set_var('l_statement', 
lang('Please beware').':<br>'
-                                                                               
 .lang('All correct hours in uploaded CSV file will be added to your 
account').'<br>'
-                                                                               
 .lang('It will NOT check if you already have uploaded hours for a certain day')
+                                                                               
                                                                                
                                                                                
         .lang('All correct hours in uploaded CSV file will be added to your 
account.').'<br>'
+                                                                               
                                                                                
                                                                                
         .lang('It will NOT check if you already have uploaded hours for a 
certain day.')
                                                                                
);
                        $GLOBALS['phpgw']->template->set_var('error', $error);
                        $GLOBALS['phpgw']->template->set_var('action', 
$GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=>'projects.uiprojecthours.import_controlling_sheet')));
 
-                       $GLOBALS['phpgw']->template->pfp('out','controlling', 
True);
+                       
$GLOBALS['phpgw']->template->pfp('out','controlling',false);
                        $GLOBALS['phpgw']->common->phpgw_exit();
                }
        }

Index: inc/class.uiprojects.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/class.uiprojects.inc.php,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -b -r1.169 -r1.170
--- inc/class.uiprojects.inc.php        28 Nov 2006 17:54:50 -0000      1.169
+++ inc/class.uiprojects.inc.php        5 Dec 2006 19:40:45 -0000       1.170
@@ -3,10 +3,10 @@
        * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: class.uiprojects.inc.php,v 1.169 2006/11/28 17:54:50 
sigurdne Exp $
+       * @version $Id: class.uiprojects.inc.php,v 1.170 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/class.uiprojects.inc.php,v $
        */
 
@@ -33,11 +33,14 @@
                        //'accounts_popup'                      => True,
                        //'e_accounts_popup'                    => True,
                        'list_budget'                           => True,
+                       'project_mstones'                       => True,
                        'assign_employee_roles'         => True,
                        'report'                                        => True,
                        'export_cost_accounting'        => True,
+                       'export_cost_accounting_A' => True,
                        'view_employee_activity'        => True,
-                       'tree_view_projects'            => True
+                       'tree_view_projects'            => True,
+                       'view_report_list'                      => true
                );
 
                function uiprojects()
@@ -48,7 +51,9 @@
                        $this->boprojects                               = 
$this->ui_base->boprojects;
                        $this->nextmatchs                               = 
CreateObject('phpgwapi.nextmatchs');
 
-                       $this->attached_files                   = 
CreateObject('filemanager.attached_files');
+                       $this->attached_files                   = 
CreateObject('projects.attached_files');
+                       $this->bohours                                  = 
CreateObject('projects.boprojecthours');
+                       $this->accounts                                 = 
CreateObject('phpgwapi.accounts');
 
                        $this->start                                    = 
$this->boprojects->start;
                        $this->query                                    = 
$this->boprojects->query;
@@ -57,6 +62,21 @@
                        $this->sort                                             
= $this->boprojects->sort;
                        $this->cat_id                                   = 
$this->boprojects->cat_id;
                        $this->status                                   = 
$this->boprojects->status;
+
+                       if(!is_object($GLOBALS['phpgw']->js))
+                       {
+                               $GLOBALS['phpgw']->js = 
createObject('phpgwapi.javascript');
+                       }
+                       
$GLOBALS['phpgw']->js->validate_file('tabs','tabs','phpgwapi');
+                       
$GLOBALS['phpgw']->js->validate_file('core','popup','phpgwapi');
+
+                       if(!is_object($GLOBALS['phpgw']->css))
+                       {
+                               $GLOBALS['phpgw']->css = 
createObject('phpgwapi.css');
+                       }
+                       
$GLOBALS['phpgw']->css->validate_file('tabs','phpgwapi');
+                       
$GLOBALS['phpgw']->css->validate_file('style','projects');
+                       
$GLOBALS['phpgw']->css->validate_file('tooltip','phpgwapi');
                }
 
                function save_sessiondata($action)
@@ -76,7 +96,6 @@
 
                function priority_list($selected = 0)
                {
-                       $list = '';
                        for($i=1;$i<=10;$i++)
                        {
                                $list .= '<option value="' . $i . '"' . ($i == 
$selected?' SELECTED>':'>') . $i . '</option>';
@@ -94,9 +113,14 @@
                                $this->cat_id = $_GET['cat_id'];
                        }
 
+                       if($project_id && !$pro_main)
+                       {
+                               $pro_main = $this->ui_base->pro_main;
+                       }
+
                        if (!$action)
                        {
-                               $action = 'mains';
+                               $action = $this->ui_base->action;
                        }
 
                        //$GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . lang('list projects')
@@ -123,13 +147,19 @@
                                $main = 
$this->boprojects->read_single_project($pro_main);
                                
$GLOBALS['phpgw']->template->set_var('title_main',$main['title']);
                                
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project',
-                                                                               
                                                                                
                                                'action'=>'mains',
-                                                                               
                                                                                
                                                'project_id'=> $pro_main)));
+                                                                               
                                                                                
                                                        'action'=>'mains'
+                                                                               
                                                                                
                                                        ,'project_id'=> 
$pro_main)));
                                
$GLOBALS['phpgw']->template->set_var('coordinator_main',$main['coordinatorout']);
                                
$GLOBALS['phpgw']->template->set_var('number_main',$main['number']);
                                
$GLOBALS['phpgw']->template->set_var('customer_main',$main['customerout']);
                                
$GLOBALS['phpgw']->template->set_var('customer_org_name',$main['customerorgout']);
                                
$GLOBALS['phpgw']->template->set_var('url_main',$main['url']);
+                               
$GLOBALS['phpgw']->template->set_var('attachment',$this->attached_files->get_files($pro_main));
+                               
$GLOBALS['phpgw']->template->set_var('lang_files',lang('Files'));
+                               $link = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.report',
+                                                                               
                                                        'project_id'=>$pro_main,
+                                                                               
                                                        'generated'=>'true'));
+                               
$GLOBALS['phpgw']->template->set_var('report','<a href="' . $link . '"><img 
src="projects/templates/' . $GLOBALS['phpgw_info']['server']['template_set'] . 
'/images/document.png" title="' . lang('generate activity report') . '">' . 
lang('generate activity report') . '</a>');
                                
$GLOBALS['phpgw']->template->parse('main','project_main',True);
                        }
 
@@ -201,6 +231,7 @@
                                        case 'psdateout':               $cname 
= lang('start date planned'); $db = 'psdate'; $col_align= 'center'; break;
                                        case 'pedateout':               $cname 
= lang('date due planned'); $db = 'pedate'; $col_align= 'center'; break;
                                        case 'discountout':             $cname 
= lang('discount'); $db = 'discount'; $col_align= 'right'; break;
+                                       case 'salesmanagerout': $cname = 
lang('sales manager'); $db = 'salesmanager'; break;
                                }
 
                                if ($col=='mstones')
@@ -209,7 +240,7 @@
                                }
                                else
                                {
-                                       $sort_column = 
$this->nextmatchs->show_sort_order($this->sort,(isset($db)?$db:$col),$this->order,'/index.php',$cname?$cname:lang($col),$link_data);
+                                       $sort_column = 
$this->nextmatchs->show_sort_order($this->sort,($db?$db:$col),$this->order,'/index.php',$cname?$cname:lang($col),$link_data);
                                }
                                
$GLOBALS['phpgw']->template->set_var('col_align',$col_align?$col_align:'left');
                                
$GLOBALS['phpgw']->template->set_var('sort_column',$sort_column);
@@ -236,8 +267,10 @@
                                        }
                                        /*else
                                        {
-                                               $projects_url = 
$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojecthours.list_hours&project_id='
-                                                                       . 
$p['project_id'] . '&action=hours&pro_main=' . $pro_main);
+                                               $projects_url = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.list_hours',
+                                                                               
                                                                                
        'project_id'=> $p['project_id'],
+                                                                               
                                                                                
        'action'=>'hours',
+                                                                               
                                                                                
        'pro_main'=> $pro_main));
                                        }
                                        */
                                        
$GLOBALS['phpgw']->template->set_var(array
@@ -267,7 +300,7 @@
                                                }
 
                                                
$GLOBALS['phpgw']->template->set_var('col_align',$col_align);
-                                               
$GLOBALS['phpgw']->template->set_var('column',(isset($p[$col])?$p[$col]:''));
+                                               
$GLOBALS['phpgw']->template->set_var('column',$p[$col]);
                                                
$GLOBALS['phpgw']->template->fp('pro_column','pro_cols',True);
                                        }
                                        
//$GLOBALS['phpgw']->template->set_var('pro_column',$pdata);
@@ -289,12 +322,12 @@
                                                                                
                                                                                
. '" border="0">'));
 
                                        if 
($this->boprojects->add_perms(array('action' => $action,'coordinator' => 
$p['coordinator'],
-                                                                               
                                'main_co' => 
(isset($main['coordinator'])?$main['coordinator']:''),'parent' => 
$p['parent'])))
+                                                                               
                                'main_co' => $main['coordinator'],'parent' => 
$p['parent'])))
                                        {
                                                
$GLOBALS['phpgw']->template->set_var('add_job_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.edit_project',
                                                                                
                                                                                
                                                                
'action'=>'subs',
                                                                                
                                                                                
                                                                'pro_parent'=> 
$p['project_id'],
-                                                                               
                                                                                
                                                                'pro_main'=> 
($pro_main?$pro_main:$p['project_id']))));
+                                                                               
                                                                                
                                        'pro_main'=>(isset($pro_main) && 
$pro_main ? $pro_main:$p['project_id']))));
                                                
$GLOBALS['phpgw']->template->set_var('add_job_img','<img src="' . 
$GLOBALS['phpgw']->common->image('phpgwapi','new') . '" title="' . lang('add 
sub project')
                                                                                
                                                                . '" 
border="0">');
                                        }
@@ -305,10 +338,10 @@
 
 // --------------- Button interactions --------------------------
                        $valid_interactions = 
$this->boprojects->get_interactions(array('pro_main'    => $pro_main,
-                                                                               
        'project_id'  => (isset($p['project_id'])?$p['project_id']:''),
+                                                                               
        'project_id'  => $p['project_id'],
                                                                                
        'status'      => $this->status,
                                                                                
        'action'      => $action,
-                                                                               
        'coordinator' => (isset($main['coordinator'])?$main['coordinator']:'')
+                                                                               
        'coordinator' => $main['coordinator']
                                                                                
       ));
                        if(in_array('book_hours', $valid_interactions))
                        {
@@ -388,7 +421,7 @@
                                }
                        }
 
-                       
$GLOBALS['phpgw']->template->set_file(array('projects_list_t' => 'list.tpl'));
+                       
$GLOBALS['phpgw']->template->set_file(array('projects_list_t' => 
'list_tree.tpl'));
                        
$GLOBALS['phpgw']->template->set_block('projects_list_t','projects_list','list');
                        
$GLOBALS['phpgw']->template->set_block('projects_list_t','pro_sort_cols','sort_cols');
                        
$GLOBALS['phpgw']->template->set_block('projects_list_t','pro_cols','cols');
@@ -405,40 +438,55 @@
                        {
                                $main = 
$this->boprojects->read_single_project($pro_main);
                                
$GLOBALS['phpgw']->template->set_var('title_main',$main['title']);
-                               
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojects.view_project&action=mains&project_id='
-                                                                               
                                                                                
                . $pro_main));
+                               
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project',
+                                                                               
                                                                                
                                                'action'=>'mains',
+                                                                               
                                                                                
                                                'project_id'=> $pro_main)));
                                
$GLOBALS['phpgw']->template->set_var('coordinator_main',$main['coordinatorout']);
                                
$GLOBALS['phpgw']->template->set_var('number_main',$main['number']);
                                
$GLOBALS['phpgw']->template->set_var('customer_main',$main['customerout']);
                                
$GLOBALS['phpgw']->template->set_var('customer_org_name',$main['customerorgout']);
                                
$GLOBALS['phpgw']->template->set_var('url_main',$main['url']);
-                               $link = 
$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojects.report&project_id='
 . $pro_main . '&generated=1');
+                               
$GLOBALS['phpgw']->template->set_var('attachment',$this->attached_files->get_files($pro_main));
+                               
$GLOBALS['phpgw']->template->set_var('lang_files',lang('Files'));
+                               $link = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.report',
+                                                                               
                                                        'project_id'=> 
$pro_main,
+                                                                               
                                                        'generated'=>1));
                                
$GLOBALS['phpgw']->template->set_var('report','<a href="' . $link . '"><img 
src="projects/templates/' . $GLOBALS['phpgw_info']['server']['template_set'] . 
'/images/document.png" title="' . lang('generate activity report') . '">' . 
lang('generate activity report') . '</a>');
                                
$GLOBALS['phpgw']->template->parse('main','project_main',True);
                        }
 */
-                       $pro = $this->boprojects->list_projects(array('action' 
=> 'mainsubsorted','project_id' => $project_id));
-
+                       $this->boprojects->status = false; // workaround for 
full tree view support
+                       $pro = $this->boprojects->list_projects(array('action' 
=> 'mainsubsorted','project_id' => $project_id, 'limit' => false));
 
 // --------------------- nextmatch variable template-declarations 
------------------------
-
+/*
                        $left = 
$this->nextmatchs->left('/index.php',$this->start,$this->boprojects->total_records,$link_data);
                        $right = 
$this->nextmatchs->right('/index.php',$this->start,$this->boprojects->total_records,$link_data);
                        $GLOBALS['phpgw']->template->set_var('left',$left);
                        $GLOBALS['phpgw']->template->set_var('right',$right);
 
                        
$GLOBALS['phpgw']->template->set_var('lang_showing',$this->nextmatchs->show_hits($this->boprojects->total_records,$this->start));
-
+*/
 // ------------------------- end nextmatch template 
--------------------------------------
 
-                       $action_list= '<select name="cat_id" 
onChange="this.form.submit();"><option value="none">' . lang('Select category') 
. '</option>' . "\n"
-                                               . 
$this->boprojects->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
+                       //$action_list= '<select name="cat_id" 
onChange="this.form.submit();"><option value="none">' . lang('Select category') 
. '</option>' . "\n"
+                       //                      . 
$this->boprojects->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
+/*
+                       if($pro_main)
+                       {
+                               $cat_id = 
$this->boprojects->return_value('cat', $pro_main);
+                               $action_list = lang('category').': 
'.$this->boprojects->cats->id2name($cat_id);
+                               $action_list = '<input style="border: solid 2px 
#d0d0d0;" readonly="readonly" size="60" type="text" 
value="&nbsp;'.$action_list.'">';
+                       }
 
                        
$GLOBALS['phpgw']->template->set_var('action_list',$action_list);
                        
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
-                       
$GLOBALS['phpgw']->template->set_var('filter_list',$this->nextmatchs->new_filter($this->filter));
+                       
//$GLOBALS['phpgw']->template->set_var('filter_list',$this->nextmatchs->new_filter($this->filter));
                        
$GLOBALS['phpgw']->template->set_var('search_list',$this->nextmatchs->search(array('query'
 => $this->query)));
-                       
$GLOBALS['phpgw']->template->set_var('status_list',$this->ui_base->status_format($this->status));
+*/
+                       //workaround for full tree view support
+                       //$status_list = '<select name="status" 
onChange="this.form.submit();">'.$this->ui_base->status_format($this->status).'</select>';
+                       
//$GLOBALS['phpgw']->template->set_var('status_list',$status_list);
 
 // ---------------- list header variable template-declarations 
--------------------------
 
@@ -463,6 +511,7 @@
                                        case 'budget':                  $cname 
= $prefs['currency'] . ' ' . lang('budget'); $col_align= 'right'; break;
                                        case 'e_budget':                $cname 
= $prefs['currency'] . ' ' . lang('extra budget'); $col_align= 'right'; break;
                                        case 'coordinatorout':  $cname = 
lang('coordinator'); $db = 'coordinator'; break;
+                                       case 'salesmanagerout':         $cname 
= lang('sales manager'); break; $db = 'salesmanager'; break;
                                        case 'customerout':             $cname 
= lang('customer'); break; $db = 'customer'; break;
                                        case 'investment_nr':   $cname = 
lang('investment nr'); break;
                                        case 'previousout':             $cname 
= lang('previous'); $db = 'previous'; break;
@@ -486,7 +535,7 @@
                                }
                                else
                                {
-                                       $sort_column = 
$this->nextmatchs->show_sort_order($this->sort,(isset($db)?$db:$col),$this->order,'/index.php',$cname?$cname:lang($col),$link_data);
+                                       $sort_column = 
$this->nextmatchs->show_sort_order($this->sort,($db?$db:$col),$this->order,'/index.php',$cname?$cname:lang($col),$link_data);
                                }
                                
$GLOBALS['phpgw']->template->set_var('col_align',$col_align?$col_align:'left');
                                
$GLOBALS['phpgw']->template->set_var('sort_column',$sort_column);
@@ -575,12 +624,12 @@
                                                                                
                                                                                
. '" border="0">'));
 
                                        if 
($this->boprojects->add_perms(array('action' => $action,'coordinator' => 
$p['coordinator'],
-                                                                               
                                'main_co' => 
(isset($main['coordinator'])?$main['coordinator']:''),'parent' => 
$p['parent'])))
+                                                                               
                                'main_co' => $main['coordinator'],'parent' => 
$p['parent'])))
                                        {
                                                
$GLOBALS['phpgw']->template->set_var('add_job_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.edit_project',
                                                                                
                                                                                
                                        'action'=>'subs',
                                                                                
                                                                                
                                        'pro_parent'=> $p['project_id'],
-                                                                               
                                                                                
                                        
'pro_main'=>($pro_main?$pro_main:$p['project_id']))));
+                                                                               
                                                                                
                                                                                
'pro_main'=> (isset($pro_main) && $pro_main?$pro_main:$p['project_id']))));
                                                
$GLOBALS['phpgw']->template->set_var('add_job_img','<img src="' . 
$GLOBALS['phpgw']->common->image('phpgwapi','new') . '" title="' . lang('add 
sub project')
                                                                                
                                                                . '" 
border="0">');
                                        }
@@ -664,6 +713,7 @@
 // ---------------- list header variable template-declarations 
--------------------------
 
                        
$this->t->set_var('sort_number',$this->nextmatchs->show_sort_order($this->sort,'p_number',$this->order,'/index.php',lang('Project
 ID'),$link_data));
+                       $this->t->set_var('lang_milestones',lang('milestones'));
                        
$this->t->set_var('sort_title',$this->nextmatchs->show_sort_order($this->sort,'title',$this->order,'/index.php',lang('Title'),$link_data));
                        
$this->t->set_var('sort_end_date',$this->nextmatchs->show_sort_order($this->sort,'end_date',$this->order,'/index.php',lang('Date
 due'),$link_data));
                        
$this->t->set_var('sort_coordinator',$this->nextmatchs->show_sort_order($this->sort,'coordinator',$this->order,'/index.php',lang('Coordinator'),$link_data));
@@ -703,7 +753,7 @@
                                        $projects_url = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.list_hours',
                                                                                
                                                                        
'project_id'=> $pro[$i]['project_id'],
                                                                                
                                                                        
'action'=>'hours',
-                                                                               
                                                                        
'pro_main'=> $pro_main));
+                                                                               
                                                                                
'pro_main'=>$pro_main));
                                }
 
                                $this->t->set_var(array
@@ -732,13 +782,14 @@
 
                function edit_project()
                {
-                       $message ='';
                        if(!is_object($GLOBALS['phpgw']->js))
                        {
                                $GLOBALS['phpgw']->js = 
createObject('phpgwapi.javascript');
                        }
+                       $GLOBALS['phpgw']->js->validate_file('api', 'tabs');
 
                        $jscal = CreateObject('phpgwapi.jscalendar');
+                       $cssTooltip = CreateObject('phpgwapi.csstooltip');
                                
                        $action          = 
get_var('action',array('GET','POST'));
                        $pro_main        = 
get_var('pro_main',array('GET','POST'));
@@ -746,7 +797,7 @@
                        $book_activities = 
get_var('book_activities',array('POST'));
                        $bill_activities = 
get_var('bill_activities',array('POST'));
                        $project_id      = 
get_var('project_id',array('GET','POST'));
-                       //$name            = get_var('name',array('POST'));
+                       $name            = get_var('name',array('POST'));
                        $values          = get_var('values',array('POST'));
                        $sdate           = get_var('sdate',array('GET','POST'));
                        $edate           = get_var('edate',array('GET','POST'));
@@ -754,7 +805,14 @@
                        $pedate          = 
get_var('pedate',array('GET','POST'));
                        $budgetradio     = 
get_var('budgetradio',array('GET','POST'));
 
-                       if($pro_parent>0)
+                       if($pro_parent === '')
+                       {
+                               $pro_parent = 
$this->boprojects->return_value('parent', $project_id);
+                       }
+
+                       if(!$action)
+                       {
+                               if($pro_parent > 0)
                        {
                                $action = 'subs';
                        }
@@ -762,29 +820,55 @@
                        {
                                $action = 'mains';
                        }
+                       }
 
-                       if(!$action && $project_id>0)
+                       // only 'Y' would be submitted because it is a checkbox 
and
+                       // not checked values wouldnt submitted
+                       if(!isset($values['plan_bottom_up']))
                        {
-                               $parent = 
$this->boprojects->return_value('parent', $project_id);
-                               if($parent > 0)
+                               // differ project typ
+                               if($action == 'mains')
                                {
-                                       $action = 'subs';
+                                       $plan_bottom_up = 'N';
+                               }
+                               else
+                               { // use parent setting
+                                       $plan_bottom_up = 
$this->boprojects->return_value('plan_bottom_up', $pro_parent);
+                               }
                                }
                                else
                                {
-                                       $action = 'mains';
+                               $plan_bottom_up = $values['plan_bottom_up'];
                                }
+
+                       if(!isset($values['cat']) && $pro_parent>0)
+                       {
+                               $pro_main = 
$this->boprojects->return_value('main', $pro_parent);
+                               $pro_main_data = 
$this->boprojects->read_single_project($pro_main);
+                               $values['cat'] = $pro_main_data['cat'];
                        }
 
                        $link_data = array
                        (
-                               'menuaction'    => 
'projects.uiprojects.edit_project',
+                               'menuaction'    => 
'projects.uiprojects.tree_view_projects',
                                'pro_main'              => $pro_main,
                                'action'                => $action,
                                'project_id'    => $project_id,
                                'pro_parent'    => $pro_parent
                        );
 
+                       if($_POST['mstone'])
+                       {
+                               $link_data['menuaction'] = 
'projects.uiprojects.project_mstones';
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+
+                       if($_POST['roles'])
+                       {
+                               $link_data['menuaction'] = 
'projects.uiprojects.assign_employee_roles';
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+
                        if(is_array($sdate))
                        {
                                $start_array    = 
$jscal->input2date($sdate['str']);
@@ -809,22 +893,13 @@
                                $pend_val       = $pend_array['raw'];
                        }
 
-                       //_debug_array($sdate);
-
-                       if ((isset($_POST['save']) && $_POST['save']) || 
(isset($_POST['apply']) && $_POST['apply']))
-                       {
-                               $this->cat_id = ($values['cat'] ? 
$values['cat'] : '');
-
-                               $values['coordinator']  = 
(isset($_POST['accountid'])?$_POST['accountid']:'');
-                               
-                               if(isset($_POST['employees']) && 
is_array($_POST['employees']))
+                       if ($_POST['save'] || $_POST['apply'])
                                {
+                               //$this->cat_id = ($values['cat'] ? 
$values['cat'] : ''); // disable because no reason for change selected cat when 
add/edit project
+                               $values['billable']             = 
isset($values['not_billable']) ? false : true;
+                               $values['coordinator']  = $_POST['accountid'];
+                               $values['salesmanager'] = 
$_POST['salesmanagerid'];
                                        $values['employees']  = 
array_merge($_POST['employees'], array($_POST['accountid']));
-                               }
-                               else
-                               {
-                                       $values['employees'] = 
array($_POST['accountid']);
-                               }                       
                                $values['project_id']   = $project_id;
                                $values['customer']     = $_POST['abid'];
                                $values['customer_org'] = 
$_POST['customer_org'];
@@ -834,6 +909,15 @@
                                $values['edate']  = $end_val;
                                $values['psdate'] = $pstart_val;
                                $values['pedate'] = $pend_val;
+                               $values['plan_bottom_up'] = $plan_bottom_up;
+
+                               $old_values = 
$this->boprojects->read_single_project($project_id);
+                               if(is_array($old_values))
+                               {
+                                       $values['ptime'] = $values['ptime'] + 
$old_values['ptime_childs'];
+                                       $values['budget'] = $values['budget'] + 
$old_values['budget_childs'];
+                                       $values['e_budget'] = 
$values['e_budget'] + $old_values['e_budget_childs'];
+                               }
                                
                                switch($budgetradio)
                                {
@@ -842,24 +926,28 @@
                                        default : $values['budgetradio'] = 'm'; 
break;
                                }
                                
-                               if(isset($values['radio_acc_factor']) && 
$values['radio_acc_factor'] == 'day')
+                               if ($values['accounting'] == 'project')
+                               {
+                                       if 
($values['project_accounting_factor'] || $values['project_accounting_factor_d'])
                                {
+                                               
switch($values['radio_acc_factor'])
+                                               {
+                                                       case 'day': // only 
$values['project_accounting_factor'] submitted
+                                                               
$values['project_accounting_factor_d'] = $values['project_accounting_factor'];
                                        $values['project_accounting_factor'] = 
$values['project_accounting_factor'] / $this->boprojects->siteconfig['hwday'];
+                                                       break;
+                                                       default:
+                                                               
$values['project_accounting_factor_d'] = $values['project_accounting_factor'] * 
$this->boprojects->siteconfig['hwday'];
+                                                       break;
                                }
 
-                               if (isset($values['accounting']) && 
$values['accounting'] == 'project')
-                               {
-                                       $values['ptime']  = 
intval($values['ptime']);
-                                       $values['budget'] = 
round($values['budget'], 2);
-                                       if($values['project_accounting_factor'] 
> 0)
-                                       {
-                                               if($values['budgetradio'] == 
'm')
+                                               if(($values['budgetradio'] == 
'm') && ($values['project_accounting_factor'] > 0))
                                                {                       
                                                                
$values['ptime'] = intval($values['budget'] / 
$values['project_accounting_factor']);
                                                }
                                                elseif($values['budgetradio'] 
== 'h')
                                                {
-                                                       $values['budget'] = 
$values['ptime'] * $values['project_accounting_factor'];
+                                                       $values['budget'] = 
intval($values['ptime']) * $values['project_accounting_factor'];
                                                }
                                                else
                                                {
@@ -877,95 +965,56 @@
                                else
                                {
                                        $project_id = 
$this->boprojects->save_project($action, $values);
-                                       if(isset($_FILES['attachment']['name']) 
&& $_FILES['attachment']['name'])
-                                       {
-                                               
$this->attached_files->save_file(array('action_id' => $project_id));
-                                       }
+                                       
$this->attached_files->save_file($project_id);
                                        $link_data['project_id'] = $project_id;
-                                       if(isset($_POST['save']) && 
$_POST['save'])
+                                       if($_POST['save'])
                                        {
                                                unset($jscal);
-                                               $link_data['menuaction'] = 
'projects.uiprojects.tree_view_projects';
                                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                                        }
                                        else
                                        {
                                                $message = lang('project %1 has 
been saved',$values['title']);
                                        }
+                                       $values = 
$this->boprojects->read_single_project($project_id);
                                }
                        }
-                       elseif(isset($_POST['cancel']) && $_POST['cancel'])
+
+                       if($_POST['cancel'])
                        {
-                               if(!isset($project_id) || !$project_id)
+                               if(!$project_id)
                                {
                                        $link_data['project_id'] = $pro_parent;
                                }
-                               $link_data['menuaction'] = 
'projects.uiprojects.tree_view_projects';
+
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
-                       elseif(isset($_POST['delete']) && $_POST['delete'])
+
+                       if($_POST['delete'])
                        {
                                $link_data['menuaction'] = 
'projects.uiprojects.delete_project';
                                $link_data['pa_id'] = $project_id;
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
-                       elseif(isset($_POST['mstone_save']) && 
$_POST['mstone_save'])
-                       {
-                               $mstone_edate   = 
get_var('mstone_edate',array('GET','POST'));
-                               $vmstone                = 
get_var('vmstone',array('GET','POST'));
-
-                               if(is_array($mstone_edate))
-                               {
-                                       $mstone_end_array       = 
$jscal->input2date($mstone_edate['str']);
-                                       $mstone_end_val         = 
$mstone_end_array['raw'];
-                               }
-
-                               $mstone['project_id']   = $project_id;
-                               $mstone['edate']                = 
$mstone_end_val;
-                               $mstone['old_edate']    = $vmstone['old_edate'];
-                               $mstone['title']                = 
$vmstone['title'];
-                               if($vmstone['s_id'])
-                               {
-                                       $mstone['s_id'] = $vmstone['s_id'];
-                               }
-                               $error = 
$this->boprojects->check_mstone($mstone);
-                               if(is_array($error))
-                               {
-                                       $message = 
$GLOBALS['phpgw']->common->error_list($error);
-                               }
-                               else
-                               {
-                                       $this->boprojects->save_mstone($mstone);
-                                       $message = lang('milestone has been 
saved');
-                               }
-                       }
-                       elseif(isset($_POST['roles']) && $_POST['roles'])
-                       {
-                               $link_data['menuaction'] = 
'projects.uiprojects.assign_employee_roles';
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
-                       }
 
-                       if(isset($project_id) && $project_id)
+                       if($project_id)
                        {
-                               if(!isset($values) || !is_array($values))
+                               if(!is_array($values))
                                {
                                        $values = 
$this->boprojects->read_single_project($project_id);
                                }
 
                                if(!is_array($values))
                                {
-                                       $link_data['menuaction'] = 
'projects.uiprojects.tree_view_projects';
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
-                               }
-
-                               $check = array('action' => 
$action,'coordinator' => $values['coordinator'],'main' => 
(isset($values['main'])?$values['main']:''),'parent' => 
(isset($values['parent'])?$values['parent']:''));
-                               if(!$this->boprojects->edit_perms($check))
-                               {
-                                       $link_data['menuaction'] = 
'projects.uiprojects.tree_view_projects';
                                        
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                                }
                        }
 
+/*
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . ($project_id?lang('edit project'):lang('add project'))
+                                                                               
                                        . $this->admin_header_info();
+                       $this->display_app_header();
+*/
                        $this->ui_base->display_app_header();
 
                        $GLOBALS['phpgw']->template->set_file(array('edit_form' 
=> 'form.tpl'));
@@ -977,19 +1026,16 @@
                        
$GLOBALS['phpgw']->template->set_block('edit_form','elist','elisthandle');
                        
$GLOBALS['phpgw']->template->set_block('edit_form','efield','efieldhandle');
 
-                       
$GLOBALS['phpgw']->template->set_block('edit_form','mstones_tab','mstones_tabhandle');
-                       
$GLOBALS['phpgw']->template->set_block('edit_form','mstones_tabcontent','mstones_tabcontenthandle');
-                       
$GLOBALS['phpgw']->template->set_block('edit_form','mstone_list','mlist');
-
                        
$GLOBALS['phpgw']->template->set_block('edit_form','accounting_act','accounting_acthandle');
                        
$GLOBALS['phpgw']->template->set_block('edit_form','accounting_own','accounting_ownhandle');
 
                        $nopref = $this->boprojects->check_prefs();
-                       if (is_array($nopref))
+                       if (is_array($nopref) && !$_POST['save'] && 
!$_POST['apply'])
                        {
                                $message .= 
$GLOBALS['phpgw']->common->error_list($nopref);
                        }
 
+                       
$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',
@@ -1007,12 +1053,18 @@
                                                                                
                                           'hidebcc' => 1,
                                                                                
                                           'targettagto' => 'staff'
                                                                                
                                          )));
+                       
$GLOBALS['phpgw']->template->set_var('s_accounts_link',$GLOBALS['phpgw']->link('/index.php',
 array('menuaction' => 'phpgwapi.pbaddbookaccount_projects.show',
+                                                                               
                                           'hidecc' => 1,
+                                                                               
                                           'hidebcc' => 1,
+                                                                               
                                           'targettagto' => 'salesmanager'
+                                                                               
                                          )));
+
                        if($pro_main)
                        {
                                $main = 
$this->boprojects->read_single_project($pro_main,'planned');
                        }
 
-                       if(!$pro_parent && isset($main) && is_array($main) || 
($pro_main == $pro_parent && isset($main) && is_array($main)))
+                       if(!$pro_parent && is_array($main) || ($pro_main == 
$pro_parent && is_array($main)))
                        {
                                $parent = $main;
                        }
@@ -1025,28 +1077,28 @@
                        if(!isset($values['plan_bottom_up']))
                        {
                                $values['plan_bottom_up'] = 'N';
-
-                               //_debug_array($values);
                        }
 
                        if ($project_id)
                        {
-                               //$values = 
$this->boprojects->read_single_project($project_id);
-                               $edit_mstone    = 
get_var('edit_mstone',array('GET','POST'));
-                               $delete_mstone  = 
get_var('delete_mstone',array('GET','POST'));
-                               if((((isset($_POST['save']) && $_POST['save']) 
|| (isset($_POST['apply']) && $_POST['apply'])) && $error)
-                                       || (isset($_POST['mstone_save']) && 
$_POST['mstone_save'])
-                                       || $edit_mstone
-                                       || $delete_mstone)
+                               $values_save = $values; // store the values 
because it includes some calculated values before check_values (budget, time)
+                               $values = 
$this->boprojects->read_single_project($project_id);
+
+                               $values['ptime'] = $values['ptime'] - 
$values['ptime_childs'];
+                               $values['budget'] = $values['budget'] - 
$values['budget_childs'];
+                               $values['e_budget'] = $values['e_budget'] - 
$values['e_budget_childs'];
+
+                               if(($_POST['save'] || $_POST['apply']) && 
$error)
                                {
                                        $values['coordinator']                = 
$_POST['accountid'];
                                        $values['employees']                  = 
$_POST['employees'];
                                        $values['customer']                   = 
$_POST['abid'];
                                        $values['customer_org']               = 
$_POST['customer_org'];
+                                       $values['salesmanager']               = 
$_POST['salesmanagerid'];
                                        $values['book_activities']            = 
$book_activities;
                                        $values['bill_activities']            = 
$bill_activities;
-                                       $values['number']                     = 
(isset($_POST['values']['number'])?$_POST['values']['number']:'');
-                                       $values['investment_nr']              = 
(isset($_POST['values']['investment_nr'])?$_POST['values']['investment_nr']:'');
+                                       $values['number']                     = 
$_POST['values']['number'];
+                                       $values['investment_nr']              = 
$_POST['values']['investment_nr'];
                                        $values['title']                      = 
$_POST['values']['title'];
                                        $values['descr']                      = 
$_POST['values']['descr'];
                                        $values['previous']                   = 
$_POST['values']['previous'];
@@ -1057,15 +1109,23 @@
                                        $values['access']                     = 
$_POST['values']['access'];
                                        $values['reference']                  = 
$_POST['values']['reference'];
                                        $values['customer_nr']                = 
$_POST['values']['customer_nr'];
-                                       $values['ptime']                      = 
intval($_POST['values']['ptime']);
+                                       $values['ptime']                      = 
$values_save['ptime']; // use calculated value
                                        $values['plan_bottom_up']             = 
$_POST['values']['plan_bottom_up'];
+                                       $values['budget']                     = 
$values_save['budget']; // use calculated value
                                        $values['e_budget']                   = 
$_POST['values']['e_budget'];
                                        $values['project_accounting_factor']  = 
$_POST['values']['project_accounting_factor'];
                                        $values['direct_work']                = 
$_POST['values']['direct_work'];
-                                       if($_POST['values']['billable'])
+
+                                       // map not_billable field to billable 
after edit form submit
+                                       
if(isset($_POST['values']['not_billable']) && $_POST['values']['not_billable'])
                                        {
                                                $values['billable'] = 'N';
                                        }
+                                       else
+                                       {
+                                               $values['billable'] = 'Y';
+                                       }
+
                                        $values['inv_method']                 = 
$_POST['values']['inv_method'];
                                        $values['discount_type']              = 
$_POST['values']['discount_type'];
                                        $values['discount']                   = 
$_POST['values']['discount'];
@@ -1080,95 +1140,35 @@
                                
$GLOBALS['phpgw']->template->set_var('old_parent',$pro_parent);
                                
$GLOBALS['phpgw']->template->set_var('old_edate',$values['edate']);
                                
$GLOBALS['phpgw']->template->set_var('old_coordinator',$values['coordinator']);
-                               
$GLOBALS['phpgw']->template->set_var('lang_choose','');
-                               
$GLOBALS['phpgw']->template->set_var('choose','');
-                               
$GLOBALS['phpgw']->template->set_var('help_img','');
-                               $this->cat_id = $values['cat'];
-
-                               $start  = 
(isset($start_val)?$start_val:($values['sdate']?$values['sdate']:''));
-                               $end    = 
(isset($end_val)?$end_val:($values['edate']?$values['edate']:''));
-                               $pstart = 
(isset($pstart_val)?$pstart_val:($values['psdate']?$values['psdate']:''));
-                               $pend   = 
(isset($pend_val)?$pend_val:($values['psdate']?$values['pedate']:''));
-
-                               
$GLOBALS['phpgw']->template->set_var('edit_roles_events_button','<input 
type="submit" name="roles" value="' . lang('edit roles and events') . '">');
-
-// ---- BEGIN MILESTONES
 
-                               if($edit_mstone)
-                               {
-                                       $s_id                   = 
get_var('s_id',array('GET','POST'));
-                                       $single_mstone  = 
$this->boprojects->get_single_mstone($s_id);
-                               }
-
-                               if($delete_mstone)
+                               if($this->boprojects->siteconfig['projectnr'] 
== 'generate')
                                {
-                                       $s_id                   = 
get_var('s_id',array('GET','POST'));
-                                       
$this->boprojects->delete_item(array('id' => $s_id));
-                                       $message = lang('milestone has been 
deleted');
+                                       
$GLOBALS['phpgw']->template->set_var('choose','<input type="checkbox" 
name="values[choose]" value="True"' . (isset($values['choose'])?' checked':'') 
. '>');
+                                       
$GLOBALS['phpgw']->template->set_var('lang_choose',lang('generate project id'));
+                                       
$GLOBALS['phpgw']->template->set_var('help_img','');
                                }
-
-                               $mstones = 
$this->boprojects->get_mstones($project_id);
-                               if(is_array($mstones))
-                               {
-                                       for($i=0;$i<count($mstones);++$i)
-                                       {
-                                               
$this->nextmatchs->template_alternate_row_class($GLOBALS['phpgw']->template);
-
-                                               $link_data['s_id'] = 
$mstones[$i]['s_id'];
-
-                                               
$GLOBALS['phpgw']->template->set_var(array
-                                               (
-                                                       'mstone_datedue'        
=> $this->boprojects->formatted_edate($mstones[$i]['edate'],True,'ms'),
-                                                       'mstone_edit_url'       
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                                                       'mstone_title'          
=> $mstones[$i]['title']
-                                               ));
-                                               
$GLOBALS['phpgw']->template->set_var('edit_img','<img src="' . 
$GLOBALS['phpgw']->common->image('phpgwapi','edit')
-                                                                               
                                        . '" border="0" title="' . lang('edit') 
. '">');
-                                               $link_data['edit_mstone'] = 
True;
-                                               
$GLOBALS['phpgw']->template->set_var('mstone_edit_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
-                                               
unset($link_data['edit_mstone']);
-
-                                               if 
($this->boprojects->edit_perms(array('action' => $action,'main' => 
(isset($parent['pro_main'])?$parent['pro_main']:''),'parent' => 
$parent['project_id'],'type' => 'delete',
-                                                                               
                                        'coordinator' => 
(isset($pro['coordinator'])?$pro['coordinator']:''))))
+                               else
                                                {
-                                                       
$link_data['delete_mstone']     = True;
-
-                                                       
$GLOBALS['phpgw']->template->set_var('mstone_delete_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
-                                                       
$GLOBALS['phpgw']->template->set_var('delete_img','<img src="' . 
$GLOBALS['phpgw']->common->image('phpgwapi','delete')
-                                                                               
                                                                . '" border="0" 
title="' . lang('delete') . '">');
-                                                       
unset($link_data['delete_mstone']);
-                                               }
-                                               
$GLOBALS['phpgw']->template->fp('list_mlist','mstone_list',True);
-                                       }
+                                       
$GLOBALS['phpgw']->template->set_var('lang_choose','');
+                                       
$GLOBALS['phpgw']->template->set_var('choose','');
+                                       
$GLOBALS['phpgw']->template->set_var('help_img','<a href="#"><img src="' . 
$GLOBALS['phpgw']->common->image('projects','help') . '" onclick="open_popup(\''
+                                                                               
                        . 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects_base.proid_help_popup'))
 . '\');" title="'
+                                                                               
                        . lang('help') . '" alt="Project-Nr." /></a>');
                                }
 
-                               
$GLOBALS['phpgw']->template->set_var('mstone_old_edate',(isset($single_mstone['edate'])?$single_mstone['edate']:''));
-                               
$GLOBALS['phpgw']->template->set_var('s_id',(isset($single_mstone['s_id'])?$single_mstone['s_id']:''));
-                               
$GLOBALS['phpgw']->template->set_var('lang_new',lang('new milestone'));
-                               
$GLOBALS['phpgw']->template->set_var('lang_save_mstone',lang('save milestone'));
-                               
$GLOBALS['phpgw']->template->set_var('new_checked',(isset($values['new'])?' 
checked':''));
-                               
$GLOBALS['phpgw']->template->set_var('mstone_title',$GLOBALS['phpgw']->strip_html((isset($single_mstone['title'])?$single_mstone['title']:'')));
-
-                               $msend = 
(isset($single_mstone['edate'])?$single_mstone['edate']:($end?mktime(12,0,0,date('m',$end),date('d',$end),date('Y',$end)):mktime(12,0,0,date('m'),date('d'),date('Y'))));
-
-                               
$GLOBALS['phpgw']->template->set_var('mstone_end_date_select',$jscal->input('mstone_edate[str]',$msend));
-
-                               
$GLOBALS['phpgw']->template->fp('mstones_tabhandle','mstones_tab',True);
-                               
$GLOBALS['phpgw']->template->fp('mstones_tabcontenthandle','mstones_tabcontent',True);
-
-                               
$GLOBALS['phpgw']->template->set_var('number_Tabs','5');
-
-// --------- END MILESTONES
+                               //$this->cat_id = $values['cat'];
 
+                               $start  = 
$start_val?$start_val:($values['sdate']?$values['sdate']:'');
+                               $end    = 
$end_val?$end_val:($values['edate']?$values['edate']:'');
+                               $pstart = 
$pstart_val?$pstart_val:($values['psdate']?$values['psdate']:mktime(0,0,0,date('m',
 time()), date('d', time()), date('Y', time())) );
+                               $pend   = 
$pend_val?$pend_val:($values['psdate']?$values['pedate']:'');
 
+                               
$GLOBALS['phpgw']->template->set_var('lang_milestones',lang('milestones').':');
+                               
$GLOBALS['phpgw']->template->set_var('edit_mstones_button','<input 
type="submit" name="mstone" value="' . lang('edit milestones') . '">');
+                               
$GLOBALS['phpgw']->template->set_var('edit_roles_events_button','<input 
type="submit" name="roles" value="' . lang('edit roles and events') . '">');
                        }
                        else
                        {
-                               
$GLOBALS['phpgw']->template->set_var('number_Tabs','4');
-                               
$GLOBALS['phpgw']->template->set_var('mstones_tabhandle','');
-                               
$GLOBALS['phpgw']->template->set_var('mstones_tabcontenthandle','');
-                               
$GLOBALS['phpgw']->template->set_var('mlist','');
-
                                if($this->boprojects->siteconfig['projectnr'] 
== 'generate')
                                {
                                        
$GLOBALS['phpgw']->template->set_var('choose','<input type="checkbox" 
name="values[choose]" value="True"' . (isset($values['choose'])?' checked':'') 
. '>');
@@ -1178,34 +1178,33 @@
                                {
                                        
$GLOBALS['phpgw']->template->set_var('help_img','<a href="#"><img src="' . 
$GLOBALS['phpgw']->common->image('projects','help') . '" onclick="open_popup(\''
                                                                                
                        . 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects_base.proid_help_popup'))
 . '\');" title="'
-                                                                               
                        . lang('help project nr') . '" alt="Project-Nr." 
/></a>');
+                                                                               
                        . lang('help') . '" alt="Project-Nr." /></a>');
                                }
 
                                switch($action)
                                {
                                        case 'mains':
-                                               $start  = 
(isset($start_val)?$start_val:''); 
//mktime(12,0,0,date('m'),date('d'),date('Y'));
-                                               $end    = 
(isset($end_val)?$end_val:'');
-                                               $pstart = 
(isset($pstart_val)?$pstart_val:''); 
//mktime(12,0,0,date('m'),date('d'),date('Y'));
-                                               $pend   = 
(isset($pend_val)?$pend_val:'');
+                                               $start  = 
$start_val?$start_val:''; //mktime(12,0,0,date('m'),date('d'),date('Y'));
+                                               $end    = $end_val?$end_val:'';
+                                               $pstart = 
$pstart_val?$pstart_val:mktime(12,0,0,date('m'),date('d'),date('Y'));
+                                               $pend   = 
$pend_val?$pend_val:'';
 
                                                $values['access']       = 
isset($values['access'])?$values['access']:'public';
                                                $values['direct_work']  = 
isset($values['direct_work'])?$values['direct_work']:'Y';
                                                break;
                                        case 'subs':
-                                               if(isset($parent) && 
is_array($parent))
+                                               if(is_array($parent))
                                                {
-                                                       $start  = 
isset($start_val)?$start_val:($parent['sdate']?mktime(12,0,0,date('m',$parent['sdate']),date('d',$parent['sdate']),date('Y',$parent['sdate'])):'');
 //mktime(12,0,0,date('m'),date('d'),date('Y')));
-                                                       $end    = 
isset($end_val)?$end_val:($parent['edate']?mktime(12,0,0,date('m',$parent['edate']),date('d',$parent['edate']),date('Y',$parent['edate'])):'');
-                                                       $pstart = 
isset($pstart_val)?$pstart_val:($parent['psdate']?mktime(12,0,0,date('m',$parent['psdate']),date('d',$parent['psdate']),date('Y',$parent['psdate'])):'');
-                                                       $pend   = 
isset($pend_val)?$pend_val:($parent['pedate']?mktime(12,0,0,date('m',$parent['pedate']),date('d',$parent['pedate']),date('Y',$parent['pedate'])):'');
+                                                       $start  = 
$start_val?$start_val:($parent['sdate']?mktime(12,0,0,date('m',$parent['sdate']),date('d',$parent['sdate']),date('Y',$parent['sdate'])):'');
 //mktime(12,0,0,date('m'),date('d'),date('Y')));
+                                                       $end    = 
$end_val?$end_val:($parent['edate']?mktime(12,0,0,date('m',$parent['edate']),date('d',$parent['edate']),date('Y',$parent['edate'])):'');
+                                                       $pstart = 
$pstart_val?$pstart_val:($parent['psdate']?mktime(12,0,0,date('m',$parent['psdate']),date('d',$parent['psdate']),date('Y',$parent['psdate'])):'');
+                                                       $pend   = 
$pend_val?$pend_val:($parent['pedate']?mktime(12,0,0,date('m',$parent['pedate']),date('d',$parent['pedate']),date('Y',$parent['pedate'])):'');
                                                        
$values['plan_bottom_up']       = 
$parent['plan_bottom_up']?$parent['plan_bottom_up']:'N';
                                                        $values['direct_work'] 
= $parent['direct_work']?$parent['direct_work']:'Y';
                                                }
                                                break;
                                }
                        }
-                       
$GLOBALS['phpgw']->template->set_var('message',$message);
 
                        
$GLOBALS['phpgw']->template->set_var('start_date_select',$jscal->input('sdate[str]',$start));
                        
$GLOBALS['phpgw']->template->set_var('end_date_select',$jscal->input('edate[str]',$end));
@@ -1215,9 +1214,17 @@
 
                        if ($action == 'mains')
                        {
-                               $cat = '<select name="values[cat]"><option 
value="">' . lang('None') . '</option>'
-                                               .       
$this->boprojects->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
+                               
if($this->boprojects->siteconfig['categorie_required'] == 'yes')
+                               {
+                                       $cat_option0_lang = lang('Please 
select');
+                               }
+                               else
+                               {
+                                       $cat_option0_lang = lang('None');
+                               }
 
+                               $cat = '<select style="width:99%; 
overflow:visable;" name="values[cat]"><option value="">' . $cat_option0_lang . 
'</option>'
+                                               .       
$this->boprojects->cats->formatted_list('select','all',$values['cat'],True) . 
'</select>';
                                
$GLOBALS['phpgw']->template->set_var('cat',$cat);
 
                                
//$GLOBALS['phpgw']->template->set_var('pcosts','<input type="text" 
name="values[pcosts]" value="' . $values['pcosts'] . '"> [' . 
$prefs['currency'] . $prefs['currency'] . '.cc]');
@@ -1241,7 +1248,9 @@
                        {
 /*
                                
$GLOBALS['phpgw']->template->set_var('pro_main',$main['title'] . ' [' . 
$main['number'] . ']');
-                               
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project','action'=>'mains','project_id'=>$pro_main)));
+                               
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project',
+                                                                               
                                                                                
                                                        'action'=>'mains',
+                                                                               
                                                                                
                                                        'project_id'=> 
$pro_main)));
                                
$GLOBALS['phpgw']->template->set_var('lang_sum_jobs',lang('sum jobs'));
                                
$GLOBALS['phpgw']->template->set_var('lang_available',lang('available'));
 
@@ -1255,8 +1264,10 @@
 
                                
$GLOBALS['phpgw']->template->fp('mainhandle','main',True);
 */
-                               $values['coordinator']          = 
isset($values['coordinator'])?$values['coordinator']:$parent['coordinator'];
-                               $values['coordinatorout']       = 
isset($values['coordinatorout'])?$values['coordinatorout']:$parent['coordinatorout'];
+                               $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'];
+                               $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'];
                                $values['customer_org']         = 
isset($values['customer_org'])?$values['customer_org']:$parent['customer_org'];
@@ -1285,7 +1296,7 @@
                                
$GLOBALS['phpgw']->template->set_var('parent_select', $parent['title'].'<input 
type="hidden" name="values[parent]" value="'.intval($values['parent']).'">');
 
                                
$GLOBALS['phpgw']->template->set_var('cat',$this->boprojects->cats->id2name($main['cat']));
-                               $this->cat_id = $main['cat'];
+                               //$this->cat_id = $main['cat'];
 
                                // use input field as hidden field and show 
only a text info
                                
$GLOBALS['phpgw']->template->set_var('plan_bottom_up_input_type', 'hidden');
@@ -1304,14 +1315,26 @@
                        $link_data['menuaction'] = 
'projects.uiprojects.edit_project';
                        
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
                        
-                       $GLOBALS['phpgw']->template->set_var('budget_type', 
(isset($values['ptime']) && $values['ptime'] > 0 && 0 == $values['budget']) ? 
'h' : 'm');
+                       if(($values['ptime'] > 0) && ($values['budget'] == 0))
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('budget_type', 'h');
+                               
$GLOBALS['phpgw']->template->set_var('budgetradio_check_m', '');
+                               
$GLOBALS['phpgw']->template->set_var('budgetradio_check_h', 'checked');
+                       }
+                       else
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('budget_type', 'm');
+                               
$GLOBALS['phpgw']->template->set_var('budgetradio_check_m', 'checked');
+                               
$GLOBALS['phpgw']->template->set_var('budgetradio_check_h', '');
+                       }
+                       
                        
$GLOBALS['phpgw']->template->set_var('lang_budget_type', lang('budget type'));
                        
$GLOBALS['phpgw']->template->set_var('currency',$prefs['currency']);
                        $month = $this->boprojects->return_date();
                        
$GLOBALS['phpgw']->template->set_var('month',$month['monthformatted']);
 
-                       
$GLOBALS['phpgw']->template->set_var('status_list',$this->ui_base->status_format((isset($values['status'])?$values['status']:''),(($action
 == 'mains')?True:False)));
-                       
$GLOBALS['phpgw']->template->set_var('priority_list',$this->priority_list((isset($values['priority'])?$values['priority']:'')));
+                       
$GLOBALS['phpgw']->template->set_var('status_list',$this->ui_base->status_format($values['status'],(($action
 == 'mains')?True:False)));
+                       
$GLOBALS['phpgw']->template->set_var('priority_list',$this->priority_list($values['priority']));
 
                        $acces_private = '<option value="private"' . 
($values['access'] == 'private'?' selected="selected"':'') . '>' . 
lang('private') . '</option>';
                        $acces_public = '<option value="public"' . 
($values['access'] == 'public'?' selected="selected"':'') . '>' . 
lang('public') . '</option>';
@@ -1321,22 +1344,45 @@
                        
$GLOBALS['phpgw']->template->set_var('acces_public',$acces_public);
                        
$GLOBALS['phpgw']->template->set_var('acces_anonym',$acces_anonym);
 
-                       
$GLOBALS['phpgw']->template->set_var('access',(isset($aradio)?$aradio:''));
+                       $GLOBALS['phpgw']->template->set_var('access',$aradio);
 
                        
$GLOBALS['phpgw']->template->set_var('previous_select',$this->boprojects->select_project_list(array('action'
 => 'all',
-                                                                               
                                                                                
                                                'status' => 
(isset($values['status'])?$values['status']:''),
+                                                                               
                                                                                
                                                'status' => $values['status'],
                                                                                
                                                                                
                                                'self' => $project_id,
-                                                                               
                                                                                
                                        'selected' => 
(isset($values['previous'])?$values['previous']:''))));
+                                                                               
                                                                                
                                        'selected' => $values['previous'])));
                                                                                
                                                                                
                                        
                        
$GLOBALS['phpgw']->template->set_var('help_image',$GLOBALS['phpgw']->common->image('projects','help.png'));
                        
$GLOBALS['phpgw']->template->set_var('help_project_nr','http://' . 
$_SERVER['HTTP_HOST'] . $GLOBALS['phpgw_info']['server']['webserver_url'] . 
'/projects/templates/default/projects_nr_help.html');
 
                        if($this->boprojects->siteconfig['accounting'] == 'own')
                        {
-                               
$GLOBALS['phpgw']->template->set_var('acc_employee_selected',(isset($values['accounting'])
 && $values['accounting']=='employee'?' selected="selected"':''));
-                               
$GLOBALS['phpgw']->template->set_var('acc_project_selected',(isset($values['accounting'])
 && $values['accounting']=='project'?' selected="selected"':''));
-                               
$GLOBALS['phpgw']->template->set_var('project_accounting_factor',sprintf("%01.2f",(isset($values['project_accounting_factor'])?$values['project_accounting_factor']:'')));
-                               
$GLOBALS['phpgw']->template->set_var('acc_billable_checked',(isset($values['billable'])
 && $values['billable']=='N'?' checked':''));
+                               // define default setting for new projects
+                               if(!isset($values['billable']))
+                               {
+                                       $values['billable'] = 'Y';
+                               }
+                               
+                               // check billable value
+                               if(!is_string($values['billable']))
+                               {       // no string, map to not_billable
+                                       if($values['billable'] === false)
+                                       {
+                                               $values['not_billable'] = 'Y';
+                                       }
+                                       else
+                                       {
+                                               $values['not_billable'] = 'N';
+                                       }
+                               }
+                               else
+                               { // map to not_billable
+                                       $values['not_billable'] = 
($values['billable']=='Y')?'N':'Y';
+                               }
+
+                               
$GLOBALS['phpgw']->template->set_var('acc_employee_selected',($values['accounting']=='employee'?'
 selected="selected"':''));
+                               
$GLOBALS['phpgw']->template->set_var('acc_project_selected',($values['accounting']=='project'?'
 selected="selected"':''));
+                               
$GLOBALS['phpgw']->template->set_var('project_accounting_factor',sprintf("%01.2f",$values['project_accounting_factor']));
+                               
$GLOBALS['phpgw']->template->set_var('acc_not_billable_checked',($values['not_billable']=='Y'?'
 checked':''));
 
                                
$GLOBALS['phpgw']->template->fp('accounting_ownhandle','accounting_own',True);
                        }
@@ -1361,37 +1407,54 @@
                                }
                        }
 
-                       
$GLOBALS['phpgw']->template->set_var('discount',(isset($values['discount'])?$values['discount']:''));
-                       
$GLOBALS['phpgw']->template->set_var('dt_no',(isset($values['discount_type']) 
&& $values['discount_type']=='no'?' selected="selected"':''));
-                       
$GLOBALS['phpgw']->template->set_var('dt_amount',(isset($values['discount_type'])
 && $values['discount_type']=='amount'?' selected="selected"':''));
-                       
$GLOBALS['phpgw']->template->set_var('dt_percent',(isset($values['discount_type'])
 && $values['discount_type']=='percent'?' selected="selected"':''));
-
-                       
$GLOBALS['phpgw']->template->set_var('budget',(isset($values['budget'])?$values['budget']:''));
-                       
$GLOBALS['phpgw']->template->set_var('e_budget',(isset($values['e_budget'])?$values['e_budget']:''));
-                       
$GLOBALS['phpgw']->template->set_var('number',(isset($values['number'])?$values['number']:''));
-                       
$GLOBALS['phpgw']->template->set_var('title',(isset($values['title'])?$values['title']:''));
-                       
$GLOBALS['phpgw']->template->set_var('descr',(isset($values['descr'])?$values['descr']:''));
-                       $values['ptime'] = 
(isset($values['ptime'])?$values['ptime']:0);
-                       
$GLOBALS['phpgw']->template->set_var('ptime',(isset($values['ptime']) && 
intval($values['ptime'])==0?'':intval($values['ptime'])));
-                       
$GLOBALS['phpgw']->template->set_var('investment_nr',(isset($values['investment_nr'])?$values['investment_nr']:''));
-                       
$GLOBALS['phpgw']->template->set_var('customer_nr',(isset($values['customer_nr'])?$values['customer_nr']:''));
-
-                       
$GLOBALS['phpgw']->template->set_var('inv_method',(isset($values['inv_method'])?$values['inv_method']:''));
-                       
$GLOBALS['phpgw']->template->set_var('reference',(isset($values['reference'])?$values['reference']:''));
-                       
$GLOBALS['phpgw']->template->set_var('url',(isset($values['url'])?$values['url']:''));
-
-                       
$GLOBALS['phpgw']->template->set_var('result',(isset($values['result'])?$values['result']:''));
-                       
$GLOBALS['phpgw']->template->set_var('test',(isset($values['test'])?$values['test']:''));
-                       
$GLOBALS['phpgw']->template->set_var('quality',(isset($values['quality'])?$values['quality']:''));
+                       
$GLOBALS['phpgw']->template->set_block('edit_form','option_discount','option_discount_handle');
+                       
$GLOBALS['phpgw']->template->set_block('edit_form','option_not_billable','option_not_billable_handle');
+                       
$GLOBALS['phpgw']->template->set_block('edit_form','option_direct_work','option_direct_work_handle');
+
+                       
if($this->boprojects->siteconfig['show_project_option_discount'] == 'yes')
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('discount',$values['discount']);
+                               
$GLOBALS['phpgw']->template->set_var('dt_no',$values['discount_type']=='no'?' 
selected="selected"':'');
+                               
$GLOBALS['phpgw']->template->set_var('dt_amount',$values['discount_type']=='amount'?'
 selected="selected"':'');
+                               
$GLOBALS['phpgw']->template->set_var('dt_percent',$values['discount_type']=='percent'?'
 selected="selected"':'');
+                               
$GLOBALS['phpgw']->template->parse('option_discount_handle','option_discount',False);
+                       }
+
+                       
if($this->boprojects->siteconfig['show_project_option_not_billable'] == 'yes')
+                       {
+                               
$GLOBALS['phpgw']->template->parse('option_not_billable_handle','option_not_billable',False);
+                       }
+
+                       
if($this->boprojects->siteconfig['show_project_option_direct_work'] == 'yes')
+                       {
+                               
$GLOBALS['phpgw']->template->parse('option_direct_work_handle','option_direct_work',False);
+                       }
+                       
+                       
$GLOBALS['phpgw']->template->set_var('budget',sprintf("%1.02f", (float) 
$values['budget']));
+                       
$GLOBALS['phpgw']->template->set_var('e_budget',sprintf("%1.02f", (float) 
$values['e_budget']));
+                       
$GLOBALS['phpgw']->template->set_var('number',$values['number']);
+                       
$GLOBALS['phpgw']->template->set_var('title',$values['title']);
+                       
$GLOBALS['phpgw']->template->set_var('descr',$values['descr']);
+                       
$GLOBALS['phpgw']->template->set_var('ptime',(intval($values['ptime'])==0?'':intval($values['ptime'])));
+                       
$GLOBALS['phpgw']->template->set_var('investment_nr',$values['investment_nr']);
+                       
$GLOBALS['phpgw']->template->set_var('customer_nr',$values['customer_nr']);
+
+                       
$GLOBALS['phpgw']->template->set_var('inv_method',$values['inv_method']);
+                       
$GLOBALS['phpgw']->template->set_var('reference',$values['reference']);
+                       
$GLOBALS['phpgw']->template->set_var('url',$values['url']);
+
+                       
$GLOBALS['phpgw']->template->set_var('result',$values['result']);
+                       
$GLOBALS['phpgw']->template->set_var('test',$values['test']);
+                       
$GLOBALS['phpgw']->template->set_var('quality',$values['quality']);
 
                        
$GLOBALS['phpgw']->template->set_var('attachment',$this->attached_files->get_files($project_id,
 True));
+                       
$GLOBALS['phpgw']->template->set_var('lang_files',lang('Files'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_attach',lang('Attach File'));
 
 //--------- coordinator -------------
 
                        
$GLOBALS['phpgw']->template->set_var('lang_coordinator',lang('Coordinator'));
-                       
-                       $account_selection = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['account_selection'])?$GLOBALS['phpgw_info']['user']['preferences']['common']['account_selection']:'');
-                       switch($account_selection)
+                       
switch($GLOBALS['phpgw_info']['user']['preferences']['common']['account_selection'])
                        {
                                case 'popup':
                                        if ($values['coordinator'])
@@ -1412,15 +1475,34 @@
                                                $values['coordinatorout'] = 
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname);
                                                
$GLOBALS['phpgw']->template->set_var('accountname',$values['coordinatorout']);
                                        }
-                                       
$GLOBALS['phpgw']->template->set_var('clisthandle','');
-                                       
$GLOBALS['phpgw']->template->fp('cfieldhandle','cfield',True);
 
-                                       if($project_id || $parent['project_id'])
+                                       
$GLOBALS['phpgw']->template->set_var('lang_salesmanager', lang('sales 
department'));
+
+                                       if ($values['salesmanager'])
                                        {
-                                               
$GLOBALS['phpgw']->template->set_var('employee_list',$this->ui_base->employee_format(array('type'
 => 'popup','project_id' => ($project_id?$project_id:$parent['project_id']))));
-                                       }
-                                       elseif(isset($values['employees']) && 
(count($values['employees']) > 0))
+                                               
$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);
+                                               }
+
+                                               
$GLOBALS['phpgw']->template->set_var('salesmanagername', 
$values['salesmanagerout']);
+                                       }
+                                       
+                                       
$GLOBALS['phpgw']->template->set_var('clisthandle','');
+                                       
$GLOBALS['phpgw']->template->fp('cfieldhandle','cfield',True);
+
+                                       /* disable auto adapt employees fron 
parent project
+                                       if(($project_id || 
$parent['project_id']) && !(isset($values['employees']) && 
(count($values['employees']) > 0)))
+                                       */
+                                       if($project_id && 
!(isset($values['employees']) && (count($values['employees']) > 0)))
+                                       {
+                                               
$GLOBALS['phpgw']->template->set_var('employee_list',$this->ui_base->employee_format(array('type'
 => 'popup','project_id' => ($project_id?$project_id:$parent['project_id']))));
+                                       }
+                                       elseif(isset($values['employees']) && 
(count($values['employees']) > 0))
+                                       {
+                                               $values['employees'] = 
array_unique($values['employees']);
                                                $employee_list = '';
                                                for($i=0; 
$i<count($values['employees']); ++$i)
                                                {
@@ -1434,36 +1516,78 @@
                                                
$GLOBALS['phpgw']->template->set_var('employee_list',$employee_list);           
                                
                                        }
                                        
$GLOBALS['phpgw']->template->set_var('elisthandle','');
+
+                                       $parent_project_members_string = '';
+                                       $parent_project_members = array();
+                                       
+                                       if (isset($parent['project_id']) && 
$parent['project_id'] > 0 && $parent['project_id'] != $project_id)
+                                       {
+                                               $parent_project_members = 
$this->boprojects->selected_employees(
+                                                       array('project_id' => 
$parent['project_id'])
+                                               );
+
+                                               while(list($no_use, $adata) = 
each($parent_project_members))
+                                               {
+                                                       echo $aid;
+                                                       if($adata['account_id'] 
<= 0)
+                                                       {
+                                                               continue;
+                                                       }
+                                                       else
+                                                       {
+                                                               
$parent_project_members_string .= 
'parent_project_members[parent_project_members.length] = new 
Array("'.$adata['account_fullname'].'", "'.$adata['account_id'].'");'."\n";
+                                                       }
+                                               }
+                                               $parent_project_members_disable 
= '';
+                                       }
+                                       else
+                                       {
+                                               $parent_project_members_disable 
= ' disabled="disabled"';
+                                       }
+
+                                       //echo 
'<pre>'.var_dump($parent_project_members_string).'</pre>';
+                                       
$GLOBALS['phpgw']->template->set_var('parent_project_members', 
$parent_project_members_string);
+                                       
$GLOBALS['phpgw']->template->set_var('parent_project_members_button_disable', 
$parent_project_members_disable);
+                                       
+                                       
$GLOBALS['phpgw']->template->set_var('lang_adapt', lang('adapt'));
+                                       
$GLOBALS['phpgw']->template->set_var('lang_remove', lang('remove'));
+                                       
$GLOBALS['phpgw']->template->set_var('lang_select', lang('select'));
+
+                                       
$GLOBALS['phpgw']->template->set_var('tooltip_parent_project_members', 
$cssTooltip->createHelpTooltip(lang('tooltip_parent_project_members')));
+                                       
$GLOBALS['phpgw']->template->set_var('tooltip_select_project_members', 
$cssTooltip->createHelpTooltip(lang('tooltip_select_project_members')));
+                                       
$GLOBALS['phpgw']->template->set_var('tooltip_remove_project_members', 
$cssTooltip->createHelpTooltip(lang('tooltip_remove_project_members')));
                                        
$GLOBALS['phpgw']->template->fp('efieldhandle','efield',True);
                                        break;
                                default:
-                                       
$GLOBALS['phpgw']->template->set_var('coordinator_list',$this->ui_base->employee_format(array('selected'
 => 
(isset($values['coordinator'])?$values['coordinator']:$this->boprojects->account))));
+                                       
$GLOBALS['phpgw']->template->set_var('coordinator_list',$this->ui_base->employee_format(array('selected'
 => 
($values['coordinator']?$values['coordinator']:$this->boprojects->account))));
                                                
$GLOBALS['phpgw']->template->set_var('cfieldhandle','');
                                                
$GLOBALS['phpgw']->template->fp('clisthandle','clist',True);
-
-                                       $parent['project_id'] = 
(isset($parent['project_id'])?$parent['project_id']:'');
                                        
$GLOBALS['phpgw']->template->set_var('employee_list',$this->ui_base->employee_format(array('project_id'
 => ($project_id?$project_id:$parent['project_id']),'action' => $action,
-                                                                               
                                                                                
                                        'pro_parent' => 
$parent['project_id'],'selected' => 
(isset($values['employees'])?$values['employees']:''))));
+                                                                               
                                                                                
                                        'pro_parent' => 
$parent['project_id'],'selected' => $values['employees'])));
                                                
$GLOBALS['phpgw']->template->set_var('efieldhandle','');
                                                
$GLOBALS['phpgw']->template->fp('elisthandle','elist',True);
-                                       break;
                        }
-                       unset($account_selection);
 
-                       $abid = 
(isset($values['customer'])?$values['customer']:'');
+                       
$GLOBALS['phpgw']->template->set_var('tooltip_select_coordinator',  
$cssTooltip->createHelpTooltip(lang('tooltip_select_coordinator')));
+                       
$GLOBALS['phpgw']->template->set_var('tooltip_select_salesmanager', 
$cssTooltip->createHelpTooltip(lang('tooltip_select_salesmanager')));
+                       
$GLOBALS['phpgw']->template->set_var('tooltip_remove_salesmanager', 
$cssTooltip->createHelpTooltip(lang('tooltip_remove_salesmanager')));
+
+                       $abid = $values['customer'];
                        $customer = 
$this->boprojects->read_single_contact($abid);
                        $name = $customer[0] ? $customer[0]['per_first_name'] . 
' ' . $customer[0]['per_last_name'] : '';
                        $GLOBALS['phpgw']->template->set_var('name',$name);
                        $GLOBALS['phpgw']->template->set_var('abid',$abid);
 
-                       $customer_org_id = 
(isset($values['customer_org'])?$values['customer_org']:'');
+                       $customer_org_id = $values['customer_org'];
                        $customer_org = 
$this->boprojects->read_single_contact_org($customer_org_id);
-                       $customer_org_name = (isset($customer_org[0]) ? 
$customer[0]['org_name'] : '');
+                       $customer_org_name = $customer_org[0] ? 
$customer[0]['org_name'] : '';
                        
$GLOBALS['phpgw']->template->set_var('customer_org_name', $customer_org_name);
                        $GLOBALS['phpgw']->template->set_var('customer_org', 
$customer_org_id);
 
-                       if ($project_id && 
$this->boprojects->edit_perms(array('action' => $action,'coordinator' => 
$values['coordinator'],'main_co' => 
(isset($main['coordinator'])?$main['coordinator']:''),
-                                                                               
                        'parent_co' => 
(isset($parent['coordinator'])?$parent['coordinator']:''),'type' => 'delete')))
+                       
$GLOBALS['phpgw']->template->set_var('attachment',$this->attached_files->get_files($project_id,True));
+
+                       if ($project_id && 
$this->boprojects->edit_perms(array('action' => $action,'coordinator' => 
$values['coordinator'],'main_co' => $main['coordinator'],
+                                                                               
                        'parent_co' => $parent['coordinator'],'type' => 
'delete')))
                        {
                                
$GLOBALS['phpgw']->template->set_var('delete_button','<input type="submit" 
name="delete" value="' . lang('Delete') .'">');
                        }
@@ -1482,6 +1606,8 @@
                        {
                                $values = 
$this->boprojects->read_single_project($project_id);
                                $pro_main = $values['main'];
+                               $values['cat'] = 
$this->boprojects->return_value('cat', $pro_main);
+
                                if($values['parent'] > 0)
                                {
                                        $action = 'subs';
@@ -1495,12 +1621,13 @@
                        $link_data = array
                        (
                                'menuaction'  => 
'projects.uiprojects.view_project',
-                               'pro_main'    => 
(isset($pro_main)?$pro_main:''),
-                               'action'      => (isset($action)?$action:''),
-                               'project_id'  => $project_id
+                               'pro_main'    => $pro_main,
+                               'action'      => $action,
+                               'project_id'  => $project_id,
+                               'public_view' => $public_view
                        );
 
-                       if(isset($_POST['back']) && $_POST['back'])
+                       if($_POST['back'])
                        {
                                $clickhistory = 
$GLOBALS['phpgw']->session->get_click_path_entry();
                                $link_data['menuaction'] = 
$clickhistory['menuaction'];
@@ -1510,13 +1637,50 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
 
-                       if(isset($_POST['done']) && $_POST['done'])
+                       if($_POST['edit'])
+                       {
+                               $link_data['menuaction'] = 
'projects.uiprojects.edit_project';
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+                       if($_POST['mstone'])
                        {
-                               $link_data['menuaction'] = 
'projects.uiprojects.list_projects';
+                               $link_data['menuaction'] = 
'projects.uiprojects.project_mstones';
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
 
+                       if($_POST['roles'])
+                       {
+                               $link_data['menuaction'] = 
'projects.uiprojects.assign_employee_roles';
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+
+                       if($_POST['done'])
+                       {
+                               if ($public_view)
+                               {
+                                       $menu = 
'projects.uiprojects.list_projects_home';
+                               }
+                               else
+                               {
+                                       $menu = 
'projects.uiprojects.list_projects';
+                               }
+                               $link_data['menuaction'] = $menu;
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+
+                       if (isset($public_view))
+                       {
+                               $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . lang('view project')
+                                                                               
                                                . $this->admin_header_info();
+                               $GLOBALS['phpgw']->common->phpgw_header();
+                               echo parse_navbar();
+                               $this->set_app_langs();
+                       }
+                       else
+                       {
+                               //$this->display_app_header();
                        $this->ui_base->display_app_header();
+                       }
 
                        $GLOBALS['phpgw']->template->set_file(array('view' => 
'view.tpl'));
                        
$GLOBALS['phpgw']->template->set_block('view','sub','subhandle');
@@ -1524,9 +1688,13 @@
                        
$GLOBALS['phpgw']->template->set_block('view','accounting_own','ownhandle');
                        
$GLOBALS['phpgw']->template->set_block('view','accounting_both','bothhandle');
 
+                       
$GLOBALS['phpgw']->template->set_block('view','nonanonym','nonanonymhandle');
+
                        
$GLOBALS['phpgw']->template->set_block('view','mslist','mslisthandle');
                        
$GLOBALS['phpgw']->template->set_block('view','emplist','emplisthandle');
 
+                       $GLOBALS['phpgw']->template->set_block('view', 
'attachment_list', 'listhandle');
+
                        
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
 
                        $nopref = $this->boprojects->check_prefs();
@@ -1546,10 +1714,10 @@
 
                        //_debug_array($values);
 
-                       if (isset($action) && ($action == 'mains' || $action == 
'amains'))
-                       {
                                
$GLOBALS['phpgw']->template->set_var('cat',$this->boprojects->cats->id2name($values['cat']));
-                               
$GLOBALS['phpgw']->template->set_var('pcosts',(isset($values['pcosts'])?$values['pcosts']:''));
+                       if ($action == 'mains' || $action == 'amains')
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('pcosts',$values['pcosts']);
                        }
 /*
                        else if($pro_main && $action == 'subs')
@@ -1561,26 +1729,34 @@
 
                                $link_data['project_id'] = $values['parent'];
                                
$GLOBALS['phpgw']->template->set_var('pro_parent',$this->boprojects->return_value('pro',$values['parent']));
-                               
$GLOBALS['phpgw']->template->set_var('parent_url',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojects.view_project&action='
-                                                                               
                                                                                
                        . ($values['main']==$values['parent']?'mains':'subs') . 
'&project_id='
-                                                                               
                                                                                
                . $values['parent'] . '&pro_main=' . $values['main']));
+                               
$GLOBALS['phpgw']->template->set_var('parent_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project',
+                                                                               
                                                                                
                                                        'action'=> 
($values['main']==$values['parent']?'mains':'subs'),
+                                                                               
                                                                                
                                                        'project_id'=> 
$values['parent'],
+                                                                               
                                                                                
                                                        'pro_main'=> 
$values['main'])));
 
                                
$GLOBALS['phpgw']->template->set_var('pro_main',$this->boprojects->return_value('pro',$values['main']));
-                               
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojects.view_project&action=mains&project_id='
-                                                                               
                                                                                
                . $values['main']));
+                               
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project',
+                                                                               
                                                                                
                                                        'action'=>'mains',
+                                                                               
                                                                                
                                                        'project_id'=> 
$values['main'])));
                                
$GLOBALS['phpgw']->template->set_var('previous',$this->boprojects->return_value('pro',$values['previous']));
                                
$GLOBALS['phpgw']->template->fp('subhandle','sub',True);
                        }
 */
-                       $main['investment_nr'] = 
(isset($main['investment_nr'])?$main['investment_nr']:'');
-                       
$GLOBALS['phpgw']->template->set_var('investment_nr',(isset($values['investment_nr'])?$values['investment_nr']:$main['investment_nr']));
-
+                       
$GLOBALS['phpgw']->template->set_var('investment_nr',($values['investment_nr']?$values['investment_nr']:$main['investment_nr']));
+                       if($values['parent']>0)
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('parent_select', 
$this->boprojects->return_value('title', $values['parent']));
+                       }
+                       else
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('parent_select', '');
+                               
$GLOBALS['phpgw']->template->set_var('lang_parent', lang('main project'));
+                       }
 
                        
$GLOBALS['phpgw']->template->set_var('number',$values['number']);
                        
$GLOBALS['phpgw']->template->set_var('title',($values['title']?$values['title']:'&nbsp;'));
                        
$GLOBALS['phpgw']->template->set_var('descr',($values['descr']?$values['descr']:'&nbsp;'));
-                       
$GLOBALS['phpgw']->template->set_var('status',lang($values['status']));
-                       
$GLOBALS['phpgw']->template->set_var('access',lang($values['access']));
+                       
$GLOBALS['phpgw']->template->set_var('status',($values['status']?lang($values['status']):'&nbsp;'));
 
                        
$GLOBALS['phpgw']->template->set_var('plan_bottom_up_text', 
(($values['plan_bottom_up'] == 'Y') ? lang('Yes') : lang('No')));
                        
$GLOBALS['phpgw']->template->set_var('direct_work_text', 
(($values['direct_work'] == 'Y') ? lang('Yes') : lang('No')));
@@ -1589,8 +1765,8 @@
                        
$GLOBALS['phpgw']->template->set_var('budget_jobs',sprintf("%01.2f",$values['pbudget_jobs']));
                        $GLOBALS['phpgw']->template->set_var('budget_sum', 
sprintf("%01.2f",$values['budget']));
 
-                       
$GLOBALS['phpgw']->template->set_var('ebudget_item',sprintf("%01.2f",$values['e_budget']-(isset($values['e_budget_chields'])?$values['e_budget_chields']:0)));
-                       
$GLOBALS['phpgw']->template->set_var('ebudget_jobs',sprintf("%01.2f",(isset($values['e_budget_chields'])?$values['e_budget_chields']:'')));
+                       
$GLOBALS['phpgw']->template->set_var('ebudget_item',sprintf("%01.2f",$values['e_budget']-$values['e_budget_chields']));
+                       
$GLOBALS['phpgw']->template->set_var('ebudget_jobs',sprintf("%01.2f",$values['e_budget_chields']));
                        $GLOBALS['phpgw']->template->set_var('ebudget_sum', 
sprintf("%01.2f",$values['e_budget']));
 
                        
$GLOBALS['phpgw']->template->set_var('discount',$values['discount']);
@@ -1606,7 +1782,7 @@
                        
$GLOBALS['phpgw']->template->set_var('quality',$values['quality']);
                        
$GLOBALS['phpgw']->template->set_var('priority',$this->boprojects->formatted_priority($values['priority']));
 
-                       
$GLOBALS['phpgw']->template->set_var('currency',(isset($prefs['currency'])?$prefs['currency']:''));
+                       
$GLOBALS['phpgw']->template->set_var('currency',$prefs['currency']);
 
                        $month = $this->boprojects->return_date();
                        
$GLOBALS['phpgw']->template->set_var('month',$month['monthformatted']);
@@ -1615,7 +1791,7 @@
                        
$GLOBALS['phpgw']->template->set_var('ptime_jobs',intval($values['ptime_jobs']));
                        $GLOBALS['phpgw']->template->set_var('ptime_sum', 
intval($values['ptime']));
 
-                       
$GLOBALS['phpgw']->template->set_var('uhours_jobs',(isset($values['uhours_jobs_all'])?$values['uhours_jobs_all']:''));
+                       
$GLOBALS['phpgw']->template->set_var('uhours_jobs',$values['uhours_jobs_all']);
 
                        
$GLOBALS['phpgw']->template->set_var('sdate',$values['sdate_formatted']);
                        
$GLOBALS['phpgw']->template->set_var('edate',$values['edate_formatted']);
@@ -1626,12 +1802,12 @@
                        
$GLOBALS['phpgw']->template->set_var('udate',$values['udate_formatted']);
                        
$GLOBALS['phpgw']->template->set_var('cdate',$values['cdate_formatted']);
 
-                       
$GLOBALS['phpgw']->template->set_var('attachment',$this->attached_files->get_files($project_id));
-
 //--------- coordinator -------------
 
                        
$GLOBALS['phpgw']->template->set_var('lang_coordinator',lang('Coordinator'));
                        
$GLOBALS['phpgw']->template->set_var('coordinator',$values['coordinatorout']);
+                       
$GLOBALS['phpgw']->template->set_var('lang_salesmanager',lang('sales manager'));
+                       
$GLOBALS['phpgw']->template->set_var('salesmanager',$values['salesmanagerout']);
                        
$GLOBALS['phpgw']->template->set_var('owner',$GLOBALS['phpgw']->common->grab_owner_name($values['owner']));
                        
$GLOBALS['phpgw']->template->set_var('processor',$GLOBALS['phpgw']->common->grab_owner_name($values['processor']));
 
@@ -1643,6 +1819,7 @@
 
 // --------- milestones ------------------------------
 
+                       
$GLOBALS['phpgw']->template->set_var('lang_milestones',lang('milestones').':');
                        $mstones = $this->boprojects->get_mstones($project_id);
                        //$link_data['menuaction'] = 
'projects.uiprojects.edit_mstone';
 
@@ -1657,49 +1834,48 @@
 
 // --------- emps & roles ------------------------------
 
-                       $e_emps = 
$this->boprojects->get_employee_roles(array('project_id' => 
$project_id,'formatted' => True));
-                       $a_emps = 
$this->boprojects->selected_employees(array('project_id' => $project_id));
-
-                       if(is_array($a_emps))
-                       {
-                               $emps = array();
-                               foreach($a_emps as $null => $a)
+                       $all_emps = 
$this->boprojects->selected_employees(array('project_id' => $project_id));
+                       if(is_array($all_emps))
                                {
-                                       if(is_array($e_emps))
+                               usort($all_emps, array('uiprojects_base', 
'cmp_employees'));
+                       }
+
+                       $emps_with_role_exists = array();
+                       $emps_with_role = 
$this->boprojects->get_employee_roles(array('project_id' => 
$project_id,'formatted' => True));
+
+                       while (is_array($emps_with_role) && (list($no_use,$emp) 
= each($emps_with_role)))
                                        {
-                                               foreach($e_emps as $bla => $e)
+                               $emps_with_role_exists[$emp['account_id']] = 
$emp;
+                       }
+                       
+                       while (is_array($all_emps) && (list(,$emp) = 
each($all_emps)))
                                                {
-                                                       
if($a['account_id']==$e['account_id'])
+                               if(!$emp['account_id'])
                                                        {
-                                                               $emps[] = $e;
+                                       continue;
                                                        }
-                                                       else
+                               
+                               
if(isset($emps_with_role_exists[$emp['account_id']]))
                                                        {
-                                                               $emps[] = array
-                                                               (
-                                                                       
'emp_name' => $a['account_fullname']
-                                                               );
-                                                       }
-                                               }
+                                       $emp = 
$emps_with_role_exists[$emp['account_id']];
                                        }
                                        else
                                        {
-                                               $emps[] = array
-                                               (
-                                                       'emp_name' => 
$a['account_fullname']
-                                               );
-                                       }
-                               }
+                                       
$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['events'] = '';
+                                       $emp['role_name'] = '';
                        }
-                       //_debug_array($emps);
-                       while (is_array($emps) && (list($no_use,$emp) = 
each($emps)))
-                       {
+                               
                                
$GLOBALS['phpgw']->template->set_var('emp_name',$emp['emp_name']);
-                               
$GLOBALS['phpgw']->template->set_var('events',(isset($emp['events'])?$emp['events']:''));
-                               
$GLOBALS['phpgw']->template->set_var('role_name',(isset($emp['role_name'])?$emp['role_name']:''));
+                               
$GLOBALS['phpgw']->template->set_var('events',$emp['events']);
+                               
$GLOBALS['phpgw']->template->set_var('role_name',$emp['role_name']);
                                
$GLOBALS['phpgw']->template->fp('emplisthandle','emplist',True);
                        }
 
+                       if (!isset($public_view))
+                       {
                        if($this->boprojects->siteconfig['accounting'] == 'own')
                        {
                                
$GLOBALS['phpgw']->template->set_var('accounting_factor',($values['accounting']=='employee'?lang('factor
 employee'):lang('factor project')));
@@ -1713,8 +1889,7 @@
                        {
 // ------------ activites bookable ----------------------
                                $boact = 
$this->boprojects->activities_list($project_id,False);
-                               $boact_list ='';
-                               if (isset($boact) && is_array($boact))
+                                       if (is_array($boact))
                                {
                                        while (list($null,$bo) = each($boact))
                                        {
@@ -1726,8 +1901,7 @@
 // -------------- activities billable ---------------------- 
 
                                $billact = 
$this->boprojects->activities_list($project_id,True);
-                               $billact_list = '';
-                               if (isset($billact) && is_array($billact))
+                                       if (is_array($billact))
                                {
                                        while (list($null,$bill) = 
each($billact))
                                        {
@@ -1738,13 +1912,44 @@
                                
$GLOBALS['phpgw']->template->fp('accounting_settings','accounting_act',True);
                        }
                        
$GLOBALS['phpgw']->template->fp('accounting_2settings','accounting_both',True);
-
+                               
$GLOBALS['phpgw']->template->fp('nonanonymhandle','nonanonym',True);
                                /*$GLOBALS['phpgw']->hooks->process(array
                                (
                                        'location'   => 'projects_view',
                                        'project_id' => $project_id
                                ));*/
 
+                               if 
($this->boprojects->edit_perms(array('action' => $action,'coordinator' => 
$values['coordinator'],'main' => $values['main'],
+                                                                               
                        'parent' => $values['parent'])))
+                               {
+                                       
$GLOBALS['phpgw']->template->set_var('edit_button','<input type="submit" 
name="edit" value="' . lang('edit') .'">');
+                                       
$GLOBALS['phpgw']->template->set_var('edit_milestones_button','<input 
type="submit" name="mstone" value="' . lang('edit milestones') .'">');
+                                       
$GLOBALS['phpgw']->template->set_var('edit_roles_events_button','<input 
type="submit" name="roles" value="' . lang('edit roles and events') .'">');
+                               }
+                       }
+                       
+                       
$GLOBALS['phpgw']->template->set_var('lang_filename',lang('Filename'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_period',lang('Period'));
+                       
+                       $attachments = 
$this->attached_files->get_files($project_id,true,true,$GLOBALS['phpgw_info']['user']['account_id']);
+                       if($attachments!="")
+                       {               
+                               for($x=0;$x<count($attachments);$x++)
+                               {
+                                       
$GLOBALS['phpgw']->template->set_var('attachment_link',$attachments[$x]['link']);
+                                       $comment = 
explode(";",$attachments[$x]['comment']);
+                                       $attachment_comment = "";
+                                       if($comment[0]>0)
+                                       {
+                                               $attachment_comment = 
date("d.m.Y", $comment[0]) . " - " . date("d.m.Y", $comment[1]);
+                                       }
+                                       
$GLOBALS['phpgw']->template->set_var('attachment_comment',$attachment_comment);
+                                       
$GLOBALS['phpgw']->template->set_var('delete',$attachments[$x]['delLink']);
+                                       
$GLOBALS['phpgw']->template->parse('files','attachment_list',True);
+                               }
+                               
//$GLOBALS['phpgw']->template->parse('report_rows','project_row',True);
+                       }
+
                        $GLOBALS['phpgw']->template->set_var('ownhandle','');
                        $GLOBALS['phpgw']->template->set_var('acthandle','');
                        $GLOBALS['phpgw']->template->set_var('bothhandle','');
@@ -1787,6 +1992,16 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
 
+                       switch($action)
+                       {
+                               case 'mains':   $deleteheader = lang('are you 
sure you want to delete this project');
+                                                               $header = 
lang('delete project');
+                                                               break;
+                               case 'subs':    $deleteheader = lang('are you 
sure you want to delete this job');
+                                                               $header = 
lang('delete job');
+                                                               break;
+                       }
+
                        //$GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . $header
                        //                                                      
                                        . $this->admin_header_info();
 
@@ -1797,7 +2012,7 @@
                        //$GLOBALS['phpgw']->template->set_var('lang_subs','');
                        $GLOBALS['phpgw']->template->set_var('subs', '');
 
-                       
$GLOBALS['phpgw']->template->set_var('deleteheader',lang('are you sure you want 
to delete this project'));
+                       
$GLOBALS['phpgw']->template->set_var('deleteheader',$deleteheader);
                        
$GLOBALS['phpgw']->template->set_var('lang_no',lang('No'));
                        
$GLOBALS['phpgw']->template->set_var('lang_yes',lang('Yes'));
 
@@ -1829,7 +2044,7 @@
 
                        
$GLOBALS['phpgw']->template->set_file(array('projects_list_t' => 
'list_budget.tpl'));
                        
$GLOBALS['phpgw']->template->set_block('projects_list_t','projects_list','list');
-                       
$GLOBALS['phpgw']->template->set_block('projects_list_t','pcosts','pc');
+//                     
$GLOBALS['phpgw']->template->set_block('projects_list_t','pcosts','pc');
                        
$GLOBALS['phpgw']->template->set_block('projects_list_t','project_main','main');
 
                        $nopref = $this->boprojects->check_prefs();
@@ -1860,14 +2075,18 @@
                        (
                                'menuaction'    => 
'projects.uiprojects.list_budget',
                                'pro_main'              => $pro_main,
-                               'action'                => $action
+                               'action'      => $action,
+                               'status'     => $this->status,
+                               'project_id' => $project_id
                        );
 
                        if($pro_main)
                        {
                                $main = 
$this->boprojects->read_single_project($pro_main,'budget','mains');
                                
$GLOBALS['phpgw']->template->set_var('title_main',$main['title']);
-                               
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project','action'=>'mains','project_id'=>$pro_main)));
+                               
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project',
+                                                                               
                                                                                
                                                        'action'=>'mains',
+                                                                               
                                                                                
                                                        'project_id'=> 
$pro_main)));
                                
$GLOBALS['phpgw']->template->set_var('coordinator_main',$main['coordinatorout']);
                                
$GLOBALS['phpgw']->template->set_var('number_main',$main['number']);
                                
$GLOBALS['phpgw']->template->set_var('customer_main',$main['customerout']);
@@ -1881,12 +2100,10 @@
                                
$GLOBALS['phpgw']->template->parse('main','project_main',True);
                        }
 
-                       $pro = $this->boprojects->list_projects(array('action' 
=> $action,'parent' => $pro_main,'page' => 'budget'));
-
-
                        if ($action == 'mainsubsorted') 
                        {
-                               $pro = 
$this->boprojects->list_projects(array('action' => $action,'project_id' => 
$pro_main,'page' => 'budget'));
+                               $this->boprojects->status = false; // 
workaround for full tree view support
+                               $pro = 
$this->boprojects->list_projects(array('action' => $action,'project_id' => 
$pro_main,'page' => 'budget','limit' => false));
                        }
                        else 
                        {
@@ -1906,9 +2123,9 @@
 
                        //if ($action == 'mains')
                        //{
-                               $action_list= '<select name="cat_id" 
onChange="this.form.submit();"><option value="none">' . lang('Select category') 
. '</option>' . "\n"
-                                                       . 
$this->boprojects->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
-                               
$GLOBALS['phpgw']->template->set_var('lang_action',lang('sub projects'));
+                       //      $action_list= '<select name="cat_id" 
onChange="this.form.submit();"><option value="none">' . lang('Select category') 
. '</option>' . "\n"
+                       //                              . 
$this->boprojects->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
+                       //      
$GLOBALS['phpgw']->template->set_var('lang_action',lang('sub projects'));
                        //}
                        //else 
                        //{
@@ -1916,6 +2133,12 @@
                        //                              . 
$this->boprojects->select_project_list(array('status' => $this->status, 
'selected' => $pro_main)) . '</select>';
                        //      
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Work hours'));
                        //}
+                       if($pro_main)
+                       {
+                               $cat_id = 
$this->boprojects->return_value('cat', $pro_main);
+                               $action_list = lang('category').': 
'.$this->boprojects->cats->id2name($cat_id);
+                               $action_list = '<input style="border: solid 2px 
#d0d0d0;" readonly="readonly" size="60" type="text" 
value="&nbsp;'.$action_list.'">';
+                       }
 
                        
$GLOBALS['phpgw']->template->set_var('action_list',$action_list);
                        
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
@@ -1946,14 +2169,16 @@
                                $link_data['project_id'] = 
$pro[$i]['project_id'];
                                if ($action == 'mains')
                                {
-                                       $projects_url = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.list_budget','action'=>'subs','pro_main'=>
 $pro[$i]['project_id']));
+                                       $projects_url = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.list_budget',
+                                                                               
                                                                                
'action'=>'subs',
+                                                                               
                                                                                
'pro_main'=> $pro[$i]['project_id']));
                                }
                                else
                                {
                                        $projects_url = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.list_hours',
                                                                                
                                                                'project_id'=> 
$pro[$i]['project_id'],
                                                                                
                                                                
'action'=>'hours',
-                                                                               
                                                                'pro_main'=> 
$pro_main));
+                                                                               
                                                                                
'pro_main'=>$pro_main));
                                }
 
                                $GLOBALS['phpgw']->template->set_var(array
@@ -2021,29 +2246,180 @@
                        
$GLOBALS['phpgw']->template->pfp('out','projects_list_t',True);
                }
 
+
+// ---- MILESTONES -----
+
+               function project_mstones()
+               {
+                       $action         = get_var('action',array('GET','POST'));
+                       $project_id     = 
get_var('project_id',array('GET','POST'));
+                       $values         = get_var('values',array('POST'));
+                       $s_id           = get_var('s_id',array('GET','POST'));
+                       $edate          = get_var('edate',array('POST','GET'));
+
+                       if(!$_POST['save'] && !$_GET['delete'] && 
!$_POST['done'] && !$_GET['edit'])
+                       {
+                               $referer = get_var('referer',array('POST'));
+                       }
+                       if($_POST['save'] || $_GET['delete'] || $_POST['done'] 
|| $_GET['back'] || $_GET['edit'])
+                       {
+                               $referer = get_var('referer',array('GET'));
+                       }
+                       if(!$referer)  //$_POST['back'] && !$_POST['done'] && 
!$_POST['edit'])
+                       {
+                               $referer = $_SERVER['HTTP_REFERER'];
+                       }
+
+                       //echo 'REFERER: ' . $referer;
+
+                       $link_data = array
+                       (
+                               'menuaction'    => 
'projects.uiprojects.project_mstones',
+                               'action'                => $action,
+                               'project_id'    => $project_id,
+                               'referer'               => $referer
+                       );
+
+                       $jscal = CreateObject('phpgwapi.jscalendar');
+
+                       if(is_array($edate))
+                       {
+                               $end_array      = 
$jscal->input2date($edate['str']);
+                               $end_val        = $end_array['raw'];
+                       }
+
+                       if ($_POST['save'])
+                       {
+                               $values['s_id']                 = 
$values['new']?'':$s_id;
+                               $values['project_id']   = $project_id;
+                               $values['edate']                = $end_val;
+                               $error = 
$this->boprojects->check_mstone($values);
+                               if(is_array($error))
+                               {
+                                       $message = 
$GLOBALS['phpgw']->common->error_list($error);
+                               }
+                               else
+                               {
+                                       $this->boprojects->save_mstone($values);
+                                       $message = lang('milestone has been 
saved');
+                               }
+                       }
+
+                       if ($_POST['done'])
+                       {
+                               unset($jscal);
+                               $link = array
+                               (
+                                       'menuaction'    => 
'projects.uiprojects.edit_project',
+                                       'action'                => $action,
+                                       'project_id'    => $project_id
+                               );
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link);
+                               //Header('Location: ' . $referer);
+                       }
+
+                       if ($_GET['delete'])
+                       {
+                               $this->boprojects->delete_item(array('id' => 
$s_id));
+                               $message = lang('milestone has been deleted');
+                       }
+
+                       if($_GET['edit'])
+                       {
+                               $values = 
$this->boprojects->get_single_mstone($s_id);
+                       }
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . lang('edit milestones');
+                       //$this->display_app_header();
+                       $this->ui_base->display_app_header();
+
+                       
$GLOBALS['phpgw']->template->set_file(array('mstone_list_t' => 
'list_mstones.tpl'));
+                       
$GLOBALS['phpgw']->template->set_block('mstone_list_t','mstone_list','list');
+                       
$GLOBALS['phpgw']->template->set_block('mstone_list_t','project_data','pro');
+
+                       $pro = 
$this->boprojects->read_single_project($project_id);
+                       
$GLOBALS['phpgw']->template->set_var('title_pro',$pro['title']);
+                       
$GLOBALS['phpgw']->template->set_var('pro_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project',
+                                                                               
                                                                                
                                        'action'=> 
($pro['level']==0?'mains':'subs'),
+                                                                               
                                                                                
                                        'project_id'=> $project_id)));
+                       
$GLOBALS['phpgw']->template->set_var('coordinator_pro',$pro['coordinatorout']);
+                       
$GLOBALS['phpgw']->template->set_var('number_pro',$pro['number']);
+                       
$GLOBALS['phpgw']->template->set_var('customer_pro',$pro['customerout']);
+                       
$GLOBALS['phpgw']->template->set_var('customerorg_pro',$pro['customerorgout']);
+                       
$GLOBALS['phpgw']->template->set_var('url_pro',$pro['url']);
+                       
$GLOBALS['phpgw']->template->set_var('sdate',$pro['sdate_formatted']);
+                       
$GLOBALS['phpgw']->template->set_var('edate',$pro['edate_formatted']);
+                       
+                       
+                       
$GLOBALS['phpgw']->template->parse('pro','project_data',True);
+
+                       
$GLOBALS['phpgw']->template->set_var('message',$message);
+                       
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
+
+                       $mstones = $this->boprojects->get_mstones($project_id);
+
+                       if(is_array($mstones))
+                       {
+                               for($i=0;$i<count($mstones);$i++)
+                               {
+                                       
$this->nextmatchs->template_alternate_row_class($GLOBALS['phpgw']->template);
+
+                                       $link_data['s_id']                      
= $mstones[$i]['s_id'];
+                                       $link_data['edit']                      
= True;
+
+                                       
$GLOBALS['phpgw']->template->set_var(array
+                                       (
+                                               'datedue'       => 
$this->boprojects->formatted_edate($mstones[$i]['edate'],True,'ms'),
+                                               'edit_url'      => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                                               'title'         => 
$mstones[$i]['title']
+                                       ));
+                                       
$GLOBALS['phpgw']->template->set_var('edit_img','<img src="' . 
$GLOBALS['phpgw']->common->image('phpgwapi','edit')
+                                                                               
                                                        . '" border="0" 
title="' . lang('edit') . '">');
+                                       unset($link_data['edit']);
+
+                                       if 
($this->boprojects->edit_perms(array('action' => $action,'main' => 
$pro['main'],'parent' => $pro['parent'],'type' => 'delete',
+                                                                               
                                        'coordinator' => $pro['coordinator'])))
+                                       {
+                                               $link_data['menuaction']        
= 'projects.uiprojects.project_mstones';
+                                               $link_data['delete']            
= True;
+
+                                               
$GLOBALS['phpgw']->template->set_var('delete_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                                               
$GLOBALS['phpgw']->template->set_var('delete_img','<img src="' . 
$GLOBALS['phpgw']->common->image('phpgwapi','delete')
+                                                                               
                                                                . '" border="0" 
title="' . lang('delete') . '">');
+                                               unset($link_data['delete']);
+                                       }
+                                       
$GLOBALS['phpgw']->template->parse('list','mstone_list',True);
+                               }
+                       }
+                       
$GLOBALS['phpgw']->template->set_var('old_edate',$values['edate']);
+                       
$GLOBALS['phpgw']->template->set_var('s_id',$values['s_id']);
+                       
$GLOBALS['phpgw']->template->set_var('lang_new',lang('new milestone'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_save_mstone',lang('save milestone'));
+                       
$GLOBALS['phpgw']->template->set_var('new_checked',$values['new']?' 
checked':'');
+                       
$GLOBALS['phpgw']->template->set_var('title',$GLOBALS['phpgw']->strip_html($values['title']));
+
+                       $end = 
$end_val?$end_val:($values['edate']?mktime(12,0,0,date('m',$values['edate']),date('d',$values['edate']),date('Y',$values['edate'])):mktime(12,0,0,date('m'),date('d'),date('Y')));
+                       
$GLOBALS['phpgw']->template->set_var('end_date_select',$jscal->input('edate[str]',$end));
+
+                       
$GLOBALS['phpgw']->template->pfp('out','mstone_list_t',True);
+               }
+
                function assign_employee_roles()
                {
                        $action         = get_var('action',array('GET','POST'));
                        $r_id           = get_var('r_id',array('GET','POST'));
                        $project_id     = 
get_var('project_id',array('GET','POST'));
                        $values         = get_var('values',array('POST'));
-                       $message = '';
 
-                       if((!isset($_POST['save']) || !$_POST['save'])
-                               && (!isset($_GET['delete']) || !$_GET['delete'])
-                               && (!isset($_POST['done']) || !$_POST['done'])
-                               && (!isset($_GET['edit']) || !$_GET['edit']))
+                       if(!$_POST['save'] && !$_GET['delete'] && 
!$_POST['done'] && !$_GET['edit'])
                        {
                                $referer = get_var('referer',array('POST'));
                        }
-                       if((isset($_POST['save']) && $_POST['save'])
-                               || (isset($_GET['delete']) && $_GET['delete'])
-                               || (isset($_POST['done']) && $_POST['done'])
-                               || (isset($_GET['edit']) && $_GET['edit']))
+                       if($_POST['save'] || $_GET['delete'] || $_POST['done'] 
|| $_GET['edit'])
                        {
                                $referer = get_var('referer',array('GET'));
                        }
-                       if(!isset($referer) || !$referer)  //$_POST['back'] && 
!$_POST['done'] && !$_POST['edit'])
+                       if(!$referer)  //$_POST['back'] && !$_POST['done'] && 
!$_POST['edit'])
                        {
                                $referer = $_SERVER['HTTP_REFERER'];
                        }
@@ -2058,14 +2434,14 @@
                                'referer'               => $referer
                        );
 
-                       if (isset($_POST['save']) && $_POST['save'])
+                       if ($_POST['save'])
                        {
                                $values['project_id']   = $project_id;
                                $this->boprojects->save_employee_role($values);
                                
$GLOBALS['phpgw']->template->set_var('message',lang('assignment has been 
saved'));
                        }
 
-                       if (isset($_POST['done']) && $_POST['done'])
+                       if ($_POST['done'])
                        {
                                $link = array
                                (
@@ -2077,13 +2453,13 @@
                                //Header('Location: ' . $referer);
                        }
 
-                       if (isset($_GET['delete']) && $_GET['delete'])
+                       if ($_GET['delete'])
                        {
                                $this->boprojects->delete_item(array('id' => 
$r_id,'action' => 'emp_role'));
                                $message = lang('assignment has been deleted');
                        }
 
-                       if(isset($_GET['edit']) && $_GET['edit'])
+                       if($_GET['edit'])
                        {
                                list($values) = 
$this->boprojects->get_employee_roles(array('project_id' => 
$project_id,'account_id' => $_GET['account_id']));
                        }
@@ -2100,8 +2476,8 @@
                        $pro = 
$this->boprojects->read_single_project($project_id);
                        
$GLOBALS['phpgw']->template->set_var('title_pro',$pro['title']);
                        
$GLOBALS['phpgw']->template->set_var('pro_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project',
-                                                                               
                                                                                
                                'action'=> (isset($pro['level']) && 
$pro['level']==0?'mains':'subs'),
-                                                                               
                                                                                
                                'project_id'=> $project_id)));
+                                                                               
                                                                                
                                        'action'=> 
($pro['level']==0?'mains':'subs'),
+                                                                               
                                                                                
                                        'project_id'=>$project_id)));
                        
$GLOBALS['phpgw']->template->set_var('coordinator_pro',$pro['coordinatorout']);
                        
$GLOBALS['phpgw']->template->set_var('number_pro',$pro['number']);
                        
$GLOBALS['phpgw']->template->set_var('customer_pro',$pro['customerout']);
@@ -2147,9 +2523,9 @@
 
                                                        $link_data['r_id'] = 
$role['r_id'];
                                                        $link_data['delete'] = 
True;
-                                                       
$GLOBALS['phpgw']->template->set_var('delete_role',(isset($delete_rights) && 
$delete_rights=='no'?'':'<a href="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) . '">'));
+                                                       
$GLOBALS['phpgw']->template->set_var('delete_role',($delete_rights=='no'?'':'<a 
href="' . $GLOBALS['phpgw']->link('/index.php',$link_data) . '">'));
                                                        $link_data['delete'] = 
False;
-                                                       
$GLOBALS['phpgw']->template->set_var('delete_img',(isset($delete_rights) && 
$delete_rights=='no'?'':'<img src="' . 
$GLOBALS['phpgw']->common->image('phpgwapi','delete')
+                                                       
$GLOBALS['phpgw']->template->set_var('delete_img',($delete_rights=='no'?'':'<img
 src="' . $GLOBALS['phpgw']->common->image('phpgwapi','delete')
                                                                                
                                                        . '" . border="0" 
title="' . lang('delete') . '"></a>'));
                                                }
                                        }
@@ -2162,10 +2538,10 @@
                        }
 
                        
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
-                       
$GLOBALS['phpgw']->template->set_var('role_select',$this->boprojects->action_format((isset($values['role_id'])?$values['role_id']:'')));
-                       
$GLOBALS['phpgw']->template->set_var('event_select',$this->boprojects->action_format((isset($values['events'])?$values['events']:''),'event'));
+                       
$GLOBALS['phpgw']->template->set_var('role_select',$this->boprojects->action_format($values['role_id']));
+                       
$GLOBALS['phpgw']->template->set_var('event_select',$this->boprojects->action_format($values['events'],'event'));
                        
$GLOBALS['phpgw']->template->set_var('lang_select_role',lang('select role'));
-                       
$GLOBALS['phpgw']->template->set_var('emp_select',$this->ui_base->employee_format(array('type'
 => 'selectbox','project_id' => $project_id,'selected' => 
(isset($values['account_id'])?$values['account_id']:'')
+                       
$GLOBALS['phpgw']->template->set_var('emp_select',$this->ui_base->employee_format(array('type'
 => 'selectbox','project_id' => $project_id,'selected' => $values['account_id']
                                                                                
                                                                                
                        ,'project_only' => True,'admins_included' => True)));
                        
$GLOBALS['phpgw']->template->set_var('lang_assign',lang('assign'));
                        
$GLOBALS['phpgw']->template->pfp('out','role_list_t',True);
@@ -2178,6 +2554,12 @@
                        $sdate          = get_var('sdate',array('POST','GET'));
                        $edate          = get_var('edate',array('POST','GET'));
                        $employee       = 
get_var('employee',array('POST','GET'));
+                       $template       = 
get_var('template',array('POST','GET'));
+                       $deleted        = 
get_var('deleted',array('POST','GET'));
+                       $hourid         = get_var('hourid',array('POST','GET'));
+                       $forward        = 
get_var('forward',array('POST','GET'));
+                       $back           = get_var('back',array('POST','GET'));
+                       $filename       = 
get_var('filename',array('POST','GET'));
 
                        $this->reportOOo = CreateObject('projects.reportOOo');
 
@@ -2187,26 +2569,14 @@
                        {
                                if($_POST['yes'])
                                {
-                                       if($sdate)
-                                       {
-                                               $start_array = 
$jscal->input2date($sdate);
-                                               $start_val   = 
mktime(0,0,0,$start_array['month'],$start_array['day'],$start_array['year']);
-                                       }
-                                       
-                                       if($edate)
-                                       {
-                                               $end_array = 
$jscal->input2date($edate);
-                                               $end_val   = 
mktime(23,59,59,$end_array['month'],$end_array['day'],$end_array['year']);
-                                       }
-
                                        $link_data = array(
                                                'menuaction'    => 
'projects.uiprojects.report',
                                                'project_id'  => $project_id,
-                                               'sdate'             => 
$start_val,
-                                               'edate'             => $end_val
+                                               'sdate'             => $sdate,
+                                               'edate'             => $edate
                                        );
 
-                                       $generated = 
$this->reportOOo->generate($project_id, $start_val, $end_val, $employee);
+                                       $generated = 
$this->reportOOo->generate($project_id, $sdate, $edate, $hourid, $template, 
$employee, $filename);
                                        if(!$generated)
                                        {
                                                $link_data['generated'] = 0;
@@ -2214,6 +2584,7 @@
                                        else
                                        {
                                                $link_data['generated'] = 1;
+                                               $link_data['menuaction'] = 
'projects.uiprojects.view_report_list';
                                        }
                                        
$GLOBALS['phpgw']->redirect_link('/index.php', $link_data);
                                }
@@ -2226,7 +2597,24 @@
 
                        $this->ui_base->display_app_header();
 
-                       $GLOBALS['phpgw']->template->set_file(array('report' => 
'report.tpl'));
+                       $GLOBALS['phpgw']->template->set_file(array('report' => 
'report_wizard.tpl'));
+
+                       
+                       if($forward)
+                       {
+                               
$GLOBALS['phpgw']->template->set_block('report', 'list_activities', 
'listhandle');
+                               
$GLOBALS['phpgw']->template->set_block('report', 'activities_handle', 
'activitieshandle');
+                               
$GLOBALS['phpgw']->template->set_block('report', 'details_handle', 
'detailshandle');
+                               
$GLOBALS['phpgw']->template->set_var('details_handle','');
+                       }
+                       else
+                       {
+                               
$GLOBALS['phpgw']->template->set_block('report', 'details_handle', 
'detailshandle');                    
+                               
$GLOBALS['phpgw']->template->set_block('report', 'list_activities', 
'listhandle');
+                               
$GLOBALS['phpgw']->template->set_block('report', 'activities_handle', 
'activitieshandle');
+                               
$GLOBALS['phpgw']->template->set_var('activities_handle','');
+                               
$GLOBALS['phpgw']->template->set_var('list_activities','');
+                       }
                        
                        if($generated === '0')
                        {
@@ -2241,17 +2629,30 @@
                                
$GLOBALS['phpgw']->template->set_var('error','');
                        }
                        
+                       if($deleted)
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('error',lang('activity report deleted'));
+                       }
+                       
                        $pro = 
$this->boprojects->read_single_project($project_id);
                        
                        $start = 
$sdate?$sdate:mktime(0,0,0,date('m'),1,date('Y'));
                        $end = 
$edate?$edate:mktime(23,59,59,date('m')+1,0,date('Y'));
                        
+                       
$GLOBALS['phpgw']->template->set_var('lang_select_data',lang('Please choose 
details for your new activity report'));
                        
$GLOBALS['phpgw']->template->set_var('period',lang('please choose the 
period:'));
                        
$GLOBALS['phpgw']->template->set_var('lang_no',lang('Cancel'));
                        
$GLOBALS['phpgw']->template->set_var('lang_yes',lang('generate activity 
report'));
                        
$GLOBALS['phpgw']->template->set_var('start_date_select',$jscal->input('sdate',$start));
                        
$GLOBALS['phpgw']->template->set_var('end_date_select',$jscal->input('edate',$end));
                        
$GLOBALS['phpgw']->template->set_var('lang_employee',lang('Employee'));
+                       
$GLOBALS['phpgw']->template->set_var('template_name',lang('Select Template'));
+                       
$GLOBALS['phpgw']->template->set_var('template_select','<select 
name="template"><option>Berlin</option><option>B&ouml;blingen</option><option>Dresden</option><option>D&uuml;sseldorf</option><option>Frankfurt</option><option>Hamburg</option><option>Hannover</option><option>M&uuml;nchen</option></select>');
+                       
$GLOBALS['phpgw']->template->set_var('lang_date',lang('Date'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_description',lang('Description'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_duration',lang('Duration'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_activities',lang('Activities'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_forward',lang('Forward'));
 
                        if($this->boprojects->edit_perms(array('coordinator' => 
$pro['coordinator'])))
                        {
@@ -2269,27 +2670,213 @@
                        }
                        else
                        {                       
-                               
$GLOBALS['phpgw']->template->set_var('employee','<input type="hidden" 
name="employee" value="' . $this->account . '">' . 
$GLOBALS['phpgw_info']['user']['fullname']);
+                               $employee = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                               
$GLOBALS['phpgw']->template->set_var('employee','<input type="hidden" 
name="employee" value="' . $employee . '">' . 
$GLOBALS['phpgw_info']['user']['fullname']);
                        }
 
-                       
$GLOBALS['phpgw']->template->set_var('attachment',$this->attached_files->get_files($project_id));
                        
$GLOBALS['phpgw']->template->set_var('lang_activity_reports',lang('Activity 
reports'));
 
+                       if($forward)
+                       {
+                               $start_array = $jscal->input2date($sdate);
+                               $start = 
mktime(0,0,0,$start_array['month'],$start_array['day'],$start_array['year']);
+                               
+                               $end_array = $jscal->input2date($edate);
+                               $end   = 
mktime(23,59,59,$end_array['month'],$end_array['day'],$end_array['year']);
+                               
+                               $filename = "TB_" . 
$this->accounts->id2name($employee) . "_" . date("Ymd",$start) . "-" . 
date("Ymd",$end);
+                               
$GLOBALS['phpgw']->template->set_var('filename',$filename);
+                               
$GLOBALS['phpgw']->template->set_var('lang_filename',lang('Filename'));
+                               
+                               $activities = 
$this->bohours->get_emp_activities($project_id, $start, $end, $employee);
+               
+                               for($i=0;$i<count($activities);$i++)
+                               {
+                                       $time = 
((int)($activities[$i]['duration'] / 60)) . ":" . (($activities[$i]['duration'] 
% 60) == "0" ? "00" : sprintf("%02d",($activities[$i]['duration'] % 60)));      
                        
+                                       
$GLOBALS['phpgw']->template->set_var('id',$i);
+                                       
$GLOBALS['phpgw']->template->set_var('activity_date',date("d.m.Y", 
$activities[$i]['date']));
+                                       
$GLOBALS['phpgw']->template->set_var('activity_descr',$activities[$i]['descr']);
+                                       
$GLOBALS['phpgw']->template->set_var('activity_duration',$time);
+                                       
$this->nextmatchs->template_alternate_row_class($GLOBALS['phpgw']->template);
+                                       
$GLOBALS['phpgw']->template->parse('list','list_activities',True);
+                               }
+                       }
+                       
+                       if(!$back)
+                       {
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'projects.uiprojects.report',
+                                       'project_id'    => $project_id,
+                                       'template'              => $template,
+                                       'sdate'                 => $start,
+                                       'edate'                 => $end,
+                                       'employee'              => $employee,
+                                       'hourid'                => $hourid
+                               );
+                       }
+                       else
+                       {
                        $link_data = array
                        (
                                'menuaction'    => 'projects.uiprojects.report',
                                'project_id'    => $project_id
                        );
+                       }
+                       
                        
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
 
+                       if($forward)
+                       {
+                               
$GLOBALS['phpgw']->template->parse('activities','activities_handle',True);
+                       }
+                       else
+                       {
+                               
$GLOBALS['phpgw']->template->parse('details','details_handle',True);
+                       }
+
                        $GLOBALS['phpgw']->template->pfp('out','report');
                        
                }
 
+               function view_report_list()
+               {
+                       $project_id     = 
get_var('project_id',array('POST','GET'));
+                       $generated      = 
get_var('generated',array('POST','GET'));
+                       $sdate          = get_var('sdate',array('POST','GET'));
+                       $edate          = get_var('edate',array('POST','GET'));
+                       $employee       = 
get_var('employee',array('POST','GET'));
+                       $template       = 
get_var('template',array('POST','GET'));
+                       $deleted        = 
get_var('deleted',array('POST','GET'));
+
+                       if($_POST['yes'])
+                       {
+                               $link_data = array(
+                                               'menuaction'  => 
'projects.uiprojects.report',
+                                               'project_id'  => $project_id,
+                                               'employee'    => $employee);
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
$link_data);
+                       }
+                       
+                       
+                       $this->ui_base->display_app_header();
+
+                       $GLOBALS['phpgw']->template->set_file(array('report' => 
'report_list.tpl'));
+                       $GLOBALS['phpgw']->template->set_block('report', 
'project_row', 'project_row');
+                       $GLOBALS['phpgw']->template->set_block('report', 
'attachment_list', 'listhandle');
+                                               
+                       if($deleted)
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('error',lang('activity report deleted'));
+                       }
+                       
+                       if($generated)
+                       {
+                               
$GLOBALS['phpgw']->template->set_var('error',lang('activity report generated'));
+                       }
+                       
+                       $pro = 
$this->boprojects->read_single_project($project_id);
+                       
+                       $start = 
$sdate?$sdate:mktime(0,0,0,date('m'),1,date('Y'));
+                       $end = 
$edate?$edate:mktime(23,59,59,date('m')+1,0,date('Y'));
+                       
+                       
$GLOBALS['phpgw']->template->set_var('period',lang('please choose the period'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_no',lang('Cancel'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_yes',lang('generate activity 
report'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_filename',lang('Filename'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_period',lang('Period'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_employee',lang('Employee'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_reports_for',lang('Activity reports 
for'));
+                       
//$GLOBALS['phpgw']->template->set_var('template_name',lang('Select Template'));
+                       
//$GLOBALS['phpgw']->template->set_var('template_select','<select 
name="template"><option>Berlin</option><option>B&ouml;blingen</option><option>Dresden</option><option>D&uuml;sseldorf</option><option>Frankfurt</option><option>Hamburg</option><option>Hannover</option><option>M&uuml;nchen</option></select>');
+
+                       if($this->boprojects->edit_perms(array('coordinator' => 
$pro['coordinator'])))
+                       {
+                               if(!$employee)
+                               {
+                                       $employee = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                               }
+                               
+                               
$GLOBALS['phpgw']->template->set_var('employee','<select name="employee" 
onChange="this.form.submit();">' . 
$this->ui_base->employee_format(array('project_only'                => True,
+                                                                               
                                                                                
                                                                                
                        'admins_included'       => True,
+                                                                               
                                                                                
                                                                                
                        'project_id'            => $project_id,
+                                                                               
                                                                                
                                                                                
                        'selected'                      => 
$employee?$employee:$this->account
+                                                                               
                                                   ))
+                                                                               
                                                . '</select>');
+                       }
+                       else
+                       {                       
+                               $employee = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                               
$GLOBALS['phpgw']->template->set_var('employee','<input type="hidden" 
name="employee" value="' . $employee . '">' . 
$GLOBALS['phpgw_info']['user']['fullname']);
+                       }
+
+                       $params = array(
+                                       'project_id' => $project_id,
+                                       'filter' => 'employee',
+                                       'status' => 'all',
+                                       'limit' => false,
+                                       'order' => 'end_date',
+                                       'employee' => $account_id
+                               );
+
+                       $subs = $this->boprojects->list_projects(array('action' 
=> 'mainsubsorted','project_id' => $project_id));
+
+                       for ($i=0;$i<count($subs);$i++)
+                       {
+                               $pr_name = $subs[$i]['title'];
+                               $attachments = 
$this->attached_files->get_files($subs[$i]['project_id'],true,true,$employee);
+                               if($attachments!="")
+                               {       
+                                       
$GLOBALS['phpgw']->template->set_var('pr_name',$pr_name);
+                                       
$GLOBALS['phpgw']->template->set_var('files','');
+                                       for($x=0;$x<count($attachments);$x++)
+                                       {
+                                               
$GLOBALS['phpgw']->template->set_var('attachment_link',$attachments[$x]['link']);
+                                               $comment = 
explode(";",$attachments[$x]['comment']);
+                                               $attachment_comment = "";
+                                               if($comment[0]>0)
+                                               {
+                                                       $attachment_comment = 
date("d.m.Y", $comment[0]) . " - " . date("d.m.Y", $comment[1]);
+                                               }
+                                               
$GLOBALS['phpgw']->template->set_var('attachment_comment',$attachment_comment);
+                                               
$GLOBALS['phpgw']->template->set_var('delete',$attachments[$x]['delLink']);
+                                               
$GLOBALS['phpgw']->template->parse('files','attachment_list',True);
+                                       }
+                                       
$GLOBALS['phpgw']->template->parse('report_rows','project_row',True);
+                               }
+                       }
+
+                       
$GLOBALS['phpgw']->template->set_var('lang_activity_reports',lang('Activity 
reports'));
+
+                       $link_data = array
+                       (
+                               'menuaction'    => 
'projects.uiprojects.view_report_list',
+                               'project_id'    => $project_id
+                       );
+                       
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                       
$GLOBALS['phpgw']->template->set_var('lang_new',lang('New Report'));
+                       $GLOBALS['phpgw']->template->set_var('project_row','');
+                       $GLOBALS['phpgw']->template->set_var('listhandle','');
+
+                       $GLOBALS['phpgw']->template->pfp('out','report');
+                       
+               }
+               
+
                function export_cost_accounting()
                {
-                       $action = get_var('action',array('POST','GET'));
-                       if (!$action)
+                       $export = get_var('export',array('POST','GET'));
+                       $statistic = get_var('statistic',array('POST','GET'));
+                       
+                       if($export)
+                       {
+                               $action = 'export';
+                       }
+                       elseif($statistic)
+                       {
+                               $action = 'statistic';
+                       }
+                       else
                        {
                                $action = 'select';
                        }
@@ -2298,15 +2885,32 @@
                        {
                                $month = get_var('month',array('POST','GET'));
                                $year = get_var('year',array('POST','GET'));
-                               if($month && $year)
+                               $location_id = 
get_var('location_id',array('POST','GET'));
+                               if($month && $year && $location_id)
                                {
-                                       $data = 
$this->boprojects->get_cost_accounting_diamant($month, $year);
+                                       $data = 
$this->boprojects->get_cost_accounting_diamant($month, $year, $location_id);
                                        header("Content-Type: text/plain");
                                        echo $data;
                                        $GLOBALS['phpgw']->common->phpgw_exit();
                                }
                        }
 
+                       if ($action == 'statistic')
+                       {
+                               $month = get_var('month',array('POST','GET'));
+                               $year = get_var('year',array('POST','GET'));
+                               $location_id = 
get_var('location_id',array('POST','GET'));
+                               if($month && $year && $location_id)
+                               {
+                                       $link_data['menuaction']  = 
'projects.uistatistics.list_users_worktimes';
+                                       $link_data['sdate']       = 
mktime(0,0,0,$month,1,$year);
+                                       $link_data['edate']       = 
mktime(23,59,59,$month+1,0,$year);
+                                       $link_data['values[employee]'] = 0;
+                                       $link_data['location_id'] = 
$location_id;
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                               }
+                       }
+
                        //$GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . ($pro_parent?lang('list budget'):lang('export diamant 
accounting'))
                        //                                                      
                                . $this->admin_header_info();
 
@@ -2316,12 +2920,11 @@
 
                        $link_data = array
                        (
-                               'menuaction' => 
'projects.uiprojects.export_cost_accounting',
-                               'action'     => 'export'
+                               'menuaction' => 
'projects.uiprojects.export_cost_accounting'
                        );
                        
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
                        
-                       
$GLOBALS['phpgw']->template->set_var('text',lang('Select month and year'));
+                       
$GLOBALS['phpgw']->template->set_var('text',lang('Select month, year and 
location'));
 
                        $current_m = date('m', time());
                        $current_y = date('Y', time());
@@ -2355,12 +2958,136 @@
                                        $optionlist_y .= '<option 
value="'.$y.'"/>'.$y.'</option>'."\n";
                        }
 
+                       $optionlist_l = '';
+                       $locations = 
$this->boprojects->soconfig->get_locations();
+                       foreach($locations as $location)
+                       {
+                               $optionlist_l .= '<option 
value="'.$location['location_id'].'">'.$location['location_name'].'</option>';
+                       }
+
                        $selectbox_m = '<select 
name="month">'.$optionlist_m.'</select>';
                        $selectbox_y = '<select 
name="year">'.$optionlist_y.'</select>';
+                       $selectbox_l = '<select 
name="location_id">'.$optionlist_l.'</select>';
 
                        
$GLOBALS['phpgw']->template->set_var('selectbox_m',$selectbox_m);
                        
$GLOBALS['phpgw']->template->set_var('selectbox_y',$selectbox_y);
-                       $GLOBALS['phpgw']->template->set_var('button','<input 
type="submit" name="export" value="' . lang('Submit') . '">');
+                       
$GLOBALS['phpgw']->template->set_var('selectbox_l',$selectbox_l);
+                       
$GLOBALS['phpgw']->template->set_var('button_statistic','<input type="submit" 
name="statistic" value="' . lang('user statistic') . '">');
+                       
$GLOBALS['phpgw']->template->set_var('button_export','<input type="submit" 
name="export" value="' . lang('Export cost_accounting') . '">');
+                       
$GLOBALS['phpgw']->template->pfp('out','export_diamant_t',True);
+               }
+
+               function export_cost_accounting_A()
+               {
+                       $export = get_var('export',array('POST','GET'));
+                       $statistic = get_var('statistic',array('POST','GET'));
+                       
+                       if($export)
+                       {
+                               $action = 'export';
+                       }
+                       elseif($statistic)
+                       {
+                               $action = 'statistic';
+                       }
+                       else
+                       {
+                               $action = 'select';
+                       }
+
+                       if ($action == 'export')
+                       {
+                               $month = get_var('month',array('POST','GET'));
+                               $year = get_var('year',array('POST','GET'));
+                               $location_id = 
get_var('location_id',array('POST','GET'));
+                               if($month && $year && $location_id)
+                               {
+                                       $data = 
$this->boprojects->get_cost_accounting_diamant_A($month, $year, $location_id);
+                                       header("Content-Type: text/plain");
+                                       echo $data;
+                                       $GLOBALS['phpgw']->common->phpgw_exit();
+                               }
+                       }
+
+                       if ($action == 'statistic')
+                       {
+                               $month = get_var('month',array('POST','GET'));
+                               $year = get_var('year',array('POST','GET'));
+                               $location_id = 
get_var('location_id',array('POST','GET'));
+                               if($month && $year && $location_id)
+                               {
+                                       $link_data['menuaction']  = 
'projects.uistatistics.list_users_worktimes';
+                                       $link_data['sdate']       = 
mktime(0,0,0,$month,1,$year);
+                                       $link_data['edate']       = 
mktime(23,59,59,$month+1,0,$year);
+                                       $link_data['values[employee]'] = 0;
+                                       $link_data['location_id'] = 
$location_id;
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                               }
+                       }
+
+                       //$GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . ($pro_parent?lang('list budget'):lang('export diamant 
accounting'))
+                       //                                                      
                                . $this->admin_header_info();
+
+                       $this->ui_base->display_app_header();
+
+                       
$GLOBALS['phpgw']->template->set_file(array('export_diamant_t' => 
'export_diamant.tpl'));
+
+                       $link_data = array
+                       (
+                               'menuaction' => 
'projects.uiprojects.export_cost_accounting_A'
+                       );
+                       
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                       
+                       
$GLOBALS['phpgw']->template->set_var('text',lang('Select month, year and 
location'));
+
+                       $current_m = date('m', time());
+                       $current_y = date('Y', time());
+                       
+                       if($current_m == 1)
+                       {
+                               $select_m = 12;
+                               $select_y = $current_y-1;
+                       }
+                       else
+                       {
+                               $select_m = $current_m-1;
+                               $select_y = $current_y;
+                       }
+
+                       $optionlist_m = '';
+                       for($m=1; $m<=12; ++$m)
+                       {
+                               if($m == $select_m)
+                                       $optionlist_m .= '<option 
value="'.$m.'" selected>'.$m.'</option>'."\n";
+                               else
+                                       $optionlist_m .= '<option 
value="'.$m.'"/>'.$m.'</option>'."\n";
+                       }
+
+                       $optionlist_y = '';
+                       for($y=2004; $y<=2010; ++$y)
+                       {
+                               if($y == $select_y)
+                                       $optionlist_y .= '<option 
value="'.$y.'" selected>'.$y.'</option>'."\n";
+                               else
+                                       $optionlist_y .= '<option 
value="'.$y.'"/>'.$y.'</option>'."\n";
+                       }
+
+                       $optionlist_l = '';
+                       $locations = 
$this->boprojects->soconfig->get_locations();
+                       foreach($locations as $location)
+                       {
+                               $optionlist_l .= '<option 
value="'.$location['location_id'].'">'.$location['location_name'].'</option>';
+                       }
+
+                       $selectbox_m = '<select 
name="month">'.$optionlist_m.'</select>';
+                       $selectbox_y = '<select 
name="year">'.$optionlist_y.'</select>';
+                       $selectbox_l = '<select 
name="location_id">'.$optionlist_l.'</select>';
+
+                       
$GLOBALS['phpgw']->template->set_var('selectbox_m',$selectbox_m);
+                       
$GLOBALS['phpgw']->template->set_var('selectbox_y',$selectbox_y);
+                       
$GLOBALS['phpgw']->template->set_var('selectbox_l',$selectbox_l);
+                       
$GLOBALS['phpgw']->template->set_var('button_statistic','<input type="submit" 
name="statistic" value="' . lang('user statistic') . '">');
+                       
$GLOBALS['phpgw']->template->set_var('button_export','<input type="submit" 
name="export" value="' . lang('Export cost_accounting') . '">');
                        
$GLOBALS['phpgw']->template->pfp('out','export_diamant_t',True);
                }
 
@@ -2379,14 +3106,21 @@
                        //$values       = get_var('view', array('POST', 'GET'));
                        $GLOBALS['phpgw']->template->set_var('l_update_view', 
lang('Update'));
                        
-                       $start = $start_array['raw'] > 1 ? $start_array['raw'] 
: mktime(0,0,0,7,1,date('Y'));
-                       $end   = $end_array['raw'] > 1 ?   $end_array['raw']   
: mktime(23,59,59,6,30,date('Y')+1);
+                       $start = $start_array['raw'] > 1 ? $start_array['raw'] 
: mktime(0,0,0,date('m'),1,date('Y'));
+                       $end   = $end_array['raw'] > 1 ?   $end_array['raw']   
: mktime(23,59,59,date('m')+1,0,date('Y'));
 
                        
$GLOBALS['phpgw']->template->set_var('sdate_select',$jscal->input('datum[start]',
 $start));
                        
$GLOBALS['phpgw']->template->set_var('edate_select',$jscal->input('datum[end]', 
$end));
                        
                        $projectID = get_var('project_id', array('POST','GET'));
 
+                       $link_data = array
+                       (
+                               'menuaction'    => 
'projects.uiprojects.view_employee_activity',
+                               'project_id'    => $projectID
+                       );
+                       
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
+
                        $this->bohours = 
CreateObject('projects.boprojecthours');
                        $matrix = 
$this->bohours->build_acitivity_matrix($projectID, $start, $end);
                        
@@ -2468,6 +3202,14 @@
                                                                $tooltip .= 
'</tr>';
                                                                $tooltip .= 
'<tr>';
                                                                $tooltip .= 
'<td>';
+                                                               $tooltip .= 
lang('Travel time').':';
+                                                               $tooltip .= 
'</td>';
+                                                               $tooltip .= 
'<td align=right>';
+                                                               $tooltip .= 
$xvalue[$k]['t_minutesout'];
+                                                               $tooltip .= 
'</td>';
+                                                               $tooltip .= 
'</tr>';
+                                                               $tooltip .= 
'<tr>';
+                                                               $tooltip .= 
'<td>';
                                                                $tooltip .= 
lang('Status').':';
                                                                $tooltip .= 
'</td>';
                                                                $tooltip .= 
'<td align=right>';
@@ -2481,13 +3223,13 @@
                                                                $output .= 
"<div style=\"text-align: right;\" onMouseover=\"this.T_TITLE='$tooltiptitle'; 
this.T_WIDTH=250; return escape('$tooltip'); \" >";
                                                                
if($budget_modus == 'h')
                                                                {
-                                                                       $output 
.= $this->bohours->format_minutes($xvalue[$k]['minutes']).'<br>';
+                                                                       $output 
.= 
$this->bohours->format_minutes($xvalue[$k]['minutes']+$xvalue[$k]['t_minutes']).'<br>';
                                                                }
                                                                else
                                                                {
-                                                                       $output 
.= number_format($xvalue[$k]['minutes'] / 60 * 
$matrix[$i]['project']['budget_factor'], 0, ',', '.'). ' &euro;';
+                                                                       $output 
.= number_format(($xvalue[$k]['minutes']+$xvalue[$k]['t_minutes']) / 60 * 
$matrix[$i]['project']['budget_factor'], 0, ',', '.'). ' &euro;';
                                                                }
-                                                               $totalminutes 
+= $xvalue[$k]['minutes'];
+                                                               $totalminutes 
+= $xvalue[$k]['minutes']+$xvalue[$k]['t_minutes'];
                                                                $output .= 
'</div>';
                                                                $output .= 
'</td>';
                                                                $output .= 
'</tr>';

Index: inc/class.uiprojects_base.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/class.uiprojects_base.inc.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- inc/class.uiprojects_base.inc.php   29 Nov 2006 21:31:07 -0000      1.18
+++ inc/class.uiprojects_base.inc.php   5 Dec 2006 19:40:45 -0000       1.19
@@ -1,13 +1,11 @@
-<?php
-       /**
+<?php
        /**
        * Project Manager
        *
-       * @author Bettina Gille address@hidden
-       * @author Dirk Schaller <address@hidden>
-       * @copyright Copyright (C) 2004-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @author Dirk Schaller address@hidden
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: class.uiprojects_base.inc.php,v 1.18 2006/11/29 
21:31:07 sigurdne Exp $
+       * @version $Id: class.uiprojects_base.inc.php,v 1.19 2006/12/05 
19:40:45 sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/class.uiprojects_base.inc.php,v $
        */
 
@@ -31,9 +29,10 @@
        define('WORKTIME_EDIT','wt_edit');
        define('WORKTIME_CONTROLLINGSHEET','wt_cs');
        define('WORKTIME_TIMETRACKER','wt_tt');
+       define('WORKTIME_STATISTIC','wt_stat');
 
        define('ACT_REPORT','act_report');
-       //define('EXPORT_DIAMANT','export_diamant');
+       define('EXPORT_DIAMANT','export_diamant');
 
        class uiprojects_base
        {
@@ -57,7 +56,6 @@
                {
                        $action                         = 
get_var('action',array('GET'));
                        $this->boprojects       = 
CreateObject('projects.boprojects', True,$action);
-                       $this->siteconfig       = $this->boprojects->siteconfig;
 
                        $this->menuaction       = 
get_var('menuaction',array('POST','GET'));
                        $this->action           = 
get_var('action',array('GET','POST'));
@@ -102,7 +100,7 @@
                        switch($this->menuaction)
                        {
                                case 'projects.uiprojects.list_projects':
-                                       if($this->project_id != 0)
+                                       if($this->project_id > 0)
                                        {
                                                $link_data = array
                                                (
@@ -117,13 +115,9 @@
                                        $this->activeView = PROJECT_LIST;
                                break;
                                case 'projects.uiprojects.tree_view_projects':
-                                       if($this->project_id == 0)
+                                       if(!$this->project_id)
                                        {
-                                               $link_data = array
-                                               (
-                                                       'menuaction'    => 
'projects.uiprojects.list_projects'
-                                               );
-                                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'        => 
'projects.uiprojects.list_projects'));
                                        }
                                        $this->activeView = PROJECT_LIST;
                                break;
@@ -131,7 +125,6 @@
                                case 'projects.uiprojects.edit_project':
                                case 'projects.uiprojects.project_mstones':
                                case 
'projects.uiprojects.assign_employee_roles':
-                               
                                        if($this->project_id > 0)
                                        { // edit
                                                $this->activeView = 
PROJECT_EDIT;
@@ -151,28 +144,74 @@
                                        }
                                break;
                                case 'projects.uiprojects.view_project':
+                                       if(!$this->project_id)
+                                       {
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'        => 
'projects.uiprojects.list_projects'));
+                                       }
                                        $this->activeView = PROJECT_VIEW;
                                break;
                                case 'projects.uiprojecthours.list_projects':
+                                       if(!$this->project_id)
+                                       {
+                                               if($this->pro_main)
+                                               {
+                                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('project_id' => 
$this->pro_main, 'menuaction' => $this->menuaction));
+                                               }
+                                               else
+                                               {
+                                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction' => 
'projects.uiprojects.list_projects'));
+                                               }
+                                       }
                                        $this->activeView = PROJECT_HOURS;
                                break;
                                case 'projects.uiprojects.list_budget':
+                                       if(!$this->project_id)
+                                       {
+                                               if($this->pro_main)
+                                               {
+                                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('project_id' => 
$this->pro_main, 'menuaction' => $this->menuaction));
+                                               }
+                                               else
+                                               {
+                                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction' => 
'projects.uiprojects.list_projects'));
+                                               }
+                                       }
                                        $this->activeView = PROJECT_BUDGET;
                                break;
                                case 
'projects.uiprojects.view_employee_activity':
                                        $this->activeView = PROJECT_ACTIVITIES;
+                                       if(!$this->project_id)
+                                       {
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'        => 
'projects.uiprojects.list_projects'));
+                                       }
                                break;
                                case 'projects.uistatistics.project_gantt':
+                                       if(!$this->project_id)
+                                       {
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'        => 
'projects.uiprojects.list_projects'));
+                                       }
                                        $this->activeView = PROJECT_GANTTCHART;
                                break;
                                case 
'projects.uistatistics.list_project_employees':
+                                       if(!$this->project_id)
+                                       {
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'        => 
'projects.uiprojects.list_projects'));
+                                       }
                                        $this->activeView = PROJECT_EMPLOYEES;
                                break;
                                case 'projects.uiprojecthours.list_hours':
+                                       if(!$this->project_id)
+                                       {
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'        => 
'projects.uiprojects.list_projects'));
+                                       }
                                        $this->activeView = WORKTIME_LIST;
                                break;
                                case 'projects.uiprojecthours.delete_hours':
                                case 'projects.uiprojecthours.edit_hours':
+                                       if(!$this->project_id)
+                                       {
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'        => 
'projects.uiprojects.list_projects'));
+                                       }
                                        $hours_id = 
get_var('hours_id',array('POST','GET'));
                                        if(!$hours_id)
                                        {
@@ -185,45 +224,49 @@
 
                                break;
                                case 'projects.uiprojecthours.view_hours':
+                                       if(!$this->project_id)
+                                       {
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'        => 
'projects.uiprojects.list_projects'));
+                                       }
                                        $this->activeView = WORKTIME_VIEW;
                                break;
                                case 
'projects.uiprojecthours.controlling_sheet':
                                case 
'projects.uiprojecthours.import_controlling_sheet':
                                        $this->activeView = 
WORKTIME_CONTROLLINGSHEET;
                                break;
+                               case 
'projects.uistatistics.list_users_worktimes':
+                                       $this->activeView = WORKTIME_STATISTIC;
+                               break;
                                case 'projects.uiprojecthours.ttracker':
                                        $this->activeView = 
WORKTIME_TIMETRACKER;
                                break;
-                               case 'projects.uiprojects.report':
+                               case 'projects.uiprojects.view_report_list':
+                                       if(!$this->project_id)
+                                       {
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'        => 
'projects.uiprojects.list_projects'));
+                                       }
                                        $this->activeView = ACT_REPORT;
                                break;
-                               /*case 
'projects.uiprojects.export_cost_accounting':
+                               case 'projects.uiprojects.report':
+                                       if(!$this->project_id)
+                                       {
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'        => 
'projects.uiprojects.list_projects'));
+                                       }
+                                       $this->activeView = ACT_REPORT_WIZARD;
+                               break;
+                               case 
'projects.uiprojects.export_cost_accounting':
                                        $this->activeView = EXPORT_DIAMANT;
-                               break;*/
+                               break;
                                default: // default is chosen when projects 
starts
                                        $this->activeView = PROJECT_LIST;
                        }
 
                        $this->headline = $this->getProjectPath();
-
-                       if(!is_object($GLOBALS['phpgw']->js))
-                       {
-                               $GLOBALS['phpgw']->js = 
CreateObject('phpgwapi.javascript');
-                       }
-                       $GLOBALS['phpgw']->js->validate_file('tabs','tabs');
-                       $GLOBALS['phpgw']->js->validate_file('core','popup');
-                       
$GLOBALS['phpgw']->js->validate_file('core','projects','projects');
-
-                       if(!isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css))
-                       {
-                               $GLOBALS['phpgw']->css = 
CreateObject('phpgwapi.css');
-                       }
-                       $GLOBALS['phpgw']->css->validate_file('tabs');
-                       
$GLOBALS['phpgw']->css->validate_file('style','projects');
                }
 
                function display_app_header()
                {
+
                        $GLOBALS['phpgw']->common->phpgw_header();
                        echo parse_navbar();
                        
@@ -239,69 +282,63 @@
                        
$GLOBALS['phpgw']->template->set_block('header','projects_header');
                        
$GLOBALS['phpgw']->template->set_block('header','projects_menu_toolbar', 
'toolbars');
 
-                       $icon_sep = '<span 
style="float:left;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>';
+                       $icon_sep = '<div 
style="float:left;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>';
 
-                       // 1. view toolbar
+                       // 2. view toolbar
                        $icons  = $this->CreateButton(PROJECT_LIST);
                        $icons .= $this->CreateButton(PROJECT_VIEW);
                        $icons .= $icon_sep;
                        $icons .= $this->CreateButton(PROJECT_HOURS);
-                       $icons .= $this->CreateButton(PROJECT_EMPLOYEES);
+                       $icons .= $this->CreateButton(PROJECT_BUDGET);
                        $icons .= $this->CreateButton(PROJECT_GANTTCHART);
+                       $icons .= $icon_sep;
+                       $icons .= $this->CreateButton(PROJECT_ACTIVITIES);
+                       $icons .= $this->CreateButton(PROJECT_EMPLOYEES);
 
                        $GLOBALS['phpgw']->template->set_var('toolbar_name',  
lang('Views'));
                        $GLOBALS['phpgw']->template->set_var('toolbar_icons', 
$icons);
 
                        
$GLOBALS['phpgw']->template->fp('projects_menu','projects_menu_toolbar',True);
 
-                       // 2. controlling toolbar
+                       // 3. controlling toolbar
                        $icons  = $this->CreateButton(WORKTIME_LIST);
+                       $icons .= $icon_sep;
+                       $icons .= $this->CreateButton(WORKTIME_ADD);
+                       $icons .= $icon_sep;
                        $icons .= $this->CreateButton(ACT_REPORT);
+                       $icons .= $icon_sep;
+                       $icons .= $this->CreateButton(WORKTIME_TIMETRACKER);
                        $icons .= 
$this->CreateButton(WORKTIME_CONTROLLINGSHEET);
+                       $icons .= $icon_sep;
+                       $icons .= $this->CreateButton(WORKTIME_STATISTIC);
 
                        $GLOBALS['phpgw']->template->set_var('toolbar_name',  
lang('Controlling'));
                        $GLOBALS['phpgw']->template->set_var('toolbar_icons', 
$icons);
 
                        
$GLOBALS['phpgw']->template->fp('projects_menu','projects_menu_toolbar',True);
 
-                       // 3. action toolbar
+                       // 1. projectmanagement toolbar
                        $icons  = $this->CreateButton(PROJECT_ADD);
                        $icons .= $this->CreateButton(PROJECT_EDIT);
                        $icons .= $this->CreateButton(PROJECT_ADD_SUB);
+
+                       if ($this->boprojects->isprojectadmin('pad') || 
$this->boprojects->isprojectadmin('pmanager'))
+                       {
                        $icons .= $icon_sep;
-                       $icons .= $this->CreateButton(WORKTIME_ADD);
-                       $icons .= $this->CreateButton(WORKTIME_TIMETRACKER);
+                               $icons .= $this->CreateButton(EXPORT_DIAMANT);
+                       }
                        
                        $GLOBALS['phpgw']->template->set_var('toolbar_name',  
lang('Actions'));
                        $GLOBALS['phpgw']->template->set_var('toolbar_icons', 
$icons);
 
                        
$GLOBALS['phpgw']->template->fp('projects_menu','projects_menu_toolbar',True);
 
-                       // 4. admin toolbar
-                       $check = array('action' => $this->action,'coordinator' 
=> $this->pro_data['coordinator'],'main' => $this->pro_main,'parent' => 
$this->pro_parent);
-                       if($this->boprojects->edit_perms($check))
-                       {
-                               $icons  = 
$this->CreateButton(PROJECT_ACTIVITIES);
-                               $icons .= $this->CreateButton(PROJECT_BUDGET);
-
-                               
$GLOBALS['phpgw']->template->set_var('toolbar_name',  lang('Administration'));
-                               
$GLOBALS['phpgw']->template->set_var('toolbar_icons', $icons);
-                               
$GLOBALS['phpgw']->template->fp('projects_menu','projects_menu_toolbar',True);
-                       }
-
-                       /* this will move to bookkeeping
-                       if ($this->boprojects->isprojectadmin())
-                       {
-                               $icons .= $icon_sep;
-                               $icons .= $this->CreateButton(EXPORT_DIAMANT);
-                       }*/
-
                        $selectBox = $this->createSelectBox();
                        
$GLOBALS['phpgw']->template->set_var('select_pro_action',  
$selectBox['action']);
                        
$GLOBALS['phpgw']->template->set_var('select_pro_options', 
$selectBox['options']);
 
                        $GLOBALS['phpgw']->template->set_var('headline', 
$this->headline);
-                       $GLOBALS['phpgw']->template->set_var('up_button', 
$this->CreateIcon(PROJECT_PARENT));
+                       $GLOBALS['phpgw']->template->set_var('up_button', 
$this->createIcon(PROJECT_PARENT));
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects');
                        
$GLOBALS['phpgw']->template->fp('app_header','projects_header');
@@ -325,8 +362,9 @@
                                                        
$GLOBALS['phpgw']->template->set_var('lang_accounting',lang('Activities'));
                                                        break;
                                                default:
-                                                       
$GLOBALS['phpgw']->template->set_var('link_accounting',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_employees','action'=>'accounting')));
-                                                       
$GLOBALS['phpgw']->template->set_var('lang_accounting',lang('Accounting'));
+                                                 //open accounting page from 
admin section
+                                                       
//$GLOBALS['phpgw']->template->set_var('link_accounting',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_accounting','action'=>'accounting')));
+                                                       
//$GLOBALS['phpgw']->template->set_var('lang_accounting',lang('Accounting'));
                                        }
                                        
$GLOBALS['phpgw']->template->fp('admin_header','projects_admin_header');
                                }
@@ -363,7 +401,7 @@
                }
 
 
-               function CreateIcon($targetView, $showToolTip=true, 
$showText=false)
+               function createIcon($targetView, $showToolTip=true, 
$showText=false)
                {
                        switch($targetView)
                        {
@@ -397,11 +435,11 @@
                                $linkText = '';
                        }
 
-                       if(isset($buttonInActive) && $buttonInActive)
+                       if($buttonInActive)
                        {
                                $buttonClass = 'menu_icon_inactive';
                        }
-                       elseif(isset($buttonActive) && $buttonActive)
+                       elseif($buttonActive)
                        {
                                $buttonClass = 'menu_icon_active';
                        }
@@ -410,14 +448,14 @@
                                $buttonClass = 'menu_icon';
                        }
                
-                       if(isset($buttonInActive) && $buttonInActive)
+                       if($buttonInActive)
                        {
-                               $link = '<div class="'.$buttonClass.'"><a 
class="'.$buttonClass.'" title="'.$linkToolTip.'"><img 
src="'.$GLOBALS['phpgw']->common->image('projects', $guiId).'" 
class="'.$buttonClass.'" title="'.$linkToolTip.'">'.$linkText.'</a></div>';
+                               $link = '<div class="'.$buttonClass.'"><a 
class="'.$buttonClass.'" title="'.$linkToolTip.'"><img 
src="'.$GLOBALS['phpgw']->common->image('projects', $guiId).'" 
class="'.$buttonClass.'" alt="'.$linkToolTip.'">'.$linkText.'</a></div>';
                        }
                        else
                        {
                                $viewUrl = $this->createViewUrl($targetView);
-                               $link = '<div class="'.$buttonClass.'"><a 
class="'.$buttonClass.'" href="'.$viewUrl.'" title="'.$linkToolTip.'"><img 
src="'.$GLOBALS['phpgw']->common->image('projects', $guiId).'" 
class="'.$buttonClass.'" title="'.$linkToolTip.'">'.$linkText.'</a></div>';
+                               $link = '<div class="'.$buttonClass.'"><a 
class="'.$buttonClass.'" href="'.$viewUrl.'" title="'.$linkToolTip.'"><img 
src="'.$GLOBALS['phpgw']->common->image('projects', $guiId).'" 
class="'.$buttonClass.'" alt="'.$linkToolTip.'">'.$linkText.'</a></div>';
                        }
 
                        return $link;
@@ -438,7 +476,7 @@
                                        'filter' => 'none',
                                        'action' => 'all',
                                        'limit' => False,
-                                       'status' => $this->status,
+                                       'status' => 'active',
                                        'selected' => $this->project_id
                                ));
                        }
@@ -448,7 +486,7 @@
                                $selectbox['options']  = '<option value="">' . 
lang('Select project') . '</option>' . "\n";
                                $selectbox['options'] .= 
$this->boprojects->select_project_list(array(
                                        'action' => 'all',
-                                       'status' => $this->status,
+                                       'status' => 'active',
                                        'limit'  => False)
                                );
                        }
@@ -479,6 +517,7 @@
                                case PROJECT_ADD:
                                case WORKTIME_CONTROLLINGSHEET:
                                case WORKTIME_TIMETRACKER:
+                               case WORKTIME_STATISTIC:
                                break;
                                case PROJECT_PARENT:
                                        if(!$this->pro_main || 
($this->activeView == PROJECT_ADD_SUB))
@@ -493,10 +532,12 @@
                                        }
                                        else
                                        {
-                                               $check = array('action'         
        => $this->action,
+                                               $check = array(
+                                                 'action' => $this->action,
                                                                                
'coordinator'   => $this->pro_data['coordinator'],
                                                                                
'main'                  => $this->pro_main,
-                                                                               
'parent'                => $this->pro_parent);
+                                                 'parent' => $this->pro_parent
+                                               );
                                                if 
(!$this->boprojects->edit_perms($check))
                                                {
                                                        $buttonInActive = True;
@@ -523,6 +564,30 @@
                                        }
                                break;
                                case PROJECT_ACTIVITIES:
+                                       if(!$this->pro_main)
+                                       {
+                                               $buttonInActive = True;
+                                       }
+                                       else
+                                       {
+                                               $check = array(
+                                                 'action' => $this->action,
+                                                 'coordinator' => 
$this->pro_data['coordinator'],
+                                                 'main' => $this->pro_main,
+                                                 'parent' => $this->pro_parent
+                                               );
+
+                                               if( 
!$this->boprojects->edit_perms($check) &&
+                                                         
!$this->boprojects->isprojectadmin('pad') &&
+                                                         
!$this->boprojects->isprojectadmin('pmanager')
+                                                 )
+                                               {
+                                                       $buttonInActive = True;
+                                               }
+                                       }
+
+
+                               break;
                                case PROJECT_LIST:
                                case PROJECT_VIEW:
                                case PROJECT_HOURS:
@@ -543,7 +608,7 @@
 
                        $guiId = 'button_'.$targetView;
 
-                       if($showToolTip)
+                       if(isset($showToolTip) && $showToolTip)
                        {
                                $linkToolTip = 
$this->getText($guiId.'_tooltip');
                        }
@@ -552,7 +617,7 @@
                                $linkToolTip = '';
                        }
 
-                       if($showText)
+                       if(isset($showText) && $showText)
                        {
                                $linkText = $this->getText($guiId.'_text');
                        }
@@ -689,13 +754,20 @@
                                        $linkData['menuaction'] = 
'projects.uiprojecthours.ttracker';
                                        $linkData['values[project_id]'] = 
$this->project_id;
                                break;
+                               case WORKTIME_STATISTIC:
+                                       $linkData['menuaction'] = 
'projects.uistatistics.list_users_worktimes';
+                               break;
                                case ACT_REPORT:
+                                       $linkData['menuaction'] = 
'projects.uiprojects.view_report_list';
+                                       $linkData['project_id'] = 
$this->project_id;
+                               break;
+                               case 'ACT_REPORT_WIZARD':
                                        $linkData['menuaction'] = 
'projects.uiprojects.report';
-                                       $linkData['project_id'] = 
$this->pro_main;
+                                       $linkData['project_id'] = 
$this->project_id;
                                break;
-                               /*case EXPORT_DIAMANT:
+                               case EXPORT_DIAMANT:
                                        $linkData['menuaction'] = 
'projects.uiprojects.export_cost_accounting';
-                               break;*/
+                               break;
                                default:
                                        return False;
                        }
@@ -723,6 +795,7 @@
                                case PROJECT_EDIT:
                                case PROJECT_ADD_SUB:
                                case WORKTIME_CONTROLLINGSHEET:
+                               case WORKTIME_STATISTIC:
                                        $targetView = PROJECT_LIST;
                                break;
                                default:
@@ -734,24 +807,51 @@
 
                function getProjectPath()
                {
-                       $id = 'button_'.$this->activeView.'_text';
-                       $action = $this->getText($id);
-
-                       $path = $action;
-                       $space = '&nbsp;>&nbsp;';
-                       $level = 0;
+                       $path = '';
+                       $space = "&nbsp;&gt;&nbsp;";
                        $view = $this->getTargetView();
+
+                       if(!$this->pro_data && $this->project_id)
+                       {
+                               $this->pro_data = 
$this->boprojects->read_single_project($this->project_id);
+                       }
+               
+                       $level = $level_start = 
intval($this->pro_data['level']);
+
                        $project_id = $this->project_id;
                        while($project_id > 0)
                        {
+                               if($level < ($level_start-1) && ($level > 1))
+                               {
+                                       $title = '&nbsp;...';
+                               }
+                               else
+                               {
                                $title = 
$this->boprojects->return_value('title', $project_id);
+                                       if(strlen($title) > 50)
+                                       {
+                                               $title = substr($title, 0, 35);
+                                               $str_break = strrchr($title, 
32); // ASCII 32 = space
+                                               if($str_break !== false)
+                                               {
+                                                       $pos_break = 
strlen($title) - strlen($str_break);
+                                                       $title = substr($title, 
0, $pos_break);
+                                               }
+                                               $title .= '&nbsp;...';
+                                       }
+                               }
+
                                $link = $this->createViewUrl($view, 
array('project_id' => $project_id));
                                $menu = '<a href="'.$link.'">'.$title.'</a>';
                                $path = $menu.$space.$path;
                                $parent = 
$this->boprojects->return_value('parent', $project_id);
                                $project_id = $parent;
+                               $level--;
                        }
                        
+                       $id = 'button_'.$this->activeView.'_text';
+                       $path .= $this->getText($id);
+                       
                        return $path;
                }
 
@@ -793,7 +893,7 @@
                                break;
                                case 'button_pro_edit_tooltip':
                                case 'button_pro_edit_text':
-                                       $text = lang('edit project');
+                                       $text = lang('edit');
                                break;
                                case 'button_pro_add_sub_tooltip':
                                case 'button_pro_add_sub_text':
@@ -801,7 +901,7 @@
                                break;
                                case 'button_pro_activities_tooltip':
                                case 'button_pro_activities_text':
-                                       $text = lang('employee activities');
+                                       $text = lang('activities');
                                break;
                                case 'button_pro_hours_tooltip':
                                case 'button_pro_hours_text':
@@ -817,7 +917,7 @@
                                break;
                                case 'button_pro_employees_tooltip':
                                case 'button_pro_employees_text':
-                                       $text = lang('project employees');
+                                       $text = lang('employees');
                                break;
                                case 'button_wt_list_tooltip':
                                case 'button_wt_list_text':
@@ -825,7 +925,7 @@
                                break;
                                case 'button_wt_add_tooltip':
                                case 'button_wt_add_text':
-                                       $text = lang('add work hours');
+                                       $text = lang('add activity');
                                break;
                                case 'button_wt_edit_tooltip':
                                case 'button_wt_edit_text':
@@ -839,6 +939,10 @@
                                case 'button_wt_cs_text':
                                        $text = lang('controlling sheet');
                                break;
+                               case 'button_wt_stat_tooltip':
+                               case 'button_wt_stat_text':
+                                       $text = lang('work hours statistics');
+                               break;
                                case 'button_wt_tt_tooltip':
                                case 'button_wt_tt_text':
                                        $text = lang('time tracker');
@@ -847,10 +951,10 @@
                                case 'button_act_report_text':
                                        $text = lang('activity reports');
                                break;
-                       /*      case 'button_export_diamant_tooltip':
+                               case 'button_export_diamant_tooltip':
                                case 'button_export_diamant_text':
                                        $text = lang('export diamant 
accounting');
-                               break;*/
+                               break;
                        }
 
                        return $text;
@@ -858,9 +962,9 @@
 
                function set_app_langs()
                {
-                       
$GLOBALS['phpgw']->template->set_var('th_bg',(isset($GLOBALS['phpgw_info']['theme']['th_bg'])?$GLOBALS['phpgw_info']['theme']['th_bg']:''));
-                       
$GLOBALS['phpgw']->template->set_var('row_on',(isset($GLOBALS['phpgw_info']['theme']['row_on'])?$GLOBALS['phpgw_info']['theme']['row_on']:''));
-                       
$GLOBALS['phpgw']->template->set_var('row_off',(isset($GLOBALS['phpgw_info']['theme']['row_off'])?$GLOBALS['phpgw_info']['theme']['row_off']:''));
+                       
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
+                       
$GLOBALS['phpgw']->template->set_var('row_on',$GLOBALS['phpgw_info']['theme']['row_on']);
+                       
$GLOBALS['phpgw']->template->set_var('row_off',$GLOBALS['phpgw_info']['theme']['row_off']);
 
                        
$GLOBALS['phpgw']->template->set_var('lang_category',lang('Category'));
                        
$GLOBALS['phpgw']->template->set_var('lang_select',lang('Select'));
@@ -883,14 +987,13 @@
                        
$GLOBALS['phpgw']->template->set_var('lang_access',lang('access'));
                        
$GLOBALS['phpgw']->template->set_var('lang_projects',lang('Projects'));
                        
$GLOBALS['phpgw']->template->set_var('lang_project',lang('Project'));
-
-                       
$GLOBALS['phpgw']->template->set_var('lang_sub_projects',lang('Sub projects'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_sub_projects',lang('Sub Projects'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_sub_project',lang('Sub Project'));
 
                        
$GLOBALS['phpgw']->template->set_var('lang_ttracker',lang('time tracker'));
                        
$GLOBALS['phpgw']->template->set_var('lang_statistics',lang('Statistics'));
                        
$GLOBALS['phpgw']->template->set_var('lang_roles',lang('roles'));
                        
$GLOBALS['phpgw']->template->set_var('lang_role',lang('role'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_name',lang('name'));
 
                        
$GLOBALS['phpgw']->template->set_var('lang_act_number',lang('Activity ID'));
                        
$GLOBALS['phpgw']->template->set_var('lang_status',lang('Status'));
@@ -900,10 +1003,8 @@
                        
$GLOBALS['phpgw']->template->set_var('lang_customer',lang('Customer'));
                        
$GLOBALS['phpgw']->template->set_var('lang_coordinator',lang('Coordinator'));
                        
$GLOBALS['phpgw']->template->set_var('lang_employees',lang('Employees'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_project_team',lang('project team'));
-
                        
$GLOBALS['phpgw']->template->set_var('lang_person',lang('Person'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_organization',lang('Organization'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_organization',lang('Orga'));
                        
$GLOBALS['phpgw']->template->set_var('lang_creator',lang('creator'));
                        
$GLOBALS['phpgw']->template->set_var('lang_processor',lang('processor'));
                        
$GLOBALS['phpgw']->template->set_var('lang_previous',lang('previous project'));
@@ -932,13 +1033,12 @@
                        
$GLOBALS['phpgw']->template->set_var('lang_delete',lang('delete'));
                        
$GLOBALS['phpgw']->template->set_var('lang_back',lang('back'));
 
-                       
$GLOBALS['phpgw']->template->set_var('lang_details',lang('details'));
+
 
                        
$GLOBALS['phpgw']->template->set_var('lang_parent',lang('Parent project'));
                        
$GLOBALS['phpgw']->template->set_var('lang_main',lang('Main project'));
 
                        
$GLOBALS['phpgw']->template->set_var('lang_add_milestone',lang('add 
milestone'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_milestones',lang('milestones'));
 
                        
$GLOBALS['phpgw']->template->set_var('lang_result',lang('result'));
                        
$GLOBALS['phpgw']->template->set_var('lang_test',lang('test'));
@@ -976,11 +1076,10 @@
                        
$GLOBALS['phpgw']->template->set_var('lang_billable',lang('billable'));
                        
$GLOBALS['phpgw']->template->set_var('lang_files',lang('files'));
                        
$GLOBALS['phpgw']->template->set_var('lang_attach',lang('attach file'));
-
                        
$GLOBALS['phpgw']->template->set_var('lang_plan_bottom_up',lang('plan bottom 
up'));
                        
$GLOBALS['phpgw']->template->set_var('lang_direct_work',lang('direct work'));
                        
$GLOBALS['phpgw']->template->set_var('lang_sum',lang('Sum'));
-                       $GLOBALS['phpgw']->template->set_var('lang_summery', 
lang('Summary'));
+
 
                        // hours
 
@@ -989,7 +1088,6 @@
                        
$GLOBALS['phpgw']->template->set_var('lang_start_date',lang('Start Date'));
                        
$GLOBALS['phpgw']->template->set_var('lang_end_date',lang('End Date'));
                        
$GLOBALS['phpgw']->template->set_var('lang_date_due',lang('Date due'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_access',lang('Private'));
 
                        
$GLOBALS['phpgw']->template->set_var('lang_projects',lang('Projects'));
                        
$GLOBALS['phpgw']->template->set_var('lang_statistics',lang('Statistics'));
@@ -1013,7 +1111,7 @@
 
                        
$GLOBALS['phpgw']->template->set_var('lang_activity',lang('Activity'));
                        
$GLOBALS['phpgw']->template->set_var('lang_project',lang('Project'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_descr',lang('Short description'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_descr',lang('Description'));
                        
$GLOBALS['phpgw']->template->set_var('lang_remark',lang('Remark'));
                        
$GLOBALS['phpgw']->template->set_var('lang_status',lang('Status'));
                        
$GLOBALS['phpgw']->template->set_var('lang_employee',lang('Employee'));
@@ -1053,6 +1151,7 @@
 
                        
$GLOBALS['phpgw']->template->set_var('lang_non_billable',lang('not billable'));
                        
$GLOBALS['phpgw']->template->set_var('lang_travel_time',lang('travel time'));
+
                        
$GLOBALS['phpgw']->template->set_var('lang_distance',lang('distance'));
                        
$GLOBALS['phpgw']->template->set_var('lang_surcharge',lang('surcharge'));
                        
$GLOBALS['phpgw']->template->set_var('lang_select_surcharge',lang('select 
surcharge'));
@@ -1070,7 +1169,6 @@
                        
$GLOBALS['phpgw']->template->set_var('lang_comment',lang('comment'));
                        
$GLOBALS['phpgw']->template->set_var('lang_action',lang('action'));
 
-                       
$GLOBALS['phpgw']->template->set_var('lang_plus_jobs',lang('Jobs included'));
 
                        // stats
 
@@ -1136,11 +1234,11 @@
                        }
 
                        $status_list = '<option value="active"' . $stat_sel[0] 
. '>' . lang('Active') . '</option>' . "\n"
-                                               . '<option value="nonactive"' . 
(isset($stat_sel[1])? $stat_sel[1]:'') . '>' . lang('Nonactive') . '</option>' 
. "\n";
+                                               . '<option value="nonactive"' . 
$stat_sel[1] . '>' . lang('Nonactive') . '</option>' . "\n";
 
                        if ($showarchive)
                        {
-                               $status_list .= '<option value="archive"' . 
(isset($stat_sel[2])?$stat_sel[2]:'') . '>' . lang('Archive') . '</option>' . 
"\n";
+                               $status_list .= '<option value="archive"' . 
$stat_sel[2] . '>' . lang('Archive') . '</option>' . "\n";
                        }
                        return $status_list;
                }
@@ -1150,11 +1248,11 @@
                        $type                           = 
(isset($data['type'])? $data['type']: 'selectbox');
                        $selected                       = 
(isset($data['selected'])? 
$data['selected']:$this->boprojects->get_acl_for_project($data['project_id']));
                        $project_only           = 
(isset($data['project_only'])?$data['project_only']:False);
-                       $pro_parent                     = 
(isset($data['pro_parent'])?intval($data['pro_parent']):0);
+                       $admins_included = 
(isset($data['admins_included'])?$data['admins_included']:False);
 
                        if($project_only)
                        {
-                               $pro_parent             = $data['project_id'];
+                               $data['pro_parent']     = $data['project_id'];
                                $data['action'] = 'subs';
                        }
 
@@ -1166,9 +1264,10 @@
                        switch($type)
                        {
                                case 'selectbox':
-                                       $employees = 
$this->boprojects->selected_employees(array('action' => 
(isset($data['action'])?$data['action']:''),
-                                                                               
                 'pro_parent' => (($pro_parent>0 && $pro_parent != 
$data['project_id'])?$pro_parent:''),
-                                                                               
                 'project_id' => 
(isset($data['project_id'])?$data['project_id']:'')
+                                       $employees = 
$this->boprojects->selected_employees(array('action' => $data['action'],
+                                                                               
                 'pro_parent' => $data['pro_parent'],
+                                                                               
                 'admins_included' => $admins_included,
+                                                                               
                 'project_id' => $data['project_id']
                                                                                
                ));
                                        break;
                                case 'popup':
@@ -1181,10 +1280,13 @@
                                usort($employees, array('uiprojects_base', 
'cmp_employees'));
                        }
 
-                       $s = '';
                        while (is_array($employees) && (list($null,$account) = 
each($employees)))
                        {
-                               $s .= '<option value="' . 
(isset($account['account_id'])?$account['account_id']:'') . '"';
+                               if(!$account['account_lid'])
+                               {
+                                       continue;
+                               }
+                               $s .= '<option value="' . 
$account['account_id'] . '"';
                                if (in_array($account['account_id'],$selected))
                                {
                                        $s .= ' SELECTED';

Index: inc/class.uistatistics.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/class.uistatistics.inc.php,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- inc/class.uistatistics.inc.php      29 Nov 2006 21:31:07 -0000      1.66
+++ inc/class.uistatistics.inc.php      5 Dec 2006 19:40:45 -0000       1.67
@@ -3,10 +3,10 @@
        * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: class.uistatistics.inc.php,v 1.66 2006/11/29 21:31:07 
sigurdne Exp $
+       * @version $Id: class.uistatistics.inc.php,v 1.67 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/class.uistatistics.inc.php,v $
        */
 
@@ -81,13 +81,21 @@
                        $pro_main       = 
get_var('pro_main',array('POST','GET'));
                        $pro_users      = 
get_var('pro_users',array('POST','GET'));
                        $values         = get_var('values',array('POST','GET'));
-                       $view           = get_var('view',array('POST','GET'));
 
-                       $msg = '';
+                       if($_POST['userstats'])
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>'projects.uistatistics.list_users'));
+                       }
+
+                       if($_POST['worktimestats'])
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>'projects.uistatistics.list_users_worktimes'));
+                       }
+
                        $pro_user = array();
-                       if(isset($_POST['viewuser']) && $_POST['viewuser'])
+                       if($_POST['viewuser'])
                        {
-                               if(isset($values['project_id']) && 
is_array($values['project_id']))
+                               if(is_array($values['project_id']))
                                {
                                        $i = 0;
                                        foreach($values['project_id'] as 
$pro_id => $val)
@@ -102,9 +110,9 @@
                                }
                        }
 
-                       if(isset($_POST['viewgantt']) && $_POST['viewgantt'])
+                       if($_POST['viewgantt'])
                        {
-                               if(isset($values['gantt_id']) && 
is_array($values['gantt_id']))
+                               if(is_array($values['gantt_id']))
                                {
                                        $i = 0;
                                        foreach($values['gantt_id'] as $pro_id 
=> $val)
@@ -113,7 +121,7 @@
                                                $i++;
                                        }
                                        
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>'projects.uistatistics.project_gantt',
-                                                                               
                                                
'project_id'=>implode(',',$gantt_user)));
+                                                                               
                                                                'project_id'=> 
implode(',',$gantt_user)));
                                }
                                else
                                {
@@ -121,6 +129,11 @@
                                }
                        }
 
+/*
+      $GLOBALS['phpgw_info']['flags']['app_header'] = lang('projects') . ': ' 
. lang('list projects')
+                              . $this->admin_header_info();
+      $this->display_app_header();
+*/
                        $this->ui_base->display_app_header();
 
                        
$GLOBALS['phpgw']->template->set_file(array('projects_list_t' => 
'stats_projectlist.tpl'));
@@ -129,9 +142,6 @@
                        
$GLOBALS['phpgw']->template->set_block('projects_list_t','user_cols','cols');
                        
$GLOBALS['phpgw']->template->set_block('projects_list_t','project_main','main');
 
-                       
$GLOBALS['phpgw']->template->set_block('projects_list_t','gantt_submit','gantt');
-                       
$GLOBALS['phpgw']->template->set_block('projects_list_t','user_submit','user');
-
                        $GLOBALS['phpgw']->template->set_var('msg',$msg);
 
                        if($pro_main)
@@ -140,7 +150,7 @@
                                
$GLOBALS['phpgw']->template->set_var('title_main',$main['title']);
                                
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project',
                                                                                
                                                                                
'action'=>'mains',
-                                                                               
                                                                                
'project_id'=> $pro_main)));
+                                                                               
                                                                                
                                'project_id'=>$pro_main)));
                                
$GLOBALS['phpgw']->template->set_var('coordinator_main',$main['coordinatorout']);
                                
$GLOBALS['phpgw']->template->set_var('number_main',$main['number']);
                                
$GLOBALS['phpgw']->template->set_var('customer_main',$main['customerout']);
@@ -158,8 +168,7 @@
                                'menuaction'    => 
'projects.uistatistics.list_projects',
                                'pro_main'              => $pro_main,
                                'action'                => $action,
-                               'cat_id'                => $this->cat_id,
-                               'view'                  => $view
+        'cat_id'               => $this->cat_id
                        );
 
                        if (!$this->start)
@@ -207,7 +216,7 @@
                        
$GLOBALS['phpgw']->template->set_var('sort_coordinator',$this->nextmatchs->show_sort_order($this->sort,'coordinator',$this->order,'/index.php',lang('Coordinator'),$link_data));
                        
$GLOBALS['phpgw']->template->set_var('user_img',$GLOBALS['phpgw']->common->image('phpgwapi','users'));
                        
$GLOBALS['phpgw']->template->set_var('user_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
-                       
$GLOBALS['phpgw']->template->set_var('lang_action',$view=='gantt'?'Gantt 
Chart':lang('employees'));
+
 // -------------- end header declaration 
---------------------------------------
 
                        for ($i=0;$i<count($pro);$i++)
@@ -233,8 +242,8 @@
                                {
                                        $projects_url = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.list_hours',
                                                                                
                                                                        
'project_id'=> $pro[$i]['project_id'],
-                                                                               
                                                                        
'action'        => 'hours',
-                                                                               
                                                                        
'pro_main'      => $pro_main));
+                                                                               
                                                'action'=>'hours',
+                                                                               
                                                'pro_main'=>$pro_main));
                                }
 
                                $GLOBALS['phpgw']->template->set_var(array
@@ -246,9 +255,8 @@
                                        'edate'                 => 
$pro[$i]['edateout'],
                                        'coordinator'   => 
$pro[$i]['coordinatorout'],
                                        'view_img'              => 
$GLOBALS['phpgw']->common->image('phpgwapi','view'),
-                                       'radio_user_checked'    => 
(isset($_POST['viewuser'])?(in_array($pro[$i]['project_id'],$pro_user)?' 
checked':''):''),
-                                       'project_id'    => 
$pro[$i]['project_id'],
-                                       'view_value'    => 
($view=='gantt'?'gantt_id][' . $pro[$i]['project_id']:'project_id][' . 
$pro[$i]['project_id'])
+          'radio_user_checked' => 
$_POST['viewuser']?(in_array($pro[$i]['project_id'],$pro_user)?' 
checked':''):'',
+          'project_id' => $pro[$i]['project_id']
                                ));
 
                                $link_data['project_id'] = 
$pro[$i]['project_id'];
@@ -265,7 +273,7 @@
 
                                
$GLOBALS['phpgw']->template->set_var('employee_list','');
                                
$GLOBALS['phpgw']->template->set_var('users','');
-                               if(isset($emps[$pro[$i]['project_id']]) && 
is_array($emps[$pro[$i]['project_id']]))
+        if(is_array($emps[$pro[$i]['project_id']]))
                                {
                                        foreach($emps[$pro[$i]['project_id']] 
as $e)
                                        {
@@ -288,10 +296,6 @@
 
                        $this->save_sessiondata('pstat');
                        $GLOBALS['phpgw']->template->set_var('cols','');
-                       //$GLOBALS['phpgw']->template->set_var('user','');
-                       //$GLOBALS['phpgw']->template->set_var('gantt','');
-
-                       $GLOBALS['phpgw']->template->fp($view,$view . 
'_submit',True);
                        
$GLOBALS['phpgw']->template->pfp('out','projects_list_t',True);
                }
 
@@ -300,7 +304,11 @@
                {
                        $project_id = get_var('project_id',array('POST','GET'));
 
+      //$GLOBALS['phpgw_info']['flags']['app_header'] = lang('projects') . ': 
' . lang('list project employees')
+      //                                                                       
                        . $this->admin_header_info();
+
                        $this->ui_base->display_app_header();
+      $pro_main = $this->ui_base->pro_main;
 
                        
$GLOBALS['phpgw']->template->set_file(array('projects_list_t' => 
'stats_project_employees.tpl'));
                        
$GLOBALS['phpgw']->template->set_block('projects_list_t','projects_list','list');
@@ -314,9 +322,9 @@
                        {
                                $main = 
$this->boprojects->read_single_project($pro_main);
                                
$GLOBALS['phpgw']->template->set_var('title_main',$main['title']);
-                               
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'
 => 'projects.uiprojects.view_project',
-                                                                               
                                                                                
                                                        'action'        => 
'mains',
-                                                                               
                                                                                
                                                        'project_id'    => 
$pro_main)));
+        
$GLOBALS['phpgw']->template->set_var('main_url',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.view_project',
+                                                                               
                                                                                
                                'action'=>'mains',
+                                                                               
                                                                                
                                'project_id'=> $pro_main)));
                                
$GLOBALS['phpgw']->template->set_var('coordinator_main',$main['coordinatorout']);
                                
$GLOBALS['phpgw']->template->set_var('number_main',$main['number']);
                                
$GLOBALS['phpgw']->template->set_var('customer_main',$main['customerout']);
@@ -336,8 +344,8 @@
                                $this->start = 0;
                        }
 
-                       $this->boprojects->limit = False;
-                       $this->boprojects->status = $this->status;
+      $this->boprojects->limit = false;
+      $this->boprojects->status = false; // workaround for full tree view 
support
                        $pro = $this->boprojects->list_projects(array('action' 
=> 'mainsubsorted','project_id' => $project_id));
 
 // --------------------- nextmatch variable template-declarations 
------------------------
@@ -353,14 +361,20 @@
 
                        //if ($action == 'mains')
                        //{
-                               $action_list = '<select name="cat_id" 
onChange="this.form.submit();"><option value="none">' . lang('Select category') 
. '</option>' . "\n"
-                                                       . 
$this->boprojects->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
+      //       $action_list = '<select name="cat_id" 
onChange="this.form.submit();"><option value="none">' . lang('Select category') 
. '</option>' . "\n"
+      //                               . 
$this->boprojects->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
                        //}
                        //else
                        //{
                        //      $action_list= '<select name="pro_main" 
onChange="this.form.submit();"><option value="">' . lang('Select main project') 
. '</option>' . "\n"
                        //                              . 
$this->boprojects->select_project_list(array('status' => $status, 'selected' => 
$project_id)) . '</select>';
                        //}
+      if($pro_main)
+      {
+        $cat_id = $this->boprojects->return_value('cat', $pro_main);
+        $action_list = lang('category').': 
'.$this->boprojects->cats->id2name($cat_id);
+        $action_list = '<input style="border: solid 2px #d0d0d0;" 
readonly="readonly" size="60" type="text" value="&nbsp;'.$action_list.'">';
+      }
 
                        
$GLOBALS['phpgw']->template->set_var('action_list',$action_list);
                        
$GLOBALS['phpgw']->template->set_var('filter_list',$this->nextmatchs->new_filter($this->filter));
@@ -390,12 +404,13 @@
 
 // --------------- template declaration for list records 
-------------------------------------
 
-                               /*$projects_url = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uistatistics.list_project_employees','project_id'=>
 $pro[$i]['project_id']));
+        /*$projects_url = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uistatistics.list_project_employees',
+                                                                               
                                                
'project_id'=>$pro[$i]['project_id']));
                                */                                      
                                $projects_url = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.list_hours',
                                                                                
                                                'project_id'=> 
$pro[$i]['project_id'],
                                                                                
                                                'action'=>'hours',
-                                                                               
                                                'pro_main'=>$pro[$i]['main']));
+                                                                               
                                                'pro_main'=> $pro[$i]['main']));
 
                                if($pro[$i]['project_id']==$project_id)
                                {
@@ -416,7 +431,7 @@
                                        'sdate'                 => 
$pro[$i]['sdateout'],
                                        'edate'                 => 
$pro[$i]['edateout'],
                                        'coordinator'   => 
$pro[$i]['coordinatorout'],
-                                       'view_img'              => 
$GLOBALS['phpgw']->common->image('phpgwapi','users'),
+          'view_img'           => 
$GLOBALS['phpgw']->common->image('project','users'),
                                        'radio_user_checked'    => 
$_POST['viewuser']?(in_array($pro[$i]['project_id'],$pro_user)?' 
checked':''):'',
                                        'project_id'    => 
$pro[$i]['project_id'],
                                        'node_style'    => $node_style,
@@ -458,11 +473,16 @@
 
 // ------------------------- end record declaration ------------------------
 
+      $GLOBALS['phpgw']->template->set_var('lang_view_gantt',lang('view gantt 
chart'));
+      $GLOBALS['phpgw']->template->set_var('lang_view_users',lang('view 
users'));
+
                        $this->save_sessiondata('pstat');
                        $GLOBALS['phpgw']->template->set_var('cols','');
                        
$GLOBALS['phpgw']->template->pfp('out','projects_list_t',True);
                }
 
+
+
                function coordinator_format($employee = '')
                {
                        if (! $employee)
@@ -485,10 +505,10 @@
 
                function list_users()
                {
-                       $values = (isset($_POST['values'])?$_POST['values']:'');
+      $values  = $_POST['values'];
 
                        $pro_user = array();
-                       if(isset($values['account_id']) && 
is_array($values['account_id']))
+      if(is_array($values['account_id']))
                        {
                                $i = 0;
                                foreach($values['account_id'] as $a_id => $val)
@@ -566,7 +586,7 @@
 
                                
$GLOBALS['phpgw']->template->set_var('project_list','');
                                $GLOBALS['phpgw']->template->set_var('pro','');
-                               if(isset($pro[$users[$i]['account_id']]) && 
is_array($pro[$users[$i]['account_id']]))
+        if(is_array($pro[$users[$i]['account_id']]))
                                {
                                        foreach($pro[$users[$i]['account_id']] 
as $p)
                                        {
@@ -584,7 +604,7 @@
 // ------------------------------- end record declaration 
---------------------------------
 
                        
$GLOBALS['phpgw']->template->pfp('out','user_list_t',True);
-                       $this->save_sessiondata($action='');
+      $this->save_sessiondata($action);
                }
 
                function user_stat()
@@ -622,7 +642,7 @@
 
                        
$GLOBALS['phpgw']->template->set_var('employee',$employee);
 
-                       
$this->nextmatchs->alternate_row_class($GLOBALS['phpgw']->template);
+      $this->nextmatchs->alternate_row_color($GLOBALS['phpgw']->template);
 
                        if (!$values['sdate'])
                        {
@@ -858,8 +878,8 @@
                                $end_val = $end;
                        }
 
-                       $start  = 
isset($start_val)?$start_val:mktime(12,0,0,date('m'),date('d'),date('Y'));
-                       $end    = 
isset($end_val)?$end_val:mktime(12,0,0,date('m'),date('d')+30,date('Y'));
+      $start   = 
$start_val?$start_val:mktime(12,0,0,date('m'),date('d'),date('Y'));
+      $end     = 
$end_val?$end_val:mktime(12,0,0,date('m'),date('d')+30,date('Y'));
 
                        $GLOBALS['phpgw']->template->set_var('start',$start);
                        $GLOBALS['phpgw']->template->set_var('end',$end);
@@ -873,7 +893,7 @@
                                                                                
                                                'action'=> $action,
                                                                                
                                                'project_id'=> $project_id,
                                                                                
                                                'gantt_popup'=>'True',
-                                                                               
                                                'start'=> $start,
+                                                                               
                                                                                
        'start'=>$start,
                                                                                
                                                'end'=> $end)));
 
 
@@ -885,7 +905,7 @@
                        //_debug_array($project_array);
 
                        $gantt_data = 
$this->bostatistics->show_graph(array('project_array' => $project_array,'sdate' 
=> $start, 'edate' => $end,'width' => $screen_width,
-                                                                               
                'height' => $screen_height,'gantt_popup' => 
$gantt_popup,'parent_array' => $parent_array));
+                        'height' => $screen_height,'gantt_popup' => 
$gantt_popup,'parent_array' => $parent_array, 'viewtype' => 'planned'));
 
                        
$GLOBALS['phpgw']->template->set_var('lang_close_window',lang('close window'));
                        
$GLOBALS['phpgw']->template->set_var('lang_show_gantt_in_new_window',lang('show 
gantt chart in new window'));
@@ -1119,7 +1139,25 @@
                {
                        $jscal = CreateObject('phpgwapi.jscalendar');   // 
before phpgw_header() !!!
 
-                       $values = (isset($_POST['values'])?$_POST['values']:'');
+                 $values = get_var('values',array('POST','GET'));
+                 $sdate  = get_var('sdate',array('POST','GET'));
+                 $edate  = get_var('edate',array('POST','GET'));
+
+                       if($values['sdate'] || $values['edate'])
+                       {
+                         
$GLOBALS['phpgw']->session->appsession('session_data', 'projectsStartDate', 
$jscal->input2date($values['sdate']));
+                         
$GLOBALS['phpgw']->session->appsession('session_data', 'projectsEndDate',  
$jscal->input2date($values['edate']));
+                       }
+
+                       if(!$sdate && !$edate)
+                       {
+                               $sdateSession =  
$GLOBALS['phpgw']->session->appsession('session_data','projectsStartDate');
+                               $sdate = $sdateSession['raw'];
+       
+                               $edateSession =  
$GLOBALS['phpgw']->session->appsession('session_data','projectsEndDate');
+                               $edate = $edateSession['raw'];
+                       }
+
 
                        //$GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . lang('User statistics')
                        //                                                      
                                        . $this->admin_header_info();
@@ -1129,6 +1167,7 @@
                        
$GLOBALS['phpgw']->template->set_file(array('user_list_worktimes_t' => 
'stats_userlist_worktimes.tpl'));
                        
$GLOBALS['phpgw']->template->set_block('user_list_worktimes_t','pro_list','pro');
                        
$GLOBALS['phpgw']->template->set_block('user_list_worktimes_t','worktime_list','work');
+      
$GLOBALS['phpgw']->template->set_block('user_list_worktimes_t','posible_sum','posible');
 
                        $link_data = array
                        (
@@ -1137,6 +1176,11 @@
                        );
 
                        
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
+      $GLOBALS['phpgw']->template->set_var('lang_workhours',lang('work 
hours'));
+      $GLOBALS['phpgw']->template->set_var('lang_workhours_project', 
lang('Project'));
+      $GLOBALS['phpgw']->template->set_var('lang_workhours_journey', 
lang('travel time'));
+      $GLOBALS['phpgw']->template->set_var('lang_workhours_sum', lang('Sum'));
+      $GLOBALS['phpgw']->template->set_var('lang_update', lang('update'));
 
                        if(!isset($values['employee']))
                        {
@@ -1147,14 +1191,42 @@
 
                        if ($this->boprojects->isprojectadmin('pad') || 
$this->boprojects->isprojectadmin('pmanager'))
                        {
-                               $select_employee_list = '<select 
name="values[employee]" size="1">' . "\n";
-                               $select_employee_list .= 
$this->ui_base->employee_format(array('selected' => $values['employee']));
+        $employees = $this->boprojects->read_projects_acl();
+        $employees_list = array();
+
+        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);
+        }
+
+        if(count($employees_list))
+        {
+          asort($employees_list);
+          reset($employees_list);
+        }
+
+        $select_employee_list = "<select name=\"values[employee]\" 
size=\"1\">\n";
+        $select_employee_list .= '<option 
value="0">'.lang('all')."</option>\n";
+        while (list($account_id,$account_name) = each($employees_list))
+        {
+          $select_employee_list .= '<option value="' . $account_id . '"';
+          if ($values['employee'] == $account_id)
+          {
+            $select_employee_list .= ' selected';
+          }
+          $select_employee_list .= '>'.$account_name."</option>\n";
+        }
                                $select_employee_list .= '</select>';
                        }
                        else
                        {
                                // show only current user
-                               $select_employee_list = '<input type="hidden" 
name="values[employee]" value="'. (isset($account_id)?$account_id:'') .'">'. 
$GLOBALS['phpgw']->common->grab_owner_name($this->account);
+        $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);
                        }
 
                        
$GLOBALS['phpgw']->template->set_var('select_employee_list', 
$select_employee_list);
@@ -1163,7 +1235,7 @@
 
 // ------------ action selectbox variable template-declarations 
---------------------
 
-                       $select_action_list = '<select 
name="values[stat_action]" size="1">' . "\n";
+      $select_action_list = "<select name=\"values[stat_action]\" 
size=\"1\">\n";
                        
                        $actions = array(
                                'pro_all'      => lang('all'),
@@ -1174,7 +1246,7 @@
                        while(list($stat, $lang_stat) = each($actions))
                        {
                                $select_action_list .= '<option 
value="'.$stat.'"';
-                               if(isset($values['stat_action']) && 
$values['stat_action'] == $stat)
+        if($values['stat_action'] == $stat)
                                {
                                        $select_action_list .= ' selected';
                                }
@@ -1188,21 +1260,35 @@
 
 // ------------- jscal variable template-declarations 
-------------------------------
 
-                       $start_val = false;
-                       if(isset($values['sdate']) && $values['sdate'])
+      if($values['sdate'])
                        {
                                $start_array = 
$jscal->input2date($values['sdate']);
                                //$start_val   = $start_array['raw'];
                                $start_val   = 
mktime(0,0,0,$start_array['month'],$start_array['day'],$start_array['year']);
                        }
+      elseif($sdate)
+      {
+        $start_val = $sdate;
+      }
+      else
+      {
+        $start_val = false;
+      }
 
-                       $end_val = false;
-                       if(isset($values['edate']) && $values['edate'])
+      if($values['edate'])
                        {
                                $end_array = 
$jscal->input2date($values['edate']);
                                //$end_val   = $end_array['raw'];
                                $end_val   = 
mktime(23,59,59,$end_array['month'],$end_array['day'],$end_array['year']);
                        }
+      elseif($edate)
+      {
+        $end_val = $edate;
+      }
+      else
+      {
+        $end_val = false;
+      }
 
                        $start = 
$start_val?$start_val:mktime(0,0,0,date('m'),1,date('Y'));
                        $end   = 
$end_val?$end_val:mktime(23,59,59,date('m')+1,0,date('Y'));
@@ -1214,7 +1300,11 @@
 
                        if(isset($values['employee']) && 
($values['employee']>0))
                        {
-                               $worktimes = 
$this->boprojects->list_emp_worktimes($values['employee'], $start, $end);
+        $GLOBALS['phpgw']->template->set_var('info_1', lang('projects'));
+        $GLOBALS['phpgw']->template->set_var('info_1_1', lang('title'));
+        $GLOBALS['phpgw']->template->set_var('info_1_2', lang('number'));
+
+        $worktimes = $this->boprojects->get_emp_worktimes($values['employee'], 
$start, $end);
 
                                // filter
                                $project_list = array();
@@ -1223,7 +1313,7 @@
                                        $project_id = 
$worktimes['projects'][$i];
                                        $project = 
$worktimes[$project_id]['project_data'];
 
-                                       
switch((isset($values['stat_action'])?$values['stat_action']:''))
+          switch($values['stat_action'])
                                        {
                                                case 'pro_direct':
                                                        
if($project['project_direct'] != 'Y')
@@ -1253,6 +1343,7 @@
 
                                                $project_list[$main_project_id] 
= array();
                                                
$project_list[$main_project_id]['project_title']        = $main['title'];
+            $project_list[$main_project_id]['project_number']       = 
$main['number'];
                                                
$project_list[$main_project_id]['sum_minutes_worktime'] = 0;
                                                
$project_list[$main_project_id]['sum_minutes_journey']  = 0;
                                                
$project_list[$main_project_id]['sum_minutes_all']      = 0;
@@ -1267,6 +1358,7 @@
                                $summary_sum_minutes_journey  = 0;
                                $summary_sum_minutes_all      = 0;
 
+        $action_url = $GLOBALS['phpgw']->link('/index.php', array('menuaction' 
=> 'projects.uiprojecthours.list_hours' , 'sdate' => $start, 'edate' => $end, 
'employee' => $values['employee']));
                                reset($project_list);
                                while(list($project_id, $project) = 
each($project_list))
                                {
@@ -1278,8 +1370,9 @@
                                        $project_hj = 
$this->boprojects->format_minutes($project['sum_minutes_journey']);
                                        $project_hs = 
$this->boprojects->format_minutes($project['sum_minutes_all']);
                                        
-                                       
$this->nextmatchs->template_alternate_row_class($GLOBALS['phpgw']->template);
-                                       
$GLOBALS['phpgw']->template->set_var('pro_name', $project['project_title']);
+          $link_url = $action_url.'&project_id='.$project_id;
+          $GLOBALS['phpgw']->template->set_var('pro_name', '<a 
href="'.$link_url.'" title="'.lang('list 
activities').'">'.$project['project_title'].'</a>');
+          $GLOBALS['phpgw']->template->set_var('pro_number', '<a 
href="'.$link_url.'" title="'.lang('list 
activities').'">'.$project['project_number'].'</a>');
                                        
$GLOBALS['phpgw']->template->set_var('pro_hours', $project_hw);
                                        
$GLOBALS['phpgw']->template->set_var('pro_hours_journey', $project_hj);
                                        
$GLOBALS['phpgw']->template->set_var('pro_hours_sum', $project_hs);
@@ -1292,12 +1385,121 @@
                                        
$GLOBALS['phpgw']->template->fp('project_list','pro', true);
                                        
$GLOBALS['phpgw']->template->set_var('pro', '');
 
-                                       
$GLOBALS['phpgw']->template->set_var('summery_workhours_project', 
$this->boprojects->format_minutes($summary_sum_minutes_worktime));
-                                       
$GLOBALS['phpgw']->template->set_var('summery_workhours_journey', 
$this->boprojects->format_minutes($summary_sum_minutes_journey));
-                                       
$GLOBALS['phpgw']->template->set_var('summery_workhours_sum', 
$this->boprojects->format_minutes($summary_sum_minutes_all));
+          $GLOBALS['phpgw']->template->set_var('lang_summery', 
lang('Summary'));
+          
$GLOBALS['phpgw']->template->set_var('lang_summery_workhours_project', 
$this->boprojects->format_minutes($summary_sum_minutes_worktime));
+          
$GLOBALS['phpgw']->template->set_var('lang_summery_workhours_journey', 
$this->boprojects->format_minutes($summary_sum_minutes_journey));
+          $GLOBALS['phpgw']->template->set_var('lang_summery_workhours_sum', 
$this->boprojects->format_minutes($summary_sum_minutes_all));
+        }
+        
+        
+        $prefs = CreateObject('phpgwapi.preferences', $values['employee']);
+               $prefs->read_repository();
+               
+               $sbox = createobject('phpgwapi.sbox');
+               $holidays = CreateObject('phpgwapi.calendar_holidays');
+        
+        $pref_country = $prefs->data['common']['country'];
+               if(!$pref_country)
+               { // no user prefs
+                       $pref_country = 
$GLOBALS['phpgw']->preferences->data['common']['country'];
+               }
+               if(!$pref_country)
+               { // no predefined user prefs
+                       $pref_country = 'DE';
+               }
+               
+               $pref_f_state = $prefs->data['common']['federalstate'];
+               if(!$pref_f_state)
+               { // no user prefs
+                       $pref_f_state = 
$GLOBALS['phpgw']->preferences->data['common']['federalstate'];
+               }
+               if(!$pref_f_state)
+               { // no predefined user prefs
+                       $pref_f_state = 8; // Niedersachsen
+               }
+
+               $pref_religion = $prefs->data['common']['religion'];
+               if(!$pref_religion)
+               { // no user prefs
+                       $pref_religion = 
$GLOBALS['phpgw']->preferences->data['common']['religion'];
+               }
+               if(!$pref_religion)
+               { // no predefined user prefs
+                       $pref_religion = 0; // Atheistisch
+               }
+       
+//             $country = 
ucfirst($GLOBALS['phpgw']->translation->retranslate($sbox->country_array[$pref_country]));
+               $country = ucfirst(lang($sbox->country_array[$pref_country]));
+
+               $federal_state = 
$this->holidays->federal_states[$country][$pref_f_state]; // Achtung: bisher 
existiert nur germany!
+               $religion = $this->holidays->religions[$pref_religion];
+        
+        $workdays = 
$holidays->get_number_of_workdays(date("d",$start),date("m",$start),date("Y",$start),date("d",$end),date("m",$end),date("Y",$end),$country,$federal_state,$religion);
+        $GLOBALS['phpgw']->template->set_var('summery_workhours_posible', 
($workdays*8));
+        $GLOBALS['phpgw']->template->set_var('lang_summery_workhours_posible', 
lang('Posible workhours'));
+
+               $GLOBALS['phpgw']->template->parse('ps_sum','posible_sum',True);
+
+        $GLOBALS['phpgw']->template->fp('work','worktime_list', true);
+
+      }
+
+      if(isset($values['employee']) && ($values['employee']==0))
+      {
+        reset($employees_list);
+        $summary_sum_minutes_worktime = 0;
+        $summary_sum_minutes_journey  = 0;
+        $summary_sum_minutes_all      = 0;
+
+        $GLOBALS['phpgw']->template->set_var('info_1', lang('employees'));
+        $GLOBALS['phpgw']->template->set_var('info_1_1', lang('name'));
+        $GLOBALS['phpgw']->template->set_var('info_1_2', '');
+        $GLOBALS['phpgw']->template->set_var('posible_sum', '');
+
+        $link_data = array
+        (
+          'menuaction' => 'projects.uistatistics.list_users_worktimes',
+          'action'     => 'ustat',
+          'sdate'      => $start,
+          'edate'      => $end
+        );
+        $action_url = $GLOBALS['phpgw']->link('/index.php',$link_data);
+
+        while(list($emp_id, $emp_name) = each($employees_list))
+        {
+          $worktimes = $this->boprojects->get_emp_worktimes($emp_id, $start, 
$end);
+
+          $summary_sum_minutes_worktime += $worktimes['sum_minutes_worktime'];
+          $summary_sum_minutes_journey  += $worktimes['sum_minutes_journey'];
+          $summary_sum_minutes_all      += $worktimes['sum_minutes_all'];
+
+          $emp_hw = 
$this->boprojects->format_minutes($worktimes['sum_minutes_worktime']);
+          $emp_hj = 
$this->boprojects->format_minutes($worktimes['sum_minutes_journey']);
+          $emp_hs = 
$this->boprojects->format_minutes($worktimes['sum_minutes_all']);
+
+          $GLOBALS['phpgw']->template->set_var('pro_name', '<a 
href="'.$action_url.'&values[employee]='.$emp_id.'">'.$emp_name.'</a>');
+          $GLOBALS['phpgw']->template->set_var('pro_number', '');
+          $GLOBALS['phpgw']->template->set_var('pro_hours', $emp_hw);
+          $GLOBALS['phpgw']->template->set_var('pro_hours_journey', $emp_hj);
+          $GLOBALS['phpgw']->template->set_var('pro_hours_sum', $emp_hs);
+
+          $GLOBALS['phpgw']->template->fp('pro','pro_list', true);
+        }
+
+        if(count($employees_list) > 0)
+        {
+          $GLOBALS['phpgw']->template->fp('project_list','pro', true);
+          $GLOBALS['phpgw']->template->set_var('pro', '');
+
+          $GLOBALS['phpgw']->template->set_var('lang_summery', 
lang('Summary'));
+          
$GLOBALS['phpgw']->template->set_var('lang_summery_workhours_project', 
$this->boprojects->format_minutes($summary_sum_minutes_worktime));
+          
$GLOBALS['phpgw']->template->set_var('lang_summery_workhours_journey', 
$this->boprojects->format_minutes($summary_sum_minutes_journey));
+          $GLOBALS['phpgw']->template->set_var('lang_summery_workhours_sum', 
$this->boprojects->format_minutes($summary_sum_minutes_all));
                                }
                                
$GLOBALS['phpgw']->template->fp('work','worktime_list', true);
                        }
+
+
                        
$GLOBALS['phpgw']->template->pfp('out','user_list_worktimes_t',True);
                }
        }

Index: inc/hook_add_def_pref.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/hook_add_def_pref.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- inc/hook_add_def_pref.inc.php       9 Apr 2005 22:36:30 -0000       1.9
+++ inc/hook_add_def_pref.inc.php       5 Dec 2006 19:40:45 -0000       1.10
@@ -1,15 +1,12 @@
 <?php
        /**
-       * Project Manager - Preferences
+       * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: hook_add_def_pref.inc.php,v 1.9 2005/04/09 22:36:30 ceb 
Exp $
+       * @version $Id: hook_add_def_pref.inc.php,v 1.10 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/hook_add_def_pref.inc.php,v $
        */
-
-       $columns = 
array('priority','number','coordinatorout','sdateout','edateout');
-       $GLOBALS['pref']->change('projects','columns',$columns);
 ?>

Index: inc/hook_admin.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/hook_admin.inc.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- inc/hook_admin.inc.php      27 Nov 2006 21:36:26 -0000      1.25
+++ inc/hook_admin.inc.php      5 Dec 2006 19:40:45 -0000       1.26
@@ -1,27 +1,32 @@
 <?php
        /**
-       * Project Manager - Admin
+       * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: hook_admin.inc.php,v 1.25 2006/11/27 21:36:26 sigurdne 
Exp $
+       * @version $Id: hook_admin.inc.php,v 1.26 2006/12/05 19:40:45 sigurdne 
Exp $
        * $Source: /sources/phpgroupware/projects/inc/hook_admin.inc.php,v $
        */
 
        {
+// Only Modify the $file and $title variables.....
                $file = Array
                (
-                       'Site Configuration'            => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uiconfig.index', 'appname' => 'projects') ),
-                       'project administrators'        => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uiconfig.list_admins') ),
-                       'Activities'                            => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uiconfig.list_activities','action'=>'act') ),
-                       'Budget'                                        => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uiconfig.list_budget','action'=>'mains') ),
-                       'Worktime statusmail'           => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uiconfig.config_worktime_statusmail') ),
-                       'Worktime warnmail'                     => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uiconfig.config_worktime_warnmail') ),
-                       'Workhours booking'                     => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uiconfig.config_workhours_booking') ),
-                       'edit project id help msg'      => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uiconfig.config_proid_help_msg') ),
+                       'Site Configuration'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'admin.uiconfig.index','appname'=>
 $appname)),
+                       'Worktime statusmail'           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_worktime_statusmail')),
+                       'Worktime warnmail'                     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_worktime_warnmail')),
+                       'Workhours booking'                     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_workhours_booking')),
+                       'managing committee'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_admins','action'=>'pmanager')),
+                       'project administrators'        => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_admins','action'=>'pad')),
+                       'sales department'                      => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_admins','action'=>'psale')),
+                       'Global Categories'                     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'admin.uicategories.index','appname'=>
 $appname)),
+                       'edit project id help msg'      => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_proid_help_msg')),
+                       'edit locations'        => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_locations')),
+                       'accounting'    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_accounting'))
                );
-               $GLOBALS['phpgw']->common->display_mainscreen($appname,$file);
+//Do not modify below this line
+               display_section($appname,$appname,$file);
        }
 ?>

Index: inc/hook_deleteaccount.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/hook_deleteaccount.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- inc/hook_deleteaccount.inc.php      5 Sep 2006 10:53:09 -0000       1.8
+++ inc/hook_deleteaccount.inc.php      5 Dec 2006 19:40:45 -0000       1.9
@@ -1,24 +1,24 @@
 <?php
        /**
-       * Project Manager - Delete account
+       * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: hook_deleteaccount.inc.php,v 1.8 2006/09/05 10:53:09 
skwashd Exp $
+       * @version $Id: hook_deleteaccount.inc.php,v 1.9 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/hook_deleteaccount.inc.php,v $
        */
 
        // Delete all records for a user
        $pro = CreateObject('projects.boprojects');
 
-       if ( (int)$_POST['new_owner'] == 0)
+       if(intval($_POST['new_owner']) == 0)
        {
-               $pro->delete_project( (int)$_POST['account_id'],0,'account');
+               $pro->delete_project(intval($_POST['account_id']),0,'account');
        }
        else
        {
-               $pro->change_owner( (int)$_POST['account_id'], (int) 
$_POST['new_owner']);
+               
$pro->change_owner(intval($_POST['account_id']),intval($_POST['new_owner']));
        }
 ?>

Index: inc/hook_home.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/hook_home.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- inc/hook_home.inc.php       30 Aug 2006 17:02:38 -0000      1.6
+++ inc/hook_home.inc.php       5 Dec 2006 19:40:45 -0000       1.7
@@ -1,17 +1,24 @@
 <?php
        /**
-       * Project Manager - Home screen
+       * Project Manager
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: hook_home.inc.php,v 1.6 2006/08/30 17:02:38 skwashd Exp 
$
+       * @version $Id: hook_home.inc.php,v 1.7 2006/12/05 19:40:45 sigurdne 
Exp $
        * $Source: /sources/phpgroupware/projects/inc/hook_home.inc.php,v $
        */
 
-       if ( 
isset($GLOBALS['phpgw_info']['user']['preferences']['projects']['mainscreen_showevents'])
-               && 
$GLOBALS['phpgw_info']['user']['preferences']['projects']['mainscreen_showevents']
 == True)
+       $d1 = strtolower(substr(PHPGW_APP_INC,0,3));
+       if($d1 == 'htt' || $d1 == 'ftp' )
+       {
+               echo "Failed attempt to break in via an old Security Hole!<br 
/>\n";
+               $GLOBALS['phpgw']->common->phpgw_exit();
+       }
+       unset($d1);
+
+       if 
($GLOBALS['phpgw_info']['user']['preferences']['projects']['mainscreen_showevents']
 == True)
        {
 
                $projects = CreateObject('projects.uiprojects');

Index: inc/hook_manual.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/hook_manual.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- inc/hook_manual.inc.php     9 Apr 2005 22:36:30 -0000       1.4
+++ inc/hook_manual.inc.php     5 Dec 2006 19:40:45 -0000       1.5
@@ -2,12 +2,12 @@
        /**
        * Project Manager - Manual
        *
-       * @author Bettina Gille address@hidden
        * @author Mark Peters <address@hidden>
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: hook_manual.inc.php,v 1.4 2005/04/09 22:36:30 ceb Exp $
+       * @version $Id: hook_manual.inc.php,v 1.5 2006/12/05 19:40:45 sigurdne 
Exp $
+       * $Source: /sources/phpgroupware/projects/inc/hook_manual.inc.php,v $
        */
 
 // Only Modify the $file variable.....

Index: inc/hook_preferences.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/hook_preferences.inc.php,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- inc/hook_preferences.inc.php        27 Nov 2006 15:00:08 -0000      1.30
+++ inc/hook_preferences.inc.php        5 Dec 2006 19:40:45 -0000       1.31
@@ -1,12 +1,12 @@
 <?php
        /**
-       * Project Manager - Preferences
+       * Project Manager - Project Prefs 
        *
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: hook_preferences.inc.php,v 1.30 2006/11/27 15:00:08 
sigurdne Exp $
+       * @version $Id: hook_preferences.inc.php,v 1.31 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/hook_preferences.inc.php,v $
        */
 
@@ -15,8 +15,8 @@
                $file = Array
                (
                        'Preferences'           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.preferences')),
-                       'Grant Access'          => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'preferences.uiadmin_acl.aclprefs', 'acl_app'=> $appname)),
-                       'Edit categories'       => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'admin.uicategories.index','cats_app'=>'projects','cats_level'=>'True','global_cats'=>'True'))
+                       'Grant Access'    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'preferences.uiaclprefs.index','acl_app'=>$appname)),
+                       'Edit categories' => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'preferences.uicategories.index','cats_app'=>'projects','cats_level'=>'True','global_cats'=>'True'))
                );
 
                $pro_soconfig = CreateObject('projects.soconfig');
@@ -31,7 +31,7 @@
                        unset($pro_soconfig);
                }
 
-               if(isset($afile) && is_array($afile))
+               if(is_array($afile))
                {
                        $file += $afile;
                }

Index: inc/hook_sidebox_menu.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/inc/hook_sidebox_menu.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- inc/hook_sidebox_menu.inc.php       9 Sep 2006 10:38:51 -0000       1.15
+++ inc/hook_sidebox_menu.inc.php       5 Dec 2006 19:40:45 -0000       1.16
@@ -1,115 +1,119 @@
 <?php
        /**
-       * Project Manager - Sidebox-Menu for iDots Template
+       * Project Manager - Sidebox-Menu for idots-template
        *
-       * @author Bettina Gille address@hidden
        * @author Pim Snel <address@hidden>
-       * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package projects
-       * @version $Id: hook_sidebox_menu.inc.php,v 1.15 2006/09/09 10:38:51 
skwashd Exp $
+       * @version $Id: hook_sidebox_menu.inc.php,v 1.16 2006/12/05 19:40:45 
sigurdne Exp $
        * $Source: 
/sources/phpgroupware/projects/inc/hook_sidebox_menu.inc.php,v $
        */
 
        {
                        $boprojects = CreateObject('projects.boprojects');
                        $appname = 'projects';
+                       if( isset($boprojects->siteconfig['show_sidebox']) &&
+                           ($boprojects->siteconfig['show_sidebox'] == 'no')
+                         )
+                       { // skip showing the sidebom
+                               return;
+                       }
 
-                       $file = array();
-
-                       $menu_title = lang('projects');
-                       $file[] = array
-                       (
-                               'text'  => 'Projects',
-                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uiprojects.list_projects', 'action' => 'mains') )
-                       );
-                       $file[] = array
-                       (
-                               'text'  => 'Sub projects',
-                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uiprojects.list_projects', 'action' => 'subs') )
-                       );
-                       $file[] = array
-                       (
-                               'text'  => 'Work hours',
-                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uiprojecthours.list_projects', 'action' => 'mains') )
-                       );
+/* Not yet ready
+                       switch ($_REQUEST['menuaction'])
+                       {
+                               case 'projects.uiprojects.list_projects':
+                               $actionmenu = true;
+                               $action_entry[] = array('text'  => 'New 
Project',
+                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.edit_project')));
 
-                       display_sidebox($appname,$menu_title,$file);
-                       unset($file);
+                               if(!$_REQUEST['project_id'] && 
$_REQUEST['pro_main'])
+                               {
+                                       $_REQUEST['project_id'] = 
$_REQUEST['pro_main'];
+                               }
+                               if($_REQUEST['project_id'])
+                               {
+                                       $action_entry[] = array('text'  => 'add 
work hours',
+                                                                               
        'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.edit_hours','project_id'=>$_REQUEST['project_id'],'pro_main'=>$_REQUEST['pro_main'])));
+                               }
+                               break;
 
-                       $menu_title = lang('Statistics');
-                       $file[] = array
-                       (
-                               'text'  => 'Gantt Chart',
-                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uistatistics.list_projects', 'view' => 'gantt'))
-                       );
-                       
-                       $file[] = array
-                       (
-                               'text'  => 'Projects per employee',
-                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uistatistics.list_users'))
-                       );
-                       $file[] = array
-                       (
-                               'text'  => 'Employees per project',
-                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uistatistics.list_projects', 'view' => 'user'))
-                       );
-                       $file[] = array
-                       (
-                               'text'  => 'work hours statistic',
-                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uistatistics.list_users_worktimes'))
-                       );
+                               default:        
+                       }
+                       if($actionmenu)
+                       {
+                               $menu_title = lang('Actions');
+                               
display_sidebox($appname,$menu_title,$action_entry);
+                       }
+*/
 
-                       display_sidebox($appname,$menu_title,$file);
-                       unset($file);
+                       $menu_title = lang('Views');
+                       $file[] = array('text'  => 'Projects',
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.list_projects','action'=>'mains')));
+                       $file[] = array('text'  => 'Sub projects',
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.list_projects','action'=>'subs')));
+                       $file[] = array('text'  => 'Work hours',
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.list_projects','action'=>'mains')));
+                       $file[] = array('text'  => 'Controlling Sheet',
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.controlling_sheet')));
+                       $file[] = array('text'  => 'time tracker',
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojecthours.ttracker')));
+                       $file[] = array('text'  => 'Statistics',
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uistatistics.list_projects','action'=>'mains')));
 
                        if ($boprojects->isprojectadmin('pad') || 
$boprojects->isprojectadmin('pmanager'))
                        {
-                               $file = array();
-                               $menu_title = lang('administration');
-
-                               $file[] = array
-                               (
-                                       'text'  => 'Budget',
-                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uiprojects.list_budget', 'action' => 'mains'))
-                               );
+                               $file[] = array('text'  => 'Budget',
+                                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.list_budget','action'=>'mains')));
                                switch($boprojects->siteconfig['accounting'])
                                {
                                        case 'activity':
-                                               $file[] = array
-                                               (
-                                                       'text'  => 'Activities',
-                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uiconfig.list_activities', 'action' => 'act'))
-                                               );
+                                               $file[] = array('text'  => 
'Activities',
+                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_activities','action'=>'act')));
                                                break;
                                        default:
-                                               $file[] = array
-                                               (
-                                                       'text'  => 'Accounting',
-                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'projects.uiconfig.list_employees', 'action' => 'accounting'))
-                                               );
+                                               $file[] = array('text'  => 
'Accounting',
+                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_accounting','action'=>'accounting')));
+                               }
                                }
-
                                display_sidebox($appname,$menu_title,$file);
                                unset($file);
-                       }
 
-                       /*if 
($GLOBALS['phpgw_info']['user']['apps']['preferences'])
+                       $menu_title = lang('Statistics');
+                       $file[] = array('text'  => 'work hours statistics',
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uistatistics.list_users_worktimes')));
+                       $file[] = array('text'  => 'Gantt Chart',
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uistatistics.list_projects')));
+                       $file[] = array('text'  => 'Projects per employee',
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uistatistics.list_users')));
+                       $file[] = array('text'  => 'Employee per project',
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uistatistics.list_projects')));
+
+                       /*if ($boprojects->isprojectadmin('pad') || 
$boprojects->isprojectadmin('pmanager'))
+                       {
+                               $file[] = array('text'  => 'Export 
cost_accounting',
+                                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiprojects.export_cost_accounting'));
+                       }*/
+
+                       display_sidebox($appname,$menu_title,$file);
+
+                       if 
($GLOBALS['phpgw_info']['user']['apps']['preferences'])
                        {
                                $menu_title = lang('Preferences');
                                $pref_file[] = array('text'     => 
'Preferences',
-                                                                       'url'   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiconfig.preferences'));
+                                                                       'url'   
=> 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.preferences')));
                                $pref_file[] = array('text'     => 'Grant 
Access',
-                                                                       'url'   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname));
+                                                                       'url'   
=> 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'preferences.uiaclprefs.index','acl_app'=>$appname)));
                                $pref_file[] = array('text'     => 'Edit 
categories',
-                                                                       'url'   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=projects&cats_level=True&global_cats=True'));
+                                                                       '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'))
                                {
                                        $pref_file[] = array('text'     => 
'Roles',
-                                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiconfig.list_roles&action=role'));
+                                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_roles','action'=>'role')));
                                        $pref_file[] = array('text'     => 
'events',
-                                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiconfig.list_events'));
+                                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_events')));
                                }
                                
display_sidebox($appname,$menu_title,$pref_file);
                        }
@@ -119,19 +123,19 @@
                                $menu_title = lang('Administration');
 
                                $admin_file[] = array('text'    => 'Site 
Configuration',
-                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' 
. $appname));
+                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'admin.uiconfig.index','appname'=>
 $appname)));
                                $admin_file[] = array('text'    => 'managing 
committee',
-                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiconfig.list_admins&action=pmanager'));
+                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_admins','action'=>'pmanager')));
                                $admin_file[] = array('text'    => 'project 
administrators',
-                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiconfig.list_admins&action=pad'));
+                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_admins','action'=>'pad')));
                                $admin_file[] = array('text'    => 'sales 
department',
-                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiconfig.list_admins&action=psale'));
+                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.list_admins','action'=>'psale')));
                                $admin_file[] = array('text'    => 'Global 
Categories',
-                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index&appname='
 . $appname));
+                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'admin.uicategories.index','appname'=>
 $appname)));
                                $admin_file[] = array('text'    => 'edit 
project id help msg',
-                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiconfig.config_proid_help_msg'));
+                                                                               
'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'projects.uiconfig.config_proid_help_msg')));
                                
display_sidebox($appname,$menu_title,$admin_file);
-                       }*/
+                       }
                        
                        unset($boprojects);
        }

Index: setup/default_records.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/setup/default_records.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- setup/default_records.inc.php       9 Apr 2005 22:36:30 -0000       1.2
+++ setup/default_records.inc.php       5 Dec 2006 19:40:45 -0000       1.3
@@ -1,14 +1,14 @@
 <?php
-       /**
-       * Project Manager - Setup
-       *
-       * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @package projects
-       * @subpackage setup
-       * @version $Id: default_records.inc.php,v 1.2 2005/04/09 22:36:30 ceb 
Exp $
-       */
+       
/**************************************************************************\
+       * phpGroupWare - Setup                                                  
   *
+       * http://www.phpgroupware.org                                           
   *
+       * --------------------------------------------                          
   *
+       *  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.                                           
   *
+       
\**************************************************************************/
+       /* $Id: default_records.inc.php,v 1.3 2006/12/05 19:40:45 sigurdne Exp 
$ */
 
        $GLOBALS['phpgw_setup']->oProc->query("INSERT into phpgw_p_events 
(event_name,event_type,event_extra) values('hours 
limit','percent',90)",__LINE__,__FILE__);
        $GLOBALS['phpgw_setup']->oProc->query("INSERT into phpgw_p_events 
(event_name,event_type,event_extra) values('budget 
limit','percent',90)",__LINE__,__FILE__);
@@ -20,3 +20,19 @@
 
        $GLOBALS['phpgw_setup']->oProc->query("INSERT into phpgw_p_events 
(event_name,event_type) values('project 
dependencies','dependencies')",__LINE__,__FILE__);
        $GLOBALS['phpgw_setup']->oProc->query("INSERT into phpgw_p_events 
(event_name,event_type) values('changes of project 
data','dependencies')",__LINE__,__FILE__);
+
+/*
+       $GLOBALS['phpgw_setup']->oProc->query("INSERT into phpgw_p_locmap 
(p_group,p_location,p_locprojnum) values(103,1,'910186')",__LINE__,__FILE__); 
// Hannover
+       $GLOBALS['phpgw_setup']->oProc->query("INSERT into phpgw_p_locmap 
(p_group,p_location,p_locprojnum) values(921,2,'910113')",__LINE__,__FILE__); 
// Berlin
+       $GLOBALS['phpgw_setup']->oProc->query("INSERT into phpgw_p_locmap 
(p_group,p_location,p_locprojnum) values(123,3,'910166')",__LINE__,__FILE__); 
// Frankfurt / Böblingen 739
+       $GLOBALS['phpgw_setup']->oProc->query("INSERT into phpgw_p_locmap 
(p_group,p_location,p_locprojnum) values(719,4,'910360')",__LINE__,__FILE__); 
// Düsseldorf
+       $GLOBALS['phpgw_setup']->oProc->query("INSERT into phpgw_p_locmap 
(p_group,p_location,p_locprojnum) values(224,5,'910476')",__LINE__,__FILE__); 
// München
+       // $GLOBALS['phpgw_setup']->oProc->query("INSERT into phpgw_p_locmap 
(p_group,p_location,p_locprojnum) values(840,6,'')",__LINE__,__FILE__); // 
Hamburg
+*/
+/*
+Hannover D04 01 910186
+Berlin D04 01 910113
+Frankfurt/Böblingen D04 01 910166
+Düsseldorf D04 01 910360
+München D04 01 910476
+*/

Index: setup/phpgw_br.lang
===================================================================
RCS file: /sources/phpgroupware/projects/setup/phpgw_br.lang,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- setup/phpgw_br.lang 22 Feb 2006 06:16:47 -0000      1.4
+++ setup/phpgw_br.lang 5 Dec 2006 19:40:45 -0000       1.5
@@ -1,5 +1,5 @@
 projects       common  br      Projetos
-project administration admin   br      Administração de Projetos
+project administration admin   br      Administração de Projetos
 Account        projects        br      Conta
 Active projects        br      Ativo
 Activities     projects        br      Ativos
@@ -18,11 +18,11 @@
 archive        projects        br      Arquivo
 billed projects        br      Devedor
 Billed only    projects        br      Devedor somente
-Billing        projects        br      Cobrança
-Bookable activities    projects        br      Recursos encomendáveis
-Billable activities    projects        br      Recursos cobráveis
+Billing        projects        br      Cobrança
+Bookable activities    projects        br      Recursos encomendáveis
+Billable activities    projects        br      Recursos cobráveis
 Bill per workunit      projects        br      Fatura por unidade de trabalho
-Budget projects        br      Orçamento
+Budget projects        br      Orçamento
 Calculate      projects        br      Calcular
 Coordinator    projects        br      Coordenador
 Create delivery        projects        br      Criar entrega
@@ -40,10 +40,10 @@
 Delivery %1 has been updated ! projects        br      Entrega %1 foi 
atualizada !
 Edit Activity  projects        br      Editar ativo
 Edit hours     projects        br      Editar horas
-Edit project administrator list        projects        br      Editar Lista de 
administração de projetos
+Edit project administrator list        projects        br      Editar Lista de 
administração de projetos
 Edit project   projects        br      Editar Projetos
 Edit project hours     projects        br      Editar horas do projetos
-Employee       projects        br      Funcionário
+Employee       projects        br      Funcionário
 Generate Delivery ID ? projects        br      Gerar ID de entrega ?
 Generate Project ID ?  projects        br      Gerar ID do projeto ?
 Generate Invoice ID ?  projects        br      Gerar ID da fatura ?
@@ -57,7 +57,7 @@
 Invoice %1 has been updated !  projects        br      Fatura %1 foi 
atualizada !
 Job    projects        br      Trabalho
 Job date       projects        br      Data do Trabalho
-Job description        projects        br      Descrição do Trabalho
+Job description        projects        br      Descrição do Trabalho
 Job has been added !   projects        br      Horas foram adicionadas !
 Job has been updated ! projects        br      Horas foram adicionadas !
 Job list       projects        br      Lista de trabalhos
@@ -66,56 +66,56 @@
 Minutes per workunit   projects        br      Minutos por unidade de trabalho
 net    projects        br      rede
 New project    projects        br      Novo projeto
-Nonactive      projects        br      Não ativo
-Number projects        br      Número
+Nonactive      projects        br      Não ativo
+Number projects        br      Número
 open   projects        br      Abrir
-Overall        projects        br      Marcação
+Overall        projects        br      Marcação
 per    projects        br      per
 per workunit   projects        br      por unidade de trabalho
 Please enter an ID !   projects        br      Por favor entre com um 
identificador !
 Please enter a remark !        projects        br      Por favor entre com uma 
nota !
 Please enter the bill per workunit !   projects        br      Por favor entre 
com um valor para uma unidade de trabalho !
 Please enter the minutes per workunit !        projects        br      Por 
favor entre com os minutos para cada unidade de trabalho !
-Position       projects        br      Posição
+Position       projects        br      Posição
 Print delivery projects        br      Imprimir entrega
 Print invoice  projects        br      Imprimir fatura
 Project        projects        br      Projeto
-Project administration projects        br      Administração de Projetos
+Project administration projects        br      Administração de Projetos
 Project archive        projects        br      Lista de projetos
 Project billing        projects        br      Fatura do projeto
 Project delivery       projects        br      Entrega do projeto
 Project ID     projects        br      ID do projeto
 Project list   projects        br      Lista de projetos
 Project name   projects        br      Nome do projeto
-Project preferences    projects        br      Preferência de Projetos
-Project statistic      projects        br      Estatística do projeto
-project statistics     projects        br      Estatísticas do projeto
+Project preferences    projects        br      Preferência de Projetos
+Project statistic      projects        br      Estatística do projeto
+project statistics     projects        br      Estatísticas do projeto
 Remark projects        br      Nortas
 Remark required        projects        br      Notas requeridos
 Select project projects        br      Selecione um projeto
 Select tax for workhours       projects        br      Selecione uma taxa para 
horas de trabalho
-Select users   projects        br      Selecione usuários
+Select users   projects        br      Selecione usuários
 Select groups  projects        br      Selecione grupos
-Select your address    projects        br      Selecione seu endereço
-Statistic      projects        br      Estatística
-Statistics     projects        br      Estatísticas
-Short description      projects        br      Descrição rápida
+Select your address    projects        br      Selecione seu endereço
+Statistic      projects        br      Estatística
+Statistics     projects        br      Estatísticas
+Short description      projects        br      Descrição rápida
 Sum    projects        br      Som
 Sum workunits  projects        br      Soma de unidades de trabalho
 tax    projects        br      taxa
-That ID has been used already !        projects        br      Esse ID já 
está sendo usado !
+That ID has been used already !        projects        br      Esse ID já está 
sendo usado !
 Update invoice projects        br      Atualizar fatura
 Update delivery        projects        br      Atualizar entrega
-Username / Group       projects        br      Usuários / Grupo
-User statistic projects        br      Estatística dos usuários
-user statistics        projects        br      Estatísticas dos usuários
+Username / Group       projects        br      Usuários / Grupo
+User statistic projects        br      Estatística dos usuários
+user statistics        projects        br      Estatísticas dos usuários
 View job       projects        br      Ver Trabalho
 View project   projects        en      View project
 Work date      projects        br      Data de trabalho
 Work time      projects        br      Tempo de trabalho
 Workunit       projects        br      Unidade de Trabalho
 Workunits      projects        br      Unidades de Trabalho
-You have entered an invalid start date !       projects        br      Você 
entrou com uma data de ínicio inválida !
-You have entered an invalid end date ! projects        br      Você entrou 
com uma data de finalização inválida !
-You have no customer selected !        projects        br      Você não tem 
clientes selecionados !
-You have to CREATE a delivery or invoice first !       projects        br      
Você deve criar uma ENTREGA ou uma fatura antes !
+You have entered an invalid start date !       projects        br      Você 
entrou com uma data de ínicio inválida !
+You have entered an invalid end date ! projects        br      Você entrou com 
uma data de finalização inválida !
+You have no customer selected !        projects        br      Você não tem 
clientes selecionados !
+You have to CREATE a delivery or invoice first !       projects        br      
Você deve criar uma ENTREGA ou uma fatura antes !

Index: setup/phpgw_da.lang
===================================================================
RCS file: /sources/phpgroupware/projects/setup/phpgw_da.lang,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- setup/phpgw_da.lang 22 Feb 2006 06:20:34 -0000      1.3
+++ setup/phpgw_da.lang 5 Dec 2006 19:40:45 -0000       1.4
@@ -2,14 +2,14 @@
 Activities list        projects        da      Aktivitets liste
 Activity       projects        da      Aktivitet
 Activity ID    projects        da      Aktivitets ID
-Add Activity   projects        da      Tilføj aktivitet
-Add hours      projects        da      Tilføj timer
-Add project    projects        da      Tilføj projekt
-Add project hours      projects        da      Tilføj projekt timer
+Add Activity   projects        da      Tilføj aktivitet
+Add hours      projects        da      Tilføj timer
+Add project    projects        da      Tilføj projekt
+Add project hours      projects        da      Tilføj projekt timer
 All delivery notes     projects        da      Alle leverings noter
 All done hours projects        da      Alle brugte timer
 All invoices   projects        da      Alle fakturaer
-All open hours projects        da      Alle åbne timer
+All open hours projects        da      Alle åbne timer
 Bill per workunit      projects        da      Tarif pr arbejdsenhed
 Billable activities    projects        da      Fakturerbare aktiviteter
 Billed projects        da      Fakturerede projekter
@@ -26,8 +26,8 @@
 Delivery list   projects        da      Leveringsliste
 Delivery note   projects        da      Leveringsnota
 Edit hours      projects        da      Rediger timer
-Edit project    projects        da      Redigér projekt
-Edit project hours      projects        da      Redigér projekt timer
+Edit project    projects        da      Redigér projekt
+Edit project hours      projects        da      Redigér projekt timer
 Employee       projects        da      Medarbejder
 Hours   projects       da      Timer
 Invoice projects       da      Faktura
@@ -52,14 +52,14 @@
 Project preferences    common  da      Projekt preferencer
 projects       common  da      Projekter
 Project statistic      projects        da      Projekt statistik
-Remark  projects       da      Bemærkning
-Remark required projects       da      Bemærkning er krævet
-Select customer projects       da      Vælg kunde
-Select tax for work hours      projects        da      Vælg afgift for 
arbejdstimer
-Select your address    projects        da      Vælg Din adresse
+Remark  projects       da      Bemærkning
+Remark required projects       da      Bemærkning er krævet
+Select customer projects       da      Vælg kunde
+Select tax for work hours      projects        da      Vælg afgift for 
arbejdstimer
+Select your address    projects        da      Vælg Din adresse
 Statistic      projects        da      Statistik
 Sum    projects        da      Sum
 User statistic  projects       da      Bruger statistik
 User statistics projects       da      Bruger statistikker
 You have selected an invalid activity  projects        da      Du har valgt en 
ugyldig aktivitet
-You have to enter a remark     projects        da      Du skal skrive en 
bemærkning
+You have to enter a remark     projects        da      Du skal skrive en 
bemærkning

Index: setup/phpgw_de.lang
===================================================================
RCS file: /sources/phpgroupware/projects/setup/phpgw_de.lang,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- setup/phpgw_de.lang 1 Oct 2006 13:46:33 -0000       1.45
+++ setup/phpgw_de.lang 5 Dec 2006 19:40:45 -0000       1.46
@@ -2,76 +2,82 @@
 % from projects        de      % vom
 accounting     common  de      Abrechnung
 accounting factor      projects        de      Abrechnungsfaktor
-accounting factor for project  projects        de      Abrechnungsfaktor für 
Projekt
+accounting factor for project  projects        de      Abrechnungsfaktor für 
Projekt
 accounting system      projects        de      Abrechnungsart
 Actions        projects        de      Aktionen
 active projects        de      Aktiv
-activities     projects        de      Tätigkeiten
-activity       projects        de      Tätigkeit
-activity reports       projects        de      Tätigkeitsberichte
-activity report generated      projects        de      Tätigkeitsbericht 
wurde generiert
-activity %1 has been added     projects        de      Tätigkeit %1 wurde 
hinzugefügt.
-activity %1 has been updated   projects        de      Tätigkeit %1 wurde 
überarbeitet.
-activity id    projects        de      Tätigkeits-ID
+activities     projects        de      Tätigkeiten
+activity       projects        de      Tätigkeit
+activity reports       projects        de      Tätigkeitsberichte
+activity report generated      projects        de      Tätigkeitsbericht wurde 
generiert
+activity %1 has been added     projects        de      Tätigkeit %1 wurde 
hinzugefügt.
+activity %1 has been updated   projects        de      Tätigkeit %1 wurde 
überarbeitet.
+activity id    projects        de      Tätigkeits-ID
+Activity reports for   projects        de      Tätigkeitsberichte für
 Actual projects        de      Ist
-add activity   projects        de      Tätigkeit hinzufügen
-add factor     projects        de      Faktor hinzufügen
-add sub project        projects        de      Unterprojekt hinzufügen
-add milestone  projects        de      Meilenstein hinzufügen
-add project    projects        de      Projekt hinzufügen
-add role       projects        de      Rolle hinzufügen
-add work hours projects        de      Arbeitsstunden hinzufügen
-add work hours to the main project     projects        de      Arbeitsstunden 
hinzufügen
+adapt  projects        de      Ãœbernehmen
+add activity   projects        de      Tätigkeit hinzufügen
+add factor     projects        de      Faktor hinzufügen
+add sub project        projects        de      Unterprojekt hinzufügen
+add milestone  projects        de      Meilenstein hinzufügen
+add project    projects        de      Projekt hinzufügen
+add role       projects        de      Rolle hinzufügen
+add work hours projects        de      Arbeitsstunden hinzufügen
+add work hours to the main project     projects        de      Arbeitsstunden 
hinzufügen
 view work hours of the main project    projects        de      Arbeitsstunden 
anzeigen
 administrator  projects        de      Administrator
 administrator list     projects        de      Administrator Liste
 alarm  projects        de      Benachrichtigung
-All correct hours in uploaded CSV file will be added to your account   
projects        de      Alle gültigen Arbeitsstunden in der hochgeladenen 
CSV-Datei werden zu Ihrem Konto hinzugefügt.
+All correct hours in uploaded CSV file will be added to your account.  
projects        de      Alle gültigen Arbeitsstunden in der hochgeladenen 
CSV-Datei werden zu Ihrem Konto hinzugefügt.
 All Organizations      common  de      Alle Organisationen
 amount projects        de      Betrag
-anonymous public       projects        de      Anonym öffentlich
+anonymous public       projects        de      Anonym öffentlich
 archive        projects        de      Archiv
-are you sure you want to delete this activity  projects        de      Sind 
Sie sicher, dass Sie diese Tätigkeit löschen wollen?
-are you sure you want to delete this project   projects        de      Sind 
Sie sicher, dass Sie dieses Projekt löschen wollen?
-Are you sure you want to make this entry editable?     projects        de      
Sind Sie sicher, dass Sie diese gebuchte Tätigkeit zum Editieren freigeben 
wollen?
-Activity already booked!       projects        de      Diese Tätigkeit ist 
gebucht!
+are you sure you want to delete this activity  projects        de      Sind 
Sie sicher, dass Sie diese Tätigkeit löschen wollen?
+are you sure you want to delete this job       projects        de      Sind 
Sie sicher, dass Sie diesen Job löschen wollen?
+are you sure you want to delete this project   projects        de      Sind 
Sie sicher, dass Sie dieses Projekt löschen wollen?
+Are you sure you want to make this entry editable?     projects        de      
Sind Sie sicher, dass Sie diese gebuchte Tätigkeit zum Editieren freigeben 
wollen?
+Activity already booked!       projects        de      Diese Tätigkeit ist 
gebucht!
 assign projects        de      Zuordnen
 assign roles and events        projects        de      Rollen und Ereignisse 
zuordnen
-assignment has been deleted    projects        de      Zuordnung wurde 
gelöscht.
+assignment has been deleted    projects        de      Zuordnung wurde 
gelöscht.
 assignment has been saved      projects        de      Zuordnung wurde 
gespeichert.
 assignment to project  projects        de      Zuordnung zu Projekt
 assignment to project %1       projects        de      Zuordnung zu Projekt %1
 assignment to role     projects        de      Zuordnung zu Rolle
-attach file    projects        de      Datei anhängen
-available      projects        de      Verfügbar
+attach file    projects        de      Datei anhängen
+available      projects        de      Verfügbar
 before projects        de      vor
 Begin  projects        de      Beginn
 bill per hour  projects        de      Preis pro Stunde
 bill per hour/workunit projects        de      Preis pro Stunde/Arbeitseinheit
 bill per workunit      projects        de      Preis pro Arbeitseinheit
 billable       projects        de      Abrechenbar
-billable activities    projects        de      Abrechenbare Aktivitäten
+billable activities    projects        de      Abrechenbare Aktivitäten
 billed projects        de      Bezahlt
 billed only    projects        de      nur bezahlte
-bookable activities    projects        de      Buchbare Aktivitäten
+bookable activities    projects        de      Buchbare Aktivitäten
 booked projects        de      gebucht
-booking workhours on the specified work day of a month common  de      
Arbeitsstunden am eingestellten Werktag eines Monats buchen
+booking workhours on the specified work day of a month admin   de      
Arbeitsstunden am eingestellten Werktag eines Monats buchen
+budget can not be lesser then 0        projects        de      Das Budget darf 
nicht kleiner 0 sein.
 budget can not be lesser then budget sum of all sub projects   projects        
de      Das Budget darf nicht kleiner sein als die Budget-Summe aller 
Unterprojekte.
 budget projects        de      Budget
 budget limit   projects        de      Budget Limit
 budget planned projects        de      Geplantes Budget
-budget sum of all sub projects is bigger than the budget of the main project   
projects        de      Das Budget ist grö&szlig;er als das verfügbare Budget 
des Hauptprojektes.
+budget is bigger than the budget of the parent project projects        de      
Das Budget ist grö&szlig;er als das verfügbare Budget des übergeordneten 
Budgets.
 budget type    projects        de      Budget Art
 calculate      projects        de      Berechnen
-changed start date and end date        projects        de      Start- und 
Enddatum wurden geändert.
-changed start date and end date of projects bellow     projects        de      
Start- und Enddatum der im Folgenden aufgelisteten Projekte wurden geändert.
-changes of project data        projects        de      Änderungen von 
Projektdaten
+categorie required     admin   de      Kategorie-Auswahl als Pflichtfeld 
verwenden
+cc-reciever (separating through commas)        projects        de      
CC-Empf&auml;ger (mehrere durch Kommata getrennt)
+changed start date and end date        projects        de      Start- und 
Enddatum wurden geändert.
+changed start date and end date of projects bellow     projects        de      
Start- und Enddatum der im Folgenden aufgelisteten Projekte wurden geändert.
+changes of project data        projects        de      Änderungen von 
Projektdaten
 closed projects        de      Abgeschlossen
-close window   projects        de      Fenster schließen
+close window   projects        de      Fenster schließen
 color legend   projects        de      Farblegende
 columns to show in the controlling sheet       projects        de      Spalten 
zum Anzeigen im Controlling Sheet
-config workhours booking       common  de      Konfiguration Arbeitsstunden 
buchen
-config worktime warnmail       projects        de      Mailbenachrichtigung 
bei unvollständiger Zeiterfassung konfigurieren
+config workhours booking       admin   de      Konfiguration Arbeitsstunden 
buchen
+config worktime warnmail       projects        de      Mailbenachrichtigung 
bei unvollständiger Zeiterfassung konfigurieren
 continue       projects        de      Fortsetzen
 controlling    projects        de      Zeiterfassung
 controlling sheet      projects        de      Controlling Blatt
@@ -81,128 +87,152 @@
 Current Organizations  common  de      Aktuelle Organisation
 customer       projects        de      Kunde
 customer nr    projects        de      Kunden-Nr.
+customer version       projects        de      Kunden-Version
+customer version id    projects        de      Kunden-Version ID
 Date   projects        de      Datum
 date created   projects        de      Erstellungs-Datum
-date due of milestone %1 of project %2 has been updated        projects        
de      Fälligkeit des Meilensteines %1 von Projekt %2 wurde geändert.
+date due of milestone %1 of project %2 has been updated        projects        
de      Fälligkeit des Meilensteines %1 von Projekt %2 wurde geändert.
 date due planned       projects        de      Geplantes Enddatum
 days   projects        de      Tage
 days before    projects        de      Tage vor
 Debit  projects        de      Soll
 Default Organizations  common  de      Standard Organisation
 definition per project admin   de      Definition per Projekt
-delete factor  projects        de      Faktor löschen
-delete hours   projects        de      Stunden löschen
-delete surcharge       projects        de      Aufschlag löschen
-delete work hours      projects        de      Arbeitsstunden löschen
-description can not exceed 8000 characters in length   projects        de      
Beschreibung darf 8000 Zeichen nicht überschreiten.
-Description can not exceed 250 characters in length    projects        de      
Die Bezeichnung der Tätigkeit darf nicht mehr als 250 Zeichen enthalten.
-Description was not set        projects        de      Die Bezeichnung der 
Tätigkeit fehlt.
+delete factor  projects        de      Faktor löschen
+delete hours   projects        de      Stunden löschen
+delete surcharge       projects        de      Aufschlag löschen
+delete work hours      projects        de      Arbeitsstunden löschen
+empty employee list    projects        de      Mitarbeiter-Liste leeren
+description can not exceed 8000 characters in length   projects        de      
Beschreibung darf 8000 Zeichen nicht überschreiten.
+Description can not exceed 250 characters in length    projects        de      
Die Bezeichnung der Tätigkeit darf nicht mehr als 250 Zeichen enthalten.
+Description was not set        projects        de      Die Bezeichnung der 
Tätigkeit fehlt.
 discount       projects        de      Rabatt
 distance       projects        de      Entfernung
-Do you also want to delete all sub projects ?  projects        de      Wollen 
Sie auch alle Unterprojekte löschen?
-edateout       projects        de      fällig am
-edit activity  projects        de      Tätigkeit überarbeiten
+Duration       projects        de      Dauer
+Do you also want to delete all sub projects ?  projects        de      Wollen 
Sie auch alle Unterprojekte löschen?
+documentation  projects        de      Dokumentation
+edateout       projects        de      fällig am
+edit activity  projects        de      Tätigkeit überarbeiten
 Edit administrator list        projects        de      Administratorliste 
bearbeiten
 edit events    projects        de      Ereignisse bearbeiten
 edit factor    projects        de      Faktor bearbeiten
 edit hours     projects        de      Stunden bearbeiten
-edit recipients        common  de      Ausgewählte Personen
-edit salesmen list     projects        de      Liste der Verkäufer bearbeiten
+edit locations common  de      Standorte bearbeiten
+edit recipients        common  de      Ausgewählte Personen
+edit salesmen list     projects        de      Liste der Verkäufer bearbeiten
+edit job       projects        de      Job bearbeiten
 edit manager list      projects        de      Liste der Vorstandsmitglieder 
bearbeiten
 edit milestones        projects        de      Meilensteine bearbeiten
 edit project   projects        de      Projekt bearbeiten
+edit project id help msg       common  de      Popup-Fenster für Projekt-Nr. 
konfigurieren
 edit roles and events  projects        de      Rollen und Ereignisse bearbeiten
 edit surcharge projects        de      Aufschlag bearbeiten
-edit surcharges        projects        de      Aufschläge bearbeiten
+edit surcharges        projects        de      Aufschläge bearbeiten
 edit work hours        projects        de      Arbeitsstunden bearbeiten
 employee       projects        de      Mitarbeiter
+employee without entry common  de      Mitarbeiter ohne Eintrag
 employees      projects        de      Mitarbeiter
 Employee per project   projects        de      Mitarbeiter pro Projekt
 Enable detail preview  common  de      Vorschau aktivieren
 End    projects        de      Ende
-end date has changed   projects        de      Enddatum wurde geändert
-end date can not be after parent projects date due     projects        de      
Enddatum kann nicht hinter dem Enddatum des übergeordneten Projektes liegen.
-end date planned can not be after parent projects end date planned     
projects        de      Geplantes Enddatum kann nicht hinter dem geplanten 
Enddatum des übergeordneten Projektes liegen.
+end date has changed   projects        de      Enddatum wurde geändert
+end date can not be after parent projects date due     projects        de      
Enddatum kann nicht hinter dem Enddatum des übergeordneten Projektes liegen.
+end date planned can not be after parent projects end date planned     
projects        de      Geplantes Enddatum kann nicht hinter dem geplanten 
Enddatum des übergeordneten Projektes liegen.
 end date can not be after projects date due    projects        de      
Enddatum kann nicht hinter dem Enddatum des Projektes liegen.
 end date can not be before start date  projects        de      Startdatum kann 
nicht hinter dem Enddatum liegen.
 end time can not be before start time  projects        de      Startzeit kann 
nicht hinter der Endzeit liegen.
+end date can not be before sub projects end date       projects        de      
Enddatum kann nicht vor dem Enddatum eines Unterprojekts liegen.
 error while uploading file     projects        de      Fehler beim Hochladen 
der Datei
 Export cost_accounting projects        de      Exportiere Kostenberechnung
 Export Sheet   projects        de      Exportieren
-work time can not be bigger then time between start time and end time  
projects        de      Die Arbeitszeit kann nicht größer sein als die Zeit 
zwischen Start- und Endzeit.
+work time can not be bigger then time between start time and end time  
projects        de      Die Arbeitszeit kann nicht größer sein als die Zeit 
zwischen Start- und Endzeit.
 work time must be during project time  projects        de      Die Arbeitszeit 
muss in der Projektlaufzeit liegen.
 end date planned can not be before start date planned  projects        de      
Geplantes Startdatum kann nicht hinter dem geplanten Enddatum liegen.
 entry  projects        de      Eintrag
-event  projects        de      Einträge
-event extra has been saved     projects        de      Extra Einträge wurden 
gespeichert
+event  projects        de      Einträge
+event extra has been saved     projects        de      Extra Einträge wurden 
gespeichert
 events common  de      Ereignisse
 exact accounting [hh.mm]       admin   de      Exakte Abrechnung [hh.mm]
 external reference     projects        de      Externe Referenz
 extra budget   projects        de      Extra Budget
-extra budget sum of all sub projects is bigger than the extra budget of the 
main project       projects        de      Das Extra Budget ist grö&szlig;er 
als das verfügbare Extra Budget des Hauptprojektes.
+extra budget can not be lesser then 0  projects        de      Das Extra 
Budget darf nicht kleiner 0 sein.
+extra budget can not be lesser then extra budget sum of all sub projects       
projects        de      Das Extra Budget darf nicht kleiner als die Summe des 
Extra Budgets aller Unterprojekte sein.
+extra budget is bigger than the extra budget of the parent project     
projects        de      Das Extra Budget ist grö&szlig;er als das verfügbare 
Extra Budget des übergeordneten Projekts.
 export diamant accounting      projects        de      Diamant Abrechnung 
exportieren
 factor employee        projects        de      Faktor Mitarbeiter
 factor project projects        de      Faktor Projekt
 factor has been saved  projects        de      Faktor wurde gespeichert.
-factor has been deleted        projects        de      Faktor wurde gelöscht.
-found no data for import       projects        de      Für den Import wurden 
keine Daten gefunden
+factor has been deleted        projects        de      Faktor wurde gelöscht.
+fade in/blind out sum  projects        de      Summe aus-/einblenden
+Filename       projects        de      Dateiname
+Forward        projects        de      Weiter
+found no data for import       projects        de      Für den Import wurden 
keine Daten gefunden
 from   projects        de      Von
 gantt chart    projects        de      Gantt Chart
 gantt chart from %1 to %2      projects        de      Gantt Chart von %1 bis 
%2
-generate activity id   projects        de      Activitäts ID generieren ?
-generate activity report       projects        de      Tätigkeitsbericht 
generieren
+generate automatically admin   de      automatisch generieren
+generate activity id   projects        de      Activitäts ID generieren ?
+generate activity report       projects        de      Tätigkeitsbericht 
generieren
 generate project id    projects        de      Projekt-Nr. generieren ?
 global categories      projects        de      Globale Kategorien
 has reached    projects        de      wurde erreicht
 hours  projects        de      Stunden
 hours limit    projects        de      Stunden Limit
 hours of work day      admin   de      Anzahl der Stunden eines Arbeitstages
-id can not exceed 250 characters in length     projects        de      
Projekt-Nr. darf 250 Zeichen nicht überschreiten.
-if using activities    admin   de      Wenn Tätigkeiten benutzt werden
-if you are an administrator, please edit the site configuration for projects 
in the admin section      projects        de      Sind Sie ein Administrator, 
bearbeiten Sie bitte die Konfiguration für Projekte in der Admin Sektion.
+how to create project number   admin   de      Generierung der Projekt-Nr.
+id can not exceed 250 characters in length     projects        de      
Projekt-Nr. darf 250 Zeichen nicht überschreiten.
+if using activities    admin   de      Wenn Tätigkeiten benutzt werden
+if you are an administrator, please edit the site configuration for projects 
in the admin section      projects        de      Sind Sie ein Administrator, 
bearbeiten Sie bitte die Konfiguration für Projekte in der Admin Sektion.
 if you are not an administrator, please inform the administrator to configure 
projects projects        de      Sind Sie kein Administrator, informieren Sie 
bitte den Administrator zum Konfigurieren der Projekte Anwendung .
 import controlling sheet       projects        de      Controlling Sheet 
importieren
 Import Sheet   projects        de      Importieren
 imported       projects        de      Importiert
 imported hours projects        de      Importierte Arbeitsstunden
 imported hours on      projects        de      Importierte Arbeitsstunden am
+insert parent employees        projects        de      Mitarbeiter vom 
übergeordneten Projekt übernehmen
 investment nr  projects        de      Referenz-Nr.
 invoicing method       projects        de      Anmerkungen zur Abrechnung      
 invoicing of work time admin   de      Arbrechnung von Arbeitszeit
-It will NOT check if you already have uploaded hours for a certain day 
projects        de      Es wird NICHT geprüft, ob Sie bereits Arbeitsstunden 
für einen bestimmten Tag hochgeladen haben.
+It will NOT check if you already have uploaded hours for a certain day.        
projects        de      Es wird NICHT geprüft, ob Sie bereits Arbeitsstunden 
für einen bestimmten Tag hochgeladen haben.
 large  projects        de      Gro&szlig;
 last update    projects        de      letzte Aktualisierung
-list activities        projects        de      Tätigkeitenliste
+list activities        projects        de      Tätigkeitenliste
 list budget    projects        de      Budgetliste
 list projects  projects        de      Projektliste
 list work hours        projects        de      Arbeitsstundenliste
 live mode      projects        de      Live Modus
+location       common  de      Standort
+location deleted       common  de      Standort gelöscht
+location ident exists  common  de      ID des Standorts existiert bereits!
+location saved common  de      Standort gespeichert
 main project   projects        de      Hauptprojekt
 manager        projects        de      Vorstandsmitglied
 managing committee     common  de      Vorstand
 manager list   projects        de      Liste der Vorstandsmitglieder
-manuell entries        projects        de      Manuelle Einträge
+manuell entries        projects        de      Manuelle Einträge
 manual mode    projects        de      Manueller Modus
+manually show help msg admin   de      manuell - Popup-Fenster für Projekt-Nr.
 milestone      projects        de      Meilenstein
 milestones     common  de      Meilensteine
 milestone date can not be after projects date due      projects        de      
Datum des Meilensteines kann nicht hinter dem Enddatum des Projektes liegen.
 milestone date can not be before projects date due     projects        de      
Datum des Meilensteines kann nicht vor dem Startdatum des Projektes liegen.
-milestone date due     projects        de      Fälligkeit des Meilensteins
-milestone has been deleted     projects        de      Meilenstein wurde 
gelöscht.
+milestone date due     projects        de      Fälligkeit des Meilensteins
+milestone has been deleted     projects        de      Meilenstein wurde 
gelöscht.
 milestone has been saved       projects        de      Meilenstein wurde 
gespeichert.
 minutes per workunit   projects        de      Minuten pro Arbeitseinheit
-monetary       projects        de      monetär
+monetary       projects        de      monetär
 month  projects        de      Monat
-move start date if pervious projects end date changes  admin   de      
Startdatum verschieben, wenn sich das Enddatum des vorausgehenden Projektes 
ändert
-new date due of milestone %1: %2       projects        de      Neuer 
Fälligkeitstermin des Meilensteines %1: %2.
+move start date if pervious projects end date changes  admin   de      
Startdatum verschieben, wenn sich das Enddatum des vorausgehenden Projektes 
ändert
+new date due of milestone %1: %2       projects        de      Neuer 
Fälligkeitstermin des Meilensteines %1: %2.
 new end date   projects        de      Neues Enddatum
 new milestone  projects        de      Neuer Meilenstein
 new start date projects        de      Neues Startdatum
 new surcharge  projects        de      neuer Aufschlag
 new project    projects        de      Neues Projekt
+new report     projects        de      Neuer Bericht
 no discount    projects        de      Kein Rabatt
-no activities in this period!  projects        de      Keine Tätigkeiten im 
angegebenen Zeitraum!
-no file selected       projects        de      Keine Datei ausgewählt
+no activities in this period!  projects        de      Keine Tätigkeiten im 
angegebenen Zeitraum!
+no file selected       projects        de      Keine Datei ausgewählt
 nonactive      common  de      Nicht aktiv
 not billable   projects        de      nicht abzurechnen
 number projects        de      Nummer
@@ -210,12 +240,12 @@
 old end date   projects        de      Altes Enddatum
 old start date projects        de      Altes Startdatum
 open   projects        de      Offen
-open popup window      projects        de      Popup Fenster öffnen
+open popup window      projects        de      Popup Fenster öffnen
 orga   projects        de      Organisation
-Organizations Data for common  de      Organisations Daten für 
+Organizations Data for common  de      Organisations Daten für 
 overall        projects        de      Gesammt
-Overtime       projects        de      Überstunden
-parent project projects        de      Übergeordnetes Projekt
+Overtime       projects        de      Ãœberstunden
+parent project projects        de      Ãœbergeordnetes Projekt
 pause  projects        de      Pause
 per day        projects        de      pro Tag
 per hour       projects        de      pro Stunde
@@ -223,25 +253,36 @@
 per workunit   common  de      pro Arbeitseinheit
 percent        projects        de      Prozent
 period projects        de      Zeitraum
+permit booking of hours for more than one day  admin   de      mehr als ein 
Tag pro Buchung erlauben
+permit booking of hours with null values       admin   de      Buchung mit 0 
Stunden erlauben
+permit double project id       admin   de      Hauptprojekte mit gleichen 
Projekt-Nr. erlauben
 person common  de      Person
+Posible workhours      projects        de      Mögliche Arbeitsstunden
 pre filter     common  de      Filter
 private        projects        de      Projektleiter
 planned        projects        de      Geplant
 plan bottom up projects        de      Bottom-Up Planung
-please select a project for time tracking      projects        de      Bitte 
ein Projekt zum Zeiterfassen wählen!
+please select a project for time tracking      projects        de      Bitte 
ein Projekt zum Zeiterfassen wählen!
+please select a categorie for the project      projects        de      Bitte 
eine Kategorie für das Projekt wählen!
+please insert a location name  projects        de      Bitte geben Sie einen 
Namen für den Standort an!
+Please choose details for your new activity report     projects        de      
Bitte wählen Sie die Details für den neuen Tätigkeitsbericht
 public projects        de      Projektmitglieder
-direct work    projects        de      direkte Tätigkeiten
-indirect work  projects        de      indirekte Tätigkeiten
-planned start date can not be after sub projects planned start date    
projects        de      Das geplante Startdatum kann nicht nach dem Startdatum 
eines Unterprojektes liegen.
+direct work    projects        de      direkte Tätigkeiten
+indirect work  projects        de      indirekte Tätigkeiten
+planned end date can not be before sub projects planned end date       
projects        de      Geplantes Enddatum kann nicht vor dem geplanten 
Enddatum eines Unterprojekts liegen.
+planned start date can not be after sub projects planned start date    
projects        de      Geplantes Startdatum kann nicht hinter dem geplanten 
Startdatum des Unterprojektes liegen.
+planned time can not be lesser then 0  projects        de      Die geplante 
Zeit darf nicht kleiner 0 sein.
 planned time can not be lesser then planned time sum of all sub projects       
projects        de      Die geplante Zeit darf nicht geringer sein als die 
Summe der geplanten Zeiten aller Unterprojekte.
-planned time sum of all sub projects is bigger than the planned time of the 
main project       projects        de      Die geplante Zeit ist grö&szlig;er 
als die verfügbare geplante Zeit des Hauptprojektes.
+planned time is bigger than the planned time of the parent project     
projects        de      Die geplante Zeit ist grö&szlig;er als die verfügbare 
geplante Zeit des übergeordneten Projekts.
 Please beware  projects        de      Bitte beachten Sie
-please choose a project coordinator    projects        de      Bitte wählen 
Sie einen Projektleiter.
-please choose activities for the project       projects        de      Bitte 
wählen Sie Tätigkeiten für das Projekt.
+please choose a project coordinator    projects        de      Bitte wählen 
Sie einen Projektleiter.
+please choose activities for the project       projects        de      Bitte 
wählen Sie Tätigkeiten für das Projekt.
 please enter a remark  projects        de      Bitte geben Sie einen Betreff 
an.
-please choose the accounting system for the project    projects        de      
Bitte wählen Sie die Abrechnungsart.
-please choose the columns to list in the projects preferences section  
projects        de      Bitte wählen Sie die Listenspalten in den 
Benutzereinstellungen für Projekte.
-please choose the period:      projects        de      Bitte Zeitraum 
auswählen:
+please enter planned start date        projects        de      Bitte geben Sie 
ein geplantes Start-Datum an.
+please enter planned end date  projects        de      Bitte geben Sie ein 
geplantes End-Datum an.
+please choose the accounting system for the project    projects        de      
Bitte wählen Sie die Abrechnungsart.
+please choose the columns to list in the projects preferences section  
projects        de      Bitte wählen Sie die Listenspalten in den 
Benutzereinstellungen für Projekte.
+please choose the period:      projects        de      Bitte Zeitraum 
auswählen:
 please specify the budget      projects        de      Bitte geben Sie das 
Budget an.
 please specify the date due    projects        de      Bitte geben Sie das 
Enddatum an.
 please enter the work time     projects        de      Bitte geben Sie die 
Arbeitszeit an.
@@ -254,115 +295,136 @@
 please set the cost centre     projects        de      Bitte geben Sie die 
Kostenstelle des Mitarbeiters an.
 please set the start date      projects        de      Bitten geben Sie das 
Startdatum an.
 please set the end date        projects        de      Bitte geben Sie das 
Enddatum an.
-please set the weekly workhours        projects        de      Bitte geben Sie 
die Wochenarbeitsstunden des Mitarbeiters an.
-please specify the currency in the global preferences section  common  de      
Bitte geben Sie die Währung in der globalen Sektion der Benutzereinstellungen 
an.
+please set the weekly workhours        projects        de      Bitte geben Sie 
die Arbeitsstunden pro Woche des Mitarbeiters an.
+please specify the currency in the global preferences section  common  de      
Bitte geben Sie die Währung in der globalen Sektion der Benutzereinstellungen 
an.
 please specify the budget      projects        de      Bitte geben Sie das 
Budget an.
 previous       projects        de      Vorprojekt
 previous project       projects        de      Vorprojekt
-previous projects end date has changed projects        de      Das Enddatum 
des Vorprojektes wurde geändert
+previous projects end date has changed projects        de      Das Enddatum 
des Vorprojektes wurde geändert
 processor      projects        de      Bearbeiter
 progress       projects        de      Fortschritt
-project and activity   projects        de      Projekt und Tätigkeit
-projects and captured activities       projects        de      Projekte und 
erfasste Tätigkeiten
+project and activity   projects        de      Projekt und Tätigkeit
+projects and captured activities       projects        de      Projekte und 
erfasste Tätigkeiten
 project        projects        de      Projekt
 project accounting     admin   de      Projektabrechnung
 project %1 has been saved      projects        de      Projekt %1 wurde 
gespeichert.
 project %1 has been updated    projects        de      Projekt %1 wurde 
bearbeitet.
 project administrators common  de      Projektadministratoren
-project date due       projects        de      Projektfälligkeit 
-project dependencies   common  de      Projektabhängigkeiten
+project date due       projects        de      Projektfälligkeit 
+project dependencies   common  de      Projektabhängigkeiten
 project employees      projects        de      Projektmitglieder
 Projects per employee  projects        de      Projekt pro Mitarbeiter
 project id     common  de      Projekt-Nr.
+project id already exists      projects        de      Für die angegebene 
Projekt-Nr. existiert bereits ein Projekt.
+project team   projects        de      Projekt-Team
 projects       common  de      Projekte
 project management     projects        de      Projektmanagement
 project url    projects        de      Projekt URL
 projects, which are assigned as sequencing     projects        de      
Nachfolgende Projekte
-quality check  projects        de      Qualität
+quality check  projects        de      Qualität
 reference      projects        de      Referenz
-Remark can not exceed 8000 characters in length !      projects        de      
Die Betreff der Tätigkeit darf nicht mehr als 8000 Zeichen enthalten.
+Remark can not exceed 8000 characters in length !      projects        de      
Die Betreff der Tätigkeit darf nicht mehr als 8000 Zeichen enthalten.
 remark projects        de      Betreff
-remark can not exceed 8000 characters in length        projects        en      
Betreff darf 8000 Zeichen nicht überschreiten.
+remark can not exceed 8000 characters in length        projects        en      
Betreff darf 8000 Zeichen nicht überschreiten.
 remark required        projects        de      Betreff notwendig
+remove projects        de      Entfernen
 result projects        de      Resultat
 role   projects        de      Rolle
-role has been deleted  projects        de      Rolle wurde gelöscht
+role has been deleted  projects        de      Rolle wurde gelöscht
 roles  common  de      Rollen
 roles list     projects        de      Rollenliste
 sales department       common  de      Vertrieb
-salesman       projects        de      Verkäufer
-salesmen list  projects        de      Liste der Verkäufer
-save activities        projects        de      Tätigkeiten speichern
+sales manager  projects        de      Vertriebsbeauftragter
+salesman       projects        de      Verkäufer
+salesmen list  projects        de      Liste der Verkäufer
+save activities        projects        de      Tätigkeiten speichern
 save factor    projects        de      Faktor speichern
 save milestone projects        de      Milestone speichern
 save surcharge projects        de      Aufschlag speichern
-send a warning mail at the end of a month if not enough worktime was captured. 
projects        de      Senden einer Mailbenachrichtigung bei unvollständiger 
Zeiterfassung:
+send a warning mail at the end of a month if not enough worktime was captured. 
projects        de      Senden einer Mailbenachrichtigung bei unvollständiger 
Zeiterfassung:
 columns to show in the projects list   projects        de      Spalten zum 
anzeigen in der Projektliste
-select contacts        common  de      Personen auswählen
-select factor  projects        de      Faktor auswählen
-select groups  projects        de      Gruppen auswählen
-select main project    projects        de      Hauptprojekt auswählen
-Select month and year  projects        de      Monat und Jahr auswählen
-select role    projects        de      Rolle auswählen
-select project projects        de      Projekt auswählen
-select repository      common  de      Ressource wählen
-select surcharge       projects        de      Aufschlag auswählen
-select users   projects        de      Benutzer auswählen
+select contacts        common  de      Personen auswählen
+select employees       projects        de      Mitarbeiter hinzufügen ...
+select factor  projects        de      Faktor auswählen
+select groups  projects        de      Gruppen auswählen
+select main project    projects        de      Hauptprojekt auswählen
+Select month, year and location        projects        de      Monat, Jahr und 
Standort auswählen
+select role    projects        de      Rolle auswählen
+select project projects        de      Projekt auswählen
+select repository      common  de      Ressource wählen
+select surcharge       projects        de      Aufschlag auswählen
+Select Template        projects        de      Standort-Vorlage auswählen
+select users   projects        de      Benutzer auswählen
 settings       admin   de      Einstellungen
 sequencing project     projects        de      Nachfolgendes Projekt
-show anonymous public projects on mainscreen   projects        de      Anonym 
öffentliche Projekte auf der Startseite anzeigen
+show anonymous public projects on mainscreen   projects        de      Anonym 
öffentliche Projekte auf der Startseite anzeigen
+show projects on mainscreen    projects        de      Projekte auf der 
Startseite anzeigen
+show project option not billable       common  de      Option 'nicht 
abrechenbar' beim Anlegen oder Ändern eines Projekts einblenden
+show project option direct work        common  de      Option 'direkte 
Tätigkeiten' beim Anlegen oder Ändern eines Projekts einblenden
+show project option discount   common  de      Option 'Rabatt' beim Anlegen 
oder Ändern eines Projekts einblenden
 show gantt chart       projects        de      Gantt Chart anzeigen
 show gantt chart in new window projects        de      Gantt Chart in neuem 
Fenster anzeigen
+show sidebox   admin   de      Sitebox anzeigen
 site configuration     common  de      Konfiguration der Seite
 start  projects        de      Start
 start date planned     projects        de      Geplantes Startdatum
-start date can not be before parent projects start date        projects        
de      Startdatum kann nicht vor dem Startdatum des übergeordneten Projektes 
liegen.
-start date planned can not be before parent projects start date planned        
projects        de      Geplantes Startdatum kann nicht vor dem geplanten 
Startdatum des übergeordneten Projektes liegen.
+start date can not be before parent projects start date        projects        
de      Startdatum kann nicht vor dem Startdatum des übergeordneten Projektes 
liegen.
+start date planned can not be before parent projects start date planned        
projects        de      Geplantes Startdatum kann nicht vor dem geplanten 
Startdatum des übergeordneten Projektes liegen.
+start date can not be after sub projects start date    projects        de      
Startdatum kann nicht hinter dem Startdatum des Unterprojektes liegen.
 statistics     projects        de      Statistiken
 Status projects        de      Status
 stop   projects        de      Stopp
 sub project level %1   projects        de      Unterprojekt Level %1
+sub project    common  de      Unterprojekt
 sub projects   common  de      Unterprojekte
 Sum    projects        de      Summe
 sum budget     projects        de      Summe Budget
 Summary        projects        de      Zusammenfassung
 surcharge      projects        de      Aufschlag
-surcharge has been deleted     projects        de      Aufschlag wurde 
gelöscht.
+surcharge has been deleted     projects        de      Aufschlag wurde 
gelöscht.
 surcharge %1 has been saved    projects        de      Aufschlag %1 wurde 
gespeichert.
-surcharges     preferences     de      Aufschläge
+surcharges     preferences     de      Aufschläge
 test   projects        de      Test
 that id has been used already  projects        de      Diese Projekt-Nr. ist 
bereits in Benutzung.
-the choosen previous project does not have an end date specified       
projects        de      Für das gewählte Vorprojekt wurde kein Enddatum 
angegeben.
-the choosen timeframe interleaves an already existing timeframe        
projects        de      Der gewählte Zeitraum überschneidet sich mit einem 
bereits existierenden
+the choosen previous project does not have an end date specified       
projects        de      Für das gewählte Vorprojekt wurde kein Enddatum 
angegeben.
+the choosen timeframe interleaves an already existing timeframe        
projects        de      Der gewählte Zeitraum überschneidet sich mit einem 
bereits existierenden
 till   projects        de      Bis
 travel time    projects        de      Reisezeit
+time and budget        projects        de      Zeit und Budget
 time planned   projects        de      geplante Zeit
 time tracker   projects        de      Time Tracker
-time tracking for this project has been stopped already        projects        
de      Die Zeiterfassungen für dieses Projekt wurden erfolgreich gestoppt.
-time tracking for this project is already active       projects        de      
Die Zeiterfassungen für dieses Projekt wurden bereits gestartet.
-time tracking for this project is not active   projects        de      Die 
Zeiterfassungen für dieses Projekt wurden nicht gestartet.
+time tracking for this project has been stopped already        projects        
de      Die Zeiterfassungen für dieses Projekt wurden erfolgreich gestoppt.
+time tracking for this project is already active       projects        de      
Die Zeiterfassungen für dieses Projekt wurden bereits gestartet.
+time tracking for this project is not active   projects        de      Die 
Zeiterfassungen für dieses Projekt wurden nicht gestartet.
 time used      projects        de      verbrauchte Zeit
 timed  projects        de      zeitlich
-title can not exceed 250 characters in length  projects        de      Titel 
darf 250 Zeichen nicht überschreiten.
+title can not exceed 250 characters in length  projects        de      Titel 
darf 250 Zeichen nicht überschreiten.
 to     common  de      -&gt;
-too many hours for this day    projects        de      zu viele Stunden für 
diesen Tag
+too many hours for this day    projects        de      zu viele Stunden für 
diesen Tag
+tooltip_parent_project_members projects        de      Durch Anklicken des 
Buttons <b>Übernehmen</b> werden die Mitarbeiter des übergeordneten Projektes 
in dieses Projekt eingetragen.
+tooltip_select_project_members projects        de      Durch Anklicken des 
Buttons <b>Auswählen</b> können Sie Mitarbeiter zu diesem Projekt hinzufügen.
+tooltip_remove_project_members projects        de      Durch Anklicken des 
Buttons <b>Entfernen</b> werden die selektierten Mitarbeiter von diesem Projekt 
entfernt.
+tooltip_select_coordinator     projects        de      Durch Anklicken des 
Buttons <b>Auswählen</b> können Sie einen anderen Projektleiter für dieses 
Projekt festlegen.
+tooltip_select_salesmanager    projects        de      Durch Anklicken des 
Buttons <b>Auswählen</b> können Sie einen Vertriebsbeauftragten zu diesem 
Projekt hinzufügen.
+tooltip_remove_salesmanager    projects        de      Durch Anklicken des 
Buttons <b>Entfernen</b> wird der zugeordnete Vertriebsbeauftragte von diesem 
Projekt entfernt.
 Total  projects        de      Gesamt
 Travel projects        de      Reise
 upload projects        de      Hochladen
-use activities admin   de      Tätigkeiten benutzen
+use activities admin   de      Tätigkeiten benutzen
 used billable  projects        de      Verbraucht abzurechnen
 used not billable      projects        de      Verbraucht nicht abzurechnen
 used total     projects        de      Verbraucht total
+user interface admin   de      Benutzeroberfläche
 user statistic projects        de      Benutzer Statistik
 user statistics        projects        de      Benutzer Statistiken
-value check not passed projects        de      Überprüfung der Eingabewerte 
fehlgeschlagen
+value check not passed projects        de      Überprüfung der Eingabewerte 
fehlgeschlagen
 Variance       projects        de      Abweichung
 view gantt chart       projects        de      Gantt Chart anzeigen
 View controlling sheet projects        de      Controlling Sheet
 view employees projects        de      Mitarbeiter anzeigen
 view hours     projects        de      Stunden anzeigen
 view project   projects        de      Projekt anzeigen
-view project activities        projects        de      Projekt Aktivitäten 
anzeigen   
+view project activities        projects        de      Projekt Aktivitäten 
anzeigen    
 view projects  projects        de      Projekte anzeigen
 view sheet     projects        de      Anzeigen
 view work hours        projects        de      Arbeitsstunden anzeigen
@@ -373,19 +435,19 @@
 workunit       projects        de      Arbeitseinheit
 workunits      projects        de      Arbeitseinheiten
 wrong file type        projects        de      Falscher Dateityp
-You entered a worktime for a month that was already booked! Booking is not 
possible any more.  projects        de      Sie haben versucht Zeiten für 
einen bereits gebuchten Monat zu erfassen. Eine Erfassung ist nicht mehr 
möglich.
-You have entered an invalid date due   projects        de      Sie haben ein 
ungültiges Fälligkeitsdatum angegeben.
-you have entered an invalid start date projects        de      Sie haben ein 
ungültiges Startdatum angegeben.
-You have entered an invalid planned start date projects        de      Sie 
haben ein ungültiges geplantes Startdatum angegeben.
-You have entered an invalid planned end date   projects        de      Sie 
haben ein ungültiges geplantes Enddatum angegeben.
-You have entered an invalid work time  projects        de      Sie haben eine 
ungültige Arbeitszeit angegeben.
-you have no projects selected  projects        de      Sie haben kein Projekt 
gewählt!
+You entered a worktime for a month that was already booked! Booking is not 
possible any more.  projects        de      Sie haben versucht Zeiten für einen 
bereits gebuchten Monat zu erfassen. Eine Erfassung ist nicht mehr möglich.
+You have entered an invalid date due   projects        de      Sie haben ein 
ungültiges Fälligkeitsdatum angegeben.
+you have entered an invalid start date projects        de      Sie haben ein 
ungültiges Startdatum angegeben.
+You have entered an invalid planned start date projects        de      Sie 
haben ein ungültiges geplantes Startdatum angegeben.
+You have entered an invalid planned end date   projects        de      Sie 
haben ein ungültiges geplantes Enddatum angegeben.
+You have entered an invalid work time  projects        de      Sie haben eine 
ungültige Arbeitszeit angegeben.
+you have no projects selected  projects        de      Sie haben kein Projekt 
gewählt!
 worktime statusmail    common  de      Arbeitszeit Statusmail
-weekly projects        de      wöchentlich
+weekly projects        de      wöchentlich
 monthly        projects        de      monatlich
 setting has been saved projects        de      Einstellungen wurden gespeichert
 setting has not been saved     projects        de      Einstellungen wurden 
nicht gespeichert
-weekly workhours       projects        de      Wochenarbeitsstunden
+weekly workhours       projects        de      Arbeitsstunden pro Woche
 workhours booking      common  de      Arbeitsstunden buchen
-worktime warnmail      common  de      Mailbenachrichtigung bei 
unvollständiger Zeiterfassung
+worktime warnmail      common  de      Mailbenachrichtigung bei 
unvollständiger Zeiterfassung
 work hours statistics  projects        de      Arbeitsstunden Statistik

Index: setup/phpgw_en.lang
===================================================================
RCS file: /sources/phpgroupware/projects/setup/phpgw_en.lang,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- setup/phpgw_en.lang 29 Sep 2006 11:59:28 -0000      1.57
+++ setup/phpgw_en.lang 5 Dec 2006 19:40:45 -0000       1.58
@@ -157,12 +157,13 @@
 plan bottom up projects        en      plan bottom up
 direct work    projects        en      project with direct work units
 indirect work  projects        en      project with indirect work units
-planned start date can not be after sub projects planned start date    
projects        en      planned start date can not be after sub projects 
planned start date
+planned start date can not be after sub projects planned start date    en      
planned start date can not be after sub projects planned start date
 please choose a project coordinator    projects        en      Please choose a 
project coordinator.
 please choose activities for the project       projects        en      Please 
choose activities for the project.
 please choose the accounting system for the project    projects        en      
Please choose the accounting system for the project.
 please choose the columns to list in the projects preferences section  
projects        en      Please choose the columns to list in the projects 
preferences section.
 please choose the discount type        projects        en      Please choose 
the discount type.
+please choose the period       projects        en      Please choose the period
 please enter a remark  projects        en      Please enter a remark.
 please enter a title   projects        en      Please enter a title.
 please enter the project id    projects        en      Please enter the 
Project ID.
@@ -251,7 +252,7 @@
 you have entered an invalid start date projects        en      You have 
entered an invalid start date.
 You have entered an invalid planned start date projects        en      You 
have entered an invalid planned start date.
 You have entered an invalid planned end date   projects        en      You 
have entered an invalid planned end date.
-You entered a worktime for a month that was already booked! Booking is not 
possible any more.  projects        en      You entered a worktime for a month 
that was already booked! Booking is not possible any more.
+You entered a worktime for a month that was already booked! Booking is not 
possible any more.  en      You entered a worktime for a month that was already 
booked! Booking is not possible any more.
 worktime statusmail    common  en      Worktime Statusmail
 weekly projects        en      weekly
 monthly        projects        en      monthly

Index: setup/phpgw_es.lang
===================================================================
RCS file: /sources/phpgroupware/projects/setup/phpgw_es.lang,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- setup/phpgw_es.lang 22 Feb 2006 06:26:37 -0000      1.5
+++ setup/phpgw_es.lang 5 Dec 2006 19:40:45 -0000       1.6
@@ -40,7 +40,7 @@
 Delivery       projects        es      Envio
 Delivery date  projects        es      Fecha de Envio
 Delivery note  projects        es      Nota de Envio
-delivery note for project      projects        es      Nota de Envío para el 
proyecto
+delivery note for project      projects        es      Nota de Envío para el 
proyecto
 Delivery ID    projects        es      ID de Envio
 Delivery list  projects        es      Lista de Envios
 Delivery notes projects        es      Notas de Envios
@@ -53,7 +53,7 @@
 Edit project   projects        es      Editar proyecto
 Edit project hours     projects        es      Editar horas de proyecto
 Employee       projects        es      Empleado
-Ending date can not be after main projects ending date !       projects        
es      La fecha de finalizaciòn no puede ser posterior a la del proyecto 
principal!
+Ending date can not be after main projects ending date !       projects        
es      La fecha de finalizaciòn no puede ser posterior a la del proyecto 
principal!
 Generate Activity ID ? projects        es      Generar ID de Actividad ?
 Generate Delivery ID ? projects        es      Generar ID de Envio ?
 Generate Project ID ?  projects        es      Generar ID de Proyecto ?
@@ -115,16 +115,16 @@
 project statistics     projects        es      Estadisticas de Proyecto
 Remark projects        es      Nota
 Remark required        projects        es      Nota requerida
-select font    projects        es      Seleccion de Tipografía
-Select font size for own address       projects        es      Seleccione 
tamaño de tipografía para la dirección propia
-Select font size for customer address  projects        es      Seleccione 
tamaño de tipografía para la dirección del cliente
+select font    projects        es      Seleccion de Tipografía
+Select font size for own address       projects        es      Seleccione 
tamaño de tipografía para la dirección propia
+Select font size for customer address  projects        es      Seleccione 
tamaño de tipografía para la dirección del cliente
 Select main project    projects        es      Seleccione proyecto principal
 Select project projects        es      Seleccione proyecto
 Select tax for workhours       projects        es      Seleccione impuestos 
por hora de trabajo
 Select users   projects        es      Seleccione Usuarios
 Select groups  projects        es      Seleccione grupos
 Select your address    projects        es      Seleccione su direccion
-small  projects        es      Pequeño
+small  projects        es      Pequeño
 Start date can not be before main projects start date !        projects        
es      La fecha de inicio no puede ser previa a la del proyecto principal
 Statistic      projects        es      Estadisticas
 Statistics     projects        es      Estadisticas
@@ -145,7 +145,7 @@
 user statistics        projects        es      Estadisticas del Usuario
 verdana        projects        es      Verdana
 very large     projects        es      Muy Grande
-very small     projects        es      Muy Pequeño
+very small     projects        es      Muy Pequeño
 View work hours        projects        es      Ver horas de Trabajo
 View job       projects        es      Ver Trabajo
 View project   projects        es      Ver Proyecto

Index: setup/phpgw_fr.lang
===================================================================
RCS file: /sources/phpgroupware/projects/setup/phpgw_fr.lang,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- setup/phpgw_fr.lang 22 Feb 2006 06:08:25 -0000      1.10
+++ setup/phpgw_fr.lang 5 Dec 2006 19:40:45 -0000       1.11
@@ -1,13 +1,13 @@
 Account        projects        fr      Compte
-accountancy    common  fr      Comptabilité
+accountancy    common  fr      Comptabilité
 Active projects        fr      Actif
-Activities     projects        fr      Activités
-Activity       projects        fr      Activité
-Activity %1 has been added !   projects        fr      L'activité %1 a été 
ajoutée !
-Activity %1 has been updated ! projects        fr      L'activité %1 a été 
mise à jour !
-Activity ID    projects        fr      ID Activité
-Add Activity   projects        fr      Ajouter activité
-Add job        projects        fr      Ajouter tâche
+Activities     projects        fr      Activités
+Activity       projects        fr      Activité
+Activity %1 has been added !   projects        fr      L'activité %1 a été 
ajoutée !
+Activity %1 has been updated ! projects        fr      L'activité %1 a été 
mise à jour !
+Activity ID    projects        fr      ID Activité
+Add Activity   projects        fr      Ajouter activité
+Add job        projects        fr      Ajouter tâche
 Add project    projects        fr      Ajouter projet
 Add project hours      projects        fr      Ajouter heures de projet
 Add work hours projects        fr      Ajouter heures de travail
@@ -17,144 +17,147 @@
 All invoices   projects        fr      Toutes les factures
 apply  projects        fr      Appliquer
 archive        projects        fr      Archive
-are you sure you want to delete this activity  projects        fr      
Etes-vous sûr de vouloir effacer cette activité ?
-are you sure you want to delete this project   projects        fr      
Etes-vous sûr de vouloir effacer ce projet ?
+are you sure you want to delete this activity  projects        fr      
Etes-vous sûr de vouloir effacer cette activité ?
+are you sure you want to delete this project   projects        fr      
Etes-vous sûr de vouloir effacer ce projet ?
 arial  projects        fr      Arial
 bill per hour  projects        fr      Facturer par heure
-bill per hour/workunit projects        fr      Facturer par heure/unité de 
travail
-Bill per workunit      projects        fr      Facturer par unité de travail
-Billable activities    projects        fr      Activités facturables
-billed projects        fr      Facturé
-Billed only    projects        fr      Facturé seulement
+bill per hour/workunit projects        fr      Facturer par heure/unité de 
travail
+Bill per workunit      projects        fr      Facturer par unité de travail
+Billable activities    projects        fr      Activités facturables
+billed projects        fr      Facturé
+Billed only    projects        fr      Facturé seulement
 Billing        projects        fr      Facturation
-Bookable activities    projects        fr      Activités réservables
+Bookable activities    projects        fr      Activités réservables
 bookkeeper     projects        fr      Comptable
-bookkeeping    common  fr      comptabilité
+bookkeeping    common  fr      comptabilité
 Budget projects        fr      Budget
 budget main project    projects        fr      Budget projet principal
-budget sum of all sub projects is bigger than the budget of the main project   
projects        fr      La somme des budgets de tous les sous-projets est 
supérieure au budget du projet principal
+budget sum of all sub projects is bigger than the budget of the main project   
projects        fr      La somme des budgets de tous les sous-projets est 
supérieure au budget du projet principal
 Calculate      projects        fr      Calculer
-closed projects        fr      Fermé
+closed projects        fr      Fermé
 Coordinator    projects        fr      Coordinateur
 courier new    projects        fr      Courier New
-Create delivery        projects        fr      Créer une livraison
-Create invoice projects        fr      Créer une facture
-creator        projects        fr      Créateur
+Create delivery        projects        fr      Créer une livraison
+Create invoice projects        fr      Créer une facture
+creator        projects        fr      Créateur
 customer       projects        fr      Client
-date created   projects        fr      Date de création
+date created   projects        fr      Date de création
 Delete hours   projects        fr      Effacer les heures
 Deliveries     projects        fr      Livraisons
 Delivery       projects        fr      Livraison
-Delivery %1 has been created ! projects        fr      La livraison %1 a été 
crée !
-Delivery %1 has been updated ! projects        fr      La livraison %1 a été 
mise à jour !
+Delivery %1 has been created ! projects        fr      La livraison %1 a été 
crée !
+Delivery %1 has been updated ! projects        fr      La livraison %1 a été 
mise à jour !
 Delivery date  projects        fr      Date de livraison
 Delivery ID    projects        fr      ID de livraison
 Delivery list  projects        fr      Liste de livraison
 Delivery note  projects        fr      Note de livraison
 delivery note for project      projects        fr      Note de livraison pour 
le projet
 Delivery notes projects        fr      Notes de livraison
-description can not exceed 255 characters in length !  projects        fr      
La description ne peut excéder 255 caractères de long !
-description can not exceed 8000 characters in length ! projects        fr      
La description ne peut excéder 8000 caractères de long !
+description can not exceed 255 characters in length !  projects        fr      
La description ne peut excéder 255 caractères de long !
+description can not exceed 8000 characters in length ! projects        fr      
La description ne peut excéder 8000 caractères de long !
 Do you also want to delete all sub projects ?  projects        fr      
Voulez-vous aussi effacer tous les sous-projets ?
-Edit Activity  projects        fr      Modifier l'activité
+Edit Activity  projects        fr      Modifier l'activité
 Edit administrator list        projects        fr      Modifier la liste des 
administrateurs
 edit bookkeeper list   projects        fr      Modifier la liste des comptables
 Edit job       projects        fr      Modifier le job
 Edit project   projects        fr      Modifier le projet
 Edit project hours     projects        fr      Modifier les heures de projet
 Edit work hours        projects        fr      Modifier les heures de travail
-Employee       projects        fr      Employé
-ending date can not be after main projects ending date projects        fr      
La date de fin ne peut pas être après celle des projets principaux
-Ending date can not be before start date       projects        fr      La date 
de fin ne peut pas être avant la date de début
+Employee       projects        fr      Employé
+employees      projects        fr      Employés
+enable acl for invoicing section       common  fr      Activer l'ACL pour la 
section facturation
+ending date can not be after main projects ending date projects        fr      
La date de fin ne peut pas être après celle des projets principaux
+Ending date can not be before start date       projects        fr      La date 
de fin ne peut pas être avant la date de début
 Error in calculation sum does not match !      projects        fr      Erreur 
dans le calcul la somme ne correspond pas !
 exactly accounting     projects        fr      Comptabilisation exacte
-Generate Activity ID ? projects        fr      Générer l'ID d'activité ?
-Generate Delivery ID ? projects        fr      Générer l'ID de livraison ?
-Generate Invoice ID ?  projects        fr      Générer l'ID de facture ?
-Generate Job ID ?      projects        fr      Générer l'ID de tâche ?
-Generate Project ID ?  projects        fr      Générer l'ID de projet ?
+Generate Activity ID ? projects        fr      Générer l'ID d'activité ?
+Generate Delivery ID ? projects        fr      Générer l'ID de livraison ?
+Generate Invoice ID ?  projects        fr      Générer l'ID de facture ?
+Generate Job ID ?      projects        fr      Générer l'ID de tâche ?
+Generate Project ID ?  projects        fr      Générer l'ID de projet ?
 georgia        projects        fr      Georgia
 helvetica      projects        fr      Helvetica
 Hours  projects        fr      Heures
-id can not exceed 19 characters in length      projects        fr      L'ID ne 
peut pas excéder 19 caractères de long.
-id can not exceed 25 characters in length      projects        fr      L'ID ne 
peut pas excéder 25 caractères de long
-if you are an administrator, please set the preferences for this application   
projects        fr      Si vous êtes un administrateur, SVP réglez les 
préférences pour cette application
-if you are not an administrator, please inform the administrator to set the 
preferences for this application   projects        fr      Si vous n'êtes pas 
un administrateur, SVP informez l'administrateur qu'il doit régler les 
préférences pour cette application
+id can not exceed 19 characters in length      projects        fr      L'ID ne 
peut pas excéder 19 caractères de long.
+id can not exceed 25 characters in length      projects        fr      L'ID ne 
peut pas excéder 25 caractères de long
+if you are an administrator, please set the preferences for this application   
projects        fr      Si vous êtes un administrateur, SVP réglez les 
préférences pour cette application
+if you are not an administrator, please inform the administrator to set the 
preferences for this application   projects        fr      Si vous n'êtes pas 
un administrateur, SVP informez l'administrateur qu'il doit régler les 
préférences pour cette application
 investment nr  projects        fr      No d'investissement
 Invoice        projects        fr      Facture
-Invoice %1 has been created !  projects        fr      La facture %1 a été 
crée !
-Invoice %1 has been updated !  projects        fr      La facture %1 a été 
mise à jour !
+Invoice %1 has been created !  projects        fr      La facture %1 a été 
crée !
+Invoice %1 has been updated !  projects        fr      La facture %1 a été 
mise à jour !
 Invoice date   projects        fr      Date de facture
 invoice for project    projects        fr      Facture pour projet
 Invoice ID     projects        fr      ID de facture
 Invoice layout projects        fr      Mise en page de facture
 Invoice list   projects        fr      Liste de factures
 Invoices       projects        fr      Factures
+invoicing      common  fr      Facturation
 invoicing of work time projects        fr      Facturation du temps de travail
-Job    projects        fr      Tâche
-job archive    projects        fr      Archive des tâches
-Job date       projects        fr      Date de tâche
-Job description        projects        fr      Description de tâche
-Job has been added !   projects        fr      La tâche a été ajoutée !
-Job has been updated ! projects        fr      La tâche a été mise à jour !
-Job ID projects        fr      ID de tâche
-Job list       projects        fr      Liste de tâches
-Jobs   projects        fr      Tâches
+Job    projects        fr      Tâche
+job archive    projects        fr      Archive des tâches
+Job date       projects        fr      Date de tâche
+Job description        projects        fr      Description de tâche
+Job has been added !   projects        fr      La tâche a été ajoutée !
+Job has been updated ! projects        fr      La tâche a été mise à jour !
+Job ID projects        fr      ID de tâche
+Job list       projects        fr      Liste de tâches
+Jobs   projects        fr      Tâches
 large  projects        fr      Large
-last update    projects        fr      Dernière mise à jour
-list activities        projects        fr      Lister les activités
+last update    projects        fr      Dernière mise à jour
+list activities        projects        fr      Lister les activités
 list budget    projects        fr      Lister le budget
-list pcosts    projects        fr      Lister les coûts planifiés
+list pcosts    projects        fr      Lister les coûts planifiés
 list projects  projects        fr      Lister les projets
 list work hours        projects        fr      Lister les heures de travail
 main project   projects        fr      Projet principal
 Main project:  projects        fr      Projet principal:
-Minutes per workunit   projects        fr      Minutes par unité de travail
+Minutes per workunit   projects        fr      Minutes par unité de travail
 month  projects        fr      Mois
 net    projects        fr      net
 New project    projects        fr      Nouveau projet
 Nonactive      projects        fr      Non-actif
 Number projects        fr      Nombre
 open   projects        fr      Ouvert
-open popup window      projects        fr      Ouvrir une fenêtre Popup
+open popup window      projects        fr      Ouvrir une fenêtre Popup
 Overall        projects        fr      Total
-pcosts can not be higher than the budget       projects        fr      Les 
coûts planifiés ne peuvent être plus élevés que le budget !
+pcosts can not be higher than the budget       projects        fr      Les 
coûts planifiés ne peuvent être plus élevés que le budget !
 per hour       projects        fr      Par heure
-per hour/workunit      projects        fr      Unité de travai/heure
-per workunit   projects        fr      Par unité de travail
-planned costs  projects        fr      Coûts planifiés
-planned time   projects        fr      Temps planifié
-planned time sum of all sub projects is bigger than the planned time of the 
main project       projects        fr      La somme des temps planifiés pour 
tous les sous-projets est supérieure au temps planifié pour le projet 
principal
+per hour/workunit      projects        fr      Unité de travai/heure
+per workunit   projects        fr      Par unité de travail
+planned costs  projects        fr      Coûts planifiés
+planned time   projects        fr      Temps planifié
+planned time sum of all sub projects is bigger than the planned time of the 
main project       projects        fr      La somme des temps planifiés pour 
tous les sous-projets est supérieure au temps planifié pour le projet principal
 please choose a project coordinator    projects        fr      SVP choisissez 
un coordinateur de projet !
-please choose activities for the project       projects        fr      SVP 
choisissez les activités pour le projet !
+please choose activities for the project       projects        fr      SVP 
choisissez les activités pour le projet !
 please enter a remark !        projects        fr      SVP entrez une remarque 
!
 please enter an ID !   projects        fr      SVP entrez un ID !
 please enter the bill  projects        fr      SVP entrez la facture.
-please enter the minutes per workunit  projects        fr      SVP entrez les 
minutes par unité de travail.
-Please set the minutes per workunit for each activity now !    projects        
fr      SVP entrez les minutes par unité de travail pour chaque activité 
maintenant !
-Please set your preferences for this application !     projects        fr      
SVP réglez vos préférences pour cette application !
-please specify country and currency in the global preferences section  
projects        fr      SVP spécifiez le pays et la monnaie dans la section 
des préférences globales
-please specify the budget      projects        fr      SVP spécifiez le 
budget !
+please enter the minutes per workunit  projects        fr      SVP entrez les 
minutes par unité de travail.
+Please set the minutes per workunit for each activity now !    projects        
fr      SVP entrez les minutes par unité de travail pour chaque activité 
maintenant !
+Please set your preferences for this application !     projects        fr      
SVP réglez vos préférences pour cette application !
+please specify country and currency in the global preferences section  
projects        fr      SVP spécifiez le pays et la monnaie dans la section des 
préférences globales
+please specify the budget      projects        fr      SVP spécifiez le budget 
!
 Position       projects        fr      Position
-preferences for accountancy    projects        fr      Préférences pour la 
comptabilité
+preferences for accountancy    projects        fr      Préférences pour la 
comptabilité
 Print delivery projects        fr      Imprimer la livraison
 Print invoice  projects        fr      Imprimer la facture
 processor      projects        fr      Processeur
 Project        projects        fr      Projet
-project %1 has been saved      projects        fr      Le projet %1 a été 
enregistré
+project %1 has been saved      projects        fr      Le projet %1 a été 
enregistré
 Project archive        projects        fr      Archive de projets
 Project billing        projects        fr      Facturation de projet
 Project delivery       projects        fr      Livraison de projet
 Project ID     projects        fr      ID de projet
 Project list   projects        fr      Liste de projets
 Project name   projects        fr      Nom de projet
-Project preferences    projects        fr      Préférences de Projet
+Project preferences    projects        fr      Préférences de Projet
 Project statistic      projects        fr      Statistique de projet
 project statistics     projects        fr      Statistiques de projet
 projects       common  fr      Projets
-projects preferences   preferences     fr      Préférences de projets
+projects preferences   preferences     fr      Préférences de projets
 Remark projects        fr      Remarque
-remark can not exceed 8000 characters in length !      projects        fr      
La remarque ne peut pas excéder 8000 caractères de long !
+remark can not exceed 8000 characters in length !      projects        fr      
La remarque ne peut pas excéder 8000 caractères de long !
 Remark required        projects        fr      Remarque requise
 select font    projects        fr      Choisissez la fonte
 Select font size for customer address  projects        fr      Choisissez la 
taille de fonte pour l'adresse du client
@@ -167,35 +170,35 @@
 Select users   projects        fr      Choisissez les utilisateurs
 Short description      projects        fr      Courte description
 small  projects        fr      Petit
-Sorry, no preferences to set for you :)        projects        fr      
Désolé, aucune préférence à régler pour vous :)
-start date can not be before main projects start date  projects        fr      
La date de départ ne peut pas être avant celle des projets principaux
+Sorry, no preferences to set for you :)        projects        fr      Désolé, 
aucune préférence à régler pour vous :)
+start date can not be before main projects start date  projects        fr      
La date de départ ne peut pas être avant celle des projets principaux
 Statistic      projects        fr      Statistique
 statistics     projects        fr      Statistiques
 Sum    projects        fr      Total
 sum budget     projects        fr      Somme du budget
 sum hours      projects        fr      Total heures
 sum net        projects        fr      Total net
-sum pcosts     projects        fr      Somme de coûts planifiés
-Sum workunits  projects        fr      Total unités de travail
+sum pcosts     projects        fr      Somme de coûts planifiés
+Sum workunits  projects        fr      Total unités de travail
 tahoma projects        fr      Tahoma
 tax    projects        fr      Taxe
-that id has been used already !        projects        fr      Cet ID a déjà 
été utilisé !
+that id has been used already !        projects        fr      Cet ID a déjà 
été utilisé !
 The delivery note contains no items !  projects        fr      La note de 
livraison ne contient aucun objet !
 The invoice contains no items !        projects        fr      La facture ne 
contient aucun objet !
-time planned   projects        fr      Temps planifié
-time planned main project      projects        fr      Temps planifié projet 
principal
-time used      projects        fr      Temps utilisé
+time planned   projects        fr      Temps planifié
+time planned main project      projects        fr      Temps planifié projet 
principal
+time used      projects        fr      Temps utilisé
 times new roman        projects        fr      Times New Roman
-title can not exceed 255 characters in length  projects        fr      Le 
titre ne peut pas excéder 255 caractères de long
-Update delivery        projects        fr      Mettre à jour la livraison
-Update invoice projects        fr      Mettre à jour la facture
+title can not exceed 255 characters in length  projects        fr      Le 
titre ne peut pas excéder 255 caractères de long
+Update delivery        projects        fr      Mettre à jour la livraison
+Update invoice projects        fr      Mettre à jour la facture
 User statistic projects        fr      Statistique d'utilisateur
 user statistics        projects        fr      Statistiques d'utilisateur
 Username / Group       projects        fr      Utilisateur / Groupe
 verdana        projects        fr      Verdana
-very large     projects        fr      Très grand
-very small     projects        fr      Très petit
-View job       projects        fr      Voir la tâche
+very large     projects        fr      Très grand
+very small     projects        fr      Très petit
+View job       projects        fr      Voir la tâche
 View project   projects        fr      Voir le projet
 View work hours        projects        fr      Voir les heures de travail
 Work date      projects        fr      Date de travail
@@ -203,12 +206,12 @@
 Work hours archive     projects        fr      Archive des heures de travail
 Work hours list        projects        fr      Liste des heures de travail
 Work time      projects        fr      Temps de travail
-Workunit       projects        fr      Unité de travail
-Workunits      projects        fr      Unités de travail
+Workunit       projects        fr      Unité de travail
+Workunits      projects        fr      Unités de travail
 written by:    projects        fr      Ecrit par:
-you have entered an invalid date !     projects        fr      Vous avez 
entré une date invalide !
-you have entered an invalid end date ! projects        fr      Vous avez 
entré une date de fin invalide !
-you have entered an invalid start date !       projects        fr      Vous 
avez entré une date de début invalide !
-You have no customer selected !        projects        fr      Vous n'avez 
aucun client sélectionné !
-You have selected an invalid activity !        projects        fr      Vous 
avez sélectionné une activité invalide !
-You have to CREATE a delivery or invoice first !       projects        fr      
Vous devez d'abord créer une livraison ou une facture !
+you have entered an invalid date !     projects        fr      Vous avez entré 
une date invalide !
+you have entered an invalid end date ! projects        fr      Vous avez entré 
une date de fin invalide !
+you have entered an invalid start date !       projects        fr      Vous 
avez entré une date de début invalide !
+You have no customer selected !        projects        fr      Vous n'avez 
aucun client sélectionné !
+You have selected an invalid activity !        projects        fr      Vous 
avez sélectionné une activité invalide !
+You have to CREATE a delivery or invoice first !       projects        fr      
Vous devez d'abord créer une livraison ou une facture !

Index: setup/phpgw_it.lang
===================================================================
RCS file: /sources/phpgroupware/projects/setup/phpgw_it.lang,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- setup/phpgw_it.lang 22 Feb 2006 06:30:26 -0000      1.3
+++ setup/phpgw_it.lang 5 Dec 2006 19:40:45 -0000       1.4
@@ -1,13 +1,13 @@
 account        projects        it      Account
 accountancy    common  it      Accountancy
 active projects        it      Attivo
-activities     projects        it      Attività
-activities list        projects        it      Lista attività
-activity       projects        it      Attività
-activity %1 has been added !   projects        it      L'attività %1 è stata 
aggiunta!
-activity %1 has been updated ! projects        it      L'attività %1 è stata 
aggiornata!
-activity id    projects        it      ID Attività
-add activity   projects        it      Aggiungi Attività
+activities     projects        it      Attività
+activities list        projects        it      Lista attività
+activity       projects        it      Attività
+activity %1 has been added !   projects        it      L'attività %1 è stata 
aggiunta!
+activity %1 has been updated ! projects        it      L'attività %1 è stata 
aggiornata!
+activity id    projects        it      ID Attività
+add activity   projects        it      Aggiungi Attività
 add job        projects        it      Aggiungi Lavoro
 add project    projects        it      Aggiungi progetto
 add project hours      projects        it      Aggiungi ore di progetto
@@ -19,14 +19,14 @@
 archive        projects        it      Archivio
 arial  projects        it      Arial
 bill per hour  projects        it      Costo per ora
-bill per workunit      projects        it      Costo per unità di lavoro
-billable activities    projects        it      Attività fatturabili
+bill per workunit      projects        it      Costo per unità di lavoro
+billable activities    projects        it      Attività fatturabili
 billed projects        it      Fatturato
 billed only    projects        it      Solo Fatturato
 billing        projects        it      Fatturazione
-bookable activities    projects        it      Attività contabilizzabili
+bookable activities    projects        it      Attività contabilizzabili
 bookkeeper     projects        it      Responsabile contabile
-bookkeeping    common  it      Contabilità
+bookkeeping    common  it      Contabilità
 budget projects        it      Budget
 calculate      projects        it      Esegui Calcoli
 closed projects        it      Chiuso
@@ -38,18 +38,18 @@
 delete hours   projects        it      Cancella ore
 deliveries     projects        it      Consegne
 delivery       projects        it      Consegna
-delivery %1 has been created ! projects        it      La Consegna %1 è stata 
creata!
-delivery %1 has been updated ! projects        it      La Consegna %1 è stata 
modificata!
+delivery %1 has been created ! projects        it      La Consegna %1 è stata 
creata!
+delivery %1 has been updated ! projects        it      La Consegna %1 è stata 
modificata!
 delivery date  projects        it      Data Consegna
 delivery id    projects        it      ID Consegna
 delivery list  projects        it      Lista Consegne
 delivery note  projects        it      Nota Consegna
 delivery note for project      projects        it      Nota di Consegna per 
progetto
 delivery notes projects        it      Note di Consegna
-description can not exceed 255 characters in length !  projects        it      
La descrizione non può essere più lunga di 255 caratteri!
-description can not exceed 8000 characters in length ! projects        it      
La descrizione non può essere più lunga di 8000 caratteri!
+description can not exceed 255 characters in length !  projects        it      
La descrizione non può essere più lunga di 255 caratteri!
+description can not exceed 8000 characters in length ! projects        it      
La descrizione non può essere più lunga di 8000 caratteri!
 do you also want to delete all sub projects ?  projects        it      Vuoi 
Cancellare anche tutti i sottoprogetti?
-edit activity  projects        it      Modifica Attività
+edit activity  projects        it      Modifica Attività
 edit job       projects        it      Modifica Lavoro
 edit project   projects        it      Modifica Progetto
 edit project administrator list        projects        it      Modifica lista 
amministratori progetto
@@ -57,11 +57,11 @@
 edit project hours     projects        it      Modifica ore di progetto
 edit work hours        projects        it      Modifica ore di lavoro
 employee       projects        it      Impiegato
-ending date can not be after main projects ending date !       projects        
it      La data di fine non può essere successiva alla data di fine del 
progetto
-ending date can not be before start date       projects        it      La data 
di fine non può precedere la data d'inizio
+ending date can not be after main projects ending date !       projects        
it      La data di fine non può essere successiva alla data di fine del progetto
+ending date can not be before start date       projects        it      La data 
di fine non può precedere la data d'inizio
 error in calculation sum does not match !      projects        it      Errore 
nei calcoli, la somma non corrisponde
 exactly accounting     projects        it      
-generate activity id ? projects        it      Generare ID Attività?
+generate activity id ? projects        it      Generare ID Attività?
 generate delivery id ? projects        it      Generare ID Consegna?
 generate invoice id ?  projects        it      Generare ID Fattura?
 generate job id ?      projects        it      Generare ID Lavoro?
@@ -69,11 +69,11 @@
 georgia        projects        it      Georgia
 helvetica      projects        it      Helvetica
 hours  projects        it      Ore
-id can not exceed 19 characters in length !    projects        it      L'ID 
non può essere più lungo di 19 caratteri!
-id can not exceed 25 characters in length !    projects        it      L'ID 
non può essere più lungo di 25 caratteri!
+id can not exceed 19 characters in length !    projects        it      L'ID 
non può essere più lungo di 19 caratteri!
+id can not exceed 25 characters in length !    projects        it      L'ID 
non può essere più lungo di 25 caratteri!
 invoice        projects        it      Fattura
-invoice %1 has been created !  projects        it      La Fattura %1 è stata 
creata!
-invoice %1 has been updated !  projects        it      La Fattura %1 è stata 
aggiornata!
+invoice %1 has been created !  projects        it      La Fattura %1 è stata 
creata!
+invoice %1 has been updated !  projects        it      La Fattura %1 è stata 
aggiornata!
 invoice date   projects        it      Data Fattura
 invoice for project    projects        it      Fattura per progetto
 invoice id     projects        it      ID Fattura
@@ -85,14 +85,14 @@
 job archive    projects        it      Archivio Lavori
 job date       projects        it      Data Lavoro
 job description        projects        it      Descrizione Lavoro
-job has been added !   projects        it      Il lavoro è stato aggiunto!
-job has been updated ! projects        it      Il lavoro è stato aggiornato!
+job has been added !   projects        it      Il lavoro è stato aggiunto!
+job has been updated ! projects        it      Il lavoro è stato aggiornato!
 job id projects        it      ID Job
 job list       projects        it      Lista Lavori
 jobs   projects        it      Lavori
 large  projects        it      Grande
 main project:  projects        it      Progetto principale
-minutes per workunit   projects        it      Minuti per unità di lavoro
+minutes per workunit   projects        it      Minuti per unità di lavoro
 net    projects        it      rete
 new project    projects        it      Nuovo progetto
 nonactive      projects        it      Non Attivo
@@ -100,14 +100,14 @@
 open   projects        it      Aperto
 overall        projects        it      Complessivo
 per hour       projects        it      per ora
-per hour/workunit      projects        it      per ora/unità di lavoro
-per workunit   projects        it      per unità di lavoro
-please choose activities for that project first !      projects        it      
Scegliere prima le attività per questo progetto!
+per hour/workunit      projects        it      per ora/unità di lavoro
+per workunit   projects        it      per unità di lavoro
+please choose activities for that project first !      projects        it      
Scegliere prima le attività per questo progetto!
 please enter a remark !        projects        it      Inserire le 
osservazioni!
 please enter an id !   projects        it      Inserire un ID!
 please enter the bill !        projects        it      Inserire la fattura!
-please enter the minutes per workunit !        projects        it      
Inserire i minuti per unità di lavoro!
-please set the minutes per workunit for each activity now !    projects        
it      Impstare i minuti per unità di lavoro per ogni attività, adesso!
+please enter the minutes per workunit !        projects        it      
Inserire i minuti per unità di lavoro!
+please set the minutes per workunit for each activity now !    projects        
it      Impstare i minuti per unità di lavoro per ogni attività, adesso!
 please set your preferences for this application !     projects        it      
Impostare le preferenze per questa applicazione
 position       projects        it      Posizione
 preferences for accountancy    projects        it      Preference per 
l'accountancy
@@ -126,7 +126,7 @@
 projects       common  it      Progetti
 projects preferences   preferences     it      Preferenze progetti
 remark projects        it      Osservazioni
-remark can not exceed 8000 characters in length !      projects        it      
Le osservazioni non possono essere più lunghe di 8000 caratteri
+remark can not exceed 8000 characters in length !      projects        it      
Le osservazioni non possono essere più lunghe di 8000 caratteri
 remark required        projects        it      Osservazioni Richieste
 select projects        it      Selezione
 select font    projects        it      Seleziona Font
@@ -142,20 +142,20 @@
 short description      projects        it      Descrizione breve
 small  projects        it      Piccolo
 sorry, no preferences to set for you :)        projects        it      
Spiacente,  non ci sono preferenze da impostare
-start date can not be before main projects start date !        projects        
it      La data d'inizio non può precedere la data d'inizio del progetto 
principale
+start date can not be before main projects start date !        projects        
it      La data d'inizio non può precedere la data d'inizio del progetto 
principale
 statistic      projects        it      Statistica
 statistics     projects        it      Statistiche
 sum    projects        it      Totale
 sum hours      projects        it      Somma ore
 sum net        projects        it      Totale netto
-sum workunits  projects        it      Somma Unità di Lavoro
+sum workunits  projects        it      Somma Unità di Lavoro
 tahoma projects        it      Tahoma
 tax    projects        it      IVA
-that id has been used already !        projects        it      Questo ID è 
già stato utilizzato
+that id has been used already !        projects        it      Questo ID è già 
stato utilizzato
 the delivery note contains no items !  projects        it      La nota di 
Consegna non contiene nessun elemento!
 the invoice contains no items !        projects        it      La Fattura non 
Contiene nessun Elemento
 times new roman        projects        it      Times New Roman
-title can not exceed 255 characters in length !        projects        it      
Il Titolo nonpuò essere più lungo di 255 caratteri!
+title can not exceed 255 characters in length !        projects        it      
Il Titolo nonpuò essere più lungo di 255 caratteri!
 update delivery        projects        it      Modifica Consegna
 update invoice projects        it      Modifica Fattura
 user statistic projects        it      Statistica Utente
@@ -172,13 +172,13 @@
 work hours archive     projects        it      Archivio Ore Lavorate
 work hours list        projects        it      Lista Ore Lavoro
 work time      projects        it      Tempo di Lavoro
-workunit       projects        it      Unità di Lavoro
-workunits      projects        it      Unità di Lavoro
+workunit       projects        it      Unità di Lavoro
+workunits      projects        it      Unità di Lavoro
 written by:    projects        it      Srcitto da:
 you have entered an invalid date !     projects        it      E' stata 
inserita una data non valida!
 you have entered an invalid end date ! projects        it      E' stata 
inserita una data di fine non valida!
 you have entered an invalid start date !       projects        it      E' 
stata inserita una data d'inizio non valida!
-you have no customer selected !        projects        it      Non è stato 
selezionato il cliente!
-you have selected an invalid activity !        projects        it      E' 
stata selezionata una attività non valida!
+you have no customer selected !        projects        it      Non è stato 
selezionato il cliente!
+you have selected an invalid activity !        projects        it      E' 
stata selezionata una attività non valida!
 you have to create a delivery or invoice first !       projects        it      
Bisogna creare prima una consegna o una fattura!
 

Index: setup/phpgw_nl.lang
===================================================================
RCS file: /sources/phpgroupware/projects/setup/phpgw_nl.lang,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2

Index: setup/phpgw_pl.lang
===================================================================
RCS file: /sources/phpgroupware/projects/setup/phpgw_pl.lang,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- setup/phpgw_pl.lang 22 Feb 2006 09:20:45 -0000      1.4
+++ setup/phpgw_pl.lang 5 Dec 2006 19:40:45 -0000       1.5
@@ -1,21 +1,21 @@
 account        projects        pl      Konto
 accountancy    common  pl      
 active projects        pl      Aktywny
-activities     projects        pl      Działalności
-activities list        projects        pl      Lista działalności
-activity       projects        pl      Działalność
-activity id    projects        pl      ID Działalności
-activity %1 has been added !   projects        pl      Dodano działalność %1
-activity %1 has been updated ! projects        pl      Zaktualizowano 
działalność %1
-add activity   projects        pl      Dodaj działalność
+activities     projects        pl      Dzia³alno¶ci
+activities list        projects        pl      Lista dzia³alno¶ci
+activity       projects        pl      Dzia³alno¶æ
+activity id    projects        pl      ID Dzia³alno¶ci
+activity %1 has been added !   projects        pl      Dodano dzia³alno¶æ %1
+activity %1 has been updated ! projects        pl      Zaktualizowano 
dzia³alno¶æ %1
+add activity   projects        pl      Dodaj dzia³alno¶æ
 add hours      projects        pl      Dodaj godziny
 add job        projects        pl      Dodaj zadanie
 add project    projects        pl      Dodaj projekt
 add project hours      projects        pl      Dodaj godziny
 add work hours projects        pl      
-address book   projects        pl      Książka adresowa
+address book   projects        pl      Ksi±¿ka adresowa
 admin  projects        pl      Admininistracja
-administrator  projects        pl      Zarządzający
+administrator  projects        pl      Zarz±dzaj±cy
 all    projects        pl      Wszystko
 all delivery notes     projects        pl      Wszystkie dostawy
 all deliverys  projects        pl      Wszystkie dostawy
@@ -23,29 +23,29 @@
 all invoices   projects        pl      Wszystkie faktury
 all open hours projects        pl      Wszystkie otwarte godziny
 archive        projects        pl      Archiwum
-are you sure you want to delete this entry     projects        pl      Na 
pewno usunąć ten wpis?
+are you sure you want to delete this entry     projects        pl      Na 
pewno usun±æ ten wpis?
 arial  projects        pl      Arial
 bill per hour  projects        pl      
-bill per workunit      projects        pl      Wartość jednostki pracy
-billable activities    projects        pl      Wartość działalności
+bill per workunit      projects        pl      Warto¶æ jednostki pracy
+billable activities    projects        pl      Warto¶æ dzia³alno¶ci
 billed projects        pl      Rozliczone
 billed only    projects        pl      Tylko rozliczone
 billing        projects        pl      Rachunek
-bookable activities    projects        pl      Przypisana działalność
+bookable activities    projects        pl      Przypisana dzia³alno¶æ
 bookkeeper     projects        pl      
 bookkeeping    common  pl      
-budget projects        pl      Budżet
+budget projects        pl      Bud¿et
 calculate      projects        pl      Oblicz
 category       projects        pl      Kategoria
-closed projects        pl      Zamknięty
-coordinator    projects        pl      Prowadzący
+closed projects        pl      Zamkniêty
+coordinator    projects        pl      Prowadz±cy
 courier new    projects        pl      Courier New
-create delivery        projects        pl      Twórz dostawę
-create invoice projects        pl      Twórz fakturę
+create delivery        projects        pl      Twórz dostawê
+create invoice projects        pl      Twórz fakturê
 customer       projects        pl      Klient
 date   projects        pl      Data
 date due       projects        pl      Termin wykonania
-delete hours   projects        pl      Usuń godziny
+delete hours   projects        pl      Usuñ godziny
 deliveries     projects        pl      Dostawcy
 delivery       projects        pl      Dostawa
 delivery date  projects        pl      Data dostawy
@@ -54,29 +54,29 @@
 delivery note  projects        pl      Dostawy
 delivery note for project      projects        pl      
 delivery notes projects        pl      Dostawy
-delivery %1 has been created ! projects        pl      Utworzono dostawę %1
-delivery %1 has been updated ! projects        pl      Zaktualizowano dostawę 
%1
+delivery %1 has been created ! projects        pl      Utworzono dostawê %1
+delivery %1 has been updated ! projects        pl      Zaktualizowano dostawê 
%1
 description    projects        pl      Opis
 done   projects        pl      Gotowe
 edit   projects        pl      Edycja
-edit activity  projects        pl      Edycja działalności
+edit activity  projects        pl      Edycja dzia³alno¶ci
 edit hours     projects        pl      Edycja godzin
 edit project   projects        pl      Edycja projektu
-edit project administrator list        projects        pl      Edycja listy 
zarządzających projektem
+edit project administrator list        projects        pl      Edycja listy 
zarz±dzaj±cych projektem
 edit project bookkeeper list   projects        pl      
 edit project hours     projects        pl      Edycja godzin
 edit work hours        projects        pl      
 employee       projects        pl      Osoba
-end date       projects        pl      Zakończenie
-end time       projects        pl      Zakończenie
+end date       projects        pl      Zakoñczenie
+end time       projects        pl      Zakoñczenie
 ending date can not be after main projects ending date !       projects        
pl      
 entry date     projects        pl      Data wprowadzenia
-firstname      projects        pl      Imię
-generate activity id ? projects        pl      Wygenerować ID Działalności
-generate delivery id ? projects        pl      Wygenerować ID Dostawy?
-generate invoice id ?  projects        pl      Wygenerować ID Faktury?
-generate job id ?      projects        pl      Wygenerować ID Zadania?
-generate project id ?  projects        pl      Wygenerować ID Projektu?
+firstname      projects        pl      Imiê
+generate activity id ? projects        pl      Wygenerowaæ ID Dzia³alno¶ci
+generate delivery id ? projects        pl      Wygenerowaæ ID Dostawy?
+generate invoice id ?  projects        pl      Wygenerowaæ ID Faktury?
+generate job id ?      projects        pl      Wygenerowaæ ID Zadania?
+generate project id ?  projects        pl      Wygenerowaæ ID Projektu?
 georgia        projects        pl      Georgia
 helvetica      projects        pl      Helvetica
 hours  projects        pl      Godzin
@@ -84,10 +84,10 @@
 invoice date   projects        pl      Data faktury
 invoice for project    projects        pl      Faktura dla projektu
 invoice id     projects        pl      ID Faktury
-invoice layout projects        pl      Układ faktury
+invoice layout projects        pl      Uk³ad faktury
 invoice list   projects        pl      Lista faktur
-invoice %1 has been created !  projects        pl      Utworzono fakturę %1
-invoice %1 has been updated !  projects        pl      Zaktualizowano fakturę 
%1
+invoice %1 has been created !  projects        pl      Utworzono fakturê %1
+invoice %1 has been updated !  projects        pl      Zaktualizowano fakturê 
%1
 invoices       projects        pl      Faktury
 invoicing      projects        pl      
 job    projects        pl      Zadanie
@@ -97,13 +97,13 @@
 job has been added !   projects        pl      Dodano zadanie
 job has been updated ! projects        pl      Zaktualizowano zadanie
 job id projects        pl      ID Zadania
-job list       projects        pl      Lista zadań
+job list       projects        pl      Lista zadañ
 jobs   projects        pl      Zadania
-large  projects        pl      Duża
+large  projects        pl      Du¿a
 lastname       projects        pl      Nazwisko
 list hours     projects        pl      Lista godzin
-main project:  projects        pl      Główny projekt:
-minutes per workunit   projects        pl      Minut na jednostkę pracy
+main project:  projects        pl      G³ówny projekt:
+minutes per workunit   projects        pl      Minut na jednostkê pracy
 net    projects        pl      Netto
 new project    projects        pl      Nowy projekt
 nonactive      projects        pl      Nieaktywny
@@ -111,63 +111,63 @@
 open   projects        pl      Otwarte
 overall        projects        pl      Podsumowanie
 per    projects        pl      za
-per hour       projects        pl      na godzinę
-per workunit   projects        pl      za jednostkę pracy
-please choose activities for that project first !      projects        pl      
Proszę wybrać działalność dla projektu
-please enter a delivery id for that delivery ! projects        pl      Proszę 
podać ID Dostawy dla dostawy
-please enter a remark !        projects        pl      Proszę wpisać 
komentarz!
-please enter an id !   projects        pl      Proszę podać ID
-please enter an id for that activity ! projects        pl      Proszę podać 
ID Działalności
-please enter an invoice id for that invoice !  projects        pl      Proszę 
podać ID Faktury dla faktury
+per hour       projects        pl      na godzinê
+per workunit   projects        pl      za jednostkê pracy
+please choose activities for that project first !      projects        pl      
Proszê wybraæ dzia³alno¶æ dla projektu
+please enter a delivery id for that delivery ! projects        pl      Proszê 
podaæ ID Dostawy dla dostawy
+please enter a remark !        projects        pl      Proszê wpisaæ komentarz!
+please enter an id !   projects        pl      Proszê podaæ ID
+please enter an id for that activity ! projects        pl      Proszê podaæ ID 
Dzia³alno¶ci
+please enter an invoice id for that invoice !  projects        pl      Proszê 
podaæ ID Faktury dla faktury
 please enter the bill !        projects        pl      
-please enter the bill per workunit !   projects        pl      Proszę podać 
wartość jednostki pracy
-please enter the minutes per workunit !        projects        pl      Proszę 
podać liczbę minut na jednostkę czasu
-please select currency,tax and your address in preferences!    projects        
pl      Proszę wybrać walutę, podatek i swój adres w preferencjach
-please select your address in preferences!     projects        pl      Proszę 
wybrać swój adres w preferencjach
-please select your currency in preferences!    projects        pl      Proszę 
wybrać walutę w preferencjach
+please enter the bill per workunit !   projects        pl      Proszê podaæ 
warto¶æ jednostki pracy
+please enter the minutes per workunit !        projects        pl      Proszê 
podaæ liczbê minut na jednostkê czasu
+please select currency,tax and your address in preferences!    projects        
pl      Proszê wybraæ walutê, podatek i swój adres w preferencjach
+please select your address in preferences!     projects        pl      Proszê 
wybraæ swój adres w preferencjach
+please select your currency in preferences!    projects        pl      Proszê 
wybraæ walutê w preferencjach
 please set the minutes per workunit for each activity now !    projects        
pl      
 position       projects        pl      Pozycja
-print delivery projects        pl      Drukuj dostawę
-print invoice  projects        pl      Drukuj fakturę
+print delivery projects        pl      Drukuj dostawê
+print invoice  projects        pl      Drukuj fakturê
 project        projects        pl      Projekt
-project administration projects        pl      Zarządzanie projektem
-project archive        projects        pl      Archiwum projektów
+project administration projects        pl      Zarz±dzanie projektem
+project archive        projects        pl      Archiwum projektów
 project billing        projects        pl      Rozliczenie projektu
 project delivery       projects        pl      Przekazanie projektu
 project hours  projects        pl      Godziny
 project id     projects        pl      ID Projektu
-project list   projects        pl      Lista projektów
+project list   projects        pl      Lista projektów
 project name   projects        pl      Nazwa projektu
 project preferences    projects        pl      Preferencje projektu
 project statistic      projects        pl      Statystyka projektu
-project statistics     projects        pl      Statystyki projektów
+project statistics     projects        pl      Statystyki projektów
 project %1 %2 has been added ! projects        pl      Dodano projekt %1 %2
 project %1 %2 has been updated !       projects        pl      Zaktualizowano 
projekt %1 %2
 projects       common  pl      Projekty
 projects archive       projects        pl      Projekty archiwalne
-projects list  projects        pl      Lista projektów
+projects list  projects        pl      Lista projektów
 projects preferences   preferences     pl      Preferencje projektu
 remark projects        pl      Komentarz
-remark required        projects        pl      Wymagać komentarza?
-return to projects     projects        pl      Powrót do projektów
-select category        projects        pl      Wybierz kategorię
+remark required        projects        pl      Wymagaæ komentarza?
+return to projects     projects        pl      Powrót do projektów
+select category        projects        pl      Wybierz kategoriê
 select customer        projects        pl      Wybierz klienta
-select font    projects        pl      Wybierz cziconkę
-select font size for customer address  projects        pl      Wybierz 
wielkość czcionki dla adresu klienta
-select font size for own address       projects        pl      Wybierz 
wielkość czcionki dla własnego adresu
+select font    projects        pl      Wybierz cziconkê
+select font size for customer address  projects        pl      Wybierz 
wielko¶æ czcionki dla adresu klienta
+select font size for own address       projects        pl      Wybierz 
wielko¶æ czcionki dla w³asnego adresu
 select groups  projects        pl      Wybierz grupy
-select main project    projects        pl      Wybierz projekt główny
+select main project    projects        pl      Wybierz projekt g³ówny
 select project projects        pl      Wybierz projekt
 select tax for work hours      projects        pl      Podatek od roboczogodzin
 select tax for workhours       projects        pl      Podatek od roboczogodzin
-select users   projects        pl      Wybierz użytkowników
-select your address    projects        pl      Wybierz swój adres
-short description      projects        pl      Krótki opis
-small  projects        pl      Mała
+select users   projects        pl      Wybierz u¿ytkowników
+select your address    projects        pl      Wybierz swój adres
+short description      projects        pl      Krótki opis
+small  projects        pl      Ma³a
 sorry, no preferences to set for you :)        projects        pl      
Niestety, nie ma preferencji do ustawienia przez Ciebie
-start date     projects        pl      Początek
+start date     projects        pl      Pocz±tek
 start date can not be before main projects start date !        projects        
pl      
-start time     projects        pl      Początek
+start time     projects        pl      Pocz±tek
 statistic      projects        pl      Statystyka
 statistics     projects        pl      Statystyki
 status projects        pl      Status
@@ -178,27 +178,27 @@
 sum workunits  projects        pl      Suma jednostek pracy
 tahoma projects        pl      Tahoma
 tax    projects        pl      Podatek
-that activity id has been used already !       projects        pl      Ten ID 
Działalności już istnieje
-that delivery id has been used already !       projects        pl      Ten ID 
Dostawy już istnieje
-that id has been used already !        projects        pl      Podany ID jest 
już używany
-that invoice id has been used already !        projects        pl      Ten ID 
Faktury już istnieje
-there are no entries   projects        pl      Nie ma wpisów!
+that activity id has been used already !       projects        pl      Ten ID 
Dzia³alno¶ci ju¿ istnieje
+that delivery id has been used already !       projects        pl      Ten ID 
Dostawy ju¿ istnieje
+that id has been used already !        projects        pl      Podany ID jest 
ju¿ u¿ywany
+that invoice id has been used already !        projects        pl      Ten ID 
Faktury ju¿ istnieje
+there are no entries   projects        pl      Nie ma wpisów!
 time   projects        pl      Czas
 times new roman        projects        pl      Times New Roman
-title  projects        pl      Tytuł
+title  projects        pl      Tytu³
 update projects        pl      Aktualizuj
-update delivery        projects        pl      Aktualizuj dostawę
-update invoice projects        pl      Aktualizuj fakturę
+update delivery        projects        pl      Aktualizuj dostawê
+update invoice projects        pl      Aktualizuj fakturê
 update project projects        pl      Aktualizuj projekt
-user statistic projects        pl      Statystyka użytkownika
-user statistics        projects        pl      Statystyki użytkowników
-username       projects        pl      Nazwa użytkownika
-username / group       projects        pl      Nazwa użytkownika/Grupa
+user statistic projects        pl      Statystyka u¿ytkownika
+user statistics        projects        pl      Statystyki u¿ytkowników
+username       projects        pl      Nazwa u¿ytkownika
+username / group       projects        pl      Nazwa u¿ytkownika/Grupa
 verdana        projects        pl      Verdana
-very large     projects        pl      Bardzo duża
-very small     projects        pl      Bardzo mała
-view job       projects        pl      Pogląd zadania
-view project   projects        pl      Pogląd projektu
+very large     projects        pl      Bardzo du¿a
+very small     projects        pl      Bardzo ma³a
+view job       projects        pl      Pogl±d zadania
+view project   projects        pl      Pogl±d projektu
 view work hours        projects        pl      
 work date      projects        pl      Dni
 work hours     projects        pl      Roboczogodziny
@@ -208,10 +208,10 @@
 workunit       projects        pl      Jednostka pracy
 workunits      projects        pl      Jednostki pracy
 written by:    projects        pl      
-you have entered an invalid delivery date !    projects        pl      
Podałeś niepoprawną datę dostawy
-you have entered an invalid end date ! projects        pl      Podałeś 
niepopraną datę zakończenia projektu
-you have entered an invalid invoice date !     projects        pl      
Podałeś niepoprawną datę faktury
-you have entered an invalid start date !       projects        pl      
Podałeś niepoprawną datę rozpoczęcia projektu
-you have no customer selected !        projects        pl      Nie wybrałeś 
klienta
-you have selected an invalid activity !        projects        pl      
Wybrałeś niewłaściwą działalność
-you have to create a delivery or invoice first !       projects        pl      
Najpierw musisz utworzyć dostawę lub fakturę
+you have entered an invalid delivery date !    projects        pl      Poda³e¶ 
niepoprawn± datê dostawy
+you have entered an invalid end date ! projects        pl      Poda³e¶ 
niepopran± datê zakoñczenia projektu
+you have entered an invalid invoice date !     projects        pl      Poda³e¶ 
niepoprawn± datê faktury
+you have entered an invalid start date !       projects        pl      Poda³e¶ 
niepoprawn± datê rozpoczêcia projektu
+you have no customer selected !        projects        pl      Nie wybra³e¶ 
klienta
+you have selected an invalid activity !        projects        pl      
Wybra³e¶ niew³a¶ciw± dzia³alno¶æ
+you have to create a delivery or invoice first !       projects        pl      
Najpierw musisz utworzyæ dostawê lub fakturê

Index: setup/phpgw_pt.lang
===================================================================
RCS file: /sources/phpgroupware/projects/setup/phpgw_pt.lang,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- setup/phpgw_pt.lang 22 Feb 2006 09:21:55 -0000      1.6
+++ setup/phpgw_pt.lang 5 Dec 2006 19:40:45 -0000       1.7
@@ -1,247 +1,165 @@
-account        projects        pt      Cliente
-accountancy    common  pt      Contabilidade
-active projects        pt      Ativo
-activities     projects        pt      Atividade
-activities list        projects        pt      Activities list
-activity       projects        pt      Atividade
-activity %1 has been added !   projects        pt      Atividade %1 foi 
adicionada.
-activity %1 has been updated ! projects        pt      Atividade %1 foi 
atualizada.
-activity id    projects        pt      ID da atividade
-add activity   projects        pt      Adicionar atividade
-add job        projects        pt      Adicionar trabalho
-add milestone  projects        pt      Adicionar marco
-add project    projects        pt      Adicionar projeto
-add project hours      projects        pt      Adionar horas do projeto
-add work hours projects        pt      Adicionar horas de trabalho
-address book   projects        pt      Contatos
-administrator  projects        pt      Administrador
-all    projects        pt      Todos
-all delivery notes     projects        pt      Todas notas de entregas
-all invoices   projects        pt      Todas faturas
-anonymous public       projects        pt      Público para anônimos
+accountancy    common  pt      Accountancy
+Account        projects        pt      Account
+Active projects        pt      Active
+Activities list        projects        pt      Activities list
+Activities     projects        pt      Activities
+Activity ID    projects        pt      Activity ID
+Activity       projects        pt      Activity
+Activity %1 has been added !   projects        pt      Activity %1 has been 
added !
+Activity %1 has been updated ! projects        pt      Activity %1 has been 
updated !
+Add Activity   projects        pt      Add activity
+Add job        projects        pt      Add job
+Add project hours      projects        pt      Add project hours
+Add project    projects        pt      Add project
+Add work hours projects        pt      Add work hours
+Administrator  projects        pt      Administrator
+All delivery notes     projects        pt      ALL delivery notes
+All invoices   projects        pt      All invoices
+All    projects        pt      All
 archive        projects        pt      Arquivo
-are you sure you want to delete this activity  projects        pt      Você 
tem certeza que deseja remover esta atividade ?
-are you sure you want to delete this project   projects        pt      Você 
tem certeza que deseja remover este projeto ?
 arial  projects        pt      Arial
+Billable activities    projects        pt      Billable activities
+Billed only    projects        pt      Billed only
+billed projects        pt      cobrado
+Billing        projects        pt      Billing
 bill per hour  projects        pt      Taxa por hora
-bill per hour/workunit projects        pt      Taxa por hora/unidade de 
trabalho
-bill per workunit      projects        pt      Taxa por unidade de trabalho
-billable activities    projects        pt      Atividades cobradas
-billed projects        pt      Cobrado
-billed only    projects        pt      Billed only
-billing        projects        pt      Cobrando
-bookable activities    projects        pt      Atividades contabilizadas
+Bill per workunit      projects        pt      Bill per workunit
+Bookable activities    projects        pt      Bookable activities
 bookkeeper     projects        pt      Contabilidade
-bookkeeping    common  pt      Contabilizando
-budget projects        pt      Orçamento
-budget main project    projects        pt      Orçamento de todo projeto
-budget sum of all sub projects is bigger than the budget of the main project   
projects        pt      A soma dos orçamentos dos sub projetos é maior que o 
orçamento do projeto todo !
-calculate      projects        pt      Calcular
+bookkeeping    common  pt      bookkeeping
+Budget projects        pt      Budget
+Calculate      projects        pt      Calculate
 closed projects        pt      Fechado
-company        projects        pt      Empresa
-coordinator    common  pt      Coordenador
+Coordinator    projects        pt      Coordinator
 courier new    projects        pt      Courier New
-create delivery        projects        pt      Criar entrega
-create invoice projects        pt      Criar fatura
-creator        projects        pt      Criador
-customer       projects        pt      Cliente
-date created   projects        pt      Data Criação
-delete hours   projects        pt      Remover horas
-deliveries     projects        pt      Entregas
-delivery       projects        pt      Entrega
-delivery %1 has been created ! projects        pt      Entrega %1 foi criada.
-delivery %1 has been updated ! projects        pt      Entrega %1 foi 
atualizada.
-delivery date  projects        pt      Data de entrega
-delivery id    projects        pt      ID da entrega
-delivery list  projects        pt      Lista de entregas
-delivery note  projects        pt      Nota de entrega
-delivery note for project      projects        pt      Nota de entrega para 
projeto
-delivery notes projects        pt      Notas de entrega
-description can not exceed 255 characters in length !  projects        pt      
Descrição não pode ultrapassar 255 caracteres !
-description can not exceed 8000 characters in length ! projects        pt      
Descrição não pode ultrapassar 8000 caracteres !
-do you also want to delete all sub projects ?  projects        pt      Você  
gostaria de apagar todos os sub-projetos também ?
-edit activity  projects        pt      Editar atividade
-edit administrator list        projects        pt      Editar lista de 
administradores do projeto
-edit bookkeeper list   projects        pt      Editar lista de contabilidade 
do projeto
-edit job       projects        pt      Editar trabalho
-edit milestone projects        pt      Editar marco
-edit project   projects        pt      Editar projeto
-edit project administrator list        projects        pt      Edit project 
administrator list
+Create delivery        projects        pt      Create delivery
+Create invoice projects        pt      Create invoice
+customer       projects        pt      Customer
+Delete hours   projects        pt      Delete hours
+Deliveries     projects        pt      Deliveries
+Delivery date  projects        pt      Delivery date
+Delivery ID    projects        pt      Delivery ID
+Delivery list  projects        pt      Delivery list
+delivery note for project      projects        pt      Delivery note for 
project
+Delivery note  projects        pt      Delivery note
+Delivery notes projects        pt      Delivery notes
+Delivery       projects        pt      Delivery
+Delivery %1 has been created ! projects        pt      Delivery %1 has been 
created !
+Delivery %1 has been updated ! projects        pt      Delivery %1 has been 
updated !
+Edit Activity  projects        pt      Edit activity
+Edit project administrator list        projects        pt      Edit project 
administrator list
 edit project bookkeeper list   projects        pt      Editar lista de 
contabilidades de projetos
-edit project hours     projects        pt      Editar horas do projeto
-edit work hours        projects        pt      Editar horas de trabalho
-employee       projects        pt      Empregado
-employees      projects        pt      Empregados
-enable acl for invoicing section       common  pt      Habilitar controle de 
acesso para seção de faturamento
-ending date can not be after main projects ending date projects        pt      
Data de término não pode ser posterior a data de fim do projeto
-ending date can not be after main projects ending date !       projects        
pt      Ending date can not be after main projects ending date !
-ending date can not be before start date       projects        pt      Data de 
término não pode ser depois da data de início !
-error in calculation sum does not match !      projects        pt      Erro no 
cálculo, soma não confere !
-exactly accounting     projects        pt      Contabilidade exata
-generate activity id ? projects        pt      Gerar ID de Atividade
-generate delivery id ? projects        pt      Gerar ID de Entrega
-generate invoice id ?  projects        pt      Generate Invoice ID ?
-generate job id ?      projects        pt      Gerar ID de Trabalho
-generate project id ?  projects        pt      Gerar ID de Projeto
+Edit project hours     projects        pt      Edit project hours
+Edit project   projects        pt      Edit project
+Edit work hours        projects        pt      Edit work hours
+Employee       projects        pt      Employee
+Ending date can not be after main projects ending date !       projects        
pt      Ending date can not be after main projects ending date !
+Generate Activity ID ? projects        pt      Generate Activity ID ?
+Generate Delivery ID ? projects        pt      Generate Delivery ID ?
+Generate Invoice ID ?  projects        pt      Generate Invoice ID ?
+Generate Job ID ?      projects        pt      Generate Job ID ?
+Generate Project ID ?  projects        pt      Generate Project ID ?
 georgia        projects        pt      Georgia
 helvetica      projects        pt      Helvetica
-hours  projects        pt      Horas
-id can not exceed 19 characters in length      projects        pt      ID não 
pode exceder 19 caracteres !
-id can not exceed 25 characters in length      projects        pt      ID não 
pode exceder 25 caracteres !
-if you are an administrator, please set the preferences for this application   
projects        pt      Se você é um administrador, por favor defina as 
preferências para esta aplicação !
-if you are not an administrator, please inform the administrator to set the 
preferences for this application   projects        pt      Se você não é um 
administrador, por favor informe o administrador para definir as preferências 
para esta aplicação !
-investment nr  projects        pt      Número do Investimento
-invoice        projects        pt      Fatura
-invoice %1 has been created !  projects        pt      Fatura %1 foi criada.
-invoice %1 has been updated !  projects        pt      Fatura %1 foi atualizada
-invoice date   projects        pt      Data de fatura
-invoice for project    projects        pt      Fatura par o projeto
-invoice id     projects        pt      ID da Fatura
-invoice layout projects        pt      Layout da fatura
-invoice list   projects        pt      Lista de Faturas
-invoices       projects        pt      Faturas
-invoicing      common  pt      Faturamento
-invoicing of work time projects        pt      Fatura de tempo de trabalho
-job    projects        pt      Trabalho
-job archive    projects        pt      Arquivo de trabalhos
-job date       projects        pt      Data do trabalho
-job description        projects        pt      Descrição do trabalho
-job has been added !   projects        pt      Trabalho foi adicionado.
-job has been updated ! projects        pt      Trabalho foi atualizado
-job id projects        pt      ID do trabalho
-job list       projects        pt      Lista de trabalhos
-jobs   common  pt      Trabalhos
+Hours  projects        pt      Hours
+Invoice date   projects        pt      Invoice date
+invoice for project    projects        pt      Invoice for project
+Invoice ID     projects        pt      Invoice ID
+Invoice layout projects        pt      Invoice layout
+Invoice list   projects        pt      Invoice list
+Invoice        projects        pt      Invoice
+Invoices       projects        pt      Invoices
+Invoice %1 has been created !  projects        pt      Invoice %1 has been 
created !
+Invoice %1 has been updated !  projects        pt      Invoice %1 has been 
updated !
+invoicing      projects        pt      Invoicing
+job archive    projects        pt      Arquivo de tarefas
+Job date       projects        pt      Job date
+Job description        projects        pt      Job description
+Job has been added !   projects        pt      Job has been added !
+Job has been updated ! projects        pt      Job has been updated !
+Job ID projects        pt      Job ID
+Job list       projects        pt      Job list
+Job    projects        pt      Job
+Jobs   projects        pt      Jobs
 large  projects        pt      Large
-last update    projects        pt      Última atualização
-list activities        projects        pt      Últimas atividades
-list budget    projects        pt      Listar orçamento
-list deliveries        projects        pt      Listar entregas
-list invoices  projects        pt      Listar faturas
-list jobs      projects        pt      Listar trabalhos
-list pcosts    projects        pt      Listar plano de custos
-list projects  projects        pt      Listar projetos
-list work hours        projects        pt      Listar horas de trabalho
-main project   projects        pt      Projeto todo
-main project:  projects        pt      Projeto todo:
-milestones     common  pt      Marcos
-minutes per workunit   projects        pt      MInutos por unidade de trabalho
-month  projects        pt      Mês
+Main project:  projects        pt      Main project:
+Minutes per workunit   projects        pt      Minutes per workunit
 net    projects        pt      rede
-new project    projects        pt      Novo projeto
-nonactive      common  pt      Inativo
-notifications  projects        pt      notificações
-number projects        pt      Número
+New project    projects        pt      New project
+Nonactive      projects        pt      Nonactive
+Number projects        pt      Number
 open   projects        pt      Em aberto
-open popup window      projects        pt      Abrir janela popup
-overall        projects        pt      Overall
-parent project projects        pt      Projeto pai
-parent project:        projects        pt      Projeto pai:
-pcosts can not be higher than the budget       projects        pt      Custos 
planejados não pode ser maior que o orçamento !
+Overall        projects        pt      Overall
 per hour       projects        pt      por hora
-per hour/workunit      projects        pt      por hora/unidade de trabalho
-per workunit   projects        pt      por unidade de trabalho
-planned costs  projects        pt      Custo planejado
-planned time   projects        pt      Tempo planjedo
-planned time sum of all sub projects is bigger than the planned time of the 
main project       projects        pt      Tempo planejado para todos os sub 
projetos é maior que o tempo planejado para todo o projeto
-please choose a project coordinator    projects        pt      Escolha um 
coordenador par o projeto !
-please choose activities for that project first !      projects        pt      
Please choose activities for that project first !
-please choose activities for the project       projects        pt      Escolha 
atividades para o projeto !
-please enter a remark !        projects        pt      Please enter a remark !
-please enter an id !   projects        pt      Digite um ID !
-please enter the bill  projects        pt      Digite uma taxa !
-please enter the bill !        projects        pt      Please enter the bill !
-please enter the minutes per workunit  projects        pt      Digite os 
minutos por unidade de trabalho !
-please enter the minutes per workunit !        projects        pt      Please 
enter the minutes per workunit !
-please set the minutes per workunit for each activity now !    projects        
pt      Please set the minutes per workunit for each activity now !
-please set your preferences for this application !     projects        pt      
Defina suas preferências para esta aplicação
-please specify country and currency in the global preferences section  
projects        pt      Por favor, especifique o pais e a moeda nas seção de 
preferências globais !
-please specify the budget      projects        pt      Especifique o 
orçamento !
-position       projects        pt      Posição
-preferences for accountancy    projects        pt      Preferências para 
contabilidade
-previous project       projects        pt      Projeto anterior
-print delivery projects        pt      Imprimir entrega
-print invoice  projects        pt      Print invoice
-processor      projects        pt      Processador
-project        projects        pt      Projeto
-project %1 has been saved      projects        pt      projeto %1 foi salvo
-project archive        projects        pt      Arquivo do projeto
-project billing        projects        pt      Orçamento do projeto
-project delivery       projects        pt      Entrega do projeto
-project id     common  pt      ID do projeto
-project list   projects        pt      Lista de projetos
-project name   projects        pt      Nome do projeto
-project preferences    projects        pt      Preferências do projeto
-project statistic      projects        pt      Estatística do projeto
-project statistics     projects        pt      Estatísticas do projeto
+per workunit   projects        pt      por uni. de trabalho
+Please choose activities for that project first !      projects        pt      
Please choose activities for that project first !
+Please enter an ID !   projects        pt      Please enter an ID !
+Please enter a remark !        projects        pt      Please enter a remark !
+Please enter the bill !        projects        pt      Please enter the bill !
+Please enter the minutes per workunit !        projects        pt      Please 
enter the minutes per workunit !
+Please set the minutes per workunit for each activity now !    projects        
pt      Please set the minutes per workunit for each activity now !
+Position       projects        pt      Position
+Print delivery projects        pt      Print delivery
+Print invoice  projects        pt      Print invoice
+Project archive        projects        pt      Project archive
+Project billing        projects        pt      Project billing
+Project delivery       projects        pt      Project delivery
+Project ID     projects        pt      Project ID
+Project list   projects        pt      Project list
+Project name   projects        pt      Project name
+Project preferences    projects        pt      Project preferences
+Project        projects        pt      Project
 projects       common  pt      Projetos
-projects preferences   preferences     pt      Preferências dos Projetos
-remark projects        pt      Observação
-remark can not exceed 8000 characters in length !      projects        pt      
Observação não pode exceder 8000 caracteres !
-remark required        projects        pt      Observação obrigatória
+projects preferences   preferences     pt      Preferências dos Projetos
+Project statistic      projects        pt      Project statistic
+project statistics     projects        pt      Estatísticas do projeto
+Remark projects        pt      Remark
+Remark required        projects        pt      Remark required
+select font    projects        pt      Select font
+Select font size for customer address  projects        pt      Select font 
size for customer address
+Select font size for own address       projects        pt      Select font 
size for own address
+Select groups  projects        pt      Select groups
+Select main project    projects        pt      Select main project
+Select project projects        pt      Select project
 select projects        pt      Selecione
-select font    projects        pt      Selecionar fonte
-select font size for customer address  projects        pt      Selecionar 
tamanho da fonte para endereço de cliente
-select font size for own address       projects        pt      Selecionar 
tamanho da fonte para seu endereço
-select groups  projects        pt      Selecionar grupos
-select main project    projects        pt      Selecionar projeto todo
-select own address     projects        pt      Selecionar seu endereço
-select project projects        pt      Selecionar projeto
-select tax for work time       projects        pt      Selecionar taxa para 
hora de trabalho
-select tax for workhours       projects        pt      Select tax for workhours
-select users   projects        pt      Selecionar usuários
-select your address    projects        pt      Select your address
-settings       admin   pt      Configurações
-short description      projects        pt      Descrição resumida
-small  projects        pt      Pequeno
-sorry, no preferences to set for you   projects        pt      Desculpe, 
definição de preferências para você :)
-sorry, no preferences to set for you :)        projects        pt      
Desculpe, nenhuma preferência para definir para você :)
-start date can not be before main projects start date  projects        pt      
Data de início não pode ser anterior à data de início do projeto !
-start date can not be before main projects start date !        projects        
pt      Start date can not be before main projects start date !
-statistic      projects        pt      Estatística
-statistics     projects        pt      Estatísticas
-sum    projects        pt      Somar
-sum budget     projects        pt      Somar orçamento
-sum hours      projects        pt      Somar horas
+Select tax for workhours       projects        pt      Select tax for workhours
+Select users   projects        pt      Select users
+Select your address    projects        pt      Select your address
+Short description      projects        pt      Short description
+small  projects        pt      Small
+Sorry, no preferences to set for you :)        projects        pt      
Desculpe, nenhuma preferência para definir para você :)
+Start date can not be before main projects start date !        projects        
pt      Start date can not be before main projects start date !
+Statistic      projects        pt      Statistic
+statistics     projects        pt      Statistics
+sum hours      projects        pt      Sum hours
 sum net        projects        pt      Soma de rede
-sum pcosts     projects        pt      Somar custos planejados
-sum workunits  projects        pt      Sum workunits
+Sum    projects        pt      Sum
+Sum workunits  projects        pt      Sum workunits
 tahoma projects        pt      Tahoma
 tax    projects        pt      Taxa
-that id has been used already !        projects        pt      Essa ID já foi 
usada !
-the choosen previous project does not have an end date specified       
projects        pt      O projeto anterior selecionado não possui uma data de 
fim definida !
-the delivery note contains no items !  projects        pt      A nota de envio 
não contém itens !
-the invoice contains no items !        projects        pt      A fatura não 
contém itens !
-time planned   projects        pt      Tempo planejado
-time planned main project      projects        pt      Tempo planejado do 
projeto
-time used      projects        pt      Tempo utilzado
+That ID has been used already !        projects        pt      That ID has 
been used already !
 times new roman        projects        pt      Times New Roman
-title can not exceed 255 characters in length  projects        pt      Título 
não pode ultrapassar 255 caracteres !
-update delivery        projects        pt      Atualizar entrega
-update invoice projects        pt      Update invoice
-user statistic projects        pt      Estatística do usuário
-user statistics        projects        pt      Estatísticas de usuários
-username / group       projects        pt      Usuário / Grupo
+Update delivery        projects        pt      Update delivery
+Update invoice projects        pt      Update invoice
+Username / Group       projects        pt      Username / Group
+User statistic projects        pt      User statistic
+user statistics        projects        pt      Estatísticas de usuários
 verdana        projects        pt      Verdana
-very large     projects        pt      Muito grande
-very small     projects        pt      Muito pequeno
-view job       projects        pt      Ver trabalho
-view project   projects        pt      Ver projeto
-view work hours        projects        pt      Ver horas de trabalho
-work date      projects        pt      Work date
-work hours     projects        pt      Horas de trabalho
-work hours archive     projects        pt      Arquivo de horas de trabalho
-work hours list        projects        pt      Listar horas de trabalho
-work time      projects        pt      Work time
-workunit       projects        pt      Workunit
-workunits      projects        pt      Workunits
-would you like to get notified via email about changes of milestones date due  
projects        pt      Você gostaria de ser notificado por email sobre 
alterações nas datas dos marcos ?
-would you like to get notified via email about changes of tasks        
projects        pt      Você gostaria de ser notificado por email sobre 
alterações nas tarefas ?
-would you like to get notified via email about dates due       projects        
pt      Você gostaria de ser notificado por email sobre datas planejadas ?
-would you like to get notified via email if you get assigned to a project      
projects        pt      Você gostaria de ser notificado por email se você for 
atribuído para um projeto ?
+very large     projects        pt      Very Large
+very small     projects        pt      Very Small
+View job       projects        pt      View job
+View project   projects        pt      View project
+View work hours        projects        pt      View work hours
+Work date      projects        pt      Work date
+Work hours archive     projects        pt      Work hours archive
+Work hours list        projects        pt      Work hours list
+Work hours     projects        pt      Work hours
+Work time      projects        pt      Work time
+Workunit       projects        pt      Workunit
+Workunits      projects        pt      Workunits
 written by:    projects        pt      Escrito por:
-you have entered an invalid date !     projects        pt      Você digitou 
uma data inválida
-you have entered an invalid end date ! projects        pt      Você digitou 
uma data inválida !
-you have entered an invalid start date !       projects        pt      Você 
digitou uma data de início inválida !
-you have no customer selected !        projects        pt      Você não 
selecionou um cliente !
-you have selected an invalid activity !        projects        pt      Você 
selecionou uma atividade inválida !
-you have to create a delivery or invoice first !       projects        pt      
You have to CREATE a delivery or invoice first !
+You have entered an invalid end date ! projects        pt      You have 
entered an invalid end date !
+You have entered an invalid start date !       projects        pt      You 
have entered an invalid start date !
+You have no customer selected !        projects        pt      You have no 
customer selected !
+You have selected an invalid activity !        projects        pt      You 
have selected an invalid activity !
+You have to CREATE a delivery or invoice first !       projects        pt      
You have to CREATE a delivery or invoice first !

Index: setup/phpgw_sv.lang
===================================================================
RCS file: /sources/phpgroupware/projects/setup/phpgw_sv.lang,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4

Index: setup/setup.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/setup/setup.inc.php,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- setup/setup.inc.php 11 Mar 2006 23:20:49 -0000      1.60
+++ setup/setup.inc.php 5 Dec 2006 19:40:45 -0000       1.61
@@ -1,21 +1,19 @@
 <?php
-       /**
-       * Project Manager - Setup
-       *
-       * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @package projects
-       * @subpackage setup
-       * @version $Id: setup.inc.php,v 1.60 2006/03/11 23:20:49 skwashd Exp $
-       * $Source: /sources/phpgroupware/projects/setup/setup.inc.php,v $
-       */
+  /*************************************************************************\
+  * phpGroupWare Setup - Projects                                           *
+  * http://www.phpgroupware.org                                             *
+  * --------------------------------------------                            *
+  * 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.                                              *
+  \*************************************************************************/
+  /* $Id: setup.inc.php,v 1.61 2006/12/05 19:40:45 sigurdne Exp $ */
 
        $setup_info['projects']['name']      = 'projects';
-       $setup_info['projects']['version']   = '0.8.7.049';
+       $setup_info['projects']['version']   = '0.8.7.055';
        $setup_info['projects']['app_order'] = 13;
        $setup_info['projects']['enable']    = 1;
-       $setup_info['projects']['app_group']    = 'office';
 
        $setup_info['projects']['author'] = array
        (
@@ -44,7 +42,8 @@
                'phpgw_p_ttracker',
                'phpgw_p_events',
                'phpgw_p_alarm',
-               'phpgw_p_surcharges'
+               'phpgw_p_surcharges',
+               'phpgw_p_locations'
        );
 
 /* The hooks this app includes, needed for hooks registration */
@@ -54,6 +53,7 @@
                'preferences',
                'admin',
                'manual',
+               'add_def_pref',
                'deleteaccount',
                'home',
                'sidebox_menu'
@@ -67,30 +67,30 @@
        $setup_info['projects']['depends'][] = array
        (
                 'appname' => 'phpgwapi',
-                'versions' => Array('0.9.17', '0.9.18')
+                'versions' => Array('0.9.16','0.9.17','0.9.18')
        );
 
        $setup_info['projects']['depends'][] = array
        (
                 'appname' => 'admin',
-                'versions' => Array('0.9.17', '0.9.18')
+                'versions' => Array('0.9.16','0.9.17')
        );
 
        $setup_info['projects']['depends'][] = array
        (
                 'appname' => 'preferences',
-                'versions' => Array('0.9.17', '0.9.18')
+                'versions' => Array('0.9.16','0.9.17')
        );
 
        $setup_info['projects']['depends'][] = array
        (
                 'appname' => 'addressbook',
-                'versions' => Array('0.9.17', '0.9.18')
+                'versions' => Array('0.9.16','0.9.17')
        );
 
        $setup_info['projects']['depends'][] = array
        (
                 'appname' => 'email',
-                'versions' => Array('0.9.13', '0.9.17', '0.9.18')
+                'versions' => Array('0.9.13','0.9.17')
        );
 ?>

Index: setup/tables_baseline.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/setup/tables_baseline.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- setup/tables_baseline.inc.php       9 Apr 2005 22:36:30 -0000       1.3
+++ setup/tables_baseline.inc.php       5 Dec 2006 19:40:45 -0000       1.4
@@ -1,15 +1,14 @@
 <?php
-       /**
-       * Project Manager - Setup
-       *
-       * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @package projects
-       * @subpackage setup
-       * @version $Id: tables_baseline.inc.php,v 1.3 2005/04/09 22:36:30 ceb 
Exp $
-       * $Source: 
/sources/phpgroupware/projects/setup/tables_baseline.inc.php,v $
-       */
+       
/**************************************************************************\
+       * phpGroupWare - Setup                                                  
   *
+       * http://www.phpgroupware.org                                           
   *
+       * --------------------------------------------                          
   *
+       * 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.                                            
   *
+       
\**************************************************************************/
+       /* $Id: tables_baseline.inc.php,v 1.4 2006/12/05 19:40:45 sigurdne Exp 
$ */
 
        $phpgw_baseline = array(
                'p_projects' => array(

Index: setup/tables_current.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/setup/tables_current.inc.php,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- setup/tables_current.inc.php        9 Apr 2005 22:36:30 -0000       1.47
+++ setup/tables_current.inc.php        5 Dec 2006 19:40:45 -0000       1.48
@@ -1,15 +1,18 @@
 <?php
-       /**
-       * Project Manager - Setup
-       *
-       * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @package projects
-       * @subpackage setup
-       * @version $Id: tables_current.inc.php,v 1.47 2005/04/09 22:36:30 ceb 
Exp $
-       * $Source: 
/sources/phpgroupware/projects/setup/tables_current.inc.php,v $
-       */
+       
/**************************************************************************\
+       * phpGroupWare - Setup                                                  
   *
+       * http://www.phpgroupware.org                                           
   *
+       * --------------------------------------------                          
   *
+       *  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 file should be generated for you. It should never be edited by 
hand *
+       
\**************************************************************************/
+       /* $Id: tables_current.inc.php,v 1.48 2006/12/05 19:40:45 sigurdne Exp 
$ */
 
        $phpgw_baseline = array(
                'phpgw_p_projects' => array(
@@ -46,6 +49,7 @@
                                'quality' => array('type' => 'text','nullable' 
=> True),
                                'accounting' => array('type' => 
'varchar','precision' => 8,'nullable' => True),
                                'acc_factor' => array('type' => 
'decimal','precision' => 20,'scale' => 2,'default' => 0,'nullable' => False),
+                               'acc_type' => array('type' => 
'char','precision' => 1,'default' => 'T','nullable' => False),
                                'billable' => array('type' => 
'char','precision' => 1,'default' => 'N','nullable' => False),
                                'psdate' => array('type' => 'int','precision' 
=> 4,'default' => 0,'nullable' => False),
                                'pedate' => array('type' => 'int','precision' 
=> 4,'default' => 0,'nullable' => False),
@@ -58,7 +62,8 @@
                                'discount_type' => array('type' => 
'varchar','precision' => 7,'nullable' => True),
                                'plan_bottom_up' => array('type' => 
'char','precision' => 1,'default' => 'N','nullable' => False),
                                'customer_org' => array('type' => 
'int','precision' => 4,'default' => 0,'nullable' => False),
-                               'direct_work' => array('type' => 
'char','precision' => 1,'default' => 'Y','nullable' => False)
+                               'direct_work' => array('type' => 
'char','precision' => 1,'default' => 'Y','nullable' => False),
+                               'salesmanager' => array('type' => 
'int','precision' => 4,'default' => 0,'nullable' => false)
                        ),
                        'pk' => array('project_id'),
                        'fk' => array(),
@@ -132,7 +137,8 @@
                                'sdate' => array('type' => 'int','precision' => 
4,'default' => 0,'nullable' => False),
                                'edate' => array('type' => 'int','precision' => 
4,'default' => 0,'nullable' => False),
                                'weekly_workhours' => array('type' => 
'decimal','precision' => 20,'scale' => 2,'default' => 0,'nullable' => True),
-                               'cost_centre' => array('type' => 
'int','precision' => 4,'default' => 0,'nullable' => True)
+                               'cost_centre' => array('type' => 
'int','precision' => 4,'default' => 0,'nullable' => True),
+                               'location_id' => array('type' => 
'int','precision' => 4,'default' => 0,'nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),
@@ -270,6 +276,18 @@
                        'fk' => array(),
                        'ix' => array(),
                        'uc' => array()
+               ),
+               'phpgw_p_locations' => array(
+                       'fd' => array(
+                               'location_id'      => array('type' => 
'auto','nullable' => False),
+                               'location_name'    => array('type' => 
'varchar','precision' => 255,'nullable' => False),
+                               'location_ident'   => array('type' => 
'varchar','precision' => 255,'nullable' => True),
+                               'location_custnum' => array('type' => 
'varchar','precision' => 255,'nullable' => True)
+                       ),
+                       'pk' => array('location_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
                )
        );
 ?>

Index: setup/tables_update.inc.php
===================================================================
RCS file: /sources/phpgroupware/projects/setup/tables_update.inc.php,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- setup/tables_update.inc.php 9 Apr 2005 22:36:30 -0000       1.54
+++ setup/tables_update.inc.php 5 Dec 2006 19:40:45 -0000       1.55
@@ -1,15 +1,14 @@
 <?php
-       /**
-       * Project Manager - Setup
-       *
-       * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @package projects
-       * @subpackage setup
-       * @version $Id: tables_update.inc.php,v 1.54 2005/04/09 22:36:30 ceb 
Exp $
-       * $Source: /sources/phpgroupware/projects/setup/tables_update.inc.php,v 
$
-       */
+       
/**************************************************************************\
+       * phpGroupWare - Setup                                                  
   *
+       * http://www.phpgroupware.org                                           
   *
+       * --------------------------------------------                          
   *
+       * 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.                                            
   *
+       
\**************************************************************************/
+       /* $Id: tables_update.inc.php,v 1.55 2006/12/05 19:40:45 sigurdne Exp $ 
*/
 
        function projects_table_exists($table)
        {
@@ -162,12 +161,15 @@
                
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_p_projects','title',array('type'
 => 'varchar','precision' => 255,'nullable' => False));
                
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_p_projects','num',array('type'
 => 'varchar','precision' => 20,'nullable' => False));
                
$GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_p_projects',$newtabledefinition,'access');
-               $GLOBALS['phpgw_setup']->oProc->query("CREATE INDEX 
phpgw_p_projects_key ON phpgw_p_projects(id,num)");
+//             $GLOBALS['phpgw_setup']->oProc->query("CREATE INDEX 
phpgw_p_projects_key ON phpgw_p_projects(id,num)");
+               
$GLOBALS['phpgw_setup']->oProc->CreateIndex(array('id','num'),'phpgw_p_projects');
+
 
                
$GLOBALS['phpgw_setup']->oProc->RenameTable('p_activities','phpgw_p_activities');
                
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_p_activities','descr',array('type'
 => 'varchar','precision' => 255,'nullable' => False));
                
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_p_activities','num',array('type'
 => 'varchar','precision' => 20,'nullable' => False));
-               $GLOBALS['phpgw_setup']->oProc->query("CREATE INDEX 
phpgw_p_activities_key ON phpgw_p_activities(id,num)");
+//             $GLOBALS['phpgw_setup']->oProc->query("CREATE INDEX 
phpgw_p_activities_key ON phpgw_p_activities(id,num)");
+               
$GLOBALS['phpgw_setup']->oProc->CreateIndex(array('id','num'),'phpgw_p_activities');
 
                
$GLOBALS['phpgw_setup']->oProc->RenameTable('p_projectactivities','phpgw_p_projectactivities');
                
$GLOBALS['phpgw_setup']->oProc->RenameTable('p_hours','phpgw_p_hours');
@@ -175,13 +177,15 @@
 
                
$GLOBALS['phpgw_setup']->oProc->RenameTable('p_invoice','phpgw_p_invoice');
                
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_p_invoice','num',array('type'
 => 'varchar','precision' => 20,'nullable' => False));
-               $GLOBALS['phpgw_setup']->oProc->query("CREATE INDEX 
phpgw_p_invoice_key ON phpgw_p_invoice(id,num)");
+//             $GLOBALS['phpgw_setup']->oProc->query("CREATE INDEX 
phpgw_p_invoice_key ON phpgw_p_invoice(id,num)");
+               
$GLOBALS['phpgw_setup']->oProc->CreateIndex(array('id','num'),'phpgw_p_invoice');
 
                
$GLOBALS['phpgw_setup']->oProc->RenameTable('p_invoicepos','phpgw_p_invoicepos');
 
                
$GLOBALS['phpgw_setup']->oProc->RenameTable('p_delivery','phpgw_p_delivery');
                
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_p_delivery','num',array('type'
 => 'varchar','precision' => 20,'nullable' => False));
-               $GLOBALS['phpgw_setup']->oProc->query("CREATE INDEX 
phpgw_p_delivery_key ON phpgw_p_delivery(id,num)");
+//             $GLOBALS['phpgw_setup']->oProc->query("CREATE INDEX 
phpgw_p_delivery_key ON phpgw_p_delivery(id,num)");
+               
$GLOBALS['phpgw_setup']->oProc->CreateIndex(array('id','num'),'phpgw_p_delivery');
 
                
$GLOBALS['phpgw_setup']->oProc->RenameTable('p_deliverypos','phpgw_p_deliverypos');
 
@@ -248,9 +252,13 @@
        $test[] = '0.8.4.006';
        function projects_upgrade0_8_4_006()
        {
-               $GLOBALS['phpgw_setup']->oProc->query("CREATE UNIQUE INDEX 
project_num ON phpgw_p_projects(num)");
-               $GLOBALS['phpgw_setup']->oProc->query("CREATE UNIQUE INDEX 
invoice_num ON phpgw_p_invoice(num)");
-               $GLOBALS['phpgw_setup']->oProc->query("CREATE UNIQUE INDEX 
delivery_num ON phpgw_p_delivery(num)");
+//             $GLOBALS['phpgw_setup']->oProc->query("CREATE UNIQUE INDEX 
project_num ON phpgw_p_projects(num)");
+//             $GLOBALS['phpgw_setup']->oProc->query("CREATE UNIQUE INDEX 
invoice_num ON phpgw_p_invoice(num)");
+//             $GLOBALS['phpgw_setup']->oProc->query("CREATE UNIQUE INDEX 
delivery_num ON phpgw_p_delivery(num)");
+
+               
$GLOBALS['phpgw_setup']->oProc->CreateIndex(array('num'),'phpgw_p_projects');
+               
$GLOBALS['phpgw_setup']->oProc->CreateIndex(array('num'),'phpgw_p_invoice');
+               
$GLOBALS['phpgw_setup']->oProc->CreateIndex(array('num'),'phpgw_p_delivery');
 
                $GLOBALS['setup_info']['projects']['currentver'] = '0.8.5.001';
                return $GLOBALS['setup_info']['projects']['currentver'];
@@ -636,7 +644,7 @@
        $test[] = '0.8.7.019';
        function projects_upgrade0_8_7_019()
        {
-               $GLOBALS['phpgw_setup']->oProc->query('alter table 
phpgw_p_projects drop INDEX p_number');
+//             $GLOBALS['phpgw_setup']->oProc->query('alter table 
phpgw_p_projects drop INDEX p_number');
                
$GLOBALS['phpgw_setup']->oProc->RenameColumn('phpgw_p_projects','id','project_id');
                $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.020';
                return $GLOBALS['setup_info']['projects']['currentver'];
@@ -722,7 +730,7 @@
                                                'event'         => 'changes of 
project data');
 
 
-               while (is_array($events) && list(,$val) = each($events))
+               while (is_array($events) && (list($not_used,$val) = 
each($events)))
                {
                        $GLOBALS['phpgw_setup']->oProc->query("INSERT into 
phpgw_p_events (event_name,event_type) values('" . $val['event'] . "','" . 
$key['type'] . "')",__LINE__,__FILE__);
                }
@@ -804,7 +812,8 @@
        $test[] = '0.8.7.030';
        function projects_upgrade0_8_7_030()
        {
-               $GLOBALS['phpgw_setup']->oProc->query('CREATE UNIQUE INDEX 
project_id on phpgw_p_projects(project_id)');
+//             $GLOBALS['phpgw_setup']->oProc->query('CREATE UNIQUE INDEX 
project_id on phpgw_p_projects(project_id)');
+               
$GLOBALS['phpgw_setup']->oProc->CreateIndex(array('project_id'),'phpgw_p_projects');
 
                $newdef = array(
                        'fd' => array(
@@ -913,6 +922,7 @@
        $test[] = '0.8.7.036';
        function projects_upgrade0_8_7_036()
        {
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_projects','plan_bottom_up',array('type'
 => 'char','precision' => 1,'default' => 'N','nullable' => False));
                
$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_p_surcharges',array
                (
                        'fd' => array
@@ -943,7 +953,8 @@
        $test[] = '0.8.7.038';
        function projects_upgrade0_8_7_038()
        {
-               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_projects','plan_bottom_up',array('type'
 => 'char','precision' => 1,'default' => 'N','nullable' => False));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_projectmembers','weekly_workhours',array('type'
 => 'decimal','precision' => 20,'scale' => 2,'default' => 0,'nullable' => 
True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_projectmembers','cost_centre',array('type'
 => 'int','precision' => 4,'default' => 0,'nullable' => True));
 
                $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.039';
                return $GLOBALS['setup_info']['projects']['currentver'];
@@ -961,8 +972,7 @@
        $test[] = '0.8.7.040';
        function projects_upgrade0_8_7_040()
        {
-               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_projectmembers','weekly_workhours',array('type'
 => 'decimal','precision' => 20,'scale' => 2,'default' => 0,'nullable' => 
True));
-               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_projectmembers','cost_centre',array('type'
 => 'int','precision' => 4,'default' => 0,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_hours','booked',array('type' 
=> 'char','precision' => 1,'default' => 'N','nullable' => False));
 
                $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.041';
                return $GLOBALS['setup_info']['projects']['currentver'];
@@ -980,7 +990,6 @@
        $test[] = '0.8.7.042';
        function projects_upgrade0_8_7_042()
        {
-               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_hours','booked',array('type' 
=> 'char','precision' => 1,'default' => 'N','nullable' => False));
 
                $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.043';
                return $GLOBALS['setup_info']['projects']['currentver'];
@@ -989,7 +998,7 @@
        $test[] = '0.8.7.043';
        function projects_upgrade0_8_7_043()
        {
-               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_ttracker','billable',array('type'
 => 'char','precision' => 1,'nullable' => False));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_ttracker','billable',array('type'
 => 'char','precision' => 1,'nullable' => false));
 
                $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.044';
                return $GLOBALS['setup_info']['projects']['currentver'];
@@ -1001,15 +1010,15 @@
                // correct project acls
                $GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_acl SET 
acl_appname='project_members' WHERE acl_appname='projects' AND 
acl_rights='7'",__LINE__,__FILE__);
 
-               // correct pro_main values in p_hours - fails with mysql 3.23.55
+               // correct pro_main values in p_hours
                $GLOBALS['phpgw_setup']->oProc->query("update phpgw_p_projects, 
phpgw_p_hours set phpgw_p_hours.pro_main = phpgw_p_projects.main where 
phpgw_p_projects.project_id = phpgw_p_hours.project_id and 
phpgw_p_projects.main != phpgw_p_hours.pro_main",__LINE__,__FILE__);
                
                // convert existing journey times in p_hours and p_ttracker 
from decimal h.m to minutes
                $GLOBALS['phpgw_setup']->oProc->query("update phpgw_p_hours set 
t_journey=FLOOR(t_journey)*60 + 
(t_journey-FLOOR(t_journey))*100",__LINE__,__FILE__);
                $GLOBALS['phpgw_setup']->oProc->query("update phpgw_p_ttracker 
set t_journey=FLOOR(t_journey)*60 + 
(t_journey-FLOOR(t_journey))*100",__LINE__,__FILE__);
 
-               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_p_hours','t_journey',array('type'
 => 'int','precision' => 4,'default' => 0,'nullable' => True));
-               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_p_ttracker','t_journey',array('type'
 => 'int','precision' => 4,'default' => 0,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_p_hours','t_journey',array('type'
 => 'int','precision' => 4,'default' => 0,'nullable' => true));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_p_ttracker','t_journey',array('type'
 => 'int','precision' => 4,'default' => 0,'nullable' => true));
 
                $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.045';
                return $GLOBALS['setup_info']['projects']['currentver'];
@@ -1018,7 +1027,44 @@
        $test[] = '0.8.7.045';
        function projects_upgrade0_8_7_045()
        {
-               $GLOBALS['phpgw_setup']->db->query('SELECT project_id, 
start_date, end_date, psdate, pedate FROM phpgw_p_projects');
+               /*
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'phpgw_p_locmap', array(
+                               'fd' => array(
+                                       'p_group'               => array('type' 
=> 'int','precision' => 4,'default' => 0,'nullable' => False),
+                                       'p_location'    => array('type' => 
'int','precision' => 4,'default' => 0,'nullable' => False),
+                                       'p_locprojnum'  => array('type' => 
'varchar','precision' => 255,'nullable' => False)
+                               ),
+                               'pk' => array(),
+                               'fk' => array('p_group'),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT into 
phpgw_p_locmap (p_group,p_location,p_locprojnum) 
values(103,1,'910186')",__LINE__,__FILE__); // Hannover
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT into 
phpgw_p_locmap (p_group,p_location,p_locprojnum) 
values(921,2,'910113')",__LINE__,__FILE__); // Berlin
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT into 
phpgw_p_locmap (p_group,p_location,p_locprojnum) 
values(123,3,'910166')",__LINE__,__FILE__); // Frankfurt / Böblingen 739
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT into 
phpgw_p_locmap (p_group,p_location,p_locprojnum) 
values(719,4,'910360')",__LINE__,__FILE__); // Düsseldorf
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT into 
phpgw_p_locmap (p_group,p_location,p_locprojnum) 
values(224,5,'910476')",__LINE__,__FILE__); // München
+               // $GLOBALS['phpgw_setup']->oProc->query("INSERT into 
phpgw_p_locmap (p_group,p_location,p_locprojnum) 
values(840,6,'')",__LINE__,__FILE__); // Hamburg
+
+               // Hannover D04 01 910186
+               // Berlin D04 01 910113
+               // Frankfurt/Böblingen D04 01 910166
+               // Düsseldorf D04 01 910360
+               // München D04 01 910476
+
+               $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.046';
+               */
+               return $GLOBALS['setup_info']['projects']['currentver'];
+       }
+
+       $test[] = '0.8.7.046';
+       function projects_upgrade0_8_7_046()
+       {
+               // update start_
+               $GLOBALS['phpgw_setup']->db->query("SELECT project_id, 
start_date, end_date, psdate, pedate FROM phpgw_p_projects");
                while($GLOBALS['phpgw_setup']->db->next_record())
                {
                        $pro_id   = 
intval($GLOBALS['phpgw_setup']->db->f('project_id'));
@@ -1043,27 +1089,19 @@
                                                                                
        . ' where project_id='.$pro_id ,__LINE__,__FILE__);
                }
 
-               $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.046';
-               return $GLOBALS['setup_info']['projects']['currentver'];
-       }
-
-
-       $test[] = '0.8.7.046';
-       function projects_upgrade0_8_7_046()
-       {
-               $GLOBALS['phpgw_setup']->oProc->query('CREATE INDEX 
project_id_3 ON phpgw_p_hours(project_id)');
-               $GLOBALS['phpgw_setup']->oProc->query('CREATE INDEX hours_start 
ON phpgw_p_hours(start_date)');
                $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.047';
                return $GLOBALS['setup_info']['projects']['currentver'];
        }
 
+
        $test[] = '0.8.7.047';
        function projects_upgrade0_8_7_047()
        {
-               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_projects','time_planned_childs',array('type'
 => 'int','precision' => 4,'default' => 0,'nullable' => False));
-               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_projects','budget_childs',array('type'
 => 'decimal','precision' => 20,'scale' => 2,'default' => 0,'nullable' => 
False));
-               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_projects','e_budget_childs',array('type'
 => 'decimal','precision' => 20,'scale' => 2,'default' => 0,'nullable' => 
True));
+               
$GLOBALS['phpgw_setup']->oProc->CreateIndex(array('project_id'),'phpgw_p_hours');
+               
$GLOBALS['phpgw_setup']->oProc->CreateIndex(array('start_date'),'phpgw_p_hours');
 
+//             $GLOBALS['phpgw_setup']->oProc->query('CREATE INDEX 
project_id_3 ON phpgw_p_hours(project_id)');
+//             $GLOBALS['phpgw_setup']->oProc->query('CREATE INDEX hours_start 
ON phpgw_p_hours(start_date)');
                $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.048';
                return $GLOBALS['setup_info']['projects']['currentver'];
        }
@@ -1071,73 +1109,75 @@
        $test[] = '0.8.7.048';
        function projects_upgrade0_8_7_048()
        {
-               $i = 0;
-               $GLOBALS['phpgw_setup']->db->query("SELECT account_id FROM 
phpgw_p_projectmembers where type='aa' or type='ma'");
-               while($GLOBALS['phpgw_setup']->db->next_record())
-               {
-                       $uadmins[$i] = 
$GLOBALS['phpgw_setup']->db->f('account_id');
-                       ++$i;
-               }
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_projects','time_planned_childs',array('type'
 => 'int','precision' => 4,'default' => 0,'nullable' => false));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_projects','budget_childs',array('type'
 => 'decimal','precision' => 20,'scale' => 2,'default' => 0,'nullable' => 
false));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_projects','e_budget_childs',array('type'
 => 'decimal','precision' => 20,'scale' => 2,'default' => 0,'nullable' => 
true));
 
-               $i = 0;
-               $GLOBALS['phpgw_setup']->db->query("SELECT account_id FROM 
phpgw_p_projectmembers where type='ag' or type='mg'");
-               while($GLOBALS['phpgw_setup']->db->next_record())
-               {
-                       $gadmins[$i] = 
$GLOBALS['phpgw_setup']->db->f('account_id');
-                       ++$i;
+               $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.049';
+               return $GLOBALS['setup_info']['projects']['currentver'];
                }
 
-               $i = 0;
-               $GLOBALS['phpgw_setup']->db->query("SELECT account_id FROM 
phpgw_p_projectmembers where type='sa'");
-               while($GLOBALS['phpgw_setup']->db->next_record())
+       $test[] = '0.8.7.049';
+       function projects_upgrade0_8_7_049()
                {
-                       $suser[$i] = 
$GLOBALS['phpgw_setup']->db->f('account_id');
-                       ++$i;
+               $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.051';
+               return $GLOBALS['setup_info']['projects']['currentver'];
                }
 
-               $i = 0;
-               $GLOBALS['phpgw_setup']->db->query("SELECT account_id FROM 
phpgw_p_projectmembers where type='sg'");
-               while($GLOBALS['phpgw_setup']->db->next_record())
+       $test[] = '0.8.7.051';
+       function projects_upgrade0_8_7_051()
                {
-                       $sgroup[$i] = 
$GLOBALS['phpgw_setup']->db->f('account_id');
-                       ++$i;
-               }
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'phpgw_p_locations', array(
+                               'fd' => array(
+                                       'location_id'      => array('type' => 
'auto','nullable' => False),
+                                       'location_name'    => array('type' => 
'varchar','precision' => 255,'nullable' => False),
+                                       'location_ident'   => array('type' => 
'varchar','precision' => 255,'nullable' => True),
+                                       'location_custnum' => array('type' => 
'varchar','precision' => 255,'nullable' => True)
+                               ),
+                               'pk' => array('location_id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
 
-               if(is_array($uadmins))
-               {
-                       foreach($uadmins as $null => $aa)
-                       {
-                               $GLOBALS['phpgw_setup']->db->query("INSERT into 
phpgw_acl values ('project_admin','user'," . $aa . ',1)',__LINE__,__FILE__);
-                       }
+               $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.052';
+               return $GLOBALS['setup_info']['projects']['currentver'];
                }
 
-               if(is_array($gadmins))
-               {
-                       foreach($gadmins as $null => $ag)
+       $test[] = '0.8.7.052';
+       function projects_upgrade0_8_7_052()
                        {
-                               $GLOBALS['phpgw_setup']->db->query("INSERT into 
phpgw_acl values ('project_admin','group'," . $ag . ',1)',__LINE__,__FILE__);
-                       }
-               }
+               $GLOBALS['phpgw_setup']->oProc->AddColumn(
+                       'phpgw_p_projectmembers',
+                       'location_id',
+                       array('type' => 'int','precision' => 4,'default' => 
0,'nullable' => True)
+               );
 
-               if(is_array($suser))
-               {
-                       foreach($suser as $null => $su)
-                       {
-                               $GLOBALS['phpgw_setup']->db->query("INSERT into 
phpgw_acl values ('project_salesman','user'," . $su . ',1)',__LINE__,__FILE__);
-                       }
+               $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.053';
+               return $GLOBALS['setup_info']['projects']['currentver'];
                }
 
-               if(is_array($sgroup))
+       $test[] = '0.8.7.053';
+       function projects_upgrade0_8_7_053()
                {
-                       foreach($sgroup as $null => $sg)
-                       {
-                               $GLOBALS['phpgw_setup']->db->query("INSERT into 
phpgw_acl values ('project_salesman','group'," . $sg . ',1)',__LINE__,__FILE__);
-                       }
-               }
+               $GLOBALS['phpgw_setup']->oProc->AddColumn(
+                       'phpgw_p_projects',
+                       'salesmanager',
+                       array('type' => 'int','precision' => 4,'default' => 
0,'nullable' => false)
+               );
 
-               $GLOBALS['phpgw_setup']->db->query("DELETE from 
phpgw_p_projectmembers where type='aa' or type='ag' or type='ma' or type='mg' 
or type='sa' or type='sg'",__LINE__,__FILE__);
+               $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.054';
+               return $GLOBALS['setup_info']['projects']['currentver'];
+       }
 
-               $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.049';
+       $test[] = '0.8.7.054';
+       function projects_upgrade0_8_7_054()
+       {
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_p_projects','acc_type',array('type'
 => 'char','precision' => 1,'default' => 'T','nullable' => False));
+               $GLOBALS['setup_info']['projects']['currentver'] = '0.8.7.054';
                return $GLOBALS['setup_info']['projects']['currentver'];
        }
+
 ?>

Index: templates/base/addressbook.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/addressbook.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/addressbook.tpl      27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/addressbook.tpl      5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: addressbook.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: addressbook.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" 
"http://www.w3.org/TR/REC-html40/loose.dtd";>
 <HTML LANG="en">
 <head>

Index: templates/base/archive.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/archive.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/archive.tpl  27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/archive.tpl  5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: archive.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: archive.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <center>

Index: templates/base/booked.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/booked.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/booked.tpl   27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/booked.tpl   5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: booked.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: booked.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <center>

Index: templates/base/config.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/config.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/config.tpl   27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/config.tpl   5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: config.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: config.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 <!-- BEGIN header -->
 <br/>
 

Index: templates/base/config_locations.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/config_locations.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/config_locations.tpl 27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/config_locations.tpl 5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: config_locations.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: config_locations.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 <center>
 <table border="0" cellpadding="2" cellspacing="2" align="center">
        <tr height="5"><td></td></tr>

Index: templates/base/controlling_import_result.tpl
===================================================================
RCS file: 
/sources/phpgroupware/projects/templates/base/controlling_import_result.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/controlling_import_result.tpl        27 Nov 2006 13:36:03 
-0000      1.1
+++ templates/base/controlling_import_result.tpl        5 Dec 2006 19:40:45 
-0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: controlling_import_result.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp 
$ -->
+<!-- $Id: controlling_import_result.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp 
$ -->
 {app_header}
 <div class="projects_content"></div>
 <table width="100%" cellpadding="2" cellspacing="2" align="center">

Index: templates/base/delete.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/delete.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/delete.tpl   27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/delete.tpl   5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: delete.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: delete.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"</div>
 <center>

Index: templates/base/export_diamant.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/export_diamant.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/export_diamant.tpl   27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/export_diamant.tpl   5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: export_diamant.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: export_diamant.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <table border="0" cellspacing="2" cellpadding="2">

Index: templates/base/form.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/form.tpl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- templates/base/form.tpl     31 Mar 2005 23:00:22 -0000      1.5
+++ templates/base/form.tpl     5 Dec 2006 19:40:45 -0000       1.6
@@ -1,14 +1,129 @@
-<!-- $Id: form.tpl,v 1.5 2005/03/31 23:00:22 ceb Exp $ -->
-
+<!-- $Id: form.tpl,v 1.6 2006/12/05 19:40:45 sigurdne Exp $ -->
+<script language="JavaScript">
+       var parent_project_members = new Array();
+       {parent_project_members}
+
+       function writeOptions(tagname, myarray)
+       {
+               selectbox = document.getElementById(tagname);
+               if(!selectbox)
+                       return;
+
+               for(i=0; i < myarray.length; i++)
+               {
+                       myoption = new Option(myarray[i][0], myarray[i][1], 
true);
+                       exists = false;
+                       for(j=0; j < selectbox.options.length; j++)
+                       {
+                               if (selectbox.options[j].value == myarray[i][1])
+                               {
+                                       exists = true;
+                                       j = selectbox.options.length;
+                               }
+                       }
+                       if(!exists)
+                       {
+                               selectbox.options[selectbox.length] = myoption;
+                               selectbox.options[(selectbox.length - 
1)].selected = true;
+                       }
+               }
+       }
+
+       function getParentMember(tagname)
+       {
+               writeOptions(tagname, parent_project_members);
+       }
+
+       function selectAll(tagname)
+       {
+               selectbox = document.getElementById(tagname);
+               if(!selectbox)
+                       return;
+
+               for(var i=0; i < selectbox.length; i++)
+               {
+                       selectbox.options[i].selected = true;
+               }
+       }
+
+       function clearFields(fieldlist)
+       {
+               for(var i=0; i < fieldlist.length; i++)
+               {
+                       document.getElementById(fieldlist[i]).value = '';
+               }
+       }
+       
+       function clearOptions(tagname)
+       {
+               selectbox = document.getElementById(tagname);
+               if(!selectbox)
+                       return;
+
+               for(var i=0; i < selectbox.length; i++)
+               {
+                       if(selectbox.options[i].selected == true)
+                       {
+                               selectbox.options[i] = null;
+                               --i;
+                       }
+               }
+       }
+       
+       function clearCustomer()
+       {
+               var customer_fields = Array('customernr', 'orgaid', 'organame', 
'customerid', 'customer');
+               clearFields(customer_fields);
+       }
+
+       function factor_calculator(type)
+       {
+               if(type == 'hour')
+               {
+                       document.getElementById('factor').value = 
document.getElementById('factor').value / 8;
+               }
+               else
+               {
+                       document.getElementById('factor').value = 
document.getElementById('factor').value * 8;
+               }
+       }
+
+       function switch_budget_type(type)
+       {
+               if(type == 'h')
+               {
+                       document.getElementById('hbudget').style.display = 
'block';
+                       document.getElementById('mbudget').style.display = 
'none';
+               }
+               else
+               {
+                       document.getElementById('mbudget').style.display = 
'block';
+                       document.getElementById('hbudget').style.display = 
'none';
+               }
+       }
+
+       function set_factortr()
+       {
+               if(document.getElementById('factortype').value == 'project')
+               {
+                       document.getElementById('td1').style.display = 'block';
+                       document.getElementById('td2').style.display = 'block';
+                       document.getElementById('td3').style.display = 'block';
+               }
+               else
+               {
+                       document.getElementById('td1').style.display = 'none';
+                       document.getElementById('td2').style.display = 'none';
+                       document.getElementById('td3').style.display = 'none';
+               }
+       }
+</script>
 {app_header}
-
-<center>
-<p>{message}</p>
+<div class="projects_content"></div>
+<center>{message}</center>
+<table width="100%" border="0" cellspacing="2" cellpadding="2">
 <form method="POST" name="app_form" action="{action_url}" 
enctype="multipart/form-data">
-
 <!-- BEGIN main -->
-
-<table width="100%" border="0" cellspacing="2" cellpadding="2">
        <tr bgcolor="{th_bg}">
                <td width="100%" colspan="7"><b>{lang_main}</b>:&nbsp;<a 
href="{main_url}">{pro_main}</a></td>
        </tr>
@@ -32,8 +147,9 @@
        </tr>
 </table>
 
+<table width="100%" border="0" cellspacing="2" cellpadding="2">
 <!-- END main -->
-
+</table>
 <div align="center">
 <table class="tabletab">
        <tr>
@@ -81,74 +197,56 @@
                                </tr>
                        </table>
                </th>
-
-<!-- BEGIN mstones_tab --> 
-
-               <th id="tab5" class="activetab" 
onclick="javascript:tab.display(5);">
-                       <table>
-                               <tr>
-                                       <td id="tweentab_l"></td>
-                                       <td>
-                                               <a href="#" tabindex="0" 
accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); 
return(false);">{lang_milestones}</a>
-                                       </td>
-                                       <td id="tweentab_r"></td>
-                               </tr>
-                       </table>
-               </th>
-
-<!-- END mstones_tab --> 
-
        </tr>
 </table>
 </div>
-
 <div id="tabcontent1" class="activetab">
 <table class="contenttab">
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_parent}:</td>
                <td>{parent_select}</td>
                <td>{lang_previous}:</td>
-               <td><select name="values[previous]">
-                                       <option value="">{lang_none}</option>
+               <td><div style="width:99%; overflow:hidden;"><select 
style="width:99%; overflow:hidden;" name="values[previous]">
+                                       <option value=""></option>
                                        {previous_select}
-                               </select>
+                               </select></div>
                        </td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td class="must">{lang_number}:</td>
-               <td><input type="text" name="values[number]" value="{number}" 
size="30" />&nbsp;{help_img}</td>
+               <td nowrap="nowrap"><input type="text" name="values[number]" 
value="{number}" size="30" />&nbsp;{help_img}</td>
                <td>{lang_choose}</td>
                <td>{choose}</td>
        </tr>
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td width="20%">{lang_investment_nr}:</td>
                <td width="30%"><input type="text" name="values[investment_nr]" 
value="{investment_nr}" size="30"></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td class="must">{lang_title}:</td>
                <td><input type="text" name="values[title]" size="30" 
value="{title}"></td>
-               <td>{lang_category}:</td>
-               <td><div id="hideme1">{cat}</div></td>
+               <td class="must">{lang_category}:</td>
+               <td><div style="width:99%; overflow:hidden;">{cat}</div></td>
        </tr>
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td valign="top">{lang_descr}:</td>
-               <td colspan="3"><textarea name="values[descr]" rows="4" 
cols="50" wrap="VIRTUAL">{descr}</textarea></td>
+               <td colspan="3"><textarea name="values[descr]" rows="1" 
cols="30" wrap="VIRTUAL">{descr}</textarea></td>
        </tr>
-       <tr class="row_off">
-               <td>{lang_start_date_planned}:</td>
+       <tr bgcolor="{row_off}">
+               <td class="must">{lang_start_date_planned}:</td>
                <td>{pstart_date_select}</td>
-               <td>{lang_date_due_planned}:</td>
+               <td class="must">{lang_date_due_planned}:</td>
                <td>{pend_date_select}</td>
        </tr>
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_start_date}:</td>
                <td>{start_date_select}</td>
-               <td>{lang_date_due}:</td>
+               <td>{lang_end_date}:</td>
                <td>{end_date_select}</td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_status}:</td>
                <td><select name="values[status]">{status_list}</select></td>
                <td valign="top">{lang_access}:</td>
@@ -157,30 +255,30 @@
                </td>
                <td>{access}</td>
        </tr>
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_priority}:</td>
                <td><select 
name="values[priority]">{priority_list}</select></td>
-               <td>&nbsp;</td>
-               <td>&nbsp;</td>
+               <td>{lang_milestones}</td>
+               <td>{edit_mstones_button}</td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_url}:</td>
-               <td>http://<input type="text" name="values[url]" size="30" 
value="{url}"></td>
+               <td>http://<input type="text" name="values[url]" size="25" 
value="{url}"></td>
                <td>{lang_reference}:</td>
-               <td>http://<input type="text" name="values[reference]" 
size="30" value="{reference}"></td>
+               <td>http://<input type="text" name="values[reference]" 
size="25" value="{reference}"></td>
        </tr>
 </table>
 </div>
 
 <div id="tabcontent2" class="activetab">
 <table  class="contenttab">
-       <tr class="row_on" style="font-weight: bold; text-align: center">
+       <tr bgcolor="{row_on}" style="font-weight: bold; text-align: center">
                <td colspan="2">{lang_customer}</td>
                <td colspan="2">{lang_project_team}</td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_customer_nr}:</td>
-               <td><input type="text" id="customernr" 
name="values[customer_nr]" size="10" value="{customer_nr}"></td>
+               <td><input style="width:95%;" type="text" id="customernr" 
name="values[customer_nr]" size="10" value="{customer_nr}"></td>
                <td class="must">{lang_coordinator}:</td>
                <td>
                        <!-- BEGIN clist -->
@@ -189,54 +287,109 @@
 
                        <!-- BEGIN cfield -->
                        <input type="hidden" id="cordinatorid" name="accountid" 
value="{accountid}">
-                       <input type="text" id="cordinator" name="accountname" 
size="20" value="{accountname}" readonly>
-                       <input type="button" value="{lang_select}" 
onClick="open_popup('{accounts_link}')" />
+                       <table border="0" cellspacing="0" cellpadding="1">
+                               <tr>
+                                       <td width="185"><input type="text" 
id="cordinator" name="accountname" style="width:175px;" value="{accountname}" 
readonly /></td>
+                                       <td width="105"><input type="button" 
style="width:100px;" value="{lang_select}" 
onClick="open_popup('{accounts_link}')" /></td>
+                                       <td>{tooltip_select_coordinator}</td>
+                               </tr>
+                       </table>
                        <!-- END cfield -->
                </td>
        </tr>
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_organization}:</td>
                <td>
-                       <input type="hidden" id="orgaid" name="customer_org" 
value="{customer_org}">
-                       <input type="text" id="organame" size="35" 
value="{customer_org_name}" readonly>
+                       <input type="hidden" id="orgaid" name="customer_org" 
value="{customer_org}" />
+                       <input type="text" id="organame" style="width:95%;" 
size="35" value="{customer_org_name}" readonly />
                </td>
                <td>{lang_employees}:</td>
                <td>
                        <!-- BEGIN elist -->
-                       <select name="employees[]" 
multiple>{employee_list}</select>
+                       <select style="width:150px;" name="employees[]" 
multiple>{employee_list}</select>
                        <!-- END elist -->
        
                        <!-- BEGIN efield -->
-                               <table border="0" cellpadding="0" 
cellspacing="2">
+                       <table border="0" cellspacing="0" cellpadding="1">
                                        <tr>
-                                               <td>
-                                                       <select id="staff" 
name="employees[]" multiple>{employee_list}</select>
-                                               </td>
-                                               <td valign="top"><input 
type="button" value="{lang_select}" 
onClick="open_popup('{e_accounts_link}');"></td>
+                                       <td rowspan="3" width="185" 
valign="top"><select style="width:175px;" id="staff" name="employees[]" 
size="4" multiple>{employee_list}</select></td>
+                                       <td width="105"><input 
style="width:100px;" type="button" value="{lang_adapt}" 
onClick="getParentMember('staff');"{parent_project_members_button_disable} 
/></td>
+                                       
<td>{tooltip_parent_project_members}</td>
+                               </tr>
+                               <tr>
+                                       <td width="105"><input 
style="width:100px;" type="button" value="{lang_select}" 
onClick="open_popup('{e_accounts_link}');"></td>
+                                       
<td>{tooltip_select_project_members}</td>
+                               </tr>
+                               <tr>
+                                       <td width="105"><input 
style="width:100px;" type="button" value="{lang_remove}" 
onClick="clearOptions('staff');"></td>
+                                       
<td>{tooltip_remove_project_members}</td>
                                        </tr>
                                </table>
                        <!-- END efield -->
                </td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_person}:</td>
                <td>
                        <input type="hidden" id="customerid" name="abid" 
value="{abid}">
-                       <input type="text"   id="customer" name="name" 
size="40" value="{name}" readonly></td>
+                       <input type="text"   id="customer" name="name" 
style="width:95%;" size="40" value="{name}" readonly></td>
                </td>
-               <td colspan="2"></td>
+               <td>{lang_salesmanager}:</td>
+               <td>
+                       <input type="hidden" id="salesmanagerid" 
name="salesmanagerid" value="{salesmanagerid}">
+                       <table border="0" cellspacing="0" cellpadding="1">
+                               <tr>
+                                       <td rowspan="2" width="185"><input 
type="text" id="salesmanager" name="salesmanagername" style="width:175px;" 
value="{salesmanagername}"></td>
+                                       <td width="105"><input type="button" 
style="width:100px;" value="{lang_select}" 
onClick="open_popup('{s_accounts_link}')" 
title="123&#164;{title_select_salesmanager}" readonly/></td>
+                                       <td>{tooltip_select_salesmanager}</td>
        </tr>
-       <tr class="row_on" align="center">
-               <td colspan="2"><input type="button" value="{lang_select}" 
onClick="open_popup('{addressbook_link}');" /></td>
+                               <tr>
+                                       <td width="105"><input 
style="width:100px;" type="button" value="{lang_remove}" 
onClick="clearFields(Array('salesmanagerid', 'salesmanager'));"></td>
+                                       <td>{tooltip_remove_salesmanager}</td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+       <tr bgcolor="{row_on}" align="center">
+               <td></td>
+               <td>
+                       <input type="button" value="{lang_select}" 
style="width:100px;" onClick="open_popup('{addressbook_link}');" />&nbsp;
+                       <input type="button" value="{lang_remove}" 
style="width:100px;" onClick="clearCustomer();">
+               </td>
                <td colspan="2">{edit_roles_events_button}</td>
        </tr>
+
+<!--begin rolefield1
+
+       <tr bgcolor="{row_off}">
+               <td valign="top">{lang_roles}:</td>
+               <td colspan="2">
+                       <table width="100%" border="0" cellspacing="2" 
cellpadding="2">
+
+end rolefield1
+begin rolelist
+
+                               <tr>
+                                       <td width="50%">{emp_name}</td>
+                                       <td width="50%">{role_name}</td>
+                               </tr>
+
+end rolelist
+
+begin rolefield2
+                               </table>
+               </td>
+               <td valign="top" align="right"><input type="submit" 
name="roles" value="{lang_edit_roles}"></td>
+       </tr>
+
+end rolefield2-->
 </table>
 </div>
 
 
 <div id="tabcontent3" class="activetab">
 <table class="contenttab">
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_plan_bottom_up}:</td>
                <td>
                        <input type="{plan_bottom_up_input_type}" 
name="values[plan_bottom_up]" 
value="{plan_bottom_up_input_value}"{plan_bottom_up_input_checked}>{plan_bottom_up_text}
@@ -245,7 +398,7 @@
                </td>
        </tr>
 
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_budget}:</td>
                <td>
                        <input type="radio" name="budgetradio" value="m" 
checked onMouseUp="switch_budget_type(this.value);">{lang_monetary}
@@ -261,7 +414,7 @@
                </td>
        </tr>
 
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_extra_budget}:</td>
                <td>
                </td>
@@ -272,12 +425,12 @@
 
 <!-- BEGIN accounting_act -->
 
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_bookable_activities}:</td>
                <td colspan="2"><select name="book_activities[]" 
multiple>{book_activities_list}</select></td>
        </tr>
 
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_billable_activities}:</td>
                <td colspan="2"><select name="bill_activities[]" 
multiple>{bill_activities_list}</select></td>
        </tr>
@@ -286,7 +439,7 @@
 
 <!-- BEGIN accounting_own -->
 
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td valign="top">{lang_accounting}:</td>
                <td valign="top" colspan="2">
                        <select id="factortype" name="values[accounting]" 
onChange="set_factortr()">
@@ -296,7 +449,7 @@
                        </select>
                </td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td class="must" style="white-space:nowrap; vertical-align:top">
                        <div id="td1">
                                {lang_accounting_factor_for_project}:
@@ -314,103 +467,69 @@
                        </div>
                </td>
        </tr>
-
 <!-- END accounting_own -->
        
-       <tr class="row_on">
-               <td valign="top">{lang_discount}:</td>  
-               <td valign="top">
-                       <select name="values[discount_type]">
-                               <option value="no" 
{dt_no}>{lang_nodiscount}</option>
-                               <option value="percent" 
{dt_percent}>{lang_percent}&nbsp;[%]</option>
-                               <option value="amount" 
{dt_amount}>{lang_amount}&nbsp;[{currency}.c]</option>
-                       </select>
-               </td>
-               <td>
-                       <input type="text" name="values[discount]" 
value="{discount}"></td>
-               </td>
-       </tr>
-
-       <tr class="row_off">
-               <td>{lang_direct_work}:</td>
-               <td colspan="2"><input type="{direct_work_input_type}" 
name="values[direct_work]" 
value="{direct_work_input_value}"{direct_work_input_checked}>{direct_work_text}</td>
-       </tr>
-
-       <tr class="row_on">
-               <td>{lang_non_billable}:</td>
-               <td colspan="2"><input type="checkbox" name="values[billable]" 
value="True" {acc_billable_checked}></td>
-       </tr>
-
-       <tr class="row_off">
+       <tr bgcolor="{row_on}">
                <td valign="top">{lang_invoicing_method}:</td>
                <td colspan="2">
                        <textarea name="values[inv_method]" rows="6" cols="50" 
wrap="VIRTUAL">{inv_method}</textarea>
                </td>
        </tr>
+
+{option_direct_work_handle}
+{option_not_billable_handle}
+{option_discount_handle}
+
 </table>
 </div>
 
 <div id="tabcontent4" class="activetab">
 <table class="contenttab">
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td valign="top">{lang_result}:</td>
                <td colspan="3"><textarea name="values[result]" rows="4" 
cols="50" wrap="VIRTUAL">{result}</textarea></td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td valign="top">{lang_test}:</td>
                <td colspan="3"><textarea name="values[test]" rows="4" 
cols="50" wrap="VIRTUAL">{test}</textarea></td>
        </tr>
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td valign="top">{lang_quality}:</td>
                <td colspan="3"><textarea name="values[quality]" rows="4" 
cols="50" wrap="VIRTUAL">{quality}</textarea></td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td valign="top">{lang_files}:</td>
                <td valign="top">{attachment}</td>
                <td valign="top">{lang_attach}:</td>
                <td valign="top"><input type="file" name="attachment" /></td>
        </tr>
-</table>
-</div>
 
-<!-- BEGIN mstones_tabcontent -->
+<!-- begin msfield1
 
-<div id="tabcontent5" class="activetab">
-<table class="contenttab">
-       <tr class="th">
-               <td>{lang_title}</td>
-               <td>{lang_date_due}</td>
-               <td width="16">&nbsp;</td>
-               <td width="16">&nbsp;</td>
+       <tr bgcolor="{row_on}">
+               <td valign="top">{lang_milestones}:</td>
+               <td colspan="2">
+                       <table width="100%" border="0" cellspacing="2" 
cellpadding="2">
+
+-- end msfield1 --
+-- begin mslist --
+
+                               <tr>
+                                       <td width="50%"><a 
href="{ms_edit_url}">{s_title}</a></td>
+                                       <td width="50%">{s_edateout}</td>
        </tr>
 
-       {list_mlist}
-
-       <tr height="50" valign="bottom">
-               <td><input type="text" name="vmstone[title]" size="35" 
value="{mstone_title}"></td>
-               <td>{mstone_end_date_select}</td>
-               <td colspan="2">
-                       <input type="hidden" name="vmstone[old_edate]" 
value="{mstone_old_edate}">
-                       <input type="hidden" name="vmstone[s_id]" 
value="{s_id}">
-                       <input type="submit" name="mstone_save" 
value="{lang_save_mstone}">
+-- end mslist --
+
+-- begin msfield2 --
+                               </table>
                </td>
+               <td valign="top" align="right"><input type="submit" 
name="mstone" value="{lang_add_mstone}"></td>
        </tr>
+end msfield2 -->
 </table>
 </div>
 
-<!-- END mstones_tabcontent -->
-
-<!-- BEGIN mstone_list -->
-
-       <tr class="{tr_color}">
-               <td><a href="{mstone_edit_url}">{mstone_title}</a></td>
-               <td>{mstone_datedue}</td>
-               <td align="center"><a 
href="{mstone_edit_url}">{edit_img}</a></td>
-               <td align="center"><a 
href="{mstone_delete_url}">{delete_img}</a></td>
-       </tr>
-
-<!-- END mstone_list -->
-
 <table width="100%" border="0" cellspacing="2" cellpadding="2">
        <tr valign="bottom" height="50" width="100%">
                <!--td width="25%">
@@ -420,22 +539,48 @@
                        <input type="hidden" name="values[old_coordinator]" 
value="{old_coordinator}">
                        <input type="submit" name="apply" value="{lang_apply}">
                </td-->
-               <td width="15%"><input type="submit" name="save" 
value="{lang_save}"></td>
-               <td width="35%"><input type="submit" name="apply" 
value="{lang_apply}"></td>
+               <td width="35%"><input type="submit" 
onClick="selectAll('staff'); return true;" name="save" value="{lang_save}" 
tabindex="1"></td>
+               <td width="30%" align="center">{delete_button}</td>
                <td width="35%" align="right"><input type="submit" 
name="cancel" value="{lang_cancel}"></td>
-               <td width="15%" align="right">{delete_button}</td>
        </tr>
-</table>
 </form>
-</center>
-</fieldset>
+</table>
 
 <script language="JavaScript1.1" type="text/javascript">
 <!--
-  var tab = new 
Tabs({number_Tabs},'activetab','inactivetab','tab','tabcontent','','','tabpage');
+  var tab = new 
Tabs(4,'activetab','inactivetab','tab','tabcontent','','','tabpage');
   tab.init();
   switch_budget_type('{budget_type}');
   set_factortr();
 // -->
 </script>
 
+<!-- BEGIN option_direct_work -->
+       <tr bgcolor="{row_off}">
+               <td>{lang_direct_work}:</td>
+               <td colspan="2"><input type="{direct_work_input_type}" 
name="values[direct_work]" 
value="{direct_work_input_value}"{direct_work_input_checked}>{direct_work_text}</td>
+       </tr>
+<!-- END option_direct_work -->
+
+<!-- BEGIN option_not_billable -->
+       <tr bgcolor="{row_on}">
+               <td>{lang_non_billable}:</td>
+               <td colspan="2"><input type="checkbox" name="values[billable]" 
value="True" {acc_billable_checked}></td>
+       </tr>
+<!-- END option_not_billable -->
+
+<!-- BEGIN option_discount -->
+       <tr bgcolor="{row_on}">
+               <td valign="top">{lang_discount}:</td>  
+               <td valign="top">
+                       <select name="values[discount_type]">
+                               <option value="no" 
{dt_no}>{lang_nodiscount}</option>
+                               <option value="percent" 
{dt_percent}>{lang_percent}&nbsp;[%]</option>
+                               <option value="amount" 
{dt_amount}>{lang_amount}&nbsp;[{currency}.c]</option>
+                       </select>
+               </td>
+               <td>
+                       <input type="text" name="values[discount]" 
value="{discount}"></td>
+               </td>
+       </tr>
+<!-- END option_discount -->

Index: templates/base/form_admin.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/form_admin.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2

Index: templates/base/form_emp_factor.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/form_emp_factor.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/form_emp_factor.tpl  27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/form_emp_factor.tpl  5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: form_emp_factor.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: form_emp_factor.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <center>

Index: templates/base/form_emp_roles.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/form_emp_roles.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/form_emp_roles.tpl   27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/form_emp_roles.tpl   5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: form_emp_roles.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: form_emp_roles.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <center>

Index: templates/base/formactivity.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/formactivity.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/formactivity.tpl     27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/formactivity.tpl     5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: formactivity.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: formactivity.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 <center>
 {pref_message}<br>{message}
 <table width="75%" border="0" cellspacing="2" cellpadding="2">

Index: templates/base/header.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/header.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/header.tpl   27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/header.tpl   5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: header.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: header.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 <!-- BEGIN projects_header -->
 <table border="0" width="100%" cellpadding="2" cellspacing="2">
        <tr width="100%">

Index: templates/base/home_list.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/home_list.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/home_list.tpl        27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/home_list.tpl        5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: home_list.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: home_list.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 
 <center>
 

Index: templates/base/hours_controlling.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/hours_controlling.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/hours_controlling.tpl        27 Nov 2006 13:36:03 -0000      
1.1
+++ templates/base/hours_controlling.tpl        5 Dec 2006 19:40:45 -0000       
1.2
@@ -1,4 +1,4 @@
-<!-- $Id: hours_controlling.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: hours_controlling.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <style type="text/css"><!--

Index: templates/base/hours_formhours.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/hours_formhours.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/hours_formhours.tpl  30 Mar 2005 15:53:38 -0000      1.1
+++ templates/base/hours_formhours.tpl  5 Dec 2006 19:40:45 -0000       1.2
@@ -1,9 +1,7 @@
-<!-- $Id: hours_formhours.tpl,v 1.1 2005/03/30 15:53:38 ceb Exp $ -->
-
+<!-- $Id: hours_formhours.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
-
+<div class="projects_content"></div>
 <center>{message}</center>
-
 <!-- BEGIN main -->
 <!--
 <table width="100%" border="0" cellspacing="2" cellpadding="2">
@@ -14,24 +12,24 @@
                <td style="height: 15px">
                </td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_project}:</td>
                <td>{project_name}</td>
                <td colspan="2"></td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_url}:</td>
                <td><a href="http://{url_main}"; 
target="_blank">{url_main}</a></td>
                <td>{lang_hours} {lang_planned}:</td>
                <td style="text-align: right">{ptime_main}</td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_customer}:</td>
                <td>{customer_main}</td>
                <td>{lang_used_total}{lang_plus_jobs}:</td>
                <td style="text-align: right">{utime_main}</td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_coordinator}:</td>
                <td>{coordinator_main}</td>
                <td>{lang_available}{lang_plus_jobs}:</td>
@@ -42,18 +40,20 @@
 -->
 <!-- END main -->
 
+<table width="100%" border="0" cellspacing="2" cellpadding="2">
 <form method="POST" action="{action_url}">
-<table width="100%" border="0" cellspacing="2" cellpadding="2" border="1">
 {hidden_vars}
 
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td style="font-weight: bold">{lang_employee}:</td>
-               <td colspan="3" style="font-weight: bold">{employee}</td>
+               <td style="font-weight: bold">{employee}</td>
+               <td style="font-weight: bold">{lang_project}:</td>
+               <td colspan="3" style="font-weight: bold"><select 
name="project_id">{project_options}</select></td>
        </tr>
 
-       <tr class="row_off" valign="top">
+       <tr bgcolor="{row_off}" valign="top">
                <td class="must">{lang_activity}:</td>
-               <td colspan="3">
+               <td>
 
 <!-- BEGIN activity -->
 
@@ -64,43 +64,45 @@
 <!-- BEGIN activity_own -->
 
                        <input type="text" name="values[hours_descr]" size="45" 
value="{hours_descr}">
-
 <!-- END activity_own -->
-
                </td>
+               <td colspan="2">&nbsp;</td>
+               <td colspan="2">&nbsp;</td>
        </tr>
 
-       <tr class="row_on">
-               <td valign="top">{lang_remark}:</td>
-               <td><textarea name="values[remark]" rows="8" cols="40" 
wrap="VIRTUAL">{remark}</textarea></td>
-
+       <tr bgcolor="{row_on}">
+               <td rowspan="6" valign="top">{lang_remark}:</td>
+               <td rowspan="6" valign="top"><textarea name="values[remark]" 
rows="5" cols="40" wrap="VIRTUAL">{remark}</textarea></td>
+               <td bgcolor="{row_off}" colspan="4" style="height: 1px">
+               </td>
+       </tr>
 
-               <td colspan="2">
-                       <table border="0" width="80%" cellpadding="2" 
cellspacing="2">
-                               <tr class="row_off">
+       <tr bgcolor="{row_on}">
 
 <!-- BEGIN booking_date -->
 
-                                       <td class="must">{lang_start_date}:</td>
+               <td>{lang_start_date}:</td>
                                        <td>{start_date_select}</td>
                                        <td>{lang_start_time}:</td>
-                                       <td>
-                                               <input type="text" 
name="values[shour]" value="{shour}" size="2" maxlength="2">&nbsp;:&nbsp;<input 
type="text" name="values[smin]" value="{smin}" size="2" 
maxlength="2">&nbsp;[hh:mm]&nbsp;{sradio}
+               <td nowrap="nowrap"
+                       <input type="text" name="values[shour]" value="{shour}" 
size="2" maxlength="2">&nbsp;:&nbsp;<input type="text" name="values[smin]" 
value="{smin}" size="2" maxlength="2">&nbsp;[hh:mm]
+                       &nbsp;{sradio}
                                        </td>
                                </tr>
-                               <tr class="row_off">
+       <tr bgcolor="{row_on}">
                                        <td>{lang_end_date}:</td>
                                        <td>{end_date_select}</td>
                                        <td>{lang_end_time}:</td>
-                                       <td>
-                                               <input type="text" 
name="values[ehour]" value="{ehour}" size="2" maxlength=2>&nbsp;:&nbsp;<input 
type="text" name="values[emin]" value="{emin}" size="2" 
maxlength="2">&nbsp;[hh:mm]&nbsp;{eradio}
+               <td nowrap="nowrap"
+                       <input type="text" name="values[ehour]" value="{ehour}" 
size="2" maxlength=2>&nbsp;:&nbsp;<input type="text" name="values[emin]" 
value="{emin}" size="2" maxlength="2">&nbsp;[hh:mm]
+                       &nbsp;{eradio}
                                        </td>
                                </tr>
-                               <tr class="row_off">
+       <tr bgcolor="{row_on}">
                                        <td colspan="2" 
class="must">{lang_hours}:</td>
-                                       <td colspan="2">
+               <td colspan="2" nowrap="nowrap">
                                                <input type="text" 
name="values[hours]" value="{hours}" size="2" maxlength="2">&nbsp;:&nbsp;<input 
type="text" name="values[minutes]" value="{minutes}" size="2" 
maxlength="2">&nbsp;[hh:mm]
-
+               </td>
                                
 <!-- END booking_date -->
 
@@ -109,66 +111,57 @@
                                        <td colspan="2" 
class="must">{lang_work_date}:</td>
                                        <td colspan="2">{start_date_select}</td>
                                </tr>
-                               <tr class="row_off">
+       <tr bgcolor="{row_on}">
                                        <td colspan="2" 
class="must">{lang_hours}:</td>
-                                       <td colspan="2">
+               <td colspan="2" nowrap="nowrap">
                                                <input type="text" 
name="values[hours]" value="{hours}" size="2" maxlength="2">&nbsp;:&nbsp;<input 
type="text" name="values[minutes]" value="{minutes}" size="2" 
maxlength="2">&nbsp;[hh:mm]
                                        </td>
                                </tr>
-                               <tr class="row_off">
+       <tr bgcolor="{row_on}">
                                        <td>{lang_start_time}:</td>
-                                       <td>
+               <td nowrap="nowrap">
                                                <input type="text" 
name="values[shour]" value="{shour}" size="2" maxlength="2">&nbsp;:&nbsp;<input 
type="text" name="values[smin]" value="{smin}" size="2" 
maxlength="2">&nbsp;[hh:mm]
                                                &nbsp;{sradio}
                                        </td>
                                        <td>{lang_end_time}:</td>
-                                       <td>
+               <td nowrap="nowrap">
                                                <input type="text" 
name="values[ehour]" value="{ehour}" size="2" maxlength=2>&nbsp;:&nbsp;<input 
type="text" name="values[emin]" value="{emin}" size="2" 
maxlength="2">&nbsp;[hh:mm]
                                                &nbsp;{eradio}
+               </td>
 
 <!-- END booking_time -->
 
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
        </tr>
 
-       <tr class="row_off">
-               <td colspan="4" style="height: 5px">
-               </td>
-       </tr>
-       
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_travel_time}:</td>
                <td><input type="text" name="values[t_journey_h]" 
value="{t_journey_h}" size="2" maxlength="2">&nbsp;:&nbsp;<input type="text" 
name="values[t_journey_m]" value="{t_journey_m}" size="2" 
maxlength="2">&nbsp;[hh:mm]</td>
                <td>{lang_distance}:</td>
                <td><input type="text" name="values[km_distance]" 
value="{km_distance}" size="5">&nbsp;[km]</td>
        </tr>
        
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td style="height: 5px" colspan="4"></td>
        </tr>
 
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_status}:</td>
-               <td colspan="3"><select 
name="values[status]">{status_list}</select></td>
+               <td colspan="5"><select 
name="values[status]">{status_list}</select></td>
        </tr>
        
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_non_billable}:</td>
                <td><input type="checkbox" name="values[billable]" value="True" 
{hours_billable_checked}></td>
-               <td>{lang_surcharge}:</td>
-               <td><select name="values[surcharge]"><option 
value="">{lang_select_surcharge}</option>{surcharge_list}</select></td>
+               <td colspan="2">{lang_surcharge}:</td>
+               <td colspan="2"><select name="values[surcharge]"><option 
value="">{lang_select_surcharge}</option>{surcharge_list}</select></td>
        </tr>
 
        <tr height="50">
                <td>{save}</td>
                <td><b>{booked}</b></td>
-               <td align="right"><input type="submit" name="cancel" 
value="{lang_cancel}"></td>
-               <td align="right">{delete}</td><!-- <input type="submit" 
name="save" value="{lang_save}"> -->
+               <td colspan="2" align="center">{delete}</td><!-- <input 
type="submit" name="save" value="{lang_save}"> -->
+               <td colspan="2" align="right"><input type="submit" 
name="cancel" value="{lang_cancel}"></td>
        </tr>
+       </form>
 </table>
-
-</form>
 </center>

Index: templates/base/hours_import_controlling.tpl
===================================================================
RCS file: 
/sources/phpgroupware/projects/templates/base/hours_import_controlling.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/hours_import_controlling.tpl 27 Nov 2006 13:36:03 -0000      
1.1
+++ templates/base/hours_import_controlling.tpl 5 Dec 2006 19:40:45 -0000       
1.2
@@ -1,4 +1,4 @@
-<!-- $Id: hours_import_controlling.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp 
$ -->
+<!-- $Id: hours_import_controlling.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp 
$ -->
 {app_header}
 <div class="projects_content"></div>
 <center>

Index: templates/base/hours_listhours.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/hours_listhours.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/hours_listhours.tpl  30 Mar 2005 15:53:38 -0000      1.1
+++ templates/base/hours_listhours.tpl  5 Dec 2006 19:40:45 -0000       1.2
@@ -1,7 +1,24 @@
-<!-- $Id: hours_listhours.tpl,v 1.1 2005/03/30 15:53:38 ceb Exp $ -->
+<!-- $Id: hours_listhours.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
+<script type="text/javascript">
+
+       function hideColumn (colIndex)
+       {
+               var table = document.all ? 
document.all.aTable:document.getElementById('aTable');
+               for (var r = 0; r < table.rows.length; r++)
+               table.rows[r].cells[colIndex].style.display = 'none';
+       }
+
+       function showColumn (colIndex)
+       {
+               var table = document.all ? 
document.all.aTable:document.getElementById('aTable');
+               for (var r = 0; r < table.rows.length; r++)
+               table.rows[r].cells[colIndex].style.display = '';
+       }
 
-{app_header}
 
+</script>
+{app_header}
+<div class="projects_content"></div>
 <!-- BEGIN project_main -->
 <!--
 <table border="0" width="100%" cellpadding="2" cellspacing="0">
@@ -39,27 +56,31 @@
 
 <center>{error}</center>
 
+
 <table border="0" width="100%" cellpadding="2" cellspacing="2">
        <form method="POST" action="{action_url}">
-       <tr style="vertical-align:top" width="100%">
-               <td width="15%" align="center">{lang_employee}</td>
-               <td width="35%" align="center">{lang_time}</td>
-               <td width="15%" align="center">{lang_status}</td>
-               <td width="15%" align="center">&nbsp;</td>
-               <td width="20%" align="right">{lang_search}</td>
+       <tr bgcolor="{th_bg}" style="vertical-align:top">
+               <td align="center">{lang_employee}</td>
+               <td align="center">{lang_start_date}</td>
+               <td align="center">{lang_end_date}</td>
+               <td align="center">{lang_status}</td>
+               <td align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+               <td align="center">{lang_search}</td>
        </tr>
-       <tr>
+       <tr bgcolor="{th_bg}">
                <td align="center">{filter_list}</td>
-               <td 
align="center"><nobr>{sdate_select}-&nbsp;{edate_select}</nobr></td>
+               <td align="center" style="white-space: 
nowrap;">&nbsp;{sdate_select}&nbsp;</td>
+               <td align="center" style="white-space: 
nowrap;">&nbsp;{edate_select}&nbsp;</td>
                <td align="center"><select 
name="state">{state_list}</select></td>
-               <td align="left"><input type="submit" name="submit" 
value="{lang_update}"></td>
-               <td align="right"><nobr>{search_list}</nobr></td>
+               <td><input type="submit" name="submit" 
value="{lang_update}"></td>
+               <td align="right"><nowrap>{search_list}</nowrap></td>
        </tr>
        </form>
 </table>
 <br>
 <table id="aTable" border="0" width="100%" cellpadding="2" cellspacing="2">
-       <tr class="th" style="text-align: center">
+       <tr bgcolor="{th_bg}" style="text-align: center">
+               <td style="width: 50px">&nbsp;</td>
                <td>{sort_hours_descr}</td>
                <td>{sort_status}</td>
                <td>{sort_start_date}</td>
@@ -68,12 +89,15 @@
                <td>{sort_hours}</td>
                <td>{sort_t_journey}</td>
                <td>{sort_employee}</td>
-               <td style="width: 50px">&nbsp;</td>
        </tr>
 
 <!-- BEGIN hours_list -->
 
-       <tr class="{tr_color}">
+       <tr bgcolor="{tr_color}">
+               <td align="center">
+                       {booked}
+                       <a href="{edit_url}"><img src="{edit_img}" border="0" 
title="{lang_edit_hours}" /></a>
+               </td>
                <td>{hours_descr}</td>
                <td align="center">{status}</td>
                <td align="center">{start_date}</td>
@@ -81,14 +105,13 @@
                <td align="center">{end_time}</td>
                <td align="right">{wh}</td>
                <td align="right">{t_journey}</td>
-               <td align="center">{employee}</td>
-               <td align="center">
-                       {booked}
-                       <a href="{edit_url}"><img src="{edit_img}" border="0" 
title="{lang_edit_hours}" /></a>
-               </td>
+               <td>{employee}</td>
        </tr>
 
 <!-- END hours_list -->
 
+       <tr height="5">
+               <td>&nbsp;</td>
+       </tr>
 </table>
 </center>

Index: templates/base/hours_view.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/hours_view.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/hours_view.tpl       27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/hours_view.tpl       5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: hours_view.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: hours_view.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <center>

Index: templates/base/list.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/list.tpl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- templates/base/list.tpl     31 Mar 2005 23:00:22 -0000      1.3
+++ templates/base/list.tpl     5 Dec 2006 19:40:45 -0000       1.4
@@ -1,9 +1,7 @@
-<!-- $Id: list.tpl,v 1.3 2005/03/31 23:00:22 ceb Exp $ -->
-
+<!-- $Id: list.tpl,v 1.4 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
-
+<div class="projects_content"></div>
 <!-- BEGIN project_main -->
-
 <table border="0" width="100%" cellpadding="2" cellspacing="0">
        <tr bgcolor="{th_bg}">
                <td colspan="4"><b>{lang_main}:&nbsp;<a 
href="{main_url}">{title_main}</a></b></td>
@@ -20,6 +18,12 @@
                <td>{lang_customer}:</td>
                <td>{customer_main}</td>
        </tr>
+       <tr bgcolor="{row_off}">
+               <td>{lang_files}:</td>
+               <td>{attachment}</td>
+               <td>{report}</td>
+               <td>&nbsp</td>
+       </tr>
 </table>
 
 <!-- END project_main -->
@@ -49,40 +53,24 @@
        </tr>
 </table>
 <table border="0" width="100%" cellpadding="2" cellspacing="2">
-       <tr class="th">
-
+       <tr bgcolor="{th_bg}">
                <td>{sort_title}</td>
 
                <!-- BEGIN pro_sort_cols -->
-
                <td align="{col_align}">{sort_column}</td>
-
                <!-- END pro_sort_cols -->
 
-               <td width="16" align="center">&nbsp;</td>
-               <td width="16" align="center">&nbsp;</td>
-               <td width="16" align="center">&nbsp;</td>
        </tr>
 
 <!-- BEGIN projects_list -->
 
-       <tr class="{tr_color}">
-
+       <tr class="{tr_class}">
                <td valign="top"><a href="{projects_url}">{title}</a></td>
                {pro_column}
-
-               <td align="center" valign="top"><a 
href="{add_job_url}">{add_job_img}</a></td>
-               <td align="center" valign="top"><a href="{view_url}"><img 
src="{view_img}" title="{lang_view}" border="0"></a></td>
-               <td align="center" valign="top"><a 
href="{edit_url}">{edit_img}</a></td>
        </tr>
-
 <!-- END projects_list -->
-
 </table>
-</fieldset>
 
 <!-- BEGIN pro_cols -->
-
                <td align="{col_align}">{column}</td>
-
 <!-- END pro_cols -->

Index: templates/base/list_admin.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/list_admin.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/list_admin.tpl       1 Apr 2005 23:52:28 -0000       1.1
+++ templates/base/list_admin.tpl       5 Dec 2006 19:40:45 -0000       1.2
@@ -1,7 +1,6 @@
-<!-- $Id: list_admin.tpl,v 1.1 2005/04/01 23:52:28 ceb Exp $ -->
+<!-- $Id: list_admin.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 <center>
 <table width="80%" border="0" cellpadding="2" cellspacing="2">
-<form method="POST" action="{action_url}">
        <tr>
                <td colspan="4" align="left">
                        <table border="0" width="100%">
@@ -14,54 +13,44 @@
                </td>
        </tr>
        <tr>
-               <td width="33%">
-                       <select name="action" onChange="submit();">
-                               <option value="project_admin" 
{selected_admin}>{lang_admins}</option>
-                               <option value="project_salesman" 
{selected_salesman}>{lang_salesmen}</option>
-                       </select>
-               </td>
                <td width="33%">&nbsp;</td>
-               <td width="33%" align="right">{search_list}</td>
+               <td width="33%">&nbsp;</td>
+               <td width="33%" align="right"><form method="POST" name="query" 
action="{search_action}">{search_list}</form></td>
        </tr>
 </table>
 <table width="80%" border="0" cellpadding="2" cellspacing="2"> 
-       <tr class="th">
-               <td width="33%">{sort_lid}</td>
-               <td width="33%">{sort_firstname}</td>
-               <td width="33%">{sort_lastname}</td>
+       <tr bgcolor="{th_bg}">
+               <td width="33%" bgcolor="{th_bg}"><b>{sort_lid}</b></td>
+               <td width="33%" bgcolor="{th_bg}"><b>{sort_firstname}</b></td>
+               <td width="33%" bgcolor="{th_bg}"><b>{sort_lastname}</b></td>
        </tr>
 
 <!-- BEGIN admin_list -->
 
-       <tr class="{tr_color}">                                                 
                                                                                
                               
+       <tr bgcolor="{tr_color}">                                               
                                                                                
                                 
                <td>{lid}</td>
                <td>{firstname}</td>
                <td>{lastname}</td>
        </tr>
 
 <!-- END admin_list -->
-
-<!-- BEGIN group_th -->
-
        <tr>
-               <td colspan="3" class="th">{lang_group}</td>
+               <td colspan="3" bgcolor="{th_bg}"><b>{lang_group}</b></td>
        </tr>
 
-<!-- END group_th -->
-
 <!-- BEGIN group_list -->
 
-       <tr class="{tr_color}">
+       <tr bgcolor="{tr_color}">                                               
                                                                                
                                 
                <td colspan="3">{lid}</td>
        </tr>
 
 <!-- END group_list -->
 
        <tr valign="bottom" height="50">
-
+       <form method="POST" action="{action_url}">
                <td colspan="2"><input type="submit" name="add" 
value="{lang_edit}"></td>
-               <td align="right"><input type="submit" name="done" 
value="{lang_done}"></td>
+               <td colspan="2" align="right"><input type="submit" name="done" 
value="{lang_done}"></td>
+       </form>
        </tr>
-</form>
 </table>
 </center>

Index: templates/base/list_budget.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/list_budget.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/list_budget.tpl      30 Mar 2005 15:53:38 -0000      1.1
+++ templates/base/list_budget.tpl      5 Dec 2006 19:40:45 -0000       1.2
@@ -1,7 +1,6 @@
-<!-- $Id: list_budget.tpl,v 1.1 2005/03/30 15:53:38 ceb Exp $ -->
-
+<!-- $Id: list_budget.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
-
+<div class="projects_content"></div>
 <!-- BEGIN project_main -->
 <!--
 <table border="0" width="100%" cellpadding="2" cellspacing="0">
@@ -78,6 +77,53 @@
                }
        </style>
 
+       <script type="text/javascript">
+               function getStyleSheet(name)
+               {
+                       if(!name || !document.styleSheets) {
+                               return null;
+                       }
+                       var i = document.styleSheets.length;
+                       while(i--)
+                       {
+                               var rules = document.styleSheets[i].rules ? 
document.styleSheets[i].rules :
+                               document.styleSheets[i].cssRules;
+                               var j = rules.length;
+                               while(j--) { 
+                                       names = 
rules[j].selectorText.split(",");
+                                       for (var k=0; k<names.length; k++) {
+                                               var p = 
names[k].indexOf("[class~=");
+                                               var s = (p>=0)? 
names[k].substring(0,p) : names[k];
+                                               if(s.toLowerCase() == 
name.toLowerCase()) 
+                                                       return rules[j]; 
+                                       }
+                               }
+                       }
+                       return null;
+               }
+
+               function setStyle(name, attr, value)
+               {
+                       var rule = getStyleSheet(name);
+                       if(!rule) {
+                               alert("could not find stylerule "+name);
+                               return null;
+                               }
+                       if(value) rule.style[attr] = value;
+                       return rule.style[attr];
+               }
+
+               function sum_switch()
+               {
+                       value = setStyle("div.node_sum", "display");
+                       if (value != 'none') 
+                               setStyle("div.node_sum", "display", "none");
+                       else
+                               setStyle("div.node_sum", "display", "block");
+               }
+               
+       </script>
+<!--
 <table border="0" width="100%" cellpadding="2" cellspacing="2">
        <tr>
                <td colspan="7">
@@ -102,16 +148,17 @@
                        </form>
                </td>
                <td width="20%" align="center"><form method="POST" 
name="filter" action="{action_url}">{filter_list}</form></td>
-               <td width="35%" align="right"><form method="POST" name="query" 
action="{action_url}">{search_list}</form></td>
+               <td nowrap="nowrap" width="35%" align="right"><form 
method="POST" name="query" action="{action_url}">{search_list}</form></td>
        </tr>
 </table>
+-->
 <table border="0" width="100%" cellpadding="2" cellspacing="2">
-       <tr class="th">
+       <tr bgcolor="{th_bg}">
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td 
colspan="6"><b>{currency}&nbsp;{lang_budget}</b>&nbsp;&nbsp;&nbsp;<a 
href="javascript:sum_switch()">{lang_in_out_sum}</a></td>
        </tr>
-       <tr class="th"  valign="top">
+       <tr bgcolor="{th_bg}"  valign="top">
                <td width="10%" valign="top">{sort_number}</td>
                <td width="40%" valign="top">{sort_title}</td>
                <td width="5%" align="right" valign="top">{sort_planned}</td>
@@ -124,7 +171,7 @@
 
 <!-- BEGIN projects_list -->
 
-       <tr class="{tr_color}">
+       <tr bgcolor="{tr_color}">
                <td>{number}</td>
                <td><a href="{sub_url}">{title}</a></td>
                <td align="right">

Index: templates/base/list_employees.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/list_employees.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/list_employees.tpl   27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/list_employees.tpl   5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: list_employees.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: list_employees.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 <center>
 <br/><br/>
 {message}

Index: templates/base/list_events.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/list_events.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/list_events.tpl      27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/list_events.tpl      5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: list_events.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: list_events.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {message}
 <table width="60%" border="0" cellpadding="2" cellspacing="2" align="center">
        <tr bgcolor="{th_bg}">

Index: templates/base/list_mstones.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/list_mstones.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/list_mstones.tpl     27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/list_mstones.tpl     5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: list_mstones.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: list_mstones.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <center>

Index: templates/base/list_pro_hours.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/list_pro_hours.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/list_pro_hours.tpl   27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/list_pro_hours.tpl   5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: list_pro_hours.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: list_pro_hours.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <!-- BEGIN project_main -->

Index: templates/base/list_roles.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/list_roles.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/list_roles.tpl       27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/list_roles.tpl       5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: list_roles.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: list_roles.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <center>

Index: templates/base/list_surcharges.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/list_surcharges.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/list_surcharges.tpl  27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/list_surcharges.tpl  5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: list_surcharges.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: list_surcharges.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 <center>
 <table border="0" cellpadding="2" cellspacing="2" align="center">
        <tr height="5"><td></td></tr>

Index: templates/base/list_tree.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/list_tree.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/list_tree.tpl        27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/list_tree.tpl        5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: list_tree.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: list_tree.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <!-- BEGIN project_main -->

Index: templates/base/listactivities.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/listactivities.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/listactivities.tpl   27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/listactivities.tpl   5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: listactivities.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: listactivities.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <center>

Index: templates/base/preference_acl.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/preference_acl.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/preference_acl.tpl   27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/preference_acl.tpl   5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: preference_acl.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: preference_acl.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {errors}
 {title}
 <table border="0" align="center" width="70%">

Index: templates/base/preference_acl_row.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/preference_acl_row.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/preference_acl_row.tpl       27 Nov 2006 13:36:03 -0000      
1.1
+++ templates/base/preference_acl_row.tpl       5 Dec 2006 19:40:45 -0000       
1.2
@@ -1,4 +1,4 @@
-<!-- $Id: preference_acl_row.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: preference_acl_row.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 <tr bgcolor="{row_color}">
        <td>{user}</td>
        <td align="center"><input type="checkbox" name="{read}" 
value="Y"{read_selected}></td>

Index: templates/base/preference_colspan.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/preference_colspan.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/preference_colspan.tpl       27 Nov 2006 13:36:03 -0000      
1.1
+++ templates/base/preference_colspan.tpl       5 Dec 2006 19:40:45 -0000       
1.2
@@ -1,4 +1,4 @@
-<!-- $Id: preference_colspan.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: preference_colspan.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 <tr bgcolor="{bg_color}">
        <td>{string}</td>
        <td align="center">{lang_read}</td>

Index: templates/base/preferences.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/preferences.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/preferences.tpl      27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/preferences.tpl      5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: preferences.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: preferences.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 <br/><br/><br/><br/>
 <center>
 <table border="0" cellspacing="2" cellpadding="2">

Index: templates/base/project_activity.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/project_activity.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/project_activity.tpl 27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/project_activity.tpl 5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: project_activity.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: project_activity.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <table cellspacing="2" cellpadding="2">

Index: templates/base/projects_header.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/projects_header.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/projects_header.tpl  30 Mar 2005 15:53:38 -0000      1.1
+++ templates/base/projects_header.tpl  5 Dec 2006 19:40:45 -0000       1.2
@@ -1,32 +1,155 @@
-<!-- $Id: projects_header.tpl,v 1.1 2005/03/30 15:53:38 ceb Exp $ -->
+<!-- $Id: projects_header.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
+<script language="JavaScript" type="text/javascript">
+document.getElementsByTagName("body")[0].style.backgroundColor = "white";
+</script>
 <!-- BEGIN projects_header -->
+<style>
+body
+{
+       background-color: #ffffff;
+}
 
-<table cellspacing="2" cellpadding="2" border="0">
-       <tr>
-               {projects_menu}
-       </tr>
-</table>
-<br />
-<table width="100%" cellspacing="2" cellpadding="2" border="0">
-       <tr>
-               <form method="POST" name="select_pro" 
action="{select_pro_action}">
-                       <td width="100%" style="white-space: nowrap;" 
valign="top">{up_button}<select name="project_id" 
onChange="this.form.submit();">{select_pro_options}</td>
-               </form>
-       </tr>
-</table>
-<br />
+input, select, textarea
+{
+       border: 1px solid #808080;
+       background-color: #ffffff;
+}
+
+fieldset
+{
+       border: 1px solid #808080;
+       padding: 1px 6px 6px 6px;
+       font-family: Verdana, Arial, Helvetica, sans-serif;
+       font-size: 9pt;
+       color: #000000;
+}
+
+fieldset.menu_toolbar
+{
+       padding: 1px 6px 6px 6px;
+       font-family: Verdana, Arial, Helvetica, sans-serif;
+       font-size: 1pt;
+       white-space: nowrap;
+       height:47px; 
+       min-height:47px; 
+       max-height:47px; 
+    x-height: 47px;
+    float: left;
+}
+
+
+legend
+{
+       font-family: Verdana, Arial, Helvetica, sans-serif;
+       color: #000000;
+}
+
+legend.headline
+{
+       font-size: 9pt;
+}
+
+legend.menu_toolbar
+{
+       font-size: 7pt;
+}
+
+div.menu_button, div.menu_button_active, div.menu_button_inactive
+{
+       float: left;
+       margin: 2px;
+       padding: 4px;
+       font-family: Verdana, Arial, Helvetica, sans-serif;
+       font-size: 8pt;
+       text-align: center;
+       vertical-align: middle;
+       color: #000000;
+       text-align: center;
+       -moz-border-radius: 8px;
+       white-space: nowrap;
+}
+
+div.menu_button
+{
+       border: 2px solid #909090;
+}
+
+img.menu_button, img.menu_button_active, img.menu_button_inactive
+{
+       text-align: center;
+       vertical-align: middle;
+       width: 20px;
+       height: 20px;
+}
+
+img.menu_button_inactive
+{
+       filter: alpha(opacity=40);
+       -moz-opacity:40%;
+}
+
+div.menu_button_active
+{
+       border: 3px solid #000090;
+}
+
+div.menu_button_inactive
+{
+       border: 2px solid #e0e0e0;
+       filter: alpha(opacity=40);
+       -moz-opacity:40%;
+}
+
+a.menu_button, a.menu_button_active, a.menu_button_inactive
+{
+       text-decoration: none;
+       white-space: nowrap;
+}
+
+div.menu_icon, div.menu_icon_active, div.menu_icon_inactive
+{
+       float: left;
+       margin: 3px;
+       padding: 3px;
+       width: 15px;
+       height: 15px;
+       font-family: Verdana, Arial, Helvetica, sans-serif;
+       font-size: 8pt;
+       text-align: center;
+       vertical-align: middle;
+       color: #000000;
+       text-align: center;
+       -moz-border-radius: 8px;
+}
+
+div.appgroup
+{
+    width:100%;
+    float:left;
+}
+
+img.menu_icon_inactive
+{
+       filter: alpha(opacity=40);
+       -moz-opacity:40%;
+}
+
+</style>
+<div class="appgroup">{projects_menu}</div>
+<br style="float:clear" />
+<form method="POST" name="select_pro" action="{select_pro_action}">
+  <div class="appgroup">
+    <div style="margin-left:5px; margin-top:8px; white-space:nowrap; 
float:left; width:100%; overflow:hidden">{up_button}&nbsp;<select 
style="width:85%; overflow:hidden" name="project_id" 
onChange="this.form.submit();">{select_pro_options}</select></div>
+  </div>
+</form>
+<div class="appgroup">
 <fieldset>
 <legend class="headline">[&nbsp;{headline}&nbsp;]</legend>
-
 <!-- END projects_header -->
 
 <!-- BEGIN projects_menu_toolbar -->
-
-       <td valign="top" style="white-space: nowrap;">
-               <fieldset class="menu_toolbar">
+<fieldset class="menu_toolbar" style="margin-right:5px">
                        <legend 
class="menu_toolbar">[&nbsp;{toolbar_name}&nbsp;]</legend>
                        <div style="float:left; white-space: 
nowrap;">{toolbar_icons}</div>
-               </fieldset>
-       </td>
-
+</fieldset>
 <!-- END projects_menu_toolbar -->

Index: templates/base/report_list.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/report_list.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/report_list.tpl      27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/report_list.tpl      5 Dec 2006 19:40:45 -0000       1.2
@@ -1,5 +1,5 @@
 <!-- BEGIN report.tpl -->
-<!-- $Id: report_list.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: report_list.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <center>

Index: templates/base/report_wizard.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/report_wizard.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/report_wizard.tpl    27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/report_wizard.tpl    5 Dec 2006 19:40:45 -0000       1.2
@@ -1,5 +1,5 @@
 <!-- BEGIN report_wizard.tpl -->
-<!-- $Id: report_wizard.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: report_wizard.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
 <div class="projects_content"></div>
 <center>

Index: templates/base/stats_gant.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/stats_gant.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/stats_gant.tpl       31 Mar 2005 23:24:19 -0000      1.1
+++ templates/base/stats_gant.tpl       5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: stats_gant.tpl,v 1.1 2005/03/31 23:24:19 ceb Exp $ -->
+<!-- $Id: stats_gant.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 
 <script language="JavaScript">
        self.name="first_Window";
@@ -9,38 +9,34 @@
 </script>
 
 {app_header}
-
+<div class="projects_content"></div>
 <table border="0" width="100%" cellpadding="2" cellspacing="2">
        <form method="POST" action="{action_url}">
        <input type="hidden" name="project_id" value="{project_id}">
        <input type="hidden" name="start" value="{start}">
        <input type="hidden" name="end" value="{end}">
-       <tr height="50">
-               <td width="20%">&nbsp;</td>
-               <td>{lang_start_date}:&nbsp;{sdate_select}</td>
-               <td>{lang_end_date}:&nbsp;{edate_select}</td>
-               <td align="right"><input type="submit" name="show" 
value="{lang_show_chart}"></td>
-               <td width="20%">&nbsp;</td>
+       <tr bgcolor="{th_bg}">
+               <td align="center" width="30%" 
nowrap="nowrap">{lang_start_date}:&nbsp;{sdate_select}</td>
+               <td align="center" width="30%" 
nowrap="nowrap">{lang_end_date}:&nbsp;{edate_select}</td>
+               <td align="center" width="40%" nowrap="nowrap"><input 
type="submit" name="show" value="{lang_show_chart}"></td>
+       </tr>
+       <tr height="5">
+               <td colspan="3"></td>
        </tr>
        <tr>
                <map name="plus">
 
 <!-- BEGIN map -->
 
-                       <AREA SHAPE="Rect" HREF="{gantt_url}" COORDS="{coords}" 
/>
+                       <area shape="Rect" href="{gantt_url}" coords="{coords}" 
/>
 
 <!-- END map -->
 
                </map>
-               <td colspan="5" align="center"><img usemap="#plus" 
src="{pix_src}" border="0"></td>
+               <td colspan="3" align="center"><img usemap="#plus" 
src="{pix_src}" border="0"><hr></td>
        </tr>
-       <tr height="50">
-               <td width="20%">&nbsp;</td>
-               <td>&nbsp;</td>
-               <td>&nbsp;</td>
-               <td align="right"><input type="button" name="gantt_popup" 
value="{lang_show_gantt_in_new_window}" onClick="gantt_chart();"></td>
-               <td width="20%">&nbsp;</td>
+       <tr height="30">
+               <td colspan="3" align="right"><input type="button" 
name="gantt_popup" value="{lang_show_gantt_in_new_window}" 
onclick="gantt_chart();"></td>
        </tr>
        </form>
 </table>
-</fieldset>

Index: templates/base/stats_gant_popup.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/stats_gant_popup.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/stats_gant_popup.tpl 27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/stats_gant_popup.tpl 5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: stats_gant_popup.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: stats_gant_popup.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 
 <html>
 <head>

Index: templates/base/stats_project_employees.tpl
===================================================================
RCS file: 
/sources/phpgroupware/projects/templates/base/stats_project_employees.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/stats_project_employees.tpl  30 Mar 2005 15:53:38 -0000      
1.1
+++ templates/base/stats_project_employees.tpl  5 Dec 2006 19:40:45 -0000       
1.2
@@ -1,9 +1,7 @@
-<!-- $Id: stats_project_employees.tpl,v 1.1 2005/03/30 15:53:38 ceb Exp $ -->
-
-<br />{app_header}
-
+<!-- $Id: stats_project_employees.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ 
-->
+{app_header}
+<div class="projects_content"></div>
 <center>{msg}</center>
-
 <!-- BEGIN project_main -->
 <!--
 <table border="0" width="100%" cellpadding="2" cellspacing="0">
@@ -25,7 +23,7 @@
 </table>
 -->
 <!-- END project_main -->
-
+<!--
 <table border="0" width="100%" cellpadding="2" cellspacing="2">
        <tr>
                <td width="100%" colspan="8">
@@ -40,13 +38,24 @@
        </tr>
        <form method="POST" action="{action_url}">
        <tr style="vertical-align:top">
-               <td width="25%" align="left">{action_list}</td>
-               <td width="20%" align="center"><select name="status" 
onChange="this.form.submit();">{status_list}</select></td>
-               <td width="15%" align="center">{filter_list}</td>
-               <td width="40%" align="right">{search_list}</td>
+               <td width="20%" nowrap="nowrap" align="left">{action_list}</td>
+               <td width="10%" nowrap="nowrap" align="center"><select 
name="status" onChange="this.form.submit();">{status_list}</select></td>
+               {filter_list}
+               <td width="10%" nowrap="nowrap" align="right">{search_list}</td>
        </tr>
 </table>
-<br />
+<br/>
+-->
+<script type="text/javascript">
+       function change_view(id)
+       {
+               value = document.getElementById(id).style.display
+               if (value != 'none') 
+                       document.getElementById(id).style.display = "none";
+               else
+                       document.getElementById(id).style.display = "block";
+       }
+</script>
 
 <style type="text/css">
        table.show_emps {
@@ -55,7 +64,7 @@
 </style>
 
 <table border="0" width="100%" cellpadding="2" cellspacing="2">
-       <tr class="th">
+       <tr bgcolor="{th_bg}">
                <td style="padding-left:5px; 
paddgin-right:5px">{sort_number}</td>
                <td style="padding-left:5px; 
paddgin-right:5px">{sort_title}</td>
                <td style="padding-left:5px; 
paddgin-right:5px">{sort_coordinator}</td>
@@ -66,8 +75,7 @@
 
 <!-- BEGIN projects_list -->
 
-
-       <tr class="{tr_color}">
+       <tr bgcolor="{tr_color}">
                <td style="padding-left:5px; paddgin-right:5px;">{number}</td>
                <td style="padding-left:5px; paddgin-right:5px;"><a 
href="{projects_url}">{title}</a></td>
                <td style="padding-left:5px; 
paddgin-right:5px;">{coordinator}</td>
@@ -85,29 +93,29 @@
        </tr>
 </form>
 </table>
-</center>
 
 <!-- BEGIN user_cols -->
-       <tr class="{tr_color}">
+       <tr bgcolor="{tr_color}">
                <td colspan="2">&nbsp;</td>
                <td colspan="3">
                        <div id="{node_nr}" style="display: {node_style};">
                                <table width="100%" align="center" border="0" 
cellpadding="0" cellspacing="2" class="show_emps">
                                        <tr>
-                                               <td width="50%" 
class="th">{lang_employee}</td>
-                                               <td width="50%" 
class="th">{lang_role}</td>
+                                               <td width="50%" 
bgcolor="{th_bg}">{lang_project_employees}</td>
+                                               <td width="50%" 
bgcolor="{th_bg}">{lang_role}</td>
                                        </tr>
 
 <!-- BEGIN user_list -->
 
                                        <tr>
-                                               <td width="50%" 
class="{tr_color}">{emp_name}</td>
-                                               <td width="50%" 
class="{tr_color}">{emp_role}</td>
+                                               <td width="50%" 
bgcolor="{tr_color}">{emp_name}</td>
+                                               <td width="50%" 
bgcolor="{tr_color}">{emp_role}</td>
                                        </tr>
 
 <!-- END user_list -->
                                </table>
                        </div>
-               <td>
+               </td>
+               <td>&nbsp;</td>
        </tr>
 <!-- END user_cols -->

Index: templates/base/stats_projectlist.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/stats_projectlist.tpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- templates/base/stats_projectlist.tpl        31 Mar 2005 23:00:22 -0000      
1.2
+++ templates/base/stats_projectlist.tpl        5 Dec 2006 19:40:45 -0000       
1.3
@@ -1,23 +1,22 @@
-<!-- $Id: stats_projectlist.tpl,v 1.2 2005/03/31 23:00:22 ceb Exp $ -->
+<!-- $Id: stats_projectlist.tpl,v 1.3 2006/12/05 19:40:45 sigurdne Exp $ -->
 
 {app_header}
-
-<center>
-<p>{msg}</p>
+<div class="projects_content"></div>
+<center>{msg}</center>
 
 <!-- BEGIN project_main -->
 
 <table border="0" width="100%" cellpadding="2" cellspacing="0">
-       <tr class="th">
+       <tr bgcolor="{th_bg}">
                <td colspan="4"><b>{lang_main}:&nbsp;<a 
href="{main_url}">{title_main}</a></b></td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_number}:</td>
                <td>{number_main}</td>
                <td>{lang_url}:</td>
                <td><a href="http://{url_main}"; 
taget="_blank">{url_main}</a></td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_coordinator}:</td>
                <td>{coordinator_main}</td>
                <td>{lang_customer}:</td>
@@ -28,7 +27,6 @@
 <!-- END project_main -->
 
 <table border="0" width="100%" cellpadding="2" cellspacing="2">
-<form method="POST" action="{action_url}">
        <tr>
                <td width="100%" colspan="8">
                        <table border="0" width="100%">
@@ -40,6 +38,7 @@
                        </table>
                </td>
        </tr>
+       <form method="POST" action="{action_url}">
        <tr style="vertical-align:top">
                <td width="30%" align="left">{action_list}</td>
                <td width="20%" align="center"><select name="status" 
onChange="this.form.submit();">{status_list}</select></td>
@@ -48,28 +47,28 @@
        </tr>
 </table>
 <table border="0" width="100%" cellpadding="2" cellspacing="2">
-       <tr class="th">
+       <tr bgcolor="{th_bg}">
                <td style="padding-left:5px; 
paddgin-right:5px">{sort_number}</td>
                <td style="padding-left:5px; 
paddgin-right:5px">{sort_title}</td>
                <td style="padding-left:5px; 
paddgin-right:5px">{sort_coordinator}</td>
                <td style="padding-left:5px; paddgin-right:5px; 
text-align:center">{sort_sdate}</td>
                <td style="padding-left:5px; paddgin-right:5px; 
text-align:center">{sort_edate}</td>
-               <td style="padding-left:5px; paddgin-right:5px; 
text-align:center">{lang_action}</td>
-               <!--<td style="padding-left:5px; paddgin-right:5px; 
text-align:center">{lang_employees}</td>-->
-               <td>&nbsp;</td>
+               <td style="padding-left:5px; paddgin-right:5px; 
text-align:center">{lang_gantt_chart}</td>
+               <td style="padding-left:5px; paddgin-right:5px; 
text-align:center">{lang_employees}</td>
+               <td style="padding-left:5px; paddgin-right:5px" 
width="16">&nbsp;</td>
        </tr>
 
 <!-- BEGIN projects_list -->
 
-       <tr class="{tr_color}">
+       <tr bgcolor="{tr_color}">
                <td style="padding-left:5px; paddgin-right:5px;">{number}</td>
                <td style="padding-left:5px; paddgin-right:5px;"><a 
href="{projects_url}">{title}</a></td>
                <td style="padding-left:5px; 
paddgin-right:5px;">{coordinator}</td>
                <td style="padding-left:5px; paddgin-right:5px; 
text-align:center">{sdate}</td>
                <td style="padding-left:5px; paddgin-right:5px; 
text-align:center">{edate}</td>
-               <td style="padding-left:5px; paddgin-right:5px; 
text-align:center"><input type="checkbox" name="values[{view_value}]" 
value="{project_id}" {radio_user_checked}></td>
-               <!--<td style="padding-left:5px; paddgin-right:5px; 
text-align:center"><input type="checkbox" 
name="values[project_id][{project_id}]" value="{project_id}" ></td>-->
-               <td style="padding-left:5px; paddgin-right:5px; 
text-align:center"><a href="{view_url}"><img src="{view_img}" border="0" 
title="{lang_details}" /></a></td>
+               <td style="padding-left:5px; paddgin-right:5px; 
text-align:center"><input type="checkbox" name="values[gantt_id][{project_id}]" 
value="{project_id}"></td>
+               <td style="padding-left:5px; paddgin-right:5px; 
text-align:center"><input type="checkbox" 
name="values[project_id][{project_id}]" value="{project_id}" 
{radio_user_checked}></td>
+               <td style="padding-left:5px; paddgin-right:5px; 
text-align:center"><a href="{view_url}"><img src="{view_img}" border="0" 
title="{lang_view}" /></a></td>
        </tr>
 
        {employee_list}
@@ -77,33 +76,25 @@
 <!-- END projects_list -->
                                                                                
                                                      
        <tr height="50" valign="bottom">
-               <td colspan="5">&nbsp;</td>
-
-<!-- BEGIN gantt_submit -->
-
+               <td colspan="5">
+                       <input type="submit" name="userstats" 
value="{lang_userstats}">
+                       <input type="submit" name="worktimestats" 
value="{lang_worktimestats}">
+               </td>
                <td align="center"><input type="submit" name="viewgantt" 
value="{lang_view_gantt}" onClick="gantt_popup()"></td>
-
-<!-- END gantt_submit -->
-
-<!-- BEGIN user_submit -->
-
                <td align="center"><input type="submit" name="viewuser" 
value="{lang_view_employees}"></td>
-
-<!-- END user_submit -->
-
-               <td>&nbsp;</td>
+               <td width="16">&nbsp;</td>
        </tr>
 </form>
 </table>
 </center>
-</fieldset>
 
 <!-- BEGIN user_cols -->
 
        <tr>
                <td>&nbsp;</td>
-               <td class="th">{lang_name}</td>
-               <td class="th">{lang_role}</td>
+               <td bgcolor="{th_bg}">{lang_name}</td>
+               <td bgcolor="{th_bg}">{lang_role}</td>
+               <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
@@ -114,8 +105,9 @@
 
        <tr>
                <td>&nbsp;</td>
-               <td class="{tr_color}">{emp_name}</td>
-               <td class="{tr_color}">{emp_role}</td>
+               <td bgcolor="{tr_color}">{emp_name}</td>
+               <td bgcolor="{tr_color}">{emp_role}</td>
+               <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
@@ -124,4 +116,8 @@
 
 <!-- END user_list -->
 
+       <tr height="15">
+               <td>&nbsp;</td>
+       </tr>
+
 <!-- END user_cols -->

Index: templates/base/stats_projectstat.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/stats_projectstat.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/stats_projectstat.tpl        27 Nov 2006 13:36:03 -0000      
1.1
+++ templates/base/stats_projectstat.tpl        5 Dec 2006 19:40:45 -0000       
1.2
@@ -1,4 +1,4 @@
-<!-- $Id: stats_projectstat.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: stats_projectstat.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 
 {app_header}
 <div class="projects_content"></div>

Index: templates/base/stats_userlist.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/stats_userlist.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/stats_userlist.tpl   31 Mar 2005 15:50:49 -0000      1.1
+++ templates/base/stats_userlist.tpl   5 Dec 2006 19:40:45 -0000       1.2
@@ -1,10 +1,10 @@
-<!-- $Id: stats_userlist.tpl,v 1.1 2005/03/31 15:50:49 ceb Exp $ -->
+<!-- $Id: stats_userlist.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 
 {app_header}
-
+<div class="projects_content"></div>
 <center>
-<form method="POST" action="{action_url}">
 <table border="0" width="79%" cellspacing="2" cellpadding="2">
+       <form method="POST" action="{action_url}">
        <tr>
                <td colspan="4" width="100%">
                        <table border="0" width="100%">
@@ -17,11 +17,14 @@
                </td>
        </tr>
        <tr>
+               <td>&nbsp;</td>
+               <td>&nbsp;</td>
+               <td>&nbsp;</td>
                {search_list}
        </tr>
 </table>
 <table border="0" width="79%" cellspacing="2" cellpadding="2">
-       <tr class="th">
+       <tr bgcolor="{th_bg}">
                <td width="20%">{sort_lid}</td>
                <td width="20%">{sort_firstname}</td>
                <td width="20%">{sort_lastname}</td>
@@ -30,7 +33,7 @@
 
 <!-- BEGIN user_list -->
 
-       <tr class="{tr_color}">
+       <tr bgcolor="{tr_color}">
                <td>{lid}</td>
                <td>{firstname}</td>
                <td>{lastname}</td>
@@ -46,14 +49,13 @@
                <td colspan="4" align="right"><input type="submit" name="view" 
value="{lang_view_projects}"></td>
        </tr>
 </table>
-</form>
 </center>
-
+</form>
 <!-- BEGIN pro_cols -->
 
        <tr>
                <td>&nbsp;</td>
-               <td class="th" colspan="2" style="font-weight: 
bold">{lang_projects}</td>
+               <td bgcolor="{th_bg}" colspan="2">{lang_projects}</td>
                <td>&nbsp;</td>
        </tr>
 
@@ -61,10 +63,14 @@
 
        <tr>
                <td>&nbsp;</td>
-               <td class="{tr_color}" colspan="2">{pro_name}</td>
+               <td bgcolor="{tr_color}" colspan="2">{pro_name}</td>
                <td>&nbsp;</td>
        </tr>
 
 <!-- END pro_list -->
 
+       <tr height="15">
+               <td>&nbsp;</td>
+       </tr>
+
 <!-- END pro_cols -->

Index: templates/base/stats_userlist_worktimes.tpl
===================================================================
RCS file: 
/sources/phpgroupware/projects/templates/base/stats_userlist_worktimes.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/stats_userlist_worktimes.tpl 31 Mar 2005 15:50:49 -0000      
1.1
+++ templates/base/stats_userlist_worktimes.tpl 5 Dec 2006 19:40:45 -0000       
1.2
@@ -1,47 +1,58 @@
-<!-- $Id: stats_userlist_worktimes.tpl,v 1.1 2005/03/31 15:50:49 ceb Exp $ -->
+<!-- $Id: stats_userlist_worktimes.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp 
$ -->
 
 {app_header}
-
+<div class="projects_content"></div>
 <center>
-<form method="POST" action="{action_url}">
 <table border="0" width="96%" cellspacing="2" cellpadding="2">
-       <tr>
-               <td align="center">{select_employee_list}</td>
-               <td 
align="center">{lang_project}:&nbsp;{select_action_list}</td>
-               <td align="center">{lang_start_date}:&nbsp;{sdate_select}</td>
-               <td align="center">{lang_end_date}:&nbsp;{edate_select}</td>
-               <td align="center"><input type="submit" name="view" 
value="{lang_view_projects}"></td>
+       <form method="POST" action="{action_url}">
+       <tr bgcolor="{th_bg}">
+               <td 
align="center">{lang_employee}:<br\>{select_employee_list}</td>
+               <!--td 
align="center">{lang_project}:<br\>{select_action_list}</td-->
+               <td align="center">{lang_start_date}:<br\>{sdate_select}</td>
+               <td align="center">{lang_end_date}:<br\>{edate_select}</td>
+               <td align="center"><input type="submit" name="view" 
value="{lang_update}"></td>
        </tr>
-</table>
 </form>
+</table>
 <br>
 <!-- BEGIN worktime_list -->
 <table border="0" width="96%" cellspacing="2" cellpadding="2">
-       <tr class="th">
-               <td rowspan="2" valign="middle" 
align="center">{lang_projects}</td>
-               <td colspan="3" width="25%" align="center" 
width="15%">{lang_hours}</td>
-       </tr>
-       <tr class="th">
-               <td align="center">{lang_project}</td>
-               <td align="center">{lang_travel_time}</td>
-               <td align="center">{lang_sum}</td>
+       <tr bgcolor="{tr_color}">
+               <td colspan="2" width="75%" valign?"middle" align="center" 
bgcolor="{th_bg}">{info_1}</td>
+               <td colspan="3" width="25%" align="center" width="15%" 
bgcolor="{th_bg}">{lang_workhours}</td>
+       </tr>
+       <tr bgcolor="{tr_color}">
+               <td align="center" bgcolor="{th_bg}" >{info_1_1}</td>
+               <td align="center" bgcolor="{th_bg}" width="15%">{info_1_2}</td>
+               <td align="center" 
bgcolor="{th_bg}">{lang_workhours_project}</td>
+               <td align="center" 
bgcolor="{th_bg}">{lang_workhours_journey}</td>
+               <td align="center" bgcolor="{th_bg}">{lang_workhours_sum}</td>
        </tr>
        {project_list}
-       <tr class="th">
-               <td rowspan="2" valign="middle" 
align="right"><b>{lang_summery}</b></td>
-               <td align="right"><b>{summery_workhours_project}</b></td>
-               <td align="right"><b>{summery_workhours_journey}</b></td>
-               <td align="right"><b>{summery_workhours_sum}</b></td>
+       <tr bgcolor="{tr_color}">
+               <td colspan="2" valign?"middle" align="right" 
bgcolor="{th_bg}"><b>{lang_summery}</b></td>
+               <td align="right" 
bgcolor="{th_bg}"><b>{lang_summery_workhours_project}</b></td>
+               <td align="right" 
bgcolor="{th_bg}"><b>{lang_summery_workhours_journey}</b></td>
+               <td align="right" 
bgcolor="{th_bg}"><b>{lang_summery_workhours_sum}</b></td>
        </tr>
+       {ps_sum}
 </table>
 <!-- END worktime_list -->
 </center>
 
 <!-- BEGIN pro_list -->
-       <tr class="{tr_color}">
-               <td align="left">{pro_name}</td>
-               <td align="right">{pro_hours}</td>
-               <td align="right">{pro_hours_journey}</td>
-               <td align="right">{pro_hours_sum}</td>
+       <tr bgcolor="{tr_color}">
+               <td align="left" bgcolor="{row_on}">{pro_name}</td>
+               <td align="left" bgcolor="{row_off}">{pro_number}</td>
+               <td align="right" bgcolor="{row_on}">{pro_hours}</td>
+               <td align="right" bgcolor="{row_off}">{pro_hours_journey}</td>
+               <td align="right" bgcolor="{row_on}">{pro_hours_sum}</td>
        </tr>
 <!-- END pro_list -->
+
+<!-- BEGIN posible_sum -->
+       <tr>
+               <td colspan="2" align="right" 
bgcolor="{th_bg}"><b>{lang_summery_workhours_posible}:</b></td>
+               <td colspan="3" align="right" 
bgcolor="{th_bg}"><b>{summery_workhours_posible}:00</b></td>
+       </tr>
+<!-- END posible_sum -->
\ No newline at end of file

Index: templates/base/stats_userstat.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/stats_userstat.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/stats_userstat.tpl   27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/stats_userstat.tpl   5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: stats_userstat.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: stats_userstat.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 
 {app_header}
 <div class="projects_content"></div>

Index: templates/base/ttracker.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/ttracker.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/ttracker.tpl 27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/ttracker.tpl 5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: ttracker.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: ttracker.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 
 {app_header}
 <div class="projects_content"></div>

Index: templates/base/ttracker_form.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/ttracker_form.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/ttracker_form.tpl    27 Nov 2006 13:36:03 -0000      1.1
+++ templates/base/ttracker_form.tpl    5 Dec 2006 19:40:45 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: ttracker_form.tpl,v 1.1 2006/11/27 13:36:03 sigurdne Exp $ -->
+<!-- $Id: ttracker_form.tpl,v 1.2 2006/12/05 19:40:45 sigurdne Exp $ -->
 
 {app_header}
 <div class="projects_content"></div>

Index: templates/base/view.tpl
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/view.tpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- templates/base/view.tpl     29 Mar 2005 14:46:57 -0000      1.2
+++ templates/base/view.tpl     5 Dec 2006 19:40:45 -0000       1.3
@@ -1,8 +1,7 @@
-<!-- $Id: view.tpl,v 1.2 2005/03/29 14:46:57 ceb Exp $ -->
-
+<!-- $Id: view.tpl,v 1.3 2006/12/05 19:40:45 sigurdne Exp $ -->
 {app_header}
-
-<center>
+<div class="projects_content"></div>
+<center>{message}</center>
 <form method="POST" name="app_form" action="{action_url}" 
enctype="multipart/form-data">
 <div align="center">
 <table class="tabletab">
@@ -12,7 +11,7 @@
         <tr>
           <td id="starttab"></td>
           <td>
-            <a href="#" tabindex="0" accesskey="1" onfocus="tab.display(1);" 
onclick="tab.display(1); return(false);">{lang_project}</a>
+            <a href="#" tabindex="0" accesskey="1" onfocus="tab.display(1);" 
onclick="tab.display(1); return(false);">Projekt</a>
           </td>
           <td id="tweentab_r"></td>
         </tr>
@@ -23,7 +22,7 @@
         <tr>
           <td id="tweentab_l"></td>
           <td>
-            <a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" 
onclick="tab.display(2); return(false);">{lang_persons}</a>
+            <a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" 
onclick="tab.display(2); return(false);">Personen</a>
           </td>
           <td id="tweentab_r"></td>
         </tr>
@@ -34,7 +33,7 @@
         <tr>
           <td id="tweentab_l"></td>
           <td>
-            <a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" 
onclick="tab.display(3); return(false);">{lang_time_and_budget}</a>
+            <a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" 
onclick="tab.display(3); return(false);">Zeit und Budget</a>
           </td>
           <td id="tweentab_r"></td>
         </tr>
@@ -45,19 +44,7 @@
         <tr>
           <td id="tweentab_l"></td>
           <td>
-            <a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" 
onclick="tab.display(4); return(false);">{lang_documentation}</a>
-          </td>
-          <td id="tweentab_r"></td>
-        </tr>
-      </table>
-    </th>
-
-               <th id="tab5" class="activetab" 
onclick="javascript:tab.display(5);">
-                       <table>
-                               <tr>
-                                       <td id="tweentab_l"></td>
-                                       <td>
-                                               <a href="#" tabindex="0" 
accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); 
return(false);">{lang_milestones}</a>
+            <a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" 
onclick="tab.display(4); return(false);">Dokumentation</a>
                                        </td>
                                        <td id="tweentab_r"></td>
                                </tr>
@@ -66,63 +53,62 @@
        </tr>
 </table>
 </div>
-
 <div id="tabcontent1" class="activetab">
 <table class="contenttab">
-       <tr class="row_on">
-               <td>{lang_parent}:</td>
-               <td>{parent_select}</td>
-               <td>{lang_previous}</td>
-               <td>{previous}</td>
+       <tr bgcolor="{row_on}">
+               <td width="20%">{lang_parent}:</td>
+               <td width="30%">{parent_select}</td>
+               <td width="20%">{lang_previous}</td>
+               <td width="30%">{previous}</td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_number}:</td>
                <td>{number}</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
        </tr>
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_investment_nr}:</td>
                <td>{investment_nr}</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_title}:</td>
                <td>{title}</td>
                <td>{lang_category}:</td>
                <td>{cat}</td>
        </tr>
 
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td valign="top">{lang_descr}:</td>
                <td colspan="3">{descr}</td>
        </tr>
 
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_start_date_planned}:</td>
                <td>{psdate}</td>
                <td>{lang_date_due_planned}:</td>
                <td>{pedate}</td>
        </tr>
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_start_date}:</td>
                <td>{sdate}</td>
                <td>{lang_date_due}:</td>
                <td>{edate}</td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_status}:</td>
                <td>{status}</td>
                <td valign="top">{lang_access}:</td>
                <td>{access}</td>
        </tr>
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_priority}:</td>
                <td>{priority}</td>
                <td colspan="2"></td>
        </tr>           
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_url}:</td>
                <td>{url}</td>
                <td>{lang_reference}:</td>
@@ -133,96 +119,130 @@
 
 <div id="tabcontent2" class="activetab">
 <table class="contenttab">
-       <tr class="th">
+       <tr bgcolor="{row_on}" style="font-weight: bold; text-align: center">
                <td colspan="5">{lang_customer}</td>
        </tr>
-       <tr class="row_on">
+       <tr bgcolor="{row_off}">
                <td>{lang_customer_nr}:</td>
                <td>{customer_nr}</td>
                <td><!-- {lang_orga}: --></td>
                <td colspan="2"></td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_person}:</td>
                <td>{customer}</td>
                <td colspan="3"></td>
        </tr>
-       <tr class="th">
-               <td colspan="5">{lang_project_team}</td>
+       <tr bgcolor="{row_on}" style="font-weight: bold; text-align: center">
+               <td colspan="5">Projekt-Team</td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td colspan="2">{lang_coordinator}:</td>
                <td colspan="3">{coordinator}</td>
        </tr>
-       <tr class="row_on">
+       <tr bgcolor="{row_off}">
+               <td colspan="2">{lang_salesmanager}:</td>
+               <td colspan="3">{salesmanager}</td>
+       </tr>
+       <tr bgcolor="{row_on}">
                <td colspan="5" style="text-align: left">{lang_employees}:</td>
        </tr>
-       <tr class="row_off">
-               <td>&nbsp;</td>
-               <td style="text-decoration: underline">{lang_name}</td>
-               <td style="text-decoration: underline">{lang_role}</td>
-               <td  colspan="2" style="text-decoration: 
underline">{lang_events}</td>
+       <tr bgcolor="{row_off}">
+               <td colspan="2" style="text-decoration: 
underline">{lang_name}</td>
+               <td colspan="2" style="text-decoration: 
underline">{lang_role}</td>
+               <td style="text-decoration: underline">{lang_events}</td>
        <tr>
 
 <!-- BEGIN emplist -->
 
-       <tr class="row_off">
-               <td>&nbsp;</td>
-               <td valign="top" nowrap="nowrap">{emp_name}&nbsp;</td>
-               <td valign="top" nowrap="nowrap">{role_name}&nbsp;</td>
-               <td colspan="2">{events}</td>
+       <tr bgcolor="{row_off}">
+               <td colspan="2" valign="top" 
nowrap="nowrap">{emp_name}&nbsp;</td>
+               <td colspan="2" valign="top" 
nowrap="nowrap">{role_name}&nbsp;</td>
+               <td>{events}</td>
        </tr>
 
 <!-- END emplist -->
 
+       
+       <tr bgcolor="{row_on}" align="center">
+               <td colspan="2"></td>
+               <td colspan="3"></td>
+       </tr>
+
+<!--begin rolefield1
+
+       <tr bgcolor="{row_off}">
+               <td valign="top">{lang_roles}:</td>
+               <td colspan="2">
+                       <table width="100%" border="0" cellspacing="2" 
cellpadding="2">
+
+end rolefield1
+begin rolelist
+
+                               <tr>
+                                       <td width="50%">{emp_name}</td>
+                                       <td width="50%">{role_name}</td>
+                               </tr>
+
+end rolelist
+
+begin rolefield2
+                       </table>
+               </td>
+               <td valign="top" align="right"><input type="submit" 
name="roles" value="{lang_edit_roles}"></td>
+       </tr>
+
+end rolefield2-->
 </table>
 </div>
 
 
 <div id="tabcontent3" class="activetab">
 <table class="contenttab">
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_plan_bottom_up}:</td>
                <td colspan="4" align="left">{plan_bottom_up_text}</td>
        </tr>
-       <tr class="row_off">
+<!-- BEGIN nonanonym -->
+
+       <tr bgcolor="{row_off}">
                <td>{lang_ptime}:</td>
                <td colspan="4">
                        <table width="100%" border="0">
-                               <tr class="row_on">
+                               <tr bgcolor="{row_on}">
                                        <td 
colspan="2">{lang_ptime}&nbsp;{lang_hours}&nbsp;[h]</td>
                                <tr>
-                               <tr class="row_off">
+                               <tr bgcolor="{row_off}">
                                        <td 
width="50%">&nbsp;{lang_project}:</td>
                                        <td align="right" 
width="50%">{ptime_item}&nbsp;</td>
                                </tr>
-                               <tr class="row_off">
-                                       <td 
width="50%">&nbsp;{lang_sub_projects}:</td>
+                               <tr bgcolor="{row_off}">
+                                       <td 
width="50%">&nbsp;{lang_sub_project}:</td>
                                        <td align="right" 
width="50%">{ptime_jobs}&nbsp;</td>
                                </tr>
-                               <tr class="row_off">
+                               <tr bgcolor="{row_off}">
                                        <td width="50%" style="border-top: 1px 
solid #000000">&nbsp;{lang_sum}:</td>
                                        <td align="right" width="50%" 
style="border-top: 1px solid #000000">{ptime_sum}&nbsp;</td>
                                </tr>
                        </table>
                </td>
        </tr>
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_budget}:</td>
                <td colspan="4">
                        <table width="100%" border="0">
-                               <tr class="row_on">
+                               <tr bgcolor="{row_on}">
                                        <td 
colspan="2">{lang_budget}&nbsp;[{currency}]</td>
                                <tr>
-                               <tr class="row_off">
+                               <tr bgcolor="{row_off}">
                                        <td 
width="50%">&nbsp;{lang_project}:</td>
                                        <td align="right" 
width="50%">{budget_item}&nbsp;</td>
                                </tr>
-                               <tr class="row_off">
-                                       <td 
width="50%">&nbsp;{lang_sub_projects}:</td>
+                               <tr bgcolor="{row_off}">
+                                       <td 
width="50%">&nbsp;{lang_sub_project}:</td>
                                        <td align="right" 
width="50%">{budget_jobs}&nbsp;</td>
                                </tr>
-                               <tr class="row_off">
+                               <tr bgcolor="{row_off}">
                                        <td width="50%" style="border-top: 1px 
solid #000000">&nbsp;{lang_sum}:</td>
                                        <td align="right" width="50%" 
style="border-top: 1px solid #000000">{budget_sum}&nbsp;</td>
                                </tr>
@@ -230,22 +250,22 @@
                </td>
        </tr>
 
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_extra_budget}:</td>
                <td colspan="4">
                        <table width="100%" border="0">
-                               <tr class="row_on">
+                               <tr bgcolor="{row_on}">
                                        <td 
colspan="2">{lang_extra_budget}&nbsp;[{currency}]</td>
                                <tr>
-                               <tr class="row_off">
+                               <tr bgcolor="{row_off}">
                                        <td 
width="50%">&nbsp;{lang_project}:</td>
                                        <td align="right" 
width="50%">{ebudget_item}&nbsp;</td>
                                </tr>
-                               <tr class="row_off">
-                                       <td 
width="50%">&nbsp;{lang_sub_projects}:</td>
+                               <tr bgcolor="{row_off}">
+                                       <td 
width="50%">&nbsp;{lang_sub_project}:</td>
                                        <td align="right" 
width="50%">{ebudget_jobs}&nbsp;</td>
                                </tr>
-                               <tr class="row_off">
+                               <tr bgcolor="{row_off}">
                                        <td width="50%" style="border-top: 1px 
solid #000000">&nbsp;{lang_sum}:</td>
                                        <td align="right" width="50%" 
style="border-top: 1px solid #000000">{ebudget_sum}&nbsp;</td>
                                </tr>
@@ -256,40 +276,70 @@
 {accounting_settings}
 {accounting_2settings}
 
+<!-- END nonanonym -->
+
 </table>
 </div>
 
 <div id="tabcontent4" class="activetab">
 <table class="contenttab">
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td valign="top">{lang_result}:</td>
                <td colspan="3">{result}</td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td valign="top">{lang_test}:</td>
                <td colspan="3">{test}</td>
        </tr>
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td valign="top">{lang_quality}:</td>
                <td colspan="3">{quality}</td>
        </tr>
-       <tr class="row_off">
+
+       <tr bgcolor="{row_off}">
+               <td valign="top">{lang_milestones}</td>
+               <td colspan="2">
+                       <table width="100%" border="0" cellspacing="2" 
cellpadding="2">
+
+<!-- BEGIN mslist -->
+
+                               <tr>
+                                       <td width="50%">{s_title}</td>
+                                       <td width="50%">{s_edateout}</td>
+                               </tr>
+
+<!-- END mslist -->
+
+                       </table>
+               </td>
+               <td align="right" valign="top"><!-- {edit_milestones_button} 
--></td>
+       </tr>
+       <tr bgcolor="{row_on}">
                <td valign="top">{lang_files}:</td>
-               <td colspan="3">{attachment}</td>
+               <td colspan="3">
+                       <table border="0" cellspacing="0" cellpadding="0" 
width="80%" style="padding: 5px;">
+                               <tr bgcolor="{row_off}">
+                                       <td>{lang_filename}</td>
+                       <td>{lang_period}</td>
+                       <td>&nbsp;</td>
+               </tr>
+                               {files}
+                       </table>
+               </td>
        </tr>
 
        <tr height="15">
                <td colspan="4">&nbsp;</td>
        </tr>
 
-       <tr class="row_on">
+       <tr bgcolor="{row_off}">
                <td>{lang_creator}:</td>
                <td>{owner}</td>
                <td>{lang_cdate}:</td>
                <td>{cdate}</td>
        </tr>
 
-       <tr class="row_off">
+       <tr bgcolor="{row_on}">
                <td>{lang_processor}:</td>
                <td>{processor}</td>
                <td>{lang_last_update}:</td>
@@ -298,28 +348,11 @@
 </table>
 </div>
 
-<div id="tabcontent5" class="activetab">
-<table class="contenttab">
-       <tr class="th">
-               <td>{lang_title}</td>
-               <td>{lang_date_due}</td>
-       </tr>
 
-<!-- BEGIN mslist -->
-
-       <tr>
-               <td width="50%">{s_title}</td>
-               <td width="50%">{s_edateout}</td>
-       </tr>
-
-<!-- END mslist -->
-
-</table>
-</div>
 
 <script language="JavaScript1.1" type="text/javascript">
 <!--
-  var tab = new 
Tabs(5,'activetab','inactivetab','tab','tabcontent','','','tabpage');
+  var tab = new 
Tabs(4,'activetab','inactivetab','tab','tabcontent','','','tabpage');
   tab.init();
   switch_budget_type('{budget_type}');
   set_factortr();
@@ -327,23 +360,21 @@
 </script>
 
 </form>
-</center>
-
 
 <!-- BEGIN accounting_act -->
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td valign="top">{lang_bookable_activities}:</td>
                <td colspan="4">{book_activities_list}&nbsp;</td>
        </tr>
 
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td valign="top">{lang_billable_activities}:</td>
                <td colspan="4">{bill_activities_list}&nbsp;</td>
        </tr>
 <!-- END accounting_act -->
 
 <!-- BEGIN accounting_own -->
-       <tr class="row_on" valign="top">
+       <tr bgcolor="{row_on}" valign="top">
                <td>{lang_accounting}:</td>
                <td>{accounting_factor}</td>
                <td>{lang_accounting_factor_for_project}:&nbsp;{currency}</td>
@@ -358,7 +389,7 @@
                        </table>
                </td>
        </tr>
-       <tr class="row_off">
+       <tr bgcolor="{row_off}">
                <td>{lang_billable}:</td>
                <td>{billable}</td>
                <td>{lang_direct_work}:</td>
@@ -369,7 +400,7 @@
        
 <!-- BEGIN accounting_both -->
 
-       <tr class="row_on">
+       <tr bgcolor="{row_on}">
                <td>{lang_invoicing_method}:</td>
                <td>{inv_method}</td>
                <td valign="top">{lang_discount}:&nbsp;{discount_type}</td>
@@ -388,3 +419,11 @@
        </tr>
 
 <!-- END sub -->
+
+<!-- BEGIN attachment_list -->        
+      <tr>
+          <td>{attachment_link}</td>
+          <td style="padding-left: 5px;">{attachment_comment}</td>
+          <td>{delete}</td>
+      </tr>
+<!-- END attachment_list -->
\ No newline at end of file

Index: templates/base/css/style.css
===================================================================
RCS file: /sources/phpgroupware/projects/templates/base/css/style.css,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- templates/base/css/style.css        16 Mar 2005 16:26:40 -0000      1.2
+++ templates/base/css/style.css        5 Dec 2006 19:40:45 -0000       1.3
@@ -1,14 +1,3 @@
-input.must, textarea.must
-{
-       border: 2px solid #dd5959;
-}
-
-td.must
-{
-       font-style: italic;
-       color: #630909;
-}
-
 td.holiday
 {
        color: red;
@@ -80,130 +69,3 @@
        padding:5px;
        text-align:justify;
 }
-
-body
-{
-       background-color: #ffffff;
-}
-
-input, select
-{
-       border: 1px solid #808080;
-       background-color: #ffffff;
-}
-
-fieldset
-{
-       border: 1px solid #808080;
-       padding: 1px 6px 6px 6px;
-       font-family: Verdana, Arial, Helvetica, sans-serif;
-       font-size: 9pt;
-       color: #000000;
-}
-
-fieldset.menu_toolbar
-{
-       padding: 1px 6px 6px 6px;
-       font-family: Verdana, Arial, Helvetica, sans-serif;
-       font-size: 2pt;
-       white-space: nowrap;
-}
-
-
-legend
-{
-       font-family: Verdana, Arial, Helvetica, sans-serif;
-       font-size: 7pt;
-       color: #000000;
-}
-
-legend.headline
-{
-}
-
-legend.menu_toolbar
-{
-}
-
-div.menu_button, div.menu_button_active, div.menu_button_inactive
-{
-       float: left;
-       margin: 2px;
-       padding: 4px;
-       font-family: Verdana, Arial, Helvetica, sans-serif;
-       font-size: 8pt;
-       text-align: center;
-       vertical-align: middle;
-       color: #000000;
-       text-align: center;
-       -moz-border-radius: 8px;
-       white-space: nowrap;
-}
-
-div.menu_button
-{
-       border: 2px solid #909090;
-}
-
-img.menu_button, img.menu_button_active, img.menu_button_inactive
-{
-       text-align: center;
-       vertical-align: middle;
-}
-
-img.menu_button_inactive
-{
-       filter: alpha(opacity=40);
-       -moz-opacity:40%;
-}
-
-div.menu_button_active
-{
-       border: 3px solid #000090;
-}
-
-div.menu_button_inactive
-{
-       border: 2px solid #e0e0e0;
-       filter: alpha(opacity=40);
-       -moz-opacity:40%;
-}
-
-a.menu_button, a.menu_button_active, a.menu_button_inactive
-{
-       text-decoration: none;
-       white-space: nowrap;
-}
-
-div.menu_icon, div.menu_icon_active, div.menu_icon_inactive
-{
-       float: left;
-       margin: 3px;
-       padding: 3px;
-       width: 15px;
-       height: 15px;
-       font-family: Verdana, Arial, Helvetica, sans-serif;
-       font-size: 8pt;
-       text-align: center;
-       vertical-align: middle;
-       color: #000000;
-       text-align: center;
-       -moz-border-radius: 8px;
-}
-
-div.menu_icon, div.menu_icon_active, div.menu_icon_inactive
-{
-}
-
-img.menu_icon_inactive
-{
-       filter: alpha(opacity=40);
-       -moz-opacity:40%;
-}
-
-table.contenttab
-{
-       width:850px;
-    min-width:850px;
-    vertical-align:center;
-}

Index: css/style.css
===================================================================
RCS file: css/style.css
diff -N css/style.css
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ css/style.css       5 Dec 2006 19:40:44 -0000       1.4
@@ -0,0 +1,71 @@
+td.holiday
+{
+       color: red;
+}
+
+.projects_box
+{
+       background-color:transparent;
+       /* position:relative; */
+       top: 15px; 
+       left: 200px;
+       z-index: 2;
+       display: none;
+
+       position: absolute;
+       color:black;
+       background-color:#DBD6CB;
+       text-decoration:none;
+       width:450px;
+       border-top:2px solid #837c6b;
+       border-right:2px solid #e4d9c0;
+       border-bottom:2px solid #e4d9c0;
+       border-left:2px solid #837c6b;
+}
+.projects_box a 
+{
+       text-decoration:none;
+       display:block;
+       padding:5px;
+}
+
+.projects_box visited
+{
+       text-decoration:none;
+       background-color:transparent;
+       display:none;
+}
+
+.projects_box a:hover 
+{
+       position: absolute;
+       display:none;
+       color:#f6e4c1;
+       background-color:#DBD6CB;
+       text-decoration:none;
+       width:450px;
+       border-top:2px solid #837c6b;
+       border-right:2px solid #e4d9c0;
+       border-bottom:2px solid #e4d9c0;
+       border-left:2px solid #837c6b;
+}
+
+.projects_box a:active 
+{
+       color:#f6e4c1;
+}
+
+.projects_box a .info 
+{
+       display:none;
+}
+
+.projects_box a:hover .info 
+{
+       color:black; 
+       background:#DBD6CB;
+       font:8pt courier,sans-serif;
+       display:none;
+       padding:5px;
+       text-align:justify;
+}
\ No newline at end of file

Index: inc/class.attached_files.inc.php
===================================================================
RCS file: inc/class.attached_files.inc.php
diff -N inc/class.attached_files.inc.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ inc/class.attached_files.inc.php    5 Dec 2006 19:40:45 -0000       1.4
@@ -0,0 +1,214 @@
+<?php
+       /**
+       * Project Manager - attached_files 
+       *
+       * @author Lars Piepho address@hidden
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @package projects
+       * @version $Id: class.attached_files.inc.php,v 1.4 2006/12/05 19:40:45 
sigurdne Exp $
+       * $Source: 
/sources/phpgroupware/projects/inc/class.attached_files.inc.php,v $
+       */
+       
+       class attached_files
+       {
+
+               var $public_functions = array
+               (
+                       'show_file'             => True,
+                       'save_file'     => True,
+                       'delete_file'   => True,
+                       'get_file'              => True
+               );
+               var $file;
+               var $vfs;
+               var $project_id;
+
+               function attached_files()
+               {
+                       $this->file                     = $_REQUEST['file'];
+                       $this->project_id       = $_REQUEST['project_id'];
+                       $this->vfs                      = 
CreateObject('phpgwapi.vfs');
+                       $this->session          = $GLOBALS['phpgw']->session;
+                       $this->vfs->override_acl = True;
+               }
+
+               function show_file()
+               {
+                       $ls_array = $this->vfs->ls(array
+                       (
+                               'string'                => $this->file,
+                               'relatives'             => array (RELATIVE_ALL),
+                               'checksubdirs'  => False,
+                               'nofiles'               => True
+                       ));
+
+                       if ($ls_array[0]['mime_type'])
+                       {
+                               $mime_type = $ls_array[0]['mime_type'];
+                       }
+                       elseif ($GLOBALS['settings']['viewtextplain'])
+                       {
+                               $mime_type = 'application/octet-stream;';
+                       }
+                       $filename = basename($this->file);
+                       header('Content-type: ' . $mime_type);
+                       header('Content-Disposition: attachment; filename=' . 
$filename);
+                       echo $this->vfs->read(array
+                               (
+                                       'string'        => $this->file,
+                                       'relatives'     => array(RELATIVE_NONE)
+                               ));
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+
+               function save_file($project_id, $source = '', $destination = 
'', $details = false)
+               {
+                       //Check if home/groupdirectory exists. If not, we 
create it
+                       $basedir = '/projects';
+                       if (!file_exists($basedir))
+                       {
+                               $this->vfs->override_acl = 1;
+                               $this->vfs->mkdir(array
+                               (
+                                       'string'        => $basedir,
+                                       'relatives'     => array (RELATIVE_ALL)
+                               ));
+                               $this->vfs->override_acl = 0;
+                       }                               
+
+                       $attdir = $basedir . '/' . $project_id;                 
+
+                       if (!file_exists($attdir))
+                       {
+                               $this->vfs->override_acl = 1;
+                               $this->vfs->mkdir(array
+                               (
+                                       'string' => $attdir,
+                                       'relatives' => array (RELATIVE_ALL)
+                               ));
+                               $this->vfs->override_acl = 0;
+                       }
+                       
+                       if(!$source || !$destination)
+                       {
+                               $source = $_FILES['attachment']['tmp_name'];
+                               $destination = $_FILES['attachment']['name'];
+                       }
+                                               
+                       $this->vfs->override_acl = 1;
+                       $this->vfs->cp(array 
+                       (
+                               'from'          => $source,
+                               'to'            => $attdir . '/' . $destination,
+                               'relatives'     => array 
(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)
+                       ));
+                       $this->vfs->override_acl = 0;
+                       
+                       if($details)
+                       {
+                               $GLOBALS['phpgw']->db->query("UPDATE phpgw_vfs 
SET comment='" . $details['comment'] . "', owner_id=" . $details['owner_id'] . 
" where name like '" . $destination . "' AND size > 0 AND mime_type NOT like 
'journal-deleted'",__LINE__,__FILE__);                               
+                       }
+               }
+
+               function delete_file($project_id = true)
+               {       
+                       $basedir = '/projects';
+
+                       if(!$this->file && file_exists($basedir . '/' . 
$project_id))
+                       {
+                               $this->vfs->override_acl = 1;
+                               $this->vfs->delete(array
+                               (
+                                       'string'        => $basedir . '/' . 
$project_id,
+                                       'relatives'     => array (RELATIVE_ALL)
+                               ));
+                               $this->vfs->override_acl = 0;
+                       }
+                       elseif($this->file)
+                       {
+                               $this->vfs->override_acl = 1;
+                               $this->vfs->rm(array
+                               (
+                                       'string'        => $basedir . '/' . 
$this->project_id . '/' . $this->file,
+                                       'relatives' => array (RELATIVE_ALL)
+                               ));
+                               $this->vfs->override_acl = 0;
+                               $clickhistory = 
$this->session->get_click_path_entry(1);
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array
+                                                                               
                                        (
+                                                                               
                                                'menuaction' => 
$clickhistory['menuaction'],
+                                                                               
                                                'project_id' => 
$clickhistory['get']['project_id'],
+                                                                               
                                                'deleted'    => true
+                                                                               
                                        ));
+                       }
+               }
+
+               function get_files($project_id, $delete = false, $details = 
false, $user_id = false)
+               {
+                       $GLOBALS['phpgw']->db->query("SELECT 
name,owner_id,comment from phpgw_vfs where directory like '/projects/" . 
$project_id . "' AND size > 0 AND mime_type NOT like 
'journal-deleted'",__LINE__,__FILE__);
+                       $x = 0;
+                       
+                       if($user_id)
+                       {
+                               $user = $user_id;
+                       }
+                       else
+                       {
+                               $user = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       }
+                               
+                       while ($GLOBALS['phpgw']->db->next_record() != '')
+                       {
+                               $attachment[$x] =  '/projects/' . $project_id . 
'/' . $GLOBALS['phpgw']->db->f('name');
+                               //++$x;
+                               $owner[$x] = 
$GLOBALS['phpgw']->db->f('owner_id');
+                               $comment[$x] = 
$GLOBALS['phpgw']->db->f('comment');
+                       /*}
+
+                       for($i=0; $i<=$x-1; $i++)
+                       {*/
+                               $file = 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
                                        (
+                                                                               
                                                'menuaction'    => 
'projects.attached_files.show_file',
+                                                                               
                                                'file'                  => 
$attachment[$x]
+                                                                               
                                        ));
+                               /*
+                               if($details)
+                               {
+                                       $details = '&nbsp;&nbsp;|&nbsp;&nbsp;' 
. $comment[$x];
+                               }
+                               */                      
+                               if($delete)
+                               {
+                                       $delFile = basename($attachment[$x]);
+                                       $delLink = 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
                                                        (
+                                                                               
                                                                'menuaction'    
=> 'projects.attached_files.delete_file',
+                                                                               
                                                                'project_id'    
=> $project_id,
+                                                                               
                                                                'file'          
        => $delFile
+                                                                               
                                                        ));
+                                       $del = '<a href="' . $delLink . '"><img 
src="' . $GLOBALS['phpgw']->common->image('phpgwapi','delete') . '" title="' . 
lang('delete') . '" border="0"></a>';
+                               } 
+                               $attLink = '<a href="' . $file . '" 
target="_blank">' . basename($attachment[$x]) . '</a><br />';
+                               
+                               if($owner[$x]==$user)
+                               {
+                                       $files[$x] = array(
+                                                                               
'link' => $attLink,
+                                                                               
'comment' => $comment[$x],
+                                                                               
'delLink' => $del);
+                               
+                                       ++$x;
+                               }
+                       }
+                       
+                       return ($files);
+               }
+               
+               function file_exists($data)
+               {
+                       return $this->vfs->file_exists($data);
+               }
+       }
+?>

Index: inc/class.checker.inc.php
===================================================================
RCS file: inc/class.checker.inc.php
diff -N inc/class.checker.inc.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ inc/class.checker.inc.php   5 Dec 2006 19:40:45 -0000       1.1
@@ -0,0 +1,48 @@
+<?php
+
+class checker
+{
+       var $errorMsg = array();
+       
+       function checker()
+       {
+  }
+  
+  function checkProjectNr($pNr = '')
+  {
+               if (!$pNr)
+               {
+                       $this->setErrorMsg(lang('Please enter the project id'));
+                       return false;
+               }
+                       
+               if (strlen($pNr) > 250)
+               {
+                       $this->setErrorMsg(lang('id can not exceed 250 
characters in length'));
+                       return false;
+               }
+
+               return true;
+       }
+  
+  function setErrorMsg($errorMsg)
+  {
+       $this->errorMsg[] = $errorMsg;
+  }
+  
+  function getLastErrorMsg()
+  {
+       $i = count($this->errorMsg) - 1;
+       if($i >= 0)
+               return $this->errorMsg[$i];
+       else
+               return '';
+  }
+
+  function getErrorMsg()
+  {
+       return $this->errorMsg;
+  }
+  
+}
+?>
\ No newline at end of file

Index: inc/class.checker_pb.inc.php
===================================================================
RCS file: inc/class.checker_pb.inc.php
diff -N inc/class.checker_pb.inc.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ inc/class.checker_pb.inc.php        5 Dec 2006 19:40:45 -0000       1.1
@@ -0,0 +1,118 @@
+<?php
+require_once 'class.checker.inc.php';
+
+class checker_pb extends checker
+{
+       function checkProjectNr($pNr = '')
+  {
+       if(!parent::checkProjectNr($pNr))
+       {
+               return false;
+       }
+
+       /* Dokumentation regex
+                * 
+        
+               ^[PSIDV] // Typ; Kein A, da keine Vorplanung im Tool, wegen 
Projektleichen.
+               [0-9]{2} // Jahr
+               [0][1-6] // Niederlassung
+       
+               // Redundanter Auftragstyp als Nummer kodiert
+               (
+         (?<=^A[0-9]{4})0 | 
+         (?<=^P[0-9]{4})1 | 
+         (?<=^I[0-9]{4})7 | 
+         (?<=^V[0-9]{4})5 | 
+         (?<=^S[0-9]{4})8 | 
+         (?<=^D[0-9]{4})9 
+               )
+       
+               [0-9]{5} // Kundennummer, Laufende Projektnummer
+       
+               */
+                       
+       //Check auf alte oder neue Projekt-Nr.
+               if($pNr == '-')
+               {
+                       return true;
+               }
+               else
+               {
+               if(strlen($pNr) != 11)
+               {
+                               $this->setErrorMsg('Projekt-Nr. muss eine Länge 
von 11 Zeichen haben');
+                               return false;
+               }
+
+
+               $year = substr($pNr, 1, 2);
+               $location = substr($pNr, 3, 2);
+                       $p_12_map = array('01' => 'Hannover', '02' => 'Berlin', 
'03' => 'Frankfurt', '04' => 'Düsseldorf', '05' => 'München', '06' => 
'Hamburg');
+               
+                       if(is_numeric($year) && (int) $year < 4)
+                       {
+                               
if(preg_match('/^[P][0-9]{2}[0][1-6][0-9]{6}$/', $pNr))
+                               {
+                                       return true;
+                               }
+
+                               // genauen Fehler für genauere Fehlermeldung 
bestimmen
+                               if(!isset($p_12_map[$location]))
+                               {
+                                       $this->setErrorMsg('Fehler in der 
Projekt-Nr.: 4. und 5. Stelle (\'Code für die Niederlassung\') ist ungültig');
+                                       return false;
+                               }
+
+                               $p_0_5_map = array('P'=>1);
+                               if(!isset($p_0_5_map[$pNr[0]]))
+                               {
+                                       $this->setErrorMsg('Fehler in der 
Projekt-Nr.: 1. Stelle (\'Art der Nummer\') muss eine Buchstabe (P) sein');
+                                       return false;
+                               }
+
+                               $this->setErrorMsg('Fehler in der Projekt-Nr.');
+                               return false;
+                       }
+                       elseif(is_numeric($year))
+                       {
+                               
if(preg_match('/^[PSIDV][0-9]{2}[0][1-6]((?<=^P[0-9]{4})1|(?<=^S[0-9]{4})8|(?<=^I[0-9]{4})7|(?<=^D[0-9]{4})9|(?<=^V[0-9]{4})5)[0-9]{5}$/',
 $pNr, $matches))
+                               {
+                                       return true;
+                               }
+
+                               // genauen Fehler für genauere Fehlermeldung 
bestimmen
+                               if(!isset($p_12_map[$location]))
+                               {
+                                       $this->setErrorMsg('Fehler in der 
Projekt-Nr.: 4. und 5. Stelle (\'Code für die Niederlassung\') ist ungültig');
+                                       return false;
+                               }
+
+                               $p_0_5_map = array('P'=>1, 'S'=>8, 'I'=>7, 
'D'=>9, 'V'=>5);
+                               if(!is_numeric($pNr[5]))
+                               {
+                                       $this->setErrorMsg('Fehler in der 
Projekt-Nr.: 6. Stelle (\'Art des Auftrages\') muss eine Ziffer sein');
+                                       return false;
+                               }
+
+                               if(!isset($p_0_5_map[$pNr[0]]))
+                               {
+                                       $this->setErrorMsg('Fehler in der 
Projekt-Nr.: 1. Stelle (\'Art der Nummer\') muss eine Buchstabe (P, S, I, D 
oder V) sein');
+                                       return false;
+                               }
+                                               
+                               if( (int)$pNr[5] != $p_0_5_map[$pNr[0]] )
+                               {
+                                       $this->setErrorMsg('Fehler in der 
Projekt-Nr.: 1. und 6. Stelle (\'Art der Nummer umd des Auftrages\') müssen 
korrespondieren ('.$pNr[0].'....'.$p_0_5_map[$pNr[0]].'.....)');
+                                       return false;
+                               }
+
+                               $this->setErrorMsg('Fehler in der Projekt-Nr.');
+                               return false;
+                       }
+
+                       $this->setErrorMsg('Fehler in der Projekt-Nr.: 2. und 
3. Stelle (\'Code für das Geschäftsjahr\') müssen eine zweistellige 
Jahresangabe sein');
+                       return false;
+         }
+  }
+}
+?>
\ No newline at end of file

Index: inc/class.ipc_projects.inc.php
===================================================================
RCS file: inc/class.ipc_projects.inc.php
diff -N inc/class.ipc_projects.inc.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ inc/class.ipc_projects.inc.php      5 Dec 2006 19:40:45 -0000       1.1
@@ -0,0 +1,202 @@
+<?php
+       /**
+       * IPC Class for Projects
+       * @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: class.ipc_projects.inc.php,v 1.1 2006/12/05 19:40:45 
sigurdne Exp $
+       */
+
+       /**
+       * Fassade of the projects application.
+       * @package projects
+       */
+       class ipc_projects extends ipc_
+       {
+               /**
+               * @var object $bo application storage object
+               * @access private
+               */
+               var $boprojects;
+
+
+               /**
+               * Constructor
+               */
+               function ipc_projects()
+               {
+                       $this->boprojects =& 
CreateObject('projects.boprojects');
+               }
+
+               /**
+               * Get data from the application in a certain mime type format.
+               * @param integer $id id of data to get from the application
+               * @param string $type specifies the mime type of the returned 
data
+               * @param string $version specifies the mime type version of the 
returned data
+               * @return mixed data from application, the datatype depends on 
the passed mime type, false if no data exists for the passed id
+               */
+               function getData($id, $type, $version='')
+               {
+
+                       if($type == 'x-phpgroupware/projects-view-url')
+                       {
+                               $link_data['menuaction'] = 
'projects.uiprojects.view_project';
+                               $link_data['action'] = 'mains';
+                               $link_data['project_id'] = $id;
+                               return 
$GLOBALS['phpgw']->link('/index.php',$link_data);
+                       }
+                       
+                       $pro = $this->boprojects->read_single_project($id);
+                       if(!$pro)
+                       {
+                               return false;
+                       }
+                       else
+                       {
+                               // project data are 
'x-phpgroupware/projects-appl-data-array'
+                               $convertTypeIn     = 
'x-phpgroupware/projects-appl-data-array';
+                               $convertVersionIn  = '';
+                               $convertTypeOut    = $type;
+                               $convertVersionOut = $version;
+
+                               // convert fields to mime type format
+                               return $this->convertData($pro, $convertTypeIn, 
$convertVersionIn, $convertTypeOut, $convertVersionOut);
+                       }
+
+               }
+               
+               /**
+               * Return a list with the available id's in the application.
+               * The optional lastmod parameter allows a limitations of the 
data id list.
+               * The list contains all the id's of the modified data since the 
passed lastmod timestamp.
+               * @param integer $lastmod last modification time, default is -1 
and means return all data id's.
+               * @param string $restriction restrict the result for a special 
use of the id list. The possible restrictions are 'syncable' or 'searchable'. 
When using 'syncable' only person ids will be returned in the result. 
'searchable' returns all ids for both persons and orgs without check the owner. 
Otherwise no restriction will be used and the result contains all ids for both 
persons and orgs from the owner.
+               * @return array list of data id's
+               */
+               function getIdList($lastmod=-1, $restriction='')
+               {
+                       $idList = array();
+                       $lastmod = intval($lastmod);
+                       
+                       $sql = 'SELECT DISTINCT project_id FROM 
phpgw_p_projects';
+                       
$this->boprojects->soprojects->db->query($sql,__LINE__,__FILE__);
+                       while ($this->boprojects->soprojects->db->next_record())
+                       {
+                               $idList[] =     
$this->boprojects->soprojects->db->Record['project_id'];
+                       }
+
+                       return $idList;
+               }
+
+               /**
+               * Checks if data for the passed id exists.
+               * @param integer $id id to check
+               * @return boolean true if the data with id exist, otherwise 
false
+               */
+               function existData($id)
+               {
+                       return $this->boprojects->soprojects->reallyexists($id);
+               }
+
+               /**
+               * Convert the given data from a mime type into another.
+               * @param mixed $data data for converting
+               * @param string $typeIn specifies the mime type of the passed 
data
+               * @param string $versionIn specifies the mime type version of 
the passed data
+               * @param string $typeOut specifies the mime type of the 
returned data
+               * @param string $versionOut specifies the mime type version of 
the returned data
+               * @return mixed data from application, the datatype depends on 
the passed typeOut and versionOut parameters
+               */
+               function convertData($data, $typeIn, $versionIn, $typeOut, 
$versionOut)
+               {
+                       switch($typeIn)
+                       {
+                               case 'x-phpgroupware/projects-data-array':
+                                       $appl_data_array = 
$this->_import_projects_data_array($data, $versionIn);
+                               break;
+                               case 
'x-phpgroupware/projects-serialized-appl-data-array':
+                                       $appl_data_array = 
unserialize(trim($data));
+                               break;
+                               case 'x-phpgroupware/projects-appl-data-array':
+                                       // no import convert
+                                       $appl_data_array = $data;
+                               break;
+                               default:
+                                       return false;
+                       }
+
+                       if(!$appl_data_array)
+                               return false;
+
+                       switch($typeOut)
+                       {
+                               case 'x-phpgroupware/projects-data-array':
+                                       $ret_data = 
$this->_export_projects_data_array($appl_data_array, $versionOut);
+                               break;
+                               case 'x-phpgroupware/search-index-data-item':
+                                       $ret_data = 
$this->_export_index_data_item($appl_data_array, $versionOut);
+                               break;
+                               case 
'x-phpgroupware/projects-serialized-appl-data-array':
+                                       $ret_data = serialize($appl_data_array);
+                               break;
+                               case 'x-phpgroupware/projects-appl-data-array':
+                                       // no export convert
+                                       $ret_data = $appl_data_array;
+                               break;
+                               default:
+                                       return false;
+                       }
+                       
+                       return $ret_data;
+               }
+
+               /**
+               * Convert the extern data array structure into intern 
application array
+               * @access private
+               * @param array $fields extern data array
+               * @return string xml
+               */
+               function _import_projects_data_array($fields, $versionIn)
+               {
+               }
+
+
+               function _export_projects_data_array($fields, $versionOut)
+               {
+               }
+               
+
+               function &_export_index_data_item($fields, $version='1.0')
+               {
+                       $indexitem = CreateObject('pbsearch.IndexBaseDataItem', 
'projects', $fields['project_id']);
+
+                       $indexitem->setValue('DataDisplayName', 
$fields['number'].' '.$fields['title']);
+                       $indexitem->setValue('DataOwnerId', $fields['owner']);
+                       $indexitem->setValue('DataAccess', $fields['access']);
+                       $indexitem->setValue('DataTimeCreated', '');
+                       $indexitem->setValue('DataTimeModified', '');
+                       $indexitem->setValue('DataCategoryId', $fields['cat']);
+                       
+                       $data['title']          = $fields['title'];
+                       $data['number']         = $fields['number'];
+                       $data['investment_nr']  = $fields['investment_nr'];
+                       $data['descr']          = $fields['descr'];
+                       $data['coordinatorout'] = $fields['coordinatorout'];
+                       $data['status']         = $fields['status'];
+                       $data['url']            = $fields['url'];
+                       $data['reference']      = $fields['reference'];
+                       $data['customer_nr']    = $fields['customer_nr'];
+                       $data['test']           = $fields['test'];
+                       $data['quality']        = $fields['quality'];
+                       $data['result']         = $fields['result'];
+                       $data['customerout']    = $fields['customerout'];
+                       $data['customerorgout'] = $fields['customerorgout'];
+                       $indexitem->setValue('Data', $data);
+
+                       return $indexitem;
+               }
+
+       }
+?>

Index: inc/class.ofprojects.inc.php
===================================================================
RCS file: inc/class.ofprojects.inc.php
diff -N inc/class.ofprojects.inc.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ inc/class.ofprojects.inc.php        5 Dec 2006 19:40:45 -0000       1.1
@@ -0,0 +1,82 @@
+<?php
+       /**
+       * Project Manager
+       * @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: class.ofprojects.inc.php,v 1.1 2006/12/05 19:40:45 
sigurdne Exp $
+       */
+
+       class ofprojects extends 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)
+               */
+               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);
+                       switch($ci['class'])
+                       {
+                               case 'checker':
+                                       return 
ofprojects::CreateCheckerObject();
+                               break;
+                               default:
+                                       return 
parent::CreateObject($class,$p1,$p2,$p3,$p4,$p5,$p6,$p7,$p8,$p9,$p10,$p11,$p12,$p13,$p14,$p15,$p16);
+                       }
+               }
+               
+               function CreateCheckerObject($params = array())
+               {
+                       // get customer version setting
+                       $soconfig               = 
CreateObject('projects.soconfig');
+                       $siteconfig     = $soconfig->get_site_config();
+                       if(isset($siteconfig['customer_version_id']))
+                       {
+                               $customer_version_id = 
$siteconfig['customer_version_id'];
+                       }
+                       else
+                       {
+                               $customer_version_id = 'standard';
+                       }
+
+                       $loaded = false;
+                       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)
+                       {
+                               $checkerClassName = 'checker';
+                               if(!include_class('projects', 
$checkerClassName))
+                               {
+                                       return null;
+                               }
+                       }
+
+                       return new $checkerClassName();
+               }
+               
+       }
+?>

Index: inc/class.phpOpenOffice.inc.php
===================================================================
RCS file: inc/class.phpOpenOffice.inc.php
diff -N inc/class.phpOpenOffice.inc.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ inc/class.phpOpenOffice.inc.php     5 Dec 2006 19:40:45 -0000       1.1
@@ -0,0 +1,333 @@
+<?php
+// +----------------------------------------------------------------------+
+// | phpOpenOffice - Solution for modifying OpenOffice documents with PHP |
+// | v0.1b - 18/12/2003                                                   |
+// |                                                                      |
+// | This software is published under BSD licence.                        |
+// | http://www.opensource.org/licenses/bsd-license.php                   |
+// +----------------------------------------------------------------------+
+// | Written by Bjoern Kahle, Hamburg 2003 (phpopenoffice at pinasoft.de) |
+// | http://www.pinasoft.de/projects/phpOpenOffice/                       |
+// +----------------------------------------------------------------------+
+
+// Where is phpOpenOffice going to store the documents temporarly
+if (!defined('POO_TMP_PATH')) {
+  define('POO_TMP_PATH', '/tmp');
+}
+
+
+// Where are the OpenOffice templates
+if (!defined('POO_TEMPLATE_PATH')) {
+  define('POO_TEMPLATE_PATH', "");
+}
+
+// PhpConcept Library - Zip Module 2.0
+// http://www.phpconcept.net
+if (!defined('PCLZIP_INCLUDE_PATH')) {
+  define('PCLZIP_INCLUDE_PATH',"pclzip/");
+}
+define( 'PCLZIP_TEMPORARY_DIR', POO_TMP_PATH );
+require PCLZIP_INCLUDE_PATH . 'pclzip.lib.php';
+
+
+// Use zlib from PHPMyAdmin for writing zipped files,
+// because documents created with PclZip cannot be opened with OpenOffice
+// Needs to be fixed in later version.
+if (!defined('ZIPLIB_INCLUDE_PATH')) {
+  define('ZIPLIB_INCLUDE_PATH', "");
+}
+require ZIPLIB_INCLUDE_PATH . 'zip.lib.php';
+
+
+// How are variables defined within the document
+if (!defined('POO_VAR_PREFIX')) {
+  define('POO_VAR_PREFIX', '%');
+}
+
+if (!defined('POO_VAR_SUFFIX')) {
+  define('POO_VAR_SUFFIX', '%');
+}
+
+
+// Callback function for pclzip
+$archiveFiles = array();
+function ooPreAdd($p_event, &$p_header)
+{
+       global $archiveFiles;
+       if($p_header['folder'] == 0)
+               $archiveFiles[] = $p_header["stored_filename"];
+       return 0;
+}
+
+
+class phpOpenOffice
+{
+       var $tmpDirName = "";
+       var $parserFiles = "";
+       var $parsedDocuments = "";
+       var $mimetypeFile = "";
+       var $mimetype = "";
+       var $zipFile = "";
+
+
+       // Load document from filesystem
+       function loadDocument($filename)
+       {
+               if(!file_exists($filename))
+               {
+                       $this->handleError("File not found: ".$filename, 
E_USER_ERROR);
+               }
+               else
+               {
+                       $this->zipFile = $filename;
+               }
+
+
+               // Find a random folder name for PCLZIP_OPT_ADD_PATH
+               $this->tmpDirName = $this->getRandomString(16);
+               $this->mimetypeFile = 
POO_TMP_PATH."/".$this->tmpDirName."/mimetype";
+               $this->parserFiles = array();
+               $this->parserFiles["content.xml"] = 
POO_TMP_PATH."/".$this->tmpDirName."/content.xml";
+               $this->parserFiles["styles.xml"] = 
POO_TMP_PATH."/".$this->tmpDirName."/styles.xml";
+
+
+               // Open archive and extract content.xml
+               $archive = new PclZip($filename);
+               $list = $archive->extract(PCLZIP_OPT_PATH, POO_TMP_PATH, 
PCLZIP_OPT_ADD_PATH, $this->tmpDirName);
+       }
+
+
+       // Put variables into extracted content file
+       function parse($variables)
+       {
+               // Has file been extracted ?
+               if($this->tmpDirName == "")
+               {
+                       $this->handleError("No document loaded. Use 
loadDocument function first.", E_USER_ERROR);
+               }
+
+
+               // Is dir still there
+               if(!is_dir(POO_TMP_PATH."/".$this->tmpDirName))
+               {
+                       $this->handleError("Directory not found: 
".$this->tmpDirName, E_USER_ERROR);
+               }
+
+
+               // Is argument valid ?
+               if(!is_array($variables))
+               {
+                       $this->handleError("First parameter need to been an 
array.", E_USER_ERROR);
+               }
+
+
+               // Read mimetype
+               $fp = fopen($this->mimetypeFile, "r");
+               $this->mimetype = fread($fp, filesize($this->mimetypeFile));
+               fclose($fp);
+
+
+               // Open files and start parsing
+               $parsedDocuments = array();
+               foreach (array_keys($this->parserFiles) as $file)
+               {
+                       $fp = fopen($this->parserFiles[$file], "r");
+                       $this->parsedDocuments[$file] = fread($fp, 
filesize($this->parserFiles[$file]));
+                       fclose($fp);
+
+                       foreach(array_keys($variables) as $key)
+                       {
+                               $value = $this->xmlencode( $variables[$key] );
+                               $this->parsedDocuments[$file] = 
str_replace(POO_VAR_PREFIX.$key.POO_VAR_SUFFIX, $value, 
$this->parsedDocuments[$file]);
+                       }
+               }
+       }
+
+
+       // encode string xml compatible
+       function xmlencode($param)
+       {
+               $xml = $param;
+
+               $xml = str_replace("&", "&amp;", $xml);
+               $xml = str_replace(">", "&gt;", $xml);
+               $xml = str_replace("<", "&lt;", $xml);
+               $xml = str_replace("'", "&apos;", $xml);
+               $xml = str_replace("\"", "&quot;", $xml);
+
+               $xml = utf8_encode($xml);
+               return $xml;
+       }
+
+       // Save parsed document
+       function savefile($filename)
+       {
+               global $archiveFiles;
+
+
+               // Has file been extracted ?
+               if($this->tmpDirName == "")
+               {
+                       $this->handleError("No document loaded. Use 
loadDocument function first.", E_USER_ERROR);
+               }
+
+
+               // Is dir still there
+               if(!is_dir(POO_TMP_PATH."/".$this->tmpDirName))
+               {
+                       $this->handleError("Directory not found: 
".$this->tmpDirName, E_USER_ERROR);
+               }
+
+
+               //Overwrite parsed documents
+               foreach (array_keys($this->parserFiles) as $file)
+               {
+                       $fp = fopen($this->parserFiles[$file], "w+");
+                       fputs($fp, $this->parsedDocuments[$file]);
+                       fclose($fp);
+               }
+
+               // Create new (zip-)file - Add all files and subdirectories 
from temporary directory
+               $archive = new PclZip($filename);
+               $v_list = $archive->create(POO_TMP_PATH."/".$this->tmpDirName, 
PCLZIP_OPT_REMOVE_PATH, POO_TMP_PATH."/".$this->tmpDirName."/", 
PCLZIP_CB_PRE_ADD, "ooPreAdd");
+
+
+               // zip.lib dirty hack
+               $zip = new zipfile();
+
+
+               // Add specials files without compression
+               for($i = 0; $i < count($archiveFiles); $i++)
+               {
+                       $file = $archiveFiles[$i];
+
+                       /*if( $file == "mimetype" || $file == "meta.xml" || 
substr( $file, 0, 9) == "Pictures/" )
+                       {
+                               $v_list = 
$archive->add(POO_TMP_PATH."/".$this->tmpDirName."/".$file, 
PCLZIP_OPT_REMOVE_PATH, POO_TMP_PATH."/".$this->tmpDirName."/", 
PCLZIP_OPT_NO_COMPRESSION);
+                       }
+                       else
+                       {
+                               $v_list = 
$archive->add(POO_TMP_PATH."/".$this->tmpDirName."/".$file, 
PCLZIP_OPT_REMOVE_PATH, POO_TMP_PATH."/".$this->tmpDirName."/");
+                       }
+                       */
+
+
+                       // zip.lib dirty hack
+                       $fp = 
fopen(POO_TMP_PATH."/".$this->tmpDirName."/".$file, "r");
+                       $content = fread($fp, 
filesize(POO_TMP_PATH."/".$this->tmpDirName."/".$file));
+                       fclose($fp);
+                       $zip->addFile($content, $file);
+               }
+
+
+               // Finally write file to disk => zip.lib dirty hack
+               $fp = fopen($filename, "w+");
+               fputs($fp, $zip->file());
+               fclose($fp);
+       }
+
+
+
+       function download($filename)
+       {
+               // Build filename and save file temporarly to harddisk
+               if($filename == "") $filename = $this->getRandomString(16);
+               $info = pathinfo($this->zipFile);
+               $fullfile = $filename.".".$info["extension"];
+               $downloadFile = POO_TMP_PATH."/".$fullfile;
+               $this->savefile($downloadFile);
+
+
+               // Read temp file
+               $fp = fopen($downloadFile, "r");
+               $content = fread($fp, filesize($downloadFile));
+               fclose($fp);
+
+
+               // Build HTTP header and send file
+               header("Expires: ".date("D, d M Y H:i:s", time() - 24 * 60 * 
60)." GMT");       // expires in the past
+               header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");      
                // Last modified, right now
+               header("Cache-Control: no-cache, must-revalidate");             
                // Prevent caching, HTTP/1.1
+               header("Pragma: no-cache");
+               header("Content-Type: ".$this->mimetype);
+               header('Content-Length: '.filesize($downloadFile));
+               header('Content-Transfer-Encoding: binary');
+
+
+               // (Browser specific)
+               $browser = $_SERVER["HTTP_USER_AGENT"];
+               if( preg_match('/MSIE 5.5/', $browser) || preg_match('/MSIE 
6.0/', $browser) )
+               {
+                       header('Content-Disposition: filename="'.$fullfile.'"');
+               }
+               else
+               {
+                       header('Content-Disposition: attachment; 
filename="'.$fullfile.'"');
+               }
+
+
+               // Data
+               echo $content;
+
+               
+               // Delete temp file
+               unlink($downloadFile);
+       }
+
+
+       // Cleans up filesystem after job is done
+       function clean()
+       {
+               if($this->tmpDirName == "")
+                       return;
+               $tmpPath = POO_TMP_PATH."/".$this->tmpDirName;
+               $this->deldir($tmpPath);
+       }
+
+
+       // Returns random string..easy, eh ?
+       function getRandomString($length)
+       {
+               srand(date("s"));
+               $possible_charactors = 
"abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+               $string = "";
+               while(strlen($string)<$length)
+               {
+                       $string .= substr($possible_charactors, 
rand()%(strlen($possible_charactors)), 1);
+               }
+               return($string);
+       }
+
+
+       // Default error handler
+       function handleError($errorMessage, $errorType = E_USER_WARNING)
+       {
+               $prefix = 'phpOpenOffice ' . (($errorType == E_USER_ERROR) ? 
'Error' : 'Warning') . ': ';
+               echo $prefix . $errorMessage;
+
+               if($errorType == E_USER_ERROR) die;
+       }
+
+
+       // Borrowed from marcelognunez at hotmail dot com
+       function deldir($dir)
+       {
+               $current_dir = opendir($dir);
+               while($entryname = readdir($current_dir))
+               {
+                       if(is_dir("$dir/$entryname") and ($entryname != "." and 
$entryname!=".."))
+                       {
+                               $this->deldir("${dir}/${entryname}");
+                       }
+                       elseif($entryname != "." and $entryname!="..")
+                       {
+                               unlink("${dir}/${entryname}");
+               }
+               }
+               closedir($current_dir);
+               rmdir(${dir});
+       }
+
+}
+
+?>

Index: inc/class.reportOOo.inc.php
===================================================================
RCS file: inc/class.reportOOo.inc.php
diff -N inc/class.reportOOo.inc.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ inc/class.reportOOo.inc.php 5 Dec 2006 19:40:45 -0000       1.1
@@ -0,0 +1,287 @@
+<?php  
+       /**
+       * Project Manager - reportOOo 
+       *
+       * @author Lars Piepho address@hidden
+       * @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @package projects
+       * @version $Id: class.reportOOo.inc.php,v 1.1 2006/12/05 19:40:45 
sigurdne Exp $
+       * $Source: /sources/phpgroupware/projects/inc/class.reportOOo.inc.php,v 
$
+       */
+
+       class reportOOo
+       {
+               var $public_functions = array
+               (
+                       'generate'              => True,
+                       'get_projects'  => True
+               );
+
+               var $project_id;
+               var $account_id;
+
+               function reportOOo()
+               {       
+                       $this->project_id               = 
$_REQUEST['project_id'];
+                       $this->account_id               = 
$_REQUEST['account_id'];              
+                       $this->attached_files   = 
CreateObject('projects.attached_files');
+                       $this->doc                              = 
CreateObject('phpgwapi.open_office');
+
+                       $this->bohours          = 
CreateObject('projects.boprojecthours');
+                       $this->boprojects       = 
CreateObject('projects.boprojects');
+                       $this->sohours          = $this->boprojects->sohours;
+                       $this->contacts         = $this->boprojects->contacts;
+                       $this->accounts = CreateObject('phpgwapi.accounts');
+               }
+
+               function generate($project_id, $sdate, $edate, $hourid, 
$template, $account_id, $filename)
+               {                       
+                       $activities = 
$this->bohours->get_emp_activities($project_id, $sdate, $edate, $account_id);
+                       
+                       for($i=0;$i<count($hourid);$i++)
+                               {
+                                               $values[$i] = 
$activities[$hourid[$i]];
+                               }
+                       
+                       //$values = $this->get_projects($project_id, $sdate, 
$edate, $account_id);
+                       if($values)
+                       {                               
+                               switch($template)
+                               {
+                                       case "Hannover" :
+                                               $doc = 'hannover.sxw';
+                                               break;
+                                       case "Berlin" :
+                                               $doc = 'berlin.sxw';
+                                               break;
+                                       case "Frankfurt" :
+                                               $doc = 'frankfurt.sxw';
+                                               break;
+                                       case "München" :
+                                               $doc = 'muenchen.sxw';
+                                               break;
+                                       case "Hamburg" :
+                                               $doc = 'hamburg.sxw';
+                                               break;
+                                       case "Düsseldorf" :
+                                               $doc = 'duesseldorf.sxw';
+                                               break;
+                                       case "Dresden" :
+                                               $doc = 'berlin.sxw';
+                                               break;
+                                       case "Böblingen" :
+                                               $doc = 'frankfurt.sxw';
+                                               break;
+                               }
+                               
+                               chdir('projects/templates/default');
+                               $this->doc->loadDocument($doc);
+                       
+                               $file = $this->doc->parserFiles["content.xml"];
+
+                               $f = fopen($file, "r+b");
+                               $contents = fread ($f, filesize ($file));
+
+                               $lenght = strpos($contents, "<table:table-cell 
table:style-name=\"Tabelle4.A3\"");
+                               $rowBegin = $lenght - 17;
+                       $part = substr($contents, $rowBegin);
+                       $rowEnd = strpos($part, "</table:table-row>") + 
strlen("</table:table-row>");
+                       $rowString = substr($part, 0, $rowEnd);
+                       $contentsBegin = substr($contents, 0, $rowBegin);
+                       $contentsEnd = substr($part, $rowEnd, 
strlen($contents));
+                       
+                       for($i=0;$i<count($values);$i++)
+                       {
+                               $jobDuration[$i] += $values[$i]['duration'];
+                               $sumDuration += $values[$i]['duration'];
+                               $sumDrivetime += $values[$i]['drivetime'];
+                               $sumDistance += $values[$i]['distance'];
+                               if($values[$i]['surcharge'] == '1')
+                               {
+                                       $sur50 = 'x';
+                               }
+                               elseif($values[$i]['surcharge'] == '2')
+                               {
+                                       $sur50 = '';
+                                       $sur100 = 'x';
+                               }
+                               else
+                               {
+                                       $sur50 = '';
+                                       $sur100 = '';
+                               }
+                               $row .= '<table:table-row>
+                                                       <table:table-cell 
table:style-name="Tabelle4.A3" table:value-type="float" table:value="' . ($i+1) 
. '">
+                                                               <text:p 
text:style-name="P4">' . ($i+1) . '</text:p>
+                                                       </table:table-cell>
+                                                       <table:table-cell 
table:style-name="Tabelle4.B3" table:value-type="string">
+                                                               <text:p 
text:style-name="P6">' . date("d.m.Y", $values[$i]['date']) . '</text:p>
+                                                       </table:table-cell>
+                                                       <table:table-cell 
table:style-name="Tabelle4.B3" table:value-type="string">
+                                                               <text:p 
text:style-name="P6">' . date("H:i", $values[$i]['begin']) . '</text:p>
+                                                       </table:table-cell>
+                                                               
<table:table-cell table:style-name="Tabelle4.B3" table:value-type="string">
+                                                       <text:p 
text:style-name="P6">' . date("H:i", $values[$i]['end']) . '</text:p>
+                                                       </table:table-cell>
+                                                       <table:table-cell 
table:style-name="Tabelle4.B3" table:value-type="string">
+                                                               <text:p 
text:style-name="P6">' . $this->min2time($values[$i]['duration']) .'</text:p>
+                                                       </table:table-cell>
+                                                               
<table:table-cell table:style-name="Tabelle4.A2" table:value-type="string">
+                                                       <text:p 
text:style-name="P5">[ ' . $sur50 . '<text:s/>] 50% <text:s text:c="2"/>[ ' . 
$sur100 . '<text:s/>] 100%</text:p>
+                                                               
</table:table-cell>
+                                                       <table:table-cell 
table:style-name="Tabelle4.A2" table:value-type="string">
+                                                               <text:p 
text:style-name="P6">' . $rate . '</text:p>
+                                                       </table:table-cell>
+                                                       <table:table-cell 
table:style-name="Tabelle4.H3" table:value-type="time">
+                                                               <text:p 
text:style-name="P6">' . sprintf("%02d:%02d", 
floor($values[$i]['drivetime']/60), $values[$i]['drivetime']%60) . '</text:p>
+                                                       </table:table-cell>
+                                                       <table:table-cell 
table:style-name="Tabelle4.I3" table:value-type="float">
+                                                               <text:p 
text:style-name="P6">' . str_replace(".",",",$values[$i]['distance']) . 
'</text:p>
+                                                       </table:table-cell>
+                                               </table:table-row>';
+                               
+                               $descRow .= '<table:table-row>
+                                                                       
<table:table-cell table:style-name="Tabelle2.A2" table:value-type="string">
+                                                                               
<text:p text:style-name="P9">' . ($i+1) . '</text:p>
+                                                                       
</table:table-cell>
+                                                                       
<table:table-cell table:style-name="Tabelle2.B1" table:value-type="string">
+                                                                               
<text:p text:style-name="P2">' . 
htmlspecialchars(utf8_encode($values[$i]['descr'])) . '; ' . 
htmlspecialchars(utf8_encode($values[$i]['notes'])) . '</text:p>
+                                                                       
</table:table-cell>
+                                                                       
<table:table-cell table:style-name="Tabelle2.B1" table:value-type="string">
+                                                                               
<text:p text:style-name="P9"/>
+                                                                       
</table:table-cell>
+                                                                       
<table:table-cell table:style-name="Tabelle2.D2" table:value-type="string">
+                                                                               
<text:p text:style-name="P9">' . $this->min2time($values[$i]['duration']) . 
'</text:p>
+                                                                       
</table:table-cell>
+                                                               
</table:table-row>';
+                                               
+                                       $rows=($i+1);
+                       }
+                               
+                               $contentsEnd = 
str_replace('table:formula="SUMME(&lt;Tabelle4.E3&gt;)"' , 
'table:formula="SUMME(&lt;Tabelle4.E3:E' . utf8_encode($rows + 2) . '&gt;)"' , 
$contentsEnd);
+                               $contentsEnd = 
str_replace('table:formula="SUMME(&lt;Tabelle4.H3&gt;)"' , 
'table:formula="SUMME(&lt;Tabelle4.H3:H' . utf8_encode($rows + 2) . '&gt;)"' , 
$contentsEnd);
+                               $contentsEnd = 
str_replace('table:formula="SUMME(&lt;Tabelle4.I3&gt;)"' , 
'table:formula="SUMME(&lt;Tabelle4.I3:I' . utf8_encode($rows + 2) . '&gt;)"' , 
$contentsEnd);
+                               $contentsEnd = 
str_replace('table:formula="SUMME(&lt;Tabelle2.D2&gt;)"' , 
'table:formula="SUMME(&lt;Tabelle2.D2:D' . utf8_encode($rows + 1) . '&gt;)"' , 
$contentsEnd);
+                               
+                               $lenght = strpos($contentsEnd, 
'<table:table-cell table:style-name="Tabelle2.A2" table:value-type="string">');
+                               $rowBegin = $lenght - 17;
+                               $part = substr($contentsEnd, $rowBegin);
+                               $rowEnd = strpos($part, "</table:table-row>") + 
strlen("</table:table-row>");
+                               $rowString = substr($part, 0, $rowEnd);
+                               $contents2Begin = substr($contentsEnd, 0, 
$rowBegin);
+                               $contents2End = substr($part, $rowEnd, 
strlen($contentsEnd));
+                       
+                               $contentsEnd = $contents2Begin . $descRow . 
$contents2End;                              
+                               $newContents = $contentsBegin . $row . 
$contentsEnd; 
+
+               
+                               rewind($f);
+                               fwrite($f, $newContents);
+                               fclose($f);
+
+                               $project = 
$this->boprojects->read_single_project($project_id);
+                               $address = 
$this->contacts->get_addr_contact_data($project['customer_org']);
+
+                       $vars = array(
+                               'KUNDE'         => $project['customerorgout'],
+                               'ANSPRP'        => $project['customerout'],
+                               'STRASSE'       => $address[0]['addr_add1'],
+                               'ORT'           => 
$address[0]['addr_postal_code'] . " " . $address[0]['addr_city'],
+                               'AUFTRAG'       => $project['number'],
+                               'KDNR'          => $project['customer_nr'],
+                               'CONSULT'       => 
$this->accounts->id2name($account_id),
+                               'INVEST'        => $project['investment_nr']
+                       );
+                       $this->doc->parse($vars);
+
+                       $sstring = date("Ymd", $sdate);
+                       $estring = date("Ymd", $edate);
+
+                       //$saveFilename = "TB_" . 
$this->accounts->id2name($account_id) . "_" . $sstring . "-" . $estring . 
".sxw";
+                       $saveFilename = $filename . ".sxw";
+                               $source = 
stripslashes($GLOBALS['phpgw_info']['server']['temp_dir']).SEP.$saveFilename;
+                       $this->doc->savefile($source);
+                       $this->doc->clean();
+
+                               $testfile = "projects/" . $project_id . "/" . 
$saveFilename;
+                               $exists = $this->attached_files->file_exists 
(array (
+                                                                               
                                        'string' => $testfile,
+                                                                               
                                        'relatives' => array (RELATIVE_ROOT)));
+                               $details = array(
+                                                               'comment' => 
$sdate . ';' . $edate,
+                                                               'owner_id' => 
$account_id
+                                                               );
+                               
+                               $this->attached_files->save_file($project_id, 
$source, ($exists?$filename . "_01.sxw":$saveFilename), $details);
+                               unlink($source);
+
+                               return True;
+                       }
+                       else
+                       {
+                               return False;
+                       }
+
+               }
+               
+               function get_projects($project_id, $sdate, $edate, $account_id)
+               {
+                       $params = array(
+                                       'project_id' => $project_id,
+                                       'filter' => 'employee',
+                                       'status' => 'all',
+                                       'limit' => false,
+                                       'order' => 'end_date',
+                                       'employee' => $account_id
+                               );
+
+                       $subs = $this->boprojects->get_sub_projects($params);
+                       $x = 0;
+                       
+                       for($i=0;$i<=(count($subs));$i++)
+                       {
+                               $values_hours = array(
+                                       'project_id' => $subs[$i]['project_id'],
+                                       'filter' => 'employee',
+                                       'action' => 'all',
+                                       'limit' => false,
+                                       'order' => 'end_date',
+                                       'employee' => $account_id
+                               );
+                               $hours[$i] = 
$this->sohours->read_hours($values_hours);
+                                                                       
+                               for($j=0;$j<=(count($hours[$i]));$j++)
+                               {       
+                                       if(($hours[$i][$j]['sdate'] >= $sdate) 
&& ($hours[$i][$j]['edate'] <= $edate) && ($hours[$i][$j]['billable'] == 'Y'))
+                                       {
+                                               $values[$x] = array(
+                                                       'date'          => 
date("d.m.Y", $hours[$i][$j]['sdate']),
+                                                       'begin'         => 
date("H:i", $hours[$i][$j]['sdate']),
+                                                       'end'           => 
date("H:i", $hours[$i][$j]['edate']),
+                                                       'duration'      => 
$hours[$i][$j]['minutes'],
+                                                       'drivetime'     => 
$hours[$i][$j]['t_journey'],
+                                                       'distance'      => 
$hours[$i][$j]['km_distance'],
+                                                       'descr'         => 
$hours[$i][$j]['hours_descr'],
+                                                       'notes'         => 
$hours[$i][$j]['remark'],
+                                                       'surcharge' => 
$hours[$i][$j]['surcharge']);
+                                               $x++;
+                                       }
+                               }
+                       
+                       }
+
+                       return $values;
+
+               }
+               
+               function min2time($string)
+               {
+                       $time = ((int)($string / 60)) . ":" . (($string % 60) 
== "0" ? "00" : sprintf("%02d",($string % 60)));
+                       
+                       return $time;
+               }
+               
+               
+       }
+?>

Index: inc/zip.lib.php
===================================================================
RCS file: inc/zip.lib.php
diff -N inc/zip.lib.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ inc/zip.lib.php     5 Dec 2006 19:40:45 -0000       1.1
@@ -0,0 +1,186 @@
+<?php
+/* $Id: zip.lib.php,v 1.1 2006/12/05 19:40:45 sigurdne Exp $ */
+// vim: expandtab sw=4 ts=4 sts=4:
+
+
+/**
+ * Zip file creation class.
+ * Makes zip files.
+ *
+ * Based on :
+ *
+ *  http://www.zend.com/codex.php?id=535&single=1
+ *  By Eric Mueller <address@hidden>
+ *
+ *  http://www.zend.com/codex.php?id=470&single=1
+ *  by Denis125 <address@hidden>
+ *
+ *  a patch from Peter Listiak <address@hidden> for last modified
+ *  date and time of the compressed file
+ *
+ * Official ZIP file format: http://www.pkware.com/appnote.txt
+ *
+ * @access  public
+ */
+class zipfile
+{
+    /**
+     * Array to store compressed data
+     *
+     * @var  array    $datasec
+     */
+    var $datasec      = array();
+
+    /**
+     * Central directory
+     *
+     * @var  array    $ctrl_dir
+     */
+    var $ctrl_dir     = array();
+
+    /**
+     * End of central directory record
+     *
+     * @var  string   $eof_ctrl_dir
+     */
+    var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
+
+    /**
+     * Last offset position
+     *
+     * @var  integer  $old_offset
+     */
+    var $old_offset   = 0;
+
+
+    /**
+     * Converts an Unix timestamp to a four byte DOS date and time format (date
+     * in high two bytes, time in low two bytes allowing magnitude comparison).
+     *
+     * @param  integer  the current Unix timestamp
+     *
+     * @return integer  the current date in a four byte DOS format
+     *
+     * @access private
+     */
+    function unix2DosTime($unixtime = 0) {
+        $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);
+
+        if ($timearray['year'] < 1980) {
+               $timearray['year']    = 1980;
+               $timearray['mon']     = 1;
+               $timearray['mday']    = 1;
+               $timearray['hours']   = 0;
+               $timearray['minutes'] = 0;
+               $timearray['seconds'] = 0;
+        } // end if
+
+        return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) 
| ($timearray['mday'] << 16) |
+                ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | 
($timearray['seconds'] >> 1);
+    } // end of the 'unix2DosTime()' method
+
+
+    /**
+     * Adds "file" to archive
+     *
+     * @param  string   file contents
+     * @param  string   name of the file in the archive (may contains the path)
+     * @param  integer  the current timestamp
+     *
+     * @access public
+     */
+    function addFile($data, $name, $time = 0)
+    {
+        $name     = str_replace('\\', '/', $name);
+
+        $dtime    = dechex($this->unix2DosTime($time));
+        $hexdtime = '\x' . $dtime[6] . $dtime[7]
+                  . '\x' . $dtime[4] . $dtime[5]
+                  . '\x' . $dtime[2] . $dtime[3]
+                  . '\x' . $dtime[0] . $dtime[1];
+        eval('$hexdtime = "' . $hexdtime . '";');
+
+        $fr   = "\x50\x4b\x03\x04";
+        $fr   .= "\x14\x00";            // ver needed to extract
+        $fr   .= "\x00\x00";            // gen purpose bit flag
+        $fr   .= "\x08\x00";            // compression method
+        $fr   .= $hexdtime;             // last mod time and date
+
+        // "local file header" segment
+        $unc_len = strlen($data);
+        $crc     = crc32($data);
+        $zdata   = gzcompress($data);
+        $zdata   = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix 
crc bug
+        $c_len   = strlen($zdata);
+        $fr      .= pack('V', $crc);             // crc32
+        $fr      .= pack('V', $c_len);           // compressed filesize
+        $fr      .= pack('V', $unc_len);         // uncompressed filesize
+        $fr      .= pack('v', strlen($name));    // length of filename
+        $fr      .= pack('v', 0);                // extra field length
+        $fr      .= $name;
+
+        // "file data" segment
+        $fr .= $zdata;
+
+        // "data descriptor" segment (optional but necessary if archive is not
+        // served as file)
+        $fr .= pack('V', $crc);                 // crc32
+        $fr .= pack('V', $c_len);               // compressed filesize
+        $fr .= pack('V', $unc_len);             // uncompressed filesize
+
+        // add this entry to array
+        $this -> datasec[] = $fr;
+
+        // now add to central directory record
+        $cdrec = "\x50\x4b\x01\x02";
+        $cdrec .= "\x00\x00";                // version made by
+        $cdrec .= "\x14\x00";                // version needed to extract
+        $cdrec .= "\x00\x00";                // gen purpose bit flag
+        $cdrec .= "\x08\x00";                // compression method
+        $cdrec .= $hexdtime;                 // last mod time & date
+        $cdrec .= pack('V', $crc);           // crc32
+        $cdrec .= pack('V', $c_len);         // compressed filesize
+        $cdrec .= pack('V', $unc_len);       // uncompressed filesize
+        $cdrec .= pack('v', strlen($name) ); // length of filename
+        $cdrec .= pack('v', 0 );             // extra field length
+        $cdrec .= pack('v', 0 );             // file comment length
+        $cdrec .= pack('v', 0 );             // disk number start
+        $cdrec .= pack('v', 0 );             // internal file attributes
+        $cdrec .= pack('V', 32 );            // external file attributes - 
'archive' bit set
+
+        $cdrec .= pack('V', $this -> old_offset ); // relative offset of local 
header
+        $this -> old_offset += strlen($fr);
+
+        $cdrec .= $name;
+
+        // optional extra field, file comment goes here
+        // save to central directory
+        $this -> ctrl_dir[] = $cdrec;
+    } // end of the 'addFile()' method
+
+
+    /**
+     * Dumps out file
+     *
+     * @return  string  the zipped file
+     *
+     * @access public
+     */
+    function file()
+    {
+        $data    = implode('', $this -> datasec);
+        $ctrldir = implode('', $this -> ctrl_dir);
+
+        return
+            $data .
+            $ctrldir .
+            $this -> eof_ctrl_dir .
+            pack('v', sizeof($this -> ctrl_dir)) .  // total # of entries "on 
this disk"
+            pack('v', sizeof($this -> ctrl_dir)) .  // total # of entries 
overall
+            pack('V', strlen($ctrldir)) .           // size of central dir
+            pack('V', strlen($data)) .              // offset to start of 
central dir
+            "\x00\x00";                             // .zip file comment length
+    } // end of the 'file()' method
+
+} // end of the 'zipfile' class
+?>
\ No newline at end of file

Index: inc/pclzip/gnu-lgpl.txt
===================================================================
RCS file: inc/pclzip/gnu-lgpl.txt
diff -N inc/pclzip/gnu-lgpl.txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ inc/pclzip/gnu-lgpl.txt     5 Dec 2006 19:40:45 -0000       1.1
@@ -0,0 +1,504 @@
+                 GNU LESSER GENERAL PUBLIC LICENSE
+                      Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+                 GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                           NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+

Index: inc/pclzip/pclzip.lib.php
===================================================================
RCS file: inc/pclzip/pclzip.lib.php
diff -N inc/pclzip/pclzip.lib.php
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ inc/pclzip/pclzip.lib.php   5 Dec 2006 19:40:45 -0000       1.1
@@ -0,0 +1,4970 @@
+<?php
+// 
--------------------------------------------------------------------------------
+// PhpConcept Library - Zip Module 2.1
+// 
--------------------------------------------------------------------------------
+// License GNU/LGPL - Vincent Blavet - December 2003
+// http://www.phpconcept.net
+// 
--------------------------------------------------------------------------------
+//
+// Presentation :
+//   PclZip is a PHP library that manage ZIP archives.
+//   So far tests show that archives generated by PclZip are readable by
+//   WinZip application and other tools.
+//
+// Description :
+//   See readme.txt and http://www.phpconcept.net
+//
+// Warning :
+//   This library and the associated files are non commercial, non professional
+//   work.
+//   It should not have unexpected results. However if any damage is caused by
+//   this software the author can not be responsible.
+//   The use of this software is at the risk of the user.
+//
+// 
--------------------------------------------------------------------------------
+// $Id: pclzip.lib.php,v 1.1 2006/12/05 19:40:45 sigurdne Exp $
+// 
--------------------------------------------------------------------------------
+
+  // ----- Constants
+  define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
+  
+  // ----- File list separator
+  // In version 1.x of PclZip, the separator for file list is a space
+  // (which is not a very smart choice, specifically for windows paths !).
+  // A better separator should be a comma (,). This constant gives you the
+  // abilty to change that.
+  // However notice that changing this value, may have impact on existing
+  // scripts, using space separated filenames.
+  // Recommanded values for compatibility with older versions :
+  //define( 'PCLZIP_SEPARATOR', ' ' );
+  // Recommanded values for smart separation of filenames.
+  define( 'PCLZIP_SEPARATOR', ',' );
+
+  // ----- Error configuration
+  // 0 : PclZip Class integrated error handling
+  // 1 : PclError external library error handling. By enabling this
+  //     you must ensure that you have included PclError library.
+  // [2,...] : reserved for futur use
+  define( 'PCLZIP_ERROR_EXTERNAL', 0 );
+
+  // ----- Optional static temporary directory
+  //       By default temporary files are generated in the script current
+  //       path.
+  //       If defined :
+  //       - MUST BE terminated by a '/'.
+  //       - MUST be a valid, already created directory
+  //       Samples :
+  // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
+  // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
+  define( 'PCLZIP_TEMPORARY_DIR', '' );
+
+// 
--------------------------------------------------------------------------------
+// ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****
+// 
--------------------------------------------------------------------------------
+
+  // ----- Global variables
+  $g_pclzip_version = "2.1";
+
+  // ----- Error codes
+  //   -1 : Unable to open file in binary write mode
+  //   -2 : Unable to open file in binary read mode
+  //   -3 : Invalid parameters
+  //   -4 : File does not exist
+  //   -5 : Filename is too long (max. 255)
+  //   -6 : Not a valid zip file
+  //   -7 : Invalid extracted file size
+  //   -8 : Unable to create directory
+  //   -9 : Invalid archive extension
+  //  -10 : Invalid archive format
+  //  -11 : Unable to delete file (unlink)
+  //  -12 : Unable to rename file (rename)
+  //  -13 : Invalid header checksum
+  //  -14 : Invalid archive size
+  define( 'PCLZIP_ERR_USER_ABORTED', 2 );
+  define( 'PCLZIP_ERR_NO_ERROR', 0 );
+  define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );
+  define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );
+  define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );
+  define( 'PCLZIP_ERR_MISSING_FILE', -4 );
+  define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );
+  define( 'PCLZIP_ERR_INVALID_ZIP', -6 );
+  define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );
+  define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );
+  define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );
+  define( 'PCLZIP_ERR_BAD_FORMAT', -10 );
+  define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );
+  define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );
+  define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );
+  define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
+  define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );
+  define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );
+
+  // ----- Options values
+  define( 'PCLZIP_OPT_PATH', 77001 );
+  define( 'PCLZIP_OPT_ADD_PATH', 77002 );
+  define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );
+  define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );
+  define( 'PCLZIP_OPT_SET_CHMOD', 77005 );
+  define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );
+  define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );
+  define( 'PCLZIP_OPT_BY_NAME', 77008 );
+  define( 'PCLZIP_OPT_BY_INDEX', 77009 );
+  define( 'PCLZIP_OPT_BY_EREG', 77010 );
+  define( 'PCLZIP_OPT_BY_PREG', 77011 );
+  define( 'PCLZIP_OPT_COMMENT', 77012 );
+  define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );
+  define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );
+  define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );
+
+  // ----- Call backs values
+  define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
+  define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
+  define( 'PCLZIP_CB_PRE_ADD', 78003 );
+  define( 'PCLZIP_CB_POST_ADD', 78004 );
+  /* For futur use
+  define( 'PCLZIP_CB_PRE_LIST', 78005 );
+  define( 'PCLZIP_CB_POST_LIST', 78006 );
+  define( 'PCLZIP_CB_PRE_DELETE', 78007 );
+  define( 'PCLZIP_CB_POST_DELETE', 78008 );
+  */
+
+  // 
--------------------------------------------------------------------------------
+  // Class : PclZip
+  // Description :
+  //   PclZip is the class that represent a Zip archive.
+  //   The public methods allow the manipulation of the archive.
+  // Attributes :
+  //   Attributes must not be accessed directly.
+  // Methods :
+  //   PclZip() : Object creator
+  //   create() : Creates the Zip archive
+  //   listContent() : List the content of the Zip archive
+  //   extract() : Extract the content of the archive
+  //   properties() : List the properties of the archive
+  // 
--------------------------------------------------------------------------------
+  class PclZip
+  {
+    // ----- Filename of the zip file
+    var $zipname = '';
+
+    // ----- File descriptor of the zip file
+    var $zip_fd = 0;
+
+    // ----- Internal error handling
+    var $error_code = 1;
+    var $error_string = '';
+
+  // 
--------------------------------------------------------------------------------
+  // Function : PclZip()
+  // Description :
+  //   Creates a PclZip object and set the name of the associated Zip archive
+  //   filename.
+  //   Note that no real action is taken, if the archive does not exist it is 
not
+  //   created. Use create() for that.
+  // 
--------------------------------------------------------------------------------
+  function PclZip($p_zipname)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
'PclZip::PclZip', "zipname=$p_zipname");
+
+    // ----- Tests the zlib
+    if (!function_exists('gzopen'))
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 1, "zlib 
extension seems to be missing");
+      die('Abort '.basename(__FILE__).' : Missing zlib extensions');
+    }
+
+    // ----- Set the attributes
+    $this->zipname = $p_zipname;
+    $this->zip_fd = 0;
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 1);
+    return;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function :
+  //   create($p_filelist, $p_add_dir="", $p_remove_dir="")
+  //   create($p_filelist, $p_option, $p_option_value, ...)
+  // Description :
+  //   This method supports two different synopsis. The first one is 
historical.
+  //   This method creates a Zip Archive. The Zip file is created in the
+  //   filesystem. The files and directories indicated in $p_filelist
+  //   are added in the archive. See the parameters description for the
+  //   supported format of $p_filelist.
+  //   When a directory is in the list, the directory and its content is added
+  //   in the archive.
+  //   In this synopsis, the function takes an optional variable list of
+  //   options. See bellow the supported options.
+  // Parameters :
+  //   $p_filelist : An array containing file or directory names, or
+  //                 a string containing one filename or one directory name, or
+  //                 a string containing a list of filenames and/or directory
+  //                 names separated by spaces.
+  //   $p_add_dir : A path to add before the real path of the archived file,
+  //                in order to have it memorized in the archive.
+  //   $p_remove_dir : A path to remove from the real path of the file to 
archive,
+  //                   in order to have a shorter path memorized in the 
archive.
+  //                   When $p_add_dir and $p_remove_dir are set, $p_remove_dir
+  //                   is removed first, before $p_add_dir is added.
+  // Options :
+  //   PCLZIP_OPT_ADD_PATH :
+  //   PCLZIP_OPT_REMOVE_PATH :
+  //   PCLZIP_OPT_REMOVE_ALL_PATH :
+  //   PCLZIP_OPT_COMMENT :
+  //   PCLZIP_CB_PRE_ADD :
+  //   PCLZIP_CB_POST_ADD :
+  // Return Values :
+  //   0 on failure,
+  //   The list of the added files, with a status of the add action.
+  //   (see PclZip::listContent() for list entry format)
+  // 
--------------------------------------------------------------------------------
+//  function create($p_filelist, $p_add_dir="", $p_remove_dir="")
+  function create($p_filelist /*, options */)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
'PclZip::create', "filelist='$p_filelist', ...");
+    $v_result=1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Set default values
+    $v_options = array();
+    $v_add_path = "";
+    $v_remove_path = "";
+    $v_remove_all_path = false;
+    $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
+
+    // ----- Look for variable options arguments
+    $v_size = func_num_args();
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size 
arguments passed to the method");
+
+    // ----- Look for arguments
+    if ($v_size > 1) {
+      // ----- Get the arguments
+      $v_arg_list = &func_get_args();
+
+      // ----- Remove form the options list the first argument
+      array_shift($v_arg_list);
+      $v_size--;
+
+      // ----- Look for first arg
+      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Variable list of options detected");
+
+        // ----- Parse the options
+        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+                                            array (PCLZIP_OPT_REMOVE_PATH => 
'optional',
+                                                   PCLZIP_OPT_REMOVE_ALL_PATH 
=> 'optional',
+                                                   PCLZIP_OPT_ADD_PATH => 
'optional',
+                                                   PCLZIP_CB_PRE_ADD => 
'optional',
+                                                   PCLZIP_CB_POST_ADD => 
'optional',
+                                                   PCLZIP_OPT_NO_COMPRESSION 
=> 'optional',
+                                                   PCLZIP_OPT_COMMENT => 
'optional' ));
+        if ($v_result != 1) {
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+          return 0;
+        }
+
+        // ----- Set the arguments
+        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
+          $v_add_path = $v_options[PCLZIP_OPT_ADD_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
+          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
+          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
+        }
+      }
+
+      // ----- Look for 2 args
+      // Here we need to support the first historic synopsis of the
+      // method.
+      else {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Static synopsis");
+
+        // ----- Get the first argument
+        $v_add_path = $v_arg_list[0];
+
+        // ----- Look for the optional second argument
+        if ($v_size == 2) {
+          $v_remove_path = $v_arg_list[1];
+        }
+        else if ($v_size > 2) {
+          // ----- Error log
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
+                                      "Invalid number / type of arguments");
+
+          // ----- Return
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+          return 0;
+        }
+      }
+    }
+
+    // ----- Trace
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"add_path='$v_add_path', remove_path='$v_remove_path', 
remove_all_path='".($v_remove_all_path?'true':'false')."'");
+
+    // ----- Look if the $p_filelist is really an array
+    $p_result_list = array();
+    if (is_array($p_filelist))
+    {
+      // ----- Call the create fct
+      $v_result = $this->privCreate($p_filelist, $p_result_list, $v_add_path, 
$v_remove_path, $v_remove_all_path, $v_options);
+    }
+
+    // ----- Look if the $p_filelist is a string
+    else if (is_string($p_filelist))
+    {
+      // ----- Create a list with the elements from the string
+      $v_list = explode(PCLZIP_SEPARATOR, $p_filelist);
+
+      // ----- Call the create fct
+      $v_result = $this->privCreate($v_list, $p_result_list, $v_add_path, 
$v_remove_path, $v_remove_all_path, $v_options);
+    }
+
+    // ----- Invalid variable
+    else
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable 
type p_filelist");
+      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
+    }
+
+    if ($v_result != 1)
+    {
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+      return 0;
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
+    return $p_result_list;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function :
+  //   add($p_filelist, $p_add_dir="", $p_remove_dir="")
+  //   add($p_filelist, $p_option, $p_option_value, ...)
+  // Description :
+  //   This method supports two synopsis. The first one is historical.
+  //   This methods add the list of files in an existing archive.
+  //   If a file with the same name already exists, it is added at the end of 
the
+  //   archive, the first one is still present.
+  //   If the archive does not exist, it is created.
+  // Parameters :
+  //   $p_filelist : An array containing file or directory names, or
+  //                 a string containing one filename or one directory name, or
+  //                 a string containing a list of filenames and/or directory
+  //                 names separated by spaces.
+  //   $p_add_dir : A path to add before the real path of the archived file,
+  //                in order to have it memorized in the archive.
+  //   $p_remove_dir : A path to remove from the real path of the file to 
archive,
+  //                   in order to have a shorter path memorized in the 
archive.
+  //                   When $p_add_dir and $p_remove_dir are set, $p_remove_dir
+  //                   is removed first, before $p_add_dir is added.
+  // Options :
+  //   PCLZIP_OPT_ADD_PATH :
+  //   PCLZIP_OPT_REMOVE_PATH :
+  //   PCLZIP_OPT_REMOVE_ALL_PATH :
+  //   PCLZIP_OPT_COMMENT :
+  //   PCLZIP_OPT_ADD_COMMENT :
+  //   PCLZIP_OPT_PREPEND_COMMENT :
+  //   PCLZIP_CB_PRE_ADD :
+  //   PCLZIP_CB_POST_ADD :
+  // Return Values :
+  //   0 on failure,
+  //   The list of the added files, with a status of the add action.
+  //   (see PclZip::listContent() for list entry format)
+  // 
--------------------------------------------------------------------------------
+//  function add($p_filelist, $p_add_dir="", $p_remove_dir="")
+  function add($p_filelist /* options */)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
'PclZip::add', "filelist='$p_filelist', ...");
+    $v_result=1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Set default values
+    $v_options = array();
+    $v_add_path = "";
+    $v_remove_path = "";
+    $v_remove_all_path = false;
+    $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
+
+    // ----- Look for variable options arguments
+    $v_size = func_num_args();
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size 
arguments passed to the method");
+
+    // ----- Look for arguments
+    if ($v_size > 1) {
+      // ----- Get the arguments
+      $v_arg_list = &func_get_args();
+
+      // ----- Remove form the options list the first argument
+      array_shift($v_arg_list);
+      $v_size--;
+
+      // ----- Look for first arg
+      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Variable list of options detected");
+
+        // ----- Parse the options
+        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+                                            array (PCLZIP_OPT_REMOVE_PATH => 
'optional',
+                                                   PCLZIP_OPT_REMOVE_ALL_PATH 
=> 'optional',
+                                                   PCLZIP_OPT_ADD_PATH => 
'optional',
+                                                   PCLZIP_CB_PRE_ADD => 
'optional',
+                                                   PCLZIP_CB_POST_ADD => 
'optional',
+                                                   PCLZIP_OPT_NO_COMPRESSION 
=> 'optional',
+                                                   PCLZIP_OPT_COMMENT => 
'optional',
+                                                   PCLZIP_OPT_ADD_COMMENT => 
'optional',
+                                                   PCLZIP_OPT_PREPEND_COMMENT 
=> 'optional' ));
+        if ($v_result != 1) {
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+          return 0;
+        }
+
+        // ----- Set the arguments
+        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
+          $v_add_path = $v_options[PCLZIP_OPT_ADD_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
+          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
+          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
+        }
+      }
+
+      // ----- Look for 2 args
+      // Here we need to support the first historic synopsis of the
+      // method.
+      else {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Static synopsis");
+
+        // ----- Get the first argument
+        $v_add_path = $v_arg_list[0];
+
+        // ----- Look for the optional second argument
+        if ($v_size == 2) {
+          $v_remove_path = $v_arg_list[1];
+        }
+        else if ($v_size > 2) {
+          // ----- Error log
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / 
type of arguments");
+
+          // ----- Return
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+          return 0;
+        }
+      }
+    }
+
+    // ----- Trace
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"add_path='$v_add_path', remove_path='$v_remove_path', 
remove_all_path='".($v_remove_all_path?'true':'false')."'");
+
+    // ----- Look if the $p_filelist is really an array
+    $p_result_list = array();
+    if (is_array($p_filelist))
+    {
+      // ----- Call the create fct
+      $v_result = $this->privAdd($p_filelist, $p_result_list, $v_add_path, 
$v_remove_path, $v_remove_all_path, $v_options);
+    }
+
+    // ----- Look if the $p_filelist is a string
+    else if (is_string($p_filelist))
+    {
+      // ----- Create a list with the elements from the string
+      $v_list = explode(PCLZIP_SEPARATOR, $p_filelist);
+
+      // ----- Call the create fct
+      $v_result = $this->privAdd($v_list, $p_result_list, $v_add_path, 
$v_remove_path, $v_remove_all_path, $v_options);
+    }
+
+    // ----- Invalid variable
+    else
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable 
type p_filelist");
+      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
+    }
+
+    if ($v_result != 1)
+    {
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+      return 0;
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
+    return $p_result_list;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : listContent()
+  // Description :
+  //   This public method, gives the list of the files and directories, with 
their
+  //   properties.
+  //   The properties of each entries in the list are (used also in other 
functions) :
+  //     filename : Name of the file. For a create or add action it is the 
filename
+  //                given by the user. For an extract function it is the 
filename
+  //                of the extracted file.
+  //     stored_filename : Name of the file / directory stored in the archive.
+  //     size : Size of the stored file.
+  //     compressed_size : Size of the file's data compressed in the archive
+  //                       (without the headers overhead)
+  //     mtime : Last known modification date of the file (UNIX timestamp)
+  //     comment : Comment associated with the file
+  //     folder : true | false
+  //     index : index of the file in the archive
+  //     status : status of the action (depending of the action) :
+  //              Values are :
+  //                ok : OK !
+  //                filtered : the file / dir is not extracted (filtered by 
user)
+  //                already_a_directory : the file can not be extracted 
because a
+  //                                      directory with the same name already 
exists
+  //                write_protected : the file can not be extracted because a 
file
+  //                                  with the same name already exists and is
+  //                                  write protected
+  //                newer_exist : the file was not extracted because a newer 
file exists
+  //                path_creation_fail : the file is not extracted because the 
folder
+  //                                     does not exists and can not be created
+  //                write_error : the file was not extracted because there was 
a
+  //                              error while writing the file
+  //                read_error : the file was not extracted because there was 
a error
+  //                             while reading the file
+  //                invalid_header : the file was not extracted because of an 
archive
+  //                                 format error (bad file header)
+  //   Note that each time a method can continue operating when there
+  //   is an action error on a file, the error is only logged in the file 
status.
+  // Return Values :
+  //   0 on an unrecoverable failure,
+  //   The list of the files in the archive.
+  // 
--------------------------------------------------------------------------------
+  function listContent()
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
'PclZip::listContent', "");
+    $v_result=1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Check archive
+    if (!$this->privCheckFormat()) {
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+      return(0);
+    }
+
+    // ----- Call the extracting fct
+    $p_list = array();
+    if (($v_result = $this->privList($p_list)) != 1)
+    {
+      unset($p_list);
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, 
PclZip::errorInfo());
+      return(0);
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
+    return $p_list;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function :
+  //   extract($p_path="./", $p_remove_path="")
+  //   extract([$p_option, $p_option_value, ...])
+  // Description :
+  //   This method supports two synopsis. The first one is historical.
+  //   This method extract all the files / directories from the archive to the
+  //   folder indicated in $p_path.
+  //   If you want to ignore the 'root' part of path of the memorized files
+  //   you can indicate this in the optional $p_remove_path parameter.
+  //   By default, if a newer file with the same name already exists, the
+  //   file is not extracted.
+  //
+  //   If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions
+  //   are used, the path indicated in PCLZIP_OPT_ADD_PATH is append
+  //   at the end of the path value of PCLZIP_OPT_PATH.
+  // Parameters :
+  //   $p_path : Path where the files and directories are to be extracted
+  //   $p_remove_path : First part ('root' part) of the memorized path
+  //                    (if any similar) to remove while extracting.
+  // Options :
+  //   PCLZIP_OPT_PATH :
+  //   PCLZIP_OPT_ADD_PATH :
+  //   PCLZIP_OPT_REMOVE_PATH :
+  //   PCLZIP_OPT_REMOVE_ALL_PATH :
+  //   PCLZIP_CB_PRE_EXTRACT :
+  //   PCLZIP_CB_POST_EXTRACT :
+  // Return Values :
+  //   0 or a negative value on failure,
+  //   The list of the extracted files, with a status of the action.
+  //   (see PclZip::listContent() for list entry format)
+  // 
--------------------------------------------------------------------------------
+  //function extract($p_path="./", $p_remove_path="")
+  function extract(/* options */)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::extract", "");
+    $v_result=1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Check archive
+    if (!$this->privCheckFormat()) {
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+      return(0);
+    }
+
+    // ----- Set default values
+    $v_options = array();
+    $v_path = "./";
+    $v_remove_path = "";
+    $v_remove_all_path = false;
+
+    // ----- Look for variable options arguments
+    $v_size = func_num_args();
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size 
arguments passed to the method");
+
+    // ----- Default values for option
+    $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
+
+    // ----- Look for arguments
+    if ($v_size > 0) {
+      // ----- Get the arguments
+      $v_arg_list = &func_get_args();
+
+      // ----- Look for first arg
+      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Variable list of options");
+
+        // ----- Parse the options
+        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+                                            array (PCLZIP_OPT_PATH => 
'optional',
+                                                   PCLZIP_OPT_REMOVE_PATH => 
'optional',
+                                                   PCLZIP_OPT_REMOVE_ALL_PATH 
=> 'optional',
+                                                   PCLZIP_OPT_ADD_PATH => 
'optional',
+                                                   PCLZIP_CB_PRE_EXTRACT => 
'optional',
+                                                   PCLZIP_CB_POST_EXTRACT => 
'optional',
+                                                   PCLZIP_OPT_SET_CHMOD => 
'optional',
+                                                   PCLZIP_OPT_BY_NAME => 
'optional',
+                                                   PCLZIP_OPT_BY_EREG => 
'optional',
+                                                   PCLZIP_OPT_BY_PREG => 
'optional',
+                                                   PCLZIP_OPT_BY_INDEX => 
'optional',
+                                                   
PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
+                                                   
PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional' ));
+        if ($v_result != 1) {
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+          return 0;
+        }
+
+        // ----- Set the arguments
+        if (isset($v_options[PCLZIP_OPT_PATH])) {
+          $v_path = $v_options[PCLZIP_OPT_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
+          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
+          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
+          // ----- Check for '/' in last path char
+          if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
+            $v_path .= '/';
+          }
+          $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
+        }
+      }
+
+      // ----- Look for 2 args
+      // Here we need to support the first historic synopsis of the
+      // method.
+      else {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Static synopsis");
+
+        // ----- Get the first argument
+        $v_path = $v_arg_list[0];
+
+        // ----- Look for the optional second argument
+        if ($v_size == 2) {
+          $v_remove_path = $v_arg_list[1];
+        }
+        else if ($v_size > 2) {
+          // ----- Error log
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / 
type of arguments");
+
+          // ----- Return
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, 
PclZip::errorInfo());
+          return 0;
+        }
+      }
+    }
+
+    // ----- Trace
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"path='$v_path', remove_path='$v_remove_path', 
remove_all_path='".($v_remove_path?'true':'false')."'");
+
+    // ----- Call the extracting fct
+    $p_list = array();
+    $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
+                                            $v_remove_all_path, $v_options);
+    if ($v_result < 1) {
+      unset($p_list);
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, 
PclZip::errorInfo());
+      return(0);
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
+    return $p_list;
+  }
+  // 
--------------------------------------------------------------------------------
+
+
+  // 
--------------------------------------------------------------------------------
+  // Function :
+  //   extractByIndex($p_index, $p_path="./", $p_remove_path="")
+  //   extractByIndex($p_index, [$p_option, $p_option_value, ...])
+  // Description :
+  //   This method supports two synopsis. The first one is historical.
+  //   This method is doing a partial extract of the archive.
+  //   The extracted files or folders are identified by their index in the
+  //   archive (from 0 to n).
+  //   Note that if the index identify a folder, only the folder entry is
+  //   extracted, not all the files included in the archive.
+  // Parameters :
+  //   $p_index : A single index (integer) or a string of indexes of files to
+  //              extract. The form of the string is "0,4-6,8-12" with only 
numbers
+  //              and '-' for range or ',' to separate ranges. No spaces or ';'
+  //              are allowed.
+  //   $p_path : Path where the files and directories are to be extracted
+  //   $p_remove_path : First part ('root' part) of the memorized path
+  //                    (if any similar) to remove while extracting.
+  // Options :
+  //   PCLZIP_OPT_PATH :
+  //   PCLZIP_OPT_ADD_PATH :
+  //   PCLZIP_OPT_REMOVE_PATH :
+  //   PCLZIP_OPT_REMOVE_ALL_PATH :
+  //   PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and
+  //     not as files.
+  //     The resulting content is in a new field 'content' in the file
+  //     structure.
+  //     This option must be used alone (any other options are ignored).
+  //   PCLZIP_CB_PRE_EXTRACT :
+  //   PCLZIP_CB_POST_EXTRACT :
+  // Return Values :
+  //   0 on failure,
+  //   The list of the extracted files, with a status of the action.
+  //   (see PclZip::listContent() for list entry format)
+  // 
--------------------------------------------------------------------------------
+  function extractByIndex($p_index /* $options */)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::extractByIndex", "index='$p_index', ...");
+    $v_result=1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Check archive
+    if (!$this->privCheckFormat()) {
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+      return(0);
+    }
+
+    // ----- Set default values
+    $v_options = array();
+    $v_path = "./";
+    $v_remove_path = "";
+    $v_remove_all_path = false;
+
+    // ----- Look for variable options arguments
+    $v_size = func_num_args();
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size 
arguments passed to the method");
+
+    // ----- Default values for option
+    $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
+
+    // ----- Look for arguments
+    if ($v_size > 1) {
+      // ----- Get the arguments
+      $v_arg_list = &func_get_args();
+
+      // ----- Remove form the options list the first argument
+      array_shift($v_arg_list);
+      $v_size--;
+
+      // ----- Look for first arg
+      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Variable list of options");
+
+        // ----- Parse the options
+        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+                                            array (PCLZIP_OPT_PATH => 
'optional',
+                                                   PCLZIP_OPT_REMOVE_PATH => 
'optional',
+                                                   PCLZIP_OPT_REMOVE_ALL_PATH 
=> 'optional',
+                                                   
PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
+                                                   PCLZIP_OPT_ADD_PATH => 
'optional',
+                                                   PCLZIP_CB_PRE_EXTRACT => 
'optional',
+                                                   PCLZIP_CB_POST_EXTRACT => 
'optional',
+                                                   PCLZIP_OPT_SET_CHMOD => 
'optional' ));
+        if ($v_result != 1) {
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+          return 0;
+        }
+
+        // ----- Set the arguments
+        if (isset($v_options[PCLZIP_OPT_PATH])) {
+          $v_path = $v_options[PCLZIP_OPT_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
+          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
+          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
+          // ----- Check for '/' in last path char
+          if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
+            $v_path .= '/';
+          }
+          $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
+        }
+        if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
+          $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Option PCLZIP_OPT_EXTRACT_AS_STRING not set.");
+        }
+        else {
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Option PCLZIP_OPT_EXTRACT_AS_STRING set.");
+        }
+      }
+
+      // ----- Look for 2 args
+      // Here we need to support the first historic synopsis of the
+      // method.
+      else {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Static synopsis");
+
+        // ----- Get the first argument
+        $v_path = $v_arg_list[0];
+
+        // ----- Look for the optional second argument
+        if ($v_size == 2) {
+          $v_remove_path = $v_arg_list[1];
+        }
+        else if ($v_size > 2) {
+          // ----- Error log
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / 
type of arguments");
+
+          // ----- Return
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+          return 0;
+        }
+      }
+    }
+
+    // ----- Trace
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"index='$p_index', path='$v_path', remove_path='$v_remove_path', 
remove_all_path='".($v_remove_path?'true':'false')."'");
+
+    // ----- Trick
+    // Here I want to reuse extractByRule(), so I need to parse the $p_index
+    // with privParseOptions()
+    $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
+    $v_options_trick = array();
+    $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), 
$v_options_trick,
+                                        array (PCLZIP_OPT_BY_INDEX => 
'optional' ));
+    if ($v_result != 1) {
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+        return 0;
+    }
+    $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
+
+    // ----- Call the extracting fct
+    if (($v_result = $this->privExtractByRule($p_list, $v_path, 
$v_remove_path, $v_remove_all_path, $v_options)) < 1) {
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, 
PclZip::errorInfo());
+        return(0);
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
+    return $p_list;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function :
+  //   delete([$p_option, $p_option_value, ...])
+  // Description :
+  // Parameters :
+  //   None
+  // Options :
+  //   PCLZIP_OPT_BY_INDEX :
+  // Return Values :
+  //   0 on failure,
+  //   The list of the files which are still present in the archive.
+  //   (see PclZip::listContent() for list entry format)
+  // 
--------------------------------------------------------------------------------
+  function delete(/* options */)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::delete", "");
+    $v_result=1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Check archive
+    if (!$this->privCheckFormat()) {
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+      return(0);
+    }
+
+    // ----- Set default values
+    $v_options = array();
+
+    // ----- Look for variable options arguments
+    $v_size = func_num_args();
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size 
arguments passed to the method");
+
+    // ----- Look for no arguments
+    if ($v_size <= 0) {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing 
arguments");
+
+        // ----- Return
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, 
PclZip::errorInfo());
+        return 0;
+    }
+
+    // ----- Get the arguments
+    $v_arg_list = &func_get_args();
+
+    // ----- Parse the options
+    $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+                                        array (PCLZIP_OPT_BY_NAME => 
'optional',
+                                               PCLZIP_OPT_BY_EREG => 
'optional',
+                                               PCLZIP_OPT_BY_PREG => 
'optional',
+                                               PCLZIP_OPT_BY_INDEX => 
'optional' ));
+    if ($v_result != 1) {
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+        return 0;
+    }
+
+    // ----- Check that at least one rule is set
+    if (   (!isset($v_options[PCLZIP_OPT_BY_NAME]))
+        && (!isset($v_options[PCLZIP_OPT_BY_EREG]))
+        && (!isset($v_options[PCLZIP_OPT_BY_PREG]))
+        && (!isset($v_options[PCLZIP_OPT_BY_INDEX]))) {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "At least one 
filtering rule must be set");
+
+        // ----- Return
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, 
PclZip::errorInfo());
+        return 0;
+    }
+
+    // ----- Call the delete fct
+    $v_list = array();
+    if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1)
+    {
+      unset($v_list);
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, 
PclZip::errorInfo());
+      return(0);
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_list);
+    return $v_list;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : deleteByIndex()
+  // Description :
+  //   ***** Deprecated *****
+  //   delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered.
+  // 
--------------------------------------------------------------------------------
+  function deleteByIndex($p_index)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::deleteByIndex", "index='$p_index'");
+    
+    $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
+    return $p_list;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : properties()
+  // Description :
+  //   This method gives the properties of the archive.
+  //   The properties are :
+  //     nb : Number of files in the archive
+  //     comment : Comment associated with the archive file
+  //     status : not_exist, ok
+  // Parameters :
+  //   None
+  // Return Values :
+  //   0 on failure,
+  //   An array with the archive properties.
+  // 
--------------------------------------------------------------------------------
+  function properties()
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::properties", "");
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Check archive
+    if (!$this->privCheckFormat()) {
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+      return(0);
+    }
+
+    // ----- Default properties
+    $v_prop = array();
+    $v_prop['comment'] = '';
+    $v_prop['nb'] = 0;
+    $v_prop['status'] = 'not_exist';
+
+    // ----- Look if file exists
+    if (@is_file($this->zipname))
+    {
+      // ----- Open the zip file
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open 
file in binary read mode");
+      if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
+      {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open 
archive \''.$this->zipname.'\' in binary read mode');
+
+        // ----- Return
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), 0);
+        return 0;
+      }
+
+      // ----- Read the central directory informations
+      $v_central_dir = array();
+      if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+        return 0;
+      }
+
+      // ----- Close the zip file
+      $this->privCloseFd();
+
+      // ----- Set the user attributes
+      $v_prop['comment'] = $v_central_dir['comment'];
+      $v_prop['nb'] = $v_central_dir['entries'];
+      $v_prop['status'] = 'ok';
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_prop);
+    return $v_prop;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : duplicate()
+  // Description :
+  //   This method creates an archive by copying the content of an other one. 
If
+  //   the archive already exist, it is replaced by the new one without any 
warning.
+  // Parameters :
+  //   $p_archive : The filename of a valid archive, or
+  //                a valid PclZip object.
+  // Return Values :
+  //   1 on success.
+  //   0 or a negative value on error (error code).
+  // 
--------------------------------------------------------------------------------
+  function duplicate($p_archive)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::duplicate", "");
+    $v_result = 1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Look if the $p_archive is a PclZip object
+    if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The 
parameter is valid PclZip object '".$p_archive->zipname."'");
+
+      // ----- Duplicate the archive
+      $v_result = $this->privDuplicate($p_archive->zipname);
+    }
+
+    // ----- Look if the $p_archive is a string (so a filename)
+    else if (is_string($p_archive))
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The 
parameter is a filename '$p_archive'");
+
+      // ----- Check that $p_archive is a valid zip file
+      // TBC : Should also check the archive format
+      if (!is_file($p_archive)) {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename 
'".$p_archive."'");
+        $v_result = PCLZIP_ERR_MISSING_FILE;
+      }
+      else {
+        // ----- Duplicate the archive
+        $v_result = $this->privDuplicate($p_archive);
+      }
+    }
+
+    // ----- Invalid variable
+    else
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable 
type p_archive_to_add");
+      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : merge()
+  // Description :
+  //   This method merge the $p_archive_to_add archive at the end of the 
current
+  //   one ($this).
+  //   If the archive ($this) does not exist, the merge becomes a duplicate.
+  //   If the $p_archive_to_add archive does not exist, the merge is a success.
+  // Parameters :
+  //   $p_archive_to_add : It can be directly the filename of a valid zip 
archive,
+  //                       or a PclZip object archive.
+  // Return Values :
+  //   1 on success,
+  //   0 or negative values on error (see below).
+  // 
--------------------------------------------------------------------------------
+  function merge($p_archive_to_add)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::merge", "");
+    $v_result = 1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Check archive
+    if (!$this->privCheckFormat()) {
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
+      return(0);
+    }
+
+    // ----- Look if the $p_archive_to_add is a PclZip object
+    if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 
'pclzip'))
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The 
parameter is valid PclZip object");
+
+      // ----- Merge the archive
+      $v_result = $this->privMerge($p_archive_to_add);
+    }
+
+    // ----- Look if the $p_archive_to_add is a string (so a filename)
+    else if (is_string($p_archive_to_add))
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The 
parameter is a filename");
+
+      // ----- Create a temporary archive
+      $v_object_archive = new PclZip($p_archive_to_add);
+
+      // ----- Merge the archive
+      $v_result = $this->privMerge($v_object_archive);
+    }
+
+    // ----- Invalid variable
+    else
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable 
type p_archive_to_add");
+      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+
+
+  // 
--------------------------------------------------------------------------------
+  // Function : errorCode()
+  // Description :
+  // Parameters :
+  // 
--------------------------------------------------------------------------------
+  function errorCode()
+  {
+    if (PCLZIP_ERROR_EXTERNAL == 1) {
+      return(PclErrorCode());
+    }
+    else {
+      return($this->error_code);
+    }
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : errorName()
+  // Description :
+  // Parameters :
+  // 
--------------------------------------------------------------------------------
+  function errorName($p_with_code=false)
+  {
+    $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
+                      PCLZIP_ERR_WRITE_OPEN_FAIL => 
'PCLZIP_ERR_WRITE_OPEN_FAIL',
+                      PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
+                      PCLZIP_ERR_INVALID_PARAMETER => 
'PCLZIP_ERR_INVALID_PARAMETER',
+                      PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE',
+                      PCLZIP_ERR_FILENAME_TOO_LONG => 
'PCLZIP_ERR_FILENAME_TOO_LONG',
+                      PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP',
+                      PCLZIP_ERR_BAD_EXTRACTED_FILE => 
'PCLZIP_ERR_BAD_EXTRACTED_FILE',
+                      PCLZIP_ERR_DIR_CREATE_FAIL => 
'PCLZIP_ERR_DIR_CREATE_FAIL',
+                      PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION',
+                      PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT',
+                      PCLZIP_ERR_DELETE_FILE_FAIL => 
'PCLZIP_ERR_DELETE_FILE_FAIL',
+                      PCLZIP_ERR_RENAME_FILE_FAIL => 
'PCLZIP_ERR_RENAME_FILE_FAIL',
+                      PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM',
+                      PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 
'PCLZIP_ERR_INVALID_ARCHIVE_ZIP',
+                      PCLZIP_ERR_MISSING_OPTION_VALUE => 
'PCLZIP_ERR_MISSING_OPTION_VALUE',
+                      PCLZIP_ERR_INVALID_OPTION_VALUE => 
'PCLZIP_ERR_INVALID_OPTION_VALUE' );
+
+    if (isset($v_name[$this->error_code])) {
+      $v_value = $v_name[$this->error_code];
+    }
+    else {
+      $v_value = 'NoName';
+    }
+
+    if ($p_with_code) {
+      return($v_value.' ('.$this->error_code.')');
+    }
+    else {
+      return($v_value);
+    }
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : errorInfo()
+  // Description :
+  // Parameters :
+  // 
--------------------------------------------------------------------------------
+  function errorInfo($p_full=false)
+  {
+    if (PCLZIP_ERROR_EXTERNAL == 1) {
+      return(PclErrorString());
+    }
+    else {
+      if ($p_full) {
+        return($this->errorName(true)." : ".$this->error_string);
+      }
+      else {
+        return($this->error_string." [code ".$this->error_code."]");
+      }
+    }
+  }
+  // 
--------------------------------------------------------------------------------
+
+
+// 
--------------------------------------------------------------------------------
+// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS *****
+// *****                                                        *****
+// *****       THESES FUNCTIONS MUST NOT BE USED DIRECTLY       *****
+// 
--------------------------------------------------------------------------------
+
+
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privCheckFormat()
+  // Description :
+  //   This method check that the archive exists and is a valid zip archive.
+  //   Several level of check exists. (futur)
+  // Parameters :
+  //   $p_level : Level of check. Default 0.
+  //              0 : Check the first bytes (magic codes) (default value))
+  //              1 : 0 + Check the central directory (futur)
+  //              2 : 1 + Check each file header (futur)
+  // Return Values :
+  //   true on success,
+  //   false on error, the error code is set.
+  // 
--------------------------------------------------------------------------------
+  function privCheckFormat($p_level=0)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privCheckFormat", "");
+    $v_result = true;
+
+       // ----- Reset the file system cache
+    clearstatcache();
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Look if the file exits
+    if (!is_file($this->zipname)) {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file 
'".$this->zipname."'");
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, 
PclZip::errorInfo());
+      return(false);
+    }
+
+    // ----- Check that the file is readeable
+    if (!is_readable($this->zipname)) {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive 
'".$this->zipname."'");
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, 
PclZip::errorInfo());
+      return(false);
+    }
+
+    // ----- Check the magic code
+    // TBC
+
+    // ----- Check the central header
+    // TBC
+
+    // ----- Check each file header
+    // TBC
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privParseOptions()
+  // Description :
+  //   This internal methods reads the variable list of arguments 
($p_options_list,
+  //   $p_size) and generate an array with the options and values 
($v_result_list).
+  //   $v_requested_options contains the options that can be present and those 
that
+  //   must be present.
+  //   $v_requested_options is an array, with the option value as key, and 
'optional',
+  //   or 'mandatory' as value.
+  // Parameters :
+  //   See above.
+  // Return Values :
+  //   1 on success.
+  //   0 on failure.
+  // 
--------------------------------------------------------------------------------
+  function privParseOptions(&$p_options_list, $p_size, &$v_result_list, 
$v_requested_options=false)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privParseOptions", "");
+    $v_result=1;
+
+    // ----- Read the options
+    $i=0;
+    while ($i<$p_size) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Looking for table index $i, option = 
'".PclZipUtilOptionText($p_options_list[$i])."(".$p_options_list[$i].")'");
+
+      // ----- Check if the option is requested
+      if (!isset($v_requested_options[$p_options_list[$i]])) {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional 
parameter '".$p_options_list[$i]."' for this method");
+
+        // ----- Return
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+        return PclZip::errorCode();
+      }
+
+      // ----- Look for next option
+      switch ($p_options_list[$i]) {
+        // ----- Look for options that request a path value
+        case PCLZIP_OPT_PATH :
+        case PCLZIP_OPT_REMOVE_PATH :
+        case PCLZIP_OPT_ADD_PATH :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing 
parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          $v_result_list[$p_options_list[$i]] = 
PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"".PclZipUtilOptionText($p_options_list[$i])." = 
'".$v_result_list[$p_options_list[$i]]."'");
+          $i++;
+        break;
+
+        // ----- Look for options that request an array of string for value
+        case PCLZIP_OPT_BY_NAME :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing 
parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          if (is_string($p_options_list[$i+1])) {
+              $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
+          }
+          else if (is_array($p_options_list[$i+1])) {
+              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+          }
+          else {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong 
parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+          ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"".PclZipUtilOptionText($p_options_list[$i])." = 
'".$v_result_list[$p_options_list[$i]]."'");
+          $i++;
+        break;
+
+        // ----- Look for options that request an EREG or PREG expression
+        case PCLZIP_OPT_BY_EREG :
+        case PCLZIP_OPT_BY_PREG :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing 
parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          if (is_string($p_options_list[$i+1])) {
+              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+          }
+          else {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong 
parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"".PclZipUtilOptionText($p_options_list[$i])." = 
'".$v_result_list[$p_options_list[$i]]."'");
+          $i++;
+        break;
+
+        // ----- Look for options that takes a string
+        case PCLZIP_OPT_COMMENT :
+        case PCLZIP_OPT_ADD_COMMENT :
+        case PCLZIP_OPT_PREPEND_COMMENT :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
+                                            "Missing parameter value for 
option '"
+                                                                
.PclZipUtilOptionText($p_options_list[$i])
+                                                                ."'");
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          if (is_string($p_options_list[$i+1])) {
+              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+          }
+          else {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
+                                            "Wrong parameter value for option 
'"
+                                                                
.PclZipUtilOptionText($p_options_list[$i])
+                                                                ."'");
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"".PclZipUtilOptionText($p_options_list[$i])." = 
'".$v_result_list[$p_options_list[$i]]."'");
+          $i++;
+        break;
+
+        // ----- Look for options that request an array of index
+        case PCLZIP_OPT_BY_INDEX :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing 
parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          $v_work_list = array();
+          if (is_string($p_options_list[$i+1])) {
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 
4, "Index value is a string '".$p_options_list[$i+1]."'");
+
+              // ----- Remove spaces
+              $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
+
+              // ----- Parse items
+              $v_work_list = explode(",", $p_options_list[$i+1]);
+          }
+          else if (is_integer($p_options_list[$i+1])) {
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 
4, "Index value is an integer '".$p_options_list[$i+1]."'");
+              $v_work_list[0] = 
$p_options_list[$i+1].'-'.$p_options_list[$i+1];
+          }
+          else if (is_array($p_options_list[$i+1])) {
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 
4, "Index value is an array");
+              $v_work_list = $p_options_list[$i+1];
+          }
+          else {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must 
be integer, string or array for option 
'".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+          
+          // ----- Reduce the index list
+          // each index item in the list must be a couple with a start and
+          // an end value : [0,3], [5-5], [8-10], ...
+          // ----- Check the format of each item
+          $v_sort_flag=false;
+          $v_sort_value=0;
+          for ($j=0; $j<sizeof($v_work_list); $j++) {
+              // ----- Explode the item
+              $v_item_list = explode("-", $v_work_list[$j]);
+              $v_size_item_list = sizeof($v_item_list);
+              
+              // ----- TBC : Here we might check that each item is a
+              // real integer ...
+              
+              // ----- Look for single value
+              if ($v_size_item_list == 1) {
+                  // ----- Set the option value
+                  $v_result_list[$p_options_list[$i]][$j]['start'] = 
$v_item_list[0];
+                  $v_result_list[$p_options_list[$i]][$j]['end'] = 
$v_item_list[0];
+              }
+              elseif ($v_size_item_list == 2) {
+                  // ----- Set the option value
+                  $v_result_list[$p_options_list[$i]][$j]['start'] = 
$v_item_list[0];
+                  $v_result_list[$p_options_list[$i]][$j]['end'] = 
$v_item_list[1];
+              }
+              else {
+                  // ----- Error log
+                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too 
many values in index range for option 
'".PclZipUtilOptionText($p_options_list[$i])."'");
+
+                  // ----- Return
+                  //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+                  return PclZip::errorCode();
+              }
+
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 
3, "Extracted index item = 
[".$v_result_list[$p_options_list[$i]][$j]['start'].",".$v_result_list[$p_options_list[$i]][$j]['end']."]");
+
+              // ----- Look for list sort
+              if ($v_result_list[$p_options_list[$i]][$j]['start'] < 
$v_sort_value) {
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "The list should be sorted ...");
+                  $v_sort_flag=true;
+
+                  // ----- TBC : An automatic sort should be writen ...
+                  // ----- Error log
+                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, 
"Invalid order of index range for option 
'".PclZipUtilOptionText($p_options_list[$i])."'");
+
+                  // ----- Return
+                  //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+                  return PclZip::errorCode();
+              }
+              $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
+          }
+          
+          // ----- Sort the items
+          if ($v_sort_flag) {
+              // TBC : To Be Completed
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 
3, "List sorting is not yet write ...");
+          }
+
+          // ----- Next option
+          $i++;
+        break;
+
+        // ----- Look for options that request no value
+        case PCLZIP_OPT_REMOVE_ALL_PATH :
+        case PCLZIP_OPT_EXTRACT_AS_STRING :
+        case PCLZIP_OPT_NO_COMPRESSION :
+        case PCLZIP_OPT_EXTRACT_IN_OUTPUT :
+          $v_result_list[$p_options_list[$i]] = true;
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"".PclZipUtilOptionText($p_options_list[$i])." = 
'".$v_result_list[$p_options_list[$i]]."'");
+        break;
+
+        // ----- Look for options that request an octal value
+        case PCLZIP_OPT_SET_CHMOD :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing 
parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"".PclZipUtilOptionText($p_options_list[$i])." = 
'".$v_result_list[$p_options_list[$i]]."'");
+          $i++;
+        break;
+
+        // ----- Look for options that request a call-back
+        case PCLZIP_CB_PRE_EXTRACT :
+        case PCLZIP_CB_POST_EXTRACT :
+        case PCLZIP_CB_PRE_ADD :
+        case PCLZIP_CB_POST_ADD :
+        /* for futur use
+        case PCLZIP_CB_PRE_DELETE :
+        case PCLZIP_CB_POST_DELETE :
+        case PCLZIP_CB_PRE_LIST :
+        case PCLZIP_CB_POST_LIST :
+        */
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing 
parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          $v_function_name = $p_options_list[$i+1];
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"call-back ".PclZipUtilOptionText($p_options_list[$i])." = 
'".$v_function_name."'");
+
+          // ----- Check that the value is a valid existing function
+          if (!function_exists($v_function_name)) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function 
'".$v_function_name."()' is not an existing function for option 
'".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+
+          // ----- Set the attribute
+          $v_result_list[$p_options_list[$i]] = $v_function_name;
+          $i++;
+        break;
+
+        default :
+          // ----- Error log
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
+                                      "Unknown parameter '"
+                                                          
.$p_options_list[$i]."'");
+
+          // ----- Return
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+          return PclZip::errorCode();
+      }
+
+      // ----- Next options
+      $i++;
+    }
+
+    // ----- Look for mandatory options
+    if ($v_requested_options !== false) {
+      for ($key=reset($v_requested_options); $key=key($v_requested_options); 
$key=next($v_requested_options)) {
+        // ----- Look for mandatory option
+        if ($v_requested_options[$key] == 'mandatory') {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
+          // ----- Look if present
+          if (!isset($v_result_list[$key])) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing 
mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+        }
+      }
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privCreate()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privCreate($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, 
$p_remove_all_dir, &$p_options)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privCreate", "list, result_list, add_dir='$p_add_dir', 
remove_dir='$p_remove_dir'");
+    $v_result=1;
+    $v_list_detail = array();
+
+    // ----- Open the file in write mode
+    if (($v_result = $this->privOpenFd('wb')) != 1)
+    {
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Add the list of files
+    $v_result = $this->privAddList($p_list, $p_result_list, $p_add_dir, 
$p_remove_dir, $p_remove_all_dir, $p_options);
+
+    // ----- Close
+    $this->privCloseFd();
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privAdd()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privAdd($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, 
$p_remove_all_dir, &$p_options)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privAdd", "list, result_list, add_dir='$p_add_dir', 
remove_dir='$p_remove_dir'");
+    $v_result=1;
+    $v_list_detail = array();
+
+    // ----- Look if the archive exists or is empty
+    if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Archive does not exist, or is empty, create it.");
+
+      // ----- Do a create
+      $v_result = $this->privCreate($p_list, $p_result_list, $p_add_dir, 
$p_remove_dir, $p_remove_all_dir, $p_options);
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Open the zip file
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open 
file in binary read mode");
+    if (($v_result=$this->privOpenFd('rb')) != 1)
+    {
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Read the central directory informations
+    $v_central_dir = array();
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+    {
+      $this->privCloseFd();
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Go to beginning of File
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position in file : ".ftell($this->zip_fd)."'");
+    @rewind($this->zip_fd);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position in file : ".ftell($this->zip_fd)."'");
+
+    // ----- Creates a temporay file
+    $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
+
+    // ----- Open the temporary file in write mode
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open 
file in binary read mode");
+    if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
+    {
+      $this->privCloseFd();
+
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open 
temporary file \''.$v_zip_temp_name.'\' in binary write mode');
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Copy the files from the archive to the temporary file
+    // TBC : Here I should better append the file and go back to erase the 
central dir
+    $v_size = $v_central_dir['offset'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : 
PCLZIP_READ_BLOCK_SIZE);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read 
$v_read_size bytes");
+      $v_buffer = fread($this->zip_fd, $v_read_size);
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Swap the file descriptor
+    // Here is a trick : I swap the temporary fd with the zip fd, in order to 
use
+    // the following methods on the temporary fil and not the real archive
+    $v_swap = $this->zip_fd;
+    $this->zip_fd = $v_zip_temp_fd;
+    $v_zip_temp_fd = $v_swap;
+
+    // ----- Add the files
+    $v_header_list = array();
+    if (($v_result = $this->privAddFileList($p_list, $v_header_list, 
$p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1)
+    {
+      fclose($v_zip_temp_fd);
+      $this->privCloseFd();
+      @unlink($v_zip_temp_name);
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Store the offset of the central dir
+    $v_offset = @ftell($this->zip_fd);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New 
offset of central dir : $v_offset");
+
+    // ----- Copy the block of file headers from the old archive
+    $v_size = $v_central_dir['size'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : 
PCLZIP_READ_BLOCK_SIZE);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read 
$v_read_size bytes");
+      $v_buffer = @fread($v_zip_temp_fd, $v_read_size);
+      @fwrite($this->zip_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Create the Central Dir files header
+    for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++)
+    {
+      // ----- Create the file header
+      if ($v_header_list[$i]['status'] == 'ok') {
+        if (($v_result = 
$this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
+          fclose($v_zip_temp_fd);
+          $this->privCloseFd();
+          @unlink($v_zip_temp_name);
+
+          // ----- Return
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+          return $v_result;
+        }
+        $v_count++;
+      }
+
+      // ----- Transform the header to a 'usable' info
+      $this->privConvertHeader2FileInfo($v_header_list[$i], 
$p_result_list[$i]);
+    }
+
+    // ----- Zip file comment
+    $v_comment = $v_central_dir['comment'];
+    if (isset($p_options[PCLZIP_OPT_COMMENT])) {
+      $v_comment = $p_options[PCLZIP_OPT_COMMENT];
+    }
+    if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) {
+      $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT];
+    }
+    if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) {
+      $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment;
+    }
+
+    // ----- Calculate the size of the central header
+    $v_size = @ftell($this->zip_fd)-$v_offset;
+
+    // ----- Create the central dir footer
+    if (($v_result = 
$this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, 
$v_offset, $v_comment)) != 1)
+    {
+      // ----- Reset the file list
+      unset($v_header_list);
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Swap back the file descriptor
+    $v_swap = $this->zip_fd;
+    $this->zip_fd = $v_zip_temp_fd;
+    $v_zip_temp_fd = $v_swap;
+
+    // ----- Close
+    $this->privCloseFd();
+
+    // ----- Close the temporary file
+    @fclose($v_zip_temp_fd);
+
+    // ----- Delete the zip file
+    // TBC : I should test the result ...
+    @unlink($this->zipname);
+
+    // ----- Rename the temporary file
+    // TBC : I should test the result ...
+    //@rename($v_zip_temp_name, $this->zipname);
+    PclZipUtilRename($v_zip_temp_name, $this->zipname);
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privOpenFd()
+  // Description :
+  // Parameters :
+  // 
--------------------------------------------------------------------------------
+  function privOpenFd($p_mode)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privOpenFd", 'mode='.$p_mode);
+    $v_result=1;
+
+    // ----- Look if already open
+    if ($this->zip_fd != 0)
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file 
\''.$this->zipname.'\' already open');
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Open the zip file
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Open 
file in '.$p_mode.' mode');
+    if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive 
\''.$this->zipname.'\' in '.$p_mode.' mode');
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privCloseFd()
+  // Description :
+  // Parameters :
+  // 
--------------------------------------------------------------------------------
+  function privCloseFd()
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privCloseFd", "");
+    $v_result=1;
+
+    if ($this->zip_fd != 0)
+      @fclose($this->zip_fd);
+    $this->zip_fd = 0;
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privAddList()
+  // Description :
+  //   $p_add_dir and $p_remove_dir will give the ability to memorize a path 
which is
+  //   different from the real path of the file. This is usefull if you want 
to have PclTar
+  //   running in any directory, and memorize relative path from an other 
directory.
+  // Parameters :
+  //   $p_list : An array containing the file or directory names to add in the 
tar
+  //   $p_result_list : list of added files with their properties (specially 
the status field)
+  //   $p_add_dir : Path to add in the filename path archived
+  //   $p_remove_dir : Path to remove in the filename path archived
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, 
$p_remove_all_dir, &$p_options)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privAddList", "list, add_dir='$p_add_dir', 
remove_dir='$p_remove_dir'");
+    $v_result=1;
+
+    // ----- Add the files
+    $v_header_list = array();
+    if (($v_result = $this->privAddFileList($p_list, $v_header_list, 
$p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1)
+    {
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Store the offset of the central dir
+    $v_offset = @ftell($this->zip_fd);
+
+    // ----- Create the Central Dir files header
+    for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)
+    {
+      // ----- Create the file header
+      if ($v_header_list[$i]['status'] == 'ok') {
+        if (($v_result = 
$this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
+          // ----- Return
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+          return $v_result;
+        }
+        $v_count++;
+      }
+
+      // ----- Transform the header to a 'usable' info
+      $this->privConvertHeader2FileInfo($v_header_list[$i], 
$p_result_list[$i]);
+    }
+
+    // ----- Zip file comment
+    $v_comment = '';
+    if (isset($p_options[PCLZIP_OPT_COMMENT])) {
+      $v_comment = $p_options[PCLZIP_OPT_COMMENT];
+    }
+
+    // ----- Calculate the size of the central header
+    $v_size = @ftell($this->zip_fd)-$v_offset;
+
+    // ----- Create the central dir footer
+    if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, 
$v_offset, $v_comment)) != 1)
+    {
+      // ----- Reset the file list
+      unset($v_header_list);
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privAddFileList()
+  // Description :
+  //   $p_add_dir and $p_remove_dir will give the ability to memorize a path 
which is
+  //   different from the real path of the file. This is usefull if you want to
+  //   run the lib in any directory, and memorize relative path from an other 
directory.
+  // Parameters :
+  //   $p_list : An array containing the file or directory names to add in the 
tar
+  //   $p_result_list : list of added files with their properties (specially 
the status field)
+  //   $p_add_dir : Path to add in the filename path archived
+  //   $p_remove_dir : Path to remove in the filename path archived
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privAddFileList($p_list, &$p_result_list, $p_add_dir, 
$p_remove_dir, $p_remove_all_dir, &$p_options)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privAddFileList", "list, add_dir='$p_add_dir', 
remove_dir='$p_remove_dir'");
+    $v_result=1;
+    $v_header = array();
+
+    // ----- Recuperate the current number of elt in list
+    $v_nb = sizeof($p_result_list);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Before 
add, list have $v_nb elements");
+
+    // ----- Loop on the files
+    for ($j=0; ($j<count($p_list)) && ($v_result==1); $j++)
+    {
+      // ----- Recuperate the filename
+      $p_filename = PclZipUtilTranslateWinPath($p_list[$j], false);
+
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Looking for file [$p_filename]");
+
+      // ----- Skip empty file names
+      if ($p_filename == "")
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Skip empty filename");
+        continue;
+      }
+
+      // ----- Check the filename
+      if (!file_exists($p_filename))
+      {
+        // ----- Error log
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"File '$p_filename' does not exists");
+        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '$p_filename' does 
not exists");
+
+        // ----- Return
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+        return PclZip::errorCode();
+      }
+
+      /* This test is done later
+      // ----- Check the path length
+      if (strlen($p_filename) > 0xFF)
+      {
+        // ----- Error log
+        PclZip::privErrorLog(-5, "File name is too long (max. 255) : 
'$p_filename'");
+
+        // ----- Return
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+        return PclZip::errorCode();
+      }
+      */
+
+      // ----- Look if it is a file or a dir with no all pathnre move
+      if ((is_file($p_filename)) || ((is_dir($p_filename)) && 
!$p_remove_all_dir)) {
+        // ----- Add the file
+        if (($v_result = $this->privAddFile($p_filename, $v_header, 
$p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1)
+        {
+          // ----- Return status
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+          return $v_result;
+        }
+
+        // ----- Store the file infos
+        $p_result_list[$v_nb++] = $v_header;
+      }
+
+      // ----- Look for directory
+      if (is_dir($p_filename))
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"$p_filename is a directory");
+
+        // ----- Look for path
+        if ($p_filename != ".")
+          $v_path = $p_filename."/";
+        else
+          $v_path = "";
+
+        // ----- Read the directory for files and sub-directories
+        $p_hdir = opendir($p_filename);
+        $p_hitem = readdir($p_hdir); // '.' directory
+        $p_hitem = readdir($p_hdir); // '..' directory
+        while (($p_hitem = readdir($p_hdir)) !== false)
+        {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Looking for $p_hitem in the directory");
+
+          // ----- Look for a file
+          if (is_file($v_path.$p_hitem))
+          {
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Add the file '".$v_path.$p_hitem."'");
+
+            // ----- Add the file
+            if (($v_result = $this->privAddFile($v_path.$p_hitem, $v_header, 
$p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1)
+            {
+              // ----- Return status
+              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+              return $v_result;
+            }
+
+            // ----- Store the file infos
+            $p_result_list[$v_nb++] = $v_header;
+          }
+
+          // ----- Recursive call to privAddFileList()
+          else
+          {
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Add the directory '".$v_path.$p_hitem."'");
+
+            // ----- Need an array as parameter
+            $p_temp_list[0] = $v_path.$p_hitem;
+            $v_result = $this->privAddFileList($p_temp_list, $p_result_list, 
$p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options);
+
+            // ----- Update the number of elements of the list
+            $v_nb = sizeof($p_result_list);
+          }
+        }
+
+        // ----- Free memory for the recursive loop
+        unset($p_temp_list);
+        unset($p_hdir);
+        unset($p_hitem);
+      }
+    }
+
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "After 
add, list have $v_nb elements");
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privAddFile()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privAddFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, 
$p_remove_all_dir, &$p_options)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privAddFile", "filename='$p_filename', add_dir='$p_add_dir', 
remove_dir='$p_remove_dir'");
+    $v_result=1;
+
+    if ($p_filename == "")
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list 
parameter (invalid or empty list)");
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Calculate the stored filename
+    $v_stored_filename = $p_filename;
+
+    // ----- Look for all path to remove
+    if ($p_remove_all_dir) {
+      $v_stored_filename = basename($p_filename);
+    }
+    // ----- Look for partial path remove
+    else if ($p_remove_dir != "")
+    {
+      if (substr($p_remove_dir, -1) != '/')
+        $p_remove_dir .= "/";
+
+      if ((substr($p_filename, 0, 2) == "./") || (substr($p_remove_dir, 0, 2) 
== "./"))
+      {
+        if ((substr($p_filename, 0, 2) == "./") && (substr($p_remove_dir, 0, 
2) != "./"))
+          $p_remove_dir = "./".$p_remove_dir;
+        if ((substr($p_filename, 0, 2) != "./") && (substr($p_remove_dir, 0, 
2) == "./"))
+          $p_remove_dir = substr($p_remove_dir, 2);
+      }
+
+      $v_compare = PclZipUtilPathInclusion($p_remove_dir, $p_filename);
+      if ($v_compare > 0)
+//      if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir)
+      {
+
+        if ($v_compare == 2) {
+          $v_stored_filename = "";
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Path to remove is the current folder");
+        }
+        else {
+          $v_stored_filename = substr($p_filename, strlen($p_remove_dir));
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Remove path '$p_remove_dir' in file '$p_filename' = '$v_stored_filename'");
+        }
+      }
+    }
+    // ----- Look for path to add
+    if ($p_add_dir != "")
+    {
+      if (substr($p_add_dir, -1) == "/")
+        $v_stored_filename = $p_add_dir.$v_stored_filename;
+      else
+        $v_stored_filename = $p_add_dir."/".$v_stored_filename;
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Add 
path '$p_add_dir' in file '$p_filename' = '$v_stored_filename'");
+    }
+
+    // ----- Filename (reduce the path of stored name)
+    $v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
+
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Filename (reduced) '$v_stored_filename', strlen ".strlen($v_stored_filename));
+
+    /* filename length moved after call-back in release 1.3
+    // ----- Check the path length
+    if (strlen($v_stored_filename) > 0xFF)
+    {
+      // ----- Error log
+      PclZip::privErrorLog(-5, "Stored file name is too long (max. 255) : 
'$v_stored_filename'");
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+    */
+
+    // ----- Set the file properties
+    clearstatcache();
+    $p_header['version'] = 20;
+    $p_header['version_extracted'] = 10;
+    $p_header['flag'] = 0;
+    $p_header['compression'] = 0;
+    $p_header['mtime'] = filemtime($p_filename);
+    $p_header['crc'] = 0;
+    $p_header['compressed_size'] = 0;
+    $p_header['size'] = filesize($p_filename);
+    $p_header['filename_len'] = strlen($p_filename);
+    $p_header['extra_len'] = 0;
+    $p_header['comment_len'] = 0;
+    $p_header['disk'] = 0;
+    $p_header['internal'] = 0;
+    $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010);
+    $p_header['offset'] = 0;
+    $p_header['filename'] = $p_filename;
+    $p_header['stored_filename'] = $v_stored_filename;
+    $p_header['extra'] = '';
+    $p_header['comment'] = '';
+    $p_header['status'] = 'ok';
+    $p_header['index'] = -1;
+
+    // ----- Look for pre-add callback
+    if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A 
pre-callback '".$p_options[PCLZIP_CB_PRE_ADD]."()') is defined for the 
extraction");
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_header, $v_local_header);
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference 
to the
+      // header.
+      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, 
$v_local_header);');
+      if ($v_result == 0) {
+        // ----- Change the file status
+        $p_header['status'] = "skipped";
+        $v_result = 1;
+      }
+
+      // ----- Update the informations
+      // Only some fields can be modified
+      if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
+        $p_header['stored_filename'] = 
PclZipUtilPathReduction($v_local_header['stored_filename']);
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New 
stored filename is '".$p_header['stored_filename']."'");
+      }
+    }
+
+    // ----- Look for empty stored filename
+    if ($p_header['stored_filename'] == "") {
+      $p_header['status'] = "filtered";
+    }
+    
+    // ----- Check the path length
+    if (strlen($p_header['stored_filename']) > 0xFF) {
+      $p_header['status'] = 'filename_too_long';
+    }
+
+    // ----- Look if no error, or file not skipped
+    if ($p_header['status'] == 'ok') {
+
+      // ----- Look for a file
+      if (is_file($p_filename))
+      {
+        // ----- Open the source file
+        if (($v_file = @fopen($p_filename, "rb")) == 0) {
+          PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file 
'$p_filename' in binary read mode");
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+          return PclZip::errorCode();
+        }
+
+        if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
+          // ----- Read the file content
+          $v_content_compressed = @fread($v_file, $p_header['size']);
+
+          // ----- Calculate the CRC
+          $p_header['crc'] = crc32($v_content_compressed);
+        }
+        else {
+          // ----- Read the file content
+          $v_content = @fread($v_file, $p_header['size']);
+
+          // ----- Calculate the CRC
+          $p_header['crc'] = crc32($v_content);
+
+          // ----- Compress the file
+          $v_content_compressed = gzdeflate($v_content);
+        }
+
+        // ----- Set header parameters
+        $p_header['compressed_size'] = strlen($v_content_compressed);
+        $p_header['compression'] = 8;
+
+        // ----- Call the header generation
+        if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
+          @fclose($v_file);
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+          return $v_result;
+        }
+
+        // ----- Write the compressed content
+        $v_binary_data = pack('a'.$p_header['compressed_size'], 
$v_content_compressed);
+        @fwrite($this->zip_fd, $v_binary_data, $p_header['compressed_size']);
+        
+        // ----- Close the file
+        @fclose($v_file);
+      }
+
+      // ----- Look for a directory
+      else
+      {
+        // ----- Set the file properties
+        $p_header['filename'] .= '/';
+        $p_header['filename_len']++;
+        $p_header['size'] = 0;
+        $p_header['external'] = 0x41FF0010;   // Value for a folder : to be 
checked
+
+        // ----- Call the header generation
+        if (($v_result = $this->privWriteFileHeader($p_header)) != 1)
+        {
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+          return $v_result;
+        }
+      }
+    }
+
+    // ----- Look for pre-add callback
+    if (isset($p_options[PCLZIP_CB_POST_ADD])) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A 
post-callback '".$p_options[PCLZIP_CB_POST_ADD]."()') is defined for the 
extraction");
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_header, $v_local_header);
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference 
to the
+      // header.
+      eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, 
$v_local_header);');
+      if ($v_result == 0) {
+        // ----- Ignored
+        $v_result = 1;
+      }
+
+      // ----- Update the informations
+      // Nothing can be modified
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privWriteFileHeader()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privWriteFileHeader(&$p_header)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privWriteFileHeader", 'file="'.$p_header['filename'].'", stored as 
"'.$p_header['stored_filename'].'"');
+    $v_result=1;
+
+    // TBC
+    //for(reset($p_header); $key = key($p_header); next($p_header)) {
+    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"header[$key] = ".$p_header[$key]);
+    //}
+
+    // ----- Store the offset position of the file
+    $p_header['offset'] = ftell($this->zip_fd);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'File 
offset of the header :'.$p_header['offset']);
+
+    // ----- Transform UNIX mtime to DOS format mdate/mtime
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : 
\''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
+    $v_date = getdate($p_header['mtime']);
+    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + 
$v_date['seconds']/2;
+    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + 
$v_date['mday'];
+
+    // ----- Packed data
+    $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, $p_header['version'], 
$p_header['flag'],
+                          $p_header['compression'], $v_mtime, $v_mdate,
+                          $p_header['crc'], $p_header['compressed_size'], 
$p_header['size'],
+                          strlen($p_header['stored_filename']), 
$p_header['extra_len']);
+
+    // ----- Write the first 148 bytes of the header in the archive
+    fputs($this->zip_fd, $v_binary_data, 30);
+
+    // ----- Write the variable fields
+    if (strlen($p_header['stored_filename']) != 0)
+    {
+      fputs($this->zip_fd, $p_header['stored_filename'], 
strlen($p_header['stored_filename']));
+    }
+    if ($p_header['extra_len'] != 0)
+    {
+      fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privWriteCentralFileHeader()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privWriteCentralFileHeader(&$p_header)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privWriteCentralFileHeader", 'file="'.$p_header['filename'].'", stored 
as "'.$p_header['stored_filename'].'"');
+    $v_result=1;
+
+    // TBC
+    //for(reset($p_header); $key = key($p_header); next($p_header)) {
+    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"header[$key] = ".$p_header[$key]);
+    //}
+
+    // ----- Transform UNIX mtime to DOS format mdate/mtime
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : 
\''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
+    $v_date = getdate($p_header['mtime']);
+    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + 
$v_date['seconds']/2;
+    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + 
$v_date['mday'];
+
+    // ----- Packed data
+    $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, 
$p_header['version'], $p_header['version_extracted'],
+                          $p_header['flag'], $p_header['compression'], 
$v_mtime, $v_mdate, $p_header['crc'],
+                          $p_header['compressed_size'], $p_header['size'],
+                          strlen($p_header['stored_filename']), 
$p_header['extra_len'], $p_header['comment_len'],
+                          $p_header['disk'], $p_header['internal'], 
$p_header['external'], $p_header['offset']);
+
+    // ----- Write the 42 bytes of the header in the zip file
+    fputs($this->zip_fd, $v_binary_data, 46);
+
+    // ----- Write the variable fields
+    if (strlen($p_header['stored_filename']) != 0)
+    {
+      fputs($this->zip_fd, $p_header['stored_filename'], 
strlen($p_header['stored_filename']));
+    }
+    if ($p_header['extra_len'] != 0)
+    {
+      fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
+    }
+    if ($p_header['comment_len'] != 0)
+    {
+      fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']);
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privWriteCentralHeader()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, 
$p_comment)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privWriteCentralHeader", 'nb_entries='.$p_nb_entries.', 
size='.$p_size.', offset='.$p_offset.', comment="'.$p_comment.'"');
+    $v_result=1;
+
+    // ----- Packed data
+    $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, 
$p_nb_entries, $p_size, $p_offset, strlen($p_comment));
+
+    // ----- Write the 22 bytes of the header in the zip file
+    fputs($this->zip_fd, $v_binary_data, 22);
+
+    // ----- Write the variable fields
+    if (strlen($p_comment) != 0)
+    {
+      fputs($this->zip_fd, $p_comment, strlen($p_comment));
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privList()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privList(&$p_list)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privList", "list");
+    $v_result=1;
+
+    // ----- Open the zip file
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open 
file in binary read mode");
+    if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive 
\''.$this->zipname.'\' in binary read mode');
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Read the central directory informations
+    $v_central_dir = array();
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Go to beginning of Central Dir
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Offset 
: ".$v_central_dir['offset']."'");
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Position in file : ".ftell($this->zip_fd)."'");
+    @rewind($this->zip_fd);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Position in file : ".ftell($this->zip_fd)."'");
+    if (@fseek($this->zip_fd, $v_central_dir['offset']))
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive 
size');
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Position in file : ".ftell($this->zip_fd)."'");
+
+    // ----- Read each entry
+    for ($i=0; $i<$v_central_dir['entries']; $i++)
+    {
+      // ----- Read the file header
+      if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+        return $v_result;
+      }
+      $v_header['index'] = $i;
+
+      // ----- Get the only interesting attributes
+      $this->privConvertHeader2FileInfo($v_header, $p_list[$i]);
+      unset($v_header);
+    }
+
+    // ----- Close the zip file
+    $this->privCloseFd();
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privConvertHeader2FileInfo()
+  // Description :
+  //   This function takes the file informations from the central directory
+  //   entries and extract the interesting parameters that will be given back.
+  //   The resulting file infos are set in the array $p_info
+  //     $p_info['filename'] : Filename with full path. Given by user (add),
+  //                           extracted in the filesystem (extract).
+  //     $p_info['stored_filename'] : Stored filename in the archive.
+  //     $p_info['size'] = Size of the file.
+  //     $p_info['compressed_size'] = Compressed size of the file.
+  //     $p_info['mtime'] = Last modification date of the file.
+  //     $p_info['comment'] = Comment associated with the file.
+  //     $p_info['folder'] = true/false : indicates if the entry is a folder 
or not.
+  //     $p_info['status'] = status of the action on the file.
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privConvertHeader2FileInfo($p_header, &$p_info)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privConvertHeader2FileInfo", "Filename='".$p_header['filename']."'");
+    $v_result=1;
+
+    // ----- Get the interesting attributes
+    $p_info['filename'] = $p_header['filename'];
+    $p_info['stored_filename'] = $p_header['stored_filename'];
+    $p_info['size'] = $p_header['size'];
+    $p_info['compressed_size'] = $p_header['compressed_size'];
+    $p_info['mtime'] = $p_header['mtime'];
+    $p_info['comment'] = $p_header['comment'];
+    $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
+    $p_info['index'] = $p_header['index'];
+    $p_info['status'] = $p_header['status'];
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privExtractByRule()
+  // Description :
+  //   Extract a file or directory depending of rules (by index, by name, ...)
+  // Parameters :
+  //   $p_file_list : An array where will be placed the properties of each
+  //                  extracted file
+  //   $p_path : Path to add while writing the extracted files
+  //   $p_remove_path : Path to remove (from the file memorized path) while 
writing the
+  //                    extracted files. If the path does not match the file 
path,
+  //                    the file is extracted with its memorized path.
+  //                    $p_remove_path does not apply to 'list' mode.
+  //                    $p_path and $p_remove_path are commulative.
+  // Return Values :
+  //   1 on success,0 or less on error (see error code list)
+  // 
--------------------------------------------------------------------------------
+  function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, 
$p_remove_all_path, &$p_options)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privExtractByRule", "path='$p_path', remove_path='$p_remove_path', 
remove_all_path='".($p_remove_all_path?'true':'false')."'");
+    $v_result=1;
+
+    // ----- Check the path
+    if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 
0, 3) != "../") && (substr($p_path,1,2)!=":/")))
+      $p_path = "./".$p_path;
+
+    // ----- Reduce the path last (and duplicated) '/'
+    if (($p_path != "./") && ($p_path != "/"))
+    {
+      // ----- Look for the path end '/'
+      while (substr($p_path, -1) == "/")
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Destination path [$p_path] ends by '/'");
+        $p_path = substr($p_path, 0, strlen($p_path)-1);
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Modified to [$p_path]");
+      }
+    }
+
+    // ----- Look for path to remove format (should end by /)
+    if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/'))
+    {
+      $p_remove_path .= '/';
+    }
+    $p_remove_path_size = strlen($p_remove_path);
+
+    // ----- Open the zip file
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open 
file in binary read mode");
+    if (($v_result = $this->privOpenFd('rb')) != 1)
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Read the central directory informations
+    $v_central_dir = array();
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+    {
+      // ----- Close the zip file
+      $this->privCloseFd();
+
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Start at beginning of Central Dir
+    $v_pos_entry = $v_central_dir['offset'];
+
+    // ----- Read each entry
+    $j_start = 0;
+    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read 
next file header entry : '$i'");
+
+      // ----- Read next Central dir entry
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Position before rewind : ".ftell($this->zip_fd)."'");
+      @rewind($this->zip_fd);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Position after rewind : ".ftell($this->zip_fd)."'");
+      if (@fseek($this->zip_fd, $v_pos_entry))
+      {
+        // ----- Close the zip file
+        $this->privCloseFd();
+
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive 
size');
+
+        // ----- Return
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+        return PclZip::errorCode();
+      }
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Position after fseek : ".ftell($this->zip_fd)."'");
+
+      // ----- Read the file header
+      $v_header = array();
+      if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
+      {
+        // ----- Close the zip file
+        $this->privCloseFd();
+
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+        return $v_result;
+      }
+
+      // ----- Store the index
+      $v_header['index'] = $i;
+
+      // ----- Store the file position
+      $v_pos_entry = ftell($this->zip_fd);
+
+      // ----- Look for the specific extract rules
+      $v_extract = false;
+
+      // ----- Look for extract by name rule
+      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
+          && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Extract with rule 'ByName'");
+
+          // ----- Look if the filename is in the list
+          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && 
(!$v_extract); $j++) {
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 
3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
+
+              // ----- Look for a directory
+              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "The searched item is a directory");
+
+                  // ----- Look if the directory is in the filename path
+                  if (   (strlen($v_header['stored_filename']) > 
strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
+                      && (substr($v_header['stored_filename'], 0, 
strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == 
$p_options[PCLZIP_OPT_BY_NAME][$j])) {
+                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "The directory is in the file path");
+                      $v_extract = true;
+                  }
+              }
+              // ----- Look for a filename
+              elseif ($v_header['stored_filename'] == 
$p_options[PCLZIP_OPT_BY_NAME][$j]) {
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "The file is the right one.");
+                  $v_extract = true;
+              }
+          }
+      }
+
+      // ----- Look for extract by ereg rule
+      else if (   (isset($p_options[PCLZIP_OPT_BY_EREG]))
+               && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
+
+          if (ereg($p_options[PCLZIP_OPT_BY_EREG], 
$v_header['stored_filename'])) {
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 
3, "Filename match the regular expression");
+              $v_extract = true;
+          }
+      }
+
+      // ----- Look for extract by preg rule
+      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
+               && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Extract with rule 'ByEreg'");
+
+          if (preg_match($p_options[PCLZIP_OPT_BY_PREG], 
$v_header['stored_filename'])) {
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 
3, "Filename match the regular expression");
+              $v_extract = true;
+          }
+      }
+
+      // ----- Look for extract by index rule
+      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
+               && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Extract with rule 'ByIndex'");
+          
+          // ----- Look if the index is in the list
+          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && 
(!$v_extract); $j++) {
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 
3, "Look if index '$i' is in 
[".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
+
+              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && 
($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "Found as part of an index range");
+                  $v_extract = true;
+              }
+              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "Do not look this index range for next loop");
+                  $j_start = $j+1;
+              }
+
+              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "Index range is greater than index, stop loop");
+                  break;
+              }
+          }
+      }
+
+      // ----- Look for no rule, which means extract all the archive
+      else {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Extract with no rule (extract all)");
+          $v_extract = true;
+      }
+      
+
+      // ----- Look for real extraction
+      if ($v_extract)
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Extracting file '".$v_header['filename']."', index '$i'");
+
+        // ----- Go to the file position
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position before rewind : ".ftell($this->zip_fd)."'");
+        @rewind($this->zip_fd);
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position after rewind : ".ftell($this->zip_fd)."'");
+        if (@fseek($this->zip_fd, $v_header['offset']))
+        {
+          // ----- Close the zip file
+          $this->privCloseFd();
+
+          // ----- Error log
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid 
archive size');
+
+          // ----- Return
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+          return PclZip::errorCode();
+        }
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position after fseek : ".ftell($this->zip_fd)."'");
+
+        // ----- Look for extraction as string
+        if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {
+
+          // ----- Extracting the file
+          $v_result1 = $this->privExtractFileAsString($v_header, $v_string);
+          if ($v_result1 < 1) {
+            $this->privCloseFd();
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result1);
+            return $v_result1;
+          }
+
+          // ----- Get the only interesting attributes
+          if (($v_result = $this->privConvertHeader2FileInfo($v_header, 
$p_file_list[$v_nb_extracted])) != 1)
+          {
+            // ----- Close the zip file
+            $this->privCloseFd();
+
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+            return $v_result;
+          }
+
+          // ----- Set the file content
+          $p_file_list[$v_nb_extracted]['content'] = $v_string;
+
+          // ----- Next extracted file
+          $v_nb_extracted++;
+          
+          // ----- Look for user callback abort
+          if ($v_result1 == 2) {
+               break;
+          }
+        }
+        // ----- Look for extraction in standard output
+        elseif (   (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
+                       && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
+          // ----- Extracting the file in standard output
+          $v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
+          if ($v_result1 < 1) {
+            $this->privCloseFd();
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result1);
+            return $v_result1;
+          }
+
+          // ----- Get the only interesting attributes
+          if (($v_result = $this->privConvertHeader2FileInfo($v_header, 
$p_file_list[$v_nb_extracted++])) != 1) {
+            $this->privCloseFd();
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+            return $v_result;
+          }
+
+          // ----- Look for user callback abort
+          if ($v_result1 == 2) {
+               break;
+          }
+        }
+        // ----- Look for normal extraction
+        else {
+          // ----- Extracting the file
+          $v_result1 = $this->privExtractFile($v_header,
+                                                     $p_path, $p_remove_path,
+                                                                               
          $p_remove_all_path,
+                                                                               
          $p_options);
+          if ($v_result1 < 1) {
+            $this->privCloseFd();
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result1);
+            return $v_result1;
+          }
+
+          // ----- Get the only interesting attributes
+          if (($v_result = $this->privConvertHeader2FileInfo($v_header, 
$p_file_list[$v_nb_extracted++])) != 1)
+          {
+            // ----- Close the zip file
+            $this->privCloseFd();
+
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+            return $v_result;
+          }
+
+          // ----- Look for user callback abort
+          if ($v_result1 == 2) {
+               break;
+          }
+        }
+      }
+    }
+
+    // ----- Close the zip file
+    $this->privCloseFd();
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privExtractFile()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privExtractFile(&$p_entry, $p_path, $p_remove_path, 
$p_remove_all_path, &$p_options)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
'PclZip::privExtractFile', "path='$p_path', remove_path='$p_remove_path', 
remove_all_path='".($p_remove_all_path?'true':'false')."'");
+    $v_result=1;
+
+    // ----- Read the file header
+    if (($v_result = $this->privReadFileHeader($v_header)) != 1)
+    {
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found 
file '".$v_header['filename']."', size '".$v_header['size']."'");
+
+    // ----- Check that the file header is coherent with $p_entry info
+    // TBC
+
+    // ----- Look for all path to remove
+    if ($p_remove_all_path == true) {
+        // ----- Get the basename of the path
+        $p_entry['filename'] = basename($p_entry['filename']);
+    }
+
+    // ----- Look for path to remove
+    else if ($p_remove_path != "")
+    {
+      //if (strcmp($p_remove_path, $p_entry['filename'])==0)
+      if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2)
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The 
folder is the same as the removed path '".$p_entry['filename']."'");
+
+        // ----- Change the file status
+        $p_entry['status'] = "filtered";
+
+        // ----- Return
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+        return $v_result;
+      }
+
+      $p_remove_path_size = strlen($p_remove_path);
+      if (substr($p_entry['filename'], 0, $p_remove_path_size) == 
$p_remove_path)
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Found path '$p_remove_path' to remove in file '".$p_entry['filename']."'");
+
+        // ----- Remove the path
+        $p_entry['filename'] = substr($p_entry['filename'], 
$p_remove_path_size);
+
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Resulting file is '".$p_entry['filename']."'");
+      }
+    }
+
+    // ----- Add the path
+    if ($p_path != '')
+    {
+      $p_entry['filename'] = $p_path."/".$p_entry['filename'];
+    }
+
+    // ----- Look for pre-extract callback
+    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A 
pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the 
extraction");
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference 
to the
+      // header.
+      eval('$v_result = 
'.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, 
$v_local_header);');
+      if ($v_result == 0) {
+        // ----- Change the file status
+        $p_entry['status'] = "skipped";
+        $v_result = 1;
+      }
+      
+      // ----- Look for abort result
+      if ($v_result == 2) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"User callback abort the extraction");
+        // ----- This status is internal and will be changed in 'skipped'
+        $p_entry['status'] = "aborted";
+       $v_result = PCLZIP_ERR_USER_ABORTED;
+      }
+
+      // ----- Update the informations
+      // Only some fields can be modified
+      $p_entry['filename'] = $v_local_header['filename'];
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New 
filename is '".$p_entry['filename']."'");
+    }
+
+    // ----- Trace
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Extracting file (with path) '".$p_entry['filename']."', size 
'$v_header[size]'");
+
+    // ----- Look if extraction should be done
+    if ($p_entry['status'] == 'ok') {
+
+    // ----- Look for specific actions while the file exist
+    if (file_exists($p_entry['filename']))
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File 
'".$p_entry['filename']."' already exists");
+
+      // ----- Look if file is a directory
+      if (is_dir($p_entry['filename']))
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Existing file '".$p_entry['filename']."' is a directory");
+
+        // ----- Change the file status
+        $p_entry['status'] = "already_a_directory";
+
+        // ----- Return
+        ////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+        //return $v_result;
+      }
+      // ----- Look if file is write protected
+      else if (!is_writeable($p_entry['filename']))
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Existing file '".$p_entry['filename']."' is write protected");
+
+        // ----- Change the file status
+        $p_entry['status'] = "write_protected";
+
+        // ----- Return
+        ////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+        //return $v_result;
+      }
+
+      // ----- Look if the extracted file is older
+      else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Existing file '".$p_entry['filename']."' is newer (".date("l dS of F Y h:i:s 
A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS 
of F Y h:i:s A", $p_entry['mtime']).")");
+
+        // ----- Change the file status
+        $p_entry['status'] = "newer_exist";
+
+        // ----- Return
+        ////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+        //return $v_result;
+      }
+    }
+
+    // ----- Check the directory availability and create it if necessary
+    else {
+      if ((($p_entry['external']&0x00000010)==0x00000010) || 
(substr($p_entry['filename'], -1) == '/'))
+        $v_dir_to_check = $p_entry['filename'];
+      else if (!strstr($p_entry['filename'], "/"))
+        $v_dir_to_check = "";
+      else
+        $v_dir_to_check = dirname($p_entry['filename']);
+
+      if (($v_result = $this->privDirCheck($v_dir_to_check, 
(($p_entry['external']&0x00000010)==0x00000010))) != 1) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Unable to create path for '".$p_entry['filename']."'");
+
+        // ----- Change the file status
+        $p_entry['status'] = "path_creation_fail";
+
+        // ----- Return
+        ////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+        //return $v_result;
+        $v_result = 1;
+      }
+    }
+    }
+
+    // ----- Look if extraction should be done
+    if ($p_entry['status'] == 'ok') {
+
+      // ----- Do the extraction (if not a folder)
+      if (!(($p_entry['external']&0x00000010)==0x00000010))
+      {
+
+        // ----- Look for not compressed file
+        if ($p_entry['compressed_size'] == $p_entry['size'])
+        {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Extracting an un-compressed file");
+
+          // ----- Opening destination file
+          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
+          {
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Error while opening '".$p_entry['filename']."' in write binary mode");
+
+            // ----- Change the file status
+            $p_entry['status'] = "write_error";
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+            return $v_result;
+          }
+
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Reading '".$p_entry['size']."' bytes");
+
+          // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+          $v_size = $p_entry['compressed_size'];
+          while ($v_size != 0)
+          {
+            $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : 
PCLZIP_READ_BLOCK_SIZE);
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Read $v_read_size bytes");
+            $v_buffer = fread($this->zip_fd, $v_read_size);
+            $v_binary_data = pack('a'.$v_read_size, $v_buffer);
+            @fwrite($v_dest_file, $v_binary_data, $v_read_size);
+            $v_size -= $v_read_size;
+          }
+
+          // ----- Closing the destination file
+          fclose($v_dest_file);
+
+          // ----- Change the file mtime
+          touch($p_entry['filename'], $p_entry['mtime']);
+        }
+        else
+        {
+          // ----- Trace
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Extracting a compressed file");
+
+          // ----- Opening destination file
+          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Error while opening '".$p_entry['filename']."' in write binary mode");
+
+            // ----- Change the file status
+            $p_entry['status'] = "write_error";
+
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+            return $v_result;
+          }
+
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Reading '".$p_entry['size']."' bytes");
+
+          // ----- Read the compressed file in a buffer (one shot)
+          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+
+          // ----- Decompress the file
+          $v_file_content = gzinflate($v_buffer);
+          unset($v_buffer);
+
+          // ----- Write the uncompressed data
+          @fwrite($v_dest_file, $v_file_content, $p_entry['size']);
+          unset($v_file_content);
+
+          // ----- Closing the destination file
+          @fclose($v_dest_file);
+
+          // ----- Change the file mtime
+          touch($p_entry['filename'], $p_entry['mtime']);
+        }
+
+        // ----- Look for chmod option
+        if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"chmod option activated '".$p_options[PCLZIP_OPT_SET_CHMOD]."'");
+
+          // ----- Change the mode of the file
+          chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);
+        }
+
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Extraction done");
+      }
+    }
+
+       // ----- Change abort status
+       if ($p_entry['status'] == "aborted") {
+      $p_entry['status'] = "skipped";
+       }
+       
+    // ----- Look for post-extract callback
+    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A 
post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the 
extraction");
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference 
to the
+      // header.
+      eval('$v_result = 
'.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, 
$v_local_header);');
+
+      // ----- Look for abort result
+      if ($v_result == 2) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"User callback abort the extraction");
+       $v_result = PCLZIP_ERR_USER_ABORTED;
+      }
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privExtractFileInOutput()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privExtractFileInOutput(&$p_entry, &$p_options)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
'PclZip::privExtractFileInOutput', "");
+    $v_result=1;
+
+    // ----- Read the file header
+    if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found 
file '".$v_header['filename']."', size '".$v_header['size']."'");
+
+    // ----- Check that the file header is coherent with $p_entry info
+    // TBC
+
+    // ----- Look for pre-extract callback
+    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A 
pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the 
extraction");
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference 
to the
+      // header.
+      eval('$v_result = 
'.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, 
$v_local_header);');
+      if ($v_result == 0) {
+        // ----- Change the file status
+        $p_entry['status'] = "skipped";
+        $v_result = 1;
+      }
+
+      // ----- Look for abort result
+      if ($v_result == 2) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"User callback abort the extraction");
+        // ----- This status is internal and will be changed in 'skipped'
+        $p_entry['status'] = "aborted";
+       $v_result = PCLZIP_ERR_USER_ABORTED;
+      }
+
+      // ----- Update the informations
+      // Only some fields can be modified
+      $p_entry['filename'] = $v_local_header['filename'];
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New 
filename is '".$p_entry['filename']."'");
+    }
+
+    // ----- Trace
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Extracting file (with path) '".$p_entry['filename']."', size 
'$v_header[size]'");
+
+    // ----- Look if extraction should be done
+    if ($p_entry['status'] == 'ok') {
+
+      // ----- Do the extraction (if not a folder)
+      if (!(($p_entry['external']&0x00000010)==0x00000010)) {
+        // ----- Look for not compressed file
+        if ($p_entry['compressed_size'] == $p_entry['size']) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Extracting an un-compressed file");
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Reading '".$p_entry['size']."' bytes");
+
+          // ----- Read the file in a buffer (one shot)
+          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+
+          // ----- Send the file to the output
+          echo $v_buffer;
+          unset($v_buffer);
+        }
+        else {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Extracting a compressed file");
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Reading '".$p_entry['size']."' bytes");
+
+          // ----- Read the compressed file in a buffer (one shot)
+          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+          
+          // ----- Decompress the file
+          $v_file_content = gzinflate($v_buffer);
+          unset($v_buffer);
+
+          // ----- Send the file to the output
+          echo $v_file_content;
+          unset($v_file_content);
+        }
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Extraction done");
+      }
+    }
+
+       // ----- Change abort status
+       if ($p_entry['status'] == "aborted") {
+      $p_entry['status'] = "skipped";
+       }
+
+    // ----- Look for post-extract callback
+    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A 
post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the 
extraction");
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference 
to the
+      // header.
+      eval('$v_result = 
'.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, 
$v_local_header);');
+
+      // ----- Look for abort result
+      if ($v_result == 2) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"User callback abort the extraction");
+       $v_result = PCLZIP_ERR_USER_ABORTED;
+      }
+    }
+
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privExtractFileAsString()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privExtractFileAsString(&$p_entry, &$p_string)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
'PclZip::privExtractFileAsString', 
"p_entry['filename']='".$p_entry['filename']."'");
+    $v_result=1;
+
+    // ----- Read the file header
+    $v_header = array();
+    if (($v_result = $this->privReadFileHeader($v_header)) != 1)
+    {
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found 
file '".$v_header['filename']."', size '".$v_header['size']."'");
+
+    // ----- Check that the file header is coherent with $p_entry info
+    // TBC
+
+    // ----- Trace
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Extracting file in string (with path) '".$p_entry['filename']."', size 
'$v_header[size]'");
+
+    // ----- Do the extraction (if not a folder)
+    if (!(($p_entry['external']&0x00000010)==0x00000010))
+    {
+      // ----- Look for not compressed file
+      if ($p_entry['compressed_size'] == $p_entry['size'])
+      {
+        // ----- Trace
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Extracting an un-compressed file");
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Reading '".$p_entry['size']."' bytes");
+
+        // ----- Reading the file
+        $p_string = fread($this->zip_fd, $p_entry['compressed_size']);
+      }
+      else
+      {
+        // ----- Trace
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Extracting a compressed file");
+
+        // ----- Reading the file
+        $v_data = fread($this->zip_fd, $p_entry['compressed_size']);
+        
+        // ----- Decompress the file
+        $p_string = gzinflate($v_data);
+      }
+
+      // ----- Trace
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Extraction done");
+    }
+    else {
+        // TBC : error : can not extract a folder in a string
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privReadFileHeader()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privReadFileHeader(&$p_header)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privReadFileHeader", "");
+    $v_result=1;
+
+    // ----- Read the 4 bytes signature
+    $v_binary_data = @fread($this->zip_fd, 4);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary 
data is : '".sprintf("%08x", $v_binary_data)."'");
+    $v_data = unpack('Vid', $v_binary_data);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary 
signature is : '".sprintf("0x%08x", $v_data['id'])."'");
+
+    // ----- Check signature
+    if ($v_data['id'] != 0x04034b50)
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Invalid File header");
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Read the first 42 bytes of the header
+    $v_binary_data = fread($this->zip_fd, 26);
+
+    // ----- Look for invalid block size
+    if (strlen($v_binary_data) != 26)
+    {
+      $p_header['filename'] = "";
+      $p_header['status'] = "invalid_header";
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Invalid block size : ".strlen($v_binary_data));
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : 
".strlen($v_binary_data));
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Extract the values
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header 
: '".$v_binary_data."'");
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header 
(Hex) : '".bin2hex($v_binary_data)."'");
+    $v_data = 
unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len',
 $v_binary_data);
+
+    // ----- Get filename
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "File 
name length : ".$v_data['filename_len']);
+    $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
'Filename : \''.$p_header['filename'].'\'');
+
+    // ----- Get extra_fields
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extra 
field length : ".$v_data['extra_len']);
+    if ($v_data['extra_len'] != 0) {
+      $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
+    }
+    else {
+      $p_header['extra'] = '';
+    }
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Extra 
field : \''.bin2hex($p_header['extra']).'\'');
+
+    // ----- Extract properties
+    $p_header['compression'] = $v_data['compression'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
'Compression method : \''.bin2hex($p_header['compression']).'\'');
+    $p_header['size'] = $v_data['size'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : 
\''.$p_header['size'].'\'');
+    $p_header['compressed_size'] = $v_data['compressed_size'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
'Compressed Size : \''.$p_header['compressed_size'].'\'');
+    $p_header['crc'] = $v_data['crc'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : 
\''.$p_header['crc'].'\'');
+    $p_header['flag'] = $v_data['flag'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag : 
\''.$p_header['flag'].'\'');
+
+    // ----- Recuperate date in UNIX format
+    $p_header['mdate'] = $v_data['mdate'];
+    $p_header['mtime'] = $v_data['mtime'];
+    if ($p_header['mdate'] && $p_header['mtime'])
+    {
+      // ----- Extract time
+      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
+      $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
+      $v_seconde = ($p_header['mtime'] & 0x001F)*2;
+
+      // ----- Extract date
+      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
+      $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
+      $v_day = $p_header['mdate'] & 0x001F;
+
+      // ----- Get UNIX date format
+      $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, 
$v_day, $v_year);
+
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date 
: \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
+    }
+    else
+    {
+      $p_header['mtime'] = time();
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date 
is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
+    }
+
+    // ----- Other informations
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Compression type : ".$v_data['compression']);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Version 
: ".$v_data['version']);
+
+    // TBC
+    //for(reset($v_data); $key = key($v_data); next($v_data)) {
+    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Attribut[$key] = ".$v_data[$key]);
+    //}
+
+    // ----- Set the stored filename
+    $p_header['stored_filename'] = $p_header['filename'];
+
+    // ----- Set the status field
+    $p_header['status'] = "ok";
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privReadCentralFileHeader()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privReadCentralFileHeader(&$p_header)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privReadCentralFileHeader", "");
+    $v_result=1;
+
+    // ----- Read the 4 bytes signature
+    $v_binary_data = @fread($this->zip_fd, 4);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary 
data is : '".sprintf("%08x", $v_binary_data)."'");
+    $v_data = unpack('Vid', $v_binary_data);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary 
signature is : '".sprintf("0x%08x", $v_data['id'])."'");
+
+    // ----- Check signature
+    if ($v_data['id'] != 0x02014b50)
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Invalid Central Dir File signature");
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Read the first 42 bytes of the header
+    $v_binary_data = fread($this->zip_fd, 42);
+
+    // ----- Look for invalid block size
+    if (strlen($v_binary_data) != 42)
+    {
+      $p_header['filename'] = "";
+      $p_header['status'] = "invalid_header";
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Invalid block size : ".strlen($v_binary_data));
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : 
".strlen($v_binary_data));
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Extract the values
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header 
: '".$v_binary_data."'");
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header 
(Hex) : '".bin2hex($v_binary_data)."'");
+    $p_header = 
unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset',
 $v_binary_data);
+
+    // ----- Get filename
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File 
name length : ".$p_header['filename_len']);
+    if ($p_header['filename_len'] != 0)
+      $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
+    else
+      $p_header['filename'] = '';
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
'Filename : \''.$p_header['filename'].'\'');
+
+    // ----- Get extra
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Extra 
length : ".$p_header['extra_len']);
+    if ($p_header['extra_len'] != 0)
+      $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
+    else
+      $p_header['extra'] = '';
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Extra : 
\''.$p_header['extra'].'\'');
+
+    // ----- Get comment
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Comment 
length : ".$p_header['comment_len']);
+    if ($p_header['comment_len'] != 0)
+      $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
+    else
+      $p_header['comment'] = '';
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Comment 
: \''.$p_header['comment'].'\'');
+
+    // ----- Extract properties
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version 
: \''.($p_header['version']/10).'.'.($p_header['version']%10).'\'');
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version 
need to extract : 
\''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Size : 
\''.$p_header['size'].'\'');
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
'Compressed Size : \''.$p_header['compressed_size'].'\'');
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'CRC : 
\''.$p_header['crc'].'\'');
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Flag : 
\''.$p_header['flag'].'\'');
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Offset 
: \''.$p_header['offset'].'\'');
+
+    // ----- Recuperate date in UNIX format
+    if ($p_header['mdate'] && $p_header['mtime'])
+    {
+      // ----- Extract time
+      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
+      $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
+      $v_seconde = ($p_header['mtime'] & 0x001F)*2;
+
+      // ----- Extract date
+      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
+      $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
+      $v_day = $p_header['mdate'] & 0x001F;
+
+      // ----- Get UNIX date format
+      $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, 
$v_day, $v_year);
+
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date 
: \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
+    }
+    else
+    {
+      $p_header['mtime'] = time();
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date 
is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
+    }
+
+    // ----- Set the stored filename
+    $p_header['stored_filename'] = $p_header['filename'];
+
+    // ----- Set default status to ok
+    $p_header['status'] = 'ok';
+
+    // ----- Look if it is a directory
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Internal (Hex) : '".sprintf("Ox%04X", $p_header['internal'])."'");
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"External (Hex) : '".sprintf("Ox%04X", $p_header['external'])."' 
(".(($p_header['external']&0x00000010)==0x00000010?'is a folder':'is a 
file').')');
+    if (substr($p_header['filename'], -1) == '/')
+    {
+      $p_header['external'] = 0x41FF0010;
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Force 
folder external : \''.$p_header['external'].'\'');
+    }
+
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Header 
of filename : \''.$p_header['filename'].'\'');
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privReadEndCentralDir()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privReadEndCentralDir(&$p_central_dir)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privReadEndCentralDir", "");
+    $v_result=1;
+
+    // ----- Go to the end of the zip file
+    $v_size = filesize($this->zipname);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size of 
the file :$v_size");
+    @fseek($this->zip_fd, $v_size);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
'Position at end of zip file : \''.ftell($this->zip_fd).'\'');
+    if (@ftell($this->zip_fd) != $v_size)
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of 
the archive \''.$this->zipname.'\'');
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- First try : look if this is an archive with no commentaries (most 
of the time)
+    // in this case the end of central dir is at 22 bytes of the file end
+    $v_found = 0;
+    if ($v_size > 26) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Look 
for central dir with no comment');
+      @fseek($this->zip_fd, $v_size-22);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
'Position after min central position : \''.ftell($this->zip_fd).'\'');
+      if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))
+      {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to 
the middle of the archive \''.$this->zipname.'\'');
+
+        // ----- Return
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+        return PclZip::errorCode();
+      }
+
+      // ----- Read for bytes
+      $v_binary_data = @fread($this->zip_fd, 4);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Binary data is : '".sprintf("%08x", $v_binary_data)."'");
+      $v_data = @unpack('Vid', $v_binary_data);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
+
+      // ----- Check signature
+      if ($v_data['id'] == 0x06054b50) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Found central dir at the default position.");
+        $v_found = 1;
+      }
+
+      $v_pos = ftell($this->zip_fd);
+    }
+
+    // ----- Go back to the maximum possible size of the Central Dir End Record
+    if (!$v_found) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Start 
extended search of end central dir');
+      $v_maximum_size = 65557; // 0xFFFF + 22;
+      if ($v_maximum_size > $v_size)
+        $v_maximum_size = $v_size;
+      @fseek($this->zip_fd, $v_size-$v_maximum_size);
+      if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size))
+      {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to 
the middle of the archive \''.$this->zipname.'\'');
+
+        // ----- Return
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+        return PclZip::errorCode();
+      }
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
'Position after max central position : \''.ftell($this->zip_fd).'\'');
+
+      // ----- Read byte per byte in order to find the signature
+      $v_pos = ftell($this->zip_fd);
+      $v_bytes = 0x00000000;
+      while ($v_pos < $v_size)
+      {
+        // ----- Read a byte
+        $v_byte = @fread($this->zip_fd, 1);
+
+        // -----  Add the byte
+        $v_bytes = ($v_bytes << 8) | Ord($v_byte);
+
+        // ----- Compare the bytes
+        if ($v_bytes == 0x504b0506)
+        {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
'Found End Central Dir signature at position : \''.ftell($this->zip_fd).'\'');
+          $v_pos++;
+          break;
+        }
+
+        $v_pos++;
+      }
+
+      // ----- Look if not found end of central dir
+      if ($v_pos == $v_size)
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Unable to find End of Central Dir Record signature");
+
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of 
Central Dir Record signature");
+
+        // ----- Return
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+        return PclZip::errorCode();
+      }
+    }
+
+    // ----- Read the first 18 bytes of the header
+    $v_binary_data = fread($this->zip_fd, 18);
+
+    // ----- Look for invalid block size
+    if (strlen($v_binary_data) != 18)
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"Invalid End of Central Dir Record size : ".strlen($v_binary_data));
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir 
Record size : ".strlen($v_binary_data));
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Extract the values
+    ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Central Dir Record : '".$v_binary_data."'");
+    ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Central Dir Record (Hex) : '".bin2hex($v_binary_data)."'");
+    $v_data = 
unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', 
$v_binary_data);
+
+    // ----- Check the global size
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Comment 
length : ".$v_data['comment_size']);
+    if (($v_pos + $v_data['comment_size'] + 18) != $v_size)
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Fail 
to find the right signature");
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Fail to find the right 
signature");
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Get comment
+    if ($v_data['comment_size'] != 0)
+      $p_central_dir['comment'] = fread($this->zip_fd, 
$v_data['comment_size']);
+    else
+      $p_central_dir['comment'] = '';
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment 
: \''.$p_central_dir['comment'].'\'');
+
+    $p_central_dir['entries'] = $v_data['entries'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of 
entries : \''.$p_central_dir['entries'].'\'');
+    $p_central_dir['disk_entries'] = $v_data['disk_entries'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of 
entries for this disk : \''.$p_central_dir['disk_entries'].'\'');
+    $p_central_dir['offset'] = $v_data['offset'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Offset 
of Central Dir : \''.$p_central_dir['offset'].'\'');
+    $p_central_dir['size'] = $v_data['size'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size of 
Central Dir : \''.$p_central_dir['size'].'\'');
+    $p_central_dir['disk'] = $v_data['disk'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Disk 
number : \''.$p_central_dir['disk'].'\'');
+    $p_central_dir['disk_start'] = $v_data['disk_start'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Start 
disk number : \''.$p_central_dir['disk_start'].'\'');
+
+    // TBC
+    //for(reset($p_central_dir); $key = key($p_central_dir); 
next($p_central_dir)) {
+    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"central_dir[$key] = ".$p_central_dir[$key]);
+    //}
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privDeleteByRule()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privDeleteByRule(&$p_result_list, &$p_options)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privDeleteByRule", "");
+    $v_result=1;
+    $v_list_detail = array();
+
+    // ----- Open the zip file
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open 
file in binary read mode");
+    if (($v_result=$this->privOpenFd('rb')) != 1)
+    {
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Read the central directory informations
+    $v_central_dir = array();
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+    {
+      $this->privCloseFd();
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Go to beginning of File
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position in file : ".ftell($this->zip_fd)."'");
+    @rewind($this->zip_fd);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position in file : ".ftell($this->zip_fd)."'");
+
+    // ----- Scan all the files
+    // ----- Start at beginning of Central Dir
+    $v_pos_entry = $v_central_dir['offset'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position before rewind : ".ftell($this->zip_fd)."'");
+    @rewind($this->zip_fd);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position after rewind : ".ftell($this->zip_fd)."'");
+    if (@fseek($this->zip_fd, $v_pos_entry))
+    {
+      // ----- Close the zip file
+      $this->privCloseFd();
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive 
size');
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position after fseek : ".ftell($this->zip_fd)."'");
+
+    // ----- Read each entry
+    $v_header_list = array();
+    $j_start = 0;
+    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read 
next file header entry (index '$i')");
+
+      // ----- Read the file header
+      $v_header_list[$v_nb_extracted] = array();
+      if (($v_result = 
$this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1)
+      {
+        // ----- Close the zip file
+        $this->privCloseFd();
+
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+        return $v_result;
+      }
+
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Filename (index '$i') : 
'".$v_header_list[$v_nb_extracted]['stored_filename']."'");
+
+      // ----- Store the index
+      $v_header_list[$v_nb_extracted]['index'] = $i;
+
+      // ----- Look for the specific extract rules
+      $v_found = false;
+
+      // ----- Look for extract by name rule
+      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
+          && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Extract with rule 'ByName'");
+
+          // ----- Look if the filename is in the list
+          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && 
(!$v_found); $j++) {
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 
3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
+
+              // ----- Look for a directory
+              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "The searched item is a directory");
+
+                  // ----- Look if the directory is in the filename path
+                  if (   
(strlen($v_header_list[$v_nb_extracted]['stored_filename']) > 
strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
+                      && 
(substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, 
strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == 
$p_options[PCLZIP_OPT_BY_NAME][$j])) {
+                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "The directory is in the file path");
+                      $v_found = true;
+                  }
+                  elseif (   
(($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* 
Indicates a folder */
+                          && 
($v_header_list[$v_nb_extracted]['stored_filename'].'/' == 
$p_options[PCLZIP_OPT_BY_NAME][$j])) {
+                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "The entry is the searched directory");
+                      $v_found = true;
+                  }
+              }
+              // ----- Look for a filename
+              elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == 
$p_options[PCLZIP_OPT_BY_NAME][$j]) {
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "The file is the right one.");
+                  $v_found = true;
+              }
+          }
+      }
+
+      // ----- Look for extract by ereg rule
+      else if (   (isset($p_options[PCLZIP_OPT_BY_EREG]))
+               && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
+
+          if (ereg($p_options[PCLZIP_OPT_BY_EREG], 
$v_header_list[$v_nb_extracted]['stored_filename'])) {
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 
3, "Filename match the regular expression");
+              $v_found = true;
+          }
+      }
+
+      // ----- Look for extract by preg rule
+      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
+               && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Extract with rule 'ByEreg'");
+
+          if (preg_match($p_options[PCLZIP_OPT_BY_PREG], 
$v_header_list[$v_nb_extracted]['stored_filename'])) {
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 
3, "Filename match the regular expression");
+              $v_found = true;
+          }
+      }
+
+      // ----- Look for extract by index rule
+      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
+               && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Extract with rule 'ByIndex'");
+
+          // ----- Look if the index is in the list
+          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && 
(!$v_found); $j++) {
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 
3, "Look if index '$i' is in 
[".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
+
+              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && 
($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "Found as part of an index range");
+                  $v_found = true;
+              }
+              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "Do not look this index range for next loop");
+                  $j_start = $j+1;
+              }
+
+              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, 
__LINE__, 3, "Index range is greater than index, stop loop");
+                  break;
+              }
+          }
+      }
+
+      // ----- Look for deletion
+      if ($v_found)
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' need 
to be deleted");
+        unset($v_header_list[$v_nb_extracted]);
+      }
+      else
+      {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 
"File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' will 
not be deleted");
+        $v_nb_extracted++;
+      }
+    }
+
+    // ----- Look if something need to be deleted
+    if ($v_nb_extracted > 0) {
+
+        // ----- Creates a temporay file
+        $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
+
+        // ----- Creates a temporary zip archive
+        $v_temp_zip = new PclZip($v_zip_temp_name);
+
+        // ----- Open the temporary zip file in write mode
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Open file in binary write mode");
+        if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {
+            $this->privCloseFd();
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+            return $v_result;
+        }
+
+        // ----- Look which file need to be kept
+        for ($i=0; $i<sizeof($v_header_list); $i++) {
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Keep entry index '$i' : '".$v_header_list[$i]['filename']."'");
+
+            // ----- Calculate the position of the header
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Offset='". $v_header_list[$i]['offset']."'");
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position before rewind : ".ftell($this->zip_fd)."'");
+            @rewind($this->zip_fd);
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position after rewind : ".ftell($this->zip_fd)."'");
+            if (@fseek($this->zip_fd,  $v_header_list[$i]['offset'])) {
+                // ----- Close the zip file
+                $this->privCloseFd();
+                $v_temp_zip->privCloseFd();
+                @unlink($v_zip_temp_name);
+
+                // ----- Error log
+                PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid 
archive size');
+
+                // ----- Return
+                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+                return PclZip::errorCode();
+            }
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position after fseek : ".ftell($this->zip_fd)."'");
+
+            // ----- Read the file header
+            if (($v_result = $this->privReadFileHeader($v_header_list[$i])) != 
1) {
+                // ----- Close the zip file
+                $this->privCloseFd();
+                $v_temp_zip->privCloseFd();
+                @unlink($v_zip_temp_name);
+
+                // ----- Return
+                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+                return $v_result;
+            }
+
+            // ----- Write the file header
+            if (($v_result = 
$v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
+                // ----- Close the zip file
+                $this->privCloseFd();
+                $v_temp_zip->privCloseFd();
+                @unlink($v_zip_temp_name);
+
+                // ----- Return
+                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+                return $v_result;
+            }
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Offset for this file is '".$v_header_list[$i]['offset']."'");
+
+            // ----- Read/write the data block
+            if (($v_result = PclZipUtilCopyBlock($this->zip_fd, 
$v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
+                // ----- Close the zip file
+                $this->privCloseFd();
+                $v_temp_zip->privCloseFd();
+                @unlink($v_zip_temp_name);
+
+                // ----- Return
+                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+                return $v_result;
+            }
+        }
+
+        // ----- Store the offset of the central dir
+        $v_offset = @ftell($v_temp_zip->zip_fd);
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "New 
offset of central dir : $v_offset");
+
+        // ----- Re-Create the Central Dir files header
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Creates the new central directory");
+        for ($i=0; $i<sizeof($v_header_list); $i++) {
+            // ----- Create the file header
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Offset of file : ".$v_header_list[$i]['offset']);
+            if (($v_result = 
$v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
+                $v_temp_zip->privCloseFd();
+                $this->privCloseFd();
+                @unlink($v_zip_temp_name);
+
+                // ----- Return
+                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+                return $v_result;
+            }
+
+            // ----- Transform the header to a 'usable' info
+            $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], 
$p_result_list[$i]);
+        }
+
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Creates the central directory footer");
+
+        // ----- Zip file comment
+        $v_comment = '';
+        if (isset($p_options[PCLZIP_OPT_COMMENT])) {
+          $v_comment = $p_options[PCLZIP_OPT_COMMENT];
+        }
+
+        // ----- Calculate the size of the central header
+        $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset;
+
+        // ----- Create the central dir footer
+        if (($v_result = 
$v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, 
$v_comment)) != 1) {
+            // ----- Reset the file list
+            unset($v_header_list);
+            $v_temp_zip->privCloseFd();
+            $this->privCloseFd();
+            @unlink($v_zip_temp_name);
+
+            // ----- Return
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+            return $v_result;
+        }
+
+        // ----- Close
+        $v_temp_zip->privCloseFd();
+        $this->privCloseFd();
+
+        // ----- Delete the zip file
+        // TBC : I should test the result ...
+        @unlink($this->zipname);
+
+        // ----- Rename the temporary file
+        // TBC : I should test the result ...
+        //@rename($v_zip_temp_name, $this->zipname);
+        PclZipUtilRename($v_zip_temp_name, $this->zipname);
+    
+        // ----- Destroy the temporary archive
+        unset($v_temp_zip);
+    }
+    
+    // ----- Remove every files : reset the file
+    else if ($v_central_dir['entries'] != 0) {
+        $this->privCloseFd();
+
+        if (($v_result = $this->privOpenFd('wb')) != 1) {
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+          return $v_result;
+        }
+
+        if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+          return $v_result;
+        }
+
+        $this->privCloseFd();
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privDirCheck()
+  // Description :
+  //   Check if a directory exists, if not it creates it and all the parents 
directory
+  //   which may be useful.
+  // Parameters :
+  //   $p_dir : Directory path to check.
+  // Return Values :
+  //    1 : OK
+  //   -1 : Unable to create directory
+  // 
--------------------------------------------------------------------------------
+  function privDirCheck($p_dir, $p_is_dir=false)
+  {
+    $v_result = 1;
+
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privDirCheck", "entry='$p_dir', 
is_dir='".($p_is_dir?"true":"false")."'");
+
+    // ----- Remove the final '/'
+    if (($p_is_dir) && (substr($p_dir, -1)=='/'))
+    {
+      $p_dir = substr($p_dir, 0, strlen($p_dir)-1);
+    }
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking 
for entry '$p_dir'");
+
+    // ----- Check the directory availability
+    if ((is_dir($p_dir)) || ($p_dir == ""))
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, "'$p_dir' is 
a directory");
+      return 1;
+    }
+
+    // ----- Extract parent directory
+    $p_parent_dir = dirname($p_dir);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Parent 
directory is '$p_parent_dir'");
+
+    // ----- Just a check
+    if ($p_parent_dir != $p_dir)
+    {
+      // ----- Look for parent directory
+      if ($p_parent_dir != "")
+      {
+        if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)
+        {
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
$v_result);
+          return $v_result;
+        }
+      }
+    }
+
+    // ----- Create the directory
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Create 
directory '$p_dir'");
+    if (address@hidden($p_dir, 0777))
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create 
directory '$p_dir'");
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result, 
"Directory '$p_dir' created");
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privMerge()
+  // Description :
+  //   If $p_archive_to_add does not exist, the function exit with a success 
result.
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privMerge(&$p_archive_to_add)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privMerge", "archive='".$p_archive_to_add->zipname."'");
+    $v_result=1;
+
+    // ----- Look if the archive_to_add exists
+    if (!is_file($p_archive_to_add->zipname))
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Archive to add does not exist. End of merge.");
+
+      // ----- Nothing to merge, so merge is a success
+      $v_result = 1;
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Look if the archive exists
+    if (!is_file($this->zipname))
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Archive does not exist, duplicate the archive_to_add.");
+
+      // ----- Do a duplicate
+      $v_result = $this->privDuplicate($p_archive_to_add->zipname);
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Open the zip file
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open 
file in binary read mode");
+    if (($v_result=$this->privOpenFd('rb')) != 1)
+    {
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Read the central directory informations
+    $v_central_dir = array();
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+    {
+      $this->privCloseFd();
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Go to beginning of File
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position in zip : ".ftell($this->zip_fd)."'");
+    @rewind($this->zip_fd);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position in zip : ".ftell($this->zip_fd)."'");
+
+    // ----- Open the archive_to_add file
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open 
archive_to_add in binary read mode");
+    if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)
+    {
+      $this->privCloseFd();
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Read the central directory informations
+    $v_central_dir_to_add = array();
+    if (($v_result = 
$p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1)
+    {
+      $this->privCloseFd();
+      $p_archive_to_add->privCloseFd();
+
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Go to beginning of File
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
+    @rewind($p_archive_to_add->zip_fd);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
+
+    // ----- Creates a temporay file
+    $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
+
+    // ----- Open the temporary file in write mode
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open 
file in binary read mode");
+    if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
+    {
+      $this->privCloseFd();
+      $p_archive_to_add->privCloseFd();
+
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open 
temporary file \''.$v_zip_temp_name.'\' in binary write mode');
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Copy the files from the archive to the temporary file
+    // TBC : Here I should better append the file and go back to erase the 
central dir
+    $v_size = $v_central_dir['offset'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : 
PCLZIP_READ_BLOCK_SIZE);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read 
$v_read_size bytes");
+      $v_buffer = fread($this->zip_fd, $v_read_size);
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Copy the files from the archive_to_add into the temporary file
+    $v_size = $v_central_dir_to_add['offset'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : 
PCLZIP_READ_BLOCK_SIZE);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read 
$v_read_size bytes");
+      $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Store the offset of the central dir
+    $v_offset = @ftell($v_zip_temp_fd);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New 
offset of central dir : $v_offset");
+
+    // ----- Copy the block of file headers from the old archive
+    $v_size = $v_central_dir['size'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : 
PCLZIP_READ_BLOCK_SIZE);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read 
$v_read_size bytes");
+      $v_buffer = @fread($this->zip_fd, $v_read_size);
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Copy the block of file headers from the archive_to_add
+    $v_size = $v_central_dir_to_add['size'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : 
PCLZIP_READ_BLOCK_SIZE);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read 
$v_read_size bytes");
+      $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Merge the file comments
+    $v_comment = $v_central_dir['comment'].' 
'.$v_central_dir_to_add['comment'];
+
+    // ----- Calculate the size of the (new) central header
+    $v_size = @ftell($v_zip_temp_fd)-$v_offset;
+
+    // ----- Swap the file descriptor
+    // Here is a trick : I swap the temporary fd with the zip fd, in order to 
use
+    // the following methods on the temporary fil and not the real archive fd
+    $v_swap = $this->zip_fd;
+    $this->zip_fd = $v_zip_temp_fd;
+    $v_zip_temp_fd = $v_swap;
+
+    // ----- Create the central dir footer
+    if (($v_result = 
$this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'],
 $v_size, $v_offset, $v_comment)) != 1)
+    {
+      $this->privCloseFd();
+      $p_archive_to_add->privCloseFd();
+      @fclose($v_zip_temp_fd);
+      $this->zip_fd = null;
+
+      // ----- Reset the file list
+      unset($v_header_list);
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Swap back the file descriptor
+    $v_swap = $this->zip_fd;
+    $this->zip_fd = $v_zip_temp_fd;
+    $v_zip_temp_fd = $v_swap;
+
+    // ----- Close
+    $this->privCloseFd();
+    $p_archive_to_add->privCloseFd();
+
+    // ----- Close the temporary file
+    @fclose($v_zip_temp_fd);
+
+    // ----- Delete the zip file
+    // TBC : I should test the result ...
+    @unlink($this->zipname);
+
+    // ----- Rename the temporary file
+    // TBC : I should test the result ...
+    //@rename($v_zip_temp_name, $this->zipname);
+    PclZipUtilRename($v_zip_temp_name, $this->zipname);
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privDuplicate()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function privDuplicate($p_archive_filename)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZip::privDuplicate", "archive_filename='$p_archive_filename'");
+    $v_result=1;
+
+    // ----- Look if the $p_archive_filename exists
+    if (!is_file($p_archive_filename))
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 
"Archive to duplicate does not exist. End of duplicate.");
+
+      // ----- Nothing to duplicate, so duplicate is a success.
+      $v_result = 1;
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Open the zip file
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open 
file in binary read mode");
+    if (($v_result=$this->privOpenFd('wb')) != 1)
+    {
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Open the temporary file in write mode
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open 
file in binary read mode");
+    if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
+    {
+      $this->privCloseFd();
+
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive 
file \''.$p_archive_filename.'\' in binary write mode');
+
+      // ----- Return
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 
PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Copy the files from the archive to the temporary file
+    // TBC : Here I should better append the file and go back to erase the 
central dir
+    $v_size = filesize($p_archive_filename);
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : 
PCLZIP_READ_BLOCK_SIZE);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read 
$v_read_size bytes");
+      $v_buffer = fread($v_zip_temp_fd, $v_read_size);
+      @fwrite($this->zip_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Close
+    $this->privCloseFd();
+
+    // ----- Close the temporary file
+    @fclose($v_zip_temp_fd);
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privErrorLog()
+  // Description :
+  // Parameters :
+  // 
--------------------------------------------------------------------------------
+  function privErrorLog($p_error_code=0, $p_error_string='')
+  {
+    if (PCLZIP_ERROR_EXTERNAL == 1) {
+      PclError($p_error_code, $p_error_string);
+    }
+    else {
+      $this->error_code = $p_error_code;
+      $this->error_string = $p_error_string;
+    }
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : privErrorReset()
+  // Description :
+  // Parameters :
+  // 
--------------------------------------------------------------------------------
+  function privErrorReset()
+  {
+    if (PCLZIP_ERROR_EXTERNAL == 1) {
+      PclErrorReset();
+    }
+    else {
+      $this->error_code = 1;
+      $this->error_string = '';
+    }
+  }
+  // 
--------------------------------------------------------------------------------
+
+  }
+  // End of class
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : PclZipUtilPathReduction()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function PclZipUtilPathReduction($p_dir)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZipUtilPathReduction", "dir='$p_dir'");
+    $v_result = "";
+
+    // ----- Look for not empty path
+    if ($p_dir != "")
+    {
+      // ----- Explode path by directory names
+      $v_list = explode("/", $p_dir);
+
+      // ----- Study directories from last to first
+      for ($i=sizeof($v_list)-1; $i>=0; $i--)
+      {
+        // ----- Look for current path
+        if ($v_list[$i] == ".")
+        {
+          // ----- Ignore this directory
+          // Should be the first $i=0, but no check is done
+        }
+        else if ($v_list[$i] == "..")
+        {
+          // ----- Ignore it and ignore the $i-1
+          $i--;
+        }
+        else if (($v_list[$i] == "") && ($i!=(sizeof($v_list)-1)) && ($i!=0))
+        {
+          // ----- Ignore only the double '//' in path,
+          // but not the first and last '/'
+        }
+        else
+        {
+          $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
+        }
+      }
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : PclZipUtilPathInclusion()
+  // Description :
+  //   This function indicates if the path $p_path is under the $p_dir tree. 
Or,
+  //   said in an other way, if the file or sub-dir $p_path is inside the dir
+  //   $p_dir.
+  //   The function indicates also if the path is exactly the same as the dir.
+  //   This function supports path with duplicated '/' like '//', but does not
+  //   support '.' or '..' statements.
+  // Parameters :
+  // Return Values :
+  //   0 if $p_path is not inside directory $p_dir
+  //   1 if $p_path is inside directory $p_dir
+  //   2 if $p_path is exactly the same as $p_dir
+  // 
--------------------------------------------------------------------------------
+  function PclZipUtilPathInclusion($p_dir, $p_path)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
+    $v_result = 1;
+
+    // ----- Explode dir and path by directory separator
+    $v_list_dir = explode("/", $p_dir);
+    $v_list_dir_size = sizeof($v_list_dir);
+    $v_list_path = explode("/", $p_path);
+    $v_list_path_size = sizeof($v_list_path);
+
+    // ----- Study directories paths
+    $i = 0;
+    $j = 0;
+    while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) 
{
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Working on dir($i)='".$v_list_dir[$i]."' and path($j)='".$v_list_path[$j]."'");
+
+      // ----- Look for empty dir (path reduction)
+      if ($v_list_dir[$i] == '') {
+        $i++;
+        continue;
+      }
+      if ($v_list_path[$j] == '') {
+        $j++;
+        continue;
+      }
+
+      // ----- Compare the items
+      if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && 
( $v_list_path[$j] != ''))  {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Items ($i,$j) are different");
+        $v_result = 0;
+      }
+
+      // ----- Next items
+      $i++;
+      $j++;
+    }
+
+    // ----- Look if everything seems to be the same
+    if ($v_result) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Look 
for tie break");
+      // ----- Skip all the empty items
+      while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
+      while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Looking on dir($i)='".($i < $v_list_dir_size?$v_list_dir[$i]:'')."' and 
path($j)='".($j < $v_list_path_size?$v_list_path[$j]:'')."'");
+
+      if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
+        // ----- There are exactly the same
+        $v_result = 2;
+      }
+      else if ($i < $v_list_dir_size) {
+        // ----- The path is shorter than the dir
+        $v_result = 0;
+      }
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : PclZipUtilCopyBlock()
+  // Description :
+  // Parameters :
+  //   $p_mode : read/write compression mode
+  //             0 : src & dest normal
+  //             1 : src gzip, dest normal
+  //             2 : src normal, dest gzip
+  //             3 : src & dest gzip
+  // Return Values :
+  // 
--------------------------------------------------------------------------------
+  function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZipUtilCopyBlock", "size=$p_size, mode=$p_mode");
+    $v_result = 1;
+
+    if ($p_mode==0)
+    {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src 
offset before read :".(@ftell($p_src)));
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest 
offset before write :".(@ftell($p_dest)));
+      while ($p_size != 0)
+      {
+        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : 
PCLZIP_READ_BLOCK_SIZE);
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Read $v_read_size bytes");
+        $v_buffer = @fread($p_src, $v_read_size);
+        @fwrite($p_dest, $v_buffer, $v_read_size);
+        $p_size -= $v_read_size;
+      }
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src 
offset after read :".(@ftell($p_src)));
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest 
offset after write :".(@ftell($p_dest)));
+    }
+    else if ($p_mode==1)
+    {
+      while ($p_size != 0)
+      {
+        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : 
PCLZIP_READ_BLOCK_SIZE);
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Read $v_read_size bytes");
+        $v_buffer = @gzread($p_src, $v_read_size);
+        @fwrite($p_dest, $v_buffer, $v_read_size);
+        $p_size -= $v_read_size;
+      }
+    }
+    else if ($p_mode==2)
+    {
+      while ($p_size != 0)
+      {
+        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : 
PCLZIP_READ_BLOCK_SIZE);
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Read $v_read_size bytes");
+        $v_buffer = @fread($p_src, $v_read_size);
+        @gzwrite($p_dest, $v_buffer, $v_read_size);
+        $p_size -= $v_read_size;
+      }
+    }
+    else if ($p_mode==3)
+    {
+      while ($p_size != 0)
+      {
+        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : 
PCLZIP_READ_BLOCK_SIZE);
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 
"Read $v_read_size bytes");
+        $v_buffer = @gzread($p_src, $v_read_size);
+        @gzwrite($p_dest, $v_buffer, $v_read_size);
+        $p_size -= $v_read_size;
+      }
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : PclZipUtilRename()
+  // Description :
+  //   This function tries to do a simple rename() function. If it fails, it
+  //   tries to copy the $p_src file in a new $p_dest file and then unlink the
+  //   first one.
+  // Parameters :
+  //   $p_src : Old filename
+  //   $p_dest : New filename
+  // Return Values :
+  //   1 on success, 0 on failure.
+  // 
--------------------------------------------------------------------------------
+  function PclZipUtilRename($p_src, $p_dest)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZipUtilRename", "source=$p_src, destination=$p_dest");
+    $v_result = 1;
+
+    // ----- Try to rename the files
+    if (address@hidden($p_src, $p_dest)) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail 
to rename file, try copy+unlink");
+
+      // ----- Try to copy & unlink the src
+      if (address@hidden($p_src, $p_dest)) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Fail to copy file");
+        $v_result = 0;
+      }
+      else if (address@hidden($p_src)) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, 
"Fail to unlink old filename");
+        $v_result = 0;
+      }
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : PclZipUtilOptionText()
+  // Description :
+  //   Translate option value in text. Mainly for debug purpose.
+  // Parameters :
+  //   $p_option : the option value.
+  // Return Values :
+  //   The option text value.
+  // 
--------------------------------------------------------------------------------
+  function PclZipUtilOptionText($p_option)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 
"PclZipUtilOptionText", "option='".$p_option."'");
+
+    switch ($p_option) {
+      case PCLZIP_OPT_PATH :
+        $v_result = 'PCLZIP_OPT_PATH';
+      break;
+      case PCLZIP_OPT_ADD_PATH :
+        $v_result = 'PCLZIP_OPT_ADD_PATH';
+      break;
+      case PCLZIP_OPT_REMOVE_PATH :
+        $v_result = 'PCLZIP_OPT_REMOVE_PATH';
+      break;
+      case PCLZIP_OPT_REMOVE_ALL_PATH :
+        $v_result = 'PCLZIP_OPT_REMOVE_ALL_PATH';
+      break;
+      case PCLZIP_OPT_EXTRACT_AS_STRING :
+        $v_result = 'PCLZIP_OPT_EXTRACT_AS_STRING';
+      break;
+      case PCLZIP_OPT_SET_CHMOD :
+        $v_result = 'PCLZIP_OPT_SET_CHMOD';
+      break;
+      case PCLZIP_OPT_BY_NAME :
+        $v_result = 'PCLZIP_OPT_BY_NAME';
+      break;
+      case PCLZIP_OPT_BY_INDEX :
+        $v_result = 'PCLZIP_OPT_BY_INDEX';
+      break;
+      case PCLZIP_OPT_BY_EREG :
+        $v_result = 'PCLZIP_OPT_BY_EREG';
+      break;
+      case PCLZIP_OPT_BY_PREG :
+        $v_result = 'PCLZIP_OPT_BY_PREG';
+      break;
+
+
+      case PCLZIP_CB_PRE_EXTRACT :
+        $v_result = 'PCLZIP_CB_PRE_EXTRACT';
+      break;
+      case PCLZIP_CB_POST_EXTRACT :
+        $v_result = 'PCLZIP_CB_POST_EXTRACT';
+      break;
+      case PCLZIP_CB_PRE_ADD :
+        $v_result = 'PCLZIP_CB_PRE_ADD';
+      break;
+      case PCLZIP_CB_POST_ADD :
+        $v_result = 'PCLZIP_CB_POST_ADD';
+      break;
+
+      default :
+        $v_result = 'Unknown';
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // 
--------------------------------------------------------------------------------
+
+  // 
--------------------------------------------------------------------------------
+  // Function : PclZipUtilTranslateWinPath()
+  // Description :
+  //   Translate windows path by replacing '\' by '/' and optionally removing
+  //   drive letter.
+  // Parameters :
+  //   $p_path : path to translate.
+  //   $p_remove_disk_letter : true | false
+  // Return Values :
+  //   The path translated.
+  // 
--------------------------------------------------------------------------------
+  function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true)
+  {
+    if (stristr(php_uname(), 'windows')) {
+      // ----- Look for potential disk letter
+      if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != 
false)) {
+          $p_path = substr($p_path, $v_position+1);
+      }
+      // ----- Change potential windows directory separator
+      if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
+          $p_path = strtr($p_path, '\\', '/');
+      }
+    }
+    return $p_path;
+  }
+  // 
--------------------------------------------------------------------------------
+
+?>

Index: inc/pclzip/readme.txt
===================================================================
RCS file: inc/pclzip/readme.txt
diff -N inc/pclzip/readme.txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ inc/pclzip/readme.txt       5 Dec 2006 19:40:45 -0000       1.1
@@ -0,0 +1,276 @@
+// 
--------------------------------------------------------------------------------
+// PclZip 2.1 - readme.txt
+// 
--------------------------------------------------------------------------------
+// License GNU/LGPL - December 2003
+// Vincent Blavet - address@hidden
+// http://www.phpconcept.net
+// 
--------------------------------------------------------------------------------
+// $Id: readme.txt,v 1.1 2006/12/05 19:40:45 sigurdne Exp $
+// 
--------------------------------------------------------------------------------
+
+
+
+0 - Sommaire
+============
+    1 - Introduction
+    2 - What's new
+    3 - Corrected bugs
+    4 - Known bugs or limitations
+    5 - License
+    6 - Warning
+    7 - Author
+    8 - Contribute
+
+1 - Introduction
+================
+
+  PclZip is a library that allow you to manage a Zip archive.
+
+  Full documentation about PclZip can be found here : 
http://www.phpconcept.net/pclzip
+
+2 - What's new
+==============
+
+  Version 2.1 :
+    - Add the ability to abort the extraction by using a user callback 
function.
+      The user can now return the value '2' in its callback which indicates to 
stop the
+      extraction. For a pre call-back extract is stopped before the extration 
of the current
+      file. For a post call back, the extraction is stopped after.
+    - Add the ability to extract a file (or several files) directly in the 
standard output.
+      This is done by the new parameter PCLZIP_OPT_EXTRACT_IN_OUTPUT with 
method extract().
+    - Add support for parameters PCLZIP_OPT_COMMENT, PCLZIP_OPT_ADD_COMMENT,
+      PCLZIP_OPT_PREPEND_COMMENT. This will create, replace, add, or prepend 
comments
+      in the zip archive.
+    - When merging two archives, the comments are not any more lost, but 
merged, with a 
+      blank space separator.
+    - Corrected bug : Files are not deleted when all files are asked to be 
deleted.
+    - Corrected bug : Folders with name '0' made PclZip to abort the create or 
add feature.
+
+
+  Version 2.0 :
+    ***** Warning : Some new features may break the backward compatibility for 
your scripts.
+                    Please carefully read the readme file.
+    - Add the ability to delete by Index, name and regular expression. This 
feature is 
+      performed by the method delete(), which uses the optional parameters
+      PCLZIP_OPT_BY_INDEX, PCLZIP_OPT_BY_NAME, PCLZIP_OPT_BY_EREG or 
PCLZIP_OPT_BY_PREG.
+    - Add the ability to extract by regular expression. To extract by regexp 
you must use the method
+      extract(), with the option PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG 
+      (depending if you want to use ereg() or preg_match() syntax) followed by 
the 
+      regular expression pattern.
+    - Add the ability to extract by index, directly with the extract() method. 
This is a
+      code improvment of the extractByIndex() method.
+    - Add the ability to extract by name. To extract by name you must use the 
method
+      extract(), with the option PCLZIP_OPT_BY_NAME followed by the filename to
+      extract or an array of filenames to extract. To extract all a folder, 
use the folder
+      name rather than the filename with a '/' at the end.
+    - Add the ability to add files without compression. This is done with a 
new attribute
+      which is PCLZIP_OPT_NO_COMPRESSION.
+    - Add the attribute PCLZIP_OPT_EXTRACT_AS_STRING, which allow to extract a 
file directly
+      in a string without using any file (or temporary file).
+    - Add constant PCLZIP_SEPARATOR for static configuration of filename 
separators in a single string.
+      The default separator is now a comma (,) and not any more a blank space.
+      THIS BREAK THE BACKWARD COMPATIBILITY : Please check if this may have an 
impact with
+      your script.
+    - Improve algorythm performance by removing the use of temporary files 
when adding or 
+      extracting files in an archive.
+    - Add (correct) detection of empty filename zipping. This can occurs when 
the removed
+      path is the same
+      as a zipped dir. The dir is not zipped (['status'] = filtered), only its 
content.
+    - Add better support for windows paths (thanks for help from 
address@hidden).
+    - Corrected bug : When the archive file already exists with size=0, the 
add() method
+      fails. Corrected in 2.0.
+    - Remove the use of OS_WINDOWS constant. Use php_uname() function rather.
+    - Control the order of index ranges in extract by index feature.
+    - Change the internal management of folders (better handling of internal 
flag).
+
+
+  Version 1.3 :
+    - Removing the double include check. This is now done by include_once() 
and require_once()
+      PHP directives.
+    - Changing the error handling mecanism : Remove the use of an external 
error library.
+      The former PclError...() functions are replaced by internal equivalent 
methods.
+      By changing the environment variable PCLZIP_ERROR_EXTERNAL you can still 
use the former library.
+      Introducing the use of constants for error codes rather than integer 
values. This will help
+      in futur improvment.
+      Introduction of error handling functions like errorCode(), errorName() 
and errorInfo().
+    - Remove the deprecated use of calling function with arguments passed by 
reference.
+    - Add the calling of extract(), extractByIndex(), create() and add() 
functions
+      with variable options rather than fixed arguments.
+    - Add the ability to remove all the file path while extracting or adding,
+      without any need to specify the path to remove.
+      This is available for extract(), extractByIndex(), create() and add() 
functionS by using
+      the new variable options parameters :
+      - PCLZIP_OPT_REMOVE_ALL_PATH : by indicating this option while calling 
the fct.
+    - Ability to change the mode of a file after the extraction (chmod()).
+      This is available for extract() and extractByIndex() functionS by using
+      the new variable options parameters.
+      - PCLZIP_OPT_SET_CHMOD : by setting the value of this option.
+    - Ability to definition call-back options. These call-back will be called 
during the adding,
+      or the extracting of file (extract(), extractByIndex(), create() and 
add() functions) :
+      - PCLZIP_CB_PRE_EXTRACT : will be called before each extraction of a 
file. The user
+        can trigerred the change the filename of the extracted file. The user 
can triggered the
+        skip of the extraction. This is adding a 'skipped' status in the file 
list result value.
+      - PCLZIP_CB_POST_EXTRACT : will be called after each extraction of a 
file.
+        Nothing can be triggered from that point.
+      - PCLZIP_CB_PRE_ADD : will be called before each add of a file. The user
+        can trigerred the change the stored filename of the added file. The 
user can triggered the
+        skip of the add. This is adding a 'skipped' status in the file list 
result value.
+      - PCLZIP_CB_POST_ADD : will be called after each add of a file.
+        Nothing can be triggered from that point.
+    - Two status are added in the file list returned as function result : 
skipped & filename_too_long
+      'skipped' is used when a call-back function ask for skipping the file.
+      'filename_too_long' is used while adding a file with a too long filename 
to archive (the file is
+      not added)
+    - Adding the function PclZipUtilPathInclusion(), that check the inclusion 
of a path into
+      a directory.
+    - Add a check of the presence of the archive file before some actions 
(like list, ...)
+    - Add the initialisation of field "index" in header array. This means that 
by
+      default index will be -1 when not explicitly set by the methods.
+
+  Version 1.2 :
+    - Adding a duplicate function.
+    - Adding a merge function. The merge function is a "quick merge" function,
+      it just append the content of an archive at the end of the first one. 
There
+      is no check for duplicate files or more recent files.
+    - Improve the search of the central directory end.
+
+  Version 1.1.2 :
+
+    - Changing the license of PclZip. PclZip is now released under the GNU / 
LGPL license
+      (see License section).
+    - Adding the optional support of a static temporary directory. You will 
need to configure
+      the constant PCLZIP_TEMPORARY_DIR if you want to use this feature.
+    - Improving the rename() function. In some cases rename() does not work 
(different
+      Filesystems), so it will be replaced by a copy() + unlink() functions.
+
+  Version 1.1.1 :
+
+    - Maintenance release, no new feature.
+
+  Version 1.1 :
+
+    - New method Add() : adding files in the archive
+    - New method ExtractByIndex() : partial extract of the archive, files are 
identified by
+      their index in the archive
+    - New method DeleteByIndex() : delete some files/folder entries from the 
archive,
+      files are identified by their index in the archive.
+    - Adding a test of the zlib extension presence. If not present abort the 
script.
+
+  Version 1.0.1 :
+
+    - No new feature
+
+
+3 - Corrected bugs
+==================
+
+  Corrected in Version 2.0 :
+    - Corrected : During an extraction, if a call-back fucntion is used and 
try to skip
+                  a file, all the extraction process is stopped. 
+
+  Corrected in Version 1.3 :
+    - Corrected : Support of static synopsis for method extract() is broken.
+    - Corrected : invalid size of archive content field (0xFF) should be 
(0xFFFF).
+    - Corrected : When an extract is done with a remove_path parameter, the 
entry for
+      the directory with exactly the same path is not skipped/filtered.
+    - Corrected : extractByIndex() and deleteByIndex() were not managing index 
in the
+      right way. For example indexes '1,3-5,11' will only extract files 1 and 
11. This
+      is due to a sort of the index resulting table that puts 11 before 3-5 
(sort on
+      string and not interger). The sort is temporarilly removed, this means 
that
+      you must provide a sorted list of index ranges.
+
+  Corrected in Version 1.2 :
+
+    - Nothing.
+
+  Corrected in Version 1.1.2 :
+
+    - Corrected : Winzip is unable to delete or add new files in a PclZip 
created archives.
+
+  Corrected in Version 1.1.1 :
+
+    - Corrected : When archived file is not compressed (0% compression), the
+      extract method fails.
+
+  Corrected in Version 1.1 :
+
+    - Corrected : Adding a complete tree of folder may result in a bad archive
+      creation.
+
+  Corrected in Version 1.0.1 :
+
+    - Corrected : Error while compressing files greater than 
PCLZIP_READ_BLOCK_SIZE (default=1024).
+
+
+4 - Known bugs or limitations
+=============================
+
+  Please publish bugs reports in SourceForge :
+    http://sourceforge.net/tracker/?group_id=40254&atid=427564
+
+  In Version 1.2 :
+
+    - merge() methods does not check for duplicate files or last date of 
modifications.
+
+  In Version 1.1 :
+
+    - Limitation : Using 'extract' fields in the file header in the zip 
archive is not supported.
+    - WinZip is unable to delete a single file in a PclZip created archive. It 
is also unable to
+      add a file in a PclZip created archive. (Corrected in v.1.2)
+
+  In Version 1.0.1 :
+
+    - Adding a complete tree of folder may result in a bad archive
+      creation. (Corrected in V.1.1).
+    - Path given to methods must be in the unix format (/) and not the Windows 
format (\).
+      Workaround : Use only / directory separators.
+    - PclZip is using temporary files that are sometime the name of the file 
with a .tmp or .gz
+      added suffix. Files with these names may already exist and may be 
overwritten.
+      Workaround : none.
+    - PclZip does not check if the zlib extension is present. If it is absent, 
the zip
+      file is not created and the lib abort without warning.
+      Workaround : enable the zlib extension on the php install
+
+  In Version 1.0 :
+
+    - Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE 
(default=1024).
+      (Corrected in v.1.0.1)
+    - Limitation : Multi-disk zip archive are not supported.
+
+
+5 - License
+===========
+
+  Since version 1.1.2, PclZip Library is released under GNU/LGPL license.
+  This library is free, so you can use it at no cost.
+
+  HOWEVER, if you release a script, an application, a library or any kind of
+  code using PclZip library (or a part of it), YOU MUST :
+  - Indicate in the documentation (or a readme file), that your work
+    uses PclZip Library, and make a reference to the author and the web site
+    http://www.phpconcept.net
+  - Gives the ability to the final user to update the PclZip libary.
+
+  I will also appreciate that you send me a mail (address@hidden), just to
+  be aware that someone is using PclZip.
+
+  For more information about GNU/LGPL license : http://www.gnu.org
+
+6 - Warning
+=================
+
+  This library and the associated files are non commercial, non professional 
work.
+  It should not have unexpected results. However if any damage is caused by 
this software
+  the author can not be responsible.
+  The use of this software is at the risk of the user.
+
+7 - Author
+==========
+
+  This software was written by Vincent Blavet (address@hidden) on its leasure 
time.
+
+8 - Contribute
+==============
+  If you want to contribute to the development of PclZip, please contact 
address@hidden
+  If you can help in financing PhpConcept hosting service, please go to
+  http://www.phpconcept.net/soutien.php
\ No newline at end of file

Index: templates/base/images/booked1.png
===================================================================
RCS file: templates/base/images/booked1.png
diff -N templates/base/images/booked1.png
Binary files /dev/null and /tmp/cvsWJwzB2 differ

Index: templates/base/images/button_act_report.png
===================================================================
RCS file: templates/base/images/button_act_report.png
diff -N templates/base/images/button_act_report.png
Binary files /dev/null and /tmp/cvs7oGeH0 differ

Index: templates/base/images/button_export_diamant.png
===================================================================
RCS file: templates/base/images/button_export_diamant.png
diff -N templates/base/images/button_export_diamant.png
Binary files /dev/null and /tmp/cvsuSOIb1 differ

Index: templates/base/images/button_pro_activities.png
===================================================================
RCS file: templates/base/images/button_pro_activities.png
diff -N templates/base/images/button_pro_activities.png
Binary files /dev/null and /tmp/cvsb0aAU3 differ

Index: templates/base/images/button_pro_add.png
===================================================================
RCS file: templates/base/images/button_pro_add.png
diff -N templates/base/images/button_pro_add.png
Binary files /dev/null and /tmp/cvsmVgEo4 differ

Index: templates/base/images/button_pro_add_sub.jpg
===================================================================
RCS file: templates/base/images/button_pro_add_sub.jpg
diff -N templates/base/images/button_pro_add_sub.jpg
Binary files /dev/null and /tmp/cvsXFc014 differ

Index: templates/base/images/button_pro_budget.jpg
===================================================================
RCS file: templates/base/images/button_pro_budget.jpg
diff -N templates/base/images/button_pro_budget.jpg
Binary files /dev/null and /tmp/cvsIDCOa3 differ

Index: templates/base/images/button_pro_edit.png
===================================================================
RCS file: templates/base/images/button_pro_edit.png
diff -N templates/base/images/button_pro_edit.png
Binary files /dev/null and /tmp/cvsTqmfy3 differ

Index: templates/base/images/button_pro_employees.png
===================================================================
RCS file: templates/base/images/button_pro_employees.png
diff -N templates/base/images/button_pro_employees.png
Binary files /dev/null and /tmp/cvsAEJyn6 differ

Index: templates/base/images/button_pro_ganttchart.png
===================================================================
RCS file: templates/base/images/button_pro_ganttchart.png
diff -N templates/base/images/button_pro_ganttchart.png
Binary files /dev/null and /tmp/cvsTNkL16 differ

Index: templates/base/images/button_pro_hours.png
===================================================================
RCS file: templates/base/images/button_pro_hours.png
diff -N templates/base/images/button_pro_hours.png
Binary files /dev/null and /tmp/cvsm8Rgv7 differ

Index: templates/base/images/button_pro_list.png
===================================================================
RCS file: templates/base/images/button_pro_list.png
diff -N templates/base/images/button_pro_list.png
Binary files /dev/null and /tmp/cvsrU37v5 differ

Index: templates/base/images/button_pro_parent.gif
===================================================================
RCS file: templates/base/images/button_pro_parent.gif
diff -N templates/base/images/button_pro_parent.gif
Binary files /dev/null and /tmp/cvsKFBM15 differ

Index: templates/base/images/button_pro_parent.png
===================================================================
RCS file: templates/base/images/button_pro_parent.png
diff -N templates/base/images/button_pro_parent.png
Binary files /dev/null and /tmp/cvszZrp18 differ

Index: templates/base/images/button_pro_view.png
===================================================================
RCS file: templates/base/images/button_pro_view.png
diff -N templates/base/images/button_pro_view.png
Binary files /dev/null and /tmp/cvs6F2js9 differ

Index: templates/base/images/button_wt_add.png
===================================================================
RCS file: templates/base/images/button_wt_add.png
diff -N templates/base/images/button_wt_add.png
Binary files /dev/null and /tmp/cvsdxc5Q9 differ

Index: templates/base/images/button_wt_cs.jpg
===================================================================
RCS file: templates/base/images/button_wt_cs.jpg
diff -N templates/base/images/button_wt_cs.jpg
Binary files /dev/null and /tmp/cvsMAa507 differ

Index: templates/base/images/button_wt_list.png
===================================================================
RCS file: templates/base/images/button_wt_list.png
diff -N templates/base/images/button_wt_list.png
Binary files /dev/null and /tmp/cvsxIKdE8 differ

Index: templates/base/images/button_wt_stat.gif
===================================================================
RCS file: templates/base/images/button_wt_stat.gif
diff -N templates/base/images/button_wt_stat.gif
Binary files /dev/null and /tmp/cvs6nPlub differ

Index: templates/base/images/button_wt_stat.png
===================================================================
RCS file: templates/base/images/button_wt_stat.png
diff -N templates/base/images/button_wt_stat.png
Binary files /dev/null and /tmp/cvspn07Pb differ

Index: templates/base/images/button_wt_tt.jpg
===================================================================
RCS file: templates/base/images/button_wt_tt.jpg
diff -N templates/base/images/button_wt_tt.jpg
Binary files /dev/null and /tmp/cvsy7gO89 differ

Index: templates/base/images/delete.png
===================================================================
RCS file: templates/base/images/delete.png
diff -N templates/base/images/delete.png
Binary files /dev/null and /tmp/cvsNSjIeb differ

Index: templates/base/images/document.png
===================================================================
RCS file: templates/base/images/document.png
diff -N templates/base/images/document.png
Binary files /dev/null and /tmp/cvseAvl1d differ

Index: templates/base/images/help.png
===================================================================
RCS file: templates/base/images/help.png
diff -N templates/base/images/help.png
Binary files /dev/null and /tmp/cvsruLTwc differ

Index: templates/base/images/navbar.gif
===================================================================
RCS file: templates/base/images/navbar.gif
diff -N templates/base/images/navbar.gif
Binary files /dev/null and /tmp/cvsECHZdd differ

Index: templates/base/images/users.png
===================================================================
RCS file: templates/base/images/users.png
diff -N templates/base/images/users.png
Binary files /dev/null and /tmp/cvs3UzDEd differ

Index: templates/idots/images/aufbau.png
===================================================================
RCS file: templates/idots/images/aufbau.png
diff -N templates/idots/images/aufbau.png
Binary files /dev/null and /tmp/cvs2jayEg differ

Index: templates/idots/images/booked1.png
===================================================================
RCS file: templates/idots/images/booked1.png
diff -N templates/idots/images/booked1.png
Binary files /dev/null and /tmp/cvsPWkHeh differ

Index: templates/idots/images/delete.png
===================================================================
RCS file: templates/idots/images/delete.png
diff -N templates/idots/images/delete.png
Binary files /dev/null and /tmp/cvsIUvVpf differ

Index: templates/idots/images/document.png
===================================================================
RCS file: templates/idots/images/document.png
diff -N templates/idots/images/document.png
Binary files /dev/null and /tmp/cvsHX1aRf differ

Index: templates/idots/images/help.png
===================================================================
RCS file: templates/idots/images/help.png
diff -N templates/idots/images/help.png
Binary files /dev/null and /tmp/cvs6f6mzi differ

Index: templates/probusiness/images/aufbau.png
===================================================================
RCS file: templates/probusiness/images/aufbau.png
diff -N templates/probusiness/images/aufbau.png
Binary files /dev/null and /tmp/cvsno639i differ

Index: templates/probusiness/images/booked1.png
===================================================================
RCS file: templates/probusiness/images/booked1.png
diff -N templates/probusiness/images/booked1.png
Binary files /dev/null and /tmp/cvsmemyqh differ

Index: templates/probusiness/images/document.png
===================================================================
RCS file: templates/probusiness/images/document.png
diff -N templates/probusiness/images/document.png
Binary files /dev/null and /tmp/cvsJ93bVh differ




reply via email to

[Prev in Thread] Current Thread [Next in Thread]