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
34622b9e
Commit
34622b9e
authored
Jan 24, 2007
by
Nigel McNie
Committed by
Nigel McNie
Jan 24, 2007
Browse files
Merge with
git+ssh://git.catalyst.net.nz/var/git/mahara.git#master
parents
ad744e38
5da54068
Changes
6
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/blog/lib.php
View file @
34622b9e
...
...
@@ -706,7 +706,10 @@ class ArtefactTypeBlogPost extends ArtefactType {
$data
->
blogpost
=
$this
->
id
;
$data
->
file
=
$fileid
;
insert_record
(
'artefact_blog_blogpost_file'
,
$data
);
$data
->
artefact
=
$data
->
file
;
$data
->
parent
=
$data
->
blogpost
;
$data
->
dirty
=
true
;
insert_record
(
'artefact_parent_cache'
,
$data
);
return
$fileid
;
}
...
...
htdocs/lib/artefact.php
View file @
34622b9e
...
...
@@ -58,9 +58,10 @@ function artefact_check_plugin_sanity($pluginname) {
function
rebuild_artefact_parent_cache_dirty
()
{
// this will give us a list of artefacts, as the first returned column
// is not unqiue, but that's ok, it's what we want.
if
(
!
$dirty
=
get_records_array
(
'artefact_parent_cache'
,
'dirty'
,
1
))
{
if
(
!
$dirty
=
get_records_array
(
'artefact_parent_cache'
,
'dirty'
,
1
,
''
,
'DISTINCT(artefact)'
))
{
return
;
}
$blogsinstalled
=
get_field
(
'artefact_installed'
,
'active'
,
'name'
,
'blog'
);
db_begin
();
delete_records
(
'artefact_parent_cache'
,
'dirty'
,
1
);
foreach
(
$dirty
as
$d
)
{
...
...
@@ -74,6 +75,15 @@ function rebuild_artefact_parent_cache_dirty() {
break
;
}
$parentids
[]
=
$parent
->
parent
;
// get any blog posts it may be attached to
if
(
$parent
->
artefacttype
==
'file'
&&
$blogsinstalled
&&
$associated
=
get_column
(
'artefact_blog_blogpost_file'
,
'blogpost'
,
'file'
,
$parent
->
id
))
{
foreach
(
$associated
as
$a
)
{
if
(
!
in_array
(
$a
,
$parentids
))
{
$parentids
[]
=
$a
;
}
}
}
$current
=
$parent
->
parent
;
}
foreach
(
$parentids
as
$p
)
{
...
...
@@ -90,26 +100,36 @@ function rebuild_artefact_parent_cache_dirty() {
function
rebuild_artefact_parent_cache_complete
()
{
db_begin
();
delete_records
(
'artefact_parent_cache'
);
$artefacts
=
get_records_array
(
'artefact'
);
foreach
(
$artefacts
as
$a
)
{
$parentids
=
array
();
$current
=
$a
->
id
;
while
(
true
)
{
if
(
!
$parent
=
get_record
(
'artefact'
,
'id'
,
$current
))
{
break
;
if
(
$artefacts
=
get_records_array
(
'artefact'
))
{
foreach
(
$artefacts
as
$a
)
{
$parentids
=
array
();
$current
=
$a
->
id
;
while
(
true
)
{
if
(
!
$parent
=
get_record
(
'artefact'
,
'id'
,
$current
))
{
break
;
}
if
(
!
$parent
->
parent
)
{
break
;
}
$parentids
[]
=
$parent
->
parent
;
// get any blog posts it may be attached to
if
(
$parent
->
artefacttype
==
'file'
&&
$blogsinstalled
&&
$associated
=
get_column
(
'artefact_blog_blogpost_file'
,
'blogpost'
,
'file'
,
$parent
->
id
))
{
foreach
(
$associated
as
$a
)
{
if
(
!
in_array
(
$a
,
$parentids
))
{
$parentids
[]
=
$a
;
}
}
}
$current
=
$parent
->
parent
;
}
if
(
!
$parent
->
parent
)
{
break
;
foreach
(
$parentids
as
$p
)
{
$apc
=
new
StdClass
;
$apc
->
artefact
=
$a
->
id
;
$apc
->
parent
=
$p
;
$apc
->
dirty
=
0
;
insert_record
(
'artefact_parent_cache'
,
$apc
);
}
$parentids
[]
=
$parent
->
parent
;
$current
=
$parent
->
parent
;
}
foreach
(
$parentids
as
$p
)
{
$apc
=
new
StdClass
;
$apc
->
artefact
=
$a
->
id
;
$apc
->
parent
=
$p
;
$apc
->
dirty
=
0
;
insert_record
(
'artefact_parent_cache'
,
$apc
);
}
}
db_commit
();
...
...
htdocs/lib/cron.php
View file @
34622b9e
...
...
@@ -24,8 +24,9 @@
*
*/
define
(
'INTERNAL'
,
1
);
define
(
'PUBLIC'
,
1
);
define
(
'INTERNAL'
,
1
);
define
(
'PUBLIC'
,
1
);
define
(
'CRON'
,
1
);
/**
* This defines (in seconds) how far PAST the next run time of a cron job
...
...
htdocs/lib/errors.php
View file @
34622b9e
...
...
@@ -464,6 +464,11 @@ class MaharaException extends Exception {
echo
json_encode
(
array
(
'error'
=>
true
,
'message'
=>
$this
->
render_exception
()));
exit
;
}
if
(
defined
(
'CRON'
))
{
echo
$this
->
render_exception
();
exit
;
}
$outputtitle
=
$this
->
get_string
(
'title'
);
$outputmessage
=
$this
->
render_exception
();
...
...
htdocs/view/getfeedback.json.php
View file @
34622b9e
...
...
@@ -42,26 +42,38 @@ $userid = $USER->get('id');
if
(
$artefact
)
{
$owner
=
get_field
(
'artefact'
,
'owner'
,
'id'
,
$artefact
);
$public
=
(
int
)
(
$owner
!=
$userid
);
$feedback
=
get_records_sql_array
(
'SELECT id, author, ctime, message, public
$count
=
count_records_sql
(
'
SELECT
COUNT(*)
FROM '
.
$prefix
.
'artefact_feedback
WHERE view = '
.
$view
.
' AND artefact = '
.
$artefact
.
(
$public
?
' AND (public = 1 OR author = '
.
$userid
.
')'
:
''
)
.
'
.
(
$public
?
' AND (public = 1 OR author = '
.
$userid
.
')'
:
''
));
$feedback
=
get_records_sql_array
(
'
SELECT
id, author, ctime, message, public
FROM '
.
$prefix
.
'artefact_feedback
WHERE view = '
.
$view
.
' AND artefact = '
.
$artefact
.
(
$public
?
' AND (public = 1 OR author = '
.
$userid
.
')'
:
''
)
.
'
ORDER BY id DESC'
,
''
,
$offset
,
$limit
);
$count
=
count_records
(
'artefact_feedback'
,
'view'
,
$view
,
'artefact'
,
$artefact
,
'public'
,
$public
);
}
else
{
$owner
=
get_field
(
'view'
,
'owner'
,
'id'
,
$view
);
$public
=
(
int
)
(
$owner
!=
$userid
);
$public
=
(
$owner
!=
$userid
);
$count
=
count_records_sql
(
'
SELECT
COUNT(*)
FROM '
.
$prefix
.
'view_feedback
WHERE view = '
.
$view
.
(
$public
?
' AND (public = 1 OR author = '
.
$userid
.
')'
:
''
));
$feedback
=
get_records_sql_array
(
'
SELECT
f.id, f.author, f.ctime, f.message, f.public, f.attachment, a.title
FROM '
.
$prefix
.
'view_feedback f
LEFT OUTER JOIN '
.
$prefix
.
'artefact a ON f.attachment = a.id
WHERE view = '
.
$view
.
(
$public
?
' AND (f.public = 1 OR f.author = '
.
$userid
.
')'
:
''
)
.
'
.
(
$public
?
' AND (f.public = 1 OR f.author = '
.
$userid
.
')'
:
''
)
.
'
ORDER BY id DESC'
,
''
,
$offset
,
$limit
);
$count
=
count_records
(
'view_feedback'
,
'view'
,
$view
,
'public'
,
$public
);
}
$data
=
array
();
...
...
@@ -84,6 +96,7 @@ if ($feedback) {
}
$result
=
array
(
'count'
=>
$count
,
'limit'
=>
$limit
,
...
...
htdocs/view/view.php
View file @
34622b9e
...
...
@@ -188,10 +188,12 @@ function view_menu() {
}
appendChildNodes('viewmenu',
A({'href':'', 'onclick':"return feedbackform();"}, {$getstring['placefeedback']}), ' | ',
A({'href':'', 'onclick':"return feedbackform();"},
{$getstring['placefeedback']}), ' | ',
A({'href':'', 'onclick':'return objectionform();'},
{$getstring['reportobjectionablematerial']}), ' | ',
A({'href':'', 'onclick':'window.print();'}, {$getstring['print']}), ' | ',
A({'href':'', 'onclick':'window.print();'},
{$getstring['print']}), ' | ',
A({'href':'', 'onclick':'return addtowatchlist(false);'},
{$getstring['addtowatchlist']}), ' | ',
A({'href':'', 'onclick':'return addtowatchlist(true);'},
...
...
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