use new bento and finish the frontpage
[opensuse:software-o-o.git] / app / views / main / download.erb
1 var mymedium = "<%= @medium %>";
2
3 var mylink = '';
4 var myiso = '';
5 var directory = "<%= @directory %>";
6 var isos = new Array();
7 <% @isos.each { |key, value| %>
8   <%= "isos['#{key}'] = '#{value}';" %>
9 <% } %>
10
11 function changeiso () {
12   mylink = mymedium;
13   var arch_suffix = "-64";
14   if ($('#i686').attr('checked')) {
15     arch_suffix = "-32";
16   }
17   myiso = directory + "/iso/openSUSE-" + isos[mylink + arch_suffix] + ".iso";
18   mylink = myiso;
19   var download_suffix = '';
20   if ($('#p_torrent').attr('checked')) {
21     download_suffix = ".torrent";
22   }
23   if ($('#p_metalink').attr('checked')) {
24     download_suffix = ".metalink";
25   }
26   if ($('#p_mirror').attr('checked')) {
27     download_suffix = "?mirrorlist";
28   }
29   $('#sig_gpg').attr("href", myiso + ".asc");
30   $('#sig_md5').attr("href", myiso + ".md5");
31   $('#sig_sha1').attr("href", myiso + ".sha1");
32   mylink += download_suffix;
33
34   var langiso = directory + "/iso/openSUSE-" + isos['lang' + arch_suffix] + ".iso";
35   $('#md5_lang').attr('href', langiso + ".md5");
36   $('#sha1_lang').attr('href', langiso + ".sha1");
37   $('#gpg_lang').attr('href', langiso + ".asc");
38   $('#iso_lang').attr('href', langiso + download_suffix);
39   $('#iso_nonoss').attr('href', directory + "/iso/openSUSE-" + isos['nonoss'] + ".iso" + download_suffix);
40
41   $('#icon_' + mymedium).addClass('icon_selected').removeClass('icon_unselected').parent('div').addClass("medium_selected").removeClass('medium_unselected');
42   // $('#icon_' + mymedium).addClass('icon_selected').removeClass('icon_unselected');
43
44   // $('#download_button').html($('#download_' + mymedium).html());
45   $('#download_button').html($('#download_' + mymedium).html());
46
47   if (mymedium == 'net') {
48      $('#l_torrent').addClass('notavailable');
49      $('#p_torrent').attr('disabled', 'disabled');
50      if ($('#p_torrent').attr('checked')) {
51         $('#p_torrent').attr('checked', '');
52         $('#p_http').attr('checked', 'checked');
53      }
54   } else {
55      $('#l_torrent').removeClass('notavailable');
56      $('#p_torrent').attr('disabled', '');
57   }
58
59   if ( mymedium == "derivatives"){
60     //mylink="http://www.opensuse-education.org/download/ISOs/openSUSE-Edu-li-f-e-11.2-latest-i686.iso";
61     mylink = "http://en.opensuse.org/Derivatives";
62
63 //      $('#l_x86_64').addClass('notavailable');
64 //    $('#x86_64').attr('disabled', 'disabled');
65 //   if ($('#x86_64').attr('checked')) {
66 //              $('#x86_64').attr('checked', '');
67 //              $('#i686').attr('checked', 'checked');
68 //    }
69 //  }
70 //  else {
71 //     $('#l_x86_64').removeClass('notavailable');
72 //     $('#x86_64').attr('disabled', '');
73   }
74 }
75
76
77 function unselectOld() {
78   // $('#icon_' + mymedium).removeClass('icon_selected').addClass('icon_unselected');
79   $('#icon_' + mymedium).removeClass('icon_selected').addClass('icon_unselected').parent('div').addClass("medium_unselected").removeClass('medium_selected');
80 }
81
82 $(function() {
83     changeiso();
84     $('.helplink').show();
85     $('.script_only').show();
86     $('.noscript').hide();
87
88     $('.changeiso').click(function(){
89                             changeiso();
90                             return true; 
91                           });
92     $('div.changeiso').click(function(){
93                                   unselectOld();
94                                   mymedium = this.id.substr(3);
95                                   changeiso();
96                               $(this).parent().trigger('click');
97                                   if ( mymedium == "derivatives"){
98                                       $(this).parent().next().append($('#derivativesDiv'));
99                                   }
100                                   else {
101                                       $(this).parent().next().append($('#downloadForm'));
102                                   }
103                                   return false; 
104                                 });
105     $('button.changeiso').click(function(){
106                                   unselectOld();
107                                   mymedium = this.id.substr(3);
108                                   changeiso();
109                                   return false; 
110                                 });
111     $('#download_button').click(function() {
112                            window.location = mylink;
113                            return false;
114                          });
115
116         $("#downloaderAccordion").accordion();
117         $("#help_method_content").dialog({
118                                 bgiframe: true,
119                                 autoOpen:false,
120                                 width: "80%",
121                                 draggable: false,
122                                 resizable: false,
123                                 title: 'openSUSE Download Help',
124                                 modal: true,
125                                 buttons: {
126                                         Ok: function() {
127                                                 $(this).dialog('close');
128                                         }
129                                 }
130                         });
131         $("#help_arch_content").dialog({
132                                 bgiframe: true,
133                                 autoOpen:false,
134                                 width: "80%",
135                                 draggable: false,
136                                 resizable: false,
137                                 title: 'openSUSE Download Help',
138                                 modal: true,
139                                 buttons: {
140                                         Ok: function() {
141                                                 $(this).dialog('close');
142                                         }
143                                 }
144                         });
145
146         $("#downloadMethodHelpPopup").click( function (){
147                 $("#help_method_content").dialog('open');
148         });
149
150         $("#architectureTypeHelpPopup").click( function (){
151                 $("#help_arch_content").dialog('open');
152         });
153 });