From 18b73873dc81fdbd450ecb29e4f251e29eb2beaf Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Fri, 5 Oct 2012 14:08:28 +0200 Subject: New skin selection with full name, license and thumbnail --- program/steps/settings/func.inc | 47 +++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 14 deletions(-) (limited to 'program/steps/settings/func.inc') diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 4f8da1350..c60d17f30 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -157,7 +157,6 @@ function rcmail_user_prefs($current=null) $blocks = array( 'main' => array('name' => Q(rcube_label('mainoptions'))), - 'browser' => array('name' => Q(rcube_label('browseroptions'))), ); // language selection @@ -252,15 +251,32 @@ function rcmail_user_prefs($current=null) if (count($skins) > 1) { $field_id = 'rcmfd_skin'; - $input_skin = new html_select(array('name'=>'_skin', 'id'=>$field_id)); - - foreach($skins as $skin) - $input_skin->add($skin, $skin); - - $blocks['main']['options']['skin'] = array( - 'title' => html::label($field_id, Q(rcube_label('skin'))), - 'content' => $input_skin->show($config['skin']), - ); + $input_skin = new html_radiobutton(array('name'=>'_skin')); + + $blocks['skin'] = array('name' => Q(rcube_label('skin')),); + + foreach($skins as $skin) { + $thumbnail = "./skins/$skin/thumbnail.png"; + if (!is_file($thumbnail)) + $thumbnail = './program/resources/blank.gif'; + + $skinname = ucfirst($skin); + $author_link = $license_link = ''; + $meta = @json_decode(@file_get_contents("./skins/$skin/meta.json"), true); + if (is_array($meta) && $meta['name']) { + $skinname = $meta['name']; + $author_link = $meta['url'] ? html::a(array('href' => $meta['url'], 'target' => '_blank'), Q($meta['author'])) : Q($meta['author']); + $license_link = $meta['license-url'] ? html::a(array('href' => $meta['license-url'], 'target' => '_blank'), Q($meta['license'])) : Q($meta['license']); + } + + $blocks['skin']['options'][$skin]['content'] = html::label(array('class' => 'skinselection'), + html::span('skinitem', $input_skin->show($config['skin'], array('value' => $skin, 'id' => $field_id.$skin))) . + html::span('skinitem', html::img(array('src' => $thumbnail, 'class' => 'skinthumbnail', 'alt' => $skin, 'width' => 64, 'height' => 64))) . + html::span('skinitem', html::span('skinname', Q($skinname)) . html::br() . + html::span('skinauthor', $author_link ? 'by ' . $author_link : '') . html::br() . + html::span('skinlicense', $license_link ? rcube_label('license').': ' . $license_link : '')) + ); + } } } @@ -268,10 +284,13 @@ function rcmail_user_prefs($current=null) $RCMAIL->output->add_script(sprintf("%s.check_protocol_handler('%s', '#mailtoprotohandler');", JS_OBJECT_NAME, JQ($product_name)), 'foot'); - $blocks['browser']['options']['mailtoprotohandler'] = array( - 'content' => html::a(array( - 'href' => '#', - 'id' => 'mailtoprotohandler'), Q(rcube_label('mailtoprotohandler'))), + $blocks['browser'] = array( + 'name' => Q(rcube_label('browseroptions')), + 'options' => array('mailtoprotohandler' => array( + 'content' => html::a(array( + 'href' => '#', + 'id' => 'mailtoprotohandler'), Q(rcube_label('mailtoprotohandler'))), + )), ); break; -- cgit v1.2.3