summaryrefslogtreecommitdiff
path: root/edition.php
blob: 66d9d505001417b413b985a52dc8da50feeed7a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
 * Copyright (c) 2005 bitweaver.org
 * All Rights Reserved. See below for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
 *
 * created 2005/12/10
 *
 * @package newsletters
 * @author spider <spider@steelsun.com>
 */

/** 
 * Initialization
 */
require_once( '../kernel/setup_inc.php' );

$gBitSystem->verifyPackage( 'newsletters' );

require_once( NEWSLETTERS_PKG_INCLUDE_PATH.'lookup_newsletter_edition_inc.php' );

$listHash = array();
$newsletters = $gContent->mNewsletter->getList( $listHash );
$gBitSmarty->assign( 'newsletters', $newsletters );

if (isset($_REQUEST["remove"] ) && $gContent->isValid() ) {
	if( !empty( $_REQUEST['cancel'] ) ) {
		// user cancelled - just continue on, doing nothing
	} elseif( empty( $_REQUEST['confirm'] ) ) {
		$formHash['remove'] = TRUE;
		$formHash['edition_id'] = $gContent->mEditionId;
		$gBitSystem->confirmDialog( $formHash, 
			array( 
				'warning' => tra('Are you sure you want to delete this newsletter edition?'). ' ' . $gContent->getTitle()
			)
		);
	} else {
		if( $gContent->expunge() ) {
			header( "Location: ".NEWSLETTERS_PKG_URL.'edition.php' );
			die;
		}
	}
}

if( $gContent->isValid() ) {
	$title = $gContent->mInfo['title'];
	$mid = 'bitpackage:newsletters/view_edition.tpl';
} else {
	$listHash = array();
	$editions = $gContent->getList( $listHash );
	$gBitSmarty->assignByRef( 'editionList', $editions );
	$gBitSmarty->assign( 'listInfo', $listHash );
	$title = tra("List Editions");
	$mid = 'bitpackage:newsletters/list_editions.tpl';
}

// Display the template
$gBitSystem->display( $mid, $title , array( 'display_mode' => 'edit' ));

?>