},
/**
+ * Propagates a SELECT drop down list with the editable calendars.
+ *
+ * @param string id The id of the SELECT element.
+ */
+ updateCalendarDropDown: function(id)
+ {
+ $(id).update();
+ $H(Kronolith.conf.calendars.internal).each(function(cal) {
+ if (cal.value.edit) {
+ $(id).insert(new Element('OPTION', { 'value': cal.key })
+ .setStyle({ 'backgroundColor': cal.value.bg, 'color': cal.value.fg })
+ .update(cal.value.name.escapeHTML()));
+ }
+ });
+ },
+
+ /**
* Sets the load signature and show the loading spinner.
*
* @param string cal The loading calendar.
return;
case 'kronolithQuickEvent':
+ this.updateCalendarDropDown('kronolithQuickinsertCalendars');
$('kronolithQuickinsert').appear({
duration: 0.3,
afterFinish: function() {
// Turn debugging on?
'debug' => !empty($conf['js']['debug']),
);
- foreach ($GLOBALS['all_calendars'] as $id => $calendar) {
- $owner = $calendar->get('owner') == Horde_Auth::getAuth();
- $code['conf']['calendars']['internal'][$id] = array(
- 'name' => ($owner ? '' : '[' . Horde_Auth::convertUsername($calendar->get('owner'), false) . '] ')
- . $calendar->get('name'),
- 'owner' => $owner,
- 'fg' => self::foregroundColor($calendar),
- 'bg' => self::backgroundColor($calendar),
- 'show' => in_array($id, $GLOBALS['display_calendars']));
+ foreach (array(true, false) as $my) {
+ foreach ($GLOBALS['all_calendars'] as $id => $calendar) {
+ $owner = $calendar->get('owner') == Horde_Auth::getAuth();
+ if (($my && $owner) || (!$my && !$owner)) {
+ $code['conf']['calendars']['internal'][$id] = array(
+ 'name' => ($owner ? '' : '[' . Horde_Auth::convertUsername($calendar->get('owner'), false) . '] ')
+ . $calendar->get('name'),
+ 'owner' => $owner,
+ 'fg' => self::foregroundColor($calendar),
+ 'bg' => self::backgroundColor($calendar),
+ 'show' => in_array($id, $GLOBALS['display_calendars']),
+ 'edit' => $calendar->hasPermission(Horde_Auth::getAuth(), PERMS_READ));
+ }
+ }
}
foreach ($GLOBALS['all_external_calendars'] as $api => $categories) {
foreach ($categories as $id => $name) {
<!-- ini menu -->
<div id="kronolithMenu">
<div id="kronolithAddEvents">
- <span id="kronolithNewEvent"><?php echo _("_New event") ?></span>
+ <span id="kronolithNewEvent" class="button"><?php echo _("_New event") ?></span>
<span id="kronolithQuickEvent" title="<?php echo _("Quick _insert") ?>">+</span>
</div>
<div id="kronolithQuickinsert" style="display:none">
<form id="kronolithQuickinsertForm" action="">
- <input type="text" id="kronolithQuickinsertQ" value="" />
- <input type="submit" id="kronolithQuickinsertSave" value="<?php echo _("Add") ?>" class="button ok" />
- <input type="submit" id="kronolithQuickinsertCancel" value="x" class="button cancel" /><br />
- <?php echo _("I.e. Dinner with John tomorrow 10am") ?><br />
+ <input type="text" id="kronolithQuickinsertQ" size="35" value="" class="kronolithLongField" /><br />
+ <span class="kronolithFormInfo"><?php echo _("I.e. Dinner with John
+tomorrow 10am") ?></span><br />
+
+ <label><?php echo _("Add to") ?>:</label>
+ <select id="kronolithQuickinsertCalendars">
+ </select>
+ <span class="kronolithSep">|</span>
+ <input type="button" id="kronolithQuickinsertSave" value="<?php echo _("Save") ?>" class="button ok" />
+ <span class="kronolithSep"><?php echo _("or") ?></span>
+ <a href="#" id="kronolithQuickinsertCancel" class="kronolithFormCancel"><?php echo _("Cancel") ?></a><br />
</form>
</div>
}
#kronolithAddEvents span {
/* We need some style here. */
- margin-bottom: 5px;
- padding-right: 10px;
+ float: left;
font-weight: bold;
cursor: pointer;
}
+span#kronolithNewEvent {
+ width: 121px;
+ margin-right: 10px;
+ text-align: center;
+}
span#kronolithQuickEvent {
+ width: 16px;
background: transparent url("graphics/new.png") no-repeat;
color: transparent;
}
#kronolithQuickinsert {
position: absolute;
z-index: 110;
- left: 105px;
+ left: 163px;
top: 10px;
- width: 250px;
- height: 75px;
+ width: 350px;
+ height: auto;
margin: 0;
padding: 0;
background: transparent url("graphics/back_quick.png") no-repeat left top;
padding: 5px;
margin: 5px 5px 5px 15px;
}
-#kronolithQuickinsertQ {
- width: 150px;
-}
/* Navigation bar */
#kronolithBar {