summaryrefslogtreecommitdiffstats
path: root/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report
diff options
context:
space:
mode:
authorzhangab <zhanganbing@chinamobile.com>2018-04-18 09:11:56 +0800
committerzhangab <zhanganbing@chinamobile.com>2018-04-18 09:12:03 +0800
commitd698af153772ca4351ad3b23fbb987fc749890af (patch)
tree8fa49f10523134f9596814ef7a30528e298ac660 /usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report
parentffffd8a35ae5fcea703a7427844037c07c232b92 (diff)
Fix Security/Vulnerability problems
Change-Id: Ie0f2c9e0794941d9b9a7f00a6c3d349269d98ed1 Issue-ID: USECASEUI-104 Signed-off-by: zhangab <zhanganbing@chinamobile.com>
Diffstat (limited to 'usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report')
-rw-r--r--usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/raptorReportFactory.js595
-rw-r--r--usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/stepFormFactory.js198
2 files changed, 0 insertions, 793 deletions
diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/raptorReportFactory.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/raptorReportFactory.js
deleted file mode 100644
index 83c051db..00000000
--- a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/raptorReportFactory.js
+++ /dev/null
@@ -1,595 +0,0 @@
-appDS2.factory('raptorReportFactory', function($http, $q) {
- return {
- getDefinitionByReportId: function(reportId) {
- return $http({
- method: "GET",
- url: "report/wizard/retrieve_def_tab_wise_data/"+reportId,
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getDefinitionByReportId did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getDefinitionByReportId callback failed");
- });
- },
- getDefinitionByReportId: function(reportId) {
- return $http({
- method: "GET",
- url: "report/wizard/retrieve_def_tab_wise_data/"+reportId,
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getDefinitionByReportId did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getDefinitionByReportId callback failed");
- });
- },
- getDefinitionInSession: function() {
- return $http({
- method: "GET",
- url: "report/wizard/retrieve_def_tab_wise_data/InSession",
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getDefinitionInSession did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getDefinitionInSession callback failed");
- });
- },
-
- createNewDefinition: function() {
- return $http({
- method: "GET",
- url: "report/wizard/retrieve_def_tab_wise_data/Create",
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: createNewDefinition did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: createNewDefinition callback failed");
- });
- },
- updateDefinition: function(updatedJson,isUpdate) {
- return $http({
- method: "POST",
- url: (isUpdate?("report/wizard/save_def_tab_data/"+updatedJson.reportId):"report/wizard/save_def_tab_data/Create"),
- data: updatedJson
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: updateDefinition did not return a valid JSON object.");
- }
- return response.data;
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: updateDefinition callback failed");
- });
- },
- saveNewDefinition: function(updatedJson) {
- return $http({
- method: "POST",
- url: "report/wizard/save_def_tab_data/InSession",
- data: updatedJson
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: saveNewDefinition did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: saveNewDefinition callback failed");
- });
- },
- getSqlInSession: function() {
- return $http({
- method: "GET",
- url: "report/wizard/retrieve_sql_tab_wise_data/InSession",
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getSqlInSession did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getSqlInSession callback failed");
- });
- },
- testRunSQL: function(queryJSON) {
- return $http({
- method: "POST",
- url: "report/wizard/retrieve_data/true",
- data: queryJSON
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return JSON.parse(response.data.data.elements);
- } else {
- return $q.reject("raptorReportFactory: testRunSQL did not return a valid JSON object.");
- }
- return response.data;
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: testRunSQL callback failed");
- });
- },
- formFieldVerifySQL: function(queryJSON) {
- return $http({
- method: "POST",
- url: "report/wizard/retrieve_data/false",
- data: queryJSON
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return JSON.parse(response.data.data.elements);
- } else {
- return $q.reject("raptorReportFactory: formFieldVerifySQL did not return a valid JSON object.");
- }
- return response.data;
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: formFieldVerifySQL callback failed");
- });
- },
- getColumnList: function() {
- return $http({
- method: "GET",
- url: "report/wizard/list_columns",
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getColumnList did not return a valid JSON object.");
- }
- return response.data;
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getColumnList callback failed");
- });
- },
- getDrillDownReportList: function() {
- return $http({
- method: "GET",
- url: "report/wizard/list_drilldown_reports",
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getDrillDownReportList did not return a valid JSON object.");
- }
- return response.data;
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getDrillDownReportList callback failed");
- });
- },
- getChildReportFormField: function(reportId) {
- return $http({
- method: "GET",
- url: "report/wizard/list_child_report_ff/"+reportId,
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getDrillDownReportList did not return a valid JSON object.");
- }
- return response.data;
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getDrillDownReportList callback failed");
- });
- },
- getChildReportColumn: function(reportId) {
- return $http({
- method: "GET",
- url: "report/wizard/list_child_report_col/"+reportId,
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getChildReportColumn did not return a valid JSON object.");
- }
- return response.data;
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getChildReportColumn callback failed");
- });
- },
- getColumnEditInfoById: function(columnId){
- return $http({
- method: "GET",
- url: "report/wizard/retrieve_col_tab_wise_data/"+columnId,
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getColumnEditInfoById did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getColumnEditInfoById callback failed");
- });
- },
- saveColumnEditInfo: function(updatedColumnJson){
- return $http({
- method: "POST",
- url: "report/wizard/save_col_tab_data",
- data: updatedColumnJson
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: saveColumnEditInfo did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: saveColumnEditInfo callback failed");
- });
- },
- postImportXml: function(importXMLJSON){
- return $http({
- method: "POST",
- url: "report/wizard/import_report",
- data: importXMLJSON
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: importXml did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: importXml callback failed");
- });
- },
- copyReportById: function(reportId) {
- return $http({
- method: "GET",
- url: "report/wizard/copy_report/"+reportId,
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: copyReportById did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: copyReportById callback failed");
- });
- },
- saveFormFieldEditInfo: function(updatedFormFieldJson){
- return $http({
- method: "POST",
- url: "report/wizard/save_formfield_tab_data",
- data: updatedFormFieldJson
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: saveFormFieldEditInfo did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: saveFormFieldEditInfo callback failed");
- });
- },
- getFormFieldList: function() {
- return $http({
- method: "GET",
- url: "report/wizard/list_formfields",
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getFormFieldList did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getFormFieldList callback failed");
- });
- },
- getFormFieldEditInfoById: function(fieldId){
- return $http({
- method: "GET",
- url: "report/wizard/retrieve_form_tab_wise_data/"+fieldId,
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getColumnEditInfoById did not return a valid JSON object.");
- }
- return response.data;
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getFormFieldEditInfoById callback failed");
- });
- },
- deleteFormFieldById: function(fieldId){
- return $http({
- method: "GET",
- url: "report/wizard/retrieve_form_tab_wise_data/"+fieldId+"/delete",
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: deleteFormFieldById did not return a valid JSON object.");
- }
- return response.data;
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: deleteFormFieldById callback failed");
- });
- },
- getColumns: function() {
- return $http
- .get('raptor.htm?action=report.search.execute&r_page=0')
- .then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getColumns did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getColumns callback failed");
- });
- },
-
- getSearchData : function() {
- return $http
- .get('raptor.htm?action=report.search.execute&r_page=0')
- .then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getSearchData did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getSearchData callback failed");
- });
- },
-
- getSecurityReportOwnerList: function() {
- return $http
- .get('report/wizard/security/retrieveReportOwner')
- .then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getSecurityReportOwnerList did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getSecurityReportOwnerList callback failed");
- });
- },
- getReportRoleList: function() {
- return $http
- .get('report/wizard/security/retrieveReportRoleList')
- .then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getReportRoleList did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getReportRoleList callback failed");
- });
- },
- getReportSecurityInfo: function() {
- return $http
- .get('report/wizard/security/getReportSecurityInfo')
- .then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getReportSecurityInfo did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getReportSecurityInfo callback failed");
- });
- },
- getReportSecurityUsers: function() {
- return $http
- .get('report/wizard/security/retrieveReportUserList')
- .then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getReportSecurityUsers did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getReportSecurityUsers callback failed");
- });
- },
-
- getReportSecurityRoles: function() {
- return $http
- .get('report/wizard/security/getReportSecurityRoles')
- .then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getReportSecurityUsers did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getReportSecurityUsers callback failed");
- });
- },
-
-
- getSearchDataAtPage : function(pageSearchParameter) {
- return $http
- .get('raptor.htm?action=report.search.execute&r_page='+pageSearchParameter)
- .then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getSearchDataAtPage did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getSearchDataAtPage callback failed");
- });
- },
- setDrillDownPopupOptions: function(drillDownURL,drillDownParams) {
- this.drillDownURL = drillDownURL;
- this.drillDownParams = drillDownParams;
- },
- getReportDeleteStatus : function(deleteUrl) {
- return $http.get(deleteUrl).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: getReportDeleteStatus did not return a valid JSON object.");
- }
-
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: getReportDeleteStatus callback failed");
- });
- },
- addReportSecurityUser: function(UserId) {
- return $http({
- method: "POST",
- url: "report/security/addReportUser",
- data: UserId
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: addReportSecurityUser did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: saveNewDefinition callback failed");
- });
- },
- removeReportSecurityUser: function(UserId) {
- return $http({
- method: "POST",
- url: "report/security/removeReportUser",
- data: UserId
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: removeReportSecurityUser did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: saveNewDefinition callback failed");
- });
- },
- addReportSecurityRole: function(RoleId) {
- return $http({
- method: "POST",
- url: "report/security/addReportRole",
- data: RoleId
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: addReportSecurityRole did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: saveNewDefinition callback failed");
- });
- },
- removeReportSecurityRole: function(RoleId) {
- return $http({
- method: "POST",
- url: "report/security/removeReportRole",
- data: RoleId
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: removeReportSecurityRole did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: removeReportSecurityRole callback failed");
- });
- },
- updateReportSecurityInfo: function(securityInfo) {
- return $http({
- method: "POST",
- url: "report/security/updateReportSecurityInfo",
- data: securityInfo
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: updateReportSecurityInfo did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: updateReportSecurityInfo callback failed");
- });
- },
-
- toggleUserEditAccess: function(reportUser) {
- var readOnly = reportUser.accessAllowed?"N":"Y";
- return $http({
- method: "POST",
- url:"report/security/toggleUserEditAccess/"+reportUser.id,
- data: readOnly
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: toggleUserEditAccess did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: toggleUserEditAccess callback failed");
- });
- },
- toggleRoleEditAccess: function(reportRole) {
- var readOnly = reportRole.accessAllowed?"N":"Y";
- return $http({
- method: "POST",
- url:"report/security/toggleRoleEditAccess/"+reportRole.id,
- data: readOnly
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject("raptorReportFactory: toggleRoleEditAccess did not return a valid JSON object.");
- }
- }, function(response) {
- // something went wrong
- return $q.reject("raptorReportFactory: toggleRoleEditAccess callback failed");
- });
- },
- resetSecurityLoadingCounter: function() {
- this.securityPageApiCounter = 0;
- this.securityPageApiTotalCount = 5;
- },
- icrementSecurityLoadingCounter: function() {
- this.securityPageApiCounter = this.securityPageApiCounter+1;
- },
- checkSecurityLoadingCounter: function() {
- return (this.securityPageApiCounter ==this.securityPageApiTotalCount);
- }
- };
-});
diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/stepFormFactory.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/stepFormFactory.js
deleted file mode 100644
index 5c711425..00000000
--- a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/stepFormFactory.js
+++ /dev/null
@@ -1,198 +0,0 @@
-(function(){
- var stepFormFactory = function($http, $compile, $q, $log) {
-
- var factory = {};
-
- factory.getStepJSONData = function(jsonSrcName) {
- $http({
- method: "GET",
- url: jsonSrcName,
- }).then(function(response) {
- if (typeof response.data === 'object') {
- return response.data;
- } else {
- return $q.reject(response.data);
- }
- }, function(response) {
- // something went wrong
- return $q.reject(response.data);
- });
- }
-
-
- factory.renderColumnForm = function(scope) {
-
- }
- factory.renderForm = function(jsonSrcName, elem, scope) {
- let defer = $q.defer();
- var divStepForm = document.getElementById('stepView');
- var textStyle = "width:300px"
- var textAreaStyle = "width:300px"
- if(divStepForm)
- while(divStepForm && divStepForm.firstChild){
- divStepForm.removeChild(divStepForm.firstChild);
- }
- $http({
- method: 'GET',
- url: jsonSrcName
- }).then(function successCallback(response) {
- // this callback will be called asynchronously
- // when the response is available
- if (typeof response.data === 'object') {
- var json = response.data;
- var step = json.step;
- var div =d3.select(elem[0]);
- var modelNameDict = {};
-
- div.append("h1").attr({"class":"font-color:blue"}).text(json.content.title);
- div.append("div").html(json.content.contentHtml);
- var sections = json.content.sections;
- sections.forEach(function(d, i) {
- var sectionDiv = div.append("div");
- sectionDiv.attr("id", "section_"+i);
- if(d.title != "finalButton")
- sectionDiv.append("h4").text(d.title);
- var proj_id_hidden = sectionDiv.append("input");
- proj_id_hidden.attr({"type":"hidden", "value":"", "name": "proj_id", "ng-model":"proj_id", "style": "" });
-
- var elements = d.elements;
- var buttons = d.buttons;
- var elementTable ;
- if(elements) {
- elements.forEach(function(element, elementIndex) {
-
- var elementBody ;
- if(elementIndex == 0) {
- elementTable = sectionDiv.append("table").attr({"border":"0", "cellpadding":"4", "cellspacing":"0"});
- elementBody = elementTable.append("tbody");
- } else {
- elementBody = elementTable = sectionDiv.select("tbody");
- }
- if(element.input == 'hidden') {
-
- } else {
- var tr = elementBody.append("tr")
- var cellWidthStyle = {"width":"50%"}
-
- if (!(element.spanOverTwoColumns)){
- var td = tr.append("td").attr({"width":"30%","class":"tdLeftColumn"});
- if (element.input=="checkboxGroup") {
- td = td.attr({"rowspan":element.checkboxes.length})
- }
- td.text(element.displayName);
- var cellWidthStyle = {"width":"500px;"}
- }
- td = tr.append("td").attr(cellWidthStyle);
- var model_name_appendix='';
- if (element.name in modelNameDict) {
- modelNameDict[element.name]=modelNameDict[element.name]+1
- model_name_appendix ='_'+modelNameDict[element.name]
- } else {
- modelNameDict[element.name]=0
- }
- if(element.input == 'text') {
- var inp_text = td.append("input");
- inp_text.attr({"type":"text", "value":element.defaultValue, "name": element.name, "ng-model":element.name+model_name_appendix, "style": (element.style?element.style:textStyle) });
- }
- else if(element.input === 'checkbox') {
- var temptd= td.append("label").attr({"class":"checkbox"});
- var temptd2= temptd.append("input").attr({"type":"checkbox", "ng-model": element.checkbox.value});
- var temptd3= temptd.append("i").attr({"class":"skin"})
- var temptd3= temptd.append("span").text(element.checkbox.text);
-
- } else if (element.input === 'radio') {
- element.options.forEach(function(d,i) {
- td.append("input").attr({"type":"radio", "id":element.name+"_"+d.id, "ng-model":element.name+model_name_appendix, "name": element.name, "value": d.id});
- td.append("label").text(d.name);
- })
- } else if (element.input === 'checkboxGroup') {
-
- element.checkboxes.forEach(function(d,i) {
- if (i==0) {
- var temptd= td.append("label").attr({"class":"checkbox"});
- var temptd2= temptd.append("input").attr({"type":"checkbox", "ng-model": d.value});
- var temptd3= temptd.append("i").attr({"class":"skin"})
- var temptd3= temptd.append("span").text(d.text);
- } else {
- var tr = elementBody.append("tr")
- td = tr.append("td").attr({"width":"50%"});
- var temptd= td.append("label").attr({"class":"checkbox"});
- var temptd2= temptd.append("input").attr({"type":"checkbox", "ng-model": d.value});
- var temptd3= temptd.append("i").attr({"class":"skin"})
- var temptd3= temptd.append("span").text(d.text);
- }
- })
- } else if (element.input === 'textarea') {
- td.append("textarea").attr({"rows":"4", "cols":"50", "ng-model":element.name+model_name_appendix, "name": element.name, "style": (element.style?element.style:textAreaStyle)});
- }
- else if (element.input === 'select') {
- var select = td.append("select");
- // need to store options into element name;
- select
- .attr({"name": element.name,"b2b-dropdown":"","ng-model":element.ngModelName,"style":"width:300px"})
- .attr("placeholder-text","Select");
-
-
- /* var data = ["Option 1", "Option 2", "Option 3"]*/
- var options = select
- .selectAll('option')
- .data(element.options).enter()
- .append('option').attr("value", function(d) {return d.value})
- .attr("b2b-dropdown-list","")
- .text(function (d) { return d.text; })
- ;
- } else if (element.input === 'tabletext') {
- var colArray = element.columns.split(',');
- var table = td.append("table");
- table.attr("border", "1");
-
- colArray.forEach(function(d) {
- table.append("th").text(d);
- })
-
- }
- }
- })
- if (buttons) {
- buttons.forEach(function(button, buttonIndex) {
- sectionDiv.append("input").attr({"type":"button", "value": button.text, "ng-click":button.ngFunction,"class":"btn btn-alt btn-small"});
- })
- sectionDiv.append("br");
- }
- }
- else { //if elements
- if((json.step != "1")&&(!json.hideBackButton))
- sectionDiv.append("input").attr({"type":"button", "value": "Back", "ng-click":"previous()","class":"btn btn-alt btn-small"});
- if((d.title == "finalButton")&(!json.hideSaveButton))
- sectionDiv.append("input").attr({"type":"button", "value": "Save", "ng-click":"save()", "class":"btn btn-alt btn-small"});
- if(!json.last_step)
- sectionDiv.append("input").attr({"type":"button", "value": "Next", "ng-click":"next()", "class":"btn btn-alt btn-small"});
-
- }
- })
- elem.html(div.html());
- elem.removeAttr("step-form");
- $compile(elem.contents())(scope);
- defer.resolve();
- } else {
- $log.error
- return $q.reject(response.data);
- }
- }, function errorCallback(response) {
- // called asynchronously if an error occurs
- // or server returns response with an error status.
- $log.error("reponse data is not a valid JSON object");
- defer.resolve();
- });
- //}
- return defer.promise;
- };
-
- return factory;
- };
-
- stepFormFactory.$inject = ['$http', '$compile', '$q'];
-
- appDS2.factory('stepFormFactory', stepFormFactory);
-
-}())