Attachment 'attachfile.patch'

Download

   1 diff -r 6cdf52df1219 MoinMoin/action/AttachFile.py
   2 --- a/MoinMoin/action/AttachFile.py	Mon Aug 31 19:05:28 2009 +0200
   3 +++ b/MoinMoin/action/AttachFile.py	Tue Sep 01 00:25:03 2009 +0200
   4 @@ -43,6 +43,8 @@
   5  from MoinMoin.security.textcha import TextCha
   6  from MoinMoin.events import FileAttachedEvent, send_event
   7  from MoinMoin.support import tarfile
   8 +from MoinMoin.util.dataset import TupleDataset, Column
   9 +from MoinMoin.widget.browser import DataBrowserWidget
  10  
  11  action_name = __name__.split('.')[-1]
  12  
  13 @@ -270,6 +272,19 @@
  14  
  15      html = []
  16      if files:
  17 +        data = TupleDataset()
  18 +        data.columns = []
  19 +        data.columns.extend([
  20 +              Column('action', label=_('action')),
  21 +              Column('date', label=_('date')),
  22 +              Column('size', label=_('size')),
  23 +              Column('mimetype', label=_("mimetype")),
  24 +              Column('name', label=_('name')),
  25 +              Column('', label='')
  26 +          ])
  27 +
  28 +        data.columns[-1].hidden = 1
  29 +        row = []
  30          if showheader:
  31              html.append(fmt.rawHTML(_(
  32                  "To refer to attachments on a page, use '''{{{attachment:filename}}}''', \n"
  33 @@ -289,6 +304,7 @@
  34  
  35          html.append(fmt.bullet_list(1))
  36          for file in files:
  37 +            result = []
  38              mt = wikiutil.MimeType(filename=file)
  39              fullpath = os.path.join(attach_dir, file).encode(config.charset)
  40              st = os.stat(fullpath)
  41 @@ -348,12 +364,12 @@
  42                  # archive).
  43                  logging.exception("An exception within zip file attachment handling occurred:")
  44  
  45 -            html.append(fmt.listitem(1))
  46 -            html.append("[%s]" % " | ".join(links))
  47 -            html.append(" (%(fmtime)s, %(fsize)s KB) [[attachment:%(file)s]]" % parmdict)
  48 -            html.append(fmt.listitem(0))
  49 -        html.append(fmt.bullet_list(0))
  50 -
  51 +            result.append('  '.join(links))
  52 +            result.append(parmdict['fmtime'])
  53 +            result.append(parmdict['fsize'])
  54 +            result.append(wikiutil.MimeType(filename=parmdict['file']).mime_type()),
  55 +            result.append(parmdict['file'])
  56 +            data.addRow(tuple(result))
  57      else:
  58          if showheader:
  59              html.append(fmt.paragraph(1))
  60 @@ -361,7 +377,12 @@
  61                                     'pagename': pagename}))
  62              html.append(fmt.paragraph(0))
  63  
  64 -    return ''.join(html)
  65 +    table = DataBrowserWidget(request, css_class="sortable")
  66 +    table.setData(data)
  67 +    html.append(''.join(table.format(method='GET')))
  68 +    html = ''.join(html)
  69 +    #html = html.replace('id="dbw.table"', 'class="sortable" id="dbw.table"')
  70 +    return html
  71  
  72  
  73  def _get_files(request, pagename):
  74 diff -r 6cdf52df1219 MoinMoin/web/static/htdocs/common/js/common.js
  75 --- a/MoinMoin/web/static/htdocs/common/js/common.js	Mon Aug 31 19:05:28 2009 +0200
  76 +++ b/MoinMoin/web/static/htdocs/common/js/common.js	Tue Sep 01 00:25:03 2009 +0200
  77 @@ -389,3 +389,497 @@
  78      return getElementsByClassName(className, tag, elm);
  79  };
  80  
  81 +/*
  82 +  SortTable
  83 +  version 2
  84 +  7th April 2007
  85 +  Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
  86 +  
  87 +  Instructions:
  88 +  Download this file
  89 +  Add <script src="sorttable.js"></script> to your HTML
  90 +  Add class="sortable" to any table you'd like to make sortable
  91 +  Click on the headers to sort
  92 +  
  93 +  Thanks to many, many people for contributions and suggestions.
  94 +  Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
  95 +  This basically means: do what you want with it.
  96 +*/
  97 +
  98 + 
  99 +var stIsIE = /*@cc_on!@*/false;
 100 +
 101 +sorttable = {
 102 +  init: function() {
 103 +    // quit if this function has already been called
 104 +    if (arguments.callee.done) return;
 105 +    // flag this function so we don't do the same thing twice
 106 +    arguments.callee.done = true;
 107 +    // kill the timer
 108 +    if (_timer) clearInterval(_timer);
 109 +    
 110 +    if (!document.createElement || !document.getElementsByTagName) return;
 111 +    
 112 +    sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
 113 +    
 114 +    forEach(document.getElementsByTagName('table'), function(table) {
 115 +      if (table.className.search(/\bsortable\b/) != -1) {
 116 +        sorttable.makeSortable(table);
 117 +      }
 118 +    });
 119 +    
 120 +  },
 121 +  
 122 +  makeSortable: function(table) {
 123 +    if (table.getElementsByTagName('thead').length == 0) {
 124 +      // table doesn't have a tHead. Since it should have, create one and
 125 +      // put the first table row in it.
 126 +      the = document.createElement('thead');
 127 +      the.appendChild(table.rows[0]);
 128 +      table.insertBefore(the,table.firstChild);
 129 +    }
 130 +    // Safari doesn't support table.tHead, sigh
 131 +    if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
 132 +    
 133 +    if (table.tHead.rows.length != 1) return; // can't cope with two header rows
 134 +    
 135 +    // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
 136 +    // "total" rows, for example). This is B&R, since what you're supposed
 137 +    // to do is put them in a tfoot. So, if there are sortbottom rows,
 138 +    // for backwards compatibility, move them to tfoot (creating it if needed).
 139 +    sortbottomrows = [];
 140 +    for (var i=0; i<table.rows.length; i++) {
 141 +      if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
 142 +        sortbottomrows[sortbottomrows.length] = table.rows[i];
 143 +      }
 144 +    }
 145 +    if (sortbottomrows) {
 146 +      if (table.tFoot == null) {
 147 +        // table doesn't have a tfoot. Create one.
 148 +        tfo = document.createElement('tfoot');
 149 +        table.appendChild(tfo);
 150 +      }
 151 +      for (var i=0; i<sortbottomrows.length; i++) {
 152 +        tfo.appendChild(sortbottomrows[i]);
 153 +      }
 154 +      delete sortbottomrows;
 155 +    }
 156 +    
 157 +    // work through each column and calculate its type
 158 +    headrow = table.tHead.rows[0].cells;
 159 +    for (var i=0; i<headrow.length; i++) {
 160 +      // manually override the type with a sorttable_type attribute
 161 +      if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
 162 +        mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
 163 +        if (mtch) { override = mtch[1]; }
 164 +              if (mtch && typeof sorttable["sort_"+override] == 'function') {
 165 +                headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
 166 +              } else {
 167 +                headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
 168 +              }
 169 +              // make it clickable to sort
 170 +              headrow[i].sorttable_columnindex = i;
 171 +              headrow[i].sorttable_tbody = table.tBodies[0];
 172 +              dean_addEvent(headrow[i],"click", function(e) {
 173 +
 174 +          if (this.className.search(/\bsorttable_sorted\b/) != -1) {
 175 +            // if we're already sorted by this column, just 
 176 +            // reverse the table, which is quicker
 177 +            sorttable.reverse(this.sorttable_tbody);
 178 +            this.className = this.className.replace('sorttable_sorted',
 179 +                                                    'sorttable_sorted_reverse');
 180 +            this.removeChild(document.getElementById('sorttable_sortfwdind'));
 181 +            sortrevind = document.createElement('span');
 182 +            sortrevind.id = "sorttable_sortrevind";
 183 +            sortrevind.innerHTML = stIsIE ? '&nbsp<font face="webdings">5</font>' : '&nbsp;&#x25B4;';
 184 +            this.appendChild(sortrevind);
 185 +            return;
 186 +          }
 187 +          if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
 188 +            // if we're already sorted by this column in reverse, just 
 189 +            // re-reverse the table, which is quicker
 190 +            sorttable.reverse(this.sorttable_tbody);
 191 +            this.className = this.className.replace('sorttable_sorted_reverse',
 192 +                                                    'sorttable_sorted');
 193 +            this.removeChild(document.getElementById('sorttable_sortrevind'));
 194 +            sortfwdind = document.createElement('span');
 195 +            sortfwdind.id = "sorttable_sortfwdind";
 196 +            sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
 197 +            this.appendChild(sortfwdind);
 198 +            return;
 199 +          }
 200 +          
 201 +          // remove sorttable_sorted classes
 202 +          theadrow = this.parentNode;
 203 +          forEach(theadrow.childNodes, function(cell) {
 204 +            if (cell.nodeType == 1) { // an element
 205 +              cell.className = cell.className.replace('sorttable_sorted_reverse','');
 206 +              cell.className = cell.className.replace('sorttable_sorted','');
 207 +            }
 208 +          });
 209 +          sortfwdind = document.getElementById('sorttable_sortfwdind');
 210 +          if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
 211 +          sortrevind = document.getElementById('sorttable_sortrevind');
 212 +          if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
 213 +          
 214 +          this.className += ' sorttable_sorted';
 215 +          sortfwdind = document.createElement('span');
 216 +          sortfwdind.id = "sorttable_sortfwdind";
 217 +          sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
 218 +          this.appendChild(sortfwdind);
 219 +
 220 +                // build an array to sort. This is a Schwartzian transform thing,
 221 +                // i.e., we "decorate" each row with the actual sort key,
 222 +                // sort based on the sort keys, and then put the rows back in order
 223 +                // which is a lot faster because you only do getInnerText once per row
 224 +                row_array = [];
 225 +                col = this.sorttable_columnindex;
 226 +                rows = this.sorttable_tbody.rows;
 227 +                for (var j=0; j<rows.length; j++) {
 228 +                  row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
 229 +                }
 230 +                /* If you want a stable sort, uncomment the following line */
 231 +                //sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
 232 +                /* and comment out this one */
 233 +                row_array.sort(this.sorttable_sortfunction);
 234 +                
 235 +                tb = this.sorttable_tbody;
 236 +                for (var j=0; j<row_array.length; j++) {
 237 +                  tb.appendChild(row_array[j][1]);
 238 +                }
 239 +                
 240 +                delete row_array;
 241 +              });
 242 +            }
 243 +    }
 244 +  },
 245 +  
 246 +  guessType: function(table, column) {
 247 +    // guess the type of a column based on its first non-blank row
 248 +    sortfn = sorttable.sort_alpha;
 249 +    for (var i=0; i<table.tBodies[0].rows.length; i++) {
 250 +      text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
 251 +      if (text != '') {
 252 +        if (text.match(/^-?[£$?]?[\d,.]+%?$/)) {
 253 +          return sorttable.sort_numeric;
 254 +        }
 255 +        // check for a date: dd/mm/yyyy or dd/mm/yy 
 256 +        // can have / or . or - as separator
 257 +        // can be mm/dd as well
 258 +        possdate = text.match(sorttable.DATE_RE)
 259 +        if (possdate) {
 260 +          // looks like a date
 261 +          first = parseInt(possdate[1]);
 262 +          second = parseInt(possdate[2]);
 263 +          if (first > 12) {
 264 +            // definitely dd/mm
 265 +            return sorttable.sort_ddmm;
 266 +          } else if (second > 12) {
 267 +            return sorttable.sort_mmdd;
 268 +          } else {
 269 +            // looks like a date, but we can't tell which, so assume
 270 +            // that it's dd/mm (English imperialism!) and keep looking
 271 +            sortfn = sorttable.sort_ddmm;
 272 +          }
 273 +        }
 274 +      }
 275 +    }
 276 +    return sortfn;
 277 +  },
 278 +  
 279 +  getInnerText: function(node) {
 280 +    // gets the text we want to use for sorting for a cell.
 281 +    // strips leading and trailing whitespace.
 282 +    // this is *not* a generic getInnerText function; it's special to sorttable.
 283 +    // for example, you can override the cell text with a customkey attribute.
 284 +    // it also gets .value for <input> fields.
 285 +    
 286 +    hasInputs = (typeof node.getElementsByTagName == 'function') &&
 287 +                 node.getElementsByTagName('input').length;
 288 +    
 289 +    if (node.getAttribute("sorttable_customkey") != null) {
 290 +      return node.getAttribute("sorttable_customkey");
 291 +    }
 292 +    else if (typeof node.textContent != 'undefined' && !hasInputs) {
 293 +      return node.textContent.replace(/^\s+|\s+$/g, '');
 294 +    }
 295 +    else if (typeof node.innerText != 'undefined' && !hasInputs) {
 296 +      return node.innerText.replace(/^\s+|\s+$/g, '');
 297 +    }
 298 +    else if (typeof node.text != 'undefined' && !hasInputs) {
 299 +      return node.text.replace(/^\s+|\s+$/g, '');
 300 +    }
 301 +    else {
 302 +      switch (node.nodeType) {
 303 +        case 3:
 304 +          if (node.nodeName.toLowerCase() == 'input') {
 305 +            return node.value.replace(/^\s+|\s+$/g, '');
 306 +          }
 307 +        case 4:
 308 +          return node.nodeValue.replace(/^\s+|\s+$/g, '');
 309 +          break;
 310 +        case 1:
 311 +        case 11:
 312 +          var innerText = '';
 313 +          for (var i = 0; i < node.childNodes.length; i++) {
 314 +            innerText += sorttable.getInnerText(node.childNodes[i]);
 315 +          }
 316 +          return innerText.replace(/^\s+|\s+$/g, '');
 317 +          break;
 318 +        default:
 319 +          return '';
 320 +      }
 321 +    }
 322 +  },
 323 +  
 324 +  reverse: function(tbody) {
 325 +    // reverse the rows in a tbody
 326 +    newrows = [];
 327 +    for (var i=0; i<tbody.rows.length; i++) {
 328 +      newrows[newrows.length] = tbody.rows[i];
 329 +    }
 330 +    for (var i=newrows.length-1; i>=0; i--) {
 331 +       tbody.appendChild(newrows[i]);
 332 +    }
 333 +    delete newrows;
 334 +  },
 335 +  
 336 +  /* sort functions
 337 +     each sort function takes two parameters, a and b
 338 +     you are comparing a[0] and b[0] */
 339 +  sort_numeric: function(a,b) {
 340 +    aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
 341 +    if (isNaN(aa)) aa = 0;
 342 +    bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); 
 343 +    if (isNaN(bb)) bb = 0;
 344 +    return aa-bb;
 345 +  },
 346 +  sort_alpha: function(a,b) {
 347 +    if (a[0]==b[0]) return 0;
 348 +    if (a[0]<b[0]) return -1;
 349 +    return 1;
 350 +  },
 351 +  sort_ddmm: function(a,b) {
 352 +    mtch = a[0].match(sorttable.DATE_RE);
 353 +    y = mtch[3]; m = mtch[2]; d = mtch[1];
 354 +    if (m.length == 1) m = '0'+m;
 355 +    if (d.length == 1) d = '0'+d;
 356 +    dt1 = y+m+d;
 357 +    mtch = b[0].match(sorttable.DATE_RE);
 358 +    y = mtch[3]; m = mtch[2]; d = mtch[1];
 359 +    if (m.length == 1) m = '0'+m;
 360 +    if (d.length == 1) d = '0'+d;
 361 +    dt2 = y+m+d;
 362 +    if (dt1==dt2) return 0;
 363 +    if (dt1<dt2) return -1;
 364 +    return 1;
 365 +  },
 366 +  sort_mmdd: function(a,b) {
 367 +    mtch = a[0].match(sorttable.DATE_RE);
 368 +    y = mtch[3]; d = mtch[2]; m = mtch[1];
 369 +    if (m.length == 1) m = '0'+m;
 370 +    if (d.length == 1) d = '0'+d;
 371 +    dt1 = y+m+d;
 372 +    mtch = b[0].match(sorttable.DATE_RE);
 373 +    y = mtch[3]; d = mtch[2]; m = mtch[1];
 374 +    if (m.length == 1) m = '0'+m;
 375 +    if (d.length == 1) d = '0'+d;
 376 +    dt2 = y+m+d;
 377 +    if (dt1==dt2) return 0;
 378 +    if (dt1<dt2) return -1;
 379 +    return 1;
 380 +  },
 381 +  
 382 +  shaker_sort: function(list, comp_func) {
 383 +    // A stable sort function to allow multi-level sorting of data
 384 +    // see: http://en.wikipedia.org/wiki/Cocktail_sort
 385 +    // thanks to Joseph Nahmias
 386 +    var b = 0;
 387 +    var t = list.length - 1;
 388 +    var swap = true;
 389 +
 390 +    while(swap) {
 391 +        swap = false;
 392 +        for(var i = b; i < t; ++i) {
 393 +            if ( comp_func(list[i], list[i+1]) > 0 ) {
 394 +                var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
 395 +                swap = true;
 396 +            }
 397 +        } // for
 398 +        t--;
 399 +
 400 +        if (!swap) break;
 401 +
 402 +        for(var i = t; i > b; --i) {
 403 +            if ( comp_func(list[i], list[i-1]) < 0 ) {
 404 +                var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
 405 +                swap = true;
 406 +            }
 407 +        } // for
 408 +        b++;
 409 +
 410 +    } // while(swap)
 411 +  }  
 412 +}
 413 +
 414 +/* ******************************************************************
 415 +   Supporting functions: bundled here to avoid depending on a library
 416 +   ****************************************************************** */
 417 +
 418 +// Dean Edwards/Matthias Miller/John Resig
 419 +
 420 +/* for Mozilla/Opera9 */
 421 +if (document.addEventListener) {
 422 +    document.addEventListener("DOMContentLoaded", sorttable.init, false);
 423 +}
 424 +
 425 +/* for Internet Explorer */
 426 +/*@cc_on @*/
 427 +/*@if (@_win32)
 428 +    document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
 429 +    var script = document.getElementById("__ie_onload");
 430 +    script.onreadystatechange = function() {
 431 +        if (this.readyState == "complete") {
 432 +            sorttable.init(); // call the onload handler
 433 +        }
 434 +    };
 435 +/*@end @*/
 436 +
 437 +/* for Safari */
 438 +if (/WebKit/i.test(navigator.userAgent)) { // sniff
 439 +    var _timer = setInterval(function() {
 440 +        if (/loaded|complete/.test(document.readyState)) {
 441 +            sorttable.init(); // call the onload handler
 442 +        }
 443 +    }, 10);
 444 +}
 445 +
 446 +/* for other browsers */
 447 +//window.onload = sorttable.init;
 448 +
 449 +// written by Dean Edwards, 2005
 450 +// with input from Tino Zijdel, Matthias Miller, Diego Perini
 451 +
 452 +// http://dean.edwards.name/weblog/2005/10/add-event/
 453 +
 454 +function dean_addEvent(element, type, handler) {
 455 +        if (element.addEventListener) {
 456 +                element.addEventListener(type, handler, false);
 457 +        } else {
 458 +                // assign each event handler a unique ID
 459 +                if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
 460 +                // create a hash table of event types for the element
 461 +                if (!element.events) element.events = {};
 462 +                // create a hash table of event handlers for each element/event pair
 463 +                var handlers = element.events[type];
 464 +                if (!handlers) {
 465 +                        handlers = element.events[type] = {};
 466 +                        // store the existing event handler (if there is one)
 467 +                        if (element["on" + type]) {
 468 +                                handlers[0] = element["on" + type];
 469 +                        }
 470 +                }
 471 +                // store the event handler in the hash table
 472 +                handlers[handler.$$guid] = handler;
 473 +                // assign a global event handler to do all the work
 474 +                element["on" + type] = handleEvent;
 475 +        }
 476 +};
 477 +// a counter used to create unique IDs
 478 +dean_addEvent.guid = 1;
 479 +
 480 +function removeEvent(element, type, handler) {
 481 +        if (element.removeEventListener) {
 482 +                element.removeEventListener(type, handler, false);
 483 +        } else {
 484 +                // delete the event handler from the hash table
 485 +                if (element.events && element.events[type]) {
 486 +                        delete element.events[type][handler.$$guid];
 487 +                }
 488 +        }
 489 +};
 490 +
 491 +function handleEvent(event) {
 492 +        var returnValue = true;
 493 +        // grab the event object (IE uses a global event object)
 494 +        event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
 495 +        // get a reference to the hash table of event handlers
 496 +        var handlers = this.events[event.type];
 497 +        // execute each event handler
 498 +        for (var i in handlers) {
 499 +                this.$$handleEvent = handlers[i];
 500 +                if (this.$$handleEvent(event) === false) {
 501 +                        returnValue = false;
 502 +                }
 503 +        }
 504 +        return returnValue;
 505 +};
 506 +
 507 +function fixEvent(event) {
 508 +        // add W3C standard event methods
 509 +        event.preventDefault = fixEvent.preventDefault;
 510 +        event.stopPropagation = fixEvent.stopPropagation;
 511 +        return event;
 512 +};
 513 +fixEvent.preventDefault = function() {
 514 +        this.returnValue = false;
 515 +};
 516 +fixEvent.stopPropagation = function() {
 517 +  this.cancelBubble = true;
 518 +}
 519 +
 520 +// Dean's forEach: http://dean.edwards.name/base/forEach.js
 521 +/*
 522 +        forEach, version 1.0
 523 +        Copyright 2006, Dean Edwards
 524 +        License: http://www.opensource.org/licenses/mit-license.php
 525 +*/
 526 +
 527 +// array-like enumeration
 528 +if (!Array.forEach) { // mozilla already supports this
 529 +        Array.forEach = function(array, block, context) {
 530 +                for (var i = 0; i < array.length; i++) {
 531 +                        block.call(context, array[i], i, array);
 532 +                }
 533 +        };
 534 +}
 535 +
 536 +// generic enumeration
 537 +Function.prototype.forEach = function(object, block, context) {
 538 +        for (var key in object) {
 539 +                if (typeof this.prototype[key] == "undefined") {
 540 +                        block.call(context, object[key], key, object);
 541 +                }
 542 +        }
 543 +};
 544 +
 545 +// character enumeration
 546 +String.forEach = function(string, block, context) {
 547 +        Array.forEach(string.split(""), function(chr, index) {
 548 +                block.call(context, chr, index, string);
 549 +        });
 550 +};
 551 +
 552 +// globally resolve forEach enumeration
 553 +var forEach = function(object, block, context) {
 554 +        if (object) {
 555 +                var resolve = Object; // default
 556 +                if (object instanceof Function) {
 557 +                        // functions have a "length" property
 558 +                        resolve = Function;
 559 +                } else if (object.forEach instanceof Function) {
 560 +                        // the object implements a custom forEach method so use that
 561 +                        object.forEach(block, context);
 562 +                        return;
 563 +                } else if (typeof object == "string") {
 564 +                        // the object is a string
 565 +                        resolve = String;
 566 +                } else if (typeof object.length == "number") {
 567 +                        // the object is array-like
 568 +                        resolve = Array;
 569 +                }
 570 +                resolve.forEach(object, block, context);
 571 +        }
 572 +};
 573 +
 574 +
 575 diff -r 6cdf52df1219 MoinMoin/widget/browser.py
 576 --- a/MoinMoin/widget/browser.py	Mon Aug 31 19:05:28 2009 +0200
 577 +++ b/MoinMoin/widget/browser.py	Tue Sep 01 00:25:03 2009 +0200
 578 @@ -11,7 +11,7 @@
 579  
 580  class DataBrowserWidget(base.Widget):
 581  
 582 -    def __init__(self, request, show_header=True, **kw):
 583 +    def __init__(self, request, show_header=True, css_class=None, **kw):
 584          _ = request.getText
 585          base.Widget.__init__(self, request, **kw)
 586          self.data = None
 587 @@ -27,6 +27,7 @@
 588          self._filter = _('filter')
 589          self.__filter = 'filter'
 590          self._show_header = show_header
 591 +        self.css_class = css_class
 592  
 593      def setData(self, dataset):
 594          """ Sets the data for the browser (see MoinMoin.util.dataset).
 595 @@ -120,7 +121,7 @@
 596          if havefilters:
 597              result.append(fmt.rawHTML('<input type="submit" value="%s" %s>' % (self._filter, self._name('submit'))))
 598  
 599 -        result.append(fmt.table(1, id='%stable' % self.unqual_data_id))
 600 +        result.append(fmt.table(1, id='%stable' % self.unqual_data_id, css_class=self.css_class))
 601  
 602          # add header line
 603          if self._show_header:

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-09-05 15:09:23, 22.3 KB) [[attachment:attachfile.patch]]
  • [get | view] (2009-09-05 15:09:06, 96.8 KB) [[attachment:attachfile.png]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.