protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        designerElem.ServiceUrl = SERVICEURL;

        CssRegistration.RegisterBootstrap(this);
    }
        protected override void OnPreRender(EventArgs e)
        {
            SPMonitoredScope scope = new SPMonitoredScope(this.Title + " OnPreRender");

            try
            {
                base.ShouldLogQuery = false;
                if (!this._isSrhdcError)
                {
                    if (SPContext.Current.Web.UIVersion == 4)
                    {
                        CssRegistration.Register("Themable/search.css");
                    }
                    else
                    {
                        CssRegistration.Register("portal.css");
                    }
                    if (!this.Page.ClientScript.IsClientScriptBlockRegistered("resizeprofileimg_peoplesearch"))
                    {
                        this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "resizeprofileimg_peoplesearch", "\r\n<script>\r\nfunction resizeProfileImageCore(objid, maxWidth, maxHeight) {\r\n    var obj = document.getElementById(objid);\r\n    var oldResize=obj.onresize;\r\n    obj.onresize=null;\r\n    if ((obj != null) && (obj.height > 0) && (obj.width > 0)) {\r\n        try {\r\n            var ratiomax = maxHeight/maxWidth;\r\n            var ratioobj = obj.height/obj.width;\r\n\r\n            if (ratiomax > ratioobj) { // too wide\r\n                obj.width = maxWidth;\r\n            }\r\n            else { // too tall\r\n                obj.height = maxHeight;\r\n            }\r\n        }\r\n        catch (e) {\r\n        }\r\n    }\r\n    obj.onresize=oldResize;\r\n}\r\nfunction resizeProfileImage(objid) {\r\n    resizeProfileImageCore(objid, 75, 75);\r\n}\r\n</script>\r\n");
                    }
                    base.OnPreRender(e);
                }
            }
            finally
            {
                if (scope != null)
                {
                    scope.Dispose();
                }
            }
        }
Пример #3
0
    /// <summary>
    /// OnPreRender event handler.
    /// </summary>
    /// <param name="e">Event argument</param>
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        // Register jQuery and Require.js
        ScriptHelper.RegisterJQuery(Page);

        RequestContext.ClientApplication.Add("isAppList", true);

        // Register CMSAppList module
        ScriptHelper.RegisterModule(Page, "CMS/AppList", new
        {
            applicationListBaseUrl = ApplicationUrlHelper.GetElementUrl(),
            defaultAppUrl          = UrlResolver.ResolveUrl("~/CMSModules/ApplicationDashboard/ApplicationDashboard.aspx"),
            defaultAppName         = GetString("cms.dashboard"),
            indentLiveSite         = plcLiveSite.Visible,
            launchAppWithQuery     = String.IsNullOrEmpty(URLHelper.GetQuery(RequestContext.CurrentURL)) ? "" : URLHelper.UrlEncodeQueryString(URLHelper.GetQuery(RequestContext.CurrentURL)).Substring(1),
            screenLockInterval     = SecurityHelper.GetSecondsToShowScreenLockAction(SiteContext.CurrentSiteName)
        });

        ScriptHelper.RegisterModule(Page, "CMS/GlobalEventsHandler");

        // Register CSS for jQuery scroller
        CssRegistration.RegisterCssLink(Page, "~/CMSScripts/jquery/jquery-jscrollpane.css");

        // Register bootstrap tooltip for application list
        ScriptHelper.RegisterBootstrapTooltip(Page, ".js-filter-item a", "<div class=\"tooltip applist-tooltip\"><div class=\"tooltip-arrow\"></div><div class=\"tooltip-inner\"></div></div>");
    }
    /// <summary>
    /// Initialize design.
    /// </summary>
    private void InitDesign()
    {
        // Register css styles for uploader
        CssRegistration.RegisterCssBlock(Page, "dfu_" + containerDiv.ClientID, CreateCss(containerDiv.ClientID));

        bool isRTL = IsLiveSite ? CultureHelper.IsPreferredCultureRTL() : CultureHelper.IsUICultureRTL();

        // Prepare loading image
        imgLoading.Style.Add("float", isRTL ? "right" : "left");
        imgLoading.Attributes["title"] = GetString("tree.loading");

        // Loading css class
        lblProgress.CssClass = InnerLoadingElementClass;

        // Ensure nowrap on loading text
        pnlLoading.Style.Add("white-space", "nowrap;");
        pnlLoading.Style.Add("display", "none");

        // Decide between icon or text mode
        uploadIcon.Visible = ShowIconMode;
        btnUpload.Visible  = !ShowIconMode;

        // Disable everything properly
        if (!Enabled)
        {
            btnUpload.Enabled = false;
            uploadIcon.Attributes["class"] += " icon-disabled";
            pnlInnerDiv.CssClass           += " uploader-button-disabled";
        }

        uploaderFrame.Visible     = Enabled;
        mfuDirectUploader.Visible = Enabled;

        // Inner div html and design
        if (!String.IsNullOrEmpty(Text))
        {
            btnUpload.Text = Text;
        }
        if (!String.IsNullOrEmpty(InnerElementClass))
        {
            pnlInnerDiv.CssClass += " " + InnerElementClass;
        }

        // Container div styles
        containerDiv.Style.Add("position", "relative");
        if (DisplayInline)
        {
            containerDiv.Style.Add("float", isRTL ? "right" : "left");
        }

        if (!String.IsNullOrEmpty(ControlGroup))
        {
            containerDiv.Attributes.Add("class", ControlGroup);
        }

        string initScript = String.Format("if (typeof(DFU) !== 'undefined') {{ $cmsj(function () {{DFU.initializeDesign({0});}}); }}", ScriptHelper.GetString(containerDiv.ClientID));

        RegisterScript("DFUInit_" + ClientID, initScript);
    }
