Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 149 lines (127 sloc) 3.542 kb
94419467 »
2010-05-31 first commit
1 require "messagestrings.rb"
2
3 class Session
4
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
5 def displaybull(number)
6 bulletin = fetch_bulletin(number)
7 print
c732cce9 »
2011-04-09 color fixes prompt fixes menu fixes
8 print "%R;#%W;#{number} %G; #{bulletin.name}"
98f66769 »
2010-08-28 fixed the colour codes
9 print "%C;Path: %G;#{bulletin.path}"
87c7ba10 » martindemello
2010-06-13 undo accidental overwriting of commit 6262136
10 end
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
11
12 def bullmaint
13
14 readmenu(
87c7ba10 » martindemello
2010-06-13 undo accidental overwriting of commit 6262136
15 :initval => 1,
16 :range => 1..(b_total),
8be7097a »
2010-08-14 themes basically working
17 :loc => BULLETIN
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
18 ) {|sel, bpointer, moved|
19 if !sel.integer?
20 parameters = Parse.parse(sel)
21 sel.gsub!(/[-\d]/,"")
22 end
23
24 displaybull(bpointer) if moved
25
26 case sel
27 when "/"; showbulletin(bpointer)
106ec2a4 »
2010-06-28 email, userconfig, web updates
28 when "Q"; bpointer = true
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
29 when "W"; displaywho
30 when "PU";page
31 when "A"; addbulletin
32 when "P"; changebulletinpath(bpointer)
33 when "N"; changebulletinname(bpointer)
34 when "K"; deletebulletin(bpointer)
35 when "G"; leave
36 when "?"; gfileout ("bullmnu")
37 end # of case
38 p_return = [bpointer,(b_total)]
39 }
87c7ba10 » martindemello
2010-06-13 undo accidental overwriting of commit 6262136
40 end
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
41
42 def addbulletin
43
ba4aa757 »
2010-07-01 datamapper updates
44 name = getinp("Enter new bulletin name: ",:nonempty)
45 path = getinp("Enter new bulletin path: ",:nonempty)
c732cce9 »
2011-04-09 color fixes prompt fixes menu fixes
46 if yes("Are you sure #{YESNO}", true, false,true)
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
47 add_bulletin(name, path)
48 else
c732cce9 »
2011-04-09 color fixes prompt fixes menu fixes
49 print "%WR; Aborted. %W;"
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
50 end
51 print
94419467 »
2010-05-31 first commit
52 end
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
53
54 def changebulletinname(bpointer)
55
56 bulletin = fetch_bulletin(bpointer)
87c7ba10 » martindemello
2010-06-13 undo accidental overwriting of commit 6262136
57 name = getinp("Enter new bulletin name: ")
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
58 if name !='' then
59 bulletin.name = name
60 update_bulletin(bulletin)
87c7ba10 » martindemello
2010-06-13 undo accidental overwriting of commit 6262136
61 else
98f66769 »
2010-08-28 fixed the colour codes
62 print "%WR;Not Changed.%W;"
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
63 end
64 print
65 end
66
67 def changebulletinpath(bpointer)
68
69 bulletin = fetch_bulletin(bpointer)
70 print CHANGEBULLETINPATHWARNING
87c7ba10 » martindemello
2010-06-13 undo accidental overwriting of commit 6262136
71 path = getinp("Enter new bulletin path: ")
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
72 if path != ""
73 bulletin.path = path
74 update_bulletin(bulletin)
75 print
76 else
c732cce9 »
2011-04-09 color fixes prompt fixes menu fixes
77 print "%WR; Not Changed. %W;"
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
78 end
94419467 »
2010-05-31 first commit
79 end
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
80
81 def deletebulletin(bpointer)
82 if bpointer > 0 then
83 delete_bulletin(bpointer)
84 renumber_bulletins
85 bpointer = b_total if bpointer > b_total
86 else
87 print NOBULLETINERROR
88 end
89 end
90
91 def showbulletin(bpointer)
92 if b_total > 0 then
93 displaybull(bpointer)
87c7ba10 » martindemello
2010-06-13 undo accidental overwriting of commit 6262136
94 else
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
95 print
c732cce9 »
2011-04-09 color fixes prompt fixes menu fixes
96 print "%WR; No bulletins. Why not add one? %W;"
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
97 end
98 end
99
100 #-------------------Bulletin Section-------------------
101
102 def displaybullet
a5d4b179 »
2010-08-10 you can select a theme. it doesn't do anything yet...
103
104
105
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
106 i = 0
107 if b_total < 1 then
c732cce9 »
2011-04-09 color fixes prompt fixes menu fixes
108 print "%WR; No Bulletins %W;"
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
109 return
110 end
a5d4b179 »
2010-08-10 you can select a theme. it doesn't do anything yet...
111 ogfileout("bullethdr",0,true)
112 if !existfileout('bulletins',0,true)
98f66769 »
2010-08-28 fixed the colour codes
113 print "%G;Bulletins Available:"
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
114 for i in 1..(b_total)
115 bulletin = fetch_bulletin(i)
98f66769 »
2010-08-28 fixed the colour codes
116 print " %B;#{i}...%G;#{bulletin.name}"
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
117 end
a5d4b179 »
2010-08-10 you can select a theme. it doesn't do anything yet...
118 end
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
119 print
120 end
121
122 def bullets(parameters)
87c7ba10 » martindemello
2010-06-13 undo accidental overwriting of commit 6262136
123 t = (parameters[0] > 0) ? parameters[0] : 0
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
124
125 if t == 0 then
126 displaybullet if !existfileout('bulletins',0,true)
98f66769 »
2010-08-28 fixed the colour codes
127 prompt = "\r\n%W;Bulletin #[1-#{b_total}] ? #{RET} to quit: "
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
128 while true
106ec2a4 »
2010-06-28 email, userconfig, web updates
129 # getinp(prompt, :nonempty) {|inp| <-- removed :nonempty which prevents the loop from exiting on <return>
130 getinp(prompt) {|inp|
87c7ba10 » martindemello
2010-06-13 undo accidental overwriting of commit 6262136
131 happy = inp.upcase
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
132 t = happy.to_i
133 case happy
134 when "CR"; crerror
8be7097a »
2010-08-14 themes basically working
135 when @cmd_hash["bullquit"] ; run_if_ulevel("bullquit") {return}
5930585e »
2010-08-13 configurable commands
136 when @cmd_hash["bullmenu"] ; run_if_ulevel("bullmenu") {displaybullet}
8be7097a »
2010-08-14 themes basically working
137 when ""; return
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
138 else
87c7ba10 » martindemello
2010-06-13 undo accidental overwriting of commit 6262136
139 if t > 0 and t <= b_total then
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
140 bulletin = fetch_bulletin(t)
879cc95c »
2010-08-11 adding customizable commands
141 ogfileout(bulletin.path,1,true) #if @bulletins.has_index?(t)
4e699422 » martindemello
2010-06-13 run rbeautify over the .rb files and remove executable bit
142 end
143 end #of case
144 }
145 end
146 end
87c7ba10 » martindemello
2010-06-13 undo accidental overwriting of commit 6262136
147 end
94419467 »
2010-05-31 first commit
148
149 end #class Session
Something went wrong with that request. Please try again.