123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- <?php defined('InShopNC') or exit('Access Invalid!');?>
- <div class="page">
- <div class="fixed-bar">
- <div class="item-title">
- <h3><?php echo $lang['article_index_manage'];?></h3>
- <ul class="tab-base">
- <li><a href="index.php?act=article&op=article"><span><?php echo $lang['nc_manage'];?></span></a></li>
- <li><a href="index.php?act=article&op=article_add"><span><?php echo $lang['nc_new'];?></span></a></li>
- <li><a href="JavaScript:void(0);" class="current"><span><?php echo $lang['nc_edit'];?></span></a></li>
- </ul>
- </div>
- </div>
- <div class="fixed-empty"></div>
- <form id="article_form" method="post">
- <input type="hidden" name="form_submit" value="ok" />
- <input type="hidden" name="article_id" value="<?php echo $output['article_array']['article_id'];?>" />
- <input type="hidden" name="ref_url" value="<?php echo getReferer();?>" />
- <table class="table tb-type2">
- <tbody>
- <tr class="noborder">
- <td colspan="2" class="required"><label class="validation" for="article_title"><?php echo $lang['article_index_title'];?>:</label></td>
- </tr>
- <tr class="noborder">
- <td class="vatop rowform"><input type="text" value="<?php echo $output['article_array']['article_title'];?>" name="article_title" id="article_title" class="txt"></td>
- <td class="vatop tips"></td>
- </tr>
- <tr>
- <td colspan="2" class="required"><label class="validation" for="cate_id"><?php echo $lang['article_add_class'];?>:</label></td>
- </tr>
- <tr class="noborder">
- <td class="vatop rowform"><select name="ac_id" id="ac_id">
- <option value=""><?php echo $lang['nc_please_choose'];?>...</option>
- <?php if(!empty($output['parent_list']) && is_array($output['parent_list'])){ ?>
- <?php foreach($output['parent_list'] as $k => $v){ ?>
- <option <?php if($output['article_array']['ac_id'] == $v['ac_id']){ ?>selected='selected'<?php } ?> value="<?php echo $v['ac_id'];?>"><?php echo $v['ac_name'];?></option>
- <?php } ?>
- <?php } ?>
- </select></td>
- <td class="vatop tips"></td>
- </tr>
- <tr>
- <td colspan="2" class="required"><label for="article_url"><?php echo $lang['article_add_url'];?>:</label></td>
- </tr>
- <tr class="noborder">
- <td class="vatop rowform"><input type="text" value="<?php echo $output['article_array']['article_url'];?>" name="article_url" id="article_url" class="txt"></td>
- <td class="vatop tips"><?php echo $lang['article_add_url_tip'];?></td>
- </tr>
- <tr>
- <td colspan="2" class="required"><label for="if_show"><?php echo $lang['article_add_show'];?>:</label></td>
- </tr>
- <tr class="noborder">
- <td class="vatop rowform onoff"><label for="article_show1" class="cb-enable <?php if($output['article_array']['article_show'] == '1'){ ?>selected<?php } ?>" ><span><?php echo $lang['nc_yes'];?></span></label>
- <label for="article_show0" class="cb-disable <?php if($output['article_array']['article_show'] == '0'){ ?>selected<?php } ?>" ><span><?php echo $lang['nc_no'];?></span></label>
- <input id="article_show1" name="article_show" <?php if($output['article_array']['article_show'] == '1'){ ?>checked="checked"<?php } ?> value="1" type="radio">
- <input id="article_show0" name="article_show" <?php if($output['article_array']['article_show'] == '0'){ ?>checked="checked"<?php } ?> value="0" type="radio"></td>
- <td class="vatop tips"></td>
- </tr>
- <tr>
- <td colspan="2" class="required"><?php echo $lang['nc_sort'];?>:</td>
- </tr>
- <tr class="noborder">
- <td class="vatop rowform"><input type="text" value="<?php echo $output['article_array']['article_sort'];?>" name="article_sort" id="article_sort" class="txt"></td>
- <td class="vatop tips"></td>
- </tr>
- <tr>
- <td colspan="2" class="required"><label class="validation"><?php echo $lang['article_add_content'];?>:</label></td>
- </tr>
- <tr class="noborder">
- <td colspan="2" class="vatop rowform"><?php showEditor('article_content',$output['article_array']['article_content']);?></td>
- </tr>
- <tr>
- <td colspan="2" class="required"><?php echo $lang['article_add_upload'];?>:</td>
- </tr>
- <tr class="noborder">
- <td colspan="3" id="divComUploadContainer"><input type="file" multiple="multiple" id="fileupload" name="fileupload" /></td>
- </tr>
- <tr>
- <td colspan="2" class="required"><?php echo $lang['article_add_uploaded'];?>:</td>
- </tr>
- <tr class="noborder">
- <td colspan="2"><ul id="thumbnails" class="thumblists">
- <?php if(is_array($output['file_upload'])){?>
- <?php foreach($output['file_upload'] as $k => $v){ ?>
- <li id="<?php echo $v['upload_id'];?>" class="picture" >
- <input type="hidden" name="file_id[]" value="<?php echo $v['upload_id'];?>" />
- <div class="size-64x64"><span class="thumb"><i></i><img src="<?php echo $v['upload_path'];?>" alt="<?php echo $v['file_name'];?>" onload="javascript:DrawImage(this,64,64);"/></span></div>
- <p><span><a href="javascript:insert_editor('<?php echo $v['upload_path'];?>');"><?php echo $lang['article_add_insert'];?></a></span><span><a href="javascript:del_file_upload('<?php echo $v['upload_id'];?>');"><?php echo $lang['nc_del'];?></a></span></p>
- </li>
- <?php } ?>
- <?php } ?>
- </ul></td>
- </tr>
- </tbody>
- <tfoot>
- <tr class="tfoot">
- <td colspan="15" ><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span><?php echo $lang['nc_submit'];?></span></a></td>
- </tr>
- </tfoot>
- </table>
- </form>
- </div>
- <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/fileupload/jquery.iframe-transport.js" charset="utf-8"></script>
- <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/fileupload/jquery.ui.widget.js" charset="utf-8"></script>
- <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/fileupload/jquery.fileupload.js" charset="utf-8"></script>
- <script>
- //按钮先执行验证再提交表单
- $(function(){$("#submitBtn").click(function(){
- if($("#article_form").valid()){
- $("#article_form").submit();
- }
- });
- });
- //
- $(document).ready(function(){
- $('#article_form').validate({
- errorPlacement: function(error, element){
- error.appendTo(element.parent().parent().prev().find('td:first'));
- },
- rules : {
- article_title : {
- required : true
- },
- ac_id : {
- required : true
- },
- article_url : {
- url : true
- },
- article_content : {
- required : true
- },
- article_sort : {
- number : true
- }
- },
- messages : {
- article_title : {
- required : '<?php echo $lang['article_add_title_null'];?>'
- },
- ac_id : {
- required : '<?php echo $lang['article_add_class_null'];?>'
- },
- article_url : {
- url : '<?php echo $lang['article_add_url_wrong'];?>'
- },
- article_content : {
- required : '<?php echo $lang['article_add_content_null'];?>'
- },
- article_sort : {
- number : '<?php echo $lang['article_add_sort_int'];?>'
- }
- }
- });
- // 图片上传
- $('#fileupload').each(function(){
- $(this).fileupload({
- dataType: 'json',
- url: 'index.php?act=article&op=article_pic_upload&item_id=<?php echo $output['article_array']['article_id'];?>',
- done: function (e,data) {
- if(data != 'error'){
- add_uploadedfile(data.result);
- }
- }
- });
- });
- });
- function add_uploadedfile(file_data)
- {
- var newImg = '<li id="' + file_data.file_id + '" class="picture"><input type="hidden" name="file_id[]" value="' + file_data.file_id + '" /><div class="size-64x64"><span class="thumb"><i></i><img src="<?php echo UPLOAD_SITE_URL.'/'.ATTACH_ARTICLE.'/';?>' + file_data.file_name + '" alt="' + file_data.file_name + '" width="64px" height="64px"/></span></div><p><span><a href="javascript:insert_editor(\'<?php echo UPLOAD_SITE_URL.'/'.ATTACH_ARTICLE.'/';?>' + file_data.file_name + '\');"><?php echo $lang['article_add_insert'];?></a></span><span><a href="javascript:del_file_upload(' + file_data.file_id + ');"><?php echo $lang['nc_del'];?></a></span></p></li>';
- $('#thumbnails').prepend(newImg);
- }
- function insert_editor(file_path){
- KE.appendHtml('article_content', '<img src="'+ file_path + '" alt="'+ file_path + '">');
- }
- function del_file_upload(file_id)
- {
- if(!window.confirm('<?php echo $lang['nc_ensure_del'];?>')){
- return;
- }
- $.getJSON('index.php?act=article&op=ajax&branch=del_file_upload&file_id=' + file_id, function(result){
- if(result){
- $('#' + file_id).remove();
- }else{
- alert('<?php echo $lang['article_add_del_fail'];?>');
- }
- });
- }
- </script>
|