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
694cc595
Commit
694cc595
authored
Aug 20, 2009
by
Richard Mansfield
Browse files
Rewrite blog list to use artefactchooser paginator
parent
6b8e261d
Changes
5
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/blog/index.php
View file @
694cc595
...
...
@@ -78,9 +78,10 @@ define('SECTION_PAGE', 'index');
ArtefactTypeBlog
::
build_blog_list_html
(
$blogs
);
$smarty
=
smarty
();
$smarty
=
smarty
(
array
(
'paginator'
)
);
$smarty
->
assign_by_ref
(
'blogs'
,
$blogs
);
$smarty
->
assign
(
'PAGEHEADING'
,
hsc
(
get_string
(
"myblogs"
,
"artefact.blog"
)));
$smarty
->
assign
(
'INLINEJAVASCRIPT'
,
'addLoadEvent(function() {'
.
$blogs
->
pagination_js
.
'});'
);
$smarty
->
display
(
'artefact:blog:index.tpl'
);
?>
htdocs/artefact/blog/lib.php
View file @
694cc595
...
...
@@ -288,11 +288,13 @@ class ArtefactTypeBlog extends ArtefactType {
public
static
function
build_blog_list_html
(
&
$blogs
)
{
$smarty
=
smarty_core
();
$smarty
->
assign_by_ref
(
'blogs'
,
$blogs
);
$blogs
->
html
=
$smarty
->
fetch
(
'artefact:blog:bloglist.tpl'
);
$
blogs
->
pagination
=
build_pagination
(
array
(
$blogs
->
tablerows
=
$smarty
->
fetch
(
'artefact:blog:bloglist.tpl'
);
$pagination
=
build_pagination
(
array
(
'id'
=>
'bloglist_pagination'
,
'class'
=>
'center'
,
'url'
=>
get_config
(
'wwwroot'
)
.
'artefact/blog/index.php'
,
'jsonscript'
=>
'artefact/blog/index.json.php'
,
'datatable'
=>
'bloglist'
,
'count'
=>
$blogs
->
count
,
'limit'
=>
$blogs
->
limit
,
'offset'
=>
$blogs
->
offset
,
...
...
@@ -304,6 +306,8 @@ class ArtefactTypeBlog extends ArtefactType {
'resultcounttextsingular'
=>
get_string
(
'blog'
,
'artefact.blog'
),
'resultcounttextplural'
=>
get_string
(
'blogs'
,
'artefact.blog'
),
));
$blogs
->
pagination
=
$pagination
[
'html'
];
$blogs
->
pagination_js
=
$pagination
[
'javascript'
];
}
/**
...
...
htdocs/artefact/blog/theme/raw/bloglist.tpl
View file @
694cc595
{
if
empty
(
$blogs
->
data
)
}
<div>
{
str
tag
=
youhavenoblogs
section
=
artefact
.
blog
}
</div>
{
else
}
<table
class=
"tablerenderer fullwidth"
>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{
foreach
from
=
$blogs
->
data
item
=
blog
}
<tr
class=
"
{
cycle
name
=
rows
values
=
r1
,
r0
}
"
>
<td>
...
...
@@ -22,6 +11,3 @@
</td>
</tr>
{/
foreach
}
</tbody>
</table>
{/
if
}
htdocs/artefact/blog/theme/raw/index.tpl
View file @
694cc595
...
...
@@ -3,8 +3,17 @@
<div
class=
"rbuttons"
>
<a
class=
"btn-add"
href=
"
{
$WWWROOT
}
artefact/blog/new/"
>
{
str
section
=
"artefact.blog"
tag
=
"addblog"
}
</a>
</div>
<div
id=
"bloglist"
>
{
$blogs
->
html
}
</div>
{
if
$blogs
->
data
}{
$blogs
->
pagination
.
html
}{/
if
}
{
if
empty
(
$blogs
->
data
)
}
<div>
{
str
tag
=
youhavenoblogs
section
=
artefact
.
blog
}
</div>
{
else
}
<table
id=
"bloglist"
class=
"tablerenderer fullwidth"
>
<thead>
<tr><th></th><th></th></tr>
</thead>
<tbody>
{
$blogs
->
tablerows
}
</tbody>
</table>
{
$blogs
->
pagination
}
{/
if
}
{
include
file
=
"footer.tpl"
}
htdocs/js/paginator.js
View file @
694cc595
...
...
@@ -80,8 +80,8 @@ var Paginator = function(id, datatable, script, extradata) {
// Update the result count
var
results
=
getFirstElementByTagAndClassName
(
'
div
'
,
'
results
'
,
self
.
id
);
if
(
results
)
{
results
.
innerHTML
=
data
[
'
data
'
][
'
results
'
]
;
if
(
results
&&
data
.
data
.
results
)
{
results
.
innerHTML
=
data
.
data
.
results
;
}
}
...
...
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