Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
bee22be8
Commit
bee22be8
authored
Jul 22, 2008
by
Stacey Walker
Browse files
add view id to links in the blogposts in views. fixes bug #2484
parent
0c9903fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/blog/lib.php
View file @
bee22be8
...
@@ -425,7 +425,8 @@ class ArtefactTypeBlogPost extends ArtefactType {
...
@@ -425,7 +425,8 @@ class ArtefactTypeBlogPost extends ArtefactType {
// We need to make sure that the images in the post have the right viewid associated with them
// We need to make sure that the images in the post have the right viewid associated with them
$postcontent
=
$this
->
get
(
'description'
);
$postcontent
=
$this
->
get
(
'description'
);
if
(
isset
(
$options
[
'viewid'
]))
{
if
(
isset
(
$options
[
'viewid'
]))
{
$postcontent
=
preg_replace
(
'#(<img[^>]+src="[^>]+artefact/file/download\.php\?file=\d+)#'
,
'\1&view='
.
$options
[
'viewid'
],
$postcontent
);
safe_require
(
'artefact'
,
'file'
);
$postcontent
=
ArtefactTypeFolder
::
append_view_url
(
$postcontent
,
$options
[
'viewid'
]);
}
}
$smarty
->
assign
(
'artefactdescription'
,
$postcontent
);
$smarty
->
assign
(
'artefactdescription'
,
$postcontent
);
$smarty
->
assign
(
'artefact'
,
$this
);
$smarty
->
assign
(
'artefact'
,
$this
);
...
...
htdocs/artefact/file/lib.php
View file @
bee22be8
...
@@ -881,6 +881,15 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
...
@@ -881,6 +881,15 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
return
$record
->
id
;
return
$record
->
id
;
}
}
// append the view id to to the end of image and anchor urls so they are visible to logged out users also
public
static
function
append_view_url
(
$postcontent
,
$view_id
)
{
$postcontent
=
preg_replace
(
'#(<a[^>]+href="[^>]+artefact/file/download\.php\?file=\d+)#'
,
'\1&view='
.
$view_id
,
$postcontent
);
$postcontent
=
preg_replace
(
'#(<img[^>]+src="[^>]+artefact/file/download\.php\?file=\d+)#'
,
'\1&view='
.
$view_id
,
$postcontent
);
$postcontent
=
preg_replace
(
'#(<img[^>]+src="([^>]+artefact/file/download\.php\?file=\d+&view=\d+)"[^>]*>)#'
,
'<a href="\2">\1</a>'
,
$postcontent
);
return
$postcontent
;
}
public
static
function
get_links
(
$id
)
{
public
static
function
get_links
(
$id
)
{
$wwwroot
=
get_config
(
'wwwroot'
);
$wwwroot
=
get_config
(
'wwwroot'
);
...
...
htdocs/blocktype/textbox/lib.php
View file @
bee22be8
...
@@ -43,6 +43,8 @@ class PluginBlocktypeTextbox extends SystemBlocktype {
...
@@ -43,6 +43,8 @@ class PluginBlocktypeTextbox extends SystemBlocktype {
public
static
function
render_instance
(
BlockInstance
$instance
)
{
public
static
function
render_instance
(
BlockInstance
$instance
)
{
$configdata
=
$instance
->
get
(
'configdata'
);
$configdata
=
$instance
->
get
(
'configdata'
);
$text
=
(
isset
(
$configdata
[
'text'
]))
?
$configdata
[
'text'
]
:
''
;
$text
=
(
isset
(
$configdata
[
'text'
]))
?
$configdata
[
'text'
]
:
''
;
safe_require
(
'artefact'
,
'file'
);
$text
=
ArtefactTypeFolder
::
append_view_url
(
$text
,
$instance
->
get
(
'view'
));
return
$text
;
return
$text
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment