model.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. App.Model.DNS.loadList = function(){
  2. App.Ajax.request('DNS.getList', {}, App.View.listItems);
  3. }
  4. App.Model.IP.loadList = function(){
  5. App.Ajax.request('IP.getList', {}, App.View.listItems);
  6. }
  7. App.Model.add = function(values, source_json) {
  8. var method = App.Settings.getMethodName('add');
  9. App.Ajax.request(method, {
  10. spell: $.toJSON(values)
  11. }, function(reply){
  12. if(!reply.result) {
  13. alert('FALSE');
  14. }
  15. });
  16. }
  17. App.Model.update = function(values, source_json) {
  18. var method = App.Settings.getMethodName('update');
  19. App.Ajax.request(method, {
  20. 'old': source_json,
  21. 'new': App.Helpers.toJSON(values)
  22. }, function(reply){
  23. if(!reply.result) {
  24. alert('FALSE');
  25. }
  26. });
  27. }
  28. /*
  29. App.Model.IP.update = function(values, source_json) {
  30. App.Ajax.request('IP.update', {
  31. 'source': source_json,
  32. 'target': App.Helpers.toJSON(values)
  33. }, function(reply){
  34. if(!reply.result) {
  35. App.Pages.IP.ipNotSaved(reply);
  36. }
  37. });
  38. }
  39. App.Model.IP.add = function(values) {
  40. App.Ajax.request('IP.add', {
  41. 'target': App.Helpers.toJSON(values)
  42. }, function(reply){
  43. if(!reply.result) {
  44. App.Helpers.alert(reply.message)
  45. }
  46. });
  47. }
  48. App.Model.IP.remove = function(values_json, elm) {
  49. App.Ajax.request('IP.remove', {
  50. 'target': values_json
  51. }, function(reply){
  52. if(!reply.result) {
  53. App.Helpers.alert(reply.message);
  54. }
  55. else {
  56. elm.remove();
  57. }
  58. });
  59. }*/