Changeset 1620:542c321dc040 for admin/post.php
- Timestamp:
- 08/30/13 10:37:08 (12 years ago)
- Branch:
- default
- Parents:
- 1619:5d925866b5b3 (diff), 1593:0c884219a872 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/post.php
r1537 r1620 50 50 } 51 51 52 # Getting categories 53 $categories_combo = array(' ' => ''); 54 try { 55 $categories = $core->blog->getCategories(array('post_type'=>'post')); 56 while ($categories->fetch()) { 57 $categories_combo[] = new formSelectOption( 58 str_repeat(' ',$categories->level-1).($categories->level-1 == 0 ? '' : '• ').html::escapeHTML($categories->cat_title), 59 $categories->cat_id 60 ); 61 } 62 } catch (Exception $e) { } 63 52 64 # Status combo 53 65 foreach ($core->blog->getAllPostStatus() as $k => $v) { … … 82 94 if (!empty($_REQUEST['id'])) 83 95 { 96 $page_title = __('Edit entry'); 97 84 98 $params['post_id'] = $_REQUEST['id']; 85 99 … … 111 125 $post_open_tb = (boolean) $post->post_open_tb; 112 126 113 $page_title = __('Edit entry');114 115 127 $can_edit_post = $post->isEditable(); 116 128 $can_delete= $post->isDeletable(); … … 121 133 if ($next_rs !== null) { 122 134 $next_link = sprintf($post_link,$next_rs->post_id, 123 html::escapeHTML($next_rs->post_title),__(' next entry').' »');135 html::escapeHTML($next_rs->post_title),__('Next entry').' »'); 124 136 $next_headlink = sprintf($post_headlink,'next', 125 137 html::escapeHTML($next_rs->post_title),$next_rs->post_id); … … 128 140 if ($prev_rs !== null) { 129 141 $prev_link = sprintf($post_link,$prev_rs->post_id, 130 html::escapeHTML($prev_rs->post_title),'« '.__(' previous entry'));142 html::escapeHTML($prev_rs->post_title),'« '.__('Previous entry')); 131 143 $prev_headlink = sprintf($post_headlink,'previous', 132 144 html::escapeHTML($prev_rs->post_title),$prev_rs->post_id); … … 316 328 } 317 329 330 if ($post_id) { 331 switch ($post_status) { 332 case 1: 333 $img_status = sprintf($img_status_pattern,__('Published'),'check-on.png'); 334 break; 335 case 0: 336 $img_status = sprintf($img_status_pattern,__('Unpublished'),'check-off.png'); 337 break; 338 case -1: 339 $img_status = sprintf($img_status_pattern,__('Scheduled'),'scheduled.png'); 340 break; 341 case -2: 342 $img_status = sprintf($img_status_pattern,__('Pending'),'check-wrn.png'); 343 break; 344 default: 345 $img_status = ''; 346 } 347 $edit_entry_str = __('“%s”'); 348 $page_title_edit = sprintf($edit_entry_str, html::escapeHTML($post_title)).' '.$img_status; 349 } else { 350 $img_status = ''; 351 } 352 353 318 354 dcPage::open($page_title.' - '.__('Entries'), 319 355 dcPage::jsDatePicker(). … … 326 362 $core->callBehavior('adminPostHeaders'). 327 363 dcPage::jsPageTabs($default_tab). 328 $next_headlink."\n".$prev_headlink 364 $next_headlink."\n".$prev_headlink, 365 dcPage::breadcrumb( 366 array( 367 html::escapeHTML($core->blog->name) => '', 368 __('Entries') => 'posts.php', 369 '<span class="page-title">'.($post_id ? $page_title_edit : $page_title).'</span>' => '' 370 )) 329 371 ); 330 372 331 373 if (!empty($_GET['upd'])) { 332 dcPage:: message(__('Entry has been successfully updated.'));374 dcPage::success(__('Entry has been successfully updated.')); 333 375 } 334 376 elseif (!empty($_GET['crea'])) { 335 dcPage:: message(__('Entry has been successfully created.'));377 dcPage::success(__('Entry has been successfully created.')); 336 378 } 337 379 elseif (!empty($_GET['attached'])) { 338 dcPage:: message(__('File has been successfully attached.'));380 dcPage::success(__('File has been successfully attached.')); 339 381 } 340 382 elseif (!empty($_GET['rmattach'])) { 341 dcPage:: message(__('Attachment has been successfully removed.'));383 dcPage::success(__('Attachment has been successfully removed.')); 342 384 } 343 385 344 386 if (!empty($_GET['creaco'])) { 345 dcPage:: message(__('Comment has been successfully created.'));387 dcPage::success(__('Comment has been successfully created.')); 346 388 } 347 389 … … 356 398 } 357 399 358 echo '<h2>'.html::escapeHTML($core->blog->name).' › '.'<a href="posts.php">'.__('Entries').'</a> › <span class="page-title">';359 if ($post_id) {360 switch ($post_status) {361 case 1:362 $img_status = sprintf($img_status_pattern,__('published'),'check-on.png');363 break;364 case 0:365 $img_status = sprintf($img_status_pattern,__('unpublished'),'check-off.png');366 break;367 case -1:368 $img_status = sprintf($img_status_pattern,__('scheduled'),'scheduled.png');369 break;370 case -2:371 $img_status = sprintf($img_status_pattern,__('pending'),'check-wrn.png');372 break;373 default:374 $img_status = '';375 }376 $edit_entry_str = __('Edit entry “%s”');377 echo sprintf($edit_entry_str, html::escapeHTML($post_title)).' '.$img_status;378 } else {379 echo $page_title;380 }381 echo '</span></h2>';382 383 400 if ($post_id && $post->post_status == 1) { 384 echo '<p><a href="'.$post->getURL().'" onclick="window.open(this.href);return false;" title="'.$post_title.' ('.__('new window').')'.'">'.__('Go to this entry on the site').' <img src="images/outgoing-blue.png" alt="" /></a></p>';401 echo '<p><a class="onblog_link" href="'.$post->getURL().'" onclick="window.open(this.href);return false;" title="'.$post_title.' ('.__('new window').')'.'">'.__('Go to this entry on the site').' <img src="images/outgoing-blue.png" alt="" /></a></p>'; 385 402 } 386 403 if ($post_id) 387 404 { 388 echo '<p >';405 echo '<p class="nav_prevnext">'; 389 406 if ($prev_link) { echo $prev_link; } 390 if ($next_link && $prev_link) { echo ' -'; }407 if ($next_link && $prev_link) { echo ' | '; } 391 408 if ($next_link) { echo $next_link; } 392 409 … … 403 420 exit; 404 421 } 405 406 422 /* Post form if we can edit post 407 423 -------------------------------------------------------- */ 408 424 if ($can_edit_post) 409 425 { 410 echo '<div class="multi-part" title="'.__('Edit entry').'" id="edit-entry">'; 426 $sidebar_items = new ArrayObject(array( 427 'status-box' => array( 428 'title' => __('Status'), 429 'items' => array( 430 'post_status' => 431 '<p class="entry-status"><label for="post_status" class="ib">'.__('Entry status').' '.$img_status.'</label>'. 432 form::combo('post_status',$status_combo,$post_status,'maximal','',!$can_publish). 433 '</p>', 434 'post_dt' => 435 '<p><label for="post_dt" class="ib">'.__('Publication date and hour').'</label>'. 436 form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). 437 '</p>', 438 'post_lang' => 439 '<p><label for="post_lang" class="ib">'.__('Entry lang').'</label>'. 440 form::combo('post_lang',$lang_combo,$post_lang). 441 '</p>', 442 'post_format' => 443 '<div>'. 444 '<h5 id="label_format"><label for="post_format" class="ib">'.__('Text formating').'</label></h5>'. 445 '<p>'.form::combo('post_format',$formaters_combo,$post_format,'maximal'). 446 '</p>'. 447 '<p>'.($post_id && $post_format != 'xhtml' ? 448 '<a id="convert-xhtml" class="button maximal" href="post.php?id='.$post_id.'&xconv=1">'. 449 __('Convert to XHTML').'</a>' : '').'</p></div>')), 450 'metas-box' => array( 451 'title' => __('Ordering'), 452 'items' => array( 453 'post_selected' => 454 '<p><label for="post_selected" class="classic">'. 455 form::checkbox('post_selected',1,$post_selected).' '. 456 __('Selected entry').'</label></p>', 457 'cat_id' => 458 '<p><label for="cat_id" class="ib">'.__('Category').'</label>'. 459 form::combo('cat_id',$categories_combo,$cat_id,'maximal'). 460 '</p>'. 461 ($core->auth->check('categories', $core->blog->id) ? 462 '<div>'. 463 '<h5 id="create_cat">'.__('Add a new category').'</h5>'. 464 '<p><label for="new_cat_title">'.__('Title:').' '. 465 form::field('new_cat_title',30,255,'','maximal').'</label></p>'. 466 '<p><label for="new_cat_parent">'.__('Parent:').' '. 467 form::combo('new_cat_parent',$categories_combo,'','maximal'). 468 '</label></p>'. 469 '</div>' 470 : ''))), 471 'options-box' => array( 472 'title' => __('Options'), 473 'items' => array( 474 'post_open_comment' => 475 '<p><label for="post_open_comment" class="classic">'. 476 form::checkbox('post_open_comment',1,$post_open_comment).' '. 477 __('Accept comments').'</label></p>'. 478 ($core->blog->settings->system->allow_comments ? 479 (isContributionAllowed($post_id,strtotime($post_dt),true) ? 480 '' : 481 '<p class="form-note warn">'. 482 __('Warning: Comments are not more accepted for this entry.').'</p>') : 483 '<p class="form-note warn">'. 484 __('Warning: Comments are not accepted on this blog.').'</p>'), 485 'post_open_tb' => 486 '<p><label for="post_open_tb" class="classic">'. 487 form::checkbox('post_open_tb',1,$post_open_tb).' '. 488 __('Accept trackbacks').'</label></p>'. 489 ($core->blog->settings->system->allow_trackbacks ? 490 (isContributionAllowed($post_id,strtotime($post_dt),false) ? 491 '' : 492 '<p class="form-note warn">'. 493 __('Warning: Trackbacks are not more accepted for this entry.').'</p>') : 494 '<p class="form-note warn">'.__('Warning: Trackbacks are not accepted on this blog.').'</p>'), 495 'post_password' => 496 '<p><label for="post_password" class="ib">'.__('Password').'</label>'. 497 form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). 498 '</p>', 499 'post_url' => 500 '<div class="lockable">'. 501 '<p><label for="post_url" class="ib">'.__('Edit basename').'</label>'. 502 form::field('post_url',10,255,html::escapeHTML($post_url),'maximal'). 503 '</p>'. 504 '<p class="form-note warn">'. 505 __('Warning: If you set the URL manually, it may conflict with another entry.'). 506 '</p></div>' 507 )))); 508 509 $main_items = new ArrayObject(array( 510 "post_title" => 511 '<p class="col">'. 512 '<label class="required no-margin"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:').'</label>'. 513 form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). 514 '</p>', 515 516 "post_excerpt" => 517 '<p class="area" id="excerpt-area"><label for="post_excerpt">'.__('Excerpt:').'<span class="form-note">'. 518 __('Add an introduction to the post.').'</span></label> '. 519 form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 520 '</p>', 521 522 "post_content" => 523 '<p class="area"><label class="required" '. 524 'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. 525 form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 526 '</p>', 527 528 "post_notes" => 529 '<p class="area" id="notes-area"><label for="post_notes">'.__('Personal notes:').'<span class="form-note">'. 530 __('Add unpublished notes.').'</span></label>'. 531 form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). 532 '</p>' 533 ) 534 ); 535 536 # --BEHAVIOR-- adminPostFormItems 537 $core->callBehavior('adminPostFormItems',$main_items,$sidebar_items, isset($post) ? $post : null); 538 539 echo '<div class="multi-part" title="'.($post_id ? __('Edit entry') : __('New entry')).'" id="edit-entry">'; 411 540 echo '<form action="post.php" method="post" id="entry-form">'; 412 541 echo '<div id="entry-wrapper">'; 413 542 echo '<div id="entry-content"><div class="constrained">'; 543 544 echo '<h3 class="hidden">'.__('Edit post').'</h3>'; 545 546 foreach ($main_items as $id => $item) { 547 echo $item; 548 } 549 550 # --BEHAVIOR-- adminPostForm (may be deprecated) 551 $core->callBehavior('adminPostForm',isset($post) ? $post : null); 414 552 415 553 echo 416 '<p class="col"><label class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:'). 417 form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). 418 '</label></p>'. 419 420 '<p class="area" id="excerpt-area"><label for="post_excerpt">'.__('Excerpt:').'</label> '. 421 form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 422 '</p>'. 423 424 '<p class="area"><label class="required" '. 425 'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. 426 form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 427 '</p>'. 428 429 '<p class="area" id="notes-area"><label for="post_notes">'.__('Notes:').'</label>'. 430 form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). 431 '</p>'; 432 433 # --BEHAVIOR-- adminPostForm 434 $core->callBehavior('adminPostForm',isset($post) ? $post : null); 435 436 echo 437 '<p>'. 554 '<p class="border-top">'. 438 555 ($post_id ? form::hidden('id',$post_id) : ''). 439 556 '<input type="submit" value="'.__('Save').' (s)" '. … … 460 577 echo '<div id="entry-sidebar">'; 461 578 462 echo 463 '<p><label for="cat_id">'.__('Category:'). 464 form::combo('cat_id',$categories_combo,$cat_id,'maximal'). 465 '</label></p>'. 466 467 ($core->auth->check('categories', $core->blog->id) ? 468 '<div>'. 469 '<p id="new_cat">'.__('Add a new category').'</p>'. 470 '<p class="form-note info clear">'.__('This category will be created when you will save your post.').'</p>'. 471 '<p><label for="new_cat_title">'.__('Title:').' '. 472 form::field('new_cat_title',30,255,'','maximal').'</label></p>'. 473 '<p><label for="new_cat_parent">'.__('Parent:').' '. 474 form::combo('new_cat_parent',$categories_combo,'','maximal'). 475 '</label></p>'. 476 '</div>' 477 : ''). 478 479 '<p><label for="post_status">'.__('Entry status:'). 480 form::combo('post_status',$status_combo,$post_status,'','',!$can_publish). 481 '</label></p>'. 482 483 '<p><label for="post_dt">'.__('Published on:'). 484 form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). 485 '</label></p>'. 486 487 '<p><label for="post_format">'.__('Text formating:'). 488 form::combo('post_format',$formaters_combo,$post_format). 489 '</label>'. 490 '</p>'. 491 '<p>'.($post_id && $post_format != 'xhtml' ? '<a id="convert-xhtml" class="button" href="post.php?id='.$post_id.'&xconv=1">'.__('Convert to XHTML').'</a>' : '').'</p>'. 492 493 '<p><label for="post_open_comment" class="classic">'.form::checkbox('post_open_comment',1,$post_open_comment).' '. 494 __('Accept comments').'</label></p>'. 495 ($core->blog->settings->system->allow_comments ? 496 (isContributionAllowed($post_id,strtotime($post_dt),true) ? 497 '' : 498 '<p class="form-note warn">'.__('Warning: Comments are not more accepted for this entry.').'</p>') : 499 '<p class="form-note warn">'.__('Warning: Comments are not accepted on this blog.').'</p>'). 500 501 '<p><label for="post_open_tb" class="classic">'.form::checkbox('post_open_tb',1,$post_open_tb).' '. 502 __('Accept trackbacks').'</label></p>'. 503 ($core->blog->settings->system->allow_trackbacks ? 504 (isContributionAllowed($post_id,strtotime($post_dt),false) ? 505 '' : 506 '<p class="form-note warn">'.__('Warning: Trackbacks are not more accepted for this entry.').'</p>') : 507 '<p class="form-note warn">'.__('Warning: Trackbacks are not accepted on this blog.').'</p>'). 508 509 '<p><label for="post_selected" class="classic">'.form::checkbox('post_selected',1,$post_selected).' '. 510 __('Selected entry').'</label></p>'. 511 512 '<p><label for="post_lang">'.__('Entry lang:'). 513 form::combo('post_lang',$lang_combo,$post_lang). 514 '</label></p>'. 515 516 '<p><label for="post_password">'.__('Entry password:'). 517 form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). 518 '</label></p>'. 519 520 '<div class="lockable">'. 521 '<p><label for="post_url">'.__('Basename:'). 522 form::field('post_url',10,255,html::escapeHTML($post_url),'maximal'). 523 '</label></p>'. 524 '<p class="form-note warn">'. 525 __('Warning: If you set the URL manually, it may conflict with another entry.'). 526 '</p>'. 527 '</div>'; 528 529 # --BEHAVIOR-- adminPostFormSidebar 579 foreach ($sidebar_items as $id => $c) { 580 echo '<div id="'.$id.'" class="box">'. 581 '<h4>'.$c['title'].'</h4>'; 582 foreach ($c['items'] as $e_name=>$e_content) { 583 echo $e_content; 584 } 585 echo '</div>'; 586 } 587 588 589 # --BEHAVIOR-- adminPostFormSidebar (may be deprecated) 530 590 $core->callBehavior('adminPostFormSidebar',isset($post) ? $post : null); 531 532 591 echo '</div>'; // End #entry-sidebar 533 592 … … 560 619 if ($can_edit_post && $core->auth->check('publish,contentadmin',$core->blog->id)) 561 620 { 562 $combo_action[__(' publish')] = 'publish';563 $combo_action[__(' unpublish')] = 'unpublish';564 $combo_action[__(' mark as pending')] = 'pending';565 $combo_action[__(' mark as junk')] = 'junk';621 $combo_action[__('Publish')] = 'publish'; 622 $combo_action[__('Unpublish')] = 'unpublish'; 623 $combo_action[__('Mark as pending')] = 'pending'; 624 $combo_action[__('Mark as junk')] = 'junk'; 566 625 } 567 626 … … 571 630 } 572 631 632 echo 633 '<div id="comments" class="multi-part" title="'.__('Comments').'">'; 634 573 635 # --BEHAVIOR-- adminCommentsActionsCombo 574 636 $core->callBehavior('adminCommentsActionsCombo',array(&$combo_action)); 575 637 576 638 $has_action = !empty($combo_action) && (!$trackbacks->isEmpty() || !$comments->isEmpty()); 577 578 echo 579 '<div id="comments" class="multi-part" title="'.__('Comments').'">'; 639 echo 640 '<p class="top-add"><a class="button add onblog_link" href="#comment-form">'.__('Add a comment').'</a></p>'; 580 641 581 642 if ($has_action) { 582 echo '<form action="comments_actions.php" id="form-comments" method="post" >';583 } 584 585 echo '<h3 >'.__('Trackbacks').'</h3>';643 echo '<form action="comments_actions.php" id="form-comments" method="post" class="clear">'; 644 } 645 646 echo '<h3 class="clear">'.__('Trackbacks').'</h3>'; 586 647 587 648 if (!$trackbacks->isEmpty()) { … … 611 672 '</form>'; 612 673 } 613 614 echo '</div>'; 615 } 616 617 /* Add a comment 618 -------------------------------------------------------- */ 619 if ($post_id) 620 { 674 /* Add a comment 675 -------------------------------------------------------- */ 676 621 677 echo 622 '<div class=" multi-part" id="add-comment" title="'.__('Add a comment').'">'.678 '<div class="fieldset clear">'. 623 679 '<h3>'.__('Add a comment').'</h3>'. 624 680 625 681 '<form action="comment.php" method="post" id="comment-form">'. 626 682 '<div class="constrained">'. 627 '<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Name:'). 683 '<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Name:').'</label>'. 628 684 form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). 629 '</ label></p>'.630 631 '<p><label for="comment_email">'.__('Email:'). 685 '</p>'. 686 687 '<p><label for="comment_email">'.__('Email:').'</label>'. 632 688 form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). 633 '</ label></p>'.634 635 '<p><label for="comment_site">'.__('Web site:'). 689 '</p>'. 690 691 '<p><label for="comment_site">'.__('Web site:').'</label>'. 636 692 form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). 637 '</ label></p>'.693 '</p>'. 638 694 639 695 '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. … … 645 701 $core->formNonce(). 646 702 '<input type="submit" name="add" value="'.__('Save').'" /></p>'. 647 '</div>'. 703 '</div>'. #constrained 704 648 705 '</form>'. 649 '</div>'; 706 '</div>'. #add comment 707 '</div>'; #comments 650 708 } 651 709 … … 677 735 echo 678 736 '<table class="comments-list"><tr>'. 679 '<th colspan="2" >'.__('Author').'</th>'.737 '<th colspan="2" class="first">'.__('Author').'</th>'. 680 738 '<th>'.__('Date').'</th>'. 681 739 '<th class="nowrap">'.__('IP address').'</th>'. 682 740 '<th>'.__('Status').'</th>'. 683 '<th> </th>'.741 '<th>'.__('Edit').'</th>'. 684 742 '</tr>'; 685 743 … … 691 749 switch ($rs->comment_status) { 692 750 case 1: 693 $img_status = sprintf($img,__(' published'),'check-on.png');751 $img_status = sprintf($img,__('Published'),'check-on.png'); 694 752 break; 695 753 case 0: 696 $img_status = sprintf($img,__(' unpublished'),'check-off.png');754 $img_status = sprintf($img,__('Unpublished'),'check-off.png'); 697 755 break; 698 756 case -1: 699 $img_status = sprintf($img,__(' pending'),'check-wrn.png');757 $img_status = sprintf($img,__('Pending'),'check-wrn.png'); 700 758 break; 701 759 case -2: 702 $img_status = sprintf($img,__(' junk'),'junk.png');760 $img_status = sprintf($img,__('Junk'),'junk.png'); 703 761 break; 704 762 } … … 715 773 '<td class="nowrap status">'.$img_status.'</td>'. 716 774 '<td class="nowrap status"><a href="'.$comment_url.'">'. 717 '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /> </a></td>'.775 '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /> '.__('Edit').'</a></td>'. 718 776 719 777 '</tr>'; … … 723 781 } 724 782 725 dcPage::helpBlock('core_post','core_ wiki');783 dcPage::helpBlock('core_post','core_trackbacks','core_wiki'); 726 784 dcPage::close(); 727 785 ?> -
admin/post.php
r1619 r1620 147 147 try { 148 148 $core->media = new dcMedia($core); 149 } catch (Exception $e) {} 149 } catch (Exception $e) { 150 $core->error->add($e->getMessage()); 151 } 150 152 } 151 153 }
Note: See TracChangeset
for help on using the changeset viewer.