- Timestamp:
- 02/02/09 17:58:53 (3 years ago)
- Location:
- trunk/model/sources/dkCore/genSld/wdt/mgr
- Files:
-
- 4 edited
-
scPresMgr.doss/scPresMgr.js (modified) (22 diffs)
-
scPresMgr.uiwidget (modified) (1 diff)
-
scSlideMgr.doss/scSlideMgr.js (modified) (4 diffs)
-
scSlideMgr.uiwidget (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/model/sources/dkCore/genSld/wdt/mgr/scPresMgr.doss/scPresMgr.js
r414 r468 77 77 fCutableFilterComp : null, 78 78 fListeners : [], 79 fToolElts : [], 79 80 80 81 /* Etats */ … … 85 86 * @param pSldFraPath : path to the slide frame. 86 87 * @param pNavPath : path to the navigation bar. 87 * @param pTocPath : path to table of contents. 88 * @param pTocLnksPath : relative path to all toc entries. 89 */ 90 init : function(pSldFraPath, pNavPath, pTocPath, pTocLnksPath) { 88 * @param pTocLnksPath : path to all toc entries. 89 */ 90 init : function(pSldFraPath, pNavPath, pTocLnksPath) { 91 91 //scCoLib.util.log("scPresMgr.init"); 92 92 this.fSldFraPath = pSldFraPath; 93 93 this.fNavPath = pNavPath; 94 this.fTocPath = pTocPath; 95 this.fTocLnksPath = pTocLnksPath || "des:a"; 94 this.fTocLnksPath = pTocLnksPath; 96 95 //Compilations paths et filters 97 96 this.fContainerFilterComp = scPaLib.compileFilter(this.fContainerFilter); … … 99 98 this.fBlkCoPathComp = scPaLib.compilePath(this.fBlkCoPath); 100 99 this.fCutableFilterComp = scPaLib.compileFilter(this.fCutableFilter); 101 100 //Init Listeners 102 101 this.fListeners = {}; 103 102 this.fListeners['onSldLoad'] = new Array(); 104 103 this.fListeners['onSldShow'] = new Array(); 104 //Init liste elements outils 105 this.fToolElts = new Array(); 105 106 106 107 scOnLoads[scOnLoads.length] = this; … … 108 109 setContainerFilter : function(pContainerFilter) { 109 110 this.fContainerFilter = pContainerFilter; 111 }, 112 setContainerBlocksRootPath : function(pContainerBlocksRootPath) { 113 this.fContainerBlocksRootPath = pContainerBlocksRootPath; 110 114 }, 111 115 setBlkCoPath : function(pBlkCoPath) { … … 118 122 try{ 119 123 //scCoLib.util.log("scPresMgr.onLoad"); 120 // Init basic objects 121 this.fToc = scPaLib.findNode(this.fTocPath); 124 //Find Slideshow frame 122 125 this.fSldFra = scPaLib.findNode(this.fSldFraPath); 123 124 // Enable fSsCssName CSS 126 //Enable fSsCssName CSS 125 127 var vCss = null; 126 128 for(var i = 0; (vCss = document.getElementsByTagName("link")[i]); i++) { … … 130 132 } 131 133 } 132 133 //Nav 134 this.fNav = scPaLib.findNode(this.fNavPath); 135 this.fTocLnks = scPaLib.findNodes(this.fTocLnksPath, this.fToc); 134 //Init toc 135 this.fTocLnks = scPaLib.findNodes(this.fTocLnksPath); 136 136 this.fBtnHome = this.fTocLnks.shift(); 137 137 this.fBtnHome.href = "#"; … … 144 144 this.fTocLnks[i].onclick = this.sOnClickTocLnk; 145 145 } 146 //Init events 146 147 document.onkeyup = scPresMgr.sOnKeyUp; 147 148 this.fToolsShowTime = new Date().getTime(); 148 window.setInterval(this.sToolsHider,1000);149 this.fHeartbeat = window.setInterval(this.sHeartbeat,1000); 149 150 if(scCoLib.isIE) document.body.attachEvent("onmousemove", this.sMouseMgr); 150 151 else window.addEventListener("mousemove", this.sMouseMgr,true); 151 152 if(scCoLib.isIE) document.body.attachEvent("onmousedown", this.sMouseMgr); 152 153 else window.addEventListener("mousedown", this.sMouseMgr,true); 153 154 // Init nav bar154 //Init nav bar 155 this.fNav = scPaLib.findNode(this.fNavPath); 155 156 this.fNav.innerHTML = ""; // Purge the nav bar 156 157 this.fBtnPrv = this.xAddBtn(this.fNav, "btnPrv", "Précédant", "Précédant (flèche gauche)"); 157 158 this.fBtnPrv.style.visibility = "hidden"; 158 159 this.fBtnNxt = this.xAddBtn(this.fNav, "btnNxt", "Suivant", "Suivant (flèche droite)"); 159 // Init Slide d'accueil 160 this.addToolElt(this.fNav); 161 //Init Slide d'accueil 160 162 this.fSldHome = scPaLib.findNode("chi:div.slide", this.fSldFra); 161 163 this.fSldHome.fSldMgr = new scPresMgr.SldHomeMgr(this.fSldHome, -1); 162 163 164 this.fSldHome.fSldMgr.initSld(); 164 165 // Init zoom container 165 //Init zoom container 166 166 this.fZoom = this.xAddEltHidden("div", document.body, "tplZm"); 167 // this.fZoom.fTi = this.xAddElt("div", this.fZoom, "tplZmTi"); 168 this.fZoom.fFra = scPresMgr.xAddElt("iframe", this.fZoom, "tplZmCo"); 167 this.fZoom.fSld = scPresMgr.xAddElt("div", this.fZoom, "tplZmSld"); 169 168 this.fZoom.fCo = this.xAddElt("div", this.fZoom, "tplZmCo"); 170 169 this.fZoom.fBtnCls = this.xAddBtn(this.fZoom, "btnZmCls", "Fermer", "Fermer le zoom (ESC)"); 171 172 // Affichage du slide d'accueil (rendu instantanné) 170 //Enable tool auto hiding 171 this.enableToolHider(true); 172 //Affichage du slide d'accueil (rendu instantanné) 173 173 this.fSwitchSldTask.initTask(this.fSldHome, "first", true); 174 175 176 174 }catch(e){scCoLib.util.logError("ERROR scPresMgr.onLoad : ", e);} 177 175 }, … … 225 223 }, 226 224 225 /** Show the passed ressource in the zoom. */ 226 showZoom : function(pRes) { 227 return this.xShowZoom(pRes); 228 }, 229 230 /** register a listener. */ 227 231 register : function(pType, pFunc) { 228 232 this.fListeners[pType].push(pFunc); 233 }, 234 235 /** Enable / Disable auto tool hiding */ 236 enableToolHider : function(pEnable) { 237 this.fToolHider = pEnable; 238 if (!pEnable) this.xShowTools(); 239 }, 240 241 /** register a node as a tool (auto hidden elements). */ 242 addToolElt : function(pNode) { 243 this.fToolElts.push(pNode); 229 244 }, 230 245 … … 241 256 */ 242 257 xNxt : function(pSkip) { 243 this.xHideZoom(); 244 var vFromSld = scPresMgr.fSwitchSldTask.fNewSld || this.fCurrSld; 245 if( ! vFromSld || ! vFromSld.fSldMgr.fIsLoaded) return false; 246 if (pSkip || ! vFromSld.fSldMgr.goToNxt()) { 247 return this.xGotoSlide(vFromSld.fSldMgr.fSldIdx+1, true, false); 258 259 if(this.fZoom.fAct && !pSkip){ 260 if(this.fZoom.fSldMgr && !this.fZoom.fSldMgr.fIsLoaded) return false; 261 if(!this.fZoom.fSldMgr || this.fZoom.fSldMgr && !this.fZoom.fSldMgr.goToNxt()) this.xHideZoom(); 262 } else { 263 this.xHideZoom(); 264 var vFromSld = scPresMgr.fSwitchSldTask.fNewSld || this.fCurrSld; 265 if( ! vFromSld || ! vFromSld.fSldMgr.fIsLoaded) return false; 266 if (pSkip || ! vFromSld.fSldMgr.goToNxt()) { 267 return this.xGotoSlide(vFromSld.fSldMgr.fSldIdx+1, true, false); 268 } 248 269 } 249 270 return true; … … 254 275 */ 255 276 xPrv : function(pSkip) { 256 this.xHideZoom(); 257 var vFromSld = scPresMgr.fSwitchSldTask.fNewSld || this.fCurrSld; 258 if( ! vFromSld || ! vFromSld.fSldMgr.fIsLoaded) return false; 259 if (pSkip || ! vFromSld.fSldMgr.goToPrv()) { 260 return this.xGotoSlide(vFromSld.fSldMgr.fSldIdx-1, (pSkip ? true : false), false); 277 if(this.fZoom.fAct && !pSkip){ 278 if(this.fZoom.fSldMgr && !this.fZoom.fSldMgr.fIsLoaded) return false; 279 if(!this.fZoom.fSldMgr || this.fZoom.fSldMgr && !this.fZoom.fSldMgr.goToPrv()) this.xHideZoom(); 280 } else { 281 var vFromSld = scPresMgr.fSwitchSldTask.fNewSld || this.fCurrSld; 282 if( ! vFromSld || ! vFromSld.fSldMgr.fIsLoaded) return false; 283 if (pSkip || ! vFromSld.fSldMgr.goToPrv()) { 284 return this.xGotoSlide(vFromSld.fSldMgr.fSldIdx-1, (pSkip ? true : false), false); 285 } 261 286 } 262 287 return true; … … 381 406 case 8://bksp 382 407 case 37://left 383 case 48://up408 case 38://up 384 409 case 80://p 385 410 this.xPrv(); return false; … … 405 430 if (!vZm.fAct){ 406 431 vZm.fAct = true; 407 vZm.fFra.src = "";408 432 vZm.fCo.innerHTML = ""; 433 vZm.fSld.innerHTML = ""; 434 vZm.fSldMgr = null; 409 435 if (pRes.nodeName.toLowerCase() == "a") { 410 vZm.fCo.style.visibility = "hidden"; 411 vZm.fFra.style.visibility = ""; 412 // TODO zoom a slide 436 new scPresMgr.FadeEltTask(vZm.fCo,0,null,null,true); 437 new scPresMgr.FadeEltTask(vZm.fSld,1,null,null,true); 438 vZm.fSldMgr = new scPresMgr.SldZoomMgr(vZm.fSld, pRes.href,function(){new scPresMgr.FadeEltTask(scPresMgr.fZoom,1);}); 439 vZm.fSldMgr.initSld(); 413 440 } else { 414 vZm.fCo.style.visibility = "";415 vZm.fFra.style.visibility = "hidden";441 new scPresMgr.FadeEltTask(vZm.fCo,1,null,null,true); 442 new scPresMgr.FadeEltTask(vZm.fSld,0,null,null,true); 416 443 vDst = scPresUt.importDeepNode(pRes, vZm.fCo.ownerDocument, vZm.fCo); 417 }418 new scPresMgr.FadeEltTask(vZm,1);444 new scPresMgr.FadeEltTask(vZm,1); 445 } 419 446 } else { 420 //TODO zoom already open 447 if (pRes.nodeName.toLowerCase() == "a") { 448 // TODO finalize zoom a slide 449 vZm.fSldMgr = new scPresMgr.SldZoomMgr(vZm.fSld, pRes.href); 450 vZm.fSldMgr.initSld(); 451 } else { 452 vDst = scPresUt.importDeepNode(pRes, vZm.fCo.ownerDocument, vZm.fCo); 453 new scPresMgr.FadeEltTask(vZm.fSld,0); 454 new scPresMgr.FadeEltTask(vZm.fCo,1); 455 } 421 456 } 422 457 return vDst; … … 427 462 if (this.fZoom.fAct){ 428 463 this.fZoom.fAct = false; 429 new scPresMgr.FadeEltTask(this.fZoom, 0, null, function(){scPresMgr.fZoom.f Fra.src = ""; scPresMgr.fZoom.fCo.innerHTML= "";});464 new scPresMgr.FadeEltTask(this.fZoom, 0, null, function(){scPresMgr.fZoom.fSldMgr = null; scPresMgr.fZoom.fSld.innerHTML = ""; scPresMgr.fZoom.fCo.innerHTML = ""; scPresMgr.fNav.style.zIndex = "";}); 430 465 } 431 466 }, … … 435 470 return this.fZoom.fCo; 436 471 }, 437 /** scPresMgr.xGetZoom Frame : return the zoom iframe438 */ 439 xGetZoom Frame : function(){472 /** scPresMgr.xGetZoomSlide : return the zoom iframe container 473 */ 474 xGetZoomSlide : function(){ 440 475 return this.fZoom.fFra; 441 476 }, … … 461 496 } 462 497 }, 498 /** scPresMgr.xHideTools : tool hider 499 */ 500 xHideTools : function(){ 501 if (!this.fToolsHidden) { 502 var vNewTime = new Date().getTime(); 503 if (vNewTime-this.fToolsShowTime >= 5000) { 504 this.fToolsHidden = true; 505 for (i in this.fToolElts) { 506 try { 507 new this.FadeEltTask(this.fToolElts[i],0,this.sFadeToolsStart,this.sFadeToolsEnd); 508 } catch(e) {scCoLib.util.logError("ERROR scPresMgr.xHideTools: ",e);} 509 } 510 } 511 } 512 }, 513 /** scPresMgr.xShowTools : mouse event manager 514 */ 515 xShowTools : function(){ 516 if (this.fToolsHidden) { 517 this.fToolsHidden = false; 518 for (i in this.fToolElts) { 519 try { 520 new this.FadeEltTask(this.fToolElts[i],1,this.sFadeToolsStart,this.sFadeToolsEnd); 521 } catch(e) {scCoLib.util.logError("ERROR scPresMgr.xShowTools: ",e);} 522 } 523 } 524 this.fToolsShowTime = new Date().getTime(); 525 }, 463 526 /** scPresMgr.sMouseMgr : mouse event manager 464 527 */ 465 528 sMouseMgr : function(){ 466 if (scPresMgr.fToolsHidden) { 467 scPresMgr.fToolsHidden = false; 468 new scPresMgr.FadeEltTask(scPresMgr.fNav,1,scPresMgr.sFadeToolsStart,scPresMgr.sFadeToolsEnd); 469 if (tocMgr.fTglBtn) new scPresMgr.FadeEltTask(tocMgr.fTglBtn,1,scPresMgr.sFadeToolsStart,scPresMgr.sFadeToolsEnd); 470 471 } 472 scPresMgr.fToolsShowTime = new Date().getTime(); 473 }, 474 /** scPresMgr.sToolsHider : nav bar hider 475 */ 476 sToolsHider : function(){ 477 if (!scPresMgr.fToolsHidden) { 478 var vNewTime = new Date().getTime(); 479 if (vNewTime-scPresMgr.fToolsShowTime >= 5000) { 480 scPresMgr.fToolsHidden = true; 481 new scPresMgr.FadeEltTask(scPresMgr.fNav,0,scPresMgr.sFadeToolsStart,scPresMgr.sFadeToolsEnd); 482 if (tocMgr.fTglBtn) new scPresMgr.FadeEltTask(tocMgr.fTglBtn,0,scPresMgr.sFadeToolsStart,scPresMgr.sFadeToolsEnd); 483 } 484 } 485 }, 529 if (scPresMgr.fToolHider) scPresMgr.xShowTools(); 530 }, 531 532 /** scPresMgr.sHeartbeat : run every second. 533 */ 534 sHeartbeat : function(){ 535 if (scPresMgr.fToolHider) scPresMgr.xHideTools(); 536 }, 537 486 538 /** scPresMgr.sFadeToolsStart : 487 539 */ … … 1053 1105 vSldMgr.fIsLoaded = true; 1054 1106 scPresMgr.xNotifyListeners("onSldSLoad", vSldMgr.fSldNode); 1107 vSldMgr.postOnLoad(); 1055 1108 } catch(e){scCoLib.util.logError("ERROR error loading slide.", e);} 1109 } 1110 scPresMgr.SldMgr.prototype.postOnLoad = function() { 1056 1111 } 1057 1112 scPresMgr.SldMgr.prototype.getFirstBlock = function() { … … 1146 1201 return scPresMgr.xGetZoomContainer(); 1147 1202 } 1148 scPresMgr.SldMgr.prototype.getZoom Frame = function(pRes){1149 return scPresMgr.xGetZoom Frame();1203 scPresMgr.SldMgr.prototype.getZoomSlide = function(pRes){ 1204 return scPresMgr.xGetZoomSlide(); 1150 1205 } 1151 1206 scPresMgr.SldMgr.prototype.setCurrBlock = function(pNewBlock){ … … 1154 1209 1155 1210 1156 /** Slide sde l'accueil : pas d'iframe. */1211 /** Slide de l'accueil : pas d'iframe. */ 1157 1212 scPresMgr.SldHomeMgr = function(pSldNode, pIdx){ 1158 1213 this.fSldNode = pSldNode; … … 1169 1224 this.fBlocksRoot = scSlideMgr.getBlocksRoot(); 1170 1225 this.fBlocks = scPresMgr.xInitBlocks(this, this.fBlocksRoot); 1171 1172 1226 // flag, load ok. 1173 1227 this.fIsLoaded = true; 1174 1175 1228 } 1176 1229 scPresMgr.SldHomeMgr.prototype.redrawSld = function() { … … 1185 1238 scPresMgr.SldHomeMgr.prototype.getAvailWidth = function(){ 1186 1239 return this.fBlocksRoot.offsetWidth; 1240 } 1241 1242 /** Slide de zoom. */ 1243 scPresMgr.SldZoomMgr = function(pSldNode, pUrl, pPostLoadFunc){ 1244 this.fSldNode = pSldNode; 1245 this.fSldIdx = -1; 1246 this.fPostLoadFunc = pPostLoadFunc || function(){}; 1247 this.fSldUrl = pUrl; 1248 this.fIsLoaded = false; 1249 this.fCurrBlk = null; 1250 } 1251 scPresMgr.SldZoomMgr.prototype = new scPresMgr.SldMgr(); 1252 scPresMgr.SldZoomMgr.prototype.initSld = function(){ 1253 this.fFraNode = scPresMgr.xAddElt("iframe", this.fSldNode, "slideFra"); 1254 this.fFraNode.fSldMgr = this; 1255 this.fCurrBlk = null; 1256 if(scCoLib.isIE) this.fFraNode.onreadystatechange = scPresMgr.SldMgr.sOnLoadSld; 1257 else this.fFraNode.onload = scPresMgr.SldMgr.sOnLoadSld; 1258 this.fFraNode.src = this.fSldUrl; 1259 } 1260 scPresMgr.SldZoomMgr.prototype.postOnLoad = function() { 1261 scPresMgr.fSwitchBlkTask.initTask(this.fCurrBlk, this.getFirstBlock(), "F", true); 1262 scPresMgr.fNav.style.zIndex = this.hasNxt() ? "100" : ""; 1263 this.fPostLoadFunc(); 1187 1264 } 1188 1265 … … 1642 1719 * @param pStartFunc optionnal function that will be executed at the start of the task. 1643 1720 * @param pEndFunc optionnal function that will be executed at the end of the task. 1721 * @param pInstant optionnal parameter if true no animation. 1644 1722 */ 1645 scPresMgr.FadeEltTask = function(pElt,pDir,pStartFunc,pEndFunc ){1723 scPresMgr.FadeEltTask = function(pElt,pDir,pStartFunc,pEndFunc,pInstant){ 1646 1724 this.fRate = new Array(); 1647 1725 this.fRate[0] = [.9, .85, .8, .7, .6, .5, .4, .3, .2, .15, .1]; … … 1652 1730 this.fStartFunc = pStartFunc || function(){}; 1653 1731 this.fEndFunc = pEndFunc || function(){}; 1732 if (pInstant) { 1733 this.terminate(); 1734 return; 1735 } 1654 1736 if (this.fElt.fFadeTask) { 1655 1737 this.fElt.fFadeTask.changeDir(this.fDir); -
trunk/model/sources/dkCore/genSld/wdt/mgr/scPresMgr.uiwidget
r414 r468 7 7 <sm:standardLibrary codeLib="SiLib"/> 8 8 <sm:linkScript path="scPresMgr.js" pathFrom="localPublishFiles" sortKey="AA"/> 9 <sm:otherBuffers keyBuffer="js.postLink">scPresMgr.init("ide:tplSldFra","ide:tplNav","ide:tplTocCo ","des:a.toc_lnk");9 <sm:otherBuffers keyBuffer="js.postLink">scPresMgr.init("ide:tplSldFra","ide:tplNav","ide:tplTocCo/des:a.toc_lnk"); 10 10 </sm:otherBuffers> 11 11 </sm:fillTemplateBuffers> -
trunk/model/sources/dkCore/genSld/wdt/mgr/scSlideMgr.doss/scSlideMgr.js
r414 r468 185 185 } 186 186 187 /* ===== SlideZoom Block class ================================================= */ 188 /** scSlideMgr.SldZmBlk : SlideZoom block (anchors pointing to slides that need to be opened as a zoom). 189 */ 190 scSlideMgr.SldZmBlk = function(pElt, pOpt){ 191 pElt.onclick = this.onClickZoom; 192 } 193 scSlideMgr.SldZmBlk.prototype.onClickZoom = function(){ 194 if (!window.frameElement || !window.frameElement.fSldMgr) return false; 195 var vSldMgr = window.frameElement.fSldMgr; 196 if(vSldMgr) vSldMgr.showZoom(this); 197 return false; 198 } 199 187 200 /* ===== Size Block classes ================================================= */ 188 201 … … 245 258 var vWantedH = pOwnerNode.fOriH * vRate; 246 259 var vMaxW = scSlideMgr.getBlocksAvailWidth() * (this.fOpt.ratioWidth || .8); 247 var vMaxH = scSlideMgr.getBlocksAvailHeight() * ( vIsAlone ? (this.fOpt.ratioHeightAlone || .9) : (this.fOpt.ratioHeight || . 6) ) - (this.fOpt.captionHeight || 30);260 var vMaxH = scSlideMgr.getBlocksAvailHeight() * ( vIsAlone ? (this.fOpt.ratioHeightAlone || .9) : (this.fOpt.ratioHeight || .8) ) - (this.fOpt.captionHeight || 30); 248 261 var vFinalW; 249 262 var vZoomOn = false; … … 265 278 pOwnerNode.fResFra.style.height=vImg.height+"px"; 266 279 } 267 if (pOwnerNode.fZoom) pOwnerNode.fZoom.style.display = (vZoomOn && i < l ) ? "" : "none";280 if (pOwnerNode.fZoom) pOwnerNode.fZoom.style.display = (vZoomOn && i < l-1) ? "" : "none"; 268 281 }catch(e){ 269 282 scCoLib.util.logError("ERROR scSlideMgr.SizeBlkImg.onResizedAnc : ", e); … … 339 352 var vWantedH = vObj.oriH * vRate; 340 353 var vMaxW = scSlideMgr.getBlocksAvailWidth() * (this.fOpt.ratioWidth || .8); 341 var vMaxH = scSlideMgr.getBlocksAvailHeight() * ( vIsAlone ? (this.fOpt.ratioHeightAlone || .9) : (this.fOpt.ratioHeight || . 6) ) - (this.fOpt.captionHeight || 30);354 var vMaxH = scSlideMgr.getBlocksAvailHeight() * ( vIsAlone ? (this.fOpt.ratioHeightAlone || .9) : (this.fOpt.ratioHeight || .8) ) - (this.fOpt.captionHeight || 30); 342 355 if(vWantedW > vMaxW || vWantedH > vMaxH) { 343 356 var vRW = vWantedW / vMaxW; -
trunk/model/sources/dkCore/genSld/wdt/mgr/scSlideMgr.uiwidget
r414 r468 10 10 scSlideMgr.addBindableBlk("des:div.objInFlow",null,scSlideMgr.SizeBlkObj); 11 11 scSlideMgr.addBindableBlk("des:span.objInline",{captionHeight:0},scSlideMgr.SizeBlkObj); 12 scSlideMgr.addBindableBlk("bod:/des:a.ssZmLnk",null,scSlideMgr.SldZmBlk); 12 13 </sm:otherBuffers> 13 14 </sm:fillTemplateBuffers>
Note: See TracChangeset
for help on using the changeset viewer.