コード例 #1
0
    private ICollection CreateContentFlagSource(ContentFlagData[] FlagList)
    {
        DataTable dt = new DataTable();
        DataRow dr;
        EkDTSelector dtS;
        dtS = common.EkDTSelectorRef;
        dt.Columns.Add(new DataColumn("USERNAME", typeof(string)));
        dt.Columns.Add(new DataColumn("DATETIME", typeof(string)));
        dt.Columns.Add(new DataColumn("FLAG", typeof(string)));
        dt.Columns.Add(new DataColumn("COMMENTS", typeof(string)));

        for (int i = 0; i <= (FlagList.Length - 1); i++)
        {
            dr = dt.NewRow();
            if (FlagList[i].FlaggedUser.Id == 0)
            {
                dr[0] = "<font color=\"gray\">" + this._MessageHelper.GetMessage("lbl anon") + "</font>";
            }
            else
            {
                dr[0] = FlagList[i].FlaggedUser.DisplayName;
            }
            dr[1] = GetFlagEditURL(FlagList[i].FlagId, Convert.ToString(FlagList[i].FlagDate));
            dr[2] = FlagList[i].FlagName;
            dr[3] = FlagList[i].FlagComment;
            dt.Rows.Add(dr);
        }
        DataView dv = new DataView(dt);
        return dv;
    }
コード例 #2
0
    private void LoadContentFlags(ContentFlagData[] FlagList)
    {
        dg_flag.DataSource = this.CreateContentFlagSource(FlagList);
        dg_flag.CellPadding = 3;

        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "USERNAME";
        colBound.HeaderText = _MessageHelper.GetMessage("display name label");
        //colBound.HeaderStyle.CssClass = "title-header"
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.ItemStyle.Wrap = false;
        dg_flag.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "DATETIME";
        colBound.HeaderText = _MessageHelper.GetMessage("generic date no colon");
        //colBound.HeaderStyle.CssClass = "title-header"
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.ItemStyle.Wrap = false;
        dg_flag.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "FLAG";
        colBound.HeaderText = _MessageHelper.GetMessage("flag label");
        //colBound.HeaderStyle.CssClass = "title-header"
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.ItemStyle.Wrap = false;
        dg_flag.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "COMMENTS";
        colBound.HeaderText = _MessageHelper.GetMessage("comment text");
        //colBound.HeaderStyle.CssClass = "title-header"
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.ItemStyle.Wrap = true;
        dg_flag.Columns.Add(colBound);

        dg_flag.DataBind();
    }
コード例 #3
0
ファイル: reports.aspx.cs プロジェクト: jaytem/minGit
    private ICollection CreateContentFlagSource(ContentFlagData[] FlagList)
    {
        DataTable dt = new DataTable();
        DataRow dr;
        EkDTSelector dtS;
        dtS = _ContentApi.EkDTSelectorRef;

        dt.Columns.Add(new DataColumn("TITLE", typeof(string)));
        dt.Columns.Add(new DataColumn("USERNAME", typeof(string)));
        dt.Columns.Add(new DataColumn("DATETIME", typeof(string)));
        dt.Columns.Add(new DataColumn("FLAG", typeof(string)));
        dt.Columns.Add(new DataColumn("COMMENTS", typeof(string)));

        for (int i = 0; i <= (FlagList.Length - 1); i++)
        {
            if ((FlagList[i]).LanguageId == _ContentApi.ContentLanguage)
            {
                dr = dt.NewRow();
                if (FlagList[i].ContentType == 1)
                {
                    if (FlagList[i].SubType == EkEnumeration.CMSContentSubtype.WebEvent)
                    {
                        dr[0] = "<img src=" + _ContentApi.AppPath + "images/ui/icons/calendarViewDay.png" + "></img>&nbsp;";
                    }
                    else
                    {
                        dr[0] = "<img src=" + _ContentApi.AppPath + "images/ui/icons/contentHtml.png" + "></img>&nbsp;";
                    }
                }
                else if (FlagList[i].ContentType == 2)
                {
                    dr[0] = "<img src=" + _ContentApi.AppPath + "images/ui/icons/contentForm.png" + "></img>&nbsp;";
                }
                else
                {
                    dr[0] = "<img src=" + FlagList[i].AssetData.Icon + "></img>&nbsp;";
                }
                // dr(0) = "<a href=""contentflagging/addeditcontentflag.aspx?action=view&id=" & FlagList(i).EntryId.ToString() & "&cid=" & FlagList(i).Id.ToString() & """>" & FlagList(i).Title & "</a>"
                dr[0] += "<a href=\"ContentFlagging/addeditcontentflag.aspx?action=view&id=" + FlagList[i].FlagId.ToString() + "&cid=" + FlagList[i].Id.ToString() + "\">" + FlagList[i].Title + "</a>";
                if (FlagList[i].FlaggedUser.Id == 0)
                {
                    dr[1] = "<font color=\"gray\">" + this._MessageHelper.GetMessage("lbl anon") + "</font>";
                }
                else
                {
                    dr[1] = FlagList[i].FlaggedUser.DisplayName;
                }
                dr[2] = FlagList[i].FlagDate.ToShortDateString();
                dr[3] = FlagList[i].FlagName;
                dr[4] = FlagList[i].FlagComment;
                dt.Rows.Add(dr);
            }
        }
        DataView dv = new DataView(dt);
        return dv;
    }
コード例 #4
0
ファイル: AJAXbase.aspx.cs プロジェクト: jaytem/minGit
    public string Handler_AddEditContentFlag()
    {
        StringBuilder sbRet = new StringBuilder();
            ContentAPI apiContent = new ContentAPI();
            Ektron.Cms.Community.FlaggingAPI apiFlagging = new Ektron.Cms.Community.FlaggingAPI();
            long iFlag = 0;
            long iContent = 0;
            int iLang = 0;
            long iret = 0;
            string sComment = "";
            string sKey = "";
            ContentFlagData cfFlag = new ContentFlagData();
            try
            {
                string visitorid;

                // Check and see if the cookie has been set by the user
                if (Page.Request.Cookies["ekContentRatingID"] == null && ! Page.IsPostBack)
                {
                    visitorid = (string) (System.Guid.NewGuid().ToString().Replace("-", ""));
                    Page.Response.Cookies.Add(new System.Web.HttpCookie("ekContentRatingID", visitorid));
                    Page.Response.Cookies["ekContentRatingID"].Expires = DateTime.MaxValue;
                }
                else
                {
                    try
                    {
                        visitorid = Page.Request.Cookies["ekContentRatingID"].Value;
                    }
                    catch (Exception)
                    {
                        visitorid = string.Empty;
                    }
                }
                if (Request.QueryString["comment"] != "")
                {
                    sComment = Ektron.Cms.Common.EkFunctions.HtmlEncode(Request.QueryString["comment"]);
                }
                if (Request.QueryString["lang"] != "")
                {
                    iLang = Convert.ToInt32(Request.QueryString["lang"]);
                }
                iFlag = Convert.ToInt64(Request.QueryString["flag"]);
                iContent = Convert.ToInt64(Request.QueryString["contentid"]);
                sKey = EkFunctions.HtmlEncode(Request.QueryString["key"]);
                if (apiFlagging.ContentLanguage < 1 && iLang > 0)
                {
                    apiFlagging.ContentLanguage = iLang;
                }
                ObjectFlagData objectFlag = new ObjectFlagData();
                ContentFlagData fdRet = null;
                try
                {
                    fdRet = apiFlagging.GetContentFlagData(iContent, apiContent.UserId, visitorid);

                    if (fdRet.EntryId == 0)
                    {
                        objectFlag.FlagComment = sComment;
                        objectFlag.FlagItemId = iFlag;
                        objectFlag.VisitorID = visitorid;
                        objectFlag.UserId = apiContent.UserId;
                        objectFlag.ObjectId = iContent;
                        objectFlag.ObjectType = Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Content;
                        objectFlag.ObjectLanguageId = iLang;
                        iret = apiFlagging.AddFlagObject(objectFlag);
                    }
                    else
                    {
                        objectFlag.FlagComment = sComment;
                        objectFlag.FlagItemId = iFlag;
                        objectFlag.FlagId = fdRet.FlagDefinition.ID;
                        objectFlag.VisitorID = fdRet.VisitorID;
                        objectFlag.UserId = fdRet.FlaggedUser.Id;
                        objectFlag.ObjectId = fdRet.Id;
                        objectFlag.ObjectType = Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Content;
                        objectFlag.ObjectLanguageId = fdRet.LanguageId;
                        objectFlag.FlagEntryId = fdRet.EntryId;
                        apiFlagging.UpdateFlagObject(objectFlag);
                        iret = fdRet.EntryId;
                    }
                }
                catch (Exception ex)
                {
                    EkException.ThrowException(ex);
                }
                //cfFlag = apiContent.AddContentFlag(iContent, visitorid, iFlag, sComment)

                sbRet.Append("  <method>AddEditFlag</method>").Append(Environment.NewLine);
                sbRet.Append("  <result>").Append(iFlag).Append("</result>").Append(Environment.NewLine);
                sbRet.Append("  <key>").Append(sKey).Append("</key>").Append(Environment.NewLine);
                return sbRet.ToString();
            }
            catch (Exception)
            {

            }

            return sbRet.ToString();
    }
コード例 #5
0
 protected void Process_Edit()
 {
     cfFlag = this.m_refContentApi.EkContentRef.GetContentFlag(this.m_iID);
     if (cfFlag.EntryId > 0)
     {
         cfFlag.FlagComment = (string)this.txt_comment.Text;
         cfFlag.FlagId = long.Parse(drp_flag_data.SelectedValue);
         cfFlag = this.m_refContentApi.EkContentRef.UpdateContentFlag(cfFlag);
     }
     string pagemode = (string)("&page=" + Request.QueryString["page"]);
     Response.Redirect(m_sPage + "?action=view&id=" + this.m_iID + "&cid=" + this.content_id + pagemode, false);
 }
コード例 #6
0
 protected void Process_Delete()
 {
     cfFlag = this.m_refContentApi.EkContentRef.GetContentFlag(this.m_iID);
     if (cfFlag.EntryId > 0)
     {
         this.m_refContentApi.EkContentRef.DeleteContentFlag(cfFlag.EntryId);
     }
     if (Request.QueryString["page"] == "workarea")
     {
         // redirect to workarea
         Response.Write("<script language=\"Javascript\">" + "top.switchDesktopTab();" + "</script>");
     }
     else
     {
         Response.Redirect((string)("../ContentStatistics.aspx?page=ContentStatistics.aspx&id=" + this.content_id + "&LangType=" + this.ContentLanguage), false);
     }
 }
コード例 #7
0
    protected override void Page_Load(object sender, System.EventArgs e)
    {
        base.Page_Load(sender, e);
        try
        {
            if (!string.IsNullOrEmpty(Request.QueryString["fid"]))
            {
                m_iID = Convert.ToInt64(Request.QueryString["fid"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["cid"]))
            {
                content_id = Convert.ToInt64(Request.QueryString["cid"]);
            }

            CheckPermissions();

            if (Page.IsPostBack)
            {
                switch (base.m_sPageAction)
                {
                    default: // "edit"
                        Process_Edit();
                        break;
                }
            }
            else
            {
                cfFlag = this.m_refContentApi.EkContentRef.GetContentFlag(m_iID);
                RenderJS();
                switch (base.m_sPageAction)
                {
                    case "delete":
                        Process_Delete();
                        break;
                    case "edit":
                        Display_Edit();
                        break;
                    default: // "view"
                        Display_View();
                        break;
                }
                SetLabels();
            }
        }
        catch (Exception ex)
        {
            Utilities.ShowError(ex.Message);
        }
    }