[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/admin/tool/spamcleaner/ -> module.js (source)

   1  M.tool_spamcleaner = {
   2      Y: null,
   3      row: null,
   4      me: null,
   5  
   6      del_all: function() {
   7          var context = M.tool_spamcleaner;
   8  
   9          var yes = confirm(M.util.get_string('spamdeleteallconfirm', 'tool_spamcleaner'));
  10          if (yes) {
  11              var cfg = {
  12                  method: "POST",
  13                  on: {
  14                      success : function(id, o, args) {
  15                          try {
  16                              var resp = context.Y.JSON.parse(o.responseText);
  17                          } catch(e) {
  18                              alert(M.util.get_string('spaminvalidresult', 'tool_spamcleaner'));
  19                              return;
  20                          }
  21                          if (resp == true) {
  22                              window.location.href=window.location.href;
  23                          }
  24                      }
  25                  }
  26              };
  27              context.Y.io(context.me+'?delall=yes&sesskey='+M.cfg.sesskey, cfg);
  28          }
  29      },
  30  
  31      del_user: function(obj, id) {
  32          var context = M.tool_spamcleaner;
  33  
  34          if (context.Y == null) {
  35              // not initialised yet
  36              return;
  37          }
  38  
  39          var yes = confirm(M.util.get_string('spamdeleteconfirm', 'tool_spamcleaner'));
  40          if (yes) {
  41              context.row = obj;
  42              var cfg = {
  43                  method: "POST",
  44                  on: {
  45                      success : function(id, o, args) {
  46                          try {
  47                              var resp = context.Y.JSON.parse(o.responseText);
  48                          } catch(e) {
  49                              alert(M.util.get_string('spaminvalidresult', 'tool_spamcleaner'));
  50                              return;
  51                          }
  52                          if (context.row) {
  53                              if (resp == true) {
  54                                  while(context.row.tagName != 'TR') {
  55                                      context.row = context.row.parentNode;
  56                                  }
  57                                  context.row.parentNode.removeChild(context.row);
  58                                  context.row = null;
  59                              } else {
  60                                  alert(M.util.get_string('spamcannotdelete', 'tool_spamcleaner'));
  61                              }
  62                          }
  63                      }
  64                  }
  65              }
  66              context.Y.io(context.me+'?del=yes&sesskey='+M.cfg.sesskey+'&id='+id, cfg);
  67          }
  68      },
  69  
  70      ignore_user: function(obj, id) {
  71          var context = M.tool_spamcleaner;
  72  
  73          if (context.Y == null) {
  74              // not initilised yet
  75              return;
  76          }
  77  
  78          context.row = obj;
  79          var cfg = {
  80              method: "POST",
  81              on: {
  82                  success : function(id, o, args) {
  83                      try {
  84                          var resp = context.Y.JSON.parse(o.responseText);
  85                      } catch(e) {
  86                          alert(M.util.get_string('spaminvalidresult', 'tool_spamcleaner'));
  87                          return;
  88                      }
  89                      if (context.row) {
  90                          if (resp == true){
  91                              while(context.row.tagName != 'TR') {
  92                                  context.row = context.row.parentNode;
  93                              }
  94                              context.row.parentNode.removeChild(context.row);
  95                              context.row = null;
  96                          }
  97                      }
  98                  }
  99              }
 100          }
 101          context.Y.io(context.me+'?ignore=yes&sesskey='+M.cfg.sesskey+'&id='+id, cfg);
 102      },
 103  
 104      init: function(Y, me) {
 105          var context = M.tool_spamcleaner;
 106  
 107          Y.use('json', 'io-base', function (Y) {
 108              context.Y = Y;
 109              context.me = me;
 110              if (Y.one("#removeall_btn")) {
 111                  Y.on("click", context.del_all, "#removeall_btn");
 112              }
 113          });
 114      }
 115  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1