Pimki 1.1.092 → 1.2.092

Sign up to get free protection for your applications and to get access to all the features.
data/README-PIMKI CHANGED
@@ -66,6 +66,10 @@ Command-line options:
66
66
  Run "ruby pimki.rb --help"
67
67
 
68
68
  History:
69
+ 1.2.092 Bug-fix and minor enhancements release
70
+ - Fixed problem with free-content of menu. (Mark S)
71
+ - Fixed problem in persisting menu-type changes.
72
+ - Fixed broken images in Mind Map under Firefox 1.0
69
73
 
70
74
  1.1.092 Bug-fix and minor enhancements release
71
75
  - Changed storage path to be relative to CWD to avoid storing under gem
@@ -218,7 +218,7 @@ class WikiController < ActionControllerServlet
218
218
  page.wiki_words.size > 0
219
219
  }.sort_by { |page| page.name }
220
220
  end
221
- if web.menu_limit
221
+ if web.menu_limit && @menu_pages
222
222
  @menu_pages = @menu_pages[0..web.menu_limit]
223
223
  end
224
224
  end #}}}
@@ -274,18 +274,30 @@ class WikiController < ActionControllerServlet
274
274
  limit -= 1 if limit >= 0
275
275
 
276
276
  # need to go through the WikiService to persist the command:
277
- wiki.save_menu_pref web, type, limit, content, category
277
+ wiki.save_menu_pref web_address, type, limit, content, category
278
278
  end
279
279
 
280
280
  if web_address
281
- redirect_show "HomePage"
281
+ # redirect to the most recently viewed page, or the home page.
282
+ pname = begin
283
+ web.select{ true }.by_last_visited.first.name
284
+ rescue
285
+ "HomePage"
286
+ end
287
+ redirect_show pname
282
288
  elsif wiki.webs.length == 1
289
+ # only one web, so go there.
283
290
  redirect_show "HomePage", wiki.webs.values.first.address
284
291
  else
285
292
  redirect_path "/web_list/"
286
293
  end
287
294
  end #}}}
288
295
 
296
+ def get_map_img
297
+ file_name = "map.png"
298
+ file_path = File.join WikiService.storage_path, file_name
299
+ send_export(file_name, file_path, "image/png")
300
+ end
289
301
 
290
302
  # Within a single page --------------------------------------------------------
291
303
 
data/app/models/page.rb CHANGED
@@ -88,4 +88,6 @@ class Page
88
88
  def method_missing(method_symbol)
89
89
  revisions.last.send(method_symbol)
90
90
  end
91
- end
91
+ end
92
+
93
+ # jEdit :folding=indent:collapseFolds=1:
data/app/models/web.rb CHANGED
@@ -103,8 +103,8 @@ class Web
103
103
 
104
104
  # Graph properties:
105
105
  file.puts "digraph G {"
106
- file.puts 'size="8,8";'
107
- file.puts 'ratio=fill;'
106
+ file.puts 'size="7,5";'
107
+ #file.puts 'ratio=fill;'
108
108
  file.puts 'concentrate=true;'
109
109
  file.puts 'node [fontsize=10,fontname="Tahoma"];'
110
110
  file.puts 'edge [len=1.5];'
@@ -163,8 +163,8 @@ class Web
163
163
 
164
164
  # Graph properties:
165
165
  file.puts "digraph G {"
166
- file.puts 'size="8,8";'
167
- file.puts 'ratio=fill;'
166
+ file.puts 'size="7,5";'
167
+ #file.puts 'ratio=fill;'
168
168
  file.puts 'concentrate=true;'
169
169
  file.puts 'node [fontsize=10,fontname="Tahoma"];'
170
170
  file.puts 'edge [len=1.5];'
@@ -201,8 +201,8 @@ class Web
201
201
  File.open(dotFile, "w") do |file|
202
202
  # Graph properties:
203
203
  file.puts "digraph G {"
204
- file.puts 'size="8,8";'
205
- file.puts 'ratio=fill;'
204
+ file.puts 'size="7,5";'
205
+ #file.puts 'ratio=fill;'
206
206
  file.puts 'concentrate=true;'
