Rev 833 | Rev 1292 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 833 | Rev 1036 | ||
---|---|---|---|
Line 38... | Line 38... | ||
38 | csrf_token: csrf_token, |
38 | csrf_token: csrf_token, |
39 | plugin: OIDplusPageAdminOIDInfoExport.oid, |
39 | plugin: OIDplusPageAdminOIDInfoExport.oid, |
40 | action: "import_oidinfo_oid", |
40 | action: "import_oidinfo_oid", |
41 | oid: oid |
41 | oid: oid |
42 | }, |
42 | }, |
43 | error:function(jqXHR, textStatus, errorThrown) { |
- | |
44 | if (errorThrown == "abort") return; |
43 | error: oidplus_ajax_error, |
45 | alertError(_L("Error: %1",errorThrown)); |
- | |
46 | }, |
- | |
47 | success:function(data) { |
44 | success: function (data) { |
48 | if ("error" in data) { |
- | |
49 | alertError(_L("Error: %1",data.error)); |
- | |
50 | } else if (data.status >= 0) { |
45 | oidplus_ajax_success(data, function (data) { |
51 | console.log(_L("Imported OID %1",oid)); |
46 | console.log(_L("Imported OID %1", oid)); |
52 | OIDplusPageAdminOIDInfoExport.removeMissingOid(oid); |
47 | OIDplusPageAdminOIDInfoExport.removeMissingOid(oid); |
53 | } else { |
- | |
54 | alertError(_L("Error: %1",data)); |
- | |
55 | } |
48 | }); |
56 | } |
49 | } |
57 | }); |
50 | }); |
58 | }, |
51 | }, |
59 | 52 | ||
60 | uploadXmlFile: function(file) { |
53 | uploadXmlFile: function(file) { |
Line 77... | Line 70... | ||
77 | }, |
70 | }, |
78 | complete: function(jqXHR, text) { |
71 | complete: function(jqXHR, text) { |
79 | $.xhrPool.remove(jqXHR); |
72 | $.xhrPool.remove(jqXHR); |
80 | }, |
73 | }, |
81 | data: form_data, |
74 | data: form_data, |
82 | error:function(jqXHR, textStatus, errorThrown) { |
- | |
83 | if (errorThrown == "abort") return; |
75 | error: oidplus_ajax_error, |
84 | alertError(_L("Error: %1",errorThrown)); |
- | |
85 | }, |
- | |
86 | success:function(data) { |
76 | success:function(data) { |
87 | // TODO XXX: (Future feature) If the user decides that existing OIDs shall be overwritten, then we may not print "Ignored OIDs because they are already existing" |
77 | // TODO XXX: (Future feature) If the user decides that existing OIDs shall be overwritten, then we may not print "Ignored OIDs because they are already existing" |
88 | if ("error" in data) { |
78 | if (typeof data === "object" && "error" in data) { |
89 | if ("count_imported_oids" in data) { |
79 | if (typeof data === "object" && "count_imported_oids" in data) { |
90 | // TODO: Device if alertSuccess, alertWarning oder alertError is shown |
80 | // TODO: Device if alertSuccess, alertWarning oder alertError is shown |
91 | alertSuccess(_L("Successfully imported OIDs: %1",data.count_imported_oids)+"\n"+ |
81 | alertSuccess(_L("Successfully imported OIDs: %1",data.count_imported_oids)+"\n"+ |
92 | _L("Ignored OIDs because they are already existing: %1",data.count_already_existing)+"\n"+ |
82 | _L("Ignored OIDs because they are already existing: %1",data.count_already_existing)+"\n"+ |
93 | _L("Not imported because of errors: %1",data.count_errors)+"\n"+ |
83 | _L("Not imported because of errors: %1",data.count_errors)+"\n"+ |
94 | _L("Warnings: %1",data.count_warnings)+"\n"+ |
84 | _L("Warnings: %1",data.count_warnings)+"\n"+ |
Line 97... | Line 87... | ||
97 | "\n"+ |
87 | "\n"+ |
98 | data.error); |
88 | data.error); |
99 | } else { |
89 | } else { |
100 | alertError(_L("Error: %1",data.error)); |
90 | alertError(_L("Error: %1",data.error)); |
101 | } |
91 | } |
102 | } else if (data.status >= 0) { |
92 | } else if (typeof data === "object" && data.status >= 0) { |
103 | // TODO: Device if alertSuccess, alertWarning oder alertError is shown |
93 | // TODO: Device if alertSuccess, alertWarning oder alertError is shown |
104 | alertSuccess(_L("Successfully imported OIDs: %1",data.count_imported_oids)+"\n"+ |
94 | alertSuccess(_L("Successfully imported OIDs: %1",data.count_imported_oids)+"\n"+ |
105 | _L("Ignored OIDs because they are already existing: %1",data.count_already_existing)+"\n"+ |
95 | _L("Ignored OIDs because they are already existing: %1",data.count_already_existing)+"\n"+ |
106 | _L("Not imported because of errors: %1",data.count_errors)+"\n"+ |
96 | _L("Not imported because of errors: %1",data.count_errors)+"\n"+ |
107 | _L("Warnings: %1",data.count_warnings)); |
97 | _L("Warnings: %1",data.count_warnings)); |
108 | $('#userfile').val(''); |
98 | $('#userfile').val(''); |
109 | } else { |
99 | } else { |
110 | if ("count_imported_oids" in data) { |
100 | if (typeof data === "object" && "count_imported_oids" in data) { |
111 | // TODO: Device if alertSuccess, alertWarning oder alertError is shown |
101 | // TODO: Device if alertSuccess, alertWarning oder alertError is shown |
112 | alertSuccess(_L("Successfully imported OIDs: %1",data.count_imported_oids)+"\n"+ |
102 | alertSuccess(_L("Successfully imported OIDs: %1",data.count_imported_oids)+"\n"+ |
113 | _L("Ignored OIDs because they are already existing: %1",data.count_already_existing)+"\n"+ |
103 | _L("Ignored OIDs because they are already existing: %1",data.count_already_existing)+"\n"+ |
114 | _L("Not imported because of errors: %1",data.count_errors)+"\n"+ |
104 | _L("Not imported because of errors: %1",data.count_errors)+"\n"+ |
115 | _L("Warnings: %1",data.count_warnings)+"\n"+ |
105 | _L("Warnings: %1",data.count_warnings)+"\n"+ |