protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            try
            {
                if (renderScript)
                {
                    this.Page.ClientScript.RegisterHiddenField(this.ClientID + "notificationList", messageListJSON);

                    //page.ClientScript.RegisterStartupScript(type, scriptBlockId, Utility.BuildDelayedExecutionScript(strFileKey, strMethod, scriptSafeArgs), true);

                    ScriptLink.Register(this.Page, "schaeflein.community.systemnotification/json2.js", false);
                    ScriptLink.Register(this.Page, "schaeflein.community.systemnotification/systemnotifications.js", false);

                    Utility.RegisterDelayedExecutionScript(this.Page, this.GetType(),
                                                           "schaeflein.community.systemnotification/systemnotifications.js", "INIT_KEY",
                                                           "Schaeflein.Community.SystemNotification.init",
                                                           new string[] { "'" + this.ClientID + "'" });
                }
            }
            catch (Exception ex)
            {
                // TODO: Log this
            }
        }
コード例 #2
0
        // PUT api/Link/5
        public IHttpActionResult PutScriptLink(decimal id, ScriptLink scriptlink)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != scriptlink.ScriptLinkID)
            {
                return(BadRequest());
            }

            db.Entry(scriptlink).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ScriptLinkExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        protected override void OnPreRender(EventArgs e)
        {
            tb.AddTimer();
            if (bHasPeriods)
            {
                if (GridType == 0)
                {
                    AddContextualTab();

                    ClientScriptManager clientScriptManager = Page.ClientScript;
                    clientScriptManager.RegisterClientScriptBlock(GetType(), "MyTimesheet", DelayScript.Replace("{webPartPageComponentId}", SPRibbon.GetWebPartPageComponentId(this)).Replace("{TSOBJECT}", "TSObject" + sFullGridId));
                }
                CssRegistration.Register("/_layouts/epmlive/MyTimesheet.css");
                CssRegistration.Register("/_layouts/epmlive/modal/modal.css");

                ScriptLink.Register(Page, "/_layouts/epmlive/modal/modal.js", false);
                ScriptLink.Register(Page, "/_layouts/epmlive/dhtml/xgrid/dhtmlxcommon.js", false);

                EPMLiveCore.Infrastructure.EPMLiveScriptManager.RegisterScript(Page, new[]
                {
                    "/treegrid/GridE", "MyTimesheet"
                });

                //ScriptLink.Register(Page, "/_layouts/epmlive/MyTimesheet.js", false);

                ServicePointManager.ServerCertificateValidationCallback += delegate { return(true); };
            }
            base.OnPreRender(e);
            tb.StopTimer();
        }
コード例 #4
0
        protected override void CreateChildControls() {
            if (!Page.IsPostBack && !string.IsNullOrEmpty(InitPageComponentScript)) {

                var sp = new ScriptLink() {
                    Language = "javascript",
                    Name = "SP.js",
                    OnDemand = true,
                    Localizable = false,
                };
                var spribbon = new ScriptLink() {
                    Language = "javascript",
                    Name = "SP.Ribbon.js",
                    OnDemand = true,
                    Localizable = false,
                };
                var initialize = new ScriptLink() {
                    Language = "javascript",
                    Name = InitPageComponentScript,
                    LoadAfterUI = true,
                    Localizable = false,
                };
                Controls.Add(sp);
                Controls.Add(spribbon);
                Controls.Add(initialize);
            }
        }
コード例 #5
0
 protected override void OnPreRender(EventArgs e)
 {
     base.OnPreRender(e);
     ScriptLink.Register(Page, "/_layouts/epmlive/DHTML/xgrid/dhtmlxcommon.js", false);
     ScriptLink.Register(Page, "/_layouts/epmlive/DHTML/xgrid/dhtmlxgrid.js", false);
     ScriptLink.Register(Page, "/_layouts/epmlive/DHTML/xgrid/dhtmlxgridcell.js", false);
     ScriptLink.Register(Page, "/_layouts/epmlive/DHTML/xtreegrid/dhtmlxtreegrid.js", false);
 }
