Ejemplo n.º 1
0
        /// <summary>
        /// 执行分页数据查询操作,返回PageResponseData
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="connectionStr"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public override PageResponseData GetPageList <T>(string connectionStr, PageRequestData pageRequest)
        {
            PageResponseData responsResult = new PageResponseData();

            try
            {
                #region 相关变量定义
                Type   type         = typeof(T);
                string tableName    = type.Name;
                int    startNum     = pageRequest.PageSize * (pageRequest.PageIndex - 1) + 1;
                int    endNum       = pageRequest.PageSize * pageRequest.PageIndex;
                var    searchEntity = pageRequest.SearchEntityObj;
                #endregion

                #region 分页查询处理
                EntityColumn idColumn = new EntityColumnUtility().GetIdColumn <T>(null);
                if (idColumn != null)
                {
                    responsResult.TotalCount = GetCount <T>(connectionStr, searchEntity);
                    if (responsResult.TotalCount > 0)
                    {
                        if (string.IsNullOrEmpty(searchEntity.ColumnSql))
                        {
                            searchEntity.ColumnSql = "b.*";
                        }
                        if (string.IsNullOrEmpty(searchEntity.SortColumn))
                        {
                            searchEntity.SortColumn = idColumn.ColumnName;
                            searchEntity.SortMethod = "asc";
                        }
                        StringBuilder cmdText = new StringBuilder();
                        cmdText.AppendFormat("select {0}  from ", searchEntity.ColumnSql);
                        cmdText.Append("(");
                        cmdText.AppendFormat("select ROW_NUMBER() over(order by {0} {1}) num,{2}  from {3} ", searchEntity.SortColumn, searchEntity.SortMethod, idColumn.ColumnName, tableName);
                        if (!string.IsNullOrEmpty(searchEntity.WhereSql))
                        {
                            cmdText.AppendFormat("where {0} ", searchEntity.WhereSql);
                        }
                        cmdText.Append(") ");
                        cmdText.AppendFormat("a inner join {0} b on a.{1}=b.{1} and  a.num between {2} and {3} ", tableName, idColumn.ColumnName, startNum, endNum);
                        IDataReader dataReader;
                        if (searchEntity.WhereParam != null)
                        {
                            dataReader = SqlDbBase.ExecuteReaderWithParam(connectionStr, cmdText.ToString(), CommandType.Text, searchEntity.WhereParam);
                        }
                        else
                        {
                            dataReader = SqlDbBase.ExecuteReader(connectionStr, cmdText.ToString(), CommandType.Text, null);
                        }
                        responsResult.Data = Map <T>(dataReader);
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(responsResult);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 执行分页数据查询操作,返回PageResponseData
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="connectionStr"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public override PageResponseData GetPageList <T>(string connectionStr, PageRequestData pageRequest)
        {
            PageResponseData responsResult = new PageResponseData();

            try
            {
                #region 相关变量定义
                Type   type         = typeof(T);
                string tableName    = type.Name;
                int    startNum     = pageRequest.PageSize * (pageRequest.PageIndex - 1);
                var    searchEntity = pageRequest.SearchEntityObj;
                #endregion

                #region 分页查询处理
                EntityColumn idColumn = new EntityColumnUtility().GetIdColumn <T>(null);
                if (idColumn != null)
                {
                    //查询记录结果数
                    responsResult.TotalCount = GetCount <T>(connectionStr, searchEntity);
                    if (responsResult.TotalCount > 0)
                    {
                        StringBuilder cmdText = new StringBuilder();
                        if (string.IsNullOrEmpty(searchEntity.ColumnSql))
                        {
                            searchEntity.ColumnSql = "*";
                        }
                        if (string.IsNullOrEmpty(searchEntity.SortColumn))
                        {
                            searchEntity.SortColumn = idColumn.ColumnName;
                        }
                        cmdText.AppendFormat("select {0} from {1} ", searchEntity.ColumnSql, tableName);
                        if (string.IsNullOrEmpty(searchEntity.WhereSql))
                        {
                            cmdText.AppendFormat("where {0} ", searchEntity.WhereSql);
                        }
                        cmdText.AppendFormat("order by {0} {1} ", searchEntity.SortColumn, searchEntity.SortMethod);
                        cmdText.AppendFormat("limit {0},{1} ", startNum, pageRequest.PageSize);
                        IDataReader dataReader;
                        if (searchEntity.WhereParam != null)
                        {
                            dataReader = SqlDbBase.ExecuteReaderWithParam(connectionStr, cmdText.ToString(), CommandType.Text, searchEntity.WhereParam);
                        }
                        else
                        {
                            dataReader = SqlDbBase.ExecuteReader(connectionStr, cmdText.ToString(), CommandType.Text, null);
                        }
                        responsResult.Data = Map <T>(dataReader);
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(responsResult);
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageRequestData requestData = new PageRequestData();

            requestData.m_RedirectFunction       = (string _RedirectURL) => { Response.Redirect(_RedirectURL); };
            requestData.m_GetQueryStringFunction = (string _Query) => { return(Request.QueryString.Get(_Query)); };
            requestData.RawURL          = Request.RawUrl;
            requestData.AbsoluteURLPath = Request.Url.AbsolutePath;
            PageResponeData data = GeneratePage(requestData);

            this.Title = data.Title;
            m_PageHTML = new MvcHtmlString(data.PageHTML);
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ContentAPI capi = new ContentAPI();
            if (!IsPostBack)
            {
                PageRequestData colrequest = new PageRequestData();
                colrequest.PageSize = 1000;
                colrequest.CurrentPage = 1;
                CollectionListData[] collection_list = capi.EkContentRef.GetCollectionList("", ref colrequest);
                collections.DataSource = collection_list;
                collections.DataBind();
            }

            // Register JS
            JS.RegisterJS(this, JS.ManagedScript.EktronJS);
            JS.RegisterJS(this, JS.ManagedScript.EktronTreeviewJS);

            // Register CSS
            Css.RegisterCss(this, Css.ManagedStyleSheet.EktronTreeviewCss);
        }
Ejemplo n.º 5
0
    // Render the UI:
    public void ShowControls()
    {
        Literal1.Text = string.Empty;
            System.Text.StringBuilder result = new System.Text.StringBuilder();
            CollectionListData[] gtNavs = null;
            EkContent gtObj = null;
            ApplicationAPI AppUI = new ApplicationAPI();

            long caller_id = AppUI.RequestInformationRef.CallerId;
            AppUI.RequestInformationRef.CallerId = EkConstants.InternalAdmin;
            gtObj = AppUI.EkContentRef;
            AppUI.RequestInformationRef.CallerId = caller_id;
            result.Append(m_refStyle.GetClientScript() + "\r\n");
            result.Append("<input type=HIDDEN value=\"true\" name=\"postback\" id=\"postback\"/>");
            result.Append("<table width=\"100%\" class=\"ektronGrid\">" + "\r\n");
            result.Append("	<tr>" + "\r\n");

            result.Append("		<td class=\"ektronTitlebar forceTitlebar\">" + "\r\n");

            if (_isMenu)
            {
                result.Append("			" + m_refMsg.GetMessage("lbl select menu") + "\r\n");
            }
            else if (_isUser)
            {
                result.Append("			" + m_refMsg.GetMessage("lbl select user") + "\r\n");
            }
            else
            {
                result.Append("			" + m_refMsg.GetMessage("lbl select collection") + "\r\n");
            }
            result.Append("		</td>" + "\r\n");
            result.Append("	</tr>" + "\r\n");
            if (_isUser)
            {
                result.Append("	<tr>" + "\r\n");
                result.Append("	<td class=\"ektronToolbar forceToolbar\">" + "\r\n");
                result.Append("			<table>" + "\r\n");
                result.Append("				<tr>" + "\r\n");

                result.Append("					<td>&nbsp;</td>" + "\r\n");

                result.Append("<td class=\"label\">&nbsp;" + m_refMsg.GetMessage("btn search") + ":<input type=text class=\"ektronTextMedium\" id=txtSearch name=txtSearch value=\"" + m_strKeyWords + "\" onkeydown=\"CheckForReturn(event)\">");
                result.Append("<select id=searchlist name=searchlist>");
                result.Append("<option value=-1" + IsSelected("-1") + ">All</option>");
                result.Append("<option value=\"last_name\"" + IsSelected("last_name") + ">" + m_refMsg.GetMessage("generic lastname") + "</option>");
                result.Append("<option value=\"first_name\"" + IsSelected("first_name") + ">" + m_refMsg.GetMessage("generic firstname") + "</option>");
                result.Append("<option value=\"display_name\"" + IsSelected("display_name") + ">" + m_refMsg.GetMessage("display name label") + "</option>");
                result.Append("</select><input type=button value=" + m_refMsg.GetMessage("btn search") + " id=btnSearch name=btnSearch onclick=\"searchuser();\" title=\"Search Users\"></td>");

                result.Append("				</tr>" + "\r\n");
                result.Append("			</table>" + "\r\n");
                result.Append("		</td>" + "\r\n");
                result.Append("	</tr>" + "\r\n");
            }
            result.Append("</table>" + "\r\n");

            if (_isMenu)
            {
                PageRequestData req = new PageRequestData();
                req.PageSize = m_refContentApi.RequestInformationRef.PagingSize;
                req.CurrentPage = _currentPageNumber;
                string searchText = string.Empty;
                caller_id = AppUI.RequestInformationRef.CallerId;
                AppUI.RequestInformationRef.CallerId = EkConstants.InternalAdmin;
                Collection menu_list = AppUI.EkContentRef.GetMenuReport(searchText, ref req);
                AppUI.RequestInformationRef.CallerId = caller_id;
                ConfigurePaging(req.TotalPages);

                result.Append("<table width=\"100%\" class=\"ektronGrid\">" + "\r\n");
                result.Append("	<tr>" + "\r\n");
                result.Append("		<td class=\"title-header\" width=\"30%\">" + m_refMsg.GetMessage("generic title") + "</td>" + "\r\n");
                result.Append("		<td class=\"title-header\" width=\"5%\">" + m_refMsg.GetMessage("generic id") + "</td>" + "\r\n");
                result.Append("		<td class=\"title-header\">" + m_refMsg.GetMessage("generic description") + "</td>" + "\r\n");
                result.Append("		<td class=\"title-header\">" + m_refMsg.GetMessage("generic language") + "</td>" + "\r\n");
                result.Append("		<td class=\"title-header\">" + m_refMsg.GetMessage("generic path") + "</td>" + "\r\n");
                result.Append("	</tr>" + "\r\n");

                if (menu_list != null && menu_list.Count > 0)
                {
                    string strBoldStart = "";
                    string strBoldEnd = "";
                    string title = "";

                    foreach (Collection temp_cList in menu_list)
                    {
                        title = Server.HtmlDecode(temp_cList["MenuTitle"].ToString());
                        if (m_nId == Convert.ToInt64(temp_cList["MenuID"]))
                        {
                            strBoldStart = "<b>";
                            strBoldEnd = "</b>";
                        }
                        else
                        {
                            strBoldStart = "";
                            strBoldEnd = "";
                        }

                        result.Append("	<tr>		" + "\r\n");
                        result.Append("		<td>" + strBoldStart);
                        result.Append("			<a href=\"#\" onclick=\"UpdateFormData(\'" + temp_cList["MenuID"]);
                        result.Append("\', \'" + title.Replace("\'", "\\\'") + "\', \'" + m_nMetadataFormTagId + "\');return false;\">");
                        result.Append(title + "</a>");
                        result.Append(strBoldEnd + "</td> " + "\r\n");
                        result.Append("		<td>" + strBoldStart + temp_cList["MenuID"] + strBoldEnd + "</td>" + "\r\n");
                        result.Append("		<td>" + strBoldStart + temp_cList["MenuDescription"] + strBoldEnd + "</td>" + "\r\n");
                        result.Append("		<td>" + strBoldStart + temp_cList["ContentLanguage"] + strBoldEnd + "</td>" + "\r\n");
                        result.Append("		<td>" + strBoldStart + temp_cList["Path"] + strBoldEnd + "</td>" + "\r\n");
                        result.Append("	</tr>" + "\r\n");
                    }
                }
                result.Append("</table>" + "\r\n");
                Literal1.Text += result.ToString();
                result = null;
                gtObj = null;
                menu_list = null;

            }
            else if (_isUser)
            {
                Ektron.Cms.API.User.User refUserApi = new Ektron.Cms.API.User.User();
                UserData[] user_list;
                UserRequestData req = new UserRequestData();
                int idx;
                string dispName;

                req.Type = -1; // Assigning -1 to retrieve all users in the system
                req.SearchText = m_strSearchText;
                req.PageSize = m_refContentApi.RequestInformationRef.PagingSize; // unlimited.
                req.CurrentPage = _currentPageNumber;
                user_list = refUserApi.GetAllUsers(ref req);
                ConfigurePaging(req.TotalPages);

                result.Append("<table width=\"100%\" class=\"ektronGrid forceMarginTop40\">" + "\r\n");
                result.Append("	<tr>" + "\r\n");
                result.Append("		<td class=\"title-header\" width=\"5%\">" + m_refMsg.GetMessage("generic id") + "</td>" + "\r\n");
                result.Append("		<td class=\"title-header\" >" + m_refMsg.GetMessage("display name label") + "</td>" + "\r\n");
                result.Append("		<td class=\"title-header\" >" + m_refMsg.GetMessage("lbl first name") + "</td>" + "\r\n");
                result.Append("		<td class=\"title-header\" >" + m_refMsg.GetMessage("lbl last name") + "</td>" + "\r\n");
                result.Append("	</tr>" + "\r\n");

                if (user_list != null)
                {
                    for (idx = 0; idx <= user_list.Length - 1; idx++)
                    {
                        if (999999999 == user_list[idx].Id)
                        {
                            continue;
                        }
                        dispName = (string) ((0 < user_list[idx].DisplayName.Length) ? (user_list[idx].DisplayName) : (user_list[idx].FirstName));
                        result.Append("	<tr>		" + "\r\n");
                        result.Append("		<td>" + user_list[idx].Id + "</td>" + "\r\n");
                        result.Append("		<td>");
                        result.Append("			<a href=\"#\" onclick=\"UpdateFormData(\'" + user_list[idx].Id);
                        result.Append("\', \'" + dispName.Replace("\'", "\\\'") + "\', \'" + m_nMetadataFormTagId + "\');return false;\">");
                        result.Append(dispName + "</a>");
                        result.Append("</td> " + "\r\n");
                        result.Append("		<td>" + user_list[idx].FirstName + "</td>" + "\r\n");
                        result.Append("		<td>" + user_list[idx].LastName + "</td>" + "\r\n");
                        result.Append("	</tr>" + "\r\n");
                    }
                }

                result.Append("</table>" + "\r\n");
                Literal1.Text += result.ToString();
                result = null;
                refUserApi = null;

            }
            else
            {
                // collections:
                result.Append("<table width=\"100%\" class=\"ektronGrid forceMarginTop40\">" + "\r\n");
                result.Append("	<tr>" + "\r\n");
                result.Append("		<td class=\"title-header\" width=\"30%\">" + m_refMsg.GetMessage("generic title") + "</td>" + "\r\n");
                result.Append("		<td class=\"title-header\" width=\"5%\">" + m_refMsg.GetMessage("generic id") + "</td>" + "\r\n");
                result.Append("		<td class=\"title-header\">" + m_refMsg.GetMessage("generic description") + "</td>" + "\r\n");
                result.Append("		<td class=\"title-header\">" + m_refMsg.GetMessage("generic path") + "</td>" + "\r\n");
                result.Append("	</tr>" + "\r\n");
                PageRequestData req = new PageRequestData();
                req.PageSize = m_refContentApi.RequestInformationRef.PagingSize;
                req.CurrentPage = _currentPageNumber;
                string searchText = string.Empty;
                gtNavs = gtObj.GetCollectionList(searchText, ref req);
                ConfigurePaging(req.TotalPages);
                if (gtNavs != null && gtNavs.Length  > 0)
                {
                    int count = 0;
                    string strBoldStart = "";
                    string strBoldEnd = "";
                    string title = "";

                    for (count = 0; count <= gtNavs.Length - 1; count++)
                    {
                        title = "";
                        title = Server.HtmlDecode(gtNavs[count].Title.ToString());
                        if (m_nId == gtNavs[count].Id)
                        {
                            strBoldStart = "<b>";
                            strBoldEnd = "</b>";
                        }
                        else
                        {
                            strBoldStart = "";
                            strBoldEnd = "";
                        }

                        result.Append("	<tr>		" + "\r\n");
                        result.Append("		<td>" + strBoldStart);
                        result.Append("			<a href=\"#\" onclick=\"UpdateFormData(\'" + gtNavs[count].Id);
                        result.Append("\', \'" + title.Replace("\'", "\\\'") + "\', \'" + m_nMetadataFormTagId + "\');return false;\">");
                        result.Append(title + "</a>");
                        result.Append(strBoldEnd + "</td> " + "\r\n");
                        result.Append("		<td>" + strBoldStart + gtNavs[count].Id + strBoldEnd + "</td>" + "\r\n");
                        result.Append("		<td>" + strBoldStart + gtNavs[count].Description + strBoldEnd + "</td>" + "\r\n");
                        result.Append("		<td>" + strBoldStart + gtNavs[count].FolderPath + strBoldEnd + "</td>" + "\r\n");
                        result.Append("	</tr>" + "\r\n");

                    }
                    gtObj = null;
                    gtNavs = null;
                }
                result.Append("</table>" + "\r\n");

                Literal1.Text += result.ToString();
                result = null;
            }
    }
Ejemplo n.º 6
0
    private void LoadMenuList()
    {
        PageRequestData req = new PageRequestData();
        req.PageSize = m_refContentApi.RequestInformationRef.PagingSize;
        req.CurrentPage = _currentPageNumber;
        m_strKeyWords = Request.Form["txtSearch"];
        if (m_strKeyWords == null)
        {
            m_strKeyWords = "";
        }
        Collection menu_list = m_refApi.EkContentRef.GetMenuReport(m_strKeyWords, ref req);
        TotalPagesNumber = req.TotalPages;
        PageSettings();
        ViewAllMenuToolBar(m_strKeyWords);
        if ((menu_list != null) && menu_list.Count > 0)
        {
            CollectionListGrid.Columns.Add(m_refStyle.CreateBoundField("TITLE", MsgHelper.GetMessage("generic Title"), "", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(30), Unit.Percentage(30), false, false));
            CollectionListGrid.Columns.Add(m_refStyle.CreateBoundField("ID", MsgHelper.GetMessage("generic ID"), "", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false));
            CollectionListGrid.Columns.Add(m_refStyle.CreateBoundField("LANGUAGE", MsgHelper.GetMessage("generic language"), "", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false));
            CollectionListGrid.Columns.Add(m_refStyle.CreateBoundField("DESCRIPTION", MsgHelper.GetMessage("generic Description"), "", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(35), Unit.Percentage(40), false, false));
            CollectionListGrid.Columns.Add(m_refStyle.CreateBoundField("PATH", MsgHelper.GetMessage("generic Path"), "", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(25), Unit.Percentage(25), false, false));
            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("LANGUAGE", typeof(string)));
            dt.Columns.Add(new DataColumn("DESCRIPTION", typeof(string)));
            dt.Columns.Add(new DataColumn("PATH", typeof(string)));

            foreach (Collection coll in menu_list)
            {
                dr = dt.NewRow();
                if (m_refApi.TreeModel == 0)
                {
                    dr["TITLE"] = "<a href=\"collections.aspx?folderid=" + coll["FolderID"].ToString() + "&Action=ViewMenu&nid=" + coll["MenuID"] + "&bpage=reports&LangType=" + coll["ContentLanguage"] + "\"  alt=\'" + MsgHelper.GetMessage("generic View") + " \"" + Strings.Replace((string)(coll["MenuTitle"]), "\'", "`", 1, -1, 0) + "\"\' title=\'" + MsgHelper.GetMessage("generic View") + " \"" + Strings.Replace((string)(coll["MenuTitle"]), "\'", "`", 1, -1, 0) + "\"\'>" + coll["MenuTitle"] + "</a>";
                }
                else
                {
                    string enableQDOparam = "";
                    if (Convert.ToInt32(coll["EnableReplication"]) == 1)
                    {
                        enableQDOparam = "&qdo=1";
                    }
                    //dr("TITLE") = "<a href=""menutree.aspx?folderid=" & menu_list(i)("FolderID") & "&nid=" & menu_list(i)("MenuID") & "&bpage=reports&LangType=" & menu_list(i)("ContentLanguage") & """  alt='" & MsgHelper.GetMessage("generic View") & " """ & Replace(menu_list(i)("MenuTitle"), "'", "`") & """' title='" & MsgHelper.GetMessage("generic View") & " """ & Replace(menu_list(i)("MenuTitle"), "'", "`") & enableQDOparam & """'>" & menu_list(i)("MenuTitle") & "</a>"
                    dr["TITLE"] = "<a href=\"menu.aspx?Action=viewcontent&menuid=" + coll["MenuID"] + "&LangType=" + coll["ContentLanguage"] + "&treeViewId=-3" + "\"  alt=\'" + MsgHelper.GetMessage("generic View") + " \"" + Strings.Replace((string)(coll["MenuTitle"]), "\'", "`", 1, -1, 0) + "\"\' title=\'" + MsgHelper.GetMessage("generic View") + " \"" + Strings.Replace((string)(coll["MenuTitle"]), "\'", "`", 1, -1, 0) + enableQDOparam + "\"\'>" + coll["MenuTitle"] + "</a>";
                }
                dr["ID"] = coll["MenuID"];
                dr["LANGUAGE"] = coll["ContentLanguage"];
                dr["DESCRIPTION"] = coll["MenuDescription"];
                dr["PATH"] = coll["Path"];
                dt.Rows.Add(dr);
            }
            DataView dv = new DataView(dt);
            CollectionListGrid.DataSource = dv;
            CollectionListGrid.DataBind();
        }
    }
Ejemplo n.º 7
0
    private void LoadCollectionList()
    {
        PageRequestData req = new PageRequestData();
        req.PageSize = m_refContentApi.RequestInformationRef.PagingSize;
        req.CurrentPage = _currentPageNumber;
        m_strKeyWords = Request.Form["txtSearch"];
        if (m_strKeyWords == null)
        {
            m_strKeyWords = "";
        }
        Collection gtNavs = null;
        CollectionListData[] collection_list =null;
        if (folderID > 0 || report)
        {
            gtNavs = AppUI.EkContentRef.GetAllCollectionsInfo(folderID, "title");
            TotalPagesNumber =0;
            PageSettings();
        }
        else
        {
            collection_list = m_refApi.EkContentRef.GetCollectionList(m_strKeyWords, ref req);
            TotalPagesNumber = req.TotalPages;
            PageSettings();
        }

        ViewAllCollectionToolBar(m_strKeyWords);
        if ((collection_list != null) && collection_list.Length > 0)
        {
            CollectionListGrid.Columns.Add(m_refStyle.CreateBoundField("TITLE", MsgHelper.GetMessage("generic Title"), "", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(30), Unit.Percentage(30), false, false));
            CollectionListGrid.Columns.Add(m_refStyle.CreateBoundField("ID", MsgHelper.GetMessage("generic ID"), "", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false));
            CollectionListGrid.Columns.Add(m_refStyle.CreateBoundField("DESCRIPTION", MsgHelper.GetMessage("generic Description"), "", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(40), Unit.Percentage(40), false, false));
            CollectionListGrid.Columns.Add(m_refStyle.CreateBoundField("PATH", MsgHelper.GetMessage("generic Path"), "", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(25), Unit.Percentage(25), false, false));
            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("DESCRIPTION", typeof(string)));
            dt.Columns.Add(new DataColumn("PATH", typeof(string)));

            for (int i = 0; i <= collection_list.Length - 1; i++)
            {
                // Display all the collection in the list found. This is displayed under the Content -> Collection view.
                if (folderID == 0)
                {
                    string vAction = "";
                    if (collection_list[i].ApprovalRequired && collection_list[i].Status != "A")
                    {
                        vAction = "&Action=ViewStage";
                    }
                    else
                    {
                        vAction = "&Action=View";
                    }
                    dr = dt.NewRow();
                    dr["TITLE"] = "<a href=\"collections.aspx?folderid=" + collection_list[i].FolderId + vAction + "&nid=" + collection_list[i].Id + "&bpage=reports\" alt=\'" + MsgHelper.GetMessage("generic View") + " \"" + Strings.Replace(collection_list[i].Title, "\'", "`", 1, -1, 0) + "\"\' title=\'" + MsgHelper.GetMessage("generic View") + " \"" + Strings.Replace(collection_list[i].Title, "\'", "`", 1, -1, 0) + "\"\'>" + collection_list[i].Title + "</a>";
                    dr["ID"] = collection_list[i].Id;
                    dr["DESCRIPTION"] = collection_list[i].Description;
                    dr["PATH"] = collection_list[i].FolderPath;
                    dt.Rows.Add(dr);
                }
                // Display the collection that are assigned to a particular folder.
                else if (folderID == collection_list[i].FolderId)
                {
                    string vAction = "";
                    if (collection_list[i].ApprovalRequired && collection_list[i].Status != "A")
                    {
                        vAction = "&Action=ViewStage";
                    }
                    else
                    {
                        vAction = "&Action=View";
                    }
                    dr = dt.NewRow();
                    dr["TITLE"] = "<a href=\"collections.aspx?folderid=" + collection_list[i].FolderId + vAction + "&nid=" + collection_list[i].Id + "&bpage=reports\" alt=\'" + MsgHelper.GetMessage("generic View") + " \"" + Strings.Replace(collection_list[i].Title, "\'", "`", 1, -1, 0) + "\"\' title=\'" + MsgHelper.GetMessage("generic View") + " \"" + Strings.Replace(collection_list[i].Title, "\'", "`", 1, -1, 0) + "\"\'>" + collection_list[i].Title + "</a>";
                    dr["ID"] = collection_list[i].Id;
                    dr["DESCRIPTION"] = collection_list[i].Description;
                    dr["PATH"] = collection_list[i].FolderPath;
                    dt.Rows.Add(dr);
                }
            }
            DataView dv = new DataView(dt);
            CollectionListGrid.DataSource = dv;
            CollectionListGrid.DataBind();
        }
        if ((gtNavs != null) && gtNavs.Count > 0)
        {
            CollectionListGrid.Columns.Add(m_refStyle.CreateBoundField("CollectionTitle", MsgHelper.GetMessage("generic Title"), "", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(30), Unit.Percentage(30), false, false));
            CollectionListGrid.Columns.Add(m_refStyle.CreateBoundField("CollectionID", MsgHelper.GetMessage("generic ID"), "", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false));
            CollectionListGrid.Columns.Add(m_refStyle.CreateBoundField("DisplayLastEditDate", MsgHelper.GetMessage("generic Date Modified"), "", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(25), Unit.Percentage(25), false, false));
            CollectionListGrid.Columns.Add(m_refStyle.CreateBoundField("CollectionTemplate", MsgHelper.GetMessage("generic URL Link"), "", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(40), Unit.Percentage(40), false, false));

            DataTable dt = new DataTable();
            DataRow dr;
            dt.Columns.Add(new DataColumn("CollectionTitle", typeof(string)));
            dt.Columns.Add(new DataColumn("CollectionID", typeof(string)));
            dt.Columns.Add(new DataColumn("DisplayLastEditDate", typeof(string)));
             dt.Columns.Add(new DataColumn("CollectionTemplate", typeof(string)));

            if (gtNavs.Count > 0)
            {
                DataTable dtItems = new DataTable();
                dtItems.Columns.Add("CollectionID");
                dtItems.Columns.Add("DisplayLastEditDate");
                dtItems.Columns.Add("CollectionTemplate");
                dtItems.Columns.Add("CollectionTitle");
                dtItems.Columns.Add("CollectionLink");

                foreach (Collection gtNa in gtNavs)
                {
                    string colAction = "";
                    if (Convert.ToBoolean(gtNa["ApprovalRequired"]) && gtNa["Status"].ToString().ToUpper() != "A")
                        colAction = "&action=ViewStage";
                    else
                        colAction = "&action=View";
                    DataRow dRow = dtItems.NewRow();
                    dRow["CollectionID"] = gtNa["CollectionID"].ToString();
                    dRow["DisplayLastEditDate"] = gtNa["DisplayLastEditDate"].ToString();
                    dRow["CollectionTemplate"] = gtNa["CollectionTemplate"].ToString();
                    dRow["CollectionTitle"] = "<a href=\"collections.aspx?folderid=" + folderID + colAction + "&nid=" + gtNa["CollectionID"].ToString() + "&bpage=reports\" alt=\'" + MsgHelper.GetMessage("generic View") + " \"" + Strings.Replace(gtNa["CollectionTitle"].ToString(), "\'", "`", 1, -1, 0) + "\"\' title=\'" + MsgHelper.GetMessage("generic View") + " \"" + Strings.Replace(gtNa["CollectionTitle"].ToString(), "\'", "`", 1, -1, 0) + "\"\'>" + gtNa["CollectionTitle"].ToString() + "</a>";
                    dRow["CollectionLink"] = "collections.aspx?folderid=" + folderID + colAction + "&nid=" + gtNa["CollectionID"].ToString();
                    dtItems.Rows.Add(dRow);
                }
                CollectionListGrid.DataSource = dtItems;
                CollectionListGrid.DataBind();
            }

        }
    }
Ejemplo n.º 8
0
    private void Display_ViewTasks()
    {
        ltrPageBasePath.Text = "tasks.aspx?action=ViewTasks&ty=" + actiontype + "&page={0}";
        ltrFormAction.Text = "tasks.aspx?Action=UpdateStatePurge" + closeOnFinish + callBackPage;
        pnlViewTasks.Visible = true;
        StringBuilder sbViewTasks = new StringBuilder();
        Collection cTemplates = new Collection();
        Ektron.Cms.Content.EkTask brObj = AppUI.EkTaskRef;
        PageRequestData pgrdata = new PageRequestData();
        string backButtonUrl = string.Empty;
        long selectedUser = 0;
        long selectedUserType = 0;
        long userValue = 0;
        HttpCookie httpCookie = Ektron.Cms.CommonApi.GetEcmCookie();
        if (IsAdmin)
        {
            TaskItemType = 8;
        }
        else
        {
            TaskItemType = 14;
        }
        pgrdata.CurrentPage = CurrentPage;
        pgrdata.PageSize = AppUI.RequestInformationRef.PagingSize;
        backButtonUrl = "callbackpage=tasks.aspx&parm1=action&value1=ViewTasks&parm2=ty&value2=" + actiontype + "&parm3=orderby&value3=" + Request.QueryString["orderby"];
        switch (actiontype)
        {
            case "all":
                TaskItemType = 12;
                sTitleBar = MsgHelper.GetMessage("lbl View All Open Tasks In The System");
                break;
            case "both":
                TaskItemType = 9;
                State = -1;
                sTitleBar = MsgHelper.GetMessage("lbl View Tasks Assigned By and To") + "&nbsp;" + httpCookie["userfullname"];
                break;
            case "to":
                TaskItemType = 3;
                sTitleBar = MsgHelper.GetMessage("lbl View Tasks Assigned To") + "&nbsp;" + httpCookie["userfullname"];
                break;
            case "touser":
                TaskItemType = 3;
                sTitleBar = MsgHelper.GetMessage("lbl View Tasks Assigned To Selected User") + "&nbsp;" + httpCookie["userfullname"];
                break;
            case "by":
                TaskItemType = 7;
                State = -1;
                sTitleBar = MsgHelper.GetMessage("lbl View Tasks Assigned By") + "&nbsp;" + httpCookie["userfullname"];
                break;
            case "created":
                TaskItemType = 18;
                sTitleBar = MsgHelper.GetMessage("lbl View Tasks Created By") + "&nbsp;" + httpCookie["userfullname"];
                break;
            case "notstarted":
                State = 1;
                sTitleBar = MsgHelper.GetMessage("lbl view task in nonstarted state");
                break;
            case "active":
                State = 2;
                sTitleBar = MsgHelper.GetMessage("lbl view task in active state");
                break;
            case "awaitingdata":
                State = 3;
                sTitleBar = MsgHelper.GetMessage("lbl view task in awaiting data state");
                break;
            case "onhold":
                State = 4;
                sTitleBar = MsgHelper.GetMessage("lbl View Tasks In Hold State");
                break;
            case "pending":
                State = 5;
                sTitleBar = MsgHelper.GetMessage("lbl view task in pending state");
                break;
            case "reopened":
                State = 6;
                sTitleBar = MsgHelper.GetMessage("lbl view task in reopened state");
                break;
            case "completed":
                State = 7;
                sTitleBar = MsgHelper.GetMessage("lbl view task in completed state");
                break;
            case "archived":
                State = 8;
                sTitleBar = MsgHelper.GetMessage("lbl view task in archived state");
                break;
            case "deleted":
                State = 9;
                sTitleBar = MsgHelper.GetMessage("lbl view task in deleted state");
                break;
        }

        if ((actiontype == "touser"))
        {
            if (!string.IsNullOrEmpty(Request.QueryString["user"]))
            {
                selectedUser = Convert.ToInt64(Server.HtmlEncode(Request.QueryString["user"]));
            }
            if (selectedUser < 0)
            {
                selectedUser = currentUserID;
                selectedUserType = 1;
            }
            else
            {
                if (!string.IsNullOrEmpty(Request.QueryString["usertype"]))
                {
                    selectedUserType = Convert.ToInt64(Server.HtmlEncode(Request.QueryString["usertype"]));
                }
            }
            if (selectedUserType == 1)
            {
                cTasks = brObj.GetTasks(-1, selectedUser, State, TaskItemType, OrderBy, 0, ref pgrdata, "");
            }
            else
            {
                cTasks = brObj.GetTasks(-1, selectedUser, State, 19, OrderBy, 0, ref pgrdata, "");
            }
        }
        else if ((IsAdmin & (actiontype != "all" & actiontype != "both" & actiontype != "to" & actiontype != "by" & actiontype != "created" & actiontype != "touser")))
        {
            cTasks = brObj.GetTasks(-1, State, -1, TaskItemType, OrderBy, 0, ref pgrdata, "");
        }
        else
        {
            cTasks = objTask.GetTasks(-1, currentUserID, State, TaskItemType, OrderBy, 0, ref pgrdata, "");
        }
        if ((string.IsNullOrEmpty(ErrorString) & (actiontype == "to" | actiontype == "by" | actiontype == "touser")))
        {
            cTemplates = objTask.GetUsersForTask(currentUserID, -1);
        }
        if (ErrorString != string.Empty)
        {
            Response.Redirect("reterror.aspx?info=" + ErrorString, false);
        }

        sbViewTasks.Append("<table width=\"100%\" class=\"ektronGrid\">");
        sbViewTasks.Append("  <tr>");
        if (actiontype == "touser")
        {
            sbViewTasks.Append("<td>");
            sbViewTasks.Append("  <table>");
            sbViewTasks.Append("      <tr>");
            sbViewTasks.Append("          <td class=\"label\" title=\"Assign to User\">" + MsgHelper.GetMessage("lbl Assign to User") + "</td>");
            sbViewTasks.Append("          <td>");
            sbViewTasks.Append("              <select name=\"selectusergroup\" id=\"selectusergroup\">");
            sbViewTasks.Append("              <optgroup label=\"Users\">");
            for (int i = 1; i < cTemplates.Count; i++)
            {
                Collection coll = (Collection)cTemplates[i];
                if (coll.Contains("DisplayUserName"))
                {
                    if (!string.IsNullOrEmpty(coll["UserID"].ToString()))
                    {
                        long c = Convert.ToInt64(coll["UserID"].ToString());
                        if (c > 0)
                        {
                            userValue = Convert.ToInt64(coll["UserID"]);
                        }
                    }
                    sbViewTasks.Append("<option value=\"" + userValue + ",1\"");
                    if ((userValue == selectedUser) & selectedUserType == 1)
                    {
                        sbViewTasks.Append(" selected");
                    }
                    sbViewTasks.Append(">" + coll["DisplayUserName"] + "</option>");
                }

            }
            sbViewTasks.Append("              </optgroup>");
            sbViewTasks.Append("              <optgroup label=\"Groups\">");
            for (int j = 1; j < cTemplates.Count; j++)
            {
                Collection coll = (Collection)cTemplates[j];
                if (coll.Contains("DisplayUserGroupName"))
                {
                    if(!string.IsNullOrEmpty(coll["UserGroupID"].ToString()))
                    {
                        long c = Convert.ToInt64(coll["UserGroupID"]);
                        if (c > 0)
                        {
                            userValue = Convert.ToInt64(coll["UserGroupID"]);
                        }
                    }
                    sbViewTasks.Append("<option value=\"" + userValue + ",2\"");
                    if ((userValue == selectedUser) & selectedUserType == 2)
                    {
                        sbViewTasks.Append(" selected");
                    }
                    sbViewTasks.Append(">" + coll["DisplayUserGroupName"] + "</option>");
                }

            }
            sbViewTasks.Append("              </optgroup>");
            sbViewTasks.Append("             </select>");
            sbViewTasks.Append("          </td>");
            sbViewTasks.Append("          <td>");
            sbViewTasks.Append("              <a class=\"button buttonInline blueHover minHeight buttonViewTask\" type=\"button\" name=\"getusergrouptasks\" id=\"getusergrouptasks\" title=\"" + MsgHelper.GetMessage("btn view tasks") + "\" value=\"&nbsp;" + MsgHelper.GetMessage("btn view tasks") + "&nbsp;\" onclick=\"getTaskForUser()\">" + MsgHelper.GetMessage("generic view") + "</a>");
            sbViewTasks.Append("          </td>");
            sbViewTasks.Append("      </tr>");
            sbViewTasks.Append("    </table>");
            sbViewTasks.Append("  </td>");
        }
        else if (IsAdmin & (actiontype != "all" & actiontype != "both" & actiontype != "to" & actiontype != "by" & actiontype != "created"))
        {
            sbViewTasks.Append("<td>");
            sbViewTasks.Append("  <table>");
            sbViewTasks.Append("      <tr>");
            sbViewTasks.Append("          <td class=\"label\" title=\"" + MsgHelper.GetMessage("lbl changestate") + "\">" + MsgHelper.GetMessage("lbl Change to state") + "</td>");
            sbViewTasks.Append("          <td>");
            sbViewTasks.Append("              <select name=\"state\" id=\"state\">");
            sbViewTasks.Append("                  <option title=\"Not Started\" value=\"1\"");
            if (actiontype == "notstarted")
            {
                sbViewTasks.Append(" selected");
            }
            sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl not started") + "</option>");
            sbViewTasks.Append("<option title=\"Active\" value=\"2\"");
            if (actiontype == "active")
            {
                sbViewTasks.Append(" selected");
            }
            sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl active") + "</option>");
            sbViewTasks.Append("<option title=\"Awaiting Data\" value=\"3\"");
            if (actiontype == "awaitingdata")
            {
                sbViewTasks.Append(" selected");
            }
            sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl awaiting data") + "</option>");
            sbViewTasks.Append("<option title=\"On Hold\" value=\"4\"");
            if (actiontype == "onhold")
            {
                sbViewTasks.Append(" selected");
            }
            sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl on hold") + "</option>");
            sbViewTasks.Append("<option title=\"Pending\" value=\"5\"");
            if (actiontype == "pending")
            {
                sbViewTasks.Append(" selected");
            }
            sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl pending") + "</option>");
            sbViewTasks.Append("<option title=\"Reopened\" value=\"6\"");
            if (actiontype == "reopened")
            {
                sbViewTasks.Append(" selected");
            }
            sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl reopened") + "</option>");
            sbViewTasks.Append("<option title=\"Completed\" value=\"7\"");
            if (actiontype == "completed")
            {
                sbViewTasks.Append(" selected");
            }
            sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl completed") + "</option>");
            sbViewTasks.Append("<option title=\"Archived\" value=\"8\"");
            if (actiontype == "archived")
            {
                sbViewTasks.Append(" selected");
            }
            sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl archived") + "</option>");
            sbViewTasks.Append("<option title=\"Deleted\" value=\"9\"");
            if (actiontype == "deleted")
            {
                sbViewTasks.Append(" selected");
            }
            sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl deleted") + "</option>");
            sbViewTasks.Append("                 </select>");
            sbViewTasks.Append("             </td>");
            sbViewTasks.Append("             <td>");
            sbViewTasks.Append("                  <a title=\"" + MsgHelper.GetMessage("lbl Set State") + "\" class=\"button buttonInline blueHover minHeight buttonSet\" type=\"button\" name=\"setstate\" id=\"setstate\" value=\"&nbsp;" + MsgHelper.GetMessage("btn set") + "&nbsp;\" onclick=\"setTaskStateForSelTasks(0)\" >" + MsgHelper.GetMessage("btn set") + " </a>");
            sbViewTasks.Append("             </td>");
            if (IsAdmin & actiontype == "deleted")
            {
                sbViewTasks.Append("         <td>");
                sbViewTasks.Append("              <a title=\"Purge\" class=\"button buttonInline redHover minHeight buttonDelete\" type=\"button\" name=\"purgeButton\" id=\"purgeButton\" value=\"&nbsp;" + MsgHelper.GetMessage("btn Purge") + "&nbsp;\" onclick=\"setTaskStateForSelTasks(1)\" >" + MsgHelper.GetMessage("btn Purge") + "</a>");
                sbViewTasks.Append("         </td>");
            }
            sbViewTasks.Append("     </tr>");
            sbViewTasks.Append(" </table>");
            sbViewTasks.Append("</td>");
        }
        else if (IsAdmin & (actiontype != "all" & actiontype != "both" & actiontype != "created"))
        {
            sbViewTasks.Append("<td>");
            sbViewTasks.Append("  <table>");
            sbViewTasks.Append("      <tr>");
            sbViewTasks.Append("          <td class=\"label\" title=\"Assign to User\">" + MsgHelper.GetMessage("lbl Assign to User") + "</td>");
            sbViewTasks.Append("          <td>");
            sbViewTasks.Append("              <select name=\"selectusergroup\" id=\"selectusergroup\">");
            sbViewTasks.Append("              <optgroup label=\"Users\">");
            for (int i = 1; i < cTemplates.Count; i++)
            {
                Collection coll = (Collection)cTemplates[i];
                if (coll.Contains("DisplayUserName"))
                {
                    if (!string.IsNullOrEmpty(coll["UserID"].ToString()))
                    {
                        long c = Convert.ToInt64(coll["UserID"]);
                        if (c > 0)
                        {
                            userValue = c;
                        }
                    }
                    sbViewTasks.Append("<option value=\"" + userValue + ",1\"");
                    sbViewTasks.Append(">" + coll["DisplayUserName"] + "</option>");
                }
            }
            sbViewTasks.Append("              </optgroup>");
            sbViewTasks.Append("              <optgroup label=\"Groups\">");
            for (int j = 1; j < cTemplates.Count; j++)
            {
                Collection coll = (Collection)cTemplates[j];
                if (coll.Contains("DisplayUserGroupName"))
                {
                    if(!string.IsNullOrEmpty(coll["UserGroupID"].ToString()))
                    {
                        long c = Convert.ToInt64(coll["UserGroupID"]);
                        if (c > 0)
                        {
                            userValue = c;
                        }
                    }
                    sbViewTasks.Append("<option value=\"" + userValue + ",2\"");
                    sbViewTasks.Append(">" + coll["DisplayUserGroupName"] + "</option>");
                }
            }
            sbViewTasks.Append("              </optgroup>");
            sbViewTasks.Append("             </select>");
            sbViewTasks.Append("          </td>");
            sbViewTasks.Append("          <td>");
            sbViewTasks.Append("              <a title=\"Set User Group\" class=\"button buttonInline blueHover minHeight buttonSet\" type=\"button\" name=\"setusergroup\" id=\"setusergroup\" value=\"&nbsp;" + MsgHelper.GetMessage("btn set") + "&nbsp;\" onclick=\"setTaskStateForSelTasks(2)\" >" + MsgHelper.GetMessage("btn set") + "</a>");
            sbViewTasks.Append("          </td>");
            sbViewTasks.Append("      </tr>");
            sbViewTasks.Append("    </table>");
            sbViewTasks.Append("  </td>");
        }
        else if (actiontype == "notstarted" | actiontype == "active")
        {
            sbViewTasks.Append("<td>");
            sbViewTasks.Append("  <table>");
            sbViewTasks.Append("      <tr>");
            sbViewTasks.Append("          <td class=\"label\" title=\"" + MsgHelper.GetMessage("lbl changestate") + "\">" + MsgHelper.GetMessage("lbl Change To State") + "</td>");
            sbViewTasks.Append("          <td>");
            sbViewTasks.Append("              <select name=\"state\" id=\"state\">");
            sbViewTasks.Append("                  <option title=\"Awaiting Data\" value=\"3\" selected>Awaiting Data</option>");
            sbViewTasks.Append("                  <option title=\"On Hold\" value=\"4\">On Hold</option>");
            sbViewTasks.Append("              </select>");
            sbViewTasks.Append("          </td>");
            sbViewTasks.Append("          <td>");
            sbViewTasks.Append("              <a title=\"" + MsgHelper.GetMessage("lbl Set State") + "\" type=\"button\" class=\"button buttonInline blueHover minHeight buttonSet\" name=\"setstate\" id=\"setstate\" value=\"&nbsp;" + MsgHelper.GetMessage("btn set") + "&nbsp;\" onclick=\"setTaskStateForSelTasks(0)\" >" + MsgHelper.GetMessage("btn set") + "</a>");
            sbViewTasks.Append("          </td>");
            sbViewTasks.Append("      </tr>");
            sbViewTasks.Append("  </table>");
            sbViewTasks.Append("</td>");
        }
        else if (actiontype == "awaitingdata")
        {
            sbViewTasks.Append("<td>");
            sbViewTasks.Append("  <table>");
            sbViewTasks.Append("      <tr>");
            sbViewTasks.Append("          <td class=\"label\" title=\"" + MsgHelper.GetMessage("lbl changestate") + "\">" + MsgHelper.GetMessage("lbl Change To State") + "</td>");
            sbViewTasks.Append("          <td>");
            sbViewTasks.Append("              <select name=\"state\" id=\"state\">");
            sbViewTasks.Append("                  <option title=\"Active\" value=\"2\" selected>Active</option>");
            sbViewTasks.Append("                  <option title=\"On Hold\" value=\"4\">On Hold</option>");
            sbViewTasks.Append("              </select>");
            sbViewTasks.Append("          </td>");
            sbViewTasks.Append("          <td>");
            sbViewTasks.Append("              <a title=\"" + MsgHelper.GetMessage("lbl Set State") + "\" type=\"button\" class=\"button buttonInline blueHover minHeight buttonSet\" name=\"setstate\" id=\"setstate\" value=\"&nbsp;" + MsgHelper.GetMessage("btn set") + "&nbsp;\" onclick=\"setTaskStateForSelTasks(0)\" >" + MsgHelper.GetMessage("btn set") + "</a>");
            sbViewTasks.Append("          </td>");
            sbViewTasks.Append("      </tr>");
            sbViewTasks.Append("  </table>");
            sbViewTasks.Append("</td>");
        }
        else if (actiontype == "onhold")
        {
            sbViewTasks.Append("<td>");
            sbViewTasks.Append("  <table id=\"Table35\">");
            sbViewTasks.Append("      <tr>");
            sbViewTasks.Append("          <td class=\"label\" title=\"" + MsgHelper.GetMessage("lbl changestate") + "\">" + MsgHelper.GetMessage("lbl Change To State") + "</td>");
            sbViewTasks.Append("          <td>");
            sbViewTasks.Append("              <select name=\"state\" id=\"state\">");
            sbViewTasks.Append("                  <option title=\"Active\" value=\"2\" selected>Active</option>");
            sbViewTasks.Append("                  <option title=\"Awaiting Data\" value=\"3\">Awaiting Data</option>");
            sbViewTasks.Append("              </select>");
            sbViewTasks.Append("          </td>");
            sbViewTasks.Append("          <td>");
            sbViewTasks.Append("              <a title=\""+MsgHelper.GetMessage("lbl Set State")+"\" type=\"button\" class=\"button buttonInline blueHover minHeight buttonSet\" name=\"setstate\" id=\"setstate\" value=\"&nbsp;" + MsgHelper.GetMessage("btn set") + "&nbsp;\" onclick=\"setTaskStateForSelTasks(0)\" >" + MsgHelper.GetMessage("btn set") + "</a>");
            sbViewTasks.Append("          </td>");
            sbViewTasks.Append("      </tr>");
            sbViewTasks.Append("  </table>");
            sbViewTasks.Append("</td>");
        }
        else if (actiontype == "completed")
        {
            sbViewTasks.Append("<td>");
            sbViewTasks.Append("  <table>");
            sbViewTasks.Append("      <tr>");
            sbViewTasks.Append("          <td class=\"label\" title=\"" + MsgHelper.GetMessage("lbl changestate") + "\">" + MsgHelper.GetMessage("lbl Change To State") + "</td>");
            sbViewTasks.Append("          <td>");
            sbViewTasks.Append("              <select name=\"state\" id=\"state\">");
            sbViewTasks.Append("                  <option title=\"Archived\" value=\"8\" selected>Archived</option>");
            sbViewTasks.Append("              </select>");
            sbViewTasks.Append("          </td>");
            sbViewTasks.Append("          <td>");
            sbViewTasks.Append("              <a title=\"" + MsgHelper.GetMessage("lbl Set State") + "\" type=\"button\" class=\"button buttonInline blueHover minHeight buttonSet\" name=\"setstate\" id=\"setstate\" value=\"&nbsp;" + MsgHelper.GetMessage("btn set") + "&nbsp;\" onclick=\"setTaskStateForSelTasks(0)\" >" + MsgHelper.GetMessage("btn set") + "</a>");
            sbViewTasks.Append("          </td>");
            sbViewTasks.Append("      </tr>");
            sbViewTasks.Append("  </table>");
            sbViewTasks.Append("</td>");
        }

        sbViewTasks.Append("      <td class=\"label\" align=\"right\" title=\"" + MsgHelper.GetMessage("lbl show tasktype") + "\">" + MsgHelper.GetMessage("lbl show task type"));
        sbViewTasks.Append("          <select name=\"show_task_type\" id=\"show_task_type\" onchange=\"RefreshTasksWithTaskType();\">");
        sbViewTasks.Append("          </select>");
        sbViewTasks.Append("      </td>");
        sbViewTasks.Append("  </tr>");
        sbViewTasks.Append("</table>");
        sbViewTasks.Append("<div class=\"\">");
        if (cTasks.Count == 0)
        {
            this.uxPaging.Visible = false;
            sbViewTasks.Append("<p title=\"Currently there is no data to report\">" + MsgHelper.GetMessage("msg no data report") + "</p>");
        }
        else
        {
            if (pgrdata.TotalPages > 1)
            {
                this.uxPaging.ClientFunction = "GoToPage(this); return false;";
                this.uxPaging.Visible = true;
                this.uxPaging.TotalPages = pgrdata.TotalPages;
                this.uxPaging.CurrentPageIndex = pgrdata.CurrentPage - 1;
            }
            else
            {
                this.uxPaging.Visible = false;
            }
            sbViewTasks.Append("  <table class=\"ektronGrid\" style=\"width:100%;\">");
            sbViewTasks.Append("      <tr class=\"title-header\">");
            if (IsAdmin & (actiontype != "all" & actiontype != "both" & actiontype != "touser"))
            {
                sbViewTasks.Append("<td width=\"1\">");
                sbViewTasks.Append("  <input title=\"Check All\" type=\"checkbox\" name=\"all\" onclick=\"checkAll(document.forms.viewtasks.all.checked);\" id=\"Checkbox3\" />");
                sbViewTasks.Append("</td>");
            }
            else if (actiontype == "notstarted" | actiontype == "active" | actiontype == "completed" | actiontype == "awaitingdata" | actiontype == "onhold")
            {
                sbViewTasks.Append("<td width=\"1\">");
                sbViewTasks.Append("  <input title=\"Check All\" type=\"checkbox\" name=\"all\" onclick=\"checkAll(document.forms.viewtasks.all.checked);\" id=\"Checkbox6\" />");
                sbViewTasks.Append("</td>");
            }
            sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=title&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("generic Title") + "</a></td>");
            sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=content_id&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("lbl CID") + "</a></td>");
            sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=state&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("lbl state") + "</a></td>");
            sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=priority&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("lbl priority") + "</a></td>");
            sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=duedate&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("lbl Due Date") + "</a></td>");
            sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=assignedto&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("lbl Assigned To") + "</a></td>");
            sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=assignedby&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("lbl Assigned By") + "</a></td>");
            sbViewTasks.Append("<td>" + MsgHelper.GetMessage("lbl Last Added comments") + "</td>");
            sbViewTasks.Append("<td>" + MsgHelper.GetMessage("lbl Create Date") + "</td>");
            sbViewTasks.Append("</tr>");
            bool bHasTask = false;
            for (int counter = 1; counter < cTasks.Count + 1; counter++)
            {
                EkTask cTask = cTasks.get_Item(counter);
                if (!(cTask.TaskTypeID == Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.TaskType.BlogPostComment) | cTask.TaskTypeID == Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.TaskType.TopicReply)))
                {
                    bHasTask = true;

                    sbViewTasks.Append("<tr id=\"task_" + cTask.TaskID + "_" + counter + "_");
                    if (cTask.TaskTypeID <= 0)
                    {
                        sbViewTasks.Append("NotS\">");
                    }
                    else
                    {
                        sbViewTasks.Append(cTask.TaskTypeID + "\" >");
                    }
                    sbViewTasks.Append("<script type=\"text/javascript\">");
                    sbViewTasks.Append("AddShownTaskID('task_" + cTask.TaskID + "_" + counter + "_");
                    if (cTask.TaskTypeID <= 0)
                    {
                        sbViewTasks.Append("NotS')");
                    }
                    else
                    {
                        sbViewTasks.Append(cTask.TaskTypeID + "')");
                    }
                    sbViewTasks.Append("</script>");
                    if (IsAdmin & (actiontype != "all" & actiontype != "both" & actiontype != "touser"))
                    {
                        sbViewTasks.Append("<td nowrap width=\"1\">");
                        sbViewTasks.Append("<input title=\"Task Type\" type=\"checkbox\" onclick=\"checkAllFalse();\" name=\"" + cTask.TaskID + "\"  value=\"" + cTask.TaskID + "\" id=\"_" + cTask.TaskID + "_" + counter + "_");
                        if (cTask.TaskTypeID <= 0)
                        {
                            sbViewTasks.Append("NotS\">");
                        }
                        else
                        {
                            sbViewTasks.Append(cTask.TaskTypeID + "\" >");
                        }
                        sbViewTasks.Append("</td>");
                    }
                    else if (actiontype == "notstarted" | actiontype == "active" | actiontype == "completed" | actiontype == "awaitingdata" | actiontype == "onhold")
                    {
                        sbViewTasks.Append("<td nowrap width=\"1\">");
                        sbViewTasks.Append("<input title=\"Task ID\" type=\"checkbox\" onclick=\"checkAllFalse();\" name=\"" + cTask.TaskID + "\"  value=\"" + cTask.TaskID + "\" id=\"_" + cTask.TaskID + "_" + counter + "_");
                        if (cTask.TaskTypeID <= 0)
                        {
                            sbViewTasks.Append("NotS\">");
                        }
                        else
                        {
                            sbViewTasks.Append(cTask.TaskTypeID + "\" >");
                        }
                        sbViewTasks.Append("</td>");
                    }
                    sbViewTasks.Append("<td nowrap=\"nowrap\">");
                    sbViewTasks.Append("  <a href=\"tasks.aspx?action=ViewTask&tid=" + cTask.TaskID + "&ty=" + actiontype + "&" + backButtonUrl + "\">" + cTask.TaskTitle + "</a>");
                    sbViewTasks.Append("</td>");
                    if (cTask.ContentID != -1)
                    {
                        if (Convert.ToInt32(cTask.ContentType) == 2 | Convert.ToInt32(cTask.ContentType) == 4)
                        {
                            sbViewTasks.Append("<td nowrap=\"nowrap\"><a href=\"cmsform.aspx?action=ViewForm&form_id=" + cTask.ContentID + "&LangType=" + cTask.LanguageID + "&callerpage=tasks.aspx&origurl=" + Server.UrlEncode(Request.ServerVariables["QUERY_STRING"]) + "\" title=\"" + MsgHelper.GetMessage("generic View") + " " + cTask.ContentTitle.Replace("'", "`") + "\">" + cTask.ContentID + "</a></td>");
                        }
                        else
                        {
                            sbViewTasks.Append("<td nowrap=\"nowrap\"><a href=\"content.aspx?action=View&id=" + cTask.ContentID + "&LangType=" + cTask.LanguageID + "&callerpage=tasks.aspx&origurl=" + Server.UrlEncode(Request.ServerVariables["QUERY_STRING"]) + "\" title=\"" + MsgHelper.GetMessage("generic View") + " " + cTask.ContentTitle.Replace("'", "`") + "\">" + cTask.ContentID + "</a></td>");
                        }
                    }
                    else
                    {
                        sbViewTasks.Append("<td>&nbsp;</td>");
                    }
                    switch (cTask.State)
                    {
                        case "1":
                            sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl not started")+"</td>");
                            break;
                        case "2":
                            sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl active")+"</td>");
                            break;
                        case "3":
                            sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl awaiting data")+"</td>");
                            break;
                        case "4":
                            sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl on hold")+"</td>");
                            break;
                        case "5":
                            sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl pending")+"</td>");
                            break;
                        case "6":
                            sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl reopened")+"</td>");
                            break;
                        case "7":
                            sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl completed")+"</td>");
                            break;
                        case "8":
                            sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl archived")+"</td>");
                            break;
                        case "9":
                            sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl deleted")+"</td>");
                            break;
                    }
                    switch (Convert.ToInt32(cTask.Priority))
                    {
                        case 1:
                            sbViewTasks.Append("<td nowrap=\"true\">" + this.MsgHelper.GetMessage("lbl low") + "</td>");
                            break;
                        case 2:
                            sbViewTasks.Append("<td nowrap=\"true\">" + this.MsgHelper.GetMessage("lbl normal") + "</td>");
                            break;
                        case 3:
                            sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl high")+"</td>");
                            break;
                        case 0:
                            sbViewTasks.Append("<td nowrap=\"true\">[" + this.MsgHelper.GetMessage("dd not specified") + "]</td>");
                            break;
                    }
                    if ((!string.IsNullOrEmpty(cTask.DueDate)))
                    {
                        if ((Convert.ToDateTime(cTask.DueDate) < DateTime.Today))
                        {
                            sbViewTasks.Append("<td nowrap=\"true\" class=\"important\">" + AppUI.GetInternationalDateOnly(cTask.DueDate) + "</td>");
                        }
                        else
                        {
                            sbViewTasks.Append("<td nowrap=\"true\">" + AppUI.GetInternationalDateOnly(cTask.DueDate) + "</td>");
                        }
                    }
                    else
                    {
                        sbViewTasks.Append("<td nowrap=\"true\">[" + this.MsgHelper.GetMessage("dd not specified") + "]</td>");
                    }
                    if (cTask.AssignToUserGroupID == 0)
                    {
                        if (cTask.ContentID != -1)
                        {
                            sbViewTasks.Append("<td nowrap=\"true\">All Authors of (" + cTask.ContentID + ")</td>");
                        }
                        else
                        {
                            sbViewTasks.Append("<td nowrap=\"true\">All Authors</td>");
                        }
                    }
                    else if (cTask.AssignedToUser != "")
                    {
                        sbViewTasks.Append("<td nowrap=\"nowrap\">");
                        sbViewTasks.Append("<img src=\"" + AppPath + "images/UI/Icons/user.png\" alt=\"\" align=\"absbottom\"/>");
                        sbViewTasks.Append(m_refEmail.MakeUserTaskEmailLink(cTask, false));
                        sbViewTasks.Append("</td>");
                    }
                    else if (cTask.AssignToUserGroupID != 0)
                    {
                        sbViewTasks.Append("<td nowrap=\"nowrap\">");
                        sbViewTasks.Append("<img src=\"" + AppPath + "images/UI/Icons/user.png\" alt=\"\" align=\"absbottom\"/>");
                        sbViewTasks.Append(m_refEmail.MakeUserGroupTaskEmailLink(cTask));
                        sbViewTasks.Append("</td>");
                    }
                    else
                    {
                        sbViewTasks.Append("<td>&nbsp;</td>");
                    }
                    sbViewTasks.Append("<td nowrap=\"nowrap\">");
                    sbViewTasks.Append(m_refEmail.MakeByUserTaskEmailLink(cTask, false));
                    sbViewTasks.Append("</td>");
                    if (cTask.LastComment == "")
                    {
                        sbViewTasks.Append("<td >[" + this.MsgHelper.GetMessage("dd not specified") + "]</td>");
                    }
                    else
                    {
                        sbViewTasks.Append("<td ><div class=\"comment-block\">" + cTask.LastComment + "</div></td>");
                    }
                    sbViewTasks.Append("<td>" + AppUI.GetInternationalDateOnly(cTask.DateCreated) + "</td>");
                    sbViewTasks.Append("</tr>");
                }
            }
            sbViewTasks.Append("</table>");
            if (!bHasTask)
            {
                sbViewTasks.Append("<p>" + MsgHelper.GetMessage("msg no data report") + "</p>");
            }
        }
        sbViewTasks.Append("<input type=\"hidden\" name=\"taskids\" value=\"\" id=\"taskids\"/>");
        sbViewTasks.Append("<input type=\"hidden\" name=\"purge\" value=\"\" id=\"purge\"/>");
        sbViewTasks.Append("<input type=\"hidden\" name=\"actiontype\" value=\"" + actiontype + "\" id=\"actiontype\"/>");
        sbViewTasks.Append("<input type=\"hidden\" name=\"rptHtml\" value=\"\" id=\"rptHtml\"/>");
        sbViewTasks.Append("<input type=\"hidden\" name=\"rptTitle\" value=\"\" id=\"rptTitle\"/>");
        sbViewTasks.Append("</div>");
        ltrViewTasks.Text = sbViewTasks.ToString();
    }
Ejemplo n.º 9
0
    private void Display_ViewContentTask()
    {
        pnlViewContentTask.Visible = true;
        objTask = AppUI.EkTaskRef;
        TaskItemType = 1;
        TaskID = ContentId;
        if (TaskID <= 0)
        {
            Response.Redirect("reterror.aspx?info=");
        }
        if (!string.IsNullOrEmpty(Request.QueryString["LangType"]))
        {
            languageID = Convert.ToInt32(Request.QueryString["LangType"]);
        }
        objTask.LanguageID = languageID;
        PageRequestData prdata = new PageRequestData();
        objTask.GetTasks(TaskID, -1, -1, TaskItemType, OrderBy, languageID, ref prdata, "");
        callBackPage = BuildCallBackParms("&");
        if (actiontype == "both")
        {
            sTitleBar =this.MsgHelper.GetMessage("lbl View All Tasks for content")+" (" + TaskID + ")";
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 1; i < cTasks.Count + 1; i++)
        {
            objTask = cTasks.get_Item(i);
            sb.Append("<tr>");
            sb.Append(" <td><a href=\"tasks.aspx?action=ViewTask&tid=" + objTask.TaskID + "&fromViewContent=1&ty=" + actiontype + "&LangType=" + objTask.ContentLanguage + callBackPage + "\">" + objTask.TaskTitle + "</a></td>");
            sb.Append("<td title=\"" + objTask.TaskID + "\">" + objTask.TaskID + "</td>");

            switch (objTask.State)
            {
                case "1":
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl not started") + "</td>");
                    break;
                case "2":
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl active") + "</td>");
                    break;
                case "3":
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl awaiting data") + "</td>");
                    break;
                case "4":
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl on hold") + "</td>");
                    break;
                case "5":
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl pending") + "</td>");
                    break;
                case "6":
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl reopened") + "</td>");
                    break;
                case "7":
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl completed") + "</td>");
                    break;
                case "8":
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl archived") + "</td>");
                    break;
                case "9":
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl deleted") + "</td>");
                    break;
            }
            switch (objTask.Priority)
            {
                case EkEnumeration.TaskPriority.Low:
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl low") + "</td>");
                    break;
                case EkEnumeration.TaskPriority.Normal:
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl normal") + "</td>");
                    break;
                case EkEnumeration.TaskPriority.High:
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl high") + "</td>");
                    break;
            }

            if ((!string.IsNullOrEmpty(objTask.DueDate)))
            {
                if ((Convert.ToDateTime(objTask.DueDate) < DateTime.Today))
                {
                    sb.Append("<td class=\"important\">" + AppUI.GetInternationalDateOnly(objTask.DueDate) + "</td>");
                }
                else
                {
                    sb.Append("<td>" + AppUI.GetInternationalDateOnly(objTask.DueDate) + "</td>");
                }
            }
            else
            {
                sb.Append("<td>[" + this.MsgHelper.GetMessage("dd not specified") + "]</td>");
            }
            if ((actiontype == "by") | (actiontype == "all") | (actiontype == "both"))
            {
                if (objTask.AssignToUserGroupID == 0)
                {
                    sb.Append("<td>All Authors of (" + objTask.ContentID + ")</td>");
                }
                else if (objTask.AssignedToUser != "")
                {
                    sb.Append("<td>");
                    sb.Append("<img src=\"" + AppPath + "images/UI/Icons/user.png\" alt=\"\" align=\"absbottom\"/>");
                    sb.Append(m_refEmail.MakeUserTaskEmailLink(objTask, false));
                    sb.Append("</td>");
                }
                else if(objTask.AssignedToUserGroup != "")
                {
                    sb.Append("<td>");
                    sb.Append("<img src=\"" + AppPath + "images/UI/Icons/users.png\" alt=\"\" align=\"absbottom\"/>");
                    sb.Append(m_refEmail.MakeUserGroupTaskEmailLink(objTask));
                    sb.Append("</td>");
                }
            }
            if ((actiontype == "to") | (actiontype == "all") | (actiontype == "both"))
            {
                sb.Append("<td title\"" + m_refEmail.MakeByUserTaskEmailLink(objTask, false) + "\">");
                sb.Append(m_refEmail.MakeByUserTaskEmailLink(objTask, false));
                sb.Append("</td>");
            }
            if (objTask.LastComment == "")
            {
                sb.Append("<td> [" + this.MsgHelper.GetMessage("dd not specified") + "] </td>");
            }
            else
            {
                sb.Append("<td nowrap=\"nowrap\"><div class=\"comment-block\">" + objTask.LastComment + "</div></td>");
            }
            sb.Append("<td>" + AppUI.GetInternationalDateOnly(objTask.DateCreated) + "</td>");
            sb.Append("</tr>");
        }
        ltrViewContentTaskBody.Text = sb.ToString();
    }
