diff --git a/Rakefile b/Rakefile index 11246cd7a..123d679d1 100644 --- a/Rakefile +++ b/Rakefile @@ -173,14 +173,12 @@ def buildPmdynaform(homeDir, targetDir, mode) pmdynaformDir = targetDir + "/pmdynaform" executeInto(homeDir, [ "default"]) - - system("cp -r #{homeDir}/build #{pmdynaformDir}") - system("cp -r #{homeDir}/libs #{pmdynaformDir}") - system("rm #{pmdynaformDir}/build/appBuild.js") - readyForm = "" - system("echo '#{readyForm}' >> #{pmdynaformDir}/build/appBuild.js ") - system("cp #{Dir.pwd}/workflow/engine/templates/cases/cases_Step_Pmdynaform.html #{pmdynaformDir}/build/cases_Step_Pmdynaform.html") - system("cp #{Dir.pwd}/workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html #{pmdynaformDir}/build/cases_Step_Pmdynaform_Preview.html") + + require 'fileutils' + Dir.mkdir("#{pmdynaformDir}/build") + FileUtils.cp_r(Dir["#{homeDir}/build/*"],"#{pmdynaformDir}/build") + Dir.mkdir("#{pmdynaformDir}/libs") + FileUtils.cp_r(Dir["#{homeDir}/libs/*"],"#{pmdynaformDir}/libs") template = "" config = File.read "#{homeDir}/config/templates.json" @@ -188,28 +186,25 @@ def buildPmdynaform(homeDir, targetDir, mode) json.each do |key| s = "" key["files"].each do |source| - s += File.read "#{homeDir}/#{source}" + s += File.read "#{homeDir}/#{source}" s += "\n" end template += s end - target = "#{pmdynaformDir}/build/cases_Step_Pmdynaform.html" - html = File.read target - while html['###TEMPLATES##'] do - html['###TEMPLATES###'] = template - end - File.open(target, 'w+') do |file| - file.write html - end - - target = "#{pmdynaformDir}/build/cases_Step_Pmdynaform_Preview.html" - html = File.read target - while html['###TEMPLATES##'] do - html['###TEMPLATES###'] = template - end - File.open(target, 'w+') do |file| - file.write html + htmlTemplates=["cases_Step_Pmdynaform.html","cases_Step_Pmdynaform_Preview.html","cases_Step_Pmdynaform_View.html"] + htmlTemplates.each do |htmlTemplate| + + FileUtils.cp("#{Dir.pwd}/workflow/engine/templates/cases/#{htmlTemplate}", "#{pmdynaformDir}/build/#{htmlTemplate}") + + target = "#{pmdynaformDir}/build/#{htmlTemplate}" + html = File.read target + while html['###TEMPLATES##'] do + html['###TEMPLATES###'] = template + end + File.open(target, 'w+') do |file| + file.write html + end end puts "\nPmDynaform Build Finished!".magenta diff --git a/features/backend/application_cases/cases_lists_1-6/main_tests_cases_lists_1_6.feature b/features/backend/application_cases/cases_lists_1-6/main_tests_cases_lists_1_6.feature index 9371f9ffd..be9544fb2 100644 --- a/features/backend/application_cases/cases_lists_1-6/main_tests_cases_lists_1_6.feature +++ b/features/backend/application_cases/cases_lists_1-6/main_tests_cases_lists_1_6.feature @@ -610,12 +610,12 @@ Scenario Outline: Get paging of list Advanced Search | high number for start | 1000 | 1 | 0 | 200 | | high number for start | 1000 | 0 | 0 | 200 | | empty result | 1 | 0 | 30 | 200 | - | empty string | 1 | 10000 | 57 | 200 | + | empty string | 1 | 10000 | 83 | 200 | | invalid start | b | 25 | 25 | 200 | | invalid limit | 1 | c | 30 | 200 | | start equals zero | 0 | 20 | 20 | 200 | | search 0 | 0 | 0 | 30 | 200 | - | search 0 | 0 | 100 | 57 | 200 | + | search 0 | 0 | 100 | 83 | 200 | | negative numbers in start | -10 | 25 | 25 | 200 | | negative numbers in limit | 1 | -25 | 25 | 200 | | real numbers | 0.0 | 1.0 | 1 | 200 | @@ -652,7 +652,7 @@ Scenario Outline: Get order type of Process Category Examples: | test_description | cat_uid | records | - | Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | 26 | + | Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | 30 | | Filter all categories | | 30 | @@ -684,7 +684,7 @@ Scenario Outline: Get order type of Search Examples: | test_description | search | records | - | Filter for cases "Derivation rules - Parallel -> Case number 6" | 17 | 10 | + | Filter for cases "Derivation rules - Parallel -> Case number 6" | 17 | 16 | | Filter all cases | | 30 | @@ -719,7 +719,7 @@ Scenario Outline: Get order for User | Filter Status = All User | | 30 | | Filter Status = aaron | 51049032352d56710347233042615067 | 4 | | Filter Status = admin | 00000000000000000000000000000001 | 30 | - | Filter Status = chris | 24166330352d56730cdd525035621101 | 6 | + | Filter Status = chris | 24166330352d56730cdd525035621101 | 7 | Scenario Outline: Get order for date @@ -733,5 +733,5 @@ Scenario Outline: Get order for date Examples: | test_description | date_from | date_to | records | - | Filter date = 2014-03-01 | 2014-03-01 | 2014-03-31 | 5 | + | Filter date = 2014-03-01 | 2014-03-01 | 2014-03-31 | 7 | | Filter date = 2014-03-15 | 2014-03-15 | 2014-04-01 | 30 | \ No newline at end of file diff --git a/features/backend/projects/files_manager/main_test_files_manager.feature b/features/backend/projects/files_manager/main_test_files_manager.feature index b841470d6..b89488189 100644 --- a/features/backend/projects/files_manager/main_test_files_manager.feature +++ b/features/backend/projects/files_manager/main_test_files_manager.feature @@ -217,7 +217,7 @@ Scenario Outline: Delete folder #BUG 15207, The "Upload" accepts files with other extensions -Scenario Outline: Upload files to same folders "Project - Process Complete BPMN" +Scenario Outline: Upload files with incorret extension ".exe" - "Project - Process Complete BPMN" Given POST I want to upload the file "" to path "". Url "project/1455892245368ebeb11c1a5001393784/file-manager" And store "prf_uid" in session array as variable "prf_uid_" And the response status message should have the following text "incorrect extension" diff --git a/features/backend/projects/project/main_tests_project_resources.feature b/features/backend/projects/project/main_tests_project_resources.feature index 12dc1ee7f..727d86fca 100644 --- a/features/backend/projects/project/main_tests_project_resources.feature +++ b/features/backend/projects/project/main_tests_project_resources.feature @@ -720,8 +720,7 @@ Scenario Outline: Get definition of a project And the type is "object" And that "prj_name" is set to "Update Evaluation" And that "prj_description" is set to "Update" - And that "par_name" property in object "participants" equals "abcd" - + Examples: @@ -731,14 +730,18 @@ Scenario Outline: Get definition of a project #Test of successful export and import of objects "Data Object, Data Store, Black Box and Text" -Scenario: Get for Export Project - Test process NEW - Given that I want to get a resource with the key "new_uid" stored in session array as variable "project_new_uid_" in position 0 - And I request "project//export" +Scenario Outline: Get for Export Project - Test process NEW + Given I request "project/new_uid/export" with the key "new_uid" stored in session array as variable "project_new_uid_" in position 0 Then the response status code should be 200 And the response charset is "UTF-8" And the content type is "application/xml" And save exported process to "/" as "Test process NEW.pmx" + Examples: + + | project_new_uid_number | + | 7 | + Scenario Outline: Delete a Project activity created previously in this script - Test process NEW Given that I want to delete a resource with the key "new_uid" stored in session array as variable "project_new_uid_" in position 0 @@ -765,7 +768,7 @@ Scenario Outline: Import a process - Test process NEW Examples: | project_file | import_option | prj_uid_number | - | Process_NewCreate_BPMN.pmx | create | 7 | + | Process_NewCreate_BPMN.pmx | CREATE | 7 | diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index 1edb13fce..6601fd2d7 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1311,6 +1311,36 @@ class RestContext extends BehatContext } + /** + * @Given /^I request "([^"]*)" with the key "([^"]*)" stored in session array as variable "([^"]*)" in position (\d+)$/ + */ + public function iRequestWithTheKeyStoredInSessionArrayAsVariableInPosition($pageUrl, $varName, $sessionVarName, $position) + { + if (file_exists("session.data")) { + $sessionData = json_decode(file_get_contents("session.data")); + } else { + $sessionData = array(); + } + if (!isset($sessionData->$sessionVarName) ) { + $varValue = ''; + } else { + foreach ($sessionData->$sessionVarName as $key => $value) { + if($key == $position){ + $varValue = $value; + } + } + } + + $pageUrl = str_replace($varName, $varValue, $pageUrl); + + + $this->printDebug("URL: $pageUrl\n$varName = $varValue\nsessionVarName = $sessionVarName\n"); + + + $this->iRequest($pageUrl); + } + + /** * @Given /^the property "([^"]*)" of "([^"]*)" is set to "([^"]*)"$/ */ diff --git a/features/json/process_template_with_DATA_participant.json b/features/json/process_template_with_DATA_participant.json new file mode 100644 index 000000000..ec69b7389 --- /dev/null +++ b/features/json/process_template_with_DATA_participant.json @@ -0,0 +1,544 @@ +{ + "prj_uid": "89867911453cfc0a88166b6079100310", + "prj_name": "Test process NEW", + "prj_description": "", + "prj_target_namespace": "", + "prj_expresion_language": "", + "prj_type_language": "", + "prj_exporter": "", + "prj_exporter_version": "", + "prj_create_date": "2014-07-23 10:03:20", + "prj_update_date": "2014-07-23 15:25:16", + "prj_author": "00000000000000000000000000000001", + "prj_author_version": "", + "prj_original_source": "", + "diagrams": [ + { + "dia_uid": "44288077153cfc0a89424f9087061662", + "prj_uid": "89867911453cfc0a88166b6079100310", + "dia_name": "Test process NEW", + "dia_is_closable": 0, + "pro_uid": "93177932753cfc0a8986c44089014824", + "activities": [ + { + "act_uid": "42039389753cfc58a2db023038551328", + "act_name": "Task # 3", + "act_type": "TASK", + "act_is_for_compensation": "0", + "act_start_quantity": "1", + "act_completion_quantity": "0", + "act_task_type": "EMPTY", + "act_implementation": "", + "act_instantiate": "0", + "act_script_type": "", + "act_script": "", + "act_loop_type": "NONE", + "act_test_before": "0", + "act_loop_maximum": "0", + "act_loop_condition": "0", + "act_loop_cardinality": "0", + "act_loop_behavior": "0", + "act_is_adhoc": "0", + "act_is_collapsed": "0", + "act_completion_condition": "0", + "act_ordering": "0", + "act_cancel_remaining_instances": "0", + "act_protocol": "0", + "act_method": "0", + "act_is_global": "0", + "act_referer": "0", + "act_default_flow": "0", + "act_master_diagram": "0", + "bou_x": "618", + "bou_y": "206", + "bou_width": "150", + "bou_height": "75", + "bou_container": "bpmnDiagram" + }, + { + "act_uid": "47452513353cfc4b015e855056634598", + "act_name": "Task # 1", + "act_type": "TASK", + "act_is_for_compensation": "0", + "act_start_quantity": "1", + "act_completion_quantity": "0", + "act_task_type": "EMPTY", + "act_implementation": "", + "act_instantiate": "0", + "act_script_type": "", + "act_script": "", + "act_loop_type": "NONE", + "act_test_before": "0", + "act_loop_maximum": "0", + "act_loop_condition": "0", + "act_loop_cardinality": "0", + "act_loop_behavior": "0", + "act_is_adhoc": "0", + "act_is_collapsed": "0", + "act_completion_condition": "0", + "act_ordering": "0", + "act_cancel_remaining_instances": "0", + "act_protocol": "0", + "act_method": "0", + "act_is_global": "0", + "act_referer": "0", + "act_default_flow": "0", + "act_master_diagram": "0", + "bou_x": "198", + "bou_y": "146", + "bou_width": "150", + "bou_height": "75", + "bou_container": "bpmnDiagram" + }, + { + "act_uid": "63183340353cfc57778a499040015745", + "act_name": "Task # 2", + "act_type": "TASK", + "act_is_for_compensation": "0", + "act_start_quantity": "1", + "act_completion_quantity": "0", + "act_task_type": "EMPTY", + "act_implementation": "", + "act_instantiate": "0", + "act_script_type": "", + "act_script": "", + "act_loop_type": "NONE", + "act_test_before": "0", + "act_loop_maximum": "0", + "act_loop_condition": "0", + "act_loop_cardinality": "0", + "act_loop_behavior": "0", + "act_is_adhoc": "0", + "act_is_collapsed": "0", + "act_completion_condition": "0", + "act_ordering": "0", + "act_cancel_remaining_instances": "0", + "act_protocol": "0", + "act_method": "0", + "act_is_global": "0", + "act_referer": "0", + "act_default_flow": "0", + "act_master_diagram": "0", + "bou_x": "618", + "bou_y": "74", + "bou_width": "150", + "bou_height": "75", + "bou_container": "bpmnDiagram" + } + ], + "events": [ + { + "evn_uid": "90282129153cfc4b0565a82000775606", + "evn_name": "Start Event # 1", + "evn_type": "START", + "evn_marker": "EMPTY", + "evn_is_interrupting": "1", + "evn_cancel_activity": "0", + "evn_activity_ref": "", + "evn_wait_for_completion": "0", + "evn_error_name": "", + "evn_error_code": "", + "evn_escalation_name": "", + "evn_escalation_code": "", + "evn_message": "LEAD", + "evn_operation_implementation_ref": "", + "evn_time_date": "", + "evn_time_cycle": "", + "evn_time_duration": "", + "evn_behavior": "CATCH", + "evn_operation_name": "", + "bou_x": "57", + "bou_y": "166", + "bou_width": "33", + "bou_height": "33", + "bou_container": "bpmnDiagram" + }, + { + "evn_uid": "98330162753cfc58a6e3282003840838", + "evn_name": "End Event # 1", + "evn_type": "END", + "evn_marker": "EMPTY", + "evn_is_interrupting": "1", + "evn_cancel_activity": "0", + "evn_activity_ref": "", + "evn_wait_for_completion": "0", + "evn_error_name": "", + "evn_error_code": "", + "evn_escalation_name": "", + "evn_escalation_code": "", + "evn_message": "", + "evn_operation_implementation_ref": "", + "evn_time_date": "", + "evn_time_cycle": "", + "evn_time_duration": "", + "evn_behavior": "THROW", + "evn_operation_name": "", + "bou_x": "907", + "bou_y": "149", + "bou_width": "33", + "bou_height": "33", + "bou_container": "bpmnDiagram" + } + ], + "gateways": [ + { + "gat_uid": "10270112553cfc5779f0ec1019712071", + "gat_name": "Exlusive Gateway # 1", + "gat_type": "EXCLUSIVE", + "gat_direction": "DIVERGING", + "gat_instantiate": "0", + "gat_activation_count": "0", + "gat_waiting_for_start": "1", + "gat_default_flow": "0", + "gat_event_gateway_type": "NONE", + "bou_x": "416", + "bou_y": "162", + "bou_width": "41", + "bou_height": "41", + "bou_container": "bpmnDiagram" + } + ], + "flows": [ + { + "flo_uid": "14108751053d00c1e327739055650441", + "flo_type": "SEQUENCE", + "flo_name": "", + "flo_element_origin": "47452513353cfc4b015e855056634598", + "flo_element_origin_type": "bpmnActivity", + "flo_element_dest": "10270112553cfc5779f0ec1019712071", + "flo_element_dest_type": "bpmnGateway", + "flo_is_inmediate": "1", + "flo_condition": "", + "flo_x1": "345", + "flo_y1": "178", + "flo_x2": "411", + "flo_y2": "178", + "flo_state": [ + { + "x": 350, + "y": 183 + }, + { + "x": 416, + "y": 183 + } + ] + }, + { + "flo_uid": "26171853453d00c1e327538080865741", + "flo_type": "SEQUENCE", + "flo_name": "", + "flo_element_origin": "10270112553cfc5779f0ec1019712071", + "flo_element_origin_type": "bpmnGateway", + "flo_element_dest": "63183340353cfc57778a499040015745", + "flo_element_dest_type": "bpmnActivity", + "flo_is_inmediate": "1", + "flo_condition": "", + "flo_x1": "452", + "flo_y1": "178", + "flo_x2": "612", + "flo_y2": "106", + "flo_state": [ + { + "x": 457, + "y": 183 + }, + { + "x": 537, + "y": 183 + }, + { + "x": 537, + "y": 111 + }, + { + "x": 617, + "y": 111 + } + ] + }, + { + "flo_uid": "35962716053d00c1e327923027081892", + "flo_type": "SEQUENCE", + "flo_name": "", + "flo_element_origin": "42039389753cfc58a2db023038551328", + "flo_element_origin_type": "bpmnActivity", + "flo_element_dest": "98330162753cfc58a6e3282003840838", + "flo_element_dest_type": "bpmnEvent", + "flo_is_inmediate": "1", + "flo_condition": "", + "flo_x1": "765", + "flo_y1": "238", + "flo_x2": "902", + "flo_y2": "161", + "flo_state": [ + { + "x": 770, + "y": 243 + }, + { + "x": 838, + "y": 243 + }, + { + "x": 838, + "y": 166 + }, + { + "x": 907, + "y": 166 + } + ] + }, + { + "flo_uid": "45234438053d00c1e327279046619951", + "flo_type": "SEQUENCE", + "flo_name": "", + "flo_element_origin": "90282129153cfc4b0565a82000775606", + "flo_element_origin_type": "bpmnEvent", + "flo_element_dest": "47452513353cfc4b015e855056634598", + "flo_element_dest_type": "bpmnActivity", + "flo_is_inmediate": "1", + "flo_condition": "", + "flo_x1": "85", + "flo_y1": "178", + "flo_x2": "192", + "flo_y2": "178", + "flo_state": [ + { + "x": 90, + "y": 183 + }, + { + "x": 197, + "y": 183 + } + ] + }, + { + "flo_uid": "85219507353d00c1e327b28058412058", + "flo_type": "SEQUENCE", + "flo_name": "", + "flo_element_origin": "63183340353cfc57778a499040015745", + "flo_element_origin_type": "bpmnActivity", + "flo_element_dest": "98330162753cfc58a6e3282003840838", + "flo_element_dest_type": "bpmnEvent", + "flo_is_inmediate": "1", + "flo_condition": "", + "flo_x1": "765", + "flo_y1": "106", + "flo_x2": "902", + "flo_y2": "161", + "flo_state": [ + { + "x": 770, + "y": 111 + }, + { + "x": 838, + "y": 111 + }, + { + "x": 838, + "y": 166 + }, + { + "x": 907, + "y": 166 + } + ] + }, + { + "flo_uid": "86729603453d00c1e327e23091238933", + "flo_type": "SEQUENCE", + "flo_name": "", + "flo_element_origin": "10270112553cfc5779f0ec1019712071", + "flo_element_origin_type": "bpmnGateway", + "flo_element_dest": "42039389753cfc58a2db023038551328", + "flo_element_dest_type": "bpmnActivity", + "flo_is_inmediate": "1", + "flo_condition": "", + "flo_x1": "452", + "flo_y1": "178", + "flo_x2": "612", + "flo_y2": "238", + "flo_state": [ + { + "x": 457, + "y": 183 + }, + { + "x": 537, + "y": 183 + }, + { + "x": 537, + "y": 243 + }, + { + "x": 617, + "y": 243 + } + ] + } + ], + "artifacts": [ + { + "art_uid": "59954519253d0052028c894036716690", + "art_type": "V_LABEL", + "art_name": "Vertical Text # 1", + "art_category_ref": "", + "bou_x": "57", + "bou_y": "439", + "bou_width": "30", + "bou_height": "150", + "bou_container": "bpmnDiagram" + }, + { + "art_uid": "71566215953d0052023d2a8070976645", + "art_type": "H_LABEL", + "art_name": "Horizontal Text # 1", + "art_category_ref": "", + "bou_x": "27", + "bou_y": "399", + "bou_width": "100", + "bou_height": "30", + "bou_container": "bpmnDiagram" + }, + { + "art_uid": "76936366253d005200fecf1072255540", + "art_type": "VERTICAL_LINE", + "art_name": "", + "art_category_ref": "", + "bou_x": "143", + "bou_y": "-6666", + "bou_width": "0", + "bou_height": "0", + "bou_container": "bpmnDiagram" + }, + { + "art_uid": "81251352753d005201445b3079328056", + "art_type": "VERTICAL_LINE", + "art_name": "", + "art_category_ref": "", + "bou_x": "492", + "bou_y": "-6666", + "bou_width": "0", + "bou_height": "0", + "bou_container": "bpmnDiagram" + }, + { + "art_uid": "83307143353d00520187cb7053341695", + "art_type": "TEXT_ANNOTATION", + "art_name": "Annotation # 1", + "art_category_ref": "", + "bou_x": "23", + "bou_y": "321", + "bou_width": "100", + "bou_height": "30", + "bou_container": "bpmnDiagram" + }, + { + "art_uid": "83607134753d005200b7218057925307", + "art_type": "VERTICAL_LINE", + "art_name": "", + "art_category_ref": "", + "bou_x": "866", + "bou_y": "-6668", + "bou_width": "0", + "bou_height": "0", + "bou_container": "bpmnDiagram" + }, + { + "art_uid": "84367937053d0051fed9425007718074", + "art_type": "HORIZONTAL_LINE", + "art_name": "", + "art_category_ref": "", + "bou_x": "-6666", + "bou_y": "297", + "bou_width": "0", + "bou_height": "0", + "bou_container": "bpmnDiagram" + } + ], + "laneset": [], + "lanes": [], + "data": [ + { + "dat_uid": "26571650353d005204769f0016803456", + "pro_uid": "93177932753cfc0a8986c44089014824", + "dat_name": "Data Store # 1", + "dat_type": "DATASTORE", + "dat_is_collection": "0", + "dat_item_kind": "INFORMATION", + "dat_capacity": "0", + "dat_is_unlimited": "0", + "dat_state": "", + "dat_is_global": "0", + "dat_object_ref": "", + "bou_uid": "18632057653d00520498147014458357", + "dia_uid": "44288077153cfc0a89424f9087061662", + "element_uid": "26571650353d005204769f0016803456", + "bou_element": "pm_canvas", + "bou_element_type": "bpmnData", + "bou_x": "653", + "bou_y": "359", + "bou_width": "41", + "bou_height": "41", + "bou_rel_position": "0", + "bou_size_identical": "0", + "bou_container": "bpmnDiagram" + }, + { + "dat_uid": "78867843253d00520623a38020792926", + "pro_uid": "93177932753cfc0a8986c44089014824", + "dat_name": "Data Object # 1", + "dat_type": "DATAOBJECT", + "dat_is_collection": "0", + "dat_item_kind": "INFORMATION", + "dat_capacity": "0", + "dat_is_unlimited": "0", + "dat_state": "", + "dat_is_global": "0", + "dat_object_ref": "", + "bou_uid": "69652140553d0052062ece8068466841", + "dia_uid": "44288077153cfc0a89424f9087061662", + "element_uid": "78867843253d00520623a38020792926", + "bou_element": "pm_canvas", + "bou_element_type": "bpmnData", + "bou_x": "279", + "bou_y": "359", + "bou_width": "33", + "bou_height": "41", + "bou_rel_position": "0", + "bou_size_identical": "0", + "bou_container": "bpmnDiagram" + } + ], + "participants": [ + { + "par_uid": "23138442753d004f65bfca9078520587", + "pro_uid": "93177932753cfc0a8986c44089014824", + "lns_uid": "", + "par_name": "Participant # 1", + "par_minimum": "0", + "par_maximum": "1", + "par_num_participants": "1", + "par_is_horizontal": "1", + "bou_uid": "69206715353d004f65c9bc3086768663", + "dia_uid": "44288077153cfc0a89424f9087061662", + "element_uid": "23138442753d004f65bfca9078520587", + "bou_element": "pm_canvas", + "bou_element_type": "bpmnParticipant", + "bou_x": "885", + "bou_y": "359", + "bou_width": "500", + "bou_height": "100", + "bou_rel_position": "0", + "bou_size_identical": "0", + "bou_container": "bpmnDiagram" + } + ] + } + ] +} \ No newline at end of file diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php new file mode 100644 index 000000000..0550c0891 --- /dev/null +++ b/workflow/engine/classes/class.pmDynaform.php @@ -0,0 +1,105 @@ +dyn_uid = $dyn_uid; + $this->app_data = $app_data; + + $this->getDynaform(); + } + + public function getDynaform() + { + if ($this->record != null) { + return $this->record; + } + $a = new Criteria("workflow"); + $a->addSelectColumn(DynaformPeer::DYN_VERSION); + $a->addSelectColumn(DynaformPeer::DYN_CONTENT); + $a->addSelectColumn(DynaformPeer::PRO_UID); + $a->addSelectColumn(DynaformPeer::DYN_UID); + $a->add(DynaformPeer::DYN_UID, $this->dyn_uid, Criteria::EQUAL); + $ds = ProcessPeer::doSelectRS($a); + $ds->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $ds->next(); + $row = $ds->getRow(); + $this->record = isset($row) ? $row : null; + + return $this->record; + } + + public function getMergeValues() + { + $dataJSON = G::json_decode($this->record["DYN_CONTENT"]); + $dt = $dataJSON->items[0]->items; + $n = count($dt); + for ($i = 0; $i < $n; $i++) { + $dr = $dt[$i]; + $n2 = count($dr); + for ($j = 0; $j < $n2; $j++) { + if ($dr[$j]->name) { + $valueField = isset($this->app_data[$dr[$j]->name]) ? $this->app_data[$dr[$j]->name] : ""; + $dataJSON->items[0]->items[$i][$j]->defaultValue = $valueField; + } + } + } + return G::json_encode($dataJSON); + } + + public function mergeValues() + { + $this->record["DYN_CONTENT"] = $this->getMergeValues(); + } + + public function isResponsive() + { + return $this->record != null && $this->record["DYN_VERSION"] == 2 ? true : false; + } + + public function printView($pm_run_outside_main_app, $application) + { + ob_clean(); + $file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform_View.html'); + $file = str_replace("{JSON_DATA}", $this->record["DYN_CONTENT"], $file); + $file = str_replace("{PM_RUN_OUTSIDE_MAIN_APP}", $pm_run_outside_main_app, $file); + $file = str_replace("{DYN_UID}", $this->dyn_uid, $file); + $file = str_replace("{DYNAFORMNAME}", $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"], $file); + $file = str_replace("{APP_UID}", $application, $file); + echo $file; + exit(); + } + + public function printEdit($pm_run_outside_main_app, $application, $headData) + { + ob_clean(); + $file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform.html'); + $file = str_replace("{JSON_DATA}", $this->record["DYN_CONTENT"], $file); + $file = str_replace("{CASE}", $headData["CASE"], $file); + $file = str_replace("{APP_NUMBER}", $headData["APP_NUMBER"], $file); + $file = str_replace("{TITLE}", $headData["TITLE"], $file); + $file = str_replace("{APP_TITLE}", $headData["APP_TITLE"], $file); + $file = str_replace("{PM_RUN_OUTSIDE_MAIN_APP}", $pm_run_outside_main_app, $file); + $file = str_replace("{DYN_UID}", $this->dyn_uid, $file); + $file = str_replace("{DYNAFORMNAME}", $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"], $file); + $file = str_replace("{APP_UID}", $application, $file); + echo $file; + exit(); + } + +} + diff --git a/workflow/engine/controllers/processProxy.php b/workflow/engine/controllers/processProxy.php index fcae2c2b1..072ce56b5 100755 --- a/workflow/engine/controllers/processProxy.php +++ b/workflow/engine/controllers/processProxy.php @@ -447,5 +447,27 @@ class ProcessProxy extends HttpProxyController } $this->rows = $rows; } + + /** + * Generate BPMN (New record is generated) + * + * return void + */ + public function generateBpmn() + { + try { + $processUid = $_POST["processUid"]; + + $workflowBpmn = new \ProcessMaker\Project\Adapter\WorkflowBpmn(); + + $projectUid = $workflowBpmn->generateBpmn($processUid, "processUid", $_SESSION["USER_LOGGED"]); + + $this->status = "OK"; + $this->projectUid = $projectUid; + } catch (Exception $e) { + $this->status = "ERROR"; + $this->message = $e->getMessage(); + } + } } diff --git a/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js b/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js index fb894c81f..e22a6d5d6 100644 --- a/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js +++ b/workflow/engine/js/cases/core/cases_Step_Pmdynaform.js @@ -21,23 +21,12 @@ function dynaFormChanged (frm) { } return false; } - -function validateNameField (form, type) { - var i, j = 0, dt, name; - dt = form.getElementsByTagName(type); - for (i = 0; i < dt.length; i++) { - name = dt[i].name; - if (!name) - name = "field" + type + j; - dt[i].name = "form[" + name + "]"; - j++; - } -} - -window.onload = function () { +$(window).load(function () { var data = JSON.parse(jsondata); - var modelPMDynaform = new PMDynaform.Model.Form(data); - var viewPMDynaform = new PMDynaform.View.Form({tagName: "div", renderTo: $(".container"), model: modelPMDynaform}); + window.dynaform = new PMDynaform.core.Project({ + data: data, + submitRest: false + }); if (pm_run_outside_main_app === 'true') { if (parent.showCaseNavigatorPanel) { @@ -50,39 +39,49 @@ window.onload = function () { } var form = document.getElementsByTagName("form")[0]; - validateNameField(form, "input"); - validateNameField(form, "textarea"); - validateNameField(form, "select"); + + var el = form.elements; + var k = 0; + var dt = data.items[0].items; + for (var i = 0; i < dt.length; i++) { + var dr = dt[i]; + for (var j = 0; j < dr.length; j++) { + if (dr[j].name) { + el[k].name = "form[" + dr[j].name + "]"; + k = k + 1; + } + } + } var type = document.createElement("input"); type.type = "hidden"; - type.value = "ASSIGN_TASK"; type.name = "TYPE"; + type.value = "ASSIGN_TASK"; var uid = document.createElement("input"); uid.type = "hidden"; - uid.value = dyn_uid; uid.name = "UID"; + uid.value = dyn_uid; var position = document.createElement("input"); position.type = "hidden"; - position.value = "10000"; position.name = "POSITION"; + position.value = "10000"; var action = document.createElement("input"); action.type = "hidden"; - action.value = "ASSIGN"; action.name = "ACTION"; + action.value = "ASSIGN"; var dynaformname = document.createElement("input"); dynaformname.type = "hidden"; - dynaformname.value = __DynaformName__; dynaformname.name = "__DynaformName__"; + dynaformname.value = __DynaformName__; var appuid = document.createElement("input"); appuid.type = "hidden"; - appuid.value = app_uid; appuid.name = "APP_UID"; + appuid.value = app_uid; form.action = "cases_SaveData?UID=" + dyn_uid + "&APP_UID=" + app_uid; form.method = "post"; @@ -93,4 +92,9 @@ window.onload = function () { form.appendChild(dynaformname); form.appendChild(appuid); -}; \ No newline at end of file + var dyn_forward = document.getElementById("dyn_forward"); + dyn_forward.onclick = function () { + form.submit(); + return false; + }; +}); \ No newline at end of file diff --git a/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php b/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php index 762e2a1ba..4739335a2 100644 --- a/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php +++ b/workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php @@ -380,7 +380,14 @@ if ($actionAjax == 'dynaformChangeLogViewHistory') { $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = ''; $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = '#'; $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'return false;'; - $G_PUBLISH->AddContent( 'dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view' ); + G::LoadClass('pmDynaform'); + $a = new pmDynaform($_GET['DYN_UID'], $Fields['APP_DATA']); + if ($a->isResponsive()) { + $a->mergeValues(); + $a->printView((!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false", $_SESSION['APPLICATION']); + } else { + $G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view'); + } ?> @@ -14,6 +13,7 @@ +
@@ -33,7 +33,14 @@ {CASE} #: {APP_NUMBER}     {TITLE}: {APP_TITLE} - Previous Step - Next step +
+   + + +   + + Next Step + +
diff --git a/workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html b/workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html index 8f5e95589..e60e0ae33 100644 --- a/workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html +++ b/workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html @@ -6,7 +6,6 @@ - @@ -14,12 +13,11 @@ +
###TEMPLATES### - Previous Step - Next step diff --git a/workflow/engine/templates/cases/cases_Step_Pmdynaform_View.html b/workflow/engine/templates/cases/cases_Step_Pmdynaform_View.html new file mode 100644 index 000000000..07b493ada --- /dev/null +++ b/workflow/engine/templates/cases/cases_Step_Pmdynaform_View.html @@ -0,0 +1,40 @@ + + + + PMDynaform + + + + + + + + + + + + + + +
+ ###TEMPLATES### + + + + diff --git a/workflow/engine/templates/oauth2/accessTokenSetup.js b/workflow/engine/templates/oauth2/accessTokenSetup.js index 2f5a95c40..25f25a995 100644 --- a/workflow/engine/templates/oauth2/accessTokenSetup.js +++ b/workflow/engine/templates/oauth2/accessTokenSetup.js @@ -342,7 +342,7 @@ accessTokenSetup.application = { sm.selectRow(rowIndex, true); var record = grdpnlMain.getSelectionModel().getSelected(); - console.log(record); + if (typeof(record) != "undefined") { Ext.MessageBox.confirm( _("ID_CONFIRM"), diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index 988a06a1c..991f376db 100755 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -394,11 +394,10 @@ Ext.onReady(function(){ } if (rowSelected.data.PROJECT_TYPE == "bpmn"){ - Ext.getCmp('edit_with_classic_editor').setDisabled(false); + Ext.getCmp("mnuGenerateBpmn").setDisabled(true); } else { - Ext.getCmp('edit_with_classic_editor').setDisabled(true); + Ext.getCmp("mnuGenerateBpmn").setDisabled(false); } - }, this); processesGrid.on('contextmenu', function (evt) { evt.preventDefault(); @@ -435,6 +434,15 @@ Ext.onReady(function(){ handler: function () { exportProcess(); } + }, + { + id: "mnuGenerateBpmn", + text: _("ID_GENERATE_BPMN_PROJECT"), + iconCls: "button_menu_ext ss_sprite ss_page_white_go", + handler: function () + { + generateBpmn(); + } } ] }); @@ -584,7 +592,7 @@ editProcess = function(typeParam) var rowSelected = processesGrid.getSelectionModel().getSelected(); if (!rowSelected) { Ext.Msg.show({ - title: '', + title: _("ID_INFORMATION"), msg: _('ID_NO_SELECTION_WARNING'), buttons: Ext.Msg.INFO, fn: function () { @@ -617,7 +625,7 @@ editNewProcess = function(){ location.href = '../designer?pro_uid='+rowSelected.data.PRO_UID } else { Ext.Msg.show({ - title:'', + title: _("ID_INFORMATION"), msg: _('ID_NO_SELECTION_WARNING'), buttons: Ext.Msg.INFO, fn: function(){}, @@ -701,7 +709,7 @@ deleteProcess = function(){ } } else { Ext.Msg.show({ - title:'', + title: _("ID_INFORMATION"), msg: _('ID_NO_SELECTION_WARNING'), buttons: Ext.Msg.INFO, fn: function(){}, @@ -743,7 +751,7 @@ function exportProcess() { } else { Ext.Msg.show({ - title: "", + title: _("ID_INFORMATION"), msg: _("ID_NO_SELECTION_WARNING"), icon: Ext.MessageBox.INFO, buttons: Ext.MessageBox.OK @@ -751,6 +759,60 @@ function exportProcess() { } } +function generateBpmn() +{ + var record = processesGrid.getSelectionModel().getSelections(); + + if (typeof(record) != "undefined") { + if (record.length == 1) { + var loadMaskGenerateBpmn = new Ext.LoadMask(Ext.getBody(), {msg: _("ID_PROCESSING")}); + var processUid = record[0].get("PRO_UID"); + + loadMaskGenerateBpmn.show(); + + Ext.Ajax.request({ + url: "../processProxy/generateBpmn", + method: "POST", + params: { + processUid: processUid + }, + + success: function (response, opts) + { + var dataResponse = Ext.util.JSON.decode(response.responseText); + + if (dataResponse.status) { + if (dataResponse.status == "OK") { + //processesGrid.store.reload(); + location.assign("../designer?prj_uid=" + dataResponse.projectUid); + } else { + Ext.MessageBox.show({ + title: _("ID_ERROR"), + icon: Ext.MessageBox.ERROR, + buttons: Ext.MessageBox.OK, + msg: dataResponse.message + }); + } + } + + loadMaskGenerateBpmn.hide(); + }, + failure: function (response, opts) + { + loadMaskGenerateBpmn.hide(); + } + }); + } else { + Ext.MessageBox.show({ + title: _("ID_INFORMATION"), + icon: Ext.MessageBox.INFO, + buttons: Ext.MessageBox.OK, + msg: _("ID_NO_SELECTION_WARNING") + }); + } + } +} + importProcessExistGroup = function() { @@ -1191,7 +1253,7 @@ function activeDeactive(){ }); } else { Ext.Msg.show({ - title:'', + title: _("ID_INFORMATION"), msg: _('ID_NO_SELECTION_WARNING'), buttons: Ext.Msg.INFO, fn: function(){}, @@ -1227,7 +1289,7 @@ function enableDisableDebug() }); } else { Ext.Msg.show({ - title:'', + title: _("ID_INFORMATION"), msg: _('ID_NO_SELECTION_WARNING'), buttons: Ext.Msg.INFO, fn: function(){},