コード例 #6
0
 protected override void OnLoad(EventArgs e)
 {
     ScriptLink.Register(Page, "/_layouts/MediaExtensions/jquery.min.js", false);
     Page.ClientScript.RegisterClientScriptBlock(GetType(), "RibbonInit", RibbonInitScript, true);
     ScriptLink.Register(Page, "/_layouts/MediaExtensions/YTPlayer.js", false);
     Page.ClientScript.RegisterClientScriptBlock(GetType(), "youtube", "registerYTIFrameApi();", true);
     //Page.ClientScript.RegisterClientScriptBlock(GetType(), "youtube_player", "_spBodyOnLoadFunctionNames.push('loadYTPlayers');", true);
     Page.ClientScript.RegisterClientScriptBlock(GetType(), "youtube_player", "loadYTPlayers();", true);
 }
コード例 #7
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (ControlMode != SPControlMode.Display)
            {
                ScriptLink.Register(Page, "entityeditor.js", false);
            }
        }
コード例 #8
0
 protected override void OnPreRender(EventArgs e)
 {
     base.OnPreRender(e);
     EnsureCommentsListExist();
     EnsurePublicCommentsListExist();
     //ScriptLink.Register(Page, "/epmlive/javascripts/libraries/jquery.min.js", false);
     //ScriptLink.Register(Page, "/epmlive/slimScroll.js", false);
     //ScriptLink.Register(Page, "/epmlive/TextBoxAutoGrow.js", false);
     ScriptLink.Register(Page, "/epmlive/CommentsWebPart.js", false);
 }
コード例 #9
0
        public IHttpActionResult GetScriptLink(decimal id)
        {
            ScriptLink scriptlink = db.ScriptLinks.Find(id);

            if (scriptlink == null)
            {
                return(NotFound());
            }

            return(Ok(scriptlink));
        }
コード例 #10
0
        public IHttpActionResult PostScriptLink(ScriptLink scriptlink)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ScriptLinks.Add(scriptlink);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = scriptlink.ScriptLinkID }, scriptlink));
        }
コード例 #11
0
 private void WebSitePart_LoadNavigation(object sender, EventArgs e)
 {
     if (inEditMode)
     {
         CreateWebSitePartMenu();
         WebSitePartMenu menu = new WebSitePartMenu(this);
         menuControls.Controls.Add(menu);
         ScriptLink.Register(this.Page, "Hemrika/WebSitePart/Hemrika.SharePresence.WebSitePart.js", false, true);
         this.Controls.Add(menuControls);
         this.EnsureChildControls();
     }
 }
コード例 #12
0
 private static void MakeBrowserCacheSafeOrRemoveIfMissing(ScriptLink scriptLink)
 {
     try
     {
         // These are optional module, so trying to build these browser-cache-safe URLs may explode if the modules are missing
         scriptLink.Name = SPUtility.MakeBrowserCacheSafeLayoutsUrl(scriptLink.Name, false);
     }
     catch (SPException)
     {
         // Script not found, remove from page
         scriptLink.Parent.Controls.Remove(scriptLink);
     }
 }
コード例 #13
0
 private static void MakeBrowserCacheSafeOrRemoveIfMissing(ScriptLink scriptLink)
 {
     try
     {
         // These are optional module, so trying to build these browser-cache-safe URLs may explode if the modules are missing
         scriptLink.Name = SPUtility.MakeBrowserCacheSafeLayoutsUrl(scriptLink.Name, false);
     }
     catch (SPException)
     {
         // Script not found, remove from page
         scriptLink.Parent.Controls.Remove(scriptLink);
     }
 }
コード例 #14
0
        public IHttpActionResult DeleteScriptLink(decimal id)
        {
            ScriptLink scriptlink = db.ScriptLinks.Find(id);

            if (scriptlink == null)
            {
                return(NotFound());
            }

            db.ScriptLinks.Remove(scriptlink);
            db.SaveChanges();

            return(Ok(scriptlink));
        }
コード例 #15
0
        // Protected Methods (1) 

        protected void Page_Load(object sender, EventArgs e)
        {
            _jobId = Request.Params["jobid"] ?? string.Empty;
            string format            = Request.Params["format"] ?? string.Empty;
            bool   isImportCancelled = Convert.ToBoolean(Request.Params["isCancelImportResourceJob"]);

            if (!isImportCancelled)
            {
                if (!format.Trim().ToLower().Equals("json"))
                {
                    if (string.IsNullOrEmpty(_jobId))
                    {
                        MissingJobIdErrorLabel.Visible = true;
                    }
                    else
                    {
                        Panel.Visible = true;
                        ScriptLink.Register(Page, "/_layouts/epmlive/javascripts/libraries/jquery.min.js", false);
                    }
                }
                else
                {
                    string response = "{warmingUp:true}";

                    if (string.IsNullOrEmpty(_jobId))
                    {
                        response = "{error:\"No Job ID was provided.\"}";
                    }
                    else
                    {
                        XmlNode timerJobStatus = Timer.GetTimerJobStatus(Web, new Guid(_jobId));

                        XmlNode node = timerJobStatus.FirstChild;
                        if (node != null)
                        {
                            response = node.Value;
                        }
                    }

                    Response.Clear();
                    Response.ContentType = "application/json; charset=utf-8";
                    Response.Write(Server.HtmlDecode(response));
                    Response.End();
                }
            }
            else
            {
                Timer.CancelTimerJob(Web, new Guid(_jobId));
            }
        }
コード例 #16
0
        // Protected Methods (2) 

        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnPreRender(EventArgs e)
        {
            long ticks = DateTime.Now.Ticks;

            var javascripts = new[] { "treegrid/GridE.js", "javascripts/EPMLive.AssignmentPlanner.js" };

            foreach (string javascript in javascripts)
            {
                ScriptLink.Register(Page,
                                    string.Format("/_layouts/epmlive/{0}?v={1}", javascript,
                                                  InDebugMode ? (object)string.Empty : ticks), false);
            }

            ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => true;
        }
コード例 #17
0
        private void MakeBrowserCacheSafeOrRemoveIfMissing(ScriptLink scriptLink)
        {
            try
            {
                // These are optional module, so trying to build these browser-cache-safe URLs may explode if the modules are missing
                scriptLink.Name = SPUtility.MakeBrowserCacheSafeLayoutsUrl(scriptLink.Name, false);
            }
            catch (SPException ex)
            {
                // Script not found, remove from page
                scriptLink.Parent.Controls.Remove(scriptLink);

                // Current.Resolve<ILogger>().Info("Failed to find script in layouts folder. Removing script link from page: " + scriptLink.Name);
            }
        }
