fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10041] bugfix on activity list


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [10041] bugfix on activity list
Date: Thu, 27 Sep 2012 10:11:20 +0000

Revision: 10041
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10041
Author:   erikhl
Date:     2012-09-27 10:11:19 +0000 (Thu, 27 Sep 2012)
Log Message:
-----------
bugfix on activity list
added inline edit on admin->project type->project type name

Modified Paths:
--------------
    trunk/logistic/inc/class.soactivity.inc.php
    trunk/logistic/inc/class.uiactivity.inc.php
    trunk/logistic/inc/class.uiproject.inc.php
    trunk/logistic/inc/model/class.activity.inc.php
    trunk/logistic/setup/phpgw_no.lang

Modified: trunk/logistic/inc/class.soactivity.inc.php
===================================================================
--- trunk/logistic/inc/class.soactivity.inc.php 2012-09-27 09:49:30 UTC (rev 
10040)
+++ trunk/logistic/inc/class.soactivity.inc.php 2012-09-27 10:11:19 UTC (rev 
10041)
@@ -28,8 +28,8 @@
        */
        phpgw::import_class('logistic.socommon');
 
-       include_class('logistic', 'activity', 'inc/model/');
-       
+       include_class('logistic', 'activity', '/inc/model/');
+
        class logistic_soactivity extends logistic_socommon
        {
                protected static $so;
@@ -47,8 +47,8 @@
                        }
                        return self::$so;
                }
-               
-               protected function add(logistic_activity &$activity)
+
+               protected function add(&$activity)
                {
                        $cols = array(
                                'name',
@@ -60,7 +60,7 @@
                                'update_user',
                                'update_date'
                        );
-                       
+
                        $values = array(
                                $this->marshal($activity->get_name(), 'string'),
                                $this->marshal($activity->get_parent_id(), 
'int'),
@@ -71,7 +71,7 @@
                                $this->marshal($activity->get_update_user(), 
'int'),
                                $this->marshal(strtotime('now'), 'int')
                        );
-                       
+
                        $sql = 'INSERT INTO lg_activity (' . join(',', $cols) . 
') VALUES (' . join(',', $values) . ')';
                        $result = $this->db->query($sql, __LINE__,__FILE__);
 
@@ -84,13 +84,13 @@
                        {
                                return 0;
                        }
-                       
+
                }
-               
-               protected function update(logistic_activity $activity)
+
+               protected function update($activity)
                {
                        $id = intval($activity->get_id());
-                       
+
                        $values = array(
                                'name=' . $this->marshal($activity->get_name(), 
'string'),
                                'parent_id=' . 
$this->marshal($activity->get_parent_id(), 'int'),
@@ -101,7 +101,7 @@
                                'update_user=' . 
$this->marshal($activity->get_update_user(), 'int'),
                                'update_date=' . 
$this->marshal(strtotime('now'), 'int')
                        );
-                       
+
                        $result = $this->db->query('UPDATE lg_activity SET ' . 
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
 
                        return $result;
@@ -150,7 +150,7 @@
                        if(isset($filters[$this->get_id_field_name()]))
                        {
                                $filter_clauses[] = "activity.id = 
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
-                       }/*
+                       }
                        if(isset($filters['project']) && !$filters['project'] 
== '')
                        {
                                $filter_clauses[] = "activity.project_id = 
{$this->marshal($filters['project'], 'int')}";
@@ -159,7 +159,7 @@
                        {
                                $filter_clauses[] = 
"activity.responsible_user_id = {$this->marshal($filters['user'], 'int')}";
                        }
-*/
+
                        if(count($filter_clauses))
                        {
                                $clauses[] = join(' AND ', $filter_clauses);
@@ -192,7 +192,7 @@
                        if($activity == null)
                        {
                                $activity = new logistic_activity((int) 
$activity_id);
-                               
+
                                
$activity->set_name($this->unmarshal($this->db->f('name'), 'string'));
                                
$activity->set_parent_id($this->unmarshal($this->db->f('parent_id'), 'int'));
                                
$activity->set_project_id($this->unmarshal($this->db->f('project_id'), 'int'));
@@ -202,8 +202,7 @@
                                
$activity->set_update_date($this->unmarshal($this->db->f('update_date'), 
'int'));
                                
$activity->set_update_user($this->unmarshal($this->db->f('update_user'), 
'int'));
                        }
-               
+
                        return $activity;
                }
-       }
-?>
+       }
\ No newline at end of file

