<%@ Page Language="C#" MasterPageFile="~/Admin/MainPage.Master" AutoEventWireup="true" CodeBehind="label_modify.aspx.cs" Inherits="PPFOR.Admin.DesignCenter.Label.label_modify" Title="修改标签" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PPFOR_mainContent" runat="server">
<script src="../../JS/public.js" type="text/javascript"></script>
<script src="/ckeditor/ckeditor.js" type="text/javascript"></script>
<script src="../../JS/popup.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
function validateLabelDescription(source,args)
{
    var obj=document.getElementById("<%= PPFOR_labelDescription.ClientID %>");
    if(obj.value.length>255)
    {
        args.IsValid=false;
    }
    else
    {
        args.IsValid=true;
    }
}
function openDivForSelect(name,width,height)
{
    var displaySystemOption="<%=PPFOR_displaySystemOption %>";
    if(displaySystemOption=="")
    {
        var obj=document.getElementById("<%=PPFOR_labelType.ClientID %>");
        var id=-1;
        if(obj!=null)
        {
            var vId=obj.options[obj.selectedIndex].getAttribute("labelLanguageId");
            if(vId!=null)
            {
                id=parseInt(vId);
            }
        }
        if(id<0)
        {
            alert("请先选择一个标签分类");
        }
        else
        {
            popup_show("选择标签参数","<iframe id='htmlFrame' src='/Admin/DesignCenter/Label/" + name + ".aspx?languageId=" + id + "' scrolling='yes' width='100%' height='100%' frameborder='0'></iframe>",width||600,height||380);
        }
    }
}
</script>
<form action="label_modify.aspx" method="post" id="form1" runat="server">
<label id="showDiv"></label>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="fortable">
    <thead>   
        <tr>
          <td colspan="2" align="center">修改标签</td>
        </tr>
    </thead>        
        <tr>
          <td style="width:15%" align="right">标签名称：</td>
          <td>{PPFOR_User_<asp:TextBox ID="PPFOR_labelName" runat="server" TextMode="SingleLine" Maxlength="19" Width="150px"></asp:TextBox>}
          <asp:DropDownList ID="PPFOR_labelType" runat="server" Width="100px">
            <asp:ListItem Value="-1" Text="选择标签分类"></asp:ListItem>
          </asp:DropDownList>
          <asp:Label ID="PPFOR_labelId" runat="server" Enabled="false" Visible="false"></asp:Label>
          <br />
              <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" SetFocusOnError="true" ValidationExpression="^[A-Za-z0-9_\u4e00-\u9fa5]{1,19}$" Display="Dynamic" ControlToValidate="PPFOR_labelName">标签名只能包含英文字母、数字、下划线和汉字，标签名长度必须在1-19个字符之间<br /></asp:RegularExpressionValidator>
              <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" SetFocusOnError="true" Display="Dynamic" ControlToValidate="PPFOR_labelName">标签名不能为空<br /></asp:RequiredFieldValidator>
              <asp:RangeValidator ID="CompareValidator1" ControlToValidate="PPFOR_labelType" runat="server" Display="Dynamic" SetFocusOnError="true" MinimumValue="1" MaximumValue="2147483647" Type="Integer">必须选择一个标签分类，若无标签分类，请先 <a href="type_add.aspx">创建标签分类</a></asp:RangeValidator>
          </td>
        </tr>
        <tr style="display:<%=PPFOR_displaySystemOption %>">
          <td align="right">插入内容：</td>
          <td id="labelButtonList">
           &nbsp;<span onclick="openDivForSelect('newsOptions')">新闻</span>&nbsp;<span onclick="openDivForSelect('newsTypeOptions')">新闻类型</span>&nbsp;<span onclick="openDivForSelect('brandOptions')">品牌</span>&nbsp;<span onclick="openDivForSelect('productOptions')">商品</span>&nbsp;<span onclick="openDivForSelect('productTypeOptions')">商品类型</span>&nbsp;<span onclick="openDivForSelect('pictureOptions')">图片</span>&nbsp;<span onclick="openDivForSelect('pictureTypeOptions')">图片类型</span>&nbsp;<span onclick="openDivForSelect('fileOptions')">下载</span>&nbsp;<span onclick="openDivForSelect('fileTypeOptions',620,340)">下载类型</span>&nbsp;<span onclick="openDivForSelect('jobPostOptions')">招聘职位</span>&nbsp;<span onclick="openDivForSelect('jobTypeOptions',620,340)">招聘类型</span>&nbsp;<span onclick="openDivForSelect('commentOptions')">评论</span>&nbsp;<span onclick="openDivForSelect('replyOptions')">回复</span>&nbsp;<span onclick="openDivForSelect('scriptOptions')">导航</span>&nbsp;<span onclick="openDivForSelect('controlOptions',600,350)">控件</span>
            <script type="text/javascript">
                function changeButtonListStyle(){
                    var obj=document.getElementById('labelButtonList');                    
                    if(obj!=null){
                        var spanList=obj.getElementsByTagName('span');
                        if(spanList!=null && spanList.length>0){                       
                            for(var i=0;i<spanList.length;i++){
                                spanList[i].style.cursor="pointer";
                                spanList[i].style.border=0;
                                spanList[i].onmouseover=function(){  
                                    this.style.color='#FF0000';
                                };
                                spanList[i].onmouseout=function(){
                                    this.style.color='';
                                };
                            }
                        }
                    }
                }
                changeButtonListStyle();
            </script>
          </td>
        </tr>   
        <tr>
          <td align="right">标签内容：</td>
          <td>
          <asp:TextBox ID="PPFOR_labelContent" runat="server" TextMode="MultiLine" Width="98%" Height="80"></asp:TextBox>
          <script type="text/javascript">
            var ckEditor=CKEDITOR.replace("<%=PPFOR_labelContent.ClientID%>", {
             toolbar:'EditLabel'
            });
            function appenHTML(text)
            {
                ckEditor.insertHtml(text);
            }
            function resetHTML(text)
            {
                ckEditor.setData(text);
                ckEditor.focus();
            }
            </script>
          </td>
        </tr>        
        <tr>
          <td align="right">标签描述：</td>
          <td align="center">
            <asp:TextBox ID="PPFOR_labelDescription" runat="server" TextMode="MultiLine" MaxLength="255" Width="98%" Height="40"></asp:TextBox>
              <asp:CustomValidator ID="CustomValidator1" runat="server" Display="Dynamic" SetFocusOnError="true" ControlToValidate="PPFOR_labelDescription" ClientValidationFunction="validateLabelDescription">角色描述长度不能大于255个字符</asp:CustomValidator>
          </td>
        </tr>
        <tr>
            <td align="center" colspan="2" valign="middle" style="height:50px; display:none;">               
                <asp:Button ID="PPFOR_modifyLabel" CssClass="inputbutton" runat="server" Text="提交" OnClick="PPFOR_modifyLabelClick"/>
                <input name="reset" type="reset" id="reset1" class="inputbutton" onmouseover="this.className='inputbutton_hover'" onmouseout="this.className='inputbutton'" value="重置" />
                <asp:Label ID="PPFOR_goToItemList" runat="server"></asp:Label>
                <script type="text/javascript">
                    addButtonArray("<%= PPFOR_modifyLabel.ClientID %>","reset1","goBack");
                </script>
            </td>
        </tr>
      </table>
      <br />
</form>
</asp:Content>