コード例 #18
0
        //public override Microsoft.SharePoint.WebControls.PickerEntity ValidateEntity(Microsoft.SharePoint.WebControls.PickerEntity entity)
        //{
        //    try
        //    {
        //        if (SPContext.Current.List == null || SPContext.Current.List.Title != "Resources")
        //        {
        //            this.ValidateResolvedEntity = false;
        //            entity = base.ValidateEntity(entity);

        //            XmlDocument docTeam = new XmlDocument();
        //            docTeam.LoadXml(WorkEngineAPI.GetTeam("<Filter Column='SharePointAccount' Value='" + entity.DisplayText + "'/>", SPContext.Current.Web));
        //            if (docTeam.FirstChild.SelectSingleNode("//Team/Member") == null)
        //                entity.IsResolved = false;
        //            else
        //            {
        //                if (docTeam.FirstChild.SelectSingleNode("//Team/Member").Attributes["Username"].Value.ToLower() != entity.EntityData["AccountName"].ToString().ToLower())
        //                {
        //                    entity.IsResolved = false;
        //                }
        //            }
        //        }
        //        else
        //            entity = base.ValidateEntity(entity);

        //    }
        //    catch { }
        //    return entity;
        //}


        protected override void OnPreRender(EventArgs e)
        {
            ScriptLink.Register(Page, "/_layouts/epmlive/CCPeopleEditorAutoComplete.js", false);
            // we are sharing style sheets between this control and GenericEntityPicker
            this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "_WEPeopleEditorStyle_", "<link href=\"/_layouts/epmlive/GenericEntityPickerStyle.css\" rel=\"stylesheet\" type=\"text/css\" />", false);

            if (!Page.ClientScript.IsClientScriptBlockRegistered("_WEPeopleEditorGlobalVariables_"))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "_WEPeopleEditorGlobalVariables_", "<script>var curWebURL = '" + SPContext.Current.Web.Url + "';</script>", false);
            }

            if (!Page.ClientScript.IsClientScriptBlockRegistered("_WEPeopleEditorGlobalObject_"))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "_WEPeopleEditorGlobalObject_", "<script>var _wePeopleEditorControlPropertyArray = new Array();</script>", false);
            }

            if (!Page.ClientScript.IsClientScriptBlockRegistered("_WEPeopleEditorGlobalDataCache_"))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "_WEPeopleEditorGlobalDataCache_", "<script>var _wePeopleEditorControlGlobalDataCache = new Array();</script>", false);
            }

            if (!Page.ClientScript.IsClientScriptBlockRegistered("_WEPeopleEditorControlProperties_" + this.ClientID))
            {
                this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "_WEPeopleEditorControlProperties_" + this.ClientID,
                                                                 "<script>" +
                                                                 "if (_wePeopleEditorControlPropertyArray) { " +
                                                                 "   var controlProps_" + this.ClientID + " = { wePeopleEditorDivIDRoot : '" + this.ClientID + "'," +
                                                                 "                                              wePeopleEditorDivID : '" + this.ClientID + "_upLevelDiv'," +
                                                                 "                                              wePeopleEdtiorCheckNameID : '" + this.ClientID + "_checkNames'," +
                                                                 "                                              ajaxHandlerPage : '" + PEOPLE_EDITOR_AJAX_HANDLER_PAGE + "', " +
                                                                 "                                              curWebURL : '" + SPContext.Current.Web.Url + "'," +
                                                                 "                                              isMultiSelect : " + this.MultiSelect.ToString().ToLower() + "," +
                                                                 "                                              searchText : '', " +
                                                                 "                                              singleSelectLookupVal : '', " +
                                                                 "                                              candidateIndex : '-1', " +
                                                                 "                                              autoCompleteDivID : 'autoCompleteDiv_" + this.ClientID + "', " +
                                                                 "                                              checkNamesOnClick : '', " +
                                                                 "                                              browseOnClick : '' }; " +
                                                                 "  var arrLength = _wePeopleEditorControlPropertyArray.length; " +
                                                                 "  _wePeopleEditorControlPropertyArray[arrLength] = controlProps_" + this.ClientID + "; " +
                                                                 "  }</script>", false);
            }

            // hides the book and validate button
            this.ShowButtons = false;

            base.OnPreRender(e);
        }
コード例 #19
0
        /// <summary>
        /// Adds the necessarry javascript to a page.
        /// </summary>
        /// <param name="page"></param>
        /// <param name="Text"></param>
        /// <param name="sticky">Specifies whether the notification stays on the page until removed.</param>
        public static void RenderNotification(Page page, string Text, bool sticky)
        {
            // Add SP.js
            ScriptLink.RegisterScriptAfterUI(page, "SP.js", false, true);
            ScriptLink.RegisterScriptAfterUI(page, "SP.Ribbon.js", false, true);

            var script = @"                
                SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () { });
                ExecuteOrDelayUntilScriptLoaded(showNotification, 'SP.js');
                function showNotification(){{
                    " + GetNotificationScript(page, Text, sticky) + @"
                }}
            ";

            ScriptManager.RegisterClientScriptBlock(page, typeof(Notification), string.Format("Notification:{0}", Text), script, true);
        }
