openskip-skip_embedded 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.9.5 / 2009-05-27
2
+ * [port] SKIP's upload file validations.
3
+
1
4
  == 0.9.4 / 2009-05-22
2
5
  * [new] update flash showing mechanism.
3
6
 
@@ -10,7 +10,7 @@ class SkipEmbeddedGenerator < Rails::Generator::Base
10
10
  public/blank.html
11
11
  public/javascripts/dropdown_navigation.js
12
12
  public/javascripts/labeled_text_field.js
13
- public/javascripts/skip_fckeditor_config.js
13
+ public/javascripts/skip/skip_fckeditor_config.js
14
14
  public/javascripts/flash_message.js
15
15
  ]
16
16
 
@@ -16,6 +16,11 @@
16
16
  target.removeClass(focusClass).val(message);
17
17
  };
18
18
  });
19
+ target.parents("form").submit(function(){
20
+ if(target.val() == message){ target.val("") };
21
+ return true;
22
+ });
23
+ return target;
19
24
  };
20
25
  })(jQuery);
21
26
 
@@ -1,5 +1,4 @@
1
-
2
- FCKConfig.EditorAreaCSS = FCKConfig.BasePath + '../../../stylesheets/application.css' ;
1
+ FCKConfig.EditorAreaCSS = FCKConfig.BasePath + '../../../../stylesheets/editor_area.css' ;
3
2
 
4
3
  FCKConfig.Plugins.Add( 'autogrow' ) ;
5
4
  FCKConfig.Plugins.Add( 'dragresizetable' );
@@ -6,10 +6,12 @@ class SkipEmbeddedStylesheetsGenerator < Rails::Generator::Base
6
6
  public/stylesheets/skip_embedded.css
7
7
  public/stylesheets/skip_footer.css
8
8
  public/stylesheets/skip_header.css
9
+ public/stylesheets/editor_area.css
9
10
  public/stylesheets/sass/skip_base.sass
10
11
  public/stylesheets/sass/skip_embedded.sass
11
12
  public/stylesheets/sass/skip_footer.sass
12
13
  public/stylesheets/sass/skip_header.sass
14
+ public/stylesheets/sass/editor_area.sass
13
15
  public/stylesheets/sprites/sprites.css
14
16
  public/stylesheets/sprites/sprites.png
15
17
  ]
@@ -0,0 +1,72 @@
1
+ .hiki_style p, .rich_style p {
2
+ color: #555555;
3
+ font-size: 12px;
4
+ font-family: Verdana, Arial, sans-serif;
5
+ margin: 10px 0;
6
+ line-height: 1.2; }
7
+ .hiki_style hr, .rich_style hr {
8
+ margin: 3px; }
9
+ .hiki_style h1, .rich_style h1 {
10
+ border: 1px solid silver;
11
+ background-color: #f0f0f0;
12
+ margin-top: 0.8em; }
13
+ .hiki_style h2, .rich_style h2 {
14
+ border-left: 10px solid silver;
15
+ border-bottom: 1px solid silver;
16
+ margin-top: 0.8em;
17
+ padding-left: 3px; }
18
+ .hiki_style h3, .rich_style h3 {
19
+ border-left: 5px solid silver;
20
+ border-bottom: 1px dashed silver;
21
+ margin-top: 0.8em;
22
+ padding-left: 3px; }
23
+ .hiki_style h4, .rich_style h4 {
24
+ border-left: 2px solid silver;
25
+ border-bottom: 1px dotted silver;
26
+ margin-top: 0.8em;
27
+ padding-left: 3px; }
28
+ .hiki_style h5, .rich_style h5 {
29
+ border-bottom: 1px dotted silver;
30
+ margin-top: 0.8em; }
31
+ .hiki_style ul, .rich_style ul {
32
+ list-style-type: disc;
33
+ padding-left: 25px; }
34
+ .hiki_style ol, .rich_style ol {
35
+ list-style-type: decimal;
36
+ padding-left: 25px; }
37
+ .hiki_style pre, .rich_style pre {
38
+ white-space: -moz-pre-wrap;
39
+ white-space: -pre-wrap;
40
+ white-space: -o-pre-wrap;
41
+ white-space: pre-wrap;
42
+ word-wrap: break-word;
43
+ background-color: #f7f7ff;
44
+ margin-left: 5px;
45
+ border: 1px dashed silver;
46
+ padding: 5px; }
47
+ .hiki_style blockquote, .rich_style blockquote {
48
+ background-color: #fff7f7;
49
+ margin: 2px 2px 2px 10px;
50
+ border: 1px dashed silver;
51
+ padding: 2px 2px 2px 5px; }
52
+ .hiki_style big, .rich_style big {
53
+ font-size: 30px;
54
+ font-weight: bold; }
55
+
56
+ .rich_style {
57
+ background-color: #FFFFFF;
58
+ color: #555555;
59
+ width: 98%; }
60
+ .rich_style td {
61
+ font-family: Arial, Verdana, sans-serif;
62
+ font-size: 12px;
63
+ color: #555555; }
64
+ .rich_style a[href] {
65
+ color: -moz-hyperlinktext !important;
66
+ text-decoration: -moz-anchor-decoration; }
67
+ .rich_style div {
68
+ color: #555555;
69
+ font-size: 12px;
70
+ font-family: Verdana, Arial, sans-serif;
71
+ margin: 10px 0;
72
+ line-height: 1.2; }
@@ -0,0 +1,96 @@
1
+ .hiki_style, .rich_style
2
+ p
3
+ :color #555555
4
+ :font-size 12px
5
+ :font-family Verdana, Arial, sans-serif
6
+ :margin 10px 0
7
+ :line-height 1.2
8
+
9
+ hr
10
+ :margin 3px
11
+
12
+ h1
13
+ :border 1px solid silver
14
+ :background-color #f0f0f0
15
+ :margin-top 0.8em
16
+
17
+ h2
18
+ :border-left 10px solid silver
19
+ :border-bottom 1px solid silver
20
+ :margin-top 0.8em
21
+ :padding-left 3px
22
+
23
+ h3
24
+ :border-left 5px solid silver
25
+ :border-bottom 1px dashed silver
26
+ :margin-top 0.8em
27
+ :padding-left 3px
28
+
29
+ h4
30
+ :border-left 2px solid silver
31
+ :border-bottom 1px dotted silver
32
+ :margin-top 0.8em
33
+ :padding-left 3px
34
+
35
+ h5
36
+ :border-bottom 1px dotted silver
37
+ :margin-top 0.8em
38
+
39
+ ul
40
+ :list-style-type disc
41
+ :padding-left 25px
42
+
43
+ li
44
+ ol
45
+ :list-style-type decimal
46
+ :padding-left 25px
47
+
48
+ pre
49
+ // Mozilla
50
+ :white-space -moz-pre-wrap
51
+ // Opera 4-6
52
+ :white-space -pre-wrap
53
+ // Opera 7
54
+ :white-space -o-pre-wrap
55
+ // CSS3
56
+ :white-space pre-wrap
57
+ // IE 5.5+
58
+ :word-wrap break-word
59
+ :background-color #f7f7ff
60
+ :margin-left 5px
61
+ :border 1px dashed silver
62
+ :padding 5px
63
+
64
+ blockquote
65
+ :background-color #fff7f7
66
+ :margin 2px 2px 2px 10px
67
+ :border 1px dashed silver
68
+ :padding 2px 2px 2px 5px
69
+
70
+ big
71
+ :font-size 30px
72
+ :font-weight bold
73
+
74
+ .rich_style
75
+ :background-color #FFFFFF
76
+ :color #555555
77
+ :width 98%
78
+
79
+ td
80
+ :font-family Arial, Verdana, sans-serif
81
+ :font-size 12px
82
+ :color #555555
83
+
84
+ a[href]
85
+ // For Firefox... mark as important, otherwise it becomes black
86
+ :color -moz-hyperlinktext !important
87
+ // For Firefox 3, otherwise no underline will be used
88
+ :text-decoration -moz-anchor-decoration
89
+
90
+ // TODO 以下のdivは必要なければ消す。(元のCSSに記述があったので入れてあるだけ
91
+ div
92
+ :color #555555
93
+ :font-size 12px
94
+ :font-family Verdana, Arial, sans-serif
95
+ :margin 10px 0
96
+ :line-height 1.2
data/lib/skip_embedded.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # SkipEmbedded
2
2
  module SkipEmbedded
3
- Version = "0.9.4"
3
+ Version = "0.9.5"
4
4
 
5
5
  Dependencies = {:jquery => "jquery-1.3.2.min.js"}
6
6
  end
@@ -3,7 +3,7 @@ module SkipEmbedded
3
3
  module Ui
4
4
 
5
5
  def sanitize_richtext(content)
6
- allowed_tags = HTML::WhiteListSanitizer.allowed_tags.dup << "table" << "tbody" << "tr" << "th" << "td" << "caption" << "strike"
6
+ allowed_tags = HTML::WhiteListSanitizer.allowed_tags.dup << "table" << "tbody" << "tr" << "th" << "td" << "caption" << "strike" << "u"
7
7
  allowed_attributes = HTML::WhiteListSanitizer.allowed_attributes.dup << "style" << "cellspacing" << "cellpadding" << "border" << "align" << "summary"
8
8
  sanitize(content, :tags => allowed_tags, :attributes => allowed_attributes)
9
9
  end
@@ -0,0 +1,28 @@
1
+ # SKIP(Social Knowledge & Innovation Platform)
2
+ # Copyright (C) 2008-2009 TIS Inc.
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ module SkipEmbedded
17
+ module Types::ContentType
18
+ CONTENT_TYPE_IMAGES = {
19
+ :jpg => 'image/jpg,image/jpeg,image/pjpeg',
20
+ :jpeg => 'image/jpg,image/jpeg,image/pjpeg',
21
+ :png => 'image/png,image/x-png',
22
+ :gif => 'image/gif',
23
+ :bmp => 'image/bmp'
24
+ }.freeze
25
+
26
+ DEFAULT_CONTENT_TYPE = "application/octet-stream"
27
+ end
28
+ end
@@ -0,0 +1,94 @@
1
+ # SKIP(Social Knowledge & Innovation Platform)
2
+ # Copyright (C) 2008-2009 TIS Inc.
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ module SkipEmbedded
17
+ module ValidationsFile
18
+ include Types::ContentType
19
+ def valid_presence_of_file(file)
20
+ unless file.is_a?(ActionController::UploadedFile)
21
+ errors.add_to_base "ファイルが指定されていません。"
22
+ return false
23
+ end
24
+ true
25
+ end
26
+
27
+ def valid_extension_of_file(file)
28
+ unless verify_extension? file.original_filename, file.content_type
29
+ errors.add_to_base "この形式のファイルは、アップロードできません。"
30
+ end
31
+ end
32
+
33
+ def valid_content_type_of_file(file)
34
+ extension = file.original_filename.split('.').last
35
+ if(content_types = CONTENT_TYPE_IMAGES[extension.to_sym])
36
+ unless content_types.split(',').include?(file.content_type)
37
+ errors.add_to_base "この形式のファイルは、アップロードできません。"
38
+ return false;
39
+ end
40
+ end
41
+ true
42
+ end
43
+
44
+ def valid_size_of_file(file)
45
+ if file.size == 0
46
+ errors.add_to_base "存在しないもしくはサイズ0のファイルはアップロードできません。"
47
+ elsif file.size > SkipEmbedded::InitialSettings['max_share_file_size'].to_i
48
+ errors.add_to_base "#{SkipEmbedded::InitialSettings['max_share_file_size'].to_i/1.megabyte}Mバイト以上のファイルはアップロードできません。"
49
+ end
50
+ end
51
+
52
+ def valid_max_size_per_owner_of_file(file, owner_symbol)
53
+ if (FileSizeCounter.per_owner(owner_symbol) + file.size) > SkipEmbedded::InitialSettings['max_share_file_size_per_owner'].to_i
54
+ errors.add_to_base "共有ファイル保存領域の利用容量が最大値を越えてしまうためアップロードできません。"
55
+ end
56
+ end
57
+
58
+ def valid_max_size_of_system_of_file(file)
59
+ if (FileSizeCounter.per_system + file.size) > SkipEmbedded::InitialSettings['max_share_file_size_of_system'].to_i
60
+ errors.add_to_base "システム全体における共有ファイル保存領域の利用容量が最大値を越えてしまうためアップロードできません。"
61
+ end
62
+ end
63
+
64
+ class FileSizeCounter
65
+ def self.per_owner owner_symbol
66
+ sum = 0
67
+ sum += ShareFile.total_share_file_size(owner_symbol)
68
+ sum
69
+ end
70
+ def self.per_system
71
+ sum = 0
72
+ Dir.glob("#{SkipEmbedded::InitialSettings['share_file_path']}/**/*").each do |f|
73
+ sum += File.stat(f).size
74
+ end
75
+ sum
76
+ end
77
+ end
78
+
79
+ private
80
+ def verify_extension? file_name, content_type
81
+ !disallow_extensions.any?{|extension| extension == file_name.split('.').last } &&
82
+ !disallow_content_types.any?{|content| content == content_type }
83
+ end
84
+
85
+ def disallow_content_types
86
+ ['text/html', 'application/x-javascript', 'image/bmp']
87
+ end
88
+
89
+ def disallow_extensions
90
+ ['html', 'htm', 'js', 'bmp']
91
+ end
92
+ end
93
+ end
94
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openskip-skip_embedded
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - MAEDA Naoki
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-05-22 00:00:00 -07:00
13
+ date: 2009-05-28 00:00:00 -07:00
14
14
  default_executable: skip-gen
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -77,6 +77,9 @@ files:
77
77
  - lib/skip_embedded/rp_service/http_connection.rb
78
78
  - lib/skip_embedded/rp_service/oauth_proxy.rb
79
79
  - lib/skip_embedded/rp_service/util.rb
80
+ - lib/skip_embedded/types
81
+ - lib/skip_embedded/types/content_type.rb
82
+ - lib/skip_embedded/validations_file.rb
80
83
  - lib/skip_embedded/web_service_util
81
84
  - lib/skip_embedded/web_service_util/client.rb
82
85
  - lib/skip_embedded/web_service_util/server.rb
@@ -103,13 +106,16 @@ files:
103
106
  - generators/skip_embedded/templates/public/javascripts/dropdown_navigation.js
104
107
  - generators/skip_embedded/templates/public/javascripts/flash_message.js
105
108
  - generators/skip_embedded/templates/public/javascripts/labeled_text_field.js
106
- - generators/skip_embedded/templates/public/javascripts/skip_fckeditor_config.js
109
+ - generators/skip_embedded/templates/public/javascripts/skip
110
+ - generators/skip_embedded/templates/public/javascripts/skip/skip_fckeditor_config.js
107
111
  - generators/skip_embedded_stylesheets
108
112
  - generators/skip_embedded_stylesheets/skip_embedded_stylesheets_generator.rb
109
113
  - generators/skip_embedded_stylesheets/templates
110
114
  - generators/skip_embedded_stylesheets/templates/public
111
115
  - generators/skip_embedded_stylesheets/templates/public/stylesheets
116
+ - generators/skip_embedded_stylesheets/templates/public/stylesheets/editor_area.css
112
117
  - generators/skip_embedded_stylesheets/templates/public/stylesheets/sass
118
+ - generators/skip_embedded_stylesheets/templates/public/stylesheets/sass/editor_area.sass
113
119
  - generators/skip_embedded_stylesheets/templates/public/stylesheets/sass/skip_base.sass
114
120
  - generators/skip_embedded_stylesheets/templates/public/stylesheets/sass/skip_embedded.sass
115
121
  - generators/skip_embedded_stylesheets/templates/public/stylesheets/sass/skip_footer.sass
@@ -130,7 +136,7 @@ files:
130
136
  - spec/skip_embedded/web_service_util_spec.rb
131
137
  - spec/spec_helper.rb
132
138
  - rails/init.rb
133
- has_rdoc: true
139
+ has_rdoc: false
134
140
  homepage: http://github.com/openskip/skip_embedded/tree/master
135
141
  post_install_message:
136
142
  rdoc_options:
@@ -165,7 +171,7 @@ requirements: []
165
171
  rubyforge_project:
166
172
  rubygems_version: 1.2.0
167
173
  signing_key:
168
- specification_version: 2
174
+ specification_version: 3
169
175
  summary: Utilities to collabolate SKIP, opensource buisiness SNS.
170
176
  test_files:
171
177
  - spec/skip_embedded/fulltext_search_cache/builder_base_spec.rb