Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Basics of App now working
* Not displaying message bodies because need to parse and sanitize first |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
cb38509564588cf8489dbe363db526c9 |
| User & Date: | i5ivem@gmail.com 2010-03-23 17:25:17 |
Context
|
2010-03-24
| ||
| 14:46 |
First attempt at UI layout, email bodies load
* Laying out application as desired, with scrolling message pane | |
|
2010-03-23
| ||
| 17:25 |
Basics of App now working
* Not displaying message bodies because need to parse and sanitize first | |
| 14:28 | Initial commit of app check-in: 698b55c0f7 user: i5ivem@gmail.com tags: trunk | |
Changes
Changes to shoefiti.rb.
1 2 3 | require 'rubygems' require 'date' | > | > > > > | | | > > > > > > > > < | < < < | | | | | | > > > > > > > > > | > | | | | > > | > > > > > > | | > > > | > > > > > > > > > > > > > > > > > > > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
require 'rubygems'
require 'date'
require 'json'
Shoes.app :title => "Shoefiti - Librelist Browser" do
URL = "http://librelist.com/archives/"
@listurl = ""
def getlist
download(URL+@listurl) do |list|
@lists = eval(list.response.body)[1]
@place = eval(list.response.body)[0].split("/")
debug(@lists)
debug(@place)
stack do
if @place.length < 5 #Need to break out of this once we get to the list of days. Odd array length due to split on /
list_box :items => @lists do |list|
@listurl += list.text
getlist
end
else
#debug("Pop1")
#debug(@place.pop)
#debug("Pop2")
#debug(@place.pop)
drawcalendar(@place.pop.to_i, @place.pop.to_i, @place.pop.to_s, @lists) #pass @lists?
end
end
end
end
getlist
def drawcalendar(month, year, list, maildays)
off=Date.new(year, month, 01).wday-1 #Offset, not sure wh yI need the -1 here, but I do.
mdays=(Date.new(year, 12, 31) << (12-month)).day #Days in the month
rows=((mdays+off+1).to_f/7.0).ceil #Number of rows in calendar, plus 1 to compensate for -1 above. Have confused myself
days = %w{Su Mo Tu We Th Fr Sa}
days.each do |column|
i = days.index(column)
row = 0
stack :left => i*50, :top => 100 do
para column
until row == rows do
calday = i-off+7*row
if (1..mdays) === calday #Only want to draw if greater than zero and less than max days
if calday.to_s.length == 1
caldaystr = "0"+calday.to_s
else
caldaystr = calday.to_s
end
if maildays.include?(caldaystr+"/") #deal with "0" in front of single digits
para make_date_link(list, year, month, calday)
else
para calday
end
else
para ""
end#
row += 1
end
end
end
end
def make_date_link(list, year, month, day) #http://thread.gmane.org/gmane.comp.lib.shoes/4042/focus=4044
link(day){getmails(list, year, month, day)}
end
def getmails(list, year, month, day)
#need to fix months and days here, ie 0 on front.
if month.to_s.length == 1
month = "0"+month.to_s
else
month = month.to_s
end
if day.to_s.length == 1
day = "0"+day.to_s
else
day = day.to_s
end
url = "http://librelist.com/archives/"+list+"/"+year.to_s+"/"+month.to_s+"/"+day.to_s+"/json/"
debug(url)
download(url) do |data|
emails = eval(data.response.body)[1]
debug(emails.length)
emails.each do |message|
download(url+message) do |data|
js = JSON.parse(data.response.body)
stack :margin => 10, :width => 400 do
border black, :strokewidth => 3, :curve => 5
inscription js["headers"]["Date"]
inscription js["headers"]["From"]
inscription js["headers"]["Subject"]
end
#para js["body"] #Need to sanatize this a bit for output
end
end
# Where to store all these? Or just draw straight away?
end
end
end
|