Commit 02195eec authored by Gabriel Monnerat's avatar Gabriel Monnerat

- remove jquery sheet plugin because now it is a bt5.

- fix paths to jquery sheet plugin

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40195 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 08458187
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="DTMLMethod" module="OFS.DTMLMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>jquery.sheet.css</string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string>/* Controls styling */\r\n
.jSheetControls_loc, .jSheetControls_fx\r\n
{\r\n
\tborder-width: 0px ! important;\r\n
\tbackground: none ! important;\r\n
}\r\n
\r\n
.jSheetControls_formula\r\n
{\r\n
\twidth: 99%;\r\n
height: 17px;\r\n
}\r\n
\r\n
.jSheetLog\r\n
{\r\n
\theight: 100px;\r\n
\twidth: 100%;\r\n
\toverflow-y: scroll;\r\n
\tposition: relative;\r\n
}\r\n
\r\n
.jSheetControls, .jSheetControls table\r\n
{\r\n
\tpadding: 0px ! important;\r\n
\tborder: none ! important;\r\n
\twidth: 100%; \r\n
\tmargin: 0px; \r\n
}\r\n
\r\n
.jSheetMenu\r\n
{\r\n
\tcursor: pointer;\r\n
\tbackground-color: transparent ! important;\r\n
\tpadding: 0px ! important;\r\n
\tmargin: 0px ! important;\r\n
\tborder: none ! important;\r\n
}\r\n
\r\n
.jSheetMenu *\r\n
{\r\n
\tcolor: inherit ! important;\r\n
\tbackground-color: inherit ! important;\r\n
}\r\n
.menu\r\n
{\r\n
\tdisplay: none;\r\n
}\r\n
#titleHolder\r\n
{\r\n
\tpadding-left: 10px;\r\n
}\r\n
.jSheetUI\r\n
{\r\n
\twidth: inherit ! important;\r\n
\tborder-color: inherit ! important;\r\n
}\r\n
.jSheetTabContainer\r\n
{\r\n
\tvertical-align: bottom;\r\n
\ttext-align: left ! important;\r\n
}\r\n
.jSheetTabContainer span\r\n
{\r\n
\t\r\n
\tpadding: 2px 5px 0 5px ! important;\r\n
\tcursor: pointer;\r\n
}\r\n
.jSheetTabContainer *, .menuDiv *\r\n
{\r\n
\tfont-size: 1em ! important;\r\n
}\r\n
\r\n
.tableControl\r\n
{\r\n
\tborder-collapse: collapse ! important;\r\n
\tborder: none ! important;\r\n
\tmargin: none ! important;\r\n
\tpadding: none ! important;\r\n
\tposition: absolute ! important;\r\n
}\r\n
\r\n
/* Sheet styling */\r\n
.jSheet\r\n
{\r\n
\tposition: relative ! important;\r\n
\tmargin-top: -1px ! important;\r\n
\tmargin-left: -1px ! important;\r\n
table-layout: fixed;\r\n
empty-cells: show;\r\n
\tbackground-image: none ! important;\r\n
\tfont-family: arial, serif;\r\n
\toverflow: hidden;\r\n
\theight: auto ! important;\r\n
\tborder-spacing: 0px ! important;\r\n
\tborder-width: 1px ! important;\r\n
\tmargin-bottom: 20px ! important;\r\n
}\r\n
.jSheet tbody\r\n
{\r\n
\tbackground-color: transparent;\r\n
\tcolor: inherit ! important;\r\n
\tborder-color: inherit ! important;\r\n
}\r\n
\r\n
.jSheet tr {\r\n
\tborder-color: inherit ! important;\r\n
\tpadding: 0px ! important;\r\n
\tborder-style: solid ! important;\r\n
\tbackground-color: transparent;\r\n
\t-moz-border-radius: 0px 0px 0px 0px;\r\n
\tcolor: inherit ! important;\r\n
\tborder-width: 0px ! important;\r\n
}\r\n
.jSheet td {\r\n
\tborder-width: 1px ! important;\r\n
\tborder-color: inherit;\r\n
\tpadding: 0px ! important;\r\n
\tborder-style: solid ! important;\r\n
\t-moz-border-radius: 0px 0px 0px 0px;\r\n
\toverflow: hidden ! important;\r\n
text-overflow: ellipsis ! important;\r\n
white-space: nowrap ! important;\r\n
\tmargin: 0px ! important;\r\n
\tpadding: 0px ! important;\r\n
\tfont-size: 1em ! important;\r\n
\theight: inherit ! important;\r\n
\tcolor: inherit;\r\n
\tposition: relative;\r\n
\tmin-width: 25px ! important;\r\n
}\r\n
\r\n
.jSheet colgroup col\r\n
{\r\n
\tborder: none ! important;\r\n
}\r\n
\r\n
/* Containers styleing*/\r\n
.jSheetBarCorner\r\n
{\r\n
\tcursor: pointer;\r\n
\tborder-width: 1px ! important;\r\n
}\r\n
\r\n
.jSheetBarCornerParent\r\n
{\r\n
\tborder: none ! important;\r\n
}\r\n
\r\n
.jSheetBarTopParent\r\n
{\r\n
position: relative ! important;\r\n
\tbackground-image: none ! important;\r\n
\tvertical-align: middle;\r\n
\toverflow: hidden ! important;\r\n
\tcursor: pointer;\r\n
\toverflow: hidden ! important;\r\n
}\r\n
\r\n
.jSheetBarLeftParent\r\n
{\r\n
position: relative ! important;\r\n
\tbackground-image: none ! important;\r\n
\tvertical-align: middle;\r\n
\toverflow: hidden ! important;\r\n
\tcursor: pointer;\r\n
\toverflow: hidden ! important;\r\n
}\r\n
\r\n
.jSheetEditPane\r\n
{\r\n
overflow: auto ! important;\r\n
\tbackground-image: none ! important;\r\n
\tborder-width: 0px;\r\n
\tposition: relative ! important;\r\n
}\r\n
/* Bar item styling */\r\n
\r\n
.jSheetBarTop\r\n
{\r\n
position: relative ! important;\r\n
\tborder-width: 0px ! important;\r\n
\tmin-width: 100000px;\r\n
}\r\n
\r\n
.jSheetBarLeft\r\n
{\r\n
\tposition: relative ! important;\r\n
\tborder-width: 0px ! important;\r\n
\tmin-height: 100000px;\r\n
}\r\n
.jSheetBarLeft div\r\n
{\r\n
\ttext-align: center;\r\n
\tfont-size: .8em;\r\n
\theight: inherit;\r\n
\tborder-left: none ! important;\r\n
\tborder-right: none ! important;\r\n
\tposition: relative ! important;\r\n
\tvertical-align: middle ! important;\r\n
\tmin-width: 14px ! important;\r\n
}\r\n
.jSheetBarTop div\r\n
{\r\n
\ttext-align: center ! important;\r\n
\tfont-size: .8em;\r\n
\tfloat: left;\r\n
\tdisplay:block;\r\n
\theight: inherit ! important;\r\n
\tpadding-top: 2px;\r\n
\toverflow: hidden;\r\n
\tborder-top: none ! important;\r\n
\tborder-bottom: none ! important;\r\n
\tmin-width: 25px ! important;\r\n
}\r\n
\r\n
.jSheetControls img\r\n
{\r\n
\tborder: none;\r\n
}\r\n
\r\n
.safeImg\r\n
{\r\n
\tdisplay: inline;\r\n
}\r\n
\r\n
.jSheetInPlaceEdit\r\n
{\r\n
\tposition: absolute;\r\n
}\r\n
\r\n
.colorPickers *\r\n
{\r\n
\tdisplay: inline-block;\r\n
\twidth: 16px ! important;\r\n
\theight: 16px ! important;\r\n
\tbackground-color: transparent ! important;\r\n
}\r\n
\r\n
.jSheetFullScreen\r\n
{\r\n
\ttop: 5px;\r\n
\tleft: 5px;\r\n
\tposition: fixed;\r\n
\ttop: expression(eval(document.body.scrollTop + 15) + "px");\r\n
\tleft: expression(eval(document.body.scrollLeft) + "px");\r\n
}\r\n
\r\n
.jSheetFullScreenTabContainer\r\n
{\r\n
\tbottom: 10px;\r\n
\tleft: 10px;\r\n
\tposition: fixed;\r\n
\ttop: expression(eval(document.body.scrollTop + 15) + "px");\r\n
\tleft: expression(eval(document.body.scrollLeft) + "px");\r\n
}\r\n
\r\n
/* Cell styler classes */\r\n
.styleBold\r\n
{ font-weight: bold; }\r\n
.styleItalics\t\r\n
{ font-style: italic; }\r\n
.styleUnderline\t\r\n
{ text-decoration: underline; }\r\n
.styleLineThrough\r\n
{ text-decoration: line-through;}\r\n
.styleLeft\t\t\r\n
{ text-align: left; }\r\n
.styleRight\t\t\r\n
{ text-align: right; }\r\n
.styleCenter\t\r\n
{ text-align: center; }\r\n
.styleTop\t\t\r\n
{ vertical-align: top; }\r\n
.styleMiddle\t\r\n
{ vertical-align: middle; }\r\n
.styleBottom\t\r\n
{ vertical-align: bottom; }\r\n
.styleUpper \t\t\r\n
{ text-transform: uppercase; }\r\n
.styleCapital \t\r\n
{ text-transform: capitalize; }\r\n
.styleLower \t\t\r\n
{ text-transform: lowercase; }\r\n
.styleHidden \t\r\n
{ display: none; }\r\n
.styleWrap\r\n
{ word-wrap: break-word; }</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -42,10 +42,10 @@
// submitAction function may have changed the action before, it\'s better to\n
// reset the form action to it\'s original behaviour. This is actually\n
// usefull when the user click the back button.\n
function clickSaveButton(act) {\n
function clickSaveButton(act){\n
changed = false;\n
document.forms[0].action = act;\n
// Here we should use \n
// Here we should use\n
document.forms[0].elements[\'field_my_text_content\'].value = $.sheet.instance[0].getSource(true);\n
} \n
\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts79960941.53</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>jquery.sheet.min.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/x-javascript</string> </value>
</item>
<item>
<key> <string>data</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>77769</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Pdata" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value> <string>/*\r\n
jQuery.sheet() Spreadsheet with Calculations Plugin\r\n
Version: 1.1.0\r\n
http://code.google.com/p/jquerysheet/\r\n
\t\t\r\n
Copyright (C) 2010 Robert Plummer\r\n
Dual licensed under the LGPL v2 and GPL v2 licenses.\r\n
http://www.gnu.org/licenses/\r\n
*/\r\n
jQuery.fn.extend({sheet:function(a){a=jQuery.extend({urlGet:"sheets/enduser.documentation.html",urlSave:"save.html",editable:true,allowToggleState:true,urlMenu:"menu.html",newColumnWidth:120,title:null,inlineMenu:null,buildSheet:false,calcOff:false,log:false,lockFormulas:false,parent:jQuery(this),colMargin:18,fnBefore:function(){},fnAfter:function(){},fnSave:function(){jS.saveSheet()},fnOpen:function(){var c=prompt("Paste your table html here");if(c){jS.openSheet(c)}},fnClose:function(){},fnAfterCellEdit:function(){},joinedResizing:false,boxModelCorrection:2,showErrors:true,calculations:{},cellSelectModel:"excel",autoAddCells:true,caseInsensitive:false},a);var b=a.parent;if(jQuery.sheet.instance){b.sheetInstance=jQuery.sheet.createInstance(a,jQuery.sheet.instance.length,b);jQuery.sheet.instance.push(b.sheetInstance)}else{b.sheetInstance=jQuery.sheet.createInstance(a,0,b);jQuery.sheet.instance=[b.sheetInstance]}return b}});jQuery.sheet={createInstance:function(s,I,origParent){var jS={version:"1.1.0",i:0,I:I,sheetCount:0,s:{},obj:{barCorner:function(){return jQuery("#"+jS.id.barCorner+jS.i)},barCornerAll:function(){return s.parent.find("div."+jS.cl.barCorner)},barCornerParent:function(){return jQuery("#"+jS.id.barCornerParent+jS.i)},barCornerParentAll:function(){return s.parent.find("td."+jS.cl.barCornerParent)},barTop:function(){return jQuery("#"+jS.id.barTop+jS.i)},barTopAll:function(){return s.parent.find("div."+jS.cl.barTop)},barTopParent:function(){return jQuery("#"+jS.id.barTopParent+jS.i)},barTopParentAll:function(){return s.parent.find("div."+jS.cl.barTopParent)},barLeft:function(){return jQuery("#"+jS.id.barLeft+jS.i)},barLeftAll:function(){return s.parent.find("div."+jS.cl.barLeft)},barLeftParent:function(){return jQuery("#"+jS.id.barLeftParent+jS.i)},barLeftParentAll:function(){return s.parent.find("div."+jS.cl.barLeftParent)},cellActive:function(){return jQuery(jS.cellLast.td)},cellHighlighted:function(){return jQuery(jS.highlightedLast.td)},controls:function(){return jQuery("#"+jS.id.controls)},formula:function(){return jQuery("#"+jS.id.formula)},fullScreen:function(){return jQuery("div."+jS.cl.fullScreen)},inPlaceEdit:function(){return jQuery("#"+jS.id.inPlaceEdit)},label:function(){return jQuery("#"+jS.id.label)},log:function(){return jQuery("#"+jS.id.log)},menu:function(){return jQuery("#"+jS.id.menu)},pane:function(){return jQuery("#"+jS.id.pane+jS.i)},paneAll:function(){return s.parent.find("div."+jS.cl.pane)},parent:function(){return s.parent},sheet:function(){return jQuery("#"+jS.id.sheet+jS.i)},sheetAll:function(){return s.parent.find("table."+jS.cl.sheet)},tab:function(){return jQuery("#"+jS.id.tab+jS.i)},tabAll:function(){return this.tabContainer().find("a."+jS.cl.tab)},tabContainer:function(){return jQuery("#"+jS.id.tabContainer)},tableBody:function(){return document.getElementById(jS.id.sheet+jS.i)},tableControl:function(){return jQuery("#"+jS.id.tableControl+jS.i)},tableControlAll:function(){return s.parent.find("table."+jS.cl.tableControl)},ui:function(){return jQuery("#"+jS.id.ui)},uiActive:function(){return s.parent.find("div."+jS.cl.uiActive)}},id:{barCorner:"jSheetBarCorner_"+I+"_",barCornerParent:"jSheetBarCornerParent_"+I+"_",barTop:"jSheetBarTop_"+I+"_",barTopParent:"jSheetBarTopParent_"+I+"_",barLeft:"jSheetBarLeft_"+I+"_",barLeftParent:"jSheetBarLeftParent_"+I+"_",controls:"jSheetControls_"+I,formula:"jSheetControls_formula_"+I,inPlaceEdit:"jSheetInPlaceEdit_"+I,label:"jSheetControls_loc_"+I,log:"jSheetLog_"+I,menu:"jSheetMenu_"+I,pane:"jSheetEditPane_"+I+"_",sheet:"jSheet_"+I+"_",tableControl:"tableControl_"+I+"_",tab:"jSheetTab_"+I,tabContainer:"jSheetTabContainer_"+I+"_",ui:"jSheetUI_"+I},cl:{barCorner:"jSheetBarCorner",barCornerParent:"jSheetBarCornerParent",barLeftTd:"barLeft",barLeft:"jSheetBarLeft",barLeftParent:"jSheetBarLeftParent",barTop:"jSheetBarTop",barTopParent:"jSheetBarTopParent",barTopTd:"barTop",cellActive:"jSheetCellActive",cellHighlighted:"jSheetCellHighighted",controls:"jSheetControls",formula:"jSheetControls_formula",fullScreen:"jSheetFullScreen",inPlaceEdit:"jSheetInPlaceEdit",menu:"jSheetMenu",sheet:"jSheet",sheetPaneTd:"sheetPane",label:"jSheetControls_loc",log:"jSheetLog",pane:"jSheetEditPane",tab:"jSheetTab",tabContainer:"jSheetTabContainer",tabContainerFullScreen:"jSheetFullScreenTabContainer",tableControl:"tableControl",toggle:"cellStyleToggle",ui:"jSheetUI",uiActive:"ui-state-active",uiBar:"ui-widget-header",uiCellActive:"ui-state-active",uiCellHighlighted:"ui-state-highlight",uiControl:"ui-widget-header ui-corner-top",uiControlTextBox:"ui-widget-content",uiFullScreen:"ui-widget-content ui-corner-all",uiInPlaceEdit:"ui-state-active",uiMenu:"ui-state-highlight",uiMenuUl:"ui-widget-header",uiMenuLi:"ui-widget-header",uiMenuHighlighted:"ui-state-highlight",uiPane:"ui-widget-content",uiParent:"ui-widget-content ui-corner-all",uiSheet:"ui-widget-content",uiTab:"ui-widget-header",uiTabActive:"ui-state-highlight"},kill:function(){jS.obj.tabContainer().remove();jS.obj.fullScreen().remove();jS.obj.inPlaceEdit().remove();origParent.removeClass(jS.cl.uiParent).html("");cE=s=jQuery.sheet.instance[I]=jS=origParent.sheetInstance=null;delete cE;delete s;delete jQuery.sheet.instance[I];delete jS;delete origParent.sheetInstance},controlFactory:{addRowMulti:function(qty,isBefore){if(!qty){qty=prompt("How many rows would you like to add?")}if(qty){jS.controlFactory.addCells(null,isBefore,null,qty,"row")}},addColumnMulti:function(qty,isBefore){if(!qty){qty=prompt("How many columns would you like to add?")}if(qty){jS.controlFactory.addCells(null,isBefore,null,qty,"col")}},addCells:function(eq,isBefore,eqO,qty,type){jS.setDirty(true);var sheet=jS.obj.sheet();var sheetWidth=sheet.width();qty=(qty?qty:1);type=(type?type:"col");var cellLastBar=(type=="row"?jS.cellLast.row:jS.cellLast.col);if(!eq){if(cellLastBar==-1){eq=":last"}else{eq=":eq("+cellLastBar+")"}}else{if(!isNaN(eq)){eq=":eq("+(eq-1)+")"}}var o;switch(type){case"row":o={bar:jS.obj.barLeft().find("div"+eq),barParent:jS.obj.barLeft(),cells:function(){return sheet.find("tr"+eq)},col:function(){return""},newBar:\'\074div class="\'+jS.cl.uiBar+\'" style="height: \'+(s.colMargin-s.boxModelCorrection)+\'px;" /\076\',loc:function(){return jS.getTdLocation(o.cells().find("td:last"))},newCells:function(){var j=o.loc()[1];var newCells="";for(var i=0;i\074=j;i++){newCells+="\074td /\076"}return\'\074tr style="height: \'+s.colMargin+\'px;"\076\'+newCells+"\074/tr\076"},newCol:"",reLabel:function(){o.barParent.children().each(function(i){jQuery(this).text(i+1)})},dimensions:function(loc,bar,cell,col){bar.height(cell.height(s.colMargin).outerHeight()-s.boxModelCorrection)},offset:[qty,0]};break;case"col":o={bar:jS.obj.barTop().find("div"+eq),barParent:jS.obj.barTop(),cells:function(){var cellStart=sheet.find("tr:first td"+eq);var cellEnd=sheet.find("td:last");var loc1=jS.getTdLocation(cellStart);var loc2=jS.getTdLocation(cellEnd);var cells=jQuery(jS.getTd(jS.i,loc1[0],loc1[1]));var cell;for(var i=1;i\074=loc2[0];i++){cells.push(jS.getTd(jS.i,i,loc1[1]))}return cells},col:function(){return sheet.find("col"+eq)},newBar:\'\074div class="\'+jS.cl.uiBar+\'"/\076\',newCol:"\074col /\076",loc:function(cells){cells=(cells?cells:o.cells());return jS.getTdLocation(cells.first())},newCells:function(){return"\074td /\076"},reLabel:function(){o.barParent.children().each(function(i){jQuery(this).text(cE.columnLabelString(i+1))})},dimensions:function(loc,bar,cell,col){var w=s.newColumnWidth;col.width(w).css("width",w+"px").attr("width",w+"px");bar.width(w-s.boxModelCorrection);sheet.width(sheetWidth+(w*qty))},offset:[0,qty]};break}jS.cellUndoable.add(jQuery(sheet).add(o.barParent));var cells=o.cells();var loc=o.loc(cells);var col=o.col();var newBar=o.newBar;var newCell=o.newCells();var newCol=o.newCol;var newCols="";var newBars="";var newCells="";for(var i=0;i\074qty;i++){newCols+=newCol;newBars+=newBar;newCells+=newCell}newCols=jQuery(newCols);newBars=jQuery(newBars);newCells=jQuery(newCells);if(isBefore){cells.before(newCells);o.bar.before(newBars);jQuery(col).before(newCols)}else{cells.after(newCells);o.bar.after(newBars);jQuery(col).after(newCols)}jS.setTdIds(sheet);o.dimensions(loc,newBars,newCells,newCols);o.reLabel();jS.obj.pane().scroll();jS.offsetFormulaRange((isBefore?loc[0]-qty:loc[0]),(isBefore?loc[1]-qty:loc[0]),o.offset[0],o.offset[1],isBefore);jS.sheetSyncSize();jS.cellUndoable.add(jQuery(sheet).add(o.barParent))},addRow:function(atRow,isBefore,atRowQ){jS.controlFactory.addCells(atRow,isBefore,atRowQ,1,"row")},addColumn:function(atColumn,isBefore,atColumnQ){jS.controlFactory.addCells(atColumn,isBefore,atColumnQ,1,"col")},barLeft:function(reload,o){jS.obj.barLeft().remove();var barLeft=jQuery(\'\074div border="1px" id="\'+jS.id.barLeft+jS.i+\'" class="\'+jS.cl.barLeft+\'" /\076\');var heightFn;if(reload){heightFn=function(i,objSource,objBar){objBar.height(parseInt(objSource.outerHeight())-s.boxModelCorrection)}}else{heightFn=function(i,objSource,objBar){objBar.height(parseInt(objSource.css("height").replace("px",""))-s.boxModelCorrection)}}o.find("tr").each(function(i){var child=jQuery("\074div\076"+(i+1)+"\074/div\076");jQuery(barLeft).append(child);heightFn(i,jQuery(this),child)});jS.evt.barMouseDown.height(jS.obj.barLeftParent().append(barLeft))},barTop:function(reload,o){jS.obj.barTop().remove();var barTop=jQuery(\'\074div id="\'+jS.id.barTop+jS.i+\'" class="\'+jS.cl.barTop+\'" /\076\');barTop.height(s.colMargin);var parents;var widthFn;if(reload){parents=o.find("tr:first td");widthFn=function(obj){return jS.attrH.width(obj)}}else{parents=o.find("col");widthFn=function(obj){return parseInt(jQuery(obj).css("width").replace("px",""))-s.boxModelCorrection}}parents.each(function(i){var v=cE.columnLabelString(i+1);var w=widthFn(this);var child=jQuery("\074div\076"+v+"\074/div\076").width(w).height(s.colMargin);barTop.append(child)});jS.evt.barMouseDown.width(jS.obj.barTopParent().append(barTop))},header:function(){jS.obj.controls().remove();jS.obj.tabContainer().remove();var header=jQuery(\'\074div id="\'+jS.id.controls+\'" class="\'+jS.cl.controls+\'"\076\074/div\076\');var firstRow=jQuery(\'\074table cellpadding="0" cellspacing="0" border="0"\076\074tr /\076\074/table\076\').prependTo(header);var firstRowTr=jQuery("\074tr /\076");if(s.title){var title;if(jQuery.isFunction(s.title)){title=jS.title(jS)}else{title=s.title}firstRowTr.append(jQuery(\'\074td style="width: auto;text-align: center;" /\076\').html(title))}if(s.inlineMenu\046\046s.editable){var inlineMenu;if(jQuery.isFunction(s.inlineMenu)){inlineMenu=s.inlineMenu(jS)}else{inlineMenu=s.inlineMenu}firstRowTr.append(jQuery(\'\074td style="text-align: center;" /\076\').html(inlineMenu))}if(s.editable){if(jQuery.mbMenu){jQuery("\074div /\076").load(s.urlMenu,function(){var menu=jQuery(\'\074td style="width: 50px; text-align: center;" id="\'+jS.id.menu+\'" class="rootVoices ui-corner-tl \'+jS.cl.menu+\'" /\076\').html(jQuery(this).html().replace(/sheetInstance/g,"jQuery.sheet.instance["+I+"]").replace(/menuInstance/g,I));menu.prependTo(firstRowTr).buildMenu({menuWidth:100,openOnRight:false,containment:s.parent.attr("id"),hasImages:false,fadeInTime:0,fadeOutTime:0,adjustLeft:2,minZindex:"auto",adjustTop:10,opacity:0.95,shadow:false,closeOnMouseOut:true,closeAfter:1000,hoverIntent:0,submenuHoverIntent:0}).hover(function(){jQuery(this).addClass(jS.cl.uiMenu)},function(){jQuery(this).removeClass(jS.cl.uiMenu)})})}var secondRow=jQuery(\'\074table cellpadding="0" cellspacing="0" border="0"\076\074tr\076\074td style="width: 35px; text-align: right;" id="\'+jS.id.label+\'" class="\'+jS.cl.label+\'"\076\074/td\076\074td\076\074textarea id="\'+jS.id.formula+\'" class="\'+jS.cl.formula+\'"\076\074/textarea\076\074/td\076\074/tr\076\074/table\076\').keydown(jS.evt.keyDownHandler.formulaOnKeyDown).keyup(function(){jS.obj.inPlaceEdit().val(jS.obj.formula().val())}).change(function(){jS.obj.inPlaceEdit().val(jS.obj.formula().val())}).appendTo(header)}firstRowTr.appendTo(firstRow);var tabParent=jQuery(\'\074div id="\'+jS.id.tabContainer+\'" class="\'+jS.cl.tabContainer+\'"\076\'+(s.editable?\'\074span class="\'+jS.cl.uiTab+\' ui-corner-bottom" title="Add a spreadsheet" i="-1"\076+\074/span\076\':"\074span /\076")+"\074/div\076").mousedown(jS.evt.tabOnMouseDown);s.parent.html("").append(header).append(\'\074div id="\'+jS.id.ui+\'" class="\'+jS.cl.ui+\'"\076\').after(tabParent)},sheet:function(size){if(!size){size=s.buildSheet}size=size.toLowerCase().split("x");var columnsCount=parseInt(size[0]);var rowsCount=parseInt(size[1]);var newSheet=jQuery(\'\074table cellpadding="0" cellspacing="0" border="0" border="1px" class="\'+jS.cl.sheet+\'" id="\'+jS.id.sheet+jS.i+\'"\076\074/table\076\');var standardTd="\074td\076 \074/td\076";var tds="";for(var i=columnsCount;i\076=1;i--){tds+=standardTd}var standardTr=\'\074tr height="\'+s.colMargin+\'" style="height: \'+s.colMarg+\';"\076\'+tds+"\074/tr\076";var trs="";for(var i=rowsCount;i\076=1;i--){trs+=standardTr}newSheet.html("\074tbody\076"+trs+"\074/tbody\076");newSheet.width(columnsCount*s.newColumnWidth);return newSheet},sheetUI:function(o,i,fn,reloadBars){if(!i){jS.sheetCount=0;jS.i=0}else{jS.sheetCount++;jS.i=jS.sheetCount;i=jS.i}var objContainer=jS.controlFactory.table().appendTo(jS.obj.ui());var pane=jS.obj.pane().html(o);o=jS.tuneTableForSheetUse(o);jS.sheetDecorate(o);jS.controlFactory.barTop(reloadBars,o);jS.controlFactory.barLeft(reloadBars,o);jS.sheetTab(true);if(s.editable){pane.mousedown(function(e){jS.evt.cellOnMouseDown(e);return false});pane.dblclick(jS.evt.cellOnDblClick)}jS.themeRoller.start(i);jS.setTdIds(o);jS.evt.scrollBars();jS.addTab();if(fn){fn()}jS.log("Sheet Initialized");return objContainer},table:function(){return jQuery(\'\074table cellpadding="0" cellspacing="0" border="0" id="\'+jS.id.tableControl+jS.i+\'" class="\'+jS.cl.tableControl+\'"\076\074tbody\076\074tr\076\074td id="\'+jS.id.barCornerParent+jS.i+\'" class="\'+jS.cl.barCornerParent+\'"\076\074div style="height: \'+s.colMargin+"; width: "+s.colMargin+\';" id="\'+jS.id.barCorner+jS.i+\'" class="\'+jS.cl.barCorner+\'"\'+(s.editable?\' onClick="jQuery.sheet.instance[\'+I+"].cellSetActiveBar(\'all\');\\"":"")+\' title="Select All"\076\046nbsp;\074/div\076\074/td\076\074td class="\'+jS.cl.barTopTd+\'"\076\074div id="\'+jS.id.barTopParent+jS.i+\'" class="\'+jS.cl.barTopParent+\'"\076\074/div\076\074/td\076\074/tr\076\074tr\076\074td class="\'+jS.cl.barLeftTd+\'"\076\074div style="width: \'+s.colMargin+\';" id="\'+jS.id.barLeftParent+jS.i+\'" class="\'+jS.cl.barLeftParent+\'"\076\074/div\076\074/td\076\074td class="\'+jS.cl.sheetPaneTd+\'"\076\074div id="\'+jS.id.pane+jS.i+\'" class="\'+jS.cl.pane+\'"\076\074/div\076\074/td\076\074/tr\076\074/tbody\076\074/table\076\')},chart:function(type,data,legend,axisLabels,w,h,row){if(jGCharts){var api=new jGCharts.Api();function refine(v){var refinedV=new Array();jQuery(v).each(function(i){refinedV[i]=jS.manageHtmlToText(v[i]+"")});return refinedV}var o={};if(type){o.type=type}if(data){data=data.filter(function(v){return(v?v:0)});o.data=data}if(legend){o.legend=refine(legend)}if(axisLabels){o.axis_labels=refine(axisLabels)}if(w||h){o.size=w+"x"+h}return jS.controlFactory.safeImg(api.make(o),row)}else{return jQuery("\074div\076Charts are not enabled\074/div\076")}},safeImg:function(src,row){return jQuery("\074img /\076").hide().load(function(){jQuery(this).fadeIn(function(){jQuery(this).addClass("safeImg");jS.attrH.setHeight(parseInt(row),"cell",false)})}).attr("src",src)},inPlaceEdit:function(td){jS.obj.inPlaceEdit().remove();var formula=jS.obj.formula();var offset=td.offset();var style=td.attr("style");var w=td.width();var h=td.height();var textarea=jQuery(\'\074textarea id="\'+jS.id.inPlaceEdit+\'" class="\'+jS.cl.inPlaceEdit+" "+jS.cl.uiInPlaceEdit+\'" /\076\').css("left",offset.left).css("top",offset.top).width(w).height(h).keydown(jS.evt.inPlaceEditOnKeyDown).keyup(function(){formula.val(textarea.val())}).change(function(){formula.val(textarea.val())}).appendTo("body").val(formula.val()).focus().select();if(jQuery.fn.elastic){textarea.elastic()}},input:{select:function(){return jQuery(\'\074select style="width: 100%;" onchange="jQuery.sheet.instance[\'+I+\'].controlFactory.input.setValue(jQuery(this).val(), jQuery(this).parent());" class="clickable" /\076\')},radio:function(v,cell){var radio=jQuery(\'\074span class="clickable" /\076\');var name=I+"_table"+cell.tableI+"_cell_c"+(cell.col-1)+"_r"+(cell.row-1)+"radio";for(var i=0;i\074(v.length\074=25?v.length:25);i++){if(v[i]){radio.append(\'\074input onchange="jQuery.sheet.instance[\'+I+\'].controlFactory.input.setValue(jQuery(this).val(), jQuery(this).parent().parent());" type="radio" value="\'+v[i]+\'" name="\'+name+\'" /\076\'+v[i]+"\074br /\076")}}return radio},checkbox:function(v){return jQuery(\'\074input onclick="jQuery.sheet.instance[\'+I+"].controlFactory.input.setValue(jQuery(this).is(\':checked\') + \'\', jQuery(this).parent());\\" type=\\"checkbox\\" value=\\""+v+\'" /\076\'+v+"\074br /\076")},setValue:function(v,p){p.attr("selectedvalue",v);jS.calc(cE.calcState.i)},getValue:function(cell){return jQuery(jS.getTd(cell.tableI,cell.row-1,cell.col-1)).attr("selectedvalue")}}},sizeSync:{},evt:{keyDownHandler:{enterOnInPlaceEdit:function(e){if(!e.shiftKey){return jS.evt.cellSetFocusFromKeyCode(e)}else{return true}},enter:function(e){if(!jS.cellLast.isEdit\046\046!e.ctrlKey){jS.cellLast.td.dblclick();return false}else{return this.enterOnInPlaceEdit(e)}},tab:function(e){return jS.evt.cellSetFocusFromKeyCode(e)},pasteOverCells:function(e){if(e.ctrlKey){var formula=jS.obj.formula();var oldVal=formula.val();formula.val("");jQuery(document).one("keyup",function(){var loc=jS.getTdLocation(jS.cellLast.td);var val=formula.val();var firstValue="";formula.val("");var tdsBefore=jQuery("\074div /\076");var tdsAfter=jQuery("\074div /\076");var row=val.split(/\\n/g);for(var i=0;i\074row.length;i++){var col=row[i].split(/\\t/g);for(var j=0;j\074col.length;j++){if(col[j]){var td=jQuery(jS.getTd(jS.i,i+loc[0],j+loc[1]));tdsBefore.append(td.clone());if((col[j]+"").charAt(0)=="="){td.attr("formula",col[j])}else{td.html(col[j]).removeAttr("formula")}tdsAfter.append(td.clone());if(i==0\046\046j==0){firstValue=col[j]}}}}jS.cellUndoable.add(tdsBefore.children());jS.cellUndoable.add(tdsAfter.children());formula.val(firstValue);jS.setDirty(true);jS.evt.cellEditDone(true)})}return true},findCell:function(e){if(e.ctrlKey){jS.cellFind();return false}return true},redo:function(e){if(e.ctrlKey\046\046!jS.cellLast.isEdit){jS.cellUndoable.undoOrRedo();return false}return true},undo:function(e){if(e.ctrlKey\046\046!jS.cellLast.isEdit){jS.cellUndoable.undoOrRedo(true);return false}return true},pageUpDown:function(reverse){var pane=jS.obj.pane();var left=jS.cellLast.td.position().left;var top=0;if(reverse){top=0;pane.scrollTop(pane.scrollTop()-pane.height())}else{top=pane.height()-(s.colMargin*3);pane.scrollTop(pane.scrollTop()+top)}return jS.evt.cellSetFocusFromCoordinates(left,top)},formulaOnKeyDown:function(e){switch(e.keyCode){case key.ESCAPE:jS.evt.cellEditAbandon();break;case key.TAB:return jS.evt.keyDownHandler.tab(e);break;case key.ENTER:return jS.evt.keyDownHandler.enter(e);break;case key.LEFT:case key.UP:case key.RIGHT:case key.DOWN:return jS.evt.cellSetFocusFromKeyCode(e);break;case key.PAGE_UP:return jS.evt.keyDownHandler.pageUpDown(true);break;case key.PAGE_DOWN:return jS.evt.keyDownHandler.pageUpDown();break;case key.V:return jS.evt.keyDownHandler.pasteOverCells(e);break;case key.Y:return jS.evt.keyDownHandler.redo(e);break;case key.Z:return jS.evt.keyDownHandler.undo(e);break;case key.F:return jS.evt.keyDownHandler.findCell(e);case key.CONTROL:case key.CAPS_LOCK:case key.SHIFT:case key.ALT:case key.UP:case key.DOWN:case key.LEFT:case key.RIGHT:break;case key.HOME:case key.END:jS.evt.cellSetFocusFromKeyCode(e);break;default:jS.cellLast.isEdit=true}}},inPlaceEditOnKeyDown:function(e){switch(e.keyCode){case key.ENTER:return jS.evt.keyDownHandler.enterOnInPlaceEdit(e);break;case key.TAB:return jS.evt.keyDownHandler.tab(e);break;case key.ESCAPE:jS.evt.cellEditAbandon();return false;break}},formulaChange:function(e){jS.obj.inPlaceEdit().val(jS.obj.formula().val())},inPlaceEditChange:function(e){jS.obj.formula().val(jS.obj.inPlaceEdit().val())},cellEditDone:function(forceCalc){switch(jS.cellLast.isEdit){case true:jS.obj.inPlaceEdit().remove();var formula=jS.obj.formula();formula.unbind("keydown");var td=jS.cellLast.td;switch(jS.isFormulaEditable(td)){case true:if(td){jS.cellUndoable.add(td);var v=jS.manageTextToHtml(formula.val());var prevVal=td.html();if(v.charAt(0)=="="){td.attr("formula",v).html("")}else{td.removeAttr("formula").html(v)}if(v!=prevVal||forceCalc){jS.calc(jS.i)}jS.attrH.setHeight(jS.cellLast.row,"cell");jS.cellUndoable.add(td);formula.focus().select();jS.cellLast.isEdit=false;jS.setDirty(true);s.fnAfterCellEdit({td:jS.cellLast.td,row:jS.cellLast.row,col:jS.cellLast.col,spreadsheetIndex:jS.i,sheetIndex:I})}}break;default:jS.attrH.setHeight(jS.cellLast.row,"cell",false)}},cellEditAbandon:function(skipCalc){jS.obj.inPlaceEdit().remove();jS.themeRoller.cell.clearActive();jS.themeRoller.bar.clearActive();jS.themeRoller.cell.clearHighlighted();if(!skipCalc){jS.calc(jS.i)}jS.cellLast.td=jQuery("\074td /\076");jS.cellLast.row=jS.cellLast.col=-1;jS.rowLast=jS.colLast=-1;jS.labelUpdate("",true);jS.obj.formula().val("");return false},cellSetFocusFromCoordinates:function(left,top,skipOffset){var pane=jS.obj.pane();var paneOffset=(skipOffset?{left:0,top:0}:pane.offset());top+=paneOffset.top+2;left+=paneOffset.left+2;if((top\076=paneOffset.top\046\046top\074=paneOffset.top+pane.height())\046\046(left\076=paneOffset.left\046\046left\074=paneOffset.left+pane.width())){var td=jQuery(document.elementFromPoint(left-$window.scrollLeft(),top-$window.scrollTop()));if(jS.isTd(td)){jS.themeRoller.cell.clearHighlighted();jS.cellEdit(td);return false}else{return true}}else{return false}},cellSetFocusFromKeyCode:function(e){var c=jS.cellLast.col;var r=jS.cellLast.row;var overrideIsEdit=false;switch(e.keyCode){case key.UP:r--;break;case key.DOWN:r++;break;case key.LEFT:c--;break;case key.RIGHT:c++;break;case key.ENTER:r++;overrideIsEdit=true;if(s.autoAddCells){if(jS.cellLast.row==jS.sheetSize()[0]){jS.controlFactory.addCells(":last",false,null,1,"row")}}break;case key.TAB:overrideIsEdit=true;if(e.shiftKey){c--}else{c++}if(s.autoAddCells){if(jS.cellLast.col==jS.sheetSize()[1]){jS.controlFactory.addCells(":last",false,null,1,"col")}}break;case key.HOME:c=0;break;case key.END:c=jS.cellLast.td.parent().find("td").length-1;break}c=(c\0740?0:c);r=(r\0740?0:r);if(!jS.cellLast.isEdit||overrideIsEdit){var td=jS.getTd(jS.i,r,c);if(td){jS.themeRoller.cell.clearHighlighted();jS.cellEdit(jQuery(td));return false}}return true},cellOnMouseDown:function(e){if(e.shiftKey){jS.getTdRange(e,jS.obj.formula().val());return false}else{if(jS.isTd([e.target])){return jS.cellEdit(jQuery(e.target),true)}else{return true}}},cellOnDblClick:function(e){jS.cellLast.isEdit=jS.isSheetEdit=true;jS.controlFactory.inPlaceEdit(jS.cellLast.td);jS.log("click, in place edit activated")},tabOnMouseDown:function(e){var i=jQuery(e.target).attr("i");if(i!="-1"\046\046i!=jS.i){jS.setActiveSheet(jQuery("#"+jS.id.tableControl+i),i);jS.calc(i)}else{if(i!="-1"\046\046jS.i==i){jS.sheetTab()}else{jS.addSheet("5x10")}}return false},resizeBar:function(e,o){var target=jQuery(e.target);var resizeBar={start:function(e){jS.log("start resize");o.offset=target.offset();o.tdPageXY=[o.offset.left,o.offset.top][o.xyDimension];o.startXY=[e.pageX,e.pageY][o.xyDimension];o.i=o.getIndex(target);o.srcBarSize=o.getSize(target);o.edgeDelta=o.startXY-(o.tdPageXY+o.srcBarSize);o.min=10;if(s.joinedResizing){o.resizeFn=function(size){o.setDesinationSize(size);o.setSize(target,size)}}else{o.resizeFn=function(size){o.setSize(target,size)}}if(Math.abs(o.edgeDelta)\074=o.min){jQuery(e.target).parent().css("cursor",o.cursor);jQuery(document).mousemove(resizeBar.drag).mouseup(resizeBar.stop);return true}else{return false}},drag:function(e){var newSize=o.min;var v=o.srcBarSize+([e.pageX,e.pageY][o.xyDimension]-o.startXY);if(v\0760){newSize=Math.max(v,o.min)}o.resizeFn(newSize);return false},stop:function(e){o.setDesinationSize(o.getSize(target));jQuery(document).unbind("mousemove").unbind("mouseup");jS.obj.formula().focus().select();target.parent().css("cursor","pointer");jS.log("stop resizing")}};return resizeBar.start(e)},scrollBars:function(){var o={pane:jS.obj.pane(),barLeft:jS.obj.barLeftParent(),barTop:jS.obj.barTopParent()};jS.obj.pane().scroll(function(){o.barTop.scrollLeft(o.pane.scrollLeft());o.barLeft.scrollTop(o.pane.scrollTop())})},barMouseDown:{select:function(o,e,selectFn,resizeFn){var isResizing=jS.evt.resizeBar(e,resizeFn);if(!isResizing){selectFn(e.target);o.unbind("mouseover").mouseover(function(e){selectFn(e.target)});jQuery(document).one("mouseup",function(){o.unbind("mouseover").unbind("mouseup")})}return false},first:0,last:0,height:function(o){var selectRow=function(){};o.unbind("mousedown").mousedown(function(e){if(!jQuery(e.target).hasClass(jS.cl.barLeft)){jS.evt.barMouseDown.first=jS.evt.barMouseDown.last=jS.rowLast=jS.getBarLeftIndex(e.target);jS.evt.barMouseDown.select(o,e,selectRow,jS.rowResizer)}return false});if(s.editable){selectRow=function(o){if(!jQuery(o).attr("id")){var i=jS.getBarLeftIndex(o);jS.rowLast=i;jS.evt.barMouseDown.last=i;jS.cellSetActiveBar("row",jS.evt.barMouseDown.first,jS.evt.barMouseDown.last)}}}},width:function(o){var selectColumn=function(){};o.unbind("mousedown").mousedown(function(e){if(!jQuery(e.target).hasClass(jS.cl.barTop)){jS.evt.barMouseDown.first=jS.evt.barMouseDown.last=jS.colLast=jS.getBarTopIndex(e.target);jS.evt.barMouseDown.select(o,e,selectColumn,jS.columnResizer)}return false});if(s.editable){selectColumn=function(o){if(!jQuery(o).attr("id")){var i=jS.getBarTopIndex(o);jS.colLast=i;jS.evt.barMouseDown.last=i;jS.cellSetActiveBar("col",jS.evt.barMouseDown.first,jS.evt.barMouseDown.last)}}}}}},isTd:function(o){if(o[0]){if(!isNaN(o[0].cellIndex)){return true}}return false},isFormulaEditable:function(o){if(s.lockFormulas){if(o.attr("formula")!==undefined){return false}}return true},toggleFullScreen:function(){if(jS.obj.fullScreen().is(":visible")){s.parent=origParent;var w=s.parent.width();var h=s.parent.height();s.width=w;s.height=h;jS.obj.tabContainer().insertAfter(s.parent.append(jS.obj.fullScreen().children())).removeClass(jS.cl.tabContainerFullScreen);jS.obj.fullScreen().remove();jS.sheetSyncSize()}else{var w=$window.width()-15;var h=$window.height()-35;s.width=w;s.height=h;jS.obj.tabContainer().insertAfter(jQuery(\'\074div class="\'+jS.cl.fullScreen+" "+jS.cl.uiFullScreen+\'" /\076\').append(s.parent.children()).appendTo("body")).addClass(jS.cl.tabContainerFullScreen);s.parent=jS.obj.fullScreen();jS.sheetSyncSize()}},tuneTableForSheetUse:function(o){o.addClass(jS.cl.sheet).attr("id",jS.id.sheet+jS.i).attr("border","1px").attr("cellpadding","0").attr("cellspacing","0");o.find("td."+jS.cl.cellActive).removeClass(jS.cl.cellActive);return o},attrH:{width:function(o,skipCorrection){return jQuery(o).outerWidth()-(skipCorrection?0:s.boxModelCorrection)},widthReverse:function(o,skipCorrection){return jQuery(o).outerWidth()+(skipCorrection?0:s.boxModelCorrection)},height:function(o,skipCorrection){return jQuery(o).outerHeight()-(skipCorrection?0:s.boxModelCorrection)},heightReverse:function(o,skipCorrection){return jQuery(o).outerHeight()+(skipCorrection?0:s.boxModelCorrection)},syncSheetWidthFromTds:function(o){var w=0;o=(o?o:jS.obj.sheet());o.find("col").each(function(){w+=jQuery(this).width()});o.width(w);return w},setHeight:function(i,from,skipCorrection,o){var correction=0;var h=0;var fn;switch(from){case"cell":o=(o?o:jS.obj.barLeft().find("div").eq(i));h=jS.attrH.height(jQuery(jS.getTd(jS.i,i,0)).parent().andSelf(),skipCorrection);break;case"bar":o=(o?o:jQuery(jS.getTd(jS.i,i,0)).parent().andSelf());h=jS.attrH.heightReverse(jS.obj.barLeft().find("div").eq(i),skipCorrection);break}if(h){jQuery(o).height(h).css("height",h).attr("height",h)}return o}},setTdIds:function(o){o=(o?o:jS.obj.sheet());o.find("tr").each(function(row){jQuery(this).find("td").each(function(col){jQuery(this).attr("id",jS.getTdId(jS.i,row,col))})})},setControlIds:function(){var resetIds=function(o,id){o.each(function(i){jQuery(this).attr("id",id+i)})};resetIds(jS.obj.sheetAll().each(function(){jS.setTdIds(jQuery(this))}),jS.id.sheet);resetIds(jS.obj.barTopAll(),jS.id.barTop);resetIds(jS.obj.barTopParentAll(),jS.id.barTopParent);resetIds(jS.obj.barLeftAll(),jS.id.barLeft);resetIds(jS.obj.barLeftParentAll(),jS.id.barLeftParent);resetIds(jS.obj.barCornerAll(),jS.id.barCorner);resetIds(jS.obj.barCornerParentAll(),jS.id.barCornerParent);resetIds(jS.obj.tableControlAll(),jS.id.tableControl);resetIds(jS.obj.paneAll(),jS.id.pane);resetIds(jS.obj.tabAll().each(function(j){jQuery(this).attr("i",j)}),jS.id.tab)},columnResizer:{xyDimension:0,getIndex:function(o){return jS.getBarTopIndex(o)},getSize:function(o){return jS.attrH.width(o,true)},setSize:function(o,v){o.width(v)},setDesinationSize:function(w){jS.sheetSyncSizeToDivs();jS.obj.sheet().find("col").eq(this.i).width(w).css("width",w).attr("width",w);jS.obj.pane().scroll()},cursor:"w-resize"},rowResizer:{xyDimension:1,getIndex:function(o){return jS.getBarLeftIndex(o)},getSize:function(o){return jS.attrH.height(o,true)},setSize:function(o,v){if(v){o.height(v).css("height",v).attr("height",v)}return jS.attrH.height(o)},setDesinationSize:function(){jS.attrH.setHeight(this.i,"bar",true);jS.attrH.setHeight(this.i,"cell",false);jS.obj.pane().scroll()},cursor:"s-resize"},toggleHide:{row:function(i){if(!i){i=jS.obj.cellActive().parent().attr("rowIndex")}if(i){var o=jS.obj.barLeft().find("div").eq(i);if(o.is(":visible")){o.hide();jS.obj.sheet().find("tr").eq(i).hide()}else{o.show();jS.obj.sheet().find("tr").eq(i).show()}}else{alert("No row selected.")}},rowAll:function(){jS.obj.sheet().find("tr").show();jS.obj.barLeft().find("div").show()},column:function(i){if(!i){i=jS.obj.cellActive().attr("cellIndex")}if(i){var o=jS.obj.barTop().find("div").eq(i);if(o.is(":visible")){jS.obj.sheet().find("tbody tr").each(function(){jQuery(this).find("td").eq(i).hide()});o.hide();jS.obj.sheet().find("colgroup col").eq(i).hide();jS.toggleHide.columnSizeManage()}}else{alert("Now column selected.")}},columnAll:function(){},columnSizeManage:function(){var w=jS.obj.barTop().width();var newW=0;var newW=0;jS.obj.barTop().find("div").each(function(){var o=jQuery(this);if(o.is(":hidden")){newW+=o.width()}});jS.obj.barTop().width(w);jS.obj.sheet().width(w)}},merge:function(){var cellsValue="";var cellValue="";var cells=jS.obj.cellHighlighted();var formula;var cellFirstLoc=jS.getTdLocation(cells.first());var cellLastLoc=jS.getTdLocation(cells.last());var colI=(cellLastLoc[1]-cellFirstLoc[1])+1;if(cells.length\0761\046\046cellFirstLoc[0]){for(var i=cellFirstLoc[1];i\074=cellLastLoc[1];i++){var cell=jQuery(jS.getTd(jS.i,cellFirstLoc[0],i)).hide();formula=cell.attr("formula");cellValue=cell.html();cellValue=(cellValue?cellValue+" ":"");cellsValue=(formula?"("+formula.replace("=","")+")":cellValue)+cellsValue;if(i!=cellFirstLoc[1]){cell.attr("formula","").html("").hide()}}var cell=cells.first().show().attr("colspan",colI).html(cellsValue);jS.setDirty(true);jS.calc(jS.i)}else{if(!cellFirstLoc[0]){alert("Merging is not allowed on the first row.")}}},unmerge:function(){var cell=jS.obj.cellHighlighted().first();var loc=jS.getTdLocation(cell);var formula=cell.attr("formula");var v=cell.html();v=(formula?formula:v);var rowI=cell.attr("rowspan");var colI=cell.attr("colspan");colI=parseInt(colI?colI:1);var td="\074td /\076";var tds="";if(colI){for(var i=0;i\074colI;i++){tds+=td}}for(var i=loc[1];i\074colI;i++){jQuery(jS.getTd(jS.i,loc[0],i)).show()}cell.removeAttr("colspan");jS.setDirty(true);jS.calc(jS.i)},fillUpOrDown:function(goUp,skipOffsetForumals){var cells=jS.obj.cellHighlighted();var cellActive=jS.obj.cellActive();jS.cellUndoable.add(cells);var startFromActiveCell=cellActive.hasClass(jS.cl.uiCellHighlighted);var locFirst=jS.getTdLocation(cells.first());var locLast=jS.getTdLocation(cells.last());var v=jS.obj.formula().val();var fn;var formulaOffset=(startFromActiveCell?0:1);if((v+"").charAt(0)=="="){fn=function(o,i){o.attr("formula",(skipOffsetForumals?v:jS.offsetFormula(v,i+formulaOffset,0))).html("")}}else{fn=function(o){o.removeAttr("formula").html(v)}}function fill(r,c,i){var td=jQuery(jS.getTd(jS.i,r,c));if(jS.isFormulaEditable(td)){fn(td,i)}}var k=0;if(goUp){for(var i=locLast[0];i\076=locFirst[0];i--){for(var j=locLast[1];j\076=locFirst[1];j--){fill(i,j,k);k++}}}else{for(var i=locFirst[0];i\074=locLast[0];i++){for(var j=locFirst[1];j\074=locLast[1];j++){fill(i,j,k);k++}}}jS.setDirty(true);jS.calc(jS.i);jS.cellUndoable.add(cells)},offsetFormulaRange:function(row,col,rowOffset,colOffset,isBefore){var shiftedRange={first:[(row?row:0),(col?col:0)],last:jS.sheetSize()};if(!isBefore\046\046rowOffset){shiftedRange.first[0]++;shiftedRange.last[0]++}if(!isBefore\046\046colOffset){shiftedRange.first[1]++;shiftedRange.last[1]++}function isInFormula(loc){if((loc[0]-1)\076=shiftedRange.first[0]\046\046(loc[1]-1)\076=shiftedRange.first[1]\046\046(loc[0]-1)\074=shiftedRange.last[0]\046\046(loc[1]-1)\074=shiftedRange.last[1]){return true}else{return false}}function isInFormulaRange(startLoc,endLoc){if(((startLoc[0]-1)\076=shiftedRange.first[0]\046\046(startLoc[1]-1)\076=shiftedRange.first[1])\046\046((startLoc[0]-1)\074=shiftedRange.last[0]\046\046(startLoc[1]-1)\074=shiftedRange.last[1])\046\046((endLoc[0]-1)\076=shiftedRange.first[0]\046\046(endLoc[1]-1)\076=shiftedRange.first[1])\046\046((endLoc[0]-1)\074=shiftedRange.last[0]\046\046(endLoc[1]-1)\074=shiftedRange.last[1])){return true}else{return false}}function reparseFormula(loc){return(cE.columnLabelString(loc[1]+colOffset)+(loc[0]+rowOffset))}function reparseFormulaRange(startLoc,endLoc){return((cE.columnLabelString(startLoc[1]+colOffset)+(startLoc[0]+rowOffset))+":"+(cE.columnLabelString(endLoc[1]+colOffset)+(endLoc[0]+rowOffset)))}jS.cylceCells(function(td){var formula=td.attr("formula");if(formula\046\046jS.isFormulaEditable(td)){formula=formula.replace(cE.regEx.cell,function(ignored,colStr,rowStr,pos){var charAt=[formula.charAt(pos-1),formula.charAt(ignored.length+pos)];if(!colStr.match(cE.regEx.sheet)\046\046charAt[0]!=":"\046\046charAt[1]!=":"){var colI=cE.columnLabelIndex(colStr);var rowI=parseInt(rowStr);if(isInFormula([rowI,colI])){return reparseFormula([rowI,colI])}else{return ignored}}else{return ignored}});formula=formula.replace(cE.regEx.range,function(ignored,startColStr,startRowStr,endColStr,endRowStr,pos){var charAt=[formula.charAt(pos-1),formula.charAt(ignored.length+pos)];if(!startColStr.match(cE.regEx.sheet)\046\046charAt[0]!=":"){var startRowI=parseInt(startRowStr);var startColI=cE.columnLabelIndex(startColStr);var endRowI=parseInt(endRowStr);var endColI=cE.columnLabelIndex(endColStr);if(isInFormulaRange([startRowI,startColI],[endRowI,endColI])){return reparseFormulaRange([startRowI,startColI],[endRowI,endColI])}else{return ignored}}else{return ignored}});td.attr("formula",formula)}},[0,0],shiftedRange.last);jS.calc(jS.i)},cylceCells:function(fn,firstLoc,lastLoc){for(var i=firstLoc[0];i\074lastLoc[0];i++){for(var j=firstLoc[1];j\074lastLoc[1];j++){fn(jQuery(jS.getTd(jS.i,i,j)))}}},cycleCellsAndMaintainPoint:function(fn,firstLoc,lastLoc){var o=[];for(var i=(firstLoc[0]\074lastLoc[0]?firstLoc[0]:lastLoc[0]);i\074=(firstLoc[0]\076lastLoc[0]?firstLoc[0]:lastLoc[0]);i++){for(var j=(firstLoc[1]\074lastLoc[1]?firstLoc[1]:lastLoc[1]);j\074=(firstLoc[1]\076lastLoc[1]?firstLoc[1]:lastLoc[[1]]);j++){o.push(jS.getTd(jS.i,i,j));fn(o[o.length-1])}}return o},offsetFormula:function(formula,rowOffset,colOffset,includeRanges){var charAt=[];var col="";var row="";formula=formula.replace(cE.regEx.cell,function(ignored,colStr,rowStr,pos){charAt[0]=formula.charAt(pos-1);charAt[1]=formula.charAt(ignored.length+pos);charAt[0]=(charAt[0]?charAt[0]:"");charAt[1]=(charAt[1]?charAt[1]:"");if(colStr.match(cE.regEx.sheet)||charAt[0]==":"||charAt[1]==":"){return ignored}else{row=parseInt(rowStr)+rowOffset;col=cE.columnLabelIndex(colStr)+colOffset;row=(row\0760?row:"1");col=(col\0760?col:"1");return cE.columnLabelString(col)+row}});return formula},addTab:function(){jQuery(\'\074span class="\'+jS.cl.uiTab+\' ui-corner-bottom"\076\074a class="\'+jS.cl.tab+\'" id="\'+jS.id.tab+jS.i+\'" i="\'+jS.i+\'"\076\'+jS.sheetTab(true)+"\074/a\076\074/span\076").insertBefore(jS.obj.tabContainer().find("span:last"))},sheetDecorate:function(o){jS.formatSheet(o);jS.sheetSyncSizeToCols(o);jS.sheetDecorateRemove()},formatSheet:function(o){var tableWidth=0;if(o.find("tbody").length\0741){o.wrapInner("\074tbody /\076")}if(o.find("colgroup").length\0741||o.find("col").length\0741){o.remove("colgroup");var colgroup=jQuery("\074colgroup /\076");o.find("tr:first").find("td").each(function(){var w=s.newColumnWidth;jQuery("\074col /\076").width(w).css("width",(w)+"px").attr("width",(w)+"px").appendTo(colgroup);tableWidth+=w});o.find("tr").each(function(){jQuery(this).height(s.colMargin).css("height",s.colMargin+"px").attr("height",s.colMargin+"px")});colgroup.prependTo(o)}o.removeAttr("width").css("width","").width(tableWidth)},themeRoller:{start:function(){s.parent.addClass(jS.cl.uiParent);jS.obj.sheet().addClass(jS.cl.uiSheet);jS.obj.barLeft().find("div").addClass(jS.cl.uiBar);jS.obj.barTop().find("div").addClass(jS.cl.uiBar);jS.obj.barCornerParent().addClass(jS.cl.uiBar);jS.obj.controls().addClass(jS.cl.uiControl);jS.obj.label().addClass(jS.cl.uiControl);jS.obj.formula().addClass(jS.cl.uiControlTextBox)},cell:{setActive:function(){this.clearActive();this.setHighlighted(jS.cellLast.td.addClass(jS.cl.cellActive))},setHighlighted:function(td){jQuery(td).addClass(jS.cl.cellHighlighted+" "+jS.cl.uiCellHighlighted)},clearActive:function(){jS.obj.cellActive().removeClass(jS.cl.cellActive)},clearHighlighted:function(){jS.obj.cellHighlighted().removeClass(jS.cl.cellHighlighted+" "+jS.cl.uiCellHighlighted);jS.highlightedLast.rowStart=-1;jS.highlightedLast.colStart=-1;jS.highlightedLast.rowEnd=-1;jS.highlightedLast.colEnd=-1}},bar:{style:function(o){jQuery(o).addClass(jS.cl.uiBar)},setActive:function(direction,i){switch(direction){case"top":jS.obj.barTop().find("div").eq(i).addClass(jS.cl.uiActive);break;case"left":jS.obj.barLeft().find("div").eq(i).addClass(jS.cl.uiActive);break}},clearActive:function(){jS.obj.barTop().add(jS.obj.barLeft()).find("div."+jS.cl.uiActive).removeClass(jS.cl.uiActive)}},tab:{setActive:function(o){this.clearActive();jS.obj.tab().parent().addClass(jS.cl.uiTabActive)},clearActive:function(){jS.obj.tabContainer().find("span."+jS.cl.uiTabActive).removeClass(jS.cl.uiTabActive)}},resize:function(){if(jQuery.ui){var o;var barTop;var barLeft;var controlsHeight;var parent=s.parent;parent.resizable("destroy").resizable({minWidth:s.width*0.5,minHeight:s.height*0.5,start:function(){jS.obj.ui().hide()},stop:function(){jS.obj.ui().show();s.width=parent.width();s.height=parent.height();jS.sheetSyncSize()}});var formulaResizeParent=jQuery("\074span /\076");jS.obj.formula().wrap(formulaResizeParent).parent().resizable({minHeight:jS.obj.formula().height(),maxHeight:78,handles:"s",resize:function(e,ui){jS.obj.formula().height(ui.size.height);jS.sheetSyncSize()}})}}},manageHtmlToText:function(v){v=jQuery.trim(v);if(v.charAt(0)!="="){v=v.replace(/\046nbsp;/g," ").replace(/\046gt;/g,"\076").replace(/\046lt;/g,"\074").replace(/\\t/g,"").replace(/\\n/g,"").replace(/\074br\076/g,"\\r").replace(/\074BR\076/g,"\\n")}return v},manageTextToHtml:function(v){v=jQuery.trim(v);if(v.charAt(0)!="="){v=v.replace(/\\t/g,"\046nbsp;\046nbsp;\046nbsp;\046nbsp;").replace(/ /g,"\046nbsp;").replace(/\076/g,"\046gt;").replace(/\074/g,"\046lt;").replace(/\\n/g,"\074br\076").replace(/\\r/g,"\074br\076")}return v},sheetDecorateRemove:function(makeClone){var o=(makeClone?jS.obj.sheetAll().clone():jS.obj.sheetAll());jQuery(o).find("td."+jS.cl.cellActive).removeClass(jS.cl.cellActive+" "+jS.cl.uiCellActive);jQuery(o).find("td."+jS.cl.cellHighlighted).removeClass(jS.cl.cellHighlighted+" "+jS.cl.uiCellHighlighted);return o},labelUpdate:function(v,setDirect){if(!setDirect){jS.obj.label().html(cE.columnLabelString(v[1]+1)+(v[0]+1))}else{jS.obj.label().html(v)}},cellEdit:function(td,isDrag){jS.evt.cellEditDone();jS.followMe(td);var loc=jS.getTdLocation(td);jS.labelUpdate(loc);var v=td.attr("formula");if(!v){v=jS.manageHtmlToText(td.html())}jS.obj.formula().val(v).focus().select();jS.cellSetActive(td,loc,isDrag)},cellSetActive:function(td,loc,isDrag){if(typeof(loc[1])!="undefined"){jS.cellLast.td=td;jS.cellLast.row=jS.rowLast=loc[0];jS.cellLast.col=jS.colLast=loc[1];jS.themeRoller.bar.clearActive();jS.themeRoller.cell.clearHighlighted();jS.highlightedLast.td=td;jS.themeRoller.cell.setActive();jS.themeRoller.bar.setActive("left",jS.cellLast.row);jS.themeRoller.bar.setActive("top",jS.cellLast.col);var selectModel;var clearHighlightedModel;jS.highlightedLast.rowStart=loc[0];jS.highlightedLast.colStart=loc[1];jS.highlightedLast.rowLast=loc[0];jS.highlightedLast.colLast=loc[1];switch(s.cellSelectModel){case"excel":case"gdocs":selectModel=function(){};clearHighlightedModel=jS.themeRoller.cell.clearHighlighted;break;case"oo":selectModel=function(target){var td=jQuery(target);if(jS.isTd(td)){jS.cellEdit(td)}};clearHighlightedModel=function(){};break}if(isDrag){jS.obj.pane().mousemove(function(e){var endLoc=jS.getTdLocation([e.target]);if(loc[1]!=endLoc[1]||loc[0]!=endLoc[0]){clearHighlightedModel();jS.highlightedLast.colEnd=endLoc[1];jS.highlightedLast.rowEnd=endLoc[0];selectModel(e.target);jS.highlightedLast.td=jS.cycleCellsAndMaintainPoint(jS.themeRoller.cell.setHighlighted,loc,endLoc)}});jQuery(document).one("mouseup",function(){jS.obj.pane().unbind("mousemove").unbind("mouseup")})}}},colLast:0,rowLast:0,cellLast:{td:jQuery("\074td /\076"),row:-1,col:-1,isEdit:false},highlightedLast:{td:jQuery("\074td /\076"),rowStart:-1,colStart:-1,rowEnd:-1,colEnd:-1},cellStyleToggle:function(setClass,removeClass){var uiCell=jS.obj.cellHighlighted();jS.cellUndoable.add(uiCell);if(removeClass){uiCell.removeClass(removeClass)}if(uiCell.hasClass(setClass)){uiCell.removeClass(setClass)}else{uiCell.addClass(setClass)}jS.cellUndoable.add(uiCell);jS.obj.formula().focus().select();return false},context:{},calc:function(tableI,fuel){jS.log("Calculation Started");if(!s.calcOff){cE.calc(new jS.tableCellProvider(tableI),jS.context,fuel);jS.isSheetEdit=false}jS.log("Calculation Ended")},refreshLabelsColumns:function(){var w=0;jS.obj.barTop().find("div").each(function(i){jQuery(this).text(cE.columnLabelString(i+1));w+=jQuery(this).width()});return w},refreshLabelsRows:function(){jS.obj.barLeft().find("div").each(function(i){jQuery(this).text((i+1))})},addSheet:function(size){size=(size?size:prompt(jS.newSheetDialog));if(size){jS.evt.cellEditAbandon();jS.setDirty(true);var newSheetControl=jS.controlFactory.sheetUI(jS.controlFactory.sheet(size),jS.sheetCount+1,function(){jS.setActiveSheet(newSheetControl,jS.sheetCount+1)},true)}},deleteSheet:function(){jS.obj.tableControl().remove();jS.obj.tabContainer().children().eq(jS.i).remove();jS.i=0;jS.sheetCount--;jS.setControlIds();jS.setActiveSheet(jS.obj.tableControl(),jS.i)},deleteRow:function(){var v=confirm("Are you sure that you want to delete that row?");if(v){jS.obj.barLeft().find("div").eq(jS.rowLast).remove();jS.obj.sheet().find("tr").eq(jS.rowLast).remove();jS.evt.cellEditAbandon();jS.setTdIds();jS.refreshLabelsRows();jS.obj.pane().scroll();jS.rowLast=-1;jS.offsetFormulaRange(jS.rowLast,0,-1,0)}},deleteColumn:function(){var v=confirm("Are you sure that you want to delete that column?");if(v){jS.obj.barTop().find("div").eq(jS.colLast).remove();jS.obj.sheet().find("colgroup col").eq(jS.colLast).remove();jS.obj.sheet().find("tr").each(function(i){jQuery(this).find("td").eq(jS.colLast).remove()});jS.evt.cellEditAbandon();var w=jS.refreshLabelsColumns();jS.setTdIds();jS.obj.sheet().width(w);jS.obj.pane().scroll();jS.colLast=-1;jS.offsetFormulaRange(0,jS.colLast,0,-1)}},sheetTab:function(get){var sheetTab="";if(get){sheetTab=jS.obj.sheet().attr("title");sheetTab=(sheetTab?sheetTab:"Spreadsheet "+(jS.i+1))}else{if(s.editable){var newTitle=prompt("What would you like the sheet\'s title to be?",jS.sheetTab(true));if(!newTitle){sheetTab=jS.obj.sheet().attr("title");newTitle=(sheetTab?sheetTab:"Spreadsheet"+(jS.i+1))}else{jS.setDirty(true);jS.obj.sheet().attr("title",newTitle);jS.obj.tab().html(newTitle);sheetTab=newTitle}}}return sheetTab},print:function(o){var w=window.open();w.document.write("\074html\076\074body\076\074xmp\076"+o+"\\n\074/xmp\076\074/body\076\074/html\076");w.document.close()},viewSource:function(pretty){var sheetClone=jS.sheetDecorateRemove(true);var s="";if(pretty){jQuery(sheetClone).each(function(){s+=jS.HTMLtoPrettySource(this)})}else{s+=jQuery("\074div /\076").html(sheetClone).html()}jS.print(s);return false},saveSheet:function(){var v=jS.sheetDecorateRemove(true);var d=jQuery("\074div /\076").html(v).html();jQuery.ajax({url:s.urlSave,type:"POST",data:"s="+d,dataType:"html",success:function(data){jS.setDirty(false);alert("Success! - "+data)}})},HTMLtoCompactSource:function(node){var result="";if(node.nodeType==1){result+="\074"+node.tagName;hasClass=false;var n=node.attributes.length;for(var i=0,hasClass=false;i\074n;i++){var key=node.attributes[i].name;var val=node.getAttribute(key);if(val){if(key=="contentEditable"\046\046val=="inherit"){continue}if(key=="class"){hasClass=true}if(typeof(val)=="string"){result+=" "+key+\'="\'+val.replace(/"/g,"\'")+\'"\'}else{if(key=="style"\046\046val.cssText){result+=\' style="\'+val.cssText+\'"\'}}}}if(node.tagName=="COL"){result+="/\076"}else{result+="\076";var childResult="";jQuery(node.childNodes).each(function(){childResult+=jS.HTMLtoCompactSource(this)});result+=childResult;result+="\074/"+node.tagName+"\076"}}else{if(node.nodeType==3){result+=node.data.replace(/^\\s*(.*)\\s*$/g,"$1")}}return result},HTMLtoPrettySource:function(node,prefix){if(!prefix){prefix=""}var result="";if(node.nodeType==1){result+="\\n"+prefix+"\074"+node.tagName;var n=node.attributes.length;for(var i=0;i\074n;i++){var key=node.attributes[i].name;var val=node.getAttribute(key);if(val){if(key=="contentEditable"\046\046val=="inherit"){continue}if(typeof(val)=="string"){result+=" "+key+\'="\'+val.replace(/"/g,"\'")+\'"\'}else{if(key=="style"\046\046val.cssText){result+=\' style="\'+val.cssText+\'"\'}}}}if(node.childNodes.length\074=0){result+="/\076"}else{result+="\076";var childResult="";var n=node.childNodes.length;for(var i=0;i\074n;i++){childResult+=jS.HTMLtoPrettySource(node.childNodes[i],prefix+" ")}result+=childResult;if(childResult.indexOf("\\n")\076=0){result+="\\n"+prefix}result+="\074/"+node.tagName+"\076"}}else{if(node.nodeType==3){result+=node.data.replace(/^\\s*(.*)\\s*$/g,"$1")}}return result},followMe:function(td){var pane=jS.obj.pane();var panePos=pane.offset();var paneWidth=pane.width();var paneHeight=pane.height();var tdPos=td.offset();var tdWidth=td.width();var tdHeight=td.height();var margin=20;if((tdPos.left+tdWidth+margin)\076(panePos.left+paneWidth)){pane.stop().scrollTo(td,{axis:"x",duration:50,offset:-((paneWidth-tdWidth)-margin)})}else{if(tdPos.left\074panePos.left){pane.stop().scrollTo(td,{axis:"x",duration:50})}}if((tdPos.top+tdHeight+margin)\076(panePos.top+paneHeight)){pane.stop().scrollTo(td,{axis:"y",duration:50,offset:-((paneHeight-tdHeight)-margin)})}else{if(tdPos.top\074panePos.top){pane.stop().scrollTo(td,{axis:"y",duration:50})}}},count:{rows:function(){return jS.getBarLeftIndex(jS.obj.barLeft().find("div:last").text())},columns:function(){return jS.getBarTopLocatoin(jS.obj.barTop().find("div:last").text())}},isRowHeightSync:[],setActiveSheet:function(o,i){if(o){o.show().siblings().hide();jS.i=i}else{jS.obj.tableControl().siblings().not("div").hide();i=0}jS.themeRoller.tab.setActive();if(!jS.isRowHeightSync[i]){jS.isRowHeightSync[i]=true;jS.obj.sheet().find("tr").each(function(j){jS.attrH.setHeight(j,"cell")})}jS.sheetSyncSize();jS.replaceWithSafeImg(jS.obj.sheet().find("img"))},openSheetURL:function(url){s.urlGet=url;return jS.openSheet()},openSheet:function(o){if(!jS.isDirty?true:confirm("Are you sure you want to open a different sheet? All unsaved changes will be lost.")){jS.controlFactory.header();var fnAfter=function(i,l){if(i==(l-1)){jS.i=0;jS.setActiveSheet();jS.themeRoller.resize();for(var i=0;i\074=jS.sheetCount;i++){jS.calc(i)}s.fnAfter()}};if(!o){jQuery("\074div /\076").load(s.urlGet,function(){var sheets=jQuery(this).find("table");sheets.each(function(i){jS.controlFactory.sheetUI(jQuery(this),i,function(){fnAfter(i,sheets.length)},true)})})}else{var sheets=jQuery("\074div /\076").html(o).find("table");sheets.show().each(function(i){jS.controlFactory.sheetUI(jQuery(this),i,function(){fnAfter(i,sheets.length)},false)})}jS.setDirty(false);return true}else{return false}},newSheetDialog:"What size would you like to make your spreadsheet? Example: \'5x10\' creates a sheet that is 5 columns by 10 rows.",newSheet:function(){var size=prompt(jS.newSheetDialog);if(size){jS.openSheet(jS.controlFactory.sheet(size))}},importRow:function(rowArray){jS.controlFactory.addRow(null,null,":last");var error="";jS.obj.sheet().find("tr:last td").each(function(i){jQuery(this).removeAttr("formula");try{if((rowArray[i]+"").charAt(0)=="="){jQuery(this).attr("formula",rowArray[i])}else{jQuery(this).html(rowArray[i])}}catch(e){error+=e+";\\n"}});if(error){alert(error)}jS.setTdIds();jS.calc(jS.i)},importColumn:function(columnArray){jS.controlFactory.addColumn();var error="";jS.obj.sheet().find("tr").each(function(i){var o=jQuery(this).find("td:last");try{if((columnArray[i]+"").charAt(0)=="="){o.attr("formula",columnArray[i])}else{o.html(columnArray[i])}}catch(e){error+=e+";\\n"}});if(error){alert(error)}jS.setTdIds();jS.calc(jS.i)},exportSheet:{xml:function(skipCData){var sheetClone=jS.sheetDecorateRemove(true);var document="";var cdata=["\074![CDATA[","]]\076"];if(skipCData){cdata=["",""]}jQuery(sheetClone).each(function(){var row="";var table=jQuery(this);var colCount=0;var col_widths="";table.find("colgroup").children().each(function(i){col_widths+="\074c"+i+"\076"+(jQuery(this).attr("width")+"").replace("px","")+"\074/c"+i+"\076"});var trs=table.find("tr");var rowCount=trs.length;trs.each(function(i){var col="";var tr=jQuery(this);var h=tr.attr("height");var height=(h?h:s.colMargin);var tds=tr.find("td");colCount=tds.length;tds.each(function(j){var td=jQuery(this);var colSpan=td.attr("colspan");colSpan=(colSpan\0761?colSpan:"");var formula=td.attr("formula");var text=(formula?formula:td.text());var cl=td.attr("class");var style=td.attr("style");col+="\074c"+j+(style?\' style="\'+style+\'"\':"")+(cl?\' class="\'+cl+\'"\':"")+(colSpan?\' colspan="\'+colSpan+\'"\':"")+"\076"+text+"\074/c"+j+"\076"});row+="\074r"+i+\' h="\'+height+\'"\076\'+col+"\074/r"+i+"\076"});document+=\'\074document title="\'+table.attr("title")+\'"\076\074metadata\076\074columns\076\'+colCount+"\074/columns\076\074rows\076"+rowCount+"\074/rows\076\074col_widths\076"+col_widths+"\074/col_widths\076\074/metadata\076\074data\076"+row+"\074/data\076\074/document\076"});return"\074documents\076"+document+"\074/documents\076"},json:function(){var sheetClone=jS.sheetDecorateRemove(true);var documents=[];jQuery(sheetClone).each(function(){var document={};document.metadata={};document.data={};var table=jQuery(this);var trs=table.find("tr");var rowCount=trs.length;var colCount=0;var col_widths="";trs.each(function(i){var tr=jQuery(this);var tds=tr.find("td");colCount=tds.length;document.data["r"+i]={};document.data["r"+i]["h"]=tr.attr("height");tds.each(function(j){var td=jQuery(this);var colSpan=td.attr("colspan");colSpan=(colSpan\0761?colSpan:null);var formula=td.attr("formula");document.data["r"+i]["c"+j]={value:(formula?formula:td.text()),style:td.attr("style"),colspan:colSpan,cl:td.attr("class")}})});document.metadata={columns:colCount,rows:rowCount,title:table.attr("title"),col_widths:{}};table.find("colgroup").children().each(function(i){document.metadata["col_widths"]["c"+i]=(jQuery(this).attr("width")+"").replace("px","")});documents.push(document)});return documents},html:function(){return jS.sheetDecorateRemove(true)}},sheetSyncSizeToDivs:function(){var newSheetWidth=0;jS.obj.barTop().find("div").each(function(){newSheetWidth+=parseInt(jQuery(this).outerWidth())});jS.obj.sheet().width(newSheetWidth)},sheetSyncSizeToCols:function(o){var newSheetWidth=0;o.find("colgroup col").each(function(){newSheetWidth+=jQuery(this).width()});o.width(newSheetWidth)},sheetSyncSize:function(){var h=s.height;if(!h){h=400}else{if(h\074200){h=200}}s.parent.height(h).width(s.width);var w=s.width-jS.attrH.width(jS.obj.barLeftParent())-(s.boxModelCorrection);h=h-jS.attrH.height(jS.obj.controls())-jS.attrH.height(jS.obj.barTopParent())-(s.boxModelCorrection*2);jS.obj.pane().height(h).width(w).parent().width(w);jS.obj.ui().width(w+jS.attrH.width(jS.obj.barLeftParent()));jS.obj.barLeftParent().height(h);jS.obj.barTopParent().width(w).parent().width(w)},cellFind:function(v){if(!v){v=prompt("What are you looking for in this spreadsheet?")}if(v){var o=jS.obj.sheet().find(\'td:contains("\'+v+\'")\');if(o.length\0741){o=jS.obj.sheet().find(\'td:contains("\'+v.toLowerCase()+\'")\')}if(o.length\0741){o=jS.obj.sheet().find(\'td:contains("\'+v.toUpperCase()+\'")\')}o=o.eq(0);if(o.length\0760){jS.cellEdit(o)}else{alert("No results found.")}}},cellSetActiveBar:function(type,start,end){var loc=jS.sheetSize();var first=(start\074end?start:end);var last=(start\074end?end:start);var setActive=function(td,rowStart,colStart,rowFollow,colFollow){switch(s.cellSelectModel){case"oo":jS.cellEdit(jQuery(jS.getTd(jS.i,rowFollow,colFollow)));break;default:jS.cellEdit(jQuery(jS.getTd(jS.i,rowStart,colStart)));break}setActive=function(td){return td};return td};var cycleFn;var td=[];switch(type){case"col":cycleFn=function(){for(var i=0;i\074=loc[0];i++){for(var j=first;j\074=last;j++){td.push(jS.getTd(jS.i,i,j));jS.themeRoller.cell.setHighlighted(setActive(td[td.length-1],0,start,0,end))}}};break;case"row":cycleFn=function(){for(var i=first;i\074=last;i++){for(var j=0;j\074=loc[1];j++){td.push(jS.getTd(jS.i,i,j));jS.themeRoller.cell.setHighlighted(setActive(td[td.length-1],start,0,end,0))}}};break;case"all":cycleFn=function(){setActive=function(td){jS.cellEdit(jQuery(td));setActive=function(){}};for(var i=0;i\074=loc[0];i++){for(var j=0;j\074=loc[1];j++){td.push(jS.getTd(jS.i,i,j));setActive(td[td.length-1]);jS.themeRoller.cell.setHighlighted(td[td.length-1])}}first=[0,0];last=loc};break}cycleFn();jS.highlightedLast.td=td;jS.highlightedLast.rowStart=first[0];jS.highlightedLast.colStart=first[1];jS.highlightedLast.rowEnd=last[0];jS.highlightedLast.colEnd=last[1]},sheetClearActive:function(){jS.obj.formula().val("");jS.obj.barSelected().removeClass(jS.cl.barSelected)},getTdRange:function(e,v,newFn,notSetFormula){jS.cellLast.isEdit=true;var range=function(loc){if(loc.first[1]\076loc.last[1]||loc.first[0]\076loc.last[0]){return{first:cE.columnLabelString(loc.last[1]+1)+(loc.last[0]+1),last:cE.columnLabelString(loc.first[1]+1)+(loc.first[0]+1)}}else{return{first:cE.columnLabelString(loc.first[1]+1)+(loc.first[0]+1),last:cE.columnLabelString(loc.last[1]+1)+(loc.last[0]+1)}}};var label=function(loc){var rangeLabel=range(loc);var v2=v+"";v2=(v2.match(/=/)?v2:"="+v2);if(newFn||v2.charAt(v2.length-1)!="("){v2=v2+(newFn?newFn:"")+"("}var formula;var lastChar="";if(rangeLabel.first!=rangeLabel.last){formula=rangeLabel.first+":"+rangeLabel.last}else{formula=rangeLabel.first}if(v2.charAt(v2.length-1)=="("){lastChar=")"}return v2+formula+lastChar};var newVal="";if(e){var loc={first:jS.getTdLocation([e.target])};var sheet=jS.obj.sheet().mousemove(function(e){loc.last=jS.getTdLocation([e.target]);newVal=label(loc);if(!notSetFormula){jS.obj.formula().val(newVal);jS.obj.inPlaceEdit().val(newVal)}});jQuery(document).one("mouseup",function(){sheet.unbind("mousemove");return newVal})}else{var cells=jS.obj.cellHighlighted().not(jS.obj.cellActive());if(cells.length){var loc={first:jS.getTdLocation(cells.first()),last:jS.getTdLocation(cells.last())};newVal=label(loc);if(!notSetFormula){jS.obj.formula().val(newVal);jS.obj.inPlaceEdit().val(newVal)}return newVal}else{return""}}},getTdId:function(tableI,row,col){return I+"_table"+tableI+"_cell_c"+col+"_r"+row},getTd:function(tableI,row,col){return document.getElementById(jS.getTdId(tableI,row,col))},getTdLocation:function(td){var col=parseInt(td[0].cellIndex);var row=parseInt(td[0].parentNode.rowIndex);return[row,col]},getBarLeftIndex:function(o){var i=jQuery.trim(jQuery(o).text());return parseInt(i)-1},getBarTopIndex:function(o){var i=cE.columnLabelIndex(jQuery.trim(jQuery(o).text()));return parseInt(i)-1},tableCellProvider:function(tableI){this.tableBodyId=jS.id.sheet+tableI;this.tableI=tableI;this.cells={}},tableCell:function(tableI,row,col){this.tableBodyId=jS.id.sheet+tableI;this.tableI=tableI;this.row=row;this.col=col;this.value=jS.EMPTY_VALUE},EMPTY_VALUE:{},time:{now:new Date(),last:new Date(),diff:function(){return Math.abs(Math.ceil(this.last.getTime()-this.now.getTime())/1000).toFixed(5)},set:function(){this.last=this.now;this.now=new Date()},get:function(){return this.now.getHours()+":"+this.now.getMinutes()+":"+this.now.getSeconds()}},log:function(msg){jS.time.set();jS.obj.log().prepend(jS.time.get()+", "+jS.time.diff()+"; "+msg+"\074br /\076\\n")},replaceWithSafeImg:function(o){o.each(function(){var src=jQuery(this).attr("src");jQuery(this).replaceWith(jS.controlFactory.safeImg(src,jS.getTdLocation(jQuery(this).parent())[0]))})},isDirty:false,setDirty:function(dirty){jS.isDirty=dirty},appendToFormula:function(v,o){var formula=jS.obj.formula();var fV=formula.val();if(fV.charAt(0)!="="){fV="="+fV}formula.val(fV+v)},cellUndoable:{undoOrRedo:function(undo){if(!undo\046\046this.i\0760){this.i--}else{if(undo\046\046this.i\074this.stack.length){this.i++}}this.get().clone().each(function(){var o=jQuery(this);var id=o.attr("undoable");if(id){jQuery("#"+id).replaceWith(o.removeAttr("undoable").attr("id",id))}else{jS.log("Not available.")}});jS.themeRoller.cell.clearActive();jS.themeRoller.bar.clearActive();jS.themeRoller.cell.clearHighlighted()},get:function(){return jQuery(this.stack[this.i])},add:function(tds){var oldTds=tds.clone().each(function(){var o=jQuery(this);var id=o.attr("id");o.removeAttr("id").attr("undoable",id).removeClass(jS.cl.cellHighlighted+" "+jS.cl.uiCellHighlighted)});if(this.stack.length\0760){this.stack.unshift(oldTds)}else{this.stack=[oldTds]}this.i=-1;if(this.stack.length\07620){this.stack.pop()}},i:0,stack:[]},sheetSize:function(){return jS.getTdLocation(jS.obj.sheet().find("td:last"))},toggleState:function(newS){if(s.allowToggleState){s.editable=!s.editable;jS.obj.tabContainer().remove();var sheets=jS.obj.sheetAll().clone();origParent.children().remove();jS.openSheet(sheets)}}};jS.tableCellProvider.prototype={getCell:function(tableI,row,col){if(typeof(col)=="string"){col=cE.columnLabelIndex(col)}var key=tableI+","+row+","+col;var cell=this.cells[key];if(!cell){var td=jS.getTd(tableI,row-1,col-1);if(td){cell=this.cells[key]=new jS.tableCell(tableI,row,col)}}return cell},getNumberOfColumns:function(row){var tableBody=document.getElementById(this.tableBodyId);if(tableBody){var tr=tableBody.rows[row];if(tr){return tr.cells.length}}return 0},toString:function(){result="";jQuery("#"+(this.tableBodyId)+" tr").each(function(){result+=this.innerHTML.replace(/\\n/g,"")+"\\n"});return result}};jS.tableCell.prototype={td:null,getTd:function(){if(!this.td){this.td=document.getElementById(jS.getTdId(this.tableI,this.row-1,this.col-1))}return this.td},setValue:function(v,e){this.error=e;this.value=v;jQuery(this.getTd()).html(v?v:"")},getValue:function(){var v=this.value;if(v===jS.EMPTY_VALUE\046\046!this.getFormula()){v=jQuery(this.getTd()).text();v=this.value=(v.length\0760?cE.parseFormulaStatic(v):null)}return(v===jS.EMPTY_VALUE?null:v)},getFormat:function(){return jQuery(this.getTd()).attr("format")},setFormat:function(v){jQuery(this.getTd()).attr("format",v)},getFormulaFunc:function(){return this.formulaFunc},setFormulaFunc:function(v){this.formulaFunc=v},formula:null,getFormula:function(){if(!this.formula){var v=jQuery(this.getTd()).attr("formula");this.formula=(v?v.replace(/\\n/g," "):v)}return this.formula},setFormula:function(v){if(v\046\046v.length\0760){jQuery(this.getTd()).attr("formula",v)}else{jQuery(this.getTd()).removeAttr("formula")}}};var cE={TEST:{},ERROR:"#VALUE!",cFN:{sum:function(x,y){return x+y},max:function(x,y){return x\076y?x:y},min:function(x,y){return x\074y?x:y},count:function(x,y){return(y!=null)?x+1:x},clean:function(v){if(typeof(v)=="string"){v=v.replace(cE.regEx.amp,"\046").replace(cE.regEx.nbsp," ").replace(/\\n/g,"").replace(/\\r/g,"")}return v}},fn:{HTML:function(v){return jQuery(v)},IMG:function(v){return jS.controlFactory.safeImg(v,cE.calcState.row,cE.calcState.col)},AVERAGE:function(values){var arr=cE.foldPrepare(values,arguments);return cE.fn.SUM(arr)/cE.fn.COUNT(arr)},AVG:function(values){return cE.fn.AVERAGE(values)},COUNT:function(values){return cE.fold(cE.foldPrepare(values,arguments),cE.cFN.count,0)},SUM:function(values){return cE.fold(cE.foldPrepare(values,arguments),cE.cFN.sum,0,true)},MAX:function(values){return cE.fold(cE.foldPrepare(values,arguments),cE.cFN.max,Number.MIN_VALUE,true)},MIN:function(values){return cE.fold(cE.foldPrepare(values,arguments),cE.cFN.min,Number.MAX_VALUE,true)},ABS:function(v){return Math.abs(cE.fn.N(v))},CEILING:function(v){return Math.ceil(cE.fn.N(v))},FLOOR:function(v){return Math.floor(cE.fn.N(v))},INT:function(v){return Math.floor(cE.fn.N(v))},ROUND:function(v,decimals){return cE.fn.FIXED(v,(decimals?decimals:0),false)},RAND:function(v){return Math.random()},RND:function(v){return Math.random()},TRUE:function(){return"TRUE"},FALSE:function(){return"FALSE"},NOW:function(){return new Date()},TODAY:function(){return Date(Math.floor(new Date()))},DAYSFROM:function(year,month,day){return Math.floor((new Date()-new Date(year,(month-1),day))/86400000)},IF:function(v,t,f){t=cE.cFN.clean(t);f=cE.cFN.clean(f);try{v=eval(v)}catch(e){}try{t=eval(t)}catch(e){}try{t=eval(t)}catch(e){}if(v=="true"||v==true||v\0760||v=="TRUE"){return t}else{return f}},FIXED:function(v,decimals,noCommas){if(decimals==null){decimals=2}var x=Math.pow(10,decimals);var n=String(Math.round(cE.fn.N(v)*x)/x);var p=n.indexOf(".");if(p\0740){p=n.length;n+="."}for(var i=n.length-p-1;i\074decimals;i++){n+="0"}if(noCommas==true){return n}var arr=n.replace("-","").split(".");var result=[];var first=true;while(arr[0].length\0760){if(!first){result.unshift(",")}result.unshift(arr[0].slice(-3));arr[0]=arr[0].slice(0,-3);first=false}if(decimals\0760){result.push(".");var first=true;while(arr[1].length\0760){if(!first){result.push(",")}result.push(arr[1].slice(0,3));arr[1]=arr[1].slice(3);first=false}}if(v\0740){return"-"+result.join("")}return result.join("")},TRIM:function(v){if(typeof(v)=="string"){v=jQuery.trim(v)}return v},HYPERLINK:function(link,name){name=(name?name:"LINK");return jQuery(\'\074a href="\'+link+\'" target="_new" class="clickable"\076\'+name+"\074/a\076")},DOLLAR:function(v,decimals,symbol){if(decimals==null){decimals=2}if(symbol==null){symbol="$"}var r=cE.fn.FIXED(v,decimals,false);if(v\076=0){return symbol+r}else{return"-"+symbol+r.slice(1)}},VALUE:function(v){return parseFloat(v)},N:function(v){if(v==null){return 0}if(v instanceof Date){return v.getTime()}if(typeof(v)=="object"){v=v.toString()}if(typeof(v)=="string"){v=parseFloat(v.replace(cE.regEx.n,""))}if(isNaN(v)){return 0}if(typeof(v)=="number"){return v}if(v==true){return 1}return 0},PI:function(){return Math.PI},POWER:function(x,y){return Math.pow(x,y)},INPUT:{SELECT:function(v,noBlank){if(s.editable){v=cE.foldPrepare(v,arguments);var selectObj=jS.controlFactory.input.select();if(!noBlank){selectObj.append(\'\074option value=""\076Select a value\074/option\076\')}for(var i=0;i\074(v.length\074=50?v.length:50);i++){if(v[i]){selectObj.append(\'\074option value="\'+v[i]+\'"\076\'+v[i]+"\074/option\076")}}selectObj.val(jS.controlFactory.input.getValue(cE.thisCell));return selectObj}else{return jS.controlFactory.input.getValue(cE.thisCell)}},SELECTVAL:function(v){return(s.editable?jQuery(v).val():v)},RADIO:function(v){if(s.editable){v=cE.foldPrepare(v,arguments);var o=jS.controlFactory.input.radio(v,cE.thisCell);o.find(\'input[value="\'+jS.controlFactory.input.getValue(cE.thisCell)+\'"]\').attr("CHECKED","true")}else{return jS.controlFactory.input.getValue(cE.thisCell)}return o},RADIOVAL:function(v){return(s.editable?jQuery(v).find("input:checked").val():v)},CHECKBOX:function(v){if(s.editable){v=cE.foldPrepare(v,arguments)[0];var o=jS.controlFactory.input.checkbox(v,cE.thisCell);var checked=jS.controlFactory.input.getValue(cE.thisCell);if(checked=="true"||checked==true){o.attr("CHECKED","TRUE")}else{o.removeAttr("CHECKED")}return o}else{return jS.controlFactory.input.getValue(cE.thisCell)}},CHECKBOXVAL:function(v){return(s.editable?jQuery(cE.foldPrepare(v,arguments)).val():v)},ISCHECKED:function(v){var checked=jQuery(v).is(":checked");if(checked){return"TRUE"}else{return"FALSE"}}},CHART:{BAR:function(v,legend,axisLabels,w,h){return jS.controlFactory.chart(null,cE.foldPrepare(v,arguments),legend,axisLabels,w,h,cE.calcState.row-1)},BARH:function(v,legend,axisLabels,w,h){return jS.controlFactory.chart("bhg",cE.foldPrepare(v,arguments),legend,axisLabels,w,h,cE.calcState.row-1)},SBAR:function(v,legend,axisLabels,w,h){return jS.controlFactory.chart("bvs",cE.foldPrepare(v,arguments),legend,axisLabels,w,h,cE.calcState.row-1)},SBARH:function(v,legend,axisLabels,w,h){return jS.controlFactory.chart("bhs",cE.foldPrepare(v,arguments),legend,axisLabels,w,h,cE.calcState.row-1)},LINE:function(v,legend,axisLabels,w,h){return jS.controlFactory.chart("lc",cE.foldPrepare(v,arguments),legend,axisLabels,w,h,cE.calcState.row-1)},PIE:function(v,legend,axisLabels,w,h){return jS.controlFactory.chart("p",cE.foldPrepare(v,arguments),legend,axisLabels,w,h,cE.calcState.row-1)},PIETHREED:function(v,legend,axisLabels,w,h){return jS.controlFactory.chart("p3",cE.foldPrepare(v,arguments),legend,axisLabels,w,h,cE.calcState.row-1)},CUSTOM:function(type,v,legend,axisLabels,w,h){return jS.controlFactory.chart(type,cE.foldPrepare(v,arguments),legend,axisLabels,w,h,cE.calcState.row-1)}}},calcState:{},calc:function(cellProvider,context,startFuel){cE.calcState={cellProvider:cellProvider,context:(context!=null?context:{}),row:1,col:1,i:cellProvider.tableI,done:false,stack:[],calcMore:function(moreFuel){cE.calcState.fuel=moreFuel;return cE.calcLoop()}};return cE.calcState.calcMore(startFuel)},cell:function(){prototype:{getError=function(){return this.error},getValue=function(){return this.value},setValue=function(v,e){this.value=v;this.error=e},getFormula=function(){return this.formula},setFormula=function(v){this.formula=v},getFormulaFunc=function(){return this.formulaFunc},setFormulaFunc=function(v){this.formulaFunc=v},toString=function(){return"Cell:["+this.getFormula()+": "+this.getValue()+": "+this.getError()+"]"}}},columnLabelIndex:function(str){var num=0;for(var i=0;i\074str.length;i++){var digit=str.toUpperCase().charCodeAt(i)-65+1;num=(num*26)+digit}return num},parseLocation:function(locStr){if(locStr!=null\046\046locStr.length\0760\046\046locStr!="\046nbsp;"){for(var firstNum=0;firstNum\074locStr.length;firstNum++){if(locStr.charCodeAt(firstNum)\074=57){break}}return[parseInt(locStr.substring(firstNum)),cE.columnLabelIndex(locStr.substring(0,firstNum))]}else{return null}},columnLabelString:function(index){var b=(index-1).toString(26).toUpperCase();var c=[];for(var i=0;i\074b.length;i++){var x=b.charCodeAt(i);if(i\074=0\046\046b.length\0761){x=x-1}if(x\074=57){c.push(String.fromCharCode(x-48+65))}else{c.push(String.fromCharCode(x+10))}}return c.join("")},regEx:{n:/[\\$,\\s]/g,cell:/\\$?([a-zA-Z]+)\\$?([0-9]+)/g,range:/\\$?([a-zA-Z]+)\\$?([0-9]+):\\$?([a-zA-Z]+)\\$?([0-9]+)/g,remoteCell:/\\$?(SHEET+)\\$?([0-9]+):\\$?([a-zA-Z]+)\\$?([0-9]+)/g,remoteCellRange:/\\$?(SHEET+)\\$?([0-9]+):\\$?([a-zA-Z]+)\\$?([0-9]+):\\$?([a-zA-Z]+)\\$?([0-9]+)/g,sheet:/SHEET/,cellInsensitive:/\\$?([a-zA-Z]+)\\$?([0-9]+)/gi,rangeInsensitive:/\\$?([a-zA-Z]+)\\$?([0-9]+):\\$?([a-zA-Z]+)\\$?([0-9]+)/gi,remoteCellInsensitive:/\\$?(SHEET+)\\$?([0-9]+):\\$?([a-zA-Z]+)\\$?([0-9]+)/gi,remoteCellRangeInsensitive:/\\$?(SHEET+)\\$?([0-9]+):\\$?([a-zA-Z]+)\\$?([0-9]+):\\$?([a-zA-Z]+)\\$?([0-9]+)/gi,sheetInsensitive:/SHEET/i,amp:/\046/g,gt:/\074/g,lt:/\076/g,nbsp:/\046nbsp;/g},str:{amp:"\046amp;",lt:"\046lt;",gt:"\046gt;",nbsp:"\046nbps;"},parseFormula:function(formula,dependencies,thisTableI){var nrows=null;var ncols=null;if(cE.calcState.cellProvider!=null){nrows=cE.calcState.cellProvider.nrows;ncols=cE.calcState.cellProvider.ncols}formula=formula.replace(cE.regEx.remoteCellRange,function(ignored,TableStr,tableI,startColStr,startRowStr,endColStr,endRowStr){var res=[];var startCol=cE.columnLabelIndex(startColStr);var startRow=parseInt(startRowStr);var endCol=cE.columnLabelIndex(endColStr);var endRow=parseInt(endRowStr);if(ncols!=null){endCol=Math.min(endCol,ncols)}if(nrows!=null){endRow=Math.min(endRow,nrows)}for(var r=startRow;r\074=endRow;r++){for(var c=startCol;c\074=endCol;c++){res.push("SHEET"+(tableI)+":"+cE.columnLabelString(c)+r)}}return"["+res.join(",")+"]"});formula=formula.replace(cE.regEx.remoteCell,function(ignored,tableStr,tableI,colStr,rowStr){tableI=parseInt(tableI)-1;colStr=colStr.toUpperCase();if(dependencies!=null){dependencies["SHEET"+(tableI)+":"+colStr+rowStr]=[parseInt(rowStr),cE.columnLabelIndex(colStr),tableI]}return"(cE.calcState.cellProvider.getCell(("+(tableI)+"),("+(rowStr)+\'),"\'+(colStr)+\'").getValue())\'});formula=formula.replace(cE.regEx.range,function(ignored,startColStr,startRowStr,endColStr,endRowStr){var res=[];var startCol=cE.columnLabelIndex(startColStr);var startRow=parseInt(startRowStr);var endCol=cE.columnLabelIndex(endColStr);var endRow=parseInt(endRowStr);if(ncols!=null){endCol=Math.min(endCol,ncols)}if(nrows!=null){endRow=Math.min(endRow,nrows)}for(var r=startRow;r\074=endRow;r++){for(var c=startCol;c\074=endCol;c++){res.push(cE.columnLabelString(c)+r)}}return"["+res.join(",")+"]"});formula=formula.replace(cE.regEx.cell,function(ignored,colStr,rowStr){colStr=colStr.toUpperCase();if(dependencies!=null){dependencies["SHEET"+thisTableI+":"+colStr+rowStr]=[parseInt(rowStr),cE.columnLabelIndex(colStr),thisTableI]}return"(cE.calcState.cellProvider.getCell(("+thisTableI+"),("+(rowStr)+\'),"\'+(colStr)+\'").getValue())\'});return formula},parseFormulaStatic:function(formula){if(formula==null){return null}else{var formulaNum=formula.replace(cE.regEx.n,"");var value=parseFloat(formulaNum);if(isNaN(value)){value=parseInt(formulaNum)}if(isNaN(value)){value=(formula.charAt(0)=="\'"?formula.substring(1):formula)}return value}},calcLoop:function(){if(cE.calcState.done==true){return null}else{while(cE.calcState.fuel==null||cE.calcState.fuel\0760){if(cE.calcState.stack.length\0760){var workFunc=cE.calcState.stack.pop();if(workFunc!=null){workFunc(cE.calcState)}}else{if(cE.calcState.cellProvider.formulaCells!=null){if(cE.calcState.cellProvider.formulaCells.length\0760){var loc=cE.calcState.cellProvider.formulaCells.shift();cE.visitCell(cE.calcState.i,loc[0],loc[1])}else{cE.calcState.done=true;return null}}else{if(cE.visitCell(cE.calcState.i,cE.calcState.row,cE.calcState.col)==true){cE.calcState.done=true;return null}if(cE.calcState.col\076=cE.calcState.cellProvider.getNumberOfColumns(cE.calcState.row-1)){cE.calcState.row++;cE.calcState.col=1}else{cE.calcState.col++}}}if(cE.calcState.fuel!=null){cE.calcState.fuel-=1}}return cE.calcState.calcMore}},formula:null,formulaFunc:null,visitCell:function(tableI,r,c){var cell=cE.calcState.cellProvider.getCell(tableI,r,c);if(cell==null){return true}else{var value=cell.getValue();if(value==null){this.formula=cell.getFormula();if(this.formula){if(this.formula.charAt(0)=="="){this.formulaFunc=cell.getFormulaFunc();if(this.formulaFunc==null||this.formulaFunc.formula!=this.formula){this.formulaFunc=null;try{var dependencies={};var body=cE.parseFormula(this.formula.substring(1),dependencies,tableI);this.formulaFunc=function(){with(cE.fn){return eval(body)}};this.formulaFunc.formula=this.formula;this.formulaFunc.dependencies=dependencies;cell.setFormulaFunc(this.formulaFunc)}catch(e){cell.setValue(cE.ERROR+": "+e)}}if(this.formulaFunc){cE.calcState.stack.push(cE.makeFormulaEval(cell,r,c,this.formulaFunc));var dependencies=this.formulaFunc.dependencies;for(var k in dependencies){if(dependencies[k] instanceof Array\046\046(cE.checkCycles(dependencies[k][0],dependencies[k][1],dependencies[k][2])==true)){cell.setValue(cE.ERROR+": cycle detected");cE.calcState.stack.pop();return false}}for(var k in dependencies){if(dependencies[k] instanceof Array){cE.calcState.stack.push(cE.makeCellVisit(dependencies[k][2],dependencies[k][0],dependencies[k][1]))}}}}else{cell.setValue(cE.parseFormulaStatic(this.formula))}}}return false}},makeCellVisit:function(tableI,row,col){var fn=function(){return cE.visitCell(tableI,row,col)};fn.row=row;fn.col=col;return fn},thisCell:null,makeFormulaEval:function(cell,row,col,formulaFunc){cE.thisCell=cell;var fn=function(){var v="";try{v=formulaFunc();switch(typeof(v)){case"string":v=v.replace(cE.regEx.amp,cE.str.amp).replace(cE.regEx.lt,cE.str.lt).replace(cE.regEx.gt,cE.str.gt).replace(cE.regEx.nbsp,cE.str.nbsp)}cell.setValue(v)}catch(e){cE.makeError(cell,e)}};fn.row=row;fn.col=col;return fn},makeError:function(cell,e){var msg=cE.ERROR+": "+msg;e.message.replace(/\\d+\\.?\\d*, \\d+\\.?\\d*/,function(v,i){try{v=v.split(", ");msg=("Cell:"+cE.columnLabelString(parseInt(v[0])+1)+(parseInt(v[1]))+" not found")}catch(e){}});cell.setValue(msg)},checkCycles:function(row,col,tableI){for(var i=0;i\074cE.calcState.stack.length;i++){var item=cE.calcState.stack[i];if(item.row!=null\046\046item.col!=null\046\046item.row==row\046\046item.col==col\046\046tableI==cE.calcState.i){return true}}return false},foldPrepare:function(firstArg,theArguments){if(firstArg!=null\046\046firstArg instanceof Object\046\046firstArg.length!=null){return firstArg}else{return theArguments}},fold:function(arr,funcOfTwoArgs,result,castToN){for(var i=0;i\074arr.length;i++){result=funcOfTwoArgs(result,(castToN==true?cE.fn.N(arr[i]):arr[i]))}return result}};var $window=jQuery(window);jS.s=s;s.fnBefore();var o;var emptyFN=function(){};if(s.buildSheet){if(typeof(s.buildSheet)=="object"){o=s.buildSheet}else{if(s.buildSheet==true||s.buildSheet=="true"){o=jQuery(s.parent.html())}else{if(s.buildSheet.match(/x/i)){o=jS.controlFactory.sheet(s.buildSheet)}}}}s.parent.html("");s.width=s.parent.width();s.height=s.parent.height();if(s.log){s.parent.after(\'\074textarea id="\'+jS.id.log+\'" class="\'+jS.cl.log+\'" /\076\')}else{jS.log=emptyFN}if(!s.showErrors){cE.makeError=emptyFN}if(!jQuery.support.boxModel){s.boxModelCorrection=0}if(!jQuery.scrollTo){jS.followMe=emptyFN}jS.log("Startup");$window.resize(function(){s.width=s.parent.width();s.height=s.parent.height();jS.sheetSyncSize()});cE.fn=jQuery.extend(cE.fn,s.calculations);if(s.caseInsensitive){cE.regEx.cell=cE.regEx.cellInsensitive;cE.regEx.range=cE.regEx.rangeInsensitive;cE.regEx.remoteCell=cE.regEx.remoteCellInsensitive;cE.regEx.remoteCellRange=cE.regEx.remoteCellRangeInsensitive;cE.regEx.sheet=cE.regEx.sheetInsensitive;for(var k in cE.fn){var kLower=k.toLowerCase();if(kLower!=k){cE.fn[kLower]=cE.fn[k]}}}jS.openSheet(o);return jS},makeTable:{xml:function(b){var a=jQuery("\074div /\076");jQuery(b).find("document").each(function(t){var y=jQuery("\074table /\076");var x=0;var l=jQuery("\074colgroup /\076").appendTo(y);var d=jQuery("\074tbody /\076");var r=jQuery(this).find("metadata");var z=r.find("columns").text();var m=r.find("rows").text();var B=jQuery(this).attr("title");var A=jQuery(this).find("data");var e=r.find("col_widths").children();for(var t=0;t\074parseInt(jQuery.trim(z));t++){var n=parseInt(e.eq(t).text().replace("px",""));n=(n?n:120);x+=n;l.append(\'\074col width="\'+n+\'px" style="width: \'+n+\'px;" /\076\')}y.width(x).attr("title",B);for(var t=0;t\074m;t++){var u=A.find("r"+t);var p=(A.attr("h")+"").replace("px","");p=parseInt(p);var s=jQuery(\'\074tr height="\'+(p?p:18)+\'px" /\076\');for(var q=0;q\074z;q++){var f="\074td /\076";var h=u.find("c"+q);if(h){var o=h.text()+"";var k=h.attr("class");var v=h.attr("style");var g=h.attr("colspan");var c="";if(o.charAt(0)=="="){c=\' formula="\'+o+\'"\'}f="\074td"+c+(v?\' style="\'+v+\'"\':"")+(k?\' class="\'+k+\'"\':"")+(g?\' colspan="\'+g+\'"\':"")+(p?\' height="\'+p+\'px"\':"")+"\076"+o+"\074/td\076"}s.append(f)}d.append(s)}y.append(d).appendTo(a)});return a.children()},json:function(data,makeEval){sheet=(makeEval==true?eval("("+data+")"):data);var tables=jQuery("\074div /\076");for(var i=0;i\074sheet.length;i++){var colCount=parseInt(sheet[i].metadata.columns);var rowCount=parseInt(sheet[i].metadata.rows);title=sheet[i].metadata.title;title=(title?title:"Spreadsheet "+i);var table=jQuery("\074table /\076");var tableWidth=0;var colgroup=jQuery("\074colgroup /\076").appendTo(table);var tbody=jQuery("\074tbody /\076");if(sheet[i]["metadata"]["col_widths"]){for(var x=0;x\074colCount;x++){var w=120;if(sheet[i]["metadata"]["col_widths"]["c"+x]){var newW=parseInt(sheet[i]["metadata"]["col_widths"]["c"+x].replace("px",""));w=(newW?newW:120);tableWidth+=w}colgroup.append(\'\074col width="\'+w+\'px" style="width: \'+w+\'px;" /\076\')}}table.attr("title",title).width(tableWidth);for(var x=0;x\074rowCount;x++){var tr=jQuery("\074tr /\076").appendTo(table);tr.attr("height",(sheet[i]["data"]["r"+x].h?sheet[i]["data"]["r"+x].h:18));for(var y=0;y\074colCount;y++){var cell=sheet[i]["data"]["r"+x]["c"+y];var cur_val;var colSpan;var style;var cl;if(cell){cur_val=cell.value+"";colSpan=cell.colSpan+"";style=cell.style+"";cl=cell.cl+""}var cur_td=jQuery("\074td"+(style?\' style="\'+style+\'"\':"")+(cl?\' class="\'+cl+\'"\':"")+(colSpan?\' colspan="\'+colSpan+\'"\':"")+" /\076");try{if(typeof(cur_val)=="number"){cur_td.html(cur_val)}else{if(cur_val.charAt(0)=="="){cur_td.attr("formula",cur_val)}else{cur_td.html(cur_val)}}}catch(e){}tr.append(cur_td)}}tables.append(table)}return tables.children()},fromSize:function(m,e,k){if(!m){m="5x10"}m=m.toLowerCase().split("x");var b=parseInt(m[0]);var f=parseInt(m[1]);var l=jQuery("\074table /\076");var a="\074td\076\074/td\076";var d="";for(var c=b;c\076=1;c--){d+=a}var j="\074tr"+(e?\' height="\'+e+\'px" style="height: \'+e+\'px;"\':"")+"\076"+d+"\074/tr\076";var g="";for(var c=f;c\076=1;c--){g+=j}l.html("\074tbody\076"+g+"\074/tbody\076");if(k){l.width(b*k)}return l}},killAll:function(){if(jQuery.sheet){if(jQuery.sheet.instance){for(var a=0;a\074jQuery.sheet.instance.length;a++){if(jQuery.sheet.instance[a]){if(jQuery.sheet.instance[a].kill){jQuery.sheet.instance[a].kill()}}}}}}};var key={BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,ALT:18,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,F:70,V:86,Y:89,Z:90};</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -42,19 +42,19 @@
xmlns:metal="http://xml.zope.org/namespaces/metal"\n
xmlns:i18n="http://xml.zope.org/namespaces/i18n">\n
<tal:block metal:define-macro="master"\n
tal:define="css_list_jquery_template python:[\'jquery.sheet.css\',\n
tal:define="css_list_jquery_template python:[\'portal_skins/erp5_jquery/plugin/sheet/jquery.sheet.css\',\n
\'portal_skins/erp5_jquery/plugin/colorpicker/jquery.colorPicker.css\',\n
\'portal_skins/erp5_jquery/plugin/colorpicker/menu.css\',\n
];\n
js_list_jquery_template python:[\'portal_skins/erp5_jquery/core/jquery.js\',\n
\'jquery.sheet.js\',\n
\'portal_skins/erp5_jquery/plugin/sheet/jquery.sheet.js\',\n
\'portal_skins/erp5_jquery/plugin/mbmenu/mbMenu.min.js\',\n
\'portal_skins/erp5_jquery/ui/jquery-ui.js\',\n
\'portal_skins/erp5_jquery/plugin/jqcharts/jgcharts.min.js\',\n
\'portal_skins/erp5_jquery/plugin/colorpicker/jquery.colorPicker.min.js\',\n
\'http://jqueryui.com/themeroller/themeswitchertool/\',\n
\'portal_skins/erp5_jquery/plugin/elastic/jquery.elastic.min.js\',\n
\'jquery.sheet.erp5.js\',\n
\'portal_skins/erp5_jquery/plugin/sheet/jquery.sheet.erp5.js\',\n
];\n
global css_list css_list | python:[];\n
global js_list js_list | python:[];\n
......
......@@ -36,19 +36,18 @@
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<link rel="stylesheet" href="jquery.sheet.css" type="text/css"/>\n
<link rel="stylesheet" href="portal_skins/erp5_jquery/plugin/sheet/jquery.sheet.css" type="text/css"/>\n
<link rel="stylesheet" href="jquery.sheet.erp5.css" type="text/css"/>\n
<link rel="stylesheet" href="portal_skins/erp5_jquery/plugin/colorpicker/jquery.colorPicker.css" type="text/css"/>\n
<link rel="stylesheet" href="portal_skins/erp5_jquery/plugin/colorpicker/menu.css" type="text/css"/>\n
<script type="text/javascript" src="portal_skins/erp5_jquery/core/jquery.js"></script>\n
<script type="text/javascript" src="jquery.sheet.js"></script>\n
<script type="text/javascript" src="portal_skins/erp5_jquery/plugin/sheet/jquery.sheet.js"></script>\n
<script type="text/javascript" src="portal_skins/erp5_jquery/plugin/mbmenu/mbMenu.min.js"></script>\n
<script type="text/javascript" src="portal_skins/erp5_jquery/ui/jquery-ui.js"></script>\n
<script type="text/javascript" src="portal_skins/erp5_jquery/plugin/jqcharts/jgcharts.min.js"></script>\n
<script type="text/javascript" src="portal_skins/erp5_jquery/plugin/colorpicker/jquery.colorPicker.min.js"></script>\n
<script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>\n
<script type="text/javascript" src="portal_skins/erp5_jquery/plugin/elastic/jquery.elastic.min.js"></script>\n
<!--<script type="text/javascript" src="jquery.sheet.erp5.js"></script>-->\n
\n
<script type="text/javascript">\n
$("button.save").click(function(event){\n
......
erp5_jquery
erp5_jquery_plugin_mbmenu
erp5_jquery_plugin_sheet
erp5_jquery_ui
erp5_jquery_plugin_jqchart
erp5_jquery_plugin_colorpicker
......
9
\ No newline at end of file
11
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment