Changeset 701dc2 in indico


Ignore:
Timestamp:
06/09/10 17:32:00 (3 years ago)
Author:
Jose Benito <jose.benito.gonzalez@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, new-webex, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
2f05ce
Parents:
5c80b9
git-author:
Ian Rolewicz <ian.rolewicz@…> (05/11/10 10:20:39)
git-committer:
Jose Benito <jose.benito.gonzalez@…> (06/09/10 17:32:00)
Message:

[IMP] Protection Setting for new events and categs

  • fixes #95
  • Now the protection of a category or an event can be set when creating this categ/event.
  • Updated the user guide
  • reviewed by jbenito:
    • removed unnecessary protection checking.
    • i18n missing in some sentences
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • doc/guides/UserGuide/Conferences.rst

    r62a512 r701dc2  
    2929the page. You will be presented with a form in which you: 
    3030 
    31 1. choose the category where you want to place your conference and 
    32 2. fill the details of the conference you wish to create. 
     311. choose the category where you want to place your conference 
     322. fill the details of the conference you wish to create 
     333. set the access protection of the conference 
    3334 
    3435Once this is done your conference will be created and you will be 
  • indico/MaKaC/services/implementation/category.py

    r521479 r701dc2  
    1616    Base class for category 
    1717    """ 
    18      
     18 
    1919    def _checkParams( self ): 
    2020        try: 
     
    2222            l.setCategory( self._params ) 
    2323            self._target = self._categ = l.getObject() 
    24         except:            
     24        except: 
    2525            #raise ServiceError("ERR-E4", "Invalid category id.") 
    2626            self._target = self._categ = conference.CategoryManager().getRoot() 
     
    3333 
    3434class CategoryDisplayBase(ProtectedDisplayService, CategoryBase): 
    35      
     35 
    3636    def _checkParams(self): 
    3737        CategoryBase._checkParams(self) 
    3838        ProtectedDisplayService._checkParams(self) 
    39          
     39 
    4040class GetCategoryList(CategoryDisplayBase): 
    4141 
     
    8383            categList.append({"id":cat.getId(), "title":cat.getTitle(), "subcatLength":len(cat.getSubCategoryList()), "final": not cat.hasSubcategories()}) 
    8484        return {"parentCateg": 
    85                     {"id":parent.getId(), "title":parent.getTitle()},  
     85                    {"id":parent.getId(), "title":parent.getTitle()}, 
    8686                "currentCateg": 
    87                     {"id":target.getId(), "title":target.getTitle(), "breadcrumb": breadcrumbs},  
     87                    {"id":target.getId(), "title":target.getTitle(), "breadcrumb": breadcrumbs}, 
    8888                "categList":categList, 
    8989                "accessAllowed": allowed 
     
    9191 
    9292class CanCreateEvent(CategoryDisplayBase): 
    93  
     93    """ 
     94    This service returns whether or not the user can create 
     95    an event in this category along with the protection of 
     96    the chosen category. 
     97    """ 
    9498    def _checkProtection( self ): 
    9599        self._accessAllowed = False 
     
    101105 
    102106    def _getAnswer( self ): 
     107        canCreate = False 
     108        protection = "public" 
     109 
    103110        if (self._accessAllowed and self._categ.canCreateConference( self._getUser() )): 
    104                 return True 
    105         return False 
     111            canCreate = True 
     112 
     113        if self._categ.isProtected() : 
     114            protection = "private" 
     115 
     116        return {"canCreate": canCreate, 
     117                "protection": protection} 
    106118 
    107119 
    108120class GetPastEventsList(CategoryDisplayBase): 
    109      
     121 
    110122    def _checkParams(self): 
    111123        CategoryDisplayBase._checkParams(self) 
     
    114126 
    115127    def _getAnswer( self ): 
    116          
     128 
    117129        allEvents,eventsByMonth = WConferenceList.sortEvents(self._target.getConferenceList()) 
    118          
     130 
    119131        ## CREATE future events dict and future/past counter 
    120132        pastEvents = {} 
     
    126138                    if month < self._fromDate.month: 
    127139                        pastEvents.setdefault(year,{})[month] = allEvents[year][month] 
    128          
     140 
    129141        return WConferenceListEvents(pastEvents, self._aw).getHTML() 
    130142 
  • indico/MaKaC/webinterface/pages/category.py

    r9456a0 r701dc2  
    12061206        vars["roomName"] = vars.get("locationRoom","") 
    12071207        #vars["locator"] = self._categ.getLocator().getWebForm() 
    1208         vars["categ"] = {"id":"", "title":_("-- please, choose a category --") } 
     1208        vars["protection"] = "public" 
     1209        vars["categ"] = {"id":"", "title":_("-- please, choose a category --")} 
    12091210        if self._categ and not self._categ.hasSubcategories(): 
     1211            if self._categ.isProtected() : 
     1212                vars["protection"] = "private" 
    12101213            vars["categ"] = {"id":self._categ.getId(), "title":self._categ.getTitle()} 
    12111214        vars["nocategs"] = False 
     
    12131216            vars["nocategs"] = True 
    12141217            rootcateg = CategoryManager().getRoot() 
     1218            if rootcateg.isProtected(): 
     1219                vars["protection"] = "private" 
    12151220            vars["categ"] = {"id":rootcateg.getId(), "title":rootcateg.getTitle()} 
    12161221        #vars["event_type"] = "" 
     
    16331638           default_tz = 'UTC' 
    16341639        vars["timezoneOptions"] = TimezoneRegistry.getShortSelectItemsHTML(default_tz) 
     1640        vars["categTitle"] = self.__target.getTitle() 
     1641        if self.__target.isProtected() : 
     1642            vars["categProtection"] = "private" 
     1643        else : 
     1644            vars["categProtection"] = "public" 
     1645 
    16351646        return vars 
    16361647 
  • indico/MaKaC/webinterface/rh/categoryDisplay.py

    reefc00 r701dc2  
    240240        if self._wf: 
    241241            self._wfReg.registerFactory( c, self._wf ) 
    242         avatars, newUsers = self._getPersons() 
    243         UtilPersons.addToConf(avatars, newUsers, c, self._params.has_key('grant-manager')) 
     242 
     243        eventAccessProtection = params.get("eventProtection", "inherit") 
     244 
     245        if eventAccessProtection == "private" : 
     246            c.getAccessController().setProtection(1) 
     247        elif eventAccessProtection == "public" : 
     248            c.getAccessController().setProtection(-1) 
     249 
     250        avatars, newUsers, allowedAvatars = self._getPersons() 
     251        UtilPersons.addToConf(avatars, newUsers, allowedAvatars, c, self._params.has_key('grant-manager')) 
    244252        if params.get("sessionSlots",None) is not None : 
    245253            if params["sessionSlots"] == "enabled" : 
     
    251259 
    252260    def _getPersons(self): 
    253         avatars, newUsers = [], [] 
     261        cpAvatars, cpNewUsers, auAvatars = [], [], [] 
    254262        from MaKaC.services.interface.rpc import json 
    255263        chairpersonDict = json.decode(self._params.get("chairperson")) 
     264        allowedUsersDict = json.decode(self._params.get("allowedUsers")) 
    256265        if chairpersonDict: 
    257             avatars, newUsers, editedAvatars = UserListModificationBase.retrieveUsers({"userList":chairpersonDict}) 
     266            cpAvatars, cpNewUsers, cpEditedAvatars = UserListModificationBase.retrieveUsers({"userList":chairpersonDict}) 
     267        if allowedUsersDict : 
     268            auAvatars, auNewUsers, auEditedAvatars = UserListModificationBase.retrieveUsers({"userList":allowedUsersDict}) 
    258269        #raise "avt: %s, newusers: %s, edited: %s"%(map(lambda x:x.getFullName(),avatars), newUsers, editedAvatars) 
    259         return avatars, newUsers 
     270        return cpAvatars, cpNewUsers, auAvatars 
    260271 
    261272    def alertCreation(self, confs): 
     
    325336 
    326337    @staticmethod 
    327     def addToConf( avatars, newUsers, conf, grantManager): 
     338    def addToConf( avatars, newUsers, accessingAvatars, conf, grantManager): 
    328339 
    329340        if newUsers : 
     
    340351                if not UtilPersons._alreadyDefined(person) : 
    341352                    #TODO: add to conf 
    342                     UtilPersons._add(conf, person, grantManager) 
     353                    UtilPersons._addChair(conf, person, grantManager) 
    343354                else : 
    344355                    #self._errorList.append("%s has been already defined as %s of this conference"%(person.getFullName(),self._typeName)) 
     
    353364                    if not UtilPersons._alreadyDefined(person): 
    354365                        #TODO: add to conf 
    355                         UtilPersons._add(conf, person, grantManager) 
     366                        UtilPersons._addChair(conf, person, grantManager) 
    356367                    else : 
    357368                        #self._errorList.append("%s has been already defined as %s of this conference"%(person.getFullName(),self._typeName)) 
     
    366377                #        else : 
    367378                #            self._errorList.append("%s has been already defined as %s of this conference"%(presenter.getFullName(),self._typeName)) 
     379 
     380        if accessingAvatars: 
     381            for person in accessingAvatars : 
     382                if isinstance(person, user.Avatar) or isinstance(person, user.Group) or isinstance(person, user.CERNGroup): 
     383                    conf.grantAccess(person) 
    368384 
    369385    @staticmethod 
     
    380396 
    381397    @staticmethod 
    382     def _add(conf, chair, grant): 
     398    def _addChair(conf, chair, grant): 
    383399        conf.addChair(chair) 
    384400        if grant: 
  • indico/MaKaC/webinterface/rh/categoryMod.py

    rbdd862 r701dc2  
    2525import MaKaC.webinterface.urlHandlers as urlHandlers 
    2626import MaKaC.webinterface.pages.category as category 
     27from MaKaC.webinterface.user import UserListModificationBase 
    2728from MaKaC.common.Configuration import Config 
    28 import MaKaC.common.indexes as indexes  
     29import MaKaC.common.indexes as indexes 
    2930from MaKaC.common.utils import sortCategoryByTitle 
    3031import MaKaC.conference as conference 
     
    6162class RHCategoryModification( RHCategModifBase ): 
    6263    _uh = urlHandlers.UHCategoryModification 
    63      
     64 
    6465    def _process( self ): 
    6566        p = category.WPCategoryModification( self, self._target ) 
     
    6970class RHCategoryDataModif( RHCategModifBase ): 
    7071    _uh = urlHandlers.UHCategoryDataModif 
    71      
     72 
    7273    def _process( self ): 
    7374        p = category.WPCategoryDataModification( self, self._target ) 
     
    8081        self._target.clearCache() 
    8182        self._redirect( urlHandlers.UHCategoryModification.getURL( self._target ) ) 
    82      
     83 
    8384class RHCategoryClearConferenceCaches( RHCategModifBase ): 
    8485    _uh = urlHandlers.UHCategoryClearConferenceCaches 
     
    8788        self._target.clearConferenceCaches() 
    8889        self._redirect( urlHandlers.UHCategoryModification.getURL( self._target ) ) 
    89      
     90 
    9091class RHCategoryPerformModification( RHCategModifBase ): 
    9192    _uh = urlHandlers.UHCategoryPerformModification 
    92      
     93 
    9394    def _checkParams(self, params): 
    9495        RHCategModifBase._checkParams(self, params) 
    9596        if params.get("name", "").strip() =="": 
    96             raise FormValuesError("Please, provide a name for the new subcategory")     
     97            raise FormValuesError("Please, provide a name for the new subcategory") 
    9798 
    9899    def _getNewTempFile( self ): 
     
    101102        tempFileName = tempfile.mkstemp( suffix="Indico.tmp", dir = tempPath )[1] 
    102103        return tempFileName 
    103      
     104 
    104105    def _saveFileToTemp( self, fd ): 
    105106        fileName = self._getNewTempFile() 
     
    108109        f.close() 
    109110        return fileName 
    110      
     111 
    111112    def _process( self): 
    112113        params = self._getRequestParams() 
    113            
     114 
    114115        if not "cancel" in params: 
    115116            if (params.get("subcats","")): 
     
    121122            else: 
    122123                modifyConfTZ=False 
    123             tz = params.get("defaultTimezone", "UTC")  
     124            tz = params.get("defaultTimezone", "UTC") 
    124125            self._target.setTimezone( tz ) 
    125126            if modifyConfTZ: 
     
    150151                else : 
    151152                    self._target.setTasksForbidden() 
    152                      
     153 
    153154        self._redirect( urlHandlers.UHCategoryModification.getURL( self._target ) ) 
    154155 
    155156 
    156 class RHCategoryTaskOption( RHCategModifBase ):     
     157class RHCategoryTaskOption( RHCategModifBase ): 
    157158    _uh = urlHandlers.UHCategoryTasksOption 
    158      
    159     def _process( self ): 
    160          
    161         if self._target.tasksAllowed() :             
    162             self._target.setTasksForbidden()             
     159 
     160    def _process( self ): 
     161 
     162        if self._target.tasksAllowed() : 
     163            self._target.setTasksForbidden() 
    163164        else : 
    164165            self._target.setTasksAllowed() 
    165              
     166 
    166167        self._redirect( urlHandlers.UHCategoryModification.getURL( self._target ) ) 
    167168 
     
    170171class RHCategoryAC( RHCategModifBase ): 
    171172    _uh = urlHandlers.UHCategModifAC 
    172      
     173 
    173174    def _process( self ): 
    174175        p = category.WPCategModifAC( self, self._target ) 
    175176        return p.display() 
    176          
     177 
    177178 
    178179class RHCategoryTools( RHCategModifBase ): 
    179180    _uh = urlHandlers.UHCategModifTools 
    180      
     181 
    181182    def _process( self ): 
    182183        p = category.WPCategModifTools( self, self._target ) 
     
    186187class RHCategoryTasks( RHCategModifBase ): 
    187188    _uh = urlHandlers.UHCategModifTasks 
    188      
     189 
    189190    def _process( self ): 
    190191        p = category.WPCategModifTasks( self, self._target ) 
     
    193194class RHCategoryFiles( RHCategModifBase ): 
    194195    _uh = urlHandlers.UHCategModifFiles 
    195    
    196     def _process( self ):        
     196 
     197    def _process( self ): 
    197198        p = category.WPCategoryModifExistingMaterials( self, self._target ) 
    198199        return p.display() 
    199    
     200 
    200201 
    201202class RHAddMaterial( RHCategModifBase ): 
    202203    _uh = urlHandlers.UHCategoryAddMaterial 
    203     
     204 
    204205    def _checkParams( self, params ): 
    205206        RHCategModifBase._checkParams(self, params) 
     
    217218class RHCategoryTasksAction( RHCategModifBase ): 
    218219    _uh = urlHandlers.UHCategModifTasksAction 
    219      
    220     def _process( self ): 
    221         params = self._getRequestParams()         
    222          
     220 
     221    def _process( self ): 
     222        params = self._getRequestParams() 
     223 
    223224        if params.get("accessVisibility","") == _("PRIVATE") : 
    224225            self._target.setTasksPrivate() 
     
    227228        else : 
    228229            pass 
    229              
     230 
    230231        if params.get("commentVisibility","") == _("PRIVATE") : 
    231232            self._target.setTasksCommentPrivate() 
     
    234235        else : 
    235236            pass 
    236              
     237 
    237238        if params.get("taskAccessAction","") == "Add": 
    238239            chosen = params.get("accessChosen",None) 
     
    249250        else : 
    250251            pass 
    251              
     252 
    252253        if params.get("taskCommentAction","") == "Add": 
    253254            chosen = params.get("commentChosen",None) 
    254             if chosen is not None and chosen != "" :                 
     255            if chosen is not None and chosen != "" : 
    255256                person = self._findPerson(chosen) 
    256257                if person is not None : 
     
    264265        else : 
    265266            pass 
    266          
    267          
     267 
     268 
    268269        if params.get("taskManagerAction","") == "Add": 
    269270            chosen = params.get("managerChosen",None) 
    270             if chosen is not None and chosen != "" :                                 
     271            if chosen is not None and chosen != "" : 
    271272                person = self._findPerson(chosen) 
    272                 if person is not None :                     
     273                if person is not None : 
    273274                    self._target.addTasksManager(person) 
    274275        elif params.get("taskManagerAction","") == "New": 
     
    280281        else : 
    281282            pass 
    282          
    283              
     283 
     284 
    284285        p = category.WPCategModifTasks( self, self._target ) 
    285286        return p.display() 
    286287 
    287     def _findPerson(self, idString):  
     288    def _findPerson(self, idString): 
    288289        if idString is None or idString == "" : 
    289290            return None 
     
    292293        elif idString[0] == "a" : 
    293294            return self._target.getTasksAccessPerson(int(idString[1:])) 
    294              
     295 
    295296        index = idString.find("-") 
    296297        eventId = idString[1:index] 
    297298        personId = idString[index+1:] 
    298          
     299 
    299300        if idString[0] == "h" : 
    300301            return self._target.getConferenceById(eventId).getChairById(personId) 
     
    303304        elif idString[0] == "p" : 
    304305            return self._target.getConferenceById(eventId).getParticipation().getParticipantById(personId) 
    305          
     306 
    306307        return None 
    307308 
    308309class RHCategoryCreation( RHCategModifBase ): 
    309310    _uh = urlHandlers.UHCategoryCreation 
    310      
     311 
    311312    def _process( self ): 
    312313        p = category.WPCategoryCreation( self, self._target ) 
     
    316317class RHCategoryPerformCreation( RHCategModifBase ): 
    317318    _uh = urlHandlers.UHCategoryPerformCreation 
    318     
     319 
    319320    def _checkParams(self, params): 
    320321        RHCategModifBase._checkParams(self, params) 
     
    325326        params = self._getRequestParams() 
    326327        if not ("cancel" in params): 
    327             nc = self._target.newSubCategory()   
     328            nc = self._target.newSubCategory() 
    328329            nc.setTimezone( params.get("defaultTimezone")) 
    329330            nc.setName( params.get("name", "") ) 
     
    331332            nc.setDefaultStyle("simple_event",params.get("defaultSimpleEventStyle", "") ) 
    332333            nc.setDefaultStyle("meeting",params.get("defaultMeetingStyle", "") ) 
     334 
     335            categAccessProtection = params.get("categProtection", "inherit") 
     336 
     337            if categAccessProtection == "private" : 
     338                nc.getAccessController().setProtection(1) 
     339                allowedUsers = self._getAllowedUsers(params) 
     340                if allowedUsers : 
     341                    for person in allowedUsers : 
     342                        if isinstance(person, user.Avatar) or isinstance(person, user.Group) or isinstance(person, user.CERNGroup): 
     343                            nc.grantAccess(person) 
     344            elif categAccessProtection == "public" : 
     345                nc.getAccessController().setProtection(-1) 
     346 
    333347        self._redirect( urlHandlers.UHCategoryModification.getURL( self._target ) ) 
     348 
     349 
     350    def _getAllowedUsers(self, params): 
     351 
     352        auAvatars = [] 
     353        from MaKaC.services.interface.rpc import json 
     354        allowedUsersDict = json.decode(params.get("allowedUsers")) 
     355        if allowedUsersDict : 
     356            auAvatars, auNewUsers, auEditedAvatars = UserListModificationBase.retrieveUsers({"allowedUserList":allowedUsersDict}, "allowedUserList") 
     357 
     358        return auAvatars 
    334359 
    335360 
    336361#class RHCategoryRemoveSubItems( RHCategModifBase ): 
    337362#    _uh = urlHandlers.UHCategoryPerformCreation 
    338 #     
     363# 
    339364#    def _checkParams( self, params ): 
    340365#        RHCategModifBase._checkParams( self, params ) 
     
    353378#        for confId in confIdList: 
    354379#            self._confs.append( ch.getById( confId ) ) 
    355 #     
     380# 
    356381#    def _process( self ): 
    357382#        if self._cancel: 
     
    361386 
    362387class _ActionSubCategDeletion: 
    363      
     388 
    364389    def __init__( self, rh, target, selCategs ): 
    365390        self._rh = rh 
    366391        self._target = target 
    367392        self._categs = selCategs 
    368      
     393 
    369394    def askConfirmation( self, params ): 
    370395        p = category.WPSubCategoryDeletion( self._rh, self._target ) 
     
    390415 
    391416class _ActionSubCategMove: 
    392      
     417 
    393418    def __init__( self, rh, newpos, oldpos ): 
    394419        self._rh = rh 
    395420        self._newpos = int(newpos) 
    396421        self._oldpos = int(oldpos) 
    397          
     422 
    398423    def askConfirmation( self, params ): 
    399424        return "" 
     
    409434 
    410435class _ActionSubCategReallocation: 
    411      
     436 
    412437    def __init__( self, rh, target, selCategs ): 
    413438        self._rh = rh 
    414439        self._target = target 
    415440        self._categs = selCategs 
    416      
     441 
    417442    def askConfirmation( self, params ): 
    418443        p = category.WPCategoryReallocation( self._rh, self._target ) 
     
    421446 
    422447    def perform( self ): 
    423         #check if the current user has modification privileges on the  
     448        #check if the current user has modification privileges on the 
    424449        #   destination category 
    425450        if not self._target.canModify( self._rh.getAW() ): 
    426451            raise MaKaCError( _("cannot reallocate selected categoried to the selected destination because you are not authorised to modify the destination category")) 
    427452        for categ in self._categs: 
    428             categ.move( self._target )  
     453            categ.move( self._target ) 
    429454 
    430455 
    431456class RHCategoryActionSubCategs( RHCategModifBase ): 
    432457    _uh = urlHandlers.UHCategoryActionSubCategs 
    433      
     458 
    434459    def _checkParams( self, params ): 
    435460        RHCategModifBase._checkParams( self, params ) 
     
    451476            self._confirmation = 1 
    452477            self._action = _ActionSortCategories( self ) 
    453      
     478 
    454479    def _process( self ): 
    455480        if not self._categs: 
     
    466491 
    467492class _ActionConferenceDeletion: 
    468      
     493 
    469494    def __init__( self, rh,target, selConfs,): 
    470495        self._rh = rh 
     
    476501            event.delete() 
    477502 
    478      
     503 
    479504    def askConfirmation( self, params ): 
    480505        p = category.WPConferenceDeletion( self._rh, self._target ) 
     
    482507 
    483508class _ActionConferenceReallocation: 
    484      
     509 
    485510    def __init__( self, rh, srcCateg, selConfs, target): 
    486511        self._rh = rh 
     
    488513        self._confs = selConfs 
    489514        self._target=target 
    490      
     515 
    491516    def askConfirmation( self, params ): 
    492517        p = category.WPConferenceReallocation( self._rh, self._categ ) 
     
    495520 
    496521    def perform( self, confs ): 
    497         #ToDo: check if the current user can create conferences on the  
     522        #ToDo: check if the current user can create conferences on the 
    498523        #   destination category 
    499524        if self._confs == []: 
     
    506531class RHCategoryActionConferences( RHCategModifBase ): 
    507532    _uh = urlHandlers.UHCategoryActionConferences 
    508      
     533 
    509534    def _checkParams( self, params ): 
    510535        RHCategModifBase._checkParams( self, params ) 
     
    524549                self._srcCateg = cm.getById( params["srcCategId"] ) 
    525550            self._action = _ActionConferenceReallocation( self, self._srcCateg, self._confs, self._target ) 
    526      
     551 
    527552    def _process( self ): 
    528553        if self._confirmation: 
     
    537562class RHCategorySelectManagers( RHCategModifBase ): 
    538563    _uh = urlHandlers.UHCategorySelectManagers 
    539      
     564 
    540565    def _process( self ): 
    541566        p = category.WPCategorySelectManagers( self, self._target ) 
     
    545570class RHCategoryAddManagers( RHCategModifBase ): 
    546571    _uh = urlHandlers.UHCategoryAddManagers 
    547      
     572 
    548573    def _process( self ): 
    549574        params = self._getRequestParams() 
     
    558583class RHCategoryRemoveManagers( RHCategModifBase ): 
    559584    _uh = urlHandlers.UHCategoryRemoveManagers 
    560      
     585 
    561586    def _process( self ): 
    562587        params = self._getRequestParams() 
     
    571596class RHCategorySetVisibility( RHCategModifBase ): 
    572597    _uh = urlHandlers.UHCategorySetVisibility 
    573      
     598 
    574599    def _process( self ): 
    575600        params = self._getRequestParams() 
     
    581606            self._target.setProtection( -1 ) 
    582607        self._redirect( urlHandlers.UHCategModifAC.getURL( self._target ) ) 
    583      
     608 
    584609 
    585610class RHCategorySelectAllowed( RHCategModifBase ): 
    586611    _uh = urlHandlers.UHCategorySelectAllowed 
    587      
     612 
    588613    def _process( self ): 
    589614        p = category.WPCategorySelectAllowed( self, self._target ) 
     
    593618class RHCategoryAddAllowed( RHCategModifBase ): 
    594619    _uh = urlHandlers.UHCategoryAddAllowed 
    595      
     620 
    596621    def _process( self ): 
    597622        params = self._getRequestParams() 
     
    605630class RHCategoryRemoveAllowed( RHCategModifBase ): 
    606631    _uh = urlHandlers.UHCategoryRemoveAllowed 
    607      
     632 
    608633    def _process( self ): 
    609634        params = self._getRequestParams() 
     
    618643class RHCategoryAddDomains( RHCategModifBase ): 
    619644    _uh = urlHandlers.UHCategoryAddDomain 
    620      
     645 
    621646    def _process( self ): 
    622647        params = self._getRequestParams() 
     
    630655class RHCategoryRemoveDomains( RHCategModifBase ): 
    631656    _uh = urlHandlers.UHCategoryRemoveDomain 
    632      
     657 
    633658    def _process( self ): 
    634659        params = self._getRequestParams() 
     
    654679class RHCategorySelectConfCreators( RHCategModifBase ): 
    655680    _uh = urlHandlers.UHCategorySelectConfCreators 
    656      
     681 
    657682    def _process( self ): 
    658683        p = category.WPCategorySelectConfCreators( self, self._target ) 
     
    662687class RHCategoryAddConfCreators( RHCategModifBase ): 
    663688    _uh = urlHandlers.UHCategoryAddConfCreators 
    664      
     689 
    665690    def _process( self ): 
    666691        params = self._getRequestParams() 
     
    677702class RHCategoryRemoveConfCreators( RHCategModifBase ): 
    678703    _uh = urlHandlers.UHCategoryRemoveConfCreators 
    679      
     704 
    680705    def _process( self ): 
    681706        params = self._getRequestParams() 
     
    689714class RHCategorySetNotifyCreation( RHCategModifBase ): 
    690715    _uh = urlHandlers.UHCategorySetNotifyCreation 
    691      
     716 
    692717    def _process( self ): 
    693718        params = self._getRequestParams() 
     
    697722class RHCategoryDeletion( RHCategModifBase ): 
    698723    _uh = urlHandlers.UHCategoryDeletion 
    699      
     724 
    700725    def _checkParams( self, params ): 
    701726        RHCategModifBase._checkParams( self, params ) 
     
    704729            self._cancel = True 
    705730        self._confirmation = params.has_key("confirm") 
    706      
     731 
    707732    def _perform( self ): 
    708733        self._target.delete(1) 
    709      
     734 
    710735    def _process( self ): 
    711736        if self._cancel: 
  • indico/MaKaC/webinterface/tpls/CategoryCreation.tpl

    r9033fd r701dc2  
    11 
    2 <form action="%(postURL)s" method="POST"> 
     2<form id="categCreationForm" action="%(postURL)s" method="POST"> 
    33    %(locator)s 
    44    <table class="groupTable"> 
     
    2929        </tr> 
    3030        <tr> 
     31            <td nowrap class="dataCaptionTD"><span class="dataCaptionFormat"><%= _("Protection")%></span></td> 
     32            <td class="blacktext"> 
     33                <div> 
     34                    <% if categProtection == 'public' : %> 
     35                        <% color = "#128F33" %> 
     36                    <% end %> 
     37                    <% else : %> 
     38                        <% color = "#B02B2C" %> 
     39                    <% end %> 
     40                    <span id="inheritRadioButtonWrapper" class="categProtectionRadioEntry"> 
     41                        <input type="radio" id="inheritRadioButton" class="eventProtectionRadioButton" name="categProtection" value='inherit' onclick="hideUserList();" checked/><label for="inheritRadioButton"><span id="inheritRadioEntryKey" style="color:<%= color %>;"><%= _("Same as for parent category '") %><span id="radioCategTitle"><%= categTitle %></span>'</span> : <span id="radioCategProtection" style="font-weight: bold;"><%= categProtection %></span> <%= _("for the moment, but it may change") %> </label> 
     42                    </span> 
     43                    <span id="privateRadioButtonWrapper" class='categProtectionRadioEntry'> 
     44                        <input type="radio" id="privateRadioButton" class="eventProtectionRadioButton" name="categProtection" value='private' onclick="showUserList();"/><label for="privateRadioButton"><span style="color: #B02B2C"><%= _("Private") %></span><%= _(" : Can only be viewed by you and users/groups chosen by you from the list of users") %></label> 
     45                    </span> 
     46                    <span id="allowedUserListInfo" class="allowedUserListInfo" style="display: none;"> 
     47                        <em><%= _("Please fill in the list below with the users/groups that will be granted access to this category. You can always do so later, once the category is created, through the category protection settings.") %></em> 
     48                    </span> 
     49                    <div id="userListWrapper"> 
     50                    </div> 
     51                    <% if categProtection != 'public' : %> 
     52                    <span id="publicRadioButtonWrapper" class='categProtectionRadioEntry'> 
     53                        <input type="radio" id="publicRadioButton" class="eventProtectionRadioButton" name="categProtection" value='public' onclick="hideUserList();"/><label for="publicRadioButton"><span style="color: #128F33"><%= _("Public") %></span><%= _(" : Can be viewed by everyone") %></label> 
     54                    </span> 
     55                    <% end %> 
     56                </div> 
     57                <input type="hidden" value="" id="allowedUsers" name="allowedUsers"/> 
     58            </td> 
     59        </tr> 
     60        <tr> 
    3161            <td>&nbsp;</td> 
    3262            <td> 
    33                 <input type="submit" class="btn" name="OK" value="<%= _("ok")%>"> 
    34                 <input type="submit" class="btn" name="cancel" value="<%= _("cancel")%>"> 
     63                <input type="submit" class="btn" name="OK" value="<%= _("Create Sub-Category")%>"> 
     64                <input type="submit" class="btn" name="cancel" value="<%= _("Cancel")%>"> 
    3565            </td> 
    3666        </tr> 
    3767    </table> 
    3868</form> 
     69 
     70<script type="text/javascript"> 
     71 
     72    // ---- List of users allowed to view the event 
     73 
     74    var allowedUsersList = new UserListField( 
     75            'allowedUserListDiv', 'allowedUserList', 
     76            null, true, null, 
     77            true, true, null, null, 
     78            false, false, true, 
     79            userListNothing, userListNothing, userListNothing); 
     80 
     81    // ---- When the private radio button is selected, display the list of users 
     82 
     83    var hideUserList = function() { 
     84        $E('userListWrapper').dom.style.padding = ""; 
     85        $E('userListWrapper').set(''); 
     86        $E('allowedUserListInfo').dom.style.display = "none"; 
     87    } 
     88 
     89    var showUserList = function() { 
     90        $E('userListWrapper').dom.style.padding = "6px 26px"; 
     91        $E('userListWrapper').set(allowedUsersList.draw()); 
     92        $E('allowedUserListInfo').dom.style.display = ""; 
     93    } 
     94 
     95    function injectValuesInForm(form, action) { 
     96        form.observeEvent('submit', function() { 
     97            if (action) { 
     98               return action(); 
     99            } 
     100         }); 
     101       }; 
     102 
     103    // ---- On Load 
     104    IndicoUI.executeOnLoad(function() { 
     105        injectValuesInForm($E('categCreationForm'),function() { 
     106            $E('allowedUsers').set(Json.write(allowedUsersList.getUsers())); 
     107        }); 
     108    }); 
     109 
     110</script> 
  • indico/MaKaC/webinterface/tpls/ConferenceCreation.tpl

    rc728c4 r701dc2  
    9999        </tr> 
    100100    </table> 
     101 
     102    <% includeTpl('EventSetProtection', eventType='conference') %> 
     103 
    101104    <table class="groupTable" style="background-color: #ECECEC; border-top: 1px dashed #777777;"> 
    102105        <tr> 
     
    155158 
    156159    // ----- Categ Chooser 
    157     var categoryChooserHandler = function(categ){ 
     160    var categoryChooserHandler = function(categ, protection){ 
    158161        $E("createCategId").set(categ.id); 
    159162        $E("categTitle").set(categ.title); 
    160163        $E("buttonCategChooser").set("Change...") 
    161164        IndicoUI.Effect.highLightBackground("categTitle"); 
     165 
     166        updateProtectionChooser(categ.title, protection); 
    162167    }; 
    163168 
     
    176181            $E("buttonCategChooser").set("<%= _("Change...")%>"); 
    177182        } 
     183 
     184        protectionChooserExecOnLoad("<%=categ["id"]%>", "<%=protection%>"); 
    178185 
    179186                var startDate = IndicoUI.Widgets.Generic.dateField(true,null,['sDay', 'sMonth', 'sYear','sHour', 'sMinute']) 
     
    206213                }else { 
    207214                    $E('chairperson').set(Json.write(uf.getUsers())); 
     215                    injectFromProtectionChooser(); 
    208216                } 
    209217        }); 
  • indico/MaKaC/webinterface/tpls/MeetingCreation.tpl

    rc728c4 r701dc2  
    9494        </td></tr> 
    9595    </table> 
     96 
     97    <% includeTpl('EventSetProtection', eventType='meeting') %> 
     98 
    9699    <table class="groupTable" style="background-color: #ECECEC; border-top: 1px dashed #777777;"> 
    97100        <tr> 
     
    151154 
    152155    // ----- Categ Chooser 
    153     var categoryChooserHandler = function(categ){ 
     156    var categoryChooserHandler = function(categ, protection){ 
    154157        $E("createCategId").set(categ.id); 
    155158        $E("categTitle").set(categ.title); 
    156         $E("buttonCategChooser").set("<%= _("Change...")%>") 
     159        $E("buttonCategChooser").set("<%= _("Change...")%>"); 
    157160        IndicoUI.Effect.highLightBackground("categTitle"); 
    158     }; 
     161 
     162        updateProtectionChooser(categ.title, protection); 
     163 
     164        }; 
    159165 
    160166    var openCategoryChooser = function() { 
     
    163169    } 
    164170 
     171 
    165172    // ---- On Load 
    166173    IndicoUI.executeOnLoad(function() 
     
    171178            $E("buttonCategChooser").set("<%= _("Change...")%>"); 
    172179        } 
     180 
     181        protectionChooserExecOnLoad("<%= categ["id"] %>", "<%= protection %>"); 
    173182 
    174183                var startDate = IndicoUI.Widgets.Generic.dateField(true,null,['sDay', 'sMonth', 'sYear','sHour', 'sMinute']); 
     
    201210                }else { 
    202211                    $E('chairperson').set(Json.write(uf.getUsers())); 
     212                    injectFromProtectionChooser(); 
    203213                } 
    204214        }); 
  • indico/MaKaC/webinterface/tpls/SimpleEventCreation.tpl

    rc728c4 r701dc2  
    9696    </table> 
    9797 
     98    <% includeTpl('EventSetProtection', eventType='lecture') %> 
     99 
    98100    <table class="groupTable" style="background-color: #ECECEC; border-top: 1px dashed #777777;"> 
    99101        <tr> 
     
    135137 
    136138    // ----- Categ Chooser 
    137     var categoryChooserHandler = function(categ){ 
     139    var categoryChooserHandler = function(categ, protection){ 
    138140        $E("createCategId").set(categ.id); 
    139141        $E("categTitle").set(categ.title); 
    140142        $E("buttonCategChooser").set("<%= _("Change...")%>") 
    141143        IndicoUI.Effect.highLightBackground("categTitle"); 
     144 
     145        updateProtectionChooser(categ.title, protection); 
    142146    }; 
    143147 
     
    160164        } 
    161165 
     166        protectionChooserExecOnLoad("<%=categ["id"]%>", "<%=protection%>"); 
     167 
    162168                injectValuesInForm($E('eventCreationForm'),function() { 
    163169                if (!verifyDates()) { 
     
    172178                }else { 
    173179                    $E('chairperson').set(Json.write(uf.getUsers())); 
     180                    injectFromProtectionChooser(); 
    174181                } 
    175182        }); 
  • indico/htdocs/css/Default.css

    r0d5340 r701dc2  
    31943194} 
    31953195 
     3196div.accessProtection { 
     3197    padding: 10px; 
     3198    font-size: 16px; 
     3199} 
     3200 
     3201span.eventProtectionRadioEntry { 
     3202    display: block; 
     3203    padding-left: 50px; 
     3204    padding-bottom: 5px; 
     3205} 
     3206 
     3207span.eventProtectionRadioEntry label, span.categProtectionRadioEntry label { 
     3208    font-weight: normal; 
     3209    padding-left: 5px; 
     3210} 
     3211 
     3212span.protectionRadioInfo { 
     3213    display: block; 
     3214    padding: 20px; 
     3215} 
     3216 
     3217input.eventProtectionRadioButton { 
     3218    padding-right: 5px; 
     3219} 
     3220 
     3221span.categProtectionRadioEntry { 
     3222    display: block; 
     3223    padding-bottom: 5px; 
     3224} 
     3225 
     3226div.userListWrapper { 
     3227    padding-left: 63px; 
     3228} 
     3229 
     3230div.userListWrapper div { 
     3231    padding: 6px; 
     3232} 
     3233 
     3234div.userListDiv , div.allowedUserListDiv{ 
     3235    width: 320px; 
     3236    height: 200px; 
     3237    border: 1px solid #CCCCCC; 
     3238    overflow: auto; 
     3239} 
     3240 
     3241ul.userList, ul.allowedUserList { 
     3242    padding-left: 0; 
     3243    margin: 0; 
     3244    list-style-type: none; 
     3245    display: block; 
     3246    border: medium none; 
     3247 
     3248} 
     3249 
     3250ul.userList li , ul.allowedUserList li { 
     3251    display: block; 
     3252    line-height: 28px; 
     3253    margin: 0 0 0; 
     3254    padding-left: 5px; 
     3255    vertical-align: middle; 
     3256} 
     3257 
     3258ul.allowedUserList li { 
     3259    line-height: 21px; 
     3260} 
     3261 
     3262ul.userList li:hover, ul.allowedUserList li:hover { 
     3263    background-color: #ECECEC; 
     3264} 
     3265 
     3266span.userListInfo { 
     3267    display: block; 
     3268    padding-left: 70px; 
     3269} 
     3270 
     3271span.allowedUserListInfo { 
     3272    display: block; 
     3273    padding-left: 27px; 
     3274} 
     3275 
    31963276.bannerTitle 
    31973277{ 
  • indico/htdocs/js/indico/Core/Widgets/Base.js

    red6cf2 r701dc2  
    681681                 if (value == SourceState.Loaded) { 
    682682                     canvas.set(self.drawContent(content)); 
    683                  }else if(value == SourceState.Committing){ 
    684                     self.runIndicator(canvas); 
     683                 } else if(value == SourceState.Loading || value == SourceState.Committing){ 
     684                     self.runIndicator(canvas); 
    685685                 } else if (value == SourceState.Error) { 
    686686                     self._error(self.source.error.get()); 
  • indico/htdocs/js/indico/Management/Users.js

    r92af92 r701dc2  
    15601560     * @param {Function} editProcess A function that will be called when a user is edited. 
    15611561     * @param {Function} removeProcess A function that will be called when a user is removed. 
    1562      * @param {Boolean} showToggleFavouriteButtons. false by default. If true, favouritize buttons will not be shown. 
    15631562     */ 
    15641563    function(userDivStyle, userListStyle, 
  • indico/htdocs/js/indico/Management/eventCreation.js

    rf25f07 r701dc2  
    157157    _returnChoice: function(categ) { 
    158158        if (!this.creationControl) { 
    159             this.owner.closeHandler(categ); 
     159            this.owner.closeHandler(categ, 'public'); 
    160160        } else { 
    161161            var self = this; 
     
    166166                if (value == SourceState.Loaded) { 
    167167                    if (self.owner) { 
    168                         if (!src.get()) { 
     168                        if (!src.get()["canCreate"]) { 
    169169                            var popup = new ErrorPopup($T("Creation forbidden"), [$T("You do not have permissions to create events in that category")], ""); 
    170170                            popup.open(); 
    171171                        }else{ 
    172                             self.owner.closeHandler(self.resultCateg); 
     172                            self.owner.closeHandler(self.resultCateg, src.get()["protection"]); 
    173173                        } 
    174174                        self.killProgress(); 
     
    204204    }, 
    205205 
    206     closeHandler: function(categ) { 
    207         this.handler(categ); 
     206    closeHandler: function(categ, protection) { 
     207        this.handler(categ, protection); 
    208208    }, 
    209209 
     
    266266        var self = this; 
    267267 
    268         var handler = function(categ) { 
     268        var handler = function(categ, protection) { 
    269269            self.categ = categ; 
     270            self.protection = protection 
    270271            self.close(); 
    271             self.categoryChooserHandler(categ); 
     272            self.categoryChooserHandler(categ, protection); 
    272273        }; 
    273274        var catChooserWidget = new CategoryChooserWidget(self.categ, handler, self.creationControl); 
Note: See TracChangeset for help on using the changeset viewer.