1 /* Copyright (C) 2000-2003 Thomas Bopp, Thorsten Hampel, Ludger Merkens
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 inherit "/factories/RoomFactory";
23 #include <attributes.h>
25 class CalendarFactory : public RoomFactory{
35 init_class_attribute(CALENDAR_TIMETABLE_START, CMD_TYPE_INT,
37 EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 8*60);
39 init_class_attribute(CALENDAR_TIMETABLE_END, CMD_TYPE_INT,
41 EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 18*60);
43 init_class_attribute(CALENDAR_TIMETABLE_ROTATION, CMD_TYPE_INT,
44 "timetable rotation", 0,
45 EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 60);
47 init_class_attribute(CALENDAR_DATE_TYPE, CMD_TYPE_MAPPING,
48 "calendar date type", 0,
49 EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, ([ ]));
51 init_class_attribute(CALENDAR_TRASH, CMD_TYPE_OBJECT,
53 EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
55 init_class_attribute(CALENDAR_STORAGE, CMD_TYPE_OBJECT,
56 "calendar storage", 0,
57 EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
59 init_class_attribute(CALENDAR_OWNER, CMD_TYPE_OBJECT,
61 EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
64 object execute(mapping vars)
67 try_event(EVENT_EXECUTE, CALLER, obj);
68 if ( vars->transient ) {
69 if ( mappingp(vars->attributes) )
70 vars->attributes[OBJ_TEMP] = 1;
72 vars->attributes = ([ OBJ_TEMP : 1 ]);
75 obj = ::object_create(vars["name"], CLASS_NAME_CALENDAR, 0,
77 vars["attributesAcquired"],
78 vars["attributesLocked"],
80 vars["sanctionMeta"]);
82 object factory = _Server->get_factory(CLASS_TRASHBIN);
83 object trashbin = factory->execute((["name":"trashbin", ]));
84 function do_set_attribute = obj->get_function("do_set_attribute");
85 do_set_attribute(CALENDAR_TRASH, trashbin);
87 run_event(EVENT_EXECUTE, CALLER, obj);
92 string get_identifier() { return "Calendar.factory"; }
93 string get_class_name() { return CLASS_NAME_CALENDAR;}
94 int get_class_id() { return CLASS_CALENDAR; }