Changeset 1414:ce67e9c592b7 for admin
- Timestamp:
- 08/16/13 15:48:37 (12 years ago)
- Branch:
- twig
- Location:
- admin
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/index.php
r1413 r1414 304 304 } 305 305 306 $_ctx-> fillPageTitle(__('Dashboard'));306 $_ctx->setBreadCrumb(__('Dashboard').' : '.html::escapeHTML($core->blog->name), false); 307 307 $core->tpl->display('index.html.twig'); 308 308 ?> -
admin/js/_post.js
r1280 r1414 127 127 fn: function() { excerptTb.switchMode(formatField.value); }, 128 128 cookie: 'dcx_post_excerpt', 129 hide: $('#post_excerpt').val() == '' 129 hide: $('#post_excerpt').val() == '', 130 legend_click: true 130 131 }); 131 132 -
admin/plugin.php
r1413 r1414 90 90 # No plugin or content found 91 91 if (!$has_content) { 92 $_ctx-> fillPageTitle(__('Plugin not found'));92 $_ctx->setBreadcrumb(__('Plugin not found')); 93 93 $_ctx->addError(__('The plugin you reached does not exist or does not have an admin page.')); 94 94 $core->tpl->display('plugin.html.twig'); -
admin/post.php
r1413 r1414 15 15 dcPage::check('usage,contentadmin'); 16 16 17 function savePost($form) { 18 global $_ctx; 19 $_ctx->setAlert('save'); 20 21 } 22 23 function deletePost($form) { 24 print_r($form); exit; 17 class PostActions 18 { 19 public static function savePost($form) { 20 global $_ctx, $core; 21 try { 22 $form->check($_ctx); 23 $_ctx->setAlert('save'); 24 $form->cat_id = (integer) $form->cat_id; 25 26 if (!empty($form->post_dt)) { 27 try 28 { 29 $post_dt = strtotime($form->post_dt); 30 if ($post_dt == false || $post_dt == -1) { 31 $bad_dt = true; 32 throw new Exception(__('Invalid publication date')); 33 } 34 $form->post_dt = date('Y-m-d H:i',$post_dt); 35 } 36 catch (Exception $e) 37 { 38 $core->error->add($e->getMessage()); 39 } 40 } 41 $post_excerpt = $form->post_excerpt; 42 $post_content = $form->post_content; 43 $post_excerpt_xhtml = ''; 44 $post_content_xhtml = ''; 45 $core->blog->setPostContent( 46 $form->id,$form->post_format,$form->post_lang, 47 $post_excerpt,$post_excerpt_xhtml,$post_content,$post_content_xhtml 48 ); 49 $form->post_excerpt = $post_excerpt; 50 $form->post_content = $post_content; 51 $form->post_excerpt_xhtml = $post_excerpt_xhtml; 52 $form->post_content_xhtml = $post_content_xhtml; 53 54 $cur = $core->con->openCursor($core->prefix.'post'); 55 56 $cur->post_title = $form->post_title; 57 $cur->cat_id = $form->cat_id ? $form->cat_id : null; 58 $cur->post_dt = $form->post_dt ? date('Y-m-d H:i:00',strtotime($form->post_dt)) : ''; 59 $cur->post_format = $form->post_format; 60 $cur->post_password = $form->post_password; 61 $cur->post_lang = $form->post_lang; 62 $cur->post_title = $form->post_title; 63 $cur->post_excerpt = $form->post_excerpt; 64 $cur->post_excerpt_xhtml = $form->post_excerpt_xhtml; 65 $cur->post_content = $form->post_content; 66 $cur->post_content_xhtml = $form->post_content_xhtml; 67 $cur->post_notes = $form->post_notes; 68 $cur->post_status = $form->post_status; 69 $cur->post_selected = (integer) $form->post_selected; 70 $cur->post_open_comment = (integer) $form->post_open_comment; 71 $cur->post_open_tb = (integer) $form->post_open_tb; 72 73 if (!empty($form->post_url)) { 74 $cur->post_url = $form->post_url; 75 } 76 77 # Update post 78 if ($form->id) 79 { 80 # --BEHAVIOR-- adminBeforePostUpdate 81 $core->callBehavior('adminBeforePostUpdate',$cur,$form->id); 82 83 $core->blog->updPost($form->id,$cur); 84 85 # --BEHAVIOR-- adminAfterPostUpdate 86 $core->callBehavior('adminAfterPostUpdate',$cur,$form->id); 87 88 http::redirect('post.php?id='.$form->id.'&upd=1'); 89 } 90 else 91 { 92 $cur->user_id = $core->auth->userID(); 93 # --BEHAVIOR-- adminBeforePostCreate 94 $core->callBehavior('adminBeforePostCreate',$cur); 95 96 $return_id = $core->blog->addPost($cur); 97 98 # --BEHAVIOR-- adminAfterPostCreate 99 $core->callBehavior('adminAfterPostCreate',$cur,$return_id); 100 101 http::redirect('post.php?id='.$return_id.'&crea=1'); 102 } 103 104 } catch (Exception $e) { 105 $ctx->setError($e->getMessage()); 106 } 107 } 108 function deletePost($form) { 109 echo $form->id->getValue(); exit; 110 } 25 111 } 26 112 27 113 $page_title = __('New entry'); 28 114 $post_id=''; 29 115 $can_view_page = true; 30 116 $can_edit_post = $core->auth->check('usage,contentadmin',$core->blog->id); … … 67 153 $rs = $core->blog->getLangs(array('order'=>'asc')); 68 154 $all_langs = l10n::getISOcodes(0,1); 69 $lang_combo = array('' => '', __('Most used') => array(), __('Available') => l10n::getISOcodes( 1,1));155 $lang_combo = array('' => '', __('Most used') => array(), __('Available') => l10n::getISOcodes(0,1)); 70 156 while ($rs->fetch()) { 71 157 if (isset($all_langs[$rs->post_lang])) { 72 $lang_combo[__('Most used')][$ all_langs[$rs->post_lang]] = $rs->post_lang;73 unset($lang_combo[__('Available')][$ all_langs[$rs->post_lang]]);158 $lang_combo[__('Most used')][$rs->post_lang] = $all_langs[$rs->post_lang]; 159 unset($lang_combo[__('Available')][$rs->post_lang]); 74 160 } else { 75 $lang_combo[__('Most used')][$rs->post_lang] = $ rs->post_lang;161 $lang_combo[__('Most used')][$rs->post_lang] = $all_langs[$rs->post_lang]; 76 162 } 77 163 } … … 83 169 ->addField( 84 170 new dcFieldText('post_title','', array( 85 ' size' => 20,171 'maxlength' => 255, 86 172 'required' => true, 87 173 'label' => __('Title')))) … … 100 186 ->addField( 101 187 new dcFieldSubmit('save',__('Save'),array( 102 'action' => 'savePost')))188 'action' => array('PostActions','savePost')))) 103 189 ->addField( 104 190 new dcFieldSubmit('delete',__('Delete'),array( … … 124 210 "label" => __('Accept trackbacks')))) 125 211 ->addField( 126 new dcFieldCheckbox ('post_selected', false,array(212 new dcFieldCheckbox ('post_selected',array(1=>false),array( 127 213 "label" => __('Selected entry')))) 128 214 ->addField( … … 225 311 $default_tab = 'comments'; 226 312 } 227 313 $page_title_edit = __('Edit entry'); 228 314 $_ctx 229 ->fillPageTitle(html::escapeHTML($core->blog->name)) 230 ->fillPageTitle(__('Entries'),'posts.php') 231 ->fillPageTitle($page_title) 315 ->setBreadCrumb( 316 array( 317 html::escapeHTML($core->blog->name) => '', 318 __('Entries') => 'posts.php', 319 ($post_id ? $page_title_edit : $page_title) => '' 320 )) 232 321 ->default_tab = $default_tab; 233 322 -
admin/posts.php
r1413 r1414 187 187 188 188 $_ctx 189 -> fillPageTitle(__('Entries'),'posts.php');189 ->setBreadCrumb(array(__('Entries') => 'posts.php')); 190 190 191 191
Note: See TracChangeset
for help on using the changeset viewer.