Пример #5
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (IsLiveSite)
     {
         // Register custom CSS
         CssRegistration.RegisterCssLink(Page, DocumentContext.CurrentDocumentStylesheetName, "Skin.css");
     }
 }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptHelper.RegisterJQuery(Page);
        ScriptHelper.RegisterModule(Page, "CMS/ScrollPane", new { selector = "#language-menu" });

        CssRegistration.RegisterCssLink(Page, "~/CMSScripts/jquery/jquery-jscrollpane.css");

        string currentSiteName = (SiteID != 0) ? SiteInfoProvider.GetSiteName(SiteID) : SiteContext.CurrentSiteName;
        var    cultures        = CultureSiteInfoProvider.GetSiteCultures(currentSiteName).Items;

        if (cultures.Count > 1)
        {
            string      defaultCulture = CultureHelper.GetDefaultCultureCode(currentSiteName);
            CultureInfo ci             = CultureInfo.Provider.Get(SelectedCulture);

            imgLanguage.ImageUrl      = GetFlagIconUrl(SelectedCulture, "16x16");
            imgLanguage.AlternateText = imgLanguage.ToolTip = ResHelper.LocalizeString(ci.CultureName);
            lblLanguageName.Text      = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(ci.CultureShortName));

            // Generate sub-menu only if more cultures to choose from
            StringBuilder sb = new StringBuilder();
            foreach (var culture in cultures)
            {
                string cultureCode = culture.CultureCode;
                string cultureName = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(culture.CultureName));

                if (CMSString.Compare(cultureCode, defaultCulture, true) == 0)
                {
                    cultureName += " " + GetString("general.defaultchoice");
                }

                string flagUrl = GetFlagIconUrl(cultureCode, "16x16");

                var click = String.Format("ChangeLanguage({0}); return false;", ScriptHelper.GetString(cultureCode));

                sb.AppendFormat("<li><a href=\"#\" onclick=\"{0}\"><img src=\"{1}\" alt=\"\" class=\"language-flag\"><span class=\"language-name\">{2}</span></a></li>", click, flagUrl, cultureName);
            }

            ltlLanguages.Text = sb.ToString();

            // Split view button
            btnCompare.ToolTip = GetString("SplitMode.CompareLangVersions");
            btnCompare.Text    = GetString("SplitMode.Compare");
            if (PortalUIHelper.DisplaySplitMode)
            {
                btnCompare.AddCssClass("active");
            }
            else
            {
                btnCompare.RemoveCssClass("active");
            }
        }
        else
        {
            // Hide language menu for one assigned culture on site
            Visible = false;
        }
    }
Пример #7
0
    protected void Page_Init(object sender, EventArgs e)
    {
        ScriptHelper.RegisterTooltip(this);

        RegisterAngularModule();

        ScriptHelper.RegisterDialogScript(this);
        CssRegistration.RegisterCssLink(this, "~/CMSScripts/jquery/jqueryui/jquery-ui.css");
    }
Пример #8
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     // Dynamite Core Registration
     var dynamiteCoreCss = new CssRegistration();
     dynamiteCoreCss.ID = "DynamiteCoreCssRegistration";
     dynamiteCoreCss.After = "corev4.css";
     dynamiteCoreCss.Name = SPUtility.ConcatUrls(SPContext.Current.Site.ServerRelativeUrl, SPUtility.MakeBrowserCacheSafeLayoutsUrl("GSoft.Dynamite/CSS/GSoft.Dynamite.Core.css", false));
     this.Controls.Add(dynamiteCoreCss);
 }
