// Protected Methods (1) 

        /// <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)
        {
            string message = string.Empty;

            EPMLiveCore.Act act = new EPMLiveCore.Act(SPContext.Current.Web);
            int             featureLicenseStatus = act.CheckFeatureLicense(EPMLiveCore.ActFeature.WebParts);

            if (featureLicenseStatus != 0)
            {
                Response.Write(act.translateStatus(featureLicenseStatus));
                return;
            }

            if (!string.IsNullOrEmpty(ContentLocation))
            {
                Uri uri;
                if (Uri.TryCreate(ContentLocation, UriKind.Absolute, out uri))
                {
                    SlideOutId = Path.GetFileNameWithoutExtension(uri.LocalPath);

                    if (IsSlideOutVisible())
                    {
                        try
                        {
                            DisplaySlideOut(uri);
                        }
                        catch (WebException)
                        {
                            ContentPanel.Visible = false;
                            message = string.Format(@"<strong>ERROR: </strong> Unable to connect to: {0}",
                                                    ContentLocation);
                        }
                    }
                    else
                    {
                        ContentPanel.Visible = false;
                    }
                }
                else
                {
                    message = string.Format(@"<strong>ERROR: </strong> {0} is not a valid URL.",
                                            ContentLocation);
                }
            }
            else
            {
                message = @"<strong>ERROR: </strong> Please provide a valid Content Location URL.";
            }

            if (string.IsNullOrEmpty(message))
            {
                return;
            }

            DisplayMessage(message);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Act act = new Act(Web);

            if (act.CheckFeatureLicense(ActFeature.AppsAndCommunities) != 0)
            {
                Microsoft.SharePoint.Utilities.SPUtility.Redirect("epmlive/applications/noact.aspx", Microsoft.SharePoint.Utilities.SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current);
            }

            API.ApplicationDef appDef = API.Applications.GetApplicationInfo(Request["AppId"]);

            ApplicationName = appDef.Title;
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Act act = new Act(Web);

            if (act.CheckFeatureLicense(ActFeature.AppsAndCommunities) != 0)
            {
                Microsoft.SharePoint.Utilities.SPUtility.Redirect("epmlive/applications/noact.aspx", Microsoft.SharePoint.Utilities.SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current);
            }

            SPList oList = API.Applications.GetApplicationList(Web);

            SPListItem li = oList.GetItemById(int.Parse(Request["AppId"]));

            ApplicationName = li.Title;

            try
            {
                extapp = li["EXTID"].ToString();
            }
            catch { }
        }
예제 #4
0
        protected override void RenderWebPart(HtmlTextWriter output)
        {
            EPMLiveCore.Act act        = new EPMLiveCore.Act(SPContext.Current.Web);
            int             activation = act.CheckFeatureLicense(EPMLiveCore.ActFeature.WebParts);

            if (activation != 0)
            {
                output.Write(act.translateStatus(activation));
                return;
            }

            SPWeb  cWeb  = SPContext.Current.Web;
            SPSite cSite = SPContext.Current.Site;

            var sPubComTxt = string.Empty;

            try {
                sPubComTxt = CoreFunctions.getConfigSetting(cWeb, "EPMLivePublicCommentText");
                sPubComTxt = HttpUtility.JavaScriptStringEncode(sPubComTxt);
            }
            catch { }

            if (string.IsNullOrEmpty(sPubComTxt))
            {
                sPubComTxt = "What are you working on?";
            }

            SPUser user = cWeb.CurrentUser;

            //get user picture from user id
            SPList     userInfoList   = cWeb.SiteUserInfoList;
            SPListItem userItem       = userInfoList.GetItemById(user.ID);
            string     userPictureUrl = cSite.MakeFullUrl(cWeb.ServerRelativeUrl) + "/_layouts/epmlive/images/O14_person_placeHolder_32.png";

            SPField fldPicture = null;

            try
            {
                fldPicture = userItem.Fields.GetFieldByInternalName("Picture");
            }
            catch (ArgumentException x)
            {
                fldPicture = null;
            }

            if (fldPicture != null)
            {
                try
                {
                    string[] picUrls = userItem[userItem.Fields.GetFieldByInternalName("Picture").Id].ToString().Split(',');
                    userPictureUrl = picUrls[0];
                }
                catch
                {
                    userPictureUrl = cSite.MakeFullUrl(cSite.ServerRelativeUrl) + "/_layouts/epmlive/images/O14_person_placeHolder_32.png";
                }
            }
            string userProfileUrl = cSite.MakeFullUrl(cWeb.ServerRelativeUrl) + "/_layouts/userdisp.aspx?Force=True&ID=" + user.ID + "&source=" + HttpContext.Current.Request.UrlReferrer;

            var defaultHeight = 500;

            output.Write("<script>" +
                         "curWebUrl = '" + cWeb.Url + "';" +
                         "curWebTitle = '" + HttpUtility.JavaScriptStringEncode(cWeb.Title) + "';" +
                         "userProfileUrl = '" + userProfileUrl + "';" +
                         "userEmail = '" + user.Email + "';" +
                         "userPicUrl = '" + userPictureUrl + "';" +
                         "userName = '******';" +
                         "numThreads = '" + this.NumThreads.ToString() + "';" +
                         "maxComments = '" + this.MaxComments.ToString() + "';" +
                         "sPubComTxt = '" + sPubComTxt + "';" +
                         "defaultHeight = '" + (int.TryParse(this.DefaultHeight, out defaultHeight) ? defaultHeight : 500) + "px';" +
                         "</script>");

            output.Write("<link rel=\"STYLESHEET\" type=\"text/css\" href=\"" + (cWeb.ServerRelativeUrl == "/" ? "" : cWeb.ServerRelativeUrl) + "/_layouts/epmlive/Comments.UI.css\"/>");
            output.Write("<link rel=\"STYLESHEET\" type=\"text/css\" href=\"" + (cWeb.ServerRelativeUrl == "/" ? "" : cWeb.ServerRelativeUrl) + "/_layouts/epmlive/CommentsWebPartStyle.css\"/>");

            output.Write(@"<div id='wrapper' class='divPublicCommentContainer'>
                            <table>
                                <tbody>
			                        <tr>
				                        <td valign='middle' align='left' id='commentTblc1'>
					                        <div id='comment-photo'>
                                                <img src='" + userPictureUrl + @"' class='circleborder' />
                                            </div>
				                        </td>
				                        <td valign='middle' align='left' style='padding-left:8px;padding-right:5px;' id='commentTblc2'>
					                        <div id='whatsup'>
                                                <div class='comment-box'>
                                                    <div id='inputPublicComment' class='comment-paragraph' contenteditable='true'>
                                                    </div>
                                                </div>
                                            </div>
				                        </td>
				                        <td valign='middle' align='left' id='commentTblc3'>
					                        <div class='general-button-wrapper'><a id='btnGeneralPost' href='#' class='btn-primary btn btn-small' style='text-decoration:none;'>Share</a></div>
				                        </td>
			                        </tr>
		                        </tbody>
                            </table>
                        </div>");

            output.Write("<div style=\"clear:both;\"></div>");

            output.Write("<div id=\"commentsWebPartMainContainer\" class=\"commentsWPMainContainer\">");
            output.Write("<div style=\"clear:both;\"></div>");

            output.Write(_loadingHtml);
            output.Write("<div style=\"clear:both;height:5px\"></div>");
            output.Write(_noCommentHtml);
            output.Write("</div>");
        }
예제 #5
0
        protected override void CreateChildControls()
        {
            act = new EPMLiveCore.Act(SPContext.Current.Web);
            int activation = act.CheckFeatureLicense(EPMLiveCore.ActFeature.WebParts);

            if (activation != 0)
            {
                return;
            }

            //base.CreateChildControls();
            MainTable = new HtmlTable();
            InitializeBubbleChartInputs();

            // Diagnostics
            Chart.PropTrace            = Page.Request.QueryString["charttrace"] != null;
            Chart.ChartLookupField     = Page.Request.QueryString["lookupfield"];
            Chart.ChartLookupFieldList = Page.Request.QueryString["lookupfieldlist"];

            if (_myProvider != null)
            {
                Chart.ReportFilterWebPartId = _myProvider.ReportID;
            }

            Chart.PropChartWebPartId = ID;

            Chart.BubbleChartUserSettings = GetPersistedBubbleChartPersonalizations();

            _litVfChart = new LiteralControl(Chart.GetHtml(ZoneID + ZoneIndex));

            var currentWebPartManager = WebPartManager.GetCurrentWebPartManager(Page);

            if (currentWebPartManager != null &&
                ((String.IsNullOrEmpty(PropChartSelectedList.Trim()) &&
                  currentWebPartManager.DisplayMode.Name == "Design") ||
                 (PropChartSelectedList.Trim() == "<Select List>" && currentWebPartManager.DisplayMode.Name == "Browse")))
            {
                ConfigureChartVerbiageLiteral.Text =
                    "<P><DIV class=\"UserGeneric\"><br />To configure the EPM Live Chart Web Part <a href=\"javascript:MSOTlPn_ShowToolPane2Wrapper('Edit', this, '" +
                    ID + "')\">click here</a>.<br /><br /></DIV></P>";
                Controls.Add(ConfigureChartVerbiageLiteral);
            }

            if (IsBubbleChart())
            {
                using (var site = new SPSite(SPContext.Current.Site.Url))
                {
                    using (var web = site.OpenWeb(SPContext.Current.Web.ID))
                    {
                        var selectedList = web.Lists[PropChartSelectedList];

                        if (selectedList == null)
                        {
                            return;
                        }
                        PopulateBubbleChartInputsWithInitialValues(selectedList);

                        if (Chart.BubbleChartUserSettings != null && Chart.BubbleChartUserSettings.IsValid && selectedList.ID == Chart.BubbleChartUserSettings.ListId)
                        {
                            SetBubbleChartInputSelectionsBasedOnPersonalizationSettings(Chart.BubbleChartUserSettings, selectedList);
                        }
                        else
                        {
                            SetBubbleChartInputsBasedOnWebPartProperties();
                        }
                    }
                }
            }

            var tableRow  = new HtmlTableRow();
            var chartCell = new HtmlTableCell();

            chartCell.Attributes.Add("valign", "top");

            var userSettingsCell = new HtmlTableCell();

            userSettingsCell.Attributes.Add("valign", "top");
            userSettingsCell.Attributes.Add("style", "padding-top:12px;");

            chartCell.Controls.Add(_litVfChart);

            MainTable.Attributes.Add("width", "100%");

            if (PropChartShowBubbleChartInputsInWebPart)
            {
                chartCell.Attributes.Add("width", "80%");
                userSettingsCell.Controls.Add(UserSettingsTable);
            }

            tableRow.Controls.Add(chartCell);

            if (IsBubbleChart())
            {
                tableRow.Controls.Add(userSettingsCell);
            }

            MainTable.Controls.Add(tableRow);

            Controls.Add(MainTable);
        }