Page MenuHomePhorge

No OneTemporary

diff --git a/plugins/tasklist/localization/en_US.inc b/plugins/tasklist/localization/en_US.inc
index 0b713774..f43fbb93 100644
--- a/plugins/tasklist/localization/en_US.inc
+++ b/plugins/tasklist/localization/en_US.inc
@@ -1,140 +1,154 @@
<?php
$labels = array();
$labels['navtitle'] = 'Tasks';
$labels['lists'] = 'Tasklists';
$labels['list'] = 'Tasklist';
$labels['tags'] = 'Tags';
$labels['tasklistsubscribe'] = 'List permanently';
$labels['listsearchresults'] = 'Available Tasklists';
$labels['findlists'] = 'Find tasklists...';
$labels['searchterms'] = 'Search terms';
$labels['notasklistsfound'] = 'No tasklists found';
$labels['nrtasklistsfound'] = '$nr tasklists found';
$labels['newtask'] = 'New Task';
$labels['createtask'] = 'Create Task <Enter>';
$labels['createnewtask'] = 'Create new Task (e.g. Saturday, Mow the lawn)';
$labels['createfrommail'] = 'Save as task';
$labels['mark'] = 'Mark';
$labels['unmark'] = 'Unmark';
$labels['edit'] = 'Edit';
$labels['delete'] = 'Delete';
$labels['title'] = 'Title';
$labels['description'] = 'Description';
$labels['datetime'] = 'Due';
$labels['duetime'] = 'Due time';
$labels['start'] = 'Start';
$labels['starttime'] = 'Start time';
$labels['alarms'] = 'Reminder';
$labels['repeat'] = 'Repeat';
$labels['status'] = 'Status';
$labels['status-needs-action'] = 'Needs action';
$labels['status-in-process'] = 'In process';
$labels['status-completed'] = 'Completed';
$labels['status-cancelled'] = 'Cancelled';
$labels['all'] = 'All';
$labels['flagged'] = 'Flagged';
$labels['complete'] = 'Complete';
$labels['overdue'] = 'Overdue';
$labels['today'] = 'Today';
$labels['tomorrow'] = 'Tomorrow';
$labels['next7days'] = 'Next 7 days';
$labels['later'] = 'Later';
$labels['nodate'] = 'no date';
$labels['removetag'] = 'Remove';
$labels['taskdetails'] = 'Details';
$labels['newtask'] = 'New Task';
$labels['edittask'] = 'Edit Task';
$labels['save'] = 'Save';
$labels['cancel'] = 'Cancel';
$labels['addsubtask'] = 'Add subtask';
$labels['deletetask'] = 'Delete task';
$labels['deletethisonly'] = 'Delete this task only';
$labels['deletewithchilds'] = 'Delete with all subtasks';
$labels['taskactions'] = 'Task options...';
$labels['tabsummary'] = 'Summary';
$labels['tabrecurrence'] = 'Recurrence';
$labels['tabassignments'] = 'Assignments';
$labels['tabattachments'] = 'Attachments';
$labels['tabsharing'] = 'Sharing';
$labels['editlist'] = 'Edit list';
$labels['createlist'] = 'Add list';
$labels['listactions'] = 'List options...';
$labels['listname'] = 'Name';
$labels['showalarms'] = 'Show reminders';
$labels['import'] = 'Import';
$labels['viewoptions'] = 'View options';
$labels['focusview'] = 'View only this list';
// date words
$labels['on'] = 'on';
$labels['at'] = 'at';
$labels['this'] = 'this';
$labels['next'] = 'next';
-// mesages
+// messages
$labels['savingdata'] = 'Saving data...';
$labels['errorsaving'] = 'Failed to save data.';
$labels['notasksfound'] = 'No tasks found for the given criteria';
$labels['invalidstartduedates'] = 'Start date must not be greater than due date.';
$labels['deletetasktconfirm'] = 'Do you really want to delete this task?';
$labels['deleteparenttasktconfirm'] = 'Do you really want to delete this task and all its subtasks?';
$labels['deletelistconfirm'] = 'Do you really want to delete this list with all its tasks?';
$labels['deletelistconfirmrecursive'] = 'Do you really want to delete this list with all its sub-lists and tasks?';
$labels['aclnorights'] = 'You do not have administrator rights on this task list.';
// (hidden) titles and labels for accessibility annotations
$labels['quickaddinput'] = 'New task date and title';
$labels['arialabelquickaddbox'] = 'Quick add new task';
$labels['arialabelsearchform'] = 'Task search form';
$labels['arialabelquicksearchbox'] = 'Task search input';
$labels['arialabellistsearchform'] = 'Tasklists search form';
$labels['arialabeltaskselector'] = 'List mode';
$labels['arialabeltasklisting'] = 'Tasks listing';
// attendees
$labels['attendee'] = 'Participant';
$labels['role'] = 'Role';
$labels['availability'] = 'Avail.';
$labels['confirmstate'] = 'Status';
$labels['addattendee'] = 'Add participant';
$labels['roleorganizer'] = 'Organizer';
$labels['rolerequired'] = 'Required';
$labels['roleoptional'] = 'Optional';
$labels['rolechair'] = 'Chair';
$labels['rolenonparticipant'] = 'Absent';
$labels['sendinvitations'] = 'Send invitations';
$labels['sendnotifications'] = 'Notify participants about modifications';
$labels['sendcancellation'] = 'Notify participants about task cancellation';
$labels['invitationsubject'] = 'You\'ve been invited to "$title"';
$labels['invitationmailbody'] = "*\$title*\n\nWhen: \$date\n\nInvitees: \$attendees\n\nPlease find attached an iCalendar file with all the task details which you can import to your tasks application.";
$labels['invitationattendlinks'] = "In case your email client doesn't support iTip requests you can use the following link to either accept or decline this invitation:\n\$url";
$labels['eventupdatesubject'] = '"$title" has been updated';
$labels['eventupdatesubjectempty'] = 'A task that concerns you has been updated';
$labels['eventupdatemailbody'] = "*\$title*\n\nWhen: \$date\n\nInvitees: \$attendees\n\nPlease find attached an iCalendar file with the updated task details which you can import to your tasks application.";
$labels['eventcancelsubject'] = '"$title" has been canceled';
$labels['eventcancelmailbody'] = "*\$title*\n\nWhen: \$date\n\nInvitees: \$attendees\n\nThe task has been cancelled by \$organizer.\n\nPlease find attached an iCalendar file with the updated task details.";
// invitation handling (overrides labels from libcalendaring)
$labels['itipobjectnotfound'] = 'The task referred by this message was not found in your tasks list.';
$labels['itipmailbodyaccepted'] = "\$sender has accepted the assignment to the following task:\n\n*\$title*\n\nWhen: \$date\n\nInvitees: \$attendees";
$labels['itipmailbodytentative'] = "\$sender has tentatively accepted the assignment to the following task:\n\n*\$title*\n\nWhen: \$date\n\nInvitees: \$attendees";
$labels['itipmailbodydeclined'] = "\$sender has declined the assignment to the following task:\n\n*\$title*\n\nWhen: \$date\n\nInvitees: \$attendees";
$labels['itipmailbodycancel'] = "\$sender has rejected your assignment to the following task:\n\n*\$title*\n\nWhen: \$date";
$labels['itipdeclineevent'] = 'Do you want to decline your assignment to this task?';
$labels['declinedeleteconfirm'] = 'Do you also want to delete this declined task from your tasks list?';
$labels['itipcomment'] = 'Invitation/notification comment';
$labels['itipcommenttitle'] = 'This comment will be attached to the invitation/notification message sent to participants';
$labels['itipsendsuccess'] = 'Invitation sent to participants.';
$labels['errornotifying'] = 'Failed to send notifications to task participants';
$labels['andnmore'] = '$nr more...';
$labels['delegatedto'] = 'Delegated to: ';
$labels['delegatedfrom'] = 'Delegated from: ';
+$labels['savetotasklist'] = 'Save to tasks';
+$labels['comment'] = 'Comment';
+$labels['errorimportingtask'] = 'Failed to import task(s)';
+$labels['importwarningexists'] = 'A copy of this task already exists in your tasklist.';
+$labels['importsuccess'] = 'Successfully imported $nr tasks';
+$labels['newerversionexists'] = 'A newer version of this task already exists! Aborted.';
+$labels['nowritetasklistfound'] = 'No tasklist found to save the task';
+$labels['importedsuccessfully'] = 'The task was successfully added to \'$list\'';
+$labels['updatedsuccessfully'] = 'The task was successfully updated in \'$list\'';
+$labels['attendeupdateesuccess'] = 'Successfully updated the participant\'s status';
+$labels['itipresponseerror'] = 'Failed to send the response to this task invitation';
+$labels['itipinvalidrequest'] = 'This invitation is no longer valid';
+$labels['sentresponseto'] = 'Successfully sent invitation response to $mailto';
+$labels['successremoval'] = 'The task has been deleted successfully.';
diff --git a/plugins/tasklist/skins/larry/images/ical-attachment.png b/plugins/tasklist/skins/larry/images/ical-attachment.png
new file mode 100644
index 00000000..8fa486ae
Binary files /dev/null and b/plugins/tasklist/skins/larry/images/ical-attachment.png differ
diff --git a/plugins/tasklist/skins/larry/images/loading_blue.gif b/plugins/tasklist/skins/larry/images/loading_blue.gif
new file mode 100644
index 00000000..2ea6b19a
Binary files /dev/null and b/plugins/tasklist/skins/larry/images/loading_blue.gif differ
diff --git a/plugins/tasklist/skins/larry/images/tasklist.png b/plugins/tasklist/skins/larry/images/tasklist.png
new file mode 100644
index 00000000..50ed6300
Binary files /dev/null and b/plugins/tasklist/skins/larry/images/tasklist.png differ
diff --git a/plugins/tasklist/skins/larry/tasklist.css b/plugins/tasklist/skins/larry/tasklist.css
index 7bdfe570..bcdf29aa 100644
--- a/plugins/tasklist/skins/larry/tasklist.css
+++ b/plugins/tasklist/skins/larry/tasklist.css
@@ -1,1093 +1,1186 @@
/**
* Roundcube Taklist plugin styles for skin "Larry"
*
* Copyright (C) 2012, Kolab Systems AG <contact@kolabsys.com>
* Screendesign by FLINT / Büro für Gestaltung, bueroflint.com
*
* The contents are subject to the Creative Commons Attribution-ShareAlike
* License. It is allowed to copy, distribute, transmit and to adapt the work
* by keeping credits to the original autors in the README file.
* See http://creativecommons.org/licenses/by-sa/3.0/ for details.
*/
#taskbar a.button-tasklist span.button-inner {
background-image: url(buttons.png);
background-position: 0 0;
}
#taskbar a.button-tasklist:hover span.button-inner,
#taskbar a.button-tasklist.button-selected span.button-inner {
background-position: 0 -26px;
}
-ul.toolbarmenu li span.icon.taskadd {
+ul.toolbarmenu li span.icon.taskadd,
+#attachmentmenu li a.tasklistlink span.icon.taskadd {
background-image: url(buttons.png);
background-position: -4px -90px;
}
div.uidialog {
display: none;
}
body.attachmentwin #mainscreen {
top: 60px;
}
body.attachmentwin #topnav .topright {
margin-top: 20px;
}
.tasklistview #mainscreen {
min-width: 1000px !important;
min-height: 520px !important;
}
.tasklistview #header {
min-width: 1020px !important;
}
#sidebar {
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 240px;
}
.tasklistview #searchmenulink {
width: 15px;
}
#tagsbox {
position: absolute;
top: 42px;
left: 0;
width: 100%;
height: 242px;
}
#tasklistsbox {
position: absolute;
top: 300px;
left: 0;
width: 100%;
bottom: 0px;
}
#tasklistsbox .boxtitle a.iconbutton.search {
position: absolute;
top: 8px;
right: 8px;
width: 16px;
cursor: pointer;
background-position: -2px -317px;
}
#tasklistsbox .listsearchbox {
display: none;
}
#tasklistsbox .listsearchbox.expanded {
display: block;
}
#tasklistsbox .scroller {
top: 34px;
}
#tasklistsbox .listsearchbox.expanded + .scroller {
top: 68px;
}
#taskselector {
margin: -1px 40px 0 0;
padding: 0;
}
#taskselector li {
display: inline-block;
position: relative;
font-size: 90%;
padding-right: 0.3em;
}
.tagcloud li,
#taskselector li a {
display: inline-block;
color: #004458;
min-width: 3.5em;
padding: 0.2em 0.6em 0.2em 0.6em;
text-align: center;
text-decoration: none;
border: 1px solid #eee;
border-color: transparent;
}
.webkit .tagcloud li,
.webkit #taskselector li a {
padding-bottom: 0.25em;
}
#taskselector li:first-child {
border-top: 0;
border-radius: 4px 4px 0 0;
}
#taskselector li:last-child {
border-bottom: 0;
border-radius: 0 0 4px 4px;
}
#taskselector li.overdue a {
color: #b72a2a;
font-weight: bold;
}
#taskselector li.inactive a {
color: #97b3bf;
}
.tagcloud li.selected,
#taskselector li.selected a {
color: #fff;
background: #005d76;
background: -moz-linear-gradient(top, #005d76 0%, #004558 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#005d76), color-stop(100%,#004558));
background: -o-linear-gradient(top, #005d76 0%, #004558 100%);
background: -ms-linear-gradient(top, #005d76 0%, #004558 100%);
background: linear-gradient(top, #005d76 0%, #004558 100%);
box-shadow: inset 0 1px 1px 0 #003645;
-o-box-shadow: inset 0 1px 1px 0 #003645;
-webkit-box-shadow: inset 0 1px 1px 0 #003645;
-moz-box-shadow: inset 0 1px 1px 0 #003645;
border-color: #003645;
border-radius: 10px;
text-shadow: none;
}
#taskselector li .count {
display: none;
position: absolute;
top: -18px;
right: 5px;
min-width: 1.8em;
padding: 2px 4px;
background: #004558;
background: -moz-linear-gradient(top, #005d76 0%, #004558 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#005d76), color-stop(100%,#004558));
background: -o-linear-gradient(top, #005d76 0%, #004558 100%);
background: -ms-linear-gradient(top, #005d76 0%, #004558 100%);
background: linear-gradient(top, #005d76 0%, #004558 100%);
box-shadow: 0 1px 2px 0 rgba(24,24,24,0.6);
color: #fff;
border-radius: 3px;
text-align: center;
font-weight: bold;
font-size: 80%;
text-shadow: none;
}
#taskselector li .count:after {
content: "";
position: absolute;
bottom: -5px;
left: 50%;
margin-left: -5px;
border-style: solid;
border-width: 5px 5px 0;
border-color: #004558 transparent;
/* reduce the damage in FF3.0 */
display: block;
width: 0;
}
#taskselector li.overdue .count {
background: #ff3800;
}
#taskselector li.overdue .count:after {
border-color: #ff3800 transparent;
}
.tagcloud {
padding: 0;
margin: 6px;
list-style: none;
}
.tagcloud li {
display: inline-block;
color: #004458;
padding-right: 0.2em;
margin-right: 0.3em;
margin-bottom: 0.4em;
min-width: 1.2em;
cursor: pointer;
}
.tagcloud li.inactive {
color: #89b3be;
padding-right: 0.6em;
font-size: 80%;
/* display: none; */
}
.tagcloud li .count {
position: relative;
top: -1px;
margin-left: 5px;
padding: 0.15em 0.5em;
font-size: 80%;
font-weight: bold;
color: #59838e;
background: #c7e3ef;
box-shadow: inset 0 1px 1px 0 #b0ccd7;
-o-box-shadow: inset 0 1px 1px 0 #b0ccd7;
-webkit-box-shadow: inset 0 1px 1px 0 #b0ccd7;
-moz-box-shadow: inset 0 1px 1px 0 #b0ccd7;
border-color: #b0ccd7;
border-radius: 8px;
}
.tag-draghelper .tag .count,
.tagcloud li.inactive .count {
display: none;
}
#tasklistsbox .treelist li {
margin: 0;
display: block;
position: relative;
}
#tasklistsbox .treelist li div.tasklist {
margin: 0;
height: 20px;
padding: 6px 8px 2px 6px;
position: relative;
white-space: nowrap;
}
#tasklistsbox .treelist li.virtual > div.tasklist {
height: 14px;
}
#tasklistsbox .treelist ul li > div.tasklist {
margin-left: 16px;
}
#tasklistsbox .treelist ul ul li > div.tasklist {
margin-left: 32px;
}
#tasklistsbox .treelist ul ul ul li > div.tasklist {
margin-left: 48px;
}
#tasklistsbox .treelist li label {
display: block;
}
#tasklistsbox .treelist li span.listname {
display: block;
position: absolute;
top: 7px;
left: 38px;
right: 40px;
cursor: default;
padding: 0px 30px 2px 2px;
color: #004458;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background: url(sprites.png) right 20px no-repeat;
}
#tasklistsbox .treelist li a.quickview {
display: inline-block;
position: absolute;
top: 6px;
right: 24px;
width: 16px;
height: 16px;
padding: 0;
background: url(sprites.png) -200px 0 no-repeat;
overflow: hidden;
text-indent: -5000px;
cursor: pointer;
}
#tasklistsbox .treelist li a.subscribed {
display: inline-block;
position: absolute;
top: 6px;
right: 5px;
height: 16px;
width: 16px;
padding: 0;
background: url(sprites.png) -100px 0 no-repeat;
overflow: hidden;
text-indent: -5000px;
cursor: pointer;
}
#tasklistsbox .treelist div > a.subscribed:focus,
#tasklistsbox .treelist div:hover > a.subscribed {
background-position: -2px -215px;
}
#tasklistsbox .treelist div.subscribed a.subscribed {
background-position: -20px -215px;
}
#tasklistsbox .treelist div > a.quickview:focus,
#tasklistsbox .treelist li div:hover > a.quickview {
background-position: -20px -101px;
}
#tasklistsbox .treelist li div.focusview > a.quickview {
background-position: -2px -101px;
}
#tasklistsbox .searchresults .treelist li a.quickview {
display: none;
}
#tasklistsbox .treelist div a.quickview:focus,
#tasklistsbox .treelist div a.subscribed:focus {
border-radius: 3px;
outline: 2px solid rgba(30,150,192, 0.5);
}
#tasklistsbox .treelist li.selected > div > span.listname {
font-weight: bold;
}
#tasklistsbox .treelist .readonly > span.listname {
background-position: right -142px;
}
#tasklistsbox .treelist .user > span.listname {
background-position: right -160px;
}
#tasklistsbox .treelist .virtual > span.listname {
color: #aaa;
top: 4px;
left: 20px;
right: 5px;
}
#tasklistsbox .treelist.flat li span.calname {
left: 24px;
right: 22px;
}
#tasklistsbox .treelist li input {
position: absolute;
top: 5px;
left: 18px;
}
#tasklistsbox .treelist li .treetoggle {
top: 8px;
}
#tasklistsbox .treelist li.virtual > .treetoggle {
top: 6px;
}
#tasklistsbox .searchresults {
background: #b0ccd7;
margin-top: 8px;
}
#tasklistsbox .searchresults .boxtitle {
background: none;
padding: 2px 8px 2px 8px;
}
#tasklistsbox .searchresults .listing li {
background-color: #c7e3ef;
}
#mainview-right {
position: absolute;
top: 0;
left: 256px;
right: 0;
bottom: 0;
}
#taskstoolbar {
position: absolute;
top: -6px;
left: 0;
width: 100%;
height: 40px;
white-space: nowrap;
}
#taskstoolbar a.button.newtask {
background-image: url(buttons.png);
background-position: center -53px;
}
#quickaddbox {
position: absolute;
top: 2px;
left: 0;
width: 60%;
height: 32px;
white-space: nowrap;
}
#quickaddinput {
width: 85%;
margin: 0;
padding: 3px 8px;
height: 18px;
background: #f1f1f1;
background: rgba(255, 255, 255, 0.7);
border-color: #a3a3a3;
font-weight: bold;
}
#quickaddbox .button {
margin-left: 5px;
padding: 3px 10px;
font-weight: bold;
}
#tasksview {
position: absolute;
top: 42px;
left: 0;
right: 0;
bottom: 0;
padding-bottom: 28px;
background: rgba(255, 255, 255, 0.2);
overflow: visible;
}
#message.statusbar {
border-top: 1px solid #c3c3c3;
}
#tasksview .scroller {
position: absolute;
left: 0;
top: 35px;
width: 100%;
bottom: 0;
overflow: auto;
}
#tasksview .buttonbar {
color: #777;
background: #eee;
background: -moz-linear-gradient(top, #eee 0%, #dfdfdf 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eee), color-stop(100%,#dfdfdf));
background: -o-linear-gradient(top, #eee 0%, #dfdfdf 100%);
background: -ms-linear-gradient(top, #eee 0%, #dfdfdf 100%);
background: linear-gradient(top, #eee 0%, #dfdfdf 100%);
border-bottom: 1px solid #ccc;
position: relative;
line-height: 13px;
height: 20px;
}
#tasksview .buttonbar .buttonbar-right {
position: absolute;
top: 6px;
right: 8px;
}
.buttonbar-right .listmenu {
display: inline-block;
cursor: pointer;
}
.buttonbar-right .listmenu .inner {
display: inline-block;
height: 18px;
width: 20px;
padding: 0;
background: url(sprites.png) 0 -237px no-repeat;
text-indent: -5000px;
}
#thelist {
padding: 0;
margin: 1em;
list-style: none;
}
#listmessagebox {
display: none;
font-size: 14px;
color: #666;
margin: 1.5em;
text-shadow: 0px 1px 1px #fff;
text-align:center;
}
.taskitem {
position: relative;
display: block;
margin-bottom: 3px;
}
.taskitem.dragging {
opacity: 0.5;
}
.taskitem .childtasks {
position: relative;
padding: 0;
margin: 3px 0 0 20px;
list-style: none;
}
.taskitem .childtoggle {
display: none;
position: absolute;
top: 4px;
left: -5px;
padding: 2px;
font-size: 10px;
color: #727272;
cursor: pointer;
width: 14px;
height: 14px;
background: url(sprites.png) -2px -80px no-repeat;
text-indent: -1000px;
overflow: hidden;
}
.taskitem .childtoggle.collapsed {
background-position: -18px -81px;
}
.taskhead {
position: relative;
margin-left: 14px;
padding: 4px 5px 3px 5px;
border: 1px solid #fff;
border-radius: 5px;
background: #fff;
-webkit-box-shadow: 0 1px 1px 0 rgba(50, 50, 50, 0.5);
-moz-box-shadow: 0 1px 1px 0 rgba(50, 50, 50, 0.5);
box-shadow: 0 1px 1px 0 rgba(50, 50, 50, 0.5);
padding-right: 26em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: default;
outline: none;
}
.taskhead:focus,
.taskhead.droptarget {
border-color: #4787b1;
box-shadow: 0 0 5px 2px rgba(71,135,177, 0.9);
-moz-box-shadow: 0 0 5px 2px rgba(71,135,177, 0.9);
-webkit-box-shadow: 0 0 5px 2px rgba(71,135,177, 0.9);
-o-box-shadow: 0 0 5px 2px rgba(71,135,177, 0.9);
}
.taskhead .complete {
margin: -1px 1em 0 0;
}
.taskhead .title {
font-size: 12px;
}
.taskhead .flagged {
display: inline-block;
width: 16px;
height: 16px;
background: url(sprites.png) 1000px -3px no-repeat;
margin: -3px 1em 0 0;
vertical-align: middle;
cursor: pointer;
}
.taskhead .flagged:focus,
.taskhead:hover .flagged {
background-position: -2px -3px;
}
.taskhead.flagged .flagged {
background-position: -2px -23px;
}
.taskhead .tags {
display: block;
position: absolute;
top: 3px;
right: 10em;
max-width: 14em;
height: 16px;
overflow: hidden;
padding-top: 1px;
text-align: right;
}
.tag-draghelper .tag,
.taskhead .tags .tag {
font-size: 85%;
background: #d9ecf4;
border: 1px solid #c2dae5;
border-radius: 4px;
padding: 1px 7px;
margin-right: 3px;
}
.tag-draghelper li.tag {
list-style: none;
font-size: 100%;
}
.taskhead .date {
position: absolute;
top: 4px;
right: 30px;
text-align: right;
cursor: pointer;
}
.taskhead.nodate .date {
color: #ddd;
}
.taskhead.overdue .date {
color: #d00;
}
.taskhead.nodate:hover .date {
color: #999;
}
.taskhead .date input {
padding: 1px 2px;
border: 1px solid #ddd;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
outline: none;
text-align: right;
width: 6em;
font-size: 11px;
}
.taskhead .actions {
display: block;
position: absolute;
top: 3px;
right: 6px;
width: 18px;
height: 18px;
background: url(sprites.png) 1000px -80px no-repeat;
text-indent: -5000px;
overflow: hidden;
cursor: pointer;
}
.taskhead .actions:focus,
.taskhead:hover .actions {
background-position: 0 -80px;
}
.taskhead.complete {
opacity: 0.6;
}
.taskhead.complete .title {
text-decoration: line-through;
}
.taskhead .progressbar {
position: absolute;
bottom: 1px;
left: 6px;
right: 6px;
height: 2px;
}
.taskhead.complete .progressbar {
display: none;
}
.taskhead .progressvalue {
height: 1px;
background: rgba(1, 124, 180, 0.2);
border-top: 1px solid #219de6;
}
ul.toolbarmenu li span.add,
ul.toolbarmenu li span.expand,
ul.toolbarmenu li span.collapse {
background-image: url(sprites.png);
}
ul.toolbarmenu li span.add {
background-position: 0 -302px;
}
ul.toolbarmenu li span.expand {
background-position: 0 -258px;
}
ul.toolbarmenu li span.collapse {
background-position: 0 -280px;
}
ul.toolbarmenu li span.delete {
background-position: 0 -1508px;
}
.taskitem-draghelper {
/*
width: 32px;
height: 26px;
*/
background: #444;
border: 1px solid #555;
border-radius: 4px;
box-shadow: 0 2px 6px 0 #333;
-moz-box-shadow: 0 2px 6px 0 #333;
-webkit-box-shadow: 0 2px 6px 0 #333;
-o-box-shadow: 0 2px 6px 0 #333;
z-index: 5000;
padding: 2px 10px;
font-size: 20px;
color: #ccc;
opacity: 0.92;
filter: alpha(opacity=90);
text-shadow: 0px 1px 1px #333;
}
#rootdroppable {
display: none;
position: absolute;
top: 2px;
left: 1em;
right: 1em;
height: 5px;
background: #ddd;
border-radius: 3px;
}
#rootdroppable.droptarget {
background: #4787b1;
box-shadow: 0 0 2px 1px rgba(71,135,177, 0.9);
-moz-box-shadow: 0 0 2px 1px rgba(71,135,177, 0.9);
-webkit-box-shadow: 0 0 2px 1px rgba(71,135,177, 0.9);
-o-box-shadow: 0 0 2px 1px rgba(71,135,177, 0.9);
}
/*** task edit form ***/
#taskedit,
#taskshow {
display:none;
}
#taskedit {
position: relative;
top: -1.5em;
padding: 0.5em 0.1em;
margin: 0 -0.2em;
}
#taskshow h2 {
margin-top: -0.5em;
}
#taskshow label {
color: #999;
}
#task-parent-title {
position: relative;
top: -0.6em;
}
a.morelink {
font-size: 90%;
color: #0069a6;
text-decoration: none;
outline: none;
}
a.morelink:hover {
text-decoration: underline;
}
#taskedit .ui-tabs-panel {
min-height: 24em;
}
#taskeditform input.text,
#taskeditform textarea {
width: 97%;
}
#taskeditform .formbuttons {
margin: 0.5em 0;
}
#taskedit .border-after {
padding-bottom: 0.8em;
margin-bottom: 0.8em;
border-bottom: 2px solid #fafafa;
}
.edit-attendees-table {
width: 100%;
margin-top: 0.5em;
}
.edit-attendees-table th.role,
.edit-attendees-table td.role {
width: 9em;
}
.edit-attendees-table th.availability,
.edit-attendees-table td.availability,
.edit-attendees-table th.confirmstate,
.edit-attendees-table td.confirmstate {
width: 4em;
}
.edit-attendees-table th.options,
.edit-attendees-table td.options {
width: 16px;
padding: 2px 4px;
}
.edit-attendees-table th.sendmail,
.edit-attendees-table td.sendmail {
width: 44px;
padding: 2px;
}
.edit-attendees-table th.sendmail label {
display: inline-block;
position: relative;
top: 4px;
width: 24px;
height: 18px;
min-width: 24px;
padding: 0;
overflow: hidden;
text-indent: -5000px;
white-space: nowrap;
background: url(images/sendinvitation.png) 1px 0 no-repeat;
}
.edit-attendees-table th.name,
.edit-attendees-table td.name {
width: auto;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.edit-attendees-table td.name select {
width: 100%;
}
.edit-attendees-table a.deletelink {
display: inline-block;
width: 17px;
height: 17px;
padding: 0;
overflow: hidden;
text-indent: 1000px;
}
#edit-attendees-form {
position: relative;
margin-top: 15px;
}
#edit-attendees-form .attendees-invitebox {
text-align: right;
margin: 0;
}
#edit-attendees-form .attendees-invitebox label {
padding-right: 3px;
}
#taskedit-attachments {
margin: 0.6em 0;
}
#taskedit-attachments ul li {
display: block;
color: #333;
font-weight: bold;
padding: 8px 4px 3px 30px;
text-shadow: 0px 1px 1px #fff;
text-decoration: none;
white-space: nowrap;
}
#taskedit-attachments ul li a.file {
padding: 0;
}
#taskedit-attachments-form {
margin-top: 1em;
padding-top: 0.8em;
border-top: 2px solid #fafafa;
}
div.form-section {
position: relative;
margin-top: 0.2em;
margin-bottom: 0.8em;
}
.form-section label {
display: inline-block;
min-width: 7em;
padding-right: 0.5em;
margin-bottom: 0.3em;
}
label.block {
display: block;
margin-bottom: 0.3em;
}
#taskedit-completeness-slider {
display: inline-block;
margin-left: 2em;
width: 30em;
height: 0.8em;
border: 1px solid #ccc;
}
#taskedit-tagline {
width: 97%;
}
#taskedit .droptarget {
background-image: url(../../../../skins/larry/images/filedrop.png) !important;
background-position: center bottom !important;
background-repeat: no-repeat !important;
}
#taskedit .droptarget.hover,
#taskedit .droptarget.active {
border-color: #019bc6;
box-shadow: 0 0 3px 2px rgba(71,135,177, 0.5);
-moz-box-shadow: 0 0 3px 2px rgba(71,135,177, 0.5);
-webkit-box-shadow: 0 0 3px 2px rgba(71,135,177, 0.5);
-o-box-shadow: 0 0 3px 2px rgba(71,135,177, 0.5);
}
#taskedit .droptarget.hover {
background-color: #d9ecf4;
box-shadow: 0 0 5px 2px rgba(71,135,177, 0.9);
-moz-box-shadow: 0 0 5px 2px rgba(71,135,177, 0.9);
-webkit-box-shadow: 0 0 5px 2px rgba(71,135,177, 0.9);
-o-box-shadow: 0 0 5px 2px rgba(71,135,177, 0.9);
}
#task-attachments .attachmentslist li {
float: left;
margin-right: 1em;
}
#task-attachments .attachmentslist li a {
outline: none;
}
.task-attendees span.attendee {
padding-right: 18px;
margin-right: 0.5em;
background: url(images/attendee-status.png) right 0 no-repeat;
}
.task-attendees span.attendee a.mailtolink {
text-decoration: none;
white-space: nowrap;
outline: none;
}
.task-attendees span.attendee a.mailtolink:hover {
text-decoration: underline;
}
.task-attendees span.accepted {
background-position: right -20px;
}
.task-attendees span.declined {
background-position: right -40px;
}
.task-attendees span.tentative {
background-position: right -60px;
}
.task-attendees span.delegated {
background-position: right -180px;
}
.task-attendees span.organizer {
background-position: right -80px;
}
#all-task-attendees span.attendee {
display: block;
margin-bottom: 0.4em;
padding-bottom: 0.3em;
border-bottom: 1px solid #ddd;
}
.tasklistview .uidialog .tabbed {
min-width: 600px;
}
.tasklistview .uidialog .propform fieldset.ui-tabs-panel {
min-height: 290px;
}
.tasklistview .uidialog .propform #taskedit-tasklistame {
width: 20em;
}
.ui-dialog .task-update-confirm {
padding: 0 0.5em 0.5em 0.5em;
}
.task-dialog-message,
.task-update-confirm .message {
margin-top: 0.5em;
padding: 0.8em;
border: 1px solid #ffdf0e;
background-color: #fef893;
}
.task-dialog-message .message,
.task-update-confirm .message {
margin-bottom: 0.5em;
}
+/* Invitation UI in mail */
+
+.messagelist tbody .attachment span.ical {
+ display: inline-block;
+ vertical-align: middle;
+ height: 18px;
+ width: 20px;
+ padding: 0;
+ background: url(images/ical-attachment.png) 2px 1px no-repeat;
+}
+
+div.tasklist-invitebox {
+ min-height: 20px;
+ margin: 5px 8px;
+ padding: 3px 6px 6px 34px;
+ border: 1px solid #ffdf0e;
+ background: url(images/tasklist.png) 6px 5px no-repeat #fef893;
+}
+
+div.tasklist-invitebox td.ititle {
+ font-weight: bold;
+ padding-right: 0.5em;
+}
+
+div.tasklist-invitebox td.label {
+ color: #666;
+ padding-right: 1em;
+}
+
+#event-rsvp .rsvp-buttons,
+div.tasklist-invitebox .itip-buttons div {
+ margin-top: 0.5em;
+}
+
+#event-rsvp input.button,
+div.tasklist-invitebox input.button {
+ font-weight: bold;
+ margin-right: 0.5em;
+}
+
+div.tasklist-invitebox .folder-select {
+ font-weight: 10px;
+ margin-left: 1em;
+}
+
+div.tasklist-invitebox .rsvp-status {
+ padding-left: 2px;
+}
+
+div.tasklist-invitebox .rsvp-status.loading {
+ color: #666;
+ padding: 1px 0 2px 24px;
+ background: url(images/loading_blue.gif) top left no-repeat;
+}
+
+div.tasklist-invitebox .rsvp-status.hint {
+ color: #666;
+ text-shadow: none;
+ font-style: italic;
+}
+
+#event-partstat .changersvp,
+div.tasklist-invitebox .rsvp-status.declined,
+div.tasklist-invitebox .rsvp-status.tentative,
+div.tasklist-invitebox .rsvp-status.accepted,
+div.tasklist-invitebox .rsvp-status.delegated,
+div.tasklist-invitebox .rsvp-status.needs-action {
+ padding: 0 0 1px 22px;
+ background: url(images/attendee-status.png) 2px -20px no-repeat;
+}
+
+#event-partstat .changersvp.declined,
+div.tasklist-invitebox .rsvp-status.declined {
+ background-position: 2px -40px;
+}
+
+#event-partstat .changersvp.tentative,
+div.tasklist-invitebox .rsvp-status.tentative {
+ background-position: 2px -60px;
+}
+
+#event-partstat .changersvp.delegated,
+div.tasklist-invitebox .rsvp-status.delegated {
+ background-position: 2px -180px;
+}
+
+#event-partstat .changersvp.needs-action,
+div.tasklist-invitebox .rsvp-status.needs-action {
+ background-position: 2px 0;
+}
+
+
/** Special hacks for IE7 **/
/** They need to be in this file to also affect the task-create dialog embedded in mail view **/
html.ie7 #taskedit-completeness-slider {
display: inline;
}
diff --git a/plugins/tasklist/tasklist.php b/plugins/tasklist/tasklist.php
index 34b1ffb9..76ef2514 100644
--- a/plugins/tasklist/tasklist.php
+++ b/plugins/tasklist/tasklist.php
@@ -1,1278 +1,1808 @@
<?php
/**
* Tasks plugin for Roundcube webmail
*
* @version @package_version@
* @author Thomas Bruederli <bruederli@kolabsys.com>
*
* Copyright (C) 2012, Kolab Systems AG <contact@kolabsys.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class tasklist extends rcube_plugin
{
const FILTER_MASK_TODAY = 1;
const FILTER_MASK_TOMORROW = 2;
const FILTER_MASK_WEEK = 4;
const FILTER_MASK_LATER = 8;
const FILTER_MASK_NODATE = 16;
const FILTER_MASK_OVERDUE = 32;
const FILTER_MASK_FLAGGED = 64;
const FILTER_MASK_COMPLETE = 128;
const SESSION_KEY = 'tasklist_temp';
public static $filter_masks = array(
'today' => self::FILTER_MASK_TODAY,
'tomorrow' => self::FILTER_MASK_TOMORROW,
'week' => self::FILTER_MASK_WEEK,
'later' => self::FILTER_MASK_LATER,
'nodate' => self::FILTER_MASK_NODATE,
'overdue' => self::FILTER_MASK_OVERDUE,
'flagged' => self::FILTER_MASK_FLAGGED,
'complete' => self::FILTER_MASK_COMPLETE,
);
public $task = '?(?!login|logout).*';
public $rc;
public $lib;
public $driver;
public $timezone;
public $ui;
public $home; // declare public to be used in other classes
private $collapsed_tasks = array();
private $itip;
+ private $ical;
/**
* Plugin initialization.
*/
function init()
{
$this->require_plugin('libcalendaring');
$this->rc = rcube::get_instance();
$this->lib = libcalendaring::get_instance();
$this->register_task('tasks', 'tasklist');
// load plugin configuration
$this->load_config();
$this->timezone = $this->lib->timezone;
// proceed initialization in startup hook
$this->add_hook('startup', array($this, 'startup'));
$this->add_hook('user_delete', array($this, 'user_delete'));
}
/**
* Startup hook
*/
public function startup($args)
{
// the tasks module can be enabled/disabled by the kolab_auth plugin
if ($this->rc->config->get('tasklist_disabled', false) || !$this->rc->config->get('tasklist_enabled', true))
return;
// load localizations
$this->add_texts('localization/', $args['task'] == 'tasks' && (!$args['action'] || $args['action'] == 'print'));
$this->rc->load_language($_SESSION['language'], array('tasks.tasks' => $this->gettext('navtitle'))); // add label for task title
if ($args['task'] == 'tasks' && $args['action'] != 'save-pref') {
$this->load_driver();
// register calendar actions
$this->register_action('index', array($this, 'tasklist_view'));
$this->register_action('task', array($this, 'task_action'));
$this->register_action('tasklist', array($this, 'tasklist_action'));
$this->register_action('counts', array($this, 'fetch_counts'));
$this->register_action('fetch', array($this, 'fetch_tasks'));
$this->register_action('inlineui', array($this, 'get_inline_ui'));
$this->register_action('mail2task', array($this, 'mail_message2task'));
$this->register_action('get-attachment', array($this, 'attachment_get'));
$this->register_action('upload', array($this, 'attachment_upload'));
+ $this->register_action('mailimportitip', array($this, 'mail_import_itip'));
+ $this->register_action('mailimportattach', array($this, 'mail_import_attachment'));
+ $this->register_action('itip-status', array($this, 'task_itip_status'));
+ $this->register_action('itip-remove', array($this, 'task_itip_remove'));
+ $this->register_action('itip-decline-reply', array($this, 'mail_itip_decline_reply'));
$this->add_hook('refresh', array($this, 'refresh'));
$this->collapsed_tasks = array_filter(explode(',', $this->rc->config->get('tasklist_collapsed_tasks', '')));
}
else if ($args['task'] == 'mail') {
- // TODO: register hooks to catch ical/vtodo email attachments
if ($args['action'] == 'show' || $args['action'] == 'preview') {
- // $this->add_hook('message_load', array($this, 'mail_message_load'));
- // $this->add_hook('template_object_messagebody', array($this, 'mail_messagebody_html'));
+ $this->add_hook('message_load', array($this, 'mail_message_load'));
+ $this->add_hook('template_object_messagebody', array($this, 'mail_messagebody_html'));
}
// add 'Create event' item to message menu
if ($this->api->output->type == 'html') {
$this->api->add_content(html::tag('li', null,
$this->api->output->button(array(
'command' => 'tasklist-create-from-mail',
'label' => 'tasklist.createfrommail',
'type' => 'link',
'classact' => 'icon taskaddlink active',
'class' => 'icon taskaddlink',
'innerclass' => 'icon taskadd',
))),
'messagemenu');
$this->api->output->add_label('tasklist.createfrommail');
}
}
if (!$this->rc->output->ajax_call && !$this->rc->output->env['framed']) {
$this->load_ui();
$this->ui->init();
}
// add hooks for alarms handling
$this->add_hook('pending_alarms', array($this, 'pending_alarms'));
$this->add_hook('dismiss_alarms', array($this, 'dismiss_alarms'));
}
/**
*
*/
private function load_ui()
{
if (!$this->ui) {
require_once($this->home . '/tasklist_ui.php');
$this->ui = new tasklist_ui($this);
}
}
/**
* Helper method to load the backend driver according to local config
*/
private function load_driver()
{
if (is_object($this->driver))
return;
$driver_name = $this->rc->config->get('tasklist_driver', 'database');
$driver_class = 'tasklist_' . $driver_name . '_driver';
require_once($this->home . '/drivers/tasklist_driver.php');
require_once($this->home . '/drivers/' . $driver_name . '/' . $driver_class . '.php');
switch ($driver_name) {
case "kolab":
$this->require_plugin('libkolab');
default:
$this->driver = new $driver_class($this);
break;
}
$this->rc->output->set_env('tasklist_driver', $driver_name);
}
/**
* Dispatcher for task-related actions initiated by the client
*/
public function task_action()
{
$filter = intval(get_input_value('filter', RCUBE_INPUT_GPC));
$action = get_input_value('action', RCUBE_INPUT_GPC);
$rec = get_input_value('t', RCUBE_INPUT_POST, true);
$oldrec = $rec;
$success = $refresh = false;
switch ($action) {
case 'new':
$oldrec = null;
$rec = $this->prepare_task($rec);
$rec['uid'] = $this->generate_uid();
$temp_id = $rec['tempid'];
if ($success = $this->driver->create_task($rec)) {
$refresh = $this->driver->get_task($rec);
if ($temp_id) $refresh['tempid'] = $temp_id;
$this->cleanup_task($rec);
}
break;
case 'edit':
$rec = $this->prepare_task($rec);
$clone = $this->handle_recurrence($rec, $this->driver->get_task($rec));
if ($success = $this->driver->edit_task($rec)) {
$refresh[] = $this->driver->get_task($rec);
$this->cleanup_task($rec);
// add clone from recurring task
if ($clone && $this->driver->create_task($clone)) {
$refresh[] = $this->driver->get_task($clone);
$this->driver->clear_alarms($rec['id']);
}
// move all childs if list assignment was changed
if (!empty($rec['_fromlist']) && !empty($rec['list']) && $rec['_fromlist'] != $rec['list']) {
foreach ($this->driver->get_childs(array('id' => $rec['id'], 'list' => $rec['_fromlist']), true) as $cid) {
$child = array('id' => $cid, 'list' => $rec['list'], '_fromlist' => $rec['_fromlist']);
if ($this->driver->move_task($child)) {
$r = $this->driver->get_task($child);
if ((bool)($filter & self::FILTER_MASK_COMPLETE) == $this->driver->is_complete($r)) {
$refresh[] = $r;
}
}
}
}
}
break;
case 'move':
foreach ((array)$rec['id'] as $id) {
$r = $rec;
$r['id'] = $id;
if ($this->driver->move_task($r)) {
$refresh[] = $this->driver->get_task($r);
$success = true;
// move all childs, too
foreach ($this->driver->get_childs(array('id' => $rec['id'], 'list' => $rec['_fromlist']), true) as $cid) {
$child = $rec;
$child['id'] = $cid;
if ($this->driver->move_task($child)) {
$r = $this->driver->get_task($child);
if ((bool)($filter & self::FILTER_MASK_COMPLETE) == $this->driver->is_complete($r)) {
$refresh[] = $r;
}
}
}
}
}
break;
case 'delete':
$mode = intval(get_input_value('mode', RCUBE_INPUT_POST));
$oldrec = $this->driver->get_task($rec);
if ($success = $this->driver->delete_task($rec, false)) {
// delete/modify all childs
foreach ($this->driver->get_childs($rec, $mode) as $cid) {
$child = array('id' => $cid, 'list' => $rec['list']);
if ($mode == 1) { // delete all childs
if ($this->driver->delete_task($child, false)) {
if ($this->driver->undelete)
$_SESSION['tasklist_undelete'][$rec['id']][] = $cid;
}
else
$success = false;
}
else {
$child['parent_id'] = strval($oldrec['parent_id']);
$this->driver->edit_task($child);
}
}
// update parent task to adjust list of children
if (!empty($oldrec['parent_id'])) {
$refresh[] = $this->driver->get_task(array('id' => $oldrec['parent_id'], 'list' => $rec['list']));
}
}
if (!$success)
$this->rc->output->command('plugin.reload_data');
break;
case 'undelete':
if ($success = $this->driver->undelete_task($rec)) {
$refresh[] = $this->driver->get_task($rec);
foreach ((array)$_SESSION['tasklist_undelete'][$rec['id']] as $cid) {
if ($this->driver->undelete_task($rec)) {
$refresh[] = $this->driver->get_task($rec);
}
}
}
break;
case 'collapse':
foreach (explode(',', $rec['id']) as $rec_id) {
if (intval(get_input_value('collapsed', RCUBE_INPUT_GPC))) {
$this->collapsed_tasks[] = $rec_id;
}
else {
$i = array_search($rec_id, $this->collapsed_tasks);
if ($i !== false)
unset($this->collapsed_tasks[$i]);
}
}
$this->rc->user->save_prefs(array('tasklist_collapsed_tasks' => join(',', array_unique($this->collapsed_tasks))));
return; // avoid further actions
}
if ($success) {
$this->rc->output->show_message('successfullysaved', 'confirmation');
$this->update_counts($oldrec, $refresh);
}
else {
$this->rc->output->show_message('tasklist.errorsaving', 'error');
}
// send out notifications
if ($success && $rec['_notify'] && ($rec['attendees'] || $oldrec['attendees'])) {
// make sure we have the complete record
$task = $action == 'delete' ? $oldrec : $this->driver->get_task($rec);
// only notify if data really changed (TODO: do diff check on client already)
if (!$oldrec || $action == 'delete' || self::task_diff($event, $old)) {
$sent = $this->notify_attendees($task, $oldrec, $action, $rec['_comment']);
if ($sent > 0)
$this->rc->output->show_message('tasklist.itipsendsuccess', 'confirmation');
else if ($sent < 0)
$this->rc->output->show_message('tasklist.errornotifying', 'error');
}
}
// unlock client
$this->rc->output->command('plugin.unlock_saving');
if ($refresh) {
if ($refresh['id']) {
$this->encode_task($refresh);
}
else if (is_array($refresh)) {
foreach ($refresh as $i => $r)
$this->encode_task($refresh[$i]);
}
$this->rc->output->command('plugin.update_task', $refresh);
}
}
/**
* Load iTIP functions
*/
private function load_itip()
{
if (!$this->itip) {
require_once realpath(__DIR__ . '/../libcalendaring/lib/libcalendaring_itip.php');
$this->itip = new libcalendaring_itip($this, 'tasklist');
// if ($this->rc->config->get('kolab_invitation_tasklists')) {
// $this->itip->set_rsvp_actions(array('accepted','tentative','declined','needs-action'));
// }
}
return $this->itip;
}
/**
* repares new/edited task properties before save
*/
private function prepare_task($rec)
{
// try to be smart and extract date from raw input
if ($rec['raw']) {
foreach (array('today','tomorrow','sunday','monday','tuesday','wednesday','thursday','friday','saturday','sun','mon','tue','wed','thu','fri','sat') as $word) {
$locwords[] = '/^' . preg_quote(mb_strtolower($this->gettext($word))) . '\b/i';
$normwords[] = $word;
$datewords[] = $word;
}
foreach (array('jan','feb','mar','apr','may','jun','jul','aug','sep','oct','now','dec') as $month) {
$locwords[] = '/(' . preg_quote(mb_strtolower($this->gettext('long'.$month))) . '|' . preg_quote(mb_strtolower($this->gettext($month))) . ')\b/i';
$normwords[] = $month;
$datewords[] = $month;
}
foreach (array('on','this','next','at') as $word) {
$fillwords[] = preg_quote(mb_strtolower($this->gettext($word)));
$fillwords[] = $word;
}
$raw = trim($rec['raw']);
$date_str = '';
// translate localized keywords
$raw = preg_replace('/^(' . join('|', $fillwords) . ')\s*/i', '', $raw);
$raw = preg_replace($locwords, $normwords, $raw);
// find date pattern
$date_pattern = '!^(\d+[./-]\s*)?((?:\d+[./-])|' . join('|', $datewords) . ')\.?(\s+\d{4})?[:;,]?\s+!i';
if (preg_match($date_pattern, $raw, $m)) {
$date_str .= $m[1] . $m[2] . $m[3];
$raw = preg_replace(array($date_pattern, '/^(' . join('|', $fillwords) . ')\s*/i'), '', $raw);
// add year to date string
if ($m[1] && !$m[3])
$date_str .= date('Y');
}
// find time pattern
$time_pattern = '/^(\d+([:.]\d+)?(\s*[hapm.]+)?),?\s+/i';
if (preg_match($time_pattern, $raw, $m)) {
$has_time = true;
$date_str .= ($date_str ? ' ' : 'today ') . $m[1];
$raw = preg_replace($time_pattern, '', $raw);
}
// yes, raw input matched a (valid) date
if (strlen($date_str) && strtotime($date_str) && ($date = new DateTime($date_str, $this->timezone))) {
$rec['date'] = $date->format('Y-m-d');
if ($has_time)
$rec['time'] = $date->format('H:i');
$rec['title'] = $raw;
}
else
$rec['title'] = $rec['raw'];
}
// normalize input from client
if (isset($rec['complete'])) {
$rec['complete'] = floatval($rec['complete']);
if ($rec['complete'] > 1)
$rec['complete'] /= 100;
}
if (isset($rec['flagged']))
$rec['flagged'] = intval($rec['flagged']);
// fix for garbage input
if ($rec['description'] == 'null')
$rec['description'] = '';
foreach ($rec as $key => $val) {
if ($val === 'null')
$rec[$key] = null;
}
if (!empty($rec['date'])) {
$this->normalize_dates($rec, 'date', 'time');
}
if (!empty($rec['startdate'])) {
$this->normalize_dates($rec, 'startdate', 'starttime');
}
// convert tags to array, filter out empty entries
if (isset($rec['tags']) && !is_array($rec['tags'])) {
$rec['tags'] = array_filter((array)$rec['tags']);
}
// convert the submitted alarm values
if ($rec['valarms']) {
$valarms = array();
foreach (libcalendaring::from_client_alarms($rec['valarms']) as $alarm) {
// alarms can only work with a date (either task start, due or absolute alarm date)
if (is_a($alarm['trigger'], 'DateTime') || $rec['date'] || $rec['startdate'])
$valarms[] = $alarm;
}
$rec['valarms'] = $valarms;
}
// convert the submitted recurrence settings
if (is_array($rec['recurrence'])) {
$refdate = null;
if (!empty($rec['date'])) {
$refdate = new DateTime($rec['date'] . ' ' . $rec['time'], $this->timezone);
}
else if (!empty($rec['startdate'])) {
$refdate = new DateTime($rec['startdate'] . ' ' . $rec['starttime'], $this->timezone);
}
if ($refdate) {
$rec['recurrence'] = $this->lib->from_client_recurrence($rec['recurrence'], $refdate);
// translate count into an absolute end date.
// why? because when shifting completed tasks to the next recurrence,
// the initial start date to count from gets lost.
if ($rec['recurrence']['COUNT']) {
$engine = libcalendaring::get_recurrence();
$engine->init($rec['recurrence'], $refdate);
if ($until = $engine->end()) {
$rec['recurrence']['UNTIL'] = $until;
unset($rec['recurrence']['COUNT']);
}
}
}
else { // recurrence requires a reference date
$rec['recurrence'] = '';
}
}
$attachments = array();
$taskid = $rec['id'];
if (is_array($_SESSION[self::SESSION_KEY]) && $_SESSION[self::SESSION_KEY]['id'] == $taskid) {
if (!empty($_SESSION[self::SESSION_KEY]['attachments'])) {
foreach ($_SESSION[self::SESSION_KEY]['attachments'] as $id => $attachment) {
if (is_array($rec['attachments']) && in_array($id, $rec['attachments'])) {
$attachments[$id] = $this->rc->plugins->exec_hook('attachment_get', $attachment);
unset($attachments[$id]['abort'], $attachments[$id]['group']);
}
}
}
}
$rec['attachments'] = $attachments;
if (is_numeric($rec['id']) && $rec['id'] < 0)
unset($rec['id']);
return $rec;
}
/**
* Utility method to convert a tasks date/time values into a normalized format
*/
private function normalize_dates(&$rec, $date_key, $time_key)
{
try {
// parse date from user format (#2801)
$date_format = $this->rc->config->get(empty($rec[$time_key]) ? 'date_format' : 'date_long', 'Y-m-d');
$date = DateTime::createFromFormat($date_format, trim($rec[$date_key] . ' ' . $rec[$time_key]), $this->timezone);
// fall back to default strtotime logic
if (empty($date)) {
$date = new DateTime($rec[$date_key] . ' ' . $rec[$time_key], $this->timezone);
}
$rec[$date_key] = $date->format('Y-m-d');
if (!empty($rec[$time_key]))
$rec[$time_key] = $date->format('H:i');
return true;
}
catch (Exception $e) {
$rec[$date_key] = $rec[$time_key] = null;
}
return false;
}
/**
* Releases some resources after successful save
*/
private function cleanup_task(&$rec)
{
// remove temp. attachment files
if (!empty($_SESSION[self::SESSION_KEY]) && ($taskid = $_SESSION[self::SESSION_KEY]['id'])) {
$this->rc->plugins->exec_hook('attachments_cleanup', array('group' => $taskid));
$this->rc->session->remove(self::SESSION_KEY);
}
}
/**
* When flagging a recurring task as complete,
* clone it and shift dates to the next occurrence
*/
private function handle_recurrence(&$rec, $old)
{
$clone = null;
if ($this->driver->is_complete($rec) && $old && !$this->driver->is_complete($old) && is_array($rec['recurrence'])) {
$engine = libcalendaring::get_recurrence();
$rrule = $rec['recurrence'];
$updates = array();
// compute the next occurrence of date attributes
foreach (array('date'=>'time', 'startdate'=>'starttime') as $date_key => $time_key) {
if (empty($rec[$date_key]))
continue;
$date = new DateTime($rec[$date_key] . ' ' . $rec[$time_key], $this->timezone);
$engine->init($rrule, $date);
if ($next = $engine->next()) {
$updates[$date_key] = $next->format('Y-m-d');
if (!empty($rec[$time_key]))
$updates[$time_key] = $next->format('H:i');
}
}
// shift absolute alarm dates
if (!empty($updates) && is_array($rec['valarms'])) {
$updates['valarms'] = array();
unset($rrule['UNTIL'], $rrule['COUNT']); // make recurrence rule unlimited
foreach ($rec['valarms'] as $i => $alarm) {
if ($alarm['trigger'] instanceof DateTime) {
$engine->init($rrule, $alarm['trigger']);
if ($next = $engine->next()) {
$alarm['trigger'] = $next;
}
}
$updates['valarms'][$i] = $alarm;
}
}
if (!empty($updates)) {
// clone task to save a completed copy
$clone = $rec;
$clone['uid'] = $this->generate_uid();
$clone['parent_id'] = $rec['id'];
unset($clone['id'], $clone['recurrence'], $clone['attachments']);
// update the task but unset completed flag
$rec = array_merge($rec, $updates);
$rec['complete'] = $old['complete'];
$rec['status'] = $old['status'];
}
}
return $clone;
}
/**
* Send out an invitation/notification to all task attendees
*/
private function notify_attendees($task, $old, $action = 'edit', $comment = null)
{
if ($action == 'delete' || ($task['status'] == 'CANCELLED' && $old['status'] != $task['status'])) {
$task['cancelled'] = true;
$is_cancelled = true;
}
$itip = $this->load_itip();
$emails = $this->lib->get_user_emails();
// add comment to the iTip attachment
$task['comment'] = $comment;
// needed to generate VTODO instead of VEVENT entry
$task['_type'] = 'task';
// compose multipart message using PEAR:Mail_Mime
$method = $action == 'delete' ? 'CANCEL' : 'REQUEST';
$message = $itip->compose_itip_message($task, $method);
// list existing attendees from the $old task
$old_attendees = array();
foreach ((array)$old['attendees'] as $attendee) {
$old_attendees[] = $attendee['email'];
}
// send to every attendee
$sent = 0; $current = array();
foreach ((array)$task['attendees'] as $attendee) {
$current[] = strtolower($attendee['email']);
// skip myself for obvious reasons
if (!$attendee['email'] || in_array(strtolower($attendee['email']), $emails)) {
continue;
}
// skip if notification is disabled for this attendee
if ($attendee['noreply']) {
continue;
}
// which template to use for mail text
$is_new = !in_array($attendee['email'], $old_attendees);
$bodytext = $is_cancelled ? 'eventcancelmailbody' : ($is_new ? 'invitationmailbody' : 'eventupdatemailbody');
$subject = $is_cancelled ? 'eventcancelsubject' : ($is_new ? 'invitationsubject' : ($task['title'] ? 'eventupdatesubject' : 'eventupdatesubjectempty'));
// finally send the message
if ($itip->send_itip_message($task, $method, $attendee, $subject, $bodytext, $message))
$sent++;
else
$sent = -100;
}
// send CANCEL message to removed attendees
foreach ((array)$old['attendees'] as $attendee) {
if ($attendee['ROLE'] == 'ORGANIZER' || !$attendee['email'] || in_array(strtolower($attendee['email']), $current)) {
continue;
}
$vevent = $old;
$vevent['cancelled'] = $is_cancelled;
$vevent['attendees'] = array($attendee);
$vevent['comment'] = $comment;
if ($itip->send_itip_message($vevent, 'CANCEL', $attendee, 'eventcancelsubject', 'eventcancelmailbody'))
$sent++;
else
$sent = -100;
}
return $sent;
}
/**
* Compare two task objects and return differing properties
*
* @param array Event A
* @param array Event B
* @return array List of differing task properties
*/
public static function task_diff($a, $b)
{
$diff = array();
$ignore = array('changed' => 1, 'attachments' => 1);
foreach (array_unique(array_merge(array_keys($a), array_keys($b))) as $key) {
if (!$ignore[$key] && $a[$key] != $b[$key])
$diff[] = $key;
}
// only compare number of attachments
if (count($a['attachments']) != count($b['attachments']))
$diff[] = 'attachments';
return $diff;
}
/**
* Dispatcher for tasklist actions initiated by the client
*/
public function tasklist_action()
{
$action = get_input_value('action', RCUBE_INPUT_GPC);
$list = get_input_value('l', RCUBE_INPUT_GPC, true);
$success = false;
if (isset($list['showalarms']))
$list['showalarms'] = intval($list['showalarms']);
switch ($action) {
case 'form-new':
case 'form-edit':
echo $this->ui->tasklist_editform($action, $list);
exit;
case 'new':
$list += array('showalarms' => true, 'active' => true, 'editable' => true);
if ($insert_id = $this->driver->create_list($list)) {
$list['id'] = $insert_id;
if (!$list['_reload']) {
$this->load_ui();
$list['html'] = $this->ui->tasklist_list_item($insert_id, $list, $jsenv);
$list += (array)$jsenv[$insert_id];
}
$this->rc->output->command('plugin.insert_tasklist', $list);
$success = true;
}
break;
case 'edit':
if ($newid = $this->driver->edit_list($list)) {
$list['oldid'] = $list['id'];
$list['id'] = $newid;
$this->rc->output->command('plugin.update_tasklist', $list);
$success = true;
}
break;
case 'subscribe':
$success = $this->driver->subscribe_list($list);
break;
case 'remove':
if (($success = $this->driver->remove_list($list)))
$this->rc->output->command('plugin.destroy_tasklist', $list);
break;
case 'search':
$this->load_ui();
$results = array();
foreach ((array)$this->driver->search_lists(get_input_value('q', RCUBE_INPUT_GPC), get_input_value('source', RCUBE_INPUT_GPC)) as $id => $prop) {
$editname = $prop['editname'];
unset($prop['editname']); // force full name to be displayed
$prop['active'] = false;
// let the UI generate HTML and CSS representation for this calendar
$html = $this->ui->tasklist_list_item($id, $prop, $jsenv);
$prop += (array)$jsenv[$id];
$prop['editname'] = $editname;
$prop['html'] = $html;
$results[] = $prop;
}
// report more results available
if ($this->driver->search_more_results) {
$this->rc->output->show_message('autocompletemore', 'info');
}
$this->rc->output->command('multi_thread_http_response', $results, get_input_value('_reqid', RCUBE_INPUT_GPC));
return;
}
if ($success)
$this->rc->output->show_message('successfullysaved', 'confirmation');
else
$this->rc->output->show_message('tasklist.errorsaving', 'error');
$this->rc->output->command('plugin.unlock_saving');
}
/**
* Get counts for active tasks divided into different selectors
*/
public function fetch_counts()
{
if (isset($_REQUEST['lists'])) {
$lists = get_input_value('lists', RCUBE_INPUT_GPC);
}
else {
foreach ($this->driver->get_lists() as $list) {
if ($list['active'])
$lists[] = $list['id'];
}
}
$counts = $this->driver->count_tasks($lists);
$this->rc->output->command('plugin.update_counts', $counts);
}
/**
* Adjust the cached counts after changing a task
*/
public function update_counts($oldrec, $newrec)
{
// rebuild counts until this function is finally implemented
$this->fetch_counts();
// $this->rc->output->command('plugin.update_counts', $counts);
}
/**
*
*/
public function fetch_tasks()
{
$f = intval(get_input_value('filter', RCUBE_INPUT_GPC));
$search = get_input_value('q', RCUBE_INPUT_GPC);
$filter = array('mask' => $f, 'search' => $search);
$lists = get_input_value('lists', RCUBE_INPUT_GPC);;
/*
// convert magic date filters into a real date range
switch ($f) {
case self::FILTER_MASK_TODAY:
$today = new DateTime('now', $this->timezone);
$filter['from'] = $filter['to'] = $today->format('Y-m-d');
break;
case self::FILTER_MASK_TOMORROW:
$tomorrow = new DateTime('now + 1 day', $this->timezone);
$filter['from'] = $filter['to'] = $tomorrow->format('Y-m-d');
break;
case self::FILTER_MASK_OVERDUE:
$yesterday = new DateTime('yesterday', $this->timezone);
$filter['to'] = $yesterday->format('Y-m-d');
break;
case self::FILTER_MASK_WEEK:
$today = new DateTime('now', $this->timezone);
$filter['from'] = $today->format('Y-m-d');
$weekend = new DateTime('now + 7 days', $this->timezone);
$filter['to'] = $weekend->format('Y-m-d');
break;
case self::FILTER_MASK_LATER:
$date = new DateTime('now + 8 days', $this->timezone);
$filter['from'] = $date->format('Y-m-d');
break;
}
*/
$data = $this->tasks_data($this->driver->list_tasks($filter, $lists), $f, $tags);
$this->rc->output->command('plugin.data_ready', array('filter' => $f, 'lists' => $lists, 'search' => $search, 'data' => $data, 'tags' => array_values(array_unique($tags))));
}
/**
* Prepare and sort the given task records to be sent to the client
*/
private function tasks_data($records, $f, &$tags)
{
$data = $tags = $this->task_tree = $this->task_titles = array();
foreach ($records as $rec) {
if ($rec['parent_id']) {
$this->task_tree[$rec['id']] = $rec['parent_id'];
}
$this->encode_task($rec);
if (!empty($rec['tags']))
$tags = array_merge($tags, (array)$rec['tags']);
// apply filter; don't trust the driver on this :-)
if ((!$f && !$this->driver->is_complete($rec)) || ($rec['mask'] & $f))
$data[] = $rec;
}
// sort tasks according to their hierarchy level and due date
array_walk($data, array($this, 'task_walk_tree'));
usort($data, array($this, 'task_sort_cmp'));
return $data;
}
/**
* Prepare the given task record before sending it to the client
*/
private function encode_task(&$rec)
{
$rec['mask'] = $this->filter_mask($rec);
$rec['flagged'] = intval($rec['flagged']);
$rec['complete'] = floatval($rec['complete']);
$rec['changed'] = is_object($rec['changed']) ? $rec['changed']->format('U') : null;
if ($rec['date']) {
try {
$date = new DateTime($rec['date'] . ' ' . $rec['time'], $this->timezone);
$rec['datetime'] = intval($date->format('U'));
$rec['date'] = $date->format($this->rc->config->get('date_format', 'Y-m-d'));
$rec['_hasdate'] = 1;
}
catch (Exception $e) {
$rec['date'] = $rec['datetime'] = null;
}
}
else {
$rec['date'] = $rec['datetime'] = null;
$rec['_hasdate'] = 0;
}
if ($rec['startdate']) {
try {
$date = new DateTime($rec['startdate'] . ' ' . $rec['starttime'], $this->timezone);
$rec['startdatetime'] = intval($date->format('U'));
$rec['startdate'] = $date->format($this->rc->config->get('date_format', 'Y-m-d'));
}
catch (Exception $e) {
$rec['startdate'] = $rec['startdatetime'] = null;
}
}
if ($rec['valarms']) {
$rec['alarms_text'] = libcalendaring::alarms_text($rec['valarms']);
$rec['valarms'] = libcalendaring::to_client_alarms($rec['valarms']);
}
if ($rec['recurrence']) {
$rec['recurrence_text'] = $this->lib->recurrence_text($rec['recurrence']);
$rec['recurrence'] = $this->lib->to_client_recurrence($rec['recurrence'], $rec['time'] || $rec['starttime']);
}
foreach ((array)$rec['attachments'] as $k => $attachment) {
$rec['attachments'][$k]['classname'] = rcube_utils::file2class($attachment['mimetype'], $attachment['name']);
}
if (!is_array($rec['tags']))
$rec['tags'] = (array)$rec['tags'];
sort($rec['tags'], SORT_LOCALE_STRING);
if (in_array($rec['id'], $this->collapsed_tasks))
$rec['collapsed'] = true;
if (empty($rec['parent_id']))
$rec['parent_id'] = null;
$this->task_titles[$rec['id']] = $rec['title'];
}
/**
* Callback function for array_walk over all tasks.
* Sets tree depth and parent titles
*/
private function task_walk_tree(&$rec)
{
$rec['_depth'] = 0;
$parent_id = $this->task_tree[$rec['id']];
while ($parent_id) {
$rec['_depth']++;
$rec['parent_title'] = $this->task_titles[$parent_id];
$parent_id = $this->task_tree[$parent_id];
}
}
/**
* Compare function for task list sorting.
* Nested tasks need to be sorted to the end.
*/
private function task_sort_cmp($a, $b)
{
$d = $a['_depth'] - $b['_depth'];
if (!$d) $d = $b['_hasdate'] - $a['_hasdate'];
if (!$d) $d = $a['datetime'] - $b['datetime'];
return $d;
}
/**
* Compute the filter mask of the given task
*
* @param array Hash array with Task record properties
* @return int Filter mask
*/
public function filter_mask($rec)
{
static $today, $tomorrow, $weeklimit;
if (!$today) {
$today_date = new DateTime('now', $this->timezone);
$today = $today_date->format('Y-m-d');
$tomorrow_date = new DateTime('now + 1 day', $this->timezone);
$tomorrow = $tomorrow_date->format('Y-m-d');
$week_date = new DateTime('now + 7 days', $this->timezone);
$weeklimit = $week_date->format('Y-m-d');
}
$mask = 0;
$start = $rec['startdate'] ?: '1900-00-00';
$duedate = $rec['date'] ?: '3000-00-00';
if ($rec['flagged'])
$mask |= self::FILTER_MASK_FLAGGED;
if ($this->driver->is_complete($rec))
$mask |= self::FILTER_MASK_COMPLETE;
if (empty($rec['date']))
$mask |= self::FILTER_MASK_NODATE;
else if ($rec['date'] < $today)
$mask |= self::FILTER_MASK_OVERDUE;
if ($duedate <= $today || ($rec['startdate'] && $start <= $today))
$mask |= self::FILTER_MASK_TODAY;
if ($duedate <= $tomorrow || ($rec['startdate'] && $start <= $tomorrow))
$mask |= self::FILTER_MASK_TOMORROW;
if (($start > $tomorrow && $start <= $weeklimit) || ($duedate > $tomorrow && $duedate <= $weeklimit))
$mask |= self::FILTER_MASK_WEEK;
else if ($start > $weeklimit || ($rec['date'] && $duedate > $weeklimit))
$mask |= self::FILTER_MASK_LATER;
return $mask;
}
/******* UI functions ********/
/**
* Render main view of the tasklist task
*/
public function tasklist_view()
{
$this->ui->init();
$this->ui->init_templates();
// set autocompletion env
$this->rc->output->set_env('autocomplete_threads', (int)$this->rc->config->get('autocomplete_threads', 0));
$this->rc->output->set_env('autocomplete_max', (int)$this->rc->config->get('autocomplete_max', 15));
$this->rc->output->set_env('autocomplete_min_length', $this->rc->config->get('autocomplete_min_length'));
$this->rc->output->add_label('autocompletechars', 'autocompletemore');
$this->rc->output->set_pagetitle($this->gettext('navtitle'));
$this->rc->output->send('tasklist.mainview');
}
/**
*
*/
public function get_inline_ui()
{
foreach (array('save','cancel','savingdata') as $label)
$texts['tasklist.'.$label] = $this->gettext($label);
$texts['tasklist.newtask'] = $this->gettext('createfrommail');
$this->ui->init_templates();
echo $this->api->output->parse('tasklist.taskedit', false, false);
echo html::tag('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $this->url($this->local_skin_path() . '/tagedit.css'), 'nl' => true));
echo html::tag('script', array('type' => 'text/javascript'),
"rcmail.set_env('tasklists', " . json_encode($this->api->output->env['tasklists']) . ");\n".
"rcmail.add_label(" . json_encode($texts) . ");\n"
);
exit;
}
/**
* Handler for keep-alive requests
* This will check for updated data in active lists and sync them to the client
*/
public function refresh($attr)
{
// refresh the entire list every 10th time to also sync deleted items
if (rand(0,10) == 10) {
$this->rc->output->command('plugin.reload_data');
return;
}
$filter = array(
'since' => $attr['last'],
'search' => get_input_value('q', RCUBE_INPUT_GPC),
'mask' => intval(get_input_value('filter', RCUBE_INPUT_GPC)) & self::FILTER_MASK_COMPLETE,
);
$lists = get_input_value('lists', RCUBE_INPUT_GPC);;
$updates = $this->driver->list_tasks($filter, $lists);
if (!empty($updates)) {
$this->rc->output->command('plugin.refresh_tasks', $this->tasks_data($updates, 255, $tags), true);
// update counts
$counts = $this->driver->count_tasks($lists);
$this->rc->output->command('plugin.update_counts', $counts);
}
}
/**
* Handler for pending_alarms plugin hook triggered by the calendar module on keep-alive requests.
* This will check for pending notifications and pass them to the client
*/
public function pending_alarms($p)
{
$this->load_driver();
if ($alarms = $this->driver->pending_alarms($p['time'] ?: time())) {
foreach ($alarms as $alarm) {
// encode alarm object to suit the expectations of the calendaring code
if ($alarm['date'])
$alarm['start'] = new DateTime($alarm['date'].' '.$alarm['time'], $this->timezone);
$alarm['id'] = 'task:' . $alarm['id']; // prefix ID with task:
$alarm['allday'] = empty($alarm['time']) ? 1 : 0;
$p['alarms'][] = $alarm;
}
}
return $p;
}
/**
* Handler for alarm dismiss hook triggered by the calendar module
*/
public function dismiss_alarms($p)
{
$this->load_driver();
foreach ((array)$p['ids'] as $id) {
if (strpos($id, 'task:') === 0)
$p['success'] |= $this->driver->dismiss_alarm(substr($id, 5), $p['snooze']);
}
return $p;
}
/******* Attachment handling *******/
/**
* Handler for attachments upload
*/
public function attachment_upload()
{
$this->lib->attachment_upload(self::SESSION_KEY);
}
/**
* Handler for attachments download/displaying
*/
public function attachment_get()
{
// show loading page
if (!empty($_GET['_preload'])) {
return $this->lib->attachment_loading_page();
}
$task = get_input_value('_t', RCUBE_INPUT_GPC);
$list = get_input_value('_list', RCUBE_INPUT_GPC);
$id = get_input_value('_id', RCUBE_INPUT_GPC);
$task = array('id' => $task, 'list' => $list);
$attachment = $this->driver->get_attachment($id, $task);
// show part page
if (!empty($_GET['_frame'])) {
$this->lib->attachment = $attachment;
$this->register_handler('plugin.attachmentframe', array($this->lib, 'attachment_frame'));
$this->register_handler('plugin.attachmentcontrols', array($this->lib, 'attachment_header'));
$this->rc->output->send('tasklist.attachment');
}
// deliver attachment content
else if ($attachment) {
$attachment['body'] = $this->driver->get_attachment_body($id, $task);
$this->lib->attachment_get($attachment);
}
// if we arrive here, the requested part was not found
header('HTTP/1.1 404 Not Found');
exit;
}
/******* Email related function *******/
public function mail_message2task()
{
$uid = get_input_value('_uid', RCUBE_INPUT_POST);
$mbox = get_input_value('_mbox', RCUBE_INPUT_POST);
$task = array();
// establish imap connection
$imap = $this->rc->get_storage();
$imap->set_mailbox($mbox);
$message = new rcube_message($uid);
if ($message->headers) {
$task['title'] = trim($message->subject);
$task['description'] = trim($message->first_text_part());
$task['id'] = -$uid;
$this->load_driver();
// copy mail attachments to task
if ($message->attachments && $this->driver->attachments) {
if (!is_array($_SESSION[self::SESSION_KEY]) || $_SESSION[self::SESSION_KEY]['id'] != $task['id']) {
$_SESSION[self::SESSION_KEY] = array();
$_SESSION[self::SESSION_KEY]['id'] = $task['id'];
$_SESSION[self::SESSION_KEY]['attachments'] = array();
}
foreach ((array)$message->attachments as $part) {
$attachment = array(
'data' => $imap->get_message_part($uid, $part->mime_id, $part),
'size' => $part->size,
'name' => $part->filename,
'mimetype' => $part->mimetype,
'group' => $task['id'],
);
$attachment = $this->rc->plugins->exec_hook('attachment_save', $attachment);
if ($attachment['status'] && !$attachment['abort']) {
$id = $attachment['id'];
$attachment['classname'] = rcube_utils::file2class($attachment['mimetype'], $attachment['name']);
// store new attachment in session
unset($attachment['status'], $attachment['abort'], $attachment['data']);
$_SESSION[self::SESSION_KEY]['attachments'][$id] = $attachment;
$attachment['id'] = 'rcmfile' . $attachment['id']; // add prefix to consider it 'new'
$task['attachments'][] = $attachment;
}
}
}
$this->rc->output->command('plugin.mail2taskdialog', $task);
}
else {
$this->rc->output->command('display_message', $this->gettext('messageopenerror'), 'error');
}
$this->rc->output->send();
}
+ /**
+ * Check mail message structure of there are .ics files attached
+ *
+ * @todo move to libcalendaring
+ */
+ public function mail_message_load($p)
+ {
+ $this->message = $p['object'];
+ $itip_part = null;
+
+ // check all message parts for .ics files
+ foreach ((array)$this->message->mime_parts as $part) {
+ if ($this->is_vcalendar($part)) {
+ if ($part->ctype_parameters['method'])
+ $itip_part = $part->mime_id;
+ else
+ $this->ics_parts[] = $part->mime_id;
+ }
+ }
+
+ // priorize part with method parameter
+ if ($itip_part) {
+ $this->ics_parts = array($itip_part);
+ }
+ }
+
+ /**
+ * Add UI element to copy event invitations or updates to the calendar
+ *
+ * @todo move to libcalendaring
+ */
+ public function mail_messagebody_html($p)
+ {
+ // load iCalendar functions (if necessary)
+ if (!empty($this->ics_parts)) {
+ $this->get_ical();
+ $this->load_itip();
+ }
+
+ // @todo: Calendar plugin does the same, which means the
+ // attachment body is fetched twice, this is not optimal
+ $html = '';
+ foreach ($this->ics_parts as $mime_id) {
+ $part = $this->message->mime_parts[$mime_id];
+ $charset = $part->ctype_parameters['charset'] ? $part->ctype_parameters['charset'] : RCMAIL_CHARSET;
+ $objects = $this->ical->import($this->message->get_part_content($mime_id), $charset);
+ $title = $this->gettext('title');
+
+ // successfully parsed events?
+ if (empty($objects)) {
+ continue;
+ }
+
+ // show a box for every task in the file
+ foreach ($objects as $idx => $task) {
+ if ($task['_type'] != 'task') {
+ continue;
+ }
+
+ // get prepared inline UI for this event object
+ $html .= html::div('tasklist-invitebox',
+ $this->itip->mail_itip_inline_ui(
+ $task,
+ $this->ical->method,
+ $mime_id . ':' . $idx,
+ 'tasks',
+ rcube_utils::anytodatetime($this->message->headers->date)
+ )
+ );
+
+ // limit listing
+ if ($idx >= 3) {
+ break;
+ }
+ }
+ }
+
+ // prepend event boxes to message body
+ if ($html) {
+ $this->load_ui();
+ $this->ui->init();
+
+ $p['content'] = $html . $p['content'];
+
+ $this->rc->output->add_label('tasklist.savingdata','tasklist.deletetaskconfirm','tasklist.declinedeleteconfirm');
+
+ // add "Save to calendar" button into attachment menu
+ $this->add_button(array(
+ 'id' => 'attachmentsavetask',
+ 'name' => 'attachmentsavetask',
+ 'type' => 'link',
+ 'wrapper' => 'li',
+ 'command' => 'attachment-save-task',
+ 'class' => 'icon tasklistlink',
+ 'classact' => 'icon tasklistlink active',
+ 'innerclass' => 'icon taskadd',
+ 'label' => 'tasklist.savetotasklist',
+ ), 'attachmentmenu');
+ }
+
+ return $p;
+ }
+
+ /**
+ * Read the given mime message from IMAP and parse ical data
+ *
+ * @todo move to libcalendaring
+ */
+ private function mail_get_itip_task($mbox, $uid, $mime_id)
+ {
+ $charset = RCMAIL_CHARSET;
+
+ // establish imap connection
+ $imap = $this->rc->get_storage();
+ $imap->set_mailbox($mbox);
+
+ if ($uid && $mime_id) {
+ list($mime_id, $index) = explode(':', $mime_id);
+
+ $part = $imap->get_message_part($uid, $mime_id);
+ $headers = $imap->get_message_headers($uid);
+
+ if ($part->ctype_parameters['charset']) {
+ $charset = $part->ctype_parameters['charset'];
+ }
+
+ if ($part) {
+ $tasks = $this->get_ical()->import($part, $charset);
+ }
+ }
+
+ // successfully parsed events?
+ if (!empty($tasks) && ($task = $tasks[$index])) {
+ // store the message's sender address for comparisons
+ $task['_sender'] = preg_match('/([a-z0-9][a-z0-9\-\.\+\_]*@[^&@"\'.][^@&"\']*\\.([^\\x00-\\x40\\x5b-\\x60\\x7b-\\x7f]{2,}|xn--[a-z0-9]{2,}))/', $headers->from, $m) ? $m[1] : '';
+ $askt['_sender_utf'] = rcube_idn_to_utf8($task['_sender']);
+
+ return $task;
+ }
+
+ return null;
+ }
+
+ /**
+ * Checks if specified message part is a vcalendar data
+ *
+ * @param rcube_message_part Part object
+ *
+ * @return boolean True if part is of type vcard
+ *
+ * @todo move to libcalendaring
+ */
+ private function is_vcalendar($part)
+ {
+ return (
+ in_array($part->mimetype, array('text/calendar', 'text/x-vcalendar', 'application/ics')) ||
+ // Apple sends files as application/x-any (!?)
+ ($part->mimetype == 'application/x-any' && $part->filename && preg_match('/\.ics$/i', $part->filename))
+ );
+ }
+
+ /**
+ * Load iCalendar functions
+ */
+ public function get_ical()
+ {
+ if (!$this->ical) {
+ $this->ical = libcalendaring::get_ical();
+ }
+
+ return $this->ical;
+ }
+
+ /**
+ * Get properties of the tasklist this user has specified as default
+ */
+ public function get_default_tasklist($writeable = false)
+ {
+// $default_id = $this->rc->config->get('tasklist_default_list');
+ $lists = $this->driver->get_lists();
+// $list = $calendars[$default_id] ?: null;
+
+ if (!$list || ($writeable && !$list['editable'])) {
+ foreach ($lists as $l) {
+ if ($l['default']) {
+ $list = $l;
+ break;
+ }
+
+ if (!$writeable || $l['editable']) {
+ $first = $l;
+ }
+ }
+ }
+
+ return $list ?: $first;
+ }
+
+ /**
+ * Import the full payload from a mail message attachment
+ */
+ public function mail_import_attachment()
+ {
+ $uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST);
+ $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST);
+ $mime_id = rcube_utils::get_input_value('_part', rcube_utils::INPUT_POST);
+ $charset = RCMAIL_CHARSET;
+
+ // establish imap connection
+ $imap = $this->rc->get_storage();
+ $imap->set_mailbox($mbox);
+
+ if ($uid && $mime_id) {
+ $part = $imap->get_message_part($uid, $mime_id);
+ $headers = $imap->get_message_headers($uid);
+
+ if ($part->ctype_parameters['charset']) {
+ $charset = $part->ctype_parameters['charset'];
+ }
+
+ if ($part) {
+ $tasks = $this->get_ical()->import($part, $charset);
+ }
+ }
+
+ $success = $existing = 0;
+
+ if (!empty($tasks)) {
+ // find writeable tasklist to store task
+ $cal_id = !empty($_REQUEST['_list']) ? rcube_utils::get_input_value('_list', rcube_utils::INPUT_POST) : null;
+ $lists = $this->driver->get_lists();
+ $list = $lists[$cal_id] ?: $this->get_default_tasklist(true);
+
+ foreach ($tasks as $task) {
+ // save to tasklist
+ if ($list && $list['editable'] && $task['_type'] == 'task') {
+ $task['list'] = $list['id'];
+
+ if (!$this->driver->get_task($task['uid'])) {
+ $success += (bool) $this->driver->create_task($task);
+ }
+ else {
+ $existing++;
+ }
+ }
+ }
+ }
+
+ if ($success) {
+ $this->rc->output->command('display_message', $this->gettext(array(
+ 'name' => 'importsuccess',
+ 'vars' => array('nr' => $success),
+ )), 'confirmation');
+ }
+ else if ($existing) {
+ $this->rc->output->command('display_message', $this->gettext('importwarningexists'), 'warning');
+ }
+ else {
+ $this->rc->output->command('display_message', $this->gettext('errorimportingtask'), 'error');
+ }
+ }
+
+ /**
+ * Handler for POST request to import an event attached to a mail message
+ */
+ public function mail_import_itip()
+ {
+ $uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST);
+ $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST);
+ $mime_id = rcube_utils::get_input_value('_part', rcube_utils::INPUT_POST);
+ $status = rcube_utils::get_input_value('_status', rcube_utils::INPUT_POST);
+ $delete = intval(rcube_utils::get_input_value('_del', rcube_utils::INPUT_POST));
+ $noreply = intval(rcube_utils::get_input_value('_noreply', rcube_utils::INPUT_POST)) || $status == 'needs-action';
+
+ $error_msg = $this->gettext('errorimportingtask');
+ $success = false;
+
+ // successfully parsed tasks?
+ if ($task = $this->mail_get_itip_task($mbox, $uid, $mime_id)) {
+ // find writeable list to store the task
+ $list_id = !empty($_REQUEST['_list']) ? rcube_utils::get_input_value('_list', rcube_utils::INPUT_POST) : null;
+ $lists = $this->driver->get_lists();
+ $list = $lists[$list_id] ?: $this->get_default_tasklist(true);
+
+ $metadata = array(
+ 'uid' => $task['uid'],
+ 'changed' => is_object($task['changed']) ? $task['changed']->format('U') : 0,
+ 'sequence' => intval($task['sequence']),
+ 'fallback' => strtoupper($status),
+ 'method' => $this->ical->method,
+ 'task' => 'tasks',
+ );
+
+ // update my attendee status according to submitted method
+ if (!empty($status)) {
+ $organizer = null;
+ $emails = $this->lib->get_user_emails();
+
+ foreach ($task['attendees'] as $i => $attendee) {
+ if ($attendee['role'] == 'ORGANIZER') {
+ $organizer = $attendee;
+ }
+ else if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
+ $metadata['attendee'] = $attendee['email'];
+ $metadata['rsvp'] = $attendee['role'] != 'NON-PARTICIPANT';
+ $reply_sender = $attendee['email'];
+
+ $task['attendees'][$i]['status'] = strtoupper($status);
+ if ($task['attendees'][$i]['status'] != 'NEEDS-ACTION') {
+ unset($task['attendees'][$i]['rsvp']); // remove RSVP attribute
+ }
+ }
+ }
+
+ // add attendee with this user's default identity if not listed
+ if (!$reply_sender) {
+ $sender_identity = $this->rc->user->get_identity();
+ $task['attendees'][] = array(
+ 'name' => $sender_identity['name'],
+ 'email' => $sender_identity['email'],
+ 'role' => 'OPT-PARTICIPANT',
+ 'status' => strtoupper($status),
+ );
+ $metadata['attendee'] = $sender_identity['email'];
+ }
+ }
+
+ // save to tasklist
+ if ($list && $list['editable']) {
+ $task['list'] = $list['id'];
+
+ // check for existing task with the same UID
+ $existing = $this->driver->get_task($task['uid']);
+
+ if ($existing) {
+ // only update attendee status
+ if ($this->ical->method == 'REPLY') {
+ // try to identify the attendee using the email sender address
+ $existing_attendee = -1;
+ foreach ($existing['attendees'] as $i => $attendee) {
+ if ($task['_sender'] && ($attendee['email'] == $task['_sender'] || $attendee['email'] == $task['_sender_utf'])) {
+ $existing_attendee = $i;
+ break;
+ }
+ }
+
+ $task_attendee = null;
+ foreach ($task['attendees'] as $attendee) {
+ if ($task['_sender'] && ($attendee['email'] == $task['_sender'] || $attendee['email'] == $task['_sender_utf'])) {
+ $task_attendee = $attendee;
+ $metadata['fallback'] = $attendee['status'];
+ $metadata['attendee'] = $attendee['email'];
+ $metadata['rsvp'] = $attendee['rsvp'] || $attendee['role'] != 'NON-PARTICIPANT';
+ break;
+ }
+ }
+
+ // found matching attendee entry in both existing and new events
+ if ($existing_attendee >= 0 && $task_attendee) {
+ $existing['attendees'][$existing_attendee] = $task_attendee;
+ $success = $this->driver->edit_task($existing);
+ }
+ // update the entire attendees block
+ else if (($task['sequence'] >= $existing['sequence'] || $task['changed'] >= $existing['changed']) && $task_attendee) {
+ $existing['attendees'][] = $task_attendee;
+ $success = $this->driver->edit_task($existing);
+ }
+ else {
+ $error_msg = $this->gettext('newerversionexists');
+ }
+ }
+ // delete the task when declined
+ else if ($status == 'declined' && $delete) {
+ $deleted = $this->driver->delete_task($existing, true);
+ $success = true;
+ }
+ // import the (newer) task
+ else if ($task['sequence'] >= $existing['sequence'] || $task['changed'] >= $existing['changed']) {
+ $task['id'] = $existing['id'];
+ $task['list'] = $existing['list'];
+
+ // preserve my participant status for regular updates
+ if (empty($status)) {
+ $emails = $this->lib->get_user_emails();
+ foreach ($task['attendees'] as $i => $attendee) {
+ if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
+ foreach ($existing['attendees'] as $j => $_attendee) {
+ if ($attendee['email'] == $_attendee['email']) {
+ $task['attendees'][$i] = $existing['attendees'][$j];
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // set status=CANCELLED on CANCEL messages
+ if ($this->ical->method == 'CANCEL') {
+ $task['status'] = 'CANCELLED';
+ }
+ // show me as free when declined (#1670)
+ if ($status == 'declined' || $task['status'] == 'CANCELLED') {
+ $task['free_busy'] = 'free';
+ }
+
+ $success = $this->driver->edit_task($task);
+ }
+ else if (!empty($status)) {
+ $existing['attendees'] = $task['attendees'];
+ if ($status == 'declined') { // show me as free when declined (#1670)
+ $existing['free_busy'] = 'free';
+ }
+
+ $success = $this->driver->edit_event($existing);
+ }
+ else {
+ $error_msg = $this->gettext('newerversionexists');
+ }
+ }
+ else if (!$existing && ($status != 'declined' || $this->rc->config->get('kolab_invitation_tasklists'))) {
+ $success = $this->driver->create_task($task);
+ }
+ else if ($status == 'declined') {
+ $error_msg = null;
+ }
+ }
+ else if ($status == 'declined') {
+ $error_msg = null;
+ }
+ else {
+ $error_msg = $this->gettext('nowritetasklistfound');
+ }
+ }
+
+ if ($success) {
+ $message = $this->ical->method == 'REPLY' ? 'attendeupdateesuccess' : ($deleted ? 'successremoval' : ($existing ? 'updatedsuccessfully' : 'importedsuccessfully'));
+ $this->rc->output->command('display_message', $this->gettext(array('name' => $message, 'vars' => array('list' => $list['name']))), 'confirmation');
+
+ $metadata['rsvp'] = intval($metadata['rsvp']);
+ $metadata['after_action'] = $this->rc->config->get('tasklist_itip_after_action');
+
+ $this->rc->output->command('plugin.itip_message_processed', $metadata);
+ $error_msg = null;
+ }
+ else if ($error_msg) {
+ $this->rc->output->command('display_message', $error_msg, 'error');
+ }
+
+ // send iTip reply
+ if ($this->ical->method == 'REQUEST' && $organizer && !$noreply && !in_array(strtolower($organizer['email']), $emails) && !$error_msg) {
+ $task['comment'] = rcube_utils::get_input_value('_comment', rcube_utils::INPUT_POST);
+ $itip = $this->load_itip();
+ $itip->set_sender_email($reply_sender);
+
+ if ($itip->send_itip_message($task, 'REPLY', $organizer, 'itipsubject' . $status, 'itipmailbody' . $status))
+ $this->rc->output->command('display_message', $this->gettext(array('name' => 'sentresponseto', 'vars' => array('mailto' => $organizer['name'] ? $organizer['name'] : $organizer['email']))), 'confirmation');
+ else
+ $this->rc->output->command('display_message', $this->gettext('itipresponseerror'), 'error');
+ }
+
+ $this->rc->output->send();
+ }
+
+
+ /**** Task invitation plugin hooks ****/
+
+ /**
+ * Handler for calendar/itip-status requests
+ */
+ function task_itip_status()
+ {
+ $data = rcube_utils::get_input_value('data', rcube_utils::INPUT_POST, true);
+
+ // find local copy of the referenced task
+ $existing = $this->driver->get_task($data);
+ $itip = $this->load_itip();
+ $response = $itip->get_itip_status($data, $existing);
+
+ // get a list of writeable lists to save new tasks to
+ if (!$existing && $response['action'] == 'rsvp' || $response['action'] == 'import') {
+ $lists = $this->driver->get_lists();
+ $select = new html_select(array('name' => 'tasklist', 'id' => 'itip-saveto', 'is_escaped' => true));
+ $num = 0;
+
+ foreach ($lists as $list) {
+ if ($list['editable']) {
+ $select->add($list['name'], $list['id']);
+ $num++;
+ }
+ }
+
+ if ($num <= 1) {
+ $select = null;
+ }
+ }
+
+ if ($select) {
+ $default_list = $this->get_default_tasklist(true);
+ $response['select'] = html::span('folder-select', $this->gettext('saveintasklist') . '&nbsp;' .
+ $select->show($this->rc->config->get('tasklist_default_list', $default_list['id'])));
+ }
+
+ $this->rc->output->command('plugin.update_itip_object_status', $response);
+ }
+
+ /**
+ * Handler for calendar/itip-remove requests
+ */
+ function task_itip_remove()
+ {
+ $success = false;
+ $uid = rcube_utils::get_input_value('uid', rcube_utils::INPUT_POST);
+
+ // search for event if only UID is given
+ if ($task = $this->driver->get_task($uid)) {
+ $success = $this->driver->delete_task($task, true);
+ }
+
+ if ($success) {
+ $this->rc->output->show_message('tasklist.successremoval', 'confirmation');
+ }
+ else {
+ $this->rc->output->show_message('tasklist.errorsaving', 'error');
+ }
+ }
+
/******* Utility functions *******/
/**
* Generate a unique identifier for an event
*/
public function generate_uid()
{
return strtoupper(md5(time() . uniqid(rand())) . '-' . substr(md5($this->rc->user->get_username()), 0, 16));
}
/**
* Handler for user_delete plugin hook
*/
public function user_delete($args)
{
$this->load_driver();
return $this->driver->user_delete($args);
}
}
-
diff --git a/plugins/tasklist/tasklist_base.js b/plugins/tasklist/tasklist_base.js
index 6e93b15d..81e27f0f 100644
--- a/plugins/tasklist/tasklist_base.js
+++ b/plugins/tasklist/tasklist_base.js
@@ -1,107 +1,132 @@
/**
* Client scripts for the Tasklist plugin
*
* @author Thomas Bruederli <bruederli@kolabsys.com>
*
* @licstart The following is the entire license notice for the
* JavaScript code in this file.
*
* Copyright (C) 2013, Kolab Systems AG <contact@kolabsys.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @licend The above is the entire license notice
* for the JavaScript code in this file.
*/
function rcube_tasklist(settings)
{
/* private vars */
var ui_loaded = false;
var me = this;
/* public members */
this.ui;
/* public methods */
this.create_from_mail = create_from_mail;
this.mail2taskdialog = mail2task_dialog;
+ this.save_to_tasklist = save_to_tasklist;
/**
* Open a new task dialog prefilled with contents from the currently selected mail message
*/
function create_from_mail(uid)
{
if (uid || (uid = rcmail.get_single_uid())) {
// load calendar UI (scripts and edit dialog template)
if (!ui_loaded) {
$.when(
$.getScript('./plugins/tasklist/tasklist.js'),
$.getScript('./plugins/tasklist/jquery.tagedit.js'),
$.get(rcmail.url('tasks/inlineui'), function(html){ $(document.body).append(html); }, 'html')
).then(function() {
// register attachments form
// rcmail.gui_object('attachmentlist', 'attachmentlist');
ui_loaded = true;
me.ui = new rcube_tasklist_ui(settings);
create_from_mail(uid); // start over
});
return;
}
else {
// get message contents for task dialog
var lock = rcmail.set_busy(true, 'loading');
rcmail.http_post('tasks/mail2task', {
'_mbox': rcmail.env.mailbox,
'_uid': uid
}, lock);
}
}
}
/**
* Callback function to put the given task properties into the dialog
*/
function mail2task_dialog(prop)
{
this.ui.edit_task(null, 'new', prop);
}
+ // handler for attachment-save-tasklist commands
+ function save_to_tasklist()
+ {
+ // TODO: show dialog to select the tasklist for importing
+ if (this.selected_attachment && window.rcube_libcalendaring) {
+ rcmail.http_post('tasks/mailimportattach', {
+ _uid: rcmail.env.uid,
+ _mbox: rcmail.env.mailbox,
+ _part: this.selected_attachment,
+ // _list: $('#tasklist-attachment-saveto').val(),
+ }, rcmail.set_busy(true, 'itip.savingdata'));
+ }
+ }
+
}
/* tasklist plugin initialization (for email task) */
window.rcmail && rcmail.env.task == 'mail' && rcmail.addEventListener('init', function(evt) {
var tasks = new rcube_tasklist(rcmail.env.libcal_settings);
- rcmail.register_command('tasklist-create-from-mail', function() { tasks.create_from_mail() });
- rcmail.addEventListener('plugin.mail2taskdialog', function(p){ tasks.mail2taskdialog(p) });
- rcmail.addEventListener('plugin.unlock_saving', function(p){ tasks.ui && tasks.ui.unlock_saving(); });
+ rcmail.register_command('tasklist-create-from-mail', function() { tasks.create_from_mail(); });
+ rcmail.register_command('attachment-save-task', function() { tasks.save_to_tasklist(); });
+ rcmail.addEventListener('plugin.mail2taskdialog', function(p) { tasks.mail2taskdialog(p); });
+ rcmail.addEventListener('plugin.unlock_saving', function(p) { tasks.ui && tasks.ui.unlock_saving(); });
if (rcmail.env.action != 'show')
rcmail.env.message_commands.push('tasklist-create-from-mail');
else
rcmail.enable_command('tasklist-create-from-mail', true);
+ rcmail.addEventListener('beforemenu-open', function(p) {
+ if (p.menu == 'attachmentmenu') {
+ tasks.selected_attachment = p.id;
+ var mimetype = rcmail.env.attachments[p.id],
+ is_ics = mimetype == 'text/calendar' || mimetype == 'text/x-vcalendar' || mimetype == 'application/ics';
+
+ rcmail.enable_command('attachment-save-task', is_ics);
+ }
+ });
+
// add contextmenu item
if (window.rcm_contextmenu_register_command) {
rcm_contextmenu_register_command(
'tasklist-create-from-mail',
function(cmd,el){ tasks.create_from_mail() },
'tasklist.createfrommail',
'moveto');
}
});
-

File Metadata

Mime Type
text/x-diff
Expires
Mon, Jun 9, 10:00 AM (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
196794
Default Alt Text
(107 KB)

Event Timeline