Piggy 0.4.2.4 → 0.4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES.txt +15 -0
- data/INSTALL.txt +9 -4
- data/README.txt +8 -6
- data/bin/directory_diff +1 -1
- data/bin/ftp_browser +1 -1
- data/bin/piggy +1 -1
- data/lib/directory_diff.rb +8 -6
- data/lib/ftp_browser.rb +8 -6
- data/lib/icons/connect.ico +0 -0
- data/lib/icons/hide_details.ico +0 -0
- data/lib/icons/show_details.ico +0 -0
- data/lib/piggy-core/alive_check.rb +4 -4
- data/lib/piggy-core/debug.rb +4 -4
- data/lib/piggy-core/environment.rb +24 -26
- data/lib/piggy-core/exifr_adapter.rb +11 -11
- data/lib/piggy-core/file_info.rb +61 -61
- data/lib/piggy-core/ftp_adapter.rb +24 -24
- data/lib/piggy-core/htmlgen.rb +41 -45
- data/lib/piggy-core/nconvert_thumbsgen.rb +22 -22
- data/lib/piggy-core/options.rb +25 -19
- data/lib/piggy-core/options_persistence.rb +8 -8
- data/lib/piggy-core/progress.rb +7 -7
- data/lib/piggy-core/rmagick_thumbnail_page_generator.rb +14 -14
- data/lib/piggy-core/thumbnail_generator.rb +26 -26
- data/lib/piggy-core/thumbnail_page_generator.rb +234 -230
- data/lib/piggy-core/upload_info.rb +22 -22
- data/lib/piggy-core/version.rb +7 -7
- data/lib/piggy-core/winshell.rb +136 -80
- data/lib/piggy-gui/dir_chooser.rb +14 -14
- data/lib/piggy-gui/directory_diff_widget.rb +177 -160
- data/lib/piggy-gui/filtered_file_list.rb +87 -87
- data/lib/piggy-gui/fox_thumbsgen.rb +4 -4
- data/lib/piggy-gui/ftp_browser_widget.rb +211 -155
- data/lib/piggy-gui/fullscreen.rb +4 -4
- data/lib/piggy-gui/html_generation_dialog.rb +42 -115
- data/lib/piggy-gui/html_options_widget.rb +97 -0
- data/lib/piggy-gui/image_processor.rb +58 -58
- data/lib/piggy-gui/modal_dialog.rb +11 -5
- data/lib/piggy-gui/multiimagecanvas.rb +59 -59
- data/lib/piggy-gui/options_dialog.rb +170 -48
- data/lib/piggy-gui/piggy_image_browser.rb +382 -340
- data/lib/piggy-gui/pipe_log.rb +17 -17
- data/lib/piggy-gui/progress_with_dialog.rb +8 -8
- data/lib/piggy-gui/require-fox.rb +23 -8
- data/lib/piggy.rb +7 -5
- data/lib/templates/styles/basic/style.css +16 -14
- data/lib/templates/styles/black/style.css +28 -29
- data/lib/templates/styles/roundedbox/style.css +28 -31
- data/lib/templates/styles/shadow/style.css +26 -26
- data/lib/templates/styles/shadow_D9F5F3/style.css +1 -1
- data/lib/templates/styles/shadow_black/lo.jpg +0 -0
- data/lib/templates/styles/shadow_black/lu.jpg +0 -0
- data/lib/templates/styles/shadow_black/ro.jpg +0 -0
- data/lib/templates/styles/shadow_black/ru.jpg +0 -0
- data/lib/templates/styles/shadow_black/style.css +78 -0
- data/lib/templates/styles/shadow_bowers/style.css +48 -51
- data/lib/templates/styles/sylvester/sh.png +0 -0
- data/lib/templates/styles/sylvester/style.css +74 -0
- data/lib/templates/styles/sylvester/wunderkerze.jpg +0 -0
- data/test/file_info_test.rb +29 -29
- metadata +52 -38
@@ -11,7 +11,7 @@ require 'piggy-core/options'
|
|
11
11
|
#
|
12
12
|
# Generation without frames:
|
13
13
|
#
|
14
|
-
#
|
14
|
+
# output_path
|
15
15
|
# |
|
16
16
|
# +----subDir
|
17
17
|
# |
|
@@ -30,7 +30,7 @@ require 'piggy-core/options'
|
|
30
30
|
#
|
31
31
|
# Generation with frames:
|
32
32
|
#
|
33
|
-
#
|
33
|
+
# output_path
|
34
34
|
# |
|
35
35
|
# +----subDir
|
36
36
|
# | |
|
@@ -68,26 +68,28 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
68
68
|
@indexName = 'index' + HtmlExt
|
69
69
|
end
|
70
70
|
|
71
|
-
def
|
71
|
+
def set_output_directory(outputDir)
|
72
72
|
@subDir = outputDir
|
73
|
-
@imageOutputPath = File.join(
|
73
|
+
@imageOutputPath = File.join(output_path, outputDir)
|
74
74
|
end
|
75
75
|
|
76
76
|
# Overwrite this, if you convert arbitrary image types into
|
77
77
|
# output formats suitable for web pages, e. g. jpg or png
|
78
|
-
def
|
78
|
+
def conversion_type_for(type)
|
79
79
|
type
|
80
80
|
end
|
81
81
|
|
82
|
-
def
|
83
|
-
|
82
|
+
def image_name(info, pre = '')
|
83
|
+
offset = @options.stylesSample? ? "../basic/#{pre}" : pre
|
84
|
+
name = "#{info.name_without_extension}.#{conversion_type_for(info.extension)}"
|
85
|
+
offset + escape_html(name)
|
84
86
|
end
|
85
87
|
|
86
|
-
def
|
88
|
+
def set_files(fileInfos)
|
87
89
|
@inputFilenames = fileInfos
|
88
90
|
end
|
89
91
|
|
90
|
-
def
|
92
|
+
def set_title(title)
|
91
93
|
@title = title
|
92
94
|
end
|
93
95
|
|
@@ -99,147 +101,148 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
99
101
|
return "..#{sep}"
|
100
102
|
end
|
101
103
|
|
102
|
-
def
|
104
|
+
def output_path
|
103
105
|
return @options.localDestinationPath
|
104
106
|
end
|
105
107
|
|
106
|
-
def
|
107
|
-
return @options.generateFramePage ?
|
108
|
+
def main_index_path
|
109
|
+
return @options.generateFramePage ? output_path : imageOutputPath
|
108
110
|
end
|
109
111
|
|
110
|
-
def
|
111
|
-
return
|
112
|
+
def main_index_with_path
|
113
|
+
return main_index_path + sep + indexName
|
112
114
|
end
|
113
115
|
|
114
|
-
def
|
116
|
+
def get_backlink_string
|
115
117
|
@options.generateFramePage? ? back + subDir + HtmlExt : indexName
|
116
118
|
end
|
117
119
|
|
118
|
-
def
|
120
|
+
def sub_stylesheet_url
|
119
121
|
if @options.generateFramePage?
|
120
|
-
back +
|
122
|
+
back + main_stylesheet_url
|
121
123
|
else
|
122
|
-
|
124
|
+
main_stylesheet_url
|
123
125
|
end
|
124
126
|
end
|
125
127
|
|
126
|
-
def
|
128
|
+
def main_stylesheet_url
|
127
129
|
'style/style.css'
|
128
130
|
end
|
129
131
|
|
130
132
|
# Add important meta tags
|
131
|
-
def
|
133
|
+
def common_head
|
132
134
|
norobots()
|
133
135
|
# the next tag will tell Piggy that this file may be
|
134
136
|
# overwritten by Piggy
|
135
137
|
meta({
|
136
|
-
|
137
|
-
|
138
|
+
"name" => "generator",
|
139
|
+
"content" =>"Piggy"})
|
138
140
|
utf8()
|
139
141
|
end
|
140
142
|
|
141
143
|
# Check if this file has been written by Piggy
|
142
|
-
def
|
144
|
+
def is_piggy_file?(file)
|
143
145
|
ret = false
|
144
|
-
File.open(file, 'r')
|
145
|
-
while !ret && fp.gets
|
146
|
-
ret =
|
146
|
+
File.open(file, 'r') do |fp|
|
147
|
+
while !ret && (line = fp.gets)
|
148
|
+
ret = /<meta.*name="generator"/.match(line) &&
|
149
|
+
/<meta.*content="Piggy"/.match(line)
|
147
150
|
end
|
148
|
-
|
151
|
+
end
|
149
152
|
return ret
|
150
153
|
end
|
151
154
|
|
152
|
-
def
|
153
|
-
progress.
|
154
|
-
|
155
|
-
backlink =
|
156
|
-
|
155
|
+
def build_html_pages_for_images(progress)
|
156
|
+
progress.set_task("Generate html", @inputFilenames.size)
|
157
|
+
max_ind = @inputFilenames.size - 1
|
158
|
+
backlink = get_backlink_string
|
159
|
+
(0..max_ind).each { | i |
|
157
160
|
currentInfo = @inputFilenames[i]
|
158
|
-
predInfo = @inputFilenames[i == 0 ?
|
159
|
-
succInfo = @inputFilenames[i ==
|
160
|
-
current = currentInfo.
|
161
|
+
predInfo = @inputFilenames[i == 0 ? max_ind : i - 1]
|
162
|
+
succInfo = @inputFilenames[i == max_ind ? 0 : i + 1]
|
163
|
+
current = currentInfo.name_without_extension
|
161
164
|
comment = currentInfo.comment
|
162
|
-
pred = predInfo.
|
163
|
-
succ = succInfo.
|
164
|
-
progress.
|
165
|
-
|
165
|
+
pred = predInfo.name_without_extension
|
166
|
+
succ = succInfo.name_without_extension
|
167
|
+
progress.set_progress(current, 1)
|
168
|
+
new_transitional
|
166
169
|
html {
|
167
170
|
head {
|
168
|
-
title() {
|
169
|
-
|
170
|
-
stylesheet
|
171
|
+
title() { escape_html(current) }
|
172
|
+
common_head
|
173
|
+
stylesheet sub_stylesheet_url
|
171
174
|
}
|
172
175
|
body({"class"=>"image_page"}) {
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
176
|
+
div({'class' => 'content'}){
|
177
|
+
div({'class' => 'navigation'}){
|
178
|
+
div {
|
179
|
+
div {
|
180
|
+
p {
|
181
|
+
a({"HREF" => escape_html(pred) + HtmlExt}){
|
182
|
+
add_html(escape_html(i == 0 ? 'last' : 'previous'))
|
183
|
+
}
|
184
|
+
a({"HREF" => escape_html(backlink) }) {
|
185
|
+
add_html(escape_html('overview'))
|
186
|
+
}
|
187
|
+
a({"HREF" => escape_html(succ) + HtmlExt}) {
|
188
|
+
add_html(escape_html(i == max_ind ? 'first' : 'next'))
|
189
|
+
}
|
190
|
+
}
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}
|
194
|
+
div({'class' => 'image'}){
|
195
|
+
div {
|
196
|
+
div {
|
197
|
+
p {
|
198
|
+
img(image_name(currentInfo), escape_html(current))
|
199
|
+
}
|
200
|
+
}
|
201
|
+
}
|
202
|
+
}
|
203
|
+
div({'class' => 'comment'}){
|
204
|
+
div {
|
205
|
+
div {
|
206
|
+
p { add_html(escape_html(comment)) }
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
210
|
+
}
|
211
|
+
}
|
209
212
|
}
|
210
213
|
File.open(File.join(imageOutputPath, current + HtmlExt), 'w') { | fp |
|
211
|
-
fp.print(
|
214
|
+
fp.print(get_page)
|
212
215
|
}
|
213
216
|
}
|
214
217
|
end
|
215
218
|
|
216
|
-
def
|
219
|
+
def build_slideshow_list
|
217
220
|
File.open(File.join(imageOutputPath, 'images.js'), 'w') { | fp |
|
218
221
|
fp.print("var images = new Array(\n")
|
219
222
|
maxInd = @inputFilenames.size - 1
|
220
|
-
|
221
|
-
current =
|
223
|
+
(0..maxInd).each { | i |
|
224
|
+
current = slideshow_image(@inputFilenames[i])
|
222
225
|
fp.print("#{current}")
|
223
226
|
fp.print(i == maxInd ? "\n" : ",\n")
|
224
227
|
}
|
225
228
|
fp.print(")\n")
|
226
229
|
}
|
227
230
|
unless @inputFilenames.empty?
|
228
|
-
|
231
|
+
update_slideshow_template(slideshow_image(@inputFilenames[1]))
|
229
232
|
end
|
230
233
|
end
|
231
234
|
|
232
|
-
def
|
233
|
-
src =
|
234
|
-
txt =
|
235
|
+
def slideshow_image(fileInfo)
|
236
|
+
src = image_name(fileInfo)
|
237
|
+
txt = escape_html(fileInfo.comment)
|
235
238
|
"new slide(\"#{src}\", \"\", \"#{txt}\")"
|
236
239
|
end
|
237
240
|
|
238
|
-
def
|
241
|
+
def update_slideshow_template(imageFile)
|
239
242
|
reset
|
240
243
|
file = File.join(imageOutputPath, 'slideshow.htm')
|
241
244
|
lines = File.readlines(file)
|
242
|
-
backlink = "href=\"#{
|
245
|
+
backlink = "href=\"#{get_backlink_string}\""
|
243
246
|
File.open(file, 'w') { |fp|
|
244
247
|
lines.each { |line|
|
245
248
|
line = line.gsub('PLACEHOLDER_FOR_IMAGE_NAME', imageFile)
|
@@ -249,7 +252,7 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
249
252
|
}
|
250
253
|
end
|
251
254
|
|
252
|
-
def
|
255
|
+
def bytes_as_string(bytes)
|
253
256
|
kb = bytes/1024
|
254
257
|
return "#{kb} KB" if kb < 1024
|
255
258
|
mb = kb/1024
|
@@ -258,58 +261,58 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
258
261
|
return "#{gb} GB"
|
259
262
|
end
|
260
263
|
|
261
|
-
def
|
262
|
-
|
263
|
-
matrix = Array.new(@inputFilenames.size() /
|
264
|
+
def build_thumbnail_page(size_of_zipfile = -1)
|
265
|
+
num_col = 5
|
266
|
+
matrix = Array.new(@inputFilenames.size() / num_col)
|
264
267
|
row = -1
|
265
268
|
col = 0
|
266
269
|
@inputFilenames.each { |info|
|
267
|
-
if col %
|
270
|
+
if col % num_col == 0
|
268
271
|
col = 0
|
269
272
|
row += 1
|
270
|
-
matrix[row] = Array.new(
|
273
|
+
matrix[row] = Array.new(num_col)
|
271
274
|
end
|
272
275
|
matrix[row][col] = info
|
273
276
|
col += 1
|
274
277
|
}
|
275
|
-
|
278
|
+
new_transitional
|
276
279
|
html() {
|
277
280
|
head() {
|
278
281
|
title() { @title }
|
279
|
-
|
280
|
-
stylesheet
|
282
|
+
common_head()
|
283
|
+
stylesheet sub_stylesheet_url
|
281
284
|
}
|
282
285
|
body({'class'=>'thumbs'}){
|
283
|
-
h3({}){
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
286
|
+
h3({}){ add_html(escape_html(@title)) }
|
287
|
+
if(size_of_zipfile > 0)
|
288
|
+
a({"href" => DownloadName }) { add_html(DownloadName) }
|
289
|
+
add_html("(#{bytes_as_string(size_of_zipfile)})")
|
290
|
+
end
|
291
|
+
if(@options.addSlideshow?)
|
292
|
+
a({"href" => File.join('slideshow.htm'), "target" => "_top"}) {
|
293
|
+
add_html(SlideshowName)
|
294
|
+
}
|
295
|
+
end
|
296
|
+
image_table({'class'=>'table'}) {
|
297
|
+
matrix.each do |m_row|
|
298
|
+
image_row {
|
299
|
+
m_row.each do |info|
|
300
|
+
if info
|
301
|
+
image_column {
|
302
|
+
add_preview(info)
|
303
|
+
}
|
304
|
+
end
|
305
|
+
end
|
306
|
+
}
|
307
|
+
end
|
308
|
+
}
|
306
309
|
}
|
307
310
|
}
|
308
311
|
File.open(File.join(imageOutputPath, indexName), 'w') { | fp |
|
309
|
-
fp.print(
|
312
|
+
fp.print(get_page) }
|
310
313
|
end
|
311
314
|
|
312
|
-
def
|
315
|
+
def image_table(params, &block)
|
313
316
|
if @options.useTable?
|
314
317
|
table(params, &block)
|
315
318
|
else
|
@@ -317,140 +320,140 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
317
320
|
end
|
318
321
|
end
|
319
322
|
|
320
|
-
def
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
323
|
+
def image_row(&block)
|
324
|
+
if @options.useTable?
|
325
|
+
tr({}, &block)
|
326
|
+
else
|
327
|
+
block.call
|
328
|
+
end
|
326
329
|
end
|
327
330
|
|
328
|
-
def
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
331
|
+
def image_column(&block)
|
332
|
+
if @options.useTable?
|
333
|
+
td({}, &block)
|
334
|
+
else
|
335
|
+
dd({}, &block)
|
336
|
+
end
|
334
337
|
end
|
335
338
|
|
336
|
-
def
|
339
|
+
def add_preview(info)
|
337
340
|
div({'class' => 'preview'}){
|
338
341
|
div({'class' => 'thumb'}){
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
342
|
+
p {
|
343
|
+
name = escape_html(info.name_without_extension)
|
344
|
+
a({
|
345
|
+
"href" => name + HtmlExt,
|
346
|
+
'target' => '_top'}
|
347
|
+
) {
|
348
|
+
img(image_name(info, 't_'), name)
|
349
|
+
}
|
350
|
+
}
|
348
351
|
}
|
349
352
|
}
|
350
353
|
end
|
351
354
|
|
352
|
-
def
|
353
|
-
|
355
|
+
def frame_text()
|
356
|
+
new_frame
|
354
357
|
html(){
|
355
358
|
head(){
|
356
359
|
title { 'Bildindex' }
|
357
|
-
|
358
|
-
stylesheet
|
360
|
+
common_head
|
361
|
+
stylesheet main_stylesheet_url
|
359
362
|
}
|
360
363
|
frameset({'rows'=>'14%,65%,21%'}){
|
361
364
|
frame({
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
'frameborder'=>"0"
|
366
|
-
})
|
367
|
-
frameset({'cols'=>"15%,85%"}){
|
368
|
-
frame({
|
369
|
-
'src'=>"navigation.htm",
|
370
|
-
'name'=>"Navigation",
|
371
|
-
'scrolling'=>"yes",
|
365
|
+
'src'=>"kopf.htm",
|
366
|
+
'name'=>"Kopf",
|
367
|
+
'scrolling'=>"no",
|
372
368
|
'frameborder'=>"0"
|
373
369
|
})
|
370
|
+
frameset({'cols'=>"15%,85%"}){
|
374
371
|
frame({
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
372
|
+
'src'=>"navigation.htm",
|
373
|
+
'name'=>"Navigation",
|
374
|
+
'scrolling'=>"yes",
|
375
|
+
'frameborder'=>"0"
|
376
|
+
})
|
377
|
+
frame({
|
378
|
+
'src'=>"#{subDir + sep + indexName}",
|
379
|
+
'name'=>"Daten",
|
380
|
+
'frameborder'=>"0"
|
381
|
+
})
|
379
382
|
}
|
380
383
|
frame({
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
384
|
+
'src'=>"fuss.htm",
|
385
|
+
'name'=>"Fuss",
|
386
|
+
'scrolling'=>"no",
|
387
|
+
'frameborder'=>"0"
|
388
|
+
})
|
386
389
|
noframes(){
|
387
390
|
cr
|
388
|
-
|
391
|
+
add_html('Ohne Frames siehe: ')
|
389
392
|
a({'href'=>"navigation.htm"}){
|
390
|
-
|
393
|
+
add_html('Navigationsleiste')
|
391
394
|
}
|
392
395
|
}
|
393
396
|
}
|
394
397
|
}
|
395
|
-
return
|
398
|
+
return get_page
|
396
399
|
end
|
397
400
|
|
398
|
-
def
|
399
|
-
content =
|
400
|
-
|
401
|
-
|
401
|
+
def build_frame_page()
|
402
|
+
content = frame_text
|
403
|
+
write_file(File.join(output_path, subDir + HtmlExt), content)
|
404
|
+
write_file(File.join(output_path, indexName), content)
|
402
405
|
end
|
403
406
|
|
404
|
-
def
|
405
|
-
return if File.exists?(file) && !
|
407
|
+
def write_file(file, content)
|
408
|
+
return if File.exists?(file) && !is_piggy_file?(file)
|
406
409
|
File.open(file, 'w') { |fp| fp.print(content) }
|
407
410
|
end
|
408
411
|
|
409
|
-
def
|
412
|
+
def build_zip_file(nameOfZipFile, progress)
|
410
413
|
require 'zip/zip'
|
411
|
-
progress.
|
414
|
+
progress.set_task("Creating zipfile", @inputFilenames.size)
|
412
415
|
Zip::ZipFile.open(nameOfZipFile, Zip::ZipFile::CREATE) {
|
413
416
|
|zipfile|
|
414
417
|
zipfile.mkdir(subDir)
|
415
418
|
@inputFilenames.each do
|
416
419
|
|info|
|
417
|
-
progress.
|
420
|
+
progress.set_progress("Zip #{info.name}", 1)
|
418
421
|
entry = File.join(subDir, info.name)
|
419
|
-
src = info.
|
422
|
+
src = info.name_with_path
|
420
423
|
zipfile.add(entry, src)
|
421
424
|
end
|
422
425
|
}
|
423
426
|
end
|
424
427
|
|
425
|
-
def
|
428
|
+
def copy_template_files()
|
426
429
|
if @options.generateFramePage
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
+
copy_templates(['navigation.htm', 'kopf.htm', 'fuss.htm'],
|
431
|
+
output_path)
|
432
|
+
copy_style(output_path)
|
430
433
|
else
|
431
|
-
|
434
|
+
copy_style(imageOutputPath)
|
432
435
|
end
|
433
436
|
if @options.addSlideshow?
|
434
|
-
|
435
|
-
link = "<link href=\"#{
|
436
|
-
|
437
|
-
|
437
|
+
copy_templates(['slideshow.htm', 'slideshow.js'], imageOutputPath)
|
438
|
+
link = "<link href=\"#{sub_stylesheet_url}\" rel=\"stylesheet\" type=\"text/css\">"
|
439
|
+
insert_in_file(File.join(imageOutputPath, 'slideshow.htm'),
|
440
|
+
/<!--STYLE-->/, link)
|
438
441
|
end
|
439
442
|
end
|
440
443
|
|
441
|
-
def
|
444
|
+
def style_source_dir
|
442
445
|
File.join(PIGGY_PATH, 'templates/styles', @options.style)
|
443
446
|
end
|
444
447
|
|
445
|
-
def
|
446
|
-
|
447
|
-
File.makedirs(
|
448
|
-
Dir[File.join(
|
449
|
-
File.copy(fName,
|
448
|
+
def copy_style(targetPath)
|
449
|
+
target_dir = File.join(targetPath, 'style')
|
450
|
+
File.makedirs(target_dir)
|
451
|
+
Dir[File.join(style_source_dir, '*.*')].each { |fName|
|
452
|
+
File.copy(fName, target_dir) unless File.exists?(File.join(target_dir, fName))
|
450
453
|
}
|
451
454
|
end
|
452
455
|
|
453
|
-
def
|
456
|
+
def copy_templates(files, targetPath)
|
454
457
|
files.each do
|
455
458
|
|fName|
|
456
459
|
unless File.exists?(File.join(targetPath, fName))
|
@@ -461,7 +464,7 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
461
464
|
end
|
462
465
|
|
463
466
|
# Insert insertion into file after any match of pattern
|
464
|
-
def
|
467
|
+
def insert_in_file(file, pattern, insertion)
|
465
468
|
lines = File.readlines(file)
|
466
469
|
File.open(file, 'w') { |fp|
|
467
470
|
lines.each { |line|
|
@@ -471,18 +474,18 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
471
474
|
}
|
472
475
|
end
|
473
476
|
|
474
|
-
def
|
477
|
+
def update_navigation_frame()
|
475
478
|
reset
|
476
|
-
|
479
|
+
nav_file = File.join(output_path, 'navigation.htm')
|
477
480
|
a({
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
+
'href' => escape_html(subDir) + '/index.htm',
|
482
|
+
'target' => 'Daten'}) {
|
483
|
+
add_html(escape_html(@title))
|
481
484
|
}
|
482
485
|
br
|
483
|
-
|
484
|
-
link =
|
485
|
-
|
486
|
+
add_html("\n")
|
487
|
+
link = get_page
|
488
|
+
insert_in_file(nav_file, /<!--NAV-->/, link)
|
486
489
|
end
|
487
490
|
|
488
491
|
def error msg
|
@@ -493,37 +496,38 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
493
496
|
##
|
494
497
|
# Will create the directory for all the '3 files per image'
|
495
498
|
# unless directory exits
|
496
|
-
def
|
497
|
-
|
498
|
-
Dir.mkdir(
|
499
|
+
def create_subdir
|
500
|
+
sub_dir_with_path = File.join(output_path, subDir)
|
501
|
+
Dir.mkdir(sub_dir_with_path) unless File.directory?(sub_dir_with_path)
|
499
502
|
end
|
500
503
|
|
501
504
|
##
|
502
505
|
# Central bublic doit function
|
503
|
-
def generate(progress, overwrite=false,
|
504
|
-
|
505
|
-
return error("#{
|
506
|
+
def generate(progress, overwrite=false, add_zipfile=false)
|
507
|
+
unless File.directory?(output_path)
|
508
|
+
return error("#{output_path} ist no directory}")
|
506
509
|
end
|
507
|
-
|
508
|
-
return error("#{
|
510
|
+
if File.directory?(File.join(output_path, subDir))
|
511
|
+
return error("#{subDir} allready exists") unless overwrite
|
512
|
+
else
|
513
|
+
progress.set_task("Creating directory")
|
514
|
+
create_subdir
|
509
515
|
end
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
buildZipfile(nameOfZipFile, progress)
|
516
|
-
sizeOfZipfile = File.size(nameOfZipFile) if File.exists?(nameOfZipFile)
|
516
|
+
size_of_zipfile = -1
|
517
|
+
if add_zipfile
|
518
|
+
name_of_zip_file = File.join(output_path, subDir, DownloadName)
|
519
|
+
build_zip_file(name_of_zip_file, progress)
|
520
|
+
size_of_zipfile = File.size(name_of_zip_file) if File.exists?(name_of_zip_file)
|
517
521
|
end
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
+
build_html_pages_for_images(progress)
|
523
|
+
build_thumbnail_page(size_of_zipfile)
|
524
|
+
copy_template_files
|
525
|
+
build_slideshow_list if @options.addSlideshow?
|
522
526
|
if @options.generateFramePage?
|
523
|
-
|
524
|
-
|
527
|
+
build_frame_page
|
528
|
+
update_navigation_frame
|
525
529
|
end
|
526
|
-
|
530
|
+
image_processing(progress) unless @options.skipImageProcessing
|
527
531
|
return true
|
528
532
|
end
|
529
533
|
|
@@ -532,12 +536,12 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
532
536
|
##
|
533
537
|
# Overwrite this hook method to add image processing
|
534
538
|
# to html genmeration
|
535
|
-
def
|
539
|
+
def image_processing(&block)
|
536
540
|
end
|
537
541
|
|
538
542
|
##
|
539
543
|
# Service which migt be useful if no client is set
|
540
|
-
def
|
541
|
-
|
544
|
+
def run_command(commandline, workingDir)
|
545
|
+
in_path(workingDir) { `#{commandline}` }
|
542
546
|
end
|
543
547
|
end
|