App-SocialCalc-Multiplayer
view release on metacpan or search on metacpan
socialcalc/socialcalc2demo10.html view on Meta::CPAN
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SocialCalc 0.7.10</title>
<script type="text/javascript" src="socialcalcconstants.js"></script>
<script type="text/javascript" src="socialcalc-3.js"></script>
<script type="text/javascript" src="socialcalctableeditor.js"></script>
<script type="text/javascript" src="formatnumber2.js"></script>
<script type="text/javascript" src="formula1.js"></script>
<script type="text/javascript" src="socialcalcpopup.js"></script>
<script type="text/javascript" src="socialcalcspreadsheetcontrol.js"></script>
<style>
body, td, input, texarea {font-family:verdana,helvetica,sans-serif;font-size:small;}
.smaller {font-size:smaller;}
</style>
</head>
<body style="background-color:#FFF;" onresize="spreadsheet.DoOnResize();">
<div style="margin:8px 0px 10px 0px;">
<div id="tableeditor" style="margin:8px 0px 10px 0px;">editor goes here</div>
</div>
<div id="msg" onclick="this.innerHTML=' ';"></div>
<script>
function addmsg(str) {document.getElementById("msg").innerHTML += ", "+str;}
function setmsg(str) {document.getElementById("msg").innerHTML = str;}
// window.onerror = function(m, u, l){ addmsg(m+" at line "+l); return true;};
// Create the spreadsheet control, but don't initialize yet
var spreadsheet = new SocialCalc.SpreadsheetControl();
var savestr = "";
// Set up the tabs we want
// Remove Audit
spreadsheet.tabs.splice(spreadsheet.tabnums.audit, 1);
spreadsheet.tabnums = {};
for (var i=0; i<spreadsheet.tabs.length; i++) {
spreadsheet.tabnums[spreadsheet.tabs[i].name] = i;
}
// Add Plain
spreadsheet.tabnums.plain = spreadsheet.tabs.length;
spreadsheet.tabs.push({name: "plain", text: "Plain", html:
'<div id="%id.plaintools" style="display:none;">'+
' <div style="%tbt."> </div>'+
'</div>',
view: "plain",
onclick:
function(s, t) {
s.views.plain.element.innerHTML = s.CreateSheetHTML();
},
onclickFocus: true
});
spreadsheet.views["plain"] = {name: "plain",
divStyle: "border:1px solid black;overflow:auto;",
html: 'Plain View'
};
// Add Graph
spreadsheet.tabnums.graph = spreadsheet.tabs.length;
spreadsheet.tabs.push({name: "graph", text: "Graph", html:
'<div id="%id.graphtools" style="display:none;">'+
' <div style="%tbt."> </div>'+
'</div>',
view: "graph",
onclick: DoGraph,
onclickFocus: true
});
socialcalc/socialcalc2demo10.html view on Meta::CPAN
var maxheight, totalwidth, color, nitems, byrow, maxval, minval, i, cr, cr1, cell, val, extra, eachwidth, str, thisbar;
var values = [];
var labels = [];
var range = objs.editor.range;
var gview = objs.views.graph.element;
if (!range.hasrange) {
gview.innerHTML = '<div style="padding:30px;font-weight:bold;">Select a range of cells with numeric values to graph.</div>';
return;
}
if (range.left==range.right) { // down
nitems = range.bottom - range.top + 1;
byrow = true;
}
else {
nitems = range.right - range.left + 1;
byrow = false;
}
str = "";
maxheight = (objs.height-objs.nonviewheight)-50;
totalwidth = objs.width-30;
color = "#666";
minval = null;
maxval = null;
for (i=0; i<nitems; i++) {
cr = byrow ? SocialCalc.rcColname(range.left)+(i+range.top) : SocialCalc.rcColname(i+range.left)+range.top;
cr1 = byrow ? SocialCalc.rcColname(range.left-1 || 1)+(i+range.top) : SocialCalc.rcColname(i+range.left)+(range.top-1 || 1);
cell = objs.sheet.GetAssuredCell(cr);
if (cell.valuetype.charAt(0) == "n") {
val = cell.datavalue - 0;
if (maxval==null || maxval<val) maxval = val;
if (minval==null || minval>val) minval = val;
values.push(val);
cell = objs.sheet.GetAssuredCell(cr1);
if ((range.right==range.left || range.top==range.bottom) && (cell.valuetype.charAt(0) == "t" || cell.valuetype.charAt(0) == "n")) {
labels.push(cell.datavalue+"");
}
else {
labels.push(cr);
}
}
}
extra = (maxval-minval)*0.1;
minval = minval - (extra || 1);
eachwidth = Math.floor(totalwidth / (values.length || 1))-4 || 1;
str += '<table cellspacing="0" cellpadding="0" width="'+totalwidth+'"><tr>';
for (i=0; i<values.length; i++) {
thisbar = Math.floor((values[i]-minval)*maxheight/(maxval-minval || 1))+1;
val = (values[i]+"").substring(0,7);
str += '<td valign="bottom" style="padding-right:4px;"><table cellspacing="0" cellpadding="0" width="'+eachwidth+'">';
str += '<tr><td align="center" style="font-size:7pt;">'+val+'</td></tr>';
str += '<tr><td><div style="height:'+thisbar+'px;background-color:'+color+';width:100%"> </div></td></tr>';
str += '</table></td>';
}
str += "</tr><tr>";
for (i=0; i<values.length; i++) {
str += '<td align="center" valign="top" style="font-size:8pt;font-weight:bold;padding-top:6px;">'+labels[i]+'</td>';
}
str += "</tr></table>";
gview.innerHTML = str;
}
// This is where loading help text might go:
function DoHelp(s, t) {
var hview = s.views.help.element;
var str =
'HELP TEXT FOLLOWED BY ABOUT TEXT AND LEGAL INFORMATION:<br><br> '+
'Version 0.7.10<br><br> '+
'<i>This is an early version of a spreadsheet built on SocialCalc JavaScript code, still in development. '+
'</i> '+
'<br><br> '+
'You can use the arrow keys and mouse to select cells in a manner similar to traditional spreadsheets. '+
'This includes using the shift key, as well as dragging. '+
'<br><br> '+
'The scrollbars should work in a normal manner. '+
'Because this is a spreadsheet, you can scroll any amount without needing to create new rows or columns. '+
'Dragging the thumb to the end of a scrollbar attempts to go to the last row or column where there is/was data. '+
'The mousewheel is also supported. '+
'<br><br> '+
'In addition to the scrollbars there are two pane sliders (that start out at the beginning of the scrollbars) '+
'that let you "lock" the upper rows or columns to facilitate keeping column and row headers visible when scrolling. '+
'<br><br> '+
'You can type values in cells. '+
'An input box will pop up. It may be moved by dragging the top of the box. '+
'Press Enter, use an arrow key, or click on a cell to finish. '+
'If you are in a partial formula (e.g., "=1+" or "=SUM(") an arrow key or cell click will '+
'insert the name of the newly selected cell into the formula, similar to a traditional spreadsheet. '+
'Cell ranges are separated by typing a ":", or you can use the drag or shift-click range selection methods. '+
'<br><br> '+
'The program supports many forms of data, such as numbers, text (preceded by a "\'" if necessary '+
'to distinguish it from numbers), dates (e.g., "1/2/3"), dollars ("$1,234.50"), time ("3:45"), '+
'numbers with fractions ("1 1/2"), and "true", "false", and "#N/A". '+
'A value\'s type determines its displayed format if there is no explicit numeric format set for a cell. '+
'The program supports a wide variety of formats (including other currencies) through its custom format functionality, '+
'but this early release only has several that are hardcoded in for you to select from the UI. '+
'<br><br> '+
'Use the Esc key to cancel during edits. '+
'The Del key deletes the values of the selected cell(s). '+
'<br><br> '+
'The 109 formula functions that the June 2007 Open Document Format "Open Formula" specification '+
'calls the "small group" are available. '+
'(<b><i>A simple reference to all of the functions is provided below.</i></b>) '+
'The specification says that: "This group includes approximately 100 functions, '+
'and includes the basic functions that are very widely implemented in spreadsheet applications, '+
'even in resource-constrained environments."<br><br> '+
'The definitions of the functions follow common conventions, '+
'with common syntax similar to many other spreadsheets. '+
( run in 1.815 second using v1.01-cache-2.11-cpan-ceb78f64989 )