App-SocialCalc-Multiplayer

 view release on metacpan or  search on metacpan

socialcalc/socialcalc2demo-0-8-1.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.8.1</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='&nbsp;';"></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.">&nbsp;</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.">'+
      ' <table cellspacing="0" cellpadding="0"><tr>'+
      '   <td style="vertical-align:middle;padding-right:32px;padding-left:16px;">'+
      '    <div style="%tbt.">Cells to Graph</div>'+
      '    <div id="%id.graphrange" style="font-weight:bold;">Not Set</div>'+
      '   </td>'+
      '  <td style="vertical-align:top;padding-right:32px;">'+

socialcalc/socialcalc2demo-0-8-1.html  view on Meta::CPAN

        'The <b>Graph</b> tab displays a very simple bar graph representation of the cells currently selected as a range to graph '+
        '(either in a single row across or column down). '+
        'If the range is a single row or column, and if the row above (or column to the left) has values, those values are used as labels. '+
        'Otherwise the cell coordinates are used (e.g., B5). '+
        'This is a very early, minimal implementation for demonstration purposes. '+
         '<br><br><input type="button" value="Hide Help" onclick="DoGraph(false);">';

      gview.innerHTML = str;

      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 = (spreadsheet.height-spreadsheet.nonviewheight)-50;
   totalwidth = spreadsheet.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 = spreadsheet.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 = spreadsheet.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%">&nbsp;</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.8.1<br><br> '+
'<i>This is a spreadsheet built on SocialCalc JavaScript code. '+
'</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. '+
'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 '+
'available on the Format tab. '+
'<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 when you click the "f()" button on the formula bar.</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. '+
'You can, for example, have a function like IF(B10=B3, "Yes", "No"), where B10 and B3 may contain text values '+



( run in 0.424 second using v1.01-cache-2.11-cpan-7f9471e7e0a )