Dotclear

Changeset 1155:49ba58cbf593 for admin


Ignore:
Timestamp:
04/09/13 09:15:41 (13 years ago)
Author:
Dsls <dsls@…>
Branch:
twig
Parents:
1154:e85c1417b8a4 (diff), 1143:fbf575ae9bda (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.
Message:

Merge with default

Location:
admin
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • admin/post.php

    r1139 r1155  
    1515dcPage::check('usage,contentadmin'); 
    1616 
    17 $post_id = ''; 
    18 $cat_id = ''; 
    19 $post_dt = ''; 
    20 $post_format = $core->auth->getOption('post_format'); 
    21 $post_password = ''; 
    22 $post_url = ''; 
    23 $post_lang = $core->auth->getInfo('user_lang'); 
    24 $post_title = ''; 
    25 $post_excerpt = ''; 
    26 $post_excerpt_xhtml = ''; 
    27 $post_content = ''; 
    28 $post_content_xhtml = ''; 
    29 $post_notes = ''; 
    30 $post_status = $core->auth->getInfo('user_post_status'); 
    31 $post_selected = false; 
    32 $post_open_comment = $core->blog->settings->system->allow_comments; 
    33 $post_open_tb = $core->blog->settings->system->allow_trackbacks; 
     17function savePost($form) { 
     18     global $_ctx; 
     19     $_ctx->setAlert('save'); 
     20 
     21} 
     22 
     23function deletePost($form) { 
     24     print_r($form); exit; 
     25} 
    3426 
    3527$page_title = __('New entry'); 
     
    4739# If user can't publish 
    4840if (!$can_publish) { 
    49      $post_status = -2; 
     41     $form->post_status = -2; 
    5042} 
    5143 
     
    5547     $categories = $core->blog->getCategories(array('post_type'=>'post')); 
    5648     while ($categories->fetch()) { 
    57           $categories_combo[] = new formSelectOption( 
    58                str_repeat('&nbsp;&nbsp;',$categories->level-1).($categories->level-1 == 0 ? '' : '&bull; ').html::escapeHTML($categories->cat_title), 
    59                $categories->cat_id 
    60           ); 
     49          $categories_combo[$categories->cat_id] =  
     50               str_repeat('&nbsp;&nbsp;',$categories->level-1). 
     51               ($categories->level-1 == 0 ? '' : '&bull; '). 
     52               html::escapeHTML($categories->cat_title); 
    6153     } 
    6254} catch (Exception $e) { } 
     
    6456# Status combo 
    6557foreach ($core->blog->getAllPostStatus() as $k => $v) { 
    66      $status_combo[$v] = (string) $k; 
     58     $status_combo[$k] = $v; 
    6759} 
    68 $img_status_pattern = '<img class="img_select_option" alt="%1$s" title="%1$s" src="images/%2$s" />'; 
    6960 
    7061# Formaters combo 
     
    8879unset($rs); 
    8980 
    90 # Validation flag 
    91 $bad_dt = false; 
    92  
     81$form = new dcForm($core,'post','post.php'); 
     82$form 
     83     ->addField( 
     84          new dcFieldText('post_title','', array( 
     85               'size'         => 20, 
     86               'required'     => true, 
     87               'label'        => __('Title')))) 
     88     ->addField( 
     89          new dcFieldTextArea('post_excerpt','', array( 
     90               'cols'         => 50, 
     91               'rows'         => 5, 
     92               'label'        => __("Excerpt:")))) 
     93     ->addField( 
     94          new dcFieldTextArea('post_content','', array( 
     95               'required'     => true, 
     96               'label'        => __("Content:")))) 
     97     ->addField( 
     98          new dcFieldTextArea('post_notes','', array( 
     99               'label'        => __("Notes")))) 
     100     ->addField( 
     101          new dcFieldSubmit('save',__('Save'),array( 
     102               'action' => 'savePost'))) 
     103     ->addField( 
     104          new dcFieldSubmit('delete',__('Delete'),array( 
     105               'action' => 'deletePost'))) 
     106     ->addField( 
     107          new dcFieldCombo('post_status',$core->auth->getInfo('user_post_status'),$status_combo,array( 
     108               'disabled' => !$can_publish, 
     109               'label' => __('Entry status:')))) 
     110     ->addField( 
     111          new dcFieldCombo('cat_id','',$categories_combo,array( 
     112               "label" => __('Category:')))) 
     113     ->addField( 
     114          new dcFieldText('post_dt','',array( 
     115               "label" => __('Published on:')))) 
     116     ->addField( 
     117          new dcFieldCombo('post_format',$core->auth->getOption('post_format'),$formaters_combo,array( 
     118               "label" => __('Text formating:')))) 
     119     ->addField( 
     120          new dcFieldCheckbox ('post_open_comment',$core->blog->settings->system->allow_comments,array( 
     121               "label" => __('Accept comments')))) 
     122     ->addField( 
     123          new dcFieldCheckbox ('post_open_tb',$core->blog->settings->system->allow_trackbacks,array( 
     124               "label" => __('Accept trackbacks')))) 
     125     ->addField( 
     126          new dcFieldCheckbox ('post_selected',false,array( 
     127               "label" => __('Selected entry')))) 
     128     ->addField( 
     129          new dcFieldCombo ('post_lang',$core->auth->getInfo('user_lang'),$lang_combo, array( 
     130               "label" => __('Entry lang:')))) 
     131     ->addField( 
     132          new dcFieldHidden ('id','')) 
     133; 
    93134# Get entry informations 
    94135if (!empty($_REQUEST['id'])) 
     
    105146     else 
    106147     { 
    107           $post_id = $post->post_id; 
    108           $cat_id = $post->cat_id; 
    109           $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 
    110           $post_format = $post->post_format; 
    111           $post_password = $post->post_password; 
    112           $post_url = $post->post_url; 
    113           $post_lang = $post->post_lang; 
    114           $post_title = $post->post_title; 
    115           $post_excerpt = $post->post_excerpt; 
    116           $post_excerpt_xhtml = $post->post_excerpt_xhtml; 
    117           $post_content = $post->post_content; 
    118           $post_content_xhtml = $post->post_content_xhtml; 
    119           $post_notes = $post->post_notes; 
    120           $post_status = $post->post_status; 
    121           $post_selected = (boolean) $post->post_selected; 
    122           $post_open_comment = (boolean) $post->post_open_comment; 
    123           $post_open_tb = (boolean) $post->post_open_tb; 
     148          $form->id = $post->post_id; 
     149          $form->cat_id = $post->cat_id; 
     150          $form->post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 
     151          $form->post_format = $post->post_format; 
     152          $form->post_password = $post->post_password; 
     153          $form->post_url = $post->post_url; 
     154          $form->post_lang = $post->post_lang; 
     155          $form->post_title = $post->post_title; 
     156          $form->post_excerpt = $post->post_excerpt; 
     157          $form->post_excerpt_xhtml = $post->post_excerpt_xhtml; 
     158          $form->post_content = $post->post_content; 
     159          $form->post_content_xhtml = $post->post_content_xhtml; 
     160          $form->post_notes = $post->post_notes; 
     161          $form->post_status = $post->post_status; 
     162          $form->post_selected = (boolean) $post->post_selected; 
     163          $form->post_open_comment = (boolean) $post->post_open_comment; 
     164          $form->post_open_tb = (boolean) $post->post_open_tb; 
     165          $form->can_edit_post = $post->isEditable(); 
     166          $form->can_delete= $post->isDeletable(); 
    124167           
    125           $page_title = __('Edit entry'); 
    126            
    127           $can_edit_post = $post->isEditable(); 
    128           $can_delete= $post->isDeletable(); 
    129            
    130           $next_rs = $core->blog->getNextPost($post,1); 
    131           $prev_rs = $core->blog->getNextPost($post,-1); 
    132            
    133           if ($next_rs !== null) { 
    134                $next_link = sprintf($post_link,$next_rs->post_id, 
    135                     html::escapeHTML($next_rs->post_title),__('next entry').'&nbsp;&#187;'); 
    136                $next_headlink = sprintf($post_headlink,'next', 
    137                     html::escapeHTML($next_rs->post_title),$next_rs->post_id); 
    138           } 
    139            
    140           if ($prev_rs !== null) { 
    141                $prev_link = sprintf($post_link,$prev_rs->post_id, 
    142                     html::escapeHTML($prev_rs->post_title),'&#171;&nbsp;'.__('previous entry')); 
    143                $prev_headlink = sprintf($post_headlink,'previous', 
    144                     html::escapeHTML($prev_rs->post_title),$prev_rs->post_id); 
    145           } 
    146            
    147           try { 
    148                $core->media = new dcMedia($core); 
    149           } catch (Exception $e) {} 
    150168     } 
    151169} 
    152170 
    153 # Format excerpt and content 
    154 if (!empty($_POST) && $can_edit_post) 
    155 { 
    156      $post_format = $_POST['post_format']; 
    157      $post_excerpt = $_POST['post_excerpt']; 
    158      $post_content = $_POST['post_content']; 
    159       
    160      $post_title = $_POST['post_title']; 
    161       
    162      $cat_id = (integer) $_POST['cat_id']; 
    163       
    164      if (isset($_POST['post_status'])) { 
    165           $post_status = (integer) $_POST['post_status']; 
    166      } 
    167       
    168      if (empty($_POST['post_dt'])) { 
    169           $post_dt = ''; 
    170      } else { 
    171           try 
    172           { 
    173                $post_dt = strtotime($_POST['post_dt']); 
    174                if ($post_dt == false || $post_dt == -1) { 
    175                     $bad_dt = true; 
    176                     throw new Exception(__('Invalid publication date')); 
    177                } 
    178                $post_dt = date('Y-m-d H:i',$post_dt); 
    179           } 
    180           catch (Exception $e) 
    181           { 
    182                $core->error->add($e->getMessage()); 
    183           } 
    184      } 
    185       
    186      $post_open_comment = !empty($_POST['post_open_comment']); 
    187      $post_open_tb = !empty($_POST['post_open_tb']); 
    188      $post_selected = !empty($_POST['post_selected']); 
    189      $post_lang = $_POST['post_lang']; 
    190      $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; 
    191       
    192      $post_notes = $_POST['post_notes']; 
    193       
    194      if (isset($_POST['post_url'])) { 
    195           $post_url = $_POST['post_url']; 
    196      } 
    197       
    198      $core->blog->setPostContent( 
    199           $post_id,$post_format,$post_lang, 
    200           $post_excerpt,$post_excerpt_xhtml,$post_content,$post_content_xhtml 
    201      ); 
    202 } 
    203  
    204 # Delete post 
    205 if (!empty($_POST['delete']) && $can_delete) 
    206 { 
    207      try { 
    208           # --BEHAVIOR-- adminBeforePostDelete 
    209           $core->callBehavior('adminBeforePostDelete',$post_id); 
    210           $core->blog->delPost($post_id); 
    211           http::redirect('posts.php'); 
    212      } catch (Exception $e) { 
    213           $core->error->add($e->getMessage()); 
    214      } 
    215 } 
    216  
    217 # Create or update post 
    218 if (!empty($_POST) && !empty($_POST['save']) && $can_edit_post && !$bad_dt) 
    219 { 
    220      $cur = $core->con->openCursor($core->prefix.'post'); 
    221       
    222      $cur->post_title = $post_title; 
    223      $cur->cat_id = ($cat_id ? $cat_id : null); 
    224      $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; 
    225      $cur->post_format = $post_format; 
    226      $cur->post_password = $post_password; 
    227      $cur->post_lang = $post_lang; 
    228      $cur->post_title = $post_title; 
    229      $cur->post_excerpt = $post_excerpt; 
    230      $cur->post_excerpt_xhtml = $post_excerpt_xhtml; 
    231      $cur->post_content = $post_content; 
    232      $cur->post_content_xhtml = $post_content_xhtml; 
    233      $cur->post_notes = $post_notes; 
    234      $cur->post_status = $post_status; 
    235      $cur->post_selected = (integer) $post_selected; 
    236      $cur->post_open_comment = (integer) $post_open_comment; 
    237      $cur->post_open_tb = (integer) $post_open_tb; 
    238       
    239      if (isset($_POST['post_url'])) { 
    240           $cur->post_url = $post_url; 
    241      } 
    242       
    243      # Update post 
    244      if ($post_id) 
    245      { 
    246           try 
    247           { 
    248                # --BEHAVIOR-- adminBeforePostUpdate 
    249                $core->callBehavior('adminBeforePostUpdate',$cur,$post_id); 
    250                 
    251                $core->blog->updPost($post_id,$cur); 
    252                 
    253                # --BEHAVIOR-- adminAfterPostUpdate 
    254                $core->callBehavior('adminAfterPostUpdate',$cur,$post_id); 
    255                 
    256                http::redirect('post.php?id='.$post_id.'&upd=1'); 
    257           } 
    258           catch (Exception $e) 
    259           { 
    260                $core->error->add($e->getMessage()); 
    261           } 
    262      } 
    263      else 
    264      { 
    265           $cur->user_id = $core->auth->userID(); 
    266            
    267           try 
    268           { 
    269                # --BEHAVIOR-- adminBeforePostCreate 
    270                $core->callBehavior('adminBeforePostCreate',$cur); 
    271                 
    272                $return_id = $core->blog->addPost($cur); 
    273                 
    274                # --BEHAVIOR-- adminAfterPostCreate 
    275                $core->callBehavior('adminAfterPostCreate',$cur,$return_id); 
    276                 
    277                http::redirect('post.php?id='.$return_id.'&crea=1'); 
    278           } 
    279           catch (Exception $e) 
    280           { 
    281                $core->error->add($e->getMessage()); 
    282           } 
    283      } 
    284 } 
     171$form->setup(); 
    285172 
    286173/* DISPLAY 
     
    294181} 
    295182 
    296 dcPage::open($page_title.' - '.__('Entries'), 
    297      dcPage::jsDatePicker(). 
    298      dcPage::jsToolBar(). 
    299      dcPage::jsModal(). 
    300      dcPage::jsMetaEditor(). 
    301      dcPage::jsLoad('js/_post.js'). 
    302      dcPage::jsConfirmClose('entry-form','comment-form'). 
    303      # --BEHAVIOR-- adminPostHeaders 
    304      $core->callBehavior('adminPostHeaders'). 
    305      dcPage::jsPageTabs($default_tab). 
    306      $next_headlink."\n".$prev_headlink 
    307 ); 
     183$_ctx 
     184     ->fillPageTitle(__('Entries'),'posts.php') 
     185     ->fillPageTitle($page_title) 
     186     ->default_tab = $default_tab; 
    308187 
    309 if (!empty($_GET['upd'])) { 
    310      dcPage::message(__('Entry has been successfully updated.')); 
    311 } 
    312 elseif (!empty($_GET['crea'])) { 
    313      dcPage::message(__('Entry has been successfully created.')); 
    314 } 
    315 elseif (!empty($_GET['attached'])) { 
    316      dcPage::message(__('File has been successfully attached.')); 
    317 } 
    318 elseif (!empty($_GET['rmattach'])) { 
    319      dcPage::message(__('Attachment has been successfully removed.')); 
    320 } 
    321  
    322 if (!empty($_GET['creaco'])) { 
    323      dcPage::message(__('Comment has been successfully created.')); 
    324 } 
    325  
    326 # XHTML conversion 
    327 if (!empty($_GET['xconv'])) 
    328 { 
    329      $post_excerpt = $post_excerpt_xhtml; 
    330      $post_content = $post_content_xhtml; 
    331      $post_format = 'xhtml'; 
    332       
    333      dcPage::message(__('Don\'t forget to validate your XHTML conversion by saving your post.')); 
    334 } 
    335  
    336 echo '<h2>'.html::escapeHTML($core->blog->name).' &rsaquo; '.'<a href="posts.php">'.__('Entries').'</a> &rsaquo; <span class="page-title">'.$page_title; 
    337 if ($post_id) { 
    338      switch ($post_status) { 
    339           case 1: 
    340                $img_status = sprintf($img_status_pattern,__('published'),'check-on.png'); 
    341                break; 
    342           case 0: 
    343                $img_status = sprintf($img_status_pattern,__('unpublished'),'check-off.png'); 
    344                break; 
    345           case -1: 
    346                $img_status = sprintf($img_status_pattern,__('scheduled'),'scheduled.png'); 
    347                break; 
    348           case -2: 
    349                $img_status = sprintf($img_status_pattern,__('pending'),'check-wrn.png'); 
    350                break; 
    351           default: 
    352                $img_status = ''; 
    353      } 
    354      echo ' &ldquo;'.$post_title.'&rdquo;'.' '.$img_status; 
    355 } 
    356 echo '</span></h2>'; 
    357  
    358 if ($post_id && $post->post_status == 1) { 
    359      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>'; 
    360 } 
    361 if ($post_id) 
    362 { 
    363      echo '<p>'; 
    364      if ($prev_link) { echo $prev_link; } 
    365      if ($next_link && $prev_link) { echo ' - '; } 
    366      if ($next_link) { echo $next_link; } 
    367       
    368      # --BEHAVIOR-- adminPostNavLinks 
    369      $core->callBehavior('adminPostNavLinks',isset($post) ? $post : null); 
    370       
    371      echo '</p>'; 
    372 } 
    373  
    374 # Exit if we cannot view page 
    375 if (!$can_view_page) { 
    376      dcPage::helpBlock('core_post'); 
    377      dcPage::close(); 
    378      exit; 
    379 } 
    380  
    381 /* Post form if we can edit post 
    382 -------------------------------------------------------- */ 
    383 if ($can_edit_post) 
    384 { 
    385      echo '<div class="multi-part" title="'.__('Edit entry').'" id="edit-entry">'; 
    386      echo '<form action="post.php" method="post" id="entry-form">'; 
    387      echo '<div id="entry-wrapper">'; 
    388      echo '<div id="entry-content"><div class="constrained">'; 
    389       
    390      echo 
    391      '<p class="col"><label class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:'). 
    392      form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). 
    393      '</label></p>'. 
    394       
    395      '<p class="area" id="excerpt-area"><label for="post_excerpt">'.__('Excerpt:').'</label> '. 
    396      form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 
    397      '</p>'. 
    398       
    399      '<p class="area"><label class="required" '. 
    400      'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. 
    401      form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 
    402      '</p>'. 
    403       
    404      '<p class="area" id="notes-area"><label for="post_notes">'.__('Notes:').'</label>'. 
    405      form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). 
    406      '</p>'; 
    407       
    408      # --BEHAVIOR-- adminPostForm 
    409      $core->callBehavior('adminPostForm',isset($post) ? $post : null); 
    410       
    411      echo 
    412      '<p>'. 
    413      ($post_id ? form::hidden('id',$post_id) : ''). 
    414      '<input type="submit" value="'.__('Save').' (s)" '. 
    415      'accesskey="s" name="save" /> '; 
    416      if ($post_id) { 
    417           $preview_url = 
    418           $core->blog->url.$core->url->getURLFor('preview',$core->auth->userID().'/'. 
    419           http::browserUID(DC_MASTER_KEY.$core->auth->userID().$core->auth->getInfo('user_pwd')). 
    420           '/'.$post->post_url); 
    421           echo '<a id="post-preview" href="'.$preview_url.'" class="button" accesskey="p">'.__('Preview').' (p)'.'</a> '; 
    422      } 
    423      echo 
    424      ($can_delete ? '<input type="submit" class="delete" value="'.__('Delete').'" name="delete" />' : ''). 
    425      $core->formNonce(). 
    426      '</p>'; 
    427       
    428      echo '</div></div>';          // End #entry-content 
    429      echo '</div>';      // End #entry-wrapper 
    430  
    431      echo '<div id="entry-sidebar">'; 
    432       
    433      echo 
    434      '<p><label for="cat_id">'.__('Category:'). 
    435      form::combo('cat_id',$categories_combo,$cat_id,'maximal'). 
    436      '</label></p>'. 
    437       
    438      '<p><label for="post_status">'.__('Entry status:'). 
    439      form::combo('post_status',$status_combo,$post_status,'','',!$can_publish). 
    440      '</label></p>'. 
    441       
    442      '<p><label for="post_dt">'.__('Published on:'). 
    443      form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). 
    444      '</label></p>'. 
    445       
    446      '<p><label for="post_format">'.__('Text formating:'). 
    447      form::combo('post_format',$formaters_combo,$post_format). 
    448      '</label>'. 
    449      '</p>'. 
    450      '<p>'.($post_id && $post_format != 'xhtml' ? '<a id="convert-xhtml" class="button" href="post.php?id='.$post_id.'&amp;xconv=1">'.__('Convert to XHTML').'</a>' : '').'</p>'. 
    451       
    452      '<p><label for="post_open_comment" class="classic">'.form::checkbox('post_open_comment',1,$post_open_comment).' '. 
    453      __('Accept comments').'</label></p>'. 
    454      ($core->blog->settings->system->allow_comments ?  
    455           (isContributionAllowed($post_id,strtotime($post_dt),true) ?  
    456                '' : 
    457                '<p class="form-note warn">'.__('Warning: Comments are not more accepted for this entry.').'</p>') :  
    458           '<p class="form-note warn">'.__('Warning: Comments are not accepted on this blog.').'</p>'). 
    459  
    460      '<p><label for="post_open_tb" class="classic">'.form::checkbox('post_open_tb',1,$post_open_tb).' '. 
    461      __('Accept trackbacks').'</label></p>'. 
    462      ($core->blog->settings->system->allow_trackbacks ?  
    463           (isContributionAllowed($post_id,strtotime($post_dt),false) ?  
    464                '' : 
    465                '<p class="form-note warn">'.__('Warning: Trackbacks are not more accepted for this entry.').'</p>') :  
    466           '<p class="form-note warn">'.__('Warning: Trackbacks are not accepted on this blog.').'</p>'). 
    467  
    468      '<p><label for="post_selected" class="classic">'.form::checkbox('post_selected',1,$post_selected).' '. 
    469      __('Selected entry').'</label></p>'. 
    470       
    471      '<p><label for="post_lang">'.__('Entry lang:'). 
    472      form::combo('post_lang',$lang_combo,$post_lang). 
    473      '</label></p>'. 
    474       
    475      '<p><label for="post_password">'.__('Entry password:'). 
    476      form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). 
    477      '</label></p>'. 
    478       
    479      '<div class="lockable">'. 
    480      '<p><label for="post_url">'.__('Basename:'). 
    481      form::field('post_url',10,255,html::escapeHTML($post_url),'maximal'). 
    482      '</label></p>'. 
    483      '<p class="form-note warn">'. 
    484      __('Warning: If you set the URL manually, it may conflict with another entry.'). 
    485      '</p>'. 
    486      '</div>'; 
    487       
    488      # --BEHAVIOR-- adminPostFormSidebar 
    489      $core->callBehavior('adminPostFormSidebar',isset($post) ? $post : null); 
    490       
    491      echo '</div>';      // End #entry-sidebar 
    492  
    493      echo '</form>'; 
    494       
    495      # --BEHAVIOR-- adminPostForm 
    496      $core->callBehavior('adminPostAfterForm',isset($post) ? $post : null); 
    497       
    498      echo '</div>'; 
    499       
    500      if ($post_id && $post->post_status == 1) { 
    501           echo '<p><a href="trackbacks.php?id='.$post_id.'" class="multi-part">'. 
    502           __('Ping blogs').'</a></p>'; 
    503      } 
    504       
    505 } 
    506  
    507  
    508 /* Comments and trackbacks 
    509 -------------------------------------------------------- */ 
    510 if ($post_id) 
    511 { 
    512      $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
    513       
    514      $comments = $core->blog->getComments(array_merge($params,array('comment_trackback'=>0))); 
    515      $trackbacks = $core->blog->getComments(array_merge($params,array('comment_trackback'=>1))); 
    516       
    517      # Actions combo box 
    518      $combo_action = array(); 
    519      if ($can_edit_post && $core->auth->check('publish,contentadmin',$core->blog->id)) 
    520      { 
    521           $combo_action[__('publish')] = 'publish'; 
    522           $combo_action[__('unpublish')] = 'unpublish'; 
    523           $combo_action[__('mark as pending')] = 'pending'; 
    524           $combo_action[__('mark as junk')] = 'junk'; 
    525      } 
    526       
    527      if ($can_edit_post && $core->auth->check('delete,contentadmin',$core->blog->id)) 
    528      { 
    529           $combo_action[__('Delete')] = 'delete'; 
    530      } 
    531       
    532      # --BEHAVIOR-- adminCommentsActionsCombo 
    533      $core->callBehavior('adminCommentsActionsCombo',array(&$combo_action)); 
    534       
    535      $has_action = !empty($combo_action) && (!$trackbacks->isEmpty() || !$comments->isEmpty()); 
    536       
    537      echo 
    538      '<div id="comments" class="multi-part" title="'.__('Comments').'">'; 
    539       
    540      if ($has_action) { 
    541           echo '<form action="comments_actions.php" id="form-comments" method="post">'; 
    542      } 
    543       
    544      echo '<h3>'.__('Trackbacks').'</h3>'; 
    545       
    546      if (!$trackbacks->isEmpty()) { 
    547           showComments($trackbacks,$has_action,true); 
    548      } else { 
    549           echo '<p>'.__('No trackback').'</p>'; 
    550      } 
    551       
    552      echo '<h3>'.__('Comments').'</h3>'; 
    553      if (!$comments->isEmpty()) { 
    554           showComments($comments,$has_action); 
    555      } else { 
    556           echo '<p>'.__('No comment').'</p>'; 
    557      } 
    558       
    559      if ($has_action) { 
    560           echo 
    561           '<div class="two-cols">'. 
    562           '<p class="col checkboxes-helpers"></p>'. 
    563            
    564           '<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '. 
    565           form::combo('action',$combo_action). 
    566           form::hidden('redir','post.php?id='.$post_id.'&amp;co=1'). 
    567           $core->formNonce(). 
    568           '<input type="submit" value="'.__('ok').'" /></p>'. 
    569           '</div>'. 
    570           '</form>'; 
    571      } 
    572       
    573      echo '</div>'; 
    574 } 
    575  
    576 /* Add a comment 
    577 -------------------------------------------------------- */ 
    578 if ($post_id) 
    579 { 
    580      echo 
    581      '<div class="multi-part" id="add-comment" title="'.__('Add a comment').'">'. 
    582      '<h3>'.__('Add a comment').'</h3>'. 
    583       
    584      '<form action="comment.php" method="post" id="comment-form">'. 
    585      '<div class="constrained">'. 
    586      '<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Name:'). 
    587      form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). 
    588      '</label></p>'. 
    589       
    590      '<p><label for="comment_email">'.__('Email:'). 
    591      form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). 
    592      '</label></p>'. 
    593       
    594      '<p><label for="comment_site">'.__('Web site:'). 
    595      form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). 
    596      '</label></p>'. 
    597       
    598      '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. 
    599      __('Comment:').'</label> '. 
    600      form::textarea('comment_content',50,8,html::escapeHTML('')). 
    601      '</p>'. 
    602       
    603      '<p>'.form::hidden('post_id',$post_id). 
    604      $core->formNonce(). 
    605      '<input type="submit" name="add" value="'.__('Save').'" /></p>'. 
    606      '</div>'. 
    607      '</form>'. 
    608      '</div>'; 
    609 } 
    610  
    611 # Controls comments or trakbacks capabilities 
    612 function isContributionAllowed($id,$dt,$com=true) 
    613 { 
    614      global $core; 
    615  
    616      if (!$id) { 
    617           return true; 
    618      } 
    619      if ($com) { 
    620           if (($core->blog->settings->system->comments_ttl == 0) ||  
    621                (time() - $core->blog->settings->system->comments_ttl*86400 < $dt)) { 
    622                return true; 
    623           } 
    624      } else { 
    625           if (($core->blog->settings->system->trackbacks_ttl == 0) ||  
    626                (time() - $core->blog->settings->system->trackbacks_ttl*86400 < $dt)) { 
    627                return true; 
    628           } 
    629      } 
    630      return false; 
    631 } 
    632  
    633 # Show comments or trackbacks 
    634 function showComments($rs,$has_action,$tb=false) 
    635 { 
    636      echo 
    637      '<table class="comments-list"><tr>'. 
    638      '<th colspan="2">'.__('Author').'</th>'. 
    639      '<th>'.__('Date').'</th>'. 
    640      '<th class="nowrap">'.__('IP address').'</th>'. 
    641      '<th>'.__('Status').'</th>'. 
    642      '<th>&nbsp;</th>'. 
    643      '</tr>'; 
    644       
    645      while($rs->fetch()) 
    646      { 
    647           $comment_url = 'comment.php?id='.$rs->comment_id; 
    648            
    649           $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 
    650           switch ($rs->comment_status) { 
    651                case 1: 
    652                     $img_status = sprintf($img,__('published'),'check-on.png'); 
    653                     break; 
    654                case 0: 
    655                     $img_status = sprintf($img,__('unpublished'),'check-off.png'); 
    656                     break; 
    657                case -1: 
    658                     $img_status = sprintf($img,__('pending'),'check-wrn.png'); 
    659                     break; 
    660                case -2: 
    661                     $img_status = sprintf($img,__('junk'),'junk.png'); 
    662                     break; 
    663           } 
    664            
    665           echo 
    666           '<tr class="line'.($rs->comment_status != 1 ? ' offline' : '').'"'. 
    667           ' id="c'.$rs->comment_id.'">'. 
    668            
    669           '<td class="nowrap">'. 
    670           ($has_action ? form::checkbox(array('comments[]'),$rs->comment_id,'','','',0,'title="'.($tb ? __('select this trackback') : __('select this comment')).'"') : '').'</td>'. 
    671           '<td class="maximal">'.html::escapeHTML($rs->comment_author).'</td>'. 
    672           '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$rs->comment_dt).'</td>'. 
    673           '<td class="nowrap"><a href="comments.php?ip='.$rs->comment_ip.'">'.$rs->comment_ip.'</a></td>'. 
    674           '<td class="nowrap status">'.$img_status.'</td>'. 
    675           '<td class="nowrap status"><a href="'.$comment_url.'">'. 
    676           '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /></a></td>'. 
    677            
    678           '</tr>'; 
    679      } 
    680       
    681      echo '</table>'; 
    682 } 
    683  
    684 dcPage::helpBlock('core_post','core_wiki'); 
    685 dcPage::close(); 
     188$core->tpl->display('post.html.twig'); 
    686189?> 
  • admin/style/default.css

    r1140 r1155  
    4040     margin-bottom: 0.6em; 
    4141} 
     42 
    4243h2 { 
    4344     color: #666; 
     
    5253     font-size: 1.2em; 
    5354} 
     55 
    5456p, div.p { 
    5557     margin: 0 0 1em 0; 
    5658} 
     59 
    5760hr { 
    5861     height: 1px; 
     
    6164     border-style: solid; 
    6265} 
     66 
    6367pre, code { 
    6468     font: 100% "Andale Mono","Courier New",monospace; 
     
    7781     cursor: help; 
    7882} 
     83 
    7984 
    8085/* LAYOUT 
     
    431436     color: #666; 
    432437} 
     438 
    433439#dashboard-items { 
    434440     float: left; 
     
    536542     height: 500px; 
    537543} 
     544 
    538545#add-file-f { 
    539546     position: relative; 
     
    619626     display: inline; 
    620627} 
     628 
    621629#default-favs h3 { 
    622630     margin-top: 2em; 
    623631     margin-bottom: 1em; 
    624632} 
     633 
    625634.fav-list { 
    626635     list-style-type: none; 
     
    915924     vertical-align: middle; 
    916925} 
     926 
    917927/* Si quelque chose a besoin d'être caché sauf pour les revues d'écran */ 
    918928.hidden { 
     
    949959     overflow: auto; 
    950960} 
     961 
    951962.grid { 
    952963     background: transparent repeat url('grid.png') 0 0; 
    953964} 
     965 
    954966.line p { 
    955967     margin: 0; 
     
    958970     color: #666; 
    959971} 
     972 
    960973ul.nice { 
    961974     margin: 1em 0; 
     
    10061019     margin-bottom: .5em; 
    10071020} 
    1008  
    10091021th, td { 
    10101022     border-width: 0 0 1px 0; 
     
    10211033     border-width: 0; 
    10221034} 
     1035 
    10231036table .maximal, table.maximal { 
    10241037     width: 100%; 
     
    10271040     width: 1px; 
    10281041} 
     1042 
    10291043table .nowrap { 
    10301044     white-space: nowrap; 
     
    11171131     font-weight: normal; 
    11181132} 
     1133 
    11191134input, textarea, select { 
    11201135     background: #f9f9f9; 
     
    11491164     background: transparent; 
    11501165} 
     1166 
    11511167label { 
    11521168     display: block; 
     
    11941210     resize: vertical; 
    11951211} 
     1212 
    11961213label.required { 
    11971214     font-weight: bold; 
     
    12181235     top: 0; 
    12191236} 
     1237 
    12201238label .maximal, textarea.maximal, input.maximal { 
    12211239     width: 100%; 
     
    12321250     padding-left: 20px; 
    12331251} 
     1252 
     1253a#toggle-filters { 
     1254     font-weight: bold; 
     1255     background: url(../images/plus.png) no-repeat 0 0; 
     1256     padding-left: 20px; 
     1257} 
     1258 
     1259a#toggle-filters.opened { 
     1260     background: url(../images/minus.png) no-repeat 0 0; 
     1261} 
     1262 
    12341263.constrained { 
    12351264     margin: 0; 
     
    13511380     background-color: #2373A8; 
    13521381} 
    1353  
    13541382/* jQuery Autocomplete plugin */ 
    13551383.ac_results { 
     
    13841412     color: white; 
    13851413} 
     1414 
     1415form#filters {font-size: 100%; background: #f0f0f0; padding: 1em; border-radius: .5em; border: 1px solid #ddd;} 
     1416form#filters .margintop {padding-top: 1.33em;} 
     1417form#filters ul, form#filters p {list-style-type:none;margin: 0; padding: 0 0 .5em 0; margin-left: 1em;} 
     1418form#filters .col30 {border-left: 1px solid #999;} 
     1419form#filters .col30 h3 {margin-left: 1em;} 
     1420 
     1421p.line, li.line { position: relative; padding: 3px 0 0 28px; margin: 0 0 1em 0;} 
     1422li.line input[type=submit] {position: absolute; left:0;top:0; padding: 0 .1em; margin: 0;} 
     1423li.line input[type=checkbox], li.line input[type=checkbox] {position: absolute; left: 0; top: .2em; padding: 0 .1em; margin: 0;} 
     1424li.line select { margin-right: 2em;} 
     1425li.line label { display: block; width: 8em; float: left;} 
     1426li.line label img {margin-right: 8px;} 
     1427li.line span.or { 
     1428     text-align: right; 
     1429     margin-left: 5em; 
     1430     font-weight: bold; 
     1431} 
     1432p.line label.or + select {margin-left: 2em;} 
     1433li.line { padding: 0 0 0 20px; height: 1em;} 
     1434li.line label {width: auto;} 
     1435 
     1436#available_filters input[type=submit] {padding: 0 .1em; margin-left: .5em;} 
     1437 
     1438div.pagination span, div.pagination a { 
     1439     margin-right: 1em; 
     1440} 
  • admin/style/default.css

    r1147 r1155  
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    1212*/ 
     13 
     14/* ------------------------------------------------------------------ html */ 
    1315body { 
    1416     font: 75%/1.5em Helvetica,Arial,sans-serif; 
     
    151153     height: 2em; 
    152154} 
     155#info-box1 p { 
     156     margin: 0; 
     157     display: inline; 
     158} 
    153159#info-box1 select { 
    154160     width: 15em; 
     
    193199} 
    194200#content { 
    195      margin: 1.5em 1.5em 4em 13em; 
     201     margin: 1.5em 1.5em .5em 13em; 
    196202     padding: 1em; 
    197203     background: #fff; 
    198      -webkit-border-radius: .5em; 
    199      -moz-border-radius: .5em; 
    200204     border-radius: .5em; 
    201205     border: 1px solid #ddd; 
     
    255259     background: #dfdfdf; 
    256260     text-decoration: none; 
    257      -webkit-border-top-left-radius: .3em; 
    258      -webkit-border-top-right-radius: .3em; 
    259      -moz-border-radius-topleft: .3em; 
    260      -moz-border-radius-topright: .3em; 
    261261     border-top-left-radius: .3em; 
    262262     border-top-right-radius: .3em; 
     
    282282     float: left; 
    283283     margin-top: 1.2em; 
    284      margin-bottom: 1em; 
     284     margin-bottom: .5em; 
    285285} 
    286286#main-menu h3 { 
     
    302302     padding: .2em 0 0 32px; 
    303303     background-repeat: no-repeat; 
    304      background-position: 12px .2em; 
     304     background-position: 12px .4em; 
    305305} 
    306306#main-menu a { 
     
    340340#footer { 
    341341     clear: both; 
    342      padding: .75em 2em; 
    343      margin: 6em 15px .5em 15px; 
    344      -webkit-border-radius: .3em; 
    345      -moz-border-radius: .3em; 
    346      border-radius: .3em; 
    347      background: #575859 url(dc_logo_small.png) no-repeat right bottom; 
    348      color: #fff; 
     342     padding: .75em .75em 0 0; 
     343     text-align: right; 
    349344} 
    350345#footer p { 
     
    355350} 
    356351#footer a { 
    357      color: #f5f5f5; 
    358352} 
    359353#footer p span.credit { 
     
    378372     border: 1px solid #999; 
    379373     padding: 1em 1em 0 1em; 
    380      -moz-border-radius: 4px; 
    381      -webkit-border-radius: 4px; 
    382374     border-radius: 4px; 
    383375} 
     
    513505     border: 1px solid #ccc; 
    514506     border-left: 1em solid #E5E3DA; 
    515      -moz-border-radius: .3em; 
    516      -webkit-border-radius: .3em; 
    517507     border-radius: .3em; 
    518508} 
     
    668658     border: 1px solid #ddd; 
    669659     padding: .2em; 
    670      -moz-border-radius: .5em; 
    671      -webkit-border-radius: .5em; 
    672660     border-radius: .5em; 
    673661} 
     
    764752     border: 1px solid #f3f3f3; 
    765753     cursor: pointer; 
    766      -moz-border-radius: 4px; 
    767      -webkit-border-radius: 4px; 
    768754     border-radius: 4px; 
    769755} 
     
    804790} 
    805791#help-button { 
    806      position: absolute; 
    807      top: 6.2em; 
     792     position: fixed; 
     793     top: 3.2em; 
    808794     right: 0px; 
    809795     cursor: pointer; 
     
    815801     text-transform: capitalize; 
    816802     padding: .33em .75em .33em 1em; 
    817      -moz-border-radius: 1em 0 0 1em; 
    818      -webkit-border-top-left-radius: 1em; 
    819      -webkit-border-bottom-left-radius: 1em; 
     803     border-radius: 1em 0 0 1em; 
    820804     color: #444; 
    821805} 
     
    879863div.message, p.message,  
    880864div.static-msg, p.static-msg { 
    881      padding: 0.5em 0.5em 0.5em 40px; 
     865     padding: 0.5em 0.5em 0.5em 48px; 
    882866     margin-bottom: 1em; 
    883      -moz-border-radius: 8px; 
    884      -webkit-border-radius: 8px; 
    885867     border-radius: 8px; 
    886868} 
     
    890872} 
    891873div.error, p.error { 
    892      background: #e5bfbf url(msg-error.png) no-repeat 5px 5px; 
    893      color: #600; 
     874     background: #ffdec8 url(msg-error.png) no-repeat .7em .7em; 
     875     color: #000; 
    894876} 
    895877div.message, p.message,  
    896878div.static-msg, p.static-msg { 
    897      background: #666 url(msg-std.png) no-repeat 5px 5px; 
     879     background: #666 url(msg-std.png) no-repeat .7em .7em; 
    898880     color: #fff; 
    899881} 
     
    1015997     right: 0; 
    1016998} 
     999.distrib img { 
     1000     display: block; 
     1001     float: right; 
     1002     margin-top: -1em; 
     1003} 
    10171004/* TABLES 
    10181005-------------------------------------------------------- */ 
     
    10411028th { 
    10421029     text-align: left; 
     1030     border-bottom-color: #666; 
    10431031} 
    10441032.noborder td, td.noborder, .noborder th, th.noborder { 
     
    10561044     white-space: nowrap; 
    10571045     vertical-align: top; 
     1046} 
     1047table.settings, table.prefs { 
     1048     width: 80%; 
     1049} 
     1050table.settings th:first-child, table.prefs th:first-child { 
     1051     width: 20%; 
     1052} 
     1053table.settings th + th, table.prefs th + th { 
     1054     width: 30%; 
     1055} 
     1056table.settings th + th + th, table.prefs th + th + th { 
     1057     width: 10%; 
     1058} 
     1059table.settings th:last-child, table.prefs th:last-child { 
     1060     width: 40%; 
    10581061} 
    10591062 
     
    11361139     border-color: #000 #ccc #ccc #000; 
    11371140} 
     1141input.invalid, textarea.invalid, select.invalid { 
     1142     border: 1px solid red; 
     1143     background: #fff;  
     1144     color: red; 
     1145     box-shadow: 0 0 0 1px rgba(218, 62, 90, 0.3) 
     1146} 
    11381147input, textarea, select, option { 
    11391148     font: 1em "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif; 
     
    11671176     color: #666; 
    11681177} 
     1178span.form-note { 
     1179     font-style:italic; 
     1180     font-weight: normal; 
     1181     color: #666; 
     1182} 
    11691183p.form-note.warn, p.form-note.info, p.warning { 
    11701184     font-style: normal; 
     
    11721186} 
    11731187p.form-note.warn, p.warning { 
    1174      background: #ffd url(warning.png) no-repeat .2em .2em; 
     1188     background: #ffd url(warning.png) no-repeat .3em .3em; 
    11751189     border: 1px solid #f0c020; 
    11761190} 
    11771191p.form-note.info { 
    1178      background: #eef url(info.png) no-repeat .2em .2em; 
     1192     background: #eef url(info.png) no-repeat .3em .2em; 
    11791193     border: 1px solid #99f; 
    11801194} 
     
    12091223p.field { 
    12101224     position: relative; 
    1211  
     1225      
    12121226} 
    12131227p.field label { 
     
    12751289     padding: .1em .5em 0 .5em; 
    12761290     text-shadow: 0 1px 1px rgba(0,0,0,.3); 
    1277      -webkit-border-radius: .2em; 
    1278      -moz-border-radius: .2em; 
    12791291     border-radius: .2em; 
    12801292     margin-bottom: .1em; 
     
    13581370} 
    13591371a.button.add { 
    1360      -webkit-border-radius: .5em; 
    1361      -moz-border-radius: .5em; 
    13621372     border-radius: .5em; 
    13631373     margin-bottom: .1em;      
    1364      background: #2C8FD1 url(add.png) no-repeat 6px center; 
     1374     background: #2C8FD1 url(../images/add.png) no-repeat 6px center; 
    13651375     color: #fff; 
    13661376     padding: .2em 16px .2em 30px; 
     
    13691379a.button.add:hover, a.button.add:focus { 
    13701380     background-color: #2373A8; 
     1381} 
     1382/* jQuery Autocomplete plugin */ 
     1383.ac_results { 
     1384     padding: 0px; 
     1385     border: 1px dotted #f90; 
     1386     background-color: white; 
     1387     overflow: hidden; 
     1388     z-index: 99999; 
     1389} 
     1390.ac_results ul { 
     1391     width: 100%; 
     1392     list-style-position: outside; 
     1393     list-style: none; 
     1394     padding: 0; 
     1395     margin: 0; 
     1396} 
     1397.ac_results li { 
     1398     margin: 0px; 
     1399     padding: 2px 5px; 
     1400     cursor: default; 
     1401     display: block; 
     1402     font: menu; 
     1403     font-size: 1em; 
     1404     line-height: 16px; 
     1405     overflow: hidden; 
     1406} 
     1407.ac_loading { 
     1408     background: transparent url('loader.gif') right center no-repeat; 
     1409} 
     1410.ac_over { 
     1411     background-color: #06c; 
     1412     color: white; 
    13711413} 
    13721414 
Note: See TracChangeset for help on using the changeset viewer.

Sites map