コード例 #1
0
ファイル: viewcontent.ascx.cs プロジェクト: jaytem/minGit
    private void ViewTasks()
    {
        string actiontype = "both";
        string callBackPage = ""; //unknown
        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TITLE";
        colBound.HeaderText = m_refMsg.GetMessage("generic Title");
        TaskDataGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "ID";
        colBound.HeaderText = m_refMsg.GetMessage("generic ID");
        TaskDataGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "STATE";
        colBound.HeaderText = m_refMsg.GetMessage("lbl state");
        TaskDataGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "PRIORITY";
        colBound.HeaderText = m_refMsg.GetMessage("lbl priority");
        TaskDataGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "DUEDATE";
        colBound.HeaderText = m_refMsg.GetMessage("lbl Due Date");
        TaskDataGrid.Columns.Add(colBound);

        if ((actiontype == "by") || (actiontype == "all") || (actiontype == "both"))
        {
            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "ASSIGNEDTO";
            colBound.HeaderText = m_refMsg.GetMessage("lbl Assigned to");
            TaskDataGrid.Columns.Add(colBound);
        }
        if ((actiontype == "to") || (actiontype == "all") || (actiontype == "both"))
        {
            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "ASSIGNEDBY";
            colBound.HeaderText = m_refMsg.GetMessage("lbl Assigned By");
            TaskDataGrid.Columns.Add(colBound);
        }

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "COMMENT";
        colBound.HeaderText = m_refMsg.GetMessage("lbl Last Added comments");
        TaskDataGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "DATECREATED";
        colBound.HeaderText = m_refMsg.GetMessage("lbl Create Date");
        TaskDataGrid.Columns.Add(colBound);

        TaskDataGrid.BorderColor = System.Drawing.Color.White;

        DataTable dt = new DataTable();
        DataRow dr;

        dt.Columns.Add(new DataColumn("TITLE", typeof(string)));
        dt.Columns.Add(new DataColumn("ID", typeof(string)));
        dt.Columns.Add(new DataColumn("STATE", typeof(string)));
        dt.Columns.Add(new DataColumn("PRIORITY", typeof(string)));
        dt.Columns.Add(new DataColumn("DUEDATE", typeof(string)));
        dt.Columns.Add(new DataColumn("ASSIGNEDTO", typeof(string)));
        dt.Columns.Add(new DataColumn("ASSIGNEDBY", typeof(string)));
        dt.Columns.Add(new DataColumn("COMMENT", typeof(string)));
        dt.Columns.Add(new DataColumn("DATECREATED", typeof(string)));

        if (TaskExists == true)
        {
            int TaskItemType = 1;
            m_refTask = m_refContentApi.EkTaskRef;

            Ektron.Cms.PageRequestData null_EktronCmsPageRequestData = null;
            cTasks = m_refTask.GetTasks(m_intId, -1, -1, TaskItemType, Request.QueryString["orderby"], ContentLanguage, ref null_EktronCmsPageRequestData, "");
        }

        int i = 0;
        EkTask cTask;

        if (cTasks != null)
        {
            EmailHelper m_refMail = new EmailHelper();
            while (i < cTasks.Count)
            {
                i++;
                cTask = cTasks.get_Item(i);
                if (!(cTask.TaskTypeID == (long)Ektron.Cms.Common.EkEnumeration.TaskType.BlogPostComment))
                {
                    Array.Resize(ref arrTaskTypeID, i - 1 + 1);
                    arrTaskTypeID[i - 1] = (string)("shown_task_" + i + "_" + (cTask.TaskTypeID <= 0 ? "NotS" : (cTask.TaskTypeID.ToString())));

                    dr = dt.NewRow();

                    dr["TITLE"] = "<a href=\"tasks.aspx?action=ViewTask&tid=" + cTask.TaskID + "&folderid=" + cTask.FolderId  +  "&contentid=" + cTask.ContentID +  "&fromViewContent=1&ty=both&LangType=" + cTask.ContentLanguage + callBackPage + "\">" + cTask.TaskTitle + "</a>";
                    dr["TITLE"] += "	<script language=\"JavaScript\">" + "\r\n";
                    dr["TITLE"] += "					AddShownTaskID(\'" + arrTaskTypeID[i - 1] + "\');" + "\r\n";
                    dr["TITLE"] += "				</script>	" + "\r\n";

                    dr["ID"] = cTask.TaskID;
                    int iState = System.Convert.ToInt32(cTask.State);
                    switch (iState)
                    {
                        case 1:
                            dr["STATE"] = "Not Started";
                            break;
                        case 2:
                            dr["STATE"] = "Active";
                            break;
                        case 3:
                            dr["STATE"] = "Awaiting Data";
                            break;
                        case 4:
                            dr["STATE"] = "On Hold";
                            break;
                        case 5:
                            dr["STATE"] = "Pending";
                            break;
                        case 6:
                            dr["STATE"] = "ReOpened";
                            break;
                        case 7:
                            dr["STATE"] = "Completed";
                            break;
                        case 8:
                            dr["STATE"] = "Archived";
                            break;
                        case 9:
                            dr["STATE"] = "Deleted";
                            break;
                    }
                    int iPrio = System.Convert.ToInt32(cTask.Priority);
                    switch (iPrio)
                    {
                        case 1:
                            dr["PRIORITY"] = "Low";
                            break;
                        case 2:
                            dr["PRIORITY"] = "Normal";
                            break;
                        case 3:
                            dr["PRIORITY"] = "High";
                            break;
                    }

                    if (cTask.DueDate != "")
                    {
                        if (System.Convert.ToDateTime(cTask.DueDate) < DateTime.Today) //Verify:Udai 11/22/04 Replaced Now.ToOADate - 1 with DateTime.Today
                        {
                            dr["DUEDATE"] = cTask.DueDate; //Response.Write("<td class=""important"">" & AppUI.GetInternationalDateOnly(cTask.DueDate) & "</td>")
                        }
                        else
                        {
                            dr["DUEDATE"] = cTask.DueDate; //Response.Write("<td>" & AppUI.GetInternationalDateOnly(cTask.DueDate) & "</td>")
                        }
                    }
                    else
                    {
                        dr["DUEDATE"] = "[Not Specified]";
                    }
                    EkTask tempcTask = cTask;
                    if ((actiontype == "by") || (actiontype == "all") || (actiontype == "both"))
                    {
                        if (cTask.AssignToUserGroupID == 0)
                        {
                            dr["ASSIGNEDTO"] = "All Authors of (" + cTask.ContentID.ToString() + ")";
                        }
                        else if (cTask.AssignedToUser != "")
                        {
                            dr["ASSIGNEDTO"] = "<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/user.png\" align=\"absbottom\">" + m_refMail.MakeUserTaskEmailLink(tempcTask, false);
                        }
                        else if (cTask.AssignedToUserGroup != "")
                        {
                            dr["ASSIGNEDTO"] = "<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/users.png\" align=\"absbottom\">";
                            if (cTask.AssignToUserGroupID != -1)
                            {
                                dr[5] += m_refMail.MakeUserGroupTaskEmailLink(tempcTask);
                            }
                            else
                            {
                                dr[5] += cTask.AssignedToUserGroup;
                            }
                        }
                    }
                    if ((actiontype == "to") || (actiontype == "all") || (actiontype == "both"))
                    {
                        dr["ASSIGNEDBY"] = m_refMail.MakeByUserTaskEmailLink(tempcTask, false);

                    }

                    if (cTask.LastComment == "")
                    {
                        dr["COMMENT"] = "[Not Specified]";
                    }
                    else
                    {
                        dr["COMMENT"] = "<div class=\"comment-block\">" + cTask.LastComment + "</div>";
                    }
                    dr["DATECREATED"] = cTask.DateCreated; //GetInternationalDateOnly

                    dt.Rows.Add(dr);
                }
            }
        }
        DataView dv = new DataView(dt);
        TaskDataGrid.DataSource = dv;
        TaskDataGrid.DataBind();
    }