Ejemplo n.º 10
0
    private void Display_DeleteAllTasks()
    {
        ValidateCanDeleteTask();
        pnlDeleteAllTasks.Visible = true;
        string taskIDs = string.Empty;
        objTask = AppUI.EkTaskRef;
        if ((actiontype == "all"))
        {
            TaskItemType = 12;
        }
        else if ((actiontype == "both"))
        {
            TaskItemType = 9;
        }
        else if ((actiontype == "to"))
        {
            TaskItemType = 3;
        }
        else if ((actiontype == "by"))
        {
            TaskItemType = 7;
        }
        PageRequestData pgdata = new PageRequestData();
        cTasks = objTask.GetTasks(-1, currentUserID, -1, TaskItemType, OrderBy, -1, ref pgdata, "");
        HttpCookie cookie = Ektron.Cms.CommonApi.GetEcmCookie();
        if ((actiontype == "all"))
        {
            sTitleBar = "Delete All Tasks In The System";
        }
        else if ((actiontype == "to"))
        {
            sTitleBar = "Delete Tasks Assigned To " + cookie["userfullname"];
        }
        else if ((actiontype == "by"))
        {
            sTitleBar = "Delete Tasks Assigned By " + cookie["userfullname"];
        }
        else if ((actiontype == "both"))
        {
            sTitleBar = "Delete Tasks Assigned By and To " + cookie["userfullname"];
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 1; i < cTasks.Count + 1; i++)
        {
            EkTask cTask = cTasks.get_Item(i);
            taskIDs = taskIDs + cTask.TaskID + ",";
            sb.Append("<tr id=\"task_" + cTask.TaskID + "_" + i + "_");
            if (cTask.TaskTypeID <= 0)
            {
                sb.Append("NotS\">");
            }
            else
            {
                sb.Append(cTask.TaskTypeID + "\">");
            }
            sb.Append(" <script type=\"text/javascript\">");
            sb.Append(" AddShownTaskID('task_" + cTask.TaskID + "_" + i + "_");
            if (cTask.TaskTypeID <= 0)
            {
                sb.Append("NotS');");
            }
            else
            {
                sb.Append(cTask.TaskTypeID + "');");
            }
            sb.Append("</script>");
            sb.Append(" <td nowrap=\"nowrap\" width=\"1\">");
            sb.Append("     <input title=\"Task ID\" type=\"checkbox\" onclick=\"checkAllFalse();\" name=\"id_" + cTask.TaskID +"\" id=\"_" + cTask.TaskID + "_" + i + "_");
            if (cTask.TaskTypeID <= 0)
            {
                sb.Append("NotS\"/>");
            }
            else
            {
                sb.Append(cTask.TaskTypeID + "\"/>");
            }
            sb.Append(" </td>");
            sb.Append("<td><a href=\"tasks.aspx?action=ViewTask&tid=" + cTask.TaskID + "\" title=\"" + cTask.TaskTitle + "\">" + cTask.TaskTitle + "</a></td>");
            sb.Append("<td title=\"" + cTask.TaskID + "\">" + cTask.TaskID + "</td>");
            if ((actiontype == "by") | (actiontype == "all") | (actiontype == "both"))
            {
                if (cTask.AssignToUserGroupID == 0)
                {
                    sb.Append("<td>All Authors</td>");
                }
                else if (cTask.AssignedToUser != "")
                {
                    sb.Append("<td>");
                    sb.Append("<img src=\"" + AppPath + "images/UI/Icons/user.png\" alt=\"\" align=\"absbottom\"/>");
                    sb.Append(m_refEmail.MakeUserTaskEmailLink(cTask, false));
                    sb.Append("</td>");
                }
                else if (cTask.AssignedToUserGroup != "")
                {
                    sb.Append("<td>");
                    sb.Append("<img src=\"" + AppPath + "images/UI/Icons/users.png\" alt=\"\" align=\"absbottom\"/>");
                    sb.Append(m_refEmail.MakeUserGroupTaskEmailLink(cTask));
                    sb.Append("</td>");
                }
            }
            if ((actiontype == "to") | (actiontype == "all") | (actiontype == "both"))
            {
                sb.Append("<td>");
                sb.Append(m_refEmail.MakeByUserTaskEmailLink(cTask, false));
                sb.Append("</td>");
            }
            if ((!string.IsNullOrEmpty(cTask.DueDate)))
            {
                if ((Convert.ToDateTime(cTask.DueDate) < DateTime.Today))
                {
                    sb.Append("<td class=\"important\">" + AppUI.GetInternationalDateOnly(cTask.DueDate) + "</td>");
                }
                else
                {
                    sb.Append("<td>" + AppUI.GetInternationalDateOnly(cTask.DueDate) + "</td>");
                }
            }
            else
            {
                sb.Append("<td>[" + this.MsgHelper.GetMessage("dd not specified") + "]</td>");
            }
            switch (cTask.State)
            {
                case "1":
                    sb.Append("<td>"+this.MsgHelper.GetMessage("lbl not started")+"</td>");
                    break;
                case "2":
                    sb.Append("<td>"+this.MsgHelper.GetMessage("lbl active")+"</td>");
                    break;
                case "3":
                    sb.Append("<td>"+this.MsgHelper.GetMessage("lbl awaiting data")+"</td>");
                    break;
                case "4":
                    sb.Append("<td>"+this.MsgHelper.GetMessage("lbl on hold")+"</td>");
                    break;
                case "5":
                    sb.Append("<td>"+this.MsgHelper.GetMessage("lbl pending")+"</td>");
                    break;
                case "6":
                    sb.Append("<td>"+this.MsgHelper.GetMessage("lbl reopened")+"</td>");
                    break;
                case "7":
                    sb.Append("<td>"+this.MsgHelper.GetMessage("lbl completed")+"</td>");
                    break;
                case "8":
                    sb.Append("<td>"+this.MsgHelper.GetMessage("lbl archived")+"</td>");
                    break;
                case "9":
                    sb.Append("<td>"+this.MsgHelper.GetMessage("lbl deleted")+"</td>");
                    break;
            }

            switch (cTask.Priority)
            {
                case EkEnumeration.TaskPriority.Low:
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl low") + "</td>");
                    break;
                case EkEnumeration.TaskPriority.Normal:
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl normal") + "</td>");
                    break;
                case EkEnumeration.TaskPriority.High:
                    sb.Append("<td>" + this.MsgHelper.GetMessage("lbl high") + "</td>");
                    break;
            }
            sb.Append("</tr>");
        }
        if (taskIDs != string.Empty)
        {
            taskIDs = taskIDs.Remove(taskIDs.Length - 1, 1);
        }
        ltrDeleteAllTasks.Text = sb.ToString();
        ltrTaskIds.Text = "<input type=\"hidden\" name=\"taskids\" value=\"" + taskIDs + "\" id=\"taskids\"/>";
    }
