Index: trunk/core/admin_templates/js/calendar.js =================================================================== diff -u -N --- trunk/core/admin_templates/js/calendar.js (revision 0) +++ trunk/core/admin_templates/js/calendar.js (revision 6656) @@ -0,0 +1,1318 @@ +var cbPath = ""; + /* +preloadImage(cbPath); +preloadImage(cbPathO); +preloadImage(cbPathA); +*/ + +//addScript("core.js"); +//addScript("lang.js"); + +//addCss("wnd.css"); +//addCss("calendar.css"); + +function initCalendar(id, dateFormat) +{ + var input = document.getElementById(id); + if (!input) return; + input.dateFormat = dateFormat; + var cbPath = input.getAttribute("datepickerIcon"); + + var inputContainer = document.createElement("DIV"); + inputContainer.className = "dpContainer"; + inputContainer.noWrap = true; + var pNode = input.parentNode; + pNode.insertBefore(inputContainer, input.nextSibling); +// inputContainer.appendChild(pNode.removeChild(input)); + + var calendarButton = document.createElement("IMG"); + calendarButton.setAttribute("width", "24"); + calendarButton.setAttribute("height", "24"); + calendarButton.setAttribute("align", "absMiddle"); + calendarButton.style.width=24 + calendarButton.style.height=24 + calendarButton.style.cursor = "hand"; + + calendarButton.setAttribute("hspace", 2); + calendarButton.src = cbPath; + calendarButton.onmouseover = cbMouseOver; + calendarButton.onmouseout = cbMouseOut; + calendarButton.onmouseup = calendarButton.onmouseout; + calendarButton.onmousedown = cbMouseDown; + calendarButton.showCalendar = wnd_showCalendar; + inputContainer.appendChild(calendarButton); + inputContainer.dateInput = input; +} + +var calendar; + +function cbMouseOver(e) +{ +// this.src = cbPathO; + var evt = (e) ? e : event; if (evt) evt.cancelBubble = true; +} + +function cbMouseOut(e) +{ +// this.src = cbPath; + var evt = (e) ? e : event; if (evt) evt.cancelBubble = true; +} + +function cbMouseDown(e) +{ +// this.src = cbPathA; + // alert("cbMouseDown"); + var evt = (e) ? e : event; if (evt) evt.cancelBubble = true; + this.showCalendar(); +} + +function wnd_showCalendar() +{ + var el = this.parentNode.dateInput; + if (calendar != null) calendar.hide(); + else + { + var calendarObject = new Calendar(false, null, dateSelected, closeHandler); + calendar = calendarObject; + calendarObject.setRange(1900, 2070); + calendarObject.create(); + } + calendar.setDateFormat(el.dateFormat); + calendar.parseDate(el.value); + calendar.sel = el; + calendar.showAtElement(el); + + Calendar.addEvent(document, "mousedown", checkCalendar); + return false; +} + +function dateSelected(calendarObject, date) +{ + calendarObject.sel.value = date; + calendarObject.callCloseHandler(); +} + +function closeHandler(calendarObject) +{ + calendarObject.hide(); + Calendar.removeEvent(document, "mousedown", checkCalendar); +} + +function checkCalendar(ev) +{ + var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); + + for (; el != null; el = el.parentNode) + if (el == calendar.element || el.tagName == "A") break; + + if (el == null) + { + calendar.callCloseHandler(); + Calendar.stopEvent(ev); + } +} + +function preloadImage(path) +{ + var img = new Image(); + img.src = path; + preloadImages.push(img); +} + +function addCss(path) +{ + path = cssPath + path; + document.write(""); +} + +/**/ +/* Copyright Mihai Bazon, 2002 + * http://students.infoiasi.ro/~mishoo + * + * Version: 0.9.1 + * + * Feel free to use this script under the terms of the GNU General Public + * License, as long as you do not remove or alter this notice. + */ + +/** The Calendar object constructor. */ +Calendar = function (mondayFirst, dateStr, onSelected, onClose) { + // member variables + this.activeDiv = null; + this.currentDateEl = null; + this.checkDisabled = null; + this.timeout = null; + this.onSelected = onSelected || null; + this.onClose = onClose || null; + this.dragging = false; + this.minYear = 1970; + this.maxYear = 2050; + this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; + this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; + this.isPopup = true; + this.mondayFirst = mondayFirst; + this.dateStr = dateStr; + // HTML elements + this.table = null; + this.element = null; + this.tbody = null; + this.daynames = null; + // Combo boxes + this.monthsCombo = null; + this.yearsCombo = null; + this.hilitedMonth = null; + this.activeMonth = null; + this.hilitedYear = null; + this.activeYear = null; + + // one-time initializations + if (!Calendar._DN3) { + // table of short day names + var ar = new Array(); + for (var i = 8; i > 0;) { + ar[--i] = Calendar._DN[i].substr(0, 3); + } + Calendar._DN3 = ar; + // table of short month names + ar = new Array(); + for (var i = 12; i > 0;) { + ar[--i] = Calendar._MN[i].substr(0, 3); + } + Calendar._MN3 = ar; + } +}; + +// ** constants + +/// "static", needed for event handlers. +Calendar._C = null; + +/// detect a special case of "web browser" +Calendar.is_ie = ( (navigator.userAgent.toLowerCase().indexOf("msie") != -1) && + (navigator.userAgent.toLowerCase().indexOf("opera") == -1) ); + +// short day names array (initialized at first constructor call) +Calendar._DN3 = null; + +// short month names array (initialized at first constructor call) +Calendar._MN3 = null; + +// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate +// library, at some point. + +Calendar.getAbsolutePos = function(el) { + var r = { x: el.offsetLeft, y: el.offsetTop }; + if (el.offsetParent) { + var tmp = Calendar.getAbsolutePos(el.offsetParent); + r.x += tmp.x; + r.y += tmp.y; + } + return r; +}; + +Calendar.isRelated = function (el, evt) { + var related = evt.relatedTarget; + if (!related) { + var type = evt.type; + if (type == "mouseover") { + related = evt.fromElement; + } else if (type == "mouseout") { + related = evt.toElement; + } + } + while (related) { + if (related == el) { + return true; + } + related = related.parentNode; + } + return false; +}; + +Calendar.removeClass = function(el, className) { + if (!(el && el.className)) { + return; + } + var cls = el.className.split(" "); + var ar = new Array(); + for (var i = cls.length; i > 0;) { + if (cls[--i] != className) { + ar[ar.length] = cls[i]; + } + } + el.className = ar.join(" "); +}; + +Calendar.addClass = function(el, className) { + el.className += " " + className; +}; + +Calendar.getElement = function(ev) { + if (Calendar.is_ie) { + return window.event.srcElement; + } else { + return ev.currentTarget; + } +}; + +Calendar.getTargetElement = function(ev) { + if (Calendar.is_ie) { + return window.event.srcElement; + } else { + return ev.target; + } +}; + +Calendar.stopEvent = function(ev) { + if (Calendar.is_ie) { + window.event.cancelBubble = true; + window.event.returnValue = false; + } else { + ev.preventDefault(); + ev.stopPropagation(); + } +}; + +Calendar.addEvent = function(el, evname, func) { + if (Calendar.is_ie) { + el.attachEvent("on" + evname, func); + } else { + el.addEventListener(evname, func, true); + } +}; + +Calendar.removeEvent = function(el, evname, func) { + if (Calendar.is_ie) { + el.detachEvent("on" + evname, func); + } else { + el.removeEventListener(evname, func, true); + } +}; + +Calendar.createElement = function(type, parent) { + var el = null; + if (document.createElementNS) { + // use the XHTML namespace; IE won't normally get here unless + // _they_ "fix" the DOM2 implementation. + el = document.createElementNS("http://www.w3.org/1999/xhtml", type); + } else { + el = document.createElement(type); + } + if (typeof parent != "undefined") { + parent.appendChild(el); + } + return el; +}; + +// END: UTILITY FUNCTIONS + +// BEGIN: CALENDAR STATIC FUNCTIONS + +/** Internal -- adds a set of events to make some element behave like a button. */ +Calendar._add_evs = function(el) { + with (Calendar) { + addEvent(el, "mouseover", dayMouseOver); + addEvent(el, "mousedown", dayMouseDown); + addEvent(el, "mouseout", dayMouseOut); + if (is_ie) { + addEvent(el, "dblclick", dayMouseDblClick); + el.setAttribute("unselectable", true); + } + } +}; + +Calendar.findMonth = function(el) { + if (typeof el.month != "undefined") { + return el; + } else if (typeof el.parentNode.month != "undefined") { + return el.parentNode; + } + return null; +}; + +Calendar.findYear = function(el) { + if (typeof el.year != "undefined") { + return el; + } else if (typeof el.parentNode.year != "undefined") { + return el.parentNode; + } + return null; +}; + +Calendar.showMonthsCombo = function () { + var cal = Calendar._C; + if (!cal) { + return false; + } + var cal = cal; + var cd = cal.activeDiv; + var mc = cal.monthsCombo; + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + if (cal.activeMonth) { + Calendar.removeClass(cal.activeMonth, "active"); + } + var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; + Calendar.addClass(mon, "active"); + cal.activeMonth = mon; + mc.style.left = cd.offsetLeft; + mc.style.top = cd.offsetTop + cd.offsetHeight; + mc.style.display = "block"; +}; + +Calendar.showYearsCombo = function (fwd) { + var cal = Calendar._C; + if (!cal) { + return false; + } + var cal = cal; + var cd = cal.activeDiv; + var yc = cal.yearsCombo; + if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + if (cal.activeYear) { + Calendar.removeClass(cal.activeYear, "active"); + } + cal.activeYear = null; + var Y = cal.date.getFullYear() + (fwd ? 1 : -1); + var yr = yc.firstChild; + var show = false; + for (var i = 12; i > 0; --i) { + if (Y >= cal.minYear && Y <= cal.maxYear) { + yr.firstChild.data = Y; + yr.year = Y; + yr.style.display = "block"; + show = true; + } else { + yr.style.display = "none"; + } + yr = yr.nextSibling; + Y += fwd ? 2 : -2; + } + if (show) { + yc.style.left = cd.offsetLeft; + yc.style.top = cd.offsetTop + cd.offsetHeight; + yc.style.display = "block"; + } +}; + +// event handlers + +Calendar.tableMouseUp = function(ev) { + var cal = Calendar._C; + if (!cal) { + return false; + } + if (cal.timeout) { + clearTimeout(cal.timeout); + } + var el = cal.activeDiv; + if (!el) { + return false; + } + var target = Calendar.getTargetElement(ev); + Calendar.removeClass(el, "active"); + if (target == el || target.parentNode == el) { + Calendar.cellClick(el); + } + var mon = Calendar.findMonth(target); + var date = null; + if (mon) { + date = new Date(cal.date); + if (mon.month != date.getMonth()) { + date.setMonth(mon.month); + cal.setDate(date); + } + } else { + var year = Calendar.findYear(target); + if (year) { + date = new Date(cal.date); + if (year.year != date.getFullYear()) { + date.setFullYear(year.year); + cal.setDate(date); + } + } + } + with (Calendar) { + removeEvent(document, "mouseup", tableMouseUp); + removeEvent(document, "mouseover", tableMouseOver); + removeEvent(document, "mousemove", tableMouseOver); + cal._hideCombos(); + stopEvent(ev); + _C = null; + } +}; + +Calendar.tableMouseOver = function (ev) { + var cal = Calendar._C; + if (!cal) { + return; + } + var el = cal.activeDiv; + var target = Calendar.getTargetElement(ev); + if (target == el || target.parentNode == el) { + Calendar.addClass(el, "hilite active"); + } else { + Calendar.removeClass(el, "active"); + Calendar.removeClass(el, "hilite"); + } + var mon = Calendar.findMonth(target); + if (mon) { + if (mon.month != cal.date.getMonth()) { + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + Calendar.addClass(mon, "hilite"); + cal.hilitedMonth = mon; + } else if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + } else { + var year = Calendar.findYear(target); + if (year) { + if (year.year != cal.date.getFullYear()) { + if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + Calendar.addClass(year, "hilite"); + cal.hilitedYear = year; + } else if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + } + } + Calendar.stopEvent(ev); +}; + +Calendar.tableMouseDown = function (ev) { + if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { + Calendar.stopEvent(ev); + } +}; + +Calendar.calDragIt = function (ev) { + var cal = Calendar._C; + if (!(cal && cal.dragging)) { + return false; + } + var posX; + var posY; + if (Calendar.is_ie) { + posY = window.event.clientY + document.body.scrollTop; + posX = window.event.clientX + document.body.scrollLeft; + } else { + posX = ev.pageX; + posY = ev.pageY; + } + cal.hideShowCovered(); + var st = cal.element.style; + st.left = (posX - cal.xOffs) + "px"; + st.top = (posY - cal.yOffs) + "px"; + Calendar.stopEvent(ev); +}; + +Calendar.calDragEnd = function (ev) { + var cal = Calendar._C; + if (!cal) { + return false; + } + cal.dragging = false; + with (Calendar) { + removeEvent(document, "mousemove", calDragIt); + removeEvent(document, "mouseover", stopEvent); + removeEvent(document, "mouseup", calDragEnd); + tableMouseUp(ev); + } + cal.hideShowCovered(); +}; + +Calendar.dayMouseDown = function(ev) { + var el = Calendar.getElement(ev); + if (el.disabled) { + return false; + } + var cal = el.calendar; + cal.activeDiv = el; + Calendar._C = cal; + if (el.navtype != 300) with (Calendar) { + addClass(el, "hilite active"); + addEvent(document, "mouseover", tableMouseOver); + addEvent(document, "mousemove", tableMouseOver); + addEvent(document, "mouseup", tableMouseUp); + } else if (cal.isPopup) { + cal._dragStart(ev); + } + Calendar.stopEvent(ev); + if (el.navtype == -1 || el.navtype == 1) { + cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); + } else if (el.navtype == -2 || el.navtype == 2) { + cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); + } else { + cal.timeout = null; + } +}; + +Calendar.dayMouseDblClick = function(ev) { + Calendar.cellClick(Calendar.getElement(ev)); + if (Calendar.is_ie) { + document.selection.empty(); + } +}; + +Calendar.dayMouseOver = function(ev) { + var el = Calendar.getElement(ev); + if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { + return false; + } + if (el.ttip) { + if (el.ttip.substr(0, 1) == "_") { + var date = null; + with (el.calendar.date) { + date = new Date(getFullYear(), getMonth(), el.caldate); + } + el.ttip = date.print(el.calendar.ttDateFormat) + el.ttip.substr(1); + } + el.calendar.tooltips.firstChild.data = el.ttip; + } + if (el.navtype != 300) { + Calendar.addClass(el, "hilite"); + } + Calendar.stopEvent(ev); +}; + +Calendar.dayMouseOut = function(ev) { + with (Calendar) { + var el = getElement(ev); + if (isRelated(el, ev) || _C || el.disabled) { + return false; + } + removeClass(el, "hilite"); + el.calendar.tooltips.firstChild.data = _TT["SEL_DATE"]; + stopEvent(ev); + } +}; + +/** + * A generic "click" handler :) handles all types of buttons defined in this + * calendar. + */ +Calendar.cellClick = function(el) { + var cal = el.calendar; + var closing = false; + var newdate = false; + var date = null; + if (typeof el.navtype == "undefined") { + Calendar.removeClass(cal.currentDateEl, "selected"); + Calendar.addClass(el, "selected"); + closing = (cal.currentDateEl == el); + if (!closing) { + cal.currentDateEl = el; + } + cal.date.setDate(el.caldate); + date = cal.date; + newdate = true; + } else { + if (el.navtype == 200) { + Calendar.removeClass(el, "hilite"); + cal.callCloseHandler(); + return; + } + date = (el.navtype == 0) ? new Date() : new Date(cal.date); + var year = date.getFullYear(); + var mon = date.getMonth(); + var setMonth = function (mon) { + var day = date.getDate(); + var max = date.getMonthDays(); + if (day > max) { + date.setDate(max); + } + date.setMonth(mon); + }; + switch (el.navtype) { + case -2: + if (year > cal.minYear) { + date.setFullYear(year - 1); + } + break; + case -1: + if (mon > 0) { + setMonth(mon - 1); + } else if (year-- > cal.minYear) { + date.setFullYear(year); + setMonth(11); + } + break; + case 1: + if (mon < 11) { + setMonth(mon + 1); + } else if (year < cal.maxYear) { + date.setFullYear(year + 1); + setMonth(0); + } + break; + case 2: + if (year < cal.maxYear) { + date.setFullYear(year + 1); + } + break; + case 100: + cal.setMondayFirst(!cal.mondayFirst); + return; + } + if (!date.equalsTo(cal.date)) { + cal.setDate(date); + newdate = el.navtype == 0; + } + } + if (newdate) { + cal.callHandler(); + } + if (closing) { + Calendar.removeClass(el, "hilite"); + cal.callCloseHandler(); + } +}; + +// END: CALENDAR STATIC FUNCTIONS + +// BEGIN: CALENDAR OBJECT FUNCTIONS + +/** + * This function creates the calendar inside the given parent. If _par is + * null than it creates a popup calendar inside the BODY element. If _par is + * an element, be it BODY, then it creates a non-popup calendar (still + * hidden). Some properties need to be set before calling this function. + */ +Calendar.prototype.create = function (_par) { + var parent = null; + if (! _par) { + // default parent is the document body, in which case we create + // a popup calendar. + parent = document.getElementsByTagName("body")[0]; + this.isPopup = true; + } else { + parent = _par; + this.isPopup = false; + } + this.date = this.dateStr ? new Date(this.dateStr) : new Date(); + + var table = Calendar.createElement("table"); + this.table = table; + table.cellSpacing = 0; + table.cellPadding = 0; + table.calendar = this; + Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); + + var div = Calendar.createElement("div"); + this.element = div; + div.className = "calendar"; + if (this.isPopup) { + div.style.position = "absolute"; + div.style.display = "none"; + } + div.appendChild(table); + + var thead = Calendar.createElement("thead", table); + var cell = null; + var row = null; + + var cal = this; + var hh = function (text, cs, navtype) { + cell = Calendar.createElement("td", row); + cell.colSpan = cs; + cell.className = "button"; + Calendar._add_evs(cell); + cell.calendar = cal; + cell.navtype = navtype; + if (text.substr(0, 1) != "&") { + cell.appendChild(document.createTextNode(text)); + } + else { + // FIXME: dirty hack for entities + cell.innerHTML = text; + } + return cell; + }; + + row = Calendar.createElement("tr", thead); + row.className = "headrow"; + + hh("-", 1, 100).ttip = Calendar._TT["TOGGLE"]; + this.title = hh("", this.isPopup ? 5 : 6, 300); + this.title.className = "title"; + if (this.isPopup) { + this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; + this.title.style.cursor = "move"; + hh("X", 1, 200).ttip = Calendar._TT["CLOSE"]; + } + + row = Calendar.createElement("tr", thead); + row.className = "headrow"; + + hh("«", 1, -2).ttip = Calendar._TT["PREV_YEAR"]; + hh("‹", 1, -1).ttip = Calendar._TT["PREV_MONTH"]; + hh(Calendar._TT["TODAY"], 3, 0).ttip = Calendar._TT["GO_TODAY"]; + hh("›", 1, 1).ttip = Calendar._TT["NEXT_MONTH"]; + hh("»", 1, 2).ttip = Calendar._TT["NEXT_YEAR"]; + + // day names + row = Calendar.createElement("tr", thead); + row.className = "daynames"; + this.daynames = row; + for (var i = 7; i > 0; --i) { + cell = Calendar.createElement("td", row); + cell.appendChild(document.createTextNode("")); + if (!i) { + cell.navtype = 100; + cell.calendar = this; + Calendar._add_evs(cell); + } + } + this._displayWeekdays(); + + var tbody = Calendar.createElement("tbody", table); + this.tbody = tbody; + + for (i = 6; i > 0; --i) { + row = Calendar.createElement("tr", tbody); + for (var j = 7; j > 0; --j) { + cell = Calendar.createElement("td", row); + cell.appendChild(document.createTextNode("")); + cell.calendar = this; + Calendar._add_evs(cell); + } + } + + var tfoot = Calendar.createElement("tfoot", table); + + row = Calendar.createElement("tr", tfoot); + row.className = "footrow"; + + cell = hh(Calendar._TT["SEL_DATE"], 7, 300); + cell.className = "ttip"; + if (this.isPopup) { + cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; + cell.style.cursor = "move"; + } + this.tooltips = cell; + + div = Calendar.createElement("div", this.element); + this.monthsCombo = div; + div.className = "combo"; + for (i = 0; i < Calendar._MN.length; ++i) { + var mn = Calendar.createElement("div"); + mn.className = "label"; + mn.month = i; + mn.appendChild(document.createTextNode(Calendar._MN3[i])); + div.appendChild(mn); + } + + div = Calendar.createElement("div", this.element); + this.yearsCombo = div; + div.className = "combo"; + for (i = 12; i > 0; --i) { + var yr = Calendar.createElement("div"); + yr.className = "label"; + yr.appendChild(document.createTextNode("")); + div.appendChild(yr); + } + + this._init(this.mondayFirst, this.date); + parent.appendChild(this.element); +}; + +/** + * (RE)Initializes the calendar to the given date and style (if mondayFirst is + * true it makes Monday the first day of week, otherwise the weeks start on + * Sunday. + */ +Calendar.prototype._init = function (mondayFirst, date) { + var today = new Date(); + var year = date.getFullYear(); + if (year < this.minYear) { + year = this.minYear; + date.setFullYear(year); + } else if (year > this.maxYear) { + year = this.maxYear; + date.setFullYear(year); + } + this.mondayFirst = mondayFirst; + this.date = new Date(date); + var month = date.getMonth(); + var mday = date.getDate(); + var no_days = date.getMonthDays(); + date.setDate(1); + var wday = date.getDay(); + var MON = mondayFirst ? 1 : 0; + var SAT = mondayFirst ? 5 : 6; + var SUN = mondayFirst ? 6 : 0; + if (mondayFirst) { + wday = (wday > 0) ? (wday - 1) : 6; + } + var iday = 1; + var row = this.tbody.firstChild; + var MN = Calendar._MN3[month]; + var hasToday = ((today.getFullYear() == year) && (today.getMonth() == month)); + var todayDate = today.getDate(); + for (var i = 0; i < 6; ++i) { + if (iday > no_days) { + row.className = "emptyrow"; + row = row.nextSibling; + continue; + } + var cell = row.firstChild; + row.className = "daysrow"; + for (var j = 0; j < 7; ++j) { + if ((!i && j < wday) || iday > no_days) { + cell.className = "emptycell"; + cell = cell.nextSibling; + continue; + } + cell.firstChild.data = iday; + cell.className = "day"; + cell.disabled = false; + if (typeof this.checkDisabled == "function") { + date.setDate(iday); + if (this.checkDisabled(date)) { + cell.className += " disabled"; + cell.disabled = true; + } + } + if (!cell.disabled) { + cell.caldate = iday; + cell.ttip = "_"; + if (iday == mday) { + cell.className += " selected"; + this.currentDateEl = cell; + } + if (hasToday && (iday == todayDate)) { + cell.className += " today"; + cell.ttip += Calendar._TT["PART_TODAY"]; + } + if (wday == SAT || wday == SUN) { + cell.className += " weekend"; + } + } + ++iday; + ((++wday) ^ 7) || (wday = 0); + cell = cell.nextSibling; + } + row = row.nextSibling; + } + this.title.firstChild.data = Calendar._MN[month] + ", " + year; + // PROFILE + // this.tooltips.firstChild.data = "Generated in " + ((new Date()) - today) + " ms"; +}; + +/** + * Calls _init function above for going to a certain date (but only if the + * date is different than the currently selected one). + */ +Calendar.prototype.setDate = function (date) { + if (!date.equalsTo(this.date)) { + this._init(this.mondayFirst, date); + } +}; + +/** Modifies the "mondayFirst" parameter (EU/US style). */ +Calendar.prototype.setMondayFirst = function (mondayFirst) { + this._init(mondayFirst, this.date); + this._displayWeekdays(); +}; + +/** + * Allows customization of what dates are enabled. The "unaryFunction" + * parameter must be a function object that receives the date (as a JS Date + * object) and returns a boolean value. If the returned value is true then + * the passed date will be marked as disabled. + */ +Calendar.prototype.setDisabledHandler = function (unaryFunction) { + this.checkDisabled = unaryFunction; +}; + +/** Customization of allowed year range for the calendar. */ +Calendar.prototype.setRange = function (a, z) { + this.minYear = a; + this.maxYear = z; +}; + +/** Calls the first user handler (selectedHandler). */ +Calendar.prototype.callHandler = function () { + if (this.onSelected) { + this.onSelected(this, this.date.print(this.dateFormat)); + } +}; + +/** Calls the second user handler (closeHandler). */ +Calendar.prototype.callCloseHandler = function () { + if (this.onClose) { + this.onClose(this); + } + this.hideShowCovered(); +}; + +/** Removes the calendar object from the DOM tree and destroys it. */ +Calendar.prototype.destroy = function () { + var el = this.element.parentNode; + el.removeChild(this.element); + Calendar._C = null; + delete el; +}; + +/** + * Moves the calendar element to a different section in the DOM tree (changes + * its parent). + */ +Calendar.prototype.reparent = function (new_parent) { + var el = this.element; + el.parentNode.removeChild(el); + new_parent.appendChild(el); +}; + +/** Shows the calendar. */ +Calendar.prototype.show = function () { + this.element.style.display = "block"; + this.hideShowCovered(); +}; + +/** + * Hides the calendar. Also removes any "hilite" from the class of any TD + * element. + */ +Calendar.prototype.hide = function () { + var trs = this.table.getElementsByTagName("td"); + for (var i = trs.length; i > 0; ) { + Calendar.removeClass(trs[--i], "hilite"); + } + this.element.style.display = "none"; +}; + +/** + * Shows the calendar at a given absolute position (beware that, depending on + * the calendar element style -- position property -- this might be relative + * to the parent's containing rectangle). + */ +Calendar.prototype.showAt = function (x, y) { + var s = this.element.style; + s.left = x + "px"; + s.top = y + "px"; + this.show(); +}; + +/** Shows the calendar near a given element. */ +Calendar.prototype.showAtElement = function (el) { + var p = Calendar.getAbsolutePos(el); + + var cw = 190; + var ch = -200; + + if (Calendar.is_ie) + { + var posX = getWndX(el) + el.offsetWidth + 18; if (posX + ch > document.body.scrollLeft + document.body.offsetWidth) posX = document.body.scrollLeft + document.body.offsetWidth - ch + var posY = p.y + el.offsetHeight; if (posY + cw > document.body.scrollTop + document.body.offsetHeight) posY = getWndY(el) - cw; + //document.body.scrollTop + document.body.offsetHeight - cw - el.offsetHeight + this.showAt(posX, posY); + } + else + { + // for other browsers types + this.showAt(getWndX(el) + el.offsetWidth + 30, p.y + el.offsetHeight-200); + } +}; + +function getWndC(object, c) +{ + pos = 0; + while (object != null) + { + pos += (c == "y") ? object.offsetTop : object.offsetLeft; + object = object.offsetParent; + } + return pos; +} + +function getWndX(object) {return getWndC(object, "x")} +function getWndY(object) {return getWndC(object, "y")} + + +/** Customizes the date format. */ +Calendar.prototype.setDateFormat = function (str) { + this.dateFormat = str; +}; + +/** Customizes the tooltip date format. */ +Calendar.prototype.setTtDateFormat = function (str) { + this.ttDateFormat = str; +}; + +/** + * Tries to identify the date represented in a string. If successful it also + * calls this.setDate which moves the calendar to the given date. + */ +Calendar.prototype.parseDate = function (str, fmt) { + var y = 0; + var m = -1; + var d = 0; + var a = str.split(/\W+/); + if (!fmt) { + fmt = this.dateFormat; + } + var b = fmt.split(/\W+/); + var i = 0, j = 0; + for (i = 0; i < a.length; ++i) { + if (b[i] == "D" || b[i] == "DD") { + continue; + } + if (b[i] == "j" || b[i] == "d") { + d = a[i]; + } + if (b[i] == "n" || b[i] == "m") { + m = a[i]-1; + } +// if (b[i] == "y") { +// y = a[i]; +// } + if ((b[i] == "Y")||(b[i] == "y")) { +// if (b[i] == "yy") { + if (a[i].length == 4) { + y = a[i]; + } + else { + if (parseInt(a[i]) < 70) { + y = parseInt(a[i]) + 2000; + } + else { + y = parseInt(a[i]) + 1900; + } + } + } + if (b[i] == "M" || b[i] == "MM") { + for (j = 0; j < 12; ++j) { + if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } + } + } + } + if (y != 0 && m != -1 && d != 0) { + this.setDate(new Date(y, m, d)); + return; + } + y = 0; m = -1; d = 0; + for (i = 0; i < a.length; ++i) { + if (a[i].search(/[a-zA-Z]+/) != -1) { + var t = -1; + for (j = 0; j < 12; ++j) { + if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } + } + if (t != -1) { + if (m != -1) { + d = m+1; + } + m = t; + } + } else if (parseInt(a[i]) <= 12 && m == -1) { + m = a[i]-1; + } else if (parseInt(a[i]) > 31 && y == 0) { + y = a[i]; + } else if (d == 0) { + d = a[i]; + } + } + if (y == 0) { + var today = new Date(); + y = today.getFullYear(); + } + if (m != -1 && d != 0) { + this.setDate(new Date(y, m, d)); + } +}; + +Calendar.prototype.hideShowCovered = function () { + var tags = new Array("applet", "iframe", "select"); + var el = this.element; + + var p = Calendar.getAbsolutePos(el); + var EX1 = p.x; + var EX2 = el.offsetWidth + EX1; + var EY1 = p.y; + var EY2 = el.offsetHeight + EY1; + + for (var k = tags.length; k > 0; ) { + var ar = document.getElementsByTagName(tags[--k]); + var cc = null; + + for (var i = ar.length; i > 0;) { + cc = ar[--i]; + + p = Calendar.getAbsolutePos(cc); + var CX1 = p.x; + var CX2 = cc.offsetWidth + CX1; + var CY1 = p.y; + var CY2 = cc.offsetHeight + CY1; + + if ((CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { + cc.style.visibility = "visible"; + } else { + cc.style.visibility = "hidden"; + } + } + } +}; + +/** Internal function; it displays the bar with the names of the weekday. */ +Calendar.prototype._displayWeekdays = function () { + var MON = this.mondayFirst ? 0 : 1; + var SUN = this.mondayFirst ? 6 : 0; + var SAT = this.mondayFirst ? 5 : 6; + var cell = this.daynames.firstChild; + for (var i = 0; i < 7; ++i) { + cell.className = "day name"; + if (!i) { + cell.ttip = this.mondayFirst ? Calendar._TT["SUN_FIRST"] : Calendar._TT["MON_FIRST"]; + cell.navtype = 100; + cell.calendar = this; + Calendar._add_evs(cell); + } + if (i == SUN || i == SAT) { + Calendar.addClass(cell, "weekend"); + } + cell.firstChild.data = Calendar._DN3[i + 1 - MON]; + cell = cell.nextSibling; + } +}; + +/** Internal function. Hides all combo boxes that might be displayed. */ +Calendar.prototype._hideCombos = function () { + this.monthsCombo.style.display = "none"; + this.yearsCombo.style.display = "none"; +}; + +/** Internal function. Starts dragging the element. */ +Calendar.prototype._dragStart = function (ev) { + if (this.dragging) { + return; + } + this.dragging = true; + var posX; + var posY; + if (Calendar.is_ie) { + posY = window.event.clientY + document.body.scrollTop; + posX = window.event.clientX + document.body.scrollLeft; + } else { + posY = ev.clientY + window.scrollY; + posX = ev.clientX + window.scrollX; + } + var st = this.element.style; + this.xOffs = posX - parseInt(st.left); + this.yOffs = posY - parseInt(st.top); + with (Calendar) { + addEvent(document, "mousemove", calDragIt); + addEvent(document, "mouseover", stopEvent); + addEvent(document, "mouseup", calDragEnd); + } +}; + +// BEGIN: DATE OBJECT PATCHES + +/** Adds the number of days array to the Date object. */ +Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); + +/** Returns the number of days in the current month */ +Date.prototype.getMonthDays = function() { + var year = this.getFullYear(); + var month = this.getMonth(); + if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { + return 29; + } else { + return Date._MD[month]; + } +}; + +/** Checks dates equality (ignores time) */ +Date.prototype.equalsTo = function(date) { + return ((this.getFullYear() == date.getFullYear()) && + (this.getMonth() == date.getMonth()) && + (this.getDate() == date.getDate())); +}; + +/** Prints the date in a string according to the given format. */ +Date.prototype.print = function (frm) { + var str = new String(frm); + var m = this.getMonth(); + var d = this.getDate(); + var y = this.getFullYear(); + var w = this.getDay(); + var s = new Array(); + s["j"] = d; + s["d"] = (d < 10) ? ("0" + d) : d; + s["n"] = 1+m; + s["m"] = (m < 9) ? ("0" + (1+m)) : (1+m); + s["Y"] = y; + s["y"] = new String(y).substr(2, 2); + with (Calendar) { + s["D"] = _DN3[w]; + s["DD"] = _DN[w]; + s["M"] = _MN3[m]; + s["MM"] = _MN[m]; + } + var re = /(.*)(\W|^)(j|d|n|m|y|Y|MM|M|DD|D)(\W|$)(.*)/; + while (re.exec(str) != null) { + str = RegExp.$1 + RegExp.$2 + s[RegExp.$3] + RegExp.$4 + RegExp.$5; + } + return str; +}; + +// END: DATE OBJECT PATCHES +/**/ +/**/ +Calendar._DN = new Array +("Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday"); +Calendar._MN = new Array +("January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["TOGGLE"] = "Toggle first day of week"; +Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)"; +Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)"; +Calendar._TT["GO_TODAY"] = "Go Today"; +Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)"; +Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)"; +Calendar._TT["SEL_DATE"] = "Select date"; +Calendar._TT["DRAG_TO_MOVE"] = "Drag to move"; +Calendar._TT["PART_TODAY"] = " (today)"; +Calendar._TT["MON_FIRST"] = "Display Monday first"; +Calendar._TT["SUN_FIRST"] = "Display Sunday first"; +Calendar._TT["CLOSE"] = "Close"; +Calendar._TT["TODAY"] = "Today"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "y-mm-dd"; +Calendar._TT["TT_DATE_FORMAT"] = "D, M d"; +/**/ +/**/ +document.write("") +/* The main calendar widget. DIV containing a table. */ + Index: trunk/core/admin_templates/img/globe.gif =================================================================== diff -u -N Binary files differ Index: trunk/core/admin_templates/img/blue_bar_help.gif =================================================================== diff -u -N Binary files differ Index: trunk/core/admin_templates/img/tabnav_left.gif =================================================================== diff -u -N Binary files differ Index: trunk/core/admin_templates/incs/blocks.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/incs/blocks.tpl (revision 0) +++ trunk/core/admin_templates/incs/blocks.tpl (revision 6656) @@ -0,0 +1,31 @@ + + + + + + + +
" name="" enctype="multipart/form-data" method="post" action=""> + " /> + + + + + + + + + + *: + + + + + + " value=""> + + + + + ','')"> + \ No newline at end of file Index: trunk/core/kernel/constants.php =================================================================== diff -u -N -r6652 -r6656 --- trunk/core/kernel/constants.php (.../constants.php) (revision 6652) +++ trunk/core/kernel/constants.php (.../constants.php) (revision 6656) @@ -4,33 +4,33 @@ define('HAVING_FILTER', 1); define('WHERE_FILTER', 2); define('AGGREGATE_FILTER', 3); - + define('FLT_TYPE_AND', 'AND'); define('FLT_TYPE_OR', 'OR'); // item statuses safeDefine('STATUS_DISABLED', 0); safeDefine('STATUS_ACTIVE', 1); safeDefine('STATUS_PENDING', 2); - + // sections define('stTREE', 1); define('stTAB', 2); - + // event statuses define('erSUCCESS', 0); // event finished working succsessfully define('erFAIL', -1); // event finished working, but result is unsuccsessfull define('erFATAL', -2); // event experienced FATAL error - no hooks should continue! define('erPERM_FAIL', -3); // event failed on internal permission checking (user has not permission) - + // permission types define('ptCATEGORY', 0); define('ptSYSTEM', 1); - + $application =& kApplication::Instance(); - $spacer_url = $application->BaseURL().'kernel/admin_templates/img/spacer.gif'; + $spacer_url = $application->BaseURL().'core/admin_templates/img/spacer.gif'; define('SPACER_URL', $spacer_url); - + if (!$application->IsAdmin()) { // don't show debugger buttons on front (if not overrided in "debug.php") safeDefine('DBG_TOOLBAR_BUTTONS', 0); Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r6654 -r6656 --- trunk/core/kernel/application.php (.../application.php) (revision 6654) +++ trunk/core/kernel/application.php (.../application.php) (revision 6656) @@ -359,7 +359,7 @@ function VerifyThemeId() { if ($this->Application->IsAdmin()) { - safeDefine('THEMES_PATH', '/kernel/admin_templates'); + safeDefine('THEMES_PATH', '/core/admin_templates'); return; } Index: trunk/core/admin_templates/img/blue_bar_logout.gif =================================================================== diff -u -N Binary files differ Index: trunk/core/admin_templates/js/script.js =================================================================== diff -u -N --- trunk/core/admin_templates/js/script.js (revision 0) +++ trunk/core/admin_templates/js/script.js (revision 6656) @@ -0,0 +1,1035 @@ +if ( !( isset($init_made) && $init_made ) ) { + var Grids = new Array(); + var Toolbars = new Array(); + var $Menus = new Array(); + var $ViewMenus = new Array(); + + var $form_name = 'kernel_form'; + if(!$fw_menus) var $fw_menus = new Array(); + + var $env = ''; + var submitted = false; + var $edit_mode = false; + var $init_made = true; // in case of double inclusion of script.js :) + + // hook processing + var hBEFORE = 1; // this is const, but including this twice causes errors + var hAFTER = 2; // this is const, but including this twice causes errors + var $hooks = new Array(); +} + +function getArrayValue() +{ + var $value = arguments[0]; + var $current_key = 0; + $i = 1; + while ($i < arguments.length) { + $current_key = arguments[$i]; + if (isset($value[$current_key])) { + $value = $value[$current_key]; + } + else { + return false; + } + $i++; + } + return $value; +} + +function setArrayValue() +{ + // first argument - array, other arguments - keys (arrays too), last argument - value + var $array = arguments[0]; + var $current_key = 0; + $i = 1; + while ($i < arguments.length - 1) { + $current_key = arguments[$i]; + if (!isset($array[$current_key])) { + $array[$current_key] = new Array(); + } + $array = $array[$current_key]; + $i++; + } + $array[$array.length] = arguments[arguments.length - 1]; +} + +function processHooks($function_name, $hook_type, $prefix_special) +{ + var $i = 0; + var $local_hooks = getArrayValue($hooks, $function_name, $hook_type); + + while($i < $local_hooks.length) { + $local_hooks[$i]($function_name, $prefix_special); + $i++; + } +} + +function registerHook($function_name, $hook_type, $hook_body) +{ + setArrayValue($hooks, $function_name, $hook_type, $hook_body); +} + +function resort_grid($prefix_special, $field, $ajax) +{ + set_form($prefix_special, $ajax); + set_hidden_field($prefix_special + '_Sort1', $field); + submit_event($prefix_special, 'OnSetSorting', null, null, $ajax); +} + +function direct_sort_grid($prefix_special, $field, $direction, $field_pos, $ajax) +{ + if(!isset($field_pos)) $field_pos = 1; + set_form($prefix_special, $ajax); + set_hidden_field($prefix_special+'_Sort'+$field_pos,$field); + set_hidden_field($prefix_special+'_Sort'+$field_pos+'_Dir',$direction); + set_hidden_field($prefix_special+'_SortPos',$field_pos); + submit_event($prefix_special,'OnSetSortingDirect', null, null, $ajax); +} + +function reset_sorting($prefix_special) +{ + submit_event($prefix_special,'OnResetSorting'); +} + +function set_per_page($prefix_special, $per_page, $ajax) +{ + set_form($prefix_special, $ajax); + set_hidden_field($prefix_special + '_PerPage', $per_page); + submit_event($prefix_special, 'OnSetPerPage', null, null, $ajax); +} + +function submit_event(prefix_special, event, t, form_action, $ajax) +{ + if ($ajax) { + return $Catalog.submit_event(prefix_special, event, t); + } + + if (event) { + set_hidden_field('events[' + prefix_special + ']', event); + } + if (t) set_hidden_field('t', t); + + if (form_action) { + var old_env = ''; + if (!form_action.match(/\?/)) { + document.getElementById($form_name).action.match(/.*(\?.*)/); + old_env = RegExp.$1; + } + document.getElementById($form_name).action = form_action + old_env; + } + submit_kernel_form(); +} + +function submit_action($url, $action) +{ + $form = document.getElementById($form_name); + $form.action = $url; + set_hidden_field('Action', $action); + submit_kernel_form(); +} + +function show_form_data() +{ + var $kf = document.getElementById($form_name); + $ret = ''; + for(var i in $kf.elements) + { + $elem = $kf.elements[i]; + $ret += $elem.id + ' = ' + $elem.value + "\n"; + } + alert($ret); +} + +function submit_kernel_form() +{ + if (submitted) { + return; + } + submitted = true; + + var $form = document.getElementById($form_name); + processHooks('SubmitKF', hBEFORE); + if (typeof $form.onsubmit == "function") { + $form.onsubmit(); + } + + $form.submit(); + processHooks('SubmitKF', hAFTER); + $form.target = ''; + $form.t.value = t; + + window.setTimeout(function() {submitted = false}, 500); +} + +function set_event(prefix_special, event) +{ + var event_field=document.getElementById('events[' + prefix_special + ']'); + if(isset(event_field)) + { + event_field.value = event; + } +} + +function isset(variable) +{ + if(variable==null) return false; + return (typeof(variable)=='undefined')?false:true; +} + +function in_array(needle, haystack) +{ + return array_search(needle, haystack) != -1; +} + +function array_search(needle, haystack) +{ + for (var i=0; i "+variable[prop] + "\n"; + } + alert(s); +} + +function go_to_page($prefix_special, $page, $ajax) +{ + set_form($prefix_special, $ajax); + set_hidden_field($prefix_special + '_Page', $page); + submit_event($prefix_special, null, null, null, $ajax); +} + +function go_to_list(prefix_special, tab) +{ + set_hidden_field(prefix_special+'_GoTab', tab); + submit_event(prefix_special,'OnUpdateAndGoToTab',null); +} + +function go_to_tab(prefix_special, tab) +{ + set_hidden_field(prefix_special+'_GoTab', tab); + submit_event(prefix_special,'OnPreSaveAndGoToTab',null); +} + +function go_to_id(prefix_special, id) +{ + set_hidden_field(prefix_special+'_GoId', id); + submit_event(prefix_special,'OnPreSaveAndGo') +} + +// in-portal compatibility functions: begin +function getScriptURL($script_name, tpl) +{ + tpl = tpl ? '-'+tpl : ''; + var $asid = get_hidden_field('sid'); + return base_url+$script_name+'?env='+( isset($env)&&$env?$env:$asid )+tpl+'&en=0'; +} + +function OpenEditor(extra_env,TargetForm,TargetField) +{ +// var $url = getScriptURL('admin/editor/editor_new.php'); + var $url = getScriptURL('admin/index.php', 'popups/editor'); +// alert($url); + $url = $url+'&TargetForm='+TargetForm+'&TargetField='+TargetField+'&destform=popup'; + if(extra_env.length>0) $url += extra_env; + openwin($url,'html_edit',800,575); +} + +function OpenUserSelector(extra_env,TargetForm,TargetField) +{ + var $url = getScriptURL('admin/users/user_select.php'); + $url += '&destform='+TargetForm+'&Selector=radio&destfield='+TargetField+'&IdField=Login'; + if(extra_env.length>0) $url += extra_env; + openwin($url,'user_select',800,575); + return false; +} + +function OpenCatSelector(extra_env) +{ + var $url = getScriptURL('admin/cat_select.php'); + if(extra_env.length>0) $url += extra_env; + openwin($url,'catselect',750,400); +} + +function OpenItemSelector(extra_env,$TargetForm) +{ + var $url = getScriptURL('admin/relation_select.php') + '&destform='+$TargetForm; + if(extra_env.length>0) $url += extra_env; + openwin($url,'groupselect',750,400); +} + +function OpenUserEdit($user_id, $extra_env) +{ + var $url = getScriptURL('admin/users/adduser.php') + '&direct_id=' + $user_id; + if( isset($extra_env) ) $url += $extra_env; + window.location.href = $url; +} + +function OpenLinkEdit($link_id, $extra_env) +{ + var $url = getScriptURL('in-link/admin/addlink.php') + '&item=' + $link_id; + if( isset($extra_env) ) $url += $extra_env; + window.location.href = $url; +} + +function OpenHelp($help_link) +{ + +// $help_link.match('http://(.*).lv/in-commerce/admin(.*)'); +// alert(RegExp.$2); + openwin($help_link,'HelpPopup',750,400); +} + +function openEmailSend($url, $type, $prefix_special) +{ + var $kf = document.getElementById($form_name); + var $prev_action = $kf.action; + var $prev_opener = get_hidden_field('m_opener'); + + $kf.action = $url; + set_hidden_field('m_opener', 'p'); + $kf.target = 'sendmail'; + set_hidden_field('idtype', 'group'); + set_hidden_field('idlist', Grids[$prefix_special].GetSelected().join(',') ); + openwin('','sendmail',750,400); + submit_kernel_form(); + + $kf.action = $prev_action; + set_hidden_field('m_opener', $prev_opener); +} +// in-portal compatibility functions: end + +function openSelector($prefix, $url, $dst_field, $window_size, $event) +{ + var $kf = document.getElementById($form_name); + var $regex = new RegExp('(.*)\?env=(' + document.getElementById('sid').value + ')?-(.*?):(m[^:]+)'); + $regex = $regex.exec($url); + + var $t = $regex[3]; + var $window_name = 'select_'+$t.replace(/(\/|-)/g, '_'); + set_hidden_field('return_m', $regex[4]); + + if (!isset($window_size)) $window_size = '750x400'; + + $window_size = $window_size.split('x'); + + if (!isset($event)) $event = ''; + processHooks('openSelector', hBEFORE); + + var $prev_action = $kf.action; + var $prev_opener = get_hidden_field('m_opener'); + + set_hidden_field('m_opener', 'p'); + set_hidden_field('main_prefix', $prefix); + set_hidden_field('dst_field', $dst_field); + set_hidden_field('return_template', $kf.elements['t'].value); // where should return after popup is done + + openwin('', $window_name, $window_size[0], $window_size[1]); + $kf.action = $url; + $kf.target = $window_name; + + submit_event($prefix, $event, $t); + + processHooks('openSelector', hAFTER); + $kf.action = $prev_action; + set_hidden_field('m_opener', $prev_opener); +} + +function InitTranslator(prefix, field, t, multi_line) +{ + var $kf = document.getElementById($form_name); + var $window_name = 'select_'+t.replace(/(\/|-)/g, '_'); + var $regex = new RegExp('(.*)\?env=(' + document.getElementById('sid').value + ')?-(.*?):(m[^:]+)'); + + $regex = $regex.exec($kf.action); + set_hidden_field('return_m', $regex[4]); + var $prev_opener = get_hidden_field('m_opener'); + if (!isset(multi_line)) multi_line = 0; + openwin('', $window_name, 750, 400); + set_hidden_field('return_template', $kf.elements['t'].value); // where should return after popup is done + set_hidden_field('m_opener', 'p'); + + set_hidden_field('translator_wnd_name', $window_name); + set_hidden_field('translator_field', field); + set_hidden_field('translator_t', t); + set_hidden_field('translator_prefixes', prefix); + set_hidden_field('translator_multi_line', multi_line); + $kf.target = $window_name; + + return $prev_opener; +} + +function PreSaveAndOpenTranslator(prefix, field, t, multi_line) +{ + var $prev_opener = InitTranslator(prefix, field, t, multi_line); + + var split_prefix = prefix.split(','); + submit_event(split_prefix[0], 'OnPreSaveAndOpenTranslator'); + + set_hidden_field('m_opener', $prev_opener); +} + + +function PreSaveAndOpenTranslatorCV(prefix, field, t, resource_id, multi_line) +{ + var $prev_opener = InitTranslator(prefix, field, t, multi_line); + set_hidden_field('translator_resource_id', resource_id); + + var split_prefix = prefix.split(','); + submit_event(split_prefix[0],'OnPreSaveAndOpenTranslator'); + + set_hidden_field('m_opener', $prev_opener); +} + +function openTranslator(prefix,field,url,wnd) +{ + var $kf = document.getElementById($form_name); + + set_hidden_field('trans_prefix', prefix); + set_hidden_field('trans_field', field); + set_hidden_field('events[trans]', 'OnLoad'); + + var $regex = new RegExp('(.*)\?env=(' + document.getElementById('sid').value + ')?-(.*?):(.*)'); + var $t = $regex.exec(url)[3]; + $kf.target = wnd; + submit_event(prefix,'',$t,url); +} + +function openwin($url,$name,$width,$height) +{ + var $window_params = 'width='+$width+',height='+$height+',status=yes,resizable=yes,menubar=no,scrollbars=yes,toolbar=no'; + return window.open($url,$name,$window_params); +} + +function opener_action(new_action) +{ + set_hidden_field('m_opener', new_action); +} + +function std_precreate_item(prefix_special, edit_template) +{ + opener_action('d'); + set_hidden_field(prefix_special+'_mode', 't'); + submit_event(prefix_special,'OnPreCreate', edit_template) +} + +function std_new_item(prefix_special, edit_template) +{ + opener_action('d'); + submit_event(prefix_special,'OnNew', edit_template) +} + +function std_edit_item(prefix_special, edit_template) + { + opener_action('d'); + set_hidden_field(prefix_special+'_mode', 't'); + submit_event(prefix_special,'OnEdit',edit_template) +} + +function std_edit_temp_item(prefix_special, edit_template) +{ + opener_action('d'); + submit_event(prefix_special,'',edit_template) +} + +function std_delete_items(prefix_special, t, $ajax) +{ + if (inpConfirm('Are you sure you want to delete selected items?')) { + submit_event(prefix_special, 'OnMassDelete', t, null, $ajax); + } +} + + +// set current form base on ajax +function set_form($prefix_special, $ajax) +{ + if ($ajax) { + $form_name = $Catalog.queryTabRegistry('prefix', $prefix_special, 'tab_id') + '_form'; + } +} + +// sets hidden field value +// if the field does not exist - creates it +function set_hidden_field($field_id, $value) +{ + var $kf = document.getElementById($form_name); + var $field = $kf.elements[$field_id]; + if ($field) { + $field.value = $value; + return true; + } + + $field = document.createElement('INPUT'); + $field.type = 'hidden'; + $field.name = $field_id; + $field.id = $field_id; + $field.value = $value; + + $kf.appendChild($field); + return false; +} + +// sets hidden field value +// if the field does not exist - creates it +function setInnerHTML($field_id, $value) +{ + var $element = document.getElementById($field_id); + if (!$element) return false; + $element.innerHTML = $value; +} + +function get_hidden_field($field) +{ + var $kf = document.getElementById($form_name); + return $kf.elements[$field] ? $kf.elements[$field].value : false; +} + +function search($prefix_special, $grid_name, $ajax) +{ + set_form($prefix_special, $ajax); + set_hidden_field('grid_name', $grid_name); + submit_event($prefix_special, 'OnSearch', null, null, $ajax); +} + +function search_reset($prefix_special, $grid_name, $ajax) +{ + set_form($prefix_special, $ajax); + set_hidden_field('grid_name', $grid_name); + submit_event($prefix_special, 'OnSearchReset', null, null, $ajax); +} + +function search_keydown($event) +{ + $event = $event ? $event : event; + if ($event.keyCode == 13) { + var $prefix_special = this.getAttribute('PrefixSpecial'); + var $grid = this.getAttribute('Grid'); + search($prefix_special, $grid, parseInt(this.getAttribute('ajax'))); + } +} + +function getRealLeft(el) +{ + if (typeof(el) == 'string') { + el = document.getElementById(el); + } + xPos = el.offsetLeft; + tempEl = el.offsetParent; + while (tempEl != null) + { + xPos += tempEl.offsetLeft; + tempEl = tempEl.offsetParent; + } + // if (obj.x) return obj.x; + return xPos; +} + +function getRealTop(el) +{ + if (typeof(el) == 'string') { + el = document.getElementById(el); + } + yPos = el.offsetTop; + tempEl = el.offsetParent; + while (tempEl != null) + { + yPos += tempEl.offsetTop; + tempEl = tempEl.offsetParent; + } + +// if (obj.y) return obj.y; + return yPos; +} + +function show_viewmenu($toolbar, $button_id) +{ + var $img = $toolbar.GetButtonImage($button_id); + var $pos_x = getRealLeft($img) - ((document.all) ? 6 : -2); + var $pos_y = getRealTop($img) + 32; + + var $prefix_special = ''; + window.triedToWriteMenus = false; + + if($ViewMenus.length == 1) + { + $prefix_special = $ViewMenus[$ViewMenus.length-1]; + $fw_menus[$prefix_special+'_view_menu'](); + $Menus[$prefix_special+'_view_menu'].writeMenus('MenuContainers['+$prefix_special+']'); + window.FW_showMenu($Menus[$prefix_special+'_view_menu'], $pos_x, $pos_y); + } + else + { + // prepare menus + for(var $i in $ViewMenus) + { + $prefix_special = $ViewMenus[$i]; + $fw_menus[$prefix_special+'_view_menu'](); + } + $Menus['mixed'] = new Menu('ViewMenu_mixed'); + + // merge menus into new one + for(var $i in $ViewMenus) + { + $prefix_special = $ViewMenus[$i]; + $Menus['mixed'].addMenuItem( $Menus[$prefix_special+'_view_menu'] ); + } + + $Menus['mixed'].writeMenus('MenuContainers[mixed]'); + window.FW_showMenu($Menus['mixed'], $pos_x, $pos_y); + } +} + +function set_window_title($title) +{ + var $window = window; + if($window.parent) $window = $window.parent; + $window.document.title = (main_title.length ? main_title + ' - ' : '') + $title; +} + +function set_filter($prefix_special, $filter_id, $filter_value, $ajax) +{ + set_form($prefix_special, $ajax); + set_hidden_field('filter_id', $filter_id); + set_hidden_field('filter_value', $filter_value); + submit_event($prefix_special, 'OnSetFilter', null, null, $ajax); +} + +function filters_remove_all($prefix_special, $ajax) +{ + set_form($prefix_special, $ajax); + submit_event($prefix_special,'OnRemoveFilters', null, null, $ajax); +} + +function filters_apply_all($prefix_special, $ajax) +{ + set_form($prefix_special, $ajax); + submit_event($prefix_special,'OnApplyFilters', null, null, $ajax); +} + +function RemoveTranslationLink($string, $escaped) +{ + if (!isset($escaped)) $escaped = true; + + if ($escaped) { + return $string.match(/<a href="(.*)">(.*)<\/a>/) ? RegExp.$2 : $string; + } + else { + return $string.match(/(.*)<\/a>/) ? RegExp.$2 : $string; + } +} + +function redirect($url) +{ + window.location.href = $url; +} + +function update_checkbox_options($cb_mask, $hidden_id) +{ + var $kf = document.getElementById($form_name); + var $tmp = ''; + for (var i = 0; i < $kf.elements.length; i++) + { + if ( $kf.elements[i].id.match($cb_mask) ) + { + if ($kf.elements[i].checked) $tmp += '|'+$kf.elements[i].value; + } + } + if($tmp.length > 0) $tmp += '|'; + document.getElementById($hidden_id).value = $tmp.replace(/,$/, ''); +} + +// related to lists operations (moving) + + + + function move_selected($from_list, $to_list) + { + if (typeof($from_list) != 'object') $from_list = document.getElementById($from_list); + if (typeof($to_list) != 'object') $to_list = document.getElementById($to_list); + + if (has_selected_options($from_list)) + { + var $from_array = select_to_array($from_list); + var $to_array = select_to_array($to_list); + var $new_from = Array(); + var $cur = null; + + for (var $i = 0; $i < $from_array.length; $i++) + { + $cur = $from_array[$i]; + if ($cur[2]) // If selected - add to To array + { + $to_array[$to_array.length] = $cur; + } + else //Else - keep in new From + { + $new_from[$new_from.length] = $cur; + } + } + + $from_list = array_to_select($new_from, $from_list); + $to_list = array_to_select($to_array, $to_list); + } + else + { + alert('Please select items to perform moving!'); + } + } + + function select_to_array($aSelect) + { + var $an_array = new Array(); + var $cur = null; + + for (var $i = 0; $i < $aSelect.length; $i++) + { + $cur = $aSelect.options[$i]; + $an_array[$an_array.length] = new Array($cur.text, $cur.value, $cur.selected); + } + return $an_array; + } + + function array_to_select($anArray, $aSelect) + { + var $initial_length = $aSelect.length; + for (var $i = $initial_length - 1; $i >= 0; $i--) + { + $aSelect.options[$i] = null; + } + + for (var $i = 0; $i < $anArray.length; $i++) + { + $cur = $anArray[$i]; + $aSelect.options[$aSelect.length] = new Option($cur[0], $cur[1]); + } + } + + function select_compare($a, $b) + { + if ($a[0] < $b[0]) + return -1; + if ($a[0] > $b[0]) + return 1; + return 0; + } + + function select_to_string($aSelect) + { + var $result = ''; + var $cur = null; + + if (typeof($aSelect) != 'object') $aSelect = document.getElementById($aSelect); + + for (var $i = 0; $i < $aSelect.length; $i++) + { + $result += $aSelect.options[$i].value + '|'; + } + + return $result.length ? '|' + $result : ''; + } + + function selected_to_string($aSelect) + { + var $result = ''; + var $cur = null; + + if (typeof($aSelect) != 'object') $aSelect = document.getElementById($aSelect); + + for (var $i = 0; $i < $aSelect.length; $i++) + { + $cur = $aSelect.options[$i]; + if ($cur.selected && $cur.value != '') + { + $result += $cur.value + '|'; + } + } + + return $result.length ? '|' + $result : ''; + } + + function string_to_selected($str, $aSelect) + { + var $cur = null; + for (var $i = 0; $i < $aSelect.length; $i++) + { + $cur = $aSelect.options[$i]; + $aSelect.options[$i].selected = $str.match('\\|' + $cur.value + '\\|') ? true : false; + } + } + + function set_selected($selected_options, $aSelect) + { + if (!$selected_options.length) return false; + + for (var $i = 0; $i < $aSelect.length; $i++) + { + for (var $k = 0; $k < $selected_options.length; $k++) + { + if ($aSelect.options[$i].value == $selected_options[$k]) + { + $aSelect.options[$i].selected = true; + } + } + } + } + + function get_selected_count($theList) + { + var $count = 0; + var $cur = null; + for (var $i = 0; $i < $theList.length; $i++) + { + $cur = $theList.options[$i]; + if ($cur.selected) $count++; + } + return $count; + } + + function get_selected_index($aSelect, $typeIndex) + { + var $index = 0; + for (var $i = 0; $i < $aSelect.length; $i++) + { + if ($aSelect.options[$i].selected) + { + $index = $i; + if ($typeIndex == 'firstSelected') break; + } + } + return $index; + } + + function has_selected_options($theList) + { + var $ret = false; + var $cur = null; + + for (var $i = 0; $i < $theList.length; $i++) + { + $cur = $theList.options[$i]; + if ($cur.selected) $ret = true; + } + return $ret; + } + + function select_sort($aSelect) + { + if (typeof($aSelect) != 'object') $aSelect = document.getElementById($aSelect); + + var $to_array = select_to_array($aSelect); + $to_array.sort(select_compare); + array_to_select($to_array, $aSelect); + } + + function move_options_up($aSelect, $interval) + { + if (typeof($aSelect) != 'object') $aSelect = document.getElementById($aSelect); + + if (has_selected_options($aSelect)) + { + var $selected_options = Array(); + var $first_selected = get_selected_index($aSelect, 'firstSelected'); + + for (var $i = 0; $i < $aSelect.length; $i++) + { + if ($aSelect.options[$i].selected && ($first_selected > 0) ) + { + swap_options($aSelect, $i, $i - $interval); + $selected_options[$selected_options.length] = $aSelect.options[$i - $interval].value; + } + else if ($first_selected == 0) + { + //alert('Begin of list'); + break; + } + } + set_selected($selected_options, $aSelect); + } + else + { + //alert('Check items from moving'); + } + } + + function move_options_down($aSelect, $interval) + { + if (typeof($aSelect) != 'object') $aSelect = document.getElementById($aSelect); + + if (has_selected_options($aSelect)) + { + var $last_selected = get_selected_index($aSelect, 'lastSelected'); + var $selected_options = Array(); + + for (var $i = $aSelect.length - 1; $i >= 0; $i--) + { + if ($aSelect.options[$i].selected && ($aSelect.length - ($last_selected + 1) > 0)) + { + swap_options($aSelect, $i, $i + $interval); + $selected_options[$selected_options.length] = $aSelect.options[$i + $interval].value; + } + else if ($last_selected + 1 == $aSelect.length) + { + //alert('End of list'); + break; + } + } + set_selected($selected_options, $aSelect); + } + else + { + //alert('Check items from moving'); + } + } + + function swap_options($aSelect, $src_num, $dst_num) + { + var $src_html = $aSelect.options[$src_num].innerHTML; + var $dst_html = $aSelect.options[$dst_num].innerHTML; + var $src_value = $aSelect.options[$src_num].value; + var $dst_value = $aSelect.options[$dst_num].value; + + var $src_option = document.createElement('OPTION'); + var $dst_option = document.createElement('OPTION'); + + $aSelect.remove($src_num); + $aSelect.options.add($dst_option, $src_num); + $dst_option.innerText = $dst_html; + $dst_option.value = $dst_value; + $dst_option.innerHTML = $dst_html; + + $aSelect.remove($dst_num); + $aSelect.options.add($src_option, $dst_num); + $src_option.innerText = $src_html; + $src_option.value = $src_value; + $src_option.innerHTML = $src_html; + } + + function getXMLHTTPObject(content_type) + { + if (!isset(content_type)) content_type = 'text/plain'; + var http_request = false; + if (window.XMLHttpRequest) { // Mozilla, Safari,... + http_request = new XMLHttpRequest(); + if (http_request.overrideMimeType) { + http_request.overrideMimeType(content_type); + // See note below about this line + } + } else if (window.ActiveXObject) { // IE + try { + http_request = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + http_request = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (e) {} + } + } + return http_request; + } + + function str_repeat($symbol, $count) + { + var $i = 0; + var $ret = ''; + while($i < $count) { + $ret += $symbol; + $i++; + } + return $ret; + } + + function getDocumentFromXML(xml) + { + if (window.ActiveXObject) { + var doc = new ActiveXObject("Microsoft.XMLDOM"); + doc.async=false; + doc.loadXML(xml); + } + else { + var parser = new DOMParser(); + var doc = parser.parseFromString(xml,"text/xml"); + } + return doc; + } + + + function addEvent(el, evname, func) { + if (is.ie) { + el.attachEvent("on" + evname, func); + } else { + el.addEventListener(evname, func, true); + } + }; + + function set_persistant_var($var_name, $var_value, $t, $form_action) + { + set_hidden_field('field', $var_name); + set_hidden_field('value', $var_value); + submit_event('u', 'OnSetPersistantVariable', $t, $form_action); + } + + /*functionremoveEvent(el, evname, func) { + if (Calendar.is_ie) { + el.detachEvent("on" + evname, func); + } else { + el.removeEventListener(evname, func, true); + } + };*/ + + function setCookie($Name, $Value) + { + // set cookie + if(getCookie($Name) != $Value) + { + document.cookie = $Name+'='+escape($Value)+'; path=' + $base_path + '/'; + } + } + + function getCookie($Name) + { + // get cookie + var $cookieString = document.cookie; + var $index = $cookieString.indexOf($Name+'='); + if($index == -1) return null; + + $index = $cookieString.indexOf('=',$index)+1; + var $endstr = $cookieString.indexOf(';',$index); + if($endstr == -1) $endstr = $cookieString.length; + return unescape($cookieString.substring($index, $endstr)); + } + + function deleteCookie($Name) + { + // deletes cookie + if (getCookie($Name)) + { + document.cookie = $Name+'=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/'; + } + } + + function addElement($dst_element, $tag_name) { + var $new_element = document.createElement($tag_name.toUpperCase()); + $dst_element.appendChild($new_element); + return $new_element; + } + + Math.sum = function($array) { + var $i = 0; + var $total = 0; + while ($i < $array.length) { + $total += $array[$i]; + $i++; + } + return $total; + } + + Math.average = function($array) { + return Math.sum($array) / $array.length; + } Index: trunk/core/admin_templates/js/is.js =================================================================== diff -u -N --- trunk/core/admin_templates/js/is.js (revision 0) +++ trunk/core/admin_templates/js/is.js (revision 6656) @@ -0,0 +1,210 @@ +// Ultimate client-side JavaScript client sniff. Version 3.03 +// (C) Netscape Communications 1999. Permission granted to reuse and distribute. +// Revised 17 May 99 to add is.nav5up and is.ie5up (see below). +// Revised 21 Nov 00 to add is.gecko and is.ie5_5 Also Changed is.nav5 and is.nav5up to is.nav6 and is.nav6up +// Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4, +// correct Opera 5 detection +// add support for winME and win2k +// synch with browser-type-oo.js +// Revised 26 Mar 01 to correct Opera detection +// Revised 02 Oct 01 to add IE6 detection + +// Everything you always wanted to know about your JavaScript client +// but were afraid to ask ... "Is" is the constructor function for "is" object, +// which has properties indicating: +// (1) browser vendor: +// is.nav, is.ie, is.opera, is.hotjava, is.webtv, is.TVNavigator, is.AOLTV +// (2) browser version number: +// is.major (integer indicating major version number: 2, 3, 4 ...) +// is.minor (float indicating full version number: 2.02, 3.01, 4.04 ...) +// (3) browser vendor AND major version number +// is.nav2, is.nav3, is.nav4, is.nav4up, is.nav6, is.nav6up, is.gecko, is.ie3, +// is.ie4, is.ie4up, is.ie5, is.ie5up, is.ie5_5, is.ie5_5up, is.ie6, is.ie6up, is.hotjava3, is.hotjava3up +// (4) JavaScript version number: +// is.js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...) +// (5) OS platform and version: +// is.win, is.win16, is.win32, is.win31, is.win95, is.winnt, is.win98, is.winme, is.win2k +// is.os2 +// is.mac, is.mac68k, is.macppc +// is.unix +// is.sun, is.sun4, is.sun5, is.suni86 +// is.irix, is.irix5, is.irix6 +// is.hpux, is.hpux9, is.hpux10 +// is.aix, is.aix1, is.aix2, is.aix3, is.aix4 +// is.linux, is.sco, is.unixware, is.mpras, is.reliant +// is.dec, is.sinix, is.freebsd, is.bsd +// is.vms +// +// See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and +// http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html +// for detailed lists of userAgent strings. +// +// Note: you don't want your Nav4 or IE4 code to "turn off" or +// stop working when Nav5 and IE5 (or later) are released, so +// in conditional code forks, use is.nav4up ("Nav4 or greater") +// and is.ie4up ("IE4 or greater") instead of is.nav4 or is.ie4 +// to check version in code which you want to work on future +// versions. + +function Is () +{ // convert all characters to lowercase to simplify testing + var agt=navigator.userAgent.toLowerCase(); + + // *** BROWSER VERSION *** + // Note: On IE5, these return 4, so use is.ie5up to detect IE5. + + this.major = parseInt(navigator.appVersion); + this.minor = parseFloat(navigator.appVersion); + + // Note: Opera and WebTV spoof Navigator. We do strict client detection. + // If you want to allow spoofing, take out the tests for opera and webtv. + this.nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) + && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) + && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)); + this.nav2 = (this.nav && (this.major == 2)); + this.nav3 = (this.nav && (this.major == 3)); + this.nav4 = (this.nav && (this.major == 4)); + this.nav4up = (this.nav && (this.major >= 4)); + this.navonly = (this.nav && ((agt.indexOf(";nav") != -1) || + (agt.indexOf("; nav") != -1)) ); + this.nav6 = (this.nav && (this.major == 5)); + this.nav6up = (this.nav && (this.major >= 5)); + this.gecko = (agt.indexOf('gecko') != -1); + + this.ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); + this.ie3 = (this.ie && (this.major < 4)); + this.ie4 = (this.ie && (this.major == 4) && (agt.indexOf("msie 4")!=-1) ); + this.ie4up = (this.ie && (this.major >= 4)); + this.ie5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) ); + this.ie5_5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1)); + this.ie5up = (this.ie && !this.ie3 && !this.ie4); + this.ie5_5up =(this.ie && !this.ie3 && !this.ie4 && !this.ie5); + this.ie6 = (this.ie && (this.major == 4) && (agt.indexOf("msie 6.")!=-1) ); + this.ie6up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5); + + // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser + // or if this is the first browser window opened. Thus the + // variables is.aol, is.aol3, and is.aol4 aren't 100% reliable. + this.aol = (agt.indexOf("aol") != -1); + this.aol3 = (this.aol && this.ie3); + this.aol4 = (this.aol && this.ie4); + this.aol5 = (agt.indexOf("aol 5") != -1); + this.aol6 = (agt.indexOf("aol 6") != -1); + + this.opera = (agt.indexOf("opera") != -1); + this.opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1); + this.opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1); + this.opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1); + this.opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1); + this.opera5up = (this.opera && !this.opera2 && !this.opera3 && !this.opera4); + + this.webtv = (agt.indexOf("webtv") != -1); + + this.TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); + this.AOLTV = this.TVNavigator; + + this.hotjava = (agt.indexOf("hotjava") != -1); + this.hotjava3 = (this.hotjava && (this.major == 3)); + this.hotjava3up = (this.hotjava && (this.major >= 3)); + + // *** JAVASCRIPT VERSION CHECK *** + if (this.nav2 || this.ie3) this.js = 1.0; + else if (this.nav3) this.js = 1.1; + else if (this.opera5up) this.js = 1.3; + else if (this.opera) this.js = 1.1; + else if ((this.nav4 && (this.minor <= 4.05)) || this.ie4) this.js = 1.2; + else if ((this.nav4 && (this.minor > 4.05)) || this.ie5) this.js = 1.3; + else if (this.hotjava3up) this.js = 1.4; + else if (this.nav6 || this.gecko) this.js = 1.5; + // NOTE: In the future, update this code when newer versions of JS + // are released. For now, we try to provide some upward compatibility + // so that future versions of Nav and IE will show they are at + // *least* JS 1.x capable. Always check for JS version compatibility + // with > or >=. + else if (this.nav6up) this.js = 1.5; + // note ie5up on mac is 1.4 + else if (this.ie5up) this.js = 1.3 + + // HACK: no idea for other browsers; always check for JS version with > or >= + else this.js = 0.0; + + // *** PLATFORM *** + this.win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) ); + // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all + // Win32, so you can't distinguish between Win95 and WinNT. + this.win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1)); + + // is this a 16 bit compiled version? + this.win16 = ((agt.indexOf("win16")!=-1) || + (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || + (agt.indexOf("windows 16-bit")!=-1) ); + + this.win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) || + (agt.indexOf("windows 16-bit")!=-1)); + + // NOTE: Reliable detection of Win98 may not be possible. It appears that: + // - On Nav 4.x and before you'll get plain "Windows" in userAgent. + // - On Mercury client, the 32-bit version will return "Win98", but + // the 16-bit version running on Win98 will still return "Win95". + this.win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1)); + this.winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1)); + this.win32 = (this.win95 || this.winnt || this.win98 || + ((this.major >= 4) && (navigator.platform == "Win32")) || + (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1)); + + this.winme = ((agt.indexOf("win 9x 4.90")!=-1)); + this.win2k = ((agt.indexOf("windows nt 5.0")!=-1)); + + this.os2 = ((agt.indexOf("os/2")!=-1) || + (navigator.appVersion.indexOf("OS/2")!=-1) || + (agt.indexOf("ibm-webexplorer")!=-1)); + + this.mac = (agt.indexOf("mac")!=-1); + // hack ie5 js version for mac + if (this.mac && this.ie5up) this.js = 1.4; + this.mac68k = (this.mac && ((agt.indexOf("68k")!=-1) || + (agt.indexOf("68000")!=-1))); + this.macppc = (this.mac && ((agt.indexOf("ppc")!=-1) || + (agt.indexOf("powerpc")!=-1))); + + this.sun = (agt.indexOf("sunos")!=-1); + this.sun4 = (agt.indexOf("sunos 4")!=-1); + this.sun5 = (agt.indexOf("sunos 5")!=-1); + this.suni86= (this.sun && (agt.indexOf("i86")!=-1)); + this.irix = (agt.indexOf("irix") !=-1); // SGI + this.irix5 = (agt.indexOf("irix 5") !=-1); + this.irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1)); + this.hpux = (agt.indexOf("hp-ux")!=-1); + this.hpux9 = (this.hpux && (agt.indexOf("09.")!=-1)); + this.hpux10= (this.hpux && (agt.indexOf("10.")!=-1)); + this.aix = (agt.indexOf("aix") !=-1); // IBM + this.aix1 = (agt.indexOf("aix 1") !=-1); + this.aix2 = (agt.indexOf("aix 2") !=-1); + this.aix3 = (agt.indexOf("aix 3") !=-1); + this.aix4 = (agt.indexOf("aix 4") !=-1); + this.linux = (agt.indexOf("inux")!=-1); + this.sco = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1); + this.unixware = (agt.indexOf("unix_system_v")!=-1); + this.mpras = (agt.indexOf("ncr")!=-1); + this.reliant = (agt.indexOf("reliantunix")!=-1); + this.dec = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || + (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || + (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); + this.sinix = (agt.indexOf("sinix")!=-1); + this.freebsd = (agt.indexOf("freebsd")!=-1); + this.bsd = (agt.indexOf("bsd")!=-1); + this.unix = ((agt.indexOf("x11")!=-1) || this.sun || this.irix || this.hpux || + this.sco ||this.unixware || this.mpras || this.reliant || + this.dec || this.sinix || this.aix || this.linux || this.bsd || this.freebsd); + + this.vms = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1)); +} + +var is; +var isIE3Mac = false; +// this section is designed specifically for IE3 for the Mac + +if ((navigator.appVersion.indexOf("Mac")!=-1) && (navigator.userAgent.indexOf("MSIE")!=-1) && +(parseInt(navigator.appVersion)==3)) + isIE3Mac = true; +else is = new Is(); Index: trunk/core/admin_templates/incs/header.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/incs/header.tpl (revision 0) +++ trunk/core/admin_templates/incs/header.tpl (revision 6656) @@ -0,0 +1,46 @@ + + + +In-Portal :: Administration Panel + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + \ No newline at end of file Index: trunk/core/admin_templates/incs/style.css =================================================================== diff -u -N --- trunk/core/admin_templates/incs/style.css (revision 0) +++ trunk/core/admin_templates/incs/style.css (revision 6656) @@ -0,0 +1,587 @@ +/* --- In-Portal --- */ + + +.head_version { + font-family: verdana, arial; + font-size: 10px; + font-weight: normal; + color: white; + padding-right: 5px; + text-decoration: none; +} + +body { + font-family: Verdana, Arial, Helvetica, Sans-serif; + font-size: 12px; + color: #000000; + scrollbar-3dlight-color: #333333; + scrollbar-arrow-color: #ffffff; + scrollbar-track-color: #88d2f8; + scrollbar-darkshadow-color: #333333; + scrollbar-highlight-color: #009ffd; + scrollbar-shadow-color: #009ffd; + scrollbar-face-color: #009ffd; + overflow-x: auto; overflow-y: auto; +} + +A { + color: #006699; + text-decoration: none; +} + +A:hover { + color: #009ff0; + text-decoration: none; +} + +TD { + font-family: verdana,helvetica; + font-size: 10pt; + text-decoration: none; +} + +form { + display: inline; +} + +.text { + font-family: verdana, arial; + font-size: 12px; + font-weight: normal; + text-decoration: none; +} + +.tablenav { + font-family: verdana, arial; + font-size: 14px; + font-weight: bold; + color: #FFFFFF; + + text-decoration: none; + background-color: #73C4F5; + background: url(../img/tabnav_back.gif) repeat-x; +} + +.tablenav_link { + font-family: verdana, arial; + font-size: 14px; + font-weight: bold; + color: #FFFFFF; + text-decoration: none; +} + +.header_left_bg { + background: url(../img/tabnav_left.gif) no-repeat; +} + +.tablenav_link:hover { + font-family: verdana, arial; + font-size: 14px; + font-weight: bold; + color: #ffcc00; + text-decoration: none; +} + +.tableborder { + font-family: arial, helvetica, sans-serif; + font-size: 10pt; + border: 1px solid #000000; + border-top-width: 0px; + border-collapse: collapse; +} + +.tableborder_full, .tableborder_full_kernel { + font-family: Arial, Helvetica, sans-serif; + font-size: 10pt; + border: 1px solid #000000; +} + + +.button { + font-family: arial, verdana; + font-size: 12px; + font-weight: normal; + color: #000000; + background: url(../img/button_back.gif) #f9eeae repeat-x; + text-decoration: none; +} + +.button-disabled { + font-family: arial, verdana; + font-size: 12px; + font-weight: normal; + color: #676767; + background: url(../img/button_back_disabled.gif) #f9eeae repeat-x; + text-decoration: none; +} + +.hint_red { + font-family: Arial, Helvetica, sans-serif; + font-size: 10px; + font-style: normal; + color: #FF0000; + /* background-color: #F0F1EB; */ +} + +.tree_head { + font-family: verdana, arial; + font-size: 10px; + font-weight: bold; + color: #FFFFFF; + text-decoration: none; +} + +.admintitle { + font-family: verdana, arial; + font-size: 20px; + font-weight: bold; + color: #009FF0; + text-decoration: none; +} + +.table_border_notop, .table_border_nobottom { + background-color: #F0F1EB; + border: 1px solid #000000; +} + +.table_border_notop { + border-top-width: 0px; +} + +.table_border_nobottom { + border-bottom-width: 0px; +} + +.pagination_bar { + background-color: #D7D7D7; + border: 1px solid #000000; + border-top-width: 0px; +} + +/* Categories */ + +.priority { + color: #FF0000; + padding-left: 1px; + padding-right: 1px; + font-size: 11px; +} + +.cat_no, .cat_desc, .cat_new, .cat_pick, .cats_stats { + font-family: arial, verdana, sans-serif; +} + +.cat_no { + font-size: 10px; + color: #707070; +} + +.cat_desc { + font-size: 9pt; + color: #000000; +} + +.cat_new { + font-size: 12px; + vertical-align: super; + color: blue; +} + +.cat_pick { + font-size: 12px; + vertical-align: super; + color: #009900; +} + +.cats_stats { + font-size: 11px; + color: #707070; +} + +/* Links */ + +.link, .link:hover, .link_desc, .link_detail { + font-family: arial, helvetica, sans-serif; +} + +.link { + font-size: 9pt; + color: #1F569A; +} + +.link:hover { + font-size: 9pt; + color: #009FF0; +} + +.link_desc { + font-size: 9pt; + color: #000000; +} + +.link_detail { + font-size: 11px; + color: #707070; +} + +.link_rate, .link_review, .link_modify, .link_div, .link_new, .link_top, .link_pop, .link_pick { + font-family: arial, helvetica, sans-serif; + font-size: 12px; +} + +.link_rate, .link_review, .link_modify, .link_div { + text-decoration: none; +} + +.link_rate { color: #006600; } +.link_review { color: #A27900; } +.link_modify { color: #800000; } +.link_div { color: #000000; } + +.link_new, .link_top, .link_pop, .link_pick { + vertical-align: super; +} + +.link_new { color: #0000FF; } +.link_top { color: #FF0000; } +.link_pop { color: FFA500; } +.link_pick { color: #009900; } + +/* ToolBar */ + +.divider { + BACKGROUND-COLOR: #999999 +} + +.toolbar { + font-family: Arial, Helvetica, sans-serif; + font-size: 10pt; + border: 1px solid #000000; + border-width: 0 1 1 1; + background-color: #F0F1EB; +} + +.current_page { + font-family: verdana; + font-size: 12px; + font-weight: bold; + background-color: #C4C4C4; + padding-left: 1px; + padding-right: 1px; +} + +.nav_url { + font-family: verdana; + font-size: 12px; + font-weight: bold; + color: #1F569A; +} + +.nav_arrow { + font-family: verdana; + font-size: 12px; + font-weight: normal; + color: #1F569A; + padding-left: 3px; + padding-right: 3px; +} + +.nav_current_item { + font-family: verdana; + font-size: 12px; + font-weight: bold; + color: #666666; +} + +/* Edit forms */ + +.hint { + font-family: arial, helvetica, sans-serif; + font-size: 12px; + font-style: normal; + color: #666666; +} + +.table_color1, .table_color2 { + font-family: verdana, arial; + font-size: 14px; + font-weight: normal; + color: #000000; + text-decoration: none; +} + +.table_color1 { background-color: #F6F6F6; } +.table_color2 { background-color: #EBEBEB; } + + +.table_white, .table_white_selected { + font-family: verdana, arial; + font-weight: normal; + font-size: 14px; + color: #000000; + text-decoration: none; + padding-top: 0px; + padding-bottom: 0px; +} + +.table_white { + background-color: #FFFFFF; +} + +.table_white_selected { + background-color: #C6D6EF; +} + +.subsectiontitle { + font-family: verdana, arial; + font-size: 14px; + font-weight: bold; + background-color: #999999; + text-decoration: none; + + color: #FFFFFF; + +} + +.subsectiontitle:hover { + font-family: verdana, arial; + font-size: 14px; + font-weight: bold; + background-color: #999999; + text-decoration: none; + + color: #FFCC00; +} + +.error { + font-family: arial, helvetica, sans-serif; + font-weight: bold; + font-size: 9pt; + color: #FF0000; +} + +/* Tabs */ + +.tab_border { + border: 1px solid #000000; + border-width: 1 0 0 0; +} + +.tab, .tab:hover { + font-family: verdana, arial, helvetica; + font-size: 12px; + font-weight: bold; + color: #000000; + text-decoration: none; +} + +.tab2, .tab2:hover { + font-family: verdana, arial, helvetica; + font-size: 12px; + font-weight: bold; + text-decoration: none; +} + +.tab2 { color: #FFFFFF; } +.tab2:hover { color: #000000; } + +/* Item DIVS */ + +.selected_div { background-color: #C6D6EF; } +.notselected_div { background-color: #FFFFFF; } + +/* Item tabs */ + + +.itemtab_active { + background: url("../img/itemtabs/tab_active.gif") #eee repeat-x; +} + +.itemtab_inactive { + background: url("../img/itemtabs/tab_inactive.gif") #F9EEAE repeat-x; +} + + +/* Grids */ + +.columntitle, .columntitle:hover { + font-family: verdana, arial; + font-size: 14px; + font-weight: bold; + background-color: #999999; + text-decoration: none; +} + +.columntitle { color: #FFFFFF; } +.columntitle:hover { color: #FFCC00; } + +.columntitle_small, .columntitle_small:hover { + font-family: verdana, arial; + font-size: 12px; + font-weight: bold; + background-color: #999999; + text-decoration: none; +} + +.columntitle_small { color: #FFFFFF; } +.columntitle_small:hover { color: #FFCC00; } + +/* ----------------------------- */ + +.section_header_bg { + background: url(../img/logo_bg.gif) no-repeat top right; +} + +.small { + font-size: 9px; + font-family: Verdana, Arial, Helvetica, sans-serif; +} + +/* order preview & preview_print styles */ + +.order_print_defaults TD, +.order_preview_header, +.order_preview_header TD, +.order_print_preview_header TD, +.order_preview_field_name, +.order-totals-name, +.arial2r, +.orders_print_flat_table TD { + font-family: Arial; + font-size: 10pt; +} + +.order_preview_header, .order_preview_header TD, .order_print_preview_header TD { + background-color: #C9E9FE; + font-weight: bold; +} + +.order_print_preview_header TD { + background-color: #FFFFFF; +} + +.order_preview_field_name { + font-weight: bold; + padding: 2px 4px 2px 4px; +} + +.order-totals-name { + font-style: normal; +} + +.border1 { + border: 1px solid #111111; +} + +.arial2r { + color: #602830; + font-weight: bold; +} + +.orders_flat_table, .orders_print_flat_table { + border-collapse: collapse; + margin: 5px; +} + +.orders_flat_table TD { + padding: 2px 5px 2px 5px; + border: 1px solid #444444; +} + +.orders_print_flat_table TD { + border: 1px solid #000000; + padding: 2px 5px 2px 5px; +} + +.help_box { + padding: 5px 10px 5px 10px; +} + +.progress_bar +{ + background: url(../img/progress_bar_segment.gif); +} + +.grid_id_cell TD { + padding-right: 2px; +} + +/*.transparent { + filter: alpha(opacity=50); + -moz-opacity: .5; + opacity: .5; +}*/ + +.none_transparent { + +} + +.subitem_icon { + vertical-align: top; + padding-top: 0px; + text-align: center; + width: 28px; +} + +.subitem_description { + vertical-align: middle; +} + +.dLink, .dLink:hover { + display: block; + margin-bottom: 5px; + font-family: Verdana; + font-size: 13px; + font-weight: bold; + color: #2C73CB; +} + +.dLink { + text-decoration: none; +} + +.dLink:hover { + text-decoration: underline; +} + +a.config-header, a.config-header:hover { + color: #FFFFFF; + font-size: 11px; +} + +.catalog-tab-left { + background: url(../img/itemtabs/tab_left.gif) top left no-repeat; +} + +.catalog-tab-middle { + background: url(../img/itemtabs/tab_middle.gif) top left repeat-x; +} + +.catalog-tab-right { + background: url(../img/itemtabs/tab_right.gif) top right no-repeat; +} + +catalog-tab-separator td { + background: #FFFFFF; +} + +.catalog-tab-selected td { + background-color: #E0E0DA; + cursor: default; +} + +.catalog-tab-unselected td, .catalog-tab-unselected td span { + background-color: #F0F1EB; + cursor: pointer; +} + +.catalog-tab { + display: none; + width: 100%; +} + +.progress-text { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 9px; + color: #414141; +} \ No newline at end of file Index: trunk/core/admin_templates/logout.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/logout.tpl (revision 0) +++ trunk/core/admin_templates/logout.tpl (revision 6656) @@ -0,0 +1 @@ +Logout Template \ No newline at end of file Index: trunk/core/admin_templates/img/logo.gif =================================================================== diff -u -N Binary files differ Index: trunk/core/admin_templates/img/spacer.gif =================================================================== diff -u -N Binary files differ Index: trunk/core/admin_templates/js/ajax.js =================================================================== diff -u -N --- trunk/core/admin_templates/js/ajax.js (revision 0) +++ trunk/core/admin_templates/js/ajax.js (revision 6656) @@ -0,0 +1,257 @@ +// Main AJAX classs +function Request() {} + +Request.timeout = 5000; //5 seconds +Request.method = 'GET'; +Request.headers = new Array(); +Request.params = null; + +Request.makeRequest = function(p_url, p_busyReq, p_progId, p_successCallBack, p_errorCallBack, p_pass, p_object) { + //p_url: the web service url + //p_busyReq: is a request for this object currently in progress? + //p_progId: element id where progress HTML should be shown + //p_successCallBack: callback function for successful response + //p_errorCallBack: callback function for erroneous response + //p_pass: string of params to pass to callback functions + //p_object: object of params to pass to callback functions + + if (p_busyReq) return; + var req = Request.getRequest(); + if (req != null) { + p_busyReq = true; + Request.showProgress(p_progId); + req.onreadystatechange = function() { + if (req.readyState == 4) { + p_busyReq = false; + window.clearTimeout(toId); + if (req.status == 200) { + p_successCallBack(req, p_pass, p_object); + } else { + p_errorCallBack(req, p_pass, p_object); + } + Request.hideProgress(p_progId); + } + } + var $ajax_mark = (p_url.indexOf('?') ? '&' : '?') + 'ajax=yes'; + req.open(Request.method, p_url + $ajax_mark, true); + + if (Request.method == 'POST') { + Request.headers['Content-type'] = 'application/x-www-form-urlencoded'; + Request.headers['referer'] = p_url; + } + else { + Request.headers['If-Modified-Since'] = 'Sat, 1 Jan 2000 00:00:00 GMT'; + } + + Request.sendHeaders(req); + if (Request.method == 'POST') { + req.send(Request.params); + Request.method = 'GET'; // restore method back to GET + } + else { + req.send(null); + } + + var toId = window.setTimeout( function() {if (p_busyReq) req.abort();}, Request.timeout ); + } +} + +Request.sendHeaders = function($request) { + for (var $header_name in Request.headers) { + $request.setRequestHeader($header_name, Request.headers[$header_name]); + } + Request.headers = new Array(); // reset header afterwards +} + +Request.getRequest = function() { + var xmlHttp; + try { xmlHttp = new ActiveXObject('MSXML2.XMLHTTP'); return xmlHttp; } catch (e) {} + try { xmlHttp = new ActiveXObject('Microsoft.XMLHTTP'); return xmlHttp; } catch (e) {} + try { xmlHttp = new XMLHttpRequest(); return xmlHttp; } catch(e) {} + return null; +} + +Request.showProgress = function(p_id) { + if (p_id != '') { + Request.setOpacity(20, p_id); + + if (!document.getElementById(p_id + '_progress')) { + document.body.appendChild(Request.getProgressObject(p_id)); + } + else { + var $progress_div = document.getElementById(p_id + '_progress'); + $progress_div.style.top = getRealTop(p_id) + 'px'; + $progress_div.style.height = document.getElementById(p_id).clientHeight; + $progress_div.style.display = 'block'; + } +// document.getElementById(p_id).innerHTML = Request.getProgressHtml(); + } +} + +Request.hideProgress = function(p_id) { + if (p_id != '') { + document.getElementById(p_id + '_progress').style.display = 'none'; + Request.setOpacity(100, p_id); + } +} + +Request.setOpacity = function (opacity, id) { + var object = document.getElementById(id).style; + object.opacity = (opacity / 100); + object.MozOpacity = (opacity / 100); + object.KhtmlOpacity = (opacity / 100); + object.filter = "alpha(opacity=" + opacity + ")"; +} + +Request.getProgressHtml = function() { + return "