Modified: trunk/logistic/inc/class.uiactivity.inc.php
===================================================================
--- trunk/logistic/inc/class.uiactivity.inc.php 2012-09-27 09:49:30 UTC (rev 
10040)
+++ trunk/logistic/inc/class.uiactivity.inc.php 2012-09-27 10:11:19 UTC (rev 
10041)
@@ -1,82 +1,84 @@
 <?php
-/**
-       * phpGroupWare - logistic: a part of a Facilities Management System.
-       *
-       * @author Erik Holm-Larsen <address@hidden>
-       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * This file is part of phpGroupWare.
-       *
-       * phpGroupWare is free software; you can redistribute it and/or modify
-       * it under the terms of the GNU General Public License as published by
-       * the Free Software Foundation; either version 2 of the License, or
-       * (at your option) any later version.
-       *
-       * phpGroupWare is distributed in the hope that it will be useful,
-       * but WITHOUT ANY WARRANTY; without even the implied warranty of
-       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       * GNU General Public License for more details.
-       *
-       * You should have received a copy of the GNU General Public License
-       * along with phpGroupWare; if not, write to the Free Software
-       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
-       *
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
-       * @package property
-       * @subpackage logistic
-       * @version $Id:$
-       */      
 
+       /**
+        * phpGroupWare - logistic: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare is free software; you can redistribute it and/or modify
+        * it under the terms of the GNU General Public License as published by
+        * the Free Software Foundation; either version 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare is distributed in the hope that it will be useful,
+        * but WITHOUT ANY WARRANTY; without even the implied warranty of
+        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        * GNU General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+        * @package property
+        * @subpackage logistic
+        * @version $Id:$
+        */
        phpgw::import_class('phpgwapi.uicommon');
        phpgw::import_class('logistic.soactivity');
-       
+
        include_class('logistic', 'actvity');
