[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] ged inc/class.ged_dm.inc.php inc/hook_admin.inc...
From: |
Pascal Vilarem |
Subject: |
[Phpgroupware-cvs] ged inc/class.ged_dm.inc.php inc/hook_admin.inc... |
Date: |
Thu, 02 Aug 2007 15:34:11 +0000 |
CVSROOT: /sources/phpgroupware
Module name: ged
Changes by: Pascal Vilarem <maat> 07/08/02 15:34:11
Modified files:
inc : class.ged_dm.inc.php hook_admin.inc.php
class.ged_ui.inc.php
setup : setup.inc.php
Added files:
inc : class.ged_admin.inc.php
templates/base : types.tpl places.tpl
Log message:
added: admin form to manage doc types
to come : admin form to define doc places for each project (future
"quick add" feature)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_dm.inc.php?cvsroot=phpgroupware&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/ged/inc/hook_admin.inc.php?cvsroot=phpgroupware&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_ui.inc.php?cvsroot=phpgroupware&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_admin.inc.php?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/types.tpl?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/places.tpl?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ged/setup/setup.inc.php?cvsroot=phpgroupware&r1=1.10&r2=1.11
Patches:
Index: inc/class.ged_dm.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_dm.inc.php,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- inc/class.ged_dm.inc.php 1 Aug 2007 17:28:49 -0000 1.39
+++ inc/class.ged_dm.inc.php 2 Aug 2007 15:34:10 -0000 1.40
@@ -2963,25 +2963,31 @@
}
// Type management
- function list_doc_types ()
+ function list_doc_types ($show_notype=true)
{
$i=0;
+
+ if ( $show_notype == true )
+ {
+
$list[$i]['type_id'] = "";
$list[$i]['type_desc'] = lang('No type');
+ $list[$i]['type_ref'] = "";
$list[$i]['type_chrono'] = 0;
+ $i++;
+ }
- $sql="SELECT * from ged_doc_types";
+ $sql="SELECT * from ged_doc_types order by type_desc asc";
$this -> db -> query($sql, __LINE__, __FILE__);
- $i=1;
while ($this -> db -> next_record())
{
$list[$i]['type_id'] = $this -> db -> f('type_id');
$list[$i]['type_desc'] = $this -> db -> f('type_desc');
+ $list[$i]['type_ref'] = $this -> db -> f('type_ref');
$list[$i]['type_chrono'] = $this -> db ->
f('type_chrono');
- if ( $list[$i]['type_chrono'] == 1 )
- $list[$i]['type_desc'] .= " [C]";
+
$i ++;
}
return $list;
@@ -3044,6 +3050,79 @@
return ($out );
}
+ function add_doc_types($doc_types)
+ {
+ foreach ( $doc_types as $old_type_id => $doc_type )
+ {
+ if ( isset($doc_type['type_chrono']) &&
$doc_type['type_chrono'] == "on" )
+ {
+ $chrono_flag=1;
+ }
+ else
+ {
+ $chrono_flag=0;
+ }
+
+ $sql="select * FROM ged_doc_types ";
+ $sql.="WHERE type_id='".$doc_type['type_id']."'";
+
+ $this -> db -> query($sql, __LINE__, __FILE__);
+
+ $nogo=($this->db->next_record());
+ $this->db->unlock();
+
+ $sql2="INSERT INTO ged_doc_types (type_id, type_desc,
type_ref, type_chrono) values ( '".$doc_type['type_id']."',
'".addslashes($doc_type['type_desc'])."', '".$doc_type['type_ref']."',
".$chrono_flag.") ";
+
+ $this -> db->query($sql2, __LINE__, __FILE__);
+ $this->db->unlock();
+ }
+ }
+
+ function update_doc_types($doc_types)
+ {
+ foreach ( $doc_types as $old_type_id => $doc_type )
+ {
+ if ( isset($doc_type['type_chrono']) &&
$doc_type['type_chrono'] == "on" )
+ {
+ $chrono_flag=1;
+ }
+ else
+ {
+ $chrono_flag=0;
+ }
+
+ $sql="UPDATE ged_doc_types set
type_id='".$doc_type['type_id']."',
type_desc='".addslashes($doc_type['type_desc'])."',
type_ref='".$doc_type['type_ref']."', type_chrono=".$chrono_flag." ";
+ $sql.="WHERE type_id='".$old_type_id."'";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+ $this->db->unlock();
+
+ $sql2="UPDATE ged_elements set
doc_type='".$doc_type['type_id']."' ";
+ $sql2.="WHERE doc_type='".$old_type_id."'";
+
+ $this->db-> query($sql2, __LINE__, __FILE__);
+ $this->db->unlock();
+ }
+ }
+
+ function delete_doc_types($doc_types)
+ {
+ foreach ( $doc_types as $old_type_id => $doc_type )
+ {
+ $sql="DELETE FROM ged_doc_types ";
+ $sql.="WHERE type_id='".$old_type_id."'";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+ $this->db->unlock();
+
+ $sql2="UPDATE ged_elements set doc_type='' ";
+ $sql2.="WHERE doc_type='".$old_type_id."'";
+
+ $this->db-> query($sql2, __LINE__, __FILE__);
+ $this->db->unlock();
+ }
+ }
+
function get_project_base_ref($project_root_id)
{
$db2 = clone($this->db);
Index: inc/hook_admin.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/hook_admin.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- inc/hook_admin.inc.php 9 Sep 2006 09:04:49 -0000 1.5
+++ inc/hook_admin.inc.php 2 Aug 2007 15:34:10 -0000 1.6
@@ -15,7 +15,8 @@
// Only Modify the $file and $title variables.....
$file = array
(
- 'Site Configuration' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'admin.uiconfig.index', 'appname' => 'ged') )
+ 'Types Configuration' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'ged.ged_admin.types', 'appname' => 'ged') ),
+ 'Places Configuration' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'ged.ged_admin.places', 'appname' => 'ged') )
);
//Do not modify below this line
$GLOBALS['phpgw']->common->display_mainscreen($appname,$file);
Index: inc/class.ged_ui.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_ui.inc.php,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- inc/class.ged_ui.inc.php 1 Aug 2007 17:28:49 -0000 1.43
+++ inc/class.ged_ui.inc.php 2 Aug 2007 15:34:10 -0000 1.44
@@ -1250,7 +1250,13 @@
$select_types_html="<select name=\"document_type\">\n";
foreach ($select_types as $select_type)
{
- $select_types_html.="<option
value=\"".$select_type['type_id']."\">".lang($select_type['type_desc'])."</option>\n";
+ $chrono_flag=$style="";
+ if ( $select_type['type_chrono']==1)
+ {
+ $chrono_flag=" [C]";
+ $style="style=\"font-weight: bold;\"";
+ }
+ $select_types_html.="<option ".$style."
value=\"".$select_type['type_id']."\">".lang($select_type['type_desc']).$chrono_flag."</option>\n";
}
$select_types_html.="</select>\n";
Index: setup/setup.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/setup.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- setup/setup.inc.php 1 Aug 2007 17:28:49 -0000 1.10
+++ setup/setup.inc.php 2 Aug 2007 15:34:11 -0000 1.11
@@ -32,7 +32,7 @@
/* The hooks this app includes, needed for hooks registration */
// $setup_info['ged']['hooks'][]='about';
-// $setup_info['ged']['hooks'][]='admin';
+ $setup_info['ged']['hooks'][]='admin';
// $setup_info['ged']['hooks'][]='manual';
$setup_info['ged']['hooks'][]='preferences';
$setup_info['ged']['hooks'][]='settings';
Index: inc/class.ged_admin.inc.php
===================================================================
RCS file: inc/class.ged_admin.inc.php
diff -N inc/class.ged_admin.inc.php
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ inc/class.ged_admin.inc.php 2 Aug 2007 15:34:10 -0000 1.1
@@ -0,0 +1,164 @@
+<?php
+
/**************************************************************************
+ * phpGroupWare - ged
+ * http://www.phpgroupware.org
+ * Written by Pascal Vilarem <address@hidden>
+ *
+ *
--------------------------------------------------------------------------
+ * This program is free software; you can redistribute it and/or modify
it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at
your
+ * option) any later version
+
***************************************************************************/
+
+class ged_admin
+{
+
+ var $public_functions=array(
+ 'types'=>true,
+ 'places'=>true
+ );
+
+ function ged_admin()
+ {
+ $this->ged_dm=CreateObject('ged.ged_dm', True);
+
+ /*
+ * Get sure that the user is a ged admin
+ * else eject the looser
+ */
+ if ( ! $this->ged_dm->admin )
+ {
+ $link_data=null;
+ $GLOBALS['phpgw']->redirect_link('/index.php',
$link_data);
+ }
+
+ $this->t = clone ($GLOBALS['phpgw']->template);
+ define('GED_TPL',
ExecMethod('phpgwapi.phpgw.common.get_tpl_dir', 'ged'));
+ $this->t->set_root(GED_TPL);
+
+ if(address@hidden($GLOBALS['phpgw']->css))
+ {
+ $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+ }
+ $GLOBALS['phpgw']->css->validate_file('default','ged');
+ }
+
+ function display_app_header()
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ }
+
+ function types()
+ {
+ $action=get_var('action',array('POST'));
+ $doc_types=get_var('doc_types',array('POST'));
+
+ if ( $action==lang("add"))
+ {
+ $this->ged_dm->add_doc_types($doc_types);
+ }
+ elseif ( $action==lang("update"))
+ {
+ $this->ged_dm->update_doc_types($doc_types);
+ }
+ elseif ( $action == lang("delete"))
+ {
+ $this->ged_dm->delete_doc_types($doc_types);
+ }
+
+ $this->t->set_file(array('types_tpl'=>'types.tpl'));
+
+ $doc_types=$this->ged_dm->list_doc_types(false);
+
+ $this->t->set_block('types_tpl', 'types_bloc',
'types_bloc_handler');
+ $this->t->set_var('types_bloc_handler', '');
+ $this->t->set_block('types_bloc', 'action_bloc',
'action_bloc_handler');
+ $this->t->set_var('action_bloc_handler', '');
+
+ $this->t->set_var('submit_field', "submit");
+ $this->t->set_var('submit_value', lang("submit"));
+
+ foreach ( $doc_types as $doc_type )
+ {
+ $this->t->set_var('type_id_field',
"doc_types[".$doc_type['type_id']."][type_id]");
+ $this->t->set_var('type_desc_field',
"doc_types[".$doc_type['type_id']."][type_desc]");
+ $this->t->set_var('type_ref_field',
"doc_types[".$doc_type['type_id']."][type_ref]");
+ $this->t->set_var('type_chrono_field',
"doc_types[".$doc_type['type_id']."][type_chrono]");
+ $this->t->set_var('type_delete_field',
"doc_types[".$doc_type['type_id']."][type_delete]");
+
+ $this->t->set_var('type_id_value',
$doc_type['type_id']);
+ $this->t->set_var('type_desc_value',
$doc_type['type_desc']);
+ $this->t->set_var('type_ref_value',
$doc_type['type_ref']);
+
+ if ( $doc_type['type_chrono'] == 1)
+ {
+ $this->t->set_var('type_chrono_checked',
'checked');
+ }
+ else
+ {
+ $this->t->set_var('type_chrono_checked', '');
+ }
+
+ /*
+ * actions update and delete
+ */
+ $this->t->set_var('action_bloc_handler', '');
+
+ $this->t->set_var('action_field', 'action');
+ $this->t->set_var('action_value', lang('update'));
+ $this->t->fp('action_bloc_handler', 'action_bloc',
True);
+
+ $this->t->set_var('action_field', 'action');
+ $this->t->set_var('action_value', lang('delete'));
+ $this->t->fp('action_bloc_handler', 'action_bloc',
True);
+
+
+ $this->t->fp('types_bloc_handler', 'types_bloc', True);
+ }
+
+ /*
+ * new line to allow admin to add a new doc type
+ */
+
+ $this->t->set_var('type_id_field', "doc_types[new][type_id]");
+ $this->t->set_var('type_desc_field',
"doc_types[new][type_desc]");
+ $this->t->set_var('type_ref_field', "doc_types[new][type_ref]");
+ $this->t->set_var('type_chrono_field',
"doc_types[new][type_chrono]");
+ $this->t->set_var('type_delete_field', "");
+
+ $this->t->set_var('type_id_value', "");
+ $this->t->set_var('type_desc_value', "");
+ $this->t->set_var('type_ref_value', "");
+ $this->t->set_var('type_chrono_checked', '');
+
+ /*
+ * action add
+ */
+
+ $this->t->set_var('action_bloc_handler', '');
+
+ $this->t->set_var('action_field', 'action');
+ $this->t->set_var('action_value', lang('add'));
+ $this->t->fp('action_bloc_handler', 'action_bloc', True);
+
+
+ $this->t->fp('types_bloc_handler', 'types_bloc', True);
+
+ $this->display_app_header();
+
+ $this->t->pfp('out', 'types_tpl');
+ }
+
+ function places()
+ {
+ $this->t->set_file(array('places_tpl'=>'places.tpl'));
+
+ $this->display_app_header();
+
+ $this->t->pfp('out', 'places_tpl');
+ }
+
+}
+
\ No newline at end of file
Index: templates/base/types.tpl
===================================================================
RCS file: templates/base/types.tpl
diff -N templates/base/types.tpl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ templates/base/types.tpl 2 Aug 2007 15:34:11 -0000 1.1
@@ -0,0 +1,25 @@
+<h1>Types</h1>
+<table >
+<tr class="head_class">
+<td colspan="2">id</td>
+<td>description</td>
+<td>ref</td>
+<td>chrono</td>
+<td colspan="2">actions</td>
+</tr>
+<!-- BEGIN types_bloc -->
+<tr class="{tr_class}">
+<td><form name="doc_types-{type_id_value}" method="POST"></td>
+<td><input type="text" name="{type_id_field}" value="{type_id_value}"/></td>
+<td><input size="50" type="text" name="{type_desc_field}"
value="{type_desc_value}"/></td>
+<td><input type="text" name="{type_ref_field}" value="{type_ref_value}"/></td>
+<td><input type="checkbox" name="{type_chrono_field}"
{type_chrono_checked}/></td>
+<td><!-- BEGIN action_bloc --><input type="submit" name ="{action_field}"
value="{action_value}"/><!-- END action_bloc --></td>
+<td></form></td>
+</tr>
+<!-- END types_bloc -->
+</table>
+<br/>
+
+
+<br/>
\ No newline at end of file
Index: templates/base/places.tpl
===================================================================
RCS file: templates/base/places.tpl
diff -N templates/base/places.tpl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ templates/base/places.tpl 2 Aug 2007 15:34:11 -0000 1.1
@@ -0,0 +1 @@
+<h1>Places</h1>
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] ged inc/class.ged_dm.inc.php inc/hook_admin.inc...,
Pascal Vilarem <=