[ Index ]
 

Code source de Plume CMS 1.2.2

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/manager/mtemplates/ -> article-edit.php (source)

   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']) == 'article-edit.php') exit;
  25  
  26  /* ===================================================== *
  27   *  Preview of the content if some content is available  *
  28   * ===================================================== */
  29  if (strlen($ar->getUnformattedContent('description'))) {
  30      echo '<div class="preview">';
  31      
  32      echo '<h3>'.$ar->getTextContent('title').'</h3>';
  33      echo $ar->getFormattedContent('description','html');
  34  
  35      echo "<hr class='invisible' id=\"xxx-prevent\" /></div>\n\n";
  36  
  37      if (!$is_editable) {
  38          while (!$ar->pages->EOF()) {
  39              echo '<div class="preview">';
  40  
  41              echo '<h3>'.$ar->getTextContent('page_title', 'pages').'</h3>';
  42              echo $ar->getFormattedContent('page_content', 'html', 'pages');
  43  
  44              echo "<hr class='invisible' id=\"zzz\"/></div>\n\n";
  45              $ar->pages->moveNext();
  46          }
  47  
  48      }
  49  }
  50  
  51  /* =========================================== *
  52   *  If is editable form to modify the content  *
  53   * =========================================== */
  54  if ($is_editable) { 
  55      echo '<form action="articles.php" method="post" id="formPost" '
  56          .'onsubmit="return isReady(\'a_title\',\''
  57          .__('You need to give a title.').'\')">'."\n\n";
  58  
  59      if ($ar->cats->nbRow() >= 1) {
  60          /* ==================================================== *
  61           *  The article is already in a category, propose more  * 
  62           * ==================================================== */
  63          echo '<fieldset><legend>'. __('Categories')."</legend>\n\n";
  64          echo "<ol>\n";
  65          while (!$ar->cats->EOF()) {
  66              echo '<li>'.$ar->cats->f('category_name');
  67              if ($ar->cats->f('categoryasso_type') != PX_RESOURCE_CATEGORY_MAIN) {
  68                  echo ' - <a href=\'articles.php?delcat=1&amp;resource_id='
  69                      .$ar->f('resource_id').'&amp;a_category_id='
  70                      .$ar->cats->f('category_id').'\' title=\''
  71                      . __('Remove from this category').'\'>';
  72                  echo '<img src="themes/'.$_px_theme
  73                      .'/images/delete.png" alt=" "></a> ';
  74                  echo ' <a href=\'articles.php?addcategory=main&amp;resource_id='
  75                      .$ar->f('resource_id').'&amp;a_category_id='
  76                      .$ar->cats->f('category_id').'\' title=\''
  77                      .__('Set as main category').'\'>';
  78                  echo '<img src="themes/'.$_px_theme
  79                      .'/images/ico_set_as_home.png" alt=" "></a> ';
  80              } else {
  81                  echo ' - <img src="themes/'.$_px_theme
  82                      .'/images/ico_home.png" alt="'.__('Main category')
  83                      .'"></a>';
  84              }
  85              echo "</li>\n";
  86              $ar->cats->moveNext();
  87          }
  88          echo "</ol>\n\n";
  89          echo '<p><span class="nowrap"><label for="a_category_id" '
  90              .'style="display:inline">'.__('Add in another category').' '
  91              .$m->HelpLink('article', 'h-category').'</label><br />'."\n";
  92          echo form::combobox('a_category_id',$arry_cat, '', 
  93                              $m->user->getPref('article_category_id'), 1)."\n";
  94          echo '<input name="addcategory" tabindex="2" type="submit" '
  95              .'class="submit" value="'.__('Add').'" />'."\n";
  96          echo '</span></p></fieldset>'."\n".'<p>';
  97      } else {  
  98          /* ================================================= *
  99           *  A new news, propose a list of categories         * 
 100           * ================================================= */
 101          
 102          echo '<p>'."\n";
 103          echo '<span class="nowrap"><label for="a_category_id" '
 104              .'style="display:inline">'.__('Category').' '
 105              .$m->HelpLink('article', 'h-category').'</label>'."\n";
 106          echo form::combobox('a_category_id', $arry_cat, 
 107                              $ar->f('category_id'), 
 108                              $m->user->getPref('article_category_id'),
 109                              2).'</span>'."\n";
 110      } 
 111      /* ================================================= *
 112       *  Rest of the edition form                         * 
 113       * ================================================= */
 114  
 115      // Content format
 116      echo '<span class="nowrap"><label for="a_description_format" ';
 117      echo 'style="display:inline">';
 118      echo __('Format').' '; 
 119      echo $m->HelpLink('article', 'h-format');
 120      echo '</label> ';
 121      echo form::combobox('a_description_format',
 122                          array('HTML'=>'html','Wiki'=>'wiki'),
 123                          $ar->getContentFormat('description'),
 124                          $m->user->getPref('content_format'), 3);
 125      echo "</span>\n";
 126  
 127      // Status
 128      echo '<span class="nowrap"><label for="a_status" ';
 129      echo 'style="display:inline">';
 130      echo __('Status').' '; 
 131      echo $m->HelpLink('article', 'h-status');
 132      echo '</label> ';
 133      echo form::combobox('a_status', $m->getArrayResStatus(),
 134                          $ar->f('status'), 
 135                          $m->user->getPref('article_status'), 4);
 136      echo "</span>\n";
 137  
 138      // Comment open or not
 139      // Show the choice only if possible to choose as defined by
 140      // the website configuration settings.
 141      if (config::f('comment_support') == 2) {
 142          echo '<span class="nowrap"><label for="a_comment_support" ';
 143          echo 'style="display:inline">';
 144          echo __('Comments').' ';  
 145          echo $m->HelpLink('article', 'h-comments'); 
 146          echo '</label> ';
 147          echo form::combobox('a_comment_support', 
 148                              $m->getArrayCommentSupport(),
 149                              $ar->f('comment_support'), 
 150                              $m->user->getPref('article_comment_support'), 4);
 151          echo "</span>\n\n";
 152      } else {
 153          echo form::hidden('a_comment_support', config::f('comment_support'));
 154      }
 155  
 156  
 157      // Subtype
 158      if (count($arry_subtypes) > 1) {
 159          echo '<span class="nowrap"><label for="a_subtype" ';
 160          echo 'style="display:inline">';
 161          echo __('Type'); 
 162          echo '</label> ';
 163          echo form::combobox('a_subtype', $arry_subtypes, 
 164                              $ar->f('subtype_id'), 
 165                              '', 5); 
 166          echo "</span>\n</p>\n";
 167      } else {
 168          echo form::hidden('a_subtype', array_shift($arry_subtypes));
 169      }
 170  
 171      // Title
 172      echo '<p><label for="a_title"><strong>';
 173      echo __('Title'); 
 174      echo '</strong> ';
 175      echo $m->HelpLink('article', 'h-title'); 
 176      echo '</label> ';
 177      echo form::textField('a_title', 30, 255, $ar->f('title'), 6, 
 178                           'style="width:100%" onkeyup="setUrl(\'a_title\', '
 179                           .'\'a_path\', \'\', '.strlen($ar->f('path')).')"');
 180      echo "</p>\n";
 181  
 182      echo "<p>\n";
 183  
 184      // Insert an image or a file
 185      echo '<span id="insert-img" class="bloc-droite"><img src="themes/'.$_px_theme
 186          .'/images/ico_image.png" alt="" /> ';
 187      echo '<strong><a href="xmedia.php" accesskey="i" ';
 188      echo 'onclick="popup(this.href+\'?mode=popup\'); return false;">';
 189      echo __('Insert an image or a file'); 
 190      echo '</a></strong></span>'."\n";
 191  
 192      // Description
 193      echo '<label for="a_description"><strong>'. __('Description').'</strong> ';
 194      echo $m->HelpLink('article', 'h-description').' ';
 195      echo '</label>';
 196      echo form::textArea('a_description', 60,
 197                          $m->user->getPref('article_textarea_description'),
 198                          $ar->getUnformattedContent('description'), 7,
 199                          'style="width:100%"');
 200  
 201      // Size controls
 202      echo '<span id="size-control" class="size-control">';
 203      echo '<input type="image" alt="'.__('shrink textarea');
 204      echo '" name="decrease" value="-" src="themes/'.$_px_theme; 
 205      echo '/images/ico_shrink.png" accesskey="-" class="size-control" /> ';
 206      echo '<input type="image" alt="'.__('grow textarea');
 207      echo '" name="increase" value="+" src="themes/'.$_px_theme; 
 208      echo '/images/ico_grow.png" accesskey="+" class="size-control" />';
 209      echo "</span>\n</p>\n\n";
 210  
 211      // Keywords
 212      echo '<p><label for="a_subject">'.__('Keywords').' ';
 213      echo $m->HelpLink('article', 'h-keywords').' </label>';
 214      echo form::textArea('a_subject',60,4,
 215                          $ar->f('subject'), 8,'style="width:100%"');
 216      echo "</p>\n";
 217  
 218      // Path
 219      echo '<p><label for="a_path"><strong>'.__('Path').'</strong> ';
 220      echo $m->HelpLink('article', 'h-path').'</label> ';
 221      echo form::textField('a_path', 30, 255, $ar->f('path'), 9, 
 222                           'style="width:100%"'); 
 223      echo "</p>\n";
 224  
 225      // Publication date
 226      if ($ar->f('resource_id') > 0) {
 227          echo '<p>'. __('Publication date').' ';
 228          echo $m->HelpLink('article', 'h-publication-date');
 229          echo ' '.form::datetime('a_dt', 
 230                                  $ar->getArrayDate('publicationdate'), 9);
 231          echo "<br />\n";
 232          $noenddate_style = ($ar->isDateEOT('enddate')) ? 
 233              'style="display: none"' : '';
 234  
 235          echo '<span class="nowrap">';
 236          echo form::checkbox('a_noenddate', 1, $ar->isDateEOT('enddate'), 10, 
 237                              "onclick=\"openCloseSpan('noenddate',0)\"; return false;").' ';
 238          echo '<label for="a_noenddate" style="display:inline">';
 239          echo __('Do not use an expiration date.');
 240          echo '</label></span>';
 241          echo ' <span class="nowrap" id="noenddate" '.$noenddate_style.'>';
 242          echo '<br />';
 243          echo __('Expiration date').' ';
 244          echo $m->HelpLink('article', 'h-expiration-date').' ';
 245          echo form::datetime('a_dt_e', $ar->getArrayDate('enddate'), 11);
 246          echo "</span></p>\n\n";
 247      }
 248  
 249      if ($ar->f('resource_id') > 0) {
 250          //  list the pages, link to add a new page
 251          echo '<fieldset><legend>'. __('Article pages').'</legend>'."\n\n";
 252          if ($ar->pages->nbRow() >= 1) {
 253              echo "<ol>\n";
 254              while (!$ar->pages->EOF()) {
 255                  echo '<li><a tabindex="4'.$ar->pages->f('page_number').'" ';
 256                  echo 'href=\'articles.php?op=page&amp;resource_id='
 257                      .$ar->f('resource_id').'&amp;a_page_id='
 258                      .$ar->pages->f('page_id').'\' title=\''
 259                      . __('Edit this page').'\'>'
 260                  .$ar->pages->f('page_title').'</a> ';
 261                  echo "</li>\n";
 262                  $ar->pages->moveNext();
 263              }
 264              echo "</ol>\n\n";
 265          }
 266          echo '<p><a tabindex="900" href="articles.php?op=page&amp;resource_id='
 267              .$ar->f('resource_id').'">'.__('Add a page to the article')
 268              .'</a></p>';
 269          echo '</fieldset>'."\n";
 270      } else {
 271          echo '<p><strong>';
 272          echo __('You need first to save the article, before adding a page to it.');
 273          echo '</strong></p>';
 274      }
 275  
 276      // Submit buttons
 277      echo '<p><input name="preview" type="submit" class="submit" ';
 278      echo 'tabindex="912" value="'.__('Visualize [v]').'" ';
 279      echo 'accesskey="v" />&nbsp; ';
 280      echo '<input name="publish" type="submit" class="submit" tabindex="913" ';
 281      echo 'value="'.__('Save [s]').'" accesskey="s" />';
 282  
 283      if ($ar->f('resource_id') > 0 && 
 284          $ar->getContentFormat('description') == 'wiki') {
 285          echo '&nbsp;<input tabindex="914" name="transform" type="submit" ';
 286          echo 'class="submit" value="'.__('Transform in XHTML').'" />';
 287      }
 288  
 289      if ($ar->f('resource_id') > 0) {
 290          echo '&nbsp;<input tabindex="915" name="delete" type="submit" ';
 291          echo 'class="submit" value="'. __('Delete').'" onclick="return ';
 292          echo 'window.confirm(\'';
 293          echo addslashes(__('Are you sure you want to delete this article?'));
 294          echo '\')" />';
 295          echo form::hidden('resource_id',$ar->f('resource_id'));
 296      }
 297      echo "</p>\n\n";
 298      echo "</form>\n\n";
 299      ?>
 300      <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>
 301    <?php  echo __('Wiki syntax'); ?></h3>
 302    <div id="wikihelp" style="display: none;">
 303    <?php echo $m->getHelp('wiki-inline'); ?>
 304    </div>
 305    <script type="text/javascript"><!--
 306    openClose('wikihelp',-1);
 307    //--></script>
 308   <?php
 309      $px_resource_id = $ar->f('resource_id');
 310      if ($px_resource_id > 0) {
 311          $ct = $ar->comments;
 312          include dirname(__FILE__).'/comments-rlist.php';
 313      }
 314  
 315  
 316  }
 317  ?>


Généré le : Mon Nov 26 11:57:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics