Editieren Diskussion Vergangenheit Dateianhänge

attachment:stats.patch von Admin/Patches

Dateianhang 'stats.patch'

Herunterladen

   1 diff -x '*.orig' -r -u moin-1.9.1-orig/MoinMoin/stats/hitcounts.py moin-1.9.1/MoinMoin/stats/hitcounts.py
   2 --- moin-1.9.1-orig/MoinMoin/stats/hitcounts.py	2010-01-18 13:49:33.000000000 +0100
   3 +++ moin-1.9.1/MoinMoin/stats/hitcounts.py	2010-02-14 17:24:28.000000000 +0100
   4 @@ -192,7 +192,7 @@
   5  
   6  def draw(pagename, request):
   7      import shutil, cStringIO
   8 -    from MoinMoin.stats.chart import Chart, ChartData, Color
   9 +    import gdchart
  10  
  11      _ = request.getText
  12  
  13 @@ -217,9 +217,12 @@
  14  
  15      # create image
  16      image = cStringIO.StringIO()
  17 -    c = Chart()
  18 -    c.addData(ChartData(views, color='green'))
  19 -    c.addData(ChartData(edits, color='red'))
  20 +    c = gdchart.Line()
  21 +    c.bg_color= 0xffffff
  22 +    c.line_color = 0x000000
  23 +
  24 +    c.setData((views),(edits))
  25 +    c.ext_color=['green']*len(views) + ['red']*len(edits)
  26      chart_title = ''
  27      if request.cfg.sitename:
  28          chart_title = "%s: " % request.cfg.sitename
  29 @@ -229,26 +232,24 @@
  30              'chart_title': chart_title,
  31              'filterpage': filterpage,
  32          }
  33 -    chart_title = "%s\n%sx%d" % (chart_title, _("green=view\nred=edit"), scalefactor)
  34 -    c.option(
  35 -        title=chart_title.encode('iso-8859-1', 'replace'), # gdchart can't do utf-8
  36 -        xtitle=(_('date') + ' (Server)').encode('iso-8859-1', 'replace'),
  37 -        ytitle=_('# of hits').encode('iso-8859-1', 'replace'),
  38 -        title_font=c.GDC_GIANT,
  39 -        #thumblabel = 'THUMB', thumbnail = 1, thumbval = 10,
  40 -        #ytitle_color = Color('green'),
  41 -        #yaxis2 = 1,
  42 -        #ytitle2 = '# of edits',
  43 -        #ytitle2_color = Color('red'),
  44 -        #ylabel2_color = Color('black'),
  45 -        #interpolations = 0,
  46 -        threed_depth=1.0,
  47 -        requested_yinterval=1.0,
  48 -        stack_type=c.GDC_STACK_BESIDE
  49 -    )
  50 -    c.draw(c.GDC_LINE,
  51 -        (request.cfg.chart_options['width'], request.cfg.chart_options['height']),
  52 -        image, days)
  53 +    chart_title = "%s\n%s x %d" % (chart_title, _("green=view\nred=edit"), scalefactor)
  54 +    c.title=chart_title.encode('iso-8859-1', 'replace') # gdchart can't do utf-8
  55 +    c.xtitle=(_('date') + ' (Server)').encode('iso-8859-1', 'replace')
  56 +    c.ytitle=_('# of hits').encode('iso-8859-1', 'replace')
  57 +    c.title_font_size='GIANT'
  58 +    c.threeD_depth=1.0
  59 +    c.requested_yinterval=1.0
  60 +    c.stack_type='BESIDE'
  61 +    c.width=request.cfg.chart_options['width']
  62 +    c.height=request.cfg.chart_options['height']
  63 +    c.setLabels(days)
  64 +
  65 +    import tempfile
  66 +    f = tempfile.NamedTemporaryFile(suffix=".gif")
  67 +    c.draw(f.file)
  68 +    f.file.seek(0)
  69 +    image.write(f.file.read())
  70 +    f.close()
  71  
  72      request.content_type = 'image/gif'
  73      request.content_length = len(image.getvalue())
  74 diff -x '*.orig' -r -u moin-1.9.1-orig/MoinMoin/stats/pagesize.py moin-1.9.1/MoinMoin/stats/pagesize.py
  75 --- moin-1.9.1-orig/MoinMoin/stats/pagesize.py	2010-01-18 13:49:33.000000000 +0100
  76 +++ moin-1.9.1/MoinMoin/stats/pagesize.py	2010-02-14 17:24:28.000000000 +0100
  77 @@ -51,10 +51,10 @@
  78  
  79  def draw(pagename, request):
  80      import bisect, shutil, cStringIO
  81 -    from MoinMoin.stats.chart import Chart, ChartData, Color
  82 +    import gdchart
  83 +    from MoinMoin.util.web import Color
  84  
  85      _ = request.getText
  86 -    style = Chart.GDC_3DBAR
  87  
  88      # get data
  89      pages = request.rootpage.getPageDict()
  90 @@ -72,11 +72,11 @@
  91      if upper_bound >= 65536:
  92          bounds.extend([s*65536 for s in range(2, 9)])
  93  
  94 -    data = [None] * len(bounds)
  95 +    data = [0] * len(bounds)
  96      for size, name in sizes:
  97          idx = bisect.bisect(bounds, size)
  98          ##idx = int((size / upper_bound) * classes)
  99 -        data[idx] = (data[idx] or 0) + 1
 100 +        data[idx] = data[idx] + 1
 101  
 102      labels = ["%d" % b for b in bounds]
 103  
 104 @@ -87,31 +87,35 @@
 105  
 106      # create image
 107      image = cStringIO.StringIO()
 108 -    c = Chart()
 109 -    ##c.addData(ChartData(data, 'magenta'))
 110 -    c.addData(ChartData(_slice(data, 0, 7), 'blue'))
 111 -    if upper_bound >= 1024:
 112 -        c.addData(ChartData(_slice(data, 7, 14), 'green'))
 113 -    if upper_bound >= 8192:
 114 -        c.addData(ChartData(_slice(data, 14, 21), 'red'))
 115 -    if upper_bound >= 65536:
 116 -        c.addData(ChartData(_slice(data, 21, 28), 'magenta'))
 117 +    c = gdchart.Bar3D()
 118 +    c.bg_color= 0xffffff
 119 +    c.line_color = 0x000000
 120 +
 121 +    c.setData(data)
 122 +    c.ext_color= []
 123 +    for x in ['blue', 'green', 'red', 'magenta']:
 124 +        c.ext_color = c.ext_color + [ Color(x) ] * 8
 125      title = ''
 126      if request.cfg.sitename: title = "%s: " % request.cfg.sitename
 127 -    title = title + _('Page Size Distribution')
 128 -    c.option(
 129 -        annotation=(bisect.bisect(bounds, upper_bound), Color('black'), "%d %s" % sizes[-1]),
 130 -        title=title.encode('iso-8859-1', 'replace'), # gdchart can't do utf-8
 131 -        xtitle=_('page size upper bound [bytes]').encode('iso-8859-1', 'replace'),
 132 -        ytitle=_('# of pages of this size').encode('iso-8859-1', 'replace'),
 133 -        title_font=c.GDC_GIANT,
 134 -        threed_depth=2.0,
 135 -        requested_yinterval=1.0,
 136 -        stack_type=c.GDC_STACK_LAYER,
 137 -    )
 138 -    c.draw(style,
 139 -        (request.cfg.chart_options['width'], request.cfg.chart_options['height']),
 140 -        image, labels)
 141 +    c.title = title.encode('iso-8859-1','replace') + _('Page Size Distribution').encode('iso-8859-1', 'replace')
 142 +    c.width=request.cfg.chart_options['width']
 143 +    c.height=request.cfg.chart_options['height']
 144 +    c.xtitle=_('page size upper bound [bytes]').encode('iso-8859-1', 'replace')
 145 +    c.ytitle=_('# of pages of this size').encode('iso-8859-1', 'replace')
 146 +    #c.annotate(point=bisect.bisect(bounds, upper_bound), color='black', note="%d %s" % sizes[-1])
 147 +    c.title_font_size="GIANT"
 148 +    c.stack_type="LAYER"
 149 +    c.threeD_depth=2.0
 150 +    c.requested_yinterval=1.0
 151 +    c.setLabels(labels)
 152 +
 153 +    import tempfile
 154 +    f = tempfile.NamedTemporaryFile(suffix=".gif")
 155 +    c.draw(f.file)
 156 +    f.file.seek(0)
 157 +    image.write(f.file.read())
 158 +    f.close()
 159 +
 160  
 161      request.content_type = 'image/gif'
 162      request.content_length = len(image.getvalue())
 163 diff -x '*.orig' -r -u moin-1.9.1-orig/MoinMoin/stats/useragents.py moin-1.9.1/MoinMoin/stats/useragents.py
 164 --- moin-1.9.1-orig/MoinMoin/stats/useragents.py	2010-01-18 13:49:33.000000000 +0100
 165 +++ moin-1.9.1/MoinMoin/stats/useragents.py	2010-02-14 17:24:28.000000000 +0100
 166 @@ -120,12 +120,11 @@
 167  
 168  def draw(pagename, request):
 169      import shutil, cStringIO
 170 -    from MoinMoin.stats.chart import Chart, ChartData, Color
 171 +    import gdchart
 172 +    from MoinMoin.util.web import Color
 173  
 174      _ = request.getText
 175  
 176 -    style = Chart.GDC_3DPIE
 177 -
 178      # get data
 179      colors = ['red', 'mediumblue', 'yellow', 'deeppink', 'aquamarine', 'purple', 'beige',
 180                'blue', 'forestgreen', 'orange', 'cyan', 'fuchsia', 'lime']
 181 @@ -152,26 +151,34 @@
 182  
 183      # create image
 184      image = cStringIO.StringIO()
 185 -    c = Chart()
 186 -    c.addData(data)
 187 +    c = gdchart.Pie3D()
 188 +    c.bg_color= 0xffffff
 189 +    c.line_color = 0x000000
 190 +    c.setData(*data)
 191  
 192      title = ''
 193      if request.cfg.sitename: title = "%s: " % request.cfg.sitename
 194      title = title + _('Distribution of User-Agent Types')
 195 -    c.option(
 196 -        pie_color=colors,
 197 -        label_font=Chart.GDC_SMALL,
 198 -        label_line=1,
 199 -        label_dist=20,
 200 -        threed_depth=20,
 201 -        threed_angle=225,
 202 -        percent_labels=Chart.GDCPIE_PCT_RIGHT,
 203 -        title_font=c.GDC_GIANT,
 204 -        title=title.encode('iso-8859-1', 'replace')) # gdchart can't do utf-8
 205 +    c.color=colors
 206 +    c.label_font_size=0 #'SMALL'
 207 +    c.label_line=1
 208 +    c.label_dist=20
 209 +    c.threeD_depth=20
 210 +    c.threeD_angle=225
 211 +    c.percent_labels='RIGHT'
 212 +    c.title_font_size=2 #"GIANT"
 213 +    c.title=title.encode('iso-8859-1', 'replace') # gdchart can't do utf-8
 214      labels = [label.encode('iso-8859-1', 'replace') for label in labels]
 215 -    c.draw(style,
 216 -        (request.cfg.chart_options['width'], request.cfg.chart_options['height']),
 217 -        image, labels)
 218 +    c.setLabels( labels )
 219 +    c.width = request.cfg.chart_options['width']
 220 +    c.height = request.cfg.chart_options['height']
 221 +
 222 +    import tempfile
 223 +    f = tempfile.NamedTemporaryFile(suffix=".gif")
 224 +    c.draw(f.file)
 225 +    f.file.seek(0)
 226 +    image.write(f.file.read())
 227 +    f.close()
 228  
 229      request.content_type = 'image/gif'
 230      request.content_length = len(image.getvalue())

