diff --git a/devdocs/specs/core-customize-form-fields.txt b/devdocs/specs/core-customize-form-fields.txt
index c765c69b..5f0d2c29 100644
--- a/devdocs/specs/core-customize-form-fields.txt
+++ b/devdocs/specs/core-customize-form-fields.txt
@@ -41,7 +41,7 @@ UI FEATURE - The ability to customize forms:
- Hide "hide"
- Required "required"
- Type One of values from AyDataType but not tags or enum (bool, date, date time, decimal, number, picklist(FUTURE), and text)
- - e.g.: {fields:[{fld:"ltkeyoffieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"dollarAmount",lt:"WidgetDollarAmount",type:"currency"}]}
+ - e.g.: {template:[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]}
- #DONE# Need a FormAvailableFields static collection class that contains the fields available to each form
- This should be independent from any other class tied to a particular route or controller or db table as it could be some or none of all of those things
diff --git a/server/AyaNova/Controllers/FormCustomController.cs b/server/AyaNova/Controllers/FormCustomController.cs
index 393ca8de..72e61171 100644
--- a/server/AyaNova/Controllers/FormCustomController.cs
+++ b/server/AyaNova/Controllers/FormCustomController.cs
@@ -128,49 +128,49 @@ namespace AyaNova.Api.Controllers
- // ///
- // /// Put (update) FormCustom
- // ///
- // /// Required roles:
- // /// Any (public filter) or owned only (private filter)
- // ///
- // ///
- // ///
- // ///
- // ///
- // [HttpPut("{id}")]
- // public async Task PutFormCustom([FromRoute] long id, [FromBody] FormCustom inObj)
- // {
- // if (!serverState.IsOpen)
- // return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
+ ///
+ /// Put (update) FormCustom
+ ///
+ /// Required roles:
+ /// Any (public filter) or owned only (private filter)
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPut("{id}")]
+ public async Task PutFormCustom([FromRoute] long id, [FromBody] FormCustom inObj)
+ {
+ if (!serverState.IsOpen)
+ return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
- // if (!ModelState.IsValid)
- // return BadRequest(new ApiErrorResponse(ModelState));
+ if (!ModelState.IsValid)
+ return BadRequest(new ApiErrorResponse(ModelState));
- // //Instantiate the business object handler
- // FormCustomBiz biz = FormCustomBiz.GetBiz(ct, HttpContext);
+ //Instantiate the business object handler
+ FormCustomBiz biz = FormCustomBiz.GetBiz(ct, HttpContext);
- // var o = await biz.GetNoLogAsync(id);
- // if (o == null)
- // return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
+ var o = await biz.GetNoLogAsync(id);
+ if (o == null)
+ return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
- // if (!Authorized.IsAuthorizedToModify(HttpContext.Items, biz.BizType, o.OwnerId))
- // return StatusCode(401, new ApiNotAuthorizedResponse());
+ if (!Authorized.IsAuthorizedToModify(HttpContext.Items, biz.BizType, o.OwnerId))
+ return StatusCode(401, new ApiNotAuthorizedResponse());
- // try
- // {
- // if (!biz.Put(o, inObj))
- // return BadRequest(new ApiErrorResponse(biz.Errors));
- // }
- // catch (DbUpdateConcurrencyException)
- // {
- // if (!await biz.ExistsAsync(id))
- // return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
- // else
- // return StatusCode(409, new ApiErrorResponse(ApiErrorCode.CONCURRENCY_CONFLICT));
- // }
- // return Ok(new ApiOkResponse(new { ConcurrencyToken = o.ConcurrencyToken }));
- // }
+ try
+ {
+ if (!biz.Put(o, inObj))
+ return BadRequest(new ApiErrorResponse(biz.Errors));
+ }
+ catch (DbUpdateConcurrencyException)
+ {
+ if (!await biz.ExistsAsync(id))
+ return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
+ else
+ return StatusCode(409, new ApiErrorResponse(ApiErrorCode.CONCURRENCY_CONFLICT));
+ }
+ return Ok(new ApiOkResponse(new { ConcurrencyToken = o.ConcurrencyToken }));
+ }
///
diff --git a/server/AyaNova/Startup.cs b/server/AyaNova/Startup.cs
index 4be91b55..02ac09c9 100644
--- a/server/AyaNova/Startup.cs
+++ b/server/AyaNova/Startup.cs
@@ -434,7 +434,7 @@ namespace AyaNova
//to support html5 pushstate routing in spa
//this ensures that a refresh at the client will not 404 but rather force back to the index.html app page and then handled internally by the client
await next();
- if (context.Request.Path.Value != "/docs" && context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
+ if (!context.Response.HasStarted && context.Request.Path.Value != "/docs" && context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
{
context.Request.Path = "/index.html";
context.Response.StatusCode = 200;
diff --git a/server/AyaNova/biz/FormCustomBiz.cs b/server/AyaNova/biz/FormCustomBiz.cs
index 883b140b..1c7c1c2f 100644
--- a/server/AyaNova/biz/FormCustomBiz.cs
+++ b/server/AyaNova/biz/FormCustomBiz.cs
@@ -80,21 +80,21 @@ namespace AyaNova.Biz
}
}
-
+
////////////////////////////////////////////////////////////////////////////////////////////////
/// GET
//Get one
internal async Task GetAsync(string formKey)
- {
+ {
var ret = await ct.FormCustom.SingleOrDefaultAsync(m => m.FormKey == formKey);
- //Do not log this, it's going to be called a zillion times anyway
+ //Do not log this, it's going to be called a zillion times anyway
return ret;
}
-
+
////////////////////////////////////////////////////////////////////////////////////////////////
@@ -128,7 +128,7 @@ namespace AyaNova.Biz
}
- //NO DELETE, ONLY EDIT
+ //NO DELETE, ONLY EDIT
////////////////////////////////////////////////////////////////////////////////////////////////
//VALIDATION
@@ -167,7 +167,7 @@ namespace AyaNova.Biz
}
}
-
+
//Template json must parse
if (!string.IsNullOrWhiteSpace(inObj.Template))
@@ -176,6 +176,11 @@ namespace AyaNova.Biz
{
var v = JArray.Parse(inObj.Template);
+ /*
+ Example:
+ {template:[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]}
+ */
+
//Validate the following:
//FormKey is valid value
//All fields specified are valid values
@@ -266,7 +271,7 @@ namespace AyaNova.Biz
-
+
/////////////////////////////////////////////////////////////////////