################################################################################################### # _scormlib.py # # $Id: _scormlib.py,v 1.51 2006/06/22 21:02:52 fh Exp $ # $Name: $ # $Author: dnordmann $ # $Revision: 1.51 $ # # Implementation of class SCORMLib (see below). # # This program 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. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ################################################################################################### # Imports. from OFS.CopySupport import absattr # Product Imports. import zmscontainerobject import _globals import _xmllib # --------------------------------------------------------------------------------------------- # _scormlib.getIMSManifestItems: # --------------------------------------------------------------------------------------------- def getIMSManifestItems(self, REQUEST): obs = self.getChildNodes( REQUEST) xml = [] if self.isActive( REQUEST): xml.append(' 0 or \ len(filter(lambda x: x.isPage(), obs)) == 0: xml.append(' identifierref="R_%s"'%self.id) learningresourcetype = self.getObjProperty( 'learningresourcetype', REQUEST) if learningresourcetype is None or learningresourcetype == '': if self.meta_type in ['ZMSDocument','ZMSCustom']: learningresourcetype = 'lecture.document' elif self.meta_type in ['ZMSRubrik','ZMSSysFolder']: learningresourcetype = 'lecture.folder' else: learningresourcetype = 'Unknown' xml.append(' learningresourcetype="%s"'%str(learningresourcetype)) if self.getObjProperty('attr_ims_isvisible',REQUEST)==0: xml.append(' isvisible="false"') else: xml.append(' isvisible="true"') xml.append('>') # Title (place always before Sequencing-Rules!) xml.append('<![CDATA[%s]]>\n'%self.getTitlealt(REQUEST)) # Score xml.append( self.getObjProperty( 'imsmanifestScore', REQUEST)) # Sequencing-Rules self.initObjChildren(REQUEST) for ob in self.getObjChildren('',REQUEST): if ob.meta_type == 'ZMSCustom' and \ 'imsmanifest' in self.getMetaobjAttrIds(ob.meta_id): xml.append( ob.getObjProperty( 'imsmanifest', REQUEST)) for ob in obs: if ob.isPage(): xml.extend(getIMSManifestItems(ob,REQUEST)) xml.append('') return ''.join(xml) # --------------------------------------------------------------------------------------------- # getIMSManifestResources: # --------------------------------------------------------------------------------------------- def getIMSManifestResources(base, self, scoType, REQUEST): from _exportable import localHtml obs = self.getChildNodes(REQUEST) xml = '' if not self.isActive( REQUEST) or self.isResource( REQUEST): scoType = 'asset' if self.isActive( REQUEST) and \ (self.meta_type=='ZMSCustom' or \ len(filter(lambda x: x.isPageElement(), obs)) > 0 or \ len(filter(lambda x: x.isPage(), obs)) == 0): href = self.getHref2IndexHtml(REQUEST)[len(base.absolute_url())+1:] xml += '