Neuer Dateianhang

Neuer Dateianhang
Umbenennen auf
Anhänge gleichen Namens überschreiben
Tippe: 1234

Gespeicherte Dateianhänge

Um Dateianhänge in eine Seite einzufügen sollte unbedingt eine Angabe wie attachment:dateiname benutzt werden, wie sie auch in der folgenden Liste der Dateien erscheint. Es sollte niemals die URL des Verweises ("laden") kopiert werden, da sich diese jederzeit ändern kann und damit der Verweis auf die Datei brechen würde.
  • [laden | anzeigen] (2010-02-16 00:14:49, 0.7 KB) [[attachment:disable-spell-check.patch]]
  • [laden | anzeigen] (2010-07-16 01:10:04, 1.4 KB) [[attachment:isbn.patch]]
  • [laden | anzeigen] (2010-02-16 00:19:52, 0.6 KB) [[attachment:sitemap.patch]]
  • [laden | anzeigen] (2010-02-16 00:20:42, 8.1 KB) [[attachment:stats.patch]]
  • [laden | anzeigen] (2010-02-16 00:20:50, 0.7 KB) [[attachment:wsgiapp.patch]]
  • [laden | anzeigen] (2010-02-16 00:20:57, 1.6 KB) [[attachment:xapian.patch]]
 Alle Dateien | Ausgewählte Dateien: löschen verschieben auf Seite copy to page