コード例 #2
0
ファイル: viewtaxonomy.ascx.cs プロジェクト: jaytem/minGit
 private string GetTaskIdForTopic(EkTasks tasks, long contentID)
 {
     if (tasks != null)
         {
             for (int i = 1; i <= tasks.Count; i++)
             {
                 if (tasks.get_Item(i) != null && tasks.get_Item(i).ContentID == contentID)
                 {
                     return tasks.get_Item(i).TaskID.ToString();
                 }
             }
         }
         return String.Empty;
 }
コード例 #3
0
ファイル: viewfolder.ascx.cs プロジェクト: jaytem/minGit
    public bool ViewContentByCategory()
    {
        _CurrentUserId = _ContentApi.UserId;
        _AppImgPath = _ContentApi.AppImgPath;
        _AppPath = _ContentApi.AppPath;
        _SitePath = _ContentApi.SitePath;
        _EnableMultilingual = _ContentApi.EnableMultilingual;

        url_action.Text = _PageAction;
        url_id.Text = _Id.ToString();

        if (_FolderData == null)
        {
            _FolderData = _ContentApi.GetFolderById(_Id);
        }
        if (_FolderData == null)
        {
            Response.Redirect((string)("reterror.aspx?info=" + _MessageHelper.GetMessage("com: folder does not exist")), true);
            return false;
        }
        else
        {
            if (_FolderData.XmlConfiguration != null)
            {
                _HasXmlConfig = true;
            }
            _PermissionData = _ContentApi.LoadPermissions(_Id, "folder", 0);
            _FolderType = _FolderData.FolderType;
        }

        //Setting JS Variable for global use through workarea.aspx page.
        pasteFolderType.Text = Convert.ToString(_FolderData.FolderType);
        pasteFolderId.Text = Convert.ToString(_FolderData.Id);
        pasteParentId.Text = Convert.ToString(_FolderData.ParentId);

        if (!string.IsNullOrEmpty(Request.QueryString["IsArchivedEvent"]))
        {
            _IsArchivedEvent = Convert.ToBoolean(Request.QueryString["IsArchivedEvent"]);
            is_archived.Text = Convert.ToString(_IsArchivedEvent);
        }

        _AssetInfoData = _ContentApi.GetAssetSupertypes();
        if ((Ektron.Cms.Common.EkConstants.CMSContentType_Content == Convert.ToInt32(_ContentTypeSelected)) || (Ektron.Cms.Common.EkConstants.CMSContentType_Archive_Content == Convert.ToInt32(_ContentTypeSelected)) || (Ektron.Cms.Common.EkConstants.CMSContentType_XmlConfig == Convert.ToInt32(_ContentTypeSelected)))
        {
            _ContentType = int.Parse(_ContentTypeSelected);
        }
        else if (Ektron.Cms.Common.EkConstants.CMSContentType_Forms == Convert.ToInt32(_ContentTypeSelected) || Ektron.Cms.Common.EkConstants.CMSContentType_Archive_Forms == Convert.ToInt32(_ContentTypeSelected))
        {
            _ContentType = int.Parse(_ContentTypeSelected);
        }
        else if (_ManagedAsset_Min <= Convert.ToInt32(_ContentTypeSelected) && Convert.ToInt32(_ContentTypeSelected) <= _ManagedAsset_Max)
        {
            if (DoesAssetSupertypeExist(_AssetInfoData, int.Parse(_ContentTypeSelected)))
            {
                _ContentType = int.Parse(_ContentTypeSelected);
            }
        }
        else if (Convert.ToInt32(_ContentTypeSelected) == _CMSContentType_AllTypes)
        {
            _ContentType = Ektron.Cms.Common.EkConstants.CMSContentType_NonLibraryForms;
        }
        else if (_IsArchivedEvent == true && (Convert.ToInt32(_ContentTypeSelected) == EkConstants.CMSContentType_Archive_ManagedFiles || Convert.ToInt32(_ContentTypeSelected) == EkConstants.CMSContentType_Archive_OfficeDoc || Convert.ToInt32(_ContentTypeSelected) == EkConstants.CMSContentType_Archive_MultiMedia || Convert.ToInt32(_ContentTypeSelected) == EkConstants.CMSContentType_Archive_Images))
        {
            _ContentType = int.Parse(_ContentTypeSelected);
        }

        _ContentTypeSelected = _ContentType.ToString();

        _PageData = new Microsoft.VisualBasic.Collection();
        _PageData.Add(_Id, "FolderID", null, null);
        if (_FolderData.FolderType == 1) //blog
        {
            _PageData.Add("BlogPost", "OrderBy", null, null);
        }
        else
        {
            _PageData.Add(_OrderBy, "OrderBy", null, null);
        }
        if (Request.QueryString["orderbydirection"] == "desc")
            direction = "desc";
        else
            direction = "asc";
        _OrderByDirection = direction;
        _PageData.Add(_OrderByDirection, "OrderByDirection", null, null);
        _PageData.Add(_ContentLanguage, "m_intContentLanguage", null, null);
        switch ((Ektron.Cms.Common.EkEnumeration.FolderType)_FolderData.FolderType)
        {
            case Ektron.Cms.Common.EkEnumeration.FolderType.Blog:
                _ContentType = Ektron.Cms.Common.EkConstants.CMSContentType_Content;
                _PageData.Add(_ContentType, "ContentType", null, null);
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum:
                _ContentType = Ektron.Cms.Common.EkConstants.CMSContentType_Content;
                _PageData.Add(_ContentType, "ContentType", null, null);
                break;
            default:
                if (_ContentType > 0)
                {
                    _PageData.Add(_ContentType, "ContentType", null, null);
                }
                break;
        }

        if (_ContentType == 1 && _ContentSubTypeSelected != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes)
        {
            _PageData.Add(_ContentSubTypeSelected, "ContentSubType", null, null);
        }

        if ((Ektron.Cms.Common.EkEnumeration.FolderType)(_FolderData.FolderType) == Ektron.Cms.Common.EkEnumeration.FolderType.Calendar)
        {
            calendardisplay.Visible = true;
            pnlThreadedDiscussions.Visible = false;
            if ((Request.QueryString["showAddEventForm"] != null) && Request.QueryString["showAddEventForm"] == "true")
            {
                if (ViewState["AddEventFormDisplay"] == null || System.Convert.ToBoolean(ViewState["AddEventFormDisplay"]) == false) //only show once
                {
                    ViewState.Add("AddEventFormDisplay", true);
                    DateTime startDT = DateTime.Now.Date.AddHours(8);
                    if (Request.QueryString["startDT"] != null)
                    {
                        startDT = DateTime.ParseExact(Request.QueryString["startDT"], "yyyyMMddHHmm", new System.Globalization.CultureInfo(1033));
                    }
                    calendardisplay.ShowInsertForm(startDT);
                }
            }
            if (Request.QueryString["editEvent"] != null)
            {
                if (ViewState["editEvent"] == null || System.Convert.ToBoolean(ViewState["editEvent"]) == false) //only show once
                {
                    ViewState.Add("editEvent", true);
                    calendardisplay.ShowEditForm(Request.QueryString["editEvent"]);
                }
            }

            ScriptManager.RegisterClientScriptBlock(Page, typeof(UserControl), "CalendarCleanup", "try{ window.EditorCleanup(); }catch(ex){}", true);
        }
        _PagingPageSize = _ContentApi.RequestInformationRef.PagingSize;
        if ((Ektron.Cms.Common.EkEnumeration.FolderType)(_FolderData.FolderType) == Ektron.Cms.Common.EkEnumeration.FolderType.Blog)
        {
            _BlogData = _ContentApi.BlogObject(_FolderData);
        }

        //if it's a calendar then we do it on prerender
        if ((Ektron.Cms.Common.EkEnumeration.FolderType)(_FolderData.FolderType) != Ektron.Cms.Common.EkEnumeration.FolderType.Calendar)
        {
            if (_PageAction == "viewarchivecontentbycategory")
            {
                _EkContentCol = _EkContent.GetAllViewArchiveContentInfov5_0(_PageData, _PagingCurrentPageNumber, _PagingPageSize, ref _PagingTotalPagesNumber);
                _NextActionType = "ViewContentByCategory";
            }
            else if (_PageAction == "viewcontentbycategory")
            {
                _EkContentCol = _EkContent.GetAllViewableChildContentInfoV5_0(_PageData, _PagingCurrentPageNumber, _PagingPageSize, ref _PagingTotalPagesNumber);
                _NextActionType = "ViewArchiveContentByCategory";
            }
            //paging goes here

            int i;
            for (i = 0; i <= _EkContentCol.Count - 1; i++)
            {
                if (_EkContentCol.get_Item(i).ContentStatus == "A")
                {
                    _TakeAction = true;
                    _CheckedInOrApproved = true;
                    break;
                }
                else
                {
                    if (_EkContentCol.get_Item(i).ContentStatus == "I")
                    {
                        _CheckedInOrApproved = true;
                    }
                }
            }
        }
        else
        {
            if (_PageAction == "viewarchivecontentbycategory")
            {
                _NextActionType = "ViewContentByCategory";
            }
            else if (_PageAction == "viewcontentbycategory")
            {
                _NextActionType = "ViewArchiveContentByCategory";
            }
        }

        switch ((Ektron.Cms.Common.EkEnumeration.FolderType)(_FolderData.FolderType))
        {
            case Ektron.Cms.Common.EkEnumeration.FolderType.Catalog:
                if (_PageAction == "viewarchivecontentbycategory")
                {
                    _NextActionType = "ViewContentByCategory";
                }
                else if (_PageAction == "viewcontentbycategory")
                {
                    _NextActionType = "ViewArchiveContentByCategory";
                }

                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");

                CatalogEntry CatalogManager = new CatalogEntry(_ContentApi.RequestInformationRef);
                System.Collections.Generic.List<EntryData> entryList = new System.Collections.Generic.List<EntryData>();
                Ektron.Cms.Common.Criteria<EntryProperty> entryCriteria = new Ektron.Cms.Common.Criteria<EntryProperty>();

                entryCriteria.AddFilter(EntryProperty.CatalogId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _Id);
                entryCriteria.PagingInfo.CurrentPage = Convert.ToInt32(_PagingCurrentPageNumber.ToString());
                entryCriteria.PagingInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize;

                if (_ContentApi.RequestInformationRef.ContentLanguage > 0)
                {
                    entryCriteria.AddFilter(EntryProperty.LanguageId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _ContentApi.RequestInformationRef.ContentLanguage);
                }

                switch (this._ContentTypeQuerystringParam)
                {
                    case "0":
                        long[] IdList = new long[3];
                        IdList[0] = Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product);
                        IdList[1] = Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.ComplexProduct);
                        entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.In, IdList);
                        break;
                    case "2":
                        entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Kit);
                        break;
                    case "3":
                        entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Bundle);
                        break;
                    case "4":
                        entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct);
                        break;
                }

                if (_PageAction == "viewarchivecontentbycategory")
                {
                    entryCriteria.AddFilter(EntryProperty.IsArchived, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, true);
                }
                else
                {
                    entryCriteria.AddFilter(EntryProperty.IsArchived, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, false);
                }
                if (Request.QueryString["orderbydirection"] == "desc")
                    direction = "desc";
                else
                    direction = "asc";
                if(direction == "desc")
                    entryCriteria.OrderByDirection = (EkEnumeration.OrderByDirection)OrderByDirection.Descending;
                else
                entryCriteria.OrderByDirection = (EkEnumeration.OrderByDirection)OrderByDirection.Ascending;

                switch (_OrderBy.ToLower())
                {
                    case "language":
                        entryCriteria.OrderByField = EntryProperty.LanguageId;
                        break;
                    case "id":
                        entryCriteria.OrderByField = EntryProperty.Id;
                        break;
                    case "status":
                        entryCriteria.OrderByField = EntryProperty.ContentStatus;
                        break;
                    case "entrytype":
                        entryCriteria.OrderByField = EntryProperty.EntryType;
                        break;
                    case "sale":
                        entryCriteria.OrderByField = EntryProperty.SalePrice;
                        break;
                    case "list":
                        entryCriteria.OrderByField = EntryProperty.ListPrice;
                        break;
                    default: //"title"
                        entryCriteria.OrderByField = EntryProperty.Title;
                        break;
                }

                entryList = CatalogManager.GetList(entryCriteria);

                for (int j = 0; j <= entryList.Count - 1; j++)
                {
                    if (entryList[j].Status == "A")
                    {
                        _TakeAction = true;
                        _CheckedInOrApproved = true;
                        break;
                    }
                    else
                    {
                        if (entryList[j].Status == "I")
                        {
                            _CheckedInOrApproved = true;
                        }
                    }
                }

                _PagingTotalPagesNumber = System.Convert.ToInt32(entryCriteria.PagingInfo.TotalPages);

                //paging goes here

                ViewCatalogToolBar(entryList.Count);
                Populate_ViewCatalogGrid(_EkContentCol, entryList);
                _ContentType = int.Parse(_ContentTypeSelected);
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.Blog:
                _IsMyBlog = System.Convert.ToBoolean((_BlogData.Id == _ContentApi.GetUserBlog(_ContentApi.UserId)) ? true : false);
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");
                if (!string.IsNullOrEmpty(Request.QueryString["ContType"]) && (Request.QueryString["ContType"] == Ektron.Cms.Common.EkConstants.CMSContentType_BlogComments.ToString()))
                {
                    _ContentType = System.Convert.ToInt32(Request.QueryString["ContType"]);
                    _Task = _ContentApi.EkTaskRef;
                    if (!string.IsNullOrEmpty(Request.QueryString["contentid"]))
                    {
                        _PostID = Convert.ToInt64(Request.QueryString["contentid"]);
                        _ContentData = _ContentApi.GetContentById(_PostID, 0);

                        Ektron.Cms.PageRequestData null_EktronCmsPageRequestData = null;
                        _Comments = _Task.GetTasks(_PostID, -1, -1, Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.CMSTaskItemType.BlogCommentItem), "postcomment", 0, ref null_EktronCmsPageRequestData, "");
                    }
                    else
                    {

                        Ektron.Cms.PageRequestData null_EktronCmsPageRequestData2 = null;
                        _Comments = _Task.GetTasks(-1, -1, -1, Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.CMSTaskItemType.BlogCommentItem), "", 0, ref null_EktronCmsPageRequestData2, "");
                    }
                    ViewBlogContentByCategoryToolBar();
                    Populate_ViewBlogCommentsByCategoryGrid(_Comments);
                }
                else
                {
                    Hashtable BlogPostCommentTally = new Hashtable();
                    BlogPostCommentTally = _EkContent.TallyCommentsForBlogPosts(_Id);
                    ViewBlogContentByCategoryToolBar();
                    Populate_ViewBlogPostsByCategoryGrid(_EkContentCol, BlogPostCommentTally);
                }
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.Media:
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");
                ViewContentByCategoryToolBar();
                Populate_ViewMediaGrid(_EkContentCol);
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionBoard:
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");
                ViewDiscussionBoardToolBar();
                Populate_ViewDiscussionBoardGrid();
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum:
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");
                bool bCanModerate = false;
                int itotalpages = 1;
                int icurrentpage = 1;
                if (!string.IsNullOrEmpty(Request.QueryString["ContType"]) && (Request.QueryString["ContType"] == Ektron.Cms.Common.EkConstants.CMSContentType_BlogComments.ToString()))
                {
                    _ContentType = System.Convert.ToInt32(Request.QueryString["ContType"]);
                    if (this._ContentApi.UserId > 0 && ((!(_PermissionData == null) && _PermissionData.CanAddToImageLib == true) || _PermissionData.IsAdmin))
                    {
                        bCanModerate = true;
                    }
                    _DiscussionBoard = _ContentApi.GetTopic(_ContentId, true);
                    if (_DiscussionBoard == null)
                    {
                        throw new Exception("You may not have permission to view this object or it has been deleted.");
                    }
                    _BoardID = _DiscussionBoard.Id;
                    _ContentData = (ContentData)(_DiscussionBoard.Forums[0].Topics[0]);
                    _PermissionData = _ContentApi.LoadPermissions(_ContentId, "content", ContentAPI.PermissionResultType.All);
                    ViewRepliesToolBar();
                    _Task = _ContentApi.EkTaskRef;
                    if (!string.IsNullOrEmpty(Request.QueryString["contentid"]))
                    {
                        _PostID = Convert.ToInt64(Request.QueryString["contentid"]);
                        _Comments = _Task.GetTopicReplies(_PostID, _DiscussionBoard.Id, ref icurrentpage, 0, 0, ref itotalpages, bCanModerate);
                    }
                    else
                    {

                        Ektron.Cms.PageRequestData null_EktronCmsPageRequestData3 = null;
                        _Comments = _Task.GetTasks(-1, -1, -1, Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.CMSTaskItemType.TopicReplyItem), "", 0, ref null_EktronCmsPageRequestData3, "");
                    }
                    Populate_ViewTopicRepliesGrid(_Comments);
                }
                else
                {
                    ArrayList ForumPostCommentTally = new ArrayList();
                    DiscussionBoard thisboard;
                    bool bModerator = false;
                    if (_PermissionData.IsAdmin == true || _PermissionData.CanAddToImageLib == true)
                    {
                        bModerator = true;
                    }
                    thisboard = _EkContent.GetForumbyID(_Id.ToString(), bModerator, _PagingCurrentPageNumber, ref this._PagingTotalPagesNumber, "", this._ContentApi.RequestInformationRef.PagingSize);

                    //paging here

                    ForumPostCommentTally = _EkContent.GetRepliesForTopics(_Id);
                    ViewDiscussionForumToolBar();
                    Populate_ViewForumPostsByCategoryGrid(thisboard.Forums[0].Topics, ForumPostCommentTally);
                }
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.Calendar:
                ViewCalendarToolBar();
                break;
            default:
                ViewContentByCategoryToolBar();
                Populate_ViewContentByCategoryGrid(_EkContentCol);
                break;
        }

        Util_SetJs();
        return true;
    }
