work on multiselection actions in index dialog

This commit is contained in:
Cornelius Weiß 2005-06-13 09:18:06 +00:00
parent 74b50f5dea
commit 9cc02bf68b
2 changed files with 44 additions and 31 deletions

View File

@ -39,7 +39,7 @@ class bo_resources
/**
* get rows for resources list
*
* Cornelius Weiß <egw@von-und-zu-weiss.de>
* Cornelius Weiss <egw@von-und-zu-weiss.de>
*/
function get_rows($query,&$rows,&$readonlys)
{
@ -107,7 +107,7 @@ class bo_resources
/**
* reads a resource exept binary datas
*
* Cornelius Weiß <egw@von-und-zu-weiss.de>
* Cornelius Weiss <egw@von-und-zu-weiss.de>
* @param int $id resource id
* @return array with key => value or false if not found or allowed
*/
@ -125,7 +125,7 @@ class bo_resources
/**
* saves a resource. pictures are saved in vfs
*
* Cornelius Weiß <egw@von-und-zu-weiss.de>
* Cornelius Weiss <egw@von-und-zu-weiss.de>
* @param array $resource array with key => value of all needed datas
* @return string msg if somthing went wrong; nothing if all right
*/
@ -213,7 +213,7 @@ class bo_resources
/**
* gets list of accessories for resource
*
* Cornelius Weiß <egw@von-und-zu-weiss.de>
* Cornelius Weiss <egw@von-und-zu-weiss.de>
* @param int $id id of resource
* @return array
*/
@ -230,7 +230,7 @@ class bo_resources
/**
* returns info about resource for calender
* @author Cornelius Weiß <egw@von-und-zu-weiss.de>
* @author Cornelius Weiß <egw@von-und-zu-weiss.de>
* @param int/array $res_id single id or array $num => $res_id
* @return array
*/
@ -258,7 +258,7 @@ class bo_resources
/**
* returns status for a new calendar entry depending on resources ACL
* @author Cornelius Weiß <egw@von-und-zu-weiss.de>
* @author Cornelius Weiss <egw@von-und-zu-weiss.de>
* @param int/array $res_id single id or array $num => $res_id
* @return array
*/
@ -270,7 +270,7 @@ class bo_resources
}
/**
* @author Cornelius Weiß <egw@von-und-zu-weiss.de>
* @author Cornelius Weiss <egw@von-und-zu-weiss.de>
* query infolog for entries matching $pattern
*
*/
@ -290,7 +290,7 @@ class bo_resources
}
/**
* @author Cornelius Weiß <egw@von-und-zu-weiss.de>
* @author Cornelius Weiss <egw@von-und-zu-weiss.de>
* get title for an infolog entry identified by $id
*
*/
@ -307,7 +307,7 @@ class bo_resources
/**
* resizes and saves an pictures in vfs
*
* Cornelius Weiß <egw@von-und-zu-weiss.de>
* Cornelius Weiss <egw@von-und-zu-weiss.de>
* @param array $file array with key => value
* @param int $resource_id
* @return mixed string with msg if somthing went wrong; nothing if all right
@ -411,7 +411,7 @@ class bo_resources
/**
* get resource picture either from vfs or from symlink
* Cornelius Weiß <egw@von-und-zu-weiss.de>
* Cornelius Weiss <egw@von-und-zu-weiss.de>
* @param int $id id of resource
* @param bool $size false = thumb, true = full pic
* @return string url of picture
@ -449,7 +449,7 @@ class bo_resources
* remove_picture
* removes picture from vfs
*
* Cornelius Weiß <egw@von-und-zu-weiss.de>
* Cornelius Weiss <egw@von-und-zu-weiss.de>
* @param int $id id of resource
* @return bool succsess or not
*/
@ -470,7 +470,7 @@ class bo_resources
* get_genpicturelist
* gets all pictures from 'generic picutres dir' in selectbox style for eTemplate
*
* Cornelius Weiß <egw@von-und-zu-weiss.de>
* Cornelius Weiss <egw@von-und-zu-weiss.de>
* @return array directory contens in eTemplates selectbox style
*/
function get_genpicturelist()

View File