207
207
  file.puts 'node [fontsize=10,fontname="Tahoma"];'
208
208
  file.puts 'edge [len=1.5];'
@@ -86,15 +86,17 @@ class WikiService < MadeleineService
86
86
  web.pages[new_page_name] = page
87
87
  end #}}}
88
88
 
89
- def save_menu_pref(web, type, limit, content, category) #{{{
89
+ def save_menu_pref(web_address, type, limit, content, category) #{{{
90
+ web = @webs[web_address]
90
91
  web.menu_type = type
91
92
  web.menu_limit = limit
92
- web.menu_content = content
93
93
  web.menu_category = category
94
+ # TODO: persist revisions of user specified content.
95
+ web.menu_content = content
94
96
  if web.menu_type == 'user'
95
- # only calculate the rendered content once:
97
+ # Only calculate the rendered content once:
96
98
  web.rendered_menu = Page.new(
97
- web, 'menu', @params["content"], Time.now, ''
99
+ web, 'menu', content, Time.now, ''
98
100
  ).revisions.last.display_content
99
101
  end
100
102
  end #}}}
@@ -14,13 +14,15 @@ module WikiWords
14
14
  "абвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓєѕіїјљћќѝўџѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӀӂӄӆӈӊӌӎӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӹ" +
15
15
  "աբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆև"
16
16
 
17
- WIKI_WORD_PATTERN = '[A-Z' + I18N_HIGHER_CASE_LETTERS + '][a-z' + I18N_LOWER_CASE_LETTERS + ']+[A-Z' + I18N_HIGHER_CASE_LETTERS + ']\w+'
17
+ DIGITS = "0123456789"
18
+
19
+ WIKI_WORD_PATTERN = '[A-Z' + I18N_HIGHER_CASE_LETTERS + ']+[a-z' + I18N_LOWER_CASE_LETTERS + DIGITS + ']+[A-Z' + I18N_HIGHER_CASE_LETTERS + DIGITS + ']\w+'
18
20
 
19
21
  def self.separate(wiki_word, ignore_separation = false)
20
22
  if ignore_separation
21
23
  wiki_word
22
24
  else
23
- wiki_word.gsub(/([a-z#{I18N_LOWER_CASE_LETTERS}])([A-Z#{I18N_HIGHER_CASE_LETTERS}])/u, '\1 \2').gsub(/(\d+)/u, ' \1 ')
25
+ wiki_word.gsub(/([a-z#{I18N_LOWER_CASE_LETTERS}])([A-Z#{I18N_HIGHER_CASE_LETTERS}#{DIGITS}])/u, '\1 \2').gsub(/(\d+)/u, ' \1 ')
24
26
  end
25
27
  end
26
28
  end
data/app/views/menu.rhtml CHANGED
@@ -1,4 +1,4 @@
1
- <div id="Menu">
1
+ <div id="Menu" width="150">
2
2
  <p>
3
3
  <table>
4
4
  <% begin %>
@@ -12,7 +12,7 @@
12
12
 
13
13
  #Menu th {
14
14
  color: darkgreen;
15
- font-size: 12px;
15
+ font-size: 12px;
16
16
  text-align: left
17
17
  }
18
18
 
@@ -9,101 +9,96 @@
9
9
  </div>
10
10
  <% end %>
11
11
 
12
- <div id="allPages" style="float: left; width: 280px; margin-right: 30px">
13
- <% unless @pages_that_are_orphaned.empty? && @page_names_that_are_wanted.empty? %>
14
- <h2>
15
- All Pages
16
- <br/><small style="font-size: 12px"><i>All pages in <%= @set_name %> listed alphabetically</i></small>
17
- </h2>
18
- <% end %>
19
-
20
- <ul><% for page in @pages_by_name.sort_by { |p| p.name } %><li><a href="../show/<%= page.name %>"><%= truncate(page.plain_name, 35) %></a></li><% end %></ul>
21
-
22
- <% if @web.count_pages %>
23
- <% total_chars = @pages_in_category.characters %>
24
- <p><small>All content: <%= total_chars %> chars / <%= sprintf("%-.1f", (total_chars / 2275 )) %> pages</small></p>
25
- <% end %>
26
- </div>
27
-
28
- <div style="float: left; width: 500px">
29
- <% unless @page_names_that_are_wanted.empty? %>
30
- <h2>
31
- Wanted Pages
32
- <br/><small style="font-size: 12px"><i>Unexisting pages that other pages in <%= @set_name %> reference</i></small>
33
- </h2>
34
-
35
- <ul style="margin-bottom: 10px">
36
- <% for page_name in @page_names_that_are_wanted.sort_by { |pname| pname } %>
37
- <li>
38
- <a href="../show/<%= page_name %>"><%= truncate(WikiWords.separate(page_name), 35) %></a>
39
- wanted by
40
- <%= web.select.pages_that_reference(page_name).collect { |page| page.link }.join(", ") %>
41
- </li>
12
+ <div id="listsContainer" style="float: left; width: 300px;">
13
+ <% unless @pages_that_are_orphaned.empty? && @page_names_that_are_wanted.empty? %>
14
+ <h2>
15
+ All Pages
16
+ <br/><small style="font-size: 12px"><i>All pages in <%= @set_name %> listed alphabetically</i></small>
17
+ </h2>
18
+ <% end %>
19
+
20
+ <ul><% for page in @pages_by_name.sort_by { |p| p.name } %><li><a href="../show/<%= page.name %>"><%= truncate(page.plain_name, 35) %></a></li><% end %></ul>
21
+
22
+ <% if @web.count_pages %>
23
+ <% total_chars = @pages_in_category.characters %>
24
+ <p><small>All content: <%= total_chars %> chars / <%= sprintf("%-.1f", (total_chars / 2275 )) %> pages</small></p>
42
25
  <% end %>
43
- </ul>
44
- <% end %>
45
26
 
46
- <% unless @pages_that_are_orphaned.empty? %>
47
- <h2>
48
- Orphaned Pages
49
- <br/><small style="font-size: 12px"><i>Pages in <%= @set_name %> that no other page reference</i></small>
50
- </h2>
51
27
 
52
- <ul style="margin-bottom: 35px">
53
- <% for page in @pages_that_are_orphaned.sort_by { |p| p.name } %><li><a href="../show/<%= page.name %>"><%= truncate(page.plain_name, 35) %></a></li><% end %>
54
- </ul>
55
- <% end %>
28
+ <% unless @page_names_that_are_wanted.empty? %>
29
+ <h2>
30
+ Wanted Pages
31
+ <br/><small style="font-size: 12px"><i>Unexisting pages that other pages in <%= @set_name %> reference</i></small>
32
+ </h2>
33
+
34
+ <ul style="margin-bottom: 10px">
35
+ <% for page_name in @page_names_that_are_wanted.sort_by { |pname| pname } %>
36
+ <li>
37
+ <a href="../show/<%= page_name %>"><%= truncate(WikiWords.separate(page_name), 35) %></a>
38
+ wanted by
39
+ <%= web.select.pages_that_reference(page_name).collect { |page| page.link }.join(", ") %>
40
+ </li>
41
+ <% end %>
42
+ </ul>
43
+ <% end %>
44
+
45
+ <% unless @pages_that_are_orphaned.empty? %>
46
+ <h2>
47
+ Orphaned Pages
48
+ <br/><small style="font-size: 12px"><i>Pages in <%= @set_name %> that no other page reference</i></small>
49
+ </h2>
50
+
51
+ <ul style="margin-bottom: 35px">
52
+ <% for page in @pages_that_are_orphaned.sort_by { |p| p.name } %><li><a href="../show/<%= page.name %>"><%= truncate(page.plain_name, 35) %></a></li><% end %>
53
+ </ul>
54
+ <% end %>
56
55
  </div>
57
56
 
58
- </td></tr>
59
- <tr><td>
60
-
57
+ <div id="pageAdmin"style="float: right; width: 280px; vertical-align: top;">
61
58
  <script language="JavaScript1.2">
62
- function validateSelection(fieldID) {
63
- var selection = document.getElementById(fieldID).value;
64
- if (selection == "noselect") {
65
- alert("Please make a selection");
66
- return false;
67
- }
68
- return true;
69
- }
70
- function validatePageName(fieldID) {
71
- if (/^([A-Z][a-z]+[A-Z]\w+)$/.test(document.getElementById(fieldID).value)) {
59
+ function validateSelection(fieldID) {
60
+ var selection = document.getElementById(fieldID).value;
61
+ if (selection == "noselect") {
62
+ alert("Please make a selection");
63
+ return false;
64
+ }
72
65
  return true;
73
- } else {
74
- alert('You wrote "' + document.getElementById(fieldID).value + '" as a page name, but it needs to be a wiki word.');
75
- return false;
76
66
  }
77
- }
78
- function verifyDelete() {
79
- var del = confirm("Are you sure you want to delete " + document.getElementById('sel_delete').value + "?")
80
- return del;
81
- }
82
- function verifyRename() {
83
- if (!validatePageName('ren_newpage')) {
84
- return false;
67
+ function validatePageName(fieldID) {
68
+ if (/^([A-Z][a-z]+[A-Z]\w+)$/.test(document.getElementById(fieldID).value)) {
69
+ return true;
70
+ } else {
71
+ alert('You wrote "' + document.getElementById(fieldID).value + '" as a page name, but it needs to be a wiki word.');
72
+ return false;
73
+ }
74
+ }
75
+ function verifyDelete() {
76
+ var del = confirm("Are you sure you want to delete " + document.getElementById('sel_delete').value + "?")
77
+ return del;
78
+ }
79
+ function verifyRename() {
80
+ if (!validatePageName('ren_newpage')) {
81
+ return false;
82
+ }
83
+ var ren = confirm("Are you sure you want to rename '" + document.getElementById('sel_rename').value +
84
+ "' to '" + document.getElementById('ren_newpage').value +
85
+ "'?\nNOTE: Links in other pages will have to be manually translated!")
86
+ return ren;
85
87
  }
86
- var ren = confirm("Are you sure you want to rename '" + document.getElementById('sel_rename').value +
87
- "' to '" + document.getElementById('ren_newpage').value +
88
- "'?\nNOTE: Links in other pages will have to be manually translated!")
89
- return ren;
90
- }
91
88
  </script>
92
89
 
93
90
  <!-- hr -->
94
- <h2><br />
95
- Page Administration
96
- </h2>
91
+ <h2>Page Administration</h2>
97
92
 
98
93
  <table border="0" style="font-size:10px">
99
- <!-- Delete Page -->
94
+ <!-- Delete Page -->
95
+ <form class="navigation" action="list/" action="get" onSubmit="return validateSelection('sel_delete') && verifyDelete();">
100
96
  <tr>
101
- <form class="navigation" action="list/" action="get" onSubmit="return validateSelection('sel_delete') && verifyDelete();">
102
97
  <td>Delete page:</td>
103
- <td><select id="sel_delete" name="sel_page_name" size="1" style="width:190">
104
- <option value="noselect">------------
98
+ <td><select id="sel_delete" name="sel_page_name" size="1" style="width:195">
99
+ <option value="noselect">------------</option>
105
100
  <% for page in @pages_by_name %>
106
- <option value="<%= page.name %>"><%= page.name %>
101
+ <option value="<%= page.name %>"><%= page.name %></option>
107
102
  <% end %>
108
103
  </select>
109
104
  </td>
@@ -113,16 +108,16 @@
113
108
  <td align="right">
114
109
  <input type="submit" name="Action" value="Delete">
115
110
  </td>
116
- </form>
117
111
  </tr>
118
- <!-- Rename Page -->
112
+ </form>
113
+ <!-- Rename Page -->
114
+ <form class="navigation" action="../list/" action="get" onSubmit="return validateSelection('sel_rename') && verifyRename() && validatePageName('ren_newpage');">
119
115
  <tr>
120
- <form class="navigation" action="../list/" action="get" onSubmit="return validateSelection('sel_rename') && verifyRename() && validatePageName('ren_newpage');">
121
116
  <td>Rename:</td>
122
- <td><select id="sel_rename" name="sel_page_name" size="1" style="width:190">
123
- <option value="noselect">------------
117
+ <td><select id="sel_rename" name="sel_page_name" size="1" style="width:195">
118
+ <option value="noselect">------------</option>
124
119
  <% for page in @pages_by_name %>
125
- <option value="<%= page.name %>"><%= page.name %>
120
+ <option value="<%= page.name %>"><%= page.name %></option>
126
121
  <% end %>
127
122
  </select>
128
123
  </td>
@@ -138,11 +133,11 @@
138
133
  <td align="right">
139
134
  <input type="submit" name="Action" value="Rename">
140
135
  </td>
141
- </form>
142
136
  </tr>
143
- <!-- Create Page -->
137
+ </form>
138
+ <!-- Create Page -->
139
+ <form class="navigation" action="../list/" action="get" onSubmit="return validatePageName('newpage');">
144
140
  <tr>
145
- <form class="navigation" action="../list/" action="get" onSubmit="return validatePageName('newpage');">
146
141
  <td>Create New Page:</td>
147
142
  <td>
148
143
  <input type="text" name="newpage" id="newpage" size="28">
@@ -154,11 +149,9 @@
154
149
  <input type="submit" name="Action" value="Create">
155
150
  </td>
156
151
  </td>
157
- </form>
158
152
  </tr>
153
+ </form>
159
154
  </table>
160
-
161
- </td></tr>
162
- </table>
155
+ </div>
163
156
 
164
157
  <%= sub_template "bottom" %>
@@ -1,19 +1,18 @@
1
1
  <% @title = "Mind Map"
2
- @style_additions = "img { width: 8in; }"
2
+ #@style_additions = "img { width: 8in; }"
3
3
  %>
4
4
  <%= sub_template "top" %>
5
5
 
6
6
  <h4>A "Mind Map" created from the Wiki links.</h4>
7
7
 
8
+ <img src="../get_map_img" usemap="#graph.map" />
9
+ <map name="graph.map" id="graph.map">
10
+ <%= File.read(@mapFile) %>
11
+ </map>
12
+
8
13
  <table border=0>
9
- <tr>
10
- <td colspan='3' id='mapcell'>
11
- <img src="file://<%= @pngFile %>" usemap="#graph.map" />
12
- <map name="graph.map"><%= File.read(@mapFile) %></map>
13
- </td>
14
- </tr>
15
- <tr>
16
- <form name="input" action="../mind/" method="post">
14
+ <form name="input" action="../mind/" method="post">
15
+ <tr>
17
16
  <td width="100" style="vertical-align:top;" >
18
17
  <input type="radio" name="draw_type" value="neato" <% if @prog == 'neato' %> checked <% end %>>Neato<br>
19
18
  <input type="radio" name="draw_type" value="dot" <% if @prog == 'dot' %> checked <% end %>>Dot</br>
@@ -30,9 +29,8 @@
30
29
  <input type="checkbox" name="missing" <% if @req.query['missing'] == 'on' %> checked <% end %>>Show missing pages<br>
31
30
  <input type="submit" value="Redraw" name="Go">
32
31
  </td>
33
- </form>
34
- </td>
35
32
  </tr>
33
+ </form>
36
34
  </table>
37
35
 
38
36
  <p>Graphs generated with <a href='http://www.research.att.com/sw/tools/graphviz/'>GraphViz</a>.
@@ -16,7 +16,6 @@
16
16
  <%= @page.display_diff %>
17
17
  </div>
18
18
 
19
-
20
19
  <div class="byline">
21
20
  <%= @page.revisions? ? "Revised" : "Created" %> on <%= @page.pretty_created_at %>
22
21
  by <%= @page.author_link %>
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.1
3
3
  specification_version: 1
4
4
  name: Pimki
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.092
7
- date: 2004-12-04
6
+ version: 1.2.092
7
+ date: 2004-12-10
8
8
  summary: A Personal Information Manager (PIM) based on the Wiki technology of Instiki.
9
9
  require_paths:
10
10
  - libraries