{layout:default} {class:Shop.Admin.storeConfig.SearchKey}
<lbhead>
    <title><%=Tag("关键词管理")%>-<%=site.title%></title>
</lbhead>
<lbpath>
    <div class="tools">
    <ul>
    <%if (PageReturnMsg == ""){%>
    <li class="add"><a href="javascript:void(0);" onclick="EditSrarchKey(0);"><b></b><span><%=Tag("添加")%></span></a></li>
    <li class="submit"><a href="javascript:void(0);" onclick="Update();"><b></b><span><%=Tag("保存")%></span></a></li>
    <li class="del"><a href="javascript:void(0);" onclick="DELSrarchKey();"><b></b><span><%=Tag("删除")%></span></a></li>
    <%}%>
    <li class="name"><span id="navIgation"><%=Tag("当前位置")%>：<a href="<%=site.AdminPath %>/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0"><%=Tag("管理首页")%></a> > <%=Tag("关键词管理")%></span></li>
    </ul>
    </div>
</lbpath>
<lbbody>
    <div class="searchbox">
        <select id="lang">
            <option value="">┌<%=Tag("语言")%></option>
            <%=Shop.Bussiness.Language.LanguageOption(lang) %>
        </select>
        <!--select id="type">
            <option value=""><%=Tag("属性")%></option>
            <option value="1" <%=type==1?"selected":"" %>><%=Tag("内链")%></option>
            <option value="2" <%=type==2?"selected":"" %>><%=Tag("外链")%></option>
        </select-->
        <input type="text" id="key" name="key" class="input-query" value="<%=key %>" onkeydown="if(event.keyCode==13){search_();}" /><input type="button" id="btnSou" class="btn-query" onclick="search_();" value="" />
    </div>
    <table class="datalist">
        <tr class="title">
            <th style="width: 40px" class="selectAll">
                <a href="javascript:void(0);" onclick="$('input[name=\'sid\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));"><%=Tag("全选")%></a>
            </th>
            <th style="width: 200px">
                <%=Tag("名称")%>
            </th>
            <th style="width: 300px">
                <%=Tag("网址")%>
            </th>
            <th style="width: 80px">
                <%=Tag("属性")%>
            </th>
            <th style="width: 80px">
                <%=Tag("序号")%>
            </th>
            <th>
                <%=Tag("操作")%>
            </th>
        </tr>
        <%foreach (DB.LebiShop.Lebi_Searchkey model in models)
          {%>
        <tr class="list" ondblclick="EditSrarchKey(<%=model.id %>)">
            <td style="text-align:center">
                <input type="checkbox" value="<%=model.id %>" name="sid" />
                <input type="hidden" name="Uid" shop="true" value="<%=model.id %>" />
            </td>
            <td>
                <%=Shop.Bussiness.Language.Content(model.Name, lang)%>
            </td>
            <td>
                <%=model.URL%>&nbsp;
            </td>
            <td>
                <%=model.Type == 1 ? "" + Tag("内链") + "" : "" + Tag("外链") + ""%>
            </td>
            <td>
                <input type="text" id="Sort<%=model.id %>" name="Sort<%=model.id %>" shop="true" class="input" style="width: 60px" value="<%=model.Sort %>" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" />
            </td>
            <td>
                <a href="javascript:void(0)" onclick="EditSrarchKey(<%=model.id %>)"><%=Tag("编辑")%></a>
            </td>
        </tr>
        <%} %>
    </table> 
    <script type="text/javascript">
        function search_() {
            var lang = $("#lang").val();
            var key = $("#key").val();
            var type = $("#type").val();
            window.location = "?key=" + escape(key) + "&lang=" + lang + "&type=" + type;
        }
        function EditSrarchKey(id) {
            var title_ = "<%=Tag("编辑关键词")%>";
            if (id == 0) title_ ="<%=Tag("添加关键词")%>"
            var url_ = "searchkey_edit_window.aspx?id=" + id;
            var width_ = 600;
            var height_ = "auto";
            var modal_ = true;
            EditWindow(title_, url_, width_, height_, modal_);
        }
        function DELSrarchKey() {
            if (!confirm("<%=Tag("确认要删除吗？")%>"))
                return false;
            var ids = GetChkCheckedValues("sid");
            var postData = { "ids": ids };
            var url = "<%=site.AdminPath %>/ajax/ajax_site.aspx?__Action=SearchKey_Del";
            RequestAjax(url,postData,function(){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
        function Update() {
            var postData = GetFormJsonData("shop");
            var url = "<%=site.AdminPath %>/ajax/ajax_site.aspx?__Action=SearchKey_Update";
            RequestAjax(url,postData,function(){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
    </script>
</lbbody>
<lbbottom>
<div class="bottom" id="body_bottom">
    <%=PageString%>
</div>
</lbbottom>