var pageTextMode; var adminMode; var styleElementsMode; var adminHelpMode; var saveImgClass; var pages; var activeStyleEle; var activeEle; var activeSection; var activeStyleAttrib; var cssMap=""; var ajaxResp; var saveHoverVal; var viewerClicked="false"; var currentTheme; var themeAction; var newCss; var pubOrAdmin; var a_handle="top,left,position,z-index"; var a_indexPageImg="visibility,top,left,width,src,border-all,z-index"; var a_loginPageImg="visibility,top,left,width,src,border-all,z-index"; var a_floatImg="visibility,top,left,width,src,border-all,position,z-index"; var a_bar="visibility,top,left,width,height,background-image,background-repeat,background-color,border-all,position,z-index"; var a_text="visibility,top,left,width,height,background-color,foreground-color,border-all,position,z-index"; var a_video="visibility,top,left,width,border-all,position,z-index"; var a_dataBlock="visibility,top,left,width,font-family,font-size,border-all,z-index"; var a_title="visibility,top,left,width,foreground-color,font-size,font-family,border-all,z-index"; var a_body="background-image,background-repeat,background-color"; var a_headerContainer="top,left,height,width,background-image,background-repeat,background-color,border-all"; var a_contentContainer="top,left,width,background-image,background-repeat,background-color,foreground-color,border-all"; var a_pageContainer="width"; var a_footerContainer="top,left,width,background-image,background-repeat,background-color,border-top"; var a_mainMenuContainer="top,left,background-color,foreground-color,border-all,separator"; var a_mainMenuItemSeparator="visibility"; var a_scroller="visibility,top,left,width,background-color,foreground-color,border-all,z-index"; /* prototypes */ String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } String.prototype.endsWith = function(suffix) { return (this.substr(this.length - suffix.length) === suffix); } String.prototype.startsWith = function(prefix) { return (this.substr(0, prefix.length) === prefix); } String.prototype.contains = function(prefix) { if (this.indexOf(prefix)>-1){return true;} else{return false;} } /* prototypes */ function rand2(maxVal,floatVal) /* if floatVal isn't supplied, we get an integer */ { var randVal = Math.random()*maxVal; var val=typeof floatVal=='undefined'?Math.round(randVal):randVal.toFixed(floatVal); return (val>0?val:1); } function rand(minV, maxV) { var range=maxV-minV+1; return Math.floor(Math.random()*range+minV); } dojo.addOnLoad(function(){ adminMode="Off"; currentTheme="Vestaburg Initial Theme"; if (currentTheme.substring(0,1)=="."){ if(dojo.byId("saveAttribsButton")!=null){ dojo.byId("saveAttribsButton").value="Protected Theme"; } } if (dojo.byId("indexPage")!=null){ $("#indexPageImg").css("display","inline"); $("#scroller").css("display","inline"); $("#dataBlock").css("display","inline"); } if (dojo.byId("loginPage")!=null){ $("#loginPageImg").css("display","inline"); } }); function showWait(){ $("#waitBoxWrap").css("visibility","visible"); $("#waitBox").css("visibility","visible"); } function hideWait(){ $("#waitBoxWrap").css("visibility","hidden"); $("#waitBox").css("visibility","hidden"); } /* * This a private function used only to set specific values to some * default values prior to loading their actual values from a CSS object. * * Used only when previewing themes. */ function firstClear(){ $("#contentContainer").css("width","870px"); $("#pageContainer").css("width","630px"); $("#footerContainer").css("width","900px"); $("#dataBlock").css("width","300px"); $(".hasBgImg").css("background-image","url(http://my2ws.com/images/private/trans10x10.gif)"); $(".hasBgImg").css("background-repeat","no-repeat"); $(".hasBgImg").css("background-color","Transparent"); $(".hasBgImg").css("border","0px solid"); $("#mainMenuContainer").css("background-color","Transparent"); $("#mainMenuContainer").css("border","0px solid"); $(".boxHeader").css("background-color","Transparent"); $("#title").css("font-family","Arial"); $("#title").css("width","800px"); $("#title").css("top","10px"); $("#title").css("left","30px"); $("#title").css("font-size","48px"); $("#title").css("visibility","visible"); $("#subTitle").css("font-family","Arial"); $("#subTitle").css("width","400px"); $("#subTitle").css("top","55px"); $("#subTitle").css("left","300px"); $("#subTitle").css("font-size","20px"); $("#subTitle").css("visibility","visible"); $("#dataBlock").css("font-family","Arial"); $("#dataBlock").css("top","160px"); $("#dataBlock").css("left","500px"); $("#dataBlock").css("font-size","14px"); $("#dataBlock").css("line-height","1.2em"); $(".hideit").css("visibility","hidden"); $(".hideit").css("background-color","transparent"); $(".hideit").css("background-repeat","no-repeat"); $(".hideit").css("position","fixed"); $(".hideit").css("top","-999"); $(".hideit").css("left","-999"); $(".hideit").css("border","0px solid"); $(".hideit").css("border-color","transparent"); $("#loginPageImg").css("width","150px"); $("#loginPageImg").css("top","130px"); $("#loginPageImg").css("left","500px"); $("#indexPageImg").css("width","300px"); $("#indexPageImg").css("top","30px"); $("#indexPageImg").css("left","300px"); separatorOff(); } /* Used only when previewing themes */ function loadCssObjects(cssStr){ firstClear(); var objs = cssStr.split("}"); for (var ii in objs){ if (typeof objs[0] != 'undefined' && typeof objs[1] != 'undefined'){ var eachObj = objs[ii].split("{"); for (var jj in eachObj){ if (eachObj[0].substr(0,4) == "#nav"){continue;} if (typeof eachObj[0] != 'undefined' && typeof eachObj[1] != 'undefined'){ var attrib = eachObj[1].split(";"); for (var hh in attrib){ if (typeof attrib[hh] != 'undefined' && typeof attrib[1] != 'undefined'){ var sel = attrib[hh].split(":"); if (typeof sel[0] != 'undefined' && typeof sel[1] != 'undefined'){ for (var kk in sel){ var selecter = sel[0]; var valu = sel[1]; if (selecter == "background-color"){ activeStyleEle=eachObj[0].replace("#",""); setBgColorStyle(valu) } if (selecter == "width"){ $(eachObj[0]).css("width",valu); } if (selecter == "height"){ $(eachObj[0]).css("height",valu); } if (selecter == "color"){ activeStyleEle=eachObj[0].replace("#",""); setFgColorStyle(valu) } if (selecter == "left"){ $(eachObj[0]).css("left",valu); } if (selecter == "top"){ $(eachObj[0]).css("top",valu); } if (selecter == "position"){ $(eachObj[0]).css("position",valu); } if (selecter == "background-repeat"){ $(eachObj[0]).css("backgroundRepeat",valu); } if (selecter == "visibility"){ $(eachObj[0]).css("visibility",valu); } if (selecter == "display"){ $(eachObj[0]).css("display",valu); } if (selecter == "border"){ activeStyleEle=eachObj[0].replace("#",""); setBorder(valu) } if (selecter == "font-family"){ $(eachObj[0]).css("font-family",valu); } if (selecter == "src"){ activeStyleEle=eachObj[0].replace("#",""); setImgStyle(valu.replace("http~","http:")); } if (selecter == "background-image"){ activeStyleEle=eachObj[0].replace("#",""); setImgStyle(valu.replace("url(http~","http:").replace(")","")); } } } } } } } } } if ($("#mainMenuItemSeparator").css("visibility")=="visible"){ separatorOn(); } } function makeMap(ele,attribs){ var obj=document.getElementById(ele); if (obj==null) { return }; if (ele=='undefined'){ return }; cssMap=cssMap+"#"+ele+"{"; if (attribs.indexOf("src") > -1){ /* src must be found with javascript, not css */ if (document.getElementById(ele).src.indexOf("images") > -1){ cssMap=cssMap+"src:"+document.getElementById(ele).src+";"; } } if (attribs.indexOf("background-image") > -1){ cssMap=cssMap+"background-image:"+$("#"+ele).css("background-image")+";"; } if (attribs.indexOf("position") > -1){ cssMap=cssMap+"position:"+$("#"+ele).css("position")+";"; } if (attribs.indexOf("background-repeat") > -1){ cssMap=cssMap+"background-repeat:"+$("#"+ele).css("background-repeat")+";"; } if (attribs.indexOf("foreground-color") > -1){ cssMap=cssMap+"color:"+getHexColor($("#"+ele).css("color"))+";"; } if (attribs.indexOf("background-color") > -1){ cssMap=cssMap+"background-color:"+getHexColor($("#"+ele).css("background-color"))+";"; } if (attribs.indexOf("left") > -1){ cssMap=cssMap+"left:"+$("#"+ele).css("left")+";"; } if (attribs.indexOf("top") > -1){ cssMap=cssMap+"top:"+$("#"+ele).css("top")+";"; } if (attribs.indexOf("border-all") > -1){ cssMap=cssMap+"border:"+$("#"+ele).css("border-top-style")+" "+$("#"+ele).css("border-top-width")+" "+getHexColor($("#contentContainer").css("border-top-color"))+";"; } if (attribs.indexOf("border-top") > -1){ cssMap=cssMap+"border-top:"+$("#"+ele).css("border-top-style")+" "+$("#"+ele).css("border-top-width")+" "+getHexColor($("#contentContainer").css("border-top-color"))+";"; } if (attribs.indexOf("font-family") > -1){ cssMap=cssMap+"font-family:"+$("#"+ele).css("font-family")+";"; } if (attribs.indexOf("font-size") > -1){ cssMap=cssMap+"font-size:"+$("#"+ele).css("font-size")+";"; } if (attribs.indexOf("width") > -1){ cssMap=cssMap+"width:"+$("#"+ele).css("width")+";"; } if (attribs.indexOf("height") > -1){ cssMap=cssMap+"height:"+$("#"+ele).css("height")+";"; } if (attribs.indexOf("visibility") > -1){ cssMap=cssMap+"visibility:"+$("#"+ele).css("visibility")+";"; } if (attribs.indexOf("z-index") > -1){ cssMap=cssMap+"z-index:"+$("#"+ele).css("z-index")+";"; } cssMap=cssMap+"}"; } /* The following are set based on some other value or element */ function setOthers(){ cssMap=cssMap+".boxHeader{color:"+getHexColor($("#title").css("color"))+";background-color:"+getHexColor($("#headerContainer").css("background-color"))+";border-color:"+getHexColor($("#contentContainer").css("color"))+";}"; cssMap=cssMap+"#dataBlock{color:"+getHexColor($("#contentContainer").css("color"))+";}"; cssMap=cssMap+"#userPage table tr th{color:"+getHexColor($("#title").css("color"))+";background-color:"+getHexColor($("#headerContainer").css("background-color"))+";}"; cssMap=cssMap+"#scroller{border-color:"+getHexColor($("#scroller").css("color"))+";}"; if ($("#mainMenuItemSeparator").css("visibility")=="visible"){ cssMap=cssMap+"#mainMenuContainer #flyoutMenu #nav .mainMenuLi{border-left:2px solid;border-right:2px solid;margin-left:-2px;}"; } else{ cssMap=cssMap+"#mainMenuContainer #flyoutMenu #nav .mainMenuLi{border-left:0px solid;border-right:0px solid;margin-left:0px;}"; } /* navigation menu */ /* the 'mainContainer' constrains the width of the navigation menu. So, set that container's * width to the greater of either headerContainer or contentContainer. */ var headWid=parseInt($('#headerContainer').css('width').replace("px","")); var headLft=parseInt($('#headerContainer').css('left').replace("px","")); var contWid=parseInt($('#contentContainer').css('width').replace("px","")); var contLft=parseInt($('#contentContainer').css('left').replace("px","")); var headTot=headWid+headLft; var contTot=contWid+contLft; var wid=(headTot>contTot?headTot:contTot)+40; cssMap=cssMap+"#mainContainer{width:"+wid+"px;}"; cssMap=cssMap+"#nav li ul:visited,#nav a:visited,#nav li ul a:visited,#nav,#nav li ul a,#nav a,#nav li ul{background-color:"+getHexColor($("#mainMenuContainer").css("background-color"))+";}"; cssMap=cssMap+"#nav li ul:visited,#nav a:visited,#nav li ul a:visited,#nav,#nav li ul a,#nav a,#nav li ul{color:"+getHexColor($("#mainMenuContainer").css("color"))+";}"; cssMap=cssMap+"#nav li ul:hover,#nav a:hover,#nav a:visited:hover,#nav li ul a:hover,#nav li ul a:visited:hover,#nav a:hover,#nav a:visited:hover{background-color:"+getHexColor($("#mainMenuContainer").css("color"))+";}"; cssMap=cssMap+"#nav li ul:hover,#nav a:hover,#nav a:visited:hover,#nav li ul a:hover,#nav li ul a:visited:hover,#nav a:hover,#nav a:visited:hover{color:"+getHexColor($("#mainMenuContainer").css("background-color"))+";}"; cssMap=cssMap+"#nav li ul{border-color:"+getHexColor($("#mainMenuContainer").css("color"))+";}"; /* set other links to complement the main navigation menu */ /* non-hover */ cssMap=cssMap+".credits,.credits:visited,#contentContainer a,#contentContainer a:visited,"+ "#messageContainer a,#messageContainer a:visited,#pageContainer a,"+ "#pageContainer a:visited,#extLinksContainer a,#extLinksContainer a:visited,"+ "#extLinksContainer a:visited"+ "{color:"+getHexColor($("#contentContainer").css("color"))+";}"; /* hovering */ cssMap=cssMap+".credits:hover,#contentContainer a:hover,"+ "#messageContainer a:hover,#pageContainer a:hover,#extLinksContainer a:hover,"+ ".credits:visited:hover,#contentContainer a:visited:hover,"+ "#messageContainer a:visited:hover,#pageContainer a:visited:hover,"+ "#extLinksContainer a:visited:hover"+ "{color:"+getHexColor($("#mainMenuContainer").css("background-color"))+";"+ "background-color:"+getHexColor($("#mainMenuContainer").css("color"))+";}"; } function saveAttribs(){ if (currentTheme.substring(0,1)=="."){ alert("You cannot save a protected theme... use Theme > 'Save As' first."); return; } showWait(); makeMap("body",a_body); makeMap("headerContainer",a_headerContainer); makeMap("contentContainer",a_contentContainer); makeMap("pageContainer",a_pageContainer); makeMap("footerContainer",a_footerContainer); makeMap("mainMenuContainer",a_mainMenuContainer); makeMap("mainMenuItemSeparator",a_mainMenuItemSeparator); makeMap("title",a_title); makeMap("subTitle",a_title); makeMap("loginPageImg",a_loginPageImg); makeMap("indexPageImg",a_indexPageImg); makeMap("dataBlock",a_dataBlock); makeMap("scroller",a_scroller); makeMap("video1",a_video); makeMap("video2",a_video); makeMap("indexPageImgHdl",a_handle); makeMap("loginPageImgHdl",a_handle); makeMap("floatImg1Hdl",a_handle); makeMap("floatImg2Hdl",a_handle); makeMap("floatImg3Hdl",a_handle); makeMap("floatImg4Hdl",a_handle); makeMap("floatImg5Hdl",a_handle); makeMap("floatImg6Hdl",a_handle); makeMap("floatImg1",a_floatImg); makeMap("floatImg2",a_floatImg); makeMap("floatImg3",a_floatImg); makeMap("floatImg4",a_floatImg); makeMap("floatImg5",a_floatImg); makeMap("floatImg6",a_floatImg); makeMap("bar1",a_bar); makeMap("bar2",a_bar); makeMap("bar3",a_bar); makeMap("bar4",a_bar); makeMap("bar5",a_bar); makeMap("bar6",a_bar); makeMap("text1",a_text); makeMap("text2",a_text); makeMap("text3",a_text); makeMap("text4",a_text); // makeMap("hyperLinks",a_); setOthers(); /* Need to use Post here since the string is too long for 'get' sometimes. */ $("#cssMapText").html(cssMap); // console.log($("#cssMapText").html()); ajaxPost("updateTheme"); window.location.reload(); } function moveableOn() { $(".movable").draggable({ disabled:false }); $("#mainMenuContainerHandle").css("border","6px solid"); $("#mainMenuContainerHandle").css("visibility","visible"); toggleAdmin(); hidePropsViewer(); $("#saveAttribsButton").css("visibility","visible"); $( ".resizable" ).resizable({ disabled:false,handles:"e,s,se",aspectRatio:false,helper:"ui-resizable-helper" }); $( "#scroller" ).resizable({ disabled:false,handles:"e,se",maxHeight:20,helper:"ui-resizable-helper" }); $( "#title" ).resizable({ disabled:false,handles:"e,se",maxHeight:40,helper:"ui-resizable-helper" }); $( "#subTitle" ).resizable({ disabled:false,handles:"e,se",maxHeight:20,helper:"ui-resizable-helper" }); $( "#contentContainer" ).resizable({ disabled:false,handles:"e",minWidth:500,maxWidth:1200,helper:"ui-resizable-helper" }); $( "#contentContainer" ).resizable( "option", "alsoResize", '#pageContainer' ); $( "#indexPageImgHdl" ).resizable({ disabled:false,handles:"e,s,se",aspectRatio:true,helper:"ui-resizable-helper" }); $( "#indexPageImgHdl" ).resizable( "option", "alsoResize", '#indexPageImg' ); $( "#loginPageImgHdl" ).resizable({ disabled:false,handles:"e,s,se",aspectRatio:true,helper:"ui-resizable-helper" }); $( "#loginPageImgHdl" ).resizable( "option", "alsoResize", '#loginPageImg' ); $( "#floatImg1Hdl" ).resizable({ disabled:false,handles:"e,s,se",aspectRatio:true,helper:"ui-resizable-helper" }); $( "#floatImg1Hdl" ).resizable( "option", "alsoResize", '#floatImg1' ); $( "#floatImg2Hdl" ).resizable({ disabled:false,handles:"e,s,se",aspectRatio:true,helper:"ui-resizable-helper" }); $( "#floatImg2Hdl" ).resizable( "option", "alsoResize", '#floatImg2' ); $( "#floatImg3Hdl" ).resizable({ disabled:false,handles:"e,s,se",aspectRatio:true,helper:"ui-resizable-helper" }); $( "#floatImg3Hdl" ).resizable( "option", "alsoResize", '#floatImg3' ); $( "#floatImg4Hdl" ).resizable({ disabled:false,handles:"e,s,se",aspectRatio:true,helper:"ui-resizable-helper" }); $( "#floatImg4Hdl" ).resizable( "option", "alsoResize", '#floatImg4' ); $( "#floatImg5Hdl" ).resizable({ disabled:false,handles:"e,s,se",aspectRatio:true,helper:"ui-resizable-helper" }); $( "#floatImg5Hdl" ).resizable( "option", "alsoResize", '#floatImg5' ); $( "#floatImg6Hdl" ).resizable({ disabled:false,handles:"e,s,se",aspectRatio:true,helper:"ui-resizable-helper" }); $( "#floatImg6Hdl" ).resizable( "option", "alsoResize", '#floatImg6' ); if (dojo.byId("indexPage")!=null){ $("#indexPageImgHdl").css("visibility",$("#indexPageImg").css("visibility")); } else{ $("#indexPageImgHdl").css("visibility","hidden"); } if (dojo.byId("loginPage")!=null){ $("#loginPageImgHdl").css("visibility",$("#loginPageImg").css("visibility")); } else{ $("#loginPageImgHdl").css("visibility","hidden"); } $("#floatImg1Hdl").css("visibility",$("#floatImg1").css("visibility")); $("#floatImg2Hdl").css("visibility",$("#floatImg2").css("visibility")); $("#floatImg3Hdl").css("visibility",$("#floatImg3").css("visibility")); $("#floatImg4Hdl").css("visibility",$("#floatImg4").css("visibility")); $("#floatImg5Hdl").css("visibility",$("#floatImg5").css("visibility")); $("#floatImg6Hdl").css("visibility",$("#floatImg6").css("visibility")); } function toggleAdminHelp() { if (adminHelpMode != "On") { adminHelpMode="On"; $("#adminHelpButton").html(""); var pName=window.location.pathname.substring(window.location.pathname.lastIndexOf("/")); $("#adminHelpBox").html(eval(pName.substring(1,pName.indexOf(".")))); } else { adminHelpMode="Off"; $("#styleMenu").css("visibility","hidden"); $("#adminHelpButton").html(""); $("#adminHelpBox").css("visibility","hidden"); } } function toggleAdmin() { if (adminMode == "On") { adminMode="Off"; propsMode="Off"; styleElementsMode="Off"; $("#adminButton").html(""); $("#colorViewer").css("visibility","hidden"); $("#genViewer").css("visibility","hidden"); $("#genViewerHandle").css("visibility","hidden"); $("#helpBox").css("visibility","hidden"); $("#styleMenu").css("visibility","hidden"); $(".editWindow").css("visibility","hidden"); styleElementsMode="On"; pageTextMode="On"; } else { adminMode="On"; $("#adminButton").html(""); $("#helpBox").html(adminOnMsg); $("#styleMenu").css("visibility","visible"); if (dojo.byId("loginPage")==null){ $('#loginPageStyleMenu').hide(); } if (dojo.byId("indexPage")==null){ $('#indexPageImgMenu').hide(); $('#indexPageDataMenu').hide(); $('#indexPageScrollerMenu').hide(); } if (dojo.byId("userPage")==null){ $('#userPageStyleMenu').hide(); } } } function promptTheme(action,sourceTheme){ hidePropsViewer(); if (action=="saveAs"){ var val=prompt("Save As... (3 to 45 characters)","Enter name to Save As"); val=val.trim(); if ( val!=null){ if (val.length<3){ alert("Theme must be at least 3 characters."); return; } ajaxGet("isAvailable&theme="+val); if (ajaxResp!='yes'){ alert("Theme name '"+val+"' is already in use. You must provide a unique name."); return; } ajaxGet("saveThemeAs&newName="+val+"&theme="+sourceTheme); window.location.reload(); } } else if (action=="rename"){ var val=prompt("Rename Current Theme to... (3 to 45 characters)","Enter name to Save As"); val=val.trim(); if ( val!=null){ if (val.length<3){ alert("Theme must be at least 3 characters."); return; } ajaxGet("isAvailable&theme="+val); if (ajaxResp!="yes"){ alert("Theme name '"+val+"' is already in use. You must provide a unique name."); return; } ajaxGet("renameTheme&newName="+val); window.location.reload(); } } else if (action=="select"){ $("#adminButton").html(""); $("#adminToggleButton").css("width","360px"); $("#saveAttribsButton").css("visibility","hidden"); $("#adminButtonHandle").css("visibility","hidden"); $("#styleMenu").css("visibility","hidden"); themeAction="setTheme"; pubOrAdmin="public"; ajaxGet("listThemes&purpose=public"); $("#gViewer").html(ajaxResp); $("#genViewerHandle").css("visibility","visible"); $("#genViewer").css("visibility","visible"); hideWait(); } else if (action=="selectAdmin"){ $("#adminButton").html(""); $("#adminToggleButton").css("width","360px"); $("#saveAttribsButton").css("visibility","hidden"); $("#adminButtonHandle").css("visibility","hidden"); $("#styleMenu").css("visibility","hidden"); themeAction="setTheme"; pubOrAdmin="admin"; ajaxGet("listThemes&purpose=admin"); $("#gViewer").html(ajaxResp); $("#genViewer").css("visibility","visible"); $("#genViewerHandle").css("visibility","visible"); $("#genViewer").css("visibility","visible"); hideWait(); } else if (action=="selectInitial"){ $("#realTxt").hide(); $("#ipsumTxt").show(); var ttl=$("#newSiteName").html(); $("#title").html(ttl); var stl=$("#newSiteSubtitle").html(); $("#subTitle").html(stl); themeAction="setInitialTheme"; pubOrAdmin="admin"; ajaxGet("listThemes&purpose=system"); $("#gViewer").html(ajaxResp); $("#genViewerContainer").css("top","160px"); $("#genViewerContainer").css("left","730px"); $("#genViewer").css("width","200px"); $("#genViewer").css("height","300px"); $("#genViewerHandle").css("width","175px"); $("#genViewer").css("visibility","visible"); $("#genViewerHandle").css("visibility","visible"); $("#genViewer").css("visibility","visible"); hideWait(); } else if (action=="delete"){ themeAction="deleteTheme"; ajaxGet("listThemes&purpose=delete"); $("#gViewer").html(ajaxResp); $("#genViewer").css("visibility","visible"); $("#genViewerHandle").css("visibility","visible"); $("#genViewer").css("visibility","visible"); hideWait(); } } function checkMenuItemName(action){ var val=document.getElementById("newMenuItemName"); ajaxGet("menuItemExists&menuItemName="+val.value); if (ajaxResp=="yes"){ alert("Menu Item Name '"+val.value+"' is already in use. You must provide a unique name."); hideWait(); return; } setMenuItem(action); } function themeHoverAction(theme){ $("#styleMenu").css("visibility","hidden"); ajaxGet("getThemeByName&theme="+theme); loadCssObjects(ajaxResp); if (themeAction=='setInitialTheme'){ $("#initialTheme").val(theme); } } function themeOutAction(theme){ if (viewerClicked=='true'){return;} } function themeClickAction(theme){ viewerClicked='true'; if (themeAction=='deleteTheme'){ var r=confirm("Are you certain you want to delete '"+theme+"'? This cannot be undone."); if (r!=true){ $("#genViewer").css("visibility","hidden"); $("#genViewerHandle").css("visibility","hidden"); return; } showWait(); ajaxGet("deleteTheme&theme="+theme); window.location.reload(); } else { if (themeAction=='setInitialTheme'){ $("#initialTheme").val(theme); setHidden("genViewer"); return; } // invoke for all other actions (now just select and selectAdmin) // if this is a system theme, prompt to saveAs else { if (theme.startsWith('.Theme_')){ promptTheme('saveAs',theme); return; } } showWait(); ajaxGet("setTheme&theme="+theme+"&pubOrAdmin="+pubOrAdmin); window.location.reload(); } } function hidePropsViewer(){ $("#spn").css("visibility","hidden"); $("#propsViewer").css("visibility","hidden"); } function setHidden(ele){ $("#"+ele).css("visibility","hidden"); if (ele=="genViewer"){ $("#genViewerHandle").css("visibility","hidden"); } if (themeAction=="setInitialTheme"){ $("#ipsumTxt").hide(); $("#realTxt").show(); } else if (ele=="styleMenu"){ toggleAdmin(); } if (ele!="propsViewer" && ele!="styleMenu" ){ getProps(activeStyleEle); } } function setPositionStyle(position){ if (activeStyleEle.startsWith("floatImg") || activeStyleEle=="loginPageImg" || activeStyleEle=="indexPageImg"){ $("#"+activeStyleEle+"Hdl").css("position",position); } else{ $("#"+activeStyleEle).css("position",position); } } function setRepeatStyle(repeat){ $("#"+activeStyleEle).css("backgroundRepeat",repeat); } function repeatHoverAction(repeat){ setRepeatStyle(repeat); } function repeatOutAction(repeat){ if (viewerClicked=="true"){return;} setRepeatStyle(saveHoverVal); } function repeatClickAction(repeat){ viewerClicked="true"; setRepeatStyle(repeat); $("#genViewer").css("visibility","hidden"); $("#genViewerHandle").css("visibility","hidden"); getProps(activeStyleEle); } /* fontFamily */ function setFontFamStyle(fontFam){ $("#"+activeStyleEle).css("fontFamily",fontFam); } function fontFamHoverAction(fontFam){ setFontFamStyle(fontFam); } function fontFamOutAction(fontFam){ if (viewerClicked=="true"){return;} setFontFamStyle(saveHoverVal); } function fontFamClickAction(fontFam){ viewerClicked="true"; setFontFamStyle(fontFam); $("#genViewer").css("visibility","hidden"); $("#genViewerHandle").css("visibility","hidden"); getProps(activeStyleEle); } function getFontFams(element){ hidePropsViewer(); viewerClicked="false"; activeStyleEle=element; saveHoverVal=document.getElementById(element).style.fontFamily; showWait(); $("#helpBox").html(imageViewerMsg); ajaxGetAction("getFontFams"); $("#gViewer").html(ajaxResp); $("#genViewer").css("height","405px"); $("#genViewer").css("visibility","visible"); $("#genViewerHandle").css("visibility","visible"); $("#genViewer").show("slow"); hideWait(); $("#saveAttribsButton").css("visibility","visible"); } /* fontSize */ function setFontSizeStyle(fontSize){ $("#"+activeStyleEle).css("fontSize",fontSize); } function fontSizeHoverAction(fontSize){ setFontSizeStyle(fontSize); } function fontSizeOutAction(fontSize){ if (viewerClicked=="true"){return;} setFontSizeStyle(saveHoverVal); } function fontSizeClickAction(fontSize){ viewerClicked="true"; setFontSizeStyle(fontSize); $("#genViewer").css("visibility","hidden"); $("#genViewerHandle").css("visibility","hidden"); getProps(activeStyleEle); } function getFontSizes(element){ hidePropsViewer(); viewerClicked="false"; activeStyleEle=element; saveHoverVal=document.getElementById(element).style.fontSize; showWait(); $("#helpBox").html(imageViewerMsg); ajaxGetAction("getFontSizes"); $("#gViewer").html(ajaxResp); $("#genViewer").css("height","405px"); $("#genViewer").css("visibility","visible"); $("#genViewerHandle").css("visibility","visible"); $("#genViewer").show("slow"); hideWait(); $("#saveAttribsButton").css("visibility","visible"); } /* Spinner for widths and heights */ function setSpin(val){ if (activeStyleEle == null){return;} val=val+"px"; if (activeStyleAttrib=='height'){ $("#"+activeStyleEle).css("height",val); } else if (activeStyleAttrib=='width'){ $("#"+activeStyleEle).css("width",val); if (activeStyleEle=='contentContainer'){ val=parseInt(val.replace("px","")); $("#pageContainer").css("width",val-240+"px"); $("#footerContainer").css("width",val+30+"px"); } } var xx = getEleVal(activeStyleEle,activeStyleAttrib); $("#"+activeStyleAttrib+"val").html(xx); } function setLeft(val){ if (activeStyleEle == null){return;} if (activeStyleAttrib != "left") {return;} val=val+"px"; val=parseInt(val.replace("px","")); if (activeStyleEle.startsWith("floatImg") || activeStyleEle=="loginPageImg" || activeStyleEle=="indexPageImg"){ $("#"+activeStyleEle+"Hdl").css("left",val); } else{ $("#"+activeStyleEle).css("left",val); } var xx = getEleVal(activeStyleEle,activeStyleAttrib); $("#"+activeStyleAttrib+"val").html(xx); } function setTop(val){ if (activeStyleEle == null){return;} if (activeStyleAttrib != "top") {return;} val=val+"px"; val=parseInt(val.replace("px","")); if (activeStyleEle.startsWith("floatImg") || activeStyleEle=="loginPageImg" || activeStyleEle=="indexPageImg"){ $("#"+activeStyleEle+"Hdl").css("top",val); } else{ $("#"+activeStyleEle).css("top",val); } var xx = getEleVal(activeStyleEle,activeStyleAttrib); $("#"+activeStyleAttrib+"val").html(xx); } function setZindex(val){ if (activeStyleEle == null){return;} if (activeStyleAttrib != "z-index") {return;} if (activeStyleEle.startsWith("floatImg") || activeStyleEle=="loginPageImg" || activeStyleEle=="indexPageImg"){ $("#"+activeStyleEle+"Hdl").css("z-index",val); } else{ $("#"+activeStyleEle).css("z-index",val); } var xx = getEleVal(activeStyleEle,activeStyleAttrib); $("#"+activeStyleAttrib+"val").html(xx); } /* border */ /* For previewing themes only */ function setBorder(border){ if (activeStyleEle=="contentContainer"){ $("#"+activeStyleEle).css("border",border); $("#headerContainer").css("border",border); } if (activeStyleEle=="footerContainer"){ $("#footerContainer").css("border-top",border); } else { $("#"+activeStyleEle).css("border",border); } } function setBorderWidth(border){ if (activeStyleAttrib != "border-all" && activeStyleAttrib != "border-top" ) {return;} if (activeStyleEle=="contentContainer"){ $("#"+activeStyleEle).css("border-width",border); $("#headerContainer").css("border-width",border); } if (activeStyleEle=="footerContainer"){ $("#footerContainer").css("border-top-width",border); } else { $("#"+activeStyleEle).css("border-width",border); } } function setBorderStyle(border){ if (activeStyleAttrib != "border-all" && activeStyleAttrib != "border-top" ) {return;} if (activeStyleEle=="contentContainer"){ $("#"+activeStyleEle).css("border-style",border); $("#headerContainer").css("border-style",border); } if (activeStyleEle=="footerContainer"){ $("#footerContainer").css("border-top-style",border); } else { $("#"+activeStyleEle).css("border-style",border); } } /* background color */ function setBgColorStyle(color){ color=getHexColor(color); $("#"+activeStyleEle).css("backgroundColor",color); if (activeStyleEle=="mainMenuContainer"){ $(".mainMenuItem").css("backgroundColor",color); } if (activeStyleEle=="headerContainer"){ $(".boxHeader").css("backgroundColor",color); } } function bgColorHoverAction(color){ setBgColorStyle(color); } function bgColorOutAction(color){ if (viewerClicked=="true"){return;} setBgColorStyle(saveHoverVal); } function bgColorClickAction(color){ viewerClicked="true"; setBgColorStyle(color); $("#colorViewer").css("visibility","hidden"); getProps(activeStyleEle); } /* foreground color */ function setFgColorStyle(color){ color=getHexColor(color); $("#"+activeStyleEle).css("color",color); if (activeStyleEle=="mainMenuContainer"){ $(".mainMenuItem").css("color",color); } if (activeStyleEle=="contentContainer"){ $("#contentContainer").css("borderColor",color); $("#headerContainer").css("borderColor",color); $(".boxHeader").css("borderColor",color); $(".hyperLinks").css("color",color); } if (activeStyleEle=="title"){ $(".boxHeader").css("color",color); } } function fgColorHoverAction(color){ setFgColorStyle(color); } function fgColorOutAction(color){ if (viewerClicked=="true"){return;} setFgColorStyle(saveHoverVal); } function fgColorClickAction(color){ viewerClicked="true"; setFgColorStyle(color); $("#colorViewer").css("visibility","hidden"); getProps(activeStyleEle); } /* image */ function setImgStyle(img){ var element=dojo.byId(activeStyleEle); if(element==null){return;} element.src=img; if (activeStyleEle=="body"){ document.getElementById("body").style.backgroundImage="url("+img+")"; if (element.src.indexOf("texture")>0){ document.getElementById("body").style.backgroundRepeat="repeat"; } else{ document.getElementById("body").style.backgroundRepeat="no-repeat"; } } else if (activeStyleEle=="contentContainer"){ document.getElementById("contentContainer").style.backgroundImage="url("+img+")"; if (element.src.indexOf("texture")>0){ document.getElementById("contentContainer").style.backgroundRepeat="repeat"; } else{ document.getElementById("contentContainer").style.backgroundRepeat="no-repeat"; } } else if (activeStyleEle=="headerContainer"){ document.getElementById("headerContainer").style.backgroundImage="url("+img+")"; if (element.src.indexOf("texture")>0){ document.getElementById("headerContainer").style.backgroundRepeat="repeat"; } else{ document.getElementById("headerContainer").style.backgroundRepeat="no-repeat"; } } else if (activeStyleEle=="footerContainer"){ document.getElementById("footerContainer").style.backgroundImage="url("+img+")"; if (element.src.indexOf("texture")>0){ document.getElementById("footerContainer").style.backgroundRepeat="repeat"; } else{ document.getElementById("footerContainer").style.backgroundRepeat="no-repeat"; } } else if (activeStyleEle=="bar1"){ document.getElementById("bar1").style.backgroundImage="url("+img+")"; if (element.src.indexOf("texture")>0){ document.getElementById("bar1").style.backgroundRepeat="repeat"; } else{ document.getElementById("bar1").style.backgroundRepeat="no-repeat"; } } else if (activeStyleEle=="bar2"){ document.getElementById("bar2").style.backgroundImage="url("+img+")"; if (element.src.indexOf("texture")>0){ document.getElementById("bar2").style.backgroundRepeat="repeat"; } else{ document.getElementById("bar2").style.backgroundRepeat="no-repeat"; } } else if (activeStyleEle=="bar3"){ document.getElementById("bar3").style.backgroundImage="url("+img+")"; if (element.src.indexOf("texture")>0){ document.getElementById("bar3").style.backgroundRepeat="repeat"; } else{ document.getElementById("bar3").style.backgroundRepeat="no-repeat"; } } else if (activeStyleEle=="bar4"){ document.getElementById("bar4").style.backgroundImage="url("+img+")"; if (element.src.indexOf("texture")>0){ document.getElementById("bar4").style.backgroundRepeat="repeat"; } else{ document.getElementById("bar4").style.backgroundRepeat="no-repeat"; } } else if (activeStyleEle=="bar5"){ document.getElementById("bar5").style.backgroundImage="url("+img+")"; if (element.src.indexOf("texture")>0){ document.getElementById("bar5").style.backgroundRepeat="repeat"; } else{ document.getElementById("bar5").style.backgroundRepeat="no-repeat"; } } else if (activeStyleEle=="bar6"){ document.getElementById("bar6").style.backgroundImage="url("+img+")"; if (element.src.indexOf("texture")>0){ document.getElementById("bar6").style.backgroundRepeat="repeat"; } else{ document.getElementById("bar6").style.backgroundRepeat="no-repeat"; } } } function imgHoverAction(img){ setImgStyle(img); $("#genViewerHandle").html(img.replace("http://my2ws.com/images","")); $("#colorViewerHandle").html(img.replace("http://my2ws.com/images","")); } function imgOutAction(img){ $("#genViewerHandle").html("Close | Move Handle"); $("#colorViewerHandle").html("Close | Move Handle"); if (viewerClicked=="true"){return;} setImgStyle(saveHoverVal); } function imgClickAction(img){ /* This sets what gets retrieved in cssMap */ var element=dojo.byId(activeStyleEle); element.src=img; viewerClicked="true"; setImgStyle(img); $("#colorViewer").css("visibility","hidden"); getProps(activeStyleEle); $("#genViewer").css("visibility","hidden"); $("#genViewerHandle").css("visibility","hidden"); $("#saveAttribsButton").css("visibility","visible"); } /* image (end) */ function showIdBox(ele){ if (adminMode != "On"){return;} $("#idBox").html(ele); $("#idBox").css("visibility","visible"); } function hideIdBox(){ $("#idBox").css("visibility","hidden"); } /* Make a call to the server to set the correct directory for the image to be * uploaded to. Then display the upload dialog. */ function setUploadDir(imgType){ showWait(); ajaxGetAction("setUploadDir&imgSubDir="+imgType); hideWait(); toggleAdmin(); $("#photoContainer").css("visibility","visible"); } function itemPhoto(){ $("#itemPhotoContainer").css("visibility","visible"); } function cancelPhoto(){ $("#photoContainer").css("visibility","hidden"); $("#itemPhotoContainer").css("visibility","hidden"); } function toggleVisible(ele){ if ($("#"+ele).css("visibility")=="visible"){ $("#"+ele).css("visibility","hidden"); } else { $("#"+ele).css("visibility","visible"); } $("#saveAttribsButton").css("visibility","visible"); } function togglePosition(ele){ if ($("#"+ele).css("position")=="fixed"){ $("#"+ele).css("position","absolute"); } else { $("#"+ele).css("position","fixed"); } $("#saveAttribsButton").css("visibility","visible"); } function toggleSeparator(){ if ($("#mainMenuItemSeparator").css("visibility")=="visible"){ $("#mainMenuItemSeparator").css("visibility","hidden"); separatorOff(); } else { $("#mainMenuItemSeparator").css("visibility","visible"); separatorOn(); } $("#saveAttribsButton").css("visibility","visible"); } /* * mainMenuItemSeparator is a hidden div whose purpose is to set the * indicator of whether the separator bars are to be visible or hidden. */ function separatorOn(){ var bColor = $("#mainMenuContainer").css("color"); $("#mainMenuContainer #flyoutMenu #nav .mainMenuLi").css("border-left","2px solid"); $("#mainMenuContainer #flyoutMenu #nav .mainMenuLi").css("border-right","2px solid"); $("#mainMenuContainer #flyoutMenu #nav .mainMenuLi").css("border-left-color",bColor); $("#mainMenuContainer #flyoutMenu #nav .mainMenuLi").css("border-right-color",bColor); $("#mainMenuContainer #flyoutMenu #nav .mainMenuLi").css("margin-left","-2px"); } function separatorOff(){ $("#mainMenuContainer #flyoutMenu #nav .mainMenuLi").css("border-left","0px solid"); $("#mainMenuContainer #flyoutMenu #nav .mainMenuLi").css("border-right","0px solid"); $("#mainMenuContainer #flyoutMenu #nav .mainMenuLi").css("margin-left","0px"); } function ajaxGet(meth){ dojo.xhrGet({ url: "/ajaxActions.do?method="+meth, handleAs: "text", timeout : 5000, preventCache: true, sync : true, load : function(response, ioArgs) { ajaxResp=response; ajaxResp=ajaxResp.trim(); return response; }, error : function(response, ioArgs) { return response; } }); } function ajaxPost(meth){ dojo.xhrPost({ url: "/ajaxActions.do?method="+meth, handleAs: "text", timeout : 5000, preventCache: true, form : "ajaxForm", sync : true, load : function(response, ioArgs) { ajaxResp=response; ajaxResp=ajaxResp.trim(); return response; }, error : function(response, ioArgs) { return response; } }); } /*** function ajaxPost(meth){ url = "/ajaxActions.do?method="+meth; $.post(url, $("#ajaxform").serialize()); } ********/ function ajaxPostAnnounce(){ dojo.xhrPost({ url: "/announce.do?method=updateAnnounceMaint", handleAs: "text", timeout : 5000, preventCache: true, form : "ajaxAnnounceForm", sync : true, load : function(response, ioArgs) { ajaxResp=response; ajaxResp=ajaxResp.trim(); return response; }, error : function(response, ioArgs) { /* alert("Sorry! An error has occurred. If this persists, please email support@yourchurchsite.com to report it. Thanks."); */ return response; } }); } function ajaxPostAction(form){ dojo.xhrPost({ url: "/ajaxActions?method=updateUserPage", handleAs: "text", timeout : 5000, preventCache: true, form : form, sync : true, load : function(response, ioArgs) { ajaxResp=response; return response; }, error : function(response, ioArgs) { return response; } }); } function ajaxGetAction(meth){ dojo.xhrGet({ url: "/ajaxActions?method="+meth, handleAs: "text", timeout : 5000, preventCache: true, sync : true, load : function(response, ioArgs) { ajaxResp=response; ajaxResp=ajaxResp.trim(); return response; }, error : function(response, ioArgs) { ajaxResponse=""; /* alert("Sorry! An error has occurred. If this persists, please email support@yourchurchsite.com to report it. Thanks."); */ return response; } }); } function resetPassword(id){ showWait(); ajaxGetAction("resetPassword&personId="+id); hideWait(); var obj = jQuery.parseJSON(ajaxResp); if (obj.status == 'success'){ $("#username").val(obj.username); $("#loginAllowedBx").prop("checked",obj.loginAllowed); $("#passwordChangeBx").prop("checked",obj.changePw); } alert( obj.msg ); } function makeSite(){ $("#buttonHider").css("visibility","hidden"); alert("Please wait while we create your new website. This can take a few minutes. When completed, we will send you another email outlining how to access your new website, and how to take the next steps of logging on, adding some content to the basic pages, and tweaking the Theme that you have chosen so it is unique to your website. Now, please click the OK button then wait patiently until the screen refreshes..."); showWait(); } /* Send the position from the top of this div, such as top=1, left=2, etc. so I can accurately * place the sTop value to get the spinner on the right div. Also, hide the spinner when not over * an applicable element. */ function setSpn(element,styleAttrib,divNo){ var initSpnVal=0; var initMax=0; var ininMin=0; var initCallback; var sTop=0; var adj=+5; var sHeight=19; activeStyleEle=element; activeStyleAttrib=styleAttrib; $("#spn").css("visibility","hidden"); $("#spn").css("left","163px"); $("#borders").css("visibility","hidden"); sTop=((divNo * sHeight)+adj)+"px"; if (styleAttrib=="width"){ initCallback=setSpin; initMin=10; initMax=1500; initSpnVal=$("#"+element).css("width").replace("px",""); } else if (styleAttrib=="height"){ initCallback=setSpin; initMin=10; initMax=1500; initSpnVal=$("#"+element).css("height").replace("px",""); } else if (styleAttrib=="z-index"){ initCallback=setZindex; initMin=10; initMax=30; if (element.startsWith("floatImg") || element=="loginPageImg" || element=="indexPageImg"){ initSpnVal=$("#"+element+"Hdl").css("z-index"); } else{ initSpnVal=$("#"+element).css("z-index"); } } else if (styleAttrib=="left"){ initCallback=setLeft; initMin=-300; initMax=1500; if (element.startsWith("floatImg") || element=="loginPageImg" || element=="indexPageImg"){ initSpnVal=$("#"+element+"Hdl").css("left").replace("px",""); } else{ initSpnVal=$("#"+element).css("left").replace("px",""); } } else if (styleAttrib=="top"){ initCallback=setTop; initMin=-300; initMax=1500; if (element.startsWith("floatImg") || element=="loginPageImg" || element=="indexPageImg"){ initSpnVal=$("#"+element+"Hdl").css("top").replace("px",""); } else{ initSpnVal=$("#"+element).css("top").replace("px",""); } } else if (styleAttrib=="border-all" || styleAttrib=="border-top"){ initCallback=setBorderWidth; initMin=0; initMax=10; initSpnVal=$("#"+element).css("border-top-width") .replace("px","") .replace(" ","") .replace("none","") .replace("solid","") .replace("ridge","") .replace("inset","") .replace("outset","") .replace("double","") .replace("dotted","") .replace("dashed",""); $("#borders").css("top",sTop); $("#spn").css("left","245px"); $("#borders").css("visibility","visible"); } else{return;} $('#spn').spinit({ min:initMin, max:initMax, stepInc:1, pageInc:20, height:16, initValue:initSpnVal, callback:initCallback }); $("#spn").css("top",sTop); $("#spn").css("visibility","visible"); } function spnOut(ele,attrib){ /* these use the spinner */ var str="top,left,width,height,z-index"; if (!str.contains(attrib)) {return;} // console.log("spnOut : " + attrib + " " + $("#"+attrib+"val").html()); } /* Itereate the css attributes of the selected element. Determine the * type of viewer to use for each. */ function getProps(ele){ /* If there is no propsViewer, the user is not logged in as Admin. So, we just want * to return. The length property will tell us whether that object exists. */ if (($('#propsViewer').length == 0) || (ele=="undefined")){ return; } var attribs=eval("a_"+ele.replace("1","").replace("2","").replace("3","").replace("4","").replace("5","").replace("6","").replace("subT","t")).split(","); var s; var element; s="