indexing description: "Provide an interface to wiki data." author: "Peter Wyss " date: "$Date$" revision: "$Revision$" class WIKI_INTERFACE inherit BASE_INTERFACE redefine make end O_WORKITEM_CONSTANTS create make feature {NONE} -- Initialization make (a_node: like node; a_db_handler: like db_handler; a_policy_cache: like policy_cache) is -- Initialize. do Precursor (a_node, a_db_handler, a_policy_cache) end feature -- Commands wiki_add (a_msg: O_MESSAGE) is -- Add a new wiki workitem according to a_msg. require a_msg_ok: a_msg /= Void local l_pc_msg: O_WIKI_ADD_MESSAGE l_workitem: WORKITEM l_workitem_wiki: WORKITEM_WIKI l_status: O_GENERAL_STATUS_MESSAGE l_user_ret: USER l_project_ret: PROJECT l_workitem_id: INTEGER l_workitem_add_reply: O_GENERIC_MESSAGE do l_pc_msg ?= a_msg check wiki_add_message: l_pc_msg /= Void end create l_workitem.make user_access.retrieve_user_by_session (l_pc_msg.session) if user_access.is_found then l_user_ret := user_access.last_user project_access.retrieve_project_by_id (l_pc_msg.project) if project_access.is_found then l_project_ret := project_access.last_project l_workitem.set_type_id (4) l_workitem.set_user_id (l_user_ret.user_id) l_workitem.set_project_id (l_project_ret.project_id) workitem_access.insert_workitem (l_workitem) l_workitem_id := workitem_access.last_insert_id create l_workitem_wiki.make l_workitem_wiki.set_workitem_id (l_workitem_id) l_workitem_wiki.set_title (l_pc_msg.title) l_workitem_wiki.set_diff (l_pc_msg.diff) l_workitem_wiki.set_revision (l_pc_msg.revision) l_workitem_wiki.set_old_revision (l_pc_msg.old_revision) if l_pc_msg.is_private then l_workitem_wiki.set_private (1) else l_workitem_wiki.set_private (0) end wiki_access.insert_wiki_workitem(l_workitem_wiki) create l_workitem_add_reply.make (workitem_namespace, workitem_add_reply_type) l_workitem_add_reply.add_argument ("workitem_id", l_workitem_id.out) node.send_message_reply (l_workitem_add_reply, a_msg) else create l_status.make (False, err_invalid_project) node.send_message_reply (l_status, a_msg) end else create l_status.make (False, err_session_timeout) node.send_message_reply (l_status, a_msg) end end end