Annotation of cdn/www/pxHlp_ext/extensionSetup.html, revision 1.5

1.1       cdn         1: <?php
                      2: 
                      3: // $Id$
                      4: 
                      5: // Functions needed for an XPI install
                      6: // Simplified version of Chris Cooks' install script
                      7: 
1.3       cdn         8: /*
1.1       cdn         9: function doneFn(name,result) {}
                     10: 
                     11: function isValidUa() {
                     12:   // Returns true if script is run in the Phoenix browser
                     13:   
                     14:   var ua=navigator.userAgent.toLowerCase();
                     15:   if(ua.indexOf('gecko')!=-1 && ua.indexOf('phoenix')!=-1) {
                     16:       return true;
                     17:   }
                     18:   return false;
                     19: }
                     20: 
                     21: function doXPIInstall(file,name) {
                     22:   if(!isValidUa()) {
                     23:        alert('This extension is not supported by your browser.');
                     24:        return false;
                     25:   }
                     26:   var xpi = new Object();
                     27:   xpi[name] = file;
                     28:   InstallTrigger.install(xpi,doneFn);
                     29: }
1.3       cdn        30: */
1.1       cdn        31: 
                     32: // here down js->php
                     33: 
                     34: /*
                     35: function checkDateWindow(dateString) { // Input string of yyyy-mm-dd
                     36:   var newDaysWindow = 7 * (1000 * 60 * 60 * 24); // Only new for 7 days
                     37:   var dateArray = dateString.split('-');
                     38:   var newDate = (new Date( dateArray[0], dateArray[1] - 1, dateArray[2])).valueOf() + newDaysWindow;
                     39:   return ( newDate > (new Date()).valueOf() );
                     40: }
                     41: */
                     42: 
                     43: $extensionArray = array();
                     44: 
                     45: /*
                     46: function makeExtensionGrid() {
                     47:   if (extensionArray.length == 0) {
                     48:     document.write('<p><b><i>A <a href="javascript:">JavaScript Error</a> has probably occurred</i></b></p>');
                     49:   }
                     50:   document.write('<ul>');
                     51:   for (var i = 0; i < extensionArray.length; i++) {
                     52:     document.write('<div>');
                     53:     document.write('<li><a href="#');
                     54:     document.write(escape(extensionArray[i].name));
                     55:     document.write('">');
                     56:     document.write(extensionArray[i].name);
                     57:     document.write('</a></li>');
                     58:   }
                     59:   document.write('</ul>');
                     60: }
                     61: 
                     62: function listExtensions() {
                     63:        document.write('<p>This list contains most known Phoenix Extensions. There are currently ' + extensionArray.length + ' extensions available here.</p>');
                     64:   for (var i = 0; i < extensionArray.length; i++) {
                     65:     document.write('<a name="');
                     66:     document.write(extensionArray[i].name);
                     67:     document.write('"></a>');
                     68:     document.write('<table class="extensions"><thead><tr><td colspan="4">');
                     69:     document.write(extensionArray[i].name);
                     70:     document.write('</td></tr></thead>');
                     71:     document.write('<tbody><tr>');
                     72:     document.write('<td class="label">Size:</td><td class="size">');
                     73:     document.write(extensionArray[i].size);
                     74:     document.write(' KB</td>');
                     75:     document.write('<td class="label">Author:</td><td>');
                     76:     for (var j=0; j < extensionArray[i].author.length; j++) {
                     77:       if (j > 0 && extensionArray[i].author.length > 1 ) {
                     78:         document.write(', ');
                     79:       }
                     80:       if (extensionArray[i].authorEmail[j] != '') {
                     81:         document.write('<a href="mailto:');
                     82:         document.write(extensionArray[i].authorEmail[j]);
                     83:         document.write('">');
                     84:       }
                     85:       document.write(extensionArray[i].author[j]);
                     86:       if (extensionArray[i].authorEmail[j] != '') {
                     87:         document.write('</a>');
                     88:       }
                     89:     }
                     90:     document.write('</td></tr><tr><td class="label">Install:</td><td><a href="');
                     91:     document.write(extensionArray[i].installFile);
                     92:     document.write('">Click Here</a></td><td class="label">Homepage:</td><td>');
                     93:     if (extensionArray[i].homepage != '') {
                     94:       document.write('<a href="');
                     95:       document.write(extensionArray[i].homepage);
                     96:       document.write('">');
                     97:       document.write(extensionArray[i].homepage);
                     98:       document.write('</a>');
                     99:     }
                    100:     else {
                    101:       document.write('N/A');
                    102:     }
                    103:     document.write('</td></tr><tr><td colspan="4">');
                    104:     document.write(extensionArray[i].description);
                    105:     document.write('</td></tr></tbody></table>');
                    106:   }
                    107: }
                    108: */
1.2       cdn       109: 
                    110: function listExtensions()
                    111: {
                    112: 
                    113:   $ret = '<p>This list contains most known Phoenix Extensions. There are currently ' . count($extensionArray) . ' extensions available here.</p>';
1.4       cdn       114:   
                    115:   //for (var i = 0; i < extensionArray.length; i++)
                    116:   //{
                    117:   
                    118:   $i = 0;
                    119:   
                    120:     $ret .= '<a name="';
                    121:     $ret .= $extensionArray[$i]['name'];
                    122:     $ret .= '"></a>';
                    123:     $ret .= '<table class="extensions"><thead><tr><td colspan="4">';
                    124:     $ret .= $extensionArray[$i]['name'];
                    125:     $ret .= '</td></tr></thead>';
                    126:     $ret .= '<tbody><tr>';
                    127:     $ret .= '<td class="label">Size:</td><td class="size">';
1.5     ! cdn       128:     $ret .= $extensionArray[$i]['size'];
1.4       cdn       129:     $ret .= ' KB</td>';
                    130:     $ret .= '<td class="label">Author:</td><td>';
                    131: /*    for ($j=0; $j < $extensionArray[$i].author.length; $j++) {
                    132:       if (j > 0 && $extensionArray[$i].author.length > 1 ) {
                    133:         $ret .= ', ';
                    134:       }
                    135:       if ($extensionArray[$i].authorEmail[j] != '') {
                    136:         $ret .= '<a href="mailto:';
                    137:         $ret .= $extensionArray[$i].authorEmail[j]);
                    138:         $ret .= '">';
                    139:       }
                    140:       $ret .= $extensionArray[$i].author[j]);
                    141:       if ($extensionArray[$i].authorEmail[j] != '') {
                    142:         $ret .= '</a>';
                    143:       }
                    144:     }*/
                    145:     $ret .= '</td></tr><tr><td class="label">Install:</td><td><a href="';
                    146:     $ret .= $extensionArray[$i]['installFile'];
                    147:     $ret .= '">Click Here</a></td><td class="label">Homepage:</td><td>';
                    148:     if ($extensionArray[$i].homepage != '') {
                    149:       $ret .= '<a href="';
                    150:       $ret .= $extensionArray[$i]['homepage'];
                    151:       $ret .= '">';
                    152:       $ret .= $extensionArray[$i]['homepage'];
                    153:       $ret .= '</a>';
                    154:     }
                    155:     else {
                    156:       $ret .= 'N/A';
                    157:     }
                    158:     $ret .= '</td></tr><tr><td colspan="4">';
                    159:     $ret .= $extensionArray[$i]['description'];
                    160:     $ret .= '</td></tr></tbody></table>';
                    161:   //}
1.2       cdn       162: 
                    163:   return $ret;
                    164: 
                    165: }
                    166: 
1.1       cdn       167: ?>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>