hopfully finished work on pictures :-)

This commit is contained in:
Cornelius Weiß 2005-02-17 11:17:19 +00:00
parent 811d0fe37c
commit b8e3a6719c
4 changed files with 42 additions and 14 deletions

View File

@ -48,8 +48,7 @@ class bo_resources
'useable' => '',
'bookable' => '',
'cat_id' => '',
'location' => '',
'picture_src' => ''
'location' => ''
));
$order_by = $query['order'] ? $query['order'].' '. $query['sort'] : '';
@ -69,7 +68,7 @@ class bo_resources
{
$readonlys["bookable[$resource[id]]"] = true;
}
$rows[$num]['picture_thumb'] = $this->get_picture($resource['id'],$resource['picture_src']);
$rows[$num]['picture_thumb'] = $this->get_picture($resource['id']);
}
return $nr;
}
@ -129,6 +128,7 @@ class bo_resources
case 'cat_src':
break;
case 'gen_src':
$resource['picture_src'] = $resource['gen_src_list'];
break;
default:
if($resource['own_file']['size'] > 0)
@ -265,12 +265,16 @@ class bo_resources
@abstact get resource picture either from vfs or from symlink
@autor Cornelius Weiß <egw@von-und-zu-weiss.de>
@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)
function get_picture($id,$size=false)
{
if ($id > 0)
{
$src = $this->so->get_value('picture_src',$id);
}
switch($src)
{
case 'own_src':
@ -288,7 +292,7 @@ class bo_resources
case 'gen_src':
default :
$picture = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->resource_icons;
$picture .= strstr($scr,'.') ? $scr : 'generic.png';
$picture .= strstr($src,'.') ? $src : 'generic.png';
}
return $picture;
}
@ -312,6 +316,25 @@ class bo_resources
}
$this->vfs->override_acl = 0;
}
/*!
@fuction get_genpicturelist
@abstract gets all pictures from 'generic picutres dir' in selectbox style for eTemplate
@autor Cornelius Weiß <egw@von-und-zu-weiss.de>
@return array directory contens in eTemplates selectbox style
*/
function get_genpicturelist()
{
$icons['generic.png'] = lang('gernal resource');
$dir = dir(PHPGW_SERVER_ROOT.$this->resource_icons);
while($file = $dir->read())
{
if (preg_match('/\\.(png|gif|jpe?g)$/i',$file) && $file != 'generic.png')
{
$icons[$file] = substr($file,0,strpos($file,'.'));
}
}
$dir->close();
return $icons;
}
}

View File

