Пример #1
0
        private void LoadSettings()
        {
            appRoot = WebUtils.GetApplicationRoot();

            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);
            config         = new GalleryConfiguration(moduleSettings);

            lnkCancel.NavigateUrl = SiteUtils.GetCurrentPageUrl();

            //if (WebConfigSettings.ImageGalleryUseMediaFolder)
            //{
            imageFolderPath = "~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/media/GalleryImages/" + moduleId.ToInvariantString() + "/";

            thumbnailBaseUrl = ImageSiteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/media/GalleryImages/" + moduleId.ToInvariantString() + "/Thumbnails/";
            //}
            //else
            //{
            //    imageFolderPath = "~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/GalleryImages/" + moduleId.ToInvariantString() + "/";

            //    thumbnailBaseUrl = ImageSiteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/GalleryImages/" + moduleId.ToInvariantString() + "/Thumbnails/";
            //}

            fullSizeImageFolderPath = VirtualPathUtility.Combine(imageFolderPath, "FullSizeImages/");

            edDescription.WebEditor.ToolBar = ToolBar.Full;

            AddClassToBody("galleryeditimage");

            FileSystemProvider p = FileSystemManager.Providers[WebConfigSettings.FileSystemProvider];

            if (p == null)
            {
                return;
            }

            fileSystem = p.GetFileSystem();

            GalleryHelper.VerifyGalleryFolders(fileSystem, imageFolderPath);

            uploader.AcceptFileTypes = SecurityHelper.GetRegexValidationForAllowedExtensionsJqueryFileUploader(SiteUtils.ImageFileExtensions());

            uploader.ServiceUrl = SiteRoot + "/ImageGallery/upload.ashx?pageid=" + pageId.ToInvariantString()
                                  + "&mid=" + moduleId.ToInvariantString()
                                  + "&ItemID=" + itemId.ToInvariantString();
            // itemid will be returned into this field
            uploader.ReturnValueFormFieldClientId = hdnState.ClientID;

            uploader.FormFieldClientId = hdnState.ClientID; // not really used but prevents submitting all the form

            string refreshFunction = "function refresh" + moduleId.ToInvariantString()
                                     + " () { $('#" + btnUpdate.ClientID + "').click(); } ";

            uploader.UploadCompleteCallback = "refresh" + moduleId.ToInvariantString();

            ScriptManager.RegisterClientScriptBlock(
                this,
                this.GetType(), "refresh" + moduleId.ToInvariantString(),
                refreshFunction,
                true);
        }
Пример #2
0
        private void LoadSettings()
        {
            moduleSettings        = ModuleSettings.GetModuleSettings(moduleId);
            config                = new GalleryConfiguration(moduleSettings);
            lnkCancel.NavigateUrl = SiteUtils.GetCurrentPageUrl();

            if (WebConfigSettings.ImageGalleryUseMediaFolder)
            {
                imageFolderPath = "~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/media/GalleryImages/" + moduleId.ToInvariantString() + "/";
            }
            else
            {
                imageFolderPath = "~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/GalleryImages/" + moduleId.ToInvariantString() + "/";
            }

            fullSizeImageFolderPath = imageFolderPath + "FullSizeImages/";

            AddClassToBody("gallerybulkupload");

            FileSystemProvider p = FileSystemManager.Providers[WebConfigSettings.FileSystemProvider];

            if (p == null)
            {
                return;
            }

            fileSystem = p.GetFileSystem();

            GalleryHelper.VerifyGalleryFolders(fileSystem, imageFolderPath);

            uploader.MaxFilesAllowed      = GalleryConfiguration.MaxFilesToUploadAtOnce;
            uploader.AcceptFileTypes      = SecurityHelper.GetRegexValidationForAllowedExtensionsJqueryFileUploader(WebConfigSettings.ImageFileExtensions);
            uploader.UploadButtonClientId = btnUpload.ClientID;
            uploader.ServiceUrl           = SiteRoot + "/ImageGallery/upload.ashx?pageid=" + pageId.ToInvariantString()
                                            + "&mid=" + moduleId.ToInvariantString();
            uploader.FormFieldClientId = hdnState.ClientID; // not really used but prevents submitting all the form

            string refreshFunction = "function refresh" + moduleId.ToInvariantString()
                                     + " () { window.location.href = '" + SiteUtils.GetCurrentPageUrl() + "'; } ";

            uploader.UploadCompleteCallback = "refresh" + moduleId.ToInvariantString();

            ScriptManager.RegisterClientScriptBlock(
                this,
                this.GetType(), "refresh" + moduleId.ToInvariantString(),
                refreshFunction,
                true);
        }