コード例 #4
0
ファイル: viewfolder.ascx.cs プロジェクト: jaytem/minGit
    private void Populate_ViewTopicRepliesGrid(EkTasks replydata)
    {
        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        string strTag;
        string strtag1;
        int nReplyCount;
        strTag = "<a href=\"content.aspx?LangType=" + _ContentApi.ContentLanguage + "&action=" + _PageAction + "&orderby=";
        strtag1 = "&id=" + _Id + (_ContentTypeQuerystringParam != "" ? "&" + _ContentTypeUrlParam + "=" + _ContentTypeQuerystringParam : "") + "\" title=\"" + _MessageHelper.GetMessage("click to sort msg") + "\">";

        FolderDataGrid.ShowHeader = false;

        colBound.DataField = "PREVIEW";
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.Width = System.Web.UI.WebControls.Unit.Pixel(145);
        FolderDataGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TITLEDESCRIPTION";
        //colBound.ItemStyle.Wrap = False
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        FolderDataGrid.Columns.Add(colBound);

        FolderDataGrid.BorderColor = System.Drawing.Color.White;
        FolderDataGrid.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
        FolderDataGrid.CellPadding = 6;
        FolderDataGrid.CellSpacing = 2;

        DataTable dt = new DataTable();
        DataRow dr;

        dt.Columns.Add(new DataColumn("PREVIEW", typeof(string)));
        dt.Columns.Add(new DataColumn("TITLEDESCRIPTION", typeof(string)));

        string ApproveURL = "";
        string ViewUrl = "";
        string EditUrl = "";
        string DeleteUrl = "";
        string ReplyURL = "";
        string sAppend = "";
        int i;
        nReplyCount = replydata.Count;
        Ektron.Cms.ContentAPI contapi = new Ektron.Cms.ContentAPI();

        dr = dt.NewRow();

        for (i = 1; i <= replydata.Count; i++)
        {
            if (replydata.get_Item(i) != null)
            {
                if (int.Parse(replydata.get_Item(i).State) == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.BlogCommentState.Completed) || (int.Parse(replydata.get_Item(i).State) == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.BlogCommentState.Pending) && ((!(_PermissionData == null) && (_PermissionData.IsAdmin || _PermissionData.CanAddToImageLib)) || this._ContentApi.RequestInformationRef.CallerId == replydata.get_Item(i).CreatedByUserID)))
                {
                    dr = dt.NewRow();
                    if (!string.IsNullOrEmpty(Request.QueryString["contentid"]))
                    {
                        sAppend = (string)("&forumid=" + _Id.ToString() + "&contentid=" + Request.QueryString["contentid"]);
                    }
                    else
                    {
                        sAppend = (string)("&forumid=" + _Id.ToString());
                    }
                    ViewUrl = (string)("tasks.aspx?action=ViewTask&tid=" + replydata.get_Item(i).TaskID.ToString() + "&fromViewContent=1&ty=both&LangType=" + _ContentApi.ContentLanguage);
                    EditUrl = (string)("threadeddisc/addeditreply.aspx?action=Edit&topicid=" + _ContentId.ToString() + "&forumid=" + this._Id.ToString() + "&id=" + replydata.get_Item(i).TaskID.ToString() + "&boardid=" + _BoardID.ToString());
                    if (i == 1)
                    {
                        EditUrl += "&type=topic";
                    }
                    ReplyURL = (string)("threadeddisc/addeditreply.aspx?action=Add&topicid=" + _ContentId.ToString() + "&forumid=" + this._Id.ToString() + "&id=" + replydata.get_Item(i).TaskID.ToString() + "&boardid=" + _BoardID.ToString());
                    if (int.Parse(replydata.get_Item(i).State) == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.BlogCommentState.Pending))
                    {
                        ApproveURL = (string)("tasks.aspx?action=ApproveTask&tid=" + replydata.get_Item(i).TaskID.ToString() + "&ty=both" + sAppend);
                        dr[0] = "<a name=\"reply" + replydata.get_Item(i).TaskID.ToString() + "\"></a><table border=\"0\" cellspacing=\"6\" width=\"125\"><tr><td colspan=\"2\" align=\"center\">";
                        dr[0] += "<br/><img border=\"4\" style=\"border-width: 5px; border-color: gold\" src=\"" + _ContentApi.AppImgPath + "thumb_forumpost.gif\" width=\"53\" height=\"55\"/><br/>";
                        dr[0] += "</td></tr>";
                        dr[0] += "<tr><td width=\"50%\">";
                        if (_PermissionData.IsReadOnlyLib == true)
                        {
                            dr[0] += "<a href=\"" + ReplyURL + "\">" + _MessageHelper.GetMessage("lbl reply") + "</a>";
                        }
                        else
                        {
                            dr[0] += _MessageHelper.GetMessage("lbl reply");
                        }
                        dr[0] += "</td><td width=\"50%\">";
                        if (_PermissionData.CanAddToImageLib == true)
                        {
                            dr[0] += "<a href=\"" + EditUrl + "\">" + _MessageHelper.GetMessage("generic edit title") + "</a>";
                        }
                        else
                        {
                            dr[0] += _MessageHelper.GetMessage("generic edit title");
                        }
                        dr[0] += "</td></tr>";
                        if (i > 1)
                        {
                            dr[0] += "<tr><td width=\"50%\">";
                            if (!(_PermissionData == null) && (_PermissionData.IsAdmin || _PermissionData.CanAddToImageLib))
                            {
                                dr[0] += "<a href=\"" + ApproveURL + "\">approve</a>";
                            }
                            else
                            {
                                dr[0] += "approve";
                            }
                        }
                    }
                    else
                    {
                        ApproveURL = "";
                        dr[0] = "<a name=\"reply" + replydata.get_Item(i).TaskID.ToString() + "\"><table border=\"0\" cellspacing=\"6\" width=\"125\"><tr><td colspan=\"2\" align=\"center\">";
                        dr[0] += "<br/><img src=\"" + _ContentApi.AppImgPath + "thumb_forumpost.gif\" width=\"53\" height=\"55\"/><br/>";
                        dr[0] += "</td></tr>";
                        dr[0] += "<tr><td width=\"50%\">";
                        if (_PermissionData.IsReadOnlyLib == true)
                        {
                            dr[0] += "<a href=\"" + ReplyURL + "\">" + _MessageHelper.GetMessage("lbl reply") + "</a>";
                        }
                        else
                        {
                            dr[0] += _MessageHelper.GetMessage("lbl reply");
                        }
                        dr[0] += "</td><td width=\"50%\">";
                        if ((i == 1 && _PermissionData.CanEdit) || contapi.UserId == replydata.get_Item(i).CreatedByUserID)
                        {
                            dr[0] += "<a href=\"" + EditUrl + "\">" + _MessageHelper.GetMessage("generic edit title") + "</a>";
                        }
                        else
                        {
                            dr[0] += _MessageHelper.GetMessage("generic edit title");
                        }
                        dr[0] += "</td></tr>";
                        //We do not need approve button when there's no approval for that post reply
                        //If i > 1 Then
                        //    dr(0) &= "<tr><td width=""50%"">"
                        //    dr(0) &= _MessageHelper.GetMessage("btn approve")
                        //End If
                    }
                    if (i > 2)
                    {
                        DeleteUrl = (string)("tasks.aspx?action=DeleteTask&tid=" + replydata.get_Item(i).TaskID.ToString() + "&ty=both" + sAppend);
                        dr[0] += "</td><td width=\"50%\">";
                        if (_PermissionData.IsAdmin || _PermissionData.CanAddToImageLib == true || contapi.UserId == replydata.get_Item(i).CreatedByUserID)
                        {
                            dr[0] += "<a href=\"" + DeleteUrl + "\" onclick=\"return confirm(\'" + _MessageHelper.GetMessage("msg del comment") + "\');\">" + _MessageHelper.GetMessage("generic delete title") + "</a>";
                        }
                        else
                        {
                            dr[0] += _MessageHelper.GetMessage("generic delete title");
                        }
                        dr[0] += "</td></tr>";
                    }
                    dr[0] += "</table>";
                    if (replydata.get_Item(i).CreatedByUserID == -1)
                    {
                        dr[1] += "<span id=\"ReplyDesc\" class=\"ReplyDesc\" style=\"color:gray;display:block;\">" + (replydata.get_Item(i).Description) + "</span><span style=\"color:green;display:block;\">" + _MessageHelper.GetMessage("lbl posted by") + " " + _MessageHelper.GetMessage("lbl anon") + " " + _MessageHelper.GetMessage("res_isrch_on") + " " + replydata.get_Item(i).DateCreated.ToString() + "</span>";
                    }
                    else
                    {
                        dr[1] += "<span id=\"ReplyDesc\" class=\"ReplyDesc\" style=\"color:gray;display:block;\">" + (replydata.get_Item(i).Description) + "</span><span style=\"color:green;display:block;\">" + _MessageHelper.GetMessage("lbl posted by") + " " + replydata.get_Item(i).CommentDisplayName + " " + _MessageHelper.GetMessage("res_isrch_on") + " " + replydata.get_Item(i).DateCreated.ToString() + "</span>";
                    }
                    if (!(replydata.get_Item(i).FileAttachments == null) && replydata.get_Item(i).FileAttachments.Length > 0)
                    {
                        dr[1] += "<br/>";
                        dr[1] += "<br/>";
                        string filetmp = "";
                        for (int k = 0; k <= (replydata.get_Item(i).FileAttachments.Length - 1); k++)
                        {
                            if (replydata.get_Item(i).FileAttachments[k].DoesExist == true)
                            {
                                filetmp += (string)("		<img src=\'" + this._ContentApi.AppPath + "images/ui/icons/filetypes/file.png\' /> <a href=\"" + replydata.get_Item(i).FileAttachments[k].Filepath + "\" target=\"_blank\" class=\"ekattachment\">" + replydata.get_Item(i).FileAttachments[k].Filename + "</a> <span class=\'attachinfo\'>(" + replydata.get_Item(i).FileAttachments[k].FileSize.ToString() + " bytes)</span><br/>" + Environment.NewLine);
                            }
                        }
                        if (filetmp.Length > 0) // if we have at least one attachment
                        {
                            filetmp = (string)(("		<span class=\"ekattachments\">File Attachment(s):</span><br/>" + Environment.NewLine) + filetmp + ("		<br/>" + Environment.NewLine));
                            dr[1] += filetmp;
                        }
                    }
                    dt.Rows.Add(dr);
                }
            }
        }
        DataView dv = new DataView(dt);
        FolderDataGrid.DataSource = dv;
        FolderDataGrid.DataBind();

        totalPages.Visible = false;
        currentPage.Visible = false;
    }
