make get_pictures work with vfs (thanks to ralf)

This commit is contained in:
Cornelius Weiß 2005-02-16 14:50:17 +00:00
parent c04582258f
commit e4113948fc
3 changed files with 28 additions and 28 deletions

View File

@ -14,15 +14,17 @@ TODO:
- list - list
2 rows each entry 2 rows each entry
read pics via vfs (waiting for eTemplate --> Ralf)
don't translate cats in header (eTemplate bug --> Ralf) don't translate cats in header (eTemplate bug --> Ralf)
handle cats and general pics (waiting for cats picures in api) handle cats and general pics (waiting for cats picures in api)
-edit / add -edit / add
read pic via vfs (waiting for eTemplate --> Ralf)
handle cats and general pics (waiting for cats picures in api) handle cats and general pics (waiting for cats picures in api)
add accessories functionality add accessories functionality
add prize functionality add prize functionality
add location functionality add location functionality
bug: loose html and picture on tab-switch (eTemplate bug --> Ralf) bug: loose html and picture on tab-switch (eTemplate bug --> Ralf)
use eTemplates input validation
----
if basics are working --> make it scheudable (meeting with ralf)

View File

@ -28,7 +28,7 @@ class bo_resources
$this->cats = $this->acl->egw_cats; $this->cats = $this->acl->egw_cats;
$this->vfs = CreateObject('phpgwapi.vfs'); $this->vfs = CreateObject('phpgwapi.vfs');
// print_r($this->cats->return_array('all',0)); die(); // print_r($this->cats->return_single(33)); die();
} }
/*! /*!
@ -73,16 +73,7 @@ class bo_resources
{ {
$readonlys["bookable[$resource[id]]"] = true; $readonlys["bookable[$resource[id]]"] = true;
} }
$rows[$num]['picture_thumb'] = $this->get_picture($resource['id'],$resource['picture_src']);
if($resource['picture_src'] == 'own_src')
{
$rows[$num]['picture_thumb'] = $GLOBALS['phpgw_info']['server']['webserver_url']. '/resources/pictures/thumbs/'.$resource['id'].'.jpg';
}
else
{
$rows[$num]['picture_thumb'] = 'generic.png';
}
} }
return $nr; return $nr;
} }
@ -244,20 +235,28 @@ class bo_resources
return; return;
} }
/*!
function get_images($params) @function get_picture
@abstact get resource picture either from vfs or from symlink
@param int $id id of resource
@param string $src can be: own_src, gen_src, cat_scr
@param bool $size false = thumb, true = full pic
@return string url of picture
*/
function get_picture($id,$src,$size=false)
{ {
$id = implode($params); switch($src)
$picture = $this->so->get_value('picture_thumb',$id);
if($picture)
{ {
// $picture = GD($picture); case 'own_src':
header('Content-type: image/png'); $picture = false /*$this->config->use_vfs*/ ? 'vfs:' : $GLOBALS['phpgw_info']['server']['webserver_url'];
echo $picture; $picture .= $size ? $this->pictures_dir.$id.'.jpg' : $this->thumbs_dir.$id.'.jpg';
break;
case 'gen_src':
case 'cat_src':
default :
$picture = 'generic.png';
} }
header('Content-type: image/png'); return $picture;
echo file_get_contents(PHPGW_INCLUDE_ROOT.'/resources/templates/default/images/generic.png');
return;
} }
} }

View File

@ -126,15 +126,14 @@ class ui_resources
{ {
$preserv = array('id' => $content); $preserv = array('id' => $content);
$content = $this->bo->read($content); $content = $this->bo->read($content);
$content['resource_picture'] = $GLOBALS['phpgw_info']['server']['webserver_url']. '/resources/pictures/'.$content['id'].'.jpg';
} }
else else
{ {
$content = array(); $content = array();
$content['resource_picture'] = 'generic.png';
} }
$content['resource_picture'] = $this->bo->get_picture($content['id'],$content['picture_src'],$size=true);
$content['msg'] = $msg; $content['msg'] = $msg;
$preserv = $preserv + $content; $preserv = (array)$preserv + $content; // debug for eTemplate tabs don't know if really needed atm.
$this->tmpl->read('resources.edit'); $this->tmpl->read('resources.edit');
$this->tmpl->exec('resources.ui_resources.edit',$content,$sel_options,$no_button,$preserv); $this->tmpl->exec('resources.ui_resources.edit',$content,$sel_options,$no_button,$preserv);