Permalink
Browse files

Major additions (see Changes.txt for specifics and bug fixes):

drag-repeat, drag handles for fill/move/slide (two new images),
foundation for startup macros and external commands,
added "edit:" to CtrlS for editing OtherSaveParts,
added socialcalcspreadsheetviewer.js for non-editing grid display.

Signed-off-by: DanBricklin <danb@bricklin.com>
  • Loading branch information...
1 parent b294728 commit 4594429c94d18f295616a9cf2839b5c554ba7d9c @DanBricklin committed May 13, 2010
View
@@ -613,6 +613,42 @@ Minor change to SocialCalc.special_chars to clean up regex. Not a bug, but a min
2009-11-03:
Added text format Wikitext to SCFormatTextFormats in socialcalcconstants.js
+2009-12-02:
+Added missing // to socialcalcspreadsheetcontrol.js setting of tabBackground.
+Set minOK to 0 just in case in formatnumber2.js.
+
+2010-01-14:
+Changed socialcalctableeditor.js to do auto-repeat in drag select.
+Made formula editing reset position of InputEcho after pointing in case cell position has changed.
+Added beginning of SocialCalc.CellHandles to socialcalctableeditor.js. Had test code, but now just returns.
+
+2010-02-09:
+Fixed bug where undo stack didn't always set changedrendervalues so moves/pastes/etc of merged cells messed up display
+
+2010-03-23:
+Finished changes to add editor.noEdit to socialcalctableeditor.js, including
+fixing thumb dragging to better handle mouse out of window, handling no socialcalcspreadsheetcontrol.js,
+etc.
+
+2010-03-25:
+Added socialcalcviewer.js.
+Fixed bug in SocialCalc.InitializeSpreadsheetControl that didn't take padding into account when sizing status line.
+
+2010-04-13:
+Added CmdExtensions to socialcalc-3.js, and the startcmdextension command.
+
+2010-05-07:
+Implemented drag handles for fill/move using a single image with a round, segmented palette. Added sc-drag-handles.png.
+
+2010-05-12:
+Added SocialCalc.CtrlSEditor to socialcalctableeditor.js and socialcalcspreadsheetcontrol.js.
+Use "edit:partname" command to edit, "edit:" to list all parts and contents. No text deletes part.
+Added SocialCalc.OtherSaveParts to socialcalcspreadsheetcontrol.js.
+This all gives us a way to set startup macros, etc.
+
+2010-05-13:
+Fixed IE6 and IE7+ compatibility issues with drag palette. Uses .gif for IE6, .png otherwise.
+
TO DO:
View
@@ -251,7 +251,7 @@ SocialCalc.FormatNumber.formatNumberWithFormat = function(rawvalue, format_strin
ymd = SocialCalc.FormatNumber.convert_date_julian_to_gregorian(Math.floor(rawvalue+scfn.datevalues.julian_offset));
- minOK; // says "m" can be minutes
+ minOK = 0; // says "m" can be minutes if true
mspos = sectioninfo.sectionstart; // m scan position in ops
for ( ; ; mspos++) { // scan for "m" and "mm" to see if any minutes fields, and am/pm
op = thisformat.operators[mspos];
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -3,7 +3,7 @@
// The module of the SocialCalc package with customizable constants, strings, etc.
// This is where most of the common localizations are done.
//
-// (c) Copyright 2008, 2009 Socialtext, Inc.
+// (c) Copyright 2008, 2009, 2010 Socialtext, Inc.
// All Rights Reserved.
//
// The contents of this file are subject to the Artistic License 2.0; you may not
@@ -223,6 +223,20 @@ SocialCalc.Constants = {
ietUnknownFunction: "Unknown function ", // displayed when typing "=unknown("
+ //** SocialCalc.CellHandles
+
+ s_CHfillAllTooltip: "Fill Contents and Formats Down/Right", // tooltip for fill all handle
+ s_CHfillContentsTooltip: "Fill Contents Only Down/Right", // tooltip for fill formulas handle
+ s_CHmovePasteAllTooltip: "Move Contents and Formats", // etc.
+ s_CHmovePasteContentsTooltip: "Move Contents Only",
+ s_CHmoveInsertAllTooltip: "Slide Contents and Formats within Row/Col",
+ s_CHmoveInsertContentsTooltip: "Slide Contents within Row/Col",
+ s_CHindicatorOperationLookup: {"Fill": "Fill", "FillC": "Fill Contents",
+ "Move": "Move", "MoveI": "Slide",
+ "MoveC": "Move Contents", "MoveIC": "Slide Contents"}, // short form of operation to follow drag
+ s_CHindicatorDirectionLookup: {"Down": " Down", "Right": " Right",
+ "Horizontal": " Horizontal", "Vertical": " Vertical"}, // direction that modifies operation during drag
+
//*** SocialCalc.TableControl
defaultTCSliderThickness: 9, // length of pane slider (numeric in pixels)
@@ -241,12 +255,12 @@ SocialCalc.Constants = {
s_panesliderTooltipv: "Drag to lock pane horizontally",
TClessbuttonStyle: "backgroundColor:#AAA;",
TClessbuttonClass: "",
- TClessbuttonRepeatWait: 500, // in milliseconds
- TClessbuttonRepeatInterval: 100, // in milliseconds
+ TClessbuttonRepeatWait: 300, // in milliseconds
+ TClessbuttonRepeatInterval: 20,//100, // in milliseconds
TCmorebuttonStyle: "backgroundColor:#AAA;",
TCmorebuttonClass: "",
- TCmorebuttonRepeatWait: 500, // in milliseconds
- TCmorebuttonRepeatInterval: 100, // in milliseconds
+ TCmorebuttonRepeatWait: 300, // in milliseconds
+ TCmorebuttonRepeatInterval: 20,//100, // in milliseconds
TCscrollareaStyle: "backgroundColor:#DDD;",
TCscrollareaClass: "",
TCscrollareaRepeatWait: 500, // in milliseconds
@@ -511,6 +525,15 @@ SocialCalc.Constants = {
s_loc_Xselect_rangeX: "[select range]",
//
+// SocialCalc Spreadsheet Viewer module, socialcalcviewer.js:
+//
+
+ //*** SocialCalc.SpreadsheetViewer
+
+ SVStatuslineheight: 20, // in pixels
+ SVStatuslineCSS: "font-size:10px;padding:3px 0px;",
+
+//
// SocialCalc Format Number module, formatnumber2.js:
//
View
@@ -27,6 +27,7 @@
my $titlestr = "SocialCalc Server $versionstr";
my $jsdir = "/sgi/scjs/"; # The subdirectory of the server home page (when run thru CGI)
# where the .js files are, and ./images/ subdirectory.
+ my $imagedir = "/images/sc-";
#
# This whole first section lets this code run either as a CGI script on a server
@@ -36,7 +37,7 @@
#
if ($ENV{REQUEST_METHOD}) { # being run as a CGI on a server
- print "Content-type: text/html\n\n";
+ print "Content-type: text/html\n\n";
my $q = new CGI;
print process_request($q);
exit;
@@ -84,9 +85,9 @@
undef($c);
exit;
}
- if ($uri =~ /\/([a-z\-0-9]+)\.(gif|js|css)$/) { # ok request
+ if ($uri =~ /\/([a-z\-0-9]+)\.(gif|js|css|png)(\?.*)*$/) { # ok request
$uri = "$1.$2";
- $uri = "images/$uri" if $2 eq "gif";
+ $uri = "images/$uri" if ($2 eq "gif" || $2 eq "png");
# if ($2 eq "js") {
# $res->content_type("text/html; charset=UTF-8");
# }
@@ -229,6 +230,20 @@ sub process_request {
"Saved updated '$pagename'.<br>";
}
+ if ($q->param('filecontents')) { # return contents of file
+ my $fileurl = $q->param('filecontents');
+
+ open (PAGEFILEIN, "$fileurl");
+ my $filestr;
+ while (my $line = <PAGEFILEIN>) {
+ $filestr .= $line;
+ }
+ close PAGEFILEIN;
+print $filestr;
+ return $filestr;
+
+ }
+
$response = do_displaypage($q, $pagename, $statusmessage); # Otherwise, display page
return $response;
@@ -327,6 +342,8 @@ sub start_editsheet {
}
$sheetstr = special_chars($sheetstr);
+ close PAGEFILEIN;
+
$response = <<"EOF"; # output page with edit JS code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
@@ -369,12 +386,15 @@ sub start_editsheet {
// start everything
- SocialCalc.Constants.defaultImagePrefix = "$jsdir/images/sc-";
- SocialCalc.Popup.imagePrefix = "$jsdir/images/sc-";
+ SocialCalc.Constants.defaultImagePrefix = "$jsdir$imagedir";
+ SocialCalc.Popup.imagePrefix = "$jsdir$imagedir";
var spreadsheet = new SocialCalc.SpreadsheetControl();
spreadsheet.InitializeSpreadsheetControl("tableeditor", 0, 0, 0);
+ SocialCalc.SheetCommandInfo.CmdExtensionCallbacks.docmd = {func:docmdext, data:spreadsheet};
+ SocialCalc.SheetCommandInfo.CmdExtensionCallbacks.loadclipboard = {func:doloadclipboardext, data:spreadsheet};
+
var savestr = document.getElementById("sheetdata").value;
var parts = spreadsheet.DecodeSpreadsheetSave(savestr);
if (parts) {
@@ -385,6 +405,9 @@ sub start_editsheet {
if (parts.edit) {
spreadsheet.editor.LoadEditorSettings(savestr.substring(parts.edit.start, parts.edit.end));
}
+ if (parts.startupmacro) {
+ spreadsheet.editor.EditorScheduleSheetCommands(savestr.substring(parts.startupmacro.start, parts.startupmacro.end), false, true);
+ }
}
if (spreadsheet.sheet.attribs.recalc=="off") {
spreadsheet.sheet.attribs.needsrecalc = "yes"; // default turn it on
@@ -394,6 +417,123 @@ sub start_editsheet {
spreadsheet.ExecuteCommand('recalc', '');
}
+function docmdext (name, data, sheet, cmd, saveundo) {
+
+ var cmdstr = cmd.RestOfString();
+ data.editor.EditorScheduleSheetCommands(cmdstr, false, false);
+ SocialCalc.SheetCommandInfo.cmdextensionbusy = "Do Cmd Ext "+cmdstr;
+
+ window.setTimeout(function(){SocialCalc.ResumeFromCmdExtension();}, 100);
+
+ }
+
+function doloadclipboardext (name, data, sheet, cmd, saveundo) {
+
+ var cmdstr = cmd.RestOfString();
+ SocialCalc.SheetCommandInfo.cmdextensionbusy = "Load Clipboard Ext "+cmdstr;
+
+ loaddata(cmdstr);
+
+// window.setTimeout(function(){SocialCalc.ResumeFromCmdExtension();}, 100);
+// SocialCalc.ResumeFromCmdExtension();
+ }
+
+var loaddatatimerobj;
+
+function loaddata(url) {
+
+ var loadscript = document.createElement("script");
+ loadscript.type = "text/javascript";
+ loadscript.src = url+"?"+((new Date()).getTime()+'0');
+ document.body.appendChild(loadscript);
+
+ loaddatatimerobj = window.setTimeout(loaddatatimeout, 4000);
+
+ }
+
+function doloaddataload(val) {
+
+ if (loaddatatimerobj) {
+ window.clearTimeout(loaddatatimerobj);
+ loaddatatimerobj = null;
+ }
+
+ var sview = SocialCalc.GetSpreadsheetControlObject();
+ parts = sview.DecodeSpreadsheetSave(val);
+ if (parts) {
+ if (parts.sheet) {
+ SocialCalc.Clipboard.clipboard = SocialCalc.decodeFromSave(val.substring(parts.sheet.start, parts.sheet.end));
+ }
+ }
+// window.setTimeout(function(){SocialCalc.ResumeFromCmdExtension();}, 100);
+ SocialCalc.ResumeFromCmdExtension();
+ }
+
+function loaddatatimeout() {
+
+ if (loaddatatimerobj) {
+ window.clearTimeout(loaddatatimerobj);
+ loaddatatimerobj = null;
+ }
+
+ window.setTimeout(function(){SocialCalc.ResumeFromCmdExtension();}, 10);
+
+ }
+
+// Remote data lookup demo code
+
+var loadtimerobj;
+
+function loadsheet(sheetname) {
+
+ var matches = sheetname.match(/^\\{scdata\\:\\s+(.+?)\\}\$/); // {scdata: URL w/o http://)
+
+ if (!matches) {
+ return false;
+ }
+
+ var loadscript = document.createElement("script");
+ loadscript.type = "text/javascript";
+ loadscript.src = "http://"+matches[1]+"?"+((new Date()).getTime()+'0');
+ document.body.appendChild(loadscript);
+
+ loadtimerobj = window.setTimeout(loadframetimeout, 4000);
+
+ return true;
+ }
+
+SocialCalc.RecalcInfo.LoadSheet = loadsheet;
+
+function doloadframeload(val) {
+
+ if (loadtimerobj) {
+ window.clearTimeout(loadtimerobj);
+ loadtimerobj = null;
+ }
+
+ var sview = SocialCalc.GetSpreadsheetControlObject();
+ parts = sview.DecodeSpreadsheetSave(val);
+ if (parts) {
+ if (parts.sheet) {
+ SocialCalc.RecalcLoadedSheet(null, val.substring(parts.sheet.start, parts.sheet.end), true); // notify recalc loop
+ }
+ }
+ if (val=="") {
+ SocialCalc.RecalcLoadedSheet(null, "", true); // notify recalc loop that it's not available, but that we tried
+ }
+ }
+
+function loadframetimeout() {
+
+ if (loadtimerobj) {
+ window.clearTimeout(loadtimerobj);
+ loadtimerobj = null;
+ }
+
+ SocialCalc.RecalcLoadedSheet(null, "", true); // notify recalc loop that it's not available, but that we tried
+
+ }
+
</script>
</body>
</html>
@@ -467,8 +607,8 @@ sub start_viewsheet {
var spreadsheet = new SocialCalc.SpreadsheetControl();
- SocialCalc.Constants.defaultImagePrefix = "$jsdir/images/sc-";
- SocialCalc.Popup.imagePrefix = "$jsdir/images/sc-";
+ SocialCalc.Constants.defaultImagePrefix = "$jsdir$imagedir";
+ SocialCalc.Popup.imagePrefix = "$jsdir$imagedir";
var savestr = document.getElementById("sheetdata").value;
var parts = spreadsheet.DecodeSpreadsheetSave(savestr);
Oops, something went wrong.

0 comments on commit 4594429

Please sign in to comment.