コード例 #20
0
        protected override void OnPreRender(EventArgs e)
        {
            var list     = SPContext.Current.List;
            var listName = list != null ? list.Title : string.Empty;

            string viewName;
            var    viewContext = SPContext.Current.ViewContext;

            if (viewContext != null && viewContext.View != null)
            {
                viewName = viewContext.View.Title;
            }
            else
            {
                viewName = string.Empty;
            }

            ribbon         = SPRibbon.GetCurrent(Page);
            ribbonCommands = new List <IRibbonCommand>();

            RegisterRibbonExtension(SPContext.Current.Web, listName, viewName);

            if (isRegistedRibbons)
            {
                // Register required scripts
                ScriptLink.RegisterScriptAfterUI(Page, "CUI.js", false, true);
                ScriptLink.RegisterScriptAfterUI(Page, "SP.js", false, true);
                ScriptLink.RegisterScriptAfterUI(Page, "SP.Runtime.js", false, true);
                ScriptLink.RegisterScriptAfterUI(Page, "SP.Ribbon.js", false, true);

                // Register custom page component to handle custom ribbon commands
                if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "Register Ribbon Customization"))
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "Register Ribbon Customization",
                                                                RibbonCustomizationScript, true);
                }

                // Register custom ribbon commands
                var ribbonScriptManager = new SPRibbonScriptManager();
                ribbonScriptManager.RegisterGetCommandsFunction(Page, "getGlobalCommands", ribbonCommands);
                ribbonScriptManager.RegisterCommandEnabledFunction(Page, "commandEnabled", ribbonCommands);
                ribbonScriptManager.RegisterHandleCommandFunction(Page, "handleCommand", ribbonCommands);
            }

            base.OnPreRender(e);
        }
コード例 #21
0
        /// <summary>
        /// Renders the necessarry javascript on a given page.
        /// </summary>
        /// <param name="page"></param>
        /// <param name="Title"></param>
        /// <param name="Text"></param>
        /// <param name="HideAtBeginning"></param>
        /// <param name="Color"></param>
        public static void RenderStatusBar(Page page, string Title, string Text, bool HideAtBeginning, StatusBarColor Color)
        {
            ScriptLink.RegisterScriptAfterUI(page, "SP.js", false, true);
            var script = string.Format(@"
               window.onload = function () {{
                ExecuteOrDelayUntilScriptLoaded(addStatusBar, 'SP.js');
                function addStatusBar(){{
                    var sid = SP.UI.Status.addStatus(""{0}"", ""{1}"", {2});
                    {3}
                }}
                //addStatusBar();
                }}
            ", Title, Text, (!HideAtBeginning).ToString().ToLower(),
                                       Color != StatusBarColor.None ? string.Format("SP.UI.Status.setStatusPriColor(sid, '{0}');", Enum.GetName(typeof(StatusBarColor), Color).ToLower()) : "");

            ScriptManager.RegisterClientScriptBlock(page, typeof(StatusBar), string.Format("StatusBar:{0}", Title), script, true);
        }
コード例 #22
0
        protected override void OnPreRender(EventArgs e)
        {
            //ScriptLink.Register(Page, "/_layouts/epmlive/jQueryLibrary/jquery-1.6.2.min.js", false);

            Page.ClientScript.RegisterClientScriptBlock(GetType(), "_ChangeButtonToOpenInModal_",
                                                        "<script>" +
                                                        "var webUrl = '" + Web.Url + "'; " +
                                                        "var btnNewNavId = '" + newNavNode.ClientID + "_LinkText'; " +
                                                        "var btnNewCatId = '" + newCatNode.ClientID + "_LinkText'; " +
                                                        "var btnReorderId = '" + btnReorderNavNodes.ClientID + "_LinkText'; " +
                                                        "var appId = '" + _appId.ToString() + "';" +
                                                        "</script>", false);

            ScriptLink.Register(Page, "/_layouts/epmlive/EPMLiveQuickLaunch.js", false);

            base.OnPreRender(e);
        }
コード例 #23
0
        protected override void OnLoad(EventArgs e)
        {
            if (this.Page.Request["__EVENTTARGET"] == Constants.CleanupPostBackEvent)
            {
                var listId = new Guid(this.Page.Request["__EVENTARGUMENT"]);
                var web    = SPContext.Current.Web;

                CleanupUtility.AddCleanupWorkitem(web, listId);

                ScriptLink.RegisterScriptAfterUI(this.Page, "sp.js", false, true);
                var scriptText = ScriptLink.BuildDelayedExecutionScript("sp.js",
                                                                        "SP.UI.Notify.addNotification",
                                                                        "'Library submitted to cleanup'", "false");

                this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
                                                                 Constants.CleanupPostBackEvent,
                                                                 "function showPostBackNotification() {" + scriptText + "} _spBodyOnLoadFunctionNames.push('showPostBackNotification');",
                                                                 true);
            }
        }
コード例 #24
0
        private void CreateUpload(Control parent)
        {
            if (this.Enabled)
            {
                ScriptLink.RegisterScriptAfterUI(this.Page, "/Hemrika/Content/js/HTML5VideoUpload.js", false);
                FindBrowseParent(parent);

                upload = new HyperLink();
                if (BrowseParent != null)
                {
                    BrowseParent.Controls.Add(new LiteralControl(SPHttpUtility.NoEncode("&#160;")));
                    upload.ID = "upload";
                    upload.Attributes.Add("onclick", "UploadHTML5Video('{0}', '{1}', '{2}');return false;");
                    upload.NavigateUrl = @"javascript:UploadHTML5Video('{0}', '{1}', '{2}')";
                    upload.ImageUrl    = "/_layouts/Hemrika/Content/images/HTML5ImageAdd_16.png";
                    upload.Text        = "Upload";
                    BrowseParent.Controls.Add(upload);
                    EnsureChildControls();
                }
            }
        }
コード例 #25
0
        private static void MakeBrowserCacheSafeOrRemoveIfMissing(ScriptLink scriptLink)
        {
            try
            {
#if DEBUG
                if (!scriptLink.Name.Contains("/Lib/"))
                {
                    // we want to be able to debug our JS files more easily
                    scriptLink.Name = scriptLink.Name.Replace(".min.js", ".js");
                }
#endif

                // These are optional module, so trying to build these browser-cache-safe URLs may explode if the modules are missing
                scriptLink.Name = SPUtility.MakeBrowserCacheSafeLayoutsUrl(scriptLink.Name, false);
            }
            catch (SPException)
            {
                // Script not found, remove from page
                scriptLink.Parent.Controls.Remove(scriptLink);
            }
        }
コード例 #26
0
ファイル: BaseUserControl.cs プロジェクト: setsunafjava/vpsp
        /// <summary>
        ///   Register the required script for the ribbon extension
        /// </summary>
        protected void RegisterRibbonScript()
        {
            // Register required scripts
            ScriptLink.RegisterScriptAfterUI(Page, "CUI.js", false, true);
            ScriptLink.RegisterScriptAfterUI(Page, "SP.js", false, true);
            ScriptLink.RegisterScriptAfterUI(Page, "SP.Runtime.js", false, true);
            ScriptLink.RegisterScriptAfterUI(Page, "SP.Ribbon.js", false, true);

            // Register custom page component to handle custom ribbon commands
            if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "Register Ribbon Customization"))
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "Register Ribbon Customization",
                                                            RibbonCustomizationScript, true);
            }

            // Register custom ribbon commands
            var ribbonScriptManager = new SPRibbonScriptManager();

            ribbonScriptManager.RegisterGetCommandsFunction(Page, "getGlobalCommands", RibbonCommands);
            ribbonScriptManager.RegisterCommandEnabledFunction(Page, "commandEnabled", RibbonCommands);
            ribbonScriptManager.RegisterHandleCommandFunction(Page, "handleCommand", RibbonCommands);
        }
コード例 #27
0
        void PageLoadCompleted(object sender, EventArgs e)
        {
            string webUrl = String.Empty;

            try
            {
                Page page = sender as Page;

                if (page != null)
                {
                    string currentRequestUrl = HttpContext.Current.Request.Url.AbsolutePath.ToString().Trim().ToLower();

                    webUrl = SPContext.Current.Web.Url.ToLower();

                    //if (isCurrentRequestContainsOOTBUrl(currentRequestUrl, webUrl))
                    //{
                        Control ctrl = page.Master.FindControl("PlaceHolderMain");

                        if (ctrl != null)
                        {
                            ScriptLink script = new ScriptLink();
                            script.ID = "sptlnkJavaScript";
                            script.Defer = true;
                            script.Localizable = true;
                            script.Name = "/_layouts/macros.core/extjs/ext-all-dev.js";
                            ctrl.Controls.Add(script);

                            //script = new ScriptLink();
                            //script.ID = "sptlnkJavaScript2";
                            //script.Defer = true;
                            //script.Localizable = true;
                            //script.Name = "https://s3-eu-west-1.amazonaws.com/macros-sp-dev/MacrosSP/macros.all.js";
                            //ctrl.Controls.Add(script);

                        }
                    //}
                }
            }
            catch (SPException)
            {
            }
            catch (Exception)
            {
            }
        }
コード例 #28
0
 protected override void OnPreRender(EventArgs e)
 {
     ScriptLink.RegisterScriptAfterUI(this.Page, "OpenWOPI.SharePoint/previews.js", false);
 }
コード例 #29
0
 private void RegisterScripts()
 {
     ScriptLink.Register(Page, "/_layouts/epmlive/treegrid/GridE.js", false);
 }
コード例 #30
0
 protected override void OnPreRender(EventArgs e)
 {
     // Register Script to page
     ScriptLink.Register(Page, "jQuery/jquery.js", false);
     base.OnPreRender(e);
 }
コード例 #31
0
        protected override void CreateChildControls()
        {
            RosterConfigService configProvider = new RosterConfigService();
            var lists = configProvider.GetLists();

            ddlCatalogs          = new DropDownList();
            ddlCatalogs.ID       = "catalogSelector";
            ddlCatalogs.CssClass = "lists_control";
            ddlCatalogs.Attributes.Add("onchange", "UpdateViewsList(this);");
            ddlCatalogs.Items.AddRange(lists.Select(x => new ListItem(x.Name, x.Id.ToString())).ToArray());

            ddlViews          = new DropDownList();
            ddlViews.ID       = "viewSelector";
            ddlViews.CssClass = "views_control";
            ddlViews.Items.AddRange(lists.SelectMany(x => x.ViewMetadatas).Select(v => new ListItem(v.Name, v.Id.ToString())).ToArray());

            hidAllViewsInfo       = new HiddenField();
            hidAllViewsInfo.ID    = "hidAllViewsHierarchy";
            hidAllViewsInfo.Value = new JavaScriptSerializer().Serialize(lists.Select(x => new { list = x.Id, views = x.ViewMetadatas.Select(v => new { viewId = v.Id, viewName = v.Name }) }));

            txtRelationFld    = new TextBox();
            txtRelationFld.ID = "txtRelationField";

            txtFilterOperators    = new TextBox();
            txtFilterOperators.ID = "txtFilterOperators";

            txtCalendarWidth    = new TextBox();
            txtCalendarWidth.ID = "txtCalendarWidth";

            txtCalendarHeight    = new TextBox();
            txtCalendarHeight.ID = "txtCalendarHeight";

            chEditMode      = new CheckBox();
            chEditMode.ID   = "chEditMode";
            chEditMode.Text = "Edit mode? (GridView only)";

            chDisplayPrepopulated      = new CheckBox();
            chDisplayPrepopulated.ID   = "chDisplayPrepopulated";
            chDisplayPrepopulated.Text = "Display pre-populated? (CalendarView only)";

            this.Controls.Add(ddlCatalogs);
            this.Controls.Add(ddlViews);
            this.Controls.Add(hidAllViewsInfo);
            this.Controls.Add(txtRelationFld);
            this.Controls.Add(txtFilterOperators);
            this.Controls.Add(txtCalendarWidth);
            this.Controls.Add(txtCalendarHeight);
            this.Controls.Add(chEditMode);
            this.Controls.Add(chDisplayPrepopulated);
            ScriptLink.Register(this.Page, "/_layouts/15/Roster.Presentation/js/cascadeSelection.view.js", true);

            //setting the last set values as current values on custom toolpart
            ExternalListViewWebPart wp = (ExternalListViewWebPart)this.ParentToolPane.SelectedWebPart;

            if (wp != null)
            {
                this.ddlCatalogs.SelectedValue     = wp.CatalogId;
                this.ddlViews.SelectedValue        = wp.ViewName;
                this.txtRelationFld.Text           = wp.RelationField;
                this.txtFilterOperators.Text       = wp.FilterOperators;
                this.txtCalendarWidth.Text         = wp.CalendarWidth;
                this.txtCalendarHeight.Text        = wp.CalendarHeight;
                this.chEditMode.Checked            = wp.EditMode;
                this.chDisplayPrepopulated.Checked = wp.DisplayPrepopulated;
            }

            base.CreateChildControls();
        }
