<%@ page contentType="text/html; charset=GBK" session="false"%>
<%@ taglib uri="/cmsTag" prefix="cms"%>

<!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>
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<cms:SystemDataModel id='1'>
			<title>添加文章</title>
			<link href="../../style/blue/css/main.css" type="text/css" rel="stylesheet" />
			<link href="../../style/blue/css/reset-min.css" rel="stylesheet" type="text/css" />
			<link href="../../javascript/colorpicker/css/picker.css" type="text/css" rel="stylesheet" />
			<script type="text/javascript" src="../../common/js/jquery-1.7.gzjs"></script>
			<script language="javascript" type="text/javascript" src="../../javascript/commonUtil_src.js"></script>
			<script type="text/javascript" src="../../javascript/dialog/lhgdialog.min.js?skin=iblue"></script>
			<script type="text/javascript" src="../../javascript/editor/fckeditor.js"></script>
			<script type="text/javascript" src="../../javascript/format/editor_content_format.js"></script>
			<script type="text/javascript" src="../../javascript/colorpicker/picker.js"></script>
			<script type="text/javascript" src="../../javascript/uuid.js"></script>

			<script language="javascript" type="text/javascript" src="../../javascript/My97DatePicker/WdatePicker.js"></script>

			<script>
			basePath='<cms:Domain/>/';
			//$(window).load(function()
			$(function()
			{
				 //颜色选择
				 $("#titleBg").bigColorpicker(
				 	"titleBgVal"
				 ); 
				 
				 $("#simpleTitleBg").bigColorpicker(
				 	"simpleTitleBgVal"
				 ); 
	
				validate('title',1,null,null);	
			 // $.formValidator.initConfig({formID:"photoForm",theme:'Bull',mode:'AutoTip',onError:function(msg){alert(msg)},inIframe:true});
			  
		    
			})
		 
		</script>
			<script type="text/javascript">


