mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-03-04 10:11:26 +01:00
- change field id --> res_id due to database compability
- add inventory number - add storage information - show nm-header on bottom
This commit is contained in:
parent
c2106931d9
commit
c98ae36968
@ -3,11 +3,9 @@ TODO:
|
|||||||
- some artwork : general resource pictures like (room, car, beamer ...) (Benkom)
|
- some artwork : general resource pictures like (room, car, beamer ...) (Benkom)
|
||||||
- sitemgr module
|
- sitemgr module
|
||||||
|
|
||||||
- rename table column id -> res_id for compability with other databases
|
|
||||||
- list
|
- list
|
||||||
select all button --> add actions for selected: move to other cat,...
|
select all button --> add actions for selected: move to other cat,...
|
||||||
popup on picture --> show
|
popup on picture --> show
|
||||||
show nm-header on page bottom
|
|
||||||
make button-alignment nicer
|
make button-alignment nicer
|
||||||
add show-calender button
|
add show-calender button
|
||||||
|
|
||||||
@ -15,8 +13,6 @@ TODO:
|
|||||||
bug: loose html and picture on tab-switch (eTemplate bug --> Ralf)
|
bug: loose html and picture on tab-switch (eTemplate bug --> Ralf)
|
||||||
bug: inputvalidation on selectbox --> eTemplate --> Ralf
|
bug: inputvalidation on selectbox --> eTemplate --> Ralf
|
||||||
bug: accessories aren't moved to cat of master if it changes
|
bug: accessories aren't moved to cat of master if it changes
|
||||||
insert --> storage information
|
|
||||||
delete --> calendar tab
|
|
||||||
add pictureupload for htmlarea
|
add pictureupload for htmlarea
|
||||||
|
|
||||||
- admin section
|
- admin section
|
||||||
|
@ -31,7 +31,8 @@ class bo_resources
|
|||||||
$this->conf =& CreateObject('phpgwapi.config');
|
$this->conf =& CreateObject('phpgwapi.config');
|
||||||
$this->conf->read_repository();
|
$this->conf->read_repository();
|
||||||
|
|
||||||
$this->cal_right_transform = array( EGW_ACL_CALREAD => EGW_ACL_READ,
|
$this->cal_right_transform = array(
|
||||||
|
EGW_ACL_CALREAD => EGW_ACL_READ,
|
||||||
EGW_ACL_DIRECT_BOOKING => EGW_ACL_READ | EGW_ACL_ADD | EGW_ACL_EDIT | EGW_ACL_DELETE,
|
EGW_ACL_DIRECT_BOOKING => EGW_ACL_READ | EGW_ACL_ADD | EGW_ACL_EDIT | EGW_ACL_DELETE,
|
||||||
EGW_ACL_CAT_ADMIN => EGW_ACL_READ | EGW_ACL_ADD | EGW_ACL_EDIT | EGW_ACL_DELETE,
|
EGW_ACL_CAT_ADMIN => EGW_ACL_READ | EGW_ACL_ADD | EGW_ACL_EDIT | EGW_ACL_DELETE,
|
||||||
);
|
);
|
||||||
@ -47,7 +48,7 @@ class bo_resources
|
|||||||
if ($this->debug) _debug_array($query);
|
if ($this->debug) _debug_array($query);
|
||||||
$query['search'] = $query['search'] ? $query['search'] : '*';
|
$query['search'] = $query['search'] ? $query['search'] : '*';
|
||||||
$criteria = array('name' => $query['search'], 'short_description' => $query['search']);
|
$criteria = array('name' => $query['search'], 'short_description' => $query['search']);
|
||||||
$read_onlys = 'id,name,short_description,quantity,useable,bookable,buyable,cat_id,location';
|
$read_onlys = 'res_id,name,short_description,quantity,useable,bookable,buyable,cat_id,location,storage_info';
|
||||||
|
|
||||||
$accessory_of = $query['view_accs_of'] ? $query['view_accs_of'] : -1;
|
$accessory_of = $query['view_accs_of'] ? $query['view_accs_of'] : -1;
|
||||||
$filter = array('accessory_of' => $accessory_of);
|
$filter = array('accessory_of' => $accessory_of);
|
||||||
@ -74,40 +75,40 @@ class bo_resources
|
|||||||
{
|
{
|
||||||
if (!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_EDIT))
|
if (!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_EDIT))
|
||||||
{
|
{
|
||||||
$readonlys["edit[$resource[id]]"] = true;
|
$readonlys["edit[$resource[res_id]]"] = true;
|
||||||
}
|
}
|
||||||
if (!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_DELETE))
|
if (!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_DELETE))
|
||||||
{
|
{
|
||||||
$readonlys["delete[$resource[id]]"] = true;
|
$readonlys["delete[$resource[res_id]]"] = true;
|
||||||
}
|
}
|
||||||
if ((!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_ADD)) || $accessory_of != -1)
|
if ((!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_ADD)) || $accessory_of != -1)
|
||||||
{
|
{
|
||||||
$readonlys["new_acc[$resource[id]]"] = true;
|
$readonlys["new_acc[$resource[res_id]]"] = true;
|
||||||
}
|
}
|
||||||
if (!$resource['bookable'] /* && calender-acl viewable */)
|
if (!$resource['bookable'] /* && calender-acl viewable */)
|
||||||
{
|
{
|
||||||
$readonlys["bookable[$resource[id]]"] = true;
|
$readonlys["bookable[$resource[res_id]]"] = true;
|
||||||
}
|
}
|
||||||
if (!$resource['buyable'])
|
if (!$resource['buyable'])
|
||||||
{
|
{
|
||||||
$readonlys["buyable[$resource[id]]"] = true;
|
$readonlys["buyable[$resource[res_id]]"] = true;
|
||||||
}
|
}
|
||||||
$readonlys["view_acc[$resource[id]]"] = true;
|
$readonlys["view_acc[$resource[res_id]]"] = true;
|
||||||
$links = $this->link->get_links('resources',$resource['id']);
|
$links = $this->link->get_links('resources',$resource['res_id']);
|
||||||
if(count($links) != 0)
|
if(count($links) != 0)
|
||||||
{
|
{
|
||||||
foreach ($links as $link_num => $link)
|
foreach ($links as $link_num => $link)
|
||||||
{
|
{
|
||||||
if($link['app'] == 'resources')
|
if($link['app'] == 'resources')
|
||||||
{
|
{
|
||||||
if($this->so->get_value('accessory_of',$link['id']) != -1)
|
if($this->so->get_value('accessory_of',$link['res_id']) != -1)
|
||||||
{
|
{
|
||||||
$readonlys["view_acc[$resource[id]]"] = false;
|
$readonlys["view_acc[$resource[res_id]]"] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$rows[$num]['picture_thumb'] = $this->get_picture($resource['id']);
|
$rows[$num]['picture_thumb'] = $this->get_picture($resource['res_id']);
|
||||||
$rows[$num]['admin'] = $this->acl->get_cat_admin($resource['cat_id']);
|
$rows[$num]['admin'] = $this->acl->get_cat_admin($resource['cat_id']);
|
||||||
}
|
}
|
||||||
return $nr;
|
return $nr;
|
||||||
@ -117,18 +118,18 @@ class bo_resources
|
|||||||
* reads a resource exept binary datas
|
* reads a resource exept binary datas
|
||||||
*
|
*
|
||||||
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
||||||
* @param int $id resource id
|
* @param int $res_id resource id
|
||||||
* @return array with key => value or false if not found or allowed
|
* @return array with key => value or false if not found or allowed
|
||||||
*/
|
*/
|
||||||
function read($id)
|
function read($res_id)
|
||||||
{
|
{
|
||||||
if(!$this->acl->is_permitted($this->so->get_value('cat_id',$id),EGW_ACL_READ))
|
if(!$this->acl->is_permitted($this->so->get_value('cat_id',$res_id),EGW_ACL_READ))
|
||||||
{
|
{
|
||||||
echo lang('You are not permitted to get information about this resource!') . '<br>';
|
echo lang('You are not permitted to get information about this resource!') . '<br>';
|
||||||
echo lang('Notify your administrator to correct this situation') . '<br>';
|
echo lang('Notify your administrator to correct this situation') . '<br>';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $this->so->read(array('id' => $id));
|
return $this->so->read(array('res_id' => $res_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,18 +147,18 @@ class bo_resources
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we need an id to save pictures and make links...
|
// we need an id to save pictures and make links...
|
||||||
if(!$resource['id'])
|
if(!$resource['res_id'])
|
||||||
{
|
{
|
||||||
$resource['id'] = $this->so->save($resource);
|
$resource['res_id'] = $this->so->save($resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($resource['picture_src'])
|
switch ($resource['picture_src'])
|
||||||
{
|
{
|
||||||
case 'own_src':
|
case 'own_src':
|
||||||
$vfs_data = array('string' => $this->pictures_dir.$resource['id'].'.jpg','relatives' => array(RELATIVE_ROOT));
|
$vfs_data = array('string' => $this->pictures_dir.$resource['res_id'].'.jpg','relatives' => array(RELATIVE_ROOT));
|
||||||
if($resource['own_file']['size'] > 0)
|
if($resource['own_file']['size'] > 0)
|
||||||
{
|
{
|
||||||
$msg = $this->save_picture($resource['own_file'],$resource['id']);
|
$msg = $this->save_picture($resource['own_file'],$resource['res_id']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
elseif($this->vfs->file_exists($vfs_data))
|
elseif($this->vfs->file_exists($vfs_data))
|
||||||
@ -174,7 +175,7 @@ class bo_resources
|
|||||||
if($resource['own_file']['size'] > 0)
|
if($resource['own_file']['size'] > 0)
|
||||||
{
|
{
|
||||||
$resource['picture_src'] = 'own_src';
|
$resource['picture_src'] = 'own_src';
|
||||||
$msg = $this->save_picture($resource['own_file'],$resource['id']);
|
$msg = $this->save_picture($resource['own_file'],$resource['res_id']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -190,17 +191,17 @@ class bo_resources
|
|||||||
// delete old pictures
|
// delete old pictures
|
||||||
if($resource['picture_src'] != 'own_src')
|
if($resource['picture_src'] != 'own_src')
|
||||||
{
|
{
|
||||||
$this->remove_picture($resource['id']);
|
$this->remove_picture($resource['res_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// save links
|
// save links
|
||||||
if(is_array($resource['link_to']['to_id']))
|
if(is_array($resource['link_to']['to_id']))
|
||||||
{
|
{
|
||||||
$this->link->link('resources',$resource['id'],$resource['link_to']['to_id']);
|
$this->link->link('resources',$resource['res_id'],$resource['link_to']['to_id']);
|
||||||
}
|
}
|
||||||
if($resource['accessory_of'] != -1)
|
if($resource['accessory_of'] != -1)
|
||||||
{ echo $resource['id'].', '.$resource['accessory_of'];
|
{ echo $resource['res_id'].', '.$resource['accessory_of'];
|
||||||
$this->link->link('resources',$resource['id'],'resources',$resource['accessory_of']);
|
$this->link->link('resources',$resource['res_id'],'resources',$resource['accessory_of']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->so->save($resource) ? false : lang('Something went wrong by saving resource');
|
return $this->so->save($resource) ? false : lang('Something went wrong by saving resource');
|
||||||
@ -210,29 +211,29 @@ class bo_resources
|
|||||||
* deletes resource including pictures and links
|
* deletes resource including pictures and links
|
||||||
*
|
*
|
||||||
* @author Lukas Weiss <wnz_gh05t@users.sourceforge.net>
|
* @author Lukas Weiss <wnz_gh05t@users.sourceforge.net>
|
||||||
* @param int $id id of resource
|
* @param int $res_id id of resource
|
||||||
*/
|
*/
|
||||||
function delete($id)
|
function delete($res_id)
|
||||||
{
|
{
|
||||||
$this->remove_picture($id);
|
$this->remove_picture($res_id);
|
||||||
$this->link->unlink(0,'resources',$id);
|
$this->link->unlink(0,'resources',$res_id);
|
||||||
return $this->so->delete(array('id'=>$id)) ? false : lang('Something went wrong by deleting resource');
|
return $this->so->delete(array('res_id'=>$res_id)) ? false : lang('Something went wrong by deleting resource');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets list of accessories for resource
|
* gets list of accessories for resource
|
||||||
*
|
*
|
||||||
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
||||||
* @param int $id id of resource
|
* @param int $res_id id of resource
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function get_acc_list($id)
|
function get_acc_list($res_id)
|
||||||
{
|
{
|
||||||
if($id < 1){return;}
|
if($res_id < 1){return;}
|
||||||
$data = $this->so->search('','id,name','','','','','',$start,array('accessory_of' => $id),'',$need_full_no_count=true);
|
$data = $this->so->search('','res_id,name','','','','','',$start,array('accessory_of' => $res_id),'',$need_full_no_count=true);
|
||||||
foreach($data as $num => $resource)
|
foreach($data as $num => $resource)
|
||||||
{
|
{
|
||||||
$acc_list[$resource['id']] = $resource['name'];
|
$acc_list[$resource['res_id']] = $resource['name'];
|
||||||
}
|
}
|
||||||
return $acc_list;
|
return $acc_list;
|
||||||
}
|
}
|
||||||
@ -248,7 +249,7 @@ class bo_resources
|
|||||||
//echo "<p>bo_resources::get_calendar_info(".print_r($res_id,true)."</p>\n";
|
//echo "<p>bo_resources::get_calendar_info(".print_r($res_id,true)."</p>\n";
|
||||||
if(!is_array($res_id) && $res_id < 1) return;
|
if(!is_array($res_id) && $res_id < 1) return;
|
||||||
|
|
||||||
$data = $this->so->search(array('id' => $res_id),'id,cat_id,name,useable');
|
$data = $this->so->search(array('res_id' => $res_id),'res_id,cat_id,name,useable');
|
||||||
|
|
||||||
foreach($data as $num => $resource)
|
foreach($data as $num => $resource)
|
||||||
{
|
{
|
||||||
@ -286,13 +287,13 @@ class bo_resources
|
|||||||
function link_query( $pattern )
|
function link_query( $pattern )
|
||||||
{
|
{
|
||||||
$criteria = array('name' => $pattern, 'short_description' => $pattern);
|
$criteria = array('name' => $pattern, 'short_description' => $pattern);
|
||||||
$only_keys = 'id,name,short_description';
|
$only_keys = 'res_id,name,short_description';
|
||||||
$data = $this->so->search($criteria,$only_keys,$order_by='',$extra_cols='',$wildcard='%',$empty,$op='OR');
|
$data = $this->so->search($criteria,$only_keys,$order_by='',$extra_cols='',$wildcard='%',$empty,$op='OR');
|
||||||
foreach($data as $num => $resource)
|
foreach($data as $num => $resource)
|
||||||
{
|
{
|
||||||
if($num != 0)
|
if($num != 0)
|
||||||
{
|
{
|
||||||
$list[$resource['id']] = $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
|
$list[$resource['res_id']] = $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $list;
|
return $list;
|
||||||
@ -300,14 +301,14 @@ class bo_resources
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Cornelius Weiss <egw@von-und-zu-weiss.de>
|
* @author Cornelius Weiss <egw@von-und-zu-weiss.de>
|
||||||
* get title for an infolog entry identified by $id
|
* get title for an infolog entry identified by $res_id
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function link_title( $resource )
|
function link_title( $resource )
|
||||||
{
|
{
|
||||||
if (!is_array($resource) && $resource > 0)
|
if (!is_array($resource) && $resource > 0)
|
||||||
{
|
{
|
||||||
$resource = $this->so->read(array('id' => $resource));
|
$resource = $this->so->read(array('res_id' => $resource));
|
||||||
$title = $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
|
$title = $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
|
||||||
}
|
}
|
||||||
return $title ? $title : false;
|
return $title ? $title : false;
|
||||||
@ -421,25 +422,25 @@ class bo_resources
|
|||||||
/**
|
/**
|
||||||
* get resource picture either from vfs or from symlink
|
* get resource picture either from vfs or from symlink
|
||||||
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
||||||
* @param int $id id of resource
|
* @param int $res_id id of resource
|
||||||
* @param bool $size false = thumb, true = full pic
|
* @param bool $size false = thumb, true = full pic
|
||||||
* @return string url of picture
|
* @return string url of picture
|
||||||
*/
|
*/
|
||||||
function get_picture($id=0,$size=false)
|
function get_picture($res_id=0,$size=false)
|
||||||
{
|
{
|
||||||
if ($id > 0)
|
if ($res_id > 0)
|
||||||
{
|
{
|
||||||
$src = $this->so->get_value('picture_src',$id);
|
$src = $this->so->get_value('picture_src',$res_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($src)
|
switch($src)
|
||||||
{
|
{
|
||||||
case 'own_src':
|
case 'own_src':
|
||||||
$picture = $this->conf->config_data['dont_use_vfs'] ? $GLOBALS['egw_info']['server']['webserver_url'] : 'vfs:';
|
$picture = $this->conf->config_data['dont_use_vfs'] ? $GLOBALS['egw_info']['server']['webserver_url'] : 'vfs:';
|
||||||
$picture .= $size ? $this->pictures_dir.$id.'.jpg' : $this->thumbs_dir.$id.'.jpg';
|
$picture .= $size ? $this->pictures_dir.$res_id.'.jpg' : $this->thumbs_dir.$res_id.'.jpg';
|
||||||
break;
|
break;
|
||||||
case 'cat_src':
|
case 'cat_src':
|
||||||
list($picture) = $this->cats->return_single($this->so->get_value('cat_id',$id));
|
list($picture) = $this->cats->return_single($this->so->get_value('cat_id',$res_id));
|
||||||
$picture = unserialize($picture['data']);
|
$picture = unserialize($picture['data']);
|
||||||
if($picture['icon'])
|
if($picture['icon'])
|
||||||
{
|
{
|
||||||
@ -459,17 +460,17 @@ class bo_resources
|
|||||||
* removes picture from vfs
|
* removes picture from vfs
|
||||||
*
|
*
|
||||||
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
||||||
* @param int $id id of resource
|
* @param int $res_id id of resource
|
||||||
* @return bool succsess or not
|
* @return bool succsess or not
|
||||||
*/
|
*/
|
||||||
function remove_picture($id)
|
function remove_picture($res_id)
|
||||||
{
|
{
|
||||||
$vfs_data = array('string' => $this->pictures_dir.$id.'.jpg','relatives' => array(RELATIVE_ROOT));
|
$vfs_data = array('string' => $this->pictures_dir.$res_id.'.jpg','relatives' => array(RELATIVE_ROOT));
|
||||||
$this->vfs->override_acl = 1;
|
$this->vfs->override_acl = 1;
|
||||||
if($this->vfs->file_exists($vfs_data))
|
if($this->vfs->file_exists($vfs_data))
|
||||||
{
|
{
|
||||||
$this->vfs->rm($vfs_data);
|
$this->vfs->rm($vfs_data);
|
||||||
$vfs_data['string'] = $this->thumbs_dir.$id.'.jpg';
|
$vfs_data['string'] = $this->thumbs_dir.$res_id.'.jpg';
|
||||||
$this->vfs->rm($vfs_data);
|
$this->vfs->rm($vfs_data);
|
||||||
}
|
}
|
||||||
$this->vfs->override_acl = 0;
|
$this->vfs->override_acl = 0;
|
||||||
|
@ -23,16 +23,16 @@ class so_resources extends so_sql
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the value of $key from resource of $id
|
* gets the value of $key from resource of $res_id
|
||||||
*
|
*
|
||||||
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
||||||
* @param string $key key of value to get
|
* @param string $key key of value to get
|
||||||
* @param int $id resource id
|
* @param int $res_id resource id
|
||||||
* @return mixed value of key and resource, false if key or id not found.
|
* @return mixed value of key and resource, false if key or id not found.
|
||||||
*/
|
*/
|
||||||
function get_value($key,$id)
|
function get_value($key,$res_id)
|
||||||
{
|
{
|
||||||
if($this->db->select($this->table_name,$key,array('id' => $id),__LINE__,__FILE__))
|
if($this->db->select($this->table_name,$key,array('res_id' => $res_id),__LINE__,__FILE__))
|
||||||
{
|
{
|
||||||
$value = $this->db->row(row);
|
$value = $this->db->row(row);
|
||||||
return $value[$key];
|
return $value[$key];
|
||||||
@ -50,7 +50,7 @@ class so_resources extends so_sql
|
|||||||
function save($resource)
|
function save($resource)
|
||||||
{
|
{
|
||||||
$this->data = $resource;
|
$this->data = $resource;
|
||||||
return parent::save() == 0 ? $this->data['id'] : false;
|
return parent::save() == 0 ? $this->data['res_id'] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,7 @@ class ui_resources
|
|||||||
$content['nm']['no_filter2'] = true;
|
$content['nm']['no_filter2'] = true;
|
||||||
$content['nm']['filter_no_lang'] = true;
|
$content['nm']['filter_no_lang'] = true;
|
||||||
$content['nm']['no_cat'] = true;
|
$content['nm']['no_cat'] = true;
|
||||||
|
$content['nm']['bottom_too'] = true;
|
||||||
$content['nm']['order'] = 'name';
|
$content['nm']['order'] = 'name';
|
||||||
$content['nm']['sort'] = 'ASC';
|
$content['nm']['sort'] = 'ASC';
|
||||||
|
|
||||||
@ -124,7 +125,7 @@ class ui_resources
|
|||||||
|
|
||||||
if($content['nm']['view_accs_of'])
|
if($content['nm']['view_accs_of'])
|
||||||
{
|
{
|
||||||
$master = $this->bo->so->read(array('id' => $content['nm']['view_accs_of']));
|
$master = $this->bo->so->read(array('res_id' => $content['nm']['view_accs_of']));
|
||||||
$content['view_accs_of'] = $content['nm']['view_accs_of'];
|
$content['view_accs_of'] = $content['nm']['view_accs_of'];
|
||||||
$content['nm']['get_rows'] = 'resources.bo_resources.get_rows';
|
$content['nm']['get_rows'] = 'resources.bo_resources.get_rows';
|
||||||
$content['nm']['no_filter'] = true;
|
$content['nm']['no_filter'] = true;
|
||||||
@ -166,7 +167,7 @@ class ui_resources
|
|||||||
if(isset($content['delete']))
|
if(isset($content['delete']))
|
||||||
{
|
{
|
||||||
unset($content['delete']);
|
unset($content['delete']);
|
||||||
$content['msg'] = $this->bo->delete($content['id']);
|
$content['msg'] = $this->bo->delete($content['res_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($content['msg'])
|
if($content['msg'])
|
||||||
@ -182,25 +183,25 @@ class ui_resources
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$id = $content;
|
$res_id = $content;
|
||||||
if (isset($_GET['id'])) $id = $_GET['id'];
|
if (isset($_GET['res_id'])) $res_id = $_GET['res_id'];
|
||||||
if (isset($_GET['accessory_of'])) $accessory_of = $_GET['accessory_of'];
|
if (isset($_GET['accessory_of'])) $accessory_of = $_GET['accessory_of'];
|
||||||
$content = array('id' => $id);
|
$content = array('res_id' => $res_id);
|
||||||
|
|
||||||
if ($id > 0)
|
if ($res_id > 0)
|
||||||
{
|
{
|
||||||
$content = $this->bo->read($id);
|
$content = $this->bo->read($res_id);
|
||||||
$content['gen_src_list'] = strstr($content['picture_src'],'.') ? $content['picture_src'] : false;
|
$content['gen_src_list'] = strstr($content['picture_src'],'.') ? $content['picture_src'] : false;
|
||||||
$content['picture_src'] = strstr($content['picture_src'],'.') ? 'gen_src' : $content['picture_src'];
|
$content['picture_src'] = strstr($content['picture_src'],'.') ? 'gen_src' : $content['picture_src'];
|
||||||
$content['link_to'] = array(
|
$content['link_to'] = array(
|
||||||
'to_id' => $id,
|
'to_id' => $res_id,
|
||||||
'to_app' => 'resources'
|
'to_app' => 'resources'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// some presetes
|
// some presetes
|
||||||
$content['resource_picture'] = $this->bo->get_picture($content['id'],$content['picture_src'],$size=true);
|
$content['resource_picture'] = $this->bo->get_picture($content['res_id'],$content['picture_src'],$size=true);
|
||||||
$content['quantity'] = $content['quantity'] ? $content['quantity'] : 1;
|
$content['quantity'] = $content['quantity'] ? $content['quantity'] : 1;
|
||||||
$content['useable'] = $content['useable'] ? $content['useable'] : 1;
|
$content['useable'] = $content['useable'] ? $content['useable'] : 1;
|
||||||
$content['accessory_of'] = $accessory_of;
|
$content['accessory_of'] = $accessory_of;
|
||||||
@ -216,7 +217,7 @@ class ui_resources
|
|||||||
$sel_options['cat_id'] = array($catofmaster => $sel_options['cat_id'][$catofmaster]);
|
$sel_options['cat_id'] = array($catofmaster => $sel_options['cat_id'][$catofmaster]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$content['general|page|pictures|links|calendar'] = 'resources.edit_tabs.page'; //debug
|
// $content['general|page|pictures|links|calendar'] = 'resources.edit_tabs.page'; //debug
|
||||||
$no_button = array(); // TODO: show delete button only if allowed to delete resource
|
$no_button = array(); // TODO: show delete button only if allowed to delete resource
|
||||||
$preserv = $content;
|
$preserv = $content;
|
||||||
$this->tmpl->read('resources.edit');
|
$this->tmpl->read('resources.edit');
|
||||||
@ -251,23 +252,23 @@ class ui_resources
|
|||||||
/**
|
/**
|
||||||
* showes a single resource
|
* showes a single resource
|
||||||
*
|
*
|
||||||
* @param int $id resource id
|
* @param int $res_id resource id
|
||||||
* @author Lukas Weiss <wnz.gh05t@users.sourceforge.net>
|
* @author Lukas Weiss <wnz.gh05t@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
function show($id=0)
|
function show($res_id=0)
|
||||||
{
|
{
|
||||||
if (isset($_GET['id'])) $id = $_GET['id'];
|
if (isset($_GET['res_id'])) $res_id = $_GET['res_id'];
|
||||||
|
|
||||||
$content = array('id' => $id);
|
$content = array('res_id' => $res_id);
|
||||||
$content = $this->bo->read($id);
|
$content = $this->bo->read($res_id);
|
||||||
$content['gen_src_list'] = strstr($content['picture_src'],'.') ? $content['picture_src'] : false;
|
$content['gen_src_list'] = strstr($content['picture_src'],'.') ? $content['picture_src'] : false;
|
||||||
$content['picture_src'] = strstr($content['picture_src'],'.') ? 'gen_src' : $content['picture_src'];
|
$content['picture_src'] = strstr($content['picture_src'],'.') ? 'gen_src' : $content['picture_src'];
|
||||||
$content['link_to'] = array(
|
$content['link_to'] = array(
|
||||||
'to_id' => $id,
|
'to_id' => $res_id,
|
||||||
'to_app' => 'resources'
|
'to_app' => 'resources'
|
||||||
);
|
);
|
||||||
|
|
||||||
$content['resource_picture'] = $this->bo->get_picture($content['id'],$content['picture_src'],$size=true);
|
$content['resource_picture'] = $this->bo->get_picture($content['res_id'],$content['picture_src'],$size=true);
|
||||||
$content['quantity'] = $content['quantity'] ? $content['quantity'] : 1;
|
$content['quantity'] = $content['quantity'] ? $content['quantity'] : 1;
|
||||||
$content['useable'] = $content['useable'] ? $content['useable'] : 1;
|
$content['useable'] = $content['useable'] ? $content['useable'] : 1;
|
||||||
|
|
||||||
@ -287,7 +288,7 @@ class ui_resources
|
|||||||
$content['description'] = chop($content['long_description']) ? $content['long_description'] : (chop($content['short_description']) ? $content['short_description'] : lang("no description available"));
|
$content['description'] = chop($content['long_description']) ? $content['long_description'] : (chop($content['short_description']) ? $content['short_description'] : lang("no description available"));
|
||||||
$content['description'] = $content['description'] ? $content['description'] : lang('no description available');
|
$content['description'] = $content['description'] ? $content['description'] : lang('no description available');
|
||||||
$content['link_to'] = array(
|
$content['link_to'] = array(
|
||||||
'to_id' => $id,
|
'to_id' => $res_id,
|
||||||
'to_app' => 'resources'
|
'to_app' => 'resources'
|
||||||
);
|
);
|
||||||
$sel_options = array();
|
$sel_options = array();
|
||||||
@ -421,18 +422,6 @@ class ui_resources
|
|||||||
$no_button = array();
|
$no_button = array();
|
||||||
$this->tmpl->read('resources.resource_select');
|
$this->tmpl->read('resources.resource_select');
|
||||||
$this->tmpl->exec('resources.ui_resources.select',$content,$sel_options,$no_button,$preserv,2);
|
$this->tmpl->exec('resources.ui_resources.select',$content,$sel_options,$no_button,$preserv,2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* deletes a resource (lets do this only in bo ok?)
|
|
||||||
*
|
|
||||||
* @param int $id resource id
|
|
||||||
* @author Lukas Weiss <wnz.gh05t@users.sourceforge.net>
|
|
||||||
*/
|
|
||||||
/* function delete($id)
|
|
||||||
{
|
|
||||||
$this->bo->delete($id);
|
|
||||||
return $this->index();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
$setup_info['resources']['name'] = 'resources';
|
$setup_info['resources']['name'] = 'resources';
|
||||||
$setup_info['resources']['title'] = 'resources';
|
$setup_info['resources']['title'] = 'resources';
|
||||||
$setup_info['resources']['version'] = '0.0.1.017';
|
$setup_info['resources']['version'] = '0.0.1.020';
|
||||||
$setup_info['resources']['app_order'] = 1;
|
$setup_info['resources']['app_order'] = 1;
|
||||||
$setup_info['resources']['tables'] = array('egw_resources');
|
$setup_info['resources']['tables'] = array('egw_resources');
|
||||||
$setup_info['resources']['enable'] = 1;
|
$setup_info['resources']['enable'] = 1;
|
||||||
@ -68,3 +68,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
$phpgw_baseline = array(
|
$phpgw_baseline = array(
|
||||||
'egw_resources' => array(
|
'egw_resources' => array(
|
||||||
'fd' => array(
|
'fd' => array(
|
||||||
'id' => array('type' => 'auto'),
|
'res_id' => array('type' => 'auto'),
|
||||||
'name' => array('type' => 'varchar','precision' => '100'),
|
'name' => array('type' => 'varchar','precision' => '100'),
|
||||||
'short_description' => array('type' => 'varchar','precision' => '100'),
|
'short_description' => array('type' => 'varchar','precision' => '100'),
|
||||||
'cat_id' => array('type' => 'int','precision' => '11','nullable' => False),
|
'cat_id' => array('type' => 'int','precision' => '11','nullable' => False),
|
||||||
@ -28,9 +28,11 @@
|
|||||||
'prize' => array('type' => 'varchar','precision' => '200'),
|
'prize' => array('type' => 'varchar','precision' => '200'),
|
||||||
'long_description' => array('type' => 'longtext'),
|
'long_description' => array('type' => 'longtext'),
|
||||||
'picture_src' => array('type' => 'varchar','precision' => '20'),
|
'picture_src' => array('type' => 'varchar','precision' => '20'),
|
||||||
'accessory_of' => array('type' => 'int','precision' => '11','default' => '-1')
|
'accessory_of' => array('type' => 'int','precision' => '11','default' => '-1'),
|
||||||
|
'storage_info' => array('type' => 'varchar','precision' => '200'),
|
||||||
|
'inventory_number' => array('type' => 'varchar','precision' => '20')
|
||||||
),
|
),
|
||||||
'pk' => array('id'),
|
'pk' => array('res_id'),
|
||||||
'fk' => array(),
|
'fk' => array(),
|
||||||
'ix' => array(),
|
'ix' => array(),
|
||||||
'uc' => array()
|
'uc' => array()
|
||||||
|
@ -204,4 +204,61 @@
|
|||||||
$GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.017';
|
$GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.017';
|
||||||
return $GLOBALS['setup_info']['resources']['currentver'];
|
return $GLOBALS['setup_info']['resources']['currentver'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$test[] = '0.0.1.017';
|
||||||
|
function resources_upgrade0_0_1_017()
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw_setup']->oProc->RenameColumn('egw_resources','id','res_id');
|
||||||
|
$GLOBALS['phpgw_setup']->oProc->RefreshTable('egw_resources',array(
|
||||||
|
'fd' => array(
|
||||||
|
'res_id' => array('type' => 'auto'),
|
||||||
|
'name' => array('type' => 'varchar','precision' => '100'),
|
||||||
|
'short_description' => array('type' => 'varchar','precision' => '100'),
|
||||||
|
'cat_id' => array('type' => 'int','precision' => '11','nullable' => False),
|
||||||
|
'quantity' => array('type' => 'int','precision' => '11','default' => '1'),
|
||||||
|
'useable' => array('type' => 'int','precision' => '11','default' => '1'),
|
||||||
|
'location' => array('type' => 'varchar','precision' => '100'),
|
||||||
|
'bookable' => array('type' => 'varchar','precision' => '1'),
|
||||||
|
'buyable' => array('type' => 'varchar','precision' => '1'),
|
||||||
|
'prize' => array('type' => 'varchar','precision' => '200'),
|
||||||
|
'long_description' => array('type' => 'longtext'),
|
||||||
|
'picture_src' => array('type' => 'varchar','precision' => '20'),
|
||||||
|
'accessory_of' => array('type' => 'int','precision' => '11','default' => '-1')
|
||||||
|
),
|
||||||
|
'pk' => array('res_id'),
|
||||||
|
'fk' => array(),
|
||||||
|
'ix' => array(),
|
||||||
|
'uc' => array()
|
||||||
|
));
|
||||||
|
|
||||||
|
$GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.018';
|
||||||
|
return $GLOBALS['setup_info']['resources']['currentver'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$test[] = '0.0.1.018';
|
||||||
|
function resources_upgrade0_0_1_018()
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','storage_info',array(
|
||||||
|
'type' => 'varchar',
|
||||||
|
'precision' => '200'
|
||||||
|
));
|
||||||
|
|
||||||
|
$GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.019';
|
||||||
|
return $GLOBALS['setup_info']['resources']['currentver'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$test[] = '0.0.1.019';
|
||||||
|
function resources_upgrade0_0_1_019()
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','inventory_number',array(
|
||||||
|
'type' => 'varchar',
|
||||||
|
'precision' => '20'
|
||||||
|
));
|
||||||
|
|
||||||
|
$GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.020';
|
||||||
|
return $GLOBALS['setup_info']['resources']['currentver'];
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user