Changeset 9364

Show
Ignore:
Timestamp:
07/04/08 17:37:55 (2 months ago)
Author:
stefano
Message:

- added the ability to show the underlying json data from the exhibit builder (this is mostly useful for development purposes and should be turned off in production)
- lots of polish on the exhibit builder
- fixed the disconnect between the two metadata subsystems that we used (now everything works of off the exhibit-builder settings)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • playground/trunk/modules/APIs/jsmath/easy/load.js

    r9363 r9364  
    9898  //   
    9999  //loadFiles: ["plugins/tex2math.js"], 
     100  loadFiles: [], 
    100101   
    101102  // 
  • playground/trunk/modules/citeline/MOD-INF/builder.js

    r9363 r9364  
    1919        var method = request.getMethod(); 
    2020                 
    21         if (method == "GET") { 
     21        if (method == "HEAD") { 
     22            execute2(request, response, function(temp) { 
     23                var exists = repository.exists(id,temp); 
     24                if (exists) { 
     25                    butterfly.sendString(request, response, "", "UTF-8", "text/html"); 
     26                } else { 
     27                    butterfly.sendError(request, response, 401, "Not Authorized"); 
     28                } 
     29            }); 
     30        } else if (method == "GET") { 
    2231            if (action == "editable") { 
    2332                var template = request.getParameter("template"); 
    2433                var title; 
    25                 var format; 
     34                var settings; 
     35                 
    2636                execute2(request, response, function(temp) { 
    27                     title = repository.getProperty(id, temp, "title"); 
    28                     format = repository.getProperty(id, temp, "original-format"); 
     37                    settings = repository.getMetadata(id, temp); 
     38                    if (settings && settings.settableTexts) { 
     39                        title = settings.settableTexts["the-title"].text; 
     40                    } 
    2941                    if (template == null || template == "") { 
    30                         template = repository.getProperty(id, temp, "template"); 
    31                     } 
    32                 }); 
     42                        template = settings.template; 
     43                    } 
     44                }); 
     45                 
    3346                title = (title != null && title != "") ? title : "Untitled Exhibit"; 
    3447                template = (template != null && template != "") ? template : default_template; 
     
    4861 
    4962            } else if (action == "info") { 
    50                 var data = getInfo(request, response); 
    51                 var format; 
    5263                execute2(request, response, function(temp) { 
    53                     data.template = repository.getProperty(data.active_playground, temp, "template"); 
    54                     format = repository.getProperty(data.active_playground, temp, "original-format"); 
    55                 }); 
    56                 if (!("template" in data) || data.template == null || data.template == "") { 
    57                     data.template = default_template; 
    58                 } 
    59                  
    60                 butterfly.sendJSON(request, response, data); 
     64                    var data = getInfo(request, response); 
     65                    var template = repository.getProperty(data.active_playground, temp, "template"); 
     66                    data.template = (template) ? template : default_template; 
     67                    butterfly.sendJSON(request, response, data); 
     68                }); 
    6169            } else if (action == "metadata") { 
    6270                execute(request, response, function(verifiedID) { 
     
    8896                    } 
    8997                }); 
     98 
     99            } else if (action == "facets.json") { 
     100                getPlayground(id, "facet-map",request,response); 
    90101            } else if (action == "data.json") { 
    91102                getPlayground(id, "json",request,response); 
     
    97108                }); 
    98109             
     110            } else if (action == "json_viewer.html") { 
     111                butterfly.sendText(request, response, "json_viewer.html", "UTF-8", "text/html"); 
     112                 
    99113            } else if (action == "__history__.html") { 
    100114                butterfly.sendString(request, response, "<html><body></body></html>", "UTF-8", "text/html"); 
     
    110124                execute2(request, response, function(temp) { 
    111125                        settings = repository.getMetadata(id, temp); 
    112                     title = settings.title; 
    113                     format = settings.original-format; 
     126                    title = settings.settableTexts["the-title"].text; 
    114127                    template = settings.template; 
    115128                    content = repository.readFile(id, temp, "json"); 
     
    194207            }); 
    195208 
    196         } 
     209        }  
    197210     
    198211    } 
  • playground/trunk/modules/citeline/MOD-INF/main.js

    r9363 r9364  
    179179        while (results && results.hasNext()) { 
    180180            var s = results.next(); 
    181             var uri = s.getObject().toString(); 
    182             var pgProps = triplestore.getAll(uri, null, null); 
     181            var id = s.getObject().toString().substring(10); 
     182            butterfly.log("id: " + id); 
    183183            var props = {}; 
    184             while (pgProps && pgProps.hasNext()) { 
    185                 var p = pgProps.next(); 
    186                 var pred = p.getPredicate().toString(); 
    187                 var value = p.getObject().toString(); 
    188                 props[pred.substring(7)] = value; 
     184            var metadata = repository.getMetadata(id, true); 
     185            if (metadata) { 
     186                props.title = metadata.settableTexts["the-title"].text; 
     187                props.created = metadata.created; 
    189188            } 
    190189            playgrounds[uri.substring(10)] = props; 
     
    206205    var uri = "urn:pg:pg:" + pg; 
    207206    triplestore.add(accountURI, "urn:pg:owns", uri); 
    208     for (property in metadata) { 
    209         triplestore.add(uri, "urn:pg:" + property, metadata[property], true); 
    210     } 
    211207    cache.remove(accountURI,"playgrounds"); 
    212208    getPlaygrounds(accountURI); // re-populate the cache 
  • playground/trunk/modules/citeline/index.html

    r9363 r9364  
    33 
    44<head> 
    5  <title>MIT Libraries | Citeline</title> 
     5 
     6<!--+ 
     7    | Citeline - An exhibit authoring system for citation collections 
     8    | 
     9    | Stefano Mazzocchi <stefanom@mit.edu> 
     10    | David Huynh <dfhuynh@csail.mit.edu> 
     11    | Ryan Lee <ryanlee@csail.mit.edu> 
     12    | 
     13    +--> 
     14 
     15 <title>Citeline</title> 
    616  
    717 <link type="text/css" rel="stylesheet" href="[#skin#]/reset.css" media="screen"/> 
    8  <link type="text/css" rel="stylesheet" href="styles/style.css" media="screen"/> 
     18 <link type="text/css" rel="stylesheet" href="styles/structure.css" media="screen"/> 
    919 <link type="text/css" rel="stylesheet" href="[#skin#]/style.css" media="screen"/> 
    1020  
     
    1222 <script type="text/javascript" src="scripts/utils.js"></script> 
    1323 <script type="text/javascript" src="scripts/client.js"></script> 
     24  
     25 <noscript> 
     26  <p>Sorry, but <a href="http://simile.mit.edu/wiki/Citeline">Citeline</a> needs a browser that supports Javascript scripting.</p> 
     27 </noscript> 
     28  
    1429</head> 
    1530 
    1631<body> 
    1732 
     33 <div id="top"></div> 
     34 
    1835 <div id="header"> 
    19   <div id="logo"></div> 
     36  <div id="logo"><a href="http://libraries.mit.edu/"><img src="[#skin#]/images/library_logo.png"/></a></div> 
    2037  <div id="title"></div> 
    2138 </div> 
    22   
     39          
    2340 <div id="path"> 
    24    <span><a href="../">Citeline</a></span> &raquo <span id="current"></span> 
     41  <div class="authenticated auth_exhibit_builder anon_exhibit_builder pane"> 
     42   <table class="wide"> 
     43    <tr> 
     44     <td align="left" width="25%"> 
     45      <span class="auth_exhibit_builder pane"><a title="My Exhibits" class="my_exhibits action">My Exhibits</a></span><span>&nbsp;</span> 
     46     </td> 
     47     <td align="center" style="font-size: 90%" width="50%"> 
     48      <a href="http://simile.mit.edu/wiki/Citeline_User%27s_Guide" target="_blank">Help</a> | <a href="mailto:citeline-lib@mit.edu" title="Contact us for assistance">Contact Us for Assistance</a> 
     49     </td> 
     50     <td align="right" width="25%"> 
     51      <div class="anon_exhibit_builder pane"><a title="Sign In" class="signin action">Sign In and Claim Your Exhibit</a></div> 
     52      <div class="authenticated auth_exhibit_builder pane"><a title="Sign Out" class="signout action">Sign Out</a></div> 
     53     </td> 
     54    </tr> 
     55   </table> 
     56  </div> 
    2557 </div> 
    26          
    27  <div id="signout">Sign Out &raquo;</div> 
    2858  
    2959 <div id="body"> 
    3060 
    3161  <!-- ============== Anonymous Main Pane =================== --> 
    32    
    33   <div id="anonymous" class="pane"> 
    34     <p class="first centered short">Welcome to the <strong>Citeline</strong>, a service to facilitate the publishing on the web of bibliographies and citation collections as interactive <a href="http://simile.mit.edu/exhibit/">exhibits</a> and facilitate the sharing of this data.</p> 
     62 
     63  <div class="anonymous pane"> 
     64    <p class="first centered short">Welcome to <strong>Citeline</strong>, a service to facilitate the web publishing of bibliographies and citation collections as interactive <em>exhibits</em> and facilitate the sharing of this type of data.</p> 
    3565    <p class="centered">Here are some of our featured interactive publication exhibits:</p> 
    3666 
    37     <table style="margin: 2em auto"><tbody><tr> 
     67    <table style="margin: 2em auto;"> 
     68      <tr> 
    3869        <td align="center"> 
    3970            <div class="thumbnail"><a title="David Karger's Bibliography" href="http://simile.mit.edu/citeline/240c8e56a51e83b58424371353c30608dfbe8ed4/"><img height="126px" width="150px" class="reflect" src="images/exhibit4.png"/></a></div> 
     
    4475            <div><a href="http://erikdemaine.org/">Erik Demaine</a>'s Selected Publications<br/>317 publications</div> 
    4576        </td> 
    46     </tr></tbody></table> 
    47  
    48     <table> 
     77      </tr> 
     78    </table> 
     79 
     80    <table class="spaced"> 
    4981     <tr> 
    5082      <td> 
     
    5385         <div class="label">Make your own exhibit from a <a href="http://en.wikipedia.org/wiki/BibTeX">BibTeX</a> file:</div> 
    5486         <div><input class="input" type="file" name="file" size="20"/></div> 
    55          <div class="submit"><a class="action" id="upload_submit">Make your exhibit</a></div> 
    56          <p class="output error" style="display: none">Please, select a BibTEX file to upload.</p> 
     87         <div class="submit"><a class="upload action">Make your exhibit</a></div> 
     88         <p class="output error">Please, select a BibTEX file to upload.</p> 
    5789        </form> 
    5890       </div> 
     
    6294       <div id="signin"> 
    6395        <div>Manage your existing exhibits.</div> 
    64         <div><a title="Sign In" id="sign_in_link" class="action">Sign In</a></div> 
     96        <div><a title="Sign In" class="signin action">Sign In</a></div> 
    6597       </div> 
    6698      </td> 
    6799     </tr> 
    68100    </table> 
    69      
    70     <p class="centered">Don't have a BibTeX file? No worries, <a title="Where do I get a BibTEX file?" href="http://simile.mit.edu/wiki/Citeline_FAQ#Where_do_I_get_a_BibTeX_file.3F">we can help</a>.</p> 
     101 
     102    <p class="centered" style="margin: 1em;"> 
     103      <a title="Where do I get a BibTEX file?" href="http://simile.mit.edu/wiki/Citeline_FAQ#Where_do_I_get_a_BibTeX_file.3F" style="margin-right: 2em">How to create a BibTeX file &raquo;</a> 
     104      <a title="Citeline User's Guide" href="http://simile.mit.edu/wiki/Citeline_User%27s_Guide">Citeline User's Guide &raquo;</a> 
     105    </p> 
    71106 
    72107    <div id="zotero" class="boxed centered"> 
    73      <p><img src="images/zotero.png"/> user?</p> 
     108     <p><a href="http://www.zotero.org/" title="Zotero"><img src="images/zotero.png"/></a> user?</p> 
    74109     <p>Install <a href="http://simile.mit.edu/dist/zotz/zotz.xpi">our Zotz add-on</a> and build your citation publication directly from Zotero. Learn <a href="http://simile.mit.edu/wiki/Citeline_FAQ#How_do_I_use_Citeline_from_Zotero.3F">how</a>.</p> 
    75110    </div> 
     
    78113  <!-- ============== Authenticated Main Pane =================== --> 
    79114 
    80   <div id="authenticated" class="pane"> 
     115  <div class="authenticated pane" style="margin: 1em;"> 
    81116    <h1>My Exhibits</h1> 
     117    <div class="message" style="margin: 2em;"> 
     118     <p>You currently don't have any exhibit associated with this account.</p> 
     119     <p>Use the form below to create one.</p> 
     120    </div> 
    82121    <ul></ul> 
    83     <div style="margin-top: 2em;" class="centered"> 
     122    <div style="margin-top: 4em;" class="centered"> 
    84123     <form name="new" action="add_data" method="post" enctype="multipart/form-data" accept-charset="UTF-8"> 
    85124      <div class="label">Make a new exhibit from a <a href="http://en.wikipedia.org/wiki/BibTeX">BibTeX</a> file:</div> 
    86125      <div><input class="input" type="file" name="file" size="20"/></div> 
    87       <div class="submit"><a class="action" id="new_submit">Make a new exhibit</a></div> 
     126      <div class="submit"><a class="upload action">Make a new exhibit</a></div> 
     127      <p class="output error">Please, select a BibTEX file to upload.</p> 
    88128     </form> 
    89129    </div> 
     
    92132  <!-- ============== Exhibit Pane ============================== --> 
    93133 
    94   <div id="exhibit_builder" class="pane"> 
    95         <table id="main-control-panel" width="100%"> 
    96           <tr> 
    97             <td align="left"> 
    98               <input id="delete" type="button" value="Delete this Exhibit"> 
    99             </td> 
    100             <td align="center"> 
    101                 <span>Style</span><br/> 
    102                 <select onchange="switchTemplate();" id="template-select"> 
    103                     <option value="bibtex-classic">Classic</option> 
    104                     <option value="bibtex-clean">Clean</option> 
    105                     <option value="bibtex-bookworm">Bookworm</option> 
    106                     <option value="bibtex-dark">Dark</option> 
    107                     <option value="bibtex-basic">Basic</option> 
    108                     <option value="bibtex-essential">Essential</option> 
    109                 </select> 
    110             </td> 
    111             <td align="right"> 
    112                 <a id="public" target="_blank">view public version &raquo;</a><br/> 
    113                 <a id="download" target="_blank">download &raquo;</a> 
    114             </td> 
    115           </tr> 
    116         </table> 
    117      
    118         <iframe id="exhibit-container"></iframe> 
     134  <div class="auth_exhibit_builder anon_exhibit_builder pane"> 
     135    <table id="exhibit_controls" class="wide spaced" style="margin-bottom: 0.5em"> 
     136      <tr> 
     137        <td align="left" width="40%"> 
     138          <input class="delete" type="button" value="Delete this Exhibit"> 
     139          <input class="show_settings hidden" type="button" value="Show Data"> 
     140          <input class="hide_settings hidden" type="button" value="Hide Data"> 
     141        </td> 
     142        <td align="center" width="20%"> 
     143            <span>Style:</span> 
     144            <select id="template-select"> 
     145                <option value="bibtex-classic">Classic</option> 
     146                <option value="bibtex-clean">Clean</option> 
     147                <option value="bibtex-bookworm">Bookworm</option> 
     148                <option value="bibtex-dark">Dark</option> 
     149                <option value="bibtex-basic">Basic</option> 
     150                <option value="bibtex-essential">Essential</option> 
     151            </select> 
     152        </td> 
     153        <td align="right" width="40%"> 
     154            <a class="public" target="_blank">preview</a> | <a class="download" target="_blank">download</a> 
     155        </td> 
     156      </tr> 
     157    </table> 
     158 
     159    <table class="wide"> 
     160     <tr> 
     161      <td style="vertical-align: top" class="nopadding"><iframe id="exhibit-container"></iframe></td> 
     162      <td class="nopadding hidden" id="exhibit-metadata-holder" style="vertical-align: top; padding-left: 0.5em"> 
     163        <iframe id="exhibit-metadata-container"></iframe> 
     164        <div id="exhibit-metadata-selector" style="text-align: right; margin-top: 0.5em;">Data: <select> 
     165           <option value="metadata">Settings</option> 
     166           <option value="facets.json">Facets</option> 
     167           <option value="data.json">Data</option> 
     168        </select></div> 
     169      </td> 
     170     </tr> 
     171    </table> 
     172        
    119173  </div>  
    120  
    121  </div> <!-- end of div#body --> 
     174  
     175 </div> 
    122176  
    123177 <div id="footer"> 
     
    126180 
    127181 <div id="info"></div> 
    128  
    129  
    130  
    131182 
    132183 
     
    236287    <p>We're terribly sorry but an error occurred within the application that prevented  
    237288    it from completing the action that you requested.</p> 
    238     <p>This error has been already reported to the application maintenance crew  
     289    <p>This error has been already automatically reported to the maintenance crew  
    239290    that will try to diagnose and correct the problem as soon as possible.</p> 
    240291    <p>You can either try again and see if the error was temporary, or come back later. 
  • playground/trunk/modules/citeline/scripts/client.js

    r9363 r9364  
    33 */ 
    44 
    5 var debug = true; 
     5var show_data = true; 
     6var show_info = false; 
    67 
    78var min_latency = 300; 
     
    7879function reveal(pane) { 
    7980    var callback = function() { 
    80         current_pane = $("#" + pane).fadeIn(50); 
     81        current_pane = $("." + pane).fadeIn(50); 
    8182    } 
    8283    if (current_pane) { 
     
    133134        } 
    134135 
    135         if (debug) { 
     136        if (show_info) { 
    136137            var infoDiv = $("#info"); 
    137138            infoDiv.setTemplate("<div>Latency: {$T.latency}ms</div>" 
     
    156157                }); 
    157158            }).fadeIn(80); 
    158             $("#debug").fadeIn(80); 
    159159        } 
    160160    }, 
     
    164164            load("authenticated"); 
    165165        } else { 
    166             if ($.info.active_playground) { 
    167                 load("exhibit_builder"); 
    168             } else { 
    169                 $("#sign_in_link").click(signIn); 
     166            var ifExisting = function() { 
     167                load("anon_exhibit_builder"); 
     168            } 
     169                 
     170            var ifNot = function() { 
     171                removeActiveExhibit();                 
     172                $(".signin").click(signIn); 
    170173                $('img.reflect').reflect( { 
    171174                    height: 0.3, 
     
    175178                reveal("anonymous"); 
    176179            } 
     180             
     181            focusOnActiveExhibit(ifExisting,ifNot); 
    177182        } 
    178183    }, 
     
    182187            load("anonymous"); 
    183188        } else { 
    184             $("#signout").click(signOut).fadeIn(300); 
    185             if ($.info.active_playground) { 
    186                 load("exhibit_builder"); 
    187             } else { 
    188                 prepareUpload("new", "new_submit"); 
     189            var ifExisting = function() { 
     190                load("auth_exhibit_builder"); 
     191            } 
     192                 
     193            var ifNot = function() { 
     194                removeActiveExhibit();                 
     195                $(".signout").click(signOut); 
    189196                $.getJSON("playgrounds", 
    190197                    function(pgs) { 
    191                         var pane = $("#authenticated"); 
     198                        var pane = $(".authenticated"); 
    192199                        var list = pane.find("ul").html(""); 
    193200                        var found = false; 
    194                         for ( var pg in pgs) { 
     201                        for (var pg in pgs) { 
    195202                            var data = pgs[pg]; 
     203                            var title = data. 
    196204                            var title = (!data.title) ? '[untitled]' : data.title; 
    197                             list.append("<li><a href='" + pg + "/'>" + title + "</a></li>"); 
     205                            list.append("<li><a class='action' title='" + title + "'>" + title + "</a></li>").find("a").click( function () { 
     206                                setActiveExhibit(pg); 
     207                                load("auth_exhibit_builder"); 
     208                            }); 
    198209                            found = true; 
    199210                        } 
    200211                        if (!found) { 
    201                             list.html("<p>You have no exhibits associated with this account.</p>"); 
     212                            pane.find(".message").fadeIn(200); 
    202213                        } 
    203214                }); 
     215                prepareUpload("new", "new_submit"); 
    204216                reveal("authenticated"); 
    205217            } 
     218              
     219            focusOnActiveExhibit(ifExisting,ifNot); 
    206220        } 
    207221    }, 
    208222 
    209     exhibit_builder: function() { 
    210         log("init exhibit_builder"); 
    211          
    212         var resizeExhibit = function() { 
    213             var elmt = $("#exhibit-container")[0]; 
    214             //elmt.style.width = (window.innerWidth - 40) + "px"; 
    215             elmt.style.height = (window.innerHeight - 100) + "px"; 
    216         } 
    217          
    218         $(window).bind("resize", resizeExhibit); 
    219  
    220         reveal("exhibit_builder"); 
    221  
    222         instrumentExhibitBuilder(); 
    223          
    224         var formElement = $("#delete").click( function() { 
    225             if (confirm("Are you sure you want to delete this exhibit?")) { 
    226                 $.ajax( { 
    227                     type: "delete", 
    228                     url: $.info.active_playground + "/", 
    229                     error: error, 
    230                     success: function(data) { 
    231                         $.cookie('apg', null, { path :'/' }); 
    232                         redirect(''); 
    233                     } 
    234                 }); 
    235             } 
    236         }); 
    237  
    238         $("#template-select").change(switchTemplate); 
    239          
    240         $("#exhibit-container")[0].src = $.info.active_playground + "/editable"; 
    241          
    242         resizeExhibit(); 
     223    auth_exhibit_builder: function() { 
     224        if (!authenticated()) { 
     225            load("anon_exhibit_builder"); 
     226        } else { 
     227            initExhibitBuilder("auth_exhibit_builder"); 
     228            $(".my_exhibits").click(function() { 
     229                removeActiveExhibit(); 
     230                load("authenticated"); 
     231            }); 
     232        } 
    243233    }, 
    244234 
     235    anon_exhibit_builder: function() { 
     236        if (authenticated()) { 
     237            load("auth_exhibit_builder"); 
     238        } else { 
     239            initExhibitBuilder("anon_exhibit_builder"); 
     240        } 
     241    }, 
     242     
    245243    sign_up: function() { 
    246244        passwordHandler("signup"); 
     
    256254 
    257255// -------------------------------------------------- 
     256 
     257function focusOnActiveExhibit(ifExisting, ifNot) { 
     258    if ($.info.active_playground) { 
     259        $.ajax({ 
     260            type: "HEAD", 
     261            url: $.info.active_playground + "/", 
     262            success: ifExisting, 
     263            error: ifNot 
     264        }); 
     265    } else { 
     266        ifNot(); 
     267    } 
     268} 
    258269 
    259270function prepareUpload(form, action) { 
     
    266277            var ready = (str != "file="); 
    267278            if (!ready) { 
    268                 var dialog = formElement.find(".output:eq(0)").show(); 
     279                var dialog = formElement.find(".output").show(); 
    269280                setTimeout( function() { 
    270281                    dialog.fadeOut(1000); 
     
    285296    }); 
    286297     
    287     $('#' + action).click( function() { 
    288         $("form[@name='" + form + "']").submit(); 
    289     }); 
    290  
     298    formElement.find('.upload').click( function() { 
     299        formElement.submit(); 
     300    }); 
     301     
     302    formElement.find('.output').hide(); 
     303
     304 
     305function initExhibitBuilder(paneName) { 
     306    $(window).bind("resize", onResize); 
     307 
     308    $(".signin").click(signIn); 
     309     
     310    var pane = $("." + paneName); 
     311    pane.find("a.public").mouseover(function() { 
     312        $(this).attr("href", $.info.active_playground + "/" + encode(getTitle()) + ".html"); 
     313    }).mouseover(); 
     314    pane.find("a.download").mouseover(function() { 
     315        $(this).attr("href", $.info.active_playground + "/" + encode(getTitle()) + ".html?mode=download"); 
     316    }).mouseover(); 
     317     
     318    var formElement = $(".delete").click( function() { 
     319        if (confirm("Are you sure you want to delete this exhibit?")) { 
     320            $.ajax( { 
     321                type: "delete", 
     322                url: $.info.active_playground + "/", 
     323                error: error, 
     324                success: function(data) { 
     325                    removeActiveExhibit(); 
     326                    load(''); 
     327                } 
     328            }); 
     329        } 
     330    }); 
     331     
     332    $("#template-select").change(function () { 
     333        var newTemplate = $(this)[0].value; 
     334        if (newTemplate != $.info.template) { 
     335            $("#exhibit-container")[0].contentWindow.saveTemplateSettings( function() { 
     336                $.post($.info.active_playground + "/template", { 
     337                    "pg": $.info.active_playground, 
     338                    "template": newTemplate 
     339                }, function() { 
     340                    $.info.template = newTemplate; 
     341                    $("#exhibit-container")[0].src = $.info.active_playground + "/editable?template=" + $.info.template; 
     342                }); 
     343            }); 
     344        } 
     345    }); 
     346     
     347    $("#exhibit-container")[0].src = $.info.active_playground + "/editable"; 
     348 
     349    if (show_data) { 
     350        $(".show_settings").click( function() { 
     351            $("#exhibit-metadata-holder").show()[0].style.width = "30%"; 
     352            $("#exhibit-metadata-container")[0].src = $.info.active_playground + "/json_viewer.html?data=metadata"; 
     353            $(this).hide(); 
     354            $(".hide_settings").show(); 
     355            onResize(); 
     356        }).show(); 
     357 
     358        $(".hide_settings").click( function() { 
     359            $("#exhibit-metadata-holder").hide()[0].style.width = "0%"; 
     360            $(this).hide() 
     361            $(".show_settings").show(); 
     362        }).hide(); 
     363 
     364        $("#exhibit-metadata-holder select").change(function() { 
     365            var newMetadata = $(this)[0].value; 
     366            $("#exhibit-metadata-container")[0].src = $.info.active_playground + "/json_viewer.html?data=" + newMetadata; 
     367        })[0].selectedIndex = 0; 
     368         
     369        $("#exhibit-container").bind("load", function() { 
     370            var exhibit = $(this)[0].contentWindow; 
     371            var oldSavingFunction = exhibit.saveTemplateSettings; 
     372            exhibit.saveTemplateSettings = function(f) { 
     373                oldSavingFunction(f); 
     374                setTimeout(function() { 
     375                    $("#exhibit-metadata-container")[0].contentWindow.location.reload(); 
     376                },500); 
     377            }; 
     378        }); 
     379    } 
     380     
     381    reveal(paneName); 
     382     
     383    onResize(); 
     384
     385 
     386function onResize() { 
     387    var total = window.innerHeight; 
     388     
     389    var space =  $("#header").outerHeight({ margin: true }) +  
     390                 $("#path").outerHeight({ margin: true }) +  
     391                 $("#exhibit_controls").outerHeight({ margin: true }) + 
     392                 $("#footer").outerHeight({ margin: true });  
     393     
     394    resizeIframes(total - space - 2); // 2 is the iframe border 
     395
     396 
     397function resizeIframes(h) { 
     398    var selector = $("#exhibit-metadata-selector").outerHeight({ margin: true }); 
     399    $("#exhibit-metadata-container").height(h - selector);  
     400    $("#exhibit-container").height(h);  
     401
     402 
     403function encode(str) { 
     404    return encodeURI(str.toLowerCase().replace(/\s/g,'_')); 
     405
     406 
     407function getTitle() { 
     408    var iframe = $("#exhibit-container")[0].contentWindow; 
     409    var title = "Untilted Exhibit"; 
     410    if (iframe.getSettings) { 
     411        var settings = iframe.getSettings(); 
     412        if (settings && settings.settableTexts) { 
     413            title = settings.settableTexts["the-title"].text; 
     414        } 
     415    } 
     416    return title; 
    291417} 
    292418 
     
    296422} 
    297423 
    298 function saveSettings() { 
    299     $("#exhibit-container")[0].contentWindow.saveTemplateSettings(); 
    300 
    301  
    302 function encode(str) { 
    303     return encodeURI(str.toLowerCase().replace(/\s/g,'_')); 
    304 
    305  
    306 function instrumentExhibitBuilder() { 
    307     var filename = $.info.title ? encode($.info.title) : "untitled_exhibit" ; 
    308     var playgroundURL = $.info.active_playground + "/"; 
    309     var exhibitURL = playgroundURL + filename + ".html"; 
    310     $("#public").attr("href", exhibitURL); 
    311     $("#download").attr("href", exhibitURL + "?mode=download"); 
    312 
    313  
    314 function switchTemplate() { 
    315     var newTemplate = $("#template-select")[0].value; 
    316     log("new template: " + newTemplate); 
    317     if (newTemplate != $.info.template) { 
    318         $("#exhibit-container")[0].contentWindow.saveTemplateSettings( function() { 
    319             $.post("template", { 
    320                 "pg": $.info.active_playground, 
    321                 "template": newTemplate 
    322             }, function() { 
    323                 $.info.template = newTemplate; 
    324                 $("#exhibit-container")[0].src = $.info.active_playground + "/editable?template=" + $.info.template; 
    325             }); 
    326         }); 
    327     } 
    328     saveSettings(); 
    329     instrumentExhibitBuilder(); 
     424function removeActiveExhibit() { 
     425    delete $.info.active_playground; 
     426    $.cookie('apg', null, { path :'/' }); 
    330427} 
    331428 
  • playground/trunk/modules/citeline/scripts/exhibit-builder/urls.js

    r9363 r9364  
    1717        } 
    1818}; 
     19 
     20var Views = { 
     21        toString: function() { 
     22            return "<option value='Timeline'>Timeline</option>"; 
     23        } 
     24} 
  • playground/trunk/modules/citeline/styles/structure.css

    r9363 r9364  
    3737} 
    3838 
    39 table { 
    40     margin: 1em auto; 
    41 
    42  
    43 table td { 
     39table.spaced { 
     40        margin: 1em auto; 
     41
     42 
     43table.wide { 
     44    width: 100%; 
     45
     46 
     47td { 
    4448   padding: 0em 0.5em; 
    4549} 
    4650 
     51td.wide { 
     52    width: 100%; 
     53} 
     54 
     55td.nopadding { 
     56    padding: 0px; 
     57} 
     58                 
    4759li { 
    4860    padding: 0.5em 0 0 1em; 
     
    5163p { 
    5264    padding: 0.5em 0; 
     65} 
     66 
     67iframe { 
     68    width: 100%; 
    5369} 
    5470 
     
    169185/* ------------------------------- misc ------------------------------------- */ 
    170186 
     187.hidden { 
     188        display: none; 
     189} 
     190 
    171191.short { 
    172192    margin: 0 15%; 
     
    213233} 
    214234 
     235.message { 
     236        display: none; 
     237} 
     238 
    215239/* ----------------------------------------------------- */ 
     240 
     241#top { 
     242    position: absolute; 
     243    top: 0px; 
     244    left: 0px; 
     245    width: 100%; 
     246} 
     247                 
     248#path { 
     249} 
    216250 
    217251#body { 
     
    221255#footer { 
    222256        margin-top:     10px; 
    223     padding:        20px; 
    224     padding-bottom: 100px; 
     257    padding:        10px; 
    225258    text-align:     center; 
    226259    font-size:      90%; 
     
    237270}     
    238271 
    239 #path { 
    240         display: none; 
    241         position: absolute; 
    242         top: 10px; 
    243         left: 10px; 
    244 } 
    245  
    246272#debug { 
    247273    display: none; 
     
    251277    width: 150px; 
    252278} 
     279 
  • playground/trunk/modules/playground/MOD-INF/exhibit-builder/edit-mode-composition.vt

    r9363 r9364  
    2626    <link type="text/css" rel="stylesheet" href="[#skin#]/exhibit-builder-base.css" media="screen"> 
    2727    <link type="text/css" rel="stylesheet" href="[#skin#]/exhibit-builder.css" media="screen"> 
    28      
     28         
    2929    <style> 
    3030        #parse($styles) 
  • playground/trunk/modules/playground/scripts/exhibit-builder/facet-region.js

    <
    r8768 r9364  
    3030        "div", 
    3131        "<div class='playground-exhibitBuilder-facetRegion-controls-section'>" + 
    32             "<div>Add Simple Facet:</div>" + 
     32            "<div>Add Facet:</div>" + 
    3333            "<div>" + 
    3434                "<select id='simpleFacetSelect'>" + 
    35                     "<option value=''>--add a simple facet--</option>" + 
     35                    "<option value=''>--add facet--</option>" + 
    3636                    "<option value='*text-search*'>text search</option>" + 
    3737                "</select>" + 
     
    183183    this._justConstructFacet(configuration, index); 
    184184    this._settings.facets.splice(index, 0, configuration); 
     185    setTimeout(saveTemplateSettings,100);