Changeset 15019


Ignore:
Timestamp:
03/03/10 18:28:52 (2 years ago)
Author:
sys
Message:

src.appendShortDescFields(pExtPoints, pFields)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Xul_Wsp/modules/scenariWsp/commons/src.jsm

    r14773 r15019  
    3939  
    4040/** 
    41  * Propriétés et fonctions relatives à l'API Src (uri, paths, id...).  
     41 * Propriétés et fonctions relatives à l'API Src (uri, paths, id...).  
    4242 */ 
    4343const EXPORTED_SYMBOLS = ["src"]; 
     
    6161 
    6262/** 
    63  * Ajoute un élément fils à une uri et retourne la nouvelle Uri. 
     63 * Ajoute un élément fils à une uri et retourne la nouvelle Uri. 
    6464 */ 
    6565src.addLeafToUri = function(pUriParent, pLeafName){ 
     
    8080 
    8181/** 
    82  * Retourne l'élément terminal d'une Uri. 
     82 * Retourne l'élément terminal d'une Uri. 
    8383 */ 
    8484src.getLeafFromUri = function(pUri){ 
     
    9292 
    9393/** 
    94  * pAncestorUri est-elle un ancêtre de pUri. 
     94 * pAncestorUri est-elle un ancêtre de pUri. 
    9595 * Si pAncestorUri==pUri retourne false. 
    9696 */ 
     
    115115        return pSrcPath ? /^id\:/.test(pSrcPath) : false; 
    116116} 
     117 
     118/** 
     119 * Enrichit les fields définissant le contenu du shortDesc. 
     120 *  
     121 * @param pExtPoints extPoints à modifier 
     122 * @param pFields Tableau Js de fields 
     123 */ 
     124src.appendShortDescFields = function(pExtPoints, pFields){ 
     125        const PREF = "srcShortDesc.fields"; 
     126        var vFields = pExtPoints.getPref(PREF); 
     127        if(vFields) { 
     128                var vLevel = pExtPoints.getPrefLevel(PREF); 
     129                var vCurrentFields = vFields.split("*"); 
     130                for(var i = 0; i < pFields.length; i++) { 
     131                        if(vCurrentFields.indexOf(pFields[i]) < 0) { 
     132                                vCurrentFields.push(pFields[i]); 
     133                        } 
     134                } 
     135                pExtPoints.setPrefFromXpcom(PREF, vLevel+1, vCurrentFields.join("*")); 
     136        } else { 
     137                pExtPoints.setPrefFromXpcom(PREF, 1, pFields.join("*")); 
     138        } 
     139} 
Note: See TracChangeset for help on using the changeset viewer.