Setting Up the iPrint Client to Use the Local iPrint Printer Map
Novell Cool Solutions: Tip
By Ron Imsland
Digg This -
Updated: 26 Sep 2005
Users would like to have the "Find/Install printers" option on the iPrint Client icon send them to their local iPrint printer map but normally that would require a different client setting for each location.
As long as your WAN users can connect directly to your internal webserver (i.e. not going through any NAT) and each location has at least one unique octet in the IP Address, then you can use Server Side Includes for the webserver to determine the workstation's IP address along with a redirection script in your "Find/Install printers" webpage to redirect the workstation to their local iPrint map.
Server Side Includes provide a nice array of informational variables as well as the full list of CGI Environmental variables which is what we will be using: the "REMOTE_ADDR" CGI variable which tells the webserver the IP Address of the computer accessing its webpage.
To enable SSI on Apache2 for NetWare, we simply add the directory options to the HTTPD.CONF file located in the SYS\APACHE2\CONF\ folder. For simplicity to keep my iPrint URL short, I enabled SSI on my HTDOCS folder by looking for the section titled: <Directory "SYS:/APACHE2/htdocs"> in the HTTPD.CONF file.
Under that heading is an Options statement. To turn on SSI for that folder, simply append the following to the end of the Options statement:
Also add the following individual lines anywhere before the end of the section:
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Using those instructions, my entire htdocs directory section now looks like this:
<Directory "SYS:/APACHE2/htdocs"> # # This should be changed to whatever you set DocumentRoot to. # Options Indexes FollowSymLinks +Includes AllowOverride None Order allow,deny Allow from all AddType text/html .shtml AddOutputFilter INCLUDES .shtml </Directory>
Technically, you could enable SSI for any file extension you choose, even HTM or HTML (by changing the extensions of the two additional lines), but I've heard that there are performance issues if you make the server check too many files for SSI code so I opted to keep it only parsing SHTML files.
Once you have your HTTPD.CONF file changed, restart Apache2.
ipAddress = "<!--#echo var="REMOTE_ADDR" -->";
ipAddress = "192.168.1.200"
var octet = new Array() octet = ipAddress.split('.');
Once that command runs, we end up with a four-valued array as follows (note: the first member of any array is always 0):
octet = 192
octet = 168
octet = 1
octet = 200
The SPLIT command used the period in the IP Address as its focus where to split up the numbers but the output of it ignores the focus character when it creates the separate array variables.
if (octet=="192" && octet=="1") window.location = "ippdocs/Location1.htm"; else if (octet=="192" && octet=="2") window.location = "ippdocs/Location2.htm"; else if (octet=="192" && octet=="3") window.location = "ippdocs/Location3.htm"; else if (octet=="192" && octet=="31") window.location = "ippdocs/Location4.htm"; else if (octet=="192" && octet=="32") window.location = "ippdocs/Location5.htm"; else window.location = "ippdocs/masterlist.htm";
You can use any number of combinations of the octets and any number of "Else If" commands to match your own locations. If you need to check the first three octets, just use another && section to the IF statement like this:
if (octet=="192" && octet=="168" && octet=="1") window.location = "ippdocs/Location5.htm";
The final ELSE command is used to direct the browser to the master site list in case the IP address doesn't match anything in the script.
That's it. Once you modify the details of the IP Address octets and the location of the HTM files for each location, the text of the entire IPRINT.SHTML webpage should look something like this:
After that's all finished, all you need to do is distribute the one single address to all your workstations. We used a simple ZENWorks app to change the registry settings for the Novell IPrint Client. Here's the text of a .REG file that you can import into the ZENWorks app that changes the key and values you need to change:
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Printers] "Tray Icon Setting"=dword:00000001 "Tray Icon Link"="http://printing/iprint.shtml" [HKEY_USERS\.DEFAULT\Printers] "Tray Icon Setting"=dword:00000001 "Tray Icon Link"="http://printing/iprint.shtml"
Apache Webserver with Server Side Includes (SSI) enabled
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com