function uncheckbox(form, field) {
var price = new Number(form.elements['price' + field].value);
var tmpprice = "";
- var errmsg = "ERROR: Price is not a valid number, please check the price and try again!"
+ var errmsg = _("ERROR: Price is not a valid number, please check the price and try again!")
if (isNaN(price)) {
alert(errmsg);
for(var i=0; i<form.elements['price' + field].value.length; ++i) {
//=======================================================================
// Functions for drag-and-drop functionality
+if( typeof(YAHOO) === "object"){
+ (function() {
-(function() {
-
-var Dom = YAHOO.util.Dom;
-var Event = YAHOO.util.Event;
-var DDM = YAHOO.util.DragDropMgr;
-
-DDApp = {
- init: function() {
- var uls = document.getElementsByTagName('ul');
- var i,j;
- var ddtarget;
- for (i=0; i<uls.length;i=i+1) {
- if (uls[i].className == "draglist" || uls[i].className == "draglist_alt") {
- ddtarget = YAHOO.util.DragDropMgr.getDDById(uls[i].id);
-// The yahoo drag and drop is written (broken or not) in such a way, that if an element is subscribed as a target multiple times,
-// it has to be unlinked multiple times, so we need to test wether it is allready a target, otherwise we'll have a problem when closing the group
- if( ! ddtarget ) {
- new YAHOO.util.DDTarget(uls[i].id);
- }
- var children = uls[i].getElementsByTagName('li');
- for( j=0; j<children.length; j=j+1) {
-// The yahoo drag and drop is (broken or not) in such a way, that if an element is subscribed as a target multiple times,
-// it has to be unlinked multiple times, so we need to test wether it is allready a target, otherwise we'll have a problem when closing the group
- ddtarget = YAHOO.util.DragDropMgr.getDDById(children[j].id);
+ var Dom = YAHOO.util.Dom;
+ var Event = YAHOO.util.Event;
+ var DDM = YAHOO.util.DragDropMgr;
+
+ DDApp = {
+ init: function() {
+ var uls = document.getElementsByTagName('ul');
+ var i,j;
+ var ddtarget;
+ for (i=0; i<uls.length;i=i+1) {
+ if (uls[i].className == "draglist" || uls[i].className == "draglist_alt") {
+ ddtarget = YAHOO.util.DragDropMgr.getDDById(uls[i].id);
+ // The yahoo drag and drop is written (broken or not) in such a way, that if an element is subscribed as a target multiple times,
+ // it has to be unlinked multiple times, so we need to test whether it is allready a target, otherwise we'll have a problem when closing the group
if( ! ddtarget ) {
- new DDList(children[j].id);
+ new YAHOO.util.DDTarget(uls[i].id);
+ }
+ var children = uls[i].getElementsByTagName('li');
+ for( j=0; j<children.length; j=j+1) {
+ // The yahoo drag and drop is (broken or not) in such a way, that if an element is subscribed as a target multiple times,
+ // it has to be unlinked multiple times, so we need to test whether it is allready a target, otherwise we'll have a problem when closing the group
+ ddtarget = YAHOO.util.DragDropMgr.getDDById(children[j].id);
+ if( ! ddtarget ) {
+ new DDList(children[j].id);
+ }
}
}
}
- }
- }
-};
+ }
+ };
-// drag and drop implementation
+ // drag and drop implementation
-DDList = function(id, sGroup, config) {
+ DDList = function(id, sGroup, config) {
- DDList.superclass.constructor.call(this, id, sGroup, config);
+ DDList.superclass.constructor.call(this, id, sGroup, config);
- this.logger = this.logger || YAHOO;
- var el = this.getDragEl();
- Dom.setStyle(el, "opacity", 0.67); // The proxy is slightly transparent
+ this.logger = this.logger || YAHOO;
+ var el = this.getDragEl();
+ Dom.setStyle(el, "opacity", 0.67); // The proxy is slightly transparent
- this.goingUp = false;
- this.lastY = 0;
-};
+ this.goingUp = false;
+ this.lastY = 0;
+ };
-YAHOO.extend(DDList, YAHOO.util.DDProxy, {
+ YAHOO.extend(DDList, YAHOO.util.DDProxy, {
- startDrag: function(x, y) {
- this.logger.log(this.id + " startDrag");
+ startDrag: function(x, y) {
+ this.logger.log(this.id + " startDrag");
- // make the proxy look like the source element
- var dragEl = this.getDragEl();
- var clickEl = this.getEl();
- Dom.setStyle(clickEl, "visibility", "hidden");
+ // make the proxy look like the source element
+ var dragEl = this.getDragEl();
+ var clickEl = this.getEl();
+ Dom.setStyle(clickEl, "visibility", "hidden");
- dragEl.innerHTML = clickEl.innerHTML;
+ dragEl.innerHTML = clickEl.innerHTML;
- Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color"));
- Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor"));
- Dom.setStyle(dragEl, "border", "2px solid gray");
- },
+ Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color"));
+ Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor"));
+ Dom.setStyle(dragEl, "border", "2px solid gray");
+ },
- endDrag: function(e) {
+ endDrag: function(e) {
- var srcEl = this.getEl();
- var proxy = this.getDragEl();
+ var srcEl = this.getEl();
+ var proxy = this.getDragEl();
- // Show the proxy element and animate it to the src element's location
- Dom.setStyle(proxy, "visibility", "");
- var a = new YAHOO.util.Motion(
- proxy, {
- points: {
- to: Dom.getXY(srcEl)
- }
- },
- 0.2,
- YAHOO.util.Easing.easeOut
- )
- var proxyid = proxy.id;
- var thisid = this.id;
-
- // Hide the proxy and show the source element when finished with the animation
- a.onComplete.subscribe(function() {
- Dom.setStyle(proxyid, "visibility", "hidden");
- Dom.setStyle(thisid, "visibility", "");
- });
- a.animate();
-// if we are in basketgrouping page, when finished moving, edit the basket's info to reflect new status
- if(typeof(basketgroups) != 'undefined') {
+ // Show the proxy element and animate it to the src element's location
+ Dom.setStyle(proxy, "visibility", "");
+ var a = new YAHOO.util.Motion(
+ proxy, {
+ points: {
+ to: Dom.getXY(srcEl)
+ }
+ },
+ 0.2,
+ YAHOO.util.Easing.easeOut
+ )
+ var proxyid = proxy.id;
+ var thisid = this.id;
+
+ // Hide the proxy and show the source element when finished with the animation
a.onComplete.subscribe(function() {
- var reg = new RegExp("[-]+", "g");
-// add a changed input to each moved basket, so we know which baskets to modify,
-// and so we don't need to modify each and every basket and basketgroup each time the page is loaded
-// FIXME: we shouldn't use getElementsByTagName, it's not explicit enough :-(
- srcEl.getElementsByTagName('input')[1].value = "1";
- if ( srcEl.parentNode.parentNode.className == "workarea" ) {
- var dstbgroupid = srcEl.parentNode.parentNode.getElementsByTagName('input')[srcEl.parentNode.parentNode.getElementsByTagName('input').length-2].name.split(reg)[1];
- srcEl.className="grouped";
- srcEl.getElementsByTagName('input')[0].value = dstbgroupid;
-//FIXME: again, we shouldn't be using getElementsByTagName!!
- srcEl.parentNode.parentNode.getElementsByTagName('input')[srcEl.parentNode.parentNode.getElementsByTagName('input').length-1].value = 1;
- }
- else if ( srcEl.parentNode.parentNode.className == "workarea_alt" ){
- srcEl.className="ungrouped";
- srcEl.getElementsByTagName('input')[0].value = "0";
- }
- });
- }
- },
+ Dom.setStyle(proxyid, "visibility", "hidden");
+ Dom.setStyle(thisid, "visibility", "");
+ });
+ a.animate();
+ // if we are in basketgrouping page, when finished moving, edit the basket's info to reflect new status
+ if(typeof(basketgroups) != 'undefined') {
+ a.onComplete.subscribe(function() {
+ var reg = new RegExp("[-]+", "g");
+ // add a changed input to each moved basket, so we know which baskets to modify,
+ // and so we don't need to modify each and every basket and basketgroup each time the page is loaded
+ // FIXME: we shouldn't use getElementsByTagName, it's not explicit enough :-(
+ srcEl.getElementsByTagName('input')[1].value = "1";
+ if ( srcEl.parentNode.parentNode.className == "workarea" ) {
+ var dstbgroupid = srcEl.parentNode.parentNode.getElementsByTagName('input')[srcEl.parentNode.parentNode.getElementsByTagName('input').length-2].name.split(reg)[1];
+ srcEl.className="grouped";
+ srcEl.getElementsByTagName('input')[0].value = dstbgroupid;
+ //FIXME: again, we shouldn't be using getElementsByTagName!!
+ srcEl.parentNode.parentNode.getElementsByTagName('input')[srcEl.parentNode.parentNode.getElementsByTagName('input').length-1].value = 1;
+ }
+ else if ( srcEl.parentNode.parentNode.className == "workarea_alt" ){
+ srcEl.className="ungrouped";
+ srcEl.getElementsByTagName('input')[0].value = "0";
+ }
+ });
+ }
+ },
- onDragDrop: function(e, id) {
+ onDragDrop: function(e, id) {
- // If there is one drop interaction, the li was dropped either on the list,
- // or it was dropped on the current location of the source element.
- if (DDM.interactionInfo.drop.length === 1) {
+ // If there is one drop interaction, the li was dropped either on the list,
+ // or it was dropped on the current location of the source element.
+ if (DDM.interactionInfo.drop.length === 1) {
- // The position of the cursor at the time of the drop (YAHOO.util.Point)
- var pt = DDM.interactionInfo.point;
+ // The position of the cursor at the time of the drop (YAHOO.util.Point)
+ var pt = DDM.interactionInfo.point;
- // The region occupied by the source element at the time of the drop
- var region = DDM.interactionInfo.sourceRegion;
+ // The region occupied by the source element at the time of the drop
+ var region = DDM.interactionInfo.sourceRegion;
- // Check to see if we are over the source element's location. We will
- // append to the bottom of the list once we are sure it was a drop in
- // the negative space (the area of the list without any list items)
- if (!region.intersect(pt)) {
- var destEl = Dom.get(id);
- var destDD = DDM.getDDById(id);
- destEl.appendChild(this.getEl());
- destDD.isEmpty = false;
- DDM.refreshCache();
+ // Check to see if we are over the source element's location. We will
+ // append to the bottom of the list once we are sure it was a drop in
+ // the negative space (the area of the list without any list items)
+ if (!region.intersect(pt)) {
+ var destEl = Dom.get(id);
+ var destDD = DDM.getDDById(id);
+ destEl.appendChild(this.getEl());
+ destDD.isEmpty = false;
+ DDM.refreshCache();
+ }
}
- }
- },
+ },
- onDrag: function(e) {
+ onDrag: function(e) {
- // Keep track of the direction of the drag for use during onDragOver
- var y = Event.getPageY(e);
+ // Keep track of the direction of the drag for use during onDragOver
+ var y = Event.getPageY(e);
- if (y < this.lastY) {
- this.goingUp = true;
- } else if (y > this.lastY) {
- this.goingUp = false;
- }
- this.lastY = y;
- },
+ if (y < this.lastY) {
+ this.goingUp = true;
+ } else if (y > this.lastY) {
+ this.goingUp = false;
+ }
+ this.lastY = y;
+ },
- onDragOver: function(e, id) {
+ onDragOver: function(e, id) {
- var srcEl = this.getEl();
- var destEl = Dom.get(id);
+ var srcEl = this.getEl();
+ var destEl = Dom.get(id);
- // We are only concerned with list items, we ignore the dragover
- // notifications for the list.
- if (destEl.nodeName.toLowerCase() == "li") {
- var orig_p = srcEl.parentNode;
- var p = destEl.parentNode;
+ // We are only concerned with list items, we ignore the dragover
+ // notifications for the list.
+ if (destEl.nodeName.toLowerCase() == "li") {
+ var orig_p = srcEl.parentNode;
+ var p = destEl.parentNode;
- if (this.goingUp) {
- p.insertBefore(srcEl, destEl); // insert above
- } else {
- p.insertBefore(srcEl, destEl.nextSibling); // insert below
- }
+ if (this.goingUp) {
+ p.insertBefore(srcEl, destEl); // insert above
+ } else {
+ p.insertBefore(srcEl, destEl.nextSibling); // insert below
+ }
- DDM.refreshCache();
+ DDM.refreshCache();
+ }
}
- }
-});
-})();
-
+ });
+ })();
+}
if(document.location = '/cgi-bin/koha/acqui/basketgroup.pl?op=closeandprint&basketgroupid=' + bg ){
setTimeout("window.location.reload();",3000);
}else{
- alert(_('Error downloading the file'));
+ alert(_("Error downloading the file"));
}
}
logLine.appendChild(log.window_.document.createTextNode(message));
log.window_.document.body.appendChild(logLine);
}
-//=======================================================================
-
-
- function ownerPopup(f) {
- window.open("/cgi-bin/koha/admin/aqbudget_owner_search.pl?op=budget",'PatronPopup','width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
- }
- //
//=======================================================================
function getElementsByClass( searchClass, domNode, tagName) {
if (domNode == null) domNode = document;
// NEXT BLOCK IS USED BY NEWORDERBEMPTY
-function calcNeworderTotal(){
- //collect values
- var f = document.getElementById('Aform');
- var quantity = new Number(f.quantity.value);
- var discount = new Number(f.discount.value);
- var listinc = new Number (f.listinc.value);
- //var currency = f.currency.value;
- var applygst = new Number (f.applygst.value);
- var listprice = new Number(f.listprice.value);
- var invoiceingst = new Number (f.invoiceincgst.value);
-// var exchangerate = new Number(f.elements[currency].value); //get exchange rate
- var currcode = new String(document.getElementById('currency').value);
- var exchangerate = new Number(document.getElementById(currcode).value);
-
- var gst_on=(!listinc && invoiceingst);
-
- //do real stuff
+function updateCosts(){
+ var quantity = new Number($("#quantity").val());
+ var discount = new Number($("#discount").val());
+ var applygst = new Number ($("#applygst").val());
+ var listprice = new Number($("#listprice").val());
+ var currcode = new String($("#currency").val());
+ var exchangerate = new Number($("#currency_rate_"+currcode).val());
+ var gst_on=false;
+
var rrp = new Number(listprice*exchangerate);
- var ecost = new Number(rrp * (100 - discount ) / 100);
- var GST = new Number(0);
- if (gst_on) {
- rrp=rrp * (1+f.gstrate.value / 100);
- GST=ecost * f.gstrate.value / 100;
+ var ecost = rrp;
+ if ( 100-discount != 100 ) { //Prevent rounding issues if no discount
+ ecost = new Number(Math.floor(rrp * (100 - discount )) / 100);
}
+ var total = new Number( ecost * quantity);
+ $("#rrp").val(rrp.toFixed(2));
+ $("#ecost").val(ecost.toFixed(2));
+ $("#total").val(total.toFixed(2));
+ $("listprice").val(listprice.toFixed(2));
- var total = new Number( (ecost + GST) * quantity);
-
- f.rrp.value = rrp.toFixed(2);
-
-// f.rrp.value = rrp
-// f.rrp.value = 'moo'
-
- f.ecost.value = ecost.toFixed(2);
- f.total.value = total.toFixed(2);
- f.listprice.value = listprice.toFixed(2);
-
-// gst-stuff needs verifing, mason.
- if (f.GST) {
- f.GST.value=GST;
- }
return true;
}
// var currency = f.currency.value;
var currcode = new String(document.getElementById('currency').value);
var price = new Number(document.getElementById('price').value);
- var exchangerate = new Number(document.getElementById(currcode).value);
+ var exchangerate = new Number(document.getElementById('currency_rate_'+currcode).value);
var total = new Number(quantity*price*exchangerate);
for (i=1;i<=2;i++) {
- var sort_dropbox = document.getElementById('sort'+i);
+ var sort_zone = document.getElementById('sort'+i+'_zone');
var url = '../acqui/fetch_sort_dropbox.pl?sort='+i+'&budget_id='+budgetId;
var xmlhttp = null;
}
};
// rc = eval ( xmlhttp.responseText );
- sort_dropbox.innerHTML = xmlhttp.responseText;
+ var retRootType = xmlhttp.responseXML.firstChild.nodeName;
+ var existingInputs = sort_zone.getElementsByTagName('input');
+ if (existingInputs.length > 0 && retRootType == 'input') {
+ // when sort is already an input, do not override to preseve value
+ return;
+ }
+ sort_zone.innerHTML = xmlhttp.responseText;
}
}
}
}
-
-function addColumn(p_sType, p_aArgs, p_oValue)
-{
- var allRows = document.getElementById('plan').rows;
- var colnum = p_oValue[0];
- var code = p_oValue[1];
- var colnum = new Number(colnum);
-
- for (var i=0; i<allRows.length; i++) {
- var allCells = allRows[i].cells;
- allCells[colnum+1].style.display="table-cell";
- }
-
-// make a menuitem object
- var hids = document.getElementsByName("hide_cols")
- for (var i=0; i<hids.length; i++) {
- if (hids[i].value == code) {
- var x = hids[i];
- x.parentNode.removeChild(x) // sigh...
- break;
- }
- }
+function hideColumn(num) {
+ $("#hideall,#showall").removeAttr("checked").parent().removeClass("selected");
+ $("#"+num).parent().removeClass("selected");
+ var hide = Number(num.replace("col","")) + 2;
+ // hide header and cells matching the index
+ $("#plan td:nth-child("+hide+"),#plan th:nth-child("+hide+")").toggle();
}
-
-function delColumn(n, code)
-{
- var allRows = document.getElementById('plan').rows;
-
-// find index
- var index;
- var nn = new Number(n);
- var code = code ;
- for (var i=0; i<allRows.length; i++) {
- var allCells = allRows[i].cells;
- allCells[nn+1].style.display="none";
- }
-
- var r = 0;
- var hids = document.getElementsByName("hide_cols")
- for (var i=0; i<hids.length; i++) {
- if (hids[i].value == code) {
- r = 1;
- break;
- }
- }
-
- if (r == 0 ) {
- // add hide_col to form
- var el = document.createElement("input");
- el.setAttribute("type", 'hidden' );
- el.setAttribute("value", code);
- el.setAttribute("name", 'hide_cols');
- document.getElementById("hide_div").appendChild(el);
- }
+function showColumn(num){
+ $("#hideall").removeAttr("checked").parent().removeClass("selected");
+ $("#"+num).parent().addClass("selected");
+ // set the index of the table column to hide
+ show = Number(num.replace("col","")) + 2;
+ // hide header and cells matching the index
+ $("#plan td:nth-child("+show+"),#plan th:nth-child("+show+")").toggle();
}
-
+function showAllColumns(){
+ $("#selections").checkCheckboxes();
+ $("#selections span").addClass("selected");
+ $("#plan td:nth-child(2),#plan tr th:nth-child(2)").nextAll().show();
+ $("#hideall").removeAttr("checked").parent().removeClass("selected");
+}
+function hideAllColumns(){
+ var allCols = $("#plan th").length;
+ $("#selections").unCheckCheckboxes();
+ $("#selections span").removeClass("selected");
+ $("#plan td:nth-child(2),#plan th:nth-child(2)").nextUntil("th:nth-child("+(allCols-1)+"),td:nth-child("+(allCols-1)+")").hide(); // hide all but the last two columns
+ $("#hideall").attr("checked","checked").parent().addClass("selected");
+}
\ No newline at end of file