gunnar: server/horde/fbview-kronolith fbview.patch, NONE, 1.1 open_savedattlist_win.js, NONE, 1.1 savedattlist.inc, NONE, 1.1 savedattlist.php, NONE, 1.1 Makefile, 1.2, 1.3 fbview-kronolith.spec, 1.3, 1.4

cvs at kolab.org cvs at kolab.org
Thu Aug 2 14:27:36 CEST 2007


Author: gunnar

Update of /kolabrepository/server/horde/fbview-kronolith
In directory doto:/tmp/cvs-serv29765

Modified Files:
	Makefile fbview-kronolith.spec 
Added Files:
	fbview.patch open_savedattlist_win.js savedattlist.inc 
	savedattlist.php 
Log Message:
Add the patches from Kolabs older fbview version. Fixed configuration. First working release will be based on tomorrows Horde snapshot. Release number already adjusted.

--- NEW FILE: fbview.patch ---
Index: attendees.php
===================================================================
RCS file: /repository/kronolith/attendees.php,v
retrieving revision 1.33
diff -u -r1.33 attendees.php
--- attendees.php	27 Jun 2007 17:23:52 -0000	1.33
+++ attendees.php	2 Aug 2007 11:10:29 -0000
@@ -135,6 +135,16 @@
     $attendees = array();
     $_SESSION['kronolith']['attendees'] = $attendees;
     break;
+
+case 'save':
+    if (empty($attendees)) {
+        break;
+    }
+    $savedattlist = unserialize($prefs->getValue('saved_attendee_list'));
+    $savedattlist[] = array_keys($attendees);
+    $prefs->setValue('saved_attendee_list', serialize($savedattlist));
+    $notification->push(_('Successfully saved attendee list'), 'horde.success');
+    break;
 }
 
 // Get the current Free/Busy view; default to the 'day' view if none specified.
@@ -206,6 +216,14 @@
 
 $title = _("Edit attendees");
 require KRONOLITH_TEMPLATES . '/common-header.inc';
+
+if ($browser->hasFeature('javascript')) {
+    Horde::addScriptFile('open_savedattlist_win.js');
+    $savedattlist_url = 'javascript:open_savedattlist_win();';
+} else {
+    $savedattlist_url = Horde::applicationUrl('savedattlist.php');
+}
+
 $notification->notify(array('status'));
 require KRONOLITH_TEMPLATES . '/attendees/attendees.inc';
 require $registry->get('templates', 'horde') . '/common-footer.inc';
Index: config/prefs.php.dist
===================================================================
RCS file: /repository/kronolith/config/prefs.php.dist,v
retrieving revision 1.93
diff -u -r1.93 prefs.php.dist
--- config/prefs.php.dist	18 Jun 2007 16:27:44 -0000	1.93
+++ config/prefs.php.dist	2 Aug 2007 11:10:29 -0000
@@ -459,3 +459,11 @@
     'shared' => false,
     'type' => 'implicit'
 );
+
+$_prefs['saved_attendee_list'] = array(
+    'value' => 'a:0:{}',
+    'locked' => false,
+    'shared' => false,
+    'type' => 'implicit',
+    'desc' => _("A saved list of attendees")
+);
Index: lib/FBView.php
===================================================================
RCS file: /repository/kronolith/lib/FBView.php,v
retrieving revision 1.24
diff -u -r1.24 FBView.php
--- lib/FBView.php	27 Jun 2007 17:23:52 -0000	1.24
+++ lib/FBView.php	2 Aug 2007 11:10:29 -0000
@@ -87,8 +87,8 @@
             $template = new Horde_Template();
             $rows = '';
             foreach ($this->_requiredMembers as $member) {
-                $blocks = $this->_getBlocks($member, $member->getBusyPeriods(), 'busyblock.tpl', _("Busy"));
-                $template = new Horde_Template();
+                $blocks = $this->_getBlocks($member, $member->getBusyPeriods(), 'busyblock.tpl', _("Busy"), $member->getExtraParams());
+                $template = &new Horde_Template();
                 $template->set('blocks', $blocks);
                 $template->set('name', $member->getName());
                 $rows .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/row.tpl');
@@ -108,8 +108,8 @@
             $template = new Horde_Template();
             $rows = '';
             foreach ($this->_optionalMembers as $member) {
-                $blocks = $this->_getBlocks($member, $member->getBusyPeriods(), 'busyblock.tpl', _("Busy"));
-                $template = new Horde_Template();
+                $blocks = $this->_getBlocks($member, $member->getBusyPeriods(), 'busyblock.tpl', _("Busy"), $member->getExtraParams());
+                $template = &new Horde_Template();
                 $template->set('blocks', $blocks);
                 $template->set('name', $member->getName());
                 $rows .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/row.tpl');
@@ -124,6 +124,9 @@
             $html .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/section.tpl');
         }
 
+	//**********
+	//This has been disabled in kolab-fbview. Make this optional?
+
         // Possible meeting times.
         $optimal->setAttribute('ORGANIZER', _("All Attendees"));
         $blocks = $this->_getBlocks($optimal,
@@ -146,6 +149,9 @@
         $template->set('blocks', $blocks);
         $rows .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/row.tpl');
 
+	//This has been disabled in kolab-fbview. Make this optional?
+	//**********
+
         // Reset locale.
         setlocale(LC_NUMERIC, $lc);
 
@@ -218,7 +224,7 @@
         return $instances[$view];
     }
 
-    function _getBlocks($member, $periods, $blockfile, $label)
+    function _getBlocks($member, $periods, $blockfile, $label, $extra = array())
     {
         $template = new Horde_Template();
         $template->set('label', $label);
@@ -251,6 +257,21 @@
 
                 $template->set('left', $left . '%');
                 $template->set('width', $width . '%');
+                $template->set('evclick', '');
+
+                if (isset($extra[$periodStart])) {
+                    if (!empty($extra[$periodStart]['X-UID'])) {
+                        $link = "javascript:performAction('viewaction', '" 
+			  . addslashes($member->getName() . "#" 
+				       . String::convertCharset(base64_decode($extra[$periodStart]['X-UID']), 
+								'UTF-8',NLS::getCharset())) . "')";
+                        $template->set('evclick', $link);
+                    }
+                    if (!empty($extra[$periodStart]['X-SUMMARY'])) {
+                        $template->set('label', String::convertCharset(base64_decode($extra[$periodStart]['X-SUMMARY']),'UTF-8',
+				       NLS::getCharset()));
+                    }
+                }
 
                 $blocks .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/' . $blockfile);
             } else {
Index: templates/attendees/attendees.inc
===================================================================
RCS file: /repository/kronolith/templates/attendees/attendees.inc,v
retrieving revision 1.37
diff -u -r1.37 attendees.inc
--- templates/attendees/attendees.inc	27 Mar 2007 13:22:03 -0000	1.37
+++ templates/attendees/attendees.inc	2 Aug 2007 11:10:30 -0000
@@ -92,6 +92,8 @@
 <div>
  <input type="submit" class="button" name="addNew" value="<?php echo htmlspecialchars(_("Save Attendees")) ?>" />
  <input type="submit" class="button" name="addNewClose" value="<?php echo htmlspecialchars(_("Save and Finish")) ?>" />
+ <input type="button" class="button" name="loadAttList" value="<?php echo htmlspecialchars(_("Load Attendee List")) ?>" onclick="<?php echo $savedattlist_url ?>" />
+ <?php if (!empty($attendees)): ?><input type="button" class="button" name="saveAttList" value="<?php echo htmlspecialchars(_("Save Attendee List")) ?>" onclick="performAction('save', '');" /><?php endif; ?>
  <?php if (!empty($attendees)): ?><input type="submit" class="button" name="clearAll" value="<?php echo htmlspecialchars(_("Clear all attendees")) ?>" /><?php endif; ?>
 </div>
 
Index: templates/fbview/busyblock.tpl
===================================================================
RCS file: /repository/kronolith/templates/fbview/busyblock.tpl,v
retrieving revision 1.5
diff -u -r1.5 busyblock.tpl
--- templates/fbview/busyblock.tpl	11 Dec 2006 22:46:02 -0000	1.5
+++ templates/fbview/busyblock.tpl	2 Aug 2007 11:10:30 -0000
@@ -1 +1 @@
-<td><div class="busy" style="left:<tag:left />;width:<tag:width />;"> </div></td>
+<td><div class="busy" onclick="<tag:evclick />" style="cursor:pointer;left:<tag:left />;width:<tag:width />;" title="<tag:label />"> </div></td>

--- NEW FILE: open_savedattlist_win.js ---
<?php if (!strstr($_SERVER['PHP_SELF'], 'javascript.php')): ?><script language="JavaScript" type="text/javascript">
<!--
<?php endif; ?>
function open_savedattlist_win(args)
{
    var url = "<?php echo Horde::url($GLOBALS['registry']->applicationWebPath('%application%/savedattlist.php', 'kronolith')) ?>";
    if (url.indexOf('?') == -1) glue = '?';
    else glue = '<?php echo ini_get('arg_separator.output') ?>';
    var now = new Date();
    var name = "savedattlist_window_" + now.getTime();
    if (args != "") {
        url = url + glue + args + '<?php echo ini_get('arg_separator.output') ?>' + "uniq=" + now.getTime();
    } else {
        url = url + glue + "uniq=" + now.getTime();
    }
    var Width = screen.width;
    if (Width > 775) {
        Width = 700;
    } else {
        Width -= 75;
    }
    var Height = screen.height;
    if (Height > 725) {
        Height = 650;
    } else {
        Height -= 75;
    }
    param = "toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width=" + Width + ",height=" + Height + ",left=0,top=0";
    name = window.open(url, name, param);
    if (!eval("name.opener")) {
        name.opener = self;
    }
}
<?php if (!strstr($_SERVER['PHP_SELF'], 'javascript.php')): ?>// -->
</script>
<?php endif; ?>

--- NEW FILE: savedattlist.inc ---
<!-- javascript action handling -->
<script language="JavaScript" type="text/javascript">
<!--
function performAction(id, value)
{
    document.savedattlistForm.actionID.value = id;
    document.savedattlistForm.actionValue.value = value;
    document.savedattlistForm.submit();
    return false;
}

function updateMessage(list)
{
    if (parent.opener.closed) {
        alert('<?php echo addslashes(_("The Edit Attendees screen is no longer present. Exiting.")) ?>');
        this.close();
        return;
    }

    if (!parent.opener.document.attendeesForm) {
        alert('<?php echo addslashes(_("You can only use this form from the Edit Attendees screen.")) ?>');
        this.close();
        return;
    }

    parent.opener.document.attendeesForm.newAttendees.value = list;
    this.close();
}
// -->
</script>

<form method="post" action="<?php echo $form_handler; ?>" name="savedattlistForm">
<?php Util::pformInput(); ?>
<input type="hidden" name="actionID" value="" />
<input type="hidden" name="actionValue" value="" />

<div align="center">

<table border="0" width="500" cellspacing="0" cellpadding="2">

<!-- header -->
<tr><td colspan="4" class="header"><b><?php echo $title ?></b></td></tr>

<!-- attendee list header -->
<tr class="item">
 <td nowrap="nowrap" width="2%" align="center"><?php echo $loadimg ?></td>
 <td nowrap="nowrap" width="2%" align="center"><?php echo $delimg ?></td>
 <td nowrap="nowrap" width="96%"><b><?php echo htmlspecialchars(_("Attendees")) ?></b></td>
</tr>

<!-- attendees -->
<?php $i = 0 ?>
<?php if (empty($savedattlist)): ?>
 <tr class="item<?php echo ($i++ % 2) ?>"><td align="center" colspan="3"><i><?php echo htmlspecialchars('-- ' . _("No saved attendee lists are available") . ' --') ?></i></td></tr>
<?php else: foreach ($savedattlist as $index => $list): ?>
 <tr class="item<?php echo ($i++ % 2) ?>">
 <?php
  echo '<td align="center">', Horde::link("javascript:updateMessage('" . addslashes(implode(', ', $list)) . "')", _("Load this list")), $loadimg, "</a></td>";
 ?>
 <?php
  echo '<td align="center">', Horde::link("javascript:performAction('remove', '" . $index . "')", _("Remove this list")), $delimg, "</a></td>";
 ?>
  <td><?php echo implode(', ', $list); ?></td>
 </tr>
<?php endforeach; endif; ?>
</table>
</div>
</form>

--- NEW FILE: savedattlist.php ---
<?php
/**
 * $Horde: kronolith/attendeeshandler.php,v 1.1 2004/05/25 08:34:21 stuart Exp $
 *
 * Copyright 2004 Code Fusion  <http://www.codefusion.co.za/>
 *                Stuart Binge <s.binge at codefusion.co.za>
 *
 * See the enclosed file COPYING for license information (GPL).  If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 */

@define('KRONOLITH_BASE', dirname(__FILE__));
require_once KRONOLITH_BASE . '/lib/base.php';
require_once KRONOLITH_BASE . '/lib/FBView.php';

$title = _('Load Attendee List');

Horde::addScriptFile('tooltip.js', 'horde');
require KRONOLITH_TEMPLATES . '/common-header.inc';

// Get our list of saved attendees
$savedattlist = unserialize($prefs->getValue('saved_attendee_list'));

// Preformat our image urls
$delimg = Horde::img('delete.png', _("Remove List"), null, $GLOBALS['registry']->getImageDir('horde'));
$loadimg = Horde::img('tree/folder.png', _("Load List"), null, $GLOBALS['registry']->getImageDir('horde'));

// Get our Action ID & Value. This specifies what action the user initiated.
$actionID = Util::getFormData('actionID', false);
$actionValue = Util::getFormData('actionValue', false);
if (!$actionID) {
    $actionID = (Util::getFormData('addNew', false) ? 'add' : false);
    $actionValue = Util::getFormData('newAttendees', '');
}

// Perform the specified action, if there is one.
switch ($actionID) {
case 'remove':
    // Remove the specified attendee
    if (array_key_exists($actionValue, $savedattlist)) {
        unset($savedattlist[$actionValue]);
	$prefs->setValue('saved_attendee_list', serialize($savedattlist));
    }
    
    break;

case 'dismiss':
    // Make sure we're actually allowed to dismiss
    if (!$allow_dismiss) break;

    // Close the attendee window
    global $browser;

    if ($browser->hasFeature('javascript')) {
        Util::closeWindowJS();
    } else {
        $url = Util::getFormData('url');

        if (!empty($url)) {
            $location = Horde::applicationUrl($url, true);
        } else {
            $url = Util::addParameter($prefs->getValue('defaultview') . '.php', 'month', Util::getFormData('month'));
            $url = Util::addParameter($url, 'year', Util::getFormData('year'));
            $location = Horde::applicationUrl($url, true);
        }

        // Make sure URL is unique.
        $location = Util::addParameter($location, 'unique', md5(microtime()));

        header('Location: ' . $location);
    }
    break;
}

$form_handler = Horde::applicationUrl('savedattlist.php');
require KRONOLITH_TEMPLATES . '/savedattlist/savedattlist.inc';
require $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc';

Index: Makefile
===================================================================
RCS file: /kolabrepository/server/horde/fbview-kronolith/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Makefile	2 Aug 2007 10:35:19 -0000	1.2
+++ Makefile	2 Aug 2007 12:27:34 -0000	1.3
@@ -22,7 +22,7 @@
 VERSION = $(shell grep "%define[ ]*V_version" *.spec | sed -e "s/.*V_version\s*\([0-9.]*\).*/\1/")
 RELEASE = ${YEAR}${MONTH}${DAY}
 
-PATCHES = $(shell find . -name "*.patch")
+PATCHES = $(shell find . -name "*.patch") savedattlist.inc open_savedattlist_win.js
 TEMPLATES = $(shell find . -name "*.template")
 CONFIGS = $(shell find . -name "*.php")
 

Index: fbview-kronolith.spec
===================================================================
RCS file: /kolabrepository/server/horde/fbview-kronolith/fbview-kronolith.spec,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fbview-kronolith.spec	2 Aug 2007 10:35:19 -0000	1.3
+++ fbview-kronolith.spec	2 Aug 2007 12:27:34 -0000	1.4
@@ -3,7 +3,7 @@
 %define         V_package fbview-%{V_horde_name}
 %define         V_year  2007
 %define         V_month 08
-%define         V_day   01
+%define         V_day   03
 %define         V_version 2.1.5.99
 %define         V_date %{V_year}-%{V_month}-%{V_day}
 %define         V_release %{V_year}%{V_month}%{V_day}
@@ -26,6 +26,18 @@
 Source2:        conf.php
 Source3:        prefs.php
 
+##################################################
+# PATCH COMMENT
+#
+#   This allows to display extended parameters (like the event
+#   summary) in the fbview and to store a list of attendees in the
+#   preferences
+Source4:        savedattlist.php
+Source5:        savedattlist.inc
+Source6:        open_savedattlist_win.js
+
+Patch0:         fbview.patch
+
 # Build Info
 Prefix:		%{l_prefix}
 BuildRoot:	%{l_buildroot}
@@ -50,6 +62,10 @@
 %prep
 	%setup -c -q
 
+	cd %{V_horde_name}
+	%patch -p0 -P 0
+	cd ..
+
 %build
 
 %install
@@ -59,6 +75,14 @@
 	cd %{V_horde_name}/config && for fl in *.dist;do cp $fl ${fl/.dist/};done; cd ../..
 
 	cp -r %{V_horde_name} $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/fbview/
+
+	%{l_shtool} install -d $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/fbview/%{V_horde_name}/templates/savedattlist
+	%{l_shtool} install -c -m 644 %{l_value -s -a} %{S:4}      \
+	  $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/fbview/%{V_horde_name}
+	%{l_shtool} install -c -m 644 %{l_value -s -a} %{S:5}      \
+	  $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/fbview/%{V_horde_name}/templates/savedattlist
+	%{l_shtool} install -c -m 644 %{l_value -s -a} %{S:6}      \
+	  $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/fbview/%{V_horde_name}/templates/javascript
 
 	%{l_shtool} install -c -m 644 %{l_value -s -a} %{S:1} \
 	  $RPM_BUILD_ROOT%{l_prefix}/etc/kolab/templates	





More information about the commits mailing list