Commit 5ecfab4e authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add delete view confirmation box

parent a8743133
......@@ -204,6 +204,7 @@ $string['accessstopdate'] = 'Access end date';
$string['artefacts'] = 'Artefacts';
$string['createnewview'] = 'Create New View';
$string['deleteviewfailed'] = 'Delete view failed';
$string['deleteviewquestion'] = 'Do you really want to delete this view?';
$string['description'] = 'Description';
$string['editaccess'] = 'Edit Access';
$string['editview'] = 'Edit View';
......
......@@ -29,8 +29,8 @@ require(dirname(dirname(__FILE__)) . '/init.php');
$wwwroot = get_config('wwwroot');
$strings = array('accessstartdate', 'accessstopdate', 'artefacts', 'delete', 'description',
'editaccess', 'editview', 'editviewinformation', 'submitted',
$strings = array('accessstartdate', 'accessstopdate', 'artefacts', 'delete', 'deleteviewquestion',
'description', 'editaccess', 'editview', 'editviewinformation', 'submitted',
'submitview', 'submitviewquestion', 'unknownerror');
$getstring = array();
foreach ($strings as $string) {
......@@ -116,27 +116,28 @@ function artefacts(r) {
TD(null,UL(null,map(renderartefact,r.artefacts)))];
}
function deleteview(viewid) {
function sendjsonrequest(script, data) {
processingStart();
var req = getXMLHttpRequest();
req.open('POST','delete.json.php');
req.open('POST', script);
req.setRequestHeader('Content-type','application/x-www-form-urlencoded');
var d = sendXMLHttpRequest(req,queryString({'viewid':viewid}));
var d = sendXMLHttpRequest(req,queryString(data));
d.addCallbacks(json_success, json_error);
}
function deleteview(viewid) {
if (!confirm({$getstring['deleteviewquestion']})) {
return;
}
sendjsonrequest('delete.json.php', {'viewid':viewid});
return false;
}
function submitview(viewid, communityid) {
var answer = confirm({$getstring['submitviewquestion']});
if (!answer) {
if (!confirm({$getstring['submitviewquestion']})) {
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);
sendjsonrequest('submit.json.php', {'viewid':viewid,'communityid':communityid});
return false;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment