Moving some common javascript stuff into an include file. Adding verify_images function to handle missing patron images in circulation and moremember

This commit is contained in:
oleonard 2006-03-08 23:07:05 +00:00
parent b7bdfda952
commit 9506e591b2
4 changed files with 56 additions and 99 deletions

View File

@ -0,0 +1,52 @@
<script language="javascript" type="text/javascript">
function Help() {
newin=window.open("/cgi-bin/koha/help.pl","Koha Help",'width=600,height=600,toolbar=false,scrollbars=yes');
}
function openWindow(targeturl, windowname) {
newwin =
window.open(targeturl,windowname,"height=480,width=640,scrollbars,resizable")
}
var newwin;
// Open the popup window if it doesn't already exist and give it focus.
function PopWin(targeturl, windowname) {
if (!newwin || newwin.closed) newwin = window.open(targeturl,windowname, "height=300,width=400,scrollbars=yes,resizable=yes");
newwin.focus();
}
// Set the value of the form field to the passed value and optionally shift
// focus and close the popup.
function FillForm(val,formname,formfield) {
document.forms[formname].elements[formfield].value = val;
// Uncomment below to shift focus after clicking link in popup.
document.forms[formname].elements[formfield].focus();
// Uncomment below to close popup after clicking link.
newwin.close();
}
// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
function verify_images() {
for (var i = 0; i < document.images.length; i++) {
img = document.images[i];
if ((img.src.indexOf('images') >= 0)) {
w = img.width;
h = img.height;
if ((w == 0) && (h == 0) || ((img.complete != null) && (!img.complete))) {
img.src = '<!-- TMPL_VAR NAME='themelang' -->/images/patron-blank.png';
}
}
}
}
function mainfocus() {
if(document.forms['mainform']){
document.forms['mainform'].elements[0].focus();
}
}
</script>

View File

@ -5,40 +5,7 @@
<!-- TMPL_IF NAME="intranetstylesheet" -->@import url(<!-- TMPL_VAR NAME='themelang' -->/includes/<!-- TMPL_VAR NAME="intranetstylesheet" -->);<!-- TMPL_ELSE -->@import url(<!-- TMPL_VAR NAME='themelang' -->/includes/intranet.css);<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="intranetcolorstylesheet" -->@import url(<!-- TMPL_VAR NAME='themelang' -->/includes/<!-- TMPL_VAR NAME="intranetcolorstylesheet" -->);<!-- /TMPL_IF -->
</style>
<script language="JavaScript" type="text/javascript">
<!-- Hide from old browsers
function Help() {
newin=window.open("/cgi-bin/koha/help.pl","Koha Help",'width=600,height=600,toolbar=false,scrollbars=yes');
}
function openWindow(targeturl, windowname) {
newwin =
window.open(targeturl,windowname,"height=480,width=640,scrollbars,resizable")
}
var newwin;
// Open the popup window if it doesn't already exist and give it focus.
function PopWin(targeturl, windowname) {
if (!newwin || newwin.closed) newwin = window.open(targeturl,windowname, "height=300,width=400,scrollbars=yes,resizable=yes");
newwin.focus();
}
// Set the value of the form field to the passed value and optionally shift
// focus and close the popup.
function FillForm(val,formname,formfield) {
document.forms[formname].elements[formfield].value = val;
// Uncomment below to shift focus after clicking link in popup.
document.forms[formname].elements[formfield].focus();
// Uncomment below to close popup after clicking link.
newwin.close();
}
// end hiding -->
</script>
<!-- TMPL_INCLUDE NAME="common.js.inc" -->
</head>
<body onload="document.forms['mainform'].elements[0].focus();">
<body onload="verify_images(); mainfocus(); ">

View File

@ -6,40 +6,7 @@
<!-- TMPL_IF NAME="intranetcolorstylesheet" -->@import url(<!-- TMPL_VAR NAME='themelang' -->/includes/<!-- TMPL_VAR NAME="intranetcolorstylesheet" -->);<!-- /TMPL_IF -->
@import url(<!-- TMPL_VAR NAME='themelang' -->/includes/marc-editor.css);
</style>
<script language="JavaScript" type="text/javascript">
<!-- Hide from old browsers
function Help() {
newin=window.open("/cgi-bin/koha/help.pl","Koha Help",'width=600,height=600,toolbar=false,scrollbars=yes');
}
function openWindow(targeturl, windowname) {
newwin =
window.open(targeturl,windowname,"height=480,width=640,scrollbars,resizable")
}
var newwin;
// Open the popup window if it doesn't already exist and give it focus.
function PopWin(targeturl, windowname) {
if (!newwin || newwin.closed) newwin = window.open(targeturl,windowname, "height=300,width=400,scrollbars=yes,resizable=yes");
newwin.focus();
}
// Set the value of the form field to the passed value and optionally shift
// focus and close the popup.
function FillForm(val,formname,formfield) {
document.forms[formname].elements[formfield].value = val;
// Uncomment below to shift focus after clicking link in popup.
document.forms[formname].elements[formfield].focus();
// Uncomment below to close popup after clicking link.
newwin.close();
}
// end hiding -->
</script>
<!-- TMPL_INCLUDE NAME="common.js.inc" -->
</head>
<body onload="loading();">

View File

@ -5,39 +5,10 @@
<!-- TMPL_IF NAME="intranetstylesheet" -->@import url(<!-- TMPL_VAR NAME='themelang' -->/includes/<!-- TMPL_VAR NAME="intranetstylesheet" -->);<!-- TMPL_ELSE -->@import url(<!-- TMPL_VAR NAME='themelang' -->/includes/intranet.css);<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="intranetcolorstylesheet" -->@import url(<!-- TMPL_VAR NAME='themelang' -->/includes/<!-- TMPL_VAR NAME="intranetcolorstylesheet" -->);<!-- /TMPL_IF -->
</style>
<!-- TMPL_INCLUDE NAME="common.js.inc" -->
<script language="JavaScript" type="text/javascript">
<!-- Hide from old browsers
function Help() {
newin=window.open("/cgi-bin/koha/help.pl","Koha Help",'width=600,height=600,toolbar=false,scrollbars=yes');
}
function openWindow(targeturl, windowname) {
newwin =
window.open(targeturl,windowname,"height=480,width=640,scrollbars,resizable")
}
var newwin;
// Open the popup window if it doesn't already exist and give it focus.
function PopWin(targeturl, windowname) {
if (!newwin || newwin.closed) newwin = window.open(targeturl,windowname, "height=300,width=400,scrollbars=yes,resizable=yes");
newwin.focus();
}
// Set the value of the form field to the passed value and optionally shift
// focus and close the popup.
function FillForm(val,formname,formfield) {
document.forms[formname].elements[formfield].value = val;
// Uncomment below to shift focus after clicking link in popup.
document.forms[formname].elements[formfield].focus();
// Uncomment below to close popup after clicking link.
newwin.close();
}
function CheckAll() {
count = document.mainform.elements.length;
for (i=0; i < count; i++) {