manage.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * add by suwibin
  3. */
  4. var manage = window.manage ||
  5. {
  6. go : function(view)
  7. {
  8. var date = new Date();
  9. $("#content").html('loading...');
  10. $.get($_c_d['root'] + '?' + view + '&time=' + date.getTime(),function(t)
  11. {
  12. $("#content").html(t);
  13. });
  14. },
  15. create : function()
  16. {
  17. $.confirm('确定创建这个项目吗?',function(){manage.createAction()});
  18. },
  19. createAction : function()
  20. {
  21. var name = $("#name").val();
  22. if(!name)
  23. {
  24. $.alert('项目名称不能为空');
  25. return;
  26. }
  27. $.post($_c_d['root'] + '?view=manage&type=newaction',{name:name},function(t)
  28. {
  29. $.alert(t, function(){$.box('close');manage.go('view=manage')});
  30. });
  31. },
  32. edit : function()
  33. {
  34. $("#show").hide();
  35. $("#edit").show();
  36. $("#show_show").hide();
  37. $("#edit_show").show();
  38. },
  39. show : function()
  40. {
  41. $("#edit").hide();
  42. $("#show").show();
  43. $("#edit_show").hide();
  44. $("#show_show").show();
  45. },
  46. editpost : function(name)
  47. {
  48. var content = $("#"+name).val();
  49. $.post($_c_d['root'] + '?view=manage&type=edit',{name:name,content:content},function(t)
  50. {
  51. $.alert(t,function(){$.box('close');manage.go('view=manage&type=set&name='+name)});
  52. });
  53. },
  54. oper : function(oper)
  55. {
  56. $.confirm('确定进行此项操作吗?',function(){manage.operAction(oper)});
  57. },
  58. operAction : function(oper)
  59. {
  60. var name = $("#name").val();
  61. manage.go('service='+oper+'&project='+name);
  62. }
  63. };