Add mime type icons and thumbnail previews to link list

This commit is contained in:
Nathan Gray 2007-10-15 17:27:25 +00:00
parent e3a1390b6c
commit 4bf66e6f89
4 changed files with 59 additions and 1 deletions

View File

@ -109,6 +109,13 @@
</td>
</tr>
<tr class="row_off">
<td>{lang_How_big_should_thumbnails_for_linked_images_be_(maximum_in_pixels)_?}:</td>
<td>
<input name="newsettings[link_list_thumbnail]" value="{value_link_list_thumbnail}" size="5">
</td>
</tr>
<tr class="th">
<td colspan="2">&nbsp;<b>{lang_security}</b></td>
</tr>

View File

@ -325,6 +325,7 @@
{
$value[$row] = $link;
$value[$row]['title'] = $this->link->title($link['app'],$link['id'],$link);
$value[$row]['mime_icon'] = '';
if (!is_array($link['id']))
{
$value[$row]['view'] = $this->link->view($link['app'],$link['id'],$link);
@ -338,12 +339,36 @@
{
$value[$row]['label'] = 'Delete';
$value[$row]['help'] = lang('Delete this file');
// Get mimetype and thumbnail
if(in_array($GLOBALS['egw_info']['user']['preferences']['common']['link_list_format'], array('icons', 'icons_and_text') )) {
$value[$row]['mime_icon'] = ExecMethod2('filemanager.uifilemanager.mime_icon', $value[$row]['type']);
}
if($GLOBALS['egw_info']['user']['preferences']['common']['link_list_thumbnail'] && $GLOBALS['egw_info']['server']['link_list_thumbnail'] > 0) {
list($image) = explode('/', $value[$row]['type']);
if($image == 'image') {
$value[$row]['thumbnail'] = '<img src="' .
$GLOBALS['egw_info']['server']['webserver_url'].
'/etemplate/inc/thumbnail.inc.php?image=' .
$this->link->vfs_path(
$value[$row]['view']['app'], $value[$row]['view']['id'], $value[$row]['view']['filename']
) . '" />';
}
}
}
else
{
if(in_array($GLOBALS['egw_info']['user']['preferences']['common']['link_list_format'], array('icons', 'icons_and_text') )) {
// Hardcoded sizes to match the mimetype icons. Uses the navbar image and CSS to resize.
$value[$row]['mime_icon'] = $tmpl->html->image($value[$row]['app'], 'navbar', $value[$row]['app'], 'style="width: 16px; height: 16px;"');
}
$value[$row]['label'] = 'Unlink';
$value[$row]['help'] = lang('Remove this link (not the entry itself)');
}
// Remove appname if they only want icons
if($value[$row]['mime_icon'] && $GLOBALS['egw_info']['user']['preferences']['common']['link_list_format'] == 'icons') {
$value[$row]['app'] = '';
}
}
break;

View File

@ -2,7 +2,7 @@
/**
* eGroupWare - eTemplates for Application etemplate
* http://www.egroupware.org
* generated by soetemplate::dump4setup() 2007-09-22 17:04
* generated by soetemplate::dump4setup() 2007-10-15 11:44
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package etemplate
@ -186,6 +186,9 @@ $templ_data[] = array('name' => 'etemplate.link_widget.list','template' => '','l
$templ_data[] = array('name' => 'etemplate.link_widget.list','template' => '','lang' => '','group' => '0','version' => '1.2.001','data' => 'a:1:{i:0;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:2:{s:1:"D";s:10:",!@primary";s:2:"c1";s:3:"nmr";}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"name";s:11:"${row}[app]";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:5:"2,0,0";i:1;a:5:{s:4:"type";s:5:"label";s:4:"size";s:47:",@${row}[view],,,@${row}[target],@${row}[popup]";s:7:"no_lang";s:1:"1";s:4:"name";s:13:"${row}[title]";s:4:"help";s:41:"view this linked entry in its application";}i:2;a:4:{s:4:"type";s:5:"label";s:4:"span";s:15:",note_following";s:7:"no_lang";s:1:"1";s:4:"name";s:14:"${row}[remark]";}}s:1:"C";a:5:{s:4:"type";s:6:"button";s:4:"size";s:6:"delete";s:5:"label";s:16:"$row_cont[label]";s:4:"name";s:26:"unlink[$row_cont[link_id]]";s:4:"help";s:15:"$row_cont[help]";}s:1:"D";a:4:{s:4:"type";s:5:"radio";s:4:"size";s:18:"$row_cont[link_id]";s:4:"name";s:7:"primary";s:4:"help";s:45:"Select a primary contact, to show in the list";}}}s:4:"rows";i:1;s:4:"cols";i:4;s:4:"size";s:12:",,,whiteback";}}','size' => ',,,whiteback','style' => '.whiteback { background: white; }
.note_following { font-style: italic; padding-left: 5px; }','modified' => '1035126186',);
$templ_data[] = array('name' => 'etemplate.link_widget.list','template' => '','lang' => '','group' => '0','version' => '1.2.002','data' => 'a:1:{i:0;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:2:{s:1:"D";s:10:",!@primary";s:2:"c1";s:3:"nmr";}i:1;a:4:{s:1:"A";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:2:{s:4:"type";s:4:"html";s:4:"name";s:17:"${row}[mime_icon]";}i:2;a:2:{s:4:"name";s:11:"${row}[app]";s:4:"type";s:5:"label";}}s:1:"B";a:4:{s:4:"size";s:6:"2,,0,0";s:4:"type";s:4:"hbox";i:1;a:5:{s:7:"no_lang";s:1:"1";s:4:"size";s:1:"2";s:4:"type";s:4:"vbox";i:1;a:2:{s:4:"type";s:4:"html";s:4:"name";s:17:"${row}[thumbnail]";}i:2;a:5:{s:7:"no_lang";s:1:"1";s:4:"name";s:13:"${row}[title]";s:4:"size";s:14:",@${row}[view]";s:4:"type";s:5:"label";s:4:"help";s:41:"view this linked entry in its application";}}i:2;a:4:{s:7:"no_lang";s:1:"1";s:4:"name";s:14:"${row}[remark]";s:4:"type";s:5:"label";s:4:"span";s:15:",note_following";}}s:1:"C";a:5:{s:5:"label";s:6:"Unlink";s:4:"name";s:26:"unlink[$row_cont[link_id]]";s:4:"type";s:6:"button";s:4:"size";s:10:"delete.png";s:4:"help";s:39:"Remove this link (not the entry itself)";}s:1:"D";a:4:{s:4:"name";s:7:"primary";s:4:"size";s:18:"$row_cont[link_id]";s:4:"type";s:5:"radio";s:4:"help";s:45:"Select a primary contact, to show in the list";}}}s:4:"cols";i:4;s:4:"rows";i:1;s:4:"size";s:12:",,,whiteback";}}','size' => ',,,whiteback','style' => '.whiteback { background: white; }
.note_following { font-style: italic; padding-left: 5px; }','modified' => '1192470162',);
$templ_data[] = array('name' => 'etemplate.link_widget.search','template' => '','lang' => '','group' => '0','version' => '1.0.0.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:5:{s:2:"c1";s:6:"row_on";s:2:"c3";s:7:"row_off";s:2:"h3";s:10:",@no_files";s:2:"c2";s:6:"row_on";s:2:"h2";s:6:",!@msg";}i:1;a:3:{s:1:"A";a:5:{s:4:"type";s:6:"select";s:5:"label";s:6:"Search";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"app";s:4:"help";s:26:"Select an App to search in";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:4:"size";s:2:"25";s:4:"name";s:5:"query";s:4:"help";s:22:"Enter a search pattern";}s:1:"C";a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Search";s:4:"name";s:6:"search";s:4:"help";s:30:"Click here to start the search";}}i:2;a:3:{s:1:"A";a:4:{s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";s:4:"name";s:3:"msg";s:5:"align";s:6:"center";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:3;a:3:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:11:"attach file";}s:1:"B";a:3:{s:4:"type";s:4:"file";s:4:"name";s:4:"file";s:4:"help";s:69:"Enter filename to upload and attach, use [Browse...] to search for it";}s:1:"C";a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Upload";s:4:"name";s:6:"upload";s:4:"help";s:29:"Click here to upload the file";}}}s:4:"rows";i:3;s:4:"cols";i:3;}}','size' => '','style' => '.error_msg { font-style: italic; color: red; }','modified' => '1113223869',);
$templ_data[] = array('name' => 'etemplate.link_widget.search','template' => '','lang' => '','group' => '0','version' => '1.2.001','data' => 'a:2:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:5:{s:2:"c1";s:6:"row_on";s:2:"c3";s:7:"row_off";s:2:"h3";s:10:",@no_files";s:2:"c2";s:6:"row_on";s:2:"h2";s:6:",!@msg";}i:1;a:4:{s:1:"A";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"app";s:4:"help";s:26:"Select an App to search in";}s:1:"B";a:5:{s:4:"type";s:4:"text";s:4:"size";s:2:"32";s:4:"name";s:5:"query";s:4:"help";s:22:"Enter a search pattern";s:8:"tabindex";i:99;}s:1:"C";a:6:{s:4:"type";s:6:"button";s:5:"label";s:6:"Search";s:4:"name";s:6:"search";s:4:"help";s:30:"Click here to start the search";s:4:"span";s:3:"all";s:8:"tabindex";i:100;}s:1:"D";a:1:{s:4:"type";s:5:"label";}}i:2;a:4:{s:1:"A";a:4:{s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";s:4:"name";s:3:"msg";s:5:"align";s:6:"center";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}}i:3;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:11:"Attach file";}s:1:"B";a:4:{s:4:"type";s:4:"file";s:4:"name";s:4:"file";s:4:"help";s:69:"Enter filename to upload and attach, use [Browse...] to search for it";s:4:"size";s:2:"12";}s:1:"C";a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Attach";s:4:"name";s:6:"attach";s:4:"help";s:29:"Click here to attach the file";}s:1:"D";a:4:{s:4:"type";s:8:"checkbox";s:4:"name";s:7:"comment";s:4:"help";s:28:"optional note about the Link";s:8:"onchange";s:81:"set_style_by_class(\'*\',\'hide_comment\',\'display\',this.checked ? \'block\' : \'none\');";}}}s:4:"rows";i:3;s:4:"cols";i:4;}i:1;a:6:{s:4:"type";s:4:"text";s:4:"name";s:6:"remark";s:4:"size";s:5:"50,50";s:4:"span";s:13:",hide_comment";s:5:"label";s:7:"Comment";s:4:"help";s:28:"optional note about the Link";}}','size' => '','style' => '.redItalic { font-style: italic; color: red; }

View File

@ -30,6 +30,12 @@
'text' => lang('Text only')
);
$link_list_format = array(
'icons' => lang('Icons only'),
'icons_and_text' => lang('Icons and text'),
'text' => lang('Text only')
);
$format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'];
$format = ($format ? $format : 'Y/m/d') . ', ';
if($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12')
@ -133,6 +139,23 @@
'xmlrpc' => True,
'admin' => False
),
'link_list_format' => array(
'type' => 'select',
'label' => 'Show links between eGroupWare aps as',
'name' => 'link_list_format',
'values' => $link_list_format,
'help' => 'You can show the linked entries with icons only, icons with app-name or both.',
'xmlrpc' => True,
'admin' => False
),
'link_list_thumbnail' => array(
'type' => 'check',
'label' => 'Display thumbnails for linked images',
'name' => 'link_list_thumbnail',
'help' => 'Images linked to an entry can be displayed as thumbnails. You can turn this off to speed up page display.',
'xmlrpc' => True,
'admin' => False
),
'tz_offset' => array(
'type' => 'select',
'label' => 'Time zone offset',