@ -43,17 +43,33 @@ class ui_resources
/**
* main resources list.
*
* Cornelius Wei<EFBFBD> <egw@von-und-zu-weiss.de>
* Cornelius Weiss <egw@von-und-zu-weiss.de>
* @param array $content content from eTemplate callback
*
* FIXME don't translate cats in nextmach
*/
function index($content='')
{
// _debug_array($content);
if (is_array($content))
{//_debug_array($content);
{
$sessiondata = $content['nm'];
if (isset($content['back']))
{
unset($sessiondata['view_accs_of']);
$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$sessiondata);
return $this->index();
}
if (isset($content['btn_delete_selected']))
{
foreach($content['nm']['rows']['checkbox'] as $res_id)
{
$msg .= '<p>'. $this->bo->delete($res_id). '</p><br>';
}
return $this->index($msg);
}
if (isset($content['nm']['rows']))
{
unset($sessiondata['rows']);
@ -64,7 +80,7 @@ class ui_resources
{
case 'delete':
list($id) = each($content['nm']['rows']['delete']);
return $this->delete($id);
return $this->index($this->bo->delete($id));
case 'view_acc':
list($id) = each($content['nm']['rows']['view_acc']);
$sessiondata['view_accs_of'] = $id;
@ -73,16 +89,12 @@ class ui_resources
case 'buyable':
}
}
if (isset($content['back']))
{
unset($sessiondata['view_accs_of']);
$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$sessiondata);
return $this->index();
}
}
else
{
$msg = $content;
$content = array();
$content['msg'] = $msg;
$content['nm'] = $GLOBALS['egw']->session->appsession('session_data','resources_index_nm');
}
@ -125,7 +137,7 @@ class ui_resources
}
/**
* @author Cornelius Wei<EFBFBD> <egw@von-und-zu-weiss.de>
* @author Cornelius Weiss <egw@von-und-zu-weiss.de>
* invokes add or edit dialog for resources
*
* @param $content Content from the eTemplate Exec call or id on inital call
@ -149,7 +161,7 @@ class ui_resources
if(isset($content['delete']))
{
unset($content['delete']);
$content['msg'] = $this->delete($content['id']);
$content['msg'] = $this->bo->delete($content['id']);
}
if($content['msg'])
@ -209,7 +221,7 @@ class ui_resources
/**
* adminsection of resources
*
* @author Cornelius Wei<EFBFBD> <egw@von-und-zu-weiss.de>
* @author Cornelius Weiss <egw@von-und-zu-weiss.de>
*/
function admin($content='')
{
@ -246,8 +258,8 @@ class ui_resources
$content['picture_src'] = strstr($content['picture_src'],'.') ? 'gen_src' : $content['picture_src'];
$content['link_to'] = array(
'to_id' => $id,
'to_app' => 'resources'
);
'to_app' => 'resources'
);
$content['resource_picture'] = $this->bo->get_picture($content['id'],$content['picture_src'],$size=true);
$content['quantity'] = $content['quantity'] ? $content['quantity'] : 1;
@ -255,17 +267,17 @@ class ui_resources
$content['quantity'] = ($content['useable'] == $content['quantity']) ? $content['quantity'] : $content['quantity'].' ('.lang('useable').' '.$content['useable'].')';
//$sel_options['gen_src_list'] = $this->bo->get_genpicturelist();
//$sel_options['gen_src_list'] = $this->bo->get_genpicturelist();
$content['cat_name'] = $this->bo->acl->get_cat_name($content['cat_id']);
$content['cat_admin'] = $this->bo->acl->get_cat_admin($content['cat_id']);
/* if($content['accessory_of'] > 0)
/* if($content['accessory_of'] > 0)
{
$catofmaster = $this->bo->so->get_value('cat_id',$content['accessory_of']);
$sel_options['cat_id'] = array($catofmaster => $sel_options['cat_id'][$catofmaster]);
}
*/
*/
$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['link_to'] = array(
@ -406,14 +418,15 @@ class ui_resources
}
/**
* deletes a resource
* 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)
/* function delete($id)
{
$this->bo->delete($id);
return $this->index();
}
*/
}