Changeset 117 for branches

Show
Ignore:
Timestamp:
08/08/08 10:47:29 (5 months ago)
Author:
nickstenning
Message:

Merge css and js changes. First steps towards new app.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/jsspike-20080806/microfacts/__init__.py

    r2 r117  
     1__version__ = '0.2' 
  • branches/jsspike-20080806/microfacts/public/vendor/ejs/ejs.js

    r52 r117  
    99 *  EJS is a client-side preprocessing engine written in and for JavaScript. 
    1010 *  If you have used PHP, ASP, JSP, or ERB then you get the idea: code embedded 
    11  *  in <% // Code here %> tags will be executed, and code embedded in <%= .. %> 
    12  *  tags will be evaluated and appended to the output. 
    13  * 
    14  *  This is essentially a direct JavaScript port of Masatoshi Seki's erb.rb 
    15  *  from the Ruby Core, though it contains a subset of ERB's functionality. 
    16  * 
     11 *  in <% // Code here %> tags will be executed, and code embedded in <%= .. %>  
     12 *  tags will be evaluated and appended to the output.  
     13 *  
     14 *  This is essentially a direct JavaScript port of Masatoshi Seki's erb.rb  
     15 *  from the Ruby Core, though it contains a subset of ERB's functionality.  
     16 *  
    1717 *  Requirements: 
    1818 *      prototype.js 
    19  * 
     19 *  
    2020 *  Usage: 
    2121 *      // source should be either a string or a DOM node whose innerHTML 
    2222 *      // contains EJB source. 
    23  *      var source = "<% var ejb="EJB"; %><h1>Hello, <%= ejb %>!</h1>"; 
    24  *      var compiler = new EjsCompiler(source); 
    25  *          compiler.compile(); 
     23 *      var source = "<% var ejb="EJB"; %><h1>Hello, <%= ejb %>!</h1>";  
     24 *      var compiler = new EjsCompiler(source);                 
     25 *          compiler.compile();         
    2626 *          var output = eval(compiler.out); 
    2727 *      alert(output); // -> "<h1>Hello, EJB!</h1>" 
    28  * 
     28 *        
    2929 *  For a demo:      see demo.html 
    3030 *  For the license: see license.txt 
     
    4646                        retArr.push(item.substring(0,first_idx)); 
    4747                        item = item.slice(first_idx); 
    48                 } 
     48                }               
    4949                retArr.push(result[0]); 
    5050                item = item.slice(result[0].length); 
    51                 result = regex.exec(item); 
     51                result = regex.exec(item);      
    5252        } 
    5353        if (! item == '') 
     
    7474                this.SplitRegexp = /(\[%%)|(%%\])|(\[%=)|(\[%#)|(\[%)|(%\]\n)|(%\])|(\n)/; 
    7575        else 
    76                 this.SplitRegexp = new RegExp('('+this.double_left+')|(%%'+this.double_right+')|('+this.left_equal+')|('+this.left_comment+')|('+this.left_delimiter+')|('+this.right_delimiter+'\n)|('+this.right_delimiter+')|(\n)') 
    77  
     76                this.SplitRegexp = new RegExp('('+this.double_left+')|(%%'+this.double_right+')|('+this.left_equal+')|('+this.left_comment+')|('+this.left_delimiter+')|('+this.right_delimiter+'\n)|('+this.right_delimiter+')|(\n)')  
     77         
    7878        this.source = source; 
    7979        this.stag = null; 
     
    9393    if(input instanceof Date) 
    9494                return input.toDateString(); 
    95         if(input.toString) 
     95        if(input.toString)  
    9696        return input.toString() 
    9797        return ''; 
     
    113113         } 
    114114  }, 
    115  
     115   
    116116  /* For each token, block! */ 
    117117  scanline: function(line, regex, block) { 
     
    137137        this.pre_cmd = pre_cmd; 
    138138        this.post_cmd = post_cmd; 
    139  
     139         
    140140        for (var i=0; i<this.pre_cmd.length; i++) 
    141141        { 
     
    144144} 
    145145EjsBuffer.prototype = { 
    146  
     146         
    147147  push: function(cmd) { 
    148148        this.line.push(cmd); 
     
    166166        } 
    167167  } 
    168  
     168         
    169169}; 
    170170 
     
    173173        this.pre_cmd = ['___ejsO = "";']; 
    174174        this.post_cmd = new Array(); 
    175         this.source = ' '; 
     175        this.source = ' ';      
    176176        if (source != null) 
    177177        { 
     
    185185                { 
    186186                        this.source = source.innerHTML; 
    187                 } 
     187                }  
    188188                if (typeof this.source != 'string') 
    189189                { 
     
    212212        var put_cmd = "___ejsO += "; 
    213213        var insert_cmd = put_cmd; 
    214         var buff = new EjsBuffer(this.pre_cmd, this.post_cmd); 
     214        var buff = new EjsBuffer(this.pre_cmd, this.post_cmd);          
    215215        var content = ''; 
    216216        var clean = function(content) 
     
    220220        content = content.replace(/"/g,  '\\"'); 
    221221        return content; 
    222         } 
     222        }  
    223223        this.scanner.scan(function(token, scanner) { 
    224224                if (scanner.stag == null) 
     
    239239                                        { 
    240240                                                // Chould be content.dump in Ruby 
    241  
     241                                                 
    242242                                                buff.push(put_cmd + '"' + clean(content) + '"'); 
    243243                                        } 
     
    291291        this.out = buff.script + ";"; 
    292292        var to_be_evaled = 'this.process = function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {'+this.out+" return ___ejsO;}}}catch(e){e.lineNumber=null;throw e;}};"; 
    293  
     293         
    294294        try{ 
    295295                eval(to_be_evaled); 
     
    320320EJS = function( options ){ 
    321321        this.set_options(options) 
    322  
     322         
    323323        if(options.url){ 
    324324                var template = EJS.get(options.url, this.cache) 
     
    350350        template.compile(options); 
    351351 
    352  
     352         
    353353        EJS.update(this.name, this); 
    354354        this.template = template 
     
    358358        EJS.type = options.type != null ? options.type : EJS.type 
    359359        var templates_directory = {} //nice and private container 
    360  
     360         
    361361        EJS.get = function(path, cache){ 
    362362                if(cache == false) return null; 
     
    364364                return null; 
    365365        } 
    366  
    367         EJS.update = function(path, template) { 
     366         
     367        EJS.update = function(path, template) {  
    368368                if(path == null) return; 
    369                 templates_directory[path] = template 
    370         } 
    371  
     369                templates_directory[path] = template  
     370        } 
     371         
    372372        EJS.INVALID_PATH =  -1; 
    373  
    374  
     373         
     374         
    375375} 
    376376EJS.config( {cache: true, type: '<' } ) 
     
    429429           } 
    430430        } 
    431  
     431         
    432432        EJS.request = function(path){ 
    433433           var request = new EJS.newRequest() 
    434434           request.open("GET", path, false); 
    435  
     435            
    436436           try{request.send(null);} 
    437437           catch(e){return null;} 
    438  
     438            
    439439           if ( request.status == 404 || request.status == 2 ||(request.status == 0 && request.responseText == '') ) return null; 
    440  
     440            
    441441           return request.responseText 
    442442        } 
    443443        EJS.ajax_request = function(params){ 
    444444                params.method = ( params.method ? params.method : 'GET') 
    445  
     445                 
    446446                var request = new EJS.newRequest(); 
    447447                request.onreadystatechange = function(){ 
  • branches/jsspike-20080806/microfacts/public/vendor/ejs/view.js

    r52 r117  
    22    if(! (value instanceof Date)) 
    33                value = new Date() 
    4  
     4         
    55        var month_names = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; 
    66        var years = [], months = [], days =[]; 
     
    2323        var month_select = this.select_tag(name+'[month]', month, months, {id: name+'[month]'}) 
    2424        var day_select = this.select_tag(name+'[day]', day, days, {id: name+'[day]'}) 
    25  
     25         
    2626    return year_select+month_select+day_select; 
    2727} 
    2828 
    2929EjsView.prototype.form_tag = function(action, html_options) { 
    30  
    31  
     30                  
     31     
    3232    html_options     = html_options                     || {}; 
    3333        html_options.action = action 
     
    3636        html_options.enctype = 'multipart/form-data'; 
    3737    } 
    38  
     38     
    3939    return this.start_tag_for('form', html_options) 
    4040} 
     
    4242EjsView.prototype.form_tag_end = function() { return this.tag_end('form'); } 
    4343 
    44 EjsView.prototype.hidden_field_tag   = function(name, value, html_options) { 
    45     return this.input_field_tag(name, value, 'hidden', html_options); 
     44EjsView.prototype.hidden_field_tag   = function(name, value, html_options) {  
     45    return this.input_field_tag(name, value, 'hidden', html_options);  
    4646} 
    4747 
    4848EjsView.prototype.input_field_tag = function(name, value , inputType, html_options) { 
    49  
     49     
    5050    html_options = html_options || {}; 
    5151    html_options.id  = html_options.id  || name; 
     
    5353    html_options.type = inputType || 'text'; 
    5454    html_options.name = name; 
    55  
     55     
    5656    return this.single_tag_for('input', html_options) 
    5757} 
     
    6464    if(!name) var name = 'null'; 
    6565    if(!html_options) var html_options = {} 
    66  
     66         
    6767        if(html_options.confirm){ 
    68                 html_options.onclick = 
     68                html_options.onclick =  
    6969                " var ret_confirm = confirm(\""+html_options.confirm+"\"); if(!ret_confirm){ return false;} " 
    7070                html_options.confirm = null; 
     
    7878    if(!html_options) var html_options = {} 
    7979    html_options.onclick = html_options.onclick  || '' ; 
    80  
     80         
    8181        if(html_options.confirm){ 
    82                 html_options.onclick = 
     82                html_options.onclick =  
    8383                " var ret_confirm = confirm(\""+html_options.confirm+"\"); if(!ret_confirm){ return false;} " 
    8484                html_options.confirm = null; 
    8585        } 
    86  
     86         
    8787    html_options.value = name; 
    8888        html_options.type = 'submit' 
     
    117117EjsView.prototype.password_field_tag = function(name, value, html_options) { return this.input_field_tag(name, value, 'password', html_options); } 
    118118 
    119 EjsView.prototype.select_tag = function(name, value, choices, html_options) { 
     119EjsView.prototype.select_tag = function(name, value, choices, html_options) {      
    120120    html_options = html_options || {}; 
    121121    html_options.id  = html_options.id  || name; 
    122122    html_options.value = value; 
    123123        html_options.name = name; 
    124  
     124     
    125125    var txt = '' 
    126126    txt += this.start_tag_for('select', html_options) 
    127  
     127     
    128128    for(var i = 0; i < choices.length; i++) 
    129129    { 
     
    142142EjsView.prototype.start_tag_for = function(tag, html_options)  { return this.tag(tag, html_options); } 
    143143 
    144 EjsView.prototype.submit_tag = function(name, html_options) { 
     144EjsView.prototype.submit_tag = function(name, html_options) {   
    145145    html_options = html_options || {}; 
    146146    //html_options.name  = html_options.id  || 'commit'; 
     
    153153    if(!end) var end = '>' 
    154154    var txt = ' ' 
    155     for(var attr in html_options) { 
     155    for(var attr in html_options) {  
    156156           if(html_options[attr] != null) 
    157157        var value = html_options[attr].toString(); 
     
    161161        attr = "class"; 
    162162       if( value.indexOf("'") != -1 ) 
    163             txt += attr+'=\"'+value+'\" ' 
     163            txt += attr+'=\"'+value+'\" '  
    164164       else 
    165             txt += attr+"='"+value+"' " 
     165            txt += attr+"='"+value+"' "  
    166166    } 
    167167    return '<'+tag+txt+end; 
     
    170170EjsView.prototype.tag_end = function(tag)             { return '</'+tag+'>'; } 
    171171 
    172 EjsView.prototype.text_area_tag = function(name, value, html_options) { 
     172EjsView.prototype.text_area_tag = function(name, value, html_options) {  
    173173    html_options = html_options || {}; 
    174174    html_options.id  = html_options.id  || name; 
     
    180180        delete html_options.size 
    181181    } 
    182  
     182     
    183183    html_options.cols = html_options.cols  || 50; 
    184184    html_options.rows = html_options.rows  || 4; 
    185  
     185     
    186186    return  this.start_tag_for('textarea', html_options)+value+this.tag_end('textarea') 
    187187} 
  • branches/jsspike-20080806/microfacts/script/app/master.js

    r101 r117  
    1 var factletControllers = []; 
    2 var threadControllers = []; 
     1/* deps: app/controller, app/view, app/model */ 
    32 
    43var DEBUGLEVEL = 3; 
     
    2524} 
    2625 
    27  
    2826window.addEvent('domready', function () { 
    29      
    30     $$('.factlet').each(function (elem) { 
    31         var id = elem.get('id').split('-').at(-1); 
    32         elem.store('factlet:data', {id: id}); 
    33         factletControllers[id] = new FactletController(elem); 
    34     }); 
    35      
    36     $$('.thread').each(function (elem) { 
    37         var id = elem.get('id').split('-').at(-1); 
    38         elem.store('thread:id', id); 
    39         threadControllers[id] = new ThreadController(elem); 
    40     }); 
    41  
    42 }); 
     27    var ac = new Controller(document); 
     28}) 
  • branches/jsspike-20080806/microfacts/script/appold/controllers/deck_controller.js

    r86 r117  
     1/* deps: lib/controller */ 
    12var DeckController = new Class({ 
    23    Extends: Controller, 
  • branches/jsspike-20080806/microfacts/script/appold/controllers/factlet_controller.js

    r86 r117  
     1/* deps: lib/controller, lib/extensions, app/models/factlet */ 
    12var FactletController = new Class({ 
    23    Extends: Controller, 
  • branches/jsspike-20080806/microfacts/script/appold/controllers/factlet_info_controller.js

    r100 r117  
     1/* deps: lib/controller, app/models/factlet */ 
    12var FactletInfoController = new Class({ 
    23    Extends: Controller, 
  • branches/jsspike-20080806/microfacts/script/appold/controllers/factlet_search_controller.js

    r88 r117  
     1/* deps: lib/controller, lib/extensions */ 
    12var FactletSearchController = new Class({ 
    23    Extends: Controller, 
  • branches/jsspike-20080806/microfacts/script/appold/controllers/thread_controller.js

    r103 r117  
     1/* deps: lib/controller, lib/microfactsdeck, app/models/thread, app/controllers/deck_controller, app/controllers/factlet_info_controller, app/controllers/factlet_search_controller, app/controllers/thread_timeline_controller */ 
    12var ThreadController = new Class({ 
    23    Extends: Controller, 
  • branches/jsspike-20080806/microfacts/script/appold/controllers/thread_timeline_controller.js

    r103 r117  
     1/* deps: lib/controller, lib/timeline */ 
    12var ThreadTimelineController = new Class({ 
    23    Extends: Controller, 
  • branches/jsspike-20080806/microfacts/script/appold/master.js

    r101 r117  
     1/* deps: app/controllers/factlet_controller, app/controllers/thread_controller, lib/extensions */ 
     2 
    13var factletControllers = []; 
    24var threadControllers = []; 
     
    2527} 
    2628 
    27  
    2829window.addEvent('domready', function () { 
    2930     
  • branches/jsspike-20080806/microfacts/script/lib/deck.js

    r80 r117  
     1/* deps: lib/extensions */ 
    12var Deck = new Class({ 
    23    Implements: [Options, Events], 
  • branches/jsspike-20080806/microfacts/script/lib/microfactsdeck.js

    r70 r117  
     1/* deps: lib/deck */ 
    12var MicroFactsDeck = new Class({ 
    23    Extends: Deck 
  • branches/jsspike-20080806/microfacts/script/spec/jsspec/JSSpec.css

    r52 r117  
    2121  margin: 0; 
    2222  position: absolute; 
    23   top: 0px; 
     23  top: 0px;     
    2424  left: 0px; 
    2525  width: 100%; 
     
    3131  padding: 0; 
    3232  margin: 0; 
    33   position: absolute; 
     33  position: absolute;     
    3434  top: 40px; 
    3535  left: 0px; 
    3636  bottom: 0px; 
    37   overflow: auto; 
    38   width: 250px; 
     37  overflow: auto;     
     38  width: 250px;     
    3939  _height:expression(document.body.clientHeight-40); 
    4040} 
     
    4343  padding: 0; 
    4444  margin: 0; 
    45   position: absolute; 
     45  position: absolute;     
    4646  top: 40px; 
    4747  left: 250px; 
  • branches/jsspike-20080806/microfacts/script/spec/jsspec/JSSpec.js

    • Property svn:executable deleted
    r52 r117  
    3232var JSSpec = { 
    3333        specs: [], 
    34  
     34         
    3535        EMPTY_FUNCTION: function() {}, 
    36  
     36         
    3737        Browser: { 
    3838                Trident: navigator.appName == "Microsoft Internet Explorer", 
     
    5252        this.onSuccess = typeof onSuccess == 'function' ? onSuccess : JSSpec.EMPTY_FUNCTION; 
    5353        this.onException = typeof onException == 'function' ? onException : JSSpec.EMPTY_FUNCTION; 
    54  
     54         
    5555        if(JSSpec.Browser.Trident) { 
    5656                // Exception handler for Trident. It helps to collect exact line number where exception occured. 
     
    6363                                delete JSSpec._secondPass; 
    6464                                delete JSSpec._assertionFailure; 
    65  
     65                                 
    6666                                ex.type = "failure"; 
    6767                                self.onException(self, ex); 
     
    7272                                self.onException(self, ex); 
    7373                        } 
    74  
     74                         
    7575                        return true; 
    7676                }; 
     
    8383                lineNumber:normalException.lineNumber 
    8484        }; 
    85  
     85         
    8686        return merged; 
    8787}; 
     
    9292        var onSuccess = this.onSuccess; 
    9393        var onException = this.onException; 
    94  
     94         
    9595        window.setTimeout( 
    9696                function() { 
     
    9898                        if(JSSpec.Browser.Trident) { 
    9999                                window._curExecutor = self; 
    100  
     100                                 
    101101                                result = self.target(); 
    102102                                self.onSuccess(self, result); 
     
    107107                                } catch(ex) { 
    108108                                        if(JSSpec.Browser.Webkit) ex = {message:ex.message, fileName:ex.sourceURL, lineNumber:ex.line}; 
    109  
     109                                         
    110110                                        if(JSSpec._secondPass)  { 
    111111                                                ex = self.mergeExceptions(JSSpec._assertionFailure, ex); 
    112112                                                delete JSSpec._secondPass; 
    113113                                                delete JSSpec._assertionFailure; 
    114  
     114                                                 
    115115                                                ex.type = "failure"; 
    116116                                                self.onException(self, ex);