diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/actions.php | 9 | ||||
-rw-r--r-- | inc/lang/en/lang.php | 24 | ||||
-rw-r--r-- | inc/lang/en/subscr_form.txt | 4 | ||||
-rw-r--r-- | inc/template.php | 40 |
4 files changed, 42 insertions, 35 deletions
diff --git a/inc/actions.php b/inc/actions.php index 222ac89dd..32dde008e 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -609,7 +609,7 @@ function subscription_handle_post($params) { // Get and validate parameters. if (!isset($params['target'])) { - throw new Exception($lang['subscr_no_target']); + throw new Exception('no subscription target given'); } $target = $params['target']; $valid_styles = array('every', 'digest'); @@ -618,9 +618,9 @@ function subscription_handle_post($params) { $valid_styles[] = 'list'; } $style = valid_input_set('style', $valid_styles, $params, - $lang['subscr_invalid_style']); + 'invalid subscription style given'); $action = valid_input_set('action', array('subscribe', 'unsubscribe'), - $params, $lang['subscr_invalid_action']); + $params, 'invalid subscription action given'); // Check other conditions. if ($action === 'subscribe') { @@ -635,7 +635,8 @@ function subscription_handle_post($params) { } } if ($is === false) { - throw new Exception(sprintf($lang['subscr_not_subscribed_you'], + throw new Exception(sprintf($lang['subscr_not_subscribed'], + $_SERVER['REMOTE_USER'], prettyprint_id($target))); } // subscription_set deletes a subscription if style = null. diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php index 728d7823b..e4d050648 100644 --- a/inc/lang/en/lang.php +++ b/inc/lang/en/lang.php @@ -215,21 +215,19 @@ $lang['subscr_subscribe_error'] = 'Error adding %s to subscription list for % $lang['subscr_subscribe_noaddress']= 'There is no address associated with your login, you cannot be added to the subscription list'; $lang['subscr_unsubscribe_success']= 'Removed %s from subscription list for %s'; $lang['subscr_unsubscribe_error'] = 'Error removing %s from subscription list for %s'; -$lang['subscr_no_target'] = 'No subscription target'; -$lang['subscr_invalid_style'] = 'Invalid subscription style'; -$lang['subscr_invalid_action'] = 'Invalid subscription action'; $lang['subscr_already_subscribed'] = '%s is already subscribed to %s'; -$lang['subscr_not_subscribed'] = '%s is not subscribed to %s'; -$lang['subscr_not_subscribed_you'] = 'You are not subscribed to %s'; +$lang['subscr_not_subscribed'] = '%s is not subscribed to %s'; // Manage page for subscriptions -$lang['subscr_m_current_header'] = 'Current subscriptions'; -$lang['subscr_m_current'] = 'Your current subscriptions:'; -$lang['subscr_m_entry'] = 'Subscribed to %s receiving %s.'; -$lang['subscr_m_delete'] = 'Delete'; -$lang['subscr_m_not_subscribed'] = 'You are currently not subscribed to this page.'; -$lang['subscr_m_new_header'] = 'Add subscription'; -$lang['subscr_m_noemail'] = 'You did not set an email address.'; -$lang['subscr_m_subscribe'] = 'Subscribe'; +$lang['subscr_m_not_subscribed'] = 'You are currently not subscribed to the current page or namespace.'; +$lang['subscr_m_new_header'] = 'Add subscription'; +$lang['subscr_m_current_header'] = 'Current subscriptions'; +$lang['subscr_m_unsubscribe'] = 'Unsubscribe'; +$lang['subscr_m_subscribe'] = 'Subscribe'; + +$lang['subscr_style_every'] = 'email on every change'; +$lang['subscr_style_digest'] = 'digest email of changes for each page'; +$lang['subscr_style_list'] = 'list of changes since last email'; + /* auth.class language support */ $lang['authmodfailed'] = 'Bad user authentication configuration. Please inform your Wiki Admin.'; diff --git a/inc/lang/en/subscr_form.txt b/inc/lang/en/subscr_form.txt index 94b75258c..d606508c6 100644 --- a/inc/lang/en/subscr_form.txt +++ b/inc/lang/en/subscr_form.txt @@ -1,3 +1,3 @@ -====== Manage subscriptions ====== +====== Subscription Management ====== -This form allows you to manage your subscriptions for the current page. +This page allows you to manage your subscriptions for the current page and namespace. diff --git a/inc/template.php b/inc/template.php index 9b738bf8f..3aff96a46 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1354,7 +1354,6 @@ function tpl_include_page($pageid,$print=true){ * * @author Adrian Lang <lang@cosmocode.de> */ - function tpl_subscribe() { global $INFO; global $ID; @@ -1368,22 +1367,24 @@ function tpl_subscribe() { echo p_locale_xhtml('subscr_form'); echo '<h2>' . $lang['subscr_m_current_header'] . '</h2>'; + echo '<div class="level2">'; if ($INFO['subscribed'] === false) { echo '<p>' . $lang['subscr_m_not_subscribed'] . '</p>'; } else { - echo '<p>' . $lang['subscr_m_current'] . '</p>'; echo '<ul>'; + foreach($INFO['subscribed'] as $sub) { $form = new Doku_Form(array('class' => 'unsubscribe')); if ($sub['target'] !== $ID) { - $str = sprintf($targets['namespace'], prettyprint_id($sub['target'])); + $stgt = '<code class="ns">'.hsc(prettyprint_id($sub['target'])).'</code>'; } else { - $str = $targets[$ID]; + $stgt = '<code class="ns">'.hsc(prettyprint_id($sub['target'])).'</code>'; } - $form->addElement('<li><div class="li">' . - sprintf($lang['subscr_m_entry'], $str, - $styles[$sub['style']])); - $form->addElement(form_makeButton('submit', 'subscribe', $lang['subscr_m_delete'])); + $sstl = $lang['subscr_style_'.$sub['style']]; + if(!$sstl) $sstl = hsc($sub['style']); + + $form->addElement('<li><div class="li">'.$stgt.' ('.$sstl.') '); + $form->addElement(form_makeButton('submit', 'subscribe', $lang['subscr_m_unsubscribe'])); $form->addHidden('subscribe_target', $sub['target']); $form->addHidden('subscribe_style', $sub['style']); $form->addHidden('subscribe_action', 'unsubscribe'); @@ -1392,17 +1393,23 @@ function tpl_subscribe() { } echo '</ul>'; } + echo '</div>'; + // Add new subscription form echo '<h2>' . $lang['subscr_m_new_header'] . '</h2>'; - if ($INFO['userinfo']['mail'] === '') { - echo $lang['subscr_m_noemail']; - return; - } - $styles['list'] = $styles['list'] . ' (Not allowed for single pages)'; + echo '<div class="level2">'; + $ns = getNS($ID).':'; + $targets = array( + $ID => '<code class="page">'.prettyprint_id($ID).'</code>', + $ns => '<code class="ns">'.prettyprint_id($ns).'</code>', + ); + $styles = array( + 'every' => $lang['subscr_style_every'], + 'digest' => $lang['subscr_style_digest'], + 'list' => $lang['subscr_style_list'], + ); + $form = new Doku_Form(array('id' => 'subscribe')); - $ns = getNS($ID). ':'; - $targets[$ns] = sprintf($targets['namespace'], prettyprint_id($ns)); - unset($targets['namespace']); $form->addElement('<p>' . 'Subscribe to' . '</p>'); $form->addRadioSet('subscribe_target', $targets); $form->addElement('<p>' . 'Receive' . '</p>'); @@ -1410,6 +1417,7 @@ function tpl_subscribe() { $form->addHidden('subscribe_action', 'subscribe'); $form->addElement(form_makeButton('submit', 'subscribe', $lang['subscr_m_subscribe'])); html_form('SUBSCRIBE', $form); + echo '</div>'; } //Setup VIM: ex: et ts=4 enc=utf-8 : |