From 997e8721780cce7b03320f1cc43dee9891fe0a83 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 16 Mar 2010 15:56:40 +0100 Subject: [PATCH] Implement save as new. --- kronolith/js/kronolith.js | 18 +++++++++++------- kronolith/lib/Ajax/Application.php | 3 +++ kronolith/templates/index/edit.inc | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index e5e61e4c7..aff76f2e8 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -3172,6 +3172,12 @@ KronolithCore = { e.stop(); break; + case 'kronolithEventSaveAsNew': + this.saveEvent(true); + elt.disable(); + e.stop(); + break; + case 'kronolithTaskSave': this.saveTask(); elt.disable(); @@ -3872,13 +3878,13 @@ KronolithCore = { this.updateCalendarDropDown('kronolithEventTarget'); this.toggleAllDay(false); this.openTab($('kronolithEventForm').down('.tabset a.kronolithTabLink')); - $('kronolithEventForm').enable(); this.disableAlarmMethods(); $('kronolithEventForm').reset(); if (Kronolith.conf.maps.driver) { $('kronolithEventMapLink').hide(); } $('kronolithEventSave').show(); + $('kronolithEventSaveAsNew').show(); $('kronolithEventDelete').show(); $('kronolithEventForm').down('.kronolithFormActions .kronolithSeparator').show(); if (id) { @@ -3910,6 +3916,7 @@ KronolithCore = { $('kronolithEventEndDate').setValue(d.toString(Kronolith.conf.date_format)); $('kronolithEventEndTime').setValue(d.toString(Kronolith.conf.time_format)); $('kronolithEventLinkExport').up('span').hide(); + $('kronolithEventSaveAsNew').hide(); RedBox.showHtml($('kronolithEventDialog').show()); } }, @@ -3917,7 +3924,7 @@ KronolithCore = { /** * Submits the event edit form to create or update an event. */ - saveEvent: function() + saveEvent: function(asnew) { if (this.wrongFormat.size()) { this.showNotifications([{ type: 'horde.warning', message: Kronolith.text.fix_form_values }]); @@ -3936,7 +3943,8 @@ KronolithCore = { .merge({ view: this.view, view_start: start, - view_end: end + view_end: end, + as_new: !!asnew }), function(r) { if (r.response.events && eventid) { @@ -4152,7 +4160,6 @@ KronolithCore = { if (!ev.pe) { $('kronolithEventSave').hide(); - $('kronolithEventForm').disable(); kronolithETagAc.disable(); $('kronolithEventTabTags').select('label').each(function(e) {e.hide()}); } else { @@ -4161,9 +4168,6 @@ KronolithCore = { if (!ev.pd) { $('kronolithEventDelete').hide(); } - if (!ev.pe && !ev.pd) { - $('kronolithEventForm').down('.kronolithFormActions .kronolithSeparator').hide(); - } this.setTitle(ev.t); RedBox.showHtml($('kronolithEventDialog').show()); diff --git a/kronolith/lib/Ajax/Application.php b/kronolith/lib/Ajax/Application.php index a9eedf9de..328c75862 100644 --- a/kronolith/lib/Ajax/Application.php +++ b/kronolith/lib/Ajax/Application.php @@ -81,6 +81,9 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base return $result; } + if ($this->_vars->as_new) { + unset($this->_vars->event); + } if (!$this->_vars->event) { $perms = $GLOBALS['injector']->getInstance('Horde_Perms'); if ($perms->hasAppPermission('max_events') !== true && diff --git a/kronolith/templates/index/edit.inc b/kronolith/templates/index/edit.inc index 43a877c98..d62c74bc3 100644 --- a/kronolith/templates/index/edit.inc +++ b/kronolith/templates/index/edit.inc @@ -221,6 +221,7 @@
" class="button ok" /> + " class="button ok" /> " class="button ko" />
-- 2.11.0