<%@ Page Language="C#" EnableViewState="false" AutoEventWireup="true" CodeBehind="LinkList.aspx.cs" Inherits="Forum.Web.Admin.links.LinkList" %>

<%@ Register assembly="Forum.Control" namespace="Forum.Control" tagprefix="cc1" %>

<!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 id="Head1" runat="server">
    <title></title>
    <link href="../styles/dntmanager.css" rel="stylesheet" type="text/css" />
<link href="../styles/page2.css" rel="stylesheet" type="text/css" />
    <link href="../styles/modelpopup.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
<!--
.Text_1 {
	border: 1px solid #FFFFFF;
	width: 140px;
}
.ckall
{
 display:block; height:25px; padding-top:9px; cursor:pointer;
}
-->
    </style>
</head>
<script src="../js/public.js" type="text/javascript"></script>
<script src="../js/modalpopup.js" type="text/javascript"></script>
<body><cc1:Hint ID="Hint1" runat="server" HintImageUrl="../" />



    <form id="form1" runat="server">


    <div class="ManagerForm">
		<fieldset>
		    <legend style="background:url(../images/icons/icon7.jpg) no-repeat 6px 50%;">友情链接</legend>

        
<div class="MainDiv">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                           <td height="40px;">  &nbsp; 链接类型:
                               <select id="f_mululist0" runat="server" onchange="showifr(this.value);">
                               <option value="-1">==全部友情链接==</option>
                               <option value="0">文字类友情链接</option>
                               <option value="1">图片类友情链接</option>
                               </select>
                             </td>
                           <td style="display:none;"><input name="textfield" type="text" class="text" id="textfield">
<select name=queryopt>
<option value=1 selected>文章标题</option>
<option value=2>录 入 者</option>
<option value=3>不限条件</option>
</select>
                              <input name="button" type="submit" class="button" id="button" value="搜  索"></td>
                           <td>&nbsp;</td>
                           <td>&nbsp;</td>
                         </tr>