" + Request.progressText + "
" + Request.progressText + "

"; +} + +Request.getProgressObject = function($id) { + var $div = document.createElement('DIV'); + var $parent_div = document.getElementById($id); + + $div.id = $id + '_progress'; + + $div.style.width = $parent_div.clientWidth + 'px'; + $div.style.height = '150px'; // default height if div is empty (first ajax request for div) + $div.style.left = getRealLeft($parent_div) + 'px'; + $div.style.top = getRealTop($parent_div) + 'px'; + $div.style.position = 'absolute'; + + /*$div.style.border = '1px solid green'; + $div.style.backgroundColor = '#FF0000';*/ + + $div.innerHTML = '
'+Request.progressText+'
'+escape(Request.progressText)+'
'; + return $div; +} + +Request.getErrorHtml = function(p_req) { + //TODO: implement accepted way to handle request error + return '[status: ' + p_req.status + '; status_text: ' + p_req.statusText + '; responce_text: ' + p_req.responseText + ']'; +} + +Request.serializeForm = function(theform) { + if (typeof(theform) == 'string') { + theform = document.getElementById(theform); + } + + var els = theform.elements; + var len = els.length; + var queryString = ''; + + Request.addField = function(name, value) { + if (queryString.length > 0) queryString += '&'; + queryString += encodeURIComponent(name) + '=' + encodeURIComponent(value); + }; + + for (var i = 0; i= 0) { + Request.addField(el.name, el.options[el.selectedIndex].value); + } + break; + + case 'select-multiple': + for (var j = 0; j < el.options.length; j++) { + if (!el.options[j].selected) continue; + Request.addField(el.name, el.options[j].value); + } + break; + + case 'checkbox': + case 'radio': + if (!el.checked) continue; + Request.addField(el.name,el.value); + break; + } + } + return queryString; +}; + +// AJAX ProgressBar classs +function AjaxProgressBar($url) { + this.WindowTitle = this.GetWindow().document.title; + this.URL = $url; + this.BusyRequest = false; + this.LastResponceTime = this.GetMicroTime(); + this.ProgressPercent = 0; // progress percent + this.ProgressTime = new Array(); + this.Query(); +} + +AjaxProgressBar.prototype.GetWindow = function() { + return window.parent ? window.parent : window; +} + +AjaxProgressBar.prototype.GetMicroTime = function() { + var $now = new Date(); + return Math.round($now.getTime() / 1000); // because miliseconds are returned too +} + +AjaxProgressBar.prototype.Query = function() { + Request.makeRequest(this.URL, this.BusyRequest, '', this.successCallback, this.errorCallback, '', this); +} + +// return time needed for progress to finish +AjaxProgressBar.prototype.GetEstimatedTime = function() { + return Math.ceil((100 - this.ProgressPercent) * Math.sum(this.ProgressTime) / this.ProgressPercent); +} + +AjaxProgressBar.prototype.successCallback = function($request, $params, $object) { + var $responce = $request.responseText; + var $match_redirect = new RegExp('^#redirect#(.*)').exec($responce); + if ($match_redirect != null) { + $object.showProgress(100); + // redirect to external template requested + window.location.href = $match_redirect[1]; + return false; + } + + if ($object.showProgress($responce)) { + $object.Query(); + } +} + +AjaxProgressBar.prototype.errorCallback = function($request, $params, $object) { + alert('AJAX Error; class: AjaxProgressBar; ' + Request.getErrorHtml($request)); +} + +AjaxProgressBar.prototype.FormatTime = function ($seconds) { + $seconds = parseInt($seconds); + + var $minutes = Math.floor($seconds / 60); + if ($minutes < 10) $minutes = '0' + $minutes; + $seconds = $seconds % 60; + if ($seconds < 10) $seconds = '0' + $seconds; + + return $minutes + ':' + $seconds; +} + +AjaxProgressBar.prototype.showProgress = function ($percent) { + this.ProgressPercent = $percent; + var $now = this.GetMicroTime(); + this.ProgressTime[this.ProgressTime.length] = $now - this.LastResponceTime; + this.LastResponceTime = $now; + + var $display_progress = parseInt(this.ProgressPercent); + this.GetWindow().document.title = $display_progress + '% - ' + this.WindowTitle; + document.getElementById('progress_display[percents_completed]').innerHTML = $display_progress + '%'; + document.getElementById('progress_display[elapsed_time]').innerHTML = this.FormatTime( Math.sum(this.ProgressTime) ); + document.getElementById('progress_display[Estimated_time]').innerHTML = this.FormatTime( this.GetEstimatedTime() ); + + document.getElementById('progress_bar[done]').style.width = $display_progress + '%'; + document.getElementById('progress_bar[left]').style.width = (100 - $display_progress) + '%'; + return $percent < 100 ? true : false; +} \ No newline at end of file Index: trunk/core/admin_templates/index.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/index.tpl (revision 0) +++ trunk/core/admin_templates/index.tpl (revision 6656) @@ -0,0 +1,52 @@ + + + + + + + In-portal Administration + + + + + + + + + + " name="head" scrolling="no" noresize> + + " name="menu" target="main" noresize scrolling="auto" marginwidth="0" marginheight="0"> + " name="main" marginwidth="0" marginheight="0" frameborder="no" noresize scrolling="auto"> + + + + <body bgcolor="#FFFFFF"> + <p></p> + </body> + + \ No newline at end of file Index: trunk/core/admin_templates/js/tree.js =================================================================== diff -u -N --- trunk/core/admin_templates/js/tree.js (revision 0) +++ trunk/core/admin_templates/js/tree.js (revision 6656) @@ -0,0 +1,388 @@ +function TreeItem(title, url, icon, onclick) +{ + this.Title = title; + this.Url = url; + this.Rendered = false; + this.Displayed = false; + this.Level = 0; + this.Icon = icon; + this.Onclick = onclick; +} + +TreeItem.prototype.Render = function(before) +{ + if (!this.Rendered) { + if (!isset(before)) {before = null} + + tr = document.createElement('tr'); + this.ParentElement.insertBefore(tr, before); + if (!this.Displayed) { tr.style.display = 'none' } + td = document.createElement('td'); + td.TreeElement = this; + tr.appendChild(td); + + this.appendLevel(td); + if (this.ParentFolder != null) this.appendNodeImage(td); + this.appendIcon(td); + this.appendLink(td); + + this.Tr = tr; + this.Rendered = true; +// alert(this.Tr.innerHTML) + } +} + +TreeItem.prototype.appendLevel = function(td) +{ + for (var i=0; i < this.Level; i++) + { + img = document.createElement('img'); + img.src = TREE_ICONS_PATH+'/ftv2blank.gif'; + img.style.verticalAlign = 'middle'; + td.appendChild(img); + } +} + +TreeItem.prototype.getNodeImage = function(is_last) +{ + return is_last ? TREE_ICONS_PATH+'/ftv2lastnode.gif' : TREE_ICONS_PATH+'/ftv2node.gif'; +} + +TreeItem.prototype.appendNodeImage = function(td) +{ + img = document.createElement('img'); + img.src = this.getNodeImage(); + img.style.verticalAlign = 'middle'; + td.appendChild(img); +} + +TreeItem.prototype.appendIcon = function (td) +{ + img = document.createElement('img'); + if (this.Icon.indexOf('http://') != -1) { + img.src = this.Icon; + } + else { + img.src = this.Icon; + } + img.style.verticalAlign = 'middle'; + td.appendChild(img); +} + +TreeItem.prototype.appendLink = function (td) +{ + var $node_text = document.createElement('span'); + $node_text.innerHTML = this.Title; + + link = document.createElement('a'); + link.nodeValue = this.Title; + link.href = this.Url; + link.target = 'main'; + link.appendChild($node_text); + + link.treeItem = this; + //addEvent(link, 'click', + + link.onclick = + function(ev) { + var e = is.ie ? window.event : ev; + + res = true; + if (isset(this.treeItem.Onclick)) { + res = eval(this.treeItem.Onclick); + } + if (!res) { // if we need to cancel onclick action + if (is.ie) { + window.event.cancelBubble = true; + window.event.returnValue = false; + } else { + ev.preventDefault(); + ev.stopPropagation(); + } + return res; + } + else { + // ensures, that click is made before AJAX request will be sent + if (res === true) { + // only in case of "true" is returned, used in catalog + window.parent.getFrame(link.target).location.href = this.href; + } + + if (!this.treeItem.Expanded && typeof(this.treeItem.folderClick) == 'function') { + if (this.treeItem.folderClick()); + } + return false; + } + } + + td.appendChild(link); +} + +TreeItem.prototype.display = function() +{ + this.Tr.style.display = is.ie ? 'block' : 'table-row'; + this.Displayed = true; +} + +TreeItem.prototype.hide = function() +{ + this.Tr.style.display = 'none'; + this.Displayed = false; +} + +TreeItem.prototype.expand = function() { this.display() } + +TreeItem.prototype.collapse = function() { this.hide() } + +TreeItem.prototype.updateLastNodes = function(is_last, lines_pattern) +{ + if (!isset(is_last)) is_last = true; + if (!isset(this.Tr)) return; + if (!isset(lines_pattern)) { var lines_pattern = new Array() } + + imgs = this.Tr.getElementsByTagName('img'); + found = false; + for (var i=0; i +

+
+ + + + + + + + \ No newline at end of file Index: trunk/core/admin_templates/incs/in-portal.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/incs/in-portal.tpl (revision 0) +++ trunk/core/admin_templates/incs/in-portal.tpl (revision 6656) @@ -0,0 +1,3 @@ + + + Index: trunk/core/admin_templates/img/button_back.gif =================================================================== diff -u -N Binary files differ Index: trunk/core/admin_templates/tree.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/tree.tpl (revision 0) +++ trunk/core/admin_templates/tree.tpl (revision 6656) @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + +
+  ');">In-Portal v + + +
+ + + " onclick="" icon="img/icons/icon24_.gif"> + + " onclick="" name="" icon="img/icons/icon24_.gif" load_url=""> + + + + + + +
+ +
+ + + + \ No newline at end of file Index: trunk/core/admin_templates/js/toolbar.js =================================================================== diff -u -N --- trunk/core/admin_templates/js/toolbar.js (revision 0) +++ trunk/core/admin_templates/js/toolbar.js (revision 6656) @@ -0,0 +1,231 @@ +function ToolBarButton(title, alt, onclick, $hidden, prefix) +{ + this.Title = title || ''; + this.CheckTitleModule(); + this.Alt = RemoveTranslationLink(alt || ''); + + if (typeof(onclick) == 'function') { + this.onClick = onclick; + } + else { + this.onClick = function() { + if (eval('typeof('+this.Title+')') == 'function') + eval(this.Title + '()'); + } + + } + + this.imgObject = null; + this.Enabled = true; + this.Hidden = $hidden ? true : false; + this.ToolBar = null; + this.Prefix = prefix ? prefix : ''; +} + +ToolBarButton.prototype.CheckTitleModule = function() +{ + if (this.Title.match(/([^:]+):(.*)$/)) { + // has module set directly + this.Title = RegExp.$2; + this.Module = RegExp.$1; + } + else { + // use default module + this.Module = 'kernel'; + } +} + +ToolBarButton.prototype.IconsPath = function() +{ + if (typeof(img_path) == 'undefined') { + //alert('error: toolbar image path not set'); + } + return img_path.replace('#MODULE#', this.Module) + 'toolbar/'; +} + +ToolBarButton.prototype.GetHTML = function() { + return ''; +} + +ToolBarButton.prototype.GetToolID = function() { + return this.Prefix == '' ? 'tool_' + this.Title : 'tool_['+this.Prefix+'][' + this.Title+']' +} + +ToolBarButton.prototype.Init = function() { + + img = document.getElementById(this.GetToolID()); + this.imgObject = img; + img.btn = this; + this.SetOnMouseOver(); + this.SetOnMouseOut(); + this.SetOnClick(); + if (this.Hidden) this.Hide(); +} + +ToolBarButton.prototype.SetOnMouseOver = function() { + this.imgObject.onmouseover = function() { + this.src = this.btn.IconsPath() + this.btn.ToolBar.IconPrefix + this.btn.Title + '_f2.gif'; + }; +} + +ToolBarButton.prototype.SetOnMouseOut = function() { + this.imgObject.onmouseout = function() { + this.src = this.btn.IconsPath() + this.btn.ToolBar.IconPrefix + this.btn.Title + '.gif'; + }; +} + +ToolBarButton.prototype.SetOnClick = function() { + this.imgObject.onmouseout = function() { + this.src = this.btn.IconsPath() + this.btn.ToolBar.IconPrefix + this.btn.Title + '.gif'; + }; + this.imgObject.inClick = false; + if (typeof(this.onClick) != 'function') { + this.imgObject.onclick = function() { + if (this.inClick) return; + this.inClick = true; + if (eval('typeof('+this.btn.Title+')') == 'function') + eval(this.btn.Title + '()'); + this.inClick = false; + } + } + else { + this.imgObject.onclick = function() { + if (this.inClick) return; + this.inClick = true; + this.btn.onClick(); + this.inClick = false; + } + } + + // the following lines are correct, as long as mozilla understands 'pointer', but IE 'hand', + // do not change the order of these lines! + if (is.ie6up || is.gecko) { + this.imgObject.style.cursor = 'pointer'; + } + else { + // somehow set cursor hand for IE 5/ 5.5 +// this.imgObject.style = 'cursor: hand'; + } +} + +ToolBarButton.prototype.Disable = function() { + if ( !this.Enabled ) return; + this.imgObject.src = this.IconsPath() + this.ToolBar.IconPrefix + this.Title + '_f3.gif'; + this.imgObject.onmouseover = null; + this.imgObject.onmouseout = null; + this.imgObject.onclick = null; + this.imgObject.style.cursor = 'default'; + this.Enabled = false; +} + +ToolBarButton.prototype.Enable = function() { + if (this.Enabled) return; + this.imgObject.src = this.IconsPath() + this.ToolBar.IconPrefix + this.Title + '.gif'; + this.SetOnMouseOver(); + this.SetOnMouseOut(); + this.SetOnClick(); + this.Enabled = true; +} + +ToolBarButton.prototype.Hide = function() { + this.imgObject.style.display = 'none'; + this.Hidden = true; +} + +ToolBarButton.prototype.Show = function() { + this.imgObject.style.display = ''; + this.Hidden = false; +} + +/* ----------- */ + +function ToolBarSeparator(title) //extends ToolBarButton +{ + this.Title = title; +} +ToolBarSeparator.prototype = new ToolBarButton; + +ToolBarSeparator.prototype.GetHTML = function() { + return ''; +} + +ToolBarSeparator.prototype.Init = function() { + img = document.getElementById(this.ToolBar.IconPrefix + this.Title); + this.imgObject = img; + img.btn = this; +} + +ToolBarSeparator.prototype.Enable = function() { } +ToolBarSeparator.prototype.Disable = function() { } + +/* ----------- */ + + +function ToolBar(icon_prefix, $module) +{ + this.Module = $module ? $module : 'kernel'; + this.IconPrefix = icon_prefix ? icon_prefix : 'tool_'; + this.Buttons = new Array(); +} + +ToolBar.prototype.AddButton = function(a_button) +{ + a_button.ToolBar = this; + this.Buttons[a_button.Title] = a_button; +} + +ToolBar.prototype.Render = function($container) +{ + if ($container) { + $container.innerHTML = ''; // container will contain only buttons + for (var i in this.Buttons) { + btn = this.Buttons[i]; + $container.innerHTML += btn.GetHTML(); + } + + // init all buttons after because objects are not yet created directly after assigning to innerHTML + for (var i in this.Buttons) { + btn = this.Buttons[i]; + btn.Init(); + } + } + else { + for (var i in this.Buttons) { + btn = this.Buttons[i]; + document.write( btn.GetHTML() ); + btn.Init(); + } + } +} + +ToolBar.prototype.EnableButton = function(button_id) { + if(this.ButtonExists(button_id)) this.Buttons[button_id].Enable(); +} + +ToolBar.prototype.DisableButton = function(button_id) { + if(this.ButtonExists(button_id)) this.Buttons[button_id].Disable(); +} + +ToolBar.prototype.HideButton = function(button_id) { + if(this.ButtonExists(button_id)) this.Buttons[button_id].Hide(); +} + +ToolBar.prototype.ShowButton = function(button_id) { + if(this.ButtonExists(button_id)) this.Buttons[button_id].Show(); +} + +ToolBar.prototype.SetEnabled = function(button_id, $enabled) { + var $ret = $enabled ? this.EnableButton(button_id) : this.DisableButton(button_id); +} + +ToolBar.prototype.SetVisible = function(button_id, $visible) { + var $ret = $visible ? this.ShowButton(button_id) : this.HideButton(button_id); +} + +ToolBar.prototype.GetButtonImage = function(button_id) { + if( this.ButtonExists(button_id) ) return this.Buttons[button_id].imgObject; +} + +ToolBar.prototype.ButtonExists = function(button_id) { + return typeof(this.Buttons[button_id]) == 'object'; +} Index: trunk/core/admin_templates/head.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/head.tpl (revision 0) +++ trunk/core/admin_templates/head.tpl (revision 6656) @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + +
+ " target="main"> + + " target="main"> + + + + + + + + + + +
+
+
+ + + " target="_parent"> +
+
+
+
+ + Index: trunk/core/admin_templates/incs/grid_blocks.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/incs/grid_blocks.tpl (revision 0) +++ trunk/core/admin_templates/incs/grid_blocks.tpl (revision 6656) @@ -0,0 +1,392 @@ + + + + + +
', , )" class="nav_url"> + + + + ', , )" class="nav_url">> + + + + ', , )" class="nav_url">< + + + + ', , )" class="nav_url">>> + + + + ', , )" class="nav_url"><< + + + + +tableborder_full_kernelpagination_bar"> + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + +
+ _search_keyword" + name="_search_keyword" + value="" + PrefixSpecial="" + Grid="" + ajax="" + style="border: 1px solid grey;"> + + ]"> + +
+ +
+ + + document.getElementById('_search_keyword').onkeydown = search_keydown; + Toolbars['_search'] = new ToolBar('icon16_'); + Toolbars['_search'].AddButton( + new ToolBarButton( + 'search', + '', + function() { search('','', ) }, + null, + '') ); + Toolbars['_search'].AddButton( + new ToolBarButton( + 'search_reset', + '', + function() { search_reset('','', ) }, + null, + '') ); + Toolbars['_search'].Render(document.getElementById('search_buttons[]')); + + + + + ','', );" class="columntitle_small">.gif" border="0" align="absmiddle"> + + + + + + + + + + + + + + + + + +
" id="">">
+ + + + + + + + + + +
" id="">
+ + + + + + + + + + + +
" id="">">
+ + + + + + + + + + +
">
+ + + + + + + + + + + +
" id="">">
+ + + + + + + + + " name="" value=""> + + + + + + + + + error"> + + *:
+ + ,-cdata', '-cdata:cust_', 'popups/translator', , 1);" title=""> + + ,-cdata', '-cdata:cust_', 'popups/translator', );" title=""> + + + + + +   + + + + + + + + + + $Menus[''+'_sorting_menu'].addMenuItem('','direct_sort_grid("","","", null, );','2'); + + + + $Menus[''+'_filter_menu'].addMenuItem('','',''); + + + + $Menus[''+'_filter_menu'].addMenuSeparator(); + + + + // define ViewMenu + $fw_menus[''+'_view_menu'] = function() + { + + // filtring menu + $Menus[''+'_filter_menu'] = new Menu(''); + $Menus[''+'_filter_menu'].addMenuItem('All','filters_remove_all("", );'); + $Menus[''+'_filter_menu'].addMenuItem('None','filters_apply_all("", );'); + $Menus[''+'_filter_menu'].addMenuSeparator(); + + + + + // sorting menu + $Menus[''+'_sorting_menu'] = new Menu(''); + $Menus[''+'_sorting_menu'].addMenuItem('','direct_sort_grid("","","asc",null,);','2'); + $Menus[''+'_sorting_menu'].addMenuItem('','direct_sort_grid("","","desc",null,);','2'); + $Menus[''+'_sorting_menu'].addMenuSeparator(); + $Menus[''+'_sorting_menu'].addMenuItem('','reset_sorting("");'); + + + + + // per page menu + $Menus[''+'_perpage_menu'] = new Menu(''); + $Menus[''+'_perpage_menu'].addMenuItem('10','set_per_page("",10,);','2'); + $Menus[''+'_perpage_menu'].addMenuItem('20','set_per_page("",20,);','2'); + $Menus[''+'_perpage_menu'].addMenuItem('50','set_per_page("",50,);','2'); + $Menus[''+'_perpage_menu'].addMenuItem('100','set_per_page("",100,);','2'); + $Menus[''+'_perpage_menu'].addMenuItem('500','set_per_page("",500,);','2'); + + + + // select menu + $Menus[''+'_select_menu'] = new Menu(''); + $Menus[''+'_select_menu'].addMenuItem('','Grids[""].SelectAll();'); + $Menus[''+'_select_menu'].addMenuItem('','Grids[""].ClearSelection();'); + $Menus[''+'_select_menu'].addMenuItem('','Grids[""].InvertSelection();'); + + + processHooks('ViewMenu', hBEFORE, ''); + + $Menus[''+'_view_menu'] = new Menu(''); + + $Menus[''+'_view_menu'].addMenuItem( $Menus[''+'_filter_menu'] ); + + + $Menus[''+'_view_menu'].addMenuItem( $Menus[''+'_sorting_menu'] ); + + + $Menus[''+'_view_menu'].addMenuItem( $Menus[''+'_perpage_menu'] ); + + + $Menus[''+'_view_menu'].addMenuItem( $Menus[''+'_select_menu'] ); + + + processHooks('ViewMenu', hAFTER, ''); + } + + + + nobottomnotop"> + + + +
+ +
+ + + + + + + + nobottomnotop"> + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + " id="_" sequence=""> + + + + + + +
+ + + + + + + + + + + _Sort1" name="_Sort1" value=""> + _Sort1_Dir" name="_Sort1_Dir" value="asc"> +
+ + + + Grids[''] = new Grid('', '', ':original', edit, a_toolbar); + Grids[''].AddItemsByIdMask('', /^_([\d\w-]+)/, '[$$ID$$][]'); + Grids[''].InitItems(); + + + $ViewMenus = new Array(''); + + + + + + nobottomnotop"> + + + +
+ +
+
+ + + +
+ + + %">  + + + + + +
+ + + + + + + + + + + _Sort1" name="_Sort1" value=""> + _Sort1_Dir" name="_Sort1_Dir" value="asc"> +
\ No newline at end of file Index: trunk/core/admin_templates/js/in-portal.js =================================================================== diff -u -N --- trunk/core/admin_templates/js/in-portal.js (revision 0) +++ trunk/core/admin_templates/js/in-portal.js (revision 6656) @@ -0,0 +1,51 @@ +function select_selected(list, selected_value) +{ + var count = list.options.length; + for (var current = 0; current < count; current ++) + { + if (list.options[current].value == selected_value) + { + list.options[current].selected = "1"; + break; + } + } +} + +function update_checkbox(cb, cb_hidden) +{ + cb_hidden.value = cb.checked ? 1 : 0; +} + +function nop() +{ + //do nothing! +} + +function popup_submit(t, w, h) +{ + tmp_t = 'popup_'+Math.round(Math.random(1)*100000); + + norm_width = w || 700; + norm_height = w || 450; + screen_x = (screen.availWidth-norm_width)/2; + screen_y = (screen.availHeight-norm_height)/2; + wnd = window.open('', tmp_t, 'width='+norm_width+',height='+norm_height+',resizable=yes,left='+screen_x+',top='+screen_y+',scrollbars=yes'); + wnd.focus(); + document.kernel_form.target = tmp_t; + submit_kernel_form(); +} + +function inpConfirm(msg) +{ + return confirm( RemoveTranslationLink(msg) ); +} + +function show_props(obj, objName) { + var result = ""; + for (var i in obj) { + result += objName + "." + i + " = " + obj[i] + "\n"; + } + return result; +} + + Index: trunk/core/admin_templates/img/blocks.gif =================================================================== diff -u -N Binary files differ Index: trunk/core/admin_templates/login.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/login.tpl (revision 0) +++ trunk/core/admin_templates/login.tpl (revision 6656) @@ -0,0 +1,83 @@ + + + + + + + + +
+
+ +
+ + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + +
+
+ " class="button"> + " class="button"> +
+
+
+ +

+
+
+ index
"> + + + + \ No newline at end of file Index: trunk/core/admin_templates/incs/form_blocks.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/incs/form_blocks.tpl (revision 0) +++ trunk/core/admin_templates/incs/form_blocks.tpl (revision 6656) @@ -0,0 +1,432 @@ + + + + + + + + +
+ .gif" align="absmiddle" title="">  +
+
+ + + + + img/logo_bg.gif) no-repeat top right;"> + + +
+ .gif" align="absmiddle" title="">  +
+
+ + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + "> + + +   + + + + + + + + + + + + + + "> + + + " id="" value="" tabindex="" size="" maxlength="" class="" onblur="" onkeyup=""> + + +   + + + + + + + + "> + + + " id="" tabindex="" size="" class=""> + + () + + [upload]" id="[upload]" value=""> + +   + + + + + + + + "> + + error"> + *:
+ ', '', 'popups/translator');" title=""> + + + " id="" value="" tabindex="" size="" maxlength="" class="" onblur=""> + +   + + + + + + + + " id="" value=""> + + + + + + + + "> + + + " id="" value="" tabindex="" size="" class="" datepickerIcon="admin/images/ddarrow.gif"> () + + " id="" value=""> + +   + + + + + + + + + + + + + "> + + + + " id="" value="" tabindex="" size="" class="" datepickerIcon="admin/images/ddarrow.gif"> + () + +  " id="" value="" tabindex="" size="" class=""> () + +   + + + + + + + + "> + + error"> + *:
+ + ');"> + + + + + +   + + + + + + + + "> + + error"> + *:
+ ');"> + ', '', 'popups/translator', 1);" title=""> + + + + +   + + + + + + + + "> + + + " id="" value="" tabindex="" size="" class="" onkeyup=""> + + ');"> + + ', '', '');"> + + + + +   + + + + + + + + + + + + + + + + + "> + + + + +   + + + + + + + + name="" id="_" value="" onclick="" onchange="">  + + + + name="" id="_" value="" onclick="" onchange="">  + + + + "> + + + + + + + + +   + + + + + + + + "> + + + " name="" value=""> + + " type="checkbox" id="_cb_" name="_cb_" class="" onchange="update_checkbox(this, document.getElementById(''));" onclick=""> + + +   + + + + + + + + + id="_" value="" onclick="update_checkbox_options(/^_([0-9A-Za-z-]+)/, '');">  + + + + id="_" value="" onclick="update_checkbox_options(/^_([0-9A-Za-z-]+)/, '');">  + + + + "> + + + + + + + + + +   + + + + + + + + "> + + + " name="" value=""> + " type="checkbox" id="_cb_" name="_cb_" class="" onclick="update_checkbox(this, document.getElementById(''))"> +
+ + + +   + + + + + "> + + + + " id="" value="" tabindex="" size="" maxlength="" class="" onblur=""> + + + + " id="" value="" tabindex="" size="" maxlength="" class="" onblur=""> + + " id="" value="" tabindex="" size="" maxlength="" class="" onblur=""> + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
0% + + + + + + + + + + + + + +
+ + + + + +
+
+ +
100%
+ +
+
:0%
:00:00
:00:00
+ " value="" /> +
+
\ No newline at end of file Index: trunk/core/admin_templates/img/button_back_disabled.gif =================================================================== diff -u -N Binary files differ Index: trunk/core/admin_templates/incs/tab_blocks.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/incs/tab_blocks.tpl (revision 0) +++ trunk/core/admin_templates/incs/tab_blocks.tpl (revision 6656) @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + url(img/tab_back3.jpg) no-repeat top left;" cellpadding="0" cellspacing="0" border="0"> + + + + + +
left.gif" width="15" height="23"> + ', '')" class="" onClick="">
+
right.gif" width="15" height="23">
+ + + + + + + url(img/tab_back3.jpg) no-repeat top left;" cellpadding="0" cellspacing="0" border="0"> + + + + + +
left.gif" width="15" height="23"> + " class="" onClick="">
+
right.gif" width="15" height="23">
+ + + + + + + url(img/tab_back3.jpg) no-repeat top left;" cellpadding="0" cellspacing="0" border="0"> + + + + + +
left.gif" width="15" height="23">style="border-top: black 1px solid;" background="img/tab_back.gif"> + ', '')" class="" onClick="">
+
right.gif" width="15" height="23">
+ + \ No newline at end of file Index: trunk/core/admin_templates/js/grid.js =================================================================== diff -u -N --- trunk/core/admin_templates/js/grid.js (revision 0) +++ trunk/core/admin_templates/js/grid.js (revision 6656) @@ -0,0 +1,389 @@ +var $GridManager = new GridManager(); + +function GridManager () { + this.Grids = Grids; // get all from global variable, in future replace all references to it with $GridManager.Grids + this.AlternativeGrids = new Array(); +} + +GridManager.prototype.AddAlternativeGrid = function ($source_grid, $destination_grid, $reciprocal) +{ + if ($source_grid == $destination_grid) { + return false; + } + + if (typeof(this.AlternativeGrids[$source_grid]) == 'undefined') { + // alternative grids not found, create empty list + this.AlternativeGrids[$source_grid] = new Array(); + } + + if (!in_array($destination_grid, this.AlternativeGrids[$source_grid])) { + // alternative grids found, check if not added already + this.AlternativeGrids[$source_grid].push($destination_grid); + } + + if ($reciprocal) { + this.AddAlternativeGrid($destination_grid, $source_grid); + } +} + +GridManager.prototype.ClearAlternativeGridsSelection = function ($source_prefix) +{ + if (!this.AlternativeGrids[$source_prefix]) return false; + + var $i = 0; + var $destination_prefix = ''; + while ($i < this.AlternativeGrids[$source_prefix].length) { + $destination_prefix = this.AlternativeGrids[$source_prefix][$i]; + if (this.Grids[$destination_prefix]) { + // alternative grid set, but not yet loaded by ajax + this.Grids[$destination_prefix].ClearSelection(); + } + $i++; + } +} + +GridManager.prototype.CheckDependencies = function ($prefix) { + if (typeof(this.Grids[$prefix]) != 'undefined') { + this.Grids[$prefix].CheckDependencies('GridManager.CheckDependencies'); + } +} + +function GridItem(grid, an_element, cb, item_id, class_on, class_off) +{ + this.Grid = grid; + this.selected = false; + this.id = an_element.id; + this.ItemId = item_id; + this.sequence = parseInt(an_element.getAttribute('sequence')); + this.class_on = class_on; + if (class_off == ':original') { + this.class_off = an_element.className; + } + else + this.class_off = class_off; + this.HTMLelement = an_element; + this.CheckBox = cb; + + this.value = this.ItemId; + this.ItemType = 11; +} + +GridItem.prototype.Init = function () +{ + this.HTMLelement.GridItem = this; + this.HTMLelement.onclick = function(ev) { + this.GridItem.Click(ev); + }; + this.HTMLelement.ondblclick = function(ev) { + this.GridItem.DblClick(ev); + } + if ( isset(this.CheckBox) ) { + this.CheckBox.GridItem = this; + this.CheckBox.onclick = function(ev) { + this.GridItem.cbClick(ev); + }; + this.CheckBox.ondblclick = function(ev) { + this.GridItem.DblClick(ev); + } + } +} + +GridItem.prototype.DisableClicking = function () +{ + this.HTMLelement.onclick = function(ev) { + return false; + }; + this.HTMLelement.ondblclick = function(ev) { + return false; + } + if ( isset(this.CheckBox) ) { + this.CheckBox.onclick = function(ev) { + return false; + }; + } +} + +GridItem.prototype.Select = function () +{ + if (this.selected) return; + this.selected = true; + this.HTMLelement.className = this.class_on; + if ( isset(this.CheckBox) ) { + this.CheckBox.checked = true; + } + this.Grid.LastSelectedId = this.ItemId; + this.Grid.SelectedCount++; + + // this is for in-portal only (used in relation select) + LastCheckedItem = this; + if (typeof (this.Grid.OnSelect) == 'function' ) { + this.Grid.OnSelect(this.ItemId); + } +} + +GridItem.prototype.UnSelect = function ( force ) +{ + if ( !this.selected && !force) return; + this.selected = false; + this.HTMLelement.className = this.class_off; + if ( isset(this.CheckBox) ) { + this.CheckBox.checked = false; + } + this.Grid.SelectedCount--; + if (typeof (this.Grid.OnUnSelect) == 'function' ) { + this.Grid.OnUnSelect(this.ItemId); + } +} + +GridItem.prototype.ClearBrowserSelection = function() { + if (window.getSelection) { + // removeAllRanges will be supported by Opera from v 9+, do nothing by now + var selection = window.getSelection(); + if (selection.removeAllRanges) { // Mozilla & Opera 9+ + window.getSelection().removeAllRanges(); + } + } else if (document.selection && !is.opera) { // IE + document.selection.empty(); + } +} + +GridItem.prototype.Click = function (ev) +{ + this.ClearBrowserSelection(); + this.Grid.ClearAlternativeGridsSelection('GridItem.Click'); + + var e = !is.ie ? ev : window.event; + if (e.shiftKey && !this.Grid.RadioMode) { + this.Grid.SelectRangeUpTo(this.sequence); + } + else { + if (e.ctrlKey && !this.Grid.RadioMode) { + this.Toggle() + } + else { + if (!(this.Grid.RadioMode && this.Grid.LastSelectedId == this.ItemId && this.selected)) { + // don't clear selection if item same as current is selected + this.Grid.ClearSelection(null,'GridItem.Click'); + this.Toggle(); + } + } + } + this.Grid.CheckDependencies('GridItem.Click'); + e.cancelBubble = true; +} + +GridItem.prototype.cbClick = function (ev) +{ + var e = is.ie ? window.event : ev; + if (this.Grid.RadioMode) this.Grid.ClearSelection(null,'GridItem.cbClick'); + this.Grid.ClearAlternativeGridsSelection('GridItem.cbClick'); + this.Toggle(); + this.Grid.CheckDependencies('GridItem.cbClick'); + e.cancelBubble = true; +} + +GridItem.prototype.DblClick = function (ev) +{ + var e = is.ie ? window.event : ev; + this.Grid.Edit(); +} + +GridItem.prototype.Toggle = function () +{ + if (this.selected) this.UnSelect() + else { + this.Grid.LastSelectedSequence = this.sequence; + this.Select(); + } +} + +GridItem.prototype.FallsInRange = function (from, to) +{ + return (from <= to) ? + (this.sequence >= from && this.sequence <= to) : + (this.sequence >= to && this.sequence <= from); +} + + +function Grid(prefix, class_on, class_off, dbl_click, toolbar) +{ + this.prefix = prefix; + this.class_on = class_on; + this.class_off = class_off; + this.Items = new Array(); + this.LastSelectedSequence = 1; + this.LastSelectedId = null; + this.DblClick = dbl_click; + this.ToolBar = toolbar; + this.SelectedCount = 0; + this.AlternativeGrids = new Array(); + this.DependantButtons = new Array(); + this.RadioMode = false; +} + +Grid.prototype.AddItem = function( an_item ) { + this.Items[an_item.id] = an_item; +} + +Grid.prototype.AddItemsByIdMask = function ( tag, mask, cb_mask ) { + var $item_id=0; + elements = document.getElementsByTagName(tag.toUpperCase()); + for (var i=0; i < elements.length; i++) { + if ( typeof(elements[i].id) == 'undefined') { + continue; + } + if ( !elements[i].id.match(mask)) continue; + $item_id=RegExp.$1; + + cb_name = cb_mask.replace('$$ID$$',$item_id); + + cb = document.getElementById(cb_name); + if (typeof(cb) == 'undefined') alert ('No Checkbox defined for item '+elements[i].id); + + this.AddItem( new GridItem( this, elements[i], cb, $item_id, this.class_on, this.class_off ) ); + } +} + +Grid.prototype.InitItems = function() { + for (var i in this.Items) { + this.Items[i].Init(); + } + this.ClearSelection( true,'Grid.InitItems' ); +} + +Grid.prototype.DisableClicking = function() { + for (var i in this.Items) { + this.Items[i].DisableClicking(); + } + this.ClearSelection( true, 'Grid.DisableClicking' ); +} + +Grid.prototype.ClearSelection = function( force, called_from ) { +// alert('selection clear. force: '+force+'; called_from: '+called_from); + if (typeof(force) == 'undefined') force = false; + if (this.CountSelected() == 0 && !force) return; + for (var i in this.Items) { + this.Items[i].UnSelect(force); + } + this.SelectedCount = 0; + this.CheckDependencies('Grid.ClearSelection'); +} + +Grid.prototype.GetSelected = function() { + var $ret = new Array(); + for (var i in this.Items) { + if (this.Items[i].selected) { + $ret[$ret.length] = this.Items[i].ItemId; + } + + } + return $ret; +} + +Grid.prototype.InvertSelection = function() { + for (var i in this.Items) + { + if( this.Items[i].selected ) + { + this.Items[i].UnSelect(); + } + else + { + this.Items[i].Select(); + } + } + this.CheckDependencies('Grid.InvertSelection'); +} + +Grid.prototype.SelectAll = function() { + for (var i in this.Items) { + this.Items[i].Select(); + } + this.CheckDependencies('Grid.SelectAll'); + this.ClearAlternativeGridsSelection('Grid.SelectAll'); +} + +Grid.prototype.SelectRangeUpTo = function( last_sequence ) { + for (var i in this.Items) { + if (this.Items[i].FallsInRange(this.LastSelectedSequence, last_sequence)) { + this.Items[i].Select(); + } + } +} + +Grid.prototype.CountSelected = function () +{ + return this.SelectedCount; +} + +Grid.prototype.Edit = function() { + if ( this.CountSelected() == 0 ) return; + this.DblClick(); +} + +Grid.prototype.SetDependantToolbarButtons = function($buttons, $direct, $mode) { + if (!isset($direct)) $direct = true; // direct (use false for invert mode) + if (!isset($mode)) $mode = 1; // enable/disable (use 2 for show/hide mode) + for (var i in $buttons) { + this.DependantButtons.push(new Array($buttons[i], $direct, $mode)); + } + //this.DependantButtons = buttons; + this.CheckDependencies('Grid.SetDependantToolbarButtons'); +} + +Grid.prototype.CheckDependencies = function($called_from) +{ +// alert('prefix: ' + this.prefix + '; ' + $called_from + ' -> Grid.CheckDependencies'); + var enabling = (this.CountSelected() > 0); + for (var i in this.DependantButtons) { + if (this.DependantButtons[i][0].match("portal:(.*)")) { + button_name = RegExp.$1; + if (toolbar) { + if (enabling == this.DependantButtons[i][1]) { + toolbar.enableButton(button_name, true); + } + else + { + toolbar.disableButton(button_name, true); + } + } + } + else { + if (this.DependantButtons[i][2] == 1) { + this.ToolBar.SetEnabled(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]); + } + else { + this.ToolBar.SetVisible(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]); + } + } + } + //if (enabling) this.ClearAlternativeGridsSelection('Grid.CheckDependencies'); + +} + +Grid.prototype.ClearAlternativeGridsSelection = function (called_from) +{ + $GridManager.ClearAlternativeGridsSelection(this.prefix); +} + +Grid.prototype.AddAlternativeGrid = function (alt_grid, reciprocal) +{ + var $dst_prefix = typeof('alt_grid') == 'string' ? alt_grid : alt_grid.prefix; + $GridManager.AddAlternativeGrid(this.prefix, $dst_prefix, reciprocal); +} + +Grid.prototype.FirstSelected = function () +{ + min_sequence = null; + var res = null + for (var i in this.Items) { + if (!this.Items[i].selected) continue; + if (min_sequence == null) + min_sequence = this.Items[i].sequence; + if (this.Items[i].sequence <= min_sequence) { + res = this.Items[i].ItemId; + min_sequence = this.Items[i].sequence; + } + } + return res; +} \ No newline at end of file Index: trunk/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r6428 -r6656 --- trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 6428) +++ trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 6656) @@ -34,7 +34,7 @@ function TemplatesBase($params) { if ($this->Application->IsAdmin()) { - $module = isset($params['module']) ? $params['module'] : 'kernel'; + $module = isset($params['module']) ? $params['module'] : 'core'; $path = preg_replace('/\/(.*?)\/(.*)/', $module.'/\\2', THEMES_PATH); // remove leading slash + substitute module } else { Index: trunk/core/admin_templates/img/icons/icon24_lock_login.gif =================================================================== diff -u -N Binary files differ Index: trunk/core/admin_templates/img/version_bg.gif =================================================================== diff -u -N Binary files differ