Пример #9
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            // Dynamite Core Registration
            var dynamiteCoreCss = new CssRegistration();

            dynamiteCoreCss.ID    = "DynamiteCoreCssRegistration";
            dynamiteCoreCss.After = "corev4.css";
            dynamiteCoreCss.Name  = SPUtility.ConcatUrls(SPContext.Current.Site.ServerRelativeUrl, SPUtility.MakeBrowserCacheSafeLayoutsUrl("GSoft.Dynamite/CSS/GSoft.Dynamite.Core.css", false));
            this.Controls.Add(dynamiteCoreCss);
        }
Пример #10
0
 private void RenderStackPanel(IEnumerable <ListFilterField> fields)
 {
     CssRegistration.Register("forms.css");
     _container.Controls.Add(new LiteralControl(@"<table class=""ms-formtable"" style=""margin-top: 8px;"" border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%""><tbody>"));
     foreach (var field in fields)
     {
         RenderField(field);
     }
     _container.Controls.Add(new LiteralControl(@"</tbody></table>"));
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptHelper.RegisterScriptFile(Page, "~/CMSScripts/Laureus/jquery/jquery-3.3.1.min.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSScripts/Laureus/jsTree/jstree.min.js");
        CssRegistration.RegisterCssLink(Page, "~/CMSScripts/Laureus/jsTree/themes/default/style.min.css");

        var taxonomyService = new TaxonomyService(new TaxonomyRepository());

        TaxonomyTree = JsonConvert.SerializeObject(taxonomyService.GetTaxonomyTree(TargetTaxonomyTypes));
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptHelper.RegisterScriptFile(Page, "~/CMSScripts/Laureus/jquery/jquery-3.3.1.min.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSScripts/Laureus/chosen/chosen.jquery.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSScripts/Laureus/chosen/chosen.order.jquery.js");
        CssRegistration.RegisterCssLink(Page, "~/CMSScripts/Laureus/chosen/chosen.css");

        LoadAndSelectList(DependsOnAnotherField);
        DataBind();
    }
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        ChooseAndRenderSmartTip();

        RaiseNoCollectorOrEraserRegisteredWarning();

        RenderDeleteDataButton();

        CssRegistration.RegisterBootstrap(this);
    }
Пример #14
0
    /// <summary>
    /// PreRender event handler.
    /// </summary>
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        CssRegistration.RegisterBootstrap(Page);

        if (!WidgetActionsEnabled)
        {
            // Hide the control when document editing is not allowed (i.e. non-editable workflow step)
            Visible = false;
        }
    }
Пример #15
0
    /// <summary>
    /// Registers global device profiles style sheet and style sheet for given profile if exists.
    /// </summary>
    /// <param name="profileName">Profile code name used as folder name in ~/App_Themes/Components/DeviceProfile/ folder</param>
    private void RegisterDeviceProfileCss(string profileName)
    {
        // Global device profiles css
        CssRegistration.RegisterCssLink(Page, "~/App_Themes/Design/DeviceProfile.css");

        string styleUrl = string.Format("~/App_Themes/Components/DeviceProfile/{0}/DeviceProfile.css", profileName);

        if (FileHelper.FileExists(styleUrl))
        {
            CssRegistration.RegisterCssLink(Page, styleUrl);
        }
    }
    protected override void OnLoad(EventArgs e)
    {
        // Register Semantic UI and jQuery on page where this web part is used
        // You can register scripts also on the Master page for them to be available globally
        CssRegistration.RegisterCssLink(this.Page, "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.min.css");
        CssRegistration.RegisterCssLink(this.Page, "https://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css");

        ScriptHelper.RegisterScriptFile(this.Page, "https://code.jquery.com/jquery-2.2.0.min.js", false);
        ScriptHelper.RegisterScriptFile(this.Page, "https://code.jquery.com/ui/1.10.4/jquery-ui.min.js", false);
        ScriptHelper.RegisterScriptFile(this.Page, "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.min.js", false);

        base.OnLoad(e);
    }
Пример #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register JS
        ScriptHelper.RegisterJQuery(Page);
        ScriptHelper.RegisterJQueryCookie(Page);

        ScriptHelper.RegisterScriptFile(Page, "~/CMSScripts/jquery-jscrollpane.js");
        CssRegistration.RegisterCssLink(Page, "~/CMSScripts/jquery/jquery-jscrollpane.css");

        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Content/CMSDesk/View/View.js");

        // Init preview
        InitializeDevicePreview();
    }