</script>
	</head>
	<body>
		<form method="post" name="contentForm" id="contentForm">
			<div class="breadnav">
				<table width="99.9%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="left">
							&nbsp;
							<img src="../../style/blue/images/home.gif" width="16" height="16" class="home" />
							当前位置：
							<a href="#">内容管理</a> &raquo; 添加文章
						</td>
						<td align="right">

						</td>
					</tr>
				</table>
			</div>
			<div style="height:25px;"></div>
			<!--新添加修稿20130804-->
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td align="left" valign="top">
						<!--main start class="mainbody"-->
						<div class="addtit">
							<img src="../../style/blue/icon/application-import.png" width="16" height="16" />
							文章基本信息
						</div>



						<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form-table-big" style="padding-top: 8px;">

							<tr>
								<td width="12%" class="input-title">
									标题:
								</td>
								<td class="td-input">
									<input id="title" name="title" type="text" size="85" maxLength="120" style="width: 443px;" class="form-input-title titlerule" onkeyup="textCounter(this, 'currCharLen');" />
									<span class="red">*</span>
									<font><span id="currCharLen">0</span>字</font> &nbsp;

									<img src="../../../core/style/blue/icons/edit_r1_c7.jpg" height="16" width="16" title="颜色" id="titleBg" class="cursor img-icon" />
									<input type="hidden" id="titleBgVal" name="titleBgVal" value="" />
									<img src="../../../core/style/blue/icons/edit_r1_c1.jpg" height="16" width="16" title="粗体" id="strongTitle" onclick="javascript:setTitleChar(this);" class="cursor img-icon" />
									<img src="../../../core/style/blue/icons/edit_r1_c3.jpg" height="16" width="16" title="斜体" id="emTitle" onclick="javascript:setTitleChar(this);" class=" cursor img-icon" />
									<img src="../../../core/style/blue/icons/edit_r1_c5.jpg" height="16" width="16" title="下划线" id="underTitle" onclick="javascript:setTitleChar(this);" class=" cursor img-icon" />
									&nbsp;
									<input type="checkbox" size="55" class="form-checkbox img-icon" onclick="javascript:showTitleInput('simpleTitle',this);" />
									副标
									<input type="checkbox" size="55" class="form-checkbox img-icon" onclick="javascript:showTitleInput('shortTitle',this);" />
									短标
								</td>
							</tr>
							<tr id="simpleTitleTr" style="display:none">
								<td class="input-title">
									副标题:
								</td>
								<td width="87%" class="td-input">
									<input id="simpleTitle" name="simpleTitle" type="text" style="width: 284px;" class="form-input-title titlerule" onkeyup="textCounter(this, 'currSimpleCharLen');" size="55" maxLength="60" />
									<font face="微软雅黑"><span id="currSimpleCharLen">0</span>字</font> &nbsp;
									<img src="../../../core/style/blue/icons/edit_r1_c7.jpg" height="16" width="16" title="颜色" id="simpleTitleBg" class="cursor img-icon" />
									<input type="hidden" id="simpleTitleBgVal" name="simpleTitleBgVal" value="" />
									<img src="../../../core/style/blue/icons/edit_r1_c1.jpg" height="16" width="16" title="粗体" id="strongSimpleTitle" onclick="javascript:setSimpleTitleChar(this);" class="cursor img-icon" />
									<img src="../../../core/style/blue/icons/edit_r1_c3.jpg" height="16" width="16" title="斜体" id="emSimpleTitle" onclick="javascript:setSimpleTitleChar(this);" class="cursor img-icon" />
									<img src="../../../core/style/blue/icons/edit_r1_c5.jpg" height="16" width="16" title="下划线" id="underSimpleTitle" onclick="javascript:setSimpleTitleChar(this);" class="cursor img-icon" />
									&nbsp;
								</td>

							</tr>
							<tr id="shortTitleTr" style="display:none">
								<td class="input-title">
									短标题:
								</td>
								<td width="87%" class="td-input">
									<input id="shortTitle" name="shortTitle" style="width: 284px;" type="text" class="form-input" size="55" maxLength="30" />
									<font face="微软雅黑">0字 </font> &nbsp; &nbsp;
								</td>

							</tr>

							<tr>
								<td width="16%" class="input-title">
									所属栏目:
								</td>
								<td class="td-input">

									<input id="classInfo" type="text" class="form-input" value="合肥 &laquo; 社会新闻 &laquo; 国内 &laquo; 新闻中心" readonly size="22" maxlength="54" />
									<input type="button" value="选择" onclick="" class="btn-1" />


									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<span><img src="../../../core/style/blue/icon/documents-text.png" height="16" width="16" class="img-icon" /><a class="a_style" href="javascript:openCopyContentToSiteClassDialog('1');">&nbsp;复制到 本站栏目</a>[<font color=red><span id='shareCount'>0</span></font>] </span> &nbsp;&nbsp;
									<span><img src="../../../core/style/blue/icon/sitemap-application.png" height="16" width="16" class="img-icon" /><a class="a_style" href="javascript:showShareDialog()">&nbsp;共享到 网站群</a>[<font color=red><span id='shareCount'>0</span></font>] </span>&nbsp;&nbsp;
									<span><img src="../../../core/style/blue/icon/document-tree.png" height="16" width="16" class="img-icon" /><a class="a_style" href="javascript:showShareDialog()">&nbsp;相关内容</a>[<font color=red><span id='shareCount'>0</span></font>] </span>
								</td>
							</tr>

							<tr>
								<td class="input-title">
									责编:
								</td>
								<td class="td-input">
									<input id="creator" name="creator" type="text" class="form-input" value="" size="45" maxlength="58" />
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<span class="input-title">TAG:</span>
									<input id="tagKey" name="tagKey" type="text" class="form-input" value="" size="40" maxlength="30" />
									<input type="button" value="选取Tag" onclick="javascript:openSelectTagDialog();" class="btn-1" />
								</td>
							</tr>


							<tr>
								<td class="input-title">
									来源:
								</td>
								<td class="td-input">
									<input name="author" id="author" type="text" class="form-input" size="34" maxLength="50" />
									<input type="button" value="选取来源" class="btn-1"  />
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<span class="input-title">关键字:</span>
									<input id="keywords" name="keywords" type="text" class="form-input" value="" size="40" maxlength="200" />
									<input type="button" value="自动获取" onclick="javascript:getKeywordFromContent();" class="btn-1" />
								</td>
							</tr>





							<tr>
								<td class="input-title">
									内容摘要:
								</td>
								<td class="td-input">
									<textarea id="summary" name="summary" style="height:45px;width:562px" class="form-textarea"></textarea>
								</td>
							</tr>





							<tr>
								<td class="input-title">

								</td>
								<td class="td-input">
									<textarea id="content" name="content" style="height:50px;width:570px" class="form-textarea"></textarea>

									<script type="text/javascript">
                                                   var editor1 = new FCKeditor('content');
                                                   editor1.BasePath = "<cms:BasePath/>core/javascript/editor/";
                                                   editor1.Height = 535;
                                                   editor1.Width = 665;
                                                   editor1.Config["EnterMode"] = "p";
                                                   editor1.ReplaceTextarea();   
                                 	</script>

									<%--<input type="hidden" id="content" name="content" value="" style="display:none" />

									<iframe id="jtopcmsEditorFrame" src="<cms:Domain/>/core/javascript/editor/editor/fckeditor.html?InstanceName=content&amp;Toolbar=Default&amp;EnterMode=br" width="675" height="500" frameborder="0" scrolling="no" style="border: 0pt none ; margin: 0pt; padding: 0pt; background-color: transparent; background-image: none; width: 100%; height: 200px;"></iframe>
									<br>
									
									--%>
									<script>
									//javascript:change(400,"a")javascript:change(400,"d")
										function change(h,f)
										{
											var styleHeight = parseInt(document.getElementById('jtopcmsEditorFrame').style.height);
											
											if("d" == f && styleHeight -60 < 600 )
											{
												return;
											}
											
											if("a" == f)
											{									
												document.getElementById('jtopcmsEditorFrame').style.height= (styleHeight + h)+"px";
											}
											else
											{
												document.getElementById('jtopcmsEditorFrame').style.height= (styleHeight - h)+"px";
											}
										}
									</script>

								</td>
							</tr>
							<tr>
								<td class="input-title">
									文章属性
								</td>
								<td class="td-input">
									<input type="checkbox" id="getImgFromWeb" name="getImgFromWeb" checked>
									<span class="style12">下载文章中图片到本地</span>
									<input type="checkbox" id="useHeadPageImg" name="useHeadPageImg">
									<span class="style12">取内容中首张图片为引导图片</span>
									<input type="checkbox" id="deleteAllHref" name="deleteAllHref">
									<span class="style12">删除所有外部链接</span>

								</td>
							</tr>


						</table>

						<div class="addtit">
							<img src="../../style/blue/icon/application-import.png" width="16" height="16" />
							高级选项
						</div>
						<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-table-big">
							<tr>

								<td class="input-title">
									引导图片
								</td>
								<td class="td-input">
									<%--<img id="guide1" src="../../style/blue/images/no-image.png" width="90" height="67" />
									<img id="guide1" src="../../style/blue/images/no-image.png" width="90" height="67" />
									<img id="guide1" src="../../style/blue/images/no-image.png" width="90" height="67" />
									<img id="guide1" src="../../style/blue/images/no-image.png" width="90" height="67" />

								--%>


									<table border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td>
												<img id="contentImageShow" src="../../style/blue/images/no-image.png" width="95" height="67" />
											</td>
											<td>
												<table border="0" cellpadding="0" cellspacing="0">
													<tr>
														<td>
															<input type="button" onclick="javascript:showModuleImageDialog('contentImageShow','contentImageSysReUrl')" value="上传" onclick="" class="btn-1" />
															<input type="button" value="裁剪" onclick="" class="btn-1" />
															<input type="button" value="删除" onclick="" class="btn-1" />
														</td>
													</tr>
													<tr>
														<td>
															宽
															<input type="text" value="300" onclick="" class="form-input" size="4" />
															&nbsp; &nbsp; &nbsp;高
															<input type="text" value="300" onclick="" class="form-input" size="4" />
														</td>
													</tr>
												</table>


											</td>
										</tr>
									</table>

								</td>
							</tr>


							<tr>
								<td width="16%" class="input-title">
									独有模板
								</td>
								<td class="td-input">
									<input id="especialTemplateUrl" name="especialTemplateUrl" type="text" class="form-input" value="" size="54" maxlength="220" />
									<input type="button" value="浏览..." onclick="" class="btn-1" />
								</td>

							</tr>

							<tr>
								<td class="input-title">
									内容属性
								</td>
								<td class="td-input">
									<%--
								multiple="multiple"
									--%>
									<select name="typeFlag" id="typeFlag">
										<option>
											------ 内容自定义属性 ------
										</option>
										<option>
											图文
										</option>
										<option>
											视频
										</option>
										<option>
											附件
										</option>
										<option>
											图集
										</option>
									</select>
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 置顶内容:
									<input type="radio" name="topFlag" value="0" checked>
									否
									<input type="radio" name="topFlag" value="1">
									是 评论选项:
									<input type='radio' name='allowCommend' class='form-radio' value='1' checked />
									允许
									<input type='radio' name='allowCommend' class='form-radio' value='0' />
									禁止
								</td>


							</tr>







							<%--<tr>
								<td class="input-title">
									推荐位
								</td>
								<td class="td-input">
									
								multiple="multiple"
									
									<select name="commFlag" id="commFlag" multiple="multiple">
										<option>
											------ 内容多选推荐位 ------
										</option>
										<option>
											头条
										</option>
										<option>
											推荐
										</option>
										<option>
											热点
										</option>
										<option>
											幻灯
										</option>
										<option>
											首页头条
										</option>
										<option>
											首页推荐
										</option>
										<option>
											首页热点
										</option>
									</select>
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 评论选项:
									<input type='radio' name='allowCommend' class='form-radio' value='1' checked />
									允许
									<input type='radio' name='allowCommend' class='form-radio' value='0' />
									禁止
								</td>


							</tr>

							--%>
							<tr>
								<td class="input-title">
									发布时间
								</td>
								<td class="td-input">
									<input id="appearStartDateTime" name="appearStartDateTime" size="27" maxlength="30" type="text" class="form-input-date" onmousedown="javascript:WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" />
									&nbsp;至 &nbsp;
									<input id="appearEndDateTime" name="appearEndDateTime" size="27" maxlength="30" type="text" class="form-input-date" onmousedown="javascript:WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" />

								</td>
							</tr>
							<tr>
								<td class="input-title">
									推荐位
								</td>
								<td class="td-input">
									<input type="checkbox" name="commandFlag" value="1">
									<span class="style12">头条</span>
									<input type="checkbox" name="commandFlag" value="2">
									<span class="style12">推荐</span>
									<input type="checkbox" name="commandFlag" value="3">
									<span class="style12">热点</span>
									<input type="checkbox" name="commandFlag" value="4">
									<span class="style12">幻灯</span>

									<input type="checkbox" name="commandFlag" value="5">
									<span class="style12">滚动</span>
									<input type="checkbox" name="commandFlag" value="6">
									<span class="style12">首页头条</span>
									<br />
									<input type="checkbox" name="commandFlag" value="7">
									<span class="style12">首页推荐</span>
									<input type="checkbox" name="commandFlag" value="8">
									<span class="style12">首页热点</span>


								</td>
							</tr>

						</table>
					</td>
				</tr>

				<tr>
					<td height="10">
						&nbsp;
					</td>
				</tr>
			</table>

			<!-- hidden -->
			<input type="hidden" id="classId" name="classId" value="${param.classId}" />

			<!-- 文章模型 -->
			<input type="hidden" id="modelId" name="modelId" value="1" />

			<input type="hidden" id="toStepId" name="toStepId" />

			<input type="hidden" id="fromStepId" name="fromStepId" />

			<!-- 图片信息-->
			<input id="homeImageSysReUrl" name="homeImageSysReUrl" type="hidden" />
			<input id="channelhomeImageSysReUrl" name="channelhomeImageSysReUrl" type="hidden" />
			<input id="classImageSysReUrl" name="classImageSysReUrl" type="hidden" />
			<input id="contentImageSysReUrl" name="contentImageSysReUrl" type="hidden" />


			<!-- 标题样式 -->
			<input id='titleStyle' name="titleStyle" type="hidden" />
			<input id='simpleTitleStyle' name="simpleTitleStyle" type="hidden" />

			<!-- 稿件标志 -->
			<input id='contentAddStatus' name="contentAddStatus" type="hidden" />

			<!-- 获取keyword临时变量 -->
			<input type="hidden" id="jtopcms_sys_keyword_content" name="jtopcms_sys_keyword_content" value="" />
		</form>

		<!--提交-->
		<table width="100%" border="0" cellspacing="0" cellpadding="0" >
			<tr class="btnbg100">
				<td width="40%" class="input-title"></td>
				<td width="87%" class="td-input">
					<cms:WorkflowActionUIHelp classId="${param.classId}">
						<a onclick="javascript:submitArticle('${Action.fromStepId}','${Action.toStepId}');"  class="btnwithico"><img src="../../style/icons/tick.png" width="16" height="16" /><b>${Action.passActionName}&nbsp;</b> </a>
					</cms:WorkflowActionUIHelp>
					<a onclick="javascript:submitArticle(-1,-1,true);"  class="btnwithico"><img src="../../style/icons/tick.png" width="16" height="16" /><b>存为稿件&nbsp;</b> </a>
					<a href="javascript:;"  class="btnwithico" onclick=""><img src="../../style/icon/close.png" width="16" height="16"><b>取消&nbsp;</b> </a>
				</td>
			</tr>
		</table>

		<!--[if lt IE 7]>
        <script type="text/javascript" src="js/unitpngfix.js"></script>
