<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="commentOptions.aspx.cs" Inherits="PPFOR.Admin.DesignCenter.Label.commentOptions" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <script src="/ckeditor/ckeditor.js" type="text/javascript" ></script>
    <script src="../../JS/label.js" type="text/javascript"></script>   
    <link href="../../Css/global.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
    function saveContent()
    {
        var fStr=",<br />&nbsp;";
        var data=formatContent("[PPFOR:Loop","") + fStr + formatContent("PPFOR:Class","Comments");
        
        var objMenuId= document.getElementById("PPFOR_commentMenuId");            
        if(objMenuId!=null && objMenuId.style.display!="none" && objMenuId.selectedIndex>=0)
        {
            var menuId=objMenuId.options[objMenuId.selectedIndex].value;
            if(menuId!=null && menuId!="")
            {
                data+=fStr + formatContent("PPFOR:MenuID",menuId);
            }
        }
        
        var objTypeId= document.getElementById("commentGroupId");            
        if(objTypeId!=null && objTypeId.style.display!="none" && objTypeId.selectedIndex>=0)
        {
            var typeId=objTypeId.options[objTypeId.selectedIndex].value;
            if(typeId!=null && typeId!="")
            {
                data+=fStr + formatContent("PPFOR:ClassID",typeId);
            }
        }   
        
        var objMemberLimit= document.getElementById("memberLimit");            
        if(objMemberLimit!=null && objMemberLimit.type=='checkbox' && !objMemberLimit.disabled)
        {
            data+=fStr + formatContent("PPFOR:MemberLimit",objMemberLimit.checked?'True':'False');
        }  
        
        var type=getRadioValue("commentListType");
        if(type!=null && type!="")
        {
            data+=fStr + formatContent("PPFOR:Type",type);
        } 
        
        var objLoopNumber= document.getElementById("PPFOR_loopNumber");
        if(objLoopNumber!=null && objLoopNumber.value!="")
        {
            data+=fStr + formatContent("PPFOR:LoopNumber",objLoopNumber.value);
        }
            
        var objOutFormat= document.getElementById("outFormat");
        if(objOutFormat!=null)
        {
            data+=fStr + formatContent("PPFOR:Format",objOutFormat.value!='' ? objOutFormat.value : "Table");
        }   
        
        var objNewsColumnNumber= document.getElementById("PPFOR_CommentColumnNumber");
        if(objNewsColumnNumber!=null && objNewsColumnNumber.value!="")
        {
            data+=fStr + formatContent("PPFOR:ColumnNumber",objNewsColumnNumber.value);
        }
      
        data+=formatContent("]","") + "<br />" + ckEditor.getData() + "<br />" + formatContent("[/PPFOR:Loop]","");
        
        parent.window.resetHTML(data);
        if(document.all)
        {
            parent.document.getElementById("popupExit").fireEvent("onclick");
        }
        else
        {
            var evt = document.createEvent('HTMLEvents');   
            evt.initEvent('click',true,true);   
            parent.document.getElementById("popupExit").dispatchEvent(evt);   
        }
    }
    function getRadioValue(name)
    {
        var radioes = document.getElementsByName(name); 
        for(var i=0;i<radioes.length;i++)
        {
             if(radioes[i].checked){
                return radioes[i].value;
             }
        }
        return "";
    }
    function changeNumberOption()
    {
        var rValue=getRadioValue("commentListType");
        if(rValue=="List")
        {
            document.getElementById("listNumber").style.display="none";
            document.getElementById("listNumberPerPage").style.display="";
        }
        else
        {
            document.getElementById("listNumberPerPage").style.display="none";
            document.getElementById("listNumber").style.display="";
        } 
    }
    function showTypeIds(objMenu)
    {
        var obj= document.getElementById("PPFOR_commentGroupId");
        var objTypeId=document.getElementById("commentGroupId");
        var id=objMenu.options[objMenu.selectedIndex].value;
        if(obj!=null && objTypeId!=null && id>=0)
        {
            while(objTypeId.options.length>0)
            {
                objTypeId.removeChild(objTypeId.options[0]);
            }
            objTypeId.options.add(new Option("--所有评论组--","0")); 
            for(var i=0;i<obj.options.length;i++)
            {                
                 if(obj.options[i].getAttribute("optionMenuId")==id)
                 {
                    objTypeId.options.add(new Option(obj.options[i].text,obj.options[i].value)); 
                 }
            }
            if(objTypeId.options.length==0)
            {
                objTypeId.style.display="none";
            }
            else
            {
                objTypeId.style.display="";
            }
        }
    }
    </script>
    <title>评论列表参数设置</title>
