You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2014/11/07 20:48:13 UTC
svn commit: r1637437 - in /vcl/trunk/web: .ht-inc/errors.php
.ht-inc/image.php .ht-inc/resource.php js/resources/image.js
Author: jfthomps
Date: Fri Nov 7 19:48:12 2014
New Revision: 1637437
URL: http://svn.apache.org/r1637437
Log:
VCL-776 - rework resource code to have a base class for all resources and inheriting classes for each resource type
resource.php: modified AJstartImage: use $revid for value of $cdata['baserevisionid'] instead of getting it from $data['reservations']
image.php:
-modified createImage: get imageid from continuation instead of from request data; get baerevisionid from continuation instead of from request data. I was seeing a few problems where AJsaveResource was somehow getting submitted twice with the 2nd time using the imagerevisionid from the newly created image
-modified validateResourceData: include baserevisionid in returned data
errors.php: changed references to addImage to "Image::addResource"
image.js:
-modified saveResourceCB, updateImageCB, and submitUpdateImageClickthroughCB: enable clickthroughDlgBtn after hiding clickthroughdlg
-modified clickThroughAgree: disable clickthroughDlgBtn when it is clicked so it cannot be double clicked
-modified hideClickThroughDlg: check to see if each dialog is open before calling .hide() on it
Modified:
vcl/trunk/web/.ht-inc/errors.php
vcl/trunk/web/.ht-inc/image.php
vcl/trunk/web/.ht-inc/resource.php
vcl/trunk/web/js/resources/image.js
Modified: vcl/trunk/web/.ht-inc/errors.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/errors.php?rev=1637437&r1=1637436&r2=1637437&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/errors.php (original)
+++ vcl/trunk/web/.ht-inc/errors.php Fri Nov 7 19:48:12 2014
@@ -102,11 +102,11 @@ $ERRORS = array (
"195" => "Failed to execute query 1 in addComputer",
"198" => "Failed to execute query 3 in addComputer",
"200" => "Failed to execute query 1 in updateImage",
- "205" => "Failed to execute query 1 in addImage",
- "206" => "Failed to execute query 2 in addImage",
- "207" => "Failed to fetch last insert id in addImage",
- "208" => "Failed to execute query 3 in addImage",
- "209" => "Failed to execute query 4 in addImage",
+ "205" => "Failed to execute query 1 in Image::addResource",
+ "206" => "Failed to execute query 2 in Image::addResource",
+ "207" => "Failed to fetch last insert id in Image::addResource",
+ "208" => "Failed to execute query 3 in Image::addResource",
+ "209" => "Failed to execute query 4 in Image::addResource",
"210" => "Failed to execute query 1 in submitDeleteImage",
"211" => "Failed to execute query 2 in submitDeleteImage",
"212" => "Failed to execute query 3 in submitDeleteImage",
Modified: vcl/trunk/web/.ht-inc/image.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/image.php?rev=1637437&r1=1637436&r2=1637437&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/image.php (original)
+++ vcl/trunk/web/.ht-inc/image.php Fri Nov 7 19:48:12 2014
@@ -712,7 +712,7 @@ class Image extends Resource {
'add' => 1,
'checkpoint' => $checkpoint,
'fromclickthrough' => 1);
- $cont = addContinuationsEntry('AJsaveResource', $cdata);
+ $cont = addContinuationsEntry('AJsaveResource', $cdata, SECINDAY, 0, 0);
$ret = array('status' => 'success',
'action' => 'clickthrough',
'agree' => $agree,
@@ -722,11 +722,10 @@ class Image extends Resource {
}
// get extra data from base image
- $requestdata = getRequestInfo($data['requestid']);
- $imagedata = getImages(0, $requestdata["reservations"][0]["imageid"]);
- $data["platformid"] = $imagedata[$requestdata["reservations"][0]["imageid"]]["platformid"];
- $data["osid"] = $imagedata[$requestdata["reservations"][0]["imageid"]]["osid"];
- $data["basedoffrevisionid"] = $requestdata["reservations"][0]["imagerevisionid"];
+ $imagedata = getImages(0, $data["imageid"]);
+ $data["platformid"] = $imagedata[$data["imageid"]]["platformid"];
+ $data["osid"] = $imagedata[$data["imageid"]]["osid"];
+ $data["basedoffrevisionid"] = $data["baserevisionid"];
$data["reload"] = 10;
$data["autocaptured"] = 0;
@@ -1391,6 +1390,7 @@ class Image extends Resource {
$return['requestid'] = getContinuationVar('requestid'); # only in add
$return["imageid"] = getContinuationVar('imageid');
+ $return['baserevisionid'] = getContinuationVar('baserevisionid');
$return["desc"] = processInputVar("desc", ARG_STRING);
if(get_magic_quotes_gpc())
Modified: vcl/trunk/web/.ht-inc/resource.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/resource.php?rev=1637437&r1=1637436&r2=1637437&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/resource.php (original)
+++ vcl/trunk/web/.ht-inc/resource.php Fri Nov 7 19:48:12 2014
@@ -1648,7 +1648,7 @@ function AJstartImage() {
$cdata = array('obj' => $obj,
'requestid' => $requestid,
'imageid' => $imageid,
- 'baserevisionid' => $data['reservations'][0]['imagerevisionid'],
+ 'baserevisionid' => $revid,
'checkpoint' => $checkpoint,
'add' => 1);
$cont = addContinuationsEntry('AJsaveResource', $cdata, SECINDAY, 0);
Modified: vcl/trunk/web/js/resources/image.js
URL: http://svn.apache.org/viewvc/vcl/trunk/web/js/resources/image.js?rev=1637437&r1=1637436&r2=1637437&view=diff
==============================================================================
--- vcl/trunk/web/js/resources/image.js (original)
+++ vcl/trunk/web/js/resources/image.js Fri Nov 7 19:48:12 2014
@@ -218,17 +218,20 @@ function saveResourceCB(data, ioArgs) {
else if(data.items.status == 'adderror') {
alert(data.items.errormsg);
dijit.byId('clickthroughdlg').hide();
+ dijit.byId('clickthroughDlgBtn').set('disabled', false);
}
else if(data.items.status == 'success') {
if(data.items.action == 'clickthrough') {
dojo.byId('addresourcecont').value = data.items.cont;
dojo.byId('clickthroughDlgContent').innerHTML = data.items.agree;
dijit.byId('addeditbtn').set('disabled', false);
+ dijit.byId('clickthroughDlgBtn').set('disabled', false);
dijit.byId('clickthroughdlg').show();
return;
}
else if(data.items.action == 'add') {
dijit.byId('clickthroughdlg').hide();
+ dijit.byId('clickthroughDlgBtn').set('disabled', false);
resRefresh();
}
else {
@@ -560,8 +563,10 @@ function hideUpdateImageDlg() {
}
function hideClickThroughDlg() {
- dijit.byId('addeditdlg').hide();
- dijit.byId('updateimagedlg').hide();
+ if(dijit.byId('addeditdlg').open)
+ dijit.byId('addeditdlg').hide();
+ if(dijit.byId('updateimagedlg').open)
+ dijit.byId('updateimagedlg').hide();
}
function startImage(cont) {
@@ -651,6 +656,7 @@ function updateImageCB(data, ioArgs) {
if(data.items.action == 'clickthrough') {
dojo.byId('updateimage').value = data.items.cont;
dojo.byId('clickthroughDlgContent').innerHTML = data.items.agree;
+ dijit.byId('clickthroughDlgBtn').set('disabled', false);
dijit.byId('clickthroughdlg').show();
return;
}
@@ -663,6 +669,7 @@ function updateImageCB(data, ioArgs) {
}
function clickThroughAgree() {
+ dijit.byId('clickthroughDlgBtn').set('disabled', true);
if(dijit.byId('addeditdlg').open)
saveResource();
else if(dijit.byId('updateimagedlg').open)
@@ -679,15 +686,18 @@ function submitUpdateImageClickthroughCB
alert('You must be the owner of the image to update it.');
dijit.byId('updateimagedlg').hide();
dijit.byId('clickthroughdlg').hide();
+ dijit.byId('clickthroughDlgBtn').set('disabled', false);
return;
}
else if(data.items.status == 'error') {
alert(data.items.errmsg);
dijit.byId('updateimagedlg').hide();
dijit.byId('clickthroughdlg').hide();
+ dijit.byId('clickthroughDlgBtn').set('disabled', false);
return;
}
dijit.byId('updateimagedlg').hide();
dijit.byId('clickthroughdlg').hide();
+ dijit.byId('clickthroughDlgBtn').set('disabled', false);
resRefresh();
}