Пример #18
0
    protected void Page_Init(object sender, EventArgs e)
    {
        ScriptHelper.RegisterTooltip(this);

        RegisterAngularModule();

        ScriptHelper.RegisterDialogScript(this);
        CssRegistration.RegisterCssLink(this, "~/CMSScripts/jquery/jqueryui/jquery-ui.css");

        if (SiteContext.CurrentSite.SiteIsContentOnly && SitePresentationUri == null)
        {
            ShowError(GetString("campaign.incorrectPresentationUrl"));
            MessagesPlaceHolder.ContainerCssClass = CssHelper.EnsureClass(MessagesPlaceHolder.ContainerCssClass, "cms-campaigns-edit");
        }
    }
Пример #19
0
    /// <summary>
    /// PreRender event handler.
    /// </summary>
    protected override void OnPreRender(EventArgs e)
    {
        if (!StopProcessing)
        {
            // Register scripts
            ScriptHelper.RegisterJQuery(Page);
            CMSDialogHelper.RegisterDialogHelper(Page);
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "InitResizers", "$cmsj(InitResizers());", true);
            CssRegistration.RegisterCssBlock(Page, "themeCss", ".TooltipImage{max-width:200px; max-height:200;}");

            ScriptHelper.HideVerticalTabs(Page);
        }

        base.OnPreRender(e);
    }
Пример #20
0
    /// <summary>
    /// Raises the <see cref="E:Init"/> event.
    /// </summary>
    protected override void OnInit(EventArgs e)
    {
        ucEditableImage.ViewMode        = CheckPermissions();
        ucEditableImage.DataControl     = CurrentWebPartInstance;
        ucEditableImage.CurrentPageInfo = CurrentPageInfo;
        ucEditableImage.SetupControl();

        // Web part property macros need to be resolved manually in the EditText dialog.
        // In portal engine, macro resolving is being handled by the CMSAbstractWebpart control which cannot be used in this page.
        ucEditableImage.OnGetValue += ucEditableText_OnGetValue;

        string title = GetString("Content.EditImageTitle");

        if (!String.IsNullOrEmpty(PageTitleSuffix))
        {
            title += " - " + HTMLHelper.HTMLEncode(PageTitleSuffix);
        }
        SetTitle(title);

        // Check whether control is initialized form ASPX page
        if (QueryHelper.GetBoolean("aspxc", false))
        {
            // Alternate text
            ucEditableImage.AlternateText = QueryHelper.GetString("at", ucEditableImage.AlternateText);

            // Image CSS class
            ucEditableImage.ImageCssClass = QueryHelper.GetString("icc", ucEditableImage.ImageCssClass);

            // Width/Height
            ucEditableImage.ImageHeight = QueryHelper.GetInteger("ih", ucEditableImage.ImageHeight);
            ucEditableImage.ImageWidth  = QueryHelper.GetInteger("iw", ucEditableImage.ImageWidth);

            // Resizing values
            ucEditableImage.ResizeToHeight      = QueryHelper.GetInteger("rth", ucEditableImage.ResizeToHeight);
            ucEditableImage.ResizeToWidth       = QueryHelper.GetInteger("rtw", ucEditableImage.ResizeToWidth);
            ucEditableImage.ResizeToMaxSideSize = QueryHelper.GetInteger("rtmss", ucEditableImage.ResizeToMaxSideSize);
        }

        base.OnInit(e);

        CssRegistration.RegisterCssLink(Page, "Design", "OnSiteEdit.css");
        ScriptHelper.RegisterJQuery(Page);

        menuElem.ShowSave         = false;
        menuElem.ShowSaveAndClose = true;
    }
    private void Page_PreRenderComplete(object sender, EventArgs e)
    {
        // Hide control if not enough anchors
        var anchorCount = UIContext.AnchorLinks.Count;

        if ((anchorCount < MinimalAnchors) || (anchorCount == 0) || !Visible)
        {
            pnlWrapper.Visible = false;
            return;
        }

        CssRegistration.RegisterCssLink(Page, "~/CMSScripts/jquery/jquery-jscrollpane.css");
        ScriptHelper.RegisterModule(Page, "AdminControls/AnchorDropup", ScrollOffset);

        repNavigationItems.DataSource = UIContext.AnchorLinks;
        repNavigationItems.DataBind();
    }
