1 /* Copyright (C) 2000-2006 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/ObjectFactory";
23 #include <attributes.h>
26 class DateFactory : public ObjectFactory{
30 // Wir wissen nicht wirklich welche includes werden muessen.
39 init_class_attribute(DATE_KIND_OF_ENTRY, CMD_TYPE_UNKNOWN,
40 "the kind of this entry", 0,
41 EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER,-1);
44 init_class_attribute(DATE_IS_SERIAL, CMD_TYPE_INT,
45 "is this entry serial or not", 0,
46 EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER,-1);
49 init_class_attribute(DATE_PRIORITY, CMD_TYPE_INT,
50 "the priority of this entry", 0,
51 EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER,-1);
54 init_class_attribute(DATE_TITLE, CMD_TYPE_STRING,
55 "the title of this entry", 0,
56 EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER,"");
59 init_class_attribute(DATE_DESCRIPTION, CMD_TYPE_STRING,
60 "the description of this entry",
61 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER,"");
64 init_class_attribute(DATE_START_TIME, CMD_TYPE_INT, "start time of date",
65 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
67 init_class_attribute(DATE_END_TIME, CMD_TYPE_INT, "end time of date",
68 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
71 init_class_attribute(DATE_START_DATE, CMD_TYPE_INT, "start date of date",
72 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
75 init_class_attribute(DATE_END_DATE, CMD_TYPE_INT, "end date of date",
76 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
79 init_class_attribute(DATE_INTERVALL, CMD_TYPE_STRING,
80 "intervall of date (day, week, month, year)",
81 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER,"");
84 init_class_attribute(DATE_LOCATION, CMD_TYPE_STRING, "location of date",
85 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER,"");
87 init_class_attribute(DATE_WEBSITE, CMD_TYPE_STRING, "website",
88 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER,"");
90 init_class_attribute(DATE_NOTICE, CMD_TYPE_STRING, "notice",
91 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER,"");
93 init_class_attribute(DATE_TYPE, CMD_TYPE_INT, "type of date",
94 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
96 init_class_attribute(DATE_ATTACHMENT, CMD_TYPE_OBJECT, "attachement",
97 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
101 init_class_attribute(DATE_PARTICIPANTS, CMD_TYPE_ARRAY, "participating users",
102 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
104 init_class_attribute(DATE_ORGANIZERS, CMD_TYPE_ARRAY, "organizing user",
105 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
107 init_class_attribute(DATE_ACCEPTED, CMD_TYPE_ARRAY, "accepting users",
108 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
110 init_class_attribute(DATE_CANCELLED, CMD_TYPE_ARRAY, "cancelling users",
111 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
114 init_class_attribute(DATE_STATUS, CMD_TYPE_INT, "date status",
115 0, EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER, 0);
119 init_class_attribute(DATE_RANGE, CMD_TYPE_OBJECT,
120 "an mapping, which includes all the dates informations",
122 EVENT_ATTRIBUTES_CHANGE, 0, CONTROL_ATTR_USER,0);
126 object execute(mapping vars)
129 try_event(EVENT_EXECUTE, CALLER, obj);
130 if ( vars->transient ) {
131 if ( mappingp(vars->attributes) )
132 vars->attributes[OBJ_TEMP] = 1;
134 vars->attributes = ([ OBJ_TEMP : 1 ]);
137 obj = ::object_create(vars["name"], CLASS_NAME_DATE, 0,
139 vars["attributesAcquired"],
140 vars["attributesLocked"],
142 vars["sanctionMeta"]);
144 run_event(EVENT_EXECUTE, CALLER, obj);
146 object start = Calendar.Second(vars->start);
147 object end = Calendar.Second(vars->end);
148 if ( objectp(start) && objectp(end) ) {
149 object rangeObject = start->range(end);
150 obj->set_attribute(DATE_RANGE, rangeObject);
157 string get_identifier() { return "Date.factory"; }
158 string get_class_name() { return CLASS_NAME_DATE;}
159 int get_class_id() { return CLASS_DATE; }