Ticket Change Details
Not logged in
Overview

Artifact ID: 84bb16abad5325d692eaa22107d6a23dcd3d4933
Ticket: 369e246e508de6d0874ec8c400c79c6a5495b0d3
Using EXTJS for JavaScript UI Framework
User & Date: renez 2011-02-12 11:03:38
Changes

  1. Appended to comment:
    
    
    <hr /><i>renez added on 2011-02-12 11:03:38 UTC:</i><br />
    I suggest to use a web page extern that will allow to load the file from the $HOME. If that fails it tries from /usr/share/fossil. I have coded an UNIX implementation. I'm not sure if and how security is compromised by this feature!
    
    For windows some other paths need to be used/found
    
    if I have a directory jscripts in $home and unpack tinymce there then I would code in header
    
    html "<script type='text/javascript' 
    src='extern/jscripts/tiny_mce/tiny_mce.js'></script>\n"
    
    and extern is coded like:
    <verbatim>
    /*
    ** WEBPAGE: extern
    ** URL: /extern/PATH
    **
    ** if the file
    **      $HOME/PATH is checked
    ** not exists then
    **      /usr/share/fossil/PATH
    ** is tried.
    **
    ** The content is returned straight without any interpretation or processing.
    */
    void ext_page(void){
      const char *zName;                /* Argument to the /extern page */
      const char *zMime;                /* Document MIME type */
      Blob filebody;                    /* Content of the documentation file */
      char *zFullpath = (char *) 0;
      static const char const * zSystem = {"/usr/share/fossil"};
    
      login_check_credentials();
      if( !g.okRead ){ login_needed(); return; }
      zName = PD("name", "");
      while( zName[0]=='/' ){ zName++; }
      zFullpath = mprintf("%s/%s", g.zHome, zName);
      if( !file_isfile(zFullpath) ){
    	  zFullpath = mprintf("%s/%s", zSystem, zName);
    	  if( !file_isfile(zFullpath) ){
    	    goto ext_not_found;
    	  }
      }
      if( blob_read_from_file(&filebody, zFullpath)<0 ){
        goto ext_not_found;
      }
      zMime = P("mimetype");
      if( zMime==0 ){
        zMime = mimetype_from_name(zName);
      }
      cgi_set_content_type(zMime);
      cgi_set_content(&filebody);
      return;
    
    ext_not_found:
      /* Jump here when unable to locate the document */
      style_header("External file Not Found");
      @ <p>No such external file: %s(zName) in %s(g.zHome) or %s(zSystem)</p>
      style_footer();
      return;
    }
    
    </verbatim>