gunnar: server/patches/horde HK-GW-framework_3.2_ALPHA-Kolab_issue_2138.patch, NONE, 1.1 HK-GW-horde_3.2_ALPHA-Deleting_categories.patch, NONE, 1.1 HK-GW-kronolith_2.2_ALPHA-Kolab_issue_2138.patch, NONE, 1.1 README_Deleting_categories.patch, NONE, 1.1 README_Kolab_issue_2138.patch, NONE, 1.1
cvs at kolab.org
cvs at kolab.org
Mon Nov 19 18:18:57 CET 2007
- Previous message: thomas: server README.1st,1.66,1.67
- Next message: gunnar: server/horde/horde-turba attributes.php, NONE, 1.1 ChangeLog, 1.4, 1.5 horde-turba-kolab.spec, 1.16, 1.17 sources.php, 1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: gunnar
Update of /kolabrepository/server/patches/horde
In directory doto:/tmp/cvs-serv3118
Added Files:
HK-GW-framework_3.2_ALPHA-Kolab_issue_2138.patch
HK-GW-horde_3.2_ALPHA-Deleting_categories.patch
HK-GW-kronolith_2.2_ALPHA-Kolab_issue_2138.patch
README_Deleting_categories.patch README_Kolab_issue_2138.patch
Log Message:
The last round of Horde patches for our next release.
--- NEW FILE: HK-GW-framework_3.2_ALPHA-Kolab_issue_2138.patch ---
Fix kolab issue 2138.
diff -r 794fd76385d6 framework/Kolab/Kolab/IMAP.php
--- a/framework/Kolab/Kolab/IMAP.php Mon Nov 19 14:52:25 2007 +0100
+++ b/framework/Kolab/Kolab/IMAP.php Mon Nov 19 14:57:56 2007 +0100
@@ -289,7 +289,11 @@ class Kolab_IMAP {
$this->_object_type = $app_consts['mime_type_suffix'];
$this->_mime_type = KOLAB_MIME_TYPE_PREFIX . $this->_object_type;
$this->_owner = Auth::getAuth();
- $this->_folder = $this->parseFolder($share_uid);
+ $folder = $this->parseFolder($share_uid);
+ if (is_a($folder, 'PEAR_Error')) {
+ return $folder;
+ }
+ $this->_folder = $folder;
$this->_imap = &Kolab_IMAP_Connection::singleton(Kolab::getServer('imap'),
$conf['kolab']['imap']['port'], true, false);
@@ -358,8 +362,9 @@ class Kolab_IMAP {
return $folder[0];
}
}
- }
- return rawurldecode($folder);
+ return PEAR::raiseError(sprintf(_("Default folder of type %s does not exist!"), $this->_object_type));
+ }
+ return rawurldecode($folder);
}
/**
@@ -371,70 +376,11 @@ class Kolab_IMAP {
*/
function listFolders()
{
- require_once 'Horde/SessionObjects.php';
-
- static $folders = array();
-
- if (empty($folders)) {
- $session = &Horde_SessionObjects::singleton();
- $folders = &$session->query('horde_kolab_imaplist');
- }
-
- if (!empty($folders)) {
- return $folders;
- }
-
// Connect to the IMAP server
$imap = &Kolab_IMAP_Connection::singleton(Kolab::getServer('imap'),
$GLOBALS['conf']['kolab']['imap']['port']);
- // Login using the current Horde credentials
- $result = $imap->connect(Auth::getAuth(),
- Auth::getCredential('password'));
- if (is_a($result, 'PEAR_Error')) {
- Horde::logMessage('Unable to authenticate with the Kolab IMAP server', __FILE__, __LINE__, PEAR_LOG_ERR);
- $imap->disconnect();
- return $folders;
- }
-
- // Obtain a list of all folders the current user has access to
- $folder_list = $imap->getMailboxes();
- if (is_a($folder_list, 'PEAR_Error')) {
- Horde::logMessage('Unable to obtain IMAP folder list', __FILE__, __LINE__, PEAR_LOG_ERR);
- $imap->disconnect();
- return $folders;
- }
-
- // Iterate over all the folders obtaining their groupware types
- foreach ($folder_list as $folder) {
- $foldertype = 'mail';
- $default = false;
-
- $annotation = $imap->getAnnotation(KOLAB_ANNOT_FOLDER_TYPE,
- 'value.shared',
- $folder);
- if (!is_a($annotation, 'PEAR_Error') && !empty($annotation)) {
- $type = explode('.', $annotation);
- if ((!empty($type[1]) && $type[1] == 'default') ||
- (empty($type[1]))) {
- $foldertype = $type[0];
- if (!empty($type[1]) && $type[1] == 'default') {
- $default = true;
- } else {
- $default = false;
- }
- }
- }
-
- $folders[] = array($folder, $foldertype, $default);
- }
-
- $session = &Horde_SessionObjects::singleton();
- $session->overwrite('horde_kolab_imaplist', $folders, false);
-
- $imap->disconnect();
-
- return $folders;
+ return $imap->listFolders();
}
/**
@@ -662,6 +608,9 @@ class Kolab_IMAP {
// This assumes that both folders are owned by $this->_owner.
// This needs to be checked.
$new_folder = $this->parseFolder($new_folder);
+ if (is_a($new_folder, 'PEAR_Error')) {
+ return $new_folder;
+ }
$result = $this->_imap->moveMessage($imap_uid, $new_folder);
if (is_a($result, 'PEAR_Error')) {
@@ -1371,6 +1320,9 @@ class Kolab_IMAP {
$new_share = rawurldecode($new_share);
$new_share = $this->parseFolder($new_share);
+ if (is_a($new_share, 'PEAR_Error')) {
+ return $new_share;
+ }
$msg_no = $this->findObject($uid);
if (is_a($msg_no, 'PEAR_Error')) {
@@ -1713,4 +1665,83 @@ class Kolab_IMAP_Connection {
return $driver;
}
+
+ /**
+ * Returns a list of all IMAP folders (including their groupware type)
+ * that the current user has acccess to.
+ *
+ * @return array An array of array($foldername, $foldertype) items (empty
+ * on error).
+ */
+ function listFolders()
+ {
+ require_once 'Horde/SessionObjects.php';
+
+ static $folders = array();
+
+ if (empty($folders)) {
+ $session = &Horde_SessionObjects::singleton();
+ $folders = &$session->query('horde_kolab_imaplist');
+ }
+
+ if (!empty($folders)) {
+ return $folders;
+ }
+
+ // Login using the current Horde credentials
+ $result = $this->connect(Auth::getAuth(),
+ Auth::getCredential('password'));
+ if (is_a($result, 'PEAR_Error')) {
+ Horde::logMessage('Unable to authenticate with the Kolab IMAP server', __FILE__, __LINE__, PEAR_LOG_ERR);
+ return $folders;
+ }
+
+ // Obtain a list of all folders the current user has access to
+ $folder_list = $this->getMailboxes();
+ if (is_a($folder_list, 'PEAR_Error')) {
+ Horde::logMessage('Unable to obtain IMAP folder list', __FILE__, __LINE__, PEAR_LOG_ERR);
+ return $folders;
+ }
+
+ // Iterate over all the folders obtaining their groupware types
+ foreach ($folder_list as $folder) {
+ $foldertype = 'mail';
+ $default = false;
+ $subtype = '';
+
+ $annotation = $this->getAnnotation(KOLAB_ANNOT_FOLDER_TYPE,
+ 'value.shared',
+ $folder);
+ if (!is_a($annotation, 'PEAR_Error') && !empty($annotation)) {
+ $type = explode('.', $annotation);
+ if (!empty($type[0])) {
+ $foldertype = $type[0];
+ if (!empty($type[1])) {
+ $subtype = $type[1];
+ if ($type[1] == 'default') {
+ $default = true;
+ }
+ }
+ }
+ }
+
+ $folders[] = array($folder, $foldertype, $default, $subtype);
+ }
+
+ $session = &Horde_SessionObjects::singleton();
+ $session->overwrite('horde_kolab_imaplist', $folders, false);
+
+ return $folders;
+ }
+
+ /**
+ * Resets the list cache
+ */
+ function resetListCache()
+ {
+ require_once 'Horde/SessionObjects.php';
+ $session = &Horde_SessionObjects::singleton();
+ $session->overwrite('horde_kolab_imaplist', false, false);
+ }
+
}
diff -r 794fd76385d6 framework/Kolab/Kolab/IMAP/cclient.php
--- a/framework/Kolab/Kolab/IMAP/cclient.php Mon Nov 19 14:52:25 2007 +0100
+++ b/framework/Kolab/Kolab/IMAP/cclient.php Mon Nov 19 14:57:56 2007 +0100
@@ -163,6 +163,8 @@ class Kolab_IMAP_Connection_cclient exte
*/
function create($folder)
{
+ $this->resetListCache();
+
$mbox = $this->_base_mbox . $folder;
$result = @imap_createmailbox($this->_imap, $mbox);
if (!$result) {
@@ -181,6 +183,8 @@ class Kolab_IMAP_Connection_cclient exte
*/
function delete($folder)
{
+ $this->resetListCache();
+
$mbox = $this->_base_mbox . $folder;
$result = @imap_deletemailbox($this->_imap, $mbox);
if (!$result) {
@@ -200,6 +204,8 @@ class Kolab_IMAP_Connection_cclient exte
*/
function rename($old, $new)
{
+ $this->resetListCache();
+
$result = @imap_renamemailbox($this->_imap,
$this->_base_mbox . $old,
$this->_base_mbox . $new);
@@ -391,18 +397,20 @@ class Kolab_IMAP_Connection_cclient exte
*/
function getMailboxes()
{
+ $folders = array();
+
$result = @imap_list($this->_imap, $this->_base_mbox, '*');
if (!$result) {
return PEAR::raiseError(sprintf(_("IMAP error. Folder: %s. Error: %s"), $this->_base_mbox, @imap_last_error()));
}
-
- $folders = array();
+
$server_len = strlen($this->_base_mbox);
foreach ($result as $folder) {
if (substr($folder, 0, $server_len) == $this->_base_mbox) {
$folders[] = substr($folder, $server_len);
}
}
+
return $folders;
}
diff -r 794fd76385d6 framework/Kolab/Kolab/IMAP/pear.php
--- a/framework/Kolab/Kolab/IMAP/pear.php Mon Nov 19 14:52:25 2007 +0100
+++ b/framework/Kolab/Kolab/IMAP/pear.php Mon Nov 19 14:57:56 2007 +0100
@@ -107,6 +107,7 @@ class Kolab_IMAP_Connection_pear extends
*/
function create($folder)
{
+ $this->resetListCache();
return $this->_imap->createMailbox($folder);
}
@@ -120,6 +121,7 @@ class Kolab_IMAP_Connection_pear extends
*/
function delete($folder)
{
+ $this->resetListCache();
return $this->_imap->deleteMailbox($folder);
}
@@ -134,6 +136,7 @@ class Kolab_IMAP_Connection_pear extends
*/
function rename($old, $new)
{
+ $this->resetListCache();
return $this->_imap->renameMailbox($old, $new);
}
--- NEW FILE: HK-GW-horde_3.2_ALPHA-Deleting_categories.patch ---
Fix deleting categories.
diff -r 8ec1fe533f3c horde/templates/prefs/categorymanagement.inc
--- a/horde/templates/prefs/categorymanagement.inc Mon Nov 19 14:58:02 2007 +0100
+++ b/horde/templates/prefs/categorymanagement.inc Mon Nov 19 15:00:34 2007 +0100
@@ -1,12 +1,12 @@
<script type="text/javascript">
-function remove(category)
+function removeCategory(category)
{
document.prefs.cAction.value = 'remove';
document.prefs.category.value = category;
document.prefs.submit();
}
-function add()
+function addCategory()
{
var category = window.prompt('<?php echo addslashes(_("Please enter a name for the new category:")) ?>', '');
if (category != null && category != '') {
@@ -18,7 +18,7 @@ function add()
</script>
<input name="cAction" value="" type="hidden" />
<input name="category" value="" type="hidden" />
-<input type="button" class="button" value="<?php echo _("New Category") ?>" onclick="add();" />
+<input type="button" class="button" value="<?php echo _("New Category") ?>" onclick="addCategory();" />
<table>
<?php
@@ -75,7 +75,7 @@ foreach ($categories as $name):
<a href="#" onclick="new ColorPicker({ color: '<?php echo htmlspecialchars($color) ?>', offsetParent: Event.element(event), update: [['color_<?php echo $color_b ?>', 'value'], ['color_<?php echo $color_b ?>', 'background']] }); return false;">
<?php echo Horde::img('colorpicker.png', _("Color Picker"), 'height="16"', $registry->getImageDir('horde')) ?></a>
<?php endif; ?>
- <a href="#" onclick="remove(decodeURIComponent('<?php echo rawurlencode(String::convertCharset($name, NLS::getCharset(), 'UTF-8')) ?>')); return false;"><?php echo Horde::img('delete.png') ?></a>
+ <a href="#" onclick="removeCategory(decodeURIComponent('<?php echo rawurlencode(String::convertCharset($name, NLS::getCharset(), 'UTF-8')) ?>')); return false;"><?php echo Horde::img('delete.png') ?></a>
</td>
</tr>
<?php endforeach; ?>
--- NEW FILE: HK-GW-kronolith_2.2_ALPHA-Kolab_issue_2138.patch ---
The kronolith part of issue 2138.
diff -r 7dfda4d79222 kronolith/lib/Driver/kolab.php
--- a/kronolith/lib/Driver/kolab.php Wed Nov 07 17:49:30 2007 +0100
+++ b/kronolith/lib/Driver/kolab.php Wed Nov 07 18:00:52 2007 +0100
@@ -1041,7 +1041,10 @@ class Kronolith_Driver_kolab_wrapper_new
return PEAR::raiseError(sprintf("Kolab::exists called for calendar %s. Currently active is %s.", $calendar_id, $this->_driver->_calendar));
}
- $this->synchronize();
+ $result = $this->synchronize();
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
if ($this->_store->objectUidExists($uid)) {
return $uid;
@@ -1063,7 +1066,10 @@ class Kronolith_Driver_kolab_wrapper_new
*/
function listEvents($startDate = null, $endDate = null, $hasAlarm = false)
{
- $this->synchronize();
+ $result = $this->synchronize();
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
if (is_null($startDate)) {
$startDate = &new Horde_Date(array('mday' => 1, 'month' => 1, 'year' => 0000));
@@ -1112,7 +1118,10 @@ class Kronolith_Driver_kolab_wrapper_new
return $event;
}
- $this->synchronize();
+ $result = $this->synchronize();
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
if (array_key_exists($eventId, $this->_events_cache)) {
return $this->_events_cache[$eventId];
@@ -1158,7 +1167,10 @@ class Kronolith_Driver_kolab_wrapper_new
*/
function saveEvent(&$event)
{
- $this->synchronize();
+ $result = $this->synchronize();
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
$uid = $event->getUID();
if ($uid == null) {
@@ -1195,7 +1207,10 @@ class Kronolith_Driver_kolab_wrapper_new
*/
function move($eventId, $newCalendar)
{
- $this->synchronize();
+ $result = $this->synchronize();
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
global $kronolith_shares;
$target = &$kronolith_shares->getShare($newCalendar);
@@ -1223,7 +1238,10 @@ class Kronolith_Driver_kolab_wrapper_new
*/
function deleteEvent($eventId)
{
- $this->synchronize();
+ $result = $this->synchronize();
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
if (!$this->_store->objectUidExists($eventId)) {
return PEAR::raiseError(sprintf(_("Event not found: %s"), $eventId));
--- NEW FILE: README_Deleting_categories.patch ---
DESCRIPTION:
Fixes kolab/issue2101 (https://www.intevation.de/roundup/kolab/issue2101)
IMPACT:
Categories can't be deleted without this patch.
REFERENCES:
Mercurial patch repository:
http://hg.pardus.de/cgi-bin/hg.cgi/horde/HORDE_3_2_ALPHA/summary
HISTORY
Applied upstream.
--- NEW FILE: README_Kolab_issue_2138.patch ---
DESCRIPTION:
Fixes kolab/issue2138 (https://www.intevation.de/roundup/kolab/issue2138)
IMPACT:
Caching of folder lists will be broken if this patch is missing.
REFERENCES:
Mercurial patch repository:
http://hg.pardus.de/cgi-bin/hg.cgi/horde/HORDE_3_2_ALPHA/summary
HISTORY
Applied upstream.
- Previous message: thomas: server README.1st,1.66,1.67
- Next message: gunnar: server/horde/horde-turba attributes.php, NONE, 1.1 ChangeLog, 1.4, 1.5 horde-turba-kolab.spec, 1.16, 1.17 sources.php, 1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the commits
mailing list