newsletters
[ class tree: newsletters ] [ index: newsletters ] [ all elements ]

Source for file edition_edit.php

Documentation is available at edition_edit.php

  1. <?php
  2. /**
  3.  *
  4.  * Copyright (c) 2005 bitweaver.org
  5.  * All Rights Reserved. See below for details and a complete list of authors.
  6.  * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
  7.  *
  8.  * created 2005/12/10
  9.  *
  10.  * @package newsletters
  11.  * @author spider <spider@steelsun.com>
  12.  */
  13.  
  14. /** 
  15.  * Initialization
  16.  */
  17. require_once( '../kernel/setup_inc.php' );
  18. $gBitSystem->verifyPackage( 'newsletters' );
  19. $gBitSystem->verifyPermission( 'p_newsletters_create_editions' );
  20.  
  21. require_once( NEWSLETTERS_PKG_PATH.'lookup_newsletter_edition_inc.php' );
  22.  
  23. $listHash = array();
  24. $newsletters = $gContent->mNewsletter->getList( $listHash );
  25.  
  26. if( empty( $newsletters ) ) {
  27.     header( 'Location: '.NEWSLETTERS_PKG_URL.'newsletters.php' );
  28.     die;
  29. }
  30.  
  31. $gBitSmarty->assign( 'newsletters', $newsletters );
  32.  
  33. #edit preview needs this
  34. if( !isset( $_REQUEST['title'] ) && isset( $gContent->mInfo['title'] ) ) {
  35.     $_REQUEST['title'] = $gContent->mInfo['title'];
  36. }
  37.  
  38. if( !empty( $gContent->mInfo ) ) {
  39.     $formInfo = $gContent->mInfo;
  40.     $formInfo['edit'] = !empty( $gContent->mInfo['data'] )? $gContent->mInfo['data'] : '';
  41. }
  42.  
  43. if( isset( $_REQUEST["edit"] ) ) {
  44.     $formInfo['data'] = $_REQUEST["edit"];
  45. }
  46. if( isset( $_REQUEST['title'] ) ) {
  47.     $formInfo['title'] = $_REQUEST['title'];
  48. }
  49.  
  50. if( isset( $_REQUEST['is_draft'] ) && $_REQUEST['is_draft']=='y' ) {
  51.     $formInfo['is_draft'] = 'y';
  52. }
  53.  
  54. if( isset( $_REQUEST['reply_to'] ) ) {
  55.     $formInfo['reply_to'] = $_REQUEST['reply_to'];
  56. }
  57.  
  58. if (isset($_REQUEST["preview"])) {
  59.     $gBitSmarty->assign('preview', 'y');
  60.  
  61.     $gBitSmarty->assign( 'title',!empty( $_REQUEST["title"] ) ? $_REQUEST["title"] : $gContent->getTitle() );
  62.  
  63.     $parsed = $gContent->parseData( $formInfo['data'],( !empty( $_REQUEST['format_guid'] ) ? $_REQUEST['format_guid'] :
  64.         ( isset( $gContent->mInfo['format_guid'] ) ? $gContent->mInfo['format_guid'] : 'tikiwiki' ) ) );
  65.     $gBitSmarty->assign_by_ref( 'parsed', $parsed );
  66.  
  67.     $gContent->invokeServices( 'content_preview_function' );
  68. } elseif (isset($_REQUEST["save"])) {
  69.     if( $gContent->store( $_REQUEST ) ) {
  70.         // Add the content to the search index
  71. //        if( $gBitSystem->isPackageActive( 'search' ) and $gBitSystem->isFeatureActive("search_index_on_submit")) {
  72. //            require_once( SEARCH_PKG_PATH.'refresh_functions.php');
  73. //            refresh_index_tiki_content($gContent->mContentId);
  74. //        }
  75.         header( 'Location: '.$gContent->getDisplayUrl() );
  76.         die;
  77.     } else {
  78.         $formInfo = $_REQUEST;
  79.         $formInfo['data'] = &$_REQUEST['edit'];
  80.     }
  81. } else {
  82.     $gContent->invokeServices( 'content_edit_function' );
  83. }
  84.  
  85. // WYSIWYG and Quicktag variable
  86. $gBitSmarty->assign( 'textarea_id', LIBERTY_TEXT_AREA );
  87.  
  88. // formInfo might be set due to a error on submit
  89. if( empty( $formInfo ) ) {
  90.     $formInfo = &$gContent->mInfo;
  91. }
  92.  
  93. $gBitSmarty->assign_by_ref( 'pageInfo', $formInfo );
  94. $gBitSmarty->assign( 'errors', $gContent->mErrors );
  95.  
  96. // Display the template
  97. $gBitSystem->display( 'bitpackage:newsletters/edit_edition.tpl', ($gContent->isValid() ? tra( 'Edit Edition' ).': '.$gContent->getTitle() : tra( 'Create New Edition' )) , array( 'display_mode' => 'edit' ));
  98. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:25 +0000 by phpDocumentor 1.5.0-lsces