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

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: 
1.10      cdn        45: function makeExtensionGrid($extensionArray) {
                     46:   if (count($extensionArray) == 0) {
                     47:     echo('<p><b><i>A <a href="javascript:">JavaScript Error</a> has probably occurred</i></b></p>');
1.1       cdn        48:   }
1.10      cdn        49:   echo('<ul>');
                     50:   for ($i = 0; $i < count($extensionArray); $i++) {
                     51:     echo('<div>');
                     52:     echo('<li><a href="#');
1.15    ! cdn        53:     echo(htmlentities($extensionArray[$i]['name']));
1.10      cdn        54:     echo('">');
1.13      cdn        55:     echo($extensionArray[$i]['name']);
1.10      cdn        56:     echo('</a></li>');
1.1       cdn        57:   }
1.10      cdn        58:   echo('</ul>');
1.1       cdn        59: }
1.2       cdn        60: 
1.6       cdn        61: function listExtensions($extensionArray)
1.2       cdn        62: {
                     63: 
1.8       cdn        64:   $howMany = count($extensionArray);
                     65: 
                     66:   $ret = '<p>This list contains most known Phoenix Extensions. There are currently ' . $howMany . ' extensions available here.</p>';
1.4       cdn        67:   
1.8       cdn        68:   for ($i = 0; $i < $howMany; $i++)
1.7       cdn        69:   {
                     70:    
1.4       cdn        71:     $ret .= '<a name="';
                     72:     $ret .= $extensionArray[$i]['name'];
                     73:     $ret .= '"></a>';
                     74:     $ret .= '<table class="extensions"><thead><tr><td colspan="4">';
                     75:     $ret .= $extensionArray[$i]['name'];
                     76:     $ret .= '</td></tr></thead>';
                     77:     $ret .= '<tbody><tr>';
                     78:     $ret .= '<td class="label">Size:</td><td class="size">';
1.5       cdn        79:     $ret .= $extensionArray[$i]['size'];
1.4       cdn        80:     $ret .= ' KB</td>';
                     81:     $ret .= '<td class="label">Author:</td><td>';
1.9       cdn        82:     for ($j=0; $extensionArray[$i]['author'][$j] != ''; $j++) {
1.7       cdn        83:       if ($j > 0 && count($extensionArray[$i]['author']) > 1 ) {
1.4       cdn        84:         $ret .= ', ';
                     85:       }
1.7       cdn        86:       if ($extensionArray[$i]['authorEmail'][$j] != '') {
1.4       cdn        87:         $ret .= '<a href="mailto:';
1.7       cdn        88:         $ret .= $extensionArray[$i]['authorEmail'][$j];
1.4       cdn        89:         $ret .= '">';
                     90:       }
1.7       cdn        91:       $ret .= $extensionArray[$i]['author'][$j];
                     92:       if ($extensionArray[$i]['authorEmail'][$j] != '') {
1.4       cdn        93:         $ret .= '</a>';
                     94:       }
1.7       cdn        95:     }
1.4       cdn        96:     $ret .= '</td></tr><tr><td class="label">Install:</td><td><a href="';
                     97:     $ret .= $extensionArray[$i]['installFile'];
                     98:     $ret .= '">Click Here</a></td><td class="label">Homepage:</td><td>';
                     99:     if ($extensionArray[$i].homepage != '') {
                    100:       $ret .= '<a href="';
                    101:       $ret .= $extensionArray[$i]['homepage'];
                    102:       $ret .= '">';
                    103:       $ret .= $extensionArray[$i]['homepage'];
                    104:       $ret .= '</a>';
                    105:     }
                    106:     else {
                    107:       $ret .= 'N/A';
                    108:     }
                    109:     $ret .= '</td></tr><tr><td colspan="4">';
                    110:     $ret .= $extensionArray[$i]['description'];
                    111:     $ret .= '</td></tr></tbody></table>';
1.7       cdn       112:   
                    113:   }
1.2       cdn       114: 
                    115:   return $ret;
                    116: 
                    117: }
                    118: 
1.1       cdn       119: ?>

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