</head>
<body>
    <form id="form1" runat="server" onsubmit="saveContent();return false;">
    <table width="98%" cellpadding="0" cellspacing="0" class="fortable" style="margin:6px;">
    <thead>
      <tr>
        <td colspan="2" align="center">选择标签参数--评论列表</td>
      </tr>     
    </thead>      
       <tr>
        <td align="right">列表类型：</td>
        <td>
           <input type="radio" value="New" name="commentListType" onclick="changeNumberOption();"/>最新
           <input type="radio" value="List" name="commentListType" checked="checked" onclick="changeNumberOption();"/>评论列表
       </td>
      </tr>
      <tr>
        <td align="right" style="width:15%">循环<span id="listNumber" style="display:<%=PPFOR_displayListNumberOption %>">条数</span><span id="listNumberPerPage" style="display:<%=PPFOR_displayListNumberPerPageOption %>">每页条数</span>：</td>
        <td><asp:TextBox Text="8" MaxLength="10" ID="PPFOR_loopNumber" runat="server" Width="150px"/>
            <select id="outFormat">               
                <option value="" selected="selected">--选择输出格式--</option>
                <option value="Table">Table(默认)</option>                
                <option value="None">无格式</option>
            </select>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="PPFOR_loopNumber" runat="server" Display="Dynamic" SetFocusOnError="true"><br />循环条数必须填写</asp:RequiredFieldValidator>
            <asp:RangeValidator ID="RangeValidator1" ControlToValidate="PPFOR_loopNumber" runat="server"  Display="Dynamic" SetFocusOnError="true" MinimumValue="1" MaximumValue="2147483647" Type="Integer"><br />循环条数必须填写正整数</asp:RangeValidator>            
        </td>
      </tr>
      <tr>
        <td align="right">评论栏目：</td>
        <td>
        <asp:DropDownList ID="PPFOR_commentMenuId" runat="server" Width="150px">
            <asp:ListItem Text="--选择栏目--" Value="0"></asp:ListItem>
            <asp:ListItem Text="*自适应栏目*" Value="0"></asp:ListItem>
        </asp:DropDownList>
        <select id="commentGroupId" style="display:none;"></select>
        <asp:DropDownList ID="PPFOR_commentGroupId" runat="server" Width="150px" Enabled="false">
        </asp:DropDownList>     
        </td>
      </tr>
      <tr>
        <td align="right">列表参数：</td>
        <td align="left">
            <select id="CommentParam" style="width:150px;" onchange="appenHTML(this.value);this.selectedIndex=0;">
            <option value="">01.&nbsp;选择基本参数</option>  
            <option value="&lt;a href={#GroupURL}&gt;{#Group}&lt;/a&gt;">02.&nbsp;评论组</option>            
            <option value="{#ID}">03.&nbsp;评论ID</option>      
            <option value="{#Subject}">04.&nbsp;评论主题</option>   
            <option value="{#Object}">05.&nbsp;评论对象</option>            
            <option value="{#Content}">06.&nbsp;评论内容</option>   
            <option value="{#Name}">07.&nbsp;评论人名称</option>   
            <option value="{#Email}">08.&nbsp;评论人邮箱</option>   
            <option value="{#Address}">09.&nbsp;评论人地址</option> 
            <option value="{#Website}">10.&nbsp;评论人网址</option> 
            <option value="{#Phone}">11.&nbsp;评论人电话</option>      
            <option value="{#Chat}">12.&nbsp;评论人其他联系方式</option>   
            <option value="{#ReplyCount}">13.&nbsp;回复总数</option>   
            <option value="{#Date}">14.&nbsp;审核日期</option> 
            <option value="{#Time}">15.&nbsp;审核时间</option> 
            <option value="{#DateTime}">16.&nbsp;审核日期时间</option> 
            <option value="&lt;a href='javascript:void(0);' onclick=&quot;goForReplyAction('{#IDForReply}');&quot; &gt;回复此评论&lt;/a&gt;">17.&nbsp;回复此评论</option>           
            </select>
            <asp:DropDownList ID="PPFOR_subLabelList" runat="server">
            <asp:ListItem Text="--选择二级标签--" Value=""></asp:ListItem>
            </asp:DropDownList>
            <input type="checkbox" id="memberLimit" />开启会员等级限制
            <br />
            <asp:TextBox ID="PPFOR_CommentOptionContent" runat="server" TextMode="MultiLine" Rows="5" Width="98%"></asp:TextBox>
           <script type="text/javascript">
            var ckEditor=CKEDITOR.replace("PPFOR_CommentOptionContent", {
             toolbar:'EditLabelOptions',
             height:'100'
            });
            function appenHTML(text)
            {
                ckEditor.insertHtml(text);
            }
            </script>
         </td>
      </tr>
      <tr>
        <td align="right">每行显示评论条数：</td>
        <td><asp:TextBox ID="PPFOR_CommentColumnNumber" runat="server" Width="150px" />
            <asp:RangeValidator ID="RangeValidator5" ControlToValidate="PPFOR_CommentColumnNumber" runat="server"  Display="Dynamic" SetFocusOnError="true" MinimumValue="1" MaximumValue="2147483647" Type="Integer">评论条数必须填写正整数</asp:RangeValidator>            
        </td>
      </tr>  
      <tr style="display:none">
        <td align="center" colspan="2" valign="middle" style="height:50px">            
            <asp:Button ID="PPFOR_setCommentOptions" CssClass="inputbutton" runat="server" Text="确定" OnClick="PPFOR_setCommentOptionsClick"/>
            <input id="reset1" name="reset" type="reset" class="inputbutton" onmouseover="this.className='inputbutton_hover'" onmouseout="this.className='inputbutton'" value="重置" />
             <script type="text/javascript"> 
                parent.popup_clearButtons();
                parent.popup_addButton(document.getElementById('PPFOR_setCommentOptions'));
                parent.popup_addButton(document.getElementById('reset1'));
             </script>
        </td>
      </tr>
    </table>
    </form>
</body>
</html>
