vzaar 0.2.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.
@@ -0,0 +1,98 @@
1
+ /*
2
+ Queue Plug-in
3
+
4
+ Features:
5
+ *Adds a cancelQueue() method for cancelling the entire queue.
6
+ *All queued files are uploaded when startUpload() is called.
7
+ *If false is returned from uploadComplete then the queue upload is stopped.
8
+ If false is not returned (strict comparison) then the queue upload is continued.
9
+ *Adds a QueueComplete event that is fired when all the queued files have finished uploading.
10
+ Set the event handler with the queue_complete_handler setting.
11
+
12
+ */
13
+
14
+ var SWFUpload;
15
+ if (typeof(SWFUpload) === "function") {
16
+ SWFUpload.queue = {};
17
+
18
+ SWFUpload.prototype.initSettings = (function (oldInitSettings) {
19
+ return function (userSettings) {
20
+ if (typeof(oldInitSettings) === "function") {
21
+ oldInitSettings.call(this, userSettings);
22
+ }
23
+
24
+ this.queueSettings = {};
25
+
26
+ this.queueSettings.queue_cancelled_flag = false;
27
+ this.queueSettings.queue_upload_count = 0;
28
+
29
+ this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
30
+ this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler;
31
+ this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
32
+ this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler;
33
+
34
+ this.settings.queue_complete_handler = userSettings.queue_complete_handler || null;
35
+ };
36
+ })(SWFUpload.prototype.initSettings);
37
+
38
+ SWFUpload.prototype.startUpload = function (fileID) {
39
+ this.queueSettings.queue_cancelled_flag = false;
40
+ this.callFlash("StartUpload", [fileID]);
41
+ };
42
+
43
+ SWFUpload.prototype.cancelQueue = function () {
44
+ this.queueSettings.queue_cancelled_flag = true;
45
+ this.stopUpload();
46
+
47
+ var stats = this.getStats();
48
+ while (stats.files_queued > 0) {
49
+ this.cancelUpload();
50
+ stats = this.getStats();
51
+ }
52
+ };
53
+
54
+ SWFUpload.queue.uploadStartHandler = function (file) {
55
+ var returnValue;
56
+ if (typeof(this.queueSettings.user_upload_start_handler) === "function") {
57
+ returnValue = this.queueSettings.user_upload_start_handler.call(this, file);
58
+ }
59
+
60
+ // To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value.
61
+ returnValue = (returnValue === false) ? false : true;
62
+
63
+ this.queueSettings.queue_cancelled_flag = !returnValue;
64
+
65
+ return returnValue;
66
+ };
67
+
68
+ SWFUpload.queue.uploadCompleteHandler = function (file) {
69
+ var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler;
70
+ var continueUpload;
71
+
72
+ if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
73
+ this.queueSettings.queue_upload_count++;
74
+ }
75
+
76
+ if (typeof(user_upload_complete_handler) === "function") {
77
+ continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
78
+ } else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) {
79
+ // If the file was stopped and re-queued don't restart the upload
80
+ continueUpload = false;
81
+ } else {
82
+ continueUpload = true;
83
+ }
84
+
85
+ if (continueUpload) {
86
+ var stats = this.getStats();
87
+ if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) {
88
+ this.startUpload();
89
+ } else if (this.queueSettings.queue_cancelled_flag === false) {
90
+ this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]);
91
+ this.queueSettings.queue_upload_count = 0;
92
+ } else {
93
+ this.queueSettings.queue_cancelled_flag = false;
94
+ this.queueSettings.queue_upload_count = 0;
95
+ }
96
+ }
97
+ };
98
+ }
@@ -0,0 +1,335 @@
1
+ /* -----------------------------------------------
2
+ www.swfupload.org
3
+ Description: Common Screen Stylesheet for SWFUpload Demos
4
+ Updated on: May 1, 2008
5
+ ----------------------------------------------- */
6
+
7
+
8
+ /* -----------------------------------------------
9
+ GLOBAL RESET
10
+ ----------------------------------------------- */
11
+
12
+ html, body, div, span, applet, object, iframe,
13
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
14
+ a, abbr, acronym, address, big, cite, code,
15
+ del, dfn, font, img, ins, kbd, q, s, samp,
16
+ small, strike, strong, sub, sup, tt, var,
17
+ dl, dt, dd, ol, ul, li,
18
+ fieldset, form, label, legend,
19
+ table, caption, tbody, tfoot, thead, tr, th, td {
20
+ margin: 0;
21
+ padding: 0;
22
+ border: 0;
23
+ outline: 0;
24
+ font-weight: inherit;
25
+ font-style: inherit;
26
+ font-size: 100%;
27
+ font-family: inherit;
28
+ vertical-align: baseline;
29
+ }
30
+
31
+ /* remember to define focus styles! */
32
+ :focus { outline: 0; }
33
+ body {
34
+ line-height: 1;
35
+ color: black;
36
+ background: white;
37
+ padding:10px;
38
+ }
39
+ ol, ul {
40
+ list-style: none;
41
+ }
42
+ /* tables still need 'cellspacing="0"' in the markup */
43
+ table {
44
+ border-collapse: separate;
45
+ border-spacing: 0;
46
+ }
47
+ caption, th, td {
48
+ text-align: left;
49
+ font-weight: normal;
50
+ }
51
+ blockquote:before, blockquote:after,
52
+ q:before, q:after {
53
+ content: "";
54
+ }
55
+ blockquote, q {
56
+ quotes: "" "";
57
+ }
58
+
59
+
60
+ /* -----------------------------------------------
61
+ BASIC ELEMENTS
62
+ ----------------------------------------------- */
63
+
64
+
65
+ /* -- Text Styles ------------------------------- */
66
+ html,
67
+ body {
68
+ margin: 0;
69
+ padding: 0;
70
+ width: 100%;
71
+ font: 12px/1.4em Helvetica, Arial, sans-serif;
72
+ }
73
+
74
+ a {
75
+ color: #385ea2;
76
+ text-decoration: none;
77
+ }
78
+ a:hover { text-decoration: underline; }
79
+
80
+ strong { font-weight: 700; }
81
+
82
+ h1 {
83
+ font: 28px/1em Arial, Helvetica, sans-serif;
84
+ padding: 60px 20px 20px;
85
+ margin-bottom: 15px;
86
+ color: #333;
87
+ text-decoration: none;
88
+ }
89
+
90
+ h1 a{
91
+ color: #fff;
92
+ text-decoration: none;
93
+ }
94
+
95
+ h2 {
96
+ font-size: 22px;
97
+ font-weight: 300;
98
+ padding-top: 1em;
99
+ padding-bottom: .25em;
100
+ }
101
+
102
+
103
+ p {
104
+ margin-top: .25em;
105
+ margin-bottom: .5em;
106
+ }
107
+
108
+ ul { padding: 4px 5px; }
109
+ ul li {
110
+ padding: 4px 5px;
111
+ margin: 0 20px;
112
+ list-style:square;
113
+ }
114
+
115
+ code {
116
+ display: block;
117
+ background:#edffb8 none repeat scroll 0%;
118
+ border-color:#b2da3a;
119
+ border-style:solid;
120
+ border-width:1px 0;
121
+ font-size: 1em;
122
+ margin: 1em 0pt;
123
+ overflow:auto;
124
+ padding: 0.3em 0.4em;
125
+ white-space:pre;
126
+ }
127
+
128
+ /* -- Layout ------------------------------- */
129
+
130
+
131
+ #header {
132
+ background: #313131 url(../images/header-bg.jpg) repeat-x top left;
133
+ height: 125px;
134
+ position: relative;
135
+ }
136
+ #logo {
137
+ padding: 0;
138
+ margin: 0;
139
+ background: url(../images/logo.gif) no-repeat 20px 20px;
140
+ height: 106px;
141
+ width: 272px;
142
+ text-indent: -5000px;
143
+ overflow: hidden;
144
+ }
145
+ /* hide link text */
146
+ #logo a {
147
+ display: block;
148
+ color: #fff;
149
+ text-indent: -5000px;
150
+ overflow: hidden;
151
+ height: 106px;
152
+ width: 272px;
153
+ }
154
+
155
+ #version {
156
+ color: #fff;
157
+ position: absolute;
158
+ right: 20px;
159
+ top: 85px;
160
+ }
161
+
162
+
163
+ #content { width: 680px;}
164
+ #content { margin: 20px 90px; }
165
+
166
+
167
+
168
+
169
+ /* -- Form Styles ------------------------------- */
170
+ form {
171
+ margin: 0;
172
+ padding: 0;
173
+ }
174
+
175
+
176
+
177
+ div.fieldset {
178
+ border: 1px solid #afe14c;
179
+ margin: 10px 0;
180
+ padding: 20px 10px;
181
+ }
182
+ div.fieldset span.legend {
183
+ position: relative;
184
+ background-color: #FFF;
185
+ padding: 3px;
186
+ top: -30px;
187
+ font: 700 14px Arial, Helvetica, sans-serif;
188
+ color: #73b304;
189
+ }
190
+
191
+ div.flash {
192
+ width: 375px;
193
+ margin: 10px 5px;
194
+ border-color: #D9E4FF;
195
+
196
+ -moz-border-radius-topleft : 5px;
197
+ -webkit-border-top-left-radius : 5px;
198
+ -moz-border-radius-topright : 5px;
199
+ -webkit-border-top-right-radius : 5px;
200
+ -moz-border-radius-bottomleft : 5px;
201
+ -webkit-border-bottom-left-radius : 5px;
202
+ -moz-border-radius-bottomright : 5px;
203
+ -webkit-border-bottom-right-radius : 5px;
204
+
205
+ }
206
+
207
+ button,
208
+ input,
209
+ select,
210
+ textarea {
211
+ border-width: 1px;
212
+ margin-bottom: 10px;
213
+ padding: 2px 3px;
214
+ }
215
+
216
+
217
+
218
+ input[disabled]{ border: 1px solid #ccc } /* FF 2 Fix */
219
+
220
+
221
+ label {
222
+ width: 150px;
223
+ text-align: right;
224
+ display:block;
225
+ margin-right: 5px;
226
+ }
227
+
228
+ #btnSubmit { margin: 0 0 0 155px ; }
229
+
230
+ /* -- Table Styles ------------------------------- */
231
+ td {
232
+ font: 10pt Helvetica, Arial, sans-serif;
233
+ vertical-align: top;
234
+ }
235
+
236
+ .progressWrapper {
237
+ width: 357px;
238
+ overflow: hidden;
239
+ }
240
+
241
+ .progressContainer {
242
+ margin: 5px;
243
+ padding: 4px;
244
+ border: solid 1px #E8E8E8;
245
+ background-color: #F7F7F7;
246
+ overflow: hidden;
247
+ }
248
+ /* Message */
249
+ .message {
250
+ margin: 1em 0;
251
+ padding: 10px 20px;
252
+ border: solid 1px #FFDD99;
253
+ background-color: #FFFFCC;
254
+ overflow: hidden;
255
+ }
256
+ /* Error */
257
+ .red {
258
+ border: solid 1px #B50000;
259
+ background-color: #FFEBEB;
260
+ }
261
+
262
+ /* Current */
263
+ .green {
264
+ border: solid 1px #DDF0DD;
265
+ background-color: #EBFFEB;
266
+ }
267
+
268
+ /* Complete */
269
+ .blue {
270
+ border: solid 1px #CEE2F2;
271
+ background-color: #F0F5FF;
272
+ }
273
+
274
+ .progressName {
275
+ font-size: 8pt;
276
+ font-weight: 700;
277
+ color: #555;
278
+ width: 323px;
279
+ height: 14px;
280
+ text-align: left;
281
+ white-space: nowrap;
282
+ overflow: hidden;
283
+ }
284
+
285
+ .progressBarInProgress,
286
+ .progressBarComplete,
287
+ .progressBarError {
288
+ font-size: 0;
289
+ width: 0%;
290
+ height: 2px;
291
+ background-color: blue;
292
+ margin-top: 2px;
293
+ }
294
+
295
+ .progressBarComplete {
296
+ width: 100%;
297
+ background-color: green;
298
+ visibility: hidden;
299
+ }
300
+
301
+ .progressBarError {
302
+ width: 100%;
303
+ background-color: red;
304
+ visibility: hidden;
305
+ }
306
+
307
+ .progressBarStatus {
308
+ margin-top: 2px;
309
+ width: 337px;
310
+ font-size: 7pt;
311
+ font-family: Arial;
312
+ text-align: left;
313
+ white-space: nowrap;
314
+ }
315
+
316
+ a.progressCancel {
317
+ font-size: 0;
318
+ display: block;
319
+ height: 14px;
320
+ width: 14px;
321
+ background-image: url(../../images/vzaar/cancelbutton.gif);
322
+ background-repeat: no-repeat;
323
+ background-position: -14px 0px;
324
+ float: right;
325
+ }
326
+
327
+ a.progressCancel:hover {
328
+ background-position: 0px 0px;
329
+ }
330
+
331
+
332
+ /* -- SWFUpload Object Styles ------------------------------- */
333
+ .swfupload {
334
+ vertical-align: top;
335
+ }
@@ -0,0 +1,15 @@
1
+ <%= include_vzaar_javascripts %>
2
+ <%= link_vzaar_stylesheets %>
3
+
4
+ <div>Upload videos to vzaar:</div>
5
+ <%= vzaar_flash_uploader %>
6
+
7
+ <div>
8
+ Currently available videos (uncomment the code below
9
+ and replace YOUR_VZAAR_LOGIN with your actual login to show your videos):
10
+ <ul>
11
+ <%# Vzaar.connection.video_list('YOUR_VZAAR_LOGIN', true).each do |video| %>
12
+ <li><%#= video.title %></li>
13
+ <%# end %>
14
+ </ul>
15
+ </div>
@@ -0,0 +1,52 @@
1
+ class VzaarUploaderGenerator < Rails::Generator::Base
2
+
3
+ def manifest
4
+ record do |m|
5
+
6
+ # Views
7
+ m.directory 'app/views/vzaar'
8
+ m.file 'views/uploader.html.erb', 'app/views/vzaar/index.html.erb'
9
+
10
+ # Resources
11
+ m.directory 'public/flash/vzaar'
12
+ m.directory 'public/images/vzaar'
13
+ m.directory 'public/javascripts/vzaar'
14
+ m.directory 'public/stylesheets/vzaar'
15
+ m.file 'flash/swfupload.swf', 'public/flash/vzaar/swfupload.swf'
16
+ m.file 'flash/swfupload_fp9.swf', 'public/flash/vzaar/swfupload_fp9.swf'
17
+ m.file 'images/cancelbutton.gif', 'public/images/vzaar/cancelbutton.gif'
18
+ m.file 'javascripts/fileprogress.js', 'public/javascripts/vzaar/fileprogress.js'
19
+ m.file 'javascripts/handlers.js', 'public/javascripts/vzaar/handlers.js'
20
+ m.file 'javascripts/swfupload.js', 'public/javascripts/vzaar/swfupload.js'
21
+ m.file 'javascripts/json_parse.js', 'public/javascripts/vzaar/json_parse.js'
22
+ m.file 'javascripts/swfupload.queue.js',
23
+ 'public/javascripts/vzaar/swfupload.queue.js'
24
+ m.file 'stylesheets/swfupload.css', 'public/stylesheets/vzaar/swfupload.css'
25
+
26
+ # Routes
27
+ gen_routes
28
+
29
+ end
30
+ end
31
+
32
+ def gen_routes
33
+ sentinel = 'ActionController::Routing::Routes.draw do |map|'
34
+ gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
35
+ "#{match}\n\n" +
36
+ " map.vzaar_uploader '/vzaar/', :controller => 'vzaar', " +
37
+ ":action => 'index'\n" +
38
+ " map.vzaar_signature '/vzaar/signature/', :controller => 'vzaar', " +
39
+ ":action => 'signature'\n" +
40
+ " map.vzaar_process_video '/vzaar/process_video/', :controller => 'vzaar', " +
41
+ ":action => 'process_video'\n"
42
+ end
43
+
44
+ end
45
+
46
+ def gsub_file(relative_destination, regexp, *args, &block)
47
+ path = destination_path(relative_destination)
48
+ content = File.read(path).gsub(regexp, *args, &block)
49
+ File.open(path, 'wb') { |file| file.write(content) }
50
+ end
51
+
52
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vzaar
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
+ platform: ruby
11
+ authors:
12
+ - Mariusz Lusiak
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-01-28 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: httpclient
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 2
29
+ - 1
30
+ - 5
31
+ version: 2.1.5
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: oauth
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 3
44
+ - 6
45
+ version: 0.3.6
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ description: The vzaar_api gem provides means to access and manage resources on http://vzaar.com
49
+ email: mariusz@applicake.com
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files:
55
+ - README
56
+ files:
57
+ - README
58
+ - Changelog
59
+ - LICENSE
60
+ - demo.rb
61
+ - lib/rails/views/view_helpers.rb
62
+ - lib/rails/controllers/vzaar_controller.rb
63
+ - lib/vzaar.rb
64
+ - lib/vzaar/video_details.rb
65
+ - lib/vzaar/base.rb
66
+ - lib/vzaar/account_type.rb
67
+ - lib/vzaar/signature.rb
68
+ - lib/vzaar/video.rb
69
+ - lib/vzaar/user.rb
70
+ - lib/vzaar/errors.rb
71
+ - rails_generators/vzaar_uploader/vzaar_uploader_generator.rb
72
+ - rails_generators/vzaar_uploader/templates/views/uploader.html.erb
73
+ - rails_generators/vzaar_uploader/templates/images/cancelbutton.gif
74
+ - rails_generators/vzaar_uploader/templates/stylesheets/swfupload.css
75
+ - rails_generators/vzaar_uploader/templates/flash/swfupload.swf
76
+ - rails_generators/vzaar_uploader/templates/flash/swfupload_fp9.swf
77
+ - rails_generators/vzaar_uploader/templates/javascripts/swfupload.js
78
+ - rails_generators/vzaar_uploader/templates/javascripts/fileprogress.js
79
+ - rails_generators/vzaar_uploader/templates/javascripts/swfupload.queue.js
80
+ - rails_generators/vzaar_uploader/templates/javascripts/json_parse.js
81
+ - rails_generators/vzaar_uploader/templates/javascripts/handlers.js
82
+ - rails_generators/vzaar_uploader/USAGE
83
+ has_rdoc: true
84
+ homepage: http://developer.vzaar.com
85
+ licenses: []
86
+
87
+ post_install_message:
88
+ rdoc_options: []
89
+
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ segments:
97
+ - 0
98
+ version: "0"
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ segments:
104
+ - 0
105
+ version: "0"
106
+ requirements: []
107
+
108
+ rubyforge_project:
109
+ rubygems_version: 1.3.6
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: The vzaar_api gem provides means to access and manage resources on http://vzaar.com
113
+ test_files: []
114
+