<%@ Page Language="C#" MasterPageFile="~/Manager/MasterPage/PageTemplate.Master" AutoEventWireup="true" CodeBehind="Render.aspx.cs" Inherits="FrameWork.web.Manager.Module.Information.InfoUp.Render" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<%@ Register Src="~/Manager/controls/WindowEditor.ascx" TagName="WindowEditor" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PageBody" runat="server">
<script type="text/javascript" src="<%=Page.ResolveUrl("~/") %>Manager/inc/FineMessBox/js/common.js"></script>
<script type="text/javascript" src="<%=Page.ResolveUrl("~/") %>Manager/inc/FineMessBox/js/subModal.js"></script>
<script type="text/javascript">
var InfoDetailsRender = function() {
return '<img class="imgEdit" ext:qtip="Click to view/edit additional details" style="cursor:pointer;" src="vcard_edit.png" />';
}
var cellClick = function(grid, rowIndex, columnIndex, e) {
var t = e.getTarget();
var record = grid.getStore().getAt(rowIndex); // Get the Record
var columnId = grid.getColumnModel().getColumnId(columnIndex); // Get column id
if (t.className == 'imgEdit' && columnId == 'Context') {
//the ajax event allowed
//openInfoDetails(record, t);
return true;
}
//forbidden
return false;
}
</script>
<ext:ScriptManager ID="ScriptManager1" runat="server" />
<ext:Store ID="Store1" runat="server">
<Reader>
<ext:JsonReader ReaderID="ArticleID">
<Fields>
<ext:RecordField Name="ArticleID" Type="Int"/>
<ext:RecordField Name="Title" />
<ext:RecordField Name="Author" />
<ext:RecordField Name="Context" />
<ext:RecordField Name="Run_Date" Type="Date" />
<ext:RecordField Name="Up_GroupID" Type="Int" />
<ext:RecordField Name="LabelID" Type="Int" />
<ext:RecordField Name="Up_GroupName" />
<ext:RecordField Name="ShowDate" Type="Date" />
<ext:RecordField Name="Modify_Date" Type="Date" />
<ext:RecordField Name="Context" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:ViewPort ID="ViewPort1" runat="server">
<Body>
<ext:FitLayout ID="FitLayout1" runat="server">
<ext:GridPanel
ID="ArticleList"
runat="server"
StoreID="Store1"
StripeRows="true"
Header="false"
Border="false"
AutoExpandColumn="Title" AutoWidth="true" Height="600">
<LoadMask ShowMask="false" />
<SelectionModel>
<ext:CheckboxSelectionModel HideCheckAll="true" ID="CheckboxSelectionModel1" runat="server" MoveEditorOnEnter="true" />
</SelectionModel>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column
ColumnID="Title"
Header="信息标题"
Width="300"
Sortable="true"
DataIndex="Title"
/>
<ext:Column
ColumnID="Up_GroupName"
Header="报送部门"
Width="120"
Sortable="true"
DataIndex="Name"
/>
<ext:Column
ColumnID="ShowDate"
Header="上报时间"
Width="120"
Sortable="true"
DataIndex="ShowDate">
<Renderer Fn="Ext.util.Format.dateRenderer('Y-m-d')" />
</ext:Column>
<ext:Column
ColumnID="Modify_Date"
Header="修改时间"
Width="80"
Sortable="true"
DataIndex="Modify_Date">
<Renderer Fn="Ext.util.Format.dateRenderer('Y-m-d')" />
</ext:Column>
<ext:Column
ColumnID="Context"
Header="详细信息"
Width="50"
Sortable="true"
DataIndex="Context"
>
<Renderer Fn="InfoDetailsRender" />
</ext:Column>
</Columns>
</ColumnModel>
<Plugins>
<ext:GridFilters runat="server" ID="GridFilters1" Local="true">
<Filters>
<ext:StringFilter DataIndex="Title" />
<ext:StringFilter DataIndex="Up_GroupName" />
<ext:DateFilter DataIndex="Show_Date">
<DatePickerOptions runat="server" TodayText="Now" />
</ext:DateFilter>
<ext:DateFilter DataIndex="Modify_Date">
<DatePickerOptions runat="server" TodayText="Now" />
</ext:DateFilter>
</Filters>
</ext:GridFilters>
</Plugins>
<BottomBar>
<ext:PagingToolBar
ID="PagingToolBar1"
runat="server"
StoreID="Store1"
PageSize="10"
DisplayInfo="true"
DisplayMsg="草案箱 {0} - {1} of {2}"
/>
</BottomBar>
<Listeners>
<CellClick Fn="cellClick" />
</Listeners>
<AjaxEvents>
<CellClick OnEvent="ShowDetails" Failure="Ext.MessageBox.alert('Load failed', 'Error during ajax event!');">
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{ArticleList}.body}" />
<ExtraParams>
<ext:Parameter Name="id" Value="params[0].getStore().getAt(params[1]).id" Mode="Raw" />
</ExtraParams>
</CellClick>
</AjaxEvents>
</ext:GridPanel>
</ext:FitLayout>
<uc1:WindowEditor ID="WindowEditor1" runat="server" />
</Body>
</ext:ViewPort>
</asp:Content>
using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Collections;
using System.Web.SessionState;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;
using FrameWork;
using FrameWork.Components;
using FrameWork.WebControls;
using com.tsingdai.Model;
using com.tsingdai.Common;
using com.tsingdai.Service;
using Coolite.Ext.Web;
namespace FrameWork.web.Manager.Module.Information.InfoUp
{
public partial class Render : PageBase
{
private static readonly ArticleService _articleService = ArticleService.GetInstance();
private static readonly LabelService _labelService = LabelService.GetInstance();
int groupID = (int)Common.sink("GroupID", MethodType.Get, 50, 0, DataType.Int);
int labelID = (int)Common.sink("LabelID", MethodType.Get, 50, 0, DataType.Int);
string status = Common.sink("status", MethodType.Get, 50, 0, DataType.Str).ToString();
protected void Page_Load(object sender, EventArgs e)
{
InitPage();
if (!Ext.IsAjaxRequest)
{
BindData();
}
}
protected void BindData()
{
IList labelList = null;
if (labelID == 0)
{
labelList = _labelService.GetLabelListByGroupID(groupID);
if (labelList.Count > 0)
{
foreach (com.tsingdai.Model.Label lab in labelList)
{
//ShowData(label);
}
}
}
else
{
labelList = _labelService.GetLabelListByGroupID(groupID);
}
Article article = new Article();
com.tsingdai.Model.Label label = _labelService.GetLabel(labelID);
article.InitArticle(groupID, label);
IList draftList = null;
switch (status)
{
case "Draft":
draftList = _articleService.GetDraftListByLabelID(article);
break;
case "Report":
draftList = _articleService.GetReportListByLabelID(article);
break;
case "Adopt":
draftList = _articleService.GetAdoptListByLabelID(article);
break;
case "Publish":
draftList = _articleService.GetPublishListByLabelID(article);
break;
default:
draftList = _articleService.GetDraftListByLabelID(article);
break;
}
Store1.DataSource = draftList;
Store1.DataBind();
}
# region AjaxMethod
protected void ShowDetails(object sender, AjaxEventArgs e)
{
string id = e.ExtraParams["id"];
((WindowEditor)WindowEditor1).SetInfo(_articleService.GetArticle(Int32.Parse(id)));
((WindowEditor)WindowEditor1).Show();
}
# endregion
}
}