EduploneLearningSequence EduploneActivity.py,1.10,1.11 EduploneLearningSequence.py,1.7,1.8 config.py,1.1.1.1,1.2 version.txt,1.3,1.4

Jens Klein <[email protected]>
Newsgroups gmane.comp.web.zope.eduplone.cvs
Message-ID <[email protected]>
Update of /cvsroot/eduplone/EduploneLearningSequence
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18613

Modified Files:
	EduploneActivity.py EduploneLearningSequence.py config.py 
	version.txt 
Log Message:
huge nameageddon and code cleanup


Index: config.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneLearningSequence/config.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** config.py	26 Dec 2003 13:21:44 -0000	1.1.1.1
--- config.py	27 Jun 2004 16:09:23 -0000	1.2
***************
*** 6,14 ****
  # Licence:     GNU General Public Licencse Version 2 or newer
  #-----------------------------------------------------------------------------
! from Permissions import ADD_CONTENT_PERMISSION
! from Products.Archetypes.public import DisplayList
! 
! PROJECTNAME = "EduploneLearningSequence"
! SKINS_DIR = 'skins'
! 
  GLOBALS = globals()
\ No newline at end of file
--- 6,14 ----
  # Licence:     GNU General Public Licencse Version 2 or newer
  #-----------------------------------------------------------------------------
! from Permissions import ADD_CONTENT_PERMISSION
! from Products.Archetypes.public import DisplayList
! 
! PROJECTNAME = "EduploneLearningSequence"
! SKINS_DIR = 'skins'
! 
  GLOBALS = globals()
\ No newline at end of file

Index: EduploneLearningSequence.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneLearningSequence/EduploneLearningSequence.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** EduploneLearningSequence.py	16 Jun 2004 14:05:31 -0000	1.7
--- EduploneLearningSequence.py	27 Jun 2004 16:09:23 -0000	1.8
***************
*** 26,30 ****
  
      __implements__ = ATFolder.__implements__
!     security = ClassSecurityInfo()
      
      portal_type = meta_type = 'EduploneLearningSequence' 
--- 26,30 ----
  
      __implements__ = ATFolder.__implements__
!     security = ClassSecurityInfo()
      
      portal_type = meta_type = 'EduploneLearningSequence' 
***************
*** 39,43 ****
          {   'id'            : 'view',
              'name'          : 'View',
!             'action'        : 'string:folder_listing',
              'visible'       : 0,
              'permissions'   : (CMFCorePermissions.View,)
--- 39,43 ----
          {   'id'            : 'view',
              'name'          : 'View',
!             'action'        : 'string:folder_listing',
              'visible'       : 0,
              'permissions'   : (CMFCorePermissions.View,)
***************
*** 59,62 ****
--- 59,63 ----
              'action'        : 'string:lsq_start_form',
              'permissions'   : ('Start Learning Sequence',),
+             'condition'     : "string:here/isReadyToGo",
              'category'      : 'object',
          },
***************
*** 166,173 ****
      def getMembersWithRole(self, role):
          """ get a sorted list of members with a particular role for a given object """
!         membership_tool = getToolByName(self, 'portal_membership')
          # the uncommented code doesnt work with CMFMember
!         #members = membership_tool.searchForMembers(roles=[role])
!         #print members
          members = []
          portal = getToolByName(self, 'portal_url').getPortalObject()
--- 167,174 ----
      def getMembersWithRole(self, role):
          """ get a sorted list of members with a particular role for a given object """
!         membership_tool = getToolByName(self, 'portal_membership')
          # the uncommented code doesnt work with CMFMember
!         #members = membership_tool.searchForMembers(roles=[role])
!         #print members
          members = []
          portal = getToolByName(self, 'portal_url').getPortalObject()
***************
*** 175,207 ****
          users = {}
          while 1:            
!             if o.has_local_roles():
!                 user_list = o.users_with_local_role(role)
                  for u in user_list:
!                     users[u] = 1
              if o == portal:
                  break
              o = o.getParentNode()
!         user_list = users.keys()
!         user_list.sort()
          for u in user_list:
!             m = membership_tool.getMemberById(u)
!             # the follwing line is a hack to make it with CMFMember working
!             u = hasattr(m, 'isGroup') and m or m.getUser()
              if u.isGroup():
                  group = u.getGroupUsers()
!                 for guser in group:
                      mguser = membership_tool.getMemberById(guser.id)
                      if not mguser in members:
!                         members.append(mguser)
              else:
                  if not m in members:
!                     members.append(m)
          return members
  
      def getStudents(self) :
!         """ Returns users that are students """
          learnerids = self.getMembersWithRole('eduploneLearner')
          return learnerids
  
      # OPENFLOW
  
--- 176,217 ----
          users = {}
          while 1:            
!             if o.has_local_roles():
!                 user_list = o.users_with_local_role(role)
                  for u in user_list:
!                     users[u] = 1
              if o == portal:
                  break
              o = o.getParentNode()
!         user_list = users.keys()        
!         user_list.sort()
          for u in user_list:
!             m = membership_tool.getMemberById(u)
!             # the follwing line is a hack to make it with CMFMember working
!             u = hasattr(m, 'isGroup') and m or m.getUser()
              if u.isGroup():
                  group = u.getGroupUsers()
!                 for guser in group:
                      mguser = membership_tool.getMemberById(guser.id)
                      if not mguser in members:
!                         members.append(mguser)
              else:
                  if not m in members:
!                     members.append(m)
          return members
  
+     security.declareProtected('Start Learning Sequence', 'getStudents')
      def getStudents(self) :
!         """ Returns users that are students 
!         """
          learnerids = self.getMembersWithRole('eduploneLearner')
          return learnerids
  
+     security.declarePublic('isReadyToGo')
+     def isReadyToGo(self) :
+         """ Returns if there are students and actions available
+         """
+         go = self.getStudents() and 1
+         return go 
+     
      # OPENFLOW
  
***************
*** 212,216 ****
          request = self.REQUEST
          RESPONSE =  request.RESPONSE
!         
          if not students:
              if not request.has_key('students'):
--- 222,226 ----
          request = self.REQUEST
          RESPONSE =  request.RESPONSE
!         
          if not students:
              if not request.has_key('students'):
***************
*** 218,234 ****
                      '/lsq_start_form?portal_status_message='
                      'You+need+to+select+at+least+one+student!')
!                 return
!             students     = request['students']        
!         
          # If only one student was selected you would get a string instead of a 
          # list
          if type(students) == type("") :
            students = [students]
! 
!         tutor        = self.REQUEST.AUTHENTICATED_USER
          step         = self.objectValues()[0]
          uid          = step.UID()
          activitytype = step.getActivitytype()
! 
          oftool       = self.portal_openflow
          user_name    = self.REQUEST.AUTHENTICATED_USER.getUserName()
--- 228,244 ----
                      '/lsq_start_form?portal_status_message='
                      'You+need+to+select+at+least+one+student!')
!                 return
!             students     = request['students']        
!         
          # If only one student was selected you would get a string instead of a 
          # list
          if type(students) == type("") :
            students = [students]
! 
!         tutor        = self.REQUEST.AUTHENTICATED_USER
          step         = self.objectValues()[0]
          uid          = step.UID()
          activitytype = step.getActivitytype()
! 
          oftool       = self.portal_openflow
          user_name    = self.REQUEST.AUTHENTICATED_USER.getUserName()

Index: version.txt
===================================================================
RCS file: /cvsroot/eduplone/EduploneLearningSequence/version.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** version.txt	2 Jun 2004 00:27:44 -0000	1.3
--- version.txt	27 Jun 2004 16:09:23 -0000	1.4
***************
*** 1 ****
! 0.3.0 CVS
--- 1 ----
! 0.3.1 CVS

Index: EduploneActivity.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneLearningSequence/EduploneActivity.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** EduploneActivity.py	16 Jun 2004 14:05:31 -0000	1.10
--- EduploneActivity.py	27 Jun 2004 16:09:23 -0000	1.11
***************
*** 17,29 ****
  from Products.Archetypes.Marshall import PrimaryFieldMarshaller
  
! from Products.ATContentTypes.types.ATDocument import ATDocument
! 
  from Products.EduploneTypes.IMSBaseXML import IMSBaseXML
  
! EduploneActivitySchema = Schema((
      StringField(
       'activitytype',
          searchable = 1,
          required = 1,
          index = "KeywordIndex|KeywordIndex:schema",
          vocabulary =  DisplayList((
--- 17,32 ----
  from Products.Archetypes.Marshall import PrimaryFieldMarshaller
  
! from Products.ATContentTypes.HistoryAware import HistoryAwareMixin
! from Products.ATContentTypes.types.schemata import ATDocumentSchema
! from Products.ATContentTypes.types.ATContentType import ATCTContent, updateActions
!     
  from Products.EduploneTypes.IMSBaseXML import IMSBaseXML
  
! EduploneActivitySchema = ATDocumentSchema + Schema((
      StringField(
       'activitytype',
          searchable = 1,
          required = 1,
+         
          index = "KeywordIndex|KeywordIndex:schema",
          vocabulary =  DisplayList((
***************
*** 67,93 ****
      ), marshall=PrimaryFieldMarshaller())
  
- actions = (
-     {
-     'id': 'view',
-     'name': 'View',
-     'action': 'string:eduplone_activity_view',
-     'permissions': (CMFCorePermissions.View,)
-     },
- )
  
! class EduploneActivity(ATDocument,IMSBaseXML):
!     """ A simple contentish archetype for eduplone """
  
!     __implements__ = (ATDocument.__implements__, )
!     schema = ATDocument.schema + EduploneActivitySchema
!     portal_type = meta_type = "eduplone activity"
      archetype_name = "eduplone Activity"
!     actions=actions
  
!     factory_type_information = {
!         'content_icon':'activity_icon.gif',
!         'immediate_view':'folder_listing',
!         'global_allow':0,
!     }
  
      #Methods
--- 70,97 ----
      ), marshall=PrimaryFieldMarshaller())
  
  
! class EduploneActivity(ATCTContent,HistoryAwareMixin,IMSBaseXML):
!     """ Activity for eduplone lsq """
  
!     __implements__ = (ATCTContent.__implements__,
!                       HistoryAwareMixin.__implements__,
!                      )
!     
!     schema         = EduploneActivitySchema
! 
!     portal_type    = "eduplone activity"
!     meta_type      = "eduplone activity"
      archetype_name = "eduplone Activity"
!     
!     immediate_view = 'lsq_activity_view'
!     default_view   = 'lsq_activity_view'
!     suppl_views    = ()
!     
!     content_icon   = 'activity_icon.gif'
!     global_allow   = 0
  
!     actions = updateActions(ATCTContent,
!                             HistoryAwareMixin.actions
!                            )
  
      #Methods



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.