@ -95,7 +95,10 @@ class ui_resources
*/
function edit($content='',$msg='')
{
$sel_options = array('cat_id' => $this->bo->acl->get_cats(PHPGW_ACL_ADD));
$sel_options = array(
'cat_id' => $this->bo->acl->get_cats(PHPGW_ACL_ADD),
'gen_src_list' => $this->bo->get_genpicturelist()
);
$no_button = array();
if (is_array($content))
@ -128,6 +131,8 @@ class ui_resources
{
$preserv = array('id' => $content);
$content = $this->bo->read($content);
$content['gen_src_list'] = strstr($content['picture_src'],'.') ? $content['picture_src'] : false;
$content['picture_src'] = strstr($content['picture_src'],'.') ? 'gen_src' : $content['picture_src'];
}
else
{

View File

@ -1,5 +1,5 @@
<?php
// eTemplates for Application 'resources', generated by etemplate.dump() 2005-02-16 09:42
// eTemplates for Application 'resources', generated by etemplate.dump() 2005-02-17 12:14
/* $Id$ */
@ -11,7 +11,7 @@ $templ_data[] = array('name' => 'resources.edit','template' => '','lang' => '','
$templ_data[] = array('name' => 'resources.edit_buttons','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:5:{s:4:\"type\";s:4:\"grid\";s:4:\"data\";a:2:{i:0;a:1:{s:1:\"C\";s:4:\"100%\";}i:1;a:3:{s:1:\"A\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:4:\"Save\";s:4:\"name\";s:4:\"save\";s:4:\"help\";s:21:\"Saves entry and exits\";}s:1:\"B\";a:3:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:6:\"Cancel\";s:4:\"name\";s:6:\"cancel\";}s:1:\"C\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:6:\"Delete\";s:5:\"align\";s:5:\"right\";s:4:\"name\";s:6:\"delete\";}}}s:4:\"rows\";i:1;s:4:\"cols\";i:3;s:4:\"size\";s:4:\"100%\";}}','size' => '100%','style' => '','modified' => '1093597552',);
$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:2:{s:4:\"type\";s:6:\"select\";s:4:\"name\";s:12:\"gen_scr_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' => '1108466336',);
$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:5:{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:4:{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:1:\"B\";a:6:{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: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:60:\"General|Accessories|Pictures|Page|Location|Prizeing|Calendar\";s:4:\"name\";s:60:\"general|accessories|pictures|page|location|prizeing|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;s:4:\"size\";s:4:\"100%\";}}','size' => '100%','style' => '','modified' => '1107959809',);

View File

@ -1,5 +1,5 @@
<?php
// eTemplates for Application 'resources', generated by etemplate.dump() 2005-02-16 09:36
// eTemplates for Application 'resources', generated by etemplate.dump() 2005-02-17 12:13
/* $Id$ */
@ -11,7 +11,7 @@ $templ_data[] = array('name' => 'resources.edit','template' => '','lang' => '','
$templ_data[] = array('name' => 'resources.edit_buttons','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:5:{s:4:\"type\";s:4:\"grid\";s:4:\"data\";a:2:{i:0;a:1:{s:1:\"C\";s:4:\"100%\";}i:1;a:3:{s:1:\"A\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:4:\"Save\";s:4:\"name\";s:4:\"save\";s:4:\"help\";s:21:\"Saves entry and exits\";}s:1:\"B\";a:3:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:6:\"Cancel\";s:4:\"name\";s:6:\"cancel\";}s:1:\"C\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:6:\"Delete\";s:5:\"align\";s:5:\"right\";s:4:\"name\";s:6:\"delete\";}}}s:4:\"rows\";i:1;s:4:\"cols\";i:3;s:4:\"size\";s:4:\"100%\";}}','size' => '100%','style' => '','modified' => '1093597552',);
$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:2:{s:4:\"type\";s:6:\"select\";s:4:\"name\";s:12:\"gen_scr_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' => '1108466336',);
$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:4:{s:4:\"type\";s:6:\"select\";s:4:\"size\";s:16:\"general resource\";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' => '1108637208',);
$templ_data[] = array('name' => 'resources.edit_tabs','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:5:{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:4:{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:1:\"B\";a:6:{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: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:60:\"General|Accessories|Pictures|Page|Location|Prizeing|Calendar\";s:4:\"name\";s:60:\"general|accessories|pictures|page|location|prizeing|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;s:4:\"size\";s:4:\"100%\";}}','size' => '100%','style' => '','modified' => '1107959809',);
@ -19,7 +19,7 @@ $templ_data[] = array('name' => 'resources.edit_tabs.general','template' => '','
$templ_data[] = array('name' => 'resources.edit_tabs.page','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:5:{s:4:\"type\";s:4:\"grid\";s:4:\"data\";a:2:{i:0;a:0:{}i:1;a:1:{s:1:\"A\";a:3:{s:4:\"type\";s:8:\"htmlarea\";s:4:\"name\";s:16:\"long_description\";s:4:\"help\";s:26:\"Web-Site for this resource\";}}}s:4:\"rows\";i:1;s:4:\"cols\";i:1;s:4:\"size\";s:4:\"100%\";}}','size' => '100%','style' => '','modified' => '1093599237',);
$templ_data[] = array('name' => 'resources.edit_tabs.pictures','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:\"type\";s:4:\"grid\";s:4:\"data\";a:3:{i:0;a:0:{}i:1;a:2:{s:1:\"A\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"B\";a:2:{s:4:\"type\";s:5:\"label\";s:4:\"size\";s:1:\"b\";}}i:2;a:2:{s:1:\"A\";a:3:{s:4:\"type\";s:5:\"image\";s:5:\"align\";s:6:\"center\";s:4:\"name\";s:16:\"resource_picture\";}s:1:\"B\";a:5:{s:4:\"type\";s:8:\"groupbox\";s:4:\"size\";s:1:\"2\";s:5:\"label\";s:14:\"picture source\";i:1;a:1:{s:4:\"type\";s:5:\"label\";}i:2;a:2:{s:4:\"type\";s:8:\"template\";s:4:\"name\";s:23:\"resources.edit_pictures\";}}}}s:4:\"rows\";i:2;s:4:\"cols\";i:2;}}','size' => '','style' => '','modified' => '1108542990',);
$templ_data[] = array('name' => 'resources.edit_tabs.pictures','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:\"type\";s:4:\"grid\";s:4:\"data\";a:2:{i:0;a:1:{s:2:\"c1\";s:4:\",top\";}i:1;a:2:{s:1:\"A\";a:3:{s:4:\"type\";s:5:\"image\";s:5:\"align\";s:6:\"center\";s:4:\"name\";s:16:\"resource_picture\";}s:1:\"B\";a:5:{s:4:\"type\";s:8:\"groupbox\";s:4:\"size\";s:1:\"2\";s:5:\"label\";s:14:\"picture source\";i:1;a:1:{s:4:\"type\";s:5:\"label\";}i:2;a:2:{s:4:\"type\";s:8:\"template\";s:4:\"name\";s:23:\"resources.edit_pictures\";}}}}s:4:\"rows\";i:1;s:4:\"cols\";i:2;}}','size' => '','style' => '','modified' => '1108543308',);
$templ_data[] = array('name' => 'resources.show','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:\"type\";s:4:\"grid\";s:4:\"data\";a:3:{i:0;a:1:{s:1:\"A\";s:4:\"100%\";}i:1;a:1:{s:1:\"A\";a:4:{s:4:\"type\";s:9:\"nextmatch\";s:4:\"size\";s:19:\"resources.show.rows\";s:7:\"no_lang\";s:1:\"1\";s:4:\"name\";s:2:\"nm\";}}i:2;a:1:{s:1:\"A\";a:3:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:3:\"Add\";s:4:\"name\";s:3:\"add\";}}}s:4:\"rows\";i:2;s:4:\"cols\";i:1;}}','size' => '','style' => '','modified' => '1108479422',);