Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1974903
tasklist_base.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
tasklist_base.js
View Options
/**
* 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
(
$
.
extend
(
rcmail
.
env
.
tasklist_settings
,
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
.
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
);
}
});
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Sep 15, 9:40 AM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
287519
Default Alt Text
tasklist_base.js (4 KB)
Attached To
Mode
R14 roundcubemail-plugins-kolab
Attached
Detach File
Event Timeline
Log In to Comment