mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
finished work on links (hopefully :-))
This commit is contained in:
parent
4057b2da43
commit
8f5ccbd557
@ -16,7 +16,7 @@ TODO:
|
||||
-edit / add
|
||||
add accessories functionality
|
||||
bug: loose html and picture on tab-switch (eTemplate bug --> Ralf)
|
||||
if only one cat is present --> chose it (eTemplate patch sent!)
|
||||
inputvalidation on selectbox --> eTemplate --> Ralf
|
||||
make some returnmessages js dialogs
|
||||
accessories get inserted a second time on page-refresh
|
||||
|
||||
|
@ -77,12 +77,11 @@ class admin_prefs_sidebox_hooks
|
||||
function search_link($args)
|
||||
{
|
||||
$appname = 'resources';
|
||||
return array('resources' => array(
|
||||
'query' => 'resources.ui_resources.link_query',
|
||||
'title' => 'resources_title',
|
||||
return array( 'query' => 'resources.bo_resources.link_query',
|
||||
'title' => 'resources.bo_resources.link_title',
|
||||
'view' => array('menuaction' => 'resources.ui_resources.view'),
|
||||
'view_id' => 'id'
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ class bo_resources
|
||||
|
||||
$order_by = $query['order'] ? $query['order'].' '. $query['sort'] : '';
|
||||
|
||||
$nr = $this->so->search($criteria,$cats,&$rows,$order_by,$offset=$query['start'],$num_rows=0);
|
||||
$nr = $this->so->search($criteria,$cats,&$rows,$accessory_of=-1,$order_by,$offset=$query['start'],$num_rows=0);
|
||||
foreach($rows as $num => $resource)
|
||||
{
|
||||
if (!$this->acl->is_permitted($resource['cat_id'],PHPGW_ACL_EDIT))
|
||||
@ -187,7 +187,7 @@ class bo_resources
|
||||
if($id < 1){return;}
|
||||
$cat_id = $this->so->get_value('cat_id',$id);
|
||||
$data[0] = array('id' => '', 'name' => '');
|
||||
$this->so->search(array('accessory_only' => 1),array($cat_id => ''),&$data,$order_by='',$offset=false,$num_rows=-1);
|
||||
$this->so->search(array('accessory_only' => 1),array($cat_id => ''),&$data,$accessory_of=-1,$order_by='',$offset=false,$num_rows=-1);
|
||||
foreach($data as $num => $resource)
|
||||
{
|
||||
if($num != 0)
|
||||
@ -198,31 +198,45 @@ class bo_resources
|
||||
return $acc_list;
|
||||
}
|
||||
|
||||
/*!
|
||||
/*!
|
||||
@function link_query
|
||||
@syntax link_query( $pattern )
|
||||
@author ralfbecker
|
||||
@author Cornelius Weiß <egw@von-und-zu-weiss.de>
|
||||
@abstract query infolog for entries matching $pattern
|
||||
*/
|
||||
function link_query( $pattern )
|
||||
{print_r($pattern);
|
||||
$query = array(
|
||||
'search' => $pattern,
|
||||
'start' => 0,
|
||||
'subs' => true,
|
||||
);
|
||||
$ids = $this->search($query);
|
||||
$content = array();
|
||||
if (is_array($ids))
|
||||
*/
|
||||
function link_query( $pattern )
|
||||
{
|
||||
$criteria = array('name' => $pattern,'short_description' => $pattern);
|
||||
$cats = $this->acl->get_cats(PHPGW_ACL_READ);
|
||||
$data[0] = array('id' => '','name' => '', 'short_description' => '');
|
||||
$this->so->search($criteria,$cats,&$data,$accessory_of=-1,$order_by='',$offset=false,$num_rows=-1);
|
||||
|
||||
foreach($data as $num => $resource)
|
||||
{
|
||||
if($num != 0)
|
||||
{
|
||||
foreach($ids as $id => $info )
|
||||
{
|
||||
$content[$id] = $this->link_title($id);
|
||||
}
|
||||
$list[$resource['id']] = $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/*!
|
||||
@function link_title
|
||||
@syntax link_title( $id )
|
||||
@author Cornelius Weiß <egw@von-und-zu-weiss.de>
|
||||
@abstract get title for an infolog entry identified by $id
|
||||
*/
|
||||
function link_title( $resource )
|
||||
{
|
||||
if (!is_array($resource))
|
||||
{
|
||||
$resource = $this->so->read($resource);
|
||||
$title = $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
|
||||
}
|
||||
return $title ? $title : false;
|
||||
}
|
||||
|
||||
/*!
|
||||
@function save_picture
|
||||
@abstract resizes and saves an pictures in vfs
|
||||
|
@ -29,13 +29,14 @@ class so_resources
|
||||
@param array $criteria array of key => value for search. (or'ed together)
|
||||
@param array $cats array of cat_id => cat_name to be searched
|
||||
@param &array $data reference of data array with cols to return in first row ( key => '')
|
||||
@param int $accessory_of find accessories of id, default -1 = show all exept accessories
|
||||
@param string $order_by fieldnames + {ASC|DESC} separated by colons ','
|
||||
@param int $offset row to start from, default 0
|
||||
@param int $num_rows number of rows to return (optional), default -1 = all, 0 will use $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']
|
||||
|
||||
@return int number of matching rows
|
||||
*/
|
||||
function search($criteria,$cats,&$data,$order_by='',$offset=false,$num_rows=-1)
|
||||
function search($criteria,$cats,&$data,$accessory_of=-1,$order_by='',$offset=false,$num_rows=-1)
|
||||
{
|
||||
$select = implode(',',array_keys($data[0]));
|
||||
foreach($criteria as $col => $value)
|
||||
@ -50,8 +51,9 @@ class so_resources
|
||||
$wherecats .= ($wherecats ? " OR " : " AND ( " ) .'cat_id' . "='".$cat_id."'";
|
||||
}
|
||||
$wherecats .= $wherecats ? " ) " : "";
|
||||
$whereacc = " AND (accessory_of ='".$accessory_of."')";
|
||||
|
||||
$this->db->query( 'SELECT '.$select." FROM ".$this->rs_table." WHERE ".$where.$wherecats.
|
||||
$this->db->query( 'SELECT '.$select." FROM ".$this->rs_table." WHERE ".$where.$wherecats.$whereacc.
|
||||
($order_by != '' ? " ORDER BY $order_by" : ''),__LINE__,__FILE__);
|
||||
|
||||
$nr = $this->db->nf();
|
||||
|
@ -126,6 +126,9 @@ class ui_resources
|
||||
{
|
||||
$resource_id = $content;
|
||||
$content = array('resource_id' => $resource_id);
|
||||
// some presetes
|
||||
$content['quantity'] = $content['useable'] = 1;
|
||||
$content['accessory_of'] = -1;
|
||||
|
||||
if ($resource_id > 0)
|
||||
{
|
||||
@ -140,11 +143,11 @@ class ui_resources
|
||||
}
|
||||
|
||||
$content['resource_picture'] = $this->bo->get_picture($resource_id,$content['picture_src'],$size=true);
|
||||
}
|
||||
$sel_options = array(
|
||||
'cat_id' => $this->bo->acl->get_cats(PHPGW_ACL_ADD),
|
||||
'gen_src_list' => $this->bo->get_genpicturelist()
|
||||
);
|
||||
}
|
||||
$sel_options['cat_id'] = $this->bo->acl->get_cats(PHPGW_ACL_ADD);
|
||||
$sel_options['cat_id'] = count($sel_options['cat_id']) == 1 ? $sel_options['cat_id'] : array('' => lang('select one')) + $sel_options['cat_id'];
|
||||
$sel_options['gen_src_list'] = $this->bo->get_genpicturelist();
|
||||
|
||||
$no_button = array(); // TODO: show delete button only if allowed to delete resource
|
||||
$preserv = $content;
|
||||
$this->tmpl->read('resources.edit');
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// eTemplates for Application 'resources', generated by soetemplate::dump4setup() 2005-02-25 09:51
|
||||
// eTemplates for Application 'resources', generated by soetemplate::dump4setup() 2005-02-25 10:45
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
@ -11,7 +11,7 @@ $templ_data[] = array('name' => 'resources.edit_buttons','template' => '','lang'
|
||||
|
||||
$templ_data[] = array('name' => 'resources.edit_pictures','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:3:{s:2:"c1";s:3:"nmr";s:2:"c2";s:3:"nmr";s:2:"c3";s:3:"nmr";}i:1;a:3:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:26:"Use general resources icon";s:5:"align";s:5:"right";}s:1:"B";a:3:{s:4:"type";s:5:"radio";s:4:"size";s:7:"gen_src";s:4:"name";s:11:"picture_src";}s:1:"C";a:3:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:12:"gen_src_list";}}i:2;a:3:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:23:"Use the category\'s icon";s:5:"align";s:5:"right";}s:1:"B";a:3:{s:4:"type";s:5:"radio";s:4:"size";s:7:"cat_src";s:4:"name";s:11:"picture_src";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:3;a:3:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:15:"Use own picture";s:5:"align";s:5:"right";}s:1:"B";a:3:{s:4:"type";s:5:"radio";s:4:"size";s:7:"own_src";s:4:"name";s:11:"picture_src";}s:1:"C";a:2:{s:4:"type";s:4:"file";s:4:"name";s:8:"own_file";}}}s:4:"rows";i:3;s:4:"cols";i:3;}}','size' => '','style' => '','modified' => '1108638846',);
|
||||
|
||||
$templ_data[] = array('name' => 'resources.edit_tabs','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:3:{s:1:"A";s:3:"250";s:2:"c1";s:6:"row_on";s:2:"c2";s:7:"row_off";}i:1;a:2:{s:1:"A";a:5:{s:4:"type";s:4:"text";s:5:"label";s:4:"Name";s:4:"name";s:4:"name";s:4:"help";s:16:"Name of resource";s:6:"needed";s:1:"1";}s:1:"B";a:7:{s:4:"type";s:6:"select";s:4:"size";s:10:"select one";s:5:"label";s:8:"Category";s:7:"no_lang";s:1:"1";s:4:"name";s:6:"cat_id";s:6:"needed";s:1:"1";s:4:"help";s:44:"Which category does this resource belong to?";}}i:2;a:2:{s:1:"A";a:5:{s:4:"type";s:3:"tab";s:4:"span";s:3:"all";s:5:"label";s:54:"General|Description|Picture|Accessories|Links|Calendar";s:4:"name";s:48:"general|page|pictures|accessories|links|calendar";s:4:"help";s:194:"General informations about resource|Informations about the location of resource|Prizeing information for booking or buying|Web-Page of resource|Pictures or resource|The Calendar of this resource";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:3;s:4:"cols";i:2;}}','size' => '','style' => '','modified' => '1109155739',);
|
||||
$templ_data[] = array('name' => 'resources.edit_tabs','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:3:{s:1:"A";s:3:"250";s:2:"c1";s:6:"row_on";s:2:"c2";s:7:"row_off";}i:1;a:2:{s:1:"A";a:5:{s:4:"type";s:4:"text";s:5:"label";s:4:"Name";s:4:"name";s:4:"name";s:4:"help";s:16:"Name of resource";s:6:"needed";s:1:"1";}s:1:"B";a:6:{s:4:"type";s:6:"select";s:5:"label";s:8:"Category";s:7:"no_lang";s:1:"1";s:4:"name";s:6:"cat_id";s:6:"needed";s:1:"1";s:4:"help";s:44:"Which category does this resource belong to?";}}i:2;a:2:{s:1:"A";a:5:{s:4:"type";s:3:"tab";s:4:"span";s:3:"all";s:5:"label";s:54:"General|Description|Picture|Accessories|Links|Calendar";s:4:"name";s:48:"general|page|pictures|accessories|links|calendar";s:4:"help";s:194:"General informations about resource|Informations about the location of resource|Prizeing information for booking or buying|Web-Page of resource|Pictures or resource|The Calendar of this resource";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:3;s:4:"cols";i:2;}}','size' => '','style' => '','modified' => '1109155739',);
|
||||
|
||||
$templ_data[] = array('name' => 'resources.edit_tabs.general','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:7:{i:0;a:1:{s:1:"C";s:2:"10";}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:19:"Description (short)";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:4:"size";s:6:"50,100";s:4:"name";s:17:"short_description";s:4:"help";s:29:"Short description of resource";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:29:"Short description of resource";}}i:2;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Location";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:4:"size";s:6:"50,100";s:4:"name";s:8:"location";s:4:"help";s:20:"Location of resource";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:28:"Where to find this resource?";}}i:3;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Quantity";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:4:"size";s:4:"5,10";s:4:"name";s:8:"quantity";s:4:"help";s:20:"Quantity of resource";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:20:"Quantity of resource";}}i:4;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Useable";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:4:"size";s:4:"5,10";s:4:"name";s:7:"useable";s:4:"help";s:29:"How many of them are useable?";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:38:"How many of the resources are useable?";}}i:5;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Bookable";}s:1:"B";a:3:{s:4:"type";s:8:"checkbox";s:4:"name";s:8:"bookable";s:4:"help";s:21:"Is resource bookable?";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:26:"Is this resource bookable?";}}i:6;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Buyable";}s:1:"B";a:3:{s:4:"type";s:8:"checkbox";s:4:"name";s:7:"buyable";s:4:"help";s:20:"Is resource buyable?";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:25:"Is this resource buyable?";}}}s:4:"rows";i:6;s:4:"cols";i:4;s:4:"size";s:4:"100%";}}','size' => '100%','style' => '','modified' => '1093597682',);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user