Ejemplo n.º 11
0
    void _host_Edit(string settings)
    {
        menulist.Items.Clear();
        //get list of menu's
        Ektron.Cms.CommonApi m_refApi = new Ektron.Cms.CommonApi();
        PageRequestData req = new PageRequestData();
        req.PageSize = 500;
        Microsoft.VisualBasic.Collection menu_list = m_refApi.EkContentRef.GetMenuReport("", ref req);
        ListItem li = new ListItem();
        for (int i = 0; i <= menu_list.Count; i++)
        {
            if (i != 0)
            {
                Microsoft.VisualBasic.Collection menuData = (Microsoft.VisualBasic.Collection)menu_list[i];
                li = new ListItem();
                try
                {
                    li.Text = menuData[3].ToString();
                    li.Value = menuData[1].ToString();
                    menulist.Items.Add(li);
                }
                catch
                {
                }
            }
        }
        if (_menuID != 0)
        {
            menulist.SelectedValue = _menuID.ToString();
        }
        vert.Checked = _verticalField;
        cacheinterval.Text = _cacheInterval.ToString();
        displayxslt.Text = _displayXslt;
        language.Text = _Language.ToString();
        stylesheet.Text = _Stylesheet;
        enableajax.Checked = _enableAjax;
        enablesmartopen.Checked = _enablesmartOpen;
        enablemouseoverpopup.Checked = _enablemouseoverPopup;
        startlevel.Text = _startLevel.ToString();
        startcollapsed.Checked = _startCollapsed;
        menudepth.Text = _menuDepth.ToString();

        ViewSet.SetActiveView(Edit);
    }
