Changeset 3402:8681798c6491
- Timestamp:
- 11/11/16 00:10:02 (9 years ago)
- Branch:
- default
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/blogs.php
r3400 r3402 13 13 require dirname(__FILE__).'/../inc/admin/prepend.php'; 14 14 15 dcPage::check ('usage,contentadmin');15 dcPage::checkSuper(); 16 16 17 17 # Filters … … 22 22 23 23 $sortby_combo = array( 24 __('Last update') => 'blog_upddt',25 __('Blog name') => 'UPPER(blog_name)',26 __('Blog ID') => 'B.blog_id',27 __('Status') => 'blog_status'24 __('Last update') => 'blog_upddt', 25 __('Blog name') => 'UPPER(blog_name)', 26 __('Blog ID') => 'B.blog_id', 27 __('Status') => 'blog_status' 28 28 ); 29 29 30 30 $order_combo = array( 31 __('Descending') => 'desc',32 __('Ascending') => 'asc'31 __('Descending') => 'desc', 32 __('Ascending') => 'asc' 33 33 ); 34 34 35 # Actions 36 $blogs_actions_page = new dcBlogsActionsPage($core,$core->adminurl->get("admin.blogs")); 37 38 if ($blogs_actions_page->process()) { 39 return; 40 } 41 42 # Requests 35 43 $q = !empty($_GET['q']) ? $_GET['q'] : ''; 36 44 $status = isset($_GET['status']) ? $_GET['status'] : ''; … … 88 96 $rsStatic->lexicalSort(($sortby == 'UPPER(blog_name)' ? 'blog_name' : 'blog_id'),$order); 89 97 } 98 $blog_list = new adminBlogList($core,$rs,$counter->f(0)); 90 99 } catch (Exception $e) { 91 100 $core->error->add($e->getMessage()); … … 96 105 97 106 dcPage::open(__('List of blogs'), 98 dcPage::js FilterControl($show_filters),107 dcPage::jsLoad('js/_blogs.js').dcPage::jsFilterControl($show_filters), 99 108 dcPage::breadcrumb( 100 109 array( … … 103 112 )) 104 113 ); 105 106 if (!empty($_GET['del'])) {107 dcPage::success(__('Blog has been successfully deleted.'));108 }109 114 110 115 if (!$core->error->flag()) … … 143 148 144 149 # Show blogs 145 if ($nb_blog == 0) 146 { 147 if( $show_filters ) { 148 echo '<p><strong>'.__('No blog matches the filter').'</strong></p>'; 149 } else { 150 echo '<p><strong>'.__('No blog').'</strong></p>'; 151 } 152 } 153 else 154 { 155 $pager = new dcPager($page,$nb_blog,$nb_per_page,10); 150 $blog_list->display($page,$nb_per_page, 151 '<form action="'.$core->adminurl->get("admin.blogs").'" method="post" id="form-blogs">'. 156 152 157 echo $pager->getLinks();153 '%s'. 158 154 159 echo 160 '<div class="table-outer">'. 161 '<table class="clear">'; 155 '<div class="two-cols">'. 156 '<p class="col checkboxes-helpers"></p>'. 162 157 163 if( $show_filters ) { 164 echo '<caption>'.sprintf(__('%d blog matches the filter.','%d blogs match the filter.',$nb_blog),$nb_blog).'</caption>'; 165 } else { 166 echo '<caption class="hidden">'.__('Blogs list').'</caption>'; 167 } 158 '<p class="col right"><label for="action" class="classic">'.__('Selected blogs action:').'</label> '. 159 form::combo('action',$blogs_actions_page->getCombo(),'online','','','','title="'.__('Actions').'"'). 160 $core->formNonce(). 161 '<input id="do-action" type="submit" value="'.__('ok').'" /></p>'. 162 form::hidden(array('sortby'),$sortby). 163 form::hidden(array('order'),$order). 164 form::hidden(array('status'),$status). 165 form::hidden(array('page'),$page). 166 form::hidden(array('nb'),$nb_per_page). 167 '</div>'. 168 168 169 echo 170 '<tr>'. 171 '<th scope="col" class="nowrap">'.__('Blog id').'</th>'. 172 '<th scope="col">'.__('Blog name').'</th>'. 173 '<th scope="col" class="nowrap">'.__('URL').'</th>'. 174 '<th scope="col" class="nowrap">'.__('Entries (all types)').'</th>'. 175 '<th scope="col" class="nowrap">'.__('Last update').'</th>'. 176 '<th scope="col" class="nowrap">'.__('Status').'</th>'. 177 '</tr>'; 169 '<div>'. 170 '<p>'.__('Please give your password to confirm the blog deletion.').'</p>'. 171 '<p><label for="pwd">'.__('Your password:').'</label> '. 172 form::password('pwd',20,255).'</p>'. 173 '</div>'. 178 174 179 while ($rsStatic->fetch()) { 180 echo blogLine($rsStatic); 181 } 175 '</form>', 176 $show_filters 177 ); 178 } 182 179 183 echo '</table></div>';184 185 echo $pager->getLinks();186 }187 }188 180 dcPage::helpBlock('core_blogs'); 189 181 dcPage::close(); 190 191 function blogLine($rs)192 {193 global $core;194 195 $blog_id = html::escapeHTML($rs->blog_id);196 $edit_link = '';197 198 if ($GLOBALS['core']->auth->isSuperAdmin()) {199 $edit_link =200 '<a href="'.$core->adminurl->get("admin.blog",array('id' => $blog_id)).'" title="'.sprintf(__('Edit blog settings for %s'),$blog_id).'">'.201 '<img src="images/edit-mini.png" alt="'.__('Edit blog settings').'" /> '.$blog_id.'</a> ';202 } else {203 $edit_link = $blog_id;204 }205 206 $img_status = $rs->blog_status == 1 ? 'check-on' : ($rs->blog_status == 0 ? 'check-off' : 'check-wrn');207 $txt_status = $GLOBALS['core']->getBlogStatus($rs->blog_status);208 $img_status = sprintf('<img src="images/%1$s.png" alt="%2$s" title="%2$s" />',$img_status,$txt_status);209 $offset = dt::getTimeOffset($core->auth->getInfo('user_tz'));210 $blog_upddt = dt::str(__('%Y-%m-%d %H:%M'),strtotime($rs->blog_upddt) + $offset);211 212 return213 '<tr class="line">'.214 '<td class="nowrap">'.$edit_link.'</td>'.215 '<td class="maximal"><a href="'.$core->adminurl->get("admin.home",array('switchblog' => $rs->blog_id)).'" '.216 'title="'.sprintf(__('Switch to blog %s'),$rs->blog_id).'">'.217 html::escapeHTML($rs->blog_name).'</a></td>'.218 '<td class="nowrap"><a class="outgoing" href="'.html::escapeHTML($rs->blog_url).'">'.html::escapeHTML($rs->blog_url).219 ' <img src="images/outgoing-blue.png" alt="" /></a></td>'.220 '<td class="nowrap count">'.$core->countBlogPosts($rs->blog_id).'</td>'.221 '<td class="nowrap count">'.$blog_upddt.'</td>'.222 '<td class="status">'.$img_status.'</td>'.223 '</tr>';224 } -
inc/admin/lib.pager.php
r3265 r3402 662 662 } 663 663 664 class adminBlogList extends adminGenericList 665 { 666 public function display($page,$nb_per_page,$enclose_block='',$filter=false) 667 { 668 if ($this->rs->isEmpty()) 669 { 670 if($filter) { 671 echo '<p><strong>'.__('No blog matches the filter').'</strong></p>'; 672 } else { 673 echo '<p><strong>'.__('No blog').'</strong></p>'; 674 } 675 } 676 else 677 { 678 $blogs = array(); 679 if (isset($_REQUEST['blogs'])) { 680 foreach ($_REQUEST['blogs'] as $v) { 681 $blogs[$v]=true; 682 } 683 } 684 685 $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); 686 687 $cols = array( 688 'blog' => '<th colspan="2" scope="col" abbr="comm" class="first nowrap">'.__('Blog id').'</th>', 689 'name' => '<th scope="col" abbr="name">'.__('Blog name').'</th>', 690 'url' => '<th scope="col" class="nowrap">'.__('URL').'</th>', 691 'posts' => '<th scope="col" class="nowrap">'.__('Entries (all types)').'</th>', 692 'upddt' => '<th scope="col" class="nowrap">'.__('Last update').'</th>', 693 'status' => '<th scope="col" class="txt-center">'.__('Status').'</th>' 694 ); 695 696 $cols = new ArrayObject($cols); 697 $this->core->callBehavior('adminBlogListHeader',$this->core,$this->rs,$cols); 698 699 $html_block = 700 '<div class="table-outer"><table>'. 701 ($filter ? 702 '<caption>'. 703 sprintf(__('%d blog matches the filter.','%d blogs match the filter.',$this->rs_count),$this->rs_count). 704 '</caption>' 705 : 706 '<caption class="hidden">'.__('Blogs list').'</caption>' 707 ). 708 '<tr>'.implode(iterator_to_array($cols)).'</tr>%s</table></div>'; 709 710 if ($enclose_block) { 711 $html_block = sprintf($enclose_block,$html_block); 712 } 713 714 $blocks = explode('%s',$html_block); 715 716 echo $pager->getLinks(); 717 718 echo $blocks[0]; 719 720 while ($this->rs->fetch()) { 721 echo $this->blogLine(isset($blogs[$this->rs->blog_id])); 722 } 723 724 echo $blocks[1]; 725 726 echo $pager->getLinks(); 727 } 728 } 729 730 private function blogLine($checked=false) 731 { 732 $blog_id = html::escapeHTML($this->rs->blog_id); 733 734 $cols = array( 735 'check' => 736 '<td class="nowrap">'. 737 form::checkbox(array('blogs[]'),$this->rs->blog_id,$checked,'','',0). 738 '</td>', 739 'blog' => 740 '<td class="nowrap">'. 741 '<a href="'.$this->core->adminurl->get("admin.blog",array('id' => $blog_id)).'" '. 742 'title="'.sprintf(__('Edit blog settings for %s'),$blog_id).'">'. 743 '<img src="images/edit-mini.png" alt="'.__('Edit blog settings').'" /> '.$blog_id.'</a> '. 744 '</td>', 745 'name' => 746 '<td class="maximal">'. 747 '<a href="'.$this->core->adminurl->get("admin.home",array('switchblog' => $this->rs->blog_id)).'" '. 748 'title="'.sprintf(__('Switch to blog %s'),$this->rs->blog_id).'">'. 749 html::escapeHTML($this->rs->blog_name).'</a>'. 750 '</td>', 751 'url' => 752 '<td class="nowrap">'. 753 '<a class="outgoing" href="'. 754 html::escapeHTML($this->rs->blog_url).'">'.html::escapeHTML($this->rs->blog_url). 755 ' <img src="images/outgoing-blue.png" alt="" /></a></td>', 756 'posts' => 757 '<td class="nowrap count">'. 758 $this->core->countBlogPosts($this->rs->blog_id). 759 '</td>', 760 'upddt' => 761 '<td class="nowrap count">'. 762 dt::str(__('%Y-%m-%d %H:%M'),strtotime($this->rs->blog_upddt) + dt::getTimeOffset($this->core->auth->getInfo('user_tz'))). 763 '</td>', 764 'status' => 765 '<td class="nowrap status txt-center">'. 766 sprintf( 767 '<img src="images/%1$s.png" alt="%2$s" title="%2$s" />', 768 ($this->rs->blog_status == 1 ? 'check-on' : ($this->rs->blog_status == 0 ? 'check-off' : 'check-wrn')), 769 $this->core->getBlogStatus($this->rs->blog_status) 770 ). 771 '</td>' 772 ); 773 774 $cols = new ArrayObject($cols); 775 $this->core->callBehavior('adminBlogListValue',$this->core,$this->rs,$cols); 776 777 return 778 '<tr class="line" id="b'.$blog_id.'">'. 779 implode(iterator_to_array($cols)). 780 '</tr>'; 781 } 782 } 783 664 784 class adminUserList extends adminGenericList 665 785 { -
inc/core/class.dc.core.php
r3400 r3402 1017 1017 } 1018 1018 1019 if (!empty($params['blog_status']) && $this->auth->isSuperAdmin()) { 1020 $where = 'AND blog_status = '.(integer) $params['blog_status'].' '; 1021 } 1022 1023 if (!empty($params['blog_id'])) { 1024 $where .= "AND B.blog_id = '".$this->con->escape($params['blog_id'])."' "; 1019 if (isset($params['blog_status']) && $params['blog_status'] !== '' && $this->auth->isSuperAdmin()) { 1020 $where .= 'AND blog_status = '.(integer) $params['blog_status'].' '; 1021 } 1022 1023 if (isset($params['blog_id']) && $params['blog_id'] !== '') { 1024 if (!is_array($params['blog_id'])) { 1025 $params['blog_id'] = array($params['blog_id']); 1026 } 1027 $where .= 'AND B.blog_id '.$this->con->in($params['blog_id']); 1025 1028 } 1026 1029 -
inc/prepend.php
r3388 r3402 68 68 $__autoload['adminPostMiniList'] = dirname(__FILE__).'/admin/lib.pager.php'; 69 69 $__autoload['adminCommentList'] = dirname(__FILE__).'/admin/lib.pager.php'; 70 $__autoload['adminBlogList'] = dirname(__FILE__).'/admin/lib.pager.php'; 70 71 $__autoload['adminUserList'] = dirname(__FILE__).'/admin/lib.pager.php'; 71 72 $__autoload['dcPager'] = dirname(__FILE__).'/admin/lib.pager.php'; … … 77 78 $__autoload['dcPostsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactionposts.php'; 78 79 $__autoload['dcCommentsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactioncomments.php'; 80 $__autoload['dcBlogsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactionblogs.php'; 79 81 $__autoload['dcActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcaction.php'; 80 82
Note: See TracChangeset
for help on using the changeset viewer.