File:  [mozdev] / cdn / www / pxHlp_ext / extensionSetup.html
Revision 1.8: download - view: text, annotated - select for diffs - revision graph
Mon Feb 17 00:44:09 2003 UTC (16 years, 11 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
.o.

    1: <?php
    2: 
    3: // $Id: extensionSetup.html,v 1.8 2003/02/17 00:44:09 cdn Exp $
    4: 
    5: // Functions needed for an XPI install
    6: // Simplified version of Chris Cooks' install script
    7: 
    8: /*
    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: }
   30: */
   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: */
  109: 
  110: function listExtensions($extensionArray)
  111: {
  112: 
  113:   $howMany = count($extensionArray);
  114: 
  115:   $ret = '<p>This list contains most known Phoenix Extensions. There are currently ' . $howMany . ' extensions available here.</p>';
  116:   
  117:   for ($i = 0; $i < $howMany; $i++)
  118:   {
  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">';
  128:     $ret .= $extensionArray[$i]['size'];
  129:     $ret .= ' KB</td>';
  130:     $ret .= '<td class="label">Author:</td><td>';
  131:     for ($j=0; $extensionArray[$i]['author'][$j] != 0; $j++) {
  132:       if ($j > 0 && count($extensionArray[$i]['author']) > 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:   
  162:   }
  163: 
  164:   return $ret;
  165: 
  166: }
  167: 
  168: ?>

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