<%@Page Language="C#" Inherits="IWMS.Admin.GetJs" MasterPageFile="admin.master"%>
<asp:Content ContentPlaceHolderId="cphHead" runat="server">
	<script type="text/javascript" src="inc/html_preview.js"></script>
	<script type="text/javascript">
	<!--
	function GenerateJs()
	{
		var s, path;
		var oGetType, oTopType, oCols, oTopNum, oMaxLength, oBullet, oHeaderArea, oJsArea, oWidth, oHeight, oNewWin;
		
		oGetType = $i("getType");
		oTopType = $i("topType");
		oPostType = $i("postType");
		oCols = $i("cols");
		oTopNum = $i("topNum");
		oMaxLength = $i("maxLength");
		oBullet = $i("bullet");
		oHeaderArea = $i("headerArea");
		oJsArea = $i("jsArea");
		oWidth = $i("tWidth");
		oHeight = $i("tHeight");
		oNewWin = $i("newWin");
		
		path=window.location.href;
		path=path.substring(0,path.lastIndexOf("/")+1);
		s=path+"js.aspx?type=";
		switch (oGetType.value) {
			case "text" :
				s+=oTopType.value+"&cols=";
				s+=oCols.value;
				break;
			case "img" :
				s+="img&cols="
				s+=oCols.value;
				break;
			case "top" :
				s+="top";
				break;
			case "post" :
				s+="post&hot=";
				s+=oPostType.selectedIndex+"&showdate=";
				s+=$i("showDate").checked?"1":"0";
				break;
			case "adminchart" :
				s+="adminchart";
				break;
			case "topic" :
				s+="topic";
				break;
			case "links" :
				s+="links&cols=";
				s+=oCols.value;
				break;
			case "imgLinks" :
				s+="imglinks&cols=";
				s+=oCols.value;
		}
		if (!oTopNum.disabled) {
			s+="&num=";
			s+=oTopNum.value;
		}
		if (oGetType.value=="text" || oGetType.value=="img" || oGetType.value=="top") {
			var oClassID = $i("<%=classID.ClientID%>");
			if (oClassID.selectedIndex>=0){
				s+="&classid=";
				s+=oClassID.value;
				for(var i=0; i<oClassID.options.length; i++){
					oOption = oClassID.options[i];
					if (oOption.selected==false || oOption.value==oClassID.value){
						continue;
					}else{
						s+=","+oOption.value;
					}
				}
			}
			var oTopicID = $i("<%=topicID.ClientID%>");
			if (oTopicID.selectedIndex>0){
				s+="&topicid=";
				s+=oTopicID.value;
			}
			if (oGetType.value=="text") {
				if ($i("showClass").checked)
					s+="&showclass=1";
				if ($i("showDate").checked)
					s+="&showdate=1";
				if ($i("showHits").checked)
					s+="&showhits=1";
				if ($i("showNew").checked)
					s+="&shownew=1";
				if ($i("inTable").checked)
					s+="&table=1";
			}
		}
		if (!oMaxLength.disabled) {
			s+="&maxlen=";
			s+=oMaxLength.value;
		}
		if (oNewWin.checked){
			s+="&nw=1";
		}
		if (oBullet.value!=""){
			s+="&b=";
			s+=oBullet.value.replace(/"/ig,"&quot;");
		}
		if (oGetType.value=="text"){
			var hd = "<style type='text/css'>\r\n"+
					".icoNew1 {background:url("+path+"style/iwms/pic.gif) 0 0;width:10px;height:10px}\r\n"+
					".icoNew2 {background:url("+path+"style/iwms/pic.gif) 0 -10px;width:10px;height:10px}\r\n"+
					".icoNew3 {background:url("+path+"style/iwms/pic.gif) 0 -20px;width:10px;height:10px}\r\n"+
					"<\/style>";
			oHeaderArea.value = hd;
		}else if (oGetType.value=="img"){
			var hd ="<style type='text/css'>\r\n"+
					"/*下边样式表定义标题图片显示边框*/\r\n"+
					"a.imgLink img {display:block;background:#FFF; padding:3px; border:1px solid #D8A18B;margin:auto;}\r\n"+
					"a.imgLink { margin:5px auto;line-height:1.8; display:block}\r\n"+
					"a.imgLink:hover img {border:2px dotted #99F; background:#EEE; padding:2px}\r\n"+
					"<\/style>\r\n"+
					"<script type=\"text/javascript\" src=\""+path+"inc/iwms.js\" charset=\"UTF-8\"><\/script>\r\n";
			oHeaderArea.value = hd;
		}else{
			oHeaderArea.value="";
		}
		oJsArea.value="<script src=\""+s+"\"><\/script>";
	}
	
	function CopyJs()
	{
		$i("jsArea").focus();
		$i("jsArea").select();
		document.execCommand("copy");
	}
	
	function CopyHeader()
	{
		$i("headerArea").focus();
		$i("headerArea").select();
		document.execCommand("copy");
	}
	
	function ImgOrText(s)
	{
		var oTopType = $i("topType");
		var oPostType = $i("postType");
		var oCols = $i("cols");
		var oClassID = $i("<%=classID.ClientID%>");
		var oTopicID = $i("<%=topicID.ClientID%>");
		var oTopNum = $i("topNum");
		var oMaxLength = $i("maxLength");
		if (s=="img") {
			oTopType.style.display="none";
			oPostType.style.display="none";
			oCols.disabled=false;
			oClassID.disabled=false;
			oClassID.size=6;
			oClassID.multiple=true;
			oTopicID.disabled=true;
			oTopNum.disabled=false;
			oMaxLength.disabled=false;
		}else if (s=="text") {
			oTopType.style.display="";
			oPostType.style.display="none";
			oCols.disabled=true;
			oClassID.disabled=false;
			oClassID.size=6;
			oClassID.multiple=true;
			oTopicID.disabled=false;
			oTopNum.disabled=false;
			oMaxLength.disabled=false;
		}else if (s=="top") {
			oTopType.style.display="none";
			oPostType.style.display="none";
			oCols.disabled=true;
			oClassID.disabled=false;
			oClassID.size=0;
			oClassID.multiple=false;
			oTopicID.disabled=true;
			oTopNum.disabled=false;
			oMaxLength.disabled=false;
		}else if (s=="post"){
			oTopType.style.display="none";
			oPostType.style.display="";
			oCols.disabled=true;
			oClassID.disabled=true;
			oClassID.size=0;
			oClassID.multiple=false;
			oTopicID.disabled=true;
			oTopNum.disabled=false;
			oMaxLength.disabled=false;
		}else if (s=="adminchart") {
			oTopType.style.display="none";
			oPostType.style.display="none";
			oCols.disabled=true;
			oClassID.disabled=true;
			oClassID.size=0;
			oClassID.multiple=false;
			oTopicID.disabled=true;
			oTopNum.disabled=false;
			oMaxLength.disabled=false;
		}else if (s=="topic") {
			oTopType.style.display="none";
			oPostType.style.display="none";
			oCols.disabled=true;
			oClassID.disabled=true;
			oClassID.size=0;
			oClassID.multiple=false;
			oTopicID.disabled=true;
			oTopNum.disabled=false;
			oMaxLength.disabled=false;
		}else if (s=="links" || s=="imgLinks") {
			oTopType.style.display="none";
			oPostType.style.display="none";
			oCols.disabled=false;
			oClassID.disabled=true;
			oClassID.size=0;
			oClassID.multiple=false;
			oTopicID.disabled=true;
			oTopNum.disabled=true;
			oMaxLength.disabled=true;
		}
	}
	
	function TextType(s)
	{
		var oTopType = $i("topType");
		var oClassID = $i("<%=classID.ClientID%>");
		if (s=="new") {
			oClassID.size=6;
			oClassID.multiple=true;
		}else{
			oClassID.size=0;
			oClassID.multiple=false;
		}
	}
	
	-->
	</script>
</asp:Content>

<asp:Content ContentPlaceHolderId="cphMain" runat="server">


	<div class="mframe">
	<div class="tl"></div>
	<div class="rt"></div>
	<div class="tm">
		<span class="tt">获取调用脚本</span>
	</div>
	<div class="wrapper">
	<div class="ml"></div>
	<div class="mr"></div>
	<div class="mm">
		<form runat="server">
		<table width="95%" align="center" style="table-layout:fixed">
		<tr>
		<th width="80">
			调用类型：
		</th><td>
			<select id="getType" onchange="ImgOrText(this.value);">
				<option value="text">调用文本新闻</option>
				<option value="img">调用图片新闻</option>
				<option value="top">固顶新闻</option>
				<option value="post">调用帖子</option>
				<option value="adminchart">会员排名</option>
				<option value="topic">调用专题</option>
				<option value="links">文本友情链接</option>
				<option value="imgLinks">图片友情链接</option>
			</select> 
			
			<select id="topType" onchange="TextType(this.value);" style="margin-left:20px">
				<option value="new">最新添加</option>
				<option value="hot">热门新闻</option>
				<option value="weekhot">本周热门</option>
				<option value="dayhot">今日热门</option>
				<option value="random">随机内容</option>
			</select>
			
			<select id="postType" style="margin-left:20px;display:none">
				<option value="new">最新更新</option>
				<option value="hot">一月热门</option>
			</select>
			
			　分
			<select id="cols">
				<option value="1">1</option>
				<option value="2">2</option>
				<option value="3">3</option>
				<option value="4">4</option>
				<option value="5">5</option>
				<option value="6">6</option>
				<option value="7">7</option>
				<option value="8">8</option>
				<option value="9">9</option>
			</select> 列显示
		</td>
		</tr>
		<tr>
		<th>
			调用分类：
		</th><td>	
			<asp:DropDownList id="classID"
				runat="server" size="6" multiple="multiple" />(文本及图片最新添加新闻调用可以同时调用多个分类，按ctrl多选)
		</td>
		</tr>
		<tr>
		<th>
			专题新闻：
		</th><td>	
			<asp:DropDownList id="topicID"
				runat="server"/>
		</td>
		</tr>
		<tr>
		<th>
			调用数量：
		</th><td>
			<input type="text" id="topNum" value="10" size="3" maxlength="3"/> &nbsp;
			标题长度：
			<input type="text" id="maxLength" value="15" size="3" maxlength="3"/> &nbsp;
			<input type="checkbox" id="newWin" checked="checked" /><label for="newWin">新窗口打开新闻</label>&nbsp; &nbsp;
		</td>
		</tr>
		<tr>
		<th>
			标题图片：
		</th><td>
			宽度：<input type="text" id="tWidth" value="120" size="3" maxlength="3"/>
			高度：<input type="text" id="tHeight" value="0" size="3" maxlength="3"/>
			(0表示不指定)
		</td>
		</tr>
		<tr>
		<th>
			标题符号：
		</th><td>
			<input type="text" id="bullet" value="·" size="40" maxlength="80" /> (可以为html<a href="javascript:HtmlPreview('bullet')">预览</a>,如图片<strong>&lt;img src="x.gif"/&gt;</strong>)
		</td>
		</tr>
		<tr>
		<th>
			显示内容：
		</th><td>
			<input type="checkbox" id="showClass" /><label for="showClass">显示类名</label>&nbsp; &nbsp;
			<input type="checkbox" id="showDate" /><label for="showDate">显示日期</label>&nbsp; &nbsp;
			<input type="checkbox" id="showHits" /><label for="showHits">显示点击数</label>&nbsp; &nbsp;
			<input type="checkbox" id="showNew" /><label for="showNew">显示New图标</label>&nbsp; &nbsp;
			<input type="checkbox" id="inTable" /><label for="inTable">日期对齐显示</label>&nbsp; &nbsp;
		</td>
		</tr>
		<tr>
		<td>
			&nbsp;
		</td>
		<td>
			<input type="button" value="生成脚本" onclick="GenerateJs();"/> &nbsp; &nbsp; 
		</td>
		</tr>
		<tr>
		<td>
			&nbsp;
		</td>
		<td>
			请将以下内容放在html的&lt;head&gt;中<input type="button" value="拷贝头部信息" onclick="CopyHeader();"/>
		</td>
		</tr>
		<tr>
		<td>&nbsp;</td>
		<td>
			<textarea id="headerArea" cols="90" rows="6"></textarea>
		</td>
		</tr>
		<tr>
		<td>
			&nbsp;
		</td>
		<td>
			请把以下脚本放到要显示调用内容的位置<input type="button" value="拷贝脚本" onclick="CopyJs();"/>
		</td>
		</tr>
		<tr>
		<td>&nbsp;</td>
		<td>
			<textarea id="jsArea" cols="90" rows="6"></textarea>
		</td>
		</tr>
		<tr>
		<td colspan="2" height="30">
			注：把生成的脚本粘贴到html文件内即可以显示指定的内容
		</td>
		</tr>
		</table>
		</form>
		
	</div>
	</div>
	<div class="bl"></div>
	<div class="br"></div>
	<div class="bm"></div>
	</div>

</asp:Content>