Commit 9c42c5ac authored by jcnventura's avatar jcnventura

Fix #764204: align source url and links on the left side for RTL languages

parent e281ff0b
......@@ -6,6 +6,8 @@ body {
th {
text-align: right;
}
.print-links,
.print-source_url,
.print-taxonomy {
text-align: left;
}
......@@ -12,11 +12,9 @@
* Implements hook_install().
*/
function print_install() {
drupal_install_schema('print');
$t = get_t();
drupal_set_message($t('Printer-friendly Page settings are available under !link',
array( '!link' => l($t('Administer > Site configuration > Printer-friendly Pages'), 'admin/settings/print' ) )
array( '!link' => l($t('Administer > Configuration > Printer, e-mail and PDF versions'), 'admin/config/print' ) )
));
}
......
......@@ -84,7 +84,7 @@ define('PRINT_TYPE_FIELDS_WEIGHT', 30);
/**
* Implements hook_permission().
*/
function print_permission() {
/*function print_permission() {
return array(
'access print' => array(
'title' => t('Access the printer-friendly page'),
......@@ -99,7 +99,7 @@ function print_permission() {
'description' => t('Enable access to the per-node settings.'),
),
);
}
}*/
/**
* Implements hook_theme().
......@@ -123,14 +123,14 @@ function print_theme() {
/**
* Clones the node theme registry for print_node so that it works with existing node templates
*/
function print_theme_registry_alter(&$theme_registry) {
/*function print_theme_registry_alter(&$theme_registry) {
$theme_registry['print_node']['theme paths'] += $theme_registry['node']['theme paths'];
}
}*/
/**
* Renders the content of the node using the theme api
*/
function print_preprocess_print_node(&$vars) {
/*function print_preprocess_print_node(&$vars) {
$format = $vars['type'];
$type = $vars['node']->type;
$vars['template_files'][] = "node";
......@@ -138,19 +138,19 @@ function print_preprocess_print_node(&$vars) {
$vars['template_files'][] = "print_node";
$vars['template_files'][] = "print_node_$format";
$vars['template_files'][] = "print_node_$format.node-$type";
}
}*/
/**
* Renders the print page, where the node content gets embedded
*/
function print_preprocess_print_page(&$vars) {
/*function print_preprocess_print_page(&$vars) {
$format = $vars['type'];
$type = $vars['node']->type;
$vars['template_files'][] = "print";
$vars['template_files'][] = "print.node-$type";
$vars['template_files'][] = "print_$format";
$vars['template_files'][] = "print_$format.node-$type";
}
}*/
/**
* Implements hook_menu().
......@@ -225,18 +225,18 @@ function print_menu() {
/**
* Implements hook_block_list().
*/
function print_block_list() {
/*function print_block_list() {
$block[0]['info'] = t('Printer, e-mail and PDF versions');
$block[0]['cache'] = BLOCK_CACHE_PER_PAGE;
$block[1]['info'] = t('Most printed');
$block[1]['cache'] = BLOCK_CACHE_GLOBAL;
return $block;
}
}*/
/**
* Implements hook_block_view().
*/
function print_block_view($delta = 0) {
/*function print_block_view($delta = 0) {
switch ($delta) {
case 0:
$nid = preg_replace('!^node/!', '', $_GET['q']);
......@@ -271,7 +271,7 @@ function print_block_view($delta = 0) {
break;
}
return $block;
}
}*/
/**
* Implements hook_link_alter().
......@@ -340,7 +340,7 @@ function print_help($path, $arg) {
/**
* Implements hook_node_view().
*/
function print_node_view($node, $build_mode) {
/*function print_node_view($node, $build_mode) {
$print_html_link_pos = variable_get('print_html_link_pos', array(PRINT_HTML_LINK_POS_DEFAULT => PRINT_HTML_LINK_POS_DEFAULT));
$print_html_link_use_alias = variable_get('print_html_link_use_alias', PRINT_HTML_LINK_USE_ALIAS_DEFAULT);
$allowed_type = print_link_allowed(array('type' => 'node', 'node' => $node, 'teaser' => ($build_mode == 'teaser')));
......@@ -390,51 +390,51 @@ function print_node_view($node, $build_mode) {
node->content['print_links']['#markup'] .= print_insert_link(NULL, $node);
}
}
}
}*/
/**
* Implements hook_node_load().
*/
function print_node_load($nodes, $types) {
/*function print_node_load($nodes, $types) {
foreach ($nodes as $node) {
_print_set_node_fields($node);
}
}
}*/
/**
* Implements hook_node_insert().
*/
function print_node_insert($node) {
/*function print_node_insert($node) {
if (user_access('administer print') || user_access('node-specific print configuration')) {
_print_node_conf_modify($node->nid, $node->print_display, $node->print_display_comment, $node->print_display_urllist);
}
}
}*/
/**
* Implements hook_node_update().
*/
function print_node_update($node) {
/*function print_node_update($node) {
if (user_access('administer print') || user_access('node-specific print configuration')) {
_print_node_conf_modify($node->nid, $node->print_display, $node->print_display_comment, $node->print_display_urllist);
}
}
}*/
/**
* Implements hook_node_delete().
*/
function print_node_delete($node) {
/*function print_node_delete($node) {
db_delete('print_node_conf')
->condition('nid', $node->nid)
->execute();
db_delete('print_page_counter')
->condition('path', 'node/' . $node->nid)
->execute();
}
}*/
/**
* Implements hook_form_alter().
*/
function print_form_alter(&$form, &$form_state, $form_id) {
/*function print_form_alter(&$form, &$form_state, $form_id) {
// Add the node-type settings option to activate the printer-friendly version link
if ((user_access('administer print') || user_access('node-specific print configuration')) &&
(($form_id == 'node_type_form') || !empty($form['#node_edit_form']))) {
......@@ -479,24 +479,24 @@ function print_form_alter(&$form, &$form_state, $form_id) {
$form['print']['label']['#markup'] = '<p><em>' . t('The settings below only apply in case the corresponding type-specific setting is also enabled (except for the "Show link in individual comments").') . '</em></p>' . $form['print']['label']['#markup'];
}
}
}
}*/
/**
* Implements hook_cck_extra_fields().
*/
function print_cck_extra_fields($type_name) {
/*function print_cck_extra_fields($type_name) {
$fields['print'] = array(
'label' => t('Printer, e-mail and PDF versions'),
'description' => t('Print module form.'),
'weight' => PRINT_TYPE_FIELDS_WEIGHT,
);
return $fields;
}
}*/
/**
* Implements hook_field_build_modes().
*/
function print_field_build_modes() {
/*function print_field_build_modes() {
return array(
'print' => array(
'title' => t('Print'),
......@@ -508,7 +508,7 @@ function print_field_build_modes() {
),
),
);
}
}*/
/**
* Auxiliary function to assign the per-node settings to the node object fields
......@@ -812,7 +812,7 @@ function print_link_allowed($args) {
$print_html_node_link_visibility = variable_get('print_html_node_link_visibility', PRINT_HTML_NODE_LINK_VISIBILITY_DEFAULT);
$print_html_node_link_pages = variable_get('print_html_node_link_pages', PRINT_HTML_NODE_LINK_PAGES_DEFAULT);
if (!_print_page_match($print_html_node_link_visibility, "node/". $node->nid, $print_html_node_link_pages)) {
if (!_print_page_match($print_html_node_link_visibility, "node/" . $node->nid, $print_html_node_link_pages)) {
// Page not in visibility list
return FALSE;
}
......
......@@ -171,7 +171,7 @@ function _print_var_generator($node, $message = NULL, $cid = NULL) {
$print['title'] = check_plain($node->title);
$print['head'] = drupal_get_html_head();
if ($print_html_sendtoprinter) {
drupal_add_js('misc/drupal.js', 'core');
drupal_add_js('misc/drupal.js', array('weight' => JS_LIBRARY));
}
$print['scripts'] = drupal_get_js();
$print['robots_meta'] = _print_robots_meta_generator();
......@@ -217,7 +217,7 @@ function _print_var_generator($node, $message = NULL, $cid = NULL) {
else {
$print['css'] = drupal_get_css($drupal_css);
if (!empty($print_css)) {
$query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1);
$query_string = '?' . substr(variable_get('css_js_query_string', '0'), 0, 1);
$print['css'] .= "<link type='text/css' rel='stylesheet' media='all' href='${user_css}${query_string}' />\n";
}
}
......@@ -341,7 +341,7 @@ function _print_var_generator($node, $message = NULL, $cid = NULL) {
$print['taxonomy'] = theme('links', $terms);
}
$print['content'] = $node->body;
$print['content'] = $node->body['und'][0]['value'];
$print['node'] = $node;
$print['message'] = $message;
......@@ -505,6 +505,8 @@ function _print_url_list_enabled($node, $format = PRINT_HTML_FORMAT) {
*/
function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $teaser = FALSE, $message = NULL) {
global $_print_urls;
global $language;
//var_dump($language);
// We can take a node id
$node = node_load($nid);
......@@ -518,14 +520,9 @@ function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $t
drupal_access_denied();
return FALSE;
}
$view_mode = $teaser ? 'teaser' : 'full';
drupal_set_title($node->title);
//alert other modules that we are generating a printer-friendly page, so they can choose to show/hide info
$node->printing = TRUE;
//use the proper build_mode
$node->build_mode = 'print';
// Turn off Pagination by the Paging module
unset($node->pages);
unset($node->page_count);
......@@ -538,7 +535,8 @@ function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $t
if ($cid === NULL) {
// Adapted (simplified) version of node_view
//Render the node content
$node = node_build_content($node, $teaser, TRUE);
node_build_content($node, $view_mode);
// Disable the links area
unset($node->content['links']);
// Disable fivestar widget output
......@@ -546,19 +544,11 @@ function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $t
// Disable service links module output
unset($node->content['service_links']);
$content = drupal_render($node->content);
$build = $node->content;
unset($node->content);
// Disable the AdSense module ads
$content = preg_replace('!<div class=[\'"]adsense[\'"].*?</div>!sim', '', $content);
if ($teaser) {
$node->teaser = $content;
unset($node->body);
}
else {
$node->body = $content;
unset($node->teaser);
}
// $content = preg_replace('!<div class=[\'"]adsense[\'"].*?</div>!sim', '', $content);
}
$print_comments = variable_get('print_comments', PRINT_COMMENTS_DEFAULT);
......@@ -587,23 +577,20 @@ function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $t
$node->body .= $comments;
}
module_invoke_all('node_alter', $node, $teaser, TRUE);
$content = theme('print_node', $node, $teaser, TRUE, $format);
$build += array(
'#theme' => 'print_node',
'#node' => $node,
'#view_mode' => $view_mode,
);
if ($teaser) {
$node->body = $node->teaser;
unset($node->teaser);
}
drupal_alter('node_view', $build);
//Check URL list settings
$_print_urls = _print_url_list_enabled($node, $format);
// Convert the a href elements
$pattern = '!<(a\s[^>]*?)>(.*?)(</a>)!is';
$node->body = preg_replace_callback($pattern, '_print_rewrite_urls', $node->body);
init_theme();
$node->body['und'][0]['value'] = preg_replace_callback($pattern, '_print_rewrite_urls', $node->body['und'][0]['value']);
$print = _print_var_generator($node, $message, $cid);
......@@ -671,8 +658,6 @@ function _print_generate_path($path, $format = PRINT_HTML_FORMAT, $teaser = FALS
$pattern = '!<(a\s[^>]*?)>(.*?)(</a>)!is';
$node->body = preg_replace_callback($pattern, '_print_rewrite_urls', $node->body);
init_theme();
$print = _print_var_generator($node, $message);
return $print;
......@@ -718,8 +703,6 @@ function _print_generate_book($nid, $format = PRINT_HTML_FORMAT, $teaser = FALSE
$pattern = '!<(a\s[^>]*?)>(.*?)(</a>)!is';
$node->body = preg_replace_callback($pattern, '_print_rewrite_urls', $node->body);
init_theme();
$print = _print_var_generator($node, $message);
// The title is already displayed by the book_recurse, so avoid duplication
$print['title'] = '';
......
......@@ -8,13 +8,6 @@
* @ingroup print
*/
/**
* Implements hook_install().
*/
function print_mail_install() {
drupal_install_schema('print_mail');
}
/**
* Implements hook_uninstall().
*/
......
......@@ -307,7 +307,7 @@ function _print_mail_access($permission) {
unset($parts[0]);
$path = implode('/', $parts);
if (is_numeric($parts[1])) {
$path = 'node/'. $path;
$path = 'node/' . $path;
}
// If the destination page is not accessible, don't show the form
if (!($router_item = menu_get_item($path)) || (!$router_item['access'])) {
......@@ -490,7 +490,7 @@ function print_mail_link_allowed($args) {
$print_mail_node_link_visibility = variable_get('print_mail_node_link_visibility', PRINT_MAIL_NODE_LINK_VISIBILITY_DEFAULT);
$print_mail_node_link_pages = variable_get('print_mail_node_link_pages', PRINT_MAIL_NODE_LINK_PAGES_DEFAULT);
if (!_print_page_match($print_mail_node_link_visibility, "node/". $node->nid, $print_mail_node_link_pages)) {
if (!_print_page_match($print_mail_node_link_visibility, "node/" . $node->nid, $print_mail_node_link_pages)) {
// Page not in visibility list
return FALSE;
}
......
......@@ -8,13 +8,6 @@
* @ingroup print
*/
/**
* Implements hook_install().
*/
function print_pdf_install() {
drupal_install_schema('print_pdf');
}
/**
* Implements hook_uninstall().
*/
......
......@@ -85,12 +85,12 @@ class PrintBasicTest extends DrupalWebTestCase {
$url[8] = 'index.php?q=sample/path with spaces';
$rel_url[5] = base_path() . $_GET['q'] . $url[5];
$rel_url[6] = $base_root . $url[6];
$rel_url[7] = $base_url .'/'. $url[7];
$rel_url[8] = $base_url .'/'. $url[8];
$abs_url[5] = $base_url .'/'. $this->getq . $url[5];
$rel_url[7] = $base_url . '/' . $url[7];
$rel_url[8] = $base_url . '/' . $url[8];
$abs_url[5] = $base_url . '/' . $this->getq . $url[5];
$abs_url[6] = $base_root . $url[6];
$abs_url[7] = $base_url .'/'. $url[7];
$abs_url[8] = $base_url .'/'. $url[8];
$abs_url[7] = $base_url . '/' . $url[7];
$abs_url[8] = $base_url . '/' . $url[8];
$url[9] = '&#109;&#97;&#x69;&#x6c;&#x74;&#111;&#58;&#115;&#x75;&#x70;p&#111;&#114;&#x74;&#x40;e&#120;&#97;&#x6d;&#x70;&#x6c;&#101;&#46;&#x63;&#x6f;&#x6d;';
$rel_url[9] = $url[9];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment