[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] demo inc/class.bodemo.inc.php inc/class.menu.in...
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] demo inc/class.bodemo.inc.php inc/class.menu.in... |
Date: |
Thu, 23 Nov 2006 13:26:52 +0000 |
CVSROOT: /sources/phpgroupware
Module name: demo
Changes by: Sigurd Nes <sigurdne> 06/11/23 13:26:52
Modified files:
inc : class.bodemo.inc.php class.menu.inc.php
class.sodemo.inc.php class.uidemo.inc.php
templates/base : attributes_form.xsl demo.xsl
Log message:
Alternative list : Custom fields are listed when marked as "show in
list"
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/demo/inc/class.bodemo.inc.php?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/demo/inc/class.menu.inc.php?cvsroot=phpgroupware&r1=1.1.1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/demo/inc/class.sodemo.inc.php?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/demo/inc/class.uidemo.inc.php?cvsroot=phpgroupware&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/demo/templates/base/attributes_form.xsl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/demo/templates/base/demo.xsl?cvsroot=phpgroupware&r1=1.4&r2=1.5
Patches:
Index: inc/class.bodemo.inc.php
===================================================================
RCS file: /sources/phpgroupware/demo/inc/class.bodemo.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- inc/class.bodemo.inc.php 19 Nov 2006 20:48:24 -0000 1.4
+++ inc/class.bodemo.inc.php 23 Nov 2006 13:26:51 -0000 1.5
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package hrm
* @subpackage demo
- * @version $Id: class.bodemo.inc.php,v 1.4 2006/11/19 20:48:24 sigurdne
Exp $
+ * @version $Id: class.bodemo.inc.php,v 1.5 2006/11/23 13:26:51 sigurdne
Exp $
*/
/**
@@ -40,6 +40,7 @@
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->so =
CreateObject($this->currentapp.'.sodemo');
$this->custom =
createObject('phpgwapi.custom_fields');
+ $this->acl_location = '.demo_location';
if ($session)
{
@@ -144,16 +145,33 @@
return $demo_info;
}
+ /**
+ * Get list of records with dynamically allocated coulmns
+ *
+ * @return array Array with records.
+ */
+ function read2()
+ {
+ $custom_attributes =
$this->custom->get_attribs($this->currentapp, $this->acl_location, 0, '',
'ASC', 'attrib_sort', true, true);
+
+ $demo_info = $this->so->read2(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'cat_id'=>$this->cat_id,'allrows'=>$this->allrows,'filter'=>$this->filter,
+
'custom_attributes'=>$custom_attributes));
+ $this->total_records = $this->so->total_records;
+ $this->uicols = $this->so->uicols;
+ return $demo_info;
+ }
+
function read_single($id='')
{
- $values['attributes'] =
$this->custom->get_attribs('demo', '.demo_location', 0, '', 'ASC',
'attrib_sort', true, true);
+ $values['attributes'] =
$this->custom->get_attribs($this->currentapp, $this->acl_location, 0, '',
'ASC', 'attrib_sort', true, true);
if($id)
{
$values = $this->so->read_single($id,$values);
}
- $values =
$this->custom->prepare_attributes($values,$appname='demo',
$location='.demo_location');
+ $values =
$this->custom->prepare_attributes($values,$appname=$this->currentapp,
$location=$this->acl_location);
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
if(isset($values['entry_date']) &&
$values['entry_date'])
@@ -201,7 +219,7 @@
$receipt =
$this->so->add($values,$values_attribute);
}
- $custom_functions =
$this->custom->read_custom_function(array('appname'=>'demo','location' =>
'.demo_location','allrows'=>True));
+ $custom_functions =
$this->custom->read_custom_function(array('appname'=>$this->currentapp,'location'
=> $this->acl_location,'allrows'=>True));
if (isSet($custom_functions) AND
is_array($custom_functions))
{
Index: inc/class.menu.inc.php
===================================================================
RCS file: /sources/phpgroupware/demo/inc/class.menu.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -b -r1.1.1.1 -r1.2
--- inc/class.menu.inc.php 10 Nov 2006 15:05:23 -0000 1.1.1.1
+++ inc/class.menu.inc.php 23 Nov 2006 13:26:51 -0000 1.2
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package hrm
* @subpackage core
- * @version $Id: class.menu.inc.php,v 1.1.1.1 2006/11/10 15:05:23
sigurdne Exp $
+ * @version $Id: class.menu.inc.php,v 1.2 2006/11/23 13:26:51 sigurdne
Exp $
*/
/**
@@ -55,6 +55,15 @@
$menu['module'][$i]['statustext'] = 'WML';
$i++;
+ if($sub=='alternative')
+ {
+ $menu['module'][$i]['this']=True;
+ }
+ $menu['module'][$i]['url'] =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
$currentapp.'.uidemo.index2','output'=>'html'));
+ $menu['module'][$i]['text'] =
'Alternative';
+ $menu['module'][$i]['statustext'] = 'Alternative
list';
+ $i++;
+
$GLOBALS['phpgw']->session->appsession('menu_demo','sidebox',$menu);
return $menu;
}
Index: inc/class.sodemo.inc.php
===================================================================
RCS file: /sources/phpgroupware/demo/inc/class.sodemo.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- inc/class.sodemo.inc.php 19 Nov 2006 20:48:24 -0000 1.4
+++ inc/class.sodemo.inc.php 23 Nov 2006 13:26:51 -0000 1.5
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package hrm
* @subpackage demo
- * @version $Id: class.sodemo.inc.php,v 1.4 2006/11/19 20:48:24 sigurdne
Exp $
+ * @version $Id: class.sodemo.inc.php,v 1.5 2006/11/23 13:26:51 sigurdne
Exp $
*/
/**
@@ -27,14 +27,15 @@
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->db =&
$GLOBALS['phpgw']->db;
+ $this->db =
clone($GLOBALS['phpgw']->db);
$this->db2 =
clone($this->db);
$this->like =& $this->db->like;
$this->join =& $this->db->join;
$this->left_join =& $this->db->left_join;
+ $this->acl_location = '.demo_location';
- $this->grants =
$GLOBALS['phpgw']->acl->get_grants('demo','.demo_location');
+ $this->grants =
$GLOBALS['phpgw']->acl->get_grants($this->currentapp,$this->acl_location);
}
function read($data)
@@ -137,6 +138,244 @@
return $demo_info;
}
+ function read2($data)
+ {
+ if(is_array($data))
+ {
+ if ($data['start'])
+ {
+ $start=$data['start'];
+ }
+ else
+ {
+ $start=0;
+ }
+ $query =
(isset($data['query'])?$data['query']:'');
+ $sort =
(isset($data['sort'])?$data['sort']:'DESC');
+ $order =
(isset($data['order'])?$data['order']:'');
+ $allrows =
(isset($data['allrows'])?$data['allrows']:'');
+ $cat_id =
(isset($data['cat_id'])?$data['cat_id']:0);
+ $filter =
(isset($data['filter'])?$data['filter']:'');
+ $custom_attributes =
(isset($data['custom_attributes'])?$data['custom_attributes']:'');
+ }
+
+ $contacts =
CreateObject('phpgwapi.contacts');
+
+ $table = 'phpgw_demo_table';
+ $where= 'WHERE';
+ $filtermethod = '';
+
+ if (!$filter)
+ {
+ if (is_array($this->grants))
+ {
+ while (list($user) =
each($this->grants))
+ {
+ $public_user_list[] = $user;
+ }
+ reset($public_user_list);
+ $filtermethod .= " $where (
$table.user_id IN(" . implode(',',$public_user_list) . "))";
+ }
+ }
+ elseif ($filter == 'yours')
+ {
+ $filtermethod = "$where user_id='" .
$this->account . "'";
+ }
+ elseif ($filter == 'private')
+ {
+ $filtermethod = "$where user_id='" .
$this->account . "' AND access='private'";
+ }
+
+ $where= 'AND';
+
+ if ($cat_id > 0)
+ {
+ $filtermethod .= " $where category='$cat_id' ";
+ $where= 'AND';
+ }
+
+ if ($order)
+ {
+ $ordermethod = " order by $order $sort";
+ }
+ else
+ {
+ $ordermethod = ' order by name asc';
+ }
+
+ $querymethod = '';
+ if($query)
+ {
+ $query = ereg_replace("'",'',$query);
+ $query = ereg_replace('"','',$query);
+
+ $querymethod = " $where name $this->like
'%$query%'";
+ }
+
+
+ $cols = $table . '.*';
+
+ $cols_return[] = 'id';
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] = 'id';
+ $uicols['descr'][] = 'ID';
+ $uicols['statustext'][] = 'Demo ID';
+ $uicols['datatype'][] = 'I';
+
+ $cols_return[] = 'entry_date';
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] = 'entry_date';
+ $uicols['descr'][] = lang('Time created');
+ $uicols['statustext'][] = lang('Time created');
+ $uicols['datatype'][] = 'timestamp';
+ $cols_return_extra[]= array
+ (
+ 'name'
=> 'entry_date',
+
'datatype' => 'timestamp'
+ );
+
+ $cols_return[] = 'user_id';
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] = 'user_id';
+ $uicols['descr'][] = lang('Owner');
+ $uicols['statustext'][] = lang('Owner of this record');
+ $uicols['datatype'][] = 'user_id';
+ $cols_return_extra[]= array
+ (
+ 'name'
=> 'user_id',
+
'datatype' => 'user_id'
+ );
+
+
+ $i = count($uicols['name']);
+ if(isset($custom_attributes) &&
is_array($custom_attributes))
+ {
+ foreach($custom_attributes as
$column_info)
+ {
+ if($column_info['list'])
+ {
+
if($column_info['datatype'] == 'link')
+ {
+
$uicols['input_type'][] = 'link';
+ }
+ else
+ {
+
$uicols['input_type'][] = 'text';
+ }
+ $cols_return[]
= $column_info['column_name'];
+ $uicols['name'][]
= $column_info['column_name'];
+ $uicols['descr'][]
= $column_info['input_text'];
+ $uicols['statustext'][]
= $column_info['statustext'];
+ $uicols['datatype'][$i]
= $column_info['datatype'];
+ $cols_return_extra[]=
array(
+ 'name' =>
$column_info['column_name'],
+ 'datatype'
=> $column_info['datatype'],
+ 'attrib_id'
=> $column_info['id']
+ );
+ $i++;
+ }
+ }
+ }
+
+ $this->uicols = $uicols;
+
+
+ $sql = "SELECT * FROM $table $filtermethod
$querymethod";
+
+ $this->db2->query($sql,__LINE__,__FILE__);
+ $this->total_records = $this->db2->num_rows();
+
+ if(!$allrows)
+ {
+ $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
+ }
+ else
+ {
+ $this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
+ }
+
+ $demo_info = '';
+
+ $j=0;
+ $n=count($cols_return);
+
+ while ($this->db->next_record())
+ {
+ for ($i=0;$i<$n;$i++)
+ {
+ $demo_info[$j][$cols_return[$i]] =
$this->db->f($cols_return[$i]);
+ $demo_info[$j]['grants'] =
(int)$this->grants[$this->db->f('user_id')];
+ }
+
+ for ($i=0;$i<count($cols_return_extra);$i++)
+ {
+ $value='';
+
$value=$this->db->f($cols_return_extra[$i]['name']);
+
+
if(($cols_return_extra[$i]['datatype']=='R' ||
$cols_return_extra[$i]['datatype']=='LB') && $value):
+ {
+ $sql="SELECT value FROM
phpgw_cust_choice WHERE appname= '{$this->currentapp}' AND location=
'{$this->acl_location}' AND attrib_id=" .$cols_return_extra[$i]['attrib_id']. "
AND id=" . $value;
+ $this->db2->query($sql);
+ $this->db2->next_record();
+
$demo_info[$j][$cols_return_extra[$i]['name']] = $this->db2->f('value');
+ }
+
elseif($cols_return_extra[$i]['datatype']=='AB' && $value):
+ {
+ $contact_data =
$contacts->read_single_entry($value,array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
+
$demo_info[$j][$cols_return_extra[$i]['name']] = $contact_data[0]['n_family']
. ', ' . $contact_data[0]['n_given'];
+ }
+
elseif($cols_return_extra[$i]['datatype']=='VENDOR' && $value):
+ {
+ $sql="SELECT org_name FROM
fm_vendor where id=$value";
+ $this->db2->query($sql);
+ $this->db2->next_record();
+
$demo_info[$j][$cols_return_extra[$i]['name']] = $this->db2->f('org_name');
+ }
+
elseif($cols_return_extra[$i]['datatype']=='CH' && $value):
+ {
+ $ch= unserialize($value);
+
+ if (isset($ch) AND
is_array($ch))
+ {
+ for
($k=0;$k<count($ch);$k++)
+ {
+ $sql="SELECT
value FROM phpgw_cust_choice WHERE appname= '{$this->currentapp}' AND location=
'{$this->acl_location}' AND attrib_id=" .$cols_return_extra[$i]['attrib_id']. "
AND id=" . $ch[$k];
+
$this->db2->query($sql);
+ while
($this->db2->next_record())
+ {
+
$ch_value[]=$this->db2->f('value');
+ }
+ }
+
$demo_info[$j][$cols_return_extra[$i]['name']] = @implode(",", $ch_value);
+ unset($ch_value);
+ }
+ }
+
elseif($cols_return_extra[$i]['datatype']=='D' && $value):
+ {
+
$demo_info[$j][$cols_return_extra[$i]['name']]=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($value));
+ }
+
elseif($cols_return_extra[$i]['datatype']=='timestamp' && $value):
+ {
+
$demo_info[$j][$cols_return_extra[$i]['name']]=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$value);
+ }
+
elseif($cols_return_extra[$i]['datatype']=='user_id' && $value):
+ {
+
$demo_info[$j][$cols_return_extra[$i]['name']]=
$GLOBALS['phpgw']->accounts->id2name($value);
+ }
+ else:
+ {
+
$demo_info[$j][$cols_return_extra[$i]['name']]=$value;
+ }
+ endif;
+ }
+
+ $j++;
+ }
+//_debug_array($demo_info);
+ return $demo_info;
+ }
+
+
function read_single($id,$values='')
{
$sql = 'SELECT * FROM phpgw_demo_table where id=' .
intval($id);
Index: inc/class.uidemo.inc.php
===================================================================
RCS file: /sources/phpgroupware/demo/inc/class.uidemo.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- inc/class.uidemo.inc.php 20 Nov 2006 11:38:38 -0000 1.5
+++ inc/class.uidemo.inc.php 23 Nov 2006 13:26:51 -0000 1.6
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package hrm
* @subpackage demo
- * @version $Id: class.uidemo.inc.php,v 1.5 2006/11/20 11:38:38 sigurdne
Exp $
+ * @version $Id: class.uidemo.inc.php,v 1.6 2006/11/23 13:26:51 sigurdne
Exp $
*/
/**
@@ -29,6 +29,7 @@
var $public_functions = array
(
'index' => True,
+ 'index2' => True,
'view' => True,
'edit' => True,
'delete' => True,
@@ -46,6 +47,11 @@
$this->menu =
CreateObject($this->currentapp.'.menu');
$this->menu->sub ='demo';
$this->acl = &
$GLOBALS['phpgw']->acl;
+ $this->acl_location = '.demo_location';
+ $this->acl_read =
$this->acl->check($this->acl_location,PHPGW_ACL_READ);
+ $this->acl_add =
$this->acl->check($this->acl_location,PHPGW_ACL_ADD);
+ $this->acl_edit =
$this->acl->check($this->acl_location,PHPGW_ACL_EDIT);
+ $this->acl_delete =
$this->acl->check($this->acl_location,PHPGW_ACL_DELETE);
$this->start = $this->bo->start;
$this->query = $this->bo->query;
@@ -79,7 +85,8 @@
$this->menu->sub = $output;
$links = $this->menu->links();
- if(!$this->acl->check('.demo_location', PHPGW_ACL_READ))
+
+ if(!$this->acl_read)
{
$this->no_access($links);
return;
@@ -149,8 +156,6 @@
//_debug_array($content);
- $acl_edit = $this->acl->check('.demo_location',
PHPGW_ACL_EDIT);
- $acl_delete = $this->acl->check('.demo_location',
PHPGW_ACL_DELETE);
$table_header[] = array
(
'sort_name' =>
$this->nextmatchs->show_sort_order(array
@@ -167,8 +172,8 @@
)),
'lang_name' => lang('name'),
'lang_view' => lang('view'),
- 'lang_edit' =>
(isset($acl_edit)?lang('edit'):''),
- 'lang_delete' =>
(isset($acl_delete)?lang('view'):''),
+ 'lang_edit' =>
(isset($this->acl_edit)?lang('edit'):''),
+ 'lang_delete' =>
(isset($this->acl_delete)?lang('view'):''),
);
if(!$this->allrows)
@@ -235,11 +240,197 @@
$this->save_sessiondata();
}
+ function index2()
+ {
+ $output = get_var('output',array('POST','GET'));
+
+ if(!$output)
+ {
+ $output = 'html';
+ }
+
+ $this->menu->sub = 'alternative';
+ $links = $this->menu->links();
+ if(!$this->acl_read)
+ {
+ $this->no_access($links);
+ return;
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('demo','nextmatchs','menu',
+
'search_field'));
+
+ $demo_info = $this->bo->read2();
+
+ $uicols = $this->bo->uicols;
+//_debug_array($uicols);
+ $j=0;
+
+ if (isset($demo_info) AND is_array($demo_info))
+ {
+ foreach($demo_info as $entry)
+ {
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
$content[$j]['row'][$i]['value'] = $entry[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
+
if($uicols['input_type'][$i]=='link')
+ {
+
$content[$j]['row'][$i]['text'] = lang('link');
+
$content[$j]['row'][$i]['link'] = $entry[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['target'] = '_blank';
+ }
+ }
+ }
+
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('view the
record');
+ $content[$j]['row'][$i]['text']
= lang('view');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
$this->currentapp.'.uidemo.view','demo_id'=> $entry['id']));
+ }
+ if($this->acl_edit)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('edit the
record');
+ $content[$j]['row'][$i]['text']
= lang('edit');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
$this->currentapp.'.uidemo.edit', 'demo_id'=> $entry['id']));
+ }
+ if($this->acl_delete)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('delete the
record');
+ $content[$j]['row'][$i]['text']
= lang('delete');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
$this->currentapp.'.uidemo.delete', 'demo_id'=> $entry['id']));
+ }
+
+ $j++;
+ }
+ }
+
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header']
= $uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['datatype'][$i]!='T' &&
$uicols['datatype'][$i]!='CH')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+ (
+ 'sort' =>
$this->sort,
+ 'var' =>
$uicols['name'][$i],
+ 'order' =>
$this->order,
+ 'extra' =>
array('menuaction' => $this->currentapp.'.uidemo.index2',
+
'query' => $this->query,
+
'cat_id' => $this->cat_id,
+
'filter' => $this->filter,
+
'output' =>$output,
+
'allrows' => $this->allrows
+
)
+ ));
+ }
+ }
+ }
+
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+
+
+ if($this->acl_add)
+ {
+ $table_add[] = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
demo'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
$this->currentapp.'.uidemo.edit','output'=>$output)),
+ );
+ }
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uidemo.index2',
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'cat_id' => $this->cat_id,
+ 'filter' => $this->filter,
+ 'query' => $this->query,
+ 'output' => $output
+ );
+
+ $msgbox_data =
(isset($receipt)?$GLOBALS['phpgw']->common->msgbox_data($receipt):'');
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links'
=> $links,
+ 'cat_filter'
=> $this->cats->formatted_xslt_list(array('select_name' =>
'cat_id','selected' => $this->cat_id,'globals' => True,'link_data' =>
$link_data)),
+ 'filter_data'
=> $this->nextmatchs->xslt_filter(array('filter' =>
$this->filter,'link_data' => $link_data)),
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> ($demo_info?count($demo_info):0),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=>
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_statustext'
=> lang('Enter the search string. To show all entries, empty this field and
press the SUBMIT button again'),
+ 'lang_searchbutton_statustext'
=> lang('Submit the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'table_add'
=> $table_add,
+ 'values'
=> (isset($content)?$content:'')
+ );
+
+//_debug_array($data);
+ $function_msg= lang('list demo values');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp). ': ' . $function_msg;
+
+ if($output == 'wml')
+ {
+ $GLOBALS['phpgw']->xslttpl->wml_out = true;
+ }
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array("list2_{$output}" => $data));
+ $this->save_sessiondata();
+ }
+
function edit()
{
$acl_location = '.demo_location';
- if(!$this->acl->check($acl_location, PHPGW_ACL_ADD))
+ if(!$this->acl_add)
{
$this->no_access();
return;
@@ -270,7 +461,7 @@
if (isset($values) && is_array($values))
{
- if(!$this->acl->check($acl_location,
PHPGW_ACL_EDIT))
+ if(!$this->acl_edit)
{
$this->no_access($links);
return;
@@ -289,8 +480,7 @@
if ((isset($values['save']) && $values['save'])
|| (isset($values['apply']) && $values['apply']))
{
-
- if(!$values['cat_id'])
+ if(!$values['cat_id'] ||
$values['cat_id'] == 'none')
{
$receipt['error'][]=array('msg'=>lang('Please select a category!'));
}
@@ -421,7 +611,7 @@
function view()
{
- if(!$this->acl->check('.demo_location', PHPGW_ACL_READ))
+ if(!$this->acl_delete)
{
$this->no_access();
return;
@@ -489,7 +679,7 @@
function delete()
{
- if(!$this->acl->check('.demo_location',
PHPGW_ACL_DELETE))
+ if(!$this->acl_delete)
{
$this->no_access();
return;
@@ -542,7 +732,6 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
}
-
function no_access($links = '')
{
$GLOBALS['phpgw']->xslttpl->add_file(array('no_access','menu'));
Index: templates/base/attributes_form.xsl
===================================================================
RCS file: /sources/phpgroupware/demo/templates/base/attributes_form.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/attributes_form.xsl 19 Nov 2006 19:02:36 -0000 1.1
+++ templates/base/attributes_form.xsl 23 Nov 2006 13:26:51 -0000 1.2
@@ -1,4 +1,4 @@
-<!-- $Id: attributes_form.xsl,v 1.1 2006/11/19 19:02:36 sigurdne Exp $ -->
+<!-- $Id: attributes_form.xsl,v 1.2 2006/11/23 13:26:51 sigurdne Exp $ -->
<xsl:template name="attributes_form">
<xsl:apply-templates select="attributes_values"/>
@@ -25,7 +25,7 @@
<xsl:value-of select="input_text"/>
<xsl:choose>
<xsl:when test="helpmsg=1">
- <xsl:variable
name="help_url"><xsl:value-of select="//help_url"/>&attrib_id=<xsl:value-of
select="attrib_id"/></xsl:variable>
+ <xsl:variable
name="help_url"><xsl:value-of select="//help_url"/>&attrib_id=<xsl:value-of
select="id"/></xsl:variable>
<xsl:variable
name="lang_help"><xsl:value-of select="//lang_help"/></xsl:variable>
<a href="javascript:var
w=window.open('{$help_url}','','width=550,height=400,scrollbars')">
<xsl:text>
[</xsl:text><xsl:value-of select="$lang_help"/><xsl:text>]</xsl:text></a>
@@ -58,7 +58,7 @@
<input type="hidden"
name="values_attribute[{counter}][name]" value="{name}"></input>
<input type="hidden"
name="values_attribute[{counter}][datatype]" value="{datatype}"></input>
<input type="hidden"
name="values_attribute[{counter}][history]" value="{history}"></input>
- <input type="hidden"
name="values_attribute[{counter}][attrib_id]" value="{attrib_id}"></input>
+ <input type="hidden"
name="values_attribute[{counter}][attrib_id]" value="{id}"></input>
<input type="hidden"
name="values_attribute[{counter}][allow_null]" value="{allow_null}"></input>
<input type="hidden"
name="values_attribute[{counter}][input_text]" value="{input_text}"></input>
<xsl:choose>
Index: templates/base/demo.xsl
===================================================================
RCS file: /sources/phpgroupware/demo/templates/base/demo.xsl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- templates/base/demo.xsl 19 Nov 2006 20:48:24 -0000 1.4
+++ templates/base/demo.xsl 23 Nov 2006 13:26:51 -0000 1.5
@@ -1,4 +1,4 @@
-<!-- $Id: demo.xsl,v 1.4 2006/11/19 20:48:24 sigurdne Exp $ -->
+<!-- $Id: demo.xsl,v 1.5 2006/11/23 13:26:51 sigurdne Exp $ -->
<xsl:template name="app_data">
<xsl:choose>
@@ -11,14 +11,19 @@
<xsl:when test="list_wml">
<xsl:apply-templates select="list_wml"/>
</xsl:when>
- <xsl:otherwise>
+ <xsl:when test="list_html">
<xsl:apply-templates select="list_html"/>
+ </xsl:when>
+ <xsl:when test="list2_wml">
+ <xsl:apply-templates select="list_wml"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="list2_html"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="list_html">
-
<xsl:call-template name="menu"/>
<table width="100%" cellpadding="2" cellspacing="2"
align="center">
<xsl:choose>
@@ -186,6 +191,104 @@
</xsl:template>
+ <xsl:template match="list2_html">
+ <xsl:call-template name="menu"/>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td>
+ <xsl:call-template name="categories"/>
+ </td>
+ <td align="center">
+ <xsl:call-template
name="filter_select"/>
+ </td>
+ <td align="right">
+ <xsl:call-template name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:call-template name="table_header2"/>
+ <xsl:choose>
+ <xsl:when test="values != ''">
+ <xsl:call-template name="values2"/>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="table_add != ''">
+ <xsl:apply-templates
select="table_add"/>
+ </xsl:when>
+ </xsl:choose>
+ </table>
+ </xsl:template>
+
+
+ <xsl:template name="table_header2">
+ <tr class="th">
+ <xsl:for-each select="table_header" >
+ <td class="th_text" width="{with}"
align="{align}">
+ <xsl:choose>
+ <xsl:when
test="sort_link!=''">
+ <a
href="{sort}" onMouseover="window.status='{header}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of select="header"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="header"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </xsl:template>
+
+ <xsl:template name="values2">
+ <xsl:for-each select="values" >
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod 2 = 0">
+ <xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:for-each select="row" >
+ <xsl:choose>
+ <xsl:when test="link">
+ <td class="small_text"
align="center">
+ <a
href="{link}" onMouseover="window.status='{statustext}';return true;"
onMouseout="window.status='';return true;" target = "{target}"><xsl:value-of
select="text"/></a>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td class="small_text"
align="left">
+ <xsl:value-of
select="value"/>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </xsl:template>
+
+
+
<!-- add / edit -->
<xsl:template match="edit">
<div align="left">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] demo inc/class.bodemo.inc.php inc/class.menu.in...,
Sigurd Nes <=