# -*- coding: utf-8 # $Id$ # # Copyright 2001, 2002 by IVA Team and contributors # # This file is part of IVA. # # IVA is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # IVA 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with IVA; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """Contains class GroupFolder, which is the root object for group folders in Knowledge Building.""" __version__ = "$Revision$"[11:-2] import Globals #from Globals import Persistent, HTMLFile import AccessControl #import TraversableWrapper import WebtopFolder from WebtopItem import WebtopItem from TraversableWrapper import TWFolder from TempObjectManager import TempObjectManager from common import perm_view, perm_edit, perm_manage, perm_add_lo # This object is the root of a group folder inside a Course or # a CourseContext. # # A group folder contains a trash folder and any # WebtopItems the users have created. WebtopItem is a superclass, and # actually the group folder will contain specific subclass instances, like # WebtopFolder, WebtopFile, WebtopLink and WebtopMemo. # from zope.interface import implements from interfaces import IWebtopItem class GroupFolder( WebtopFolder.WebtopFolder, ): """Group folder.""" meta_type = "GroupFolder" implements(IWebtopItem) list_of_types=('WebtopFolder', 'WebtopLink', 'WebtopMemo', 'WebtopFile','GroupFolder') security = AccessControl.ClassSecurityInfo() def __init__(self,parent,name): """Construct the group folder root object.""" WebtopItem.__init__(self,parent,name) TempObjectManager.__init__(self) self.id = 'gf' + self.id[2:] self.__id_counter = long(self.id[2:]) security.declarePrivate('generate_id') def generate_id(self): """Return a unique (within this webtop) id. These ids are used for any and all WebtopItems created instead of their visible names so we avoid any problems with visible name conflicts and can use more complex visible names for items.""" self.__id_counter += 1L return "gf"+str(self.__id_counter) security.declareProtected(perm_view, 'get_list_item_name') def get_list_item_name(self, REQUEST=None): """Return the name of Groupfolder.""" return self.get_name() def get_name(self): """Return the name of the course.""" try: if hasattr(self.parent().aq_base, 'toplevel'): return self.parent().get_name() except AttributeError: pass return WebtopFolder.WebtopFolder.get_name(self) Globals.InitializeClass(GroupFolder) # EOF