[midgard-commits] r11023 - in
branches/branch-2_6/src/org.openpsa.projects: . config
handler handler/hours handler/project handler/task locale
netblade
midgard-commits at lists.midgard-project.org
Thu Jun 21 15:12:29 CEST 2007
Author: netblade
Date: Thu Jun 21 15:12:28 2007
New Revision: 11023
URL: http://trac.midgard-project.org/software/changeset/11023
Log:
Backported r11020
Added:
branches/branch-2_6/src/org.openpsa.projects/config/schemadb_default_project_dm2.inc
branches/branch-2_6/src/org.openpsa.projects/handler/hours/csv.php
branches/branch-2_6/src/org.openpsa.projects/handler/project/csv.php
branches/branch-2_6/src/org.openpsa.projects/handler/task/csv.php
Modified:
branches/branch-2_6/src/org.openpsa.projects/config/config.inc
branches/branch-2_6/src/org.openpsa.projects/config/schemadb_default_task_dm2.inc
branches/branch-2_6/src/org.openpsa.projects/handler/frontpage.php
branches/branch-2_6/src/org.openpsa.projects/handler/project/view.php
branches/branch-2_6/src/org.openpsa.projects/handler/task/view.php
branches/branch-2_6/src/org.openpsa.projects/locale/default.en.txt
branches/branch-2_6/src/org.openpsa.projects/locale/default.fi.txt
branches/branch-2_6/src/org.openpsa.projects/task_midcomdba.php
branches/branch-2_6/src/org.openpsa.projects/viewer.php
Modified: branches/branch-2_6/src/org.openpsa.projects/config/config.inc
==============================================================================
--- branches/branch-2_6/src/org.openpsa.projects/config/config.inc (original)
+++ branches/branch-2_6/src/org.openpsa.projects/config/config.inc Thu Jun 21 15:12:28 2007
@@ -15,6 +15,7 @@
'schemadb_task' => 'file:/org/openpsa/projects/config/schemadb_default_task.inc',
'schemadb_task_dm2' => 'file:/org/openpsa/projects/config/schemadb_default_task_dm2.inc',
'schemadb_project' => 'file:/org/openpsa/projects/config/schemadb_default_project.inc',
+'schemadb_project_dm2' => 'file:/org/openpsa/projects/config/schemadb_default_project_dm2.inc',
/**
* Hour Reporting Datamanager schema snippet
*/
@@ -25,4 +26,11 @@
*/
'enable_project_news' => false,
'enable_project_forum' => false,
-'list_projects_by_status' => true,
\ No newline at end of file
+'list_projects_by_status' => true,
+
+/**
+ * CSV-export configuration
+ */
+'csv_export_schema_hours' => 'hour_report',
+'csv_export_schema_projects' => 'export',
+'csv_export_schema_tasks' => 'export',
\ No newline at end of file
Added: branches/branch-2_6/src/org.openpsa.projects/config/schemadb_default_project_dm2.inc
==============================================================================
--- (empty file)
+++ branches/branch-2_6/src/org.openpsa.projects/config/schemadb_default_project_dm2.inc Thu Jun 21 15:12:28 2007
@@ -0,0 +1,428 @@
+'default' => array
+(
+ 'description' => 'project',
+ 'fields' => array
+ (
+ 'title' => array
+ (
+ 'title' => 'title',
+ 'type' => 'text',
+ 'widget' => 'text',
+ 'storage' => 'title',
+ 'required' => true,
+ ),
+ 'customer' => array
+ (
+ 'title' => 'customer',
+ 'storage' => 'customer',
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'require_corresponding_option' => false,
+ 'options' => array(),
+ ),
+ 'widget' => 'universalchooser',
+ 'widget_config' => array
+ (
+ 'class' => 'org_openpsa_contacts_group',
+ 'component' => 'org.openpsa.contacts',
+ 'titlefield' => 'official',
+ 'idfield' => 'id',
+ 'constraints' => array(),
+ 'searchfields' => array
+ (
+ 'name',
+ 'official',
+ ),
+ 'orders' => array
+ (
+ array('official' => 'ASC'),
+ array('name' => 'ASC'),
+ ),
+ ),
+ ),
+ 'tags' => Array
+ (
+ 'title' => 'skills required',
+ 'storage' => null,
+ 'type' => 'tags',
+ 'widget' => 'text',
+ ),
+ 'start' => Array
+ (
+ 'title' => 'start time',
+ 'storage' => 'start',
+ 'type' => 'date',
+ 'type_config' => Array
+ (
+ 'storage_type' => 'UNIXTIME'
+ ),
+ 'widget' => 'jsdate',
+ 'widget_config' => Array
+ (
+ 'show_time' => false,
+ ),
+ ),
+ 'end' => Array
+ (
+ 'title' => 'deadline',
+ 'storage' => 'end',
+ 'type' => 'date',
+ 'type_config' => Array
+ (
+ 'storage_type' => 'UNIXTIME'
+ ),
+ 'widget' => 'jsdate',
+ 'widget_config' => Array
+ (
+ 'show_time' => false,
+ ),
+ ),
+ 'description' => Array
+ (
+ 'title' => 'description',
+ 'storage' => 'description',
+ 'type' => 'text',
+ 'type_config' => array
+ (
+ 'output_mode' => 'markdown'
+ ),
+ 'widget' => 'textarea',
+ ),
+ 'manager' => array
+ (
+ 'title' => 'manager',
+ 'storage' => 'manager',
+ //'required' => true,
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'require_corresponding_option' => false,
+ 'options' => array(),
+ ),
+ 'widget' => 'universalchooser',
+ 'widget_config' => array
+ (
+ 'class' => 'org_openpsa_contacts_person',
+ 'component' => 'org.openpsa.contacts',
+ 'titlefield' => 'name',
+ 'idfield' => 'id',
+ 'constraints' => array
+ (
+ array
+ (
+ 'field' => 'username',
+ 'op' => '<>',
+ 'value' => '',
+ ),
+ ),
+ 'searchfields' => array
+ (
+ 'firstname',
+ 'lastname',
+ 'username',
+ ),
+ 'orders' => array
+ (
+ array('lastname' => 'ASC'),
+ array('firstname' => 'ASC'),
+
+ ),
+ ),
+ ),
+ 'resources' => array
+ (
+ 'title' => 'resources',
+ 'storage' => 'resources2',
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'require_corresponding_option' => false,
+ 'allow_multiple' => true,
+ 'multiple_storagemode' => 'array',
+ 'options' => array(),
+ ),
+ 'widget' => 'universalchooser',
+ 'widget_config' => array
+ (
+ 'class' => 'org_openpsa_contacts_person',
+ 'component' => 'org.openpsa.contacts',
+ 'titlefield' => 'name',
+ 'idfield' => 'id',
+ 'constraints' => array
+ (
+ array
+ (
+ 'field' => 'username',
+ 'op' => '<>',
+ 'value' => '',
+ ),
+ ),
+ 'searchfields' => array
+ (
+ 'firstname',
+ 'lastname',
+ 'username',
+ ),
+ 'orders' => array
+ (
+ array('lastname' => 'ASC'),
+ array('firstname' => 'ASC'),
+ ),
+ ),
+ ),
+ 'contacts' => array
+ (
+ 'title' => 'contacts',
+ 'storage' => 'contacts2',
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'require_corresponding_option' => false,
+ 'allow_multiple' => true,
+ 'multiple_storagemode' => 'array',
+ 'options' => array(),
+ ),
+ 'widget' => 'universalchooser',
+ 'widget_config' => array
+ (
+ 'class' => 'org_openpsa_contacts_person',
+ 'component' => 'org.openpsa.contacts',
+ 'titlefield' => 'name',
+ 'idfield' => 'id',
+ 'constraints' => array(),
+ 'searchfields' => array
+ (
+ 'firstname',
+ 'lastname',
+ 'username',
+ ),
+ 'orders' => array
+ (
+ array('lastname' => 'ASC'),
+ array('firstname' => 'ASC'),
+ ),
+ ),
+ ),
+ )
+),
+
+'export' => array
+(
+ 'description' => 'project',
+ 'fields' => array
+ (
+ 'title' => array
+ (
+ 'title' => 'title',
+ 'type' => 'text',
+ 'widget' => 'text',
+ 'storage' => 'title',
+ 'required' => true,
+ ),
+ 'up' => array
+ (
+ 'title' => 'parent',
+ 'storage' => 'up',
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'options' => org_openpsa_projects_task::get_tasks_names(),
+ ),
+ 'widget' => 'select',
+ ),
+ 'customer' => array
+ (
+ 'title' => 'customer',
+ 'storage' => 'customer',
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'require_corresponding_option' => false,
+ 'options' => array(),
+ ),
+ 'widget' => 'universalchooser',
+ 'widget_config' => array
+ (
+ 'class' => 'org_openpsa_contacts_group',
+ 'component' => 'org.openpsa.contacts',
+ 'titlefield' => 'official',
+ 'idfield' => 'id',
+ 'constraints' => array(),
+ 'searchfields' => array
+ (
+ 'name',
+ 'official',
+ ),
+ 'orders' => array
+ (
+ array('official' => 'ASC'),
+ array('name' => 'ASC'),
+ ),
+ ),
+ ),
+ 'tags' => Array
+ (
+ 'title' => 'skills required',
+ 'storage' => null,
+ 'type' => 'tags',
+ 'widget' => 'text',
+ ),
+ 'start' => Array
+ (
+ 'title' => 'start time',
+ 'storage' => 'start',
+ 'type' => 'date',
+ 'type_config' => Array
+ (
+ 'storage_type' => 'UNIXTIME'
+ ),
+ 'widget' => 'jsdate',
+ 'widget_config' => Array
+ (
+ 'show_time' => false,
+ ),
+ ),
+ 'end' => Array
+ (
+ 'title' => 'deadline',
+ 'storage' => 'end',
+ 'type' => 'date',
+ 'type_config' => Array
+ (
+ 'storage_type' => 'UNIXTIME'
+ ),
+ 'widget' => 'jsdate',
+ 'widget_config' => Array
+ (
+ 'show_time' => false,
+ ),
+ ),
+ 'description' => Array
+ (
+ 'title' => 'description',
+ 'storage' => 'description',
+ 'type' => 'text',
+ 'type_config' => array
+ (
+ 'output_mode' => 'markdown'
+ ),
+ 'widget' => 'textarea',
+ ),
+ 'manager' => array
+ (
+ 'title' => 'manager',
+ 'storage' => 'manager',
+ //'required' => true,
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'require_corresponding_option' => false,
+ 'options' => array(),
+ ),
+ 'widget' => 'universalchooser',
+ 'widget_config' => array
+ (
+ 'class' => 'org_openpsa_contacts_person',
+ 'component' => 'org.openpsa.contacts',
+ 'titlefield' => 'name',
+ 'idfield' => 'id',
+ 'constraints' => array
+ (
+ array
+ (
+ 'field' => 'username',
+ 'op' => '<>',
+ 'value' => '',
+ ),
+ ),
+ 'searchfields' => array
+ (
+ 'firstname',
+ 'lastname',
+ 'username',
+ ),
+ 'orders' => array
+ (
+ array('lastname' => 'ASC'),
+ array('firstname' => 'ASC'),
+
+ ),
+ ),
+ ),
+ 'resources' => array
+ (
+ 'title' => 'resources',
+ 'storage' => 'resources2',
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'require_corresponding_option' => false,
+ 'allow_multiple' => true,
+ 'multiple_storagemode' => 'array',
+ 'options' => array(),
+ ),
+ 'widget' => 'universalchooser',
+ 'widget_config' => array
+ (
+ 'class' => 'org_openpsa_contacts_person',
+ 'component' => 'org.openpsa.contacts',
+ 'titlefield' => 'name',
+ 'idfield' => 'id',
+ 'constraints' => array
+ (
+ array
+ (
+ 'field' => 'username',
+ 'op' => '<>',
+ 'value' => '',
+ ),
+ ),
+ 'searchfields' => array
+ (
+ 'firstname',
+ 'lastname',
+ 'username',
+ ),
+ 'orders' => array
+ (
+ array('lastname' => 'ASC'),
+ array('firstname' => 'ASC'),
+ ),
+ ),
+ ),
+ 'contacts' => array
+ (
+ 'title' => 'contacts',
+ 'storage' => 'contacts2',
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'require_corresponding_option' => false,
+ 'allow_multiple' => true,
+ 'multiple_storagemode' => 'array',
+ 'options' => array(),
+ ),
+ 'widget' => 'universalchooser',
+ 'widget_config' => array
+ (
+ 'class' => 'org_openpsa_contacts_person',
+ 'component' => 'org.openpsa.contacts',
+ 'titlefield' => 'name',
+ 'idfield' => 'id',
+ 'constraints' => array(),
+ 'searchfields' => array
+ (
+ 'firstname',
+ 'lastname',
+ 'username',
+ ),
+ 'orders' => array
+ (
+ array('lastname' => 'ASC'),
+ array('firstname' => 'ASC'),
+ ),
+ ),
+ ),
+ )
+),
\ No newline at end of file
Modified: branches/branch-2_6/src/org.openpsa.projects/config/schemadb_default_task_dm2.inc
==============================================================================
--- branches/branch-2_6/src/org.openpsa.projects/config/schemadb_default_task_dm2.inc (original)
+++ branches/branch-2_6/src/org.openpsa.projects/config/schemadb_default_task_dm2.inc Thu Jun 21 15:12:28 2007
@@ -265,4 +265,284 @@
'widget' => 'composite',
),
)
+),
+
+'export' => array
+(
+ 'description' => 'task',
+ 'fields' => array
+ (
+ 'title' => array
+ (
+ 'title' => 'title',
+ 'type' => 'text',
+ 'widget' => 'text',
+ 'storage' => 'title',
+ 'required' => true,
+ ),
+ 'up' => array
+ (
+ 'title' => 'parent',
+ 'storage' => 'up',
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'options' => org_openpsa_projects_task::get_tasks_names(),
+ ),
+ 'widget' => 'select',
+ ),
+ 'tags' => Array
+ (
+ 'title' => 'skills required',
+ 'storage' => null,
+ 'type' => 'tags',
+ 'widget' => 'text',
+ ),
+ 'start' => Array
+ (
+ 'title' => 'start time',
+ 'storage' => 'start',
+ 'type' => 'date',
+ 'type_config' => Array
+ (
+ 'storage_type' => 'UNIXTIME'
+ ),
+ 'widget' => 'jsdate',
+ 'widget_config' => Array
+ (
+ 'show_time' => false,
+ ),
+ ),
+ 'end' => Array
+ (
+ 'title' => 'deadline',
+ 'storage' => 'end',
+ 'type' => 'date',
+ 'type_config' => Array
+ (
+ 'storage_type' => 'UNIXTIME'
+ ),
+ 'widget' => 'jsdate',
+ 'widget_config' => Array
+ (
+ 'show_time' => false,
+ ),
+ ),
+ 'plannedHours' => array
+ (
+ 'title' => 'planned hours',
+ 'type' => 'number',
+ 'widget' => 'text',
+ 'storage' => 'plannedHours',
+ ),
+ 'minimum_slot' => Array
+ (
+ 'title' => 'minimum time slot needed for task bookings',
+ 'storage' => Array(
+ 'location' => 'configuration',
+ 'domain' => 'org.openpsa.projects.projectbroker',
+ 'name' => 'minimum_slot',
+ ),
+ 'type' => 'number',
+ 'widget' => 'text',
+ ),
+ 'resource_seek_type' => Array
+ (
+ 'title' => 'automatic resource search',
+ 'storage' => 'resource_seek_type',
+ 'type' => 'select',
+ 'type_config' => Array
+ (
+ 'options' => Array
+ (
+ 'none' => 'no search',
+ 'organization' => 'my organization',
+ 'openpsa' => 'whole openpsa',
+ 'dbe' => 'whole world (dbe)',
+ ),
+ ),
+ 'widget' => 'select',
+ ),
+ 'agreement' => array
+ (
+ 'title' => 'agreement',
+ 'storage' => 'agreement',
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'require_corresponding_option' => false,
+ 'options' => array(),
+ ),
+ 'widget' => 'universalchooser',
+ 'widget_config' => array
+ (
+ 'class' => 'org_openpsa_sales_salesproject_deliverable',
+ 'component' => 'org.openpsa.sales',
+ 'titlefield' => 'deliverable_html',
+ 'idfield' => 'id',
+ 'constraints' => array(),
+ 'searchfields' => array
+ (
+ 'title',
+ 'salesproject.title'
+ ),
+ 'orders' => array
+ (
+ array('title' => 'ASC'),
+ ),
+ ),
+ ),
+ 'description' => Array
+ (
+ 'title' => 'description',
+ 'storage' => 'description',
+ 'type' => 'text',
+ 'type_config' => array
+ (
+ 'output_mode' => 'markdown'
+ ),
+ 'widget' => 'textarea',
+ ),
+ 'manager' => array
+ (
+ 'title' => 'manager',
+ 'storage' => 'manager',
+ //'required' => true,
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'require_corresponding_option' => false,
+ 'options' => array(),
+ ),
+ 'widget' => 'universalchooser',
+ 'widget_config' => array
+ (
+ 'class' => 'org_openpsa_contacts_person',
+ 'component' => 'org.openpsa.contacts',
+ 'titlefield' => 'name',
+ 'idfield' => 'id',
+ 'constraints' => array
+ (
+ array
+ (
+ 'field' => 'username',
+ 'op' => '<>',
+ 'value' => '',
+ ),
+ ),
+ 'searchfields' => array
+ (
+ 'firstname',
+ 'lastname',
+ 'username',
+ ),
+ 'orders' => array
+ (
+ array('lastname' => 'ASC'),
+ array('firstname' => 'ASC'),
+
+ ),
+ ),
+ ),
+ 'resources' => array
+ (
+ 'title' => 'resources',
+ 'storage' => 'resources2',
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'require_corresponding_option' => false,
+ 'allow_multiple' => true,
+ 'multiple_storagemode' => 'array',
+ 'options' => array(),
+ ),
+ 'widget' => 'universalchooser',
+ 'widget_config' => array
+ (
+ 'class' => 'org_openpsa_contacts_person',
+ 'component' => 'org.openpsa.contacts',
+ 'titlefield' => 'name',
+ 'idfield' => 'id',
+ 'constraints' => array
+ (
+ array
+ (
+ 'field' => 'username',
+ 'op' => '<>',
+ 'value' => '',
+ ),
+ ),
+ 'searchfields' => array
+ (
+ 'firstname',
+ 'lastname',
+ 'username',
+ ),
+ 'orders' => array
+ (
+ array('lastname' => 'ASC'),
+ array('firstname' => 'ASC'),
+ ),
+ ),
+ ),
+ 'contacts' => array
+ (
+ 'title' => 'contacts',
+ 'storage' => 'contacts2',
+ 'type' => 'select',
+ 'type_config' => array
+ (
+ 'require_corresponding_option' => false,
+ 'allow_multiple' => true,
+ 'multiple_storagemode' => 'array',
+ 'options' => array(),
+ ),
+ 'widget' => 'universalchooser',
+ 'widget_config' => array
+ (
+ 'class' => 'org_openpsa_contacts_person',
+ 'component' => 'org.openpsa.contacts',
+ 'titlefield' => 'name',
+ 'idfield' => 'id',
+ 'constraints' => array(),
+ 'searchfields' => array
+ (
+ 'firstname',
+ 'lastname',
+ 'username',
+ ),
+ 'orders' => array
+ (
+ array('lastname' => 'ASC'),
+ array('firstname' => 'ASC'),
+ ),
+ ),
+ ),
+ 'hours' => Array
+ (
+ 'title' => 'hours',
+ 'storage' => null,
+ 'type' => 'composite',
+ 'type_config' => Array
+ (
+ 'child_class' => 'org_openpsa_projects_hour_report',
+ 'child_schemadb' => 'file:/org/openpsa/projects/config/schemadb_default_hours_dm2.inc',
+ 'child_foreign_key_fieldname' => 'task',
+ 'style_element_name' => 'hours',
+ 'area_element' => 'tr',
+ 'orders' => array
+ (
+ 'date' => 'ASC',
+ 'created' => 'ASC',
+ ),
+ 'defaults' => array
+ (
+ 'date' => time(),
+ 'person' => $_MIDGARD['user'],
+ ),
+ 'wide_mode' => true,
+ ),
+ 'widget' => 'composite',
+ ),
+ )
),
\ No newline at end of file
Modified: branches/branch-2_6/src/org.openpsa.projects/handler/frontpage.php
==============================================================================
--- branches/branch-2_6/src/org.openpsa.projects/handler/frontpage.php (original)
+++ branches/branch-2_6/src/org.openpsa.projects/handler/frontpage.php Thu Jun 21 15:12:28 2007
@@ -55,6 +55,38 @@
MIDCOM_TOOLBAR_ENABLED => $_MIDCOM->auth->can_user_do('midgard:create', null, 'org_openpsa_projects_task'),
)
);
+
+ $this->_view_toolbar->add_item
+ (
+ Array(
+ MIDCOM_TOOLBAR_URL => 'csv/hours/',
+ MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get("export all hourreports as csv"),
+ MIDCOM_TOOLBAR_HELPTEXT => null,
+ MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_data-edit-table.png',
+ MIDCOM_TOOLBAR_ENABLED => $_MIDCOM->auth->can_user_do('midgard:create', null, 'org_openpsa_projects_task'),
+ )
+ );
+ $this->_view_toolbar->add_item
+ (
+ Array(
+ MIDCOM_TOOLBAR_URL => 'csv/projects/',
+ MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get("export all projects as csv"),
+ MIDCOM_TOOLBAR_HELPTEXT => null,
+ MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_data-edit-table.png',
+ MIDCOM_TOOLBAR_ENABLED => $_MIDCOM->auth->can_user_do('midgard:create', null, 'org_openpsa_projects_task'),
+ )
+ );
+ $this->_view_toolbar->add_item
+ (
+ Array(
+ MIDCOM_TOOLBAR_URL => 'csv/tasks/',
+ MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get("export all tasks as csv"),
+ MIDCOM_TOOLBAR_HELPTEXT => null,
+ MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_data-edit-table.png',
+ MIDCOM_TOOLBAR_ENABLED => $_MIDCOM->auth->can_user_do('midgard:create', null, 'org_openpsa_projects_task'),
+ )
+ );
+
return true;
}
Added: branches/branch-2_6/src/org.openpsa.projects/handler/hours/csv.php
==============================================================================
--- (empty file)
+++ branches/branch-2_6/src/org.openpsa.projects/handler/hours/csv.php Thu Jun 21 15:12:28 2007
@@ -0,0 +1,64 @@
+<?php
+/**
+ * @package org.openpsa.projects
+ * @author The Midgard Project, http://www.midgard-project.org
+ * @version $Id: projects.php 3991 2006-09-07 11:28:16Z bergie $
+ * @copyright The Midgard Project, http://www.midgard-project.org
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
+ */
+require_once(MIDCOM_ROOT.'/midcom/baseclasses/components/handler/dataexport.php');
+/**
+ * @package org.openpsa.projects
+ */
+class org_openpsa_projects_handler_hours_csv extends midcom_baseclasses_components_handler_dataexport
+{
+ function org_openpsa_projects_handler_hours_csv()
+ {
+ parent::midcom_baseclasses_components_handler_dataexport();
+ }
+
+ function _load_schemadb()
+ {
+ $this->_schema = $this->_config->get('csv_export_schema_hours');
+ return $this->_request_data['schemadb_hours_dm2'];
+ }
+
+ function _load_data($handler_id, $args, &$data)
+ {
+ $qb = org_openpsa_projects_hour_report::new_query_builder();
+ if( $handler_id === 'hours_csv_task_filename'
+ || $handler_id === 'hours_csv_task')
+ {
+ $qb_task = midcom_org_openpsa_task::new_query_builder();
+ $qb_task->add_constraint('guid', '=', $args[0]);
+ $task = $qb_task->execute();
+ if(array_key_exists(0,$task))
+ {
+ $qb->add_constraint('task', '=', $task[0]->id);
+ }
+ }
+ elseif( $handler_id === 'hours_csv_project_filename'
+ || $handler_id === 'hours_csv_project')
+ {
+ $qb_project = midcom_org_openpsa_task::new_query_builder();
+ $qb_project->add_constraint('guid', '=', $args[0]);
+ $project = $qb_project->execute();
+ if(array_key_exists(0,$task))
+ {
+ $qb_tasks = midcom_org_openpsa_task::new_query_builder();
+ $qb_tasks->add_constraint('up', '=', $project->id);
+ $tasks = $qb_tasks->execute();
+
+ $qb->begin_group('OR');
+ foreach($tasks as $task)
+ {
+ $qb->add_constraint('task', '=', $task->id);
+ }
+ $qb->end_group();
+ }
+ }
+ $hours = $qb->execute();
+ return $hours;
+ }
+}
+?>
\ No newline at end of file
Added: branches/branch-2_6/src/org.openpsa.projects/handler/project/csv.php
==============================================================================
--- (empty file)
+++ branches/branch-2_6/src/org.openpsa.projects/handler/project/csv.php Thu Jun 21 15:12:28 2007
@@ -0,0 +1,35 @@
+<?php
+/**
+ * @package org.openpsa.projects
+ * @author The Midgard Project, http://www.midgard-project.org
+ * @version $Id: projects.php 3991 2006-09-07 11:28:16Z bergie $
+ * @copyright The Midgard Project, http://www.midgard-project.org
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
+ */
+require_once(MIDCOM_ROOT.'/midcom/baseclasses/components/handler/dataexport.php');
+/**
+ * @package org.openpsa.projects
+ */
+class org_openpsa_projects_handler_project_csv extends midcom_baseclasses_components_handler_dataexport
+{
+ function org_openpsa_projects_handler_projects_csv()
+ {
+ parent::midcom_baseclasses_components_handler_dataexport();
+ }
+
+ function _load_schemadb()
+ {
+ $this->_schema = $this->_config->get('csv_export_schema_projects');
+ return $this->_request_data['schemadb_project_dm2'];
+ }
+
+ function _load_data($handler_id, $args, &$data)
+ {
+ $qb = midcom_org_openpsa_task::new_query_builder();
+ $qb->add_constraint('orgOpenpsaObtype', '<>',ORG_OPENPSA_OBTYPE_TASK);
+ $hours = $qb->execute();
+
+ return $hours;
+ }
+}
+?>
\ No newline at end of file
Modified: branches/branch-2_6/src/org.openpsa.projects/handler/project/view.php
==============================================================================
--- branches/branch-2_6/src/org.openpsa.projects/handler/project/view.php (original)
+++ branches/branch-2_6/src/org.openpsa.projects/handler/project/view.php Thu Jun 21 15:12:28 2007
@@ -98,6 +98,16 @@
MIDCOM_TOOLBAR_ENABLED => true,
)
);
+
+ $this->_view_toolbar->add_item(
+ Array(
+ MIDCOM_TOOLBAR_URL => "csv/hours/project/{$this->_project->guid}",
+ MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get('export hourreports as csv'),
+ MIDCOM_TOOLBAR_HELPTEXT => null,
+ MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_data-edit-table.png',
+ MIDCOM_TOOLBAR_ENABLED => true,
+ )
+ );
}
// Project news and forum topic creation buttons
Added: branches/branch-2_6/src/org.openpsa.projects/handler/task/csv.php
==============================================================================
--- (empty file)
+++ branches/branch-2_6/src/org.openpsa.projects/handler/task/csv.php Thu Jun 21 15:12:28 2007
@@ -0,0 +1,35 @@
+<?php
+/**
+ * @package org.openpsa.projects
+ * @author The Midgard Project, http://www.midgard-project.org
+ * @version $Id: projects.php 3991 2006-09-07 11:28:16Z bergie $
+ * @copyright The Midgard Project, http://www.midgard-project.org
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
+ */
+require_once(MIDCOM_ROOT.'/midcom/baseclasses/components/handler/dataexport.php');
+/**
+ * @package org.openpsa.projects
+ */
+class org_openpsa_projects_handler_task_csv extends midcom_baseclasses_components_handler_dataexport
+{
+ function org_openpsa_projects_handler_tasks_csv()
+ {
+ parent::midcom_baseclasses_components_handler_dataexport();
+ }
+
+ function _load_schemadb()
+ {
+ $this->_schema = $this->_config->get('csv_export_schema_tasks');
+ return $this->_request_data['schemadb_task_dm2'];
+ }
+
+ function _load_data($handler_id, $args, &$data)
+ {
+ $qb = midcom_org_openpsa_task::new_query_builder();
+ $qb->add_constraint('orgOpenpsaObtype', '=',ORG_OPENPSA_OBTYPE_TASK);
+ $hours = $qb->execute();
+
+ return $hours;
+ }
+}
+?>
\ No newline at end of file
Modified: branches/branch-2_6/src/org.openpsa.projects/handler/task/view.php
==============================================================================
--- branches/branch-2_6/src/org.openpsa.projects/handler/task/view.php (original)
+++ branches/branch-2_6/src/org.openpsa.projects/handler/task/view.php Thu Jun 21 15:12:28 2007
@@ -126,6 +126,15 @@
MIDCOM_TOOLBAR_ENABLED => true,
)
);
+ $this->_view_toolbar->add_item(
+ Array(
+ MIDCOM_TOOLBAR_URL => "csv/hours/task/{$this->_request_data['task']->guid}",
+ MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get('export hourreports as csv'),
+ MIDCOM_TOOLBAR_HELPTEXT => null,
+ MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_data-edit-table.png',
+ MIDCOM_TOOLBAR_ENABLED => true,
+ )
+ );
}
else
{
Modified: branches/branch-2_6/src/org.openpsa.projects/locale/default.en.txt
==============================================================================
--- branches/branch-2_6/src/org.openpsa.projects/locale/default.en.txt (original)
+++ branches/branch-2_6/src/org.openpsa.projects/locale/default.en.txt Thu Jun 21 15:12:28 2007
@@ -407,3 +407,19 @@
You are project subscriber
---STRINGEND
+---STRING export all hourreports as csv
+Export all hourreports as csv
+---STRINGEND
+
+---STRING export all projects as csv
+Export all projects as csv
+---STRINGEND
+
+---STRING export all tasks as csv
+Export all tasks as csv
+---STRINGEND
+
+---STRING export hourreports as csv
+Export hourreports as csv
+---STRINGEND
+
Modified: branches/branch-2_6/src/org.openpsa.projects/locale/default.fi.txt
==============================================================================
--- branches/branch-2_6/src/org.openpsa.projects/locale/default.fi.txt (original)
+++ branches/branch-2_6/src/org.openpsa.projects/locale/default.fi.txt Thu Jun 21 15:12:28 2007
@@ -407,3 +407,19 @@
Aikatauluta resursseja
---STRINGEND
+---STRING export all hourreports as csv
+Tuo kaikki tuntiraportit csv-tiedostoon
+---STRINGEND
+
+---STRING export all projects as csv
+Tuo kaikki projektit csv-tiedostoon
+---STRINGEND
+
+---STRING export all tasks as csv
+Tuo kaikki tehtävät csv-tiedostoon
+---STRINGEND
+
+---STRING export hourreports as csv
+Tuo tuntiraportit csv-tiedostoon
+---STRINGEND
+
Modified: branches/branch-2_6/src/org.openpsa.projects/task_midcomdba.php
==============================================================================
--- branches/branch-2_6/src/org.openpsa.projects/task_midcomdba.php (original)
+++ branches/branch-2_6/src/org.openpsa.projects/task_midcomdba.php Thu Jun 21 15:12:28 2007
@@ -1320,22 +1320,83 @@
function get_task_resources()
{
- $resource_array = array();
+ static $cache = array();
+ $refresh_cache = false;
$view_data =& $_MIDCOM->get_custom_context_data('request_data');
- if (!array_key_exists('task', $view_data))
+ if (array_key_exists('task', $view_data))
+ {
+ if (!isset($cache[$view_data['task']->guid]))
+ {
+ $cache[$view_data['task']->guid] = array();
+ $refresh_cache = true;
+ }
+ $resource_array =& $cache[$view_data['task']->guid];
+ }
+ else
+ {
+ if (!isset($cache['ALL']))
+ {
+ $cache['ALL'] = array();
+ $refresh_cache = true;
+ }
+ $resource_array =& $cache['ALL'];
+ }
+
+ if (!$refresh_cache)
{
return $resource_array;
}
$qb = org_openpsa_projects_task_resource::new_query_builder();
- $qb->add_constraint('task', '=', $view_data['task']->id);
+ if(array_key_exists('task', $view_data))
+ {
+ $qb->add_constraint('task', '=', $view_data['task']->id);
+ }
$qb->add_constraint('orgOpenpsaObtype', '=', ORG_OPENPSA_OBTYPE_PROJECTRESOURCE);
$resources = $qb->execute();
+ unset($qb);
+ $seen_persons = array();
foreach ($resources as $resource)
{
+ if (isset($seen_persons[$resource->person]))
+ {
+ continue;
+ }
$person = new midcom_db_person($resource->person);
$resource_array[$person->id] = $person->rname;
+ $seen_persons[$resource->person] = true;
+ }
+ return $resource_array;
+ }
+
+ function get_tasks_names($key_field = 'id')
+ {
+ static $cache = array();
+ $refresh_cache = false;
+ $resource_array =& $cache;
+ if (empty($cache))
+ {
+ $refresh_cache = true;
}
+
+ if (!$refresh_cache)
+ {
+ return $resource_array;
+ }
+
+ $qb = midcom_org_openpsa_task::new_query_builder();
+ $tasks = $qb->execute();
+ unset($qb);
+ if ($tasks === false)
+ {
+ // CRITICAL qb error
+ return $resource_array;
+ }
+ foreach ($tasks as $task)
+ {
+ $resource_array[$task->$key_field] = $task->title;
+ }
+
return $resource_array;
}
Modified: branches/branch-2_6/src/org.openpsa.projects/viewer.php
==============================================================================
--- branches/branch-2_6/src/org.openpsa.projects/viewer.php (original)
+++ branches/branch-2_6/src/org.openpsa.projects/viewer.php Thu Jun 21 15:12:28 2007
@@ -254,6 +254,77 @@
$this->_request_switch[] = array(
'handler' => Array('org_openpsa_projects_handler_frontpage', 'frontpage'),
);
+
+ // Handle /csv/hours
+ $this->_request_switch['hours_csv'] = Array
+ (
+ 'handler' => Array('org_openpsa_projects_handler_hours_csv', 'csv'),
+ 'fixed_args' => Array('csv', 'hours'),
+ );
+
+ // Handle /csv/hours/<filename>
+ $this->_request_switch['hours_csv_filename'] = Array
+ (
+ 'handler' => Array('org_openpsa_projects_handler_hours_csv', 'csv'),
+ 'fixed_args' => Array('csv', 'hours'),
+ 'variable_args' => 1,
+ );
+ // Handle /csv/hours/task/<GUID>
+ $this->_request_switch['hours_csv_task'] = Array
+ (
+ 'handler' => Array('org_openpsa_projects_handler_hours_csv', 'csv'),
+ 'fixed_args' => Array('csv', 'hours', 'task'),
+ 'variable_args' => 1,
+ );
+ // Handle /csv/hours/task/<GUID>/<filename>
+ $this->_request_switch['hours_csv_task_filename'] = Array
+ (
+ 'handler' => Array('org_openpsa_projects_handler_hours_csv', 'csv'),
+ 'fixed_args' => Array('csv', 'hours', 'task'),
+ 'variable_args' => 2,
+ );
+ // Handle /csv/hours/project/<GUID>
+ $this->_request_switch['hours_csv_project'] = Array
+ (
+ 'handler' => Array('org_openpsa_projects_handler_hours_csv', 'csv'),
+ 'fixed_args' => Array('csv', 'hours', 'project'),
+ 'variable_args' => 1,
+ );
+ // Handle /csv/hours/project/<GUID>/<filename>
+ $this->_request_switch['hours_csv_project_filename'] = Array
+ (
+ 'handler' => Array('org_openpsa_projects_handler_hours_csv', 'csv'),
+ 'fixed_args' => Array('csv', 'hours', 'project'),
+ 'variable_args' => 2,
+ );
+ // Handle /csv/projects
+ $this->_request_switch['projects_csv'] = Array
+ (
+ 'handler' => Array('org_openpsa_projects_handler_project_csv', 'csv'),
+ 'fixed_args' => Array('csv', 'projects'),
+ );
+
+ // Handle /csv/projects/<filename>
+ $this->_request_switch['projects_csv_filename'] = Array
+ (
+ 'handler' => Array('org_openpsa_projects_handler_project_csv', 'csv'),
+ 'fixed_args' => Array('csv', 'projects'),
+ 'variable_args' => 1,
+ );
+ // Handle /csv/tasks
+ $this->_request_switch['tasks_csv'] = Array
+ (
+ 'handler' => Array('org_openpsa_projects_handler_task_csv', 'csv'),
+ 'fixed_args' => Array('csv', 'tasks'),
+ );
+
+ // Handle /csv/tasks/<filename>
+ $this->_request_switch['tasks_csv_filename'] = Array
+ (
+ 'handler' => Array('org_openpsa_projects_handler_task_csv', 'csv'),
+ 'fixed_args' => Array('csv', 'tasks'),
+ 'variable_args' => 1,
+ );
//Add common relatedto request switches
org_openpsa_relatedto_handler::common_request_switches($this->_request_switch, 'org.openpsa.projects');
@@ -297,6 +368,8 @@
// Load DM2 schemas
$this->_request_data['schemadb_task_dm2'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_task_dm2'));
+ $this->_request_data['schemadb_project_dm2'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_project_dm2'));
+ $this->_request_data['schemadb_hours_dm2'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_hours_dm2'));
$this->_request_data['datamanagers'] =& $this->_datamanagers;
}
More information about the midgard-commits
mailing list