[ Index ] |
|
Code source de Plume CMS 1.2.2 |
1 <?php 2 /* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 3 /* 4 # ***** BEGIN LICENSE BLOCK ***** 5 # This file is part of Plume CMS, a website management application. 6 # Copyright (C) 2001-2005 Loic d'Anterroches and contributors. 7 # 8 # Plume CMS is free software; you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License as published by 10 # the Free Software Foundation; either version 2 of the License, or 11 # (at your option) any later version. 12 # 13 # Plume CMS is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with this program; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 # 22 # ***** END LICENSE BLOCK ***** */ 23 24 if (basename($_SERVER['SCRIPT_NAME']) == 'news-edit.php') exit; 25 26 /* =================================================== * 27 * Preview of the content if some content is available * 28 * =================================================== */ 29 if (strlen($news->getUnformattedContent('description'))) { 30 echo '<div class="preview">'; 31 32 echo '<h3>'.$news->getTextContent('title').'</h3>'; 33 echo $news->getFormattedContent('description','html'); 34 35 echo "<hr class='invisible' id=\"xxx-prevent\" /></div>\n\n"; 36 } 37 38 /* ================================================= * 39 * If is editable form to modify the content * 40 * ================================================= */ 41 if ($is_editable) { 42 echo '<form action="news.php" method="post" id="formPost" onsubmit="return isReady(\'n_title\',\''.__('You need to give a title.').'\')">'; 43 echo '<script type="text/javascript">'."\n<!--\n". 44 "var js_subtype_ids = new Array('". 45 implode("','",$arry_subtypes_extra). 46 "');\n//-->\n</script>\n"; 47 48 if ($news->cats->nbRow() >= 1) { 49 /* ================================================= * 50 * The news is already in a category, propose more * 51 * ================================================= */ 52 echo '<fieldset><legend>'. __('Categories')."</legend>\n\n"; 53 echo "<ol>\n"; 54 while (!$news->cats->EOF()) { 55 echo '<li>'.$news->cats->f('category_name'); 56 if ($news->cats->f('categoryasso_type') != PX_RESOURCE_CATEGORY_MAIN) { 57 echo ' - <a href=\'news.php?delcat=1&resource_id=' 58 .$news->f('resource_id').'&n_category_id=' 59 .$news->cats->f('category_id').'\' title=\'' 60 . __('Remove from this category').'\'>'; 61 echo '<img src="themes/'.$_px_theme 62 .'/images/delete.png" alt=" "></a> '; 63 echo ' <a href=\'news.php?addcategory=main&resource_id=' 64 .$news->f('resource_id').'&n_category_id=' 65 .$news->cats->f('category_id').'\' title=\'' 66 .__('Set as main category').'\'>'; 67 echo '<img src="themes/'.$_px_theme 68 .'/images/ico_set_as_home.png" alt=" "></a> '; 69 } else { 70 echo ' - <img src="themes/'.$_px_theme 71 .'/images/ico_home.png" alt="'.__('Main category') 72 .'"></a>'; 73 } 74 echo "</li>\n"; 75 $news->cats->moveNext(); 76 } 77 echo "</ol>\n\n"; 78 echo '<p><span class="nowrap"><label for="n_category_id" ' 79 .'style="display:inline">'.__('Add in another category').' ' 80 .$m->HelpLink('news', 'h-category').'</label><br />'."\n"; 81 echo form::combobox('n_category_id',$arry_cat, '', 1)."\n"; 82 echo '<input name="addcategory" tabindex="2" type="submit" ' 83 .'class="submit" value="'.__('Add').'" />'."\n"; 84 echo '</span></p></fieldset>'."\n".'<p>'; 85 } else { 86 /* ================================================= * 87 * A new news, propose a list of categories * 88 * ================================================= */ 89 90 echo '<p>'."\n"; 91 echo '<span class="nowrap"><label for="n_category_id" ' 92 .'style="display:inline">'.__('Category').' ' 93 .$m->HelpLink('news', 'h-category').'</label>'."\n"; 94 echo form::combobox('n_category_id', $arry_cat, 95 $news->f('category_id'), 96 $m->user->getPref('news_category_id'), 97 2).'</span>'."\n"; 98 } 99 /* ================================================= * 100 * Rest of the edition form * 101 * ================================================= */ 102 103 // content format 104 echo '<span class="nowrap"><label for="n_content_format" '; 105 echo 'style="display:inline">'; 106 echo __('Format').' '; 107 echo $m->HelpLink('news', 'h-format'); 108 echo '</label> '; 109 echo form::combobox('n_content_format', 110 array('HTML'=>'html','Wiki'=>'wiki'), 111 $news->getContentFormat('description'), 112 $m->user->getPref('content_format'), 3); 113 echo "</span>\n\n"; 114 115 // status 116 echo '<span class="nowrap"><label for="n_status" '; 117 echo 'style="display:inline">'; 118 echo __('Status').' '; 119 echo $m->HelpLink('news', 'h-status'); 120 echo '</label> '; 121 echo form::combobox('n_status', $m->getArrayResStatus(), 122 $news->f('status'), 123 $m->user->getPref('news_status'), 4); 124 echo "</span>\n\n"; 125 126 // Comment open or not 127 // Show the choice only if possible to choose as defined by 128 // the website configuration settings. 129 if (config::f('comment_support') == 2) { 130 echo '<span class="nowrap"><label for="n_comment_support" '; 131 echo 'style="display:inline">'; 132 echo __('Comments').' '; 133 echo $m->HelpLink('news', 'h-comments'); 134 echo '</label> '; 135 echo form::combobox('n_comment_support', 136 $m->getArrayCommentSupport(), 137 $news->f('comment_support'), 138 $m->user->getPref('news_comment_support'), 4); 139 echo "</span>\n\n"; 140 } else { 141 echo form::hidden('n_comment_support', config::f('comment_support')); 142 } 143 144 // news type, is hidden if only one 145 if (count($arry_subtypes) > 1) { 146 echo '<span class="nowrap"><label for="n_subtype" '; 147 echo 'style="display:inline">'; 148 echo __('Type').' '; 149 echo $m->HelpLink('news', 'h-type'); 150 echo '</label> '; 151 echo form::combobox('n_subtype', $arry_subtypes, 152 $news->f('subtype_id'), '', 5, '', 153 "onChange=\"openCloseBlockIfArray('div_extra','n_subtype',js_subtype_ids,1,-1)\";"); 154 echo "</span></p>\n\n"; 155 } else { 156 echo form::hidden('n_subtype', array_shift($arry_subtypes)); 157 } 158 159 // title 160 echo '<p><label for="n_title"><strong>'; 161 echo __('Title'); 162 echo '</strong> '; 163 echo $m->HelpLink('news', 'h-title'); 164 echo '</label> '; 165 echo form::textField('n_title', 30, 255, $news->f('title'), 166 6, 'style="width:100%"'); 167 echo "</p>\n\n"; 168 169 echo "<p>\n"; 170 171 // insert image or file 172 echo '<span id="insert-img" class="bloc-droite"><img src="themes/'.$_px_theme 173 .'/images/ico_image.png" alt="" /> '; 174 echo '<strong><a href="xmedia.php" accesskey="i" '; 175 echo 'onclick="popup(this.href+\'?mode=popup\'); return false;">'; 176 echo __('Insert an image or a file').'</a></strong></span>'."\n\n"; 177 178 // content of the news 179 echo '<label for="n_content"><strong>'.__('Content of the news'); 180 echo '</strong> '; 181 echo $m->HelpLink('news', 'h-content'); 182 echo '</label> '; 183 echo form::textArea('n_content', 60, 184 $m->user->getPref('news_textarea_content'), 185 $news->getUnformattedContent('description'), 7, 186 'style="width:100%"'); 187 188 // size control of the content textarea 189 echo '<span id="size-control" class="size-control">'."\n"; 190 echo '<input type="image" alt="'.__('shrink textarea').'" '; 191 echo 'name="decrease" value="-" src="themes/'.$_px_theme 192 .'/images/ico_shrink.png" accesskey="-" class="size-control" /> '; 193 echo '<input type="image" alt="'.__('grow textarea').'" '; 194 echo 'name="increase" value="+" src="themes/'.$_px_theme 195 .'/images/ico_grow.png" accesskey="+" class="size-control" /> '; 196 echo "</span>\n\n"; 197 198 echo "</p>\n\n"; 199 200 // keywords 201 echo '<p><label for="n_subject">'.__('Keywords').' '; 202 echo $m->HelpLink('news', 'h-keywords'); 203 echo '</label>'; 204 echo form::textArea('n_subject', 60, 4, $news->f('subject'), 8, 205 'style="width:100%"'); 206 echo "</p>\n"; 207 208 209 // associated website and link 210 echo '<div id="div_extra">'."\n"; 211 echo '<p><label for="n_titlewebsite">'.__('Associated website title').' '; 212 echo $m->HelpLink('news', 'h-asso-title'); 213 echo '</label> '; 214 echo form::textField('n_titlewebsite', 50, 255, 215 $news->details->f('news_titlewebsite'), 9, 216 'style="width:100%"'); 217 echo "</p>\n"; 218 echo '<p><label for="n_linkwebsite">'.__('Associated website address').' '; 219 echo $m->HelpLink('news', 'h-asso-address'); 220 echo '</label> '; 221 echo form::textField('n_linkwebsite', 50, 255, 222 $news->details->f('news_linkwebsite'), 10, 223 'style="width:100%"'); 224 echo '</p></div>'."\n\n"; 225 226 227 // script to show hide the extra part 228 echo '<script type="text/javascript">'."\n"; 229 echo "<!--\n"; 230 echo "openCloseBlockIfArray('div_extra', 'n_subtype', "; 231 echo 'js_subtype_ids, 1, -1);'."\n"; 232 echo "//-->\n"; 233 echo '</script>'."\n"; 234 235 236 237 if ($news->f('resource_id') > 0) { 238 echo '<p>'. __('Publication date').' '; 239 echo $m->HelpLink('news', 'h-publication-date'); 240 echo ' '.form::datetime('n_dt', $news->getArrayDate('publicationdate'), 241 11)."<br />\n"; 242 $noenddate_style = ($news->isDateEOT('enddate')) ? 'style="display: none"' : ''; 243 244 echo '<span class="nowrap">'. 245 form::checkbox('n_noenddate', 1, $news->isDateEOT('enddate'), 12, 246 "onclick=\"openCloseSpan('noenddate',0)\"; return false;") 247 .' <label for="n_noenddate" style="display:inline">' 248 .__('Do not use an expiration date.').'</label></span>' 249 .' <span class="nowrap" id="noenddate" '.$noenddate_style 250 .'><br />'. __('Expiration date').' '; 251 echo $m->HelpLink('news', 'h-expiration-date'); 252 echo ' '.form::datetime('n_dt_e', $news->getArrayDate('enddate'), 253 13)."</span></p>\n\n"; 254 } 255 256 // submit buttons 257 echo "<p>\n"; 258 echo form::button('submit', 'preview', __('Visualize [v]'), 259 14, 'v', 'submit'); 260 echo " \n"; 261 echo form::button('submit', 'publish', __('Save [s]'), 262 15, 's', 'submit')."\n"; 263 264 if (strlen($news->f('resource_id')) && 265 $news->getContentFormat('description') == 'wiki') { 266 echo form::button('submit', 'transform', __('Transform in XHTML'), 267 16, '', 'submit')."\n"; 268 } 269 270 if (strlen($news->f('resource_id'))) { 271 echo ' <input name="delete" type="submit" tabindex="17" class="submit" value="'.__('Delete').'" onclick="return window.confirm(\''.addslashes( __('Are you sure you want to delete this news?')).'\')" />'; 272 echo form::hidden('resource_id',$news->f('resource_id')); 273 } 274 ?></p> 275 </form> 276 <h3><a onclick="openClose('wikihelp',0); return false" href="#"><img alt="<?php echo __('show/hide'); ?>" id="img_wikihelp" src="themes/<?php echo $_px_theme; ?>/images/plus.png" /></a> 277 <?php echo __('Wiki syntax'); ?></h3> 278 <div id="wikihelp" style="display: none;"> 279 <?php echo $m->getHelp('wiki-inline'); ?> 280 </div> 281 <script type="text/javascript"><!-- 282 openClose('wikihelp',-1); 283 //--></script> 284 285 <?php 286 $px_resource_id = $news->f('resource_id'); 287 if ($px_resource_id > 0) { 288 $ct = $news->comments; 289 include dirname(__FILE__).'/comments-rlist.php'; 290 } 291 } // end of if ($is_editable) 292 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 11:57:01 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |