1//General 2//for example: instead of each module writing out script found in moduleMaxMin_OnClick have the functionality cached 3// 4 5var DNN_COL_DELIMITER = String.fromCharCode(16); 6var DNN_ROW_DELIMITER = String.fromCharCode(15); 7var __dnn_m_bPageLoaded = false; 8 9window.onload = __dnn_Page_OnLoad; 10 11function __dnn_ClientAPIEnabled() 12{ 13 return typeof(dnn) != 'undefined'; 14} 15 16 17function __dnn_Page_OnLoad() 18{ 19 if (__dnn_ClientAPIEnabled()) 20 { 21 var sLoadHandlers = dnn.getVar('__dnn_pageload'); 22 if (sLoadHandlers != null) 23 eval(sLoadHandlers); 24 25 dnn.dom.attachEvent(window, 'onscroll', __dnn_bodyscroll); 26 } 27 __dnn_m_bPageLoaded = true; 28} 29 30function __dnn_KeyDown(iKeyCode, sFunc, e) 31{ 32 if (e == null) 33 e = window.event; 34 35 if (e.keyCode == iKeyCode) 36 { 37 eval(unescape(sFunc)); 38 return false; 39 } 40} 41 42function __dnn_bodyscroll() 43{ 44 var oF=document.forms[0]; 45 if (__dnn_ClientAPIEnabled() && __dnn_m_bPageLoaded && typeof oF.ScrollTop !== "undefined") 46 oF.ScrollTop.value=document.documentElement.scrollTop ? document.documentElement.scrollTop : dnn.dom.getByTagName("body")[0].scrollTop; 47} 48 49function __dnn_setScrollTop(iTop) 50{ 51 if (__dnn_ClientAPIEnabled()) 52 { 53 if (iTop == null) 54 iTop = document.forms[0].ScrollTop.value; 55 56 var sID = dnn.getVar('ScrollToControl'); 57 if (sID != null && sID.length > 0) 58 { 59 var oCtl = dnn.dom.getById(sID); 60 if (oCtl != null) 61 { 62 iTop = dnn.dom.positioning.elementTop(oCtl); 63 dnn.setVar('ScrollToControl', ''); 64 } 65 } 66 window.scrollTo(0, iTop); 67 } 68} 69 70//Focus logic 71function __dnn_SetInitialFocus(sID) 72{ 73 var oCtl = dnn.dom.getById(sID); 74 if (oCtl != null && __dnn_CanReceiveFocus(oCtl)) 75 oCtl.focus(); 76} 77 78function __dnn_CanReceiveFocus(e) 79{ 80 //probably should call getComputedStyle for classes that cause item to be hidden 81 if (e.style.display != 'none' && e.tabIndex > -1 && e.disabled == false && e.style.visible != 'hidden') 82 { 83 var eParent = e.parentElement; 84 while (eParent != null && eParent.tagName != 'BODY') 85 { 86 if (eParent.style.display == 'none' || eParent.disabled || eParent.style.visible == 'hidden') 87 return false; 88 eParent = eParent.parentElement; 89 } 90 return true; 91 } 92 else 93 return false; 94} 95 96//Max/Min Script 97function __dnn_ContainerMaxMin_OnClick(oLnk, sContentID) 98{ 99 var oContent = dnn.dom.getById(sContentID); 100 if (oContent != null) 101 { 102 var oBtn = oLnk.childNodes[0]; 103 var sContainerID = oLnk.getAttribute('containerid'); 104 var sCookieID = oLnk.getAttribute('cookieid'); 105 var sCurrentFile = oBtn.src.toLowerCase().substr(oBtn.src.lastIndexOf('/')); 106 var sMaxFile; 107 var sMaxIcon; 108 var sMinIcon; 109 110 if (dnn.getVar('min_icon_' + sContainerID)) 111 sMinIcon = dnn.getVar('min_icon_' + sContainerID); 112 else 113 sMinIcon = dnn.getVar('min_icon'); 114 115 if (dnn.getVar('max_icon_' + sContainerID)) 116 sMaxIcon = dnn.getVar('max_icon_' + sContainerID); 117 else 118 sMaxIcon = dnn.getVar('max_icon'); 119 120 sMaxFile = sMaxIcon.toLowerCase().substr(sMaxIcon.lastIndexOf('/')); 121 122 var iNum = 5; 123 if (oLnk.getAttribute('animf') != null)
124 iNum = new Number(oLnk.getAttribute('animf')); 125 126 if (sCurrentFile == sMaxFile) 127 { 128 oBtn.src = sMinIcon; 129 //oContent.style.display = ''; 130 dnn.dom.expandElement(oContent, iNum); 131 oBtn.title = dnn.getVar('min_text'); 132 if (sCookieID != null) 133 { 134 if (dnn.getVar('__dnn_' + sContainerID + ':defminimized') == 'true') 135 dnn.dom.setCookie(sCookieID, 'true', 365); 136 else 137 dnn.dom.deleteCookie(sCookieID); 138 } 139 else 140 dnn.setVar('__dnn_' + sContainerID + '_Visible', 'true'); 141 } 142 else 143 { 144 oBtn.src = sMaxIcon; 145 //oContent.style.display = 'none'; 146 dnn.dom.collapseElement(oContent, iNum); 147 oBtn.title = dnn.getVar('max_text'); 148 if (sCookieID != null) 149 { 150 if (dnn.getVar('__dnn_' + sContainerID + ':defminimized') == 'true') 151 dnn.dom.deleteCookie(sCookieID); 152 else 153 dnn.dom.setCookie(sCookieID, 'false', 365); 154 } 155 else 156 dnn.setVar('__dnn_' + sContainerID + '_Visible', 'false'); 157 } 158 159 return true; //cancel postback 160 } 161 return false; //failed so do postback 162} 163 164function __dnn_Help_OnClick(sHelpID) 165{ 166 var oHelp = dnn.dom.getById(sHelpID); 167 if (oHelp != null) 168 { 169 if (oHelp.style.display == 'none') 170 oHelp.style.display = ''; 171 else 172 oHelp.style.display = 'none'; 173 174 return true; //cancel postback 175 } 176 return false; //failed so do postback 177} 178 179function __dnn_SectionMaxMin(oBtn, sContentID) 180{ 181 var oContent = dnn.dom.getById(sContentID); 182 if (oContent != null) 183 { 184 var sMaxIcon = oBtn.getAttribute('max_icon'); 185 var sMinIcon = oBtn.getAttribute('min_icon'); 186 var bCallback = oBtn.getAttribute('userctr') != null; 187 var sVal; 188 if (oContent.style.display == 'none') 189 { 190 oBtn.src = sMinIcon; 191 oContent.style.display = ''; 192 if (bCallback) 193 sVal = 'True'; 194 else 195 dnn.setVar(oBtn.id + ':exp', 1); 196 } 197 else 198 { 199 oBtn.src = sMaxIcon; 200 oContent.style.display = 'none'; 201 if (bCallback) 202 sVal = 'False'; 203 else 204 dnn.setVar(oBtn.id + ':exp', 0); 205 } 206 if (bCallback) 207 dnncore.setUserProp(oBtn.getAttribute('userctr'), oBtn.getAttribute('userkey'), sVal, null); 208 return true; //cancel postback 209 } 210 return false; //failed so do postback 211} 212 213//Drag N Drop 214function __dnn_enableDragDrop() 215{ 216 var aryConts = dnn.getVar('__dnn_dragDrop').split(";"); 217 var aryTitles; 218 219 for (var i=0; i < aryConts.length; i++) 220 { 221 aryTitles = aryConts[i].split(" "); 222 if (aryTitles[0].length > 0) 223 { 224 var oCtr = dnn.dom.getById(aryTitles[0]); 225 var oTitle = dnn.dom.getById(aryTitles[1]); 226 if (oCtr != null && oTitle != null) 227 { 228 oCtr.setAttribute('moduleid', aryTitles[2]); 229 dnn.dom.positioning.enableDragAndDrop(oCtr, oTitle, '__dnn_dragComplete()', '__dnn_dragOver()'); 230 } 231 } 232 } 233} 234 235var __dnn_oPrevSelPane; 236var __dnn_oPrevSelModule; 237var __dnn_dragEventCount=0; 238function __dnn_dragOver() 239{ 240 __dnn_dragEventCount++; 241 if (__dnn_dragEventCount % 75 != 0) //only calculate position every 75 events 242 return; 243 244 var oCont = dnn.dom.getById(dnn.dom.positioning.dragCtr.contID); 245 246 var oPane = __dnn_getMostSelectedPane(dnn.dom.positioning.dragCtr); 247 248 if (__dnn_oPrevSelPane != null) //reset previous pane's border 249 __dnn_oPrevSelPane.pane.style.border = __dnn_oPrevSelPane.origBorder; 250 251 if (oPane != null) 252 { 253 __dnn_oPrevSelPane = oPane; 254 oPane.pane.style.border = '4px double ' + DNN_HIGHLIGHT_COLOR; 255 var iIndex = __dnn_getPaneControlIndex(oCont, oPane); 256 257 var oPrevCtl; 258 var oNextCtl; 259 for (var i=0; i<oPane.controls.length; i++) 260 { 261 if (iIndex > i && oPane.controls[i].id != oCont.id) 262 oPrevCtl = oPane.controls[i]; 263 if (iIndex <= i && oPane.controls[i].id != oCont.id) 264 { 265 oNextCtl = oPane.controls[i]; 266 break; 267 } 268 } 269 270 if (__dnn_oPrevSelModule != null) 271 dnn.dom.getNonTextNode(__dnn_oPrevSelModule.control).style.border = __dnn_oPrevSelModule.origBorder; 272 273 274 if (oNextCtl != null) 275 { 276 __dnn_oPrevSelModule = oNextCtl; 277 dnn.dom.getNonTextNode(oNextCtl.control).style.borderTop = '5px groove ' + DNN_HIGHLIGHT_COLOR; 278 } 279 else if (oPrevCtl != null) 280 { 281 __dnn_oPrevSelModule = oPrevCtl; 282 dnn.dom.getNonTextNode(oPrevCtl.control).style.borderBottom = '5px groove ' + DNN_HIGHLIGHT_COLOR; 283 } 284 } 285} 286 287function __dnn_dragComplete() 288{ 289 var oCtl = dnn.dom.getById(dnn.dom.positioning.dragCtr.contID); 290 var sModuleID = oCtl.getAttribute('moduleid'); 291 292 if (__dnn_oPrevSelPane != null) 293 __dnn_oPrevSelPane.pane.style.border = __dnn_oPrevSelPane.origBorder; 294 295 if (__dnn_oPrevSelModule != null) 296 dnn.dom.getNonTextNode(__dnn_oPrevSelModule.control).style.border = __dnn_oPrevSelModule.origBorder; 297 298 var oPane = __dnn_getMostSelectedPane(dnn.dom.positioning.dragCtr); 299 var iIndex; 300 if (oPane == null) 301 {
302 var oPanes = __dnn_Panes(); 303 for (var i=0; i<oPanes.length; i++) 304 { 305 if (oPanes[i].id == oCtl.parentNode.id) 306 oPane = oPanes[i]; 307 } 308 } 309 if (oPane != null) 310 { 311 iIndex = __dnn_getPaneControlIndex(oCtl, oPane); 312 __dnn_MoveToPane(oPane, oCtl, iIndex); 313 314 dnn.callPostBack('MoveToPane', 'moduleid=' + sModuleID, 'pane=' + oPane.paneName, 'order=' + iIndex * 2); 315 } 316} 317 318function __dnn_MoveToPane(oPane, oCtl, iIndex) 319{ 320 321 if (oPane != null) 322 { 323 var aryCtls = new Array(); 324 for (var i=iIndex; i<oPane.controls.length; i++) 325 { 326 if (oPane.controls[i].control.id != oCtl.id) 327 aryCtls[aryCtls.length] = oPane.controls[i].control; 328 329 dnn.dom.removeChild(oPane.controls[i].control); 330 } 331 dnn.dom.appendChild(oPane.pane, oCtl); 332 oCtl.style.top=0; 333 oCtl.style.left=0; 334 oCtl.style.position = 'relative'; 335 for (var i=0; i<aryCtls.length; i++) 336 { 337 dnn.dom.appendChild(oPane.pane, aryCtls[i]); 338 } 339 __dnn_RefreshPanes(); 340 } 341 else 342 { 343 oCtl.style.top=0; 344 oCtl.style.left=0; 345 oCtl.style.position = 'relative'; 346 } 347} 348 349function __dnn_RefreshPanes() 350{ 351 var aryPanes = dnn.getVar('__dnn_Panes').split(';'); 352 var aryPaneNames = dnn.getVar('__dnn_PaneNames').split(';'); 353 __dnn_m_aryPanes = new Array(); 354 for (var i=0; i<aryPanes.length; i++) 355 { 356 if (aryPanes[i].length > 0) 357 __dnn_m_aryPanes[__dnn_m_aryPanes.length] = new __dnn_Pane(dnn.dom.getById(aryPanes[i]), aryPaneNames[i]); 358 } 359} 360 361var __dnn_m_aryPanes; 362var __dnn_m_aryModules; 363function __dnn_Panes() 364{ 365 if (__dnn_m_aryPanes == null) 366 { 367 __dnn_m_aryPanes = new Array(); 368 __dnn_RefreshPanes(); 369 } 370 return __dnn_m_aryPanes; 371} 372 373function __dnn_Modules(sModuleID) 374{ 375 if (__dnn_m_aryModules == null) 376 __dnn_RefreshPanes(); 377 378 return __dnn_m_aryModules[sModuleID]; 379} 380 381function __dnn_getMostSelectedPane(oContent) 382{ 383 var oCDims = new dnn.dom.positioning.dims(oContent); 384 var iTopScore=0; 385 var iScore; 386 var oTopPane; 387 for (var i=0; i<__dnn_Panes().length; i++) 388 { 389 var oPane = __dnn_Panes()[i]; 390 var oPDims = new dnn.dom.positioning.dims(oPane.pane); 391 iScore = dnn.dom.positioning.elementOverlapScore(oPDims, oCDims); 392 393 if (iScore > iTopScore) 394 { 395 iTopScore = iScore; 396 oTopPane = oPane; 397 } 398 } 399 return oTopPane; 400} 401 402function __dnn_getPaneControlIndex(oContent, oPane) 403{ 404 if (oPane == null) 405 return; 406 var oCDims = new dnn.dom.positioning.dims(oContent); 407 var oCtl; 408 if (oPane.controls.length == 0) 409 return 0; 410 for (var i=0; i<oPane.controls.length; i++) 411 { 412 oCtl = oPane.controls[i]; 413 var oIDims = new dnn.dom.positioning.dims(oCtl.control); 414 if (oCDims.t < oIDims.t) 415 return oCtl.index; 416 } 417 if (oCtl != null) 418 return oCtl.index+1; 419 else 420 return 0; 421} 422 423//Objects 424function __dnn_Pane(ctl, sPaneName) 425{ 426 this.pane = ctl; 427 this.id = ctl.id; 428 this.controls = new Array(); 429 this.origBorder = ctl.style.border; 430 this.paneName = sPaneName; 431 432 var iIndex = 0; 433 var strModuleOrder=''; 434 for (var i=0; i<ctl.childNodes.length; i++) 435 { 436 var oNode = ctl.childNodes[i]; 437 if (dnn.dom.isNonTextNode(oNode)) 438 { 439 if (__dnn_m_aryModules == null) 440 __dnn_m_aryModules = new Array(); 441 442 //if (oNode.tagName == 'A' && oNode.childNodes.length > 0) 443 // oNode = oNode.childNodes[0]; //DNN now embeds anchor tag 444 445 var sModuleID = oNode.getAttribute('moduleid'); 446 if (sModuleID != null && sModuleID.length > 0) 447 { 448 strModuleOrder += sModuleID + '~'; 449 this.controls[this.controls.length] = new __dnn_PaneControl(oNode, iIndex); 450 __dnn_m_aryModules[sModuleID] = oNode.id; 451 iIndex+=1; 452 } 453 } 454 } 455 this.moduleOrder = strModuleOrder; 456 457} 458 459function __dnn_PaneControl(ctl, iIndex) 460{ 461 this.control = ctl; 462 this.id = ctl.id; 463 this.index = iIndex; 464 this.origBorder = ctl.style.border; 465 466} 467 468//move towards dnncore ns. right now only for personalization 469function __dnncore() 470{ 471 this.GetUserVal = 0; 472 this.SetUserVal = 1; 473} 474 475__dnncore.prototype = { 476getUserProp: function(sNameCtr, sKey, pFunc) { 477 this._doUserCallBack(dnncore.GetUserVal, sNameCtr, sKey, null, new dnncore.UserPropArgs(sNameCtr, sKey, pFunc)); 478}, 479 480setUserProp: function(sNameCtr, sKey, sVal, pFunc) { 481 this._doUserCallBack(dnncore.SetUserVal, sNameCtr, sKey, sVal, new dnncore.UserPropArgs(sNameCtr, sKey, pFunc)); 482}, 483 484_doUserCallBack: function(iType, sNameCtr, sKey, sVal, pFunc) { 485 if (dnn && dnn.xmlhttp) 486 { 487 var sPack = iType + COL_DELIMITER + sNameCtr + COL_DELIMITER + sKey + COL_DELIMITER + sVal; 488 dnn.xmlhttp.doCallBack('__Page',sPack,dnncore._callBackSuccess,pFunc,dnncore._callBackFail,null,true,null,0); 489 } 490 else 491 alert('Client Personalization not enabled'); 492}, 493 494_callBackSuccess: function (result, ctx, req) { 495 if (ctx.pFunc)
496 ctx.pFunc(ctx.namingCtr, ctx.key, result); 497}, 498 499_callBackFail: function (result, ctx) { 500 window.status = result; 501} 502} 503 504__dnncore.prototype.UserPropArgs = function(sNameCtr, sKey, pFunc) 505{ 506 this.namingCtr = sNameCtr; 507 this.key = sKey; 508 this.pFunc = pFunc; 509} 510 511var dnncore = new __dnncore();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.