コード例 #32
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="System.EventArgs"/> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     ScriptLink.Register(this.Page, jqueryScript, false);
     ScriptLink.Register(this.Page, jqueryUIScript, false);
     CssRegistration.Register(jqueryCss);
 }
コード例 #33
0
        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);
            }
        }
コード例 #34
0
        protected override void OnPreRender(EventArgs e)
        {
            Page.ClientScript.RegisterClientScriptBlock(
                Page.GetType(),
                "_LookupFieldsPropsArray_",
                "<script> if (!_LookupFieldsPropsArray) { var _LookupFieldsPropsArray = new Array(); } </script>",
                false);

            var fieldName = LookupData.Field != "none"
                ? LookupData.Field
                : LookupField.InternalName;
            var type = LookupData.Type;

            parent = LookupData.Parent;
            var parentListField = LookupData.ParentListField;

            Page.ClientScript.RegisterClientScriptBlock(
                Page.GetType(),
                "_LookupFieldsPropsArray_Edit_" + ClientID,
                "<script>" +
                "if (_LookupFieldsPropsArray) { " +
                "   var lookupFieldProp_" + fieldName + " = { FieldName : '" + fieldName + "', " +
                "                                             ControlType: '" + type + "', " +
                "                                             FieldInfo: { LookupWebId: '" + LookupField.LookupWebId.ToString() + "', " +
                "                                                          LookupListId: '" + LookupField.LookupList.ToString() + "', " +
                "                                                          LookupField: '" + LookupField.LookupField.ToString() + "' }, " +
                "                                             ControlInfo:  { DropDownClientId: '" + (DropList != null ? DropList.ClientID : string.Empty) + "', " +
                "                                                             TextBoxClientId: '" + (TextField != null ? TextField.ClientID : string.Empty) + "', " +
                "                                                             DropImageClientId: '" + (DropImage != null ? DropImage.ClientID : string.Empty) + "', " +
                "                                                             CurWebURL: '" + SPContext.Current.Web.Url + "', " +
                "                                                             IsMultiSelect: " + propBag.IsMultiSelect.ToLower() + ", " +
                "                                                             SourceControlId: '" + propBag.SourceControlID + "', " +
                "                                                             SearchText: '', " +
                "                                                             SingleSelectLookupVal: '', " +
                "                                                             SingleSelectDisplayVal: ''}, " +
                "                                             Parent: '" + parent + "', " +
                "                                             ParentListField: '" + parentListField + "', " +
                "                                             CachedValue: ''};" +
                "  var arrLength = _LookupFieldsPropsArray.length; " +
                "  _LookupFieldsPropsArray[arrLength] = lookupFieldProp_" + fieldName + "}; " +
                "</script>"
                , false);

            var fileVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location)
                              .FileVersion;

            if (string.IsNullOrWhiteSpace(fileVersion) || fileVersion.Equals("1.0.0.0"))
            {
                fileVersion = DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture);
            }

            ScriptLink.Register(Page, "/_layouts/epmlive/ModifiedDropDown.js?v=" + fileVersion, false);

            base.OnPreRender(e);

            if (!string.IsNullOrWhiteSpace(parent))
            {
                Page.ClientScript.RegisterStartupScript(
                    GetType(),
                    "_HideChildCascadeField_" + ClientID,
                    "function HideControl_" + ClientID + "(){ " +
                    "   if ($('#" + ClientID + "').length > 0){ " +
                    "       $('#" + ClientID + "').prop('disabled', true); " +
                    "   } else { " +
                    "       setTimeout(HideControl_" + ClientID + ", 500); " +
                    "   } " +
                    "} " +
                    "$(document).ready(function () { " +
                    "HideControl_" + ClientID + "();" +
                    "});",
                    true);
            }
        }
コード例 #35
0
        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);
            }
        }