diff options
| -rw-r--r-- | BitMailer.php | 132 | ||||
| -rw-r--r-- | BitNewsletterEdition.php | 35 | ||||
| -rw-r--r-- | admin/admin_newsletters_inc.php | 44 | ||||
| -rw-r--r-- | admin/index.php | 4 | ||||
| -rw-r--r-- | admin/schema_inc.php | 1 | ||||
| -rw-r--r-- | admin/tend_mail_queue.php | 37 | ||||
| -rw-r--r-- | templates/admin_newsletters.tpl | 124 | ||||
| -rw-r--r-- | templates/edit_newsletter.tpl | 141 | ||||
| -rw-r--r-- | templates/menu_newsletters_admin.tpl | 2 |
9 files changed, 361 insertions, 159 deletions
diff --git a/BitMailer.php b/BitMailer.php new file mode 100644 index 0000000..3578fb3 --- /dev/null +++ b/BitMailer.php @@ -0,0 +1,132 @@ +<?php +/** + * $Header: /cvsroot/bitweaver/_bit_newsletters/Attic/BitMailer.php,v 1.1 2005/12/16 06:34:54 spiderr Exp $ + * + * Copyright (c) 2004 bitweaver.org + * All Rights Reserved. See copyright.txt for details and a complete list of authors. + * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details + * + * $Id: BitMailer.php,v 1.1 2005/12/16 06:34:54 spiderr Exp $ + * + * Class that handles editions of newsletters + * @package newsletters + * + * created 2005/12/08 + * + * @author spiderr <spider@steelsun.com> + * + * @version $Revision: 1.1 $ $Date: 2005/12/16 06:34:54 $ $Author: spiderr $ + */ + +/** + * required setup + */ +require_once( NEWSLETTERS_PKG_PATH.'BitNewsletter.php' ); +require_once( UTIL_PKG_PATH.'phpmailer/class.phpmailer.php' ); + +class BitMailer extends phpmailer { + // Set default variables for all new objects + var $From; + var $FromName; + var $Host; + var $Mailer; // Alternative to IsSMTP() + var $WordWrap; + function BitMailer () { + global $gBitDb, $gBitSystem; + $this->mDb = $gBitDb; + $this->From = $gBitSystem->getPreference( 'bitmailer_sender_email', $gBitSystem->getPreference( 'sender_email', $_SERVER['SERVER_ADMIN'] ) ); + $this->FromName = $gBitSystem->getPreference( 'bitmailer_from', $gBitSystem->getPreference( 'siteTitle' ) ); + $this->Host = $gBitSystem->getPreference( 'bitmailer_servers', $gBitSystem->getPreference( 'feature_server_name', $_SERVER['HTTP_HOST'] ) ); + $this->Mailer = $gBitSystem->getPreference( 'bitmailer_protocol', 'smtp' ); // Alternative to IsSMTP() + $this->WordWrap = $gBitSystem->getPreference( 'bitmailer_word_wrap', 75 ); + } + + // Replace the default error_handler + function error_handler( $msg ) { + global $gBitDb; + bit_error_handler( NULL, NULL, NULL, "FULFILLMENT ERROR: MISSSING PDF for ORDER $pOrderId CID ".$prod->mInfo['related_content_id'], $pdfInfo['pdf_file'], '', $prod->mDb ); + print("My Site Error"); + print("Description:"); + printf("%s", $msg); + exit; + } + + function queueRecipients( $pRecipients ) { + $ret = 0; + if( $this->isValid() ) { +vd( $this->mContentId ); + $queueTime = time(); + foreach( array_keys( $pRecipients ) AS $email ) { + $insertHash['email'] = $email; + if( !empty( $pRecipients[$email]['user_id'] ) ) { + $insertHash['user_id'] = $pRecipients[$email]['user_id']; + } + $insertHash['content_id'] = $this->mContentId; + $insertHash['queue_date'] = $queueTime; + $this->mDb->associateInsert( BIT_DB_PREFIX.'tiki_mail_queue', $insertHash ); + $ret++; + } +die; + } + return $ret; + } + + function tendQueue() { + $body = array(); + $this->mDb->StartTrans(); + $query = "SELECT * + FROM `".BIT_DB_PREFIX."tiki_mail_queue` tmq + WHERE `sent_date` IS NULL ".$this->mDb->SQLForUpdate(); + while( ($rs = $this->mDb->query( $query, NULL, 1 )) && $rs->RowCount() ) { + $pick = $rs->fields; + if( !empty( $pick['user_id'] ) ) { + $userHash = $this->mDb->getRow( "SELECT * FROM `".BIT_DB_PREFIX."users_users` WHERE `user_id`=?", array( $pick['user_id'] ) ); + $pick['full_name'] = BitUser::getDisplayName( FALSE, $userHash ); + } else { + $pick['full_name'] = NULL; + } + if( !isset( $body[$pick['content_id']] ) ) { + // We only support sending of newsletters currently + $content = new BitNewsletterEdition( NULL, $pick['content_id'] ); + if( $content->load() ) { + $body[$pick['content_id']]['body'] = $content->render(); + $body[$pick['content_id']]['subject'] = $content->getTitle(); + } +// $content[$pick['content_id']] = LibertyBase::getLibertyObject(); + } + if( !empty( $body[$pick['content_id']] ) ) { + $this->sendMail( $pick, $body[$pick['content_id']]['subject'], $body[$pick['content_id']]['body'] ); +die; + $this->mDb->query( $updateQuery, array( time(), $pick['content_id'], $pick['email'] ) ); + $updateQuery = "UPDATE `".BIT_DB_PREFIX."tiki_mail_queue` SET `sent_date`=? WHERE `content_id`=? AND `email`=?"; + $this->mDb->CompleteTrans(); + $this->mDb->StartTrans(); + } + $rs->MoveNext(); + } + $this->mDb->CompleteTrans(); + + $this->mDb->query( "UPDATE tiki_mail_queue set sent_date=NULL" ); + } + + + function sendMail( $pRecipient, $pSubject, $pHtmlBody ) { + $ret = TRUE; + $this->Body = $pHtmlBody; + $this->Subject = $pSubject; + $this->IsHTML( TRUE ); + $this->AltBody = ''; + $this->AddAddress( $pRecipient['email'], $pRecipient["full_name"] ); + if(!$this->Send()) { + $ret = FALSE; + echo "There has been a mail error sending to " . $pRecipient["email"] . "<br>"; + } + + // Clear all addresses and attachments for next loop + $this->ClearAddresses(); + $this->ClearAttachments(); + return $ret; + } + +} +?>
\ No newline at end of file diff --git a/BitNewsletterEdition.php b/BitNewsletterEdition.php index c2366f9..27cca58 100644 --- a/BitNewsletterEdition.php +++ b/BitNewsletterEdition.php @@ -1,22 +1,21 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_newsletters/BitNewsletterEdition.php,v 1.6 2005/12/11 22:53:05 spiderr Exp $ + * $Header: /cvsroot/bitweaver/_bit_newsletters/BitNewsletterEdition.php,v 1.7 2005/12/16 06:34:55 spiderr Exp $ * * Copyright (c) 2004 bitweaver.org * All Rights Reserved. See copyright.txt for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details * - * $Id: BitNewsletterEdition.php,v 1.6 2005/12/11 22:53:05 spiderr Exp $ + * $Id: BitNewsletterEdition.php,v 1.7 2005/12/16 06:34:55 spiderr Exp $ * - * Virtual base class (as much as one can have such things in PHP) for all - * derived tikiwiki classes that require database access. - * @package blogs + * Class that handles editions of newsletters + * @package newsletters * - * created 2004/10/20 + * created 2005/12/08 * - * @author drewslater <andrew@andrewslater.com>, spiderr <spider@steelsun.com> + * @author spiderr <spider@steelsun.com> * - * @version $Revision: 1.6 $ $Date: 2005/12/11 22:53:05 $ $Author: spiderr $ + * @version $Revision: 1.7 $ $Date: 2005/12/16 06:34:55 $ $Author: spiderr $ */ /** @@ -194,22 +193,12 @@ class BitNewsletterEdition extends LibertyAttachable { return $ret; } - function queueRecipients( $pRecipients ) { - $ret = 0; + function render() { + global $gBitSmarty; + $ret = NULL; if( $this->isValid() ) { -vd( $this->mContentId ); - $queueTime = time(); - foreach( array_keys( $pRecipients ) AS $email ) { - $insertHash['email'] = $email; - if( !empty( $pRecipients[$email]['user_id'] ) ) { - $insertHash['user_id'] = $pRecipients[$email]['user_id']; - } - $insertHash['content_id'] = $this->mContentId; - $insertHash['queue_date'] = $queueTime; - $this->mDb->associateInsert( BIT_DB_PREFIX.'tiki_mail_queue', $insertHash ); - $ret++; - } -die; + $gBitSmarty->assign_by_ref( 'gContent', $this ); + $ret = $gBitSmarty->fetch( 'bitpackage:newsletters/view_edition.tpl' ); } return $ret; } diff --git a/admin/admin_newsletters_inc.php b/admin/admin_newsletters_inc.php new file mode 100644 index 0000000..56a52b1 --- /dev/null +++ b/admin/admin_newsletters_inc.php @@ -0,0 +1,44 @@ +<?php +// $Header: /cvsroot/bitweaver/_bit_newsletters/admin/admin_newsletters_inc.php,v 1.1 2005/12/16 06:34:55 spiderr Exp $ + +$formNewsletterFeatures = array( + "bitmailer_sender_email" => array( + 'label' => 'From Email', + 'note' => 'If empty, it will default to the site Sender Email', + 'default' => $gBitSystem->getPreference( 'sender_email', $_SERVER['SERVER_ADMIN'] ), + ), + "bitmailer_from" => array( + 'label' => 'From Name', + 'note' => '', + 'default' => $gBitSystem->getPreference( 'siteTitle' ), + ), + "bitmailer_servers" => array( + 'label' => 'Mail Servers', + 'note' => '', + 'default' => $gBitSystem->getPreference( 'feature_server_name', $_SERVER['HTTP_HOST'] ), + ), + "bitmailer_protocol" => array( + 'label' => 'Protocol', + 'note' => '', + 'default' => 'smtp', + ), + "bitmailer_word_wrap" => array( + 'label' => 'Word wrap', + 'note' => '', + 'default' => '75', + ), +); +$gBitSmarty->assign( 'formNewsletterFeatures',$formNewsletterFeatures ); + +$processForm = set_tab(); + +if( $processForm ) { + + foreach( array_keys( $formNewsletterFeatures ) as $key ) { + if( empty( $_REQUEST[$key] ) || $_REQUEST[$key] != $formNewsletterFeatures[$key]['default'] ) { + $gBitSystem->storePreference( $key, isset( $_REQUEST[$key] ) ? $_REQUEST[$key] : NULL ); + } + } +} + +?> diff --git a/admin/index.php b/admin/index.php index b4369ab..a8d1c3e 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,6 +1,6 @@ <?php -// $Header: /cvsroot/bitweaver/_bit_newsletters/admin/Attic/index.php,v 1.5 2005/12/09 19:15:50 spiderr Exp $ +// $Header: /cvsroot/bitweaver/_bit_newsletters/admin/Attic/index.php,v 1.6 2005/12/16 06:34:55 spiderr Exp $ // Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. // All Rights Reserved. See copyright.txt for details and a complete list of authors. @@ -64,6 +64,6 @@ include_once( CATEGORIES_PKG_PATH.'categorize_list_inc.php' ); */ // Display the template -$gBitSystem->display( 'bitpackage:newsletters/admin_newsletters.tpl'); +$gBitSystem->display( 'bitpackage:newsletters/edit_newsletters.tpl'); ?> diff --git a/admin/schema_inc.php b/admin/schema_inc.php index 7e42ce4..faafe42 100644 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -46,6 +46,7 @@ $tables = array( email C(160) PRIMARY, user_id I4, queue_date I8 NOTNULL, + begin_date I8, sent_date I8 CONSTRAINTS ', CONSTRAINT `tiki_nl_mailq_ed_ref` FOREIGN KEY (`edition_id`) REFERENCES `".BIT_DB_PREFIX."tiki_newsletters_editions`( `edition_id` ), , CONSTRAINT `tiki_nl_mailq_user_ref` FOREIGN KEY (`users_id`) REFERENCES `".BIT_DB_PREFIX."users_users`( `users_id` )' diff --git a/admin/tend_mail_queue.php b/admin/tend_mail_queue.php new file mode 100644 index 0000000..7565ca7 --- /dev/null +++ b/admin/tend_mail_queue.php @@ -0,0 +1,37 @@ +<?php + + global $gBitSystem, $_SERVER; + + $_SERVER['SCRIPT_URL'] = ''; + $_SERVER['HTTP_HOST'] = ''; + $_SERVER['HTTP_HOST'] = ''; + $_SERVER['HTTP_HOST'] = ''; + $_SERVER['SERVER_NAME'] = ''; + $_SERVER['SERVER_ADMIN'] = ''; + $_SERVER['SERVER_SOFTWARE'] = 'command line'; + +/** + * required setup + */ + if( !empty( $argc ) ) { + // reduce feedback for command line to keep log noise way down +// define( 'BIT_PHP_ERROR_REPORTING', E_ERROR | E_PARSE ); + } + + require_once( '../../bit_setup_inc.php' ); + + // add some protection for arbitrary thumbail execution. + // if argc is present, we will trust it was exec'ed command line. + if( empty( $argc ) && !$gBitUser->isAdmin() ) { + $gBitSystem->fatalError( 'You cannot run the thumbnailer' ); + } + + if( $gBitSystem->isPackageActive( 'newsletters' ) ) { + require_once( NEWSLETTERS_PKG_PATH.'BitMailer.php' ); + global $gBitMailer; + $gBitMailer = new BitMailer(); + + $gBitMailer->tendQueue(); + } + +?>
\ No newline at end of file diff --git a/templates/admin_newsletters.tpl b/templates/admin_newsletters.tpl index d68d824..2806a7b 100644 --- a/templates/admin_newsletters.tpl +++ b/templates/admin_newsletters.tpl @@ -1,113 +1,27 @@ {strip} -<div class="floaticon">{bithelp}</div> +{form} + {jstabs} + {jstab title="Newsletter Features"} + {legend legend="Newsletter Features"} + <input type="hidden" name="page" value="{$page}" /> -<div class="edit newsletters"> - <div class="header"> - <h1>{tr}Newsletter Settings{/tr}</h1> - </div> - - <div class="body"> - {if !$newsletters || $gContent->isValid() || $smarty.request.new} - {form legend="Create / Edit Newsletters"} - {if $individual eq 'y'} - <a href="{$smarty.const.KERNEL_PKG_URL}object_permissions.php?objectName=newsletter%20{$gContent->mInfo.name}&object_type=newsletter&permType=newsletters&object_id={$gContent->mInfo.nl_id}">{tr}There are individual permissions set for this newsletter{/tr}</a><br /><br /> - {/if} - <input type="hidden" name="nl_id" value="{$gContent->mNlId}" /> - - <div class="row"> - {formlabel label="Title" for="title"} - {forminput} - <input type="text" name="title" id="title" value="{$gContent->mInfo.title|escape}" /> - {formhelp note="Title of the newsletter."} - {/forminput} - </div> - - <div class="row"> - {formlabel label="Description" for="description"} - {forminput} - <textarea name="edit" rows="4" cols="40" id="description">{$gContent->mInfo.data|escape}</textarea> - {formhelp note="Description of the newsletter, that users know what they are getting themselves into."} - {/forminput} - </div> - - <div class="row"> - {formlabel label="Users can Subscribe" for="allow_user_sub"} - {forminput} - <input type="checkbox" name="allow_user_sub" id="allow_user_sub" {if $gContent->mInfo.allow_user_sub eq 'y'}checked="checked"{/if} /> - {formhelp note="Users can subscribe to this list. Disabling this options means that you have to manually add users to the list."} - {/forminput} - </div> - - <div class="row"> - {formlabel label="Any e-mail Address" for="allow_any_sub"} - {forminput} - <input type="checkbox" name="allow_any_sub" id="allow_any_sub" {if $gContent->mInfo.allow_any_sub eq 'y'}checked="checked"{/if} /> - {formhelp note="Users may subscribe using any email address."} - {/forminput} - </div> - - <div class="row"> - {formlabel label="Append Un/Subscribe Instructions" for="unsub_msg"} - {forminput} - <input type="checkbox" name="unsub_msg" id="unsub_msg" {if $gContent->mInfo.unsub_msg eq 'y'}checked="checked"{/if} /> - {formhelp note="Append instructions on how to subscribe / unsubscribe to ever outgoing newsletter. This is only useful when users can un / subscribe to the list themselves."} - {/forminput} - </div> - - <div class="row"> - {formlabel label="Validate e-mail Addresses" for="validate_addr"} - {forminput} - <input type="checkbox" name="validate_addr" id="validate_addr" {if $gContent->mInfo.validate_addr eq 'y'}checked="checked"{/if} /> - {formhelp note="Validate all email addresses before they are added to the list. This might result in members not being added despite working email addresses."} - {/forminput} - </div> + {foreach from=$formNewsletterFeatures key=item item=output} + <div class="row"> + {formlabel label=`$output.label` for=$item} + {forminput} + <input type="text" name="{$item}" value="{$gBitSystem->getPreference($item,$output.default)}" id=$item /> + {formhelp note=`$output.note` page=`$output.page`} + {/forminput} + </div> + {/foreach} <div class="row submit"> - <input type="submit" name="cancel" value="{tr}Cancel{/tr}" /> - <input type="submit" name="save" value="{tr}Save{/tr}" /> + <input type="submit" name="featuresTabSubmit" value="{tr}Change preferences{/tr}" /> </div> - {/form} - - {else} - - {minifind} - - <table class="data"> - <caption>{tr}Newsletters{/tr}</caption> - <tr> - <th>{smartlink ititle="Name" isort=name offset=$offset}</th> - <th>{smartlink ititle="Description" isort=description offset=$offset}</th> - <th>{smartlink ititle="Created" isort=last_sent offset=$offset}</th> - <th>{smartlink ititle="Last Sent" isort=created offset=$offset}</th> - <th>{smartlink ititle="Users Unsubscribed" isort=users offset=$offset}</th> - <th>{tr}Action{/tr}</th> - </tr> - - {foreach key=nlId from=$newsletters item=nl} - <tr class="{cycle values='odd,even'}"> - <td><a href="{$smarty.const.NEWSLETTERS_PKG_URL}index.php?nl_id={$nlId}">{$nl.title}</a></td> - <td>{$nl.data}</td> - <td>{$nl.created|bit_short_date}</td> - <td>{$nl.last_sent|bit_short_date}</td> - <td style="text-align:right;"><a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletter_subscriptions.php?nl_id={$nlId}">{$nl.users|default:0} [ {$channels[user].confirmed|default:0} ]</a></td> - <td style="text-align:right;"> - <a href="{$smarty.const.NEWSLETTERS_PKG_URL}edition_edit.php?nl_id={$nlId}">{biticon ipackage=liberty iname=new iexplain="New Edition"}</a> - <a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/index.php?remove=1&nl_id={$nlId}">{biticon ipackage=liberty iname=delete iexplain=Remove}</a> - <a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/index.php?&nl_id={$nlId}">{biticon ipackage=liberty iname=edit iexplain=Edit}</a> - {if $channels[user].individual eq 'y'}({/if}<a href="{$smarty.const.KERNEL_PKG_URL}object_permissions.php?objectName=newsletter%20{$nl.title}&object_type={$smarty.const.BITNEWSLETTER_CONTENT_TYPE_GUID}&permType=newsletters&object_id={$nlId}">{biticon ipackage=liberty iname=permissions iexplain=Permissions}</a>{if $nl.individual eq 'y'}){/if} - </td> - </tr> - {foreachelse} - <tr class="norecords"> - <td colspan="7">{tr}No Records Found{/tr}</td> - </tr> - {/foreach} - </table> + {/legend} + {/jstab} - <a href="{$smarty.server.php_self}?new=1">Create new newsletter</a> + {/jstabs} +{/form} - {pagination} - {/if} - </div><!-- end .body --> -</div><!-- end .___ --> {/strip} diff --git a/templates/edit_newsletter.tpl b/templates/edit_newsletter.tpl index 84876be..d68d824 100644 --- a/templates/edit_newsletter.tpl +++ b/templates/edit_newsletter.tpl @@ -1,28 +1,113 @@ -<h2>{tr}Prepare a newsletter to be sent{/tr}</h2> -<form action="{$smarty.const.NEWSLETTERS_PKG_URL}admin/send.php" method="post" id='editpageform'> -<table class="panel"> -<tr><td>{tr}Subject{/tr}:</td><td><input type="text" maxlength="250" size="40" name="title" value="{$info.subject|escape}" /></td></tr> -<tr><td>{tr}Newsletter{/tr}:</td><td> - <select name="nl_id"> - {foreach from=$newsletters item=nl key=nlId} - <option value="{$nlId|escape}" {if $nlId eq $nl_id}selected="selected"{/if}>{$nl.title}</option> - {/foreach} - </select> -</td></tr> -{if $tiki_p_use_content_templates eq 'y'} -<tr><td>{tr}Apply template{/tr}</td><td> -<select name="template_id" onchange="javascript:document.getElementById('editpageform').submit();"> -<option value="0">{tr}none{/tr}</option> -{section name=ix loop=$templates} -<option value="{$templates[ix].template_id|escape}">{$templates[ix].name}</option> -{/section} -</select> -</td></tr> -{/if} -<tr><td>{tr}Data{/tr}:</td><td><textarea name="edit" rows="25" cols="60">{$info.data|escape}</textarea></td></tr> -<tr class="panelsubmitrow"><td colspan="2"> -<input type="submit" name="preview" value="{tr}Preview{/tr}" /> <input type="submit" name="save" value="{tr}Send Newsletters{/tr}" /> -</td></tr> -</table> -</form> -{/if} +{strip} +<div class="floaticon">{bithelp}</div> + +<div class="edit newsletters"> + <div class="header"> + <h1>{tr}Newsletter Settings{/tr}</h1> + </div> + + <div class="body"> + {if !$newsletters || $gContent->isValid() || $smarty.request.new} + {form legend="Create / Edit Newsletters"} + {if $individual eq 'y'} + <a href="{$smarty.const.KERNEL_PKG_URL}object_permissions.php?objectName=newsletter%20{$gContent->mInfo.name}&object_type=newsletter&permType=newsletters&object_id={$gContent->mInfo.nl_id}">{tr}There are individual permissions set for this newsletter{/tr}</a><br /><br /> + {/if} + <input type="hidden" name="nl_id" value="{$gContent->mNlId}" /> + + <div class="row"> + {formlabel label="Title" for="title"} + {forminput} + <input type="text" name="title" id="title" value="{$gContent->mInfo.title|escape}" /> + {formhelp note="Title of the newsletter."} + {/forminput} + </div> + + <div class="row"> + {formlabel label="Description" for="description"} + {forminput} + <textarea name="edit" rows="4" cols="40" id="description">{$gContent->mInfo.data|escape}</textarea> + {formhelp note="Description of the newsletter, that users know what they are getting themselves into."} + {/forminput} + </div> + + <div class="row"> + {formlabel label="Users can Subscribe" for="allow_user_sub"} + {forminput} + <input type="checkbox" name="allow_user_sub" id="allow_user_sub" {if $gContent->mInfo.allow_user_sub eq 'y'}checked="checked"{/if} /> + {formhelp note="Users can subscribe to this list. Disabling this options means that you have to manually add users to the list."} + {/forminput} + </div> + + <div class="row"> + {formlabel label="Any e-mail Address" for="allow_any_sub"} + {forminput} + <input type="checkbox" name="allow_any_sub" id="allow_any_sub" {if $gContent->mInfo.allow_any_sub eq 'y'}checked="checked"{/if} /> + {formhelp note="Users may subscribe using any email address."} + {/forminput} + </div> + + <div class="row"> + {formlabel label="Append Un/Subscribe Instructions" for="unsub_msg"} + {forminput} + <input type="checkbox" name="unsub_msg" id="unsub_msg" {if $gContent->mInfo.unsub_msg eq 'y'}checked="checked"{/if} /> + {formhelp note="Append instructions on how to subscribe / unsubscribe to ever outgoing newsletter. This is only useful when users can un / subscribe to the list themselves."} + {/forminput} + </div> + + <div class="row"> + {formlabel label="Validate e-mail Addresses" for="validate_addr"} + {forminput} + <input type="checkbox" name="validate_addr" id="validate_addr" {if $gContent->mInfo.validate_addr eq 'y'}checked="checked"{/if} /> + {formhelp note="Validate all email addresses before they are added to the list. This might result in members not being added despite working email addresses."} + {/forminput} + </div> + + <div class="row submit"> + <input type="submit" name="cancel" value="{tr}Cancel{/tr}" /> + <input type="submit" name="save" value="{tr}Save{/tr}" /> + </div> + {/form} + + {else} + + {minifind} + + <table class="data"> + <caption>{tr}Newsletters{/tr}</caption> + <tr> + <th>{smartlink ititle="Name" isort=name offset=$offset}</th> + <th>{smartlink ititle="Description" isort=description offset=$offset}</th> + <th>{smartlink ititle="Created" isort=last_sent offset=$offset}</th> + <th>{smartlink ititle="Last Sent" isort=created offset=$offset}</th> + <th>{smartlink ititle="Users Unsubscribed" isort=users offset=$offset}</th> + <th>{tr}Action{/tr}</th> + </tr> + + {foreach key=nlId from=$newsletters item=nl} + <tr class="{cycle values='odd,even'}"> + <td><a href="{$smarty.const.NEWSLETTERS_PKG_URL}index.php?nl_id={$nlId}">{$nl.title}</a></td> + <td>{$nl.data}</td> + <td>{$nl.created|bit_short_date}</td> + <td>{$nl.last_sent|bit_short_date}</td> + <td style="text-align:right;"><a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/admin_newsletter_subscriptions.php?nl_id={$nlId}">{$nl.users|default:0} [ {$channels[user].confirmed|default:0} ]</a></td> + <td style="text-align:right;"> + <a href="{$smarty.const.NEWSLETTERS_PKG_URL}edition_edit.php?nl_id={$nlId}">{biticon ipackage=liberty iname=new iexplain="New Edition"}</a> + <a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/index.php?remove=1&nl_id={$nlId}">{biticon ipackage=liberty iname=delete iexplain=Remove}</a> + <a href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/index.php?&nl_id={$nlId}">{biticon ipackage=liberty iname=edit iexplain=Edit}</a> + {if $channels[user].individual eq 'y'}({/if}<a href="{$smarty.const.KERNEL_PKG_URL}object_permissions.php?objectName=newsletter%20{$nl.title}&object_type={$smarty.const.BITNEWSLETTER_CONTENT_TYPE_GUID}&permType=newsletters&object_id={$nlId}">{biticon ipackage=liberty iname=permissions iexplain=Permissions}</a>{if $nl.individual eq 'y'}){/if} + </td> + </tr> + {foreachelse} + <tr class="norecords"> + <td colspan="7">{tr}No Records Found{/tr}</td> + </tr> + {/foreach} + </table> + + <a href="{$smarty.server.php_self}?new=1">Create new newsletter</a> + + {pagination} + {/if} + </div><!-- end .body --> +</div><!-- end .___ --> +{/strip} diff --git a/templates/menu_newsletters_admin.tpl b/templates/menu_newsletters_admin.tpl index 7a15eb1..427af15 100644 --- a/templates/menu_newsletters_admin.tpl +++ b/templates/menu_newsletters_admin.tpl @@ -1,6 +1,6 @@ {if $gBitUser->hasPermission( 'bit_p_admin_newsletters' )} <ul> - <li><a class="item" href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/index.php">{tr}Newsletters Settings{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=newsletters">{tr}Newsletters Settings{/tr}</a></li> <li><a class="item" href="{$smarty.const.NEWSLETTERS_PKG_URL}admin/send.php">{tr}Send Newsletters{/tr}</a></li> </ul> {/if} |