Пример #22
0
        protected override void CreateChildControls()
        {
            //注册JS文件

            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "js0001", "/_layouts/STYLES/corechart.js");
            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "js0002", "/_layouts/STYLES/jquery.ba-resize.min.js");
            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "js0003", "/_layouts/STYLES/jquery.gvChart-1.0.1.min.js");
            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "js0004", "/_layouts/STYLES/jquery.js");
            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "js0005", "/_layouts/STYLES/jsapi.js");
            //注册CSS文件

            CssRegistration cssControls = new CssRegistration();

            cssControls.Name = "/_layouts/STYLES/myStyle.css";
            Page.Header.Controls.Add(cssControls);

            Control control = Page.LoadControl(_ascxPath);

            Controls.Add(control);
            //test

            int[] result = StatisticAllList(ListName, SubWebUrl);
            int   points = 0;

            for (int i = 0; i < result.Length; i++)
            {
                points += result[i];
            }
            this.Controls.Add(new LiteralControl("<div><span style='width:120px;font-weight:bold;'>活动总积分:</span>" + points.ToString() + "</div>"));
            this.Controls.Add(new LiteralControl("<ul>"));
            this.Controls.Add(new LiteralControl("<li><span style='width:120px;font-weight:bold;'>" + "微博:</span>" + result[0].ToString() + "</li>"));

            string[] lstName = ListName.Split(';');

            for (int i = 0; i < lstName.Length; i++)
            {
                string lname = lstName[i];
                if (lname == "Posts")
                {
                    lname = "备忘录";
                }
                this.Controls.Add(new LiteralControl("<li><span style='width:120px;font-weight:bold;'>" + lname + ":</span>" + result[i + 1].ToString() + "</li>"));
            }
            this.Controls.Add(new LiteralControl("</ul>"));
        }
Пример #23
0
        private void LoadWorkingMode()
        {
            CssClass = "spfilter-container";
            try
            {
                if (ListViewWebPart == null)
                {
                    if (WebPartManager.DisplayMode.AllowPageDesign)
                    {
                        const string iconUrl = "/_layouts/15/images/SPFilter/IconInfo.gif";
                        var          text    = string.Format(this.LocalizedString("Text_ShowEditPanel"), ID);
                        RenderMessage(text, iconUrl, string.Empty);
                    }
                }
                else
                {
                    if (ListFilterSettings.GetCurrent(this).Fields.Any())
                    {
                        CssRegistration.Register("forms.css");
                        _container = this;
                        RenderFields();
                        _container.Controls.Add(new LiteralControl(@"<div style=""clear:both;""></div>"));
                        FilterButton.Text = this.LocalizedString("Button_Apply");
                        _container.Controls.Add(FilterButton);

                        Controls.Add(Up);
                        RenderStyleSheet(_container);
                    }
                    else
                    {
                        const string iconUrl = "/_layouts/15/images/SPFilter/IconInfo.gif";
                        var          text    = string.Format(this.LocalizedString("Text_ShowEditPanel"), ID);
                        RenderMessage(text, iconUrl, string.Empty);
                    }
                }
            }
            catch (Exception ex)
            {
                Controls.Clear();
                const string iconUrl = "/_layouts/15/images/SPFilter/IconError.png";
                var          text    = ex.Message;
                RenderMessage(text, iconUrl, string.Empty);
            }
        }
Пример #24
0
        private void RenderGrid(IEnumerable <ListFilterField> fields)
        {
            CssRegistration.Register("forms.css");
            _container.Controls.Add(new LiteralControl(@"<table class=""ms-formtable"" style=""margin-top: 8px;"" border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%""><tbody><tr>"));
            const int fieldsPerRow = 3;
            var       counter      = 0;

            foreach (var field in fields)
            {
                RenderField(field);
                counter = counter + 1;
                if (counter == fieldsPerRow)
                {
                    counter = 0;
                    _container.Controls.Add(new LiteralControl(@"</tr><tr>"));
                }
            }
            _container.Controls.Add(new LiteralControl(@"</tr></tbody></table>"));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!QueryHelper.ValidateHash("hash"))
        {
            URLHelper.Redirect(AdministrationUrlHelper.GetErrorPageUrl("imageeditor.badhashtitle", "imageeditor.badhashtext"));
        }
        else
        {
            ScriptHelper.RegisterJQueryCrop(Page);
            ScriptHelper.RegisterScriptFile(Page, "~/CMSAdminControls/ImageEditor/ImageEditorInnerPage.js");
            CssRegistration.RegisterBootstrap(Page);

            string imgUrl = QueryHelper.GetString("imgurl", null);
            if (String.IsNullOrEmpty(imgUrl))
            {
                string query = RequestContext.CurrentQueryString;

                query = URLHelper.RemoveParameterFromUrl(query, "hash");

                var settings = new HashSettings
                {
                    HashSalt = HashValidationSalts.GET_IMAGE_VERSION
                };

                query = URLHelper.AddParameterToUrl(query, "hash", ValidationHelper.GetHashString(query, settings));

                imgContent.ImageUrl = UrlResolver.ResolveUrl("~/CMSPages/GetImageVersion.aspx" + query);

                int imgwidth  = QueryHelper.GetInteger("imgwidth", 0);
                int imgheight = QueryHelper.GetInteger("imgheight", 0);
                if ((imgwidth > 0) && (imgheight > 0))
                {
                    imgContent.Width  = imgwidth;
                    imgContent.Height = imgheight;
                }
            }
            else
            {
                imgContent.ImageUrl = imgUrl;
            }
        }
    }
