<!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="Content-Type" content="text/html; charset={$CONFIG[charset]}" />
<title>投稿_个人专栏_{$SYSTEM[sitename]}</title>
	<link href="{IMG_URL}templates/{TEMPLATE}/css/style.css" type="text/css" rel="stylesheet" rev="stylesheet" media="screen"  />
	<link href="{IMG_URL}templates/{TEMPLATE}/css/content.css" type="text/css" rel="stylesheet" rev="stylesheet" media="screen"  />
	<!--[if IE 6]> 
		<link href="{IMG_URL}templates/{TEMPLATE}/css/ie6.css" type="text/css" rel="stylesheet" rev="stylesheet" media="screen"  />
	<![endif]-->
	<link href="{IMG_URL}templates/{TEMPLATE}/css/dialog.css" rel="stylesheet" type="text/css" />
<link href="{IMG_URL}js/lib/jquery-ui/dialog.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{IMG_URL}js/config.js"></script>
<script type="text/javascript" src="{IMG_URL}js/lib/jquery.js"></script>
<script type="text/javascript" src="{IMG_URL}js/lib/jquery.form.js"></script>
<script type="text/javascript" src="{IMG_URL}js/tiny_mce/tiny_mce.js"></script>
</head>
<body class="person-theme">
<div class="person-wrap">
    <?php $menu['space'] = 'class="person-current"'; $this->assign('menu',$menu); ?>
    <!--{template 'member/panel/header.html'}-->
    <div class="clear"></div>
    <div class="person-cont">
        <div class="hr-h10"></div>
        <form action="{url('space/panel/contribute')}" method="POST" name="member_contribute" id="member_contribute">
            <input type="hidden" name="status" id="status" value="3"/>
            <ul class="formFormat">
                <li>
                    <span class="info f-l">标题：</span><input type="text" class="input-text f-l" value="" id="title" name="title" size="50"/>
                    <em class="warn"></em></li>
                <li>
                    <span class="info f-l">正文：</span><textarea name="content" id="content" style="width: 590px; height: 355px;"></textarea>
                    <span class="info f-l"></span><em class="warn"></em></li>
                <li>
                    <span class="info f-l">关键词:</span><input type="text" name="tags" value="" size="60" class="input-text age f-l"/><span class="f-l f-warn">多个关键词请用空格隔开</span>
                </li>
                <li><span class="info f-l">栏目：</span><?=element::check_category('catid', 'catid', $catid);?></li>
                <li class="ok-wrap"><input type="submit" id="sub" name="submit" value="投稿" class="zl-btn zl-ok f-l"/>
                    <input type="submit" id="draft" class="f-l save-cg" value="保存草稿"/></li>
            </ul>
        </form>
    </div>
</div>
<div class="hr-h10"></div>
<script type="text/javascript">
tinyMCE.init({
    // General options
    mode : "exact",
    theme : "advanced",
    elements : "content",
    language : "ch",
    pagebreak_separator : "<!-- my page break -->",
    convert_urls : false,
    plugins :
"safari,pagebreak,style,advimage,advlink,insertdatetime,preview,searchreplace,contextmenu,paste,template,inlinepopups,onekeyclear,fullscreen,media,insertimage,wordcount",
    // Theme options
    theme_advanced_buttons1 :
"undo,bold,italic,underline,fontsizeselect,forecolor,|,link,unlink,|,justifyleft,justifycentr,justifyright,|,image,media",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",

    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : false,
    // Example content CSS (should be your site CSS)
    content_css : "css/content.css",
    extended_valid_elements : "a[class|name|href|target|title|onclick|rel],script[type|src],iframe[src|style|width|height|scrolling|marginwidth|marginheight|frameborder],img[class|src|border=0|width|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],$elements",
    setup : function(ed){
         ed.onPostProcess.add(function(ed, o) {
            o.content = o.content.replace(/<br><br>/ig,'</p><p>');
         });
    }
});
$(document).ready(function() {
	$('#sub').click(function(){
		$('#status').val(3);
	});
	$('#draft').click(function(){
		$('#status').val(1);
	});
    $('#member_contribute').submit(function() {
        $('#content').val(tinyMCE.activeEditor.getContent());
        $(this).ajaxSubmit({
            success: function(json) {
                var isDraft = $('#status').val() == 1;
                if (json && json.state) {
                    alert(isDraft ? '草稿保存成功' : '您的稿件已提交至本站编辑，请等待审核');
                    location.href = "{url('space/panel/submitted')}";
                } else {
                    alert(json && json.error || (isDraft ? '保存失败' : '提交失败，请重试'));
                }
            },
            dataType:'json',
            beforeSubmit :function(){
                if(! $.trim($('#title').val())) {
                    alert('请填写标题');
                    return false;
                }
                if(! $.trim($('#content').val())) {
                    alert('内容不能为空');
                    return false;
                }
                if(! $('#catid').val()) {
                    alert('请选择栏目');
                    return false;
                }
                return true;
            }
        });
        return false;
    });
	<!--{loop $channel $v}-->
		$('#catid option[value="{$v[catid]}"]').attr("disabled", "disabled");
	<!--{/loop}-->
});
</script>
<!--{template 'system/footer.html'}-->