Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
print
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
print
Commits
75f94765
Commit
75f94765
authored
May 25, 2012
by
João Ventura
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#757244
: enable printer-friendly versions of old revisions.
parent
7d4b4c6c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
print.pages.inc
+10
-6
10 additions, 6 deletions
print.pages.inc
print_ui/print_ui.module
+16
-6
16 additions, 6 deletions
print_ui/print_ui.module
with
26 additions
and
12 deletions
print.pages.inc
+
10
−
6
View file @
75f94765
...
...
@@ -86,8 +86,10 @@ function print_controller($path, $format, $cid = NULL, $teaser = FALSE) {
array_shift
(
$parts
);
$path
=
implode
(
'/'
,
$parts
);
}
if
(
ctype_digit
(
$parts
[
0
])
&&
(
count
(
$parts
)
==
1
))
{
$node
=
_print_generate_node
(
$path
,
$format
,
$cid
,
$teaser
);
$revision_view
=
preg_match
(
'!^[\d]*/revisions/[\d]*/view$!'
,
$path
);
if
(
ctype_digit
(
$parts
[
0
])
&&
((
count
(
$parts
)
==
1
)
||
$revision_view
))
{
$vid
=
$revision_view
?
$parts
[
2
]
:
NULL
;
$node
=
_print_generate_node
(
$path
,
$format
,
$vid
,
$cid
,
$teaser
);
}
else
{
$ret
=
preg_match
(
'!^book/export/html/(.*)!i'
,
$path
,
$matches
);
...
...
@@ -552,15 +554,17 @@ function _print_url_list_enabled($node, $format) {
* node ID of the node to be rendered into a printer-friendly page
* @param string $format
* format of the page being generated
* @param int $vid
* (optional) revision ID of the node to use
* @param int $cid
* comment ID of the individual comment to be rendered
*
(optional)
comment ID of the individual comment to be rendered
* @param bool $teaser
* if set to TRUE, outputs only the node's teaser
*
(optional)
if set to TRUE, outputs only the node's teaser
*
* @return object
* filled node-like object to be used in the print template
*/
function
_print_generate_node
(
$nid
,
$format
,
$cid
=
NULL
,
$teaser
=
FALSE
)
{
function
_print_generate_node
(
$nid
,
$format
,
$vid
=
NULL
,
$cid
=
NULL
,
$teaser
=
FALSE
)
{
global
$_print_urls
;
if
(
!
isset
(
$langcode
))
{
...
...
@@ -568,7 +572,7 @@ function _print_generate_node($nid, $format, $cid = NULL, $teaser = FALSE) {
}
// We can take a node id
$node
=
node_load
(
$nid
);
$node
=
node_load
(
$nid
,
$vid
);
if
(
!
$node
)
{
// Node not found
drupal_not_found
();
...
...
This diff is collapsed.
Click to expand it.
print_ui/print_ui.module
+
16
−
6
View file @
75f94765
...
...
@@ -127,7 +127,7 @@ function print_ui_block_view($delta = '') {
function
print_ui_help
(
$path
,
$arg
)
{
$links
=
''
;
if
(
$path
!==
'node/%'
)
{
if
(
(
$path
!==
'node/%'
)
&&
(
$path
!==
'node/%/revisions/%/view'
))
{
static
$output
=
FALSE
;
if
(
$output
===
FALSE
)
{
...
...
@@ -200,6 +200,16 @@ function print_ui_node_view($node, $view_mode) {
$link_pos
=
variable_get
(
'print_'
.
$link
[
'format'
]
.
'_link_pos'
,
array
(
PRINT_UI_LINK_POS_DEFAULT
=>
PRINT_UI_LINK_POS_DEFAULT
));
$link_use_alias
=
variable_get
(
'print_'
.
$link
[
'format'
]
.
'_link_use_alias'
,
PRINT_UI_LINK_USE_ALIAS_DEFAULT
);
if
(
!
preg_match
(
'!^node/[\d]*/revisions/[\d]*/view$!'
,
$_GET
[
'q'
]))
{
// Not a revision, use node->nid to build the path
$path
=
((
$link_use_alias
)
&&
(
$alias
=
drupal_lookup_path
(
'alias'
,
'node/'
.
$node
->
nid
)))
?
$alias
:
$node
->
nid
;
}
else
{
// This is a node revision, replace only the node component
$path
=
preg_replace
(
'!^node/!'
,
''
,
$_GET
[
'q'
]);
}
$path
=
$link
[
'path'
]
.
'/'
.
$path
;
foreach
(
array
(
'node'
,
'comment'
)
as
$type
)
{
$allowed_type
=
print_ui_link_allowed
(
$link
,
array
(
'type'
=>
$type
,
'node'
=>
$node
,
'view_mode'
=>
$view_mode
));
if
(
$allowed_type
)
{
...
...
@@ -209,18 +219,18 @@ function print_ui_node_view($node, $view_mode) {
// Show book link
if
(
$allowed_type
===
PRINT_UI_ALLOW_BOOK_LINK
)
{
$path
=
$link
[
'path'
]
.
'/book/export/html/'
.
$node
->
nid
;
$links
[
'book_'
.
$link
[
'format'
]]
=
array
(
'href'
=>
$
link
[
'path'
]
.
'/book/export/html/'
.
$node
->
nid
,
'href'
=>
$
path
,
'title'
=>
$format
[
'text'
],
'attributes'
=>
$format
[
'attributes'
],
'html'
=>
$format
[
'html'
],
);
}
elseif
(
$allowed_type
===
PRINT_UI_ALLOW_NORMAL_LINK
)
{
$path
=
((
$link_use_alias
)
&&
(
$alias
=
drupal_lookup_path
(
'alias'
,
'node/'
.
$node
->
nid
)))
?
$alias
:
$node
->
nid
;
$links
[
'print_'
.
$link
[
'format'
]]
=
array
(
'href'
=>
$link
[
'path'
]
.
'/'
.
$path
,
'href'
=>
$path
,
'title'
=>
$format
[
'text'
],
'attributes'
=>
$format
[
'attributes'
],
'html'
=>
$format
[
'html'
],
...
...
@@ -250,7 +260,7 @@ function print_ui_node_view($node, $view_mode) {
}
if
(
!
empty
(
$link_pos
[
'corner'
]))
{
$corner_markup
.
=
print_ui_insert_link
(
$link
,
NULL
,
$node
);
$corner_markup
.
=
print_ui_insert_link
(
$link
,
$path
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment