tdiary-contrib 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +4 -4
- data/README.en.md +9 -0
- data/README.md +9 -0
- data/js/socialbutton.js +2 -2
- data/lib/tdiary/contrib/version.rb +1 -1
- data/plugin/google_universal_analytics.rb +39 -0
- data/plugin/mathjax.rb +23 -0
- data/spec/google_universal_analytics_spec.rb +60 -0
- data/util/image-gallery/README.ja +2 -2
- data/util/image-gallery/image-gallery.rb +3 -2
- data/util/image-gallery/js/SmoothGallery/css/jd.gallery.css +2 -1
- data/util/image-gallery/js/SmoothGallery/scripts/jd.gallery.js +53 -38
- data/util/image-gallery/{skel → views}/gallery.rhtml +0 -0
- metadata +7 -5
- data/util/image-gallery/image-gallery.rb.euc-jp +0 -523
- data/util/image-gallery/skel/gallery.rhtml.euc-jp +0 -154
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb4987d60e60c9a3130d9883de1ad14d41105c87
|
4
|
+
data.tar.gz: 0cc0f6d11ef5e64a16ad5c77273439f5a8eefa3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dec6581b5097a1c9a4d1bcea6bab76387ba319fb2628b657eae092b27bca6c257d9847cb030e35a2e46222605d648de4503eea259310c5ecf0910b0b864e133
|
7
|
+
data.tar.gz: 7739d7edcc96fb474a81e25008482f568c55ab8e1daf59c3091226e4b76ab7e5022cc875b6370fe9965e9e26ffbe78c9ec81265e6f89f8628ba0534fb61b4160
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -4,12 +4,12 @@ GEM
|
|
4
4
|
diff-lcs (1.2.5)
|
5
5
|
docile (1.1.5)
|
6
6
|
multi_json (1.10.1)
|
7
|
-
rake (10.
|
7
|
+
rake (10.4.2)
|
8
8
|
rspec (3.1.0)
|
9
9
|
rspec-core (~> 3.1.0)
|
10
10
|
rspec-expectations (~> 3.1.0)
|
11
11
|
rspec-mocks (~> 3.1.0)
|
12
|
-
rspec-core (3.1.
|
12
|
+
rspec-core (3.1.7)
|
13
13
|
rspec-support (~> 3.1.0)
|
14
14
|
rspec-expectations (3.1.2)
|
15
15
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
multi_json (~> 1.0)
|
23
23
|
simplecov-html (~> 0.8.0)
|
24
24
|
simplecov-html (0.8.0)
|
25
|
-
tdiary (4.0.
|
25
|
+
tdiary (4.1.0.20141126)
|
26
26
|
bundler (~> 1.3)
|
27
27
|
thor (~> 0.18)
|
28
28
|
thor (0.19.1)
|
@@ -34,4 +34,4 @@ DEPENDENCIES
|
|
34
34
|
rake
|
35
35
|
rspec
|
36
36
|
simplecov
|
37
|
-
tdiary (~> 4.0
|
37
|
+
tdiary (~> 4.1.0)
|
data/README.en.md
CHANGED
@@ -3,6 +3,15 @@
|
|
3
3
|
This package include some utilities and plugins for tDiary.
|
4
4
|
See documents in each directories.
|
5
5
|
|
6
|
+
To use with tDiary, make "Gemfile.local" file on top of
|
7
|
+
tDiary, and write a line like below:
|
8
|
+
|
9
|
+
```
|
10
|
+
gem 'tdiary-contrib'
|
11
|
+
```
|
12
|
+
|
13
|
+
----
|
14
|
+
|
6
15
|
See licenses and copyrights in each theme files. If no license
|
7
16
|
or copyright, it can be distoributed by GPL2, and it has a
|
8
17
|
copyright below:
|
data/README.md
CHANGED
@@ -4,6 +4,15 @@
|
|
4
4
|
インが収録されています。ドキュメントはそれぞれのツールのディレクトリ
|
5
5
|
に含まれています。
|
6
6
|
|
7
|
+
tDiaryで使う場合は、tDiaryのトップディレクトリに Gemfile.local という
|
8
|
+
ファイルを作成し、以下のように記述します:
|
9
|
+
|
10
|
+
```
|
11
|
+
gem 'tdiary-contrib'
|
12
|
+
```
|
13
|
+
|
14
|
+
----
|
15
|
+
|
7
16
|
著作権およびライセンスは各テーマのファイルに記述してあるものに従いま
|
8
17
|
すが、特に明記されていない場合、配布条件はGPL2、著作権は以下になりま
|
9
18
|
す。
|
data/js/socialbutton.js
CHANGED
@@ -87,7 +87,7 @@ $(function() {
|
|
87
87
|
$('.socialbuttons').css('height', '1em')
|
88
88
|
var bottom = $(window).height() + $(window).scrollTop();
|
89
89
|
|
90
|
-
$($tDiary.blogkit ? '.day' : '.section')
|
90
|
+
$($tDiary.blogkit ? '.day' : '.day .section')
|
91
91
|
.filter(function() {
|
92
92
|
return bottom > $(this).offset().top;
|
93
93
|
})
|
@@ -103,7 +103,7 @@ $(function() {
|
|
103
103
|
} else if (anchor.size() == 0) {
|
104
104
|
// The section may not have an anchor on etdiary style.
|
105
105
|
// https://github.com/tdiary/tdiary-contrib/issues/59
|
106
|
-
var url = $(this).parents('.day').find('h2 a:first').get(0).href;
|
106
|
+
var url = ($(this).parents('.day').find('h2 a:first').get(0)||'').href;
|
107
107
|
var title = $(this).parents('.day').find('h2 .title').text();
|
108
108
|
} else {
|
109
109
|
var url = anchor.get(0).href;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#
|
2
|
+
# Google Universal Analytics plugin for tDiary
|
3
|
+
#
|
4
|
+
# Copyright (C) 2014 TSUNEMATSU Shinya <s@tnmt.info>
|
5
|
+
# You can redistribute it and/or modify it under GPL2.
|
6
|
+
#
|
7
|
+
if /^(?:latest|day|month|nyear|search)$/ =~ @mode then
|
8
|
+
add_footer_proc do
|
9
|
+
google_universal_analytics_insert_code
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def google_universal_analytics_insert_code
|
14
|
+
return '' unless @conf['google_universal_analytics.profile']
|
15
|
+
<<-HTML
|
16
|
+
<script>
|
17
|
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
18
|
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
19
|
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
20
|
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
21
|
+
|
22
|
+
ga('create', 'UA-#{h @conf['google_universal_analytics.profile']}', 'auto');
|
23
|
+
ga('require', 'displayfeatures');
|
24
|
+
ga('send', 'pageview');
|
25
|
+
</script>
|
26
|
+
HTML
|
27
|
+
end
|
28
|
+
|
29
|
+
# UA-53836-1
|
30
|
+
add_conf_proc( 'google_universal_analytics', 'Google Universal Analytics' ) do
|
31
|
+
if @mode == 'saveconf' then
|
32
|
+
@conf['google_universal_analytics.profile'] = @cgi.params['google_universal_analytics.profile'][0]
|
33
|
+
end
|
34
|
+
<<-HTML
|
35
|
+
<h3>Google Universal Analytics Profile</h3>
|
36
|
+
<p>set your Profile ID (NNNNN-N)</p>
|
37
|
+
<p><input name="google_universal_analytics.profile" value="#{h @conf['google_universal_analytics.profile']}"></p>
|
38
|
+
HTML
|
39
|
+
end
|
data/plugin/mathjax.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# mathjax.rb $Revision: $
|
3
|
+
#
|
4
|
+
# MathJaxを使った数式表示のためのプラグイン
|
5
|
+
#
|
6
|
+
# MathJaxでTeXやMathMLを使った数式を埋め込むことができます。
|
7
|
+
#
|
8
|
+
# MathJaxについては、http://www.mathjax.org/ を参照のこと
|
9
|
+
#
|
10
|
+
# Copyright (C) 2014 by Yuh Ohmura <http://yutopia.pussycat.jp/diary/>
|
11
|
+
#
|
12
|
+
=begin ChangeLog
|
13
|
+
2014-12-17 Yuh Ohmura
|
14
|
+
* created.
|
15
|
+
=end
|
16
|
+
add_header_proc do
|
17
|
+
'<script type="text/x-mathjax-config">
|
18
|
+
MathJax.Hub.Config({tex2jax: {inlineMath: [[\'$\',\'$\'], ["\\\\(","\\\\)"]]}});
|
19
|
+
</script>
|
20
|
+
<script type="text/javascript"
|
21
|
+
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
22
|
+
</script>'
|
23
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__))
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe "google_universal_analytics plugin" do
|
5
|
+
def setup_google_universal_analytics_plugin(profile_id, mode)
|
6
|
+
fake_plugin(:google_universal_analytics) { |plugin|
|
7
|
+
plugin.mode = mode
|
8
|
+
plugin.conf['google_universal_analytics.profile'] = profile_id
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "should render javascript" do
|
13
|
+
before do
|
14
|
+
@plugin = setup_google_universal_analytics_plugin('53836-1', 'latest')
|
15
|
+
end
|
16
|
+
|
17
|
+
it "for footer" do
|
18
|
+
snippet = @plugin.footer_proc
|
19
|
+
expect(snippet).to eq(expected_html_footer_snippet)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "should render javascript" do
|
24
|
+
before do
|
25
|
+
@plugin = setup_google_universal_analytics_plugin('53836-1', 'conf')
|
26
|
+
end
|
27
|
+
|
28
|
+
it "for footer" do
|
29
|
+
snippet = @plugin.footer_proc
|
30
|
+
expect(snippet).to be_empty
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "should not render when profile_id is empty" do
|
35
|
+
before do
|
36
|
+
@plugin = setup_google_universal_analytics_plugin(nil, 'latest')
|
37
|
+
end
|
38
|
+
|
39
|
+
it "for footer" do
|
40
|
+
snippet = @plugin.footer_proc
|
41
|
+
expect(snippet).to be_empty
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def expected_html_footer_snippet
|
46
|
+
expected = <<-SCRIPT
|
47
|
+
<script>
|
48
|
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
49
|
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
50
|
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
51
|
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
52
|
+
|
53
|
+
ga('create', 'UA-53836-1', 'auto');
|
54
|
+
ga('require', 'displayfeatures');
|
55
|
+
ga('send', 'pageview');
|
56
|
+
</script>
|
57
|
+
SCRIPT
|
58
|
+
expected.gsub( /^\t/, '' ).chomp
|
59
|
+
end
|
60
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
tDiary Image Gallery Ver 2.0
|
1
|
+
tDiary Image Gallery Ver 2.1.0 -- README.ja --
|
2
2
|
|
3
|
-
Copyright (c) 2005-
|
3
|
+
Copyright (c) 2005-2014 N.KASHIJUKU <n-kashi[at]whi.m-net.ne.jp>
|
4
4
|
You can redistribute it and/or modify it under GPL2.
|
5
5
|
===================
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- coding: utf-8 -*-
|
3
|
-
# image-gallery.rb $Revision: 2.0
|
3
|
+
# image-gallery.rb $Revision: 2.1.0 $
|
4
4
|
#
|
5
5
|
# Copyright (c) 2005-2013 N.KASHIJUKU <n-kashi[at]whi.m-net.ne.jp>
|
6
6
|
# You can redistribute it and/or modify it under GPL2.
|
@@ -16,6 +16,7 @@ else
|
|
16
16
|
org_path = File::dirname( __FILE__ )
|
17
17
|
end
|
18
18
|
$:.unshift( org_path.untaint )
|
19
|
+
$:.unshift( (org_path + '/lib').untaint ) unless $:.include?( org_path + '/lib' )
|
19
20
|
require 'tdiary'
|
20
21
|
require 'pstore'
|
21
22
|
require 'date'
|
@@ -43,7 +44,7 @@ module TDiary
|
|
43
44
|
|
44
45
|
def initialize( cgi, rhtml, conf )
|
45
46
|
super
|
46
|
-
@img_version = "2.0
|
47
|
+
@img_version = "2.1.0"
|
47
48
|
@image_hash = Hash[]
|
48
49
|
@image_num = 0
|
49
50
|
@image_keys = []
|
@@ -59,7 +59,7 @@ var gallery = {
|
|
59
59
|
preloader: true,
|
60
60
|
preloaderImage: true,
|
61
61
|
preloaderErrorImage: true,
|
62
|
-
fullScreen: false,
|
62
|
+
fullScreen: false,
|
63
63
|
/* Data retrieval */
|
64
64
|
manualData: [],
|
65
65
|
populateFrom: false,
|
@@ -128,17 +128,28 @@ var gallery = {
|
|
128
128
|
this.populateData();
|
129
129
|
element.style.display="block";
|
130
130
|
|
131
|
-
if(this.options.fullScreen)
|
131
|
+
if(this.options.fullScreen)
|
132
132
|
{
|
133
|
-
var
|
134
|
-
|
135
|
-
// size.x-=18;
|
133
|
+
var sizex = window.innerWidth;
|
134
|
+
var sizey = window.innerHeight;
|
136
135
|
element.setStyles({
|
137
136
|
'position':'absolute',
|
138
137
|
'top':'0px',
|
139
138
|
'left':'0px',
|
140
|
-
'width':
|
141
|
-
'height':
|
139
|
+
'width':sizex,
|
140
|
+
'height':sizey
|
141
|
+
});
|
142
|
+
|
143
|
+
window.addEvent('resize', function(event) {
|
144
|
+
var sizex = window.innerWidth;
|
145
|
+
var sizey = window.innerHeight;
|
146
|
+
element.setStyles({
|
147
|
+
'position':'absolute',
|
148
|
+
'top':'0px',
|
149
|
+
'left':'0px',
|
150
|
+
'width':sizex,
|
151
|
+
'height':sizey
|
152
|
+
});
|
142
153
|
});
|
143
154
|
}
|
144
155
|
|
@@ -249,41 +260,45 @@ var gallery = {
|
|
249
260
|
currentImg.load = function(imageStyle, i) {
|
250
261
|
if (!imageStyle.loaded) {
|
251
262
|
this.galleryData[i].imgloader = new Asset.image(imageStyle.source, {
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
263
|
+
'onload' : function(img, i){
|
264
|
+
img.loaded = true;
|
265
|
+
img.width = this.galleryData[i].imgloader.width;
|
266
|
+
img.height = this.galleryData[i].imgloader.height;
|
267
|
+
top_height = this.topElement.getStyle('height').toInt();
|
268
|
+
top_width = this.topElement.getStyle('width').toInt();
|
269
|
+
new_width = img.width;
|
270
|
+
new_height = img.height;
|
271
|
+
margin_top = 0;
|
272
|
+
if(top_height < img.height && img.height >= img.width){
|
273
|
+
new_height = top_height;
|
274
|
+
new_width = Math.round(top_height*img.width/img.height);
|
275
|
+
} else if(top_width < img.width && img.height <= img.width) {
|
276
|
+
new_width = top_width;
|
277
|
+
new_height = Math.round(top_width*img.height/img.width);
|
278
|
+
if(new_height > top_height) {
|
279
|
+
new_height = top_height;
|
280
|
+
new_width = Math.round(top_height*img.width/img.height);
|
281
|
+
}
|
282
|
+
margin_top = Math.round((top_height - new_height)/2);
|
283
|
+
} else {
|
284
|
+
margin_top = Math.round((top_height - img.height)/2);
|
285
|
+
}
|
286
|
+
img.element.appendChild(new Element('img').set('src',img.source).setStyles({
|
287
|
+
'margin':'0 auto',
|
288
|
+
'display':'block',
|
289
|
+
'width':new_width+'px',
|
290
|
+
'height':new_height+'px',
|
291
|
+
'margin-top':margin_top+'px'
|
292
|
+
}));
|
293
|
+
}.pass([imageStyle, i], this)
|
279
294
|
});
|
280
295
|
}
|
281
296
|
}.pass([currentImg, i], this);
|
282
297
|
} else {
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
298
|
+
currentImg.element.appendChild(new Element('img').set('src',this.galleryData[i].image).setStyles({
|
299
|
+
'margin':'0 auto',
|
300
|
+
'display':'block'
|
301
|
+
}));
|
287
302
|
}
|
288
303
|
this.galleryElements[parseInt(i)] = currentImg;
|
289
304
|
}
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tdiary-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tDiary contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tdiary
|
@@ -218,6 +218,7 @@ files:
|
|
218
218
|
- plugin/google_analytics.rb
|
219
219
|
- plugin/google_map.rb
|
220
220
|
- plugin/google_sitemaps.rb
|
221
|
+
- plugin/google_universal_analytics.rb
|
221
222
|
- plugin/google_webmaster.rb
|
222
223
|
- plugin/hatena_bookmark_nocomment.rb
|
223
224
|
- plugin/hatena_star.rb
|
@@ -257,6 +258,7 @@ files:
|
|
257
258
|
- plugin/make_link.rb
|
258
259
|
- plugin/makerss_category.rb
|
259
260
|
- plugin/makerss_comment.rb
|
261
|
+
- plugin/mathjax.rb
|
260
262
|
- plugin/microsummary.rb
|
261
263
|
- plugin/mm_footer.rb
|
262
264
|
- plugin/monthly_autopagerize.rb
|
@@ -330,6 +332,7 @@ files:
|
|
330
332
|
- spec/gist_spec.rb
|
331
333
|
- spec/github_link_spec.rb
|
332
334
|
- spec/google_analytics_spec.rb
|
335
|
+
- spec/google_universal_analytics_spec.rb
|
333
336
|
- spec/jdate_spec.rb
|
334
337
|
- spec/jmonth_spec.rb
|
335
338
|
- spec/jyear_spec.rb
|
@@ -362,7 +365,6 @@ files:
|
|
362
365
|
- util/estraier-search/ja/estraier-register.rb
|
363
366
|
- util/image-gallery/README.ja
|
364
367
|
- util/image-gallery/image-gallery.rb
|
365
|
-
- util/image-gallery/image-gallery.rb.euc-jp
|
366
368
|
- util/image-gallery/js/SmoothGallery/Changelog
|
367
369
|
- util/image-gallery/js/SmoothGallery/css/ReMooz.css
|
368
370
|
- util/image-gallery/js/SmoothGallery/css/img/carrow1.gif
|
@@ -403,10 +405,9 @@ files:
|
|
403
405
|
- util/image-gallery/js/SmoothGallery/scripts/resizer.php
|
404
406
|
- util/image-gallery/misc/plugin/recent_image.rb
|
405
407
|
- util/image-gallery/misc/plugin/view_exif.rb
|
406
|
-
- util/image-gallery/skel/gallery.rhtml
|
407
|
-
- util/image-gallery/skel/gallery.rhtml.euc-jp
|
408
408
|
- util/image-gallery/tdiary.conf.igsample
|
409
409
|
- util/image-gallery/theme/image-gallery.css
|
410
|
+
- util/image-gallery/views/gallery.rhtml
|
410
411
|
- util/image2flickr.rb
|
411
412
|
- util/posttdiary/README.ja
|
412
413
|
- util/posttdiary/posttdiary-ex.rb
|
@@ -468,6 +469,7 @@ test_files:
|
|
468
469
|
- spec/gist_spec.rb
|
469
470
|
- spec/github_link_spec.rb
|
470
471
|
- spec/google_analytics_spec.rb
|
472
|
+
- spec/google_universal_analytics_spec.rb
|
471
473
|
- spec/jdate_spec.rb
|
472
474
|
- spec/jmonth_spec.rb
|
473
475
|
- spec/jyear_spec.rb
|
@@ -1,523 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# image-gallery.rb $Revision: 2.0.4 $
|
4
|
-
#
|
5
|
-
# Copyright (c) 2005-2013 N.KASHIJUKU <n-kashi[at]whi.m-net.ne.jp>
|
6
|
-
# You can redistribute it and/or modify it under GPL2.
|
7
|
-
|
8
|
-
if RUBY_VERSION >= '1.9.0'
|
9
|
-
Encoding::default_external = 'EUC-JP'
|
10
|
-
$LOAD_PATH.push('./')
|
11
|
-
end
|
12
|
-
|
13
|
-
if FileTest::symlink?( __FILE__ ) then
|
14
|
-
org_path = File::dirname( File::readlink( __FILE__ ) )
|
15
|
-
else
|
16
|
-
org_path = File::dirname( __FILE__ )
|
17
|
-
end
|
18
|
-
$:.unshift( org_path.untaint )
|
19
|
-
require 'tdiary'
|
20
|
-
require 'pstore'
|
21
|
-
require 'date'
|
22
|
-
|
23
|
-
|
24
|
-
# class TDiaryGallery
|
25
|
-
#
|
26
|
-
module TDiary
|
27
|
-
class ImageData
|
28
|
-
attr_reader :file, :url, :title, :subtitle, :date, :width, :height, :type
|
29
|
-
attr_writer :file, :url, :title, :subtitle, :date, :width, :height, :type
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
class TDiaryGallery < ::TDiary::TDiaryBase
|
34
|
-
MAX_PAGES = 20
|
35
|
-
ORDER_OPTIONS = [
|
36
|
-
["asc", "��������"],
|
37
|
-
["desc", "�Ť���"],
|
38
|
-
]
|
39
|
-
MODE_OPTIONS = [
|
40
|
-
["list", "�ꥹ��"],
|
41
|
-
["slide", "���饤��"],
|
42
|
-
]
|
43
|
-
|
44
|
-
def initialize( cgi, rhtml, conf )
|
45
|
-
super
|
46
|
-
@img_version = "2.0.4"
|
47
|
-
@image_hash = Hash[]
|
48
|
-
@image_num = 0
|
49
|
-
@image_keys = []
|
50
|
-
@images = []
|
51
|
-
@exifstr = []
|
52
|
-
@t_page_title = ""
|
53
|
-
|
54
|
-
get_conf(conf)
|
55
|
-
parse_args(cgi)
|
56
|
-
format_form
|
57
|
-
read_cache
|
58
|
-
make_image_data
|
59
|
-
check_name_filter_dateformat
|
60
|
-
make_page_title
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
def get_conf(conf)
|
66
|
-
@column = conf.options['image-gallery.column'].to_i
|
67
|
-
@column = 3 if @column == 0
|
68
|
-
@line = conf.options['image-gallery.line'].to_i
|
69
|
-
@line = 4 if @line == 0
|
70
|
-
@num = @line * @column
|
71
|
-
@width = conf.options['image-gallery.width']
|
72
|
-
@width = "160" if @width == nil
|
73
|
-
@vwidth = conf.options['image-gallery.vwidth']
|
74
|
-
@vwidth = "640" if @vwidth == nil
|
75
|
-
@show_exif = conf.options['image-gallery.show_exif']
|
76
|
-
@show_exif = false if @show_exif == nil
|
77
|
-
@use_mid_image = conf.options['image-gallery.use_mid_image']
|
78
|
-
@use_mid_image = false if @use_mid_image == nil
|
79
|
-
end
|
80
|
-
|
81
|
-
def parse_args(cgi)
|
82
|
-
@start = cgi["start"].to_i
|
83
|
-
@order = @cgi["order"].empty? ? "asc" : @cgi["order"]
|
84
|
-
@name_filter = @cgi["name"].empty? ? "" : @cgi["name"].strip
|
85
|
-
@title_filter = @cgi["title"].empty? ? "" : @cgi["title"].strip
|
86
|
-
@subtitle_filter = @cgi["subtitle"].empty? ? "" : @cgi["subtitle"].strip
|
87
|
-
@mode = @cgi["mode"].empty? ? "list" : @cgi["mode"].strip
|
88
|
-
@mode = "list" if @mode != "viewer" and @mode != "slide" and @mode != "fslide"
|
89
|
-
@key = cgi["key"].empty? ? "" : cgi["key"].strip
|
90
|
-
@page_title = cgi["pagetitle"].empty? ? "" : @cgi["pagetitle"].strip
|
91
|
-
@show_inputfield = true;
|
92
|
-
show_inputfield = @cgi["showinputfield"].strip
|
93
|
-
@show_inputfield = false if show_inputfield == "false"
|
94
|
-
end
|
95
|
-
|
96
|
-
def read_cache
|
97
|
-
begin
|
98
|
-
db = PStore.new("#{@io.cache_path}/gallery/image-gallery2.dat") # for tDiary 3.1.3 or later
|
99
|
-
rescue
|
100
|
-
db = PStore.new("#{cache_path}/gallery/image-gallery2.dat") # for tDiary 3.1.2 or faster
|
101
|
-
end
|
102
|
-
db.transaction do
|
103
|
-
@image_hash = db["recent_image_hash"]
|
104
|
-
@image_keys = db["recent_image_keys"]
|
105
|
-
@image_url = db["recent_image_url"]
|
106
|
-
@image_dir = db["recent_image_dir"]
|
107
|
-
db.abort
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def make_image_data
|
112
|
-
if @name_filter != "" or @title_filter != "" or @subtitle_filter != ""
|
113
|
-
@image_keys.reject! { |key|
|
114
|
-
image = @image_hash[key]
|
115
|
-
(@name_filter != "" and image.file.match(@name_filter) == nil) or
|
116
|
-
(@title_filter != "" and image.title.match(@title_filter) == nil) or
|
117
|
-
(@subtitle_filter != "" and image.subtitle.match(@subtitle_filter) == nil)
|
118
|
-
}
|
119
|
-
end
|
120
|
-
@image_num = @image_keys.length
|
121
|
-
@image_keys = @image_keys.reverse if @order == "asc"
|
122
|
-
|
123
|
-
if @mode == "list" or @mode == "slide" or @mode == "fslide"
|
124
|
-
if @key != ""
|
125
|
-
index = @image_keys.index(@key)
|
126
|
-
if index != nil
|
127
|
-
@start = (index / @num) * @num
|
128
|
-
else
|
129
|
-
return
|
130
|
-
end
|
131
|
-
end
|
132
|
-
@num.times do |i|
|
133
|
-
index = @start + i
|
134
|
-
break if @image_keys[index] == nil
|
135
|
-
@images.push(@image_hash[@image_keys[index]])
|
136
|
-
end
|
137
|
-
elsif @mode == "viewer"
|
138
|
-
if @key != ""
|
139
|
-
index = @image_keys.index(@key)
|
140
|
-
if index != nil
|
141
|
-
@start = index
|
142
|
-
else
|
143
|
-
@start = 0
|
144
|
-
end
|
145
|
-
end
|
146
|
-
@images.push(@image_hash[@image_keys[@start]])
|
147
|
-
width, height = @images[0].width.to_i, @images[0].height.to_i
|
148
|
-
size = ((width > height ? width : height) > @vwidth.to_i) ? @vwidth : width
|
149
|
-
if width > height
|
150
|
-
@sizestr = %Q[width="#{size}" height="#{(size.to_i*height/width).to_s}"]
|
151
|
-
else
|
152
|
-
@sizestr = %Q[width="#{(size.to_i*width/height).to_s}" height="#{size}"]
|
153
|
-
end
|
154
|
-
if @show_exif and @images[0].type == "jpg"
|
155
|
-
begin
|
156
|
-
require 'exifparser'
|
157
|
-
@exifstr = read_exif_data("#{@image_dir}/#{@images[0].file}")
|
158
|
-
rescue
|
159
|
-
exp = []
|
160
|
-
exp.push(($!).to_s)
|
161
|
-
($!).backtrace.each do |btinfo|
|
162
|
-
exp.push(btinfo)
|
163
|
-
end
|
164
|
-
@exifstr = exp
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def check_name_filter_dateformat
|
171
|
-
@page_year = ""
|
172
|
-
@page_month = ""
|
173
|
-
@page_day = ""
|
174
|
-
@page_date = nil
|
175
|
-
return if @name_filter == ""
|
176
|
-
t_name_filter = @name_filter.dup
|
177
|
-
t_name_filter["^"] = "" if t_name_filter[0] == ?^
|
178
|
-
t_name_filter = t_name_filter[5,8] if t_name_filter[4] == ?/
|
179
|
-
begin
|
180
|
-
if t_name_filter.index(/[\d]{8}/) != nil
|
181
|
-
@page_year = t_name_filter[0,4]
|
182
|
-
@page_month = t_name_filter[4,2]
|
183
|
-
@page_day = t_name_filter[6,2]
|
184
|
-
@page_date = Date.new(@page_year.to_i, @page_month.to_i, @page_day.to_i)
|
185
|
-
|
186
|
-
elsif t_name_filter.index(/[\d]{6}/) != nil
|
187
|
-
@page_year = t_name_filter[0,4]
|
188
|
-
@page_month = t_name_filter[4,2]
|
189
|
-
@page_date = Date.new(@page_year.to_i, @page_month.to_i, 1)
|
190
|
-
|
191
|
-
elsif t_name_filter.index(/[\d]{4}/) != nil and t_name_filter[0,4].to_i >= 1970
|
192
|
-
@page_year = t_name_filter[0,4]
|
193
|
-
@page_date = Date.new(@page_year.to_i, 1, 1)
|
194
|
-
end
|
195
|
-
rescue
|
196
|
-
@page_year = ""
|
197
|
-
@page_month = ""
|
198
|
-
@page_day = ""
|
199
|
-
@page_date = nil
|
200
|
-
return
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
def make_page_title
|
205
|
-
return if @page_title == ""
|
206
|
-
@t_page_title = String.new(@page_title)
|
207
|
-
@t_page_title.gsub!("@year", @page_year)
|
208
|
-
@t_page_title.gsub!("@month", @page_month)
|
209
|
-
@t_page_title.gsub!("@day", @page_day)
|
210
|
-
begin
|
211
|
-
@t_page_title.gsub!("@subtitle", @images[0].subtitle)
|
212
|
-
rescue
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
def format_links(count)
|
217
|
-
page_count = (count - 1) / @num + 1
|
218
|
-
current_page = @start / @num + 1
|
219
|
-
first_page = current_page - (MAX_PAGES / 2 - 1)
|
220
|
-
if first_page < 1
|
221
|
-
first_page = 1
|
222
|
-
end
|
223
|
-
last_page = first_page + MAX_PAGES - 1
|
224
|
-
if last_page > page_count
|
225
|
-
last_page = page_count
|
226
|
-
end
|
227
|
-
buf = "<p id=\"navi\" class=\"infobar\">\n"
|
228
|
-
if current_page > 1
|
229
|
-
buf << format_link("«��Ƭ�� ", 0, 0, @mode)
|
230
|
-
buf << format_link("<����", @start - @num, @num, @mode)
|
231
|
-
end
|
232
|
-
if first_page > 1
|
233
|
-
buf << "... "
|
234
|
-
end
|
235
|
-
for i in first_page..last_page
|
236
|
-
if i == current_page
|
237
|
-
buf << "#{i} "
|
238
|
-
else
|
239
|
-
buf << format_link(i.to_s, (i - 1) * @num, @num, @mode)
|
240
|
-
end
|
241
|
-
end
|
242
|
-
if last_page < page_count
|
243
|
-
buf << "... "
|
244
|
-
end
|
245
|
-
if current_page < page_count
|
246
|
-
buf << format_link("����>", @start + @num, @num, @mode)
|
247
|
-
buf.concat(format_link(" �Ǹ��»", (page_count - 1) * @num, 0, @mode))
|
248
|
-
end
|
249
|
-
buf << "</p>\n"
|
250
|
-
return buf
|
251
|
-
end
|
252
|
-
|
253
|
-
def format_link(label, start, num, mode)
|
254
|
-
return format('<a href="%s?mode=%s;%sstart=%d">%s</a> ',
|
255
|
-
_(@cgi.script_name ? @cgi.script_name : ''),
|
256
|
-
mode,
|
257
|
-
make_cgi_param,
|
258
|
-
start, label)
|
259
|
-
end
|
260
|
-
|
261
|
-
def format_links_viewer
|
262
|
-
buf = "<p id=\"vnavi\" class=\"infobar\">\n"
|
263
|
-
if @start == 0
|
264
|
-
buf << "«����"
|
265
|
-
else
|
266
|
-
buf << format_link_viewer("«����", @image_keys[@start - 1])
|
267
|
-
end
|
268
|
-
buf << " | "
|
269
|
-
buf << format_link("������", (@start / @num) * @num, 0, "list")
|
270
|
-
buf << " | "
|
271
|
-
if @start == @image_keys.length - 1
|
272
|
-
buf << "����»"
|
273
|
-
else
|
274
|
-
buf << format_link_viewer("����»", @image_keys[@start + 1])
|
275
|
-
end
|
276
|
-
buf << "</p>\n"
|
277
|
-
return buf
|
278
|
-
end
|
279
|
-
|
280
|
-
def format_link_viewer(label, key)
|
281
|
-
return format('<a href="%s?%smode=viewer;key=%s">%s</a>',
|
282
|
-
_(@cgi.script_name ? @cgi.script_name : ''),
|
283
|
-
make_cgi_param,
|
284
|
-
key, label)
|
285
|
-
end
|
286
|
-
|
287
|
-
def format_link_viewer_image(key)
|
288
|
-
return format('%s?%smode=viewer;key=%s',
|
289
|
-
_(@cgi.script_name ? @cgi.script_name : ''),
|
290
|
-
make_cgi_param,
|
291
|
-
key)
|
292
|
-
end
|
293
|
-
|
294
|
-
def format_links_date
|
295
|
-
return "" unless @name_filter != "" and @title_filter == "" and @subtitle_filter == ""
|
296
|
-
|
297
|
-
begin
|
298
|
-
buf = "<p id=\"ynavi\" class=\"infobar\">\n"
|
299
|
-
if @page_day != ""
|
300
|
-
yesterday = (@page_date - 1).strftime("%Y%m%d")
|
301
|
-
tomorrow = (@page_date + 1).strftime("%Y%m%d")
|
302
|
-
buf << format_link_date(%Q[«#{(@page_date - 1).to_s}], yesterday)
|
303
|
-
buf << format(' | <a href="%s?mode=%s;order=%s">%s</a> | ', _(@cgi.script_name ? @cgi.script_name : ''), _(@mode), _(@order), '������')
|
304
|
-
buf << format_link_date(%Q[#{(@page_date + 1).to_s}»], tomorrow)
|
305
|
-
|
306
|
-
elsif @page_month != ""
|
307
|
-
prevmonth = (@page_date << 1).strftime("%Y%m")
|
308
|
-
nextmonth = (@page_date >> 1).strftime("%Y%m")
|
309
|
-
if @name_filter[0] == ?^ and @name_filter[5] == ?/
|
310
|
-
prevmonth = %Q[^#{prevmonth[0,4]}/#{prevmonth}]
|
311
|
-
nextmonth = %Q[^#{nextmonth[0,4]}/#{nextmonth}]
|
312
|
-
elsif @name_filter[0] == ?^
|
313
|
-
prevmonth = %Q[^#{prevmonth[0,4]}]
|
314
|
-
nextmonth = %Q[^#{nextmonth[0,4]}]
|
315
|
-
end
|
316
|
-
buf << format_link_date(%Q[«#{(@page_date << 1).to_s[0,7]}], prevmonth)
|
317
|
-
buf << format(' | <a href="%s?mode=%s;order=%s">%s</a> | ', _(@cgi.script_name ? @cgi.script_name : ''), _(@mode), _(@order), '������')
|
318
|
-
buf << format_link_date(%Q[#{(@page_date >> 1).to_s[0,7]}»], nextmonth)
|
319
|
-
|
320
|
-
elsif @page_year != ""
|
321
|
-
year = @page_year.to_i
|
322
|
-
buf << format_link_date(%Q[«#{(year - 1).to_s}], "^"+(year - 1).to_s)
|
323
|
-
buf << format(' | <a href="%s?mode=%s;order=%s">%s</a> | ', _(@cgi.script_name ? @cgi.script_name : ''), _(@mode), _(@order), '������')
|
324
|
-
buf << format_link_date(%Q[#{(year + 1).to_s}»], "^"+(year + 1).to_s)
|
325
|
-
end
|
326
|
-
|
327
|
-
buf << "</p>\n"
|
328
|
-
return buf
|
329
|
-
rescue
|
330
|
-
return ""
|
331
|
-
end
|
332
|
-
end
|
333
|
-
|
334
|
-
def format_link_date(label, name_filter)
|
335
|
-
cgi_params = make_cgi_param
|
336
|
-
if cgi_params.gsub!(/name=[^;]*;/, "name=#{CGI::escape(name_filter)};") == nil
|
337
|
-
cgi_params = "name=" + CGI::escape(name_filter) + ";" + cgi_params
|
338
|
-
end
|
339
|
-
return format('<a href="%s?mode=%s;%s">%s</a>',
|
340
|
-
_(@cgi.script_name ? @cgi.script_name : ''),
|
341
|
-
@mode,
|
342
|
-
cgi_params,
|
343
|
-
label)
|
344
|
-
end
|
345
|
-
|
346
|
-
def format_link_viewer_date(label, name_filter)
|
347
|
-
return format('<a href="%s?mode=list;order=desc;name=%s">%s</a>',
|
348
|
-
_(@cgi.script_name ? @cgi.script_name : ''),
|
349
|
-
CGI::escape(name_filter),
|
350
|
-
label)
|
351
|
-
end
|
352
|
-
|
353
|
-
def format_link_viewer_category(subtitle)
|
354
|
-
buf = ""
|
355
|
-
subtitle.scan(/\[[^\]]*\]/).each do |category|
|
356
|
-
tag = category[1..-2]
|
357
|
-
next if tag[0] == ?[
|
358
|
-
buf << format('[<a href="%s?mode=list;order=desc;subtitle=%s">%s</a>]',
|
359
|
-
_(@cgi.script_name ? @cgi.script_name : ''),
|
360
|
-
CGI::escape("\\[" + tag + "\\]"), tag)
|
361
|
-
end
|
362
|
-
return buf
|
363
|
-
end
|
364
|
-
|
365
|
-
def format_link_list_category(images)
|
366
|
-
categories = []
|
367
|
-
images.each do |image|
|
368
|
-
categories |= image.subtitle.scan(/\[[^\]]*\]/)
|
369
|
-
end
|
370
|
-
buf = ""
|
371
|
-
categories.each do |category|
|
372
|
-
tag = category[1..-2]
|
373
|
-
next if tag[0] == ?[
|
374
|
-
buf << format('[<a href="%s?mode=list;order=desc;subtitle=%s">%s</a>]',
|
375
|
-
_(@cgi.script_name ? @cgi.script_name : ''),
|
376
|
-
CGI::escape("\\[" + tag + "\\]"), tag)
|
377
|
-
end
|
378
|
-
return buf
|
379
|
-
end
|
380
|
-
|
381
|
-
def get_other_mode_link
|
382
|
-
case @mode
|
383
|
-
when "list"
|
384
|
-
format_link("[SLIDESHOW]", @start, @num, "slide") + format_link("[SLIDESHOW(FullScreen)]", @start, @num, "fslide")
|
385
|
-
when "slide"
|
386
|
-
format_link("[LIST]", @start, @num, "list") + format_link("[SLIDESHOW(FullScreen)]", @start, @num, "fslide")
|
387
|
-
when "fslide"
|
388
|
-
format_link("[LIST]", @start, @num, "list") + format_link("[SLIDESHOW]", @start, @num, "slide")
|
389
|
-
end
|
390
|
-
end
|
391
|
-
|
392
|
-
def make_cgi_param
|
393
|
-
buf = ""
|
394
|
-
buf << "name=#{CGI::escape(@name_filter)};" if @name_filter != ""
|
395
|
-
buf << "title=#{CGI::escape(@title_filter)};" if @title_filter != ""
|
396
|
-
buf << "subtitle=#{CGI::escape(@subtitle_filter)};" if @subtitle_filter != ""
|
397
|
-
buf << "pagetitle=#{CGI::escape(@page_title)};" if @page_title != ""
|
398
|
-
buf << "showinputfield=false;" if not @show_inputfield
|
399
|
-
buf << "order=#{@order};"
|
400
|
-
return buf
|
401
|
-
end
|
402
|
-
|
403
|
-
def format_options(options, value)
|
404
|
-
return options.collect { |val, label|
|
405
|
-
if val == value
|
406
|
-
"<option value=\"#{_(val)}\" selected>#{_(label)}</option>"
|
407
|
-
else
|
408
|
-
"<option value=\"#{_(val)}\">#{_(label)}</option>"
|
409
|
-
end
|
410
|
-
}.join("\n")
|
411
|
-
end
|
412
|
-
|
413
|
-
def format_form
|
414
|
-
@order_options = format_options(ORDER_OPTIONS, @order)
|
415
|
-
@mode_options = format_options(MODE_OPTIONS, @mode )
|
416
|
-
end
|
417
|
-
|
418
|
-
def _(str)
|
419
|
-
CGI::escapeHTML(str)
|
420
|
-
end
|
421
|
-
|
422
|
-
def read_exif_data(file)
|
423
|
-
exifstr = []
|
424
|
-
str = ""
|
425
|
-
exif = ExifParser.new(file)
|
426
|
-
return exifstr if exif == nil
|
427
|
-
|
428
|
-
exifstr.push("-- IFD0 (main image) --")
|
429
|
-
exif.each(:IFD0) do |tag|
|
430
|
-
next if tag.name == "Unknown"
|
431
|
-
str = "#{tag.name} : #{tag.to_s}"
|
432
|
-
exifstr.push(str)
|
433
|
-
end
|
434
|
-
|
435
|
-
exifstr.push("-- Exif SubIFD --")
|
436
|
-
exif.each(:Exif) do |tag|
|
437
|
-
next if tag.name == "Unknown"
|
438
|
-
str = "#{tag.name} : #{tag.to_s}"
|
439
|
-
exifstr.push(str)
|
440
|
-
end
|
441
|
-
|
442
|
-
exifstr.push("-- MakerNote --")
|
443
|
-
exif.each(:MakerNote) do |tag|
|
444
|
-
next if tag.name == "Unknown" or tag.name == "NikonCameraSerialNumber"
|
445
|
-
str = "#{tag.name} : #{tag.to_s}"
|
446
|
-
exifstr.push(str)
|
447
|
-
end
|
448
|
-
|
449
|
-
exifstr.push("-- GPS --")
|
450
|
-
exif.each(:GPS) do |tag|
|
451
|
-
next if tag.name == "Unknown"
|
452
|
-
str = "#{tag.name} : #{tag.to_s}"
|
453
|
-
exifstr.push(str)
|
454
|
-
end
|
455
|
-
|
456
|
-
return exifstr
|
457
|
-
|
458
|
-
end
|
459
|
-
|
460
|
-
|
461
|
-
def js_start_gallery
|
462
|
-
if @mode == "fslide"
|
463
|
-
<<-EOS
|
464
|
-
<script type="text/javascript">
|
465
|
-
function startGallery() {
|
466
|
-
var myGallery = new gallery($('myGallery'), {
|
467
|
-
timed: true,
|
468
|
-
fullScreen: true
|
469
|
-
});
|
470
|
-
}
|
471
|
-
window.addEvent('domready',startGallery);
|
472
|
-
</script>
|
473
|
-
EOS
|
474
|
-
elsif @mode == "slide"
|
475
|
-
<<-EOS2
|
476
|
-
<script type="text/javascript">
|
477
|
-
function startGallery() {
|
478
|
-
var myGallery = new gallery($('myGallery'), {
|
479
|
-
timed: true,
|
480
|
-
});
|
481
|
-
}
|
482
|
-
window.addEvent('domready',startGallery);
|
483
|
-
</script>
|
484
|
-
EOS2
|
485
|
-
end
|
486
|
-
end
|
487
|
-
end
|
488
|
-
end
|
489
|
-
|
490
|
-
begin
|
491
|
-
@cgi = CGI::new
|
492
|
-
if TDiary::Config.instance_method(:initialize).arity == 0
|
493
|
-
# for tDiary 2.0 or earlier
|
494
|
-
conf = TDiary::Config::new
|
495
|
-
else
|
496
|
-
# for tDiary 2.1 or later
|
497
|
-
request = TDiary::Request.new( ENV, @cgi )
|
498
|
-
conf = TDiary::Config::new(@cgi, request)
|
499
|
-
end
|
500
|
-
tdiary = TDiary::TDiaryGallery::new( @cgi, 'gallery.rhtml', conf )
|
501
|
-
|
502
|
-
head = {
|
503
|
-
'type' => 'text/html',
|
504
|
-
'Vary' => 'User-Agent'
|
505
|
-
}
|
506
|
-
body = tdiary.eval_rhtml
|
507
|
-
head['charset'] = conf.encoding
|
508
|
-
head['Content-Length'] = body.bytesize.to_s
|
509
|
-
head['Pragma'] = 'no-cache'
|
510
|
-
head['Cache-Control'] = 'no-cache'
|
511
|
-
|
512
|
-
print @cgi.header( head )
|
513
|
-
print body
|
514
|
-
rescue Exception
|
515
|
-
if @cgi then
|
516
|
-
print @cgi.header( 'type' => 'text/plain' )
|
517
|
-
else
|
518
|
-
print "Content-Type: text/plain\n\n"
|
519
|
-
end
|
520
|
-
puts "#$! (#{$!.class})"
|
521
|
-
puts ""
|
522
|
-
puts $@.join( "\n" )
|
523
|
-
end
|
@@ -1,154 +0,0 @@
|
|
1
|
-
<%# gallery.rhtml $Revision: 2.0.1 $ %>
|
2
|
-
<%# Copyright (c) 2005-2012 N.KASHIJUKU <n-kashi[at]whi.m-net.ne.jp> %>
|
3
|
-
<%# You can redistribute it and/or modify it under GPL2. %>
|
4
|
-
|
5
|
-
<div class="adminmenu"><%%=navi_user%></div><h1><%= CGI::escapeHTML( @conf.html_title ) %> [Image Gallery]</h1>
|
6
|
-
|
7
|
-
<% if @images.length == 0 %>
|
8
|
-
<p>��������ե�����Ϥ���ޤ���</p>
|
9
|
-
<%= format_links_date %>
|
10
|
-
<% else %>
|
11
|
-
<% if @mode == "list" or @mode == "slide" or @mode == "fslide" %>
|
12
|
-
<%= format_links_date %>
|
13
|
-
<div class="day">
|
14
|
-
<% if @images.length != 0 %>
|
15
|
-
<h2><span class="date"><%= _(@conf.to_native(@t_page_title)) %> Page <%=@start / @num + 1 %></span> <span class="nyear">[<%= @image_num %> ���� <%= @start + 1 %> - <%= @start + @images.length %> ����] <%= get_other_mode_link %></span></h2>
|
16
|
-
<% end %>
|
17
|
-
<div class="body">
|
18
|
-
<div class="section">
|
19
|
-
<div class="categorylink"><%= format_link_list_category(@images) %></div>
|
20
|
-
<% if @mode == "list" %>
|
21
|
-
<table class="imagelist">
|
22
|
-
<% @line.times do |line|%>
|
23
|
-
<tr>
|
24
|
-
<% @column.times do |column| %>
|
25
|
-
<% i = line * @column + column %>
|
26
|
-
<td>
|
27
|
-
<% if @images[i] != nil %>
|
28
|
-
<% if @images[i].width.to_i > @images[i].height.to_i %>
|
29
|
-
<p><a href="<%= format_link_viewer_image(@image_hash.index(@images[i])) %>"><img src="<%= @image_url %>/<%= @images[i].url %>" width="<%= @width %>" height="<%= (@width.to_i*@images[i].height.to_i/@images[i].width.to_i).to_s %>" alt="<%= @images[i].file %>" title="<%= @images[i].file %>" class="imagebody"></a></p>
|
30
|
-
<% else %>
|
31
|
-
<p><a href="<%= format_link_viewer_image(@image_hash.index(@images[i])) %>"><img src="<%= @image_url %>/<%= @images[i].url %>" width="<%= (@width.to_i*@images[i].width.to_i/@images[i].height.to_i).to_s %>" height="<%= @width %>" alt="<%= @images[i].file %>" title="<%= @images[i].file %>" class="imagebody"></a></p>
|
32
|
-
<% end %>
|
33
|
-
<p class="imagetitle"><%= CGI::escapeHTML(@images[i].title) %></p>
|
34
|
-
<p class="imagedate"><a href="./?date=<%= @images[i].date %>" title="<%= CGI::escapeHTML(@images[i].subtitle) %>"><%= @images[i].date.sub(/(\d{4})(\d{2})(\d{2})/, '\1-\2-\3') %></a></p>
|
35
|
-
<% end %>
|
36
|
-
</td>
|
37
|
-
<% end %>
|
38
|
-
</tr>
|
39
|
-
<% break if @images[(line + 1) * @column] == nil %>
|
40
|
-
<% end %>
|
41
|
-
</table>
|
42
|
-
<% elsif @mode == "slide" or @mode == "fslide" %>
|
43
|
-
<%= js_start_gallery %>
|
44
|
-
<div class="content">
|
45
|
-
<div id="myGallery">
|
46
|
-
<% (@line * @column).times do |i| %>
|
47
|
-
<div class="imageElement">
|
48
|
-
<h3><%= CGI::escapeHTML(@images[i].title) %>[<%= @images[i].date.sub(/(\d{4})(\d{2})(\d{2})/, '\1-\2-\3') %>]</h3>
|
49
|
-
<p><%= CGI::escapeHTML(@images[i].subtitle) %></p>
|
50
|
-
<a href="./?date=<%= @images[i].date %>" title="to Diary" class="open"></a>
|
51
|
-
<% image_file = @images[i].file.dup %>
|
52
|
-
<% if @use_mid_image && @mode == "slide" %>
|
53
|
-
<% if image_file[4] == ?/ %>
|
54
|
-
<% image_file[4] = "/m" %>
|
55
|
-
<% else %>
|
56
|
-
<% image_file = "m" + image_file %>
|
57
|
-
<% end %>
|
58
|
-
<% end %>
|
59
|
-
<img src="<%= @image_url %>/<%= image_file %>" class="full" />
|
60
|
-
<img src="<%= @image_url %>/<%= @images[i].url %>" class="thumbnail" />
|
61
|
-
</div>
|
62
|
-
<% break if @images[i+1] == nil %>
|
63
|
-
<% end %>
|
64
|
-
</div>
|
65
|
-
</div>
|
66
|
-
<% end %>
|
67
|
-
</div>
|
68
|
-
</div>
|
69
|
-
</div>
|
70
|
-
<div class="referer">
|
71
|
-
<% if @image_num > 0 %>
|
72
|
-
<%= format_links(@image_num) %>
|
73
|
-
<% end %>
|
74
|
-
</div>
|
75
|
-
|
76
|
-
<% elsif @mode == "viewer" %>
|
77
|
-
<%= format_links_viewer %>
|
78
|
-
<div class="day">
|
79
|
-
<h2><span class="date"> <a href="./?date=<%= @images[0].date %>" title="<%= CGI::escapeHTML(@images[0].subtitle) %>"><%= @images[0].date.sub(/(\d{4})(\d{2})(\d{2})/, '\1-\2-\3') %></a></span> <span class="title"><%= CGI::escapeHTML(@images[0].title) %></span> <span class="nyear">[<%= @images[0].file %>:<%= @images[0].width %>(w)��<%= @images[0].height %>(h)]</span></h2>
|
80
|
-
<div class="body">
|
81
|
-
<% image_file = @images[0].file.dup %>
|
82
|
-
<% month_filter = ((image_file[4] == ?/) ? %Q[^#{image_file[0,4]}/#{image_file[5,6]}] : %Q[^#{image_file[0,6]}]) %>
|
83
|
-
<div class="categorylink">»<%= format_link_viewer_date(@images[0].date[0,4], "^"+@images[0].date[0,4]) %>-<%= format_link_viewer_date(@images[0].date[4,2], month_filter) %>-<%= format_link_viewer_date(@images[0].date[6,2], @images[0].date[0,8]) %> | <%= format_link_viewer_category(@images[0].subtitle) %></div>
|
84
|
-
<div class="section">
|
85
|
-
<table class="imageview">
|
86
|
-
<tr>
|
87
|
-
<td colspan="2">
|
88
|
-
<% image_file = @images[0].file.dup %>
|
89
|
-
<% if @use_mid_image %>
|
90
|
-
<% if image_file[4] == ?/ %>
|
91
|
-
<% image_file[4] = "/m" %>
|
92
|
-
<% else %>
|
93
|
-
<% image_file = "m" + image_file %>
|
94
|
-
<% end %>
|
95
|
-
<% end %>
|
96
|
-
<a href="<%= @image_url %>/<%= @images[0].file %>"><img src="<%= @image_url %>/<%= image_file %>" <%= @sizestr %> alt="<%= CGI::escapeHTML(@images[0].title) %>" title="<%= CGI::escapeHTML(@images[0].title) %>" class="imagebody"></a>
|
97
|
-
</td>
|
98
|
-
</tr>
|
99
|
-
<tr>
|
100
|
-
<td>
|
101
|
-
<% if @show_exif and @exifstr.length != 0 %>
|
102
|
-
<strong><p class="infobar"> - EXIF Data -</p></strong>
|
103
|
-
<strong><p class="exiftitle"><%= @exifstr[0] %></p></strong>
|
104
|
-
<ul class="exifdata">
|
105
|
-
<% i = 1 %>
|
106
|
-
<% while i < @exifstr.length %>
|
107
|
-
<% if @exifstr.length > 5 and i == @exifstr.length / 2 %>
|
108
|
-
</ul>
|
109
|
-
</td>
|
110
|
-
<td>
|
111
|
-
<ul class="exifdata">
|
112
|
-
<% end %>
|
113
|
-
<% if @exifstr[i][0,2] == "--" %>
|
114
|
-
</ul>
|
115
|
-
<strong><p class="exiftitle"><%= @exifstr[i] %></p></strong>
|
116
|
-
<ul class="exifdata">
|
117
|
-
<% else %>
|
118
|
-
<li><%= @exifstr[i] %></li>
|
119
|
-
<% end %>
|
120
|
-
<% i = i + 1 %>
|
121
|
-
<% end %>
|
122
|
-
</ul>
|
123
|
-
</td>
|
124
|
-
<% end %>
|
125
|
-
</tr>
|
126
|
-
</table>
|
127
|
-
</div>
|
128
|
-
</div>
|
129
|
-
</div>
|
130
|
-
<% end %>
|
131
|
-
<% end %>
|
132
|
-
|
133
|
-
<% if @show_inputfield %>
|
134
|
-
<form action="<%= @cgi.script_name ? _(@cgi.script_name) : '' %>">
|
135
|
-
<p>
|
136
|
-
����������: �ե�����̾��<input type="text" name="name" value="<%= _(@conf.to_native(@name_filter)) %>" size="16" />
|
137
|
-
�����Υ��֥����ȥ�:<input type="text" name="subtitle" value="<%= _(@conf.to_native(@subtitle_filter)) %>" size="16" />
|
138
|
-
�����Υ����ȥ�:<input type="text" name="title" value="<%= _(@conf.to_native(@title_filter)) %>" size="16" />
|
139
|
-
</p>
|
140
|
-
<p>
|
141
|
-
�¤��ؤ�:
|
142
|
-
<select name="order">
|
143
|
-
<%= @order_options %>
|
144
|
-
</select>
|
145
|
-
ɽ������:
|
146
|
-
<select name="mode">
|
147
|
-
<%= @mode_options %>
|
148
|
-
</select>
|
149
|
-
<input type="submit" value="ɽ��" />
|
150
|
-
</p>
|
151
|
-
</form>
|
152
|
-
<div class="footer">
|
153
|
-
Generated by <a href="http://www1.whi.m-net.ne.jp/n-kashi/image-gallery2.html">tDiary Image Gallery</a> version <%= @img_version %></div>
|
154
|
-
<% end %>
|