Ejemplo n.º 12
0
    // ****************************************************************************************************
    // Implement the callback interface
    private string RaiseCallbackEvent()
    {
        string result = "";
        FolderData[] folder_arr_data;
        FolderData folder_data;
        long m_intId;
        try
        {
            // handle language switch if needed
            int LangId = -1;
            if ((Request.Params["langid"] != null) && Information.IsNumeric(Request.Params["langid"]))
            {
                LangId = Convert.ToInt32(Request.Params["langid"]);
                if (LangId != -99)
                {
                    if (LangId > 0)
                    {
                        m_refContentApi.SetCookieValue("LastValidLanguageID", LangId.ToString());
                    }

                    m_refContentApi.ContentLanguage = LangId;
                    m_refApi.ContentLanguage = LangId;
                    //m_refApi.EkContentRef.RequestInformation.ContentLanguage = LangId
                }
            }

            if (!string.IsNullOrEmpty(Request.QueryString["method"]))
            {
                if (Request.QueryString["method"].ToLower() == "get_folder")
                {
                    m_intId = Convert.ToInt64(Request.Params["id"]);
                    folder_data = m_refContentApi.GetFolderDataWithPermission(m_intId); //GetFolderById(m_intId)
                    folder_data.XmlConfiguration = null;
                    result = SerializeAsXmlData(folder_data, folder_data.GetType());
                }
                else if (Request.QueryString["method"].ToLower() == "get_child_folders")
                {
                    m_intId = Convert.ToInt64(Request.Params["folderid"]);
                    folder_arr_data = m_refContentApi.GetChildFolders(m_intId, false, Ektron.Cms.Common.EkEnumeration.FolderOrderBy.Name);
                    //when there are no folders in the content tree like CMS400min
                    if (folder_arr_data != null)
                    {
                        result = SerializeAsXmlData(folder_arr_data, folder_arr_data.GetType());
                    }
                }
                else if (Request.QueryString["method"].ToLower() == "get_child_category")
                {
                    Ektron.Cms.Content.EkContent m_refContent;
                    long TaxFolderId = -1;
                    if (Request.Params["folderid"] != null)
                    {
                        TaxFolderId = Convert.ToInt64(Request.Params["folderid"]);
                    }
                    long TaxOverrideId = -1;
                    if (Request.Params["taxonomyoverrideid"] != null)
                    {
                        TaxOverrideId = Convert.ToInt64(Request.Params["taxonomyoverrideid"]);
                    }

                    long TaxLangId = -99;
                    if (Request.Params["langid"] != null)
                    {
                        if (Request.Params["langid"] != "undefined")
                        {
                            TaxLangId = Convert.ToInt64(Request.Params["langid"]);
                        }
                    }

                    TaxonomyRequest taxonomy_request = new TaxonomyRequest();
                    TaxonomyBaseData[] taxonomy_data_arr = null;
                    Utilities.SetLanguage(m_refContentApi);
                    m_refContent = m_refContentApi.EkContentRef;
                    if (TaxFolderId == -2)
                    {
                        taxonomy_data_arr = m_refContent.GetAllTaxonomyByConfig(Ektron.Cms.Common.EkEnumeration.TaxonomyType.Group);
                    }
                    else
                    {
                        m_intId = Convert.ToInt64(Request.Params["taxonomyid"]);
                        taxonomy_request.TaxonomyId = m_intId;
                        if ((TaxFolderId > -1) && (TaxOverrideId <= 0) && (m_intId == 0))
                        {
                            taxonomy_data_arr = m_refContent.GetAllFolderTaxonomy(TaxFolderId);
                        }
                        else
                        {
                            if (TaxLangId != -99)
                            {
                                taxonomy_request.TaxonomyLanguage = Convert.ToInt32(TaxLangId);
                            }
                            else if (m_refContentApi.ContentLanguage == -1)
                            {
                                taxonomy_request.TaxonomyLanguage = m_refContentApi.DefaultContentLanguage;
                            }
                            else
                            {
                                taxonomy_request.TaxonomyLanguage = m_refContentApi.ContentLanguage;
                            }
                            taxonomy_request.PageSize = m_maxTreeTopNodes; // default of 0 used to mean "everything" but storedproc changed
                            if (TaxFolderId == -3)
                            {
                                taxonomy_request.TaxonomyType = Ektron.Cms.Common.EkEnumeration.TaxonomyType.Locale;
                            }
                            taxonomy_data_arr = m_refContent.ReadAllSubCategories(taxonomy_request);
                        }
                    }
                    result = SerializeAsXmlData(taxonomy_data_arr, taxonomy_data_arr.GetType());
                }
                else if (Request.QueryString["method"].ToLower() == "get_taxonomy")
                {
                    if (Request.Params["taxonomyid"] != "")
                    {
                        Ektron.Cms.Content.EkContent m_refContent;
                        TaxonomyRequest taxonomy_request = new TaxonomyRequest();
                        m_intId = Convert.ToInt64(Request.Params["taxonomyid"]);
                        Utilities.SetLanguage(m_refContentApi);
                        m_refContent = m_refContentApi.EkContentRef;
                        taxonomy_request.TaxonomyId = m_intId;
                        taxonomy_request.TaxonomyLanguage = m_refContentApi.ContentLanguage;
                        TaxonomyData taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request);
                        if (taxonomy_data != null)
                        {
                            result = SerializeAsXmlData(taxonomy_data, taxonomy_data.GetType());
                        }
                    }
                }
                else if (Request.QueryString["method"].ToLower() == "get_taxonomies")
                {
                    TaxonomyRequest request = new TaxonomyRequest();
                    request.TaxonomyId = 0;
                    Utilities.SetLanguage(m_refContentApi);
                    request.TaxonomyLanguage = m_refContentApi.ContentLanguage;
                    if (m_refContentApi.ContentLanguage == -1)
                    {
                        request.TaxonomyLanguage = m_refContentApi.DefaultContentLanguage;
                    }
                    request.PageSize = m_maxTreeTopNodes;
                    request.CurrentPage = 1;
                    TaxonomyBaseData[] taxonomy_data = m_refApi.EkContentRef.ReadAllSubCategories(request);
                    result = SerializeAsXmlData(taxonomy_data, taxonomy_data.GetType());
                }
                else if (Request.QueryString["method"].ToLower() == "get_collections")
                {
                    PageRequestData request = new PageRequestData();
                    request.PageSize = m_maxTreeTopNodes;
                    request.CurrentPage = 1;
                    CollectionListData[] collection_list = m_refApi.EkContentRef.GetCollectionList("", ref request);
                    result = SerializeAsXmlData(collection_list, collection_list.GetType());
                }
                else if (Request.QueryString["method"].ToLower() == "get_menus")
                {
                    PageRequestData request = new PageRequestData();
                    request.PageSize = m_maxTreeTopNodes;
                    request.CurrentPage = 1;
                    Collection menus = m_refApi.EkContentRef.GetMenuReport("", ref request);
                    List<AxMenuData> menuList = GetMenuList(menus);
                    result = SerializeAsXmlData(menuList, menuList.GetType());
                    if (m_refContentApi.ContentLanguage == -1)
                    {
                        XmlDocument xdoc = new XmlDocument();
                        xdoc.LoadXml(result);
                        XmlNodeList nodes = xdoc.SelectNodes("//HasChildren");
                        foreach (XmlNode node in nodes)
                        {
                            node.InnerText = "false";
                        }
                        result = xdoc.InnerXml;
                    }
                }
                else if (Request.QueryString["method"].ToLower() == "get_submenus")
                {
                    m_intId = Convert.ToInt64(Request.Params["menuid"]);
                    List<AxMenuData> items = GetSubmenuList(m_intId);
                    result = SerializeAsXmlData(items, items.GetType());
                }
            }
        }
        catch (Exception ex)
        {
            EkException.LogException(ex);
            result = "";
        }

        return result;
    }
