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
92591a59
Commit
92591a59
authored
Jan 25, 2007
by
Richard Mansfield
Browse files
Fix view artefact breadcrumbs by adding artefact path to urls
parent
ada3dcd8
Changes
4
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/blog/lib.php
View file @
92591a59
...
...
@@ -213,6 +213,8 @@ class ArtefactTypeBlog extends ArtefactType {
?
$options
[
'blockid'
]
:
mt_rand
();
$this
->
add_to_render_path
(
$options
);
// This uses the above blockid, so needs to be inlcuded after.
$javascript
=
require
(
get_config
(
'docroot'
)
.
'artefact/blog/render/blog_listchildren.js.php'
);
...
...
@@ -245,6 +247,8 @@ class ArtefactTypeBlog extends ArtefactType {
?
$options
[
'blockid'
]
:
mt_rand
();
$this
->
add_to_render_path
(
$options
);
// This uses the above blockid, so needs to be inlcuded after.
$javascript
=
require
(
get_config
(
'docroot'
)
.
'artefact/blog/render/blog_renderfull.js.php'
);
...
...
@@ -466,6 +470,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
$smarty
->
assign
(
'artefact'
,
$this
);
$attachments
=
$this
->
get_attached_files
();
if
(
$attachments
)
{
$this
->
add_to_render_path
(
$options
);
require_once
(
'artefact.php'
);
foreach
(
$attachments
as
&
$attachment
)
{
$f
=
artefact_instance_from_id
(
$attachment
->
id
);
...
...
htdocs/artefact/file/lib.php
View file @
92591a59
...
...
@@ -542,6 +542,7 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
}
$smarty
->
assign
(
'options'
,
array_merge
(
array
(
'date'
=>
true
,
'icon'
=>
true
),
$options
));
if
(
$childrecords
=
$this
->
folder_contents
())
{
$this
->
add_to_render_path
(
$options
);
usort
(
$childrecords
,
array
(
"ArtefactTypeFileBase"
,
"my_files_cmp"
));
$children
=
array
();
require_once
(
'artefact.php'
);
...
...
@@ -559,6 +560,7 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
public
function
listchildren
(
$options
)
{
$smarty
=
smarty
();
if
(
$childrecords
=
$this
->
folder_contents
())
{
$this
->
add_to_render_path
(
$options
);
usort
(
$childrecords
,
array
(
"ArtefactTypeFileBase"
,
"my_files_cmp"
));
$children
=
array
();
require_once
(
'artefact.php'
);
...
...
htdocs/artefact/lib.php
View file @
92591a59
...
...
@@ -454,6 +454,17 @@ abstract class ArtefactType {
}
public
function
add_to_render_path
(
&
$options
)
{
if
(
empty
(
$options
[
'path'
]))
{
$options
[
'path'
]
=
$this
->
get
(
'id'
);
}
else
{
$options
[
'path'
]
.
=
','
.
$this
->
get
(
'id'
);
}
}
/**
* list artefact children. There's a default for this, but we only use it
* if the class thinks it can render FORMAT_ARTEFACT_LISTCHILDREN.
...
...
@@ -484,7 +495,11 @@ abstract class ArtefactType {
require_once
(
'artefact.php'
);
if
(
artefact_in_view
(
$id
=
$this
->
get
(
'id'
),
$options
[
'viewid'
]))
{
$title
=
'<a href="'
.
get_config
(
'wwwroot'
)
.
'view/view.php?view='
.
$options
[
'viewid'
]
.
'&artefact='
.
$id
.
'">'
.
$this
->
title
.
'</a>'
;
.
'&artefact='
.
$id
;
if
(
!
empty
(
$options
[
'path'
]))
{
$title
.
=
'&path='
.
$options
[
'path'
];
}
$title
.
=
'">'
.
$this
->
title
.
'</a>'
;
}
}
if
(
!
isset
(
$title
))
{
...
...
htdocs/view/view.php
View file @
92591a59
...
...
@@ -30,20 +30,25 @@ require(get_config('libroot') . 'view.php');
$viewid
=
param_integer
(
'view'
);
$artefactid
=
param_integer
(
'artefact'
,
null
);
$path
=
param_variable
(
'path'
,
null
);
$view
=
new
View
(
$viewid
);
if
(
!
can_view_view
(
$viewid
))
{
throw
new
AccessDeniedException
();
}
if
(
$artefactid
)
{
require_once
(
'artefact.php'
);
$artefact
=
artefact_instance_from_id
(
$artefactid
);
$title
=
$artefact
->
get
(
'title'
);
if
(
!
artefact_in_view
(
$artefactid
,
$viewid
))
{
throw
new
AccessDeniedException
(
"Artefact
$artefactid
not in View
$viewid
"
);
}
require_once
(
'artefact.php'
);
$artefact
=
artefact_instance_from_id
(
$artefactid
);
$feedbackisprivate
=
!
$artefact
->
public_feedback_allowed
();
$options
=
array
(
'viewid'
=>
$viewid
);
$options
=
array
(
'viewid'
=>
$viewid
,
'path'
=>
$path
);
if
(
in_array
(
FORMAT_ARTEFACT_RENDERFULL
,
$artefact
->
get_render_list
()))
{
$content
=
$artefact
->
render
(
FORMAT_ARTEFACT_RENDERFULL
,
$options
);
}
...
...
@@ -51,20 +56,24 @@ if ($artefactid) {
$content
=
$artefact
->
render
(
FORMAT_ARTEFACT_RENDERMETADATA
,
$options
);
}
// Link ancestral artefacts back to the view
$hierarchy
=
$view
->
get_artefact_hierarchy
();
$artefact
=
$hierarchy
[
'refs'
][
$artefactid
];
$ancestorid
=
$artefact
->
parent
;
$navlist
=
array
(
'<a href="view.php?view='
.
$viewid
.
'">'
.
$view
->
get
(
'title'
)
.
'</a>'
);
while
(
$ancestorid
&&
isset
(
$hierarchy
[
'refs'
][
$ancestorid
]))
{
$ancestor
=
$hierarchy
[
'refs'
][
$ancestorid
];
$link
=
'<a href="view.php?view='
.
$viewid
.
'&artefact='
.
$ancestorid
.
'">'
.
$ancestor
->
title
.
"</a>
\n
"
;
array_push
(
$navlist
,
$link
);
$ancestorid
=
$ancestor
->
parent
;
$viewhref
=
'view.php?view='
.
$viewid
;
$navlist
=
array
(
'<a href="'
.
$viewhref
.
'">'
.
$view
->
get
(
'title'
)
.
'</a>'
);
if
(
!
empty
(
$path
))
{
$titles
=
get_records_sql_assoc
(
'
SELECT id,title FROM '
.
get_config
(
'dbprefix'
)
.
'artefact
WHERE id IN ('
.
$path
.
')'
,
''
);
$artefactids
=
split
(
','
,
$path
);
for
(
$i
=
0
;
$i
<
count
(
$artefactids
);
$i
++
)
{
if
(
$artefactid
==
$artefactid
[
$i
])
{
break
;
}
array_push
(
$navlist
,
'<a href="'
.
$viewhref
.
'&artefact='
.
$artefactids
[
$i
]
.
(
$i
>
0
?
'&path='
.
join
(
','
,
array_slice
(
$artefactids
,
0
,
$i
))
:
''
)
.
'">'
.
$titles
[
$artefactids
[
$i
]]
->
title
.
'</a>'
);
}
}
//
array_push($navlist, $artefact->title);
array_push
(
$navlist
,
$title
);
array_push
(
$navlist
,
$artefact
->
get
(
'
title
'
)
);
$jsartefact
=
$artefactid
;
}
else
{
...
...
Write
Preview
Markdown
is supported
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