File:  [mozdev] / cdn / www / pxHlp_ext / extensionSetup.html
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Mon Feb 17 00:18:52 2003 UTC (16 years, 11 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
data in php arrays, theoretically

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

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