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
a4460cc0
Commit
a4460cc0
authored
Nov 03, 2008
by
Richard Mansfield
Browse files
Fix ajax submission in add feedback, objectionable content forms
parent
7d63f2d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/js/feedbacklist.js
View file @
a4460cc0
...
...
@@ -55,6 +55,17 @@ feedbacklist.rowfunction = function(r, n, d) {
};
feedbacklist
.
emptycontent
=
get_string
(
'
nopublicfeedback
'
);
function
addFeedbackSuccess
()
{
hideElement
(
'
add_feedback_form
'
);
$
(
'
add_feedback_form_message
'
).
innerHTML
=
''
;
feedbacklist
.
doupdate
();
}
function
objectionSuccess
()
{
hideElement
(
'
objection_form
'
);
$
(
'
objection_form_message
'
).
innerHTML
=
''
;
}
addLoadEvent
(
function
()
{
hideElement
(
'
add_feedback_form
'
);
if
(
$
(
'
add_feedback_link
'
))
{
...
...
htdocs/lib/view.php
View file @
a4460cc0
...
...
@@ -2185,7 +2185,9 @@ function add_feedback_form($attachments=false) {
'method'
=>
'post'
,
'plugintype'
=>
'core'
,
'pluginname'
=>
'view'
,
'jsform'
=>
true
,
'elements'
=>
array
(),
'jssuccesscallback'
=>
'addFeedbackSuccess'
,
);
if
(
!
$USER
->
is_logged_in
())
{
$form
[
'elements'
][
'authorname'
]
=
array
(
...
...
@@ -2230,7 +2232,7 @@ function add_feedback_form_validate(Pieform $form, $values) {
}
function
add_feedback_form_submit
(
Pieform
$form
,
$values
)
{
global
$view
,
$artefact
,
$SESSION
,
$USER
;
global
$view
,
$artefact
,
$USER
;
$data
=
new
StdClass
;
$data
->
view
=
$view
->
get
(
'id'
);
if
(
$artefact
)
{
...
...
@@ -2251,11 +2253,22 @@ function add_feedback_form_submit(Pieform $form, $values) {
insert_record
(
$table
,
$data
,
'id'
,
true
);
require_once
(
'activity.php'
);
activity_occurred
(
'feedback'
,
$data
);
$SESSION
->
add_ok_msg
(
get_string
(
'feedbacksubmitted'
,
'view'
));
if
(
$artefact
)
{
redirect
(
get_config
(
'wwwroot'
)
.
'view/artefact.php?artefact='
.
$artefact
->
get
(
'id'
)
.
'&view='
.
$view
->
get
(
'id'
)
)
;
$goto
=
get_config
(
'wwwroot'
)
.
'view/artefact.php?artefact='
.
$artefact
->
get
(
'id'
)
.
'&view='
.
$view
->
get
(
'id'
);
}
redirect
(
get_config
(
'wwwroot'
)
.
'view/view.php?id='
.
$view
->
get
(
'id'
));
else
{
$goto
=
get_config
(
'wwwroot'
)
.
'view/view.php?id='
.
$view
->
get
(
'id'
);
}
$form
->
reply
(
PIEFORM_OK
,
array
(
'message'
=>
get_string
(
'feedbacksubmitted'
,
'view'
),
'goto'
=>
$goto
,
));
}
function
add_feedback_form_cancel_submit
(
Pieform
$form
)
{
$form
->
reply
(
PIEFORM_OK
,
array
(
'goto'
=>
''
,
));
}
function
objection_form
()
{
...
...
@@ -2264,7 +2277,9 @@ function objection_form() {
'method'
=>
'post'
,
'plugintype'
=>
'core'
,
'pluginname'
=>
'view'
,
'jsform'
=>
true
,
'elements'
=>
array
(),
'jssuccesscallback'
=>
'objectionSuccess'
,
);
$form
[
'elements'
][
'message'
]
=
array
(
'type'
=>
'textarea'
,
...
...
@@ -2280,7 +2295,7 @@ function objection_form() {
}
function
objection_form_submit
(
Pieform
$form
,
$values
)
{
global
$USER
,
$SESSION
,
$view
,
$artefact
;
global
$USER
,
$view
,
$artefact
;
require_once
(
'activity.php'
);
$data
=
new
StdClass
;
...
...
@@ -2292,11 +2307,22 @@ function objection_form_submit(Pieform $form, $values) {
}
activity_occurred
(
'objectionable'
,
$data
);
$SESSION
->
add_ok_msg
(
get_string
(
'reportsent'
,
'view'
));
if
(
$artefact
)
{
redirect
(
get_config
(
'wwwroot'
)
.
'view/artefact.php?artefact='
.
$artefact
->
get
(
'id'
)
.
'&view='
.
$view
->
get
(
'id'
)
)
;
$goto
=
get_config
(
'wwwroot'
)
.
'view/artefact.php?artefact='
.
$artefact
->
get
(
'id'
)
.
'&view='
.
$view
->
get
(
'id'
);
}
redirect
(
get_config
(
'wwwroot'
)
.
'view/view.php?id='
.
$view
->
get
(
'id'
));
else
{
$goto
=
get_config
(
'wwwroot'
)
.
'view/view.php?id='
.
$view
->
get
(
'id'
);
}
$form
->
reply
(
PIEFORM_OK
,
array
(
'message'
=>
get_string
(
'reportsent'
,
'view'
),
'goto'
=>
$goto
,
));
}
function
objection_form_cancel_submit
(
Pieform
$form
)
{
$form
->
reply
(
PIEFORM_OK
,
array
(
'goto'
=>
''
,
));
}
...
...
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