From 15741132b4a2b6f006441f4c11e021062c168af8 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 23 Nov 2009 16:18:13 +0100 Subject: Some language changes in subscription management Ignore-this: 9d6c368419814c7b8cb94f778377ede7 A few language strings were dropped, others updated or added darcs-hash:20091123151813-6e07b-4d01fe03fa2c3bd5944bc05abdd05a24fb79c186.gz --- inc/actions.php | 9 +++++---- inc/lang/en/lang.php | 24 +++++++++++------------- inc/lang/en/subscr_form.txt | 4 ++-- 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 */ - function tpl_subscribe() { global $INFO; global $ID; @@ -1368,22 +1367,24 @@ function tpl_subscribe() { echo p_locale_xhtml('subscr_form'); echo '

' . $lang['subscr_m_current_header'] . '

'; + echo '
'; if ($INFO['subscribed'] === false) { echo '

' . $lang['subscr_m_not_subscribed'] . '

'; } else { - echo '

' . $lang['subscr_m_current'] . '

'; echo '
    '; + 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 = ''.hsc(prettyprint_id($sub['target'])).''; } else { - $str = $targets[$ID]; + $stgt = ''.hsc(prettyprint_id($sub['target'])).''; } - $form->addElement('
  • ' . - 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('
  • '.$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 '
'; } + echo '
'; + // Add new subscription form echo '

' . $lang['subscr_m_new_header'] . '

'; - if ($INFO['userinfo']['mail'] === '') { - echo $lang['subscr_m_noemail']; - return; - } - $styles['list'] = $styles['list'] . ' (Not allowed for single pages)'; + echo '
'; + $ns = getNS($ID).':'; + $targets = array( + $ID => ''.prettyprint_id($ID).'', + $ns => ''.prettyprint_id($ns).'', + ); + $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('

' . 'Subscribe to' . '

'); $form->addRadioSet('subscribe_target', $targets); $form->addElement('

' . 'Receive' . '

'); @@ -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 '
'; } //Setup VIM: ex: et ts=4 enc=utf-8 : -- cgit v1.2.3