Пример #26
0
    private void RegisterCSS()
    {
        CssRegistration.RegisterCssBlock(this, "SupportHelper", String.Format(@"
			.ck-link-form .ck-input-text {{
				width: inherit !important;
			}}
            .cms-bootstrap .editing-form-value-cell i {{
                margin: inherit;
            }}
			.cms-bootstrap .ck-editor__editable a:hover,
			.cms-bootstrap .ck-editor__editable .link:hover,
			.cms-bootstrap .ck-editor__editable a:focus,
			.cms-bootstrap .ck-editor__editable .link:focus {{
				color: black;
				text-decoration: none;
			}}
			.cms-bootstrap .ck-editor__editable h2,
			.cms-bootstrap .ck-editor__editable h3,
			.cms-bootstrap .ck-editor__editable h4,
			.cms-bootstrap .ck-editor__editable strong {{
				color: black;
			}}
			#{0} {{
				height: 300px;
				max-width: 500px !important;
				border: 2px solid #bdbbbb;
				border-radius: 3px;
			}}
			#{0}:focus {{
				border-bottom: 2px solid #1175ae;
			}}
			#{1} {{
				margin: 7px 0 0;
			}}
			#{2} {{
				display: block;
			}}
			.PLCFix > div {{
				top: 70px;
			}}
		"        , txtDescription.ClientID, txtCategoryCustom.ClientID, drpCategory.ClientID));
    }
Пример #27
0
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Override BasicStyles flag to ensure correct styles in widget properties on the dashboard
        MessagesPlaceHolder.BasicStyles            = false;
        MessagesPlaceHolder.WrapperControlClientID = formCustom.ClientID;

        ScriptHelper.RegisterEditScript(Page, false);

        // Register css file with editor classes
        CssRegistration.RegisterCssLink(Page, "~/CMSModules/Widgets/CSS/editor.css");

        string definition = ValidationHelper.GetString(SessionHelper.GetValue("WidgetDefinition"), string.Empty);

        if (String.IsNullOrEmpty(definition))
        {
            hdnWidgetDefinition.Value = definition;
            SessionHelper.Remove("WidgetDefinition");
        }

        DocumentManager.RegisterSaveChangesScript = false;
    }
Пример #28
0
        protected override void CreateChildControls()
        {
            if (!Page.ClientScript.IsClientScriptIncludeRegistered("jQuery"))
            {
                Page.ClientScript.RegisterClientScriptInclude(typeof(ManageNavigation), "jQuery", "/_layouts/Hemrika/Content/js/jquery.min.js");
            }

            if (!Page.ClientScript.IsClientScriptIncludeRegistered("Navigation"))
            {
                Page.ClientScript.RegisterClientScriptInclude(typeof(ManageNavigation), "Navigation", "/_layouts/Hemrika/Content/js/Navigation.js");
            }

            CssRegistration.Register("/_layouts/Hemrika/Content/css/Navigation.css");

            if (!Page.ClientScript.IsClientScriptBlockRegistered("NavigationInit"))
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(ManageNavigation), "NavigationInit", "", true);
            }

            base.CreateChildControls();
        }
        /// <summary>
        /// Fires when the page loads
        /// </summary>
        /// <param name="sender">Originator of event</param>
        /// <param name="e">Event arguments</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            // Css link elements need to be generated on the fly - rewriting their arguments from code-behind doesn't work.
            // The Css import sequence should be corev4.css -> GSoft.Dynamite.Examples.css -> GSoft.Dynamite.Examples.Custom.css.

            // Add a version string to layouts CSS file, otherwise a stale version will get cached in the clients' browsers
            string projectCssName = SPUtility.ConcatUrls(SPContext.Current.Web.ServerRelativeUrl, "/_layouts/GSoft.Dynamite.Examples/css/GSoft.Dynamite.Examples.css?v=" + VersionContext.CurrentVersionTag);

            CssRegistration css = new CssRegistration();
            css.ID = "ProjectCssRegistration";
            css.After = "corev4.css";
            css.Name = projectCssName;
            this.Controls.Add(css);

            CssRegistration customCss = new CssRegistration();
            customCss.ID = "ProjectCustomCssRegistration";
            customCss.After = projectCssName;

            // no need for a version string here - the Style Library won't unnecessarily cache the css file
            customCss.Name = SPUtility.ConcatUrls(SPContext.Current.Web.ServerRelativeUrl, "/Style Library/GSoft.Dynamite.Examples.Custom.css");
            this.Controls.Add(customCss);
        }
    /// <summary>
    /// Load event handler.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Contains definition for position of error label
        CssRegistration.RegisterCssLink(Page, "~/CMSWebparts/StrandsRecommender/StrandsRecommendations.css");

        if (!StrandsSettings.IsStrandsEnabled(SiteContext.CurrentSiteName))
        {
            // If Strands is not currently available, stop processing webpart
            StopProcessing = true;
            HandleError(GetString("strands.notoken"));
        }
        else if (CookieHelper.CurrentCookieLevel < CookieLevel.Visitor)
        {
            // Do nothing, if user has decided to forbid cookie usage to under Visitor level, because Strands library uses Cookies under the hood
            StopProcessing = true;
            HandleError();
        }
        else
        {
            SetupControl();
        }
    }
