From 286aebd93bd49eac2ff80c3a6930f7f692a4c3ef Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 18 Apr 2012 17:01:40 +0200 Subject: [PATCH 001/165] [ticket/10811] Fix AJAX callback alt_text so it can be repeated. PHPBB3-10811 --- phpBB/assets/javascript/core.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 958b6c9ff6..74c71fca79 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -436,11 +436,12 @@ phpbb.add_ajax_callback = function(id, callback) * the alt-text data attribute, and replaces the text in the attribute with the * current text so that the process can be repeated. */ -phpbb.add_ajax_callback('alt_text', function(data) { +phpbb.add_ajax_callback('alt_text', function() { var el = $(this), alt_text; alt_text = el.attr('data-alt-text'); + el.attr('data-alt-text', el.text()); el.attr('title', alt_text); el.text(alt_text); }); From 51347ebc09d18a55fa93fe86ef50a215148c935f Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 29 Apr 2012 00:30:08 +0300 Subject: [PATCH 002/165] [ticket/10800] Changing template paths in tests Changing template paths in tests from absolute to relative PHPBB3-10800 --- tests/template/template_includejs_test.php | 7 +++---- tests/template/template_locate_test.php | 6 +++--- tests/template/template_test.php | 2 +- tests/template/template_test_case.php | 4 +++- tests/template/template_test_case_with_tree.php | 4 ++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index 632fde61d1..d80254072b 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -17,11 +17,10 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes $this->setup_engine(array('assets_version' => 1)); // Prepare correct result - $dir = dirname(__FILE__); $scripts = array( - '', - '', - '' + '', + '', + '' ); // Run test diff --git a/tests/template/template_locate_test.php b/tests/template/template_locate_test.php index d6e2e82a47..be9ae06809 100644 --- a/tests/template/template_locate_test.php +++ b/tests/template/template_locate_test.php @@ -17,21 +17,21 @@ class phpbb_template_template_locate_test extends phpbb_template_template_test_c // First element of the array is test name - keep them distinct array( 'simple inheritance - only parent template exists', - dirname(__FILE__) . '/parent_templates/parent_only.html', + $this->test_path . '/parent_templates/parent_only.html', 'parent_only.html', false, true, ), array( 'simple inheritance - only child template exists', - dirname(__FILE__) . '/templates/child_only.html', + $this->test_path . '/templates/child_only.html', 'child_only.html', false, true, ), array( 'simple inheritance - both parent and child templates exist', - dirname(__FILE__) . '/templates/parent_and_child.html', + $this->test_path . '/templates/parent_and_child.html', 'parent_and_child.html', false, true, diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 739bbe9387..f8677ed913 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -277,7 +277,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $this->template->set_filenames(array('test' => $filename)); $this->assertFileNotExists($this->template_path . '/' . $filename, 'Testing missing file, file cannot exist'); - $expecting = sprintf('style resource locator: File for handle test does not exist. Could not find: %s', realpath($this->template_path . '/../') . '/templates/' . $filename); + $expecting = sprintf('style resource locator: File for handle test does not exist. Could not find: %s', $this->test_path . '/templates/' . $filename); $this->setExpectedTriggerError(E_USER_ERROR, $expecting); $this->display('test'); diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index d660aa3f56..dd0acba6cd 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -18,6 +18,8 @@ class phpbb_template_template_test_case extends phpbb_test_case protected $style_resource_locator; protected $style_provider; + protected $test_path = 'tests/template'; + // Keep the contents of the cache for debugging? const PRESERVE_CACHE = true; @@ -63,7 +65,7 @@ class phpbb_template_template_test_case extends phpbb_test_case $defaults = $this->config_defaults(); $config = new phpbb_config(array_merge($defaults, $new_config)); - $this->template_path = dirname(__FILE__) . '/templates'; + $this->template_path = $this->test_path . '/templates'; $this->style_resource_locator = new phpbb_style_resource_locator(); $this->style_provider = new phpbb_style_path_provider(); $this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator); diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 9522c97330..05ccb7ee55 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -18,8 +18,8 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat $defaults = $this->config_defaults(); $config = new phpbb_config(array_merge($defaults, $new_config)); - $this->template_path = dirname(__FILE__) . '/templates'; - $this->parent_template_path = dirname(__FILE__) . '/parent_templates'; + $this->template_path = $this->test_path . '/templates'; + $this->parent_template_path = $this->test_path . '/parent_templates'; $this->style_resource_locator = new phpbb_style_resource_locator(); $this->style_provider = new phpbb_style_path_provider(); $this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator); From 53a47fdcc323a5d7dc3696215cc47285a0c99042 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 18 Apr 2012 17:03:24 +0200 Subject: [PATCH 003/165] [ticket/10811] Make subscribe/unsubscribe repeatable with AJAX PHPBB3-10811 --- phpBB/assets/javascript/core.js | 25 +++++++++++++++++++ .../prosilver/template/overall_footer.html | 4 +-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 74c71fca79..3c1e39fca6 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -446,5 +446,30 @@ phpbb.add_ajax_callback('alt_text', function() { el.text(alt_text); }); +/** + * This callback is based on the alt_text callback. + * + * It replaces the current text with the text in the alt-text data attribute, + * and replaces the text in the attribute with the current text so that the + * process can be repeated. + * Additionally it replaces the icon of the link and changes the link itself. + */ +phpbb.add_ajax_callback('toggle_subscribe', function() { + var el = $(this), + alt_text; + + phpbb.ajax_callbacks['alt_text'].call(this); + + if (el.attr('href').indexOf('unwatch') !== -1) + { + el.attr('href', el.attr('href').replace('unwatch', 'watch')); + el.parent().attr('class', 'icon-subscribe'); + } + else + { + el.attr('href', el.attr('href').replace('watch', 'unwatch')); + el.parent().attr('class', 'icon-unsubscribe'); + } +}); })(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 2cb721073f..972d90305e 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -8,8 +8,8 @@