コード例 #5
0
ファイル: viewfolder.ascx.cs プロジェクト: jaytem/minGit
    private void Populate_ViewBlogCommentsByCategoryGrid(EkTasks blogcommentdata)
    {
        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        string strTag;
        string strtag1;
        int nBlogCommentCount;
        strTag = "<a href=\"content.aspx?LangType=" + _ContentApi.ContentLanguage + "&action=" + _PageAction + "&orderby=";
        strtag1 = "&id=" + _Id + (_ContentTypeQuerystringParam != "" ? "&" + _ContentTypeUrlParam + "=" + _ContentTypeQuerystringParam : "") + "\" title=\"" + _MessageHelper.GetMessage("click to sort msg") + "\">";

        FolderDataGrid.ShowHeader = false;

        colBound.DataField = "PREVIEW";
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.Width = System.Web.UI.WebControls.Unit.Pixel(145);
        FolderDataGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TITLEDESCRIPTION";
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        FolderDataGrid.Columns.Add(colBound);

        FolderDataGrid.BorderColor = System.Drawing.Color.White;
        FolderDataGrid.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
        FolderDataGrid.CellPadding = 6;
        FolderDataGrid.CellSpacing = 2;

        DataTable dt = new DataTable();
        DataRow dr;

        dt.Columns.Add(new DataColumn("PREVIEW", typeof(string)));
        dt.Columns.Add(new DataColumn("TITLEDESCRIPTION", typeof(string)));

        string ApproveURL = "";
        string ViewUrl = "";
        string EditUrl = "";
        string DeleteUrl = "";
        string sAppend = "";
        string _CommentDisplayName = string.Empty;
        int i;
        nBlogCommentCount = blogcommentdata.Count;
        for (i = 1; i <= blogcommentdata.Count; i++)
        {
            if (!(blogcommentdata.get_Item(i) == null))
            {
                if (_ContentLanguage == blogcommentdata.get_Item(i).ContentLanguage || (Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES == _ContentLanguage && Convert.ToInt32(Request.QueryString["viewin"]) == blogcommentdata.get_Item(i).ContentLanguage))
                {
                    if (blogcommentdata.get_Item(i).CommentDisplayName == string.Empty)
                    {
                        _CommentDisplayName = blogcommentdata.get_Item(i).CreatedByUser;
                    }
                    else
                    {
                        _CommentDisplayName = blogcommentdata.get_Item(i).CommentDisplayName;
                    }
                    dr = dt.NewRow();
                    if (!string.IsNullOrEmpty(Request.QueryString["contentid"]))
                    {
                        sAppend = (string)("&blogid=" + _Id.ToString() + "&contentid=" + Request.QueryString["contentid"]);
                    }
                    else
                    {
                        sAppend = (string)("&blogid=" + _Id.ToString());
                    }
                    ViewUrl = (string)("tasks.aspx?action=ViewTask&tid=" + blogcommentdata.get_Item(i).TaskID.ToString() + "&fromViewContent=1&ty=both&LangType=" + _ContentApi.ContentLanguage);
                    EditUrl = (string)("blogs/addeditcomment.aspx?action=Edit&id=" + blogcommentdata.get_Item(i).TaskID.ToString() + sAppend);
                    dr[0] += "<p class=\"center";
                    if (int.Parse(blogcommentdata.get_Item(i).State) == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.BlogCommentState.Pending))
                    {
                        dr[0] += " blogCommentStatusPending\" title=\"" + _MessageHelper.GetMessage("moderator action required");
                    }
                    dr[0] += "\">";
                    if (int.Parse(blogcommentdata.get_Item(i).State) == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.BlogCommentState.Pending))
                    {
                        ApproveURL = (string)("tasks.aspx?action=ApproveTask&tid=" + blogcommentdata.get_Item(i).TaskID.ToString() + "&ty=both" + sAppend);
                        dr[0] += "<img style=\"border: none; margin: .5em auto;\" src=\"" + _ContentApi.AppImgPath + "thumb_blogcomment.gif\" width=\"53\" height=\"55\"/><br/>";
                        if (_PermissionData.CanEdit == true)
                        {
                            dr[0] += "<a href=\"" + ApproveURL + "\">" + _MessageHelper.GetMessage("generic approve title") + "</a>&nbsp;|&nbsp;";
                        }
                        else
                        {
                            dr[0] += "<br/>&nbsp;";
                        }
                    }
                    else
                    {
                        dr[0] += "<img src=\"" + _ContentApi.AppImgPath + "thumb_blogcomment.gif\" width=\"53\" height=\"55\" style=\"border: none; margin: .5em auto;\"/><br />";
                    }
                    if (_PermissionData.CanEdit)
                    {
                        dr[0] += "<a href=\"" + EditUrl + "\">" + _MessageHelper.GetMessage("generic edit title") + "</a>&nbsp;|&nbsp;";
                        DeleteUrl = (string)("tasks.aspx?action=DeleteTask&tid=" + blogcommentdata.get_Item(i).TaskID.ToString() + "&ty=both" + sAppend);
                        dr[0] += "<a href=\"" + DeleteUrl + "\" onclick=\"return confirm(\'" + _MessageHelper.GetMessage("msg del comment") + "\');\">" + _MessageHelper.GetMessage("generic delete title") + "</a>&nbsp;";
                    }
                    dr[0] += "</p>";
                    dr[1] += "<font color=\"gray\">\"" + EkFunctions.HtmlEncode(blogcommentdata.get_Item(i).Description) + "\"</font><br/><font color=\"green\">" + _MessageHelper.GetMessage("lbl posted by") + " " + _CommentDisplayName + " " + _MessageHelper.GetMessage("res_isrch_on") + " " + blogcommentdata.get_Item(i).DateCreated.ToString() + "</font>";
                    dt.Rows.Add(dr);
                }
            }
        }
        DataView dv = new DataView(dt);
        FolderDataGrid.DataSource = dv;
        FolderDataGrid.DataBind();
    }