logo       


svn commit: r1364 - trunk: lib viewvc.org: msg#00014

Subject: svn commit: r1364 - trunk: lib viewvc.org
Author: cmpilato
Date: 2006-05-19 08:40:24-0700
New Revision: 1364

Modified:
   trunk/lib/viewvc.py
   trunk/viewvc.org/template-authoring-guide.html

Log:
Merge the commonize-navdata branch into the trunk.  For change log
information, see these revisions:

r1348 | cmpilato | 2006-04-25 10:01:17 -0400 (Tue, 25 Apr 2006) | 17 lines
r1343 | cmpilato | 2006-04-20 04:00:21 -0400 (Thu, 20 Apr 2006) | 23 lines


Modified: trunk/lib/viewvc.py
Url: 
http://viewvc.tigris.org/source/browse/viewvc/trunk/lib/viewvc.py?view=diff&rev=1364&p1=trunk/lib/viewvc.py&p2=trunk/lib/viewvc.py&r1=1363&r2=1364
==============================================================================
--- trunk/lib/viewvc.py (original)
+++ trunk/lib/viewvc.py 2006-05-19 08:40:24-0700
@@ -1054,14 +1054,25 @@
     'rootname' : request.server.escape(request.rootname),
     'pathtype' : None,
     'nav_path' : nav_path(request),
+    'view'     : _view_codes[request.view_func],
+    'rev'      : None,
+    'view_href' : None,
+    'annotate_href' : None,
+    'download_href' : None,
+    'download_text_href' : None,
+    'revision_href' : None,
+    'queryform_href' : None,
     'up_href'  : None,
     'log_href' : None,
     'log_href_rev': None,
     'graph_href': None,
     'rss_href' : None,
-    'view'     : _view_codes[request.view_func],
+    'prefer_markup' : ezt.boolean(0),
   }
 
+  rev = request.query_dict.get('revision')
+  data['rev'] = hasattr(request.repos, '_getrev') \
+                and request.repos._getrev(rev) or rev
   if request.pathtype == vclib.DIR:
     data['pathtype'] = 'dir'
   elif request.pathtype == vclib.FILE:
@@ -1092,63 +1103,38 @@
                                       params={}, escape=1)
 
   if request.pathtype == vclib.FILE:
-    if (request.view_func is not view_log):
-      data['log_href'] = request.get_url(view_func=view_log,
-                                         params={}, escape=1)
-      if (request.view_func is view_diff):
-        data['log_href_rev'] = request.query_dict.get('r2')
-      elif (request.view_func is view_annotate):
-        # if user did "view=annotate" there may not be an annotate key
-        if request.query_dict.has_key('annotate'):
-          data['log_href_rev'] = request.query_dict.get('annotate')
-      elif request.query_dict.has_key('revision'):
-        data['log_href_rev'] = request.query_dict.get('revision')
-
-    if (request.roottype == 'cvs' and cfg.options.use_cvsgraph
-        and request.view_func is not view_cvsgraph):
+    data['view_href'], data['download_href'], data['download_text_href'], \
+      data['annotate_href'], data['revision_href'], data['prefer_markup'] \
+        = get_file_view_info(request, request.where,
+                             data['rev'], request.mime_type)
+    data['log_href'] = request.get_url(view_func=view_log,
+                                       params={}, escape=1)
+    if request.roottype == 'cvs' and cfg.options.use_cvsgraph:
       data['graph_href'] = request.get_url(view_func=view_cvsgraph,
                                            params={}, escape=1)
   elif request.pathtype == vclib.DIR:
+    data['view_href'] = request.get_url(view_func=view_directory,
+                                       params={}, escape=1)
     if request.roottype == 'svn':
+      data['revision_href'] = request.get_url(view_func=view_revision,
+                                              params={}, escape=1)
+
       data['log_href'] = request.get_url(view_func=view_log,
                                          params={}, escape=1)
 
   if is_query_supported(request):
