view.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. App.View.popup = function(content) {
  2. var tpl = App.Templates.get('popup', 'general');
  3. if ('undefined' != typeof App.Templates.html.popup[content]) {
  4. var content = App.Templates.get(content, 'popup').finalize();
  5. }
  6. tpl.set(':content', content);
  7. $('#popup-bg, #popup').remove();
  8. $(document.body).append(tpl.finalize());
  9. }
  10. App.View.closePopup = function(){
  11. $('.black_overlay').remove();
  12. $('.popup_content').remove();
  13. }
  14. App.View.updateInitialInfo = function(key, object) {
  15. var expr = '.'+key;
  16. var object = parseInt(object, 10);
  17. var html = object + ' ' + App.Messages.get(key, (object > 1));
  18. $(expr).html(html);
  19. }
  20. App.View.listItems = function(reply){
  21. var acc = [];
  22. var build_method = App.Env.getWorldName() + '_entry';
  23. $(reply.data).each(function(i, o){
  24. acc[acc.length++] = App.HTML.Build[build_method](o);
  25. });
  26. var html = acc.done().wrapperize('ENTRIES_WRAPPER', 'ip');
  27. App.Ref.CONTENT.html(html);
  28. App.Helpers.updateScreen();
  29. }
  30. /*App.View.start = function(){
  31. };
  32. App.View.showDatabases = function(databases){
  33. var tpl = App.HTML.makeDatabases(databases);
  34. $('#navigation').html(tpl.wrapperize('database_wrap', 'database'));
  35. }
  36. App.View.openDatabase = function(data, ref, db_name){
  37. var tpl = App.HTML.makeDbTableList(data);
  38. $('.databases .tables').remove();
  39. $('.databases .active').removeClass('active');
  40. $(ref).after(tpl.wrapperize('database_table_wrap', 'database'));
  41. $(ref).attr('className', 'active do.closeDatabase('+db_name+')"');
  42. }
  43. App.View.openTable = function(data, ref, table_name){
  44. var tpl = App.HTML.makeDbFieldsList(data);
  45. $(ref).next('.fields').remove();
  46. $(ref).after(tpl.wrapperize('database_field_wrap', 'database'));
  47. $(ref).attr('className', 'active do.closeTable('+table_name+')"');
  48. App.Helpers.updateScreen();
  49. }
  50. App.View.resultReturned = function(reply){
  51. if(reply.result){
  52. $('#results').text(reply.data);
  53. }else{
  54. $('#results').text(reply.message);
  55. }
  56. }
  57. App.View.Pages.IP.list = function(reply){
  58. var acc = [];
  59. $(reply.data).each(function(i, o){
  60. acc[acc.length++] = App.HTML.Build.ip_entry(o);
  61. });
  62. var html = acc.done().wrapperize('ENTRIES_WRAPPER', 'ip');
  63. App.Ref.CONTENT.html(html);
  64. App.Helpers.updateScreen();
  65. }
  66. App.View.Pages.DNS.list = function(reply){
  67. var acc = [];
  68. $(reply.data).each(function(i, o){
  69. acc[acc.length++] = App.HTML.Build.dns_entry(o);
  70. });
  71. var html = acc.done().wrapperize('ENTRIES_WRAPPER', 'dns');
  72. App.Ref.CONTENT.html(html);
  73. App.Helpers.updateScreen();
  74. }
  75. */