<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WindowEditor.ascx.cs" Inherits="WindowEditor" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<%@ Register assembly="CuteEditor" namespace="CuteEditor" tagprefix="CE" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.QuickStart" Assembly="Telerik.QuickStart" %>
<%@ Register TagPrefix="radU" Namespace="Telerik.WebControls" Assembly="RadUpload.Net2" %>
<%@ Import Namespace="FrameWork" %>
<%@ Import Namespace="FrameWork.Components" %>
<%@ Import Namespace="FrameWork.WebControls" %>
<%@ Import Namespace="Telerik.WebControls" %>
<%@ Import Namespace="com.tsingdai.Model" %>
<%@ Import Namespace="com.tsingdai.Common" %>
<%@ Import Namespace="com.tsingdai.Service" %>
<script type="text/javascript">
var openInfoDetails = function (context, animTrg) {
var editor = document.getElementById('<%=Editor1.ClientID %>'); //JavaScript方法
if (context != null)
{
editor.setHTML(context);
}
window.show(animTrg);
}
rnd.today = new Date();
rnd.seed = rnd.today.getTime();
function rnd() {
rnd.seed = (rnd.seed * 9301 + 49297) % 233280;
return rnd.seed / (233280.0);
};
function rand(number) {
return Math.ceil(rnd() * number);
};
function AlertMessageBox(file_name)
{
if (file_name!=undefined){
var ShValues = file_name.split('||');
if (ShValues[1]!=0)
{
document.all.<%=this.U_GroupID.ClientID %>.value=ShValues[1];
document.all.<%=this.Publisher.ClientID %>.value=ShValues[0];
}
}
}
function ShowDepartID() {
showPopWin('选择部门', '../../FrameWork/SystemApp/UserManager/SelectGroup.aspx?' + rand(10000000), 215, 255, AlertMessageBox, true, true)
}
</script>
<ext:TextField ID="U_GroupID" DataIndex="U_GroupID" runat="server" Hidden="true" />
<ext:TextField ID="ArticleID" DataIndex="ArticleID" runat="server" Hidden="true" />
<ext:Store runat="server" ID="LabelStore" AutoLoad="false" OnRefreshData="LabelRefresh">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="ID" Type="Int" />
<ext:RecordField Name="GroupID" Type="Int" />
<ext:RecordField Name="Label_Name" />
<ext:RecordField Name="G_CName" />
<ext:RecordField Name="SeqNo" Type="Int" />
<ext:RecordField Name="Description" />
<ext:RecordField Name="Extend_Field1" />
<ext:RecordField Name="Extend_Field2" />
</Fields>
</ext:JsonReader>
</Reader>
<Listeners>
<Load Handler="if (#{LabelName}.store.getAt(0).get('ID')){#{LabelName}.setValue(#{LabelName}.store.getAt(0).get('ID'));}" />
</Listeners>
</ext:Store>
<ext:Window ID="InfoDetailsWindow" runat="server" Icon="Group" Title="信息明细"
Width="800" Height="480" AutoShow="false" Modal="true" ShowOnLoad="false" AutoScroll="true">
<Body>
<ext:FitLayout ID="FitLayout1" runat="server">
<ext:TabPanel ID="TabPanel1" runat="server" ActiveTabIndex="0" Border="false">
<Tabs>
<ext:Tab
ID="InfoTab"
runat="server"
Title="基本信息"
Icon="ChartOrganisation"
BodyStyle="padding:5px;">
<Body>
<ext:FormLayout ID="FormLayout1" runat="server">
<ext:Anchor>
<ext:TextField
ID="Title"
runat="server"
FieldLabel="信息标题"
AllowBlank="false"
Width="500"
BlankText="信息标题必须输入!"
/>
</ext:Anchor>
<ext:Anchor>
<ext:TextField
ID="Author"
runat="server"
AllowBlank="false"
FieldLabel="撰稿人员"
Width="200"
BlankText="撰稿人员必须输入!"/>
</ext:Anchor>
<ext:Anchor>
<ext:DateField
ID="RunDate"
AllowBlank="false"
runat="server"
FieldLabel="活动日期"
BlankText="活动日期必须输入!"
/>
</ext:Anchor>
<ext:Anchor>
<ext:TriggerField
ID="Publisher"
runat="server"
Width="200"
AllowBlank="false"
EmptyText="请点击选择发布单位 -->" FieldLabel="发布单位" ReadOnly="true" BlankText="发布单位必需选择!">
<Triggers>
<ext:FieldTrigger IconCls="custom-trigger" />
</Triggers>
<Listeners>
<TriggerClick Handler="ShowDepartID();#{LabelName}.clearValue();" />
</Listeners>
</ext:TriggerField>
</ext:Anchor>
<ext:Anchor>
<ext:ComboBox ID="LabelName" FieldLabel="标签名称" runat="server" StoreID="LabelStore" TypeAhead="true" Mode="Local" ForceSelection="true" TriggerAction="All" DisplayField="Label_Name"
ValueField="ID"
EmptyText="请查询后选择标签名称 -->"
ValueNotFoundText="该单位没有标签,重新选择单位 -->" StyleSpec="text-align:left;" Hidden="false" Width="200" ReadOnly="true" AllowBlank="false" BlankText="标签名称必需选择!">
<Triggers>
<ext:FieldTrigger Icon="Search" />
</Triggers>
<Listeners>
<TriggerClick Handler="#{LabelName}.clearValue();#{LabelStore}.reload();" />
</Listeners>
</ext:ComboBox>
</ext:Anchor>
<ext:Anchor>
<ext:Panel ID="Panel7" runat="server" Title="正文内容:" BodyBorder="true" Width="800" Height="260" AutoScroll="true">
<Body>
<CE:Editor
ConfigurationPath="~/CuteSoft_Client/CuteEditor/Configuration/AutoConfigure/Sample.config"
ID="Editor1"
runat="server"
Width="780"
ResizeMode="AutoAdjust"
UseStandardDialog="true"
Height="210"
/>
</Body>
</ext:Panel>
</ext:Anchor>
</ext:FormLayout>
</Body>
</ext:Tab>
<ext:Tab
ID="AttachementTab"
runat="server"
Title="附件列表"
Icon="User"
BodyStyle="padding:5px;">
<Body>
<ext:FormLayout ID="FormLayout2" runat="server">
<ext:Anchor>
<ext:Panel ID="Panel8" runat="server" Title="" Header="false" BodyBorder="true" Height="350" AutoScroll="true">
<Body>
<radu:radprogressmanager id="Radprogressmanager1" Width="100%" runat="server" />
<radu:radprogressarea id="progressArea1" Width="100%" runat="server" Height="100" Language="zh-cn" />
<radU:RadUpload ID="upload1" runat="server" OverwriteExistingFiles="true" Language="zh-cn" Skin="Vista"/>
</Body>
</ext:Panel>
</ext:Anchor>
</ext:FormLayout>
</Body>
</ext:Tab>
</Tabs>
</ext:TabPanel>
</ext:FitLayout>
</Body>
<Buttons>
<ext:Button ID="SaveButton" runat="server" Text="保存" Icon="Disk">
<Listeners>
<Click Handler="saveEmployee();" />
</Listeners>
</ext:Button>
<ext:Button ID="CancelButton" runat="server" Text="返回" Icon="Cancel">
<Listeners>
<Click Handler="#{InfoDetailsWindow}.hide(null);" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Window>
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;
public partial class WindowEditor : System.Web.UI.UserControl
{
private static readonly ArticleService _articleService = ArticleService.GetInstance();
private static readonly LabelService _labelService = LabelService.GetInstance();
public string context = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!Ext.IsAjaxRequest)
{
InitCuteEditor();
}
}
public void Show()
{
this.InfoDetailsWindow.Show();
}
# region cuteditor文本编辑控件初始化
protected void InitCuteEditor()
{
Editor1.Setting["CuteEditorFileStorageType"] = typeof(SqlFileStorage).AssemblyQualifiedName;
Editor1.Setting["DownFile"] = ResolveUrl("DownFile.Aspx");
Editor1.SetSecurityGalleryPath("/");
//Editor1. = "type here";
}
# endregion
# region 根据选择的单位,刷新标签名称列表
protected void LabelRefresh(object sender, StoreRefreshDataEventArgs e)
{
int groupID = Int32.Parse(this.U_GroupID.Text);
IList labelList = _labelService.GetLabelListByGroupID(groupID);
LabelStore.DataSource = labelList;
LabelStore.DataBind();
}
# endregion
public void SetInfo(Article article)
{
this.ArticleID.Text = article.ArticleID.ToString();
this.Title.Text = article.Title;
this.Author.Text = article.Author;
this.RunDate.Value = article.Run_Date;
sys_GroupTable groupObj = BusinessFacade.sys_GroupDisp(article.GroupID);
this.U_GroupID.Text = article.GroupID.ToString();
this.Publisher.SetValue(groupObj.G_CName);
IList labelList = _labelService.GetLabelListByGroupID(article.GroupID);
this.LabelStore.DataSource = labelList;
this.LabelStore.DataBind();
this.LabelName.SetValue(article.Label.ID);
this.Editor1.Text = article.Context;
}
}