<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin_SMSAPI" Title="Untitled Page" Codebehind="KS.SMSAPI.aspx.cs" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Kesion.BLL" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">
    <asp:Panel ID="listPanel" runat="server" Width="100%">
       <!--<KS:TopNav ID="TopNav2" runat="server" Text="短信接口API配置" />-->
<div class="content-area mt20 pageBlank">
<div class="tab-page" id="SMSPanel">
         <script type="text/javascript">
             var tabPane1 = new WebFXTabPane(document.getElementById("SMSPanel"), 1)
         </script>
             
		 <div class="tab-page" id="tab0">
		  <h2 class="tab">基本参数</h2>
			<script type="text/javascript">
			    tabPane1.addTabPage(document.getElementById("tab0"));
			</script>

       <script>
           jQuery(window).load(function() {
           //setTimeout("getblance();", 1000)

           });
           function getblance() {
               jQuery("input[name=itemid]").each(function() {
                   var id = jQuery(this).val();
                   dogetbalance(id);
               });
           }
           function dogetbalance(id) {
               jQuery("#mybalance" + id).html("<img src='../../admin/images/loading.gif' />查询中...");
               jQuery.get("KS.SMSAPI.aspx", { action: "balance", itemid: id }, function(val) {
                   jQuery("#mybalance" + id).html("余额："+val);
               });
           }
       
       </script> 
        
          
       <table width="99%" border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable"> 
            <tr>
               <td class="lefttd" align="right"><b>短信接口总开关：</b></td>
               <td class="righttd">
                    <asp:RadioButtonList ID="RdbEnableSMS" runat="server"  RepeatLayout="Flow" RepeatDirection="Horizontal">
                       <asp:ListItem Value="0">关闭</asp:ListItem>
                       <asp:ListItem Value="1">开启</asp:ListItem>
                      </asp:RadioButtonList>
                  </td>
             </tr>
        </table>
    
        <KS:KSGV ID="list" cssclass="CTable" runat="server" Width="100%" AutoGenerateColumns="False" EmptyDataText="暂无账号通API!" GridLines="None" OnRowDataBound="list_RowDataBound" PagerType="CustomNumeric">
            <Columns>
             <asp:BoundField HeaderText="ID" DataField="ID">
                    <ItemStyle HorizontalAlign="Center" Width="40px" />
                </asp:BoundField>
            <asp:TemplateField HeaderText="默认">
                <ItemStyle HorizontalAlign="Center" />
                <ItemTemplate>
              <asp:HiddenField ID="HidDefault" Value='<%# Eval("default") %>' runat="server" />
               <asp:HiddenField ID="IFName" Value='<%# Eval("name") %>' runat="server" />
                 <asp:RadioButton ID="RdbDefault" oncheckedchanged="RadioButton1_CheckedChanged" AutoPostBack="true" runat="server" />
                 </ItemTemplate>
            </asp:TemplateField>  
                
                
            <asp:TemplateField HeaderText="接口名称">
                <ItemStyle HorizontalAlign="Center" />
                <ItemTemplate>
                  <%#Eval("name") %>
                  <input type="hidden" name="itemid" value="<%# Eval("id") %>" />
                  <div style='color:#999'>
                      <input type="button"   <%#Eval("name").ToString()=="阿里云"?"style='display:none'":"" %> class="button" value="余额" onclick="dogetbalance(<%# Eval("id") %>);"/>
                      <span id="mybalance<%# Eval("id") %>"></span></div>
                 </ItemTemplate>
            </asp:TemplateField>  
            <asp:TemplateField HeaderText="用户名">
                <ItemStyle HorizontalAlign="Center" />
                <ItemTemplate>
                  <asp:TextBox CssClass="textbox" Width="60px" ID="TxtApiID" Text='<%#Eval("ApiID") %>' runat="server"></asp:TextBox>
                 </ItemTemplate>
            </asp:TemplateField>  
            <asp:TemplateField HeaderText="密码（KEY）">
                <ItemStyle HorizontalAlign="Center" />
                <ItemTemplate>
                  <asp:TextBox CssClass="textbox"  Width="100px" TextMode="Password"  ID="TxtApiKey" Value='<%#Eval("ApiKey") %>' runat="server"></asp:TextBox>
                 </ItemTemplate>
            </asp:TemplateField>  
            <asp:TemplateField HeaderText="发送接口URL">
                <ItemStyle HorizontalAlign="Center" />
                <ItemTemplate>
                  <asp:TextBox CssClass="textbox" Width="130px" ID="TxtApiPostUrl" Text='<%#Eval("apiposturl") %>' runat="server"></asp:TextBox>
                 </ItemTemplate>
            </asp:TemplateField>  
            <asp:TemplateField HeaderText="发送参数">
                <ItemStyle HorizontalAlign="Center" />
                <ItemTemplate>
                  <asp:TextBox CssClass="textbox" Width="140px" ID="TxtApiPostParam" Text='<%#Eval("apipostparam") %>' runat="server"></asp:TextBox>
                 </ItemTemplate>
            </asp:TemplateField>  
            <asp:TemplateField HeaderText="成功标志">
                <ItemStyle HorizontalAlign="Center" />
                <ItemTemplate>
                  <asp:TextBox CssClass="textbox" Width="120px" ID="TxtSuccessTag" Text='<%#Eval("successtag") %>' runat="server"></asp:TextBox>
                 </ItemTemplate>
            </asp:TemplateField>  
                
           <asp:TemplateField HeaderText="申请">
                       <itemstyle horizontalalign="Center" width="25"/>
                        <itemtemplate>
                           <a class="apply" href="<%# Eval("ApplyUrl") %>" title="申请" target="_blank"></a>
                        </itemtemplate>
             </asp:TemplateField>
       


            </Columns>
           
            <PagerStyle CssClass="Page" HorizontalAlign="Right" />
            <HeaderStyle CssClass="CTitle" />
            <EmptyDataRowStyle CssClass="emptycss" />
            
      </KS:KSGV>
       
        <br />
             
        <script type="text/javascript">
            showtips('<span class="state"><strong>说明：</strong><br /></span>1、上面接口的用户名及密码(Key)需要到第三方网站申请后填入方可使用。<br/>2、发送参数的标签说明：{$user}用户名 {$pass}密码Key {$mobile}接收的手机号 {$content}发送的内容');
        </script>
	
	  </div>
    </div>
		 <div class="tab-page" id="tab1">
		  	<h2 class="tab">启用模块配置</h2>
			<script type="text/javascript">
			    tabPane1.addTabPage(document.getElementById("tab1"));
			</script>
            <table width="99%" border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable"> 
                <tr>
                   <td class="lefttd" align="right"><b>发送验证间隔时间：</b></td>
                   <td class="righttd">
                      <asp:TextBox ID="TxtSendSMSInterval" runat="server" CssClass="textbox" style="width:40px;text-align:center"/>秒
                          <span class="tips">一般设置60秒为宜。</span>
                          <strong>短信签名：<asp:TextBox ID="TxtSendSmsSign" Width="100" runat="server" CssClass="textbox"></asp:TextBox></strong> 
                          <span class="tips">短信接口商如果要求签名，请在些输入，如：【KESION】</span>
    
                       <!--<span style="margin-left:20px"><a href=""class="greenFont">点击查看阿里云绑定模板教程>></a></span>-->
                      </td>
                 </tr>
            </table>
            <asp:Repeater ID="RtpModule" runat="server">
          <HeaderTemplate>
           <table width="99%" cellpadding="0" cellspacing="0" class="CTable">
            <tr class="CTitle">
               	<th style="width:50px;">序号</th>
               	<th scope="col">模块名称</th>
          		<th scope="col">状态</th>
              	<th scope="col">查看</th>
		    </tr>
          </HeaderTemplate>
          <ItemTemplate>
         
            <tr<%# ModuleIsShow(Convert.ToString(Eval("name")))%>>
             <td class="Ctd" style="height:30px;text-align:center;"><%# Container.ItemIndex+1 %></td>
             <td class="Ctd" style="text-align:left;"><%# Eval("text") %></td>
             <td class="Ctd" style="text-align:center;"><a href="#" <%# Convert.ToString(Eval("enable"))=="false"?"class='no' title='不启用'":"class='ok' title='启用'" %>></a></td>
             <td class="Ctd" style="text-align:center;"><a href="KS.SMSList.aspx?name=<%# Eval("name") %>&defaultIF=<%=defaultIF %>" class="edit"></a></td>
        
            </tr>
          </ItemTemplate>
          <FooterTemplate>
           <tr style="display:<%# bool.Parse((RtpModule.Items.Count==0).ToString())?"":"none"%>">
                <td class="Ctd" style="text-align:center" colspan="10">
                
                </td>
               </tr> 
          </table>
          </FooterTemplate>
         </asp:Repeater>
        <div class="message">
         <span class="state"><strong>说明：</strong><br /></span>
         1、大部分接口要求内容加签名才能发送成功。签名格式如：【KESION】 <br />2、短信字数都有严格限制，一般不能超过70个字符。
        </div>
        
     </div>	
    </asp:Panel>
        
           
     <asp:Panel ID="Panel1" runat="server" Height="30px" CssClass="main-button">
            &nbsp;&nbsp;<asp:Button ID="Button1" CssClass="button" runat="server" Text="批量保存短信接口API配置"  onclick="Button1_Click" />&nbsp;</asp:Panel>
 </div>  
 
</asp:Content>