<script  type="text/javascript">
function showifr(mid)
{
    showurl();
    
    //hbctl_.$("ifr").src="NewsList2.aspx?mid="+mid+"&k="+hbctl_.GetRound();
}
function showurl()
{
    var mid_=hbctl_.GetValueOrTextBySelectID("f_mululist0","value");

    window.location = "LinkList.aspx?type=" + mid_ + "&k=" + hbctl_.GetRound();
}
</script>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#EAE9E1">
<tr bgcolor="#F2F2F2">
    <td height="2" colspan="8" bgcolor="#CCCCCC"></td>
    </tr>




  <tr bgcolor="#F2F2F2">
    <td width="50" height="35"><strong>
      <input type="checkbox" name="checkbox" id="checkbox"   onclick="sall(this);"/>
    <label for="checkbox" style="padding:0px; margin:0px;" >全选</label>
    </strong></td>
    <td width="60" align="center"><strong>显示顺序</strong></td>
    <td><strong>名称</strong></td>
    <td width="120" align="center"><strong>链接地址</strong></td>
    <td width="120" align="center"><strong>说明</strong></td>
    <td width="35" align="center"><strong>审核</strong></td>
    <td width="100" align="center"><strong>LOGO</strong></td>
    <td width="85" align="center">操作</td>
    </tr>
    <cc1:Repeater ID="Repeater1" runat="server">
    <ItemTemplate>
  <tr>
    <td height="30" bgcolor="#FFFFFF" align=center><label for="Checkbox_list_<%#Eval("Body_ID") %>" class="ckall"><input id="Checkbox_list_<%#Eval("Body_ID") %>" value="<%#Eval("Body_ID") %>" name="Checkbox_list" type="checkbox" /></label></td>
    <td align="center" bgcolor="#FFFFFF"><%#Eval("Body_Row") %></td>
    <td bgcolor="#FFFFFF"><a href="LinkList.aspx?type=<%#Eval("Body_LeiXing") %>">[<%#Eval("Body_LeiXing").ToString()=="0"?"文字类":"图片类"%>]</a><a href="ShowNews.aspx?id=<%#Eval("Body_ID") %>" ><%#Eval("Body_Name").ToString().Length > 30 ? Eval("Body_Name").ToString().Substring(0, 28) + "..." : Eval("Body_Name")%></a></td>
    <td bgcolor="#FFFFFF">
        <input type="text" class="Text_1" id="Text1" value="<%#Eval("Body_IP")%>" /></td>
    <td bgcolor="#FFFFFF"><input type="text" class="Text_1" id="Text2" value="<%#Eval("Body_ShuoMing")%>" /></td>
    <td align="center" bgcolor="#FFFFFF"><a href="javascript:edit(<%#Eval("Body_ID") %>)"><img src='../images/check_<%#Eval("Body_IsApproved").ToString() == "1" ? "1" : "0"%>.gif' /></a></td>
    <td height="40" align="center" bgcolor="#FFFFFF"><img src='<%#imgurl(Eval("Body_Tu"))%>' width="88" height="31" /></td>
    
    <td align="center" bgcolor="#FFFFFF">
<a href="javascript:showbox(<%#Eval("Body_ID") %>);"><img alt="编辑此信息" src="../images/icon_edit.gif" /></a> &nbsp;&nbsp;&nbsp; <a href="javascript:del_date(<%#Eval("Body_ID") %>)"><img alt="删除此信息" src="../images/icon_del.gif" /></a>    </td>
    </tr>    
    </ItemTemplate>    
    </cc1:Repeater>
</table>
<br />
<script type="text/javascript">
    var add_edit_id = -1;//-1表示添加

//window.parent.document.getElementById("f_mululist").value=mid_;

function sall(this_)
{
    if(this_.checked)
    {
        hbctl_.CheckBoxAllByName("Checkbox_list",true);
    }
    else
    {
        hbctl_.CheckBoxAllByName("Checkbox_list",false);
    }
}

function edit(id_) {
    var rvalue = Forum.Web.Admin.links.LinkList.edit(id_).value;

    if (rvalue == 1) {
        document.location.reload();
    }
}

function del_date(id_)
{
    var tf_tf=window.confirm('您确定要删除选择的信息?');
    if(tf_tf)
    {
        Forum.Web.Admin.links.LinkList.dellinks(id_);
        document.location.reload();
    }
}

function update_()
{
    var item=hbctl_.$$("Checkbox_list");

    var tf_tf=window.confirm('您确定要删除选择的信息?');

    
    if(item.length>0)
    {
        for(var i=0;i<item.length;i++)
        {
            var id_=item[i].value;
            if(item[i].checked==true)
            {
                Forum.Web.Admin.links.LinkList.dellinks(id_);
            }
        }
        document.location.reload();
    }
}




function showbox(add_edit)
{
    add_edit_id = add_edit;
    BOX_show("neworedit");

    showmodel();
}
function showmodel() {
    if (add_edit_id != -1) {
        var model = Forum.Web.Admin.links.LinkList.getmodel(add_edit_id).value;
        if (model) {
            hbctl_.SetValueByID("f_name", model.Body_Name);
            hbctl_.SetValueByID("f_lenxing", model.Body_LeiXing);
            hbctl_.SetValueByID("f_linkurl", model.Body_IP);
            hbctl_.SetValueByID("f_tu", model.Body_Tu);
            hbctl_.SetValueByID("f_row", model.Body_Row);
            hbctl_.SetValueByID("f_shuoming", model.Body_ShuoMing);
            hbctl_.$("Checkbox1").checked = model.Body_IsApproved;
        }
    }
}
function tu_() {
    var v1 = hbctl_.$('f_tu');
    var galleryscript = '../IfrUpAspx/Ifr.aspx?url=UpPic.aspx?tfcdir=false&path=UpLoad/Links/';

    imgArr = showModalDialog(galleryscript, window, 'dialogWidth:350px; dialogHeight:150px;help: no; scroll: no; status: no');
    if (imgArr != null) {
        v1.value = imgArr;
    }
}
function onsub__() {
    var type="add";
    if(add_edit_id!=-1)
    {
        type="edit";
    }

    if (hbctl_.GetValueByID("f_name") == " " || hbctl_.GetValueByID("f_name").length < 1) {
        alert("请输入名称");
        return;
    }
    if (hbctl_.GetValueByID("f_linkurl") == " " || hbctl_.GetValueByID("f_linkurl").length < 1) {
        alert("请输入链接地址");
        return;
    }
    
    var rvalue = Forum.Web.Admin.links.LinkList.adddata(add_edit_id, type, hbctl_.GetValueByID("f_name"), hbctl_.GetValueOrTextBySelectID("f_lenxing", "value"), hbctl_.GetValueByID("f_linkurl"), hbctl_.GetValueByID("f_tu"), hbctl_.GetValueByID("f_row"), hbctl_.GetValueByID("f_shuoming"), hbctl_.$("Checkbox1").checked).value;
    if(rvalue==1)
    {
        document.location.reload();
    }
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td  height="30" align="right">
        <asp:Label ID="Label1" runat="server" ></asp:Label></td>
  </tr>
</table>
		</fieldset>
        <div class="Navbutton">
<cc1:Button ID="Button1" runat="server" ButtonImgUrl="../images/add.gif" 
                Text=" 新建友情链接" AutoPostBack="False" 
                ScriptContent="hbctl_.$('Checkbox1').checked=true;showbox(-1)" />
            <cc1:Button ID="Button2" runat="server" ButtonImgUrl="../images/del.gif" 
                Text=" 删 除" AutoPostBack="False" HintInfo="删除所选择的友情链接" 
                ScriptContent="update_()" />
        </div>
        </div>
<DIV id=neworedit 
style="BORDER-RIGHT: #999 1px solid; PADDING-RIGHT: 10px; BORDER-TOP: #999 1px solid; DISPLAY:none ; PADDING-LEFT: 10px; BACKGROUND: #fff; PADDING-BOTTOM: 10px; BORDER-LEFT: #999 1px solid; WIDTH: 500px; PADDING-TOP: 10px; BORDER-BOTTOM: #999 1px solid">
<DIV class=ManagerForm>
<FIELDSET><LEGEND 
style="BACKGROUND: url(../images/icons/icon4.jpg) no-repeat 6px 50%">添加友情链接</LEGEND>
<div>
<table width="417" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="80" height="35">
    名称:    </td>
    <td>
        <cc1:TextBox ID="f_name" runat="server"></cc1:TextBox> (必填)
      </td>
  </tr>
  <tr>
    <td height="35">类型:</td>
    <td><select name="select" id="f_lenxing">
      <option value="0">文字类友情链接</option>
      <option value="1">图片类友情链接</option>
    </select>        </td>
  </tr>
  <tr>
    <td height="35">链接地址:</td>
    <td>
        <cc1:TextBox ID="f_linkurl" runat="server" Width="295px"></cc1:TextBox>
      </td>
  </tr>
  <tr>
    <td height="35">LOGO:</td>
    <td>
        <cc1:TextBox ID="f_tu" runat="server" Width="150px" 
            HintInfo="您可以上传图片也可以直接输入图片地址"></cc1:TextBox>
            <cc1:Button ID="Button5" runat="server" ButtonImgUrl="../images/uploadfile.gif" 
                Text=" 上传图片" AutoPostBack="False" 
            ScriptContent="tu_()" />
      </td>
  </tr>
  <tr>
    <td height="35">显示顺序:</td>
    <td>
        <cc1:TextBox ID="f_row" runat="server" Width="51px">0</cc1:TextBox>
      </td>
  </tr>
  <tr>
    <td height="35">说明:</td>
    <td>
        <cc1:TextBox ID="f_shuoming" runat="server" Width="295px"></cc1:TextBox>
      </td>
  </tr>
  <tr>
    <td height="35">审核:</td>
    <td>
        <input id="Checkbox1" type="checkbox"   /><label for="Checkbox1">审核后就会在友情链接里显示</label></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>
            <cc1:Button ID="Button3" runat="server" ButtonImgUrl="../images/add.gif" 
                Text=" 提 交" AutoPostBack="False" ScriptContent="onsub__()" />
            <cc1:Button ID="Button4" runat="server" ButtonImgUrl="../images/del.gif" 
                Text=" 取 消" AutoPostBack="False" 
            ScriptContent="BOX_remove('neworedit');" />
        </td>
  </tr>
</table>
</div>
</FIELDSET> 
</DIV></DIV>
</form>
</body>
</html>
