From 45fa64c3c9801f9719638f7fa2f4f11cc6505647 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 18 Nov 2011 07:51:28 -0500
Subject: [PATCH] - Added About tab in Settings

---
 CHANGELOG                                |   10 +
 skins/default/settings.css               |   47 +++++++++++
 program/localization/en_US/labels.inc    |    8 +
 program/localization/pl_PL/labels.inc    |    6 +
 program/steps/settings/about.inc         |   92 +++++++++++++++++++++++
 skins/default/templates/about.html       |   35 ++++++++
 program/js/app.js                        |    6 +
 skins/default/includes/settingstabs.html |    1 
 8 files changed, 200 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 62fd5ac..1dec34b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,13 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Added About tab in Settings
+- TinyMCE:
+  - updated to 3.4.6
+  - security issue: removed moxieplayer (embedding flv and mp4 is not supported anymore)
+
+RELEASE 0.7-beta
+----------------
 - Fix handling of HTML form elements in messages (#1485137)
 - Fix regression in setting recipient to self when replying to a Sent message (#1487074)
 - Fix listing of folders in hidden namespaces (#1486796)
@@ -17,9 +24,6 @@
 - Fix handling of dates (birthday/anniversary) in contact data (#1488147)
 - Fix error on opening searched LDAP contact (#1488144)
 - Fix redundant line break in flowed format (#1488146)
-- TinyMCE:
-  - updated to 3.4.6
-  - security issue: removed moxieplayer (embedding flv and mp4 is not supported anymore)
 - Fix IDN address validation issue (#1488137)
 - Fix JS error when dst_active checkbox doesn't exist (#1488133)
 - Autocomplete LDAP records when adding contacts from mail (#1488073)
diff --git a/program/js/app.js b/program/js/app.js
index 2545145..37a2925 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -155,7 +155,7 @@
     }
 
     // enable general commands
-    this.enable_command('logout', 'mail', 'addressbook', 'settings', 'save-pref', 'compose', 'undo', true);
+    this.enable_command('logout', 'mail', 'addressbook', 'settings', 'save-pref', 'compose', 'undo', 'about', true);
 
     if (this.env.permaurl)
       this.enable_command('permaurl', true);
@@ -504,6 +504,10 @@
         this.switch_task(command);
         break;
 
+      case 'about':
+        location.href = '?_task=settings&_action=about';
+        break;
+
       case 'permaurl':
         if (obj && obj.href && obj.target)
           return true;
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 6aefd6c..d7df397 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -343,7 +343,7 @@
 
 // settings
 $labels['settingsfor']  = 'Settings for';
-
+$labels['about'] = 'About';
 $labels['preferences']  = 'Preferences';
 $labels['userpreferences']  = 'User preferences';
 $labels['editpreferences']  = 'Edit user preferences';
@@ -465,6 +465,12 @@
 $labels['sortdesc'] = 'Sort descending';
 $labels['undo'] = 'Undo';
 
+$labels['plugin'] = 'Plugin';
+$labels['version'] = 'Version';
+$labels['source'] = 'Source';
+$labels['license'] = 'License';
+$labels['webpage'] = 'Webpage';
+
 // units
 $labels['B'] = 'B';
 $labels['KB'] = 'KB';
diff --git a/program/localization/pl_PL/labels.inc b/program/localization/pl_PL/labels.inc
index cdebe50..164e508 100644
--- a/program/localization/pl_PL/labels.inc
+++ b/program/localization/pl_PL/labels.inc
@@ -434,5 +434,11 @@
 $labels['timeformat'] = 'Format czasu';
 $labels['isdraft'] = 'To jest kopia robocza wiadomości.';
 $labels['autocompletesingle'] = 'Nie pokazuj alternatywnych adresów przy autouzupełnianiu';
+$labels['plugin'] = 'Wtyczka';
+$labels['version'] = 'Wersja';
+$labels['source'] = 'Źródła';
+$labels['license'] = 'Licencja';
+$labels['webpage'] = 'Strona internetowa';
+$labels['about'] = 'O programie';
 
 ?>
diff --git a/program/steps/settings/about.inc b/program/steps/settings/about.inc
new file mode 100644
index 0000000..ed85a94
--- /dev/null
+++ b/program/steps/settings/about.inc
@@ -0,0 +1,92 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/steps/settings/about.inc                                      |
+ |                                                                       |
+ | This file is part of the Roundcube Webmail client                     |
+ | Copyright (C) 2005-2011, The Roundcube Dev Team                       |
+ | Copyright (C) 2011, Kolab Systems AG                                  |
+ | Licensed under the GNU GPL                                            |
+ |                                                                       |
+ | PURPOSE:                                                              |
+ |   Display license information about program and enabled plugins       |
+ |                                                                       |
+ +-----------------------------------------------------------------------+
+ | Author: Aleksander Machniak <alec@alec.pl>                            |
+ +-----------------------------------------------------------------------+
+
+ $Id: identities.inc 4410 2011-01-12 18:25:02Z thomasb $
+
+*/
+
+function rcmail_plugins_list($attrib)
+{
+  global $RCMAIL;
+
+  if (!$attrib['id'])
+    $attrib['id'] = 'rcmpluginlist';
+
+  $plugins = array_filter((array) $RCMAIL->config->get('plugins'));
+  $plugins = array_flip($plugins);
+
+  $metadata = array(
+    'name'    => 'string(//rc:package/rc:name)',
+    'version' => 'string(//rc:package/rc:version/rc:release)',
+    'license' => 'string(//rc:package/rc:license)',
+    'license_uri' => 'string(//rc:package/rc:license/@uri)',
+    'source_uri' => 'string(//rc:package/rc:srcuri)',
+  );
+
+  foreach ($plugins as $name => $plugin) {
+    $package = INSTALL_PATH . "/plugins/$name/package.xml";
+    if (file_exists($package) && ($file = file_get_contents($package))) {
+      $doc = new DOMDocument();
+      $doc->loadXML($file);
+      $xpath = new DOMXPath($doc);
+      $xpath->registerNamespace('rc', "http://pear.php.net/dtd/package-2.0");
+      $data = array();
+
+      foreach ($metadata as $key => $path) {
+        $data[$key] = $xpath->evaluate($path);
+      }
+
+      $plugins[$name] = $data;
+    }
+    else {
+      unset($plugins[$name]);
+    }
+  }
+
+  if (empty($plugins)) {
+    return '';
+  }
+
+  ksort($plugins, SORT_LOCALE_STRING);
+
+  $table = new html_table($attrib);
+
+  // add table header
+  $table->add_header('name', rcube_label('plugin'));
+  $table->add_header('version', rcube_label('version'));
+  $table->add_header('license', rcube_label('license'));
+  $table->add_header('source', rcube_label('source'));
+
+  foreach ($plugins as $name => $data) {
+    $table->add_row();
+    $table->add('name', Q($data['name'] ? $data['name'] : $name));
+    $table->add('version', Q($data['version']));
+    $table->add('license', $data['license_uri'] ? html::a(array('target' => '_blank', href=> Q($data['license_uri'])),
+        Q($data['license'])) : $data['license']);
+    $table->add('source', $data['source_uri'] ? html::a(array('target' => '_blank', href=> Q($data['source_uri'])),
+        Q(rcube_label('source'))) : '');
+  }
+
+  return $table->show();
+}
+
+$OUTPUT->set_pagetitle(rcube_label('about'));
+
+$OUTPUT->add_handler('pluginlist', 'rcmail_plugins_list');
+
+$OUTPUT->send('about');
diff --git a/skins/default/includes/settingstabs.html b/skins/default/includes/settingstabs.html
index ce6d234..0aea80b 100644
--- a/skins/default/includes/settingstabs.html
+++ b/skins/default/includes/settingstabs.html
@@ -2,6 +2,7 @@
 <span id="settingstabdefault" class="tablink"><roundcube:button command="preferences" type="link" label="preferences" title="editpreferences" /></span>
 <span id="settingstabfolders" class="tablink"><roundcube:button command="folders" type="link" label="folders" title="managefolders" class="tablink" /></span>
 <span id="settingstabidentities" class="tablink"><roundcube:button command="identities" type="link" label="identities" title="manageidentities" class="tablink" /></span>
+<span id="settingstababout" class="tablink"><roundcube:button command="about" type="link" label="about" title="about" class="tablink" /></span>
 <roundcube:container name="tabs" id="tabsbar" />
 <script type="text/javascript"> if (window.rcmail) rcmail.add_onload(rcube_init_settings_tabs); </script>
 </div>
diff --git a/skins/default/settings.css b/skins/default/settings.css
index cb29097..50f1b2c 100644
--- a/skins/default/settings.css
+++ b/skins/default/settings.css
@@ -170,3 +170,50 @@
 {
   font-family: monospace;
 }
+
+#license
+{
+  margin-left: 20px;
+  left: 20px;
+  width: 500px;
+  height: 250px;
+  background: url(images/watermark.gif) no-repeat center;
+}
+
+#license .sysname
+{
+  font-size: 18px;
+  font-weight: bold;
+}
+
+#license .copyright
+{
+  font-weight: bold;
+}
+
+#license .license,
+#license .links
+{
+  margin-top: 30px;
+}
+
+#pluginlist
+{
+  border: 1px solid #999;
+  margin-left: 20px;
+  top: 300px;
+  left: 20px;
+  width: 500px;
+}
+
+#pluginlist td.source,
+#pluginlist td.license,
+#pluginlist td.version
+{
+  text-align: center;
+}
+
+div.crop
+{
+  overflow: auto;
+}
diff --git a/skins/default/templates/about.html b/skins/default/templates/about.html
new file mode 100644
index 0000000..7a55bd6
--- /dev/null
+++ b/skins/default/templates/about.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title><roundcube:object name="pagetitle" /></title>
+<roundcube:include file="/includes/links.html" />
+<script type="text/javascript" src="/functions.js"></script>
+</head>
+<body>
+
+<roundcube:include file="/includes/taskbar.html" />
+<roundcube:include file="/includes/header.html" />
+<roundcube:include file="/includes/settingstabs.html" />
+
+<div id="mainscreen" class="box darkbg crop">
+
+<div id="license">
+<p class="sysname">Roundcube Webmail <roundcube:object name="version" /></p>
+<p class="copyright">Copyright &copy; 2005-2011, The Roundcube Dev Team</p>
+<p class="license">This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+</p>
+<p class="links">
+  <roundcube:label name="license" />: <a href="http://www.gnu.org/licenses/gpl-2.0.html" target="_blank">GNU GPLv2</a>
+  <br />
+  <roundcube:label name="webpage" />: <a href="http://roundcube.net" target="_blank">www.roundcube.net</a>
+</p>
+</div>
+
+<roundcube:object name="pluginlist" id="pluginlist" class="records-table" cellspacing="0" />
+
+</div>
+
+</body>
+</html>

--
Gitblit v1.9.1