diff --git a/system/forms/formbuilder/importForm.xml b/system/forms/formbuilder/importFormFields.xml similarity index 83% rename from system/forms/formbuilder/importForm.xml rename to system/forms/formbuilder/importFormFields.xml index ca9fa81993..e12363889a 100644 --- a/system/forms/formbuilder/importForm.xml +++ b/system/forms/formbuilder/importFormFields.xml @@ -1,5 +1,5 @@ -
+
diff --git a/system/handlers/admin/FormBuilder.cfc b/system/handlers/admin/FormBuilder.cfc index 7c017341a1..8b17efbba0 100644 --- a/system/handlers/admin/FormBuilder.cfc +++ b/system/handlers/admin/FormBuilder.cfc @@ -848,8 +848,8 @@ component extends="preside.system.base.AdminHandler" { } } - public void function importForm( event, rc, prc, args ) { - prc.pageTitle = translateResource( "formbuilder:importForm.page.title" ); + public void function importFormFields( event, rc, prc, args ) { + prc.pageTitle = translateResource( "formbuilder:importFormFields.page.title" ); prc.pageIcon = "file-import"; event.addAdminBreadCrumb( @@ -858,7 +858,7 @@ component extends="preside.system.base.AdminHandler" { ); } - public string function importFormAction( event, rc, prc, args ) { + public string function importFormFieldsAction( event, rc, prc, args ) { var formId = rc.id ?: ""; var formData = event.getCollectionWithoutSystemVars() @@ -869,14 +869,14 @@ component extends="preside.system.base.AdminHandler" { formData.validationResult = validationResult; - setNextEvent( url=event.buildAdminLink( linkTo="formbuilder.importForm", queryString="id=#formId#" ), persistStruct=formData ); + setNextEvent( url=event.buildAdminLink( linkTo="formbuilder.importFormFields", queryString="id=#formId#" ), persistStruct=formData ); } try { var xml = XmlParse( formData.file.binary ); var taskId = createTask( - event = "admin.FormBuilder.importFormInBackgroundThread" + event = "admin.FormBuilder.importFormFieldsInBackgroundThread" , args = { formId=formId, xml=xml } , runNow = true , adminOwner = event.getAdminUserId() @@ -890,21 +890,21 @@ component extends="preside.system.base.AdminHandler" { , queryString = "taskId=" & taskId ) ); } catch ( any e ) { - messageBox.error( translateResource( uri="formbuilder:importForm.message.error" ) ); + messageBox.error( translateResource( uri="formbuilder:importFormFields.message.error" ) ); - setNextEvent( url=event.buildAdminLink( linkTo="formbuilder.importForm", queryString="id=#formId#" ), persistStruct=formData ); + setNextEvent( url=event.buildAdminLink( linkTo="formbuilder.importFormFields", queryString="id=#formId#" ), persistStruct=formData ); } } - private void function importFormInBackgroundThread( event, rc, prc, args={}, logger, progress ) { + private void function importFormFieldsInBackgroundThread( event, rc, prc, args={}, logger, progress ) { var canProgress = StructKeyExists( arguments, "progress" ); var formId = args.formId ?: ""; var xml = args.xml ?: ""; - logMessage( logger, "info", "Start importing the form fields and actions..." ); + logMessage( logger, "info", "Start importing the form fields..." ); - formBuilderService.importForm( + formBuilderService.importFormFields( formId = formId , xml = XmlParse( xml ) , logger = logger @@ -918,8 +918,8 @@ component extends="preside.system.base.AdminHandler" { logMessage( logger, "info", "Finished import." ); } - public string function exportFormAction( event, rc, prc, args ) { - var fileName = formBuilderService.exportForm( formId=rc.id ?: "" ); + public string function exportFormFieldsAction( event, rc, prc, args ) { + var fileName = formBuilderService.exportFormFields( formId=rc.id ?: "" ); if ( isEmptyString( fileName ) ) { event.notFound(); diff --git a/system/i18n/formbuilder.properties b/system/i18n/formbuilder.properties index 34c4bf7571..12a32e3ceb 100644 --- a/system/i18n/formbuilder.properties +++ b/system/i18n/formbuilder.properties @@ -17,7 +17,7 @@ question.not.found.alert=The question could not be found manage.form.page.title=Manage form manage.form.page.subtitle=Manage all aspects of the '{1}' form manageform.breadcrumb.title={1} -manage.empty.form.notice=Your form is currently empty. Drag and drop form fields from the left menu to start to build your form. +manage.empty.form.notice=or, drag and drop form fields from the left menu to start to build your form. manage.drag.new.items.instructions=Drag and drop form fields from the left menu to add them to your form management.tabs.fields.title=Fields and layout @@ -94,15 +94,15 @@ cloneForm.page.title=Clone form cloneForm.save=Save cloned.success.message=Form has been cloned successfully. -importForm.page.title=Import form -importForm.submit.title=Import -importForm.field.file.title=XML file -importForm.message.error=Unable to import the form. +importFormFields.page.title=Import form fields +importFormFields.submit.title=Import +importFormFields.field.file.title=Form fields XML +importFormFields.message.error=Unable to import the form fields. +importFormFields.workbench.button.title=Import fields... task.form.delete.title=Delete form and all its data action.submission.download.title=Download submissions -action.form.import.title=Import fields/ actions -action.form.export.title=Export fields/ actions +action.fields.export.title=Export fields action.form.delete.title=Delete form action.form.delete.prompt=delete this form AND all its data diff --git a/system/services/formbuilder/FormBuilderService.cfc b/system/services/formbuilder/FormBuilderService.cfc index ece856a147..f51aef41bd 100644 --- a/system/services/formbuilder/FormBuilderService.cfc +++ b/system/services/formbuilder/FormBuilderService.cfc @@ -2117,7 +2117,7 @@ component { return false; } - public string function exportForm( + public string function exportFormFields( required string formId ) { var formbuilderForm = getForm( id=arguments.formId ); @@ -2189,39 +2189,19 @@ component { ArrayAppend( xml.form.xmlChildren, xmlItems ); ArrayAppend( xml.form.xmlChildren, xmlQuestions ); - // Actions - var formbuilderFormActions = _getActionsService().getFormActions( id=arguments.formId ); - var actionsRoot = XmlElemNew( xml, "actions" ); - for ( var formbuilderFormAction in formbuilderFormActions ) { - var action = XmlElemNew( xml, "action" ); - - StructAppend( action.xmlAttributes, { - id = formbuilderFormAction.id - , actionId = formbuilderFormAction.action.id - }); - - if ( !StructIsEmpty( formbuilderFormAction.configuration ) ) { - var config = XmlElemNew( xml, "config" ); - StructAppend( config.xmlAttributes, formbuilderFormAction.configuration ); - ArrayAppend( action.xmlChildren, config ); - } - - ArrayAppend( actionsRoot.xmlChildren, action ); - } - ArrayAppend( xml.form.xmlChildren, actionsRoot ); - FileWrite( "#getTempDirectory()#/#fileName#", ToString( xml ) ); return fileName; } - public void function importForm( + public void function importFormFields( required string formId , required any xml , any logger , any progress ) { var items = XmlSearch( arguments.xml, "/form/items/item" ); + for ( var item in items ) { var itemAttributes = item.xmlAttributes ?: {}; var itemConfiguration = item.config.xmlAttributes ?: {}; @@ -2270,16 +2250,6 @@ component { } } } - - var actions = XmlSearch( xml, "/form/actions/action" ); - for ( var action in actions ) { - var actionAttributes = action.xmlAttributes ?: {}; - var actionConfiguration = action.config.xmlAttributes ?: {}; - - _getActionsService().addAction( formId=arguments.formId, action=actionAttributes.actionId, configuration=actionConfiguration ); - - $helpers.logMessage( logger, "info", "Action: #actionAttributes.actionId# created." ); - } } // PRIVATE HELPERS diff --git a/system/views/admin/formbuilder/_itemsManagement.cfm b/system/views/admin/formbuilder/_itemsManagement.cfm index 43f0bc788c..de50da7884 100644 --- a/system/views/admin/formbuilder/_itemsManagement.cfm +++ b/system/views/admin/formbuilder/_itemsManagement.cfm @@ -1,5 +1,6 @@ - items = args.items ?: []; + formId = args.formId ?: ""; + items = args.items ?: []; @@ -9,8 +10,16 @@
-

#translateResource( "formbuilder:manage.empty.form.notice")#

-

#translateResource( "formbuilder:manage.drag.new.items.instructions")#

- +

+ + + #translateResource( "formbuilder:importFormFields.workbench.button.title" )# + +
+
+ #translateResource( "formbuilder:manage.empty.form.notice" )# +

+ +

#translateResource( "formbuilder:manage.drag.new.items.instructions" )#

\ No newline at end of file diff --git a/system/views/admin/formbuilder/_statusControls.cfm b/system/views/admin/formbuilder/_statusControls.cfm index a60f8b0637..4bde8dbdc4 100644 --- a/system/views/admin/formbuilder/_statusControls.cfm +++ b/system/views/admin/formbuilder/_statusControls.cfm @@ -69,8 +69,7 @@