private void LoadSettings() { if (Settings.Contains("ContactFormEditorHeightSetting")) { editorHeight = Settings["ContactFormEditorHeightSetting"].ToString(); } if (Settings.Contains("ContactFormSubjectPrefixSetting")) { subjectPrefix = Settings["ContactFormSubjectPrefixSetting"].ToString().Trim(); } if (Settings.Contains("ContactFormEmailSetting")) { emailReceiveAddresses = Settings["ContactFormEmailSetting"].ToString().Trim(); emailAddresses = emailReceiveAddresses.SplitOnChar('|'); } if (Settings.Contains("ContactFormEmailAliasSetting")) { emailReceiveAliases = Settings["ContactFormEmailAliasSetting"].ToString().Trim(); } emailAliases = emailReceiveAliases.SplitOnChar('|'); if (Settings.Contains("ContactFormEmailBccSetting")) { emailBccAddresses = Settings["ContactFormEmailBccSetting"].ToString(); } if ((emailAddresses != null) && (emailAddresses.Count > 1)) { pnlToAddresses.Visible = true; } useSpamBlocking = WebUtils.ParseBoolFromHashtable(Settings, "ContactFormUseCommentSpamBlocker", false); appendIPToMessageSetting = WebUtils.ParseBoolFromHashtable(Settings, "AppendIPToMessageSetting", appendIPToMessageSetting); keepMessages = WebUtils.ParseBoolFromHashtable(Settings, "KeepMessagesInDatabase", keepMessages); useInputAsFromAddress = WebUtils.ParseBoolFromHashtable(Settings, "UseInputAddressAsFromAddress", useInputAsFromAddress); edMessage.WebEditor.ToolBar = ToolBar.AnonymousUser; edMessage.WebEditor.Height = Unit.Parse(editorHeight); vSummary.ValidationGroup = "Contact" + ModuleId.ToInvariantString(); reqEmail.ValidationGroup = "Contact" + ModuleId.ToInvariantString(); regexEmail.ValidationGroup = "Contact" + ModuleId.ToInvariantString(); btnSend.ValidationGroup = "Contact" + ModuleId.ToInvariantString(); if (!useSpamBlocking) { captcha.Enabled = false; captcha.Visible = false; divCaptcha.Visible = false; //pnlSend.Controls.Remove(divCaptcha); } else { captcha.ProviderName = SiteSettings.CaptchaProvider; captcha.Captcha.ControlID = "captcha" + ModuleId; captcha.RecaptchaPrivateKey = SiteSettings.RecaptchaPrivateKey; captcha.RecaptchaPublicKey = SiteSettings.RecaptchaPublicKey; } }
protected string FormatEditUrl(int itemId) { return(SiteRoot + "/SuperFlexi/Edit.aspx?ItemID=" + itemId.ToInvariantString() + "&mid=" + ModuleId.ToInvariantString() + "&pageid=" + PageId.ToInvariantString()); }
private void SetupScript() { //http://pupunzi.com/mb.components/mb.gallery/demo/demo_flickr.html StringBuilder script = new StringBuilder(); pnlInnerBody.RenderId = true; pnlInnerBody.RenderContentsOnly = false; script.Append("$(document).ready(function() { "); script.Append("$.printOutGallery=function(gallery){ "); script.Append("if (gallery.isInit==undefined){ "); script.Append("clearTimeout(document.flickr.tracer); "); script.Append("$(\"#" + pnlInnerBody.ClientID + " div.fthumbs\").empty(); "); script.Append("$(gallery).empty(); "); script.Append("if(! $(\"#" + pnlInnerBody.ClientID + " div.controls div.galleryinfo\").html()){ "); script.Append("var pages=$(\"<div class='pagesIDX'/>\"); "); script.Append("for(var i=1;i<=gallery.pages;i++){ "); script.Append("var page=$(\"<span class='pages btn' page='\"+i+\"'>\"+i+\"</span>\").click(function(){ "); script.Append("if($(this).hasClass(\"sel\")) return; "); script.Append("gallery.isInit=undefined; "); script.Append("$(\".pagesIDX span\").removeClass(\"sel\"); "); script.Append("$(this).addClass(\"sel\"); "); script.Append("document.flickr.page=$(this).attr(\"page\"); "); script.Append("$('#" + pnlGalleryContainer.ClientID + "').mb_loadFlickrPhotos({page:document.flickr.page}); "); script.Append("}); "); script.Append("pages.append(page); "); script.Append("if(gallery.pages == 1) { $('#gallerynav').children().hide(); }"); script.Append("} "); script.Append("$(\"#" + pnlInnerBody.ClientID + " div.controls div.galleryinfo\").html(pages); "); script.Append("$(\".pagesIDX span\").removeClass(\"sel\"); "); script.Append("$(\".pagesIDX span[page='1']\").addClass(\"sel\"); "); script.Append("} "); script.Append("$(gallery.photos).each(function(i){ "); script.Append("var photoURL = this.source; "); script.Append("var photoW = this.sourceWidth; "); script.Append("var photoH = this.sourceHeight; "); script.Append("if($.mbFlickr.defaults.size==\"medium\"){ "); script.Append("photoURL=this.medium; "); script.Append("photoW= this.mediumWidth; "); script.Append("photoH= this.mediumHeight; "); script.Append("} "); script.Append("var t=$(\"<img src='\"+this.square+\"'>\").css({opacity:0,width:this.squareWidth,height:this.squareHeight}).load(function(){ $(this).fadeTo(1000,1);}); "); script.Append("t.click(function(){ "); script.Append("$(gallery).mbGallery({startFrom:i,autoSlide:false}); "); script.Append("}); "); script.Append("$(\"#" + pnlInnerBody.ClientID + " div.fthumbs\").append(t); "); script.Append("var thumb=$(\"<a href='\"+this.square+\"'> </a>\").addClass(\"imgThumb\").attr({w:photoW,h:photoH}); "); script.Append("$(gallery).append(thumb); "); script.Append("var full=$(\"<a href='\"+photoURL+\"'> </a>\").addClass(\"imgFull\"); "); script.Append("$(gallery).append(full); "); script.Append("var flickrUrl=$(\"<a href='\"+this.url+\"' target='_blank'></a>\").html(this.title); "); script.Append("var imgTitle=$(\"<div/>\").addClass(\"imgTitle\").html(flickrUrl); "); script.Append("$(gallery).append(imgTitle); "); script.Append("var desc= typeof this.description ==\"undefined\"?\"\":this.description; "); script.Append("var imgDesc=$(\"<div/>\").addClass(\"imgDesc\").html(desc); "); script.Append("$(gallery).append(imgDesc); "); script.Append("}); "); script.Append("}else{ "); script.Append("$(gallery).mbGallery(); "); script.Append("}"); script.Append("}; "); script.Append("$.loader = function(){ "); script.Append("document.flickr.loaded=0; "); script.Append("document.flickr.tracer= setInterval(function(){ "); string loadingMessage = string.Format(FlickrResources.LoadingFormat, "\"+document.flickr.page+\"", "\"+document.flickr.loaded+\"", "\"+document.flickr.total+\""); script.Append("$(\"#" + pnlInnerBody.ClientID + " div.fthumbs\").html(\"<span class='msg'>" + loadingMessage + "</span>\"); "); script.Append("},500); "); script.Append("}; "); script.Append("$(\"#" + pnlInnerBody.ClientID + " div.controls span.fnext\").click(function(){ "); script.Append("document.flickr.page++; "); script.Append("$(\".pagesIDX span\").removeClass(\"sel\"); "); script.Append("$(\".pagesIDX span[page='\"+document.flickr.page+\"']\").addClass(\"sel\"); "); script.Append("$('#" + pnlGalleryContainer.ClientID + "').get(0).isInit=undefined; "); script.Append("$('#" + pnlGalleryContainer.ClientID + "').mb_loadFlickrPhotos({page:document.flickr.page}); "); script.Append("}); "); script.Append("$(\"#" + pnlInnerBody.ClientID + " div.controls span.fprev\").click(function(){ "); script.Append("document.flickr.page--; "); script.Append("$(\".pagesIDX span\").removeClass(\"sel\"); "); script.Append("$(\".pagesIDX span[page='\"+document.flickr.page+\"']\").addClass(\"sel\"); "); script.Append("$('#" + pnlGalleryContainer.ClientID + "').get(0).isInit=undefined; "); script.Append("$('#" + pnlGalleryContainer.ClientID + "').mb_loadFlickrPhotos({page:document.flickr.page}); "); script.Append("}); "); script.Append("document.flickr.page=0; "); script.Append("$.mbGallery.defaults.galleryTitle=\"" + this.ModuleConfiguration.ModuleTitle.HtmlEscapeQuotes() + "\"; "); script.Append("$.mbGallery.defaults.cssURL=\"" + Page.ResolveUrl("~/ClientScript/jqueryflickr/css/") + "\"; "); script.Append("$.mbGallery.defaults.skin=\"" + config.Theme + "\"; "); //black or white script.Append("$.mbFlickr.flickr_api_key=\"" + config.FlickrApiKey + "\"; "); //script.Append("$.mbFlickr.defaults.size=\"medium\"; "); script.Append("$.mbFlickr.defaults.per_page=" + config.PageSize.ToInvariantString() + "; "); script.Append("$.mbFlickr.defaults.onStart=$.loader; "); // you can either show a specific set or the user photo stream if (config.FlickrSetId.Length > 0) { script.Append("$.mbFlickr.defaults.flickr_photoset_id='" + config.FlickrSetId + "'; "); } else { script.Append("$.mbFlickr.defaults.flickr_user_id=\"" + config.FlickrUserId + "\"; "); } script.Append("$.mbFlickr.defaults.callback=$.printOutGallery; "); script.Append("$(\"#" + pnlInnerBody.ClientID + " div.controls span.fnext\").click(); "); script.Append("}); "); Page.ClientScript.RegisterStartupScript(typeof(Page), "flickrgal" + ModuleId.ToInvariantString(), "\n<script type=\"text/javascript\" >" + script.ToString() + "</script>"); }
private void LoadSettings() { config = new SharedFilesConfiguration(Settings); EditContentImage = WebConfigSettings.EditContentImage; lblError.Text = String.Empty; FileSystemProvider p = FileSystemManager.Providers[WebConfigSettings.FileSystemProvider]; if (p == null) { return; } fileSystem = p.GetFileSystem(); if (fileSystem == null) { return; } newWindowMarkup = displaySettings.NewWindowLinkMarkup; if (BrowserHelper.IsIE()) { //this is a needed hack because IE 8 doesn't work correctly with window.open // a "security feature" of IE 8 // unfortunately this is not valid xhtml to use target but it works in IE newWindowMarkup = displaySettings.IeNewWindowLinkMarkup; } if (!SharedFilesConfiguration.DownloadLinksOpenNewWindow) { newWindowMarkup = string.Empty; } TimeOffset = SiteUtils.GetUserTimeOffset(); timeZone = SiteUtils.GetUserTimeZone(); fileVirtualBasePath = "~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/SharedFiles/"; try { // this keeps the action from changing during ajax postback in folder based sites SiteUtils.SetFormAction(Page, Request.RawUrl); } catch (MissingMethodException) { //this method was introduced in .NET 3.5 SP1 } btnUpload2.Visible = IsEditable; uploader.Visible = IsEditable; uploader.MaxFilesAllowed = SharedFilesConfiguration.MaxFilesToUploadAtOnce; uploader.ServiceUrl = SiteRoot + "/SharedFiles/upload.ashx?pageid=" + PageId.ToInvariantString() + "&mid=" + ModuleId.ToInvariantString(); uploader.FormFieldClientId = hdnCurrentFolderId.ClientID; uploader.UploadButtonClientId = btnUpload2.ClientID; if (IsEditable) { string refreshFunction = "function refresh" + ModuleId.ToInvariantString() + " () { $('#" + btnRefresh.ClientID + "').click(); } "; uploader.UploadCompleteCallback = "refresh" + ModuleId.ToInvariantString(); ScriptManager.RegisterClientScriptBlock( this, this.GetType(), "refresh" + ModuleId.ToInvariantString(), refreshFunction, true); } if ((dgFile.TableCssClass.Contains("jqtable")) && (!WebConfigSettings.DisablejQuery)) { StringBuilder script = new StringBuilder(); script.Append("function setupJTable" + ModuleId.ToInvariantString() + "() {"); script.Append("$('#" + dgFile.ClientID + " th').each(function(){ "); script.Append("$(this).addClass('ui-state-default'); "); script.Append("}); "); script.Append("$('table.jqtable td').each(function(){ "); script.Append("$(this).addClass('ui-widget-content'); "); script.Append("}); "); script.Append("$('table.jqtable tr').hover( "); script.Append("function() {"); script.Append("$(this).children('td').addClass('ui-state-hover'); "); script.Append("},function() {"); script.Append("$(this).children('td').removeClass('ui-state-hover'); "); script.Append("} "); script.Append("); "); script.Append("$('table.jqtable tr').click(function() { "); script.Append("$(this).children('td').toggleClass('ui-state-highlight'); "); script.Append("}); "); script.Append("} "); // end function script.Append("Sys.WebForms.PageRequestManager.getInstance().add_endRequest(setupJTable" + ModuleId.ToInvariantString() + "); "); ScriptManager.RegisterStartupScript( this, this.GetType(), "jTable" + ModuleId.ToInvariantString(), script.ToString(), true); } trObjectCount.Visible = config.ShowObjectCount; if (config.InstanceCssClass.Length > 0) { pnlOuterWrap.SetOrAppendCss(config.InstanceCssClass); } if (WebConfigSettings.ForceLegacyFileUpload) { ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnUpload2); } }