-       
+
        class logistic_uiactivity extends phpgwapi_uicommon
        {
+
                private $so;
                private $so_project;
-               
                public $public_functions = array(
-                               'query' => true,
-                               'index' => true
+                       'query' => true,
+                       'index' => true
                );
-               
-               public function __construct() {
+
+               public function __construct()
+               {
                        parent::__construct();
-                       
+
                        $this->so = createObject('logistic.soactivity');
                        $this->so_project = createObject('logistic.soproject');
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"logistic::project::activity";
                }
-               
+
                public function index()
                {
-                       if(phpgw::get_var('phpgw_return_as') == 'json') {
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
                                return $this->query();
                        }
                        self::add_javascript('logistic', 'yahoo', 
'datatable.js');
                        phpgwapi_yui::load_widget('datatable');
                        phpgwapi_yui::load_widget('paginator');
-                       
+
                        $project_array = $this->so_project->get_projects();
                        $user_array = $this->get_user_array();
-                       
+
                        $data = array(
                                'form' => array(
                                        'toolbar' => array(
                                                'item' => array(
                                                        array('type' => 
'filter',
                                                                'name' => 
'project',
-                                                               'text' => 
lang('Project').':',
+                                                               'text' => 
lang('Project') . ':',
                                                                'list' => 
$project_array,
                                                        ),
                                                        array('type' => 
'filter',
                                                                'name' => 
'user',
-                                                               'text' => 
lang('Responsible user').':',
+                                                               'text' => 
lang('Responsible user') . ':',
                                                                'list' => 
$user_array,
                                                        ),
-                                                       array('type' => 'text', 
+                                                       array('type' => 'text',
                                                                'text' => 
lang('search'),
                                                                'name' => 
'query'
                                                        ),
@@ -100,33 +102,33 @@
                                                array(
                                                        'key' => 'name',
                                                        'label' => 
lang('Activity name'),
-                                                       'sortable'      => true
+                                                       'sortable' => true
                                                ),
                                                array(
                                                        'key' => 'id',
                                                        'label' => lang('ID'),
-                                                       'sortable'      => true,
+                                                       'sortable' => true,
                                                        'formatter' => 
'YAHOO.portico.formatLink'
                                                ),
                                                array(
                                                        'key' => 'project_name',
                                                        'label' => 
lang('Project'),
-                                                       'sortable'      => false
+                                                       'sortable' => false
                                                ),
                                                array(
                                                        'key' => 'start_date',
                                                        'label' => lang('Start 
date'),
-                                                       'sortable'      => false
+                                                       'sortable' => false
                                                ),
                                                array(
                                                        'key' => 'end_date',
                                                        'label' => lang('End 
date'),
-                                                       'sortable'      => false
+                                                       'sortable' => false
                                                ),
                                                array(
                                                        'key' => 
'responsible_user_id',
                                                        'label' => 
lang('Responsible user'),
-                                                       'sortable'      => false
+                                                       'sortable' => false
                                                ),
                                                array(
                                                        'key' => 'link',
@@ -136,35 +138,36 @@
                                ),
                        );
 
-                       self::render_template_xsl(array( 'activity_datatable', 
'datatable' ), $data);
+                       self::render_template_xsl(array('activity_datatable', 
'datatable'), $data);
                }
-               
+
                public function query()
                {
                        $params = array(
                                'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
                                'results' => phpgw::get_var('results', 'int', 
'REQUEST', null),
-                               'query' => phpgw::get_var('query'),
-                               'sort'  => phpgw::get_var('sort'),
-                               'dir'   => phpgw::get_var('dir'),
+                               'query' => phpgw::get_var('query'),
+                               'sort' => phpgw::get_var('sort'),
+                               'dir' => phpgw::get_var('dir'),
                                'filters' => $filters
                        );
 
-                       
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+                       if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
                        {
                                $user_rows_per_page = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
                        }
-                       else {
+                       else
+                       {
                                $user_rows_per_page = 10;
                        }
                        // YUI variables for paging and sorting
-                       $start_index    = phpgw::get_var('startIndex', 'int');
-                       $num_of_objects = phpgw::get_var('results', 'int', 
'GET', $user_rows_per_page);
-                       $sort_field             = phpgw::get_var('sort');
-                       $sort_ascending = phpgw::get_var('dir') == 'desc' ? 
false : true;
+                       $start_index = phpgw::get_var('startIndex', 'int');
+                       $num_of_objects = phpgw::get_var('results', 'int', 
'GET', $user_rows_per_page);
+                       $sort_field = phpgw::get_var('sort');
+                       $sort_ascending = phpgw::get_var('dir') == 'desc' ? 
false : true;
                        // Form variables
-                       $search_for     = phpgw::get_var('query');
-                       $search_type    = phpgw::get_var('search_option');
+                       $search_for = phpgw::get_var('query');
+                       $search_type = phpgw::get_var('search_option');
                        // Create an empty result set
                        $result_objects = array();
                        $result_count = 0;
@@ -172,17 +175,18 @@
                        //Retrieve a contract identifier and load corresponding 
contract
                        //$activity_id = phpgw::get_var('activity_id');
 
-                       $exp_param      = phpgw::get_var('export');
+                       $exp_param = phpgw::get_var('export');
                        $export = false;
-                       if(isset($exp_param)){
-                               $export=true;
+                       if (isset($exp_param))
+                       {
+                               $export = true;
                                $num_of_objects = null;
                        }
 
                        //Retrieve the type of query and perform type specific 
logic
                        $query_type = phpgw::get_var('type');
                        //var_dump($query_type);
-                       switch($query_type)
+                       switch ($query_type)
                        {
                                default: // ... all activities, filters (active 
and vacant)
                                        phpgwapi_cache::session_set('logistic', 
'activity_query', $search_for);
@@ -194,8 +198,9 @@
 
                        //Create an empty row set
                        $rows = array();
-                       foreach($result_objects as $result) {
-                               if(isset($result))
+                       foreach ($result_objects as $result)
+                       {
+                               if (isset($result))
                                {
                                        $rows[] = $result->serialize();
                                }
@@ -211,32 +216,33 @@
 
                        $editable = phpgw::get_var('editable') == 'true' ? true 
: false;
 
-                       if(!$export)
+                       if (!$export)
                        {
                                //Add action column to each row in result table
                                array_walk(
-                                       $result_data['results'],
-                                       array($this, '_add_links'),
-                                       "logistic.uiactivity.view");
+                                                               
$result_data['results'],
+                                                               array($this, 
'_add_links'),
+                                                               
"logistic.uiactivity.view"
+                               );
                        }
-                       
+
                        return $this->yui_results($result_data);
                }
-               
+
                private function get_user_array()
                {
                        $user_array = array();
                        $user_array[] = array(
-                                       'id' => '',
-                                       'name' => lang('all_types')
+                               'id' => '',
+                               'name' => lang('all_types')
                        );
                        $user_array[] = array(
-                                       'id' => 
$GLOBALS['phpgw_info']['user']['account_id'],
-                                       'name' => lang('my_activities'),
-                                       'selected' => 1
+                               'id' => 
$GLOBALS['phpgw_info']['user']['account_id'],
+                               'name' => lang('my_activities'),
+                               'selected' => 1
                        );
-                       
+
                        return $user_array;
                }
-       }
-?>
+
+       }
\ No newline at end of file

Modified: trunk/logistic/inc/class.uiproject.inc.php
===================================================================
--- trunk/logistic/inc/class.uiproject.inc.php  2012-09-27 09:49:30 UTC (rev 
10040)
+++ trunk/logistic/inc/class.uiproject.inc.php  2012-09-27 10:11:19 UTC (rev 
10041)
@@ -1,88 +1,90 @@
 <?php
 
        /**
-       * phpGroupWare - logistic: a part of a Facilities Management System.
-       *
-       * @author Erik Holm-Larsen <address@hidden>
-       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * This file is part of phpGroupWare.
-       *
-       * phpGroupWare is free software; you can redistribute it and/or modify
-       * it under the terms of the GNU General Public License as published by
-       * the Free Software Foundation; either version 2 of the License, or
-       * (at your option) any later version.
-       *
-       * phpGroupWare is distributed in the hope that it will be useful,
-       * but WITHOUT ANY WARRANTY; without even the implied warranty of
-       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       * GNU General Public License for more details.
-       *
-       * You should have received a copy of the GNU General Public License
-       * along with phpGroupWare; if not, write to the Free Software
-       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
-       *
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
-       * @package property
-       * @subpackage logistic
-       * @version $Id:$
-       */      
-
+        * phpGroupWare - logistic: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare is free software; you can redistribute it and/or modify
+        * it under the terms of the GNU General Public License as published by
+        * the Free Software Foundation; either version 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare is distributed in the hope that it will be useful,
+        * but WITHOUT ANY WARRANTY; without even the implied warranty of
+        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        * GNU General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+        * @package property
+        * @subpackage logistic
+        * @version $Id:$
+        */
        phpgw::import_class('phpgwapi.uicommon');
        phpgw::import_class('logistic.soproject');
-       
+
        include_class('logistic', 'project');
-       
+
        class logistic_uiproject extends phpgwapi_uicommon
        {
+
                private $so;
-               
                public $public_functions = array(
-                               'query' => true,
-                               'index' => true,
-                               'project_types' => true,
-                               'view' => true,
-                               'view_project_type' => true,
-                               'edit_project_type' => true,
-                               'add' => true,
-                               'edit' => true,
-                               'edit_something' =>true
+                       'query' => true,
+                       'index' => true,
+                       'project_types' => true,
+                       'view' => true,
+                       'view_project_type' => true,
+                       'edit_project_type' => true,
+                       'edit_project_type_name' => true,
+                       'add' => true,
+                       'edit' => true,
+                       'edit_something' => true
                );
-               
-               public function __construct() {
+
+               public function __construct()
+               {
                        parent::__construct();
-                       
-                       $this->so = CreateObject('logistic.soproject');         
        
 
+                       $this->so = CreateObject('logistic.soproject');
+
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"logistic::project";
                }
-               
+
                public function query()
                {
                        $params = array(
                                'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
                                'results' => phpgw::get_var('results', 'int', 
'REQUEST', null),
-                               'query' => phpgw::get_var('query'),
-                               'sort'  => phpgw::get_var('sort'),
-                               'dir'   => phpgw::get_var('dir'),
+                               'query' => phpgw::get_var('query'),
+                               'sort' => phpgw::get_var('sort'),
+                               'dir' => phpgw::get_var('dir'),
                                'filters' => $filters
                        );
 
-                       
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+                       if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
                        {
                                $user_rows_per_page = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
                        }
-                       else {
+                       else
+                       {
                                $user_rows_per_page = 10;
                        }
                        // YUI variables for paging and sorting
-                       $start_index    = phpgw::get_var('startIndex', 'int');
-                       $num_of_objects = phpgw::get_var('results', 'int', 
'GET', $user_rows_per_page);
-                       $sort_field             = phpgw::get_var('sort');
-                       $sort_ascending = phpgw::get_var('dir') == 'desc' ? 
false : true;
+                       $start_index = phpgw::get_var('startIndex', 'int');
+                       $num_of_objects = phpgw::get_var('results', 'int', 
'GET', $user_rows_per_page);
+                       $sort_field = phpgw::get_var('sort');
+                       $sort_ascending = phpgw::get_var('dir') == 'desc' ? 
false : true;
                        // Form variables
-                       $search_for     = phpgw::get_var('query');
-                       $search_type    = phpgw::get_var('search_option');
+                       $search_for = phpgw::get_var('query');
+                       $search_type = phpgw::get_var('search_option');
                        // Create an empty result set
                        $result_objects = array();
                        $result_count = 0;
@@ -90,21 +92,22 @@
                        //Retrieve a contract identifier and load corresponding 
contract
                        $project_id = phpgw::get_var('project_id');
 
-                       $exp_param      = phpgw::get_var('export');
+                       $exp_param = phpgw::get_var('export');
                        $export = false;
-                       if(isset($exp_param)){
-                               $export=true;
+                       if (isset($exp_param))
+                       {
+                               $export = true;
                                $num_of_objects = null;
                        }
 
                        //Retrieve the type of query and perform type specific 
logic
                        $query_type = phpgw::get_var('type');
                        //var_dump($query_type);
-                       switch($query_type)
+                       switch ($query_type)
                        {
-                               case 'project_type': 
+                               case 'project_type':
                                        phpgwapi_cache::session_set('logistic', 
'project_type_query', $search_for);
-                                       $search_type =  'project_type';
+                                       $search_type = 'project_type';
                                        $result_objects = 
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending, 
$search_for, $search_type, $filters);
                                        $object_count = 
$this->so->get_count($search_for, $search_type, $filters);
                                        break;
@@ -118,8 +121,9 @@
 
                        //Create an empty row set
                        $rows = array();
-                       foreach($result_objects as $result) {
-                               if(isset($result))
+                       foreach ($result_objects as $result)
+                       {
+                               if (isset($result))
                                {
                                        $rows[] = $result->serialize();
                                }
@@ -135,49 +139,46 @@
 
                        $editable = phpgw::get_var('editable') == 'true' ? true 
: false;
 
-                       if(!$export){
+                       if (!$export)
+                       {
                                //Add action column to each row in result table
-                               if($search_type && $search_type == 
'project_type')
+                               if ($search_type && $search_type == 
'project_type')
                                {
                                        array_walk(
-                                               $result_data['results'],
-                                               array($this, '_add_links'),
-                                               
"logistic.uiproject.view_project_type");
+                                                                       
$result_data['results'], array($this, '_add_links'), 
"logistic.uiproject.view_project_type");
                                }
                                else
                                {
                                        array_walk(
-                                               $result_data['results'],
-                                               array($this, '_add_links'),
-                                               "logistic.uiproject.view");
+                                                                       
$result_data['results'], array($this, '_add_links'), "logistic.uiproject.view");
                                }
-                               
                        }
                        return $this->yui_results($result_data);
                }
-               
+
                public function index()
                {
-                       if(phpgw::get_var('phpgw_return_as') == 'json') {
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
                                return $this->query();
                        }
 //                     self::add_javascript('logistic', 'yahoo', 
'datatable.js');
                        self::add_javascript('phpgwapi', 'yahoo', 
'datatable.js');
                        phpgwapi_yui::load_widget('datatable');
                        phpgwapi_yui::load_widget('paginator');
-                       
+
                        $project_type_array = $this->so->get_project_types();
-                       
+
                        $data = array(
                                'form' => array(
                                        'toolbar' => array(
                                                'item' => array(
                                                        array('type' => 
'filter',
                                                                'name' => 
'project_type',
-                                                               'text' => 
lang('Project_type').':',
+                                                               'text' => 
lang('Project_type') . ':',
                                                                'list' => 
$project_type_array,
                                                        ),
-                                                       array('type' => 'text', 
+                                                       array('type' => 'text',
                                                                'text' => 
lang('search'),
                                                                'name' => 
'query'
                                                        ),
@@ -202,24 +203,24 @@
                                                array(
                                                        'key' => 'name',
                                                        'label' => 
lang('Project name'),
-                                                       'sortable'      => true
+                                                       'sortable' => true
                                                ),
                                                array(
                                                        'key' => 'id',
                                                        'label' => lang('ID'),
-                                                       'sortable'      => true,
+                                                       'sortable' => true,
                                                        'formatter' => 
'YAHOO.portico.formatLink'
                                                ),
                                                array(
                                                        'key' => 'description',
                                                        'label' => 
lang('Project description'),
-                                                       'sortable'      => 
false,
+                                                       'sortable' => false,
                                                        'editor' => 'new 
YAHOO.widget.TextboxCellEditor({disableBtns:true})'
                                                ),
                                                array(
                                                        'key' => 
'project_type_label',
                                                        'label' => 
lang('Project type'),
-                                                       'sortable'      => false
+                                                       'sortable' => false
                                                ),
                                                array(
                                                        'key' => 'link',
@@ -229,9 +230,8 @@
                                ),
                        );
 
-                       self::render_template_xsl(array( 'project_datatable', 
'datatable' ), $data);
+                       self::render_template_xsl(array('project_datatable', 
'datatable'), $data);
                }
-               
 
                public function edit_something()
                {
@@ -241,19 +241,20 @@
                public function project_types()
                {
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"admin::logistic::project_types";
-                       if(phpgw::get_var('phpgw_return_as') == 'json') {
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
                                return $this->query();
                        }
-//                     self::add_javascript('logistic', 'yahoo', 
'datatable.js');
+
                        self::add_javascript('phpgwapi', 'yahoo', 
'datatable.js');
                        phpgwapi_yui::load_widget('datatable');
                        phpgwapi_yui::load_widget('paginator');
-                       
+
                        $project_type_id = phpgw::get_var('id');
                        $new_type = phpgw::get_var('new_type');
                        $edit_type = phpgw::get_var('edit_type');
-                       
-                       if($new_type || $edit_type)
+
+                       if ($new_type || $edit_type)
                        {
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uiproject.edit_project_type'));
                        }
@@ -264,7 +265,7 @@
                                        'form' => array(
                                                'toolbar' => array(
                                                        'item' => array(
-                                                               array('type' => 
'text', 
+                                                               array('type' => 
'text',
                                                                        'text' 
=> lang('search'),
                                                                        'name' 
=> 'query'
                                                                ),
@@ -284,17 +285,19 @@
                                        ),
                                        'datatable' => array(
                                                'source' => 
self::link(array('menuaction' => 'logistic.uiproject.project_types', 
'phpgw_return_as' => 'json', 'type' => 'project_type')),
+                                               'editor_action' => 
'logistic.uiproject.edit_project_type_name',
                                                'field' => array(
                                                        array(
                                                                'key' => 'id',
                                                                'label' => 
lang('ID'),
-                                                               'sortable'      
=> true,
+                                                               'sortable' => 
true,
                                                                'formatter' => 
'YAHOO.portico.formatLink'
                                                        ),
                                                        array(
                                                                'key' => 'name',
                                                                'label' => 
lang('Project type name'),
-                                                               'sortable'      
=> false
+                                                               'sortable' => 
false,
+                                                               'editor' => 
'new YAHOO.widget.TextboxCellEditor({disableBtns:true})'
                                                        ),
                                                        array(
                                                                'key' => 'link',
@@ -304,59 +307,59 @@
                                        ),
                                );
 
-                               self::render_template_xsl(array( 
'project_types_datatable', 'datatable' ), $data);
+                               
self::render_template_xsl(array('project_types_datatable', 'datatable'), $data);
                        }
                }
-               
+
                public function view()
                {
                        $project_id = phpgw::get_var('id');
-                       if(isset($_POST['edit_project']))
+                       if (isset($_POST['edit_project']))
                        {
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uiproject.edit', 'id' => $project_id));
                        }
                        else
                        {
-                               if($project_id && is_numeric($project_id))
+                               if ($project_id && is_numeric($project_id))
                                {
                                        $project = 
$this->so->get_single($project_id);
                                }
-                               
+
                                $project_array = $project->toArray();
-                               
-                               if($this->flash_msgs)
+
+                               if ($this->flash_msgs)
                                {
                                        $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
                                        $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
                                }
-                               
+
                                $data = array
-                               (
-                                       'value_id'                              
=> !empty($project) ? $project->get_id() : 0,
-                                       'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
-                                       'project'                               
=> $project_array,
-                                       'view'                                  
        => 'view_project'
+                                       (
+                                       'value_id' => !empty($project) ? 
$project->get_id() : 0,
+                                       'img_go_home' => 
'rental/templates/base/images/32x32/actions/go-home.png',
+                                       'project' => $project_array,
+                                       'view' => 'view_project'
                                );
 
                                $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('logistic') . '::' . lang('Project');
                                
self::render_template_xsl(array('project_item'), $data);
                        }
                }
-               
+
                public function view_project_type()
                {
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"admin::logistic::project_types";
                        $project_type_id = phpgw::get_var('id');
-                       if(isset($_POST['edit_project_type']))
+                       if (isset($_POST['edit_project_type']))
                        {
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uiproject.edit_project_type', 'id' => 
$project_type_id));
                        }
                        else
                        {
-                               if($project_type_id && 
is_numeric($project_type_id))
+                               if ($project_type_id && 
is_numeric($project_type_id))
                                {
-                                       $objects = $this->so->get(null, null, 
null, null, null,'project_type', array('id' => $project_type_id));
-                                       if(count($objects) > 0)
+                                       $objects = $this->so->get(null, null, 
null, null, null, 'project_type', array('id' => $project_type_id));
+                                       if (count($objects) > 0)
                                        {
                                                $keys = array_keys($objects);
                                                $project = $objects[$keys[0]];
@@ -364,27 +367,27 @@
                                }
 
                                $project_array = $project->toArray();
-                               
+
                                $data = array
-                               (
-                                       'value_id'                              
=> !empty($project) ? $project->get_id() : 0,
-                                       'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
-                                       'project'                               
        => $project_array
+                                       (
+                                       'value_id' => !empty($project) ? 
$project->get_id() : 0,
+                                       'img_go_home' => 
'rental/templates/base/images/32x32/actions/go-home.png',
+                                       'project' => $project_array
                                );
 
                                $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('logistic') . '::' . lang('Project type');
                                
self::render_template_xsl(array('project_type_item'), $data);
                        }
                }
-               
+
                public function edit_project_type()
                {
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"admin::logistic::project_types";
                        $project_type_id = phpgw::get_var('id');
-                       if($project_type_id && is_numeric($project_type_id))
+                       if ($project_type_id && is_numeric($project_type_id))
                        {
-                               $objects = $this->so->get(null, null, null, 
null, null,'project_type', array('id' => $project_type_id));
-                               if(count($objects) > 0)
+                               $objects = $this->so->get(null, null, null, 
null, null, 'project_type', array('id' => $project_type_id));
+                               if (count($objects) > 0)
                                {
                                        $keys = array_keys($objects);
                                        $project = $objects[$keys[0]];
@@ -394,10 +397,10 @@
                        {
                                $project = new logistic_project();
                        }
-                       if(isset($_POST['save_project_type']))
+                       if (isset($_POST['save_project_type']))
                        {
                                $project_type_name = phpgw::get_var('title');
-                               if(!$project_type_id || 
is_null($project_type_id))
+                               if (!$project_type_id || 
is_null($project_type_id))
                                {
                                        $project_type_id = 
$this->so->add_project_type($project_type_name);
                                }
@@ -407,7 +410,7 @@
                                }
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uiproject.view_project_type', 'id' => 
$project_type_id));
                        }
-                       else if(isset($_POST['cancel_project_type']))
+                       else if (isset($_POST['cancel_project_type']))
                        {
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uiproject.view_project_type', 'id' => 
$project_type_id));
                        }
@@ -416,27 +419,50 @@
                                $project_array = $project->toArray();
 
                                $data = array
-                               (
-                                       'value_id'                              
=> !empty($project) ? $project->get_id() : 0,
-                                       'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
-                                       'project'                               
        => $project_array,
-                                       'editable'                              
=> true
+                                       (
+                                       'value_id' => !empty($project) ? 
$project->get_id() : 0,
+                                       'img_go_home' => 
'rental/templates/base/images/32x32/actions/go-home.png',
+                                       'project' => $project_array,
+                                       'editable' => true
                                );
 
                                $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('logistic') . '::' . lang('Project type');
                                
self::render_template_xsl(array('project_type_item'), $data);
                        }
                }
-               
+
+               public function edit_project_type_name()
+               {
+                       $project_type_id = phpgw::get_var('id');
+                       if ($project_type_id && is_numeric($project_type_id))
+                       {
+                               $objects = $this->so->get(null, null, null, 
null, null, 'project_type', array('id' => $project_type_id));
+                               if (count($objects) > 0)
+                               {
+                                       $keys = array_keys($objects);
+                                       $project = $objects[$keys[0]];
+                               }
+                       }
+                       else
+                       {
+                               return "Ugyldig operasjon";
+                       }
+
+                       $project_type_name = phpgw::get_var('value');
+                       $this->so->update_project_type($project_type_id, 
$project_type_name);
+
+                       return lang('Project type name updated');
+               }
+
                public function add()
                {
                        $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uiproject.edit'));
                }
-               
+
                public function edit()
                {
                        $project_id = phpgw::get_var('id');
-                       if($project_id && is_numeric($project_id))
+                       if ($project_id && is_numeric($project_id))
                        {
                                $project = $this->so->get_single($project_id);
                        }
@@ -444,17 +470,17 @@
                        {
                                $project = new logistic_project();
                        }
-                       
-                       if(isset($_POST['save_project']))
+
+                       if (isset($_POST['save_project']))
                        {
                                $project->set_name(phpgw::get_var('name'));
                                
$project->set_project_type_id(phpgw::get_var('project_type_id'));
                                
$project->set_description(phpgw::get_var('description'));
-                               
+
                                $project_id = $this->so->store($project);
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uiproject.view', 'id' => $project_id));
                        }
-                       else if(isset ($_POST['cancel_project']))
+                       else if (isset($_POST['cancel_project']))
                        {
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uiproject.view', 'id' => $project_id));
                        }
@@ -463,7 +489,7 @@
                                $project_types = $this->so->get_project_types();
                                foreach ($project_types as &$p_type)
                                {
-                                       if($project->get_project_type_id() == 
$p_type['id'])
+                                       if ($project->get_project_type_id() == 
$p_type['id'])
                                        {
                                                $p_type['selected'] = 1;
                                        }
@@ -471,12 +497,12 @@
                                $project_array = $project->toArray();
 
                                $data = array
-                               (
-                                       'value_id'                              
=> !empty($project) ? $project->get_id() : 0,
-                                       'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
-                                       'project'                               
        => $project_array,
-                                       'options'                               
        => $project_types,
-                                       'editable'                              
=> true
+                                       (
+                                       'value_id' => !empty($project) ? 
$project->get_id() : 0,
+                                       'img_go_home' => 
'rental/templates/base/images/32x32/actions/go-home.png',
+                                       'project' => $project_array,
+                                       'options' => $project_types,
+                                       'editable' => true
                                );
 
                                $this->use_yui_editor('description');
@@ -484,4 +510,6 @@
                                
self::render_template_xsl(array('project_item'), $data);
                        }
                }
+
        }
+

Modified: trunk/logistic/inc/model/class.activity.inc.php
===================================================================
--- trunk/logistic/inc/model/class.activity.inc.php     2012-09-27 09:49:30 UTC 
(rev 10040)
+++ trunk/logistic/inc/model/class.activity.inc.php     2012-09-27 10:11:19 UTC 
(rev 10041)
@@ -27,8 +27,8 @@
        * @version $Id $
        */
 
-               include_class('logistic', 'model' , 'inc/model/');
-               
+               include_class('logistic', 'model', '/inc/model/');
+
                class logistic_activity extends logistic_model
                {
                                public static $so;
@@ -46,11 +46,12 @@
                                /**
                                * Constructor.  Takes an optional ID.  If a 
contract is created from outside
                                * the database the ID should be empty so the 
database can add one according to its logic.
-                               * 
+                               *
                                * @param int $id the id of this project
                                */
                                public function __construct(int $id = null)
                                {
+                                       echo "1";
                                        $this->id = (int)$id;
                                }
 
@@ -71,74 +72,74 @@
 
                                public function get_name()
                                {
-                                       return $this->title; 
+                                       return $this->title;
                                }
-                               
+
                                public function set_parent_id($parent_id)
                                {
                                        $this->parent_id = $parent_id;
                                }
-                               
+
                                public function get_parent_id()
                                {
                                        return $this->parent_id;
                                }
-                               
+
                                public function set_project_id($project_id)
                                {
                                        $this->project_id = $project_id;
                                }
-                               
+
                                public function get_project_id()
                                {
                                        return $this->project_id;
                                }
-                               
+
                                public function set_start_date($start_date)
                                {
                                        $this->start_date = $start_date;
                                }
-                               
+
                                public function get_start_date()
                                {
                                        return $this->start_date;
                                }
-                               
+
                                public function set_end_date($end_date)
                                {
                                        $this->end_date = $end_date;
                                }
-                               
+
                                public function get_end_date()
                                {
                                        return $this->end_date;
                                }
-                               
+
                                public function 
set_responsible_user_id($responsible_user_id)
                                {
                                        $this->responsible_user_id = 
$responsible_user_id;
                                }
-                               
+
                                public function get_responsible_user_id()
                                {
                                        return $this->responsible_user_id;
                                }
-                               
+
                                public function set_update_user($user_id)
                                {
                                        $this->update_user = $user_id;
                                }
-                               
+
                                public function get_update_user()
                                {
                                        return $this->update_user;
                                }
-                               
+
                                public function set_update_date($date)
                                {
                                        $this->update_date = $date;
                                }
-                               
+
                                public function get_update_date()
                                {
                                        return $this->update_date;
@@ -146,7 +147,7 @@
 
                                /**
                                * Get a static reference to the storage object 
associated with this model object
-                               * 
+                               *
                                * @return the storage object
                                */
                                public static function get_so()
@@ -171,4 +172,3 @@
                                        );
                                }
                }
-?>

Modified: trunk/logistic/setup/phpgw_no.lang
===================================================================
--- trunk/logistic/setup/phpgw_no.lang  2012-09-27 09:49:30 UTC (rev 10040)
+++ trunk/logistic/setup/phpgw_no.lang  2012-09-27 10:11:19 UTC (rev 10041)
@@ -23,4 +23,4 @@
 End date       logistic        no      Sluttdato
 Responsible user       logistic        no      Ansvarlig
 my_activities  logistic        no      Mine aktiviteter
-No records found       logistic        no      Ingen data
\ No newline at end of file
+Project type name updated logistic     no      Prosjekttypenavn oppdatert
\ No newline at end of file




reply via email to

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