Update of /cvsroot/freevo/freevo/src/www/htdocs/help
In directory sc8-pr-cvs1:/tmp/cvs-serv26930/src/www/htdocs/help

Modified Files:
        howto.rpy 
Log Message:
better howto support

Index: howto.rpy
===================================================================
RCS file: /cvsroot/freevo/freevo/src/www/htdocs/help/howto.rpy,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** howto.rpy   31 Oct 2003 18:56:14 -0000      1.3
--- howto.rpy   1 Nov 2003 15:20:38 -0000       1.4
***************
*** 12,15 ****
--- 12,18 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.4  2003/11/01 15:20:38  dischi
+ # better howto support
+ #
  # Revision 1.3  2003/10/31 18:56:14  dischi
  # Add framework for plugin writing howto
***************
*** 60,77 ****
                 os.path.join(config.SHARE_DIR, '../Docs'))
  
  class HowtoResource(FreevoResource):
      def __init__(self):
          FreevoResource.__init__(self)
          self.BASEDIR = {}
!         for d in SEARCH_PATH:
!             if os.path.isdir(os.path.join(d, 'freevo_howto')):
!                 self.BASEDIR['howto'] = os.path.join(d, 'freevo_howto')
!             elif os.path.isdir(os.path.join(d, 'howto')):
!                 self.BASEDIR['howto'] = os.path.join(d, 'howto')
! 
!             if os.path.isdir(os.path.join(d, 'plugin_writing/html')):
!                 self.BASEDIR['plugin'] = os.path.join(d, 'plugin_writing/html')
!             elif os.path.isfile(os.path.join(d, 'plugin_writing/index.html')):
!                 self.BASEDIR['plugin'] = os.path.join(d, 'plugin_writing')
          
      def _render(self, request):
--- 63,88 ----
                 os.path.join(config.SHARE_DIR, '../Docs'))
  
+ # to add a new docbook style howto, just add the identifier to this
+ # list
+ TYPES = {
+     'install': ('installation', 'Freevo Installation HOWTO',
+                 'Freevo Installation HOWTO: Build your own media box with Freevo and 
Linux'),
+     'plugin':  ('plugin_writing', 'Freevo Plugin Writing HOWTO',
+                 'Freevo Plugin Writing HOWTO: Writing your own plugins for Freevo')
+     }
+                 
  class HowtoResource(FreevoResource):
      def __init__(self):
          FreevoResource.__init__(self)
          self.BASEDIR = {}
!         for type in TYPES:
!             dirname = TYPES[type][0]
!             for d in SEARCH_PATH:
!                 if os.path.isdir(os.path.join(d, dirname, 'html')):
!                     self.BASEDIR[type] = os.path.join(d, dirname, 'html')
!                 elif os.path.isfile(os.path.join(d, dirname, 'index.html')):
!                     self.BASEDIR[type] = os.path.join(d, dirname)
!                 elif os.path.isfile(os.path.join(d, dirname, 'book1.html')):
!                     self.BASEDIR[type] = os.path.join(d, dirname)
          
      def _render(self, request):
***************
*** 86,95 ****
          type = fv.formValue(form, 'type')
          if not type:
!             type = 'howto'
              
!         if type == 'howto':
!             name = 'Freevo Installation HOWTO'
!         else:
!             name = 'Freevo Plugin Writing HOWTO'
              
          if not self.BASEDIR.has_key(type):
--- 97,103 ----
          type = fv.formValue(form, 'type')
          if not type:
!             type = 'install'
              
!         name = TYPES[type][1]
              
          if not self.BASEDIR.has_key(type):
***************
*** 99,116 ****
                        'The files are searched in the following locations:<br><ol>'
              for d in SEARCH_PATH:
!                 fv.res += '<li>%s</li>\n' % d
              fv.res += '</ol>'
  
          else:
              for line in util.readfile(os.path.join(self.BASEDIR[type], file)):
                  if line.find('HREF') == 0 and line.find('http') == -1:
                      line = line[:line.find('="')+2] + 'howto.rpy?type=' + \
                             type + '&file=' + line[line.find('="')+2:]
!                 if line.find('>Freevo Installation HOWTO: Build your own media '\
!                              'box with Freevo and Linux</TH') == 0:
!                     line = ''
!                 if line.find('>Freevo Plugin Writing HOWTO: Writing your own '\
!                              'plugins for Freevo</TH') == 0:
                      line = ''
                  if pos == 0 and line.find('><TITLE') == 0:
                      pos = 1
--- 107,132 ----
                        'The files are searched in the following locations:<br><ol>'
              for d in SEARCH_PATH:
!                 fv.res += '<li>%s/%s</li>\n' % (d, TYPES[type][0])
              fv.res += '</ol>'
  
          else:
+             if not os.path.isfile(os.path.join(self.BASEDIR[type], file)) \
+                    and file == 'index.html':
+                 file = 'book1.html'
+ 
              for line in util.readfile(os.path.join(self.BASEDIR[type], file)):
                  if line.find('HREF') == 0 and line.find('http') == -1:
                      line = line[:line.find('="')+2] + 'howto.rpy?type=' + \
                             type + '&file=' + line[line.find('="')+2:]
! 
!                 for t in TYPES:
!                     if line.find('>%s</TH' % TYPES[t][2]) == 0:
!                         line = ''
!                         break
! 
!                 # remove border for some DocBook stylesheets
!                 if line.find('BGCOLOR="#E0E0E0"') == 0:
                      line = ''
+                     
                  if pos == 0 and line.find('><TITLE') == 0:
                      pos = 1




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to