00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00031
00032 #ifdef HAVE_CONFIG_H
00033 #include "autoconfig.h"
00034 #endif
00035
00036 #include "pages.h"
00037 #include "common.h"
00038 #include "content_manager.h"
00039
00040 using namespace zmm;
00041 using namespace mxml;
00042
00043 void web::tasks::process()
00044 {
00045 check_request();
00046 String action = param(_("action"));
00047 if (! string_ok(action))
00048 throw _Exception(_("web:tasks called with illegal action"));
00049 Ref<ContentManager> cm = ContentManager::getInstance();
00050
00051 if (action == "list")
00052 {
00053 Ref<Element> tasksEl (new Element(_("tasks")));
00054 tasksEl->setArrayName(_("task"));
00055 root->appendElementChild(tasksEl);
00056 Ref<Array<GenericTask> > taskList = cm->getTasklist();
00057 if (taskList == nil)
00058 return;
00059 int count = taskList->size();
00060 for (int i = 0; i < count; i++)
00061 {
00062 appendTask(tasksEl, taskList->get(i));
00063 }
00064 }
00065 else if (action == "cancel")
00066 {
00067 int taskID = intParam(_("task_id"));
00068 cm->invalidateTask(taskID);
00069 }
00070 else
00071 throw _Exception(_("web:tasks called with illegal action"));
00072 }