Changeset 663


Ignore:
Timestamp:
09/29/11 15:03:23 (8 months ago)
Author:
sam
Message:

sync Dokiel

Location:
trunk/model/sources/dkCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/model/sources/dkCore/genSld/wdt/mgr/scHPS.doss/scHPS.js

    r661 r663  
    4848        fUncutableFilter : ".ssUncutable|tr", 
    4949        fFixedHeightFilter : ".ssFixedHeight", 
     50        fKeyMap : {nextStep:["key_right","key_down"," ","n"], 
     51                   previousStep:["\b","key_left","key_up","p"], 
     52                   nextSlide:"key_pageDown", 
     53                   previousSlide:"key_pageUp", 
     54                   home:"key_home", 
     55                   toggleEffects:"f", 
     56                   switchToHtml:"h", 
     57                   closeZoom:"key_escape"}, 
    5058 
    5159        /* Constantes de stylage. */ 
     
    7684 
    7785        /* --- Public ------------------------------------------------------------- */ 
    78         /** scHPS.init */ 
     86        /** scHPS.init : MUST be called before any other scHPS interaction */ 
    7987        init : function() { 
    8088                try{ 
     
    8391                        if (!("scTiLib" in window)) throw "scTiLib.js not present in presentation window."; 
    8492                        if (!("scPaLib" in window)) throw "scPaLib.js not present in presentation window."; 
    85  
    8693                        if (window.location.search.indexOf("mode=html")<0 && !this.fNavie6) this.fDisabled = false; 
     94                        this.fStore = new scHPS.LocalStore(); 
    8795                        scOnLoads[scOnLoads.length] = this; 
    8896                } catch(e){scCoLib.util.logError("ERROR scHPS.init", e);} 
     
    94102                        // ie6 warning... 
    95103                        if (window.location.search.indexOf("mode=html")<0 && this.fNavie6){ 
    96                                 if(document.cookie.indexOf("ie6Warn=true")<0) alert(this.xGetStr(7)); 
    97                                 document.cookie = "ie6Warn=true"; 
     104                                if(this.fStore.get("ie6Warn") != "true") alert(this.xGetStr(7)); 
     105                                this.fStore.set("ie6Warn", "true"); 
    98106                        } 
    99107                        // firebug warning... 
     
    113121                                        if(vTitle.indexOf(this.fCssNameHTML) != -1) vCss.disabled = true; 
    114122                                        if(vTitle.indexOf(this.fCssNameSS) != -1) { 
     123//                                              vCss.setAttribute("rel","stylesheet"); // Bug Safari 5.1 
     124//                                              vCss.removeAttribute("title"); // Bug Safari 5.1 
    115125                                                vCss.disabled = true; // IE bug 
    116126                                                vCss.disabled = false; 
     
    136146                } 
    137147                return false; 
     148        }, 
     149        /** scHPS.xProcessKeyMap : Retrun an interpreted keymap object. */ 
     150        xProcessKeyMap: function(pMap) { 
     151                var i, vAction, vKeys, vKey; 
     152                var vMap = {}; 
     153                var xKeyCode = function (pStr){ 
     154                        if (!pStr || pStr.length == 0) return 0; 
     155                        switch(pStr){ 
     156                                case "key_right" : return 39; 
     157                                case "key_left" : return 37; 
     158                                case "key_up" : return 38; 
     159                                case "key_down" : return 40; 
     160                                case "key_pageUp" : return 33; 
     161                                case "key_pageDown" : return 34; 
     162                                case "key_home" : return 36; 
     163                                case "key_escape" : return 27; 
     164                                default: return pStr.toUpperCase().charCodeAt(0); 
     165                        } 
     166                } 
     167                for (vAction in pMap) { 
     168                        vKeys = pMap[vAction]; 
     169                        if (typeof vKeys == "object"){ 
     170                                for (i = 0; i < vKeys.length; i++){ 
     171                                        vMap[String(xKeyCode(vKeys[i]))] = vAction; 
     172                                } 
     173                        } else vMap[String(xKeyCode(vKeys))] = vAction; 
     174                } 
     175                return vMap; 
    138176        }, 
    139177        /* --- Static ------------------------------------------------------------- */ 
     
    395433        } 
    396434} 
    397 /* === Generic tasks ======================================================== */ 
     435/* === Generic Utility Classes ============================================== */ 
    398436/** scHPS.FadeEltTask : TiLib task that fades a given element in or out. 
    399437 * @param pElt element to fade. 
     
    461499        } 
    462500} 
     501/** scHPS.LocalStore : Inits and returns a new local storage object based on localStorage / cookies in that order. 
     502 * @pId (optional) : id of new local store. */ 
     503scHPS.LocalStore = function (pId){ 
     504        if (pId && !/^[a-z][a-z0-9]+$/.exec(pId)) throw new Error("Invalid store name"); 
     505        this.fId = pId || ""; 
     506        this.fRootKey = document.location.pathname.substring(0,document.location.pathname.lastIndexOf("/")) +"/"; 
     507        if ("localStorage" in window) { 
     508                this.get = function(pKey) {var vRet = localStorage.getItem(this.fRootKey+this.xKey(pKey));return (typeof vRet == "string" ? unescape(vRet) : null)}; 
     509                this.set = function(pKey, pVal) {localStorage.setItem(this.fRootKey+this.xKey(pKey), escape(pVal))}; 
     510        } else { 
     511                this.get = function(pKey){var vReg=new RegExp(this.xKey(pKey)+"=([^;]*)");var vArr=vReg.exec(document.cookie);if(vArr && vArr.length==2) return(unescape(vArr[1]));else return null}; 
     512                this.set = function(pKey,pVal){document.cookie = this.xKey(pKey)+"="+escape(pVal)}; 
     513        } 
     514        this.xKey = function(pKey){return this.fId + this.xEsc(pKey)}; 
     515        this.xEsc = function(pStr){return "LS" + pStr.replace(/ /g, "_")}; 
     516} 
    463517 
    464518/* ============================================================================= 
     
    479533        this.fTocLnksPath = pTocLnksPath || null; 
    480534        this.fIsMaster = (typeof pIsMaster == "undefined" ? true :  pIsMaster); 
    481         this.fEnableEffects = !(document.cookie.indexOf("enableEffects=false")>=0); 
    482535        // Init default paths & classes 
    483536        this.fCoFilter = scHPS.fCoFilter; 
     
    489542        this.fSlideClass = scHPS.fSlideClass; 
    490543        this.fSsClassPrefix = scHPS.fSsClassPrefix; 
     544        // Init default behaviours 
     545        this.fKeyMap = scHPS.xProcessKeyMap(scHPS.fKeyMap); 
    491546        // Init local slide rules 
    492547        this.fSldRules = []; 
     
    577632                        scCoLib.util.log("PresMgr.onLoad"); 
    578633                        var vPresMgr = this; 
     634                        this.fEnableEffects = !(scHPS.fStore.get("enableEffects") == "false"); 
    579635                        //Find Slideshow base elements 
    580636                        this.fSldFra = scPaLib.findNode(this.fSldFraPath); 
     
    702758                if (scHPS.fDisabled) return; 
    703759                this.fEnableEffects = pEnable; 
    704                 document.cookie = "enableEffects="+this.fEnableEffects; 
     760                scHPS.fStore.set("enableEffects",String(this.fEnableEffects)); 
    705761                if (this.fBtnEfcts) this.fBtnEfcts.style.display = (this.fEnableEffects ? "none" : ""); 
    706762                if (this.fBtnNoEfcts) this.fBtnNoEfcts.style.display = (this.fEnableEffects ? "" : "none"); 
     
    709765        toggleEffects : function() { 
    710766                this.enableEffects(!this.fEnableEffects); 
     767        }, 
     768        /** PresMgr.setKeyMap : change how the keys are interpreted. 
     769            @param pKeyMap : object defining the action->mapping (see scHPS.fKeyMap at top of file)  */ 
     770        setKeyMap : function(pKeyMap) { 
     771                var vAction; 
     772                for (vAction in scHPS.fKeyMap){ 
     773                        if (typeof pKeyMap[vAction] == "undefined") pKeyMap[vAction] = scHPS.fKeyMap[vAction]; 
     774                } 
     775                this.fKeyMap = scHPS.xProcessKeyMap(pKeyMap); 
    711776        }, 
    712777        /** PresMgr.loadSlide : Load a slide by index id.  
     
    9551020                //scCoLib.util.log("PresMgr.xKeyMgr: "+pCharCode); 
    9561021                this.xNotifyListeners("onKeyPress", pCharCode); 
    957                 switch(pCharCode){ 
    958                         case 39://right 
    959                         case 40://down 
    960                         case 32://space 
    961                         case 78://n 
     1022                var vAction; 
     1023                try{ 
     1024                        vAction = this.fKeyMap[String(pCharCode)]; 
     1025                } catch(e){}; 
     1026                if (!vAction) return false; 
     1027                switch(vAction){ 
     1028                        case "nextStep": 
    9621029                                this.next(); return false; 
    963                         case 8://bksp 
    964                         case 37://left 
    965                         case 38://up 
    966                         case 80://p 
     1030                        case "previousStep": 
    9671031                                this.previous(); return false; 
    968                         case 70://f 
     1032                        case "toggleEffects": 
    9691033                                this.toggleEffects(); return false; 
    970                         case 34://pg_dwn 
     1034                        case "nextSlide": 
    9711035                                this.next(true); return false; 
    972                         case 33://pg_up 
     1036                        case "previousSlide": 
    9731037                                this.previous(true); return false; 
    974                         case 36://home 
     1038                        case "home": 
    9751039                                this.loadSlide(-1);return false; 
    976                         case 27://escape 
     1040                        case "closeZoom": 
    9771041                                this.xHideZoom();return false; 
    978                         case 72://h 
     1042                        case "switchToHtml": 
    9791043                                return scHPS.xSwitchToHtmlMode(); 
    9801044                } 
     
    29363000// Call library init function... 
    29373001scHPS.init(); 
     3002 
  • trunk/model/sources/dkCore/genWeb/wdt/img/scImgMgr.doss/scImgMgr.js

    r661 r663  
    5353        fTypAnm : "scImgAnm", 
    5454        fTypZm : "scImgZm", 
    55         fTypGal : "scImgGal" 
     55        fTypGal : "scImgGal", 
     56        fFocus : true 
    5657} 
    5758/** scImgMgr.init. */ 
     
    158159scImgMgr.setPathPgeFra = function(pPathPgeFra) { 
    159160        this.fPathPgeFra = pPathPgeFra; 
     161} 
     162/** scImgMgr.setFocus. */ 
     163scImgMgr.setFocus = function(pFocus) { 
     164        this.fFocus = pFocus; 
    160165} 
    161166 
     
    306311                        for(var k in pAnim.fImgs) { 
    307312                                var vImg = pAnim.fImgs[k]; 
     313                                vImg.style.position = "absolute"; 
    308314                                vImg.fHeight = vImg.clientHeight; 
    309315                                vImg.fWidth = scPaLib.findNode("des:img",vImg).width; 
    310316                                vMaxHeight = Math.max(vMaxHeight,vImg.fHeight); 
    311317                                vMaxWidth = Math.max(vMaxWidth,vImg.fWidth); 
    312                                 vImg.style.position = "absolute"; 
    313318                                vImg.style.visibility = "hidden"; 
    314319                                vImg.style.top = "0"; 
     
    578583        this.xNotifyListeners("onZoomOpen", pAnc); 
    579584        this.xNotifyListeners("onOverlayOpen", pAnc); 
    580         try{pAnc.fClsBtn.focus();}catch(e){}; 
     585        this.xFocus(pAnc.fClsBtn); 
    581586} 
    582587scImgMgr.xClsZm = function(pAnc) { 
     
    588593        document.onkeyup = pAnc.fKeyUpOld; 
    589594        scImgMgr.fCurrItem = null; 
    590         try{pAnc.focus();}catch(e){}; 
     595        scImgMgr.xFocus(pAnc); 
    591596} 
    592597scImgMgr.sLoadZmImg = function() { 
     
    705710        this.xNotifyListeners("onAnimationOpen", pAlbFra); 
    706711        this.xNotifyListeners("onOverlayOpen", pAlbFra); 
    707         try{pAlbFra.fSsBtnPly.focus();}catch(e){}; 
     712        this.xFocus(pAlbFra.fSsBtnPly); 
    708713 
    709714} 
     
    748753        pAlbFra.fSsAutoPly = false; 
    749754        scImgMgr.fCurrItem = null; 
    750         try{pAlbFra.fInitAnc.focus();}catch(e){}; 
     755        scImgMgr.xFocus(pAlbFra.fInitAnc); 
    751756} 
    752757scImgMgr.xPlySs = function(pAlbFra) { 
     
    754759        pAlbFra.fSsBtnPly.style.display="none"; 
    755760        pAlbFra.fSsBtnPse.style.display=""; 
    756         try{pAlbFra.fSsBtnPse.focus();}catch(e){}; 
     761        scImgMgr.xFocus(pAlbFra.fSsBtnPse); 
    757762        if (! scImgMgr.xNxtSs(pAlbFra)) scImgMgr.xUdtSs(pAlbFra,pAlbFra.fAncs[0]); 
    758763        pAlbFra.fNxtSsProc = window.setTimeout(scImgMgr.xAutoSs, pAlbFra.fSsStep); 
     
    762767        pAlbFra.fSsBtnPly.style.display=""; 
    763768        pAlbFra.fSsBtnPse.style.display="none"; 
    764         try{pAlbFra.fSsBtnPly.focus();}catch(e){}; 
     769        scImgMgr.xFocus(pAlbFra.fSsBtnPly); 
    765770        window.clearTimeout(pAlbFra.fNxtSsProc); 
    766771//      pAlbFra.fNxtSsProc = -1; 
     
    11121117        return vBtn; 
    11131118} 
     1119/** scImgMgr.xFocus : */ 
     1120scImgMgr.xFocus = function(pNode) { 
     1121        if (this.fFocus) try{pNode.focus();}catch(e){}; 
     1122} 
    11141123/** scImgMgr.xIsVisible : */ 
    11151124scImgMgr.xIsVisible = function(pNode) { 
  • trunk/model/sources/dkCore/model/base/screenShot.model

    r540 r663  
    1 <?xml version="1.0" encoding="UTF-8"?><sm:imagePrim xmlns:sm="http://www.utc.fr/ics/scenari/v3/modeling" xmlns:sc="http://www.utc.fr/ics/scenari/v3/core" name=";Copie d'écran" category=";Cœur"> 
     1<?xml version="1.0" encoding="UTF-8"?> 
     2<sm:imagePrim xmlns:sc="http://www.utc.fr/ics/scenari/v3/core" xmlns:sm="http://www.utc.fr/ics/scenari/v3/modeling" name=";Copie d'écran" category=";Cœur"> 
    23        <sm:help quickHelp=";Copie d'écran de l'application "/> 
    3         <sm:identification extensions="scr.png scr.gif" mimeTypes="image"/> 
     4        <sm:identification extensions="scr.png scr.gif" mimeTypes="image/gif image/png"/> 
    45        <sm:structure> 
    56                <sm:meta sc:refUri="/dkCore/model/base/screenShotMeta.model" usage="optional"/> 
Note: See TracChangeset for help on using the changeset viewer.