Пример #31
0
    protected override void OnPreRender(EventArgs e)
    {
        if (mReportInfo != null)
        {
            if (TableInfo != null)
            {
                EnableSubscription = (EnableSubscription && ValidationHelper.GetBoolean(TableInfo.TableSettings["SubscriptionEnabled"], true) && mReportInfo.ReportEnableSubscription);
                EnableExport       = (EnableExport && ValidationHelper.GetBoolean(TableInfo.TableSettings["ExportEnabled"], false));
                // Register context menu for export - if allowed
                RegisterSubscriptionScript(TableInfo.TableReportID, "tableid", TableInfo.TableID, menuCont);
            }

            // Export data
            if (!mErrorOccurred)
            {
                ProcessExport(ValidationHelper.GetCodeName(mReportInfo.ReportDisplayName));
            }
        }

        base.OnPreRender(e);

        CssRegistration.RegisterBootstrap(Page);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (PortalContext.ViewMode != ViewModeEnum.EditLive)
        {
            // Try skip IIS http errors
            Response.TrySkipIisCustomErrors = true;

            // Set page not found state
            Response.StatusCode = 404;
        }
        else if (SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSAllowOnSiteEditing"))
        {
            CssRegistration.RegisterDesignMode(Page);

            CMSAbstractPortalUserControl editToolbar = (CMSAbstractPortalUserControl)Page.LoadUserControl("~/CMSModules/PortalEngine/Controls/OnsiteEdit/EditToolbar.ascx");
            editToolbar.ID      = "editToolbar";
            editToolbar.ShortID = "et";
            plcMain.Controls.Add(editToolbar);
        }

        titleElem.TitleText = GetString("404.Header");
        lblInfo.Text        = String.Format(GetString("404.Info"), HTMLHelper.HTMLEncode(RequestContext.CurrentURL) + " (" + LocalizationContext.PreferredCultureCode + ")");
        lblRootDoc.Text     = "<a href=\"" + URLHelper.GetApplicationUrl() + "\" target=\"_self\">" + HTMLHelper.HTMLEncode(GetString("onsiteedit.rootredirect")) + "<a>";
    }
        protected override void CreateChildControls()
        {
            if (SPContext.Current.FormContext.FormMode == SPControlMode.Display)
            {
                ScriptLink sl = new ScriptLink();
                sl.Name = "jquery-1.7.min.js";
                Controls.Add(sl);
                ScriptLink sl2 = new ScriptLink();
                sl2.Name = "mediaelement-and-player.min.js";
                Controls.Add(sl2);
                CssRegistration css = new CssRegistration();
                css.Name = "mediaelementplayer.min.css";
                Controls.Add(css);

                Controls.Add(new LiteralControl("<video width=\"" + width + "\" height=\"" + height + "\" controls=\"controls\" preload=\"none\" poster=\"" + altimage + "\">"));
                Controls.Add(new LiteralControl("<source type=\"video/mp4\" src=\"" + VideoUrlMP4 + "\" />"));
                Controls.Add(new LiteralControl("<source type=\"video/webm\" src=\"" + VideoUrlWebM + "\" />"));
                if (subUrl.Length > 2)
                {
                    Controls.Add(new LiteralControl("<track kind=\"subtitles\" label=\"English\" srclang=\"en\" src=\"" + subUrl + "\"></track>"));
                }
                //<!-- Fallback flash player for no-HTML5 browsers with JavaScript turned off -->
                Controls.Add(new LiteralControl("<object width=\"" + width + "\" height=\"" + height + "\" type=\"application/x-shockwave-flash\" data=\"/_layouts/1033/flashmediaelement.swf\"> 	"));
                Controls.Add(new LiteralControl("<param name=\"movie\" value=\"/_layouts/1033/flashmediaelement.swf\" /> "));
                Controls.Add(new LiteralControl("<param name=\"flashvars\" value=\"controls=true&amp;file=" + VideoUrlMP4 + "\" /> 	"));
                //<!-- Image fall back for non-HTML5 browser with JavaScript turned off and no Flash player installed -->
                Controls.Add(new LiteralControl("<img src=\"" + altimage + "\" width=\"" + width + "\" height=\"" + height + "\" alt=\"Here we are\" title=\"No video playback capabilities\" />"));
                Controls.Add(new LiteralControl("</object> 	"));
                //FallBack to Silverlight video player for wmv playback
                Controls.Add(new LiteralControl("<object width=\"" + width + "\" height=\"" + height + "\" type=\"application/x-silverlight-2\" data=\"/_layouts/1033/silverlightmediaelement.xap\"> 	"));
                Controls.Add(new LiteralControl("<param name=\"movie\" value=\"/_layouts/1033/silverlightmediaelement.xap\" /> "));
                Controls.Add(new LiteralControl("<param name=\"flashvars\" value=\"controls=true&amp;file=" + VideoUrlMP4 + "\" /> 	"));
                //<!-- Image fall back for non-HTML5 browser with JavaScript turned off and no Flash player installed -->
                Controls.Add(new LiteralControl("<img src=\"" + altimage + "\" width=\"" + width + "\" height=\"" + height + "\" alt=\"Here we are\" title=\"No video playback capabilities\" />"));
                Controls.Add(new LiteralControl("</object> 	"));
                Controls.Add(new LiteralControl("</video>"));

                Controls.Add(new LiteralControl(@"
                    <script>
                        $('video').mediaelementplayer({
                            // initial volume when the player starts
                            startVolume: 0.8,
                            // useful for <audio> player loops
                            loop: false,
                            // enables Flash and Silverlight to resize to content size
                            enableAutosize: true,
                            // the order of controls you want on the control bar (and other plugins below)
                            features: ['playpause','progress','current','duration','tracks','volume','fullscreen'],
                            // Hide controls when playing and mouse is not over the video
                            alwaysShowControls: false,
                            // force iPad's native controls
                            iPadUseNativeControls: false,
                            // force iPhone's native controls
                            iPhoneUseNativeControls: false,
                            // force Android's native controls
                            AndroidUseNativeControls: false
                        });
                    </script>"));

            }
            else // SPContext.Current.FormContext.FormMode = SPControlMode.Edit
            {
                editPanel = new Panel();
                editPanel.Width = Unit.Pixel(460);
                editPanel.Controls.Add(new LiteralControl("WebPart Configuration"));
                editPanel.Controls.Add(new LiteralControl("<br/>Please define the MP4 video url<br/>"));
                videourl = new TextBox();
                if (!string.IsNullOrEmpty(VideoUrlMP4))
                {
                    videourl.Text = VideoUrlMP4;
                }
                editPanel.Controls.Add(videourl);

                editPanel.Controls.Add(new LiteralControl("<br/>"));
                editPanel.Controls.Add(new LiteralControl("<br/>Please define the WebM video url<br/>"));
                videourlwebm = new TextBox();
                if (!string.IsNullOrEmpty(VideoUrlWebM))
                {
                    videourlwebm.Text = VideoUrlWebM;
                }
                editPanel.Controls.Add(videourlwebm);

                editPanel.Controls.Add(new LiteralControl("<br/>"));
                editPanel.Controls.Add(new LiteralControl("<br/>Please define the subtitle url<br/>"));
                suburl = new TextBox();
                if (!string.IsNullOrEmpty(subUrl))
                {
                    suburl.Text = subUrl;
                }
                editPanel.Controls.Add(suburl);

                editPanel.Controls.Add(new LiteralControl("<br/>"));
                editPanel.Controls.Add(new LiteralControl("<br/>Please define the width<br/>"));
                txtwidth = new TextBox();
                if (!string.IsNullOrEmpty(width))
                {
                    txtwidth.Text = width;
                }
                editPanel.Controls.Add(txtwidth);

                editPanel.Controls.Add(new LiteralControl("<br/>"));
                editPanel.Controls.Add(new LiteralControl("<br/>Please define the height<br/>"));
                txtheight = new TextBox();
                if (!string.IsNullOrEmpty(height))
                {
                    txtheight.Text = height;
                }
                editPanel.Controls.Add(txtheight);

                editPanel.Controls.Add(new LiteralControl("<br/>"));
                editPanel.Controls.Add(new LiteralControl("<br/>Please define the alternate image (no playback fallback) url<br/>"));
                txtaltimg = new TextBox();
                if (!string.IsNullOrEmpty(altimage))
                {
                    txtaltimg.Text = altimage;
                }
                editPanel.Controls.Add(txtaltimg);

                editPanel.Controls.Add(new LiteralControl("<br/>"));
                submit = new Button();
                submit.Text = "Save";
                submit.Click += new EventHandler(submit_Click);
                editPanel.Controls.Add(submit);
                Controls.Add(editPanel);
            }
        }