Commits

Olemis Lang committed 183f38f

Protocol tab(s) selected in docs on accessing protocol page

Comments (0)

Files changed (1)

t5437/t5437-protocol_api-r7194.diff

 diff --git a/trunk/tracrpc/templates/xmlrpclist.html b/trunk/tracrpc/templates/xmlrpclist.html
 --- a/trunk/tracrpc/templates/xmlrpclist.html
 +++ b/trunk/tracrpc/templates/xmlrpclist.html
-@@ -7,18 +7,62 @@
+@@ -7,23 +7,78 @@
    <xi:include href="layout.html" />
    <xi:include href="macros.html" />
    <head>
 -    <title>XML-RPC</title>
 +    <title>RPC</title>
    </head>
++  
++  <!--! Display tabs for protocol handlers -->
++  <py:def function="tabs(divid)">
++    <script type="text/javascript">
++      <py:choose test="rpc.proto_id">
++        <py:when test="None"> <!--! no protocol -->
++  		    $('#$divid').tabs();
++  		  </py:when>
++        <py:otherwise> <!--! selected protocol -->
++  		    $('#$divid').tabs({selected: ${[x[0] for x in rpc.protocols].index(rpc.proto_id)} });
++        </py:otherwise>
++      </py:choose>
++    </script>
++  </py:def>
++
    <body>
 -
      <div id="content" class="wiki">
 -            ${xmlrpc.json and 'available' or 'not available'}</strong></dd>
 +        <div id="proto_desc">
 +          <ul>
-+    				<li py:for="protocol in xmlrpc.protocols">
-+    				  <a href="#${protocol[0]}">${protocol[0]}</a>
++    				<li py:for="protocol in rpc.protocols">
++    				  <a href="#proto_desc_${protocol[0]}">${protocol[0]}</a>
 +    				</li>
 +          </ul>
-+          <div py:for="protocol in xmlrpc.protocols" id="${protocol[0]}">
++          <div py:for="protocol in rpc.protocols" id="proto_desc_${protocol[0]}">
 +            <dd>
 +              <p>${protocol[0]} is <strong>
 +                ${protocol[1] and 'available' or 'not available'}</strong>
 +          </div>
 +        </div>
        </dl>
-+      <script type="text/javascript">
-+			  $('#proto_desc').tabs();
-+      </script>
++      ${tabs('proto_desc')}
 +
 +      <h2>Calling Methods</h2>
 +      <p>Libraries for remote procedure calls and parsing exists
 +      <div class="help">
 +        <div id="proto_ex">
 +          <ul>
-+    				<li py:for="protocol in xmlrpc.protocols">
-+    				  <a href="#${protocol[0]}_ex">${protocol[0]}</a>
++    				<li py:for="protocol in rpc.protocols">
++    				  <a href="#proto_ex_${protocol[0]}">${protocol[0]}</a>
 +    				</li>
 +          </ul>
-+          <div py:for="protocol in xmlrpc.protocols" id="${protocol[0]}_ex">
++          <div py:for="protocol in rpc.protocols" id="proto_ex_${protocol[0]}">
 +              ${wiki_to_html(context, protocol[2].replace(
 +                              '${req.abs_href.rpc()}', req.abs_href.rpc()))}
 +          </div>
 +        </div>
 +      </div>
-+      <script type="text/javascript">
-+			  $('#proto_ex').tabs();
-+      </script>
++      ${tabs('proto_ex')}
  
        <h2>RPC exported functions</h2>
  
-@@ -50,60 +94,6 @@
+       <div id="searchable">
+-        <dl py:for="key in sorted(xmlrpc.functions)" py:with="namespace = xmlrpc.functions[key]">
++        <dl py:for="key in sorted(rpc.functions)" py:with="namespace = rpc.functions[key]">
+           <dt>
+             <h3 id="${'xmlrpc.' + to_unicode(namespace.namespace)}">
+               ${namespace.namespace} - ${namespace.description}
+@@ -50,60 +105,6 @@
          </dl>
        </div>
        
 +            add_stylesheet(req, 'rpc/css/no-theme/ui.all.css')
 +            add_script(req, 'rpc/js/jquery-ui-1.6.custom.min.js')
 +            return ('xmlrpclist.html', 
-+                        {'xmlrpc': {'functions': namespaces,
++                        {'rpc': {'functions': namespaces,
 +                        'protocols': [p.rpc_info() for p in self.protocols],
 +                        'proto_id' : proto and proto.rpc_info()[0] or None}}, 
 +                      None)