Changeset 17ba50 in indico


Ignore:
Timestamp:
04/23/12 14:39:56 (13 months ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
b521ee
Parents:
cfc263
git-author:
Claude Bossy <claude.bossy@…> (02/29/12 11:40:48)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (04/23/12 14:39:56)
Message:

[IMP] Domain protection control - interface

Location:
indico/MaKaC
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/services/implementation/conference.py

    r9fa05f r17ba50  
    5151from MaKaC.participant import Participant 
    5252from MaKaC.common.Configuration import Config 
     53import MaKaC.domain as domain 
    5354 
    5455import datetime 
     
    12111212        elif isinstance(userToRemove, Avatar) or isinstance(userToRemove, Group) : 
    12121213            self._conf.revokeAccess(userToRemove) 
     1214 
     1215class ConferenceProtectionToggleDomains(ConferenceModifBase): 
     1216 
     1217    def _checkParams(self): 
     1218        ConferenceModifBase._checkParams(self) 
     1219        pm = ParameterManager(self._params) 
     1220        self._domainId = pm.extract("domainId", pType=str) 
     1221        self._add = pm.extract("add", pType=bool) 
     1222 
     1223    def _getAnswer(self): 
     1224        dh = domain.DomainHolder() 
     1225        if self._add : 
     1226            self._target.requireDomain( dh.getById( self._domainId ) ) 
     1227        elif not self._add : 
     1228            self._target.freeDomain( dh.getById( self._domainId ) ) 
    12131229 
    12141230class ConferenceProtectionSetAccessKey(ConferenceModifBase): 
     
    15901606    "protection.addAllowedUsers": ConferenceProtectionAddUsers, 
    15911607    "protection.removeAllowedUser": ConferenceProtectionRemoveUser, 
     1608    "protection.toggleDomains": ConferenceProtectionToggleDomains, 
    15921609    "protection.setAccessKey": ConferenceProtectionSetAccessKey, 
    15931610    "protection.setModifKey": ConferenceProtectionSetModifKey, 
  • indico/MaKaC/webinterface/tpls/ConfModificationControlFrame.tpl

    rd9e5b0 r17ba50  
    3333                $E('setModifKey').dom.onsubmit = function(e) { 
    3434                    var modifKey = $E('modifKey').dom.value; 
    35                     if(modifKey && !confirm('${_("Please note that it is more secure to make the event private instead of using a modification key.")}')) { 
     35                    if(modifKey && !confirm(${_("Please note that it is more secure to make the event private instead of using a modification key.")|n,j})) { 
    3636                        return false; 
    3737                    } 
  • indico/MaKaC/webinterface/tpls/ConfRegFormPersonalDataDisplay.tpl

    r81d37ab r17ba50  
    11<table width="100%" align="left" cellspacing="0"> 
    22    <tr> 
    3         <td nowrap class="regFormSectionTitle">${ _("Personal data") }</td> 
     3        <td nowrap class="regFormSectionTitle">${ _("Personal data")}</td> 
    44    </tr> 
    55    <tr> 
  • indico/MaKaC/webinterface/tpls/DomainControlFrame.tpl

    rc0de5a r17ba50  
    11<table class="groupTable"> 
    22<tr> 
    3   <td colspan="2"><div class="groupTitle">${ _("Domain control")}</div></td> 
     3  <td colspan="2"><div class="groupTitle">${ _("Domain control ")}<span id="domainControl"></span></div></td> 
    44</tr> 
    55<tr> 
    66  <td nowrap class="titleCellTD"><span class="titleCellFormat">${ _("Allowed domains")}<br><font size="-2">(${ _("if no domain is selected<br>no control is applied")})</font></span></td> 
    77  <td class="blacktext"> 
    8     <form action="${ removeURL }" method="POST"> 
    98    ${ locator } 
    10     <table width="100%"> 
    11     <tr> 
    12       <td width="80%"> 
     9    <table width="auto"> 
    1310        ${ domains } 
    14       </td> 
    15       <td width="20%" align="right" valign="bottom"> 
    16         <table> 
    17         <tr> 
    18           <td> 
    19             <input type="submit" class="btn" value="${ _("remove")}"> 
    20           </td> 
    21           <td> 
    22             <select name="addDomain"> 
    23             <option>${ _("Select")}: 
    24             ${ domainsToAdd } 
    25             </select> 
    26           </td> 
    27           <td> 
    28             <input type="submit" class="btn" value="<- ${ _("add")}<" onClick="if (this.form.addDomain.value=='${ _("Select")}:') { return false; } else { this.form.action='${ addURL }'; }"> 
    29           </td> 
    30         </tr> 
    31         </table> 
    32       </td> 
    33     </tr> 
    3411    </table> 
    35     </form> 
    3612  </td> 
    3713</tr> 
    3814</table> 
     15<script type="text/javascript"> 
     16IndicoUI.executeOnLoad(function(){ 
     17    if ($(':checkbox:checked').length==0){ 
     18        $('#domainControl').text(${ _("(disabled)")|n,j}); 
     19        $('#domainControl').attr('style','color: #B02B2C;'); 
     20    } 
     21    else{ 
     22        $('#domainControl').text(${ _("(enabled)")|n,j}); 
     23        $('#domainControl').attr('style','color: #128F33;'); 
     24    } 
     25}); 
     26var checkId = null; 
     27$(':checkbox:not(:checked)').live('change', function(){ 
     28    checkId = $(this).val(); 
     29    indicoRequest('event.protection.toggleDomains', { 
     30        confId: ${conference.getId()}, 
     31        domainId: $(this).val(), 
     32        add: false 
     33    }, 
     34    function(result, error) { 
     35        var domain = '#domain'+checkId; 
     36        if ($(':checkbox:checked').length==0){ 
     37            $('#domainControl').text(${ _("(disabled)")|n,j}); 
     38            $('#domainControl').attr('style','color: #B02B2C;'); 
     39        } 
     40        $(domain).attr('style','margin-left:10px; color:#B02B2C;'); 
     41        $(domain).text("saved"); 
     42        setTimeout(function(){ 
     43            $(domain).text(""); 
     44        }, 1000); 
     45        if(error) { 
     46            IndicoUtil.errorReport(error); 
     47        } else{ 
     48            (new AlertPopup($T('Domain removed'))).open(); 
     49        } 
     50    }); 
     51}); 
     52$(':checkbox:checked').live('change', function(){ 
     53    checkId = $(this).val(); 
     54    indicoRequest('event.protection.toggleDomains', { 
     55        confId: ${conference.getId()}, 
     56        domainId: $(this).val(), 
     57        add: true 
     58    }, 
     59    function(result, error) { 
     60        var domain = '#domain'+checkId; 
     61        if ($(':checkbox:checked').length!=0){ 
     62            $('#domainControl').text(${ _("(enabled)")|n,j}); 
     63            $('#domainControl').attr('style','color: #128F33;'); 
     64        } 
     65        $(domain).attr('style','margin-left:10px; color:#B02B2C;'); 
     66        $(domain).text("saved"); 
     67        setTimeout(function(){ 
     68            $(domain).text(""); 
     69        }, 1000); 
     70        if(error) { 
     71            IndicoUtil.errorReport(error); 
     72        } else{ 
     73            (new AlertPopup($T('Domain added'))).open(); 
     74        } 
     75    }); 
     76}); 
     77</script> 
  • indico/MaKaC/webinterface/wcomponents.py

    r61ed1b r17ba50  
    22792279        vars = WTemplated.getVars( self ) 
    22802280        l = [] 
    2281         for dom in self._target.getDomainList(): 
    2282             l.append("""<input type="checkbox" name="selectedDomain" value="%s"> %s"""%(dom.getId(), dom.getName())) 
    2283         vars["domains"] = "<br>".join(l) 
    2284         l = [] 
    22852281        for dom in domain.DomainHolder().getList(): 
    22862282            if dom not in self._target.getDomainList(): 
    2287                 l.append("""<option value="%s">%s</option>"""%(dom.getId(), dom.getName())) 
    2288         vars["domainsToAdd"] = "".join(l) 
     2283                l.append("""<tr><td><input type="checkbox" name="selectedDomain" value="%s"> %s</td><td><span id="domain%s"></span></td></tr>"""%(dom.getId(), dom.getName(), dom.getId())) 
     2284            else: 
     2285                l.append("""<tr><td><input type="checkbox" name="selectedDomain" value="%s" checked> %s</td><td><span id="domain%s"></span></td></tr>"""%(dom.getId(), dom.getName(), dom.getId())) 
     2286        vars["domains"] = "".join(l) 
    22892287        vars["removeURL"] = self._removeURL 
    22902288        vars["addURL"] = self._addURL 
    22912289        vars["locator"] = self._target.getLocator().getWebForm() 
     2290        vars["conference"] = self._target 
    22922291        return vars 
    22932292 
Note: See TracChangeset for help on using the changeset viewer.