Changeset 19651


Ignore:
Timestamp:
02/03/12 18:13:10 (4 months ago)
Author:
anp
Message:

simpleTask : gestion des permissions

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Wsp_Modeling/spaces/gen/modelBuilder/bs/sm_simpleTask.xml

    r19647 r19651  
    336336                                                <xsl:if test="sm:help">.setDescription("<xsl:value-of select="sm:help/@quickHelp"/>")</xsl:if> 
    337337                                                <!-- sm:perms --> 
    338                                                 <!-- TODO perms  
    339                                                 .addWritePermName() 
    340                                                 .addPermissionName() 
    341                                                 --> 
     338                                                <xsl:if test="sm:perms/sm:writePerm/@sc:refUri">.addWritePermName("<xsl:value-of select="resultatAgent(concat('@', getIdFromPath(sm:perms/sm:writePerm/@sc:refUri), '/codePerm'))"/>")</xsl:if> 
     339                                                <xsl:if test="$pFormWidget/sm:perms/sm:writePerm/@sc:refUri">.addWritePermName("<xsl:value-of select="resultatAgent(concat('@', getIdFromPath($pFormWidget/sm:perms/sm:writePerm/@sc:refUri), '/codePerm'))"/>")</xsl:if> 
    342340                                        </xsl:template> 
    343341                                         
     
    407405                        </page> 
    408406                </affichage> 
     407        </valeur> 
     408         
     409        <!-- @API : peuplement des buffers de gestion des droits --> 
     410        <valeur code="fillMapRights"> 
     411                <source type="xpathOnSrc-dynamique">execute(concatExpr(//*[local-name()='addRight' or local-name()='writePerm'], resultatAgent(concat('@', getIdFromPath(@sc:refUri), '/fillMapRights'))))</source> 
    409412        </valeur> 
    410413         
  • trunk/Xul_Core/content/Core/widgets/jsForm/jsForm.jsm

    r19519 r19651  
    4242        isReadOnly: function(pContext) { 
    4343                if(this.fReadOnly == true) return true; 
    44                 var vPerms = this.getWritePerms(); 
    45                 if (!vPerms) return false; 
     44                var vPerms = this.getWritePerms(pContext); 
     45                if (!vPerms || !pContext) return false; 
    4646                var vSecurityCtx = pContext.scSecurityCtx || pContext.window.scSecurityCtx; 
    4747                if (!vSecurityCtx) return false; 
     
    5757        /** Ajoute une permission par son nom. La perm devra être résolu en fonction du contexte à l'execution du isReadOnly(pContext). */ 
    5858        addWritePermName:function(pPermName){ 
    59                 //TODO 
    60         }, 
    61          
    62         getWritePerms: function () { 
    63                 return this.fWritePerms; 
     59                if(!this.fWritePermsNameArray) this.fWritePermsNameArray=[]; 
     60                this.fWritePermsNameArray.push(pPermName); 
     61                return this; 
     62        }, 
     63         
     64        getWritePerms: function (pContext) { 
     65                try{ 
     66                        if(!this.fWritePermsNameArray || !pContext){ 
     67                                return this.fWritePerms; 
     68                        }else{ 
     69                                var vPermsArray = Array.isArray(this.fWritePerms) ? this.fWritePerms.clone() : []; 
     70                                if(this.fWritePerms && !Array.isArray(this.fWritePerms)) vPermsArray.push(this.fWritePerms); 
     71                                var vSecurityCtx = pContext.scSecurityCtx || pContext.window.scSecurityCtx; 
     72                                if(vSecurityCtx){ 
     73                                        vPermsArray = vPermsArray.concat(vSecurityCtx.getPerms(this.fWritePermsNameArray.join(" "))); 
     74                                } 
     75                                return vPermsArray; 
     76                        } 
     77                }catch(e){log.debug(e)} 
    6478        }, 
    6579         
     
    121135                if (vLabel) vInput.setAttribute('label', vLabel); 
    122136                 
    123                 if (this.isReadOnly()) vInput.setAttribute('readonly', 'true'); 
    124                 if (this.isRequired()) vInput.setAttribute('required', 'true'); 
     137                if (this.isReadOnly(pContext)) vInput.setAttribute('readonly', 'true'); 
     138                if (this.isRequired(pContext)) vInput.setAttribute('required', 'true'); 
    125139                 
    126140                var vDescription = this.getDescription(pContext); 
  • trunk/Xul_Core/content/Core/widgets/jsForm/jsForm.xbl.xml

    r19647 r19651  
    535535                                <xul:label anonid="label" xbl:inherits="value=label" /> 
    536536                                <xul:hbox align="top" xbl:inherits="tooltiptext=description"> 
    537                                         <xul:toolbarbutton anonid="clear" class="smallbutton" xbl:inherits="disabled,disabled=readonly" oncommand="document.getBindingParent(this)._DeleteValue()"/> 
     537                                        <xul:toolbarbutton anonid="clear" class="smallbutton" xbl:inherits="disabled,collapsed=readonly" oncommand="document.getBindingParent(this)._DeleteValue()"/> 
    538538                                        <xul:datepicker anonid="input" isnull="true" xbl:inherits="disabled,readonly,required" type="popup"/> 
    539539                                </xul:hbox> 
     
    558558                        <property name="fInputNode" onget="return document.getAnonymousElementByAttribute(this, 'anonid', 'input')" /> 
    559559                        <property name="fBtn" onget="return document.getAnonymousElementByAttribute(this, 'anonid', 'clear')" /> 
     560                        <property name="readonly" onget="return this.getAttribute('readonly')=='true'" /> 
    560561                         
    561562                        <!-- @param pFormat[optionnel] [XML(défaut)|timestamp] --> 
     
    612613                                this.dispatchDirtyEvent(); 
    613614                        </handler> 
    614                         <handler event="focus"> 
    615                                 if(this.fInputNode.isnull){ 
     615                        <handler event="focus"><![CDATA[ 
     616                                if(!this.readonly && this.fInputNode.isnull){ 
    616617                                        this.fInputNode.isnull = false; 
    617618                                        this.dispatchDirtyEvent(); 
    618619                                } 
    619                         </handler> 
     620                        ]]></handler> 
    620621                </handlers> 
    621622        </binding> 
  • trunk/Xul_Wsp/content/Wsp/widgets/jsForm/wspJsForm.xbl.xml

    r19647 r19651  
    5454                                <xul:xedToolBar anonid="toolBar" style="-moz-binding: url(chrome://scenariXedLib/content/libUiBase/widgets/xedUiBase.xbl.xml#xedToolBar);" /> 
    5555                        </xul:hbox> 
    56                         <xul:editXedBox anonid="xedBox" class="maskIfClosed" hideStructBar="true" xmlErrorsAllowed="false" style="-moz-binding: url(chrome://scenariXedLib/content/core/xed.xbl.xml#xedBoxNoScroll);" xbl:inherits="hideStructBar,xmlErrorsAllowed,tooltiptext=description"/> 
     56                        <xul:editXedBox anonid="xedBox" class="maskIfClosed" hideStructBar="true" xmlErrorsAllowed="false" style="-moz-binding: url(chrome://scenariXedLib/content/core/xed.xbl.xml#xedBoxNoScroll);" xbl:inherits="hideStructBar,xmlErrorsAllowed,tooltiptext=description,readonly"/> 
    5757                </content> 
    5858                <implementation> 
Note: See TracChangeset for help on using the changeset viewer.