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
64b7e234
Commit
64b7e234
authored
Nov 27, 2006
by
Richard Mansfield
Browse files
Views can be submitted from my views page
parent
ca3553c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/view/index.php
View file @
64b7e234
...
...
@@ -30,8 +30,8 @@ require(dirname(dirname(__FILE__)) . '/init.php');
$wwwroot
=
get_config
(
'wwwroot'
);
$strings
=
array
(
'accessstartdate'
,
'accessenddate'
,
'artefacts'
,
'delete'
,
'description'
,
'editaccess'
,
'editview'
,
'editviewinformation'
,
'submit
ted'
,
'submittedto
'
,
'submitview'
,
'unknownerror'
);
'editaccess'
,
'editview'
,
'editviewinformation'
,
'submitted'
,
'submittedto'
,
'submit
view
'
,
'submitview
question
'
,
'unknownerror'
);
$getstring
=
array
();
foreach
(
$strings
as
$string
)
{
$getstring
[
$string
]
=
"'"
.
get_string
(
$string
)
.
"'"
;
...
...
@@ -55,7 +55,7 @@ viewlist.rowfunction = function(r, n, data) {
description(r), artefacts(r)]);
}
function title(r, c) {
function title(r, c
ommunities
) {
var editinfo = INPUT({'type':'button','value':{$getstring['editviewinformation']}});
editinfo.onclick = function () { submitform(r.id, 'editinfo'); };
var edit = INPUT({'type':'button','value':{$getstring['editview']}});
...
...
@@ -65,10 +65,10 @@ function title(r, c) {
var del = INPUT({'type':'button','value':{$getstring['delete']}});
del.onclick = function () { submitform(r.id, 'delete'); };
if (r.submittedto) {
var assess = {$getstring['submitted
to
']} + ': ' + r.submittedto;
var assess = {$getstring['submitted']} + ': ' + r.submittedto;
}
else {
var assess = assessselect(r.id,c);
var assess = assessselect(r.id,c
ommunities
);
}
var f = FORM({'id':('form'+r.id),'method':'post','enctype':'multipart/form-data',
'encoding':'multipart/form-data','onsubmit':"return formsubmit('"+r.id+"');"},
...
...
@@ -79,15 +79,17 @@ function title(r, c) {
}
function communityoption(community) {
return OPTION({'
name':'community'+
community.id},community.name);
return OPTION({'
value':
community.id},community.name);
}
function assessselect(viewid, clist) {
if (clist.length < 1) {
function assessselect(viewid, c
ommunity
list) {
if (c
ommunity
list.length < 1) {
return null;
}
return [SELECT({'name':'community'},map(communityoption, clist)),
INPUT({'type':'button','value':{$getstring['submitview']}})];
var submitview = INPUT({'type':'button','value':{$getstring['submitview']}});
submitview.onclick = function () { submitform(viewid, 'submitview'); };
return [SELECT({'name':'community'},map(communityoption, communitylist)), submitview];
}
function startdate(r) {
...
...
@@ -124,6 +126,20 @@ function deleteview(viewid) {
return false;
}
function submitview(viewid, communityid) {
var answer = confirm({$getstring['submitviewquestion']});
if (!answer) {
return;
}
processingStart();
var req = getXMLHttpRequest();
req.open('POST','submit.json.php');
req.setRequestHeader('Content-type','application/x-www-form-urlencoded');
var d = sendXMLHttpRequest(req,queryString({'viewid':viewid,'communityid':communityid}));
d.addCallbacks(json_success, json_error);
return false;
}
function json_success(result) {
var data = evalJSONRequest(result);
var errtype = false;
...
...
@@ -153,6 +169,9 @@ function submitform(viewid, action) {
return deleteview(viewid);
}
var form = $('form' + viewid);
if (action == 'submitview') {
return submitview(viewid, form.community.value);
}
var page = 'index.php';
if (action == 'editinfo') {
page = 'editmetadata.php';
...
...
htdocs/view/submit.json.php
0 → 100644
View file @
64b7e234
<?php
/**
* This program is part of Mahara
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage admin
* @author Richard Mansfield <richard.mansfield@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define
(
'INTERNAL'
,
1
);
require
(
dirname
(
dirname
(
__FILE__
))
.
'/init.php'
);
$data
=
new
StdClass
;
$data
->
id
=
param_integer
(
'viewid'
);
$data
->
submittedto
=
param_integer
(
'communityid'
);
if
(
!
update_record
(
'view'
,
$data
,
'id'
))
{
json_reply
(
'local'
,
get_string
(
'submitviewfailed'
));
}
json_reply
(
false
,
get_string
(
'viewsubmitted'
));
?>
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