Ejemplo n.º 13
0
        /// <summary>
        /// 执行分页数据查询操作,返回PageResponseData
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="connectionStr"></param>
        /// <param name="pageRequest"></param>
        /// <returns></returns>
        public virtual PageResponseData GetPageList <T>(string connectionStr, PageRequestData pageRequest)
        {
            PageResponseData responsResult = new PageResponseData();

            return(responsResult);
        }
Ejemplo n.º 14
0
        private static PageResponeData GeneratePage(PageRequestData _RequestData)
        {
            PageResponeData result = new PageResponeData();

            result.Title = "Admin | RealmPlayers";

            string userStr = _RequestData.m_GetQueryStringFunction("user");
            string passStr = _RequestData.m_GetQueryStringFunction("pass");

            if (userStr != "Viktor" || passStr != VF.HiddenStrings.CreateUserID_AdminPassword)
            {
                _RequestData.m_RedirectFunction("Index.aspx");
                return(result);
            }

            int    count       = PageUtility.GetQueryInt(_RequestData.m_GetQueryStringFunction, "count", 500);
            string detailsStr  = _RequestData.m_GetQueryStringFunction("details");
            string commandStr  = _RequestData.m_GetQueryStringFunction("command");
            string queryUrlStr = PageUtility.GetQueryString(_RequestData.m_GetQueryStringFunction, "queryurl", "");

            var appInstance = Hidden.ApplicationInstance.Instance;

            if (commandStr == "reload")
            {
                appInstance.m_LastLoadedDateTime = DateTime.MinValue;
                _RequestData.m_RedirectFunction(_RequestData.AbsoluteURLPath + "?user=Viktor&pass="******"<ul class='breadcrumb'></ul><div class='row'><div class='span12'>"
                          + "<h2><a href='Admininfo.aspx?user=Viktor&pass="******"'>Admin Info</a></h2>";

            info += "<h3><a href='Log.aspx?user=Viktor&pass="******"'>Event Log</a></h3><br />";
            info += "<div class='row'><div class='span10'>";
            info += "<h2>User Activity</h2><br />Last complete restart: " + appInstance.m_StartTime.ToString();
            info += "<br />Last database load time: " + appInstance.m_LastLoadedDateTime.ToLocalTime().ToString() + " <a href='" + _RequestData.RawURL + "&command=reload" + "'>(Reload now?)</a>";
            if (detailsStr == null)
            {
                lock (appInstance.m_RealmPlayersMutex)
                {
                    try
                    {
                        var      activityStats = appInstance.GetUserActivityStats();
                        DateTime nowMinus30s   = DateTime.Now.AddSeconds(-30);
                        DateTime nowMinus5m    = DateTime.Now.AddMinutes(-5);
                        DateTime nowMinus10m   = DateTime.Now.AddMinutes(-10);
                        DateTime nowMinus30m   = DateTime.Now.AddMinutes(-30);
                        DateTime nowMinus60m   = DateTime.Now.AddMinutes(-60);
                        DateTime nowMinus2h    = DateTime.Now.AddHours(-2);
                        DateTime nowMinus3h    = DateTime.Now.AddHours(-3);
                        DateTime nowMinus6h    = DateTime.Now.AddHours(-6);
                        DateTime nowMinus12h   = DateTime.Now.AddHours(-12);
                        DateTime nowMinus24h   = DateTime.Now.AddHours(-24);
                        DateTime nowMinus2d    = DateTime.Now.AddDays(-2);
                        DateTime nowMinus4d    = DateTime.Now.AddDays(-4);
                        DateTime nowMinus7d    = DateTime.Now.AddDays(-7);
                        DateTime nowMinus1M    = DateTime.Now.AddMonths(-1);
                        info += "<br />Unique Users Last:";
                        info += "<br />30 secs: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.Last30Sec);
                        info += "<br />5 mins: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.Last5Min);
                        info += "<br />10 mins: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.Last10Min);
                        info += "<br />30 mins: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.Last30Min);
                        info += "<br />hour: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.LastHour);
                        info += "<br />2 hours: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.Last2Hours);
                        info += "<br />3 hours: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.Last3Hours);
                        info += "<br />6 hours: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.Last6Hours);
                        info += "<br />12 hours: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.Last12Hours);
                        info += "<br />24 hours: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.Last24Hours);
                        info += "<br />2 days: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.Last2Days);
                        info += "<br />4 days: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.Last4Days);
                        info += "<br />7 days: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.Last7Days);
                        info += "<br />1 month: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.LastMonth);
                        info += "<br />total: " + activityStats.GetStat(Hidden.UserActivityStats.IntervalStat.Total);
                        //if (appInstance.m_UsersOnSite.Count > 0)
                        //    info += "<br />" + appInstance.m_UsersOnSite.First().Key;
                        info += "<br /><br /><h4>IPs: DateTime</h4>";
                        var latestVisits        = UserActivityDB.GetLatestVisits(DateTime.UtcNow.AddDays(-0.5));
                        var orderedLatestVisits = latestVisits.OrderByDescending((_Value) => _Value.Value.VisitTime);
                        //string[] urlReferrerSeparator = { " @<@ " };
                        foreach (var latestVisit in orderedLatestVisits)
                        {
                            //if(queryUrlStr == "")
                            //    userNavObj = latestVisit.Value;
                            //else if (queryUrlStr[0] == '!')
                            //{
                            //    try
                            //    {
                            //        string[] negativeQuerys = queryUrlStr.Split(new char[] { '!' }, StringSplitOptions.RemoveEmptyEntries);
                            //        userNavObj = user.Value.Last((_Value) =>
                            //        {
                            //            foreach(string negQuery in negativeQuerys)
                            //            {
                            //                if (_Value.Item2.Contains(negQuery) == true)
                            //                    return false;
                            //            }
                            //            return true;
                            //        });
                            //    }
                            //    catch (Exception)
                            //    {}
                            //}
                            //else
                            //{
                            //    try
                            //    {
                            //        string[] positiveQuerys = queryUrlStr.Split(new char[]{'!'}, StringSplitOptions.RemoveEmptyEntries);
                            //        userNavObj = user.Value.Last((_Value) =>
                            //        {
                            //            foreach (string posQuery in positiveQuerys)
                            //            {
                            //                if (_Value.Item2.Contains(posQuery) == true)
                            //                    return true;
                            //            }
                            //            return false;
                            //        });
                            //    }
                            //    catch (Exception)
                            //    {}
                            //}

                            //if (userNavObj == null)
                            //    continue;

                            if (--count < 0)
                            {
                                break;
                            }

                            //string userUrl = userNavObj.Item2.Split(urlReferrerSeparator, StringSplitOptions.None).First();
                            //string userUrlReferrer = userNavObj.Item2.Split(urlReferrerSeparator, StringSplitOptions.None).Last();

                            //int comparisonCount = userUrlReferrer.Length/3;
                            //if (userUrl.Length < userUrlReferrer.Length)
                            //    comparisonCount = userUrl.Length/3;

                            //if (userUrl.Substring(0, comparisonCount) == userUrlReferrer.Substring(0, comparisonCount))
                            //    userUrlReferrer = "";
                            //else
                            //    userUrlReferrer = " from \"" + userUrlReferrer + "\"";

                            if ((DateTime.UtcNow - latestVisit.Value.VisitTime).TotalHours >= 6)
                            {
                                info += "<a class='nav' href='http://www.ip-adress.com/ip_tracer/" + latestVisit.Key + "'>" + latestVisit.Key + "</a>: "
                                        + "<a class='nav' href='AdminInfo.aspx?user=Viktor&pass="******"&details=" + latestVisit.Key + "'>" + latestVisit.Value.VisitTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss") + "</a>" + " = <a class='nav' href='" + latestVisit.Value.URL + "'>" + latestVisit.Value.URL + "</a>"
                                        + (latestVisit.Value.FromURL != "" ? " from \"" + latestVisit.Value.FromURL + "\"" : "") + "<br />";
                            }
                            else
                            {
                                info += "<a class='nav' href='http://www.ip-adress.com/ip_tracer/" + latestVisit.Key + "'>" + latestVisit.Key + "</a>: "
                                        + "<a class='nav' href='AdminInfo.aspx?user=Viktor&pass="******"&details=" + latestVisit.Key + "'>" + latestVisit.Value.VisitTime.ToLocalTime().ToString("HH:mm:ss") + "</a>" + " = <a class='nav' href='" + latestVisit.Value.URL + "'>" + latestVisit.Value.URL + "</a>"
                                        + (latestVisit.Value.FromURL != "" ? " from \"" + latestVisit.Value.FromURL + "\"" : "") + "<br />";
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        VF_RealmPlayersDatabase.Logger.LogException(ex);
                    }
                }
            }
            else
            {
                //string[] urlReferrerSeparator = { " @<@ " };
                //List<Tuple<DateTime, string>> detailsData;
                var userActivity = UserActivityDB.GetActivity(detailsStr);
                if (userActivity != null)//appInstance.m_UsersOnSite.TryGetValue(detailsStr, out detailsData) == true)
                {
                    info += "<br /><br /><h4>Details for: <a class='nav' href='http://www.ip-adress.com/ip_tracer/" + detailsStr + "'>" + detailsStr + "</a></h4>";
                    string listData = "";
                    foreach (var urlVisit in userActivity.URLVisits)
                    {
                        //string userUrl = data.Item2.Split(urlReferrerSeparator, StringSplitOptions.None).First();
                        //string userUrlReferrer = data.Item2.Split(urlReferrerSeparator, StringSplitOptions.None).Last();

                        //int comparisonCount = userUrlReferrer.Length / 3;
                        //if (userUrl.Length < userUrlReferrer.Length)
                        //    comparisonCount = userUrl.Length / 3;

                        //if (userUrl.Substring(0, comparisonCount) == userUrlReferrer.Substring(0, comparisonCount))
                        //    userUrlReferrer = "";
                        //else
                        //    userUrlReferrer = " from \"" + userUrlReferrer + "\"";

                        listData = urlVisit.VisitTime.ToString("yyyy-MM-dd HH:mm:ss") + " = " + "<a class='nav' href='" + urlVisit.URL + "'>" + urlVisit.URL + "</a>"
                                   + (urlVisit.FromURL != "" ? " from \"" + urlVisit.FromURL + "\"" : "") + "<br />" + listData;
                    }
                    info += listData;
                }
            }

            info           += "</div><div class='span2'>";
            info           += "<h2>Commands</h2>";
            info           += "<a href='" + _RequestData.RawURL + "&command=savestats" + "'>Save UserActivity</a>";
            info           += "</div'></div>";
            info           += "</div></div>";
            result.PageHTML = info;
            return(result);
        }
Ejemplo n.º 15
0
    protected void BtnExport_Click(object sender, System.EventArgs e)
    {
        if (this.result_type.Value != "export") return;
        Server.ScriptTimeout = 86400;

        Ektron.Cms.FormSubmittedData[] aryData;
        int totalPages = 0;
        bool useFile = false;
        bool needHeading = true;
        string partReportData = string.Empty;
        string strFormsURL = m_refContentApi.QualifyURL(m_refContentApi.AppPath, "controls/forms/");
        string strFormsPath = Server.MapPath(strFormsURL);
        string strDataFilePath = "ReportData" + DefaultFormTitle.Replace(" ", "") + "Data.htm";
        strDataFilePath = m_refContentApi.QualifyURL(strFormsPath, strDataFilePath);
        // make sure it start from a blank file.
        System.IO.File.Delete(EkFunctions.UrlEncode(strDataFilePath));
        if (Int32.TryParse(this.totalPages.Value, out totalPages))
        {
            if (totalPages > 1)
            {
                useFile = true;
                PageRequestData pagingData = new PageRequestData();
                pagingData.PageSize = 10000;
                for (int i = 0; i < totalPages; i++)
                {
                    pagingData.CurrentPage = i + 1;
                    aryData = m_refContentApi.EkModuleRef.GetFormFieldDataById(FormId, StartDate, EndDate, -1, QueryLang, sPollFieldId, ref pagingData);
                    if (aryData != null && aryData.Length > 0)
                    {
                        string datastring = GeneratePartReportData(DisplayType, objFormInfo, aryData, false, needHeading);
                        partReportData += Regex.Replace(datastring, "</?(?i:pre)(.|\\n)*?>", string.Empty); //Defect # 45861 - Removing PRE tags

                        // Save long reporting data as file.
                        using (System.IO.StreamWriter sw = new System.IO.StreamWriter(strDataFilePath, true))
                        {
                            sw.Write(partReportData);
                        }
                        partReportData = string.Empty;

                        if (i == 0)
                        {
                            //reset the total page to the new paging data b/c page size has changed in the exprot.
                            totalPages = pagingData.TotalPages;
                            needHeading = false; // only the first page of export data need heading.
                        }
                    }
                }
            }
        }

        HttpContext.Current.ApplicationInstance.Response.Clear();
        HttpContext.Current.ApplicationInstance.Response.AddHeader("content-disposition", "attachment;filename=form_data_export.xls");
        Response.Charset = "";
        Response.ContentType = "application/vnd.xls";

        if (true == useFile)
        {
            using (System.IO.StreamReader sr = new System.IO.StreamReader(strDataFilePath))
            {
                Response.Write(sExcelPrefix + sr.ReadLine() + sExcelSuffix);
            }
        }
        else
        {
            ExportResult.Text = sExcelPrefix + ExportResult.Text + sExcelSuffix;
            System.IO.StringWriter stringWrite = new System.IO.StringWriter();
            HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
            ExportResult.Visible = true;
            ExportResult.RenderControl(htmlWrite);
            ExportResult.Visible = false;
            Response.Write(stringWrite.ToString());
            Response.AddHeader("Accept-Header", System.Convert.ToString(System.Text.Encoding.ASCII.GetByteCount(ExportResult.Text)));
        }
        try
        {
            //****Note:User might get THreadAbortException error or "Internet Explorer Cannot Download" Error Message when they use an HTTPS.
            //Microsoft Recommends to call HttpContext.Current.ApplicationInstance.CompleteRequest method instead of Response.End.
            //However using CompleteRequest method appends content of the page apart from HTML representation of the XLS data.
            //It's up the user to pick the option to either go with Response.End or CompleteRequest method and can be changed
            //according to their requirement in the file [Workarea\cmsformsreport.aspx.vb]
            //http://support.microsoft.com/default.aspx?scid=kb;en-us;812935
            //http://support.microsoft.com/kb/312629
            if (Request.Params["HTTPS"] != "on" && (!string.IsNullOrEmpty(Request.Params["HTTPS"])))
            {
                Response.End();
            }
            else
            {
                HttpContext.Current.ApplicationInstance.CompleteRequest();
            }
        }
        catch (Exception)
        {
        }
        finally
        {
            Response.Flush();
            HttpContext.Current.ApplicationInstance.Response.Clear();
            this.result_type.Value = "show";
        }
    }
Ejemplo n.º 16
0
    private string LoadResult()
    {
        string msgNoData = m_refMsg.GetMessage("msg no data report");
        PageRequestData pagingData = new PageRequestData();
        pagingData.PageSize = m_refContentApi.RequestInformationRef.PagingSize;
        pagingData.CurrentPage = System.Convert.ToInt32(this.uxPaging.SelectedPage) + 1;  // pagingData is 1-based and uxPaging is 0-based
        if (Information.IsNumeric(DisplayType))
        {
            if (SelectedhId > 0)
            {
                objFormInfo = m_refContentApi.GetFormByHistoryId(SelectedhId);
            }
            else
            {
                objFormInfo = m_refContentApi.GetFormById(FormId);
            }
            resultsMessage.Text = "";
            if (objFormInfo == null)
            {
                resultsMessage.Text = "<p class=\"ui-state-highlight warningError\">ERROR: Could not find form. Form ID: " + FormId + "</p>";
                return "";
            }
            Hashtable objHistData;
            objHistData = m_refContentApi.EkModuleRef.GetFormFieldQuestionsById(FormId);
            if (objHistData.Count > 0)
            {
                //only provide the QueryLang as allContenLanguage (-1) for poll and survey reports.
                //only need data from all languages to match up the poll result on the site.
                QueryLang = "-1";

                if (SelectedhId > 0)
                {
                    string sTmp = "<ektdesignns_choices id=\"";
                    int iPos = -1;
                    int iPos2 = -2;

                    iPos = System.Convert.ToInt32(objFormInfo.Html.ToString().ToLower().IndexOf(sTmp));
                    if (iPos > -1)
                    {
                        iPos = iPos + sTmp.Length;
                        iPos2 = System.Convert.ToInt32(objFormInfo.Html.ToString().ToLower().IndexOf("\"", iPos));
                        if (iPos2 > -1)
                        {
                            sPollFieldId = (string)(objFormInfo.Html.ToString().ToLower().Substring(iPos, iPos2 - iPos));
                        }
                    }
                }
            }
            Ektron.Cms.FormSubmittedData[] aryData;
            aryData = m_refContentApi.EkModuleRef.GetFormFieldDataById(FormId, StartDate, EndDate, -1, QueryLang, sPollFieldId, ref pagingData);
            if ((aryData == null) || 0 == aryData.Length)
            {
                this.uxPaging.Visible = false;
                resultsMessage.Text = "<p class=\"ui-state-highlight warningError\">" + msgNoData + "</p>";
                return "";
            }
            else
            {
                BtnExport.Visible = true;
                this.uxPaging.TotalPages = pagingData.TotalPages;
                if (this.uxPaging.TotalPages > 1)
                {
                    // only show paging if there are more than 1 page in total.
                    this.uxPaging.Visible = true;
                    this.totalPages.Value = this.uxPaging.TotalPages.ToString();
                    this.uxPaging.CurrentPageIndex = pagingData.CurrentPage - 1; // uxPaging is 0-based and pagingData is 1-based
                }
            }

            int iData;
            sFormDataIds = "\'" + aryData[0].FormDataID + "\'";
            for (iData = 1; iData <= aryData.Length - 1; iData++)
            {
                sFormDataIds = sFormDataIds + ",\'" + aryData[iData].FormDataID + "\'";
            }

            return DisplayReport(DisplayType, objFormInfo, aryData, Security_info.CanDelete);
        }

        System.Text.StringBuilder result = new System.Text.StringBuilder();
        Collection objFormData;
        Collection cDatas;
        Collection cData;
        objForm = m_refContentApi.EkModuleRef;
        objFormData = new Collection();
        objFormData.Add(FormId, "FORM_ID", null, null);
        objFormData.Add(CurrentUserId, "USER_ID", null, null);
        objFormData.Add(StartDate, "START_DATE", null, null);
        objFormData.Add(EndDate, "END_DATE", null, null);
        cDatas = objForm.GetAllFormData(objFormData);
        if (cDatas.Count == 0)
        {
            result.Append("<table><tr><td>" + msgNoData + "</td></tr></table>");
            return (result.ToString());
        }
        long iCnt;
        long tmpFormId;
        long dataID = 0;
        string strHtml;
        bool bPaste;
        strHtml = "";
        tmpFormId = 0;
        if (DisplayType == "horizontal")
        {
            Collection fd1;
            //object fds1;
            Collection fds1;
            Collection fd2;
            //object fds2;
            Collection fds2;
            if (FormId.ToString() == "")
            {
                foreach (Collection tempLoopVar_gtForm in gtForms)
                {
                    gtForm = tempLoopVar_gtForm;

                    fds1 = objForm.GetFormFieldsById(FormId);
                    fds2 = objForm.TransferFormVariable(objFormData, ref pagingData);
                    if (fds2.Count > 0)
                    {
                        bPaste = false;
                        result.Append("<table><tr><td>&nbsp;</td></tr></table>");
                        ;
                        result.Append("<table border=1 width=96% cellspacing=0 align=center><tr><td><table border=0 width=100% cellspacing=0 align=center>");
                        result.Append("<tr><td><table border=0 width=100% cellspacing=0>");
                        result.Append("<tr height=20>");
                        foreach (Collection tempLoopVar_fd1 in fds1)
                        {
                            fd1 = tempLoopVar_fd1;
                            if (IsValidCol((string)(fd1["form_field_name"])))
                            {
                                result.Append("<td class=headcell valign=top>" + fd1["form_field_name"] + "</td>");
                            }
                        }
                        result.Append("<td class=headcell valign=top>Date Created</td></tr>");
                        foreach (Collection tempLoopVar_fd2 in fds2)
                        {
                            fd2 = tempLoopVar_fd2;
                            strHtml = "";
                            strHtml = strHtml + "<tr>";
                            foreach (Collection tempLoopVar_fd1 in fds1)
                            {
                                fd1 = tempLoopVar_fd1;
                                if (!Information.IsDBNull(fd2[fd1["form_field_name"]]))
                                {
                                    if (CheckDataType(fd2[fd1["form_field_name"]].ToString(), DataType) == true)
                                    {
                                        if (fd2[fd1["form_field_name"]].ToString() != "")
                                        {
                                            bPaste = true;
                                        }
                                    }
                                }
                                if (IsValidCol((string)(fd1["form_field_name"])))
                                {
                                    strHtml = strHtml + "<td valign=top>" + fd2[fd1["form_field_name"]] + "</td>";
                                }
                            }
                            if (bPaste == true)
                            {
                                strHtml = strHtml + "<td valign=top>" + fd2["date_created"] + "</td>";
                                strHtml = strHtml + "</tr>";
                                result.Append(strHtml);
                                bPaste = false;
                            }
                        }
                        result.Append("</table></td></tr></table></td></tr></table><hr>");
                    }
                }
            }
            else
            {
                fds1 = objForm.GetFormFieldsById(FormId);
                fds2 = objForm.TransferFormVariable(objFormData, ref pagingData);
                if (fds2.Count > 0)
                {
                    bPaste = false;
                    result.Append("<table><tr><td>&nbsp;</td></tr></table>");
                    if (!string.IsNullOrEmpty(Request.Form["Form_Title"]))
                        result.Append("<table class=\"ektronGrid\" border=0 width=96% align=center cellspacing=0><tr><td align=left class=lbls>Title: " + Request.Form["Form_Title"] + "&nbsp;&nbsp;" + "" + "</td></tr></table>");
                    result.Append("<table border=1 width=96% cellspacing=0 align=center><tr><td><table border=0 width=100% cellspacing=0 align=center>");
                    result.Append("<tr><td><table border=0 width=100% cellspacing=0>");
                    result.Append("<tr height=20>");
                    if (Security_info.CanDelete)
                    {
                        result.Append("<td class=headcell align=\"center\" valign=top nowrap=\"true\">(Delete)<br><input type=\"checkbox\" name=\"chkSelectAll\" onClick=\"SelectAll(this)\"></td>");
                    }
                    foreach (Collection tempLoopVar_fd1 in fds1)
                    {
                        fd1 = tempLoopVar_fd1;
                        if (IsValidCol((string)(fd1["form_field_name"])))
                        {
                            result.Append("<td class=headcell valign=top>" + fd1["form_field_name"] + "</td>");
                        }
                    }
                    result.Append("<td class=headcell valign=top>Date Created</td></tr>");
                    foreach (Collection tempLoopVar_fd2 in fds2)
                    {
                        fd2 = tempLoopVar_fd2;
                        strHtml = "";
                        //strHtml = strHtml & "<tr>"
                        //strHtml = strHtml & "<td valign=top><input type=""checkbox""/></td>"
                        foreach (Collection tempLoopVar_fd1 in fds1)
                        {
                            fd1 = tempLoopVar_fd1;
                            if (!Information.IsDBNull(fd2[fd1["form_field_name"]]))
                            {
                                if (CheckDataType(fd2[fd1["form_field_name"]].ToString(), DataType) == true)
                                {
                                    if (fd2[fd1["form_field_name"]].ToString() != "")
                                    {
                                        bPaste = true;
                                    }
                                }
                            }
                            if (IsValidCol((string)(fd1["form_field_name"])))
                            {
                                strHtml = strHtml + "<td valign=top>" + fd2[fd1["form_field_name"]] + "</td>";
                            }
                        }

                        if (bPaste == true)
                        {
                            if (sFormDataIds != "")
                            {
                                sFormDataIds = sFormDataIds + ",\'" + fd2["form_data_id"] + "\'";
                            }
                            else
                            {
                                sFormDataIds = "\'" + fd2["form_data_id"] + "\'";
                            }
                            if (Security_info.CanDelete)
                            {
                                strHtml = (string)("<tr><td align=\"center\" valign=top><input onClick=\"CheckIt(this)\" type=\"checkbox\" name=\"ektChk" + fd2["form_data_id"] + "\" id=\"ektChk" + fd2["form_data_id"] + "\"/></td>" + strHtml);
                            }
                            else
                            {
                                strHtml = (string)("<tr>" + strHtml); // we do not need <td>s around this.
                            }
                            strHtml = strHtml + "<td valign=top>" + fd2["date_created"] + "</td>";
                            strHtml = strHtml + "</tr>";
                            result.Append(strHtml);
                            bPaste = false;
                        }
                    }
                    result.Append("</table></td></tr></table></td></tr></table><hr>");
                }
            }
        }
        else if (DisplayType == "vertical")
        {
            if (FormId.ToString() == "")
            {
                foreach (Collection tempLoopVar_gtForm in gtForms)
                {
                    gtForm = tempLoopVar_gtForm;

                    result.Append("<table><tr><td>&nbsp;</td></tr></table>");
                    result.Append("<table border=1 width=96% cellspacing=0 align=center><tr><td><table border=0 width=100% cellspacing=0 align=center>");
                    result.Append("<tr><td><table border=0 width=100% cellspacing=0>");
                    result.Append("<tr height=20><td class=headcell align=center width=5% >Id</td><td class=headcell width=20% >Variable Name</td><td class=headcell width=55% >Value</td><td class=headcell width=25% >Date Submited</td></tr>");
                    iCnt = 1;
                    foreach (Collection tempLoopVar_cData in cDatas)
                    {
                        cData = tempLoopVar_cData;
                        if (CheckDataType(cData["FORM_FIELD_VALUE"].ToString(), DataType) == true)
                        {
                            bPaste = true;
                            if (DataType.ToLower() != "all")
                            {
                                if (cData["FORM_FIELD_VALUE"].ToString() == "")
                                {
                                    bPaste = false;
                                }
                                else
                                {
                                    bPaste = true;
                                }
                            }
                            if (bPaste)
                            {
                                if (tmpFormId.ToString() == cData["FORM_ID"].ToString())
                                {
                                    if ((int)(iCnt / 2) == (iCnt / 2))
                                    {
                                        result.Append("<tr class=evenrow><td valign=top align=center>" + cData["FORM_DATA_ID"] + "</td><td>" + cData["FORM_FIELD_NAME"] + "</td><td>" + cData["FORM_FIELD_VALUE"] + "</td><td>" + cData["DATE_CREATED"] + "</td></tr>");
                                    }
                                    else
                                    {
                                        result.Append("<tr><td valign=top align=center>" + cData["FORM_DATA_ID"] + "</td><td>" + cData["FORM_FIELD_NAME"] + "</td><td>" + cData["FORM_FIELD_VALUE"] + "</td><td>" + cData["DATE_CREATED"] + "</td></tr>");
                                    }
                                    iCnt++;
                                }
                            }
                        }
                    }
                    result.Append("</table></td></tr></table></td></tr></table><hr>");
                }
            }
            else
            {
                result.Append("<table><tr><td>&nbsp;</td></tr></table>");
                if (!string.IsNullOrEmpty(Request.Form["form_title"]))
                    result.Append("<table class=\"ektronGrid\" border=0 width=96% align=center cellspacing=0><tr><td align=left class=lbls>Title: " + Request.Form["form_title"] + "</td></tr><tr><td align=left class=lbls>ID: " + FormId + "</td></tr></table>");
                result.Append("<table border=1 width=100% cellspacing=0 align=center><tr><td><table border=0 width=100% cellspacing=0 align=center>");
                result.Append("<tr><td><table border=0 width=100% cellspacing=0>");
                result.Append("<tr height=20>");
                if (Security_info.CanDelete)
                {
                    result.Append("<td class=headcell align=\"center\" width=1% nowrap=\"true\">(Delete)<br><input type=\"checkbox\" name=\"chkSelectAll\" onClick=\"SelectAll(this)\"></td>");
                }
                result.Append("<td class=headcell align=center width=5% >Id</td><td class=headcell width=20% >Variable Name</td><td class=headcell width=55% >Value</td><td class=headcell >Date Submited</td></tr>");
                iCnt = 1;
                foreach (Collection tempLoopVar_cData in cDatas)
                {
                    cData = tempLoopVar_cData;
                    strHtml = "";
                    if (CheckDataType(cData["FORM_FIELD_VALUE"].ToString(), DataType) == true)
                    {
                        bPaste = true;
                        if (DataType.ToLower() != "all")
                        {
                            if (cData["FORM_FIELD_VALUE"].ToString() == "")
                            {
                                bPaste = false;
                            }
                            else
                            {
                                bPaste = true;
                            }
                        }
                        if (bPaste)
                        {
                            if (sFormDataIds != "")
                            {
                                sFormDataIds = sFormDataIds + ",\'" + cData["form_data_id"] + "\'";
                            }
                            else
                            {
                                sFormDataIds = "\'" + cData["form_data_id"] + "\'";
                            }
                            if ((int)(iCnt / 2) == (iCnt / 2))
                            {
                                strHtml = "<tr class=evenrow>";
                            }
                            else
                            {
                                strHtml = "<tr>";
                            }
                            if (Security_info.CanDelete)
                            {
                                if (dataID != Convert.ToInt64(cData["FORM_DATA_ID"].ToString()))
                                {
                                    strHtml = strHtml + "<td align=\"center\" valign=top><input onClick=\"CheckIt(this)\" type=\"checkbox\" name=\"ektChk" + cData["FORM_DATA_ID"] + "\" id=\"ektChk" + cData["FORM_DATA_ID"] + "\"/></td>";
                                }
                                else
                                {
                                    strHtml = strHtml + "<td valign=top></td>";
                                }
                            }
                            if (IsValidCol(cData["FORM_FIELD_NAME"].ToString()))
                            {
                                result.Append(strHtml + "<td valign=top align=center>" + cData["FORM_DATA_ID"] + "</td><td valign=top>" + cData["FORM_FIELD_NAME"].ToString() + "</td><td valign=top>" + cData["FORM_FIELD_VALUE"].ToString() + "</td><td valign=top>" + cData["DATE_CREATED"] + "</td></tr>");
                            }

                            iCnt++;
                        }
                    }
                    if (dataID != Convert.ToInt64(cData["FORM_DATA_ID"].ToString()))
                    {
                        dataID = Convert.ToInt64(cData["FORM_DATA_ID"].ToString());
                    }
                }
                result.Append("</table></td></tr></table></td></tr></table><hr>");
            }
        }
        return (result.ToString());
    }