+    params = {}
+    if request.roottype == 'cvs' and request.pathrev:
+      params['branch'] = request.pathrev
+    data['queryform_href'] = request.get_url(view_func=view_queryform,
+                                             params=params,
+                                             escape=1)
     data['rss_href'] = request.get_url(view_func=view_query,
                                        params={'date': 'month',
                                                'format': 'rss'},
                                        escape=1)
   return data
 
-def nav_header_data(request, rev, orig_path):
-  view_href, download_href, download_text_href, annotate_href, \
-             revision_href, prefer_markup \
-      = get_file_view_info(request, request.where, rev, request.mime_type)
-  
-  data = common_template_data(request)
-  data.update({
-    'rev' : rev,
-    'view_href' : view_href,
-    'annotate_href' : annotate_href,
-    'download_href' : download_href,
-    'download_text_href' : download_text_href,
-    'revision_href' : revision_href,
-    'prefer_markup' : prefer_markup,
-    'orig_path' : None,
-    'orig_href' : None,
-  })
-
-  if orig_path != request.path_parts:
-    path = _path_join(orig_path)
-    data['orig_path'] = path
-    data['orig_href'] = request.get_url(view_func=view_log,
-                                        where=path,
-                                        pathtype=vclib.FILE,
-                                        params={'pathrev': rev},
-                                        escape=1)
-
-  return data
-
 def retry_read(src, reqlen=CHUNK_SIZE):
   while 1:
     chunk = src.read(CHUNK_SIZE)
@@ -1369,7 +1355,7 @@
     fp.close()
     return
 
-  data = nav_header_data(request, revision, path)
+  data = common_template_data(request)
   data.update({
     'mime_type' : request.mime_type,
     'log' : None,
@@ -1384,8 +1370,19 @@
     'state' : None,
     'vendor_branch' : None,
     'prev' : None,
+    'orig_path' : None,
+    'orig_href' : None,
     })
 
+  if path != request.path_parts:
+    orig_path = _path_join(path)
+    data['orig_path'] = orig_path
+    data['orig_href'] = request.get_url(view_func=view_log,
+                                        where=orig_path,
+                                        pathtype=vclib.FILE,
+                                        params={'pathrev': revision},
+                                        escape=1)
+
   if cfg.options.show_log_in_markup:
     options = {'svn_latest_log': 1}
     revs = request.repos.itemlog(path, revision, options)
@@ -1671,7 +1668,6 @@
     'youngest_rev' : None,
     'youngest_rev_href' : None,
     'selection_form' : None,
-    'queryform_href' : None,
     'attic_showing' : None,
     'show_attic_href' : None,
     'hide_attic_href' : None,
@@ -1718,14 +1714,6 @@
                                                 params={},
                                                 escape=1)
 
-  if is_query_supported(request):
-    params = {}
-    if request.roottype == 'cvs' and request.pathrev:
-      params['branch'] = request.pathrev
-    data['queryform_href'] = request.get_url(view_func=view_queryform,
-                                             params=params,
-                                             escape=1)
-
   if cfg.options.use_pagesize:
     data['dir_paging_action'], data['dir_paging_hidden_values'] = \
       request.get_form(params={'dir_pagestart': None})
@@ -2160,8 +2148,21 @@
   source, revision = blame.blame(request.repos, path,
                                  diff_url, include_url, rev)
 
-  data = nav_header_data(request, revision, path)
-  data['lines'] = source
+  data = common_template_data(request)
+  data.update({
+    'lines': source,
+    'orig_path': None,
+    'orig_href': None,
+    })
+
+  if path != request.path_parts:
+    orig_path = _path_join(path)
+    data['orig_path'] = orig_path
+    data['orig_href'] = request.get_url(view_func=view_log,
+                                        where=orig_path,
+                                        pathtype=vclib.FILE,
+                                        params={'pathrev': revision},
+                                        escape=1)
 
   request.server.header()
   generate_page(request, "annotate", data)
@@ -2728,10 +2729,12 @@
   except vclib.InvalidRevision:
     raise debug.ViewVCException('Invalid path(s) or revision(s) passed '
                                  'to diff', '400 Bad Request')
-  data = common_template_data(request)
+  path_left = _path_join(p1)
+  path_right = _path_join(p2)
+  data = common_template_data(request, path_right, r2)
   data.update({
-    'path_left': _path_join(p1),
-    'path_right': _path_join(p2),
+    'path_left': path_left,
+    'path_right': path_right,
     'rev_left' : rev1,
     'rev_right' : rev2,
     'tag_left' : sym1,
@@ -3447,8 +3450,6 @@
   show_branch = ezt.boolean(request.roottype == 'cvs' and
                             (branch == '' or branch_match != 'exact'))
 
-  # a link to modify query
-  queryform_href = request.get_url(view_func=view_queryform, escape=1)
   # backout link
   params = request.query_dict.copy()
   params['format'] = 'backout'
@@ -3473,7 +3474,6 @@
   data.update({
     'sql': sql,
     'english_query': english_query(request),
-    'queryform_href': queryform_href,
     'backout_href': backout_href,
     'plus_count': plus_count,
     'minus_count': minus_count,

Modified: trunk/viewvc.org/template-authoring-guide.html
Url: 
http://viewvc.tigris.org/source/browse/viewvc/trunk/viewvc.org/template-authoring-guide.html?view=diff&rev=1364&p1=trunk/viewvc.org/template-authoring-guide.html&p2=trunk/viewvc.org/template-authoring-guide.html&r1=1363&r2=1364
==============================================================================
--- trunk/viewvc.org/template-authoring-guide.html      (original)
+++ trunk/viewvc.org/template-authoring-guide.html      2006-05-19 08:40:24-0700
@@ -57,7 +57,6 @@
   <li><a href="#variables">Variables Available to ViewVC Templates</a></li>
   <ul class="toc-list">
     <li><a href="#variables-common">Common Template Variable Set 
(COMMON)</a></li>
-    <li><a href="#variables-navdata">File Navigation Variable Set 
(NAVDATA)</a></li>
     <li><a href="#variables-pathrev">Path Revision Form Variable Set 
(PATHREV)</a></li>
     <li><a href="#variables-paging">Paging Form Variable Set (PAGING)</a></li>
     <li><a href="#variables-annotate">Annotation View (annotate.ezt)</a></li>
@@ -97,6 +96,12 @@
 </thead>
 <tbody>
 <tr class="varlevel1">
+  <td class="varname">annotate_href</td>
+  <td>String</td>
+  <td>URL of the ViewVC annotation view for the current resource.
+      Valid only when <var>pathtype</var> is <tt>file</tt>.</td>
+</tr>
+<tr class="varlevel1">
   <td class="varname">cfg</td>
   <td>Object</td>
   <td>Representation of the object used by ViewVC for runtime
@@ -126,10 +131,22 @@
       location).</td>
 </tr>
 <tr class="varlevel1">
+  <td class="varname">download_href</td>
+  <td>String</td>
+  <td>ViewVC file contents download URL for the current resource.
+      Valid only when <var>pathtype</var> is <tt>file</tt>.</td>
+</tr>
+<tr class="varlevel1">
+  <td class="varname">download_text_href</td>
+  <td>String</td>
+  <td>ViewVC file contents as-text download URL for the current resource.
+      Valid only when <var>pathtype</var> is <tt>file</tt>.</td>
+</tr>
+<tr class="varlevel1">
   <td class="varname">graph_href</td>
   <td>String</td>
-  <td>URL of the ViewVC revision graph view for the current 
-      resource.</td>
+  <td>URL of the ViewVC revision graph view for the current resource.
+      Valid only when <var>pathtype</var> is <tt>file</tt>.</td>
 </tr>
 <tr class="varlevel1">
   <td class="varname">kv</td>
@@ -146,7 +163,8 @@
   <td class="varname">log_href</td>
   <td>String</td>
   <td>URL of the ViewVC revision log view for the current
-      resource.</td>
+      resource.  Valid only when <var>pathtype</var> is <tt>file</tt>
+      or (for Subversion roots) <tt>dir</tt>.</td>
 </tr>
 <tr class="varlevel1">
   <td class="varname">log_rev_href</td>
@@ -177,6 +195,29 @@
       (file), <tt>dir</tt> (directory); may be empty.</td>
 </tr>
 <tr class="varlevel1">
+  <td class="varname">prefer_markup</td>
+  <td>Boolean</td>
+  <td>Indicates whether to make the default file link a link to the markup
+      page instead of the checkout page.  Valid only when
+      <var>pathtype</var> is <tt>file</tt>.</td>
+</tr>
+<tr class="varlevel1">
+  <td class="varname">queryform_href</td>
+  <td>String</td>
+  <td>URL for a query form returning results from this directory.
+      Valid only when <var>pathtype</var> is <tt>dir</tt>.</td>
+</tr>
+<tr class="varlevel1">
+  <td class="varname">rev</td>
+  <td>String</td>
+  <td>Revision of the current resource.</td>
+</tr>
+<tr class="varlevel1">
+  <td class="varname">revision_href</td>
+  <td>String</td>
+  <td>URL of the Subversion revision view for the current revision.</td>
+</tr>
+<tr class="varlevel1">
   <td class="varname">rootname</td>
   <td>String</td>
   <td>Name of the current repository (root).</td>
@@ -209,6 +250,11 @@
       Valid values: <tt>cvs</tt> (CVS), <tt>svn</tt> (Subversion).</td>
 </tr>
 <tr class="varlevel1">
+  <td class="varname">rss_href</td>
+  <td>String</td>
+  <td>URL of RSS feed for current location.</td>
+</tr>
+<tr class="varlevel1">
   <td class="varname">up_href</td>
   <td>String</td>
   <td>Link to the current object's parent directory view.</td>
@@ -226,6 +272,13 @@
      <tt>rev</tt> (revision/changeset view).</td>
 </tr>
 <tr class="varlevel1">
+  <td class="varname">view_href</td>
+  <td>String</td>
+  <td>URL of the ViewVC file contents view for the current resource.
+      Valid only when <var>pathtype</var> is <tt>file</tt> or 
+      <tt>dir</tt>.</td>
+</tr>
+<tr class="varlevel1">
   <td class="varname">vsn</td>
   <td>String</td>
   <td>ViewVC version identifier.</td>
@@ -241,77 +294,6 @@
 </div>
 
 <div class="h3">
-<h3 id="variables-navdata">File Navigation Variable Set (NAVDATA)</h3>
-<table>
-<thead>
-<tr>
-  <th>Variable</th>
-  <th>Type</th>
-  <th>Description</th>
-</tr>
-</thead>
-<tbody>
-<tr class="include">
-  <td colspan="3">Includes all variables from the 
-     <a href="#variables-common">COMMON</a> variable set</td>
-</tr>
-<tr class="varlevel1">
-  <td class="varname">annotate_href</td>
-  <td>String</td>
-  <td>URL of the ViewVC annotation view for the current resource.</td>
-</tr>
-<tr class="varlevel1">
-  <td class="varname">download_href</td>
-  <td>String</td>
-  <td>ViewVC file contents download URL for the current resource.</td>
-</tr>
-<tr class="varlevel1">
-  <td class="varname">download_text_href</td>
-  <td>String</td>
-  <td>ViewVC file contents as-text download URL for the current resource.</td>
-</tr>
-<tr class="varlevel1">
-  <td class="varname">orig_path</td>
-  <td>String</td>
-  <td>When viewing an old file revision through a copy of the file,
-      this is the old file revision's original path.</td>
-</tr>
-<tr class="varlevel1">
-  <td class="varname">orig_href</td>
-  <td>String</td>
-  <td>URL of a ViewVC log view for <code>orig_path</code>.</td>
-</tr>
-<tr class="varlevel1">
-  <td class="varname">prefer_markup</td>
-  <td>Boolean</td>
-  <td>Indicates whether to make the default file link a link to the markup
-      page instead of the checkout page.</td>
-</tr>
-<tr class="varlevel1">
-  <td class="varname">rev</td>
-  <td>String</td>
-  <td>Revision of the current resource.</td>
-</tr>
-<tr class="varlevel1">
-  <td class="varname">revision_href</td>
-  <td>String</td>
-  <td>URL of the Subversion revision view for the current revision.</td>
-</tr>
-<tr class="varlevel1">
-  <td class="varname">rss_href</td>
-  <td>String</td>
-  <td>URL of RSS feed for current location.</td>
-</tr>
-<tr class="varlevel1">
-  <td class="varname">view_href</td>
-  <td>String</td>
-  <td>URL of the ViewVC file contents view for the current resource.</td>
-</tr>
-</tbody>
-</table>
-</div>
-
-<div class="h3">
 <h3 id="variables-pathrev">Path Revision Form Variable Set (PATHREV)</h3>
 <table>
 <thead>
@@ -415,7 +397,7 @@
 <tbody>
 <tr class="include">
   <td colspan="3">Includes all variables from the 
-     <a href="#variables-navdata">NAVDATA</a> variable set</td>
+     <a href="#variables-common">COMMON</a> variable set</td>
 </tr>
 <tr class="varlevel1">
   <td class="varname">lines</td>
@@ -463,6 +445,17 @@
   <td>String</td>
   <td>Textual contents of the line.</td>
 </tr>
+<tr class="varlevel1">
+  <td class="varname">orig_path</td>
+  <td>String</td>
+  <td>When viewing an old file revision through a copy of the file,
+      this is the old file revision's original path.</td>
+</tr>
+<tr class="varlevel1">
+  <td class="varname">orig_href</td>
+  <td>String</td>
+  <td>URL of a ViewVC log view for <code>orig_path</code>.</td>
+</tr>
 </tbody>
 </table>
 </div>
@@ -853,11 +846,6 @@
       CVS only.</td>
 </tr>
 <tr class="varlevel1">
-  <td class="varname">queryform_href</td>
-  <td>String</td>
-  <td>URL for a query form returning results from this directory.</td>
-</tr>
-<tr class="varlevel1">
   <td class="varname">search_re</td>
   <td>String</td>
   <td>Current search expression, if any.</td>
@@ -1401,7 +1389,7 @@
 <tbody>
 <tr class="include">
   <td colspan="3">Includes all variables from the 
-     <a href="#variables-navdata">NAVDATA</a> variable set</td>
+     <a href="#variables-common">COMMON</a> variable set</td>
 </tr>
 <tr class="varlevel1">
   <td class="varname">ago</td>
@@ -1452,6 +1440,17 @@
   <td>MIME type of the current file.</td>
 </tr>
 <tr class="varlevel1">
+  <td class="varname">orig_path</td>
+  <td>String</td>
+  <td>When viewing an old file revision through a copy of the file,
+      this is the old file revision's original path.</td>
+</tr>
+<tr class="varlevel1">
+  <td class="varname">orig_href</td>
+  <td>String</td>
+  <td>URL of a ViewVC log view for <code>orig_path</code>.</td>
+</tr>
+<tr class="varlevel1">
   <td class="varname">prev</td>
   <td>String</td>
   <td>Previous revision number.</td>
@@ -1646,11 +1645,6 @@
   <td>Total number of lines added in the commit (over all files).</td>
 </tr>
 <tr class="varlevel1">
-  <td class="varname">queryform_href</td>
-  <td>String</td>
-  <td>URL for form to edit query criteria.</td>
-</tr>
-<tr class="varlevel1">
   <td class="varname">querysort</td>
   <td>String</td>
   <td>Indicates how query results are being sorted. Possible values: 


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe