diff --git a/resources/TODO b/resources/TODO index a5237eec70..d0fac8ecf4 100644 --- a/resources/TODO +++ b/resources/TODO @@ -14,15 +14,17 @@ TODO: - list 2 rows each entry - read pics via vfs (waiting for eTemplate --> Ralf) don't translate cats in header (eTemplate bug --> Ralf) handle cats and general pics (waiting for cats picures in api) -edit / add - read pic via vfs (waiting for eTemplate --> Ralf) handle cats and general pics (waiting for cats picures in api) add accessories functionality add prize functionality add location functionality bug: loose html and picture on tab-switch (eTemplate bug --> Ralf) - \ No newline at end of file + use eTemplates input validation + + +---- +if basics are working --> make it scheudable (meeting with ralf) \ No newline at end of file diff --git a/resources/inc/class.bo_resources.inc.php b/resources/inc/class.bo_resources.inc.php index 8970b918b7..919311d60a 100755 --- a/resources/inc/class.bo_resources.inc.php +++ b/resources/inc/class.bo_resources.inc.php @@ -28,7 +28,7 @@ class bo_resources $this->cats = $this->acl->egw_cats; $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; } - - 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'; - } + $rows[$num]['picture_thumb'] = $this->get_picture($resource['id'],$resource['picture_src']); } return $nr; } @@ -244,20 +235,28 @@ class bo_resources 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); - $picture = $this->so->get_value('picture_thumb',$id); - if($picture) + switch($src) { - // $picture = GD($picture); - header('Content-type: image/png'); - echo $picture; + case 'own_src': + $picture = false /*$this->config->use_vfs*/ ? 'vfs:' : $GLOBALS['phpgw_info']['server']['webserver_url']; + $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'); - echo file_get_contents(PHPGW_INCLUDE_ROOT.'/resources/templates/default/images/generic.png'); - return; + return $picture; } } diff --git a/resources/inc/class.ui_resources.inc.php b/resources/inc/class.ui_resources.inc.php index 968442e987..d27013ca98 100755 --- a/resources/inc/class.ui_resources.inc.php +++ b/resources/inc/class.ui_resources.inc.php @@ -126,15 +126,14 @@ class ui_resources { $preserv = array('id' => $content); $content = $this->bo->read($content); - $content['resource_picture'] = $GLOBALS['phpgw_info']['server']['webserver_url']. '/resources/pictures/'.$content['id'].'.jpg'; } else { $content = array(); - $content['resource_picture'] = 'generic.png'; } + $content['resource_picture'] = $this->bo->get_picture($content['id'],$content['picture_src'],$size=true); $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->exec('resources.ui_resources.edit',$content,$sel_options,$no_button,$preserv);