code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
.ui-jqchart { position: relative; } .ui-jqchart-tooltip { position:absolute; white-space: nowrap; padding: .2em .4em; z-index:9999; border: 1px solid #dddddd; color: #333333; background: white; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; -o-box-shadow: 0 0 5px #aaa; -moz-box-shadow: 0 0 5px #aaa; -webkit-box-shadow: 0 0 5px #aaa; box-shadow: 0 0 5px #aaa; } * html .ui-jqchart-tooltip { background-image: none; } body .ui-jqchart-tooltip { border-width:2px; }
zzyn125-bench
BigMelon/Backup/jslib_backup/jqChartJQueryPlugin_3_0_0_0/css/jquery.jqChart.css
CSS
gpl2
582
;(function($){ /** * jqGrid English Translation * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "View {0} - {1} of {2}", emptyrecords: "No records to view", loadtext: "Loading...", pgtext : "Page {0} of {1}" }, search : { caption: "Search...", Find: "Find", Reset: "Reset", odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'], groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ], matchText: " match", rulesText: " rules" }, edit : { addCaption: "Add Record", editCaption: "Edit Record", bSubmit: "Submit", bCancel: "Cancel", bClose: "Close", saveData: "Data has been changed! Save changes?", bYes : "Yes", bNo : "No", bExit : "Cancel", msg: { required:"Field is required", number:"Please, enter valid number", minValue:"value must be greater than or equal to ", maxValue:"value must be less than or equal to", email: "is not a valid e-mail", integer: "Please, enter valid integer value", date: "Please, enter valid date value", url: "is not a valid URL. Prefix required ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "View Record", bClose: "Close" }, del : { caption: "Delete", msg: "Delete selected record(s)?", bSubmit: "Delete", bCancel: "Cancel" }, nav : { edittext: "", edittitle: "Edit selected row", addtext:"", addtitle: "Add new row", deltext: "", deltitle: "Delete selected row", searchtext: "", searchtitle: "Find records", refreshtext: "", refreshtitle: "Reload Grid", alertcap: "Warning", alerttext: "Please, select row", viewtext: "", viewtitle: "View selected row" }, col : { caption: "Select columns", bSubmit: "Ok", bCancel: "Cancel" }, errors : { errcap : "Error", nourl : "No url is set", norecords: "No records to process", model : "Length of colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/js/grid.locale-en.js
JavaScript
gpl2
3,799
/** * @preserve jquery.layout 1.3.0 - Release Candidate 29.15 * $Date: 2011-06-25 08:00:00 (Sat, 25 Jun 2011) $ * $Rev: 302915 $ * * Copyright (c) 2010 * Fabrizio Balliano (http://www.fabrizioballiano.net) * Kevin Dalman (http://allpro.net) * * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. * * Changelog: http://layout.jquery-dev.net/changelog.cfm#1.3.0.rc29.15 * * Docs: http://layout.jquery-dev.net/documentation.html * Tips: http://layout.jquery-dev.net/tips.html * Help: http://groups.google.com/group/jquery-ui-layout */ // NOTE: For best readability, view with a fixed-width font and tabs equal to 4-chars ;(function ($) { /* * GENERIC $.layout METHODS - used by all layouts */ $.layout = { version: "1.3.rc29.15" , revision: 0.032915 // 1.3.0 final = 1.0300 - major(n+).minor(nn)+patch(nn+) // LANGUAGE CUSTOMIZATION , language: { // Tips and messages for resizers, togglers, custom buttons, etc. Open: "Open" // eg: "Open Pane" , Close: "Close" , Resize: "Resize" , Slide: "Slide Open" , Pin: "Pin" , Unpin: "Un-Pin" , noRoomToOpenTip: "Not enough room to show this pane." // Developer error messages , pane: "pane" // description of "layout pane element" , selector: "selector" // description of "jQuery-selector" , errButton: "Error Adding Button \n\nInvalid " , errContainerMissing: "UI Layout Initialization Error\n\nThe specified layout-container does not exist." , errCenterPaneMissing: "UI Layout Initialization Error\n\nThe center-pane element does not exist.\n\nThe center-pane is a required element." , errContainerHeight: "UI Layout Initialization Warning\n\nThe layout-container \"CONTAINER\" has no height.\n\nTherefore the layout is 0-height and hence 'invisible'!" } // can update code here if $.browser is phased out , browser: { mozilla: !!$.browser.mozilla , webkit: !!$.browser.webkit || !!$.browser.safari // webkit = jQ 1.4 , msie: !!$.browser.msie , isIE6: !!$.browser.msie && $.browser.version == 6 , boxModel: false // page must load first, so will be updated set by _create //, version: $.browser.version - not used } /* * GENERIC UTILITY METHODS */ // calculate and return the scrollbar width, as an integer , scrollbarWidth: function () { return window.scrollbarWidth || $.layout.getScrollbarSize('width'); } , scrollbarHeight: function () { return window.scrollbarHeight || $.layout.getScrollbarSize('height'); } , getScrollbarSize: function (dim) { var $c = $('<div style="position: absolute; top: -10000px; left: -10000px; width: 100px; height: 100px; overflow: scroll;"></div>').appendTo("body"); var d = { width: $c.width() - $c[0].clientWidth, height: $c.height() - $c[0].clientHeight }; $c.remove(); window.scrollbarWidth = d.width; window.scrollbarHeight = d.height; return dim.match(/^(width|height)$/i) ? d[dim] : d; } /** * Returns hash container 'display' and 'visibility' * * @see $.swap() - swaps CSS, runs callback, resets CSS */ , showInvisibly: function ($E, force) { if (!$E) return {}; if (!$E.jquery) $E = $($E); var CSS = { display: $E.css('display') , visibility: $E.css('visibility') }; if (force || CSS.display == "none") { // only if not *already hidden* $E.css({ display: "block", visibility: "hidden" }); // show element 'invisibly' so can be measured return CSS; } else return {}; } /** * Returns data for setting size of an element (container or a pane). * * @see _create(), onWindowResize() for container, plus others for pane * @return JSON Returns a hash of all dimensions: top, bottom, left, right, outerWidth, innerHeight, etc */ , getElementDimensions: function ($E) { var d = {} // dimensions hash , x = d.css = {} // CSS hash , i = {} // TEMP insets , b, p // TEMP border, padding , N = $.layout.cssNum , off = $E.offset() ; d.offsetLeft = off.left; d.offsetTop = off.top; $.each("Left,Right,Top,Bottom".split(","), function (idx, e) { // e = edge b = x["border" + e] = $.layout.borderWidth($E, e); p = x["padding"+ e] = $.layout.cssNum($E, "padding"+e); i[e] = b + p; // total offset of content from outer side d["inset"+ e] = p; }); d.offsetWidth = $E.innerWidth(); d.offsetHeight = $E.innerHeight(); d.outerWidth = $E.outerWidth(); d.outerHeight = $E.outerHeight(); d.innerWidth = Math.max(0, d.outerWidth - i.Left - i.Right); d.innerHeight = Math.max(0, d.outerHeight - i.Top - i.Bottom); x.width = $E.width(); x.height = $E.height(); x.top = N($E,"top",true); x.bottom = N($E,"bottom",true); x.left = N($E,"left",true); x.right = N($E,"right",true); //d.visible = $E.is(":visible");// && x.width > 0 && x.height > 0; return d; } , getElementCSS: function ($E, list) { var CSS = {} , style = $E[0].style , props = list.split(",") , sides = "Top,Bottom,Left,Right".split(",") , attrs = "Color,Style,Width".split(",") , p, s, a, i, j, k ; for (i=0; i < props.length; i++) { p = props[i]; if (p.match(/(border|padding|margin)$/)) for (j=0; j < 4; j++) { s = sides[j]; if (p == "border") for (k=0; k < 3; k++) { a = attrs[k]; CSS[p+s+a] = style[p+s+a]; } else CSS[p+s] = style[p+s]; } else CSS[p] = style[p]; }; return CSS } /** * Contains logic to check boxModel & browser, and return the correct width/height for the current browser/doctype * * @see initPanes(), sizeMidPanes(), initHandles(), sizeHandles() * @param {Array.<Object>} $E Must pass a jQuery object - first element is processed * @param {number=} outerWidth/outerHeight (optional) Can pass a width, allowing calculations BEFORE element is resized * @return {number} Returns the innerWidth/Height of the elem by subtracting padding and borders */ , cssWidth: function ($E, outerWidth) { var b = $.layout.borderWidth , n = $.layout.cssNum ; // a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed if (outerWidth <= 0) return 0; if (!$.layout.browser.boxModel) return outerWidth; // strip border and padding from outerWidth to get CSS Width var W = outerWidth - b($E, "Left") - b($E, "Right") - n($E, "paddingLeft") - n($E, "paddingRight") ; return Math.max(0,W); } , cssHeight: function ($E, outerHeight) { var b = $.layout.borderWidth , n = $.layout.cssNum ; // a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed if (outerHeight <= 0) return 0; if (!$.layout.browser.boxModel) return outerHeight; // strip border and padding from outerHeight to get CSS Height var H = outerHeight - b($E, "Top") - b($E, "Bottom") - n($E, "paddingTop") - n($E, "paddingBottom") ; return Math.max(0,H); } /** * Returns the 'current CSS numeric value' for a CSS property - 0 if property does not exist * * @see Called by many methods * @param {Array.<Object>} $E Must pass a jQuery object - first element is processed * @param {string} prop The name of the CSS property, eg: top, width, etc. * @param {boolean=} allowAuto true = return 'auto' if that is value; false = return 0 * @return {(string|number)} Usually used to get an integer value for position (top, left) or size (height, width) */ , cssNum: function ($E, prop, allowAuto) { if (!$E.jquery) $E = $($E); var CSS = $.layout.showInvisibly($E) , p = $.curCSS($E[0], prop, true) , v = allowAuto && p=="auto" ? p : (parseInt(p, 10) || 0); $E.css( CSS ); // RESET return v; } , borderWidth: function (el, side) { if (el.jquery) el = el[0]; var b = "border"+ side.substr(0,1).toUpperCase() + side.substr(1); // left => Left return $.curCSS(el, b+"Style", true) == "none" ? 0 : (parseInt($.curCSS(el, b+"Width", true), 10) || 0); } /** * UTLITY for mouse tracking - FUTURE REFERENCE * * init: if (!window.mouse) { * window.mouse = { x: 0, y: 0 }; * $(document).mousemove( $.layout.trackMouse ); * } * * @param {Object} evt * , trackMouse: function (evt) { window.mouse = { x: evt.clientX, y: evt.clientY }; } */ /** * SUBROUTINE for preventPrematureSlideClose option * * @param {Object} evt * @param {Object=} el */ , isMouseOverElem: function (evt, el) { var $E = $(el || this) , d = $E.offset() , T = d.top , L = d.left , R = L + $E.outerWidth() , B = T + $E.outerHeight() , x = evt.pageX // evt.clientX ? , y = evt.pageY // evt.clientY ? ; // if X & Y are < 0, probably means is over an open SELECT return ($.layout.browser.msie && x < 0 && y < 0) || ((x >= L && x <= R) && (y >= T && y <= B)); } }; $.fn.layout = function (opts) { /* * ########################### * WIDGET CONFIG & OPTIONS * ########################### */ var // LANGUAGE - for tips & messages lang = $.layout.language // internal alias // DEFAULT OPTIONS - CHANGE IF DESIRED , options = { name: "" // Not required, but useful for buttons and used for the state-cookie , containerClass: "ui-layout-container" // layout-container element , scrollToBookmarkOnLoad: true // after creating a layout, scroll to bookmark in URL (.../page.htm#myBookmark) , resizeWithWindow: true // bind thisLayout.resizeAll() to the window.resize event , resizeWithWindowDelay: 200 // delay calling resizeAll because makes window resizing very jerky , resizeWithWindowMaxDelay: 0 // 0 = none - force resize every XX ms while window is being resized , onresizeall_start: null // CALLBACK when resizeAll() STARTS - NOT pane-specific , onresizeall_end: null // CALLBACK when resizeAll() ENDS - NOT pane-specific , onload_start: null // CALLBACK when Layout inits - after options initialized, but before elements , onload_end: null // CALLBACK when Layout inits - after EVERYTHING has been initialized , onunload_start: null // CALLBACK when Layout is destroyed OR onWindowUnload , onunload_end: null // CALLBACK when Layout is destroyed OR onWindowUnload , autoBindCustomButtons: false // search for buttons with ui-layout-button class and auto-bind them , zIndex: null // the PANE zIndex - resizers and masks will be +1 , initPanes: true // false = DO NOT initialize the panes onLoad - will init later , showErrorMessages: true // enables fatal error messages to warn developers of common errors // PANE SETTINGS , defaults: { // default options for 'all panes' - will be overridden by 'per-pane settings' applyDemoStyles: false // NOTE: renamed from applyDefaultStyles for clarity , closable: true // pane can open & close , resizable: true // when open, pane can be resized , slidable: true // when closed, pane can 'slide open' over other panes - closes on mouse-out , initClosed: false // true = init pane as 'closed' , initHidden: false // true = init pane as 'hidden' - no resizer-bar/spacing // SELECTORS //, paneSelector: "" // MUST be pane-specific - jQuery selector for pane , contentSelector: ".ui-layout-content" // INNER div/element to auto-size so only it scrolls, not the entire pane! , contentIgnoreSelector: ".ui-layout-ignore" // element(s) to 'ignore' when measuring 'content' , findNestedContent: false // true = $P.find(contentSelector), false = $P.children(contentSelector) // GENERIC ROOT-CLASSES - for auto-generated classNames , paneClass: "ui-layout-pane" // border-Pane - default: 'ui-layout-pane' , resizerClass: "ui-layout-resizer" // Resizer Bar - default: 'ui-layout-resizer' , togglerClass: "ui-layout-toggler" // Toggler Button - default: 'ui-layout-toggler' , buttonClass: "ui-layout-button" // CUSTOM Buttons - default: 'ui-layout-button-toggle/-open/-close/-pin' // ELEMENT SIZE & SPACING //, size: 100 // MUST be pane-specific -initial size of pane , minSize: 0 // when manually resizing a pane , maxSize: 0 // ditto, 0 = no limit , spacing_open: 6 // space between pane and adjacent panes - when pane is 'open' , spacing_closed: 6 // ditto - when pane is 'closed' , togglerLength_open: 50 // Length = WIDTH of toggler button on north/south sides - HEIGHT on east/west sides , togglerLength_closed: 50 // 100% OR -1 means 'full height/width of resizer bar' - 0 means 'hidden' , togglerAlign_open: "center" // top/left, bottom/right, center, OR... , togglerAlign_closed: "center" // 1 => nn = offset from top/left, -1 => -nn == offset from bottom/right , togglerTip_open: lang.Close // Toggler tool-tip (title) , togglerTip_closed: lang.Open // ditto , togglerContent_open: "" // text or HTML to put INSIDE the toggler , togglerContent_closed: "" // ditto // RESIZING OPTIONS , resizerDblClickToggle: true // , autoResize: true // IF size is 'auto' or a percentage, then recalc 'pixel size' whenever the layout resizes , autoReopen: true // IF a pane was auto-closed due to noRoom, reopen it when there is room? False = leave it closed , resizerDragOpacity: 1 // option for ui.draggable //, resizerCursor: "" // MUST be pane-specific - cursor when over resizer-bar , maskIframesOnResize: true // true = all iframes OR = iframe-selector(s) - adds masking-div during resizing/dragging , resizeNestedLayout: true // true = trigger nested.resizeAll() when a 'pane' of this layout is the 'container' for another , resizeWhileDragging: false // true = LIVE Resizing as resizer is dragged , resizeContentWhileDragging: false // true = re-measure header/footer heights as resizer is dragged // TIPS & MESSAGES - also see lang object , noRoomToOpenTip: lang.noRoomToOpenTip , resizerTip: lang.Resize // Resizer tool-tip (title) , sliderTip: lang.Slide // resizer-bar triggers 'sliding' when pane is closed , sliderCursor: "pointer" // cursor when resizer-bar will trigger 'sliding' , slideTrigger_open: "click" // click, dblclick, mouseenter , slideTrigger_close: "mouseleave"// click, mouseleave , slideDelay_open: 300 // applies only for mouseenter event - 0 = instant open , slideDelay_close: 300 // applies only for mouseleave event (300ms is the minimum!) , hideTogglerOnSlide: false // when pane is slid-open, should the toggler show? , preventQuickSlideClose: $.layout.browser.webkit // Chrome triggers slideClosed as it is opening , preventPrematureSlideClose: false // HOT-KEYS & MISC , showOverflowOnHover: false // will bind allowOverflow() utility to pane.onMouseOver , enableCursorHotkey: true // enabled 'cursor' hotkeys //, customHotkey: "" // MUST be pane-specific - EITHER a charCode OR a character , customHotkeyModifier: "SHIFT" // either 'SHIFT', 'CTRL' or 'CTRL+SHIFT' - NOT 'ALT' // PANE ANIMATION // NOTE: fxSss_open & fxSss_close options (eg: fxName_open) are auto-generated if not passed , fxName: "slide" // ('none' or blank), slide, drop, scale , fxSpeed: null // slow, normal, fast, 200, nnn - if passed, will OVERRIDE fxSettings.duration , fxSettings: {} // can be passed, eg: { easing: "easeOutBounce", duration: 1500 } , fxOpacityFix: true // tries to fix opacity in IE to restore anti-aliasing after animation // CALLBACKS , triggerEventsOnLoad: false // true = trigger onopen OR onclose callbacks when layout initializes , triggerEventsWhileDragging: true // true = trigger onresize callback REPEATEDLY if resizeWhileDragging==true , onshow_start: null // CALLBACK when pane STARTS to Show - BEFORE onopen/onhide_start , onshow_end: null // CALLBACK when pane ENDS being Shown - AFTER onopen/onhide_end , onhide_start: null // CALLBACK when pane STARTS to Close - BEFORE onclose_start , onhide_end: null // CALLBACK when pane ENDS being Closed - AFTER onclose_end , onopen_start: null // CALLBACK when pane STARTS to Open , onopen_end: null // CALLBACK when pane ENDS being Opened , onclose_start: null // CALLBACK when pane STARTS to Close , onclose_end: null // CALLBACK when pane ENDS being Closed , onresize_start: null // CALLBACK when pane STARTS being Resized ***FOR ANY REASON*** , onresize_end: null // CALLBACK when pane ENDS being Resized ***FOR ANY REASON*** , onsizecontent_start: null // CALLBACK when sizing of content-element STARTS , onsizecontent_end: null // CALLBACK when sizing of content-element ENDS , onswap_start: null // CALLBACK when pane STARTS to Swap , onswap_end: null // CALLBACK when pane ENDS being Swapped , ondrag_start: null // CALLBACK when pane STARTS being ***MANUALLY*** Resized , ondrag_end: null // CALLBACK when pane ENDS being ***MANUALLY*** Resized } , north: { paneSelector: ".ui-layout-north" , size: "auto" // eg: "auto", "30%", 200 , resizerCursor: "n-resize" // custom = url(myCursor.cur) , customHotkey: "" // EITHER a charCode OR a character } , south: { paneSelector: ".ui-layout-south" , size: "auto" , resizerCursor: "s-resize" , customHotkey: "" } , east: { paneSelector: ".ui-layout-east" , size: 200 , resizerCursor: "e-resize" , customHotkey: "" } , west: { paneSelector: ".ui-layout-west" , size: 200 , resizerCursor: "w-resize" , customHotkey: "" } , center: { paneSelector: ".ui-layout-center" , minWidth: 0 , minHeight: 0 } // STATE MANAGMENT , useStateCookie: false // Enable cookie-based state-management - can fine-tune with cookie.autoLoad/autoSave , cookie: { name: "" // If not specified, will use Layout.name, else just "Layout" , autoSave: true // Save a state cookie when page exits? , autoLoad: true // Load the state cookie when Layout inits? // Cookie Options , domain: "" , path: "" , expires: "" // 'days' to keep cookie - leave blank for 'session cookie' , secure: false // List of options to save in the cookie - must be pane-specific , keys: "north.size,south.size,east.size,west.size,"+ "north.isClosed,south.isClosed,east.isClosed,west.isClosed,"+ "north.isHidden,south.isHidden,east.isHidden,west.isHidden" } } // PREDEFINED EFFECTS / DEFAULTS , effects = { // LIST *PREDEFINED EFFECTS* HERE, even if effect has no settings slide: { all: { duration: "fast" } // eg: duration: 1000, easing: "easeOutBounce" , north: { direction: "up" } , south: { direction: "down" } , east: { direction: "right"} , west: { direction: "left" } } , drop: { all: { duration: "slow" } // eg: duration: 1000, easing: "easeOutQuint" , north: { direction: "up" } , south: { direction: "down" } , east: { direction: "right"} , west: { direction: "left" } } , scale: { all: { duration: "fast" } } } // DYNAMIC DATA - IS READ-ONLY EXTERNALLY! , state = { // generate unique ID to use for event.namespace so can unbind only events added by 'this layout' id: "layout"+ new Date().getTime() // code uses alias: sID , initialized: false , container: {} // init all keys , north: {} , south: {} , east: {} , west: {} , center: {} , cookie: {} // State Managment data storage } // INTERNAL CONFIG DATA - DO NOT CHANGE THIS! , _c = { allPanes: "north,south,west,east,center" , borderPanes: "north,south,west,east" , altSide: { north: "south" , south: "north" , east: "west" , west: "east" } // CSS used in multiple places , hidden: { visibility: "hidden" } , visible: { visibility: "visible" } // layout element settings , zIndex: { // set z-index values here pane_normal: 1 // normal z-index for panes , resizer_normal: 2 // normal z-index for resizer-bars , iframe_mask: 2 // overlay div used to mask pane(s) during resizing , pane_sliding: 100 // applied to *BOTH* the pane and its resizer when a pane is 'slid open' , pane_animate: 1000 // applied to the pane when being animated - not applied to the resizer , resizer_drag: 10000 // applied to the CLONED resizer-bar when being 'dragged' } , resizers: { cssReq: { position: "absolute" , padding: 0 , margin: 0 , fontSize: "1px" , textAlign: "left" // to counter-act "center" alignment! , overflow: "hidden" // prevent toggler-button from overflowing // SEE c.zIndex.resizer_normal } , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true background: "#DDD" , border: "none" } } , togglers: { cssReq: { position: "absolute" , display: "block" , padding: 0 , margin: 0 , overflow: "hidden" , textAlign: "center" , fontSize: "1px" , cursor: "pointer" , zIndex: 1 } , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true background: "#AAA" } } , content: { cssReq: { position: "relative" /* contain floated or positioned elements */ } , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true overflow: "auto" , padding: "10px" } , cssDemoPane: { // DEMO CSS - REMOVE scrolling from 'pane' when it has a content-div overflow: "hidden" , padding: 0 } } , panes: { // defaults for ALL panes - overridden by 'per-pane settings' below cssReq: { position: "absolute" , margin: 0 // SEE c.zIndex.pane_normal } , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true padding: "10px" , background: "#FFF" , border: "1px solid #BBB" , overflow: "auto" } } , north: { side: "Top" , sizeType: "Height" , dir: "horz" , cssReq: { top: 0 , bottom: "auto" , left: 0 , right: 0 , width: "auto" // height: DYNAMIC } , pins: [] // array of 'pin buttons' to be auto-updated on open/close (classNames) } , south: { side: "Bottom" , sizeType: "Height" , dir: "horz" , cssReq: { top: "auto" , bottom: 0 , left: 0 , right: 0 , width: "auto" // height: DYNAMIC } , pins: [] } , east: { side: "Right" , sizeType: "Width" , dir: "vert" , cssReq: { left: "auto" , right: 0 , top: "auto" // DYNAMIC , bottom: "auto" // DYNAMIC , height: "auto" // width: DYNAMIC } , pins: [] } , west: { side: "Left" , sizeType: "Width" , dir: "vert" , cssReq: { left: 0 , right: "auto" , top: "auto" // DYNAMIC , bottom: "auto" // DYNAMIC , height: "auto" // width: DYNAMIC } , pins: [] } , center: { dir: "center" , cssReq: { left: "auto" // DYNAMIC , right: "auto" // DYNAMIC , top: "auto" // DYNAMIC , bottom: "auto" // DYNAMIC , height: "auto" , width: "auto" } } } /* * ########################### * INTERNAL HELPER FUNCTIONS * ########################### */ /** * Manages all internal timers */ , timer = { data: {} , set: function (s, fn, ms) { timer.clear(s); timer.data[s] = setTimeout(fn, ms); } , clear: function (s) { var t=timer.data; if (t[s]) {clearTimeout(t[s]); delete t[s];} } } /** * Returns true if passed param is EITHER a simple string OR a 'string object' - otherwise returns false */ , isStr = function (o) { try { return typeof o == "string" || (typeof o == "object" && o.constructor.toString().match(/string/i) !== null); } catch (e) { return false; } } /** * Returns a simple string if passed EITHER a simple string OR a 'string object', * else returns the original object */ , str = function (o) { // trim converts 'String object' to a simple string return isStr(o) ? $.trim(o) : o == undefined || o == null ? "" : o; } /** * min / max * * Aliases for Math methods to simplify coding */ , min = function (x,y) { return Math.min(x,y); } , max = function (x,y) { return Math.max(x,y); } /** * Processes the options passed in and transforms them into the format used by layout() * Missing keys are added, and converts the data if passed in 'flat-format' (no sub-keys) * In flat-format, pane-specific-settings are prefixed like: north__optName (2-underscores) * To update effects, options MUST use nested-keys format, with an effects key ??? * * @see initOptions() * @param {Object} d Data/options passed by user - may be a single level or nested levels * @return {Object} Creates a data struture that perfectly matches 'options', ready to be imported */ , _transformData = function (d) { var a, json = { cookie:{}, defaults:{fxSettings:{}}, north:{fxSettings:{}}, south:{fxSettings:{}}, east:{fxSettings:{}}, west:{fxSettings:{}}, center:{fxSettings:{}} }; d = d || {}; if (d.effects || d.cookie || d.defaults || d.north || d.south || d.west || d.east || d.center) json = $.extend( true, json, d ); // already in json format - add to base keys else // convert 'flat' to 'nest-keys' format - also handles 'empty' user-options $.each( d, function (key,val) { a = key.split("__"); if (!a[1] || json[a[0]]) // check for invalid keys json[ a[1] ? a[0] : "defaults" ][ a[1] ? a[1] : a[0] ] = val; }); return json; } /** * Set an INTERNAL callback to avoid simultaneous animation * Runs only if needed and only if all callbacks are not 'already set' * Called by open() and close() when isLayoutBusy=true * * @param {string} action Either 'open' or 'close' * @param {string} pane A valid border-pane name, eg 'west' * @param {boolean=} param Extra param for callback (optional) */ , _queue = function (action, pane, param) { var tried = []; // if isLayoutBusy, then some pane must be 'moving' $.each(_c.borderPanes.split(","), function (i, p) { if (_c[p].isMoving) { bindCallback(p); // TRY to bind a callback return false; // BREAK } }); // if pane does NOT have a callback, then add one, else follow the callback chain... function bindCallback (p) { var c = _c[p]; if (!c.doCallback) { c.doCallback = true; c.callback = action +","+ pane +","+ (param ? 1 : 0); } else { // try to 'chain' this callback tried.push(p); var cbPane = c.callback.split(",")[1]; // 2nd param of callback is 'pane' // ensure callback target NOT 'itself' and NOT 'target pane' and NOT already tried (avoid loop) if (cbPane != pane && !$.inArray(cbPane, tried) >= 0) bindCallback(cbPane); // RECURSE } } } /** * RUN the INTERNAL callback for this pane - if one exists * * @param {string} pane A valid border-pane name, eg 'west' */ , _dequeue = function (pane) { var c = _c[pane]; // RESET flow-control flags _c.isLayoutBusy = false; delete c.isMoving; if (!c.doCallback || !c.callback) return; c.doCallback = false; // RESET logic flag // EXECUTE the callback var cb = c.callback.split(",") , param = (cb[2] > 0 ? true : false) ; if (cb[0] == "open") open( cb[1], param ); else if (cb[0] == "close") close( cb[1], param ); if (!c.doCallback) c.callback = null; // RESET - unless callback above enabled it again! } /** * Executes a Callback function after a trigger event, like resize, open or close * * @param {?string} pane This is passed only so we can pass the 'pane object' to the callback * @param {(string|function())} v_fn Accepts a function name, OR a comma-delimited array: [0]=function name, [1]=argument */ , _execCallback = function (pane, v_fn) { if (!v_fn) return; var fn; try { if (typeof v_fn == "function") fn = v_fn; else if (!isStr(v_fn)) return; else if (v_fn.match(/,/)) { // function name cannot contain a comma, so must be a function name AND a 'name' parameter var args = v_fn.split(","); fn = eval(args[0]); if (typeof fn=="function" && args.length > 1) return fn(args[1]); // pass the argument parsed from 'list' } else // just the name of an external function? fn = eval(v_fn); if (typeof fn=="function") { if (pane && $Ps[pane]) // pass data: pane-name, pane-element, pane-state, pane-options, and layout-name return fn( pane, $Ps[pane], state[pane], options[pane], options.name ); else // must be a layout/container callback - pass suitable info return fn( Instance, state, options, options.name ); } } catch (ex) {} } /** * cure iframe display issues in IE & other browsers */ , _fixIframe = function (pane) { if ($.layout.browser.mozilla) return; // skip FireFox - it auto-refreshes iframes onShow var $P = $Ps[pane]; // if the 'pane' is an iframe, do it if (state[pane].tagName == "IFRAME") $P.css(_c.hidden).css(_c.visible); else // ditto for any iframes INSIDE the pane $P.find('IFRAME').css(_c.hidden).css(_c.visible); } /** * cssW / cssH / cssSize / cssMinDims * * Contains logic to check boxModel & browser, and return the correct width/height for the current browser/doctype * * @see initPanes(), sizeMidPanes(), initHandles(), sizeHandles() * @param {(string|!Object)} el Can accept a 'pane' (east, west, etc) OR a DOM object OR a jQuery object * @param {number=} outerWidth (optional) Can pass a width, allowing calculations BEFORE element is resized * @return {number} Returns the innerWidth of el by subtracting padding and borders */ , cssW = function (el, outerWidth) { var str = isStr(el) , $E = str ? $Ps[el] : $(el) ; if (!$E.length) return 0; if (isNaN(outerWidth)) // not specified outerWidth = str ? getPaneSize(el) : $E.outerWidth(); return $.layout.cssWidth($E, outerWidth); } /** * @param {(string|!Object)} el Can accept a 'pane' (east, west, etc) OR a DOM object OR a jQuery object * @param {number=} outerHeight (optional) Can pass a width, allowing calculations BEFORE element is resized * @return {number} Returns the innerHeight el by subtracting padding and borders */ , cssH = function (el, outerHeight) { var str = isStr(el) , $E = str ? $Ps[el] : $(el) ; if (!$E.length) return 0; if (isNaN(outerHeight)) // not specified outerHeight = str ? getPaneSize(el) : $E.outerHeight(); return $.layout.cssHeight($E, outerHeight); } /** * @param {string} pane Can accept ONLY a 'pane' (east, west, etc) * @param {number=} outerSize (optional) Can pass a width, allowing calculations BEFORE element is resized * @return {number} Returns the innerHeight/Width of el by subtracting padding and borders */ , cssSize = function (pane, outerSize) { if (_c[pane].dir=="horz") // pane = north or south return cssH(pane, outerSize); else // pane = east or west return cssW(pane, outerSize); } /** * @param {string} pane Can accept ONLY a 'pane' (east, west, etc) * @return {Object} Returns hash of minWidth & minHeight */ , cssMinDims = function (pane) { // minWidth/Height means CSS width/height = 1px var dir = _c[pane].dir , d = { minWidth: 1001 - cssW(pane, 1000) , minHeight: 1001 - cssH(pane, 1000) } ; if (dir == "horz") d.minSize = d.minHeight; if (dir == "vert") d.minSize = d.minWidth; return d; } // TODO: see if these methods can be made more useful... // TODO: *maybe* return cssW/H from these so caller can use this info /** * @param {(string|!Object)} el * @param {number=} outerWidth * @param {boolean=} autoHide */ , setOuterWidth = function (el, outerWidth, autoHide) { var $E = el, w; if (isStr(el)) $E = $Ps[el]; // west else if (!el.jquery) $E = $(el); w = cssW($E, outerWidth); $E.css({ width: w }); if (w > 0) { if (autoHide && $E.data('autoHidden') && $E.innerHeight() > 0) { $E.show().data('autoHidden', false); if (!$.layout.browser.mozilla) // FireFox refreshes iframes - IE does not // make hidden, then visible to 'refresh' display after animation $E.css(_c.hidden).css(_c.visible); } } else if (autoHide && !$E.data('autoHidden')) $E.hide().data('autoHidden', true); } /** * @param {(string|!Object)} el * @param {number=} outerHeight * @param {boolean=} autoHide */ , setOuterHeight = function (el, outerHeight, autoHide) { var $E = el, h; if (isStr(el)) $E = $Ps[el]; // west else if (!el.jquery) $E = $(el); h = cssH($E, outerHeight); $E.css({ height: h, visibility: "visible" }); // may have been 'hidden' by sizeContent if (h > 0 && $E.innerWidth() > 0) { if (autoHide && $E.data('autoHidden')) { $E.show().data('autoHidden', false); if (!$.layout.browser.mozilla) // FireFox refreshes iframes - IE does not $E.css(_c.hidden).css(_c.visible); } } else if (autoHide && !$E.data('autoHidden')) $E.hide().data('autoHidden', true); } /** * @param {(string|!Object)} el * @param {number=} outerSize * @param {boolean=} autoHide */ , setOuterSize = function (el, outerSize, autoHide) { if (_c[pane].dir=="horz") // pane = north or south setOuterHeight(el, outerSize, autoHide); else // pane = east or west setOuterWidth(el, outerSize, autoHide); } /** * Converts any 'size' params to a pixel/integer size, if not already * If 'auto' or a decimal/percentage is passed as 'size', a pixel-size is calculated * /** * @param {string} pane * @param {(string|number)=} size * @param {string=} dir * @return {number} */ , _parseSize = function (pane, size, dir) { if (!dir) dir = _c[pane].dir; if (isStr(size) && size.match(/%/)) size = parseInt(size, 10) / 100; // convert % to decimal if (size === 0) return 0; else if (size >= 1) return parseInt(size, 10); else if (size > 0) { // percentage, eg: .25 var o = options, avail; if (dir=="horz") // north or south or center.minHeight avail = sC.innerHeight - ($Ps.north ? o.north.spacing_open : 0) - ($Ps.south ? o.south.spacing_open : 0); else if (dir=="vert") // east or west or center.minWidth avail = sC.innerWidth - ($Ps.west ? o.west.spacing_open : 0) - ($Ps.east ? o.east.spacing_open : 0); return Math.floor(avail * size); } else if (pane=="center") return 0; else { // size < 0 || size=='auto' || size==Missing || size==Invalid // auto-size the pane var $P = $Ps[pane] , dim = (dir == "horz" ? "height" : "width") , vis = $.layout.showInvisibly($P) // show pane invisibly if hidden , s = $P.css(dim); // SAVE current size ; $P.css(dim, "auto"); size = (dim == "height") ? $P.outerHeight() : $P.outerWidth(); // MEASURE $P.css(dim, s).css(vis); // RESET size & visibility return size; } } /** * Calculates current 'size' (outer-width or outer-height) of a border-pane - optionally with 'pane-spacing' added * * @param {(string|!Object)} pane * @param {boolean=} inclSpace * @return {number} Returns EITHER Width for east/west panes OR Height for north/south panes - adjusted for boxModel & browser */ , getPaneSize = function (pane, inclSpace) { var $P = $Ps[pane] , o = options[pane] , s = state[pane] , oSp = (inclSpace ? o.spacing_open : 0) , cSp = (inclSpace ? o.spacing_closed : 0) ; if (!$P || s.isHidden) return 0; else if (s.isClosed || (s.isSliding && inclSpace)) return cSp; else if (_c[pane].dir == "horz") return $P.outerHeight() + oSp; else // dir == "vert" return $P.outerWidth() + oSp; } /** * Calculate min/max pane dimensions and limits for resizing * * @param {string} pane * @param {boolean=} slide */ , setSizeLimits = function (pane, slide) { if (!isInitialized()) return; var o = options[pane] , s = state[pane] , c = _c[pane] , dir = c.dir , side = c.side.toLowerCase() , type = c.sizeType.toLowerCase() , isSliding = (slide != undefined ? slide : s.isSliding) // only open() passes 'slide' param , $P = $Ps[pane] , paneSpacing = o.spacing_open // measure the pane on the *opposite side* from this pane , altPane = _c.altSide[pane] , altS = state[altPane] , $altP = $Ps[altPane] , altPaneSize = (!$altP || altS.isVisible===false || altS.isSliding ? 0 : (dir=="horz" ? $altP.outerHeight() : $altP.outerWidth())) , altPaneSpacing = ((!$altP || altS.isHidden ? 0 : options[altPane][ altS.isClosed !== false ? "spacing_closed" : "spacing_open" ]) || 0) // limitSize prevents this pane from 'overlapping' opposite pane , containerSize = (dir=="horz" ? sC.innerHeight : sC.innerWidth) , minCenterDims = cssMinDims("center") , minCenterSize = dir=="horz" ? max(options.center.minHeight, minCenterDims.minHeight) : max(options.center.minWidth, minCenterDims.minWidth) // if pane is 'sliding', then ignore center and alt-pane sizes - because 'overlays' them , limitSize = (containerSize - paneSpacing - (isSliding ? 0 : (_parseSize("center", minCenterSize, dir) + altPaneSize + altPaneSpacing))) , minSize = s.minSize = max( _parseSize(pane, o.minSize), cssMinDims(pane).minSize ) , maxSize = s.maxSize = min( (o.maxSize ? _parseSize(pane, o.maxSize) : 100000), limitSize ) , r = s.resizerPosition = {} // used to set resizing limits , top = sC.insetTop , left = sC.insetLeft , W = sC.innerWidth , H = sC.innerHeight , rW = o.spacing_open // subtract resizer-width to get top/left position for south/east ; switch (pane) { case "north": r.min = top + minSize; r.max = top + maxSize; break; case "west": r.min = left + minSize; r.max = left + maxSize; break; case "south": r.min = top + H - maxSize - rW; r.max = top + H - minSize - rW; break; case "east": r.min = left + W - maxSize - rW; r.max = left + W - minSize - rW; break; }; } /** * Returns data for setting the size/position of center pane. Also used to set Height for east/west panes * * @return JSON Returns a hash of all dimensions: top, bottom, left, right, (outer) width and (outer) height */ , calcNewCenterPaneDims = function () { var d = { top: getPaneSize("north", true) // true = include 'spacing' value for pane , bottom: getPaneSize("south", true) , left: getPaneSize("west", true) , right: getPaneSize("east", true) , width: 0 , height: 0 }; // NOTE: sC = state.container // calc center-pane outer dimensions d.width = sC.innerWidth - d.left - d.right; // outerWidth d.height = sC.innerHeight - d.bottom - d.top; // outerHeight // add the 'container border/padding' to get final positions relative to the container d.top += sC.insetTop; d.bottom += sC.insetBottom; d.left += sC.insetLeft; d.right += sC.insetRight; return d; } /** * Returns data for setting size of an element (container or a pane). * * @see _create(), onWindowResize() for container, plus others for pane * @return JSON Returns a hash of all dimensions: top, bottom, left, right, outerWidth, innerHeight, etc */ , elDims = function ($E) { return $.layout.getElementDimensions($E); } , elCSS = function ($E, list) { return $.layout.getElementCSS($E, list); } /** * @param {!Object} el * @param {boolean=} allStates */ , getHoverClasses = function (el, allStates) { var $El = $(el) , type = $El.data("layoutRole") , pane = $El.data("layoutEdge") , o = options[pane] , root = o[type +"Class"] , _pane = "-"+ pane // eg: "-west" , _open = "-open" , _closed = "-closed" , _slide = "-sliding" , _hover = "-hover " // NOTE the trailing space , _state = $El.hasClass(root+_closed) ? _closed : _open , _alt = _state == _closed ? _open : _closed , classes = (root+_hover) + (root+_pane+_hover) + (root+_state+_hover) + (root+_pane+_state+_hover) ; if (allStates) // when 'removing' classes, also remove alternate-state classes classes += (root+_alt+_hover) + (root+_pane+_alt+_hover); if (type=="resizer" && $El.hasClass(root+_slide)) classes += (root+_slide+_hover) + (root+_pane+_slide+_hover); return $.trim(classes); } , addHover = function (evt, el) { var $E = $(el || this); if (evt && $E.data("layoutRole") == "toggler") evt.stopPropagation(); // prevent triggering 'slide' on Resizer-bar $E.addClass( getHoverClasses($E) ); } , removeHover = function (evt, el) { var $E = $(el || this); $E.removeClass( getHoverClasses($E, true) ); } , onResizerEnter = function (evt) { $('body').disableSelection(); addHover(evt, this); } , onResizerLeave = function (evt, el) { var e = el || this // el is only passed when called by the timer , pane = $(e).data("layoutEdge") , name = pane +"ResizerLeave" ; timer.clear(pane+"_openSlider"); // cancel slideOpen timer, if set timer.clear(name); // cancel enableSelection timer - may re/set below if (!el) { // 1st call - mouseleave event removeHover(evt, this); // do this on initial call // this method calls itself on a timer because it needs to allow // enough time for dragging to kick-in and set the isResizing flag // dragging has a 100ms delay set, so this delay must be higher timer.set(name, function(){ onResizerLeave(evt, e); }, 200); } // if user is resizing, then dragStop will enableSelection() when done else if (!state[pane].isResizing) // 2nd call - by timer $('body').enableSelection(); } /* * ########################### * INITIALIZATION METHODS * ########################### */ /** * Initialize the layout - called automatically whenever an instance of layout is created * * @see none - triggered onInit * @return mixed true = fully initialized | false = panes not initialized (yet) | 'cancel' = abort */ , _create = function () { // initialize config/options initOptions(); var o = options; $.layout.browser.boxModel = $.support.boxModel; // update options with saved state, if option enabled if (o.useStateCookie && o.cookie.autoLoad) loadCookie(); // Update options from state-cookie // TEMP state so isInitialized returns true during init process state.creatingLayout = true; // options & state have been initialized, so now run beforeLoad callback // onload will CANCEL layout creation if it returns false if (false === _execCallback(null, o.onload_start)) return 'cancel'; // initialize the container element _initContainer(); // bind hotkey function - keyDown - if required initHotkeys(); // search for and bind custom-buttons if (o.autoBindCustomButtons) initButtons(); // bind window.onunload $(window).bind("unload."+ sID, unload); // if layout elements are hidden, then layout WILL NOT complete initialization! // initLayoutElements will set initialized=true and run the onload callback IF successful if (o.initPanes) _initLayoutElements(); delete state.creatingLayout; return state.initialized; } /** * Initialize the layout IF not already * * @see All methods in Instance run this test * @return boolean true = layoutElements have been initialized | false = panes are not initialized (yet) */ , isInitialized = function () { if (state.initialized || state.creatingLayout) return true; // already initialized else return _initLayoutElements(); // try to init panes NOW } /** * Initialize the layout - called automatically whenever an instance of layout is created * * @see _create() & isInitialized * @return An object pointer to the instance created */ , _initLayoutElements = function () { // initialize config/options var o = options; // CANNOT init panes inside a hidden container! if (!$N.is(":visible")) return false; // a center pane is required, so make sure it exists if (!getPane('center').length) { if (o.showErrorMessages) alert( lang.errCenterPaneMissing ); return false; } // TEMP state so isInitialized returns true during init process state.creatingLayout = true; // update Container dims $.extend(sC, elDims( $N )); // initialize all layout elements initPanes(); // size & position panes - calls initHandles() - which calls initResizable() sizeContent(); // AFTER panes & handles have been initialized, size 'content' divs if (o.scrollToBookmarkOnLoad) { var l = self.location; if (l.hash) l.replace( l.hash ); // scrollTo Bookmark } // bind resizeAll() for 'this layout instance' to window.resize event if (o.resizeWithWindow && !$N.data("layoutRole")) // skip if 'nested' inside a pane $(window).bind("resize."+ sID, windowResize); delete state.creatingLayout; state.initialized = true; _execCallback(null, o.onload_end || o.onload); return true; // elements initialized successfully } , windowResize = function () { var delay = Number(options.resizeWithWindowDelay); if (delay < 10) delay = 100; // MUST have a delay! // resizing uses a delay-loop because the resize event fires repeatly - except in FF, but delay anyway timer.clear("winResize"); // if already running timer.set("winResize", function(){ timer.clear("winResize"); timer.clear("winResizeRepeater"); var dims = elDims( $N ); // only trigger resizeAll() if container has changed size if (dims.innerWidth !== sC.innerWidth || dims.innerHeight !== sC.innerHeight) resizeAll(); }, delay); // ALSO set fixed-delay timer, if not already running if (!timer.data["winResizeRepeater"]) setWindowResizeRepeater(); } , setWindowResizeRepeater = function () { var delay = Number(options.resizeWithWindowMaxDelay); if (delay > 0) timer.set("winResizeRepeater", function(){ setWindowResizeRepeater(); resizeAll(); }, delay); } , unload = function () { var o = options; state.cookie = getState(); // save state in case onunload has custom state-management _execCallback(null, o.onunload_start); if (o.useStateCookie && o.cookie.autoSave) saveCookie(); _execCallback(null, o.onunload_end || o.onunload); } /** * Validate and initialize container CSS and events * * @see _create() */ , _initContainer = function () { var tag = sC.tagName = $N[0].tagName , o = options , fullPage= (tag == "BODY") , props = "overflow,position,margin,padding,border" , CSS = {} , hid = "hidden" // used A LOT! , isVis = $N.is(":visible") ; // sC -> state.container sC.selector = $N.selector.split(".slice")[0]; sC.ref = tag +"/"+ sC.selector; // used in messages $N .data("layout", Instance) .data("layoutContainer", sID) // unique identifier for internal use .addClass(o.containerClass) ; // SAVE original container CSS for use in destroy() if (!$N.data("layoutCSS")) { // handle props like overflow different for BODY & HTML - has 'system default' values if (fullPage) { CSS = $.extend( elCSS($N, props), { height: $N.css("height") , overflow: $N.css("overflow") , overflowX: $N.css("overflowX") , overflowY: $N.css("overflowY") }); // ALSO SAVE <HTML> CSS var $H = $("html"); $H.data("layoutCSS", { height: "auto" // FF would return a fixed px-size! , overflow: $H.css("overflow") , overflowX: $H.css("overflowX") , overflowY: $H.css("overflowY") }); } else // handle props normally for non-body elements CSS = elCSS($N, props+",top,bottom,left,right,width,height,overflow,overflowX,overflowY"); $N.data("layoutCSS", CSS); } try { // format html/body if this is a full page layout if (fullPage) { $("html").css({ height: "100%" , overflow: hid , overflowX: hid , overflowY: hid }); $("body").css({ position: "relative" , height: "100%" , overflow: hid , overflowX: hid , overflowY: hid , margin: 0 , padding: 0 // TODO: test whether body-padding could be handled? , border: "none" // a body-border creates problems because it cannot be measured! }); // set current layout-container dimensions $.extend(sC, elDims( $N )); } else { // set required CSS for overflow and position // ENSURE container will not 'scroll' CSS = { overflow: hid, overflowX: hid, overflowY: hid } var p = $N.css("position") , h = $N.css("height") ; // if this is a NESTED layout, then container/outer-pane ALREADY has position and height if (!$N.data("layoutRole")) { if (!p || !p.match(/fixed|absolute|relative/)) CSS.position = "relative"; // container MUST have a 'position' /* if (!h || h=="auto") CSS.height = "100%"; // container MUST have a 'height' */ } $N.css( CSS ); // set current layout-container dimensions if (isVis) { $.extend(sC, elDims( $N )); if (o.showErrorMessages && sC.innerHeight < 2) alert( lang.errContainerHeight.replace(/CONTAINER/, sC.ref) ); } } } catch (ex) {} } /** * Bind layout hotkeys - if options enabled * * @see _create() and addPane() * @param {string=} panes The edge(s) to process, blank = all */ , initHotkeys = function (panes) { if (!panes || panes == "all") panes = _c.borderPanes; // bind keyDown to capture hotkeys, if option enabled for ANY pane $.each(panes.split(","), function (i, pane) { var o = options[pane]; if (o.enableCursorHotkey || o.customHotkey) { $(document).bind("keydown."+ sID, keyDown); // only need to bind this ONCE return false; // BREAK - binding was done } }); } /** * Build final OPTIONS data * * @see _create() */ , initOptions = function () { // simplify logic by making sure passed 'opts' var has basic keys opts = _transformData( opts ); // TODO: create a compatibility add-on for new UI widget that will transform old option syntax var newOpts = { applyDefaultStyles: "applyDemoStyles" }; renameOpts(opts.defaults); $.each(_c.allPanes.split(","), function (i, pane) { renameOpts(opts[pane]); }); // update default effects, if case user passed key if (opts.effects) { $.extend( effects, opts.effects ); delete opts.effects; } $.extend( options.cookie, opts.cookie ); // see if any 'global options' were specified var globals = "name,containerClass,zIndex,scrollToBookmarkOnLoad,resizeWithWindow,resizeWithWindowDelay,resizeWithWindowMaxDelay,"+ "onresizeall,onresizeall_start,onresizeall_end,onload,onload_start,onload_end,onunload,onunload_start,onunload_end,autoBindCustomButtons,useStateCookie"; $.each(globals.split(","), function (i, key) { if (opts[key] !== undefined) options[key] = opts[key]; else if (opts.defaults[key] !== undefined) { options[key] = opts.defaults[key]; delete opts.defaults[key]; } }); // remove any 'defaults' that MUST be set 'per-pane' $.each("paneSelector,resizerCursor,customHotkey".split(","), function (i, key) { delete opts.defaults[key]; } // is OK if key does not exist ); // now update options.defaults $.extend( true, options.defaults, opts.defaults ); // merge config for 'center-pane' - border-panes handled in the loop below _c.center = $.extend( true, {}, _c.panes, _c.center ); // update config.zIndex values if zIndex option specified var z = options.zIndex; if (z === 0 || z > 0) { _c.zIndex.pane_normal = z; _c.zIndex.resizer_normal = z+1; _c.zIndex.iframe_mask = z+1; } // merge options for 'center-pane' - border-panes handled in the loop below $.extend( options.center, opts.center ); // Most 'default options' do not apply to 'center', so add only those that DO var o_Center = $.extend( true, {}, options.defaults, opts.defaults, options.center ); // TEMP data var optionsCenter = ("paneClass,contentSelector,applyDemoStyles,triggerEventsOnLoad,showOverflowOnHover," + "onresize,onresize_start,onresize_end,resizeNestedLayout,resizeContentWhileDragging," + "onsizecontent,onsizecontent_start,onsizecontent_end").split(","); $.each(optionsCenter, function (i, key) { options.center[key] = o_Center[key]; } ); var o, defs = options.defaults; // create a COMPLETE set of options for EACH border-pane $.each(_c.borderPanes.split(","), function (i, pane) { // apply 'pane-defaults' to CONFIG.[PANE] _c[pane] = $.extend( true, {}, _c.panes, _c[pane] ); // apply 'pane-defaults' + user-options to OPTIONS.PANE o = options[pane] = $.extend( true, {}, options.defaults, options[pane], opts.defaults, opts[pane] ); // make sure we have base-classes if (!o.paneClass) o.paneClass = "ui-layout-pane"; if (!o.resizerClass) o.resizerClass = "ui-layout-resizer"; if (!o.togglerClass) o.togglerClass = "ui-layout-toggler"; // create FINAL fx options for each pane, ie: options.PANE.fxName/fxSpeed/fxSettings[_open|_close] $.each(["_open","_close",""], function (i,n) { var sName = "fxName"+n , sSpeed = "fxSpeed"+n , sSettings = "fxSettings"+n ; // recalculate fxName according to specificity rules o[sName] = opts[pane][sName] // opts.west.fxName_open || opts[pane].fxName // opts.west.fxName || opts.defaults[sName] // opts.defaults.fxName_open || opts.defaults.fxName // opts.defaults.fxName || o[sName] // options.west.fxName_open || o.fxName // options.west.fxName || defs[sName] // options.defaults.fxName_open || defs.fxName // options.defaults.fxName || "none" ; // validate fxName to be sure is a valid effect var fxName = o[sName]; if (fxName == "none" || !$.effects || !$.effects[fxName] || (!effects[fxName] && !o[sSettings] && !o.fxSettings)) fxName = o[sName] = "none"; // effect not loaded, OR undefined FX AND fxSettings not passed // set vars for effects subkeys to simplify logic var fx = effects[fxName] || {} // effects.slide , fx_all = fx.all || {} // effects.slide.all , fx_pane = fx[pane] || {} // effects.slide.west ; // RECREATE the fxSettings[_open|_close] keys using specificity rules o[sSettings] = $.extend( {} , fx_all // effects.slide.all , fx_pane // effects.slide.west , defs.fxSettings || {} // options.defaults.fxSettings , defs[sSettings] || {} // options.defaults.fxSettings_open , o.fxSettings // options.west.fxSettings , o[sSettings] // options.west.fxSettings_open , opts.defaults.fxSettings // opts.defaults.fxSettings , opts.defaults[sSettings] || {} // opts.defaults.fxSettings_open , opts[pane].fxSettings // opts.west.fxSettings , opts[pane][sSettings] || {} // opts.west.fxSettings_open ); // recalculate fxSpeed according to specificity rules o[sSpeed] = opts[pane][sSpeed] // opts.west.fxSpeed_open || opts[pane].fxSpeed // opts.west.fxSpeed (pane-default) || opts.defaults[sSpeed] // opts.defaults.fxSpeed_open || opts.defaults.fxSpeed // opts.defaults.fxSpeed || o[sSpeed] // options.west.fxSpeed_open || o[sSettings].duration // options.west.fxSettings_open.duration || o.fxSpeed // options.west.fxSpeed || o.fxSettings.duration // options.west.fxSettings.duration || defs.fxSpeed // options.defaults.fxSpeed || defs.fxSettings.duration// options.defaults.fxSettings.duration || fx_pane.duration // effects.slide.west.duration || fx_all.duration // effects.slide.all.duration || "normal" // DEFAULT ; }); }); function renameOpts (O) { for (var key in newOpts) { if (O[key] != undefined) { O[newOpts[key]] = O[key]; delete O[key]; } } } } /** * Initialize module objects, styling, size and position for all panes * * @see _create() * @param {string} pane The pane to process */ , getPane = function (pane) { var sel = options[pane].paneSelector if (sel.substr(0,1)==="#") // ID selector // NOTE: elements selected 'by ID' DO NOT have to be 'children' return $N.find(sel).eq(0); else { // class or other selector var $P = $N.children(sel).eq(0); // look for the pane nested inside a 'form' element return $P.length ? $P : $N.children("form:first").children(sel).eq(0); } } , initPanes = function () { // NOTE: do north & south FIRST so we can measure their height - do center LAST $.each(_c.allPanes.split(","), function (idx, pane) { addPane( pane, true ); }); // init the pane-handles NOW in case we have to hide or close the pane below initHandles(); // now that all panes have been initialized and initially-sized, // make sure there is really enough space available for each pane $.each(_c.borderPanes.split(","), function (i, pane) { if ($Ps[pane] && state[pane].isVisible) { // pane is OPEN setSizeLimits(pane); makePaneFit(pane); // pane may be Closed, Hidden or Resized by makePaneFit() } }); // size center-pane AGAIN in case we 'closed' a border-pane in loop above sizeMidPanes("center"); // Chrome fires callback BEFORE it completes resizing, so add a delay before handling children setTimeout(function(){ $.each(_c.allPanes.split(","), function (i, pane) { var o = options[pane]; if ($Ps[pane] && state[pane].isVisible) { // pane is OPEN // trigger onResize callbacks for all panes with triggerEventsOnLoad = true if (o.triggerEventsOnLoad) _execCallback(pane, o.onresize_end || o.onresize); resizeNestedLayout(pane); } }); }, 50 ); // 50ms delay is enough if (options.showErrorMessages && $N.innerHeight() < 2) alert( lang.errContainerHeight.replace(/CONTAINER/, sC.ref) ); } /** * Remove a pane from the layout - subroutine of destroy() * * @see initPanes() * @param {string} pane The pane to process */ , addPane = function (pane, force) { if (!force && !isInitialized()) return; var o = options[pane] , s = state[pane] , c = _c[pane] , fx = s.fx , dir = c.dir , spacing = o.spacing_open || 0 , isCenter = (pane == "center") , CSS = {} , $P = $Ps[pane] , size, minSize, maxSize ; // if pane-pointer already exists, remove the old one first if ($P) removePane( pane ); else $Cs[pane] = false; // init $P = $Ps[pane] = getPane(pane); if (!$P.length) { $Ps[pane] = false; // logic return; } // SAVE original Pane CSS if (!$P.data("layoutCSS")) { var props = "position,top,left,bottom,right,width,height,overflow,zIndex,display,backgroundColor,padding,margin,border"; $P.data("layoutCSS", elCSS($P, props)); } // add basic classes & attributes $P .data("parentLayout", Instance) .data("layoutRole", "pane") .data("layoutEdge", pane) .css(c.cssReq).css("zIndex", _c.zIndex.pane_normal) .css(o.applyDemoStyles ? c.cssDemo : {}) // demo styles .addClass( o.paneClass +" "+ o.paneClass+"-"+pane ) // default = "ui-layout-pane ui-layout-pane-west" - may be a dupe of 'paneSelector' .bind("mouseenter."+ sID, addHover ) .bind("mouseleave."+ sID, removeHover ) ; // see if this pane has a 'scrolling-content element' initContent(pane, false); // false = do NOT sizeContent() - called later if (!isCenter) { // call _parseSize AFTER applying pane classes & styles - but before making visible (if hidden) // if o.size is auto or not valid, then MEASURE the pane and use that as its 'size' size = s.size = _parseSize(pane, o.size); minSize = _parseSize(pane,o.minSize) || 1; maxSize = _parseSize(pane,o.maxSize) || 100000; if (size > 0) size = max(min(size, maxSize), minSize); // state for border-panes s.isClosed = false; // true = pane is closed s.isSliding = false; // true = pane is currently open by 'sliding' over adjacent panes s.isResizing= false; // true = pane is in process of being resized s.isHidden = false; // true = pane is hidden - no spacing, resizer or toggler is visible! } // state common to ALL panes s.tagName = $P[0].tagName; s.edge = pane // useful if pane is (or about to be) 'swapped' - easy find out where it is (or is going) s.noRoom = false; // true = pane 'automatically' hidden due to insufficient room - will unhide automatically s.isVisible = true; // false = pane is invisible - closed OR hidden - simplify logic // set css-position to account for container borders & padding switch (pane) { case "north": CSS.top = sC.insetTop; CSS.left = sC.insetLeft; CSS.right = sC.insetRight; break; case "south": CSS.bottom = sC.insetBottom; CSS.left = sC.insetLeft; CSS.right = sC.insetRight; break; case "west": CSS.left = sC.insetLeft; // top, bottom & height set by sizeMidPanes() break; case "east": CSS.right = sC.insetRight; // ditto break; case "center": // top, left, width & height set by sizeMidPanes() } if (dir == "horz") // north or south pane CSS.height = max(1, cssH(pane, size)); else if (dir == "vert") // east or west pane CSS.width = max(1, cssW(pane, size)); //else if (isCenter) {} $P.css(CSS); // apply size -- top, bottom & height will be set by sizeMidPanes if (dir != "horz") sizeMidPanes(pane, true); // true = skipCallback // close or hide the pane if specified in settings if (o.initClosed && o.closable && !o.initHidden) close(pane, true, true); // true, true = force, noAnimation else if (o.initHidden || o.initClosed) hide(pane); // will be completely invisible - no resizer or spacing else if (!s.noRoom) // make the pane visible - in case was initially hidden $P.css("display","block"); // ELSE setAsOpen() - called later by initHandles() // RESET visibility now - pane will appear IF display:block $P.css("visibility","visible"); // check option for auto-handling of pop-ups & drop-downs if (o.showOverflowOnHover) $P.hover( allowOverflow, resetOverflow ); // if adding a pane AFTER initialization, then... if (state.initialized) { initHandles( pane ); initHotkeys( pane ); resizeAll(); // will sizeContent if pane is visible if (s.isVisible) { // pane is OPEN if (o.triggerEventsOnLoad) _execCallback(pane, o.onresize_end || o.onresize); resizeNestedLayout(pane); } } } /** * Initialize module objects, styling, size and position for all resize bars and toggler buttons * * @see _create() * @param {string=} panes The edge(s) to process, blank = all */ , initHandles = function (panes) { if (!panes || panes == "all") panes = _c.borderPanes; // create toggler DIVs for each pane, and set object pointers for them, eg: $R.north = north toggler DIV $.each(panes.split(","), function (i, pane) { var $P = $Ps[pane]; $Rs[pane] = false; // INIT $Ts[pane] = false; if (!$P) return; // pane does not exist - skip var o = options[pane] , s = state[pane] , c = _c[pane] , rClass = o.resizerClass , tClass = o.togglerClass , side = c.side.toLowerCase() , spacing = (s.isVisible ? o.spacing_open : o.spacing_closed) , _pane = "-"+ pane // used for classNames , _state = (s.isVisible ? "-open" : "-closed") // used for classNames // INIT RESIZER BAR , $R = $Rs[pane] = $("<div></div>") // INIT TOGGLER BUTTON , $T = (o.closable ? $Ts[pane] = $("<div></div>") : false) ; //if (s.isVisible && o.resizable) ... handled by initResizable if (!s.isVisible && o.slidable) $R.attr("title", o.sliderTip).css("cursor", o.sliderCursor); $R // if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "paneLeft-resizer" .attr("id", (o.paneSelector.substr(0,1)=="#" ? o.paneSelector.substr(1) + "-resizer" : "")) .data("parentLayout", Instance) .data("layoutRole", "resizer") .data("layoutEdge", pane) .css(_c.resizers.cssReq).css("zIndex", _c.zIndex.resizer_normal) .css(o.applyDemoStyles ? _c.resizers.cssDemo : {}) // add demo styles .addClass(rClass +" "+ rClass+_pane) .appendTo($N) // append DIV to container ; if ($T) { $T // if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "#paneLeft-toggler" .attr("id", (o.paneSelector.substr(0,1)=="#" ? o.paneSelector.substr(1) + "-toggler" : "")) .data("parentLayout", Instance) .data("layoutRole", "toggler") .data("layoutEdge", pane) .css(_c.togglers.cssReq) // add base/required styles .css(o.applyDemoStyles ? _c.togglers.cssDemo : {}) // add demo styles .addClass(tClass +" "+ tClass+_pane) .appendTo($R) // append SPAN to resizer DIV ; // ADD INNER-SPANS TO TOGGLER if (o.togglerContent_open) // ui-layout-open $("<span>"+ o.togglerContent_open +"</span>") .data("layoutRole", "togglerContent") .data("layoutEdge", pane) .addClass("content content-open") .css("display","none") .appendTo( $T ) //.hover( addHover, removeHover ) // use ui-layout-toggler-west-hover .content-open instead! ; if (o.togglerContent_closed) // ui-layout-closed $("<span>"+ o.togglerContent_closed +"</span>") .data("layoutRole", "togglerContent") .data("layoutEdge", pane) .addClass("content content-closed") .css("display","none") .appendTo( $T ) //.hover( addHover, removeHover ) // use ui-layout-toggler-west-hover .content-closed instead! ; // ADD TOGGLER.click/.hover enableClosable(pane); } // add Draggable events initResizable(pane); // ADD CLASSNAMES & SLIDE-BINDINGS - eg: class="resizer resizer-west resizer-open" if (s.isVisible) setAsOpen(pane); // onOpen will be called, but NOT onResize else { setAsClosed(pane); // onClose will be called bindStartSlidingEvent(pane, true); // will enable events IF option is set } }); // SET ALL HANDLE DIMENSIONS sizeHandles("all"); } /** * Initialize scrolling ui-layout-content div - if exists * * @see initPane() - or externally after an Ajax injection * @param {string} pane The pane to process * @param {boolean=} resize Size content after init, default = true */ , initContent = function (pane, resize) { if (!isInitialized()) return; var o = options[pane] , sel = o.contentSelector , $P = $Ps[pane] , $C ; if (sel) $C = $Cs[pane] = (o.findNestedContent) ? $P.find(sel).eq(0) // match 1-element only : $P.children(sel).eq(0) ; if ($C && $C.length) { // SAVE original Pane CSS if (!$C.data("layoutCSS")) $C.data("layoutCSS", elCSS($C, "height")); $C.css( _c.content.cssReq ); if (o.applyDemoStyles) { $C.css( _c.content.cssDemo ); // add padding & overflow: auto to content-div $P.css( _c.content.cssDemoPane ); // REMOVE padding/scrolling from pane } state[pane].content = {}; // init content state if (resize !== false) sizeContent(pane); // sizeContent() is called AFTER init of all elements } else $Cs[pane] = false; } /** * Searches for .ui-layout-button-xxx elements and auto-binds them as layout-buttons * * @see _create() */ , initButtons = function () { var pre = "ui-layout-button-", name; $.each("toggle,open,close,pin,toggle-slide,open-slide".split(","), function (i, action) { $.each(_c.borderPanes.split(","), function (ii, pane) { $("."+pre+action+"-"+pane).each(function(){ // if button was previously 'bound', data.layoutName was set, but is blank if layout has no 'name' name = $(this).data("layoutName") || $(this).attr("layoutName"); if (name == undefined || name == options.name) bindButton(this, action, pane); }); }); }); } /** * Add resize-bars to all panes that specify it in options * -dependancy: $.fn.resizable - will skip if not found * * @see _create() * @param {string=} panes The edge(s) to process, blank = all */ , initResizable = function (panes) { var draggingAvailable = (typeof $.fn.draggable == "function") , $Frames, side // set in start() ; if (!panes || panes == "all") panes = _c.borderPanes; $.each(panes.split(","), function (idx, pane) { var o = options[pane] , s = state[pane] , c = _c[pane] , side = (c.dir=="horz" ? "top" : "left") , r, live // set in start because may change ; if (!draggingAvailable || !$Ps[pane] || !o.resizable) { o.resizable = false; return true; // skip to next } var $P = $Ps[pane] , $R = $Rs[pane] , base = o.resizerClass // 'drag' classes are applied to the ORIGINAL resizer-bar while dragging is in process , resizerClass = base+"-drag" // resizer-drag , resizerPaneClass = base+"-"+pane+"-drag" // resizer-north-drag // 'helper' class is applied to the CLONED resizer-bar while it is being dragged , helperClass = base+"-dragging" // resizer-dragging , helperPaneClass = base+"-"+pane+"-dragging" // resizer-north-dragging , helperLimitClass = base+"-dragging-limit" // resizer-drag , helperPaneLimitClass = base+"-"+pane+"-dragging-limit" // resizer-north-drag , helperClassesSet = false // logic var ; if (!s.isClosed) $R .attr("title", o.resizerTip) .css("cursor", o.resizerCursor) // n-resize, s-resize, etc ; $R.bind("mouseenter."+ sID, onResizerEnter) .bind("mouseleave."+ sID, onResizerLeave); $R.draggable({ containment: $N[0] // limit resizing to layout container , axis: (c.dir=="horz" ? "y" : "x") // limit resizing to horz or vert axis , delay: 0 , distance: 1 // basic format for helper - style it using class: .ui-draggable-dragging , helper: "clone" , opacity: o.resizerDragOpacity , addClasses: false // avoid ui-state-disabled class when disabled //, iframeFix: o.draggableIframeFix // TODO: consider using when bug is fixed , zIndex: _c.zIndex.resizer_drag , start: function (e, ui) { // REFRESH options & state pointers in case we used swapPanes o = options[pane]; s = state[pane]; // re-read options live = o.resizeWhileDragging; // ondrag_start callback - will CANCEL hide if returns false // TODO: dragging CANNOT be cancelled like this, so see if there is a way? if (false === _execCallback(pane, o.ondrag_start)) return false; _c.isLayoutBusy = true; // used by sizePane() logic during a liveResize s.isResizing = true; // prevent pane from closing while resizing timer.clear(pane+"_closeSlider"); // just in case already triggered // SET RESIZER LIMITS - used in drag() setSizeLimits(pane); // update pane/resizer state r = s.resizerPosition; $R.addClass( resizerClass +" "+ resizerPaneClass ); // add drag classes helperClassesSet = false; // reset logic var - see drag() // MASK PANES WITH IFRAMES OR OTHER TROUBLESOME ELEMENTS $Frames = $(o.maskIframesOnResize === true ? "iframe" : o.maskIframesOnResize).filter(":visible"); var id, i=0; // ID incrementer - used when 'resizing' masks during dynamic resizing $Frames.each(function() { id = "ui-layout-mask-"+ (++i); $(this).data("layoutMaskID", id); // tag iframe with corresponding maskID $('<div id="'+ id +'" class="ui-layout-mask ui-layout-mask-'+ pane +'"/>') .css({ background: "#fff" , opacity: "0.001" , zIndex: _c.zIndex.iframe_mask , position: "absolute" , width: this.offsetWidth+"px" , height: this.offsetHeight+"px" }) .css($(this).position()) // top & left -- changed from offset() .appendTo(this.parentNode) // put mask-div INSIDE pane to avoid zIndex issues ; }); // DISABLE TEXT SELECTION (probably already done by resizer.mouseOver) $('body').disableSelection(); } , drag: function (e, ui) { if (!helperClassesSet) { // can only add classes after clone has been added to the DOM //$(".ui-draggable-dragging") ui.helper .addClass( helperClass +" "+ helperPaneClass ) // add helper classes .css({ right: "auto", bottom: "auto" }) // fix dir="rtl" issue .children().css("visibility","hidden") // hide toggler inside dragged resizer-bar ; helperClassesSet = true; // draggable bug!? RE-SET zIndex to prevent E/W resize-bar showing through N/S pane! if (s.isSliding) $Ps[pane].css("zIndex", _c.zIndex.pane_sliding); } // CONTAIN RESIZER-BAR TO RESIZING LIMITS var limit = 0; if (ui.position[side] < r.min) { ui.position[side] = r.min; limit = -1; } else if (ui.position[side] > r.max) { ui.position[side] = r.max; limit = 1; } // ADD/REMOVE dragging-limit CLASS if (limit) { ui.helper.addClass( helperLimitClass +" "+ helperPaneLimitClass ); // at dragging-limit window.defaultStatus = "Panel has reached its " + ((limit>0 && pane.match(/north|west/)) || (limit<0 && pane.match(/south|east/)) ? "maximum" : "minimum") +" size"; } else { ui.helper.removeClass( helperLimitClass +" "+ helperPaneLimitClass ); // not at dragging-limit window.defaultStatus = ""; } // DYNAMICALLY RESIZE PANES IF OPTION ENABLED if (live) resizePanes(e, ui, pane); } , stop: function (e, ui) { $('body').enableSelection(); // RE-ENABLE TEXT SELECTION window.defaultStatus = ""; // clear 'resizing limit' message from statusbar $R.removeClass( resizerClass +" "+ resizerPaneClass ); // remove drag classes from Resizer s.isResizing = false; _c.isLayoutBusy = false; // set BEFORE resizePanes so other logic can pick it up resizePanes(e, ui, pane, true); // true = resizingDone } }); /** * resizePanes * * Sub-routine called from stop() and optionally drag() * * @param {!Object} evt * @param {!Object} ui * @param {string} pane * @param {boolean=} resizingDone */ var resizePanes = function (evt, ui, pane, resizingDone) { var dragPos = ui.position , c = _c[pane] , resizerPos, newSize , i = 0 // ID incrementer ; switch (pane) { case "north": resizerPos = dragPos.top; break; case "west": resizerPos = dragPos.left; break; case "south": resizerPos = sC.offsetHeight - dragPos.top - o.spacing_open; break; case "east": resizerPos = sC.offsetWidth - dragPos.left - o.spacing_open; break; }; if (resizingDone) { // Remove OR Resize MASK(S) created in drag.start $("div.ui-layout-mask").each(function() { this.parentNode.removeChild(this); }); //$("div.ui-layout-mask").remove(); // TODO: Is this less efficient? // ondrag_start callback - will CANCEL hide if returns false if (false === _execCallback(pane, o.ondrag_end || o.ondrag)) return false; } else $Frames.each(function() { $("#"+ $(this).data("layoutMaskID")) // get corresponding mask by ID .css($(this).position()) // update top & left .css({ // update width & height width: this.offsetWidth +"px" , height: this.offsetHeight+"px" }) ; }); // remove container margin from resizer position to get the pane size newSize = resizerPos - sC["inset"+ c.side]; manualSizePane(pane, newSize); } }); } /** * Destroy this layout and reset all elements */ , destroy = function () { // UNBIND layout events and remove global object $(window).unbind("."+ sID); $(document).unbind("."+ sID); // loop all panes to remove layout classes, attributes and bindings $.each(_c.allPanes.split(","), function (i, pane) { removePane( pane, false, true ); // true = skipResize }); // reset layout-container $N .removeData("layout") .removeData("layoutContainer") .removeClass(options.containerClass) ; // do NOT reset container CSS if is a 'pane' in an outer-layout - ie, THIS layout is 'nested' if (!$N.data("layoutEdge") && $N.data("layoutCSS")) // RESET CSS $N.css( $N.data("layoutCSS") ).removeData("layoutCSS"); // for full-page layouts, also reset the <HTML> CSS if (sC.tagName == "BODY" && ($N = $("html")).data("layoutCSS")) // RESET <HTML> CSS $N.css( $N.data("layoutCSS") ).removeData("layoutCSS"); // trigger state-management and onunload callback unload(); } /** * Remove a pane from the layout - subroutine of destroy() * * @see destroy() * @param {string} pane The pane to process * @param {boolean=} remove Remove the DOM element? default = false * @param {boolean=} skipResize Skip calling resizeAll()? default = false */ , removePane = function (pane, remove, skipResize) { if (!isInitialized()) return; if (!$Ps[pane]) return; // NO SUCH PANE var $P = $Ps[pane] , $C = $Cs[pane] , $R = $Rs[pane] , $T = $Ts[pane] // create list of ALL pane-classes that need to be removed , _open = "-open" , _sliding= "-sliding" , _closed = "-closed" , root = options[pane].paneClass // default="ui-layout-pane" , pRoot = root +"-"+ pane // eg: "ui-layout-pane-west" , classes = [ root, root+_open, root+_closed, root+_sliding, // generic classes pRoot, pRoot+_open, pRoot+_closed, pRoot+_sliding ] // pane-specific classes ; $.merge(classes, getHoverClasses($P, true)); // ADD hover-classes if (!$P || !$P.length) { } // pane has already been deleted! else if (remove && !$P.data("layoutContainer") && (!$C || !$C.length || !$C.data("layoutContainer"))) $P.remove(); else { $P .removeClass( classes.join(" ") ) // remove ALL pane-classes .removeData("layoutParent") .removeData("layoutRole") .removeData("layoutEdge") .removeData("autoHidden") // in case set .unbind("."+ sID) // remove ALL Layout events // TODO: remove these extra unbind commands when jQuery is fixed //.unbind("mouseenter"+ sID) //.unbind("mouseleave"+ sID) ; // do NOT reset CSS if this pane is STILL the container of a nested layout! // the nested layout will reset its 'container' when/if it is destroyed if (!$P.data("layoutContainer")) $P.css( $P.data("layoutCSS") ).removeData("layoutCSS"); // DITTO for the Content elem if ($C && $C.length && !$C.data("layoutContainer")) $C.css( $C.data("layoutCSS") ).removeData("layoutCSS"); } // REMOVE pane resizer and toggler elements if ($T && $T.length) $T.remove(); if ($R && $R.length) $R.remove(); // CLEAR all pointers and data $Ps[pane] = $Cs[pane] = $Rs[pane] = $Ts[pane] = false; // skip resize & state-clear when called from destroy() if (!skipResize) { resizeAll(); state[pane] = {}; } } /* * ########################### * ACTION METHODS * ########################### */ /** * Completely 'hides' a pane, including its spacing - as if it does not exist * The pane is not actually 'removed' from the source, so can use 'show' to un-hide it * * @param {string} pane The pane being hidden, ie: north, south, east, or west * @param {boolean=} noAnimation */ , hide = function (pane, noAnimation) { if (!isInitialized()) return; var o = options[pane] , s = state[pane] , $P = $Ps[pane] , $R = $Rs[pane] ; if (!$P || s.isHidden) return; // pane does not exist OR is already hidden // onhide_start callback - will CANCEL hide if returns false if (state.initialized && false === _execCallback(pane, o.onhide_start)) return; s.isSliding = false; // just in case // now hide the elements if ($R) $R.hide(); // hide resizer-bar if (!state.initialized || s.isClosed) { s.isClosed = true; // to trigger open-animation on show() s.isHidden = true; s.isVisible = false; $P.hide(); // no animation when loading page sizeMidPanes(_c[pane].dir == "horz" ? "all" : "center"); if (state.initialized || o.triggerEventsOnLoad) _execCallback(pane, o.onhide_end || o.onhide); } else { s.isHiding = true; // used by onclose close(pane, false, noAnimation); // adjust all panes to fit } } /** * Show a hidden pane - show as 'closed' by default unless openPane = true * * @param {string} pane The pane being opened, ie: north, south, east, or west * @param {boolean=} openPane * @param {boolean=} noAnimation * @param {boolean=} noAlert */ , show = function (pane, openPane, noAnimation, noAlert) { if (!isInitialized()) return; var o = options[pane] , s = state[pane] , $P = $Ps[pane] , $R = $Rs[pane] ; if (!$P || !s.isHidden) return; // pane does not exist OR is not hidden // onshow_start callback - will CANCEL show if returns false if (false === _execCallback(pane, o.onshow_start)) return; s.isSliding = false; // just in case s.isShowing = true; // used by onopen/onclose //s.isHidden = false; - will be set by open/close - if not cancelled // now show the elements //if ($R) $R.show(); - will be shown by open/close if (openPane === false) close(pane, true); // true = force else open(pane, false, noAnimation, noAlert); // adjust all panes to fit } /** * Toggles a pane open/closed by calling either open or close * * @param {string} pane The pane being toggled, ie: north, south, east, or west * @param {boolean=} slide */ , toggle = function (pane, slide) { if (!isInitialized()) return; if (!isStr(pane)) { pane.stopImmediatePropagation(); // pane = event pane = $(this).data("layoutEdge"); // bound to $R.dblclick } var s = state[str(pane)]; if (s.isHidden) show(pane); // will call 'open' after unhiding it else if (s.isClosed) open(pane, !!slide); else close(pane); } /** * Utility method used during init or other auto-processes * * @param {string} pane The pane being closed * @param {boolean=} setHandles */ , _closePane = function (pane, setHandles) { var $P = $Ps[pane] , s = state[pane] ; $P.hide(); s.isClosed = true; s.isVisible = false; // UNUSED: if (setHandles) setAsClosed(pane, true); // true = force } /** * Close the specified pane (animation optional), and resize all other panes as needed * * @param {string} pane The pane being closed, ie: north, south, east, or west * @param {boolean=} force * @param {boolean=} noAnimation * @param {boolean=} skipCallback */ , close = function (pane, force, noAnimation, skipCallback) { if (!state.initialized && $Ps[pane]) { _closePane(pane); // INIT pane as closed return; } if (!isInitialized()) return; var $P = $Ps[pane] , $R = $Rs[pane] , $T = $Ts[pane] , o = options[pane] , s = state[pane] , doFX = !noAnimation && !s.isClosed && (o.fxName_close != "none") // transfer logic vars to temp vars , isShowing = s.isShowing , isHiding = s.isHiding , wasSliding = s.isSliding ; // now clear the logic vars delete s.isShowing; delete s.isHiding; if (!$P || (!o.closable && !isShowing && !isHiding)) return; // invalid request // (!o.resizable && !o.closable) ??? else if (!force && s.isClosed && !isShowing) return; // already closed if (_c.isLayoutBusy) { // layout is 'busy' - probably with an animation _queue("close", pane, force); // set a callback for this action, if possible return; // ABORT } // onclose_start callback - will CANCEL hide if returns false // SKIP if just 'showing' a hidden pane as 'closed' if (!isShowing && false === _execCallback(pane, o.onclose_start)) return; // SET flow-control flags _c[pane].isMoving = true; _c.isLayoutBusy = true; s.isClosed = true; s.isVisible = false; // update isHidden BEFORE sizing panes if (isHiding) s.isHidden = true; else if (isShowing) s.isHidden = false; if (s.isSliding) // pane is being closed, so UNBIND trigger events bindStopSlidingEvents(pane, false); // will set isSliding=false else // resize panes adjacent to this one sizeMidPanes(_c[pane].dir == "horz" ? "all" : "center", false); // false = NOT skipCallback // if this pane has a resizer bar, move it NOW - before animation setAsClosed(pane); // CLOSE THE PANE if (doFX) { // animate the close lockPaneForFX(pane, true); // need to set left/top so animation will work $P.hide( o.fxName_close, o.fxSettings_close, o.fxSpeed_close, function () { lockPaneForFX(pane, false); // undo close_2(); }); } else { // hide the pane without animation $P.hide(); close_2(); }; // SUBROUTINE function close_2 () { if (s.isClosed) { // make sure pane was not 'reopened' before animation finished! bindStartSlidingEvent(pane, true); // will enable if o.slidable = true // if opposite-pane was autoClosed, see if it can be autoOpened now var altPane = _c.altSide[pane]; if (state[ altPane ].noRoom) { setSizeLimits( altPane ); makePaneFit( altPane ); } if (!skipCallback && (state.initialized || o.triggerEventsOnLoad)) { // onclose callback - UNLESS just 'showing' a hidden pane as 'closed' if (!isShowing) _execCallback(pane, o.onclose_end || o.onclose); // onhide OR onshow callback if (isShowing) _execCallback(pane, o.onshow_end || o.onshow); if (isHiding) _execCallback(pane, o.onhide_end || o.onhide); } } // execute internal flow-control callback _dequeue(pane); } } /** * @param {string} pane The pane just closed, ie: north, south, east, or west */ , setAsClosed = function (pane) { var $P = $Ps[pane] , $R = $Rs[pane] , $T = $Ts[pane] , o = options[pane] , s = state[pane] , side = _c[pane].side.toLowerCase() , inset = "inset"+ _c[pane].side , rClass = o.resizerClass , tClass = o.togglerClass , _pane = "-"+ pane // used for classNames , _open = "-open" , _sliding= "-sliding" , _closed = "-closed" ; $R .css(side, sC[inset]) // move the resizer .removeClass( rClass+_open +" "+ rClass+_pane+_open ) .removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding ) .addClass( rClass+_closed +" "+ rClass+_pane+_closed ) .unbind("dblclick."+ sID) ; // DISABLE 'resizing' when closed - do this BEFORE bindStartSlidingEvent? if (o.resizable && typeof $.fn.draggable == "function") $R .draggable("disable") .removeClass("ui-state-disabled") // do NOT apply disabled styling - not suitable here .css("cursor", "default") .attr("title","") ; // if pane has a toggler button, adjust that too if ($T) { $T .removeClass( tClass+_open +" "+ tClass+_pane+_open ) .addClass( tClass+_closed +" "+ tClass+_pane+_closed ) .attr("title", o.togglerTip_closed) // may be blank ; // toggler-content - if exists $T.children(".content-open").hide(); $T.children(".content-closed").css("display","block"); } // sync any 'pin buttons' syncPinBtns(pane, false); if (state.initialized) { // resize 'length' and position togglers for adjacent panes sizeHandles("all"); } } /** * Open the specified pane (animation optional), and resize all other panes as needed * * @param {string} pane The pane being opened, ie: north, south, east, or west * @param {boolean=} slide * @param {boolean=} noAnimation * @param {boolean=} noAlert */ , open = function (pane, slide, noAnimation, noAlert) { if (!isInitialized()) return; var $P = $Ps[pane] , $R = $Rs[pane] , $T = $Ts[pane] , o = options[pane] , s = state[pane] , doFX = !noAnimation && s.isClosed && (o.fxName_open != "none") // transfer logic var to temp var , isShowing = s.isShowing ; // now clear the logic var delete s.isShowing; if (!$P || (!o.resizable && !o.closable && !isShowing)) return; // invalid request else if (s.isVisible && !s.isSliding) return; // already open // pane can ALSO be unhidden by just calling show(), so handle this scenario if (s.isHidden && !isShowing) { show(pane, true); return; } if (_c.isLayoutBusy) { // layout is 'busy' - probably with an animation _queue("open", pane, slide); // set a callback for this action, if possible return; // ABORT } setSizeLimits(pane, slide); // update pane-state // onopen_start callback - will CANCEL hide if returns false if (false === _execCallback(pane, o.onopen_start)) return; // make sure there is enough space available to open the pane setSizeLimits(pane, slide); // update pane-state if (s.minSize > s.maxSize) { // INSUFFICIENT ROOM FOR PANE TO OPEN! syncPinBtns(pane, false); // make sure pin-buttons are reset if (!noAlert && o.noRoomToOpenTip) alert(o.noRoomToOpenTip); return; // ABORT } // SET flow-control flags _c[pane].isMoving = true; _c.isLayoutBusy = true; if (slide) // START Sliding - will set isSliding=true bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane else if (s.isSliding) // PIN PANE (stop sliding) - open pane 'normally' instead bindStopSlidingEvents(pane, false); // UNBIND trigger events - will set isSliding=false else if (o.slidable) bindStartSlidingEvent(pane, false); // UNBIND trigger events s.noRoom = false; // will be reset by makePaneFit if 'noRoom' makePaneFit(pane); s.isVisible = true; s.isClosed = false; // update isHidden BEFORE sizing panes - WHY??? Old? if (isShowing) s.isHidden = false; if (doFX) { // ANIMATE lockPaneForFX(pane, true); // need to set left/top so animation will work $P.show( o.fxName_open, o.fxSettings_open, o.fxSpeed_open, function() { lockPaneForFX(pane, false); // undo open_2(); // continue }); } else {// no animation $P.show(); // just show pane and... open_2(); // continue }; // SUBROUTINE function open_2 () { if (s.isVisible) { // make sure pane was not closed or hidden before animation finished! // cure iframe display issues _fixIframe(pane); // NOTE: if isSliding, then other panes are NOT 'resized' if (!s.isSliding) // resize all panes adjacent to this one sizeMidPanes(_c[pane].dir=="vert" ? "center" : "all", false); // false = NOT skipCallback // set classes, position handles and execute callbacks... setAsOpen(pane); } // internal flow-control callback _dequeue(pane); }; } /** * @param {string} pane The pane just opened, ie: north, south, east, or west * @param {boolean=} skipCallback */ , setAsOpen = function (pane, skipCallback) { var $P = $Ps[pane] , $R = $Rs[pane] , $T = $Ts[pane] , o = options[pane] , s = state[pane] , side = _c[pane].side.toLowerCase() , inset = "inset"+ _c[pane].side , rClass = o.resizerClass , tClass = o.togglerClass , _pane = "-"+ pane // used for classNames , _open = "-open" , _closed = "-closed" , _sliding= "-sliding" ; $R .css(side, sC[inset] + getPaneSize(pane)) // move the resizer .removeClass( rClass+_closed +" "+ rClass+_pane+_closed ) .addClass( rClass+_open +" "+ rClass+_pane+_open ) ; if (s.isSliding) $R.addClass( rClass+_sliding +" "+ rClass+_pane+_sliding ) else // in case 'was sliding' $R.removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding ) if (o.resizerDblClickToggle) $R.bind("dblclick", toggle ); removeHover( 0, $R ); // remove hover classes if (o.resizable && typeof $.fn.draggable == "function") $R .draggable("enable") .css("cursor", o.resizerCursor) .attr("title", o.resizerTip) ; else if (!s.isSliding) $R.css("cursor", "default"); // n-resize, s-resize, etc // if pane also has a toggler button, adjust that too if ($T) { $T .removeClass( tClass+_closed +" "+ tClass+_pane+_closed ) .addClass( tClass+_open +" "+ tClass+_pane+_open ) .attr("title", o.togglerTip_open) // may be blank ; removeHover( 0, $T ); // remove hover classes // toggler-content - if exists $T.children(".content-closed").hide(); $T.children(".content-open").css("display","block"); } // sync any 'pin buttons' syncPinBtns(pane, !s.isSliding); // update pane-state dimensions - BEFORE resizing content $.extend(s, elDims($P)); if (state.initialized) { // resize resizer & toggler sizes for all panes sizeHandles("all"); // resize content every time pane opens - to be sure sizeContent(pane, true); // true = remeasure headers/footers, even if 'isLayoutBusy' } if (!skipCallback && (state.initialized || o.triggerEventsOnLoad) && $P.is(":visible")) { // onopen callback _execCallback(pane, o.onopen_end || o.onopen); // onshow callback - TODO: should this be here? if (s.isShowing) _execCallback(pane, o.onshow_end || o.onshow); // ALSO call onresize because layout-size *may* have changed while pane was closed if (state.initialized) { _execCallback(pane, o.onresize_end || o.onresize); resizeNestedLayout(pane); } } } /** * slideOpen / slideClose / slideToggle * * Pass-though methods for sliding */ , slideOpen = function (evt_or_pane) { if (!isInitialized()) return; var evt = isStr(evt_or_pane) ? null : evt_or_pane , pane = evt ? $(this).data("layoutEdge") : evt_or_pane , s = state[pane] , delay = options[pane].slideDelay_open ; // prevent event from triggering on NEW resizer binding created below if (evt) evt.stopImmediatePropagation(); if (s.isClosed && evt && evt.type == "mouseenter" && delay > 0) // trigger = mouseenter - use a delay timer.set(pane+"_openSlider", open_NOW, delay); else open_NOW(); // will unbind events if is already open /** * SUBROUTINE for timed open */ function open_NOW (evt) { if (!s.isClosed) // skip if no longer closed! bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane else if (!_c[pane].isMoving) open(pane, true); // true = slide - open() will handle binding }; } , slideClose = function (evt_or_pane) { if (!isInitialized()) return; var evt = isStr(evt_or_pane) ? null : evt_or_pane , pane = evt ? $(this).data("layoutEdge") : evt_or_pane , o = options[pane] , s = state[pane] , delay = _c[pane].isMoving ? 1000 : 300 // MINIMUM delay - option may override ; if (s.isClosed || s.isResizing) return; // skip if already closed OR in process of resizing else if (o.slideTrigger_close == "click") close_NOW(); // close immediately onClick else if (o.preventQuickSlideClose && _c.isLayoutBusy) return; // handle Chrome quick-close on slide-open else if (o.preventPrematureSlideClose && evt && $.layout.isMouseOverElem(evt, $Ps[pane])) return; // handle incorrect mouseleave trigger, like when over a SELECT-list in IE else if (evt) // trigger = mouseleave - use a delay // 1 sec delay if 'opening', else .3 sec timer.set(pane+"_closeSlider", close_NOW, max(o.slideDelay_close, delay)); else // called programically close_NOW(); /** * SUBROUTINE for timed close */ function close_NOW () { if (s.isClosed) // skip 'close' if already closed! bindStopSlidingEvents(pane, false); // UNBIND trigger events - TODO: is this needed here? else if (!_c[pane].isMoving) close(pane); // close will handle unbinding }; } , slideToggle = function (pane) { toggle(pane, true); } /** * Must set left/top on East/South panes so animation will work properly * * @param {string} pane The pane to lock, 'east' or 'south' - any other is ignored! * @param {boolean} doLock true = set left/top, false = remove */ , lockPaneForFX = function (pane, doLock) { var $P = $Ps[pane]; if (doLock) { $P.css({ zIndex: _c.zIndex.pane_animate }); // overlay all elements during animation if (pane=="south") $P.css({ top: sC.insetTop + sC.innerHeight - $P.outerHeight() }); else if (pane=="east") $P.css({ left: sC.insetLeft + sC.innerWidth - $P.outerWidth() }); } else { // animation DONE - RESET CSS // TODO: see if this can be deleted. It causes a quick-close when sliding in Chrome $P.css({ zIndex: (state[pane].isSliding ? _c.zIndex.pane_sliding : _c.zIndex.pane_normal) }); if (pane=="south") $P.css({ top: "auto" }); else if (pane=="east") $P.css({ left: "auto" }); // fix anti-aliasing in IE - only needed for animations that change opacity var o = options[pane]; if ($.layout.browser.msie && o.fxOpacityFix && o.fxName_open != "slide" && $P.css("filter") && $P.css("opacity") == 1) $P[0].style.removeAttribute('filter'); } } /** * Toggle sliding functionality of a specific pane on/off by adding removing 'slide open' trigger * * @see open(), close() * @param {string} pane The pane to enable/disable, 'north', 'south', etc. * @param {boolean} enable Enable or Disable sliding? */ , bindStartSlidingEvent = function (pane, enable) { var o = options[pane] , $P = $Ps[pane] , $R = $Rs[pane] , trigger = o.slideTrigger_open.toLowerCase() ; if (!$R || (enable && !o.slidable)) return; // make sure we have a valid event if (trigger.match(/mouseover/)) trigger = o.slideTrigger_open = "mouseenter"; else if (!trigger.match(/click|dblclick|mouseenter/)) trigger = o.slideTrigger_open = "click"; $R // add or remove trigger event [enable ? "bind" : "unbind"](trigger +'.'+ sID, slideOpen) // set the appropriate cursor & title/tip .css("cursor", enable ? o.sliderCursor : "default") .attr("title", enable ? o.sliderTip : "") ; } /** * Add or remove 'mouseleave' events to 'slide close' when pane is 'sliding' open or closed * Also increases zIndex when pane is sliding open * See bindStartSlidingEvent for code to control 'slide open' * * @see slideOpen(), slideClose() * @param {string} pane The pane to process, 'north', 'south', etc. * @param {boolean} enable Enable or Disable events? */ , bindStopSlidingEvents = function (pane, enable) { var o = options[pane] , s = state[pane] , z = _c.zIndex , trigger = o.slideTrigger_close.toLowerCase() , action = (enable ? "bind" : "unbind") , $P = $Ps[pane] , $R = $Rs[pane] ; s.isSliding = enable; // logic timer.clear(pane+"_closeSlider"); // just in case // remove 'slideOpen' trigger event from resizer // ALSO will raise the zIndex of the pane & resizer if (enable) bindStartSlidingEvent(pane, false); // RE/SET zIndex - increases when pane is sliding-open, resets to normal when not $P.css("zIndex", enable ? z.pane_sliding : z.pane_normal); $R.css("zIndex", enable ? z.pane_sliding : z.resizer_normal); // make sure we have a valid event if (!trigger.match(/click|mouseleave/)) trigger = o.slideTrigger_close = "mouseleave"; // also catches 'mouseout' // add/remove slide triggers $R[action](trigger, slideClose); // base event on resize // need extra events for mouseleave if (trigger == "mouseleave") { // also close on pane.mouseleave $P[action]("mouseleave."+ sID, slideClose); // cancel timer when mouse moves between 'pane' and 'resizer' $R[action]("mouseenter."+ sID, cancelMouseOut); $P[action]("mouseenter."+ sID, cancelMouseOut); } if (!enable) timer.clear(pane+"_closeSlider"); else if (trigger == "click" && !o.resizable) { // IF pane is not resizable (which already has a cursor and tip) // then set the a cursor & title/tip on resizer when sliding $R.css("cursor", enable ? o.sliderCursor : "default"); $R.attr("title", enable ? o.togglerTip_open : ""); // use Toggler-tip, eg: "Close Pane" } // SUBROUTINE for mouseleave timer clearing function cancelMouseOut (evt) { timer.clear(pane+"_closeSlider"); evt.stopPropagation(); } } /** * Hides/closes a pane if there is insufficient room - reverses this when there is room again * MUST have already called setSizeLimits() before calling this method * * @param {string} pane The pane being resized * @param {boolean=} isOpening Called from onOpen? * @param {boolean=} skipCallback Should the onresize callback be run? * @param {boolean=} force */ , makePaneFit = function (pane, isOpening, skipCallback, force) { var o = options[pane] , s = state[pane] , c = _c[pane] , $P = $Ps[pane] , $R = $Rs[pane] , isSidePane = c.dir=="vert" , hasRoom = false ; // special handling for center & east/west panes if (pane == "center" || (isSidePane && s.noVerticalRoom)) { // see if there is enough room to display the pane // ERROR: hasRoom = s.minHeight <= s.maxHeight && (isSidePane || s.minWidth <= s.maxWidth); hasRoom = (s.maxHeight > 0); if (hasRoom && s.noRoom) { // previously hidden due to noRoom, so show now $P.show(); if ($R) $R.show(); s.isVisible = true; s.noRoom = false; if (isSidePane) s.noVerticalRoom = false; _fixIframe(pane); } else if (!hasRoom && !s.noRoom) { // not currently hidden, so hide now $P.hide(); if ($R) $R.hide(); s.isVisible = false; s.noRoom = true; } } // see if there is enough room to fit the border-pane if (pane == "center") { // ignore center in this block } else if (s.minSize <= s.maxSize) { // pane CAN fit hasRoom = true; if (s.size > s.maxSize) // pane is too big - shrink it sizePane(pane, s.maxSize, skipCallback, force); else if (s.size < s.minSize) // pane is too small - enlarge it sizePane(pane, s.minSize, skipCallback, force); else if ($R && $P.is(":visible")) { // make sure resizer-bar is positioned correctly // handles situation where nested layout was 'hidden' when initialized var side = c.side.toLowerCase() , pos = s.size + sC["inset"+ c.side] ; if ($.layout.cssNum($R, side) != pos) $R.css( side, pos ); } // if was previously hidden due to noRoom, then RESET because NOW there is room if (s.noRoom) { // s.noRoom state will be set by open or show if (s.wasOpen && o.closable) { if (o.autoReopen) open(pane, false, true, true); // true = noAnimation, true = noAlert else // leave the pane closed, so just update state s.noRoom = false; } else show(pane, s.wasOpen, true, true); // true = noAnimation, true = noAlert } } else { // !hasRoom - pane CANNOT fit if (!s.noRoom) { // pane not set as noRoom yet, so hide or close it now... s.noRoom = true; // update state s.wasOpen = !s.isClosed && !s.isSliding; if (s.isClosed){} // SKIP else if (o.closable) // 'close' if possible close(pane, true, true); // true = force, true = noAnimation else // 'hide' pane if cannot just be closed hide(pane, true); // true = noAnimation } } } /** * sizePane / manualSizePane * sizePane is called only by internal methods whenever a pane needs to be resized * manualSizePane is an exposed flow-through method allowing extra code when pane is 'manually resized' * * @param {string} pane The pane being resized * @param {number} size The *desired* new size for this pane - will be validated * @param {boolean=} skipCallback Should the onresize callback be run? */ , manualSizePane = function (pane, size, skipCallback) { if (!isInitialized()) return; // ANY call to sizePane will disabled autoResize var o = options[pane] // if resizing callbacks have been delayed and resizing is now DONE, force resizing to complete... , forceResize = o.resizeWhileDragging && !_c.isLayoutBusy // && !o.triggerEventsWhileDragging ; o.autoResize = false; // flow-through... sizePane(pane, size, skipCallback, forceResize); } /** * @param {string} pane The pane being resized * @param {number} size The *desired* new size for this pane - will be validated * @param {boolean=} skipCallback Should the onresize callback be run? * @param {boolean=} force Force resizing even if does not seem necessary */ , sizePane = function (pane, size, skipCallback, force) { if (!isInitialized()) return; var o = options[pane] , s = state[pane] , $P = $Ps[pane] , $R = $Rs[pane] , side = _c[pane].side.toLowerCase() , dimName = _c[pane].sizeType.toLowerCase() , inset = "inset"+ _c[pane].side , skipResizeWhileDragging = _c.isLayoutBusy && !o.triggerEventsWhileDragging , oldSize ; // calculate 'current' min/max sizes setSizeLimits(pane); // update pane-state oldSize = s.size; size = _parseSize(pane, size); // handle percentages & auto size = max(size, _parseSize(pane, o.minSize)); size = min(size, s.maxSize); if (size < s.minSize) { // not enough room for pane! makePaneFit(pane, false, skipCallback); // will hide or close pane return; } // IF newSize is same as oldSize, then nothing to do - abort if (!force && size == oldSize) return; // onresize_start callback CANNOT cancel resizing because this would break the layout! if (!skipCallback && state.initialized && s.isVisible) _execCallback(pane, o.onresize_start); // resize the pane, and make sure its visible $P.css( dimName, max(1, cssSize(pane, size)) ); /* var edge = _c[pane].sizeType.toLowerCase() , test = [{ target: size , attempt: size , actual: edge=='width' ? $P.outerWidth() : $P.outerHeight() }] , lastTest = test[0] , thisTest = {} ; while (lastTest.actual != size) { test.push( {} ); thisTest = test[ test.length - 1 ]; if (lastTest.actual > size) thisTest.attempt = Math.max(1, lastTest.attempt - (lastTest.actual - size)); else // lastTest.actual < size thisTest.attempt = Math.max(1, lastTest.attempt + (size - lastTest.actual)); $P.css( edge, cssSize(pane, thisTest.attempt) ); thisTest.actual = edge=='width' ? $P.outerWidth() : $P.outerHeight() // after 3 tries, is as close as its gonna get! if (test.length == 3) break; else lastTest = thisTest; } debugData( test, pane ); */ // update pane-state dimensions s.size = size; $.extend(s, elDims($P)); // reposition the resizer-bar if ($R && $P.is(":visible")) $R.css( side, size + sC[inset] ); sizeContent(pane); if (!skipCallback && !skipResizeWhileDragging && state.initialized && s.isVisible) { _execCallback(pane, o.onresize_end || o.onresize); resizeNestedLayout(pane); } // resize all the adjacent panes, and adjust their toggler buttons // when skipCallback passed, it means the controlling method will handle 'other panes' if (!skipCallback) { // also no callback if live-resize is in progress and NOT triggerEventsWhileDragging if (!s.isSliding) sizeMidPanes(_c[pane].dir=="horz" ? "all" : "center", skipResizeWhileDragging, force); sizeHandles("all"); } // if opposite-pane was autoClosed, see if it can be autoOpened now var altPane = _c.altSide[pane]; if (size < oldSize && state[ altPane ].noRoom) { setSizeLimits( altPane ); makePaneFit( altPane, false, skipCallback ); } } /** * @see initPanes(), sizePane(), resizeAll(), open(), close(), hide() * @param {string} panes The pane(s) being resized, comma-delmited string * @param {boolean=} skipCallback Should the onresize callback be run? * @param {boolean=} force */ , sizeMidPanes = function (panes, skipCallback, force) { if (!panes || panes == "all") panes = "east,west,center"; $.each(panes.split(","), function (i, pane) { if (!$Ps[pane]) return; // NO PANE - skip var o = options[pane] , s = state[pane] , $P = $Ps[pane] , $R = $Rs[pane] , isCenter= (pane=="center") , hasRoom = true , CSS = {} , newCenter = calcNewCenterPaneDims() ; // update pane-state dimensions $.extend(s, elDims($P)); if (pane == "center") { if (!force && s.isVisible && newCenter.width == s.outerWidth && newCenter.height == s.outerHeight) return true; // SKIP - pane already the correct size // set state for makePaneFit() logic $.extend(s, cssMinDims(pane), { maxWidth: newCenter.width , maxHeight: newCenter.height }); CSS = newCenter; // convert OUTER width/height to CSS width/height CSS.width = cssW(pane, CSS.width); CSS.height = cssH(pane, CSS.height); hasRoom = CSS.width > 0 && CSS.height > 0; // during layout init, try to shrink east/west panes to make room for center if (!hasRoom && !state.initialized && o.minWidth > 0) { var reqPx = o.minWidth - s.outerWidth , minE = options.east.minSize || 0 , minW = options.west.minSize || 0 , sizeE = state.east.size , sizeW = state.west.size , newE = sizeE , newW = sizeW ; if (reqPx > 0 && state.east.isVisible && sizeE > minE) { newE = max( sizeE-minE, sizeE-reqPx ); reqPx -= sizeE-newE; } if (reqPx > 0 && state.west.isVisible && sizeW > minW) { newW = max( sizeW-minW, sizeW-reqPx ); reqPx -= sizeW-newW; } // IF we found enough extra space, then resize the border panes as calculated if (reqPx == 0) { if (sizeE != minE) sizePane('east', newE, true); // true = skipCallback - initPanes will handle when done if (sizeW != minW) sizePane('west', newW, true); // now start over! sizeMidPanes('center', skipCallback, force); return; // abort this loop } } } else { // for east and west, set only the height, which is same as center height // set state.min/maxWidth/Height for makePaneFit() logic if (s.isVisible && !s.noVerticalRoom) $.extend(s, elDims($P), cssMinDims(pane)) if (!force && !s.noVerticalRoom && newCenter.height == s.outerHeight) return true; // SKIP - pane already the correct size // east/west have same top, bottom & height as center CSS.top = newCenter.top; CSS.bottom = newCenter.bottom; CSS.height = cssH(pane, newCenter.height); s.maxHeight = max(0, CSS.height); hasRoom = (s.maxHeight > 0); if (!hasRoom) s.noVerticalRoom = true; // makePaneFit() logic } if (hasRoom) { // resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized if (!skipCallback && state.initialized) _execCallback(pane, o.onresize_start); $P.css(CSS); // apply the CSS to pane if (s.noRoom && !s.isClosed && !s.isHidden) makePaneFit(pane); // will re-open/show auto-closed/hidden pane if (s.isVisible) { $.extend(s, elDims($P)); // update pane dimensions if (state.initialized) sizeContent(pane); // also resize the contents, if exists } } else if (!s.noRoom && s.isVisible) // no room for pane makePaneFit(pane); // will hide or close pane if (!s.isVisible) return true; // DONE - next pane /* * Extra CSS for IE6 or IE7 in Quirks-mode - add 'width' to NORTH/SOUTH panes * Normally these panes have only 'left' & 'right' positions so pane auto-sizes * ALSO required when pane is an IFRAME because will NOT default to 'full width' */ if (pane == "center") { // finished processing midPanes var b = $.layout.browser; var fix = b.isIE6 || (b.msie && !b.boxModel); if ($Ps.north && (fix || state.north.tagName=="IFRAME")) $Ps.north.css("width", cssW($Ps.north, sC.innerWidth)); if ($Ps.south && (fix || state.south.tagName=="IFRAME")) $Ps.south.css("width", cssW($Ps.south, sC.innerWidth)); } // resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized if (!skipCallback && state.initialized) { _execCallback(pane, o.onresize_end || o.onresize); resizeNestedLayout(pane); } }); } /** * @see window.onresize(), callbacks or custom code */ , resizeAll = function () { if (!state.initialized) { _initLayoutElements(); return; // no need to resize since we just initialized! } var oldW = sC.innerWidth , oldH = sC.innerHeight ; // cannot size layout when 'container' is hidden or collapsed if (!$N.is(":visible:") ) return; $.extend( state.container, elDims( $N ) ); // UPDATE container dimensions if (!sC.outerHeight) return; // onresizeall_start will CANCEL resizing if returns false // state.container has already been set, so user can access this info for calcuations if (false === _execCallback(null, options.onresizeall_start)) return false; var // see if container is now 'smaller' than before shrunkH = (sC.innerHeight < oldH) , shrunkW = (sC.innerWidth < oldW) , $P, o, s, dir ; // NOTE special order for sizing: S-N-E-W $.each(["south","north","east","west"], function (i, pane) { if (!$Ps[pane]) return; // no pane - SKIP s = state[pane]; o = options[pane]; dir = _c[pane].dir; if (o.autoResize && s.size != o.size) // resize pane to original size set in options sizePane(pane, o.size, true, true); // true=skipCallback, true=forceResize else { setSizeLimits(pane); makePaneFit(pane, false, true, true); // true=skipCallback, true=forceResize } }); sizeMidPanes("all", true, true); // true=skipCallback, true=forceResize sizeHandles("all"); // reposition the toggler elements // trigger all individual pane callbacks AFTER layout has finished resizing o = options; // reuse alias $.each(_c.allPanes.split(","), function (i, pane) { $P = $Ps[pane]; if (!$P) return; // SKIP if (state[pane].isVisible) { // undefined for non-existent panes _execCallback(pane, o[pane].onresize_end || o[pane].onresize); // callback - if exists resizeNestedLayout(pane); } }); _execCallback(null, o.onresizeall_end || o.onresizeall); // onresizeall callback, if exists } /** * Whenever a pane resizes or opens that has a nested layout, trigger resizeAll * * @param {string} pane The pane just resized or opened */ , resizeNestedLayout = function (pane) { var $P = $Ps[pane] , $C = $Cs[pane] , d = "layoutContainer" ; if (options[pane].resizeNestedLayout) { if ($P.data( d )) $P.layout().resizeAll(); else if ($C && $C.data( d )) $C.layout().resizeAll(); } } /** * IF pane has a content-div, then resize all elements inside pane to fit pane-height * * @param {string=} panes The pane(s) being resized * @param {boolean=} remeasure Should the content (header/footer) be remeasured? */ , sizeContent = function (panes, remeasure) { if (!isInitialized()) return; if (!panes || panes == "all") panes = _c.allPanes; $.each(panes.split(","), function (idx, pane) { var $P = $Ps[pane] , $C = $Cs[pane] , o = options[pane] , s = state[pane] , m = s.content // m = measurements ; if (!$P || !$C || !$P.is(":visible")) return true; // NOT VISIBLE - skip // onsizecontent_start will CANCEL resizing if returns false if (false === _execCallback(null, o.onsizecontent_start)) return; // skip re-measuring offsets if live-resizing if (!_c.isLayoutBusy || m.top == undefined || remeasure || o.resizeContentWhileDragging) { _measure(); // if any footers are below pane-bottom, they may not measure correctly, // so allow pane overflow and re-measure if (m.hiddenFooters > 0 && $P.css("overflow") == "hidden") { $P.css("overflow", "visible"); _measure(); // remeasure while overflowing $P.css("overflow", "hidden"); } } // NOTE: spaceAbove/Below *includes* the pane paddingTop/Bottom, but not pane.borders var newH = s.innerHeight - (m.spaceAbove - s.css.paddingTop) - (m.spaceBelow - s.css.paddingBottom); if (!$C.is(":visible") || m.height != newH) { // size the Content element to fit new pane-size - will autoHide if not enough room setOuterHeight($C, newH, true); // true=autoHide m.height = newH; // save new height }; if (state.initialized) { _execCallback(pane, o.onsizecontent_end || o.onsizecontent); resizeNestedLayout(pane); } function _below ($E) { return max(s.css.paddingBottom, (parseInt($E.css("marginBottom"), 10) || 0)); }; function _measure () { var ignore = options[pane].contentIgnoreSelector , $Fs = $C.nextAll().not(ignore || ':lt(0)') // not :lt(0) = ALL , $Fs_vis = $Fs.filter(':visible') , $F = $Fs_vis.filter(':last') ; m = { top: $C[0].offsetTop , height: $C.outerHeight() , numFooters: $Fs.length , hiddenFooters: $Fs.length - $Fs_vis.length , spaceBelow: 0 // correct if no content footer ($E) } m.spaceAbove = m.top; // just for state - not used in calc m.bottom = m.top + m.height; if ($F.length) //spaceBelow = (LastFooter.top + LastFooter.height) [footerBottom] - Content.bottom + max(LastFooter.marginBottom, pane.paddingBotom) m.spaceBelow = ($F[0].offsetTop + $F.outerHeight()) - m.bottom + _below($F); else // no footer - check marginBottom on Content element itself m.spaceBelow = _below($C); }; }); } /** * Called every time a pane is opened, closed, or resized to slide the togglers to 'center' and adjust their length if necessary * * @see initHandles(), open(), close(), resizeAll() * @param {string=} panes The pane(s) being resized */ , sizeHandles = function (panes) { if (!panes || panes == "all") panes = _c.borderPanes; $.each(panes.split(","), function (i, pane) { var o = options[pane] , s = state[pane] , $P = $Ps[pane] , $R = $Rs[pane] , $T = $Ts[pane] , $TC ; if (!$P || !$R) return; var dir = _c[pane].dir , _state = (s.isClosed ? "_closed" : "_open") , spacing = o["spacing"+ _state] , togAlign = o["togglerAlign"+ _state] , togLen = o["togglerLength"+ _state] , paneLen , offset , CSS = {} ; if (spacing == 0) { $R.hide(); return; } else if (!s.noRoom && !s.isHidden) // skip if resizer was hidden for any reason $R.show(); // in case was previously hidden // Resizer Bar is ALWAYS same width/height of pane it is attached to if (dir == "horz") { // north/south paneLen = $P.outerWidth(); // s.outerWidth || s.resizerLength = paneLen; $R.css({ width: max(1, cssW($R, paneLen)) // account for borders & padding , height: max(0, cssH($R, spacing)) // ditto , left: $.layout.cssNum($P, "left") }); } else { // east/west paneLen = $P.outerHeight(); // s.outerHeight || s.resizerLength = paneLen; $R.css({ height: max(1, cssH($R, paneLen)) // account for borders & padding , width: max(0, cssW($R, spacing)) // ditto , top: sC.insetTop + getPaneSize("north", true) // TODO: what if no North pane? //, top: $.layout.cssNum($Ps["center"], "top") }); } // remove hover classes removeHover( o, $R ); if ($T) { if (togLen == 0 || (s.isSliding && o.hideTogglerOnSlide)) { $T.hide(); // always HIDE the toggler when 'sliding' return; } else $T.show(); // in case was previously hidden if (!(togLen > 0) || togLen == "100%" || togLen > paneLen) { togLen = paneLen; offset = 0; } else { // calculate 'offset' based on options.PANE.togglerAlign_open/closed if (isStr(togAlign)) { switch (togAlign) { case "top": case "left": offset = 0; break; case "bottom": case "right": offset = paneLen - togLen; break; case "middle": case "center": default: offset = Math.floor((paneLen - togLen) / 2); // 'default' catches typos } } else { // togAlign = number var x = parseInt(togAlign, 10); // if (togAlign >= 0) offset = x; else offset = paneLen - togLen + x; // NOTE: x is negative! } } if (dir == "horz") { // north/south var width = cssW($T, togLen); $T.css({ width: max(0, width) // account for borders & padding , height: max(1, cssH($T, spacing)) // ditto , left: offset // TODO: VERIFY that toggler positions correctly for ALL values , top: 0 }); // CENTER the toggler content SPAN $T.children(".content").each(function(){ $TC = $(this); $TC.css("marginLeft", Math.floor((width-$TC.outerWidth())/2)); // could be negative }); } else { // east/west var height = cssH($T, togLen); $T.css({ height: max(0, height) // account for borders & padding , width: max(1, cssW($T, spacing)) // ditto , top: offset // POSITION the toggler , left: 0 }); // CENTER the toggler content SPAN $T.children(".content").each(function(){ $TC = $(this); $TC.css("marginTop", Math.floor((height-$TC.outerHeight())/2)); // could be negative }); } // remove ALL hover classes removeHover( 0, $T ); } // DONE measuring and sizing this resizer/toggler, so can be 'hidden' now if (!state.initialized && (o.initHidden || s.noRoom)) { $R.hide(); if ($T) $T.hide(); } }); } , enableClosable = function (pane) { if (!isInitialized()) return; var $T = $Ts[pane], o = options[pane]; if (!$T) return; o.closable = true; $T .bind("click."+ sID, function(evt){ evt.stopPropagation(); toggle(pane); }) .bind("mouseenter."+ sID, addHover) .bind("mouseleave."+ sID, removeHover) .css("visibility", "visible") .css("cursor", "pointer") .attr("title", state[pane].isClosed ? o.togglerTip_closed : o.togglerTip_open) // may be blank .show() ; } , disableClosable = function (pane, hide) { if (!isInitialized()) return; var $T = $Ts[pane]; if (!$T) return; options[pane].closable = false; // is closable is disable, then pane MUST be open! if (state[pane].isClosed) open(pane, false, true); $T .unbind("."+ sID) .css("visibility", hide ? "hidden" : "visible") // instead of hide(), which creates logic issues .css("cursor", "default") .attr("title", "") ; } , enableSlidable = function (pane) { if (!isInitialized()) return; var $R = $Rs[pane], o = options[pane]; if (!$R || !$R.data('draggable')) return; options[pane].slidable = true; if (s.isClosed) bindStartSlidingEvent(pane, true); } , disableSlidable = function (pane) { if (!isInitialized()) return; var $R = $Rs[pane]; if (!$R) return; options[pane].slidable = false; if (state[pane].isSliding) close(pane, false, true); else { bindStartSlidingEvent(pane, false); $R .css("cursor", "default") .attr("title", "") ; removeHover(null, $R[0]); // in case currently hovered } } , enableResizable = function (pane) { if (!isInitialized()) return; var $R = $Rs[pane], o = options[pane]; if (!$R || !$R.data('draggable')) return; o.resizable = true; $R .draggable("enable") .bind("mouseenter."+ sID, onResizerEnter) .bind("mouseleave."+ sID, onResizerLeave) ; if (!state[pane].isClosed) $R .css("cursor", o.resizerCursor) .attr("title", o.resizerTip) ; } , disableResizable = function (pane) { if (!isInitialized()) return; var $R = $Rs[pane]; if (!$R || !$R.data('draggable')) return; options[pane].resizable = false; $R .draggable("disable") .unbind("."+ sID) .css("cursor", "default") .attr("title", "") ; removeHover(null, $R[0]); // in case currently hovered } /** * Move a pane from source-side (eg, west) to target-side (eg, east) * If pane exists on target-side, move that to source-side, ie, 'swap' the panes * * @param {string} pane1 The pane/edge being swapped * @param {string} pane2 ditto */ , swapPanes = function (pane1, pane2) { if (!isInitialized()) return; // change state.edge NOW so callbacks can know where pane is headed... state[pane1].edge = pane2; state[pane2].edge = pane1; // run these even if NOT state.initialized var cancelled = false; if (false === _execCallback(pane1, options[pane1].onswap_start)) cancelled = true; if (!cancelled && false === _execCallback(pane2, options[pane2].onswap_start)) cancelled = true; if (cancelled) { state[pane1].edge = pane1; // reset state[pane2].edge = pane2; return; } var oPane1 = copy( pane1 ) , oPane2 = copy( pane2 ) , sizes = {} ; sizes[pane1] = oPane1 ? oPane1.state.size : 0; sizes[pane2] = oPane2 ? oPane2.state.size : 0; // clear pointers & state $Ps[pane1] = false; $Ps[pane2] = false; state[pane1] = {}; state[pane2] = {}; // ALWAYS remove the resizer & toggler elements if ($Ts[pane1]) $Ts[pane1].remove(); if ($Ts[pane2]) $Ts[pane2].remove(); if ($Rs[pane1]) $Rs[pane1].remove(); if ($Rs[pane2]) $Rs[pane2].remove(); $Rs[pane1] = $Rs[pane2] = $Ts[pane1] = $Ts[pane2] = false; // transfer element pointers and data to NEW Layout keys move( oPane1, pane2 ); move( oPane2, pane1 ); // cleanup objects oPane1 = oPane2 = sizes = null; // make panes 'visible' again if ($Ps[pane1]) $Ps[pane1].css(_c.visible); if ($Ps[pane2]) $Ps[pane2].css(_c.visible); // fix any size discrepancies caused by swap resizeAll(); // run these even if NOT state.initialized _execCallback(pane1, options[pane1].onswap_end || options[pane1].onswap); _execCallback(pane2, options[pane2].onswap_end || options[pane2].onswap); return; function copy (n) { // n = pane var $P = $Ps[n] , $C = $Cs[n] ; return !$P ? false : { pane: n , P: $P ? $P[0] : false , C: $C ? $C[0] : false , state: $.extend({}, state[n]) , options: $.extend({}, options[n]) } }; function move (oPane, pane) { if (!oPane) return; var P = oPane.P , C = oPane.C , oldPane = oPane.pane , c = _c[pane] , side = c.side.toLowerCase() , inset = "inset"+ c.side // save pane-options that should be retained , s = $.extend({}, state[pane]) , o = options[pane] // RETAIN side-specific FX Settings - more below , fx = { resizerCursor: o.resizerCursor } , re, size, pos ; $.each("fxName,fxSpeed,fxSettings".split(","), function (i, k) { fx[k] = o[k]; fx[k +"_open"] = o[k +"_open"]; fx[k +"_close"] = o[k +"_close"]; }); // update object pointers and attributes $Ps[pane] = $(P) .data("layoutEdge", pane) .css(_c.hidden) .css(c.cssReq) ; $Cs[pane] = C ? $(C) : false; // set options and state options[pane] = $.extend({}, oPane.options, fx); state[pane] = $.extend({}, oPane.state); // change classNames on the pane, eg: ui-layout-pane-east ==> ui-layout-pane-west re = new RegExp(o.paneClass +"-"+ oldPane, "g"); P.className = P.className.replace(re, o.paneClass +"-"+ pane); // ALWAYS regenerate the resizer & toggler elements initHandles(pane); // create the required resizer & toggler // if moving to different orientation, then keep 'target' pane size if (c.dir != _c[oldPane].dir) { size = sizes[pane] || 0; setSizeLimits(pane); // update pane-state size = max(size, state[pane].minSize); // use manualSizePane to disable autoResize - not useful after panes are swapped manualSizePane(pane, size, true); // true = skipCallback } else // move the resizer here $Rs[pane].css(side, sC[inset] + (state[pane].isVisible ? getPaneSize(pane) : 0)); // ADD CLASSNAMES & SLIDE-BINDINGS if (oPane.state.isVisible && !s.isVisible) setAsOpen(pane, true); // true = skipCallback else { setAsClosed(pane); bindStartSlidingEvent(pane, true); // will enable events IF option is set } // DESTROY the object oPane = null; }; } ; // END var DECLARATIONS /** * Capture keys when enableCursorHotkey - toggle pane if hotkey pressed * * @see document.keydown() */ function keyDown (evt) { if (!evt) return true; var code = evt.keyCode; if (code < 33) return true; // ignore special keys: ENTER, TAB, etc var PANE = { 38: "north" // Up Cursor - $.ui.keyCode.UP , 40: "south" // Down Cursor - $.ui.keyCode.DOWN , 37: "west" // Left Cursor - $.ui.keyCode.LEFT , 39: "east" // Right Cursor - $.ui.keyCode.RIGHT } , ALT = evt.altKey // no worky! , SHIFT = evt.shiftKey , CTRL = evt.ctrlKey , CURSOR = (CTRL && code >= 37 && code <= 40) , o, k, m, pane ; if (CURSOR && options[PANE[code]].enableCursorHotkey) // valid cursor-hotkey pane = PANE[code]; else if (CTRL || SHIFT) // check to see if this matches a custom-hotkey $.each(_c.borderPanes.split(","), function (i, p) { // loop each pane to check its hotkey o = options[p]; k = o.customHotkey; m = o.customHotkeyModifier; // if missing or invalid, treated as "CTRL+SHIFT" if ((SHIFT && m=="SHIFT") || (CTRL && m=="CTRL") || (CTRL && SHIFT)) { // Modifier matches if (k && code == (isNaN(k) || k <= 9 ? k.toUpperCase().charCodeAt(0) : k)) { // Key matches pane = p; return false; // BREAK } } }); // validate pane if (!pane || !$Ps[pane] || !options[pane].closable || state[pane].isHidden) return true; toggle(pane); evt.stopPropagation(); evt.returnValue = false; // CANCEL key return false; }; /* * ###################################### * UTILITY METHODS * called externally or by initButtons * ###################################### */ /** * Change/reset a pane overflow setting & zIndex to allow popups/drop-downs to work * * @param {Object=} el (optional) Can also be 'bound' to a click, mouseOver, or other event */ function allowOverflow (el) { if (!isInitialized()) return; if (this && this.tagName) el = this; // BOUND to element var $P; if (isStr(el)) $P = $Ps[el]; else if ($(el).data("layoutRole")) $P = $(el); else $(el).parents().each(function(){ if ($(this).data("layoutRole")) { $P = $(this); return false; // BREAK } }); if (!$P || !$P.length) return; // INVALID var pane = $P.data("layoutEdge") , s = state[pane] ; // if pane is already raised, then reset it before doing it again! // this would happen if allowOverflow is attached to BOTH the pane and an element if (s.cssSaved) resetOverflow(pane); // reset previous CSS before continuing // if pane is raised by sliding or resizing, or its closed, then abort if (s.isSliding || s.isResizing || s.isClosed) { s.cssSaved = false; return; } var newCSS = { zIndex: (_c.zIndex.pane_normal + 2) } , curCSS = {} , of = $P.css("overflow") , ofX = $P.css("overflowX") , ofY = $P.css("overflowY") ; // determine which, if any, overflow settings need to be changed if (of != "visible") { curCSS.overflow = of; newCSS.overflow = "visible"; } if (ofX && !ofX.match(/visible|auto/)) { curCSS.overflowX = ofX; newCSS.overflowX = "visible"; } if (ofY && !ofY.match(/visible|auto/)) { curCSS.overflowY = ofX; newCSS.overflowY = "visible"; } // save the current overflow settings - even if blank! s.cssSaved = curCSS; // apply new CSS to raise zIndex and, if necessary, make overflow 'visible' $P.css( newCSS ); // make sure the zIndex of all other panes is normal $.each(_c.allPanes.split(","), function(i, p) { if (p != pane) resetOverflow(p); }); }; function resetOverflow (el) { if (!isInitialized()) return; if (this && this.tagName) el = this; // BOUND to element var $P; if (isStr(el)) $P = $Ps[el]; else if ($(el).data("layoutRole")) $P = $(el); else $(el).parents().each(function(){ if ($(this).data("layoutRole")) { $P = $(this); return false; // BREAK } }); if (!$P || !$P.length) return; // INVALID var pane = $P.data("layoutEdge") , s = state[pane] , CSS = s.cssSaved || {} ; // reset the zIndex if (!s.isSliding && !s.isResizing) $P.css("zIndex", _c.zIndex.pane_normal); // reset Overflow - if necessary $P.css( CSS ); // clear var s.cssSaved = false; }; /** * Helper function to validate params received by addButton utilities * * Two classes are added to the element, based on the buttonClass... * The type of button is appended to create the 2nd className: * - ui-layout-button-pin * - ui-layout-pane-button-toggle * - ui-layout-pane-button-open * - ui-layout-pane-button-close * * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" * @param {string} pane Name of the pane the button is for: 'north', 'south', etc. * @return {Array.<Object>} If both params valid, the element matching 'selector' in a jQuery wrapper - otherwise returns null */ function getBtn (selector, pane, action) { var $E = $(selector) , err = options.showErrorMessages; if (!$E.length) { // element not found if (err) alert(lang.errButton + lang.selector +": "+ selector); } else if (_c.borderPanes.indexOf(pane) == -1) // invalid 'pane' sepecified if (err) alert(lang.errButton + lang.pane +": "+ pane); else { // VALID var btn = options[pane].buttonClass +"-"+ action; $E .addClass( btn +" "+ btn +"-"+ pane ) .data("layoutName", options.name) // add layout identifier - even if blank! ; return $E; } return null; // INVALID }; /** * NEW syntax for binding layout-buttons - will eventually replace addToggleBtn, addOpenBtn, etc. * * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" * @param {string} action * @param {string} pane */ function bindButton (selector, action, pane) { switch (action.toLowerCase()) { case "toggle": addToggleBtn(selector, pane); break; case "open": addOpenBtn(selector, pane); break; case "close": addCloseBtn(selector, pane); break; case "pin": addPinBtn(selector, pane); break; case "toggle-slide": addToggleBtn(selector, pane, true); break; case "open-slide": addOpenBtn(selector, pane, true); break; } }; /** * Add a custom Toggler button for a pane * * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" * @param {string} pane Name of the pane the button is for: 'north', 'south', etc. * @param {boolean=} slide true = slide-open, false = pin-open */ function addToggleBtn (selector, pane, slide) { var $E = getBtn(selector, pane, "toggle"); if ($E) $E.click(function (evt) { toggle(pane, !!slide); evt.stopPropagation(); }); }; /** * Add a custom Open button for a pane * * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" * @param {string} pane Name of the pane the button is for: 'north', 'south', etc. * @param {boolean=} slide true = slide-open, false = pin-open */ function addOpenBtn (selector, pane, slide) { var $E = getBtn(selector, pane, "open"); if ($E) $E .attr("title", lang.Open) .click(function (evt) { open(pane, !!slide); evt.stopPropagation(); }) ; }; /** * Add a custom Close button for a pane * * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" * @param {string} pane Name of the pane the button is for: 'north', 'south', etc. */ function addCloseBtn (selector, pane) { var $E = getBtn(selector, pane, "close"); if ($E) $E .attr("title", lang.Close) .click(function (evt) { close(pane); evt.stopPropagation(); }) ; }; /** * addPinBtn * * Add a custom Pin button for a pane * * Four classes are added to the element, based on the paneClass for the associated pane... * Assuming the default paneClass and the pin is 'up', these classes are added for a west-pane pin: * - ui-layout-pane-pin * - ui-layout-pane-west-pin * - ui-layout-pane-pin-up * - ui-layout-pane-west-pin-up * * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" * @param {string} pane Name of the pane the pin is for: 'north', 'south', etc. */ function addPinBtn (selector, pane) { var $E = getBtn(selector, pane, "pin"); if ($E) { var s = state[pane]; $E.click(function (evt) { setPinState($(this), pane, (s.isSliding || s.isClosed)); if (s.isSliding || s.isClosed) open( pane ); // change from sliding to open else close( pane ); // slide-closed evt.stopPropagation(); }); // add up/down pin attributes and classes setPinState($E, pane, (!s.isClosed && !s.isSliding)); // add this pin to the pane data so we can 'sync it' automatically // PANE.pins key is an array so we can store multiple pins for each pane _c[pane].pins.push( selector ); // just save the selector string } }; /** * INTERNAL function to sync 'pin buttons' when pane is opened or closed * Unpinned means the pane is 'sliding' - ie, over-top of the adjacent panes * * @see open(), close() * @param {string} pane These are the params returned to callbacks by layout() * @param {boolean} doPin True means set the pin 'down', False means 'up' */ function syncPinBtns (pane, doPin) { $.each(_c[pane].pins, function (i, selector) { setPinState($(selector), pane, doPin); }); }; /** * Change the class of the pin button to make it look 'up' or 'down' * * @see addPinBtn(), syncPinBtns() * @param {Array.<Object>} $Pin The pin-span element in a jQuery wrapper * @param {string} pane These are the params returned to callbacks by layout() * @param {boolean} doPin true = set the pin 'down', false = set it 'up' */ function setPinState ($Pin, pane, doPin) { var updown = $Pin.attr("pin"); if (updown && doPin == (updown=="down")) return; // already in correct state var pin = options[pane].buttonClass +"-pin" , side = pin +"-"+ pane , UP = pin +"-up "+ side +"-up" , DN = pin +"-down "+side +"-down" ; $Pin .attr("pin", doPin ? "down" : "up") // logic .attr("title", doPin ? lang.Unpin : lang.Pin) .removeClass( doPin ? UP : DN ) .addClass( doPin ? DN : UP ) ; }; /* * LAYOUT STATE MANAGEMENT * * @example .layout({ cookie: { name: "myLayout", keys: "west.isClosed,east.isClosed" } }) * @example .layout({ cookie__name: "myLayout", cookie__keys: "west.isClosed,east.isClosed" }) * @example myLayout.getState( "west.isClosed,north.size,south.isHidden" ); * @example myLayout.saveCookie( "west.isClosed,north.size,south.isHidden", {expires: 7} ); * @example myLayout.deleteCookie(); * @example myLayout.loadCookie(); * @example var hSaved = myLayout.state.cookie; */ function isCookiesEnabled () { // TODO: is the cookieEnabled property common enough to be useful??? return (navigator.cookieEnabled != 0); }; /** * Read & return data from the cookie - as JSON * * @param {Object=} opts */ function getCookie (opts) { var o = $.extend( {}, options.cookie, opts || {} ) , name = o.name || options.name || "Layout" , c = document.cookie , cs = c ? c.split(';') : [] , pair // loop var ; for (var i=0, n=cs.length; i < n; i++) { pair = $.trim(cs[i]).split('='); // name=value pair if (pair[0] == name) // found the layout cookie // convert cookie string back to a hash return decodeJSON( decodeURIComponent(pair[1]) ); } return ""; }; /** * Get the current layout state and save it to a cookie * * @param {(string|Array)=} keys * @param {Object=} opts */ function saveCookie (keys, opts) { var o = $.extend( {}, options.cookie, opts || {} ) , name = o.name || options.name || "Layout" , params = '' , date = '' , clear = false ; if (o.expires.toUTCString) date = o.expires; else if (typeof o.expires == 'number') { date = new Date(); if (o.expires > 0) date.setDate(date.getDate() + o.expires); else { date.setYear(1970); clear = true; } } if (date) params += ';expires='+ date.toUTCString(); if (o.path) params += ';path='+ o.path; if (o.domain) params += ';domain='+ o.domain; if (o.secure) params += ';secure'; if (clear) { state.cookie = {}; // clear data document.cookie = name +'='+ params; // expire the cookie } else { state.cookie = getState(keys || o.keys); // read current panes-state document.cookie = name +'='+ encodeURIComponent( encodeJSON(state.cookie) ) + params; // write cookie } return $.extend({}, state.cookie); // return COPY of state.cookie }; /** * Remove the state cookie */ function deleteCookie () { saveCookie('', { expires: -1 }); }; /** * Get data from the cookie and USE IT to loadState * * @param {Object=} opts */ function loadCookie (opts) { var o = getCookie(opts); // READ the cookie if (o) { state.cookie = $.extend({}, o); // SET state.cookie loadState(o); // LOAD the retrieved state } return o; }; /** * Update layout options from the cookie, if one exists * * @param {Object=} opts * @param {boolean=} animate */ function loadState (opts, animate) { opts = _transformData(opts); $.extend( true, options, opts ); // update layout options // if layout has already been initialized, then UPDATE layout state if (state.initialized) { var pane, o, s, h, c, a = !animate; $.each(_c.allPanes.split(","), function (idx, pane) { o = opts[ pane ]; if (typeof o != 'object') return; // no key, continue s = o.size; c = o.initClosed; h = o.initHidden; if (s > 0 || s=="auto") sizePane(pane, s); if (h === true) hide(pane, a); else if (c === false) open(pane, false, a ); else if (c === true) close(pane, false, a); else if (h === false) show(pane, false, a); }); } }; /** * Get the *current layout state* and return it as a hash * * @param {(string|Array)=} keys */ function getState (keys) { var data = {} , alt = { isClosed: 'initClosed', isHidden: 'initHidden' } , pair, pane, key, val ; if (!keys) keys = options.cookie.keys; // if called by user if ($.isArray(keys)) keys = keys.join(","); // convert keys to an array and change delimiters from '__' to '.' keys = keys.replace(/__/g, ".").split(','); // loop keys and create a data hash for (var i=0,n=keys.length; i < n; i++) { pair = keys[i].split("."); pane = pair[0]; key = pair[1]; if (_c.allPanes.indexOf(pane) < 0) continue; // bad pane! val = state[ pane ][ key ]; if (val == undefined) continue; if (key=="isClosed" && state[pane]["isSliding"]) val = true; // if sliding, then *really* isClosed ( data[pane] || (data[pane]={}) )[ alt[key] ? alt[key] : key ] = val; } return data; }; /** * Stringify a JSON hash so can save in a cookie or db-field */ function encodeJSON (JSON) { return parse( JSON ); function parse (h) { var D=[], i=0, k, v, t; // k = key, v = value for (k in h) { v = h[k]; t = typeof v; if (t == 'string') // STRING - add quotes v = '"'+ v +'"'; else if (t == 'object') // SUB-KEY - recurse into it v = parse(v); D[i++] = '"'+ k +'":'+ v; } return "{"+ D.join(",") +"}"; }; }; /** * Convert stringified JSON back to a hash object */ function decodeJSON (str) { try { return window["eval"]("("+ str +")") || {}; } catch (e) { return {}; } }; /* * ##################### * CREATE/RETURN LAYOUT * ##################### */ // validate that container exists var $N = $(this).eq(0); // FIRST matching Container element if (!$N.length) { if (options.showErrorMessages) alert( lang.errContainerMissing ); return null; }; // Users retreive Instance of a layout with: $N.layout() OR $N.data("layout") // return the Instance-pointer if layout has already been initialized if ($N.data("layoutContainer") && $N.data("layout")) return $N.data("layout"); // cached pointer // init global vars var $Ps = {} // Panes x5 - set in initPanes() , $Cs = {} // Content x5 - set in initPanes() , $Rs = {} // Resizers x4 - set in initHandles() , $Ts = {} // Togglers x4 - set in initHandles() // aliases for code brevity , sC = state.container // alias for easy access to 'container dimensions' , sID = state.id // alias for unique layout ID/namespace - eg: "layout435" ; // create Instance object to expose data & option Properties, and primary action Methods var Instance = { options: options // property - options hash , state: state // property - dimensions hash , container: $N // property - object pointers for layout container , panes: $Ps // property - object pointers for ALL Panes: panes.north, panes.center , contents: $Cs // property - object pointers for ALL Content: content.north, content.center , resizers: $Rs // property - object pointers for ALL Resizers, eg: resizers.north , togglers: $Ts // property - object pointers for ALL Togglers, eg: togglers.north , toggle: toggle // method - pass a 'pane' ("north", "west", etc) , hide: hide // method - ditto , show: show // method - ditto , open: open // method - ditto , close: close // method - ditto , slideOpen: slideOpen // method - ditto , slideClose: slideClose // method - ditto , slideToggle: slideToggle // method - ditto , initContent: initContent // method - ditto , sizeContent: sizeContent // method - ditto , sizePane: manualSizePane // method - pass a 'pane' AND an 'outer-size' in pixels or percent, or 'auto' , swapPanes: swapPanes // method - pass TWO 'panes' - will swap them , resizeAll: resizeAll // method - no parameters , initPanes: isInitialized // method - no parameters , destroy: destroy // method - no parameters , addPane: addPane // method - pass a 'pane' , removePane: removePane // method - pass a 'pane' to remove from layout, add 'true' to delete the pane-elem , setSizeLimits: setSizeLimits // method - pass a 'pane' - update state min/max data , bindButton: bindButton // utility - pass element selector, 'action' and 'pane' (E, "toggle", "west") , addToggleBtn: addToggleBtn // utility - pass element selector and 'pane' (E, "west") , addOpenBtn: addOpenBtn // utility - ditto , addCloseBtn: addCloseBtn // utility - ditto , addPinBtn: addPinBtn // utility - ditto , allowOverflow: allowOverflow // utility - pass calling element (this) , resetOverflow: resetOverflow // utility - ditto , encodeJSON: encodeJSON // method - pass a JSON object , decodeJSON: decodeJSON // method - pass a string of encoded JSON , getState: getState // method - returns hash of current layout-state , getCookie: getCookie // method - update options from cookie - returns hash of cookie data , saveCookie: saveCookie // method - optionally pass keys-list and cookie-options (hash) , deleteCookie: deleteCookie // method , loadCookie: loadCookie // method - update options from cookie - returns hash of cookie data , loadState: loadState // method - pass a hash of state to use to update options , cssWidth: cssW // utility - pass element and target outerWidth , cssHeight: cssH // utility - ditto , enableClosable: enableClosable , disableClosable: disableClosable , enableSlidable: enableSlidable , disableSlidable: disableSlidable , enableResizable: enableResizable , disableResizable: disableResizable }; // create the border layout NOW if (_create() === 'cancel') // onload_start callback returned false to CANCEL layout creation return null; else // true OR false -- if layout-elements did NOT init (hidden or do not exist), can auto-init later return Instance; // return the Instance object } })( jQuery );
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/js/jquery.layout.js
JavaScript
gpl2
146,431
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * jqForm * Tony Tomov tony@trirand.com * http://trirand.net **/ (function($){ $.jqform = { addTreeElement : function( etype, icon) { var fid = jQuery("#west-grid").jqGrid('getGridParam', 'userData').id; fid++; var dsp = "new"+etype.charAt(0).toUpperCase() + etype.slice(1); // check to see if we are using group element var root = "1"; var sr = jQuery("#west-grid").jqGrid('getGridParam', 'selrow'); if( sr ) { var data = jQuery("#west-grid").jqGrid('getRowData', sr); if(data.type == 'group') { root = sr; } } jQuery("#west-grid").jqGrid('addChildNode', fid, root, {id:fid, fldname:dsp, type:etype, "icon": icon }); jQuery("#west-grid").jqGrid('setGridParam', {"userData": {id:fid}} ); jQuery("#west-grid").jqGrid('setSelection', fid); }, saveTreeCell : function(id) { var data = {}; $("input, select, textarea","#fcontent form").each(function(){ if(this.type == 'checkbox') { if($(this).attr("checked")) data[this.id] = 1; } else if(this.value) { data[this.id] = this.value; } }); var res = xmlJsonClass.toJson(data, '', '', false); //console.log(data); jQuery("#west-grid").jqGrid('setCell', id,'prop',res); }, restoreCell : function ( prop, events ) { var data = $.jgrid.parse(prop); $("#fcontent form").each (function(){ this.reset(); }); $.each(data, function(i, n) { var elm = $("#"+i,"#fcontent form")[0]; if(elm) { if( elm.type=="checkbox") { if (n) $(elm).attr("checked","checked") } else { elm.value = n; } } //console.log(n); }); if(events == '__EMPTY_STRING_') { events = ""; } var tr = ""; if(events) { events = events.replace(new RegExp( "\n", "g" ), "&#010;"); var evndata = $.jgrid.parse(events); $.each(evndata, function (i, n) { tr += "<tr><td class='ui-event-cell eventname'>"+i+"</td>"; tr += "<td class='ui-event-cell eventcode'>"+ n +"</td>"; tr += "<td class='ui-event-cell eventactions' style='text-align: right;'> <button class='editcode'>Edit Event</button> <button class='delcode'>Delete Event</button></td>"; tr += "</tr>"; }); } $(".eventtable tbody") .empty() .append( tr ); $( ".editcode" ).button({ icons: { primary: "ui-icon-pencil" }, text : false }); $( ".delcode" ).button({ icons: { primary: "ui-icon-trash" }, text : false }); }, saveEvents : function ( id ) { var data ={}; $(".eventtable tbody tr").each(function() { var name = $(".eventname", this).html(); data[name] = $(".eventcode", this).text(); }); var res = xmlJsonClass.toJson(data, '', '', false); //console.log(data); jQuery("#west-grid").jqGrid('setCell', id,'events',res); }, saveParams : function() { var prmnames ="", prmtypes="", prmdefs ="", i, dm, params = jQuery("#grid_params").jqGrid('getGridParam','data'); if(params && params.length) { for(i in params) { dm = params[i]; if( i != 0) { prmnames += ","+dm.prm_name; prmtypes += ","+dm.prm_type; prmdefs += ","+dm.prm_def; } else { prmnames += dm.prm_name; prmtypes += dm.prm_type; prmdefs += dm.prm_def; } } } jQuery("#west-grid").jqGrid('setGridParam', { "userData": {"prmnames": prmnames, "prmtypes":prmtypes, "prmdefs":prmdefs} } ); }, saveToString : function () { // save current cell var cid = jQuery("#west-grid").jqGrid('getGridParam','selrow'); jQuery.jqform.saveTreeCell(cid); var griddata = jQuery("#west-grid").jqGrid('getGridParam','data'); var xmlstr="\n<rows>\n"; jQuery.each(griddata, function(i){ //this.prop = "<![CDATA["+this.prop+"]]>"; var d = $.extend({},this); d.prop = "<![CDATA["+d.prop+"]]>"; d.events = "<![CDATA["+d.events+"]]>"; xmlstr += "\t<row>\n\t\t"+xmlJsonClass.json2xml(d," ")+"\n\t</row>\n"; }); xmlstr += "</rows>\n"; //griddata.prop = "<![CDATA["+griddata.prop+"]]>"; var userdata = jQuery("#west-grid").jqGrid('getGridParam','userData'); for(var key in userdata) { if( userdata.hasOwnProperty(key) ) { if( userdata[key] === undefined ) { userdata[key] = ""; } if(key=="javascript" || key=="bphpscript" || key=="rphpscript") { xmlstr += "<userdata name=\""+key+"\"><![CDATA["+ userdata[key]+"]]></userdata>\n"; } else { xmlstr += "<userdata name=\""+key+"\">"+ userdata[key]+"</userdata>\n"; } } } return xmlstr; }, newForm : function( cleargrid ) { if(cleargrid === true) { jQuery("#west-grid").jqGrid('clearGridData'); jQuery("input",".ui-dialog").each(function(){ $(this).val(""); }); jQuery("#grid_params").jqGrid('clearGridData'); jQuery("#west-grid").jqGrid('setGridParam',{ "userData": null}); } var ud = {"id" :1, "sqlstring": "", "table":"", "tblkeys":"", "dbtype":"", "conname":"", "connstring":"","formlayout":"twocolumn","formheader":"","formicon":"","tablestyle":"","labelstyle":"","datastyle":"","formfooter":"", "createconn":"", "prmnames":"", "prmtypes":"", "prmdefs":"" }; jQuery("#west-grid").jqGrid('addChildNode', '', '', {id:"1", fldname:"newForm", type :"form" }); jQuery("#west-grid").jqGrid('setGridParam',{ "userData": ud}); jQuery("#west-grid").jqGrid('setSelection', 1); jQuery("#selname").html(" New File"); }, saveToServer : function( file_name) { var datastr = jQuery.jqform.saveToString(); jQuery.ajax({ url : 'includes/saveform.php', dataType: 'html', type: 'POST', data : {fcnt: datastr, fname: file_name}, success : function (req) { if(req !== "success") { alert("Error:" + req); } } }); }, generateFromSQL : function( rows ) { if(rows && rows.length) { // delete rows var gr = jQuery("#west-grid").jqGrid('getDataIDs'); if(gr.length) { for(var i=0; i<gr.length;i++) { if(gr[i] != "1") { jQuery("#west-grid").jqGrid('delRowData', gr[i]); } } } var row, fid=1, etype, icon, prop; jQuery("#west-grid").jqGrid('setGridParam', {"userData": { id: rows.length + 1 /* Form element*/ }} ); for(i=0;i<rows.length;i++) { prop = {}; row = rows[i]; fid++; switch (row.type) { case 'int': case 'numeric': etype= 'number'; icon = "ui-icon-calculator"; break; case 'boolean': etype = 'checkbox'; icon = "ui-icon-check"; break; case 'string': case 'blob': etype = 'text'; icon = "ui-icon-newwin"; break case 'date': etype = 'date'; icon = "ui-icon-calendar"; break; case 'datetime': etype = 'datetime'; icon = "ui-icon-calendar"; break; } prop.label = row.name; if(row.len) { prop.maxlength = row.len; } var res = xmlJsonClass.toJson(prop, '', '', false); jQuery("#west-grid").jqGrid('addChildNode', '', '1', {id:fid, fldname:row.name, type:etype, "icon": icon, prop:res, events: "" }); } } }, editorSetValue : function ( val, editor ) { editor.setValue( val ); }, editorGetValue : function ( editor ) { var ret = editor.getValue(); return ret } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/js/jquery.jqForm.js
JavaScript
gpl2
7,202
/*! * Modernizr v2.0.6 * http://www.modernizr.com * * Copyright (c) 2009-2011 Faruk Ates, Paul Irish, Alex Sexton * Dual-licensed under the BSD or MIT licenses: www.modernizr.com/license/ */ /* * Modernizr tests which native CSS3 and HTML5 features are available in * the current UA and makes the results available to you in two ways: * as properties on a global Modernizr object, and as classes on the * <html> element. This information allows you to progressively enhance * your pages with a granular level of control over the experience. * * Modernizr has an optional (not included) conditional resource loader * called Modernizr.load(), based on Yepnope.js (yepnopejs.com). * To get a build that includes Modernizr.load(), as well as choosing * which tests to include, go to www.modernizr.com/download/ * * Authors Faruk Ates, Paul Irish, Alex Sexton, * Contributors Ryan Seddon, Ben Alman */ window.Modernizr = (function( window, document, undefined ) { var version = '2.0.6', Modernizr = {}, // option for enabling the HTML classes to be added enableClasses = true, docElement = document.documentElement, docHead = document.head || document.getElementsByTagName('head')[0], /** * Create our "modernizr" element that we do most feature tests on. */ mod = 'modernizr', modElem = document.createElement(mod), mStyle = modElem.style, /** * Create the input element for various Web Forms feature tests. */ inputElem = document.createElement('input'), smile = ':)', toString = Object.prototype.toString, // List of property values to set for css tests. See ticket #21 prefixes = ' -webkit- -moz- -o- -ms- -khtml- '.split(' '), // Following spec is to expose vendor-specific style properties as: // elem.style.WebkitBorderRadius // and the following would be incorrect: // elem.style.webkitBorderRadius // Webkit ghosts their properties in lowercase but Opera & Moz do not. // Microsoft foregoes prefixes entirely <= IE8, but appears to // use a lowercase `ms` instead of the correct `Ms` in IE9 // More here: http://github.com/Modernizr/Modernizr/issues/issue/21 domPrefixes = 'Webkit Moz O ms Khtml'.split(' '), ns = {'svg': 'http://www.w3.org/2000/svg'}, tests = {}, inputs = {}, attrs = {}, classes = [], featureName, // used in testing loop // Inject element with style element and some CSS rules injectElementWithStyles = function( rule, callback, nodes, testnames ) { var style, ret, node, div = document.createElement('div'); if ( parseInt(nodes, 10) ) { // In order not to give false positives we create a node for each test // This also allows the method to scale for unspecified uses while ( nodes-- ) { node = document.createElement('div'); node.id = testnames ? testnames[nodes] : mod + (nodes + 1); div.appendChild(node); } } // <style> elements in IE6-9 are considered 'NoScope' elements and therefore will be removed // when injected with innerHTML. To get around this you need to prepend the 'NoScope' element // with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements. // http://msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx style = ['&shy;', '<style>', rule, '</style>'].join(''); div.id = mod; div.innerHTML += style; docElement.appendChild(div); ret = callback(div, rule); div.parentNode.removeChild(div); return !!ret; }, // adapted from matchMedia polyfill // by Scott Jehl and Paul Irish // gist.github.com/786768 testMediaQuery = function( mq ) { if ( window.matchMedia ) { return matchMedia(mq).matches; } var bool; injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) { bool = (window.getComputedStyle ? getComputedStyle(node, null) : node.currentStyle)['position'] == 'absolute'; }); return bool; }, /** * isEventSupported determines if a given element supports the given event * function from http://yura.thinkweb2.com/isEventSupported/ */ isEventSupported = (function() { var TAGNAMES = { 'select': 'input', 'change': 'input', 'submit': 'form', 'reset': 'form', 'error': 'img', 'load': 'img', 'abort': 'img' }; function isEventSupported( eventName, element ) { element = element || document.createElement(TAGNAMES[eventName] || 'div'); eventName = 'on' + eventName; // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those var isSupported = eventName in element; if ( !isSupported ) { // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element if ( !element.setAttribute ) { element = document.createElement('div'); } if ( element.setAttribute && element.removeAttribute ) { element.setAttribute(eventName, ''); isSupported = is(element[eventName], 'function'); // If property was created, "remove it" (by setting value to `undefined`) if ( !is(element[eventName], undefined) ) { element[eventName] = undefined; } element.removeAttribute(eventName); } } element = null; return isSupported; } return isEventSupported; })(); // hasOwnProperty shim by kangax needed for Safari 2.0 support var _hasOwnProperty = ({}).hasOwnProperty, hasOwnProperty; if ( !is(_hasOwnProperty, undefined) && !is(_hasOwnProperty.call, undefined) ) { hasOwnProperty = function (object, property) { return _hasOwnProperty.call(object, property); }; } else { hasOwnProperty = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */ return ((property in object) && is(object.constructor.prototype[property], undefined)); }; } /** * setCss applies given styles to the Modernizr DOM node. */ function setCss( str ) { mStyle.cssText = str; } /** * setCssAll extrapolates all vendor-specific css strings. */ function setCssAll( str1, str2 ) { return setCss(prefixes.join(str1 + ';') + ( str2 || '' )); } /** * is returns a boolean for if typeof obj is exactly type. */ function is( obj, type ) { return typeof obj === type; } /** * contains returns a boolean for if substr is found within str. */ function contains( str, substr ) { return !!~('' + str).indexOf(substr); } /** * testProps is a generic CSS / DOM property test; if a browser supports * a certain property, it won't return undefined for it. * A supported CSS property returns empty string when its not yet set. */ function testProps( props, prefixed ) { for ( var i in props ) { if ( mStyle[ props[i] ] !== undefined ) { return prefixed == 'pfx' ? props[i] : true; } } return false; } /** * testPropsAll tests a list of DOM properties we want to check against. * We specify literally ALL possible (known and/or likely) properties on * the element including the non-vendor prefixed one, for forward- * compatibility. */ function testPropsAll( prop, prefixed ) { var ucProp = prop.charAt(0).toUpperCase() + prop.substr(1), props = (prop + ' ' + domPrefixes.join(ucProp + ' ') + ucProp).split(' '); return testProps(props, prefixed); } /** * testBundle tests a list of CSS features that require element and style injection. * By bundling them together we can reduce the need to touch the DOM multiple times. */ /*>>testBundle*/ var testBundle = (function( styles, tests ) { var style = styles.join(''), len = tests.length; injectElementWithStyles(style, function( node, rule ) { var style = document.styleSheets[document.styleSheets.length - 1], // IE8 will bork if you create a custom build that excludes both fontface and generatedcontent tests. // So we check for cssRules and that there is a rule available // More here: https://github.com/Modernizr/Modernizr/issues/288 & https://github.com/Modernizr/Modernizr/issues/293 cssText = style.cssRules && style.cssRules[0] ? style.cssRules[0].cssText : style.cssText || "", children = node.childNodes, hash = {}; while ( len-- ) { hash[children[len].id] = children[len]; } /*>>touch*/ Modernizr['touch'] = ('ontouchstart' in window) || hash['touch'].offsetTop === 9; /*>>touch*/ /*>>csstransforms3d*/ Modernizr['csstransforms3d'] = hash['csstransforms3d'].offsetLeft === 9; /*>>csstransforms3d*/ /*>>generatedcontent*/Modernizr['generatedcontent'] = hash['generatedcontent'].offsetHeight >= 1; /*>>generatedcontent*/ /*>>fontface*/ Modernizr['fontface'] = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0; /*>>fontface*/ }, len, tests); })([ // Pass in styles to be injected into document /*>>fontface*/ '@font-face {font-family:"font";src:url("https://")}' /*>>fontface*/ /*>>touch*/ ,['@media (',prefixes.join('touch-enabled),('),mod,')', '{#touch{top:9px;position:absolute}}'].join('') /*>>touch*/ /*>>csstransforms3d*/ ,['@media (',prefixes.join('transform-3d),('),mod,')', '{#csstransforms3d{left:9px;position:absolute}}'].join('')/*>>csstransforms3d*/ /*>>generatedcontent*/,['#generatedcontent:after{content:"',smile,'";visibility:hidden}'].join('') /*>>generatedcontent*/ ], [ /*>>fontface*/ 'fontface' /*>>fontface*/ /*>>touch*/ ,'touch' /*>>touch*/ /*>>csstransforms3d*/ ,'csstransforms3d' /*>>csstransforms3d*/ /*>>generatedcontent*/,'generatedcontent' /*>>generatedcontent*/ ]);/*>>testBundle*/ /** * Tests * ----- */ tests['flexbox'] = function() { /** * setPrefixedValueCSS sets the property of a specified element * adding vendor prefixes to the VALUE of the property. * @param {Element} element * @param {string} property The property name. This will not be prefixed. * @param {string} value The value of the property. This WILL be prefixed. * @param {string=} extra Additional CSS to append unmodified to the end of * the CSS string. */ function setPrefixedValueCSS( element, property, value, extra ) { property += ':'; element.style.cssText = (property + prefixes.join(value + ';' + property)).slice(0, -property.length) + (extra || ''); } /** * setPrefixedPropertyCSS sets the property of a specified element * adding vendor prefixes to the NAME of the property. * @param {Element} element * @param {string} property The property name. This WILL be prefixed. * @param {string} value The value of the property. This will not be prefixed. * @param {string=} extra Additional CSS to append unmodified to the end of * the CSS string. */ function setPrefixedPropertyCSS( element, property, value, extra ) { element.style.cssText = prefixes.join(property + ':' + value + ';') + (extra || ''); } var c = document.createElement('div'), elem = document.createElement('div'); setPrefixedValueCSS(c, 'display', 'box', 'width:42px;padding:0;'); setPrefixedPropertyCSS(elem, 'box-flex', '1', 'width:10px;'); c.appendChild(elem); docElement.appendChild(c); var ret = elem.offsetWidth === 42; c.removeChild(elem); docElement.removeChild(c); return ret; }; // On the S60 and BB Storm, getContext exists, but always returns undefined // http://github.com/Modernizr/Modernizr/issues/issue/97/ tests['canvas'] = function() { var elem = document.createElement('canvas'); return !!(elem.getContext && elem.getContext('2d')); }; tests['canvastext'] = function() { return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function')); }; // This WebGL test may false positive. // But really it's quite impossible to know whether webgl will succeed until after you create the context. // You might have hardware that can support a 100x100 webgl canvas, but will not support a 1000x1000 webgl // canvas. So this feature inference is weak, but intentionally so. // It is known to false positive in FF4 with certain hardware and the iPad 2. tests['webgl'] = function() { return !!window.WebGLRenderingContext; }; /* * The Modernizr.touch test only indicates if the browser supports * touch events, which does not necessarily reflect a touchscreen * device, as evidenced by tablets running Windows 7 or, alas, * the Palm Pre / WebOS (touch) phones. * * Additionally, Chrome (desktop) used to lie about its support on this, * but that has since been rectified: http://crbug.com/36415 * * We also test for Firefox 4 Multitouch Support. * * For more info, see: http://modernizr.github.com/Modernizr/touch.html */ tests['touch'] = function() { return Modernizr['touch']; }; /** * geolocation tests for the new Geolocation API specification. * This test is a standards compliant-only test; for more complete * testing, including a Google Gears fallback, please see: * http://code.google.com/p/geo-location-javascript/ * or view a fallback solution using google's geo API: * http://gist.github.com/366184 */ tests['geolocation'] = function() { return !!navigator.geolocation; }; // Per 1.6: // This used to be Modernizr.crosswindowmessaging but the longer // name has been deprecated in favor of a shorter and property-matching one. // The old API is still available in 1.6, but as of 2.0 will throw a warning, // and in the first release thereafter disappear entirely. tests['postmessage'] = function() { return !!window.postMessage; }; // Web SQL database detection is tricky: // In chrome incognito mode, openDatabase is truthy, but using it will // throw an exception: http://crbug.com/42380 // We can create a dummy database, but there is no way to delete it afterwards. // Meanwhile, Safari users can get prompted on any database creation. // If they do, any page with Modernizr will give them a prompt: // http://github.com/Modernizr/Modernizr/issues/closed#issue/113 // We have chosen to allow the Chrome incognito false positive, so that Modernizr // doesn't litter the web with these test databases. As a developer, you'll have // to account for this gotcha yourself. tests['websqldatabase'] = function() { var result = !!window.openDatabase; /* if (result){ try { result = !!openDatabase( mod + "testdb", "1.0", mod + "testdb", 2e4); } catch(e) { } } */ return result; }; // Vendors had inconsistent prefixing with the experimental Indexed DB: // - Webkit's implementation is accessible through webkitIndexedDB // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB // For speed, we don't test the legacy (and beta-only) indexedDB tests['indexedDB'] = function() { for ( var i = -1, len = domPrefixes.length; ++i < len; ){ if ( window[domPrefixes[i].toLowerCase() + 'IndexedDB'] ){ return true; } } return !!window.indexedDB; }; // documentMode logic from YUI to filter out IE8 Compat Mode // which false positives. tests['hashchange'] = function() { return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7); }; // Per 1.6: // This used to be Modernizr.historymanagement but the longer // name has been deprecated in favor of a shorter and property-matching one. // The old API is still available in 1.6, but as of 2.0 will throw a warning, // and in the first release thereafter disappear entirely. tests['history'] = function() { return !!(window.history && history.pushState); }; tests['draganddrop'] = function() { return isEventSupported('dragstart') && isEventSupported('drop'); }; // Mozilla is targeting to land MozWebSocket for FF6 // bugzil.la/659324 tests['websockets'] = function() { for ( var i = -1, len = domPrefixes.length; ++i < len; ){ if ( window[domPrefixes[i] + 'WebSocket'] ){ return true; } } return 'WebSocket' in window; }; // http://css-tricks.com/rgba-browser-support/ tests['rgba'] = function() { // Set an rgba() color and check the returned value setCss('background-color:rgba(150,255,150,.5)'); return contains(mStyle.backgroundColor, 'rgba'); }; tests['hsla'] = function() { // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally, // except IE9 who retains it as hsla setCss('background-color:hsla(120,40%,100%,.5)'); return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla'); }; tests['multiplebgs'] = function() { // Setting multiple images AND a color on the background shorthand property // and then querying the style.background property value for the number of // occurrences of "url(" is a reliable method for detecting ACTUAL support for this! setCss('background:url(https://),url(https://),red url(https://)'); // If the UA supports multiple backgrounds, there should be three occurrences // of the string "url(" in the return value for elemStyle.background return /(url\s*\(.*?){3}/.test(mStyle.background); }; // In testing support for a given CSS property, it's legit to test: // `elem.style[styleName] !== undefined` // If the property is supported it will return an empty string, // if unsupported it will return undefined. // We'll take advantage of this quick test and skip setting a style // on our modernizr element, but instead just testing undefined vs // empty string. tests['backgroundsize'] = function() { return testPropsAll('backgroundSize'); }; tests['borderimage'] = function() { return testPropsAll('borderImage'); }; // Super comprehensive table about all the unique implementations of // border-radius: http://muddledramblings.com/table-of-css3-border-radius-compliance tests['borderradius'] = function() { return testPropsAll('borderRadius'); }; // WebOS unfortunately false positives on this test. tests['boxshadow'] = function() { return testPropsAll('boxShadow'); }; // FF3.0 will false positive on this test tests['textshadow'] = function() { return document.createElement('div').style.textShadow === ''; }; tests['opacity'] = function() { // Browsers that actually have CSS Opacity implemented have done so // according to spec, which means their return values are within the // range of [0.0,1.0] - including the leading zero. setCssAll('opacity:.55'); // The non-literal . in this regex is intentional: // German Chrome returns this value as 0,55 // https://github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632 return /^0.55$/.test(mStyle.opacity); }; tests['cssanimations'] = function() { return testPropsAll('animationName'); }; tests['csscolumns'] = function() { return testPropsAll('columnCount'); }; tests['cssgradients'] = function() { /** * For CSS Gradients syntax, please see: * http://webkit.org/blog/175/introducing-css-gradients/ * https://developer.mozilla.org/en/CSS/-moz-linear-gradient * https://developer.mozilla.org/en/CSS/-moz-radial-gradient * http://dev.w3.org/csswg/css3-images/#gradients- */ var str1 = 'background-image:', str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));', str3 = 'linear-gradient(left top,#9f9, white);'; setCss( (str1 + prefixes.join(str2 + str1) + prefixes.join(str3 + str1)).slice(0, -str1.length) ); return contains(mStyle.backgroundImage, 'gradient'); }; tests['cssreflections'] = function() { return testPropsAll('boxReflect'); }; tests['csstransforms'] = function() { return !!testProps(['transformProperty', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform']); }; tests['csstransforms3d'] = function() { var ret = !!testProps(['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']); // Webkit’s 3D transforms are passed off to the browser's own graphics renderer. // It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in // some conditions. As a result, Webkit typically recognizes the syntax but // will sometimes throw a false positive, thus we must do a more thorough check: if ( ret && 'webkitPerspective' in docElement.style ) { // Webkit allows this media query to succeed only if the feature is enabled. // `@media (transform-3d),(-o-transform-3d),(-moz-transform-3d),(-ms-transform-3d),(-webkit-transform-3d),(modernizr){ ... }` ret = Modernizr['csstransforms3d']; } return ret; }; tests['csstransitions'] = function() { return testPropsAll('transitionProperty'); }; /*>>fontface*/ // @font-face detection routine by Diego Perini // http://javascript.nwbox.com/CSSSupport/ tests['fontface'] = function() { return Modernizr['fontface']; }; /*>>fontface*/ // CSS generated content detection tests['generatedcontent'] = function() { return Modernizr['generatedcontent']; }; // These tests evaluate support of the video/audio elements, as well as // testing what types of content they support. // // We're using the Boolean constructor here, so that we can extend the value // e.g. Modernizr.video // true // Modernizr.video.ogg // 'probably' // // Codec values from : http://github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845 // thx to NielsLeenheer and zcorpan // Note: in FF 3.5.1 and 3.5.0, "no" was a return value instead of empty string. // Modernizr does not normalize for that. tests['video'] = function() { var elem = document.createElement('video'), bool = false; // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224 try { if ( bool = !!elem.canPlayType ) { bool = new Boolean(bool); bool.ogg = elem.canPlayType('video/ogg; codecs="theora"'); // Workaround required for IE9, which doesn't report video support without audio codec specified. // bug 599718 @ msft connect var h264 = 'video/mp4; codecs="avc1.42E01E'; bool.h264 = elem.canPlayType(h264 + '"') || elem.canPlayType(h264 + ', mp4a.40.2"'); bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"'); } } catch(e) { } return bool; }; tests['audio'] = function() { var elem = document.createElement('audio'), bool = false; try { if ( bool = !!elem.canPlayType ) { bool = new Boolean(bool); bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"'); bool.mp3 = elem.canPlayType('audio/mpeg;'); // Mimetypes accepted: // https://developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements // http://bit.ly/iphoneoscodecs bool.wav = elem.canPlayType('audio/wav; codecs="1"'); bool.m4a = elem.canPlayType('audio/x-m4a;') || elem.canPlayType('audio/aac;'); } } catch(e) { } return bool; }; // Firefox has made these tests rather unfun. // In FF4, if disabled, window.localStorage should === null. // Normally, we could not test that directly and need to do a // `('localStorage' in window) && ` test first because otherwise Firefox will // throw http://bugzil.la/365772 if cookies are disabled // However, in Firefox 4 betas, if dom.storage.enabled == false, just mentioning // the property will throw an exception. http://bugzil.la/599479 // This looks to be fixed for FF4 Final. // Because we are forced to try/catch this, we'll go aggressive. // FWIW: IE8 Compat mode supports these features completely: // http://www.quirksmode.org/dom/html5.html // But IE8 doesn't support either with local files tests['localstorage'] = function() { try { return !!localStorage.getItem; } catch(e) { return false; } }; tests['sessionstorage'] = function() { try { return !!sessionStorage.getItem; } catch(e){ return false; } }; tests['webworkers'] = function() { return !!window.Worker; }; tests['applicationcache'] = function() { return !!window.applicationCache; }; // Thanks to Erik Dahlstrom tests['svg'] = function() { return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect; }; // specifically for SVG inline in HTML, not within XHTML // test page: paulirish.com/demo/inline-svg tests['inlinesvg'] = function() { var div = document.createElement('div'); div.innerHTML = '<svg/>'; return (div.firstChild && div.firstChild.namespaceURI) == ns.svg; }; // Thanks to F1lt3r and lucideer, ticket #35 tests['smil'] = function() { return !!document.createElementNS && /SVG/.test(toString.call(document.createElementNS(ns.svg, 'animate'))); }; tests['svgclippaths'] = function() { // Possibly returns a false positive in Safari 3.2? return !!document.createElementNS && /SVG/.test(toString.call(document.createElementNS(ns.svg, 'clipPath'))); }; // input features and input types go directly onto the ret object, bypassing the tests loop. // Hold this guy to execute in a moment. function webforms() { // Run through HTML5's new input attributes to see if the UA understands any. // We're using f which is the <input> element created early on // Mike Taylr has created a comprehensive resource for testing these attributes // when applied to all input types: // http://miketaylr.com/code/input-type-attr.html // spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary // Only input placeholder is tested while textarea's placeholder is not. // Currently Safari 4 and Opera 11 have support only for the input placeholder // Both tests are available in feature-detects/forms-placeholder.js Modernizr['input'] = (function( props ) { for ( var i = 0, len = props.length; i < len; i++ ) { attrs[ props[i] ] = !!(props[i] in inputElem); } return attrs; })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' ')); // Run through HTML5's new input types to see if the UA understands any. // This is put behind the tests runloop because it doesn't return a // true/false like all the other tests; instead, it returns an object // containing each input type with its corresponding true/false value // Big thanks to @miketaylr for the html5 forms expertise. http://miketaylr.com/ Modernizr['inputtypes'] = (function(props) { for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) { inputElem.setAttribute('type', inputElemType = props[i]); bool = inputElem.type !== 'text'; // We first check to see if the type we give it sticks.. // If the type does, we feed it a textual value, which shouldn't be valid. // If the value doesn't stick, we know there's input sanitization which infers a custom UI if ( bool ) { inputElem.value = smile; inputElem.style.cssText = 'position:absolute;visibility:hidden;'; if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) { docElement.appendChild(inputElem); defaultView = document.defaultView; // Safari 2-4 allows the smiley as a value, despite making a slider bool = defaultView.getComputedStyle && defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' && // Mobile android web browser has false positive, so must // check the height to see if the widget is actually there. (inputElem.offsetHeight !== 0); docElement.removeChild(inputElem); } else if ( /^(search|tel)$/.test(inputElemType) ){ // Spec doesnt define any special parsing or detectable UI // behaviors so we pass these through as true // Interestingly, opera fails the earlier test, so it doesn't // even make it here. } else if ( /^(url|email)$/.test(inputElemType) ) { // Real url and email support comes with prebaked validation. bool = inputElem.checkValidity && inputElem.checkValidity() === false; } else if ( /^color$/.test(inputElemType) ) { // chuck into DOM and force reflow for Opera bug in 11.00 // github.com/Modernizr/Modernizr/issues#issue/159 docElement.appendChild(inputElem); docElement.offsetWidth; bool = inputElem.value != smile; docElement.removeChild(inputElem); } else { // If the upgraded input compontent rejects the :) text, we got a winner bool = inputElem.value != smile; } } inputs[ props[i] ] = !!bool; } return inputs; })('search tel url email datetime date month week time datetime-local number range color'.split(' ')); } // End of test definitions // ----------------------- // Run through all tests and detect their support in the current UA. // todo: hypothetically we could be doing an array of tests and use a basic loop here. for ( var feature in tests ) { if ( hasOwnProperty(tests, feature) ) { // run the test, throw the return value into the Modernizr, // then based on that boolean, define an appropriate className // and push it into an array of classes we'll join later. featureName = feature.toLowerCase(); Modernizr[featureName] = tests[feature](); classes.push((Modernizr[featureName] ? '' : 'no-') + featureName); } } // input tests need to run. Modernizr.input || webforms(); /** * addTest allows the user to define their own feature tests * the result will be added onto the Modernizr object, * as well as an appropriate className set on the html element * * @param feature - String naming the feature * @param test - Function returning true if feature is supported, false if not */ Modernizr.addTest = function ( feature, test ) { if ( typeof feature == "object" ) { for ( var key in feature ) { if ( hasOwnProperty( feature, key ) ) { Modernizr.addTest( key, feature[ key ] ); } } } else { feature = feature.toLowerCase(); if ( Modernizr[feature] !== undefined ) { // we're going to quit if you're trying to overwrite an existing test // if we were to allow it, we'd do this: // var re = new RegExp("\\b(no-)?" + feature + "\\b"); // docElement.className = docElement.className.replace( re, '' ); // but, no rly, stuff 'em. return; } test = typeof test == "boolean" ? test : !!test(); docElement.className += ' ' + (test ? '' : 'no-') + feature; Modernizr[feature] = test; } return Modernizr; // allow chaining. }; // Reset modElem.cssText to nothing to reduce memory footprint. setCss(''); modElem = inputElem = null; //>>BEGIN IEPP // Enable HTML 5 elements for styling (and printing) in IE. if ( window.attachEvent && (function(){ var elem = document.createElement('div'); elem.innerHTML = '<elem></elem>'; return elem.childNodes.length !== 1; })() ) { // iepp v2 by @jon_neal & afarkas : github.com/aFarkas/iepp/ (function(win, doc) { win.iepp = win.iepp || {}; var iepp = win.iepp, elems = iepp.html5elements || 'abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video', elemsArr = elems.split('|'), elemsArrLen = elemsArr.length, elemRegExp = new RegExp('(^|\\s)('+elems+')', 'gi'), tagRegExp = new RegExp('<(\/*)('+elems+')', 'gi'), filterReg = /^\s*[\{\}]\s*$/, ruleRegExp = new RegExp('(^|[^\\n]*?\\s)('+elems+')([^\\n]*)({[\\n\\w\\W]*?})', 'gi'), docFrag = doc.createDocumentFragment(), html = doc.documentElement, head = html.firstChild, bodyElem = doc.createElement('body'), styleElem = doc.createElement('style'), printMedias = /print|all/, body; function shim(doc) { var a = -1; while (++a < elemsArrLen) // Use createElement so IE allows HTML5-named elements in a document doc.createElement(elemsArr[a]); } iepp.getCSS = function(styleSheetList, mediaType) { if(styleSheetList+'' === undefined){return '';} var a = -1, len = styleSheetList.length, styleSheet, cssTextArr = []; while (++a < len) { styleSheet = styleSheetList[a]; //currently no test for disabled/alternate stylesheets if(styleSheet.disabled){continue;} mediaType = styleSheet.media || mediaType; // Get css from all non-screen stylesheets and their imports if (printMedias.test(mediaType)) cssTextArr.push(iepp.getCSS(styleSheet.imports, mediaType), styleSheet.cssText); //reset mediaType to all with every new *not imported* stylesheet mediaType = 'all'; } return cssTextArr.join(''); }; iepp.parseCSS = function(cssText) { var cssTextArr = [], rule; while ((rule = ruleRegExp.exec(cssText)) != null){ // Replace all html5 element references with iepp substitute classnames cssTextArr.push(( (filterReg.exec(rule[1]) ? '\n' : rule[1]) +rule[2]+rule[3]).replace(elemRegExp, '$1.iepp_$2')+rule[4]); } return cssTextArr.join('\n'); }; iepp.writeHTML = function() { var a = -1; body = body || doc.body; while (++a < elemsArrLen) { var nodeList = doc.getElementsByTagName(elemsArr[a]), nodeListLen = nodeList.length, b = -1; while (++b < nodeListLen) if (nodeList[b].className.indexOf('iepp_') < 0) // Append iepp substitute classnames to all html5 elements nodeList[b].className += ' iepp_'+elemsArr[a]; } docFrag.appendChild(body); html.appendChild(bodyElem); // Write iepp substitute print-safe document bodyElem.className = body.className; bodyElem.id = body.id; // Replace HTML5 elements with <font> which is print-safe and shouldn't conflict since it isn't part of html5 bodyElem.innerHTML = body.innerHTML.replace(tagRegExp, '<$1font'); }; iepp._beforePrint = function() { // Write iepp custom print CSS styleElem.styleSheet.cssText = iepp.parseCSS(iepp.getCSS(doc.styleSheets, 'all')); iepp.writeHTML(); }; iepp.restoreHTML = function(){ // Undo everything done in onbeforeprint bodyElem.innerHTML = ''; html.removeChild(bodyElem); html.appendChild(body); }; iepp._afterPrint = function(){ // Undo everything done in onbeforeprint iepp.restoreHTML(); styleElem.styleSheet.cssText = ''; }; // Shim the document and iepp fragment shim(doc); shim(docFrag); // if(iepp.disablePP){return;} // Add iepp custom print style element head.insertBefore(styleElem, head.firstChild); styleElem.media = 'print'; styleElem.className = 'iepp-printshim'; win.attachEvent( 'onbeforeprint', iepp._beforePrint ); win.attachEvent( 'onafterprint', iepp._afterPrint ); })(window, document); } //>>END IEPP // Assign private properties to the return object with prefix Modernizr._version = version; // expose these for the plugin API. Look in the source for how to join() them against your input Modernizr._prefixes = prefixes; Modernizr._domPrefixes = domPrefixes; // Modernizr.mq tests a given media query, live against the current state of the window // A few important notes: // * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false // * A max-width or orientation query will be evaluated against the current state, which may change later. // * You must specify values. Eg. If you are testing support for the min-width media query use: // Modernizr.mq('(min-width:0)') // usage: // Modernizr.mq('only screen and (max-width:768)') Modernizr.mq = testMediaQuery; // Modernizr.hasEvent() detects support for a given event, with an optional element to test on // Modernizr.hasEvent('gesturestart', elem) Modernizr.hasEvent = isEventSupported; // Modernizr.testProp() investigates whether a given style property is recognized // Note that the property names must be provided in the camelCase variant. // Modernizr.testProp('pointerEvents') Modernizr.testProp = function(prop){ return testProps([prop]); }; // Modernizr.testAllProps() investigates whether a given style property, // or any of its vendor-prefixed variants, is recognized // Note that the property names must be provided in the camelCase variant. // Modernizr.testAllProps('boxSizing') Modernizr.testAllProps = testPropsAll; // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... }) Modernizr.testStyles = injectElementWithStyles; // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input // Modernizr.prefixed('boxSizing') // 'MozBoxSizing' // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style. // Return values will also be the camelCase variant, if you need to translate that to hypenated style use: // // str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); // If you're trying to ascertain which transition end event to bind to, you might do something like... // // var transEndEventNames = { // 'WebkitTransition' : 'webkitTransitionEnd', // 'MozTransition' : 'transitionend', // 'OTransition' : 'oTransitionEnd', // 'msTransition' : 'msTransitionEnd', // maybe? // 'transition' : 'transitionEnd' // }, // transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ]; Modernizr.prefixed = function(prop){ return testPropsAll(prop, 'pfx'); }; // Remove "no-js" class from <html> element, if it exists: docElement.className = docElement.className.replace(/\bno-js\b/, '') // Add the new classes to the <html> element. + (enableClasses ? ' js ' + classes.join(' ') : ''); return Modernizr; })(this, this.document);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/js/modernizr.js
JavaScript
gpl2
43,394
/*! * jQuery Form Plugin * version: 2.84 (12-AUG-2011) * @requires jQuery v1.3.2 or later * * Examples and documentation at: http://malsup.com/jquery/form/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ ;(function($) { /* Usage Note: ----------- Do not use both ajaxSubmit and ajaxForm on the same form. These functions are intended to be exclusive. Use ajaxSubmit if you want to bind your own submit handler to the form. For example, $(document).ready(function() { $('#myForm').bind('submit', function(e) { e.preventDefault(); // <-- important $(this).ajaxSubmit({ target: '#output' }); }); }); Use ajaxForm when you want the plugin to manage all the event binding for you. For example, $(document).ready(function() { $('#myForm').ajaxForm({ target: '#output' }); }); When using ajaxForm, the ajaxSubmit function will be invoked for you at the appropriate time. */ /** * ajaxSubmit() provides a mechanism for immediately submitting * an HTML form using AJAX. */ $.fn.ajaxSubmit = function(options) { // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) if (!this.length) { log('ajaxSubmit: skipping submit process - no element selected'); return this; } var method, action, url, $form = this; if (typeof options == 'function') { options = { success: options }; } method = this.attr('method'); action = this.attr('action'); url = (typeof action === 'string') ? $.trim(action) : ''; url = url || window.location.href || ''; if (url) { // clean url (don't include hash vaue) url = (url.match(/^([^#]+)/)||[])[1]; } options = $.extend(true, { url: url, success: $.ajaxSettings.success, type: method || 'GET', iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' }, options); // hook for manipulating the form data before it is extracted; // convenient for use with rich editors like tinyMCE or FCKEditor var veto = {}; this.trigger('form-pre-serialize', [this, options, veto]); if (veto.veto) { log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); return this; } // provide opportunity to alter form data before it is serialized if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { log('ajaxSubmit: submit aborted via beforeSerialize callback'); return this; } var n,v,a = this.formToArray(options.semantic); if (options.data) { options.extraData = options.data; for (n in options.data) { if( $.isArray(options.data[n]) ) { for (var k in options.data[n]) { a.push( { name: n, value: options.data[n][k] } ); } } else { v = options.data[n]; v = $.isFunction(v) ? v() : v; // if value is fn, invoke it a.push( { name: n, value: v } ); } } } // give pre-submit callback an opportunity to abort the submit if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { log('ajaxSubmit: submit aborted via beforeSubmit callback'); return this; } // fire vetoable 'validate' event this.trigger('form-submit-validate', [a, this, options, veto]); if (veto.veto) { log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); return this; } var q = $.param(a); if (options.type.toUpperCase() == 'GET') { options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; options.data = null; // data is null for 'get' } else { options.data = q; // data is the query string for 'post' } var callbacks = []; if (options.resetForm) { callbacks.push(function() { $form.resetForm(); }); } if (options.clearForm) { callbacks.push(function() { $form.clearForm(); }); } // perform a load on the target only if dataType is not provided if (!options.dataType && options.target) { var oldSuccess = options.success || function(){}; callbacks.push(function(data) { var fn = options.replaceTarget ? 'replaceWith' : 'html'; $(options.target)[fn](data).each(oldSuccess, arguments); }); } else if (options.success) { callbacks.push(options.success); } options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg var context = options.context || options; // jQuery 1.4+ supports scope context for (var i=0, max=callbacks.length; i < max; i++) { callbacks[i].apply(context, [data, status, xhr || $form, $form]); } }; // are there files to upload? var fileInputs = $('input:file', this).length > 0; var mp = 'multipart/form-data'; var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); // options.iframe allows user to force iframe mode // 06-NOV-09: now defaulting to iframe mode if file input is detected if (options.iframe !== false && (fileInputs || options.iframe || multipart)) { // hack to fix Safari hang (thanks to Tim Molendijk for this) // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d if (options.closeKeepAlive) { $.get(options.closeKeepAlive, function() { fileUpload(a); }); } else { fileUpload(a); } } else { // IE7 massage (see issue 57) if ($.browser.msie && method == 'get') { var ieMeth = $form[0].getAttribute('method'); if (typeof ieMeth === 'string') options.type = ieMeth; } $.ajax(options); } // fire 'notify' event this.trigger('form-submit-notify', [this, options]); return this; // private function for handling file uploads (hat tip to YAHOO!) function fileUpload(a) { var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; var useProp = !!$.fn.prop; if (a) { // ensure that every serialized input is still enabled for (i=0; i < a.length; i++) { el = $(form[a[i].name]); el[ useProp ? 'prop' : 'attr' ]('disabled', false); } } if ($(':input[name=submit],:input[id=submit]', form).length) { // if there is an input with a name or id of 'submit' then we won't be // able to invoke the submit fn on the form (at least not x-browser) alert('Error: Form elements must not have name or id of "submit".'); return; } s = $.extend(true, {}, $.ajaxSettings, options); s.context = s.context || s; id = 'jqFormIO' + (new Date().getTime()); if (s.iframeTarget) { $io = $(s.iframeTarget); n = $io.attr('name'); if (n == null) $io.attr('name', id); else id = n; } else { $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />'); $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' }); } io = $io[0]; xhr = { // mock object aborted: 0, responseText: null, responseXML: null, status: 0, statusText: 'n/a', getAllResponseHeaders: function() {}, getResponseHeader: function() {}, setRequestHeader: function() {}, abort: function(status) { var e = (status === 'timeout' ? 'timeout' : 'aborted'); log('aborting upload... ' + e); this.aborted = 1; $io.attr('src', s.iframeSrc); // abort op in progress xhr.error = e; s.error && s.error.call(s.context, xhr, e, status); g && $.event.trigger("ajaxError", [xhr, s, e]); s.complete && s.complete.call(s.context, xhr, e); } }; g = s.global; // trigger ajax global events so that activity/block indicators work like normal if (g && ! $.active++) { $.event.trigger("ajaxStart"); } if (g) { $.event.trigger("ajaxSend", [xhr, s]); } if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) { if (s.global) { $.active--; } return; } if (xhr.aborted) { return; } // add submitting element to data if we know it sub = form.clk; if (sub) { n = sub.name; if (n && !sub.disabled) { s.extraData = s.extraData || {}; s.extraData[n] = sub.value; if (sub.type == "image") { s.extraData[n+'.x'] = form.clk_x; s.extraData[n+'.y'] = form.clk_y; } } } var CLIENT_TIMEOUT_ABORT = 1; var SERVER_ABORT = 2; function getDoc(frame) { var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document; return doc; } // take a breath so that pending repaints get some cpu time before the upload starts function doSubmit() { // make sure form attrs are set var t = $form.attr('target'), a = $form.attr('action'); // update form attrs in IE friendly way form.setAttribute('target',id); if (!method) { form.setAttribute('method', 'POST'); } if (a != s.url) { form.setAttribute('action', s.url); } // ie borks in some cases when setting encoding if (! s.skipEncodingOverride && (!method || /post/i.test(method))) { $form.attr({ encoding: 'multipart/form-data', enctype: 'multipart/form-data' }); } // support timout if (s.timeout) { timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout); } // look for server aborts function checkState() { try { var state = getDoc(io).readyState; log('state = ' + state); if (state.toLowerCase() == 'uninitialized') setTimeout(checkState,50); } catch(e) { log('Server abort: ' , e, ' (', e.name, ')'); cb(SERVER_ABORT); timeoutHandle && clearTimeout(timeoutHandle); timeoutHandle = undefined; } } // add "extra" data to form if provided in options var extraInputs = []; try { if (s.extraData) { for (var n in s.extraData) { extraInputs.push( $('<input type="hidden" name="'+n+'" />').attr('value',s.extraData[n]) .appendTo(form)[0]); } } if (!s.iframeTarget) { // add iframe to doc and submit the form $io.appendTo('body'); io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false); } setTimeout(checkState,15); form.submit(); } finally { // reset attrs and remove "extra" input elements form.setAttribute('action',a); if(t) { form.setAttribute('target', t); } else { $form.removeAttr('target'); } $(extraInputs).remove(); } } if (s.forceSync) { doSubmit(); } else { setTimeout(doSubmit, 10); // this lets dom updates render } var data, doc, domCheckCount = 50, callbackProcessed; function cb(e) { if (xhr.aborted || callbackProcessed) { return; } try { doc = getDoc(io); } catch(ex) { log('cannot access response document: ', ex); e = SERVER_ABORT; } if (e === CLIENT_TIMEOUT_ABORT && xhr) { xhr.abort('timeout'); return; } else if (e == SERVER_ABORT && xhr) { xhr.abort('server abort'); return; } if (!doc || doc.location.href == s.iframeSrc) { // response not received yet if (!timedOut) return; } io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false); var status = 'success', errMsg; try { if (timedOut) { throw 'timeout'; } var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc); log('isXml='+isXml); if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) { if (--domCheckCount) { // in some browsers (Opera) the iframe DOM is not always traversable when // the onload callback fires, so we loop a bit to accommodate log('requeing onLoad callback, DOM not available'); setTimeout(cb, 250); return; } // let this fall through because server response could be an empty document //log('Could not access iframe DOM after mutiple tries.'); //throw 'DOMException: not available'; } //log('response detected'); var docRoot = doc.body ? doc.body : doc.documentElement; xhr.responseText = docRoot ? docRoot.innerHTML : null; xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; if (isXml) s.dataType = 'xml'; xhr.getResponseHeader = function(header){ var headers = {'content-type': s.dataType}; return headers[header]; }; // support for XHR 'status' & 'statusText' emulation : if (docRoot) { xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status; xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText; } var dt = s.dataType || ''; var scr = /(json|script|text)/.test(dt.toLowerCase()); if (scr || s.textarea) { // see if user embedded response in textarea var ta = doc.getElementsByTagName('textarea')[0]; if (ta) { xhr.responseText = ta.value; // support for XHR 'status' & 'statusText' emulation : xhr.status = Number( ta.getAttribute('status') ) || xhr.status; xhr.statusText = ta.getAttribute('statusText') || xhr.statusText; } else if (scr) { // account for browsers injecting pre around json response var pre = doc.getElementsByTagName('pre')[0]; var b = doc.getElementsByTagName('body')[0]; if (pre) { xhr.responseText = pre.textContent ? pre.textContent : pre.innerHTML; } else if (b) { xhr.responseText = b.innerHTML; } } } else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) { xhr.responseXML = toXml(xhr.responseText); } try { data = httpData(xhr, s.dataType, s); } catch (e) { status = 'parsererror'; xhr.error = errMsg = (e || status); } } catch (e) { log('error caught: ',e); status = 'error'; xhr.error = errMsg = (e || status); } if (xhr.aborted) { log('upload aborted'); status = null; } if (xhr.status) { // we've set xhr.status status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error'; } // ordering of these callbacks/triggers is odd, but that's how $.ajax does it if (status === 'success') { s.success && s.success.call(s.context, data, 'success', xhr); g && $.event.trigger("ajaxSuccess", [xhr, s]); } else if (status) { if (errMsg == undefined) errMsg = xhr.statusText; s.error && s.error.call(s.context, xhr, status, errMsg); g && $.event.trigger("ajaxError", [xhr, s, errMsg]); } g && $.event.trigger("ajaxComplete", [xhr, s]); if (g && ! --$.active) { $.event.trigger("ajaxStop"); } s.complete && s.complete.call(s.context, xhr, status); callbackProcessed = true; if (s.timeout) clearTimeout(timeoutHandle); // clean up setTimeout(function() { if (!s.iframeTarget) $io.remove(); xhr.responseXML = null; }, 100); } var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+) if (window.ActiveXObject) { doc = new ActiveXObject('Microsoft.XMLDOM'); doc.async = 'false'; doc.loadXML(s); } else { doc = (new DOMParser()).parseFromString(s, 'text/xml'); } return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null; }; var parseJSON = $.parseJSON || function(s) { return window['eval']('(' + s + ')'); }; var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4 var ct = xhr.getResponseHeader('content-type') || '', xml = type === 'xml' || !type && ct.indexOf('xml') >= 0, data = xml ? xhr.responseXML : xhr.responseText; if (xml && data.documentElement.nodeName === 'parsererror') { $.error && $.error('parsererror'); } if (s && s.dataFilter) { data = s.dataFilter(data, type); } if (typeof data === 'string') { if (type === 'json' || !type && ct.indexOf('json') >= 0) { data = parseJSON(data); } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) { $.globalEval(data); } } return data; }; } }; /** * ajaxForm() provides a mechanism for fully automating form submission. * * The advantages of using this method instead of ajaxSubmit() are: * * 1: This method will include coordinates for <input type="image" /> elements (if the element * is used to submit the form). * 2. This method will include the submit element's name/value data (for the element that was * used to submit the form). * 3. This method binds the submit() method to the form for you. * * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely * passes the options argument along after properly binding events for submit elements and * the form itself. */ $.fn.ajaxForm = function(options) { // in jQuery 1.3+ we can fix mistakes with the ready state if (this.length === 0) { var o = { s: this.selector, c: this.context }; if (!$.isReady && o.s) { log('DOM not ready, queuing ajaxForm'); $(function() { $(o.s,o.c).ajaxForm(options); }); return this; } // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); return this; } return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) { if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed e.preventDefault(); $(this).ajaxSubmit(options); } }).bind('click.form-plugin', function(e) { var target = e.target; var $el = $(target); if (!($el.is(":submit,input:image"))) { // is this a child element of the submit el? (ex: a span within a button) var t = $el.closest(':submit'); if (t.length == 0) { return; } target = t[0]; } var form = this; form.clk = target; if (target.type == 'image') { if (e.offsetX != undefined) { form.clk_x = e.offsetX; form.clk_y = e.offsetY; } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin var offset = $el.offset(); form.clk_x = e.pageX - offset.left; form.clk_y = e.pageY - offset.top; } else { form.clk_x = e.pageX - target.offsetLeft; form.clk_y = e.pageY - target.offsetTop; } } // clear form vars setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100); }); }; // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm $.fn.ajaxFormUnbind = function() { return this.unbind('submit.form-plugin click.form-plugin'); }; /** * formToArray() gathers form element data into an array of objects that can * be passed to any of the following ajax functions: $.get, $.post, or load. * Each object in the array has both a 'name' and 'value' property. An example of * an array for a simple login form might be: * * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] * * It is this array that is passed to pre-submit callback functions provided to the * ajaxSubmit() and ajaxForm() methods. */ $.fn.formToArray = function(semantic) { var a = []; if (this.length === 0) { return a; } var form = this[0]; var els = semantic ? form.getElementsByTagName('*') : form.elements; if (!els) { return a; } var i,j,n,v,el,max,jmax; for(i=0, max=els.length; i < max; i++) { el = els[i]; n = el.name; if (!n) { continue; } if (semantic && form.clk && el.type == "image") { // handle image inputs on the fly when semantic == true if(!el.disabled && form.clk == el) { a.push({name: n, value: $(el).val()}); a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); } continue; } v = $.fieldValue(el, true); if (v && v.constructor == Array) { for(j=0, jmax=v.length; j < jmax; j++) { a.push({name: n, value: v[j]}); } } else if (v !== null && typeof v != 'undefined') { a.push({name: n, value: v}); } } if (!semantic && form.clk) { // input type=='image' are not found in elements array! handle it here var $input = $(form.clk), input = $input[0]; n = input.name; if (n && !input.disabled && input.type == 'image') { a.push({name: n, value: $input.val()}); a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); } } return a; }; /** * Serializes form data into a 'submittable' string. This method will return a string * in the format: name1=value1&amp;name2=value2 */ $.fn.formSerialize = function(semantic) { //hand off to jQuery.param for proper encoding return $.param(this.formToArray(semantic)); }; /** * Serializes all field elements in the jQuery object into a query string. * This method will return a string in the format: name1=value1&amp;name2=value2 */ $.fn.fieldSerialize = function(successful) { var a = []; this.each(function() { var n = this.name; if (!n) { return; } var v = $.fieldValue(this, successful); if (v && v.constructor == Array) { for (var i=0,max=v.length; i < max; i++) { a.push({name: n, value: v[i]}); } } else if (v !== null && typeof v != 'undefined') { a.push({name: this.name, value: v}); } }); //hand off to jQuery.param for proper encoding return $.param(a); }; /** * Returns the value(s) of the element in the matched set. For example, consider the following form: * * <form><fieldset> * <input name="A" type="text" /> * <input name="A" type="text" /> * <input name="B" type="checkbox" value="B1" /> * <input name="B" type="checkbox" value="B2"/> * <input name="C" type="radio" value="C1" /> * <input name="C" type="radio" value="C2" /> * </fieldset></form> * * var v = $(':text').fieldValue(); * // if no values are entered into the text inputs * v == ['',''] * // if values entered into the text inputs are 'foo' and 'bar' * v == ['foo','bar'] * * var v = $(':checkbox').fieldValue(); * // if neither checkbox is checked * v === undefined * // if both checkboxes are checked * v == ['B1', 'B2'] * * var v = $(':radio').fieldValue(); * // if neither radio is checked * v === undefined * // if first radio is checked * v == ['C1'] * * The successful argument controls whether or not the field element must be 'successful' * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). * The default value of the successful argument is true. If this value is false the value(s) * for each element is returned. * * Note: This method *always* returns an array. If no valid value can be determined the * array will be empty, otherwise it will contain one or more values. */ $.fn.fieldValue = function(successful) { for (var val=[], i=0, max=this.length; i < max; i++) { var el = this[i]; var v = $.fieldValue(el, successful); if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) { continue; } v.constructor == Array ? $.merge(val, v) : val.push(v); } return val; }; /** * Returns the value of the field element. */ $.fieldValue = function(el, successful) { var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); if (successful === undefined) { successful = true; } if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || (t == 'checkbox' || t == 'radio') && !el.checked || (t == 'submit' || t == 'image') && el.form && el.form.clk != el || tag == 'select' && el.selectedIndex == -1)) { return null; } if (tag == 'select') { var index = el.selectedIndex; if (index < 0) { return null; } var a = [], ops = el.options; var one = (t == 'select-one'); var max = (one ? index+1 : ops.length); for(var i=(one ? index : 0); i < max; i++) { var op = ops[i]; if (op.selected) { var v = op.value; if (!v) { // extra pain for IE... v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value; } if (one) { return v; } a.push(v); } } return a; } return $(el).val(); }; /** * Clears the form data. Takes the following actions on the form's input fields: * - input text fields will have their 'value' property set to the empty string * - select elements will have their 'selectedIndex' property set to -1 * - checkbox and radio inputs will have their 'checked' property set to false * - inputs of type submit, button, reset, and hidden will *not* be effected * - button elements will *not* be effected */ $.fn.clearForm = function() { return this.each(function() { $('input,select,textarea', this).clearFields(); }); }; /** * Clears the selected form elements. */ $.fn.clearFields = $.fn.clearInputs = function() { var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list return this.each(function() { var t = this.type, tag = this.tagName.toLowerCase(); if (re.test(t) || tag == 'textarea') { this.value = ''; } else if (t == 'checkbox' || t == 'radio') { this.checked = false; } else if (tag == 'select') { this.selectedIndex = -1; } }); }; /** * Resets the form data. Causes all form elements to be reset to their original value. */ $.fn.resetForm = function() { return this.each(function() { // guard against an input with the name of 'reset' // note that IE reports the reset function as an 'object' if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) { this.reset(); } }); }; /** * Enables or disables any matching elements. */ $.fn.enable = function(b) { if (b === undefined) { b = true; } return this.each(function() { this.disabled = !b; }); }; /** * Checks/unchecks any matching checkboxes or radio buttons and * selects/deselects and matching option elements. */ $.fn.selected = function(select) { if (select === undefined) { select = true; } return this.each(function() { var t = this.type; if (t == 'checkbox' || t == 'radio') { this.checked = select; } else if (this.tagName.toLowerCase() == 'option') { var $sel = $(this).parent('select'); if (select && $sel[0] && $sel[0].type == 'select-one') { // deselect all other options $sel.find('option').selected(false); } this.selected = select; } }); }; // helper fn for console logging function log() { var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,''); if (window.console && window.console.log) { window.console.log(msg); } else if (window.opera && window.opera.postError) { window.opera.postError(msg); } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/js/jquery.form.js
JavaScript
gpl2
26,751
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ $acccept_charset = "Specifies the character-sets the server can handle for form-data." ."To specify more than one character set, separate the sets with a comma.<br/> " ."In theory, any character encoding can be used, but no browser understands all of them. " ."The more widely a character encoding is used, the better the chance that a browser will understand it."; $action = "Specifies where to send the form-data when a form is submitted.<br/>" ."Possible values:<br/>" ."<ul><li>An absolute URL - points to another web site (like action='http://www.example.com/example.htm')</li>" ."<li>A relative URL - points to a file within a web site (like action='example.htm')</li><ul>"; $autocomplete = "Specifies whether or not the form should have autocomplete enabled.<br/>" ."Autocomplete allows the browser to predict the input for a field. " ."When the user starts to type in a field, the browser should display options " ."to fill in the field, based on earlier typed values."; $enctype = "The enctype attribute specifies how form-data should be encoded before " ."sending it to the server.<br/>Form-data is encoded to 'application/x-www-form-urlencoded' " ."by default. This means that all characters are encoded before they are sent " ."to the server (spaces are converted to '+' symbols, and special characters are converted to ASCII HEX values)." ."<b>Value</b><ul>" ."<li><b>application/x-www-form-urlencoded </b> - All characters are encoded before sent (this is default)</li>" ."<li><b>multipart/form-data</b> - No characters are encoded. This value is required when you are using forms that have a file upload control</li>" ."<li><b>text/plain</b> - Spaces are converted to '+' symbols, but no special characters are encoded</li>"; $method = "The method attribute specifies how to send form-data.<br/>" ."The form-data can be sent as URL variables (with method='get') or as HTTP post (with method='post').<br/> " ."<b>Notes on the 'get' method:</b><ul>" ."<li>This method appends the form-data to the URL in name/value pairs</li>" ."<li>This method is useful for form submissions where a user want to bookmark the result</li>" ."<li>There is a limit to how much data you can place in a URL (varies between browsers), " ."therefore, you cannot be sure that all of the form-data will be correctly transferred</li>" ."<li>Never use the 'get' method to pass sensitive information! " ."(password or other sensitive information will be visible in the browser's address bar)</ul> " ."<b>Notes on the 'post' method:</b><ul>" ."<li>This method sends the form-data as an HTTP post transaction</li>" ."<li>Form submissions with the 'post' method cannot be bookmarked</li>" ."<li>The 'post' method is more robust and secure than 'get', and 'post' does not have size limitations</li></ul>"; $novalidate = "The novalidate attribute specifies that the form-data (input) should not be validated when submitted."; $accesskey = "The accesskey attribute specifies a shortcut key for an element.<br/>" ."A keyboard shortcut will give the element focus and/or activate it.<br/>" ."<b>Value :</b> One or more keyboard characters, separated by spaces."; $class ="The class attribute specifies a classname for an element.<br/>" ."The class attribute is mostly used to point to a class in a style sheet. " ."However, it can also be used by a JavaScript (via the HTML DOM) to make " ."changes to HTML elements with a specified class.<br/>" ."<b>Tip:</b> It is possible to assign multiple classes to one HTML element, " ."e.g. &lt; span class='left_menu important' &gt;. This allows you to combine several " ."CSS classes for one HTML element.<br/>" ."<b>Tip:</b> Do NOT start a class name with a number! This is not supported in most browsers."; $contenteditable = "The contenteditable attribute specifies whether or not the content of the element should be editable.<br/>" ."<b>Values</b>:<br/>" ."<ul><li>true - Specifies that the content of the element should be editable</li>" ."<li>false - Specifies that the content of the element should not be editable</li>" ."<li>inherit -Specifies that the content of the element should be editable if the parent element is</li></ul>"; $contextmenu ="The value of the id attribute on the menu with which to associate the element as a context menu."; $dir = "The dir attribute specifies the text direction of the element's content." ."<b>Values:</b><br/>" ."<ul><li>ltr - Left-to-right text direction</li>" ."<li>rtl - Right-to-left text direction</li>" ."<li>auto -Let the browser figure out the text direction based on the content. This is only recommended if the text directionality is unknown</li></ul>"; $draggable ="Specifies whether the element is draggable."; $dropzone = "Specifies what types of content can be dropped on the element, and instructs " ."the UA about which actions to take with content when it is dropped on the element. <br>" ."<b>Value :</b><ul>" ."<li>copy - Indicates that dropping an accepted item on the element will result in a copy of the dragged data.</li>" ."<li>move -Indicates that dropping an accepted item on the element will result in the dragged data being moved to the new location.</li>" ."<li>link - Indicates that dropping an accepted item on the element will result in a link to the original data.</li>" ."<li>Any string with three characters or more, beginning with the literal string 's:'. - ndicates that Plain Unicode string items, of the type indicated by the part of of the keyword after the 's:' string, can be dropped on this element. </li>" ."<li>Any string with three characters or more, beginning with the literal string 'f:'. - Indicates that File items, of the type indicated by the part of of the keyword after the 'f:' string, can be dropped on this element.</li>" ."</ul>" ."The value must not have more than one of the three tokens 'copy', 'move', or 'link'. If none are specified, the element represents a copy dropzone."; $hidden = "The hidden attribute specifies that the element should be hidden. <br/>Hidden elements are not displayed." ."If this attribute is present the element will be hidden. <br/>The hidden attribute can be set to keep a user from seeing an element until some other condition has been met (like selecting a checkbox, etc.). Then, a JavaScript could remove the hidden attribute, and make the element visible."; $id = "The id attribute specifies a unique id for an HTML element (the id attribute value must be unique within the HTML document).<br/>" ."The id attribute can be used to point to a style in a style sheet.<br/>" ."The id attribute can also be used by a JavaScript (via the HTML DOM) to make changes to the HTML element with the specific id. <br/>" ."If not set in the form, the id is then generated automatiaclly (only for inputs) as a combination of form id plus '_' plus the name of the element.<br/>" ."<b>Value :</b> Any string, with the following restrictions: <br/> <ul>" ."<li>must be at least one character long</li>" ."<li>must not contain any space characters</li> </ul>" ."<b>Note: </b>Previous versions of HTML placed greater restrictions on the content of ID values (for example, they did not permit ID values to begin with a number)."; $lang = " Specifies the primary language for the contents of the element and for any of the element’s attributes that contain text.<br/>" ."<b>Value:</b> A valid language tag as defined in [BCP 47]."; $spellcheck = "The spellcheck attribute is currently supported in Opera, Chrome, and Safari.<br/>" ."The spellcheck attribute specifies whether the element should have its spelling checked.<br/>" ."The following text can be spellchecked:" ."<ul><li>The text values in input elements (not password)</li>" ."<li>The text in &lt; textarea &gt; elements</li>" ."<li>The text in editable elements</li></ul>" ."<b>Values:</b><br/>" ."<ul><li>true - Specifies that the text is spellchecked</li>" ."<li>false -Specifies that the text is not spellchecked</li></ul>"; $style = "The style attribute specifies an inline style for an element.<br>" ."The style attribute will override any style set globally, e.g. styles specified in the <style> tag or in an external style sheet.<br/>" ."<b>Value:</b> One or more CSS properties and values separated by semicolons (e.g. style='color:blue;text-align:center')"; $tabindex ="The tabindex attribute specifies the tab order of an element (when the 'tab' button is used for navigating).<br/>" ."Specifies whether the element represents an element that is is focusable (that is, an element which is part of the sequence of focusable elements in the document), and the relative order of the element in the sequence of focusable elements in the document.<br/>" ."<b>Value:</b> number - Specifies the tabbing order of the element (1 is first)"; $title = "The title attribute specifies extra information about an element.<br/>" ."The information is most often shown as a tooltip text when the mouse moves over the element.<br/>" ."<b>Tip:</b> The title attribute is often used with &lt; form &gt; and &lt; a &gt; elements, to provide information about input formats and link destinations. It is also a required attribute for the &lt; abbr &gt; and &lt; acronym &gt; elements."; $label = "The text which describes the field and appear near the input field."; $disabled = "The disabled attribute specifies that an input element should be disabled.A disabled input element is unusable and un-clickable.<br/>" ."The disabled attribute can be set to keep a user from using an input element until some other condition has been met (like selecting a checkbox, etc.). Then, a JavaScript is required to remove the disabled value, and make the input element usable.<br/>" ."<b>Note:</b> The disabled attribute will not work with <input type='hidden'>.<br/>" ."<b>Tip:</b> Disabled form elements will not be submitted.<br/>" ."<Value:</b> - disabled - Specifies that the input element should be disabled"; $form = "The form attribute specifies one or more forms the input element belongs to.<br/>" ."<b>Value: </b> Specifies a space-separated list of id's to one or more forms the input element belongs to"; $maxlength = "The maxlength attribute specifies the maximum number of characters allowed in an input field.<br/>" ."<b>Value:</b> number - Specifies the maximum number of characters allowed in the input field"; $readonly = "The readonly attribute specifies that an input field is read-only, and cannot be modified (however, a user can tab to it, highlight it, and copy the text from it).<br/>" ."The readonly attribute can be set to keep a user from changing the value until some other conditions have been met (like selecting a checkbox, etc.). Then, a JavaScript is required to remove the readonly value, and make the input field editable.<br/>" ."<b>Note:</b> Read-only input fields will not be validated.<br/>" ."<b>Value:</b> readonly - Specifies that the input field should be read-only"; $size = "The size attribute specifies the width, in characters, of an input element.<br/>" ."<b>Value:</b> number - The width, in characters, of an input element"; $size2 = "The size attribute specifies the number of visible options in a drop-down list.<br/>" ."If the value of the size attribute is greater than '1', but lower than the total number of options in the list, the browser will add a scroll bar to indicate that there are more options to view.<br/>" ."<b>Value</b> number - The number of visible options in the drop-down list"; $value = "The value attribute specifies a value for an input element.<br/>" ."The value attribute is used differently for different types of input: <ul>" ."<li>For types like 'button', 'reset', 'submit - defines the text on the button</li>" ."<li>For types like 'text', 'password', 'hidden' - defines the initial (default) value of the input field</li>" ."<li>For types like 'checkbox', 'radio', 'image' - defines the value associated with the input. This is the value sent to the form's action URL</li>" ."</ul>" ."<b>Note:</b> The value attribute is required with input type='checkbox' and input type='radio'." ."Note: The value attribute cannot be used with input type='file'.<br/>" ."<b>Value:</b> value -The value of the input element"; $autofocus = "The autofocus attribute specifies that an input element should automatically get focus when the page loads.<br/>" ."<b>Value:</b> autofocus - Specifies that the input element should automatically get focus when the page loads"; $list = "The list attribute refers to a <b>datalist</b> containing predefined options for an input field. <br/>" ."<b>Value:</b> datalist-id - Refers to an id of a datalist that contains predefined options for the input element"; $pattern = "The pattern attribute specifies a regular expression that input's value will be checked against.<br/>" ."Note: The pattern attribute works with the following input types: text, search, url, telephone, email, and password <br/>" ."Tip: Use the standard 'title' attribute to describe the pattern. <br/>" ."<b>Value</b> - regexp - Specifies a pattern used to validate an input field"; $required = "The required attribute specifies that an input field must be filled out before submitting.<br/>" ."Note: The required attribute works with the following input types: text, search, url, telephone, email, password, date pickers, number, checkbox, radio, and file. <br/>" ."<b>Value:</b> required - Specifies that the input field is a required field"; $placeholder = "The placeholder attribute specifies a short hint that describes the expected value of an input field (e.g. a sample value or a short description of the expected format).<br/>" ."The hint is displayed in the input field when it is empty, and disappears when the field gets focus.<br/>" ."<b>Note:</b> The placeholder attribute works with the following input types: text, search, url, telephone, email, and password" ."<b>Value:</b> text - Specifies a short hint that describes the expected value of the input field"; $checked ="The checked attribute specifies that an input element should be preselected when the page loads.<br/>" ."The checked attribute is used with input type='checkbox' or input type='radio'.<br/>" ."The checked attribute can also be set after the page load, with a JavaScript.<br/>" ."<b>Value:</b> checked - Specifies that the input element should be preselected when the page loads"; $multiple ="The multiple attribute specifies that multiple options can be selected at the same time.<br/>" ."Selecting multiple options vary in different operating systems and browsers: <ul>" ."<li>For windows: Hold down the control (ctrl) button to select multiple options</li>" ."<li>For Mac: Hold down the command button to select multiple options</li>" ."</ul>" ."Because of the different ways of doing this, and because you have to inform the user that multiple selection is available, it is more user-friendly to use checkboxes instead."; $datalist = "The attribute is not a standard HTML5 attribute. With this we construvt the options elements in the select.<br/>" ."The value must contain a set of value:label pairs with the value separated from the label with a colon (:) and ended with(;). Whichever you use, something like the following <br/><br/>" ."<b>FE:FedEx; IN:InTime; TN:TNT</b> <br/><br/>" ."will construct <br/><br/>" ."&lt; select &gt; <br/>" ."&lt; option value='FE' &gt; FedEx &lt; /option &gt; <br/>" ."&lt; option value='IN' &gt; InTime &lt; /option &gt; <br/>" ."&lt; option value='TN' &gt; TNT &lt;/option &gt; <br/>" ."&lt; /select &gt;"; $datasql = "The attribute is not a standard HTML5 attribute. Use this if you want to obtain the options elemets from database using SQL query.<br/>" ."If the sql query contain only one field it is set as value and label.<br/>" ."If the query contain two or more fields the first field is used as value, while the second as label.<br/>" ."<b>Note</b> Both options Data List and Data SQL can be used at the same time. In this case the values from Data List are inserted first and then the values from SQL"; $formaction ="Specifies where to send the form-data when a form is submitted. Overrides the form's action attribute.<br/>" ."Possible values:<br/>" ."<ul><li>An absolute URL - points to another web site (like action='http://www.example.com/example.htm')</li>" ."<li>A relative URL - points to a file within a web site (like action='example.htm')</li><ul>"; $formenctype = "Specifies how form-data should be encoded before sending it to a server. Overrides the form's enctype attribute. <br/>" ."<b>Value</b><ul>" ."<li><b>application/x-www-form-urlencoded </b> - All characters are encoded before sent (this is default)</li>" ."<li><b>multipart/form-data</b> - No characters are encoded. This value is required when you are using forms that have a file upload control</li>" ."<li><b>text/plain</b> - Spaces are converted to '+' symbols, but no special characters are encoded</li>"; $formmethod = "Specifies how to send form-data. Overrides the form's action attribute.<br/>" ."<b>Value</b><ul>" ."<li><b>get </b> - Appends the form-data to the URL in name/value pairs: URL?name=value&name=value</li>" ."<li><b>post</b> - Sends the form-data as an HTTP post transaction</li>"; $target = "The target attribute specifies where to open the action URL.<br/>" ."Note: Frames and framesets are not supported in HTML5. The _parent, _top and framename values are now mostly used with iframes." ."<b>Values</b><ul>" ."<li><b>_blank</b> Open in a new window or tab</li>" ."<li><b>_self</b> Open in the same frame as it was clicked</li>" ."<li><b>_parent</b> Open in the parent framese</li>" ."<li><b>_top</b> Open in the full body of the window</li></ul>"; $formtarget = "Specifies where to open the action URL. Overrides the forms target attribute.<br/>" ."<b>Values</b><ul>" ."<li><b>_blank</b> Open in a new window or tab</li>" ."<li><b>_self</b> Open in the same frame as it was clicked</li>" ."<li><b>_parent</b> Open in the parent framese</li>" ."<li><b>_top</b> Open in the full body of the window</li></ul>"; $multiple2 = "The multiple attribute specifies that multiple values can be selected for an input field.<br/>" ."<b>Note:</b> The multiple attribute works with the following input types: email, and file."; $accept ="The accept attribute is only used with input type='file' and it specifies the types of files that can be submitted through a file upload.<br/>" ."<b>Tip:</b> Do not use this attribute as your only validation tool. File uploads should be validated on the server.<br/>" ."<b>Values</b> <br/>" ."MIME_type One or more MIME types that can be submitted/uploaded. To specify more than one MIME type, separate the types with a comma." ."Look at IANA MIME types for a complete list of standard MIME types. <br/>(application, audio, example, image, message, model, multipart, text, video)"; $formnovalidate = " Overrides the form's novalidate attribute. Defines that the input element should not be validated when submitted"; $alt = "The alt attribute is only used with input type=image and it specifies an alternate text for an image input.<br/>" ."The alt attribute provides alternative information if the user for some reason cannot view the image (because of slow connection, an error in the src attribute, or if the user uses a screen reader)."; $src ="The src attribute is only used with input type=image and it specifies the URL of an image to use.<br/>" ."The src attribute is required with input type=image." ."Possible values:<br/>" ."<ul><li>An absolute URL - points to another web site (like action='http://www.example.com/submit.gif')</li>" ."<li>A relative URL - points to a file within a web site (like action='submit.gif')</li><ul>"; $width = "The width attribute is only used with input type=image and it specifies the width of an image input.<br/>" ."<bTip:</b> Always specify both the height and width attributes for images. If height and width are set, the space required for the image is reserved when the page is loaded. However, without these attributes, the browser does not know the size of the image, and cannot reserve the appropriate space to it. The effect will be that the page layout will change during loading (while the images load).<br/>" ."<b>Value</b>:<ul>" ."<li> pixels - The width in pixels (like 100px or just 100)</li>" ."<li> % - The width in percent of the containing element (like 50%)</li></ul>"; $height = "The height attribute is only used with input type=image and it specifies the height of an image input.<br/>" ."<bTip:</b> Always specify both the height and width attributes for images. If height and width are set, the space required for the image is reserved when the page is loaded. However, without these attributes, the browser does not know the size of the image, and cannot reserve the appropriate space to it. The effect will be that the page layout will change during loading (while the images load).<br/>" ."<b>Value</b>:<ul>" ."<li> pixels - The width in pixels (like 100px or just 100)</li>" ."<li> % - The width in percent of the containing element (like 50%)</li></ul>"; $min = "The min attribute specifies the minimum value allowed for an input field.<br/>" ."<b>Tip:</b> The min attribute can be used together with the max attribute to create a range of legal values.<br/>" ."<b>Note:</b> The max and min attributes works with the following input types: number, range, date, datetime, datetime-local, month, time and week." ."<b>Value</b>:<ul>" ."<li> number - Specifies the minimum value allowed in the input field</li>" ."<li> date - Specifies the minimum date allowed in the input field</li></ul>"; $max = "The max attribute specifies the maximum value allowed for an input field.<br/>" ."<b>Tip:</b> The max attribute can be used together with the min attribute to create a range of legal values.<br/>" ."<b>Note:</b> The max and min attributes works with the following input types: number, range, date, datetime, datetime-local, month, time and week." ."<b>Value</b>:<ul>" ."<li> number - Specifies the maximum value allowed in the input field</li>" ."<li> date - Specifies the maximum date allowed in the input field</li></ul>"; $step = "The step attribute specifies the legal number intervals for an input field (if step='3', legal numbers could be -3,0,3,6, etc).<br/>" ."<b>Tip:</b> The step attribute can be used together with the max and min attributes to create a range of legal values.<br/>" ."<b>Note:</b> The step, max, and min attributes works with the following input types: number, range, date, datetime, datetime-local, month, time and week.<br/>" ."<b>Value:</b> <i>number</i> Specifies the legal number intervals for the input field."; $valuedate ="A string representing a date.<br/>" ."<b>Value:</b> A valid full-date as defined in [RFC 3339], with the additional qualification that the year component is four or more digits representing a number greater than 0."; $valueemail ="A single e-mail address or a list of valid e-mail addresses separated with comma.<br>" ."<b>Value:</b><br/>" ."Any string that matches the following [ABNF] production: <br/><br/>" ."<i> 1*( atext / '.' ) '@' ldh-str 1*( '.' ldh-str ) </i><br/><br/>" ."...where atext is as defined in [RFC 5322], and ldh-str is as defined in [RFC 1034].<br/>" ."<b>Example</b><br/>" ."<i>foo-bar.baz@example.com</i>"; $valuecolor ="An string representing a color.<br/>" ."<b>Value:</b> A string exactly seven characters long, consisting of the following parts, in exactly the following order: <ol>" ."<li>A '#' character.</li>" ."<li>Six characters in the range 0–9, a–f, and A–F.</li></ol>" ."<b>Note:</b> Color keywords (for example, strings such as 'red' or 'green') are not allowed."; $separator = "Text that separates the elements within a group. For space use &amp; nbsp; word"; $text = "This not a standard HTML5 attribute. It set the text which should appear near to radio button"; $offval = "This not a standard HTML5 attribute. It determines the value which will be posted to the server if the checkbox in not checked."; //============================ $data ="An object containing extra data that should be submitted along with the form. <br/>This is a name:value pair separated with comma. <b>Note</b> Enter a valid json like &quot; mykey &quot; : &quot; myval &quot; "; $dataType ="Expected data type of the response. One of: null, 'xml', 'script', or 'json'. The dataType option provides a means for specifying how the server response should be handled. This maps directly to the jQuery.httpData method. The following values are supported: <br/> 'xml': if dataType == 'xml' the server response is treated as XML and the 'success' callback method, if specified, will be passed the responseXML value <br/>'json': if dataType == 'json' the server response will be evaluted and passed to the 'success' callback, if specified <br/>'script': if dataType == 'script' the server response is evaluated in the global context <br/>Default value: null"; $resetForm = "Boolean flag indicating whether the form should be reset if the submit is successful"; $clearForm = "Boolean flag indicating whether the form should be cleared if the submit is successful"; $iframe ="Boolean flag indicating whether the form should always target the server response to an iframe. This is useful in conjuction with file uploads. See the File Uploads documentation on the Code Samples page for more info. "; $iframeSrc = "String value that should be used for the iframe's src attribute when/if an iframe is used.<br/>Default value: about:blank<br/>Default value for pages that use https protocol: javascript:false"; $forceSync = "Boolean value. Set to true to remove short delay before posting form when uploading files (or using the iframe option). The delay is used to allow the browser to render DOM updates prior to performing a native form submit. This improves usability when displaying notifications to the user, such as 'Please Wait...' "; $beforeSerialize = "Callback function to be invoked before the form is serialized. This provides an opportunity to manipulate the form before it's values are retrieved. The beforeSerialize function is invoked with two arguments: the jQuery object for the form, and the Options Object passed into ajaxForm/ajaxSubmit. "; $beforeSubmit ="Callback function to be invoked before the form is submitted. The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for validating the form data. If the 'beforeSubmit' callback returns false then the form will not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data in array format, the jQuery object for the form, and the Options Object passed into ajaxForm/ajaxSubmit. "; $success ="Callback function to be invoked after the form has been submitted. If a 'success' callback function is provided it is invoked after the response has been returned from the server. It is passed the following arguments: <br/><ol><li>responseText or responseXML value (depending on the value of the dataType option).</li><li>statusText</li><li>xhr (or the jQuery-wrapped form element if using jQuery < 1.4)</li><li>jQuery-wrapped form element (or undefined if using jQuery < 1.4)</li></ol>"; $jscode = "Java Script code to be executed when the page renders."; $jsevent = "Valid event name for the form or input element"; $jseventcode = "Java Script code associated with this event."; $phpcode_b = "PHP Script code to be executed before the creation of the instance."; $phpcode_r = "PHP Script code to be executed before the renderer class."; $formlayout = "Defines the layout of the form. It can be: one column or two column.<br/> When one couln layout is used the label element is placed above the input element.<br> If a two colukmn layout is used the label element is places left(or right) to input element creating a table with two columns one for the label the other for the input element."; $formheader = "A text which is placed at top at the form. This is the caption of the form."; $formicon = "A valid name of icon from jQuery UI Theme roller. The icon is placed at left(right) of the caption of the form. The element is valid only if the form header attribute is set."; $tablestyle = "The inline style attributes for table element with the input elements."; $labelstyle = "Common inline style attributes for the labels column(s)"; $datastyle = "Common inline style attributes for the data (input elemens) column(s)"; $formfooter ="Text which is placed at bottom of the form"; $dbtype = "Select the database driver used."; $conname ="The name of the connection. This name later can be used in the generated script to get and set data. "; $connstring ="The connection string which create the connection. The string should contain a pair name=value separated by (;). <br/>Valid are the following values <i>host, database, user, password</i>. Additionally the following can be used too : <i>charset, port</i>. <br/><b>Example:</b> <br/> host=localhost;database=northwind;user=root;password=mypass"; $createconn = "If you plan to use your own connection set this to no, otherwiese the script will generate the needed connection code."; $sqlstring = "Enter the SQL query to build and fill the fields into the form. Note that the query can be a diffrent from the table below."; $table = "A table name from the database where the data will be submitted. The use of priimary key is mantadory."; $tblkeys = "The primary key or a list of keys separated by comma. This field is mantadory and without this setting the data will not be saved into the database.<br/> The script automatically detect if the row exists in the database and if not create a new record."; $serialkey = "Check this if the primary key is serial (autoincrement)"; ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/lang/info_en_GB.inc
PHP
gpl2
29,898
ul.jqueryFileTree { font-family: Verdana, sans-serif; font-size: 11px; line-height: 18px; padding: 0px; margin: 0px; } ul.jqueryFileTree li { list-style: none; padding: 0px; padding-left: 20px; margin: 0px; white-space: nowrap; } ul.jqueryFileTree a { color: #333; text-decoration: none; display: block; padding: 0px 2px; } /* ul.jqueryFileTree a:hover { background: #BDF; } */ ul.jqueryFileTree a { border: 0px none !important; } /* Core Styles */ .jqueryFileTree li.directory { background: url(images/directory.png) left top no-repeat; } .jqueryFileTree li.expanded { background: url(images/folder_open.png) left top no-repeat; } .jqueryFileTree li.file { background: url(images/file.png) left top no-repeat; } .jqueryFileTree li.wait { background: url(images/spinner.gif) left top no-repeat; } /* File Extensions*/ .jqueryFileTree li.ext_3gp { background: url(images/film.png) left top no-repeat; } .jqueryFileTree li.ext_afp { background: url(images/code.png) left top no-repeat; } .jqueryFileTree li.ext_afpa { background: url(images/code.png) left top no-repeat; } .jqueryFileTree li.ext_asp { background: url(images/code.png) left top no-repeat; } .jqueryFileTree li.ext_aspx { background: url(images/code.png) left top no-repeat; } .jqueryFileTree li.ext_avi { background: url(images/film.png) left top no-repeat; } .jqueryFileTree li.ext_bat { background: url(images/application.png) left top no-repeat; } .jqueryFileTree li.ext_bmp { background: url(images/picture.png) left top no-repeat; } .jqueryFileTree li.ext_c { background: url(images/code.png) left top no-repeat; } .jqueryFileTree li.ext_cfm { background: url(images/code.png) left top no-repeat; } .jqueryFileTree li.ext_cgi { background: url(images/code.png) left top no-repeat; } .jqueryFileTree li.ext_com { background: url(images/application.png) left top no-repeat; } .jqueryFileTree li.ext_cpp { background: url(images/code.png) left top no-repeat; } .jqueryFileTree li.ext_css { background: url(images/css.png) left top no-repeat; } .jqueryFileTree li.ext_doc { background: url(images/doc.png) left top no-repeat; } .jqueryFileTree li.ext_exe { background: url(images/application.png) left top no-repeat; } .jqueryFileTree li.ext_gif { background: url(images/picture.png) left top no-repeat; } .jqueryFileTree li.ext_fla { background: url(images/flash.png) left top no-repeat; } .jqueryFileTree li.ext_h { background: url(images/code.png) left top no-repeat; } .jqueryFileTree li.ext_htm { background: url(images/html.png) left top no-repeat; } .jqueryFileTree li.ext_html { background: url(images/html.png) left top no-repeat; } .jqueryFileTree li.ext_jar { background: url(images/java.png) left top no-repeat; } .jqueryFileTree li.ext_jpg { background: url(images/picture.png) left top no-repeat; } .jqueryFileTree li.ext_jpeg { background: url(images/picture.png) left top no-repeat; } .jqueryFileTree li.ext_js { background: url(images/script.png) left top no-repeat; } .jqueryFileTree li.ext_lasso { background: url(images/code.png) left top no-repeat; } .jqueryFileTree li.ext_log { background: url(images/txt.png) left top no-repeat; } .jqueryFileTree li.ext_m4p { background: url(images/music.png) left top no-repeat; } .jqueryFileTree li.ext_mov { background: url(images/film.png) left top no-repeat; } .jqueryFileTree li.ext_mp3 { background: url(images/music.png) left top no-repeat; } .jqueryFileTree li.ext_mp4 { background: url(images/film.png) left top no-repeat; } .jqueryFileTree li.ext_mpg { background: url(images/film.png) left top no-repeat; } .jqueryFileTree li.ext_mpeg { background: url(images/film.png) left top no-repeat; } .jqueryFileTree li.ext_ogg { background: url(images/music.png) left top no-repeat; } .jqueryFileTree li.ext_pcx { background: url(images/picture.png) left top no-repeat; } .jqueryFileTree li.ext_pdf { background: url(images/pdf.png) left top no-repeat; } .jqueryFileTree li.ext_php { background: url(images/php.png) left top no-repeat; } .jqueryFileTree li.ext_png { background: url(images/picture.png) left top no-repeat; } .jqueryFileTree li.ext_ppt { background: url(images/ppt.png) left top no-repeat; } .jqueryFileTree li.ext_psd { background: url(images/psd.png) left top no-repeat; } .jqueryFileTree li.ext_pl { background: url(images/script.png) left top no-repeat; } .jqueryFileTree li.ext_py { background: url(images/script.png) left top no-repeat; } .jqueryFileTree li.ext_rb { background: url(images/ruby.png) left top no-repeat; } .jqueryFileTree li.ext_rbx { background: url(images/ruby.png) left top no-repeat; } .jqueryFileTree li.ext_rhtml { background: url(images/ruby.png) left top no-repeat; } .jqueryFileTree li.ext_rpm { background: url(images/linux.png) left top no-repeat; } .jqueryFileTree li.ext_ruby { background: url(images/ruby.png) left top no-repeat; } .jqueryFileTree li.ext_sql { background: url(images/db.png) left top no-repeat; } .jqueryFileTree li.ext_swf { background: url(images/flash.png) left top no-repeat; } .jqueryFileTree li.ext_tif { background: url(images/picture.png) left top no-repeat; } .jqueryFileTree li.ext_tiff { background: url(images/picture.png) left top no-repeat; } .jqueryFileTree li.ext_txt { background: url(images/txt.png) left top no-repeat; } .jqueryFileTree li.ext_vb { background: url(images/code.png) left top no-repeat; } .jqueryFileTree li.ext_wav { background: url(images/music.png) left top no-repeat; } .jqueryFileTree li.ext_wmv { background: url(images/film.png) left top no-repeat; } .jqueryFileTree li.ext_xls { background: url(images/xls.png) left top no-repeat; } .jqueryFileTree li.ext_xml { background: url(images/code.png) left top no-repeat; } .jqueryFileTree li.ext_zip { background: url(images/zip.png) left top no-repeat; }
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/themes/jqueryFileTree.css
CSS
gpl2
5,756
/*Grid*/ .ui-jqgrid {position: relative; font-size:11px;} .ui-jqgrid .ui-jqgrid-view {position: relative;left:0px; top: 0px; padding: .0em;} /* caption*/ .ui-jqgrid .ui-jqgrid-titlebar {padding: .3em .2em .2em .3em; position: relative; border-left: 0px none;border-right: 0px none; border-top: 0px none;} .ui-jqgrid .ui-jqgrid-title { float: left; margin: .1em 0 .2em; } .ui-jqgrid .ui-jqgrid-titlebar-close { position: absolute;top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height:18px;}.ui-jqgrid .ui-jqgrid-titlebar-close span { display: block; margin: 1px; } .ui-jqgrid .ui-jqgrid-titlebar-close:hover { padding: 0; } /* header*/ .ui-jqgrid .ui-jqgrid-hdiv {position: relative; margin: 0em;padding: 0em; overflow-x: hidden; overflow-y: auto; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;} .ui-jqgrid .ui-jqgrid-hbox {float: left; padding-right: 20px;} .ui-jqgrid .ui-jqgrid-htable {table-layout:fixed;margin:0em;} .ui-jqgrid .ui-jqgrid-htable th {height:22px;padding: 0 2px 0 2px;} .ui-jqgrid .ui-jqgrid-htable th div {overflow: hidden; position:relative; height:17px;} .ui-th-column, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column {overflow: hidden;white-space: nowrap;text-align:center;border-top : 0px none;border-bottom : 0px none;} .ui-th-ltr, .ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr {border-left : 0px none;} .ui-th-rtl, .ui-jqgrid .ui-jqgrid-htable th.ui-th-rtl {border-right : 0px none;} .ui-jqgrid .ui-th-div-ie {white-space: nowrap; zoom :1; height:17px;} .ui-jqgrid .ui-jqgrid-resize {height:20px !important;position: relative; cursor :e-resize;display: inline;overflow: hidden;} .ui-jqgrid .ui-grid-ico-sort {overflow:hidden;position:absolute;display:inline; cursor: pointer !important;} .ui-jqgrid .ui-icon-asc {margin-top:-3px; height:12px;} .ui-jqgrid .ui-icon-desc {margin-top:3px;height:12px;} .ui-jqgrid .ui-i-asc {margin-top:0px;height:16px;} .ui-jqgrid .ui-i-desc {margin-top:0px;margin-left:13px;height:16px;} .ui-jqgrid .ui-jqgrid-sortable {cursor:pointer;} .ui-jqgrid tr.ui-search-toolbar th { border-top-width: 1px !important; border-top-color: inherit !important; border-top-style: ridge !important } tr.ui-search-toolbar input {margin: 1px 0px 0px 0px} tr.ui-search-toolbar select {margin: 1px 0px 0px 0px} /* body */ .ui-jqgrid .ui-jqgrid-bdiv {position: relative; margin: 0em; padding:0; overflow: auto; text-align:left;} .ui-jqgrid .ui-jqgrid-btable {table-layout:fixed; margin:0em; outline-style: none; } .ui-jqgrid tr.jqgrow { outline-style: none; } .ui-jqgrid tr.jqgroup { outline-style: none; } .ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;} .ui-jqgrid tr.jqgfirstrow td {padding: 0 2px 0 2px;border-right-width: 1px; border-right-style: solid;} .ui-jqgrid tr.jqgroup td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;} .ui-jqgrid tr.jqfoot td {font-weight: bold; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;} .ui-jqgrid tr.ui-row-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;} .ui-jqgrid tr.ui-row-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;} .ui-jqgrid td.jqgrid-rownum { padding: 0 2px 0 2px; margin: 0px; border: 0px none;} .ui-jqgrid .ui-jqgrid-resize-mark { width:2px; left:0; background-color:#777; cursor: e-resize; cursor: col-resize; position:absolute; top:0; height:100px; overflow:hidden; display:none; border:0 none;} /* footer */ .ui-jqgrid .ui-jqgrid-sdiv {position: relative; margin: 0em;padding: 0em; overflow: hidden; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;} .ui-jqgrid .ui-jqgrid-ftable {table-layout:fixed; margin-bottom:0em;} .ui-jqgrid tr.footrow td {font-weight: bold; overflow: hidden; white-space:nowrap; height: 21px;padding: 0 2px 0 2px;border-top-width: 1px; border-top-color: inherit; border-top-style: solid;} .ui-jqgrid tr.footrow-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;} .ui-jqgrid tr.footrow-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;} /* Pager*/ .ui-jqgrid .ui-jqgrid-pager { border-left: 0px none !important;border-right: 0px none !important; border-bottom: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px;white-space: nowrap;overflow: hidden;} .ui-jqgrid .ui-pager-control {position: relative;} .ui-jqgrid .ui-pg-table {position: relative; padding-bottom:2px; width:auto; margin: 0em;} .ui-jqgrid .ui-pg-table td {font-weight:normal; vertical-align:middle; padding:1px;} .ui-jqgrid .ui-pg-button { height:19px !important;} .ui-jqgrid .ui-pg-button span { display: block; margin: 1px; float:left;} .ui-jqgrid .ui-pg-button:hover { padding: 0px; } .ui-jqgrid .ui-state-disabled:hover {padding:1px;} .ui-jqgrid .ui-pg-input { height:13px;font-size:.8em; margin: 0em;} .ui-jqgrid .ui-pg-selbox {font-size:.8em; line-height:18px; display:block; height:18px; margin: 0em;} .ui-jqgrid .ui-separator {height: 18px; border-left: 1px solid #ccc ; border-right: 1px solid #ccc ; margin: 1px; float: right;} .ui-jqgrid .ui-paging-info {font-weight: normal;height:19px; margin-top:3px;margin-right:4px;} .ui-jqgrid .ui-jqgrid-pager .ui-pg-div {padding:1px 0;float:left;list-style-image:none;list-style-position:outside;list-style-type:none;position:relative;} .ui-jqgrid .ui-jqgrid-pager .ui-pg-button { cursor:pointer; } .ui-jqgrid .ui-jqgrid-pager .ui-pg-div span.ui-icon {float:left;margin:0 2px;} .ui-jqgrid td input, .ui-jqgrid td select .ui-jqgrid td textarea { margin: 0em;} .ui-jqgrid td textarea {width:auto;height:auto;} .ui-jqgrid .ui-jqgrid-toppager {border-left: 0px none !important;border-right: 0px none !important; border-top: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px !important;white-space: nowrap;overflow: hidden;} /*subgrid*/ .ui-jqgrid .ui-jqgrid-btable .ui-sgcollapsed span {display: block;} .ui-jqgrid .ui-subgrid {margin:0em;padding:0em; width:100%;} .ui-jqgrid .ui-subgrid table {table-layout: fixed;} .ui-jqgrid .ui-subgrid tr.ui-subtblcell td {height:18px;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;} .ui-jqgrid .ui-subgrid td.subgrid-data {border-top: 0px none !important;} .ui-jqgrid .ui-subgrid td.subgrid-cell {border-width: 0px 0px 1px 0px;} .ui-jqgrid .ui-th-subgrid {height:20px;} /* loading */ .ui-jqgrid .loading {position: absolute; top: 45%;left: 45%;width: auto;z-index:101;padding: 6px; margin: 5px;text-align: center;font-weight: bold;display: none;border-width: 2px !important;} .ui-jqgrid .jqgrid-overlay {display:none;z-index:100;} * html .jqgrid-overlay {width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');} * .jqgrid-overlay iframe {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');} /* end loading div */ /* toolbar */ .ui-jqgrid .ui-userdata {border-left: 0px none; border-right: 0px none; height : 21px;overflow: hidden; } /*Modal Window */ .ui-jqdialog { display: none; width: 300px; position: absolute; padding: .2em; font-size:11px; overflow:visible;} .ui-jqdialog .ui-jqdialog-titlebar { padding: .3em .2em; position: relative; } .ui-jqdialog .ui-jqdialog-title { margin: .1em 0 .2em; } .ui-jqdialog .ui-jqdialog-titlebar-close { position: absolute; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } .ui-jqdialog .ui-jqdialog-titlebar-close span { display: block; margin: 1px; } .ui-jqdialog .ui-jqdialog-titlebar-close:hover, .ui-jqdialog .ui-jqdialog-titlebar-close:focus { padding: 0; } .ui-jqdialog-content, .ui-jqdialog .ui-jqdialog-content { border: 0; padding: .3em .2em; background: none; height:auto;} .ui-jqdialog .ui-jqconfirm {padding: .4em 1em; border-width:3px;position:absolute;bottom:10px;right:10px;overflow:visible;display:none;height:80px;width:220px;text-align:center;} /* end Modal window*/ /* Form edit */ .ui-jqdialog-content .FormGrid {margin: 0px;} .ui-jqdialog-content .EditTable { width: 100%; margin-bottom:0em;} .ui-jqdialog-content .DelTable { width: 100%; margin-bottom:0em;} .EditTable td input, .EditTable td select, .EditTable td textarea {margin: 0em;} .EditTable td textarea { width:auto; height:auto;} .ui-jqdialog-content td.EditButton {text-align: right;border-top: 0px none;border-left: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;} .ui-jqdialog-content td.navButton {text-align: center; border-left: 0px none;border-top: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;} .ui-jqdialog-content input.FormElement {padding:.3em} .ui-jqdialog-content .data-line {padding-top:.1em;border: 0px none;} .ui-jqdialog-content .CaptionTD {text-align: left; vertical-align: middle;border: 0px none; padding: 2px;white-space: nowrap;} .ui-jqdialog-content .DataTD {padding: 2px; border: 0px none; vertical-align: top;} .ui-jqdialog-content .form-view-data {white-space:pre} .fm-button { display: inline-block; margin:0 4px 0 0; padding: .4em .5em; text-decoration:none !important; cursor:pointer; position: relative; text-align: center; zoom: 1; } .fm-button-icon-left { padding-left: 1.9em; } .fm-button-icon-right { padding-right: 1.9em; } .fm-button-icon-left .ui-icon { right: auto; left: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px; } .fm-button-icon-right .ui-icon { left: auto; right: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px;} #nData, #pData { float: left; margin:3px;padding: 0; width: 15px; } /* End Eorm edit */ /*.ui-jqgrid .edit-cell {}*/ .ui-jqgrid .selected-row, div.ui-jqgrid .selected-row td {font-style : normal;border-left: 0px none;} /* Tree Grid */ .ui-jqgrid .tree-wrap {float: left; position: relative;height: 18px;white-space: nowrap;overflow: hidden;} .ui-jqgrid .tree-minus {position: absolute; height: 18px; width: 18px; overflow: hidden;} .ui-jqgrid .tree-plus {position: absolute; height: 18px; width: 18px; overflow: hidden;} .ui-jqgrid .tree-leaf {position: absolute; height: 18px; width: 18px;overflow: hidden;} .ui-jqgrid .treeclick {cursor: pointer;} /* moda dialog */ * iframe.jqm {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');} .ui-jqgrid-dnd tr td {border-right-width: 1px; border-right-color: inherit; border-right-style: solid; height:20px} /* RTL Support */ .ui-jqgrid .ui-jqgrid-title-rtl {float:right;margin: .1em 0 .2em; } .ui-jqgrid .ui-jqgrid-hbox-rtl {float: right; padding-left: 20px;} .ui-jqgrid .ui-jqgrid-resize-ltr {float: right;margin: -2px -2px -2px 0px;} .ui-jqgrid .ui-jqgrid-resize-rtl {float: left;margin: -2px 0px -1px -3px;} .ui-jqgrid .ui-sort-rtl {left:0px;} .ui-jqgrid .tree-wrap-ltr {float: left;} .ui-jqgrid .tree-wrap-rtl {float: right;} .ui-jqgrid .ui-ellipsis {text-overflow:ellipsis; -moz-binding:url('ellipsis-xbl.xml#ellipsis');}
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/themes/ui.jqgrid.css
CSS
gpl2
11,634
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ //Set the demo mode $demo = false; // Set the project dir $projectdir = '/home/tony/public_html/jqform/demo/'; // // in the projecdir create a file named jqformconfig.php with // the following variables /* $SERVER_HOST = "http://localhost/"; // the host name $SELF_PATH = "~tony/jqform/juliatest/"; // the web path to the project without http $CODE_PATH = "/home/tony/public_html/jqform/php/"; // the physical path to the project */ // You can omit these values, but you will need to open the generated file // and replace it ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/form_conf.inc.php
PHP
gpl2
651
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ $SERVER_HOST = ""; // the host name $SELF_PATH = ""; // the web path to the project without http $CODE_PATH = "../php/"; // the physical path to the php files ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/projects/jqformconfig.php
PHP
gpl2
280
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input email Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autocomplete"> Autocomplete </label> </td> <td> <select id="autocomplete" name="autocomplete" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="on">On</option><option value="off">Off</option></select> </td> <td class="help" title="<?php echo $autocomplete?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="list"> List </label> </td> <td> <input type="text" id="list" style="width:98%;" name="list" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $list?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="maxlength"> Maximal length </label> </td> <td> <input type="text" id="maxlength" style="width:98%;" name="maxlength" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $maxlength?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="pattern"> Regular Expression </label> </td> <td> <input type="text" id="pattern" style="width:98%;" name="pattern" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $pattern?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="readonly"> Readonly </label> </td> <td> <input type="checkbox" id="readonly" name="readonly" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $readonly?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="size"> Size </label> </td> <td> <input type="text" id="size" style="width:98%;" name="size" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $size?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="placeholder"> Placeholder </label> </td> <td> <input type="text" id="placeholder" style="width:98%;" name="placeholder" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $placeholder?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="multiple"> Multiple </label> </td> <td> <select id="multiple" name="multiple" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="multiple">Multiple</option></select> </td> <td class="help" title="<?php echo $multiple2?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $valueemail?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_email.php
PHP
gpl2
5,727
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Select Properties"></span> Select Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="size"> Size </label> </td> <td> <input type="text" id="size" style="width:98%;" name="size" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $size2?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="multiple"> Multiple </label> </td> <td> <select id="multiple" name="multiple" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="multiple">Multiple</option></select> </td> <td class="help" title="<?php echo $multiple?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="datalist"> Data List </label> </td> <td> <input type="text" id="datalist" style="width:98%;" name="datalist" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $datalist?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="datasql"> Data SQL </label> </td> <td> <input type="text" id="datasql" style="width:98%;" name="datasql" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $datasql?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_select.php
PHP
gpl2
3,961
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input Checkbox Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="checked"> Checked </label> </td> <td> <input type="checkbox" id="checked" name="checked" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $checked?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui" value="on"/> </td> <td class="help" title="<?php echo $value?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="offval"> Off Value </label> </td> <td> <input type="text" id="offval" style="width:98%;" name="offval" class="ui-widget-content ui-corner-all input-ui" value="off"/> </td> <td class="help" title="<?php echo $offval?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_checkbox.php
PHP
gpl2
3,580
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input Password Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="maxlength"> Maximal length </label> </td> <td> <input type="text" id="maxlength" style="width:98%;" name="maxlength" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $maxlength?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="readonly"> Readonly </label> </td> <td> <input type="checkbox" id="readonly" name="readonly" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $readonly?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="size"> Size </label> </td> <td> <input type="text" id="size" style="width:98%;" name="size" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $size?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $value?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="list"> List </label> </td> <td> <input type="text" id="list" style="width:98%;" name="list" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $list?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="pattern"> Regular Expression </label> </td> <td> <input type="text" id="pattern" style="width:98%;" name="pattern" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $pattern?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="placeholder"> Placeholder </label> </td> <td> <input type="text" id="placeholder" style="width:98%;" name="placeholder" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $placeholder?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_password.php
PHP
gpl2
4,900
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input Datetime Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autocomplete"> Autocomplete </label> </td> <td> <select id="autocomplete" name="autocomplete" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="on">On</option><option value="off">Off</option></select> </td> <td class="help" title="<?php echo $autocomplete?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="list"> List </label> </td> <td> <input type="text" id="list" name="list" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $list?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="min"> Min </label> </td> <td> <input type="text" id="min" name="min" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $min?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="max"> Max </label> </td> <td> <input type="text" id="max" name="max" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $max?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="step"> Step </label> </td> <td> <input type="text" id="step" name="step" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $step?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="readonly"> Readonly </label> </td> <td> <input type="checkbox" id="readonly" name="readonly" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $readonly?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $valuedate?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_datetime.php
PHP
gpl2
4,920
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Reset Button Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $value?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_reset.php
PHP
gpl2
2,591
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input Number Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autocomplete"> Autocomplete </label> </td> <td> <select id="autocomplete" name="autocomplete" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="on">On</option><option value="off">Off</option></select> </td> <td class="help" title="<?php echo $autocomplete?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="list"> List </label> </td> <td> <input type="text" id="list" name="list" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $list?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="min"> Min </label> </td> <td> <input type="text" id="min" name="min" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $min?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="max"> Max </label> </td> <td> <input type="text" id="max" name="max" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $max?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="step"> Step </label> </td> <td> <input type="text" id="step" name="step" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $step?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="readonly"> Readonly </label> </td> <td> <input type="checkbox" id="readonly" name="readonly" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $readonly?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $value?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_number.php
PHP
gpl2
4,914
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input url Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autocomplete"> Autocomplete </label> </td> <td> <select id="autocomplete" name="autocomplete" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="on">On</option><option value="off">Off</option></select> </td> <td class="help" title="<?php echo $autocomplete?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="list"> List </label> </td> <td> <input type="text" id="list" style="width:98%;" name="list" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $list?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="maxlength"> Maximal length </label> </td> <td> <input type="text" id="maxlength" style="width:98%;" name="maxlength" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $maxlength?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="pattern"> Regular Expression </label> </td> <td> <input type="text" id="pattern" style="width:98%;" name="pattern" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $pattern?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="readonly"> Readonly </label> </td> <td> <input type="checkbox" id="readonly" name="readonly" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $readonly?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="size"> Size </label> </td> <td> <input type="text" id="size" style="width:98%;" name="size" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $size?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="placeholder"> Placeholder </label> </td> <td> <input type="text" id="placeholder" style="width:98%;" name="placeholder" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $placeholder?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $value?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_url.php
PHP
gpl2
5,327
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input Range Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autocomplete"> Autocomplete </label> </td> <td> <select id="autocomplete" name="autocomplete" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="on">On</option><option value="off">Off</option></select> </td> <td class="help" title="<?php echo $autocomplete?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="list"> List </label> </td> <td> <input type="text" id="list" name="list" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $list?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="min"> Min </label> </td> <td> <input type="text" id="min" name="min" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $min?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="max"> Max </label> </td> <td> <input type="text" id="max" name="max" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $max?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="step"> Step </label> </td> <td> <input type="text" id="step" name="step" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $step?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="readonly"> Readonly </label> </td> <td> <input type="checkbox" id="readonly" name="readonly" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $readonly?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $value?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_range.php
PHP
gpl2
4,913
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input Date Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autocomplete"> Autocomplete </label> </td> <td> <select id="autocomplete" name="autocomplete" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="on">On</option><option value="off">Off</option></select> </td> <td class="help" title="<?php echo $autocomplete?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="list"> List </label> </td> <td> <input type="text" id="list" name="list" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $list?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="min"> Min </label> </td> <td> <input type="text" id="min" name="min" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $min?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="max"> Max </label> </td> <td> <input type="text" id="max" name="max" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $max?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="step"> Step </label> </td> <td> <input type="text" id="step" name="step" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $step?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="readonly"> Readonly </label> </td> <td> <input type="checkbox" id="readonly" name="readonly" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $readonly?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $valuedate?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_date.php
PHP
gpl2
4,916
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Button Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $value?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_button.php
PHP
gpl2
2,585
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input Text Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="maxlength"> Maximal length </label> </td> <td> <input type="text" id="maxlength" style="width:98%;" name="maxlength" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $maxlength?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="readonly"> Readonly </label> </td> <td> <input type="checkbox" id="readonly" name="readonly" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $readonly?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="size"> Size </label> </td> <td> <input type="text" id="size" style="width:98%;" name="size" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $size?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $value?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autocomplete"> Autocomplete </label> </td> <td> <select id="autocomplete" name="autocomplete" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="on">On</option><option value="off">Off</option></select> </td> <td class="help" title="<?php echo $autocomplete?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="list"> List </label> </td> <td> <input type="text" id="list" style="width:98%;" name="list" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $list?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="pattern"> Regular Expression </label> </td> <td> <input type="text" id="pattern" style="width:98%;" name="pattern" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $pattern?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="placeholder"> Placeholder </label> </td> <td> <input type="text" id="placeholder" style="width:98%;" name="placeholder" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $placeholder?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_text.php
PHP
gpl2
5,324
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> File Upload Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="accept"> Accept </label> </td> <td> <input type="text" id="accept" style="width:98%;" name="accept" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $accept?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="multiple"> Multiple </label> </td> <td> <select id="multiple" name="multiple" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="multiple">Multiple</option></select> </td> <td class="help" title="<?php echo $multiple2?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_file.php
PHP
gpl2
3,307
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="width:35%;height:0px"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Image Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="alt"> Alt </label> </td> <td> <input type="text" id="alt" name="alt" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $alt?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="src"> Source </label> </td> <td> <input type="text" id="src" name="src" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $src?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="formaction"> Form Action </label> </td> <td> <input type="text" id="formaction" name="formaction" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $formaction?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="formenctype"> Form MIME Type </label> </td> <td> <select id="formenctype" name="formenctype" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="text/plain">text/plain</option><option value="multipart/form-data">multipart/form-data</option><option value="application/x-www-form-urlencoded">application/x-www-form-urlencoded</option></select> </td> <td class="help" title="<?php echo $formenctype?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="formmethod"> Form Method </label> </td> <td> <select id="formmethod" name="formmethod" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="post">POST</option><option value="get">GET</option></select> </td> <td class="help" title="<?php echo $formmethod?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="formtarget"> Form Target </label> </td> <td> <input type="text" id="formtarget" name="formtarget" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $formtarget?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="formnovalidate"> Form No Validate </label> </td> <td> <input type="checkbox" id="formnovalidate" name="formnovalidate" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $formnovalidate?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="width"> Width </label> </td> <td> <input type="text" id="width" name="width" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $width?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="height"> Height </label> </td> <td> <input type="text" id="height" name="height" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $height?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_image.php
PHP
gpl2
5,219
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input Radio Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="checked"> Checked </label> </td> <td> <input type="checkbox" id="checked" name="checked" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $checked?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $value?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="text"> Text * </label> </td> <td> <input type="text" id="text" style="width:98%;" name="text" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $text?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_radio.php
PHP
gpl2
3,543
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_form" action=""> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Form Properties </div> </td> </tr> <tr class="otherparam"> <td> <label for="accept-charset"> Accept charset </label> </td> <td> <input type="text" id="accept-charset" name="accept-charset" maxlength="300" class="ui-widget-content ui-corner-all input-ui" style="width:98%;"/> </td> <td class="help" title="<?php echo $acccept_charset?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td style=""> <label for="action"> Action </label> </td> <td> <input type="text" id="action" name="action" maxlength="300" class="ui-widget-content ui-corner-all input-ui" style="width:98%;"/> </td> <td class="help" title="<?php echo $action?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autocomplete"> Autocomplete </label> </td> <td> <select id="autocomplete" name="autocomplete" class="ui-widget-content ui-corner-all select-ui"> <option value="">Select</option> <option value="on">On</option> <option value="off">Off</option> </select> </td> <td class="help" title="<?php echo $autocomplete?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="enctype"> Enctype </label> </td> <td> <select id="enctype" name="enctype" class="ui-widget-content ui-corner-all select-ui"> <option value="">Select</option> <option value="text/plain">text/plain</option> <option value="multipart/form-data">multipart/form-data</option> <option value="application/x-www-form-urlencoded">application/x-www-form-urlencoded</option> </select> </td> <td class="help" title="<?php echo $enctype?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="method"> Method </label> </td> <td> <select id="method" name="method" class="ui-widget-content ui-corner-all select-ui"><option selected value="post">POST</option><option value="get">GET</option></select> </td> <td class="help" title="<?php echo $method?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="novalidate"> No Validate </label> </td> <td> <input type="checkbox" id="novalidate" name="novalidate" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $novalidate?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="target"> Target </label> </td> <td> <select id="target" name="target" class="ui-widget-content ui-corner-all select-ui"><option selected value="">Select</option><option value="_blank">Blank</option><option value="_self">Self</option><option value="_parent">Parent</option><option value="_top">Top</option></select> </td> <td class="help" title="<?php echo $target?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_form.php
PHP
gpl2
3,911
<tr class="globalparam"> <td style="width:35%;"> <label for="accesskey"> Accesskey </label> </td> <td> <input style="width:98%;" type="text" id="accesskey" name="accesskey" maxlength="50" class="ui-widget-content ui-corner-all input-ui" /> </td> <td class="help" title="<?php echo $accesskey?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="globalparam"> <td> <label for="class"> Class </label> </td> <td> <input style="width:98%;" type="text" id="class" name="class" maxlength="300" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $class?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="globalparam"> <td> <label for="contenteditable"> Content editable </label> </td> <td> <select id="contenteditable" name="contenteditable" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="true">True</option><option value="false">False</option><option value="inherit">Inherit</option></select> </td> <td class="help" title="<?php echo $contenteditable?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="globalparam"> <td> <label for="contextmenu"> Context menu </label> </td> <td> <input style="width:98%;" type="text" id="contextmenu" name="contextmenu" size="10" maxlength="50" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $contextmenu?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="globalparam"> <td> <label for="dir"> Direction </label> </td> <td> <select id="dir" name="dir" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="ltr">ltr</option><option value="rtl">rtl</option><option value="auto">auto</option></select> </td> <td class="help" title="<?php echo $dir?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="globalparam"> <td> <label for="draggable"> Draggable </label> </td> <td> <select id="draggable" name="draggable" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="auto">Auto</option><option value="true">Yes</option><option value="false">No</option></select> </td> <td class="help" title="<?php echo $draggable?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="globalparam"> <td> <label for="dropzone"> Drop zone </label> </td> <td> <select id="dropzone" name="dropzone" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="copy">Copy</option><option value="move">Move</option><option value="link">Link</option></select> </td> <td class="help" title="<?php echo $dropzone?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="globalparam"> <td> <label for="hidden"> Hidden </label> </td> <td> <input type="checkbox" id="hidden" name="hidden" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $hidden?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="globalparam"> <td> <label for="id"> Id </label> </td> <td> <input style="width:98%;" type="text" id="id" name="id" maxlength="50" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $id?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="globalparam"> <td> <label for="lang"> Language code </label> </td> <td> <input style="width:98%;" type="text" id="lang" name="lang" maxlength="50" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $lang?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="globalparam"> <td> <label for="spellcheck"> Spelling and grammar</label> </td> <td> <select id="spellcheck" name="spellcheck" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="true">Yes</option><option value="false">No</option></select> </td> <td class="help" title="<?php echo $spellcheck?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="globalparam"> <td> <label for="style"> Style </label> </td> <td> <input style="width:98%;" type="text" id="style" name="style" maxlength="300" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $style?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="globalparam"> <td> <label for="tabindex"> Tabindex </label> </td> <td> <input style="width:98%;" type="text" id="tabindex" name="tabindex" maxlength="300" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $tabindex?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="globalparam"> <td> <label for="title"> Title </label> </td> <td> <input style="width:98%;" type="text" id="title" name="title" maxlength="300" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $title?>"><span class='ui-icon ui-icon-info'></span></td> </tr>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/global_attr.inc
HTML
gpl2
5,348
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input Hidden Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $value?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_hidden.php
PHP
gpl2
2,266
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input url Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autocomplete"> Autocomplete </label> </td> <td> <select id="autocomplete" name="autocomplete" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="on">On</option><option value="off">Off</option></select> </td> <td class="help" title="<?php echo $autocomplete?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="list"> List </label> </td> <td> <input type="text" id="list" style="width:98%;" name="list" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $list?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="maxlength"> Maximal length </label> </td> <td> <input type="text" id="maxlength" style="width:98%;" name="maxlength" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $maxlength?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="pattern"> Regular Expression </label> </td> <td> <input type="text" id="pattern" style="width:98%;" name="pattern" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $pattern?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="readonly"> Readonly </label> </td> <td> <input type="checkbox" id="readonly" name="readonly" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $readonly?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="size"> Size </label> </td> <td> <input type="text" id="size" style="width:98%;" name="size" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $size?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="placeholder"> Placeholder </label> </td> <td> <input type="text" id="placeholder" style="width:98%;" name="placeholder" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $placeholder?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $value?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_tel.php
PHP
gpl2
5,327
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input Text Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="cols"> Cols </label> </td> <td> <input type="text" id="cols" name="cols" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $cols?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="maxlength"> Maximal length </label> </td> <td> <input type="text" id="maxlength" style="width:98%;" name="maxlength" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $maxlength?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="placeholder"> Placeholder </label> </td> <td> <input type="text" id="placeholder" style="width:98%;" name="placeholder" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $placeholder?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="readonly"> Readonly </label> </td> <td> <input type="checkbox" id="readonly" name="readonly" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $readonly?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="rows"> Rows </label> </td> <td> <input type="text" id="rows" style="width:98%;" name="rows" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $rows?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="wrap"> Wrap </label> </td> <td> <select id="wrap" name="wrap" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="hard">Hard</option><option value="soft">Soft</option></select> </td> <td class="help" title="<?php echo $wrap?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_textarea.php
PHP
gpl2
4,631
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input Color Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autocomplete"> Autocomplete </label> </td> <td> <select id="autocomplete" name="autocomplete" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="on">On</option><option value="off">Off</option></select> </td> <td class="help" title="<?php echo $autocomplete?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="list"> List </label> </td> <td> <input type="text" id="list" name="list" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $list?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $valuecolor?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_color.php
PHP
gpl2
3,338
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="height:0px;width:35%"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Input search Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" name="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" name="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autocomplete"> Autocomplete </label> </td> <td> <select id="autocomplete" name="autocomplete" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="on">On</option><option value="off">Off</option></select> </td> <td class="help" title="<?php echo $autocomplete?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="list"> List </label> </td> <td> <input type="text" id="list" style="width:98%;" name="list" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $list?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="maxlength"> Maximal length </label> </td> <td> <input type="text" id="maxlength" style="width:98%;" name="maxlength" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $maxlength?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="pattern"> Regular Expression </label> </td> <td> <input type="text" id="pattern" style="width:98%;" name="pattern" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $pattern?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="readonly"> Readonly </label> </td> <td> <input type="checkbox" id="readonly" name="readonly" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $readonly?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="required"> Required </label> </td> <td> <input type="checkbox" id="required" name="required" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $required?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="size"> Size </label> </td> <td> <input type="text" id="size" style="width:98%;" name="size" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $size?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="placeholder"> Placeholder </label> </td> <td> <input type="text" id="placeholder" style="width:98%;" name="placeholder" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $placeholder?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" style="width:98%;" name="value" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $value?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_search.php
PHP
gpl2
5,330
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_text"> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="width:35%;height:0px"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Submit Button Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="disabled"> Disabled </label> </td> <td> <input type="checkbox" id="disabled" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $disabled?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="form"> Form ID </label> </td> <td> <input type="text" id="form" name="form" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $form?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="value"> Value </label> </td> <td> <input type="text" id="value" name="value" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $value?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="formaction"> Form Action </label> </td> <td> <input type="text" id="formaction" name="formaction" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $formaction?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="autofocus"> Autofocus </label> </td> <td> <input type="checkbox" id="autofocus" name="autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $autofocus?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="formenctype"> Form MIME Type </label> </td> <td> <select id="formenctype" name="formenctype" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="text/plain">text/plain</option><option value="multipart/form-data">multipart/form-data</option><option value="application/x-www-form-urlencoded">application/x-www-form-urlencoded</option></select> </td> <td class="help" title="<?php echo $formenctype?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="formmethod"> Form Method </label> </td> <td> <select id="formmethod" name="formmethod" class="ui-widget-content ui-corner-all select-ui"><option value="">Select</option><option value="post">POST</option><option value="get">GET</option></select> </td> <td class="help" title="<?php echo $formmethod?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="formtarget"> Form Target </label> </td> <td> <input type="text" id="formtarget" name="formtarget" style="width:98%;" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $formtarget?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="formnovalidate"> Form No Validate </label> </td> <td> <input type="checkbox" id="formnovalidate" name="formnovalidate" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $formnovalidate?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-e" id="showglob" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Show Global Attributes"></span> Global Attributes </div> </td> </tr> <?php include 'global_attr.inc';?> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_submit.php
PHP
gpl2
4,274
<?php require_once '../lang/info_en_GB.inc'; ?> <form id="input_form" action=""> <table style="table-layout: auto;width:600px;"> <tbody> <tr> <td style="width:35%;height:0px"></td> <td style="height:0px"></td> <td style="height:0px"></td> </tr> <tr> <td colspan="3" style=""> <div class="ui-state-default ui-corner-all" style="padding:6px;"> <span class="ui-icon ui-icon-triangle-1-s" id="showother" style="float:left; margin:-2px 5px 0 0;cursor:pointer;" title="Hide Form Properties"></span> Group Properties </div> </td> </tr> <tr class="otherparam"> <td style="width:35%;"> <label for="label"> Label </label> </td> <td> <input type="text" id="label" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $label?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="separator"> Separator </label> </td> <td> <input type="text" id="separator" name="separator" style="width:98%;" maxlength="100" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $separator?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="class"> Class </label> </td> <td> <input type="text" id="class" name="class" style="width:98%;" maxlength="400" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $class?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr class="otherparam"> <td> <label for="style"> Style </label> </td> <td> <input type="text" id="style" name="style" style="width:98%;" maxlength="400" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $style?>"><span class='ui-icon ui-icon-info'></span></td> </tr> </tbody> </table> </form>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/tmpl/input_group.php
PHP
gpl2
1,985
<!DOCTYPE html> <?php include_once("lang/info_en_GB.inc"); try { include_once 'form_conf.inc.php'; } catch (Exception $e) { $demo = false; $projectdir = ""; } if(!isset ($demo)) { $demo = false; } if(!isset ($projectdir)) { $projectdir = ""; } ?> <html lang="en" class="no-js"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>HTML5 jqForm PHP builder</title> <link rel="stylesheet" type="text/css" media="screen" href="themes/redmond/jquery-ui-1.8.13.custom.css"/> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css"/> <link rel="stylesheet" type="text/css" media="screen" href="themes/jqueryFileTree.css"/> <link rel="stylesheet" type="text/css" media="screen" href="js/codemirror/lib/codemirror.css"> <style type="text/css"> body {margin: 0px;padding:0px;width: 100%;height:100%; font: 70% Verdana, ariel, sans-serif;} .aptabs ul {width:auto;font-size:0.95em;} .ui-layout-pane { padding: 1px; overflow: auto; } .ui-tabs-nav li {position: relative;} .ui-tabs-selected a span {padding-right: 10px;} .ui-tabs-close {display: none;position: absolute;top: 3px;right: 0px;z-index: 800;width: 16px;height: 14px;font-size: 10px; font-style: normal;cursor: pointer;} .ui-tabs-selected .ui-tabs-close {display: block;} .ui-layout-north { overflow: hidden;} .ui-layout-toggler-north span {position: absolute;top: 50%; margin: -10px 0 0 0;} .ui-layout-toggler-south span {position: absolute;top: 50%; margin: -10px 0 0 0;} .ui-layout-toggler-east span {position: absolute;left: 50%; margin: 0 0 0 -9px;} .ui-layout-north {border-bottom: 0px none;} .ui-datepicker {z-index:1200;} .ui-layout-center .ui-jqgrid {font-size: 1em;border: 0px none;} .ui-layout-center .ui-jqgrid tr.jqgrow td { border-bottom: 0px none;} .hidden { position:absolute; top:0; left:-9999px; width:1px; height:1px; overflow:hidden; } .input-ui {padding :4px;} .select-ui {padding : 3px;} .textarea-ui {padding: 3px;} .globalparam {display:none;} .ui-input {padding :4px;} .ui-select {padding : 3px;} .ui-textarea {padding: 3px;} .ui-event-cell {padding: 5px;height:25px;white-space: nowrap; overflow: hidden;} .ui-grid-footer { background-image: none; font-weight: normal; text-align: left;} .CodeMirror { font-size: 1.3em;} </style> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery-ui.min.js"></script> <script type="text/javascript" src="js/jquery.layout.js"></script> <script type="text/javascript" src="js/grid.locale-en.js"></script> <script type="text/javascript" src="js/jquery.jqGrid.min.js"></script> <script type="text/javascript" src="js/jquery.jqForm.js"></script> <script type="text/javascript" src="js/jqueryFileTree.js"></script> <script type="text/javascript" src="js/jquery.form.js"></script> <script type="text/javascript" src="js/codemirror/lib/codemirror.js"></script> <script type="text/javascript" src="js/codemirror/mode/xml/xml.js"></script> <script type="text/javascript" src="js/codemirror/mode/javascript/javascript.js"></script> <script type="text/javascript" src="js/codemirror/mode/css/css.js"></script> <script type="text/javascript" src="js/codemirror/mode/clike/clike.js"></script> <script type="text/javascript" src="js/codemirror/mode/php/php.js"></script> <script type="text/javascript" src="js/modernizr-2.0.6.js"></script> <script type="text/javascript"> // searchdb translation $.jgrid.useJSON = true; var uiLayout, selected=null, filename=''; var workingdir = '<?php echo $projectdir?>'; var demo = '<?php echo $demo?>'; if(demo == 1) { demo = true; } else { demo = false; } jQuery(document).ready(function(){ //menus jQuery(window).unload(function(){ $("body > *").unbind().remove(); }); // init the editor and hide the dialog var editor, jseditor, bseditor, sbeditor, suceditor, bphpeditor, rphpeditor; //editor = ace.edit("editor"); //var JavaScriptMode = require("ace/mode/javascript").Mode; //editor.getSession().setMode(new JavaScriptMode()); editor = CodeMirror.fromTextArea(document.getElementById("editor"), { mode: "javascript", lineNumbers: true, matchBrackets: true }); $("#dialogeventcode").hide(); jseditor = CodeMirror.fromTextArea(document.getElementById("jseditor"), { mode: "javascript", lineNumbers: true, matchBrackets: true }); $("#dialogjavascript").hide(); bphpeditor = CodeMirror.fromTextArea(document.getElementById("bphpeditor"), { mode : "text/x-php", lineNumbers: true, matchBrackets: true, indentUnit: 4, indentWithTabs: true, enterMode: "keep", tabMode: "shift" }); rphpeditor = CodeMirror.fromTextArea(document.getElementById("rphpeditor"), { mode: "text/x-php", lineNumbers: true, matchBrackets: true, indentUnit: 4, indentWithTabs: true, enterMode: "keep", tabMode: "shift" }); $("#dialogphpscript").hide(); uiLayout = $('body').layout({ togglerLength_open: 35, // WIDTH of toggler on north/south edges - HEIGHT on east/west edges togglerLength_closed: 35, // "100%" OR -1 = full height hideTogglerOnSlide: true, // hide the toggler when pane is 'slid open' togglerTip_open: 'Close Pane', togglerTip_closed: 'Open Pane', resizerTip: 'Resize Pane', sliderTip: 'Slide Open', //east__initClosed: true, south__initClosed: false, resizerClass: 'ui-state-default', north__resizable:false, north__size: 33, east__size : '80%', west__resizable:true, west__size : 35, west__spacing_closed: 21, // wider space when closed west__togglerLength_closed: 21, // make toggler 'square' - 21x21 west__togglerAlign_closed: "top", // align to top of resizer west__togglerLength_open: 0, // NONE - using custom togglers INSIDE west-pane west__togglerTip_open: 'Close Pane', west__togglerTip_closed: 'Open Pane', west__resizerTip_open: 'Resize Pane', west__slideTrigger_open: "click", // default //west__onclose : function () {$(".ui-state-default-west").removeClass("ui-state-disabled");}, center__onresize: function (pane, $Pane) { jQuery("#west-grid").setGridWidth($Pane.innerWidth()-2); } }); $(".ui-layout-toggler-north").append("<span class='ui-icon ui-icon-grip-dotted-horizontal'></span>"); $(".ui-layout-toggler-south").append("<span class='ui-icon ui-icon-grip-dotted-horizontal'></span>"); $(".ui-layout-toggler-east").append("<span class='ui-icon ui-icon-grip-dotted-vertical'></span>"); // save selector strings to vars so we don't have to repeat it // must prefix paneClass with "body > " to target ONLY the outerLayout panes var maintab =jQuery('#tabs','.ui-layout-east').tabs({ spinner: 'Loading', select : function (event , ui) { if(ui.index == 2) { $.ajax({ url: "includes/createcode.php", data: {fname:filename, act:'code'}, dataType: "html", type: "POST", success: function (res, err){ $(ui.panel).html(res) } }); //$(ui.panel).load("includes/createcode.php",{fname:filename}); } if(ui.index == 3) { var pda = {fname:filename, act:'execute'}, ud = jQuery("#west-grid").jqGrid('getGridParam','userData'), pn = ud.prmnames !== undefined ? ud.prmnames.split(",") : [], pd = ud.prmdefs !== undefined ? ud.prmdefs.split(",") : []; if(pn.length) { for(var j in pn) { if( pn.hasOwnProperty(j)) pda[pn[j]] = pd[j]; } } $.ajax({ url: "includes/createcode.php", data: pda, dataType: "html", type: "POST", success: function (res, err){ $(ui.panel).html(res) } }); //$(ui.panel).load("includes/createcode.php",{fname:filename}); } //console.log(ui); } }); function hoverbutton () { $(this).toggleClass("ui-state-hover"); } jQuery("#west-grid").jqGrid({ url: "includes/readform.php", datatype: "local", height: "auto", mtype: "POST", pager: false, colNames: ["id","Form","Type", "Properties","Events"], colModel: [ {name: "id",width:1,hidden:true, key:true}, {name: "fldname", width:150, resizable: false, sortable:false}, {name: "type",width:1,hidden:true}, {name: "prop",width:1,hidden:true}, {name: "events",width:1,hidden:true} ], treeGrid: true, treeGridModel : 'adjacency', ExpandColumn: "fldname", sortname: "id", autowidth: true, loadui: "disable", ExpandColClick: true, gridview: false, rowNum: -1, //toolbar :[true, 'top'], toppager : true, xmlReader : {repeatitems:false}, treeIcons: {leaf:'ui-icon-document-b'}, onSelectRow: function(rowid) { //if(selected != rowid ) { if(selected) { jQuery.jqform.saveTreeCell(selected); jQuery.jqform.saveEvents(selected); jQuery.jqform.saveParams(); } var treedata = $("#west-grid").getRowData(rowid); $.ajax({ url:"tmpl/input_"+treedata.type+".php", dataType: "html", type: "POST", success : function(res) { $("#fcontent","#fprop").empty().append(res); $("#type","#common_data").val(treedata.type); $("#name","#common_data").val(treedata.fldname); $("#treeid","#common_data").val(treedata.id); //$("#label","#fprop").val(); jQuery.jqform.restoreCell(treedata.prop, treedata.events); selected = rowid; $(".help").tooltip(); if(treedata.type == 'form' || treedata.type =='group') { $("#type","#common_data").attr("disabled","disabled"); } else { $("#type","#common_data").removeAttr("disabled"); } } }); //} } //loadError: false }); jQuery.jqform.newForm( false ); jQuery("#west-grid").jqGrid('navGrid','#west-grid_toppager',{add:false, edit:false, search:false,refresh:false, del:false}); $("#type","#common_data").change(function(){ var tv = $(this).val(); if(tv == "form" || tv =="group") { return ;} var ico = $("#e"+tv+" span:first").attr('class'); ico = ico.replace("ui-button-icon-primary",""); ico = $.trim(ico.replace("ui-icon","")); jQuery("#west-grid").jqGrid('setRowData', selected,{'type':$(this).val(),'icon':ico}); var ind =jQuery("#west-grid").jqGrid('getInd',selected); var excol = jQuery("#west-grid").jqGrid('getGridParam','expColInd'); $("td:eq("+excol+")", "#"+selected).empty().html( $("#name","#common_data").val()); jQuery("#west-grid").jqGrid('setTreeNode',ind, ind+1); jQuery("#west-grid").jqGrid('setSelection', selected); }); jQuery("#west-grid").jqGrid('navButtonAdd', '#west-grid_toppager',{ title:"Move element up", buttonicon : 'ui-icon-arrowthick-1-n', caption: '', onClickButton : function (e) { var sr = $(this).jqGrid('getGridParam','selrow'); if(sr && sr != "1") { var ind = this.p._index[sr]; var sd = this.p.data[ind]; var pr = sd.parent, prev=null; if(pr > '1') { prev = $("#"+sr).prev(); if(prev && prev[0] && prev[0].id) { var ind2 = this.p._index[prev[0].id]; var sd2 = this.p.data[ind2]; if(sd2.parent == pr) { $("#"+sr).insertBefore(prev); this.p.data[ind2] = this.p.data[ind]; this.p.data[ind] = sd2; this.refreshIndex(); } } } else if(pr == '1'){ var childmain = $(this).jqGrid('getNodeChildren',sd); prev = $("#"+sr).prev(); if(prev && prev[0] && prev[0].id) { if (prev[0].id != '1') { childmain.splice(0,0,sd); var ind2 = this.p._index[prev[0].id]; var sd2 = this.p.data[ind2]; var par = $(this).jqGrid('getNodeParent',sd2), childs; if(par.parent === null || par.parent == '__EMPTY_STRING_' || par.parent == '' || par.parent.toLowerCase() == 'null') { childs =[]; } else { childs = $(this).jqGrid('getNodeChildren',par); } if(childs.length) { //var iti = childs[childs.length-1]; prev = $("#"+par.id); ind2 = this.p._index[par.id]; sd2 = this.p.data[ind2]; } var cln = childmain.length; for(var i=0; i<cln; i++) { $("#"+childmain[i].id).insertBefore(prev); //$("#"+childmain[i].id).insertAfter(next); } var testme = this.p.data.splice(ind,cln); for (i=0; i<cln; i++) { this.p.data.splice(ind2,0,testme[cln-1-i]); } this.refreshIndex(); } } } } } }); jQuery("#west-grid").jqGrid('navButtonAdd', '#west-grid_toppager',{ title:"Move element down", buttonicon : 'ui-icon-arrowthick-1-s', caption: '', onClickButton : function (e) { var sr = $(this).jqGrid('getGridParam','selrow'); if(sr && sr != "1") { var ind = this.p._index[sr]; var sd = this.p.data[ind]; var pr = sd.parent, next=null; if(pr > '1') { next = $("#"+sr).next(); if(next && next[0] && next[0].id) { var ind2 = this.p._index[next[0].id]; var sd2 = this.p.data[ind2]; if(sd2.parent == pr) { $("#"+sr).insertAfter(next); this.p.data[ind2] = this.p.data[ind]; this.p.data[ind] = sd2; this.refreshIndex(); } } } else if(pr == '1') { var childmain = $(this).jqGrid('getNodeChildren',sd); var sr1=null; if(childmain.length) { sr1 = childmain[childmain.length-1].id; } if(sr1) { next = $("#"+sr1).next(); } else { next = $("#"+sr).next(); } childmain.splice(0,0,sd); if(next && next[0] && next[0].id) { var ind2 = this.p._index[next[0].id]; var sd2 = this.p.data[ind2]; var childs = $(this).jqGrid('getNodeChildren',sd2); if(childs.length) { var iti = childs[childs.length-1]; next = $("#"+iti.id); ind2 = this.p._index[iti.id]; sd2 = this.p.data[ind2]; } var cln = childmain.length; for(var i=cln-1; i>=0; i--) { $("#"+childmain[i].id).insertAfter(next); } var testme = this.p.data.splice(ind,cln); for (i=cln-1; i>=0; i--) this.p.data.splice(ind2-(cln-1),0,testme[i]); this.refreshIndex(); } } } } }); jQuery("#west-grid").jqGrid('navSeparatorAdd', '#west-grid_toppager'); jQuery("#west-grid").jqGrid('navButtonAdd', '#west-grid_toppager',{ title:"Delete element", buttonicon : 'ui-icon-trash', caption: '', onClickButton : function (e) { sr = $(this).jqGrid('getGridParam','selrow'); if(sr && sr != "1") { $("#deldialog").dialog({ height: 150, width: 250, modal: true, close : function () { $(this).dialog( 'destroy' ); }, buttons: [ { text : "Ok", click : function () { if(sr && sr != "1") { jQuery("#west-grid").jqGrid("delTreeNode", sr); $( this ).dialog( "close" ); } } }, { text : "Cancel", click : function () { $( this ).dialog( "close" ); } } ] }); } } }); $( "#etext" ).button({ icons: { primary: "ui-icon-newwin" }, text : false }).click(function(){ $.jqform.addTreeElement("text", "ui-icon-newwin"); }); $( "#epassword" ).button({ icons: { primary: "ui-icon-locked" }, text : false }).click(function(){ $.jqform.addTreeElement("password", "ui-icon-locked"); }); $( "#echeckbox" ).button({ icons: { primary: "ui-icon-check" }, text : false }).click(function(){ $.jqform.addTreeElement("checkbox", "ui-icon-check"); }); $( "#eradio" ).button({ icons: { primary: "ui-icon-radio-on" }, text : false }).click(function(){ $.jqform.addTreeElement("radio", "ui-icon-radio-on"); }); $( "#eselect" ).button({ icons: { primary: "ui-icon-circle-triangle-s" }, text : false }).click(function(){ $.jqform.addTreeElement("select", "ui-icon-circle-triangle-s"); }); $( "#etextarea" ).button({ icons: { primary: "ui-icon-gripsmall-diagonal-se" }, text : false }).click(function(){ $.jqform.addTreeElement("textarea", "ui-icon-gripsmall-diagonal-se"); }); $( "#ebutton" ).button({ icons: { primary: "ui-icon-battery-0" }, text : false }).click(function(){ $.jqform.addTreeElement("button", "ui-icon-battery-0"); }); $( "#esubmit" ).button({ icons: { primary: "ui-icon-play" }, text : false }).click(function(){ $.jqform.addTreeElement("submit", "ui-icon-play"); }); $( "#ereset" ).button({ icons: { primary: "ui-icon-stop" }, text : false }).click(function(){ $.jqform.addTreeElement("reset", "ui-icon-stop"); }); $( "#efile" ).button({ icons: { primary: "ui-icon-document-b" }, text : false }).click(function(){ $.jqform.addTreeElement("file", "ui-icon-document-b"); }); $( "#ehidden" ).button({ icons: { primary: "ui-icon-clipboard" }, text : false }).click(function(){ $.jqform.addTreeElement("hidden", "ui-icon-clipboard"); }); $( "#eimage" ).button({ icons: { primary: "ui-icon-image" }, text : false }).click(function(){ $.jqform.addTreeElement("image", "ui-icon-image"); }); $( "#edate" ).button({ icons: { primary: "ui-icon-calendar" }, text : false }).click(function(){ $.jqform.addTreeElement("date", "ui-icon-calendar"); }); $( "#enumber" ).button({ icons: { primary: "ui-icon-calculator" }, text : false }).click(function(){ $.jqform.addTreeElement("number", "ui-icon-calculator"); }); $( "#erange" ).button({ icons: { primary: "ui-icon-arrow-2-e-w" }, text : false }).click(function(){ $.jqform.addTreeElement("range", "ui-icon-arrow-2-e-w"); }); $( "#eemail" ).button({ icons: { primary: "ui-icon-mail-closed" }, text : false }).click(function(){ $.jqform.addTreeElement("email", "ui-icon-mail-closed"); }); $( "#eurl" ).button({ icons: { primary: "ui-icon-link" }, text : false }).click(function(){ $.jqform.addTreeElement("url", "ui-icon-link"); }); $( "#esearch" ).button({ icons: { primary: "ui-icon-search" }, text : false }).click(function(){ $.jqform.addTreeElement("search", "ui-icon-search"); }); $( "#etel" ).button({ icons: { primary: "ui-icon-volume-off" }, text : false }).click(function(){ $.jqform.addTreeElement("tel", "ui-icon-volume-off"); }); $( "#ecolor" ).button({ icons: { primary: "ui-icon-bookmark" }, text : false }).click(function(){ $.jqform.addTreeElement("color", "ui-icon-bookmark"); }); $( "#egroup" ).button({ icons: { primary: "ui-icon-carat-2-e-w" }, text : false }).click(function(){ $.jqform.addTreeElement("group", "ui-icon-carat-2-e-w"); }); $("#showglob").live('click',function() { if ( $( this ).hasClass("ui-icon-triangle-1-e")) { $(".globalparam").show(); $(this).attr("title","Hide Global Attributes") .removeClass("ui-icon-triangle-1-e") .addClass("ui-icon-triangle-1-s") } else { $(".globalparam").hide(); $(this).attr("title","Show Global Attributes") .removeClass("ui-icon-triangle-1-s") .addClass("ui-icon-triangle-1-e") } //$( this ).button( "option", options ); return false; }); $("#showother").live('click',function() { if ( $( this ).hasClass("ui-icon-triangle-1-e")) { $(".otherparam").show(); $(this).attr("title","Hide Form Attributes") .removeClass("ui-icon-triangle-1-e") .addClass("ui-icon-triangle-1-s") } else { $(".otherparam").hide(); $(this).attr("title","Show Form Attributes") .removeClass("ui-icon-triangle-1-s") .addClass("ui-icon-triangle-1-e") } //$( this ).button( "option", options ); return false; }); var trevent=null; $(".editcode").live('click',function(e){ trevent = $(this).parent("td").parent("tr")[0]; $( "#dialogeventcode" ).dialog( "option", "title", "Edit Event"); $( "#dialogeventcode" ).dialog( "open" ); }); $(".delcode").live('click',function(e){ trevent = $(this).parent("td").parent("tr"); $("#deldialog").dialog({ height: 150, width: 250, modal: true, close : function () { $(this).dialog( 'destroy' ); trevent = null; }, buttons: [ { text : "Ok", click : function () { $(trevent).remove(); $( this ).dialog( "close" ); } }, { text : "Cancel", click : function () { $( this ).dialog( "close" ); } } ] }); }); $( "#dialogeventcode" ).dialog({ autoOpen : false, height: 'auto', width: 600, modal: false, open: function(event, ui) { // get the data and set it in the editor if(trevent !== null) { $("#event_name").val( "" ); $.jqform.editorSetValue( " ", editor ); //editor.getSession().setValue( ""); var e_n = $(".eventname", trevent).text(); var e_c = $(".eventcode", trevent).text(); e_c = $.jgrid.htmlDecode( e_c ); //e_c = e_c.replace(new RegExp( "&#010;", "g" ), "\n"); $.jqform.editorSetValue( e_c, editor ); //editor.getSession().setValue(e_c); $("#event_name").val( e_n ); } else { // new event $("#event_name").val( "" ); $.jqform.editorSetValue( "function(event) \n{\n}", editor ); //editor.getSession().setValue( "function(event) \n{\n \n}"); } }, close : function() { trevent = null; //$(this).dialog('destroy'); }, buttons: [ { text : "Save", click : function () { var i, n; if(trevent === null) { var trtins=""; i = $("#event_name").val( ); if( $.trim(i) == "" ) { alert("Please enter a event name!"); return; } //n = editor.getSession().getValue(); n = $.jqform.editorGetValue( editor ); n = $.jgrid.htmlEncode( n ); //n = n.replace(new RegExp( "\n", "g" ), "&#010;"); trtins += "<tr><td class='ui-event-cell eventname'>"+i+"</td>"; trtins += "<td class='ui-event-cell eventcode'>"+ n +"</td>"; trtins += "<td class='ui-event-cell eventactions' style='text-align: right;'> <button class='editcode'>Edit Event</button> <button class='delcode'>Delete Event</button></td>"; trtins += "</tr>"; $(".eventtable tbody").append(trtins); trevent = $("tr:last",".eventtable")[0]; $( ".editcode", trevent ).button({ icons: { primary: "ui-icon-pencil" }, text : false }); $( ".delcode" ).button({ icons: { primary: "ui-icon-trash" }, text : false }); } else { i = $("#event_name").val( ); //n = editor.getSession().getValue(); n = $.jqform.editorGetValue( editor ); n = $.jgrid.htmlEncode( n ); //n = n.replace(new RegExp( "\n", "g" ), "&#010;"); $(".eventcode", trevent).html( n ); $(".eventname", trevent).html( i ); } } }, { text: "Exit", click : function () { $( this ).dialog( "close" ); } } ] }); $( "#dialogjavascript" ).dialog({ autoOpen : false, height: 'auto', width: 630, modal: true, open: function(event, ui) { // get the data and set it in the editor var jsc = jQuery("#west-grid").jqGrid('getGridParam','userData'); jsc = jsc['javascript']; jsc = $.jgrid.htmlDecode( jsc ); if(jsc === undefined) { jsc =""; } $.jqform.editorSetValue( jsc, jseditor ); }, close : function() { //$(this).dialog('destroy'); }, buttons: [ { text : "Save", click : function () { var n; n = $.jqform.editorGetValue( jseditor ); n = $.jgrid.htmlEncode( n ); if(n === undefined) { n = ""; } jQuery("#west-grid").jqGrid('setGridParam',{userData:{"javascript": n}}); } }, { text: "Exit", click : function () { $( this ).dialog( "close" ); } } ] }); $( "#dialogphpscript" ).dialog({ autoOpen : false, height: 450, width: 630, modal: true, open: function(event, ui) { // get the data and set it in the editor var jsc = jQuery("#west-grid").jqGrid('getGridParam','userData'); jsc = jsc['bphpscript']; jsc = $.jgrid.htmlDecode( jsc ); if(jsc === undefined) { jsc =""; } $.jqform.editorSetValue( jsc, bphpeditor ); var jsc1 = jQuery("#west-grid").jqGrid('getGridParam','userData'); jsc1 = jsc1['rphpscript']; jsc1 = $.jgrid.htmlDecode( jsc1 ); if(jsc1 === undefined) { jsc1 =""; } $.jqform.editorSetValue( jsc1, rphpeditor ); }, close : function() { //$(this).dialog('destroy'); }, buttons: [ { text : "Save", click : function () { var n, n1; n = $.jqform.editorGetValue( bphpeditor ); n = $.jgrid.htmlEncode( n ); if(n === undefined) { n = ""; } n1 = $.jqform.editorGetValue( rphpeditor ); n1 = $.jgrid.htmlEncode( n1 ); if(n1 === undefined) { n1 = ""; } jQuery("#west-grid").jqGrid('setGridParam',{userData:{"bphpscript": n, "rphpscript": n1}}); } }, { text: "Exit", click : function () { $( this ).dialog( "close" ); } } ] }); $( "#dialogajax" ).dialog({ autoOpen : false, height: '450', width: 630, modal: true, open: function(event, ui) { if(!bseditor) { bseditor = CodeMirror.fromTextArea(document.getElementById("beforeSerialize"), { mode: "javascript", lineNumbers: true, matchBrackets: true }); } if(!suceditor) { suceditor = CodeMirror.fromTextArea(document.getElementById("success"), { mode: "javascript", lineNumbers: true, matchBrackets: true }); } if(!sbeditor) { sbeditor = CodeMirror.fromTextArea(document.getElementById("beforeSubmit"), { mode: "javascript", lineNumbers: true, matchBrackets: true }); } // get the data and set it in the editor var ajaxdata = jQuery("#west-grid").jqGrid('getGridParam','userData'), ajval; ajval = ajaxdata.ajax_data ? ajaxdata.ajax_data : "" ; $("#data", this).val( $.jgrid.htmlDecode(ajval) ); ajval = ajaxdata.ajax_dataType ? ajaxdata.ajax_dataType : "" ; $("#dataType", this).val(ajval); ajval = ajaxdata.ajax_beforeSerialize ? ajaxdata.ajax_beforeSerialize : "" ; $.jqform.editorSetValue($.jgrid.htmlDecode(ajval), bseditor); ajval = ajaxdata.ajax_beforeSubmit ? ajaxdata.ajax_beforeSubmit : "" ; //$("#beforeSubmit", this).val(ajval); $.jqform.editorSetValue($.jgrid.htmlDecode(ajval), sbeditor); ajval = ajaxdata.ajax_success ? ajaxdata.ajax_success : "" ; //$("#success", this).val(ajval); $.jqform.editorSetValue($.jgrid.htmlDecode(ajval), suceditor); ajval = ajaxdata.ajax_resetForm ? ajaxdata.ajax_resetForm : "" ; $("#resetForm", this).val(ajval); ajval = ajaxdata.ajax_clearForm ? ajaxdata.ajax_clearForm : "" ; $("#clearForm", this).val(ajval); ajval = ajaxdata.ajax_iframe ? ajaxdata.ajax_iframe : "" ; $("#iframe", this).val(ajval); ajval = ajaxdata.ajax_iframeSrc ? ajaxdata.ajax_iframeSrc : "" ; $("#iframeSrc", this).val(ajval); ajval = ajaxdata.ajax_forceSync ? ajaxdata.ajax_forceSync : "" ; $("#forceSync", this).val(ajval); }, close : function() { //$(this).dialog('destroy'); }, buttons: [ { text : "Save", click : function () { var data = {}; $("input, select", "#aform").each(function(){ data["ajax_"+this.id] = $.jgrid.htmlEncode( this.value ); }); var n = $.jqform.editorGetValue( bseditor ); data["ajax_beforeSerialize"] = $.jgrid.htmlEncode( n ); //var str = xmlJsonClass.toJson(data, '', '', false); n = $.jqform.editorGetValue( sbeditor ); data["ajax_beforeSubmit"] = $.jgrid.htmlEncode( n ); var n = $.jqform.editorGetValue( suceditor ); data["ajax_success"] = $.jgrid.htmlEncode( n ); jQuery("#west-grid").jqGrid('setGridParam',{userData: data}); } }, { text: "Exit", click : function () { $( this ).dialog( "close" ); } } ] }); $( "#addeventcode" ).button({ icons: { primary: "ui-icon-plus" } }).click(function(){ trevent = null; $( "#dialogeventcode" ).dialog( "option", "title", "New Event"); $( "#dialogeventcode" ).dialog( "open" ); }); $( "#bsave" ).button({ icons: { primary: "ui-icon-disk" } }).click(function(){ if( filename == '') { $("#dialogsave").dialog( "open"); } else { if( selected ) { jQuery.jqform.saveTreeCell(selected); jQuery.jqform.saveEvents(selected); jQuery.jqform.saveParams(); } jQuery.jqform.saveToServer( filename) ; } }); $( "#bopen" ).button({ icons: { primary: "ui-icon-folder-open" } }).click(function(){ $( "#dialoglist" ).dialog( "open" ); }); /* $( "#bpower" ).button({ icons: { primary: "ui-icon-power" }, text : false }); */ $( "#bnew" ).button({ icons: { primary: "ui-icon-document-b" } }).click(function(){ jQuery.jqform.newForm( true ); filename = ''; }); $("#name","#common_data").change(function(){ var trid = $("#treeid","#common_data").val(); if(trid) { jQuery("#west-grid").jqGrid('setCell',trid,'fldname',$(this).val()); } }); $('#filelist').fileTree({root: workingdir, "script":"includes/jqueryFileTree.php" }, function(file, filetype) { if(filetype=='file') { filename = file; $( "#dialoglist" ).dialog( "close" ); selected = null; if(demo) { jQuery("#selname").html( filename.replace(workingdir,"") ); } else { jQuery("#selname").html(filename); } jQuery("#west-grid").jqGrid('clearGridData'); jQuery("#grid_params").jqGrid('clearGridData'); jQuery("#west-grid").jqGrid('setGridParam',{treedatatype:'xml', postData:{fname:filename}}); jQuery("#west-grid").trigger('reloadGrid'); setTimeout(function(){ jQuery("#west-grid").jqGrid('setSelection', 1); var userdata = jQuery("#west-grid").jqGrid('getGridParam', 'userData'); if(userdata.formheader) { $("#formheader").val(userdata.formheader); } if(userdata.formicon) { $("#formicon").val(userdata.formicon); } if(userdata.formfooter) { $("#formfooter").val(userdata.formfooter); } if(userdata.tablestyle) { $("#tablestyle").val(userdata.tablestyle); } if(userdata.labelstyle) { $("#labelstyle").val(userdata.labelstyle); } if(userdata.datastyle) { $("#datastyle").val(userdata.datastyle); } if(userdata.dbtype) { $("#dbtype").val(userdata.dbtype); } if(userdata.conname) { $("#conname").val(userdata.conname); } if(userdata.connstring) { $("#connstring").val(userdata.connstring); } // if(userdata.sqlstring) { $("#sqlstring").val(userdata.sqlstring); } if(userdata.table) { $("#table").val(userdata.table); } if(userdata.tblkeys) { $("#tblkeys").val(userdata.tblkeys); } if(userdata.prmnames) { var pnm = userdata.prmnames.split(","); var ptp = userdata.prmtypes.split(","); var pdf = userdata.prmdefs.split(","); for(var i in pnm) { jQuery("#grid_params").jqGrid('addRowData',undefined, {prm_name:pnm[i],prm_type:ptp[i], prm_def:pdf[i]}, 'last'); } } if(userdata.createconn) { $("#createconn").val(userdata.createconn); } if(userdata.serialkey) { if(userdata.serialkey == "yes") { $("#serialkey")[!!($.fn.prop) ? 'prop' : 'attr']("checked", true); } } },300); } }); $("#dialoglist").dialog({ autoOpen: false, height: 300, width: 450, modal: true, open : function(ui, ev) { $("#filelist").empty(); $("#filelist")[0].showTree ( $("#filelist"), escape(workingdir)); }, buttons: { Cancel : function () { $( this ).dialog( "close" ); } } }); var saveallowed = false; $("#dialogsave").dialog({ autoOpen: false, height: 350, width: 450, modal: true, buttons: { Save : function (){ if(saveallowed ) { filename = $("#dir_name_tosave").val(); } else { var fnts = $.trim($("#f_name_tosave").val()); if( fnts ) { if( fnts.toLowerCase().indexOf(".xml") === -1) { fnts += ".xml"; } filename = $("#dir_name_tosave").val()+fnts; if(selected) { jQuery.jqform.saveTreeCell(selected); jQuery.jqform.saveEvents(selected); jQuery.jqform.saveParams(); } jQuery.jqform.saveToServer( filename ); if( demo ) { jQuery("#selname").html(fnts); } else { jQuery("#selname").html(filename); } $( this ).dialog( "close" ); } else { alert("please enter file") } } }, Cancel : function () { $( this ).dialog( "close" ); } } }); setTimeout(function(){ $('<table "style=width:90%;table-layout:auto;"><tr id="fr_dir"><td style="padding-left:8px">Dir</td><td style="width:94%;"><input id="dir_name_tosave" value="'+workingdir+'" readonly style="width:95%;"/></td></tr><tr><td style="padding-left:8px">File</td><td style="width:94%;"><input id="f_name_tosave" value="" style="width:95%;" /></td></tr></table>').insertBefore("#dialogsave");//'<input id="f_name_tosave" value="" style="width:100%;"/><br/>'); if(demo) { $("#fr_dir").hide(); } },200); $('#savelist').fileTree({root: workingdir, "script":"includes/jqueryFileTree.php" }, function(file, filetype) { if(filetype=='file') { $("#dir_name_tosave").val(file); saveallowed = true; } else { saveallowed = false; $("#dir_name_tosave").val(file); } }); $( "#bsetting" ).button({ icons: { primary: "ui-icon-gear" } }).click(function(){ $("#dialogset").dialog( "open" ); }); $( "#bdbase" ).button({ icons: { primary: "ui-icon-pencil" } }).click(function(){ $("#dialogconn").dialog("open"); }); $( "#bdbsource" ).button({ icons: { primary: "ui-icon-contact" } }).click(function(){ $("#dialogsource").dialog("open"); }); $( "#bajax" ).button({ icons: { primary: "ui-icon-refresh" } }).click(function(){ $("#dialogajax").dialog("open"); }); $( "#bjavascript" ).button({ icons: { primary: "ui-icon-comment" } }).click(function(){ $( "#dialogjavascript" ).dialog( "open"); }); $( "#bphpscript" ).button({ icons: { primary: "ui-icon-note" } }).click(function(){ $( "#dialogphpscript" ).dialog( "open"); }); $( "#bparams" ).button({ icons: { primary: "ui-icon-transferthick-e-w" } }).click(function(){ $( "#dialogparams" ).dialog( "open"); }); $( "#prm_add" ).button({ icons: { primary: "ui-icon-plus" }, text: false }).height(20).click(function(){ var fdata = $("#newparam").serializeArray(); var submitarr = true; $(fdata).each(function(){ if(this.name == "prm_name" && !this.value) { submitarr = false; return false; } }); if( submitarr ) { $( "#grid_params" ).jqGrid( "FormToGrid", undefined, "#newparam", "add", "last"); $(":input","#newparam").val(""); } return false; }); $("#dialogset").dialog({ autoOpen: false, height: 'auto', width: 550, modal: true, buttons: [ { text : "Ok", click : function() { var u0 = $("#formlayout").val(); var u1 = $("#formheader").val(); var u2 = $("#formicon").val(); var u3 = $("#formfooter").val(); var u4 = $("#tablestyle").val(); var u5 = $("#labelstyle").val(); var u6 = $("#datastyle").val(); jQuery("#west-grid").jqGrid('setGridParam',{userData:{formlayout:u0, formheader:u1, formicon:u2, formfooter:u3, tablestyle:u4, labelstyle:u5, datastyle:u6}}); $( this ).dialog( "close" ); } }, { text : "Cancel", click : function () { $( this ).dialog( "close" ); } } ] }); $("#dialogconn").dialog({ autoOpen: false, height: 'auto', width: 470, modal: true, buttons: [ { text : "Test", click : function(){ var c1 = $("#dbtype").val(); var c2 = $("#conname").val(); var c3 = $("#connstring").val(); var c4 = $("#createconn").val(); jQuery("#west-grid").jqGrid('setGridParam',{userData:{dbtype:c1, conname:c2, connstring:c3, createconn:c4}}); $.ajax({ url : "includes/testcon.php", data : {conn:c3, dbtype:c1, action:'test'}, type: "POST", dataType: "html", success : function (res){ alert(res) } }) } }, { text : "Ok", click : function() { var c1 = $("#dbtype").val(); var c2 = $("#conname").val(); var c3 = $("#connstring").val(); var c4 = $("#createconn").val(); jQuery("#west-grid").jqGrid('setGridParam',{userData:{dbtype:c1, conname:c2, connstring:c3, createconn:c4}}); $( this ).dialog( "close" ); } }, { text : "Cancel", click : function () { $( this ).dialog( "close" ); } } ] }); // Data source $("#dialogsource").dialog({ autoOpen: false, height: 'auto', width: 550, modal: true, buttons: [ { text : "Generate", click : function(){ var c1 = $("#dbtype").val(); var c3 = $("#connstring").val(); var s1 = $("#sqlstring").val(); var s2 = $("#table").val(); var s3 = $("#tblkeys").val(); jQuery("#west-grid").jqGrid('setGridParam',{userData:{dbtype:c1, connstring:c3, sqlstring: s1, table:s2, tblkeys:s3}}); $.ajax({ url : "includes/testcon.php", data : {conn:c3, dbtype:c1, sqlstring: s1, action:'genform'}, type: "POST", dataType: "json", success : function (res){ if(res.msg == "success") { jQuery.jqform.generateFromSQL( res.rows ); } else { alert(res.msg); } } }) } }, { text : "Ok", click : function() { var c1 = $("#dbtype").val(); var c3 = $("#connstring").val(); var s1 = $("#sqlstring").val(); var s2 = $("#table").val(); var s3 = $("#tblkeys").val(); var s4 = $("#createconn").val(); var s5 = $("#serialkey").is(":checked") ? "yes" : "no"; jQuery("#west-grid").jqGrid('setGridParam',{userData:{dbtype:c1, connstring:c3, sqlstring: s1, table:s2, tblkeys:s3, createconn:s4, serialkey:s5}}); $( this ).dialog( "close" ); } }, { text : "Cancel", click : function () { $( this ).dialog( "close" ); } } ] }); jQuery("#grid_params").jqGrid({ datatype: "local", height: "100", mtype: "POST", rownumbers : true, pager: "#pgrid_params", colNames: ["id","Name","Type", "Default", "Action"], colModel: [ {name: "id",width:1,hidden:true, key:true}, {name: "prm_name", width:140, resizable: false, sortable:false, editable: true}, {name: "prm_type",width:80, formatter:'select', resizable: false, sortable:false, editable: true, edittype:"select", editoptions: { value:"string:string;int:integer;numeric:numeric;bool:boolean"}}, {name: "prm_def",width:80, resizable: false, sortable:false, editable: true}, {name: "prm_act",width:50, formatter:"actions", formatoptions:{url:'clientArray', delOptions : {useDataProxy : true, closeOnEscape: true } }, editable: false, resizable: false, sortable:false} ], dataProxy : function (o, module) { if(module == "del_"+this.p.id) { $(this).jqGrid('delRowData',o.data.id); } }, sortname: "id", width: 500, viewrecords : true, pginput : false }); $("#dialogparams").dialog({ autoOpen: false, height: '300', width: 550, modal: true, buttons: [ { text : "Close", click : function () { $( this ).dialog( "close" ); } } ] }); }); </script> </head> <body> <div class="ui-layout-north ui-helper-reset ui-helper-clearfix ui-widget" > <div class="ui-widget-header ui-corner-all" style="margin-left:2px;margin-right: 2px;"> <!-- <button id="bpower" style="width:31px;">Power</button> --> <button id="bnew">New</button> <button id="bopen">Open</button> <button id="bsave">Save</button> <button id="bsetting">Settings</button> <button id="bajax">Ajax</button> <button id="bjavascript">Java Script</button> <button id="bphpscript">PHP Script</button> <button id="bdbase">Connection</button> <button id="bdbsource">Data Source</button> <button id="bparams">Parameters</button> </div> </div> <div class="ui-layout-south ui-widget ui-widget-content"> File Name: <span id="selname"></span> </div> <div class="ui-layout-east ui-widget ui-widget-content"> <div id="tabs" class="aptabs"> <ul> <li><a href="#fprop">Properties</a></li> <li><a href="#fevents">Events</a></li> <li><a href="#fcode">Code</a></li> <li><a href="#fpreview">Preview</a></li> </ul> <div id="fprop"> <div> <form id="common_data" action=""> <table style="table-layout: auto;width:606px;"> <tbody> <tr> <td style="width:35%"> <label for="type"> Type </label> </td> <td> <select id="type" name="type" class="ui-widget-content ui-corner-all select-ui" style="width:100%;"> <option disabled ="disabled" value="form">form</option> <option value="text">text</option> <option value="password">password</option> <option value="checkbox">checkbox</option> <option value="radio">radio</option> <option value="select">select</option> <option value="textarea">textarea</option> <option value="button">button</option> <option value="submit">submit</option> <option value="reset">reset</option> <option value="file">file</option> <option value="hidden">hidden</option> <option value="image">image</option> <option value="date">date</option> <option value="datetime">datetime</option> <option value="number">number</option> <option value="range">range</option> <option value="email">email</option> <option value="url">url</option> <option value="search">search</option> <option value="tel">tel</option> <option value="color">color</option> <option disabled="disabled" value="group">group</option> </select> <!-- <input type="text" id="type" style="width:97%;" disabled="disabled" class="ui-widget-content ui-corner-all input-ui ui-state-disabled"/> --> </td> <td class="help" title="Shows the type of the element in the DOM"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="name"> Name </label> </td> <td> <input type="hidden" id="treeid" /> <input type="text" id="name" name="name" style="width:97%;" autofocus = "autofocus" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="The name attribute specifies the name of a form/input element.<br/>The name attribute of the form/input element provides a way to reference the form/input in a script."><span class='ui-icon ui-icon-info'></span></td> </tr> </tbody> </table> </form> </div> <div id="fcontent"></div> </div> <div id="fevents" style="padding-top: 20px"> <div style="width:600px;max-height: 400px;overflow-y: auto;" class=""> <table class="eventtable" style="width:100%; table-layout: fixed;border: 0px none; padding: 0px;border-collapse: collapse;border-spacing: 0"> <thead> <tr> <th class="ui-state-default ui-corner-tl" style="width:20%;height:27px;">Event</th> <th class="ui-state-default" style="width:65%;height:27px;">Code</th> <th class="ui-state-default ui-corner-tr" style="width:15%;height:27px;">Action</th> </tr> </thead> <tbody> </tbody> </table> </div> <div class="ui-grid-footer ui-state-default ui-corner-bottom ui-helper-clearfix" style="width:598px;"> <button id="addeventcode" style="height:25px;border: 0px none;">Add new event</button> </div> </div> <div id="fcode"> code </div> <div id="fpreview"> preview </div> </div> <div id="dialoglist" title="Open File"> <div id="filelist" class="ui-widget"></div> </div> <div id="dialogsave" title="Save As..."> <div id="savelist" class="ui-widget"></div> </div> <div id="deldialog" title="Delete element" style="display:none"> <p>Are you sure to delete a element?</p> </div> <div id="dialogset" title="Form Settings"> <table style="width:100%;table-layout: fixed;"> <tbody> <tr> <td style="width:25%"> <label for="formlayout"> Form layout</label> </td> <td> <select name="formlayout" id="formlayout" class="ui-widget-content ui-corner-all select-ui"> <option value="twocolumn">Two Column</option> <option value="onecolumn">One Column</option> </select> </td> <td style="width:5%" class="help" title="<?php echo $formlayout?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="formheader"> Form Header:</label> </td> <td> <input name="formheader" id="formheader" class="ui-widget-content ui-corner-all input-ui" style="width:98%;"/> </td> <td class="help" title="<?php echo $formheader?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="formicon"> Form Header Icon:</label> </td> <td> <input type="text" name="formicon" value="" id="formicon" maxlength="200" class="ui-widget-content ui-corner-all input-ui" style="width:98%;"/> </td> <td class="help" title="<?php echo $formicon?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="tablestyle"> Table Form style</label> </td> <td> <input type="text" name="tablestyle" value="" id="tablestyle" maxlength="200" class="ui-widget-content ui-corner-all input-ui" style="width:98%;"/> </td> <td class="help" title="<?php echo $tablestyle?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="labelstyle"> Label Column style</label> </td> <td> <input type="text" name="labelstyle" value="" id="labelstyle" maxlength="200" class="ui-widget-content ui-corner-all input-ui" style="width:98%;"/> </td> <td class="help" title="<?php echo $labelstyle?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="datastyle"> Data Column style</label> </td> <td> <input type="text" name="datastyle" value="" id="datastyle" maxlength="200" class="ui-widget-content ui-corner-all input-ui" style="width:98%;"/> </td> <td class="help" title="<?php echo $datastyle?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td style="vertical-align:top;"> <label for="formfooter"> Form Footer:</label> </td> <td> <input type ="text" name="formfooter" id="formfooter" class="ui-widget-content ui-corner-all input-ui" style="width:98%;"/> </td> <td class="help" title="<?php echo $formfooter?>"><span class='ui-icon ui-icon-info'></span></td> </tr> </tbody> </table> </div> <div id="dialogconn" title="Connection"> <table style="width:100%;table-layout: fixed;"> <tbody> <tr> <td style="width:20%"> <label for="dbtype"> Type:</label> </td> <td> <select name="dbtype" id="dbtype" class="ui-widget-content ui-corner-all select-ui"> <option value="mysql">PDO MySQL</option> <option value="pgsql">PDO PostgreSQL</option> <option value="sqlite">PDO SQLite</option> <option value="mysqli">MySQLi</option> <option value="sqlsrv">SQL Server</option> <option value="oci8">Oracle</option> <option value="db2">DB2</option> </select> </td> <td style="width:5%" class="help" title="<?php echo $dbtype?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="conname"> Name:</label> </td> <td> <input type="text" name="conname" value="" id="conname" maxlength="200" class="ui-widget-content ui-corner-all input-ui" style="width:98%;"/> </td> <td class="help" title="<?php echo $conname?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td style="vertical-align:top"> <label for="connstring"> Connection String</label> </td> <td> <textarea cols="40" rows="3" name="connstring" id="connstring" class="ui-widget-content ui-corner-all input-ui" style="width:98%;"></textarea> </td> <td class="help" title="<?php echo $connstring?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="createconn"> Create Connection:</label> </td> <td> <select name="createconn" id="createconn" class="ui-widget-content ui-corner-all select-ui"> <option value="no">No</option> <option value="yes">Yes</option> </select> </td> <td class="help" title="<?php echo $createconn?>"><span class='ui-icon ui-icon-info'></span></td> </tr> </tbody> </table> </div> <div id="dialogsource" title="Data Source"> <table style="width:100%;table-layout: fixed;"> <tbody> <tr> <td style="vertical-align:top; width:20%;"> <label for="sqlstring"> SQL Query</label> </td> <td> <textarea cols="40" rows="3" name="sqlstring" id="sqlstring" class="ui-widget-content ui-corner-all input-ui" style="width:98%;"></textarea> </td> <td class="help" title="<?php echo $sqlstring?>" style="vertical-align:text-top;width:5%;"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="table"> Table Name:</label> </td> <td> <input type="text" name="table" value="" id="table" maxlength="200" class="ui-widget-content ui-corner-all input-ui" style="width:98%;"/> </td> <td class="help" title="<?php echo $table?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="tblkeys"> Table Key(s):</label> </td> <td> <input type="text" name="tblkeys" value="" id="tblkeys" maxlength="200" class="ui-widget-content ui-corner-all input-ui" style="width:98%;"/> </td> <td class="help" title="<?php echo $tblkeys?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="serialkey"> Serial Key:</label> </td> <td> <input type="checkbox" id="serialkey" name="serialkey" class="ui-widget-content ui-corner-all input-ui"/> </td> <td class="help" title="<?php echo $serialkey?>"><span class='ui-icon ui-icon-info'></span></td> </tr> </tbody> </table> </div> </div> <!-- events dialogue --> <div id="dialogeventcode"> <div> <label for="event_name"> Event: </label> </div> <input id="event_name" value="" class="ui-widget-content ui-corner-all input-ui" style="width:545px;"/> <span class="help" title ="<?php echo $jsevent?>" style="float:right;" ><span class='ui-icon ui-icon-info'></span></span> <div style="margin-top: 5px;"> <label for="editor" class="help" title ="<?php echo $jseventcode?>"> Code: <span class='ui-icon ui-icon-info' style="float:right;"></span> </label> </div> <textarea id="editor" style="height: 250px; width: 550px;"></textarea> </div> <div id="dialogjavascript" title="Java Script Code Editor"> <div style="margin-top: 5px;"> <label for="jseditor" class="help" title ="<?php echo $jscode?>"> Code: <span class='ui-icon ui-icon-info' style="float:right;"></span> </label> </div> <textarea id="jseditor" style="height: 250px; width: 599px;"></textarea> </div> <div id="dialogphpscript" title="PHP Script Code Editor"> <div style="margin-top: 5px;"> <label for="bphpeditor" class="help" title ="<?php echo $phpcode_b?>"> Before Create : <span class='ui-icon ui-icon-info' style="float:right;"></span> </label> </div> <textarea id="bphpeditor" style="height: 150px; width: 599px;"></textarea> <div style="margin-top: 5px;"> <label for="rphpeditor" class="help" title ="<?php echo $phpcode_r?>"> After Create: <span class='ui-icon ui-icon-info' style="float:right;"></span> </label> </div> <textarea id="rphpeditor" style="height: 150px; width: 599px;"></textarea> </div> <div id="dialogajax" title="Ajax Form Options"> <form action="" id="aform"> <table style="width:100%;table-layout: fixed;"> <tbody> <tr> <td style="width:15%"> <label for="data">data:</label> </td> <td> <input id="data" name="data" class="ui-widget-content ui-corner-all input-ui" style="width:98%" /> </td> <td style="width:5%" class="help" title="<?php echo $data?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="dataType">dataType:</label> </td> <td> <select name="dataType" id="dataType" class="ui-widget-content ui-corner-all select-ui" style=""> <option value="null">null</option> <option value="xml">xml</option> <option value="json">json</option> <option value="script">script</option> <option value="text">text</option> <option value="html">html</option> </select> </td> <td class="help" title="<?php echo $datType?>"><span class='ui-icon ui-icon-info'></span></td></tr> <tr> <td> <label for="resetForm">resetForm</label> </td> <td> <select id="resetForm" name="resetForm" class="ui-widget-content ui-corner-all select-ui" style=""> <option value="null">Select</option> <option value="true">Yes</option> <option value="false">No</option> </select> </td> <td class="help" title="<?php echo $resetForm?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="clearForm">clearForm</label> </td> <td> <select name="clearForm" id="clearForm" class="ui-widget-content ui-corner-all select-ui" style=""> <option value="null">Select</option> <option value="true">Yes</option> <option value="false">No</option> </select> </td> <td class="help" title="<?php echo $clearForm?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="iframe">iframe</label> </td> <td> <select id="iframe" name="iframe" class="ui-widget-content ui-corner-all select-ui" style=""> <option value="false">No</option> <option value="true">Yes</option> </select> </td> <td class="help" title="<?php echo $iframe?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="iframeSrc">iframeSrc</label> </td> <td> <input name="iframeSrc" id="iframeSrc" class="ui-widget-content ui-corner-all input-ui" style="width:98%" /> </td> <td class="help" title="<?php echo $iframeSrc?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td> <label for="forceSync">forceSync</label> </td> <td> <select id="forceSync" name="forceSync" class="ui-widget-content ui-corner-all select-ui" style=""> <option value="false">No</option> <option value="true">Yes</option> </select> </td> <td class="help" title="<?php echo $forceSync?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td style="vertical-align: top"> <label for="beforeSerialize">beforeSerialize:</label> </td> <td> <font color="blue">function(form, options) {</font> <textarea id="beforeSerialize" name="beforeSerialize" style="width:98%;height:80px;"></textarea> <font color="blue">}</font> </td> <td class="help" style="vertical-align: top" title="<?php echo $beforeSerialize?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td style="vertical-align: top"> <label for="beforeSubmit">beforeSubmit</label> </td> <td> <font color="blue">function(arr, form, options) {</font> <textarea name="beforeSubmit" id="beforeSubmit" class="ui-widget-content ui-corner-all input-ui" style="width:98%;height:80px;"></textarea> <font color="blue">}</font> </td> <td class="help" style="vertical-align: top" title="<?php echo $beforeSubmit?>"><span class='ui-icon ui-icon-info'></span></td> </tr> <tr> <td style="vertical-align: top"> <label for="success">success</label> </td> <td> <font color="blue">function(response, status, xhr) {</font> <textarea name="success" id="success" class="ui-widget-content ui-corner-all input-ui" style="width:98%;height:80px;"></textarea> </td> <td class="help" style="vertical-align: top" title="<?php echo $success?>"><span class='ui-icon ui-icon-info'></span></td> </tr> </tbody> </table> </form> </div> <div id="dialogparams" title="Form Parameters"> <form id="newparam" name="newparam" action="#" style="width:505"> <table style="width:500px;table-layout: fixed;"> <tbody> <tr> <td style="width:203px"> <input style="width:197px" type="text" name="prm_name" /></td> <td style="width:100px"> <select style="width:97px" name="prm_type"> <option value="string">string</option> <option value="int">integer</option> <option value="numeric">numeric</option> <option value="bool">boolean</option> </select> </td> <td style="width:100px"> <input style="width:97px" type="text" name="prm_def" /></td> <td style="text-align:center;"> <button id="prm_add"> Add Parameter</button> </td> </tr> </tbody> </table> </form> <table id="grid_params"> <tr> <td></td> </tr> </table> <div id="pgrid_params"></div> </div> <div class="ui-layout-center ui-helper-reset ui-helper-clearfix ui-widget-content"> <table id="west-grid"></table> </div> <div class="ui-layout-west ui-widget ui-widget-content"> <button id="etext" style="width:31px;">Add text element</button> <button id="epassword" style="width:31px;">Add password element</button><br/> <button id="echeckbox" style="width:31px;">Add checkbox element</button><br/> <button id="eradio" style="width:31px;">Add radio button element</button><br/> <button id="eselect" style="width:31px;">Add select element</button><br/> <button id="etextarea" style="width:31px;">Add textarea element</button><br/> <button id="ebutton" style="width:31px;">Add button element</button><br/> <button id="esubmit" style="width:31px;">Add submit button</button><br/> <button id="ereset" style="width:31px;">Add reset button</button><br/> <button id="efile" style="width:31px;">Add file element</button><br/> <button id="ehidden" style="width:31px;">Add hidden element</button><br/> <button id="eimage" style="width:31px;">Add image element</button><br/> <button id="edate" style="width:31px;">Add date element</button><br/> <button id="enumber" style="width:31px;">Add number element</button><br/> <button id="erange" style="width:31px;">Add range element</button><br/> <button id="eemail" style="width:31px;">Add email element</button><br/> <button id="eurl" style="width:31px;">Add url element</button><br/> <button id="esearch" style="width:31px;">Add search element</button><br/> <button id="etel" style="width:31px;">Add telephone element</button><br/> <button id="ecolor" style="width:31px;">Add color element</button><br/> <button id="egroup" style="width:31px;">Add Group</button> </div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jqvisualform/index.php
PHP
gpl2
59,700
<?php // ** MySQL settings ** // //define('DB_NAME', 'northwind'); // The name of the database //define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value define('DB_DSN','mysql:host=localhost;dbname=northwind'); define('DB_USER', ''); // Your MySQL username define('DB_PASSWORD', ''); // ...and password define('ABSPATH', dirname(__FILE__).'/'); //require_once(ABSPATH.'tabs.php'); ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/jq-config.php
PHP
gpl2
430
/* * jQuery UI Multiselect * * Authors: * Michael Aufreiter (quasipartikel.at) * Yanick Rochon (yanick.rochon[at]gmail[dot]com) * * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * http://www.quasipartikel.at/multiselect/ * * * Depends: * ui.core.js * ui.sortable.js * * Optional: * localization (http://plugins.jquery.com/project/localisation) * scrollTo (http://plugins.jquery.com/project/ScrollTo) * * Todo: * Make batch actions faster * Implement dynamic insertion through remote calls */ (function($) { $.widget("ui.multiselect", { _init: function() { this.element.hide(); this.id = this.element.attr("id"); this.container = $('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element); this.count = 0; // number of currently selected options this.selectedContainer = $('<div class="selected"></div>').appendTo(this.container); this.availableContainer = $('<div class="available"></div>').appendTo(this.container); this.selectedActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">0 '+$.ui.multiselect.locale.itemsCount+'</span><a href="#" class="remove-all">'+$.ui.multiselect.locale.removeAll+'</a></div>').appendTo(this.selectedContainer); this.availableActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><input type="text" class="search empty ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+$.ui.multiselect.locale.addAll+'</a></div>').appendTo(this.availableContainer); this.selectedList = $('<ul class="selected connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer); this.availableList = $('<ul class="available connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.availableContainer); var that = this; // set dimensions this.container.width(this.element.width()+1); this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation)); this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation))); // fix list height to match <option> depending on their individual header's heights this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1)); this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1)); if ( !this.options.animated ) { this.options.show = 'show'; this.options.hide = 'hide'; } // init lists this._populateLists(this.element.find('option')); // make selection sortable if (this.options.sortable) { $("ul.selected").sortable({ placeholder: 'ui-state-highlight', axis: 'y', update: function(event, ui) { // apply the new sort order to the original selectbox that.selectedList.find('li').each(function() { if ($(this).data('optionLink')) $(this).data('optionLink').remove().appendTo(that.element); }); }, receive: function(event, ui) { ui.item.data('optionLink').attr('selected', true); // increment count that.count += 1; that._updateCount(); // workaround, because there's no way to reference // the new element, see http://dev.jqueryui.com/ticket/4303 that.selectedList.children('.ui-draggable').each(function() { $(this).removeClass('ui-draggable'); $(this).data('optionLink', ui.item.data('optionLink')); $(this).data('idx', ui.item.data('idx')); that._applyItemState($(this), true); }); // workaround according to http://dev.jqueryui.com/ticket/4088 setTimeout(function() { ui.item.remove(); }, 1); } }); } // set up livesearch if (this.options.searchable) { this._registerSearchEvents(this.availableContainer.find('input.search')); } else { $('.search').hide(); } // batch actions $(".remove-all").click(function() { that._populateLists(that.element.find('option').removeAttr('selected')); return false; }); $(".add-all").click(function() { that._populateLists(that.element.find('option').attr('selected', 'selected')); return false; }); }, destroy: function() { this.element.show(); this.container.remove(); $.widget.prototype.destroy.apply(this, arguments); }, _populateLists: function(options) { this.selectedList.children('.ui-element').remove(); this.availableList.children('.ui-element').remove(); this.count = 0; var that = this; var items = $(options.map(function(i) { var item = that._getOptionNode(this).appendTo(this.selected ? that.selectedList : that.availableList).show(); if (this.selected) that.count += 1; that._applyItemState(item, this.selected); item.data('idx', i); return item[0]; })); // update count this._updateCount(); }, _updateCount: function() { this.selectedContainer.find('span.count').text(this.count+" "+$.ui.multiselect.locale.itemsCount); }, _getOptionNode: function(option) { option = $(option); var node = $('<li class="ui-state-default ui-element" title="'+option.text()+'"><span class="ui-icon"/>'+option.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide(); node.data('optionLink', option); return node; }, // clones an item with associated data // didn't find a smarter away around this _cloneWithData: function(clonee) { var clone = clonee.clone(); clone.data('optionLink', clonee.data('optionLink')); clone.data('idx', clonee.data('idx')); return clone; }, _setSelected: function(item, selected) { item.data('optionLink').attr('selected', selected); if (selected) { var selectedItem = this._cloneWithData(item); item[this.options.hide](this.options.animated, function() { $(this).remove(); }); selectedItem.appendTo(this.selectedList).hide()[this.options.show](this.options.animated); this._applyItemState(selectedItem, true); return selectedItem; } else { // look for successor based on initial option index var items = this.availableList.find('li'), comparator = this.options.nodeComparator; var succ = null, i = item.data('idx'), direction = comparator(item, $(items[i])); // TODO: test needed for dynamic list populating if ( direction ) { while (i>=0 && i<items.length) { direction > 0 ? i++ : i--; if ( direction != comparator(item, $(items[i])) ) { // going up, go back one item down, otherwise leave as is succ = items[direction > 0 ? i : i+1]; break; } } } else { succ = items[i]; } var availableItem = this._cloneWithData(item); succ ? availableItem.insertBefore($(succ)) : availableItem.appendTo(this.availableList); item[this.options.hide](this.options.animated, function() { $(this).remove(); }); availableItem.hide()[this.options.show](this.options.animated); this._applyItemState(availableItem, false); return availableItem; } }, _applyItemState: function(item, selected) { if (selected) { if (this.options.sortable) item.children('span').addClass('ui-icon-arrowthick-2-n-s').removeClass('ui-helper-hidden').addClass('ui-icon'); else item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon'); item.find('a.action span').addClass('ui-icon-minus').removeClass('ui-icon-plus'); this._registerRemoveEvents(item.find('a.action')); } else { item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon'); item.find('a.action span').addClass('ui-icon-plus').removeClass('ui-icon-minus'); this._registerAddEvents(item.find('a.action')); } this._registerHoverEvents(item); }, // taken from John Resig's liveUpdate script _filter: function(list) { var input = $(this); var rows = list.children('li'), cache = rows.map(function(){ return $(this).text().toLowerCase(); }); var term = $.trim(input.val().toLowerCase()), scores = []; if (!term) { rows.show(); } else { rows.hide(); cache.each(function(i) { if (this.indexOf(term)>-1) { scores.push(i); } }); $.each(scores, function() { $(rows[this]).show(); }); } }, _registerHoverEvents: function(elements) { elements.removeClass('ui-state-hover'); elements.mouseover(function() { $(this).addClass('ui-state-hover'); }); elements.mouseout(function() { $(this).removeClass('ui-state-hover'); }); }, _registerAddEvents: function(elements) { var that = this; elements.click(function() { var item = that._setSelected($(this).parent(), true); that.count += 1; that._updateCount(); return false; }) // make draggable .each(function() { $(this).parent().draggable({ connectToSortable: 'ul.selected', helper: function() { var selectedItem = that._cloneWithData($(this)).width($(this).width() - 50); selectedItem.width($(this).width()); return selectedItem; }, appendTo: '.ui-multiselect', containment: '.ui-multiselect', revert: 'invalid' }); }); }, _registerRemoveEvents: function(elements) { var that = this; elements.click(function() { that._setSelected($(this).parent(), false); that.count -= 1; that._updateCount(); return false; }); }, _registerSearchEvents: function(input) { var that = this; input.focus(function() { $(this).addClass('ui-state-active'); }) .blur(function() { $(this).removeClass('ui-state-active'); }) .keypress(function(e) { if (e.keyCode == 13) return false; }) .keyup(function() { that._filter.apply(this, [that.availableList]); }); } }); $.extend($.ui.multiselect, { defaults: { sortable: true, searchable: true, animated: 'fast', show: 'slideDown', hide: 'slideUp', dividerLocation: 0.6, nodeComparator: function(node1,node2) { var text1 = node1.text(), text2 = node2.text(); return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1); } }, locale: { addAll:'Add all', removeAll:'Remove all', itemsCount:'items selected' } }); })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/ui.multiselect.js
JavaScript
gpl2
10,263
// ==ClosureCompiler== // @compilation_level SIMPLE_OPTIMIZATIONS /** * @license Highcharts JS v2.2.0 (2012-02-16) * * (c) 2009-2011 Torstein Hønsi * * License: www.highcharts.com/license */ // JSLint options: /*global Highcharts, document, window, navigator, setInterval, clearInterval, clearTimeout, setTimeout, location, jQuery, $, console */ (function () { // encapsulated variables var UNDEFINED, doc = document, win = window, math = Math, mathRound = math.round, mathFloor = math.floor, mathCeil = math.ceil, mathMax = math.max, mathMin = math.min, mathAbs = math.abs, mathCos = math.cos, mathSin = math.sin, mathPI = math.PI, deg2rad = mathPI * 2 / 360, // some variables userAgent = navigator.userAgent, isIE = /msie/i.test(userAgent) && !win.opera, docMode8 = doc.documentMode === 8, isWebKit = /AppleWebKit/.test(userAgent), isFirefox = /Firefox/.test(userAgent), SVG_NS = 'http://www.w3.org/2000/svg', hasSVG = !!doc.createElementNS && !!doc.createElementNS(SVG_NS, 'svg').createSVGRect, hasBidiBug = isFirefox && parseInt(userAgent.split('Firefox/')[1], 10) < 4, // issue #38 useCanVG = !hasSVG && !isIE && !!doc.createElement('canvas').getContext, Renderer, hasTouch = doc.documentElement.ontouchstart !== UNDEFINED, symbolSizes = {}, idCounter = 0, garbageBin, defaultOptions, dateFormat, // function globalAnimation, pathAnim, timeUnits, // some constants for frequently used strings DIV = 'div', ABSOLUTE = 'absolute', RELATIVE = 'relative', HIDDEN = 'hidden', PREFIX = 'highcharts-', VISIBLE = 'visible', PX = 'px', NONE = 'none', M = 'M', L = 'L', /* * Empirical lowest possible opacities for TRACKER_FILL * IE6: 0.002 * IE7: 0.002 * IE8: 0.002 * IE9: 0.00000000001 (unlimited) * FF: 0.00000000001 (unlimited) * Chrome: 0.000001 * Safari: 0.000001 * Opera: 0.00000000001 (unlimited) */ TRACKER_FILL = 'rgba(192,192,192,' + (hasSVG ? 0.000001 : 0.002) + ')', // invisible but clickable //TRACKER_FILL = 'rgba(192,192,192,0.5)', NORMAL_STATE = '', HOVER_STATE = 'hover', SELECT_STATE = 'select', MILLISECOND = 'millisecond', SECOND = 'second', MINUTE = 'minute', HOUR = 'hour', DAY = 'day', WEEK = 'week', MONTH = 'month', YEAR = 'year', // constants for attributes FILL = 'fill', LINEAR_GRADIENT = 'linearGradient', STOPS = 'stops', STROKE = 'stroke', STROKE_WIDTH = 'stroke-width', // time methods, changed based on whether or not UTC is used makeTime, getMinutes, getHours, getDay, getDate, getMonth, getFullYear, setMinutes, setHours, setDate, setMonth, setFullYear, // check for a custom HighchartsAdapter defined prior to this file globalAdapter = win.HighchartsAdapter, adapter = globalAdapter || {}, // Utility functions. If the HighchartsAdapter is not defined, adapter is an empty object // and all the utility functions will be null. In that case they are populated by the // default adapters below. getScript = adapter.getScript, each = adapter.each, grep = adapter.grep, offset = adapter.offset, map = adapter.map, merge = adapter.merge, addEvent = adapter.addEvent, removeEvent = adapter.removeEvent, fireEvent = adapter.fireEvent, animate = adapter.animate, stop = adapter.stop, // lookup over the types and the associated classes seriesTypes = {}; // The Highcharts namespace win.Highcharts = {}; /** * Extend an object with the members of another * @param {Object} a The object to be extended * @param {Object} b The object to add to the first one */ function extend(a, b) { var n; if (!a) { a = {}; } for (n in b) { a[n] = b[n]; } return a; } /** * Take an array and turn into a hash with even number arguments as keys and odd numbers as * values. Allows creating constants for commonly used style properties, attributes etc. * Avoid it in performance critical situations like looping */ function hash() { var i = 0, args = arguments, length = args.length, obj = {}; for (; i < length; i++) { obj[args[i++]] = args[i]; } return obj; } /** * Shortcut for parseInt * @param {Object} s * @param {Number} mag Magnitude */ function pInt(s, mag) { return parseInt(s, mag || 10); } /** * Check for string * @param {Object} s */ function isString(s) { return typeof s === 'string'; } /** * Check for object * @param {Object} obj */ function isObject(obj) { return typeof obj === 'object'; } /** * Check for array * @param {Object} obj */ function isArray(obj) { return Object.prototype.toString.call(obj) === '[object Array]'; } /** * Check for number * @param {Object} n */ function isNumber(n) { return typeof n === 'number'; } function log2lin(num) { return math.log(num) / math.LN10; } function lin2log(num) { return math.pow(10, num); } /** * Remove last occurence of an item from an array * @param {Array} arr * @param {Mixed} item */ function erase(arr, item) { var i = arr.length; while (i--) { if (arr[i] === item) { arr.splice(i, 1); break; } } //return arr; } /** * Returns true if the object is not null or undefined. Like MooTools' $.defined. * @param {Object} obj */ function defined(obj) { return obj !== UNDEFINED && obj !== null; } /** * Set or get an attribute or an object of attributes. Can't use jQuery attr because * it attempts to set expando properties on the SVG element, which is not allowed. * * @param {Object} elem The DOM element to receive the attribute(s) * @param {String|Object} prop The property or an abject of key-value pairs * @param {String} value The value if a single property is set */ function attr(elem, prop, value) { var key, setAttribute = 'setAttribute', ret; // if the prop is a string if (isString(prop)) { // set the value if (defined(value)) { elem[setAttribute](prop, value); // get the value } else if (elem && elem.getAttribute) { // elem not defined when printing pie demo... ret = elem.getAttribute(prop); } // else if prop is defined, it is a hash of key/value pairs } else if (defined(prop) && isObject(prop)) { for (key in prop) { elem[setAttribute](key, prop[key]); } } return ret; } /** * Check if an element is an array, and if not, make it into an array. Like * MooTools' $.splat. */ function splat(obj) { return isArray(obj) ? obj : [obj]; } /** * Return the first value that is defined. Like MooTools' $.pick. */ function pick() { var args = arguments, i, arg, length = args.length; for (i = 0; i < length; i++) { arg = args[i]; if (typeof arg !== 'undefined' && arg !== null) { return arg; } } } /** * Set CSS on a given element * @param {Object} el * @param {Object} styles Style object with camel case property names */ function css(el, styles) { if (isIE) { if (styles && styles.opacity !== UNDEFINED) { styles.filter = 'alpha(opacity=' + (styles.opacity * 100) + ')'; } } extend(el.style, styles); } /** * Utility function to create element with attributes and styles * @param {Object} tag * @param {Object} attribs * @param {Object} styles * @param {Object} parent * @param {Object} nopad */ function createElement(tag, attribs, styles, parent, nopad) { var el = doc.createElement(tag); if (attribs) { extend(el, attribs); } if (nopad) { css(el, {padding: 0, border: NONE, margin: 0}); } if (styles) { css(el, styles); } if (parent) { parent.appendChild(el); } return el; } /** * Extend a prototyped class by new members * @param {Object} parent * @param {Object} members */ function extendClass(parent, members) { var object = function () {}; object.prototype = new parent(); extend(object.prototype, members); return object; } /** * Format a number and return a string based on input settings * @param {Number} number The input number to format * @param {Number} decimals The amount of decimals * @param {String} decPoint The decimal point, defaults to the one given in the lang options * @param {String} thousandsSep The thousands separator, defaults to the one given in the lang options */ function numberFormat(number, decimals, decPoint, thousandsSep) { var lang = defaultOptions.lang, // http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_number_format/ n = number, c = isNaN(decimals = mathAbs(decimals)) ? 2 : decimals, d = decPoint === undefined ? lang.decimalPoint : decPoint, t = thousandsSep === undefined ? lang.thousandsSep : thousandsSep, s = n < 0 ? "-" : "", i = String(pInt(n = mathAbs(+n || 0).toFixed(c))), j = i.length > 3 ? i.length % 3 : 0; return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + mathAbs(n - i).toFixed(c).slice(2) : ""); } /** * Based on http://www.php.net/manual/en/function.strftime.php * @param {String} format * @param {Number} timestamp * @param {Boolean} capitalize */ dateFormat = function (format, timestamp, capitalize) { function pad(number, length) { // two digits number = number.toString().replace(/^([0-9])$/, '0$1'); // three digits if (length === 3) { number = number.toString().replace(/^([0-9]{2})$/, '0$1'); } return number; } if (!defined(timestamp) || isNaN(timestamp)) { return 'Invalid date'; } format = pick(format, '%Y-%m-%d %H:%M:%S'); var date = new Date(timestamp), key, // used in for constuct below // get the basic time values hours = date[getHours](), day = date[getDay](), dayOfMonth = date[getDate](), month = date[getMonth](), fullYear = date[getFullYear](), lang = defaultOptions.lang, langWeekdays = lang.weekdays, /* // uncomment this and the 'W' format key below to enable week numbers weekNumber = function () { var clone = new Date(date.valueOf()), day = clone[getDay]() == 0 ? 7 : clone[getDay](), dayNumber; clone.setDate(clone[getDate]() + 4 - day); dayNumber = mathFloor((clone.getTime() - new Date(clone[getFullYear](), 0, 1, -6)) / 86400000); return 1 + mathFloor(dayNumber / 7); }, */ // list all format keys replacements = { // Day 'a': langWeekdays[day].substr(0, 3), // Short weekday, like 'Mon' 'A': langWeekdays[day], // Long weekday, like 'Monday' 'd': pad(dayOfMonth), // Two digit day of the month, 01 to 31 'e': dayOfMonth, // Day of the month, 1 through 31 // Week (none implemented) //'W': weekNumber(), // Month 'b': lang.shortMonths[month], // Short month, like 'Jan' 'B': lang.months[month], // Long month, like 'January' 'm': pad(month + 1), // Two digit month number, 01 through 12 // Year 'y': fullYear.toString().substr(2, 2), // Two digits year, like 09 for 2009 'Y': fullYear, // Four digits year, like 2009 // Time 'H': pad(hours), // Two digits hours in 24h format, 00 through 23 'I': pad((hours % 12) || 12), // Two digits hours in 12h format, 00 through 11 'l': (hours % 12) || 12, // Hours in 12h format, 1 through 12 'M': pad(date[getMinutes]()), // Two digits minutes, 00 through 59 'p': hours < 12 ? 'AM' : 'PM', // Upper case AM or PM 'P': hours < 12 ? 'am' : 'pm', // Lower case AM or PM 'S': pad(date.getSeconds()), // Two digits seconds, 00 through 59 'L': pad(timestamp % 1000, 3) // Milliseconds (naming from Ruby) }; // do the replaces for (key in replacements) { format = format.replace('%' + key, replacements[key]); } // Optionally capitalize the string and return return capitalize ? format.substr(0, 1).toUpperCase() + format.substr(1) : format; }; /** * Take an interval and normalize it to multiples of 1, 2, 2.5 and 5 * @param {Number} interval * @param {Array} multiples * @param {Number} magnitude * @param {Object} options */ function normalizeTickInterval(interval, multiples, magnitude, options) { var normalized, i; // round to a tenfold of 1, 2, 2.5 or 5 magnitude = pick(magnitude, 1); normalized = interval / magnitude; // multiples for a linear scale if (!multiples) { multiples = [1, 2, 2.5, 5, 10]; // the allowDecimals option if (options && options.allowDecimals === false) { if (magnitude === 1) { multiples = [1, 2, 5, 10]; } else if (magnitude <= 0.1) { multiples = [1 / magnitude]; } } } // normalize the interval to the nearest multiple for (i = 0; i < multiples.length; i++) { interval = multiples[i]; if (normalized <= (multiples[i] + (multiples[i + 1] || multiples[i])) / 2) { break; } } // multiply back to the correct magnitude interval *= magnitude; return interval; } /** * Get a normalized tick interval for dates. Returns a configuration object with * unit range (interval), count and name. Used to prepare data for getTimeTicks. * Previously this logic was part of getTimeTicks, but as getTimeTicks now runs * of segments in stock charts, the normalizing logic was extracted in order to * prevent it for running over again for each segment having the same interval. * #662, #697. */ function normalizeTimeTickInterval(tickInterval, unitsOption) { var units = unitsOption || [[ MILLISECOND, // unit name [1, 2, 5, 10, 20, 25, 50, 100, 200, 500] // allowed multiples ], [ SECOND, [1, 2, 5, 10, 15, 30] ], [ MINUTE, [1, 2, 5, 10, 15, 30] ], [ HOUR, [1, 2, 3, 4, 6, 8, 12] ], [ DAY, [1, 2] ], [ WEEK, [1, 2] ], [ MONTH, [1, 2, 3, 4, 6] ], [ YEAR, null ]], unit = units[units.length - 1], // default unit is years interval = timeUnits[unit[0]], multiples = unit[1], count, i; // loop through the units to find the one that best fits the tickInterval for (i = 0; i < units.length; i++) { unit = units[i]; interval = timeUnits[unit[0]]; multiples = unit[1]; if (units[i + 1]) { // lessThan is in the middle between the highest multiple and the next unit. var lessThan = (interval * multiples[multiples.length - 1] + timeUnits[units[i + 1][0]]) / 2; // break and keep the current unit if (tickInterval <= lessThan) { break; } } } // prevent 2.5 years intervals, though 25, 250 etc. are allowed if (interval === timeUnits[YEAR] && tickInterval < 5 * interval) { multiples = [1, 2, 5]; } // prevent 2.5 years intervals, though 25, 250 etc. are allowed if (interval === timeUnits[YEAR] && tickInterval < 5 * interval) { multiples = [1, 2, 5]; } // get the count count = normalizeTickInterval(tickInterval / interval, multiples); return { unitRange: interval, count: count, unitName: unit[0] }; } /** * Set the tick positions to a time unit that makes sense, for example * on the first of each month or on every Monday. Return an array * with the time positions. Used in datetime axes as well as for grouping * data on a datetime axis. * * @param {Object} normalizedInterval The interval in axis values (ms) and the count * @param {Number} min The minimum in axis values * @param {Number} max The maximum in axis values * @param {Number} startOfWeek */ function getTimeTicks(normalizedInterval, min, max, startOfWeek) { var tickPositions = [], i, higherRanks = {}, useUTC = defaultOptions.global.useUTC, minYear, // used in months and years as a basis for Date.UTC() minDate = new Date(min), interval = normalizedInterval.unitRange, count = normalizedInterval.count; minDate.setMilliseconds(0); if (interval >= timeUnits[SECOND]) { // second minDate.setSeconds(interval >= timeUnits[MINUTE] ? 0 : count * mathFloor(minDate.getSeconds() / count)); } if (interval >= timeUnits[MINUTE]) { // minute minDate[setMinutes](interval >= timeUnits[HOUR] ? 0 : count * mathFloor(minDate[getMinutes]() / count)); } if (interval >= timeUnits[HOUR]) { // hour minDate[setHours](interval >= timeUnits[DAY] ? 0 : count * mathFloor(minDate[getHours]() / count)); } if (interval >= timeUnits[DAY]) { // day minDate[setDate](interval >= timeUnits[MONTH] ? 1 : count * mathFloor(minDate[getDate]() / count)); } if (interval >= timeUnits[MONTH]) { // month minDate[setMonth](interval >= timeUnits[YEAR] ? 0 : count * mathFloor(minDate[getMonth]() / count)); minYear = minDate[getFullYear](); } if (interval >= timeUnits[YEAR]) { // year minYear -= minYear % count; minDate[setFullYear](minYear); } // week is a special case that runs outside the hierarchy if (interval === timeUnits[WEEK]) { // get start of current week, independent of count minDate[setDate](minDate[getDate]() - minDate[getDay]() + pick(startOfWeek, 1)); } // get tick positions i = 1; minYear = minDate[getFullYear](); var time = minDate.getTime(), minMonth = minDate[getMonth](), minDateDate = minDate[getDate](); // iterate and add tick positions at appropriate values while (time < max) { tickPositions.push(time); // if the interval is years, use Date.UTC to increase years if (interval === timeUnits[YEAR]) { time = makeTime(minYear + i * count, 0); // if the interval is months, use Date.UTC to increase months } else if (interval === timeUnits[MONTH]) { time = makeTime(minYear, minMonth + i * count); // if we're using global time, the interval is not fixed as it jumps // one hour at the DST crossover } else if (!useUTC && (interval === timeUnits[DAY] || interval === timeUnits[WEEK])) { time = makeTime(minYear, minMonth, minDateDate + i * count * (interval === timeUnits[DAY] ? 1 : 7)); // else, the interval is fixed and we use simple addition } else { time += interval * count; // mark new days if the time is dividable by day if (interval <= timeUnits[HOUR] && time % timeUnits[DAY] === 0) { higherRanks[time] = DAY; } } i++; } // push the last time tickPositions.push(time); // record information on the chosen unit - for dynamic label formatter tickPositions.info = extend(normalizedInterval, { higherRanks: higherRanks, totalRange: interval * count }); return tickPositions; } /** * Helper class that contains variuos counters that are local to the chart. */ function ChartCounters() { this.color = 0; this.symbol = 0; } ChartCounters.prototype = { /** * Wraps the color counter if it reaches the specified length. */ wrapColor: function (length) { if (this.color >= length) { this.color = 0; } }, /** * Wraps the symbol counter if it reaches the specified length. */ wrapSymbol: function (length) { if (this.symbol >= length) { this.symbol = 0; } } }; /** * Utility method extracted from Tooltip code that places a tooltip in a chart without spilling over * and not covering the point it self. */ function placeBox(boxWidth, boxHeight, outerLeft, outerTop, outerWidth, outerHeight, point, distance, preferRight) { // keep the box within the chart area var pointX = point.x, pointY = point.y, x = pointX + outerLeft + (preferRight ? distance : -boxWidth - distance), y = pointY - boxHeight + outerTop + 15, // 15 means the point is 15 pixels up from the bottom of the tooltip alignedRight; // it is too far to the left, adjust it if (x < 7) { x = outerLeft + pointX + distance; } // Test to see if the tooltip is too far to the right, // if it is, move it back to be inside and then up to not cover the point. if ((x + boxWidth) > (outerLeft + outerWidth)) { x -= (x + boxWidth) - (outerLeft + outerWidth); y = pointY - boxHeight + outerTop - distance; alignedRight = true; } // if it is now above the plot area, align it to the top of the plot area if (y < outerTop + 5) { y = outerTop + 5; // If the tooltip is still covering the point, move it below instead if (alignedRight && pointY >= y && pointY <= (y + boxHeight)) { y = pointY + outerTop + distance; // below } } else if (y + boxHeight > outerTop + outerHeight) { y = outerTop + outerHeight - boxHeight - distance; // below } return {x: x, y: y}; } /** * Utility method that sorts an object array and keeping the order of equal items. * ECMA script standard does not specify the behaviour when items are equal. */ function stableSort(arr, sortFunction) { var length = arr.length, sortValue, i; // Add index to each item for (i = 0; i < length; i++) { arr[i].ss_i = i; // stable sort index } arr.sort(function (a, b) { sortValue = sortFunction(a, b); return sortValue === 0 ? a.ss_i - b.ss_i : sortValue; }); // Remove index from items for (i = 0; i < length; i++) { delete arr[i].ss_i; // stable sort index } } /** * Non-recursive method to find the lowest member of an array. Math.min raises a maximum * call stack size exceeded error in Chrome when trying to apply more than 150.000 points. This * method is slightly slower, but safe. */ function arrayMin(data) { var i = data.length, min = data[0]; while (i--) { if (data[i] < min) { min = data[i]; } } return min; } /** * Non-recursive method to find the lowest member of an array. Math.min raises a maximum * call stack size exceeded error in Chrome when trying to apply more than 150.000 points. This * method is slightly slower, but safe. */ function arrayMax(data) { var i = data.length, max = data[0]; while (i--) { if (data[i] > max) { max = data[i]; } } return max; } /** * Utility method that destroys any SVGElement or VMLElement that are properties on the given object. * It loops all properties and invokes destroy if there is a destroy method. The property is * then delete'ed. */ function destroyObjectProperties(obj) { var n; for (n in obj) { // If the object is non-null and destroy is defined if (obj[n] && obj[n].destroy) { // Invoke the destroy obj[n].destroy(); } // Delete the property from the object. delete obj[n]; } } /** * Discard an element by moving it to the bin and delete * @param {Object} The HTML node to discard */ function discardElement(element) { // create a garbage bin element, not part of the DOM if (!garbageBin) { garbageBin = createElement(DIV); } // move the node and empty bin if (element) { garbageBin.appendChild(element); } garbageBin.innerHTML = ''; } /** * Provide error messages for debugging, with links to online explanation */ function error(code, stop) { var msg = 'Highcharts error #' + code + ': www.highcharts.com/errors/' + code; if (stop) { throw msg; } else if (win.console) { console.log(msg); } } /** * Fix JS round off float errors * @param {Number} num */ function correctFloat(num) { return parseFloat( num.toPrecision(14) ); } /** * The time unit lookup */ /*jslint white: true*/ timeUnits = hash( MILLISECOND, 1, SECOND, 1000, MINUTE, 60000, HOUR, 3600000, DAY, 24 * 3600000, WEEK, 7 * 24 * 3600000, MONTH, 30 * 24 * 3600000, YEAR, 31556952000 ); /*jslint white: false*/ /** * Path interpolation algorithm used across adapters */ pathAnim = { /** * Prepare start and end values so that the path can be animated one to one */ init: function (elem, fromD, toD) { fromD = fromD || ''; var shift = elem.shift, bezier = fromD.indexOf('C') > -1, numParams = bezier ? 7 : 3, endLength, slice, i, start = fromD.split(' '), end = [].concat(toD), // copy startBaseLine, endBaseLine, sixify = function (arr) { // in splines make move points have six parameters like bezier curves i = arr.length; while (i--) { if (arr[i] === M) { arr.splice(i + 1, 0, arr[i + 1], arr[i + 2], arr[i + 1], arr[i + 2]); } } }; if (bezier) { sixify(start); sixify(end); } // pull out the base lines before padding if (elem.isArea) { startBaseLine = start.splice(start.length - 6, 6); endBaseLine = end.splice(end.length - 6, 6); } // if shifting points, prepend a dummy point to the end path if (shift === 1) { end = [].concat(end).splice(0, numParams).concat(end); } elem.shift = 0; // reset for following animations // copy and append last point until the length matches the end length if (start.length) { endLength = end.length; while (start.length < endLength) { //bezier && sixify(start); slice = [].concat(start).splice(start.length - numParams, numParams); if (bezier) { // disable first control point slice[numParams - 6] = slice[numParams - 2]; slice[numParams - 5] = slice[numParams - 1]; } start = start.concat(slice); } } if (startBaseLine) { // append the base lines for areas start = start.concat(startBaseLine); end = end.concat(endBaseLine); } return [start, end]; }, /** * Interpolate each value of the path and return the array */ step: function (start, end, pos, complete) { var ret = [], i = start.length, startVal; if (pos === 1) { // land on the final path without adjustment points appended in the ends ret = complete; } else if (i === end.length && pos < 1) { while (i--) { startVal = parseFloat(start[i]); ret[i] = isNaN(startVal) ? // a letter instruction like M or L start[i] : pos * (parseFloat(end[i] - startVal)) + startVal; } } else { // if animation is finished or length not matching, land on right value ret = end; } return ret; } }; /** * Set the global animation to either a given value, or fall back to the * given chart's animation option * @param {Object} animation * @param {Object} chart */ function setAnimation(animation, chart) { globalAnimation = pick(animation, chart.animation); } /* * Define the adapter for frameworks. If an external adapter is not defined, * Highcharts reverts to the built-in jQuery adapter. */ if (globalAdapter && globalAdapter.init) { // Initialize the adapter with the pathAnim object that takes care // of path animations. globalAdapter.init(pathAnim); } if (!globalAdapter && win.jQuery) { var jQ = jQuery; /** * Downloads a script and executes a callback when done. * @param {String} scriptLocation * @param {Function} callback */ getScript = jQ.getScript; /** * Utility for iterating over an array. Parameters are reversed compared to jQuery. * @param {Array} arr * @param {Function} fn */ each = function (arr, fn) { var i = 0, len = arr.length; for (; i < len; i++) { if (fn.call(arr[i], arr[i], i, arr) === false) { return i; } } }; /** * Filter an array */ grep = jQ.grep; /** * Map an array * @param {Array} arr * @param {Function} fn */ map = function (arr, fn) { //return jQuery.map(arr, fn); var results = [], i = 0, len = arr.length; for (; i < len; i++) { results[i] = fn.call(arr[i], arr[i], i, arr); } return results; }; /** * Deep merge two objects and return a third object */ merge = function () { var args = arguments; return jQ.extend(true, null, args[0], args[1], args[2], args[3]); }; /** * Get the position of an element relative to the top left of the page */ offset = function (el) { return jQ(el).offset(); }; /** * Add an event listener * @param {Object} el A HTML element or custom object * @param {String} event The event type * @param {Function} fn The event handler */ addEvent = function (el, event, fn) { jQ(el).bind(event, fn); }; /** * Remove event added with addEvent * @param {Object} el The object * @param {String} eventType The event type. Leave blank to remove all events. * @param {Function} handler The function to remove */ removeEvent = function (el, eventType, handler) { // workaround for jQuery issue with unbinding custom events: // http://forum.jquery.com/topic/javascript-error-when-unbinding-a-custom-event-using-jquery-1-4-2 var func = doc.removeEventListener ? 'removeEventListener' : 'detachEvent'; if (doc[func] && !el[func]) { el[func] = function () {}; } jQ(el).unbind(eventType, handler); }; /** * Fire an event on a custom object * @param {Object} el * @param {String} type * @param {Object} eventArguments * @param {Function} defaultFunction */ fireEvent = function (el, type, eventArguments, defaultFunction) { var event = jQ.Event(type), detachedType = 'detached' + type, defaultPrevented; extend(event, eventArguments); // Prevent jQuery from triggering the object method that is named the // same as the event. For example, if the event is 'select', jQuery // attempts calling el.select and it goes into a loop. if (el[type]) { el[detachedType] = el[type]; el[type] = null; } // Wrap preventDefault and stopPropagation in try/catch blocks in // order to prevent JS errors when cancelling events on non-DOM // objects. #615. each(['preventDefault', 'stopPropagation'], function (fn) { var base = event[fn]; event[fn] = function () { try { base.call(event); } catch (e) { if (fn === 'preventDefault') { defaultPrevented = true; } } }; }); // trigger it jQ(el).trigger(event); // attach the method if (el[detachedType]) { el[type] = el[detachedType]; el[detachedType] = null; } if (defaultFunction && !event.isDefaultPrevented() && !defaultPrevented) { defaultFunction(event); } }; /** * Animate a HTML element or SVG element wrapper * @param {Object} el * @param {Object} params * @param {Object} options jQuery-like animation options: duration, easing, callback */ animate = function (el, params, options) { var $el = jQ(el); if (params.d) { el.toD = params.d; // keep the array form for paths, used in jQ.fx.step.d params.d = 1; // because in jQuery, animating to an array has a different meaning } $el.stop(); $el.animate(params, options); }; /** * Stop running animation */ stop = function (el) { jQ(el).stop(); }; //=== Extend jQuery on init /*jslint unparam: true*//* allow unused param x in this function */ jQ.extend(jQ.easing, { easeOutQuad: function (x, t, b, c, d) { return -c * (t /= d) * (t - 2) + b; } }); /*jslint unparam: false*/ // extend the animate function to allow SVG animations var jFx = jQuery.fx, jStep = jFx.step; // extend some methods to check for elem.attr, which means it is a Highcharts SVG object each(['cur', '_default', 'width', 'height'], function (fn, i) { var obj = i ? jStep : jFx.prototype, // 'cur', the getter' relates to jFx.prototype base = obj[fn], elem; if (base) { // step.width and step.height don't exist in jQuery < 1.7 // create the extended function replacement obj[fn] = function (fx) { // jFx.prototype.cur does not use fx argument fx = i ? fx : this; // shortcut elem = fx.elem; // jFX.prototype.cur returns the current value. The other ones are setters // and returning a value has no effect. return elem.attr ? // is SVG element wrapper elem.attr(fx.prop, fx.now) : // apply the SVG wrapper's method base.apply(this, arguments); // use jQuery's built-in method }; } }); // animate paths jStep.d = function (fx) { var elem = fx.elem; // Normally start and end should be set in state == 0, but sometimes, // for reasons unknown, this doesn't happen. Perhaps state == 0 is skipped // in these cases if (!fx.started) { var ends = pathAnim.init(elem, elem.d, elem.toD); fx.start = ends[0]; fx.end = ends[1]; fx.started = true; } // interpolate each value of the path elem.attr('d', pathAnim.step(fx.start, fx.end, fx.pos, elem.toD)); }; } /* **************************************************************************** * Handle the options * *****************************************************************************/ var defaultLabelOptions = { enabled: true, // rotation: 0, align: 'center', x: 0, y: 15, /*formatter: function () { return this.value; },*/ style: { color: '#666', fontSize: '11px', lineHeight: '14px' } }; defaultOptions = { colors: ['#4572A7', '#AA4643', '#89A54E', '#80699B', '#3D96AE', '#DB843D', '#92A8CD', '#A47D7C', '#B5CA92'], symbols: ['circle', 'diamond', 'square', 'triangle', 'triangle-down'], lang: { loading: 'Loading...', months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], decimalPoint: '.', resetZoom: 'Reset zoom', resetZoomTitle: 'Reset zoom level 1:1', thousandsSep: ',' }, global: { useUTC: true, canvasToolsURL: 'http://code.highcharts.com/2.2.0/modules/canvas-tools.js' }, chart: { //animation: true, //alignTicks: false, //reflow: true, //className: null, //events: { load, selection }, //margin: [null], //marginTop: null, //marginRight: null, //marginBottom: null, //marginLeft: null, borderColor: '#4572A7', //borderWidth: 0, borderRadius: 5, defaultSeriesType: 'line', ignoreHiddenSeries: true, //inverted: false, //shadow: false, spacingTop: 10, spacingRight: 10, spacingBottom: 15, spacingLeft: 10, style: { fontFamily: '"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif', // default font fontSize: '12px' }, backgroundColor: '#FFFFFF', //plotBackgroundColor: null, plotBorderColor: '#C0C0C0', //plotBorderWidth: 0, //plotShadow: false, //zoomType: '' resetZoomButton: { theme: { zIndex: 20 }, position: { align: 'right', x: -10, //verticalAlign: 'top', y: 10 } // relativeTo: 'plot' } }, title: { text: 'Chart title', align: 'center', // floating: false, // margin: 15, // x: 0, // verticalAlign: 'top', y: 15, style: { color: '#3E576F', fontSize: '16px' } }, subtitle: { text: '', align: 'center', // floating: false // x: 0, // verticalAlign: 'top', y: 30, style: { color: '#6D869F' } }, plotOptions: { line: { // base series options allowPointSelect: false, showCheckbox: false, animation: { duration: 1000 }, //connectNulls: false, //cursor: 'default', //clip: true, //dashStyle: null, //enableMouseTracking: true, events: {}, //legendIndex: 0, lineWidth: 2, shadow: true, // stacking: null, marker: { enabled: true, //symbol: null, lineWidth: 0, radius: 4, lineColor: '#FFFFFF', //fillColor: null, states: { // states for a single point hover: { //radius: base + 2 }, select: { fillColor: '#FFFFFF', lineColor: '#000000', lineWidth: 2 } } }, point: { events: {} }, dataLabels: merge(defaultLabelOptions, { enabled: false, y: -6, formatter: function () { return this.y; } }), cropThreshold: 300, // draw points outside the plot area when the number of points is less than this pointRange: 0, //pointStart: 0, //pointInterval: 1, showInLegend: true, states: { // states for the entire series hover: { //enabled: false, //lineWidth: base + 1, marker: { // lineWidth: base + 1, // radius: base + 1 } }, select: { marker: {} } }, stickyTracking: true //tooltip: { //pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b>' //valueDecimals: null, //xDateFormat: '%A, %b %e, %Y', //valuePrefix: '', //ySuffix: '' //} // turboThreshold: 1000 // zIndex: null } }, labels: { //items: [], style: { //font: defaultFont, position: ABSOLUTE, color: '#3E576F' } }, legend: { enabled: true, align: 'center', //floating: false, layout: 'horizontal', labelFormatter: function () { return this.name; }, borderWidth: 1, borderColor: '#909090', borderRadius: 5, // margin: 10, // reversed: false, shadow: false, // backgroundColor: null, style: { padding: '5px' }, itemStyle: { cursor: 'pointer', color: '#3E576F' }, itemHoverStyle: { //cursor: 'pointer', removed as of #601 color: '#000000' }, itemHiddenStyle: { color: '#C0C0C0' }, itemCheckboxStyle: { position: ABSOLUTE, width: '13px', // for IE precision height: '13px' }, // itemWidth: undefined, symbolWidth: 16, symbolPadding: 5, verticalAlign: 'bottom', // width: undefined, x: 0, y: 0 }, loading: { // hideDuration: 100, labelStyle: { fontWeight: 'bold', position: RELATIVE, top: '1em' }, // showDuration: 0, style: { position: ABSOLUTE, backgroundColor: 'white', opacity: 0.5, textAlign: 'center' } }, tooltip: { enabled: true, //crosshairs: null, backgroundColor: 'rgba(255, 255, 255, .85)', borderWidth: 2, borderRadius: 5, //formatter: defaultFormatter, headerFormat: '<span style="font-size: 10px">{point.key}</span><br/>', pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b><br/>', shadow: true, shared: useCanVG, snap: hasTouch ? 25 : 10, style: { color: '#333333', fontSize: '12px', padding: '5px', whiteSpace: 'nowrap' } //xDateFormat: '%A, %b %e, %Y', //valueDecimals: null, //valuePrefix: '', //valueSuffix: '' }, credits: { enabled: true, text: 'Highcharts.com', href: 'http://www.highcharts.com', position: { align: 'right', x: -10, verticalAlign: 'bottom', y: -5 }, style: { cursor: 'pointer', color: '#909090', fontSize: '10px' } } }; // Axis defaults /*jslint white: true*/ var defaultXAxisOptions = { // allowDecimals: null, // alternateGridColor: null, // categories: [], dateTimeLabelFormats: hash( MILLISECOND, '%H:%M:%S.%L', SECOND, '%H:%M:%S', MINUTE, '%H:%M', HOUR, '%H:%M', DAY, '%e. %b', WEEK, '%e. %b', MONTH, '%b \'%y', YEAR, '%Y' ), endOnTick: false, gridLineColor: '#C0C0C0', // gridLineDashStyle: 'solid', // gridLineWidth: 0, // reversed: false, labels: defaultLabelOptions, // { step: null }, lineColor: '#C0D0E0', lineWidth: 1, //linkedTo: null, max: null, min: null, minPadding: 0.01, maxPadding: 0.01, //minRange: null, minorGridLineColor: '#E0E0E0', // minorGridLineDashStyle: null, minorGridLineWidth: 1, minorTickColor: '#A0A0A0', //minorTickInterval: null, minorTickLength: 2, minorTickPosition: 'outside', // inside or outside //minorTickWidth: 0, //opposite: false, //offset: 0, //plotBands: [{ // events: {}, // zIndex: 1, // labels: { align, x, verticalAlign, y, style, rotation, textAlign } //}], //plotLines: [{ // events: {} // dashStyle: {} // zIndex: // labels: { align, x, verticalAlign, y, style, rotation, textAlign } //}], //reversed: false, // showFirstLabel: true, // showLastLabel: true, startOfWeek: 1, startOnTick: false, tickColor: '#C0D0E0', //tickInterval: null, tickLength: 5, tickmarkPlacement: 'between', // on or between tickPixelInterval: 100, tickPosition: 'outside', tickWidth: 1, title: { //text: null, align: 'middle', // low, middle or high //margin: 0 for horizontal, 10 for vertical axes, //rotation: 0, //side: 'outside', style: { color: '#6D869F', //font: defaultFont.replace('normal', 'bold') fontWeight: 'bold' } //x: 0, //y: 0 }, type: 'linear' // linear, logarithmic or datetime }, defaultYAxisOptions = merge(defaultXAxisOptions, { endOnTick: true, gridLineWidth: 1, tickPixelInterval: 72, showLastLabel: true, labels: { align: 'right', x: -8, y: 3 }, lineWidth: 0, maxPadding: 0.05, minPadding: 0.05, startOnTick: true, tickWidth: 0, title: { rotation: 270, text: 'Y-values' }, stackLabels: { enabled: false, //align: dynamic, //y: dynamic, //x: dynamic, //verticalAlign: dynamic, //textAlign: dynamic, //rotation: 0, formatter: function () { return this.total; }, style: defaultLabelOptions.style } }), defaultLeftAxisOptions = { labels: { align: 'right', x: -8, y: null }, title: { rotation: 270 } }, defaultRightAxisOptions = { labels: { align: 'left', x: 8, y: null }, title: { rotation: 90 } }, defaultBottomAxisOptions = { // horizontal axis labels: { align: 'center', x: 0, y: 14 // staggerLines: null }, title: { rotation: 0 } }, defaultTopAxisOptions = merge(defaultBottomAxisOptions, { labels: { y: -5 // staggerLines: null } }); /*jslint white: false*/ // Series defaults var defaultPlotOptions = defaultOptions.plotOptions, defaultSeriesOptions = defaultPlotOptions.line; //defaultPlotOptions.line = merge(defaultSeriesOptions); defaultPlotOptions.spline = merge(defaultSeriesOptions); defaultPlotOptions.scatter = merge(defaultSeriesOptions, { lineWidth: 0, states: { hover: { lineWidth: 0 } }, tooltip: { headerFormat: '<span style="font-size: 10px; color:{series.color}">{series.name}</span><br/>', pointFormat: 'x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>' } }); defaultPlotOptions.area = merge(defaultSeriesOptions, { threshold: 0 // lineColor: null, // overrides color, but lets fillColor be unaltered // fillOpacity: 0.75, // fillColor: null }); defaultPlotOptions.areaspline = merge(defaultPlotOptions.area); defaultPlotOptions.column = merge(defaultSeriesOptions, { borderColor: '#FFFFFF', borderWidth: 1, borderRadius: 0, //colorByPoint: undefined, groupPadding: 0.2, marker: null, // point options are specified in the base options pointPadding: 0.1, //pointWidth: null, minPointLength: 0, cropThreshold: 50, // when there are more points, they will not animate out of the chart on xAxis.setExtremes pointRange: null, // null means auto, meaning 1 in a categorized axis and least distance between points if not categories states: { hover: { brightness: 0.1, shadow: false }, select: { color: '#C0C0C0', borderColor: '#000000', shadow: false } }, dataLabels: { y: null, verticalAlign: null }, threshold: 0 }); defaultPlotOptions.bar = merge(defaultPlotOptions.column, { dataLabels: { align: 'left', x: 5, y: 0 } }); defaultPlotOptions.pie = merge(defaultSeriesOptions, { //dragType: '', // n/a borderColor: '#FFFFFF', borderWidth: 1, center: ['50%', '50%'], colorByPoint: true, // always true for pies dataLabels: { // align: null, // connectorWidth: 1, // connectorColor: point.color, // connectorPadding: 5, distance: 30, enabled: true, formatter: function () { return this.point.name; }, // softConnector: true, y: 5 }, //innerSize: 0, legendType: 'point', marker: null, // point options are specified in the base options size: '75%', showInLegend: false, slicedOffset: 10, states: { hover: { brightness: 0.1, shadow: false } } }); // set the default time methods setTimeMethods(); /** * Set the time methods globally based on the useUTC option. Time method can be either * local time or UTC (default). */ function setTimeMethods() { var useUTC = defaultOptions.global.useUTC, GET = useUTC ? 'getUTC' : 'get', SET = useUTC ? 'setUTC' : 'set'; makeTime = useUTC ? Date.UTC : function (year, month, date, hours, minutes, seconds) { return new Date( year, month, pick(date, 1), pick(hours, 0), pick(minutes, 0), pick(seconds, 0) ).getTime(); }; getMinutes = GET + 'Minutes'; getHours = GET + 'Hours'; getDay = GET + 'Day'; getDate = GET + 'Date'; getMonth = GET + 'Month'; getFullYear = GET + 'FullYear'; setMinutes = SET + 'Minutes'; setHours = SET + 'Hours'; setDate = SET + 'Date'; setMonth = SET + 'Month'; setFullYear = SET + 'FullYear'; } /** * Merge the default options with custom options and return the new options structure * @param {Object} options The new custom options */ function setOptions(options) { // Pull out axis options and apply them to the respective default axis options defaultXAxisOptions = merge(defaultXAxisOptions, options.xAxis); defaultYAxisOptions = merge(defaultYAxisOptions, options.yAxis); options.xAxis = options.yAxis = UNDEFINED; // Merge in the default options defaultOptions = merge(defaultOptions, options); // Apply UTC setTimeMethods(); return defaultOptions; } /** * Get the updated default options. Merely exposing defaultOptions for outside modules * isn't enough because the setOptions method creates a new object. */ function getOptions() { return defaultOptions; } /** * Handle color operations. The object methods are chainable. * @param {String} input The input color in either rbga or hex format */ var Color = function (input) { // declare variables var rgba = [], result; /** * Parse the input color to rgba array * @param {String} input */ function init(input) { // rgba result = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/.exec(input); if (result) { rgba = [pInt(result[1]), pInt(result[2]), pInt(result[3]), parseFloat(result[4], 10)]; } else { // hex result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(input); if (result) { rgba = [pInt(result[1], 16), pInt(result[2], 16), pInt(result[3], 16), 1]; } } } /** * Return the color a specified format * @param {String} format */ function get(format) { var ret; // it's NaN if gradient colors on a column chart if (rgba && !isNaN(rgba[0])) { if (format === 'rgb') { ret = 'rgb(' + rgba[0] + ',' + rgba[1] + ',' + rgba[2] + ')'; } else if (format === 'a') { ret = rgba[3]; } else { ret = 'rgba(' + rgba.join(',') + ')'; } } else { ret = input; } return ret; } /** * Brighten the color * @param {Number} alpha */ function brighten(alpha) { if (isNumber(alpha) && alpha !== 0) { var i; for (i = 0; i < 3; i++) { rgba[i] += pInt(alpha * 255); if (rgba[i] < 0) { rgba[i] = 0; } if (rgba[i] > 255) { rgba[i] = 255; } } } return this; } /** * Set the color's opacity to a given alpha value * @param {Number} alpha */ function setOpacity(alpha) { rgba[3] = alpha; return this; } // initialize: parse the input init(input); // public methods return { get: get, brighten: brighten, setOpacity: setOpacity }; }; /** * A wrapper object for SVG elements */ function SVGElement() {} SVGElement.prototype = { /** * Initialize the SVG renderer * @param {Object} renderer * @param {String} nodeName */ init: function (renderer, nodeName) { var wrapper = this; wrapper.element = nodeName === 'span' ? createElement(nodeName) : doc.createElementNS(SVG_NS, nodeName); wrapper.renderer = renderer; /** * A collection of attribute setters. These methods, if defined, are called right before a certain * attribute is set on an element wrapper. Returning false prevents the default attribute * setter to run. Returning a value causes the default setter to set that value. Used in * Renderer.label. */ wrapper.attrSetters = {}; }, /** * Animate a given attribute * @param {Object} params * @param {Number} options The same options as in jQuery animation * @param {Function} complete Function to perform at the end of animation */ animate: function (params, options, complete) { var animOptions = pick(options, globalAnimation, true); stop(this); // stop regardless of animation actually running, or reverting to .attr (#607) if (animOptions) { animOptions = merge(animOptions); if (complete) { // allows using a callback with the global animation without overwriting it animOptions.complete = complete; } animate(this, params, animOptions); } else { this.attr(params); if (complete) { complete(); } } }, /** * Set or get a given attribute * @param {Object|String} hash * @param {Mixed|Undefined} val */ attr: function (hash, val) { var wrapper = this, key, value, result, i, child, element = wrapper.element, nodeName = element.nodeName, renderer = wrapper.renderer, skipAttr, attrSetters = wrapper.attrSetters, shadows = wrapper.shadows, hasSetSymbolSize, ret = wrapper; // single key-value pair if (isString(hash) && defined(val)) { key = hash; hash = {}; hash[key] = val; } // used as a getter: first argument is a string, second is undefined if (isString(hash)) { key = hash; if (nodeName === 'circle') { key = { x: 'cx', y: 'cy' }[key] || key; } else if (key === 'strokeWidth') { key = 'stroke-width'; } ret = attr(element, key) || wrapper[key] || 0; if (key !== 'd' && key !== 'visibility') { // 'd' is string in animation step ret = parseFloat(ret); } // setter } else { for (key in hash) { skipAttr = false; // reset value = hash[key]; // check for a specific attribute setter result = attrSetters[key] && attrSetters[key](value, key); if (result !== false) { if (result !== UNDEFINED) { value = result; // the attribute setter has returned a new value to set } // paths if (key === 'd') { if (value && value.join) { // join path value = value.join(' '); } if (/(NaN| {2}|^$)/.test(value)) { value = 'M 0 0'; } wrapper.d = value; // shortcut for animations // update child tspans x values } else if (key === 'x' && nodeName === 'text') { for (i = 0; i < element.childNodes.length; i++) { child = element.childNodes[i]; // if the x values are equal, the tspan represents a linebreak if (attr(child, 'x') === attr(element, 'x')) { //child.setAttribute('x', value); attr(child, 'x', value); } } if (wrapper.rotation) { attr(element, 'transform', 'rotate(' + wrapper.rotation + ' ' + value + ' ' + pInt(hash.y || attr(element, 'y')) + ')'); } // apply gradients } else if (key === 'fill') { value = renderer.color(value, element, key); // circle x and y } else if (nodeName === 'circle' && (key === 'x' || key === 'y')) { key = { x: 'cx', y: 'cy' }[key] || key; // rectangle border radius } else if (nodeName === 'rect' && key === 'r') { attr(element, { rx: value, ry: value }); skipAttr = true; // translation and text rotation } else if (key === 'translateX' || key === 'translateY' || key === 'rotation' || key === 'verticalAlign') { wrapper[key] = value; wrapper.updateTransform(); skipAttr = true; // apply opacity as subnode (required by legacy WebKit and Batik) } else if (key === 'stroke') { value = renderer.color(value, element, key); // emulate VML's dashstyle implementation } else if (key === 'dashstyle') { key = 'stroke-dasharray'; value = value && value.toLowerCase(); if (value === 'solid') { value = NONE; } else if (value) { value = value .replace('shortdashdotdot', '3,1,1,1,1,1,') .replace('shortdashdot', '3,1,1,1') .replace('shortdot', '1,1,') .replace('shortdash', '3,1,') .replace('longdash', '8,3,') .replace(/dot/g, '1,3,') .replace('dash', '4,3,') .replace(/,$/, '') .split(','); // ending comma i = value.length; while (i--) { value[i] = pInt(value[i]) * hash['stroke-width']; } value = value.join(','); } // special } else if (key === 'isTracker') { wrapper[key] = value; // IE9/MooTools combo: MooTools returns objects instead of numbers and IE9 Beta 2 // is unable to cast them. Test again with final IE9. } else if (key === 'width') { value = pInt(value); // Text alignment } else if (key === 'align') { key = 'text-anchor'; value = { left: 'start', center: 'middle', right: 'end' }[value]; // Title requires a subnode, #431 } else if (key === 'title') { var title = doc.createElementNS(SVG_NS, 'title'); title.appendChild(doc.createTextNode(value)); element.appendChild(title); } // jQuery animate changes case if (key === 'strokeWidth') { key = 'stroke-width'; } // Chrome/Win < 6 bug (http://code.google.com/p/chromium/issues/detail?id=15461) if (isWebKit && key === 'stroke-width' && value === 0) { value = 0.000001; } // symbols if (wrapper.symbolName && /^(x|y|r|start|end|innerR|anchorX|anchorY)/.test(key)) { if (!hasSetSymbolSize) { wrapper.symbolAttr(hash); hasSetSymbolSize = true; } skipAttr = true; } // let the shadow follow the main element if (shadows && /^(width|height|visibility|x|y|d|transform)$/.test(key)) { i = shadows.length; while (i--) { attr(shadows[i], key, value); } } // validate heights if ((key === 'width' || key === 'height') && nodeName === 'rect' && value < 0) { value = 0; } if (key === 'text') { // only one node allowed wrapper.textStr = value; if (wrapper.added) { renderer.buildText(wrapper); } } else if (!skipAttr) { attr(element, key, value); } } } } // Workaround for our #732, WebKit's issue https://bugs.webkit.org/show_bug.cgi?id=78385 // TODO: If the WebKit team fix this bug before the final release of Chrome 18, remove the workaround. if (isWebKit && /Chrome\/(18|19)/.test(userAgent)) { if (nodeName === 'text' && (hash.x !== UNDEFINED || hash.y !== UNDEFINED)) { var parent = element.parentNode, next = element.nextSibling; if (parent) { parent.removeChild(element); if (next) { parent.insertBefore(element, next); } else { parent.appendChild(element); } } } } // End of workaround for #732 return ret; }, /** * If one of the symbol size affecting parameters are changed, * check all the others only once for each call to an element's * .attr() method * @param {Object} hash */ symbolAttr: function (hash) { var wrapper = this; each(['x', 'y', 'r', 'start', 'end', 'width', 'height', 'innerR', 'anchorX', 'anchorY'], function (key) { wrapper[key] = pick(hash[key], wrapper[key]); }); wrapper.attr({ d: wrapper.renderer.symbols[wrapper.symbolName](wrapper.x, wrapper.y, wrapper.width, wrapper.height, wrapper) }); }, /** * Apply a clipping path to this object * @param {String} id */ clip: function (clipRect) { return this.attr('clip-path', 'url(' + this.renderer.url + '#' + clipRect.id + ')'); }, /** * Calculate the coordinates needed for drawing a rectangle crisply and return the * calculated attributes * @param {Number} strokeWidth * @param {Number} x * @param {Number} y * @param {Number} width * @param {Number} height */ crisp: function (strokeWidth, x, y, width, height) { var wrapper = this, key, attribs = {}, values = {}, normalizer; strokeWidth = strokeWidth || wrapper.strokeWidth || (wrapper.attr && wrapper.attr('stroke-width')) || 0; normalizer = mathRound(strokeWidth) % 2 / 2; // mathRound because strokeWidth can sometimes have roundoff errors // normalize for crisp edges values.x = mathFloor(x || wrapper.x || 0) + normalizer; values.y = mathFloor(y || wrapper.y || 0) + normalizer; values.width = mathFloor((width || wrapper.width || 0) - 2 * normalizer); values.height = mathFloor((height || wrapper.height || 0) - 2 * normalizer); values.strokeWidth = strokeWidth; for (key in values) { if (wrapper[key] !== values[key]) { // only set attribute if changed wrapper[key] = attribs[key] = values[key]; } } return attribs; }, /** * Set styles for the element * @param {Object} styles */ css: function (styles) { /*jslint unparam: true*//* allow unused param a in the regexp function below */ var elemWrapper = this, elem = elemWrapper.element, textWidth = styles && styles.width && elem.nodeName === 'text', n, serializedCss = '', hyphenate = function (a, b) { return '-' + b.toLowerCase(); }; /*jslint unparam: false*/ // convert legacy if (styles && styles.color) { styles.fill = styles.color; } // Merge the new styles with the old ones styles = extend( elemWrapper.styles, styles ); // store object elemWrapper.styles = styles; // serialize and set style attribute if (isIE && !hasSVG) { // legacy IE doesn't support setting style attribute if (textWidth) { delete styles.width; } css(elemWrapper.element, styles); } else { for (n in styles) { serializedCss += n.replace(/([A-Z])/g, hyphenate) + ':' + styles[n] + ';'; } elemWrapper.attr({ style: serializedCss }); } // re-build text if (textWidth && elemWrapper.added) { elemWrapper.renderer.buildText(elemWrapper); } return elemWrapper; }, /** * Add an event listener * @param {String} eventType * @param {Function} handler */ on: function (eventType, handler) { var fn = handler; // touch if (hasTouch && eventType === 'click') { eventType = 'touchstart'; fn = function (e) { e.preventDefault(); handler(); }; } // simplest possible event model for internal use this.element['on' + eventType] = fn; return this; }, /** * Move an object and its children by x and y values * @param {Number} x * @param {Number} y */ translate: function (x, y) { return this.attr({ translateX: x, translateY: y }); }, /** * Invert a group, rotate and flip */ invert: function () { var wrapper = this; wrapper.inverted = true; wrapper.updateTransform(); return wrapper; }, /** * Apply CSS to HTML elements. This is used in text within SVG rendering and * by the VML renderer */ htmlCss: function (styles) { var wrapper = this, element = wrapper.element, textWidth = styles && element.tagName === 'SPAN' && styles.width; if (textWidth) { delete styles.width; wrapper.textWidth = textWidth; wrapper.updateTransform(); } wrapper.styles = extend(wrapper.styles, styles); css(wrapper.element, styles); return wrapper; }, /** * VML and useHTML method for calculating the bounding box based on offsets * @param {Boolean} refresh Whether to force a fresh value from the DOM or to * use the cached value * * @return {Object} A hash containing values for x, y, width and height */ htmlGetBBox: function (refresh) { var wrapper = this, element = wrapper.element, bBox = wrapper.bBox; // faking getBBox in exported SVG in legacy IE if (!bBox || refresh) { // faking getBBox in exported SVG in legacy IE if (element.nodeName === 'text') { element.style.position = ABSOLUTE; } bBox = wrapper.bBox = { x: element.offsetLeft, y: element.offsetTop, width: element.offsetWidth, height: element.offsetHeight }; } return bBox; }, /** * VML override private method to update elements based on internal * properties based on SVG transform */ htmlUpdateTransform: function () { // aligning non added elements is expensive if (!this.added) { this.alignOnAdd = true; return; } var wrapper = this, elem = wrapper.element, translateX = wrapper.translateX || 0, translateY = wrapper.translateY || 0, x = wrapper.x || 0, y = wrapper.y || 0, align = wrapper.textAlign || 'left', alignCorrection = { left: 0, center: 0.5, right: 1 }[align], nonLeft = align && align !== 'left', shadows = wrapper.shadows; // apply translate if (translateX || translateY) { css(elem, { marginLeft: translateX, marginTop: translateY }); if (shadows) { // used in labels/tooltip each(shadows, function (shadow) { css(shadow, { marginLeft: translateX + 1, marginTop: translateY + 1 }); }); } } // apply inversion if (wrapper.inverted) { // wrapper is a group each(elem.childNodes, function (child) { wrapper.renderer.invertChild(child, elem); }); } if (elem.tagName === 'SPAN') { var width, height, rotation = wrapper.rotation, lineHeight, radians = 0, costheta = 1, sintheta = 0, quad, textWidth = pInt(wrapper.textWidth), xCorr = wrapper.xCorr || 0, yCorr = wrapper.yCorr || 0, currentTextTransform = [rotation, align, elem.innerHTML, wrapper.textWidth].join(','); if (currentTextTransform !== wrapper.cTT) { // do the calculations and DOM access only if properties changed if (defined(rotation)) { radians = rotation * deg2rad; // deg to rad costheta = mathCos(radians); sintheta = mathSin(radians); // Adjust for alignment and rotation. Rotation of useHTML content is not yet implemented // but it can probably be implemented for Firefox 3.5+ on user request. FF3.5+ // has support for CSS3 transform. The getBBox method also needs to be updated // to compensate for the rotation, like it currently does for SVG. // Test case: http://highcharts.com/tests/?file=text-rotation css(elem, { filter: rotation ? ['progid:DXImageTransform.Microsoft.Matrix(M11=', costheta, ', M12=', -sintheta, ', M21=', sintheta, ', M22=', costheta, ', sizingMethod=\'auto expand\')'].join('') : NONE }); } width = pick(wrapper.elemWidth, elem.offsetWidth); height = pick(wrapper.elemHeight, elem.offsetHeight); // update textWidth if (width > textWidth) { css(elem, { width: textWidth + PX, display: 'block', whiteSpace: 'normal' }); width = textWidth; } // correct x and y lineHeight = mathRound((pInt(elem.style.fontSize) || 12) * 1.2); xCorr = costheta < 0 && -width; yCorr = sintheta < 0 && -height; // correct for lineHeight and corners spilling out after rotation quad = costheta * sintheta < 0; xCorr += sintheta * lineHeight * (quad ? 1 - alignCorrection : alignCorrection); yCorr -= costheta * lineHeight * (rotation ? (quad ? alignCorrection : 1 - alignCorrection) : 1); // correct for the length/height of the text if (nonLeft) { xCorr -= width * alignCorrection * (costheta < 0 ? -1 : 1); if (rotation) { yCorr -= height * alignCorrection * (sintheta < 0 ? -1 : 1); } css(elem, { textAlign: align }); } // record correction wrapper.xCorr = xCorr; wrapper.yCorr = yCorr; } // apply position with correction css(elem, { left: (x + xCorr) + PX, top: (y + yCorr) + PX }); // record current text transform wrapper.cTT = currentTextTransform; } }, /** * Private method to update the transform attribute based on internal * properties */ updateTransform: function () { var wrapper = this, translateX = wrapper.translateX || 0, translateY = wrapper.translateY || 0, inverted = wrapper.inverted, rotation = wrapper.rotation, transform = []; // flipping affects translate as adjustment for flipping around the group's axis if (inverted) { translateX += wrapper.attr('width'); translateY += wrapper.attr('height'); } // apply translate if (translateX || translateY) { transform.push('translate(' + translateX + ',' + translateY + ')'); } // apply rotation if (inverted) { transform.push('rotate(90) scale(-1,1)'); } else if (rotation) { // text rotation transform.push('rotate(' + rotation + ' ' + wrapper.x + ' ' + wrapper.y + ')'); } if (transform.length) { attr(wrapper.element, 'transform', transform.join(' ')); } }, /** * Bring the element to the front */ toFront: function () { var element = this.element; element.parentNode.appendChild(element); return this; }, /** * Break down alignment options like align, verticalAlign, x and y * to x and y relative to the chart. * * @param {Object} alignOptions * @param {Boolean} alignByTranslate * @param {Object} box The box to align to, needs a width and height * */ align: function (alignOptions, alignByTranslate, box) { var elemWrapper = this; if (!alignOptions) { // called on resize alignOptions = elemWrapper.alignOptions; alignByTranslate = elemWrapper.alignByTranslate; } else { // first call on instanciate elemWrapper.alignOptions = alignOptions; elemWrapper.alignByTranslate = alignByTranslate; if (!box) { // boxes other than renderer handle this internally elemWrapper.renderer.alignedObjects.push(elemWrapper); } } box = pick(box, elemWrapper.renderer); var align = alignOptions.align, vAlign = alignOptions.verticalAlign, x = (box.x || 0) + (alignOptions.x || 0), // default: left align y = (box.y || 0) + (alignOptions.y || 0), // default: top align attribs = {}; // align if (/^(right|center)$/.test(align)) { x += (box.width - (alignOptions.width || 0)) / { right: 1, center: 2 }[align]; } attribs[alignByTranslate ? 'translateX' : 'x'] = mathRound(x); // vertical align if (/^(bottom|middle)$/.test(vAlign)) { y += (box.height - (alignOptions.height || 0)) / ({ bottom: 1, middle: 2 }[vAlign] || 1); } attribs[alignByTranslate ? 'translateY' : 'y'] = mathRound(y); // animate only if already placed elemWrapper[elemWrapper.placed ? 'animate' : 'attr'](attribs); elemWrapper.placed = true; elemWrapper.alignAttr = attribs; return elemWrapper; }, /** * Get the bounding box (width, height, x and y) for the element */ getBBox: function (refresh) { var wrapper = this, bBox, width, height, rotation = wrapper.rotation, element = wrapper.element, rad = rotation * deg2rad; // SVG elements if (element.namespaceURI === SVG_NS) { try { // Fails in Firefox if the container has display: none. bBox = element.getBBox ? // SVG: use extend because IE9 is not allowed to change width and height in case // of rotation (below) extend({}, element.getBBox()) : // Canvas renderer: // TODO: can this be removed now that we're checking for the SVG NS? { width: element.offsetWidth, height: element.offsetHeight }; } catch (e) {} // If the bBox is not set, the try-catch block above failed. The other condition // is for Opera that returns a width of -Infinity on hidden elements. if (!bBox || bBox.width < 0) { bBox = { width: 0, height: 0 }; } width = bBox.width; height = bBox.height; // adjust for rotated text if (rotation) { bBox.width = mathAbs(height * mathSin(rad)) + mathAbs(width * mathCos(rad)); bBox.height = mathAbs(height * mathCos(rad)) + mathAbs(width * mathSin(rad)); } // VML Renderer or useHTML within SVG } else { bBox = wrapper.htmlGetBBox(refresh); } return bBox; }, /** * Show the element */ show: function () { return this.attr({ visibility: VISIBLE }); }, /** * Hide the element */ hide: function () { return this.attr({ visibility: HIDDEN }); }, /** * Add the element * @param {Object|Undefined} parent Can be an element, an element wrapper or undefined * to append the element to the renderer.box. */ add: function (parent) { var renderer = this.renderer, parentWrapper = parent || renderer, parentNode = parentWrapper.element || renderer.box, childNodes = parentNode.childNodes, element = this.element, zIndex = attr(element, 'zIndex'), otherElement, otherZIndex, i, inserted; // mark as inverted this.parentInverted = parent && parent.inverted; // build formatted text if (this.textStr !== undefined) { renderer.buildText(this); } // mark the container as having z indexed children if (zIndex) { parentWrapper.handleZ = true; zIndex = pInt(zIndex); } // insert according to this and other elements' zIndex if (parentWrapper.handleZ) { // this element or any of its siblings has a z index for (i = 0; i < childNodes.length; i++) { otherElement = childNodes[i]; otherZIndex = attr(otherElement, 'zIndex'); if (otherElement !== element && ( // insert before the first element with a higher zIndex pInt(otherZIndex) > zIndex || // if no zIndex given, insert before the first element with a zIndex (!defined(zIndex) && defined(otherZIndex)) )) { parentNode.insertBefore(element, otherElement); inserted = true; break; } } } // default: append at the end if (!inserted) { parentNode.appendChild(element); } // mark as added this.added = true; // fire an event for internal hooks fireEvent(this, 'add'); return this; }, /** * Removes a child either by removeChild or move to garbageBin. * Issue 490; in VML removeChild results in Orphaned nodes according to sIEve, discardElement does not. */ safeRemoveChild: function (element) { var parentNode = element.parentNode; if (parentNode) { parentNode.removeChild(element); } }, /** * Destroy the element and element wrapper */ destroy: function () { var wrapper = this, element = wrapper.element || {}, shadows = wrapper.shadows, box = wrapper.box, key, i; // remove events element.onclick = element.onmouseout = element.onmouseover = element.onmousemove = null; stop(wrapper); // stop running animations if (wrapper.clipPath) { wrapper.clipPath = wrapper.clipPath.destroy(); } // Destroy stops in case this is a gradient object if (wrapper.stops) { for (i = 0; i < wrapper.stops.length; i++) { wrapper.stops[i] = wrapper.stops[i].destroy(); } wrapper.stops = null; } // remove element wrapper.safeRemoveChild(element); // destroy shadows if (shadows) { each(shadows, function (shadow) { wrapper.safeRemoveChild(shadow); }); } // destroy label box if (box) { box.destroy(); } // remove from alignObjects erase(wrapper.renderer.alignedObjects, wrapper); for (key in wrapper) { delete wrapper[key]; } return null; }, /** * Empty a group element */ empty: function () { var element = this.element, childNodes = element.childNodes, i = childNodes.length; while (i--) { element.removeChild(childNodes[i]); } }, /** * Add a shadow to the element. Must be done after the element is added to the DOM * @param {Boolean} apply */ shadow: function (apply, group) { var shadows = [], i, shadow, element = this.element, // compensate for inverted plot area transform = this.parentInverted ? '(-1,-1)' : '(1,1)'; if (apply) { for (i = 1; i <= 3; i++) { shadow = element.cloneNode(0); attr(shadow, { 'isShadow': 'true', 'stroke': 'rgb(0, 0, 0)', 'stroke-opacity': 0.05 * i, 'stroke-width': 7 - 2 * i, 'transform': 'translate' + transform, 'fill': NONE }); if (group) { group.element.appendChild(shadow); } else { element.parentNode.insertBefore(shadow, element); } shadows.push(shadow); } this.shadows = shadows; } return this; } }; /** * The default SVG renderer */ var SVGRenderer = function () { this.init.apply(this, arguments); }; SVGRenderer.prototype = { Element: SVGElement, /** * Initialize the SVGRenderer * @param {Object} container * @param {Number} width * @param {Number} height * @param {Boolean} forExport */ init: function (container, width, height, forExport) { var renderer = this, loc = location, boxWrapper; boxWrapper = renderer.createElement('svg') .attr({ xmlns: SVG_NS, version: '1.1' }); container.appendChild(boxWrapper.element); // object properties renderer.isSVG = true; renderer.box = boxWrapper.element; renderer.boxWrapper = boxWrapper; renderer.alignedObjects = []; renderer.url = isIE ? '' : loc.href.replace(/#.*?$/, '') .replace(/\(/g, '\\(').replace(/\)/g, '\\)'); // Page url used for internal references. #24, #672. renderer.defs = this.createElement('defs').add(); renderer.forExport = forExport; renderer.gradients = {}; // Object where gradient SvgElements are stored renderer.setSize(width, height, false); }, /** * Destroys the renderer and its allocated members. */ destroy: function () { var renderer = this, rendererDefs = renderer.defs; renderer.box = null; renderer.boxWrapper = renderer.boxWrapper.destroy(); // Call destroy on all gradient elements destroyObjectProperties(renderer.gradients || {}); renderer.gradients = null; // Defs are null in VMLRenderer // Otherwise, destroy them here. if (rendererDefs) { renderer.defs = rendererDefs.destroy(); } renderer.alignedObjects = null; return null; }, /** * Create a wrapper for an SVG element * @param {Object} nodeName */ createElement: function (nodeName) { var wrapper = new this.Element(); wrapper.init(this, nodeName); return wrapper; }, /** * Dummy function for use in canvas renderer */ draw: function () {}, /** * Parse a simple HTML string into SVG tspans * * @param {Object} textNode The parent text SVG node */ buildText: function (wrapper) { var textNode = wrapper.element, lines = pick(wrapper.textStr, '').toString() .replace(/<(b|strong)>/g, '<span style="font-weight:bold">') .replace(/<(i|em)>/g, '<span style="font-style:italic">') .replace(/<a/g, '<span') .replace(/<\/(b|strong|i|em|a)>/g, '</span>') .split(/<br.*?>/g), childNodes = textNode.childNodes, styleRegex = /style="([^"]+)"/, hrefRegex = /href="([^"]+)"/, parentX = attr(textNode, 'x'), textStyles = wrapper.styles, width = textStyles && pInt(textStyles.width), textLineHeight = textStyles && textStyles.lineHeight, lastLine, GET_COMPUTED_STYLE = 'getComputedStyle', i = childNodes.length; // remove old text while (i--) { textNode.removeChild(childNodes[i]); } if (width && !wrapper.added) { this.box.appendChild(textNode); // attach it to the DOM to read offset width } // remove empty line at end if (lines[lines.length - 1] === '') { lines.pop(); } // build the lines each(lines, function (line, lineNo) { var spans, spanNo = 0, lineHeight; line = line.replace(/<span/g, '|||<span').replace(/<\/span>/g, '</span>|||'); spans = line.split('|||'); each(spans, function (span) { if (span !== '' || spans.length === 1) { var attributes = {}, tspan = doc.createElementNS(SVG_NS, 'tspan'); if (styleRegex.test(span)) { attr( tspan, 'style', span.match(styleRegex)[1].replace(/(;| |^)color([ :])/, '$1fill$2') ); } if (hrefRegex.test(span)) { attr(tspan, 'onclick', 'location.href=\"' + span.match(hrefRegex)[1] + '\"'); css(tspan, { cursor: 'pointer' }); } span = (span.replace(/<(.|\n)*?>/g, '') || ' ') .replace(/&lt;/g, '<') .replace(/&gt;/g, '>'); // issue #38 workaround. /*if (reverse) { arr = []; i = span.length; while (i--) { arr.push(span.charAt(i)); } span = arr.join(''); }*/ // add the text node tspan.appendChild(doc.createTextNode(span)); if (!spanNo) { // first span in a line, align it to the left attributes.x = parentX; } else { // Firefox ignores spaces at the front or end of the tspan attributes.dx = 3; // space } // first span on subsequent line, add the line height if (!spanNo) { if (lineNo) { // allow getting the right offset height in exporting in IE if (!hasSVG && wrapper.renderer.forExport) { css(tspan, { display: 'block' }); } // Webkit and opera sometimes return 'normal' as the line height. In that // case, webkit uses offsetHeight, while Opera falls back to 18 lineHeight = win[GET_COMPUTED_STYLE] && pInt(win[GET_COMPUTED_STYLE](lastLine, null).getPropertyValue('line-height')); if (!lineHeight || isNaN(lineHeight)) { lineHeight = textLineHeight || lastLine.offsetHeight || 18; } attr(tspan, 'dy', lineHeight); } lastLine = tspan; // record for use in next line } // add attributes attr(tspan, attributes); // append it textNode.appendChild(tspan); spanNo++; // check width and apply soft breaks if (width) { var words = span.replace(/-/g, '- ').split(' '), tooLong, actualWidth, rest = []; while (words.length || rest.length) { actualWidth = wrapper.getBBox().width; tooLong = actualWidth > width; if (!tooLong || words.length === 1) { // new line needed words = rest; rest = []; if (words.length) { tspan = doc.createElementNS(SVG_NS, 'tspan'); attr(tspan, { dy: textLineHeight || 16, x: parentX }); textNode.appendChild(tspan); if (actualWidth > width) { // a single word is pressing it out width = actualWidth; } } } else { // append to existing line tspan tspan.removeChild(tspan.firstChild); rest.unshift(words.pop()); } if (words.length) { tspan.appendChild(doc.createTextNode(words.join(' ').replace(/- /g, '-'))); } } } } }); }); }, /** * Create a button with preset states * @param {String} text * @param {Number} x * @param {Number} y * @param {Function} callback * @param {Object} normalState * @param {Object} hoverState * @param {Object} pressedState */ button: function (text, x, y, callback, normalState, hoverState, pressedState) { var label = this.label(text, x, y), curState = 0, stateOptions, stateStyle, normalStyle, hoverStyle, pressedStyle, STYLE = 'style', verticalGradient = { x1: 0, y1: 0, x2: 0, y2: 1 }; // prepare the attributes /*jslint white: true*/ normalState = merge(hash( STROKE_WIDTH, 1, STROKE, '#999', FILL, hash( LINEAR_GRADIENT, verticalGradient, STOPS, [ [0, '#FFF'], [1, '#DDD'] ] ), 'r', 3, 'padding', 3, STYLE, hash( 'color', 'black' ) ), normalState); /*jslint white: false*/ normalStyle = normalState[STYLE]; delete normalState[STYLE]; /*jslint white: true*/ hoverState = merge(normalState, hash( STROKE, '#68A', FILL, hash( LINEAR_GRADIENT, verticalGradient, STOPS, [ [0, '#FFF'], [1, '#ACF'] ] ) ), hoverState); /*jslint white: false*/ hoverStyle = hoverState[STYLE]; delete hoverState[STYLE]; /*jslint white: true*/ pressedState = merge(normalState, hash( STROKE, '#68A', FILL, hash( LINEAR_GRADIENT, verticalGradient, STOPS, [ [0, '#9BD'], [1, '#CDF'] ] ) ), pressedState); /*jslint white: false*/ pressedStyle = pressedState[STYLE]; delete pressedState[STYLE]; // add the events addEvent(label.element, 'mouseenter', function () { label.attr(hoverState) .css(hoverStyle); }); addEvent(label.element, 'mouseleave', function () { stateOptions = [normalState, hoverState, pressedState][curState]; stateStyle = [normalStyle, hoverStyle, pressedStyle][curState]; label.attr(stateOptions) .css(stateStyle); }); label.setState = function (state) { curState = state; if (!state) { label.attr(normalState) .css(normalStyle); } else if (state === 2) { label.attr(pressedState) .css(pressedStyle); } }; return label .on('click', function () { callback.call(label); }) .attr(normalState) .css(extend({ cursor: 'default' }, normalStyle)); }, /** * Make a straight line crisper by not spilling out to neighbour pixels * @param {Array} points * @param {Number} width */ crispLine: function (points, width) { // points format: [M, 0, 0, L, 100, 0] // normalize to a crisp line if (points[1] === points[4]) { points[1] = points[4] = mathRound(points[1]) + (width % 2 / 2); } if (points[2] === points[5]) { points[2] = points[5] = mathRound(points[2]) + (width % 2 / 2); } return points; }, /** * Draw a path * @param {Array} path An SVG path in array form */ path: function (path) { return this.createElement('path').attr({ d: path, fill: NONE }); }, /** * Draw and return an SVG circle * @param {Number} x The x position * @param {Number} y The y position * @param {Number} r The radius */ circle: function (x, y, r) { var attr = isObject(x) ? x : { x: x, y: y, r: r }; return this.createElement('circle').attr(attr); }, /** * Draw and return an arc * @param {Number} x X position * @param {Number} y Y position * @param {Number} r Radius * @param {Number} innerR Inner radius like used in donut charts * @param {Number} start Starting angle * @param {Number} end Ending angle */ arc: function (x, y, r, innerR, start, end) { // arcs are defined as symbols for the ability to set // attributes in attr and animate if (isObject(x)) { y = x.y; r = x.r; innerR = x.innerR; start = x.start; end = x.end; x = x.x; } return this.symbol('arc', x || 0, y || 0, r || 0, r || 0, { innerR: innerR || 0, start: start || 0, end: end || 0 }); }, /** * Draw and return a rectangle * @param {Number} x Left position * @param {Number} y Top position * @param {Number} width * @param {Number} height * @param {Number} r Border corner radius * @param {Number} strokeWidth A stroke width can be supplied to allow crisp drawing */ rect: function (x, y, width, height, r, strokeWidth) { if (isObject(x)) { y = x.y; width = x.width; height = x.height; r = x.r; strokeWidth = x.strokeWidth; x = x.x; } var wrapper = this.createElement('rect').attr({ rx: r, ry: r, fill: NONE }); return wrapper.attr(wrapper.crisp(strokeWidth, x, y, mathMax(width, 0), mathMax(height, 0))); }, /** * Resize the box and re-align all aligned elements * @param {Object} width * @param {Object} height * @param {Boolean} animate * */ setSize: function (width, height, animate) { var renderer = this, alignedObjects = renderer.alignedObjects, i = alignedObjects.length; renderer.width = width; renderer.height = height; renderer.boxWrapper[pick(animate, true) ? 'animate' : 'attr']({ width: width, height: height }); while (i--) { alignedObjects[i].align(); } }, /** * Create a group * @param {String} name The group will be given a class name of 'highcharts-{name}'. * This can be used for styling and scripting. */ g: function (name) { var elem = this.createElement('g'); return defined(name) ? elem.attr({ 'class': PREFIX + name }) : elem; }, /** * Display an image * @param {String} src * @param {Number} x * @param {Number} y * @param {Number} width * @param {Number} height */ image: function (src, x, y, width, height) { var attribs = { preserveAspectRatio: NONE }, elemWrapper; // optional properties if (arguments.length > 1) { extend(attribs, { x: x, y: y, width: width, height: height }); } elemWrapper = this.createElement('image').attr(attribs); // set the href in the xlink namespace if (elemWrapper.element.setAttributeNS) { elemWrapper.element.setAttributeNS('http://www.w3.org/1999/xlink', 'href', src); } else { // could be exporting in IE // using href throws "not supported" in ie7 and under, requries regex shim to fix later elemWrapper.element.setAttribute('hc-svg-href', src); } return elemWrapper; }, /** * Draw a symbol out of pre-defined shape paths from the namespace 'symbol' object. * * @param {Object} symbol * @param {Object} x * @param {Object} y * @param {Object} radius * @param {Object} options */ symbol: function (symbol, x, y, width, height, options) { var obj, // get the symbol definition function symbolFn = this.symbols[symbol], // check if there's a path defined for this symbol path = symbolFn && symbolFn( mathRound(x), mathRound(y), width, height, options ), imageRegex = /^url\((.*?)\)$/, imageSrc, imageSize; if (path) { obj = this.path(path); // expando properties for use in animate and attr extend(obj, { symbolName: symbol, x: x, y: y, width: width, height: height }); if (options) { extend(obj, options); } // image symbols } else if (imageRegex.test(symbol)) { var centerImage = function (img, size) { img.attr({ width: size[0], height: size[1] }).translate( -mathRound(size[0] / 2), -mathRound(size[1] / 2) ); }; imageSrc = symbol.match(imageRegex)[1]; imageSize = symbolSizes[imageSrc]; // create the image synchronously, add attribs async obj = this.image(imageSrc) .attr({ x: x, y: y }); if (imageSize) { centerImage(obj, imageSize); } else { // initialize image to be 0 size so export will still function if there's no cached sizes obj.attr({ width: 0, height: 0 }); // create a dummy JavaScript image to get the width and height createElement('img', { onload: function () { var img = this; centerImage(obj, symbolSizes[imageSrc] = [img.width, img.height]); }, src: imageSrc }); } } return obj; }, /** * An extendable collection of functions for defining symbol paths. */ symbols: { 'circle': function (x, y, w, h) { var cpw = 0.166 * w; return [ M, x + w / 2, y, 'C', x + w + cpw, y, x + w + cpw, y + h, x + w / 2, y + h, 'C', x - cpw, y + h, x - cpw, y, x + w / 2, y, 'Z' ]; }, 'square': function (x, y, w, h) { return [ M, x, y, L, x + w, y, x + w, y + h, x, y + h, 'Z' ]; }, 'triangle': function (x, y, w, h) { return [ M, x + w / 2, y, L, x + w, y + h, x, y + h, 'Z' ]; }, 'triangle-down': function (x, y, w, h) { return [ M, x, y, L, x + w, y, x + w / 2, y + h, 'Z' ]; }, 'diamond': function (x, y, w, h) { return [ M, x + w / 2, y, L, x + w, y + h / 2, x + w / 2, y + h, x, y + h / 2, 'Z' ]; }, 'arc': function (x, y, w, h, options) { var start = options.start, radius = options.r || w || h, end = options.end - 0.000001, // to prevent cos and sin of start and end from becoming equal on 360 arcs innerRadius = options.innerR, cosStart = mathCos(start), sinStart = mathSin(start), cosEnd = mathCos(end), sinEnd = mathSin(end), longArc = options.end - start < mathPI ? 0 : 1; return [ M, x + radius * cosStart, y + radius * sinStart, 'A', // arcTo radius, // x radius radius, // y radius 0, // slanting longArc, // long or short arc 1, // clockwise x + radius * cosEnd, y + radius * sinEnd, L, x + innerRadius * cosEnd, y + innerRadius * sinEnd, 'A', // arcTo innerRadius, // x radius innerRadius, // y radius 0, // slanting longArc, // long or short arc 0, // clockwise x + innerRadius * cosStart, y + innerRadius * sinStart, 'Z' // close ]; } }, /** * Define a clipping rectangle * @param {String} id * @param {Number} x * @param {Number} y * @param {Number} width * @param {Number} height */ clipRect: function (x, y, width, height) { var wrapper, id = PREFIX + idCounter++, clipPath = this.createElement('clipPath').attr({ id: id }).add(this.defs); wrapper = this.rect(x, y, width, height, 0).add(clipPath); wrapper.id = id; wrapper.clipPath = clipPath; return wrapper; }, /** * Take a color and return it if it's a string, make it a gradient if it's a * gradient configuration object. Prior to Highstock, an array was used to define * a linear gradient with pixel positions relative to the SVG. In newer versions * we change the coordinates to apply relative to the shape, using coordinates * 0-1 within the shape. To preserve backwards compatibility, linearGradient * in this definition is an object of x1, y1, x2 and y2. * * @param {Object} color The color or config object */ color: function (color, elem, prop) { var colorObject, regexRgba = /^rgba/; if (color && color.linearGradient) { var renderer = this, linearGradient = color[LINEAR_GRADIENT], relativeToShape = !isArray(linearGradient), // keep backwards compatibility id, gradients = renderer.gradients, gradientObject, x1 = linearGradient.x1 || linearGradient[0] || 0, y1 = linearGradient.y1 || linearGradient[1] || 0, x2 = linearGradient.x2 || linearGradient[2] || 0, y2 = linearGradient.y2 || linearGradient[3] || 0, stopColor, stopOpacity, // Create a unique key in order to reuse gradient objects. #671. key = [relativeToShape, x1, y1, x2, y2, color.stops.join(',')].join(','); // If the gradient with the same setup is already created, reuse it if (gradients[key]) { id = attr(gradients[key].element, 'id'); // If not, create a new one and keep the reference. } else { id = PREFIX + idCounter++; gradientObject = renderer.createElement(LINEAR_GRADIENT) .attr(extend({ id: id, x1: x1, y1: y1, x2: x2, y2: y2 }, relativeToShape ? null : { gradientUnits: 'userSpaceOnUse' })) .add(renderer.defs); // The gradient needs to keep a list of stops to be able to destroy them gradientObject.stops = []; each(color.stops, function (stop) { var stopObject; if (regexRgba.test(stop[1])) { colorObject = Color(stop[1]); stopColor = colorObject.get('rgb'); stopOpacity = colorObject.get('a'); } else { stopColor = stop[1]; stopOpacity = 1; } stopObject = renderer.createElement('stop').attr({ offset: stop[0], 'stop-color': stopColor, 'stop-opacity': stopOpacity }).add(gradientObject); // Add the stop element to the gradient gradientObject.stops.push(stopObject); }); // Keep a reference to the gradient object so it is possible to reuse it and // destroy it later gradients[key] = gradientObject; } return 'url(' + this.url + '#' + id + ')'; // Webkit and Batik can't show rgba. } else if (regexRgba.test(color)) { colorObject = Color(color); attr(elem, prop + '-opacity', colorObject.get('a')); return colorObject.get('rgb'); } else { // Remove the opacity attribute added above. Does not throw if the attribute is not there. elem.removeAttribute(prop + '-opacity'); return color; } }, /** * Add text to the SVG object * @param {String} str * @param {Number} x Left position * @param {Number} y Top position * @param {Boolean} useHTML Use HTML to render the text */ text: function (str, x, y, useHTML) { // declare variables var renderer = this, defaultChartStyle = defaultOptions.chart.style, wrapper; if (useHTML && !renderer.forExport) { return renderer.html(str, x, y); } x = mathRound(pick(x, 0)); y = mathRound(pick(y, 0)); wrapper = renderer.createElement('text') .attr({ x: x, y: y, text: str }) .css({ fontFamily: defaultChartStyle.fontFamily, fontSize: defaultChartStyle.fontSize }); wrapper.x = x; wrapper.y = y; return wrapper; }, /** * Create HTML text node. This is used by the VML renderer as well as the SVG * renderer through the useHTML option. * * @param {String} str * @param {Number} x * @param {Number} y */ html: function (str, x, y) { var defaultChartStyle = defaultOptions.chart.style, wrapper = this.createElement('span'), attrSetters = wrapper.attrSetters, element = wrapper.element, renderer = wrapper.renderer; // Text setter attrSetters.text = function (value) { element.innerHTML = value; return false; }; // Various setters which rely on update transform attrSetters.x = attrSetters.y = attrSetters.align = function (value, key) { if (key === 'align') { key = 'textAlign'; // Do not overwrite the SVGElement.align method. Same as VML. } wrapper[key] = value; wrapper.htmlUpdateTransform(); return false; }; // Set the default attributes wrapper.attr({ text: str, x: mathRound(x), y: mathRound(y) }) .css({ position: ABSOLUTE, whiteSpace: 'nowrap', fontFamily: defaultChartStyle.fontFamily, fontSize: defaultChartStyle.fontSize }); // Use the HTML specific .css method wrapper.css = wrapper.htmlCss; // This is specific for HTML within SVG if (renderer.isSVG) { wrapper.add = function (svgGroupWrapper) { var htmlGroup, htmlGroupStyle, container = renderer.box.parentNode; // Create a mock group to hold the HTML elements if (svgGroupWrapper) { htmlGroup = svgGroupWrapper.div; if (!htmlGroup) { htmlGroup = svgGroupWrapper.div = createElement(DIV, { className: attr(svgGroupWrapper.element, 'class') }, { position: ABSOLUTE, left: svgGroupWrapper.attr('translateX') + PX, top: svgGroupWrapper.attr('translateY') + PX }, container); // Ensure dynamic updating position htmlGroupStyle = htmlGroup.style; extend(svgGroupWrapper.attrSetters, { translateX: function (value) { htmlGroupStyle.left = value + PX; }, translateY: function (value) { htmlGroupStyle.top = value + PX; }, visibility: function (value, key) { htmlGroupStyle[key] = value; } }); } } else { htmlGroup = container; } htmlGroup.appendChild(element); // Shared with VML: wrapper.added = true; if (wrapper.alignOnAdd) { wrapper.htmlUpdateTransform(); } return wrapper; }; } return wrapper; }, /** * Add a label, a text item that can hold a colored or gradient background * as well as a border and shadow. * @param {string} str * @param {Number} x * @param {Number} y * @param {String} shape * @param {Number} anchorX In case the shape has a pointer, like a flag, this is the * coordinates it should be pinned to * @param {Number} anchorY */ label: function (str, x, y, shape, anchorX, anchorY, useHTML) { var renderer = this, wrapper = renderer.g(), text = renderer.text('', 0, 0, useHTML) .attr({ zIndex: 1 }) .add(wrapper), box, bBox, align = 'left', padding = 3, width, height, wrapperX, wrapperY, crispAdjust = 0, deferredAttr = {}, attrSetters = wrapper.attrSetters; /** * This function runs after the label is added to the DOM (when the bounding box is * available), and after the text of the label is updated to detect the new bounding * box and reflect it in the border box. */ function updateBoxSize() { bBox = (width === undefined || height === undefined || wrapper.styles.textAlign) && text.getBBox(true); wrapper.width = (width || bBox.width) + 2 * padding; wrapper.height = (height || bBox.height) + 2 * padding; // create the border box if it is not already present if (!box) { wrapper.box = box = shape ? renderer.symbol(shape, 0, 0, wrapper.width, wrapper.height) : renderer.rect(0, 0, wrapper.width, wrapper.height, 0, deferredAttr[STROKE_WIDTH]); box.add(wrapper); } // apply the box attributes box.attr(merge({ width: wrapper.width, height: wrapper.height }, deferredAttr)); deferredAttr = null; } /** * This function runs after setting text or padding, but only if padding is changed */ function updateTextPadding() { var styles = wrapper.styles, textAlign = styles && styles.textAlign, x = padding, style = wrapper.element.style, y = padding + mathRound(pInt((style && style.fontSize) || 11) * 1.2); // compensate for alignment if (defined(width) && (textAlign === 'center' || textAlign === 'right')) { x += { center: 0.5, right: 1 }[textAlign] * (width - bBox.width); } // update if anything changed if (x !== text.x || y !== text.y) { text.attr({ x: x, y: y }); } // record current values text.x = x; text.y = y; } /** * Set a box attribute, or defer it if the box is not yet created * @param {Object} key * @param {Object} value */ function boxAttr(key, value) { if (box) { box.attr(key, value); } else { deferredAttr[key] = value; } } function getSizeAfterAdd() { wrapper.attr({ text: str, // alignment is available now x: x, y: y, anchorX: anchorX, anchorY: anchorY }); } /** * After the text element is added, get the desired size of the border box * and add it before the text in the DOM. */ addEvent(wrapper, 'add', getSizeAfterAdd); /* * Add specific attribute setters. */ // only change local variables attrSetters.width = function (value) { width = value; return false; }; attrSetters.height = function (value) { height = value; return false; }; attrSetters.padding = function (value) { padding = value; updateTextPadding(); return false; }; // change local variable and set attribue as well attrSetters.align = function (value) { align = value; return false; // prevent setting text-anchor on the group }; // apply these to the box and the text alike attrSetters.text = function (value, key) { text.attr(key, value); updateBoxSize(); updateTextPadding(); return false; }; // apply these to the box but not to the text attrSetters[STROKE_WIDTH] = function (value, key) { crispAdjust = value % 2 / 2; boxAttr(key, value); return false; }; attrSetters.stroke = attrSetters.fill = attrSetters.r = function (value, key) { boxAttr(key, value); return false; }; attrSetters.anchorX = function (value, key) { anchorX = value; boxAttr(key, value + crispAdjust - wrapperX); return false; }; attrSetters.anchorY = function (value, key) { anchorY = value; boxAttr(key, value - wrapperY); return false; }; // rename attributes attrSetters.x = function (value) { wrapperX = value; wrapperX -= { left: 0, center: 0.5, right: 1 }[align] * ((width || bBox.width) + padding); wrapper.attr('translateX', mathRound(wrapperX)); return false; }; attrSetters.y = function (value) { wrapperY = value; wrapper.attr('translateY', mathRound(value)); return false; }; // Redirect certain methods to either the box or the text var baseCss = wrapper.css; return extend(wrapper, { /** * Pick up some properties and apply them to the text instead of the wrapper */ css: function (styles) { if (styles) { var textStyles = {}; styles = merge({}, styles); // create a copy to avoid altering the original object (#537) each(['fontSize', 'fontWeight', 'fontFamily', 'color', 'lineHeight', 'width'], function (prop) { if (styles[prop] !== UNDEFINED) { textStyles[prop] = styles[prop]; delete styles[prop]; } }); text.css(textStyles); } return baseCss.call(wrapper, styles); }, /** * Return the bounding box of the box, not the group */ getBBox: function () { return box.getBBox(); }, /** * Apply the shadow to the box */ shadow: function (b) { box.shadow(b); return wrapper; }, /** * Destroy and release memory. */ destroy: function () { removeEvent(wrapper, 'add', getSizeAfterAdd); // Added by button implementation removeEvent(wrapper.element, 'mouseenter'); removeEvent(wrapper.element, 'mouseleave'); if (text) { // Destroy the text element text = text.destroy(); } // Call base implementation to destroy the rest SVGElement.prototype.destroy.call(wrapper); } }); } }; // end SVGRenderer // general renderer Renderer = SVGRenderer; /* **************************************************************************** * * * START OF INTERNET EXPLORER <= 8 SPECIFIC CODE * * * * For applications and websites that don't need IE support, like platform * * targeted mobile apps and web apps, this code can be removed. * * * *****************************************************************************/ /** * @constructor */ var VMLRenderer; if (!hasSVG && !useCanVG) { /** * The VML element wrapper. */ var VMLElementExtension = { /** * Initialize a new VML element wrapper. It builds the markup as a string * to minimize DOM traffic. * @param {Object} renderer * @param {Object} nodeName */ init: function (renderer, nodeName) { var wrapper = this, markup = ['<', nodeName, ' filled="f" stroked="f"'], style = ['position: ', ABSOLUTE, ';']; // divs and shapes need size if (nodeName === 'shape' || nodeName === DIV) { style.push('left:0;top:0;width:10px;height:10px;'); } if (docMode8) { style.push('visibility: ', nodeName === DIV ? HIDDEN : VISIBLE); } markup.push(' style="', style.join(''), '"/>'); // create element with default attributes and style if (nodeName) { markup = nodeName === DIV || nodeName === 'span' || nodeName === 'img' ? markup.join('') : renderer.prepVML(markup); wrapper.element = createElement(markup); } wrapper.renderer = renderer; wrapper.attrSetters = {}; }, /** * Add the node to the given parent * @param {Object} parent */ add: function (parent) { var wrapper = this, renderer = wrapper.renderer, element = wrapper.element, box = renderer.box, inverted = parent && parent.inverted, // get the parent node parentNode = parent ? parent.element || parent : box; // if the parent group is inverted, apply inversion on all children if (inverted) { // only on groups renderer.invertChild(element, parentNode); } // issue #140 workaround - related to #61 and #74 if (docMode8 && parentNode.gVis === HIDDEN) { css(element, { visibility: HIDDEN }); } // append it parentNode.appendChild(element); // align text after adding to be able to read offset wrapper.added = true; if (wrapper.alignOnAdd && !wrapper.deferUpdateTransform) { wrapper.htmlUpdateTransform(); } // fire an event for internal hooks fireEvent(wrapper, 'add'); return wrapper; }, /** * In IE8 documentMode 8, we need to recursively set the visibility down in the DOM * tree for nested groups. Related to #61, #586. */ toggleChildren: function (element, visibility) { var childNodes = element.childNodes, i = childNodes.length; while (i--) { // apply the visibility css(childNodes[i], { visibility: visibility }); // we have a nested group, apply it to its children again if (childNodes[i].nodeName === 'DIV') { this.toggleChildren(childNodes[i], visibility); } } }, /** * Get or set attributes */ attr: function (hash, val) { var wrapper = this, key, value, i, result, element = wrapper.element || {}, elemStyle = element.style, nodeName = element.nodeName, renderer = wrapper.renderer, symbolName = wrapper.symbolName, hasSetSymbolSize, shadows = wrapper.shadows, skipAttr, attrSetters = wrapper.attrSetters, ret = wrapper; // single key-value pair if (isString(hash) && defined(val)) { key = hash; hash = {}; hash[key] = val; } // used as a getter, val is undefined if (isString(hash)) { key = hash; if (key === 'strokeWidth' || key === 'stroke-width') { ret = wrapper.strokeweight; } else { ret = wrapper[key]; } // setter } else { for (key in hash) { value = hash[key]; skipAttr = false; // check for a specific attribute setter result = attrSetters[key] && attrSetters[key](value, key); if (result !== false && value !== null) { // #620 if (result !== UNDEFINED) { value = result; // the attribute setter has returned a new value to set } // prepare paths // symbols if (symbolName && /^(x|y|r|start|end|width|height|innerR|anchorX|anchorY)/.test(key)) { // if one of the symbol size affecting parameters are changed, // check all the others only once for each call to an element's // .attr() method if (!hasSetSymbolSize) { wrapper.symbolAttr(hash); hasSetSymbolSize = true; } skipAttr = true; } else if (key === 'd') { value = value || []; wrapper.d = value.join(' '); // used in getter for animation // convert paths i = value.length; var convertedPath = []; while (i--) { // Multiply by 10 to allow subpixel precision. // Substracting half a pixel seems to make the coordinates // align with SVG, but this hasn't been tested thoroughly if (isNumber(value[i])) { convertedPath[i] = mathRound(value[i] * 10) - 5; } else if (value[i] === 'Z') { // close the path convertedPath[i] = 'x'; } else { convertedPath[i] = value[i]; } } value = convertedPath.join(' ') || 'x'; element.path = value; // update shadows if (shadows) { i = shadows.length; while (i--) { shadows[i].path = value; } } skipAttr = true; // directly mapped to css } else if (key === 'zIndex' || key === 'visibility') { // workaround for #61 and #586 if (docMode8 && key === 'visibility' && nodeName === 'DIV') { element.gVis = value; wrapper.toggleChildren(element, value); if (value === VISIBLE) { // #74 value = null; } } if (value) { elemStyle[key] = value; } skipAttr = true; // width and height } else if (key === 'width' || key === 'height') { value = mathMax(0, value); // don't set width or height below zero (#311) this[key] = value; // used in getter // clipping rectangle special if (wrapper.updateClipping) { wrapper[key] = value; wrapper.updateClipping(); } else { // normal elemStyle[key] = value; } skipAttr = true; // x and y } else if (key === 'x' || key === 'y') { wrapper[key] = value; // used in getter elemStyle[{ x: 'left', y: 'top' }[key]] = value; // class name } else if (key === 'class') { // IE8 Standards mode has problems retrieving the className element.className = value; // stroke } else if (key === 'stroke') { value = renderer.color(value, element, key); key = 'strokecolor'; // stroke width } else if (key === 'stroke-width' || key === 'strokeWidth') { element.stroked = value ? true : false; key = 'strokeweight'; wrapper[key] = value; // used in getter, issue #113 if (isNumber(value)) { value += PX; } // dashStyle } else if (key === 'dashstyle') { var strokeElem = element.getElementsByTagName('stroke')[0] || createElement(renderer.prepVML(['<stroke/>']), null, null, element); strokeElem[key] = value || 'solid'; wrapper.dashstyle = value; /* because changing stroke-width will change the dash length and cause an epileptic effect */ skipAttr = true; // fill } else if (key === 'fill') { if (nodeName === 'SPAN') { // text color elemStyle.color = value; } else { element.filled = value !== NONE ? true : false; value = renderer.color(value, element, key); key = 'fillcolor'; } // translation for animation } else if (key === 'translateX' || key === 'translateY' || key === 'rotation') { wrapper[key] = value; wrapper.htmlUpdateTransform(); skipAttr = true; // text for rotated and non-rotated elements } else if (key === 'text') { this.bBox = null; element.innerHTML = value; skipAttr = true; } // let the shadow follow the main element if (shadows && key === 'visibility') { i = shadows.length; while (i--) { shadows[i].style[key] = value; } } if (!skipAttr) { if (docMode8) { // IE8 setAttribute bug element[key] = value; } else { attr(element, key, value); } } } } } return ret; }, /** * Set the element's clipping to a predefined rectangle * * @param {String} id The id of the clip rectangle */ clip: function (clipRect) { var wrapper = this, clipMembers = clipRect.members; clipMembers.push(wrapper); wrapper.destroyClip = function () { erase(clipMembers, wrapper); }; return wrapper.css(clipRect.getCSS(wrapper.inverted)); }, /** * Set styles for the element * @param {Object} styles */ css: SVGElement.prototype.htmlCss, /** * Removes a child either by removeChild or move to garbageBin. * Issue 490; in VML removeChild results in Orphaned nodes according to sIEve, discardElement does not. */ safeRemoveChild: function (element) { // discardElement will detach the node from its parent before attaching it // to the garbage bin. Therefore it is important that the node is attached and have parent. var parentNode = element.parentNode; if (parentNode) { discardElement(element); } }, /** * Extend element.destroy by removing it from the clip members array */ destroy: function () { var wrapper = this; if (wrapper.destroyClip) { wrapper.destroyClip(); } return SVGElement.prototype.destroy.apply(wrapper); }, /** * Remove all child nodes of a group, except the v:group element */ empty: function () { var element = this.element, childNodes = element.childNodes, i = childNodes.length, node; while (i--) { node = childNodes[i]; node.parentNode.removeChild(node); } }, /** * Add an event listener. VML override for normalizing event parameters. * @param {String} eventType * @param {Function} handler */ on: function (eventType, handler) { // simplest possible event model for internal use this.element['on' + eventType] = function () { var evt = win.event; evt.target = evt.srcElement; handler(evt); }; return this; }, /** * Apply a drop shadow by copying elements and giving them different strokes * @param {Boolean} apply */ shadow: function (apply, group) { var shadows = [], i, element = this.element, renderer = this.renderer, shadow, elemStyle = element.style, markup, path = element.path; // some times empty paths are not strings if (path && typeof path.value !== 'string') { path = 'x'; } if (apply) { for (i = 1; i <= 3; i++) { markup = ['<shape isShadow="true" strokeweight="', (7 - 2 * i), '" filled="false" path="', path, '" coordsize="100,100" style="', element.style.cssText, '" />']; shadow = createElement(renderer.prepVML(markup), null, { left: pInt(elemStyle.left) + 1, top: pInt(elemStyle.top) + 1 } ); // apply the opacity markup = ['<stroke color="black" opacity="', (0.05 * i), '"/>']; createElement(renderer.prepVML(markup), null, null, shadow); // insert it if (group) { group.element.appendChild(shadow); } else { element.parentNode.insertBefore(shadow, element); } // record it shadows.push(shadow); } this.shadows = shadows; } return this; } }, VMLElement = extendClass(SVGElement, VMLElementExtension), /** * The VML renderer */ VMLRendererExtension = { // inherit SVGRenderer Element: VMLElement, isIE8: userAgent.indexOf('MSIE 8.0') > -1, /** * Initialize the VMLRenderer * @param {Object} container * @param {Number} width * @param {Number} height */ init: function (container, width, height) { var renderer = this, boxWrapper; renderer.alignedObjects = []; boxWrapper = renderer.createElement(DIV); container.appendChild(boxWrapper.element); // generate the containing box renderer.box = boxWrapper.element; renderer.boxWrapper = boxWrapper; renderer.setSize(width, height, false); // The only way to make IE6 and IE7 print is to use a global namespace. However, // with IE8 the only way to make the dynamic shapes visible in screen and print mode // seems to be to add the xmlns attribute and the behaviour style inline. if (!doc.namespaces.hcv) { doc.namespaces.add('hcv', 'urn:schemas-microsoft-com:vml'); // setup default css doc.createStyleSheet().cssText = 'hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke' + '{ behavior:url(#default#VML); display: inline-block; } '; } }, /** * Define a clipping rectangle. In VML it is accomplished by storing the values * for setting the CSS style to all associated members. * * @param {Number} x * @param {Number} y * @param {Number} width * @param {Number} height */ clipRect: function (x, y, width, height) { // create a dummy element var clipRect = this.createElement(); // mimic a rectangle with its style object for automatic updating in attr return extend(clipRect, { members: [], left: x, top: y, width: width, height: height, getCSS: function (inverted) { var rect = this,//clipRect.element.style, top = rect.top, left = rect.left, right = left + rect.width, bottom = top + rect.height, ret = { clip: 'rect(' + mathRound(inverted ? left : top) + 'px,' + mathRound(inverted ? bottom : right) + 'px,' + mathRound(inverted ? right : bottom) + 'px,' + mathRound(inverted ? top : left) + 'px)' }; // issue 74 workaround if (!inverted && docMode8) { extend(ret, { width: right + PX, height: bottom + PX }); } return ret; }, // used in attr and animation to update the clipping of all members updateClipping: function () { each(clipRect.members, function (member) { member.css(clipRect.getCSS(member.inverted)); }); } }); }, /** * Take a color and return it if it's a string, make it a gradient if it's a * gradient configuration object, and apply opacity. * * @param {Object} color The color or config object */ color: function (color, elem, prop) { var colorObject, regexRgba = /^rgba/, markup; if (color && color[LINEAR_GRADIENT]) { var stopColor, stopOpacity, linearGradient = color[LINEAR_GRADIENT], x1 = linearGradient.x1 || linearGradient[0] || 0, y1 = linearGradient.y1 || linearGradient[1] || 0, x2 = linearGradient.x2 || linearGradient[2] || 0, y2 = linearGradient.y2 || linearGradient[3] || 0, angle, color1, opacity1, color2, opacity2; each(color.stops, function (stop, i) { if (regexRgba.test(stop[1])) { colorObject = Color(stop[1]); stopColor = colorObject.get('rgb'); stopOpacity = colorObject.get('a'); } else { stopColor = stop[1]; stopOpacity = 1; } if (!i) { // first color1 = stopColor; opacity1 = stopOpacity; } else { color2 = stopColor; opacity2 = stopOpacity; } }); // Apply the gradient to fills only. if (prop === 'fill') { // calculate the angle based on the linear vector angle = 90 - math.atan( (y2 - y1) / // y vector (x2 - x1) // x vector ) * 180 / mathPI; // when colors attribute is used, the meanings of opacity and o:opacity2 // are reversed. markup = ['<fill colors="0% ', color1, ',100% ', color2, '" angle="', angle, '" opacity="', opacity2, '" o:opacity2="', opacity1, '" type="gradient" focus="100%" method="any" />']; createElement(this.prepVML(markup), null, null, elem); // Gradients are not supported for VML stroke, return the first color. #722. } else { return stopColor; } // if the color is an rgba color, split it and add a fill node // to hold the opacity component } else if (regexRgba.test(color) && elem.tagName !== 'IMG') { colorObject = Color(color); markup = ['<', prop, ' opacity="', colorObject.get('a'), '"/>']; createElement(this.prepVML(markup), null, null, elem); return colorObject.get('rgb'); } else { var strokeNodes = elem.getElementsByTagName(prop); if (strokeNodes.length) { strokeNodes[0].opacity = 1; } return color; } }, /** * Take a VML string and prepare it for either IE8 or IE6/IE7. * @param {Array} markup A string array of the VML markup to prepare */ prepVML: function (markup) { var vmlStyle = 'display:inline-block;behavior:url(#default#VML);', isIE8 = this.isIE8; markup = markup.join(''); if (isIE8) { // add xmlns and style inline markup = markup.replace('/>', ' xmlns="urn:schemas-microsoft-com:vml" />'); if (markup.indexOf('style="') === -1) { markup = markup.replace('/>', ' style="' + vmlStyle + '" />'); } else { markup = markup.replace('style="', 'style="' + vmlStyle); } } else { // add namespace markup = markup.replace('<', '<hcv:'); } return markup; }, /** * Create rotated and aligned text * @param {String} str * @param {Number} x * @param {Number} y */ text: SVGRenderer.prototype.html, /** * Create and return a path element * @param {Array} path */ path: function (path) { // create the shape return this.createElement('shape').attr({ // subpixel precision down to 0.1 (width and height = 10px) coordsize: '100 100', d: path }); }, /** * Create and return a circle element. In VML circles are implemented as * shapes, which is faster than v:oval * @param {Number} x * @param {Number} y * @param {Number} r */ circle: function (x, y, r) { return this.symbol('circle').attr({ x: x - r, y: y - r, width: 2 * r, height: 2 * r }); }, /** * Create a group using an outer div and an inner v:group to allow rotating * and flipping. A simple v:group would have problems with positioning * child HTML elements and CSS clip. * * @param {String} name The name of the group */ g: function (name) { var wrapper, attribs; // set the class name if (name) { attribs = { 'className': PREFIX + name, 'class': PREFIX + name }; } // the div to hold HTML and clipping wrapper = this.createElement(DIV).attr(attribs); return wrapper; }, /** * VML override to create a regular HTML image * @param {String} src * @param {Number} x * @param {Number} y * @param {Number} width * @param {Number} height */ image: function (src, x, y, width, height) { var obj = this.createElement('img') .attr({ src: src }); if (arguments.length > 1) { obj.css({ left: x, top: y, width: width, height: height }); } return obj; }, /** * VML uses a shape for rect to overcome bugs and rotation problems */ rect: function (x, y, width, height, r, strokeWidth) { if (isObject(x)) { y = x.y; width = x.width; height = x.height; strokeWidth = x.strokeWidth; x = x.x; } var wrapper = this.symbol('rect'); wrapper.r = r; return wrapper.attr(wrapper.crisp(strokeWidth, x, y, mathMax(width, 0), mathMax(height, 0))); }, /** * In the VML renderer, each child of an inverted div (group) is inverted * @param {Object} element * @param {Object} parentNode */ invertChild: function (element, parentNode) { var parentStyle = parentNode.style; css(element, { flip: 'x', left: pInt(parentStyle.width) - 10, top: pInt(parentStyle.height) - 10, rotation: -90 }); }, /** * Symbol definitions that override the parent SVG renderer's symbols * */ symbols: { // VML specific arc function arc: function (x, y, w, h, options) { var start = options.start, end = options.end, radius = options.r || w || h, cosStart = mathCos(start), sinStart = mathSin(start), cosEnd = mathCos(end), sinEnd = mathSin(end), innerRadius = options.innerR, circleCorrection = 0.07 / radius, innerCorrection = (innerRadius && 0.1 / innerRadius) || 0; if (end - start === 0) { // no angle, don't show it. return ['x']; //} else if (end - start == 2 * mathPI) { // full circle } else if (2 * mathPI - end + start < circleCorrection) { // full circle // empirical correction found by trying out the limits for different radii cosEnd = -circleCorrection; } else if (end - start < innerCorrection) { // issue #186, another mysterious VML arc problem cosEnd = mathCos(start + innerCorrection); } return [ 'wa', // clockwise arc to x - radius, // left y - radius, // top x + radius, // right y + radius, // bottom x + radius * cosStart, // start x y + radius * sinStart, // start y x + radius * cosEnd, // end x y + radius * sinEnd, // end y 'at', // anti clockwise arc to x - innerRadius, // left y - innerRadius, // top x + innerRadius, // right y + innerRadius, // bottom x + innerRadius * cosEnd, // start x y + innerRadius * sinEnd, // start y x + innerRadius * cosStart, // end x y + innerRadius * sinStart, // end y 'x', // finish path 'e' // close ]; }, // Add circle symbol path. This performs significantly faster than v:oval. circle: function (x, y, w, h) { return [ 'wa', // clockwisearcto x, // left y, // top x + w, // right y + h, // bottom x + w, // start x y + h / 2, // start y x + w, // end x y + h / 2, // end y //'x', // finish path 'e' // close ]; }, /** * Add rectangle symbol path which eases rotation and omits arcsize problems * compared to the built-in VML roundrect shape * * @param {Number} left Left position * @param {Number} top Top position * @param {Number} r Border radius * @param {Object} options Width and height */ rect: function (left, top, width, height, options) { /*for (var n in r) { logTime && console .log(n) }*/ if (!defined(options)) { return []; } var right = left + width, bottom = top + height, r = mathMin(options.r || 0, width, height); return [ M, left + r, top, L, right - r, top, 'wa', right - 2 * r, top, right, top + 2 * r, right - r, top, right, top + r, L, right, bottom - r, 'wa', right - 2 * r, bottom - 2 * r, right, bottom, right, bottom - r, right - r, bottom, L, left + r, bottom, 'wa', left, bottom - 2 * r, left + 2 * r, bottom, left + r, bottom, left, bottom - r, L, left, top + r, 'wa', left, top, left + 2 * r, top + 2 * r, left, top + r, left + r, top, 'x', 'e' ]; } } }; VMLRenderer = function () { this.init.apply(this, arguments); }; VMLRenderer.prototype = merge(SVGRenderer.prototype, VMLRendererExtension); // general renderer Renderer = VMLRenderer; } /* **************************************************************************** * * * END OF INTERNET EXPLORER <= 8 SPECIFIC CODE * * * *****************************************************************************/ /* **************************************************************************** * * * START OF ANDROID < 3 SPECIFIC CODE. THIS CAN BE REMOVED IF YOU'RE NOT * * TARGETING THAT SYSTEM. * * * *****************************************************************************/ var CanVGRenderer, CanVGController; if (useCanVG) { /** * The CanVGRenderer is empty from start to keep the source footprint small. * When requested, the CanVGController downloads the rest of the source packaged * together with the canvg library. */ CanVGRenderer = function () { // Empty constructor }; /** * Handles on demand download of canvg rendering support. */ CanVGController = (function () { // List of renderering calls var deferredRenderCalls = []; /** * When downloaded, we are ready to draw deferred charts. */ function drawDeferred() { var callLength = deferredRenderCalls.length, callIndex; // Draw all pending render calls for (callIndex = 0; callIndex < callLength; callIndex++) { deferredRenderCalls[callIndex](); } // Clear the list deferredRenderCalls = []; } return { push: function (func, scriptLocation) { // Only get the script once if (deferredRenderCalls.length === 0) { getScript(scriptLocation, drawDeferred); } // Register render call deferredRenderCalls.push(func); } }; }()); } // end CanVGRenderer /* **************************************************************************** * * * END OF ANDROID < 3 SPECIFIC CODE * * * *****************************************************************************/ /** * General renderer */ Renderer = VMLRenderer || CanVGRenderer || SVGRenderer; /** * The chart class * @param {Object} options * @param {Function} callback Function to run when the chart has loaded */ function Chart(options, callback) { // Handle regular options var seriesOptions = options.series; // skip merging data points to increase performance options.series = null; options = merge(defaultOptions, options); // do the merge options.series = seriesOptions; // set back the series data var optionsChart = options.chart, optionsMargin = optionsChart.margin, margin = isObject(optionsMargin) ? optionsMargin : [optionsMargin, optionsMargin, optionsMargin, optionsMargin], optionsMarginTop = pick(optionsChart.marginTop, margin[0]), optionsMarginRight = pick(optionsChart.marginRight, margin[1]), optionsMarginBottom = pick(optionsChart.marginBottom, margin[2]), optionsMarginLeft = pick(optionsChart.marginLeft, margin[3]), spacingTop = optionsChart.spacingTop, spacingRight = optionsChart.spacingRight, spacingBottom = optionsChart.spacingBottom, spacingLeft = optionsChart.spacingLeft, spacingBox, chartTitleOptions, chartSubtitleOptions, plotTop, marginRight, marginBottom, plotLeft, axisOffset, renderTo, renderToClone, container, containerId, containerWidth, containerHeight, chartWidth, chartHeight, oldChartWidth, oldChartHeight, chartBackground, plotBackground, plotBGImage, plotBorder, chart = this, chartEvents = optionsChart.events, runChartClick = chartEvents && !!chartEvents.click, eventType, isInsidePlot, // function tooltip, mouseIsDown, loadingDiv, loadingSpan, loadingShown, plotHeight, plotWidth, tracker, trackerGroup, placeTrackerGroup, legend, legendWidth, legendHeight, chartPosition, hasCartesianSeries = optionsChart.showAxes, isResizing = 0, axes = [], maxTicks, // handle the greatest amount of ticks on grouped axes series = [], inverted, renderer, tooltipTick, tooltipInterval, hoverX, drawChartBox, // function getMargins, // function resetMargins, // function setChartSize, // function resize, zoom, // function zoomOut; // function /** * Create a new axis object * @param {Object} options */ function Axis(userOptions) { // Define variables var isXAxis = userOptions.isX, opposite = userOptions.opposite, // needed in setOptions horiz = inverted ? !isXAxis : isXAxis, side = horiz ? (opposite ? 0 : 2) : // top : bottom (opposite ? 1 : 3), // right : left stacks = {}, options = merge( isXAxis ? defaultXAxisOptions : defaultYAxisOptions, [defaultTopAxisOptions, defaultRightAxisOptions, defaultBottomAxisOptions, defaultLeftAxisOptions][side], userOptions ), axis = this, axisTitle, type = options.type, isDatetimeAxis = type === 'datetime', isLog = type === 'logarithmic', offset = options.offset || 0, xOrY = isXAxis ? 'x' : 'y', axisLength = 0, oldAxisLength, transA, // translation factor transB, // translation addend oldTransA, // used for prerendering axisLeft, axisTop, axisWidth, axisHeight, axisBottom, axisRight, translate, // fn setAxisTranslation, // fn getPlotLinePath, // fn axisGroup, gridGroup, axisLine, dataMin, dataMax, minRange = options.minRange || options.maxZoom, range = options.range, userMin, userMax, oldUserMin, oldUserMax, max = null, min = null, oldMin, oldMax, minPadding = options.minPadding, maxPadding = options.maxPadding, minPixelPadding = 0, isLinked = defined(options.linkedTo), linkedParent, ignoreMinPadding, // can be set to true by a column or bar series ignoreMaxPadding, usePercentage, events = options.events, eventType, plotLinesAndBands = [], tickInterval, minorTickInterval, magnitude, tickPositions, // array containing predefined positions tickPositioner = options.tickPositioner, ticks = {}, minorTicks = {}, alternateBands = {}, tickAmount, labelOffset, axisTitleMargin,// = options.title.margin, categories = options.categories, labelFormatter = options.labels.formatter || // can be overwritten by dynamic format function () { var value = this.value, dateTimeLabelFormat = this.dateTimeLabelFormat, ret; if (dateTimeLabelFormat) { // datetime axis ret = dateFormat(dateTimeLabelFormat, value); } else if (tickInterval % 1000000 === 0) { // use M abbreviation ret = (value / 1000000) + 'M'; } else if (tickInterval % 1000 === 0) { // use k abbreviation ret = (value / 1000) + 'k'; } else if (!categories && value >= 1000) { // add thousands separators ret = numberFormat(value, 0); } else { // strings (categories) and small numbers ret = value; } return ret; }, staggerLines = horiz && options.labels.staggerLines, reversed = options.reversed, tickmarkOffset = (categories && options.tickmarkPlacement === 'between') ? 0.5 : 0; /** * The Tick class */ function Tick(pos, type) { var tick = this; tick.pos = pos; tick.type = type || ''; tick.isNew = true; if (!type) { tick.addLabel(); } } Tick.prototype = { /** * Write the tick label */ addLabel: function () { var tick = this, pos = tick.pos, labelOptions = options.labels, str, width = (categories && horiz && categories.length && !labelOptions.step && !labelOptions.staggerLines && !labelOptions.rotation && plotWidth / categories.length) || (!horiz && plotWidth / 2), isFirst = pos === tickPositions[0], isLast = pos === tickPositions[tickPositions.length - 1], css, value = categories && defined(categories[pos]) ? categories[pos] : pos, label = tick.label, tickPositionInfo = tickPositions.info, dateTimeLabelFormat; // Set the datetime label format. If a higher rank is set for this position, use that. If not, // use the general format. if (isDatetimeAxis && tickPositionInfo) { dateTimeLabelFormat = options.dateTimeLabelFormats[tickPositionInfo.higherRanks[pos] || tickPositionInfo.unitName]; } // set properties for access in render method tick.isFirst = isFirst; tick.isLast = isLast; // get the string str = labelFormatter.call({ axis: axis, chart: chart, isFirst: isFirst, isLast: isLast, dateTimeLabelFormat: dateTimeLabelFormat, value: isLog ? correctFloat(lin2log(value)) : value }); // prepare CSS css = width && { width: mathMax(1, mathRound(width - 2 * (labelOptions.padding || 10))) + PX }; css = extend(css, labelOptions.style); // first call if (!defined(label)) { tick.label = defined(str) && labelOptions.enabled ? renderer.text( str, 0, 0, labelOptions.useHTML ) .attr({ align: labelOptions.align, rotation: labelOptions.rotation }) // without position absolute, IE export sometimes is wrong .css(css) .add(axisGroup) : null; // update } else if (label) { label.attr({ text: str }) .css(css); } }, /** * Get the offset height or width of the label */ getLabelSize: function () { var label = this.label; return label ? ((this.labelBBox = label.getBBox()))[horiz ? 'height' : 'width'] : 0; }, /** * Put everything in place * * @param index {Number} * @param old {Boolean} Use old coordinates to prepare an animation into new position */ render: function (index, old) { var tick = this, type = tick.type, label = tick.label, pos = tick.pos, labelOptions = options.labels, gridLine = tick.gridLine, gridPrefix = type ? type + 'Grid' : 'grid', tickPrefix = type ? type + 'Tick' : 'tick', gridLineWidth = options[gridPrefix + 'LineWidth'], gridLineColor = options[gridPrefix + 'LineColor'], dashStyle = options[gridPrefix + 'LineDashStyle'], tickLength = options[tickPrefix + 'Length'], tickWidth = options[tickPrefix + 'Width'] || 0, tickColor = options[tickPrefix + 'Color'], tickPosition = options[tickPrefix + 'Position'], gridLinePath, mark = tick.mark, markPath, step = labelOptions.step, cHeight = (old && oldChartHeight) || chartHeight, attribs, x, y; // get x and y position for ticks and labels x = horiz ? translate(pos + tickmarkOffset, null, null, old) + transB : axisLeft + offset + (opposite ? ((old && oldChartWidth) || chartWidth) - axisRight - axisLeft : 0); y = horiz ? cHeight - axisBottom + offset - (opposite ? axisHeight : 0) : cHeight - translate(pos + tickmarkOffset, null, null, old) - transB; // create the grid line if (gridLineWidth) { gridLinePath = getPlotLinePath(pos + tickmarkOffset, gridLineWidth, old); if (gridLine === UNDEFINED) { attribs = { stroke: gridLineColor, 'stroke-width': gridLineWidth }; if (dashStyle) { attribs.dashstyle = dashStyle; } if (!type) { attribs.zIndex = 1; } tick.gridLine = gridLine = gridLineWidth ? renderer.path(gridLinePath) .attr(attribs).add(gridGroup) : null; } // If the parameter 'old' is set, the current call will be followed // by another call, therefore do not do any animations this time if (!old && gridLine && gridLinePath) { gridLine.animate({ d: gridLinePath }); } } // create the tick mark if (tickWidth) { // negate the length if (tickPosition === 'inside') { tickLength = -tickLength; } if (opposite) { tickLength = -tickLength; } markPath = renderer.crispLine([ M, x, y, L, x + (horiz ? 0 : -tickLength), y + (horiz ? tickLength : 0) ], tickWidth); if (mark) { // updating mark.animate({ d: markPath }); } else { // first time tick.mark = renderer.path( markPath ).attr({ stroke: tickColor, 'stroke-width': tickWidth }).add(axisGroup); } } // the label is created on init - now move it into place if (label && !isNaN(x)) { x = x + labelOptions.x - (tickmarkOffset && horiz ? tickmarkOffset * transA * (reversed ? -1 : 1) : 0); y = y + labelOptions.y - (tickmarkOffset && !horiz ? tickmarkOffset * transA * (reversed ? 1 : -1) : 0); // vertically centered if (!defined(labelOptions.y)) { y += pInt(label.styles.lineHeight) * 0.9 - label.getBBox().height / 2; } // correct for staggered labels if (staggerLines) { y += (index / (step || 1) % staggerLines) * 16; } // apply show first and show last if ((tick.isFirst && !pick(options.showFirstLabel, 1)) || (tick.isLast && !pick(options.showLastLabel, 1))) { label.hide(); } else { // show those that may have been previously hidden, either by show first/last, or by step label.show(); } // apply step if (step && index % step) { // show those indices dividable by step label.hide(); } label[tick.isNew ? 'attr' : 'animate']({ x: x, y: y }); } tick.isNew = false; }, /** * Destructor for the tick prototype */ destroy: function () { destroyObjectProperties(this); } }; /** * The object wrapper for plot lines and plot bands * @param {Object} options */ function PlotLineOrBand(options) { var plotLine = this; if (options) { plotLine.options = options; plotLine.id = options.id; } //plotLine.render() return plotLine; } PlotLineOrBand.prototype = { /** * Render the plot line or plot band. If it is already existing, * move it. */ render: function () { var plotLine = this, halfPointRange = (axis.pointRange || 0) / 2, options = plotLine.options, optionsLabel = options.label, label = plotLine.label, width = options.width, to = options.to, from = options.from, value = options.value, toPath, // bands only dashStyle = options.dashStyle, svgElem = plotLine.svgElem, path = [], addEvent, eventType, xs, ys, x, y, color = options.color, zIndex = options.zIndex, events = options.events, attribs; // logarithmic conversion if (isLog) { from = log2lin(from); to = log2lin(to); value = log2lin(value); } // plot line if (width) { path = getPlotLinePath(value, width); attribs = { stroke: color, 'stroke-width': width }; if (dashStyle) { attribs.dashstyle = dashStyle; } } else if (defined(from) && defined(to)) { // plot band // keep within plot area from = mathMax(from, min - halfPointRange); to = mathMin(to, max + halfPointRange); toPath = getPlotLinePath(to); path = getPlotLinePath(from); if (path && toPath) { path.push( toPath[4], toPath[5], toPath[1], toPath[2] ); } else { // outside the axis area path = null; } attribs = { fill: color }; } else { return; } // zIndex if (defined(zIndex)) { attribs.zIndex = zIndex; } // common for lines and bands if (svgElem) { if (path) { svgElem.animate({ d: path }, null, svgElem.onGetPath); } else { svgElem.hide(); svgElem.onGetPath = function () { svgElem.show(); }; } } else if (path && path.length) { plotLine.svgElem = svgElem = renderer.path(path) .attr(attribs).add(); // events if (events) { addEvent = function (eventType) { svgElem.on(eventType, function (e) { events[eventType].apply(plotLine, [e]); }); }; for (eventType in events) { addEvent(eventType); } } } // the plot band/line label if (optionsLabel && defined(optionsLabel.text) && path && path.length && axisWidth > 0 && axisHeight > 0) { // apply defaults optionsLabel = merge({ align: horiz && toPath && 'center', x: horiz ? !toPath && 4 : 10, verticalAlign : !horiz && toPath && 'middle', y: horiz ? toPath ? 16 : 10 : toPath ? 6 : -4, rotation: horiz && !toPath && 90 }, optionsLabel); // add the SVG element if (!label) { plotLine.label = label = renderer.text( optionsLabel.text, 0, 0 ) .attr({ align: optionsLabel.textAlign || optionsLabel.align, rotation: optionsLabel.rotation, zIndex: zIndex }) .css(optionsLabel.style) .add(); } // get the bounding box and align the label xs = [path[1], path[4], pick(path[6], path[1])]; ys = [path[2], path[5], pick(path[7], path[2])]; x = arrayMin(xs); y = arrayMin(ys); label.align(optionsLabel, false, { x: x, y: y, width: arrayMax(xs) - x, height: arrayMax(ys) - y }); label.show(); } else if (label) { // move out of sight label.hide(); } // chainable return plotLine; }, /** * Remove the plot line or band */ destroy: function () { var obj = this; destroyObjectProperties(obj); // remove it from the lookup erase(plotLinesAndBands, obj); } }; /** * The class for stack items */ function StackItem(options, isNegative, x, stackOption) { var stackItem = this; // Tells if the stack is negative stackItem.isNegative = isNegative; // Save the options to be able to style the label stackItem.options = options; // Save the x value to be able to position the label later stackItem.x = x; // Save the stack option on the series configuration object stackItem.stack = stackOption; // The align options and text align varies on whether the stack is negative and // if the chart is inverted or not. // First test the user supplied value, then use the dynamic. stackItem.alignOptions = { align: options.align || (inverted ? (isNegative ? 'left' : 'right') : 'center'), verticalAlign: options.verticalAlign || (inverted ? 'middle' : (isNegative ? 'bottom' : 'top')), y: pick(options.y, inverted ? 4 : (isNegative ? 14 : -6)), x: pick(options.x, inverted ? (isNegative ? -6 : 6) : 0) }; stackItem.textAlign = options.textAlign || (inverted ? (isNegative ? 'right' : 'left') : 'center'); } StackItem.prototype = { destroy: function () { destroyObjectProperties(this); }, /** * Sets the total of this stack. Should be called when a serie is hidden or shown * since that will affect the total of other stacks. */ setTotal: function (total) { this.total = total; this.cum = total; }, /** * Renders the stack total label and adds it to the stack label group. */ render: function (group) { var stackItem = this, // aliased this str = stackItem.options.formatter.call(stackItem); // format the text in the label // Change the text to reflect the new total and set visibility to hidden in case the serie is hidden if (stackItem.label) { stackItem.label.attr({text: str, visibility: HIDDEN}); // Create new label } else { stackItem.label = chart.renderer.text(str, 0, 0) // dummy positions, actual position updated with setOffset method in columnseries .css(stackItem.options.style) // apply style .attr({align: stackItem.textAlign, // fix the text-anchor rotation: stackItem.options.rotation, // rotation visibility: HIDDEN }) // hidden until setOffset is called .add(group); // add to the labels-group } }, /** * Sets the offset that the stack has from the x value and repositions the label. */ setOffset: function (xOffset, xWidth) { var stackItem = this, // aliased this neg = stackItem.isNegative, // special treatment is needed for negative stacks y = axis.translate(stackItem.total, 0, 0, 0, 1), // stack value translated mapped to chart coordinates yZero = axis.translate(0), // stack origin h = mathAbs(y - yZero), // stack height x = chart.xAxis[0].translate(stackItem.x) + xOffset, // stack x position plotHeight = chart.plotHeight, stackBox = { // this is the box for the complete stack x: inverted ? (neg ? y : y - h) : x, y: inverted ? plotHeight - x - xWidth : (neg ? (plotHeight - y - h) : plotHeight - y), width: inverted ? h : xWidth, height: inverted ? xWidth : h }; if (stackItem.label) { stackItem.label .align(stackItem.alignOptions, null, stackBox) // align the label to the box .attr({visibility: VISIBLE}); // set visibility } } }; /** * Get the minimum and maximum for the series of each axis */ function getSeriesExtremes() { var posStack = [], negStack = [], i; // reset dataMin and dataMax in case we're redrawing dataMin = dataMax = null; // loop through this axis' series each(axis.series, function (series) { if (series.visible || !optionsChart.ignoreHiddenSeries) { var seriesOptions = series.options, stacking, posPointStack, negPointStack, stackKey, stackOption, negKey, xData, yData, x, y, threshold = seriesOptions.threshold, yDataLength, activeYData = [], activeCounter = 0; // Validate threshold in logarithmic axes if (isLog && threshold <= 0) { threshold = seriesOptions.threshold = null; } // Get dataMin and dataMax for X axes if (isXAxis) { xData = series.xData; if (xData.length) { dataMin = mathMin(pick(dataMin, xData[0]), arrayMin(xData)); dataMax = mathMax(pick(dataMax, xData[0]), arrayMax(xData)); } // Get dataMin and dataMax for Y axes, as well as handle stacking and processed data } else { var isNegative, pointStack, key, cropped = series.cropped, xExtremes = series.xAxis.getExtremes(), //findPointRange, //pointRange, j, hasModifyValue = !!series.modifyValue; // Handle stacking stacking = seriesOptions.stacking; usePercentage = stacking === 'percent'; // create a stack for this particular series type if (stacking) { stackOption = seriesOptions.stack; stackKey = series.type + pick(stackOption, ''); negKey = '-' + stackKey; series.stackKey = stackKey; // used in translate posPointStack = posStack[stackKey] || []; // contains the total values for each x posStack[stackKey] = posPointStack; negPointStack = negStack[negKey] || []; negStack[negKey] = negPointStack; } if (usePercentage) { dataMin = 0; dataMax = 99; } // processData can alter series.pointRange, so this goes after //findPointRange = series.pointRange === null; xData = series.processedXData; yData = series.processedYData; yDataLength = yData.length; // loop over the non-null y values and read them into a local array for (i = 0; i < yDataLength; i++) { x = xData[i]; y = yData[i]; if (y !== null && y !== UNDEFINED) { // read stacked values into a stack based on the x value, // the sign of y and the stack key if (stacking) { isNegative = y < threshold; pointStack = isNegative ? negPointStack : posPointStack; key = isNegative ? negKey : stackKey; y = pointStack[x] = defined(pointStack[x]) ? pointStack[x] + y : y; // add the series if (!stacks[key]) { stacks[key] = {}; } // If the StackItem is there, just update the values, // if not, create one first if (!stacks[key][x]) { stacks[key][x] = new StackItem(options.stackLabels, isNegative, x, stackOption); } stacks[key][x].setTotal(y); // general hook, used for Highstock compare values feature } else if (hasModifyValue) { y = series.modifyValue(y); } // get the smallest distance between points /*if (i) { distance = mathAbs(xData[i] - xData[i - 1]); pointRange = pointRange === UNDEFINED ? distance : mathMin(distance, pointRange); }*/ // for points within the visible range, including the first point outside the // visible range, consider y extremes if (cropped || ((xData[i + 1] || x) >= xExtremes.min && (xData[i - 1] || x) <= xExtremes.max)) { j = y.length; if (j) { // array, like ohlc data while (j--) { if (y[j] !== null) { activeYData[activeCounter++] = y[j]; } } } else { activeYData[activeCounter++] = y; } } } } // record the least unit distance /*if (findPointRange) { series.pointRange = pointRange || 1; } series.closestPointRange = pointRange;*/ // Get the dataMin and dataMax so far. If percentage is used, the min and max are // always 0 and 100. If the length of activeYData is 0, continue with null values. if (!usePercentage && activeYData.length) { dataMin = mathMin(pick(dataMin, activeYData[0]), arrayMin(activeYData)); dataMax = mathMax(pick(dataMax, activeYData[0]), arrayMax(activeYData)); } // Adjust to threshold if (threshold !== null) { if (dataMin >= threshold) { dataMin = threshold; ignoreMinPadding = true; } else if (dataMax < threshold) { dataMax = threshold; ignoreMaxPadding = true; } } } } }); } /** * Translate from axis value to pixel position on the chart, or back * */ translate = function (val, backwards, cvsCoord, old, handleLog) { var sign = 1, cvsOffset = 0, localA = old ? oldTransA : transA, localMin = old ? oldMin : min, returnValue, postTranslate = options.ordinal || (isLog && handleLog); if (!localA) { localA = transA; } if (cvsCoord) { sign *= -1; // canvas coordinates inverts the value cvsOffset = axisLength; } if (reversed) { // reversed axis sign *= -1; cvsOffset -= sign * axisLength; } if (backwards) { // reverse translation if (reversed) { val = axisLength - val; } returnValue = val / localA + localMin; // from chart pixel to value if (postTranslate) { // log and ordinal axes returnValue = axis.lin2val(returnValue); } } else { // normal translation, from axis value to pixel, relative to plot if (postTranslate) { // log and ordinal axes val = axis.val2lin(val); } returnValue = sign * (val - localMin) * localA + cvsOffset + (sign * minPixelPadding); } return returnValue; }; /** * Create the path for a plot line that goes from the given value on * this axis, across the plot to the opposite side * @param {Number} value * @param {Number} lineWidth Used for calculation crisp line * @param {Number] old Use old coordinates (for resizing and rescaling) */ getPlotLinePath = function (value, lineWidth, old) { var x1, y1, x2, y2, translatedValue = translate(value, null, null, old), cHeight = (old && oldChartHeight) || chartHeight, cWidth = (old && oldChartWidth) || chartWidth, skip; x1 = x2 = mathRound(translatedValue + transB); y1 = y2 = mathRound(cHeight - translatedValue - transB); if (isNaN(translatedValue)) { // no min or max skip = true; } else if (horiz) { y1 = axisTop; y2 = cHeight - axisBottom; if (x1 < axisLeft || x1 > axisLeft + axisWidth) { skip = true; } } else { x1 = axisLeft; x2 = cWidth - axisRight; if (y1 < axisTop || y1 > axisTop + axisHeight) { skip = true; } } return skip ? null : renderer.crispLine([M, x1, y1, L, x2, y2], lineWidth || 0); }; /** * Set the tick positions of a linear axis to round values like whole tens or every five. */ function getLinearTickPositions(tickInterval, min, max) { var pos, lastPos, roundedMin = correctFloat(mathFloor(min / tickInterval) * tickInterval), roundedMax = correctFloat(mathCeil(max / tickInterval) * tickInterval), tickPositions = []; // Populate the intermediate values pos = roundedMin; while (pos <= roundedMax) { // Place the tick on the rounded value tickPositions.push(pos); // Always add the raw tickInterval, not the corrected one. pos = correctFloat(pos + tickInterval); // If the interval is not big enough in the current min - max range to actually increase // the loop variable, we need to break out to prevent endless loop. Issue #619 if (pos === lastPos) { break; } // Record the last value lastPos = pos; } return tickPositions; } /** * Set the tick positions of a logarithmic axis */ function getLogTickPositions(interval, min, max, minor) { // Since we use this method for both major and minor ticks, // use a local variable and return the result var positions = []; // Reset if (!minor) { axis._minorAutoInterval = null; } // First case: All ticks fall on whole logarithms: 1, 10, 100 etc. if (interval >= 0.5) { interval = mathRound(interval); positions = getLinearTickPositions(interval, min, max); // Second case: We need intermediary ticks. For example // 1, 2, 4, 6, 8, 10, 20, 40 etc. } else if (interval >= 0.08) { var roundedMin = mathFloor(min), intermediate, i, j, len, pos, lastPos, break2; if (interval > 0.3) { intermediate = [1, 2, 4]; } else if (interval > 0.15) { // 0.2 equals five minor ticks per 1, 10, 100 etc intermediate = [1, 2, 4, 6, 8]; } else { // 0.1 equals ten minor ticks per 1, 10, 100 etc intermediate = [1, 2, 3, 4, 5, 6, 7, 8, 9]; } for (i = roundedMin; i < max + 1 && !break2; i++) { len = intermediate.length; for (j = 0; j < len && !break2; j++) { pos = log2lin(lin2log(i) * intermediate[j]); if (pos > min) { positions.push(lastPos); } if (lastPos > max) { break2 = true; } lastPos = pos; } } // Third case: We are so deep in between whole logarithmic values that // we might as well handle the tick positions like a linear axis. For // example 1.01, 1.02, 1.03, 1.04. } else { var realMin = lin2log(min), realMax = lin2log(max), tickIntervalOption = options[minor ? 'minorTickInterval' : 'tickInterval'], filteredTickIntervalOption = tickIntervalOption === 'auto' ? null : tickIntervalOption, tickPixelIntervalOption = options.tickPixelInterval / (minor ? 5 : 1), totalPixelLength = minor ? axisLength / tickPositions.length : axisLength; interval = pick( filteredTickIntervalOption, axis._minorAutoInterval, (realMax - realMin) * tickPixelIntervalOption / (totalPixelLength || 1) ); interval = normalizeTickInterval( interval, null, math.pow(10, mathFloor(math.log(interval) / math.LN10)) ); positions = map(getLinearTickPositions( interval, realMin, realMax ), log2lin); if (!minor) { axis._minorAutoInterval = interval / 5; } } // Set the axis-level tickInterval variable if (!minor) { tickInterval = interval; } return positions; } /** * Return the minor tick positions. For logarithmic axes, reuse the same logic * as for major ticks. */ function getMinorTickPositions() { var minorTickPositions = [], pos, i, len; if (isLog) { len = tickPositions.length; for (i = 1; i < len; i++) { minorTickPositions = minorTickPositions.concat( getLogTickPositions(minorTickInterval, tickPositions[i - 1], tickPositions[i], true) ); } } else { for (pos = min + (tickPositions[0] - min) % minorTickInterval; pos <= max; pos += minorTickInterval) { minorTickPositions.push(pos); } } return minorTickPositions; } /** * Adjust the min and max for the minimum range. Keep in mind that the series data is * not yet processed, so we don't have information on data cropping and grouping, or * updated axis.pointRange or series.pointRange. The data can't be processed until * we have finally established min and max. */ function adjustForMinRange() { var zoomOffset, spaceAvailable = dataMax - dataMin >= minRange, closestDataRange, i, distance, xData, loopLength, minArgs, maxArgs; // Set the automatic minimum range based on the closest point distance if (isXAxis && minRange === UNDEFINED && !isLog) { if (defined(options.min) || defined(options.max)) { minRange = null; // don't do this again } else { // Find the closest distance between raw data points, as opposed to // closestPointRange that applies to processed points (cropped and grouped) each(axis.series, function (series) { xData = series.xData; loopLength = series.xIncrement ? 1 : xData.length - 1; for (i = loopLength; i > 0; i--) { distance = xData[i] - xData[i - 1]; if (closestDataRange === UNDEFINED || distance < closestDataRange) { closestDataRange = distance; } } }); minRange = mathMin(closestDataRange * 5, dataMax - dataMin); } } // if minRange is exceeded, adjust if (max - min < minRange) { zoomOffset = (minRange - max + min) / 2; // if min and max options have been set, don't go beyond it minArgs = [min - zoomOffset, pick(options.min, min - zoomOffset)]; if (spaceAvailable) { // if space is available, stay within the data range minArgs[2] = dataMin; } min = arrayMax(minArgs); maxArgs = [min + minRange, pick(options.max, min + minRange)]; if (spaceAvailable) { // if space is availabe, stay within the data range maxArgs[2] = dataMax; } max = arrayMin(maxArgs); // now if the max is adjusted, adjust the min back if (max - min < minRange) { minArgs[0] = max - minRange; minArgs[1] = pick(options.min, max - minRange); min = arrayMax(minArgs); } } } /** * Set the tick positions to round values and optionally extend the extremes * to the nearest tick */ function setTickPositions(secondPass) { var length, linkedParentExtremes, tickIntervalOption = options.tickInterval, tickPixelIntervalOption = options.tickPixelInterval; // linked axis gets the extremes from the parent axis if (isLinked) { linkedParent = chart[isXAxis ? 'xAxis' : 'yAxis'][options.linkedTo]; linkedParentExtremes = linkedParent.getExtremes(); min = pick(linkedParentExtremes.min, linkedParentExtremes.dataMin); max = pick(linkedParentExtremes.max, linkedParentExtremes.dataMax); if (options.type !== linkedParent.options.type) { error(11, 1); // Can't link axes of different type } } else { // initial min and max from the extreme data values min = pick(userMin, options.min, dataMin); max = pick(userMax, options.max, dataMax); } if (isLog) { if (!secondPass && min <= 0) { error(10); // Can't plot negative values on log axis } min = log2lin(min); max = log2lin(max); } // handle zoomed range if (range) { userMin = min = mathMax(min, max - range); // #618 userMax = max; if (secondPass) { range = null; // don't use it when running setExtremes } } // adjust min and max for the minimum range adjustForMinRange(); // pad the values to get clear of the chart's edges if (!categories && !usePercentage && !isLinked && defined(min) && defined(max)) { length = (max - min) || 1; if (!defined(options.min) && !defined(userMin) && minPadding && (dataMin < 0 || !ignoreMinPadding)) { min -= length * minPadding; } if (!defined(options.max) && !defined(userMax) && maxPadding && (dataMax > 0 || !ignoreMaxPadding)) { max += length * maxPadding; } } // get tickInterval if (min === max || min === undefined || max === undefined) { tickInterval = 1; } else if (isLinked && !tickIntervalOption && tickPixelIntervalOption === linkedParent.options.tickPixelInterval) { tickInterval = linkedParent.tickInterval; } else { tickInterval = pick( tickIntervalOption, categories ? // for categoried axis, 1 is default, for linear axis use tickPix 1 : (max - min) * tickPixelIntervalOption / (axisLength || 1) ); } // Now we're finished detecting min and max, crop and group series data. This // is in turn needed in order to find tick positions in ordinal axes. if (isXAxis && !secondPass) { each(axis.series, function (series) { series.processData(min !== oldMin || max !== oldMax); }); } // set the translation factor used in translate function setAxisTranslation(); // hook for ordinal axes. To do: merge with below if (axis.beforeSetTickPositions) { axis.beforeSetTickPositions(); } // hook for extensions, used in Highstock ordinal axes if (axis.postProcessTickInterval) { tickInterval = axis.postProcessTickInterval(tickInterval); } // for linear axes, get magnitude and normalize the interval if (!isDatetimeAxis && !isLog) { // linear magnitude = math.pow(10, mathFloor(math.log(tickInterval) / math.LN10)); if (!defined(options.tickInterval)) { tickInterval = normalizeTickInterval(tickInterval, null, magnitude, options); } } // record the tick interval for linked axis axis.tickInterval = tickInterval; // get minorTickInterval minorTickInterval = options.minorTickInterval === 'auto' && tickInterval ? tickInterval / 5 : options.minorTickInterval; // find the tick positions tickPositions = options.tickPositions || (tickPositioner && tickPositioner.apply(axis, [min, max])); if (!tickPositions) { if (isDatetimeAxis) { tickPositions = (axis.getNonLinearTimeTicks || getTimeTicks)( normalizeTimeTickInterval(tickInterval, options.units), min, max, options.startOfWeek, axis.ordinalPositions, axis.closestPointRange, true ); } else if (isLog) { tickPositions = getLogTickPositions(tickInterval, min, max); } else { tickPositions = getLinearTickPositions(tickInterval, min, max); } } // post process positions, used in ordinal axes in Highstock. // TODO: combine with getNonLinearTimeTicks fireEvent(axis, 'afterSetTickPositions', { tickPositions: tickPositions }); if (!isLinked) { // reset min/max or remove extremes based on start/end on tick var roundedMin = tickPositions[0], roundedMax = tickPositions[tickPositions.length - 1]; if (options.startOnTick) { min = roundedMin; } else if (min > roundedMin) { tickPositions.shift(); } if (options.endOnTick) { max = roundedMax; } else if (max < roundedMax) { tickPositions.pop(); } // record the greatest number of ticks for multi axis if (!maxTicks) { // first call, or maxTicks have been reset after a zoom operation maxTicks = { x: 0, y: 0 }; } if (!isDatetimeAxis && tickPositions.length > maxTicks[xOrY] && options.alignTicks !== false) { maxTicks[xOrY] = tickPositions.length; } } } /** * When using multiple axes, adjust the number of ticks to match the highest * number of ticks in that group */ function adjustTickAmount() { if (maxTicks && maxTicks[xOrY] && !isDatetimeAxis && !categories && !isLinked && options.alignTicks !== false) { // only apply to linear scale var oldTickAmount = tickAmount, calculatedTickAmount = tickPositions.length; // set the axis-level tickAmount to use below tickAmount = maxTicks[xOrY]; if (calculatedTickAmount < tickAmount) { while (tickPositions.length < tickAmount) { tickPositions.push(correctFloat( tickPositions[tickPositions.length - 1] + tickInterval )); } transA *= (calculatedTickAmount - 1) / (tickAmount - 1); max = tickPositions[tickPositions.length - 1]; } if (defined(oldTickAmount) && tickAmount !== oldTickAmount) { axis.isDirty = true; } } } /** * Set the scale based on data min and max, user set min and max or options * */ function setScale() { var type, i, isDirtyData; oldMin = min; oldMax = max; oldAxisLength = axisLength; // set the new axisLength axisLength = horiz ? axisWidth : axisHeight; // is there new data? each(axis.series, function (series) { if (series.isDirtyData || series.isDirty || series.xAxis.isDirty) { // when x axis is dirty, we need new data extremes for y as well isDirtyData = true; } }); // do we really need to go through all this? if (axisLength !== oldAxisLength || isDirtyData || isLinked || userMin !== oldUserMin || userMax !== oldUserMax) { // get data extremes if needed getSeriesExtremes(); // get fixed positions based on tickInterval setTickPositions(); // record old values to decide whether a rescale is necessary later on (#540) oldUserMin = userMin; oldUserMax = userMax; // reset stacks if (!isXAxis) { for (type in stacks) { for (i in stacks[type]) { stacks[type][i].cum = stacks[type][i].total; } } } // Mark as dirty if it is not already set to dirty and extremes have changed. #595. if (!axis.isDirty) { axis.isDirty = chart.isDirtyBox || min !== oldMin || max !== oldMax; } } } /** * Set the extremes and optionally redraw * @param {Number} newMin * @param {Number} newMax * @param {Boolean} redraw * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration * */ function setExtremes(newMin, newMax, redraw, animation) { redraw = pick(redraw, true); // defaults to true fireEvent(axis, 'setExtremes', { // fire an event to enable syncing of multiple charts min: newMin, max: newMax }, function () { // the default event handler userMin = newMin; userMax = newMax; // redraw if (redraw) { chart.redraw(animation); } }); } /** * Update translation information */ setAxisTranslation = function () { var range = max - min, pointRange = 0, closestPointRange, seriesClosestPointRange; // adjust translation for padding if (isXAxis) { if (isLinked) { pointRange = linkedParent.pointRange; } else { each(axis.series, function (series) { pointRange = mathMax(pointRange, series.pointRange); seriesClosestPointRange = series.closestPointRange; if (!series.noSharedTooltip && defined(seriesClosestPointRange)) { closestPointRange = defined(closestPointRange) ? mathMin(closestPointRange, seriesClosestPointRange) : seriesClosestPointRange; } }); } // pointRange means the width reserved for each point, like in a column chart axis.pointRange = pointRange; // closestPointRange means the closest distance between points. In columns // it is mostly equal to pointRange, but in lines pointRange is 0 while closestPointRange // is some other value axis.closestPointRange = closestPointRange; } // secondary values oldTransA = transA; axis.translationSlope = transA = axisLength / ((range + pointRange) || 1); transB = horiz ? axisLeft : axisBottom; // translation addend minPixelPadding = transA * (pointRange / 2); }; /** * Update the axis metrics */ function setAxisSize() { var offsetLeft = options.offsetLeft || 0, offsetRight = options.offsetRight || 0; // basic values axisLeft = pick(options.left, plotLeft + offsetLeft); axisTop = pick(options.top, plotTop); axisWidth = pick(options.width, plotWidth - offsetLeft + offsetRight); axisHeight = pick(options.height, plotHeight); axisBottom = chartHeight - axisHeight - axisTop; axisRight = chartWidth - axisWidth - axisLeft; axisLength = horiz ? axisWidth : axisHeight; // expose to use in Series object and navigator axis.left = axisLeft; axis.top = axisTop; axis.len = axisLength; } /** * Get the actual axis extremes */ function getExtremes() { return { min: isLog ? correctFloat(lin2log(min)) : min, max: isLog ? correctFloat(lin2log(max)) : max, dataMin: dataMin, dataMax: dataMax, userMin: userMin, userMax: userMax }; } /** * Get the zero plane either based on zero or on the min or max value. * Used in bar and area plots */ function getThreshold(threshold) { var realMin = isLog ? lin2log(min) : min, realMax = isLog ? lin2log(max) : max; if (realMin > threshold || threshold === null) { threshold = realMin; } else if (realMax < threshold) { threshold = realMax; } return translate(threshold, 0, 1, 0, 1); } /** * Add a plot band or plot line after render time * * @param options {Object} The plotBand or plotLine configuration object */ function addPlotBandOrLine(options) { var obj = new PlotLineOrBand(options).render(); plotLinesAndBands.push(obj); return obj; } /** * Render the tick labels to a preliminary position to get their sizes */ function getOffset() { var hasData = axis.series.length && defined(min) && defined(max), showAxis = hasData || pick(options.showEmpty, true), titleOffset = 0, titleMargin = 0, axisTitleOptions = options.title, labelOptions = options.labels, directionFactor = [-1, 1, 1, -1][side], n; if (!axisGroup) { axisGroup = renderer.g('axis') .attr({ zIndex: 7 }) .add(); gridGroup = renderer.g('grid') .attr({ zIndex: options.gridZIndex || 1 }) .add(); } labelOffset = 0; // reset if (hasData || isLinked) { each(tickPositions, function (pos) { if (!ticks[pos]) { ticks[pos] = new Tick(pos); } else { ticks[pos].addLabel(); // update labels depending on tick interval } }); each(tickPositions, function (pos) { // left side must be align: right and right side must have align: left for labels if (side === 0 || side === 2 || { 1: 'left', 3: 'right' }[side] === labelOptions.align) { // get the highest offset labelOffset = mathMax( ticks[pos].getLabelSize(), labelOffset ); } }); if (staggerLines) { labelOffset += (staggerLines - 1) * 16; } } else { // doesn't have data for (n in ticks) { ticks[n].destroy(); delete ticks[n]; } } if (axisTitleOptions && axisTitleOptions.text) { if (!axisTitle) { axisTitle = axis.axisTitle = renderer.text( axisTitleOptions.text, 0, 0, axisTitleOptions.useHTML ) .attr({ zIndex: 7, rotation: axisTitleOptions.rotation || 0, align: axisTitleOptions.textAlign || { low: 'left', middle: 'center', high: 'right' }[axisTitleOptions.align] }) .css(axisTitleOptions.style) .add(); axisTitle.isNew = true; } if (showAxis) { titleOffset = axisTitle.getBBox()[horiz ? 'height' : 'width']; titleMargin = pick(axisTitleOptions.margin, horiz ? 5 : 10); } // hide or show the title depending on whether showEmpty is set axisTitle[showAxis ? 'show' : 'hide'](); } // handle automatic or user set offset offset = directionFactor * pick(options.offset, axisOffset[side]); axisTitleMargin = pick(axisTitleOptions.offset, labelOffset + titleMargin + (side !== 2 && labelOffset && directionFactor * options.labels[horiz ? 'y' : 'x']) ); axisOffset[side] = mathMax( axisOffset[side], axisTitleMargin + titleOffset + directionFactor * offset ); } /** * Render the axis */ function render() { var axisTitleOptions = options.title, stackLabelOptions = options.stackLabels, alternateGridColor = options.alternateGridColor, lineWidth = options.lineWidth, lineLeft, lineTop, linePath, hasRendered = chart.hasRendered, slideInTicks = hasRendered && defined(oldMin) && !isNaN(oldMin), hasData = axis.series.length && defined(min) && defined(max), showAxis = hasData || pick(options.showEmpty, true), from, to; // If the series has data draw the ticks. Else only the line and title if (hasData || isLinked) { // minor ticks if (minorTickInterval && !categories) { each(getMinorTickPositions(), function (pos) { if (!minorTicks[pos]) { minorTicks[pos] = new Tick(pos, 'minor'); } // render new ticks in old position if (slideInTicks && minorTicks[pos].isNew) { minorTicks[pos].render(null, true); } minorTicks[pos].isActive = true; minorTicks[pos].render(); }); } // major ticks each(tickPositions, function (pos, i) { // linked axes need an extra check to find out if if (!isLinked || (pos >= min && pos <= max)) { if (!ticks[pos]) { ticks[pos] = new Tick(pos); } // render new ticks in old position if (slideInTicks && ticks[pos].isNew) { ticks[pos].render(i, true); } ticks[pos].isActive = true; ticks[pos].render(i); } }); // alternate grid color if (alternateGridColor) { each(tickPositions, function (pos, i) { if (i % 2 === 0 && pos < max) { if (!alternateBands[pos]) { alternateBands[pos] = new PlotLineOrBand(); } from = pos; to = tickPositions[i + 1] !== UNDEFINED ? tickPositions[i + 1] : max; alternateBands[pos].options = { from: isLog ? lin2log(from) : from, to: isLog ? lin2log(to) : to, color: alternateGridColor }; alternateBands[pos].render(); alternateBands[pos].isActive = true; } }); } // custom plot lines and bands if (!axis._addedPlotLB) { // only first time each((options.plotLines || []).concat(options.plotBands || []), function (plotLineOptions) { //plotLinesAndBands.push(new PlotLineOrBand(plotLineOptions).render()); addPlotBandOrLine(plotLineOptions); }); axis._addedPlotLB = true; } } // end if hasData // remove inactive ticks each([ticks, minorTicks, alternateBands], function (coll) { var pos; for (pos in coll) { if (!coll[pos].isActive) { coll[pos].destroy(); delete coll[pos]; } else { coll[pos].isActive = false; // reset } } }); // Static items. As the axis group is cleared on subsequent calls // to render, these items are added outside the group. // axis line if (lineWidth) { lineLeft = axisLeft + (opposite ? axisWidth : 0) + offset; lineTop = chartHeight - axisBottom - (opposite ? axisHeight : 0) + offset; linePath = renderer.crispLine([ M, horiz ? axisLeft : lineLeft, horiz ? lineTop : axisTop, L, horiz ? chartWidth - axisRight : lineLeft, horiz ? lineTop : chartHeight - axisBottom ], lineWidth); if (!axisLine) { axisLine = renderer.path(linePath) .attr({ stroke: options.lineColor, 'stroke-width': lineWidth, zIndex: 7 }) .add(); } else { axisLine.animate({ d: linePath }); } // show or hide the line depending on options.showEmpty axisLine[showAxis ? 'show' : 'hide'](); } if (axisTitle && showAxis) { // compute anchor points for each of the title align options var margin = horiz ? axisLeft : axisTop, fontSize = pInt(axisTitleOptions.style.fontSize || 12), // the position in the length direction of the axis alongAxis = { low: margin + (horiz ? 0 : axisLength), middle: margin + axisLength / 2, high: margin + (horiz ? axisLength : 0) }[axisTitleOptions.align], // the position in the perpendicular direction of the axis offAxis = (horiz ? axisTop + axisHeight : axisLeft) + (horiz ? 1 : -1) * // horizontal axis reverses the margin (opposite ? -1 : 1) * // so does opposite axes axisTitleMargin + (side === 2 ? fontSize : 0); axisTitle[axisTitle.isNew ? 'attr' : 'animate']({ x: horiz ? alongAxis : offAxis + (opposite ? axisWidth : 0) + offset + (axisTitleOptions.x || 0), // x y: horiz ? offAxis - (opposite ? axisHeight : 0) + offset : alongAxis + (axisTitleOptions.y || 0) // y }); axisTitle.isNew = false; } // Stacked totals: if (stackLabelOptions && stackLabelOptions.enabled) { var stackKey, oneStack, stackCategory, stackTotalGroup = axis.stackTotalGroup; // Create a separate group for the stack total labels if (!stackTotalGroup) { axis.stackTotalGroup = stackTotalGroup = renderer.g('stack-labels') .attr({ visibility: VISIBLE, zIndex: 6 }) .translate(plotLeft, plotTop) .add(); } // Render each stack total for (stackKey in stacks) { oneStack = stacks[stackKey]; for (stackCategory in oneStack) { oneStack[stackCategory].render(stackTotalGroup); } } } // End stacked totals axis.isDirty = false; } /** * Remove a plot band or plot line from the chart by id * @param {Object} id */ function removePlotBandOrLine(id) { var i = plotLinesAndBands.length; while (i--) { if (plotLinesAndBands[i].id === id) { plotLinesAndBands[i].destroy(); } } } /** * Update the axis title by options */ function setTitle(newTitleOptions, redraw) { options.title = merge(options.title, newTitleOptions); axisTitle = axisTitle.destroy(); axis.isDirty = true; if (pick(redraw, true)) { chart.redraw(); } } /** * Redraw the axis to reflect changes in the data or axis extremes */ function redraw() { // hide tooltip and hover states if (tracker.resetTracker) { tracker.resetTracker(); } // render the axis render(); // move plot lines and bands each(plotLinesAndBands, function (plotLine) { plotLine.render(); }); // mark associated series as dirty and ready for redraw each(axis.series, function (series) { series.isDirty = true; }); } /** * Set new axis categories and optionally redraw * @param {Array} newCategories * @param {Boolean} doRedraw */ function setCategories(newCategories, doRedraw) { // set the categories axis.categories = userOptions.categories = categories = newCategories; // force reindexing tooltips each(axis.series, function (series) { series.translate(); series.setTooltipPoints(true); }); // optionally redraw axis.isDirty = true; if (pick(doRedraw, true)) { chart.redraw(); } } /** * Destroys an Axis instance. */ function destroy() { var stackKey; // Remove the events removeEvent(axis); // Destroy each stack total for (stackKey in stacks) { destroyObjectProperties(stacks[stackKey]); stacks[stackKey] = null; } // Destroy stack total group if (axis.stackTotalGroup) { axis.stackTotalGroup = axis.stackTotalGroup.destroy(); } // Destroy collections each([ticks, minorTicks, alternateBands, plotLinesAndBands], function (coll) { destroyObjectProperties(coll); }); // Destroy local variables each([axisLine, axisGroup, gridGroup, axisTitle], function (obj) { if (obj) { obj.destroy(); } }); axisLine = axisGroup = gridGroup = axisTitle = null; } // Run Axis // Register axes.push(axis); chart[isXAxis ? 'xAxis' : 'yAxis'].push(axis); // inverted charts have reversed xAxes as default if (inverted && isXAxis && reversed === UNDEFINED) { reversed = true; } // expose some variables extend(axis, { addPlotBand: addPlotBandOrLine, addPlotLine: addPlotBandOrLine, adjustTickAmount: adjustTickAmount, categories: categories, getExtremes: getExtremes, getPlotLinePath: getPlotLinePath, getThreshold: getThreshold, isXAxis: isXAxis, options: options, plotLinesAndBands: plotLinesAndBands, getOffset: getOffset, render: render, setAxisSize: setAxisSize, setAxisTranslation: setAxisTranslation, setCategories: setCategories, setExtremes: setExtremes, setScale: setScale, setTickPositions: setTickPositions, translate: translate, redraw: redraw, removePlotBand: removePlotBandOrLine, removePlotLine: removePlotBandOrLine, reversed: reversed, setTitle: setTitle, series: [], // populated by Series stacks: stacks, destroy: destroy }); // register event listeners for (eventType in events) { addEvent(axis, eventType, events[eventType]); } // extend logarithmic axis if (isLog) { axis.val2lin = log2lin; axis.lin2val = lin2log; } } // end Axis /** * The tooltip object * @param {Object} options Tooltip options */ function Tooltip(options) { var currentSeries, borderWidth = options.borderWidth, crosshairsOptions = options.crosshairs, crosshairs = [], style = options.style, shared = options.shared, padding = pInt(style.padding), tooltipIsHidden = true, currentX = 0, currentY = 0; // remove padding CSS and apply padding on box instead style.padding = 0; // create the label var label = renderer.label('', 0, 0, null, null, null, options.useHTML) .attr({ padding: padding, fill: options.backgroundColor, 'stroke-width': borderWidth, r: options.borderRadius, zIndex: 8 }) .css(style) .hide() .add(); // When using canVG the shadow shows up as a gray circle // even if the tooltip is hidden. if (!useCanVG) { label.shadow(options.shadow); } /** * Destroy the tooltip and its elements. */ function destroy() { each(crosshairs, function (crosshair) { if (crosshair) { crosshair.destroy(); } }); // Destroy and clear local variables if (label) { label = label.destroy(); } } /** * In case no user defined formatter is given, this will be used */ function defaultFormatter() { var pThis = this, items = pThis.points || splat(pThis), series = items[0].series, s; // build the header s = [series.tooltipHeaderFormatter(items[0].key)]; // build the values each(items, function (item) { series = item.series; s.push((series.tooltipFormatter && series.tooltipFormatter(item)) || item.point.tooltipFormatter(series.tooltipOptions.pointFormat)); }); // footer s.push(options.footerFormat || ''); return s.join(''); } /** * Provide a soft movement for the tooltip * * @param {Number} finalX * @param {Number} finalY */ function move(finalX, finalY) { // get intermediate values for animation currentX = tooltipIsHidden ? finalX : (2 * currentX + finalX) / 3; currentY = tooltipIsHidden ? finalY : (currentY + finalY) / 2; // move to the intermediate value label.attr({ x: currentX, y: currentY }); // run on next tick of the mouse tracker if (mathAbs(finalX - currentX) > 1 || mathAbs(finalY - currentY) > 1) { tooltipTick = function () { move(finalX, finalY); }; } else { tooltipTick = null; } } /** * Hide the tooltip */ function hide() { if (!tooltipIsHidden) { var hoverPoints = chart.hoverPoints; label.hide(); // hide previous hoverPoints and set new if (hoverPoints) { each(hoverPoints, function (point) { point.setState(); }); } chart.hoverPoints = null; tooltipIsHidden = true; } } /** * Hide the crosshairs */ function hideCrosshairs() { each(crosshairs, function (crosshair) { if (crosshair) { crosshair.hide(); } }); } /** * Refresh the tooltip's text and position. * @param {Object} point * */ function refresh(point) { var x, y, show, plotX, plotY, textConfig = {}, text, pointConfig = [], tooltipPos = point.tooltipPos, formatter = options.formatter || defaultFormatter, hoverPoints = chart.hoverPoints, placedTooltipPoint, borderColor; // shared tooltip, array is sent over if (shared && !(point.series && point.series.noSharedTooltip)) { plotY = 0; // hide previous hoverPoints and set new if (hoverPoints) { each(hoverPoints, function (point) { point.setState(); }); } chart.hoverPoints = point; each(point, function (item) { item.setState(HOVER_STATE); plotY += item.plotY; // for average pointConfig.push(item.getLabelConfig()); }); plotX = point[0].plotX; plotY = mathRound(plotY) / point.length; // mathRound because Opera 10 has problems here textConfig = { x: point[0].category }; textConfig.points = pointConfig; point = point[0]; // single point tooltip } else { textConfig = point.getLabelConfig(); } text = formatter.call(textConfig); // register the current series currentSeries = point.series; // get the reference point coordinates (pie charts use tooltipPos) plotX = pick(plotX, point.plotX); plotY = pick(plotY, point.plotY); x = mathRound(tooltipPos ? tooltipPos[0] : (inverted ? plotWidth - plotY : plotX)); y = mathRound(tooltipPos ? tooltipPos[1] : (inverted ? plotHeight - plotX : plotY)); // For line type series, hide tooltip if the point falls outside the plot show = shared || !currentSeries.isCartesian || currentSeries.tooltipOutsidePlot || isInsidePlot(x, y); // update the inner HTML if (text === false || !show) { hide(); } else { // show it if (tooltipIsHidden) { label.show(); tooltipIsHidden = false; } // update text label.attr({ text: text }); // set the stroke color of the box borderColor = options.borderColor || point.color || currentSeries.color || '#606060'; label.attr({ stroke: borderColor }); placedTooltipPoint = placeBox( label.width, label.height, plotLeft, plotTop, plotWidth, plotHeight, {x: x, y: y}, pick(options.distance, 12), inverted ); // do the move move(mathRound(placedTooltipPoint.x), mathRound(placedTooltipPoint.y)); } // crosshairs if (crosshairsOptions) { crosshairsOptions = splat(crosshairsOptions); // [x, y] var path, i = crosshairsOptions.length, attribs, axis; while (i--) { axis = point.series[i ? 'yAxis' : 'xAxis']; if (crosshairsOptions[i] && axis) { path = axis .getPlotLinePath(point[i ? 'y' : 'x'], 1); if (crosshairs[i]) { crosshairs[i].attr({ d: path, visibility: VISIBLE }); } else { attribs = { 'stroke-width': crosshairsOptions[i].width || 1, stroke: crosshairsOptions[i].color || '#C0C0C0', zIndex: crosshairsOptions[i].zIndex || 2 }; if (crosshairsOptions[i].dashStyle) { attribs.dashstyle = crosshairsOptions[i].dashStyle; } crosshairs[i] = renderer.path(path) .attr(attribs) .add(); } } } } fireEvent(chart, 'tooltipRefresh', { text: text, x: x + plotLeft, y: y + plotTop, borderColor: borderColor }); } // public members return { shared: shared, refresh: refresh, hide: hide, hideCrosshairs: hideCrosshairs, destroy: destroy }; } /** * The mouse tracker object * @param {Object} options */ function MouseTracker(options) { var mouseDownX, mouseDownY, hasDragged, selectionMarker, zoomType = useCanVG ? '' : optionsChart.zoomType, zoomX = /x/.test(zoomType), zoomY = /y/.test(zoomType), zoomHor = (zoomX && !inverted) || (zoomY && inverted), zoomVert = (zoomY && !inverted) || (zoomX && inverted); /** * Add crossbrowser support for chartX and chartY * @param {Object} e The event object in standard browsers */ function normalizeMouseEvent(e) { var ePos, chartPosLeft, chartPosTop, chartX, chartY; // common IE normalizing e = e || win.event; if (!e.target) { e.target = e.srcElement; } // jQuery only copies over some properties. IE needs e.x and iOS needs touches. if (e.originalEvent) { e = e.originalEvent; } // The same for MooTools. It renames e.pageX to e.page.x. #445. if (e.event) { e = e.event; } // iOS ePos = e.touches ? e.touches.item(0) : e; // get mouse position chartPosition = offset(container); chartPosLeft = chartPosition.left; chartPosTop = chartPosition.top; // chartX and chartY if (isIE) { // IE including IE9 that has pageX but in a different meaning chartX = e.x; chartY = e.y; } else { chartX = ePos.pageX - chartPosLeft; chartY = ePos.pageY - chartPosTop; } return extend(e, { chartX: mathRound(chartX), chartY: mathRound(chartY) }); } /** * Get the click position in terms of axis values. * * @param {Object} e A mouse event */ function getMouseCoordinates(e) { var coordinates = { xAxis: [], yAxis: [] }; each(axes, function (axis) { var translate = axis.translate, isXAxis = axis.isXAxis, isHorizontal = inverted ? !isXAxis : isXAxis; coordinates[isXAxis ? 'xAxis' : 'yAxis'].push({ axis: axis, value: translate( isHorizontal ? e.chartX - plotLeft : plotHeight - e.chartY + plotTop, true ) }); }); return coordinates; } /** * With line type charts with a single tracker, get the point closest to the mouse */ function onmousemove(e) { var point, points, hoverPoint = chart.hoverPoint, hoverSeries = chart.hoverSeries, i, j, distance = chartWidth, index = inverted ? e.chartY : e.chartX - plotLeft; // wtf? // shared tooltip if (tooltip && options.shared && !(hoverSeries && hoverSeries.noSharedTooltip)) { points = []; // loop over all series and find the ones with points closest to the mouse i = series.length; for (j = 0; j < i; j++) { if (series[j].visible && series[j].options.enableMouseTracking !== false && !series[j].noSharedTooltip && series[j].tooltipPoints.length) { point = series[j].tooltipPoints[index]; point._dist = mathAbs(index - point.plotX); distance = mathMin(distance, point._dist); points.push(point); } } // remove furthest points i = points.length; while (i--) { if (points[i]._dist > distance) { points.splice(i, 1); } } // refresh the tooltip if necessary if (points.length && (points[0].plotX !== hoverX)) { tooltip.refresh(points); hoverX = points[0].plotX; } } // separate tooltip and general mouse events if (hoverSeries && hoverSeries.tracker) { // only use for line-type series with common tracker // get the point point = hoverSeries.tooltipPoints[index]; // a new point is hovered, refresh the tooltip if (point && point !== hoverPoint) { // trigger the events point.onMouseOver(); } } } /** * Reset the tracking by hiding the tooltip, the hover series state and the hover point */ function resetTracker() { var hoverSeries = chart.hoverSeries, hoverPoint = chart.hoverPoint; if (hoverPoint) { hoverPoint.onMouseOut(); } if (hoverSeries) { hoverSeries.onMouseOut(); } if (tooltip) { tooltip.hide(); tooltip.hideCrosshairs(); } hoverX = null; } /** * Mouse up or outside the plot area */ function drop() { if (selectionMarker) { var selectionData = { xAxis: [], yAxis: [] }, selectionBox = selectionMarker.getBBox(), selectionLeft = selectionBox.x - plotLeft, selectionTop = selectionBox.y - plotTop; // a selection has been made if (hasDragged) { // record each axis' min and max each(axes, function (axis) { if (axis.options.zoomEnabled !== false) { var translate = axis.translate, isXAxis = axis.isXAxis, isHorizontal = inverted ? !isXAxis : isXAxis, selectionMin = translate( isHorizontal ? selectionLeft : plotHeight - selectionTop - selectionBox.height, true, 0, 0, 1 ), selectionMax = translate( isHorizontal ? selectionLeft + selectionBox.width : plotHeight - selectionTop, true, 0, 0, 1 ); selectionData[isXAxis ? 'xAxis' : 'yAxis'].push({ axis: axis, min: mathMin(selectionMin, selectionMax), // for reversed axes, max: mathMax(selectionMin, selectionMax) }); } }); fireEvent(chart, 'selection', selectionData, zoom); } selectionMarker = selectionMarker.destroy(); } css(container, { cursor: 'auto' }); chart.mouseIsDown = mouseIsDown = hasDragged = false; removeEvent(doc, hasTouch ? 'touchend' : 'mouseup', drop); } /** * Special handler for mouse move that will hide the tooltip when the mouse leaves the plotarea. */ function hideTooltipOnMouseMove(e) { var pageX = defined(e.pageX) ? e.pageX : e.page.x, // In mootools the event is wrapped and the page x/y position is named e.page.x pageY = defined(e.pageX) ? e.pageY : e.page.y; // Ref: http://mootools.net/docs/core/Types/DOMEvent if (chartPosition && !isInsidePlot(pageX - chartPosition.left - plotLeft, pageY - chartPosition.top - plotTop)) { resetTracker(); } } /** * When mouse leaves the container, hide the tooltip. */ function hideTooltipOnMouseLeave() { resetTracker(); chartPosition = null; // also reset the chart position, used in #149 fix } /** * Set the JS events on the container element */ function setDOMEvents() { var lastWasOutsidePlot = true; /* * Record the starting position of a dragoperation */ container.onmousedown = function (e) { e = normalizeMouseEvent(e); // issue #295, dragging not always working in Firefox if (!hasTouch && e.preventDefault) { e.preventDefault(); } // record the start position chart.mouseIsDown = mouseIsDown = true; chart.mouseDownX = mouseDownX = e.chartX; mouseDownY = e.chartY; addEvent(doc, hasTouch ? 'touchend' : 'mouseup', drop); }; // The mousemove, touchmove and touchstart event handler var mouseMove = function (e) { // let the system handle multitouch operations like two finger scroll // and pinching if (e && e.touches && e.touches.length > 1) { return; } // normalize e = normalizeMouseEvent(e); if (!hasTouch) { // not for touch devices e.returnValue = false; } var chartX = e.chartX, chartY = e.chartY, isOutsidePlot = !isInsidePlot(chartX - plotLeft, chartY - plotTop); // on touch devices, only trigger click if a handler is defined if (hasTouch && e.type === 'touchstart') { if (attr(e.target, 'isTracker')) { if (!chart.runTrackerClick) { e.preventDefault(); } } else if (!runChartClick && !isOutsidePlot) { e.preventDefault(); } } // cancel on mouse outside if (isOutsidePlot) { /*if (!lastWasOutsidePlot) { // reset the tracker resetTracker(); }*/ // drop the selection if any and reset mouseIsDown and hasDragged //drop(); if (chartX < plotLeft) { chartX = plotLeft; } else if (chartX > plotLeft + plotWidth) { chartX = plotLeft + plotWidth; } if (chartY < plotTop) { chartY = plotTop; } else if (chartY > plotTop + plotHeight) { chartY = plotTop + plotHeight; } } if (mouseIsDown && e.type !== 'touchstart') { // make selection // determine if the mouse has moved more than 10px hasDragged = Math.sqrt( Math.pow(mouseDownX - chartX, 2) + Math.pow(mouseDownY - chartY, 2) ); if (hasDragged > 10) { var clickedInside = isInsidePlot(mouseDownX - plotLeft, mouseDownY - plotTop); // make a selection if (hasCartesianSeries && (zoomX || zoomY) && clickedInside) { if (!selectionMarker) { selectionMarker = renderer.rect( plotLeft, plotTop, zoomHor ? 1 : plotWidth, zoomVert ? 1 : plotHeight, 0 ) .attr({ fill: optionsChart.selectionMarkerFill || 'rgba(69,114,167,0.25)', zIndex: 7 }) .add(); } } // adjust the width of the selection marker if (selectionMarker && zoomHor) { var xSize = chartX - mouseDownX; selectionMarker.attr({ width: mathAbs(xSize), x: (xSize > 0 ? 0 : xSize) + mouseDownX }); } // adjust the height of the selection marker if (selectionMarker && zoomVert) { var ySize = chartY - mouseDownY; selectionMarker.attr({ height: mathAbs(ySize), y: (ySize > 0 ? 0 : ySize) + mouseDownY }); } // panning if (clickedInside && !selectionMarker && optionsChart.panning) { chart.pan(chartX); } } } else if (!isOutsidePlot) { // show the tooltip onmousemove(e); } lastWasOutsidePlot = isOutsidePlot; // when outside plot, allow touch-drag by returning true return isOutsidePlot || !hasCartesianSeries; }; /* * When the mouse enters the container, run mouseMove */ container.onmousemove = mouseMove; /* * When the mouse leaves the container, hide the tracking (tooltip). */ addEvent(container, 'mouseleave', hideTooltipOnMouseLeave); // issue #149 workaround // The mouseleave event above does not always fire. Whenever the mouse is moving // outside the plotarea, hide the tooltip addEvent(doc, 'mousemove', hideTooltipOnMouseMove); container.ontouchstart = function (e) { // For touch devices, use touchmove to zoom if (zoomX || zoomY) { container.onmousedown(e); } // Show tooltip and prevent the lower mouse pseudo event mouseMove(e); }; /* * Allow dragging the finger over the chart to read the values on touch * devices */ container.ontouchmove = mouseMove; /* * Allow dragging the finger over the chart to read the values on touch * devices */ container.ontouchend = function () { if (hasDragged) { resetTracker(); } }; // MooTools 1.2.3 doesn't fire this in IE when using addEvent container.onclick = function (e) { var hoverPoint = chart.hoverPoint; e = normalizeMouseEvent(e); e.cancelBubble = true; // IE specific if (!hasDragged) { if (hoverPoint && attr(e.target, 'isTracker')) { var plotX = hoverPoint.plotX, plotY = hoverPoint.plotY; // add page position info extend(hoverPoint, { pageX: chartPosition.left + plotLeft + (inverted ? plotWidth - plotY : plotX), pageY: chartPosition.top + plotTop + (inverted ? plotHeight - plotX : plotY) }); // the series click event fireEvent(hoverPoint.series, 'click', extend(e, { point: hoverPoint })); // the point click event hoverPoint.firePointEvent('click', e); } else { extend(e, getMouseCoordinates(e)); // fire a click event in the chart if (isInsidePlot(e.chartX - plotLeft, e.chartY - plotTop)) { fireEvent(chart, 'click', e); } } } // reset mouseIsDown and hasDragged hasDragged = false; }; } /** * Destroys the MouseTracker object and disconnects DOM events. */ function destroy() { // Destroy the tracker group element if (chart.trackerGroup) { chart.trackerGroup = trackerGroup = chart.trackerGroup.destroy(); } removeEvent(container, 'mouseleave', hideTooltipOnMouseLeave); removeEvent(doc, 'mousemove', hideTooltipOnMouseMove); container.onclick = container.onmousedown = container.onmousemove = container.ontouchstart = container.ontouchend = container.ontouchmove = null; } /** * Create the image map that listens for mouseovers */ placeTrackerGroup = function () { // first create - plot positions is not final at this stage if (!trackerGroup) { chart.trackerGroup = trackerGroup = renderer.g('tracker') .attr({ zIndex: 9 }) .add(); // then position - this happens on load and after resizing and changing // axis or box positions } else { trackerGroup.translate(plotLeft, plotTop); if (inverted) { trackerGroup.attr({ width: chart.plotWidth, height: chart.plotHeight }).invert(); } } }; // Run MouseTracker placeTrackerGroup(); if (options.enabled) { chart.tooltip = tooltip = Tooltip(options); // set the fixed interval ticking for the smooth tooltip tooltipInterval = setInterval(function () { if (tooltipTick) { tooltipTick(); } }, 32); } setDOMEvents(); // expose properties extend(this, { zoomX: zoomX, zoomY: zoomY, resetTracker: resetTracker, normalizeMouseEvent: normalizeMouseEvent, destroy: destroy }); } /** * The overview of the chart's series */ var Legend = function () { var options = chart.options.legend; if (!options.enabled) { return; } var horizontal = options.layout === 'horizontal', symbolWidth = options.symbolWidth, symbolPadding = options.symbolPadding, allItems, style = options.style, itemStyle = options.itemStyle, itemHoverStyle = options.itemHoverStyle, itemHiddenStyle = merge(itemStyle, options.itemHiddenStyle), padding = options.padding || pInt(style.padding), ltr = !options.rtl, y = 18, initialItemX = 4 + padding + symbolWidth + symbolPadding, itemX, itemY, lastItemY, itemHeight = 0, itemMarginTop = options.itemMarginTop || 0, itemMarginBottom = options.itemMarginBottom || 0, box, legendBorderWidth = options.borderWidth, legendBackgroundColor = options.backgroundColor, legendGroup, offsetWidth, widthOption = options.width, series = chart.series, reversedLegend = options.reversed; /** * Set the colors for the legend item * @param {Object} item A Series or Point instance * @param {Object} visible Dimmed or colored */ function colorizeItem(item, visible) { var legendItem = item.legendItem, legendLine = item.legendLine, legendSymbol = item.legendSymbol, hiddenColor = itemHiddenStyle.color, textColor = visible ? options.itemStyle.color : hiddenColor, symbolColor = visible ? item.color : hiddenColor; if (legendItem) { legendItem.css({ fill: textColor }); } if (legendLine) { legendLine.attr({ stroke: symbolColor }); } if (legendSymbol) { legendSymbol.attr({ stroke: symbolColor, fill: symbolColor }); } } /** * Position the legend item * @param {Object} item A Series or Point instance * @param {Object} visible Dimmed or colored */ function positionItem(item) { var legendItem = item.legendItem, legendLine = item.legendLine, legendItemPos = item._legendItemPos, itemX = legendItemPos[0], itemY = legendItemPos[1], legendSymbol = item.legendSymbol, symbolX, checkbox = item.checkbox; if (legendItem) { legendItem.attr({ x: ltr ? itemX : legendWidth - itemX, y: itemY }); } if (legendLine) { legendLine.translate( ltr ? itemX : legendWidth - itemX, itemY - 4 ); } if (legendSymbol) { symbolX = itemX + legendSymbol.xOff; legendSymbol.attr({ x: ltr ? symbolX : legendWidth - symbolX, y: itemY + legendSymbol.yOff }); } if (checkbox) { checkbox.x = itemX; checkbox.y = itemY; } } /** * Destroy a single legend item * @param {Object} item The series or point */ function destroyItem(item) { var checkbox = item.checkbox; // destroy SVG elements each(['legendItem', 'legendLine', 'legendSymbol'], function (key) { if (item[key]) { item[key].destroy(); } }); if (checkbox) { discardElement(item.checkbox); } } /** * Destroys the legend. */ function destroy() { if (box) { box = box.destroy(); } if (legendGroup) { legendGroup = legendGroup.destroy(); } } /** * Position the checkboxes after the width is determined */ function positionCheckboxes() { each(allItems, function (item) { var checkbox = item.checkbox, alignAttr = legendGroup.alignAttr; if (checkbox) { css(checkbox, { left: (alignAttr.translateX + item.legendItemWidth + checkbox.x - 40) + PX, top: (alignAttr.translateY + checkbox.y - 11) + PX }); } }); } /** * Render a single specific legend item * @param {Object} item A series or point */ function renderItem(item) { var bBox, itemWidth, legendSymbol, symbolX, symbolY, simpleSymbol, radius, li = item.legendItem, series = item.series || item, itemOptions = series.options, strokeWidth = (itemOptions && itemOptions.borderWidth) || 0; if (!li) { // generate it once, later move it // let these series types use a simple symbol simpleSymbol = /^(bar|pie|area|column)$/.test(series.type); // generate the list item text item.legendItem = li = renderer.text( options.labelFormatter.call(item), 0, 0, options.useHTML ) .css(item.visible ? itemStyle : itemHiddenStyle) .on('mouseover', function () { item.setState(HOVER_STATE); li.css(itemHoverStyle); }) .on('mouseout', function () { li.css(item.visible ? itemStyle : itemHiddenStyle); item.setState(); }) .on('click', function () { var strLegendItemClick = 'legendItemClick', fnLegendItemClick = function () { item.setVisible(); }; // click the name or symbol if (item.firePointEvent) { // point item.firePointEvent(strLegendItemClick, null, fnLegendItemClick); } else { fireEvent(item, strLegendItemClick, null, fnLegendItemClick); } }) .attr({ align: ltr ? 'left' : 'right', zIndex: 2 }) .add(legendGroup); // draw the line if (!simpleSymbol && itemOptions && itemOptions.lineWidth) { var attrs = { 'stroke-width': itemOptions.lineWidth, zIndex: 2 }; if (itemOptions.dashStyle) { attrs.dashstyle = itemOptions.dashStyle; } item.legendLine = renderer.path([ M, (-symbolWidth - symbolPadding) * (ltr ? 1 : -1), 0, L, (-symbolPadding) * (ltr ? 1 : -1), 0 ]) .attr(attrs) .add(legendGroup); } // draw a simple symbol if (simpleSymbol) { // bar|pie|area|column legendSymbol = renderer.rect( (symbolX = -symbolWidth - symbolPadding), (symbolY = -11), symbolWidth, 12, 2 ).attr({ //'stroke-width': 0, zIndex: 3 }).add(legendGroup); if (!ltr) { symbolX += symbolWidth; } } else if (itemOptions && itemOptions.marker && itemOptions.marker.enabled) { // draw the marker radius = itemOptions.marker.radius; legendSymbol = renderer.symbol( item.symbol, (symbolX = -symbolWidth / 2 - symbolPadding - radius), (symbolY = -4 - radius), 2 * radius, 2 * radius ) .attr(item.pointAttr[NORMAL_STATE]) .attr({ zIndex: 3 }) .add(legendGroup); if (!ltr) { symbolX += symbolWidth / 2; } } if (legendSymbol) { legendSymbol.xOff = symbolX + (strokeWidth % 2 / 2); legendSymbol.yOff = symbolY + (strokeWidth % 2 / 2); } item.legendSymbol = legendSymbol; // colorize the items colorizeItem(item, item.visible); // add the HTML checkbox on top if (itemOptions && itemOptions.showCheckbox) { item.checkbox = createElement('input', { type: 'checkbox', checked: item.selected, defaultChecked: item.selected // required by IE7 }, options.itemCheckboxStyle, container); addEvent(item.checkbox, 'click', function (event) { var target = event.target; fireEvent(item, 'checkboxClick', { checked: target.checked }, function () { item.select(); } ); }); } } // calculate the positions for the next line bBox = li.getBBox(); itemWidth = item.legendItemWidth = options.itemWidth || symbolWidth + symbolPadding + bBox.width + padding; itemHeight = bBox.height; // if the item exceeds the width, start a new line if (horizontal && itemX - initialItemX + itemWidth > (widthOption || (chartWidth - 2 * padding - initialItemX))) { itemX = initialItemX; itemY += itemMarginTop + itemHeight + itemMarginBottom; } lastItemY = itemY + itemMarginBottom; // cache the position of the newly generated or reordered items item._legendItemPos = [itemX, itemY]; // advance if (horizontal) { itemX += itemWidth; } else { itemY += itemMarginTop + itemHeight + itemMarginBottom; } // the width of the widest item offsetWidth = widthOption || mathMax( horizontal ? itemX - initialItemX : itemWidth, offsetWidth ); } /** * Render the legend. This method can be called both before and after * chart.render. If called after, it will only rearrange items instead * of creating new ones. */ function renderLegend() { itemX = initialItemX; itemY = padding + itemMarginTop + y - 5; // 5 is the number of pixels above the text offsetWidth = 0; lastItemY = 0; if (!legendGroup) { legendGroup = renderer.g('legend') .attr({ zIndex: 10 }) // in front of trackers, #414 .add(); } // add each series or point allItems = []; each(series, function (serie) { var seriesOptions = serie.options; if (!seriesOptions.showInLegend) { return; } // use points or series for the legend item depending on legendType allItems = allItems.concat( serie.legendItems || (seriesOptions.legendType === 'point' ? serie.data : serie) ); }); // sort by legendIndex stableSort(allItems, function (a, b) { return (a.options.legendIndex || 0) - (b.options.legendIndex || 0); }); // reversed legend if (reversedLegend) { allItems.reverse(); } // render the items each(allItems, renderItem); // Draw the border legendWidth = widthOption || offsetWidth; legendHeight = lastItemY - y + itemHeight; if (legendBorderWidth || legendBackgroundColor) { legendWidth += 2 * padding; legendHeight += 2 * padding; if (!box) { box = renderer.rect( 0, 0, legendWidth, legendHeight, options.borderRadius, legendBorderWidth || 0 ).attr({ stroke: options.borderColor, 'stroke-width': legendBorderWidth || 0, fill: legendBackgroundColor || NONE }) .add(legendGroup) .shadow(options.shadow); box.isNew = true; } else if (legendWidth > 0 && legendHeight > 0) { box[box.isNew ? 'attr' : 'animate']( box.crisp(null, null, null, legendWidth, legendHeight) ); box.isNew = false; } // hide the border if no items box[allItems.length ? 'show' : 'hide'](); } // Now that the legend width and height are extablished, put the items in the // final position each(allItems, positionItem); // 1.x compatibility: positioning based on style var props = ['left', 'right', 'top', 'bottom'], prop, i = 4; while (i--) { prop = props[i]; if (style[prop] && style[prop] !== 'auto') { options[i < 2 ? 'align' : 'verticalAlign'] = prop; options[i < 2 ? 'x' : 'y'] = pInt(style[prop]) * (i % 2 ? -1 : 1); } } if (allItems.length) { legendGroup.align(extend(options, { width: legendWidth, height: legendHeight }), true, spacingBox); } if (!isResizing) { positionCheckboxes(); } } // run legend renderLegend(); // move checkboxes addEvent(chart, 'endResize', positionCheckboxes); // expose return { colorizeItem: colorizeItem, destroyItem: destroyItem, renderLegend: renderLegend, destroy: destroy }; }; /** * Initialize an individual series, called internally before render time */ function initSeries(options) { var type = options.type || optionsChart.type || optionsChart.defaultSeriesType, typeClass = seriesTypes[type], serie, hasRendered = chart.hasRendered; // an inverted chart can't take a column series and vice versa if (hasRendered) { if (inverted && type === 'column') { typeClass = seriesTypes.bar; } else if (!inverted && type === 'bar') { typeClass = seriesTypes.column; } } serie = new typeClass(); serie.init(chart, options); // set internal chart properties if (!hasRendered && serie.inverted) { inverted = true; } if (serie.isCartesian) { hasCartesianSeries = serie.isCartesian; } series.push(serie); return serie; } /** * Add a series dynamically after time * * @param {Object} options The config options * @param {Boolean} redraw Whether to redraw the chart after adding. Defaults to true. * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration * * @return {Object} series The newly created series object */ function addSeries(options, redraw, animation) { var series; if (options) { setAnimation(animation, chart); redraw = pick(redraw, true); // defaults to true fireEvent(chart, 'addSeries', { options: options }, function () { series = initSeries(options); series.isDirty = true; chart.isDirtyLegend = true; // the series array is out of sync with the display if (redraw) { chart.redraw(); } }); } return series; } /** * Check whether a given point is within the plot area * * @param {Number} x Pixel x relative to the plot area * @param {Number} y Pixel y relative to the plot area */ isInsidePlot = function (x, y) { return x >= 0 && x <= plotWidth && y >= 0 && y <= plotHeight; }; /** * Adjust all axes tick amounts */ function adjustTickAmounts() { if (optionsChart.alignTicks !== false) { each(axes, function (axis) { axis.adjustTickAmount(); }); } maxTicks = null; } /** * Redraw legend, axes or series based on updated data * * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration */ function redraw(animation) { var redrawLegend = chart.isDirtyLegend, hasStackedSeries, isDirtyBox = chart.isDirtyBox, // todo: check if it has actually changed? seriesLength = series.length, i = seriesLength, clipRect = chart.clipRect, serie; setAnimation(animation, chart); // link stacked series while (i--) { serie = series[i]; if (serie.isDirty && serie.options.stacking) { hasStackedSeries = true; break; } } if (hasStackedSeries) { // mark others as dirty i = seriesLength; while (i--) { serie = series[i]; if (serie.options.stacking) { serie.isDirty = true; } } } // handle updated data in the series each(series, function (serie) { if (serie.isDirty) { // prepare the data so axis can read it if (serie.options.legendType === 'point') { redrawLegend = true; } } }); // handle added or removed series if (redrawLegend && legend.renderLegend) { // series or pie points are added or removed // draw legend graphics legend.renderLegend(); chart.isDirtyLegend = false; } if (hasCartesianSeries) { if (!isResizing) { // reset maxTicks maxTicks = null; // set axes scales each(axes, function (axis) { axis.setScale(); }); } adjustTickAmounts(); getMargins(); // redraw axes each(axes, function (axis) { fireEvent(axis, 'afterSetExtremes', axis.getExtremes()); // #747, #751 if (axis.isDirty) { axis.redraw(); } }); } // the plot areas size has changed if (isDirtyBox) { drawChartBox(); placeTrackerGroup(); // move clip rect if (clipRect) { stop(clipRect); clipRect.animate({ // for chart resize width: chart.plotSizeX, height: chart.plotSizeY + 1 }); } } // redraw affected series each(series, function (serie) { if (serie.isDirty && serie.visible && (!serie.isCartesian || serie.xAxis)) { // issue #153 serie.redraw(); } }); // hide tooltip and hover states if (tracker && tracker.resetTracker) { tracker.resetTracker(); } // redraw if canvas renderer.draw(); // fire the event fireEvent(chart, 'redraw'); // jQuery breaks this when calling it from addEvent. Overwrites chart.redraw } /** * Dim the chart and show a loading text or symbol * @param {String} str An optional text to show in the loading label instead of the default one */ function showLoading(str) { var loadingOptions = options.loading; // create the layer at the first call if (!loadingDiv) { loadingDiv = createElement(DIV, { className: PREFIX + 'loading' }, extend(loadingOptions.style, { left: plotLeft + PX, top: plotTop + PX, width: plotWidth + PX, height: plotHeight + PX, zIndex: 10, display: NONE }), container); loadingSpan = createElement( 'span', null, loadingOptions.labelStyle, loadingDiv ); } // update text loadingSpan.innerHTML = str || options.lang.loading; // show it if (!loadingShown) { css(loadingDiv, { opacity: 0, display: '' }); animate(loadingDiv, { opacity: loadingOptions.style.opacity }, { duration: loadingOptions.showDuration || 0 }); loadingShown = true; } } /** * Hide the loading layer */ function hideLoading() { if (loadingDiv) { animate(loadingDiv, { opacity: 0 }, { duration: options.loading.hideDuration || 100, complete: function () { css(loadingDiv, { display: NONE }); } }); } loadingShown = false; } /** * Get an axis, series or point object by id. * @param id {String} The id as given in the configuration options */ function get(id) { var i, j, points; // search axes for (i = 0; i < axes.length; i++) { if (axes[i].options.id === id) { return axes[i]; } } // search series for (i = 0; i < series.length; i++) { if (series[i].options.id === id) { return series[i]; } } // search points for (i = 0; i < series.length; i++) { points = series[i].points || []; for (j = 0; j < points.length; j++) { if (points[j].id === id) { return points[j]; } } } return null; } /** * Create the Axis instances based on the config options */ function getAxes() { var xAxisOptions = options.xAxis || {}, yAxisOptions = options.yAxis || {}, optionsArray, axis; // make sure the options are arrays and add some members xAxisOptions = splat(xAxisOptions); each(xAxisOptions, function (axis, i) { axis.index = i; axis.isX = true; }); yAxisOptions = splat(yAxisOptions); each(yAxisOptions, function (axis, i) { axis.index = i; }); // concatenate all axis options into one array optionsArray = xAxisOptions.concat(yAxisOptions); each(optionsArray, function (axisOptions) { axis = new Axis(axisOptions); }); adjustTickAmounts(); } /** * Get the currently selected points from all series */ function getSelectedPoints() { var points = []; each(series, function (serie) { points = points.concat(grep(serie.points, function (point) { return point.selected; })); }); return points; } /** * Get the currently selected series */ function getSelectedSeries() { return grep(series, function (serie) { return serie.selected; }); } /** * Display the zoom button */ function showResetZoom() { var lang = defaultOptions.lang, btnOptions = optionsChart.resetZoomButton, theme = btnOptions.theme, states = theme.states, box = btnOptions.relativeTo === 'chart' ? null : { x: plotLeft, y: plotTop, width: plotWidth, height: plotHeight }; chart.resetZoomButton = renderer.button(lang.resetZoom, null, null, zoomOut, theme, states && states.hover) .attr({ align: btnOptions.position.align, title: lang.resetZoomTitle }) .add() .align(btnOptions.position, false, box); } /** * Zoom out to 1:1 */ zoomOut = function () { var resetZoomButton = chart.resetZoomButton; fireEvent(chart, 'selection', { resetSelection: true }, zoom); if (resetZoomButton) { chart.resetZoomButton = resetZoomButton.destroy(); } }; /** * Zoom into a given portion of the chart given by axis coordinates * @param {Object} event */ zoom = function (event) { // add button to reset selection var animate = chart.pointCount < 100, hasZoomed; if (chart.resetZoomEnabled !== false && !chart.resetZoomButton) { // hook for Stock charts etc. showResetZoom(); } // if zoom is called with no arguments, reset the axes if (!event || event.resetSelection) { each(axes, function (axis) { if (axis.options.zoomEnabled !== false) { axis.setExtremes(null, null, false); hasZoomed = true; } }); } else { // else, zoom in on all axes each(event.xAxis.concat(event.yAxis), function (axisData) { var axis = axisData.axis; // don't zoom more than minRange if (chart.tracker[axis.isXAxis ? 'zoomX' : 'zoomY']) { axis.setExtremes(axisData.min, axisData.max, false); hasZoomed = true; } }); } // Redraw if (hasZoomed) { redraw(true, animate); } }; /** * Pan the chart by dragging the mouse across the pane. This function is called * on mouse move, and the distance to pan is computed from chartX compared to * the first chartX position in the dragging operation. */ chart.pan = function (chartX) { var xAxis = chart.xAxis[0], mouseDownX = chart.mouseDownX, halfPointRange = xAxis.pointRange / 2, extremes = xAxis.getExtremes(), newMin = xAxis.translate(mouseDownX - chartX, true) + halfPointRange, newMax = xAxis.translate(mouseDownX + plotWidth - chartX, true) - halfPointRange, hoverPoints = chart.hoverPoints; // remove active points for shared tooltip if (hoverPoints) { each(hoverPoints, function (point) { point.setState(); }); } if (newMin > mathMin(extremes.dataMin, extremes.min) && newMax < mathMax(extremes.dataMax, extremes.max)) { xAxis.setExtremes(newMin, newMax, true, false); } chart.mouseDownX = chartX; // set new reference for next run css(container, { cursor: 'move' }); }; /** * Show the title and subtitle of the chart * * @param titleOptions {Object} New title options * @param subtitleOptions {Object} New subtitle options * */ function setTitle(titleOptions, subtitleOptions) { chartTitleOptions = merge(options.title, titleOptions); chartSubtitleOptions = merge(options.subtitle, subtitleOptions); // add title and subtitle each([ ['title', titleOptions, chartTitleOptions], ['subtitle', subtitleOptions, chartSubtitleOptions] ], function (arr) { var name = arr[0], title = chart[name], titleOptions = arr[1], chartTitleOptions = arr[2]; if (title && titleOptions) { title = title.destroy(); // remove old } if (chartTitleOptions && chartTitleOptions.text && !title) { chart[name] = renderer.text( chartTitleOptions.text, 0, 0, chartTitleOptions.useHTML ) .attr({ align: chartTitleOptions.align, 'class': PREFIX + name, zIndex: 1 }) .css(chartTitleOptions.style) .add() .align(chartTitleOptions, false, spacingBox); } }); } /** * Get chart width and height according to options and container size */ function getChartSize() { containerWidth = (renderToClone || renderTo).offsetWidth; containerHeight = (renderToClone || renderTo).offsetHeight; chart.chartWidth = chartWidth = optionsChart.width || containerWidth || 600; chart.chartHeight = chartHeight = optionsChart.height || // the offsetHeight of an empty container is 0 in standard browsers, but 19 in IE7: (containerHeight > 19 ? containerHeight : 400); } /** * Get the containing element, determine the size and create the inner container * div to hold the chart */ function getContainer() { renderTo = optionsChart.renderTo; containerId = PREFIX + idCounter++; if (isString(renderTo)) { renderTo = doc.getElementById(renderTo); } // Display an error if the renderTo is wrong if (!renderTo) { error(13, true); } // remove previous chart renderTo.innerHTML = ''; // If the container doesn't have an offsetWidth, it has or is a child of a node // that has display:none. We need to temporarily move it out to a visible // state to determine the size, else the legend and tooltips won't render // properly if (!renderTo.offsetWidth) { renderToClone = renderTo.cloneNode(0); css(renderToClone, { position: ABSOLUTE, top: '-9999px', display: '' }); doc.body.appendChild(renderToClone); } // get the width and height getChartSize(); // create the inner container chart.container = container = createElement(DIV, { className: PREFIX + 'container' + (optionsChart.className ? ' ' + optionsChart.className : ''), id: containerId }, extend({ position: RELATIVE, overflow: HIDDEN, // needed for context menu (avoid scrollbars) and // content overflow in IE width: chartWidth + PX, height: chartHeight + PX, textAlign: 'left', lineHeight: 'normal' // #427 }, optionsChart.style), renderToClone || renderTo ); chart.renderer = renderer = optionsChart.forExport ? // force SVG, used for SVG export new SVGRenderer(container, chartWidth, chartHeight, true) : new Renderer(container, chartWidth, chartHeight); if (useCanVG) { // If we need canvg library, extend and configure the renderer // to get the tracker for translating mouse events renderer.create(chart, container, chartWidth, chartHeight); } // Issue 110 workaround: // In Firefox, if a div is positioned by percentage, its pixel position may land // between pixels. The container itself doesn't display this, but an SVG element // inside this container will be drawn at subpixel precision. In order to draw // sharp lines, this must be compensated for. This doesn't seem to work inside // iframes though (like in jsFiddle). var subPixelFix, rect; if (isFirefox && container.getBoundingClientRect) { subPixelFix = function () { css(container, { left: 0, top: 0 }); rect = container.getBoundingClientRect(); css(container, { left: (-(rect.left - pInt(rect.left))) + PX, top: (-(rect.top - pInt(rect.top))) + PX }); }; // run the fix now subPixelFix(); // run it on resize addEvent(win, 'resize', subPixelFix); // remove it on chart destroy addEvent(chart, 'destroy', function () { removeEvent(win, 'resize', subPixelFix); }); } } /** * Calculate margins by rendering axis labels in a preliminary position. Title, * subtitle and legend have already been rendered at this stage, but will be * moved into their final positions */ getMargins = function () { var legendOptions = options.legend, legendMargin = pick(legendOptions.margin, 10), legendX = legendOptions.x, legendY = legendOptions.y, align = legendOptions.align, verticalAlign = legendOptions.verticalAlign, titleOffset; resetMargins(); // adjust for title and subtitle if ((chart.title || chart.subtitle) && !defined(optionsMarginTop)) { titleOffset = mathMax( (chart.title && !chartTitleOptions.floating && !chartTitleOptions.verticalAlign && chartTitleOptions.y) || 0, (chart.subtitle && !chartSubtitleOptions.floating && !chartSubtitleOptions.verticalAlign && chartSubtitleOptions.y) || 0 ); if (titleOffset) { plotTop = mathMax(plotTop, titleOffset + pick(chartTitleOptions.margin, 15) + spacingTop); } } // adjust for legend if (legendOptions.enabled && !legendOptions.floating) { if (align === 'right') { // horizontal alignment handled first if (!defined(optionsMarginRight)) { marginRight = mathMax( marginRight, legendWidth - legendX + legendMargin + spacingRight ); } } else if (align === 'left') { if (!defined(optionsMarginLeft)) { plotLeft = mathMax( plotLeft, legendWidth + legendX + legendMargin + spacingLeft ); } } else if (verticalAlign === 'top') { if (!defined(optionsMarginTop)) { plotTop = mathMax( plotTop, legendHeight + legendY + legendMargin + spacingTop ); } } else if (verticalAlign === 'bottom') { if (!defined(optionsMarginBottom)) { marginBottom = mathMax( marginBottom, legendHeight - legendY + legendMargin + spacingBottom ); } } } // adjust for scroller if (chart.extraBottomMargin) { marginBottom += chart.extraBottomMargin; } if (chart.extraTopMargin) { plotTop += chart.extraTopMargin; } // pre-render axes to get labels offset width if (hasCartesianSeries) { each(axes, function (axis) { axis.getOffset(); }); } if (!defined(optionsMarginLeft)) { plotLeft += axisOffset[3]; } if (!defined(optionsMarginTop)) { plotTop += axisOffset[0]; } if (!defined(optionsMarginBottom)) { marginBottom += axisOffset[2]; } if (!defined(optionsMarginRight)) { marginRight += axisOffset[1]; } setChartSize(); }; /** * Add the event handlers necessary for auto resizing * */ function initReflow() { var reflowTimeout; function reflow(e) { var width = optionsChart.width || renderTo.offsetWidth, height = optionsChart.height || renderTo.offsetHeight, target = e.target; // Width and height checks for display:none. Target is doc in IE8 and Opera, // win in Firefox, Chrome and IE9. if (width && height && (target === win || target === doc)) { if (width !== containerWidth || height !== containerHeight) { clearTimeout(reflowTimeout); reflowTimeout = setTimeout(function () { resize(width, height, false); }, 100); } containerWidth = width; containerHeight = height; } } addEvent(win, 'resize', reflow); addEvent(chart, 'destroy', function () { removeEvent(win, 'resize', reflow); }); } /** * Fires endResize event on chart instance. */ function fireEndResize() { if (chart) { fireEvent(chart, 'endResize', null, function () { isResizing -= 1; }); } } /** * Resize the chart to a given width and height * @param {Number} width * @param {Number} height * @param {Object|Boolean} animation */ resize = function (width, height, animation) { var chartTitle = chart.title, chartSubtitle = chart.subtitle; isResizing += 1; // set the animation for the current process setAnimation(animation, chart); oldChartHeight = chartHeight; oldChartWidth = chartWidth; if (defined(width)) { chart.chartWidth = chartWidth = mathRound(width); } if (defined(height)) { chart.chartHeight = chartHeight = mathRound(height); } css(container, { width: chartWidth + PX, height: chartHeight + PX }); renderer.setSize(chartWidth, chartHeight, animation); // update axis lengths for more correct tick intervals: plotWidth = chartWidth - plotLeft - marginRight; plotHeight = chartHeight - plotTop - marginBottom; // handle axes maxTicks = null; each(axes, function (axis) { axis.isDirty = true; axis.setScale(); }); // make sure non-cartesian series are also handled each(series, function (serie) { serie.isDirty = true; }); chart.isDirtyLegend = true; // force legend redraw chart.isDirtyBox = true; // force redraw of plot and chart border getMargins(); // move titles if (chartTitle) { chartTitle.align(null, null, spacingBox); } if (chartSubtitle) { chartSubtitle.align(null, null, spacingBox); } redraw(animation); oldChartHeight = null; fireEvent(chart, 'resize'); // fire endResize and set isResizing back // If animation is disabled, fire without delay if (globalAnimation === false) { fireEndResize(); } else { // else set a timeout with the animation duration setTimeout(fireEndResize, (globalAnimation && globalAnimation.duration) || 500); } }; /** * Set the public chart properties. This is done before and after the pre-render * to determine margin sizes */ setChartSize = function () { chart.plotLeft = plotLeft = mathRound(plotLeft); chart.plotTop = plotTop = mathRound(plotTop); chart.plotWidth = plotWidth = mathRound(chartWidth - plotLeft - marginRight); chart.plotHeight = plotHeight = mathRound(chartHeight - plotTop - marginBottom); chart.plotSizeX = inverted ? plotHeight : plotWidth; chart.plotSizeY = inverted ? plotWidth : plotHeight; spacingBox = { x: spacingLeft, y: spacingTop, width: chartWidth - spacingLeft - spacingRight, height: chartHeight - spacingTop - spacingBottom }; each(axes, function (axis) { axis.setAxisSize(); axis.setAxisTranslation(); }); }; /** * Initial margins before auto size margins are applied */ resetMargins = function () { plotTop = pick(optionsMarginTop, spacingTop); marginRight = pick(optionsMarginRight, spacingRight); marginBottom = pick(optionsMarginBottom, spacingBottom); plotLeft = pick(optionsMarginLeft, spacingLeft); axisOffset = [0, 0, 0, 0]; // top, right, bottom, left }; /** * Draw the borders and backgrounds for chart and plot area */ drawChartBox = function () { var chartBorderWidth = optionsChart.borderWidth || 0, chartBackgroundColor = optionsChart.backgroundColor, plotBackgroundColor = optionsChart.plotBackgroundColor, plotBackgroundImage = optionsChart.plotBackgroundImage, mgn, plotSize = { x: plotLeft, y: plotTop, width: plotWidth, height: plotHeight }; // Chart area mgn = chartBorderWidth + (optionsChart.shadow ? 8 : 0); if (chartBorderWidth || chartBackgroundColor) { if (!chartBackground) { chartBackground = renderer.rect(mgn / 2, mgn / 2, chartWidth - mgn, chartHeight - mgn, optionsChart.borderRadius, chartBorderWidth) .attr({ stroke: optionsChart.borderColor, 'stroke-width': chartBorderWidth, fill: chartBackgroundColor || NONE }) .add() .shadow(optionsChart.shadow); } else { // resize chartBackground.animate( chartBackground.crisp(null, null, null, chartWidth - mgn, chartHeight - mgn) ); } } // Plot background if (plotBackgroundColor) { if (!plotBackground) { plotBackground = renderer.rect(plotLeft, plotTop, plotWidth, plotHeight, 0) .attr({ fill: plotBackgroundColor }) .add() .shadow(optionsChart.plotShadow); } else { plotBackground.animate(plotSize); } } if (plotBackgroundImage) { if (!plotBGImage) { plotBGImage = renderer.image(plotBackgroundImage, plotLeft, plotTop, plotWidth, plotHeight) .add(); } else { plotBGImage.animate(plotSize); } } // Plot area border if (optionsChart.plotBorderWidth) { if (!plotBorder) { plotBorder = renderer.rect(plotLeft, plotTop, plotWidth, plotHeight, 0, optionsChart.plotBorderWidth) .attr({ stroke: optionsChart.plotBorderColor, 'stroke-width': optionsChart.plotBorderWidth, zIndex: 4 }) .add(); } else { plotBorder.animate( plotBorder.crisp(null, plotLeft, plotTop, plotWidth, plotHeight) ); } } // reset chart.isDirtyBox = false; }; /** * Detect whether the chart is inverted, either by setting the chart.inverted option * or adding a bar series to the configuration options */ function setInverted() { var BAR = 'bar', isInverted = ( inverted || // it is set before optionsChart.inverted || optionsChart.type === BAR || // default series type optionsChart.defaultSeriesType === BAR // backwards compatible ), seriesOptions = options.series, i = seriesOptions && seriesOptions.length; // check if a bar series is present in the config options while (!isInverted && i--) { if (seriesOptions[i].type === BAR) { isInverted = true; } } // set the chart property and the chart scope variable chart.inverted = inverted = isInverted; } /** * Render all graphics for the chart */ function render() { var labels = options.labels, credits = options.credits, creditsHref; // Title setTitle(); // Legend legend = chart.legend = new Legend(); // Get margins by pre-rendering axes // set axes scales each(axes, function (axis) { axis.setScale(); }); getMargins(); each(axes, function (axis) { axis.setTickPositions(true); // update to reflect the new margins }); adjustTickAmounts(); getMargins(); // second pass to check for new labels // Draw the borders and backgrounds drawChartBox(); // Axes if (hasCartesianSeries) { each(axes, function (axis) { axis.render(); }); } // The series if (!chart.seriesGroup) { chart.seriesGroup = renderer.g('series-group') .attr({ zIndex: 3 }) .add(); } each(series, function (serie) { serie.translate(); serie.setTooltipPoints(); serie.render(); }); // Labels if (labels.items) { each(labels.items, function () { var style = extend(labels.style, this.style), x = pInt(style.left) + plotLeft, y = pInt(style.top) + plotTop + 12; // delete to prevent rewriting in IE delete style.left; delete style.top; renderer.text( this.html, x, y ) .attr({ zIndex: 2 }) .css(style) .add(); }); } // Credits if (credits.enabled && !chart.credits) { creditsHref = credits.href; chart.credits = renderer.text( credits.text, 0, 0 ) .on('click', function () { if (creditsHref) { location.href = creditsHref; } }) .attr({ align: credits.position.align, zIndex: 8 }) .css(credits.style) .add() .align(credits.position); } placeTrackerGroup(); // Set flag chart.hasRendered = true; // If the chart was rendered outside the top container, put it back in if (renderToClone) { renderTo.appendChild(container); discardElement(renderToClone); //updatePosition(container); } } /** * Clean up memory usage */ function destroy() { var i, parentNode = container && container.parentNode; // If the chart is destroyed already, do nothing. // This will happen if if a script invokes chart.destroy and // then it will be called again on win.unload if (chart === null) { return; } // fire the chart.destoy event fireEvent(chart, 'destroy'); // remove events removeEvent(chart); // ==== Destroy collections: // Destroy axes i = axes.length; while (i--) { axes[i] = axes[i].destroy(); } // Destroy each series i = series.length; while (i--) { series[i] = series[i].destroy(); } // ==== Destroy chart properties: each(['title', 'subtitle', 'seriesGroup', 'clipRect', 'credits', 'tracker', 'scroller', 'rangeSelector'], function (name) { var prop = chart[name]; if (prop) { chart[name] = prop.destroy(); } }); // ==== Destroy local variables: each([chartBackground, plotBorder, plotBackground, legend, tooltip, renderer, tracker], function (obj) { if (obj && obj.destroy) { obj.destroy(); } }); chartBackground = plotBorder = plotBackground = legend = tooltip = renderer = tracker = null; // remove container and all SVG if (container) { // can break in IE when destroyed before finished loading container.innerHTML = ''; removeEvent(container); if (parentNode) { discardElement(container); } // IE6 leak container = null; } // memory and CPU leak clearInterval(tooltipInterval); // clean it all up for (i in chart) { delete chart[i]; } chart = null; options = null; } /** * Prepare for first rendering after all data are loaded */ function firstRender() { // VML namespaces can't be added until after complete. Listening // for Perini's doScroll hack is not enough. var ONREADYSTATECHANGE = 'onreadystatechange', COMPLETE = 'complete'; // Note: in spite of JSLint's complaints, win == win.top is required /*jslint eqeq: true*/ if ((!hasSVG && (win == win.top && doc.readyState !== COMPLETE)) || (useCanVG && !win.canvg)) { /*jslint eqeq: false*/ if (useCanVG) { // Delay rendering until canvg library is downloaded and ready CanVGController.push(firstRender, options.global.canvasToolsURL); } else { doc.attachEvent(ONREADYSTATECHANGE, function () { doc.detachEvent(ONREADYSTATECHANGE, firstRender); if (doc.readyState === COMPLETE) { firstRender(); } }); } return; } // create the container getContainer(); // Run an early event after the container and renderer are established fireEvent(chart, 'init'); // Initialize range selector for stock charts if (Highcharts.RangeSelector && options.rangeSelector.enabled) { chart.rangeSelector = new Highcharts.RangeSelector(chart); } resetMargins(); setChartSize(); // Set the common inversion and transformation for inverted series after initSeries setInverted(); // get axes getAxes(); // Initialize the series each(options.series || [], function (serieOptions) { initSeries(serieOptions); }); // Run an event where series and axes can be added //fireEvent(chart, 'beforeRender'); // Initialize scroller for stock charts if (Highcharts.Scroller && (options.navigator.enabled || options.scrollbar.enabled)) { chart.scroller = new Highcharts.Scroller(chart); } chart.render = render; // depends on inverted and on margins being set chart.tracker = tracker = new MouseTracker(options.tooltip); render(); // add canvas renderer.draw(); // run callbacks if (callback) { callback.apply(chart, [chart]); } each(chart.callbacks, function (fn) { fn.apply(chart, [chart]); }); fireEvent(chart, 'load'); } // Run chart // Set up auto resize if (optionsChart.reflow !== false) { addEvent(chart, 'load', initReflow); } // Chart event handlers if (chartEvents) { for (eventType in chartEvents) { addEvent(chart, eventType, chartEvents[eventType]); } } chart.options = options; chart.series = series; chart.xAxis = []; chart.yAxis = []; // Expose methods and variables chart.addSeries = addSeries; chart.animation = useCanVG ? false : pick(optionsChart.animation, true); chart.Axis = Axis; chart.destroy = destroy; chart.get = get; chart.getSelectedPoints = getSelectedPoints; chart.getSelectedSeries = getSelectedSeries; chart.hideLoading = hideLoading; chart.initSeries = initSeries; chart.isInsidePlot = isInsidePlot; chart.redraw = redraw; chart.setSize = resize; chart.setTitle = setTitle; chart.showLoading = showLoading; chart.pointCount = 0; chart.counters = new ChartCounters(); /* if ($) $(function () { $container = $('#container'); var origChartWidth, origChartHeight; if ($container) { $('<button>+</button>') .insertBefore($container) .click(function () { if (origChartWidth === UNDEFINED) { origChartWidth = chartWidth; origChartHeight = chartHeight; } chart.resize(chartWidth *= 1.1, chartHeight *= 1.1); }); $('<button>-</button>') .insertBefore($container) .click(function () { if (origChartWidth === UNDEFINED) { origChartWidth = chartWidth; origChartHeight = chartHeight; } chart.resize(chartWidth *= 0.9, chartHeight *= 0.9); }); $('<button>1:1</button>') .insertBefore($container) .click(function () { if (origChartWidth === UNDEFINED) { origChartWidth = chartWidth; origChartHeight = chartHeight; } chart.resize(origChartWidth, origChartHeight); }); } }) */ firstRender(); } // end Chart // Hook for exporting module Chart.prototype.callbacks = []; /** * The Point object and prototype. Inheritable and used as base for PiePoint */ var Point = function () {}; Point.prototype = { /** * Initialize the point * @param {Object} series The series object containing this point * @param {Object} options The data in either number, array or object format */ init: function (series, options, x) { var point = this, counters = series.chart.counters, defaultColors; point.series = series; point.applyOptions(options, x); point.pointAttr = {}; if (series.options.colorByPoint) { defaultColors = series.chart.options.colors; if (!point.options) { point.options = {}; } point.color = point.options.color = point.color || defaultColors[counters.color++]; // loop back to zero counters.wrapColor(defaultColors.length); } series.chart.pointCount++; return point; }, /** * Apply the options containing the x and y data and possible some extra properties. * This is called on point init or from point.update. * * @param {Object} options */ applyOptions: function (options, x) { var point = this, series = point.series, optionsType = typeof options; point.config = options; // onedimensional array input if (optionsType === 'number' || options === null) { point.y = options; } else if (typeof options[0] === 'number') { // two-dimentional array point.x = options[0]; point.y = options[1]; } else if (optionsType === 'object' && typeof options.length !== 'number') { // object input // copy options directly to point extend(point, options); point.options = options; // This is the fastest way to detect if there are individual point dataLabels that need // to be considered in drawDataLabels. These can only occur in object configs. if (options.dataLabels) { series._hasPointLabels = true; } } else if (typeof options[0] === 'string') { // categorized data with name in first position point.name = options[0]; point.y = options[1]; } /* * If no x is set by now, get auto incremented value. All points must have an * x value, however the y value can be null to create a gap in the series */ // todo: skip this? It is only used in applyOptions, in translate it should not be used if (point.x === UNDEFINED) { point.x = x === UNDEFINED ? series.autoIncrement() : x; } }, /** * Destroy a point to clear memory. Its reference still stays in series.data. */ destroy: function () { var point = this, series = point.series, hoverPoints = series.chart.hoverPoints, prop; series.chart.pointCount--; if (hoverPoints) { point.setState(); erase(hoverPoints, point); } if (point === series.chart.hoverPoint) { point.onMouseOut(); } series.chart.hoverPoints = null; // remove all events if (point.graphic || point.dataLabel) { // removeEvent and destroyElements are performance expensive removeEvent(point); point.destroyElements(); } if (point.legendItem) { // pies have legend items point.series.chart.legend.destroyItem(point); } for (prop in point) { point[prop] = null; } }, /** * Destroy SVG elements associated with the point */ destroyElements: function () { var point = this, props = ['graphic', 'tracker', 'dataLabel', 'group', 'connector', 'shadowGroup'], prop, i = 6; while (i--) { prop = props[i]; if (point[prop]) { point[prop] = point[prop].destroy(); } } }, /** * Return the configuration hash needed for the data label and tooltip formatters */ getLabelConfig: function () { var point = this; return { x: point.category, y: point.y, key: point.name || point.category, series: point.series, point: point, percentage: point.percentage, total: point.total || point.stackTotal }; }, /** * Toggle the selection status of a point * @param {Boolean} selected Whether to select or unselect the point. * @param {Boolean} accumulate Whether to add to the previous selection. By default, * this happens if the control key (Cmd on Mac) was pressed during clicking. */ select: function (selected, accumulate) { var point = this, series = point.series, chart = series.chart; selected = pick(selected, !point.selected); // fire the event with the defalut handler point.firePointEvent(selected ? 'select' : 'unselect', { accumulate: accumulate }, function () { point.selected = selected; point.setState(selected && SELECT_STATE); // unselect all other points unless Ctrl or Cmd + click if (!accumulate) { each(chart.getSelectedPoints(), function (loopPoint) { if (loopPoint.selected && loopPoint !== point) { loopPoint.selected = false; loopPoint.setState(NORMAL_STATE); loopPoint.firePointEvent('unselect'); } }); } }); }, onMouseOver: function () { var point = this, series = point.series, chart = series.chart, tooltip = chart.tooltip, hoverPoint = chart.hoverPoint; // set normal state to previous series if (hoverPoint && hoverPoint !== point) { hoverPoint.onMouseOut(); } // trigger the event point.firePointEvent('mouseOver'); // update the tooltip if (tooltip && (!tooltip.shared || series.noSharedTooltip)) { tooltip.refresh(point); } // hover this point.setState(HOVER_STATE); chart.hoverPoint = point; }, onMouseOut: function () { var point = this; point.firePointEvent('mouseOut'); point.setState(); point.series.chart.hoverPoint = null; }, /** * Extendable method for formatting each point's tooltip line * * @return {String} A string to be concatenated in to the common tooltip text */ tooltipFormatter: function (pointFormat) { var point = this, series = point.series, seriesTooltipOptions = series.tooltipOptions, split = String(point.y).split('.'), originalDecimals = split[1] ? split[1].length : 0, match = pointFormat.match(/\{(series|point)\.[a-zA-Z]+\}/g), splitter = /[\.}]/, obj, key, replacement, i; // loop over the variables defined on the form {series.name}, {point.y} etc for (i in match) { key = match[i]; if (isString(key) && key !== pointFormat) { // IE matches more than just the variables obj = key.indexOf('point') === 1 ? point : series; if (key === '{point.y}') { // add some preformatting replacement = (seriesTooltipOptions.valuePrefix || seriesTooltipOptions.yPrefix || '') + numberFormat(point.y, pick(seriesTooltipOptions.valueDecimals, seriesTooltipOptions.yDecimals, originalDecimals)) + (seriesTooltipOptions.valueSuffix || seriesTooltipOptions.ySuffix || ''); } else { // automatic replacement replacement = obj[match[i].split(splitter)[1]]; } pointFormat = pointFormat.replace(match[i], replacement); } } return pointFormat; }, /** * Update the point with new options (typically x/y data) and optionally redraw the series. * * @param {Object} options Point options as defined in the series.data array * @param {Boolean} redraw Whether to redraw the chart or wait for an explicit call * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration * */ update: function (options, redraw, animation) { var point = this, series = point.series, graphic = point.graphic, i, data = series.data, dataLength = data.length, chart = series.chart; redraw = pick(redraw, true); // fire the event with a default handler of doing the update point.firePointEvent('update', { options: options }, function () { point.applyOptions(options); // update visuals if (isObject(options)) { series.getAttribs(); if (graphic) { graphic.attr(point.pointAttr[series.state]); } } // record changes in the parallel arrays for (i = 0; i < dataLength; i++) { if (data[i] === point) { series.xData[i] = point.x; series.yData[i] = point.y; series.options.data[i] = options; break; } } // redraw series.isDirty = true; series.isDirtyData = true; if (redraw) { chart.redraw(animation); } }); }, /** * Remove a point and optionally redraw the series and if necessary the axes * @param {Boolean} redraw Whether to redraw the chart or wait for an explicit call * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration */ remove: function (redraw, animation) { var point = this, series = point.series, chart = series.chart, i, data = series.data, dataLength = data.length; setAnimation(animation, chart); redraw = pick(redraw, true); // fire the event with a default handler of removing the point point.firePointEvent('remove', null, function () { //erase(series.data, point); for (i = 0; i < dataLength; i++) { if (data[i] === point) { // splice all the parallel arrays data.splice(i, 1); series.options.data.splice(i, 1); series.xData.splice(i, 1); series.yData.splice(i, 1); break; } } point.destroy(); // redraw series.isDirty = true; series.isDirtyData = true; if (redraw) { chart.redraw(); } }); }, /** * Fire an event on the Point object. Must not be renamed to fireEvent, as this * causes a name clash in MooTools * @param {String} eventType * @param {Object} eventArgs Additional event arguments * @param {Function} defaultFunction Default event handler */ firePointEvent: function (eventType, eventArgs, defaultFunction) { var point = this, series = this.series, seriesOptions = series.options; // load event handlers on demand to save time on mouseover/out if (seriesOptions.point.events[eventType] || (point.options && point.options.events && point.options.events[eventType])) { this.importEvents(); } // add default handler if in selection mode if (eventType === 'click' && seriesOptions.allowPointSelect) { defaultFunction = function (event) { // Control key is for Windows, meta (= Cmd key) for Mac, Shift for Opera point.select(null, event.ctrlKey || event.metaKey || event.shiftKey); }; } fireEvent(this, eventType, eventArgs, defaultFunction); }, /** * Import events from the series' and point's options. Only do it on * demand, to save processing time on hovering. */ importEvents: function () { if (!this.hasImportedEvents) { var point = this, options = merge(point.series.options.point, point.options), events = options.events, eventType; point.events = events; for (eventType in events) { addEvent(point, eventType, events[eventType]); } this.hasImportedEvents = true; } }, /** * Set the point's state * @param {String} state */ setState: function (state) { var point = this, plotX = point.plotX, plotY = point.plotY, series = point.series, stateOptions = series.options.states, markerOptions = defaultPlotOptions[series.type].marker && series.options.marker, normalDisabled = markerOptions && !markerOptions.enabled, markerStateOptions = markerOptions && markerOptions.states[state], stateDisabled = markerStateOptions && markerStateOptions.enabled === false, stateMarkerGraphic = series.stateMarkerGraphic, chart = series.chart, radius, pointAttr = point.pointAttr; state = state || NORMAL_STATE; // empty string if ( // already has this state state === point.state || // selected points don't respond to hover (point.selected && state !== SELECT_STATE) || // series' state options is disabled (stateOptions[state] && stateOptions[state].enabled === false) || // point marker's state options is disabled (state && (stateDisabled || (normalDisabled && !markerStateOptions.enabled))) ) { return; } // apply hover styles to the existing point if (point.graphic) { radius = point.graphic.symbolName && pointAttr[state].r; point.graphic.attr(merge( pointAttr[state], radius ? { // new symbol attributes (#507, #612) x: plotX - radius, y: plotY - radius, width: 2 * radius, height: 2 * radius } : {} )); } else { // if a graphic is not applied to each point in the normal state, create a shared // graphic for the hover state if (state) { if (!stateMarkerGraphic) { radius = markerOptions.radius; series.stateMarkerGraphic = stateMarkerGraphic = chart.renderer.symbol( series.symbol, -radius, -radius, 2 * radius, 2 * radius ) .attr(pointAttr[state]) .add(series.group); } stateMarkerGraphic.translate( plotX, plotY ); } if (stateMarkerGraphic) { stateMarkerGraphic[state ? 'show' : 'hide'](); } } point.state = state; } }; /** * @classDescription The base function which all other series types inherit from. The data in the series is stored * in various arrays. * * - First, series.options.data contains all the original config options for * each point whether added by options or methods like series.addPoint. * - Next, series.data contains those values converted to points, but in case the series data length * exceeds the cropThreshold, or if the data is grouped, series.data doesn't contain all the points. It * only contains the points that have been created on demand. * - Then there's series.points that contains all currently visible point objects. In case of cropping, * the cropped-away points are not part of this array. The series.points array starts at series.cropStart * compared to series.data and series.options.data. If however the series data is grouped, these can't * be correlated one to one. * - series.xData and series.processedXData contain clean x values, equivalent to series.data and series.points. * - series.yData and series.processedYData contain clean x values, equivalent to series.data and series.points. * * @param {Object} chart * @param {Object} options */ var Series = function () {}; Series.prototype = { isCartesian: true, type: 'line', pointClass: Point, pointAttrToOptions: { // mapping between SVG attributes and the corresponding options stroke: 'lineColor', 'stroke-width': 'lineWidth', fill: 'fillColor', r: 'radius' }, init: function (chart, options) { var series = this, eventType, events, //pointEvent, index = chart.series.length; series.chart = chart; series.options = options = series.setOptions(options); // merge with plotOptions // bind the axes series.bindAxes(); // set some variables extend(series, { index: index, name: options.name || 'Series ' + (index + 1), state: NORMAL_STATE, pointAttr: {}, visible: options.visible !== false, // true by default selected: options.selected === true // false by default }); // special if (useCanVG) { options.animation = false; } // register event listeners events = options.events; for (eventType in events) { addEvent(series, eventType, events[eventType]); } if ( (events && events.click) || (options.point && options.point.events && options.point.events.click) || options.allowPointSelect ) { chart.runTrackerClick = true; } series.getColor(); series.getSymbol(); // set the data series.setData(options.data, false); }, /** * Set the xAxis and yAxis properties of cartesian series, and register the series * in the axis.series array */ bindAxes: function () { var series = this, seriesOptions = series.options, chart = series.chart, axisOptions; if (series.isCartesian) { each(['xAxis', 'yAxis'], function (AXIS) { // repeat for xAxis and yAxis each(chart[AXIS], function (axis) { // loop through the chart's axis objects axisOptions = axis.options; // apply if the series xAxis or yAxis option mathches the number of the // axis, or if undefined, use the first axis if ((seriesOptions[AXIS] === axisOptions.index) || (seriesOptions[AXIS] === UNDEFINED && axisOptions.index === 0)) { // register this series in the axis.series lookup axis.series.push(series); // set this series.xAxis or series.yAxis reference series[AXIS] = axis; // mark dirty for redraw axis.isDirty = true; } }); }); } }, /** * Return an auto incremented x value based on the pointStart and pointInterval options. * This is only used if an x value is not given for the point that calls autoIncrement. */ autoIncrement: function () { var series = this, options = series.options, xIncrement = series.xIncrement; xIncrement = pick(xIncrement, options.pointStart, 0); series.pointInterval = pick(series.pointInterval, options.pointInterval, 1); series.xIncrement = xIncrement + series.pointInterval; return xIncrement; }, /** * Divide the series data into segments divided by null values. */ getSegments: function () { var series = this, lastNull = -1, segments = [], i, points = series.points, pointsLength = points.length; if (pointsLength) { // no action required for [] // if connect nulls, just remove null points if (series.options.connectNulls) { i = pointsLength; while (i--) { if (points[i].y === null) { points.splice(i, 1); } } segments = [points]; // else, split on null points } else { each(points, function (point, i) { if (point.y === null) { if (i > lastNull + 1) { segments.push(points.slice(lastNull + 1, i)); } lastNull = i; } else if (i === pointsLength - 1) { // last value segments.push(points.slice(lastNull + 1, i + 1)); } }); } } // register it series.segments = segments; }, /** * Set the series options by merging from the options tree * @param {Object} itemOptions */ setOptions: function (itemOptions) { var series = this, chart = series.chart, chartOptions = chart.options, plotOptions = chartOptions.plotOptions, data = itemOptions.data, options; itemOptions.data = null; // remove from merge to prevent looping over the data set options = merge( plotOptions[this.type], plotOptions.series, itemOptions ); // Re-insert the data array to the options and the original config (#717) options.data = itemOptions.data = data; // the tooltip options are merged between global and series specific options series.tooltipOptions = merge(chartOptions.tooltip, options.tooltip); return options; }, /** * Get the series' color */ getColor: function () { var defaultColors = this.chart.options.colors, counters = this.chart.counters; this.color = this.options.color || defaultColors[counters.color++] || '#0000ff'; counters.wrapColor(defaultColors.length); }, /** * Get the series' symbol */ getSymbol: function () { var series = this, seriesMarkerOption = series.options.marker, chart = series.chart, defaultSymbols = chart.options.symbols, counters = chart.counters; series.symbol = seriesMarkerOption.symbol || defaultSymbols[counters.symbol++]; // don't substract radius in image symbols (#604) if (/^url/.test(series.symbol)) { seriesMarkerOption.radius = 0; } counters.wrapSymbol(defaultSymbols.length); }, /** * Add a point dynamically after chart load time * @param {Object} options Point options as given in series.data * @param {Boolean} redraw Whether to redraw the chart or wait for an explicit call * @param {Boolean} shift If shift is true, a point is shifted off the start * of the series as one is appended to the end. * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration */ addPoint: function (options, redraw, shift, animation) { var series = this, data = series.data, graph = series.graph, area = series.area, chart = series.chart, xData = series.xData, yData = series.yData, currentShift = (graph && graph.shift) || 0, dataOptions = series.options.data, point; //point = (new series.pointClass()).init(series, options); setAnimation(animation, chart); if (graph && shift) { // make graph animate sideways graph.shift = currentShift + 1; } if (area) { area.shift = currentShift + 1; area.isArea = true; } redraw = pick(redraw, true); // Get options and push the point to xData, yData and series.options. In series.generatePoints // the Point instance will be created on demand and pushed to the series.data array. point = { series: series }; series.pointClass.prototype.applyOptions.apply(point, [options]); xData.push(point.x); yData.push(series.valueCount === 4 ? [point.open, point.high, point.low, point.close] : point.y); dataOptions.push(options); // Shift the first point off the parallel arrays // todo: consider series.removePoint(i) method if (shift) { if (data[0]) { data[0].remove(false); } else { data.shift(); xData.shift(); yData.shift(); dataOptions.shift(); } } series.getAttribs(); // redraw series.isDirty = true; series.isDirtyData = true; if (redraw) { chart.redraw(); } }, /** * Replace the series data with a new set of data * @param {Object} data * @param {Object} redraw */ setData: function (data, redraw) { var series = this, oldData = series.points, options = series.options, initialColor = series.initialColor, chart = series.chart, firstPoint = null, i; // reset properties series.xIncrement = null; series.pointRange = (series.xAxis && series.xAxis.categories && 1) || options.pointRange; if (defined(initialColor)) { // reset colors for pie chart.counters.color = initialColor; } // parallel arrays var xData = [], yData = [], dataLength = data ? data.length : [], turboThreshold = options.turboThreshold || 1000, pt, ohlc = series.valueCount === 4; // In turbo mode, only one- or twodimensional arrays of numbers are allowed. The // first value is tested, and we assume that all the rest are defined the same // way. Although the 'for' loops are similar, they are repeated inside each // if-else conditional for max performance. if (dataLength > turboThreshold) { // find the first non-null point i = 0; while (firstPoint === null && i < dataLength) { firstPoint = data[i]; i++; } if (isNumber(firstPoint)) { // assume all points are numbers var x = pick(options.pointStart, 0), pointInterval = pick(options.pointInterval, 1); for (i = 0; i < dataLength; i++) { xData[i] = x; yData[i] = data[i]; x += pointInterval; } series.xIncrement = x; } else if (isArray(firstPoint)) { // assume all points are arrays if (ohlc) { // [x, o, h, l, c] for (i = 0; i < dataLength; i++) { pt = data[i]; xData[i] = pt[0]; yData[i] = pt.slice(1, 5); } } else { // [x, y] for (i = 0; i < dataLength; i++) { pt = data[i]; xData[i] = pt[0]; yData[i] = pt[1]; } } } /* else { error(12); // Highcharts expects configs to be numbers or arrays in turbo mode }*/ } else { for (i = 0; i < dataLength; i++) { pt = { series: series }; series.pointClass.prototype.applyOptions.apply(pt, [data[i]]); xData[i] = pt.x; yData[i] = ohlc ? [pt.open, pt.high, pt.low, pt.close] : pt.y; } } series.data = []; series.options.data = data; series.xData = xData; series.yData = yData; // destroy old points i = (oldData && oldData.length) || 0; while (i--) { if (oldData[i] && oldData[i].destroy) { oldData[i].destroy(); } } // redraw series.isDirty = series.isDirtyData = chart.isDirtyBox = true; if (pick(redraw, true)) { chart.redraw(false); } }, /** * Remove a series and optionally redraw the chart * * @param {Boolean} redraw Whether to redraw the chart or wait for an explicit call * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration */ remove: function (redraw, animation) { var series = this, chart = series.chart; redraw = pick(redraw, true); if (!series.isRemoving) { /* prevent triggering native event in jQuery (calling the remove function from the remove event) */ series.isRemoving = true; // fire the event with a default handler of removing the point fireEvent(series, 'remove', null, function () { // destroy elements series.destroy(); // redraw chart.isDirtyLegend = chart.isDirtyBox = true; if (redraw) { chart.redraw(animation); } }); } series.isRemoving = false; }, /** * Process the data by cropping away unused data points if the series is longer * than the crop threshold. This saves computing time for lage series. */ processData: function (force) { var series = this, processedXData = series.xData, // copied during slice operation below processedYData = series.yData, dataLength = processedXData.length, cropStart = 0, cropEnd = dataLength, cropped, distance, closestPointRange, xAxis = series.xAxis, i, // loop variable options = series.options, cropThreshold = options.cropThreshold; // If the series data or axes haven't changed, don't go through this. Return false to pass // the message on to override methods like in data grouping. if (series.isCartesian && !series.isDirty && !xAxis.isDirty && !series.yAxis.isDirty && !force) { return false; } // optionally filter out points outside the plot area if (!cropThreshold || dataLength > cropThreshold || series.forceCrop) { var extremes = xAxis.getExtremes(), min = extremes.min, max = extremes.max; // it's outside current extremes if (processedXData[dataLength - 1] < min || processedXData[0] > max) { processedXData = []; processedYData = []; // only crop if it's actually spilling out } else if (processedXData[0] < min || processedXData[dataLength - 1] > max) { // iterate up to find slice start for (i = 0; i < dataLength; i++) { if (processedXData[i] >= min) { cropStart = mathMax(0, i - 1); break; } } // proceed to find slice end for (; i < dataLength; i++) { if (processedXData[i] > max) { cropEnd = i + 1; break; } } processedXData = processedXData.slice(cropStart, cropEnd); processedYData = processedYData.slice(cropStart, cropEnd); cropped = true; } } // Find the closest distance between processed points for (i = processedXData.length - 1; i > 0; i--) { distance = processedXData[i] - processedXData[i - 1]; if (closestPointRange === UNDEFINED || distance < closestPointRange) { closestPointRange = distance; } } // Record the properties series.cropped = cropped; // undefined or true series.cropStart = cropStart; series.processedXData = processedXData; series.processedYData = processedYData; if (options.pointRange === null) { // null means auto, as for columns, candlesticks and OHLC series.pointRange = closestPointRange || 1; } series.closestPointRange = closestPointRange; }, /** * Generate the data point after the data has been processed by cropping away * unused points and optionally grouped in Highcharts Stock. */ generatePoints: function () { var series = this, options = series.options, dataOptions = options.data, data = series.data, dataLength, processedXData = series.processedXData, processedYData = series.processedYData, pointClass = series.pointClass, processedDataLength = processedXData.length, cropStart = series.cropStart || 0, cursor, hasGroupedData = series.hasGroupedData, point, points = [], i; if (!data && !hasGroupedData) { var arr = []; arr.length = dataOptions.length; data = series.data = arr; } for (i = 0; i < processedDataLength; i++) { cursor = cropStart + i; if (!hasGroupedData) { if (data[cursor]) { point = data[cursor]; } else { data[cursor] = point = (new pointClass()).init(series, dataOptions[cursor], processedXData[i]); } points[i] = point; } else { // splat the y data in case of ohlc data array points[i] = (new pointClass()).init(series, [processedXData[i]].concat(splat(processedYData[i]))); } } // Hide cropped-away points - this only runs when the number of points is above cropThreshold, or when // swithching view from non-grouped data to grouped data (#637) if (data && (processedDataLength !== (dataLength = data.length) || hasGroupedData)) { for (i = 0; i < dataLength; i++) { if (i === cropStart && !hasGroupedData) { // when has grouped data, clear all points i += processedDataLength; } if (data[i]) { data[i].destroyElements(); } } } series.data = data; series.points = points; }, /** * Translate data points from raw data values to chart specific positioning data * needed later in drawPoints, drawGraph and drawTracker. */ translate: function () { if (!this.processedXData) { // hidden series this.processData(); } this.generatePoints(); var series = this, chart = series.chart, options = series.options, stacking = options.stacking, xAxis = series.xAxis, categories = xAxis.categories, yAxis = series.yAxis, points = series.points, dataLength = points.length, hasModifyValue = !!series.modifyValue, isLastSeries, allStackSeries = yAxis.series, i = allStackSeries.length; // Is it the last visible series? while (i--) { if (allStackSeries[i].visible) { if (i === series.index) { isLastSeries = true; } break; } } // Translate each point for (i = 0; i < dataLength; i++) { var point = points[i], xValue = point.x, yValue = point.y, yBottom = point.low, stack = yAxis.stacks[(yValue < options.threshold ? '-' : '') + series.stackKey], pointStack, pointStackTotal; // get the plotX translation point.plotX = mathRound(xAxis.translate(xValue, 0, 0, 0, 1) * 10) / 10; // Math.round fixes #591 // calculate the bottom y value for stacked series if (stacking && series.visible && stack && stack[xValue]) { pointStack = stack[xValue]; pointStackTotal = pointStack.total; pointStack.cum = yBottom = pointStack.cum - yValue; // start from top yValue = yBottom + yValue; if (isLastSeries) { yBottom = options.threshold; } if (stacking === 'percent') { yBottom = pointStackTotal ? yBottom * 100 / pointStackTotal : 0; yValue = pointStackTotal ? yValue * 100 / pointStackTotal : 0; } point.percentage = pointStackTotal ? point.y * 100 / pointStackTotal : 0; point.stackTotal = pointStackTotal; } // Set translated yBottom or remove it point.yBottom = defined(yBottom) ? yAxis.translate(yBottom, 0, 1, 0, 1) : null; // general hook, used for Highstock compare mode if (hasModifyValue) { yValue = series.modifyValue(yValue, point); } // set the y value if (yValue !== null) { point.plotY = mathRound(yAxis.translate(yValue, 0, 1, 0, 1) * 10) / 10; // Math.round fixes #591 } // set client related positions for mouse tracking point.clientX = chart.inverted ? chart.plotHeight - point.plotX : point.plotX; // for mouse tracking // some API data point.category = categories && categories[point.x] !== UNDEFINED ? categories[point.x] : point.x; } // now that we have the cropped data, build the segments series.getSegments(); }, /** * Memoize tooltip texts and positions */ setTooltipPoints: function (renew) { var series = this, chart = series.chart, inverted = chart.inverted, points = [], pointsLength, plotSize = mathRound((inverted ? chart.plotTop : chart.plotLeft) + chart.plotSizeX), low, high, xAxis = series.xAxis, point, i, tooltipPoints = []; // a lookup array for each pixel in the x dimension // don't waste resources if tracker is disabled if (series.options.enableMouseTracking === false) { return; } // renew if (renew) { series.tooltipPoints = null; } // concat segments to overcome null values each(series.segments || series.points, function (segment) { points = points.concat(segment); }); // loop the concatenated points and apply each point to all the closest // pixel positions if (xAxis && xAxis.reversed) { points = points.reverse();//reverseArray(points); } //each(points, function (point, i) { pointsLength = points.length; for (i = 0; i < pointsLength; i++) { point = points[i]; low = points[i - 1] ? points[i - 1]._high + 1 : 0; high = point._high = points[i + 1] ? (mathFloor((point.plotX + (points[i + 1] ? points[i + 1].plotX : plotSize)) / 2)) : plotSize; while (low <= high) { tooltipPoints[inverted ? plotSize - low++ : low++] = point; } } series.tooltipPoints = tooltipPoints; }, /** * Format the header of the tooltip */ tooltipHeaderFormatter: function (key) { var series = this, tooltipOptions = series.tooltipOptions, xDateFormat = tooltipOptions.xDateFormat || '%A, %b %e, %Y', xAxis = series.xAxis, isDateTime = xAxis && xAxis.options.type === 'datetime'; return tooltipOptions.headerFormat .replace('{point.key}', isDateTime ? dateFormat(xDateFormat, key) : key) .replace('{series.name}', series.name) .replace('{series.color}', series.color); }, /** * Series mouse over handler */ onMouseOver: function () { var series = this, chart = series.chart, hoverSeries = chart.hoverSeries; if (!hasTouch && chart.mouseIsDown) { return; } // set normal state to previous series if (hoverSeries && hoverSeries !== series) { hoverSeries.onMouseOut(); } // trigger the event, but to save processing time, // only if defined if (series.options.events.mouseOver) { fireEvent(series, 'mouseOver'); } // hover this series.setState(HOVER_STATE); chart.hoverSeries = series; }, /** * Series mouse out handler */ onMouseOut: function () { // trigger the event only if listeners exist var series = this, options = series.options, chart = series.chart, tooltip = chart.tooltip, hoverPoint = chart.hoverPoint; // trigger mouse out on the point, which must be in this series if (hoverPoint) { hoverPoint.onMouseOut(); } // fire the mouse out event if (series && options.events.mouseOut) { fireEvent(series, 'mouseOut'); } // hide the tooltip if (tooltip && !options.stickyTracking && !tooltip.shared) { tooltip.hide(); } // set normal state series.setState(); chart.hoverSeries = null; }, /** * Animate in the series */ animate: function (init) { var series = this, chart = series.chart, clipRect = series.clipRect, animation = series.options.animation; if (animation && !isObject(animation)) { animation = {}; } if (init) { // initialize the animation if (!clipRect.isAnimating) { // apply it only for one of the series clipRect.attr('width', 0); clipRect.isAnimating = true; } } else { // run the animation clipRect.animate({ width: chart.plotSizeX }, animation); // delete this function to allow it only once this.animate = null; } }, /** * Draw the markers */ drawPoints: function () { var series = this, pointAttr, points = series.points, chart = series.chart, plotX, plotY, i, point, radius, symbol, isImage, graphic; if (series.options.marker.enabled) { i = points.length; while (i--) { point = points[i]; plotX = point.plotX; plotY = point.plotY; graphic = point.graphic; // only draw the point if y is defined if (plotY !== UNDEFINED && !isNaN(plotY)) { // shortcuts pointAttr = point.pointAttr[point.selected ? SELECT_STATE : NORMAL_STATE]; radius = pointAttr.r; symbol = pick(point.marker && point.marker.symbol, series.symbol); isImage = symbol.indexOf('url') === 0; if (graphic) { // update graphic.animate(extend({ x: plotX - radius, y: plotY - radius }, graphic.symbolName ? { // don't apply to image symbols #507 width: 2 * radius, height: 2 * radius } : {})); } else if (radius > 0 || isImage) { point.graphic = chart.renderer.symbol( symbol, plotX - radius, plotY - radius, 2 * radius, 2 * radius ) .attr(pointAttr) .add(series.group); } } } } }, /** * Convert state properties from API naming conventions to SVG attributes * * @param {Object} options API options object * @param {Object} base1 SVG attribute object to inherit from * @param {Object} base2 Second level SVG attribute object to inherit from */ convertAttribs: function (options, base1, base2, base3) { var conversion = this.pointAttrToOptions, attr, option, obj = {}; options = options || {}; base1 = base1 || {}; base2 = base2 || {}; base3 = base3 || {}; for (attr in conversion) { option = conversion[attr]; obj[attr] = pick(options[option], base1[attr], base2[attr], base3[attr]); } return obj; }, /** * Get the state attributes. Each series type has its own set of attributes * that are allowed to change on a point's state change. Series wide attributes are stored for * all series, and additionally point specific attributes are stored for all * points with individual marker options. If such options are not defined for the point, * a reference to the series wide attributes is stored in point.pointAttr. */ getAttribs: function () { var series = this, normalOptions = defaultPlotOptions[series.type].marker ? series.options.marker : series.options, stateOptions = normalOptions.states, stateOptionsHover = stateOptions[HOVER_STATE], pointStateOptionsHover, seriesColor = series.color, normalDefaults = { stroke: seriesColor, fill: seriesColor }, points = series.points, i, point, seriesPointAttr = [], pointAttr, pointAttrToOptions = series.pointAttrToOptions, hasPointSpecificOptions, key; // series type specific modifications if (series.options.marker) { // line, spline, area, areaspline, scatter // if no hover radius is given, default to normal radius + 2 stateOptionsHover.radius = stateOptionsHover.radius || normalOptions.radius + 2; stateOptionsHover.lineWidth = stateOptionsHover.lineWidth || normalOptions.lineWidth + 1; } else { // column, bar, pie // if no hover color is given, brighten the normal color stateOptionsHover.color = stateOptionsHover.color || Color(stateOptionsHover.color || seriesColor) .brighten(stateOptionsHover.brightness).get(); } // general point attributes for the series normal state seriesPointAttr[NORMAL_STATE] = series.convertAttribs(normalOptions, normalDefaults); // HOVER_STATE and SELECT_STATE states inherit from normal state except the default radius each([HOVER_STATE, SELECT_STATE], function (state) { seriesPointAttr[state] = series.convertAttribs(stateOptions[state], seriesPointAttr[NORMAL_STATE]); }); // set it series.pointAttr = seriesPointAttr; // Generate the point-specific attribute collections if specific point // options are given. If not, create a referance to the series wide point // attributes i = points.length; while (i--) { point = points[i]; normalOptions = (point.options && point.options.marker) || point.options; if (normalOptions && normalOptions.enabled === false) { normalOptions.radius = 0; } hasPointSpecificOptions = false; // check if the point has specific visual options if (point.options) { for (key in pointAttrToOptions) { if (defined(normalOptions[pointAttrToOptions[key]])) { hasPointSpecificOptions = true; } } } // a specific marker config object is defined for the individual point: // create it's own attribute collection if (hasPointSpecificOptions) { pointAttr = []; stateOptions = normalOptions.states || {}; // reassign for individual point pointStateOptionsHover = stateOptions[HOVER_STATE] = stateOptions[HOVER_STATE] || {}; // if no hover color is given, brighten the normal color if (!series.options.marker) { // column, bar, point pointStateOptionsHover.color = Color(pointStateOptionsHover.color || point.options.color) .brighten(pointStateOptionsHover.brightness || stateOptionsHover.brightness).get(); } // normal point state inherits series wide normal state pointAttr[NORMAL_STATE] = series.convertAttribs(normalOptions, seriesPointAttr[NORMAL_STATE]); // inherit from point normal and series hover pointAttr[HOVER_STATE] = series.convertAttribs( stateOptions[HOVER_STATE], seriesPointAttr[HOVER_STATE], pointAttr[NORMAL_STATE] ); // inherit from point normal and series hover pointAttr[SELECT_STATE] = series.convertAttribs( stateOptions[SELECT_STATE], seriesPointAttr[SELECT_STATE], pointAttr[NORMAL_STATE] ); // no marker config object is created: copy a reference to the series-wide // attribute collection } else { pointAttr = seriesPointAttr; } point.pointAttr = pointAttr; } }, /** * Clear DOM objects and free up memory */ destroy: function () { var series = this, chart = series.chart, seriesClipRect = series.clipRect, issue134 = /AppleWebKit\/533/.test(userAgent), destroy, i, data = series.data || [], point, prop, axis; // add event hook fireEvent(series, 'destroy'); // remove all events removeEvent(series); // erase from axes each(['xAxis', 'yAxis'], function (AXIS) { axis = series[AXIS]; if (axis) { erase(axis.series, series); axis.isDirty = true; } }); // remove legend items if (series.legendItem) { series.chart.legend.destroyItem(series); } // destroy all points with their elements i = data.length; while (i--) { point = data[i]; if (point && point.destroy) { point.destroy(); } } series.points = null; // If this series clipRect is not the global one (which is removed on chart.destroy) we // destroy it here. if (seriesClipRect && seriesClipRect !== chart.clipRect) { series.clipRect = seriesClipRect.destroy(); } // destroy all SVGElements associated to the series each(['area', 'graph', 'dataLabelsGroup', 'group', 'tracker'], function (prop) { if (series[prop]) { // issue 134 workaround destroy = issue134 && prop === 'group' ? 'hide' : 'destroy'; series[prop][destroy](); } }); // remove from hoverSeries if (chart.hoverSeries === series) { chart.hoverSeries = null; } erase(chart.series, series); // clear all members for (prop in series) { delete series[prop]; } }, /** * Draw the data labels */ drawDataLabels: function () { var series = this, seriesOptions = series.options, options = seriesOptions.dataLabels; if (options.enabled || series._hasPointLabels) { var x, y, points = series.points, pointOptions, generalOptions, str, dataLabelsGroup = series.dataLabelsGroup, chart = series.chart, xAxis = series.xAxis, groupLeft = xAxis ? xAxis.left : chart.plotLeft, yAxis = series.yAxis, groupTop = yAxis ? yAxis.top : chart.plotTop, renderer = chart.renderer, inverted = chart.inverted, seriesType = series.type, stacking = seriesOptions.stacking, isBarLike = seriesType === 'column' || seriesType === 'bar', vAlignIsNull = options.verticalAlign === null, yIsNull = options.y === null, dataLabel; if (isBarLike) { if (stacking) { // In stacked series the default label placement is inside the bars if (vAlignIsNull) { options = merge(options, {verticalAlign: 'middle'}); } // If no y delta is specified, try to create a good default if (yIsNull) { options = merge(options, {y: {top: 14, middle: 4, bottom: -6}[options.verticalAlign]}); } } else { // In non stacked series the default label placement is on top of the bars if (vAlignIsNull) { options = merge(options, {verticalAlign: 'top'}); } } } // create a separate group for the data labels to avoid rotation if (!dataLabelsGroup) { dataLabelsGroup = series.dataLabelsGroup = renderer.g('data-labels') .attr({ visibility: series.visible ? VISIBLE : HIDDEN, zIndex: 6 }) .translate(groupLeft, groupTop) .add(); } else { dataLabelsGroup.translate(groupLeft, groupTop); } // make the labels for each point generalOptions = options; each(points, function (point) { dataLabel = point.dataLabel; // Merge in individual options from point options = generalOptions; // reset changes from previous points pointOptions = point.options; if (pointOptions && pointOptions.dataLabels) { options = merge(options, pointOptions.dataLabels); } // If the point is outside the plot area, destroy it. #678 if (dataLabel && series.isCartesian && !chart.isInsidePlot(point.plotX, point.plotY)) { point.dataLabel = dataLabel.destroy(); // Individual labels are disabled if the are explicitly disabled // in the point options, or if they fall outside the plot area. } else if (options.enabled) { // Get the string str = options.formatter.call(point.getLabelConfig(), options); var barX = point.barX, plotX = (barX && barX + point.barW / 2) || point.plotX || -999, plotY = pick(point.plotY, -999), align = options.align, individualYDelta = yIsNull ? (point.y >= 0 ? -6 : 12) : options.y; // Postprocess the positions x = (inverted ? chart.plotWidth - plotY : plotX) + options.x; y = (inverted ? chart.plotHeight - plotX : plotY) + individualYDelta; // in columns, align the string to the column if (seriesType === 'column') { x += { left: -1, right: 1 }[align] * point.barW / 2 || 0; } if (!stacking && inverted && point.y < 0) { align = 'right'; x -= 10; } // Determine the color options.style.color = pick(options.color, options.style.color, series.color, 'black'); // update existing label if (dataLabel) { // vertically centered if (inverted && !options.y) { y = y + pInt(dataLabel.styles.lineHeight) * 0.9 - dataLabel.getBBox().height / 2; } dataLabel .attr({ text: str }).animate({ x: x, y: y }); // create new label } else if (defined(str)) { dataLabel = point.dataLabel = renderer.text( str, x, y, options.useHTML ) .attr({ align: align, rotation: options.rotation, zIndex: 1 }) .css(options.style) .add(dataLabelsGroup); // vertically centered if (inverted && !options.y) { dataLabel.attr({ y: y + pInt(dataLabel.styles.lineHeight) * 0.9 - dataLabel.getBBox().height / 2 }); } } if (isBarLike && seriesOptions.stacking && dataLabel) { var barY = point.barY, barW = point.barW, barH = point.barH; dataLabel.align(options, null, { x: inverted ? chart.plotWidth - barY - barH : barX, y: inverted ? chart.plotHeight - barX - barW : barY, width: inverted ? barH : barW, height: inverted ? barW : barH }); } } }); } }, /** * Draw the actual graph */ drawGraph: function () { var series = this, options = series.options, chart = series.chart, graph = series.graph, graphPath = [], fillColor, area = series.area, group = series.group, color = options.lineColor || series.color, lineWidth = options.lineWidth, dashStyle = options.dashStyle, segmentPath, renderer = chart.renderer, translatedThreshold = series.yAxis.getThreshold(options.threshold), useArea = /^area/.test(series.type), singlePoints = [], // used in drawTracker areaPath = [], attribs; // divide into segments and build graph and area paths each(series.segments, function (segment) { segmentPath = []; // build the segment line each(segment, function (point, i) { if (series.getPointSpline) { // generate the spline as defined in the SplineSeries object segmentPath.push.apply(segmentPath, series.getPointSpline(segment, point, i)); } else { // moveTo or lineTo segmentPath.push(i ? L : M); // step line? if (i && options.step) { var lastPoint = segment[i - 1]; segmentPath.push( point.plotX, lastPoint.plotY ); } // normal line to next point segmentPath.push( point.plotX, point.plotY ); } }); // add the segment to the graph, or a single point for tracking if (segment.length > 1) { graphPath = graphPath.concat(segmentPath); } else { singlePoints.push(segment[0]); } // build the area if (useArea) { var areaSegmentPath = [], i, segLength = segmentPath.length; for (i = 0; i < segLength; i++) { areaSegmentPath.push(segmentPath[i]); } if (segLength === 3) { // for animation from 1 to two points areaSegmentPath.push(L, segmentPath[1], segmentPath[2]); } if (options.stacking && series.type !== 'areaspline') { // Follow stack back. Todo: implement areaspline. A general solution could be to // reverse the entire graphPath of the previous series, though may be hard with // splines and with series with different extremes for (i = segment.length - 1; i >= 0; i--) { // step line? if (i < segment.length - 1 && options.step) { areaSegmentPath.push(segment[i + 1].plotX, segment[i].yBottom); } areaSegmentPath.push(segment[i].plotX, segment[i].yBottom); } } else { // follow zero line back areaSegmentPath.push( L, segment[segment.length - 1].plotX, translatedThreshold, L, segment[0].plotX, translatedThreshold ); } areaPath = areaPath.concat(areaSegmentPath); } }); // used in drawTracker: series.graphPath = graphPath; series.singlePoints = singlePoints; // draw the area if area series or areaspline if (useArea) { fillColor = pick( options.fillColor, Color(series.color).setOpacity(options.fillOpacity || 0.75).get() ); if (area) { area.animate({ d: areaPath }); } else { // draw the area series.area = series.chart.renderer.path(areaPath) .attr({ fill: fillColor }).add(group); } } // draw the graph if (graph) { stop(graph); // cancel running animations, #459 graph.animate({ d: graphPath }); } else { if (lineWidth) { attribs = { 'stroke': color, 'stroke-width': lineWidth }; if (dashStyle) { attribs.dashstyle = dashStyle; } series.graph = renderer.path(graphPath) .attr(attribs).add(group).shadow(options.shadow); } } }, /** * Render the graph and markers */ render: function () { var series = this, chart = series.chart, group, setInvert, options = series.options, doClip = options.clip !== false, animation = options.animation, doAnimation = animation && series.animate, duration = doAnimation ? (animation && animation.duration) || 500 : 0, clipRect = series.clipRect, renderer = chart.renderer; // Add plot area clipping rectangle. If this is before chart.hasRendered, // create one shared clipRect. // Todo: since creating the clip property, the clipRect is created but // never used when clip is false. A better way would be that the animation // would run, then the clipRect destroyed. if (!clipRect) { clipRect = series.clipRect = !chart.hasRendered && chart.clipRect ? chart.clipRect : renderer.clipRect(0, 0, chart.plotSizeX, chart.plotSizeY + 1); if (!chart.clipRect) { chart.clipRect = clipRect; } } // the group if (!series.group) { group = series.group = renderer.g('series'); if (chart.inverted) { setInvert = function () { group.attr({ width: chart.plotWidth, height: chart.plotHeight }).invert(); }; setInvert(); // do it now addEvent(chart, 'resize', setInvert); // do it on resize addEvent(series, 'destroy', function () { removeEvent(chart, 'resize', setInvert); }); } if (doClip) { group.clip(clipRect); } group.attr({ visibility: series.visible ? VISIBLE : HIDDEN, zIndex: options.zIndex }) .translate(series.xAxis.left, series.yAxis.top) .add(chart.seriesGroup); } series.drawDataLabels(); // initiate the animation if (doAnimation) { series.animate(true); } // cache attributes for shapes series.getAttribs(); // draw the graph if any if (series.drawGraph) { series.drawGraph(); } // draw the points series.drawPoints(); // draw the mouse tracking area if (series.options.enableMouseTracking !== false) { series.drawTracker(); } // run the animation if (doAnimation) { series.animate(); } // finish the individual clipRect setTimeout(function () { clipRect.isAnimating = false; group = series.group; // can be destroyed during the timeout if (group && clipRect !== chart.clipRect && clipRect.renderer) { if (doClip) { group.clip((series.clipRect = chart.clipRect)); } clipRect.destroy(); } }, duration); series.isDirty = series.isDirtyData = false; // means data is in accordance with what you see // (See #322) series.isDirty = series.isDirtyData = false; // means data is in accordance with what you see }, /** * Redraw the series after an update in the axes. */ redraw: function () { var series = this, chart = series.chart, wasDirtyData = series.isDirtyData, // cache it here as it is set to false in render, but used after group = series.group; // reposition on resize if (group) { if (chart.inverted) { group.attr({ width: chart.plotWidth, height: chart.plotHeight }); } group.animate({ translateX: series.xAxis.left, translateY: series.yAxis.top }); } series.translate(); series.setTooltipPoints(true); series.render(); if (wasDirtyData) { fireEvent(series, 'updatedData'); } }, /** * Set the state of the graph */ setState: function (state) { var series = this, options = series.options, graph = series.graph, stateOptions = options.states, lineWidth = options.lineWidth; state = state || NORMAL_STATE; if (series.state !== state) { series.state = state; if (stateOptions[state] && stateOptions[state].enabled === false) { return; } if (state) { lineWidth = stateOptions[state].lineWidth || lineWidth + 1; } if (graph && !graph.dashstyle) { // hover is turned off for dashed lines in VML graph.attr({ // use attr because animate will cause any other animation on the graph to stop 'stroke-width': lineWidth }, state ? 0 : 500); } } }, /** * Set the visibility of the graph * * @param vis {Boolean} True to show the series, false to hide. If UNDEFINED, * the visibility is toggled. */ setVisible: function (vis, redraw) { var series = this, chart = series.chart, legendItem = series.legendItem, seriesGroup = series.group, seriesTracker = series.tracker, dataLabelsGroup = series.dataLabelsGroup, showOrHide, i, points = series.points, point, ignoreHiddenSeries = chart.options.chart.ignoreHiddenSeries, oldVisibility = series.visible; // if called without an argument, toggle visibility series.visible = vis = vis === UNDEFINED ? !oldVisibility : vis; showOrHide = vis ? 'show' : 'hide'; // show or hide series if (seriesGroup) { // pies don't have one seriesGroup[showOrHide](); } // show or hide trackers if (seriesTracker) { seriesTracker[showOrHide](); } else if (points) { i = points.length; while (i--) { point = points[i]; if (point.tracker) { point.tracker[showOrHide](); } } } if (dataLabelsGroup) { dataLabelsGroup[showOrHide](); } if (legendItem) { chart.legend.colorizeItem(series, vis); } // rescale or adapt to resized chart series.isDirty = true; // in a stack, all other series are affected if (series.options.stacking) { each(chart.series, function (otherSeries) { if (otherSeries.options.stacking && otherSeries.visible) { otherSeries.isDirty = true; } }); } if (ignoreHiddenSeries) { chart.isDirtyBox = true; } if (redraw !== false) { chart.redraw(); } fireEvent(series, showOrHide); }, /** * Show the graph */ show: function () { this.setVisible(true); }, /** * Hide the graph */ hide: function () { this.setVisible(false); }, /** * Set the selected state of the graph * * @param selected {Boolean} True to select the series, false to unselect. If * UNDEFINED, the selection state is toggled. */ select: function (selected) { var series = this; // if called without an argument, toggle series.selected = selected = (selected === UNDEFINED) ? !series.selected : selected; if (series.checkbox) { series.checkbox.checked = selected; } fireEvent(series, selected ? 'select' : 'unselect'); }, /** * Draw the tracker object that sits above all data labels and markers to * track mouse events on the graph or points. For the line type charts * the tracker uses the same graphPath, but with a greater stroke width * for better control. */ drawTracker: function () { var series = this, options = series.options, trackerPath = [].concat(series.graphPath), trackerPathLength = trackerPath.length, chart = series.chart, renderer = chart.renderer, snap = chart.options.tooltip.snap, tracker = series.tracker, cursor = options.cursor, css = cursor && { cursor: cursor }, singlePoints = series.singlePoints, group, singlePoint, i; // Extend end points. A better way would be to use round linecaps, // but those are not clickable in VML. if (trackerPathLength) { i = trackerPathLength + 1; while (i--) { if (trackerPath[i] === M) { // extend left side trackerPath.splice(i + 1, 0, trackerPath[i + 1] - snap, trackerPath[i + 2], L); } if ((i && trackerPath[i] === M) || i === trackerPathLength) { // extend right side trackerPath.splice(i, 0, L, trackerPath[i - 2] + snap, trackerPath[i - 1]); } } } // handle single points for (i = 0; i < singlePoints.length; i++) { singlePoint = singlePoints[i]; trackerPath.push(M, singlePoint.plotX - snap, singlePoint.plotY, L, singlePoint.plotX + snap, singlePoint.plotY); } // draw the tracker if (tracker) { tracker.attr({ d: trackerPath }); } else { // create group = renderer.g() .clip(chart.clipRect) .add(chart.trackerGroup); series.tracker = renderer.path(trackerPath) .attr({ isTracker: true, stroke: TRACKER_FILL, fill: NONE, 'stroke-linejoin': 'bevel', 'stroke-width' : options.lineWidth + 2 * snap, visibility: series.visible ? VISIBLE : HIDDEN, zIndex: options.zIndex || 1 }) .on(hasTouch ? 'touchstart' : 'mouseover', function () { if (chart.hoverSeries !== series) { series.onMouseOver(); } }) .on('mouseout', function () { if (!options.stickyTracking) { series.onMouseOut(); } }) .css(css) .add(group); } } }; // end Series prototype /** * LineSeries object */ var LineSeries = extendClass(Series); seriesTypes.line = LineSeries; /** * AreaSeries object */ var AreaSeries = extendClass(Series, { type: 'area' }); seriesTypes.area = AreaSeries; /** * SplineSeries object */ var SplineSeries = extendClass(Series, { type: 'spline', /** * Draw the actual graph */ getPointSpline: function (segment, point, i) { var smoothing = 1.5, // 1 means control points midway between points, 2 means 1/3 from the point, 3 is 1/4 etc denom = smoothing + 1, plotX = point.plotX, plotY = point.plotY, lastPoint = segment[i - 1], nextPoint = segment[i + 1], leftContX, leftContY, rightContX, rightContY, ret; // find control points if (i && i < segment.length - 1) { var lastX = lastPoint.plotX, lastY = lastPoint.plotY, nextX = nextPoint.plotX, nextY = nextPoint.plotY, correction; leftContX = (smoothing * plotX + lastX) / denom; leftContY = (smoothing * plotY + lastY) / denom; rightContX = (smoothing * plotX + nextX) / denom; rightContY = (smoothing * plotY + nextY) / denom; // have the two control points make a straight line through main point correction = ((rightContY - leftContY) * (rightContX - plotX)) / (rightContX - leftContX) + plotY - rightContY; leftContY += correction; rightContY += correction; // to prevent false extremes, check that control points are between // neighbouring points' y values if (leftContY > lastY && leftContY > plotY) { leftContY = mathMax(lastY, plotY); rightContY = 2 * plotY - leftContY; // mirror of left control point } else if (leftContY < lastY && leftContY < plotY) { leftContY = mathMin(lastY, plotY); rightContY = 2 * plotY - leftContY; } if (rightContY > nextY && rightContY > plotY) { rightContY = mathMax(nextY, plotY); leftContY = 2 * plotY - rightContY; } else if (rightContY < nextY && rightContY < plotY) { rightContY = mathMin(nextY, plotY); leftContY = 2 * plotY - rightContY; } // record for drawing in next point point.rightContX = rightContX; point.rightContY = rightContY; } // moveTo or lineTo if (!i) { ret = [M, plotX, plotY]; } else { // curve from last point to this ret = [ 'C', lastPoint.rightContX || lastPoint.plotX, lastPoint.rightContY || lastPoint.plotY, leftContX || plotX, leftContY || plotY, plotX, plotY ]; lastPoint.rightContX = lastPoint.rightContY = null; // reset for updating series later } return ret; } }); seriesTypes.spline = SplineSeries; /** * AreaSplineSeries object */ var AreaSplineSeries = extendClass(SplineSeries, { type: 'areaspline' }); seriesTypes.areaspline = AreaSplineSeries; /** * ColumnSeries object */ var ColumnSeries = extendClass(Series, { type: 'column', tooltipOutsidePlot: true, pointAttrToOptions: { // mapping between SVG attributes and the corresponding options stroke: 'borderColor', 'stroke-width': 'borderWidth', fill: 'color', r: 'borderRadius' }, init: function () { Series.prototype.init.apply(this, arguments); var series = this, chart = series.chart; // if the series is added dynamically, force redraw of other // series affected by a new column if (chart.hasRendered) { each(chart.series, function (otherSeries) { if (otherSeries.type === series.type) { otherSeries.isDirty = true; } }); } }, /** * Translate each point to the plot area coordinate system and find shape positions */ translate: function () { var series = this, chart = series.chart, options = series.options, stacking = options.stacking, borderWidth = options.borderWidth, columnCount = 0, xAxis = series.xAxis, reversedXAxis = xAxis.reversed, stackGroups = {}, stackKey, columnIndex; Series.prototype.translate.apply(series); // Get the total number of column type series. // This is called on every series. Consider moving this logic to a // chart.orderStacks() function and call it on init, addSeries and removeSeries each(chart.series, function (otherSeries) { if (otherSeries.type === series.type && otherSeries.visible && series.options.group === otherSeries.options.group) { // used in Stock charts navigator series if (otherSeries.options.stacking) { stackKey = otherSeries.stackKey; if (stackGroups[stackKey] === UNDEFINED) { stackGroups[stackKey] = columnCount++; } columnIndex = stackGroups[stackKey]; } else { columnIndex = columnCount++; } otherSeries.columnIndex = columnIndex; } }); // calculate the width and position of each column based on // the number of column series in the plot, the groupPadding // and the pointPadding options var points = series.points, categoryWidth = mathAbs(xAxis.translationSlope) * (xAxis.ordinalSlope || xAxis.closestPointRange || 1), groupPadding = categoryWidth * options.groupPadding, groupWidth = categoryWidth - 2 * groupPadding, pointOffsetWidth = groupWidth / columnCount, optionPointWidth = options.pointWidth, pointPadding = defined(optionPointWidth) ? (pointOffsetWidth - optionPointWidth) / 2 : pointOffsetWidth * options.pointPadding, pointWidth = mathCeil(mathMax(pick(optionPointWidth, pointOffsetWidth - 2 * pointPadding), 1)), colIndex = (reversedXAxis ? columnCount - series.columnIndex : series.columnIndex) || 0, pointXOffset = pointPadding + (groupPadding + colIndex * pointOffsetWidth - (categoryWidth / 2)) * (reversedXAxis ? -1 : 1), threshold = options.threshold, translatedThreshold = series.yAxis.getThreshold(threshold), minPointLength = pick(options.minPointLength, 5); // record the new values each(points, function (point) { var plotY = point.plotY, yBottom = point.yBottom || translatedThreshold, barX = point.plotX + pointXOffset, barY = mathCeil(mathMin(plotY, yBottom)), barH = mathCeil(mathMax(plotY, yBottom) - barY), stack = series.yAxis.stacks[(point.y < 0 ? '-' : '') + series.stackKey], shapeArgs; // Record the offset'ed position and width of the bar to be able to align the stacking total correctly if (stacking && series.visible && stack && stack[point.x]) { stack[point.x].setOffset(pointXOffset, pointWidth); } // handle options.minPointLength if (mathAbs(barH) < minPointLength) { if (minPointLength) { barH = minPointLength; barY = mathAbs(barY - translatedThreshold) > minPointLength ? // stacked yBottom - minPointLength : // keep position translatedThreshold - (plotY <= translatedThreshold ? minPointLength : 0); } } extend(point, { barX: barX, barY: barY, barW: pointWidth, barH: barH }); // create shape type and shape args that are reused in drawPoints and drawTracker point.shapeType = 'rect'; shapeArgs = extend(chart.renderer.Element.prototype.crisp.apply({}, [ borderWidth, barX, barY, pointWidth, barH ]), { r: options.borderRadius }); if (borderWidth % 2) { // correct for shorting in crisp method, visible in stacked columns with 1px border shapeArgs.y -= 1; shapeArgs.height += 1; } point.shapeArgs = shapeArgs; // make small columns responsive to mouse point.trackerArgs = mathAbs(barH) < 3 && merge(point.shapeArgs, { height: 6, y: barY - 3 }); }); }, getSymbol: function () { }, /** * Columns have no graph */ drawGraph: function () {}, /** * Draw the columns. For bars, the series.group is rotated, so the same coordinates * apply for columns and bars. This method is inherited by scatter series. * */ drawPoints: function () { var series = this, options = series.options, renderer = series.chart.renderer, graphic, shapeArgs; // draw the columns each(series.points, function (point) { var plotY = point.plotY; if (plotY !== UNDEFINED && !isNaN(plotY) && point.y !== null) { graphic = point.graphic; shapeArgs = point.shapeArgs; if (graphic) { // update stop(graphic); graphic.animate(shapeArgs); } else { point.graphic = graphic = renderer[point.shapeType](shapeArgs) .attr(point.pointAttr[point.selected ? SELECT_STATE : NORMAL_STATE]) .add(series.group) .shadow(options.shadow); } } }); }, /** * Draw the individual tracker elements. * This method is inherited by scatter and pie charts too. */ drawTracker: function () { var series = this, chart = series.chart, renderer = chart.renderer, shapeArgs, tracker, trackerLabel = +new Date(), options = series.options, cursor = options.cursor, css = cursor && { cursor: cursor }, group, rel; // Add a series specific group to allow clipping the trackers if (series.isCartesian) { group = renderer.g() .clip(chart.clipRect) .add(chart.trackerGroup); } each(series.points, function (point) { tracker = point.tracker; shapeArgs = point.trackerArgs || point.shapeArgs; delete shapeArgs.strokeWidth; if (point.y !== null) { if (tracker) {// update tracker.attr(shapeArgs); } else { point.tracker = renderer[point.shapeType](shapeArgs) .attr({ isTracker: trackerLabel, fill: TRACKER_FILL, visibility: series.visible ? VISIBLE : HIDDEN, zIndex: options.zIndex || 1 }) .on(hasTouch ? 'touchstart' : 'mouseover', function (event) { rel = event.relatedTarget || event.fromElement; if (chart.hoverSeries !== series && attr(rel, 'isTracker') !== trackerLabel) { series.onMouseOver(); } point.onMouseOver(); }) .on('mouseout', function (event) { if (!options.stickyTracking) { rel = event.relatedTarget || event.toElement; if (attr(rel, 'isTracker') !== trackerLabel) { series.onMouseOut(); } } }) .css(css) .add(point.group || group); // pies have point group - see issue #118 } } }); }, /** * Animate the column heights one by one from zero * @param {Boolean} init Whether to initialize the animation or run it */ animate: function (init) { var series = this, points = series.points, options = series.options; if (!init) { // run the animation /* * Note: Ideally the animation should be initialized by calling * series.group.hide(), and then calling series.group.show() * after the animation was started. But this rendered the shadows * invisible in IE8 standards mode. If the columns flicker on large * datasets, this is the cause. */ each(points, function (point) { var graphic = point.graphic, shapeArgs = point.shapeArgs, yAxis = series.yAxis, threshold = options.threshold; if (graphic) { // start values graphic.attr({ height: 0, y: defined(threshold) ? yAxis.getThreshold(threshold) : yAxis.translate(yAxis.getExtremes().min, 0, 1, 0, 1) }); // animate graphic.animate({ height: shapeArgs.height, y: shapeArgs.y }, options.animation); } }); // delete this function to allow it only once series.animate = null; } }, /** * Remove this series from the chart */ remove: function () { var series = this, chart = series.chart; // column and bar series affects other series of the same type // as they are either stacked or grouped if (chart.hasRendered) { each(chart.series, function (otherSeries) { if (otherSeries.type === series.type) { otherSeries.isDirty = true; } }); } Series.prototype.remove.apply(series, arguments); } }); seriesTypes.column = ColumnSeries; var BarSeries = extendClass(ColumnSeries, { type: 'bar', init: function () { this.inverted = true; ColumnSeries.prototype.init.apply(this, arguments); } }); seriesTypes.bar = BarSeries; /** * The scatter series class */ var ScatterSeries = extendClass(Series, { type: 'scatter', /** * Extend the base Series' translate method by adding shape type and * arguments for the point trackers */ translate: function () { var series = this; Series.prototype.translate.apply(series); each(series.points, function (point) { point.shapeType = 'circle'; point.shapeArgs = { x: point.plotX, y: point.plotY, r: series.chart.options.tooltip.snap }; }); }, /** * Add tracking event listener to the series group, so the point graphics * themselves act as trackers */ drawTracker: function () { var series = this, cursor = series.options.cursor, css = cursor && { cursor: cursor }, points = series.points, i = points.length, graphic; // Set an expando property for the point index, used below while (i--) { graphic = points[i].graphic; if (graphic) { // doesn't exist for null points graphic.element._index = i; } } // Add the event listeners, we need to do this only once if (!series._hasTracking) { series.group .on(hasTouch ? 'touchstart' : 'mouseover', function (e) { series.onMouseOver(); points[e.target._index].onMouseOver(); }) .on('mouseout', function () { if (!series.options.stickyTracking) { series.onMouseOut(); } }) .css(css); } else { series._hasTracking = true; } } }); seriesTypes.scatter = ScatterSeries; /** * Extended point object for pies */ var PiePoint = extendClass(Point, { /** * Initiate the pie slice */ init: function () { Point.prototype.init.apply(this, arguments); var point = this, toggleSlice; //visible: options.visible !== false, extend(point, { visible: point.visible !== false, name: pick(point.name, 'Slice') }); // add event listener for select toggleSlice = function () { point.slice(); }; addEvent(point, 'select', toggleSlice); addEvent(point, 'unselect', toggleSlice); return point; }, /** * Toggle the visibility of the pie slice * @param {Boolean} vis Whether to show the slice or not. If undefined, the * visibility is toggled */ setVisible: function (vis) { var point = this, chart = point.series.chart, tracker = point.tracker, dataLabel = point.dataLabel, connector = point.connector, shadowGroup = point.shadowGroup, method; // if called without an argument, toggle visibility point.visible = vis = vis === UNDEFINED ? !point.visible : vis; method = vis ? 'show' : 'hide'; point.group[method](); if (tracker) { tracker[method](); } if (dataLabel) { dataLabel[method](); } if (connector) { connector[method](); } if (shadowGroup) { shadowGroup[method](); } if (point.legendItem) { chart.legend.colorizeItem(point, vis); } }, /** * Set or toggle whether the slice is cut out from the pie * @param {Boolean} sliced When undefined, the slice state is toggled * @param {Boolean} redraw Whether to redraw the chart. True by default. */ slice: function (sliced, redraw, animation) { var point = this, series = point.series, chart = series.chart, slicedTranslation = point.slicedTranslation, translation; setAnimation(animation, chart); // redraw is true by default redraw = pick(redraw, true); // if called without an argument, toggle sliced = point.sliced = defined(sliced) ? sliced : !point.sliced; translation = { translateX: (sliced ? slicedTranslation[0] : chart.plotLeft), translateY: (sliced ? slicedTranslation[1] : chart.plotTop) }; point.group.animate(translation); if (point.shadowGroup) { point.shadowGroup.animate(translation); } } }); /** * The Pie series class */ var PieSeries = extendClass(Series, { type: 'pie', isCartesian: false, pointClass: PiePoint, pointAttrToOptions: { // mapping between SVG attributes and the corresponding options stroke: 'borderColor', 'stroke-width': 'borderWidth', fill: 'color' }, /** * Pies have one color each point */ getColor: function () { // record first color for use in setData this.initialColor = this.chart.counters.color; }, /** * Animate the column heights one by one from zero */ animate: function () { var series = this, points = series.points; each(points, function (point) { var graphic = point.graphic, args = point.shapeArgs, up = -mathPI / 2; if (graphic) { // start values graphic.attr({ r: 0, start: up, end: up }); // animate graphic.animate({ r: args.r, start: args.start, end: args.end }, series.options.animation); } }); // delete this function to allow it only once series.animate = null; }, /** * Extend the basic setData method by running processData and generatePoints immediately, * in order to access the points from the legend. */ setData: function () { Series.prototype.setData.apply(this, arguments); this.processData(); this.generatePoints(); }, /** * Do translation for pie slices */ translate: function () { this.generatePoints(); var total = 0, series = this, cumulative = -0.25, // start at top precision = 1000, // issue #172 options = series.options, slicedOffset = options.slicedOffset, connectorOffset = slicedOffset + options.borderWidth, positions = options.center.concat([options.size, options.innerSize || 0]), chart = series.chart, plotWidth = chart.plotWidth, plotHeight = chart.plotHeight, start, end, angle, points = series.points, circ = 2 * mathPI, fraction, smallestSize = mathMin(plotWidth, plotHeight), isPercent, radiusX, // the x component of the radius vector for a given point radiusY, labelDistance = options.dataLabels.distance; // get positions - either an integer or a percentage string must be given positions = map(positions, function (length, i) { isPercent = /%$/.test(length); return isPercent ? // i == 0: centerX, relative to width // i == 1: centerY, relative to height // i == 2: size, relative to smallestSize // i == 4: innerSize, relative to smallestSize [plotWidth, plotHeight, smallestSize, smallestSize][i] * pInt(length) / 100 : length; }); // utility for getting the x value from a given y, used for anticollision logic in data labels series.getX = function (y, left) { angle = math.asin((y - positions[1]) / (positions[2] / 2 + labelDistance)); return positions[0] + (left ? -1 : 1) * (mathCos(angle) * (positions[2] / 2 + labelDistance)); }; // set center for later use series.center = positions; // get the total sum each(points, function (point) { total += point.y; }); each(points, function (point) { // set start and end angle fraction = total ? point.y / total : 0; start = mathRound(cumulative * circ * precision) / precision; cumulative += fraction; end = mathRound(cumulative * circ * precision) / precision; // set the shape point.shapeType = 'arc'; point.shapeArgs = { x: positions[0], y: positions[1], r: positions[2] / 2, innerR: positions[3] / 2, start: start, end: end }; // center for the sliced out slice angle = (end + start) / 2; point.slicedTranslation = map([ mathCos(angle) * slicedOffset + chart.plotLeft, mathSin(angle) * slicedOffset + chart.plotTop ], mathRound); // set the anchor point for tooltips radiusX = mathCos(angle) * positions[2] / 2; radiusY = mathSin(angle) * positions[2] / 2; point.tooltipPos = [ positions[0] + radiusX * 0.7, positions[1] + radiusY * 0.7 ]; // set the anchor point for data labels point.labelPos = [ positions[0] + radiusX + mathCos(angle) * labelDistance, // first break of connector positions[1] + radiusY + mathSin(angle) * labelDistance, // a/a positions[0] + radiusX + mathCos(angle) * connectorOffset, // second break, right outside pie positions[1] + radiusY + mathSin(angle) * connectorOffset, // a/a positions[0] + radiusX, // landing point for connector positions[1] + radiusY, // a/a labelDistance < 0 ? // alignment 'center' : angle < circ / 4 ? 'left' : 'right', // alignment angle // center angle ]; // API properties point.percentage = fraction * 100; point.total = total; }); this.setTooltipPoints(); }, /** * Render the slices */ render: function () { var series = this; // cache attributes for shapes series.getAttribs(); this.drawPoints(); // draw the mouse tracking area if (series.options.enableMouseTracking !== false) { series.drawTracker(); } this.drawDataLabels(); if (series.options.animation && series.animate) { series.animate(); } // (See #322) series.isDirty = series.isDirtyData = false; // means data is in accordance with what you see series.isDirty = false; // means data is in accordance with what you see }, /** * Draw the data points */ drawPoints: function () { var series = this, chart = series.chart, renderer = chart.renderer, groupTranslation, //center, graphic, group, shadow = series.options.shadow, shadowGroup, shapeArgs; // draw the slices each(series.points, function (point) { graphic = point.graphic; shapeArgs = point.shapeArgs; group = point.group; shadowGroup = point.shadowGroup; // put the shadow behind all points if (shadow && !shadowGroup) { shadowGroup = point.shadowGroup = renderer.g('shadow') .attr({ zIndex: 4 }) .add(); } // create the group the first time if (!group) { group = point.group = renderer.g('point') .attr({ zIndex: 5 }) .add(); } // if the point is sliced, use special translation, else use plot area traslation groupTranslation = point.sliced ? point.slicedTranslation : [chart.plotLeft, chart.plotTop]; group.translate(groupTranslation[0], groupTranslation[1]); if (shadowGroup) { shadowGroup.translate(groupTranslation[0], groupTranslation[1]); } // draw the slice if (graphic) { graphic.animate(shapeArgs); } else { point.graphic = renderer.arc(shapeArgs) .attr(extend( point.pointAttr[NORMAL_STATE], { 'stroke-linejoin': 'round' } )) .add(point.group) .shadow(shadow, shadowGroup); } // detect point specific visibility if (point.visible === false) { point.setVisible(false); } }); }, /** * Override the base drawDataLabels method by pie specific functionality */ drawDataLabels: function () { var series = this, data = series.data, point, chart = series.chart, options = series.options.dataLabels, connectorPadding = pick(options.connectorPadding, 10), connectorWidth = pick(options.connectorWidth, 1), connector, connectorPath, softConnector = pick(options.softConnector, true), distanceOption = options.distance, seriesCenter = series.center, radius = seriesCenter[2] / 2, centerY = seriesCenter[1], outside = distanceOption > 0, dataLabel, labelPos, labelHeight, halves = [// divide the points into right and left halves for anti collision [], // right [] // left ], x, y, visibility, rankArr, sort, i = 2, j; // get out if not enabled if (!options.enabled) { return; } // run parent method Series.prototype.drawDataLabels.apply(series); // arrange points for detection collision each(data, function (point) { if (point.dataLabel) { // it may have been cancelled in the base method (#407) halves[ point.labelPos[7] < mathPI / 2 ? 0 : 1 ].push(point); } }); halves[1].reverse(); // define the sorting algorithm sort = function (a, b) { return b.y - a.y; }; // assume equal label heights labelHeight = halves[0][0] && halves[0][0].dataLabel && pInt(halves[0][0].dataLabel.styles.lineHeight); /* Loop over the points in each quartile, starting from the top and bottom * of the pie to detect overlapping labels. */ while (i--) { var slots = [], slotsLength, usedSlots = [], points = halves[i], pos, length = points.length, slotIndex; // build the slots for (pos = centerY - radius - distanceOption; pos <= centerY + radius + distanceOption; pos += labelHeight) { slots.push(pos); // visualize the slot /* var slotX = series.getX(pos, i) + chart.plotLeft - (i ? 100 : 0), slotY = pos + chart.plotTop; if (!isNaN(slotX)) { chart.renderer.rect(slotX, slotY - 7, 100, labelHeight) .attr({ 'stroke-width': 1, stroke: 'silver' }) .add(); chart.renderer.text('Slot '+ (slots.length - 1), slotX, slotY + 4) .attr({ fill: 'silver' }).add(); } // */ } slotsLength = slots.length; // if there are more values than available slots, remove lowest values if (length > slotsLength) { // create an array for sorting and ranking the points within each quarter rankArr = [].concat(points); rankArr.sort(sort); j = length; while (j--) { rankArr[j].rank = j; } j = length; while (j--) { if (points[j].rank >= slotsLength) { points.splice(j, 1); } } length = points.length; } // The label goes to the nearest open slot, but not closer to the edge than // the label's index. for (j = 0; j < length; j++) { point = points[j]; labelPos = point.labelPos; var closest = 9999, distance, slotI; // find the closest slot index for (slotI = 0; slotI < slotsLength; slotI++) { distance = mathAbs(slots[slotI] - labelPos[1]); if (distance < closest) { closest = distance; slotIndex = slotI; } } // if that slot index is closer to the edges of the slots, move it // to the closest appropriate slot if (slotIndex < j && slots[j] !== null) { // cluster at the top slotIndex = j; } else if (slotsLength < length - j + slotIndex && slots[j] !== null) { // cluster at the bottom slotIndex = slotsLength - length + j; while (slots[slotIndex] === null) { // make sure it is not taken slotIndex++; } } else { // Slot is taken, find next free slot below. In the next run, the next slice will find the // slot above these, because it is the closest one while (slots[slotIndex] === null) { // make sure it is not taken slotIndex++; } } usedSlots.push({ i: slotIndex, y: slots[slotIndex] }); slots[slotIndex] = null; // mark as taken } // sort them in order to fill in from the top usedSlots.sort(sort); // now the used slots are sorted, fill them up sequentially for (j = 0; j < length; j++) { point = points[j]; labelPos = point.labelPos; dataLabel = point.dataLabel; var slot = usedSlots.pop(), naturalY = labelPos[1]; visibility = point.visible === false ? HIDDEN : VISIBLE; slotIndex = slot.i; // if the slot next to currrent slot is free, the y value is allowed // to fall back to the natural position y = slot.y; if ((naturalY > y && slots[slotIndex + 1] !== null) || (naturalY < y && slots[slotIndex - 1] !== null)) { y = naturalY; } // get the x - use the natural x position for first and last slot, to prevent the top // and botton slice connectors from touching each other on either side x = series.getX(slotIndex === 0 || slotIndex === slots.length - 1 ? naturalY : y, i); // move or place the data label dataLabel .attr({ visibility: visibility, align: labelPos[6] })[dataLabel.moved ? 'animate' : 'attr']({ x: x + options.x + ({ left: connectorPadding, right: -connectorPadding }[labelPos[6]] || 0), y: y + options.y }); dataLabel.moved = true; // draw the connector if (outside && connectorWidth) { connector = point.connector; connectorPath = softConnector ? [ M, x + (labelPos[6] === 'left' ? 5 : -5), y, // end of the string at the label 'C', x, y, // first break, next to the label 2 * labelPos[2] - labelPos[4], 2 * labelPos[3] - labelPos[5], labelPos[2], labelPos[3], // second break L, labelPos[4], labelPos[5] // base ] : [ M, x + (labelPos[6] === 'left' ? 5 : -5), y, // end of the string at the label L, labelPos[2], labelPos[3], // second break L, labelPos[4], labelPos[5] // base ]; if (connector) { connector.animate({ d: connectorPath }); connector.attr('visibility', visibility); } else { point.connector = connector = series.chart.renderer.path(connectorPath).attr({ 'stroke-width': connectorWidth, stroke: options.connectorColor || point.color || '#606060', visibility: visibility, zIndex: 3 }) .translate(chart.plotLeft, chart.plotTop) .add(); } } } } }, /** * Draw point specific tracker objects. Inherit directly from column series. */ drawTracker: ColumnSeries.prototype.drawTracker, /** * Pies don't have point marker symbols */ getSymbol: function () {} }); seriesTypes.pie = PieSeries; // global variables extend(Highcharts, { Chart: Chart, dateFormat: dateFormat, pathAnim: pathAnim, getOptions: getOptions, hasBidiBug: hasBidiBug, numberFormat: numberFormat, Point: Point, Color: Color, Renderer: Renderer, SVGRenderer: SVGRenderer, VMLRenderer: VMLRenderer, CanVGRenderer: CanVGRenderer, seriesTypes: seriesTypes, setOptions: setOptions, Series: Series, // Expose utility funcitons for modules addEvent: addEvent, removeEvent: removeEvent, createElement: createElement, discardElement: discardElement, css: css, each: each, extend: extend, map: map, merge: merge, pick: pick, splat: splat, extendClass: extendClass, placeBox: placeBox, product: 'Highcharts', version: '2.2.0' }); }()); /** * @license Highcharts JS v2.2.0 (2012-02-16) * Exporting module * * (c) 2010-2011 Torstein Hønsi * * License: www.highcharts.com/license */ // JSLint options: /*global Highcharts, document, window, Math, setTimeout */ (function () { // encapsulate // create shortcuts var HC = Highcharts, Chart = HC.Chart, addEvent = HC.addEvent, removeEvent = HC.removeEvent, createElement = HC.createElement, discardElement = HC.discardElement, css = HC.css, merge = HC.merge, each = HC.each, extend = HC.extend, math = Math, mathMax = math.max, doc = document, win = window, hasTouch = doc.documentElement.ontouchstart !== undefined, M = 'M', L = 'L', DIV = 'div', HIDDEN = 'hidden', NONE = 'none', PREFIX = 'highcharts-', ABSOLUTE = 'absolute', PX = 'px', UNDEFINED, defaultOptions = HC.getOptions(); // Add language extend(defaultOptions.lang, { downloadPNG: 'Download PNG image', downloadJPEG: 'Download JPEG image', downloadPDF: 'Download PDF document', downloadSVG: 'Download SVG vector image', exportButtonTitle: 'Export to raster or vector image', printButtonTitle: 'Print the chart' }); // Buttons and menus are collected in a separate config option set called 'navigation'. // This can be extended later to add control buttons like zoom and pan right click menus. defaultOptions.navigation = { menuStyle: { border: '1px solid #A0A0A0', background: '#FFFFFF' }, menuItemStyle: { padding: '0 5px', background: NONE, color: '#303030', fontSize: hasTouch ? '14px' : '11px' }, menuItemHoverStyle: { background: '#4572A5', color: '#FFFFFF' }, buttonOptions: { align: 'right', backgroundColor: { linearGradient: [0, 0, 0, 20], stops: [ [0.4, '#F7F7F7'], [0.6, '#E3E3E3'] ] }, borderColor: '#B0B0B0', borderRadius: 3, borderWidth: 1, //enabled: true, height: 20, hoverBorderColor: '#909090', hoverSymbolFill: '#81A7CF', hoverSymbolStroke: '#4572A5', symbolFill: '#E0E0E0', //symbolSize: 12, symbolStroke: '#A0A0A0', //symbolStrokeWidth: 1, symbolX: 11.5, symbolY: 10.5, verticalAlign: 'top', width: 24, y: 10 } }; // Add the export related options defaultOptions.exporting = { //enabled: true, //filename: 'chart', type: 'image/png', url: 'http://export.highcharts.com/', width: 800, buttons: { exportButton: { //enabled: true, symbol: 'exportIcon', x: -10, symbolFill: '#A8BF77', hoverSymbolFill: '#768F3E', _id: 'exportButton', _titleKey: 'exportButtonTitle', menuItems: [{ textKey: 'downloadPNG', onclick: function () { this.exportChart(); } }, { textKey: 'downloadJPEG', onclick: function () { this.exportChart({ type: 'image/jpeg' }); } }, { textKey: 'downloadPDF', onclick: function () { this.exportChart({ type: 'application/pdf' }); } }, { textKey: 'downloadSVG', onclick: function () { this.exportChart({ type: 'image/svg+xml' }); } } // Enable this block to add "View SVG" to the dropdown menu /* ,{ text: 'View SVG', onclick: function () { var svg = this.getSVG() .replace(/</g, '\n&lt;') .replace(/>/g, '&gt;'); doc.body.innerHTML = '<pre>' + svg + '</pre>'; } } // */ ] }, printButton: { //enabled: true, symbol: 'printIcon', x: -36, symbolFill: '#B5C9DF', hoverSymbolFill: '#779ABF', _id: 'printButton', _titleKey: 'printButtonTitle', onclick: function () { this.print(); } } } }; extend(Chart.prototype, { /** * Return an SVG representation of the chart * * @param additionalOptions {Object} Additional chart options for the generated SVG representation */ getSVG: function (additionalOptions) { var chart = this, chartCopy, sandbox, svg, seriesOptions, options = merge(chart.options, additionalOptions); // copy the options and add extra options // IE compatibility hack for generating SVG content that it doesn't really understand if (!doc.createElementNS) { /*jslint unparam: true*//* allow unused parameter ns in function below */ doc.createElementNS = function (ns, tagName) { var elem = doc.createElement(tagName); elem.getBBox = function () { return HC.Renderer.prototype.Element.prototype.getBBox.apply({ element: elem }); }; return elem; }; /*jslint unparam: false*/ } // create a sandbox where a new chart will be generated sandbox = createElement(DIV, null, { position: ABSOLUTE, top: '-9999em', width: chart.chartWidth + PX, height: chart.chartHeight + PX }, doc.body); // override some options extend(options.chart, { renderTo: sandbox, forExport: true }); options.exporting.enabled = false; // hide buttons in print options.chart.plotBackgroundImage = null; // the converter doesn't handle images // prepare for replicating the chart options.series = []; each(chart.series, function (serie) { seriesOptions = merge(serie.options, { animation: false, // turn off animation showCheckbox: false, visible: serie.visible }); if (!seriesOptions.isInternal) { // used for the navigator series that has its own option set // remove image markers if (seriesOptions && seriesOptions.marker && /^url\(/.test(seriesOptions.marker.symbol)) { seriesOptions.marker.symbol = 'circle'; } options.series.push(seriesOptions); } }); // generate the chart copy chartCopy = new Highcharts.Chart(options); // reflect axis extremes in the export each(['xAxis', 'yAxis'], function (axisType) { each(chart[axisType], function (axis, i) { var axisCopy = chartCopy[axisType][i], extremes = axis.getExtremes(), userMin = extremes.userMin, userMax = extremes.userMax; if (userMin !== UNDEFINED || userMax !== UNDEFINED) { axisCopy.setExtremes(userMin, userMax, true, false); } }); }); // get the SVG from the container's innerHTML svg = chartCopy.container.innerHTML; // free up memory options = null; chartCopy.destroy(); discardElement(sandbox); // sanitize svg = svg .replace(/zIndex="[^"]+"/g, '') .replace(/isShadow="[^"]+"/g, '') .replace(/symbolName="[^"]+"/g, '') .replace(/jQuery[0-9]+="[^"]+"/g, '') .replace(/isTracker="[^"]+"/g, '') .replace(/url\([^#]+#/g, 'url(#') /*.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ') .replace(/ href=/, ' xlink:href=') .replace(/preserveAspectRatio="none">/g, 'preserveAspectRatio="none"/>')*/ /* This fails in IE < 8 .replace(/([0-9]+)\.([0-9]+)/g, function(s1, s2, s3) { // round off to save weight return s2 +'.'+ s3[0]; })*/ // Replace HTML entities, issue #347 .replace(/&nbsp;/g, '\u00A0') // no-break space .replace(/&shy;/g, '\u00AD') // soft hyphen // IE specific .replace(/id=([^" >]+)/g, 'id="$1"') .replace(/class=([^" ]+)/g, 'class="$1"') .replace(/ transform /g, ' ') .replace(/:(path|rect)/g, '$1') .replace(/style="([^"]+)"/g, function (s) { return s.toLowerCase(); }); // IE9 beta bugs with innerHTML. Test again with final IE9. svg = svg.replace(/(url\(#highcharts-[0-9]+)&quot;/g, '$1') .replace(/&quot;/g, "'"); if (svg.match(/ xmlns="/g).length === 2) { svg = svg.replace(/xmlns="[^"]+"/, ''); } return svg; }, /** * Submit the SVG representation of the chart to the server * @param {Object} options Exporting options. Possible members are url, type and width. * @param {Object} chartOptions Additional chart options for the SVG representation of the chart */ exportChart: function (options, chartOptions) { var form, chart = this, svg = chart.getSVG(merge(chart.options.exporting.chartOptions, chartOptions)); // docs // merge the options options = merge(chart.options.exporting, options); // create the form form = createElement('form', { method: 'post', action: options.url }, { display: NONE }, doc.body); // add the values each(['filename', 'type', 'width', 'svg'], function (name) { createElement('input', { type: HIDDEN, name: name, value: { filename: options.filename || 'chart', type: options.type, width: options.width, svg: svg }[name] }, null, form); }); // submit form.submit(); // clean up discardElement(form); }, /** * Print the chart */ print: function () { var chart = this, container = chart.container, origDisplay = [], origParent = container.parentNode, body = doc.body, childNodes = body.childNodes; if (chart.isPrinting) { // block the button while in printing mode return; } chart.isPrinting = true; // hide all body content each(childNodes, function (node, i) { if (node.nodeType === 1) { origDisplay[i] = node.style.display; node.style.display = NONE; } }); // pull out the chart body.appendChild(container); // print win.print(); // allow the browser to prepare before reverting setTimeout(function () { // put the chart back in origParent.appendChild(container); // restore all body content each(childNodes, function (node, i) { if (node.nodeType === 1) { node.style.display = origDisplay[i]; } }); chart.isPrinting = false; }, 1000); }, /** * Display a popup menu for choosing the export type * * @param {String} name An identifier for the menu * @param {Array} items A collection with text and onclicks for the items * @param {Number} x The x position of the opener button * @param {Number} y The y position of the opener button * @param {Number} width The width of the opener button * @param {Number} height The height of the opener button */ contextMenu: function (name, items, x, y, width, height) { var chart = this, navOptions = chart.options.navigation, menuItemStyle = navOptions.menuItemStyle, chartWidth = chart.chartWidth, chartHeight = chart.chartHeight, cacheName = 'cache-' + name, menu = chart[cacheName], menuPadding = mathMax(width, height), // for mouse leave detection boxShadow = '3px 3px 10px #888', innerMenu, hide, menuStyle; // create the menu only the first time if (!menu) { // create a HTML element above the SVG chart[cacheName] = menu = createElement(DIV, { className: PREFIX + name }, { position: ABSOLUTE, zIndex: 1000, padding: menuPadding + PX }, chart.container); innerMenu = createElement(DIV, null, extend({ MozBoxShadow: boxShadow, WebkitBoxShadow: boxShadow, boxShadow: boxShadow }, navOptions.menuStyle), menu); // hide on mouse out hide = function () { css(menu, { display: NONE }); }; addEvent(menu, 'mouseleave', hide); // create the items each(items, function (item) { if (item) { var div = createElement(DIV, { onmouseover: function () { css(this, navOptions.menuItemHoverStyle); }, onmouseout: function () { css(this, menuItemStyle); }, innerHTML: item.text || chart.options.lang[item.textKey] }, extend({ cursor: 'pointer' }, menuItemStyle), innerMenu); div[hasTouch ? 'ontouchstart' : 'onclick'] = function () { hide(); item.onclick.apply(chart, arguments); }; // Keep references to menu divs to be able to destroy them chart.exportDivElements.push(div); } }); // Keep references to menu and innerMenu div to be able to destroy them chart.exportDivElements.push(innerMenu, menu); chart.exportMenuWidth = menu.offsetWidth; chart.exportMenuHeight = menu.offsetHeight; } menuStyle = { display: 'block' }; // if outside right, right align it if (x + chart.exportMenuWidth > chartWidth) { menuStyle.right = (chartWidth - x - width - menuPadding) + PX; } else { menuStyle.left = (x - menuPadding) + PX; } // if outside bottom, bottom align it if (y + height + chart.exportMenuHeight > chartHeight) { menuStyle.bottom = (chartHeight - y - menuPadding) + PX; } else { menuStyle.top = (y + height - menuPadding) + PX; } css(menu, menuStyle); }, /** * Add the export button to the chart */ addButton: function (options) { var chart = this, renderer = chart.renderer, btnOptions = merge(chart.options.navigation.buttonOptions, options), onclick = btnOptions.onclick, menuItems = btnOptions.menuItems, buttonWidth = btnOptions.width, buttonHeight = btnOptions.height, box, symbol, button, borderWidth = btnOptions.borderWidth, boxAttr = { stroke: btnOptions.borderColor }, symbolAttr = { stroke: btnOptions.symbolStroke, fill: btnOptions.symbolFill }, symbolSize = btnOptions.symbolSize || 12; // Keeps references to the button elements if (!chart.exportDivElements) { chart.exportDivElements = []; chart.exportSVGElements = []; } if (btnOptions.enabled === false) { return; } // element to capture the click function revert() { symbol.attr(symbolAttr); box.attr(boxAttr); } // the box border box = renderer.rect( 0, 0, buttonWidth, buttonHeight, btnOptions.borderRadius, borderWidth ) //.translate(buttonLeft, buttonTop) // to allow gradients .align(btnOptions, true) .attr(extend({ fill: btnOptions.backgroundColor, 'stroke-width': borderWidth, zIndex: 19 }, boxAttr)).add(); // the invisible element to track the clicks button = renderer.rect( 0, 0, buttonWidth, buttonHeight, 0 ) .align(btnOptions) .attr({ id: btnOptions._id, fill: 'rgba(255, 255, 255, 0.001)', title: chart.options.lang[btnOptions._titleKey], zIndex: 21 }).css({ cursor: 'pointer' }) .on('mouseover', function () { symbol.attr({ stroke: btnOptions.hoverSymbolStroke, fill: btnOptions.hoverSymbolFill }); box.attr({ stroke: btnOptions.hoverBorderColor }); }) .on('mouseout', revert) .on('click', revert) .add(); // add the click event if (menuItems) { onclick = function () { revert(); var bBox = button.getBBox(); chart.contextMenu('export-menu', menuItems, bBox.x, bBox.y, buttonWidth, buttonHeight); }; } /*addEvent(button.element, 'click', function() { onclick.apply(chart, arguments); });*/ button.on('click', function () { onclick.apply(chart, arguments); }); // the icon symbol = renderer.symbol( btnOptions.symbol, btnOptions.symbolX - (symbolSize / 2), btnOptions.symbolY - (symbolSize / 2), symbolSize, symbolSize ) .align(btnOptions, true) .attr(extend(symbolAttr, { 'stroke-width': btnOptions.symbolStrokeWidth || 1, zIndex: 20 })).add(); // Keep references to the renderer element so to be able to destroy them later. chart.exportSVGElements.push(box, button, symbol); }, /** * Destroy the buttons. */ destroyExport: function () { var i, chart = this, elem; // Destroy the extra buttons added for (i = 0; i < chart.exportSVGElements.length; i++) { elem = chart.exportSVGElements[i]; // Destroy and null the svg/vml elements elem.onclick = elem.ontouchstart = null; chart.exportSVGElements[i] = elem.destroy(); } // Destroy the divs for the menu for (i = 0; i < chart.exportDivElements.length; i++) { elem = chart.exportDivElements[i]; // Remove the event handler removeEvent(elem, 'mouseleave'); // Remove inline events chart.exportDivElements[i] = elem.onmouseout = elem.onmouseover = elem.ontouchstart = elem.onclick = null; // Destroy the div by moving to garbage bin discardElement(elem); } } }); /** * Crisp for 1px stroke width, which is default. In the future, consider a smarter, * global function. */ function crisp(arr) { var i = arr.length; while (i--) { if (typeof arr[i] === 'number') { arr[i] = Math.round(arr[i]) - 0.5; } } return arr; } // Create the export icon HC.Renderer.prototype.symbols.exportIcon = function (x, y, width, height) { return crisp([ M, // the disk x, y + width, L, x + width, y + height, x + width, y + height * 0.8, x, y + height * 0.8, 'Z', M, // the arrow x + width * 0.5, y + height * 0.8, L, x + width * 0.8, y + height * 0.4, x + width * 0.4, y + height * 0.4, x + width * 0.4, y, x + width * 0.6, y, x + width * 0.6, y + height * 0.4, x + width * 0.2, y + height * 0.4, 'Z' ]); }; // Create the print icon HC.Renderer.prototype.symbols.printIcon = function (x, y, width, height) { return crisp([ M, // the printer x, y + height * 0.7, L, x + width, y + height * 0.7, x + width, y + height * 0.4, x, y + height * 0.4, 'Z', M, // the upper sheet x + width * 0.2, y + height * 0.4, L, x + width * 0.2, y, x + width * 0.8, y, x + width * 0.8, y + height * 0.4, 'Z', M, // the lower sheet x + width * 0.2, y + height * 0.7, L, x, y + height, x + width, y + height, x + width * 0.8, y + height * 0.7, 'Z' ]); }; // Add the buttons on chart load Chart.prototype.callbacks.push(function (chart) { var n, exportingOptions = chart.options.exporting, buttons = exportingOptions.buttons; if (exportingOptions.enabled !== false) { for (n in buttons) { chart.addButton(buttons[n]); } // Destroy the export elements at chart destroy addEvent(chart, 'destroy', chart.destroyExport); } }); }());
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/src-chart/jquery.jqChart.js
JavaScript
gpl2
353,985
/* * jqModal - Minimalist Modaling with jQuery * (http://dev.iceburg.net/jquery/jqmodal/) * * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net> * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * $Version: 07/06/2008 +r13 */ (function($) { $.fn.jqm=function(o){ var p={ overlay: 50, closeoverlay : true, overlayClass: 'jqmOverlay', closeClass: 'jqmClose', trigger: '.jqModal', ajax: F, ajaxText: '', target: F, modal: F, toTop: F, onShow: F, onHide: F, onLoad: F }; return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s; H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s}; if(p.trigger)$(this).jqmAddTrigger(p.trigger); });}; $.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');}; $.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');}; $.fn.jqmShow=function(t){return this.each(function(){$.jqm.open(this._jqm,t);});}; $.fn.jqmHide=function(t){return this.each(function(){$.jqm.close(this._jqm,t)});}; $.jqm = { hash:{}, open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index')));z=(z>0)?z:3000;var o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z); if(c.modal) {if(!A[0])setTimeout(function(){L('bind');},1);A.push(s);} else if(c.overlay > 0) {if(c.closeoverlay) h.w.jqmAddClose(o);} else o=F; h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F; if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}} if(c.ajax) {var r=c.target||h.w,u=c.ajax;r=(typeof r == 'string')?$(r,h.w):$(r);u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});} else if(cc)h.w.jqmAddClose($(cc,h.w)); if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o); (c.onShow)?c.onShow(h):h.w.show();e(h);return F; }, close:function(s){var h=H[s];if(!h.a)return F;h.a=F; if(A[0]){A.pop();if(!A[0])L('unbind');} if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove(); if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F; }, params:{}}; var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false, e=function(h){var i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);}, f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}}, L=function(t){$(document)[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;}, hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() { if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});}; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/jqModal.js
JavaScript
gpl2
3,404
/* * jqDnR - Minimalistic Drag'n'Resize for jQuery. * * Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php * * $Version: 2007.08.19 +r2 */ (function($){ $.fn.jqDrag=function(h){return i(this,h,'d');}; $.fn.jqResize=function(h,ar){return i(this,h,'r',ar);}; $.jqDnR={ dnr:{}, e:0, drag:function(v){ if(M.k == 'd')E.css({left:M.X+v.pageX-M.pX,top:M.Y+v.pageY-M.pY}); else { E.css({width:Math.max(v.pageX-M.pX+M.W,0),height:Math.max(v.pageY-M.pY+M.H,0)}); if(M1){E1.css({width:Math.max(v.pageX-M1.pX+M1.W,0),height:Math.max(v.pageY-M1.pY+M1.H,0)});} } return false; }, stop:function(){ //E.css('opacity',M.o); $(document).unbind('mousemove',J.drag).unbind('mouseup',J.stop); } }; var J=$.jqDnR,M=J.dnr,E=J.e,E1, i=function(e,h,k,aR){ return e.each(function(){ h=(h)?$(h,e):e; h.bind('mousedown',{e:e,k:k},function(v){ var d=v.data,p={};E=d.e;E1 = aR ? $(aR) : false; // attempt utilization of dimensions plugin to fix IE issues if(E.css('position') != 'relative'){try{E.position(p);}catch(e){}} M={ X:p.left||f('left')||0, Y:p.top||f('top')||0, W:f('width')||E[0].scrollWidth||0, H:f('height')||E[0].scrollHeight||0, pX:v.pageX, pY:v.pageY, k:d.k //o:E.css('opacity') }; // also resize if(E1 && d.k != 'd'){ M1={ X:p.left||f1('left')||0, Y:p.top||f1('top')||0, W:E1[0].offsetWidth||f1('width')||0, H:E1[0].offsetHeight||f1('height')||0, pX:v.pageX, pY:v.pageY, k:d.k }; } else {M1 = false;} //E.css({opacity:0.8}); try {$("input.hasDatepicker",E[0]).datepicker('hide');}catch (dpe){} $(document).mousemove($.jqDnR.drag).mouseup($.jqDnR.stop); return false; }); }); }, f=function(k){return parseInt(E.css(k))||false;}; f1=function(k){ return parseInt(E1.css(k))||false;}; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/jqDnR.js
JavaScript
gpl2
1,971
;(function($){ /* * jqGrid common function * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html */ /*global jQuery, $ */ $.extend($.jgrid,{ // Modal functions showModal : function(h) { h.w.show(); }, closeModal : function(h) { h.w.hide().attr("aria-hidden","true"); if(h.o) {h.o.remove();} }, hideModal : function (selector,o) { o = $.extend({jqm : true, gb :''}, o || {}); if(o.onClose) { var oncret = o.onClose(selector); if (typeof oncret == 'boolean' && !oncret ) { return; } } if ($.fn.jqm && o.jqm === true) { $(selector).attr("aria-hidden","true").jqmHide(); } else { if(o.gb !== '') { try {$(".jqgrid-overlay:first",o.gb).hide();} catch (e){} } $(selector).hide().attr("aria-hidden","true"); } }, //Helper functions findPos : function(obj) { var curleft = 0, curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); //do not change obj == obj.offsetParent } return [curleft,curtop]; }, createModal : function(aIDs, content, p, insertSelector, posSelector, appendsel, css) { var mw = document.createElement('div'), rtlsup, self = this; css = $.extend({}, css || {}); rtlsup = $(p.gbox).attr("dir") == "rtl" ? true : false; mw.className= "ui-widget ui-widget-content ui-corner-all ui-jqdialog"; mw.id = aIDs.themodal; var mh = document.createElement('div'); mh.className = "ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"; mh.id = aIDs.modalhead; $(mh).append("<span class='ui-jqdialog-title'>"+p.caption+"</span>"); var ahr= $("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>") .hover(function(){ahr.addClass('ui-state-hover');}, function(){ahr.removeClass('ui-state-hover');}) .append("<span class='ui-icon ui-icon-closethick'></span>"); $(mh).append(ahr); if(rtlsup) { mw.dir = "rtl"; $(".ui-jqdialog-title",mh).css("float","right"); $(".ui-jqdialog-titlebar-close",mh).css("left",0.3+"em"); } else { mw.dir = "ltr"; $(".ui-jqdialog-title",mh).css("float","left"); $(".ui-jqdialog-titlebar-close",mh).css("right",0.3+"em"); } var mc = document.createElement('div'); $(mc).addClass("ui-jqdialog-content ui-widget-content").attr("id",aIDs.modalcontent); $(mc).append(content); mw.appendChild(mc); $(mw).prepend(mh); if(appendsel===true) { $('body').append(mw); } //append as first child in body -for alert dialog else if (typeof appendsel == "string") $(appendsel).append(mw); else {$(mw).insertBefore(insertSelector);} $(mw).css(css); if(typeof p.jqModal === 'undefined') {p.jqModal = true;} // internal use var coord = {}; if ( $.fn.jqm && p.jqModal === true) { if(p.left ===0 && p.top===0 && p.overlay) { var pos = []; pos = this.findPos(posSelector); p.left = pos[0] + 4; p.top = pos[1] + 4; } coord.top = p.top+"px"; coord.left = p.left; } else if(p.left !==0 || p.top!==0) { coord.left = p.left; coord.top = p.top+"px"; } $("a.ui-jqdialog-titlebar-close",mh).click(function(e){ var oncm = $("#"+aIDs.themodal).data("onClose") || p.onClose; var gboxclose = $("#"+aIDs.themodal).data("gbox") || p.gbox; self.hideModal("#"+aIDs.themodal,{gb:gboxclose,jqm:p.jqModal,onClose:oncm}); return false; }); if (p.width === 0 || !p.width) {p.width = 300;} if(p.height === 0 || !p.height) {p.height =200;} if(!p.zIndex) { var parentZ = $(insertSelector).parents("*[role=dialog]").filter(':first').css("z-index"); if(parentZ) { p.zIndex = parseInt(parentZ,10)+1; } else { p.zIndex = 950; } } var rtlt = 0; if( rtlsup && coord.left && !appendsel) { rtlt = $(p.gbox).width()- (!isNaN(p.width) ? parseInt(p.width,10) :0) - 8; // to do // just in case coord.left = parseInt(coord.left,10) + parseInt(rtlt,10); } if(coord.left) { coord.left += "px"; } $(mw).css($.extend({ width: isNaN(p.width) ? "auto": p.width+"px", height:isNaN(p.height) ? "auto" : p.height + "px", zIndex:p.zIndex, overflow: 'hidden' },coord)) .attr({tabIndex: "-1","role":"dialog","aria-labelledby":aIDs.modalhead,"aria-hidden":"true"}); if(typeof p.drag == 'undefined') { p.drag=true;} if(typeof p.resize == 'undefined') {p.resize=true;} if (p.drag) { $(mh).css('cursor','move'); if($.fn.jqDrag) { $(mw).jqDrag(mh); } else { try { $(mw).draggable({handle: $("#"+mh.id)}); } catch (e) {} } } if(p.resize) { if($.fn.jqResize) { $(mw).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>"); $("#"+aIDs.themodal).jqResize(".jqResize",aIDs.scrollelm ? "#"+aIDs.scrollelm : false); } else { try { $(mw).resizable({handles: 'se, sw',alsoResize: aIDs.scrollelm ? "#"+aIDs.scrollelm : false}); } catch (r) {} } } if(p.closeOnEscape === true){ $(mw).keydown( function( e ) { if( e.which == 27 ) { var cone = $("#"+aIDs.themodal).data("onClose") || p.onClose; self.hideModal(this,{gb:p.gbox,jqm:p.jqModal,onClose: cone}); } }); } }, viewModal : function (selector,o){ o = $.extend({ toTop: true, overlay: 10, modal: false, overlayClass : 'ui-widget-overlay', onShow: this.showModal, onHide: this.closeModal, gbox: '', jqm : true, jqM : true }, o || {}); if ($.fn.jqm && o.jqm === true) { if(o.jqM) { $(selector).attr("aria-hidden","false").jqm(o).jqmShow(); } else {$(selector).attr("aria-hidden","false").jqmShow();} } else { if(o.gbox !== '') { $(".jqgrid-overlay:first",o.gbox).show(); $(selector).data("gbox",o.gbox); } $(selector).show().attr("aria-hidden","false"); try{$(':input:visible',selector)[0].focus();}catch(_){} } }, info_dialog : function(caption, content,c_b, modalopt) { var mopt = { width:290, height:'auto', dataheight: 'auto', drag: true, resize: false, caption:"<b>"+caption+"</b>", left:250, top:170, zIndex : 1000, jqModal : true, modal : false, closeOnEscape : true, align: 'center', buttonalign : 'center', buttons : [] // {text:'textbutt', id:"buttid", onClick : function(){...}} // if the id is not provided we set it like info_button_+ the index in the array - i.e info_button_0,info_button_1... }; $.extend(mopt,modalopt || {}); var jm = mopt.jqModal, self = this; if($.fn.jqm && !jm) { jm = false; } // in case there is no jqModal var buttstr =""; if(mopt.buttons.length > 0) { for(var i=0;i<mopt.buttons.length;i++) { if(typeof mopt.buttons[i].id == "undefined") { mopt.buttons[i].id = "info_button_"+i; } buttstr += "<a href='javascript:void(0)' id='"+mopt.buttons[i].id+"' class='fm-button ui-state-default ui-corner-all'>"+mopt.buttons[i].text+"</a>"; } } var dh = isNaN(mopt.dataheight) ? mopt.dataheight : mopt.dataheight+"px", cn = "text-align:"+mopt.align+";"; var cnt = "<div id='info_id'>"; cnt += "<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+dh+";"+cn+"'>"+content+"</div>"; cnt += c_b ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+c_b+"</a>"+buttstr+"</div>" : buttstr !== "" ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+buttstr+"</div>" : ""; cnt += "</div>"; try { if($("#info_dialog").attr("aria-hidden") == "false") { this.hideModal("#info_dialog",{jqm:jm}); } $("#info_dialog").remove(); } catch (e){} this.createModal({ themodal:'info_dialog', modalhead:'info_head', modalcontent:'info_content', scrollelm: 'infocnt'}, cnt, mopt, '','',true ); // attach onclick after inserting into the dom if(buttstr) { $.each(mopt.buttons,function(i){ $("#"+this.id,"#info_id").bind('click',function(){mopt.buttons[i].onClick.call($("#info_dialog")); return false;}); }); } $("#closedialog", "#info_id").click(function(e){ self.hideModal("#info_dialog",{jqm:jm}); return false; }); $(".fm-button","#info_dialog").hover( function(){$(this).addClass('ui-state-hover');}, function(){$(this).removeClass('ui-state-hover');} ); if($.isFunction(mopt.beforeOpen) ) { mopt.beforeOpen(); } this.viewModal("#info_dialog",{ onHide: function(h) { h.w.hide().remove(); if(h.o) { h.o.remove(); } }, modal :mopt.modal, jqm:jm }); if($.isFunction(mopt.afterOpen) ) { mopt.afterOpen(); } try{ $("#info_dialog").focus();} catch (m){} }, // Form Functions createEl : function(eltype,options,vl,autowidth, ajaxso) { var elem = ""; function bindEv (el, opt) { if($.isFunction(opt.dataInit)) { opt.dataInit(el); } if(opt.dataEvents) { $.each(opt.dataEvents, function() { if (this.data !== undefined) { $(el).bind(this.type, this.data, this.fn); } else { $(el).bind(this.type, this.fn); } }); } return opt; } function setAttributes(elm, atr, exl ) { var exclude = ['dataInit','dataEvents','dataUrl', 'buildSelect','sopt', 'searchhidden', 'defaultValue', 'attr']; if(typeof(exl) != "undefined" && $.isArray(exl)) { exclude = $.extend(exclude, exl); } $.each(atr, function(key, value){ if($.inArray(key, exclude) === -1) { $(elm).attr(key,value); } }); if(!atr.hasOwnProperty('id')) { $(elm).attr('id', $.jgrid.randId()); } } switch (eltype) { case "textarea" : elem = document.createElement("textarea"); if(autowidth) { if(!options.cols) { $(elem).css({width:"98%"});} } else if (!options.cols) { options.cols = 20; } if(!options.rows) { options.rows = 2; } if(vl=='&nbsp;' || vl=='&#160;' || (vl.length==1 && vl.charCodeAt(0)==160)) {vl="";} elem.value = vl; setAttributes(elem, options); options = bindEv(elem,options); $(elem).attr({"role":"textbox","multiline":"true"}); break; case "checkbox" : //what code for simple checkbox elem = document.createElement("input"); elem.type = "checkbox"; if( !options.value ) { var vl1 = vl.toLowerCase(); if(vl1.search(/(false|0|no|off|undefined)/i)<0 && vl1!=="") { elem.checked=true; elem.defaultChecked=true; elem.value = vl; } else { elem.value = "on"; } $(elem).attr("offval","off"); } else { var cbval = options.value.split(":"); if(vl === cbval[0]) { elem.checked=true; elem.defaultChecked=true; } elem.value = cbval[0]; $(elem).attr("offval",cbval[1]); } setAttributes(elem, options, ['value']); options = bindEv(elem,options); $(elem).attr("role","checkbox"); break; case "select" : elem = document.createElement("select"); elem.setAttribute("role","select"); var msl, ovm = []; if(options.multiple===true) { msl = true; elem.multiple="multiple"; $(elem).attr("aria-multiselectable","true"); } else { msl = false; } if(typeof(options.dataUrl) != "undefined") { $.ajax($.extend({ url: options.dataUrl, type : "GET", dataType: "html", context: {elem:elem, options:options, vl:vl}, success: function(data,status){ var a, ovm = [], elem = this.elem, vl = this.vl, options = $.extend({},this.options), msl = options.multiple===true; if(typeof(options.buildSelect) != "undefined") { var b = options.buildSelect(data); a = $(b).html(); } else { a = $(data).html(); } if(a) { $(elem).append(a); setAttributes(elem, options); options = bindEv(elem,options); if(typeof options.size === 'undefined') { options.size = msl ? 3 : 1;} if(msl) { ovm = vl.split(","); ovm = $.map(ovm,function(n){return $.trim(n);}); } else { ovm[0] = $.trim(vl); } //$(elem).attr(options); setTimeout(function(){ $("option",elem).each(function(i){ //if(i===0) { this.selected = ""; } $(this).attr("role","option"); if($.inArray($.trim($(this).text()),ovm) > -1 || $.inArray($.trim($(this).val()),ovm) > -1 ) { this.selected= "selected"; } }); },0); } } },ajaxso || {})); } else if(options.value) { var i; if(typeof options.size === 'undefined') { options.size = msl ? 3 : 1; } if(msl) { ovm = vl.split(","); ovm = $.map(ovm,function(n){return $.trim(n);}); } if(typeof options.value === 'function') { options.value = options.value(); } var so,sv, ov, sep = options.separator === undefined ? ":" : options.separator; if(typeof options.value === 'string') { so = options.value.split(";"); for(i=0; i<so.length;i++){ sv = so[i].split(sep); if(sv.length > 2 ) { sv[1] = $.map(sv,function(n,ii){if(ii>0) { return n;} }).join(":"); } ov = document.createElement("option"); ov.setAttribute("role","option"); ov.value = sv[0]; ov.innerHTML = sv[1]; elem.appendChild(ov); if (!msl && ($.trim(sv[0]) == $.trim(vl) || $.trim(sv[1]) == $.trim(vl))) { ov.selected ="selected"; } if (msl && ($.inArray($.trim(sv[1]), ovm)>-1 || $.inArray($.trim(sv[0]), ovm)>-1)) {ov.selected ="selected";} } } else if (typeof options.value === 'object') { var oSv = options.value; for ( var key in oSv) { if (oSv.hasOwnProperty(key ) ){ ov = document.createElement("option"); ov.setAttribute("role","option"); ov.value = key; ov.innerHTML = oSv[key]; elem.appendChild(ov); if (!msl && ( $.trim(key) == $.trim(vl) || $.trim(oSv[key]) == $.trim(vl)) ) { ov.selected ="selected"; } if (msl && ($.inArray($.trim(oSv[key]),ovm)>-1 || $.inArray($.trim(key),ovm)>-1)) { ov.selected ="selected"; } } } } setAttributes(elem, options, ['value']); options = bindEv(elem,options); } break; case "text" : case "password" : case "button" : var role; if(eltype=="button") { role = "button"; } else { role = "textbox"; } elem = document.createElement("input"); elem.type = eltype; elem.value = vl; setAttributes(elem, options); options = bindEv(elem,options); if(eltype != "button"){ if(autowidth) { if(!options.size) { $(elem).css({width:"98%"}); } } else if (!options.size) { options.size = 20; } } $(elem).attr("role",role); break; case "image" : case "file" : elem = document.createElement("input"); elem.type = eltype; setAttributes(elem, options); options = bindEv(elem,options); break; case "custom" : elem = document.createElement("span"); try { if($.isFunction(options.custom_element)) { var celm = options.custom_element.call(this,vl,options); if(celm) { celm = $(celm).addClass("customelement").attr({id:options.id,name:options.name}); $(elem).empty().append(celm); } else { throw "e2"; } } else { throw "e1"; } } catch (e) { if (e=="e1") { this.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.nodefined, $.jgrid.edit.bClose);} if (e=="e2") { this.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.novalue,$.jgrid.edit.bClose);} else { this.info_dialog($.jgrid.errors.errcap,typeof(e)==="string"?e:e.message,$.jgrid.edit.bClose); } } break; } return elem; }, // Date Validation Javascript checkDate : function (format, date) { var daysInFebruary = function(year){ // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 === 0) && ( year % 100 !== 0 || (year % 400 === 0))) ? 29 : 28 ); }, DaysArray = function(n) { for (var i = 1; i <= n; i++) { this[i] = 31; if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;} if (i==2) {this[i] = 29;} } return this; }; var tsp = {}, sep; format = format.toLowerCase(); //we search for /,-,. for the date separator if(format.indexOf("/") != -1) { sep = "/"; } else if(format.indexOf("-") != -1) { sep = "-"; } else if(format.indexOf(".") != -1) { sep = "."; } else { sep = "/"; } format = format.split(sep); date = date.split(sep); if (date.length != 3) { return false; } var j=-1,yln, dln=-1, mln=-1; for(var i=0;i<format.length;i++){ var dv = isNaN(date[i]) ? 0 : parseInt(date[i],10); tsp[format[i]] = dv; yln = format[i]; if(yln.indexOf("y") != -1) { j=i; } if(yln.indexOf("m") != -1) { mln=i; } if(yln.indexOf("d") != -1) { dln=i; } } if (format[j] == "y" || format[j] == "yyyy") { yln=4; } else if(format[j] =="yy"){ yln = 2; } else { yln = -1; } var daysInMonth = DaysArray(12), strDate; if (j === -1) { return false; } else { strDate = tsp[format[j]].toString(); if(yln == 2 && strDate.length == 1) {yln = 1;} if (strDate.length != yln || (tsp[format[j]]===0 && date[j]!="00")){ return false; } } if(mln === -1) { return false; } else { strDate = tsp[format[mln]].toString(); if (strDate.length<1 || tsp[format[mln]]<1 || tsp[format[mln]]>12){ return false; } } if(dln === -1) { return false; } else { strDate = tsp[format[dln]].toString(); if (strDate.length<1 || tsp[format[dln]]<1 || tsp[format[dln]]>31 || (tsp[format[mln]]==2 && tsp[format[dln]]>daysInFebruary(tsp[format[j]])) || tsp[format[dln]] > daysInMonth[tsp[format[mln]]]){ return false; } } return true; }, isEmpty : function(val) { if (val.match(/^\s+$/) || val === "") { return true; } else { return false; } }, checkTime : function(time){ // checks only hh:ss (and optional am/pm) var re = /^(\d{1,2}):(\d{2})([ap]m)?$/,regs; if(!this.isEmpty(time)) { regs = time.match(re); if(regs) { if(regs[3]) { if(regs[1] < 1 || regs[1] > 12) { return false; } } else { if(regs[1] > 23) { return false; } } if(regs[2] > 59) { return false; } } else { return false; } } return true; }, checkValues : function(val, valref,g, customobject, nam) { var edtrul,i, nm, dft, len; if(typeof(customobject) === "undefined") { if(typeof(valref)=='string'){ for( i =0, len=g.p.colModel.length;i<len; i++){ if(g.p.colModel[i].name==valref) { edtrul = g.p.colModel[i].editrules; valref = i; try { nm = g.p.colModel[i].formoptions.label; } catch (e) {} break; } } } else if(valref >=0) { edtrul = g.p.colModel[valref].editrules; } } else { edtrul = customobject; nm = nam===undefined ? "_" : nam; } if(edtrul) { if(!nm) { nm = g.p.colNames[valref]; } if(edtrul.required === true) { if( this.isEmpty(val) ) { return [false,nm+": "+$.jgrid.edit.msg.required,""]; } } // force required var rqfield = edtrul.required === false ? false : true; if(edtrul.number === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.number,""]; } } } if(typeof edtrul.minValue != 'undefined' && !isNaN(edtrul.minValue)) { if (parseFloat(val) < parseFloat(edtrul.minValue) ) { return [false,nm+": "+$.jgrid.edit.msg.minValue+" "+edtrul.minValue,""];} } if(typeof edtrul.maxValue != 'undefined' && !isNaN(edtrul.maxValue)) { if (parseFloat(val) > parseFloat(edtrul.maxValue) ) { return [false,nm+": "+$.jgrid.edit.msg.maxValue+" "+edtrul.maxValue,""];} } var filter; if(edtrul.email === true) { if( !(rqfield === false && this.isEmpty(val)) ) { // taken from $ Validate plugin filter = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i; if(!filter.test(val)) {return [false,nm+": "+$.jgrid.edit.msg.email,""];} } } if(edtrul.integer === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.integer,""]; } if ((val % 1 !== 0) || (val.indexOf('.') != -1)) { return [false,nm+": "+$.jgrid.edit.msg.integer,""];} } } if(edtrul.date === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if(g.p.colModel[valref].formatoptions && g.p.colModel[valref].formatoptions.newformat) { dft = g.p.colModel[valref].formatoptions.newformat; } else { dft = g.p.colModel[valref].datefmt || "Y-m-d"; } if(!this.checkDate (dft, val)) { return [false,nm+": "+$.jgrid.edit.msg.date+" - "+dft,""]; } } } if(edtrul.time === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if(!this.checkTime (val)) { return [false,nm+": "+$.jgrid.edit.msg.date+" - hh:mm (am/pm)",""]; } } } if(edtrul.url === true) { if( !(rqfield === false && this.isEmpty(val)) ) { filter = /^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i; if(!filter.test(val)) {return [false,nm+": "+$.jgrid.edit.msg.url,""];} } } if(edtrul.custom === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if($.isFunction(edtrul.custom_func)) { var ret = edtrul.custom_func.call(g,val,nm); if($.isArray(ret)) { return ret; } else { return [false,$.jgrid.edit.msg.customarray,""]; } } else { return [false,$.jgrid.edit.msg.customfcheck,""]; } } } } return [true,"",""]; } }); })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/grid.common.js
JavaScript
gpl2
23,021
/*! * jQuery Form Plugin * version: 2.87 (20-OCT-2011) * @requires jQuery v1.3.2 or later * * Examples and documentation at: http://malsup.com/jquery/form/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ ;(function($) { /* Usage Note: ----------- Do not use both ajaxSubmit and ajaxForm on the same form. These functions are intended to be exclusive. Use ajaxSubmit if you want to bind your own submit handler to the form. For example, $(document).ready(function() { $('#myForm').bind('submit', function(e) { e.preventDefault(); // <-- important $(this).ajaxSubmit({ target: '#output' }); }); }); Use ajaxForm when you want the plugin to manage all the event binding for you. For example, $(document).ready(function() { $('#myForm').ajaxForm({ target: '#output' }); }); When using ajaxForm, the ajaxSubmit function will be invoked for you at the appropriate time. */ /** * ajaxSubmit() provides a mechanism for immediately submitting * an HTML form using AJAX. */ $.fn.ajaxSubmit = function(options) { // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) if (!this.length) { log('ajaxSubmit: skipping submit process - no element selected'); return this; } var method, action, url, $form = this; if (typeof options == 'function') { options = { success: options }; } method = this.attr('method'); action = this.attr('action'); url = (typeof action === 'string') ? $.trim(action) : ''; url = url || window.location.href || ''; if (url) { // clean url (don't include hash vaue) url = (url.match(/^([^#]+)/)||[])[1]; } options = $.extend(true, { url: url, success: $.ajaxSettings.success, type: method || 'GET', iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' }, options); // hook for manipulating the form data before it is extracted; // convenient for use with rich editors like tinyMCE or FCKEditor var veto = {}; this.trigger('form-pre-serialize', [this, options, veto]); if (veto.veto) { log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); return this; } // provide opportunity to alter form data before it is serialized if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { log('ajaxSubmit: submit aborted via beforeSerialize callback'); return this; } var traditional = options.traditional; if ( traditional === undefined ) { traditional = $.ajaxSettings.traditional; } var qx,n,v,a = this.formToArray(options.semantic); if (options.data) { options.extraData = options.data; qx = $.param(options.data, traditional); } // give pre-submit callback an opportunity to abort the submit if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { log('ajaxSubmit: submit aborted via beforeSubmit callback'); return this; } // fire vetoable 'validate' event this.trigger('form-submit-validate', [a, this, options, veto]); if (veto.veto) { log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); return this; } var q = $.param(a, traditional); if (qx) q = ( q ? (q + '&' + qx) : qx ); if (options.type.toUpperCase() == 'GET') { options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; options.data = null; // data is null for 'get' } else { options.data = q; // data is the query string for 'post' } var callbacks = []; if (options.resetForm) { callbacks.push(function() { $form.resetForm(); }); } if (options.clearForm) { callbacks.push(function() { $form.clearForm(options.includeHidden); }); } // perform a load on the target only if dataType is not provided if (!options.dataType && options.target) { var oldSuccess = options.success || function(){}; callbacks.push(function(data) { var fn = options.replaceTarget ? 'replaceWith' : 'html'; $(options.target)[fn](data).each(oldSuccess, arguments); }); } else if (options.success) { callbacks.push(options.success); } options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg var context = options.context || options; // jQuery 1.4+ supports scope context for (var i=0, max=callbacks.length; i < max; i++) { callbacks[i].apply(context, [data, status, xhr || $form, $form]); } }; // are there files to upload? var fileInputs = $('input:file', this).length > 0; var mp = 'multipart/form-data'; var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); // options.iframe allows user to force iframe mode // 06-NOV-09: now defaulting to iframe mode if file input is detected if (options.iframe !== false && (fileInputs || options.iframe || multipart)) { // hack to fix Safari hang (thanks to Tim Molendijk for this) // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d if (options.closeKeepAlive) { $.get(options.closeKeepAlive, function() { fileUpload(a); }); } else { fileUpload(a); } } else { // IE7 massage (see issue 57) if ($.browser.msie && method == 'get' && typeof options.type === "undefined") { var ieMeth = $form[0].getAttribute('method'); if (typeof ieMeth === 'string') options.type = ieMeth; } $.ajax(options); } // fire 'notify' event this.trigger('form-submit-notify', [this, options]); return this; // private function for handling file uploads (hat tip to YAHOO!) function fileUpload(a) { var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; var useProp = !!$.fn.prop; if (a) { if ( useProp ) { // ensure that every serialized input is still enabled for (i=0; i < a.length; i++) { el = $(form[a[i].name]); el.prop('disabled', false); } } else { for (i=0; i < a.length; i++) { el = $(form[a[i].name]); el.removeAttr('disabled'); } }; } if ($(':input[name=submit],:input[id=submit]', form).length) { // if there is an input with a name or id of 'submit' then we won't be // able to invoke the submit fn on the form (at least not x-browser) alert('Error: Form elements must not have name or id of "submit".'); return; } s = $.extend(true, {}, $.ajaxSettings, options); s.context = s.context || s; id = 'jqFormIO' + (new Date().getTime()); if (s.iframeTarget) { $io = $(s.iframeTarget); n = $io.attr('name'); if (n == null) $io.attr('name', id); else id = n; } else { $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />'); $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' }); } io = $io[0]; xhr = { // mock object aborted: 0, responseText: null, responseXML: null, status: 0, statusText: 'n/a', getAllResponseHeaders: function() {}, getResponseHeader: function() {}, setRequestHeader: function() {}, abort: function(status) { var e = (status === 'timeout' ? 'timeout' : 'aborted'); log('aborting upload... ' + e); this.aborted = 1; $io.attr('src', s.iframeSrc); // abort op in progress xhr.error = e; s.error && s.error.call(s.context, xhr, e, status); g && $.event.trigger("ajaxError", [xhr, s, e]); s.complete && s.complete.call(s.context, xhr, e); } }; g = s.global; // trigger ajax global events so that activity/block indicators work like normal if (g && ! $.active++) { $.event.trigger("ajaxStart"); } if (g) { $.event.trigger("ajaxSend", [xhr, s]); } if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) { if (s.global) { $.active--; } return; } if (xhr.aborted) { return; } // add submitting element to data if we know it sub = form.clk; if (sub) { n = sub.name; if (n && !sub.disabled) { s.extraData = s.extraData || {}; s.extraData[n] = sub.value; if (sub.type == "image") { s.extraData[n+'.x'] = form.clk_x; s.extraData[n+'.y'] = form.clk_y; } } } var CLIENT_TIMEOUT_ABORT = 1; var SERVER_ABORT = 2; function getDoc(frame) { var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document; return doc; } // take a breath so that pending repaints get some cpu time before the upload starts function doSubmit() { // make sure form attrs are set var t = $form.attr('target'), a = $form.attr('action'); // update form attrs in IE friendly way form.setAttribute('target',id); if (!method) { form.setAttribute('method', 'POST'); } if (a != s.url) { form.setAttribute('action', s.url); } // ie borks in some cases when setting encoding if (! s.skipEncodingOverride && (!method || /post/i.test(method))) { $form.attr({ encoding: 'multipart/form-data', enctype: 'multipart/form-data' }); } // support timout if (s.timeout) { timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout); } // look for server aborts function checkState() { try { var state = getDoc(io).readyState; log('state = ' + state); if (state.toLowerCase() == 'uninitialized') setTimeout(checkState,50); } catch(e) { log('Server abort: ' , e, ' (', e.name, ')'); cb(SERVER_ABORT); timeoutHandle && clearTimeout(timeoutHandle); timeoutHandle = undefined; } } // add "extra" data to form if provided in options var extraInputs = []; try { if (s.extraData) { for (var n in s.extraData) { extraInputs.push( $('<input type="hidden" name="'+n+'" />').attr('value',s.extraData[n]) .appendTo(form)[0]); } } if (!s.iframeTarget) { // add iframe to doc and submit the form $io.appendTo('body'); io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false); } setTimeout(checkState,15); form.submit(); } finally { // reset attrs and remove "extra" input elements form.setAttribute('action',a); if(t) { form.setAttribute('target', t); } else { $form.removeAttr('target'); } $(extraInputs).remove(); } } if (s.forceSync) { doSubmit(); } else { setTimeout(doSubmit, 10); // this lets dom updates render } var data, doc, domCheckCount = 50, callbackProcessed; function cb(e) { if (xhr.aborted || callbackProcessed) { return; } try { doc = getDoc(io); } catch(ex) { log('cannot access response document: ', ex); e = SERVER_ABORT; } if (e === CLIENT_TIMEOUT_ABORT && xhr) { xhr.abort('timeout'); return; } else if (e == SERVER_ABORT && xhr) { xhr.abort('server abort'); return; } if (!doc || doc.location.href == s.iframeSrc) { // response not received yet if (!timedOut) return; } io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false); var status = 'success', errMsg; try { if (timedOut) { throw 'timeout'; } var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc); log('isXml='+isXml); if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) { if (--domCheckCount) { // in some browsers (Opera) the iframe DOM is not always traversable when // the onload callback fires, so we loop a bit to accommodate log('requeing onLoad callback, DOM not available'); setTimeout(cb, 250); return; } // let this fall through because server response could be an empty document //log('Could not access iframe DOM after mutiple tries.'); //throw 'DOMException: not available'; } //log('response detected'); var docRoot = doc.body ? doc.body : doc.documentElement; xhr.responseText = docRoot ? docRoot.innerHTML : null; xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; if (isXml) s.dataType = 'xml'; xhr.getResponseHeader = function(header){ var headers = {'content-type': s.dataType}; return headers[header]; }; // support for XHR 'status' & 'statusText' emulation : if (docRoot) { xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status; xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText; } var dt = (s.dataType || '').toLowerCase(); var scr = /(json|script|text)/.test(dt); if (scr || s.textarea) { // see if user embedded response in textarea var ta = doc.getElementsByTagName('textarea')[0]; if (ta) { xhr.responseText = ta.value; // support for XHR 'status' & 'statusText' emulation : xhr.status = Number( ta.getAttribute('status') ) || xhr.status; xhr.statusText = ta.getAttribute('statusText') || xhr.statusText; } else if (scr) { // account for browsers injecting pre around json response var pre = doc.getElementsByTagName('pre')[0]; var b = doc.getElementsByTagName('body')[0]; if (pre) { xhr.responseText = pre.textContent ? pre.textContent : pre.innerText; } else if (b) { xhr.responseText = b.textContent ? b.textContent : b.innerText; } } } else if (dt == 'xml' && !xhr.responseXML && xhr.responseText != null) { xhr.responseXML = toXml(xhr.responseText); } try { data = httpData(xhr, dt, s); } catch (e) { status = 'parsererror'; xhr.error = errMsg = (e || status); } } catch (e) { log('error caught: ',e); status = 'error'; xhr.error = errMsg = (e || status); } if (xhr.aborted) { log('upload aborted'); status = null; } if (xhr.status) { // we've set xhr.status status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error'; } // ordering of these callbacks/triggers is odd, but that's how $.ajax does it if (status === 'success') { s.success && s.success.call(s.context, data, 'success', xhr); g && $.event.trigger("ajaxSuccess", [xhr, s]); } else if (status) { if (errMsg == undefined) errMsg = xhr.statusText; s.error && s.error.call(s.context, xhr, status, errMsg); g && $.event.trigger("ajaxError", [xhr, s, errMsg]); } g && $.event.trigger("ajaxComplete", [xhr, s]); if (g && ! --$.active) { $.event.trigger("ajaxStop"); } s.complete && s.complete.call(s.context, xhr, status); callbackProcessed = true; if (s.timeout) clearTimeout(timeoutHandle); // clean up setTimeout(function() { if (!s.iframeTarget) $io.remove(); xhr.responseXML = null; }, 100); } var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+) if (window.ActiveXObject) { doc = new ActiveXObject('Microsoft.XMLDOM'); doc.async = 'false'; doc.loadXML(s); } else { doc = (new DOMParser()).parseFromString(s, 'text/xml'); } return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null; }; var parseJSON = $.parseJSON || function(s) { return window['eval']('(' + s + ')'); }; var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4 var ct = xhr.getResponseHeader('content-type') || '', xml = type === 'xml' || !type && ct.indexOf('xml') >= 0, data = xml ? xhr.responseXML : xhr.responseText; if (xml && data.documentElement.nodeName === 'parsererror') { $.error && $.error('parsererror'); } if (s && s.dataFilter) { data = s.dataFilter(data, type); } if (typeof data === 'string') { if (type === 'json' || !type && ct.indexOf('json') >= 0) { data = parseJSON(data); } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) { $.globalEval(data); } } return data; }; } }; /** * ajaxForm() provides a mechanism for fully automating form submission. * * The advantages of using this method instead of ajaxSubmit() are: * * 1: This method will include coordinates for <input type="image" /> elements (if the element * is used to submit the form). * 2. This method will include the submit element's name/value data (for the element that was * used to submit the form). * 3. This method binds the submit() method to the form for you. * * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely * passes the options argument along after properly binding events for submit elements and * the form itself. */ $.fn.ajaxForm = function(options) { // in jQuery 1.3+ we can fix mistakes with the ready state if (this.length === 0) { var o = { s: this.selector, c: this.context }; if (!$.isReady && o.s) { log('DOM not ready, queuing ajaxForm'); $(function() { $(o.s,o.c).ajaxForm(options); }); return this; } // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); return this; } return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) { if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed e.preventDefault(); $(this).ajaxSubmit(options); } }).bind('click.form-plugin', function(e) { var target = e.target; var $el = $(target); if (!($el.is(":submit,input:image"))) { // is this a child element of the submit el? (ex: a span within a button) var t = $el.closest(':submit'); if (t.length == 0) { return; } target = t[0]; } var form = this; form.clk = target; if (target.type == 'image') { if (e.offsetX != undefined) { form.clk_x = e.offsetX; form.clk_y = e.offsetY; } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin var offset = $el.offset(); form.clk_x = e.pageX - offset.left; form.clk_y = e.pageY - offset.top; } else { form.clk_x = e.pageX - target.offsetLeft; form.clk_y = e.pageY - target.offsetTop; } } // clear form vars setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100); }); }; // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm $.fn.ajaxFormUnbind = function() { return this.unbind('submit.form-plugin click.form-plugin'); }; /** * formToArray() gathers form element data into an array of objects that can * be passed to any of the following ajax functions: $.get, $.post, or load. * Each object in the array has both a 'name' and 'value' property. An example of * an array for a simple login form might be: * * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] * * It is this array that is passed to pre-submit callback functions provided to the * ajaxSubmit() and ajaxForm() methods. */ $.fn.formToArray = function(semantic) { var a = []; if (this.length === 0) { return a; } var form = this[0]; var els = semantic ? form.getElementsByTagName('*') : form.elements; if (!els) { return a; } var i,j,n,v,el,max,jmax; for(i=0, max=els.length; i < max; i++) { el = els[i]; n = el.name; if (!n) { continue; } if (semantic && form.clk && el.type == "image") { // handle image inputs on the fly when semantic == true if(!el.disabled && form.clk == el) { a.push({name: n, value: $(el).val()}); a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); } continue; } v = $.fieldValue(el, true); if (v && v.constructor == Array) { for(j=0, jmax=v.length; j < jmax; j++) { a.push({name: n, value: v[j]}); } } else if (v !== null && typeof v != 'undefined') { a.push({name: n, value: v}); } } if (!semantic && form.clk) { // input type=='image' are not found in elements array! handle it here var $input = $(form.clk), input = $input[0]; n = input.name; if (n && !input.disabled && input.type == 'image') { a.push({name: n, value: $input.val()}); a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); } } return a; }; /** * Serializes form data into a 'submittable' string. This method will return a string * in the format: name1=value1&amp;name2=value2 */ $.fn.formSerialize = function(semantic) { //hand off to jQuery.param for proper encoding return $.param(this.formToArray(semantic)); }; /** * Serializes all field elements in the jQuery object into a query string. * This method will return a string in the format: name1=value1&amp;name2=value2 */ $.fn.fieldSerialize = function(successful) { var a = []; this.each(function() { var n = this.name; if (!n) { return; } var v = $.fieldValue(this, successful); if (v && v.constructor == Array) { for (var i=0,max=v.length; i < max; i++) { a.push({name: n, value: v[i]}); } } else if (v !== null && typeof v != 'undefined') { a.push({name: this.name, value: v}); } }); //hand off to jQuery.param for proper encoding return $.param(a); }; /** * Returns the value(s) of the element in the matched set. For example, consider the following form: * * <form><fieldset> * <input name="A" type="text" /> * <input name="A" type="text" /> * <input name="B" type="checkbox" value="B1" /> * <input name="B" type="checkbox" value="B2"/> * <input name="C" type="radio" value="C1" /> * <input name="C" type="radio" value="C2" /> * </fieldset></form> * * var v = $(':text').fieldValue(); * // if no values are entered into the text inputs * v == ['',''] * // if values entered into the text inputs are 'foo' and 'bar' * v == ['foo','bar'] * * var v = $(':checkbox').fieldValue(); * // if neither checkbox is checked * v === undefined * // if both checkboxes are checked * v == ['B1', 'B2'] * * var v = $(':radio').fieldValue(); * // if neither radio is checked * v === undefined * // if first radio is checked * v == ['C1'] * * The successful argument controls whether or not the field element must be 'successful' * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). * The default value of the successful argument is true. If this value is false the value(s) * for each element is returned. * * Note: This method *always* returns an array. If no valid value can be determined the * array will be empty, otherwise it will contain one or more values. */ $.fn.fieldValue = function(successful) { for (var val=[], i=0, max=this.length; i < max; i++) { var el = this[i]; var v = $.fieldValue(el, successful); if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) { continue; } v.constructor == Array ? $.merge(val, v) : val.push(v); } return val; }; /** * Returns the value of the field element. */ $.fieldValue = function(el, successful) { var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); if (successful === undefined) { successful = true; } if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || (t == 'checkbox' || t == 'radio') && !el.checked || (t == 'submit' || t == 'image') && el.form && el.form.clk != el || tag == 'select' && el.selectedIndex == -1)) { return null; } if (tag == 'select') { var index = el.selectedIndex; if (index < 0) { return null; } var a = [], ops = el.options; var one = (t == 'select-one'); var max = (one ? index+1 : ops.length); for(var i=(one ? index : 0); i < max; i++) { var op = ops[i]; if (op.selected) { var v = op.value; if (!v) { // extra pain for IE... v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value; } if (one) { return v; } a.push(v); } } return a; } return $(el).val(); }; /** * Clears the form data. Takes the following actions on the form's input fields: * - input text fields will have their 'value' property set to the empty string * - select elements will have their 'selectedIndex' property set to -1 * - checkbox and radio inputs will have their 'checked' property set to false * - inputs of type submit, button, reset, and hidden will *not* be effected * - button elements will *not* be effected */ $.fn.clearForm = function(includeHidden) { return this.each(function() { $('input,select,textarea', this).clearFields(includeHidden); }); }; /** * Clears the selected form elements. */ $.fn.clearFields = $.fn.clearInputs = function(includeHidden) { var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list return this.each(function() { var t = this.type, tag = this.tagName.toLowerCase(); if (re.test(t) || tag == 'textarea' || (includeHidden && /hidden/.test(t)) ) { this.value = ''; } else if (t == 'checkbox' || t == 'radio') { this.checked = false; } else if (tag == 'select') { this.selectedIndex = -1; } }); }; /** * Resets the form data. Causes all form elements to be reset to their original value. */ $.fn.resetForm = function() { return this.each(function() { // guard against an input with the name of 'reset' // note that IE reports the reset function as an 'object' if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) { this.reset(); } }); }; /** * Enables or disables any matching elements. */ $.fn.enable = function(b) { if (b === undefined) { b = true; } return this.each(function() { this.disabled = !b; }); }; /** * Checks/unchecks any matching checkboxes or radio buttons and * selects/deselects and matching option elements. */ $.fn.selected = function(select) { if (select === undefined) { select = true; } return this.each(function() { var t = this.type; if (t == 'checkbox' || t == 'radio') { this.checked = select; } else if (this.tagName.toLowerCase() == 'option') { var $sel = $(this).parent('select'); if (select && $sel[0] && $sel[0].type == 'select-one') { // deselect all other options $sel.find('option').selected(false); } this.selected = select; } }); }; // expose debug var $.fn.ajaxSubmit.debug = false; // helper fn for console logging function log() { if (!$.fn.ajaxSubmit.debug) return; var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,''); if (window.console && window.console.log) { window.console.log(msg); } else if (window.opera && window.opera.postError) { window.opera.postError(msg); } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/src-form/jquery.form.js
JavaScript
gpl2
27,151
/** * @preserve * FullCalendar v1.5.1 * http://arshaw.com/fullcalendar/ * * Use fullcalendar.css for basic styling. * For event drag & drop, requires jQuery UI draggable. * For event resizing, requires jQuery UI resizable. * * Copyright (c) 2011 Adam Shaw * Dual licensed under the MIT and GPL licenses, located in * MIT-LICENSE.txt and GPL-LICENSE.txt respectively. * * Date: Sat Apr 9 14:09:51 2011 -0700 * */ (function($, undefined) { var defaults = { // display defaultView: 'month', aspectRatio: 1.35, header: { left: 'title', center: '', right: 'today prev,next' }, weekends: true, // editing //editable: false, //disableDragging: false, //disableResizing: false, allDayDefault: true, ignoreTimezone: true, // event ajax lazyFetching: true, startParam: 'start', endParam: 'end', // time formats titleFormat: { year:'yyyy', // add by Kebin ---> 1 month: 'MMMM yyyy', week: "MMM d[ yyyy]{ '&#8212;'[ MMM] d yyyy}", day: 'dddd, MMM d, yyyy' }, columnFormat: { year:'MMMM', //add by kebin --> 2 month: 'ddd', week: 'ddd M/d', day: 'dddd M/d' }, timeFormat: { // for event elements '': 'h(:mm)t' // default }, // locale isRTL: false, firstDay: 0, monthNames: ['January','February','March','April','May','June','July','August','September','October','November','December'], monthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'], dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'], dayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'], dayNamesShortest: ['S','M','T','W','T','F','S'], //add by Kebin --> 3 buttonText: { prev: '&nbsp;&#9668;&nbsp;', next: '&nbsp;&#9658;&nbsp;', prevYear: '&nbsp;&lt;&lt;&nbsp;', nextYear: '&nbsp;&gt;&gt;&nbsp;', today: 'today', year:'year', //add by kebin --> 4 month: 'month', week: 'week', day: 'day' }, // jquery-ui theming theme: false, buttonIcons: { prev: 'circle-triangle-w', next: 'circle-triangle-e' }, //selectable: false, unselectAuto: true, dropAccept: '*' }; // right-to-left defaults var rtlDefaults = { header: { left: 'next,prev today', center: '', right: 'title' }, buttonText: { prev: '&nbsp;&#9658;&nbsp;', next: '&nbsp;&#9668;&nbsp;', prevYear: '&nbsp;&gt;&gt;&nbsp;', nextYear: '&nbsp;&lt;&lt;&nbsp;' }, buttonIcons: { prev: 'circle-triangle-e', next: 'circle-triangle-w' } }; var fc = $.fullCalendar = { version: "1.5.1" }; var fcViews = fc.views = {}; $.fn.fullCalendar = function(options) { // method calling if (typeof options == 'string') { var args = Array.prototype.slice.call(arguments, 1); var res; this.each(function() { var calendar = $.data(this, 'fullCalendar'); if (calendar && $.isFunction(calendar[options])) { var r = calendar[options].apply(calendar, args); if (res === undefined) { res = r; } if (options == 'destroy') { $.removeData(this, 'fullCalendar'); } } }); if (res !== undefined) { return res; } return this; } // would like to have this logic in EventManager, but needs to happen before options are recursively extended var eventSources = options.eventSources || []; delete options.eventSources; if (options.events) { eventSources.push(options.events); delete options.events; } options = $.extend(true, {}, defaults, (options.isRTL || options.isRTL===undefined && defaults.isRTL) ? rtlDefaults : {}, options ); this.each(function(i, _element) { var element = $(_element); var calendar = new Calendar(element, options, eventSources); element.data('fullCalendar', calendar); // TODO: look into memory leak implications calendar.render(); }); return this; }; // function for adding/overriding defaults function setDefaults(d) { $.extend(true, defaults, d); } function Calendar(element, options, eventSources) { var t = this; // exports t.options = options; t.render = render; t.destroy = destroy; t.refetchEvents = refetchEvents; t.reportEvents = reportEvents; t.reportEventChange = reportEventChange; t.rerenderEvents = rerenderEvents; t.changeView = changeView; t.select = select; t.unselect = unselect; t.prev = prev; t.next = next; t.prevYear = prevYear; t.nextYear = nextYear; t.today = today; t.gotoDate = gotoDate; t.incrementDate = incrementDate; t.formatDate = function(format, date) { return formatDate(format, date, options) }; t.formatDates = function(format, date1, date2) { return formatDates(format, date1, date2, options) }; t.getDate = getDate; t.getView = getView; t.option = option; t.trigger = trigger; // imports EventManager.call(t, options, eventSources); var isFetchNeeded = t.isFetchNeeded; var fetchEvents = t.fetchEvents; // locals var _element = element[0]; var header; var headerElement; var content; var tm; // for making theme classes var currentView; var viewInstances = {}; var elementOuterWidth; var suggestedViewHeight; var absoluteViewElement; var resizeUID = 0; var ignoreWindowResize = 0; var date = new Date(); var events = []; var _dragElement; /* Main Rendering -----------------------------------------------------------------------------*/ setYMD(date, options.year, options.month, options.date); function render(inc) { if (!content) { initialRender(); }else{ calcSize(); markSizesDirty(); markEventsDirty(); renderView(inc); } } function initialRender() { tm = options.theme ? 'ui' : 'fc'; element.addClass('fc'); if (options.isRTL) { element.addClass('fc-rtl'); } if (options.theme) { element.addClass('ui-widget'); } content = $("<div class='fc-content' style='position:relative'/>") .prependTo(element); header = new Header(t, options); headerElement = header.render(); if (headerElement) { element.prepend(headerElement); } changeView(options.defaultView); $(window).resize(windowResize); // needed for IE in a 0x0 iframe, b/c when it is resized, never triggers a windowResize if (!bodyVisible()) { lateRender(); } var inh = $(".fc-view-"+options.defaultView, element).height(); setTimeout(function(){ $(".fc-view-search", element).css('height',inh).hide(); }, 200); } // called when we know the calendar couldn't be rendered when it was initialized, // but we think it's ready now function lateRender() { setTimeout(function() { // IE7 needs this so dimensions are calculated correctly if (!currentView.start && bodyVisible()) { // !currentView.start makes sure this never happens more than once renderView(); } },0); } function destroy() { $(window).unbind('resize', windowResize); header.destroy(); content.remove(); element.removeClass('fc fc-rtl ui-widget'); } function elementVisible() { return _element.offsetWidth !== 0; } function bodyVisible() { return $('body')[0].offsetWidth !== 0; } /* View Rendering -----------------------------------------------------------------------------*/ // TODO: improve view switching (still weird transition in IE, and FF has whiteout problem) function changeView(newViewName) { if (!currentView || newViewName != currentView.name) { ignoreWindowResize++; // because setMinHeight might change the height before render (and subsequently setSize) is reached unselect(); var oldView = currentView; var newViewElement; if (oldView) { (oldView.beforeHide || noop)(); // called before changing min-height. if called after, scroll state is reset (in Opera) setMinHeight(content, content.height()); oldView.element.hide(); }else{ setMinHeight(content, 1); // needs to be 1 (not 0) for IE7, or else view dimensions miscalculated } content.css('overflow', 'hidden'); currentView = viewInstances[newViewName]; if (currentView) { currentView.element.show(); }else{ currentView = viewInstances[newViewName] = new fcViews[newViewName]( newViewElement = absoluteViewElement = $("<div class='fc-view fc-view-" + newViewName + "' style='position:absolute'/>") .appendTo(content), t // the calendar object ); } if($("#b_search_cal").hasClass('ui-state-active') ) { $("#b_search_cal").trigger('click'); } if (oldView) { header.deactivateButton(oldView.name); } header.activateButton(newViewName); renderView(); // after height has been set, will make absoluteViewElement's position=relative, then set to null content.css('overflow', ''); if (oldView) { setMinHeight(content, 1); } if (!newViewElement) { (currentView.afterShow || noop)(); // called after setting min-height/overflow, so in final scroll state (for Opera) } ignoreWindowResize--; } } function renderView(inc) { if (elementVisible()) { ignoreWindowResize++; // because renderEvents might temporarily change the height before setSize is reached unselect(); if (suggestedViewHeight === undefined) { calcSize(); } var forceEventRender = false; if (!currentView.start || inc || date < currentView.start || date >= currentView.end) { // view must render an entire new date range (and refetch/render events) currentView.render(date, inc || 0); // responsible for clearing events setSize(true); forceEventRender = true; } else if (currentView.sizeDirty) { // view must resize (and rerender events) currentView.clearEvents(); setSize(); forceEventRender = true; } else if (currentView.eventsDirty) { currentView.clearEvents(); forceEventRender = true; } currentView.sizeDirty = false; currentView.eventsDirty = false; updateEvents(forceEventRender); elementOuterWidth = element.outerWidth(); header.updateTitle(currentView.title); var today = new Date(); if (today >= currentView.start && today < currentView.end) { header.disableButton('today'); }else{ header.enableButton('today'); } ignoreWindowResize--; currentView.trigger('viewDisplay', _element); } } /* Resizing -----------------------------------------------------------------------------*/ function updateSize() { markSizesDirty(); if (elementVisible()) { calcSize(); setSize(); unselect(); currentView.clearEvents(); currentView.renderEvents(events); currentView.sizeDirty = false; } } function markSizesDirty() { $.each(viewInstances, function(i, inst) { inst.sizeDirty = true; }); } function calcSize() { if (options.contentHeight) { suggestedViewHeight = options.contentHeight; } else if (options.height) { suggestedViewHeight = options.height - (headerElement ? headerElement.height() : 0) - vsides(content); } else { suggestedViewHeight = Math.round(content.width() / Math.max(options.aspectRatio, .5)); } } function setSize(dateChanged) { // todo: dateChanged? ignoreWindowResize++; currentView.setHeight(suggestedViewHeight, dateChanged); if (absoluteViewElement) { absoluteViewElement.css('position', 'relative'); absoluteViewElement = null; } currentView.setWidth(content.width(), dateChanged); ignoreWindowResize--; } function windowResize() { if (!ignoreWindowResize) { if (currentView.start) { // view has already been rendered var uid = ++resizeUID; setTimeout(function() { // add a delay if (uid == resizeUID && !ignoreWindowResize && elementVisible()) { if (elementOuterWidth != (elementOuterWidth = element.outerWidth())) { ignoreWindowResize++; // in case the windowResize callback changes the height updateSize(); currentView.trigger('windowResize', _element); ignoreWindowResize--; } } }, 200); }else{ // calendar must have been initialized in a 0x0 iframe that has just been resized lateRender(); } } } /* Event Fetching/Rendering -----------------------------------------------------------------------------*/ // fetches events if necessary, rerenders events if necessary (or if forced) function updateEvents(forceRender) { if (!options.lazyFetching || isFetchNeeded(currentView.visStart, currentView.visEnd)) { refetchEvents(); } else if (forceRender) { rerenderEvents(); } } function refetchEvents() { fetchEvents(currentView.visStart, currentView.visEnd); // will call reportEvents } // called when event data arrives function reportEvents(_events) { events = _events; rerenderEvents(); } // called when a single event's data has been changed function reportEventChange(eventID) { rerenderEvents(eventID); } // attempts to rerenderEvents function rerenderEvents(modifiedEventID) { markEventsDirty(); if (elementVisible()) { currentView.clearEvents(); currentView.renderEvents(events, modifiedEventID); currentView.eventsDirty = false; } } function markEventsDirty() { $.each(viewInstances, function(i, inst) { inst.eventsDirty = true; }); } /* Selection -----------------------------------------------------------------------------*/ function select(start, end, allDay) { currentView.select(start, end, allDay===undefined ? true : allDay); } function unselect() { // safe to be called before renderView if (currentView) { currentView.unselect(); } } /* Date -----------------------------------------------------------------------------*/ function prev() { renderView(-1); } function next() { renderView(1); } function prevYear() { addYears(date, -1); renderView(); } function nextYear() { addYears(date, 1); renderView(); } function today() { date = new Date(); renderView(); } function gotoDate(year, month, dateOfMonth) { if (year instanceof Date) { date = cloneDate(year); // provided 1 argument, a Date }else{ setYMD(date, year, month, dateOfMonth); } renderView(); } function incrementDate(years, months, days) { if (years !== undefined) { addYears(date, years); } if (months !== undefined) { addMonths(date, months); } if (days !== undefined) { addDays(date, days); } renderView(); } function getDate() { return cloneDate(date); } /* Misc -----------------------------------------------------------------------------*/ function getView() { return currentView; } function option(name, value) { if (value === undefined) { return options[name]; } if (name == 'height' || name == 'contentHeight' || name == 'aspectRatio') { options[name] = value; updateSize(); } } function trigger(name, thisObj) { if (options[name]) { return options[name].apply( thisObj || _element, Array.prototype.slice.call(arguments, 2) ); } } /* External Dragging ------------------------------------------------------------------------*/ if (options.droppable) { $(document) .bind('dragstart', function(ev, ui) { var _e = ev.target; var e = $(_e); if (!e.parents('.fc').length) { // not already inside a calendar var accept = options.dropAccept; if ($.isFunction(accept) ? accept.call(_e, e) : e.is(accept)) { _dragElement = _e; currentView.dragStart(_dragElement, ev, ui); } } }) .bind('dragstop', function(ev, ui) { if (_dragElement) { currentView.dragStop(_dragElement, ev, ui); _dragElement = null; } }); } } function Header(calendar, options) { var t = this; // exports t.render = render; t.destroy = destroy; t.updateTitle = updateTitle; t.activateButton = activateButton; t.deactivateButton = deactivateButton; t.disableButton = disableButton; t.enableButton = enableButton; // locals var element = $([]); var tm; function render() { tm = options.theme ? 'ui' : 'fc'; var sections = options.header; if (sections) { element = $("<table class='fc-header' style='width:100%'/>") .append( $("<tr/>") .append(renderSection('left')) .append(renderSection('center')) .append(renderSection('right')) ); return element; } } function destroy() { element.remove(); } function renderSection(position) { var e = $("<td class='fc-header-" + position + "'/>"); var buttonStr = options.header[position]; if (buttonStr) { $.each(buttonStr.split(' '), function(i) { if (i > 0) { e.append("<span class='fc-header-space'/>"); } var prevButton; $.each(this.split(','), function(j, buttonName) { if (buttonName == 'title') { e.append("<span class='fc-header-title'><h2>&nbsp;</h2></span>"); if (prevButton) { prevButton.addClass(tm + '-corner-right'); } prevButton = null; }else{ var buttonClick; if (calendar[buttonName]) { buttonClick = calendar[buttonName]; // calendar method } else if (fcViews[buttonName]) { buttonClick = function() { button.removeClass(tm + '-state-hover'); // forget why calendar.changeView(buttonName); }; } if (buttonClick) { var icon = options.theme ? smartProperty(options.buttonIcons, buttonName) : null; // why are we using smartProperty here? var text = smartProperty(options.buttonText, buttonName); // why are we using smartProperty here? var button = $( "<span class='fc-button fc-button-" + buttonName + " " + tm + "-state-default'>" + "<span class='fc-button-inner'>" + "<span class='fc-button-content'>" + (icon ? "<span class='fc-icon-wrap'>" + "<span class='ui-icon ui-icon-" + icon + "'/>" + "</span>" : text ) + "</span>" + "<span class='fc-button-effect'><span></span></span>" + "</span>" + "</span>" ); if (button) { button .click(function() { if (!button.hasClass(tm + '-state-disabled')) { buttonClick(); } }) .mousedown(function() { button .not('.' + tm + '-state-active') .not('.' + tm + '-state-disabled') .addClass(tm + '-state-down'); }) .mouseup(function() { button.removeClass(tm + '-state-down'); }) .hover( function() { button .not('.' + tm + '-state-active') .not('.' + tm + '-state-disabled') .addClass(tm + '-state-hover'); }, function() { button .removeClass(tm + '-state-hover') .removeClass(tm + '-state-down'); } ) .appendTo(e); if (!prevButton) { button.addClass(tm + '-corner-left'); } prevButton = button; } } } }); if (prevButton) { prevButton.addClass(tm + '-corner-right'); } }); } return e; } function updateTitle(html) { element.find('h2') .html(html); } function activateButton(buttonName) { element.find('span.fc-button-' + buttonName) .addClass(tm + '-state-active'); } function deactivateButton(buttonName) { element.find('span.fc-button-' + buttonName) .removeClass(tm + '-state-active'); } function disableButton(buttonName) { element.find('span.fc-button-' + buttonName) .addClass(tm + '-state-disabled'); } function enableButton(buttonName) { element.find('span.fc-button-' + buttonName) .removeClass(tm + '-state-disabled'); } } fc.sourceNormalizers = []; fc.sourceFetchers = []; var ajaxDefaults = { dataType: 'json', cache: false }; var eventGUID = 1; function EventManager(options, _sources) { var t = this; // exports t.isFetchNeeded = isFetchNeeded; t.fetchEvents = fetchEvents; t.addEventSource = addEventSource; t.removeEventSource = removeEventSource; t.updateEvent = updateEvent; t.renderEvent = renderEvent; t.removeEvents = removeEvents; t.clientEvents = clientEvents; t.normalizeEvent = normalizeEvent; // imports var trigger = t.trigger; var getView = t.getView; var reportEvents = t.reportEvents; // locals var stickySource = { events: [] }; var sources = [ stickySource ]; var rangeStart, rangeEnd; var currentFetchID = 0; var pendingSourceCnt = 0; var loadingLevel = 0; var cache = []; for (var i=0; i<_sources.length; i++) { _addEventSource(_sources[i]); } /* Fetching -----------------------------------------------------------------------------*/ function isFetchNeeded(start, end) { return !rangeStart || start < rangeStart || end > rangeEnd; } function fetchEvents(start, end) { rangeStart = start; rangeEnd = end; cache = []; var fetchID = ++currentFetchID; var len = sources.length; pendingSourceCnt = len; for (var i=0; i<len; i++) { fetchEventSource(sources[i], fetchID); } } function fetchEventSource(source, fetchID) { _fetchEventSource(source, function(events) { if (fetchID == currentFetchID) { if (events) { for (var i=0; i<events.length; i++) { events[i].source = source; normalizeEvent(events[i]); } cache = cache.concat(events); } pendingSourceCnt--; if (!pendingSourceCnt) { reportEvents(cache); } } }); } function _fetchEventSource(source, callback) { var i; var fetchers = fc.sourceFetchers; var res; for (i=0; i<fetchers.length; i++) { res = fetchers[i](source, rangeStart, rangeEnd, callback); if (res === true) { // the fetcher is in charge. made its own async request return; } else if (typeof res == 'object') { // the fetcher returned a new source. process it _fetchEventSource(res, callback); return; } } var events = source.events; if (events) { if ($.isFunction(events)) { pushLoading(); events(cloneDate(rangeStart), cloneDate(rangeEnd), function(events) { callback(events); popLoading(); }); } else if ($.isArray(events)) { callback(events); } else { callback(); } }else{ var url = source.url; if (url) { var success = source.success; var error = source.error; var complete = source.complete; var data = $.extend({}, source.data || {}); var startParam = firstDefined(source.startParam, options.startParam); var endParam = firstDefined(source.endParam, options.endParam); if (startParam) { data[startParam] = Math.round(+rangeStart / 1000); } if (endParam) { data[endParam] = Math.round(+rangeEnd / 1000); } pushLoading(); $.ajax($.extend({}, ajaxDefaults, source, { data: data, success: function(events) { events = events || []; var res = applyAll(success, this, arguments); if ($.isArray(res)) { events = res; } callback(events); }, error: function() { applyAll(error, this, arguments); callback(); }, complete: function() { applyAll(complete, this, arguments); popLoading(); } })); }else{ callback(); } } } /* Sources -----------------------------------------------------------------------------*/ function addEventSource(source) { source = _addEventSource(source); if (source) { pendingSourceCnt++; fetchEventSource(source, currentFetchID); // will eventually call reportEvents } } function _addEventSource(source) { if ($.isFunction(source) || $.isArray(source)) { source = { events: source }; } else if (typeof source == 'string') { source = { url: source }; } if (typeof source == 'object') { normalizeSource(source); sources.push(source); return source; } } function removeEventSource(source) { sources = $.grep(sources, function(src) { return !isSourcesEqual(src, source); }); // remove all client events from that source cache = $.grep(cache, function(e) { return !isSourcesEqual(e.source, source); }); reportEvents(cache); } /* Manipulation -----------------------------------------------------------------------------*/ function updateEvent(event) { // update an existing event var i, len = cache.length, e, defaultEventEnd = getView().defaultEventEnd, // getView??? startDelta = event.start - event._start, endDelta = event.end ? (event.end - (event._end || defaultEventEnd(event))) // event._end would be null if event.end : 0; // was null and event was just resized for (i=0; i<len; i++) { e = cache[i]; if (e._id == event._id && e != event) { e.start = new Date(+e.start + startDelta); if (event.end) { if (e.end) { e.end = new Date(+e.end + endDelta); }else{ e.end = new Date(+defaultEventEnd(e) + endDelta); } }else{ e.end = null; } e.title = event.title; e.url = event.url; e.allDay = event.allDay; e.className = event.className; e.editable = event.editable; e.color = event.color; e.backgroudColor = event.backgroudColor; e.borderColor = event.borderColor; e.textColor = event.textColor; normalizeEvent(e); } } normalizeEvent(event); reportEvents(cache); } function renderEvent(event, stick) { normalizeEvent(event); if (!event.source) { if (stick) { stickySource.events.push(event); event.source = stickySource; } cache.push(event); } reportEvents(cache); } function removeEvents(filter) { if (!filter) { // remove all cache = []; // clear all array sources for (var i=0; i<sources.length; i++) { if ($.isArray(sources[i].events)) { sources[i].events = []; } } }else{ if (!$.isFunction(filter)) { // an event ID var id = filter + ''; filter = function(e) { return e._id == id; }; } cache = $.grep(cache, filter, true); // remove events from array sources for (var i=0; i<sources.length; i++) { if ($.isArray(sources[i].events)) { sources[i].events = $.grep(sources[i].events, filter, true); } } } reportEvents(cache); } function clientEvents(filter) { if ($.isFunction(filter)) { return $.grep(cache, filter); } else if (filter) { // an event ID filter += ''; return $.grep(cache, function(e) { return e._id == filter; }); } return cache; // else, return all } /* Loading State -----------------------------------------------------------------------------*/ function pushLoading() { if (!loadingLevel++) { trigger('loading', null, true); } } function popLoading() { if (!--loadingLevel) { trigger('loading', null, false); } } /* Event Normalization -----------------------------------------------------------------------------*/ function normalizeEvent(event) { var source = event.source || {}; var ignoreTimezone = firstDefined(source.ignoreTimezone, options.ignoreTimezone); event._id = event._id || (event.id === undefined ? '_fc' + eventGUID++ : event.id + ''); if (event.date) { if (!event.start) { event.start = event.date; } delete event.date; } event._start = cloneDate(event.start = parseDate(event.start, ignoreTimezone)); event.end = parseDate(event.end, ignoreTimezone); if (event.end && event.end <= event.start) { event.end = null; } event._end = event.end ? cloneDate(event.end) : null; if (event.allDay === undefined) { event.allDay = firstDefined(source.allDayDefault, options.allDayDefault); } if (event.className) { if (typeof event.className == 'string') { event.className = event.className.split(/\s+/); } }else{ event.className = []; } // TODO: if there is no start date, return false to indicate an invalid event } /* Utils ------------------------------------------------------------------------------*/ function normalizeSource(source) { if (source.className) { // TODO: repeat code, same code for event classNames if (typeof source.className == 'string') { source.className = source.className.split(/\s+/); } }else{ source.className = []; } var normalizers = fc.sourceNormalizers; for (var i=0; i<normalizers.length; i++) { normalizers[i](source); } } function isSourcesEqual(source1, source2) { return source1 && source2 && getSourcePrimitive(source1) == getSourcePrimitive(source2); } function getSourcePrimitive(source) { return ((typeof source == 'object') ? (source.events || source.url) : '') || source; } } fc.addDays = addDays; fc.cloneDate = cloneDate; fc.parseDate = parseDate; fc.parseISO8601 = parseISO8601; fc.parseTime = parseTime; fc.formatDate = formatDate; fc.formatDates = formatDates; /* Date Math -----------------------------------------------------------------------------*/ var dayIDs = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'], DAY_MS = 86400000, HOUR_MS = 3600000, MINUTE_MS = 60000; function addYears(d, n, keepTime) { d.setFullYear(d.getFullYear() + n); if (!keepTime) { clearTime(d); } return d; } function addMonths(d, n, keepTime) { // prevents day overflow/underflow if (+d) { // prevent infinite looping on invalid dates var m = d.getMonth() + n, check = cloneDate(d); check.setDate(1); check.setMonth(m); d.setMonth(m); if (!keepTime) { clearTime(d); } while (d.getMonth() != check.getMonth()) { d.setDate(d.getDate() + (d < check ? 1 : -1)); } } return d; } function addDays(d, n, keepTime) { // deals with daylight savings if (+d) { var dd = d.getDate() + n, check = cloneDate(d); check.setHours(9); // set to middle of day check.setDate(dd); d.setDate(dd); if (!keepTime) { clearTime(d); } fixDate(d, check); } return d; } function fixDate(d, check) { // force d to be on check's YMD, for daylight savings purposes if (+d) { // prevent infinite looping on invalid dates while (d.getDate() != check.getDate()) { d.setTime(+d + (d < check ? 1 : -1) * HOUR_MS); } } } function addMinutes(d, n) { d.setMinutes(d.getMinutes() + n); return d; } function clearTime(d) { d.setHours(0); d.setMinutes(0); d.setSeconds(0); d.setMilliseconds(0); return d; } function cloneDate(d, dontKeepTime) { if (dontKeepTime) { return clearTime(new Date(+d)); } return new Date(+d); } function zeroDate() { // returns a Date with time 00:00:00 and dateOfMonth=1 var i=0, d; do { d = new Date(1970, i++, 1); } while (d.getHours()); // != 0 return d; } function skipWeekend(date, inc, excl) { inc = inc || 1; while (!date.getDay() || (excl && date.getDay()==1 || !excl && date.getDay()==6)) { addDays(date, inc); } return date; } function dayDiff(d1, d2) { // d1 - d2 return Math.round((cloneDate(d1, true) - cloneDate(d2, true)) / DAY_MS); } function setYMD(date, y, m, d) { if (y !== undefined && y != date.getFullYear()) { date.setDate(1); date.setMonth(0); date.setFullYear(y); } if (m !== undefined && m != date.getMonth()) { date.setDate(1); date.setMonth(m); } if (d !== undefined) { date.setDate(d); } } /* Date Parsing -----------------------------------------------------------------------------*/ function parseDate(s, ignoreTimezone) { // ignoreTimezone defaults to true if (typeof s == 'object') { // already a Date object return s; } if (typeof s == 'number') { // a UNIX timestamp return new Date(s * 1000); } if (typeof s == 'string') { if (s.match(/^\d+(\.\d+)?$/)) { // a UNIX timestamp return new Date(parseFloat(s) * 1000); } if (ignoreTimezone === undefined) { ignoreTimezone = true; } return parseISO8601(s, ignoreTimezone) || (s ? new Date(s) : null); } // TODO: never return invalid dates (like from new Date(<string>)), return null instead return null; } function parseISO8601(s, ignoreTimezone) { // ignoreTimezone defaults to false // derived from http://delete.me.uk/2005/03/iso8601.html // TODO: for a know glitch/feature, read tests/issue_206_parseDate_dst.html var m = s.match(/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2})(:?([0-9]{2}))?))?)?)?)?$/); if (!m) { return null; } var date = new Date(m[1], 0, 1); if (ignoreTimezone || !m[13]) { var check = new Date(m[1], 0, 1, 9, 0); if (m[3]) { date.setMonth(m[3] - 1); check.setMonth(m[3] - 1); } if (m[5]) { date.setDate(m[5]); check.setDate(m[5]); } fixDate(date, check); if (m[7]) { date.setHours(m[7]); } if (m[8]) { date.setMinutes(m[8]); } if (m[10]) { date.setSeconds(m[10]); } if (m[12]) { date.setMilliseconds(Number("0." + m[12]) * 1000); } fixDate(date, check); }else{ date.setUTCFullYear( m[1], m[3] ? m[3] - 1 : 0, m[5] || 1 ); date.setUTCHours( m[7] || 0, m[8] || 0, m[10] || 0, m[12] ? Number("0." + m[12]) * 1000 : 0 ); if (m[14]) { var offset = Number(m[16]) * 60 + (m[18] ? Number(m[18]) : 0); offset *= m[15] == '-' ? 1 : -1; date = new Date(+date + (offset * 60 * 1000)); } } return date; } function parseTime(s) { // returns minutes since start of day if (typeof s == 'number') { // an hour return s * 60; } if (typeof s == 'object') { // a Date object return s.getHours() * 60 + s.getMinutes(); } var m = s.match(/(\d+)(?::(\d+))?\s*(\w+)?/); if (m) { var h = parseInt(m[1], 10); if (m[3]) { h %= 12; if (m[3].toLowerCase().charAt(0) == 'p') { h += 12; } } return h * 60 + (m[2] ? parseInt(m[2], 10) : 0); } } /* Date Formatting -----------------------------------------------------------------------------*/ // TODO: use same function formatDate(date, [date2], format, [options]) function formatDate(date, format, options) { return formatDates(date, null, format, options); } function formatDates(date1, date2, format, options) { options = options || defaults; var date = date1, otherDate = date2, i, len = format.length, c, i2, formatter, res = ''; for (i=0; i<len; i++) { c = format.charAt(i); if (c == "'") { for (i2=i+1; i2<len; i2++) { if (format.charAt(i2) == "'") { if (date) { if (i2 == i+1) { res += "'"; }else{ res += format.substring(i+1, i2); } i = i2; } break; } } } else if (c == '(') { for (i2=i+1; i2<len; i2++) { if (format.charAt(i2) == ')') { var subres = formatDate(date, format.substring(i+1, i2), options); if (parseInt(subres.replace(/\D/, ''), 10)) { res += subres; } i = i2; break; } } } else if (c == '[') { for (i2=i+1; i2<len; i2++) { if (format.charAt(i2) == ']') { var subformat = format.substring(i+1, i2); var subres = formatDate(date, subformat, options); if (subres != formatDate(otherDate, subformat, options)) { res += subres; } i = i2; break; } } } else if (c == '{') { date = date2; otherDate = date1; } else if (c == '}') { date = date1; otherDate = date2; } else { for (i2=len; i2>i; i2--) { if (formatter = dateFormatters[format.substring(i, i2)]) { if (date) { res += formatter(date, options); } i = i2 - 1; break; } } if (i2 == i) { if (date) { res += c; } } } } return res; }; var dateFormatters = { s : function(d) { return d.getSeconds() }, ss : function(d) { return zeroPad(d.getSeconds()) }, m : function(d) { return d.getMinutes() }, mm : function(d) { return zeroPad(d.getMinutes()) }, h : function(d) { return d.getHours() % 12 || 12 }, hh : function(d) { return zeroPad(d.getHours() % 12 || 12) }, H : function(d) { return d.getHours() }, HH : function(d) { return zeroPad(d.getHours()) }, d : function(d) { return d.getDate() }, dd : function(d) { return zeroPad(d.getDate()) }, ddd : function(d,o) { return o.dayNamesShort[d.getDay()] }, e : function(d,o) { return o.dayNamesShortest[d.getDay()] }, //add by Kebin ----> 5 dddd: function(d,o) { return o.dayNames[d.getDay()] }, M : function(d) { return d.getMonth() + 1 }, MM : function(d) { return zeroPad(d.getMonth() + 1) }, MMM : function(d,o) { return o.monthNamesShort[d.getMonth()] }, MMMM: function(d,o) { return o.monthNames[d.getMonth()] }, yy : function(d) { return (d.getFullYear()+'').substring(2) }, yyyy: function(d) { return d.getFullYear() }, t : function(d) { return d.getHours() < 12 ? 'a' : 'p' }, tt : function(d) { return d.getHours() < 12 ? 'am' : 'pm' }, T : function(d) { return d.getHours() < 12 ? 'A' : 'P' }, TT : function(d) { return d.getHours() < 12 ? 'AM' : 'PM' }, u : function(d) { return formatDate(d, "yyyy-MM-dd'T'HH:mm:ss'Z'") }, S : function(d) { var date = d.getDate(); if (date > 10 && date < 20) { return 'th'; } return ['st', 'nd', 'rd'][date%10-1] || 'th'; } }; fc.applyAll = applyAll; /* Event Date Math -----------------------------------------------------------------------------*/ function exclEndDay(event) { if (event.end) { return _exclEndDay(event.end, event.allDay); }else{ return addDays(cloneDate(event.start), 1); } } function _exclEndDay(end, allDay) { end = cloneDate(end); return allDay || end.getHours() || end.getMinutes() ? addDays(end, 1) : clearTime(end); } function segCmp(a, b) { return (b.msLength - a.msLength) * 100 + (a.event.start - b.event.start); } function segsCollide(seg1, seg2) { return seg1.end > seg2.start && seg1.start < seg2.end; } /* Event Sorting -----------------------------------------------------------------------------*/ // event rendering utilities function sliceSegs(events, visEventEnds, start, end) { var segs = [], i, len=events.length, event, eventStart, eventEnd, segStart, segEnd, isStart, isEnd; for (i=0; i<len; i++) { event = events[i]; eventStart = event.start; eventEnd = visEventEnds[i]; if (eventEnd > start && eventStart < end) { if (eventStart < start) { segStart = cloneDate(start); isStart = false; }else{ segStart = eventStart; isStart = true; } if (eventEnd > end) { segEnd = cloneDate(end); isEnd = false; }else{ segEnd = eventEnd; isEnd = true; } segs.push({ event: event, start: segStart, end: segEnd, isStart: isStart, isEnd: isEnd, msLength: segEnd - segStart }); } } return segs.sort(segCmp); } // event rendering calculation utilities function stackSegs(segs) { var levels = [], i, len = segs.length, seg, j, collide, k; for (i=0; i<len; i++) { seg = segs[i]; j = 0; // the level index where seg should belong while (true) { collide = false; if (levels[j]) { for (k=0; k<levels[j].length; k++) { if (segsCollide(levels[j][k], seg)) { collide = true; break; } } } if (collide) { j++; }else{ break; } } if (levels[j]) { levels[j].push(seg); }else{ levels[j] = [seg]; } } return levels; } /* Event Element Binding -----------------------------------------------------------------------------*/ function lazySegBind(container, segs, bindHandlers) { container.unbind('mouseover').mouseover(function(ev) { var parent=ev.target, e, i, seg; while (parent != this) { e = parent; parent = parent.parentNode; } if ((i = e._fci) !== undefined) { e._fci = undefined; seg = segs[i]; bindHandlers(seg.event, seg.element, seg); $(ev.target).trigger(ev); } ev.stopPropagation(); }); } /* Element Dimensions -----------------------------------------------------------------------------*/ function setOuterWidth(element, width, includeMargins) { for (var i=0, e; i<element.length; i++) { e = $(element[i]); e.width(Math.max(0, width - hsides(e, includeMargins))); } } function setOuterHeight(element, height, includeMargins) { for (var i=0, e; i<element.length; i++) { e = $(element[i]); e.height(Math.max(0, height - vsides(e, includeMargins))); } } // TODO: curCSS has been deprecated (jQuery 1.4.3 - 10/16/2010) function hsides(element, includeMargins) { return hpadding(element) + hborders(element) + (includeMargins ? hmargins(element) : 0); } function hpadding(element) { return (parseFloat($.curCSS(element[0], 'paddingLeft', true)) || 0) + (parseFloat($.curCSS(element[0], 'paddingRight', true)) || 0); } function hmargins(element) { return (parseFloat($.curCSS(element[0], 'marginLeft', true)) || 0) + (parseFloat($.curCSS(element[0], 'marginRight', true)) || 0); } function hborders(element) { return (parseFloat($.curCSS(element[0], 'borderLeftWidth', true)) || 0) + (parseFloat($.curCSS(element[0], 'borderRightWidth', true)) || 0); } function vsides(element, includeMargins) { return vpadding(element) + vborders(element) + (includeMargins ? vmargins(element) : 0); } function vpadding(element) { return (parseFloat($.curCSS(element[0], 'paddingTop', true)) || 0) + (parseFloat($.curCSS(element[0], 'paddingBottom', true)) || 0); } function vmargins(element) { return (parseFloat($.curCSS(element[0], 'marginTop', true)) || 0) + (parseFloat($.curCSS(element[0], 'marginBottom', true)) || 0); } function vborders(element) { return (parseFloat($.curCSS(element[0], 'borderTopWidth', true)) || 0) + (parseFloat($.curCSS(element[0], 'borderBottomWidth', true)) || 0); } function setMinHeight(element, height) { height = (typeof height == 'number' ? height + 'px' : height); element.each(function(i, _element) { _element.style.cssText += ';min-height:' + height + ';_height:' + height; // why can't we just use .css() ? i forget }); } /* Misc Utils -----------------------------------------------------------------------------*/ //TODO: arraySlice //TODO: isFunction, grep ? function noop() { } function cmp(a, b) { return a - b; } function arrayMax(a) { return Math.max.apply(Math, a); } function zeroPad(n) { return (n < 10 ? '0' : '') + n; } function smartProperty(obj, name) { // get a camel-cased/namespaced property of an object if (obj[name] !== undefined) { return obj[name]; } var parts = name.split(/(?=[A-Z])/), i=parts.length-1, res; for (; i>=0; i--) { res = obj[parts[i].toLowerCase()]; if (res !== undefined) { return res; } } return obj['']; } function htmlEscape(s) { return s.replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/'/g, '&#039;') .replace(/"/g, '&quot;') .replace(/\n/g, '<br />'); } function cssKey(_element) { return _element.id + '/' + _element.className + '/' + _element.style.cssText.replace(/(^|;)\s*(top|left|width|height)\s*:[^;]*/ig, ''); } function disableTextSelection(element) { element .attr('unselectable', 'on') .css('MozUserSelect', 'none') .bind('selectstart.ui', function() { return false; }); } /* function enableTextSelection(element) { element .attr('unselectable', 'off') .css('MozUserSelect', '') .unbind('selectstart.ui'); } */ function markFirstLast(e) { e.children() .removeClass('fc-first fc-last') .filter(':first-child') .addClass('fc-first') .end() .filter(':last-child') .addClass('fc-last'); } function setDayID(cell, date) { cell.each(function(i, _cell) { _cell.className = _cell.className.replace(/^fc-\w*/, 'fc-' + dayIDs[date.getDay()]); // TODO: make a way that doesn't rely on order of classes }); } function getSkinCss(event, opt) { var source = event.source || {}; var eventColor = event.color; var sourceColor = source.color; var optionColor = opt('eventColor'); var backgroundColor = event.backgroundColor || eventColor || source.backgroundColor || sourceColor || opt('eventBackgroundColor') || optionColor; var borderColor = event.borderColor || eventColor || source.borderColor || sourceColor || opt('eventBorderColor') || optionColor; var textColor = event.textColor || source.textColor || opt('eventTextColor'); var statements = []; if (backgroundColor) { statements.push('background-color:' + backgroundColor); } if (borderColor) { statements.push('border-color:' + borderColor); } if (textColor) { statements.push('color:' + textColor); } return statements.join(';'); } function applyAll(functions, thisObj, args) { if ($.isFunction(functions)) { functions = [ functions ]; } if (functions) { var i; var ret; for (i=0; i<functions.length; i++) { ret = functions[i].apply(thisObj, args) || ret; } return ret; } } function firstDefined() { for (var i=0; i<arguments.length; i++) { if (arguments[i] !== undefined) { return arguments[i]; } } } //Year View Start ---------------------------------------------------------------------------------- //add by kebin --> 6 fcViews.year = YearView; function YearView(element, calendar) { var t = this; // exports t.render = render; // imports BasicYearView.call(t, element, calendar, 'year'); var opt = t.opt; var renderYear = t.renderYear; var formatDate = calendar.formatDate; function render(date, delta) { if (delta) { //addYears(date, delta); t.curYear = addYears(date, delta); } var start = cloneDate(date, true); //start.setDate(1); start.setFullYear(start.getFullYear(),0,1); var end = cloneDate(date); end.setFullYear(end.getFullYear(), 11,31); var visStart = cloneDate(start); //set startDay var visEnd = cloneDate(end); var nwe = opt('weekends') ? 0 : 1; var colAndRow = '4x3'; //'2x6', '3x4', '4x3' 3 types t.title = formatDate(start, opt('titleFormat')); t.start = start; t.end = end; t.visStart = visStart; t.visEnd = visEnd; renderYear(colAndRow, 6, nwe ? 5 : 7, true); } } function BasicYearView(element, calendar, viewName) { var t = this; // exports t.renderYear = renderYear; t.setHeight = setHeight; t.setWidth = setWidth; t.renderDayOverlay = renderDayOverlay; t.defaultSelectionEnd = defaultSelectionEnd; t.renderSelection = renderSelection; t.clearSelection = clearSelection; t.reportDayClick = reportDayClick; // for selection (kinda hacky) t.dragStart = dragStart; t.dragStop = dragStop; t.defaultEventEnd = defaultEventEnd; t.getHoverListener = function() { return hoverListener }; t.colContentLeft = colContentLeft; t.colContentRight = colContentRight; t.dayOfWeekCol = dayOfWeekCol; t.dateCell = dateCell; t.cellDate = cellDate; t.cellIsAllDay = function() { return true }; t.allDayRow = allDayRow; t.allDayBounds = allDayBounds; t.getRowCnt = function() {return rowCnt }; t.getColCnt = function() { return colCnt }; t.getColWidth = function() { return colWidth }; t.getBodyRows = function(){return bodyRows}; t.getDaySegmentContainer = function() { return daySegmentContainer }; // imports View.call(t, element, calendar, viewName); OverlayManager.call(t); SelectionManager.call(t); BasicYearEventRenderer.call(t); var opt = t.opt; var trigger = t.trigger; var clearEvents = t.clearEvents; var renderOverlay = t.renderOverlay; var clearOverlays = t.clearOverlays; var daySelectionMousedown = t.daySelectionMousedown; var formatDate = calendar.formatDate; // locals var table; var head; var headCells; //var body; var bodyRows; //var mainBody; var subTables; var bodyCells; //var bodyFirstCells; //var bodyCellTopInners; var daySegmentContainer; var viewWidth; var viewHeight; var colWidth; var rowCnt, colCnt; var coordinateGrid; var hoverListener; var colContentPositions; var rtl, dis, dit; var firstDay; var nwe; var tm; //var colFormat; /* Rendering ------------------------------------------------------------*/ disableTextSelection(element.addClass('fc-grid')); function renderYear(maxr, r, c, showNumbers) { rowCnt = r; colCnt = c; updateOptions(); var firstTime = !table; if (firstTime) { buildSkeleton(maxr, showNumbers); }else{ clearEvents(); } updateCells(firstTime); } function updateOptions() { rtl = opt('isRTL'); if (rtl) { dis = -1; dit = colCnt - 1; }else{ dis = 1; dit = 0; } firstDay = opt('firstDay'); nwe = opt('weekends') ? 0 : 1; tm = opt('theme') ? 'ui' : 'fc'; colFormat = opt('columnFormat'); } function buildSkeleton(maxRowCnt, showNumbers) { var s; var headerClass = tm + "-widget-header"; var contentClass = tm + "-widget-content"; var i, j; var dayStr; var di = cloneDate(t.start); var localWeekNames = defaults.dayNamesShortest; //['S','M','T','W','T','F','S']; var localMonthNames = defaults.monthNames; //['January','February','March','April','May','June','July','August','September','October','November','December']; s ="<table class='fc-border-separate fc-year-main-table' style='width:100%'><tr >"; for(var mi=0; mi<12; mi++){ di.setFullYear(di.getFullYear(),mi,1); di.setFullYear(di.getFullYear(),mi,1-di.getDay()); if(mi%3==0 && mi > 0) s+="</tr><tr>"; s +="<td class='fc-year-monthly-td ui-widget'>"; s+="<table class='ui-widget' style='width:100%' cellspacing='0'>"+ "<thead>"+ "<tr><th colspan='7' class='fc-year-monthly-header "+headerClass +"' style='height:18px'>"+localMonthNames[mi]+"</th></tr>"+ "<tr>"; for (i=0; i<colCnt; i++) { s +="<th class='fc-year-month-weekly-head'>"+ localWeekNames[i]+"</th>"; // need fc- for setDayID } s +="</tr>" + "</thead>" + "<tbody>"; for (i=0; i<6; i++) { s +="<tr class='ui-widget-content fc-week" + i + "'>"; for (j=0; j<colCnt; j++) { if(di.getMonth()== mi){ dayStr=formatDate(di, '-yyyy-MM-dd'); }else{ dayStr=""; } s +="<td style='height:32px' class='fc- " + contentClass + " fc-day" + dayStr + "'>" + // need fc- for setDayID "<div>" + (showNumbers ? "<div class='fc-day-number'/>" : '' ) + "<div class='fc-day-content'>" + "</div>" + "</div>" + "</td>"; addDays(di, 1); } s +="</tr>"; } s +="</tbody>" + "</table>"; s+="</td>"; } s+="</tr></table>"; table = $(s).appendTo(element); head = table.find('thead'); headCells = head.find('th'); //mainBody = table.find('tbody table'); subTables = table.find('table'); //subTables.each( function(x, _sub){ // }); bodyRows = table.find('table tr td'); //bodyCells = body.find('td'); //bodyFirstCells = bodyCells.filter(':first-child'); //bodyCellTopInners = bodyRows.eq(0).find('div.fc-day-content div'); //markFirstLast(head.add(head.find('tr'))); // marks first+last tr/th's //markFirstLast(bodyRows); // marks first+last td's //bodyRows.eq(0).addClass('fc-first'); // fc-last is done in updateCells dayBind(bodyRows); daySegmentContainer =$("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(element); } function updateCells(firstTime) { //var startYear = t.start.getFullYear(); var today = clearTime(new Date()); var cell; //var date; //var row; subTables.each(function(i, _sub){ if ( !t.curYear ) t.curYear = t.start; var d = cloneDate(t.start); d.setFullYear(d.getFullYear(),i,1); d.setFullYear(d.getFullYear(),i,1-d.getDay()); $(_sub).find('td').each(function(ii, _cell) { var dayStr; cell = $(_cell); if (d.getMonth() == i) { cell.removeClass('fc-other-month'); dayStr=formatDate(d, '-yyyy-MM-dd'); }else{ cell.addClass('fc-other-month'); dayStr=" ui-state-disabled"; } if (+d == +today && d.getMonth() == i) { cell.addClass(tm + '-state-highlight fc-today'); }else{ cell.removeClass(tm + '-state-highlight fc-today'); } //cell.find('div.fc-day-number').text(d.getDate()); var $div = cell.find('div.fc-day-number'); $div.text(d.getDate()); $div.parent().parent().addClass(tm+"-widget-content fc-day" + dayStr); addDays(d, 1); }); }); bodyRows.filter('.fc-year-have-event').removeClass('fc-year-have-event ui-state-default'); } function setHeight(height) { viewHeight = height; var bodyHeight = viewHeight - head.height(); //var rowHeight; //var rowHeightLast; //var cell; var bh = table.parent().height(bodyHeight); bh.css("overflow-y","auto"); /* if (opt('weekMode') == 'variable') { rowHeight = rowHeightLast = Math.floor(bodyHeight / (rowCnt==1 ? 2 : 6)); }else{ rowHeight = Math.floor(bodyHeight / rowCnt); rowHeightLast = bodyHeight - rowHeight * (rowCnt-1); } bodyFirstCells.each(function(i, _cell) { if (i < rowCnt) { cell = $(_cell); setMinHeight( cell.find('> div'), (i==rowCnt-1 ? rowHeightLast : rowHeight) - vsides(cell) ); } }); */ } function setWidth(width) { /* viewWidth = width; colContentPositions.clear(); colWidth = Math.floor(viewWidth / colCnt); setOuterWidth(headCells.slice(0, -1), colWidth); */ } /* Day clicking and binding -----------------------------------------------------------*/ function dayBind(days) { days.click(dayClick).mousedown(daySelectionMousedown); } function dayClick(ev) { if (opt('selectable')) { // if selectable, SelectionManager will worry about dayClick var pos = this.className.search("fc-day-"), date; if(pos != -1 ) { date = this.className.substring(pos+7, pos+7+10); } else { return ; } //= parseInt(this.className.match(/fc\-day(\d+)/)[1]); // TODO: maybe use .data var da = date.split("-"); date = new Date(da[0], parseInt(da[1])-1, da[2], 0, 0, 0); trigger('reportDayClick', this, date, true, ev); } } /* Semi-transparent Overlay Helpers ------------------------------------------------------*/ function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive if (refreshCoordinateGrid) { coordinateGrid.build(); } var rowStart = cloneDate(t.visStart); var rowEnd = addDays(cloneDate(rowStart), colCnt); for (var i=0; i<rowCnt; i++) { var stretchStart = new Date(Math.max(rowStart, overlayStart)); var stretchEnd = new Date(Math.min(rowEnd, overlayEnd)); if (stretchStart < stretchEnd) { var colStart, colEnd; if (rtl) { colStart = dayDiff(stretchEnd, rowStart)*dis+dit+1; colEnd = dayDiff(stretchStart, rowStart)*dis+dit+1; }else{ colStart = dayDiff(stretchStart, rowStart); colEnd = dayDiff(stretchEnd, rowStart); } dayBind( renderCellOverlay(i, colStart, i, colEnd-1) ); } addDays(rowStart, 7); addDays(rowEnd, 7); } } function renderCellOverlay(row0, col0, row1, col1) { // row1,col1 is inclusive var rect = coordinateGrid.rect(row0, col0, row1, col1, element); return renderOverlay(rect, element); } /* Selection -----------------------------------------------------------------------*/ function defaultSelectionEnd(startDate, allDay) { return cloneDate(startDate); } function renderSelection(startDate, endDate, allDay) { renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); // rebuild every time??? } function clearSelection() { clearOverlays(); } function reportDayClick(date, allDay, ev) { var cell = dateCell(date); var _element = bodyCells[cell.row*colCnt + cell.col]; trigger('dayClick', _element, date, allDay, ev); } /* External Dragging -----------------------------------------------------------------------*/ function dragStart(_dragElement, ev, ui) { hoverListener.start(function(cell) { clearOverlays(); if (cell) { renderCellOverlay(cell.row, cell.col, cell.row, cell.col); } }, ev); } function dragStop(_dragElement, ev, ui) { var cell = hoverListener.stop(); clearOverlays(); if (cell) { var d = cellDate(cell); trigger('drop', _dragElement, d, true, ev, ui); } } /* Utilities --------------------------------------------------------*/ function defaultEventEnd(event) { return cloneDate(event.start); } coordinateGrid = new CoordinateGrid(function(rows, cols) { var e, n, p; headCells.each(function(i, _e) { e = $(_e); n = e.offset().left; if (i) { p[1] = n; } p = [n]; cols[i] = p; }); p[1] = n + e.outerWidth(); bodyRows.each(function(i, _e) { if (i < rowCnt) { e = $(_e); n = e.offset().top; if (i) { p[1] = n; } p = [n]; rows[i] = p; } }); p[1] = n + e.outerHeight(); }); hoverListener = new HoverListener(coordinateGrid); colContentPositions = new HorizontalPositionCache(function(col) { return bodyCellTopInners.eq(col); }); function colContentLeft(col) { return colContentPositions.left(col); } function colContentRight(col) { return colContentPositions.right(col); } function dateCell(date) { return { row: Math.floor(dayDiff(date, t.visStart) / 7), col: dayOfWeekCol(date.getDay()) }; } function cellDate(cell) { return _cellDate(cell.row, cell.col); } function _cellDate(row, col) { return addDays(cloneDate(t.visStart), row*7 + col*dis+dit); // what about weekends in middle of week? } function indexDate(index) { return _cellDate(Math.floor(index/colCnt), index%colCnt); } function dayOfWeekCol(dayOfWeek) { return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt) * dis + dit; } function allDayRow(i) { return bodyRows.eq(i); } function allDayBounds(i) { return { left: 0, right: viewWidth }; } } function BasicYearEventRenderer() { var t = this; // exports t.renderEvents = renderEvents; t.compileDaySegs = compileSegs; // for DayEventRenderer t.clearEvents = clearEvents; t.bindDaySeg = bindDaySeg; // imports DayEventRenderer.call(t); var opt = t.opt; var trigger = t.trigger; //var setOverflowHidden = t.setOverflowHidden; var isEventDraggable = t.isEventDraggable; var isEventResizable = t.isEventResizable; var reportEvents = t.reportEvents; var reportEventClear = t.reportEventClear; var eventElementHandlers = t.eventElementHandlers; var showEvents = t.showEvents; var hideEvents = t.hideEvents; var eventDrop = t.eventDrop; var getDaySegmentContainer = t.getDaySegmentContainer; var getHoverListener = t.getHoverListener; var renderDayOverlay = t.renderDayOverlay; var clearOverlays = t.clearOverlays; var getRowCnt = t.getRowCnt; var getColCnt = t.getColCnt; var getBodyRows = t.getBodyRows; //var renderDaySegs = t.renderDaySegs; var resizableDayEvent = t.resizableDayEvent; /* Rendering --------------------------------------------------------------------*/ function renderEvents(events, modifiedEventId) { reportEvents(events); renderDaySegs(compileSegs(events), modifiedEventId); } function clearEvents() { reportEventClear(); getDaySegmentContainer().empty(); } function compileSegs(events) { //var rowCnt = getRowCnt(), //colCnt = getColCnt(), var d1 = cloneDate(t.visStart), d2 = cloneDate(t.visEnd), visEventsEnds = $.map(events, exclEndDay), i, row, j, level, k, seg, segs=[]; row = stackSegs(sliceSegs(events, visEventsEnds, d1, d2)); for (j=0; j<row.length; j++) { level = row[j]; for (k=0; k<level.length; k++) { seg = level[k]; seg.row = i; seg.level = j; // not needed anymore segs.push(seg); } } return segs; } function sliceSegs(events, visEventEnds, start, end) { var segs = [], i, len=events.length, event, eventStart, eventEnd, segStart, segEnd, isStart, isEnd; for (i=0; i<len; i++) { event = events[i]; eventStart = event.start; eventEnd = visEventEnds[i]; if (eventEnd > start && eventStart < end) { if (eventStart < start) { segStart = cloneDate(start); isStart = false; }else{ segStart = eventStart; isStart = true; } if (eventEnd > end) { segEnd = cloneDate(end); isEnd = false; }else{ segEnd = eventEnd; isEnd = true; } segs.push({ event: event, start: segStart, end: segEnd, isStart: isStart, isEnd: isEnd, msLength: segEnd - segStart }); } } return segs.sort(segCmp); } // event rendering calculation utilities function stackSegs(segs) { var levels = [], i, len = segs.length, seg, j, collide, k; for (i=0; i<len; i++) { seg = segs[i]; j = 0; // the level index where seg should belong while (true) { collide = false; if (levels[j]) { for (k=0; k<levels[j].length; k++) { if (segsCollide(levels[j][k], seg)) { collide = true; break; } } } if (collide) { j++; }else{ break; } } if (levels[j]) { levels[j].push(seg); }else{ levels[j] = [seg]; } } return levels; } function bindDaySeg(event, eventElement, seg) { if (isEventDraggable(event)) { draggableDayEvent(event, eventElement); } if (seg.isEnd && isEventResizable(event)) { resizableDayEvent(event, eventElement, seg); } eventElementHandlers(event, eventElement); // needs to be after, because resizableDayEvent might stopImmediatePropagation on click } function renderDaySegs(segs, modifiedEventId) { try{ //var segCnt = segs.length; var rowsTd = getBodyRows(); //alert(rowsTd.find('td.fc-day-1-1')); /* rowsTd.each(function(i,_td){ alert(_td.className.match('\\d{4}-\\d{2}-\\d{2}')); $(_td).css(); }); */ $('div.fc-day-content',rowsTd).html(""); rowsTd.filter('td.fc-year-have-event').removeClass('fc-year-have-event ui-state-default'); var cellcnt; for(var i=0;i<segs.length;i++){ var sd = cloneDate(segs[i].start); while(sd.getTime() < segs[i].end.getTime()){ cellcnt = rowsTd.filter('.fc-day-'+formatDate(segs[i].start, 'yyyy-MM-dd')); cellcnt.addClass('fc-year-have-event ui-state-default'); var fcdayc = $("div.fc-day-content", cellcnt).html(); if($.trim(fcdayc) != "") { $("div.fc-day-content", cellcnt).html( parseInt(fcdayc)+1); } else { $("div.fc-day-content", cellcnt).html( "1" ); } addDays(sd,1); } } }catch(e){ alert("MyrenderDaySegs:"+e); } } /* Dragging ----------------------------------------------------------------------------*/ function draggableDayEvent(event, eventElement) { var hoverListener = getHoverListener(); var dayDelta; eventElement.draggable({ zIndex: 9, delay: 50, opacity: opt('dragOpacity'), revertDuration: opt('dragRevertDuration'), start: function(ev, ui) { trigger('eventDragStart', eventElement, event, ev, ui); hideEvents(event, eventElement); hoverListener.start(function(cell, origCell, rowDelta, colDelta) { eventElement.draggable('option', 'revert', !cell || !rowDelta && !colDelta); clearOverlays(); if (cell) { //setOverflowHidden(true); dayDelta = rowDelta*7 + colDelta * (opt('isRTL') ? -1 : 1); renderDayOverlay( addDays(cloneDate(event.start), dayDelta), addDays(exclEndDay(event), dayDelta) ); }else{ //setOverflowHidden(false); dayDelta = 0; } }, ev, 'drag'); }, stop: function(ev, ui) { hoverListener.stop(); clearOverlays(); trigger('eventDragStop', eventElement, event, ev, ui); if (dayDelta) { eventDrop(this, event, dayDelta, 0, event.allDay, ev, ui); }else{ eventElement.css('filter', ''); // clear IE opacity side-effects showEvents(event, eventElement); } //setOverflowHidden(false); } }); } } // Year View END ---------------------------------------------------------------------------------- fcViews.month = MonthView; function MonthView(element, calendar) { var t = this; // exports t.render = render; // imports BasicView.call(t, element, calendar, 'month'); var opt = t.opt; var renderBasic = t.renderBasic; var formatDate = calendar.formatDate; function render(date, delta) { if (delta) { addMonths(date, delta); date.setDate(1); } var start = cloneDate(date, true); start.setDate(1); var end = addMonths(cloneDate(start), 1); var visStart = cloneDate(start); var visEnd = cloneDate(end); var firstDay = opt('firstDay'); var nwe = opt('weekends') ? 0 : 1; if (nwe) { skipWeekend(visStart); skipWeekend(visEnd, -1, true); } addDays(visStart, -((visStart.getDay() - Math.max(firstDay, nwe) + 7) % 7)); addDays(visEnd, (7 - visEnd.getDay() + Math.max(firstDay, nwe)) % 7); var rowCnt = Math.round((visEnd - visStart) / (DAY_MS * 7)); if (opt('weekMode') == 'fixed') { addDays(visEnd, (6 - rowCnt) * 7); rowCnt = 6; } t.title = formatDate(start, opt('titleFormat')); t.start = start; t.end = end; t.visStart = visStart; t.visEnd = visEnd; renderBasic(6, rowCnt, nwe ? 5 : 7, true); } } fcViews.basicWeek = BasicWeekView; function BasicWeekView(element, calendar) { var t = this; // exports t.render = render; // imports BasicView.call(t, element, calendar, 'basicWeek'); var opt = t.opt; var renderBasic = t.renderBasic; var formatDates = calendar.formatDates; function render(date, delta) { if (delta) { addDays(date, delta * 7); } var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7)); var end = addDays(cloneDate(start), 7); var visStart = cloneDate(start); var visEnd = cloneDate(end); var weekends = opt('weekends'); if (!weekends) { skipWeekend(visStart); skipWeekend(visEnd, -1, true); } t.title = formatDates( visStart, addDays(cloneDate(visEnd), -1), opt('titleFormat') ); t.start = start; t.end = end; t.visStart = visStart; t.visEnd = visEnd; renderBasic(1, 1, weekends ? 7 : 5, false); } } fcViews.basicDay = BasicDayView; //TODO: when calendar's date starts out on a weekend, shouldn't happen function BasicDayView(element, calendar) { var t = this; // exports t.render = render; // imports BasicView.call(t, element, calendar, 'basicDay'); var opt = t.opt; var renderBasic = t.renderBasic; var formatDate = calendar.formatDate; function render(date, delta) { if (delta) { addDays(date, delta); if (!opt('weekends')) { skipWeekend(date, delta < 0 ? -1 : 1); } } t.title = formatDate(date, opt('titleFormat')); t.start = t.visStart = cloneDate(date, true); t.end = t.visEnd = addDays(cloneDate(t.start), 1); renderBasic(1, 1, 1, false); } } setDefaults({ weekMode: 'fixed' }); function BasicView(element, calendar, viewName) { var t = this; // exports t.renderBasic = renderBasic; t.setHeight = setHeight; t.setWidth = setWidth; t.renderDayOverlay = renderDayOverlay; t.defaultSelectionEnd = defaultSelectionEnd; t.renderSelection = renderSelection; t.clearSelection = clearSelection; t.reportDayClick = reportDayClick; // for selection (kinda hacky) t.dragStart = dragStart; t.dragStop = dragStop; t.defaultEventEnd = defaultEventEnd; t.getHoverListener = function() { return hoverListener }; t.colContentLeft = colContentLeft; t.colContentRight = colContentRight; t.dayOfWeekCol = dayOfWeekCol; t.dateCell = dateCell; t.cellDate = cellDate; t.cellIsAllDay = function() { return true }; t.allDayRow = allDayRow; t.allDayBounds = allDayBounds; t.getRowCnt = function() { return rowCnt }; t.getColCnt = function() { return colCnt }; t.getColWidth = function() { return colWidth }; t.getDaySegmentContainer = function() { return daySegmentContainer }; // imports View.call(t, element, calendar, viewName); OverlayManager.call(t); SelectionManager.call(t); BasicEventRenderer.call(t); var opt = t.opt; var trigger = t.trigger; var clearEvents = t.clearEvents; var renderOverlay = t.renderOverlay; var clearOverlays = t.clearOverlays; var daySelectionMousedown = t.daySelectionMousedown; var formatDate = calendar.formatDate; // locals var head; var headCells; var body; var bodyRows; var bodyCells; var bodyFirstCells; var bodyCellTopInners; var daySegmentContainer; var viewWidth; var viewHeight; var colWidth; var rowCnt, colCnt; var coordinateGrid; var hoverListener; var colContentPositions; var rtl, dis, dit; var firstDay; var nwe; var tm; var colFormat; /* Rendering ------------------------------------------------------------*/ disableTextSelection(element.addClass('fc-grid')); function renderBasic(maxr, r, c, showNumbers) { rowCnt = r; colCnt = c; updateOptions(); var firstTime = !body; if (firstTime) { buildSkeleton(maxr, showNumbers); }else{ clearEvents(); } updateCells(firstTime); } function updateOptions() { rtl = opt('isRTL'); if (rtl) { dis = -1; dit = colCnt - 1; }else{ dis = 1; dit = 0; } firstDay = opt('firstDay'); nwe = opt('weekends') ? 0 : 1; tm = opt('theme') ? 'ui' : 'fc'; colFormat = opt('columnFormat'); } function buildSkeleton(maxRowCnt, showNumbers) { var s; var headerClass = tm + "-widget-header"; var contentClass = tm + "-widget-content"; var i, j; var table; s = "<table class='fc-border-separate' style='width:100%' cellspacing='0'>" + "<thead>" + "<tr>"; for (i=0; i<colCnt; i++) { s += "<th class='fc- " + headerClass + "'/>"; // need fc- for setDayID } s += "</tr>" + "</thead>" + "<tbody>"; for (i=0; i<maxRowCnt; i++) { s += "<tr class='fc-week" + i + "'>"; for (j=0; j<colCnt; j++) { s += "<td class='fc- " + contentClass + " fc-day" + (i*colCnt+j) + "'>" + // need fc- for setDayID "<div>" + (showNumbers ? "<div class='fc-day-number'/>" : '' ) + "<div class='fc-day-content'>" + "<div style='position:relative'>&nbsp;</div>" + "</div>" + "</div>" + "</td>"; } s += "</tr>"; } s += "</tbody>" + "</table>"; table = $(s).appendTo(element); head = table.find('thead'); headCells = head.find('th'); body = table.find('tbody'); bodyRows = body.find('tr'); bodyCells = body.find('td'); bodyFirstCells = bodyCells.filter(':first-child'); bodyCellTopInners = bodyRows.eq(0).find('div.fc-day-content div'); markFirstLast(head.add(head.find('tr'))); // marks first+last tr/th's markFirstLast(bodyRows); // marks first+last td's bodyRows.eq(0).addClass('fc-first'); // fc-last is done in updateCells dayBind(bodyCells); daySegmentContainer = $("<div style='position:absolute;z-index:8;top:0;left:0'/>") .appendTo(element); } function updateCells(firstTime) { var dowDirty = firstTime || rowCnt == 1; // could the cells' day-of-weeks need updating? var month = t.start.getMonth(); var today = clearTime(new Date()); var cell; var date; var row; if (dowDirty) { headCells.each(function(i, _cell) { cell = $(_cell); date = indexDate(i); cell.html(formatDate(date, colFormat)); setDayID(cell, date); }); } bodyCells.each(function(i, _cell) { cell = $(_cell); date = indexDate(i); if (date.getMonth() == month) { cell.removeClass('fc-other-month'); }else{ cell.addClass('fc-other-month'); } if (+date == +today) { cell.addClass(tm + '-state-highlight fc-today'); }else{ cell.removeClass(tm + '-state-highlight fc-today'); } cell.find('div.fc-day-number').text(date.getDate()); if (dowDirty) { setDayID(cell, date); } }); bodyRows.each(function(i, _row) { row = $(_row); if (i < rowCnt) { row.show(); if (i == rowCnt-1) { row.addClass('fc-last'); }else{ row.removeClass('fc-last'); } }else{ row.hide(); } }); } function setHeight(height) { viewHeight = height; var bodyHeight = viewHeight - head.height(); var rowHeight; var rowHeightLast; var cell; if (opt('weekMode') == 'variable') { rowHeight = rowHeightLast = Math.floor(bodyHeight / (rowCnt==1 ? 2 : 6)); }else{ rowHeight = Math.floor(bodyHeight / rowCnt); rowHeightLast = bodyHeight - rowHeight * (rowCnt-1); } bodyFirstCells.each(function(i, _cell) { if (i < rowCnt) { cell = $(_cell); setMinHeight( cell.find('> div'), (i==rowCnt-1 ? rowHeightLast : rowHeight) - vsides(cell) ); } }); } function setWidth(width) { viewWidth = width; colContentPositions.clear(); colWidth = Math.floor(viewWidth / colCnt); setOuterWidth(headCells.slice(0, -1), colWidth); } /* Day clicking and binding -----------------------------------------------------------*/ function dayBind(days) { days.click(dayClick) .mousedown(daySelectionMousedown); } function dayClick(ev) { if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick var index = parseInt(this.className.match(/fc\-day(\d+)/)[1]); // TODO: maybe use .data var date = indexDate(index); trigger('dayClick', this, date, true, ev); } } /* Semi-transparent Overlay Helpers ------------------------------------------------------*/ function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive if (refreshCoordinateGrid) { coordinateGrid.build(); } var rowStart = cloneDate(t.visStart); var rowEnd = addDays(cloneDate(rowStart), colCnt); for (var i=0; i<rowCnt; i++) { var stretchStart = new Date(Math.max(rowStart, overlayStart)); var stretchEnd = new Date(Math.min(rowEnd, overlayEnd)); if (stretchStart < stretchEnd) { var colStart, colEnd; if (rtl) { colStart = dayDiff(stretchEnd, rowStart)*dis+dit+1; colEnd = dayDiff(stretchStart, rowStart)*dis+dit+1; }else{ colStart = dayDiff(stretchStart, rowStart); colEnd = dayDiff(stretchEnd, rowStart); } dayBind( renderCellOverlay(i, colStart, i, colEnd-1) ); } addDays(rowStart, 7); addDays(rowEnd, 7); } } function renderCellOverlay(row0, col0, row1, col1) { // row1,col1 is inclusive var rect = coordinateGrid.rect(row0, col0, row1, col1, element); return renderOverlay(rect, element); } /* Selection -----------------------------------------------------------------------*/ function defaultSelectionEnd(startDate, allDay) { return cloneDate(startDate); } function renderSelection(startDate, endDate, allDay) { renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); // rebuild every time??? } function clearSelection() { clearOverlays(); } function reportDayClick(date, allDay, ev) { var cell = dateCell(date); var _element = bodyCells[cell.row*colCnt + cell.col]; trigger('dayClick', _element, date, allDay, ev); } /* External Dragging -----------------------------------------------------------------------*/ function dragStart(_dragElement, ev, ui) { hoverListener.start(function(cell) { clearOverlays(); if (cell) { renderCellOverlay(cell.row, cell.col, cell.row, cell.col); } }, ev); } function dragStop(_dragElement, ev, ui) { var cell = hoverListener.stop(); clearOverlays(); if (cell) { var d = cellDate(cell); trigger('drop', _dragElement, d, true, ev, ui); } } /* Utilities --------------------------------------------------------*/ function defaultEventEnd(event) { return cloneDate(event.start); } coordinateGrid = new CoordinateGrid(function(rows, cols) { var e, n, p; headCells.each(function(i, _e) { e = $(_e); n = e.offset().left; if (i) { p[1] = n; } p = [n]; cols[i] = p; }); p[1] = n + e.outerWidth(); bodyRows.each(function(i, _e) { if (i < rowCnt) { e = $(_e); n = e.offset().top; if (i) { p[1] = n; } p = [n]; rows[i] = p; } }); p[1] = n + e.outerHeight(); }); hoverListener = new HoverListener(coordinateGrid); colContentPositions = new HorizontalPositionCache(function(col) { return bodyCellTopInners.eq(col); }); function colContentLeft(col) { return colContentPositions.left(col); } function colContentRight(col) { return colContentPositions.right(col); } function dateCell(date) { return { row: Math.floor(dayDiff(date, t.visStart) / 7), col: dayOfWeekCol(date.getDay()) }; } function cellDate(cell) { return _cellDate(cell.row, cell.col); } function _cellDate(row, col) { return addDays(cloneDate(t.visStart), row*7 + col*dis+dit); // what about weekends in middle of week? } function indexDate(index) { return _cellDate(Math.floor(index/colCnt), index%colCnt); } function dayOfWeekCol(dayOfWeek) { return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt) * dis + dit; } function allDayRow(i) { return bodyRows.eq(i); } function allDayBounds(i) { return { left: 0, right: viewWidth }; } } function BasicEventRenderer() { var t = this; // exports t.renderEvents = renderEvents; t.compileDaySegs = compileSegs; // for DayEventRenderer t.clearEvents = clearEvents; t.bindDaySeg = bindDaySeg; // imports DayEventRenderer.call(t); var opt = t.opt; var trigger = t.trigger; //var setOverflowHidden = t.setOverflowHidden; var isEventDraggable = t.isEventDraggable; var isEventResizable = t.isEventResizable; var reportEvents = t.reportEvents; var reportEventClear = t.reportEventClear; var eventElementHandlers = t.eventElementHandlers; var showEvents = t.showEvents; var hideEvents = t.hideEvents; var eventDrop = t.eventDrop; var getDaySegmentContainer = t.getDaySegmentContainer; var getHoverListener = t.getHoverListener; var renderDayOverlay = t.renderDayOverlay; var clearOverlays = t.clearOverlays; var getRowCnt = t.getRowCnt; var getColCnt = t.getColCnt; var renderDaySegs = t.renderDaySegs; var resizableDayEvent = t.resizableDayEvent; /* Rendering --------------------------------------------------------------------*/ function renderEvents(events, modifiedEventId) { reportEvents(events); renderDaySegs(compileSegs(events), modifiedEventId); } function clearEvents() { reportEventClear(); getDaySegmentContainer().empty(); } function compileSegs(events) { var rowCnt = getRowCnt(), colCnt = getColCnt(), d1 = cloneDate(t.visStart), d2 = addDays(cloneDate(d1), colCnt), visEventsEnds = $.map(events, exclEndDay), i, row, j, level, k, seg, segs=[]; for (i=0; i<rowCnt; i++) { row = stackSegs(sliceSegs(events, visEventsEnds, d1, d2)); for (j=0; j<row.length; j++) { level = row[j]; for (k=0; k<level.length; k++) { seg = level[k]; seg.row = i; seg.level = j; // not needed anymore segs.push(seg); } } addDays(d1, 7); addDays(d2, 7); } return segs; } function bindDaySeg(event, eventElement, seg) { if (isEventDraggable(event)) { draggableDayEvent(event, eventElement); } if (seg.isEnd && isEventResizable(event)) { resizableDayEvent(event, eventElement, seg); } eventElementHandlers(event, eventElement); // needs to be after, because resizableDayEvent might stopImmediatePropagation on click } /* Dragging ----------------------------------------------------------------------------*/ function draggableDayEvent(event, eventElement) { var hoverListener = getHoverListener(); var dayDelta; eventElement.draggable({ zIndex: 9, delay: 50, opacity: opt('dragOpacity'), revertDuration: opt('dragRevertDuration'), start: function(ev, ui) { trigger('eventDragStart', eventElement, event, ev, ui); hideEvents(event, eventElement); hoverListener.start(function(cell, origCell, rowDelta, colDelta) { eventElement.draggable('option', 'revert', !cell || !rowDelta && !colDelta); clearOverlays(); if (cell) { //setOverflowHidden(true); dayDelta = rowDelta*7 + colDelta * (opt('isRTL') ? -1 : 1); renderDayOverlay( addDays(cloneDate(event.start), dayDelta), addDays(exclEndDay(event), dayDelta) ); }else{ //setOverflowHidden(false); dayDelta = 0; } }, ev, 'drag'); }, stop: function(ev, ui) { hoverListener.stop(); clearOverlays(); trigger('eventDragStop', eventElement, event, ev, ui); if (dayDelta) { eventDrop(this, event, dayDelta, 0, event.allDay, ev, ui); }else{ eventElement.css('filter', ''); // clear IE opacity side-effects showEvents(event, eventElement); } //setOverflowHidden(false); } }); } } fcViews.agendaWeek = AgendaWeekView; function AgendaWeekView(element, calendar) { var t = this; // exports t.render = render; // imports AgendaView.call(t, element, calendar, 'agendaWeek'); var opt = t.opt; var renderAgenda = t.renderAgenda; var formatDates = calendar.formatDates; function render(date, delta) { if (delta) { addDays(date, delta * 7); } var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7)); var end = addDays(cloneDate(start), 7); var visStart = cloneDate(start); var visEnd = cloneDate(end); var weekends = opt('weekends'); if (!weekends) { skipWeekend(visStart); skipWeekend(visEnd, -1, true); } t.title = formatDates( visStart, addDays(cloneDate(visEnd), -1), opt('titleFormat') ); t.start = start; t.end = end; t.visStart = visStart; t.visEnd = visEnd; renderAgenda(weekends ? 7 : 5); } } fcViews.agendaDay = AgendaDayView; function AgendaDayView(element, calendar) { var t = this; // exports t.render = render; // imports AgendaView.call(t, element, calendar, 'agendaDay'); var opt = t.opt; var renderAgenda = t.renderAgenda; var formatDate = calendar.formatDate; function render(date, delta) { if (delta) { addDays(date, delta); if (!opt('weekends')) { skipWeekend(date, delta < 0 ? -1 : 1); } } var start = cloneDate(date, true); var end = addDays(cloneDate(start), 1); t.title = formatDate(date, opt('titleFormat')); t.start = t.visStart = start; t.end = t.visEnd = end; renderAgenda(1); } } setDefaults({ allDaySlot: true, allDayText: 'all-day', firstHour: 6, slotMinutes: 30, defaultEventMinutes: 120, axisFormat: 'h(:mm)tt', timeFormat: { agenda: 'h:mm{ - h:mm}' }, dragOpacity: { agenda: .5 }, minTime: 0, maxTime: 24 }); // TODO: make it work in quirks mode (event corners, all-day height) // TODO: test liquid width, especially in IE6 function AgendaView(element, calendar, viewName) { var t = this; // exports t.renderAgenda = renderAgenda; t.setWidth = setWidth; t.setHeight = setHeight; t.beforeHide = beforeHide; t.afterShow = afterShow; t.defaultEventEnd = defaultEventEnd; t.timePosition = timePosition; t.dayOfWeekCol = dayOfWeekCol; t.dateCell = dateCell; t.cellDate = cellDate; t.cellIsAllDay = cellIsAllDay; t.allDayRow = getAllDayRow; t.allDayBounds = allDayBounds; t.getHoverListener = function() { return hoverListener }; t.colContentLeft = colContentLeft; t.colContentRight = colContentRight; t.getDaySegmentContainer = function() { return daySegmentContainer }; t.getSlotSegmentContainer = function() { return slotSegmentContainer }; t.getMinMinute = function() { return minMinute }; t.getMaxMinute = function() { return maxMinute }; t.getBodyContent = function() { return slotContent }; // !!?? t.getRowCnt = function() { return 1 }; t.getColCnt = function() { return colCnt }; t.getColWidth = function() { return colWidth }; t.getSlotHeight = function() { return slotHeight }; t.defaultSelectionEnd = defaultSelectionEnd; t.renderDayOverlay = renderDayOverlay; t.renderSelection = renderSelection; t.clearSelection = clearSelection; t.reportDayClick = reportDayClick; // selection mousedown hack t.dragStart = dragStart; t.dragStop = dragStop; // imports View.call(t, element, calendar, viewName); OverlayManager.call(t); SelectionManager.call(t); AgendaEventRenderer.call(t); var opt = t.opt; var trigger = t.trigger; var clearEvents = t.clearEvents; var renderOverlay = t.renderOverlay; var clearOverlays = t.clearOverlays; var reportSelection = t.reportSelection; var unselect = t.unselect; var daySelectionMousedown = t.daySelectionMousedown; var slotSegHtml = t.slotSegHtml; var formatDate = calendar.formatDate; // locals var dayTable; var dayHead; var dayHeadCells; var dayBody; var dayBodyCells; var dayBodyCellInners; var dayBodyFirstCell; var dayBodyFirstCellStretcher; var slotLayer; var daySegmentContainer; var allDayTable; var allDayRow; var slotScroller; var slotContent; var slotSegmentContainer; var slotTable; var slotTableFirstInner; var axisFirstCells; var gutterCells; var selectionHelper; var viewWidth; var viewHeight; var axisWidth; var colWidth; var gutterWidth; var slotHeight; // TODO: what if slotHeight changes? (see issue 650) var savedScrollTop; var colCnt; var slotCnt; var coordinateGrid; var hoverListener; var colContentPositions; var slotTopCache = {}; var tm; var firstDay; var nwe; // no weekends (int) var rtl, dis, dit; // day index sign / translate var minMinute, maxMinute; var colFormat; /* Rendering -----------------------------------------------------------------------------*/ disableTextSelection(element.addClass('fc-agenda')); function renderAgenda(c) { colCnt = c; updateOptions(); if (!dayTable) { buildSkeleton(); }else{ clearEvents(); } updateCells(); } function updateOptions() { tm = opt('theme') ? 'ui' : 'fc'; nwe = opt('weekends') ? 0 : 1; firstDay = opt('firstDay'); if (rtl = opt('isRTL')) { dis = -1; dit = colCnt - 1; }else{ dis = 1; dit = 0; } minMinute = parseTime(opt('minTime')); maxMinute = parseTime(opt('maxTime')); colFormat = opt('columnFormat'); } function buildSkeleton() { var headerClass = tm + "-widget-header"; var contentClass = tm + "-widget-content"; var s; var i; var d; var maxd; var minutes; var slotNormal = opt('slotMinutes') % 15 == 0; s = "<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'>" + "<thead>" + "<tr>" + "<th class='fc-agenda-axis " + headerClass + "'>&nbsp;</th>"; for (i=0; i<colCnt; i++) { s += "<th class='fc- fc-col" + i + ' ' + headerClass + "'/>"; // fc- needed for setDayID } s += "<th class='fc-agenda-gutter " + headerClass + "'>&nbsp;</th>" + "</tr>" + "</thead>" + "<tbody>" + "<tr>" + "<th class='fc-agenda-axis " + headerClass + "'>&nbsp;</th>"; for (i=0; i<colCnt; i++) { s += "<td class='fc- fc-col" + i + ' ' + contentClass + "'>" + // fc- needed for setDayID "<div>" + "<div class='fc-day-content'>" + "<div style='position:relative'>&nbsp;</div>" + "</div>" + "</div>" + "</td>"; } s += "<td class='fc-agenda-gutter " + contentClass + "'>&nbsp;</td>" + "</tr>" + "</tbody>" + "</table>"; dayTable = $(s).appendTo(element); dayHead = dayTable.find('thead'); dayHeadCells = dayHead.find('th').slice(1, -1); dayBody = dayTable.find('tbody'); dayBodyCells = dayBody.find('td').slice(0, -1); dayBodyCellInners = dayBodyCells.find('div.fc-day-content div'); dayBodyFirstCell = dayBodyCells.eq(0); dayBodyFirstCellStretcher = dayBodyFirstCell.find('> div'); markFirstLast(dayHead.add(dayHead.find('tr'))); markFirstLast(dayBody.add(dayBody.find('tr'))); axisFirstCells = dayHead.find('th:first'); gutterCells = dayTable.find('.fc-agenda-gutter'); slotLayer = $("<div style='position:absolute;z-index:2;left:0;width:100%'/>") .appendTo(element); if (opt('allDaySlot')) { daySegmentContainer = $("<div style='position:absolute;z-index:8;top:0;left:0'/>") .appendTo(slotLayer); s = "<table style='width:100%' class='fc-agenda-allday' cellspacing='0'>" + "<tr>" + "<th class='" + headerClass + " fc-agenda-axis'>" + opt('allDayText') + "</th>" + "<td>" + "<div class='fc-day-content'><div style='position:relative'/></div>" + "</td>" + "<th class='" + headerClass + " fc-agenda-gutter'>&nbsp;</th>" + "</tr>" + "</table>"; allDayTable = $(s).appendTo(slotLayer); allDayRow = allDayTable.find('tr'); dayBind(allDayRow.find('td')); axisFirstCells = axisFirstCells.add(allDayTable.find('th:first')); gutterCells = gutterCells.add(allDayTable.find('th.fc-agenda-gutter')); slotLayer.append( "<div class='fc-agenda-divider " + headerClass + "'>" + "<div class='fc-agenda-divider-inner'/>" + "</div>" ); }else{ daySegmentContainer = $([]); // in jQuery 1.4, we can just do $() } slotScroller = $("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>") .appendTo(slotLayer); slotContent = $("<div style='position:relative;width:100%;overflow:hidden'/>") .appendTo(slotScroller); slotSegmentContainer = $("<div style='position:absolute;z-index:8;top:0;left:0'/>") .appendTo(slotContent); s = "<table class='fc-agenda-slots' style='width:100%' cellspacing='0'>" + "<tbody>"; d = zeroDate(); maxd = addMinutes(cloneDate(d), maxMinute); addMinutes(d, minMinute); slotCnt = 0; for (i=0; d < maxd; i++) { minutes = d.getMinutes(); s += "<tr class='fc-slot" + i + ' ' + (!minutes ? '' : 'fc-minor') + "'>" + "<th class='fc-agenda-axis " + headerClass + "'>" + ((!slotNormal || !minutes) ? formatDate(d, opt('axisFormat')) : '&nbsp;') + "</th>" + "<td class='" + contentClass + "'>" + "<div style='position:relative'>&nbsp;</div>" + "</td>" + "</tr>"; addMinutes(d, opt('slotMinutes')); slotCnt++; } s += "</tbody>" + "</table>"; slotTable = $(s).appendTo(slotContent); slotTableFirstInner = slotTable.find('div:first'); slotBind(slotTable.find('td')); axisFirstCells = axisFirstCells.add(slotTable.find('th:first')); } function updateCells() { var i; var headCell; var bodyCell; var date; var today = clearTime(new Date()); for (i=0; i<colCnt; i++) { date = colDate(i); headCell = dayHeadCells.eq(i); headCell.html(formatDate(date, colFormat)); bodyCell = dayBodyCells.eq(i); if (+date == +today) { bodyCell.addClass(tm + '-state-highlight fc-today'); }else{ bodyCell.removeClass(tm + '-state-highlight fc-today'); } setDayID(headCell.add(bodyCell), date); } } function setHeight(height, dateChanged) { if (height === undefined) { height = viewHeight; } viewHeight = height; slotTopCache = {}; var headHeight = dayBody.position().top; var allDayHeight = slotScroller.position().top; // including divider var bodyHeight = Math.min( // total body height, including borders height - headHeight, // when scrollbars slotTable.height() + allDayHeight + 1 // when no scrollbars. +1 for bottom border ); dayBodyFirstCellStretcher .height(bodyHeight - vsides(dayBodyFirstCell)); slotLayer.css('top', headHeight); slotScroller.height(bodyHeight - allDayHeight - 1); slotHeight = slotTableFirstInner.height() + 1; // +1 for border if (dateChanged) { resetScroll(); } } function setWidth(width) { viewWidth = width; colContentPositions.clear(); axisWidth = 0; setOuterWidth( axisFirstCells .width('') .each(function(i, _cell) { axisWidth = Math.max(axisWidth, $(_cell).outerWidth()); }), axisWidth ); var slotTableWidth = slotScroller[0].clientWidth; // needs to be done after axisWidth (for IE7) //slotTable.width(slotTableWidth); gutterWidth = slotScroller.width() - slotTableWidth; if (gutterWidth) { setOuterWidth(gutterCells, gutterWidth); gutterCells .show() .prev() .removeClass('fc-last'); }else{ gutterCells .hide() .prev() .addClass('fc-last'); } colWidth = Math.floor((slotTableWidth - axisWidth) / colCnt); setOuterWidth(dayHeadCells.slice(0, -1), colWidth); } function resetScroll() { var d0 = zeroDate(); var scrollDate = cloneDate(d0); scrollDate.setHours(opt('firstHour')); var top = timePosition(d0, scrollDate) + 1; // +1 for the border function scroll() { slotScroller.scrollTop(top); } scroll(); setTimeout(scroll, 0); // overrides any previous scroll state made by the browser } function beforeHide() { savedScrollTop = slotScroller.scrollTop(); } function afterShow() { slotScroller.scrollTop(savedScrollTop); } /* Slot/Day clicking and binding -----------------------------------------------------------------------*/ function dayBind(cells) { cells.click(slotClick) .mousedown(daySelectionMousedown); } function slotBind(cells) { cells.click(slotClick) .mousedown(slotSelectionMousedown); } function slotClick(ev) { if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick var col = Math.min(colCnt-1, Math.floor((ev.pageX - dayTable.offset().left - axisWidth) / colWidth)); var date = colDate(col); var rowMatch = this.parentNode.className.match(/fc-slot(\d+)/); // TODO: maybe use data if (rowMatch) { var mins = parseInt(rowMatch[1]) * opt('slotMinutes'); var hours = Math.floor(mins/60); date.setHours(hours); date.setMinutes(mins%60 + minMinute); trigger('dayClick', dayBodyCells[col], date, false, ev); }else{ trigger('dayClick', dayBodyCells[col], date, true, ev); } } } /* Semi-transparent Overlay Helpers -----------------------------------------------------*/ function renderDayOverlay(startDate, endDate, refreshCoordinateGrid) { // endDate is exclusive if (refreshCoordinateGrid) { coordinateGrid.build(); } var visStart = cloneDate(t.visStart); var startCol, endCol; if (rtl) { startCol = dayDiff(endDate, visStart)*dis+dit+1; endCol = dayDiff(startDate, visStart)*dis+dit+1; }else{ startCol = dayDiff(startDate, visStart); endCol = dayDiff(endDate, visStart); } startCol = Math.max(0, startCol); endCol = Math.min(colCnt, endCol); if (startCol < endCol) { dayBind( renderCellOverlay(0, startCol, 0, endCol-1) ); } } function renderCellOverlay(row0, col0, row1, col1) { // only for all-day? var rect = coordinateGrid.rect(row0, col0, row1, col1, slotLayer); return renderOverlay(rect, slotLayer); } function renderSlotOverlay(overlayStart, overlayEnd) { var dayStart = cloneDate(t.visStart); var dayEnd = addDays(cloneDate(dayStart), 1); for (var i=0; i<colCnt; i++) { var stretchStart = new Date(Math.max(dayStart, overlayStart)); var stretchEnd = new Date(Math.min(dayEnd, overlayEnd)); if (stretchStart < stretchEnd) { var col = i*dis+dit; var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only use it for horizontal coords var top = timePosition(dayStart, stretchStart); var bottom = timePosition(dayStart, stretchEnd); rect.top = top; rect.height = bottom - top; slotBind( renderOverlay(rect, slotContent) ); } addDays(dayStart, 1); addDays(dayEnd, 1); } } /* Coordinate Utilities -----------------------------------------------------------------------------*/ coordinateGrid = new CoordinateGrid(function(rows, cols) { var e, n, p; dayHeadCells.each(function(i, _e) { e = $(_e); n = e.offset().left; if (i) { p[1] = n; } p = [n]; cols[i] = p; }); p[1] = n + e.outerWidth(); if (opt('allDaySlot')) { e = allDayRow; n = e.offset().top; rows[0] = [n, n+e.outerHeight()]; } var slotTableTop = slotContent.offset().top; var slotScrollerTop = slotScroller.offset().top; var slotScrollerBottom = slotScrollerTop + slotScroller.outerHeight(); function constrain(n) { return Math.max(slotScrollerTop, Math.min(slotScrollerBottom, n)); } for (var i=0; i<slotCnt; i++) { rows.push([ constrain(slotTableTop + slotHeight*i), constrain(slotTableTop + slotHeight*(i+1)) ]); } }); hoverListener = new HoverListener(coordinateGrid); colContentPositions = new HorizontalPositionCache(function(col) { return dayBodyCellInners.eq(col); }); function colContentLeft(col) { return colContentPositions.left(col); } function colContentRight(col) { return colContentPositions.right(col); } function dateCell(date) { // "cell" terminology is now confusing return { row: Math.floor(dayDiff(date, t.visStart) / 7), col: dayOfWeekCol(date.getDay()) }; } function cellDate(cell) { var d = colDate(cell.col); var slotIndex = cell.row; if (opt('allDaySlot')) { slotIndex--; } if (slotIndex >= 0) { addMinutes(d, minMinute + slotIndex * opt('slotMinutes')); } return d; } function colDate(col) { // returns dates with 00:00:00 return addDays(cloneDate(t.visStart), col*dis+dit); } function cellIsAllDay(cell) { return opt('allDaySlot') && !cell.row; } function dayOfWeekCol(dayOfWeek) { return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt)*dis+dit; } // get the Y coordinate of the given time on the given day (both Date objects) function timePosition(day, time) { // both date objects. day holds 00:00 of current day day = cloneDate(day, true); if (time < addMinutes(cloneDate(day), minMinute)) { return 0; } if (time >= addMinutes(cloneDate(day), maxMinute)) { return slotTable.height(); } var slotMinutes = opt('slotMinutes'), minutes = time.getHours()*60 + time.getMinutes() - minMinute, slotI = Math.floor(minutes / slotMinutes), slotTop = slotTopCache[slotI]; if (slotTop === undefined) { slotTop = slotTopCache[slotI] = slotTable.find('tr:eq(' + slotI + ') td div')[0].offsetTop; //.position().top; // need this optimization??? } return Math.max(0, Math.round( slotTop - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes) )); } function allDayBounds() { return { left: axisWidth, right: viewWidth - gutterWidth } } function getAllDayRow(index) { return allDayRow; } function defaultEventEnd(event) { var start = cloneDate(event.start); if (event.allDay) { return start; } return addMinutes(start, opt('defaultEventMinutes')); } /* Selection ---------------------------------------------------------------------------------*/ function defaultSelectionEnd(startDate, allDay) { if (allDay) { return cloneDate(startDate); } return addMinutes(cloneDate(startDate), opt('slotMinutes')); } function renderSelection(startDate, endDate, allDay) { // only for all-day if (allDay) { if (opt('allDaySlot')) { renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); } }else{ renderSlotSelection(startDate, endDate); } } function renderSlotSelection(startDate, endDate) { var helperOption = opt('selectHelper'); coordinateGrid.build(); if (helperOption) { var col = dayDiff(startDate, t.visStart) * dis + dit; if (col >= 0 && col < colCnt) { // only works when times are on same day var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only for horizontal coords var top = timePosition(startDate, startDate); var bottom = timePosition(startDate, endDate); if (bottom > top) { // protect against selections that are entirely before or after visible range rect.top = top; rect.height = bottom - top; rect.left += 2; rect.width -= 5; if ($.isFunction(helperOption)) { var helperRes = helperOption(startDate, endDate); if (helperRes) { rect.position = 'absolute'; rect.zIndex = 8; selectionHelper = $(helperRes) .css(rect) .appendTo(slotContent); } }else{ rect.isStart = true; // conside rect a "seg" now rect.isEnd = true; // selectionHelper = $(slotSegHtml( { title: '', start: startDate, end: endDate, className: ['fc-select-helper'], editable: false }, rect )); selectionHelper.css('opacity', opt('dragOpacity')); } if (selectionHelper) { slotBind(selectionHelper); slotContent.append(selectionHelper); setOuterWidth(selectionHelper, rect.width, true); // needs to be after appended setOuterHeight(selectionHelper, rect.height, true); } } } }else{ renderSlotOverlay(startDate, endDate); } } function clearSelection() { clearOverlays(); if (selectionHelper) { selectionHelper.remove(); selectionHelper = null; } } function slotSelectionMousedown(ev) { if (ev.which == 1 && opt('selectable')) { // ev.which==1 means left mouse button unselect(ev); var dates; hoverListener.start(function(cell, origCell) { clearSelection(); if (cell && cell.col == origCell.col && !cellIsAllDay(cell)) { var d1 = cellDate(origCell); var d2 = cellDate(cell); dates = [ d1, addMinutes(cloneDate(d1), opt('slotMinutes')), d2, addMinutes(cloneDate(d2), opt('slotMinutes')) ].sort(cmp); renderSlotSelection(dates[0], dates[3]); }else{ dates = null; } }, ev); $(document).one('mouseup', function(ev) { hoverListener.stop(); if (dates) { if (+dates[0] == +dates[1]) { reportDayClick(dates[0], false, ev); } reportSelection(dates[0], dates[3], false, ev); } }); } } function reportDayClick(date, allDay, ev) { trigger('dayClick', dayBodyCells[dayOfWeekCol(date.getDay())], date, allDay, ev); } /* External Dragging --------------------------------------------------------------------------------*/ function dragStart(_dragElement, ev, ui) { hoverListener.start(function(cell) { clearOverlays(); if (cell) { if (cellIsAllDay(cell)) { renderCellOverlay(cell.row, cell.col, cell.row, cell.col); }else{ var d1 = cellDate(cell); var d2 = addMinutes(cloneDate(d1), opt('defaultEventMinutes')); renderSlotOverlay(d1, d2); } } }, ev); } function dragStop(_dragElement, ev, ui) { var cell = hoverListener.stop(); clearOverlays(); if (cell) { trigger('drop', _dragElement, cellDate(cell), cellIsAllDay(cell), ev, ui); } } } function AgendaEventRenderer() { var t = this; // exports t.renderEvents = renderEvents; t.compileDaySegs = compileDaySegs; // for DayEventRenderer t.clearEvents = clearEvents; t.slotSegHtml = slotSegHtml; t.bindDaySeg = bindDaySeg; // imports DayEventRenderer.call(t); var opt = t.opt; var trigger = t.trigger; //var setOverflowHidden = t.setOverflowHidden; var isEventDraggable = t.isEventDraggable; var isEventResizable = t.isEventResizable; var eventEnd = t.eventEnd; var reportEvents = t.reportEvents; var reportEventClear = t.reportEventClear; var eventElementHandlers = t.eventElementHandlers; var setHeight = t.setHeight; var getDaySegmentContainer = t.getDaySegmentContainer; var getSlotSegmentContainer = t.getSlotSegmentContainer; var getHoverListener = t.getHoverListener; var getMaxMinute = t.getMaxMinute; var getMinMinute = t.getMinMinute; var timePosition = t.timePosition; var colContentLeft = t.colContentLeft; var colContentRight = t.colContentRight; var renderDaySegs = t.renderDaySegs; var resizableDayEvent = t.resizableDayEvent; // TODO: streamline binding architecture var getColCnt = t.getColCnt; var getColWidth = t.getColWidth; var getSlotHeight = t.getSlotHeight; var getBodyContent = t.getBodyContent; var reportEventElement = t.reportEventElement; var showEvents = t.showEvents; var hideEvents = t.hideEvents; var eventDrop = t.eventDrop; var eventResize = t.eventResize; var renderDayOverlay = t.renderDayOverlay; var clearOverlays = t.clearOverlays; var calendar = t.calendar; var formatDate = calendar.formatDate; var formatDates = calendar.formatDates; /* Rendering ----------------------------------------------------------------------------*/ function renderEvents(events, modifiedEventId) { reportEvents(events); var i, len=events.length, dayEvents=[], slotEvents=[]; for (i=0; i<len; i++) { if (events[i].allDay) { dayEvents.push(events[i]); }else{ slotEvents.push(events[i]); } } if (opt('allDaySlot')) { renderDaySegs(compileDaySegs(dayEvents), modifiedEventId); setHeight(); // no params means set to viewHeight } renderSlotSegs(compileSlotSegs(slotEvents), modifiedEventId); } function clearEvents() { reportEventClear(); getDaySegmentContainer().empty(); getSlotSegmentContainer().empty(); } function compileDaySegs(events) { var levels = stackSegs(sliceSegs(events, $.map(events, exclEndDay), t.visStart, t.visEnd)), i, levelCnt=levels.length, level, j, seg, segs=[]; for (i=0; i<levelCnt; i++) { level = levels[i]; for (j=0; j<level.length; j++) { seg = level[j]; seg.row = 0; seg.level = i; // not needed anymore segs.push(seg); } } return segs; } function compileSlotSegs(events) { var colCnt = getColCnt(), minMinute = getMinMinute(), maxMinute = getMaxMinute(), d = addMinutes(cloneDate(t.visStart), minMinute), visEventEnds = $.map(events, slotEventEnd), i, col, j, level, k, seg, segs=[]; for (i=0; i<colCnt; i++) { col = stackSegs(sliceSegs(events, visEventEnds, d, addMinutes(cloneDate(d), maxMinute-minMinute))); countForwardSegs(col); for (j=0; j<col.length; j++) { level = col[j]; for (k=0; k<level.length; k++) { seg = level[k]; seg.col = i; seg.level = j; segs.push(seg); } } addDays(d, 1, true); } return segs; } function slotEventEnd(event) { if (event.end) { return cloneDate(event.end); }else{ return addMinutes(cloneDate(event.start), opt('defaultEventMinutes')); } } // renders events in the 'time slots' at the bottom function renderSlotSegs(segs, modifiedEventId) { var i, segCnt=segs.length, seg, event, classes, top, bottom, colI, levelI, forward, leftmost, availWidth, outerWidth, left, html='', eventElements, eventElement, triggerRes, vsideCache={}, hsideCache={}, key, val, contentElement, height, slotSegmentContainer = getSlotSegmentContainer(), rtl, dis, dit, colCnt = getColCnt(); if (rtl = opt('isRTL')) { dis = -1; dit = colCnt - 1; }else{ dis = 1; dit = 0; } // calculate position/dimensions, create html for (i=0; i<segCnt; i++) { seg = segs[i]; event = seg.event; top = timePosition(seg.start, seg.start); bottom = timePosition(seg.start, seg.end); colI = seg.col; levelI = seg.level; forward = seg.forward || 0; leftmost = colContentLeft(colI*dis + dit); availWidth = colContentRight(colI*dis + dit) - leftmost; availWidth = Math.min(availWidth-6, availWidth*.95); // TODO: move this to CSS if (levelI) { // indented and thin outerWidth = availWidth / (levelI + forward + 1); }else{ if (forward) { // moderately wide, aligned left still outerWidth = ((availWidth / (forward + 1)) - (12/2)) * 2; // 12 is the predicted width of resizer = }else{ // can be entire width, aligned left outerWidth = availWidth; } } left = leftmost + // leftmost possible (availWidth / (levelI + forward + 1) * levelI) // indentation * dis + (rtl ? availWidth - outerWidth : 0); // rtl seg.top = top; seg.left = left; seg.outerWidth = outerWidth; seg.outerHeight = bottom - top; html += slotSegHtml(event, seg); } slotSegmentContainer[0].innerHTML = html; // faster than html() eventElements = slotSegmentContainer.children(); // retrieve elements, run through eventRender callback, bind event handlers for (i=0; i<segCnt; i++) { seg = segs[i]; event = seg.event; eventElement = $(eventElements[i]); // faster than eq() triggerRes = trigger('eventRender', event, event, eventElement); if (triggerRes === false) { eventElement.remove(); }else{ if (triggerRes && triggerRes !== true) { eventElement.remove(); eventElement = $(triggerRes) .css({ position: 'absolute', top: seg.top, left: seg.left }) .appendTo(slotSegmentContainer); } seg.element = eventElement; if (event._id === modifiedEventId) { bindSlotSeg(event, eventElement, seg); }else{ eventElement[0]._fci = i; // for lazySegBind } reportEventElement(event, eventElement); } } lazySegBind(slotSegmentContainer, segs, bindSlotSeg); // record event sides and title positions for (i=0; i<segCnt; i++) { seg = segs[i]; if (eventElement = seg.element) { val = vsideCache[key = seg.key = cssKey(eventElement[0])]; seg.vsides = val === undefined ? (vsideCache[key] = vsides(eventElement, true)) : val; val = hsideCache[key]; seg.hsides = val === undefined ? (hsideCache[key] = hsides(eventElement, true)) : val; contentElement = eventElement.find('div.fc-event-content'); if (contentElement.length) { seg.contentTop = contentElement[0].offsetTop; } } } // set all positions/dimensions at once for (i=0; i<segCnt; i++) { seg = segs[i]; if (eventElement = seg.element) { eventElement[0].style.width = Math.max(0, seg.outerWidth - seg.hsides) + 'px'; height = Math.max(0, seg.outerHeight - seg.vsides); eventElement[0].style.height = height + 'px'; event = seg.event; if (seg.contentTop !== undefined && height - seg.contentTop < 10) { // not enough room for title, put it in the time header eventElement.find('div.fc-event-time') .text(formatDate(event.start, opt('timeFormat')) + ' - ' + event.title); eventElement.find('div.fc-event-title') .remove(); } trigger('eventAfterRender', event, event, eventElement); } } } function slotSegHtml(event, seg) { var html = "<"; var url = event.url; var skinCss = getSkinCss(event, opt); var skinCssAttr = (skinCss ? " style='" + skinCss + "'" : ''); var classes = ['fc-event', 'fc-event-skin', 'fc-event-vert']; if (isEventDraggable(event)) { classes.push('fc-event-draggable'); } if (seg.isStart) { classes.push('fc-corner-top'); } if (seg.isEnd) { classes.push('fc-corner-bottom'); } classes = classes.concat(event.className); if (event.source) { classes = classes.concat(event.source.className || []); } if (url) { html += "a href='" + htmlEscape(event.url) + "'"; }else{ html += "div"; } html += " class='" + classes.join(' ') + "'" + " style='position:absolute;z-index:8;top:" + seg.top + "px;left:" + seg.left + "px;" + skinCss + "'" + ">" + "<div class='fc-event-inner fc-event-skin'" + skinCssAttr + ">" + "<div class='fc-event-head fc-event-skin'" + skinCssAttr + ">" + "<div class='fc-event-time'>" + htmlEscape(formatDates(event.start, event.end, opt('timeFormat'))) + "</div>" + "</div>" + "<div class='fc-event-content'>" + "<div class='fc-event-title'>" + htmlEscape(event.title) + "</div>" + "</div>" + "<div class='fc-event-bg'></div>" + "</div>"; // close inner if (seg.isEnd && isEventResizable(event)) { html += "<div class='ui-resizable-handle ui-resizable-s'>=</div>"; } html += "</" + (url ? "a" : "div") + ">"; return html; } function bindDaySeg(event, eventElement, seg) { if (isEventDraggable(event)) { draggableDayEvent(event, eventElement, seg.isStart); } if (seg.isEnd && isEventResizable(event)) { resizableDayEvent(event, eventElement, seg); } eventElementHandlers(event, eventElement); // needs to be after, because resizableDayEvent might stopImmediatePropagation on click } function bindSlotSeg(event, eventElement, seg) { var timeElement = eventElement.find('div.fc-event-time'); if (isEventDraggable(event)) { draggableSlotEvent(event, eventElement, timeElement); } if (seg.isEnd && isEventResizable(event)) { resizableSlotEvent(event, eventElement, timeElement); } eventElementHandlers(event, eventElement); } /* Dragging -----------------------------------------------------------------------------------*/ // when event starts out FULL-DAY function draggableDayEvent(event, eventElement, isStart) { var origWidth; var revert; var allDay=true; var dayDelta; var dis = opt('isRTL') ? -1 : 1; var hoverListener = getHoverListener(); var colWidth = getColWidth(); var slotHeight = getSlotHeight(); var minMinute = getMinMinute(); eventElement.draggable({ zIndex: 9, opacity: opt('dragOpacity', 'month'), // use whatever the month view was using revertDuration: opt('dragRevertDuration'), start: function(ev, ui) { trigger('eventDragStart', eventElement, event, ev, ui); hideEvents(event, eventElement); origWidth = eventElement.width(); hoverListener.start(function(cell, origCell, rowDelta, colDelta) { clearOverlays(); if (cell) { //setOverflowHidden(true); revert = false; dayDelta = colDelta * dis; if (!cell.row) { // on full-days renderDayOverlay( addDays(cloneDate(event.start), dayDelta), addDays(exclEndDay(event), dayDelta) ); resetElement(); }else{ // mouse is over bottom slots if (isStart) { if (allDay) { // convert event to temporary slot-event eventElement.width(colWidth - 10); // don't use entire width setOuterHeight( eventElement, slotHeight * Math.round( (event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes')) / opt('slotMinutes') ) ); eventElement.draggable('option', 'grid', [colWidth, 1]); allDay = false; } }else{ revert = true; } } revert = revert || (allDay && !dayDelta); }else{ resetElement(); //setOverflowHidden(false); revert = true; } eventElement.draggable('option', 'revert', revert); }, ev, 'drag'); }, stop: function(ev, ui) { hoverListener.stop(); clearOverlays(); trigger('eventDragStop', eventElement, event, ev, ui); if (revert) { // hasn't moved or is out of bounds (draggable has already reverted) resetElement(); eventElement.css('filter', ''); // clear IE opacity side-effects showEvents(event, eventElement); }else{ // changed! var minuteDelta = 0; if (!allDay) { minuteDelta = Math.round((eventElement.offset().top - getBodyContent().offset().top) / slotHeight) * opt('slotMinutes') + minMinute - (event.start.getHours() * 60 + event.start.getMinutes()); } eventDrop(this, event, dayDelta, minuteDelta, allDay, ev, ui); } //setOverflowHidden(false); } }); function resetElement() { if (!allDay) { eventElement .width(origWidth) .height('') .draggable('option', 'grid', null); allDay = true; } } } // when event starts out IN TIMESLOTS function draggableSlotEvent(event, eventElement, timeElement) { var origPosition; var allDay=false; var dayDelta; var minuteDelta; var prevMinuteDelta; var dis = opt('isRTL') ? -1 : 1; var hoverListener = getHoverListener(); var colCnt = getColCnt(); var colWidth = getColWidth(); var slotHeight = getSlotHeight(); eventElement.draggable({ zIndex: 9, scroll: false, grid: [colWidth, slotHeight], axis: colCnt==1 ? 'y' : false, opacity: opt('dragOpacity'), revertDuration: opt('dragRevertDuration'), start: function(ev, ui) { trigger('eventDragStart', eventElement, event, ev, ui); hideEvents(event, eventElement); origPosition = eventElement.position(); minuteDelta = prevMinuteDelta = 0; hoverListener.start(function(cell, origCell, rowDelta, colDelta) { eventElement.draggable('option', 'revert', !cell); clearOverlays(); if (cell) { dayDelta = colDelta * dis; if (opt('allDaySlot') && !cell.row) { // over full days if (!allDay) { // convert to temporary all-day event allDay = true; timeElement.hide(); eventElement.draggable('option', 'grid', null); } renderDayOverlay( addDays(cloneDate(event.start), dayDelta), addDays(exclEndDay(event), dayDelta) ); }else{ // on slots resetElement(); } } }, ev, 'drag'); }, drag: function(ev, ui) { minuteDelta = Math.round((ui.position.top - origPosition.top) / slotHeight) * opt('slotMinutes'); if (minuteDelta != prevMinuteDelta) { if (!allDay) { updateTimeText(minuteDelta); } prevMinuteDelta = minuteDelta; } }, stop: function(ev, ui) { var cell = hoverListener.stop(); clearOverlays(); trigger('eventDragStop', eventElement, event, ev, ui); if (cell && (dayDelta || minuteDelta || allDay)) { // changed! eventDrop(this, event, dayDelta, allDay ? 0 : minuteDelta, allDay, ev, ui); }else{ // either no change or out-of-bounds (draggable has already reverted) resetElement(); eventElement.css('filter', ''); // clear IE opacity side-effects eventElement.css(origPosition); // sometimes fast drags make event revert to wrong position updateTimeText(0); showEvents(event, eventElement); } } }); function updateTimeText(minuteDelta) { var newStart = addMinutes(cloneDate(event.start), minuteDelta); var newEnd; if (event.end) { newEnd = addMinutes(cloneDate(event.end), minuteDelta); } timeElement.text(formatDates(newStart, newEnd, opt('timeFormat'))); } function resetElement() { // convert back to original slot-event if (allDay) { timeElement.css('display', ''); // show() was causing display=inline eventElement.draggable('option', 'grid', [colWidth, slotHeight]); allDay = false; } } } /* Resizing --------------------------------------------------------------------------------------*/ function resizableSlotEvent(event, eventElement, timeElement) { var slotDelta, prevSlotDelta; var slotHeight = getSlotHeight(); eventElement.resizable({ handles: { s: 'div.ui-resizable-s' }, grid: slotHeight, start: function(ev, ui) { slotDelta = prevSlotDelta = 0; hideEvents(event, eventElement); eventElement.css('z-index', 9); trigger('eventResizeStart', this, event, ev, ui); }, resize: function(ev, ui) { // don't rely on ui.size.height, doesn't take grid into account slotDelta = Math.round((Math.max(slotHeight, eventElement.height()) - ui.originalSize.height) / slotHeight); if (slotDelta != prevSlotDelta) { timeElement.text( formatDates( event.start, (!slotDelta && !event.end) ? null : // no change, so don't display time range addMinutes(eventEnd(event), opt('slotMinutes')*slotDelta), opt('timeFormat') ) ); prevSlotDelta = slotDelta; } }, stop: function(ev, ui) { trigger('eventResizeStop', this, event, ev, ui); if (slotDelta) { eventResize(this, event, 0, opt('slotMinutes')*slotDelta, ev, ui); }else{ eventElement.css('z-index', 8); showEvents(event, eventElement); // BUG: if event was really short, need to put title back in span } } }); } } function countForwardSegs(levels) { var i, j, k, level, segForward, segBack; for (i=levels.length-1; i>0; i--) { level = levels[i]; for (j=0; j<level.length; j++) { segForward = level[j]; for (k=0; k<levels[i-1].length; k++) { segBack = levels[i-1][k]; if (segsCollide(segForward, segBack)) { segBack.forward = Math.max(segBack.forward||0, (segForward.forward||0)+1); } } } } } function View(element, calendar, viewName) { var t = this; // exports t.element = element; t.calendar = calendar; t.name = viewName; t.opt = opt; t.trigger = trigger; //t.setOverflowHidden = setOverflowHidden; t.isEventDraggable = isEventDraggable; t.isEventResizable = isEventResizable; t.reportEvents = reportEvents; t.eventEnd = eventEnd; t.reportEventElement = reportEventElement; t.reportEventClear = reportEventClear; t.eventElementHandlers = eventElementHandlers; t.showEvents = showEvents; t.hideEvents = hideEvents; t.eventDrop = eventDrop; t.eventResize = eventResize; // t.title // t.start, t.end // t.visStart, t.visEnd // imports var defaultEventEnd = t.defaultEventEnd; var normalizeEvent = calendar.normalizeEvent; // in EventManager var reportEventChange = calendar.reportEventChange; // locals var eventsByID = {}; var eventElements = []; var eventElementsByID = {}; var options = calendar.options; function opt(name, viewNameOverride) { var v = options[name]; if (typeof v == 'object') { return smartProperty(v, viewNameOverride || viewName); } return v; } function trigger(name, thisObj) { return calendar.trigger.apply( calendar, [name, thisObj || t].concat(Array.prototype.slice.call(arguments, 2), [t]) ); } /* function setOverflowHidden(bool) { element.css('overflow', bool ? 'hidden' : ''); } */ function isEventDraggable(event) { return isEventEditable(event) && !opt('disableDragging'); } function isEventResizable(event) { // but also need to make sure the seg.isEnd == true return isEventEditable(event) && !opt('disableResizing'); } function isEventEditable(event) { return firstDefined(event.editable, (event.source || {}).editable, opt('editable')); } /* Event Data ------------------------------------------------------------------------------*/ // report when view receives new events function reportEvents(events) { // events are already normalized at this point eventsByID = {}; var i, len=events.length, event; for (i=0; i<len; i++) { event = events[i]; if (eventsByID[event._id]) { eventsByID[event._id].push(event); }else{ eventsByID[event._id] = [event]; } } } // returns a Date object for an event's end function eventEnd(event) { return event.end ? cloneDate(event.end) : defaultEventEnd(event); } /* Event Elements ------------------------------------------------------------------------------*/ // report when view creates an element for an event function reportEventElement(event, element) { eventElements.push(element); if (eventElementsByID[event._id]) { eventElementsByID[event._id].push(element); }else{ eventElementsByID[event._id] = [element]; } } function reportEventClear() { eventElements = []; eventElementsByID = {}; } // attaches eventClick, eventMouseover, eventMouseout function eventElementHandlers(event, eventElement) { eventElement .click(function(ev) { if (!eventElement.hasClass('ui-draggable-dragging') && !eventElement.hasClass('ui-resizable-resizing')) { return trigger('eventClick', this, event, ev); } }) .hover( function(ev) { trigger('eventMouseover', this, event, ev); }, function(ev) { trigger('eventMouseout', this, event, ev); } ); // TODO: don't fire eventMouseover/eventMouseout *while* dragging is occuring (on subject element) // TODO: same for resizing } function showEvents(event, exceptElement) { eachEventElement(event, exceptElement, 'show'); } function hideEvents(event, exceptElement) { eachEventElement(event, exceptElement, 'hide'); } function eachEventElement(event, exceptElement, funcName) { var elements = eventElementsByID[event._id], i, len = elements.length; for (i=0; i<len; i++) { if (!exceptElement || elements[i][0] != exceptElement[0]) { elements[i][funcName](); } } } /* Event Modification Reporting ---------------------------------------------------------------------------------*/ function eventDrop(e, event, dayDelta, minuteDelta, allDay, ev, ui) { var oldAllDay = event.allDay; var eventId = event._id; moveEvents(eventsByID[eventId], dayDelta, minuteDelta, allDay); trigger( 'eventDrop', e, event, dayDelta, minuteDelta, allDay, function() { // TODO: investigate cases where this inverse technique might not work moveEvents(eventsByID[eventId], -dayDelta, -minuteDelta, oldAllDay); reportEventChange(eventId); }, ev, ui ); reportEventChange(eventId); } function eventResize(e, event, dayDelta, minuteDelta, ev, ui) { var eventId = event._id; elongateEvents(eventsByID[eventId], dayDelta, minuteDelta); trigger( 'eventResize', e, event, dayDelta, minuteDelta, function() { // TODO: investigate cases where this inverse technique might not work elongateEvents(eventsByID[eventId], -dayDelta, -minuteDelta); reportEventChange(eventId); }, ev, ui ); reportEventChange(eventId); } /* Event Modification Math ---------------------------------------------------------------------------------*/ function moveEvents(events, dayDelta, minuteDelta, allDay) { minuteDelta = minuteDelta || 0; for (var e, len=events.length, i=0; i<len; i++) { e = events[i]; if (allDay !== undefined) { e.allDay = allDay; } addMinutes(addDays(e.start, dayDelta, true), minuteDelta); if (e.end) { e.end = addMinutes(addDays(e.end, dayDelta, true), minuteDelta); } normalizeEvent(e, options); } } function elongateEvents(events, dayDelta, minuteDelta) { minuteDelta = minuteDelta || 0; for (var e, len=events.length, i=0; i<len; i++) { e = events[i]; e.end = addMinutes(addDays(eventEnd(e), dayDelta, true), minuteDelta); normalizeEvent(e, options); } } } function DayEventRenderer() { var t = this; // exports t.renderDaySegs = renderDaySegs; t.resizableDayEvent = resizableDayEvent; // imports var opt = t.opt; var trigger = t.trigger; var isEventDraggable = t.isEventDraggable; var isEventResizable = t.isEventResizable; var eventEnd = t.eventEnd; var reportEventElement = t.reportEventElement; var showEvents = t.showEvents; var hideEvents = t.hideEvents; var eventResize = t.eventResize; var getRowCnt = t.getRowCnt; var getColCnt = t.getColCnt; var getColWidth = t.getColWidth; var allDayRow = t.allDayRow; var allDayBounds = t.allDayBounds; var colContentLeft = t.colContentLeft; var colContentRight = t.colContentRight; var dayOfWeekCol = t.dayOfWeekCol; var dateCell = t.dateCell; var compileDaySegs = t.compileDaySegs; var getDaySegmentContainer = t.getDaySegmentContainer; var bindDaySeg = t.bindDaySeg; //TODO: streamline this var formatDates = t.calendar.formatDates; var renderDayOverlay = t.renderDayOverlay; var clearOverlays = t.clearOverlays; var clearSelection = t.clearSelection; /* Rendering -----------------------------------------------------------------------------*/ function renderDaySegs(segs, modifiedEventId) { var segmentContainer = getDaySegmentContainer(); var rowDivs; var rowCnt = getRowCnt(); var colCnt = getColCnt(); var i = 0; var rowI; var levelI; var colHeights; var j; var segCnt = segs.length; var seg; var top; var k; segmentContainer[0].innerHTML = daySegHTML(segs); // faster than .html() daySegElementResolve(segs, segmentContainer.children()); daySegElementReport(segs); daySegHandlers(segs, segmentContainer, modifiedEventId); daySegCalcHSides(segs); daySegSetWidths(segs); daySegCalcHeights(segs); rowDivs = getRowDivs(); // set row heights, calculate event tops (in relation to row top) for (rowI=0; rowI<rowCnt; rowI++) { levelI = 0; colHeights = []; for (j=0; j<colCnt; j++) { colHeights[j] = 0; } while (i<segCnt && (seg = segs[i]).row == rowI) { // loop through segs in a row top = arrayMax(colHeights.slice(seg.startCol, seg.endCol)); seg.top = top; top += seg.outerHeight; for (k=seg.startCol; k<seg.endCol; k++) { colHeights[k] = top; } i++; } rowDivs[rowI].height(arrayMax(colHeights)); } daySegSetTops(segs, getRowTops(rowDivs)); } function renderTempDaySegs(segs, adjustRow, adjustTop) { var tempContainer = $("<div/>"); var elements; var segmentContainer = getDaySegmentContainer(); var i; var segCnt = segs.length; var element; tempContainer[0].innerHTML = daySegHTML(segs); // faster than .html() elements = tempContainer.children(); segmentContainer.append(elements); daySegElementResolve(segs, elements); daySegCalcHSides(segs); daySegSetWidths(segs); daySegCalcHeights(segs); daySegSetTops(segs, getRowTops(getRowDivs())); elements = []; for (i=0; i<segCnt; i++) { element = segs[i].element; if (element) { if (segs[i].row === adjustRow) { element.css('top', adjustTop); } elements.push(element[0]); } } return $(elements); } function daySegHTML(segs) { // also sets seg.left and seg.outerWidth var rtl = opt('isRTL'); var i; var segCnt=segs.length; var seg; var event; var url; var classes; var bounds = allDayBounds(); var minLeft = bounds.left; var maxLeft = bounds.right; var leftCol; var rightCol; var left; var right; var skinCss; var html = ''; // calculate desired position/dimensions, create html for (i=0; i<segCnt; i++) { seg = segs[i]; event = seg.event; classes = ['fc-event', 'fc-event-skin', 'fc-event-hori']; if (isEventDraggable(event)) { classes.push('fc-event-draggable'); } if (rtl) { if (seg.isStart) { classes.push('fc-corner-right'); } if (seg.isEnd) { classes.push('fc-corner-left'); } leftCol = dayOfWeekCol(seg.end.getDay()-1); rightCol = dayOfWeekCol(seg.start.getDay()); left = seg.isEnd ? colContentLeft(leftCol) : minLeft; right = seg.isStart ? colContentRight(rightCol) : maxLeft; }else{ if (seg.isStart) { classes.push('fc-corner-left'); } if (seg.isEnd) { classes.push('fc-corner-right'); } leftCol = dayOfWeekCol(seg.start.getDay()); rightCol = dayOfWeekCol(seg.end.getDay()-1); left = seg.isStart ? colContentLeft(leftCol) : minLeft; right = seg.isEnd ? colContentRight(rightCol) : maxLeft; } classes = classes.concat(event.className); if (event.source) { classes = classes.concat(event.source.className || []); } url = event.url; skinCss = getSkinCss(event, opt); if (url) { html += "<a href='" + htmlEscape(url) + "'"; }else{ html += "<div"; } html += " class='" + classes.join(' ') + "'" + " style='position:absolute;z-index:8;left:"+left+"px;" + skinCss + "'" + ">" + "<div" + " class='fc-event-inner fc-event-skin'" + (skinCss ? " style='" + skinCss + "'" : '') + ">"; if (!event.allDay && seg.isStart) { html += "<span class='fc-event-time'>" + htmlEscape(formatDates(event.start, event.end, opt('timeFormat'))) + "</span>"; } html += "<span class='fc-event-title'>" + htmlEscape(event.title) + "</span>" + "</div>"; if (seg.isEnd && isEventResizable(event)) { html += "<div class='ui-resizable-handle ui-resizable-" + (rtl ? 'w' : 'e') + "'>" + "&nbsp;&nbsp;&nbsp;" + // makes hit area a lot better for IE6/7 "</div>"; } html += "</" + (url ? "a" : "div" ) + ">"; seg.left = left; seg.outerWidth = right - left; seg.startCol = leftCol; seg.endCol = rightCol + 1; // needs to be exclusive } return html; } function daySegElementResolve(segs, elements) { // sets seg.element var i; var segCnt = segs.length; var seg; var event; var element; var triggerRes; for (i=0; i<segCnt; i++) { seg = segs[i]; event = seg.event; element = $(elements[i]); // faster than .eq() triggerRes = trigger('eventRender', event, event, element); if (triggerRes === false) { element.remove(); }else{ if (triggerRes && triggerRes !== true) { triggerRes = $(triggerRes) .css({ position: 'absolute', left: seg.left }); element.replaceWith(triggerRes); element = triggerRes; } seg.element = element; } } } function daySegElementReport(segs) { var i; var segCnt = segs.length; var seg; var element; for (i=0; i<segCnt; i++) { seg = segs[i]; element = seg.element; if (element) { reportEventElement(seg.event, element); } } } function daySegHandlers(segs, segmentContainer, modifiedEventId) { var i; var segCnt = segs.length; var seg; var element; var event; // retrieve elements, run through eventRender callback, bind handlers for (i=0; i<segCnt; i++) { seg = segs[i]; element = seg.element; if (element) { event = seg.event; if (event._id === modifiedEventId) { bindDaySeg(event, element, seg); }else{ element[0]._fci = i; // for lazySegBind } } } lazySegBind(segmentContainer, segs, bindDaySeg); } function daySegCalcHSides(segs) { // also sets seg.key var i; var segCnt = segs.length; var seg; var element; var key, val; var hsideCache = {}; // record event horizontal sides for (i=0; i<segCnt; i++) { seg = segs[i]; element = seg.element; if (element) { key = seg.key = cssKey(element[0]); val = hsideCache[key]; if (val === undefined) { val = hsideCache[key] = hsides(element, true); } seg.hsides = val; } } } function daySegSetWidths(segs) { var i; var segCnt = segs.length; var seg; var element; for (i=0; i<segCnt; i++) { seg = segs[i]; element = seg.element; if (element) { element[0].style.width = Math.max(0, seg.outerWidth - seg.hsides) + 'px'; } } } function daySegCalcHeights(segs) { var i; var segCnt = segs.length; var seg; var element; var key, val; var vmarginCache = {}; // record event heights for (i=0; i<segCnt; i++) { seg = segs[i]; element = seg.element; if (element) { key = seg.key; // created in daySegCalcHSides val = vmarginCache[key]; if (val === undefined) { val = vmarginCache[key] = vmargins(element); } seg.outerHeight = element[0].offsetHeight + val; } } } function getRowDivs() { var i; var rowCnt = getRowCnt(); var rowDivs = []; for (i=0; i<rowCnt; i++) { rowDivs[i] = allDayRow(i) .find('td:first div.fc-day-content > div'); // optimal selector? } return rowDivs; } function getRowTops(rowDivs) { var i; var rowCnt = rowDivs.length; var tops = []; for (i=0; i<rowCnt; i++) { tops[i] = rowDivs[i][0].offsetTop; // !!?? but this means the element needs position:relative if in a table cell!!!! } return tops; } function daySegSetTops(segs, rowTops) { // also triggers eventAfterRender var i; var segCnt = segs.length; var seg; var element; var event; for (i=0; i<segCnt; i++) { seg = segs[i]; element = seg.element; if (element) { element[0].style.top = rowTops[seg.row] + (seg.top||0) + 'px'; event = seg.event; trigger('eventAfterRender', event, event, element); } } } /* Resizing -----------------------------------------------------------------------------------*/ function resizableDayEvent(event, element, seg) { var rtl = opt('isRTL'); var direction = rtl ? 'w' : 'e'; var handle = element.find('div.ui-resizable-' + direction); var isResizing = false; // TODO: look into using jquery-ui mouse widget for this stuff disableTextSelection(element); // prevent native <a> selection for IE element .mousedown(function(ev) { // prevent native <a> selection for others ev.preventDefault(); }) .click(function(ev) { if (isResizing) { ev.preventDefault(); // prevent link from being visited (only method that worked in IE6) ev.stopImmediatePropagation(); // prevent fullcalendar eventClick handler from being called // (eventElementHandlers needs to be bound after resizableDayEvent) } }); handle.mousedown(function(ev) { if (ev.which != 1) { return; // needs to be left mouse button } isResizing = true; var hoverListener = t.getHoverListener(); var rowCnt = getRowCnt(); var colCnt = getColCnt(); var dis = rtl ? -1 : 1; var dit = rtl ? colCnt-1 : 0; var elementTop = element.css('top'); var dayDelta; var helpers; var eventCopy = $.extend({}, event); var minCell = dateCell(event.start); clearSelection(); $('body') .css('cursor', direction + '-resize') .one('mouseup', mouseup); trigger('eventResizeStart', this, event, ev); hoverListener.start(function(cell, origCell) { if (cell) { var r = Math.max(minCell.row, cell.row); var c = cell.col; if (rowCnt == 1) { r = 0; // hack for all-day area in agenda views } if (r == minCell.row) { if (rtl) { c = Math.min(minCell.col, c); }else{ c = Math.max(minCell.col, c); } } dayDelta = (r*7 + c*dis+dit) - (origCell.row*7 + origCell.col*dis+dit); var newEnd = addDays(eventEnd(event), dayDelta, true); if (dayDelta) { eventCopy.end = newEnd; var oldHelpers = helpers; helpers = renderTempDaySegs(compileDaySegs([eventCopy]), seg.row, elementTop); helpers.find('*').css('cursor', direction + '-resize'); if (oldHelpers) { oldHelpers.remove(); } hideEvents(event); }else{ if (helpers) { showEvents(event); helpers.remove(); helpers = null; } } clearOverlays(); renderDayOverlay(event.start, addDays(cloneDate(newEnd), 1)); // coordinate grid already rebuild at hoverListener.start } }, ev); function mouseup(ev) { trigger('eventResizeStop', this, event, ev); $('body').css('cursor', ''); hoverListener.stop(); clearOverlays(); if (dayDelta) { eventResize(this, event, dayDelta, 0, ev); // event redraw will clear helpers } // otherwise, the drag handler already restored the old events setTimeout(function() { // make this happen after the element's click event isResizing = false; },0); } }); } } //BUG: unselect needs to be triggered when events are dragged+dropped function SelectionManager() { var t = this; // exports t.select = select; t.unselect = unselect; t.reportSelection = reportSelection; t.daySelectionMousedown = daySelectionMousedown; // imports var opt = t.opt; var trigger = t.trigger; var defaultSelectionEnd = t.defaultSelectionEnd; var renderSelection = t.renderSelection; var clearSelection = t.clearSelection; // locals var selected = false; // unselectAuto if (opt('selectable') && opt('unselectAuto')) { $(document).mousedown(function(ev) { var ignore = opt('unselectCancel'); if (ignore) { if ($(ev.target).parents(ignore).length) { // could be optimized to stop after first match return; } } unselect(ev); }); } function select(startDate, endDate, allDay) { unselect(); if (!endDate) { endDate = defaultSelectionEnd(startDate, allDay); } renderSelection(startDate, endDate, allDay); reportSelection(startDate, endDate, allDay); } function unselect(ev) { if (selected) { selected = false; clearSelection(); trigger('unselect', null, ev); } } function reportSelection(startDate, endDate, allDay, ev) { selected = true; trigger('select', null, startDate, endDate, allDay, ev); } function daySelectionMousedown(ev) { // not really a generic manager method, oh well var cellDate = t.cellDate; var cellIsAllDay = t.cellIsAllDay; var hoverListener = t.getHoverListener(); var reportDayClick = t.reportDayClick; // this is hacky and sort of weird if (ev.which == 1 && opt('selectable')) { // which==1 means left mouse button unselect(ev); var _mousedownElement = this; var dates; hoverListener.start(function(cell, origCell) { // TODO: maybe put cellDate/cellIsAllDay info in cell clearSelection(); if (cell && cellIsAllDay(cell)) { dates = [ cellDate(origCell), cellDate(cell) ].sort(cmp); renderSelection(dates[0], dates[1], true); }else{ dates = null; } }, ev); $(document).one('mouseup', function(ev) { hoverListener.stop(); if (dates) { if (+dates[0] == +dates[1]) { reportDayClick(dates[0], true, ev); } reportSelection(dates[0], dates[1], true, ev); } }); } } } function OverlayManager() { var t = this; // exports t.renderOverlay = renderOverlay; t.clearOverlays = clearOverlays; // locals var usedOverlays = []; var unusedOverlays = []; function renderOverlay(rect, parent) { var e = unusedOverlays.shift(); if (!e) { e = $("<div class='fc-cell-overlay' style='position:absolute;z-index:3'/>"); } if (e[0].parentNode != parent[0]) { e.appendTo(parent); } usedOverlays.push(e.css(rect).show()); return e; } function clearOverlays() { var e; while (e = usedOverlays.shift()) { unusedOverlays.push(e.hide().unbind()); } } } function CoordinateGrid(buildFunc) { var t = this; var rows; var cols; t.build = function() { rows = []; cols = []; buildFunc(rows, cols); }; t.cell = function(x, y) { var rowCnt = rows.length; var colCnt = cols.length; var i, r=-1, c=-1; for (i=0; i<rowCnt; i++) { if (y >= rows[i][0] && y < rows[i][1]) { r = i; break; } } for (i=0; i<colCnt; i++) { if (x >= cols[i][0] && x < cols[i][1]) { c = i; break; } } return (r>=0 && c>=0) ? { row:r, col:c } : null; }; t.rect = function(row0, col0, row1, col1, originElement) { // row1,col1 is inclusive var origin = originElement.offset(); return { top: rows[row0][0] - origin.top, left: cols[col0][0] - origin.left, width: cols[col1][1] - cols[col0][0], height: rows[row1][1] - rows[row0][0] }; }; } function HoverListener(coordinateGrid) { var t = this; var bindType; var change; var firstCell; var cell; t.start = function(_change, ev, _bindType) { change = _change; firstCell = cell = null; coordinateGrid.build(); mouse(ev); bindType = _bindType || 'mousemove'; $(document).bind(bindType, mouse); }; function mouse(ev) { _fixUIEvent(ev); // see below var newCell = coordinateGrid.cell(ev.pageX, ev.pageY); if (!newCell != !cell || newCell && (newCell.row != cell.row || newCell.col != cell.col)) { if (newCell) { if (!firstCell) { firstCell = newCell; } change(newCell, firstCell, newCell.row-firstCell.row, newCell.col-firstCell.col); }else{ change(newCell, firstCell); } cell = newCell; } } t.stop = function() { $(document).unbind(bindType, mouse); return cell; }; } // this fix was only necessary for jQuery UI 1.8.16 (and jQuery 1.7 or 1.7.1) // upgrading to jQuery UI 1.8.17 (and using either jQuery 1.7 or 1.7.1) fixed the problem // but keep this in here for 1.8.16 users // and maybe remove it down the line function _fixUIEvent(event) { // for issue 1168 if (event.pageX === undefined) { event.pageX = event.originalEvent.pageX; event.pageY = event.originalEvent.pageY; } } function HorizontalPositionCache(getElement) { var t = this, elements = {}, lefts = {}, rights = {}; function e(i) { return elements[i] = elements[i] || getElement(i); } t.left = function(i) { return lefts[i] = lefts[i] === undefined ? e(i).position().left : lefts[i]; }; t.right = function(i) { return rights[i] = rights[i] === undefined ? t.left(i) + e(i).width() : rights[i]; }; t.clear = function() { elements = {}; lefts = {}; rights = {}; }; } })(jQuery); (function($) { function formatTime(hour, minute, options) { var printMinute = minute, printHour, half; if (minute < 10) printMinute = '0' + minute; if (options.isoTime) { printHour = hour if (printHour < 10) printHour = '0' + hour; return printHour + ':' + printMinute; } else { printHour = hour % 12; if (printHour == 0) printHour = 12; if (options.meridiemUpperCase) { half = (hour < 12) ? 'AM' : 'PM'; } else { half = (hour < 12) ? 'am' : 'pm'; } return printHour + ':' + printMinute + half; } } function parseTime(text) { var match = match = /(\d+)\s*[:\-\.,]\s*(\d+)\s*(am|pm)?/i.exec(text); if (match && match.length >= 3) { var hour = Number(match[1]); var minute = Number(match[2]) if (hour == 12 && match[3]) hour -= 12; if (match[3] && match[3].toLowerCase() == 'pm') hour += 12; return { hour: hour, minute: minute }; } else { return null; } } function timeToMinutes(time) { return time && (time.hour * 60 + time.minute); } function renderTimeSelect(element, options) { var minTime = timeToMinutes(options.minTime); var maxTime = timeToMinutes(options.maxTime); var defaultTime = timeToMinutes(options.defaultTime); var selection = options.selection && timeToMinutes(parseTime(options.selection)); var mnt= options.minutes, onh = options.onehour,hrs = options.hours; //Round selection to nearest time interval so that it matches a list item selection = selection && ( ( Math.floor((selection - minTime) / options.timeInterval) * options.timeInterval ) + minTime ); var scrollTo; //Element to scroll the dropdown box to when shown var ul = $('<ul></ul>'); for (var time = minTime; time <= maxTime; time += options.timeInterval) { (function(time) { var hour = Math.floor(time / 60); var minute = time % 60; var timeText = formatTime(hour, minute, options); var fullText = timeText; if (options.showDuration) { var duration = time - minTime; if (duration < 60) { fullText += ' (' + duration + ' '+mnt+')'; } else if (duration == 60) { fullText += ' (' +onh+')'; } else { //Round partial hours to 1 decimal place fullText += ' (' + (Math.round(duration / 60.0 * 10.0) / 10.0) + ' '+hrs+')'; } } var li = $('<li></li>').append( $('<a href="javascript:void(0);">' + fullText + '</a>') .click(function() { if (options && options.selectTime) { options.selectTime(timeText); } return false; }).mousemove(function() { $('li.selected', ul).removeClass('selected'); }).hover( function(){ $(this).addClass('ui-state-hover'); }, function(){ $(this).removeClass('ui-state-hover'); } ) ).appendTo(ul); //Set to scroll to the default hour, unless already set if (!scrollTo && time == defaultTime) scrollTo = li; if (selection == time) { //Highlight selected item li.addClass('selected').addClass("ui-state-highlight"); //Set to scroll to the selected hour // //This is set even if scrollTo is already set, since //scrolling to selected hour is more important than //scrolling to default hour scrollTo = li; } })(time); } if (scrollTo) { //Set timeout of zero so code runs immediately after any calling //functions are finished (this is needed, since box hasn't been //added to the DOM yet) setTimeout(function() { //Scroll the dropdown box so that scrollTo item is in //the middle element[0].scrollTop = scrollTo[0].offsetTop - scrollTo.height() * 2; }, 0); } element.empty().append(ul); } $.fn.calendricalTime = function(options) { options = options || {}; options.timeInterval = options.timeInterval || 30; options.padding = options.padding || 4; return this.each(function() { var element = $(this); var div; var within = false; element.bind('focus click', function() { if (div) return; var offset = element.position(); div = $('<div></div>') .addClass('calendricalTimePopup ui-widget ui-widget-content') .mouseenter(function() { within = true; }) .mouseleave(function() { within = false; }) .mousedown(function(e) { e.preventDefault(); }) .css({ position: 'absolute', left: offset.left, top: offset.top + element.height() + options.padding * 2 }); element.after(div); var renderOptions = { selection: element.val(), selectTime: function(time) { within = false; element.val(time); div.remove(); div = null; }, isoTime: options.isoTime || false, meridiemUpperCase: options.meridiemUpperCase || false, defaultTime: options.defaultTime || {hour: 8, minute: 0}, minTime: options.minTime || {hour: 0, minute: 0}, maxTime: options.maxTime || {hour: 23, minute: 59}, timeInterval: options.timeInterval || 30, minutes: options.minutes || 'mins', onehour: options.onehour || '1 hr', hours: options.hours || 'hrs' }; if (options.startTime) { var startTime = parseTime(options.startTime.val()); //Don't display duration if part of a datetime range, //and start and end times are on different days if (options.startDate && options.endDate && !areDatesEqual(parseDate(options.startDate.val()), parseDate(options.endDate.val()))) { startTime = null; } if (startTime) { renderOptions.minTime = startTime; renderOptions.showDuration = true; div.addClass('calendricalEndTimePopup'); } } renderTimeSelect(div, renderOptions); }).blur(function() { if (within){ if (div) element.focus(); return; } if (!div) return; div.remove(); div = null; }); }); }, $.fn.calendricalTimeRange = function(options) { if (this.length >= 2) { $(this[0]).calendricalTime(options); $(this[1]).calendricalTime($.extend({ startTime: $(this[0]) }, options)); } return this; }; })(jQuery); /* * jQuery timepicker addon * By: Trent Richardson [http://trentrichardson.com] * Version 0.9.4 * Last Modified: 05/12/2011 * * Copyright 2011 Trent Richardson * Dual licensed under the MIT and GPL licenses. * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt * * HERES THE CSS: * .ui-timepicker-div .ui-widget-header{ margin-bottom: 8px; } * .ui-timepicker-div dl{ text-align: left; } * .ui-timepicker-div dl dt{ height: 25px; } * .ui-timepicker-div dl dd{ margin: -25px 0 10px 65px; } * .ui-timepicker-div td { font-size: 90%; } */ (function($) { $.extend($.ui, { timepicker: { version: "0.9.4" } }); /* Time picker manager. Use the singleton instance of this class, $.timepicker, to interact with the time picker. Settings for (groups of) time pickers are maintained in an instance object, allowing multiple different settings on the same page. */ function Timepicker() { this.regional = []; // Available regional settings, indexed by language code this.regional[''] = { // Default regional settings currentText: 'Now', closeText: 'Done', ampm: false, timeFormat: 'hh:mm tt', timeOnlyTitle: 'Choose Time', timeText: 'Time', hourText: 'Hour', minuteText: 'Minute', secondText: 'Second', timezoneText: 'Time Zone' }; this._defaults = { // Global defaults for all the datetime picker instances showButtonPanel: true, timeOnly: false, showHour: true, showMinute: true, showSecond: false, showTimezone: false, showTime: true, stepHour: 0.05, stepMinute: 0.05, stepSecond: 0.05, hour: 0, minute: 0, second: 0, timezone: '+0000', hourMin: 0, minuteMin: 0, secondMin: 0, hourMax: 23, minuteMax: 59, secondMax: 59, minDateTime: null, maxDateTime: null, hourGrid: 0, minuteGrid: 0, secondGrid: 0, alwaysSetTime: true, separator: ' ', altFieldTimeOnly: true, showTimepicker: true, timezoneList: ["-1100", "-1000", "-0900", "-0800", "-0700", "-0600", "-0500", "-0400", "-0300", "-0200", "-0100", "+0000", "+0100", "+0200", "+0300", "+0400", "+0500", "+0600", "+0700", "+0800", "+0900", "+1000", "+1100", "+1200"] }; $.extend(this._defaults, this.regional['']); } $.extend(Timepicker.prototype, { $input: null, $altInput: null, $timeObj: null, inst: null, hour_slider: null, minute_slider: null, second_slider: null, timezone_select: null, hour: 0, minute: 0, second: 0, timezone: '+0000', hourMinOriginal: null, minuteMinOriginal: null, secondMinOriginal: null, hourMaxOriginal: null, minuteMaxOriginal: null, secondMaxOriginal: null, ampm: '', formattedDate: '', formattedTime: '', formattedDateTime: '', timezoneList: ["-1100", "-1000", "-0900", "-0800", "-0700", "-0600", "-0500", "-0400", "-0300", "-0200", "-0100", "+0000", "+0100", "+0200", "+0300", "+0400", "+0500", "+0600", "+0700", "+0800", "+0900", "+1000", "+1100", "+1200"], /* Override the default settings for all instances of the time picker. @param settings object - the new settings to use as defaults (anonymous object) @return the manager object */ setDefaults: function(settings) { extendRemove(this._defaults, settings || {}); return this; }, //######################################################################## // Create a new Timepicker instance //######################################################################## _newInst: function($input, o) { var tp_inst = new Timepicker(), inlineSettings = {}; for (var attrName in this._defaults) { var attrValue = $input.attr('time:' + attrName); if (attrValue) { try { inlineSettings[attrName] = eval(attrValue); } catch (err) { inlineSettings[attrName] = attrValue; } } } tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, { beforeShow: function(input, dp_inst) { if ($.isFunction(o.beforeShow)) o.beforeShow(input, dp_inst, tp_inst); }, onChangeMonthYear: function(year, month, dp_inst) { // Update the time as well : this prevents the time from disappearing from the $input field. tp_inst._updateDateTime(dp_inst); if ($.isFunction(o.onChangeMonthYear)) o.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst); }, onClose: function(dateText, dp_inst) { if (tp_inst.timeDefined === true && $input.val() != '') tp_inst._updateDateTime(dp_inst); if ($.isFunction(o.onClose)) o.onClose.call($input[0], dateText, dp_inst, tp_inst); }, timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker'); }); tp_inst.hour = tp_inst._defaults.hour; tp_inst.minute = tp_inst._defaults.minute; tp_inst.second = tp_inst._defaults.second; tp_inst.ampm = ''; tp_inst.$input = $input; if (o.altField) tp_inst.$altInput = $(o.altField) .css({ cursor: 'pointer' }) .focus(function(){ $input.trigger("focus"); }); // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime.. if(tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime()); if(tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime()); if(tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime()); if(tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime()); return tp_inst; }, //######################################################################## // add our sliders to the calendar //######################################################################## _addTimePicker: function(dp_inst) { var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val(); this.timeDefined = this._parseTime(currDT); this._limitMinMaxDateTime(dp_inst, false); this._injectTimePicker(); }, //######################################################################## // parse the time string from input value or _setTime //######################################################################## _parseTime: function(timeString, withDate) { var regstr = this._defaults.timeFormat.toString() .replace(/h{1,2}/ig, '(\\d?\\d)') .replace(/m{1,2}/ig, '(\\d?\\d)') .replace(/s{1,2}/ig, '(\\d?\\d)') .replace(/t{1,2}/ig, '(am|pm|a|p)?') .replace(/z{1}/ig, '((\\+|-)\\d\\d\\d\\d)?') .replace(/\s/g, '\\s?') + '$', order = this._getFormatPositions(), treg; if (!this.inst) this.inst = $.datepicker._getInst(this.$input[0]); if (withDate || !this._defaults.timeOnly) { // the time should come after x number of characters and a space. // x = at least the length of text specified by the date format var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat'); // escape special regex characters in the seperator var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); regstr = '.{' + dp_dateFormat.length + ',}' + this._defaults.separator.replace(specials, "\\$&") + regstr; } treg = timeString.match(new RegExp(regstr, 'i')); if (treg) { if (order.t !== -1) this.ampm = ((treg[order.t] === undefined || treg[order.t].length === 0) ? '' : (treg[order.t].charAt(0).toUpperCase() == 'A') ? 'AM' : 'PM').toUpperCase(); if (order.h !== -1) { if (this.ampm == 'AM' && treg[order.h] == '12') this.hour = 0; // 12am = 0 hour else if (this.ampm == 'PM' && treg[order.h] != '12') this.hour = (parseFloat(treg[order.h]) + 12).toFixed(0); // 12pm = 12 hour, any other pm = hour + 12 else this.hour = Number(treg[order.h]); } if (order.m !== -1) this.minute = Number(treg[order.m]); if (order.s !== -1) this.second = Number(treg[order.s]); if (order.z !== -1) this.timezone = treg[order.z]; return true; } return false; }, //######################################################################## // figure out position of time elements.. cause js cant do named captures //######################################################################## _getFormatPositions: function() { var finds = this._defaults.timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|t{1,2}|z)/g), orders = { h: -1, m: -1, s: -1, t: -1, z: -1 }; if (finds) for (var i = 0; i < finds.length; i++) if (orders[finds[i].toString().charAt(0)] == -1) orders[finds[i].toString().charAt(0)] = i + 1; return orders; }, //######################################################################## // generate and inject html for timepicker into ui datepicker //######################################################################## _injectTimePicker: function() { var $dp = this.inst.dpDiv, o = this._defaults, tp_inst = this, // Added by Peter Medeiros: // - Figure out what the hour/minute/second max should be based on the step values. // - Example: if stepMinute is 15, then minMax is 45. hourMax = (o.hourMax - (o.hourMax % o.stepHour)).toFixed(0), minMax = (o.minuteMax - (o.minuteMax % o.stepMinute)).toFixed(0), secMax = (o.secondMax - (o.secondMax % o.stepSecond)).toFixed(0), dp_id = this.inst.id.toString().replace(/([^A-Za-z0-9_])/g, ''); // Prevent displaying twice //if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0) { if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0 && o.showTimepicker) { var noDisplay = ' style="display:none;"', html = '<div class="ui-timepicker-div" id="ui-timepicker-div-' + dp_id + '"><dl>' + '<dt class="ui_tpicker_time_label" id="ui_tpicker_time_label_' + dp_id + '"' + ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' + '<dd class="ui_tpicker_time" id="ui_tpicker_time_' + dp_id + '"' + ((o.showTime) ? '' : noDisplay) + '></dd>' + '<dt class="ui_tpicker_hour_label" id="ui_tpicker_hour_label_' + dp_id + '"' + ((o.showHour) ? '' : noDisplay) + '>' + o.hourText + '</dt>', hourGridSize = 0, minuteGridSize = 0, secondGridSize = 0, size; if (o.showHour && o.hourGrid > 0) { html += '<dd class="ui_tpicker_hour">' + '<div id="ui_tpicker_hour_' + dp_id + '"' + ((o.showHour) ? '' : noDisplay) + '></div>' + '<div style="padding-left: 1px"><table><tr>'; for (var h = o.hourMin; h < hourMax; h += o.hourGrid) { hourGridSize++; var tmph = (o.ampm && h > 12) ? h-12 : h; if (tmph < 10) tmph = '0' + tmph; if (o.ampm) { if (h == 0) tmph = 12 +'a'; else if (h < 12) tmph += 'a'; else tmph += 'p'; } html += '<td>' + tmph + '</td>'; } html += '</tr></table></div>' + '</dd>'; } else html += '<dd class="ui_tpicker_hour" id="ui_tpicker_hour_' + dp_id + '"' + ((o.showHour) ? '' : noDisplay) + '></dd>'; html += '<dt class="ui_tpicker_minute_label" id="ui_tpicker_minute_label_' + dp_id + '"' + ((o.showMinute) ? '' : noDisplay) + '>' + o.minuteText + '</dt>'; if (o.showMinute && o.minuteGrid > 0) { html += '<dd class="ui_tpicker_minute ui_tpicker_minute_' + o.minuteGrid + '">' + '<div id="ui_tpicker_minute_' + dp_id + '"' + ((o.showMinute) ? '' : noDisplay) + '></div>' + '<div style="padding-left: 1px"><table><tr>'; for (var m = o.minuteMin; m < minMax; m += o.minuteGrid) { minuteGridSize++; html += '<td>' + ((m < 10) ? '0' : '') + m + '</td>'; } html += '</tr></table></div>' + '</dd>'; } else html += '<dd class="ui_tpicker_minute" id="ui_tpicker_minute_' + dp_id + '"' + ((o.showMinute) ? '' : noDisplay) + '></dd>'; html += '<dt class="ui_tpicker_second_label" id="ui_tpicker_second_label_' + dp_id + '"' + ((o.showSecond) ? '' : noDisplay) + '>' + o.secondText + '</dt>'; if (o.showSecond && o.secondGrid > 0) { html += '<dd class="ui_tpicker_second ui_tpicker_second_' + o.secondGrid + '">' + '<div id="ui_tpicker_second_' + dp_id + '"' + ((o.showSecond) ? '' : noDisplay) + '></div>' + '<div style="padding-left: 1px"><table><tr>'; for (var s = o.secondMin; s < secMax; s += o.secondGrid) { secondGridSize++; html += '<td>' + ((s < 10) ? '0' : '') + s + '</td>'; } html += '</tr></table></div>' + '</dd>'; } else html += '<dd class="ui_tpicker_second" id="ui_tpicker_second_' + dp_id + '"' + ((o.showSecond) ? '' : noDisplay) + '></dd>'; html += '<dt class="ui_tpicker_timezone_label" id="ui_tpicker_timezone_label_' + dp_id + '"' + ((o.showTimezone) ? '' : noDisplay) + '>' + o.timezoneText + '</dt>'; html += '<dd class="ui_tpicker_timezone" id="ui_tpicker_timezone_' + dp_id + '"' + ((o.showTimezone) ? '' : noDisplay) + '></dd>'; html += '</dl></div>'; $tp = $(html); // if we only want time picker... if (o.timeOnly === true) { $tp.prepend( '<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>'); $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide(); } this.hour_slider = $tp.find('#ui_tpicker_hour_'+ dp_id).slider({ orientation: "horizontal", value: this.hour, min: o.hourMin, max: hourMax, step: o.stepHour, slide: function(event, ui) { tp_inst.hour_slider.slider( "option", "value", ui.value); tp_inst._onTimeChange(); } }); // Updated by Peter Medeiros: // - Pass in Event and UI instance into slide function this.minute_slider = $tp.find('#ui_tpicker_minute_'+ dp_id).slider({ orientation: "horizontal", value: this.minute, min: o.minuteMin, max: minMax, step: o.stepMinute, slide: function(event, ui) { // update the global minute slider instance value with the current slider value tp_inst.minute_slider.slider( "option", "value", ui.value); tp_inst._onTimeChange(); } }); this.second_slider = $tp.find('#ui_tpicker_second_'+ dp_id).slider({ orientation: "horizontal", value: this.second, min: o.secondMin, max: secMax, step: o.stepSecond, slide: function(event, ui) { tp_inst.second_slider.slider( "option", "value", ui.value); tp_inst._onTimeChange(); } }); this.timezone_select = $tp.find('#ui_tpicker_timezone_'+ dp_id).append('<select></select>').find("select"); $.fn.append.apply(this.timezone_select, $.map(o.timezoneList, function(val, idx) { return $("<option />") .val(typeof val == "object" ? val.value : val) .text(typeof val == "object" ? val.label : val); }) ); this.timezone_select.val((typeof this.timezone != "undefined" && this.timezone != null && this.timezone != "") ? this.timezone : o.timezone); this.timezone_select.change(function() { tp_inst._onTimeChange(); }); // Add grid functionality if (o.showHour && o.hourGrid > 0) { size = 100 * hourGridSize * o.hourGrid / (hourMax - o.hourMin); $tp.find(".ui_tpicker_hour table").css({ width: size + "%", marginLeft: (size / (-2 * hourGridSize)) + "%", borderCollapse: 'collapse' }).find("td").each( function(index) { $(this).click(function() { var h = $(this).html(); if(o.ampm) { var ap = h.substring(2).toLowerCase(), aph = parseInt(h.substring(0,2)); if (ap == 'a') { if (aph == 12) h = 0; else h = aph; } else if (aph == 12) h = 12; else h = aph + 12; } tp_inst.hour_slider.slider("option", "value", h); tp_inst._onTimeChange(); tp_inst._onSelectHandler(); }).css({ cursor: 'pointer', width: (100 / hourGridSize) + '%', textAlign: 'center', overflow: 'hidden' }); }); } if (o.showMinute && o.minuteGrid > 0) { size = 100 * minuteGridSize * o.minuteGrid / (minMax - o.minuteMin); $tp.find(".ui_tpicker_minute table").css({ width: size + "%", marginLeft: (size / (-2 * minuteGridSize)) + "%", borderCollapse: 'collapse' }).find("td").each(function(index) { $(this).click(function() { tp_inst.minute_slider.slider("option", "value", $(this).html()); tp_inst._onTimeChange(); tp_inst._onSelectHandler(); }).css({ cursor: 'pointer', width: (100 / minuteGridSize) + '%', textAlign: 'center', overflow: 'hidden' }); }); } if (o.showSecond && o.secondGrid > 0) { $tp.find(".ui_tpicker_second table").css({ width: size + "%", marginLeft: (size / (-2 * secondGridSize)) + "%", borderCollapse: 'collapse' }).find("td").each(function(index) { $(this).click(function() { tp_inst.second_slider.slider("option", "value", $(this).html()); tp_inst._onTimeChange(); tp_inst._onSelectHandler(); }).css({ cursor: 'pointer', width: (100 / secondGridSize) + '%', textAlign: 'center', overflow: 'hidden' }); }); } var $buttonPanel = $dp.find('.ui-datepicker-buttonpane'); if ($buttonPanel.length) $buttonPanel.before($tp); else $dp.append($tp); this.$timeObj = $tp.find('#ui_tpicker_time_'+ dp_id); if (this.inst !== null) { var timeDefined = this.timeDefined; this._onTimeChange(); this.timeDefined = timeDefined; } //Emulate datepicker onSelect behavior. Call on slidestop. var onSelectDelegate = function() { tp_inst._onSelectHandler(); } this.hour_slider.bind('slidestop',onSelectDelegate); this.minute_slider.bind('slidestop',onSelectDelegate); this.second_slider.bind('slidestop',onSelectDelegate); } }, //######################################################################## // This function tries to limit the ability to go outside the // min/max date range //######################################################################## _limitMinMaxDateTime: function(dp_inst, adjustSliders){ var o = this._defaults, dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay); if(!this._defaults.showTimepicker) return; // No time so nothing to check here if(this._defaults.minDateTime !== null && dp_date){ var minDateTime = this._defaults.minDateTime, minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0); if(this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null){ this.hourMinOriginal = o.hourMin; this.minuteMinOriginal = o.minuteMin; this.secondMinOriginal = o.secondMin; } if(dp_inst.settings.timeOnly || minDateTimeDate.getTime() == dp_date.getTime()) { this._defaults.hourMin = minDateTime.getHours(); if (this.hour <= this._defaults.hourMin) { this.hour = this._defaults.hourMin; this._defaults.minuteMin = minDateTime.getMinutes(); if (this.minute <= this._defaults.minuteMin) { this.minute = this._defaults.minuteMin; this._defaults.secondMin = minDateTime.getSeconds(); } else { if(this.second < this._defaults.secondMin) this.second = this._defaults.secondMin; this._defaults.secondMin = this.secondMinOriginal; } } else { this._defaults.minuteMin = this.minuteMinOriginal; this._defaults.secondMin = this.secondMinOriginal; } }else{ this._defaults.hourMin = this.hourMinOriginal; this._defaults.minuteMin = this.minuteMinOriginal; this._defaults.secondMin = this.secondMinOriginal; } } if(this._defaults.maxDateTime !== null && dp_date){ var maxDateTime = this._defaults.maxDateTime, maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0); if(this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null){ this.hourMaxOriginal = o.hourMax; this.minuteMaxOriginal = o.minuteMax; this.secondMaxOriginal = o.secondMax; } if(dp_inst.settings.timeOnly || maxDateTimeDate.getTime() == dp_date.getTime()){ this._defaults.hourMax = maxDateTime.getHours(); if (this.hour >= this._defaults.hourMax) { this.hour = this._defaults.hourMax; this._defaults.minuteMax = maxDateTime.getMinutes(); if (this.minute >= this._defaults.minuteMax) { this.minute = this._defaults.minuteMax; this._defaults.secondMin = maxDateTime.getSeconds(); } else { if(this.second > this._defaults.secondMax) this.second = this._defaults.secondMax; this._defaults.secondMax = this.secondMaxOriginal; } } else { this._defaults.minuteMax = this.minuteMaxOriginal; this._defaults.secondMax = this.secondMaxOriginal; } }else{ this._defaults.hourMax = this.hourMaxOriginal; this._defaults.minuteMax = this.minuteMaxOriginal; this._defaults.secondMax = this.secondMaxOriginal; } } if(adjustSliders !== undefined && adjustSliders === true){ this.hour_slider.slider("option", { min: this._defaults.hourMin, max: this._defaults.hourMax }).slider('value', this.hour); this.minute_slider.slider("option", { min: this._defaults.minuteMin, max: this._defaults.minuteMax }).slider('value', this.minute); this.second_slider.slider("option", { min: this._defaults.secondMin, max: this._defaults.secondMax }).slider('value', this.second); } }, //######################################################################## // when a slider moves, set the internal time... // on time change is also called when the time is updated in the text field //######################################################################## _onTimeChange: function() { var hour = (this.hour_slider) ? this.hour_slider.slider('value') : false, minute = (this.minute_slider) ? this.minute_slider.slider('value') : false, second = (this.second_slider) ? this.second_slider.slider('value') : false, timezone = (this.timezone_select) ? this.timezone_select.val() : false if (hour !== false) hour = parseInt(hour,10); if (minute !== false) minute = parseInt(minute,10); if (second !== false) second = parseInt(second,10); var ampm = (hour < 12) ? 'AM' : 'PM'; // If the update was done in the input field, the input field should not be updated. // If the update was done using the sliders, update the input field. var hasChanged = (hour != this.hour || minute != this.minute || second != this.second || (this.ampm.length > 0 && this.ampm != ampm) || timezone != this.timezone); if (hasChanged) { if (hour !== false)this.hour = hour; if (minute !== false) this.minute = minute; if (second !== false) this.second = second; if (timezone !== false) this.timezone = timezone; this._limitMinMaxDateTime(this.inst, true); } if (this._defaults.ampm) this.ampm = ampm; this._formatTime(); if (this.$timeObj) this.$timeObj.text(this.formattedTime); this.timeDefined = true; if (hasChanged) this._updateDateTime(); }, //######################################################################## // call custom onSelect. // bind to sliders slidestop, and grid click. //######################################################################## _onSelectHandler: function() { var onSelect = this._defaults['onSelect']; var inputEl = this.$input ? this.$input[0] : null; if (onSelect && inputEl) { onSelect.apply(inputEl, [this.formattedDateTime, this]); } }, //######################################################################## // format the time all pretty... //######################################################################## _formatTime: function(time, format, ampm) { if (ampm == undefined) ampm = this._defaults.ampm; time = time || { hour: this.hour, minute: this.minute, second: this.second, ampm: this.ampm, timezone: this.timezone }; var tmptime = format || this._defaults.timeFormat.toString(); if (ampm) { var hour12 = ((time.ampm == 'AM') ? (time.hour) : (time.hour % 12)); hour12 = (Number(hour12) === 0) ? 12 : hour12; tmptime = tmptime.toString() .replace(/hh/g, ((hour12 < 10) ? '0' : '') + hour12) .replace(/h/g, hour12) .replace(/mm/g, ((time.minute < 10) ? '0' : '') + time.minute) .replace(/m/g, time.minute) .replace(/ss/g, ((time.second < 10) ? '0' : '') + time.second) .replace(/s/g, time.second) .replace(/TT/g, time.ampm.toUpperCase()) .replace(/tt/g, time.ampm.toLowerCase()) .replace(/T/g, time.ampm.charAt(0).toUpperCase()) .replace(/t/g, time.ampm.charAt(0).toLowerCase()) .replace(/z/g, time.timezone); } else { tmptime = tmptime.toString() .replace(/hh/g, ((time.hour < 10) ? '0' : '') + time.hour) .replace(/h/g, time.hour) .replace(/mm/g, ((time.minute < 10) ? '0' : '') + time.minute) .replace(/m/g, time.minute) .replace(/ss/g, ((time.second < 10) ? '0' : '') + time.second) .replace(/s/g, time.second) .replace(/z/g, time.timezone); tmptime = $.trim(tmptime.replace(/t/gi, '')); } if (arguments.length) return tmptime; else this.formattedTime = tmptime; }, //######################################################################## // update our input with the new date time.. //######################################################################## _updateDateTime: function(dp_inst) { dp_inst = this.inst || dp_inst, dt = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay), dateFmt = $.datepicker._get(dp_inst, 'dateFormat'), formatCfg = $.datepicker._getFormatConfig(dp_inst), timeAvailable = dt !== null && this.timeDefined; this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg); var formattedDateTime = this.formattedDate; if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) return; if (this._defaults.timeOnly === true) { formattedDateTime = this.formattedTime; } else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) { formattedDateTime += this._defaults.separator + this.formattedTime; } this.formattedDateTime = formattedDateTime; if(!this._defaults.showTimepicker) { this.$input.val(this.formattedDate); } else if (this.$altInput && this._defaults.altFieldTimeOnly === true) { this.$altInput.val(this.formattedTime); this.$input.val(this.formattedDate); } else if(this.$altInput) { this.$altInput.val(formattedDateTime); this.$input.val(formattedDateTime); } else { this.$input.val(formattedDateTime); } this.$input.trigger("change"); } }); $.fn.extend({ //######################################################################## // shorthand just to use timepicker.. //######################################################################## timepicker: function(o) { o = o || {}; var tmp_args = arguments; if (typeof o == 'object') tmp_args[0] = $.extend(o, { timeOnly: true }); return $(this).each(function() { $.fn.datetimepicker.apply($(this), tmp_args); }); }, //######################################################################## // extend timepicker to datepicker //######################################################################## datetimepicker: function(o) { o = o || {}; var $input = this, tmp_args = arguments; if (typeof(o) == 'string'){ if(o == 'getDate') return $.fn.datepicker.apply($(this[0]), tmp_args); else return this.each(function() { var $t = $(this); $t.datepicker.apply($t, tmp_args); }); } else return this.each(function() { var $t = $(this); $t.datepicker($.timepicker._newInst($t, o)._defaults); }); } }); //######################################################################## // the bad hack :/ override datepicker so it doesnt close on select // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378 //######################################################################## $.datepicker._base_selectDate = $.datepicker._selectDate; $.datepicker._selectDate = function (id, dateStr) { var inst = this._getInst($(id)[0]), tp_inst = this._get(inst, 'timepicker'); if (tp_inst) { tp_inst._limitMinMaxDateTime(inst, true); inst.inline = inst.stay_open = true; //This way the onSelect handler called from calendarpicker get the full dateTime this._base_selectDate(id, dateStr + tp_inst._defaults.separator + tp_inst.formattedTime); inst.inline = inst.stay_open = false; this._notifyChange(inst); this._updateDatepicker(inst); } else this._base_selectDate(id, dateStr); }; //############################################################################################# // second bad hack :/ override datepicker so it triggers an event when changing the input field // and does not redraw the datepicker on every selectDate event //############################################################################################# $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker; $.datepicker._updateDatepicker = function(inst) { if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) { this._base_updateDatepicker(inst); // Reload the time control when changing something in the input text field. var tp_inst = this._get(inst, 'timepicker'); if(tp_inst) tp_inst._addTimePicker(inst); } }; //####################################################################################### // third bad hack :/ override datepicker so it allows spaces and colan in the input field //####################################################################################### $.datepicker._base_doKeyPress = $.datepicker._doKeyPress; $.datepicker._doKeyPress = function(event) { var inst = $.datepicker._getInst(event.target), tp_inst = $.datepicker._get(inst, 'timepicker'); if (tp_inst) { if ($.datepicker._get(inst, 'constrainInput')) { var ampm = tp_inst._defaults.ampm, datetimeChars = tp_inst._defaults.timeFormat.toString() .replace(/[hms]/g, '') .replace(/TT/g, ampm ? 'APM' : '') .replace(/T/g, ampm ? 'AP' : '') .replace(/tt/g, ampm ? 'apm' : '') .replace(/t/g, ampm ? 'ap' : '') + " " + tp_inst._defaults.separator + $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')), chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode); return event.ctrlKey || (chr < ' ' || !datetimeChars || datetimeChars.indexOf(chr) > -1); } } return $.datepicker._base_doKeyPress(event); }; //####################################################################################### // Override key up event to sync manual input changes. //####################################################################################### $.datepicker._base_doKeyUp = $.datepicker._doKeyUp; $.datepicker._doKeyUp = function (event) { var inst = $.datepicker._getInst(event.target), tp_inst = $.datepicker._get(inst, 'timepicker'); if (tp_inst) { if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) { try { $.datepicker._updateDatepicker(inst); } catch (err) { $.datepicker.log(err); } } } return $.datepicker._base_doKeyUp(event); }; //####################################################################################### // override "Today" button to also grab the time. //####################################################################################### $.datepicker._base_gotoToday = $.datepicker._gotoToday; $.datepicker._gotoToday = function(id) { this._base_gotoToday(id); this._setTime(this._getInst($(id)[0]), new Date()); }; //####################################################################################### // Disable & enable the Time in the datetimepicker //####################################################################################### $.datepicker._disableTimepickerDatepicker = function(target, date, withDate) { var inst = this._getInst(target), tp_inst = this._get(inst, 'timepicker'); $(target).datepicker('getDate'); // Init selected[Year|Month|Day] if (tp_inst) { tp_inst._defaults.showTimepicker = false; tp_inst._updateDateTime(inst); } }; $.datepicker._enableTimepickerDatepicker = function(target, date, withDate) { var inst = this._getInst(target), tp_inst = this._get(inst, 'timepicker'); $(target).datepicker('getDate'); // Init selected[Year|Month|Day] if (tp_inst) { tp_inst._defaults.showTimepicker = true; tp_inst._addTimePicker(inst); // Could be disabled on page load tp_inst._updateDateTime(inst); } }; //####################################################################################### // Create our own set time function //####################################################################################### $.datepicker._setTime = function(inst, date) { var tp_inst = this._get(inst, 'timepicker'); if (tp_inst) { var defaults = tp_inst._defaults, // calling _setTime with no date sets time to defaults hour = date ? date.getHours() : defaults.hour, minute = date ? date.getMinutes() : defaults.minute, second = date ? date.getSeconds() : defaults.second; //check if within min/max times.. if ((hour < defaults.hourMin || hour > defaults.hourMax) || (minute < defaults.minuteMin || minute > defaults.minuteMax) || (second < defaults.secondMin || second > defaults.secondMax)) { hour = defaults.hourMin; minute = defaults.minuteMin; second = defaults.secondMin; } if (tp_inst.hour_slider) tp_inst.hour_slider.slider('value', hour); else tp_inst.hour = hour; if (tp_inst.minute_slider) tp_inst.minute_slider.slider('value', minute); else tp_inst.minute = minute; if (tp_inst.second_slider) tp_inst.second_slider.slider('value', second); else tp_inst.second = second; tp_inst._onTimeChange(); tp_inst._updateDateTime(inst); } }; //####################################################################################### // Create new public method to set only time, callable as $().datepicker('setTime', date) //####################################################################################### $.datepicker._setTimeDatepicker = function(target, date, withDate) { var inst = this._getInst(target), tp_inst = this._get(inst, 'timepicker'); if (tp_inst) { this._setDateFromField(inst); var tp_date; if (date) { if (typeof date == "string") { tp_inst._parseTime(date, withDate); tp_date = new Date(); tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second); } else tp_date = new Date(date.getTime()); if (tp_date.toString() == 'Invalid Date') tp_date = undefined; this._setTime(inst, tp_date); } } }; //####################################################################################### // override setDate() to allow setting time too within Date object //####################################################################################### $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker; $.datepicker._setDateDatepicker = function(target, date) { var inst = this._getInst(target), tp_date = (date instanceof Date) ? new Date(date.getTime()) : date; this._updateDatepicker(inst); this._base_setDateDatepicker.apply(this, arguments); this._setTimeDatepicker(target, tp_date, true); }; //####################################################################################### // override getDate() to allow getting time too within Date object //####################################################################################### $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker; $.datepicker._getDateDatepicker = function(target, noDefault) { var inst = this._getInst(target), tp_inst = this._get(inst, 'timepicker'); if (tp_inst) { this._setDateFromField(inst, noDefault); var date = this._getDate(inst); if (date && tp_inst._parseTime($(target).val(), true)) date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second); return date; } return this._base_getDateDatepicker(target, noDefault); }; //####################################################################################### // jQuery extend now ignores nulls! //####################################################################################### function extendRemove(target, props) { $.extend(target, props); for (var name in props) if (props[name] === null || props[name] === undefined) target[name] = props[name]; return target; } $.timepicker = new Timepicker(); // singleton instance $.timepicker.version = "0.9.4"; })(jQuery); /* * jQuery UI Tooltip 1.9m2 * * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * http://docs.jquery.com/UI/Tooltip * * Depends: * jquery.ui.core.js * jquery.ui.widget.js * jquery.ui.position.js */ (function($) { // role=application on body required for screenreaders to correctly interpret aria attributes if( !$(document.body).is('[role]') ){ $(document.body).attr('role','application'); } var increments = 0; $.widget("ui.tooltip", { options: { tooltipClass: "ui-widget-content", content: function() { return $(this).attr("title"); }, position: { my: "left center", at: "right center", offset: "15 0" } }, _init: function() { var self = this; this.tooltip = $("<div></div>") .attr("id", "ui-tooltip-" + increments++) .attr("role", "tooltip") .attr("aria-hidden", "true") .addClass("ui-tooltip ui-widget ui-corner-all") .addClass(this.options.tooltipClass) .appendTo(document.body) .hide(); this.tooltipContent = $("<div></div>") .addClass("ui-tooltip-content") .appendTo(this.tooltip); this.opacity = this.tooltip.css("opacity"); this.element .bind("focus.tooltip mouseenter.tooltip", function(event) { self.open( event ); }) .bind("blur.tooltip mouseleave.tooltip", function(event) { self.close( event ); }); }, enable: function() { this.options.disabled = false; }, disable: function() { this.options.disabled = true; }, destroy: function() { this.tooltip.remove(); $.Widget.prototype.destroy.apply(this, arguments); }, widget: function() { return this.tooltip; }, open: function(event) { var target = this.element; // already visible? possible when both focus and mouseover events occur if (this.current && this.current[0] == target[0]) return; var self = this; this.current = target; this.currentTitle = target.attr("title"); var content = this.options.content.call(target[0], function(response) { // ignore async responses that come in after the tooltip is already hidden if (self.current == target) self._show(event, target, response); }); if (content) { self._show(event, target, content); } }, _show: function(event, target, content) { if (!content) return; target.attr("title", ""); if (this.options.disabled) return; this.tooltipContent.html(content); this.tooltip.css({ top: 0, left: 0 }).show().position($.extend(this.options.position, { of: target })).hide(); this.tooltip.attr("aria-hidden", "false"); target.attr("aria-describedby", this.tooltip.attr("id")); if (this.tooltip.is(":animated")) this.tooltip.stop().show().fadeTo("normal", this.opacity); else this.tooltip.is(':visible') ? this.tooltip.fadeTo("normal", this.opacity) : this.tooltip.fadeIn(); this._trigger( "open", event ); }, close: function(event) { if (!this.current) return; var current = this.current.attr("title", this.currentTitle); if (this.options.disabled) return; this.current.removeAttr("aria-describedby"); this.current = null; this.tooltip.attr("aria-hidden", "true"); if (this.tooltip.is(':animated')) this.tooltip.stop().fadeTo("normal", 0, function() { $(this).hide().css("opacity", ""); }); else this.tooltip.stop().fadeOut(); this._trigger( "close", event ); } }); })(jQuery);;(function($){ /* * jqGrid common function * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html */ /*global jQuery, $ */ $.jgrid = $.jgrid || {}; $.extend($.jgrid,{ guid : 1, uidPref: 'jqg', randId : function( prefix ) { return (prefix? prefix: $.jgrid.uidPref) + ($.jgrid.guid++); } }); $.extend($.jgrid,{ // Modal functions showModal : function(h) { h.w.show(); }, closeModal : function(h) { h.w.hide().attr("aria-hidden","true"); if(h.o) {h.o.remove();} }, hideModal : function (selector,o) { o = $.extend({jqm : true, gb :''}, o || {}); if(o.onClose) { var oncret = o.onClose(selector); if (typeof oncret == 'boolean' && !oncret ) { return; } } if ($.fn.jqm && o.jqm === true) { $(selector).attr("aria-hidden","true").jqmHide(); } else { if(o.gb !== '') { try {$(".jqgrid-overlay:first",o.gb).hide();} catch (e){} } $(selector).hide().attr("aria-hidden","true"); } }, //Helper functions findPos : function(obj) { var curleft = 0, curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); //do not change obj == obj.offsetParent } return [curleft,curtop]; }, createModal : function(aIDs, content, p, insertSelector, posSelector, appendsel, css) { var mw = document.createElement('div'), rtlsup, self = this; css = $.extend({}, css || {}); rtlsup = $(p.gbox).attr("dir") == "rtl" ? true : false; mw.className= "ui-widget ui-widget-content ui-corner-all ui-jqdialog"; mw.id = aIDs.themodal; var mh = document.createElement('div'); mh.className = "ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"; mh.id = aIDs.modalhead; $(mh).append("<span class='ui-jqdialog-title'>"+p.caption+"</span>"); var ahr= $("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>") .hover(function(){ahr.addClass('ui-state-hover');}, function(){ahr.removeClass('ui-state-hover');}) .append("<span class='ui-icon ui-icon-closethick'></span>"); $(mh).append(ahr); if(rtlsup) { mw.dir = "rtl"; $(".ui-jqdialog-title",mh).css("float","right"); $(".ui-jqdialog-titlebar-close",mh).css("left",0.3+"em"); } else { mw.dir = "ltr"; $(".ui-jqdialog-title",mh).css("float","left"); $(".ui-jqdialog-titlebar-close",mh).css("right",0.3+"em"); } var mc = document.createElement('div'); $(mc).addClass("ui-jqdialog-content ui-widget-content").attr("id",aIDs.modalcontent); $(mc).append(content); mw.appendChild(mc); $(mw).prepend(mh); if(appendsel===true) { $('body').append(mw); } //append as first child in body -for alert dialog else if (typeof appendsel == "string") $(appendsel).append(mw); else {$(mw).insertBefore(insertSelector);} $(mw).css(css); if(typeof p.jqModal === 'undefined') {p.jqModal = true;} // internal use var coord = {}; if ( $.fn.jqm && p.jqModal === true) { if(p.left ===0 && p.top===0 && p.overlay) { var pos = []; pos = this.findPos(posSelector); p.left = pos[0] + 4; p.top = pos[1] + 4; } coord.top = p.top+"px"; coord.left = p.left; } else if(p.left !==0 || p.top!==0) { coord.left = p.left; coord.top = p.top+"px"; } $("a.ui-jqdialog-titlebar-close",mh).click(function(e){ var oncm = $("#"+aIDs.themodal).data("onClose") || p.onClose; var gboxclose = $("#"+aIDs.themodal).data("gbox") || p.gbox; self.hideModal("#"+aIDs.themodal,{gb:gboxclose,jqm:p.jqModal,onClose:oncm}); return false; }); if (p.width === 0 || !p.width) {p.width = 300;} if(p.height === 0 || !p.height) {p.height =200;} if(!p.zIndex) { var parentZ = $(insertSelector).parents("*[role=dialog]").filter(':first').css("z-index"); if(parentZ) { p.zIndex = parseInt(parentZ,10)+1; } else { p.zIndex = 950; } } var rtlt = 0; if( rtlsup && coord.left && !appendsel) { rtlt = $(p.gbox).width()- (!isNaN(p.width) ? parseInt(p.width,10) :0) - 8; // to do // just in case coord.left = parseInt(coord.left,10) + parseInt(rtlt,10); } if(coord.left) { coord.left += "px"; } $(mw).css($.extend({ width: isNaN(p.width) ? "auto": p.width+"px", height:isNaN(p.height) ? "auto" : p.height + "px", zIndex:p.zIndex, overflow: 'hidden' },coord)) .attr({tabIndex: "-1","role":"dialog","aria-labelledby":aIDs.modalhead,"aria-hidden":"true"}); if(typeof p.drag == 'undefined') { p.drag=true;} if(typeof p.resize == 'undefined') {p.resize=true;} if (p.drag) { $(mh).css('cursor','move'); if($.fn.jqDrag) { $(mw).jqDrag(mh); } else { try { $(mw).draggable({handle: $("#"+mh.id)}); } catch (e) {} } } if(p.resize) { if($.fn.jqResize) { $(mw).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>"); $("#"+aIDs.themodal).jqResize(".jqResize",aIDs.scrollelm ? "#"+aIDs.scrollelm : false); } else { try { $(mw).resizable({handles: 'se, sw',alsoResize: aIDs.scrollelm ? "#"+aIDs.scrollelm : false}); } catch (r) {} } } if(p.closeOnEscape === true){ $(mw).keydown( function( e ) { if( e.which == 27 ) { var cone = $("#"+aIDs.themodal).data("onClose") || p.onClose; self.hideModal(this,{gb:p.gbox,jqm:p.jqModal,onClose: cone}); } }); } }, viewModal : function (selector,o){ o = $.extend({ toTop: true, overlay: 10, modal: false, onShow: this.showModal, onHide: this.closeModal, gbox: '', jqm : true, jqM : true }, o || {}); if ($.fn.jqm && o.jqm === true) { if(o.jqM) { $(selector).attr("aria-hidden","false").jqm(o).jqmShow(); } else {$(selector).attr("aria-hidden","false").jqmShow();} } else { if(o.gbox !== '') { $(".jqgrid-overlay:first",o.gbox).show(); $(selector).data("gbox",o.gbox); } $(selector).show().attr("aria-hidden","false"); try{$(':input:visible',selector)[0].focus();}catch(_){} } }, info_dialog : function(caption, content,c_b, modalopt) { var mopt = { width:290, height:'auto', dataheight: 'auto', drag: true, resize: false, caption:"<b>"+caption+"</b>", left:250, top:170, zIndex : 1000, jqModal : true, modal : false, closeOnEscape : true, align: 'center', buttonalign : 'center', buttons : [] // {text:'textbutt', id:"buttid", onClick : function(){...}} // if the id is not provided we set it like info_button_+ the index in the array - i.e info_button_0,info_button_1... }; $.extend(mopt,modalopt || {}); var jm = mopt.jqModal, self = this; if($.fn.jqm && !jm) { jm = false; } // in case there is no jqModal var buttstr =""; if(mopt.buttons.length > 0) { for(var i=0;i<mopt.buttons.length;i++) { if(typeof mopt.buttons[i].id == "undefined") { mopt.buttons[i].id = "info_button_"+i; } buttstr += "<a href='javascript:void(0)' id='"+mopt.buttons[i].id+"' class='fm-button ui-state-default ui-corner-all'>"+mopt.buttons[i].text+"</a>"; } } var dh = isNaN(mopt.dataheight) ? mopt.dataheight : mopt.dataheight+"px", cn = "text-align:"+mopt.align+";"; var cnt = "<div id='info_id'>"; cnt += "<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+dh+";"+cn+"'>"+content+"</div>"; cnt += c_b ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+c_b+"</a>"+buttstr+"</div>" : buttstr !== "" ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+buttstr+"</div>" : ""; cnt += "</div>"; try { if($("#info_dialog").attr("aria-hidden") == "false") { this.hideModal("#info_dialog",{jqm:jm}); } $("#info_dialog").remove(); } catch (e){} this.createModal({ themodal:'info_dialog', modalhead:'info_head', modalcontent:'info_content', scrollelm: 'infocnt'}, cnt, mopt, '','',true ); // attach onclick after inserting into the dom if(buttstr) { $.each(mopt.buttons,function(i){ $("#"+this.id,"#info_id").bind('click',function(){mopt.buttons[i].onClick.call($("#info_dialog")); return false;}); }); } $("#closedialog", "#info_id").click(function(e){ self.hideModal("#info_dialog",{jqm:jm}); return false; }); $(".fm-button","#info_dialog").hover( function(){$(this).addClass('ui-state-hover');}, function(){$(this).removeClass('ui-state-hover');} ); if($.isFunction(mopt.beforeOpen) ) { mopt.beforeOpen(); } this.viewModal("#info_dialog",{ onHide: function(h) { h.w.hide().remove(); if(h.o) { h.o.remove(); } }, modal :mopt.modal, jqm:jm }); if($.isFunction(mopt.afterOpen) ) { mopt.afterOpen(); } try{ $("#info_dialog").focus();} catch (m){} }, // Form Functions createEl : function(eltype,options,vl,autowidth, ajaxso) { var elem = ""; function bindEv (el, opt) { if($.isFunction(opt.dataInit)) { opt.dataInit(el); } if(opt.dataEvents) { $.each(opt.dataEvents, function() { if (this.data !== undefined) { $(el).bind(this.type, this.data, this.fn); } else { $(el).bind(this.type, this.fn); } }); } return opt; } function setAttributes(elm, atr, exl ) { var exclude = ['dataInit','dataEvents','dataUrl', 'buildSelect','sopt', 'searchhidden', 'defaultValue', 'attr']; if(typeof(exl) != "undefined" && $.isArray(exl)) { exclude = $.extend(exclude, exl); } $.each(atr, function(key, value){ if($.inArray(key, exclude) === -1) { $(elm).attr(key,value); } }); if(!atr.hasOwnProperty('id')) { $(elm).attr('id', $.jgrid.randId()); } } switch (eltype) { case "textarea" : elem = document.createElement("textarea"); if(autowidth) { if(!options.cols) { $(elem).css({width:"98%"});} } else if (!options.cols) { options.cols = 20; } if(!options.rows) { options.rows = 2; } if(vl=='&nbsp;' || vl=='&#160;' || (vl.length==1 && vl.charCodeAt(0)==160)) {vl="";} elem.value = vl; setAttributes(elem, options); options = bindEv(elem,options); $(elem).attr({"role":"textbox","multiline":"true"}); break; case "checkbox" : //what code for simple checkbox elem = document.createElement("input"); elem.type = "checkbox"; if( !options.value ) { var vl1 = vl.toLowerCase(); if(vl1.search(/(false|0|no|off|undefined)/i)<0 && vl1!=="") { elem.checked=true; elem.defaultChecked=true; elem.value = vl; } else { elem.value = "on"; } $(elem).attr("offval","off"); } else { var cbval = options.value.split(":"); if(vl === cbval[0]) { elem.checked=true; elem.defaultChecked=true; } elem.value = cbval[0]; $(elem).attr("offval",cbval[1]); } setAttributes(elem, options, ['value']); options = bindEv(elem,options); $(elem).attr("role","checkbox"); break; case "select" : elem = document.createElement("select"); elem.setAttribute("role","select"); var msl, ovm = []; if(options.multiple===true) { msl = true; elem.multiple="multiple"; $(elem).attr("aria-multiselectable","true"); } else { msl = false; } if(typeof(options.dataUrl) != "undefined") { $.ajax($.extend({ url: options.dataUrl, type : "GET", dataType: "html", context: {elem:elem, options:options, vl:vl}, success: function(data,status){ var a, ovm = [], elem = this.elem, vl = this.vl, options = $.extend({},this.options), msl = options.multiple===true; if(typeof(options.buildSelect) != "undefined") { var b = options.buildSelect(data); a = $(b).html(); } else { a = $(data).html(); } if(a) { $(elem).append(a); setAttributes(elem, options); options = bindEv(elem,options); if(typeof options.size === 'undefined') { options.size = msl ? 3 : 1;} if(msl) { ovm = vl.split(","); ovm = $.map(ovm,function(n){return $.trim(n);}); } else { ovm[0] = $.trim(vl); } //$(elem).attr(options); setTimeout(function(){ $("option",elem).each(function(i){ //if(i===0) { this.selected = ""; } $(this).attr("role","option"); if($.inArray($.trim($(this).text()),ovm) > -1 || $.inArray($.trim($(this).val()),ovm) > -1 ) { this.selected= "selected"; } }); },0); } } },ajaxso || {})); } else if(options.value) { var i; if(msl) { ovm = vl.split(","); ovm = $.map(ovm,function(n){return $.trim(n);}); if(typeof options.size === 'undefined') {options.size = 3;} } else { options.size = 1; } if(typeof options.value === 'function') { options.value = options.value(); } var so,sv, ov; if(typeof options.value === 'string') { so = options.value.split(";"); for(i=0; i<so.length;i++){ sv = so[i].split(":"); if(sv.length > 2 ) { sv[1] = $.map(sv,function(n,i){if(i>0) { return n;} }).join(":"); } ov = document.createElement("option"); ov.setAttribute("role","option"); ov.value = sv[0]; ov.innerHTML = sv[1]; if (!msl && ($.trim(sv[0]) == $.trim(vl) || $.trim(sv[1]) == $.trim(vl))) { ov.selected ="selected"; } if (msl && ($.inArray($.trim(sv[1]), ovm)>-1 || $.inArray($.trim(sv[0]), ovm)>-1)) {ov.selected ="selected";} elem.appendChild(ov); } } else if (typeof options.value === 'object') { var oSv = options.value; for ( var key in oSv) { if (oSv.hasOwnProperty(key ) ){ ov = document.createElement("option"); ov.setAttribute("role","option"); ov.value = key; ov.innerHTML = oSv[key]; if (!msl && ( $.trim(key) == $.trim(vl) || $.trim(oSv[key]) == $.trim(vl)) ) { ov.selected ="selected"; } if (msl && ($.inArray($.trim(oSv[key]),ovm)>-1 || $.inArray($.trim(key),ovm)>-1)) { ov.selected ="selected"; } elem.appendChild(ov); } } } setAttributes(elem, options, ['value']); options = bindEv(elem,options); } break; case "text" : case "password" : case "button" : var role; if(eltype=="button") { role = "button"; } else { role = "textbox"; } elem = document.createElement("input"); elem.type = eltype; elem.value = vl; setAttributes(elem, options); options = bindEv(elem,options); if(eltype != "button"){ if(autowidth) { if(!options.size) { $(elem).css({width:"98%"}); } } else if (!options.size) { options.size = 20; } } $(elem).attr("role",role); break; case "image" : case "file" : elem = document.createElement("input"); elem.type = eltype; setAttributes(elem, options); options = bindEv(elem,options); break; case "custom" : elem = document.createElement("span"); try { if($.isFunction(options.custom_element)) { var celm = options.custom_element.call(this,vl,options); if(celm) { celm = $(celm).addClass("customelement").attr({id:options.id,name:options.name}); $(elem).empty().append(celm); } else { throw "e2"; } } else { throw "e1"; } } catch (e) { if (e=="e1") { this.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.nodefined, $.jgrid.edit.bClose);} if (e=="e2") { this.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.novalue,$.jgrid.edit.bClose);} else { this.info_dialog($.jgrid.errors.errcap,typeof(e)==="string"?e:e.message,$.jgrid.edit.bClose); } } break; } return elem; }, // Date Validation Javascript checkDate : function (format, date) { var daysInFebruary = function(year){ // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 === 0) && ( year % 100 !== 0 || (year % 400 === 0))) ? 29 : 28 ); }, DaysArray = function(n) { for (var i = 1; i <= n; i++) { this[i] = 31; if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;} if (i==2) {this[i] = 29;} } return this; }; var tsp = {}, sep; format = format.toLowerCase(); //we search for /,-,. for the date separator if(format.indexOf("/") != -1) { sep = "/"; } else if(format.indexOf("-") != -1) { sep = "-"; } else if(format.indexOf(".") != -1) { sep = "."; } else { sep = "/"; } format = format.split(sep); date = date.split(sep); if (date.length != 3) { return false; } var j=-1,yln, dln=-1, mln=-1; for(var i=0;i<format.length;i++){ var dv = isNaN(date[i]) ? 0 : parseInt(date[i],10); tsp[format[i]] = dv; yln = format[i]; if(yln.indexOf("y") != -1) { j=i; } if(yln.indexOf("m") != -1) { mln=i; } if(yln.indexOf("d") != -1) { dln=i; } } if (format[j] == "y" || format[j] == "yyyy") { yln=4; } else if(format[j] =="yy"){ yln = 2; } else { yln = -1; } var daysInMonth = DaysArray(12), strDate; if (j === -1) { return false; } else { strDate = tsp[format[j]].toString(); if(yln == 2 && strDate.length == 1) {yln = 1;} if (strDate.length != yln || (tsp[format[j]]===0 && date[j]!="00")){ return false; } } if(mln === -1) { return false; } else { strDate = tsp[format[mln]].toString(); if (strDate.length<1 || tsp[format[mln]]<1 || tsp[format[mln]]>12){ return false; } } if(dln === -1) { return false; } else { strDate = tsp[format[dln]].toString(); if (strDate.length<1 || tsp[format[dln]]<1 || tsp[format[dln]]>31 || (tsp[format[mln]]==2 && tsp[format[dln]]>daysInFebruary(tsp[format[j]])) || tsp[format[dln]] > daysInMonth[tsp[format[mln]]]){ return false; } } return true; }, isEmpty : function(val) { if (val.match(/^\s+$/) || val === "") { return true; } else { return false; } }, checkTime : function(time){ // checks only hh:ss (and optional am/pm) var re = /^(\d{1,2}):(\d{2})([ap]m)?$/,regs; if(!this.isEmpty(time)) { regs = time.match(re); if(regs) { if(regs[3]) { if(regs[1] < 1 || regs[1] > 12) { return false; } } else { if(regs[1] > 23) { return false; } } if(regs[2] > 59) { return false; } } else { return false; } } return true; }, checkValues : function(val, valref,g, customobject, nam) { var edtrul,i, nm, dft, len; if(typeof(customobject) === "undefined") { if(typeof(valref)=='string'){ for( i =0, len=g.p.colModel.length;i<len; i++){ if(g.p.colModel[i].name==valref) { edtrul = g.p.colModel[i].editrules; valref = i; try { nm = g.p.colModel[i].formoptions.label; } catch (e) {} break; } } } else if(valref >=0) { edtrul = g.p.colModel[valref].editrules; } } else { edtrul = customobject; nm = nam===undefined ? "_" : nam; } if(edtrul) { if(!nm) { nm = g.p.colNames[valref]; } if(edtrul.required === true) { if( this.isEmpty(val) ) { return [false,nm+": "+$.jgrid.edit.msg.required,""]; } } // force required var rqfield = edtrul.required === false ? false : true; if(edtrul.number === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.number,""]; } } } if(typeof edtrul.minValue != 'undefined' && !isNaN(edtrul.minValue)) { if (parseFloat(val) < parseFloat(edtrul.minValue) ) { return [false,nm+": "+$.jgrid.edit.msg.minValue+" "+edtrul.minValue,""];} } if(typeof edtrul.maxValue != 'undefined' && !isNaN(edtrul.maxValue)) { if (parseFloat(val) > parseFloat(edtrul.maxValue) ) { return [false,nm+": "+$.jgrid.edit.msg.maxValue+" "+edtrul.maxValue,""];} } var filter; if(edtrul.email === true) { if( !(rqfield === false && this.isEmpty(val)) ) { // taken from $ Validate plugin filter = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i; if(!filter.test(val)) {return [false,nm+": "+$.jgrid.edit.msg.email,""];} } } if(edtrul.integer === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.integer,""]; } if ((val % 1 !== 0) || (val.indexOf('.') != -1)) { return [false,nm+": "+$.jgrid.edit.msg.integer,""];} } } if(edtrul.date === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if(g.p.colModel[valref].formatoptions && g.p.colModel[valref].formatoptions.newformat) { dft = g.p.colModel[valref].formatoptions.newformat; } else { dft = g.p.colModel[valref].datefmt || "Y-m-d"; } if(!this.checkDate (dft, val)) { return [false,nm+": "+$.jgrid.edit.msg.date+" - "+dft,""]; } } } if(edtrul.time === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if(!this.checkTime (val)) { return [false,nm+": "+$.jgrid.edit.msg.date+" - hh:mm (am/pm)",""]; } } } if(edtrul.url === true) { if( !(rqfield === false && this.isEmpty(val)) ) { filter = /^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i; if(!filter.test(val)) {return [false,nm+": "+$.jgrid.edit.msg.url,""];} } } if(edtrul.custom === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if($.isFunction(edtrul.custom_func)) { var ret = edtrul.custom_func.call(g,val,nm); if($.isArray(ret)) { return ret; } else { return [false,$.jgrid.edit.msg.customarray,""]; } } else { return [false,$.jgrid.edit.msg.customfcheck,""]; } } } } return [true,"",""]; } }); })(jQuery);/* * jqFilter jQuery jqGrid filter addon. * Copyright (c) 2011, Tony Tomov, tony@trirand.com * Dual licensed under the MIT and GPL licenses * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html * * The work is inspired from this Stefan Pirvu * http://www.codeproject.com/KB/scripting/json-filtering.aspx * * The filter uses JSON entities to hold filter rules and groups. Here is an example of a filter: { "groupOp": "AND", "groups" : [ { "groupOp": "OR", "rules": [ { "field": "name", "op": "eq", "data": "England" }, { "field": "id", "op": "le", "data": "5"} ] } ], "rules": [ { "field": "name", "op": "eq", "data": "Romania" }, { "field": "id", "op": "le", "data": "1"} ] } */ /*global jQuery, $, window, navigator */ (function ($) { $.fn.jqFilter = function( arg ) { if (typeof arg === 'string') { var fn = $.fn.jqFilter[arg]; if (!fn) { throw ("jqFilter - No such method: " + arg); } var args = $.makeArray(arguments).slice(1); return fn.apply(this,args); } var p = $.extend(true,{ filter: null, columns: [], onChange : null, checkValues : null, error: false, errmsg : "", errorcheck : true, showQuery : true, sopt : null, ops : [ {"name": "eq", "description": "equal", "operator":"="}, {"name": "ne", "description": "not equal", "operator":"<>"}, {"name": "lt", "description": "less", "operator":"<"}, {"name": "le", "description": "less or equal","operator":"<="}, {"name": "gt", "description": "greater", "operator":">"}, {"name": "ge", "description": "greater or equal", "operator":">="}, {"name": "bw", "description": "begins with", "operator":"LIKE"}, {"name": "bn", "description": "does not begin with", "operator":"NOT LIKE"}, {"name": "in", "description": "in", "operator":"IN"}, {"name": "ni", "description": "not in", "operator":"NOT IN"}, {"name": "ew", "description": "ends with", "operator":"LIKE"}, {"name": "en", "description": "does not end with", "operator":"NOT LIKE"}, {"name": "cn", "description": "contains", "operator":"LIKE"}, {"name": "nc", "description": "does not contain", "operator":"NOT LIKE"}, {"name": "nu", "description": "is null", "operator":"IS NULL"}, {"name": "nn", "description": "is not null", "operator":"IS NOT NULL"} ], numopts : ['eq','ne', 'lt', 'le', 'gt', 'ge', 'nu', 'nn', 'in', 'ni'], stropts : ['eq', 'ne', 'bw', 'bn', 'ew', 'en', 'cn', 'nc', 'nu', 'nn', 'in', 'ni'], _gridsopt : [], // grid translated strings, do not tuch groupOps : ["AND", "OR"], groupButton : true }, arg || {}); return this.each( function() { if (this.filter) {return;} this.p = p; // setup filter in case if they is not defined if (this.p.filter === null || this.p.filter === undefined) { this.p.filter = { groupOp: this.p.groupOps[0], rules: [], groups: [] }; } var i, len = this.p.columns.length, cl, isIE = /msie/i.test(navigator.userAgent) && !window.opera; // translating the options if(this.p._gridsopt.length) { // ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc'] for(i=0;i<this.p._gridsopt.length;i++) { this.p.ops[i].description = this.p._gridsopt[i]; } } this.p.initFilter = $.extend(true,{},this.p.filter); // set default values for the columns if they are not set if( !len ) {return;} for(i=0; i < len; i++) { cl = this.p.columns[i]; if( cl.stype ) { // grid compatibility cl.inputtype = cl.stype; } else if(!cl.inputtype) { cl.inputtype = 'text'; } if( cl.sorttype ) { // grid compatibility cl.searchtype = cl.sorttype; } else if (!cl.searchtype) { cl.searchtype = 'string'; } if(cl.hidden === undefined) { // jqGrid compatibility cl.hidden = false; } if(!cl.label) { cl.label = cl.name; } if(cl.index) { cl.name = cl.index; } if(!cl.hasOwnProperty('searchoptions')) { cl.searchoptions = {}; } if(!cl.hasOwnProperty('searchrules')) { cl.searchrules = {}; } } if(this.p.showQuery) { $(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;'><tbody><tr><td class='query'></td></tr></tbody></table>"); } /* *Perform checking. * */ var checkData = function(val, colModelItem) { var ret = [true,""]; if($.isFunction(colModelItem.searchrules)) { ret = colModelItem.searchrules(val, colModelItem); } else if($.jgrid && $.jgrid.checkValues) { try { ret = $.jgrid.checkValues(val, -1, null, colModelItem.searchrules, colModelItem.label); } catch (e) {} } if(ret && ret.length && ret[0] === false) { p.error = !ret[0]; p.errmsg = ret[1]; } }; /* moving to common randId = function() { return Math.floor(Math.random()*10000).toString(); }; */ this.onchange = function ( ){ // clear any error this.p.error = false; this.p.errmsg=""; return $.isFunction(this.p.onChange) ? this.p.onChange.call( this, this.p ) : false; }; /* * Redrow the filter every time when new field is added/deleted * and field is changed */ this.reDraw = function() { $("table.group:first",this).remove(); var t = this.createTableForGroup(p.filter, null); $(this).append(t); }; /* * Creates a grouping data for the filter * @param group - object * @param parentgroup - object */ this.createTableForGroup = function(group, parentgroup) { var that = this, i; // this table will hold all the group (tables) and rules (rows) var table = $("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>"); // create error message row if(parentgroup === null) { $(table).append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='left'></th></tr>"); } var tr = $("<tr></tr>"); $(table).append(tr); // this header will hold the group operator type and group action buttons for // creating subgroup "+ {}", creating rule "+" or deleting the group "-" var th = $("<th colspan='5' align='left'></th>"); tr.append(th); // dropdown for: choosing group operator type var groupOpSelect = $("<select class='opsel'></select>"); th.append(groupOpSelect); // populate dropdown with all posible group operators: or, and var str= "", selected; for (i = 0; i < p.groupOps.length; i++) { selected = group.groupOp === that.p.groupOps[i] ? " selected='selected'" :""; str += "<option value='"+that.p.groupOps[i]+"'" + selected+">"+that.p.groupOps[i]+"</option>"; } groupOpSelect .append(str) .bind('change',function() { group.groupOp = $(groupOpSelect).val(); that.onchange(); // signals that the filter has changed }); // button for adding a new subgroup var inputAddSubgroup ="<span></span>"; if(this.p.groupButton) { inputAddSubgroup = $("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>"); inputAddSubgroup.bind('click',function() { if (group.groups === undefined ) { group.groups = []; } group.groups.push({ groupOp: p.groupOps[0], rules: [], groups: [] }); // adding a new group that.reDraw(); // the html has changed, force reDraw that.onchange(); // signals that the filter has changed return false; }); } th.append(inputAddSubgroup); // button for adding a new rule var inputAddRule = $("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"), cm; inputAddRule.bind('click',function() { //if(!group) { group = {};} if (group.rules === undefined) { group.rules = []; } for (i = 0; i < that.p.columns.length; i++) { // but show only serchable and serchhidden = true fields var searchable = (typeof that.p.columns[i].search === 'undefined') ? true: that.p.columns[i].search , hidden = (that.p.columns[i].hidden === true), ignoreHiding = (that.p.columns[i].searchoptions.searchhidden === true); if ((ignoreHiding && searchable) || (searchable && !hidden)) { cm = that.p.columns[i]; break; } } var opr; if( cm.searchoptions.sopt ) {opr = cm.searchoptions.sopt;} else if(that.p.sopt) { opr= that.p.sopt; } else if (cm.searchtype === 'string') {opr = that.p.stropts;} else {opr = that.p.numopts;} group.rules.push({ field: cm.name, op: opr[0], data: "" }); // adding a new rule that.reDraw(); // the html has changed, force reDraw // for the moment no change have been made to the rule, so // this will not trigger onchange event return false; }); th.append(inputAddRule); // button for delete the group if (parentgroup !== null) { // ignore the first group var inputDeleteGroup = $("<input type='button' value='-' title='Delete group' class='delete-group'/>"); th.append(inputDeleteGroup); inputDeleteGroup.bind('click',function() { // remove group from parent for (i = 0; i < parentgroup.groups.length; i++) { if (parentgroup.groups[i] === group) { parentgroup.groups.splice(i, 1); break; } } that.reDraw(); // the html has changed, force reDraw that.onchange(); // signals that the filter has changed return false; }); } // append subgroup rows if (group.groups !== undefined) { for (i = 0; i < group.groups.length; i++) { var trHolderForSubgroup = $("<tr></tr>"); table.append(trHolderForSubgroup); var tdFirstHolderForSubgroup = $("<td class='first'></td>"); trHolderForSubgroup.append(tdFirstHolderForSubgroup); var tdMainHolderForSubgroup = $("<td colspan='4'></td>"); tdMainHolderForSubgroup.append(this.createTableForGroup(group.groups[i], group)); trHolderForSubgroup.append(tdMainHolderForSubgroup); } } if(group.groupOp === undefined) { group.groupOp = that.p.groupOps[0]; } // append rules rows if (group.rules !== undefined) { for (i = 0; i < group.rules.length; i++) { table.append( this.createTableRowForRule(group.rules[i], group) ); } } return table; }; /* * Create the rule data for the filter */ this.createTableRowForRule = function(rule, group ) { // save current entity in a variable so that it could // be referenced in anonimous method calls var that=this, tr = $("<tr></tr>"), //document.createElement("tr"), // first column used for padding //tdFirstHolderForRule = document.createElement("td"), i, op, trpar, cm, str="", selected; //tdFirstHolderForRule.setAttribute("class", "first"); tr.append("<td class='first'></td>"); // create field container var ruleFieldTd = $("<td class='columns'></td>"); tr.append(ruleFieldTd); // dropdown for: choosing field var ruleFieldSelect = $("<select></select>"), ina, aoprs = []; ruleFieldTd.append(ruleFieldSelect); ruleFieldSelect.bind('change',function() { rule.field = $(ruleFieldSelect).val(); trpar = $(this).parents("tr:first"); for (i=0;i<that.p.columns.length;i++) { if(that.p.columns[i].name === rule.field) { cm = that.p.columns[i]; break; } } if(!cm) {return;} cm.searchoptions.id = $.jgrid.randId(); if(isIE && cm.inputtype === "text") { if(!cm.searchoptions.size) { cm.searchoptions.size = 10; } } var elm = $.jgrid.createEl(cm.inputtype,cm.searchoptions, "", true, that.p.ajaxSelectOptions, true); $(elm).addClass("input-elm"); //that.createElement(rule, ""); if( cm.searchoptions.sopt ) {op = cm.searchoptions.sopt;} else if(that.p.sopt) { op= that.p.sopt; } else if (cm.searchtype === 'string') {op = that.p.stropts;} else {op = that.p.numopts;} // operators var s ="",so=""; aoprs = []; $.each(that.p.ops, function() { aoprs.push(this.name) }); for ( i = 0 ; i < op.length; i++) { ina = $.inArray(op[i],aoprs); if(ina !== -1) { so =""; if(i===0) { rule.op = that.p.ops[ina].name; so = " selected='selected'"; } s += "<option value='"+that.p.ops[ina].name+"'"+ so+">"+that.p.ops[ina].description+"</option>"; } } $(".selectopts",trpar).empty().append( s ); // data $(".data",trpar).empty().append( elm ); $(".input-elm",trpar).bind('change',function() { rule.data = $(this).val(); that.onchange(); // signals that the filter has changed }); setTimeout(function(){ //IE, Opera, Chrome rule.data = $(elm).val(); that.onchange(); // signals that the filter has changed }, 0); }); // populate drop down with user provided column definitions var j=0; for (i = 0; i < that.p.columns.length; i++) { // but show only serchable and serchhidden = true fields var searchable = (typeof that.p.columns[i].search === 'undefined') ? true: that.p.columns[i].search , hidden = (that.p.columns[i].hidden === true), ignoreHiding = (that.p.columns[i].searchoptions.searchhidden === true); if ((ignoreHiding && searchable) || (searchable && !hidden)) { selected = ""; if(rule.field === that.p.columns[i].name) { selected = " selected='selected'"; j=i; } str += "<option value='"+that.p.columns[i].name+"'" +selected+">"+that.p.columns[i].label+"</option>"; } } ruleFieldSelect.append( str ); // create operator container var ruleOperatorTd = $("<td class='operators'></td>"); tr.append(ruleOperatorTd); cm = p.columns[j]; // create it here so it can be referentiated in the onchange event //var RD = that.createElement(rule, rule.data); cm.searchoptions.id = $.jgrid.randId(); if(isIE && cm.inputtype === "text") { if(!cm.searchoptions.size) { cm.searchoptions.size = 10; } } var ruleDataInput = $.jgrid.createEl(cm.inputtype,cm.searchoptions, rule.data, true, that.p.ajaxSelectOptions, true); // dropdown for: choosing operator var ruleOperatorSelect = $("<select class='selectopts'></select>"); ruleOperatorTd.append(ruleOperatorSelect); ruleOperatorSelect.bind('change',function() { rule.op = $(ruleOperatorSelect).val(); trpar = $(this).parents("tr:first"); var rd = $(".input-elm",trpar)[0]; if (rule.op === "nu" || rule.op === "nn") { // disable for operator "is null" and "is not null" rule.data = ""; rd.value = ""; rd.setAttribute("readonly", "true"); rd.setAttribute("disabled", "true"); } else { rd.removeAttribute("readonly"); rd.removeAttribute("disabled"); } that.onchange(); // signals that the filter has changed }); // populate drop down with all available operators if( cm.searchoptions.sopt ) {op = cm.searchoptions.sopt;} else if(that.p.sopt) { op= that.p.sopt; } else if (cm.searchtype === 'string') {op = p.stropts;} else {op = that.p.numopts;} str=""; $.each(that.p.ops, function() { aoprs.push(this.name) }); for ( i = 0; i < op.length; i++) { ina = $.inArray(op[i],aoprs); if(ina !== -1) { selected = rule.op === that.p.ops[ina].name ? " selected='selected'" : ""; str += "<option value='"+that.p.ops[ina].name+"'"+selected+">"+that.p.ops[ina].description+"</option>"; } } ruleOperatorSelect.append( str ); // create data container var ruleDataTd = $("<td class='data'></td>"); tr.append(ruleDataTd); // textbox for: data // is created previously //ruleDataInput.setAttribute("type", "text"); ruleDataTd.append(ruleDataInput); $(ruleDataInput) .addClass("input-elm") .bind('change', function() { rule.data = $(this).val(); that.onchange(); // signals that the filter has changed }); // create action container var ruleDeleteTd = $("<td></td>"); tr.append(ruleDeleteTd); // create button for: delete rule var ruleDeleteInput = $("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>"); ruleDeleteTd.append(ruleDeleteInput); //$(ruleDeleteInput).html("").height(20).width(30).button({icons: { primary: "ui-icon-minus", text:false}}); ruleDeleteInput.bind('click',function() { // remove rule from group for (i = 0; i < group.rules.length; i++) { if (group.rules[i] === rule) { group.rules.splice(i, 1); break; } } that.reDraw(); // the html has changed, force reDraw that.onchange(); // signals that the filter has changed return false; }); return tr; }; this.getStringForGroup = function(group) { var s = "(", index; if (group.groups !== undefined) { for (index = 0; index < group.groups.length; index++) { if (s.length > 1) { s += " " + group.groupOp + " "; } try { s += this.getStringForGroup(group.groups[index]); } catch (eg) {alert(eg);} } } if (group.rules !== undefined) { try{ for (index = 0; index < group.rules.length; index++) { if (s.length > 1) { s += " " + group.groupOp + " "; } s += this.getStringForRule(group.rules[index]); } } catch (e) {alert(e);} } s += ")"; if (s === "()") { return ""; // ignore groups that don't have rules } else { return s; } }; this.getStringForRule = function(rule) { var opUF = "",opC="", i, cm, ret, val, numtypes = ['int', 'integer', 'float', 'number', 'currency']; // jqGrid for (i = 0; i < this.p.ops.length; i++) { if (this.p.ops[i].name === rule.op) { opUF = this.p.ops[i].operator; opC = this.p.ops[i].name; break; } } for (i=0; i<this.p.columns.length; i++) { if(this.p.columns[i].name === rule.field) { cm = this.p.columns[i]; break; } } val = rule.data; if(opC === 'bw' || opC === 'bn') { val = val+"%"; } if(opC === 'ew' || opC === 'en') { val = "%"+val; } if(opC === 'cn' || opC === 'nc') { val = "%"+val+"%"; } if(opC === 'in' || opC === 'ni') { val = " ("+val+")"; } if(p.errorcheck) { checkData(rule.data, cm); } if($.inArray(cm.searchtype, numtypes) !== -1 || opC === 'nn' || opC === 'nu') { ret = rule.field + " " + opUF + " " + val; } else { ret = rule.field + " " + opUF + " \"" + val + "\""; } return ret; }; this.resetFilter = function () { this.p.filter = $.extend(true,{},this.p.initFilter); this.reDraw(); this.onchange(); }; this.hideError = function() { $("th.ui-state-error", this).html(""); $("tr.error", this).hide(); }; this.showError = function() { $("th.ui-state-error", this).html(this.p.errmsg); $("tr.error", this).show(); }; this.toUserFriendlyString = function() { return this.getStringForGroup(p.filter); }; this.toString = function() { // this will obtain a string that can be used to match an item. var that = this; function getStringRule(rule) { if(that.p.errorcheck) { var i, cm; for (i=0; i<that.p.columns.length; i++) { if(that.p.columns[i].name === rule.field) { cm = that.p.columns[i]; break; } } if(cm) {checkData(rule.data, cm);} } return rule.op + "(item." + rule.field + ",'" + rule.data + "')"; } function getStringForGroup(group) { var s = "(", index; if (group.groups !== undefined) { for (index = 0; index < group.groups.length; index++) { if (s.length > 1) { if (group.groupOp === "OR") { s += " || "; } else { s += " && "; } } s += getStringForGroup(group.groups[index]); } } if (group.rules !== undefined) { for (index = 0; index < group.rules.length; index++) { if (s.length > 1) { if (group.groupOp === "OR") { s += " || "; } else { s += " && "; } } s += getStringRule(group.rules[index]); } } s += ")"; if (s === "()") { return ""; // ignore groups that don't have rules } else { return s; } } return getStringForGroup(this.p.filter); }; // Here we init the filter this.reDraw(); if(this.p.showQuery) { this.onchange(); } // mark is as created so that it will not be created twice on this element this.filter = true; }); }; $.extend($.fn.jqFilter,{ /* * Return SQL like string. Can be used directly */ toSQLString : function() { var s =""; this.each(function(){ s = this.toUserFriendlyString(); }); return s; }, /* * Return filter data as object. */ filterData : function() { var s; this.each(function(){ s = this.p.filter; }); return s; }, getParameter : function (param) { if(param !== undefined) { if (this.p.hasOwnProperty(param) ) { return this.p[param]; } } return this.p; }, resetFilter: function() { return this.each(function(){ this.resetFilter(); }); }, addFilter: function (pfilter) { if (typeof pfilter === "string") { pfilter = jQuery.jgrid.parse( pfilter ); } this.each(function(){ this.p.filter = pfilter; this.reDraw(); this.onchange(); }); } }); })(jQuery); /* The below work is licensed under Creative Commons GNU LGPL License. Original work: License: http://creativecommons.org/licenses/LGPL/2.1/ Author: Stefan Goessner/2006 Web: http://goessner.net/ Modifications made: Version: 0.9-p5 Description: Restructured code, JSLint validated (no strict whitespaces), added handling of empty arrays, empty strings, and int/floats values. Author: Michael Schøler/2008-01-29 Web: http://michael.hinnerup.net/blog/2008/01/26/converting-json-to-xml-and-xml-to-json/ Description: json2xml added support to convert functions as CDATA so it will be easy to write characters that cause some problems when convert Author: Tony Tomov */ /*global alert */ var xmlJsonClass = { // Param "xml": Element or document DOM node. // Param "tab": Tab or indent string for pretty output formatting omit or use empty string "" to supress. // Returns: JSON string xml2json: function(xml, tab) { if (xml.nodeType === 9) { // document node xml = xml.documentElement; } var nws = this.removeWhite(xml); var obj = this.toObj(nws); var json = this.toJson(obj, xml.nodeName, "\t"); return "{\n" + tab + (tab ? json.replace(/\t/g, tab) : json.replace(/\t|\n/g, "")) + "\n}"; }, // Param "o": JavaScript object // Param "tab": tab or indent string for pretty output formatting omit or use empty string "" to supress. // Returns: XML string json2xml: function(o, tab) { var toXml = function(v, name, ind) { var xml = ""; var i, n; if (v instanceof Array) { if (v.length === 0) { xml += ind + "<"+name+">__EMPTY_ARRAY_</"+name+">\n"; } else { for (i = 0, n = v.length; i < n; i += 1) { var sXml = ind + toXml(v[i], name, ind+"\t") + "\n"; xml += sXml; } } } else if (typeof(v) === "object") { var hasChild = false; xml += ind + "<" + name; var m; for (m in v) if (v.hasOwnProperty(m)) { if (m.charAt(0) === "@") { xml += " " + m.substr(1) + "=\"" + v[m].toString() + "\""; } else { hasChild = true; } } xml += hasChild ? ">" : "/>"; if (hasChild) { for (m in v) if (v.hasOwnProperty(m)) { if (m === "#text") { xml += v[m]; } else if (m === "#cdata") { xml += "<![CDATA[" + v[m] + "]]>"; } else if (m.charAt(0) !== "@") { xml += toXml(v[m], m, ind+"\t"); } } xml += (xml.charAt(xml.length - 1) === "\n" ? ind : "") + "</" + name + ">"; } } else if (typeof(v) === "function") { xml += ind + "<" + name + ">" + "<![CDATA[" + v + "]]>" + "</" + name + ">"; } else { if (v.toString() === "\"\"" || v.toString().length === 0) { xml += ind + "<" + name + ">__EMPTY_STRING_</" + name + ">"; } else { xml += ind + "<" + name + ">" + v.toString() + "</" + name + ">"; } } return xml; }; var xml = ""; var m; for (m in o) if (o.hasOwnProperty(m)) { xml += toXml(o[m], m, ""); } return tab ? xml.replace(/\t/g, tab) : xml.replace(/\t|\n/g, ""); }, // Internal methods toObj: function(xml) { var o = {}; var FuncTest = /function/i; if (xml.nodeType === 1) { // element node .. if (xml.attributes.length) { // element with attributes .. var i; for (i = 0; i < xml.attributes.length; i += 1) { o["@" + xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue || "").toString(); } } if (xml.firstChild) { // element has child nodes .. var textChild = 0, cdataChild = 0, hasElementChild = false; var n; for (n = xml.firstChild; n; n = n.nextSibling) { if (n.nodeType === 1) { hasElementChild = true; } else if (n.nodeType === 3 && n.nodeValue.match(/[^ \f\n\r\t\v]/)) { // non-whitespace text textChild += 1; } else if (n.nodeType === 4) { // cdata section node cdataChild += 1; } } if (hasElementChild) { if (textChild < 2 && cdataChild < 2) { // structured element with evtl. a single text or/and cdata node .. this.removeWhite(xml); for (n = xml.firstChild; n; n = n.nextSibling) { if (n.nodeType === 3) { // text node o["#text"] = this.escape(n.nodeValue); } else if (n.nodeType === 4) { // cdata node if (FuncTest.test(n.nodeValue)) { o[n.nodeName] = [o[n.nodeName], n.nodeValue]; } else { o["#cdata"] = this.escape(n.nodeValue); } } else if (o[n.nodeName]) { // multiple occurence of element .. if (o[n.nodeName] instanceof Array) { o[n.nodeName][o[n.nodeName].length] = this.toObj(n); } else { o[n.nodeName] = [o[n.nodeName], this.toObj(n)]; } } else { // first occurence of element .. o[n.nodeName] = this.toObj(n); } } } else { // mixed content if (!xml.attributes.length) { o = this.escape(this.innerXml(xml)); } else { o["#text"] = this.escape(this.innerXml(xml)); } } } else if (textChild) { // pure text if (!xml.attributes.length) { o = this.escape(this.innerXml(xml)); if (o === "__EMPTY_ARRAY_") { o = "[]"; } else if (o === "__EMPTY_STRING_") { o = ""; } } else { o["#text"] = this.escape(this.innerXml(xml)); } } else if (cdataChild) { // cdata if (cdataChild > 1) { o = this.escape(this.innerXml(xml)); } else { for (n = xml.firstChild; n; n = n.nextSibling) { if(FuncTest.test(xml.firstChild.nodeValue)) { o = xml.firstChild.nodeValue; break; } else { o["#cdata"] = this.escape(n.nodeValue); } } } } } if (!xml.attributes.length && !xml.firstChild) { o = null; } } else if (xml.nodeType === 9) { // document.node o = this.toObj(xml.documentElement); } else { alert("unhandled node type: " + xml.nodeType); } return o; }, toJson: function(o, name, ind, wellform) { if(wellform === undefined) wellform = true; var json = name ? ("\"" + name + "\"") : "", tab = "\t", newline = "\n"; if(!wellform) { tab= ""; newline= ""; } if (o === "[]") { json += (name ? ":[]" : "[]"); } else if (o instanceof Array) { var n, i, ar=[]; for (i = 0, n = o.length; i < n; i += 1) { ar[i] = this.toJson(o[i], "", ind + tab, wellform); } json += (name ? ":[" : "[") + (ar.length > 1 ? (newline + ind + tab + ar.join(","+newline + ind + tab) + newline + ind) : ar.join("")) + "]"; } else if (o === null) { json += (name && ":") + "null"; } else if (typeof(o) === "object") { var arr = [], m; for (m in o) { if (o.hasOwnProperty(m)) { arr[arr.length] = this.toJson(o[m], m, ind + tab, wellform); } } json += (name ? ":{" : "{") + (arr.length > 1 ? (newline + ind + tab + arr.join(","+newline + ind + tab) + newline + ind) : arr.join("")) + "}"; } else if (typeof(o) === "string") { /* var objRegExp = /(^-?\d+\.?\d*$)/; var FuncTest = /function/i; var os = o.toString(); if (objRegExp.test(os) || FuncTest.test(os) || os==="false" || os==="true") { // int or float json += (name && ":") + "\"" +os + "\""; } else { */ json += (name && ":") + "\"" + o.replace(/\\/g,'\\\\').replace(/\"/g,'\\"') + "\""; //} } else { json += (name && ":") + "\"" + o.toString()+ "\""; } return json; }, innerXml: function(node) { var s = ""; if ("innerHTML" in node) { s = node.innerHTML; } else { var asXml = function(n) { var s = "", i; if (n.nodeType === 1) { s += "<" + n.nodeName; for (i = 0; i < n.attributes.length; i += 1) { s += " " + n.attributes[i].nodeName + "=\"" + (n.attributes[i].nodeValue || "").toString() + "\""; } if (n.firstChild) { s += ">"; for (var c = n.firstChild; c; c = c.nextSibling) { s += asXml(c); } s += "</" + n.nodeName + ">"; } else { s += "/>"; } } else if (n.nodeType === 3) { s += n.nodeValue; } else if (n.nodeType === 4) { s += "<![CDATA[" + n.nodeValue + "]]>"; } return s; }; for (var c = node.firstChild; c; c = c.nextSibling) { s += asXml(c); } } return s; }, escape: function(txt) { return txt.replace(/[\\]/g, "\\\\").replace(/[\"]/g, '\\"').replace(/[\n]/g, '\\n').replace(/[\r]/g, '\\r'); }, removeWhite: function(e) { e.normalize(); var n; for (n = e.firstChild; n; ) { if (n.nodeType === 3) { // text node if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) { // pure whitespace text node var nxt = n.nextSibling; e.removeChild(n); n = nxt; } else { n = n.nextSibling; } } else if (n.nodeType === 1) { // element node this.removeWhite(n); n = n.nextSibling; } else { // any other node n = n.nextSibling; } } return e; } };/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * jqScheduler * Tony Tomov tony@trirand.com * http://trirand.net **/ (function($){ $.jqschedule = { /** * is the id of the calendar in the template file. If needed can be changed dynamically */ calendarid : "#calendar", eventid : "#event", /** * the url to all ajax cals. Should be set dynamucally from the application */ calendarurl : "", /** * locales which should be set dynamically * Note that this locales are used only from the common JS. the other should * be defined in the application specifically file. */ locales : { dateFormat : 'dd/MM/yyyy', bSave: 'Save', bAdd: 'Add', bDelete: 'Delete', bCancel: 'Cancel', bChange: 'Change', bClose : 'Close', bSearch : 'Find', editCaption : 'Edit event', addCaption: 'Add new event', userCaption: 'Change Calendar', searchCaption: 'Advanced search' }, /** *The columns for advanced search. * Should be changed at runtime, because of language */ searchCols : [], searchOpers : [], /** * Used in serach display. When the date is clicked switch to * agendaDay of the clicked day * * @param unixdate integer - the date in unixtimestamp format * @param cal_id string the id of the calendar */ gotoDayEventView : function( unixdate, cal_id ) { $("#b_search_cal").trigger('click'); var date = $.fullCalendar.parseDate( parseInt(unixdate,10) ); $($.jqschedule.calendarid).fullCalendar( 'gotoDate', date.getFullYear() , date.getMonth(), date.getDate() ); $($.jqschedule.calendarid).fullCalendar( 'changeView', 'agendaDay' ); }, /** * Opens a modal dialog for editing a data when on existing event is clicked. * Used in eventClick in fullcalendar * * @param event object is an Event Object that holds the event's information (date, title, etc). * @param jsEvent object holds the native JavaScript event with low-level information such as click coordinates. * @param view view holds the current View Object. * */ eventEditDialog : function(event, jsEvent, view ) { var dialogContent = $($.jqschedule.eventid); // reset Form $("input,textarea,select",dialogContent).val(''); // hide the time picker in case of allday if(event.allDay) { $('#endtime, #starttime', dialogContent).hide(); } else { $('#endtime, #starttime', dialogContent).show(); } $('#all_day',dialogContent).attr('checked',event.allDay); $('#title',dialogContent).val(event.title); // FireFox 4 fix setTimeout(function(){$('#description',dialogContent).val(event.description);},100); //alert($('#description','#event').val()); $('#location',dialogContent).val(event.location); $('#categories',dialogContent).val(event.className); $('#access',dialogContent).val(event.access); $('#start',dialogContent).val( $.fullCalendar.formatDate( event.start, $.jqschedule.locales.dateFormat ) ); $('#starttime', dialogContent).val( $.fullCalendar.formatDate( event.start, 'HH:mm' ) ); $('#end',dialogContent).val( $.fullCalendar.formatDate( event.end ? event.end : event.start, $.jqschedule.locales.dateFormat ) ); $('#endtime').val( $.fullCalendar.formatDate( event.end ? event.end : event.start, 'HH:mm' ) ); $('#user_id',dialogContent).val(event.user_id); var buttons = {}; var dateformat = $("#start",dialogContent).datepicker('option','dateFormat'); var dp; buttons[$.jqschedule.locales.bSave] = function() { var st = $.datepicker.parseDate(dateformat, $('#start',dialogContent).val()); var sttime = $('#starttime',dialogContent).val(); sttime = sttime ? sttime.split(":") : ['0','0']; st.setHours(parseInt(sttime[0],10),parseInt(sttime[1],10)); var en = $.datepicker.parseDate(dateformat, $('#end',dialogContent).val()); if(!en) en = $.datepicker.parseDate(dateformat, $('#start',dialogContent).val()); var entime = $('#endtime',dialogContent).val(); entime = entime ? entime.split(":") : ['0','0']; en.setHours(parseInt(entime[0],10),parseInt(entime[1],10)); if(en.getTime()-st.getTime() < 0 ) { alert("End time is little than start time"); return; } event.start = st; event._start = st; event.end=en; event._end = en; if($("#all_day", dialogContent).attr("checked")) { event.allDay = true; } else { event.allDay = false; } event.title = $('#title',dialogContent).val(); if( $.trim(event.title) == '') { alert("Title is required"); return; } event.description = $('#description',dialogContent).val(); event.location = $('#location',dialogContent).val(); event.className = $('#categories',dialogContent).val(); event.access = $('#access',dialogContent).val(); event.user_id = $('#user_id',dialogContent).val(); // build post data dp ={}; dp.event_id = event.id; dp.start = event.start.getTime()/1000; dp.end = event.end.getTime()/1000; dp.title = event.title; dp.description = event.description; dp.location = event.location; dp.categories = $('#categories',dialogContent).val(); dp.access = event.access; dp.user_id = event.user_id; dp.all_day = event.allDay ? 1 : 0; // oper set the type of the operation dp.oper = 'editEvent'; // send it to server $.ajax({ url: $.jqschedule.calendarurl, data:dp, dataType:'json', type:'post', success : function(res) { // update $($.jqschedule.calendarid).fullCalendar('updateEvent', event); dialogContent.dialog("close"); } }); // update //$($.jqschedule.calendarid).fullCalendar('updateEvent', event); //dialogContent.dialog("close"); }; buttons[$.jqschedule.locales.bDelete] = function() { dp ={}; dp.event_id = event.id; dp.oper = 'removeEvent'; $.ajax({url: $.jqschedule.calendarurl, data:dp, dataType:'json', type:'post'}); $($.jqschedule.calendarid).fullCalendar('removeEvents', event.id); dialogContent.dialog("close"); }; buttons[$.jqschedule.locales.bCancel] = function() { dialogContent.dialog("close"); }; dialogContent.dialog({ modal: true, width: 490, closeOnEscape : false, position : { at: 'center bottom', of: $.jqschedule.calendarid }, title: $.jqschedule.locales.editCaption, close: function() { dialogContent.dialog("destroy"); dialogContent.hide(); dialogContent = null; }, buttons: buttons }).show() $(".ui-dialog").css('font-size','12px'); return false; }, /** * Opens a modal dialog for editing a data when on existing event is clicked. * Used in eventClick in fullcalendar * * @param event object is an Event Object that holds the event's information (date, title, etc). * @param jsEvent object holds the native JavaScript event with low-level information such as click coordinates. * @param view view holds the current View Object. * */ eventViewDialog : function(event, jsEvent, view ) { var dialogContent = $($.jqschedule.eventid); // reset Form $("input,textarea,select",dialogContent).val(''); // hide the time picker in case of allday if(event.allDay) { $('#endtime, #starttime', dialogContent).hide(); } else { $('#endtime, #starttime', dialogContent).show(); } $('#all_day',dialogContent).attr('checked',event.allDay); $('#title',dialogContent).val(event.title); // FireFox 4 fix setTimeout(function(){$('#description',dialogContent).val(event.description);},100); //alert($('#description','#event').val()); $('#location',dialogContent).val(event.location); $('#categories',dialogContent).val(event.className); $('#access',dialogContent).val(event.access); $('#start',dialogContent).val( $.fullCalendar.formatDate( event.start, $.jqschedule.locales.dateFormat ) ); $('#starttime', dialogContent).val( $.fullCalendar.formatDate( event.start, 'HH:mm' ) ); $('#end',dialogContent).val( $.fullCalendar.formatDate( event.end ? event.end : event.start, $.jqschedule.locales.dateFormat ) ); $('#endtime').val( $.fullCalendar.formatDate( event.end ? event.end : event.start, 'HH:mm' ) ); $('#user_id',dialogContent).val(event.user_id); var buttons = {}; buttons[$.jqschedule.locales.bClose] = function () { dialogContent.dialog("close"); }; dialogContent.dialog({ modal: true, width: 490, closeOnEscape : false, position : { at: 'center bottom', of: $.jqschedule.calendarid }, title: $.jqschedule.locales.editCaption, close: function() { dialogContent.dialog("destroy"); dialogContent.hide(); dialogContent = null; }, buttons: buttons }).show() $(".ui-dialog").css('font-size','12px'); return false; }, /** * Opens a modal dialog for adding new data event * Used in dayClick in fullcalendar * Refer here * http://arshaw.com/fullcalendar/docs/mouse/dayClick/ * for full parameter description * */ eventAddDialog : function(date, allDay, jsEvent, view) { var dialogContent = $($.jqschedule.eventid); // reset Form $("input,textarea,select",dialogContent).val(''); if(allDay) { $('#endtime, #starttime', dialogContent).hide(); } else { $('#endtime, #starttime', dialogContent).show(); } $('#all_day',dialogContent).attr('checked',allDay); // FireFox 4 fix setTimeout(function(){$('#description',dialogContent).val('');},100); $('#start',dialogContent).val( $.fullCalendar.formatDate( date, $.jqschedule.locales.dateFormat ) ); $('#starttime', dialogContent).val( $.fullCalendar.formatDate( date, 'HH:mm' ) ); $('#end',dialogContent).val( $.fullCalendar.formatDate( date , $.jqschedule.locales.dateFormat ) ); $('#endtime',dialogContent).val( $.fullCalendar.formatDate( date , 'HH:mm' ) ); var us = $('#switchuser').val(); if($.isArray(us)) { us = us[0]; } $('#user_id',dialogContent).val( us ); var buttons = {}; var dateformat = $("#start",dialogContent).datepicker('option','dateFormat'); var dp, event; buttons[$.jqschedule.locales.bAdd] = function() { event = {}; var st = $.datepicker.parseDate(dateformat, $('#start',dialogContent).val()); var sttime = $('#starttime', dialogContent).val(); sttime = sttime ? sttime.split(":") : ['0','0']; st.setHours(parseInt(sttime[0],10),parseInt(sttime[1],10)); var en = $.datepicker.parseDate(dateformat, $('#end',dialogContent).val()); if(!en) en = $.datepicker.parseDate(dateformat, $('#start',dialogContent).val()); var entime = $('#endtime').val(); entime = entime ? entime.split(":") : ['0','0']; en.setHours(parseInt(entime[0],10),parseInt(entime[1],10)); if(en.getTime()-st.getTime() < 0 ) { alert("End time is little than start time"); return; } event.start = st; event._start = st; event.end=en; event._end = en; if($("#all_day", dialogContent).attr("checked")) { event.allDay = true; } else { event.allDay = false; } event.title = $('#title',dialogContent).val(); if( $.trim(event.title) == '') { alert("Title is required"); return; } event.description = $('#description',dialogContent).val(); event.location = $('#location',dialogContent).val(); event.className = $('#categories',dialogContent).val(); event.access = $('#access',dialogContent).val(); event.user_id = $('#user_id',dialogContent).val(); // build post data dp ={}; //dp.event_id = event.id; dp.start = event.start.getTime()/1000; dp.end = event.end.getTime()/1000; dp.title = event.title; dp.description = event.description; dp.location = event.location; dp.categories = $('#categories',dialogContent).val(); dp.access = event.access; dp.user_id = event.user_id; dp.all_day = event.allDay ? 1 : 0; dp.oper = 'newEvent'; // send it to server $.ajax({ url: $.jqschedule.calendarurl, data: dp, dataType:'json', type:'POST', success : function(res, err) { if(res.event_id) { event.id = res.event_id; event._id = res.event_id; $($.jqschedule.calendarid).fullCalendar('renderEvent', event, false); dialogContent.dialog("close"); } } }); }; buttons[$.jqschedule.locales.bCancel] = function() { dialogContent.dialog("close"); }; dialogContent.dialog({ modal: true, width: 490, position : { at: 'center bottom', of: $.jqschedule.calendarid }, closeOnEscape : false, title: $.jqschedule.locales.addCaption, close: function() { dialogContent.dialog("destroy"); dialogContent.hide(); dialogContent = null; }, buttons: buttons }).show() $(".ui-dialog").css('font-size','12px'); }, eventLoading : function ( state ) { // to be written if(state) { var w = $(".calwrapper").width(), h = $(".calwrapper").height()+10; $('body').append('<div class="ui-widget-overlay" style="width:'+w+'px;height:'+h+'px;z-index: 1001;"></div>'); $("#progresspar").show(); } else { $(".ui-widget-overlay").remove(); $("#progresspar").hide(); } }, /** * Function to be called when the user drop a event. A jQuery UI drag and drop should be available * The function is used in eventDrop event in fullcalendar * refer here: http://arshaw.com/fullcalendar/docs/event_ui/eventDrop/ * for full parameter description */ eventDrop : function(event,dayDelta,minuteDelta,allDay,revertFunc) { //$(".ui-tooltip").tooltip('close'); if(event.end == null) {event.end = event.start;} $.ajax({ url: $.jqschedule.calendarurl, data:{oper:'moveEvent',event_id:event.id,start:event.start.getTime()/1000, end:event.end.getTime()/1000, all_day: allDay ? 1 :0}, dataType:'json', type:'post' }); }, /** * Function to be called when the event is resized. Use it in eventDrop in fullcalendar * Refer here: http://arshaw.com/fullcalendar/docs/event_ui/eventResize/ * for parameter description */ eventResize : function( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view ) { //$(".ui-tooltip").tooltip('close'); $.ajax({ url:$.jqschedule.calendarurl,//'eventcal.php?oper=resizeEvent', data:{oper:'resizeEvent',event_id:event.id,start:event.start.getTime()/1000, end:event.end.getTime()/1000}, dataType:'json', type:'post' }); }, /** * Function to be called when any event is render. Used in renderEven in fullcalendar * The jQuery UI tooltip widget should be available. * Refer here: http://arshaw.com/fullcalendar/docs/event_rendering/eventRender/ */ eventRender: function(event, element, view) { try { if (event.description) { element.tooltip({ position: {my: "left bottom", at: "center top", offset: "-30 -10", of: element}, content: function(r) {return event.description;} }); } } catch (e) {} }, /** * this function lunch a dialog for changing the calendar user. Used when the * appropriate button is clicked. uses ui dialog */ changeCalendarUser : function() { var udlg = $("#caluser"); udlg.dialog({ modal: true, width: 400, title: $.jqschedule.locales.userCaption, //'$locale->title_user', close: function() { udlg.dialog("destroy"); udlg.hide(); udlg = null; }, buttons: [{ text : $.jqschedule.locales.bChange, //'$locale->change', click : function() { var uid = $("#switchuser", this).val(); $.ajax({ url:$.jqschedule.calendarurl, //'eventcal.php?oper=switchUser', data:{_user_id: uid, oper:'switchUser'}, dataType:'json', type:'post', success : function(r,e) { //'#$this->calenderid' $($.jqschedule.calendarid).fullCalendar( 'refetchEvents' ); $("#common_search").val(""); $(".fnd-results").html(""); $("#search_table").empty(); var osu = $("#switchuser option:selected"); if( osu.length <= 1) { $("#cal_user").html( "<li>"+osu.text()+"</li>" ); } else { var fosu=""; $.each(osu, function(){ fosu += "<li>"+$(this).text()+"</li>"; }); $("#cal_user").html( fosu ); } } }); udlg.dialog("close"); } }, { text : $.jqschedule.locales.bCancel,//'$locale->cancel', click : function(){ udlg.dialog("close"); } } ] }).show() $(".ui-dialog, .ui-dialog-buttonpane").css('font-size','12px'); return false; }, /** * function to print a events from the current view * TODO : to analyze when we are in search mode to print the events */ printEvents : function() { if($("#b_search_cal").hasClass('ui-state-active') ) { var sv = $("#common_search").val(); var stype = 'simple'; if(sv == "") { stype = "complex"; var scal = $("#search_cal"); if( scal) { var filters = scal.jqFilter('filterData'); if(!filters.rules.length) { return false ;} try { // xmlJsonClass or JSON.stringify sv = xmlJsonClass.toJson(filters, '', '', false); } catch (e) { try { sv = JSON.stringify(filters); } catch (e2) { } } } } window.location=$.jqschedule.calendarurl+'?oper=printEvents&stype='+stype+'&search=true&svalue='+sv; } else { var curview = jQuery($.jqschedule.calendarid).fullCalendar('getView'); var start = curview.start.getTime()/1000; var end = curview.end.getTime()/1000; window.location=$.jqschedule.calendarurl+'?oper=printEvents&start='+start+'&end='+end; } return false; }, /** * function to export a events from the current view in iCal format * TODO : to analyze when we are in search mode to export the events */ exportEvents : function() { if($("#b_search_cal").hasClass('ui-state-active') ) { var sv = $("#common_search").val(); var stype = 'simple'; if(sv == "") { stype = "complex"; var scal = $("#search_cal"); if( scal) { var filters = scal.jqFilter('filterData'); if(!filters.rules.length) { return false ;} try { // xmlJsonClass or JSON.stringify sv = xmlJsonClass.toJson(filters, '', '', false); } catch (e) { try { sv = JSON.stringify(filters); } catch (e2) { } } } } window.location=$.jqschedule.calendarurl+'?oper=exportEvents&stype='+stype+'&search=true&svalue='+sv; } else { var curview = jQuery($.jqschedule.calendarid).fullCalendar('getView'); var start = curview.start.getTime()/1000; var end = curview.end.getTime()/1000; window.location=$.jqschedule.calendarurl+'?oper=exportEvents&start='+start+'&end='+end; } return false; }, /** * Toggle show function when the search button is clicked. See hideSearch. * Used in jQuery toggle */ showSearch : function() { var cs = $("#common_search").val(); if(cs) { $("#common_search").val(""); $("#b_common_search").trigger("click"); } $(this).addClass('ui-state-active'); $('.fc-view-agendaWeek, .fc-view-agendaDay, .fc-view-basicDay, .fc-view-basickWeek, .fc-view-month, .fc-view-year').hide(); $('.fc-view-search').show(); $("#common_search").focus(); }, hideSearch : function() { $(this).removeClass('ui-state-active'); var activeView = $($.jqschedule.calendarid).fullCalendar('getView').name; $('.fc-view-search').hide(); $('.fc-view-'+activeView).show(); }, _filSearchTable : function( result, tblid ) { $(tblid).empty(); if(result && result.length) { $(".fnd-results").html(result.length); var tdata = ""; var sep = "~`"; $.each(result, function() { var sd = $.fullCalendar.parseDate(this.start); var ed = $.fullCalendar.parseDate(this.end); var sh = $.fullCalendar.formatDate(sd, 'HH:mm'); var eh = $.fullCalendar.formatDate(ed, 'HH:mm'); var ad = this.allDay ? 'all day': sh + " - "+eh; sd = $.fullCalendar.formatDate(sd, 'ddd dd MMM yyyy'); ed = $.fullCalendar.formatDate(ed, 'ddd dd MMM yyyy'); if(sd != ed) ad += " "+ed; tdata += "<tr id='"+this.id+"'><th class='ui-event-cell ui-widget-content'><a href=\"javascript:jQuery.jqschedule.gotoDayEventView(\'"+this.start+"\');\">"+sd+"</a></th><td class='ui-event-time ui-widget-content'>"+ad+"</td><td class='ui-event-title ui-widget-content'><a href=\"javascript:jQuery.jqschedule.editFromSearch(\'"+this.id+"\');\" class='' style='border: 0px none;text-decoration: underline;'>"+this.title+"</a></td>"; tdata += "<td class='source' style='display:none;'>"; tdata += this.id+sep+ this.title+sep+this.start+sep+this.end+sep+this.description+sep+this.location+sep+this.className+sep+this.access+sep+this.allDay+sep+this.user_id; tdata += "</td>"; tdata += "</tr>"; }); $(tblid).append(tdata); } }, /** * Function to perform a single search when the appropriate button is clicked * */ doSimpleSearch : function() { var sv = $("#common_search").val(); var tdata = ""; if(sv) { $.ajax({ url: $.jqschedule.calendarurl, //'eventcal.php?oper=getEvent', data:{search:true,stype:'simple', svalue: sv, oper:'getEvent'}, dataType:'json', type:'POST', success : function(res, err) { $.jqschedule._filSearchTable(res, "#search_table" ); } }); } else { $(".fnd-results").html(""); $("#search_table").empty(); } }, buildLocalSearch : function () { var sa, so; $('label', $.jqschedule.eventid).each(function(i){ sa ={}; sa.name = $(this).attr('for'); sa.label = $(this).html(); if(sa.name == 'categories' || sa.name == 'access') { sa.inputtype ='select'; so = {}; $("#"+sa.name+' option', $.jqschedule.eventid).each(function(){ so[$(this).val()] = $(this).text(); }); sa.searchoptions = { value: so}; } else if(sa.name == 'all_day'){ sa.inputtype ='select'; so = {'1': 'Yes','0':'No'}; sa.searchoptions = { value: so}; } else if( sa.name=="start" || sa.name=="end") { sa.searchtype = 'date'; sa.searchoptions = { size : 20, sopt : ['eq','gt', 'ge', 'lt','le'], dataInit : function(el) { $(el).datetimepicker(); } } } else { sa.searchoptions = { size: 20}; } $.jqschedule.searchCols[i]= sa; }); }, /** * Function which create the advanced search dialog */ advancedSearchDlg : function () { $("#search_cal").jqFilter({ columns : $.jqschedule.searchCols, filter : {"groupOp": "AND",rules:[{"field":$.jqschedule.searchCols[0].name,"op":'eq',"data":""}]}, _gridsopt: $.jqschedule.searchOpers }); $("#search_cal").dialog({ modal: true, width: 'auto', autoOpen : false, title: $.jqschedule.locales.searchCaption, close: function() { //this.hide(); //this.dialog("destroy"); }, buttons: [{ text : $.jqschedule.locales.bSearch, click : function() { var scal = $("#search_cal"), res, filters = scal.jqFilter('filterData'); if(!filters.rules.length) { return ;} try { // xmlJsonClass or JSON.stringify res = xmlJsonClass.toJson(filters, '', '', false); } catch (e) { try { res = JSON.stringify(filters); } catch (e2) { } } if(res) { $.ajax({ url: $.jqschedule.calendarurl, //'eventcal.php?oper=getEvent', data:{search:true,stype:'complex', svalue: res, oper:'getEvent'}, dataType:'json', type:'POST', success : function(res, err) { $.jqschedule._filSearchTable(res, "#search_table" ); } }); } scal.dialog("close"); } }, { text : $.jqschedule.locales.bClose, click : function(){ $("#search_cal").dialog("close"); } } ] }); $(".ui-dialog, .ui-dialog-buttonpane").css('font-size','12px'); }, editFromSearch : function ( eventid ) { var sep = "~`"; var data = $("tr#"+eventid+" td.source").html().split(sep); var maps = ['id','title','start', 'end','description','location','className','access','allDay','user_id']; var event = {}; $.each(maps, function(i){ if(this=='start' || this == 'end') { data[i] = new Date( parseFloat(data[i])*1000 ); } if(this=='allDay') { data[i] = data[i] == '1' ? true : false;} event[this] = data[i]; }); $.jqschedule.eventViewDialog( event ); //console.log(data); }, openDaySearchDlg : function( date, un, ev) { var st = date.getTime()/1000; date.setHours( 23 ); date.setMinutes( 23 ); var en = date.getTime()/1000, udlg = $("#day_dialog"); udlg.dialog({ modal: true, width: 450, //title: $.jqschedule.locales.listCaption, close: function() { udlg.dialog("destroy"); udlg.hide(); udlg = null; }, open : function (event, ui) { $("#day_table").empty(); $.ajax({ url: $.jqschedule.calendarurl, //'eventcal.php?oper=getEvent', data:{ oper:'getEvent', start:st, end : en}, dataType:'json', type:'POST', success : function(res, err) { $.jqschedule._filSearchTable(res, "#day_table" ); } }); }, buttons: [{ text : $.jqschedule.locales.bClose,//'$locale->cancel', click : function(){ udlg.dialog("close"); } }] }).show(); $(".ui-dialog, .ui-dialog-buttonpane").css('font-size','12px'); }, eventsFunc : function (start, end, callback) { $.ajax({ url: $.jqschedule.calendarurl, dataType: 'json', type: 'POST', data: { oper:'getEvent', // our hypothetical feed requires UNIX timestamps start: start.getTime()/1000, end: end.getTime()/1000 }, success: function(doc, err) { callback(doc); } }); }, /** * Main function where all things are happen */ processScript :function() { // datepicker at left side // this is special additional settiong $('#datepicker').datepicker( { 'dateFormat': 'yy-mm-dd', onSelect: function(dateText, inst) { var dateset = dateText.split('-'); $($.jqschedule.calendarid).fullCalendar( 'gotoDate', parseInt(dateset[0],10) , parseInt(dateset[1],10)-1, parseInt(dateset[2],10) ); } }); // atach datepickers pop-up to edit form $('#start, #end', $.jqschedule.eventid).datepicker(); // show hide timepicker if allday $('#all_day',$.jqschedule.eventid).click(function(){ if(this.checked) { $('#endtime, #starttime', $.jqschedule.eventid).val('00:00').hide(); } else { $('#endtime, #starttime', $.jqschedule.eventid).show(); } }); $('.custbutton').height($('table.fc-header').height()); $('#b_user_change').click(jQuery.jqschedule.changeCalendarUser); $('#b_export_ical').click(jQuery.jqschedule.exportEvents); $('#b_print_cal').click(jQuery.jqschedule.printEvents); $('.fc-content',$.jqschedule.calendarid).append( $(".fc-view-search" )); $('#b_search_cal').toggle(jQuery.jqschedule.showSearch,jQuery.jqschedule.hideSearch); $('#b_common_search').click(jQuery.jqschedule.doSimpleSearch); $('#b_adv_search').click(function(){$("#search_cal").dialog('open');return false;}); $('.jq-button').hover( function(){ $(this).addClass('ui-state-hover');},function(){ $(this).removeClass('ui-state-hover'); }); $.jqschedule.buildLocalSearch(); $.jqschedule.advancedSearchDlg(); } } })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/src-scheduler/jquery.jqScheduler.js
JavaScript
gpl2
273,531
// ==ClosureCompiler== // @compilation_level SIMPLE_OPTIMIZATIONS /** * @license jqGrid 4.3.2 - jQuery Grid * Copyright (c) 2008, Tony Tomov, tony@trirand.com * Dual licensed under the MIT and GPL licenses * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html * Date: 2011-04-10 */ //jsHint options /*global document, window, jQuery, DOMParser, ActiveXObject, $, alert */ (function ($) { "use strict"; $.jgrid = $.jgrid || {}; $.extend($.jgrid,{ version : "4.3.2", htmlDecode : function(value){ if(value && (value=='&nbsp;' || value=='&#160;' || (value.length===1 && value.charCodeAt(0)===160))) { return "";} return !value ? value : String(value).replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&"); }, htmlEncode : function (value){ return !value ? value : String(value).replace(/&/g, "&amp;").replace(/\"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;"); }, format : function(format){ //jqgformat var args = $.makeArray(arguments).slice(1); if(format===undefined) { format = ""; } return format.replace(/\{(\d+)\}/g, function(m, i){ return args[i]; }); }, getCellIndex : function (cell) { var c = $(cell); if (c.is('tr')) { return -1; } c = (!c.is('td') && !c.is('th') ? c.closest("td,th") : c)[0]; if ($.browser.msie) { return $.inArray(c, c.parentNode.cells); } return c.cellIndex; }, stripHtml : function(v) { v = v+""; var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi; if (v) { v = v.replace(regexp,""); return (v && v !== '&nbsp;' && v !== '&#160;') ? v.replace(/\"/g,"'") : ""; } else { return v; } }, stripPref : function (pref, id) { var obj = $.type( pref ); if( obj == "string" || obj =="number") { pref = String(pref); id = pref !== "" ? String(id).replace(String(pref), "") : id; } return id; }, stringToDoc : function (xmlString) { var xmlDoc; if(typeof xmlString !== 'string') { return xmlString; } try { var parser = new DOMParser(); xmlDoc = parser.parseFromString(xmlString,"text/xml"); } catch(e) { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.loadXML(xmlString); } return (xmlDoc && xmlDoc.documentElement && xmlDoc.documentElement.tagName != 'parsererror') ? xmlDoc : null; }, parse : function(jsonString) { var js = jsonString; if (js.substr(0,9) == "while(1);") { js = js.substr(9); } if (js.substr(0,2) == "/*") { js = js.substr(2,js.length-4); } if(!js) { js = "{}"; } return ($.jgrid.useJSON===true && typeof (JSON) === 'object' && typeof (JSON.parse) === 'function') ? JSON.parse(js) : eval('(' + js + ')'); }, parseDate : function(format, date) { var tsp = {m : 1, d : 1, y : 1970, h : 0, i : 0, s : 0, u:0},k,hl,dM, regdate = /[\\\/:_;.,\t\T\s-]/; if(date && date !== null && date !== undefined){ date = $.trim(date); date = date.split(regdate); if ($.jgrid.formatter.date.masks[format] !== undefined) { format = $.jgrid.formatter.date.masks[format]; } format = format.split(regdate); var dfmt = $.jgrid.formatter.date.monthNames; var afmt = $.jgrid.formatter.date.AmPm; var h12to24 = function(ampm, h){ if (ampm === 0){ if (h === 12) { h = 0;} } else { if (h !== 12) { h += 12; } } return h; }; for(k=0,hl=format.length;k<hl;k++){ if(format[k] == 'M') { dM = $.inArray(date[k],dfmt); if(dM !== -1 && dM < 12){ date[k] = dM+1; tsp.m = date[k]; } } if(format[k] == 'F') { dM = $.inArray(date[k],dfmt); if(dM !== -1 && dM > 11){ date[k] = dM+1-12; tsp.m = date[k]; } } if(format[k] == 'a') { dM = $.inArray(date[k],afmt); if(dM !== -1 && dM < 2 && date[k] == afmt[dM]){ date[k] = dM; tsp.h = h12to24(date[k], tsp.h); } } if(format[k] == 'A') { dM = $.inArray(date[k],afmt); if(dM !== -1 && dM > 1 && date[k] == afmt[dM]){ date[k] = dM-2; tsp.h = h12to24(date[k], tsp.h); } } if(date[k] !== undefined) { tsp[format[k].toLowerCase()] = parseInt(date[k],10); } } tsp.m = parseInt(tsp.m,10)-1; var ty = tsp.y; if (ty >= 70 && ty <= 99) {tsp.y = 1900+tsp.y;} else if (ty >=0 && ty <=69) {tsp.y= 2000+tsp.y;} if(tsp.j !== undefined) { tsp.d = tsp.j; } if(tsp.n !== undefined) { tsp.m = parseInt(tsp.n,10)-1; } } return new Date(tsp.y, tsp.m, tsp.d, tsp.h, tsp.i, tsp.s, tsp.u); }, jqID : function(sid){ return String(sid).replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&"); }, guid : 1, uidPref: 'jqg', randId : function( prefix ) { return (prefix? prefix: $.jgrid.uidPref) + ($.jgrid.guid++); }, getAccessor : function(obj, expr) { var ret,p,prm = [], i; if( typeof expr === 'function') { return expr(obj); } ret = obj[expr]; if(ret===undefined) { try { if ( typeof expr === 'string' ) { prm = expr.split('.'); } i = prm.length; if( i ) { ret = obj; while (ret && i--) { p = prm.shift(); ret = ret[p]; } } } catch (e) {} } return ret; }, getXmlData: function (obj, expr, returnObj) { var ret, m = typeof (expr) === 'string' ? expr.match(/^(.*)\[(\w+)\]$/) : null; if (typeof (expr) === 'function') { return expr(obj); } if (m && m[2]) { // m[2] is the attribute selector // m[1] is an optional element selector // examples: "[id]", "rows[page]" return m[1] ? $(m[1], obj).attr(m[2]) : $(obj).attr(m[2]); } else { ret = $(expr, obj); if (returnObj) { return ret; } //$(expr, obj).filter(':last'); // we use ':last' to be more compatible with old version of jqGrid return ret.length > 0 ? $(ret).text() : undefined; } }, ajaxOptions: {}, from : function(source){ // Original Author Hugo Bonacci // License MIT http://jlinq.codeplex.com/license var QueryObject=function(d,q){ if(typeof(d)=="string"){ d=$.data(d); } var self=this, _data=d, _usecase=true, _trim=false, _query=q, _stripNum = /[\$,%]/g, _lastCommand=null, _lastField=null, _orDepth=0, _negate=false, _queuedOperator="", _sorting=[], _useProperties=true; if(typeof(d)=="object"&&d.push) { if(d.length>0){ if(typeof(d[0])!="object"){ _useProperties=false; }else{ _useProperties=true; } } }else{ throw "data provides is not an array"; } this._hasData=function(){ return _data===null?false:_data.length===0?false:true; }; this._getStr=function(s){ var phrase=[]; if(_trim){ phrase.push("jQuery.trim("); } phrase.push("String("+s+")"); if(_trim){ phrase.push(")"); } if(!_usecase){ phrase.push(".toLowerCase()"); } return phrase.join(""); }; this._strComp=function(val){ if(typeof(val)=="string"){ return".toString()"; }else{ return""; } }; this._group=function(f,u){ return({field:f.toString(),unique:u,items:[]}); }; this._toStr=function(phrase){ if(_trim){ phrase=$.trim(phrase); } if(!_usecase){ phrase=phrase.toLowerCase(); } phrase=phrase.toString().replace(/\\/g,'\\\\').replace(/\"/g,'\\"'); return phrase; }; this._funcLoop=function(func){ var results=[]; $.each(_data,function(i,v){ results.push(func(v)); }); return results; }; this._append=function(s){ var i; if(_query===null){ _query=""; } else { _query+=_queuedOperator === "" ? " && " :_queuedOperator; } for (i=0;i<_orDepth;i++){ _query+="("; } if(_negate){ _query+="!"; } _query+="("+s+")"; _negate=false; _queuedOperator=""; _orDepth=0; }; this._setCommand=function(f,c){ _lastCommand=f; _lastField=c; }; this._resetNegate=function(){ _negate=false; }; this._repeatCommand=function(f,v){ if(_lastCommand===null){ return self; } if(f!==null&&v!==null){ return _lastCommand(f,v); } if(_lastField===null){ return _lastCommand(f); } if(!_useProperties){ return _lastCommand(f); } return _lastCommand(_lastField,f); }; this._equals=function(a,b){ return(self._compare(a,b,1)===0); }; this._compare=function(a,b,d){ var toString = Object.prototype.toString; if( d === undefined) { d = 1; } if(a===undefined) { a = null; } if(b===undefined) { b = null; } if(a===null && b===null){ return 0; } if(a===null&&b!==null){ return 1; } if(a!==null&&b===null){ return -1; } if (toString.call(a) === '[object Date]' && toString.call(b) === '[object Date]') { if (a < b) { return -d; } if (a > b) { return d; } return 0; } if(!_usecase && typeof(a) !== "number" && typeof(b) !== "number" ) { a=String(a).toLowerCase(); b=String(b).toLowerCase(); } if(a<b){return -d;} if(a>b){return d;} return 0; }; this._performSort=function(){ if(_sorting.length===0){return;} _data=self._doSort(_data,0); }; this._doSort=function(d,q){ var by=_sorting[q].by, dir=_sorting[q].dir, type = _sorting[q].type, dfmt = _sorting[q].datefmt; if(q==_sorting.length-1){ return self._getOrder(d, by, dir, type, dfmt); } q++; var values=self._getGroup(d,by,dir,type,dfmt); var results=[]; for(var i=0;i<values.length;i++){ var sorted=self._doSort(values[i].items,q); for(var j=0;j<sorted.length;j++){ results.push(sorted[j]); } } return results; }; this._getOrder=function(data,by,dir,type, dfmt){ var sortData=[],_sortData=[], newDir = dir=="a" ? 1 : -1, i,ab,j, findSortKey; if(type === undefined ) { type = "text"; } if (type == 'float' || type== 'number' || type== 'currency' || type== 'numeric') { findSortKey = function($cell) { var key = parseFloat( String($cell).replace(_stripNum, '')); return isNaN(key) ? 0.00 : key; }; } else if (type=='int' || type=='integer') { findSortKey = function($cell) { return $cell ? parseFloat(String($cell).replace(_stripNum, '')) : 0; }; } else if(type == 'date' || type == 'datetime') { findSortKey = function($cell) { return $.jgrid.parseDate(dfmt,$cell).getTime(); }; } else if($.isFunction(type)) { findSortKey = type; } else { findSortKey = function($cell) { if(!$cell) {$cell ="";} return $.trim(String($cell).toUpperCase()); }; } $.each(data,function(i,v){ ab = by!=="" ? $.jgrid.getAccessor(v,by) : v; if(ab === undefined) { ab = ""; } ab = findSortKey(ab, v); _sortData.push({ 'vSort': ab,'index':i}); }); _sortData.sort(function(a,b){ a = a.vSort; b = b.vSort; return self._compare(a,b,newDir); }); j=0; var nrec= data.length; // overhead, but we do not change the original data. while(j<nrec) { i = _sortData[j].index; sortData.push(data[i]); j++; } return sortData; }; this._getGroup=function(data,by,dir,type, dfmt){ var results=[], group=null, last=null, val; $.each(self._getOrder(data,by,dir,type, dfmt),function(i,v){ val = $.jgrid.getAccessor(v, by); if(val === undefined) { val = ""; } if(!self._equals(last,val)){ last=val; if(group !== null){ results.push(group); } group=self._group(by,val); } group.items.push(v); }); if(group !== null){ results.push(group); } return results; }; this.ignoreCase=function(){ _usecase=false; return self; }; this.useCase=function(){ _usecase=true; return self; }; this.trim=function(){ _trim=true; return self; }; this.noTrim=function(){ _trim=false; return self; }; this.execute=function(){ var match=_query, results=[]; if(match === null){ return self; } $.each(_data,function(){ if(eval(match)){results.push(this);} }); _data=results; return self; }; this.data=function(){ return _data; }; this.select=function(f){ self._performSort(); if(!self._hasData()){ return[]; } self.execute(); if($.isFunction(f)){ var results=[]; $.each(_data,function(i,v){ results.push(f(v)); }); return results; } return _data; }; this.hasMatch=function(){ if(!self._hasData()) { return false; } self.execute(); return _data.length>0; }; this.andNot=function(f,v,x){ _negate=!_negate; return self.and(f,v,x); }; this.orNot=function(f,v,x){ _negate=!_negate; return self.or(f,v,x); }; this.not=function(f,v,x){ return self.andNot(f,v,x); }; this.and=function(f,v,x){ _queuedOperator=" && "; if(f===undefined){ return self; } return self._repeatCommand(f,v,x); }; this.or=function(f,v,x){ _queuedOperator=" || "; if(f===undefined) { return self; } return self._repeatCommand(f,v,x); }; this.orBegin=function(){ _orDepth++; return self; }; this.orEnd=function(){ if (_query !== null){ _query+=")"; } return self; }; this.isNot=function(f){ _negate=!_negate; return self.is(f); }; this.is=function(f){ self._append('this.'+f); self._resetNegate(); return self; }; this._compareValues=function(func,f,v,how,t){ var fld; if(_useProperties){ fld='jQuery.jgrid.getAccessor(this,\''+f+'\')'; }else{ fld='this'; } if(v===undefined) { v = null; } //var val=v===null?f:v, var val =v, swst = t.stype === undefined ? "text" : t.stype; if(v !== null) { switch(swst) { case 'int': case 'integer': val = (isNaN(Number(val)) || val==="") ? '0' : val; // To be fixed with more inteligent code fld = 'parseInt('+fld+',10)'; val = 'parseInt('+val+',10)'; break; case 'float': case 'number': case 'numeric': val = String(val).replace(_stripNum, ''); val = (isNaN(Number(val)) || val==="") ? '0' : val; // To be fixed with more inteligent code fld = 'parseFloat('+fld+')'; val = 'parseFloat('+val+')'; break; case 'date': case 'datetime': val = String($.jgrid.parseDate(t.newfmt || 'Y-m-d',val).getTime()); fld = 'jQuery.jgrid.parseDate("'+t.srcfmt+'",'+fld+').getTime()'; break; default : fld=self._getStr(fld); val=self._getStr('"'+self._toStr(val)+'"'); } } self._append(fld+' '+how+' '+val); self._setCommand(func,f); self._resetNegate(); return self; }; this.equals=function(f,v,t){ return self._compareValues(self.equals,f,v,"==",t); }; this.notEquals=function(f,v,t){ return self._compareValues(self.equals,f,v,"!==",t); }; this.isNull = function(f,v,t){ return self._compareValues(self.equals,f,null,"===",t); }; this.greater=function(f,v,t){ return self._compareValues(self.greater,f,v,">",t); }; this.less=function(f,v,t){ return self._compareValues(self.less,f,v,"<",t); }; this.greaterOrEquals=function(f,v,t){ return self._compareValues(self.greaterOrEquals,f,v,">=",t); }; this.lessOrEquals=function(f,v,t){ return self._compareValues(self.lessOrEquals,f,v,"<=",t); }; this.startsWith=function(f,v){ var val = (v===undefined || v===null) ? f: v, length=_trim ? $.trim(val.toString()).length : val.toString().length; if(_useProperties){ self._append(self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.substr(0,'+length+') == '+self._getStr('"'+self._toStr(v)+'"')); }else{ length=_trim?$.trim(v.toString()).length:v.toString().length; self._append(self._getStr('this')+'.substr(0,'+length+') == '+self._getStr('"'+self._toStr(f)+'"')); } self._setCommand(self.startsWith,f); self._resetNegate(); return self; }; this.endsWith=function(f,v){ var val = (v===undefined || v===null) ? f: v, length=_trim ? $.trim(val.toString()).length:val.toString().length; if(_useProperties){ self._append(self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.substr('+self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.length-'+length+','+length+') == "'+self._toStr(v)+'"'); } else { self._append(self._getStr('this')+'.substr('+self._getStr('this')+'.length-"'+self._toStr(f)+'".length,"'+self._toStr(f)+'".length) == "'+self._toStr(f)+'"'); } self._setCommand(self.endsWith,f);self._resetNegate(); return self; }; this.contains=function(f,v){ if(_useProperties){ self._append(self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.indexOf("'+self._toStr(v)+'",0) > -1'); }else{ self._append(self._getStr('this')+'.indexOf("'+self._toStr(f)+'",0) > -1'); } self._setCommand(self.contains,f); self._resetNegate(); return self; }; this.groupBy=function(by,dir,type, datefmt){ if(!self._hasData()){ return null; } return self._getGroup(_data,by,dir,type, datefmt); }; this.orderBy=function(by,dir,stype, dfmt){ dir = dir === undefined || dir === null ? "a" :$.trim(dir.toString().toLowerCase()); if(stype === null || stype === undefined) { stype = "text"; } if(dfmt === null || dfmt === undefined) { dfmt = "Y-m-d"; } if(dir=="desc"||dir=="descending"){dir="d";} if(dir=="asc"||dir=="ascending"){dir="a";} _sorting.push({by:by,dir:dir,type:stype, datefmt: dfmt}); return self; }; return self; }; return new QueryObject(source,null); }, extend : function(methods) { $.extend($.fn.jqGrid,methods); if (!this.no_legacy_api) { $.fn.extend(methods); } } }); $.fn.jqGrid = function( pin ) { if (typeof pin == 'string') { //var fn = $.fn.jqGrid[pin]; var fn = $.jgrid.getAccessor($.fn.jqGrid,pin); if (!fn) { throw ("jqGrid - No such method: " + pin); } var args = $.makeArray(arguments).slice(1); return fn.apply(this,args); } return this.each( function() { if(this.grid) {return;} var p = $.extend(true,{ url: "", height: 150, page: 1, rowNum: 20, rowTotal : null, records: 0, pager: "", pgbuttons: true, pginput: true, colModel: [], rowList: [], colNames: [], sortorder: "asc", sortname: "", datatype: "xml", mtype: "GET", altRows: false, selarrrow: [], savedRow: [], shrinkToFit: true, xmlReader: {}, jsonReader: {}, subGrid: false, subGridModel :[], reccount: 0, lastpage: 0, lastsort: 0, selrow: null, beforeSelectRow: null, onSelectRow: null, onSortCol: null, ondblClickRow: null, onRightClickRow: null, onPaging: null, onSelectAll: null, loadComplete: null, gridComplete: null, loadError: null, loadBeforeSend: null, afterInsertRow: null, beforeRequest: null, beforeProcessing : null, onHeaderClick: null, viewrecords: false, loadonce: false, multiselect: false, multikey: false, editurl: null, search: false, caption: "", hidegrid: true, hiddengrid: false, postData: {}, userData: {}, treeGrid : false, treeGridModel : 'nested', treeReader : {}, treeANode : -1, ExpandColumn: null, tree_root_level : 0, prmNames: {page:"page",rows:"rows", sort: "sidx",order: "sord", search:"_search", nd:"nd", id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del", subgridid:"id", npage: null, totalrows:"totalrows"}, forceFit : false, gridstate : "visible", cellEdit: false, cellsubmit: "remote", nv:0, loadui: "enable", toolbar: [false,""], scroll: false, multiboxonly : false, deselectAfterSort : true, scrollrows : false, autowidth: false, scrollOffset :18, cellLayout: 5, subGridWidth: 20, multiselectWidth: 20, gridview: false, rownumWidth: 25, rownumbers : false, pagerpos: 'center', recordpos: 'right', footerrow : false, userDataOnFooter : false, hoverrows : true, altclass : 'ui-priority-secondary', viewsortcols : [false,'vertical',true], resizeclass : '', autoencode : false, remapColumns : [], ajaxGridOptions :{}, direction : "ltr", toppager: false, headertitles: false, scrollTimeout: 40, data : [], _index : {}, grouping : false, groupingView : {groupField:[],groupOrder:[], groupText:[],groupColumnShow:[],groupSummary:[], showSummaryOnHide: false, sortitems:[], sortnames:[], groupDataSorted : false, summary:[],summaryval:[], plusicon: 'ui-icon-circlesmall-plus', minusicon: 'ui-icon-circlesmall-minus'}, ignoreCase : false, cmTemplate : {}, idPrefix : "" }, $.jgrid.defaults, pin || {}); var ts= this, grid={ headers:[], cols:[], footers: [], dragStart: function(i,x,y) { this.resizing = { idx: i, startX: x.clientX, sOL : y[0]}; this.hDiv.style.cursor = "col-resize"; this.curGbox = $("#rs_m"+$.jgrid.jqID(p.id),"#gbox_"+$.jgrid.jqID(p.id)); this.curGbox.css({display:"block",left:y[0],top:y[1],height:y[2]}); $(ts).triggerHandler("jqGridResizeStart", [x, i]); if($.isFunction(p.resizeStart)) { p.resizeStart.call(this,x,i); } document.onselectstart=function(){return false;}; }, dragMove: function(x) { if(this.resizing) { var diff = x.clientX-this.resizing.startX, h = this.headers[this.resizing.idx], newWidth = p.direction === "ltr" ? h.width + diff : h.width - diff, hn, nWn; if(newWidth > 33) { this.curGbox.css({left:this.resizing.sOL+diff}); if(p.forceFit===true ){ hn = this.headers[this.resizing.idx+p.nv]; nWn = p.direction === "ltr" ? hn.width - diff : hn.width + diff; if(nWn >33) { h.newWidth = newWidth; hn.newWidth = nWn; } } else { this.newWidth = p.direction === "ltr" ? p.tblwidth+diff : p.tblwidth-diff; h.newWidth = newWidth; } } } }, dragEnd: function() { this.hDiv.style.cursor = "default"; if(this.resizing) { var idx = this.resizing.idx, nw = this.headers[idx].newWidth || this.headers[idx].width; nw = parseInt(nw,10); this.resizing = false; $("#rs_m"+$.jgrid.jqID(p.id)).css("display","none"); p.colModel[idx].width = nw; this.headers[idx].width = nw; this.headers[idx].el.style.width = nw + "px"; this.cols[idx].style.width = nw+"px"; if(this.footers.length>0) {this.footers[idx].style.width = nw+"px";} if(p.forceFit===true){ nw = this.headers[idx+p.nv].newWidth || this.headers[idx+p.nv].width; this.headers[idx+p.nv].width = nw; this.headers[idx+p.nv].el.style.width = nw + "px"; this.cols[idx+p.nv].style.width = nw+"px"; if(this.footers.length>0) {this.footers[idx+p.nv].style.width = nw+"px";} p.colModel[idx+p.nv].width = nw; } else { p.tblwidth = this.newWidth || p.tblwidth; $('table:first',this.bDiv).css("width",p.tblwidth+"px"); $('table:first',this.hDiv).css("width",p.tblwidth+"px"); this.hDiv.scrollLeft = this.bDiv.scrollLeft; if(p.footerrow) { $('table:first',this.sDiv).css("width",p.tblwidth+"px"); this.sDiv.scrollLeft = this.bDiv.scrollLeft; } } $(ts).triggerHandler("jqGridResizeStop", [nw, idx]); if($.isFunction(p.resizeStop)) { p.resizeStop.call(this,nw,idx); } } this.curGbox = null; document.onselectstart=function(){return true;}; }, populateVisible: function() { if (grid.timer) { clearTimeout(grid.timer); } grid.timer = null; var dh = $(grid.bDiv).height(); if (!dh) { return; } var table = $("table:first", grid.bDiv); var rows, rh; if(table[0].rows.length) { try { rows = table[0].rows[1]; rh = rows ? $(rows).outerHeight() || grid.prevRowHeight : grid.prevRowHeight; } catch (pv) { rh = grid.prevRowHeight; } } if (!rh) { return; } grid.prevRowHeight = rh; var rn = p.rowNum; var scrollTop = grid.scrollTop = grid.bDiv.scrollTop; var ttop = Math.round(table.position().top) - scrollTop; var tbot = ttop + table.height(); var div = rh * rn; var page, npage, empty; if ( tbot < dh && ttop <= 0 && (p.lastpage===undefined||parseInt((tbot + scrollTop + div - 1) / div,10) <= p.lastpage)) { npage = parseInt((dh - tbot + div - 1) / div,10); if (tbot >= 0 || npage < 2 || p.scroll === true) { page = Math.round((tbot + scrollTop) / div) + 1; ttop = -1; } else { ttop = 1; } } if (ttop > 0) { page = parseInt(scrollTop / div,10) + 1; npage = parseInt((scrollTop + dh) / div,10) + 2 - page; empty = true; } if (npage) { if (p.lastpage && page > p.lastpage || p.lastpage==1 || (page === p.page && page===p.lastpage) ) { return; } if (grid.hDiv.loading) { grid.timer = setTimeout(grid.populateVisible, p.scrollTimeout); } else { p.page = page; if (empty) { grid.selectionPreserver(table[0]); grid.emptyRows(grid.bDiv,false, false); } grid.populate(npage); } } }, scrollGrid: function( e ) { if(p.scroll) { var scrollTop = grid.bDiv.scrollTop; if(grid.scrollTop === undefined) { grid.scrollTop = 0; } if (scrollTop != grid.scrollTop) { grid.scrollTop = scrollTop; if (grid.timer) { clearTimeout(grid.timer); } grid.timer = setTimeout(grid.populateVisible, p.scrollTimeout); } } grid.hDiv.scrollLeft = grid.bDiv.scrollLeft; if(p.footerrow) { grid.sDiv.scrollLeft = grid.bDiv.scrollLeft; } if( e ) { e.stopPropagation(); } }, selectionPreserver : function(ts) { var p = ts.p, sr = p.selrow, sra = p.selarrrow ? $.makeArray(p.selarrrow) : null, left = ts.grid.bDiv.scrollLeft, restoreSelection = function() { var i; p.selrow = null; p.selarrrow = []; if(p.multiselect && sra && sra.length>0) { for(i=0;i<sra.length;i++){ if (sra[i] != sr) { $(ts).jqGrid("setSelection",sra[i],false, null); } } } if (sr) { $(ts).jqGrid("setSelection",sr,false,null); } ts.grid.bDiv.scrollLeft = left; $(ts).unbind('.selectionPreserver', restoreSelection); }; $(ts).bind('jqGridGridComplete.selectionPreserver', restoreSelection); } }; if(this.tagName.toUpperCase()!='TABLE') { alert("Element is not a table"); return; } $(this).empty().attr("tabindex","1"); this.p = p ; this.p.useProp = !!$.fn.prop; var i, dir; if(this.p.colNames.length === 0) { for (i=0;i<this.p.colModel.length;i++){ this.p.colNames[i] = this.p.colModel[i].label || this.p.colModel[i].name; } } if( this.p.colNames.length !== this.p.colModel.length ) { alert($.jgrid.errors.model); return; } var gv = $("<div class='ui-jqgrid-view'></div>"), ii, isMSIE = $.browser.msie ? true:false, isSafari = $.browser.webkit || $.browser.safari ? true : false; ts.p.direction = $.trim(ts.p.direction.toLowerCase()); if($.inArray(ts.p.direction,["ltr","rtl"]) == -1) { ts.p.direction = "ltr"; } dir = ts.p.direction; $(gv).insertBefore(this); $(this).appendTo(gv).removeClass("scroll"); var eg = $("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>"); $(eg).insertBefore(gv).attr({"id" : "gbox_"+this.id,"dir":dir}); $(gv).appendTo(eg).attr("id","gview_"+this.id); if (isMSIE && $.browser.version <= 6) { ii = '<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>'; } else { ii="";} $("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(ii).insertBefore(gv); $("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(gv); $(this).attr({cellspacing:"0",cellpadding:"0",border:"0","role":"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id}); var sortkeys = ["shiftKey","altKey","ctrlKey"], intNum = function(val,defval) { val = parseInt(val,10); if (isNaN(val)) { return defval ? defval : 0;} else {return val;} }, formatCol = function (pos, rowInd, tv, rawObject, rowId, rdata){ var cm = ts.p.colModel[pos], ral = cm.align, result="style=\"", clas = cm.classes, nm = cm.name, celp, acp=[]; if(ral) { result += "text-align:"+ral+";"; } if(cm.hidden===true) { result += "display:none;"; } if(rowInd===0) { result += "width: "+grid.headers[pos].width+"px;"; } else if (cm.cellattr && $.isFunction(cm.cellattr)) { celp = cm.cellattr.call(ts, rowId, tv, rawObject, cm, rdata); if(celp && typeof(celp) === "string") { celp = celp.replace(/style/i,'style').replace(/title/i,'title'); if(celp.indexOf('title') > -1) { cm.title=false;} if(celp.indexOf('class') > -1) { clas = undefined;} acp = celp.split("style"); if(acp.length === 2 ) { acp[1] = $.trim(acp[1].replace("=","")); if(acp[1].indexOf("'") === 0 || acp[1].indexOf('"') === 0) { acp[1] = acp[1].substring(1); } result += acp[1].replace(/'/gi,'"'); } else { result += "\""; } } } if(!acp.length) { acp[0] = ""; result += "\"";} result += (clas !== undefined ? (" class=\""+clas+"\"") :"") + ((cm.title && tv) ? (" title=\""+$.jgrid.stripHtml(tv)+"\"") :""); result += " aria-describedby=\""+ts.p.id+"_"+nm+"\""; return result + acp[0]; }, cellVal = function (val) { return val === undefined || val === null || val === "" ? "&#160;" : (ts.p.autoencode ? $.jgrid.htmlEncode(val) : val+""); }, formatter = function (rowId, cellval , colpos, rwdat, _act){ var cm = ts.p.colModel[colpos],v; if(typeof cm.formatter !== 'undefined') { var opts= {rowId: rowId, colModel:cm, gid:ts.p.id, pos:colpos }; if($.isFunction( cm.formatter ) ) { v = cm.formatter.call(ts,cellval,opts,rwdat,_act); } else if($.fmatter){ v = $.fn.fmatter.call(ts,cm.formatter,cellval,opts,rwdat,_act); } else { v = cellVal(cellval); } } else { v = cellVal(cellval); } return v; }, addCell = function(rowId,cell,pos,irow, srvr) { var v,prp; v = formatter(rowId,cell,pos,srvr,'add'); prp = formatCol( pos,irow, v, srvr, rowId, true); return "<td role=\"gridcell\" "+prp+">"+v+"</td>"; }, addMulti = function(rowid,pos,irow){ var v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+ts.p.id+"_"+rowid+"\" class=\"cbox\" name=\"jqg_"+ts.p.id+"_"+rowid+"\"/>", prp = formatCol( pos,irow,'',null, rowid, true); return "<td role=\"gridcell\" "+prp+">"+v+"</td>"; }, addRowNum = function (pos,irow,pG,rN) { var v = (parseInt(pG,10)-1)*parseInt(rN,10)+1+irow, prp = formatCol( pos,irow,v, null, irow, true); return "<td role=\"gridcell\" class=\"ui-state-default jqgrid-rownum\" "+prp+">"+v+"</td>"; }, reader = function (datatype) { var field, f=[], j=0, i; for(i =0; i<ts.p.colModel.length; i++){ field = ts.p.colModel[i]; if (field.name !== 'cb' && field.name !=='subgrid' && field.name !=='rn') { f[j]= datatype == "local" ? field.name : ( (datatype=="xml" || datatype === "xmlstring") ? field.xmlmap || field.name : field.jsonmap || field.name ); j++; } } return f; }, orderedCols = function (offset) { var order = ts.p.remapColumns; if (!order || !order.length) { order = $.map(ts.p.colModel, function(v,i) { return i; }); } if (offset) { order = $.map(order, function(v) { return v<offset?null:v-offset; }); } return order; }, emptyRows = function (parent, scroll, locdata) { if(ts.p.deepempty) {$("#"+$.jgrid.jqID(ts.p.id)+" tbody:first tr:gt(0)").remove();} else { var trf = $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first tr:first")[0]; $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first").empty().append(trf); } if (scroll && ts.p.scroll) { $(">div:first", parent).css({height:"auto"}).children("div:first").css({height:0,display:"none"}); parent.scrollTop = 0; } if(locdata === true) { if(ts.p.treeGrid === true ) { ts.p.data = []; ts.p._index = {}; } } }, refreshIndex = function() { var datalen = ts.p.data.length, idname, i, val, ni = ts.p.rownumbers===true ? 1 :0, gi = ts.p.multiselect ===true ? 1 :0, si = ts.p.subGrid===true ? 1 :0; if(ts.p.keyIndex === false || ts.p.loadonce === true) { idname = ts.p.localReader.id; } else { idname = ts.p.colModel[ts.p.keyIndex+gi+si+ni].name; } for(i =0;i < datalen; i++) { val = $.jgrid.getAccessor(ts.p.data[i],idname); ts.p._index[val] = i; } }, constructTr = function(id, hide, altClass, rd, cur) { var tabindex = '-1', restAttr = '', attrName, style = hide ? 'display:none;' : '', classes = 'ui-widget-content jqgrow ui-row-' + ts.p.direction + altClass, rowAttrObj = $.isFunction(ts.p.rowattr) ? ts.p.rowattr.call(ts, rd, cur) : {}; if(!$.isEmptyObject( rowAttrObj )) { if (rowAttrObj.hasOwnProperty("id")) { id = rowAttrObj.id; delete rowAttrObj.id; } if (rowAttrObj.hasOwnProperty("tabindex")) { tabindex = rowAttrObj.tabindex; delete rowAttrObj.tabindex; } if (rowAttrObj.hasOwnProperty("style")) { style += rowAttrObj.style; delete rowAttrObj.style; } if (rowAttrObj.hasOwnProperty("class")) { classes += ' ' + rowAttrObj['class']; delete rowAttrObj['class']; } // dot't allow to change role attribute try { delete rowAttrObj.role; } catch(ra){} for (attrName in rowAttrObj) { if (rowAttrObj.hasOwnProperty(attrName)) { restAttr += ' ' + attrName + '=' + rowAttrObj[attrName]; } } } return '<tr role="row" id="' + id + '" tabindex="' + tabindex + '" class="' + classes + '"' + (style === '' ? '' : ' style="' + style + '"') + restAttr + '>'; }, addXmlData = function (xml,t, rcnt, more, adjust) { var startReq = new Date(), locdata = (ts.p.datatype != "local" && ts.p.loadonce) || ts.p.datatype == "xmlstring", xmlid = "_id_", xmlRd = ts.p.xmlReader, frd = ts.p.datatype == "local" ? "local" : "xml"; if(locdata) { ts.p.data = []; ts.p._index = {}; ts.p.localReader.id = xmlid; } ts.p.reccount = 0; if($.isXMLDoc(xml)) { if(ts.p.treeANode===-1 && !ts.p.scroll) { emptyRows(t,false, true); rcnt=1; } else { rcnt = rcnt > 1 ? rcnt :1; } } else { return; } var i,fpos,ir=0,v,gi=ts.p.multiselect===true?1:0,si=ts.p.subGrid===true?1:0,ni=ts.p.rownumbers===true?1:0,idn, getId,f=[],F,rd ={}, xmlr,rid, rowData=[], cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1; if(!xmlRd.repeatitems) {f = reader(frd);} if( ts.p.keyIndex===false) { idn = $.isFunction( xmlRd.id ) ? xmlRd.id.call(ts, xml) : xmlRd.id; } else { idn = ts.p.keyIndex; } if(f.length>0 && !isNaN(idn)) { if (ts.p.remapColumns && ts.p.remapColumns.length) { idn = $.inArray(idn, ts.p.remapColumns); } idn=f[idn]; } if( (idn+"").indexOf("[") === -1 ) { if (f.length) { getId = function( trow, k) {return $(idn,trow).text() || k;}; } else { getId = function( trow, k) {return $(xmlRd.cell,trow).eq(idn).text() || k;}; } } else { getId = function( trow, k) {return trow.getAttribute(idn.replace(/[\[\]]/g,"")) || k;}; } ts.p.userData = {}; ts.p.page = $.jgrid.getXmlData( xml,xmlRd.page ) || 0; ts.p.lastpage = $.jgrid.getXmlData( xml,xmlRd.total ); if(ts.p.lastpage===undefined) { ts.p.lastpage=1; } ts.p.records = $.jgrid.getXmlData( xml,xmlRd.records ) || 0; if($.isFunction(xmlRd.userdata)) { ts.p.userData = xmlRd.userdata.call(ts, xml) || {}; } else { $.jgrid.getXmlData(xml, xmlRd.userdata, true).each(function() {ts.p.userData[this.getAttribute("name")]= $(this).text();}); } var gxml = $.jgrid.getXmlData( xml, xmlRd.root, true); gxml = $.jgrid.getXmlData( gxml, xmlRd.row, true); if (!gxml) { gxml = []; } var gl = gxml.length, j=0, grpdata={}, rn = parseInt(ts.p.rowNum,10); if (gl > 0 && ts.p.page <= 0) { ts.p.page = 1; } if(gxml && gl){ var br=ts.p.scroll?$.jgrid.randId():1,altr; if (adjust) { rn *= adjust+1; } var afterInsRow = $.isFunction(ts.p.afterInsertRow), hiderow=ts.p.grouping && ts.p.groupingView.groupCollapse === true; while (j<gl) { xmlr = gxml[j]; rid = getId(xmlr,br+j); rid = ts.p.idPrefix + rid; altr = rcnt === 0 ? 0 : rcnt+1; cn1 = (altr+j)%2 == 1 ? cn : ''; var cs = []; if( ni ) { cs[cs.length] = addRowNum(0,j,ts.p.page,ts.p.rowNum); } if( gi ) { cs[cs.length] = addMulti(rid,ni,j); } if( si ) { cs[cs.length] = $(ts).jqGrid("addSubGridCell",gi+ni,j+rcnt); } if(xmlRd.repeatitems){ if (!F) { F=orderedCols(gi+si+ni); } var cells = $.jgrid.getXmlData( xmlr, xmlRd.cell, true); $.each(F, function (k) { var cell = cells[this]; if (!cell) { return false; } v = cell.textContent || cell.text; rd[ts.p.colModel[k+gi+si+ni].name] = v; cs[cs.length] = addCell(rid,v,k+gi+si+ni,j+rcnt,xmlr); }); } else { for(i = 0; i < f.length;i++) { v = $.jgrid.getXmlData( xmlr, f[i]); rd[ts.p.colModel[i+gi+si+ni].name] = v; cs[cs.length] = addCell(rid, v, i+gi+si+ni, j+rcnt, xmlr); } } rowData.push(constructTr(rid, hiderow, cn1, rd, xmlr)); rowData.push( cs.join('')); rowData.push("</tr>"); if(ts.p.grouping) { var grlen = ts.p.groupingView.groupField.length, grpitem = []; for(var z=0;z<grlen;z++) { grpitem.push(rd[ts.p.groupingView.groupField[z]]); } grpdata = $(ts).jqGrid('groupingPrepare',rowData, grpitem, grpdata, rd); rowData = []; } if(locdata || ts.p.treeGrid === true) { rd[xmlid] = rid; ts.p.data.push(rd); ts.p._index[rid] = ts.p.data.length-1; } if(ts.p.gridview === false ) { $("tbody:first",t).append(rowData.join('')); $(ts).triggerHandler("jqGridAfterInsertRow", [rid, rd, xmlr]); if(afterInsRow) {ts.p.afterInsertRow.call(ts,rid,rd,xmlr);} rowData=[]; } rd={}; ir++; j++; if(ir==rn) {break;} } } if(ts.p.gridview === true) { fpos = ts.p.treeANode > -1 ? ts.p.treeANode: 0; if(ts.p.grouping) { $(ts).jqGrid('groupingRender',grpdata,ts.p.colModel.length); grpdata = null; } else if(ts.p.treeGrid === true && fpos > 0) { $(ts.rows[fpos]).after(rowData.join('')); } else { $("tbody:first",t).append(rowData.join('')); } } if(ts.p.subGrid === true ) { try {$(ts).jqGrid("addSubGrid",gi+ni);} catch (_){} } ts.p.totaltime = new Date() - startReq; if(ir>0) { if(ts.p.records===0) { ts.p.records=gl;} } rowData =null; if( ts.p.treeGrid === true) { try {$(ts).jqGrid("setTreeNode", fpos+1, ir+fpos+1);} catch (e) {} } if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;} ts.p.reccount=ir; ts.p.treeANode = -1; if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); } if(locdata) { ts.p.records = gl; ts.p.lastpage = Math.ceil(gl/ rn); } if (!more) { ts.updatepager(false,true); } if(locdata) { while (ir<gl) { xmlr = gxml[ir]; rid = getId(xmlr,ir); rid = ts.p.idPrefix + rid; if(xmlRd.repeatitems){ if (!F) { F=orderedCols(gi+si+ni); } var cells2 = $.jgrid.getXmlData( xmlr, xmlRd.cell, true); $.each(F, function (k) { var cell = cells2[this]; if (!cell) { return false; } v = cell.textContent || cell.text; rd[ts.p.colModel[k+gi+si+ni].name] = v; }); } else { for(i = 0; i < f.length;i++) { v = $.jgrid.getXmlData( xmlr, f[i]); rd[ts.p.colModel[i+gi+si+ni].name] = v; } } rd[xmlid] = rid; ts.p.data.push(rd); ts.p._index[rid] = ts.p.data.length-1; rd = {}; ir++; } } }, addJSONData = function(data,t, rcnt, more, adjust) { var startReq = new Date(); if(data) { if(ts.p.treeANode === -1 && !ts.p.scroll) { emptyRows(t,false, true); rcnt=1; } else { rcnt = rcnt > 1 ? rcnt :1; } } else { return; } var dReader, locid = "_id_", frd, locdata = (ts.p.datatype != "local" && ts.p.loadonce) || ts.p.datatype == "jsonstring"; if(locdata) { ts.p.data = []; ts.p._index = {}; ts.p.localReader.id = locid;} ts.p.reccount = 0; if(ts.p.datatype == "local") { dReader = ts.p.localReader; frd= 'local'; } else { dReader = ts.p.jsonReader; frd='json'; } var ir=0,v,i,j,f=[],F,cur,gi=ts.p.multiselect?1:0,si=ts.p.subGrid?1:0,ni=ts.p.rownumbers===true?1:0,len,drows,idn,rd={}, fpos, idr,rowData=[],cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1,lp; ts.p.page = $.jgrid.getAccessor(data,dReader.page) || 0; lp = $.jgrid.getAccessor(data,dReader.total); ts.p.lastpage = lp === undefined ? 1 : lp; ts.p.records = $.jgrid.getAccessor(data,dReader.records) || 0; ts.p.userData = $.jgrid.getAccessor(data,dReader.userdata) || {}; if(!dReader.repeatitems) { F = f = reader(frd); } if( ts.p.keyIndex===false ) { idn = $.isFunction(dReader.id) ? dReader.id.call(ts, data) : dReader.id; } else { idn = ts.p.keyIndex; } if(f.length>0 && !isNaN(idn)) { if (ts.p.remapColumns && ts.p.remapColumns.length) { idn = $.inArray(idn, ts.p.remapColumns); } idn=f[idn]; } drows = $.jgrid.getAccessor(data,dReader.root); if (!drows) { drows = []; } len = drows.length; i=0; if (len > 0 && ts.p.page <= 0) { ts.p.page = 1; } var rn = parseInt(ts.p.rowNum,10),br=ts.p.scroll?$.jgrid.randId():1, altr; if (adjust) { rn *= adjust+1; } var afterInsRow = $.isFunction(ts.p.afterInsertRow), grpdata={}, hiderow=ts.p.grouping && ts.p.groupingView.groupCollapse === true; while (i<len) { cur = drows[i]; idr = $.jgrid.getAccessor(cur,idn); if(idr === undefined) { idr = br+i; if(f.length===0){ if(dReader.cell){ var ccur = $.jgrid.getAccessor(cur,dReader.cell); idr = ccur !== undefined ? ccur[idn] || idr : idr; ccur=null; } } } idr = ts.p.idPrefix + idr; altr = rcnt === 1 ? 0 : rcnt; cn1 = (altr+i)%2 == 1 ? cn : ''; var cs = []; if( ni ) { cs[cs.length] = addRowNum(0,i,ts.p.page,ts.p.rowNum); } if( gi ){ cs[cs.length] = addMulti(idr,ni,i); } if( si ) { cs[cs.length] += $(ts).jqGrid("addSubGridCell",gi+ni,i+rcnt); } if (dReader.repeatitems) { if(dReader.cell) {cur = $.jgrid.getAccessor(cur,dReader.cell);} if (!F) { F=orderedCols(gi+si+ni); } } for (j=0;j<F.length;j++) { v = $.jgrid.getAccessor(cur,F[j]); cs[cs.length] = addCell(idr,v,j+gi+si+ni,i+rcnt,cur); rd[ts.p.colModel[j+gi+si+ni].name] = v; } rowData.push(constructTr(idr, hiderow, cn1, rd, cur)); rowData.push( cs.join('') ); rowData.push( "</tr>" ); if(ts.p.grouping) { var grlen = ts.p.groupingView.groupField.length, grpitem = []; for(var z=0;z<grlen;z++) { grpitem.push(rd[ts.p.groupingView.groupField[z]]); } grpdata = $(ts).jqGrid('groupingPrepare',rowData, grpitem, grpdata, rd); rowData = []; } if(locdata || ts.p.treeGrid===true) { rd[locid] = idr; ts.p.data.push(rd); ts.p._index[idr] = ts.p.data.length-1; } if(ts.p.gridview === false ) { $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first").append(rowData.join('')); $(ts).triggerHandler("jqGridAfterInsertRow", [idr, rd, cur]); if(afterInsRow) {ts.p.afterInsertRow.call(ts,idr,rd,cur);} rowData=[];//ari=0; } rd={}; ir++; i++; if(ir==rn) { break; } } if(ts.p.gridview === true ) { fpos = ts.p.treeANode > -1 ? ts.p.treeANode: 0; if(ts.p.grouping) { $(ts).jqGrid('groupingRender',grpdata,ts.p.colModel.length); grpdata = null; } else if(ts.p.treeGrid === true && fpos > 0) { $(ts.rows[fpos]).after(rowData.join('')); } else { $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first").append(rowData.join('')); } } if(ts.p.subGrid === true ) { try { $(ts).jqGrid("addSubGrid",gi+ni);} catch (_){} } ts.p.totaltime = new Date() - startReq; if(ir>0) { if(ts.p.records===0) { ts.p.records=len; } } rowData = null; if( ts.p.treeGrid === true) { try {$(ts).jqGrid("setTreeNode", fpos+1, ir+fpos+1);} catch (e) {} } if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;} ts.p.reccount=ir; ts.p.treeANode = -1; if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); } if(locdata) { ts.p.records = len; ts.p.lastpage = Math.ceil(len/ rn); } if (!more) { ts.updatepager(false,true); } if(locdata) { while (ir<len && drows[ir]) { cur = drows[ir]; idr = $.jgrid.getAccessor(cur,idn); if(idr === undefined) { idr = br+ir; if(f.length===0){ if(dReader.cell){ var ccur2 = $.jgrid.getAccessor(cur,dReader.cell); idr = ccur2[idn] || idr; ccur2=null; } } } if(cur) { idr = ts.p.idPrefix + idr; if (dReader.repeatitems) { if(dReader.cell) {cur = $.jgrid.getAccessor(cur,dReader.cell);} if (!F) { F=orderedCols(gi+si+ni); } } for (j=0;j<F.length;j++) { v = $.jgrid.getAccessor(cur,F[j]); rd[ts.p.colModel[j+gi+si+ni].name] = v; } rd[locid] = idr; ts.p.data.push(rd); ts.p._index[idr] = ts.p.data.length-1; rd = {}; } ir++; } } }, addLocalData = function() { var st, fndsort=false, cmtypes={}, grtypes=[], grindexes=[], srcformat, sorttype, newformat; if(!$.isArray(ts.p.data)) { return; } var grpview = ts.p.grouping ? ts.p.groupingView : false; $.each(ts.p.colModel,function(){ sorttype = this.sorttype || "text"; if(sorttype == "date" || sorttype == "datetime") { if(this.formatter && typeof(this.formatter) === 'string' && this.formatter == 'date') { if(this.formatoptions && this.formatoptions.srcformat) { srcformat = this.formatoptions.srcformat; } else { srcformat = $.jgrid.formatter.date.srcformat; } if(this.formatoptions && this.formatoptions.newformat) { newformat = this.formatoptions.newformat; } else { newformat = $.jgrid.formatter.date.newformat; } } else { srcformat = newformat = this.datefmt || "Y-m-d"; } cmtypes[this.name] = {"stype": sorttype, "srcfmt": srcformat,"newfmt":newformat}; } else { cmtypes[this.name] = {"stype": sorttype, "srcfmt":'',"newfmt":''}; } if(ts.p.grouping && this.name == grpview.groupField[0]) { var grindex = this.name; if (typeof this.index != 'undefined') { grindex = this.index; } grtypes[0] = cmtypes[grindex]; grindexes.push(grindex); } if(!fndsort && (this.index == ts.p.sortname || this.name == ts.p.sortname)){ st = this.name; // ??? fndsort = true; } }); if(ts.p.treeGrid) { $(ts).jqGrid("SortTree", st, ts.p.sortorder, cmtypes[st].stype, cmtypes[st].srcfmt); return; } var compareFnMap = { 'eq':function(queryObj) {return queryObj.equals;}, 'ne':function(queryObj) {return queryObj.notEquals;}, 'lt':function(queryObj) {return queryObj.less;}, 'le':function(queryObj) {return queryObj.lessOrEquals;}, 'gt':function(queryObj) {return queryObj.greater;}, 'ge':function(queryObj) {return queryObj.greaterOrEquals;}, 'cn':function(queryObj) {return queryObj.contains;}, 'nc':function(queryObj,op) {return op === "OR" ? queryObj.orNot().contains : queryObj.andNot().contains;}, 'bw':function(queryObj) {return queryObj.startsWith;}, 'bn':function(queryObj,op) {return op === "OR" ? queryObj.orNot().startsWith : queryObj.andNot().startsWith;}, 'en':function(queryObj,op) {return op === "OR" ? queryObj.orNot().endsWith : queryObj.andNot().endsWith;}, 'ew':function(queryObj) {return queryObj.endsWith;}, 'ni':function(queryObj,op) {return op === "OR" ? queryObj.orNot().equals : queryObj.andNot().equals;}, 'in':function(queryObj) {return queryObj.equals;}, 'nu':function(queryObj) {return queryObj.isNull;}, 'nn':function(queryObj,op) {return op === "OR" ? queryObj.orNot().isNull : queryObj.andNot().isNull;} }, query = $.jgrid.from(ts.p.data); if (ts.p.ignoreCase) { query = query.ignoreCase(); } function tojLinq ( group ) { var s = 0, index, gor, ror, opr, rule; if (group.groups !== undefined) { gor = group.groups.length && group.groupOp.toString().toUpperCase() === "OR"; if (gor) { query.orBegin(); } for (index = 0; index < group.groups.length; index++) { if (s > 0 && gor) { query.or(); } try { tojLinq(group.groups[index]); } catch (e) {alert(e);} s++; } if (gor) { query.orEnd(); } } if (group.rules !== undefined) { if(s>0) { var result = query.select(); query = $.jgrid.from( result); if (ts.p.ignoreCase) { query = query.ignoreCase(); } } try{ ror = group.rules.length && group.groupOp.toString().toUpperCase() === "OR"; if (ror) { query.orBegin(); } for (index = 0; index < group.rules.length; index++) { rule = group.rules[index]; opr = group.groupOp.toString().toUpperCase(); if (compareFnMap[rule.op] && rule.field ) { if(s > 0 && opr && opr === "OR") { query = query.or(); } query = compareFnMap[rule.op](query, opr)(rule.field, rule.data, cmtypes[rule.field]); } s++; } if (ror) { query.orEnd(); } } catch (g) {alert(g);} } } if (ts.p.search === true) { var srules = ts.p.postData.filters; if(srules) { if(typeof srules == "string") { srules = $.jgrid.parse(srules);} tojLinq( srules ); } else { try { query = compareFnMap[ts.p.postData.searchOper](query)(ts.p.postData.searchField, ts.p.postData.searchString,cmtypes[ts.p.postData.searchField]); } catch (se){} } } if(ts.p.grouping) { query.orderBy(grindexes,grpview.groupOrder[0],grtypes[0].stype, grtypes[0].srcfmt); grpview.groupDataSorted = true; } if (st && ts.p.sortorder && fndsort) { if(ts.p.sortorder.toUpperCase() == "DESC") { query.orderBy(ts.p.sortname, "d", cmtypes[st].stype, cmtypes[st].srcfmt); } else { query.orderBy(ts.p.sortname, "a", cmtypes[st].stype, cmtypes[st].srcfmt); } } var queryResults = query.select(), recordsperpage = parseInt(ts.p.rowNum,10), total = queryResults.length, page = parseInt(ts.p.page,10), totalpages = Math.ceil(total / recordsperpage), retresult = {}; queryResults = queryResults.slice( (page-1)*recordsperpage , page*recordsperpage ); query = null; cmtypes = null; retresult[ts.p.localReader.total] = totalpages; retresult[ts.p.localReader.page] = page; retresult[ts.p.localReader.records] = total; retresult[ts.p.localReader.root] = queryResults; retresult[ts.p.localReader.userdata] = ts.p.userData; queryResults = null; return retresult; }, updatepager = function(rn, dnd) { var cp, last, base, from,to,tot,fmt, pgboxes = "", sppg, tspg = ts.p.pager ? "_"+$.jgrid.jqID(ts.p.pager.substr(1)) : "", tspg_t = ts.p.toppager ? "_"+ts.p.toppager.substr(1) : ""; base = parseInt(ts.p.page,10)-1; if(base < 0) { base = 0; } base = base*parseInt(ts.p.rowNum,10); to = base + ts.p.reccount; if (ts.p.scroll) { var rows = $("tbody:first > tr:gt(0)", ts.grid.bDiv); base = to - rows.length; ts.p.reccount = rows.length; var rh = rows.outerHeight() || ts.grid.prevRowHeight; if (rh) { var top = base * rh; var height = parseInt(ts.p.records,10) * rh; $(">div:first",ts.grid.bDiv).css({height : height}).children("div:first").css({height:top,display:top?"":"none"}); } ts.grid.bDiv.scrollLeft = ts.grid.hDiv.scrollLeft; } pgboxes = ts.p.pager ? ts.p.pager : ""; pgboxes += ts.p.toppager ? (pgboxes ? "," + ts.p.toppager : ts.p.toppager) : ""; if(pgboxes) { fmt = $.jgrid.formatter.integer || {}; cp = intNum(ts.p.page); last = intNum(ts.p.lastpage); $(".selbox",pgboxes)[ this.p.useProp ? 'prop' : 'attr' ]("disabled",false); if(ts.p.pginput===true) { $('.ui-pg-input',pgboxes).val(ts.p.page); sppg = ts.p.toppager ? '#sp_1'+tspg+",#sp_1"+tspg_t : '#sp_1'+tspg; $(sppg).html($.fmatter ? $.fmatter.util.NumberFormat(ts.p.lastpage,fmt):ts.p.lastpage); } if (ts.p.viewrecords){ if(ts.p.reccount === 0) { $(".ui-paging-info",pgboxes).html(ts.p.emptyrecords); } else { from = base+1; tot=ts.p.records; if($.fmatter) { from = $.fmatter.util.NumberFormat(from,fmt); to = $.fmatter.util.NumberFormat(to,fmt); tot = $.fmatter.util.NumberFormat(tot,fmt); } $(".ui-paging-info",pgboxes).html($.jgrid.format(ts.p.recordtext,from,to,tot)); } } if(ts.p.pgbuttons===true) { if(cp<=0) {cp = last = 0;} if(cp==1 || cp === 0) { $("#first"+tspg+", #prev"+tspg).addClass('ui-state-disabled').removeClass('ui-state-hover'); if(ts.p.toppager) { $("#first_t"+tspg_t+", #prev_t"+tspg_t).addClass('ui-state-disabled').removeClass('ui-state-hover'); } } else { $("#first"+tspg+", #prev"+tspg).removeClass('ui-state-disabled'); if(ts.p.toppager) { $("#first_t"+tspg_t+", #prev_t"+tspg_t).removeClass('ui-state-disabled'); } } if(cp==last || cp === 0) { $("#next"+tspg+", #last"+tspg).addClass('ui-state-disabled').removeClass('ui-state-hover'); if(ts.p.toppager) { $("#next_t"+tspg_t+", #last_t"+tspg_t).addClass('ui-state-disabled').removeClass('ui-state-hover'); } } else { $("#next"+tspg+", #last"+tspg).removeClass('ui-state-disabled'); if(ts.p.toppager) { $("#next_t"+tspg_t+", #last_t"+tspg_t).removeClass('ui-state-disabled'); } } } } if(rn===true && ts.p.rownumbers === true) { $("td.jqgrid-rownum",ts.rows).each(function(i){ $(this).html(base+1+i); }); } if(dnd && ts.p.jqgdnd) { $(ts).jqGrid('gridDnD','updateDnD');} $(ts).triggerHandler("jqGridGridComplete"); if($.isFunction(ts.p.gridComplete)) {ts.p.gridComplete.call(ts);} $(ts).triggerHandler("jqGridAfterGridComplete"); }, beginReq = function() { ts.grid.hDiv.loading = true; if(ts.p.hiddengrid) { return;} switch(ts.p.loadui) { case "disable": break; case "enable": $("#load_"+$.jgrid.jqID(ts.p.id)).show(); break; case "block": $("#lui_"+$.jgrid.jqID(ts.p.id)).show(); $("#load_"+$.jgrid.jqID(ts.p.id)).show(); break; } }, endReq = function() { ts.grid.hDiv.loading = false; switch(ts.p.loadui) { case "disable": break; case "enable": $("#load_"+$.jgrid.jqID(ts.p.id)).hide(); break; case "block": $("#lui_"+$.jgrid.jqID(ts.p.id)).hide(); $("#load_"+$.jgrid.jqID(ts.p.id)).hide(); break; } }, populate = function (npage) { if(!ts.grid.hDiv.loading) { var pvis = ts.p.scroll && npage === false, prm = {}, dt, dstr, pN=ts.p.prmNames; if(ts.p.page <=0) { ts.p.page = 1; } if(pN.search !== null) {prm[pN.search] = ts.p.search;} if(pN.nd !== null) {prm[pN.nd] = new Date().getTime();} if(pN.rows !== null) {prm[pN.rows]= ts.p.rowNum;} if(pN.page !== null) {prm[pN.page]= ts.p.page;} if(pN.sort !== null) {prm[pN.sort]= ts.p.sortname;} if(pN.order !== null) {prm[pN.order]= ts.p.sortorder;} if(ts.p.rowTotal !== null && pN.totalrows !== null) { prm[pN.totalrows]= ts.p.rowTotal; } var lcf = $.isFunction(ts.p.loadComplete), lc = lcf ? ts.p.loadComplete : null; var adjust = 0; npage = npage || 1; if (npage > 1) { if(pN.npage !== null) { prm[pN.npage] = npage; adjust = npage - 1; npage = 1; } else { lc = function(req) { ts.p.page++; ts.grid.hDiv.loading = false; if (lcf) { ts.p.loadComplete.call(ts,req); } populate(npage-1); }; } } else if (pN.npage !== null) { delete ts.p.postData[pN.npage]; } if(ts.p.grouping) { $(ts).jqGrid('groupingSetup'); if(ts.p.groupingView.groupDataSorted === true) { prm[pN.sort] = ts.p.groupingView.groupField[0] +" "+ ts.p.groupingView.groupOrder[0]+", "+prm[pN.sort]; } } $.extend(ts.p.postData,prm); var rcnt = !ts.p.scroll ? 1 : ts.rows.length-1; var bfr = $(ts).triggerHandler("jqGridBeforeRequest"); if (bfr === false || bfr === 'stop') { return; } if ($.isFunction(ts.p.datatype)) { ts.p.datatype.call(ts,ts.p.postData,"load_"+ts.p.id); return;} else if($.isFunction(ts.p.beforeRequest)) { bfr = ts.p.beforeRequest.call(ts); if(bfr === undefined) { bfr = true; } if ( bfr === false ) { return; } } dt = ts.p.datatype.toLowerCase(); switch(dt) { case "json": case "jsonp": case "xml": case "script": $.ajax($.extend({ url:ts.p.url, type:ts.p.mtype, dataType: dt , data: $.isFunction(ts.p.serializeGridData)? ts.p.serializeGridData.call(ts,ts.p.postData) : ts.p.postData, success:function(data,st, xhr) { if ($.isFunction(ts.p.beforeProcessing)) { ts.p.beforeProcessing.call(ts, data, st, xhr); } if(dt === "xml") { addXmlData(data,ts.grid.bDiv,rcnt,npage>1,adjust); } else { addJSONData(data,ts.grid.bDiv,rcnt,npage>1,adjust); } $(ts).triggerHandler("jqGridLoadComplete", [data]); if(lc) { lc.call(ts,data); } $(ts).triggerHandler("jqGridAfterLoadComplete", [data]); if (pvis) { ts.grid.populateVisible(); } if( ts.p.loadonce || ts.p.treeGrid) {ts.p.datatype = "local";} data=null; if (npage === 1) { endReq(); } }, error:function(xhr,st,err){ if($.isFunction(ts.p.loadError)) { ts.p.loadError.call(ts,xhr,st,err); } if (npage === 1) { endReq(); } xhr=null; }, beforeSend: function(xhr, settings ){ var gotoreq = true; if($.isFunction(ts.p.loadBeforeSend)) { gotoreq = ts.p.loadBeforeSend.call(ts,xhr, settings); } if(gotoreq === undefined) { gotoreq = true; } if(gotoreq === false) { return false; } else { beginReq(); } } },$.jgrid.ajaxOptions, ts.p.ajaxGridOptions)); break; case "xmlstring": beginReq(); dstr = $.jgrid.stringToDoc(ts.p.datastr); addXmlData(dstr,ts.grid.bDiv); $(ts).triggerHandler("jqGridLoadComplete", [dstr]); if(lcf) {ts.p.loadComplete.call(ts,dstr);} $(ts).triggerHandler("jqGridAfterLoadComplete", [dstr]); ts.p.datatype = "local"; ts.p.datastr = null; endReq(); break; case "jsonstring": beginReq(); if(typeof ts.p.datastr == 'string') { dstr = $.jgrid.parse(ts.p.datastr); } else { dstr = ts.p.datastr; } addJSONData(dstr,ts.grid.bDiv); $(ts).triggerHandler("jqGridLoadComplete", [dstr]); if(lcf) {ts.p.loadComplete.call(ts,dstr);} $(ts).triggerHandler("jqGridAfterLoadComplete", [dstr]); ts.p.datatype = "local"; ts.p.datastr = null; endReq(); break; case "local": case "clientside": beginReq(); ts.p.datatype = "local"; var req = addLocalData(); addJSONData(req,ts.grid.bDiv,rcnt,npage>1,adjust); $(ts).triggerHandler("jqGridLoadComplete", [req]); if(lc) { lc.call(ts,req); } $(ts).triggerHandler("jqGridAfterLoadComplete", [req]); if (pvis) { ts.grid.populateVisible(); } endReq(); break; } } }, setHeadCheckBox = function ( checked ) { $('#cb_'+$.jgrid.jqID(ts.p.id),ts.grid.hDiv)[ts.p.useProp ? 'prop': 'attr']("checked", checked); var fid = ts.p.frozenColumns ? ts.p.id+"_frozen" : ""; if(fid) { $('#cb_'+$.jgrid.jqID(ts.p.id),ts.grid.fhDiv)[ts.p.useProp ? 'prop': 'attr']("checked", checked); } }, setPager = function (pgid, tp){ // TBD - consider escaping pgid with pgid = $.jgrid.jqID(pgid); var sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>", pginp = "", pgl="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>", str="", pgcnt, lft, cent, rgt, twd, tdw, i, clearVals = function(onpaging){ var ret; if ($.isFunction(ts.p.onPaging) ) { ret = ts.p.onPaging.call(ts,onpaging); } ts.p.selrow = null; if(ts.p.multiselect) {ts.p.selarrrow =[]; setHeadCheckBox( false );} ts.p.savedRow = []; if(ret=='stop') {return false;} return true; }; pgid = pgid.substr(1); tp += "_" + pgid; pgcnt = "pg_"+pgid; lft = pgid+"_left"; cent = pgid+"_center"; rgt = pgid+"_right"; $("#"+$.jgrid.jqID(pgid) ) .append("<div id='"+pgcnt+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='"+lft+"' align='left'></td><td id='"+cent+"' align='center' style='white-space:pre;'></td><td id='"+rgt+"' align='right'></td></tr></tbody></table></div>") .attr("dir","ltr"); //explicit setting if(ts.p.rowList.length >0){ str = "<td dir='"+dir+"'>"; str +="<select class='ui-pg-selbox' role='listbox'>"; for(i=0;i<ts.p.rowList.length;i++){ str +="<option role=\"option\" value=\""+ts.p.rowList[i]+"\""+((ts.p.rowNum == ts.p.rowList[i])?" selected=\"selected\"":"")+">"+ts.p.rowList[i]+"</option>"; } str +="</select></td>"; } if(dir=="rtl") { pgl += str; } if(ts.p.pginput===true) { pginp= "<td dir='"+dir+"'>"+$.jgrid.format(ts.p.pgtext || "","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1_"+$.jgrid.jqID(pgid)+"'></span>")+"</td>";} if(ts.p.pgbuttons===true) { var po=["first"+tp,"prev"+tp, "next"+tp,"last"+tp]; if(dir=="rtl") { po.reverse(); } pgl += "<td id='"+po[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>"; pgl += "<td id='"+po[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>"; pgl += pginp !== "" ? sep+pginp+sep:""; pgl += "<td id='"+po[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>"; pgl += "<td id='"+po[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"; } else if (pginp !== "") { pgl += pginp; } if(dir=="ltr") { pgl += str; } pgl += "</tr></tbody></table>"; if(ts.p.viewrecords===true) {$("td#"+pgid+"_"+ts.p.recordpos,"#"+pgcnt).append("<div dir='"+dir+"' style='text-align:"+ts.p.recordpos+"' class='ui-paging-info'></div>");} $("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).append(pgl); tdw = $(".ui-jqgrid").css("font-size") || "11px"; $(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+tdw+";visibility:hidden;' ></div>"); twd = $(pgl).clone().appendTo("#testpg").width(); $("#testpg").remove(); if(twd > 0) { if(pginp !== "") { twd += 50; } //should be param $("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).width(twd); } ts.p._nvtd = []; ts.p._nvtd[0] = twd ? Math.floor((ts.p.width - twd)/2) : Math.floor(ts.p.width/3); ts.p._nvtd[1] = 0; pgl=null; $('.ui-pg-selbox',"#"+pgcnt).bind('change',function() { ts.p.page = Math.round(ts.p.rowNum*(ts.p.page-1)/this.value-0.5)+1; ts.p.rowNum = this.value; if(ts.p.pager) { $('.ui-pg-selbox',ts.p.pager).val(this.value); } if(ts.p.toppager) { $('.ui-pg-selbox',ts.p.toppager).val(this.value); } if(!clearVals('records')) { return false; } populate(); return false; }); if(ts.p.pgbuttons===true) { $(".ui-pg-button","#"+pgcnt).hover(function(){ if($(this).hasClass('ui-state-disabled')) { this.style.cursor='default'; } else { $(this).addClass('ui-state-hover'); this.style.cursor='pointer'; } },function() { if(!$(this).hasClass('ui-state-disabled')) { $(this).removeClass('ui-state-hover'); this.style.cursor= "default"; } }); $("#first"+$.jgrid.jqID(tp)+", #prev"+$.jgrid.jqID(tp)+", #next"+$.jgrid.jqID(tp)+", #last"+$.jgrid.jqID(tp)).click( function() { var cp = intNum(ts.p.page,1), last = intNum(ts.p.lastpage,1), selclick = false, fp=true, pp=true, np=true,lp=true; if(last ===0 || last===1) {fp=false;pp=false;np=false;lp=false; } else if( last>1 && cp >=1) { if( cp === 1) { fp=false; pp=false; } //else if( cp>1 && cp <last){ } else if( cp===last){ np=false;lp=false; } } else if( last>1 && cp===0 ) { np=false;lp=false; cp=last-1;} if( this.id === 'first'+tp && fp ) { ts.p.page=1; selclick=true;} if( this.id === 'prev'+tp && pp) { ts.p.page=(cp-1); selclick=true;} if( this.id === 'next'+tp && np) { ts.p.page=(cp+1); selclick=true;} if( this.id === 'last'+tp && lp) { ts.p.page=last; selclick=true;} if(selclick) { if(!clearVals(this.id)) { return false; } populate(); } return false; }); } if(ts.p.pginput===true) { $('input.ui-pg-input',"#"+pgcnt).keypress( function(e) { var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; if(key == 13) { ts.p.page = ($(this).val()>0) ? $(this).val():ts.p.page; if(!clearVals('user')) { return false; } populate(); return false; } return this; }); } }, sortData = function (index, idxcol,reload,sor){ if(!ts.p.colModel[idxcol].sortable) { return; } var so; if(ts.p.savedRow.length > 0) {return;} if(!reload) { if( ts.p.lastsort == idxcol ) { if( ts.p.sortorder == 'asc') { ts.p.sortorder = 'desc'; } else if(ts.p.sortorder == 'desc') { ts.p.sortorder = 'asc';} } else { ts.p.sortorder = ts.p.colModel[idxcol].firstsortorder || 'asc'; } ts.p.page = 1; } if(sor) { if(ts.p.lastsort == idxcol && ts.p.sortorder == sor && !reload) { return; } else { ts.p.sortorder = sor; } } var previousSelectedTh = ts.grid.headers[ts.p.lastsort].el, newSelectedTh = ts.grid.headers[idxcol].el; $("span.ui-grid-ico-sort",previousSelectedTh).addClass('ui-state-disabled'); $(previousSelectedTh).attr("aria-selected","false"); $("span.ui-icon-"+ts.p.sortorder,newSelectedTh).removeClass('ui-state-disabled'); $(newSelectedTh).attr("aria-selected","true"); if(!ts.p.viewsortcols[0]) { if(ts.p.lastsort != idxcol) { $("span.s-ico",previousSelectedTh).hide(); $("span.s-ico",newSelectedTh).show(); } } index = index.substring(5 + ts.p.id.length + 1); // bad to be changed!?! ts.p.sortname = ts.p.colModel[idxcol].index || index; so = ts.p.sortorder; if ($(ts).triggerHandler("jqGridSortCol", [index, idxcol, so]) === 'stop') { ts.p.lastsort = idxcol; return; } if($.isFunction(ts.p.onSortCol)) {if (ts.p.onSortCol.call(ts,index,idxcol,so)=='stop') {ts.p.lastsort = idxcol; return;}} if(ts.p.datatype == "local") { if(ts.p.deselectAfterSort) {$(ts).jqGrid("resetSelection");} } else { ts.p.selrow = null; if(ts.p.multiselect){setHeadCheckBox( false );} ts.p.selarrrow =[]; ts.p.savedRow =[]; } if(ts.p.scroll) { var sscroll = ts.grid.bDiv.scrollLeft; emptyRows(ts.grid.bDiv,true, false); ts.grid.hDiv.scrollLeft = sscroll; } if(ts.p.subGrid && ts.p.datatype=='local') { $("td.sgexpanded","#"+$.jgrid.jqID(ts.p.id)).each(function(){ $(this).trigger("click"); }); } populate(); ts.p.lastsort = idxcol; if(ts.p.sortname != index && idxcol) {ts.p.lastsort = idxcol;} }, setColWidth = function () { var initwidth = 0, brd=isSafari? 0: intNum(ts.p.cellLayout,0), vc=0, lvc, scw=intNum(ts.p.scrollOffset,0),cw,hs=false,aw,gw=0, cl = 0, cr; $.each(ts.p.colModel, function() { if(typeof this.hidden === 'undefined') {this.hidden=false;} this.widthOrg = cw = intNum(this.width,0); if(this.hidden===false){ initwidth += cw+brd; if(this.fixed) { gw += cw+brd; } else { vc++; } cl++; } }); if(isNaN(ts.p.width)) {ts.p.width = grid.width = initwidth;} else { grid.width = ts.p.width;} ts.p.tblwidth = initwidth; if(ts.p.shrinkToFit ===false && ts.p.forceFit === true) {ts.p.forceFit=false;} if(ts.p.shrinkToFit===true && vc > 0) { aw = grid.width-brd*vc-gw; if(!isNaN(ts.p.height)) { aw -= scw; hs = true; } initwidth =0; $.each(ts.p.colModel, function(i) { if(this.hidden === false && !this.fixed){ cw = Math.round(aw*this.width/(ts.p.tblwidth-brd*vc-gw)); this.width =cw; initwidth += cw; lvc = i; } }); cr =0; if (hs) { if(grid.width-gw-(initwidth+brd*vc) !== scw){ cr = grid.width-gw-(initwidth+brd*vc)-scw; } } else if(!hs && Math.abs(grid.width-gw-(initwidth+brd*vc)) !== 1) { cr = grid.width-gw-(initwidth+brd*vc); } ts.p.colModel[lvc].width += cr; ts.p.tblwidth = initwidth+cr+brd*vc+gw; if(ts.p.tblwidth > ts.p.width) { ts.p.colModel[lvc].width -= (ts.p.tblwidth - parseInt(ts.p.width,10)); ts.p.tblwidth = ts.p.width; } } }, nextVisible= function(iCol) { var ret = iCol, j=iCol, i; for (i = iCol+1;i<ts.p.colModel.length;i++){ if(ts.p.colModel[i].hidden !== true ) { j=i; break; } } return j-ret; }, getOffset = function (iCol) { var i, ret = {}, brd1 = isSafari ? 0 : ts.p.cellLayout; ret[0] = ret[1] = ret[2] = 0; for(i=0;i<=iCol;i++){ if(ts.p.colModel[i].hidden === false ) { ret[0] += ts.p.colModel[i].width+brd1; } } if(ts.p.direction=="rtl") { ret[0] = ts.p.width - ret[0]; } ret[0] = ret[0] - ts.grid.bDiv.scrollLeft; if($(ts.grid.cDiv).is(":visible")) {ret[1] += $(ts.grid.cDiv).height() +parseInt($(ts.grid.cDiv).css("padding-top"),10)+parseInt($(ts.grid.cDiv).css("padding-bottom"),10);} if(ts.p.toolbar[0]===true && (ts.p.toolbar[1]=='top' || ts.p.toolbar[1]=='both')) {ret[1] += $(ts.grid.uDiv).height()+parseInt($(ts.grid.uDiv).css("border-top-width"),10)+parseInt($(ts.grid.uDiv).css("border-bottom-width"),10);} if(ts.p.toppager) {ret[1] += $(ts.grid.topDiv).height()+parseInt($(ts.grid.topDiv).css("border-bottom-width"),10);} ret[2] += $(ts.grid.bDiv).height() + $(ts.grid.hDiv).height(); return ret; }, getColumnHeaderIndex = function (th) { var i, headers = ts.grid.headers, ci = $.jgrid.getCellIndex(th); for (i = 0; i < headers.length; i++) { if (th === headers[i].el) { ci = i; break; } } return ci; }; this.p.id = this.id; if ($.inArray(ts.p.multikey,sortkeys) == -1 ) {ts.p.multikey = false;} ts.p.keyIndex=false; for (i=0; i<ts.p.colModel.length;i++) { ts.p.colModel[i] = $.extend(true, {}, ts.p.cmTemplate, ts.p.colModel[i].template || {}, ts.p.colModel[i]); if (ts.p.keyIndex === false && ts.p.colModel[i].key===true) { ts.p.keyIndex = i; } } ts.p.sortorder = ts.p.sortorder.toLowerCase(); if(ts.p.grouping===true) { ts.p.scroll = false; ts.p.rownumbers = false; ts.p.subGrid = false; ts.p.treeGrid = false; ts.p.gridview = true; } if(this.p.treeGrid === true) { try { $(this).jqGrid("setTreeGrid");} catch (_) {} if(ts.p.datatype != "local") { ts.p.localReader = {id: "_id_"}; } } if(this.p.subGrid) { try { $(ts).jqGrid("setSubGrid");} catch (s){} } if(this.p.multiselect) { this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>"); this.p.colModel.unshift({name:'cb',width:isSafari ? ts.p.multiselectWidth+ts.p.cellLayout : ts.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true}); } if(this.p.rownumbers) { this.p.colNames.unshift(""); this.p.colModel.unshift({name:'rn',width:ts.p.rownumWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true}); } ts.p.xmlReader = $.extend(true,{ root: "rows", row: "row", page: "rows>page", total: "rows>total", records : "rows>records", repeatitems: true, cell: "cell", id: "[id]", userdata: "userdata", subgrid: {root:"rows", row: "row", repeatitems: true, cell:"cell"} }, ts.p.xmlReader); ts.p.jsonReader = $.extend(true,{ root: "rows", page: "page", total: "total", records: "records", repeatitems: true, cell: "cell", id: "id", userdata: "userdata", subgrid: {root:"rows", repeatitems: true, cell:"cell"} },ts.p.jsonReader); ts.p.localReader = $.extend(true,{ root: "rows", page: "page", total: "total", records: "records", repeatitems: false, cell: "cell", id: "id", userdata: "userdata", subgrid: {root:"rows", repeatitems: true, cell:"cell"} },ts.p.localReader); if(ts.p.scroll){ ts.p.pgbuttons = false; ts.p.pginput=false; ts.p.rowList=[]; } if(ts.p.data.length) { refreshIndex(); } var thead = "<thead><tr class='ui-jqgrid-labels' role='rowheader'>", tdc, idn, w, res, sort, td, ptr, tbody, imgs,iac="",idc=""; if(ts.p.shrinkToFit===true && ts.p.forceFit===true) { for (i=ts.p.colModel.length-1;i>=0;i--){ if(!ts.p.colModel[i].hidden) { ts.p.colModel[i].resizable=false; break; } } } if(ts.p.viewsortcols[1] == 'horizontal') {iac=" ui-i-asc";idc=" ui-i-desc";} tdc = isMSIE ? "class='ui-th-div-ie'" :""; imgs = "<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+iac+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+dir+"'></span>"; imgs += "<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+idc+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+dir+"'></span></span>"; for(i=0;i<this.p.colNames.length;i++){ var tooltip = ts.p.headertitles ? (" title=\""+$.jgrid.stripHtml(ts.p.colNames[i])+"\"") :""; thead += "<th id='"+ts.p.id+"_"+ts.p.colModel[i].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+dir+"'"+ tooltip+">"; idn = ts.p.colModel[i].index || ts.p.colModel[i].name; thead += "<div id='jqgh_"+ts.p.id+"_"+ts.p.colModel[i].name+"' "+tdc+">"+ts.p.colNames[i]; if(!ts.p.colModel[i].width) { ts.p.colModel[i].width = 150; } else { ts.p.colModel[i].width = parseInt(ts.p.colModel[i].width,10); } if(typeof(ts.p.colModel[i].title) !== "boolean") { ts.p.colModel[i].title = true; } if (idn == ts.p.sortname) { ts.p.lastsort = i; } thead += imgs+"</div></th>"; } thead += "</tr></thead>"; imgs = null; $(this).append(thead); $("thead tr:first th",this).hover(function(){$(this).addClass('ui-state-hover');},function(){$(this).removeClass('ui-state-hover');}); if(this.p.multiselect) { var emp=[], chk; $('#cb_'+$.jgrid.jqID(ts.p.id),this).bind('click',function(){ ts.p.selarrrow = []; var froz = ts.p.frozenColumns === true ? ts.p.id + "_frozen" : ""; if (this.checked) { $(ts.rows).each(function(i) { if (i>0) { if(!$(this).hasClass("ui-subgrid") && !$(this).hasClass("jqgroup") && !$(this).hasClass('ui-state-disabled')){ $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+$.jgrid.jqID(this.id) )[ts.p.useProp ? 'prop': 'attr']("checked",true); $(this).addClass("ui-state-highlight").attr("aria-selected","true"); ts.p.selarrrow.push(this.id); ts.p.selrow = this.id; if(froz) { $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+$.jgrid.jqID(this.id), ts.grid.fbDiv )[ts.p.useProp ? 'prop': 'attr']("checked",true); $("#"+$.jgrid.jqID(this.id), ts.grid.fbDiv).addClass("ui-state-highlight"); } } } }); chk=true; emp=[]; } else { $(ts.rows).each(function(i) { if(i>0) { if(!$(this).hasClass("ui-subgrid") && !$(this).hasClass('ui-state-disabled')){ $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+$.jgrid.jqID(this.id) )[ts.p.useProp ? 'prop': 'attr']("checked", false); $(this).removeClass("ui-state-highlight").attr("aria-selected","false"); emp.push(this.id); if(froz) { $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+$.jgrid.jqID(this.id), ts.grid.fbDiv )[ts.p.useProp ? 'prop': 'attr']("checked",false); $("#"+$.jgrid.jqID(this.id), ts.grid.fbDiv).removeClass("ui-state-highlight"); } } } }); ts.p.selrow = null; chk=false; } $(ts).triggerHandler("jqGridSelectAll", [chk ? ts.p.selarrrow : emp, chk]); if($.isFunction(ts.p.onSelectAll)) {ts.p.onSelectAll.call(ts, chk ? ts.p.selarrrow : emp,chk);} }); } if(ts.p.autowidth===true) { var pw = $(eg).innerWidth(); ts.p.width = pw > 0? pw: 'nw'; } setColWidth(); $(eg).css("width",grid.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+ts.p.id+"'>&#160;</div>"); $(gv).css("width",grid.width+"px"); thead = $("thead:first",ts).get(0); var tfoot = ""; if(ts.p.footerrow) { tfoot += "<table role='grid' style='width:"+ts.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+dir+"'>"; } var thr = $("tr:first",thead), firstr = "<tr class='jqgfirstrow' role='row' style='height:auto'>"; ts.p.disableClick=false; $("th",thr).each(function ( j ) { w = ts.p.colModel[j].width; if(typeof ts.p.colModel[j].resizable === 'undefined') {ts.p.colModel[j].resizable = true;} if(ts.p.colModel[j].resizable){ res = document.createElement("span"); $(res).html("&#160;").addClass('ui-jqgrid-resize ui-jqgrid-resize-'+dir); if(!$.browser.opera) { $(res).css("cursor","col-resize"); } $(this).addClass(ts.p.resizeclass); } else { res = ""; } $(this).css("width",w+"px").prepend(res); var hdcol = ""; if( ts.p.colModel[j].hidden ) { $(this).css("display","none"); hdcol = "display:none;"; } firstr += "<td role='gridcell' style='height:0px;width:"+w+"px;"+hdcol+"'></td>"; grid.headers[j] = { width: w, el: this }; sort = ts.p.colModel[j].sortable; if( typeof sort !== 'boolean') {ts.p.colModel[j].sortable = true; sort=true;} var nm = ts.p.colModel[j].name; if( !(nm == 'cb' || nm=='subgrid' || nm=='rn') ) { if(ts.p.viewsortcols[2]){ $(">div",this).addClass('ui-jqgrid-sortable'); } } if(sort) { if(ts.p.viewsortcols[0]) {$("div span.s-ico",this).show(); if(j==ts.p.lastsort){ $("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled");}} else if( j == ts.p.lastsort) {$("div span.s-ico",this).show();$("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled");} } if(ts.p.footerrow) { tfoot += "<td role='gridcell' "+formatCol(j,0,'', null, '', false)+">&#160;</td>"; } }).mousedown(function(e) { if ($(e.target).closest("th>span.ui-jqgrid-resize").length != 1) { return; } var ci = getColumnHeaderIndex(this); if(ts.p.forceFit===true) {ts.p.nv= nextVisible(ci);} grid.dragStart(ci, e, getOffset(ci)); return false; }).click(function(e) { if (ts.p.disableClick) { ts.p.disableClick = false; return false; } var s = "th>div.ui-jqgrid-sortable",r,d; if (!ts.p.viewsortcols[2]) { s = "th>div>span>span.ui-grid-ico-sort"; } var t = $(e.target).closest(s); if (t.length != 1) { return; } var ci = getColumnHeaderIndex(this); if (!ts.p.viewsortcols[2]) { r=true;d=t.attr("sort"); } sortData( $('div',this)[0].id, ci, r, d); return false; }); if (ts.p.sortable && $.fn.sortable) { try { $(ts).jqGrid("sortableColumns", thr); } catch (e){} } if(ts.p.footerrow) { tfoot += "</tr></tbody></table>"; } firstr += "</tr>"; tbody = document.createElement("tbody"); this.appendChild(tbody); $(this).addClass('ui-jqgrid-btable').append(firstr); firstr = null; var hTable = $("<table class='ui-jqgrid-htable' style='width:"+ts.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(thead), hg = (ts.p.caption && ts.p.hiddengrid===true) ? true : false, hb = $("<div class='ui-jqgrid-hbox" + (dir=="rtl" ? "-rtl" : "" )+"'></div>"); thead = null; grid.hDiv = document.createElement("div"); $(grid.hDiv) .css({ width: grid.width+"px"}) .addClass("ui-state-default ui-jqgrid-hdiv") .append(hb); $(hb).append(hTable); hTable = null; if(hg) { $(grid.hDiv).hide(); } if(ts.p.pager){ // TBD -- escape ts.p.pager here? if(typeof ts.p.pager == "string") {if(ts.p.pager.substr(0,1) !="#") { ts.p.pager = "#"+ts.p.pager;} } else { ts.p.pager = "#"+ $(ts.p.pager).attr("id");} $(ts.p.pager).css({width: grid.width+"px"}).appendTo(eg).addClass('ui-state-default ui-jqgrid-pager ui-corner-bottom'); if(hg) {$(ts.p.pager).hide();} setPager(ts.p.pager,''); } if( ts.p.cellEdit === false && ts.p.hoverrows === true) { $(ts).bind('mouseover',function(e) { ptr = $(e.target).closest("tr.jqgrow"); if($(ptr).attr("class") !== "ui-subgrid") { $(ptr).addClass("ui-state-hover"); } }).bind('mouseout',function(e) { ptr = $(e.target).closest("tr.jqgrow"); $(ptr).removeClass("ui-state-hover"); }); } var ri,ci, tdHtml; $(ts).before(grid.hDiv).click(function(e) { td = e.target; ptr = $(td,ts.rows).closest("tr.jqgrow"); if($(ptr).length === 0 || ptr[0].className.indexOf( 'ui-state-disabled' ) > -1 || ($(td,ts).closest("table.ui-jqgrid-btable").attr('id') || '').replace("_frozen","") !== ts.id ) { return this; } var scb = $(td).hasClass("cbox"), cSel = $(ts).triggerHandler("jqGridBeforeSelectRow", [ptr[0].id, e]); cSel = (cSel === false || cSel === 'stop') ? false : true; if(cSel && $.isFunction(ts.p.beforeSelectRow)) { cSel = ts.p.beforeSelectRow.call(ts,ptr[0].id, e); } if (td.tagName == 'A' || ((td.tagName == 'INPUT' || td.tagName == 'TEXTAREA' || td.tagName == 'OPTION' || td.tagName == 'SELECT' ) && !scb) ) { return; } if(cSel === true) { ri = ptr[0].id; ci = $.jgrid.getCellIndex(td); tdHtml = $(td).closest("td,th").html(); $(ts).triggerHandler("jqGridCellSelect", [ri,ci,tdHtml,e]); if($.isFunction(ts.p.onCellSelect)) { ts.p.onCellSelect.call(ts,ri,ci,tdHtml,e); } if(ts.p.cellEdit === true) { if(ts.p.multiselect && scb){ $(ts).jqGrid("setSelection", ri ,true,e); } else { ri = ptr[0].rowIndex; try {$(ts).jqGrid("editCell",ri,ci,true);} catch (_) {} } } else if ( !ts.p.multikey ) { if(ts.p.multiselect && ts.p.multiboxonly) { if(scb){$(ts).jqGrid("setSelection",ri,true,e);} else { var frz = ts.p.frozenColumns ? ts.p.id+"_frozen" : ""; $(ts.p.selarrrow).each(function(i,n){ var ind = ts.rows.namedItem(n); $(ind).removeClass("ui-state-highlight"); $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+$.jgrid.jqID(n))[ts.p.useProp ? 'prop': 'attr']("checked", false); if(frz) { $("#"+$.jgrid.jqID(n), "#"+$.jgrid.jqID(frz)).removeClass("ui-state-highlight"); $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+$.jgrid.jqID(n), "#"+$.jgrid.jqID(frz))[ts.p.useProp ? 'prop': 'attr']("checked", false); } }); ts.p.selarrrow = []; $(ts).jqGrid("setSelection",ri,true,e); } } else { $(ts).jqGrid("setSelection",ri,true,e); } } else { if(e[ts.p.multikey]) { $(ts).jqGrid("setSelection",ri,true,e); } else if(ts.p.multiselect && scb) { scb = $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+ri).is(":checked"); $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+ri)[ts.p.useProp ? 'prop' : 'attr']("checked", scb); } } } }).bind('reloadGrid', function(e,opts) { if(ts.p.treeGrid ===true) { ts.p.datatype = ts.p.treedatatype;} if (opts && opts.current) { ts.grid.selectionPreserver(ts); } if(ts.p.datatype=="local"){ $(ts).jqGrid("resetSelection"); if(ts.p.data.length) { refreshIndex();} } else if(!ts.p.treeGrid) { ts.p.selrow=null; if(ts.p.multiselect) {ts.p.selarrrow =[];setHeadCheckBox(false);} ts.p.savedRow = []; } if(ts.p.scroll) {emptyRows(ts.grid.bDiv,true, false);} if (opts && opts.page) { var page = opts.page; if (page > ts.p.lastpage) { page = ts.p.lastpage; } if (page < 1) { page = 1; } ts.p.page = page; if (ts.grid.prevRowHeight) { ts.grid.bDiv.scrollTop = (page - 1) * ts.grid.prevRowHeight * ts.p.rowNum; } else { ts.grid.bDiv.scrollTop = 0; } } if (ts.grid.prevRowHeight && ts.p.scroll) { delete ts.p.lastpage; ts.grid.populateVisible(); } else { ts.grid.populate(); } return false; }) .dblclick(function(e) { td = e.target; ptr = $(td,ts.rows).closest("tr.jqgrow"); if($(ptr).length === 0 ){return;} ri = ptr[0].rowIndex; ci = $.jgrid.getCellIndex(td); $(ts).triggerHandler("jqGridDblClickRow", [$(ptr).attr("id"),ri,ci,e]); if ($.isFunction(this.p.ondblClickRow)) { ts.p.ondblClickRow.call(ts,$(ptr).attr("id"),ri,ci, e); } }) .bind('contextmenu', function(e) { td = e.target; ptr = $(td,ts.rows).closest("tr.jqgrow"); if($(ptr).length === 0 ){return;} if(!ts.p.multiselect) { $(ts).jqGrid("setSelection",ptr[0].id,true,e); } ri = ptr[0].rowIndex; ci = $.jgrid.getCellIndex(td); $(ts).triggerHandler("jqGridRightClickRow", [$(ptr).attr("id"),ri,ci,e]); if ($.isFunction(this.p.onRightClickRow)) { ts.p.onRightClickRow.call(ts,$(ptr).attr("id"),ri,ci, e); } }); grid.bDiv = document.createElement("div"); if(isMSIE) { if(String(ts.p.height).toLowerCase() === "auto") { ts.p.height = "100%"; } } $(grid.bDiv) .append($('<div style="position:relative;'+(isMSIE && $.browser.version < 8 ? "height:0.01%;" : "")+'"></div>').append('<div></div>').append(this)) .addClass("ui-jqgrid-bdiv") .css({ height: ts.p.height+(isNaN(ts.p.height)?"":"px"), width: (grid.width)+"px"}) .scroll(grid.scrollGrid); $("table:first",grid.bDiv).css({width:ts.p.tblwidth+"px"}); if( isMSIE ) { if( $("tbody",this).size() == 2 ) { $("tbody:gt(0)",this).remove();} if( ts.p.multikey) {$(grid.bDiv).bind("selectstart",function(){return false;});} } else { if( ts.p.multikey) {$(grid.bDiv).bind("mousedown",function(){return false;});} } if(hg) {$(grid.bDiv).hide();} grid.cDiv = document.createElement("div"); var arf = ts.p.hidegrid===true ? $("<a role='link' href='javascript:void(0)'/>").addClass('ui-jqgrid-titlebar-close HeaderButton').hover( function(){ arf.addClass('ui-state-hover');}, function() {arf.removeClass('ui-state-hover');}) .append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css((dir=="rtl"?"left":"right"),"0px") : ""; $(grid.cDiv).append(arf).append("<span class='ui-jqgrid-title"+(dir=="rtl" ? "-rtl" :"" )+"'>"+ts.p.caption+"</span>") .addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix"); $(grid.cDiv).insertBefore(grid.hDiv); if( ts.p.toolbar[0] ) { grid.uDiv = document.createElement("div"); if(ts.p.toolbar[1] == "top") {$(grid.uDiv).insertBefore(grid.hDiv);} else if (ts.p.toolbar[1]=="bottom" ) {$(grid.uDiv).insertAfter(grid.hDiv);} if(ts.p.toolbar[1]=="both") { grid.ubDiv = document.createElement("div"); $(grid.uDiv).insertBefore(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id); $(grid.ubDiv).insertAfter(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id); if(hg) {$(grid.ubDiv).hide();} } else { $(grid.uDiv).width(grid.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id); } if(hg) {$(grid.uDiv).hide();} } if(ts.p.toppager) { ts.p.toppager = $.jgrid.jqID(ts.p.id)+"_toppager"; grid.topDiv = $("<div id='"+ts.p.toppager+"'></div>")[0]; ts.p.toppager = "#"+ts.p.toppager; $(grid.topDiv).insertBefore(grid.hDiv).addClass('ui-state-default ui-jqgrid-toppager').width(grid.width); setPager(ts.p.toppager,'_t'); } if(ts.p.footerrow) { grid.sDiv = $("<div class='ui-jqgrid-sdiv'></div>")[0]; hb = $("<div class='ui-jqgrid-hbox"+(dir=="rtl"?"-rtl":"")+"'></div>"); $(grid.sDiv).append(hb).insertAfter(grid.hDiv).width(grid.width); $(hb).append(tfoot); grid.footers = $(".ui-jqgrid-ftable",grid.sDiv)[0].rows[0].cells; if(ts.p.rownumbers) { grid.footers[0].className = 'ui-state-default jqgrid-rownum'; } if(hg) {$(grid.sDiv).hide();} } hb = null; if(ts.p.caption) { var tdt = ts.p.datatype; if(ts.p.hidegrid===true) { $(".ui-jqgrid-titlebar-close",grid.cDiv).click( function(e){ var onHdCl = $.isFunction(ts.p.onHeaderClick), elems = ".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv", counter, self = this; if(ts.p.toolbar[0]===true) { if( ts.p.toolbar[1]=='both') { elems += ', #' + $(grid.ubDiv).attr('id'); } elems += ', #' + $(grid.uDiv).attr('id'); } counter = $(elems,"#gview_"+$.jgrid.jqID(ts.p.id)).length; if(ts.p.gridstate == 'visible') { $(elems,"#gbox_"+$.jgrid.jqID(ts.p.id)).slideUp("fast", function() { counter--; if (counter === 0) { $("span",self).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"); ts.p.gridstate = 'hidden'; if($("#gbox_"+$.jgrid.jqID(ts.p.id)).hasClass("ui-resizable")) { $(".ui-resizable-handle","#gbox_"+$.jgrid.jqID(ts.p.id)).hide(); } $(ts).triggerHandler("jqGridHeaderClick", [ts.p.gridstate,e]); if(onHdCl) {if(!hg) {ts.p.onHeaderClick.call(ts,ts.p.gridstate,e);}} } }); } else if(ts.p.gridstate == 'hidden'){ $(elems,"#gbox_"+$.jgrid.jqID(ts.p.id)).slideDown("fast", function() { counter--; if (counter === 0) { $("span",self).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"); if(hg) {ts.p.datatype = tdt;populate();hg=false;} ts.p.gridstate = 'visible'; if($("#gbox_"+$.jgrid.jqID(ts.p.id)).hasClass("ui-resizable")) { $(".ui-resizable-handle","#gbox_"+$.jgrid.jqID(ts.p.id)).show(); } $(ts).triggerHandler("jqGridHeaderClick", [ts.p.gridstate,e]); if(onHdCl) {if(!hg) {ts.p.onHeaderClick.call(ts,ts.p.gridstate,e);}} } }); } return false; }); if(hg) {ts.p.datatype="local"; $(".ui-jqgrid-titlebar-close",grid.cDiv).trigger("click");} } } else {$(grid.cDiv).hide();} $(grid.hDiv).after(grid.bDiv) .mousemove(function (e) { if(grid.resizing){grid.dragMove(e);return false;} }); $(".ui-jqgrid-labels",grid.hDiv).bind("selectstart", function () { return false; }); $(document).mouseup(function () { if(grid.resizing) { grid.dragEnd(); return false;} return true; }); ts.formatCol = formatCol; ts.sortData = sortData; ts.updatepager = updatepager; ts.refreshIndex = refreshIndex; ts.setHeadCheckBox = setHeadCheckBox; ts.constructTr = constructTr; ts.formatter = function ( rowId, cellval , colpos, rwdat, act){return formatter(rowId, cellval , colpos, rwdat, act);}; $.extend(grid,{populate : populate, emptyRows: emptyRows}); this.grid = grid; ts.addXmlData = function(d) {addXmlData(d,ts.grid.bDiv);}; ts.addJSONData = function(d) {addJSONData(d,ts.grid.bDiv);}; this.grid.cols = this.rows[0].cells; populate();ts.p.hiddengrid=false; $(window).unload(function () { ts = null; }); }); }; $.jgrid.extend({ getGridParam : function(pName) { var $t = this[0]; if (!$t || !$t.grid) {return;} if (!pName) { return $t.p; } else {return typeof($t.p[pName]) != "undefined" ? $t.p[pName] : null;} }, setGridParam : function (newParams){ return this.each(function(){ if (this.grid && typeof(newParams) === 'object') {$.extend(true,this.p,newParams);} }); }, getDataIDs : function () { var ids=[], i=0, len, j=0; this.each(function(){ len = this.rows.length; if(len && len>0){ while(i<len) { if($(this.rows[i]).hasClass('jqgrow')) { ids[j] = this.rows[i].id; j++; } i++; } } }); return ids; }, setSelection : function(selection,onsr, e) { return this.each(function(){ var $t = this, stat,pt, ner, ia, tpsr, fid; if(selection === undefined) { return; } onsr = onsr === false ? false : true; pt=$t.rows.namedItem(selection+""); if(!pt || !pt.className || pt.className.indexOf( 'ui-state-disabled' ) > -1 ) { return; } function scrGrid(iR){ var ch = $($t.grid.bDiv)[0].clientHeight, st = $($t.grid.bDiv)[0].scrollTop, rpos = $t.rows[iR].offsetTop, rh = $t.rows[iR].clientHeight; if(rpos+rh >= ch+st) { $($t.grid.bDiv)[0].scrollTop = rpos-(ch+st)+rh+st; } else if(rpos < ch+st) { if(rpos < st) { $($t.grid.bDiv)[0].scrollTop = rpos; } } } if($t.p.scrollrows===true) { ner = $t.rows.namedItem(selection).rowIndex; if(ner >=0 ){ scrGrid(ner); } } if($t.p.frozenColumns === true ) { fid = $t.p.id+"_frozen"; } if(!$t.p.multiselect) { if(pt.className !== "ui-subgrid") { if( $t.p.selrow != pt.id) { $($t.rows.namedItem($t.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false", "tabindex" : "-1"}); $(pt).addClass("ui-state-highlight").attr({"aria-selected":"true", "tabindex" : "0"});//.focus(); if(fid) { $("#"+$.jgrid.jqID($t.p.selrow), "#"+$.jgrid.jqID(fid)).removeClass("ui-state-highlight"); $("#"+$.jgrid.jqID(selection), "#"+$.jgrid.jqID(fid)).addClass("ui-state-highlight"); } stat = true; } else { stat = false; } $t.p.selrow = pt.id; $($t).triggerHandler("jqGridSelectRow", [pt.id, stat, e]); if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t, pt.id, stat, e); } } } else { //unselect selectall checkbox when deselecting a specific row $t.setHeadCheckBox( false ); $t.p.selrow = pt.id; ia = $.inArray($t.p.selrow,$t.p.selarrrow); if ( ia === -1 ){ if(pt.className !== "ui-subgrid") { $(pt).addClass("ui-state-highlight").attr("aria-selected","true");} stat = true; $t.p.selarrrow.push($t.p.selrow); } else { if(pt.className !== "ui-subgrid") { $(pt).removeClass("ui-state-highlight").attr("aria-selected","false");} stat = false; $t.p.selarrrow.splice(ia,1); tpsr = $t.p.selarrrow[0]; $t.p.selrow = (tpsr === undefined) ? null : tpsr; } $("#jqg_"+$.jgrid.jqID($t.p.id)+"_"+$.jgrid.jqID(pt.id))[$t.p.useProp ? 'prop': 'attr']("checked",stat); if(fid) { if(ia === -1) { $("#"+$.jgrid.jqID(selection), "#"+$.jgrid.jqID(fid)).addClass("ui-state-highlight"); } else { $("#"+$.jgrid.jqID(selection), "#"+$.jgrid.jqID(fid)).removeClass("ui-state-highlight"); } $("#jqg_"+$.jgrid.jqID($t.p.id)+"_"+$.jgrid.jqID(selection), "#"+$.jgrid.jqID(fid))[$t.p.useProp ? 'prop': 'attr']("checked",stat); } $($t).triggerHandler("jqGridSelectRow", [pt.id, stat, e]); if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t, pt.id , stat, e); } } }); }, resetSelection : function( rowid ){ return this.each(function(){ var t = this, ind, sr, fid; if( t.p.frozenColumns === true ) { fid = t.p.id+"_frozen"; } if(typeof(rowid) !== "undefined" ) { sr = rowid === t.p.selrow ? t.p.selrow : rowid; $("#"+$.jgrid.jqID(t.p.id)+" tbody:first tr#"+$.jgrid.jqID(sr)).removeClass("ui-state-highlight").attr("aria-selected","false"); if (fid) { $("#"+$.jgrid.jqID(sr), "#"+$.jgrid.jqID(fid)).removeClass("ui-state-highlight"); } if(t.p.multiselect) { $("#jqg_"+$.jgrid.jqID(t.p.id)+"_"+$.jgrid.jqID(sr), "#"+$.jgrid.jqID(t.p.id))[t.p.useProp ? 'prop': 'attr']("checked",false); if(fid) { $("#jqg_"+$.jgrid.jqID(t.p.id)+"_"+$.jgrid.jqID(sr), "#"+$.jgrid.jqID(fid))[t.p.useProp ? 'prop': 'attr']("checked",false); } t.setHeadCheckBox( false); } sr = null; } else if(!t.p.multiselect) { if(t.p.selrow) { $("#"+$.jgrid.jqID(t.p.id)+" tbody:first tr#"+$.jgrid.jqID(t.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false"); if(fid) { $("#"+$.jgrid.jqID(t.p.selrow), "#"+$.jgrid.jqID(fid)).removeClass("ui-state-highlight"); } t.p.selrow = null; } } else { $(t.p.selarrrow).each(function(i,n){ ind = t.rows.namedItem(n); $(ind).removeClass("ui-state-highlight").attr("aria-selected","false"); $("#jqg_"+$.jgrid.jqID(t.p.id)+"_"+$.jgrid.jqID(n))[t.p.useProp ? 'prop': 'attr']("checked",false); if(fid) { $("#"+$.jgrid.jqID(n), "#"+$.jgrid.jqID(fid)).removeClass("ui-state-highlight"); $("#jqg_"+$.jgrid.jqID(t.p.id)+"_"+$.jgrid.jqID(n), "#"+$.jgrid.jqID(fid))[t.p.useProp ? 'prop': 'attr']("checked",false); } }); t.setHeadCheckBox( false ); t.p.selarrrow = []; } if(t.p.cellEdit === true) { if(parseInt(t.p.iCol,10)>=0 && parseInt(t.p.iRow,10)>=0) { $("td:eq("+t.p.iCol+")",t.rows[t.p.iRow]).removeClass("edit-cell ui-state-highlight"); $(t.rows[t.p.iRow]).removeClass("selected-row ui-state-hover"); } } t.p.savedRow = []; }); }, getRowData : function( rowid ) { var res = {}, resall, getall=false, len, j=0; this.each(function(){ var $t = this,nm,ind; if(typeof(rowid) == 'undefined') { getall = true; resall = []; len = $t.rows.length; } else { ind = $t.rows.namedItem(rowid); if(!ind) { return res; } len = 2; } while(j<len){ if(getall) { ind = $t.rows[j]; } if( $(ind).hasClass('jqgrow') ) { $('td',ind).each( function(i) { nm = $t.p.colModel[i].name; if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn') { if($t.p.treeGrid===true && nm == $t.p.ExpandColumn) { res[nm] = $.jgrid.htmlDecode($("span:first",this).html()); } else { try { res[nm] = $.unformat.call($t,this,{rowId:ind.id, colModel:$t.p.colModel[i]},i); } catch (e){ res[nm] = $.jgrid.htmlDecode($(this).html()); } } } }); if(getall) { resall.push(res); res={}; } } j++; } }); return resall ? resall: res; }, delRowData : function(rowid) { var success = false, rowInd, ia, ri; this.each(function() { var $t = this; rowInd = $t.rows.namedItem(rowid); if(!rowInd) {return false;} else { ri = rowInd.rowIndex; $(rowInd).remove(); $t.p.records--; $t.p.reccount--; $t.updatepager(true,false); success=true; if($t.p.multiselect) { ia = $.inArray(rowid,$t.p.selarrrow); if(ia != -1) { $t.p.selarrrow.splice(ia,1);} } if(rowid == $t.p.selrow) {$t.p.selrow=null;} } if($t.p.datatype == 'local') { var id = $.jgrid.stripPref($t.p.idPrefix, rowid), pos = $t.p._index[id]; if(typeof(pos) != 'undefined') { $t.p.data.splice(pos,1); $t.refreshIndex(); } } if( $t.p.altRows === true && success ) { var cn = $t.p.altclass; $($t.rows).each(function(i){ if(i % 2 ==1) { $(this).addClass(cn); } else { $(this).removeClass(cn); } }); } }); return success; }, setRowData : function(rowid, data, cssp) { var nm, success=true, title; this.each(function(){ if(!this.grid) {return false;} var t = this, vl, ind, cp = typeof cssp, lcdata={}; ind = t.rows.namedItem(rowid); if(!ind) { return false; } if( data ) { try { $(this.p.colModel).each(function(i){ nm = this.name; if( data[nm] !== undefined) { lcdata[nm] = this.formatter && typeof(this.formatter) === 'string' && this.formatter == 'date' ? $.unformat.date.call(t,data[nm],this) : data[nm]; vl = t.formatter( rowid, data[nm], i, data, 'edit'); title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {}; if(t.p.treeGrid===true && nm == t.p.ExpandColumn) { $("td:eq("+i+") > span:first",ind).html(vl).attr(title); } else { $("td:eq("+i+")",ind).html(vl).attr(title); } } }); if(t.p.datatype == 'local') { var id = $.jgrid.stripPref(t.p.idPrefix, rowid), pos = t.p._index[id]; if(t.p.treeGrid) { for(var key in t.p.treeReader ){ if(lcdata.hasOwnProperty(t.p.treeReader[key])) { delete lcdata[t.p.treeReader[key]]; } } } if(typeof(pos) != 'undefined') { t.p.data[pos] = $.extend(true, t.p.data[pos], lcdata); } lcdata = null; } } catch (e) { success = false; } } if(success) { if(cp === 'string') {$(ind).addClass(cssp);} else if(cp === 'object') {$(ind).css(cssp);} $(t).triggerHandler("jqGridAfterGridComplete"); } }); return success; }, addRowData : function(rowid,rdata,pos,src) { if(!pos) {pos = "last";} var success = false, nm, row, gi, si, ni,sind, i, v, prp="", aradd, cnm, cn, data, cm, id; if(rdata) { if($.isArray(rdata)) { aradd=true; pos = "last"; cnm = rowid; } else { rdata = [rdata]; aradd = false; } this.each(function() { var t = this, datalen = rdata.length; ni = t.p.rownumbers===true ? 1 :0; gi = t.p.multiselect ===true ? 1 :0; si = t.p.subGrid===true ? 1 :0; if(!aradd) { if(typeof(rowid) != 'undefined') { rowid = rowid+"";} else { rowid = $.jgrid.randId(); if(t.p.keyIndex !== false) { cnm = t.p.colModel[t.p.keyIndex+gi+si+ni].name; if(typeof rdata[0][cnm] != "undefined") { rowid = rdata[0][cnm]; } } } } cn = t.p.altclass; var k = 0, cna ="", lcdata = {}, air = $.isFunction(t.p.afterInsertRow) ? true : false; while(k < datalen) { data = rdata[k]; row=[]; if(aradd) { try {rowid = data[cnm];} catch (e) {rowid = $.jgrid.randId();} cna = t.p.altRows === true ? (t.rows.length-1)%2 === 0 ? cn : "" : ""; } id = rowid; rowid = t.p.idPrefix + rowid; if(ni){ prp = t.formatCol(0,1,'',null,rowid, true); row[row.length] = "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_rn\" class=\"ui-state-default jqgrid-rownum\" "+prp+">0</td>"; } if(gi) { v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+t.p.id+"_"+rowid+"\" class=\"cbox\"/>"; prp = t.formatCol(ni,1,'', null, rowid, true); row[row.length] = "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_cb\" "+prp+">"+v+"</td>"; } if(si) { row[row.length] = $(t).jqGrid("addSubGridCell",gi+ni,1); } for(i = gi+si+ni; i < t.p.colModel.length;i++){ cm = t.p.colModel[i]; nm = cm.name; lcdata[nm] = cm.formatter && typeof(cm.formatter) === 'string' && cm.formatter == 'date' ? $.unformat.date.call(t,data[nm],cm) : data[nm]; v = t.formatter( rowid, $.jgrid.getAccessor(data,nm), i, data, 'edit'); prp = t.formatCol(i,1,v, data, rowid, true); row[row.length] = "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_"+nm+"\" "+prp+">"+v+"</td>"; } row.unshift( t.constructTr(rowid, false, cna, lcdata, lcdata ) ); row[row.length] = "</tr>"; //row = "<tr id=\""+rowid+"\" role=\"row\" tabindex=\"-1\" class=\"ui-widget-content jqgrow ui-row-"+t.p.direction+" "+cna+"\">" + row+"</tr>"; if(t.rows.length === 0){ $("table:first",t.grid.bDiv).append(row.join('')); } else { switch (pos) { case 'last': $(t.rows[t.rows.length-1]).after(row.join('')); sind = t.rows.length-1; break; case 'first': $(t.rows[0]).after(row.join('')); sind = 1; break; case 'after': sind = t.rows.namedItem(src); if (sind) { if($(t.rows[sind.rowIndex+1]).hasClass("ui-subgrid")) { $(t.rows[sind.rowIndex+1]).after(row); } else { $(sind).after(row.join('')); } } sind++; break; case 'before': sind = t.rows.namedItem(src); if(sind) {$(sind).before(row.join(''));sind=sind.rowIndex;} sind--; break; } } if(t.p.subGrid===true) { $(t).jqGrid("addSubGrid",gi+ni, sind); } t.p.records++; t.p.reccount++; $(t).triggerHandler("jqGridAfterInsertRow", [rowid,data,data]); if(air) { t.p.afterInsertRow.call(t,rowid,data,data); } k++; if(t.p.datatype == 'local') { lcdata[t.p.localReader.id] = id; t.p._index[id] = t.p.data.length; t.p.data.push(lcdata); lcdata = {}; } } if( t.p.altRows === true && !aradd) { if (pos == "last") { if ((t.rows.length-1)%2 == 1) {$(t.rows[t.rows.length-1]).addClass(cn);} } else { $(t.rows).each(function(i){ if(i % 2 ==1) { $(this).addClass(cn); } else { $(this).removeClass(cn); } }); } } t.updatepager(true,true); success = true; }); } return success; }, footerData : function(action,data, format) { var nm, success=false, res={}, title; function isEmpty(obj) { for(var i in obj) { if (obj.hasOwnProperty(i)) { return false; } } return true; } if(typeof(action) == "undefined") { action = "get"; } if(typeof(format) != "boolean") { format = true; } action = action.toLowerCase(); this.each(function(){ var t = this, vl; if(!t.grid || !t.p.footerrow) {return false;} if(action == "set") { if(isEmpty(data)) { return false; } } success=true; $(this.p.colModel).each(function(i){ nm = this.name; if(action == "set") { if( data[nm] !== undefined) { vl = format ? t.formatter( "", data[nm], i, data, 'edit') : data[nm]; title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {}; $("tr.footrow td:eq("+i+")",t.grid.sDiv).html(vl).attr(title); success = true; } } else if(action == "get") { res[nm] = $("tr.footrow td:eq("+i+")",t.grid.sDiv).html(); } }); }); return action == "get" ? res : success; }, showHideCol : function(colname,show) { return this.each(function() { var $t = this, fndh=false, brd=$.browser.webkit||$.browser.safari? 0: $t.p.cellLayout, cw; if (!$t.grid ) {return;} if( typeof colname === 'string') {colname=[colname];} show = show != "none" ? "" : "none"; var sw = show === "" ? true :false, gh = $t.p.groupHeader && (typeof $t.p.groupHeader === 'object' || $.isFunction($t.p.groupHeader) ); if(gh) { $($t).jqGrid('destroyGroupHeader', false); } $(this.p.colModel).each(function(i) { if ($.inArray(this.name,colname) !== -1 && this.hidden === sw) { if($t.p.frozenColumns === true && this.frozen === true) { return true; } $("tr",$t.grid.hDiv).each(function(){ $(this.cells[i]).css("display", show); }); $($t.rows).each(function(){ if (!$(this).hasClass("jqgroup")) { $(this.cells[i]).css("display", show); } }); if($t.p.footerrow) { $("tr.footrow td:eq("+i+")", $t.grid.sDiv).css("display", show); } cw = this.widthOrg? this.widthOrg: parseInt(this.width,10); if(show === "none") {$t.p.tblwidth -= cw+brd;} else {$t.p.tblwidth += cw+brd;} this.hidden = !sw; fndh=true; $($t).triggerHandler("jqGridShowHideCol", [sw,this.name,i]); } }); if(fndh===true) { $($t).jqGrid("setGridWidth",$t.p.shrinkToFit === true ? $t.p.tblwidth : $t.p.width ); } if( gh ) { $($t).jqGrid('setGroupHeaders',$t.p.groupHeader); } }); }, hideCol : function (colname) { return this.each(function(){$(this).jqGrid("showHideCol",colname,"none");}); }, showCol : function(colname) { return this.each(function(){$(this).jqGrid("showHideCol",colname,"");}); }, remapColumns : function(permutation, updateCells, keepHeader) { function resortArray(a) { var ac; if (a.length) { ac = $.makeArray(a); } else { ac = $.extend({}, a); } $.each(permutation, function(i) { a[i] = ac[this]; }); } var ts = this.get(0); function resortRows(parent, clobj) { $(">tr"+(clobj||""), parent).each(function() { var row = this; var elems = $.makeArray(row.cells); $.each(permutation, function() { var e = elems[this]; if (e) { row.appendChild(e); } }); }); } resortArray(ts.p.colModel); resortArray(ts.p.colNames); resortArray(ts.grid.headers); resortRows($("thead:first", ts.grid.hDiv), keepHeader && ":not(.ui-jqgrid-labels)"); if (updateCells) { resortRows($("#"+$.jgrid.jqID(ts.p.id)+" tbody:first"), ".jqgfirstrow, tr.jqgrow, tr.jqfoot"); } if (ts.p.footerrow) { resortRows($("tbody:first", ts.grid.sDiv)); } if (ts.p.remapColumns) { if (!ts.p.remapColumns.length){ ts.p.remapColumns = $.makeArray(permutation); } else { resortArray(ts.p.remapColumns); } } ts.p.lastsort = $.inArray(ts.p.lastsort, permutation); if(ts.p.treeGrid) { ts.p.expColInd = $.inArray(ts.p.expColInd, permutation); } $(ts).triggerHandler("jqGridRemapColumns", [permutation, updateCells, keepHeader]); }, setGridWidth : function(nwidth, shrink) { return this.each(function(){ if (!this.grid ) {return;} var $t = this, cw, initwidth = 0, brd=$.browser.webkit||$.browser.safari? 0: $t.p.cellLayout, lvc, vc=0, hs=false, scw=$t.p.scrollOffset, aw, gw=0, cl = 0,cr; if(typeof shrink != 'boolean') { shrink=$t.p.shrinkToFit; } if(isNaN(nwidth)) {return;} else { nwidth = parseInt(nwidth,10); $t.grid.width = $t.p.width = nwidth;} $("#gbox_"+$.jgrid.jqID($t.p.id)).css("width",nwidth+"px"); $("#gview_"+$.jgrid.jqID($t.p.id)).css("width",nwidth+"px"); $($t.grid.bDiv).css("width",nwidth+"px"); $($t.grid.hDiv).css("width",nwidth+"px"); if($t.p.pager ) {$($t.p.pager).css("width",nwidth+"px");} if($t.p.toppager ) {$($t.p.toppager).css("width",nwidth+"px");} if($t.p.toolbar[0] === true){ $($t.grid.uDiv).css("width",nwidth+"px"); if($t.p.toolbar[1]=="both") {$($t.grid.ubDiv).css("width",nwidth+"px");} } if($t.p.footerrow) { $($t.grid.sDiv).css("width",nwidth+"px"); } if(shrink ===false && $t.p.forceFit === true) {$t.p.forceFit=false;} if(shrink===true) { $.each($t.p.colModel, function() { if(this.hidden===false){ cw = this.widthOrg? this.widthOrg: parseInt(this.width,10); initwidth += cw+brd; if(this.fixed) { gw += cw+brd; } else { vc++; } cl++; } }); if(vc === 0) { return; } $t.p.tblwidth = initwidth; aw = nwidth-brd*vc-gw; if(!isNaN($t.p.height)) { if($($t.grid.bDiv)[0].clientHeight < $($t.grid.bDiv)[0].scrollHeight || $t.rows.length === 1){ hs = true; aw -= scw; } } initwidth =0; var cle = $t.grid.cols.length >0; $.each($t.p.colModel, function(i) { if(this.hidden === false && !this.fixed){ cw = this.widthOrg? this.widthOrg: parseInt(this.width,10); cw = Math.round(aw*cw/($t.p.tblwidth-brd*vc-gw)); if (cw < 0) { return; } this.width =cw; initwidth += cw; $t.grid.headers[i].width=cw; $t.grid.headers[i].el.style.width=cw+"px"; if($t.p.footerrow) { $t.grid.footers[i].style.width = cw+"px"; } if(cle) { $t.grid.cols[i].style.width = cw+"px"; } lvc = i; } }); if (!lvc) { return; } cr =0; if (hs) { if(nwidth-gw-(initwidth+brd*vc) !== scw){ cr = nwidth-gw-(initwidth+brd*vc)-scw; } } else if( Math.abs(nwidth-gw-(initwidth+brd*vc)) !== 1) { cr = nwidth-gw-(initwidth+brd*vc); } $t.p.colModel[lvc].width += cr; $t.p.tblwidth = initwidth+cr+brd*vc+gw; if($t.p.tblwidth > nwidth) { var delta = $t.p.tblwidth - parseInt(nwidth,10); $t.p.tblwidth = nwidth; cw = $t.p.colModel[lvc].width = $t.p.colModel[lvc].width-delta; } else { cw= $t.p.colModel[lvc].width; } $t.grid.headers[lvc].width = cw; $t.grid.headers[lvc].el.style.width=cw+"px"; if(cle) { $t.grid.cols[lvc].style.width = cw+"px"; } if($t.p.footerrow) { $t.grid.footers[lvc].style.width = cw+"px"; } } if($t.p.tblwidth) { $('table:first',$t.grid.bDiv).css("width",$t.p.tblwidth+"px"); $('table:first',$t.grid.hDiv).css("width",$t.p.tblwidth+"px"); $t.grid.hDiv.scrollLeft = $t.grid.bDiv.scrollLeft; if($t.p.footerrow) { $('table:first',$t.grid.sDiv).css("width",$t.p.tblwidth+"px"); } } }); }, setGridHeight : function (nh) { return this.each(function (){ var $t = this; if(!$t.grid) {return;} var bDiv = $($t.grid.bDiv); bDiv.css({height: nh+(isNaN(nh)?"":"px")}); if($t.p.frozenColumns === true){ //follow the original set height to use 16, better scrollbar width detection $('#'+$.jgrid.jqID($t.p.id)+"_frozen").parent().height(bDiv.height() - 16); } $t.p.height = nh; if ($t.p.scroll) { $t.grid.populateVisible(); } }); }, setCaption : function (newcap){ return this.each(function(){ this.p.caption=newcap; $("span.ui-jqgrid-title, span.ui-jqgrid-title-rtl",this.grid.cDiv).html(newcap); $(this.grid.cDiv).show(); }); }, setLabel : function(colname, nData, prop, attrp ){ return this.each(function(){ var $t = this, pos=-1; if(!$t.grid) {return;} if(typeof(colname) != "undefined") { $($t.p.colModel).each(function(i){ if (this.name == colname) { pos = i;return false; } }); } else { return; } if(pos>=0) { var thecol = $("tr.ui-jqgrid-labels th:eq("+pos+")",$t.grid.hDiv); if (nData){ var ico = $(".s-ico",thecol); $("[id^=jqgh_]",thecol).empty().html(nData).append(ico); $t.p.colNames[pos] = nData; } if (prop) { if(typeof prop === 'string') {$(thecol).addClass(prop);} else {$(thecol).css(prop);} } if(typeof attrp === 'object') {$(thecol).attr(attrp);} } }); }, setCell : function(rowid,colname,nData,cssp,attrp, forceupd) { return this.each(function(){ var $t = this, pos =-1,v, title; if(!$t.grid) {return;} if(isNaN(colname)) { $($t.p.colModel).each(function(i){ if (this.name == colname) { pos = i;return false; } }); } else {pos = parseInt(colname,10);} if(pos>=0) { var ind = $t.rows.namedItem(rowid); if (ind){ var tcell = $("td:eq("+pos+")",ind); if(nData !== "" || forceupd === true) { v = $t.formatter(rowid, nData, pos,ind,'edit'); title = $t.p.colModel[pos].title ? {"title":$.jgrid.stripHtml(v)} : {}; if($t.p.treeGrid && $(".tree-wrap",$(tcell)).length>0) { $("span",$(tcell)).html(v).attr(title); } else { $(tcell).html(v).attr(title); } if($t.p.datatype == "local") { var cm = $t.p.colModel[pos], index; nData = cm.formatter && typeof(cm.formatter) === 'string' && cm.formatter == 'date' ? $.unformat.date.call($t,nData,cm) : nData; index = $t.p._index[rowid]; if(typeof index != "undefined") { $t.p.data[index][cm.name] = nData; } } } if(typeof cssp === 'string'){ $(tcell).addClass(cssp); } else if(cssp) { $(tcell).css(cssp); } if(typeof attrp === 'object') {$(tcell).attr(attrp);} } } }); }, getCell : function(rowid,col) { var ret = false; this.each(function(){ var $t=this, pos=-1; if(!$t.grid) {return;} if(isNaN(col)) { $($t.p.colModel).each(function(i){ if (this.name === col) { pos = i;return false; } }); } else {pos = parseInt(col,10);} if(pos>=0) { var ind = $t.rows.namedItem(rowid); if(ind) { try { ret = $.unformat.call($t,$("td:eq("+pos+")",ind),{rowId:ind.id, colModel:$t.p.colModel[pos]},pos); } catch (e){ ret = $.jgrid.htmlDecode($("td:eq("+pos+")",ind).html()); } } } }); return ret; }, getCol : function (col, obj, mathopr) { var ret = [], val, sum=0, min, max, v; obj = typeof (obj) != 'boolean' ? false : obj; if(typeof mathopr == 'undefined') { mathopr = false; } this.each(function(){ var $t=this, pos=-1; if(!$t.grid) {return;} if(isNaN(col)) { $($t.p.colModel).each(function(i){ if (this.name === col) { pos = i;return false; } }); } else {pos = parseInt(col,10);} if(pos>=0) { var ln = $t.rows.length, i =0; if (ln && ln>0){ while(i<ln){ if($($t.rows[i]).hasClass('jqgrow')) { try { val = $.unformat.call($t,$($t.rows[i].cells[pos]),{rowId:$t.rows[i].id, colModel:$t.p.colModel[pos]},pos); } catch (e) { val = $.jgrid.htmlDecode($t.rows[i].cells[pos].innerHTML); } if(mathopr) { v = parseFloat(val); sum += v; if(i===0) { min = v; max = v; } else { min = Math.min(min, v); max = Math.max(max, v); } } else if(obj) { ret.push( {id:$t.rows[i].id,value:val} ); } else { ret.push( val ); } } i++; } if(mathopr) { switch(mathopr.toLowerCase()){ case 'sum': ret =sum; break; case 'avg': ret = sum/ln; break; case 'count': ret = ln; break; case 'min': ret = min; break; case 'max': ret = max; break; } } } } }); return ret; }, clearGridData : function(clearfooter) { return this.each(function(){ var $t = this; if(!$t.grid) {return;} if(typeof clearfooter != 'boolean') { clearfooter = false; } if($t.p.deepempty) {$("#"+$.jgrid.jqID($t.p.id)+" tbody:first tr:gt(0)").remove();} else { var trf = $("#"+$.jgrid.jqID($t.p.id)+" tbody:first tr:first")[0]; $("#"+$.jgrid.jqID($t.p.id)+" tbody:first").empty().append(trf); } if($t.p.footerrow && clearfooter) { $(".ui-jqgrid-ftable td",$t.grid.sDiv).html("&#160;"); } $t.p.selrow = null; $t.p.selarrrow= []; $t.p.savedRow = []; $t.p.records = 0;$t.p.page=1;$t.p.lastpage=0;$t.p.reccount=0; $t.p.data = []; $t.p._index = {}; $t.updatepager(true,false); }); }, getInd : function(rowid,rc){ var ret =false,rw; this.each(function(){ rw = this.rows.namedItem(rowid); if(rw) { ret = rc===true ? rw: rw.rowIndex; } }); return ret; }, bindKeys : function( settings ){ var o = $.extend({ onEnter: null, onSpace: null, onLeftKey: null, onRightKey: null, scrollingRows : true },settings || {}); return this.each(function(){ var $t = this; if( !$('body').is('[role]') ){$('body').attr('role','application');} $t.p.scrollrows = o.scrollingRows; $($t).keydown(function(event){ var target = $($t).find('tr[tabindex=0]')[0], id, r, mind, expanded = $t.p.treeReader.expanded_field; //check for arrow keys if(target) { mind = $t.p._index[target.id]; if(event.keyCode === 37 || event.keyCode === 38 || event.keyCode === 39 || event.keyCode === 40){ // up key if(event.keyCode === 38 ){ r = target.previousSibling; id = ""; if(r) { if($(r).is(":hidden")) { while(r) { r = r.previousSibling; if(!$(r).is(":hidden") && $(r).hasClass('jqgrow')) {id = r.id;break;} } } else { id = r.id; } } $($t).jqGrid('setSelection', id, true, event); } //if key is down arrow if(event.keyCode === 40){ r = target.nextSibling; id =""; if(r) { if($(r).is(":hidden")) { while(r) { r = r.nextSibling; if(!$(r).is(":hidden") && $(r).hasClass('jqgrow') ) {id = r.id;break;} } } else { id = r.id; } } $($t).jqGrid('setSelection', id, true, event); } // left if(event.keyCode === 37 ){ if($t.p.treeGrid && $t.p.data[mind][expanded]) { $(target).find("div.treeclick").trigger('click'); } $($t).triggerHandler("jqGridKeyLeft", [$t.p.selrow]); if($.isFunction(o.onLeftKey)) { o.onLeftKey.call($t, $t.p.selrow); } } // right if(event.keyCode === 39 ){ if($t.p.treeGrid && !$t.p.data[mind][expanded]) { $(target).find("div.treeclick").trigger('click'); } $($t).triggerHandler("jqGridKeyRight", [$t.p.selrow]); if($.isFunction(o.onRightKey)) { o.onRightKey.call($t, $t.p.selrow); } } } //check if enter was pressed on a grid or treegrid node else if( event.keyCode === 13 ){ $($t).triggerHandler("jqGridKeyEnter", [$t.p.selrow]); if($.isFunction(o.onEnter)) { o.onEnter.call($t, $t.p.selrow); } } else if(event.keyCode === 32) { $($t).triggerHandler("jqGridKeySpace", [$t.p.selrow]); if($.isFunction(o.onSpace)) { o.onSpace.call($t, $t.p.selrow); } } } }); }); }, unbindKeys : function(){ return this.each(function(){ $(this).unbind('keydown'); }); }, getLocalRow : function (rowid) { var ret = false, ind; this.each(function(){ if(typeof(rowid) !== "undefined") { ind = this.p._index[rowid]; if(ind >= 0 ) { ret = this.p.data[ind]; } } }); return ret; } }); })(jQuery); (function($){ /** * jqGrid extension for custom methods * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * * Wildraid wildraid@mail.ru * Oleg Kiriljuk oleg.kiriljuk@ok-soft-gmbh.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html **/ /*global jQuery, $ */ "use strict"; $.jgrid.extend({ getColProp : function(colname){ var ret ={}, $t = this[0]; if ( !$t.grid ) { return false; } var cM = $t.p.colModel; for ( var i =0;i<cM.length;i++ ) { if ( cM[i].name == colname ) { ret = cM[i]; break; } } return ret; }, setColProp : function(colname, obj){ //do not set width will not work return this.each(function(){ if ( this.grid ) { if ( obj ) { var cM = this.p.colModel; for ( var i =0;i<cM.length;i++ ) { if ( cM[i].name == colname ) { $.extend(this.p.colModel[i],obj); break; } } } } }); }, sortGrid : function(colname,reload, sor){ return this.each(function(){ var $t=this,idx=-1; if ( !$t.grid ) { return;} if ( !colname ) { colname = $t.p.sortname; } for ( var i=0;i<$t.p.colModel.length;i++ ) { if ( $t.p.colModel[i].index == colname || $t.p.colModel[i].name==colname ) { idx = i; break; } } if ( idx!=-1 ){ var sort = $t.p.colModel[idx].sortable; if ( typeof sort !== 'boolean' ) { sort = true; } if ( typeof reload !=='boolean' ) { reload = false; } if ( sort ) { $t.sortData("jqgh_"+$t.p.id+"_" + colname, idx, reload, sor); } } }); }, GridDestroy : function () { return this.each(function(){ if ( this.grid ) { if ( this.p.pager ) { // if not part of grid $(this.p.pager).remove(); } try { $("#gbox_"+$.jgrid.jqID(this.id)).remove(); } catch (_) {} } }); }, GridUnload : function(){ return this.each(function(){ if ( !this.grid ) {return;} var defgrid = {id: $(this).attr('id'),cl: $(this).attr('class')}; if (this.p.pager) { $(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom"); } var newtable = document.createElement('table'); $(newtable).attr({id:defgrid.id}); newtable.className = defgrid.cl; var gid = $.jgrid.jqID(this.id); $(newtable).removeClass("ui-jqgrid-btable"); if( $(this.p.pager).parents("#gbox_"+gid).length === 1 ) { $(newtable).insertBefore("#gbox_"+gid).show(); $(this.p.pager).insertBefore("#gbox_"+gid); } else { $(newtable).insertBefore("#gbox_"+gid).show(); } $("#gbox_"+gid).remove(); }); }, setGridState : function(state) { return this.each(function(){ if ( !this.grid ) {return;} var $t = this; if(state == 'hidden'){ $(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+$.jgrid.jqID($t.p.id)).slideUp("fast"); if($t.p.pager) {$($t.p.pager).slideUp("fast");} if($t.p.toppager) {$($t.p.toppager).slideUp("fast");} if($t.p.toolbar[0]===true) { if( $t.p.toolbar[1]=='both') { $($t.grid.ubDiv).slideUp("fast"); } $($t.grid.uDiv).slideUp("fast"); } if($t.p.footerrow) { $(".ui-jqgrid-sdiv","#gbox_"+$.jgrid.jqID($t.p.id)).slideUp("fast"); } $(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"); $t.p.gridstate = 'hidden'; } else if(state=='visible') { $(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+$.jgrid.jqID($t.p.id)).slideDown("fast"); if($t.p.pager) {$($t.p.pager).slideDown("fast");} if($t.p.toppager) {$($t.p.toppager).slideDown("fast");} if($t.p.toolbar[0]===true) { if( $t.p.toolbar[1]=='both') { $($t.grid.ubDiv).slideDown("fast"); } $($t.grid.uDiv).slideDown("fast"); } if($t.p.footerrow) { $(".ui-jqgrid-sdiv","#gbox_"+$.jgrid.jqID($t.p.id)).slideDown("fast"); } $(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"); $t.p.gridstate = 'visible'; } }); }, filterToolbar : function(p){ p = $.extend({ autosearch: true, searchOnEnter : true, beforeSearch: null, afterSearch: null, beforeClear: null, afterClear: null, searchurl : '', stringResult: false, groupOp: 'AND', defaultSearch : "bw" },p || {}); return this.each(function(){ var $t = this; if(this.ftoolbar) { return; } var triggerToolbar = function() { var sdata={}, j=0, v, nm, sopt={},so; $.each($t.p.colModel,function(){ nm = this.index || this.name; so = (this.searchoptions && this.searchoptions.sopt) ? this.searchoptions.sopt[0] : this.stype=='select'? 'eq' : p.defaultSearch; v = $("#gs_"+$.jgrid.jqID(this.name), (this.frozen===true && $t.p.frozenColumns === true) ? $t.grid.fhDiv : $t.grid.hDiv).val(); if(v) { sdata[nm] = v; sopt[nm] = so; j++; } else { try { delete $t.p.postData[nm]; } catch (z) {} } }); var sd = j>0 ? true : false; if(p.stringResult === true || $t.p.datatype == "local") { var ruleGroup = "{\"groupOp\":\"" + p.groupOp + "\",\"rules\":["; var gi=0; $.each(sdata,function(i,n){ if (gi > 0) {ruleGroup += ",";} ruleGroup += "{\"field\":\"" + i + "\","; ruleGroup += "\"op\":\"" + sopt[i] + "\","; n+=""; ruleGroup += "\"data\":\"" + n.replace(/\\/g,'\\\\').replace(/\"/g,'\\"') + "\"}"; gi++; }); ruleGroup += "]}"; $.extend($t.p.postData,{filters:ruleGroup}); $.each(['searchField', 'searchString', 'searchOper'], function(i, n){ if($t.p.postData.hasOwnProperty(n)) { delete $t.p.postData[n];} }); } else { $.extend($t.p.postData,sdata); } var saveurl; if($t.p.searchurl) { saveurl = $t.p.url; $($t).jqGrid("setGridParam",{url:$t.p.searchurl}); } var bsr = $($t).triggerHandler("jqGridToolbarBeforeSearch") === 'stop' ? true : false; if(!bsr && $.isFunction(p.beforeSearch)){bsr = p.beforeSearch.call($t);} if(!bsr) { $($t).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]); } if(saveurl) {$($t).jqGrid("setGridParam",{url:saveurl});} $($t).triggerHandler("jqGridToolbarAfterSearch"); if($.isFunction(p.afterSearch)){p.afterSearch();} }; var clearToolbar = function(trigger){ var sdata={}, j=0, nm; trigger = (typeof trigger != 'boolean') ? true : trigger; $.each($t.p.colModel,function(){ var v; if(this.searchoptions && this.searchoptions.defaultValue !== undefined) { v = this.searchoptions.defaultValue; } nm = this.index || this.name; switch (this.stype) { case 'select' : $("#gs_"+$.jgrid.jqID(this.name)+" option",(this.frozen===true && $t.p.frozenColumns === true) ? $t.grid.fhDiv : $t.grid.hDiv).each(function (i){ if(i===0) { this.selected = true; } if ($(this).val() == v) { this.selected = true; return false; } }); if ( v !== undefined ) { // post the key and not the text sdata[nm] = v; j++; } else { try { delete $t.p.postData[nm]; } catch(e) {} } break; case 'text': $("#gs_"+$.jgrid.jqID(this.name),(this.frozen===true && $t.p.frozenColumns === true) ? $t.grid.fhDiv : $t.grid.hDiv).val(v); if(v !== undefined) { sdata[nm] = v; j++; } else { try { delete $t.p.postData[nm]; } catch (y){} } break; } }); var sd = j>0 ? true : false; if(p.stringResult === true || $t.p.datatype == "local") { var ruleGroup = "{\"groupOp\":\"" + p.groupOp + "\",\"rules\":["; var gi=0; $.each(sdata,function(i,n){ if (gi > 0) {ruleGroup += ",";} ruleGroup += "{\"field\":\"" + i + "\","; ruleGroup += "\"op\":\"" + "eq" + "\","; n+=""; ruleGroup += "\"data\":\"" + n.replace(/\\/g,'\\\\').replace(/\"/g,'\\"') + "\"}"; gi++; }); ruleGroup += "]}"; $.extend($t.p.postData,{filters:ruleGroup}); $.each(['searchField', 'searchString', 'searchOper'], function(i, n){ if($t.p.postData.hasOwnProperty(n)) { delete $t.p.postData[n];} }); } else { $.extend($t.p.postData,sdata); } var saveurl; if($t.p.searchurl) { saveurl = $t.p.url; $($t).jqGrid("setGridParam",{url:$t.p.searchurl}); } var bcv = $($t).triggerHandler("jqGridToolbarBeforeClear") === 'stop' ? true : false; if(!bcv && $.isFunction(p.beforeClear)){bcv = p.beforeClear.call($t);} if(!bcv) { if(trigger) { $($t).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]); } } if(saveurl) {$($t).jqGrid("setGridParam",{url:saveurl});} $($t).triggerHandler("jqGridToolbarAfterClear"); if($.isFunction(p.afterClear)){p.afterClear();} }; var toggleToolbar = function(){ var trow = $("tr.ui-search-toolbar",$t.grid.hDiv), trow2 = $t.p.frozenColumns === true ? $("tr.ui-search-toolbar",$t.grid.fhDiv) : false; if(trow.css("display")=='none') { trow.show(); if(trow2) { trow2.show(); } } else { trow.hide(); if(trow2) { trow2.hide(); } } }; // create the row function bindEvents(selector, events) { var jElem = $(selector); if (jElem[0]) { jQuery.each(events, function() { if (this.data !== undefined) { jElem.bind(this.type, this.data, this.fn); } else { jElem.bind(this.type, this.fn); } }); } } var tr = $("<tr class='ui-search-toolbar' role='rowheader'></tr>"); var timeoutHnd; $.each($t.p.colModel,function(){ var cm=this, thd , th, soptions,surl,self; th = $("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+$t.p.direction+"'></th>"); thd = $("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>"); if(this.hidden===true) { $(th).css("display","none");} this.search = this.search === false ? false : true; if(typeof this.stype == 'undefined' ) {this.stype='text';} soptions = $.extend({},this.searchoptions || {}); if(this.search){ switch (this.stype) { case "select": surl = this.surl || soptions.dataUrl; if(surl) { // data returned should have already constructed html select // primitive jQuery load self = thd; $.ajax($.extend({ url: surl, dataType: "html", success: function(res) { if(soptions.buildSelect !== undefined) { var d = soptions.buildSelect(res); if (d) { $(self).append(d); } } else { $(self).append(res); } if(soptions.defaultValue !== undefined) { $("select",self).val(soptions.defaultValue); } $("select",self).attr({name:cm.index || cm.name, id: "gs_"+cm.name}); if(soptions.attr) {$("select",self).attr(soptions.attr);} $("select",self).css({width: "100%"}); // preserve autoserch if(soptions.dataInit !== undefined) { soptions.dataInit($("select",self)[0]); } if(soptions.dataEvents !== undefined) { bindEvents($("select",self)[0],soptions.dataEvents); } if(p.autosearch===true){ $("select",self).change(function(){ triggerToolbar(); return false; }); } res=null; } }, $.jgrid.ajaxOptions, $t.p.ajaxSelectOptions || {} )); } else { var oSv, sep, delim; if(cm.searchoptions) { oSv = cm.searchoptions.value === undefined ? "" : cm.searchoptions.value; sep = cm.searchoptions.separator === undefined ? ":" : cm.searchoptions.separator; delim = cm.searchoptions.delimiter === undefined ? ";" : cm.searchoptions.delimiter; } else if(cm.editoptions) { oSv = cm.editoptions.value === undefined ? "" : cm.editoptions.value; sep = cm.editoptions.separator === undefined ? ":" : cm.editoptions.separator; delim = cm.editoptions.delimiter === undefined ? ";" : cm.editoptions.delimiter; } if (oSv) { var elem = document.createElement("select"); elem.style.width = "100%"; $(elem).attr({name:cm.index || cm.name, id: "gs_"+cm.name}); var so, sv, ov; if(typeof oSv === "string") { so = oSv.split(delim); for(var k=0; k<so.length;k++){ sv = so[k].split(sep); ov = document.createElement("option"); ov.value = sv[0]; ov.innerHTML = sv[1]; elem.appendChild(ov); } } else if(typeof oSv === "object" ) { for ( var key in oSv) { if(oSv.hasOwnProperty(key)) { ov = document.createElement("option"); ov.value = key; ov.innerHTML = oSv[key]; elem.appendChild(ov); } } } if(soptions.defaultValue !== undefined) { $(elem).val(soptions.defaultValue); } if(soptions.attr) {$(elem).attr(soptions.attr);} if(soptions.dataInit !== undefined) { soptions.dataInit(elem); } if(soptions.dataEvents !== undefined) { bindEvents(elem, soptions.dataEvents); } $(thd).append(elem); if(p.autosearch===true){ $(elem).change(function(){ triggerToolbar(); return false; }); } } } break; case 'text': var df = soptions.defaultValue !== undefined ? soptions.defaultValue: ""; $(thd).append("<input type='text' style='width:95%;padding:0px;' name='"+(cm.index || cm.name)+"' id='gs_"+cm.name+"' value='"+df+"'/>"); if(soptions.attr) {$("input",thd).attr(soptions.attr);} if(soptions.dataInit !== undefined) { soptions.dataInit($("input",thd)[0]); } if(soptions.dataEvents !== undefined) { bindEvents($("input",thd)[0], soptions.dataEvents); } if(p.autosearch===true){ if(p.searchOnEnter) { $("input",thd).keypress(function(e){ var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; if(key == 13){ triggerToolbar(); return false; } return this; }); } else { $("input",thd).keydown(function(e){ var key = e.which; switch (key) { case 13: return false; case 9 : case 16: case 37: case 38: case 39: case 40: case 27: break; default : if(timeoutHnd) { clearTimeout(timeoutHnd); } timeoutHnd = setTimeout(function(){triggerToolbar();},500); } }); } } break; } } $(th).append(thd); $(tr).append(th); }); $("table thead",$t.grid.hDiv).append(tr); this.ftoolbar = true; this.triggerToolbar = triggerToolbar; this.clearToolbar = clearToolbar; this.toggleToolbar = toggleToolbar; }); }, destroyGroupHeader : function(nullHeader) { if(typeof(nullHeader) == 'undefined') { nullHeader = true; } return this.each(function() { var $t = this, $tr, i, l, headers, $th, $resizing, grid = $t.grid, thead = $("table.ui-jqgrid-htable thead", grid.hDiv), cm = $t.p.colModel, hc; if(!grid) { return; } $(this).unbind('.setGroupHeaders'); $tr = $("<tr>", {role: "rowheader"}).addClass("ui-jqgrid-labels"); headers = grid.headers; for (i = 0, l = headers.length; i < l; i++) { hc = cm[i].hidden ? "none" : ""; $th = $(headers[i].el) .width(headers[i].width) .css('display',hc); try { $th.removeAttr("rowSpan"); } catch (rs) { //IE 6/7 $th.attr("rowSpan",1); } $tr.append($th); $resizing = $th.children("span.ui-jqgrid-resize"); if ($resizing.length>0) {// resizable column $resizing[0].style.height = ""; } $th.children("div")[0].style.top = ""; } $(thead).children('tr.ui-jqgrid-labels').remove(); $(thead).prepend($tr); if(nullHeader === true) { $($t).jqGrid('setGridParam',{ 'groupHeader': null}); } }); }, setGroupHeaders : function ( o ) { o = $.extend({ useColSpanStyle : false, groupHeaders: [] },o || {}); return this.each(function(){ this.p.groupHeader = o; var ts = this, i, cmi, skip = 0, $tr, $colHeader, th, $th, thStyle, iCol, cghi, //startColumnName, numberOfColumns, titleText, cVisibleColumns, colModel = ts.p.colModel, cml = colModel.length, ths = ts.grid.headers, $htable = $("table.ui-jqgrid-htable", ts.grid.hDiv), $trLabels = $htable.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header"), $thead = $htable.children("thead"), $theadInTable, $firstHeaderRow = $htable.find(".jqg-first-row-header"); if($firstHeaderRow.html() === null) { $firstHeaderRow = $('<tr>', {role: "row", "aria-hidden": "true"}).addClass("jqg-first-row-header").css("height", "auto"); } else { $firstHeaderRow.empty(); } var $firstRow, inColumnHeader = function (text, columnHeaders) { var i = 0, length = columnHeaders.length; for (; i < length; i++) { if (columnHeaders[i].startColumnName === text) { return i; } } return -1; }; $(ts).prepend($thead); $tr = $('<tr>', {role: "rowheader"}).addClass("ui-jqgrid-labels jqg-third-row-header"); for (i = 0; i < cml; i++) { th = ths[i].el; $th = $(th); cmi = colModel[i]; // build the next cell for the first header row thStyle = { height: '0px', width: ths[i].width + 'px', display: (cmi.hidden ? 'none' : '')}; $("<th>", {role: 'gridcell'}).css(thStyle).addClass("ui-first-th-"+ts.p.direction).appendTo($firstHeaderRow); th.style.width = ""; // remove unneeded style iCol = inColumnHeader(cmi.name, o.groupHeaders); if (iCol >= 0) { cghi = o.groupHeaders[iCol]; numberOfColumns = cghi.numberOfColumns; titleText = cghi.titleText; // caclulate the number of visible columns from the next numberOfColumns columns for (cVisibleColumns = 0, iCol = 0; iCol < numberOfColumns && (i + iCol < cml); iCol++) { if (!colModel[i + iCol].hidden) { cVisibleColumns++; } } // The next numberOfColumns headers will be moved in the next row // in the current row will be placed the new column header with the titleText. // The text will be over the cVisibleColumns columns $colHeader = $('<th>').attr({role: "columnheader"}) .addClass("ui-state-default ui-th-column-header ui-th-"+ts.p.direction) .css({'height':'22px', 'border-top': '0px none'}) .html(titleText); if(cVisibleColumns > 0) { $colHeader.attr("colspan", String(cVisibleColumns)); } if (ts.p.headertitles) { $colHeader.attr("title", $colHeader.text()); } // hide if not a visible cols if( cVisibleColumns === 0) { $colHeader.hide(); } $th.before($colHeader); // insert new column header before the current $tr.append(th); // move the current header in the next row // set the coumter of headers which will be moved in the next row skip = numberOfColumns - 1; } else { if (skip === 0) { if (o.useColSpanStyle) { // expand the header height to two rows $th.attr("rowspan", "2"); } else { $('<th>', {role: "columnheader"}) .addClass("ui-state-default ui-th-column-header ui-th-"+ts.p.direction) .css({"display": cmi.hidden ? 'none' : '', 'border-top': '0px none'}) .insertBefore($th); $tr.append(th); } } else { // move the header to the next row //$th.css({"padding-top": "2px", height: "19px"}); $tr.append(th); skip--; } } } $theadInTable = $(ts).children("thead"); $theadInTable.prepend($firstHeaderRow); $tr.insertAfter($trLabels); $htable.append($theadInTable); if (o.useColSpanStyle) { // Increase the height of resizing span of visible headers $htable.find("span.ui-jqgrid-resize").each(function () { var $parent = $(this).parent(); if ($parent.is(":visible")) { this.style.cssText = 'height: ' + $parent.height() + 'px !important; cursor: col-resize;'; } }); // Set position of the sortable div (the main lable) // with the column header text to the middle of the cell. // One should not do this for hidden headers. $htable.find("div.ui-jqgrid-sortable").each(function () { var $ts = $(this), $parent = $ts.parent(); if ($parent.is(":visible") && $parent.is(":has(span.ui-jqgrid-resize)")) { $ts.css('top', ($parent.height() - $ts.outerHeight()) / 2 + 'px'); } }); } $firstRow = $theadInTable.find("tr.jqg-first-row-header"); $(ts).bind('jqGridResizeStop.setGroupHeaders', function (e, nw, idx) { $firstRow.find('th').eq(idx).width(nw); }); }); }, setFrozenColumns : function () { return this.each(function() { if ( !this.grid ) {return;} var $t = this, cm = $t.p.colModel,i=0, len = cm.length, maxfrozen = -1, frozen= false; // TODO treeGrid and grouping Support if($t.p.subGrid === true || $t.p.treeGrid === true || $t.p.cellEdit === true || $t.p.sortable || $t.p.scroll || $t.p.grouping ) { return; } if($t.p.rownumbers) { i++; } if($t.p.multiselect) { i++; } // get the max index of frozen col while(i<len) { // from left, no breaking frozen if(cm[i].frozen === true) { frozen = true; maxfrozen = i; } else { break; } i++; } if( maxfrozen>=0 && frozen) { var top = $t.p.caption ? $($t.grid.cDiv).outerHeight() : 0, hth = $(".ui-jqgrid-htable","#gview_"+$.jgrid.jqID($t.p.id)).height(); //headers if($t.p.toppager) { top = top + $($t.grid.topDiv).outerHeight(); } if($t.p.toolbar[0] === true) { if($t.p.toolbar[1] != "bottom") { top = top + $($t.grid.uDiv).outerHeight(); } } $t.grid.fhDiv = $('<div style="position:absolute;left:0px;top:'+top+'px;height:'+hth+'px;" class="frozen-div ui-state-default ui-jqgrid-hdiv"></div>'); $t.grid.fbDiv = $('<div style="position:absolute;left:0px;top:'+(parseInt(top,10)+parseInt(hth,10) + 1)+'px;overflow-y:hidden" class="frozen-bdiv ui-jqgrid-bdiv"></div>'); $("#gview_"+$.jgrid.jqID($t.p.id)).append($t.grid.fhDiv); var htbl = $(".ui-jqgrid-htable","#gview_"+$.jgrid.jqID($t.p.id)).clone(true); // groupheader support - only if useColSpanstyle is false if($t.p.groupHeader) { $("tr.jqg-first-row-header, tr.jqg-third-row-header", htbl).each(function(){ $("th:gt("+maxfrozen+")",this).remove(); }); var swapfroz = -1, fdel = -1; $("tr.jqg-second-row-header th", htbl).each(function(){ var cs= parseInt($(this).attr("colspan"),10); if(cs) { swapfroz = swapfroz+cs; fdel++; } if(swapfroz === maxfrozen) { return false; } }); if(swapfroz !== maxfrozen) { fdel = maxfrozen; } $("tr.jqg-second-row-header", htbl).each(function(){ $("th:gt("+fdel+")",this).remove(); }); } else { $("tr",htbl).each(function(){ $("th:gt("+maxfrozen+")",this).remove(); }); } $(htbl).width(1); // resizing stuff $($t.grid.fhDiv).append(htbl) .mousemove(function (e) { if($t.grid.resizing){ $t.grid.dragMove(e);return false; } }); $($t).bind('jqGridResizeStop.setFrozenColumns', function (e, w, index) { var rhth = $(".ui-jqgrid-htable",$t.grid.fhDiv); $("th:eq("+index+")",rhth).width( w ); var btd = $(".ui-jqgrid-btable",$t.grid.fbDiv); $("tr:first td:eq("+index+")",btd).width( w ); }); // sorting stuff $($t).bind('jqGridOnSortCol.setFrozenColumns', function (index, idxcol) { var previousSelectedTh = $("tr.ui-jqgrid-labels:last th:eq("+$t.p.lastsort+")",$t.grid.fhDiv), newSelectedTh = $("tr.ui-jqgrid-labels:last th:eq("+idxcol+")",$t.grid.fhDiv); $("span.ui-grid-ico-sort",previousSelectedTh).addClass('ui-state-disabled'); $(previousSelectedTh).attr("aria-selected","false"); $("span.ui-icon-"+$t.p.sortorder,newSelectedTh).removeClass('ui-state-disabled'); $(newSelectedTh).attr("aria-selected","true"); if(!$t.p.viewsortcols[0]) { if($t.p.lastsort != idxcol) { $("span.s-ico",previousSelectedTh).hide(); $("span.s-ico",newSelectedTh).show(); } } }); // data stuff //TODO support for setRowData $("#gview_"+$.jgrid.jqID($t.p.id)).append($t.grid.fbDiv); jQuery($t.grid.bDiv).scroll(function () { jQuery($t.grid.fbDiv).scrollTop(jQuery(this).scrollTop()); }); if($t.p.hoverrows === true) { $("#"+$.jgrid.jqID($t.p.id)).unbind('mouseover').unbind('mouseout'); } $($t).bind('jqGridAfterGridComplete.setFrozenColumns', function () { $("#"+$.jgrid.jqID($t.p.id)+"_frozen").remove(); jQuery($t.grid.fbDiv).height( jQuery($t.grid.bDiv).height()-16); var btbl = $("#"+$.jgrid.jqID($t.p.id)).clone(true); $("tr",btbl).each(function(){ $("td:gt("+maxfrozen+")",this).remove(); }); $(btbl).width(1).attr("id",$t.p.id+"_frozen"); $($t.grid.fbDiv).append(btbl); if($t.p.hoverrows === true) { $("tr.jqgrow", btbl).hover( function(){ $(this).addClass("ui-state-hover"); $("#"+$.jgrid.jqID(this.id), "#"+$.jgrid.jqID($t.p.id)).addClass("ui-state-hover"); }, function(){ $(this).removeClass("ui-state-hover"); $("#"+$.jgrid.jqID(this.id), "#"+$.jgrid.jqID($t.p.id)).removeClass("ui-state-hover"); } ); $("tr.jqgrow", "#"+$.jgrid.jqID($t.p.id)).hover( function(){ $(this).addClass("ui-state-hover"); $("#"+$.jgrid.jqID(this.id), "#"+$.jgrid.jqID($t.p.id)+"_frozen").addClass("ui-state-hover");}, function(){ $(this).removeClass("ui-state-hover"); $("#"+$.jgrid.jqID(this.id), "#"+$.jgrid.jqID($t.p.id)+"_frozen").removeClass("ui-state-hover"); } ); } btbl=null; }); $t.p.frozenColumns = true; } }); }, destroyFrozenColumns : function() { return this.each(function() { if ( !this.grid ) {return;} if(this.p.frozenColumns === true) { var $t = this; $($t.grid.fhDiv).remove(); $($t.grid.fbDiv).remove(); $t.grid.fhDiv = null; $t.grid.fbDiv=null; $(this).unbind('.setFrozenColumns'); if($t.p.hoverrows === true) { var ptr; $("#"+$.jgrid.jqID($t.p.id)).bind('mouseover',function(e) { ptr = $(e.target).closest("tr.jqgrow"); if($(ptr).attr("class") !== "ui-subgrid") { $(ptr).addClass("ui-state-hover"); } }).bind('mouseout',function(e) { ptr = $(e.target).closest("tr.jqgrow"); $(ptr).removeClass("ui-state-hover"); }); } this.p.frozenColumns = false; } }); } }); })(jQuery);/* * jqModal - Minimalist Modaling with jQuery * (http://dev.iceburg.net/jquery/jqmodal/) * * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net> * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * $Version: 07/06/2008 +r13 */ (function($) { $.fn.jqm=function(o){ var p={ overlay: 50, closeoverlay : true, overlayClass: 'jqmOverlay', closeClass: 'jqmClose', trigger: '.jqModal', ajax: F, ajaxText: '', target: F, modal: F, toTop: F, onShow: F, onHide: F, onLoad: F }; return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s; H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s}; if(p.trigger)$(this).jqmAddTrigger(p.trigger); });}; $.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');}; $.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');}; $.fn.jqmShow=function(t){return this.each(function(){$.jqm.open(this._jqm,t);});}; $.fn.jqmHide=function(t){return this.each(function(){$.jqm.close(this._jqm,t)});}; $.jqm = { hash:{}, open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index')));z=(z>0)?z:3000;var o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z); if(c.modal) {if(!A[0])setTimeout(function(){L('bind');},1);A.push(s);} else if(c.overlay > 0) {if(c.closeoverlay) h.w.jqmAddClose(o);} else o=F; h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F; if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}} if(c.ajax) {var r=c.target||h.w,u=c.ajax;r=(typeof r == 'string')?$(r,h.w):$(r);u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});} else if(cc)h.w.jqmAddClose($(cc,h.w)); if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o); (c.onShow)?c.onShow(h):h.w.show();e(h);return F; }, close:function(s){var h=H[s];if(!h.a)return F;h.a=F; if(A[0]){A.pop();if(!A[0])L('unbind');} if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove(); if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F; }, params:{}}; var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false, e=function(h){var i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);}, f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}}, L=function(t){$(document)[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;}, hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() { if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});}; })(jQuery);/* * jqDnR - Minimalistic Drag'n'Resize for jQuery. * * Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php * * $Version: 2007.08.19 +r2 */ (function($){ $.fn.jqDrag=function(h){return i(this,h,'d');}; $.fn.jqResize=function(h,ar){return i(this,h,'r',ar);}; $.jqDnR={ dnr:{}, e:0, drag:function(v){ if(M.k == 'd')E.css({left:M.X+v.pageX-M.pX,top:M.Y+v.pageY-M.pY}); else { E.css({width:Math.max(v.pageX-M.pX+M.W,0),height:Math.max(v.pageY-M.pY+M.H,0)}); if(M1){E1.css({width:Math.max(v.pageX-M1.pX+M1.W,0),height:Math.max(v.pageY-M1.pY+M1.H,0)});} } return false; }, stop:function(){ //E.css('opacity',M.o); $(document).unbind('mousemove',J.drag).unbind('mouseup',J.stop); } }; var J=$.jqDnR,M=J.dnr,E=J.e,E1, i=function(e,h,k,aR){ return e.each(function(){ h=(h)?$(h,e):e; h.bind('mousedown',{e:e,k:k},function(v){ var d=v.data,p={};E=d.e;E1 = aR ? $(aR) : false; // attempt utilization of dimensions plugin to fix IE issues if(E.css('position') != 'relative'){try{E.position(p);}catch(e){}} M={ X:p.left||f('left')||0, Y:p.top||f('top')||0, W:f('width')||E[0].scrollWidth||0, H:f('height')||E[0].scrollHeight||0, pX:v.pageX, pY:v.pageY, k:d.k //o:E.css('opacity') }; // also resize if(E1 && d.k != 'd'){ M1={ X:p.left||f1('left')||0, Y:p.top||f1('top')||0, W:E1[0].offsetWidth||f1('width')||0, H:E1[0].offsetHeight||f1('height')||0, pX:v.pageX, pY:v.pageY, k:d.k }; } else {M1 = false;} //E.css({opacity:0.8}); if($("input.hasDatepicker",E[0])[0]) { try {$("input.hasDatepicker",E[0]).datepicker('hide');}catch (dpe){} } $(document).mousemove($.jqDnR.drag).mouseup($.jqDnR.stop); return false; }); }); }, f=function(k){return parseInt(E.css(k))||false;}; f1=function(k){ return parseInt(E1.css(k))||false;}; })(jQuery);/* The below work is licensed under Creative Commons GNU LGPL License. Original work: License: http://creativecommons.org/licenses/LGPL/2.1/ Author: Stefan Goessner/2006 Web: http://goessner.net/ Modifications made: Version: 0.9-p5 Description: Restructured code, JSLint validated (no strict whitespaces), added handling of empty arrays, empty strings, and int/floats values. Author: Michael Schøler/2008-01-29 Web: http://michael.hinnerup.net/blog/2008/01/26/converting-json-to-xml-and-xml-to-json/ Description: json2xml added support to convert functions as CDATA so it will be easy to write characters that cause some problems when convert Author: Tony Tomov */ /*global alert */ var xmlJsonClass = { // Param "xml": Element or document DOM node. // Param "tab": Tab or indent string for pretty output formatting omit or use empty string "" to supress. // Returns: JSON string xml2json: function(xml, tab) { if (xml.nodeType === 9) { // document node xml = xml.documentElement; } var nws = this.removeWhite(xml); var obj = this.toObj(nws); var json = this.toJson(obj, xml.nodeName, "\t"); return "{\n" + tab + (tab ? json.replace(/\t/g, tab) : json.replace(/\t|\n/g, "")) + "\n}"; }, // Param "o": JavaScript object // Param "tab": tab or indent string for pretty output formatting omit or use empty string "" to supress. // Returns: XML string json2xml: function(o, tab) { var toXml = function(v, name, ind) { var xml = ""; var i, n; if (v instanceof Array) { if (v.length === 0) { xml += ind + "<"+name+">__EMPTY_ARRAY_</"+name+">\n"; } else { for (i = 0, n = v.length; i < n; i += 1) { var sXml = ind + toXml(v[i], name, ind+"\t") + "\n"; xml += sXml; } } } else if (typeof(v) === "object") { var hasChild = false; xml += ind + "<" + name; var m; for (m in v) if (v.hasOwnProperty(m)) { if (m.charAt(0) === "@") { xml += " " + m.substr(1) + "=\"" + v[m].toString() + "\""; } else { hasChild = true; } } xml += hasChild ? ">" : "/>"; if (hasChild) { for (m in v) if (v.hasOwnProperty(m)) { if (m === "#text") { xml += v[m]; } else if (m === "#cdata") { xml += "<![CDATA[" + v[m] + "]]>"; } else if (m.charAt(0) !== "@") { xml += toXml(v[m], m, ind+"\t"); } } xml += (xml.charAt(xml.length - 1) === "\n" ? ind : "") + "</" + name + ">"; } } else if (typeof(v) === "function") { xml += ind + "<" + name + ">" + "<![CDATA[" + v + "]]>" + "</" + name + ">"; } else { if (v === undefined ) { v = ""; } if (v.toString() === "\"\"" || v.toString().length === 0) { xml += ind + "<" + name + ">__EMPTY_STRING_</" + name + ">"; } else { xml += ind + "<" + name + ">" + v.toString() + "</" + name + ">"; } } return xml; }; var xml = ""; var m; for (m in o) if (o.hasOwnProperty(m)) { xml += toXml(o[m], m, ""); } return tab ? xml.replace(/\t/g, tab) : xml.replace(/\t|\n/g, ""); }, // Internal methods toObj: function(xml) { var o = {}; var FuncTest = /function/i; if (xml.nodeType === 1) { // element node .. if (xml.attributes.length) { // element with attributes .. var i; for (i = 0; i < xml.attributes.length; i += 1) { o["@" + xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue || "").toString(); } } if (xml.firstChild) { // element has child nodes .. var textChild = 0, cdataChild = 0, hasElementChild = false; var n; for (n = xml.firstChild; n; n = n.nextSibling) { if (n.nodeType === 1) { hasElementChild = true; } else if (n.nodeType === 3 && n.nodeValue.match(/[^ \f\n\r\t\v]/)) { // non-whitespace text textChild += 1; } else if (n.nodeType === 4) { // cdata section node cdataChild += 1; } } if (hasElementChild) { if (textChild < 2 && cdataChild < 2) { // structured element with evtl. a single text or/and cdata node .. this.removeWhite(xml); for (n = xml.firstChild; n; n = n.nextSibling) { if (n.nodeType === 3) { // text node o["#text"] = this.escape(n.nodeValue); } else if (n.nodeType === 4) { // cdata node if (FuncTest.test(n.nodeValue)) { o[n.nodeName] = [o[n.nodeName], n.nodeValue]; } else { o["#cdata"] = this.escape(n.nodeValue); } } else if (o[n.nodeName]) { // multiple occurence of element .. if (o[n.nodeName] instanceof Array) { o[n.nodeName][o[n.nodeName].length] = this.toObj(n); } else { o[n.nodeName] = [o[n.nodeName], this.toObj(n)]; } } else { // first occurence of element .. o[n.nodeName] = this.toObj(n); } } } else { // mixed content if (!xml.attributes.length) { o = this.escape(this.innerXml(xml)); } else { o["#text"] = this.escape(this.innerXml(xml)); } } } else if (textChild) { // pure text if (!xml.attributes.length) { o = this.escape(this.innerXml(xml)); if (o === "__EMPTY_ARRAY_") { o = "[]"; } else if (o === "__EMPTY_STRING_") { o = ""; } } else { o["#text"] = this.escape(this.innerXml(xml)); } } else if (cdataChild) { // cdata if (cdataChild > 1) { o = this.escape(this.innerXml(xml)); } else { for (n = xml.firstChild; n; n = n.nextSibling) { if(FuncTest.test(xml.firstChild.nodeValue)) { o = xml.firstChild.nodeValue; break; } else { o["#cdata"] = this.escape(n.nodeValue); } } } } } if (!xml.attributes.length && !xml.firstChild) { o = null; } } else if (xml.nodeType === 9) { // document.node o = this.toObj(xml.documentElement); } else { alert("unhandled node type: " + xml.nodeType); } return o; }, toJson: function(o, name, ind, wellform) { if(wellform === undefined) wellform = true; var json = name ? ("\"" + name + "\"") : "", tab = "\t", newline = "\n"; if(!wellform) { tab= ""; newline= ""; } if (o === "[]") { json += (name ? ":[]" : "[]"); } else if (o instanceof Array) { var n, i, ar=[]; for (i = 0, n = o.length; i < n; i += 1) { ar[i] = this.toJson(o[i], "", ind + tab, wellform); } json += (name ? ":[" : "[") + (ar.length > 1 ? (newline + ind + tab + ar.join(","+newline + ind + tab) + newline + ind) : ar.join("")) + "]"; } else if (o === null) { json += (name && ":") + "null"; } else if (typeof(o) === "object") { var arr = [], m; for (m in o) { if (o.hasOwnProperty(m)) { arr[arr.length] = this.toJson(o[m], m, ind + tab, wellform); } } json += (name ? ":{" : "{") + (arr.length > 1 ? (newline + ind + tab + arr.join(","+newline + ind + tab) + newline + ind) : arr.join("")) + "}"; } else if (typeof(o) === "string") { /* var objRegExp = /(^-?\d+\.?\d*$)/; var FuncTest = /function/i; var os = o.toString(); if (objRegExp.test(os) || FuncTest.test(os) || os==="false" || os==="true") { // int or float json += (name && ":") + "\"" +os + "\""; } else { */ json += (name && ":") + "\"" + o.replace(/\\/g,'\\\\').replace(/\"/g,'\\"') + "\""; //} } else { json += (name && ":") + o.toString(); } return json; }, innerXml: function(node) { var s = ""; if ("innerHTML" in node) { s = node.innerHTML; } else { var asXml = function(n) { var s = "", i; if (n.nodeType === 1) { s += "<" + n.nodeName; for (i = 0; i < n.attributes.length; i += 1) { s += " " + n.attributes[i].nodeName + "=\"" + (n.attributes[i].nodeValue || "").toString() + "\""; } if (n.firstChild) { s += ">"; for (var c = n.firstChild; c; c = c.nextSibling) { s += asXml(c); } s += "</" + n.nodeName + ">"; } else { s += "/>"; } } else if (n.nodeType === 3) { s += n.nodeValue; } else if (n.nodeType === 4) { s += "<![CDATA[" + n.nodeValue + "]]>"; } return s; }; for (var c = node.firstChild; c; c = c.nextSibling) { s += asXml(c); } } return s; }, escape: function(txt) { return txt.replace(/[\\]/g, "\\\\").replace(/[\"]/g, '\\"').replace(/[\n]/g, '\\n').replace(/[\r]/g, '\\r'); }, removeWhite: function(e) { e.normalize(); var n; for (n = e.firstChild; n; ) { if (n.nodeType === 3) { // text node if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) { // pure whitespace text node var nxt = n.nextSibling; e.removeChild(n); n = nxt; } else { n = n.nextSibling; } } else if (n.nodeType === 1) { // element node this.removeWhite(n); n = n.nextSibling; } else { // any other node n = n.nextSibling; } } return e; } };/* ** * formatter for values but most of the values if for jqGrid * Some of this was inspired and based on how YUI does the table datagrid but in jQuery fashion * we are trying to keep it as light as possible * Joshua Burnett josh@9ci.com * http://www.greenbill.com * * Changes from Tony Tomov tony@trirand.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html * **/ ;(function($) { "use strict"; $.fmatter = {}; //opts can be id:row id for the row, rowdata:the data for the row, colmodel:the column model for this column //example {id:1234,} $.extend($.fmatter,{ isBoolean : function(o) { return typeof o === 'boolean'; }, isObject : function(o) { return (o && (typeof o === 'object' || $.isFunction(o))) || false; }, isString : function(o) { return typeof o === 'string'; }, isNumber : function(o) { return typeof o === 'number' && isFinite(o); }, isNull : function(o) { return o === null; }, isUndefined : function(o) { return typeof o === 'undefined'; }, isValue : function (o) { return (this.isObject(o) || this.isString(o) || this.isNumber(o) || this.isBoolean(o)); }, isEmpty : function(o) { if(!this.isString(o) && this.isValue(o)) { return false; }else if (!this.isValue(o)){ return true; } o = $.trim(o).replace(/\&nbsp\;/ig,'').replace(/\&#160\;/ig,''); return o===""; } }); $.fn.fmatter = function(formatType, cellval, opts, rwd, act) { // build main options before element iteration var v=cellval; opts = $.extend({}, $.jgrid.formatter, opts); try { v = $.fn.fmatter[formatType].call(this, cellval, opts, rwd, act); } catch(fe){} return v; }; $.fmatter.util = { // Taken from YAHOO utils NumberFormat : function(nData,opts) { if(!$.fmatter.isNumber(nData)) { nData *= 1; } if($.fmatter.isNumber(nData)) { var bNegative = (nData < 0); var sOutput = nData + ""; var sDecimalSeparator = (opts.decimalSeparator) ? opts.decimalSeparator : "."; var nDotIndex; if($.fmatter.isNumber(opts.decimalPlaces)) { // Round to the correct decimal place var nDecimalPlaces = opts.decimalPlaces; var nDecimal = Math.pow(10, nDecimalPlaces); sOutput = Math.round(nData*nDecimal)/nDecimal + ""; nDotIndex = sOutput.lastIndexOf("."); if(nDecimalPlaces > 0) { // Add the decimal separator if(nDotIndex < 0) { sOutput += sDecimalSeparator; nDotIndex = sOutput.length-1; } // Replace the "." else if(sDecimalSeparator !== "."){ sOutput = sOutput.replace(".",sDecimalSeparator); } // Add missing zeros while((sOutput.length - 1 - nDotIndex) < nDecimalPlaces) { sOutput += "0"; } } } if(opts.thousandsSeparator) { var sThousandsSeparator = opts.thousandsSeparator; nDotIndex = sOutput.lastIndexOf(sDecimalSeparator); nDotIndex = (nDotIndex > -1) ? nDotIndex : sOutput.length; var sNewOutput = sOutput.substring(nDotIndex); var nCount = -1; for (var i=nDotIndex; i>0; i--) { nCount++; if ((nCount%3 === 0) && (i !== nDotIndex) && (!bNegative || (i > 1))) { sNewOutput = sThousandsSeparator + sNewOutput; } sNewOutput = sOutput.charAt(i-1) + sNewOutput; } sOutput = sNewOutput; } // Prepend prefix sOutput = (opts.prefix) ? opts.prefix + sOutput : sOutput; // Append suffix sOutput = (opts.suffix) ? sOutput + opts.suffix : sOutput; return sOutput; } else { return nData; } }, // Tony Tomov // PHP implementation. Sorry not all options are supported. // Feel free to add them if you want DateFormat : function (format, date, newformat, opts) { var token = /\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g, timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, timezoneClip = /[^-+\dA-Z]/g, msDateRegExp = new RegExp("^\/Date\\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\\)\/$"), msMatch = ((typeof date === 'string') ? date.match(msDateRegExp): null), pad = function (value, length) { value = String(value); length = parseInt(length,10) || 2; while (value.length < length) { value = '0' + value; } return value; }, ts = {m : 1, d : 1, y : 1970, h : 0, i : 0, s : 0, u:0}, timestamp=0, dM, k,hl, dateFormat=["i18n"]; // Internationalization strings dateFormat.i18n = { dayNames: opts.dayNames, monthNames: opts.monthNames }; if( format in opts.masks ) { format = opts.masks[format]; } if( !isNaN( date - 0 ) && String(format).toLowerCase() == "u") { //Unix timestamp timestamp = new Date( parseFloat(date)*1000 ); } else if(date.constructor === Date) { timestamp = date; // Microsoft date format support } else if( msMatch !== null ) { timestamp = new Date(parseInt(msMatch[1], 10)); if (msMatch[3]) { var offset = Number(msMatch[5]) * 60 + Number(msMatch[6]); offset *= ((msMatch[4] == '-') ? 1 : -1); offset -= timestamp.getTimezoneOffset(); timestamp.setTime(Number(Number(timestamp) + (offset * 60 * 1000))); } } else { date = String(date).split(/[\\\/:_;.,\t\T\s-]/); format = format.split(/[\\\/:_;.,\t\T\s-]/); // parsing for month names for(k=0,hl=format.length;k<hl;k++){ if(format[k] == 'M') { dM = $.inArray(date[k],dateFormat.i18n.monthNames); if(dM !== -1 && dM < 12){date[k] = dM+1;} } if(format[k] == 'F') { dM = $.inArray(date[k],dateFormat.i18n.monthNames); if(dM !== -1 && dM > 11){date[k] = dM+1-12;} } if(date[k]) { ts[format[k].toLowerCase()] = parseInt(date[k],10); } } if(ts.f) {ts.m = ts.f;} if( ts.m === 0 && ts.y === 0 && ts.d === 0) { return "&#160;" ; } ts.m = parseInt(ts.m,10)-1; var ty = ts.y; if (ty >= 70 && ty <= 99) {ts.y = 1900+ts.y;} else if (ty >=0 && ty <=69) {ts.y= 2000+ts.y;} timestamp = new Date(ts.y, ts.m, ts.d, ts.h, ts.i, ts.s, ts.u); } if( newformat in opts.masks ) { newformat = opts.masks[newformat]; } else if ( !newformat ) { newformat = 'Y-m-d'; } var G = timestamp.getHours(), i = timestamp.getMinutes(), j = timestamp.getDate(), n = timestamp.getMonth() + 1, o = timestamp.getTimezoneOffset(), s = timestamp.getSeconds(), u = timestamp.getMilliseconds(), w = timestamp.getDay(), Y = timestamp.getFullYear(), N = (w + 6) % 7 + 1, z = (new Date(Y, n - 1, j) - new Date(Y, 0, 1)) / 86400000, flags = { // Day d: pad(j), D: dateFormat.i18n.dayNames[w], j: j, l: dateFormat.i18n.dayNames[w + 7], N: N, S: opts.S(j), //j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th', w: w, z: z, // Week W: N < 5 ? Math.floor((z + N - 1) / 7) + 1 : Math.floor((z + N - 1) / 7) || ((new Date(Y - 1, 0, 1).getDay() + 6) % 7 < 4 ? 53 : 52), // Month F: dateFormat.i18n.monthNames[n - 1 + 12], m: pad(n), M: dateFormat.i18n.monthNames[n - 1], n: n, t: '?', // Year L: '?', o: '?', Y: Y, y: String(Y).substring(2), // Time a: G < 12 ? opts.AmPm[0] : opts.AmPm[1], A: G < 12 ? opts.AmPm[2] : opts.AmPm[3], B: '?', g: G % 12 || 12, G: G, h: pad(G % 12 || 12), H: pad(G), i: pad(i), s: pad(s), u: u, // Timezone e: '?', I: '?', O: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4), P: '?', T: (String(timestamp).match(timezone) || [""]).pop().replace(timezoneClip, ""), Z: '?', // Full Date/Time c: '?', r: '?', U: Math.floor(timestamp / 1000) }; return newformat.replace(token, function ($0) { return $0 in flags ? flags[$0] : $0.substring(1); }); } }; $.fn.fmatter.defaultFormat = function(cellval, opts) { return ($.fmatter.isValue(cellval) && cellval!=="" ) ? cellval : opts.defaultValue ? opts.defaultValue : "&#160;"; }; $.fn.fmatter.email = function(cellval, opts) { if(!$.fmatter.isEmpty(cellval)) { return "<a href=\"mailto:" + cellval + "\">" + cellval + "</a>"; }else { return $.fn.fmatter.defaultFormat(cellval,opts ); } }; $.fn.fmatter.checkbox =function(cval, opts) { var op = $.extend({},opts.checkbox), ds; if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) { op = $.extend({},op,opts.colModel.formatoptions); } if(op.disabled===true) {ds = "disabled=\"disabled\"";} else {ds="";} if($.fmatter.isEmpty(cval) || $.fmatter.isUndefined(cval) ) {cval = $.fn.fmatter.defaultFormat(cval,op);} cval=cval+"";cval=cval.toLowerCase(); var bchk = cval.search(/(false|0|no|off)/i)<0 ? " checked='checked' " : ""; return "<input type=\"checkbox\" " + bchk + " value=\""+ cval+"\" offval=\"no\" "+ds+ "/>"; }; $.fn.fmatter.link = function(cellval, opts) { var op = {target:opts.target}; var target = ""; if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) { op = $.extend({},op,opts.colModel.formatoptions); } if(op.target) {target = 'target=' + op.target;} if(!$.fmatter.isEmpty(cellval)) { return "<a "+target+" href=\"" + cellval + "\">" + cellval + "</a>"; }else { return $.fn.fmatter.defaultFormat(cellval,opts); } }; $.fn.fmatter.showlink = function(cellval, opts) { var op = {baseLinkUrl: opts.baseLinkUrl,showAction:opts.showAction, addParam: opts.addParam || "", target: opts.target, idName: opts.idName}, target = "", idUrl; if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) { op = $.extend({},op,opts.colModel.formatoptions); } if(op.target) {target = 'target=' + op.target;} idUrl = op.baseLinkUrl+op.showAction + '?'+ op.idName+'='+opts.rowId+op.addParam; if($.fmatter.isString(cellval) || $.fmatter.isNumber(cellval)) { //add this one even if its blank string return "<a "+target+" href=\"" + idUrl + "\">" + cellval + "</a>"; }else { return $.fn.fmatter.defaultFormat(cellval,opts); } }; $.fn.fmatter.integer = function(cellval, opts) { var op = $.extend({},opts.integer); if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) { op = $.extend({},op,opts.colModel.formatoptions); } if($.fmatter.isEmpty(cellval)) { return op.defaultValue; } return $.fmatter.util.NumberFormat(cellval,op); }; $.fn.fmatter.number = function (cellval, opts) { var op = $.extend({},opts.number); if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) { op = $.extend({},op,opts.colModel.formatoptions); } if($.fmatter.isEmpty(cellval)) { return op.defaultValue; } return $.fmatter.util.NumberFormat(cellval,op); }; $.fn.fmatter.currency = function (cellval, opts) { var op = $.extend({},opts.currency); if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) { op = $.extend({},op,opts.colModel.formatoptions); } if($.fmatter.isEmpty(cellval)) { return op.defaultValue; } return $.fmatter.util.NumberFormat(cellval,op); }; $.fn.fmatter.date = function (cellval, opts, rwd, act) { var op = $.extend({},opts.date); if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) { op = $.extend({},op,opts.colModel.formatoptions); } if(!op.reformatAfterEdit && act=='edit'){ return $.fn.fmatter.defaultFormat(cellval, opts); } else if(!$.fmatter.isEmpty(cellval)) { return $.fmatter.util.DateFormat(op.srcformat,cellval,op.newformat,op); } else { return $.fn.fmatter.defaultFormat(cellval, opts); } }; $.fn.fmatter.select = function (cellval,opts) { // jqGrid specific cellval = cellval + ""; var oSelect = false, ret=[], sep, delim; if(!$.fmatter.isUndefined(opts.colModel.formatoptions)){ oSelect= opts.colModel.formatoptions.value; sep = opts.colModel.formatoptions.separator === undefined ? ":" : opts.colModel.formatoptions.separator; delim = opts.colModel.formatoptions.delimiter === undefined ? ";" : opts.colModel.formatoptions.delimiter; } else if(!$.fmatter.isUndefined(opts.colModel.editoptions)){ oSelect= opts.colModel.editoptions.value; sep = opts.colModel.editoptions.separator === undefined ? ":" : opts.colModel.editoptions.separator; delim = opts.colModel.editoptions.delimiter === undefined ? ";" : opts.colModel.editoptions.delimiter; } if (oSelect) { var msl = opts.colModel.editoptions.multiple === true ? true : false, scell = [], sv; if(msl) {scell = cellval.split(",");scell = $.map(scell,function(n){return $.trim(n);});} if ($.fmatter.isString(oSelect)) { // mybe here we can use some caching with care ???? var so = oSelect.split(delim), j=0; for(var i=0; i<so.length;i++){ sv = so[i].split(sep); if(sv.length > 2 ) { sv[1] = $.map(sv,function(n,i){if(i>0) {return n;}}).join(sep); } if(msl) { if($.inArray(sv[0],scell)>-1) { ret[j] = sv[1]; j++; } } else if($.trim(sv[0])==$.trim(cellval)) { ret[0] = sv[1]; break; } } } else if($.fmatter.isObject(oSelect)) { // this is quicker if(msl) { ret = $.map(scell, function(n){ return oSelect[n]; }); } else { ret[0] = oSelect[cellval] || ""; } } } cellval = ret.join(", "); return cellval === "" ? $.fn.fmatter.defaultFormat(cellval,opts) : cellval; }; $.fn.fmatter.rowactions = function(rid,gid,act,pos) { var op ={ keys:false, onEdit : null, onSuccess: null, afterSave:null, onError: null, afterRestore: null, extraparam: {}, url: null, delOptions: {}, editOptions : {} }; rid = $.jgrid.jqID( rid ); gid = $.jgrid.jqID( gid ); var cm = $('#'+gid)[0].p.colModel[pos]; if(!$.fmatter.isUndefined(cm.formatoptions)) { op = $.extend(op,cm.formatoptions); } if( !$.fmatter.isUndefined($('#'+gid)[0].p.editOptions) ) { op.editOptions = $('#'+gid)[0].p.editOptions; } if( !$.fmatter.isUndefined($('#'+gid)[0].p.delOptions) ) { op.delOptions = $('#'+gid)[0].p.delOptions; } var $t = $("#"+gid)[0]; var saverow = function( rowid, res) { if($.isFunction(op.afterSave)) { op.afterSave.call($t, rowid, res); } $("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid + ".ui-jqgrid-btable:first").show(); $("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide(); }, restorerow = function( rowid) { if($.isFunction(op.afterRestore) ) { op.afterRestore.call($t, rowid); } $("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid+ ".ui-jqgrid-btable:first").show(); $("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide(); }; if( $("#"+rid,"#"+gid).hasClass("jqgrid-new-row") ){ var opers = $t.p.prmNames, oper = opers.oper; op.extraparam[oper] = opers.addoper; } switch(act) { case 'edit': $('#'+gid).jqGrid('editRow',rid, op.keys, op.onEdit, op.onSuccess, op.url, op.extraparam, saverow, op.onError,restorerow); $("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid+ ".ui-jqgrid-btable:first").hide(); $("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").show(); $($t).triggerHandler("jqGridAfterGridComplete"); break; case 'save': if ( $('#'+gid).jqGrid('saveRow',rid, op.onSuccess,op.url, op.extraparam, saverow, op.onError,restorerow) ) { $("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid+ ".ui-jqgrid-btable:first").show(); $("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide(); $($t).triggerHandler("jqGridAfterGridComplete"); } break; case 'cancel' : $('#'+gid).jqGrid('restoreRow',rid, restorerow); $("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid+ ".ui-jqgrid-btable:first").show(); $("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide(); $($t).triggerHandler("jqGridAfterGridComplete"); break; case 'del': $('#'+gid).jqGrid('delGridRow',rid, op.delOptions); break; case 'formedit': $('#'+gid).jqGrid('setSelection',rid); $('#'+gid).jqGrid('editGridRow',rid, op.editOptions); break; } }; $.fn.fmatter.actions = function(cellval,opts) { var op ={keys:false, editbutton:true, delbutton:true, editformbutton: false}; if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) { op = $.extend(op,opts.colModel.formatoptions); } var rowid = opts.rowId, str="",ocl; if(typeof(rowid) =='undefined' || $.fmatter.isEmpty(rowid)) {return "";} if(op.editformbutton){ ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','formedit',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); "; str =str+ "<div title='"+$.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+ocl+"><span class='ui-icon ui-icon-pencil'></span></div>"; } else if(op.editbutton){ ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','edit',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') "; str =str+ "<div title='"+$.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+ocl+"><span class='ui-icon ui-icon-pencil'></span></div>"; } if(op.delbutton) { ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','del',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); "; str = str+"<div title='"+$.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+ocl+"><span class='ui-icon ui-icon-trash'></span></div>"; } ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','save',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); "; str = str+"<div title='"+$.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save' "+ocl+"><span class='ui-icon ui-icon-disk'></span></div>"; ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','cancel',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); "; str = str+"<div title='"+$.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' "+ocl+"><span class='ui-icon ui-icon-cancel'></span></div>"; return "<div style='margin-left:8px;'>" + str + "</div>"; }; $.unformat = function (cellval,options,pos,cnt) { // specific for jqGrid only var ret, formatType = options.colModel.formatter, op =options.colModel.formatoptions || {}, sep, re = /([\.\*\_\'\(\)\{\}\+\?\\])/g, unformatFunc = options.colModel.unformat||($.fn.fmatter[formatType] && $.fn.fmatter[formatType].unformat); if(typeof unformatFunc !== 'undefined' && $.isFunction(unformatFunc) ) { ret = unformatFunc.call(this, $(cellval).text(), options, cellval); } else if(!$.fmatter.isUndefined(formatType) && $.fmatter.isString(formatType) ) { var opts = $.jgrid.formatter || {}, stripTag; switch(formatType) { case 'integer' : op = $.extend({},opts.integer,op); sep = op.thousandsSeparator.replace(re,"\\$1"); stripTag = new RegExp(sep, "g"); ret = $(cellval).text().replace(stripTag,''); break; case 'number' : op = $.extend({},opts.number,op); sep = op.thousandsSeparator.replace(re,"\\$1"); stripTag = new RegExp(sep, "g"); ret = $(cellval).text().replace(stripTag,"").replace(op.decimalSeparator,'.'); break; case 'currency': op = $.extend({},opts.currency,op); sep = op.thousandsSeparator.replace(re,"\\$1"); stripTag = new RegExp(sep, "g"); ret = $(cellval).text(); if (op.prefix && op.prefix.length) { ret = ret.substr(op.prefix.length); } if (op.suffix && op.suffix.length) { ret = ret.substr(0, ret.length - op.suffix.length); } ret = ret.replace(stripTag,'').replace(op.decimalSeparator,'.'); break; case 'checkbox': var cbv = (options.colModel.editoptions) ? options.colModel.editoptions.value.split(":") : ["Yes","No"]; ret = $('input',cellval).is(":checked") ? cbv[0] : cbv[1]; break; case 'select' : ret = $.unformat.select(cellval,options,pos,cnt); break; case 'actions': return ""; default: ret= $(cellval).text(); } } return ret !== undefined ? ret : cnt===true ? $(cellval).text() : $.jgrid.htmlDecode($(cellval).html()); }; $.unformat.select = function (cellval,options,pos,cnt) { // Spacial case when we have local data and perform a sort // cnt is set to true only in sortDataArray var ret = []; var cell = $(cellval).text(); if(cnt===true) {return cell;} var op = $.extend({}, !$.fmatter.isUndefined(options.colModel.formatoptions) ? options.colModel.formatoptions: options.colModel.editoptions), sep = op.separator === undefined ? ":" : op.separator, delim = op.delimiter === undefined ? ";" : op.delimiter; if(op.value){ var oSelect = op.value, msl = op.multiple === true ? true : false, scell = [], sv; if(msl) {scell = cell.split(",");scell = $.map(scell,function(n){return $.trim(n);});} if ($.fmatter.isString(oSelect)) { var so = oSelect.split(delim), j=0; for(var i=0; i<so.length;i++){ sv = so[i].split(sep); if(sv.length > 2 ) { sv[1] = $.map(sv,function(n,i){if(i>0) {return n;}}).join(sep); } if(msl) { if($.inArray(sv[1],scell)>-1) { ret[j] = sv[0]; j++; } } else if($.trim(sv[1])==$.trim(cell)) { ret[0] = sv[0]; break; } } } else if($.fmatter.isObject(oSelect) || $.isArray(oSelect) ){ if(!msl) {scell[0] = cell;} ret = $.map(scell, function(n){ var rv; $.each(oSelect, function(i,val){ if (val == n) { rv = i; return false; } }); if( typeof(rv) != 'undefined' ) {return rv;} }); } return ret.join(", "); } else { return cell || ""; } }; $.unformat.date = function (cellval, opts) { var op = $.jgrid.formatter.date || {}; if(!$.fmatter.isUndefined(opts.formatoptions)) { op = $.extend({},op,opts.formatoptions); } if(!$.fmatter.isEmpty(cellval)) { return $.fmatter.util.DateFormat(op.newformat,cellval,op.srcformat,op); } else { return $.fn.fmatter.defaultFormat(cellval, opts); } }; })(jQuery); ;(function($){ /* * jqGrid common function * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html */ /*global jQuery, $ */ $.extend($.jgrid,{ // Modal functions showModal : function(h) { h.w.show(); }, closeModal : function(h) { h.w.hide().attr("aria-hidden","true"); if(h.o) {h.o.remove();} }, hideModal : function (selector,o) { o = $.extend({jqm : true, gb :''}, o || {}); if(o.onClose) { var oncret = o.onClose(selector); if (typeof oncret == 'boolean' && !oncret ) { return; } } if ($.fn.jqm && o.jqm === true) { $(selector).attr("aria-hidden","true").jqmHide(); } else { if(o.gb !== '') { try {$(".jqgrid-overlay:first",o.gb).hide();} catch (e){} } $(selector).hide().attr("aria-hidden","true"); } }, //Helper functions findPos : function(obj) { var curleft = 0, curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); //do not change obj == obj.offsetParent } return [curleft,curtop]; }, createModal : function(aIDs, content, p, insertSelector, posSelector, appendsel, css) { var mw = document.createElement('div'), rtlsup, self = this; css = $.extend({}, css || {}); rtlsup = $(p.gbox).attr("dir") == "rtl" ? true : false; mw.className= "ui-widget ui-widget-content ui-corner-all ui-jqdialog"; mw.id = aIDs.themodal; var mh = document.createElement('div'); mh.className = "ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"; mh.id = aIDs.modalhead; $(mh).append("<span class='ui-jqdialog-title'>"+p.caption+"</span>"); var ahr= $("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>") .hover(function(){ahr.addClass('ui-state-hover');}, function(){ahr.removeClass('ui-state-hover');}) .append("<span class='ui-icon ui-icon-closethick'></span>"); $(mh).append(ahr); if(rtlsup) { mw.dir = "rtl"; $(".ui-jqdialog-title",mh).css("float","right"); $(".ui-jqdialog-titlebar-close",mh).css("left",0.3+"em"); } else { mw.dir = "ltr"; $(".ui-jqdialog-title",mh).css("float","left"); $(".ui-jqdialog-titlebar-close",mh).css("right",0.3+"em"); } var mc = document.createElement('div'); $(mc).addClass("ui-jqdialog-content ui-widget-content").attr("id",aIDs.modalcontent); $(mc).append(content); mw.appendChild(mc); $(mw).prepend(mh); if(appendsel===true) { $('body').append(mw); } //append as first child in body -for alert dialog else if (typeof appendsel == "string") $(appendsel).append(mw); else {$(mw).insertBefore(insertSelector);} $(mw).css(css); if(typeof p.jqModal === 'undefined') {p.jqModal = true;} // internal use var coord = {}; if ( $.fn.jqm && p.jqModal === true) { if(p.left ===0 && p.top===0 && p.overlay) { var pos = []; pos = this.findPos(posSelector); p.left = pos[0] + 4; p.top = pos[1] + 4; } coord.top = p.top+"px"; coord.left = p.left; } else if(p.left !==0 || p.top!==0) { coord.left = p.left; coord.top = p.top+"px"; } $("a.ui-jqdialog-titlebar-close",mh).click(function(){ var oncm = $("#"+$.jgrid.jqID(aIDs.themodal)).data("onClose") || p.onClose; var gboxclose = $("#"+$.jgrid.jqID(aIDs.themodal)).data("gbox") || p.gbox; self.hideModal("#"+$.jgrid.jqID(aIDs.themodal),{gb:gboxclose,jqm:p.jqModal,onClose:oncm}); return false; }); if (p.width === 0 || !p.width) {p.width = 300;} if(p.height === 0 || !p.height) {p.height =200;} if(!p.zIndex) { var parentZ = $(insertSelector).parents("*[role=dialog]").filter(':first').css("z-index"); if(parentZ) { p.zIndex = parseInt(parentZ,10)+2; } else { p.zIndex = 950; } } var rtlt = 0; if( rtlsup && coord.left && !appendsel) { rtlt = $(p.gbox).width()- (!isNaN(p.width) ? parseInt(p.width,10) :0) - 8; // to do // just in case coord.left = parseInt(coord.left,10) + parseInt(rtlt,10); } if(coord.left) { coord.left += "px"; } $(mw).css($.extend({ width: isNaN(p.width) ? "auto": p.width+"px", height:isNaN(p.height) ? "auto" : p.height + "px", zIndex:p.zIndex, overflow: 'hidden' },coord)) .attr({tabIndex: "-1","role":"dialog","aria-labelledby":aIDs.modalhead,"aria-hidden":"true"}); if(typeof p.drag == 'undefined') { p.drag=true;} if(typeof p.resize == 'undefined') {p.resize=true;} if (p.drag) { $(mh).css('cursor','move'); if($.fn.jqDrag) { $(mw).jqDrag(mh); } else { try { $(mw).draggable({handle: $("#"+$.jgrid.jqID(mh.id))}); } catch (e) {} } } if(p.resize) { if($.fn.jqResize) { $(mw).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>"); $("#"+$.jgrid.jqID(aIDs.themodal)).jqResize(".jqResize",aIDs.scrollelm ? "#"+$.jgrid.jqID(aIDs.scrollelm) : false); } else { try { $(mw).resizable({handles: 'se, sw',alsoResize: aIDs.scrollelm ? "#"+$.jgrid.jqID(aIDs.scrollelm) : false}); } catch (r) {} } } if(p.closeOnEscape === true){ $(mw).keydown( function( e ) { if( e.which == 27 ) { var cone = $("#"+$.jgrid.jqID(aIDs.themodal)).data("onClose") || p.onClose; self.hideModal(this,{gb:p.gbox,jqm:p.jqModal,onClose: cone}); } }); } }, viewModal : function (selector,o){ o = $.extend({ toTop: true, overlay: 10, modal: false, overlayClass : 'ui-widget-overlay', onShow: this.showModal, onHide: this.closeModal, gbox: '', jqm : true, jqM : true }, o || {}); if ($.fn.jqm && o.jqm === true) { if(o.jqM) { $(selector).attr("aria-hidden","false").jqm(o).jqmShow(); } else {$(selector).attr("aria-hidden","false").jqmShow();} } else { if(o.gbox !== '') { $(".jqgrid-overlay:first",o.gbox).show(); $(selector).data("gbox",o.gbox); } $(selector).show().attr("aria-hidden","false"); try{$(':input:visible',selector)[0].focus();}catch(_){} } }, info_dialog : function(caption, content,c_b, modalopt) { var mopt = { width:290, height:'auto', dataheight: 'auto', drag: true, resize: false, caption:"<b>"+caption+"</b>", left:250, top:170, zIndex : 1000, jqModal : true, modal : false, closeOnEscape : true, align: 'center', buttonalign : 'center', buttons : [] // {text:'textbutt', id:"buttid", onClick : function(){...}} // if the id is not provided we set it like info_button_+ the index in the array - i.e info_button_0,info_button_1... }; $.extend(mopt,modalopt || {}); var jm = mopt.jqModal, self = this; if($.fn.jqm && !jm) { jm = false; } // in case there is no jqModal var buttstr =""; if(mopt.buttons.length > 0) { for(var i=0;i<mopt.buttons.length;i++) { if(typeof mopt.buttons[i].id == "undefined") { mopt.buttons[i].id = "info_button_"+i; } buttstr += "<a href='javascript:void(0)' id='"+mopt.buttons[i].id+"' class='fm-button ui-state-default ui-corner-all'>"+mopt.buttons[i].text+"</a>"; } } var dh = isNaN(mopt.dataheight) ? mopt.dataheight : mopt.dataheight+"px", cn = "text-align:"+mopt.align+";"; var cnt = "<div id='info_id'>"; cnt += "<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+dh+";"+cn+"'>"+content+"</div>"; cnt += c_b ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+c_b+"</a>"+buttstr+"</div>" : buttstr !== "" ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+buttstr+"</div>" : ""; cnt += "</div>"; try { if($("#info_dialog").attr("aria-hidden") == "false") { this.hideModal("#info_dialog",{jqm:jm}); } $("#info_dialog").remove(); } catch (e){} this.createModal({ themodal:'info_dialog', modalhead:'info_head', modalcontent:'info_content', scrollelm: 'infocnt'}, cnt, mopt, '','',true ); // attach onclick after inserting into the dom if(buttstr) { $.each(mopt.buttons,function(i){ $("#"+$.jgrid.jqID(this.id),"#info_id").bind('click',function(){mopt.buttons[i].onClick.call($("#info_dialog")); return false;}); }); } $("#closedialog", "#info_id").click(function(){ self.hideModal("#info_dialog",{jqm:jm}); return false; }); $(".fm-button","#info_dialog").hover( function(){$(this).addClass('ui-state-hover');}, function(){$(this).removeClass('ui-state-hover');} ); if($.isFunction(mopt.beforeOpen) ) { mopt.beforeOpen(); } this.viewModal("#info_dialog",{ onHide: function(h) { h.w.hide().remove(); if(h.o) { h.o.remove(); } }, modal :mopt.modal, jqm:jm }); if($.isFunction(mopt.afterOpen) ) { mopt.afterOpen(); } try{ $("#info_dialog").focus();} catch (m){} }, // Form Functions createEl : function(eltype,options,vl,autowidth, ajaxso) { var elem = ""; function bindEv (el, opt) { if($.isFunction(opt.dataInit)) { opt.dataInit(el); } if(opt.dataEvents) { $.each(opt.dataEvents, function() { if (this.data !== undefined) { $(el).bind(this.type, this.data, this.fn); } else { $(el).bind(this.type, this.fn); } }); } return opt; } function setAttributes(elm, atr, exl ) { var exclude = ['dataInit','dataEvents','dataUrl', 'buildSelect','sopt', 'searchhidden', 'defaultValue', 'attr']; if(typeof(exl) != "undefined" && $.isArray(exl)) { $.merge(exclude, exl); } $.each(atr, function(key, value){ if($.inArray(key, exclude) === -1) { $(elm).attr(key,value); } }); if(!atr.hasOwnProperty('id')) { $(elm).attr('id', $.jgrid.randId()); } } switch (eltype) { case "textarea" : elem = document.createElement("textarea"); if(autowidth) { if(!options.cols) { $(elem).css({width:"98%"});} } else if (!options.cols) { options.cols = 20; } if(!options.rows) { options.rows = 2; } if(vl=='&nbsp;' || vl=='&#160;' || (vl.length==1 && vl.charCodeAt(0)==160)) {vl="";} elem.value = vl; setAttributes(elem, options); options = bindEv(elem,options); $(elem).attr({"role":"textbox","multiline":"true"}); break; case "checkbox" : //what code for simple checkbox elem = document.createElement("input"); elem.type = "checkbox"; if( !options.value ) { var vl1 = vl.toLowerCase(); if(vl1.search(/(false|0|no|off|undefined)/i)<0 && vl1!=="") { elem.checked=true; elem.defaultChecked=true; elem.value = vl; } else { elem.value = "on"; } $(elem).attr("offval","off"); } else { var cbval = options.value.split(":"); if(vl === cbval[0]) { elem.checked=true; elem.defaultChecked=true; } elem.value = cbval[0]; $(elem).attr("offval",cbval[1]); } setAttributes(elem, options, ['value']); options = bindEv(elem,options); $(elem).attr("role","checkbox"); break; case "select" : elem = document.createElement("select"); elem.setAttribute("role","select"); var msl, ovm = []; if(options.multiple===true) { msl = true; elem.multiple="multiple"; $(elem).attr("aria-multiselectable","true"); } else { msl = false; } if(typeof(options.dataUrl) != "undefined") { $.ajax($.extend({ url: options.dataUrl, type : "GET", dataType: "html", context: {elem:elem, options:options, vl:vl}, success: function(data){ var a, ovm = [], elem = this.elem, vl = this.vl, options = $.extend({},this.options), msl = options.multiple===true; if(typeof(options.buildSelect) != "undefined") { var b = options.buildSelect(data); a = $(b).html(); } else { a = $(data).html(); } if(a) { $(elem).append(a); setAttributes(elem, options); options = bindEv(elem,options); if(typeof options.size === 'undefined') { options.size = msl ? 3 : 1;} if(msl) { ovm = vl.split(","); ovm = $.map(ovm,function(n){return $.trim(n);}); } else { ovm[0] = $.trim(vl); } //$(elem).attr(options); setTimeout(function(){ $("option",elem).each(function(i){ //if(i===0) { this.selected = ""; } // fix IE8/IE7 problem with selecting of the first item on multiple=true if (i === 0 && elem.multiple) { this.selected = false; } $(this).attr("role","option"); if($.inArray($.trim($(this).text()),ovm) > -1 || $.inArray($.trim($(this).val()),ovm) > -1 ) { this.selected= "selected"; } }); },0); } } },ajaxso || {})); } else if(options.value) { var i; if(typeof options.size === 'undefined') { options.size = msl ? 3 : 1; } if(msl) { ovm = vl.split(","); ovm = $.map(ovm,function(n){return $.trim(n);}); } if(typeof options.value === 'function') { options.value = options.value(); } var so,sv, ov, sep = options.separator === undefined ? ":" : options.separator, delim = options.delimiter === undefined ? ";" : options.delimiter; if(typeof options.value === 'string') { so = options.value.split(delim); for(i=0; i<so.length;i++){ sv = so[i].split(sep); if(sv.length > 2 ) { sv[1] = $.map(sv,function(n,ii){if(ii>0) { return n;} }).join(sep); } ov = document.createElement("option"); ov.setAttribute("role","option"); ov.value = sv[0]; ov.innerHTML = sv[1]; elem.appendChild(ov); if (!msl && ($.trim(sv[0]) == $.trim(vl) || $.trim(sv[1]) == $.trim(vl))) { ov.selected ="selected"; } if (msl && ($.inArray($.trim(sv[1]), ovm)>-1 || $.inArray($.trim(sv[0]), ovm)>-1)) {ov.selected ="selected";} } } else if (typeof options.value === 'object') { var oSv = options.value; for ( var key in oSv) { if (oSv.hasOwnProperty(key ) ){ ov = document.createElement("option"); ov.setAttribute("role","option"); ov.value = key; ov.innerHTML = oSv[key]; elem.appendChild(ov); if (!msl && ( $.trim(key) == $.trim(vl) || $.trim(oSv[key]) == $.trim(vl)) ) { ov.selected ="selected"; } if (msl && ($.inArray($.trim(oSv[key]),ovm)>-1 || $.inArray($.trim(key),ovm)>-1)) { ov.selected ="selected"; } } } } setAttributes(elem, options, ['value']); options = bindEv(elem,options); } break; case "text" : case "password" : case "button" : var role; if(eltype=="button") { role = "button"; } else { role = "textbox"; } elem = document.createElement("input"); elem.type = eltype; elem.value = vl; setAttributes(elem, options); options = bindEv(elem,options); if(eltype != "button"){ if(autowidth) { if(!options.size) { $(elem).css({width:"98%"}); } } else if (!options.size) { options.size = 20; } } $(elem).attr("role",role); break; case "image" : case "file" : elem = document.createElement("input"); elem.type = eltype; setAttributes(elem, options); options = bindEv(elem,options); break; case "custom" : elem = document.createElement("span"); try { if($.isFunction(options.custom_element)) { var celm = options.custom_element.call(this,vl,options); if(celm) { celm = $(celm).addClass("customelement").attr({id:options.id,name:options.name}); $(elem).empty().append(celm); } else { throw "e2"; } } else { throw "e1"; } } catch (e) { if (e=="e1") { this.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.nodefined, $.jgrid.edit.bClose);} if (e=="e2") { this.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.novalue,$.jgrid.edit.bClose);} else { this.info_dialog($.jgrid.errors.errcap,typeof(e)==="string"?e:e.message,$.jgrid.edit.bClose); } } break; } return elem; }, // Date Validation Javascript checkDate : function (format, date) { var daysInFebruary = function(year){ // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 === 0) && ( year % 100 !== 0 || (year % 400 === 0))) ? 29 : 28 ); }, DaysArray = function(n) { for (var i = 1; i <= n; i++) { this[i] = 31; if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;} if (i==2) {this[i] = 29;} } return this; }; var tsp = {}, sep; format = format.toLowerCase(); //we search for /,-,. for the date separator if(format.indexOf("/") != -1) { sep = "/"; } else if(format.indexOf("-") != -1) { sep = "-"; } else if(format.indexOf(".") != -1) { sep = "."; } else { sep = "/"; } format = format.split(sep); date = date.split(sep); if (date.length != 3) { return false; } var j=-1,yln, dln=-1, mln=-1; for(var i=0;i<format.length;i++){ var dv = isNaN(date[i]) ? 0 : parseInt(date[i],10); tsp[format[i]] = dv; yln = format[i]; if(yln.indexOf("y") != -1) { j=i; } if(yln.indexOf("m") != -1) { mln=i; } if(yln.indexOf("d") != -1) { dln=i; } } if (format[j] == "y" || format[j] == "yyyy") { yln=4; } else if(format[j] =="yy"){ yln = 2; } else { yln = -1; } var daysInMonth = DaysArray(12), strDate; if (j === -1) { return false; } else { strDate = tsp[format[j]].toString(); if(yln == 2 && strDate.length == 1) {yln = 1;} if (strDate.length != yln || (tsp[format[j]]===0 && date[j]!="00")){ return false; } } if(mln === -1) { return false; } else { strDate = tsp[format[mln]].toString(); if (strDate.length<1 || tsp[format[mln]]<1 || tsp[format[mln]]>12){ return false; } } if(dln === -1) { return false; } else { strDate = tsp[format[dln]].toString(); if (strDate.length<1 || tsp[format[dln]]<1 || tsp[format[dln]]>31 || (tsp[format[mln]]==2 && tsp[format[dln]]>daysInFebruary(tsp[format[j]])) || tsp[format[dln]] > daysInMonth[tsp[format[mln]]]){ return false; } } return true; }, isEmpty : function(val) { if (val.match(/^\s+$/) || val === "") { return true; } else { return false; } }, checkTime : function(time){ // checks only hh:ss (and optional am/pm) var re = /^(\d{1,2}):(\d{2})([ap]m)?$/,regs; if(!this.isEmpty(time)) { regs = time.match(re); if(regs) { if(regs[3]) { if(regs[1] < 1 || regs[1] > 12) { return false; } } else { if(regs[1] > 23) { return false; } } if(regs[2] > 59) { return false; } } else { return false; } } return true; }, checkValues : function(val, valref,g, customobject, nam) { var edtrul,i, nm, dft, len; if(typeof(customobject) === "undefined") { if(typeof(valref)=='string'){ for( i =0, len=g.p.colModel.length;i<len; i++){ if(g.p.colModel[i].name==valref) { edtrul = g.p.colModel[i].editrules; valref = i; try { nm = g.p.colModel[i].formoptions.label; } catch (e) {} break; } } } else if(valref >=0) { edtrul = g.p.colModel[valref].editrules; } } else { edtrul = customobject; nm = nam===undefined ? "_" : nam; } if(edtrul) { if(!nm) { nm = g.p.colNames[valref]; } if(edtrul.required === true) { if( this.isEmpty(val) ) { return [false,nm+": "+$.jgrid.edit.msg.required,""]; } } // force required var rqfield = edtrul.required === false ? false : true; if(edtrul.number === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.number,""]; } } } if(typeof edtrul.minValue != 'undefined' && !isNaN(edtrul.minValue)) { if (parseFloat(val) < parseFloat(edtrul.minValue) ) { return [false,nm+": "+$.jgrid.edit.msg.minValue+" "+edtrul.minValue,""];} } if(typeof edtrul.maxValue != 'undefined' && !isNaN(edtrul.maxValue)) { if (parseFloat(val) > parseFloat(edtrul.maxValue) ) { return [false,nm+": "+$.jgrid.edit.msg.maxValue+" "+edtrul.maxValue,""];} } var filter; if(edtrul.email === true) { if( !(rqfield === false && this.isEmpty(val)) ) { // taken from $ Validate plugin filter = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i; if(!filter.test(val)) {return [false,nm+": "+$.jgrid.edit.msg.email,""];} } } if(edtrul.integer === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.integer,""]; } if ((val % 1 !== 0) || (val.indexOf('.') != -1)) { return [false,nm+": "+$.jgrid.edit.msg.integer,""];} } } if(edtrul.date === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if(g.p.colModel[valref].formatoptions && g.p.colModel[valref].formatoptions.newformat) { dft = g.p.colModel[valref].formatoptions.newformat; } else { dft = g.p.colModel[valref].datefmt || "Y-m-d"; } if(!this.checkDate (dft, val)) { return [false,nm+": "+$.jgrid.edit.msg.date+" - "+dft,""]; } } } if(edtrul.time === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if(!this.checkTime (val)) { return [false,nm+": "+$.jgrid.edit.msg.date+" - hh:mm (am/pm)",""]; } } } if(edtrul.url === true) { if( !(rqfield === false && this.isEmpty(val)) ) { filter = /^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i; if(!filter.test(val)) {return [false,nm+": "+$.jgrid.edit.msg.url,""];} } } if(edtrul.custom === true) { if( !(rqfield === false && this.isEmpty(val)) ) { if($.isFunction(edtrul.custom_func)) { var ret = edtrul.custom_func.call(g,val,nm); if($.isArray(ret)) { return ret; } else { return [false,$.jgrid.edit.msg.customarray,""]; } } else { return [false,$.jgrid.edit.msg.customfcheck,""]; } } } } return [true,"",""]; } }); })(jQuery);/* * jqFilter jQuery jqGrid filter addon. * Copyright (c) 2011, Tony Tomov, tony@trirand.com * Dual licensed under the MIT and GPL licenses * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html * * The work is inspired from this Stefan Pirvu * http://www.codeproject.com/KB/scripting/json-filtering.aspx * * The filter uses JSON entities to hold filter rules and groups. Here is an example of a filter: { "groupOp": "AND", "groups" : [ { "groupOp": "OR", "rules": [ { "field": "name", "op": "eq", "data": "England" }, { "field": "id", "op": "le", "data": "5"} ] } ], "rules": [ { "field": "name", "op": "eq", "data": "Romania" }, { "field": "id", "op": "le", "data": "1"} ] } */ /*global jQuery, $, window, navigator */ (function ($) { $.fn.jqFilter = function( arg ) { if (typeof arg === 'string') { var fn = $.fn.jqFilter[arg]; if (!fn) { throw ("jqFilter - No such method: " + arg); } var args = $.makeArray(arguments).slice(1); return fn.apply(this,args); } var p = $.extend(true,{ filter: null, columns: [], onChange : null, afterRedraw : null, checkValues : null, error: false, errmsg : "", errorcheck : true, showQuery : true, sopt : null, ops : [ {"name": "eq", "description": "equal", "operator":"="}, {"name": "ne", "description": "not equal", "operator":"<>"}, {"name": "lt", "description": "less", "operator":"<"}, {"name": "le", "description": "less or equal","operator":"<="}, {"name": "gt", "description": "greater", "operator":">"}, {"name": "ge", "description": "greater or equal", "operator":">="}, {"name": "bw", "description": "begins with", "operator":"LIKE"}, {"name": "bn", "description": "does not begin with", "operator":"NOT LIKE"}, {"name": "in", "description": "in", "operator":"IN"}, {"name": "ni", "description": "not in", "operator":"NOT IN"}, {"name": "ew", "description": "ends with", "operator":"LIKE"}, {"name": "en", "description": "does not end with", "operator":"NOT LIKE"}, {"name": "cn", "description": "contains", "operator":"LIKE"}, {"name": "nc", "description": "does not contain", "operator":"NOT LIKE"}, {"name": "nu", "description": "is null", "operator":"IS NULL"}, {"name": "nn", "description": "is not null", "operator":"IS NOT NULL"} ], numopts : ['eq','ne', 'lt', 'le', 'gt', 'ge', 'nu', 'nn', 'in', 'ni'], stropts : ['eq', 'ne', 'bw', 'bn', 'ew', 'en', 'cn', 'nc', 'nu', 'nn', 'in', 'ni'], _gridsopt : [], // grid translated strings, do not tuch groupOps : [{ op: "AND", text: "AND" }, { op: "OR", text: "OR" }], groupButton : true, ruleButtons : true, direction : "ltr" }, arg || {}); return this.each( function() { if (this.filter) {return;} this.p = p; // setup filter in case if they is not defined if (this.p.filter === null || this.p.filter === undefined) { this.p.filter = { groupOp: this.p.groupOps[0].op, rules: [], groups: [] }; } var i, len = this.p.columns.length, cl, isIE = /msie/i.test(navigator.userAgent) && !window.opera; // translating the options if(this.p._gridsopt.length) { // ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc'] for(i=0;i<this.p._gridsopt.length;i++) { this.p.ops[i].description = this.p._gridsopt[i]; } } this.p.initFilter = $.extend(true,{},this.p.filter); // set default values for the columns if they are not set if( !len ) {return;} for(i=0; i < len; i++) { cl = this.p.columns[i]; if( cl.stype ) { // grid compatibility cl.inputtype = cl.stype; } else if(!cl.inputtype) { cl.inputtype = 'text'; } if( cl.sorttype ) { // grid compatibility cl.searchtype = cl.sorttype; } else if (!cl.searchtype) { cl.searchtype = 'string'; } if(cl.hidden === undefined) { // jqGrid compatibility cl.hidden = false; } if(!cl.label) { cl.label = cl.name; } if(cl.index) { cl.name = cl.index; } if(!cl.hasOwnProperty('searchoptions')) { cl.searchoptions = {}; } if(!cl.hasOwnProperty('searchrules')) { cl.searchrules = {}; } } if(this.p.showQuery) { $(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;' dir='"+this.p.direction+"'><tbody><tr><td class='query'></td></tr></tbody></table>"); } /* *Perform checking. * */ var checkData = function(val, colModelItem) { var ret = [true,""]; if($.isFunction(colModelItem.searchrules)) { ret = colModelItem.searchrules(val, colModelItem); } else if($.jgrid && $.jgrid.checkValues) { try { ret = $.jgrid.checkValues(val, -1, null, colModelItem.searchrules, colModelItem.label); } catch (e) {} } if(ret && ret.length && ret[0] === false) { p.error = !ret[0]; p.errmsg = ret[1]; } }; /* moving to common randId = function() { return Math.floor(Math.random()*10000).toString(); }; */ this.onchange = function ( ){ // clear any error this.p.error = false; this.p.errmsg=""; return $.isFunction(this.p.onChange) ? this.p.onChange.call( this, this.p ) : false; }; /* * Redraw the filter every time when new field is added/deleted * and field is changed */ this.reDraw = function() { $("table.group:first",this).remove(); var t = this.createTableForGroup(p.filter, null); $(this).append(t); if($.isFunction(this.p.afterRedraw) ) { this.p.afterRedraw.call(this, this.p); } }; /* * Creates a grouping data for the filter * @param group - object * @param parentgroup - object */ this.createTableForGroup = function(group, parentgroup) { var that = this, i; // this table will hold all the group (tables) and rules (rows) var table = $("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>"), // create error message row align = "left"; if(this.p.direction == "rtl") { align = "right"; table.attr("dir","rtl"); } if(parentgroup === null) { table.append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='"+align+"'></th></tr>"); } var tr = $("<tr></tr>"); table.append(tr); // this header will hold the group operator type and group action buttons for // creating subgroup "+ {}", creating rule "+" or deleting the group "-" var th = $("<th colspan='5' align='"+align+"'></th>"); tr.append(th); if(this.p.ruleButtons === true) { // dropdown for: choosing group operator type var groupOpSelect = $("<select class='opsel'></select>"); th.append(groupOpSelect); // populate dropdown with all posible group operators: or, and var str= "", selected; for (i = 0; i < p.groupOps.length; i++) { selected = group.groupOp === that.p.groupOps[i].op ? " selected='selected'" :""; str += "<option value='"+that.p.groupOps[i].op+"'" + selected+">"+that.p.groupOps[i].text+"</option>"; } groupOpSelect .append(str) .bind('change',function() { group.groupOp = $(groupOpSelect).val(); that.onchange(); // signals that the filter has changed }); } // button for adding a new subgroup var inputAddSubgroup ="<span></span>"; if(this.p.groupButton) { inputAddSubgroup = $("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>"); inputAddSubgroup.bind('click',function() { if (group.groups === undefined ) { group.groups = []; } group.groups.push({ groupOp: p.groupOps[0].op, rules: [], groups: [] }); // adding a new group that.reDraw(); // the html has changed, force reDraw that.onchange(); // signals that the filter has changed return false; }); } th.append(inputAddSubgroup); if(this.p.ruleButtons === true) { // button for adding a new rule var inputAddRule = $("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"), cm; inputAddRule.bind('click',function() { //if(!group) { group = {};} if (group.rules === undefined) { group.rules = []; } for (i = 0; i < that.p.columns.length; i++) { // but show only serchable and serchhidden = true fields var searchable = (typeof that.p.columns[i].search === 'undefined') ? true: that.p.columns[i].search , hidden = (that.p.columns[i].hidden === true), ignoreHiding = (that.p.columns[i].searchoptions.searchhidden === true); if ((ignoreHiding && searchable) || (searchable && !hidden)) { cm = that.p.columns[i]; break; } } var opr; if( cm.searchoptions.sopt ) {opr = cm.searchoptions.sopt;} else if(that.p.sopt) { opr= that.p.sopt; } else if (cm.searchtype === 'string') {opr = that.p.stropts;} else {opr = that.p.numopts;} group.rules.push({ field: cm.name, op: opr[0], data: "" }); // adding a new rule that.reDraw(); // the html has changed, force reDraw // for the moment no change have been made to the rule, so // this will not trigger onchange event return false; }); th.append(inputAddRule); } // button for delete the group if (parentgroup !== null) { // ignore the first group var inputDeleteGroup = $("<input type='button' value='-' title='Delete group' class='delete-group'/>"); th.append(inputDeleteGroup); inputDeleteGroup.bind('click',function() { // remove group from parent for (i = 0; i < parentgroup.groups.length; i++) { if (parentgroup.groups[i] === group) { parentgroup.groups.splice(i, 1); break; } } that.reDraw(); // the html has changed, force reDraw that.onchange(); // signals that the filter has changed return false; }); } // append subgroup rows if (group.groups !== undefined) { for (i = 0; i < group.groups.length; i++) { var trHolderForSubgroup = $("<tr></tr>"); table.append(trHolderForSubgroup); var tdFirstHolderForSubgroup = $("<td class='first'></td>"); trHolderForSubgroup.append(tdFirstHolderForSubgroup); var tdMainHolderForSubgroup = $("<td colspan='4'></td>"); tdMainHolderForSubgroup.append(this.createTableForGroup(group.groups[i], group)); trHolderForSubgroup.append(tdMainHolderForSubgroup); } } if(group.groupOp === undefined) { group.groupOp = that.p.groupOps[0].op; } // append rules rows if (group.rules !== undefined) { for (i = 0; i < group.rules.length; i++) { table.append( this.createTableRowForRule(group.rules[i], group) ); } } return table; }; /* * Create the rule data for the filter */ this.createTableRowForRule = function(rule, group ) { // save current entity in a variable so that it could // be referenced in anonimous method calls var that=this, tr = $("<tr></tr>"), //document.createElement("tr"), // first column used for padding //tdFirstHolderForRule = document.createElement("td"), i, op, trpar, cm, str="", selected; //tdFirstHolderForRule.setAttribute("class", "first"); tr.append("<td class='first'></td>"); // create field container var ruleFieldTd = $("<td class='columns'></td>"); tr.append(ruleFieldTd); // dropdown for: choosing field var ruleFieldSelect = $("<select></select>"), ina, aoprs = []; ruleFieldTd.append(ruleFieldSelect); ruleFieldSelect.bind('change',function() { rule.field = $(ruleFieldSelect).val(); trpar = $(this).parents("tr:first"); for (i=0;i<that.p.columns.length;i++) { if(that.p.columns[i].name === rule.field) { cm = that.p.columns[i]; break; } } if(!cm) {return;} cm.searchoptions.id = $.jgrid.randId(); if(isIE && cm.inputtype === "text") { if(!cm.searchoptions.size) { cm.searchoptions.size = 10; } } var elm = $.jgrid.createEl(cm.inputtype,cm.searchoptions, "", true, that.p.ajaxSelectOptions, true); $(elm).addClass("input-elm"); //that.createElement(rule, ""); if( cm.searchoptions.sopt ) {op = cm.searchoptions.sopt;} else if(that.p.sopt) { op= that.p.sopt; } else if (cm.searchtype === 'string') {op = that.p.stropts;} else {op = that.p.numopts;} // operators var s ="", so = 0; aoprs = []; $.each(that.p.ops, function() { aoprs.push(this.name) }); for ( i = 0 ; i < op.length; i++) { ina = $.inArray(op[i],aoprs); if(ina !== -1) { if(so===0) { rule.op = that.p.ops[ina].name; } s += "<option value='"+that.p.ops[ina].name+"'>"+that.p.ops[ina].description+"</option>"; so++; } } $(".selectopts",trpar).empty().append( s ); $(".selectopts",trpar)[0].selectedIndex = 0; if( $.browser.msie && $.browser.version < 9) { var sw = parseInt($("select.selectopts",trpar)[0].offsetWidth) + 1; $(".selectopts",trpar).width( sw ); $(".selectopts",trpar).css("width","auto"); } // data $(".data",trpar).empty().append( elm ); $(".input-elm",trpar).bind('change',function( e ) { var tmo = $(this).hasClass("ui-autocomplete-input") ? 200 :0; setTimeout(function(){ rule.data = e.target.value; that.onchange(); // signals that the filter has changed }, tmo); }); setTimeout(function(){ //IE, Opera, Chrome rule.data = $(elm).val(); that.onchange(); // signals that the filter has changed }, 0); }); // populate drop down with user provided column definitions var j=0; for (i = 0; i < that.p.columns.length; i++) { // but show only serchable and serchhidden = true fields var searchable = (typeof that.p.columns[i].search === 'undefined') ? true: that.p.columns[i].search , hidden = (that.p.columns[i].hidden === true), ignoreHiding = (that.p.columns[i].searchoptions.searchhidden === true); if ((ignoreHiding && searchable) || (searchable && !hidden)) { selected = ""; if(rule.field === that.p.columns[i].name) { selected = " selected='selected'"; j=i; } str += "<option value='"+that.p.columns[i].name+"'" +selected+">"+that.p.columns[i].label+"</option>"; } } ruleFieldSelect.append( str ); // create operator container var ruleOperatorTd = $("<td class='operators'></td>"); tr.append(ruleOperatorTd); cm = p.columns[j]; // create it here so it can be referentiated in the onchange event //var RD = that.createElement(rule, rule.data); cm.searchoptions.id = $.jgrid.randId(); if(isIE && cm.inputtype === "text") { if(!cm.searchoptions.size) { cm.searchoptions.size = 10; } } var ruleDataInput = $.jgrid.createEl(cm.inputtype,cm.searchoptions, rule.data, true, that.p.ajaxSelectOptions, true); // dropdown for: choosing operator var ruleOperatorSelect = $("<select class='selectopts'></select>"); ruleOperatorTd.append(ruleOperatorSelect); ruleOperatorSelect.bind('change',function() { rule.op = $(ruleOperatorSelect).val(); trpar = $(this).parents("tr:first"); var rd = $(".input-elm",trpar)[0]; if (rule.op === "nu" || rule.op === "nn") { // disable for operator "is null" and "is not null" rule.data = ""; rd.value = ""; rd.setAttribute("readonly", "true"); rd.setAttribute("disabled", "true"); } else { rd.removeAttribute("readonly"); rd.removeAttribute("disabled"); } that.onchange(); // signals that the filter has changed }); // populate drop down with all available operators if( cm.searchoptions.sopt ) {op = cm.searchoptions.sopt;} else if(that.p.sopt) { op= that.p.sopt; } else if (cm.searchtype === 'string') {op = p.stropts;} else {op = that.p.numopts;} str=""; $.each(that.p.ops, function() { aoprs.push(this.name) }); for ( i = 0; i < op.length; i++) { ina = $.inArray(op[i],aoprs); if(ina !== -1) { selected = rule.op === that.p.ops[ina].name ? " selected='selected'" : ""; str += "<option value='"+that.p.ops[ina].name+"'"+selected+">"+that.p.ops[ina].description+"</option>"; } } ruleOperatorSelect.append( str ); // create data container var ruleDataTd = $("<td class='data'></td>"); tr.append(ruleDataTd); // textbox for: data // is created previously //ruleDataInput.setAttribute("type", "text"); ruleDataTd.append(ruleDataInput); $(ruleDataInput) .addClass("input-elm") .bind('change', function() { rule.data = $(this).val(); that.onchange(); // signals that the filter has changed }); // create action container var ruleDeleteTd = $("<td></td>"); tr.append(ruleDeleteTd); // create button for: delete rule if(this.p.ruleButtons === true) { var ruleDeleteInput = $("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>"); ruleDeleteTd.append(ruleDeleteInput); //$(ruleDeleteInput).html("").height(20).width(30).button({icons: { primary: "ui-icon-minus", text:false}}); ruleDeleteInput.bind('click',function() { // remove rule from group for (i = 0; i < group.rules.length; i++) { if (group.rules[i] === rule) { group.rules.splice(i, 1); break; } } that.reDraw(); // the html has changed, force reDraw that.onchange(); // signals that the filter has changed return false; }); } return tr; }; this.getStringForGroup = function(group) { var s = "(", index; if (group.groups !== undefined) { for (index = 0; index < group.groups.length; index++) { if (s.length > 1) { s += " " + group.groupOp + " "; } try { s += this.getStringForGroup(group.groups[index]); } catch (eg) {alert(eg);} } } if (group.rules !== undefined) { try{ for (index = 0; index < group.rules.length; index++) { if (s.length > 1) { s += " " + group.groupOp + " "; } s += this.getStringForRule(group.rules[index]); } } catch (e) {alert(e);} } s += ")"; if (s === "()") { return ""; // ignore groups that don't have rules } else { return s; } }; this.getStringForRule = function(rule) { var opUF = "",opC="", i, cm, ret, val, numtypes = ['int', 'integer', 'float', 'number', 'currency']; // jqGrid for (i = 0; i < this.p.ops.length; i++) { if (this.p.ops[i].name === rule.op) { opUF = this.p.ops[i].operator; opC = this.p.ops[i].name; break; } } for (i=0; i<this.p.columns.length; i++) { if(this.p.columns[i].name === rule.field) { cm = this.p.columns[i]; break; } } val = rule.data; if(opC === 'bw' || opC === 'bn') { val = val+"%"; } if(opC === 'ew' || opC === 'en') { val = "%"+val; } if(opC === 'cn' || opC === 'nc') { val = "%"+val+"%"; } if(opC === 'in' || opC === 'ni') { val = " ("+val+")"; } if(p.errorcheck) { checkData(rule.data, cm); } if($.inArray(cm.searchtype, numtypes) !== -1 || opC === 'nn' || opC === 'nu') { ret = rule.field + " " + opUF + " " + val; } else { ret = rule.field + " " + opUF + " \"" + val + "\""; } return ret; }; this.resetFilter = function () { this.p.filter = $.extend(true,{},this.p.initFilter); this.reDraw(); this.onchange(); }; this.hideError = function() { $("th.ui-state-error", this).html(""); $("tr.error", this).hide(); }; this.showError = function() { $("th.ui-state-error", this).html(this.p.errmsg); $("tr.error", this).show(); }; this.toUserFriendlyString = function() { return this.getStringForGroup(p.filter); }; this.toString = function() { // this will obtain a string that can be used to match an item. var that = this; function getStringRule(rule) { if(that.p.errorcheck) { var i, cm; for (i=0; i<that.p.columns.length; i++) { if(that.p.columns[i].name === rule.field) { cm = that.p.columns[i]; break; } } if(cm) {checkData(rule.data, cm);} } return rule.op + "(item." + rule.field + ",'" + rule.data + "')"; } function getStringForGroup(group) { var s = "(", index; if (group.groups !== undefined) { for (index = 0; index < group.groups.length; index++) { if (s.length > 1) { if (group.groupOp === "OR") { s += " || "; } else { s += " && "; } } s += getStringForGroup(group.groups[index]); } } if (group.rules !== undefined) { for (index = 0; index < group.rules.length; index++) { if (s.length > 1) { if (group.groupOp === "OR") { s += " || "; } else { s += " && "; } } s += getStringRule(group.rules[index]); } } s += ")"; if (s === "()") { return ""; // ignore groups that don't have rules } else { return s; } } return getStringForGroup(this.p.filter); }; // Here we init the filter this.reDraw(); if(this.p.showQuery) { this.onchange(); } // mark is as created so that it will not be created twice on this element this.filter = true; }); }; $.extend($.fn.jqFilter,{ /* * Return SQL like string. Can be used directly */ toSQLString : function() { var s =""; this.each(function(){ s = this.toUserFriendlyString(); }); return s; }, /* * Return filter data as object. */ filterData : function() { var s; this.each(function(){ s = this.p.filter; }); return s; }, getParameter : function (param) { if(param !== undefined) { if (this.p.hasOwnProperty(param) ) { return this.p[param]; } } return this.p; }, resetFilter: function() { return this.each(function(){ this.resetFilter(); }); }, addFilter: function (pfilter) { if (typeof pfilter === "string") { pfilter = jQuery.jgrid.parse( pfilter ); } this.each(function(){ this.p.filter = pfilter; this.reDraw(); this.onchange(); }); } }); })(jQuery); (function($){ /** * jqGrid extension for form editing Grid Data * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html **/ "use strict"; /*global xmlJsonClass, jQuery, $ */ var rp_ge = {}; $.jgrid.extend({ searchGrid : function (p) { p = $.extend({ recreateFilter: false, drag: true, sField:'searchField', sValue:'searchString', sOper: 'searchOper', sFilter: 'filters', loadDefaults: true, // this options activates loading of default filters from grid's postData for Multipe Search only. beforeShowSearch: null, afterShowSearch : null, onInitializeSearch: null, afterRedraw : null, closeAfterSearch : false, closeAfterReset: false, closeOnEscape : false, multipleSearch : false, multipleGroup : false, //cloneSearchRowOnAdd: true, top : 0, left: 0, jqModal : true, modal: false, resize : true, width: 450, height: 'auto', dataheight: 'auto', showQuery: false, errorcheck : true, // translation // if you want to change or remove the order change it in sopt // ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc'], sopt: null, stringResult: undefined, onClose : null, onSearch : null, onReset : null, toTop : true, overlay : 30, columns : [], tmplNames : null, tmplFilters : null, // translations - later in lang file tmplLabel : ' Template: ', showOnLoad: false, layer: null }, $.jgrid.search, p || {}); return this.each(function() { var $t = this; if(!$t.grid) {return;} var fid = "fbox_"+$t.p.id, showFrm = true, IDs = {themodal:'searchmod'+fid,modalhead:'searchhd'+fid,modalcontent:'searchcnt'+fid, scrollelm : fid}, defaultFilters = $t.p.postData[p.sFilter], _filter = $("#"+$.jgrid.jqID(fid)); if(typeof(defaultFilters) === "string") { defaultFilters = $.jgrid.parse( defaultFilters ); } if(p.recreateFilter === true) { $("#"+$.jgrid.jqID(IDs.themodal)).remove(); } function showFilter() { showFrm = $($t).triggerHandler("jqGridFilterBeforeShow", [_filter]); if(typeof(showFrm) === "undefined") { showFrm = true; } if(showFrm && $.isFunction(p.beforeShowSearch)) { showFrm = p.beforeShowSearch.call($t,_filter); } if(showFrm) { $.jgrid.viewModal("#"+$.jgrid.jqID(IDs.themodal),{gbox:"#gbox_"+$.jgrid.jqID(fid),jqm:p.jqModal, modal:p.modal, overlay: p.overlay, toTop: p.toTop}); $($t).triggerHandler("jqGridFilterAfterShow", [_filter]); if($.isFunction(p.afterShowSearch)) { p.afterShowSearch.call($t, _filter); } } } if ( $("#"+$.jgrid.jqID(IDs.themodal)).html() !== null ) { showFilter(); } else { var fil = $("<div><div id='"+fid+"' class='searchFilter' style='overflow:auto'></div></div>").insertBefore("#gview_"+$.jgrid.jqID($t.p.id)), align = "left", butleft =""; if($t.p.direction == "rtl") { align = "right"; butleft = " style='text-align:left'"; fil.attr("dir","rtl"); } var columns = $.extend([],$t.p.colModel), bS ="<a href='javascript:void(0)' id='"+fid+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>"+p.Find+"</a>", bC ="<a href='javascript:void(0)' id='"+fid+"_reset' class='fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search'><span class='ui-icon ui-icon-arrowreturnthick-1-w'></span>"+p.Reset+"</a>", bQ = "", tmpl="", colnm, found = false, bt, cmi=-1; if(p.showQuery) { bQ ="<a href='javascript:void(0)' id='"+fid+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>"; } if(!p.columns.length) { $.each(columns, function(i,n){ if(!n.label) { n.label = $t.p.colNames[i]; } // find first searchable column and set it if no default filter if(!found) { var searchable = (typeof n.search === 'undefined') ? true: n.search , hidden = (n.hidden === true), ignoreHiding = (n.searchoptions && n.searchoptions.searchhidden === true); if ((ignoreHiding && searchable) || (searchable && !hidden)) { found = true; colnm = n.index || n.name; cmi =i; } } }); } else { columns = p.columns; } // old behaviour if( (!defaultFilters && colnm) || p.multipleSearch === false ) { var cmop = "eq"; if(cmi >=0 && columns[cmi].searchoptions && columns[cmi].searchoptions.sopt) { cmop = columns[cmi].searchoptions.sopt[0]; } else if(p.sopt && p.sopt.length) { cmop = p.sopt[0]; } defaultFilters = {"groupOp": "AND",rules:[{"field":colnm,"op":cmop,"data":""}]}; } found = false; if(p.tmplNames && p.tmplNames.length) { found = true; tmpl = p.tmplLabel; tmpl += "<select class='ui-template'>"; tmpl += "<option value='default'>Default</option>"; $.each(p.tmplNames, function(i,n){ tmpl += "<option value='"+i+"'>"+n+"</option>"; }); tmpl += "</select>"; } bt = "<table class='EditTable' style='border:0px none;margin-top:5px' id='"+fid+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:"+align+"'>"+bC+tmpl+"</td><td class='EditButton' "+butleft+">"+bQ+bS+"</td></tr></tbody></table>"; fid = $.jgrid.jqID( fid); $("#"+fid).jqFilter({ columns : columns, filter: p.loadDefaults ? defaultFilters : null, showQuery: p.showQuery, errorcheck : p.errorcheck, sopt: p.sopt, groupButton : p.multipleGroup, ruleButtons : p.multipleSearch, afterRedraw : p.afterRedraw, _gridsopt : $.jgrid.search.odata, ajaxSelectOptions: $t.p.ajaxSelectOptions, groupOps: p.groupOps, onChange : function() { if(this.p.showQuery) { $('.query',this).html(this.toUserFriendlyString()); } }, direction : $t.p.direction }); fil.append( bt ); if(found && p.tmplFilters && p.tmplFilters.length) { $(".ui-template", fil).bind('change', function(){ var curtempl = $(this).val(); if(curtempl=="default") { $("#"+fid).jqFilter('addFilter', defaultFilters); } else { $("#"+fid).jqFilter('addFilter', p.tmplFilters[parseInt(curtempl,10)]); } return false; }); } if(p.multipleGroup === true) {p.multipleSearch = true;} $($t).triggerHandler("jqGridFilterInitialize", [$("#"+fid)]); if($.isFunction(p.onInitializeSearch) ) { p.onInitializeSearch.call($t, $("#"+fid)); } p.gbox = "#gbox_"+fid; if (p.layer) { $.jgrid.createModal(IDs ,fil,p,"#gview_"+$.jgrid.jqID($t.p.id),$("#gbox_"+$.jgrid.jqID($t.p.id))[0], "#"+$.jgrid.jqID(p.layer), {position: "relative"}); } else { $.jgrid.createModal(IDs ,fil,p,"#gview_"+$.jgrid.jqID($t.p.id),$("#gbox_"+$.jgrid.jqID($t.p.id))[0]); } if(bQ) { $("#"+fid+"_query").bind('click', function(){ $(".queryresult", fil).toggle(); return false; }); } if (p.stringResult===undefined) { // to provide backward compatibility, inferring stringResult value from multipleSearch p.stringResult = p.multipleSearch; } $("#"+fid+"_search").bind('click', function(){ var fl = $("#"+fid), sdata={}, res , filters = fl.jqFilter('filterData'); if(p.errorcheck) { fl[0].hideError(); if(!p.showQuery) {fl.jqFilter('toSQLString');} if(fl[0].p.error) { fl[0].showError(); return false; } } if(p.stringResult) { try { // xmlJsonClass or JSON.stringify res = xmlJsonClass.toJson(filters, '', '', false); } catch (e) { try { res = JSON.stringify(filters); } catch (e2) { } } if(typeof(res)==="string") { sdata[p.sFilter] = res; $.each([p.sField,p.sValue, p.sOper], function() {sdata[this] = "";}); } } else { if(p.multipleSearch) { sdata[p.sFilter] = filters; $.each([p.sField,p.sValue, p.sOper], function() {sdata[this] = "";}); } else { sdata[p.sField] = filters.rules[0].field; sdata[p.sValue] = filters.rules[0].data; sdata[p.sOper] = filters.rules[0].op; sdata[p.sFilter] = ""; } } $t.p.search = true; $.extend($t.p.postData,sdata); $($t).triggerHandler("jqGridFilterSearch"); if($.isFunction(p.onSearch) ) { p.onSearch.call($t); } $($t).trigger("reloadGrid",[{page:1}]); if(p.closeAfterSearch) { $.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID($t.p.id),jqm:p.jqModal,onClose: p.onClose}); } return false; }); $("#"+fid+"_reset").bind('click', function(){ var sdata={}, fl = $("#"+fid); $t.p.search = false; if(p.multipleSearch===false) { sdata[p.sField] = sdata[p.sValue] = sdata[p.sOper] = ""; } else { sdata[p.sFilter] = ""; } fl[0].resetFilter(); if(found) { $(".ui-template", fil).val("default"); } $.extend($t.p.postData,sdata); $($t).triggerHandler("jqGridFilterReset"); if($.isFunction(p.onReset) ) { p.onReset.call($t); } $($t).trigger("reloadGrid",[{page:1}]); return false; }); showFilter(); $(".fm-button:not(.ui-state-disabled)",fil).hover( function(){$(this).addClass('ui-state-hover');}, function(){$(this).removeClass('ui-state-hover');} ); } }); }, editGridRow : function(rowid, p){ p = $.extend({ top : 0, left: 0, width: 300, height: 'auto', dataheight: 'auto', modal: false, overlay : 30, drag: true, resize: true, url: null, mtype : "POST", clearAfterAdd :true, closeAfterEdit : false, reloadAfterSubmit : true, onInitializeForm: null, beforeInitData: null, beforeShowForm: null, afterShowForm: null, beforeSubmit: null, afterSubmit: null, onclickSubmit: null, afterComplete: null, onclickPgButtons : null, afterclickPgButtons: null, editData : {}, recreateForm : false, jqModal : true, closeOnEscape : false, addedrow : "first", topinfo : '', bottominfo: '', saveicon : [], closeicon : [], savekey: [false,13], navkeys: [false,38,40], checkOnSubmit : false, checkOnUpdate : false, _savedData : {}, processing : false, onClose : null, ajaxEditOptions : {}, serializeEditData : null, viewPagerButtons : true }, $.jgrid.edit, p || {}); rp_ge[$(this)[0].p.id] = p; return this.each(function(){ var $t = this; if (!$t.grid || !rowid) {return;} var gID = $t.p.id, frmgr = "FrmGrid_"+gID, frmtborg = "TblGrid_"+gID, frmtb = "#"+$.jgrid.jqID(frmtborg), IDs = {themodal:'editmod'+gID,modalhead:'edithd'+gID,modalcontent:'editcnt'+gID, scrollelm : frmgr}, onBeforeShow = $.isFunction(rp_ge[$t.p.id].beforeShowForm) ? rp_ge[$t.p.id].beforeShowForm : false, onAfterShow = $.isFunction(rp_ge[$t.p.id].afterShowForm) ? rp_ge[$t.p.id].afterShowForm : false, onBeforeInit = $.isFunction(rp_ge[$t.p.id].beforeInitData) ? rp_ge[$t.p.id].beforeInitData : false, onInitializeForm = $.isFunction(rp_ge[$t.p.id].onInitializeForm) ? rp_ge[$t.p.id].onInitializeForm : false, showFrm = true, maxCols = 1, maxRows=0, postdata, extpost, newData, diff, frmoper; frmgr = $.jgrid.jqID(frmgr); if (rowid === "new") { rowid = "_empty"; frmoper = "add"; p.caption=rp_ge[$t.p.id].addCaption; } else { p.caption=rp_ge[$t.p.id].editCaption; frmoper = "edit"; } if(p.recreateForm===true && $("#"+$.jgrid.jqID(IDs.themodal)).html() !== null) { $("#"+$.jgrid.jqID(IDs.themodal)).remove(); } var closeovrl = true; if(p.checkOnUpdate && p.jqModal && !p.modal) { closeovrl = false; } function getFormData(){ $(frmtb+" > tbody > tr > td > .FormElement").each(function() { var celm = $(".customelement", this); if (celm.length) { var elem = celm[0], nm = $(elem).attr('name'); $.each($t.p.colModel, function(){ if(this.name === nm && this.editoptions && $.isFunction(this.editoptions.custom_value)) { try { postdata[nm] = this.editoptions.custom_value.call($t, $("#"+$.jgrid.jqID(nm),frmtb),'get'); if (postdata[nm] === undefined) {throw "e1";} } catch (e) { if (e==="e1") {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose);} else {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose);} } return true; } }); } else { switch ($(this).get(0).type) { case "checkbox": if($(this).is(":checked")) { postdata[this.name]= $(this).val(); }else { var ofv = $(this).attr("offval"); postdata[this.name]= ofv; } break; case "select-one": postdata[this.name]= $("option:selected",this).val(); extpost[this.name]= $("option:selected",this).text(); break; case "select-multiple": postdata[this.name]= $(this).val(); if(postdata[this.name]) {postdata[this.name] = postdata[this.name].join(",");} else {postdata[this.name] ="";} var selectedText = []; $("option:selected",this).each( function(i,selected){ selectedText[i] = $(selected).text(); } ); extpost[this.name]= selectedText.join(","); break; case "password": case "text": case "textarea": case "button": postdata[this.name] = $(this).val(); break; } if($t.p.autoencode) {postdata[this.name] = $.jgrid.htmlEncode(postdata[this.name]);} } }); return true; } function createData(rowid,obj,tb,maxcols){ var nm, hc,trdata, cnt=0,tmp, dc,elc, retpos=[], ind=false, tdtmpl = "<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>", tmpl="", i; //*2 for (i =1; i<=maxcols;i++) { tmpl += tdtmpl; } if(rowid != '_empty') { ind = $(obj).jqGrid("getInd",rowid); } $(obj.p.colModel).each( function(i) { nm = this.name; // hidden fields are included in the form if(this.editrules && this.editrules.edithidden === true) { hc = false; } else { hc = this.hidden === true ? true : false; } dc = hc ? "style='display:none'" : ""; if ( nm !== 'cb' && nm !== 'subgrid' && this.editable===true && nm !== 'rn') { if(ind === false) { tmp = ""; } else { if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) { tmp = $("td:eq("+i+")",obj.rows[ind]).text(); } else { try { tmp = $.unformat.call(obj, $("td:eq("+i+")",obj.rows[ind]),{rowId:rowid, colModel:this},i); } catch (_) { tmp = (this.edittype && this.edittype == "textarea") ? $("td:eq("+i+")",obj.rows[ind]).text() : $("td:eq("+i+")",obj.rows[ind]).html(); } if(!tmp || tmp == "&nbsp;" || tmp == "&#160;" || (tmp.length==1 && tmp.charCodeAt(0)==160) ) {tmp='';} } } var opt = $.extend({}, this.editoptions || {} ,{id:nm,name:nm}), frmopt = $.extend({}, {elmprefix:'',elmsuffix:'',rowabove:false,rowcontent:''}, this.formoptions || {}), rp = parseInt(frmopt.rowpos,10) || cnt+1, cp = parseInt((parseInt(frmopt.colpos,10) || 1)*2,10); if(rowid == "_empty" && opt.defaultValue ) { tmp = $.isFunction(opt.defaultValue) ? opt.defaultValue() : opt.defaultValue; } if(!this.edittype) {this.edittype = "text";} if($t.p.autoencode) {tmp = $.jgrid.htmlDecode(tmp);} elc = $.jgrid.createEl(this.edittype,opt,tmp,false,$.extend({},$.jgrid.ajaxOptions,obj.p.ajaxSelectOptions || {})); if(tmp === "" && this.edittype == "checkbox") {tmp = $(elc).attr("offval");} if(tmp === "" && this.edittype == "select") {tmp = $("option:eq(0)",elc).text();} if(rp_ge[$t.p.id].checkOnSubmit || rp_ge[$t.p.id].checkOnUpdate) {rp_ge[$t.p.id]._savedData[nm] = tmp;} $(elc).addClass("FormElement"); if(this.edittype == 'text' || this.edittype == 'textarea') { $(elc).addClass("ui-widget-content ui-corner-all"); } trdata = $(tb).find("tr[rowpos="+rp+"]"); if(frmopt.rowabove) { var newdata = $("<tr><td class='contentinfo' colspan='"+(maxcols*2)+"'>"+frmopt.rowcontent+"</td></tr>"); $(tb).append(newdata); newdata[0].rp = rp; } if ( trdata.length===0 ) { trdata = $("<tr "+dc+" rowpos='"+rp+"'></tr>").addClass("FormData").attr("id","tr_"+nm); $(trdata).append(tmpl); $(tb).append(trdata); trdata[0].rp = rp; } $("td:eq("+(cp-2)+")",trdata[0]).html( typeof frmopt.label === 'undefined' ? obj.p.colNames[i]: frmopt.label); $("td:eq("+(cp-1)+")",trdata[0]).append(frmopt.elmprefix).append(elc).append(frmopt.elmsuffix); retpos[cnt] = i; cnt++; } }); if( cnt > 0) { var idrow = $("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+ (maxcols*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+obj.p.id+"_id' value='"+rowid+"'/></td></tr>"); idrow[0].rp = cnt+999; $(tb).append(idrow); if(rp_ge[$t.p.id].checkOnSubmit || rp_ge[$t.p.id].checkOnUpdate) {rp_ge[$t.p.id]._savedData[obj.p.id+"_id"] = rowid;} } return retpos; } function fillData(rowid,obj,fmid){ var nm,cnt=0,tmp, fld,opt,vl,vlc; if(rp_ge[$t.p.id].checkOnSubmit || rp_ge[$t.p.id].checkOnUpdate) {rp_ge[$t.p.id]._savedData = {};rp_ge[$t.p.id]._savedData[obj.p.id+"_id"]=rowid;} var cm = obj.p.colModel; if(rowid == '_empty') { $(cm).each(function(){ nm = this.name; opt = $.extend({}, this.editoptions || {} ); fld = $("#"+$.jgrid.jqID(nm),"#"+fmid); if(fld && fld.length && fld[0] !== null) { vl = ""; if(opt.defaultValue ) { vl = $.isFunction(opt.defaultValue) ? opt.defaultValue() : opt.defaultValue; if(fld[0].type=='checkbox') { vlc = vl.toLowerCase(); if(vlc.search(/(false|0|no|off|undefined)/i)<0 && vlc!=="") { fld[0].checked = true; fld[0].defaultChecked = true; fld[0].value = vl; } else { fld[0].checked = false; fld[0].defaultChecked = false; } } else {fld.val(vl);} } else { if( fld[0].type=='checkbox' ) { fld[0].checked = false; fld[0].defaultChecked = false; vl = $(fld).attr("offval"); } else if (fld[0].type && fld[0].type.substr(0,6)=='select') { fld[0].selectedIndex = 0; } else { fld.val(vl); } } if(rp_ge[$t.p.id].checkOnSubmit===true || rp_ge[$t.p.id].checkOnUpdate) {rp_ge[$t.p.id]._savedData[nm] = vl;} } }); $("#id_g","#"+fmid).val(rowid); return; } var tre = $(obj).jqGrid("getInd",rowid,true); if(!tre) {return;} $('td[role="gridcell"]',tre).each( function(i) { nm = cm[i].name; // hidden fields are included in the form if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn' && cm[i].editable===true) { if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) { tmp = $(this).text(); } else { try { tmp = $.unformat.call(obj, $(this),{rowId:rowid, colModel:cm[i]},i); } catch (_) { tmp = cm[i].edittype=="textarea" ? $(this).text() : $(this).html(); } } if($t.p.autoencode) {tmp = $.jgrid.htmlDecode(tmp);} if(rp_ge[$t.p.id].checkOnSubmit===true || rp_ge[$t.p.id].checkOnUpdate) {rp_ge[$t.p.id]._savedData[nm] = tmp;} nm = $.jgrid.jqID(nm); switch (cm[i].edittype) { case "password": case "text": case "button" : case "image": case "textarea": if(tmp == "&nbsp;" || tmp == "&#160;" || (tmp.length==1 && tmp.charCodeAt(0)==160) ) {tmp='';} $("#"+nm,"#"+fmid).val(tmp); break; case "select": var opv = tmp.split(","); opv = $.map(opv,function(n){return $.trim(n);}); $("#"+nm+" option","#"+fmid).each(function(){ if (!cm[i].editoptions.multiple && ($.trim(tmp) == $.trim($(this).text()) || opv[0] == $.trim($(this).text()) || opv[0] == $.trim($(this).val())) ){ this.selected= true; } else if (cm[i].editoptions.multiple){ if( $.inArray($.trim($(this).text()), opv ) > -1 || $.inArray($.trim($(this).val()), opv ) > -1 ){ this.selected = true; }else{ this.selected = false; } } else { this.selected = false; } }); break; case "checkbox": tmp = tmp+""; if(cm[i].editoptions && cm[i].editoptions.value) { var cb = cm[i].editoptions.value.split(":"); if(cb[0] == tmp) { $("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("checked",true); $("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("defaultChecked",true); //ie } else { $("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("checked", false); $("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("defaultChecked", false); //ie } } else { tmp = tmp.toLowerCase(); if(tmp.search(/(false|0|no|off|undefined)/i)<0 && tmp!=="") { $("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("checked",true); $("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("defaultChecked",true); //ie } else { $("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("checked", false); $("#"+nm,"#"+fmid)[$t.p.useProp ? 'prop': 'attr']("defaultChecked", false); //ie } } break; case 'custom' : try { if(cm[i].editoptions && $.isFunction(cm[i].editoptions.custom_value)) { cm[i].editoptions.custom_value.call($t, $("#"+nm,"#"+fmid),'set',tmp); } else {throw "e1";} } catch (e) { if (e=="e1") {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);} else {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose);} } break; } cnt++; } }); if(cnt>0) {$("#id_g",frmtb).val(rowid);} } function setNulls() { $.each($t.p.colModel, function(i,n){ if(n.editoptions && n.editoptions.NullIfEmpty === true) { if(postdata.hasOwnProperty(n.name) && postdata[n.name] === "") { postdata[n.name] = 'null'; } } }); } function postIt() { var copydata, ret=[true,"",""], onCS = {}, opers = $t.p.prmNames, idname, oper, key, selr, i; var retvals = $($t).triggerHandler("jqGridAddEditBeforeCheckValues", [$("#"+frmgr), frmoper]); if(retvals && typeof(retvals) === 'object') {postdata = retvals;} if($.isFunction(rp_ge[$t.p.id].beforeCheckValues)) { retvals = rp_ge[$t.p.id].beforeCheckValues.call($t, postdata,$("#"+frmgr),postdata[$t.p.id+"_id"] == "_empty" ? opers.addoper : opers.editoper); if(retvals && typeof(retvals) === 'object') {postdata = retvals;} } for( key in postdata ){ if(postdata.hasOwnProperty(key)) { ret = $.jgrid.checkValues(postdata[key],key,$t); if(ret[0] === false) {break;} } } setNulls(); if(ret[0]) { onCS = $($t).triggerHandler("jqGridAddEditClickSubmit", [rp_ge[$t.p.id], postdata, frmoper]); if( onCS === undefined && $.isFunction( rp_ge[$t.p.id].onclickSubmit)) { onCS = rp_ge[$t.p.id].onclickSubmit.call($t, rp_ge[$t.p.id], postdata) || {}; } ret = $($t).triggerHandler("jqGridAddEditBeforeSubmit", [postdata, $("#"+frmgr), frmoper]); if(ret === undefined) { ret = [true,"",""]; } if( ret[0] && $.isFunction(rp_ge[$t.p.id].beforeSubmit)) { ret = rp_ge[$t.p.id].beforeSubmit(postdata,$("#"+frmgr)); } } if(ret[0] && !rp_ge[$t.p.id].processing) { rp_ge[$t.p.id].processing = true; $("#sData", frmtb+"_2").addClass('ui-state-active'); oper = opers.oper; idname = opers.id; // we add to pos data array the action - the name is oper postdata[oper] = ($.trim(postdata[$t.p.id+"_id"]) == "_empty") ? opers.addoper : opers.editoper; if(postdata[oper] != opers.addoper) { postdata[idname] = postdata[$t.p.id+"_id"]; } else { // check to see if we have allredy this field in the form and if yes lieve it if( postdata[idname] === undefined ) {postdata[idname] = postdata[$t.p.id+"_id"];} } delete postdata[$t.p.id+"_id"]; postdata = $.extend(postdata,rp_ge[$t.p.id].editData,onCS); if($t.p.treeGrid === true) { if(postdata[oper] == opers.addoper) { selr = $($t).jqGrid("getGridParam", 'selrow'); var tr_par_id = $t.p.treeGridModel == 'adjacency' ? $t.p.treeReader.parent_id_field : 'parent_id'; postdata[tr_par_id] = selr; } for(i in $t.p.treeReader){ if($t.p.treeReader.hasOwnProperty(i)) { var itm = $t.p.treeReader[i]; if(postdata.hasOwnProperty(itm)) { if(postdata[oper] == opers.addoper && i === 'parent_id_field') {continue;} delete postdata[itm]; } } } } postdata[idname] = $.jgrid.stripPref($t.p.idPrefix, postdata[idname]); var ajaxOptions = $.extend({ url: rp_ge[$t.p.id].url ? rp_ge[$t.p.id].url : $($t).jqGrid('getGridParam','editurl'), type: rp_ge[$t.p.id].mtype, data: $.isFunction(rp_ge[$t.p.id].serializeEditData) ? rp_ge[$t.p.id].serializeEditData(postdata) : postdata, complete:function(data,Status){ postdata[idname] = $t.p.idPrefix + postdata[idname]; if(Status != "success") { ret[0] = false; ret[1] = $($t).triggerHandler("jqGridAddEditErrorTextFormat", [data, frmoper]); if ($.isFunction(rp_ge[$t.p.id].errorTextFormat)) { ret[1] = rp_ge[$t.p.id].errorTextFormat.call($t, data); } else { ret[1] = Status + " Status: '" + data.statusText + "'. Error code: " + data.status; } } else { // data is posted successful // execute aftersubmit with the returned data from server ret = $($t).triggerHandler("jqGridAddEditAfterSubmit", [data, postdata, frmoper]); if(ret === undefined) { ret = [true,"",""]; } if( ret[0] && $.isFunction(rp_ge[$t.p.id].afterSubmit) ) { ret = rp_ge[$t.p.id].afterSubmit.call($t, data,postdata); } } if(ret[0] === false) { $("#FormError>td",frmtb).html(ret[1]); $("#FormError",frmtb).show(); } else { // remove some values if formattaer select or checkbox $.each($t.p.colModel, function(){ if(extpost[this.name] && this.formatter && this.formatter=='select') { try {delete extpost[this.name];} catch (e) {} } }); postdata = $.extend(postdata,extpost); if($t.p.autoencode) { $.each(postdata,function(n,v){ postdata[n] = $.jgrid.htmlDecode(v); }); } //rp_ge[$t.p.id].reloadAfterSubmit = rp_ge[$t.p.id].reloadAfterSubmit && $t.p.datatype != "local"; // the action is add if(postdata[oper] == opers.addoper ) { //id processing // user not set the id ret[2] if(!ret[2]) {ret[2] = $.jgrid.randId();} postdata[idname] = ret[2]; if(rp_ge[$t.p.id].closeAfterAdd) { if(rp_ge[$t.p.id].reloadAfterSubmit) {$($t).trigger("reloadGrid");} else { if($t.p.treeGrid === true){ $($t).jqGrid("addChildNode",ret[2],selr,postdata ); } else { $($t).jqGrid("addRowData",ret[2],postdata,p.addedrow); $($t).jqGrid("setSelection",ret[2]); } } $.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal,onClose: rp_ge[$t.p.id].onClose}); } else if (rp_ge[$t.p.id].clearAfterAdd) { if(rp_ge[$t.p.id].reloadAfterSubmit) {$($t).trigger("reloadGrid");} else { if($t.p.treeGrid === true){ $($t).jqGrid("addChildNode",ret[2],selr,postdata ); } else { $($t).jqGrid("addRowData",ret[2],postdata,p.addedrow); } } fillData("_empty",$t,frmgr); } else { if(rp_ge[$t.p.id].reloadAfterSubmit) {$($t).trigger("reloadGrid");} else { if($t.p.treeGrid === true){ $($t).jqGrid("addChildNode",ret[2],selr,postdata ); } else { $($t).jqGrid("addRowData",ret[2],postdata,p.addedrow); } } } } else { // the action is update if(rp_ge[$t.p.id].reloadAfterSubmit) { $($t).trigger("reloadGrid"); if( !rp_ge[$t.p.id].closeAfterEdit ) {setTimeout(function(){$($t).jqGrid("setSelection",postdata[idname]);},1000);} } else { if($t.p.treeGrid === true) { $($t).jqGrid("setTreeRow", postdata[idname],postdata); } else { $($t).jqGrid("setRowData", postdata[idname],postdata); } } if(rp_ge[$t.p.id].closeAfterEdit) {$.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal,onClose: rp_ge[$t.p.id].onClose});} } if($.isFunction(rp_ge[$t.p.id].afterComplete)) { copydata = data; setTimeout(function(){ $($t).triggerHandler("jqGridAddEditAfterComplete", [copydata, postdata, $("#"+frmgr), frmoper]); rp_ge[$t.p.id].afterComplete.call($t, copydata, postdata, $("#"+frmgr)); copydata=null; },500); } if(rp_ge[$t.p.id].checkOnSubmit || rp_ge[$t.p.id].checkOnUpdate) { $("#"+frmgr).data("disabled",false); if(rp_ge[$t.p.id]._savedData[$t.p.id+"_id"] !="_empty"){ for(var key in rp_ge[$t.p.id]._savedData) { if(postdata[key]) { rp_ge[$t.p.id]._savedData[key] = postdata[key]; } } } } } rp_ge[$t.p.id].processing=false; $("#sData", frmtb+"_2").removeClass('ui-state-active'); try{$(':input:visible',"#"+frmgr)[0].focus();} catch (e){} } }, $.jgrid.ajaxOptions, rp_ge[$t.p.id].ajaxEditOptions ); if (!ajaxOptions.url && !rp_ge[$t.p.id].useDataProxy) { if ($.isFunction($t.p.dataProxy)) { rp_ge[$t.p.id].useDataProxy = true; } else { ret[0]=false;ret[1] += " "+$.jgrid.errors.nourl; } } if (ret[0]) { if (rp_ge[$t.p.id].useDataProxy) { var dpret = $t.p.dataProxy.call($t, ajaxOptions, "set_"+$t.p.id); if(typeof(dpret) == "undefined") { dpret = [true, ""]; } if(dpret[0] === false ) { ret[0] = false; ret[1] = dpret[1] || "Error deleting the selected row!" ; } else { if(ajaxOptions.data.oper == opers.addoper && rp_ge[$t.p.id].closeAfterAdd ) { $.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose}); } if(ajaxOptions.data.oper == opers.editoper && rp_ge[$t.p.id].closeAfterEdit ) { $.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose}); } } } else { $.ajax(ajaxOptions); } } } if(ret[0] === false) { $("#FormError>td",frmtb).html(ret[1]); $("#FormError",frmtb).show(); // return; } } function compareData(nObj, oObj ) { var ret = false,key; for (key in nObj) { if(nObj[key] != oObj[key]) { ret = true; break; } } return ret; } function checkUpdates () { var stat = true; $("#FormError",frmtb).hide(); if(rp_ge[$t.p.id].checkOnUpdate) { postdata = {};extpost={}; getFormData(); newData = $.extend({},postdata,extpost); diff = compareData(newData,rp_ge[$t.p.id]._savedData); if(diff) { $("#"+frmgr).data("disabled",true); $(".confirm","#"+IDs.themodal).show(); stat = false; } } return stat; } function restoreInline() { if (rowid !== "_empty" && typeof($t.p.savedRow) !== "undefined" && $t.p.savedRow.length > 0 && $.isFunction($.fn.jqGrid.restoreRow)) { for (var i=0;i<$t.p.savedRow.length;i++) { if ($t.p.savedRow[i].id == rowid) { $($t).jqGrid('restoreRow',rowid); break; } } } } function updateNav(cr,totr){ if (cr===0) {$("#pData",frmtb+"_2").addClass('ui-state-disabled');} else {$("#pData",frmtb+"_2").removeClass('ui-state-disabled');} if (cr==totr) {$("#nData",frmtb+"_2").addClass('ui-state-disabled');} else {$("#nData",frmtb+"_2").removeClass('ui-state-disabled');} } function getCurrPos() { var rowsInGrid = $($t).jqGrid("getDataIDs"), selrow = $("#id_g",frmtb).val(), pos = $.inArray(selrow,rowsInGrid); return [pos,rowsInGrid]; } if ( $("#"+$.jgrid.jqID(IDs.themodal)).html() !== null ) { showFrm = $($t).triggerHandler("jqGridAddEditBeforeInitData", [$("#"+$.jgrid.jqID(frmgr))]); if(typeof(showFrm) == "undefined") { showFrm = true; } if(showFrm && onBeforeInit) { showFrm = onBeforeInit.call($t, $("#"+frmgr)); } if(showFrm === false) {return;} restoreInline(); $(".ui-jqdialog-title","#"+$.jgrid.jqID(IDs.modalhead)).html(p.caption); $("#FormError",frmtb).hide(); if(rp_ge[$t.p.id].topinfo) { $(".topinfo",frmtb).html(rp_ge[$t.p.id].topinfo); $(".tinfo",frmtb).show(); } else { $(".tinfo",frmtb).hide(); } if(rp_ge[$t.p.id].bottominfo) { $(".bottominfo",frmtb+"_2").html(rp_ge[$t.p.id].bottominfo); $(".binfo",frmtb+"_2").show(); } else { $(".binfo",frmtb+"_2").hide(); } // filldata fillData(rowid,$t,frmgr); /// if(rowid=="_empty" || !rp_ge[$t.p.id].viewPagerButtons) { $("#pData, #nData",frmtb+"_2").hide(); } else { $("#pData, #nData",frmtb+"_2").show(); } if(rp_ge[$t.p.id].processing===true) { rp_ge[$t.p.id].processing=false; $("#sData", frmtb+"_2").removeClass('ui-state-active'); } if($("#"+frmgr).data("disabled")===true) { $(".confirm","#"+$.jgrid.jqID(IDs.themodal)).hide(); $("#"+frmgr).data("disabled",false); } $($t).triggerHandler("jqGridAddEditBeforeShowForm", [$("#"+frmgr), frmoper]); if(onBeforeShow) { onBeforeShow.call($t, $("#"+frmgr)); } $("#"+$.jgrid.jqID(IDs.themodal)).data("onClose",rp_ge[$t.p.id].onClose); $.jgrid.viewModal("#"+$.jgrid.jqID(IDs.themodal),{gbox:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal, jqM: false, overlay: p.overlay, modal:p.modal}); if(!closeovrl) { $(".jqmOverlay").click(function(){ if(!checkUpdates()) {return false;} $.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose}); return false; }); } $($t).triggerHandler("jqGridAddEditAfterShowForm", [$("#"+frmgr), frmoper]); if(onAfterShow) { onAfterShow.call($t, $("#"+frmgr)); } } else { var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px", frm = $("<form name='FormPost' id='"+frmgr+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+dh+";'></form>").data("disabled",false), tbl = $("<table id='"+frmtborg+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"); showFrm = $($t).triggerHandler("jqGridAddEditBeforeInitData", [$("#"+frmgr), frmoper]); if(typeof(showFrm) == "undefined") { showFrm = true; } if(showFrm && onBeforeInit) { showFrm = onBeforeInit.call($t, $("#"+frmgr)); } if(showFrm === false) {return;} restoreInline(); $($t.p.colModel).each( function() { var fmto = this.formoptions; maxCols = Math.max(maxCols, fmto ? fmto.colpos || 0 : 0 ); maxRows = Math.max(maxRows, fmto ? fmto.rowpos || 0 : 0 ); }); $(frm).append(tbl); var flr = $("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+(maxCols*2)+"'></td></tr>"); flr[0].rp = 0; $(tbl).append(flr); //topinfo flr = $("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+(maxCols*2)+"'>"+rp_ge[$t.p.id].topinfo+"</td></tr>"); flr[0].rp = 0; $(tbl).append(flr); // set the id. // use carefull only to change here colproperties. // create data var rtlb = $t.p.direction == "rtl" ? true :false, bp = rtlb ? "nData" : "pData", bn = rtlb ? "pData" : "nData"; createData(rowid,$t,tbl,maxCols); // buttons at footer var bP = "<a href='javascript:void(0)' id='"+bp+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>", bN = "<a href='javascript:void(0)' id='"+bn+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>", bS ="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+p.bSubmit+"</a>", bC ="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+p.bCancel+"</a>"; var bt = "<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+frmtborg+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+(rtlb ? bN+bP : bP+bN)+"</td><td class='EditButton'>"+bS+bC+"</td></tr>"; bt += "<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+rp_ge[$t.p.id].bottominfo+"</td></tr>"; bt += "</tbody></table>"; if(maxRows > 0) { var sd=[]; $.each($(tbl)[0].rows,function(i,r){ sd[i] = r; }); sd.sort(function(a,b){ if(a.rp > b.rp) {return 1;} if(a.rp < b.rp) {return -1;} return 0; }); $.each(sd, function(index, row) { $('tbody',tbl).append(row); }); } p.gbox = "#gbox_"+$.jgrid.jqID(gID); var cle = false; if(p.closeOnEscape===true){ p.closeOnEscape = false; cle = true; } var tms = $("<span></span>").append(frm).append(bt); $.jgrid.createModal(IDs,tms,p,"#gview_"+$.jgrid.jqID($t.p.id),$("#gbox_"+$.jgrid.jqID($t.p.id))[0]); if(rtlb) { $("#pData, #nData",frmtb+"_2").css("float","right"); $(".EditButton",frmtb+"_2").css("text-align","left"); } if(rp_ge[$t.p.id].topinfo) {$(".tinfo",frmtb).show();} if(rp_ge[$t.p.id].bottominfo) {$(".binfo",frmtb+"_2").show();} tms = null;bt=null; $("#"+$.jgrid.jqID(IDs.themodal)).keydown( function( e ) { var wkey = e.target; if ($("#"+frmgr).data("disabled")===true ) {return false;}//?? if(rp_ge[$t.p.id].savekey[0] === true && e.which == rp_ge[$t.p.id].savekey[1]) { // save if(wkey.tagName != "TEXTAREA") { $("#sData", frmtb+"_2").trigger("click"); return false; } } if(e.which === 27) { if(!checkUpdates()) {return false;} if(cle) {$.jgrid.hideModal(this,{gb:p.gbox,jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose});} return false; } if(rp_ge[$t.p.id].navkeys[0]===true) { if($("#id_g",frmtb).val() == "_empty") {return true;} if(e.which == rp_ge[$t.p.id].navkeys[1]){ //up $("#pData", frmtb+"_2").trigger("click"); return false; } if(e.which == rp_ge[$t.p.id].navkeys[2]){ //down $("#nData", frmtb+"_2").trigger("click"); return false; } } }); if(p.checkOnUpdate) { $("a.ui-jqdialog-titlebar-close span","#"+$.jgrid.jqID(IDs.themodal)).removeClass("jqmClose"); $("a.ui-jqdialog-titlebar-close","#"+$.jgrid.jqID(IDs.themodal)).unbind("click") .click(function(){ if(!checkUpdates()) {return false;} $.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal,onClose: rp_ge[$t.p.id].onClose}); return false; }); } p.saveicon = $.extend([true,"left","ui-icon-disk"],p.saveicon); p.closeicon = $.extend([true,"left","ui-icon-close"],p.closeicon); // beforeinitdata after creation of the form if(p.saveicon[0]===true) { $("#sData",frmtb+"_2").addClass(p.saveicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left') .append("<span class='ui-icon "+p.saveicon[2]+"'></span>"); } if(p.closeicon[0]===true) { $("#cData",frmtb+"_2").addClass(p.closeicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left') .append("<span class='ui-icon "+p.closeicon[2]+"'></span>"); } if(rp_ge[$t.p.id].checkOnSubmit || rp_ge[$t.p.id].checkOnUpdate) { bS ="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bYes+"</a>"; bN ="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bNo+"</a>"; bC ="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bExit+"</a>"; var ii, zI = p.zIndex || 999;zI ++; if ($.browser.msie && $.browser.version ==6) { ii = '<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>'; } else {ii="";} $("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+zI+";display:none;'>&#160;"+ii+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(zI+1)+"'>"+p.saveData+"<br/><br/>"+bS+bN+bC+"</div>").insertAfter("#"+frmgr); $("#sNew","#"+$.jgrid.jqID(IDs.themodal)).click(function(){ postIt(); $("#"+frmgr).data("disabled",false); $(".confirm","#"+$.jgrid.jqID(IDs.themodal)).hide(); return false; }); $("#nNew","#"+$.jgrid.jqID(IDs.themodal)).click(function(){ $(".confirm","#"+$.jgrid.jqID(IDs.themodal)).hide(); $("#"+frmgr).data("disabled",false); setTimeout(function(){$(":input","#"+frmgr)[0].focus();},0); return false; }); $("#cNew","#"+$.jgrid.jqID(IDs.themodal)).click(function(){ $(".confirm","#"+$.jgrid.jqID(IDs.themodal)).hide(); $("#"+frmgr).data("disabled",false); $.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal,onClose: rp_ge[$t.p.id].onClose}); return false; }); } // here initform - only once $($t).triggerHandler("jqGridAddEditInitializeForm", [$("#"+frmgr), frmoper]); if(onInitializeForm) {onInitializeForm($("#"+frmgr));} if(rowid=="_empty" || !rp_ge[$t.p.id].viewPagerButtons) {$("#pData,#nData",frmtb+"_2").hide();} else {$("#pData,#nData",frmtb+"_2").show();} $($t).triggerHandler("jqGridAddEditBeforeShowForm", [$("#"+frmgr), frmoper]); if(onBeforeShow) { onBeforeShow.call($t, $("#"+frmgr));} $("#"+$.jgrid.jqID(IDs.themodal)).data("onClose",rp_ge[$t.p.id].onClose); $.jgrid.viewModal("#"+$.jgrid.jqID(IDs.themodal),{gbox:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal, overlay: p.overlay,modal:p.modal}); if(!closeovrl) { $(".jqmOverlay").click(function(){ if(!checkUpdates()) {return false;} $.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose}); return false; }); } $($t).triggerHandler("jqGridAddEditAfterShowForm", [$("#"+frmgr), frmoper]); if(onAfterShow) { onAfterShow.call($t, $("#"+frmgr)); } $(".fm-button","#"+$.jgrid.jqID(IDs.themodal)).hover( function(){$(this).addClass('ui-state-hover');}, function(){$(this).removeClass('ui-state-hover');} ); $("#sData", frmtb+"_2").click(function(){ postdata = {};extpost={}; $("#FormError",frmtb).hide(); // all depend on ret array //ret[0] - succes //ret[1] - msg if not succes //ret[2] - the id that will be set if reload after submit false getFormData(); if(postdata[$t.p.id+"_id"] == "_empty") {postIt();} else if(p.checkOnSubmit===true ) { newData = $.extend({},postdata,extpost); diff = compareData(newData,rp_ge[$t.p.id]._savedData); if(diff) { $("#"+frmgr).data("disabled",true); $(".confirm","#"+$.jgrid.jqID(IDs.themodal)).show(); } else { postIt(); } } else { postIt(); } return false; }); $("#cData", frmtb+"_2").click(function(){ if(!checkUpdates()) {return false;} $.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal,onClose: rp_ge[$t.p.id].onClose}); return false; }); $("#nData", frmtb+"_2").click(function(){ if(!checkUpdates()) {return false;} $("#FormError",frmtb).hide(); var npos = getCurrPos(); npos[0] = parseInt(npos[0],10); if(npos[0] != -1 && npos[1][npos[0]+1]) { $($t).triggerHandler("jqGridAddEditClickPgButtons", ['next',$("#"+frmgr),npos[1][npos[0]]]); if($.isFunction(p.onclickPgButtons)) { p.onclickPgButtons.call($t, 'next',$("#"+frmgr),npos[1][npos[0]]); } fillData(npos[1][npos[0]+1],$t,frmgr); $($t).jqGrid("setSelection",npos[1][npos[0]+1]); $($t).triggerHandler("jqGridAddEditAfterClickPgButtons", ['next',$("#"+frmgr),npos[1][npos[0]]]); if($.isFunction(p.afterclickPgButtons)) { p.afterclickPgButtons.call($t, 'next',$("#"+frmgr),npos[1][npos[0]+1]); } updateNav(npos[0]+1,npos[1].length-1); } return false; }); $("#pData", frmtb+"_2").click(function(){ if(!checkUpdates()) {return false;} $("#FormError",frmtb).hide(); var ppos = getCurrPos(); if(ppos[0] != -1 && ppos[1][ppos[0]-1]) { $($t).triggerHandler("jqGridAddEditClickPgButtons", ['prev',$("#"+frmgr),ppos[1][ppos[0]]]); if($.isFunction(p.onclickPgButtons)) { p.onclickPgButtons.call($t, 'prev',$("#"+frmgr),ppos[1][ppos[0]]); } fillData(ppos[1][ppos[0]-1],$t,frmgr); $($t).jqGrid("setSelection",ppos[1][ppos[0]-1]); $($t).triggerHandler("jqGridAddEditAfterClickPgButtons", ['prev',$("#"+frmgr),ppos[1][ppos[0]]]); if($.isFunction(p.afterclickPgButtons)) { p.afterclickPgButtons.call($t, 'prev',$("#"+frmgr),ppos[1][ppos[0]-1]); } updateNav(ppos[0]-1,ppos[1].length-1); } return false; }); } var posInit =getCurrPos(); updateNav(posInit[0],posInit[1].length-1); }); }, viewGridRow : function(rowid, p){ p = $.extend({ top : 0, left: 0, width: 0, height: 'auto', dataheight: 'auto', modal: false, overlay: 30, drag: true, resize: true, jqModal: true, closeOnEscape : false, labelswidth: '30%', closeicon: [], navkeys: [false,38,40], onClose: null, beforeShowForm : null, beforeInitData : null, viewPagerButtons : true }, $.jgrid.view, p || {}); return this.each(function(){ var $t = this; if (!$t.grid || !rowid) {return;} var gID = $t.p.id, frmgr = "ViewGrid_"+$.jgrid.jqID( gID ), frmtb = "ViewTbl_" + $.jgrid.jqID( gID ), frmgr_id = "ViewGrid_"+gID, frmtb_id = "ViewTbl_"+gID, IDs = {themodal:'viewmod'+gID,modalhead:'viewhd'+gID,modalcontent:'viewcnt'+gID, scrollelm : frmgr}, onBeforeInit = $.isFunction(p.beforeInitData) ? p.beforeInitData : false, showFrm = true, maxCols = 1, maxRows=0; function focusaref(){ //Sfari 3 issues if(p.closeOnEscape===true || p.navkeys[0]===true) { setTimeout(function(){$(".ui-jqdialog-titlebar-close","#"+$.jgrid.jqID(IDs.modalhead)).focus();},0); } } function createData(rowid,obj,tb,maxcols){ var nm, hc,trdata, cnt=0,tmp, dc, retpos=[], ind=false, tdtmpl = "<td class='CaptionTD form-view-label ui-widget-content' width='"+p.labelswidth+"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>", tmpl="", tdtmpl2 = "<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>", fmtnum = ['integer','number','currency'],max1 =0, max2=0 ,maxw,setme, viewfld; for (var i =1;i<=maxcols;i++) { tmpl += i == 1 ? tdtmpl : tdtmpl2; } // find max number align rigth with property formatter $(obj.p.colModel).each( function() { if(this.editrules && this.editrules.edithidden === true) { hc = false; } else { hc = this.hidden === true ? true : false; } if(!hc && this.align==='right') { if(this.formatter && $.inArray(this.formatter,fmtnum) !== -1 ) { max1 = Math.max(max1,parseInt(this.width,10)); } else { max2 = Math.max(max2,parseInt(this.width,10)); } } }); maxw = max1 !==0 ? max1 : max2 !==0 ? max2 : 0; ind = $(obj).jqGrid("getInd",rowid); $(obj.p.colModel).each( function(i) { nm = this.name; setme = false; // hidden fields are included in the form if(this.editrules && this.editrules.edithidden === true) { hc = false; } else { hc = this.hidden === true ? true : false; } dc = hc ? "style='display:none'" : ""; viewfld = (typeof this.viewable != 'boolean') ? true : this.viewable; if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn' && viewfld) { if(ind === false) { tmp = ""; } else { if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) { tmp = $("td:eq("+i+")",obj.rows[ind]).text(); } else { tmp = $("td:eq("+i+")",obj.rows[ind]).html(); } } setme = this.align === 'right' && maxw !==0 ? true : false; var opt = $.extend({}, this.editoptions || {} ,{id:nm,name:nm}), frmopt = $.extend({},{rowabove:false,rowcontent:''}, this.formoptions || {}), rp = parseInt(frmopt.rowpos,10) || cnt+1, cp = parseInt((parseInt(frmopt.colpos,10) || 1)*2,10); if(frmopt.rowabove) { var newdata = $("<tr><td class='contentinfo' colspan='"+(maxcols*2)+"'>"+frmopt.rowcontent+"</td></tr>"); $(tb).append(newdata); newdata[0].rp = rp; } trdata = $(tb).find("tr[rowpos="+rp+"]"); if ( trdata.length===0 ) { trdata = $("<tr "+dc+" rowpos='"+rp+"'></tr>").addClass("FormData").attr("id","trv_"+nm); $(trdata).append(tmpl); $(tb).append(trdata); trdata[0].rp = rp; } $("td:eq("+(cp-2)+")",trdata[0]).html('<b>'+ (typeof frmopt.label === 'undefined' ? obj.p.colNames[i]: frmopt.label)+'</b>'); $("td:eq("+(cp-1)+")",trdata[0]).append("<span>"+tmp+"</span>").attr("id","v_"+nm); if(setme){ $("td:eq("+(cp-1)+") span",trdata[0]).css({'text-align':'right',width:maxw+"px"}); } retpos[cnt] = i; cnt++; } }); if( cnt > 0) { var idrow = $("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+ (maxcols*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+rowid+"'/></td></tr>"); idrow[0].rp = cnt+99; $(tb).append(idrow); } return retpos; } function fillData(rowid,obj){ var nm, hc,cnt=0,tmp, opt,trv; trv = $(obj).jqGrid("getInd",rowid,true); if(!trv) {return;} $('td',trv).each( function(i) { nm = obj.p.colModel[i].name; // hidden fields are included in the form if(obj.p.colModel[i].editrules && obj.p.colModel[i].editrules.edithidden === true) { hc = false; } else { hc = obj.p.colModel[i].hidden === true ? true : false; } if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn') { if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) { tmp = $(this).text(); } else { tmp = $(this).html(); } opt = $.extend({},obj.p.colModel[i].editoptions || {}); nm = $.jgrid.jqID("v_"+nm); $("#"+nm+" span","#"+frmtb).html(tmp); if (hc) {$("#"+nm,"#"+frmtb).parents("tr:first").hide();} cnt++; } }); if(cnt>0) {$("#id_g","#"+frmtb).val(rowid);} } function updateNav(cr,totr){ if (cr===0) {$("#pData","#"+frmtb+"_2").addClass('ui-state-disabled');} else {$("#pData","#"+frmtb+"_2").removeClass('ui-state-disabled');} if (cr==totr) {$("#nData","#"+frmtb+"_2").addClass('ui-state-disabled');} else {$("#nData","#"+frmtb+"_2").removeClass('ui-state-disabled');} } function getCurrPos() { var rowsInGrid = $($t).jqGrid("getDataIDs"), selrow = $("#id_g","#"+frmtb).val(), pos = $.inArray(selrow,rowsInGrid); return [pos,rowsInGrid]; } if ( $("#"+$.jgrid.jqID(IDs.themodal)).html() !== null ) { if(onBeforeInit) { showFrm = onBeforeInit($("#"+frmgr)); if(typeof(showFrm) == "undefined") { showFrm = true; } } if(showFrm === false) {return;} $(".ui-jqdialog-title","#"+$.jgrid.jqID(IDs.modalhead)).html(p.caption); $("#FormError","#"+frmtb).hide(); fillData(rowid,$t); if($.isFunction(p.beforeShowForm)) {p.beforeShowForm($("#"+frmgr));} $.jgrid.viewModal("#"+$.jgrid.jqID(IDs.themodal),{gbox:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal, jqM: false, overlay: p.overlay, modal:p.modal}); focusaref(); } else { var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px"; var frm = $("<form name='FormPost' id='"+frmgr_id+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+dh+";'></form>"), tbl =$("<table id='"+frmtb_id+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>"); if(onBeforeInit) { showFrm = onBeforeInit($("#"+frmgr)); if(typeof(showFrm) == "undefined") { showFrm = true; } } if(showFrm === false) {return;} $($t.p.colModel).each( function() { var fmto = this.formoptions; maxCols = Math.max(maxCols, fmto ? fmto.colpos || 0 : 0 ); maxRows = Math.max(maxRows, fmto ? fmto.rowpos || 0 : 0 ); }); // set the id. $(frm).append(tbl); createData(rowid, $t, tbl, maxCols); var rtlb = $t.p.direction == "rtl" ? true :false, bp = rtlb ? "nData" : "pData", bn = rtlb ? "pData" : "nData", // buttons at footer bP = "<a href='javascript:void(0)' id='"+bp+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>", bN = "<a href='javascript:void(0)' id='"+bn+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>", bC ="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+p.bClose+"</a>"; if(maxRows > 0) { var sd=[]; $.each($(tbl)[0].rows,function(i,r){ sd[i] = r; }); sd.sort(function(a,b){ if(a.rp > b.rp) {return 1;} if(a.rp < b.rp) {return -1;} return 0; }); $.each(sd, function(index, row) { $('tbody',tbl).append(row); }); } p.gbox = "#gbox_"+$.jgrid.jqID(gID); var cle = false; if(p.closeOnEscape===true){ p.closeOnEscape = false; cle = true; } var bt = $("<span></span>").append(frm).append("<table border='0' class='EditTable' id='"+frmtb+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+p.labelswidth+"'>"+(rtlb ? bN+bP : bP+bN)+"</td><td class='EditButton'>"+bC+"</td></tr></tbody></table>"); $.jgrid.createModal(IDs,bt,p,"#gview_"+$.jgrid.jqID($t.p.id),$("#gview_"+$.jgrid.jqID($t.p.id))[0]); if(rtlb) { $("#pData, #nData","#"+frmtb+"_2").css("float","right"); $(".EditButton","#"+frmtb+"_2").css("text-align","left"); } if(!p.viewPagerButtons) {$("#pData, #nData","#"+frmtb+"_2").hide();} bt = null; $("#"+IDs.themodal).keydown( function( e ) { if(e.which === 27) { if(cle) {$.jgrid.hideModal(this,{gb:p.gbox,jqm:p.jqModal, onClose: p.onClose});} return false; } if(p.navkeys[0]===true) { if(e.which === p.navkeys[1]){ //up $("#pData", "#"+frmtb+"_2").trigger("click"); return false; } if(e.which === p.navkeys[2]){ //down $("#nData", "#"+frmtb+"_2").trigger("click"); return false; } } }); p.closeicon = $.extend([true,"left","ui-icon-close"],p.closeicon); if(p.closeicon[0]===true) { $("#cData","#"+frmtb+"_2").addClass(p.closeicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left') .append("<span class='ui-icon "+p.closeicon[2]+"'></span>"); } if($.isFunction(p.beforeShowForm)) {p.beforeShowForm($("#"+frmgr));} $.jgrid.viewModal("#"+$.jgrid.jqID(IDs.themodal),{gbox:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal, modal:p.modal}); $(".fm-button:not(.ui-state-disabled)","#"+frmtb+"_2").hover( function(){$(this).addClass('ui-state-hover');}, function(){$(this).removeClass('ui-state-hover');} ); focusaref(); $("#cData", "#"+frmtb+"_2").click(function(){ $.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal, onClose: p.onClose}); return false; }); $("#nData", "#"+frmtb+"_2").click(function(){ $("#FormError","#"+frmtb).hide(); var npos = getCurrPos(); npos[0] = parseInt(npos[0],10); if(npos[0] != -1 && npos[1][npos[0]+1]) { if($.isFunction(p.onclickPgButtons)) { p.onclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]]); } fillData(npos[1][npos[0]+1],$t); $($t).jqGrid("setSelection",npos[1][npos[0]+1]); if($.isFunction(p.afterclickPgButtons)) { p.afterclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]+1]); } updateNav(npos[0]+1,npos[1].length-1); } focusaref(); return false; }); $("#pData", "#"+frmtb+"_2").click(function(){ $("#FormError","#"+frmtb).hide(); var ppos = getCurrPos(); if(ppos[0] != -1 && ppos[1][ppos[0]-1]) { if($.isFunction(p.onclickPgButtons)) { p.onclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]]); } fillData(ppos[1][ppos[0]-1],$t); $($t).jqGrid("setSelection",ppos[1][ppos[0]-1]); if($.isFunction(p.afterclickPgButtons)) { p.afterclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]-1]); } updateNav(ppos[0]-1,ppos[1].length-1); } focusaref(); return false; }); } var posInit =getCurrPos(); updateNav(posInit[0],posInit[1].length-1); }); }, delGridRow : function(rowids,p) { p = $.extend({ top : 0, left: 0, width: 240, height: 'auto', dataheight : 'auto', modal: false, overlay: 30, drag: true, resize: true, url : '', mtype : "POST", reloadAfterSubmit: true, beforeShowForm: null, beforeInitData : null, afterShowForm: null, beforeSubmit: null, onclickSubmit: null, afterSubmit: null, jqModal : true, closeOnEscape : false, delData: {}, delicon : [], cancelicon : [], onClose : null, ajaxDelOptions : {}, processing : false, serializeDelData : null, useDataProxy : false }, $.jgrid.del, p ||{}); rp_ge[$(this)[0].p.id] = p; return this.each(function(){ var $t = this; if (!$t.grid ) {return;} if(!rowids) {return;} var onBeforeShow = $.isFunction( rp_ge[$t.p.id].beforeShowForm ), onAfterShow = $.isFunction( rp_ge[$t.p.id].afterShowForm ), onBeforeInit = $.isFunction(rp_ge[$t.p.id].beforeInitData) ? rp_ge[$t.p.id].beforeInitData : false, gID = $t.p.id, onCS = {}, showFrm = true, dtbl = "DelTbl_"+$.jgrid.jqID(gID),postd, idname, opers, oper, dtbl_id = "DelTbl_" + gID, IDs = {themodal:'delmod'+gID,modalhead:'delhd'+gID,modalcontent:'delcnt'+gID, scrollelm: dtbl}; if (jQuery.isArray(rowids)) {rowids = rowids.join();} if ( $("#"+$.jgrid.jqID(IDs.themodal)).html() !== null ) { if(onBeforeInit) { showFrm = onBeforeInit( $("#"+dtbl)); if(typeof(showFrm) == "undefined") { showFrm = true; } } if(showFrm === false) {return;} $("#DelData>td","#"+dtbl).text(rowids); $("#DelError","#"+dtbl).hide(); if( rp_ge[$t.p.id].processing === true) { rp_ge[$t.p.id].processing=false; $("#dData", "#"+dtbl).removeClass('ui-state-active'); } if(onBeforeShow) {rp_ge[$t.p.id].beforeShowForm($("#"+dtbl));} $.jgrid.viewModal("#"+$.jgrid.jqID(IDs.themodal),{gbox:"#gbox_"+$.jgrid.jqID(gID),jqm:rp_ge[$t.p.id].jqModal,jqM: false, overlay: rp_ge[$t.p.id].overlay, modal:rp_ge[$t.p.id].modal}); if(onAfterShow) {rp_ge[$t.p.id].afterShowForm($("#"+dtbl));} } else { var dh = isNaN(rp_ge[$t.p.id].dataheight) ? rp_ge[$t.p.id].dataheight : rp_ge[$t.p.id].dataheight+"px"; var tbl = "<div id='"+dtbl_id+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+dh+";'>"; tbl += "<table class='DelTable'><tbody>"; // error data tbl += "<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>"; tbl += "<tr id='DelData' style='display:none'><td >"+rowids+"</td></tr>"; tbl += "<tr><td class=\"delmsg\" style=\"white-space:pre;\">"+rp_ge[$t.p.id].msg+"</td></tr><tr><td >&#160;</td></tr>"; // buttons at footer tbl += "</tbody></table></div>"; var bS = "<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+p.bSubmit+"</a>", bC = "<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+p.bCancel+"</a>"; tbl += "<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+dtbl+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='DelButton EditButton'>"+bS+"&#160;"+bC+"</td></tr></tbody></table>"; p.gbox = "#gbox_"+$.jgrid.jqID(gID); $.jgrid.createModal(IDs,tbl,p,"#gview_"+$.jgrid.jqID($t.p.id),$("#gview_"+$.jgrid.jqID($t.p.id))[0]); if(onBeforeInit) { showFrm = onBeforeInit( $("#"+dtbl) ); if(typeof(showFrm) == "undefined") { showFrm = true; } } if(showFrm === false) {return;} $(".fm-button","#"+dtbl+"_2").hover( function(){$(this).addClass('ui-state-hover');}, function(){$(this).removeClass('ui-state-hover');} ); p.delicon = $.extend([true,"left","ui-icon-scissors"],rp_ge[$t.p.id].delicon); p.cancelicon = $.extend([true,"left","ui-icon-cancel"],rp_ge[$t.p.id].cancelicon); if(p.delicon[0]===true) { $("#dData","#"+dtbl+"_2").addClass(p.delicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left') .append("<span class='ui-icon "+p.delicon[2]+"'></span>"); } if(p.cancelicon[0]===true) { $("#eData","#"+dtbl+"_2").addClass(p.cancelicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left') .append("<span class='ui-icon "+p.cancelicon[2]+"'></span>"); } $("#dData","#"+dtbl+"_2").click(function(){ var ret=[true,""];onCS = {}; var postdata = $("#DelData>td","#"+dtbl).text(); //the pair is name=val1,val2,... if( $.isFunction( rp_ge[$t.p.id].onclickSubmit ) ) {onCS = rp_ge[$t.p.id].onclickSubmit(rp_ge[$t.p.id], postdata) || {};} if( $.isFunction( rp_ge[$t.p.id].beforeSubmit ) ) {ret = rp_ge[$t.p.id].beforeSubmit(postdata);} if(ret[0] && !rp_ge[$t.p.id].processing) { rp_ge[$t.p.id].processing = true; opers = $t.p.prmNames; postd = $.extend({},rp_ge[$t.p.id].delData, onCS); oper = opers.oper; postd[oper] = opers.deloper; idname = opers.id; postdata = String(postdata).split(","); if(!postdata.length) { return false; } for( var pk in postdata) { if(postdata.hasOwnProperty(pk)) { postdata[pk] = $.jgrid.stripPref($t.p.idPrefix, postdata[pk]); } } postd[idname] = postdata.join(); $(this).addClass('ui-state-active'); var ajaxOptions = $.extend({ url: rp_ge[$t.p.id].url ? rp_ge[$t.p.id].url : $($t).jqGrid('getGridParam','editurl'), type: rp_ge[$t.p.id].mtype, data: $.isFunction(rp_ge[$t.p.id].serializeDelData) ? rp_ge[$t.p.id].serializeDelData(postd) : postd, complete:function(data,Status){ if(Status != "success") { ret[0] = false; if ($.isFunction(rp_ge[$t.p.id].errorTextFormat)) { ret[1] = rp_ge[$t.p.id].errorTextFormat(data); } else { ret[1] = Status + " Status: '" + data.statusText + "'. Error code: " + data.status; } } else { // data is posted successful // execute aftersubmit with the returned data from server if( $.isFunction( rp_ge[$t.p.id].afterSubmit ) ) { ret = rp_ge[$t.p.id].afterSubmit(data,postd); } } if(ret[0] === false) { $("#DelError>td","#"+dtbl).html(ret[1]); $("#DelError","#"+dtbl).show(); } else { if(rp_ge[$t.p.id].reloadAfterSubmit && $t.p.datatype != "local") { $($t).trigger("reloadGrid"); } else { if($t.p.treeGrid===true){ try {$($t).jqGrid("delTreeNode",$t.p.idPrefix+postdata[0]);} catch(e){} } else { for(var i=0;i<postdata.length;i++) { $($t).jqGrid("delRowData",$t.p.idPrefix+ postdata[i]); } } $t.p.selrow = null; $t.p.selarrrow = []; } if($.isFunction(rp_ge[$t.p.id].afterComplete)) { setTimeout(function(){rp_ge[$t.p.id].afterComplete(data,postdata);},500); } } rp_ge[$t.p.id].processing=false; $("#dData", "#"+dtbl+"_2").removeClass('ui-state-active'); if(ret[0]) {$.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose});} } }, $.jgrid.ajaxOptions, rp_ge[$t.p.id].ajaxDelOptions); if (!ajaxOptions.url && !rp_ge[$t.p.id].useDataProxy) { if ($.isFunction($t.p.dataProxy)) { rp_ge[$t.p.id].useDataProxy = true; } else { ret[0]=false;ret[1] += " "+$.jgrid.errors.nourl; } } if (ret[0]) { if (rp_ge[$t.p.id].useDataProxy) { var dpret = $t.p.dataProxy.call($t, ajaxOptions, "del_"+$t.p.id); if(typeof(dpret) == "undefined") { dpret = [true, ""]; } if(dpret[0] === false ) { ret[0] = false; ret[1] = dpret[1] || "Error deleting the selected row!" ; } else { $.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose}); } } else {$.ajax(ajaxOptions);} } } if(ret[0] === false) { $("#DelError>td","#"+dtbl).html(ret[1]); $("#DelError","#"+dtbl).show(); } return false; }); $("#eData", "#"+dtbl+"_2").click(function(){ $.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:rp_ge[$t.p.id].jqModal, onClose: rp_ge[$t.p.id].onClose}); return false; }); if(onBeforeShow) {rp_ge[$t.p.id].beforeShowForm($("#"+dtbl));} $.jgrid.viewModal("#"+$.jgrid.jqID(IDs.themodal),{gbox:"#gbox_"+$.jgrid.jqID(gID),jqm:rp_ge[$t.p.id].jqModal, overlay: rp_ge[$t.p.id].overlay, modal:rp_ge[$t.p.id].modal}); if(onAfterShow) {rp_ge[$t.p.id].afterShowForm($("#"+dtbl));} } if(rp_ge[$t.p.id].closeOnEscape===true) { setTimeout(function(){$(".ui-jqdialog-titlebar-close","#"+$.jgrid.jqID(IDs.modalhead)).focus();},0); } }); }, navGrid : function (elem, o, pEdit,pAdd,pDel,pSearch, pView) { o = $.extend({ edit: true, editicon: "ui-icon-pencil", add: true, addicon:"ui-icon-plus", del: true, delicon:"ui-icon-trash", search: true, searchicon:"ui-icon-search", refresh: true, refreshicon:"ui-icon-refresh", refreshstate: 'firstpage', view: false, viewicon : "ui-icon-document", position : "left", closeOnEscape : true, beforeRefresh : null, afterRefresh : null, cloneToTop : false, alertwidth : 200, alertheight : 'auto', alerttop: null, alertleft: null, alertzIndex : null }, $.jgrid.nav, o ||{}); return this.each(function() { if(this.nav) {return;} var alertIDs = {themodal:'alertmod',modalhead:'alerthd',modalcontent:'alertcnt'}, $t = this, twd, tdw; if(!$t.grid || typeof elem != 'string') {return;} if ($("#"+alertIDs.themodal).html() === null) { if(!o.alerttop && !o.alertleft) { if (typeof window.innerWidth != 'undefined') { o.alertleft = window.innerWidth; o.alerttop = window.innerHeight; } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth !== 0) { o.alertleft = document.documentElement.clientWidth; o.alerttop = document.documentElement.clientHeight; } else { o.alertleft=1024; o.alerttop=768; } o.alertleft = o.alertleft/2 - parseInt(o.alertwidth,10)/2; o.alerttop = o.alerttop/2-25; } $.jgrid.createModal(alertIDs,"<div>"+o.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+$.jgrid.jqID($t.p.id),jqModal:true,drag:true,resize:true,caption:o.alertcap,top:o.alerttop,left:o.alertleft,width:o.alertwidth,height: o.alertheight,closeOnEscape:o.closeOnEscape, zIndex: o.alertzIndex},"","",true); } var clone = 1; if(o.cloneToTop && $t.p.toppager) {clone = 2;} for(var i = 0; i<clone; i++) { var tbd, navtbl = $("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"), sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>", pgid, elemids; if(i===0) { pgid = elem; elemids = $t.p.id; if(pgid == $t.p.toppager) { elemids += "_top"; clone = 1; } } else { pgid = $t.p.toppager; elemids = $t.p.id+"_top"; } if($t.p.direction == "rtl") {$(navtbl).attr("dir","rtl").css("float","right");} if (o.add) { pAdd = pAdd || {}; tbd = $("<td class='ui-pg-button ui-corner-all'></td>"); $(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.addicon+"'></span>"+o.addtext+"</div>"); $("tr",navtbl).append(tbd); $(tbd,navtbl) .attr({"title":o.addtitle || "",id : pAdd.id || "add_"+elemids}) .click(function(){ if (!$(this).hasClass('ui-state-disabled')) { if ($.isFunction( o.addfunc )) { o.addfunc.call($t); } else { $($t).jqGrid("editGridRow","new",pAdd); } } return false; }).hover( function () { if (!$(this).hasClass('ui-state-disabled')) { $(this).addClass("ui-state-hover"); } }, function () {$(this).removeClass("ui-state-hover");} ); tbd = null; } if (o.edit) { tbd = $("<td class='ui-pg-button ui-corner-all'></td>"); pEdit = pEdit || {}; $(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.editicon+"'></span>"+o.edittext+"</div>"); $("tr",navtbl).append(tbd); $(tbd,navtbl) .attr({"title":o.edittitle || "",id: pEdit.id || "edit_"+elemids}) .click(function(){ if (!$(this).hasClass('ui-state-disabled')) { var sr = $t.p.selrow; if (sr) { if($.isFunction( o.editfunc ) ) { o.editfunc.call($t, sr); } else { $($t).jqGrid("editGridRow",sr,pEdit); } } else { $.jgrid.viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$.jgrid.jqID($t.p.id),jqm:true}); $("#jqg_alrt").focus(); } } return false; }).hover( function () { if (!$(this).hasClass('ui-state-disabled')) { $(this).addClass("ui-state-hover"); } }, function () {$(this).removeClass("ui-state-hover");} ); tbd = null; } if (o.view) { tbd = $("<td class='ui-pg-button ui-corner-all'></td>"); pView = pView || {}; $(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.viewicon+"'></span>"+o.viewtext+"</div>"); $("tr",navtbl).append(tbd); $(tbd,navtbl) .attr({"title":o.viewtitle || "",id: pView.id || "view_"+elemids}) .click(function(){ if (!$(this).hasClass('ui-state-disabled')) { var sr = $t.p.selrow; if (sr) { if($.isFunction( o.viewfunc ) ) { o.viewfunc.call($t, sr); } else { $($t).jqGrid("viewGridRow",sr,pView); } } else { $.jgrid.viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$.jgrid.jqID($t.p.id),jqm:true}); $("#jqg_alrt").focus(); } } return false; }).hover( function () { if (!$(this).hasClass('ui-state-disabled')) { $(this).addClass("ui-state-hover"); } }, function () {$(this).removeClass("ui-state-hover");} ); tbd = null; } if (o.del) { tbd = $("<td class='ui-pg-button ui-corner-all'></td>"); pDel = pDel || {}; $(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.delicon+"'></span>"+o.deltext+"</div>"); $("tr",navtbl).append(tbd); $(tbd,navtbl) .attr({"title":o.deltitle || "",id: pDel.id || "del_"+elemids}) .click(function(){ if (!$(this).hasClass('ui-state-disabled')) { var dr; if($t.p.multiselect) { dr = $t.p.selarrrow; if(dr.length===0) {dr = null;} } else { dr = $t.p.selrow; } if(dr){ if($.isFunction( o.delfunc )){ o.delfunc.call($t, dr); }else{ $($t).jqGrid("delGridRow",dr,pDel); } } else { $.jgrid.viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$.jgrid.jqID($t.p.id),jqm:true});$("#jqg_alrt").focus(); } } return false; }).hover( function () { if (!$(this).hasClass('ui-state-disabled')) { $(this).addClass("ui-state-hover"); } }, function () {$(this).removeClass("ui-state-hover");} ); tbd = null; } if(o.add || o.edit || o.del || o.view) {$("tr",navtbl).append(sep);} if (o.search) { tbd = $("<td class='ui-pg-button ui-corner-all'></td>"); pSearch = pSearch || {}; $(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.searchicon+"'></span>"+o.searchtext+"</div>"); $("tr",navtbl).append(tbd); $(tbd,navtbl) .attr({"title":o.searchtitle || "",id:pSearch.id || "search_"+elemids}) .click(function(){ if (!$(this).hasClass('ui-state-disabled')) { if($.isFunction( o.searchfunc )) { o.searchfunc.call($t, pSearch); } else { $($t).jqGrid("searchGrid",pSearch); } } return false; }).hover( function () { if (!$(this).hasClass('ui-state-disabled')) { $(this).addClass("ui-state-hover"); } }, function () {$(this).removeClass("ui-state-hover");} ); if (pSearch.showOnLoad && pSearch.showOnLoad === true) { $(tbd,navtbl).click(); } tbd = null; } if (o.refresh) { tbd = $("<td class='ui-pg-button ui-corner-all'></td>"); $(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.refreshicon+"'></span>"+o.refreshtext+"</div>"); $("tr",navtbl).append(tbd); $(tbd,navtbl) .attr({"title":o.refreshtitle || "",id: "refresh_"+elemids}) .click(function(){ if (!$(this).hasClass('ui-state-disabled')) { if($.isFunction(o.beforeRefresh)) {o.beforeRefresh();} $t.p.search = false; try { var gID = $t.p.id; $t.p.postData.filters =""; $("#fbox_"+$.jgrid.jqID(gID)).jqFilter('resetFilter'); if($.isFunction($t.clearToolbar)) {$t.clearToolbar(false);} } catch (e) {} switch (o.refreshstate) { case 'firstpage': $($t).trigger("reloadGrid", [{page:1}]); break; case 'current': $($t).trigger("reloadGrid", [{current:true}]); break; } if($.isFunction(o.afterRefresh)) {o.afterRefresh();} } return false; }).hover( function () { if (!$(this).hasClass('ui-state-disabled')) { $(this).addClass("ui-state-hover"); } }, function () {$(this).removeClass("ui-state-hover");} ); tbd = null; } tdw = $(".ui-jqgrid").css("font-size") || "11px"; $('body').append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+tdw+";visibility:hidden;' ></div>"); twd = $(navtbl).clone().appendTo("#testpg2").width(); $("#testpg2").remove(); $(pgid+"_"+o.position,pgid).append(navtbl); if($t.p._nvtd) { if(twd > $t.p._nvtd[0] ) { $(pgid+"_"+o.position,pgid).width(twd); $t.p._nvtd[0] = twd; } $t.p._nvtd[1] = twd; } tdw =null;twd=null;navtbl =null; this.nav = true; } }); }, navButtonAdd : function (elem, p) { p = $.extend({ caption : "newButton", title: '', buttonicon : 'ui-icon-newwin', onClickButton: null, position : "last", cursor : 'pointer' }, p ||{}); return this.each(function() { if( !this.grid) {return;} if( typeof elem === "string" && elem.indexOf("#") !== 0) {elem = "#"+$.jgrid.jqID(elem);} var findnav = $(".navtable",elem)[0], $t = this; if (findnav) { if( p.id && $("#"+$.jgrid.jqID(p.id), findnav).html() !== null ) {return;} var tbd = $("<td></td>"); if(p.buttonicon.toString().toUpperCase() == "NONE") { $(tbd).addClass('ui-pg-button ui-corner-all').append("<div class='ui-pg-div'>"+p.caption+"</div>"); } else { $(tbd).addClass('ui-pg-button ui-corner-all').append("<div class='ui-pg-div'><span class='ui-icon "+p.buttonicon+"'></span>"+p.caption+"</div>"); } if(p.id) {$(tbd).attr("id",p.id);} if(p.position=='first'){ if(findnav.rows[0].cells.length ===0 ) { $("tr",findnav).append(tbd); } else { $("tr td:eq(0)",findnav).before(tbd); } } else { $("tr",findnav).append(tbd); } $(tbd,findnav) .attr("title",p.title || "") .click(function(e){ if (!$(this).hasClass('ui-state-disabled')) { if ($.isFunction(p.onClickButton) ) {p.onClickButton.call($t,e);} } return false; }) .hover( function () { if (!$(this).hasClass('ui-state-disabled')) { $(this).addClass('ui-state-hover'); } }, function () {$(this).removeClass("ui-state-hover");} ); } }); }, navSeparatorAdd:function (elem,p) { p = $.extend({ sepclass : "ui-separator", sepcontent: '' }, p ||{}); return this.each(function() { if( !this.grid) {return;} if( typeof elem === "string" && elem.indexOf("#") !== 0) {elem = "#"+$.jgrid.jqID(elem);} var findnav = $(".navtable",elem)[0]; if(findnav) { var sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+p.sepclass+"'></span>"+p.sepcontent+"</td>"; $("tr",findnav).append(sep); } }); }, GridToForm : function( rowid, formid ) { return this.each(function(){ var $t = this; if (!$t.grid) {return;} var rowdata = $($t).jqGrid("getRowData",rowid); if (rowdata) { for(var i in rowdata) { if ( $("[name="+$.jgrid.jqID(i)+"]",formid).is("input:radio") || $("[name="+$.jgrid.jqID(i)+"]",formid).is("input:checkbox")) { $("[name="+$.jgrid.jqID(i)+"]",formid).each( function() { if( $(this).val() == rowdata[i] ) { $(this)[$t.p.useProp ? 'prop': 'attr']("checked",true); } else { $(this)[$t.p.useProp ? 'prop': 'attr']("checked", false); } }); } else { // this is very slow on big table and form. $("[name="+$.jgrid.jqID(i)+"]",formid).val(rowdata[i]); } } } }); }, FormToGrid : function(rowid, formid, mode, position){ return this.each(function() { var $t = this; if(!$t.grid) {return;} if(!mode) {mode = 'set';} if(!position) {position = 'first';} var fields = $(formid).serializeArray(); var griddata = {}; $.each(fields, function(i, field){ griddata[field.name] = field.value; }); if(mode=='add') {$($t).jqGrid("addRowData",rowid,griddata, position);} else if(mode=='set') {$($t).jqGrid("setRowData",rowid,griddata);} }); } }); })(jQuery); ;(function($){ /** * jqGrid extension for manipulating Grid Data * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html **/ //jsHint options /*global alert, $, jQuery */ "use strict"; $.jgrid.inlineEdit = $.jgrid.inlineEdit || {}; $.jgrid.extend({ //Editing editRow : function(rowid,keys,oneditfunc,successfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) { // Compatible mode old versions var o={}, args = $.makeArray(arguments).slice(1); if( $.type(args[0]) === "object" ) { o = args[0]; } else { if (typeof keys !== "undefined") { o.keys = keys; } if ($.isFunction(oneditfunc)) { o.oneditfunc = oneditfunc; } if ($.isFunction(successfunc)) { o.successfunc = successfunc; } if (typeof url !== "undefined") { o.url = url; } if (typeof extraparam !== "undefined") { o.extraparam = extraparam; } if ($.isFunction(aftersavefunc)) { o.aftersavefunc = aftersavefunc; } if ($.isFunction(errorfunc)) { o.errorfunc = errorfunc; } if ($.isFunction(afterrestorefunc)) { o.afterrestorefunc = afterrestorefunc; } // last two not as param, but as object (sorry) //if (typeof restoreAfterError !== "undefined") { o.restoreAfterError = restoreAfterError; } //if (typeof mtype !== "undefined") { o.mtype = mtype || "POST"; } } o = $.extend(true, { keys : false, oneditfunc: null, successfunc: null, url: null, extraparam: {}, aftersavefunc: null, errorfunc: null, afterrestorefunc: null, restoreAfterError: true, mtype: "POST" }, $.jgrid.inlineEdit, o ); // End compatible return this.each(function(){ var $t = this, nm, tmp, editable, cnt=0, focus=null, svr={}, ind,cm; if (!$t.grid ) { return; } ind = $($t).jqGrid("getInd",rowid,true); if( ind === false ) {return;} editable = $(ind).attr("editable") || "0"; if (editable == "0" && !$(ind).hasClass("not-editable-row")) { cm = $t.p.colModel; $('td[role="gridcell"]',ind).each( function(i) { nm = cm[i].name; var treeg = $t.p.treeGrid===true && nm == $t.p.ExpandColumn; if(treeg) { tmp = $("span:first",this).html();} else { try { tmp = $.unformat.call($t,this,{rowId:rowid, colModel:cm[i]},i); } catch (_) { tmp = ( cm[i].edittype && cm[i].edittype == 'textarea' ) ? $(this).text() : $(this).html(); } } if ( nm != 'cb' && nm != 'subgrid' && nm != 'rn') { if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); } svr[nm]=tmp; if(cm[i].editable===true) { if(focus===null) { focus = i; } if (treeg) { $("span:first",this).html(""); } else { $(this).html(""); } var opt = $.extend({},cm[i].editoptions || {},{id:rowid+"_"+nm,name:nm}); if(!cm[i].edittype) { cm[i].edittype = "text"; } if(tmp == "&nbsp;" || tmp == "&#160;" || (tmp.length==1 && tmp.charCodeAt(0)==160) ) {tmp='';} var elc = $.jgrid.createEl(cm[i].edittype,opt,tmp,true,$.extend({},$.jgrid.ajaxOptions,$t.p.ajaxSelectOptions || {})); $(elc).addClass("editable"); if(treeg) { $("span:first",this).append(elc); } else { $(this).append(elc); } //Again IE if(cm[i].edittype == "select" && typeof(cm[i].editoptions)!=="undefined" && cm[i].editoptions.multiple===true && typeof(cm[i].editoptions.dataUrl)==="undefined" && $.browser.msie) { $(elc).width($(elc).width()); } cnt++; } } }); if(cnt > 0) { svr.id = rowid; $t.p.savedRow.push(svr); $(ind).attr("editable","1"); $("td:eq("+focus+") input",ind).focus(); if(o.keys===true) { $(ind).bind("keydown",function(e) { if (e.keyCode === 27) { $($t).jqGrid("restoreRow",rowid, o.afterrestorefunc); if($t.p._inlinenav) { try { $($t).jqGrid('showAddEditButtons'); } catch (eer1) {} } return false; } if (e.keyCode === 13) { var ta = e.target; if(ta.tagName == 'TEXTAREA') { return true; } if( $($t).jqGrid("saveRow", rowid, o ) ) { if($t.p._inlinenav) { try { $($t).jqGrid('showAddEditButtons'); } catch (eer2) {} } } return false; } }); } $($t).triggerHandler("jqGridInlineEditRow", [rowid, o]); if( $.isFunction(o.oneditfunc)) { o.oneditfunc.call($t, rowid); } } } }); }, saveRow : function(rowid, successfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) { // Compatible mode old versions var args = $.makeArray(arguments).slice(1), o = {}; if( $.type(args[0]) === "object" ) { o = args[0]; } else { if ($.isFunction(successfunc)) { o.successfunc = successfunc; } if (typeof url !== "undefined") { o.url = url; } if (typeof extraparam !== "undefined") { o.extraparam = extraparam; } if ($.isFunction(aftersavefunc)) { o.aftersavefunc = aftersavefunc; } if ($.isFunction(errorfunc)) { o.errorfunc = errorfunc; } if ($.isFunction(afterrestorefunc)) { o.afterrestorefunc = afterrestorefunc; } } o = $.extend(true, { successfunc: null, url: null, extraparam: {}, aftersavefunc: null, errorfunc: null, afterrestorefunc: null, restoreAfterError: true, mtype: "POST" }, $.jgrid.inlineEdit, o ); // End compatible var success = false; var $t = this[0], nm, tmp={}, tmp2={}, tmp3= {}, editable, fr, cv, ind; if (!$t.grid ) { return success; } ind = $($t).jqGrid("getInd",rowid,true); if(ind === false) {return success;} editable = $(ind).attr("editable"); o.url = o.url ? o.url : $t.p.editurl; if (editable==="1") { var cm; $('td[role="gridcell"]',ind).each(function(i) { cm = $t.p.colModel[i]; nm = cm.name; if ( nm != 'cb' && nm != 'subgrid' && cm.editable===true && nm != 'rn' && !$(this).hasClass('not-editable-cell')) { switch (cm.edittype) { case "checkbox": var cbv = ["Yes","No"]; if(cm.editoptions ) { cbv = cm.editoptions.value.split(":"); } tmp[nm]= $("input",this).is(":checked") ? cbv[0] : cbv[1]; break; case 'text': case 'password': case 'textarea': case "button" : tmp[nm]=$("input, textarea",this).val(); break; case 'select': if(!cm.editoptions.multiple) { tmp[nm] = $("select option:selected",this).val(); tmp2[nm] = $("select option:selected", this).text(); } else { var sel = $("select",this), selectedText = []; tmp[nm] = $(sel).val(); if(tmp[nm]) { tmp[nm]= tmp[nm].join(","); } else { tmp[nm] =""; } $("select option:selected",this).each( function(i,selected){ selectedText[i] = $(selected).text(); } ); tmp2[nm] = selectedText.join(","); } if(cm.formatter && cm.formatter == 'select') { tmp2={}; } break; case 'custom' : try { if(cm.editoptions && $.isFunction(cm.editoptions.custom_value)) { tmp[nm] = cm.editoptions.custom_value.call($t, $(".customelement",this),'get'); if (tmp[nm] === undefined) { throw "e2"; } } else { throw "e1"; } } catch (e) { if (e=="e1") { $.jgrid.info_dialog($.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,$.jgrid.edit.bClose); } if (e=="e2") { $.jgrid.info_dialog($.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,$.jgrid.edit.bClose); } else { $.jgrid.info_dialog($.jgrid.errors.errcap,e.message,$.jgrid.edit.bClose); } } break; } cv = $.jgrid.checkValues(tmp[nm],i,$t); if(cv[0] === false) { cv[1] = tmp[nm] + " " + cv[1]; return false; } if($t.p.autoencode) { tmp[nm] = $.jgrid.htmlEncode(tmp[nm]); } if(o.url !== 'clientArray' && cm.editoptions && cm.editoptions.NullIfEmpty === true) { if(tmp[nm] === "") { tmp3[nm] = 'null'; } } } }); if (cv[0] === false){ try { var positions = $.jgrid.findPos($("#"+$.jgrid.jqID(rowid), $t.grid.bDiv)[0]); $.jgrid.info_dialog($.jgrid.errors.errcap,cv[1],$.jgrid.edit.bClose,{left:positions[0],top:positions[1]}); } catch (e) { alert(cv[1]); } return success; } var idname, opers, oper; opers = $t.p.prmNames; oper = opers.oper; idname = opers.id; if(tmp) { tmp[oper] = opers.editoper; tmp[idname] = rowid; if(typeof($t.p.inlineData) == 'undefined') { $t.p.inlineData ={}; } tmp = $.extend({},tmp,$t.p.inlineData,o.extraparam); } if (o.url == 'clientArray') { tmp = $.extend({},tmp, tmp2); if($t.p.autoencode) { $.each(tmp,function(n,v){ tmp[n] = $.jgrid.htmlDecode(v); }); } var resp = $($t).jqGrid("setRowData",rowid,tmp); $(ind).attr("editable","0"); for( var k=0;k<$t.p.savedRow.length;k++) { if( $t.p.savedRow[k].id == rowid) {fr = k; break;} } if(fr >= 0) { $t.p.savedRow.splice(fr,1); } $($t).triggerHandler("jqGridInlineAfterSaveRow", [rowid, resp, tmp, o]); if( $.isFunction(o.aftersavefunc) ) { o.aftersavefunc.call($t, rowid,resp); } success = true; $(ind).unbind("keydown"); } else { $("#lui_"+$.jgrid.jqID($t.p.id)).show(); tmp3 = $.extend({},tmp,tmp3); tmp3[idname] = $.jgrid.stripPref($t.p.idPrefix, tmp3[idname]); $.ajax($.extend({ url:o.url, data: $.isFunction($t.p.serializeRowData) ? $t.p.serializeRowData.call($t, tmp3) : tmp3, type: o.mtype, async : false, //?!? complete: function(res,stat){ $("#lui_"+$.jgrid.jqID($t.p.id)).hide(); if (stat === "success"){ var ret = true, sucret; sucret = $($t).triggerHandler("jqGridInlineSuccessSaveRow", [res, rowid, o]); if (!$.isArray(sucret)) {sucret = [true, tmp];} if (sucret[0] && $.isFunction(o.successfunc)) {sucret = o.successfunc.call($t, res);} if($.isArray(sucret)) { // expect array - status, data, rowid ret = sucret[0]; tmp = sucret[1] ? sucret[1] : tmp; } else { ret = sucret; } if (ret===true) { if($t.p.autoencode) { $.each(tmp,function(n,v){ tmp[n] = $.jgrid.htmlDecode(v); }); } tmp = $.extend({},tmp, tmp2); $($t).jqGrid("setRowData",rowid,tmp); $(ind).attr("editable","0"); for( var k=0;k<$t.p.savedRow.length;k++) { if( $t.p.savedRow[k].id == rowid) {fr = k; break;} } if(fr >= 0) { $t.p.savedRow.splice(fr,1); } $($t).triggerHandler("jqGridInlineAfterSaveRow", [rowid, res, tmp, o]); if( $.isFunction(o.aftersavefunc) ) { o.aftersavefunc.call($t, rowid,res); } success = true; $(ind).unbind("keydown"); } else { $($t).triggerHandler("jqGridInlineErrorSaveRow", [rowid, res, stat, null, o]); if($.isFunction(o.errorfunc) ) { o.errorfunc.call($t, rowid, res, stat, null); } if(o.restoreAfterError === true) { $($t).jqGrid("restoreRow",rowid, o.afterrestorefunc); } } } }, error:function(res,stat,err){ $("#lui_"+$.jgrid.jqID($t.p.id)).hide(); $($t).triggerHandler("jqGridInlineErrorSaveRow", [rowid, res, stat, err, o]); if($.isFunction(o.errorfunc) ) { o.errorfunc.call($t, rowid, res, stat, err); } else { try { $.jgrid.info_dialog($.jgrid.errors.errcap,'<div class="ui-state-error">'+ res.responseText +'</div>', $.jgrid.edit.bClose,{buttonalign:'right'}); } catch(e) { alert(res.responseText); } } if(o.restoreAfterError === true) { $($t).jqGrid("restoreRow",rowid, o.afterrestorefunc); } } }, $.jgrid.ajaxOptions, $t.p.ajaxRowOptions || {})); } } return success; }, restoreRow : function(rowid, afterrestorefunc) { // Compatible mode old versions var args = $.makeArray(arguments).slice(1), o={}; if( $.type(args[0]) === "object" ) { o = args[0]; } else { if ($.isFunction(afterrestorefunc)) { o.afterrestorefunc = afterrestorefunc; } } o = $.extend(true, $.jgrid.inlineEdit, o ); // End compatible return this.each(function(){ var $t= this, fr, ind, ares={}; if (!$t.grid ) { return; } ind = $($t).jqGrid("getInd",rowid,true); if(ind === false) {return;} for( var k=0;k<$t.p.savedRow.length;k++) { if( $t.p.savedRow[k].id == rowid) {fr = k; break;} } if(fr >= 0) { if($.isFunction($.fn.datepicker)) { try { $("input.hasDatepicker","#"+$.jgrid.jqID(ind.id)).datepicker('hide'); } catch (e) {} } $.each($t.p.colModel, function(){ if(this.editable === true && this.name in $t.p.savedRow[fr] ) { ares[this.name] = $t.p.savedRow[fr][this.name]; } }); $($t).jqGrid("setRowData",rowid,ares); $(ind).attr("editable","0").unbind("keydown"); $t.p.savedRow.splice(fr,1); if($("#"+$.jgrid.jqID(rowid), "#"+$.jgrid.jqID($t.p.id)).hasClass("jqgrid-new-row")){ setTimeout(function(){$($t).jqGrid("delRowData",rowid);},0); } } $($t).triggerHandler("jqGridInlineAfterRestoreRow", [rowid]); if ($.isFunction(o.afterrestorefunc)) { o.afterrestorefunc.call($t, rowid); } }); }, addRow : function ( p ) { p = $.extend(true, { rowID : "new_row", initdata : {}, position :"first", useDefValues : true, useFormatter : false, addRowParams : {extraparam:{}} },p || {}); return this.each(function(){ if (!this.grid ) { return; } var $t = this; if(p.useDefValues === true) { $($t.p.colModel).each(function(){ if( this.editoptions && this.editoptions.defaultValue ) { var opt = this.editoptions.defaultValue, tmp = $.isFunction(opt) ? opt.call($t) : opt; p.initdata[this.name] = tmp; } }); } $($t).jqGrid('addRowData', p.rowID, p.initdata, p.position); $("#"+$.jgrid.jqID(p.rowID), "#"+$.jgrid.jqID($t.p.id)).addClass("jqgrid-new-row"); if(p.useFormatter) { $("#"+$.jgrid.jqID(p.rowID)+" .ui-inline-edit", "#"+$.jgrid.jqID($t.p.id)).click(); } else { var opers = $t.p.prmNames, oper = opers.oper; p.addRowParams.extraparam[oper] = opers.addoper; $($t).jqGrid('editRow', p.rowID, p.addRowParams); $($t).jqGrid('setSelection', p.rowID); } }); }, inlineNav : function (elem, o) { o = $.extend({ edit: true, editicon: "ui-icon-pencil", add: true, addicon:"ui-icon-plus", save: true, saveicon:"ui-icon-disk", cancel: true, cancelicon:"ui-icon-cancel", addParams : {useFormatter : false,rowID : "new_row"}, editParams : {}, restoreAfterSelect : true }, $.jgrid.nav, o ||{}); return this.each(function(){ if (!this.grid ) { return; } var $t = this, onSelect, gID = $.jgrid.jqID($t.p.id); $t.p._inlinenav = true; // detect the formatactions column if(o.addParams.useFormatter === true) { var cm = $t.p.colModel,i; for (i = 0; i<cm.length; i++) { if(cm[i].formatter && cm[i].formatter === "actions" ) { if(cm[i].formatoptions) { var defaults = { keys:false, onEdit : null, onSuccess: null, afterSave:null, onError: null, afterRestore: null, extraparam: {}, url: null }, ap = $.extend( defaults, cm[i].formatoptions ); o.addParams.addRowParams = { "keys" : ap.keys, "oneditfunc" : ap.onEdit, "successfunc" : ap.onSuccess, "url" : ap.url, "extraparam" : ap.extraparam, "aftersavefunc" : ap.afterSavef, "errorfunc": ap.onError, "afterrestorefunc" : ap.afterRestore }; } break; } } } if(o.add) { $($t).jqGrid('navButtonAdd', elem,{ caption : o.addtext, title : o.addtitle, buttonicon : o.addicon, id : $t.p.id+"_iladd", onClickButton : function () { $($t).jqGrid('addRow', o.addParams); if(!o.addParams.useFormatter) { $("#"+gID+"_ilsave").removeClass('ui-state-disabled'); $("#"+gID+"_ilcancel").removeClass('ui-state-disabled'); $("#"+gID+"_iladd").addClass('ui-state-disabled'); $("#"+gID+"_iledit").addClass('ui-state-disabled'); } } }); } if(o.edit) { $($t).jqGrid('navButtonAdd', elem,{ caption : o.edittext, title : o.edittitle, buttonicon : o.editicon, id : $t.p.id+"_iledit", onClickButton : function () { var sr = $($t).jqGrid('getGridParam','selrow'); if(sr) { $($t).jqGrid('editRow', sr, o.editParams); $("#"+gID+"_ilsave").removeClass('ui-state-disabled'); $("#"+gID+"_ilcancel").removeClass('ui-state-disabled'); $("#"+gID+"_iladd").addClass('ui-state-disabled'); $("#"+gID+"_iledit").addClass('ui-state-disabled'); } else { $.jgrid.viewModal("#alertmod",{gbox:"#gbox_"+gID,jqm:true});$("#jqg_alrt").focus(); } } }); } if(o.save) { $($t).jqGrid('navButtonAdd', elem,{ caption : o.savetext || '', title : o.savetitle || 'Save row', buttonicon : o.saveicon, id : $t.p.id+"_ilsave", onClickButton : function () { var sr = $t.p.savedRow[0].id; if(sr) { var opers = $t.p.prmNames, oper = opers.oper; if(!o.editParams.extraparam) { o.editParams.extraparam = {}; } if($("#"+$.jgrid.jqID(sr), "#"+gID ).hasClass("jqgrid-new-row")) { o.editParams.extraparam[oper] = opers.addoper; } else { o.editParams.extraparam[oper] = opers.editoper; } if( $($t).jqGrid('saveRow', sr, o.editParams) ) { $($t).jqGrid('showAddEditButtons'); } } else { $.jgrid.viewModal("#alertmod",{gbox:"#gbox_"+gID,jqm:true});$("#jqg_alrt").focus(); } } }); $("#"+gID+"_ilsave").addClass('ui-state-disabled'); } if(o.cancel) { $($t).jqGrid('navButtonAdd', elem,{ caption : o.canceltext || '', title : o.canceltitle || 'Cancel row editing', buttonicon : o.cancelicon, id : $t.p.id+"_ilcancel", onClickButton : function () { var sr = $t.p.savedRow[0].id; if(sr) { $($t).jqGrid('restoreRow', sr, o.editParams); $($t).jqGrid('showAddEditButtons'); } else { $.jgrid.viewModal("#alertmod",{gbox:"#gbox_"+gID,jqm:true});$("#jqg_alrt").focus(); } } }); $("#"+gID+"_ilcancel").addClass('ui-state-disabled'); } if(o.restoreAfterSelect === true) { if($.isFunction($t.p.beforeSelectRow)) { onSelect = $t.p.beforeSelectRow; } else { onSelect = false; } $t.p.beforeSelectRow = function(id, stat) { var ret = true; if($t.p.savedRow.length > 0 && $t.p._inlinenav===true && ( id !== $t.p.selrow && $t.p.selrow !==null) ) { if($t.p.selrow == o.addParams.rowID ) { $($t).jqGrid('delRowData', $t.p.selrow); } else { $($t).jqGrid('restoreRow', $t.p.selrow, o.editParams); } $($t).jqGrid('showAddEditButtons'); } if(onSelect) { ret = onSelect.call($t, id, stat); } return ret; }; } }); }, showAddEditButtons : function() { return this.each(function(){ if (!this.grid ) { return; } var gID = $.jgrid.jqID(this.p.id); $("#"+gID+"_ilsave").addClass('ui-state-disabled'); $("#"+gID+"_ilcancel").addClass('ui-state-disabled'); $("#"+gID+"_iladd").removeClass('ui-state-disabled'); $("#"+gID+"_iledit").removeClass('ui-state-disabled'); }); } //end inline edit }); })(jQuery); ;(function($){ /* ** * jqGrid extension for cellediting Grid Data * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html **/ /** * all events and options here are aded anonynous and not in the base grid * since the array is to big. Here is the order of execution. * From this point we use jQuery isFunction * formatCell * beforeEditCell, * onSelectCell (used only for noneditable cels) * afterEditCell, * beforeSaveCell, (called before validation of values if any) * beforeSubmitCell (if cellsubmit remote (ajax)) * afterSubmitCell(if cellsubmit remote (ajax)), * afterSaveCell, * errorCell, * serializeCellData - new * Options * cellsubmit (remote,clientArray) (added in grid options) * cellurl * ajaxCellOptions * */ "use strict"; $.jgrid.extend({ editCell : function (iRow,iCol, ed){ return this.each(function (){ var $t = this, nm, tmp,cc, cm; if (!$t.grid || $t.p.cellEdit !== true) {return;} iCol = parseInt(iCol,10); // select the row that can be used for other methods $t.p.selrow = $t.rows[iRow].id; if (!$t.p.knv) {$($t).jqGrid("GridNav");} // check to see if we have already edited cell if ($t.p.savedRow.length>0) { // prevent second click on that field and enable selects if (ed===true ) { if(iRow == $t.p.iRow && iCol == $t.p.iCol){ return; } } // save the cell $($t).jqGrid("saveCell",$t.p.savedRow[0].id,$t.p.savedRow[0].ic); } else { window.setTimeout(function () { $("#"+$.jgrid.jqID($t.p.knv)).attr("tabindex","-1").focus();},0); } cm = $t.p.colModel[iCol]; nm = cm.name; if (nm=='subgrid' || nm=='cb' || nm=='rn') {return;} cc = $("td:eq("+iCol+")",$t.rows[iRow]); if (cm.editable===true && ed===true && !cc.hasClass("not-editable-cell")) { if(parseInt($t.p.iCol,10)>=0 && parseInt($t.p.iRow,10)>=0) { $("td:eq("+$t.p.iCol+")",$t.rows[$t.p.iRow]).removeClass("edit-cell ui-state-highlight"); $($t.rows[$t.p.iRow]).removeClass("selected-row ui-state-hover"); } $(cc).addClass("edit-cell ui-state-highlight"); $($t.rows[iRow]).addClass("selected-row ui-state-hover"); try { tmp = $.unformat.call($t,cc,{rowId: $t.rows[iRow].id, colModel:cm},iCol); } catch (_) { tmp = ( cm.edittype && cm.edittype == 'textarea' ) ? $(cc).text() : $(cc).html(); } if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); } if (!cm.edittype) {cm.edittype = "text";} $t.p.savedRow.push({id:iRow,ic:iCol,name:nm,v:tmp}); if(tmp === "&nbsp;" || tmp === "&#160;" || (tmp.length===1 && tmp.charCodeAt(0)===160) ) {tmp='';} if($.isFunction($t.p.formatCell)) { var tmp2 = $t.p.formatCell.call($t, $t.rows[iRow].id,nm,tmp,iRow,iCol); if(tmp2 !== undefined ) {tmp = tmp2;} } var opt = $.extend({}, cm.editoptions || {} ,{id:iRow+"_"+nm,name:nm}); var elc = $.jgrid.createEl(cm.edittype,opt,tmp,true,$.extend({},$.jgrid.ajaxOptions,$t.p.ajaxSelectOptions || {})); $($t).triggerHandler("jqGridBeforeEditCell", [$t.rows[iRow].id, nm, tmp, iRow, iCol]); if ($.isFunction($t.p.beforeEditCell)) { $t.p.beforeEditCell.call($t, $t.rows[iRow].id,nm,tmp,iRow,iCol); } $(cc).html("").append(elc).attr("tabindex","0"); window.setTimeout(function () { $(elc).focus();},0); $("input, select, textarea",cc).bind("keydown",function(e) { if (e.keyCode === 27) { if($("input.hasDatepicker",cc).length >0) { if( $(".ui-datepicker").is(":hidden") ) { $($t).jqGrid("restoreCell",iRow,iCol); } else { $("input.hasDatepicker",cc).datepicker('hide'); } } else { $($t).jqGrid("restoreCell",iRow,iCol); } } //ESC if (e.keyCode === 13) { $($t).jqGrid("saveCell",iRow,iCol); // Prevent default action return false; } //Enter if (e.keyCode === 9) { if(!$t.grid.hDiv.loading ) { if (e.shiftKey) {$($t).jqGrid("prevCell",iRow,iCol);} //Shift TAb else {$($t).jqGrid("nextCell",iRow,iCol);} //Tab } else { return false; } } e.stopPropagation(); }); $($t).triggerHandler("jqGridAfterEditCell", [$t.rows[iRow].id, nm, tmp, iRow, iCol]); if ($.isFunction($t.p.afterEditCell)) { $t.p.afterEditCell.call($t, $t.rows[iRow].id,nm,tmp,iRow,iCol); } } else { if (parseInt($t.p.iCol,10)>=0 && parseInt($t.p.iRow,10)>=0) { $("td:eq("+$t.p.iCol+")",$t.rows[$t.p.iRow]).removeClass("edit-cell ui-state-highlight"); $($t.rows[$t.p.iRow]).removeClass("selected-row ui-state-hover"); } cc.addClass("edit-cell ui-state-highlight"); $($t.rows[iRow]).addClass("selected-row ui-state-hover"); tmp = cc.html().replace(/\&#160\;/ig,''); $($t).triggerHandler("jqGridSelectCell", [$t.rows[iRow].id, nm, tmp, iRow, iCol]); if ($.isFunction($t.p.onSelectCell)) { $t.p.onSelectCell.call($t, $t.rows[iRow].id,nm,tmp,iRow,iCol); } } $t.p.iCol = iCol; $t.p.iRow = iRow; }); }, saveCell : function (iRow, iCol){ return this.each(function(){ var $t= this, fr; if (!$t.grid || $t.p.cellEdit !== true) {return;} if ( $t.p.savedRow.length >= 1) {fr = 0;} else {fr=null;} if(fr !== null) { var cc = $("td:eq("+iCol+")",$t.rows[iRow]),v,v2, cm = $t.p.colModel[iCol], nm = cm.name, nmjq = $.jgrid.jqID(nm) ; switch (cm.edittype) { case "select": if(!cm.editoptions.multiple) { v = $("#"+iRow+"_"+nmjq+" option:selected",$t.rows[iRow]).val(); v2 = $("#"+iRow+"_"+nmjq+" option:selected",$t.rows[iRow]).text(); } else { var sel = $("#"+iRow+"_"+nmjq,$t.rows[iRow]), selectedText = []; v = $(sel).val(); if(v) { v.join(",");} else { v=""; } $("option:selected",sel).each( function(i,selected){ selectedText[i] = $(selected).text(); } ); v2 = selectedText.join(","); } if(cm.formatter) { v2 = v; } break; case "checkbox": var cbv = ["Yes","No"]; if(cm.editoptions){ cbv = cm.editoptions.value.split(":"); } v = $("#"+iRow+"_"+nmjq,$t.rows[iRow]).is(":checked") ? cbv[0] : cbv[1]; v2=v; break; case "password": case "text": case "textarea": case "button" : v = $("#"+iRow+"_"+nmjq,$t.rows[iRow]).val(); v2=v; break; case 'custom' : try { if(cm.editoptions && $.isFunction(cm.editoptions.custom_value)) { v = cm.editoptions.custom_value.call($t, $(".customelement",cc),'get'); if (v===undefined) { throw "e2";} else { v2=v; } } else { throw "e1"; } } catch (e) { if (e=="e1") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose); } if (e=="e2") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose); } else {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); } } break; } // The common approach is if nothing changed do not do anything if (v2 !== $t.p.savedRow[fr].v){ var vvv = $($t).triggerHandler("jqGridBeforeSaveCell", [$t.rows[iRow].id, nm, v, iRow, iCol]); if (vvv) {v = vvv; v2=vvv;} if ($.isFunction($t.p.beforeSaveCell)) { var vv = $t.p.beforeSaveCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol); if (vv) {v = vv; v2=vv;} } var cv = $.jgrid.checkValues(v,iCol,$t); if(cv[0] === true) { var addpost = $($t).triggerHandler("jqGridBeforeSubmitCell", [$t.rows[iRow].id, nm, v, iRow, iCol]) || {}; if ($.isFunction($t.p.beforeSubmitCell)) { addpost = $t.p.beforeSubmitCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol); if (!addpost) {addpost={};} } if( $("input.hasDatepicker",cc).length >0) { $("input.hasDatepicker",cc).datepicker('hide'); } if ($t.p.cellsubmit == 'remote') { if ($t.p.cellurl) { var postdata = {}; if($t.p.autoencode) { v = $.jgrid.htmlEncode(v); } postdata[nm] = v; var idname,oper, opers; opers = $t.p.prmNames; idname = opers.id; oper = opers.oper; postdata[idname] = $.jgrid.stripPref($t.p.idPrefix, $t.rows[iRow].id); postdata[oper] = opers.editoper; postdata = $.extend(addpost,postdata); $("#lui_"+$.jgrid.jqID($t.p.id)).show(); $t.grid.hDiv.loading = true; $.ajax( $.extend( { url: $t.p.cellurl, data :$.isFunction($t.p.serializeCellData) ? $t.p.serializeCellData.call($t, postdata) : postdata, type: "POST", complete: function (result, stat) { $("#lui_"+$t.p.id).hide(); $t.grid.hDiv.loading = false; if (stat == 'success') { var ret = $($t).triggerHandler("jqGridAfterSubmitCell", [$t, result, postdata.id, nm, v, iRow, iCol]) || [true, '']; if (ret[0] === true && $.isFunction($t.p.afterSubmitCell)) { ret = $t.p.afterSubmitCell.call($t, result,postdata.id,nm,v,iRow,iCol); } if(ret[0] === true){ $(cc).empty(); $($t).jqGrid("setCell",$t.rows[iRow].id, iCol, v2, false, false, true); $(cc).addClass("dirty-cell"); $($t.rows[iRow]).addClass("edited"); $($t).triggerHandler("jqGridAfterSaveCell", [$t.rows[iRow].id, nm, v, iRow, iCol]); if ($.isFunction($t.p.afterSaveCell)) { $t.p.afterSaveCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol); } $t.p.savedRow.splice(0,1); } else { $.jgrid.info_dialog($.jgrid.errors.errcap,ret[1],$.jgrid.edit.bClose); $($t).jqGrid("restoreCell",iRow,iCol); } } }, error:function(res,stat,err) { $("#lui_"+$.jgrid.jqID($t.p.id)).hide(); $t.grid.hDiv.loading = false; $($t).triggerHandler("jqGridErrorCell", [res, stat, err]); if ($.isFunction($t.p.errorCell)) { $t.p.errorCell.call($t, res,stat,err); $($t).jqGrid("restoreCell",iRow,iCol); } else { $.jgrid.info_dialog($.jgrid.errors.errcap,res.status+" : "+res.statusText+"<br/>"+stat,$.jgrid.edit.bClose); $($t).jqGrid("restoreCell",iRow,iCol); } } }, $.jgrid.ajaxOptions, $t.p.ajaxCellOptions || {})); } else { try { $.jgrid.info_dialog($.jgrid.errors.errcap,$.jgrid.errors.nourl,$.jgrid.edit.bClose); $($t).jqGrid("restoreCell",iRow,iCol); } catch (e) {} } } if ($t.p.cellsubmit == 'clientArray') { $(cc).empty(); $($t).jqGrid("setCell",$t.rows[iRow].id,iCol, v2, false, false, true); $(cc).addClass("dirty-cell"); $($t.rows[iRow]).addClass("edited"); $($t).triggerHandler("jqGridAfterSaveCell", [$t.rows[iRow].id, nm, v, iRow, iCol]); if ($.isFunction($t.p.afterSaveCell)) { $t.p.afterSaveCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol); } $t.p.savedRow.splice(0,1); } } else { try { window.setTimeout(function(){$.jgrid.info_dialog($.jgrid.errors.errcap,v+" "+cv[1],$.jgrid.edit.bClose);},100); $($t).jqGrid("restoreCell",iRow,iCol); } catch (e) {} } } else { $($t).jqGrid("restoreCell",iRow,iCol); } } if ($.browser.opera) { $("#"+$.jgrid.jqID($t.p.knv)).attr("tabindex","-1").focus(); } else { window.setTimeout(function () { $("#"+$.jgrid.jqID($t.p.knv)).attr("tabindex","-1").focus();},0); } }); }, restoreCell : function(iRow, iCol) { return this.each(function(){ var $t= this, fr; if (!$t.grid || $t.p.cellEdit !== true ) {return;} if ( $t.p.savedRow.length >= 1) {fr = 0;} else {fr=null;} if(fr !== null) { var cc = $("td:eq("+iCol+")",$t.rows[iRow]); // datepicker fix if($.isFunction($.fn.datepicker)) { try { $("input.hasDatepicker",cc).datepicker('hide'); } catch (e) {} } $(cc).empty().attr("tabindex","-1"); $($t).jqGrid("setCell",$t.rows[iRow].id, iCol, $t.p.savedRow[fr].v, false, false, true); $($t).triggerHandler("jqGridAfterRestoreCell", [$t.rows[iRow].id, $t.p.savedRow[fr].v, iRow, iCol]); if ($.isFunction($t.p.afterRestoreCell)) { $t.p.afterRestoreCell.call($t, $t.rows[iRow].id, $t.p.savedRow[fr].v, iRow, iCol); } $t.p.savedRow.splice(0,1); } window.setTimeout(function () { $("#"+$t.p.knv).attr("tabindex","-1").focus();},0); }); }, nextCell : function (iRow,iCol) { return this.each(function (){ var $t = this, nCol=false; if (!$t.grid || $t.p.cellEdit !== true) {return;} // try to find next editable cell for (var i=iCol+1; i<$t.p.colModel.length; i++) { if ( $t.p.colModel[i].editable ===true) { nCol = i; break; } } if(nCol !== false) { $($t).jqGrid("editCell",iRow,nCol,true); } else { if ($t.p.savedRow.length >0) { $($t).jqGrid("saveCell",iRow,iCol); } } }); }, prevCell : function (iRow,iCol) { return this.each(function (){ var $t = this, nCol=false; if (!$t.grid || $t.p.cellEdit !== true) {return;} // try to find next editable cell for (var i=iCol-1; i>=0; i--) { if ( $t.p.colModel[i].editable ===true) { nCol = i; break; } } if(nCol !== false) { $($t).jqGrid("editCell",iRow,nCol,true); } else { if ($t.p.savedRow.length >0) { $($t).jqGrid("saveCell",iRow,iCol); } } }); }, GridNav : function() { return this.each(function () { var $t = this; if (!$t.grid || $t.p.cellEdit !== true ) {return;} // trick to process keydown on non input elements $t.p.knv = $t.p.id + "_kn"; var selection = $("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+$t.p.knv+"'></span></span>"), i, kdir; function scrollGrid(iR, iC, tp){ if (tp.substr(0,1)=='v') { var ch = $($t.grid.bDiv)[0].clientHeight, st = $($t.grid.bDiv)[0].scrollTop, nROT = $t.rows[iR].offsetTop+$t.rows[iR].clientHeight, pROT = $t.rows[iR].offsetTop; if(tp == 'vd') { if(nROT >= ch) { $($t.grid.bDiv)[0].scrollTop = $($t.grid.bDiv)[0].scrollTop + $t.rows[iR].clientHeight; } } if(tp == 'vu'){ if (pROT < st ) { $($t.grid.bDiv)[0].scrollTop = $($t.grid.bDiv)[0].scrollTop - $t.rows[iR].clientHeight; } } } if(tp=='h') { var cw = $($t.grid.bDiv)[0].clientWidth, sl = $($t.grid.bDiv)[0].scrollLeft, nCOL = $t.rows[iR].cells[iC].offsetLeft+$t.rows[iR].cells[iC].clientWidth, pCOL = $t.rows[iR].cells[iC].offsetLeft; if(nCOL >= cw+parseInt(sl,10)) { $($t.grid.bDiv)[0].scrollLeft = $($t.grid.bDiv)[0].scrollLeft + $t.rows[iR].cells[iC].clientWidth; } else if (pCOL < sl) { $($t.grid.bDiv)[0].scrollLeft = $($t.grid.bDiv)[0].scrollLeft - $t.rows[iR].cells[iC].clientWidth; } } } function findNextVisible(iC,act){ var ind, i; if(act == 'lft') { ind = iC+1; for (i=iC;i>=0;i--){ if ($t.p.colModel[i].hidden !== true) { ind = i; break; } } } if(act == 'rgt') { ind = iC-1; for (i=iC; i<$t.p.colModel.length;i++){ if ($t.p.colModel[i].hidden !== true) { ind = i; break; } } } return ind; } $(selection).insertBefore($t.grid.cDiv); $("#"+$t.p.knv) .focus() .keydown(function (e){ kdir = e.keyCode; if($t.p.direction == "rtl") { if(kdir===37) { kdir = 39;} else if (kdir===39) { kdir = 37; } } switch (kdir) { case 38: if ($t.p.iRow-1 >0 ) { scrollGrid($t.p.iRow-1,$t.p.iCol,'vu'); $($t).jqGrid("editCell",$t.p.iRow-1,$t.p.iCol,false); } break; case 40 : if ($t.p.iRow+1 <= $t.rows.length-1) { scrollGrid($t.p.iRow+1,$t.p.iCol,'vd'); $($t).jqGrid("editCell",$t.p.iRow+1,$t.p.iCol,false); } break; case 37 : if ($t.p.iCol -1 >= 0) { i = findNextVisible($t.p.iCol-1,'lft'); scrollGrid($t.p.iRow, i,'h'); $($t).jqGrid("editCell",$t.p.iRow, i,false); } break; case 39 : if ($t.p.iCol +1 <= $t.p.colModel.length-1) { i = findNextVisible($t.p.iCol+1,'rgt'); scrollGrid($t.p.iRow,i,'h'); $($t).jqGrid("editCell",$t.p.iRow,i,false); } break; case 13: if (parseInt($t.p.iCol,10)>=0 && parseInt($t.p.iRow,10)>=0) { $($t).jqGrid("editCell",$t.p.iRow,$t.p.iCol,true); } break; default : return true; } return false; }); }); }, getChangedCells : function (mthd) { var ret=[]; if (!mthd) {mthd='all';} this.each(function(){ var $t= this,nm; if (!$t.grid || $t.p.cellEdit !== true ) {return;} $($t.rows).each(function(j){ var res = {}; if ($(this).hasClass("edited")) { $('td',this).each( function(i) { nm = $t.p.colModel[i].name; if ( nm !== 'cb' && nm !== 'subgrid') { if (mthd=='dirty') { if ($(this).hasClass('dirty-cell')) { try { res[nm] = $.unformat.call($t,this,{rowId:$t.rows[j].id, colModel:$t.p.colModel[i]},i); } catch (e){ res[nm] = $.jgrid.htmlDecode($(this).html()); } } } else { try { res[nm] = $.unformat.call($t,this,{rowId:$t.rows[j].id,colModel:$t.p.colModel[i]},i); } catch (e) { res[nm] = $.jgrid.htmlDecode($(this).html()); } } } }); res.id = this.id; ret.push(res); } }); }); return ret; } /// end cell editing }); })(jQuery); ;(function($){ /** * jqGrid extension for SubGrid Data * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html **/ "use strict"; $.jgrid.extend({ setSubGrid : function () { return this.each(function (){ var $t = this, cm, suboptions = { plusicon : "ui-icon-plus", minusicon : "ui-icon-minus", openicon: "ui-icon-carat-1-sw", expandOnLoad: false, delayOnLoad : 50, selectOnExpand : false, reloadOnExpand : true }; $t.p.subGridOptions = $.extend(suboptions, $t.p.subGridOptions || {}); $t.p.colNames.unshift(""); $t.p.colModel.unshift({name:'subgrid',width: $.browser.safari ? $t.p.subGridWidth+$t.p.cellLayout : $t.p.subGridWidth,sortable: false,resizable:false,hidedlg:true,search:false,fixed:true}); cm = $t.p.subGridModel; if(cm[0]) { cm[0].align = $.extend([],cm[0].align || []); for(var i=0;i<cm[0].name.length;i++) { cm[0].align[i] = cm[0].align[i] || 'left';} } }); }, addSubGridCell :function (pos,iRow) { var prp='',ic,sid; this.each(function(){ prp = this.formatCol(pos,iRow); sid= this.p.id; ic = this.p.subGridOptions.plusicon; }); return "<td role=\"gridcell\" aria-describedby=\""+sid+"_subgrid\" class=\"ui-sgcollapsed sgcollapsed\" "+prp+"><a href='javascript:void(0);'><span class='ui-icon "+ic+"'></span></a></td>"; }, addSubGrid : function( pos, sind ) { return this.each(function(){ var ts = this; if (!ts.grid ) { return; } //------------------------- var subGridCell = function(trdiv,cell,pos) { var tddiv = $("<td align='"+ts.p.subGridModel[0].align[pos]+"'></td>").html(cell); $(trdiv).append(tddiv); }; var subGridXml = function(sjxml, sbid){ var tddiv, i, sgmap, dummy = $("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"), trdiv = $("<tr></tr>"); for (i = 0; i<ts.p.subGridModel[0].name.length; i++) { tddiv = $("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+ts.p.direction+"'></th>"); $(tddiv).html(ts.p.subGridModel[0].name[i]); $(tddiv).width( ts.p.subGridModel[0].width[i]); $(trdiv).append(tddiv); } $(dummy).append(trdiv); if (sjxml){ sgmap = ts.p.xmlReader.subgrid; $(sgmap.root+" "+sgmap.row, sjxml).each( function(){ trdiv = $("<tr class='ui-widget-content ui-subtblcell'></tr>"); if(sgmap.repeatitems === true) { $(sgmap.cell,this).each( function(i) { subGridCell(trdiv, $(this).text() || '&#160;',i); }); } else { var f = ts.p.subGridModel[0].mapping || ts.p.subGridModel[0].name; if (f) { for (i=0;i<f.length;i++) { subGridCell(trdiv, $(f[i],this).text() || '&#160;',i); } } } $(dummy).append(trdiv); }); } var pID = $("table:first",ts.grid.bDiv).attr("id")+"_"; $("#"+$.jgrid.jqID(pID+sbid)).append(dummy); ts.grid.hDiv.loading = false; $("#load_"+$.jgrid.jqID(ts.p.id)).hide(); return false; }; var subGridJson = function(sjxml, sbid){ var tddiv,result , i,cur, sgmap,j, dummy = $("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"), trdiv = $("<tr></tr>"); for (i = 0; i<ts.p.subGridModel[0].name.length; i++) { tddiv = $("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+ts.p.direction+"'></th>"); $(tddiv).html(ts.p.subGridModel[0].name[i]); $(tddiv).width( ts.p.subGridModel[0].width[i]); $(trdiv).append(tddiv); } $(dummy).append(trdiv); if (sjxml){ sgmap = ts.p.jsonReader.subgrid; result = sjxml[sgmap.root]; if ( typeof result !== 'undefined' ) { for (i=0;i<result.length;i++) { cur = result[i]; trdiv = $("<tr class='ui-widget-content ui-subtblcell'></tr>"); if(sgmap.repeatitems === true) { if(sgmap.cell) { cur=cur[sgmap.cell]; } for (j=0;j<cur.length;j++) { subGridCell(trdiv, cur[j] || '&#160;',j); } } else { var f = ts.p.subGridModel[0].mapping || ts.p.subGridModel[0].name; if(f.length) { for (j=0;j<f.length;j++) { subGridCell(trdiv, cur[f[j]] || '&#160;',j); } } } $(dummy).append(trdiv); } } } var pID = $("table:first",ts.grid.bDiv).attr("id")+"_"; $("#"+$.jgrid.jqID(pID+sbid)).append(dummy); ts.grid.hDiv.loading = false; $("#load_"+$.jgrid.jqID(ts.p.id)).hide(); return false; }; var populatesubgrid = function( rd ) { var sid,dp, i, j; sid = $(rd).attr("id"); dp = {nd_: (new Date().getTime())}; dp[ts.p.prmNames.subgridid]=sid; if(!ts.p.subGridModel[0]) { return false; } if(ts.p.subGridModel[0].params) { for(j=0; j < ts.p.subGridModel[0].params.length; j++) { for(i=0; i<ts.p.colModel.length; i++) { if(ts.p.colModel[i].name === ts.p.subGridModel[0].params[j]) { dp[ts.p.colModel[i].name]= $("td:eq("+i+")",rd).text().replace(/\&#160\;/ig,''); } } } } if(!ts.grid.hDiv.loading) { ts.grid.hDiv.loading = true; $("#load_"+$.jgrid.jqID(ts.p.id)).show(); if(!ts.p.subgridtype) { ts.p.subgridtype = ts.p.datatype; } if($.isFunction(ts.p.subgridtype)) { ts.p.subgridtype.call(ts, dp); } else { ts.p.subgridtype = ts.p.subgridtype.toLowerCase(); } switch(ts.p.subgridtype) { case "xml": case "json": $.ajax($.extend({ type:ts.p.mtype, url: ts.p.subGridUrl, dataType:ts.p.subgridtype, data: $.isFunction(ts.p.serializeSubGridData)? ts.p.serializeSubGridData.call(ts, dp) : dp, complete: function(sxml) { if(ts.p.subgridtype === "xml") { subGridXml(sxml.responseXML, sid); } else { subGridJson($.jgrid.parse(sxml.responseText),sid); } sxml=null; } }, $.jgrid.ajaxOptions, ts.p.ajaxSubgridOptions || {})); break; } } return false; }; var _id, pID,atd, nhc=0, bfsc, r; $.each(ts.p.colModel,function(){ if(this.hidden === true || this.name === 'rn' || this.name === 'cb') { nhc++; } }); var len = ts.rows.length, i=1; if( sind !== undefined && sind > 0) { i = sind; len = sind+1; } while(i < len) { if($(ts.rows[i]).hasClass('jqgrow')) { $(ts.rows[i].cells[pos]).bind('click', function() { var tr = $(this).parent("tr")[0]; r = tr.nextSibling; if($(this).hasClass("sgcollapsed")) { pID = ts.p.id; _id = tr.id; if(ts.p.subGridOptions.reloadOnExpand === true || ( ts.p.subGridOptions.reloadOnExpand === false && !$(r).hasClass('ui-subgrid') ) ) { atd = pos >=1 ? "<td colspan='"+pos+"'>&#160;</td>":""; bfsc = $(ts).triggerHandler("jqGridSubGridBeforeExpand", [pID + "_" + _id, _id]); bfsc = (bfsc === false || bfsc === 'stop') ? false : true; if(bfsc && $.isFunction(ts.p.subGridBeforeExpand)) { bfsc = ts.p.subGridBeforeExpand.call(ts, pID+"_"+_id,_id); } if(bfsc === false) {return false;} $(tr).after( "<tr role='row' class='ui-subgrid'>"+atd+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon "+ts.p.subGridOptions.openicon+"'></span></td><td colspan='"+parseInt(ts.p.colNames.length-1-nhc,10)+"' class='ui-widget-content subgrid-data'><div id="+pID+"_"+_id+" class='tablediv'></div></td></tr>" ); $(ts).triggerHandler("jqGridSubGridRowExpanded", [pID + "_" + _id, _id]); if( $.isFunction(ts.p.subGridRowExpanded)) { ts.p.subGridRowExpanded.call(ts, pID+"_"+ _id,_id); } else { populatesubgrid(tr); } } else { $(r).show(); } $(this).html("<a href='javascript:void(0);'><span class='ui-icon "+ts.p.subGridOptions.minusicon+"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded"); if(ts.p.subGridOptions.selectOnExpand) { $(ts).jqGrid('setSelection',_id); } } else if($(this).hasClass("sgexpanded")) { bfsc = $(ts).triggerHandler("jqGridSubGridRowColapsed", [pID + "_" + _id, _id]); bfsc = (bfsc === false || bfsc === 'stop') ? false : true; if( bfsc && $.isFunction(ts.p.subGridRowColapsed)) { _id = tr.id; bfsc = ts.p.subGridRowColapsed.call(ts, pID+"_"+_id,_id ); } if(bfsc===false) {return false;} if(ts.p.subGridOptions.reloadOnExpand === true) { $(r).remove(".ui-subgrid"); } else if($(r).hasClass('ui-subgrid')) { // incase of dynamic deleting $(r).hide(); } $(this).html("<a href='javascript:void(0);'><span class='ui-icon "+ts.p.subGridOptions.plusicon+"'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed"); } return false; }); } if(ts.p.subGridOptions.expandOnLoad === true) { $(ts.rows[i].cells[pos]).trigger('click'); } i++; } ts.subGridXml = function(xml,sid) {subGridXml(xml,sid);}; ts.subGridJson = function(json,sid) {subGridJson(json,sid);}; }); }, expandSubGridRow : function(rowid) { return this.each(function () { var $t = this; if(!$t.grid && !rowid) {return;} if($t.p.subGrid===true) { var rc = $(this).jqGrid("getInd",rowid,true); if(rc) { var sgc = $("td.sgcollapsed",rc)[0]; if(sgc) { $(sgc).trigger("click"); } } } }); }, collapseSubGridRow : function(rowid) { return this.each(function () { var $t = this; if(!$t.grid && !rowid) {return;} if($t.p.subGrid===true) { var rc = $(this).jqGrid("getInd",rowid,true); if(rc) { var sgc = $("td.sgexpanded",rc)[0]; if(sgc) { $(sgc).trigger("click"); } } } }); }, toggleSubGridRow : function(rowid) { return this.each(function () { var $t = this; if(!$t.grid && !rowid) {return;} if($t.p.subGrid===true) { var rc = $(this).jqGrid("getInd",rowid,true); if(rc) { var sgc = $("td.sgcollapsed",rc)[0]; if(sgc) { $(sgc).trigger("click"); } else { sgc = $("td.sgexpanded",rc)[0]; if(sgc) { $(sgc).trigger("click"); } } } } }); } }); })(jQuery); /** * jqGrid extension - Tree Grid * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ /*global document, jQuery, $ */ (function($) { "use strict"; $.jgrid.extend({ setTreeNode : function(i, len){ return this.each(function(){ var $t = this; if( !$t.grid || !$t.p.treeGrid ) {return;} var expCol = $t.p.expColInd, expanded = $t.p.treeReader.expanded_field, isLeaf = $t.p.treeReader.leaf_field, level = $t.p.treeReader.level_field, icon = $t.p.treeReader.icon_field, loaded = $t.p.treeReader.loaded, lft, rgt, curLevel, ident,lftpos, twrap, ldat, lf; while(i<len) { var ind = $t.rows[i].id, dind = $t.p._index[ind], expan; ldat = $t.p.data[dind]; //$t.rows[i].level = ldat[level]; if($t.p.treeGridModel == 'nested') { if(!ldat[isLeaf]) { lft = parseInt(ldat[$t.p.treeReader.left_field],10); rgt = parseInt(ldat[$t.p.treeReader.right_field],10); // NS Model ldat[isLeaf] = (rgt === lft+1) ? 'true' : 'false'; $t.rows[i].cells[$t.p._treeleafpos].innerHTML = ldat[isLeaf]; } } //else { //row.parent_id = rd[$t.p.treeReader.parent_id_field]; //} curLevel = parseInt(ldat[level],10); if($t.p.tree_root_level === 0) { ident = curLevel+1; lftpos = curLevel; } else { ident = curLevel; lftpos = curLevel -1; } twrap = "<div class='tree-wrap tree-wrap-"+$t.p.direction+"' style='width:"+(ident*18)+"px;'>"; twrap += "<div style='"+($t.p.direction=="rtl" ? "right:" : "left:")+(lftpos*18)+"px;' class='ui-icon "; if(ldat[loaded] !== undefined) { if(ldat[loaded]=="true" || ldat[loaded]===true) { ldat[loaded] = true; } else { ldat[loaded] = false; } } if(ldat[isLeaf] == "true" || ldat[isLeaf] === true) { twrap += ((ldat[icon] !== undefined && ldat[icon] !== "") ? ldat[icon] : $t.p.treeIcons.leaf)+" tree-leaf treeclick"; ldat[isLeaf] = true; lf="leaf"; } else { ldat[isLeaf] = false; lf=""; } ldat[expanded] = ((ldat[expanded] == "true" || ldat[expanded] === true) ? true : false) && ldat[loaded]; if(ldat[expanded] === false) { twrap += ((ldat[isLeaf] === true) ? "'" : $t.p.treeIcons.plus+" tree-plus treeclick'"); } else { twrap += ((ldat[isLeaf] === true) ? "'" : $t.p.treeIcons.minus+" tree-minus treeclick'"); } twrap += "></div></div>"; $($t.rows[i].cells[expCol]).wrapInner("<span class='cell-wrapper"+lf+"'></span>").prepend(twrap); if(curLevel !== parseInt($t.p.tree_root_level,10)) { var pn = $($t).jqGrid('getNodeParent',ldat); expan = pn && pn.hasOwnProperty(expanded) ? pn[expanded] : true; if( !expan ){ $($t.rows[i]).css("display","none"); } } $($t.rows[i].cells[expCol]) .find("div.treeclick") .bind("click",function(e){ var target = e.target || e.srcElement, ind2 =$(target,$t.rows).closest("tr.jqgrow")[0].id, pos = $t.p._index[ind2]; if(!$t.p.data[pos][isLeaf]){ if($t.p.data[pos][expanded]){ $($t).jqGrid("collapseRow",$t.p.data[pos]); $($t).jqGrid("collapseNode",$t.p.data[pos]); } else { $($t).jqGrid("expandRow",$t.p.data[pos]); $($t).jqGrid("expandNode",$t.p.data[pos]); } } return false; }); if($t.p.ExpandColClick === true) { $($t.rows[i].cells[expCol]) .find("span.cell-wrapper") .css("cursor","pointer") .bind("click",function(e) { var target = e.target || e.srcElement, ind2 =$(target,$t.rows).closest("tr.jqgrow")[0].id, pos = $t.p._index[ind2]; if(!$t.p.data[pos][isLeaf]){ if($t.p.data[pos][expanded]){ $($t).jqGrid("collapseRow",$t.p.data[pos]); $($t).jqGrid("collapseNode",$t.p.data[pos]); } else { $($t).jqGrid("expandRow",$t.p.data[pos]); $($t).jqGrid("expandNode",$t.p.data[pos]); } } $($t).jqGrid("setSelection",ind2); return false; }); } i++; } }); }, setTreeGrid : function() { return this.each(function (){ var $t = this, i=0, pico, ecol = false, nm, key, dupcols=[]; if(!$t.p.treeGrid) {return;} if(!$t.p.treedatatype ) {$.extend($t.p,{treedatatype: $t.p.datatype});} $t.p.subGrid = false;$t.p.altRows =false; $t.p.pgbuttons = false;$t.p.pginput = false; $t.p.gridview = true; if($t.p.rowTotal === null ) { $t.p.rowNum = 10000; } $t.p.multiselect = false;$t.p.rowList = []; $t.p.expColInd = 0; pico = 'ui-icon-triangle-1-' + ($t.p.direction=="rtl" ? 'w' : 'e'); $t.p.treeIcons = $.extend({plus:pico,minus:'ui-icon-triangle-1-s',leaf:'ui-icon-radio-off'},$t.p.treeIcons || {}); if($t.p.treeGridModel == 'nested') { $t.p.treeReader = $.extend({ level_field: "level", left_field:"lft", right_field: "rgt", leaf_field: "isLeaf", expanded_field: "expanded", loaded: "loaded", icon_field: "icon" },$t.p.treeReader); } else if($t.p.treeGridModel == 'adjacency') { $t.p.treeReader = $.extend({ level_field: "level", parent_id_field: "parent", leaf_field: "isLeaf", expanded_field: "expanded", loaded: "loaded", icon_field: "icon" },$t.p.treeReader ); } for ( key in $t.p.colModel){ if($t.p.colModel.hasOwnProperty(key)) { nm = $t.p.colModel[key].name; if( nm == $t.p.ExpandColumn && !ecol ) { ecol = true; $t.p.expColInd = i; } i++; // for(var tkey in $t.p.treeReader) { if($t.p.treeReader[tkey] == nm) { dupcols.push(nm); } } } } $.each($t.p.treeReader,function(j,n){ if(n && $.inArray(n, dupcols) === -1){ if(j==='leaf_field') { $t.p._treeleafpos= i; } i++; $t.p.colNames.push(n); $t.p.colModel.push({name:n,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false}); } }); }); }, expandRow: function (record){ this.each(function(){ var $t = this; if(!$t.grid || !$t.p.treeGrid) {return;} var childern = $($t).jqGrid("getNodeChildren",record), //if ($($t).jqGrid("isVisibleNode",record)) { expanded = $t.p.treeReader.expanded_field, rows = $t.rows; $(childern).each(function(){ var id = $.jgrid.getAccessor(this,$t.p.localReader.id); $(rows.namedItem(id)).css("display",""); if(this[expanded]) { $($t).jqGrid("expandRow",this); } }); //} }); }, collapseRow : function (record) { this.each(function(){ var $t = this; if(!$t.grid || !$t.p.treeGrid) {return;} var childern = $($t).jqGrid("getNodeChildren",record), expanded = $t.p.treeReader.expanded_field, rows = $t.rows; $(childern).each(function(){ var id = $.jgrid.getAccessor(this,$t.p.localReader.id); $(rows.namedItem(id)).css("display","none"); if(this[expanded]){ $($t).jqGrid("collapseRow",this); } }); }); }, // NS ,adjacency models getRootNodes : function() { var result = []; this.each(function(){ var $t = this; if(!$t.grid || !$t.p.treeGrid) {return;} switch ($t.p.treeGridModel) { case 'nested' : var level = $t.p.treeReader.level_field; $($t.p.data).each(function(){ if(parseInt(this[level],10) === parseInt($t.p.tree_root_level,10)) { result.push(this); } }); break; case 'adjacency' : var parent_id = $t.p.treeReader.parent_id_field; $($t.p.data).each(function(){ if(this[parent_id] === null || String(this[parent_id]).toLowerCase() == "null") { result.push(this); } }); break; } }); return result; }, getNodeDepth : function(rc) { var ret = null; this.each(function(){ if(!this.grid || !this.p.treeGrid) {return;} var $t = this; switch ($t.p.treeGridModel) { case 'nested' : var level = $t.p.treeReader.level_field; ret = parseInt(rc[level],10) - parseInt($t.p.tree_root_level,10); break; case 'adjacency' : ret = $($t).jqGrid("getNodeAncestors",rc).length; break; } }); return ret; }, getNodeParent : function(rc) { var result = null; this.each(function(){ var $t = this; if(!$t.grid || !$t.p.treeGrid) {return;} switch ($t.p.treeGridModel) { case 'nested' : var lftc = $t.p.treeReader.left_field, rgtc = $t.p.treeReader.right_field, levelc = $t.p.treeReader.level_field, lft = parseInt(rc[lftc],10), rgt = parseInt(rc[rgtc],10), level = parseInt(rc[levelc],10); $(this.p.data).each(function(){ if(parseInt(this[levelc],10) === level-1 && parseInt(this[lftc],10) < lft && parseInt(this[rgtc],10) > rgt) { result = this; return false; } }); break; case 'adjacency' : var parent_id = $t.p.treeReader.parent_id_field, dtid = $t.p.localReader.id; $(this.p.data).each(function(){ if(this[dtid] == rc[parent_id] ) { result = this; return false; } }); break; } }); return result; }, getNodeChildren : function(rc) { var result = []; this.each(function(){ var $t = this; if(!$t.grid || !$t.p.treeGrid) {return;} switch ($t.p.treeGridModel) { case 'nested' : var lftc = $t.p.treeReader.left_field, rgtc = $t.p.treeReader.right_field, levelc = $t.p.treeReader.level_field, lft = parseInt(rc[lftc],10), rgt = parseInt(rc[rgtc],10), level = parseInt(rc[levelc],10); $(this.p.data).each(function(){ if(parseInt(this[levelc],10) === level+1 && parseInt(this[lftc],10) > lft && parseInt(this[rgtc],10) < rgt) { result.push(this); } }); break; case 'adjacency' : var parent_id = $t.p.treeReader.parent_id_field, dtid = $t.p.localReader.id; $(this.p.data).each(function(){ if(this[parent_id] == rc[dtid]) { result.push(this); } }); break; } }); return result; }, getFullTreeNode : function(rc) { var result = []; this.each(function(){ var $t = this, len; if(!$t.grid || !$t.p.treeGrid) {return;} switch ($t.p.treeGridModel) { case 'nested' : var lftc = $t.p.treeReader.left_field, rgtc = $t.p.treeReader.right_field, levelc = $t.p.treeReader.level_field, lft = parseInt(rc[lftc],10), rgt = parseInt(rc[rgtc],10), level = parseInt(rc[levelc],10); $(this.p.data).each(function(){ if(parseInt(this[levelc],10) >= level && parseInt(this[lftc],10) >= lft && parseInt(this[lftc],10) <= rgt) { result.push(this); } }); break; case 'adjacency' : if(rc) { result.push(rc); var parent_id = $t.p.treeReader.parent_id_field, dtid = $t.p.localReader.id; $(this.p.data).each(function(i){ len = result.length; for (i = 0; i < len; i++) { if (result[i][dtid] == this[parent_id]) { result.push(this); break; } } }); } break; } }); return result; }, // End NS, adjacency Model getNodeAncestors : function(rc) { var ancestors = []; this.each(function(){ if(!this.grid || !this.p.treeGrid) {return;} var parent = $(this).jqGrid("getNodeParent",rc); while (parent) { ancestors.push(parent); parent = $(this).jqGrid("getNodeParent",parent); } }); return ancestors; }, isVisibleNode : function(rc) { var result = true; this.each(function(){ var $t = this; if(!$t.grid || !$t.p.treeGrid) {return;} var ancestors = $($t).jqGrid("getNodeAncestors",rc), expanded = $t.p.treeReader.expanded_field; $(ancestors).each(function(){ result = result && this[expanded]; if(!result) {return false;} }); }); return result; }, isNodeLoaded : function(rc) { var result; this.each(function(){ var $t = this; if(!$t.grid || !$t.p.treeGrid) {return;} var isLeaf = $t.p.treeReader.leaf_field; if(rc !== undefined ) { if(rc.loaded !== undefined) { result = rc.loaded; } else if( rc[isLeaf] || $($t).jqGrid("getNodeChildren",rc).length > 0){ result = true; } else { result = false; } } else { result = false; } }); return result; }, expandNode : function(rc) { return this.each(function(){ if(!this.grid || !this.p.treeGrid) {return;} var expanded = this.p.treeReader.expanded_field, parent = this.p.treeReader.parent_id_field, loaded = this.p.treeReader.loaded, level = this.p.treeReader.level_field, lft = this.p.treeReader.left_field, rgt = this.p.treeReader.right_field; if(!rc[expanded]) { var id = $.jgrid.getAccessor(rc,this.p.localReader.id); var rc1 = $("#"+$.jgrid.jqID(id),this.grid.bDiv)[0]; var position = this.p._index[id]; if( $(this).jqGrid("isNodeLoaded",this.p.data[position]) ) { rc[expanded] = true; $("div.treeclick",rc1).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus"); } else if (!this.grid.hDiv.loading) { rc[expanded] = true; $("div.treeclick",rc1).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus"); this.p.treeANode = rc1.rowIndex; this.p.datatype = this.p.treedatatype; if(this.p.treeGridModel == 'nested') { $(this).jqGrid("setGridParam",{postData:{nodeid:id,n_left:rc[lft],n_right:rc[rgt],n_level:rc[level]}}); } else { $(this).jqGrid("setGridParam",{postData:{nodeid:id,parentid:rc[parent],n_level:rc[level]}} ); } $(this).trigger("reloadGrid"); rc[loaded] = true; if(this.p.treeGridModel == 'nested') { $(this).jqGrid("setGridParam",{postData:{nodeid:'',n_left:'',n_right:'',n_level:''}}); } else { $(this).jqGrid("setGridParam",{postData:{nodeid:'',parentid:'',n_level:''}}); } } } }); }, collapseNode : function(rc) { return this.each(function(){ if(!this.grid || !this.p.treeGrid) {return;} var expanded = this.p.treeReader.expanded_field; if(rc[expanded]) { rc[expanded] = false; var id = $.jgrid.getAccessor(rc,this.p.localReader.id); var rc1 = $("#"+$.jgrid.jqID(id),this.grid.bDiv)[0]; $("div.treeclick",rc1).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus"); } }); }, SortTree : function( sortname, newDir, st, datefmt) { return this.each(function(){ if(!this.grid || !this.p.treeGrid) {return;} var i, len, rec, records = [], $t = this, query, roots, rt = $(this).jqGrid("getRootNodes"); // Sorting roots query = $.jgrid.from(rt); query.orderBy(sortname,newDir,st, datefmt); roots = query.select(); // Sorting children for (i = 0, len = roots.length; i < len; i++) { rec = roots[i]; records.push(rec); $(this).jqGrid("collectChildrenSortTree",records, rec, sortname, newDir,st, datefmt); } $.each(records, function(index) { var id = $.jgrid.getAccessor(this,$t.p.localReader.id); $('#'+$.jgrid.jqID($t.p.id)+ ' tbody tr:eq('+index+')').after($('tr#'+$.jgrid.jqID(id),$t.grid.bDiv)); }); query = null;roots=null;records=null; }); }, collectChildrenSortTree : function(records, rec, sortname, newDir,st, datefmt) { return this.each(function(){ if(!this.grid || !this.p.treeGrid) {return;} var i, len, child, ch, query, children; ch = $(this).jqGrid("getNodeChildren",rec); query = $.jgrid.from(ch); query.orderBy(sortname, newDir, st, datefmt); children = query.select(); for (i = 0, len = children.length; i < len; i++) { child = children[i]; records.push(child); $(this).jqGrid("collectChildrenSortTree",records, child, sortname, newDir, st, datefmt); } }); }, // experimental setTreeRow : function(rowid, data) { var success=false; this.each(function(){ var t = this; if(!t.grid || !t.p.treeGrid) {return;} success = $(t).jqGrid("setRowData",rowid,data); }); return success; }, delTreeNode : function (rowid) { return this.each(function () { var $t = this, rid = $t.p.localReader.id, left = $t.p.treeReader.left_field, right = $t.p.treeReader.right_field, myright, width, res, key; if(!$t.grid || !$t.p.treeGrid) {return;} var rc = $t.p._index[rowid]; if (rc !== undefined) { // nested myright = parseInt($t.p.data[rc][right],10); width = myright - parseInt($t.p.data[rc][left],10) + 1; var dr = $($t).jqGrid("getFullTreeNode",$t.p.data[rc]); if(dr.length>0){ for (var i=0;i<dr.length;i++){ $($t).jqGrid("delRowData",dr[i][rid]); } } if( $t.p.treeGridModel === "nested") { // ToDo - update grid data res = $.jgrid.from($t.p.data) .greater(left,myright,{stype:'integer'}) .select(); if(res.length) { for( key in res) { if(res.hasOwnProperty(key)) { res[key][left] = parseInt(res[key][left],10) - width ; } } } res = $.jgrid.from($t.p.data) .greater(right,myright,{stype:'integer'}) .select(); if(res.length) { for( key in res) { if(res.hasOwnProperty(key)) { res[key][right] = parseInt(res[key][right],10) - width ; } } } } } }); }, addChildNode : function( nodeid, parentid, data ) { //return this.each(function(){ var $t = this[0]; if(data) { // we suppose tha the id is autoincremet and var expanded = $t.p.treeReader.expanded_field, isLeaf = $t.p.treeReader.leaf_field, level = $t.p.treeReader.level_field, //icon = $t.p.treeReader.icon_field, parent = $t.p.treeReader.parent_id_field, left = $t.p.treeReader.left_field, right = $t.p.treeReader.right_field, loaded = $t.p.treeReader.loaded, method, parentindex, parentdata, parentlevel, i, len, max=0, rowind = parentid, leaf, maxright; if ( typeof nodeid === 'undefined' || nodeid === null ) { i = $t.p.data.length-1; if( i>= 0 ) { while(i>=0){max = Math.max(max, parseInt($t.p.data[i][$t.p.localReader.id],10)); i--;} } nodeid = max+1; } var prow = $($t).jqGrid('getInd', parentid); leaf = false; // if not a parent we assume root if ( parentid === undefined || parentid === null || parentid==="") { parentid = null; rowind = null; method = 'last'; parentlevel = $t.p.tree_root_level; i = $t.p.data.length+1; } else { method = 'after'; parentindex = $t.p._index[parentid]; parentdata = $t.p.data[parentindex]; parentid = parentdata[$t.p.localReader.id]; parentlevel = parseInt(parentdata[level],10)+1; var childs = $($t).jqGrid('getFullTreeNode', parentdata); // if there are child nodes get the last index of it if(childs.length) { i = childs[childs.length-1][$t.p.localReader.id]; rowind = i; i = $($t).jqGrid('getInd',rowind)+1; } else { i = $($t).jqGrid('getInd', parentid)+1; } // if the node is leaf if(parentdata[isLeaf]) { leaf = true; parentdata[expanded] = true; //var prow = $($t).jqGrid('getInd', parentid); $($t.rows[prow]) .find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper") .end() .find("div.tree-leaf").removeClass($t.p.treeIcons.leaf+" tree-leaf").addClass($t.p.treeIcons.minus+" tree-minus"); $t.p.data[parentindex][isLeaf] = false; parentdata[loaded] = true; } } len = i+1; data[expanded] = false; data[loaded] = true; data[level] = parentlevel; data[isLeaf] = true; if( $t.p.treeGridModel === "adjacency") { data[parent] = parentid; } if( $t.p.treeGridModel === "nested") { // this method requiere more attention var query, res, key; //maxright = parseInt(maxright,10); // ToDo - update grid data if(parentid !== null) { maxright = parseInt(parentdata[right],10); query = $.jgrid.from($t.p.data); query = query.greaterOrEquals(right,maxright,{stype:'integer'}); res = query.select(); if(res.length) { for( key in res) { if(res.hasOwnProperty(key)) { res[key][left] = res[key][left] > maxright ? parseInt(res[key][left],10) +2 : res[key][left]; res[key][right] = res[key][right] >= maxright ? parseInt(res[key][right],10) +2 : res[key][right]; } } } data[left] = maxright; data[right]= maxright+1; } else { maxright = parseInt( $($t).jqGrid('getCol', right, false, 'max'), 10); res = $.jgrid.from($t.p.data) .greater(left,maxright,{stype:'integer'}) .select(); if(res.length) { for( key in res) { if(res.hasOwnProperty(key)) { res[key][left] = parseInt(res[key][left],10) +2 ; } } } res = $.jgrid.from($t.p.data) .greater(right,maxright,{stype:'integer'}) .select(); if(res.length) { for( key in res) { if(res.hasOwnProperty(key)) { res[key][right] = parseInt(res[key][right],10) +2 ; } } } data[left] = maxright+1; data[right] = maxright + 2; } } if( parentid === null || $($t).jqGrid("isNodeLoaded",parentdata) || leaf ) { $($t).jqGrid('addRowData', nodeid, data, method, rowind); $($t).jqGrid('setTreeNode', i, len); } if(parentdata && !parentdata[expanded]) { $($t.rows[prow]) .find("div.treeclick") .click(); } } //}); } }); })(jQuery); // Grouping module ;(function($){ "use strict"; $.jgrid.extend({ groupingSetup : function () { return this.each(function (){ var $t = this, grp = $t.p.groupingView; if(grp !== null && ( (typeof grp === 'object') || $.isFunction(grp) ) ) { if(!grp.groupField.length) { $t.p.grouping = false; } else { if ( typeof(grp.visibiltyOnNextGrouping) == 'undefined') { grp.visibiltyOnNextGrouping = []; } for(var i=0;i<grp.groupField.length;i++) { if(!grp.groupOrder[i]) { grp.groupOrder[i] = 'asc'; } if(!grp.groupText[i]) { grp.groupText[i] = '{0}'; } if( typeof(grp.groupColumnShow[i]) != 'boolean') { grp.groupColumnShow[i] = true; } if( typeof(grp.groupSummary[i]) != 'boolean') { grp.groupSummary[i] = false; } if(grp.groupColumnShow[i] === true) { grp.visibiltyOnNextGrouping[i] = true; $($t).jqGrid('showCol',grp.groupField[i]); } else { grp.visibiltyOnNextGrouping[i] = $("#"+$.jgrid.jqID($t.p.id+"_"+grp.groupField[i])).is(":visible"); $($t).jqGrid('hideCol',grp.groupField[i]); } grp.sortitems[i] = []; grp.sortnames[i] = []; grp.summaryval[i] = []; if(grp.groupSummary[i]) { grp.summary[i] =[]; var cm = $t.p.colModel; for(var j=0, cml = cm.length; j < cml; j++) { if(cm[j].summaryType) { grp.summary[i].push({nm:cm[j].name,st:cm[j].summaryType, v:''}); } } } } } } else { $t.p.grouping = false; } }); }, groupingPrepare : function (rData, items, gdata, record) { this.each(function(){ // currently only one level // Is this a good idea to do it so!!!!????? items[0] += ""; var itm = items[0].toString().split(' ').join(''); var grp = this.p.groupingView, $t= this; if(gdata.hasOwnProperty(itm)) { gdata[itm].push(rData); } else { gdata[itm] = []; gdata[itm].push(rData); grp.sortitems[0].push(itm); grp.sortnames[0].push($.trim(items[0].toString())); grp.summaryval[0][itm] = $.extend(true,[],grp.summary[0]); } if(grp.groupSummary[0]) { $.each(grp.summaryval[0][itm],function() { if ($.isFunction(this.st)) { this.v = this.st.call($t, this.v, this.nm, record); } else { this.v = $($t).jqGrid('groupingCalculations.'+this.st, this.v, this.nm, record); } }); } }); return gdata; }, groupingToggle : function(hid){ this.each(function(){ var $t = this, grp = $t.p.groupingView, strpos = hid.lastIndexOf('_'), uid = hid.substring(0,strpos+1), num = parseInt(hid.substring(strpos+1),10)+1, minus = grp.minusicon, plus = grp.plusicon, tar = $("#"+$.jgrid.jqID(hid)), r = tar.length ? tar[0].nextSibling : null, tarspan = $("#"+$.jgrid.jqID(hid)+" span."+"tree-wrap-"+$t.p.direction), collapsed = false; if( tarspan.hasClass(minus) ) { if(grp.showSummaryOnHide && grp.groupSummary[0]) { if(r){ while(r) { if($(r).hasClass('jqfoot') ) { break; } $(r).hide(); r = r.nextSibling; } } } else { if(r){ while(r) { if($(r).attr('id') ==uid+String(num) ) { break; } $(r).hide(); r = r.nextSibling; } } } tarspan.removeClass(minus).addClass(plus); collapsed = true; } else { if(r){ while(r) { if($(r).attr('id') ==uid+String(num) ) { break; } $(r).show(); r = r.nextSibling; } } tarspan.removeClass(plus).addClass(minus); } $($t).triggerHandler("jqGridGroupingClickGroup", [hid , collapsed]); if( $.isFunction($t.p.onClickGroup)) { $t.p.onClickGroup.call($t, hid , collapsed); } }); return false; }, groupingRender : function (grdata, colspans ) { return this.each(function(){ var $t = this, grp = $t.p.groupingView, str = "", icon = "", hid, pmrtl = grp.groupCollapse ? grp.plusicon : grp.minusicon, gv, cp, ii; //only one level for now if(!grp.groupDataSorted) { // ???? TO BE IMPROVED grp.sortitems[0].sort(); grp.sortnames[0].sort(); if(grp.groupOrder[0].toLowerCase() == 'desc') { grp.sortitems[0].reverse(); grp.sortnames[0].reverse(); } } pmrtl += " tree-wrap-"+$t.p.direction; ii = 0; while(ii < colspans) { if($t.p.colModel[ii].name == grp.groupField[0]) { cp = ii; break; } ii++; } $.each(grp.sortitems[0],function(i,n){ hid = $t.p.id+"ghead_"+i; icon = "<span style='cursor:pointer;' class='ui-icon "+pmrtl+"' onclick=\"jQuery('#"+$.jgrid.jqID($t.p.id)+"').jqGrid('groupingToggle','"+hid+"');return false;\"></span>"; try { gv = $t.formatter(hid, grp.sortnames[0][i], cp, grp.sortitems[0] ); } catch (egv) { gv = grp.sortnames[0][i]; } str += "<tr id=\""+hid+"\" role=\"row\" class= \"ui-widget-content jqgroup ui-row-"+$t.p.direction+"\"><td colspan=\""+colspans+"\">"+icon+$.jgrid.format(grp.groupText[0], gv, grdata[n].length)+"</td></tr>"; for(var kk=0;kk<grdata[n].length;kk++) { str += grdata[n][kk].join(''); } if(grp.groupSummary[0]) { var hhdr = ""; if(grp.groupCollapse && !grp.showSummaryOnHide) { hhdr = " style=\"display:none;\""; } str += "<tr"+hhdr+" role=\"row\" class=\"ui-widget-content jqfoot ui-row-"+$t.p.direction+"\">"; var fdata = grp.summaryval[0][n], cm = $t.p.colModel, vv, grlen = grdata[n].length; for(var k=0; k<colspans;k++) { var tmpdata = "<td "+$t.formatCol(k,1,'')+">&#160;</td>", tplfld = "{0}"; $.each(fdata,function(){ if(this.nm == cm[k].name) { if(cm[k].summaryTpl) { tplfld = cm[k].summaryTpl; } if(this.st == 'avg') { if(this.v && grlen > 0) { this.v = (this.v/grlen); } } try { vv = $t.formatter('', this.v, k, this); } catch (ef) { vv = this.v; } tmpdata= "<td "+$t.formatCol(k,1,'')+">"+$.jgrid.format(tplfld,vv)+ "</td>"; return false; } }); str += tmpdata; } str += "</tr>"; } }); $("#"+$.jgrid.jqID($t.p.id)+" tbody:first").append(str); // free up memory str = null; }); }, groupingGroupBy : function (name, options ) { return this.each(function(){ var $t = this; if(typeof(name) == "string") { name = [name]; } var grp = $t.p.groupingView; $t.p.grouping = true; //Set default, in case visibilityOnNextGrouping is undefined if (typeof grp.visibiltyOnNextGrouping == "undefined") { grp.visibiltyOnNextGrouping = []; } var i; // show previous hidden groups if they are hidden and weren't removed yet for(i=0;i<grp.groupField.length;i++) { if(!grp.groupColumnShow[i] && grp.visibiltyOnNextGrouping[i]) { $($t).jqGrid('showCol',grp.groupField[i]); } } // set visibility status of current group columns on next grouping for(i=0;i<name.length;i++) { grp.visibiltyOnNextGrouping[i] = $("#"+$.jgrid.jqID($t.p.id)+"_"+$.jgrid.jqID(name[i])).is(":visible"); } $t.p.groupingView = $.extend($t.p.groupingView, options || {}); grp.groupField = name; $($t).trigger("reloadGrid"); }); }, groupingRemove : function (current) { return this.each(function(){ var $t = this; if(typeof(current) == 'undefined') { current = true; } $t.p.grouping = false; if(current===true) { var grp = $t.p.groupingView; // show previous hidden groups if they are hidden and weren't removed yet for(var i=0;i<grp.groupField.length;i++) { if (!grp.groupColumnShow[i] && grp.visibiltyOnNextGrouping[i]) { $($t).jqGrid('showCol', grp.groupField); } } $("tr.jqgroup, tr.jqfoot","#"+$.jgrid.jqID($t.p.id)+" tbody:first").remove(); $("tr.jqgrow:hidden","#"+$.jgrid.jqID($t.p.id)+" tbody:first").show(); } else { $($t).trigger("reloadGrid"); } }); }, groupingCalculations : { "sum" : function(v, field, rc) { return parseFloat(v||0) + parseFloat((rc[field]||0)); }, "min" : function(v, field, rc) { if(v==="") { return parseFloat(rc[field]||0); } return Math.min(parseFloat(v),parseFloat(rc[field]||0)); }, "max" : function(v, field, rc) { if(v==="") { return parseFloat(rc[field]||0); } return Math.max(parseFloat(v),parseFloat(rc[field]||0)); }, "count" : function(v, field, rc) { if(v==="") {v=0;} if(rc.hasOwnProperty(field)) { return v+1; } else { return 0; } }, "avg" : function(v, field, rc) { // the same as sum, but at end we divide it return parseFloat(v||0) + parseFloat((rc[field]||0)); } } }); })(jQuery); ;(function($){ /* * jqGrid extension for constructing Grid Data from external file * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html **/ //jsHint options /*global jQuery, $, alert, xmlJsonClass */ "use strict"; $.jgrid.extend({ jqGridImport : function(o) { o = $.extend({ imptype : "xml", // xml, json, xmlstring, jsonstring impstring: "", impurl: "", mtype: "GET", impData : {}, xmlGrid :{ config : "roots>grid", data: "roots>rows" }, jsonGrid :{ config : "grid", data: "data" }, ajaxOptions :{} }, o || {}); return this.each(function(){ var $t = this; var xmlConvert = function (xml,o) { var cnfg = $(o.xmlGrid.config,xml)[0]; var xmldata = $(o.xmlGrid.data,xml)[0], jstr, jstr1; if(xmlJsonClass.xml2json && $.jgrid.parse) { jstr = xmlJsonClass.xml2json(cnfg," "); jstr = $.jgrid.parse(jstr); for(var key in jstr) { if(jstr.hasOwnProperty(key)) { jstr1=jstr[key]; } } if(xmldata) { // save the datatype var svdatatype = jstr.grid.datatype; jstr.grid.datatype = 'xmlstring'; jstr.grid.datastr = xml; $($t).jqGrid( jstr1 ).jqGrid("setGridParam",{datatype:svdatatype}); } else { $($t).jqGrid( jstr1 ); } jstr = null;jstr1=null; } else { alert("xml2json or parse are not present"); } }; var jsonConvert = function (jsonstr,o){ if (jsonstr && typeof jsonstr == 'string') { var _jsonparse = false; if($.jgrid.useJSON) { $.jgrid.useJSON = false; _jsonparse = true; } var json = $.jgrid.parse(jsonstr); if(_jsonparse) { $.jgrid.useJSON = true; } var gprm = json[o.jsonGrid.config]; var jdata = json[o.jsonGrid.data]; if(jdata) { var svdatatype = gprm.datatype; gprm.datatype = 'jsonstring'; gprm.datastr = jdata; $($t).jqGrid( gprm ).jqGrid("setGridParam",{datatype:svdatatype}); } else { $($t).jqGrid( gprm ); } } }; switch (o.imptype){ case 'xml': $.ajax($.extend({ url:o.impurl, type:o.mtype, data: o.impData, dataType:"xml", complete: function(xml,stat) { if(stat == 'success') { xmlConvert(xml.responseXML,o); $($t).triggerHandler("jqGridImportComplete", [xml, o]); if($.isFunction(o.importComplete)) { o.importComplete(xml); } } xml=null; } }, o.ajaxOptions)); break; case 'xmlstring' : // we need to make just the conversion and use the same code as xml if(o.impstring && typeof o.impstring == 'string') { var xmld = $.jgrid.stringToDoc(o.impstring); if(xmld) { xmlConvert(xmld,o); $($t).triggerHandler("jqGridImportComplete", [xmld, o]); if($.isFunction(o.importComplete)) { o.importComplete(xmld); } o.impstring = null; } xmld = null; } break; case 'json': $.ajax($.extend({ url:o.impurl, type:o.mtype, data: o.impData, dataType:"json", complete: function(json) { try { jsonConvert(json.responseText,o ); $($t).triggerHandler("jqGridImportComplete", [json, o]); if($.isFunction(o.importComplete)) { o.importComplete(json); } } catch (ee){} json=null; } }, o.ajaxOptions )); break; case 'jsonstring' : if(o.impstring && typeof o.impstring == 'string') { jsonConvert(o.impstring,o ); $($t).triggerHandler("jqGridImportComplete", [o.impstring, o]); if($.isFunction(o.importComplete)) { o.importComplete(o.impstring); } o.impstring = null; } break; } }); }, jqGridExport : function(o) { o = $.extend({ exptype : "xmlstring", root: "grid", ident: "\t" }, o || {}); var ret = null; this.each(function () { if(!this.grid) { return;} var gprm = $.extend(true, {},$(this).jqGrid("getGridParam")); // we need to check for: // 1.multiselect, 2.subgrid 3. treegrid and remove the unneded columns from colNames if(gprm.rownumbers) { gprm.colNames.splice(0,1); gprm.colModel.splice(0,1); } if(gprm.multiselect) { gprm.colNames.splice(0,1); gprm.colModel.splice(0,1); } if(gprm.subGrid) { gprm.colNames.splice(0,1); gprm.colModel.splice(0,1); } gprm.knv = null; if(gprm.treeGrid) { for (var key in gprm.treeReader) { if(gprm.treeReader.hasOwnProperty(key)) { gprm.colNames.splice(gprm.colNames.length-1); gprm.colModel.splice(gprm.colModel.length-1); } } } switch (o.exptype) { case 'xmlstring' : ret = "<"+o.root+">"+xmlJsonClass.json2xml(gprm,o.ident)+"</"+o.root+">"; break; case 'jsonstring' : ret = "{"+ xmlJsonClass.toJson(gprm,o.root,o.ident,false)+"}"; if(gprm.postData.filters !== undefined) { ret=ret.replace(/filters":"/,'filters":'); ret=ret.replace(/}]}"/,'}]}'); } break; } }); return ret; }, excelExport : function(o) { o = $.extend({ exptype : "remote", url : null, oper: "oper", tag: "excel", exportOptions : {} }, o || {}); return this.each(function(){ if(!this.grid) { return;} var url; if(o.exptype == "remote") { var pdata = $.extend({},this.p.postData); pdata[o.oper] = o.tag; var params = jQuery.param(pdata); if(o.url.indexOf("?") != -1) { url = o.url+"&"+params; } else { url = o.url+"?"+params; } window.location = url; } }); } }); })(jQuery);;(function($){ /* ** * jqGrid addons using jQuery UI * Author: Mark Williams * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html * depends on jQuery UI **/ if ($.browser.msie && $.browser.version==8) { $.expr[":"].hidden = function(elem) { return elem.offsetWidth === 0 || elem.offsetHeight === 0 || elem.style.display == "none"; }; } // requiere load multiselect before grid $.jgrid._multiselect = false; if($.ui) { if ($.ui.multiselect ) { if($.ui.multiselect.prototype._setSelected) { var setSelected = $.ui.multiselect.prototype._setSelected; $.ui.multiselect.prototype._setSelected = function(item,selected) { var ret = setSelected.call(this,item,selected); if (selected && this.selectedList) { var elt = this.element; this.selectedList.find('li').each(function() { if ($(this).data('optionLink')) { $(this).data('optionLink').remove().appendTo(elt); } }); } return ret; }; } if($.ui.multiselect.prototype.destroy) { $.ui.multiselect.prototype.destroy = function() { this.element.show(); this.container.remove(); if ($.Widget === undefined) { $.widget.prototype.destroy.apply(this, arguments); } else { $.Widget.prototype.destroy.apply(this, arguments); } }; } $.jgrid._multiselect = true; } } $.jgrid.extend({ sortableColumns : function (tblrow) { return this.each(function (){ var ts = this, tid= $.jgrid.jqID( ts.p.id ); function start() {ts.p.disableClick = true;} var sortable_opts = { "tolerance" : "pointer", "axis" : "x", "scrollSensitivity": "1", "items": '>th:not(:has(#jqgh_'+tid+'_cb'+',#jqgh_'+tid+'_rn'+',#jqgh_'+tid+'_subgrid),:hidden)', "placeholder": { element: function(item) { var el = $(document.createElement(item[0].nodeName)) .addClass(item[0].className+" ui-sortable-placeholder ui-state-highlight") .removeClass("ui-sortable-helper")[0]; return el; }, update: function(self, p) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); } }, "update": function(event, ui) { var p = $(ui.item).parent(), th = $(">th", p), colModel = ts.p.colModel, cmMap = {}, tid= ts.p.id+"_"; $.each(colModel, function(i) { cmMap[this.name]=i; }); var permutation = []; th.each(function() { var id = $(">div", this).get(0).id.replace(/^jqgh_/, "").replace(tid,""); if (id in cmMap) { permutation.push(cmMap[id]); } }); $(ts).jqGrid("remapColumns",permutation, true, true); if ($.isFunction(ts.p.sortable.update)) { ts.p.sortable.update(permutation); } setTimeout(function(){ts.p.disableClick=false;}, 50); } }; if (ts.p.sortable.options) { $.extend(sortable_opts, ts.p.sortable.options); } else if ($.isFunction(ts.p.sortable)) { ts.p.sortable = { "update" : ts.p.sortable }; } if (sortable_opts.start) { var s = sortable_opts.start; sortable_opts.start = function(e,ui) { start(); s.call(this,e,ui); }; } else { sortable_opts.start = start; } if (ts.p.sortable.exclude) { sortable_opts.items += ":not("+ts.p.sortable.exclude+")"; } tblrow.sortable(sortable_opts).data("sortable").floating = true; }); }, columnChooser : function(opts) { var self = this; if($("#colchooser_"+$.jgrid.jqID(self[0].p.id)).length ) { return; } var selector = $('<div id="colchooser_'+self[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'); var select = $('select', selector); function insert(perm,i,v) { if(i>=0){ var a = perm.slice(); var b = a.splice(i,Math.max(perm.length-i,i)); if(i>perm.length) { i = perm.length; } a[i] = v; return a.concat(b); } } opts = $.extend({ "width" : 420, "height" : 240, "classname" : null, "done" : function(perm) { if (perm) { self.jqGrid("remapColumns", perm, true); } }, /* msel is either the name of a ui widget class that extends a multiselect, or a function that supports creating a multiselect object (with no argument, or when passed an object), and destroying it (when passed the string "destroy"). */ "msel" : "multiselect", /* "msel_opts" : {}, */ /* dlog is either the name of a ui widget class that behaves in a dialog-like way, or a function, that supports creating a dialog (when passed dlog_opts) or destroying a dialog (when passed the string "destroy") */ "dlog" : "dialog", "dialog_opts" : { "minWidth": 470 }, /* dlog_opts is either an option object to be passed to "dlog", or (more likely) a function that creates the options object. The default produces a suitable options object for ui.dialog */ "dlog_opts" : function(opts) { var buttons = {}; buttons[opts.bSubmit] = function() { opts.apply_perm(); opts.cleanup(false); }; buttons[opts.bCancel] = function() { opts.cleanup(true); }; return $.extend(true, { "buttons": buttons, "close": function() { opts.cleanup(true); }, "modal" : opts.modal ? opts.modal : false, "resizable": opts.resizable ? opts.resizable : true, "width": opts.width+20 }, opts.dialog_opts || {}); }, /* Function to get the permutation array, and pass it to the "done" function */ "apply_perm" : function() { $('option',select).each(function() { if (this.selected) { self.jqGrid("showCol", colModel[this.value].name); } else { self.jqGrid("hideCol", colModel[this.value].name); } }); var perm = []; //fixedCols.slice(0); $('option:selected',select).each(function() { perm.push(parseInt(this.value,10)); }); $.each(perm, function() { delete colMap[colModel[parseInt(this,10)].name]; }); $.each(colMap, function() { var ti = parseInt(this,10); perm = insert(perm,ti,ti); }); if (opts.done) { opts.done.call(self, perm); } }, /* Function to cleanup the dialog, and select. Also calls the done function with no permutation (to indicate that the columnChooser was aborted */ "cleanup" : function(calldone) { call(opts.dlog, selector, 'destroy'); call(opts.msel, select, 'destroy'); selector.remove(); if (calldone && opts.done) { opts.done.call(self); } }, "msel_opts" : {} }, $.jgrid.col, opts || {}); if($.ui) { if ($.ui.multiselect ) { if(opts.msel == "multiselect") { if(!$.jgrid._multiselect) { // should be in language file alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!"); return; } opts.msel_opts = $.extend($.ui.multiselect.defaults,opts.msel_opts); } } } if (opts.caption) { selector.attr("title", opts.caption); } if (opts.classname) { selector.addClass(opts.classname); select.addClass(opts.classname); } if (opts.width) { $(">div",selector).css({"width": opts.width,"margin":"0 auto"}); select.css("width", opts.width); } if (opts.height) { $(">div",selector).css("height", opts.height); select.css("height", opts.height - 10); } var colModel = self.jqGrid("getGridParam", "colModel"); var colNames = self.jqGrid("getGridParam", "colNames"); var colMap = {}, fixedCols = []; select.empty(); $.each(colModel, function(i) { colMap[this.name] = i; if (this.hidedlg) { if (!this.hidden) { fixedCols.push(i); } return; } select.append("<option value='"+i+"' "+ (this.hidden?"":"selected='selected'")+">"+colNames[i]+"</option>"); }); function call(fn, obj) { if (!fn) { return; } if (typeof fn == 'string') { if ($.fn[fn]) { $.fn[fn].apply(obj, $.makeArray(arguments).slice(2)); } } else if ($.isFunction(fn)) { fn.apply(obj, $.makeArray(arguments).slice(2)); } } var dopts = $.isFunction(opts.dlog_opts) ? opts.dlog_opts.call(self, opts) : opts.dlog_opts; call(opts.dlog, selector, dopts); var mopts = $.isFunction(opts.msel_opts) ? opts.msel_opts.call(self, opts) : opts.msel_opts; call(opts.msel, select, mopts); }, sortableRows : function (opts) { // Can accept all sortable options and events return this.each(function(){ var $t = this; if(!$t.grid) { return; } // Currently we disable a treeGrid sortable if($t.p.treeGrid) { return; } if($.fn.sortable) { opts = $.extend({ "cursor":"move", "axis" : "y", "items": ".jqgrow" }, opts || {}); if(opts.start && $.isFunction(opts.start)) { opts._start_ = opts.start; delete opts.start; } else {opts._start_=false;} if(opts.update && $.isFunction(opts.update)) { opts._update_ = opts.update; delete opts.update; } else {opts._update_ = false;} opts.start = function(ev,ui) { $(ui.item).css("border-width","0px"); $("td",ui.item).each(function(i){ this.style.width = $t.grid.cols[i].style.width; }); if($t.p.subGrid) { var subgid = $(ui.item).attr("id"); try { $($t).jqGrid('collapseSubGridRow',subgid); } catch (e) {} } if(opts._start_) { opts._start_.apply(this,[ev,ui]); } }; opts.update = function (ev,ui) { $(ui.item).css("border-width",""); if($t.p.rownumbers === true) { $("td.jqgrid-rownum",$t.rows).each(function( i ){ $(this).html( i+1+(parseInt($t.p.page,10)-1)*parseInt($t.p.rowNum,10) ); }); } if(opts._update_) { opts._update_.apply(this,[ev,ui]); } }; $("tbody:first",$t).sortable(opts); $("tbody:first",$t).disableSelection(); } }); }, gridDnD : function(opts) { return this.each(function(){ var $t = this; if(!$t.grid) { return; } // Currently we disable a treeGrid drag and drop if($t.p.treeGrid) { return; } if(!$.fn.draggable || !$.fn.droppable) { return; } function updateDnD () { var datadnd = $.data($t,"dnd"); $("tr.jqgrow:not(.ui-draggable)",$t).draggable($.isFunction(datadnd.drag) ? datadnd.drag.call($($t),datadnd) : datadnd.drag); } var appender = "<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>"; if($("#jqgrid_dnd").html() === null) { $('body').append(appender); } if(typeof opts == 'string' && opts == 'updateDnD' && $t.p.jqgdnd===true) { updateDnD(); return; } opts = $.extend({ "drag" : function (opts) { return $.extend({ start : function (ev, ui) { // if we are in subgrid mode try to collapse the node if($t.p.subGrid) { var subgid = $(ui.helper).attr("id"); try { $($t).jqGrid('collapseSubGridRow',subgid); } catch (e) {} } // hack // drag and drop does not insert tr in table, when the table has no rows // we try to insert new empty row on the target(s) for (var i=0;i<$.data($t,"dnd").connectWith.length;i++){ if($($.data($t,"dnd").connectWith[i]).jqGrid('getGridParam','reccount') == "0" ){ $($.data($t,"dnd").connectWith[i]).jqGrid('addRowData','jqg_empty_row',{}); } } ui.helper.addClass("ui-state-highlight"); $("td",ui.helper).each(function(i) { this.style.width = $t.grid.headers[i].width+"px"; }); if(opts.onstart && $.isFunction(opts.onstart) ) { opts.onstart.call($($t),ev,ui); } }, stop :function(ev,ui) { if(ui.helper.dropped && !opts.dragcopy) { var ids = $(ui.helper).attr("id"); if(ids === undefined) { ids = $(this).attr("id"); } $($t).jqGrid('delRowData',ids ); } // if we have a empty row inserted from start event try to delete it for (var i=0;i<$.data($t,"dnd").connectWith.length;i++){ $($.data($t,"dnd").connectWith[i]).jqGrid('delRowData','jqg_empty_row'); } if(opts.onstop && $.isFunction(opts.onstop) ) { opts.onstop.call($($t),ev,ui); } } },opts.drag_opts || {}); }, "drop" : function (opts) { return $.extend({ accept: function(d) { if (!$(d).hasClass('jqgrow')) { return d;} var tid = $(d).closest("table.ui-jqgrid-btable"); if(tid.length > 0 && $.data(tid[0],"dnd") !== undefined) { var cn = $.data(tid[0],"dnd").connectWith; return $.inArray('#'+$.jgrid.jqID(this.id),cn) != -1 ? true : false; } return false; }, drop: function(ev, ui) { if (!$(ui.draggable).hasClass('jqgrow')) { return; } var accept = $(ui.draggable).attr("id"); var getdata = ui.draggable.parent().parent().jqGrid('getRowData',accept); if(!opts.dropbyname) { var j =0, tmpdata = {}, nm; var dropmodel = $("#"+$.jgrid.jqID(this.id)).jqGrid('getGridParam','colModel'); try { for (var key in getdata) { nm = dropmodel[j].name; if( !(nm == 'cb' || nm =='rn' || nm == 'subgrid' )) { if(getdata.hasOwnProperty(key) && dropmodel[j]) { tmpdata[nm] = getdata[key]; } } j++; } getdata = tmpdata; } catch (e) {} } ui.helper.dropped = true; if(opts.beforedrop && $.isFunction(opts.beforedrop) ) { //parameters to this callback - event, element, data to be inserted, sender, reciever // should return object which will be inserted into the reciever var datatoinsert = opts.beforedrop.call(this,ev,ui,getdata,$('#'+$.jgrid.jqID($t.p.id)),$(this)); if (typeof datatoinsert != "undefined" && datatoinsert !== null && typeof datatoinsert == "object") { getdata = datatoinsert; } } if(ui.helper.dropped) { var grid; if(opts.autoid) { if($.isFunction(opts.autoid)) { grid = opts.autoid.call(this,getdata); } else { grid = Math.ceil(Math.random()*1000); grid = opts.autoidprefix+grid; } } // NULL is interpreted as undefined while null as object $("#"+$.jgrid.jqID(this.id)).jqGrid('addRowData',grid,getdata,opts.droppos); } if(opts.ondrop && $.isFunction(opts.ondrop) ) { opts.ondrop.call(this,ev,ui, getdata); } }}, opts.drop_opts || {}); }, "onstart" : null, "onstop" : null, "beforedrop": null, "ondrop" : null, "drop_opts" : { "activeClass": "ui-state-active", "hoverClass": "ui-state-hover" }, "drag_opts" : { "revert": "invalid", "helper": "clone", "cursor": "move", "appendTo" : "#jqgrid_dnd", "zIndex": 5000 }, "dragcopy": false, "dropbyname" : false, "droppos" : "first", "autoid" : true, "autoidprefix" : "dnd_" }, opts || {}); if(!opts.connectWith) { return; } opts.connectWith = opts.connectWith.split(","); opts.connectWith = $.map(opts.connectWith,function(n){return $.trim(n);}); $.data($t,"dnd",opts); if($t.p.reccount != "0" && !$t.p.jqgdnd) { updateDnD(); } $t.p.jqgdnd = true; for (var i=0;i<opts.connectWith.length;i++){ var cn =opts.connectWith[i]; $(cn).droppable($.isFunction(opts.drop) ? opts.drop.call($($t),opts) : opts.drop); } }); }, gridResize : function(opts) { return this.each(function(){ var $t = this, gID = $.jgrid.jqID($t.p.id); if(!$t.grid || !$.fn.resizable) { return; } opts = $.extend({}, opts || {}); if(opts.alsoResize ) { opts._alsoResize_ = opts.alsoResize; delete opts.alsoResize; } else { opts._alsoResize_ = false; } if(opts.stop && $.isFunction(opts.stop)) { opts._stop_ = opts.stop; delete opts.stop; } else { opts._stop_ = false; } opts.stop = function (ev, ui) { $($t).jqGrid('setGridParam',{height:$("#gview_"+gID+" .ui-jqgrid-bdiv").height()}); $($t).jqGrid('setGridWidth',ui.size.width,opts.shrinkToFit); if(opts._stop_) { opts._stop_.call($t,ev,ui); } }; if(opts._alsoResize_) { var optstest = "{\'#gview_"+gID+" .ui-jqgrid-bdiv\':true,'" +opts._alsoResize_+"':true}"; opts.alsoResize = eval('('+optstest+')'); // the only way that I found to do this } else { opts.alsoResize = $(".ui-jqgrid-bdiv","#gview_"+gID); } delete opts._alsoResize_; $("#gbox_"+gID).resizable(opts); }); } }); })(jQuery); /* Transform a table to a jqGrid. Peter Romianowski <peter.romianowski@optivo.de> If the first column of the table contains checkboxes or radiobuttons then the jqGrid is made selectable. */ // Addition - selector can be a class or id function tableToGrid(selector, options) { jQuery(selector).each(function() { if(this.grid) {return;} //Adedd from Tony Tomov // This is a small "hack" to make the width of the jqGrid 100% jQuery(this).width("99%"); var w = jQuery(this).width(); // Text whether we have single or multi select var inputCheckbox = jQuery('tr td:first-child input[type=checkbox]:first', jQuery(this)); var inputRadio = jQuery('tr td:first-child input[type=radio]:first', jQuery(this)); var selectMultiple = inputCheckbox.length > 0; var selectSingle = !selectMultiple && inputRadio.length > 0; var selectable = selectMultiple || selectSingle; //var inputName = inputCheckbox.attr("name") || inputRadio.attr("name"); // Build up the columnModel and the data var colModel = []; var colNames = []; jQuery('th', jQuery(this)).each(function() { if (colModel.length === 0 && selectable) { colModel.push({ name: '__selection__', index: '__selection__', width: 0, hidden: true }); colNames.push('__selection__'); } else { colModel.push({ name: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'), index: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'), width: jQuery(this).width() || 150 }); colNames.push(jQuery(this).html()); } }); var data = []; var rowIds = []; var rowChecked = []; jQuery('tbody > tr', jQuery(this)).each(function() { var row = {}; var rowPos = 0; jQuery('td', jQuery(this)).each(function() { if (rowPos === 0 && selectable) { var input = jQuery('input', jQuery(this)); var rowId = input.attr("value"); rowIds.push(rowId || data.length); if (input.is(":checked")) { rowChecked.push(rowId); } row[colModel[rowPos].name] = input.attr("value"); } else { row[colModel[rowPos].name] = jQuery(this).html(); } rowPos++; }); if(rowPos >0) { data.push(row); } }); // Clear the original HTML table jQuery(this).empty(); // Mark it as jqGrid jQuery(this).addClass("scroll"); jQuery(this).jqGrid(jQuery.extend({ datatype: "local", width: w, colNames: colNames, colModel: colModel, multiselect: selectMultiple //inputName: inputName, //inputValueCol: imputName != null ? "__selection__" : null }, options || {})); // Add data var a; for (a = 0; a < data.length; a++) { var id = null; if (rowIds.length > 0) { id = rowIds[a]; if (id && id.replace) { // We have to do this since the value of a checkbox // or radio button can be anything id = encodeURIComponent(id).replace(/[.\-%]/g, "_"); } } if (id === null) { id = a + 1; } jQuery(this).jqGrid("addRowData",id, data[a]); } // Set the selection for (a = 0; a < rowChecked.length; a++) { jQuery(this).jqGrid("setSelection",rowChecked[a]); } }); };
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/src-grid/jquery.jqGrid.js
JavaScript
gpl2
432,260
/*! * jQuery Form Plugin * version: 2.87 (20-OCT-2011) * @requires jQuery v1.3.2 or later * * Examples and documentation at: http://malsup.com/jquery/form/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ ;(function($) { /* Usage Note: ----------- Do not use both ajaxSubmit and ajaxForm on the same form. These functions are intended to be exclusive. Use ajaxSubmit if you want to bind your own submit handler to the form. For example, $(document).ready(function() { $('#myForm').bind('submit', function(e) { e.preventDefault(); // <-- important $(this).ajaxSubmit({ target: '#output' }); }); }); Use ajaxForm when you want the plugin to manage all the event binding for you. For example, $(document).ready(function() { $('#myForm').ajaxForm({ target: '#output' }); }); When using ajaxForm, the ajaxSubmit function will be invoked for you at the appropriate time. */ /** * ajaxSubmit() provides a mechanism for immediately submitting * an HTML form using AJAX. */ $.fn.ajaxSubmit = function(options) { // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) if (!this.length) { log('ajaxSubmit: skipping submit process - no element selected'); return this; } var method, action, url, $form = this; if (typeof options == 'function') { options = { success: options }; } method = this.attr('method'); action = this.attr('action'); url = (typeof action === 'string') ? $.trim(action) : ''; url = url || window.location.href || ''; if (url) { // clean url (don't include hash vaue) url = (url.match(/^([^#]+)/)||[])[1]; } options = $.extend(true, { url: url, success: $.ajaxSettings.success, type: method || 'GET', iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' }, options); // hook for manipulating the form data before it is extracted; // convenient for use with rich editors like tinyMCE or FCKEditor var veto = {}; this.trigger('form-pre-serialize', [this, options, veto]); if (veto.veto) { log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); return this; } // provide opportunity to alter form data before it is serialized if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { log('ajaxSubmit: submit aborted via beforeSerialize callback'); return this; } var traditional = options.traditional; if ( traditional === undefined ) { traditional = $.ajaxSettings.traditional; } var qx,n,v,a = this.formToArray(options.semantic); if (options.data) { options.extraData = options.data; qx = $.param(options.data, traditional); } // give pre-submit callback an opportunity to abort the submit if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { log('ajaxSubmit: submit aborted via beforeSubmit callback'); return this; } // fire vetoable 'validate' event this.trigger('form-submit-validate', [a, this, options, veto]); if (veto.veto) { log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); return this; } var q = $.param(a, traditional); if (qx) q = ( q ? (q + '&' + qx) : qx ); if (options.type.toUpperCase() == 'GET') { options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; options.data = null; // data is null for 'get' } else { options.data = q; // data is the query string for 'post' } var callbacks = []; if (options.resetForm) { callbacks.push(function() { $form.resetForm(); }); } if (options.clearForm) { callbacks.push(function() { $form.clearForm(options.includeHidden); }); } // perform a load on the target only if dataType is not provided if (!options.dataType && options.target) { var oldSuccess = options.success || function(){}; callbacks.push(function(data) { var fn = options.replaceTarget ? 'replaceWith' : 'html'; $(options.target)[fn](data).each(oldSuccess, arguments); }); } else if (options.success) { callbacks.push(options.success); } options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg var context = options.context || options; // jQuery 1.4+ supports scope context for (var i=0, max=callbacks.length; i < max; i++) { callbacks[i].apply(context, [data, status, xhr || $form, $form]); } }; // are there files to upload? var fileInputs = $('input:file', this).length > 0; var mp = 'multipart/form-data'; var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); // options.iframe allows user to force iframe mode // 06-NOV-09: now defaulting to iframe mode if file input is detected if (options.iframe !== false && (fileInputs || options.iframe || multipart)) { // hack to fix Safari hang (thanks to Tim Molendijk for this) // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d if (options.closeKeepAlive) { $.get(options.closeKeepAlive, function() { fileUpload(a); }); } else { fileUpload(a); } } else { // IE7 massage (see issue 57) if ($.browser.msie && method == 'get' && typeof options.type === "undefined") { var ieMeth = $form[0].getAttribute('method'); if (typeof ieMeth === 'string') options.type = ieMeth; } $.ajax(options); } // fire 'notify' event this.trigger('form-submit-notify', [this, options]); return this; // private function for handling file uploads (hat tip to YAHOO!) function fileUpload(a) { var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; var useProp = !!$.fn.prop; if (a) { if ( useProp ) { // ensure that every serialized input is still enabled for (i=0; i < a.length; i++) { el = $(form[a[i].name]); el.prop('disabled', false); } } else { for (i=0; i < a.length; i++) { el = $(form[a[i].name]); el.removeAttr('disabled'); } }; } if ($(':input[name=submit],:input[id=submit]', form).length) { // if there is an input with a name or id of 'submit' then we won't be // able to invoke the submit fn on the form (at least not x-browser) alert('Error: Form elements must not have name or id of "submit".'); return; } s = $.extend(true, {}, $.ajaxSettings, options); s.context = s.context || s; id = 'jqFormIO' + (new Date().getTime()); if (s.iframeTarget) { $io = $(s.iframeTarget); n = $io.attr('name'); if (n == null) $io.attr('name', id); else id = n; } else { $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />'); $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' }); } io = $io[0]; xhr = { // mock object aborted: 0, responseText: null, responseXML: null, status: 0, statusText: 'n/a', getAllResponseHeaders: function() {}, getResponseHeader: function() {}, setRequestHeader: function() {}, abort: function(status) { var e = (status === 'timeout' ? 'timeout' : 'aborted'); log('aborting upload... ' + e); this.aborted = 1; $io.attr('src', s.iframeSrc); // abort op in progress xhr.error = e; s.error && s.error.call(s.context, xhr, e, status); g && $.event.trigger("ajaxError", [xhr, s, e]); s.complete && s.complete.call(s.context, xhr, e); } }; g = s.global; // trigger ajax global events so that activity/block indicators work like normal if (g && ! $.active++) { $.event.trigger("ajaxStart"); } if (g) { $.event.trigger("ajaxSend", [xhr, s]); } if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) { if (s.global) { $.active--; } return; } if (xhr.aborted) { return; } // add submitting element to data if we know it sub = form.clk; if (sub) { n = sub.name; if (n && !sub.disabled) { s.extraData = s.extraData || {}; s.extraData[n] = sub.value; if (sub.type == "image") { s.extraData[n+'.x'] = form.clk_x; s.extraData[n+'.y'] = form.clk_y; } } } var CLIENT_TIMEOUT_ABORT = 1; var SERVER_ABORT = 2; function getDoc(frame) { var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document; return doc; } // take a breath so that pending repaints get some cpu time before the upload starts function doSubmit() { // make sure form attrs are set var t = $form.attr('target'), a = $form.attr('action'); // update form attrs in IE friendly way form.setAttribute('target',id); if (!method) { form.setAttribute('method', 'POST'); } if (a != s.url) { form.setAttribute('action', s.url); } // ie borks in some cases when setting encoding if (! s.skipEncodingOverride && (!method || /post/i.test(method))) { $form.attr({ encoding: 'multipart/form-data', enctype: 'multipart/form-data' }); } // support timout if (s.timeout) { timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout); } // look for server aborts function checkState() { try { var state = getDoc(io).readyState; log('state = ' + state); if (state.toLowerCase() == 'uninitialized') setTimeout(checkState,50); } catch(e) { log('Server abort: ' , e, ' (', e.name, ')'); cb(SERVER_ABORT); timeoutHandle && clearTimeout(timeoutHandle); timeoutHandle = undefined; } } // add "extra" data to form if provided in options var extraInputs = []; try { if (s.extraData) { for (var n in s.extraData) { extraInputs.push( $('<input type="hidden" name="'+n+'" />').attr('value',s.extraData[n]) .appendTo(form)[0]); } } if (!s.iframeTarget) { // add iframe to doc and submit the form $io.appendTo('body'); io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false); } setTimeout(checkState,15); form.submit(); } finally { // reset attrs and remove "extra" input elements form.setAttribute('action',a); if(t) { form.setAttribute('target', t); } else { $form.removeAttr('target'); } $(extraInputs).remove(); } } if (s.forceSync) { doSubmit(); } else { setTimeout(doSubmit, 10); // this lets dom updates render } var data, doc, domCheckCount = 50, callbackProcessed; function cb(e) { if (xhr.aborted || callbackProcessed) { return; } try { doc = getDoc(io); } catch(ex) { log('cannot access response document: ', ex); e = SERVER_ABORT; } if (e === CLIENT_TIMEOUT_ABORT && xhr) { xhr.abort('timeout'); return; } else if (e == SERVER_ABORT && xhr) { xhr.abort('server abort'); return; } if (!doc || doc.location.href == s.iframeSrc) { // response not received yet if (!timedOut) return; } io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false); var status = 'success', errMsg; try { if (timedOut) { throw 'timeout'; } var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc); log('isXml='+isXml); if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) { if (--domCheckCount) { // in some browsers (Opera) the iframe DOM is not always traversable when // the onload callback fires, so we loop a bit to accommodate log('requeing onLoad callback, DOM not available'); setTimeout(cb, 250); return; } // let this fall through because server response could be an empty document //log('Could not access iframe DOM after mutiple tries.'); //throw 'DOMException: not available'; } //log('response detected'); var docRoot = doc.body ? doc.body : doc.documentElement; xhr.responseText = docRoot ? docRoot.innerHTML : null; xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; if (isXml) s.dataType = 'xml'; xhr.getResponseHeader = function(header){ var headers = {'content-type': s.dataType}; return headers[header]; }; // support for XHR 'status' & 'statusText' emulation : if (docRoot) { xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status; xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText; } var dt = (s.dataType || '').toLowerCase(); var scr = /(json|script|text)/.test(dt); if (scr || s.textarea) { // see if user embedded response in textarea var ta = doc.getElementsByTagName('textarea')[0]; if (ta) { xhr.responseText = ta.value; // support for XHR 'status' & 'statusText' emulation : xhr.status = Number( ta.getAttribute('status') ) || xhr.status; xhr.statusText = ta.getAttribute('statusText') || xhr.statusText; } else if (scr) { // account for browsers injecting pre around json response var pre = doc.getElementsByTagName('pre')[0]; var b = doc.getElementsByTagName('body')[0]; if (pre) { xhr.responseText = pre.textContent ? pre.textContent : pre.innerText; } else if (b) { xhr.responseText = b.textContent ? b.textContent : b.innerText; } } } else if (dt == 'xml' && !xhr.responseXML && xhr.responseText != null) { xhr.responseXML = toXml(xhr.responseText); } try { data = httpData(xhr, dt, s); } catch (e) { status = 'parsererror'; xhr.error = errMsg = (e || status); } } catch (e) { log('error caught: ',e); status = 'error'; xhr.error = errMsg = (e || status); } if (xhr.aborted) { log('upload aborted'); status = null; } if (xhr.status) { // we've set xhr.status status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error'; } // ordering of these callbacks/triggers is odd, but that's how $.ajax does it if (status === 'success') { s.success && s.success.call(s.context, data, 'success', xhr); g && $.event.trigger("ajaxSuccess", [xhr, s]); } else if (status) { if (errMsg == undefined) errMsg = xhr.statusText; s.error && s.error.call(s.context, xhr, status, errMsg); g && $.event.trigger("ajaxError", [xhr, s, errMsg]); } g && $.event.trigger("ajaxComplete", [xhr, s]); if (g && ! --$.active) { $.event.trigger("ajaxStop"); } s.complete && s.complete.call(s.context, xhr, status); callbackProcessed = true; if (s.timeout) clearTimeout(timeoutHandle); // clean up setTimeout(function() { if (!s.iframeTarget) $io.remove(); xhr.responseXML = null; }, 100); } var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+) if (window.ActiveXObject) { doc = new ActiveXObject('Microsoft.XMLDOM'); doc.async = 'false'; doc.loadXML(s); } else { doc = (new DOMParser()).parseFromString(s, 'text/xml'); } return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null; }; var parseJSON = $.parseJSON || function(s) { return window['eval']('(' + s + ')'); }; var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4 var ct = xhr.getResponseHeader('content-type') || '', xml = type === 'xml' || !type && ct.indexOf('xml') >= 0, data = xml ? xhr.responseXML : xhr.responseText; if (xml && data.documentElement.nodeName === 'parsererror') { $.error && $.error('parsererror'); } if (s && s.dataFilter) { data = s.dataFilter(data, type); } if (typeof data === 'string') { if (type === 'json' || !type && ct.indexOf('json') >= 0) { data = parseJSON(data); } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) { $.globalEval(data); } } return data; }; } }; /** * ajaxForm() provides a mechanism for fully automating form submission. * * The advantages of using this method instead of ajaxSubmit() are: * * 1: This method will include coordinates for <input type="image" /> elements (if the element * is used to submit the form). * 2. This method will include the submit element's name/value data (for the element that was * used to submit the form). * 3. This method binds the submit() method to the form for you. * * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely * passes the options argument along after properly binding events for submit elements and * the form itself. */ $.fn.ajaxForm = function(options) { // in jQuery 1.3+ we can fix mistakes with the ready state if (this.length === 0) { var o = { s: this.selector, c: this.context }; if (!$.isReady && o.s) { log('DOM not ready, queuing ajaxForm'); $(function() { $(o.s,o.c).ajaxForm(options); }); return this; } // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); return this; } return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) { if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed e.preventDefault(); $(this).ajaxSubmit(options); } }).bind('click.form-plugin', function(e) { var target = e.target; var $el = $(target); if (!($el.is(":submit,input:image"))) { // is this a child element of the submit el? (ex: a span within a button) var t = $el.closest(':submit'); if (t.length == 0) { return; } target = t[0]; } var form = this; form.clk = target; if (target.type == 'image') { if (e.offsetX != undefined) { form.clk_x = e.offsetX; form.clk_y = e.offsetY; } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin var offset = $el.offset(); form.clk_x = e.pageX - offset.left; form.clk_y = e.pageY - offset.top; } else { form.clk_x = e.pageX - target.offsetLeft; form.clk_y = e.pageY - target.offsetTop; } } // clear form vars setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100); }); }; // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm $.fn.ajaxFormUnbind = function() { return this.unbind('submit.form-plugin click.form-plugin'); }; /** * formToArray() gathers form element data into an array of objects that can * be passed to any of the following ajax functions: $.get, $.post, or load. * Each object in the array has both a 'name' and 'value' property. An example of * an array for a simple login form might be: * * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] * * It is this array that is passed to pre-submit callback functions provided to the * ajaxSubmit() and ajaxForm() methods. */ $.fn.formToArray = function(semantic) { var a = []; if (this.length === 0) { return a; } var form = this[0]; var els = semantic ? form.getElementsByTagName('*') : form.elements; if (!els) { return a; } var i,j,n,v,el,max,jmax; for(i=0, max=els.length; i < max; i++) { el = els[i]; n = el.name; if (!n) { continue; } if (semantic && form.clk && el.type == "image") { // handle image inputs on the fly when semantic == true if(!el.disabled && form.clk == el) { a.push({name: n, value: $(el).val()}); a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); } continue; } v = $.fieldValue(el, true); if (v && v.constructor == Array) { for(j=0, jmax=v.length; j < jmax; j++) { a.push({name: n, value: v[j]}); } } else if (v !== null && typeof v != 'undefined') { a.push({name: n, value: v}); } } if (!semantic && form.clk) { // input type=='image' are not found in elements array! handle it here var $input = $(form.clk), input = $input[0]; n = input.name; if (n && !input.disabled && input.type == 'image') { a.push({name: n, value: $input.val()}); a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); } } return a; }; /** * Serializes form data into a 'submittable' string. This method will return a string * in the format: name1=value1&amp;name2=value2 */ $.fn.formSerialize = function(semantic) { //hand off to jQuery.param for proper encoding return $.param(this.formToArray(semantic)); }; /** * Serializes all field elements in the jQuery object into a query string. * This method will return a string in the format: name1=value1&amp;name2=value2 */ $.fn.fieldSerialize = function(successful) { var a = []; this.each(function() { var n = this.name; if (!n) { return; } var v = $.fieldValue(this, successful); if (v && v.constructor == Array) { for (var i=0,max=v.length; i < max; i++) { a.push({name: n, value: v[i]}); } } else if (v !== null && typeof v != 'undefined') { a.push({name: this.name, value: v}); } }); //hand off to jQuery.param for proper encoding return $.param(a); }; /** * Returns the value(s) of the element in the matched set. For example, consider the following form: * * <form><fieldset> * <input name="A" type="text" /> * <input name="A" type="text" /> * <input name="B" type="checkbox" value="B1" /> * <input name="B" type="checkbox" value="B2"/> * <input name="C" type="radio" value="C1" /> * <input name="C" type="radio" value="C2" /> * </fieldset></form> * * var v = $(':text').fieldValue(); * // if no values are entered into the text inputs * v == ['',''] * // if values entered into the text inputs are 'foo' and 'bar' * v == ['foo','bar'] * * var v = $(':checkbox').fieldValue(); * // if neither checkbox is checked * v === undefined * // if both checkboxes are checked * v == ['B1', 'B2'] * * var v = $(':radio').fieldValue(); * // if neither radio is checked * v === undefined * // if first radio is checked * v == ['C1'] * * The successful argument controls whether or not the field element must be 'successful' * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). * The default value of the successful argument is true. If this value is false the value(s) * for each element is returned. * * Note: This method *always* returns an array. If no valid value can be determined the * array will be empty, otherwise it will contain one or more values. */ $.fn.fieldValue = function(successful) { for (var val=[], i=0, max=this.length; i < max; i++) { var el = this[i]; var v = $.fieldValue(el, successful); if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) { continue; } v.constructor == Array ? $.merge(val, v) : val.push(v); } return val; }; /** * Returns the value of the field element. */ $.fieldValue = function(el, successful) { var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); if (successful === undefined) { successful = true; } if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || (t == 'checkbox' || t == 'radio') && !el.checked || (t == 'submit' || t == 'image') && el.form && el.form.clk != el || tag == 'select' && el.selectedIndex == -1)) { return null; } if (tag == 'select') { var index = el.selectedIndex; if (index < 0) { return null; } var a = [], ops = el.options; var one = (t == 'select-one'); var max = (one ? index+1 : ops.length); for(var i=(one ? index : 0); i < max; i++) { var op = ops[i]; if (op.selected) { var v = op.value; if (!v) { // extra pain for IE... v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value; } if (one) { return v; } a.push(v); } } return a; } return $(el).val(); }; /** * Clears the form data. Takes the following actions on the form's input fields: * - input text fields will have their 'value' property set to the empty string * - select elements will have their 'selectedIndex' property set to -1 * - checkbox and radio inputs will have their 'checked' property set to false * - inputs of type submit, button, reset, and hidden will *not* be effected * - button elements will *not* be effected */ $.fn.clearForm = function(includeHidden) { return this.each(function() { $('input,select,textarea', this).clearFields(includeHidden); }); }; /** * Clears the selected form elements. */ $.fn.clearFields = $.fn.clearInputs = function(includeHidden) { var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list return this.each(function() { var t = this.type, tag = this.tagName.toLowerCase(); if (re.test(t) || tag == 'textarea' || (includeHidden && /hidden/.test(t)) ) { this.value = ''; } else if (t == 'checkbox' || t == 'radio') { this.checked = false; } else if (tag == 'select') { this.selectedIndex = -1; } }); }; /** * Resets the form data. Causes all form elements to be reset to their original value. */ $.fn.resetForm = function() { return this.each(function() { // guard against an input with the name of 'reset' // note that IE reports the reset function as an 'object' if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) { this.reset(); } }); }; /** * Enables or disables any matching elements. */ $.fn.enable = function(b) { if (b === undefined) { b = true; } return this.each(function() { this.disabled = !b; }); }; /** * Checks/unchecks any matching checkboxes or radio buttons and * selects/deselects and matching option elements. */ $.fn.selected = function(select) { if (select === undefined) { select = true; } return this.each(function() { var t = this.type; if (t == 'checkbox' || t == 'radio') { this.checked = select; } else if (this.tagName.toLowerCase() == 'option') { var $sel = $(this).parent('select'); if (select && $sel[0] && $sel[0].type == 'select-one') { // deselect all other options $sel.find('option').selected(false); } this.selected = select; } }); }; // expose debug var $.fn.ajaxSubmit.debug = false; // helper fn for console logging function log() { if (!$.fn.ajaxSubmit.debug) return; var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,''); if (window.console && window.console.log) { window.console.log(msg); } else if (window.opera && window.opera.postError) { window.opera.postError(msg); } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/jquery.form.js
JavaScript
gpl2
27,151
;(function($){ /** * jqGrid Japanese Translation * OKADA Yoshitada okada.dev@sth.jp * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "{2} \u4EF6\u4E2D {0} - {1} \u3092\u8868\u793A ", emptyrecords: "\u8868\u793A\u3059\u308B\u30EC\u30B3\u30FC\u30C9\u304C\u3042\u308A\u307E\u305B\u3093", loadtext: "\u8aad\u307f\u8fbc\u307f\u4e2d...", pgtext : "{1} \u30DA\u30FC\u30B8\u4E2D {0} \u30DA\u30FC\u30B8\u76EE " }, search : { caption: "\u691c\u7d22...", Find: "\u691c\u7d22", Reset: "\u30ea\u30bb\u30c3\u30c8", odata: ["\u6B21\u306B\u7B49\u3057\u3044", "\u6B21\u306B\u7B49\u3057\u304F\u306A\u3044", "\u6B21\u3088\u308A\u5C0F\u3055\u3044", "\u6B21\u306B\u7B49\u3057\u3044\u304B\u5C0F\u3055\u3044", "\u6B21\u3088\u308A\u5927\u304D\u3044", "\u6B21\u306B\u7B49\u3057\u3044\u304B\u5927\u304D\u3044", "\u6B21\u3067\u59CB\u307E\u308B", "\u6B21\u3067\u59CB\u307E\u3089\u306A\u3044", "\u6B21\u306B\u542B\u307E\u308C\u308B", "\u6B21\u306B\u542B\u307E\u308C\u306A\u3044", "\u6B21\u3067\u7D42\u308F\u308B", "\u6B21\u3067\u7D42\u308F\u3089\u306A\u3044", "\u6B21\u3092\u542B\u3080", "\u6B21\u3092\u542B\u307E\u306A\u3044"], groupOps: [{ op: "AND", text: "\u3059\u3079\u3066\u306E" }, { op: "OR", text: "\u3044\u305A\u308C\u304B\u306E" }], matchText: " \u6B21\u306E", rulesText: " \u6761\u4EF6\u3092\u6E80\u305F\u3059" }, edit : { addCaption: "\u30ec\u30b3\u30fc\u30c9\u8ffd\u52a0", editCaption: "\u30ec\u30b3\u30fc\u30c9\u7de8\u96c6", bSubmit: "\u9001\u4fe1", bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb", bClose: "\u9589\u3058\u308b", saveData: "\u30C7\u30FC\u30BF\u304C\u5909\u66F4\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u4FDD\u5B58\u3057\u307E\u3059\u304B\uFF1F", bYes: "\u306F\u3044", bNo: "\u3044\u3044\u3048", bExit: "\u30AD\u30E3\u30F3\u30BB\u30EB", msg: { required:"\u3053\u306e\u9805\u76ee\u306f\u5fc5\u9808\u3067\u3059\u3002", number:"\u6b63\u3057\u3044\u6570\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002", minValue:"\u6b21\u306e\u5024\u4ee5\u4e0a\u3067\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002", maxValue:"\u6b21\u306e\u5024\u4ee5\u4e0b\u3067\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002", email: "e-mail\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002", integer: "\u6b63\u3057\u3044\u6574\u6570\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002", date: "\u6b63\u3057\u3044\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002", url: "\u306F\u6709\u52B9\u306AURL\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\20\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u304C\u5FC5\u8981\u3067\u3059\u3002 ('http://' \u307E\u305F\u306F 'https://')", nodefined: " \u304C\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093", novalue: " \u623B\u308A\u5024\u304C\u5FC5\u8981\u3067\u3059", customarray: "\u30AB\u30B9\u30BF\u30E0\u95A2\u6570\u306F\u914D\u5217\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059", customfcheck: "\u30AB\u30B9\u30BF\u30E0\u691C\u8A3C\u306B\u306F\u30AB\u30B9\u30BF\u30E0\u95A2\u6570\u304C\u5FC5\u8981\u3067\u3059" } }, view : { caption: "\u30EC\u30B3\u30FC\u30C9\u3092\u8868\u793A", bClose: "\u9589\u3058\u308B" }, del : { caption: "\u524a\u9664", msg: "\u9078\u629e\u3057\u305f\u30ec\u30b3\u30fc\u30c9\u3092\u524a\u9664\u3057\u307e\u3059\u304b\uff1f", bSubmit: "\u524a\u9664", bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb" }, nav : { edittext: " ", edittitle: "\u9078\u629e\u3057\u305f\u884c\u3092\u7de8\u96c6", addtext:" ", addtitle: "\u884c\u3092\u65b0\u898f\u8ffd\u52a0", deltext: " ", deltitle: "\u9078\u629e\u3057\u305f\u884c\u3092\u524a\u9664", searchtext: " ", searchtitle: "\u30ec\u30b3\u30fc\u30c9\u691c\u7d22", refreshtext: "", refreshtitle: "\u30b0\u30ea\u30c3\u30c9\u3092\u30ea\u30ed\u30fc\u30c9", alertcap: "\u8b66\u544a", alerttext: "\u884c\u3092\u9078\u629e\u3057\u3066\u4e0b\u3055\u3044\u3002", viewtext: "", viewtitle: "\u9078\u629E\u3057\u305F\u884C\u3092\u8868\u793A" }, col : { caption: "\u5217\u3092\u8868\u793a\uff0f\u96a0\u3059", bSubmit: "\u9001\u4fe1", bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb" }, errors : { errcap : "\u30a8\u30e9\u30fc", nourl : "URL\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002", norecords: "\u51e6\u7406\u5bfe\u8c61\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u3042\u308a\u307e\u305b\u3093\u3002", model : "colNames\u306e\u9577\u3055\u304ccolModel\u3068\u4e00\u81f4\u3057\u307e\u305b\u3093\u3002" }, formatter : { integer: { thousandsSeparator: ",", defaultValue: '0' }, number: { decimalSeparator: ".", thousandsSeparator: ",", decimalPlaces: 2, defaultValue: '0.00' }, currency: { decimalSeparator: ".", thousandsSeparator: ",", decimalPlaces: 0, prefix: "", suffix: "", defaultValue: '0' }, date : { dayNames: [ "\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f", "\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f" ], monthNames: [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708" ], AmPm : ["am","pm","AM","PM"], S: "\u756a\u76ee", srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-ja.js
JavaScript
gpl2
6,853
;(function($){ /** * jqGrid German Translation * Version 1.0.0 (developed for jQuery Grid 3.3.1) * Olaf Klöppel opensource@blue-hit.de * http://blue-hit.de/ * * Updated for jqGrid 3.8 * Andreas Flack * http://www.contentcontrol-berlin.de * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Zeige {0} - {1} von {2}", emptyrecords: "Keine Datensätze vorhanden", loadtext: "Lädt...", pgtext : "Seite {0} von {1}" }, search : { caption: "Suche...", Find: "Suchen", Reset: "Zurücksetzen", odata : ['gleich', 'ungleich', 'kleiner', 'kleiner gleich','größer','größer gleich', 'beginnt mit','beginnt nicht mit','ist in','ist nicht in','endet mit','endet nicht mit','enthält','enthält nicht'], groupOps: [ { op: "AND", text: "alle" }, { op: "OR", text: "mindestens eine" } ], matchText: " erfülle", rulesText: " Bedingung(en)" }, edit : { addCaption: "Datensatz hinzufügen", editCaption: "Datensatz bearbeiten", bSubmit: "Speichern", bCancel: "Abbrechen", bClose: "Schließen", saveData: "Daten wurden geändert! Änderungen speichern?", bYes : "ja", bNo : "nein", bExit : "abbrechen", msg: { required:"Feld ist erforderlich", number: "Bitte geben Sie eine Zahl ein", minValue:"Wert muss größer oder gleich sein, als ", maxValue:"Wert muss kleiner oder gleich sein, als ", email: "ist keine gültige E-Mail-Adresse", integer: "Bitte geben Sie eine Ganzzahl ein", date: "Bitte geben Sie ein gültiges Datum ein", url: "ist keine gültige URL. Präfix muss eingegeben werden ('http://' oder 'https://')", nodefined : " ist nicht definiert!", novalue : " Rückgabewert ist erforderlich!", customarray : "Benutzerdefinierte Funktion sollte ein Array zurückgeben!", customfcheck : "Benutzerdefinierte Funktion sollte im Falle der benutzerdefinierten Überprüfung vorhanden sein!" } }, view : { caption: "Datensatz anzeigen", bClose: "Schließen" }, del : { caption: "Löschen", msg: "Ausgewählte Datensätze löschen?", bSubmit: "Löschen", bCancel: "Abbrechen" }, nav : { edittext: " ", edittitle: "Ausgewählte Zeile editieren", addtext:" ", addtitle: "Neue Zeile einfügen", deltext: " ", deltitle: "Ausgewählte Zeile löschen", searchtext: " ", searchtitle: "Datensatz suchen", refreshtext: "", refreshtitle: "Tabelle neu laden", alertcap: "Warnung", alerttext: "Bitte Zeile auswählen", viewtext: "", viewtitle: "Ausgewählte Zeile anzeigen" }, col : { caption: "Spalten auswählen", bSubmit: "Speichern", bCancel: "Abbrechen" }, errors : { errcap : "Fehler", nourl : "Keine URL angegeben", norecords: "Keine Datensätze zu bearbeiten", model : "colNames und colModel sind unterschiedlich lang!" }, formatter : { integer : {thousandsSeparator: ".", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:" €", defaultValue: '0,00'}, date : { dayNames: [ "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez", "Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return 'ter'}, srcformat: 'Y-m-d', newformat: 'd.m.Y', masks : { ISO8601Long: "Y-m-d H:i:s", ISO8601Short: "Y-m-d", ShortDate: "j.n.Y", LongDate: "l, j. F Y", FullDateTime: "l, d. F Y G:i:s", MonthDay: "d. F", ShortTime: "G:i", LongTime: "G:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-de.js
JavaScript
gpl2
4,480
;(function ($) { /** * jqGrid Persian Translation * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults: { recordtext: "نمابش {0} - {1} از {2}", emptyrecords: "رکوردی یافت نشد", loadtext: "بارگزاري...", pgtext: "صفحه {0} از {1}" }, search: { caption: "جستجو...", Find: "يافته ها", Reset: "از نو", odata: ['برابر', 'نا برابر', 'به', 'کوچکتر', 'از', 'بزرگتر', 'شروع با', 'شروع نشود با', 'نباشد', 'عضو این نباشد', 'اتمام با', 'تمام نشود با', 'حاوی', 'نباشد حاوی'], groupOps: [{ op: "AND", text: "کل" }, { op: "OR", text: "مجموع" }], matchText: " حاوی", rulesText: " اطلاعات" }, edit: { addCaption: "اضافه کردن رکورد", editCaption: "ويرايش رکورد", bSubmit: "ثبت", bCancel: "انصراف", bClose: "بستن", saveData: "دیتا تعییر کرد! ذخیره شود؟", bYes: "بله", bNo: "خیر", bExit: "انصراف", msg: { required: "فيلدها بايد ختما پر شوند", number: "لطفا عدد وعتبر وارد کنيد", minValue: "مقدار وارد شده بايد بزرگتر يا مساوي با", maxValue: "مقدار وارد شده بايد کوچکتر يا مساوي", email: "پست الکترونيک وارد شده معتبر نيست", integer: "لطفا يک عدد صحيح وارد کنيد", date: "لطفا يک تاريخ معتبر وارد کنيد", url: "این آدرس صحیح نمی باشد. پیشوند نیاز است ('http://' یا 'https://')", nodefined: " تعریف نشده!", novalue: " مقدار برگشتی اجباری است!", customarray: "تابع شما باید مقدار آرایه داشته باشد!", customfcheck: "برای داشتن متد دلخواه شما باید سطون با چکینگ دلخواه داشته باشید!" } }, view: { caption: "نمایش رکورد", bClose: "بستن" }, del: { caption: "حذف", msg: "از حذف گزينه هاي انتخاب شده مطمئن هستيد؟", bSubmit: "حذف", bCancel: "ابطال" }, nav: { edittext: " ", edittitle: "ويرايش رديف هاي انتخاب شده", addtext: " ", addtitle: "افزودن رديف جديد", deltext: " ", deltitle: "حذف ردبف هاي انتخاب شده", searchtext: " ", searchtitle: "جستجوي رديف", refreshtext: "", refreshtitle: "بازيابي مجدد صفحه", alertcap: "اخطار", alerttext: "لطفا يک رديف انتخاب کنيد", viewtext: "", viewtitle: "نمایش رکورد های انتخاب شده" }, col: { caption: "نمايش/عدم نمايش ستون", bSubmit: "ثبت", bCancel: "انصراف" }, errors: { errcap: "خطا", nourl: "هيچ آدرسي تنظيم نشده است", norecords: "هيچ رکوردي براي پردازش موجود نيست", model: "طول نام ستون ها محالف ستون هاي مدل مي باشد!" }, formatter: { integer: { thousandsSeparator: " ", defaultValue: "0" }, number: { decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: "0.00" }, currency: { decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix: "", defaultValue: "0" }, date: { dayNames: ["يک", "دو", "سه", "چهار", "پنج", "جمع", "شنب", "يکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"], monthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "ژانويه", "فوريه", "مارس", "آوريل", "مه", "ژوئن", "ژوئيه", "اوت", "سپتامبر", "اکتبر", "نوامبر", "December"], AmPm: ["ب.ظ", "ب.ظ", "ق.ظ", "ق.ظ"], S: function (b) { return b < 11 || b > 13 ? ["st", "nd", "rd", "th"][Math.min((b - 1) % 10, 3)] : "th" }, srcformat: "Y-m-d", newformat: "d/m/Y", masks: { ISO8601Long: "Y-m-d H:i:s", ISO8601Short: "Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit: false }, baseLinkUrl: "", showAction: "نمايش", target: "", checkbox: { disabled: true }, idName: "id" } } })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-fa.js
JavaScript
gpl2
6,408
;(function($){ /** * jqGrid Greek (el) Translation * Alex Cicovic * http://www.alexcicovic.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "View {0} - {1} of {2}", emptyrecords: "No records to view", loadtext: "Φόρτωση...", pgtext : "Page {0} of {1}" }, search : { caption: "Αναζήτηση...", Find: "Εύρεση", Reset: "Επαναφορά", odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'], groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ], matchText: " match", rulesText: " rules" }, edit : { addCaption: "Εισαγωγή Εγγραφής", editCaption: "Επεξεργασία Εγγραφής", bSubmit: "Καταχώρηση", bCancel: "Άκυρο", bClose: "Κλείσιμο", saveData: "Data has been changed! Save changes?", bYes : "Yes", bNo : "No", bExit : "Cancel", msg: { required:"Το πεδίο είναι απαραίτητο", number:"Το πεδίο δέχεται μόνο αριθμούς", minValue:"Η τιμή πρέπει να είναι μεγαλύτερη ή ίση του ", maxValue:"Η τιμή πρέπει να είναι μικρότερη ή ίση του ", email: "Η διεύθυνση e-mail δεν είναι έγκυρη", integer: "Το πεδίο δέχεται μόνο ακέραιους αριθμούς", url: "is not a valid URL. Prefix required ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "View Record", bClose: "Close" }, del : { caption: "Διαγραφή", msg: "Διαγραφή των επιλεγμένων εγγραφών;", bSubmit: "Ναι", bCancel: "Άκυρο" }, nav : { edittext: " ", edittitle: "Επεξεργασία επιλεγμένης εγγραφής", addtext:" ", addtitle: "Εισαγωγή νέας εγγραφής", deltext: " ", deltitle: "Διαγραφή επιλεγμένης εγγραφής", searchtext: " ", searchtitle: "Εύρεση Εγγραφών", refreshtext: "", refreshtitle: "Ανανέωση Πίνακα", alertcap: "Προσοχή", alerttext: "Δεν έχετε επιλέξει εγγραφή", viewtext: "", viewtitle: "View selected row" }, col : { caption: "Εμφάνιση / Απόκρυψη Στηλών", bSubmit: "ΟΚ", bCancel: "Άκυρο" }, errors : { errcap : "Σφάλμα", nourl : "Δεν έχει δοθεί διεύθυνση χειρισμού για τη συγκεκριμένη ενέργεια", norecords: "Δεν υπάρχουν εγγραφές προς επεξεργασία", model : "Άνισος αριθμός πεδίων colNames/colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ", "Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο" ], monthNames: [ "Ιαν", "Φεβ", "Μαρ", "Απρ", "Μαι", "Ιουν", "Ιουλ", "Αυγ", "Σεπ", "Οκτ", "Νοε", "Δεκ", "Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος" ], AmPm : ["πμ","μμ","ΠΜ","ΜΜ"], S: function (j) {return j == 1 || j > 1 ? ['η'][Math.min((j - 1) % 10, 3)] : ''}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-el.js
JavaScript
gpl2
5,151
;(function($){ /** * jqGrid Icelandic Translation * jtm@hi.is Univercity of Iceland * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Skoða {0} - {1} af {2}", emptyrecords: "Engar færslur", loadtext: "Hleður...", pgtext : "Síða {0} af {1}" }, search : { caption: "Leita...", Find: "Leita", Reset: "Endursetja", odata : ['sama og', 'ekki sama og', 'minna en', 'minna eða jafnt og','stærra en','stærra eða jafnt og', 'byrjar á','byrjar ekki á','er í','er ekki í','endar á','endar ekki á','inniheldur','inniheldur ekki'], groupOps: [ { op: "AND", text: "allt" }, { op: "OR", text: "eða" } ], matchText: " passar", rulesText: " reglur" }, edit : { addCaption: "Bæta við færslu", editCaption: "Breyta færslu", bSubmit: "Vista", bCancel: "Hætta við", bClose: "Loka", saveData: "Gögn hafa breyst! Vista breytingar?", bYes : "Já", bNo : "Nei", bExit : "Hætta við", msg: { required:"Reitur er nauðsynlegur", number:"Vinsamlega settu inn tölu", minValue:"gildi verður að vera meira en eða jafnt og ", maxValue:"gildi verður að vera minna en eða jafnt og ", email: "er ekki löglegt email", integer: "Vinsamlega settu inn tölu", date: "Vinsamlega setti inn dagsetningu", url: "er ekki löglegt URL. Vantar ('http://' eða 'https://')", nodefined : " er ekki skilgreint!", novalue : " skilagildi nauðsynlegt!", customarray : "Fall skal skila fylki!", customfcheck : "Fall skal vera skilgreint!" } }, view : { caption: "Skoða færslu", bClose: "Loka" }, del : { caption: "Eyða", msg: "Eyða völdum færslum ?", bSubmit: "Eyða", bCancel: "Hætta við" }, nav : { edittext: " ", edittitle: "Breyta færslu", addtext:" ", addtitle: "Ný færsla", deltext: " ", deltitle: "Eyða færslu", searchtext: " ", searchtitle: "Leita", refreshtext: "", refreshtitle: "Endurhlaða", alertcap: "Viðvörun", alerttext: "Vinsamlega veldu færslu", viewtext: "", viewtitle: "Skoða valda færslu" }, col : { caption: "Sýna / fela dálka", bSubmit: "Vista", bCancel: "Hætta við" }, errors : { errcap : "Villa", nourl : "Vantar slóð", norecords: "Engar færslur valdar", model : "Lengd colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Sun", "Mán", "Þri", "Mið", "Fim", "Fös", "Lau", "Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "Maí", "Jún", "Júl", "Ágú", "Sep", "Oct", "Nóv", "Des", "Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júný", "Júlý", "Ágúst", "September", "Október", "Nóvember", "Desember" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-is.js
JavaScript
gpl2
4,215
;(function($){ /** * jqGrid Galician Translation * Translated by Jorge Barreiro <yortx.barry@gmail.com> * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Amosando {0} - {1} de {2}", emptyrecords: "Sen rexistros que amosar", loadtext: "Cargando...", pgtext : "Páxina {0} de {1}" }, search : { caption: "Búsqueda...", Find: "Buscar", Reset: "Limpar", odata : ['igual ', 'diferente a', 'menor que', 'menor ou igual que','maior que','maior ou igual a', 'empece por','non empece por','está en','non está en','termina por','non termina por','contén','non contén'], groupOps: [ { op: "AND", text: "todo" }, { op: "OR", text: "calquera" } ], matchText: " match", rulesText: " regras" }, edit : { addCaption: "Engadir rexistro", editCaption: "Modificar rexistro", bSubmit: "Gardar", bCancel: "Cancelar", bClose: "Pechar", saveData: "Modificáronse os datos, quere gardar os cambios?", bYes : "Si", bNo : "Non", bExit : "Cancelar", msg: { required:"Campo obrigatorio", number:"Introduza un número", minValue:"O valor debe ser maior ou igual a ", maxValue:"O valor debe ser menor ou igual a ", email: "non é un enderezo de correo válido", integer: "Introduza un valor enteiro", date: "Introduza unha data correcta ", url: "non é unha URL válida. Prefixo requerido ('http://' ou 'https://')", nodefined : " non está definido.", novalue : " o valor de retorno é obrigatorio.", customarray : "A función persoalizada debe devolver un array.", customfcheck : "A función persoalizada debe estar presente no caso de ter validación persoalizada." } }, view : { caption: "Consultar rexistro", bClose: "Pechar" }, del : { caption: "Eliminar", msg: "Desexa eliminar os rexistros seleccionados?", bSubmit: "Eliminar", bCancel: "Cancelar" }, nav : { edittext: " ", edittitle: "Modificar a fila seleccionada", addtext:" ", addtitle: "Engadir unha nova fila", deltext: " ", deltitle: "Eliminar a fila seleccionada", searchtext: " ", searchtitle: "Buscar información", refreshtext: "", refreshtitle: "Recargar datos", alertcap: "Aviso", alerttext: "Seleccione unha fila", viewtext: "", viewtitle: "Ver fila seleccionada" }, col : { caption: "Mostrar/ocultar columnas", bSubmit: "Enviar", bCancel: "Cancelar" }, errors : { errcap : "Erro", nourl : "Non especificou unha URL", norecords: "Non hai datos para procesar", model : "As columnas de nomes son diferentes das columnas de modelo" }, formatter : { integer : {thousandsSeparator: ".", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Do", "Lu", "Ma", "Me", "Xo", "Ve", "Sa", "Domingo", "Luns", "Martes", "Mércoles", "Xoves", "Vernes", "Sábado" ], monthNames: [ "Xan", "Feb", "Mar", "Abr", "Mai", "Xuñ", "Xul", "Ago", "Set", "Out", "Nov", "Dec", "Xaneiro", "Febreiro", "Marzo", "Abril", "Maio", "Xuño", "Xullo", "Agosto", "Setembro", "Outubro", "Novembro", "Decembro" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd-m-Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-gl.js
JavaScript
gpl2
4,411
;(function($){ /** * jqGrid English Translation * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Pregled {0} - {1} od {2}", emptyrecords: "Nema zapisa", loadtext: "Učitavam...", pgtext : "Stranica {0} od {1}" }, search : { caption: "pretraživanje...", Find: "Traži", Reset: "Poništi", odata : ['jednak', 'nije identičan', 'manje', 'manje ili identično','veće','veše ili identično', 'počinje sa','ne počinje sa ','je u','nije u','završava sa','ne završava sa','sadrži','ne sadrži'], groupOps: [ { op: "U", text: "sve" }, { op: "ILI", text: "bilo koji" } ], matchText: " podudata se", rulesText: " pravila" }, edit : { addCaption: "Dodaj zapis", editCaption: "Promijeni zapis", bSubmit: "Preuzmi", bCancel: "Odustani", bClose: "Zatvri", saveData: "Podaci su promijenjeni! Preuzmi promijene?", bYes : "Da", bNo : "Ne", bExit : "Odustani", msg: { required:"Polje je obavezno", number:"Molim, unesite ispravan broj", minValue:"vrijednost mora biti veća ili identična ", maxValue:"vrijednost mora biti manja ili identična", email: "neispravan e-mail", integer: "Molim, unjeti ispravan cijeli broj (integer)", date: "Molim, unjeti ispravan datum ", url: "neispravan URL. Prefiks je obavezan ('http://' or 'https://')", nodefined : " nije definiran!", novalue : " zahtjevan podatak je obavezan!", customarray : "Opcionalna funkcija trebala bi bili polje (array)!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Otvori zapis", bClose: "Zatvori" }, del : { caption: "Obriši", msg: "Obriši označen zapis ili više njih?", bSubmit: "Obriši", bCancel: "Odustani" }, nav : { edittext: "", edittitle: "Promijeni obilježeni red", addtext:"", addtitle: "Dodaj novi red", deltext: "", deltitle: "Obriši obilježeni red", searchtext: "", searchtitle: "Potraži zapise", refreshtext: "", refreshtitle: "Ponovo preuzmi podatke", alertcap: "Upozorenje", alerttext: "Molim, odaberi red", viewtext: "", viewtitle: "Pregled obilježenog reda" }, col : { caption: "Obilježi kolonu", bSubmit: "Uredu", bCancel: "Odustani" }, errors : { errcap : "Greška", nourl : "Nedostaje URL", norecords: "Bez zapisa za obradu", model : "Duljina colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub", "Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota" ], monthNames: [ "Sij", "Vel", "Ožu", "Tra", "Svi", "Lip", "Srp", "Kol", "Ruj", "Lis", "Stu", "Pro", "Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return ''}, srcformat: 'Y-m-d', newformat: 'd.m.Y.', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "j.n.Y.", LongDate: "l, j. F Y", FullDateTime: "l, d. F Y G:i:s", MonthDay: "d. F", ShortTime: "G:i", LongTime: "G:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-hr.js
JavaScript
gpl2
4,015
;(function($){ /** * jqGrid Ukrainian Translation v1.0 02.07.2009 * Sergey Dyagovchenko * http://d.sumy.ua * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Перегляд {0} - {1} з {2}", emptyrecords: "Немає записів для перегляду", loadtext: "Завантаження...", pgtext : "Стор. {0} з {1}" }, search : { caption: "Пошук...", Find: "Знайти", Reset: "Скидання", odata : ['рівно', 'не рівно', 'менше', 'менше або рівне','більше','більше або рівне', 'починається з','не починається з','знаходиться в','не знаходиться в','закінчується на','не закінчується на','містить','не містить'], groupOps: [ { op: "AND", text: "все" }, { op: "OR", text: "будь-який" } ], matchText: " збігається", rulesText: " правила" }, edit : { addCaption: "Додати запис", editCaption: "Змінити запис", bSubmit: "Зберегти", bCancel: "Відміна", bClose: "Закрити", saveData: "До данних були внесені зміни! Зберегти зміни?", bYes : "Так", bNo : "Ні", bExit : "Відміна", msg: { required:"Поле є обов'язковим", number:"Будь ласка, введіть правильне число", minValue:"значення повинне бути більше або дорівнює", maxValue:"значення повинно бути менше або дорівнює", email: "некоректна адреса електронної пошти", integer: "Будь ласка, введення дійсне ціле значення", date: "Будь ласка, введення дійсне значення дати", url: "не дійсний URL. Необхідна приставка ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Переглянути запис", bClose: "Закрити" }, del : { caption: "Видалити", msg: "Видалити обраний запис(и)?", bSubmit: "Видалити", bCancel: "Відміна" }, nav : { edittext: " ", edittitle: "Змінити вибраний запис", addtext:" ", addtitle: "Додати новий запис", deltext: " ", deltitle: "Видалити вибраний запис", searchtext: " ", searchtitle: "Знайти записи", refreshtext: "", refreshtitle: "Оновити таблицю", alertcap: "Попередження", alerttext: "Будь ласка, виберіть запис", viewtext: "", viewtitle: "Переглянути обраний запис" }, col : { caption: "Показати/Приховати стовпці", bSubmit: "Зберегти", bCancel: "Відміна" }, errors : { errcap : "Помилка", nourl : "URL не задан", norecords: "Немає записів для обробки", model : "Число полів не відповідає числу стовпців таблиці!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота" ], monthNames: [ "Січ", "Лют", "Бер", "Кві", "Тра", "Чер", "Лип", "Сер", "Вер", "Жов", "Лис", "Гру", "Січень", "Лютий", "Березень", "Квітень", "Травень", "Червень", "Липень", "Серпень", "Вересень", "Жовтень", "Листопад", "Грудень" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd.m.Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n.j.Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y G:i:s", MonthDay: "F d", ShortTime: "G:i", LongTime: "G:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-ua.js
JavaScript
gpl2
5,470
;(function($){ /** * jqGrid Czech Translation * Pavel Jirak pavel.jirak@jipas.cz * doplnil Thomas Wagner xwagne01@stud.fit.vutbr.cz * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Zobrazeno {0} - {1} z {2} záznamů", emptyrecords: "Nenalezeny žádné záznamy", loadtext: "Načítám...", pgtext : "Strana {0} z {1}" }, search : { caption: "Vyhledávám...", Find: "Hledat", Reset: "Reset", odata : ['rovno', 'nerovono', 'menší', 'menší nebo rovno','větší', 'větší nebo rovno', 'začíná s', 'nezačíná s', 'je v', 'není v', 'končí s', 'nekončí s', 'obahuje', 'neobsahuje'], groupOps: [ { op: "AND", text: "všech" }, { op: "OR", text: "některého z" } ], matchText: " hledat podle", rulesText: " pravidel" }, edit : { addCaption: "Přidat záznam", editCaption: "Editace záznamu", bSubmit: "Uložit", bCancel: "Storno", bClose: "Zavřít", saveData: "Data byla změněna! Uložit změny?", bYes : "Ano", bNo : "Ne", bExit : "Zrušit", msg: { required:"Pole je vyžadováno", number:"Prosím, vložte validní číslo", minValue:"hodnota musí být větší než nebo rovná ", maxValue:"hodnota musí být menší než nebo rovná ", email: "není validní e-mail", integer: "Prosím, vložte celé číslo", date: "Prosím, vložte validní datum", url: "není platnou URL. Vyžadován prefix ('http://' or 'https://')", nodefined : " není definován!", novalue : " je vyžadována návratová hodnota!", customarray : "Custom function mělá vrátit pole!", customfcheck : "Custom function by měla být přítomna v případě custom checking!" } }, view : { caption: "Zobrazit záznam", bClose: "Zavřít" }, del : { caption: "Smazat", msg: "Smazat vybraný(é) záznam(y)?", bSubmit: "Smazat", bCancel: "Storno" }, nav : { edittext: " ", edittitle: "Editovat vybraný řádek", addtext:" ", addtitle: "Přidat nový řádek", deltext: " ", deltitle: "Smazat vybraný záznam ", searchtext: " ", searchtitle: "Najít záznamy", refreshtext: "", refreshtitle: "Obnovit tabulku", alertcap: "Varování", alerttext: "Prosím, vyberte řádek", viewtext: "", viewtitle: "Zobrazit vybraný řádek" }, col : { caption: "Zobrazit/Skrýt sloupce", bSubmit: "Uložit", bCancel: "Storno" }, errors : { errcap : "Chyba", nourl : "Není nastavena url", norecords: "Žádné záznamy ke zpracování", model : "Délka colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Ne", "Po", "Út", "St", "Čt", "Pá", "So", "Neděle", "Pondělí", "Úterý", "Středa", "Čtvrtek", "Pátek", "Sobota" ], monthNames: [ "Led", "Úno", "Bře", "Dub", "Kvě", "Čer", "Čvc", "Srp", "Zář", "Říj", "Lis", "Pro", "Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec" ], AmPm : ["do","od","DO","OD"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-cs.js
JavaScript
gpl2
4,312
;(function($){ /** * jqGrid Serbian latin Translation * Bild Studio info@bild-studio.net * http://www.bild-studio.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Pregled {0} - {1} od {2}", emptyrecords: "Ne postoji nijedan zapis", loadtext: "Učitivanje...", pgtext : "Strana {0} od {1}" }, search : { caption: "Traženje...", Find: "Traži", Reset: "Resetuj", odata : ['jednako', 'nije jednako', 'manje', 'manje ili jednako','veće','veće ili jednako', 'počinje sa','ne počinje sa','je u','nije u','završava sa','ne završava sa','sadrži','ne sadrži'], groupOps: [ { op: "AND", text: "sva" }, { op: "OR", text: "bilo koje" } ], matchText: " primeni", rulesText: " pravila" }, edit : { addCaption: "Dodaj zapis", editCaption: "Izmeni zapis", bSubmit: "Pošalji", bCancel: "Odustani", bClose: "Zatvori", saveData: "Podatak je izmenjen! Sačuvaj izmene?", bYes : "Da", bNo : "Ne", bExit : "Odustani", msg: { required: "Polje je obavezno", number: "Unesite ispravan broj", minValue: "vrednost mora biti veća od ili jednaka sa ", maxValue: "vrednost mora biti manja ili jednaka sa", email: "nije ispravna email adresa, nije valjda da ne umeš ukucati mail!?", integer: "Unesi celobrojnu vrednost ", date: "Unesite ispravan datum", url: "nije ispravan URL. Potreban je prefiks ('http://' or 'https://')", nodefined : " nije definisan!", novalue : " zahtevana je povratna vrednost!", customarray : "Prilagođena funkcija treba da vrati niz!", customfcheck : "Prilagođena funkcija treba da bude prisutana u slučaju prilagođene provere!" } }, view : { caption: "Pogledaj zapis", bClose: "Zatvori" }, del : { caption: "Izbrisi", msg: "Izbrisi izabran(e) zapise(e)?", bSubmit: "Izbriši", bCancel: "Odbaci" }, nav : { edittext: "", edittitle: "Izmeni izabrani red", addtext:"", addtitle: "Dodaj novi red", deltext: "", deltitle: "Izbriši izabran red", searchtext: "", searchtitle: "Nađi zapise", refreshtext: "", refreshtitle: "Ponovo učitaj podatke", alertcap: "Upozorenje", alerttext: "Izaberite red", viewtext: "", viewtitle: "Pogledaj izabrani red" }, col : { caption: "Izaberi kolone", bSubmit: "OK", bCancel: "Odbaci" }, errors : { errcap : "Greška", nourl : "Nije postavljen URL", norecords: "Nema zapisa za obradu", model : "Dužina modela colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Ned", "Pon", "Uto", "Sre", "Čet", "Pet", "Sub", "Nedelja", "Ponedeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Avg", "Sep", "Okt", "Nov", "Dec", "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-sr-latin.js
JavaScript
gpl2
4,082
;(function($){ /** * jqGrid English Translation * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "View {0} - {1} of {2}", emptyrecords: "No records to view", loadtext: "Loading...", pgtext : "Page {0} of {1}" }, search : { caption: "Search...", Find: "Find", Reset: "Reset", odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'], groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ], matchText: " match", rulesText: " rules" }, edit : { addCaption: "Add Record", editCaption: "Edit Record", bSubmit: "Submit", bCancel: "Cancel", bClose: "Close", saveData: "Data has been changed! Save changes?", bYes : "Yes", bNo : "No", bExit : "Cancel", msg: { required:"Field is required", number:"Please, enter valid number", minValue:"value must be greater than or equal to ", maxValue:"value must be less than or equal to", email: "is not a valid e-mail", integer: "Please, enter valid integer value", date: "Please, enter valid date value", url: "is not a valid URL. Prefix required ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "View Record", bClose: "Close" }, del : { caption: "Delete", msg: "Delete selected record(s)?", bSubmit: "Delete", bCancel: "Cancel" }, nav : { edittext: "", edittitle: "Edit selected row", addtext:"", addtitle: "Add new row", deltext: "", deltitle: "Delete selected row", searchtext: "", searchtitle: "Find records", refreshtext: "", refreshtitle: "Reload Grid", alertcap: "Warning", alerttext: "Please, select row", viewtext: "", viewtitle: "View selected row" }, col : { caption: "Select columns", bSubmit: "Ok", bCancel: "Cancel" }, errors : { errcap : "Error", nourl : "No url is set", norecords: "No records to process", model : "Length of colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-en.js
JavaScript
gpl2
3,927
;(function($){ /** * jqGrid Russian Translation v1.0 02.07.2009 (based on translation by Alexey Kanaev v1.1 21.01.2009, http://softcore.com.ru) * Sergey Dyagovchenko * http://d.sumy.ua * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Просмотр {0} - {1} из {2}", emptyrecords: "Нет записей для просмотра", loadtext: "Загрузка...", pgtext : "Стр. {0} из {1}" }, search : { caption: "Поиск...", Find: "Найти", Reset: "Сброс", odata : ['равно', 'не равно', 'меньше', 'меньше или равно','больше','больше или равно', 'начинается с','не начинается с','находится в','не находится в','заканчивается на','не заканчивается на','содержит','не содержит'], groupOps: [ { op: "AND", text: "все" }, { op: "OR", text: "любой" } ], matchText: " совпадает", rulesText: " правила" }, edit : { addCaption: "Добавить запись", editCaption: "Редактировать запись", bSubmit: "Сохранить", bCancel: "Отмена", bClose: "Закрыть", saveData: "Данные были измененны! Сохранить изменения?", bYes : "Да", bNo : "Нет", bExit : "Отмена", msg: { required:"Поле является обязательным", number:"Пожалуйста, введите правильное число", minValue:"значение должно быть больше либо равно", maxValue:"значение должно быть меньше либо равно", email: "некорректное значение e-mail", integer: "Пожалуйста, введите целое число", date: "Пожалуйста, введите правильную дату", url: "неверная ссылка. Необходимо ввести префикс ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Просмотр записи", bClose: "Закрыть" }, del : { caption: "Удалить", msg: "Удалить выбранную запись(и)?", bSubmit: "Удалить", bCancel: "Отмена" }, nav : { edittext: " ", edittitle: "Редактировать выбранную запись", addtext:" ", addtitle: "Добавить новую запись", deltext: " ", deltitle: "Удалить выбранную запись", searchtext: " ", searchtitle: "Найти записи", refreshtext: "", refreshtitle: "Обновить таблицу", alertcap: "Внимание", alerttext: "Пожалуйста, выберите запись", viewtext: "", viewtitle: "Просмотреть выбранную запись" }, col : { caption: "Показать/скрыть столбцы", bSubmit: "Сохранить", bCancel: "Отмена" }, errors : { errcap : "Ошибка", nourl : "URL не установлен", norecords: "Нет записей для обработки", model : "Число полей не соответствует числу столбцов таблицы!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Воскресение", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота" ], monthNames: [ "Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек", "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd.m.Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n.j.Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y G:i:s", MonthDay: "F d", ShortTime: "G:i", LongTime: "G:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-ru.js
JavaScript
gpl2
5,526
;(function($){ /** * jqGrid Slovak Translation * Milan Cibulka * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Zobrazených {0} - {1} z {2} záznamov", emptyrecords: "Neboli nájdené žiadne záznamy", loadtext: "Načítám...", pgtext : "Strana {0} z {1}" }, search : { caption: "Vyhľadávam...", Find: "Hľadať", Reset: "Reset", odata : ['rovná sa', 'nerovná sa', 'menšie', 'menšie alebo rovnajúce sa','väčšie', 'väčšie alebo rovnajúce sa', 'začína s', 'nezačína s', 'je v', 'nie je v', 'končí s', 'nekončí s', 'obahuje', 'neobsahuje'], groupOps: [ { op: "AND", text: "všetkých" }, { op: "OR", text: "niektorého z" } ], matchText: " hľadať podla", rulesText: " pravidiel" }, edit : { addCaption: "Pridať záznam", editCaption: "Editácia záznamov", bSubmit: "Uložiť", bCancel: "Storno", bClose: "Zavrieť", saveData: "Údaje boli zmenené! Uložiť zmeny?", bYes : "Ano", bNo : "Nie", bExit : "Zrušiť", msg: { required:"Pole je požadované", number:"Prosím, vložte valídne číslo", minValue:"hodnota musí býť väčšia ako alebo rovná ", maxValue:"hodnota musí býť menšia ako alebo rovná ", email: "nie je valídny e-mail", integer: "Prosím, vložte celé číslo", date: "Prosím, vložte valídny dátum", url: "nie je platnou URL. Požadovaný prefix ('http://' alebo 'https://')", nodefined : " nie je definovaný!", novalue : " je vyžadovaná návratová hodnota!", customarray : "Custom function mala vrátiť pole!", customfcheck : "Custom function by mala byť prítomná v prípade custom checking!" } }, view : { caption: "Zobraziť záznam", bClose: "Zavrieť" }, del : { caption: "Zmazať", msg: "Zmazať vybraný(é) záznam(y)?", bSubmit: "Zmazať", bCancel: "Storno" }, nav : { edittext: " ", edittitle: "Editovať vybraný riadok", addtext:" ", addtitle: "Pridať nový riadek", deltext: " ", deltitle: "Zmazať vybraný záznam ", searchtext: " ", searchtitle: "Nájsť záznamy", refreshtext: "", refreshtitle: "Obnoviť tabuľku", alertcap: "Varovanie", alerttext: "Prosím, vyberte riadok", viewtext: "", viewtitle: "Zobraziť vybraný riadok" }, col : { caption: "Zobrazit/Skrýť stĺpce", bSubmit: "Uložiť", bCancel: "Storno" }, errors : { errcap : "Chyba", nourl : "Nie je nastavená url", norecords: "Žiadne záznamy k spracovaniu", model : "Dĺžka colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Ne", "Po", "Ut", "St", "Št", "Pi", "So", "Nedela", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatek", "Sobota" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec", "Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December" ], AmPm : ["do","od","DO","OD"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-sk.js
JavaScript
gpl2
4,291
;(function($){ /** * jqGrid Bulgarian Translation * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "{0} - {1} от {2}", emptyrecords: "Няма запис(и)", loadtext: "Зареждам...", pgtext : "Стр. {0} от {1}" }, search : { caption: "Търсене...", Find: "Намери", Reset: "Изчисти", odata : ['равно', 'различно', 'по-малко', 'по-малко или=','по-голямо','по-голямо или =', 'започва с','не започва с','се намира в','не се намира в','завършва с','не завършава с','съдържа', 'не съдържа' ], groupOps: [ { op: "AND", text: "&nbsp;И " }, { op: "OR", text: "ИЛИ" } ], matchText: " включи", rulesText: " клауза" }, edit : { addCaption: "Нов Запис", editCaption: "Редакция Запис", bSubmit: "Запиши", bCancel: "Изход", bClose: "Затвори", saveData: "Данните са променени! Да съхраня ли промените?", bYes : "Да", bNo : "Не", bExit : "Отказ", msg: { required:"Полето е задължително", number:"Въведете валидно число!", minValue:"стойността трябва да е по-голяма или равна от", maxValue:"стойността трябва да е по-малка или равна от", email: "не е валиден ел. адрес", integer: "Въведете валидно цяло число", date: "Въведете валидна дата", url: "e невалиден URL. Изискава се префикс('http://' или 'https://')", nodefined : " е недефинирана!", novalue : " изисква връщане на стойност!", customarray : "Потреб. Функция трябва да върне масив!", customfcheck : "Потребителска функция е задължителна при този тип елемент!" } }, view : { caption: "Преглед запис", bClose: "Затвори" }, del : { caption: "Изтриване", msg: "Да изтрия ли избраният запис?", bSubmit: "Изтрий", bCancel: "Отказ" }, nav : { edittext: " ", edittitle: "Редакция избран запис", addtext:" ", addtitle: "Добавяне нов запис", deltext: " ", deltitle: "Изтриване избран запис", searchtext: " ", searchtitle: "Търсене запис(и)", refreshtext: "", refreshtitle: "Обнови таблица", alertcap: "Предупреждение", alerttext: "Моля, изберете запис", viewtext: "", viewtitle: "Преглед избран запис" }, col : { caption: "Избери колони", bSubmit: "Ок", bCancel: "Изход" }, errors : { errcap : "Грешка", nourl : "Няма посочен url адрес", norecords: "Няма запис за обработка", model : "Модела не съответства на имената!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:" лв.", defaultValue: '0.00'}, date : { dayNames: [ "Нед", "Пон", "Вт", "Ср", "Чет", "Пет", "Съб", "Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота" ], monthNames: [ "Яну", "Фев", "Мар", "Апр", "Май", "Юни", "Юли", "Авг", "Сеп", "Окт", "Нов", "Дек", "Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември" ], AmPm : ["","","",""], S: function (j) { if(j==7 || j==8 || j== 27 || j== 28) { return 'ми'; } return ['ви', 'ри', 'ти'][Math.min((j - 1) % 10, 2)]; }, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-bg.js
JavaScript
gpl2
5,099
;(function($){ /** * jqGrid (fi) Finnish Translation * Jukka Inkeri awot.fi 2010-05-19 * Alex Grönholm alex.gronholm@nextday.fi 2011-05-18 * http://awot.fi * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults: { recordtext: "Rivit {0} - {1} / {2}", emptyrecords: "Ei n&auml;ytett&auml;vi&auml;", loadtext: "Haetaan...", pgtext: "Sivu {0} / {1}" }, search: { caption: "Etsi...", Find: "Etsi", Reset: "Tyhjenn&auml;", odata: ['on', 'ei ole', 'pienempi', 'pienempi tai yht&auml;suuri','suurempi','suurempi tai yht&auml;suuri', 'alkaa','ei ala','joukossa','ei joukossa','loppuu','ei lopu','sis&auml;lt&auml;&auml;','ei sis&auml;ll&auml;','on tyhj&auml;','ei ole tyhj&auml;'], groupOps: [ { op: "AND", text: "kaikki" }, { op: "OR", text: "mik&auml; tahansa" } ], matchText: "&nbsp;&nbsp;t&auml;yt&auml; ehdot:", rulesText: "" }, edit: { addCaption: "Uusi rivi", editCaption: "Muokkaa rivi&auml;", bSubmit: "OK", bCancel: "Peru", bClose: "Sulje", saveData: "Tietoja muutettu! Tallennetaanko?", bYes: "Kyll&auml;", bNo: "Ei", bExit: "Peru", msg: { required: "pakollinen", number: "Anna kelvollinen nro", minValue: "arvon oltava suurempi tai yht&auml;suuri kuin ", maxValue: "arvon oltava pienempi tai yht&auml;suuri kuin ", email: "ei ole kelvollinen s&auml;postiosoite", integer: "Anna kelvollinen kokonaisluku", date: "Anna kelvollinen pvm", url: "Ei ole kelvollinen linkki(URL). Alku oltava ('http://' tai 'https://')", nodefined: " ei ole m&auml;&auml;ritelty!", novalue: " paluuarvo vaaditaan!", customarray: "Oman funktion tulee palauttaa jono!", customfcheck: "Oma funktio on m&auml;&auml;ritelt&auml;v&auml; r&auml;&auml;t&auml;l&ouml;ity&auml; tarkastusta varten!" } }, view: { caption: "N&auml;yt&auml; rivi", bClose: "Sulje" }, del: { caption: "Poista", msg: "Poista valitut rivit?", bSubmit: "Poista", bCancel: "Peru" }, nav: { edittext: "", edittitle: "Muokkaa valittua rivi&auml;", addtext: "", addtitle: "Uusi rivi", deltext: "", deltitle: "Poista valittu rivi", searchtext: "", searchtitle: "Etsi tietoja", refreshtext: "", refreshtitle: "Lataa uudelleen", alertcap: "Varoitus", alerttext: "Valitse rivi", viewtext: "", viewtitle: "N&auml;yta valitut rivit" }, col: { caption: "Valitse sarakkeet", bSubmit: "OK", bCancel: "Peru" }, errors : { errcap: "Virhe", nourl: "URL on asettamatta", norecords: "Ei muokattavia tietoja", model: "Pituus colNames <> colModel!" }, formatter: { integer: {thousandsSeparator: "", defaultValue: '0'}, number: {decimalSeparator:",", thousandsSeparator: "", decimalPlaces: 2, defaultValue: '0,00'}, currency: {decimalSeparator:",", thousandsSeparator: "", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date: { dayNames: [ "Su", "Ma", "Ti", "Ke", "To", "Pe", "La", "Sunnuntai", "Maanantai", "Tiistai", "Keskiviikko", "Torstai", "Perjantai", "Lauantai" ], monthNames: [ "Tam", "Hel", "Maa", "Huh", "Tou", "Kes", "Hei", "Elo", "Syy", "Lok", "Mar", "Jou", "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kes&auml;kuu", "Hein&auml;kuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu" ], AmPm: ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd.m.Y', masks: { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "d.m.Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox: {disabled:true}, idName: 'id' } }; // FI })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-fi.js
JavaScript
gpl2
4,433
;(function($){ /** * jqGrid Romanian Translation * Alexandru Emil Lupu contact@alecslupu.ro * http://www.alecslupu.ro/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Vizualizare {0} - {1} din {2}", emptyrecords: "Nu există înregistrări de vizualizat", loadtext: "Încărcare...", pgtext : "Pagina {0} din {1}" }, search : { caption: "Caută...", Find: "Caută", Reset: "Resetare", odata : ['egal', 'diferit', 'mai mic', 'mai mic sau egal','mai mare','mai mare sau egal', 'începe cu','nu începe cu','se găsește în','nu se găsește în','se termină cu','nu se termină cu','conține',''], groupOps: [ { op: "AND", text: "toate" }, { op: "OR", text: "oricare" } ], matchText: " găsite", rulesText: " reguli" }, edit : { addCaption: "Adăugare înregistrare", editCaption: "Modificare înregistrare", bSubmit: "Salvează", bCancel: "Anulare", bClose: "Închide", saveData: "Informațiile au fost modificate! Salvați modificările?", bYes : "Da", bNo : "Nu", bExit : "Anulare", msg: { required:"Câmpul este obligatoriu", number:"Vă rugăm introduceți un număr valid", minValue:"valoarea trebuie sa fie mai mare sau egală cu", maxValue:"valoarea trebuie sa fie mai mică sau egală cu", email: "nu este o adresă de e-mail validă", integer: "Vă rugăm introduceți un număr valid", date: "Vă rugăm să introduceți o dată validă", url: "Nu este un URL valid. Prefixul este necesar('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Vizualizare înregistrare", bClose: "Închidere" }, del : { caption: "Ștegere", msg: "Ștergeți înregistrarea (înregistrările) selectate?", bSubmit: "Șterge", bCancel: "Anulare" }, nav : { edittext: "", edittitle: "Modifică rândul selectat", addtext:"", addtitle: "Adaugă rând nou", deltext: "", deltitle: "Șterge rândul selectat", searchtext: "", searchtitle: "Căutare înregistrări", refreshtext: "", refreshtitle: "Reîncarcare Grid", alertcap: "Avertisment", alerttext: "Vă rugăm să selectați un rând", viewtext: "", viewtitle: "Vizualizează rândul selectat" }, col : { caption: "Arată/Ascunde coloanele", bSubmit: "Salvează", bCancel: "Anulare" }, errors : { errcap : "Eroare", nourl : "Niciun url nu este setat", norecords: "Nu sunt înregistrări de procesat", model : "Lungimea colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Dum", "Lun", "Mar", "Mie", "Joi", "Vin", "Sâm", "Duminică", "Luni", "Marți", "Miercuri", "Joi", "Vineri", "Sâmbătă" ], monthNames: [ "Ian", "Feb", "Mar", "Apr", "Mai", "Iun", "Iul", "Aug", "Sep", "Oct", "Noi", "Dec", "Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie" ], AmPm : ["am","pm","AM","PM"], /* Here is a problem in romanian: M / F 1st = primul / prima 2nd = Al doilea / A doua 3rd = Al treilea / A treia 4th = Al patrulea/ A patra 5th = Al cincilea / A cincea 6th = Al șaselea / A șasea 7th = Al șaptelea / A șaptea .... */ S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-ro.js
JavaScript
gpl2
4,602
;(function($){ /** * jqGrid Swedish Translation * Harald Normann harald.normann@wts.se, harald.normann@gmail.com * http://www.worldteamsoftware.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Visar {0} - {1} av {2}", emptyrecords: "Det finns inga poster att visa", loadtext: "Laddar...", pgtext : "Sida {0} av {1}" }, search : { caption: "Sök Poster - Ange sökvillkor", Find: "Sök", Reset: "Nollställ Villkor", odata : ['lika', 'ej lika', 'mindre', 'mindre eller lika','större','större eller lika', 'börjar med','börjar inte med','tillhör','tillhör inte','slutar med','slutar inte med','innehåller','innehåller inte'], groupOps: [ { op: "AND", text: "alla" }, { op: "OR", text: "eller" } ], matchText: " träff", rulesText: " regler" }, edit : { addCaption: "Ny Post", editCaption: "Redigera Post", bSubmit: "Spara", bCancel: "Avbryt", bClose: "Stäng", saveData: "Data har ändrats! Spara förändringar?", bYes : "Ja", bNo : "Nej", bExit : "Avbryt", msg: { required:"Fältet är obligatoriskt", number:"Välj korrekt nummer", minValue:"värdet måste vara större än eller lika med", maxValue:"värdet måste vara mindre än eller lika med", email: "är inte korrekt e-post adress", integer: "Var god ange korrekt heltal", date: "Var god ange korrekt datum", url: "är inte en korrekt URL. Prefix måste anges ('http://' or 'https://')", nodefined : " är inte definierad!", novalue : " returvärde måste anges!", customarray : "Custom funktion måste returnera en vektor!", customfcheck : "Custom funktion måste finnas om Custom kontroll sker!" } }, view : { caption: "Visa Post", bClose: "Stäng" }, del : { caption: "Radera", msg: "Radera markerad(e) post(er)?", bSubmit: "Radera", bCancel: "Avbryt" }, nav : { edittext: "", edittitle: "Redigera markerad rad", addtext:"", addtitle: "Skapa ny post", deltext: "", deltitle: "Radera markerad rad", searchtext: "", searchtitle: "Sök poster", refreshtext: "", refreshtitle: "Uppdatera data", alertcap: "Varning", alerttext: "Ingen rad är markerad", viewtext: "", viewtitle: "Visa markerad rad" }, col : { caption: "Välj Kolumner", bSubmit: "OK", bCancel: "Avbryt" }, errors : { errcap : "Fel", nourl : "URL saknas", norecords: "Det finns inga poster att bearbeta", model : "Antal colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"Kr", defaultValue: '0,00'}, date : { dayNames: [ "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör", "Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec", "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" ], AmPm : ["fm","em","FM","EM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'Y-m-d', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-sv.js
JavaScript
gpl2
4,246
;(function($){ /** * jqGrid French Translation * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Enregistrements {0} - {1} sur {2}", emptyrecords: "Aucun enregistrement à afficher", loadtext: "Chargement...", pgtext : "Page {0} sur {1}" }, search : { caption: "Recherche...", Find: "Chercher", Reset: "Annuler", odata : ['égal', 'différent', 'inférieur', 'inférieur ou égal','supérieur','supérieur ou égal', 'commence par','ne commence pas par','est dans',"n'est pas dans",'finit par','ne finit pas par','contient','ne contient pas'], groupOps: [ { op: "AND", text: "tous" }, { op: "OR", text: "aucun" } ], matchText: " correspondance", rulesText: " règles" }, edit : { addCaption: "Ajouter", editCaption: "Editer", bSubmit: "Valider", bCancel: "Annuler", bClose: "Fermer", saveData: "Les données ont changé ! Enregistrer les modifications ?", bYes: "Oui", bNo: "Non", bExit: "Annuler", msg: { required: "Champ obligatoire", number: "Saisissez un nombre correct", minValue: "La valeur doit être supérieure ou égale à", maxValue: "La valeur doit être inférieure ou égale à", email: "n'est pas un email correct", integer: "Saisissez un entier correct", url: "n'est pas une adresse correcte. Préfixe requis ('http://' or 'https://')", nodefined : " n'est pas défini!", novalue : " la valeur de retour est requise!", customarray : "Une fonction personnalisée devrait retourner un tableau (array)!", customfcheck : "Une fonction personnalisée devrait être présente dans le cas d'une vérification personnalisée!" } }, view : { caption: "Voir les enregistrement", bClose: "Fermer" }, del : { caption: "Supprimer", msg: "Supprimer les enregistrements sélectionnés ?", bSubmit: "Supprimer", bCancel: "Annuler" }, nav : { edittext: " ", edittitle: "Editer la ligne sélectionnée", addtext:" ", addtitle: "Ajouter une ligne", deltext: " ", deltitle: "Supprimer la ligne sélectionnée", searchtext: " ", searchtitle: "Chercher un enregistrement", refreshtext: "", refreshtitle: "Recharger le tableau", alertcap: "Avertissement", alerttext: "Veuillez sélectionner une ligne", viewtext: "", viewtitle: "Afficher la ligne sélectionnée" }, col : { caption: "Afficher/Masquer les colonnes", bSubmit: "Valider", bCancel: "Annuler" }, errors : { errcap : "Erreur", nourl : "Aucune adresse n'est paramétrée", norecords: "Aucun enregistrement à traiter", model : "Nombre de titres (colNames) <> Nombre de données (colModel)!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam", "Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi" ], monthNames: [ "Jan", "Fév", "Mar", "Avr", "Mai", "Jui", "Jul", "Aou", "Sep", "Oct", "Nov", "Déc", "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Octobre", "Novembre", "Décembre" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j == 1 ? 'er' : 'e';}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-fr.js
JavaScript
gpl2
4,239
;(function($){ /** * jqGrid Danish Translation * Aesiras A/S * http://www.aesiras.dk * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Vis {0} - {1} of {2}", emptyrecords: "Ingen linjer fundet", loadtext: "Henter...", pgtext : "Side {0} af {1}" }, search : { caption: "Søg...", Find: "Find", Reset: "Nulstil", odata : ['lig', 'forskellige fra', 'mindre', 'mindre eller lig','større','større eller lig', 'begynder med','begynder ikke med','findes i','findes ikke i','ender med','ender ikke med','indeholder','indeholder ikke'], groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ], matchText: " lig", rulesText: " regler" }, edit : { addCaption: "Tilføj", editCaption: "Ret", bSubmit: "Send", bCancel: "Annuller", bClose: "Luk", saveData: "Data er ændret. Gem data?", bYes : "Ja", bNo : "Nej", bExit : "Fortryd", msg: { required:"Felt er nødvendigt", number:"Indtast venligst et validt tal", minValue:"værdi skal være større end eller lig med", maxValue:"værdi skal være mindre end eller lig med", email: "er ikke en gyldig email", integer: "Indtast venligst et gyldigt heltal", date: "Indtast venligst en gyldig datoværdi", url: "er ugyldig URL. Prefix mangler ('http://' or 'https://')", nodefined : " er ikke defineret!", novalue : " returværdi kræves!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Vis linje", bClose: "Luk" }, del : { caption: "Slet", msg: "Slet valgte linje(r)?", bSubmit: "Slet", bCancel: "Fortryd" }, nav : { edittext: " ", edittitle: "Rediger valgte linje", addtext:" ", addtitle: "Tilføj ny linje", deltext: " ", deltitle: "Slet valgte linje", searchtext: " ", searchtitle: "Find linjer", refreshtext: "", refreshtitle: "Indlæs igen", alertcap: "Advarsel", alerttext: "Vælg venligst linje", viewtext: "", viewtitle: "Vis valgte linje" }, col : { caption: "Vis/skjul kolonner", bSubmit: "Opdatere", bCancel: "Fortryd" }, errors : { errcap : "Fejl", nourl : "Ingen url valgt", norecords: "Ingen linjer at behandle", model : "colNames og colModel har ikke samme længde!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec", "Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December" ], AmPm : ["","","",""], S: function (j) {return '.'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "j/n/Y", LongDate: "l d. F Y", FullDateTime: "l d F Y G:i:s", MonthDay: "d. F", ShortTime: "G:i", LongTime: "G:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; // DA })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-da.js
JavaScript
gpl2
4,097
;(function($){ /** * jqGrid Serbian Translation * Александар Миловац(Aleksandar Milovac) aleksandar.milovac@gmail.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Преглед {0} - {1} од {2}", emptyrecords: "Не постоји ниједан запис", loadtext: "Учитавање...", pgtext : "Страна {0} од {1}" }, search : { caption: "Тражење...", Find: "Тражи", Reset: "Ресетуј", odata : ['једнако', 'није једнако', 'мање', 'мање или једнако','веће','веће или једнако', 'почиње са','не почиње са','је у','није у','завршава са','не завршава са','садржи','не садржи'], groupOps: [ { op: "И", text: "сви" }, { op: "ИЛИ", text: "сваки" } ], matchText: " match", rulesText: " правила" }, edit : { addCaption: "Додај запис", editCaption: "Измени запис", bSubmit: "Пошаљи", bCancel: "Одустани", bClose: "Затвори", saveData: "Податак је измењен! Сачувај измене?", bYes : "Да", bNo : "Не", bExit : "Одустани", msg: { required:"Поље је обавезно", number:"Молим, унесите исправан број", minValue:"вредност мора бити већа од или једнака са ", maxValue:"вредност мора бити мања од или једнака са", email: "није исправна имејл адреса", integer: "Молим, унесите исправну целобројну вредност ", date: "Молим, унесите исправан датум", url: "није исправан УРЛ. Потребан је префикс ('http://' or 'https://')", nodefined : " није дефинисан!", novalue : " захтевана је повратна вредност!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Погледај запис", bClose: "Затвори" }, del : { caption: "Избриши", msg: "Избриши изабран(е) запис(е)?", bSubmit: "Ибриши", bCancel: "Одбаци" }, nav : { edittext: "", edittitle: "Измени изабрани ред", addtext:"", addtitle: "Додај нови ред", deltext: "", deltitle: "Избриши изабран ред", searchtext: "", searchtitle: "Нађи записе", refreshtext: "", refreshtitle: "Поново учитај податке", alertcap: "Упозорење", alerttext: "Молим, изаберите ред", viewtext: "", viewtitle: "Погледај изабрани ред" }, col : { caption: "Изабери колоне", bSubmit: "ОК", bCancel: "Одбаци" }, errors : { errcap : "Грешка", nourl : "Није постављен URL", norecords: "Нема записа за обраду", model : "Дужина модела colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Нед", "Пон", "Уто", "Сре", "Чет", "Пет", "Суб", "Недеља", "Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота" ], monthNames: [ "Јан", "Феб", "Мар", "Апр", "Мај", "Јун", "Јул", "Авг", "Сеп", "Окт", "Нов", "Дец", "Јануар", "Фебруар", "Март", "Април", "Мај", "Јун", "Јул", "Август", "Септембар", "Октобар", "Новембар", "Децембар" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-sr.js
JavaScript
gpl2
5,027
;(function($){ /** * jqGrid Spanish Translation * Traduccion jqGrid en Español por Yamil Bracho * Traduccion corregida y ampliada por Faserline, S.L. * http://www.faserline.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Mostrando {0} - {1} de {2}", emptyrecords: "Sin registros que mostrar", loadtext: "Cargando...", pgtext : "Página {0} de {1}" }, search : { caption: "Búsqueda...", Find: "Buscar", Reset: "Limpiar", odata : ['igual ', 'no igual a', 'menor que', 'menor o igual que','mayor que','mayor o igual a', 'empiece por','no empiece por','está en','no está en','termina por','no termina por','contiene','no contiene'], groupOps: [ { op: "AND", text: "todo" }, { op: "OR", text: "cualquier" } ], matchText: " match", rulesText: " reglas" }, edit : { addCaption: "Agregar registro", editCaption: "Modificar registro", bSubmit: "Guardar", bCancel: "Cancelar", bClose: "Cerrar", saveData: "Se han modificado los datos, ¿guardar cambios?", bYes : "Si", bNo : "No", bExit : "Cancelar", msg: { required:"Campo obligatorio", number:"Introduzca un número", minValue:"El valor debe ser mayor o igual a ", maxValue:"El valor debe ser menor o igual a ", email: "no es una dirección de correo válida", integer: "Introduzca un valor entero", date: "Introduza una fecha correcta ", url: "no es una URL válida. Prefijo requerido ('http://' or 'https://')", nodefined : " no está definido.", novalue : " valor de retorno es requerido.", customarray : "La función personalizada debe devolver un array.", customfcheck : "La función personalizada debe estar presente en el caso de validación personalizada." } }, view : { caption: "Consultar registro", bClose: "Cerrar" }, del : { caption: "Eliminar", msg: "¿Desea eliminar los registros seleccionados?", bSubmit: "Eliminar", bCancel: "Cancelar" }, nav : { edittext: " ", edittitle: "Modificar fila seleccionada", addtext:" ", addtitle: "Agregar nueva fila", deltext: " ", deltitle: "Eliminar fila seleccionada", searchtext: " ", searchtitle: "Buscar información", refreshtext: "", refreshtitle: "Recargar datos", alertcap: "Aviso", alerttext: "Seleccione una fila", viewtext: "", viewtitle: "Ver fila seleccionada" }, col : { caption: "Mostrar/ocultar columnas", bSubmit: "Enviar", bCancel: "Cancelar" }, errors : { errcap : "Error", nourl : "No se ha especificado una URL", norecords: "No hay datos para procesar", model : "Las columnas de nombres son diferentes de las columnas de modelo" }, formatter : { integer : {thousandsSeparator: ".", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa", "Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado" ], monthNames: [ "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic", "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd-m-Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-es.js
JavaScript
gpl2
4,495
;(function($){ /** * jqGrid Catalan Translation * Traducció jqGrid en Catatà per Faserline, S.L. * http://www.faserline.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Mostrant {0} - {1} de {2}", emptyrecords: "Sense registres que mostrar", loadtext: "Carregant...", pgtext : "Pàgina {0} de {1}" }, search : { caption: "Cerca...", Find: "Cercar", Reset: "Buidar", odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'], groupOps: [ { op: "AND", text: "tot" }, { op: "OR", text: "qualsevol" } ], matchText: " match", rulesText: " rules" }, edit : { addCaption: "Afegir registre", editCaption: "Modificar registre", bSubmit: "Guardar", bCancel: "Cancelar", bClose: "Tancar", saveData: "Les dades han canviat. Guardar canvis?", bYes : "Yes", bNo : "No", bExit : "Cancel", msg: { required:"Camp obligatori", number:"Introdueixi un nombre", minValue:"El valor ha de ser major o igual que ", maxValue:"El valor ha de ser menor o igual a ", email: "no és una direcció de correu vàlida", integer: "Introdueixi un valor enter", date: "Introdueixi una data correcta ", url: "no és una URL vàlida. Prefix requerit ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Veure registre", bClose: "Tancar" }, del : { caption: "Eliminar", msg: "¿Desitja eliminar els registres seleccionats?", bSubmit: "Eliminar", bCancel: "Cancelar" }, nav : { edittext: " ", edittitle: "Modificar fila seleccionada", addtext:" ", addtitle: "Agregar nova fila", deltext: " ", deltitle: "Eliminar fila seleccionada", searchtext: " ", searchtitle: "Cercar informació", refreshtext: "", refreshtitle: "Refrescar taula", alertcap: "Avís", alerttext: "Seleccioni una fila", viewtext: " ", viewtitle: "Veure fila seleccionada" }, // setcolumns module col : { caption: "Mostrar/ocultar columnes", bSubmit: "Enviar", bCancel: "Cancelar" }, errors : { errcap : "Error", nourl : "No s'ha especificat una URL", norecords: "No hi ha dades per processar", model : "Les columnes de noms són diferents de les columnes del model" }, formatter : { integer : {thousandsSeparator: ".", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds", "Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte" ], monthNames: [ "Gen", "Febr", "Març", "Abr", "Maig", "Juny", "Jul", "Ag", "Set", "Oct", "Nov", "Des", "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd-m-Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: 'show', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-cat.js
JavaScript
gpl2
4,260
;(function($){ /** * jqGrid Montenegrian Translation * Bild Studio info@bild-studio.net * http://www.bild-studio.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Pregled {0} - {1} od {2}", emptyrecords: "Ne postoji nijedan zapis", loadtext: "Učitivanje...", pgtext : "Strana {0} od {1}" }, search : { caption: "Traženje...", Find: "Traži", Reset: "Resetuj", odata : ['jednako', 'nije jednako', 'manje', 'manje ili jednako','veće','veće ili jednako', 'počinje sa','ne počinje sa','je u','nije u','završava sa','ne završava sa','sadrži','ne sadrži'], groupOps: [ { op: "AND", text: "sva" }, { op: "OR", text: "bilo koje" } ], matchText: " primjeni", rulesText: " pravila" }, edit : { addCaption: "Dodaj zapis", editCaption: "Izmjeni zapis", bSubmit: "Pošalji", bCancel: "Odustani", bClose: "Zatvori", saveData: "Podatak je izmjenjen! Sačuvaj izmjene?", bYes : "Da", bNo : "Ne", bExit : "Odustani", msg: { required:"Polje je obavezno", number:"Unesite ispravan broj", minValue:"vrijednost mora biti veća od ili jednaka sa ", maxValue:"vrijednost mora biti manja ili jednaka sa", email: "nije ispravna email adresa, nije valjda da ne umiješ ukucati mail!?", integer: "Ne zajebaji se unesi cjelobrojnu vrijednost ", date: "Unesite ispravan datum", url: "nije ispravan URL. Potreban je prefiks ('http://' or 'https://')", nodefined : " nije definisan!", novalue : " zahtjevana je povratna vrijednost!", customarray : "Prilagođena funkcija treba da vrati niz!", customfcheck : "Prilagođena funkcija treba da bude prisutana u slučaju prilagođene provjere!" } }, view : { caption: "Pogledaj zapis", bClose: "Zatvori" }, del : { caption: "Izbrisi", msg: "Izbrisi izabran(e) zapise(e)?", bSubmit: "Izbriši", bCancel: "Odbaci" }, nav : { edittext: "", edittitle: "Izmjeni izabrani red", addtext:"", addtitle: "Dodaj novi red", deltext: "", deltitle: "Izbriši izabran red", searchtext: "", searchtitle: "Nađi zapise", refreshtext: "", refreshtitle: "Ponovo učitaj podatke", alertcap: "Upozorenje", alerttext: "Izaberite red", viewtext: "", viewtitle: "Pogledaj izabrani red" }, col : { caption: "Izaberi kolone", bSubmit: "OK", bCancel: "Odbaci" }, errors : { errcap : "Greška", nourl : "Nije postavljen URL", norecords: "Nema zapisa za obradu", model : "Dužina modela colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Ned", "Pon", "Uto", "Sre", "Čet", "Pet", "Sub", "Nedelja", "Ponedeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Avg", "Sep", "Okt", "Nov", "Dec", "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-mne.js
JavaScript
gpl2
4,110
;(function($){ /** * jqGrid Arabic Translation * * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "تسجيل {0} - {1} على {2}", emptyrecords: "لا يوجد تسجيل", loadtext: "تحميل...", pgtext : "صفحة {0} على {1}" }, search : { caption: "بحث...", Find: "بحث", Reset: "إلغاء", odata : ['يساوي', 'يختلف', 'أقل', 'أقل أو يساوي','أكبر','أكبر أو يساوي', 'يبدأ بـ','لا يبدأ بـ','est dans',"n'est pas dans",'ينته بـ','لا ينته بـ','يحتوي','لا يحتوي'], groupOps: [ { op: "مع", text: "الكل" }, { op: "أو", text: "لا أحد" } ], matchText: " توافق", rulesText: " قواعد" }, edit : { addCaption: "اضافة", editCaption: "تحديث", bSubmit: "تثبيث", bCancel: "إلغاء", bClose: "غلق", saveData: "تغيرت المعطيات هل تريد التسجيل ?", bYes: "نعم", bNo: "لا", bExit: "إلغاء", msg: { required: "خانة إجبارية", number: "سجل رقم صحيح", minValue: "يجب أن تكون القيمة أكبر أو تساوي 0", maxValue: "يجب أن تكون القيمة أقل أو تساوي 0", email: "بريد غير صحيح", integer: "سجل عدد طبييعي صحيح", url: "ليس عنوانا صحيحا. البداية الصحيحة ('http://' أو 'https://')", nodefined : " ليس محدد!", novalue : " قيمة الرجوع مطلوبة!", customarray : "يجب على الدالة الشخصية أن تنتج جدولا", customfcheck : "الدالة الشخصية مطلوبة في حالة التحقق الشخصي" } }, view : { caption: "رأيت التسجيلات", bClose: "غلق" }, del : { caption: "حذف", msg: "حذف التسجيلات المختارة ?", bSubmit: "حذف", bCancel: "إلغاء" }, nav : { edittext: " ", edittitle: "تغيير التسجيل المختار", addtext:" ", addtitle: "إضافة تسجيل", deltext: " ", deltitle: "حذف التسجيل المختار", searchtext: " ", searchtitle: "بحث عن تسجيل", refreshtext: "", refreshtitle: "تحديث الجدول", alertcap: "تحذير", alerttext: "يرجى إختيار السطر", viewtext: "", viewtitle: "إظهار السطر المختار" }, col : { caption: "إظهار/إخفاء الأعمدة", bSubmit: "تثبيث", bCancel: "إلغاء" }, errors : { errcap : "خطأ", nourl : "لا يوجد عنوان محدد", norecords: "لا يوجد تسجيل للمعالجة", model : "عدد العناوين (colNames) <> عدد التسجيلات (colModel)!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت", "الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت" ], monthNames: [ "جانفي", "فيفري", "مارس", "أفريل", "ماي", "جوان", "جويلية", "أوت", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر", "جانفي", "فيفري", "مارس", "أفريل", "ماي", "جوان", "جويلية", "أوت", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر" ], AmPm : ["صباحا","مساءا","صباحا","مساءا"], S: function (j) {return j == 1 ? 'er' : 'e';}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-ar.js
JavaScript
gpl2
4,610
;(function($){ /** * jqGrid Polish Translation * Łukasz Schab * http://FreeTree.pl * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Pokaż {0} - {1} z {2}", emptyrecords: "Brak rekordów do pokazania", loadtext: "\u0142adowanie...", pgtext : "Strona {0} z {1}" }, search : { caption: "Wyszukiwanie...", Find: "Szukaj", Reset: "Czyść", odata : ['dok\u0142adnie', 'różne od', 'mniejsze od', 'mniejsze lub równe','większe od','większe lub równe', 'zaczyna się od','nie zaczyna się od','zawiera','nie zawiera','kończy się na','nie kończy się na','zawiera','nie zawiera'], groupOps: [ { op: "ORAZ", text: "wszystkie" }, { op: "LUB", text: "każdy" } ], matchText: " pasuje", rulesText: " regu\u0142y" }, edit : { addCaption: "Dodaj rekord", editCaption: "Edytuj rekord", bSubmit: "Zapisz", bCancel: "Anuluj", bClose: "Zamknij", saveData: "Dane zosta\u0142y zmienione! Zapisać zmiany?", bYes : "Tak", bNo : "Nie", bExit : "Anuluj", msg: { required:"Pole jest wymagane", number:"Proszę wpisać poprawną liczbę", minValue:"wartość musi być większa lub równa", maxValue:"wartość musi być mniejsza od", email: "nie jest adresem e-mail", integer: "Proszę wpisać poprawną liczbę", date: "Proszę podaj poprawną datę", url: "jest niew\u0142aściwym adresem URL. Pamiętaj o prefiksie ('http://' lub 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Pokaż rekord", bClose: "Zamknij" }, del : { caption: "Usuwanie", msg: "Czy usunąć wybrany rekord(y)?", bSubmit: "Usuń", bCancel: "Anuluj" }, nav : { edittext: " ", edittitle: "Edytuj wybrany wiersz", addtext:" ", addtitle: "Dodaj nowy wiersz", deltext: " ", deltitle: "Usuń wybrany wiersz", searchtext: " ", searchtitle: "Wyszukaj rekord", refreshtext: "", refreshtitle: "Prze\u0142aduj", alertcap: "Uwaga", alerttext: "Proszę wybrać wiersz", viewtext: "", viewtitle: "View selected row" }, col : { caption: "Pokaż/Ukryj kolumny", bSubmit: "Zatwierdź", bCancel: "Anuluj" }, errors : { errcap : "B\u0142ąd", nourl : "Brak adresu url", norecords: "Brak danych", model : "D\u0142ugość colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Nie", "Pon", "Wt", "Śr", "Cz", "Pi", "So", "Niedziela", "Poniedzia\u0142ek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota" ], monthNames: [ "Sty", "Lu", "Mar", "Kwie", "Maj", "Cze", "Lip", "Sie", "Wrz", "Paź", "Lis", "Gru", "Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['', '', '', ''][Math.min((j - 1) % 10, 3)] : ''}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-pl.js
JavaScript
gpl2
4,262
;(function($){ /** * jqGrid Lithuanian Translation * aur1mas aur1mas@devnet.lt * http://aur1mas.devnet.lt * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Peržiūrima {0} - {1} iš {2}", emptyrecords: "Įrašų nėra", loadtext: "Kraunama...", pgtext : "Puslapis {0} iš {1}" }, search : { caption: "Paieška...", Find: "Ieškoti", Reset: "Atstatyti", odata : ['lygu', 'nelygu', 'mažiau', 'mažiau arba lygu','daugiau','daugiau arba lygu', 'prasideda','neprasideda','reikšmė yra','reikšmės nėra','baigiasi','nesibaigia','yra sudarytas','nėra sudarytas'], groupOps: [ { op: "AND", text: "visi" }, { op: "OR", text: "bet kuris" } ], matchText: " match", rulesText: " rules" }, edit : { addCaption: "Sukurti įrašą", editCaption: "Redaguoti įrašą", bSubmit: "Išsaugoti", bCancel: "Atšaukti", bClose: "Uždaryti", saveData: "Duomenys buvo pakeisti! Išsaugoti pakeitimus?", bYes : "Taip", bNo : "Ne", bExit : "Atšaukti", msg: { required:"Privalomas laukas", number:"Įveskite tinkamą numerį", minValue:"reikšmė turi būti didesnė arba lygi ", maxValue:"reikšmė turi būti mažesnė arba lygi", email: "neteisingas el. pašto adresas", integer: "Įveskite teisingą sveikąjį skaičių", date: "Įveskite teisingą datą", url: "blogas adresas. Nepamirškite pridėti ('http://' arba 'https://')", nodefined : " nėra apibrėžta!", novalue : " turi būti gražinama kokia nors reikšmė!", customarray : "Custom f-ja turi grąžinti masyvą!", customfcheck : "Custom f-ja tūrėtų būti sukurta, prieš bandant ją naudoti!" } }, view : { caption: "Peržiūrėti įrašus", bClose: "Uždaryti" }, del : { caption: "Ištrinti", msg: "Ištrinti pažymėtus įrašus(-ą)?", bSubmit: "Ištrinti", bCancel: "Atšaukti" }, nav : { edittext: "", edittitle: "Redaguoti pažymėtą eilutę", addtext:"", addtitle: "Pridėti naują eilutę", deltext: "", deltitle: "Ištrinti pažymėtą eilutę", searchtext: "", searchtitle: "Rasti įrašus", refreshtext: "", refreshtitle: "Perkrauti lentelę", alertcap: "Įspėjimas", alerttext: "Pasirinkite eilutę", viewtext: "", viewtitle: "Peržiūrėti pasirinktą eilutę" }, col : { caption: "Pasirinkti stulpelius", bSubmit: "Gerai", bCancel: "Atšaukti" }, errors : { errcap : "Klaida", nourl : "Url reikšmė turi būti perduota", norecords: "Nėra įrašų, kuriuos būtų galima apdoroti", model : "colNames skaičius <> colModel skaičiui!" }, formatter : { integer : {thousandsSeparator: "", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: "", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:",", thousandsSeparator: "", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš", "Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis" ], monthNames: [ "Sau", "Vas", "Kov", "Bal", "Geg", "Bir", "Lie", "Rugj", "Rugs", "Spa", "Lap", "Gru", "Sausis", "Vasaris", "Kovas", "Balandis", "Gegužė", "Birželis", "Liepa", "Rugpjūtis", "Rugsėjis", "Spalis", "Lapkritis", "Gruodis" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-lt.js
JavaScript
gpl2
4,262
;(function($){ /** * jqGrid Turkish Translation * Erhan Gündoğan (erhan@trposta.net) * http://blog.zakkum.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "{0}-{1} listeleniyor. Toplam:{2}", emptyrecords: "Kayıt bulunamadı", loadtext: "Yükleniyor...", pgtext : "{0}/{1}. Sayfa" }, search : { caption: "Arama...", Find: "Bul", Reset: "Temizle", odata : ['eşit', 'eşit değil', 'daha az', 'daha az veya eşit', 'daha fazla', 'daha fazla veya eşit', 'ile başlayan', 'ile başlamayan', 'içinde', 'içinde değil', 'ile biten', 'ile bitmeyen', 'içeren', 'içermeyen'], groupOps: [ { op: "VE", text: "tüm" }, { op: "VEYA", text: "herhangi" } ], matchText: " uyan", rulesText: " kurallar" }, edit : { addCaption: "Kayıt Ekle", editCaption: "Kayıt Düzenle", bSubmit: "Gönder", bCancel: "İptal", bClose: "Kapat", saveData: "Veriler değişti! Kayıt edilsin mi?", bYes : "Evet", bNo : "Hayıt", bExit : "İptal", msg: { required:"Alan gerekli", number:"Lütfen bir numara giriniz", minValue:"girilen değer daha büyük ya da buna eşit olmalıdır", maxValue:"girilen değer daha küçük ya da buna eşit olmalıdır", email: "geçerli bir e-posta adresi değildir", integer: "Lütfen bir tamsayı giriniz", url: "Geçerli bir URL değil. ('http://' or 'https://') ön eki gerekli.", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Kayıt Görüntüle", bClose: "Kapat" }, del : { caption: "Sil", msg: "Seçilen kayıtlar silinsin mi?", bSubmit: "Sil", bCancel: "İptal" }, nav : { edittext: " ", edittitle: "Seçili satırı düzenle", addtext:" ", addtitle: "Yeni satır ekle", deltext: " ", deltitle: "Seçili satırı sil", searchtext: " ", searchtitle: "Kayıtları bul", refreshtext: "", refreshtitle: "Tabloyu yenile", alertcap: "Uyarı", alerttext: "Lütfen bir satır seçiniz", viewtext: "", viewtitle: "Seçilen satırı görüntüle" }, col : { caption: "Sütunları göster/gizle", bSubmit: "Gönder", bCancel: "İptal" }, errors : { errcap : "Hata", nourl : "Bir url yapılandırılmamış", norecords: "İşlem yapılacak bir kayıt yok", model : "colNames uzunluğu <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts", "Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi" ], monthNames: [ "Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara", "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-tr.js
JavaScript
gpl2
4,338
;(function($){ /** * jqGrid Chinese Translation for v4.2 * henryyan 2011.11.30 * http://www.wsria.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * update 2011.11.30 * add double u3000 SPACE for search:odata to fix SEARCH box display err when narrow width from only use of eq/ne/cn/in/lt/gt operator under IE6/7 **/ $.jgrid = { defaults : { recordtext: "{0} - {1}\u3000共 {2} 条", // 共字前是全角空格 emptyrecords: "无数据显示", loadtext: "读取中...", pgtext : " {0} 共 {1} 页" }, search : { caption: "搜索...", Find: "查找", Reset: "重置", odata : ['等于\u3000\u3000', '不等\u3000\u3000', '小于\u3000\u3000', '小于等于','大于\u3000\u3000','大于等于', '开始于','不开始于','属于\u3000\u3000','不属于','结束于','不结束于','包含\u3000\u3000','不包含','空值于\u3000\u3000','非空值'], groupOps: [ { op: "AND", text: "所有" }, { op: "OR", text: "任一" } ], matchText: " 匹配", rulesText: " 规则" }, edit : { addCaption: "添加记录", editCaption: "编辑记录", bSubmit: "提交", bCancel: "取消", bClose: "关闭", saveData: "数据已改变,是否保存?", bYes : "是", bNo : "否", bExit : "取消", msg: { required:"此字段必需", number:"请输入有效数字", minValue:"输值必须大于等于 ", maxValue:"输值必须小于等于 ", email: "这不是有效的e-mail地址", integer: "请输入有效整数", date: "请输入有效时间", url: "无效网址。前缀必须为 ('http://' 或 'https://')", nodefined : " 未定义!", novalue : " 需要返回值!", customarray : "自定义函数需要返回数组!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "查看记录", bClose: "关闭" }, del : { caption: "删除", msg: "删除所选记录?", bSubmit: "删除", bCancel: "取消" }, nav : { edittext: "", edittitle: "编辑所选记录", addtext:"", addtitle: "添加新记录", deltext: "", deltitle: "删除所选记录", searchtext: "", searchtitle: "查找", refreshtext: "", refreshtitle: "刷新表格", alertcap: "注意", alerttext: "请选择记录", viewtext: "", viewtitle: "查看所选记录" }, col : { caption: "选择列", bSubmit: "确定", bCancel: "取消" }, errors : { errcap : "错误", nourl : "没有设置url", norecords: "没有要处理的记录", model : "colNames 和 colModel 长度不等!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'm-d-Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "Y/j/n", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-cn.js
JavaScript
gpl2
4,184
;(function($){ /** * jqGrid Hungarian Translation * Őrszigety Ádám udx6bs@freemail.hu * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Oldal {0} - {1} / {2}", emptyrecords: "Nincs találat", loadtext: "Betöltés...", pgtext : "Oldal {0} / {1}" }, search : { caption: "Keresés...", Find: "Keres", Reset: "Alapértelmezett", odata : ['egyenlő', 'nem egyenlő', 'kevesebb', 'kevesebb vagy egyenlő','nagyobb','nagyobb vagy egyenlő', 'ezzel kezdődik','nem ezzel kezdődik','tartalmaz','nem tartalmaz','végződik','nem végződik','tartalmaz','nem tartalmaz'], groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ], matchText: " match", rulesText: " rules" }, edit : { addCaption: "Új tétel", editCaption: "Tétel szerkesztése", bSubmit: "Mentés", bCancel: "Mégse", bClose: "Bezárás", saveData: "A tétel megváltozott! Tétel mentése?", bYes : "Igen", bNo : "Nem", bExit : "Mégse", msg: { required:"Kötelező mező", number:"Kérjük, adjon meg egy helyes számot", minValue:"Nagyobb vagy egyenlőnek kell lenni mint ", maxValue:"Kisebb vagy egyenlőnek kell lennie mint", email: "hibás emailcím", integer: "Kérjük adjon meg egy helyes egész számot", date: "Kérjük adjon meg egy helyes dátumot", url: "nem helyes cím. Előtag kötelező ('http://' vagy 'https://')", nodefined : " nem definiált!", novalue : " visszatérési érték kötelező!!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Tétel megtekintése", bClose: "Bezárás" }, del : { caption: "Törlés", msg: "Kiválaztott tétel(ek) törlése?", bSubmit: "Törlés", bCancel: "Mégse" }, nav : { edittext: "", edittitle: "Tétel szerkesztése", addtext:"", addtitle: "Új tétel hozzáadása", deltext: "", deltitle: "Tétel törlése", searchtext: "", searchtitle: "Keresés", refreshtext: "", refreshtitle: "Frissítés", alertcap: "Figyelmeztetés", alerttext: "Kérem válasszon tételt.", viewtext: "", viewtitle: "Tétel megtekintése" }, col : { caption: "Oszlopok kiválasztása", bSubmit: "Ok", bCancel: "Mégse" }, errors : { errcap : "Hiba", nourl : "Nincs URL beállítva", norecords: "Nincs feldolgozásra váró tétel", model : "colNames és colModel hossza nem egyenlő!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Va", "Hé", "Ke", "Sze", "Csü", "Pé", "Szo", "Vasárnap", "Hétfő", "Kedd", "Szerda", "Csütörtök", "Péntek", "Szombat" ], monthNames: [ "Jan", "Feb", "Már", "Ápr", "Máj", "Jún", "Júl", "Aug", "Szep", "Okt", "Nov", "Dec", "Január", "Február", "Március", "Áprili", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December" ], AmPm : ["de","du","DE","DU"], S: function (j) {return '.-ik';}, srcformat: 'Y-m-d', newformat: 'Y/m/d', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "Y/j/n", LongDate: "Y. F hó d., l", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "a g:i", LongTime: "a g:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "Y, F" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-hu.js
JavaScript
gpl2
4,102
;(function($){ /** * jqGrid Thai Translation * Kittituch Manakul m.kittituch@Gmail.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "แสดง {0} - {1} จาก {2}", emptyrecords: "ไม่พบข้อมูล", loadtext: "กำลังร้องขอข้อมูล...", pgtext : "หน้า {0} จาก {1}" }, search : { caption: "กำลังค้นหา...", Find: "ค้นหา", Reset: "คืนค่ากลับ", odata : ['เท่ากับ', 'ไม่เท่ากับ', 'น้อยกว่า', 'ไม่มากกว่า','มากกกว่า','ไม่น้อยกว่า', 'ขึ้นต้นด้วย','ไม่ขึ้นต้นด้วย','มีคำใดคำหนึ่งใน','ไม่มีคำใดคำหนึ่งใน','ลงท้ายด้วย','ไม่ลงท้ายด้วย','มีคำว่า','ไม่มีคำว่า'], groupOps: [ { op: "และ", text: "ทั้งหมด" }, { op: "หรือ", text: "ใดๆ" } ], matchText: " ตรงกันกับ", rulesText: " ตามกฏ" }, edit : { addCaption: "เพิ่มข้อมูล", editCaption: "แก้ไขข้อมูล", bSubmit: "บันทึก", bCancel: "ยกเลิก", bClose: "ปิด", saveData: "คุณต้องการบันทึการแก้ไข ใช่หรือไม่?", bYes : "บันทึก", bNo : "ละทิ้งการแก้ไข", bExit : "ยกเลิก", msg: { required:"ข้อมูลนี้จำเป็น", number:"กรุณากรอกหมายเลขให้ถูกต้อง", minValue:"ค่าของข้อมูลนี้ต้องไม่น้อยกว่า", maxValue:"ค่าของข้อมูลนี้ต้องไม่มากกว่า", email: "อีเมลล์นี้ไม่ถูกต้อง", integer: "กรุณากรอกเป็นจำนวนเต็ม", date: "กรุณากรอกวันที่ให้ถูกต้อง", url: "URL ไม่ถูกต้อง URL จำเป็นต้องขึ้นต้นด้วย 'http://' หรือ 'https://'", nodefined : "ไม่ได้ถูกกำหนดค่า!", novalue : "ต้องการการคืนค่า!", customarray : "ฟังก์ชันที่สร้างขึ้นต้องส่งค่ากลับเป็นแบบแอเรย์", customfcheck : "ระบบต้องการฟังก์ชันที่สร้างขึ้นสำหรับการตรวจสอบ!" } }, view : { caption: "เรียกดูข้อมูล", bClose: "ปิด" }, del : { caption: "ลบข้อมูล", msg: "คุณต้องการลบข้อมูลที่ถูกเลือก ใช่หรือไม่?", bSubmit: "ต้องการลบ", bCancel: "ยกเลิก" }, nav : { edittext: "", edittitle: "แก้ไขข้อมูล", addtext:"", addtitle: "เพิ่มข้อมูล", deltext: "", deltitle: "ลบข้อมูล", searchtext: "", searchtitle: "ค้นหาข้อมูล", refreshtext: "", refreshtitle: "รีเฟรช", alertcap: "คำเตือน", alerttext: "กรุณาเลือกข้อมูล", viewtext: "", viewtitle: "ดูรายละเอียดข้อมูล" }, col : { caption: "กรุณาเลือกคอลัมน์", bSubmit: "ตกลง", bCancel: "ยกเลิก" }, errors : { errcap : "เกิดความผิดพลาด", nourl : "ไม่ได้กำหนด URL", norecords: "ไม่มีข้อมูลให้ดำเนินการ", model : "จำนวนคอลัมน์ไม่เท่ากับจำนวนคอลัมน์โมเดล!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "อา", "จ", "อ", "พ", "พฤ", "ศ", "ส", "อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัสบดี", "ศูกร์", "เสาร์" ], monthNames: [ "ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค.", "มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฏาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return ''}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-th.js
JavaScript
gpl2
6,130
(function(a) { a.jgrid = { defaults: { recordtext: "regels {0} - {1} van {2}", emptyrecords: "Geen data gevonden.", loadtext: "laden...", pgtext: "pagina {0} van {1}" }, search: { caption: "Zoeken...", Find: "Zoek", Reset: "Herstellen", odata: ["gelijk aan", "niet gelijk aan", "kleiner dan", "kleiner dan of gelijk aan", "groter dan", "groter dan of gelijk aan", "begint met", "begint niet met", "is in", "is niet in", "eindigd met", "eindigd niet met", "bevat", "bevat niet"], groupOps: [{ op: "AND", text: "alle" }, { op: "OR", text: "een van de"}], matchText: " match", rulesText: " regels" }, edit: { addCaption: "Nieuw", editCaption: "Bewerken", bSubmit: "Opslaan", bCancel: "Annuleren", bClose: "Sluiten", saveData: "Er is data aangepast! Wijzigingen opslaan?", bYes: "Ja", bNo: "Nee", bExit: "Sluiten", msg: { required: "Veld is verplicht", number: "Voer a.u.b. geldig nummer in", minValue: "Waarde moet groter of gelijk zijn aan ", maxValue: "Waarde moet kleiner of gelijks zijn aan", email: "is geen geldig e-mailadres", integer: "Voer a.u.b. een geldig getal in", date: "Voer a.u.b. een geldige waarde in", url: "is geen geldige URL. Prefix is verplicht ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view: { caption: "Tonen", bClose: "Sluiten" }, del: { caption: "Verwijderen", msg: "Verwijder geselecteerde regel(s)?", bSubmit: "Verwijderen", bCancel: "Annuleren" }, nav: { edittext: "", edittitle: "Bewerken", addtext: "", addtitle: "Nieuw", deltext: "", deltitle: "Verwijderen", searchtext: "", searchtitle: "Zoeken", refreshtext: "", refreshtitle: "Vernieuwen", alertcap: "Waarschuwing", alerttext: "Selecteer a.u.b. een regel", viewtext: "", viewtitle: "Openen" }, col: { caption: "Tonen/verbergen kolommen", bSubmit: "OK", bCancel: "Annuleren" }, errors: { errcap: "Fout", nourl: "Er is geen URL gedefinieerd", norecords: "Geen data om te verwerken", model: "Lengte van 'colNames' is niet gelijk aan 'colModel'!" }, formatter: { integer: { thousandsSeparator: ".", defaultValue: "0" }, number: { decimalSeparator: ",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: "0.00" }, currency: { decimalSeparator: ",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "EUR ", suffix: "", defaultValue: "0.00" }, date: { dayNames: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za", "Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag"], monthNames: ["Jan", "Feb", "Maa", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "October", "November", "December"], AmPm: ["am", "pm", "AM", "PM"], S: function(b) { return b < 11 || b > 13 ? ["st", "nd", "rd", "th"][Math.min((b - 1) % 10, 3)] : "th" }, srcformat: "Y-m-d", newformat: "d/m/Y", masks: { ISO8601Long: "Y-m-d H:i:s", ISO8601Short: "Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l d F Y G:i:s", MonthDay: "d F", ShortTime: "G:i", LongTime: "G:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit: false }, baseLinkUrl: "", showAction: "", target: "", checkbox: { disabled: true }, idName: "id" } } })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-nl.js
JavaScript
gpl2
5,406
;(function($){ /** * jqGrid Brazilian-Portuguese Translation * Sergio Righi sergio.righi@gmail.com * http://curve.com.br * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Ver {0} - {1} of {2}", emptyrecords: "Nenhum registro para visualizar", loadtext: "Carregando...", pgtext : "Página {0} de {1}" }, search : { caption: "Procurar...", Find: "Procurar", Reset: "Resetar", odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'], groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ], matchText: " iguala", rulesText: " regras" }, edit : { addCaption: "Incluir", editCaption: "Alterar", bSubmit: "Enviar", bCancel: "Cancelar", bClose: "Fechar", saveData: "Os dados foram alterados! Salvar alterações?", bYes : "Sim", bNo : "Não", bExit : "Cancelar", msg: { required:"Campo obrigatório", number:"Por favor, informe um número válido", minValue:"valor deve ser igual ou maior que ", maxValue:"valor deve ser menor ou igual a", email: "este e-mail não é válido", integer: "Por favor, informe um valor inteiro", date: "Por favor, informe uma data válida", url: "não é uma URL válida. Prefixo obrigatório ('http://' or 'https://')", nodefined : " não está definido!", novalue : " um valor de retorno é obrigatório!", customarray : "Função customizada deve retornar um array!", customfcheck : "Função customizada deve estar presente em caso de validação customizada!" } }, view : { caption: "Ver Registro", bClose: "Fechar" }, del : { caption: "Apagar", msg: "Apagar registros selecionado(s)?", bSubmit: "Apagar", bCancel: "Cancelar" }, nav : { edittext: " ", edittitle: "Alterar registro selecionado", addtext:" ", addtitle: "Incluir novo registro", deltext: " ", deltitle: "Apagar registro selecionado", searchtext: " ", searchtitle: "Procurar registros", refreshtext: "", refreshtitle: "Recarrgando Tabela", alertcap: "Aviso", alerttext: "Por favor, selecione um registro", viewtext: "", viewtitle: "Ver linha selecionada" }, col : { caption: "Mostrar/Esconder Colunas", bSubmit: "Enviar", bCancel: "Cancelar" }, errors : { errcap : "Erro", nourl : "Nenhuma URL defenida", norecords: "Sem registros para exibir", model : "Comprimento de colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "R$ ", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb", "Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado" ], monthNames: [ "Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez", "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['º', 'º', 'º', 'º'][Math.min((j - 1) % 10, 3)] : 'º'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-pt-br.js
JavaScript
gpl2
4,390
;(function($){ /** * jqGrid Hebrew Translation * Shuki Shukrun shukrun.shuki@gmail.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "מציג {0} - {1} מתוך {2}", emptyrecords: "אין רשומות להציג", loadtext: "טוען...", pgtext : "דף {0} מתוך {1}" }, search : { caption: "מחפש...", Find: "חפש", Reset: "התחל", odata : ['שווה', 'לא שווה', 'קטן', 'קטן או שווה','גדול','גדול או שווה', 'מתחיל ב','לא מתחיל ב','נמצא ב','לא נמצא ב','מסתיים ב','לא מסתיים ב','מכיל','לא מכיל'], groupOps: [ { op: "AND", text: "הכל" }, { op: "OR", text: "אחד מ" } ], matchText: " תואם", rulesText: " חוקים" }, edit : { addCaption: "הוסף רשומה", editCaption: "ערוך רשומה", bSubmit: "שלח", bCancel: "בטל", bClose: "סגור", saveData: "נתונים השתנו! לשמור?", bYes : "כן", bNo : "לא", bExit : "בטל", msg: { required:"שדה חובה", number:"אנא, הכנס מספר תקין", minValue:"ערך צריך להיות גדול או שווה ל ", maxValue:"ערך צריך להיות קטן או שווה ל ", email: "היא לא כתובת איימל תקינה", integer: "אנא, הכנס מספר שלם", date: "אנא, הכנס תאריך תקין", url: "הכתובת אינה תקינה. דרושה תחילית ('http://' או 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "הצג רשומה", bClose: "סגור" }, del : { caption: "מחק", msg: "האם למחוק את הרשומה/ות המסומנות?", bSubmit: "מחק", bCancel: "בטל" }, nav : { edittext: "", edittitle: "ערוך שורה מסומנת", addtext:"", addtitle: "הוסף שורה חדשה", deltext: "", deltitle: "מחק שורה מסומנת", searchtext: "", searchtitle: "חפש רשומות", refreshtext: "", refreshtitle: "טען גריד מחדש", alertcap: "אזהרה", alerttext: "אנא, בחר שורה", viewtext: "", viewtitle: "הצג שורה מסומנת" }, col : { caption: "הצג/הסתר עמודות", bSubmit: "שלח", bCancel: "בטל" }, errors : { errcap : "שגיאה", nourl : "לא הוגדרה כתובת url", norecords: "אין רשומות לעבד", model : "אורך של colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "א", "ב", "ג", "ד", "ה", "ו", "ש", "ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת" ], monthNames: [ "ינו", "פבר", "מרץ", "אפר", "מאי", "יונ", "יול", "אוג", "ספט", "אוק", "נוב", "דצמ", "ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר" ], AmPm : ["לפני הצהרים","אחר הצהרים","לפני הצהרים","אחר הצהרים"], S: function (j) {return j < 11 || j > 13 ? ['', '', '', ''][Math.min((j - 1) % 10, 3)] : ''}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/js/i18n/grid.locale-he.js
JavaScript
gpl2
4,455
<?php require_once '../../../tabs.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>jqGrid PHP Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.multiselect.css" /> <style type="text"> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font-size: 75%; } </style> <script src="../../../js/jquery.js" type="text/javascript"></script> <script src="../../../js/i18n/grid.locale-en.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; </script> <script src="../../../js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="../../../js/jquery-ui-custom.min.js" type="text/javascript"></script> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery("#frozenchange").change(function(){ if( $(this).val() == "2" ) { $("#grid").jqGrid("destroyFrozenColumns") .jqGrid("setColProp","OrderID",{frozen:false}) .jqGrid("setFrozenColumns") .trigger("reloadGrid",[{current:true}]); } else if($(this).val() == "3") { $("#grid").jqGrid("destroyFrozenColumns") .jqGrid("setColProp","OrderID",{frozen:true}) .jqGrid("setFrozenColumns") .trigger("reloadGrid",[{current:true}]); } }) }); </script> </head> <body> <div> <select id="frozenchange"> <option value ="2"> Froze first two colums </option> <option value ="3"> Froze first three colums </option> </select> </div> <div> <?php include ("grid.php");?> </div> <br/> <?php tabs(array("grid.php"));?> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/frozendyn/default.php
PHP
gpl2
2,190
<?php require_once '../../../jq-config.php'; // include the jqGrid Class require_once ABSPATH."php/jqGrid.php"; // include the driver class require_once ABSPATH."php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = 'SELECT CustomerID, ShipName, OrderID, OrderDate, Freight, ShipAddress, ShipCity FROM orders'; // Set output format to json $grid->dataType = 'json'; // Let the grid create the model $grid->setColModel(); $grid->setPrimaryKeyId('OrderID'); // Set the url from where we obtain the data $grid->setUrl('grid.php'); // Set some grid options $grid->setGridOptions(array( "rowNum"=>10, "rowList"=>array(10,20,30), "sortname"=>"OrderID", "shrinkToFit"=>false, "width"=>600, "rownumbers"=>true )); // set frozen property $grid->setColProperty("CustomerID", array( "frozen"=>true, "width"=>100 ) ); $grid->setColProperty("ShipName", array( "width"=>150, "frozen"=>true ) ); // Change some property of the field(s) $grid->setColProperty("OrderDate", array( "formatter"=>"date", "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"m/d/Y"), "search"=>false ) ); // Enable navigator $grid->navigator = true; // Enable excel export $grid->setNavOptions('navigator', array("excel"=>false,"add"=>false,"edit"=>false,"del"=>false,"view"=>false)); // // Call the frozen cols method $grid->callGridMethod('#grid', 'setFrozenColumns'); // Enjoy $grid->renderGrid('#grid','#pager',true, $summaryrows, null, true,true); $conn = null; ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/frozendyn/grid.php
PHP
gpl2
1,703
<?php require_once '../../../tabs.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>jqGrid PHP Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.multiselect.css" /> <style type="text"> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font-size: 75%; } </style> <script src="../../../js/jquery.js" type="text/javascript"></script> <script src="../../../js/i18n/grid.locale-en.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; </script> <script src="../../../js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="../../../js/jquery-ui-custom.min.js" type="text/javascript"></script> </head> <body> <div> <?php include ("grid.php");?> </div> <br/> <?php tabs(array("grid.php"));?> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/footer/default.php
PHP
gpl2
1,415
<?php require_once '../../../jq-config.php'; // include the jqGrid Class require_once ABSPATH."php/jqGrid.php"; // include the driver class require_once ABSPATH."php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = 'SELECT OrderID, RequiredDate, ShipName, ShipCity, Freight FROM orders'; // set the ouput format to json $grid->dataType = 'json'; // Let the grid create the model $grid->setColModel(); // Set the url from where we obtain the data $grid->setUrl('grid.php'); // Set some grid options $grid->setGridOptions(array("rowNum"=>10,"rowList"=>array(10,20,130),"sortname"=>"OrderID")); // Enable footerdata an tell the grid to obtain it from the request $grid->setGridOptions(array("footerrow"=>true,"userDataOnFooter"=>true)); // Change some property of the field(s) $grid->setColProperty("RequiredDate", array("formatter"=>"date","formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"m/d/Y"))); // At end call footerData to put total label $grid->callGridMethod('#grid', 'footerData', array("set",array("ShipCity"=>"Total:"))); // Set which parameter to be sumarized $summaryrows = array("Freight"=>array("Freight"=>"SUM")); $grid->renderGrid('#grid','#pager',true,$summaryrows , null, true,true); $conn = null; ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/footer/grid.php
PHP
gpl2
1,449
<?php require_once '../../../tabs.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>jqGrid PHP Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.multiselect.css" /> <style type="text"> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font-size: 75%; } </style> <script src="../../../js/jquery.js" type="text/javascript"></script> <script src="../../../js/i18n/grid.locale-en.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; </script> <script src="../../../js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="../../../js/jquery-ui-custom.min.js" type="text/javascript"></script> </head> <body> <div> <?php include ("grid.php");?> </div> <br/> <?php tabs(array("grid.php"));?> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/keynav/default.php
PHP
gpl2
1,415
<?php require_once '../../../jq-config.php'; // include the jqGrid Class require_once ABSPATH."php/jqGrid.php"; // include the driver class require_once ABSPATH."php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = 'SELECT OrderID, OrderDate, CustomerID, ShipName, Freight FROM orders'; // Set output format to json $grid->dataType = 'json'; // Let the grid create the model $grid->setColModel(); // Set the url from where we obtain the data $grid->setUrl('grid.php'); // Set some grid options $grid->setGridOptions(array( "rowNum"=>10, "rowList"=>array(10,20,30), "sortname"=>"OrderID", "userDataOnFooter"=>true, "footerrow"=>true )); // Change some property of the field(s) $grid->setColProperty("OrderDate", array( "formatter"=>"date", "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"m/d/Y"), "search"=>false ) ); $grid->setColProperty("ShipName", array("width"=>"200")); // Enable navigator $grid->navigator = true; // Enable excel export $grid->setNavOptions('navigator', array("excel"=>false,"add"=>false,"edit"=>false,"del"=>false,"view"=>false)); // Enjoy // Set summary field $summaryrows=array("Freight"=>array("Freight"=>"SUM")); // and finaly bind key navigation // This is way if no events or parameter //$grid->callGridMethod('#grid', 'bindKeys'); // //in case of passing events is better this way $bindkeys =<<<KEYS $("#grid").jqGrid('bindKeys', {"onEnter":function( rowid ) { alert("You enter a row with id:"+rowid)} } ); KEYS; $grid->setJSCode($bindkeys); $grid->renderGrid('#grid','#pager',true, $summaryrows, null, true,true); $conn = null; ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/keynav/grid.php
PHP
gpl2
1,827
<?php require_once '../../../tabs.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>jqGrid PHP Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.multiselect.css" /> <style type="text"> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font-size: 75%; } </style> <script src="../../../js/jquery.js" type="text/javascript"></script> <script src="../../../js/i18n/grid.locale-en.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; </script> <script src="../../../js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="../../../js/jquery-ui-custom.min.js" type="text/javascript"></script> </head> <body> <div> <?php include ("grid.php");?> </div> <br/> <?php tabs(array("grid.php"));?> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/colmodeltmpl/default.php
PHP
gpl2
1,415
<?php require_once '../../../jq-config.php'; // include the jqGrid Class require_once ABSPATH."php/jqGrid.php"; // include the driver class require_once ABSPATH."php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = 'SELECT OrderID, OrderDate, CustomerID, ShipName, Freight FROM orders'; // Set output format to json $grid->dataType = 'json'; // Let the grid create the model $grid->setColModel(); // Set the url from where we obtain the data $grid->setUrl('grid.php'); // Set some grid options $grid->setGridOptions(array( "rowNum"=>10, "rowList"=>array(10,20,30), "sortname"=>"OrderID", "userDataOnFooter"=>true, "footerrow"=>true, // define a model where all fields are not sortable, // this setting overwrite the deafult one for all fields "cmTemplate"=>array("sortable"=>false) )); // Change some property of the field(s) $grid->setColProperty("OrderDate", array( "formatter"=>"date", "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"m/d/Y"), "search"=>false ) ); $grid->setColProperty("ShipName", array("width"=>"200")); // Enable navigator $grid->navigator = true; // Enable excel export $grid->setNavOptions('navigator', array("excel"=>false,"add"=>false,"edit"=>false,"del"=>false,"view"=>false)); // Enjoy // Set summary field $summaryrows=array("Freight"=>array("Freight"=>"SUM")); $grid->renderGrid('#grid','#pager',true, $summaryrows, null, true,true); $conn = null; ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/colmodeltmpl/grid.php
PHP
gpl2
1,647
<?php require_once '../../../tabs.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>jqGrid PHP Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.multiselect.css" /> <style type="text"> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font-size: 75%; } </style> <script src="../../../js/jquery.js" type="text/javascript"></script> <script src="../../../js/i18n/grid.locale-en.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; </script> <script src="../../../js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="../../../js/jquery-ui-custom.min.js" type="text/javascript"></script> </head> <body> <div> <?php include ("grid.php");?> </div> <br/> <?php tabs(array("grid.php"));?> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/righttoleft/default.php
PHP
gpl2
1,415
<?php require_once '../../../jq-config.php'; // include the jqGrid Class require_once ABSPATH."php/jqGrid.php"; // include the driver class require_once ABSPATH."php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = 'SELECT OrderID, OrderDate, CustomerID, Freight, ShipName FROM orders'; // Set output format to json $grid->dataType = 'json'; // Let the grid create the model $grid->setColModel(); // Set the url from where we obtain the data $grid->setUrl('grid.php'); // Set the grid to construct the RTL direction $grid->setGridOptions(array( "direction"=>"rtl", "recordpos"=>"left", "rowNum"=>10, "rowList"=>array(10,20,30), "sortname"=>"OrderID" )); // Change some property of the field(s) $grid->setColProperty("OrderDate", array( "formatter"=>"date", "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"m/d/Y"), "search"=>false ) ); // Enable navigator $grid->navigator = true; $grid->setNavOptions('navigator', array("position"=>"right","add"=>false,"edit"=>false,"del"=>false,"view"=>false,"excel"=>false)); // Enjoy $grid->renderGrid('#grid','#pager',true, null, null, true,true); $conn = null; ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/righttoleft/grid.php
PHP
gpl2
1,370
<?php require_once '../../../tabs.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>jqGrid PHP Demo</title> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.multiselect.css" /> <style type="text"> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font-size: 75%; } </style> <script src="../../../js/jquery.js" type="text/javascript"></script> <script src="../../../js/i18n/grid.locale-en.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; </script> <script src="../../../js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="../../../js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script> </head> <body> <div> <?php include ("grid.php");?> </div> <br/> <?php tabs(array("grid.php"));?> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/datacolspan/default.php
PHP
gpl2
1,346
<?php require_once '../../../jq-config.php'; // include the jqGrid Class require_once ABSPATH."php/jqGrid.php"; // include the driver class require_once ABSPATH."php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = 'SELECT EmployeeID, TitleOfCourtesy, LastName, FirstName, BirthDate, City, Region FROM employees'; // Set the table to where you add the data $grid->table = 'employees'; // Set output format to json $grid->dataType = 'json'; //$grid->usertimeformat = "d/m/Y"; // Let the grid create the model $grid->setColModel(); // Set the url from where we obtain the data $grid->setUrl('grid.php'); // add a action column and instruct the formatter to create the needed butons // for inline editing $grid->setColProperty('EmployeeID', array("editable"=>false, "width"=>50, "label"=>"ID")); $grid->setColProperty('TitleOfCourtesy', array("hidden"=>true)); $grid->setColProperty('LastName', array( "cellattr"=>"js:function( rowId, value, rowObject, colModel, arrData){ return ' colspan=2'}", "formatter"=>"js:function(value, options, rData){ return rData['TitleOfCourtesy'] + ' ' + value +', '+ rData['FirstName'];}" )); $grid->setColProperty('FirstName', array( "cellattr"=>"js:function( rowId, value, rowObject, colModel, arrData){ return ' style=\"display:none\"'}" )); $grid->setColProperty('BirthDate', array("formatter"=>"date", "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s", "newformat"=>"m/d/Y h:i A"), // Ok. We use some trick here to create the datepicer on dataInit event // when the element is created. Note the js: before the function. // this instruct the grid to put a javascript code without additional formating "editoptions"=>array("dataInit"=> "js:function(elm){setTimeout(function(){ jQuery(elm).datepicker({dateFormat: 'm/d/yy',timeFormat: 'hh:mm TT',separator: ' ' ,ampm: true}); jQuery('.ui-datepicker').css({'font-size':'75%'}); },200);}") )); // Set some grid options $grid->setGridOptions(array( "rowNum"=>10, "rowList"=>array(10,20,30), "sortname"=>"EmployeeID" )); // Enjoy $grid->renderGrid('#grid','#pager',true, null, null, true,true); $conn = null; ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/datacolspan/grid.php
PHP
gpl2
2,436
<?php require_once '../../../tabs.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>jqGrid PHP Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.multiselect.css" /> <style type="text"> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font-size: 75%; } </style> <script src="../../../js/jquery.js" type="text/javascript"></script> <script src="../../../js/i18n/grid.locale-en.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; </script> <script src="../../../js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="../../../js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script> </head> <body> <div> <?php include ("grid.php");?> </div> <br/> <?php tabs(array("grid.php"));?> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/excel/default.php
PHP
gpl2
1,421
<?php require_once '../../../jq-config.php'; // include the jqGrid Class require_once ABSPATH."php/jqGrid.php"; // include the driver class require_once ABSPATH."php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = 'SELECT OrderID, OrderDate, CustomerID, ShipName, Freight FROM orders'; // Set output format to json $grid->dataType = 'json'; // Let the grid create the model $grid->setColModel(); // Set the url from where we obtain the data $grid->setUrl('grid.php'); // Set some grid options $grid->setGridOptions(array( "rowNum"=>10, "rowList"=>array(10,20,30), "sortname"=>"OrderID" )); // Change some property of the field(s) $grid->setColProperty("OrderDate", array( "formatter"=>"date", "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"m/d/Y"), "search"=>false ) ); $grid->setColProperty("ShipName", array("width"=>"200")); // Enable navigator $grid->navigator = true; // Enable excel export $grid->setNavOptions('navigator', array("excel"=>true,"add"=>false,"edit"=>false,"del"=>false,"view"=>false)); // Enjoy // Set summary field $summaryrows=array("Freight"=>array("Freight"=>"SUM")); $grid->renderGrid('#grid','#pager',true, $summaryrows, null, true,true); $conn = null; ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/excel/grid.php
PHP
gpl2
1,444
<?php require_once '../../../tabs.php'; if(isset ($_COOKIE["jqglang"])) { $lang = $_COOKIE["jqglang"]; } else { $lang = "en"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>jqGrid PHP Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.multiselect.css" /> <style type="text"> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font-size: 75%; } </style> <script src="../../../js/jquery.js" type="text/javascript"></script> <script src="../../../js/jquery.cookie.js" type="text/javascript"></script> <script src="../../../js/i18n/grid.locale-<?php echo $lang;?>.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; </script> <script src="../../../js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="../../../js/jquery-ui-custom.min.js" type="text/javascript"></script> <script type="text/javascript"> jQuery(document).ready(function(){ var lng = '<?php echo $lang;?>'; $("#lang").val(lng).change(function(){ var lng = $(this).val(); if(lng) { jQuery.cookie('jqglang',lng); window.location.reload(); } }); }); </script> </head> <body> <div style="margin-bottom: 10px"> Select Language : <select id="lang"> <option value="bg">Bulgarian</option> <option value="en">English</option> <option value="cat">Catalan</option> <option value="cn">Chinese</option> <option value="cs">Czech</option> <option value="de">German</option> <option value="dk">Danish</option> <option value="el">Greek</option> <option value="fa">Persian</option> <option value="fi">Finnish</option> <option value="fr">French</option> <option value="he">Hebrew</option> <option value="is">Icelandic</option> <option value="it">Italian</option> <option value="it">Japanese</option> <option value="nl">Holland</option> <option value="nl">Norwegian</option> <option value="nl">Polish</option> <option value="pt">Portuguese</option> <option value="pt-br">Brazilian-Portuguese</option> <option value="ro">Romanian</option> <option value="ru">Russian</option> <option value="sp">Spanish</option> <option value="sv">Swedish</option> <option value="tr">Turkish</option> <option value="ua">Ukrainian</option> </select> </div> <div> <?php include ("grid.php");?> </div> <br/> <?php tabs(array("grid.php"));?> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/localization/default.php
PHP
gpl2
3,341
<?php require_once '../../../jq-config.php'; // include the jqGrid Class require_once ABSPATH."php/jqGrid.php"; // include the driver class require_once ABSPATH."php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = 'SELECT CustomerID, CompanyName, Phone, PostalCode, City FROM customers'; // set the ouput format to json $grid->dataType = 'json'; // Let the grid create the model $grid->setColModel(); // Set the url from where we obtain the data $grid->setUrl('grid.php'); // Set some grid options $grid->setGridOptions(array("rowNum"=>10,"rowList"=>array(10,20,30),"sortname"=>"CustomerID","height"=>150)); // Enable navigator searching $grid->navigator = true; // Set which buttons should be visible $grid->setNavOptions('navigator',array("add"=>false,"edit"=>false,"del"=>false,"view"=>false,"excel"=>false)); // Enjoy $grid->renderGrid('#grid','#pager',true, null, null, true,true); $conn = null; ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/localization/grid.php
PHP
gpl2
1,121
<?php require_once '../../../tabs.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>jqGrid PHP Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.multiselect.css" /> <style type="text"> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font-size: 75%; } </style> <script src="../../../js/jquery.js" type="text/javascript"></script> <script src="../../../js/i18n/grid.locale-en.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; </script> <script src="../../../js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="../../../js/jquery-ui-custom.min.js" type="text/javascript"></script> </head> <body> <div> <?php include ("grid.php");?> </div> <br/> <?php tabs(array("grid.php"));?> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/column_reorder_resize/default.php
PHP
gpl2
1,415
<?php require_once '../../../jq-config.php'; // include the jqGrid Class require_once ABSPATH."php/jqGrid.php"; // include the driver class require_once ABSPATH."php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = 'SELECT OrderID, OrderDate, CustomerID, Freight, ShipName FROM orders'; // Set output format to json $grid->dataType = 'json'; // Let the grid create the model $grid->setColModel(); // Set the url from where we obtain the data $grid->setUrl('grid.php'); // Set the column reordering by setting sortable option to true $grid->setGridOptions(array( "sortable"=>true, "rownumbers"=>true, "rowNum"=>10, "rowList"=>array(10,20,30), "sortname"=>"OrderID" )); // Change the order date to be not resizable $grid->setColProperty("OrderDate", array( "resizable"=>false, "formatter"=>"date", "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"m/d/Y"), "search"=>false ) ); // Enjoy $grid->renderGrid('#grid','#pager',true, null, null, true,true); $conn = null; ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/column_reorder_resize/grid.php
PHP
gpl2
1,236
<?php require_once '../../../tabs.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>jqGrid PHP Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.multiselect.css" /> <style type="text"> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font-size: 75%; } </style> <script src="../../../js/jquery.js" type="text/javascript"></script> <script src="../../../js/i18n/grid.locale-en.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; </script> <script src="../../../js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="../../../js/jquery-ui-custom.min.js" type="text/javascript"></script> </head> <body> <div> <?php include ("grid.php");?> </div> <br/> <?php tabs(array("grid.php"));?> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/formatters/default.php
PHP
gpl2
1,415
<?php require_once '../../../jq-config.php'; // include the jqGrid Class require_once ABSPATH."php/jqGrid.php"; // Create the jqGrid instance $grid = new jqGridRender(); // Lets create the model manually $Model = array( array("name"=>"Integer","width"=>80, "formatter"=>"integer", "formatoptions"=>array("thousandsSeparator"=>","), "sorttype"=>"integer"), array("name"=>"Number","width"=>80, "formatter"=>"number", "formatoptions"=>array("decimalPlaces"=>1), "sorttype"=>"number"), array("name"=>"Currency","width"=>80, "formatter"=>"currency", "formatoptions"=>array("decimalPlaces"=>1,"thousandsSeparator"=>",","prefix"=>"$","suffix"=>" USD"), "sorttype"=>"currency"), array("name"=>"Email","width"=>120,"formatter"=>"email"), array("name"=>"Link","width"=>120,"formatter"=>"link"), array("name"=>"Checkbox","width"=>50,"formatter"=>"checkbox") ); // Let the grid create the model $grid->setColModel($Model); // Set grid option datatype to be local $grid->setGridOptions(array("datatype"=>"local")); //We can add data manually using arrays $data = array( array("Integer"=>200000,"Number"=>60000000.73,"Currency"=>34.2,"Email"=>"john.smith@yahoo.com","Link"=>"http://www.yahoo.com","Checkbox"=>"Yes"), array("Integer"=>1600000,"Number"=>75200000.23,"Currency"=>245.2,"Email"=>"joe.woe@google.com","Link"=>"http://www.google.com","Checkbox"=>"Yes"), array("Integer"=>652693,"Number"=>34534000.33,"Currency"=>18545.2,"Email"=>"julia.bergman@bing.com","Link"=>"http://www.bing.com","Checkbox"=>"No"), array("Integer"=>1237,"Number"=>3450.30,"Currency"=>55597545.2,"Email"=>"roy.corner@msn.com","Link"=>"http://www.msn.com","Checkbox"=>"No") ); // Let put it using the callGridMethod $grid->callGridMethod("#grid", 'addRowData', array("Integer",$data)); $grid->renderGrid('#grid','#pager',true, null, null, true,true); ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/formatters/grid.php
PHP
gpl2
1,900
<?php require_once '../../../tabs.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>jqGrid PHP Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.multiselect.css" /> <style type="text"> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font-size: 75%; } </style> <script src="../../../js/jquery.js" type="text/javascript"></script> <script src="../../../js/i18n/grid.locale-en.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; </script> <script src="../../../js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="../../../js/jquery-ui-custom.min.js" type="text/javascript"></script> </head> <body> <div> <?php include ("grid.php");?> </div> <br/> <?php tabs(array("grid.php"));?> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jqSuitePHP_4_3_2_0/examples/functionality/custom_button/default.php
PHP
gpl2
1,415