Commit 48b19c1c authored by Raph El's avatar Raph El
Browse files

Form : edit by admin

parent 341ed31b
...@@ -457,7 +457,8 @@ class Form { ...@@ -457,7 +457,8 @@ class Form {
} else if(Authorisation::isInterfaceAdmin()){ } else if(Authorisation::isInterfaceAdmin()){
$res = true; $res = true;
} } else if (Authorisation::isParentAdmin($id, Form::COLLECTION , Yii::app()->session["userId"], $form) )
$res = true;
return $res ; return $res ;
} }
......
...@@ -68,9 +68,18 @@ var oform = { ...@@ -68,9 +68,18 @@ var oform = {
// subLabel : "Vous remplirez les question de chaques étapes par la suite", // subLabel : "Vous remplirez les question de chaques étapes par la suite",
// values : [] // values : []
// }, // },
image : dyFInputs.image(),
id : { inputType : "hidden",value:"<?php echo $el["slug"].count($forms) ?>"}, id : { inputType : "hidden",value:"<?php echo $el["slug"].count($forms) ?>"},
parentSlug : { inputType : "hidden",value:"<?php echo $el["slug"] ?>"}, parentSlug : { inputType : "hidden",value:"<?php echo $el["slug"] ?>"},
parent : {
inputType : "finder",
label : tradDynForm.whoiscarrytheproject,
multiple : true,
rules : { required : true, lengthMin:[1, "parent"]},
initType: ["organizations", "projects"],
openSearch :true
},
image : dyFInputs.image(),
tpl : { inputType : "hidden",value:"survey.views.tpls.forms.formWizard"}, tpl : { inputType : "hidden",value:"survey.views.tpls.forms.formWizard"},
answersTpl : { inputType : "hidden",value:"survey.views.tpls.forms.answers"} answersTpl : { inputType : "hidden",value:"survey.views.tpls.forms.answers"}
}, },
...@@ -82,20 +91,23 @@ var oform = { ...@@ -82,20 +91,23 @@ var oform = {
afterSave : function(){ afterSave : function(){
dyFObj.commonAfterSave(); dyFObj.commonAfterSave();
}, },
save : function () { save : function (formData) {
mylog.log('save tplCtx formData', formData)
delete formData.collection ;
tplCtx = { tplCtx = {
collection : "forms", collection : "forms",
value : {} value : formData
}; };
$.each( oform.jsonSchema.properties , function(k,val) { // $.each( oform.jsonSchema.properties , function(k,val) {
if(val.inputType == "properties") // if(val.inputType == "properties")
tplCtx.value[k] = getPairsObj('.'+k+val.inputType); // tplCtx.value[k] = getPairsObj('.'+k+val.inputType);
else if(val.inputType == "array") // else if(val.inputType == "array")
tplCtx.value[k] = getArray('.'+k+val.inputType); // tplCtx.value[k] = getArray('.'+k+val.inputType);
else // else
tplCtx.value[k] = $("#"+k).val(); // tplCtx.value[k] = $("#"+k).val();
mylog.log("value",'.'+k+val.inputType,tplCtx.value[k]); // mylog.log("value",'.'+k+val.inputType,tplCtx.value[k]);
}); // });
mylog.log("save tplCtx",tplCtx); mylog.log("save tplCtx",tplCtx);
if(typeof tplCtx.value == "undefined") if(typeof tplCtx.value == "undefined")
......
Markdown is supported
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