|
| 1 | +# |
| 2 | +# Description: These are routines that are specific to your installation and |
| 3 | +# should be customized for your needs. This file is a template |
| 4 | +# only. Make a copy of this file as ProjectRoutines.pm (no |
| 5 | +# "template") and make your changes there. Basically you can use ProjectHeader, |
| 6 | +# ProjectBodyStart, ProjectFooter, and DocDBFooter to make DocDB web pages |
| 7 | +# just like the web pages for the rest of your project. If you don't want to do |
| 8 | +# any customization or just want to test DocDB, these routines work as-is. |
| 9 | +# A global variable $Public is used (when set) to remove elements from the |
| 10 | +# nav-bars that the public has no interest in. The variable is global |
| 11 | +# and can control the style of your headers and footers too. |
| 12 | +# |
| 13 | +# Author: Eric Vaandering (ewv@fnal.gov) |
| 14 | +# Modified: |
| 15 | + |
| 16 | +# Copyright 2001-2013 Eric Vaandering, Lynn Garren, Adam Bryant |
| 17 | + |
| 18 | +# This file is part of DocDB. |
| 19 | + |
| 20 | +# DocDB is free software; you can redistribute it and/or modify |
| 21 | +# it under the terms of version 2 of the GNU General Public License |
| 22 | +# as published by the Free Software Foundation. |
| 23 | + |
| 24 | +# DocDB is distributed in the hope that it will be useful, |
| 25 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 26 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 27 | +# GNU General Public License for more details. |
| 28 | + |
| 29 | +# You should have received a copy of the GNU General Public License |
| 30 | +# along with DocDB; if not, write to the Free Software |
| 31 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 32 | + |
| 33 | +sub ProjectHeader { |
| 34 | + my ($Title,$PageTitle) = @_; |
| 35 | + |
| 36 | +# This routine is reponsible for whatever HTML you want to write in the <HEAD> |
| 37 | +# section of the page. You can embed style sheets, etc. |
| 38 | +# |
| 39 | +# $Title is what is in the <title> element while $PageTitle is the title of |
| 40 | +# the page you may put in the text of the page. They are provided here for |
| 41 | +# your convenience, but you should not print the <title> here since DocDB |
| 42 | +# already takes care of that. |
| 43 | + |
| 44 | +# Here is a link to a style sheet. |
| 45 | + |
| 46 | +# print "<link rel=\"stylesheet\" href=\"/includes/style.css\" type=\"text/css\">\n"; |
| 47 | + print '<link rel="stylesheet" type="text/css" href="https://documents.egi.eu/export/system/modules/eu.egi.www/resources/d2/css/screen.css" media="screen" />'; |
| 48 | +} |
| 49 | + |
| 50 | +sub ProjectBodyStart { |
| 51 | + |
| 52 | +# This routine is called after the <body> tag is written. Here you can put your |
| 53 | +# project specific HTML. You might want to put the document title too, as a |
| 54 | +# header. ($Title is what is in the <title> element while $PageTitle is the |
| 55 | +# title of the page you may put in the text of the page.) |
| 56 | + |
| 57 | +print ' |
| 58 | +<div id="container"> |
| 59 | + <div id="head"> |
| 60 | +
|
| 61 | + <div id="site-title"> |
| 62 | + <a class="over-image" href="/">EGI<span></span></a> |
| 63 | + </div> |
| 64 | + |
| 65 | + <div class="phrase over-image"> |
| 66 | + </div> |
| 67 | + </div> |
| 68 | +'; |
| 69 | + |
| 70 | +print ' |
| 71 | + <div class="right-content"> |
| 72 | + <div id="page-header"> |
| 73 | +'; |
| 74 | + |
| 75 | + |
| 76 | + my ($Title,$PageTitle) = @_; |
| 77 | + my @TitleParts = split /\s+/, $PageTitle; |
| 78 | + $PageTitle = join ' ',@TitleParts; |
| 79 | + |
| 80 | + require "Images.pm"; |
| 81 | + |
| 82 | + my ($path,$query) = @ENV{qw/SCRIPT_NAME QUERY_STRING/}; |
| 83 | + $path =~ s/^$cgi_path//; |
| 84 | + $path =~ s/^\/+//; |
| 85 | + if ($Public) { |
| 86 | + $txt = qq{<b>Public area</b><br/><a href="$secure_root$path?$query">Login</a>}; |
| 87 | + $icon = 'Unlock'; |
| 88 | + $id = ''; |
| 89 | + } |
| 90 | + else { |
| 91 | + if (stat("/opt/DocDB/public/$path")) { |
| 92 | + $txt = qq{<b>Restricted area</b> <br/><a href="$public_root$path?$query">Logout</a>}; |
| 93 | + } else { |
| 94 | + $txt = qq{<b>Restricted area</b> <br/><a href="$public_root">Logout</a>}; |
| 95 | + } |
| 96 | + $icon = 'Lock'; |
| 97 | + $id = "Logged in as $ENV{SSL_CLIENT_S_DN_CN}"; |
| 98 | + } |
| 99 | + |
| 100 | +#<table style="text-align: left; width: 200px; margin-left: auto; margin-right: 0px;"> |
| 101 | + print qq{ |
| 102 | +<table style="width: 200px; float: right;"> |
| 103 | +<tr> |
| 104 | +<td>$txt</td> |
| 105 | +<td> |
| 106 | +<img src="$ImgURLPath/$ImageNames{$icon}"/> |
| 107 | +</td> |
| 108 | +</tr> |
| 109 | +<tr> |
| 110 | +<td colspan="2">$id</td> |
| 111 | +</tr> |
| 112 | +</table> |
| 113 | +}; |
| 114 | + |
| 115 | +print ' |
| 116 | + <h1>Document Server</h1> |
| 117 | + <div class="navigation"> |
| 118 | + <a href="http://www.egi.eu/">Home</a> > <a href="http://www.egi.eu/about/">About EGI.eu</a> > <a href="http://www.egi.eu/about/intranet/">Intranet</a> > <strong>DocDB</strong> |
| 119 | + </div><!-- end navigation --> |
| 120 | + </div><!-- end page-header --> |
| 121 | + <div class="page-content "> |
| 122 | +'; |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + print "<h1>$PageTitle</h1>\n"; |
| 127 | + # show the navbar at the top of the page as well as at the bottom |
| 128 | + if ($dbh) { |
| 129 | + &DocDBNavBar(); |
| 130 | + } |
| 131 | +} |
| 132 | + |
| 133 | +sub ProjectFooter { |
| 134 | + require "DocDBVersion.pm"; |
| 135 | + |
| 136 | + my ($WebMasterEmail,$WebMasterName) = @_; |
| 137 | + |
| 138 | +# This routine is reponsible for whatever you want to put as a footer on the |
| 139 | +# page. |
| 140 | +# |
| 141 | +# Parameters are supplied for the name and e-mail address of the person |
| 142 | +# responsible for the pages. We would appreciate it if you keep the link to |
| 143 | +# the DocDB home page present. |
| 144 | + |
| 145 | +# You probably want to include some version of this: |
| 146 | + |
| 147 | + print "<p><small>\n"; |
| 148 | + print "<a href=\"$DocDBHome\">DocDB</a>, "; |
| 149 | +# print "Version $DocDBVersion, contact \n"; |
| 150 | + print "Contact: \n"; |
| 151 | + print "<i>\n"; |
| 152 | + print "<a href=\"mailto:$WebMasterEmail\">$WebMasterName</a>\n"; |
| 153 | + print "</i>\n"; |
| 154 | + print "</small><br/>\n"; |
| 155 | + |
| 156 | +# This prints benchmark info for pages that have it |
| 157 | + |
| 158 | + if ($EndTime && $StartTime) { |
| 159 | + my $TimeDiff = timediff($EndTime,$StartTime); |
| 160 | + print "<small><b>Execution time: </b>",timestr($TimeDiff),"</small>\n"; |
| 161 | + } |
| 162 | + print "</p>\n"; |
| 163 | + |
| 164 | +# Do not print the </body> and </html> tags, DocDB does that now. |
| 165 | + |
| 166 | +use Time::Piece; |
| 167 | +my $t = Time::Piece->new(); |
| 168 | + |
| 169 | +print ' |
| 170 | + </div> |
| 171 | + </div> |
| 172 | + <div class="clear"></div> |
| 173 | +</div> |
| 174 | +<div id="footer"> |
| 175 | +<div class="float-left"> |
| 176 | + © '.$t->year.' <strong>EGI Foundation</strong><br /> |
| 177 | + Website hosted by CESNET, Brno on behalf of EGI.eu, <a href="mailto:contact@egi.eu">contact@egi.eu</a> |
| 178 | +
|
| 179 | + </div> |
| 180 | + <div class="float-right align-right"> |
| 181 | + <a href="http://www.egi.eu/">Disclaimers</a> | |
| 182 | + <a href="http://www.egi.eu/site-map/">Site map</a> | |
| 183 | + <a href="http://www.egi.eu/about/contact/">Contact</a> | |
| 184 | +
|
| 185 | + <a href="http://www.egi.eu/about/">About</a><br /> |
| 186 | + <div class="clear"></div> |
| 187 | +</div> |
| 188 | +'; |
| 189 | +} |
| 190 | + |
| 191 | +sub DocDBNavBar { |
| 192 | + |
| 193 | +# This routine prints the navigation bar just above the footer on the |
| 194 | +# page. |
| 195 | +# This provides a good default, but you can customize for your installation |
| 196 | +# and include an optional extra description and URL (e.g. for a related page). |
| 197 | + |
| 198 | + |
| 199 | + my ($ExtraDesc,$ExtraURL) = @_; |
| 200 | + |
| 201 | + require "Security.pm"; |
| 202 | + |
| 203 | + print "<div class=\"DocDBNavBar\">\n"; |
| 204 | + if ($ExtraDesc && $ExtraURL) { |
| 205 | + print "[ <a href=\"$ExtraURL\">$ExtraDesc</a> ] \n"; |
| 206 | + } |
| 207 | + print "[ <a href=\"$MainPage\">DocDB Home</a> ] \n"; |
| 208 | + if (&CanAdminister()) { |
| 209 | + print "[ <a href=\"$AdministerHome\">Administer</a> ] \n"; |
| 210 | + } |
| 211 | + if (&CanCreate()) { |
| 212 | + print "[ <a href=\"$DocumentAddForm?mode=add\">New</a> ] \n"; |
| 213 | + } |
| 214 | + print "[ <a href=\"$SearchForm\">Search</a> ]\n"; |
| 215 | + print "[ <a href=\"$ListBy?days=$LastDays\">Last $LastDays Days</a> ]\n"; |
| 216 | + print "[ <a href=\"$ListAuthors\">List Authors</a> ]\n"; |
| 217 | + print "[ <a href=\"$ListTopics\">List Topics</a> ]\n"; |
| 218 | + print "[ <a href=\"$ListAllMeetings\">List Events</a> ]\n"; |
| 219 | + unless ($Public) { |
| 220 | + print "[ <a href=\"$DocDBInstructions\">Help</a> ]\n"; |
| 221 | + } |
| 222 | + print "</div>\n"; |
| 223 | +} |
| 224 | + |
| 225 | +sub ProjectReferenceLink (;$$$$) { |
| 226 | + my ($Acronym,$Volume,$Page,$ReferenceID) = @_; |
| 227 | + |
| 228 | +# This routine is used to add links to and optionally replace the text of |
| 229 | +# references specific to the project. |
| 230 | +# See ReferenceLink in ReferenceLinks.pm for examples. |
| 231 | + |
| 232 | + my $ReferenceLink = ""; |
| 233 | + my $ReferenceText = ""; |
| 234 | + |
| 235 | + return ($ReferenceLink,$ReferenceText); |
| 236 | +} |
| 237 | + |
| 238 | +# Often times groups may have CSS or other files that are used in Server |
| 239 | +# Side Includes. This function replicates that functionality |
| 240 | + |
| 241 | +#sub SSInclude { |
| 242 | +# my ($file) = @_; |
| 243 | +# open SSI,"$SSIDirectory$file"; |
| 244 | +# my @SSI_lines = <SSI>; |
| 245 | +# close SSI; |
| 246 | +# print @SSI_lines; |
| 247 | +#} |
| 248 | + |
| 249 | +1; |
0 commit comments