modified the project/add API to not expect any data, but simply create the project.

This commit is contained in:
jacob 2011-02-18 16:14:23 +00:00
parent 3745d8cfd9
commit ef4a14a386
2 changed files with 10 additions and 7 deletions

15
api.php
View File

@ -870,7 +870,6 @@ switch($request[0]) {
switch($request[1]){ switch($request[1]){
/* APIDOC: project/add /* APIDOC: project/add
description(add a project) description(add a project)
post(projectdivisions_id integer, title varchar(255), language char(2), req_electricity enum('no', 'yes'), req_table enum('no', 'yes'), req_special varchar(128), summary text)
return(project array) return(project array)
*/ */
case 'add': case 'add':
@ -898,6 +897,13 @@ switch($request[0]) {
break; break;
} }
// if we got this far, then all's good and we can return the project data
$ret['status'] = 'ok';
$ret['project'] = getProject($regNumber);
break;
// remarking this code for now as it may get used very shortly for a project update
// functionality. Was previously in the "add" post
/*
// and then save the posted data to that project // and then save the posted data to that project
$params['project_id'] = $project['id']; $params['project_id'] = $project['id'];
foreach($_POST as $fieldName){ foreach($_POST as $fieldName){
@ -909,12 +915,9 @@ switch($request[0]) {
$ret['error'] = $message; $ret['error'] = $message;
break; break;
} }
// if we got thes far, then all's good and we can return the project data
$ret['status'] = 'ok';
$ret['project'] = getProject($regNumber);
break; break;
*/
/* APIDOC: project/edit /* APIDOC: project/edit
post(project_id integer, projectdivisions_id integer, title varchar(255), language char(2), req_electricity enum('no', 'yes'), req_table enum('no', 'yes'), req_special varchar(128), summary text) post(project_id integer, projectdivisions_id integer, title varchar(255), language char(2), req_electricity enum('no', 'yes'), req_table enum('no', 'yes'), req_special varchar(128), summary text)

View File

@ -593,7 +593,7 @@ function saveProjectData($data){
//get a random registration number between 100000 and 999999 (six digit integer) //get a random registration number between 100000 and 999999 (six digit integer)
// that isn't already in use // that isn't already in use
//TODO - set up a method or ensuring that the very unlikely chance of two people simultaneously //TODO - set up a method of ensuring that the very unlikely chance of two people simultaneously
// getting the same number is in fact impossible // getting the same number is in fact impossible
function getNewRegNum(){ function getNewRegNum(){
global $conference; global $conference;