// JavaScript Document function createGalleryEditor(galleryID,newGal){ null != newGal ? 1 : newGal = "old"; eval("galleryEditor" + galleryID +" = new galleryEditor(galleryID,'" + newGal + "');"); } function galleryEditor(galleryID,newGal){ newGal == "old" ? this.newGal = 0 : this.newGal = 1; this.galleryEditor = 'galleryEditor' + galleryID; this.galleryID = galleryID; this.thumbsPerRow = 6; this.currentRow = 0; this.currentRowCount = 0; this.retrieveGallery(); } galleryEditor.prototype.showControlToggle = function(direction){ for(var j=0;jShow Controls[+]"); }else{ document.getElementById("thumbControl_" + j).style.display = 'block'; var HTML = ("Hide Controls[x]"); } document.getElementById("controlToggle").innerHTML = HTML; } } galleryEditor.prototype.galleryDisplay = function(){ var titleField = "
Edit title:
"; this.content = "
" + titleField +"
Save Gallery[x]
"; for(var i=0;i"; this.content += this.displayButtons(i,this.photoIds[i]); this.content += "
"; this.content += ""; this.currentRowCount++; if(this.currentRowCount == this.thumbsPerRow){ this.currentRowCount = 0; this.currentRow++; } } if(this.newGal==1){ //contents,boxwidth,boxheight,left,top,fixed evPopOpen(this.content,650,'auto',300,200,1); }else{ evPopOpen(this.content,650); } this.showControlToggle(1); } galleryEditor.prototype.galleryStringBuild = function(){ if(document.getElementById("photoIdString")){ this.photoIds = document.getElementById("photoIdString").value.split(","); this.galleryTitle = document.getElementById("newGalleryTitle").value; this.photoCount = this.photoIds.length; this.totalRows = Math.ceil(this.photoCount/this.thumbsPerRow); //alert(this.totalRows + " is the total" + this.photoCount + " is count " + this.thumbsPerRow); this.directory = document.getElementById("photoDirectory").value; this.galleryDisplay(); }else{ this.t = setTimeout(this.galleryEditor + ".galleryStringBuild();",100); } } galleryEditor.prototype.retrieveGallery = function(){ document.getElementById("postDiv").innerHTML = ""; var postString = "data_only=1|module=gallery_manage|user_function[retrieve_gallery]=1|galleryID=" + this.galleryID; formCreatePost(postString,"postDiv"); this.t = setTimeout(this.galleryEditor + ".galleryStringBuild();",100); } galleryEditor.prototype.thumbMove = function(index,photoID,h,v){ direction = h + (this.thumbsPerRow * v); swapDiv = index + direction; // this will be the next one as a counter if(swapDiv == 0){ var galThumb = this.photoIds[index]; var oldThumb = this.photoIds[swapDiv]; }else if(index == 0){ var galThumb = this.photoIds[swapDiv]; var oldThumb = this.photoIds[index]; } if(galThumb){ cThumbHTML = document.getElementById("thumbCode_" + this.galleryID).innerHTML; nThumbHTML = cThumbHTML.replace("_" + oldThumb + "_","_" + galThumb + "_"); document.getElementById("thumbCode_" + this.galleryID).innerHTML = nThumbHTML; }else{ var galThumb = ""; } var holdPressed = document.getElementById("jpg_" + index).innerHTML; var holdSwap = document.getElementById("jpg_" + swapDiv).innerHTML; document.getElementById("jpg_" + index).innerHTML = holdSwap; document.getElementById("jpg_" + swapDiv).innerHTML = holdPressed; var postString = "data_only=1|module=gallery_manage|core_app=gallery_manage|user_function[modify_order]=1|direction=" + direction + "|pressed_recordID="+ this.photoIds[index] + "|swap_recordID=" + this.photoIds[swapDiv] + "|makeThumb=" + galThumb + "|galleryID=" + this.galleryID; formCreatePost(postString,"postDiv"); // swap the photo ids var holdSwapId = this.photoIds[swapDiv]; this.photoIds[swapDiv] = this.photoIds[index]; this.photoIds[index] = holdSwapId; } galleryEditor.prototype.displayButtons = function(index,photoID){ var build = ""; var iconURL = "/common/global_images/icons/utility/"; if(this.currentRowCount!=0){ var leftArrow = "
"; }else{ var leftArrow = "
"; } if(this.currentRowCount!= (this.thumbsPerRow - 1)){ var rightArrow = "
"; }else{ var rightArrow = "
"; } if(this.currentRow > 0){ var upArrow = "
"; }else{ var upArrow = "
"; } var deleter = "
"; if(this.totalRows > this.currentRow + 1){ var downArrow = "
"; }else{ var downArrow = "
"; } var centerColumn = "
" + upArrow + deleter + downArrow + "
"; return("
" + leftArrow + centerColumn + rightArrow + "
"); } galleryEditor.prototype.thumbDelete = function(index,photoID){ if(!confirm("Are you sure you want to remove this image from the latest pics?")){ return(alert("Deletion cancelled")); } var finish = false; var nextID = index + 1; var postString = "data_only=1|module=gallery_manage|core_app=gallery_manage|user_function[delete_ev_pic]=1|photoID=" + photoID; formCreatePost(postString,"postDiv"); do{ var nextDiv = "jpg_" + nextID; if(document.getElementById(nextDiv)){ document.getElementById("jpg_" + index).innerHTML = document.getElementById(nextDiv).innerHTML; this.photoIds[index] = this.photoIds[nextID]; nextID++; index++; }else{ document.getElementById("thumbHolder_" + index).innerHTML = ""; finish = true; } } while(finish==false); } function removeGallery(galleryID,sp){ if(!confirm("Are you sure you want to delete this ENTIRE gallery? Deletions are permanent and all images will be removed and can not be retrieved. Inidividual images can be removed from the gallery by clicking the edit link.")){ return(alert("Deletion cancelled")); } if(!confirm("Just double checking. eventvibe.com is not responsible for the loss of personal images at this point. Continue only if you wish to delete this ENTIRE Gallery.")){ return(alert("Deletion cancelled")); } var postString = "data_only=1|module=gallery_manage|core_app=gallery_manage|user_function[gallery_delete]=1|galleryID=" + galleryID + "|sp=" + sp; formCreatePost(postString,"postDiv"); alert("Gallery deleted"); window.location.href = window.location.href; } function get_photoAdder(galleryID){ var postString = "data_only=1|module=gallery_manage|user_function[display_uploaded_popup]=1|galleryID=" + galleryID; formCreatePost(postString,"evPopupHolder"); evPopOpen(0,400); } function galleryTitleUpdate(galleryID){ var galleryTitle = document.getElementById("galleryTitle").value; var postString = "data_only=1|module=gallery_manage|user_function[update_title]=1|galleryID=" + galleryID + "|gallery_title=" + galleryTitle; formCreatePost(postString,"postDiv"); document.getElementById("title_" + galleryID).innerHTML = "" + galleryTitle + ""; } function galleryTitleTimeout(galleryID){ setTimeout("galleryTitleUpdate(" + galleryID + ");",10); }