[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.sodemo....
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] demo inc/class.bodemo.inc.php inc/class.sodemo.... |
Date: |
Sun, 19 Nov 2006 20:48:24 +0000 |
CVSROOT: /sources/phpgroupware
Module name: demo
Changes by: Sigurd Nes <sigurdne> 06/11/19 20:48:24
Modified files:
inc : class.bodemo.inc.php class.sodemo.inc.php
class.uidemo.inc.php
setup : tables_current.inc.php tables_update.inc.php
templates/base : demo.xsl
Log message:
custom fields and functions
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/demo/inc/class.bodemo.inc.php?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/demo/inc/class.sodemo.inc.php?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/demo/inc/class.uidemo.inc.php?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/demo/setup/tables_current.inc.php?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/demo/setup/tables_update.inc.php?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/demo/templates/base/demo.xsl?cvsroot=phpgroupware&r1=1.3&r2=1.4
Patches:
Index: inc/class.bodemo.inc.php
===================================================================
RCS file: /sources/phpgroupware/demo/inc/class.bodemo.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- inc/class.bodemo.inc.php 19 Nov 2006 19:02:36 -0000 1.3
+++ inc/class.bodemo.inc.php 19 Nov 2006 20:48:24 -0000 1.4
@@ -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.3 2006/11/19 19:02:36 sigurdne
Exp $
+ * @version $Id: class.bodemo.inc.php,v 1.4 2006/11/19 20:48:24 sigurdne
Exp $
*/
/**
@@ -123,11 +123,11 @@
{
$data =
$GLOBALS['phpgw']->session->appsession('session_data','demo_app');
- $this->start = $data['start'];
- $this->query = $data['query'];
+ $this->start =
(isset($data['start'])?$data['start']:'');
+ $this->query =
(isset($data['query'])?$data['query']:'');
$this->filter =
(isset($data['filter'])?$data['filter']:'');
- $this->sort = $data['sort'];
- $this->order = $data['order'];
+ $this->sort =
(isset($data['sort'])?$data['sort']:'');
+ $this->order =
(isset($data['order'])?$data['order']:'');
$this->cat_id =
(isset($data['cat_id'])?$data['cat_id']:'');
}
@@ -139,7 +139,7 @@
function read()
{
$demo_info = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'cat_id'=>$this->cat_id,'allrows'=>$this->allrows));
+
'cat_id'=>$this->cat_id,'allrows'=>$this->allrows,'filter'=>$this->filter));
$this->total_records = $this->so->total_records;
return $demo_info;
}
@@ -156,7 +156,7 @@
$values =
$this->custom->prepare_attributes($values,$appname='demo',
$location='.demo_location');
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- if($values['entry_date'])
+ if(isset($values['entry_date']) &&
$values['entry_date'])
{
$values['entry_date'] =
$GLOBALS['phpgw']->common->show_date($values['entry_date'],$dateformat);
}
Index: inc/class.sodemo.inc.php
===================================================================
RCS file: /sources/phpgroupware/demo/inc/class.sodemo.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- inc/class.sodemo.inc.php 19 Nov 2006 19:02:36 -0000 1.3
+++ inc/class.sodemo.inc.php 19 Nov 2006 20:48:24 -0000 1.4
@@ -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.3 2006/11/19 19:02:36 sigurdne
Exp $
+ * @version $Id: class.sodemo.inc.php,v 1.4 2006/11/19 20:48:24 sigurdne
Exp $
*/
/**
@@ -54,11 +54,15 @@
$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']:'');
}
$table = 'phpgw_demo_table';
$where= 'WHERE';
$filtermethod = '';
+
+ if (!$filter)
+ {
if (is_array($this->grants))
{
while (list($user) = each($this->grants))
@@ -67,9 +71,19 @@
}
reset($public_user_list);
$filtermethod .= " $where ( $table.user_id IN("
. implode(',',$public_user_list) . "))";
- $where= 'AND';
+ }
+ }
+ 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' ";
@@ -108,6 +122,7 @@
$this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
}
+ $demo_info = '';
while ($this->db->next_record())
{
$demo_info[] = array
@@ -122,7 +137,6 @@
return $demo_info;
}
-
function read_single($id,$values='')
{
$sql = 'SELECT * FROM phpgw_demo_table where id=' .
intval($id);
@@ -140,6 +154,7 @@
$values['entry_date'] =
$this->db->f('entry_date');
$values['user_id'] =
$this->db->f('user_id');
$values['cat_id'] =
$this->db->f('category');
+ $values['access'] =
$this->db->f('access');
$values['grants'] =
(int)$this->grants[$this->db->f('user_id')];
for ($i=0;$i<count($values['attributes']);$i++)
@@ -167,6 +182,7 @@
$values['town'],
$values['remark'],
(int)$values['cat_id'],
+ (isset($values['access'])?'private':''),
$this->account,
time()
);
@@ -225,12 +241,18 @@
$insert_values =
$this->db->validate_insert($insert_values);
- if($cols)
+ if(isset($cols) && is_array($cols))
{
$cols = "," . implode(",", $cols);
$vals = "," .
$this->db->validate_insert($vals);
}
- $this->db->query("INSERT INTO phpgw_demo_table
(name,address,zip,town, remark,category,user_id,entry_date $cols) "
+ else
+ {
+ $cols = '';
+ $vals = '';
+ }
+
+ $this->db->query("INSERT INTO phpgw_demo_table
(name,address,zip,town, remark,category,access,user_id,entry_date $cols) "
. "VALUES ($insert_values
$vals)",__LINE__,__FILE__);
$receipt['message'][]=array('msg'=>lang('demo item has
been saved'));
@@ -251,6 +273,7 @@
$value_set['remark'] =
$this->db->db_addslashes($values['remark']);
$value_set['town'] =
$this->db->db_addslashes($values['town']);
$value_set['category'] =
(int)$values['cat_id'];
+ $value_set['access'] =
(isset($values['access'])?'private':'');
if(isset($values['extra']) &&
is_array($values['extra']))
{
Index: inc/class.uidemo.inc.php
===================================================================
RCS file: /sources/phpgroupware/demo/inc/class.uidemo.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- inc/class.uidemo.inc.php 19 Nov 2006 19:02:36 -0000 1.3
+++ inc/class.uidemo.inc.php 19 Nov 2006 20:48:24 -0000 1.4
@@ -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.3 2006/11/19 19:02:36 sigurdne
Exp $
+ * @version $Id: class.uidemo.inc.php,v 1.4 2006/11/19 20:48:24 sigurdne
Exp $
*/
/**
@@ -161,8 +161,11 @@
'extra' => array('menuaction' => $this->currentapp.'.uidemo.index',
'query' => $this->query,
'cat_id' => $this->cat_id,
+
'filter' => $this->filter,
+
'output' =>$output,
'allrows' => $this->allrows)
)),
+ 'lang_name' => lang('name'),
'lang_view' => lang('view'),
'lang_edit' =>
(isset($acl_edit)?lang('edit'):''),
'lang_delete' =>
(isset($acl_delete)?lang('view'):''),
@@ -202,11 +205,12 @@
'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'
=> count($demo_info),
+ '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'),
@@ -216,7 +220,7 @@
'lang_search'
=> lang('search'),
'table_header'
=> $table_header,
'table_add'
=> $table_add,
- 'values'
=> $content
+ 'values'
=> (isset($content)?$content:'')
);
$function_msg= lang('list demo values');
@@ -254,10 +258,13 @@
$insert_record_values =
$GLOBALS['phpgw']->session->appsession('insert_record_values'.
$acl_location,'demo');
+ if(isset($insert_record_values) &&
is_array($insert_record_values))
+ {
for ($j=0;$j<count($insert_record_values);$j++)
{
$insert_record['extra'][$insert_record_values[$j]] =
$insert_record_values[$j];
}
+ }
$GLOBALS['phpgw']->xslttpl->add_file(array('demo','attributes_form'));
@@ -378,8 +385,13 @@
'lang_category' =>
lang('category'),
'lang_no_cat' =>
lang('no category'),
- 'cat_select' =>
$this->cats->formatted_xslt_list(array('select_name' =>
'values[cat_id]','selected' => $values['cat_id'])),
+ 'cat_select'
=> $this->cats->formatted_xslt_list(array('select_name' =>
'values[cat_id]','selected' =>
(isset($values['cat_id'])?$values['cat_id']:''))),
'attributes_values' =>
$values['attributes'],
+
+ 'lang_access'
=> lang('private'),
+ 'value_access'
=> (isset($values['access'])?$values['access']:''),
+ 'lang_access_off_statustext' => lang('The
note is public. If the note should be private, check this box'),
+ 'lang_access_on_statustext' =>
lang('The note is private. If the note should be public, uncheck this box')
);
$appname = lang('demo');
@@ -445,6 +457,8 @@
'lang_category' =>
lang('category'),
'value_cat'
=> $this->cats->id2name($values['cat_id']),
'attributes_values' =>
$values['attributes'],
+ 'lang_access' =>
lang('private'),
+ 'value_access' =>
(isset($values['access'])?lang($values['access']):'')
);
$appname = lang('demo');
@@ -478,14 +492,13 @@
$link_data = array
(
- 'menuaction' =>
$this->currentapp.'.uidemo.index',
- 'demo_id' => $demo_id
+ 'menuaction' =>
$this->currentapp.'.uidemo.index'
);
if (get_var('confirm',array('POST')))
{
$this->bo->delete($demo_id);
-
$GLOBALS['phpgw']->redirect_link($GLOBALS['phpgw']->link('/index.php',$link_data));
+
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
}
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
Index: setup/tables_current.inc.php
===================================================================
RCS file: /sources/phpgroupware/demo/setup/tables_current.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- setup/tables_current.inc.php 19 Nov 2006 19:02:36 -0000 1.2
+++ setup/tables_current.inc.php 19 Nov 2006 20:48:24 -0000 1.3
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package hrm
* @subpackage setup
- * @version $Id: tables_current.inc.php,v 1.2 2006/11/19 19:02:36
sigurdne Exp $
+ * @version $Id: tables_current.inc.php,v 1.3 2006/11/19 20:48:24
sigurdne Exp $
*/
$phpgw_baseline = array(
@@ -25,6 +25,7 @@
'town' => array('type' => 'varchar','precision'
=> '255','nullable' => False),
'remark' => array('type' => 'text','nullable'
=> True),
'category' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'access' => array('type' => 'varchar',
'precision' => '7','nullable' => True)
),
'pk' => array('id'),
'fk' => array(),
Index: setup/tables_update.inc.php
===================================================================
RCS file: /sources/phpgroupware/demo/setup/tables_update.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- setup/tables_update.inc.php 19 Nov 2006 19:03:05 -0000 1.1
+++ setup/tables_update.inc.php 19 Nov 2006 20:48:24 -0000 1.2
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package demo
* @subpackage setup
- * @version $Id: tables_update.inc.php,v 1.1 2006/11/19 19:03:05
sigurdne Exp $
+ * @version $Id: tables_update.inc.php,v 1.2 2006/11/19 20:48:24
sigurdne Exp $
*/
/**
@@ -21,6 +21,7 @@
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_demo_table','category',
array('type' => 'int','precision' => '4','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_demo_table','access',
array('type' => 'varchar', 'precision' => '7','nullable' => True));
$GLOBALS['phpgw_setup']->oProc->query("UPDATE
phpgw_acl_location set allow_c_attrib = 1, c_attrib_table = 'phpgw_demo_table'
WHERE appname = 'demo' AND id = '.demo_location'");
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit();
Index: templates/base/demo.xsl
===================================================================
RCS file: /sources/phpgroupware/demo/templates/base/demo.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- templates/base/demo.xsl 19 Nov 2006 19:02:36 -0000 1.3
+++ templates/base/demo.xsl 19 Nov 2006 20:48:24 -0000 1.4
@@ -1,4 +1,4 @@
-<!-- $Id: demo.xsl,v 1.3 2006/11/19 19:02:36 sigurdne Exp $ -->
+<!-- $Id: demo.xsl,v 1.4 2006/11/19 20:48:24 sigurdne Exp $ -->
<xsl:template name="app_data">
<xsl:choose>
@@ -34,6 +34,9 @@
<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>
@@ -156,6 +159,9 @@
<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>
@@ -288,11 +294,42 @@
</textarea>
</td>
</tr>
+ <xsl:choose>
+ <xsl:when test="attributes_values != ''">
<tr>
<td colspan="2" align="left">
<xsl:call-template
name="attributes_form"/>
</td>
</tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td>
+ <xsl:value-of select="lang_access"/>
+ </td>
+ <td>
+ <xsl:choose>
+ <xsl:when
test="value_access = 'private'">
+ <input
type="checkbox" name="values[access]" value="True" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_access_on_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[access]" value="True"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_access_off_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
<tr height="50">
<td colspan = "2" align = "center"><table><tr>
@@ -401,11 +438,24 @@
</textarea>
</td>
</tr>
+ <xsl:choose>
+ <xsl:when test="attributes_values != ''">
<tr>
<td colspan="2" align="left">
<xsl:call-template
name="attributes_view"/>
</td>
</tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td>
+ <xsl:value-of select="lang_access"/>
+ </td>
+ <td>
+ <xsl:value-of select="value_access"/>
+ </td>
+ </tr>
+
</table>
<table cellpadding="2" cellspacing="2" width="80%"
align="center">
<tr height="50">