Permalink
Browse files

several fixes

  • Loading branch information...
1 parent 6e64d79 commit 1fbc24b8215c9f21355628ac0cf20ce736329a47 @raphaelschroiff committed Nov 2, 2012
View
19 app.js
@@ -150,6 +150,9 @@ function addUser(docName, agent, callback) {
}
});
}
+ else {
+ callback(null);
+ }
}
});
}
@@ -177,11 +180,6 @@ function removeUser(docName, userName) {
}
//disconnect the user and remove him from the list in the documentDict
delete documentDict[docName].users[userName];
-
- if (Object.keys(documentDict[docName].users).length === 0) {
- //no users editing the document - remove it
- removeDocument(docName);
- }
}
});
}
@@ -261,18 +259,17 @@ var options = {
}
else if (action.name == 'open') {
//addUser(action.docName, agent);
+ if (documentDict[action.docName]) {
+ documentDict[action.docName].state = "open";
+ }
+
addUser(action.docName, agent, function(error) {
if (error) {
console.log(error);
}
- console.log('user '+ agent.name + ' added');
- action.accept();
});
- if (documentDict[action.docName]) {
- documentDict[action.docName].state = "open";
- }
-
+ action.accept();
}
else if (action.name == 'create') {
action.accept();
View
@@ -3,9 +3,10 @@
"node":"0.8",
"author":"Raphael Schroiff",
"dependencies": {
- "share": "0.5",
- "request": "2.0",
- "express": "3.0",
- "color-convert": ""
+ "share": ">=0.5",
+ "request": ">=2.0",
+ "express": ">=3.0",
+ "color-convert": ">=0.3.1",
+ "hbs": ">=1.0.7"
}
}
View
@@ -1,13 +1,16 @@
$(function() {
var userName = $.cookie('userName');
- if (!userName) {
- $('#userNameInput').value(userName);
+ if (userName) {
+ $('#userNameInput').val(userName);
}
-
- $('#userNameButton')
+ $('#createDocButton')
.button()
.click(function( event ) {
- $.cookie('userName', $('#userNameInput').value(), { expires: 7, path: '/' });
+ document.location.href = 'spreadsheet/'+$('#docNameInput').val();
});
+
+ $('#userNameInput').change(function() {
+ $.cookie('userName', $('#userNameInput').val(), { expires: 7, path: '/' });
+ });
});
View
@@ -1,25 +1,9 @@
var sharejs_doc;
var PING_INTERVAL = 5; //in seconds
var connection;
-var userName = 'TestUser';
+var userName;
var sheetEditable = true;
-/**
- * get the value of a cookie
- * @param {String} name the name of the cookie
- */
-function readCookie(name) {
- var nameEQ = name + "=";
- var ca = document.cookie.split(';');
- for(var i=0;i < ca.length;i++) {
- var c = ca[i];
- while (c.charAt(0)==' ') c = c.substring(1,c.length);
- if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length,c.length);
- }
- return null;
-}
-
-
$(function() {
//create the dialog which will be shown on disconnect
@@ -35,14 +19,18 @@ $(function() {
$("#disconnectedDialog p").text(spreadsheetTexts.misc.disconnectMessage);
$("#disconnectedDialog").dialog(dialog_options);
+ userName = $.cookie('userName');
+
//open the shareJS document and initiate the jQuery.sheet
connection = sharejs.open(docName, 'json', {authentication: userName}, function(error, doc) {
sharejs_doc = doc;
//Setup Ping to the RT-server to indicate that the connection is still alive
setInterval(function () {
var op = {p:['users', userName, 'connected'], oi:true};
- sharejs_doc.submitOp(op);
+ if (sharejs_doc.snapshot.users[userName]) {
+ sharejs_doc.submitOp(op);
+ }
}, PING_INTERVAL * 1000);
//initialize the sheet contents
@@ -762,18 +750,14 @@ function updateUserList() {
//diaplay the current user in the first item
color = '#6089af';
- item = $(userName + ' (Ich)');
- item.css('color', color);
- $('<li></li>').css('color', color).append(item).appendTo($('#userList'));
+ $('<li>' + userName + ' (Ich)</li>').css('color', color).appendTo($('#userList'));
for (name in users) {
if (name && users.hasOwnProperty(name)) {
userCount++;
if (name != userName) {
- item = $(name);
- item.css('color', users[name].color);
- $('<li></li>').css('color', users[name].color).append(item).appendTo($('#userList'));
+ $('<li>' + name + '</li>').css('color', users[name].color).appendTo($('#userList'));
}
}
Deleted file not rendered
@@ -53,7 +53,7 @@
/* Component containers
----------------------------------*/
-.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
+.ui-widget { font-family: Verdana,Arial,sans-serif; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #b8b8b8; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }
@@ -213,7 +213,7 @@
.jSheet tr td.jSheetCellLocked
{
- background-image: url(../../stripes.png);
+ background-image: url(../../jQuery.sheet/images/stripes.png);
background-repeat: repeat;
}
.jSheetError {
@@ -2676,7 +2676,7 @@ jQuery.sheet = {
resize: function() {// add resizable jquery.ui if available
// resizable container div
jS.resizable(s.parent, {
- handles: 'e',
+ //handles: 'se',
minWidth: s.width * 0.5,
minHeight: s.height * 0.5,
Deleted file not rendered
@@ -5,13 +5,12 @@ body {
padding-bottom: 100px;
color: black;
font-family: sans-serif;
- font-size: 10px;
+ font-size: 10pt;
}
.jQuerySheet {
- /*float: left;*/
width: 80%;
- max-width: 810px;
+ left: 2em;
}
/*.jSheetControls_formula {
@@ -38,12 +37,31 @@ body {
#userDialog p {
margin: 2px;
padding-left: 4px;
+ font-size: 8pt;
}
#userList {
font-size: 10pt;
}
+#startDialog {
+
+ padding: 8pt;
+}
+
+#dialogWrapper {
+ width: 350px;
+ position: relative;
+ left: 50%;
+ margin-left: -175px;
+}
+
+#mainWrapper {
+ margin-left: auto;
+ margin-top: 2em;
+ margin-right: auto;
+}
+
.ui-autocomplete {
max-height: 100px;
overflow-y: auto;
View
@@ -1,22 +1,22 @@
-<link rel="stylesheet" type="text/css" href="../../jQuery.sheet/jquery-ui/theme/jquery-ui.css" />
-
<script type="text/javascript" src="../../code/index.js"></script>
<div id="mainWrapper" class="ui-corner-all wrapper">
- <div class="ui-corner-all">
- <p>Wie heißt du?</p>
- <input type="text" id="userNameInput"/>
+ <div id="dialogWrapper">
+ <div id="startDialog" class="ui-widget-content ui-corner-all">
+ <p>Gib bitte deinen Namen an, damit andere Nutzer sehen wer mit ihnen zusammenarbeitet:</p>
+ <input type="text" id="userNameInput" class="ui-widget-content ui-corner-all"/>
- <p>Öffne eine der Vorhandenen Tabellen</p>
- <ul id="documentList">
- {{#each documents}}
- <li><a href="spreadsheet/{{this}}">{{this}}</a></li>
- {{/each}}
- </ul>
+ <p>Öffne eine der vorhandenen Tabellen</p>
+ <ul id="documentList">
+ {{#each documents}}
+ <li><a href="spreadsheet/{{this}}">{{this}}</a></li>
+ {{/each}}
+ </ul>
- <p>Oder erstelle eine neue:</p>
- <input type="text" id="docNameInput"/>
- <button id="createDocButton">Erstellen</button>
+ <p>Oder erstelle eine neue:</p>
+ <input type="text" id="docNameInput" class="ui-widget-content ui-corner-all"/>
+ <button id="createDocButton">Erstellen</button>
+ </div>
</div>
</div>
View
@@ -2,7 +2,9 @@
<head>
<title>{{title}}</title>
<link rel='stylesheet' href='/stylesheets/style.css'>
+ <link rel="stylesheet" type="text/css" href="../../jQuery.sheet/jquery-ui/theme/jquery-ui.css" />
<script type="text/javascript" src="../../jQuery.sheet/jquery-1.6.4.js"></script>
+ <script type="text/javascript" src="../../jQuery.sheet/jquery-ui/ui/jquery-ui.min.js"></script>
<script src="../../jQuery.sheet/jquery.cookie.js"></script>
</head>
<body>
View
@@ -1,29 +1,22 @@
<link rel="stylesheet" type="text/css" href="../../jQuery.sheet/jquery.sheet.css" />
-<link rel="stylesheet" type="text/css" href="../../jQuery.sheet/jquery-ui/theme/jquery-ui.css" />
<script type="text/javascript" src="../../jQuery.sheet/jquery.sheet.js"></script>
<script type="text/javascript" src="../../jQuery.sheet/parser.js"></script>
<script type="text/javascript" src="../../jQuery.sheet/lang_de.js"></script>
-<!--jQuery UI-->
- <script type="text/javascript" src="../../jQuery.sheet/jquery-ui/ui/jquery-ui.min.js"></script>
-<!--/jQuery UI-->
<!--Raphaeljs - for charts-->
- <script type="text/javascript" src="../../jQuery.sheet/plugins/raphael-min.js"></script>
- <script type="text/javascript" src="../../jQuery.sheet/plugins/g.raphael-min.js"></script>
-<!--/Raphaeljs-->
+<script type="text/javascript" src="../../jQuery.sheet/plugins/raphael-min.js"></script>
+<script type="text/javascript" src="../../jQuery.sheet/plugins/g.raphael-min.js"></script>
+
<!--ColorPicker-->
- <link rel="stylesheet" type="text/css" href="../../jQuery.sheet/plugins/jquery.colorPicker.css" />
- <script type="text/javascript" src="../../jQuery.sheet/plugins/jquery.colorPicker.min.js"></script>
-<!--/ColorPicker-->
-<!--Elastic->
- <script type="text/javascript" src="../../jQuery.sheet/plugins/jquery.elastic.min.js"></script>
-<!--/Elastic-->
+<link rel="stylesheet" type="text/css" href="../../jQuery.sheet/plugins/jquery.colorPicker.css" />
+<script type="text/javascript" src="../../jQuery.sheet/plugins/jquery.colorPicker.min.js"></script>
+
<!--Advanced_Math-->
- <script type="text/javascript" src="../../jQuery.sheet/jquery.sheet.advancedfn.js"></script>
-<!--/Advanced_Math-->
+<script type="text/javascript" src="../../jQuery.sheet/jquery.sheet.advancedfn.js"></script>
+
<!--Finance-->
- <script type="text/javascript" src="../../jQuery.sheet/jquery.sheet.financefn.js"></script>
-<!--/Finance-->
+<script type="text/javascript" src="../../jQuery.sheet/jquery.sheet.financefn.js"></script>
+
<script type="text/javascript" src="../../channel/bcsocket.js"></script>
<script type="text/javascript" src="../../share/share.uncompressed.js"></script>

0 comments on commit 1fbc24b

Please sign in to comment.