/[drupal]/contributions/modules/twistage/twistage_publish.js
ViewVC logotype

Contents of /contributions/modules/twistage/twistage_publish.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Tue Oct 7 15:16:56 2008 UTC (13 months, 3 weeks ago) by xmattus
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5, DRUPAL-6--1
File MIME type: text/javascript
Adding multi-video posting functionality, and a few bug fixes-
1 function addVideo(a) {
2 $(a).hide();
3 $(a).parents('fieldset').clone().removeClass('twistage-add-original').appendTo('#twistage-add-replicate').find('input, textarea, select').each(function(i) {
4 var str = this.name;
5 m = str.match(/^twistage_upload\[(\d)\]\[([a-z_]+)\]$/);
6 if(m) {
7 var seq = (parseInt(m[1])+1);
8 this.name = 'twistage_upload['+seq+']['+ m[2]+']';
9 }
10 n = str.match(/^files\[twistage_upload_(\d)\]$/);
11 if(n) {
12 this.name = 'files[twistage_upload_'+(parseInt(n[1])+1)+']';
13 }
14 }).attr('value', '').end().find('.twistage-add-more').show().end().find('.form-checkbox').val('value', '1');
15 $('.twistage-add-more').click(function() {
16 addVideo(this);
17 });
18 var i = (parseInt($('#edit-twistage-sequence').val())+1);
19 $('#edit-twistage-sequence').val(i);
20 }
21
22 $(document).ready(function(){
23 // Drupal (or, at least, D5) does not seem to allow multiple file upload fields in the same form tree, so this a workaround.
24 $('#twistage-add-replicate input.form-file').each(function(i) {
25 $(this).attr('name', 'files[twistage_upload_'+i+']');
26 });
27
28 $('.twistage-add-more').click(function() {
29 addVideo(this);
30 });
31 });

  ViewVC Help
Powered by ViewVC 1.1.2