<![endif]-->
	</body>
</html>

<script type="text/javascript">

function submitArticle(fromStepId,toStepId,draft)
{	
	var hasError = false;
    var currError = false;
    
    
    currError = submitValidate('title',1,null,null);

    if(currError)
	{
		hasError = true;
    }
    			
    if(hasError)
    {
	  $.dialog({ 
	   					title :'提示',
	    				width: '180px', 
	    				height: '70px', 
	                    lock: true, 
	    				icon: '32X32/i.png', 
	    				
	                    content: '包含未正确填写的数据,请参照提示填写正确!',
	                    
	                   
	    cancel: true
	                    
		
		
		});
		
		return;
	}

	
	if(draft)
	{
		document.getElementById('contentAddStatus').value='draft';
	}
	
   	document.getElementById('fromStepId').value=fromStepId;
    document.getElementById('toStepId').value=toStepId;
 
   
    for(var i =0 ;  i< pageInfoArray.length;i++)
    {
    	//alert(pageInfoArray[i]);
    }

  
	//alert(document.all.upload.contentWindow.document.getElementById("classImgURL").value); 


	//document.all.classImgUrl.value=document.all.uploadFrame.contentWindow.document.getElementById("classImgFile").value;
	//document.all.contentImgUrl.value=document.all.uploadFrame.contentWindow.document.getElementById("contentImgFile").value;
	//document.all.headImgUrl.value=document.all.uploadFrame.contentWindow.document.getElementById("headImgFile").value;
	//alert('1:'+document.all.classImgURL.value);
	

	
	//alert('2:'+document.all.contentImgURL.value);
	//alert('3:'+document.all.headImgURL.value);
	
	disposeTitleStyle();
	
	var articleForm = document.getElementById('contentForm');
	
	articleForm.action="../../../content/addContent.cmd"
	
	articleForm.submit();
}


function showShareDialog()
{
   var returnArray=window.showModalDialog("ShareArticle.jsp?currentSelectClassIdStr="+document.getElementById("selectShareIds").value+"&random="+Math.random(),"","dialogWidth=350px;dialogHeight=430px;status=no");

   if(typeof(returnArray) != 'undefined')
   {
     var selectClassIdStr=returnArray[0];
     if(typeof(selectClassIdStr) != 'undefined' && '' != selectClassIdStr  )
     {
   	   document.getElementById("selectShareIds").value=selectClassIdStr;
     }
     
     document.getElementById("shareCount").innerHTML=returnArray[1];
   }
}

</script>
</cms:SystemDataModel>
