Ticket #7309: trac_7309-javascript-sage_v2.patch

File trac_7309-javascript-sage_v2.patch, 8.9 KB (added by mpatel, 11 years ago)

Fix TinyMCE init URL. See comment. Apply only this patch. Apply to sagenb repository.

  • sagenb/data/sage/html/notebook/head.tmpl

    # HG changeset patch
    # User Tim Dumol <tim@timdumol.com>
    # Date 1256563466 -28800
    # Node ID cf8dbe632e58b334acc126c040eb8c89bcb683dc
    # Parent  6486b05dd7484339a7ed4fa4ad37a50c6947d3de
    #7309 SageNB - Restructure /javascript/ to have /javascript/sage/. Tim Dumol.
    
    diff --git a/sagenb/data/sage/html/notebook/head.tmpl b/sagenb/data/sage/html/notebook/head.tmpl
    a b INPUT: 
    2626<!-- jQuery - general-purpose functions -->
    2727<script type="text/javascript" src="/javascript/jquery/jquery-1.3.2.min.js"></script>
    2828<!-- Sage Notebook library -->
    29 <script type="text/javascript" src="/javascript/main.js"></script>
     29<script type="text/javascript" src="/javascript/sage/main.js"></script>
    3030 
    3131{% if JSMATH %}
    3232<!-- jsMath - typeset mathematics -->
    INPUT: 
    9494<!-- TinyMCE and jEditable - in-place editing of text cells -->
    9595    <script type="text/javascript" src="/javascript/tiny_mce/tiny_mce.js"></script>
    9696    <script type="text/javascript" src="/javascript/jquery/plugins/jeditable/jquery.jeditable.mini.js" charset="utf-8"></script>
    97     <script type="text/javascript" src="/javascript/sage/js/tinymce.js"></script>
     97    <script type="text/javascript" src="/javascript/sage/tinymce.js"></script>
    9898{% endif %}
    9999
    100100<script type="text/javascript">user_name= "{{ username }}";</script>
  • sagenb/data/sage/html/notebook/index.html

    diff --git a/sagenb/data/sage/html/notebook/index.html b/sagenb/data/sage/html/notebook/index.html
    a b INPUT: 
    3333{{ common_javascript(worksheet, worksheet_filename, username, JSMATH, JSMATH_IMAGE_FONTS, JEDITABLE_TINYMCE, sage_jsmath_macros) }}
    3434{% endblock %}
    3535
     36{# TODO: Hack until the template restructuring #}
    3637{% block body_attrs %}
    37 class="worksheet-online" onLoad="initialize_the_notebook();"
     38{% if worksheet.is_published() or notebook.user_is_guest(username) %}
     39        class="worksheet-online" onLoad="initialize_the_notebook();"
     40    {% else %}
     41        class="worksheet-online" onLoad="initialize_the_notebook();" id="user-worksheet-index"
     42{% endif %}
    3843{% endblock %}
    3944
     45
    4046{% block body %}
    4147{% if worksheet.is_published() or notebook.user_is_guest(username) %}
    4248    {% set original_worksheet = worksheet.worksheet_that_was_published() %}
  • sagenb/data/sage/html/notebook/top_bar_and_worksheet.html

    diff --git a/sagenb/data/sage/html/notebook/top_bar_and_worksheet.html b/sagenb/data/sage/html/notebook/top_bar_and_worksheet.html
    a b INPUT: 
    1515                       ('bugreport()', 'Report a Problem', 'Report a problem or submit a bug to improve Sage'),
    1616                       ('help()', 'Help', 'Documentation'),
    1717                       ('/logout', 'Sign out', 'Log out of the Sage notebook')] %}
     18
    1819<table width="100%">
    1920    <tr>
    2021        <td>{% include "html/banner.html" %}</td>
  • sagenb/data/sage/html/notebook/worksheet.html

    diff --git a/sagenb/data/sage/html/notebook/worksheet.html b/sagenb/data/sage/html/notebook/worksheet.html
    a b INPUT: 
    1313
    1414{% block javascript %}
    1515<script type="text/javascript" src="/javascript/jquery/jquery-1.3.2.min.js"></script>
    16 <script type="text/javascript" src="/javascript/main.js"></script>
     16<script type="text/javascript" src="/javascript/sage/main.js"></script>
    1717{% if do_print %}
    1818    <script type="text/javascript" src="/javascript/jsmath/jsMath.js"></script>
    1919{% endif %}   
  • sagenb/data/sage/html/worksheet_listing.html

    diff --git a/sagenb/data/sage/html/worksheet_listing.html b/sagenb/data/sage/html/worksheet_listing.html
    a b  
    2121  {% if not pub %}
    2222  <script type="text/javascript" src="/javascript/jquery/jquery-1.3.2.min.js"></script>
    2323  {% endif %}
    24   <script type="text/javascript" src="/javascript/main.js"></script>
     24  <script type="text/javascript" src="/javascript/sage/main.js"></script>
    2525  {% if not pub %}
    2626    <script type="text/javascript">
    2727    var worksheet_filenames = {{ worksheet_filenames }};
  • sagenb/data/sage/js/notebook_lib.js

    diff --git a/sagenb/data/sage/js/notebook_lib.js b/sagenb/data/sage/js/notebook_lib.js
    a b function get_keyboard() { 
    265265        alert("Your browser / OS combination is not supported.  \nPlease use Firefox or Opera under Linux, Windows, or Mac OS X, or Safari.")
    266266    }
    267267
    268     async_request('/javascript/keyboard/'+b+o, get_keyboard_callback);
     268    async_request('/javascript/sage/keyboard/'+b+o, get_keyboard_callback);
    269269}
    270270
    271271
    function refresh_cell_list_callback(stat 
    576576
    577577String.prototype.replaceAll = function(strTarget, strSubString ) {
    578578    /*
    579     Replace all instances of the given substring by another string>
     579    Replace all instances of the given substring by another string.
    580580
    581581    From http://www.bennadel.com/blog/142-Ask-Ben-Javascript-String-Replace-Method.htm
    582582
    function resize_all_cells() { 
    673673
    674674function input_keyup(id, event) {
    675675    /*
    676     Resize the cell once and a while.  Not too often.
     676    Resize the cell once in a while.  Not too often.
    677677    INPUT:
    678678        id -- an integer
    679679        event -- a keyup event
    function input_keyup(id, event) { 
    701701    if (e==null) return;
    702702    if (key_enter(e)) {
    703703        var cell = get_cell(id)
    704         //warning!  very subtle regular expression (for nonjaphs)
     704        // warning!  very subtle regular expression (for nonjaphs)
    705705        // (?:\n|^)        -- starting from the last line ending (or beginning of the cell), (don't capture contents)
    706706        // ( *)            -- as many spaces as we can find (capture this, we'll find it in RegExp.$1)
    707707        // (?:.*?)         -- everything else in the string, but save room for the following terms (don't capture contents)
  • sagenb/notebook/notebook.py

    diff --git a/sagenb/notebook/notebook.py b/sagenb/notebook/notebook.py
    a b class Notebook(object): 
    12551255    ##########################################################
    12561256    # Worksheet HTML generation
    12571257    ##########################################################
    1258     def list_window_javascript(self, worksheet_filenames):
    1259         s = """
    1260            <script type="text/javascript" src="/javascript/jquery/jquery-1.3.2.min.js"></script>
    1261            <script type="text/javascript" src="/javascript/main.js"></script>
    1262            <script type="text/javascript">
    1263            var worksheet_filenames = %s;
    1264            </script>
    1265         """%(worksheet_filenames)
    1266                
    1267         return s
    1268 
    12691258    def worksheet_html(self, filename, do_print=False):
    12701259        r"""
    12711260        Return the HTML for a given worksheet.
  • sagenb/notebook/twist.py

    diff --git a/sagenb/notebook/twist.py b/sagenb/notebook/twist.py
    a b HISTORY_NCOLS = 90 
    5353
    5454from sagenb.misc.misc import SAGE_DOC, walltime, tmp_filename, tmp_dir, DATA, SAGE_VERSION
    5555
    56 css_path        = os.path.join(DATA, "sage", "css")
    57 image_path      = os.path.join(DATA, "sage", "images")
    58 javascript_path = os.path.join(DATA)
    59 java_path       = os.path.join(DATA)
     56css_path             = os.path.join(DATA, "sage", "css")
     57image_path           = os.path.join(DATA, "sage", "images")
     58javascript_path      = os.path.join(DATA)
     59sage_javascript_path = os.path.join(DATA, 'sage', 'js')
     60java_path            = os.path.join(DATA)
    6061
    6162# the list of users waiting to register
    6263waiting = {}
    class Main_js(resource.Resource): 
    17711772        s = js.javascript()
    17721773        return http.Response(stream=s)
    17731774
    1774 
    17751775class Keyboard_js_specific(resource.Resource):
    17761776    def __init__(self, browser_os):
    17771777        self.s = keyboards.get_keyboard(browser_os)
    class Keyboard_js_specific(resource.Reso 
    17801780        gzip_handler(ctx)
    17811781        return http.Response(stream = self.s)
    17821782
    1783 
    17841783class Keyboard_js(resource.Resource):
    17851784    def childFactory(self, request, browser_os):
    17861785        gzip_handler(request)
    17871786        return Keyboard_js_specific(browser_os)
    17881787
     1788class SageJavascript(resource.Resource):
     1789    addSlash = True
     1790    child_keyboard = Keyboard_js()
     1791
     1792    def render(self, ctx):
     1793        return static.File(sage_javascript_path)
     1794
     1795    def childFactory(self, request, name):
     1796        gzip_handler(request)
     1797        path = os.path.join(sage_javascript_path, name)
     1798        return static.File(path)
     1799
     1800setattr(SageJavascript, 'child_main.js', Main_js())
     1801
    17891802class Javascript(resource.Resource):
    17901803    addSlash = True
    1791     child_keyboard = Keyboard_js()
    17921804
    17931805    def render(self, ctx):
    17941806        return static.File(javascript_path)
    17951807
    17961808    def childFactory(self, request, name):
    17971809        gzip_handler(request)
     1810        if name == 'sage':
     1811            return SageJavascript()
    17981812        path = os.path.join(javascript_path, name)
    17991813        return static.File(path)
    18001814
    1801 setattr(Javascript, 'child_main.js', Main_js())
    1802 
    1803 
    18041815
    18051816############################
    18061817# Java resources