Changeset 619

Show
Ignore:
Timestamp:
04/24/07 22:14:31 (1 year ago)
Author:
schst
Message:

Drop strict dependency on YUI, by making it possible to use the version hosted at Yahoo. The user will be prompted, whether he wants to use the online version, when setting up the examples.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build.properties

    r600 r619  
    11build.base.dir=build 
    22examples.base.dir=examples 
     3yui.local.use=yes 
  • trunk/build.xml

    r604 r619  
    3131      </fileset> 
    3232    </copy> 
     33    <available file="${examples.absolute.dir}/yui" type="dir" property="yui.local.available"/> 
    3334    <if> 
    34       <available file="${examples.absolute.dir}/yui" type="dir"/> 
     35      <isset property="yui.local.use"/> 
     36      <!-- use local version --> 
    3537      <then> 
    36         <echo>YAHOO! User Interface library is installed.</echo> 
     38        <if> 
     39          <equals arg1="${yui.local.use}" arg2="yes"/> 
     40          <then> 
     41            <if> 
     42              <equals arg1="${yui.local.available}" arg2="yes"/> 
     43              <then> 
     44                <echo>YAHOO! User Interface library is installed.</echo> 
     45              </then> 
     46              <else> 
     47                <echo level="error">[Error] YAHOO! User Interface library is *not* installed.</echo> 
     48                <echo level="error"/> 
     49                <echo level="error">Set the property "yui.local.use" in "build.properties" to "no" to use the online version.</echo> 
     50                <echo level="error"/> 
     51                <echo level="error">Or download the latest version of the YAHOO! User Interface library from http://developer.yahoo.com/yui</echo> 
     52                <echo level="error">and place it into ${examples.absolute.dir}/yui.</echo> 
     53                <echo level="error">For more information refer to ${examples.absolute.dir}/json-rpc/README.</echo> 
     54              </else> 
     55            </if> 
     56          </then> 
     57          <else> 
     58            <echo>Using online version of the YAHOO! User Interface library, please make sure, you are connected to the Internet.</echo> 
     59          </else> 
     60        </if> 
    3761      </then> 
    3862      <else> 
    39         <echo level="error">[Error] YAHOO! User Interface library is *not* installed.</echo> 
    40         <echo>Please download the latest version of the YAHOO! User Interface library from http://developer.yahoo.com/yui</echo> 
    41         <echo>and place it into ${examples.absolute.dir}/yui.</echo> 
    42         <echo>For more information refer to ${examples.absolute.dir}/json-rpc/README.</echo> 
     63        <if> 
     64          <equals arg1="${yui.local.available}" arg2="yes"/> 
     65          <then> 
     66            <echo>YAHOO! User Interface library is installed.</echo> 
     67            <echo>Will use this version in examples.</echo> 
     68            <append destFile="build.properties" text="yui.local.use=yes${line.separator}"/> 
     69          </then> 
     70          <else> 
     71            <echo>YAHOO! User Interface library is *not* installed.</echo> 
     72            <input propertyname="yui.remote.use" promptChar="?">Do you want to use the online version provided by YAHOO (Y/N)</input> 
     73            <if> 
     74              <equals arg1="${yui.remote.use}" arg2="Y"/> 
     75              <then> 
     76                <append destFile="build.properties" text="yui.local.use=no${line.separator}"/> 
     77              </then> 
     78              <else> 
     79                <append destFile="build.properties" text="yui.local.use=yes${line.separator}"/> 
     80              </else> 
     81            </if> 
     82          </else> 
     83        </if> 
    4384      </else> 
    4485    </if> 
  • trunk/examples/json-rpc/index.php

    r604 r619  
     1<?php 
     2/** 
     3 * Example HTML page to demonstrate the JSON-RPC processor. 
     4 * 
     5 * In a real-life application, this page would be generated by 
     6 * any other Stubbles processor. We use PHP/HTML here, to 
     7 * demonstrate, how easy it is to the the JSON-RPC part in 
     8 * existing applications. 
     9 * 
     10 * @author  Stephan Schmidt <schst@stubbles.net> 
     11 */ 
     12 
     13$properties = parse_ini_file('../../build.properties'); 
     14?> 
    115<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    216    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     
    418<head> 
    519  <title>JSON-RPC Test</title> 
     20<?php 
     21if ($properties['yui.local.use']): 
     22?> 
    623  <script type="text/javascript" src="../yui/build/yahoo/yahoo.js"></script> 
    724  <script type="text/javascript" src="../yui/build/connection/connection.js"></script> 
     25<?php 
     26else: 
     27?> 
     28  <script type="text/javascript" src="http://yui.yahooapis.com/2.2.2/build/yahoo/yahoo-min.js"></script> 
     29  <script type="text/javascript" src="http://yui.yahooapis.com/2.2.2/build/connection/connection-min.js"></script> 
     30<?php 
     31endif; 
     32?> 
    833  <script type="text/javascript" src="javascript/json.js"></script> 
    934  <script type="text/javascript" src="javascript/stub-base.js"></script>