Apache Directory Indexer Replacement HowTo 

Author:  Greg Zartman <greg@leiinc.com>
Contributor:
  Darrell May
Release supported: e-smith 4.x, SME 5.1.2 and SME 5.5
License: GPL
Last updated: Jan. 8, 2003

 

 


Problem:  You want to replace the default apache directory indexer with one that is a little more user friendly.  Further, you don't want to have to copy the replacement indexer into every directory that you want to index.  
Solution:
  Follow this howto. 


***NOTE: IF YOU ALREADY HAVE MOD_PERL ACTIVATED ON YOUR SME SERVER, YOU CAN SKIP TO STEP 3.
                  IF YOU HAVE INSTALLED BETA VERSIONS OF THIS INDEXER (I.E., PRIOR TO VERSION 0.0.4), YOU WILL NEED TO UNINSTALL THE PRE-0.0.4 VERSION PRIOR TO INSTALLING THIS VERSION!!!

STEP 1:  Download the e-smith-mod_perl RPM:

http://www.leiinc.com/repository/Linux/Mitel_SME_Server/Contribs/mod_perl/e-smith-mod_perl-0.0.1-2.noarch.rpm

STEP 2:  Install e-smith-mod_perl RPM:

[root@testbed files]# rpm -ivh e-smith-mod_perl-0.0.1-2.noarch.rpm
Preparing... ########################################### [100%]
1:e-smith-mod_perl ########################################### [100%]
/usr/sbin/apachectl graceful: httpd gracefully restarted

STEP 3:  Download the indexer package:

http://www.leiinc.com/repository/Linux/Mitel_SME_Server/Beta/Indexer/gjz-mitel-indexer-0.0.3-4.noarch.rpm

STEP 4: Install the indexer package:

[root@testbed noarch]# rpm -ivh gjz-mitel-indexer-0.0.3-4.noarch.rpm
Preparing... ########################################### [100%]
1:gjz-indexer ########################################### [100%]
/usr/sbin/apachectl graceful: httpd gracefully restarted


STEP 3:   Browse to a file repository on your web server to verify that the new indexer is working.  That's it.  :-)



Customize the Indexer

Change the indexer theme:

Step 1:  Log into the server as root and load the Apache::SME_indexer perl module into pico:

[root@testbed root]# pico /usr/lib/perl5/site_perl/5.6.1/i386-linux/Apache/SME_indexer.pm

Step 2:  Scroll down to the configuration section, Indexer Theme sub-section, and set the desired theme variable to 1:

#------------------------------------------------------------------
#Indexer Theme: Use the following varables to choose between
# the two available indexer themes.
# Put a 1 next to the desired theme and a 0 next to
# the other(s). Default theme is Lophty.
# Themes:
# 1: Slord: Shad Lords indexer layout
# 2: Lophty: Lophty indexer layout
#------------------------------------------------------------------
our $theme_slord = 0;
our $theme_lophty = 1;

Step 3:  Hit Control-X to save changes and exit pico.  

Step 4:  Restart Apache:

[root@testbed root]# /etc/rc.d/init.d/httpd graceful
/usr/sbin/apachectl graceful: httpd gracefully restarted
[root@testbed root]#


Change, add, or remove indexer text title:

Step 1:  Log into the server as root and load the Apache::SME_indexer perl module into pico:

[root@testbed root]# pico /usr/lib/perl5/site_perl/5.6.1/i386-linux/Apache/SME_indexer.pm

Step 2:  Scroll down to the configuration section, Text Title sub-section, and modify the $text_title varable as desired:


#------------------------------------------------------------------
#Text Title: Use the variable to define a text title that will
# be displayed at the top of each indexer page.
# leave the variable empty (i.e., null) will remove
# the title.
#------------------------------------------------------------------
our $text_title = "My Indexer";

Step 3:  Hit Control-X to save changes and exit pico.  

Step 4:  Restart Apache:

[root@testbed root]# /etc/rc.d/init.d/httpd graceful
/usr/sbin/apachectl graceful: httpd gracefully restarted
[root@testbed root]#


Change how the indexer sorts files.  The indexer allows you to sort files alphabetically, by file extension, by file size, and by create/modification date:

Step 1:  Log into the server as root and load the Apache::SME_indexer perl module into pico:

[root@testbed root]# pico /usr/lib/perl5/site_perl/5.6.1/i386-linux/Apache/SME_indexer.pm

Step 2:  Scroll down to the configuration section, Indexer Sorting sub-section, and modify the group of $sort_by variable to change the sorting method.  Note that setting more than one of the $sortby_ variables to one causes the indexer to default to simple alpha sorting:

#------------------------------------------------------------------
#Indexer Sorting: Use the following group of variables to specify
# how the indexer should sort entries. Put a 1
# next to the variable designating the desired
# sort method and 0s next to the others. Setting
# more than one variable to 1 will cause the indexer
# to default to a simple alpha sort.
#------------------------------------------------------------------
our $sortby_alpha = 1;
our $sortby_file_extension = 0;
our $sortby_file_size = 0;
our $sortby_mod_date = 0;

Step 3:  Hit Control-X to save changes and exit pico.  

Step 4:  Restart Apache:

[root@testbed root]# /etc/rc.d/init.d/httpd graceful
/usr/sbin/apachectl graceful: httpd gracefully restarted
[root@testbed root]#


Modify how the indexer displays file paths:

Step 1:  Log into the server as root and load the Apache::SME_indexer perl module into pico:

[root@testbed root]# pico /usr/lib/perl5/site_perl/5.6.1/i386-linux/Apache/SME_indexer.pm

Step 2:  Scroll down to the configuration section, Show Full Path sub-section, and modify the $show_full_path variable: set to 1 to show full virtual paths or set to 0 to show only the current location:

#------------------------------------------------------------------
#Show Full Path: Set this variable to 1 to tell the indexer to
# to display full virtual paths. Set to 0 to '
# display the current location only.
#------------------------------------------------------------------
our $show_full_path = 0;

Step 3:  Hit Control-X to save changes and exit pico.  

Step 4:  Restart Apache:

[root@testbed root]# /etc/rc.d/init.d/httpd graceful
/usr/sbin/apachectl graceful: httpd gracefully restarted
[root@testbed root]#

 


Display hidden files:

Step 1:  Log into the server as root and load the Apache::SME_indexer perl module into pico:

[root@testbed root]# pico /usr/lib/perl5/site_perl/5.6.1/i386-linux/Apache/SME_indexer.pm

Step 2:  Scroll down to the configuration section, Hidden Files sub-section, and modify the $show_hidden_files variable:  set to 1 to list hidden files or zero to keep them hidden:

#------------------------------------------------------------------
#Hidden Files: Set the following variable to 1 to tell the
# indexer to list hidden files, or set to 0 to
# keep hidden files hidden.
#------------------------------------------------------------------
our $show_hidden_files = 0;

Step 3:  Hit Control-X to save changes and exit pico.  

Step 4:  Restart Apache:

[root@testbed root]# /etc/rc.d/init.d/httpd graceful
/usr/sbin/apachectl graceful: httpd gracefully restarted
[root@testbed root]#


Add File and/or Directory Descriptions:

Step 1:  Open a console and log in as root.

Step 2:  Change directories to the html directory where you want to include descriptions.

[root@testbed root]# cd /home/e-smith/files/primary/html/repository/

Step 3:  Create a text file called descriptions.txt using the pico text editor.

[root@testbed repository]# pico descriptions.txt

Step 4:  In pico, create description entries using the format:  name{tab}description.  One entry per line.

How_To_Guides    How To Guides
Contribs    Contributed RPMS
Alpha    Alpha level software

Note:  The description.txt file can contain both file and directory descriptions.  File(directory) entries must be entered exactly as they show on the hard disk.  I find it useful to have a second console open with a listing of the directory I'm writing descriptions for.  Also note that the {tab} symbol written above refers to the tab key, without braces.

Step 5:  Save the file and exit pico by hitting CTRL-X.

Step 6:  Browse to the directory containing your new index descriptions with an HTML browser to verify your work.