Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update to 0.2 with many features and fixes added

  • Loading branch information...
commit 748d216a17883934eaa8cdc62934690f4d83d0df 1 parent d6f83a4
@namjul authored
Showing with 7,463 additions and 1,483 deletions.
  1. +378 −143 app.js
  2. +225 −173 controllers/websockets.js
  3. +0 −214 logics/rooms.js
  4. +54 −2 models/model-native-driver.js
  5. +1 −1  public/css/reset.css
  6. +643 −204 public/css/style.css
  7. +755 −282 public/css/style.less
  8. BIN  public/fonts/aller_it-webfont.eot
  9. +228 −0 public/fonts/aller_it-webfont.svg
  10. BIN  public/fonts/aller_it-webfont.ttf
  11. BIN  public/fonts/aller_it-webfont.woff
  12. BIN  public/fonts/aller_rg-webfont.eot
  13. +229 −0 public/fonts/aller_rg-webfont.svg
  14. BIN  public/fonts/aller_rg-webfont.ttf
  15. BIN  public/fonts/aller_rg-webfont.woff
  16. BIN  public/images/deskButton.jpg
  17. BIN  public/images/deskInput.jpg
  18. BIN  public/images/ilumaBack Kopie.png
  19. BIN  public/images/ilumaBack.png
  20. BIN  public/images/secure.png
  21. +92 −0 public/js/home.js
  22. +1,323 −435 public/js/script.js
  23. +317 −0 public/js/uploader.js
  24. +7 −0 public/lib/cufon-yui.js
  25. +1,444 −0 public/lib/cufon.js
  26. +8 −0 public/lib/font.js
  27. +1,493 −0 public/lib/handlebars.1.0.0.beta.3.js
  28. +18 −0 public/lib/jquery-1.6.2.min.js
  29. +79 −0 public/lib/jquery-mousewheel.js
  30. +1 −1  views/brokenfile.jade
  31. +50 −8 views/home.jade
  32. +27 −12 views/index.jade
  33. +78 −8 views/layout.jade
  34. +13 −0 views/password.jade
View
521 app.js
@@ -1,4 +1,4 @@
-// sharedesk.js 0.1.x
+// sharedesk.js 0.2
// (c) 2010 Samuel Hobl, Alexander Kumbeiz, Goran Janosevic.
// Initial Setup Dependencies
@@ -10,25 +10,27 @@ var connect = require('connect'),
model = require('./models/model-native-driver').db,
util = require('util'),
port = (process.argv[2] || 8081),
- rooms = require('./logics/rooms.js'),
formidable = require('formidable'),
exec = require('child_process').exec,
- deskTime = 60;
+ demoDeskTimeOutinDays = 3,
+ deskTimeOutinDays = 60,
path = require('path'),
- fs = require('fs');
+ fs = require('fs'),
+ socketio = require('socket.io'),
+ url = require('url'),
+ crypto = require('crypto');
// Setup Express
// -------------
var app = module.exports = express.createServer();
-app.rooms = rooms;
app.configure(function() {
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.cookieParser());
- app.use(express.session({ store: mongoStore(app.set('db-uri')), secret: 'keyboard cat'}));
+ //app.use(express.session({ store: mongoStore(app.set('db-uri')), secret: 'keyboard cat'}));
app.use(express.compiler({ src: __dirname + '/public', enable: ['less'] }));
app.use(app.router);
app.use(express.static(__dirname + '/public'));
@@ -96,86 +98,55 @@ app.get('/', function(req, res){
});
});
-// Download Route
-// deskname is unimportant
-// fileid is the id for the whole group of file (if multiupload)
-app.get('/download/:deskname/:fileid', function(req, res) {
- // send file
- app.model.getFile(req.params.fileid, function(error, file) {
- if(error) {
- console.log("getFile error", error);
- }
- else {
- path.exists('./' + file.location, function(exists) {
- if(!exists || !file) {
- res.render('brokenfile.jade', {
- locals: {pageTitle: ('shareDesk - ' + req.params.deskname) },
- layout: 'layoutSimple.jade'
- });
- return;
- }
-
- // HTTP Header
- res.writeHead('200', {
- 'Content-Type' : file.type,
- 'Content-Disposition' : 'attachment;filename=' + file.name,
- 'Content-Length' : fs.statSync('./' + file.location).size,
- });
-
- // Filestream
- fs.createReadStream('./' + file.location, {
- 'bufferSize': 4 * 1024
- }).pipe(res);
- });
- }
- });
-});
// Desk Route
// different desk for each different name
app.get('/:deskname', function(req, res){
var deskname = req.params.deskname;
-
+
app.model.getDesk(deskname, function(error, desk) {
if(error) console.log('Error');
else {
- if(desk !== undefined && desk.date !== undefined){
- var currentTime = new Date();
- var diffTime = currentTime.getTime()-desk.date.getTime();
- var diffMinutes = diffTime / ( 1000 * 60 );
- var leftTimeMessage;
- var leftTime = deskTime-diffMinutes;
- console.log('ZEITEN', deskTime,diffMinutes );
+
+ var isAuthorized = true;
+ var isProtected = false;
+
+ if(desk !== undefined && 'protection' in desk) {
+
+ isProtected = true;
- //falls weniger als 1 Minute
- if(leftTime < 60) {
- leftTime = leftTime;
- leftTimeMessage = ' Minuten bis Reset';
- }
- //falls weniger als 1 Tag
- else if(leftTime/60 < 24) {
- leftTime = leftTime/60;
- leftTimeMessage = ' Stunden bis Reset';
- }
- //falls größer noch Tage
- else {
- leftTime = leftTime/60/24;
- leftTimeMessage = ' Tage bis Reset';
- }
+ if(req.cookies.identifier != desk.protection.identifier) {
+
+ isAuthorized = false;
- leftTimeMessage = leftTime.toFixed(2) + leftTimeMessage;
+ //render passwortrequest view
+ res.render('password.jade', {
+ locals: {
+ pageTitle: ('shareDesk - ' + req.params.deskname),
+ }
+ });
- console.log(diffMinutes);
+ }
+ }
- if(diffMinutes > deskTime) {
+ deskTimeOut = deskTimeOutinDays;
+ if(deskname === 'demo') {
+ deskTimeOut = demoDeskTimeOutinDays;
+ }
+ if(desk !== undefined && desk.date !== undefined && isAuthorized){
+ var currentTime = new Date();
+ var diffTime = currentTime.getTime()-desk.date.getTime();
+ var diffinDays = diffTime / ( 1000 * 60 * 60 * 24 );
+
+ if(diffinDays > deskTimeOut) {
- console.log('deleted');
app.model.deleteDesk(deskname, function() {
- console.log('EIN DELETE JETZT');
+ console.log('JETZT EIN DELETE');
+ //Deleting all files from this desk
var child = exec('rm -R ./uploads/'+ deskname,
function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
@@ -189,7 +160,9 @@ app.get('/:deskname', function(req, res){
res.render('index.jade', {
locals: {
pageTitle: ('shareDesk - ' + req.params.deskname),
- timeLeft: deskTime + ' Tage bis reset'
+ timeLeft: 'ShareDesk',
+ deskTimeOut: deskTimeOut*86400000,
+ isProtected: isProtected ? 'private' : 'public'
}
});
});
@@ -197,17 +170,21 @@ app.get('/:deskname', function(req, res){
//render view
res.render('index.jade', {
locals: {
- pageTitle: ('shareDesk - ' + req.params.deskname),
- timeLeft: leftTimeMessage
+ pageTitle: ('shareDesk - ' + req.params.deskname),
+ timeLeft: '',
+ deskTimeOut: deskTimeOut*86400000,
+ isProtected: isProtected ? 'private' : 'public'
}
});
}
- } else {
+ } else if (isAuthorized) {
//render view
res.render('index.jade', {
locals: {
pageTitle: ('shareDesk - ' + req.params.deskname),
- timeLeft: 'INFO: Dateien bleiben '+ deskTime +' Minuten erhalten'
+ timeLeft: 'ShareDesk',
+ deskTimeOut: deskTimeOut*86400000,
+ isProtected: isProtected ? 'private' : 'public'
}
});
}
@@ -215,58 +192,154 @@ app.get('/:deskname', function(req, res){
});
});
+// Download Route
+// deskname is unimportant
+app.get('/:deskname/download/:fileid', function(req, res) {
+
+ var deskname = req.params.deskname;
+
+ app.model.getDesk(deskname, function(error, desk) {
+ if(error) console.log('Error');
+ else {
+
+
+ var isAuthorized = true;
+
+ if(desk !== undefined && 'protection' in desk) {
+
+ if(req.cookies.identifier != desk.protection.identifier) {
+
+ isAuthorized = false;
+
+ //render passwortrequest view
+ res.render('password.jade', {
+ locals: {
+ pageTitle: ('shareDesk - ' + req.params.deskname),
+ }
+ });
+
+ }
+ }
+
+ if(isAuthorized) {
+
+ // send file
+ app.model.getFile(req.params.fileid, function(error, file) {
+ if(error) {
+ console.log("getFile error", error);
+ }
+ else {
+ path.exists('./' + file.location, function(exists) {
+ if(!exists || !file) {
+ res.render('brokenfile.jade', {
+ locals: {pageTitle: ('shareDesk - ' + req.params.deskname) },
+ layout: 'layoutSimple.jade'
+ });
+ return;
+ }
+
+ //Add an download-click to the file
+ app.model.addDownloadClick(req.params.fileid, function(error) {
+ if(error) {
+ console.log("add DownloadClick Error", error);
+ } else {
+ file.downloads = file.downloads+1
+ app.io.sockets.in(deskname).emit('addDownloadClick', file);
+ }
+ });
+
+ // HTTP Header
+ res.writeHead('200', {
+ 'Content-Type' : file.type,
+ 'Content-Disposition' : 'attachment;filename=' + file.name,
+ 'Content-Length' : fs.statSync('./' + file.location).size,
+ });
+
+ // Filestream
+ fs.createReadStream('./' + file.location, {
+ 'bufferSize': 4 * 1024
+ }).pipe(res);
+ });
+ }
+ });
+ }
+ }
+ });
+});
+
+
// Upload Route
// used to upload file with ajax
-app.post('/upload/:deskname/:filesgroupid', function(req, res) {
- var filesgroupid = req.params.filesgroupid;
+app.post('/upload/:deskname/:tempFileId', function(req, res) {
+ var tempFileId = req.params.tempFileId;
var rcvd_bytes_complete = 0;
var basedir = './uploads/';
+
var form = new formidable.IncomingForm(),
files = [],
fields = [];
+ req.params.deskname = encodeURIComponent(req.params.deskname);
+ console.log(req.params);
+
var oldProgressPercentage = 0;
var dir = basedir + req.params.deskname;
+ //Should check if folder exists!
+ ////missing
+
form.uploadDir = dir;
+ var filePath = '';
+
+ form.on('fileBegin', function(name, file) {
+ console.log(name, file);
+ filePath = file.path;
+ });
+
// send progress-message, at one percent-rate or above
form.on('progress', function(bytesReceived, bytesExpected) {
var newProgressPercentage = (bytesReceived / bytesExpected) * 100 | 0;
if(oldProgressPercentage < newProgressPercentage) {
- var msg = {
- action: 'progress',
- data: {
- filesgroupid: filesgroupid,
- bytesReceived: bytesReceived,
- bytesExpected: bytesExpected
- }
- }
- rooms.broadcast_room(req.params.deskname, msg);
+
+ app.io.sockets.in(req.params.deskname).emit('progressAnnouce', {
+ tempFileId: tempFileId,
+ bytesReceived: bytesReceived,
+ bytesExpected: bytesExpected
+ });
+
oldProgressPercentage = newProgressPercentage;
+
}
});
- form.on('aborted', function(error) {
- console.log("-------------------------------error");
- console.log(error);
+ form.on('aborted', function() {
+ console.log("---------------UPLOAD ABORTED----------------");
+ app.io.sockets.in(req.params.deskname).emit('uploadAbortedAnnouce', tempFileId);
+
+ //delete file on storage
+ fs.unlink(filePath, function(error, test) {
+ if(error) console.log('error delete file from storage: ', error);
+ });
+
});
form.on('end', function() {
- console.log("end");
+ console.log("---------------UPLOAD END----------------");
});
// uploading file done, save to db
form.on('file', function(name, file) {
- console.log('file', file);
+ console.log('Upload Done this is our file: ', util.inspect(file));
var fileModel = {
name: file.name,
location: file.path,
x: -1,
y: -1,
format: file.type,
- size: file.size
+ size: file.size,
+ downloads: 0
}
//Sending 'createFile' signal
@@ -283,34 +356,25 @@ app.post('/upload/:deskname/:filesgroupid', function(req, res) {
console.log('Error creating File', error);
}
else {
- var msg = {
- action: 'createFile',
- data: {
- filesgroupid: filesgroupid,
- file: fileModel
- }
- }
- rooms.broadcast_room(req.params.deskname, msg);
+
+
+ app.io.sockets.in(req.params.deskname).emit('fileSavedAnnouce', {
+ tempFileId: tempFileId,
+ file: fileModel
+ });
- //send timeLeft
- sendTimeLeft(req.params.deskname);
}
});
}
});
}
else {
- var msg = {
- action: 'createFile',
- data: {
- filesgroupid: filesgroupid,
- file: fileModel
- }
- }
- rooms.broadcast_room(req.params.deskname, msg);
- //send timeLeft
- sendTimeLeft(req.params.deskname);
+
+ app.io.sockets.in(req.params.deskname).emit('fileSavedAnnouce', {
+ tempFileId: tempFileId,
+ file: fileModel
+ });
}
});
});
@@ -319,59 +383,204 @@ app.post('/upload/:deskname/:filesgroupid', function(req, res) {
// close connection when done
form.parse(req, function(error, fields, files) {
+ //console.log('PARSE',util.inspect({fields: fields, files: files}));
+
res.writeHead(200, {'content-type': 'text/plain'});
res.write('received upload:\n\n');
- res.end(util.inspect({fields: fields, files: files}));
-
+ res.end();
+
});
});
-function sendTimeLeft(deskname) {
- //Send desk timeleft
- app.model.getDesk(deskname, function(error, desk) {
- if(error) console.log('Error');
+// Password protection ROUTES
+
+app.post('/:deskname/login', function(req, res) {
+
+ //state(0): password wrong
+ //state(1): access granted
+ //state(2): desk dont exists
+ //state(3): desk is not protected
+ var resObject = {
+ state: 0,
+ message: ''
+ }
+
+
+ app.model.getDesk(req.params.deskname, function(error, desk) {
+
+ if(error) console.log('Error in getting desk from database', error);
else {
- if(desk !== undefined && desk.date !== undefined){
- var currentTime = new Date();
- var diffTime = currentTime.getTime()-desk.date.getTime();
- var diffMinutes = diffTime / ( 1000 * 60 );
- var leftTimeMessage;
- var leftTime = deskTime-diffMinutes;
+ if(desk === undefined) {
+ resObject.state = 2;
+ resObject.message = 'This desktop is has not being created.';
+ res.send(resObject);
- //falls weniger als 1 Minute
- if(leftTime < 60) {
- leftTime = leftTime;
- leftTimeMessage = ' Minuten bis Reset';
- }
- //falls weniger als 1 Tag
- else if(leftTime/60 < 24) {
- leftTime = leftTime/60;
- leftTimeMessage = ' Stunden bis Reset';
- }
- //falls größer noch Tage
- else {
- leftTime = leftTime/60/24;
- leftTimeMessage = ' Tage bis Reset';
+ } else {
+
+ if('protection' in desk) {
+
+ var passwordHash = crypto.createHash('sha1').update(req.body.password).digest("hex")
+
+ if(passwordHash != desk.protection.passwordHash) {
+ resObject.state = 0;
+ resObject.message = 'You entern a wrong password';
+ res.send(resObject);
+
+ } else {
+
+ resObject.state = 1;
+ resObject.message = 'Acces granted';
+
+ res.cookie('identifier', desk.protection.identifier, { expires: getCookieExpire(), path:'/'+req.params.deskname });
+
+ res.send(resObject);
+
+ }
+
+ } else {
+
+ resObject.state = 3;
+ resObject.message = 'This desk is not protected';
+ res.send(resObject);
+
}
+ }
- console.log('TimeLeft', leftTime);
- leftTimeMessage = leftTime.toFixed(2) + leftTimeMessage;
+ }
+ });
+});
+
+app.post('/:deskname/password', function(req, res) {
+
+ //state(0): error setting password
+ //state(1): password succesfully set
+ //state(2): password removed
+ var resObject = {
+ state: 0,
+ message: ''
+ }
+
+ app.model.getDesk(req.params.deskname, function(error, desk) {
+
+
+ if(error) console.log('Error in getting desk from database', error);
+ else {
+
+ if(desk === undefined) {
+ resObject.state = 0;
+ resObject.message = 'you need to upload files first before setting a password';
+ res.send(resObject);
+
+ } else {
+
+ if('protection' in desk ) {
+
+ if(req.cookies.identifier != desk.protection.identifier) {
+ resObject.state = 0;
+ resObject.message = 'Your are not authorized to change the password';
+ res.send(resObject);
+
+ } else {
+ //Rename password
+
+ var toRemove = false;
+
+ if(req.body !== undefined) {
+ //Generate unique identifier
+ var uniqueIdentifier = Math.round(Math.random()*99999999);
+ var passwordHash = crypto.createHash('sha1').update(req.body.password).digest("hex");
+ var protectionObject = {
+ passwordHash:passwordHash,
+ identifier:uniqueIdentifier
+ }
+ } else {
+ toRemove = true;
+ }
+
+
+ app.model.setPassword(req.params.deskname, protectionObject, toRemove, function(error, desk) {
+ if(error) console.log('Error in setting password', error);
+ else {
+
+ if(!toRemove) {
+
+ res.cookie('identifier', uniqueIdentifier, { expires: getCookieExpire(), path:'/'+req.params.deskname });
+ resObject.state = 1;
+ resObject.message = 'Password has been renamed';
+ res.send(resObject);
+
+
+ } else {
+
+ res.clearCookie('identifier')
+ resObject.state = 2;
+ resObject.message = 'Password has been removed';
+ res.send(resObject);
+
+ }
+ }
+ });
+
+
+ }
+ } else if(req.body !== undefined) {
+ //Set a password
+
+ //Generate unique identifier
+ var uniqueIdentifier = Math.round(Math.random()*99999999);
+
+ var passwordHash = crypto.createHash('sha1').update(req.body.password).digest("hex");
+
+ var protectionObject = {
+ passwordHash:passwordHash,
+ identifier:uniqueIdentifier
+ }
+
+ app.model.setPassword(req.params.deskname, protectionObject, false, function(error, desk) {
+ if(error) console.log('Error in setting password process', error);
+ else {
+
+ res.cookie('identifier', uniqueIdentifier, { expires: getCookieExpire(), path:'/'+req.params.deskname });
+ resObject.state = 1;
+ resObject.message = 'Password has been created';
+ res.send(resObject);
- var msg = {
- action: 'timeLeft',
- data: {
- timeLeft: leftTimeMessage
}
+ });
+
+ } else {
+ res.clearCookie('identifier')
+ resObject.state = 0;
+ resObject.message = 'Password has been already removed';
+ res.send(resObject);
+
}
- rooms.broadcast_room(deskname, msg);
}
}
+
});
+
+});
+
+//Helper funktion
+/* Converts special characters
+ * */
+app.replaceUmlauts = function (string, index){
+ var anArray = new Array(2);
+ anArray[0] = new Array("Ö", "ö", "Ä", "ä", "Ü", "ü", "ß");
+ anArray[1] = new Array("Oe", "oe", "Ae", "ae", "Ue", "ue", "sz");
+
+ for (var i=0; i<anArray[index].length; i++){
+ myRegExp = new RegExp(anArray[index][i],"g");
+ string = string.replace(myRegExp, anArray[(index==0?1:0)][i]);
+ }
+ return string;
}
+
//create Upload folder if it not exists
var uploadFolder = './uploads/';
app.uploadFolder = uploadFolder;
@@ -383,6 +592,25 @@ fs.stat(uploadFolder, function(error, stats) {
}
});
+//having access to socket.io in controllers
+app.io = socketio.listen(app);
+app.io.disable('reconnect');
+
+//Configure socket.io
+app.io.configure('production', function(){
+ app.io.enable('browser client minification'); // send minified client
+ app.io.enable('browser client etag'); // apply etag caching logic based on version number
+ app.io.set('log level', 1); // reduce logging
+ app.io.set('transports', [ // enable all transports (optional if you want flashsocket)
+ 'websocket'
+ , 'flashsocket'
+ , 'htmlfile'
+ , 'xhr-polling'
+ , 'jsonp-polling'
+ ]);
+});
+
+
// start websockets controller
require('./controllers/websockets')(app);
@@ -394,3 +622,10 @@ if (!module.parent) {
+//Helper
+function getCookieExpire() {
+ var d = new Date();
+ return new Date(d.getTime() +1000*60*60*24*deskTimeOutinDays);
+}
+
+
View
398 controllers/websockets.js
@@ -1,217 +1,269 @@
// Socket.io routing
// -------------
-var io = require('socket.io'),
- util = require('util'),
- fs = require('fs');
module.exports = function(app) {
- var socket = io.listen(app),
+ var util = require('util'),
+ fs = require('fs'),
model = app.model,
- rooms = app.rooms;
-
+ io = app.io;
- socket.on('connection', function(client) {
- // new client is here!
- client.on('message', function( message ) {
- console.log("action: " + message.action + " -- data: " + util.inspect(message.data) );
+ io.sockets.on('connection', function(socket) {
- if (!message.action) {
- return;
- }
+ //Invokes initialization
+ socket.emit('newConnection');
- switch (message.action) {
- case 'initializeMe':
- initClient(client);
- break;
-
- case 'joinRoom':
- joinRoom(client, message.data, function(clients) {
- client.send( { action: 'roomAccept', data: '' } );
- });
- break;
-
- case 'moveFile':
-
- moveFile(client, message);
- break;
-
- case 'newFile':
- newFile(client, message.data);
- break;
-
- case 'renameFile':
- renameFile(client, message.data.id, message.data.value);
- break;
-
- case 'deleteFile':
- deleteFile(client, message.data.id);
- break;
- default:
- console.log('unknown action');
- break;
- }
+ //JoinDesk
+ //---------
+ //Client joins his room and initialization begins
+ socket.on('joinDesk', function(data) {
+
+ var deskName = data.deskName;
+ app.model.getDesk(deskName, function(error, desk) {
+ if(error) console.log('Error');
+ else {
+
+ var isAuthorized = true;
+ if(desk !== undefined && 'protection' in desk && 'identifier' in data) {
+ if(data.identifier != desk.protection.identifier) {
+ isAuthorized = false;
+ socket.emit('notAllowed');
+ }
+ }
+
+ //Access granted
+ if(isAuthorized) {
+
+ //save deskName in clients socket
+ socket.deskName = deskName;
+ socket.userColor = getRandomColorObject();
+ socket.username = 'anonym';
+
+ //Join Desk
+ socket.join(deskName);
+
+
+ //Send client all the files from the room
+ model.getAllFiles(deskName, function(err, filesasArray) {
+ socket.emit('initFiles', filesasArray);
+ });
+
+
+ var currentUsersinDesk = new Array();
+ var count = 0;
+ for(i in io.sockets.clients(deskName)) {
+
+ var userSId = io.sockets.clients(deskName)[i].id;
+ var color = io.sockets.clients(deskName)[i].userColor;
+ var username = io.sockets.clients(deskName)[i].username;
+
+ count++;
+
+ var user = {
+ sid: userSId,
+ color: color,
+ username: username,
+ me: false
+ }
+
+
+ currentUsersinDesk.push(user);
+
+ if(userSId === socket.id) {
+ socket.broadcast.to(deskName).emit('joinAnnouce', user);
+ user.me = true;
+ }
+
+ if(count == io.sockets.clients(deskName).length) {
+ socket.emit('initUsers', currentUsersinDesk);
+ }
+
+
+ }
+
+ model.getDesk(deskName, function(error, desk) {
+ if(error) console.log('Error');
+ else {
+ if(desk !== undefined && desk.date !== undefined){
+ socket.emit('deskCreationDate', desk.date);
+ }
+ }
+ });
+
+
+ //create desk upload folder
+ var dir = app.uploadFolder + '/' + deskName;
+ fs.stat(dir, function(error, stats) {
+ if(typeof stats=='undefined' || !stats.isDirectory()) {
+ fs.mkdir(dir, 448, function(error) {
+ if (error) throw new Error('could not create ' + app.uploadFolder + ' folder');
+ });
+ }
+ });
+ }
+ }
+ });
});
- client.on('disconnect', function() {
- leaveRoom(client);
+
+ //newFileAnnouce
+ //---------
+ //Client joins his room and initialization begins
+ socket.on('newFileAnnouce', function(file) {
+ //Annouce to other clients
+ socket.broadcast.to(socket.deskName).emit('newFileAnnouce', file);
});
- });
-
-
- // Handlers
- //--------------
-
- //Creates room and send files and users to Client
- function initClient (client) {
- getRoom(client, function(room) {
- //Send client all the files from the room
- model.getAllFiles(room, function(err, files) {
- client.send({ action: 'initFiles', data: files});
- });
+ //moveFile
+ //---------
+ //Save file's new position and annouce it
+ socket.on('moveFile', function(file) {
- roommates_clients = rooms.room_clients(room);
- roommates = [];
-
- var j = 0;
- for (i in roommates_clients)
- {
- if (roommates_clients[i].sessionId != client.sessionId)
- {
- roommates[j] = {
- sid: roommates_clients[i].sessionId,
- };
- j++;
- }
- }
+ //Save position in database
+ model.setFilePosition(null, file.id, file.position.x, file.position.y, function(error, _file) {
+ if(error) console.log("setFilePosition error:", error);
+ else {
+ //Annouce to other clients
+ socket.broadcast.to(socket.deskName).emit('moveFileAnnouce', file);
- console.log('initialusers: ' + roommates);
- client.send(
- {
- action: 'initialUsers',
- data: roommates
}
- )
-
+ });
+
});
- }
- //Adds client to a room and sends an annoucement to other clients
- function joinRoom (client, room, successFunction) {
- var msg = {
- action : 'join-announce',
- data : { sid: client.sessionId, user_name: client.user_name }
- }
- rooms.add_to_room_and_announce(client, room, msg);
+ //renameFile
+ //---------
+ //Save file's new name and annouce it
+ socket.on('renameFile', function(file) {
- //create desk upload folder
- var dir = app.uploadFolder + '/' + room;
- fs.stat(dir, function(error, stats) {
- if(typeof stats=='undefined' || !stats.isDirectory()) {
- fs.mkdir(dir, 448, function(error) {
- if (error) throw new Error('could not create ' + app.uploadFolder + ' folder');
- });
- }
+ //Save name in database
+ model.renameFile(file.id, file.value, function(error, _file) {
+ if(error) console.log("setFileName error:", error);
+ else {
+ //Annouce to other clients
+ socket.broadcast.to(socket.deskName).emit('renameFileAnnouce', file);
+ }
+ });
});
- successFunction();
- }
-
- //Removes client from a room and sends an annoucement to other clients
- function leaveRoom (client) {
- console.log (client.sessionId + ' just left');
- var msg = {};
- msg.action = 'leave-announce';
- msg.data = { sid: client.sessionId };
- rooms.remove_from_all_rooms_and_announce(client, msg);
+ //deleteFile
+ //---------
+ //Delete file and annouce it
+ socket.on('deleteFile', function(data) {
+
+ //Annouce to other clients
+
+ var fileId = data.fileId;
+ app.model.getDesk(socket.deskName, function(error, desk) {
+ if(error) console.log('Error');
+ else {
- }
-
+ var isAuthorized = true;
+ if(desk !== undefined && 'protection' in desk && 'identifier' in data) {
+ if(data.identifier != desk.protection.identifier) {
+ isAuthorized = false;
+ }
+ }
+
+ //Access granted
+ if(isAuthorized) {
+
+ model.getFile(fileId, function(error, _file) {
+ if(error) console.log(error);
+ else {
+ model.deleteFile(fileId, function(error, __file) {
+ if(error) console.log(error);
+ else {
+
+ //Annouce to other clients
+ io.sockets.in(socket.deskName).emit('deleteFileAnnouce',fileId);
- //Saves new destination of file
- function moveFile(client, msg) {
- var messageOut = {
- action: msg.action,
- data: {
- id: msg.data.id,
- position: {
- left: msg.data.position.left,
- top: msg.data.position.top
+ //delete file on storage
+ fs.unlink(_file.location, function(error, test) {
+ if(error) console.log('error delete file from storage: ', error);
+ });
+
+ }
+ });
+ }
+ });
+ } else {
+
+ socket.emit('notAllowed');
+ }
}
- }
- };
- //report to all other clients
- broadcastToRoom( client, messageOut );
+ });
- model.setFilePosition(null, msg.data.id, msg.data.position.left, msg.data.position.top, function(error, file) {
- console.log("setFilePosition error:", error);
});
- }
- //Creates new file and reposts to other clients
- function newFile (client, data) {
- var msg = {
- action: 'newFile',
- data: data
- }
- broadcastToRoom(client, msg);
- }
+ //On Client Disconnect
+ //---------
+ //Removing client from desk an annouce to others
+ socket.on('disconnect', function () {
+
+ //Annouce leave to other clients
+ socket.broadcast.to(socket.deskName).emit('leaveAnnouce', socket.id);
+
+ //leaves automatically the room
- //Renames file and reports to other clients
- function renameFile (client, fileId, newName) {
- model.renameFile(fileId, newName, function(error, file) {
- var msg = {};
- msg.action = 'renameFile';
- msg.data = { id: fileId, value: newName };
- broadcastToRoom(client, msg);
- //broadcast?
- //console.log(error);
});
- }
- //Delets Ffile and report
- function deleteFile (client, fileId) {
- model.getFile(fileId, function(error, file) {
- if(error) {
- console.log(error);
- }
- else {
- model.deleteFile(fileId, function(error, file) {
- if(error) {
- console.log(error);
- }
- else {
- var msg = {
- action : 'deleteFile',
- data : { id: fileId }
- };
- broadcastToRoom(client, msg);
- }
- });
+ //New chat message
+ //---------
+ socket.on('newMessage', function(data) {
+ if(data.toUsers.length === 0) {
+ socket.broadcast.to(data.room).emit('newMessage',data);
+ } else {
+ for(i in data.toUsers) {
+ io.sockets.socket(data.toUsers[i].sid).emit('newMessage',data);
+ }
}
- //delete file on storage
- fs.unlink(file.location, function(error, test) {
- });
});
- }
- //Returns the room the client is in.
- function getRoom( client , callback ) {
- room = rooms.get_room( client );
- //console.log( 'client: ' + client.sessionId + " is in " + room);
- callback(room);
+ //Renames user
+ //---------
+ socket.on('renameUser', function(user) {
+ io.sockets.socket(user.sid).username = user.username;
+ socket.broadcast.to(io.sockets.socket(user.sid).deskName).emit('renameUser',user);
+ });
+
+ // Password change
+ //---------
+ socket.on('setPassword', function(data) {
+ io.sockets.in(data.room).emit('setPassword',data);
+ });
+ });
+
+ //Helper
+
+ /* Creats a random Color
+ * */
+ function getRandomColorObject() {
+
+ function randomXToY() {
+ var minVal = 100;
+ maxVal = 200;
+ return Math.round(minVal+(Math.random()*(maxVal-minVal)));
+ }
+
+ var colorObject = {
+ r:randomXToY(),
+ g:randomXToY(),
+ b:randomXToY()
+ }
+ return colorObject;
}
- //Broadcasts a message to other clients than the given one
- function broadcastToRoom ( client, message ) {
- rooms.broadcast_to_roommates(client, message);
+ function isEmpty(ob){
+ for(var i in ob){ return false;}
+ return true;
}
+
}
View
214 logics/rooms.js
@@ -1,214 +0,0 @@
-// This is based on PubSubCore
-// https://github.com/PeterScott/pubsubcore/blob/master/pubsubcore.js
-
-// PubSubCore: Simple pub/sub library for Node.js and Socket.IO
-
-var util = require('util');
-var sets = require('simplesets');
-var io = require('socket.io');
-var net = require('net');
-
-//////////////////////////////
-// Tracking who's in what room
-//////////////////////////////
-
-// Dict mapping room names with people to sets of client objects.
-var rooms = {};
-// Dict mapping room names with people to sets of usernames.
-var room_users = {};
-// Dict mapping sids to sets of rooms.
-var sid_rooms = {};
-
-
-// Add a client to a room and return the sid:client mapping.
-exports.add_to_room = function (client, room, callback) {
- //console.log('Client ' + client.username + ' (' + client.sessionId + ') added to room ' + room);
-
- if (!(sid_rooms.hasOwnProperty(client.sessionId))) sid_rooms[client.sessionId] = new sets.Set();
- sid_rooms[client.sessionId].add(room);
-
- if (!(rooms.hasOwnProperty(room))) rooms[room] = new sets.Set();
- rooms[room].add(client);
-
- if (!(room_users.hasOwnProperty(room))) room_users[room] = new sets.Set();
- room_users[room].add(client.username);
-
- callback(rooms[room].array());
-}
-
-// Remove a client from all rooms and return the username:client
-// mapping for everybody in those rooms.
-exports.remove_from_all_rooms = function (client, callback) {
- var affected_clients = new sets.Set();
- if (sid_rooms.hasOwnProperty(client.sessionId)) {
- var client_rooms = sid_rooms[client.sessionId].array();
- for (var i = 0; i < client_rooms.length; i++) {
- var room = client_rooms[i];
- if (rooms.hasOwnProperty(room)) {
- rooms[room].remove(client);
- if (rooms[room].size() === 0)
- delete rooms[room];
- }
- if (room_users.hasOwnProperty(room)) {
- room_users[room].remove(client.username);
- if (room_users[room].size() === 0)
- delete room_users[room];
- }
- if (rooms.hasOwnProperty(room)) {
- var this_room = rooms[room].array();
- for (var j = 0; j < this_room.length; j++)
- affected_clients.add(this_room[j]);
- }
- }
- }
- console.log('Client ' + client.username + ' (' + client.sessionId + ') disconnected.');
- delete sid_rooms[client.sessionId];
- callback(affected_clients.array());
-}
-
-// Remove a client from a room and return the username:client mapping
-// for everybody in that room. Returns [] if the room does not exist,
-// or if the client was not in the room to begin with.
-function remove_from_room(client, room, callback) {
- if (!rooms.hasOwnProperty(room) || !rooms[room].has(client)) {
- callback([]);
- return;
- }
-
- // Delete from the room
- rooms[room].remove(client);
- if (rooms[room].size() === 0)
- delete rooms[room];
- if (room_users.hasOwnProperty(room)) {
- room_users[room].remove(client.username);
- if (room_users[room].size() === 0)
- delete room_users[room];
- }
-
- callback(exports.room_clients(room));
-}
-
-// Return list of clients in the given room.
-exports.room_clients = function(room) {
- return rooms.hasOwnProperty(room) ? rooms[room].array() : [];
-};
-
-// Return true if room contains the given client, false otherwise.
-exports.client_in_room = function(room, client) {
- return rooms.hasOwnProperty(room) && rooms[room].has(client);
-};
-
-// Return list of usernames in given room
-exports.users_in_room = function(room) {
- return room_users.hasOwnProperty(room) ? room_users[room].array() : [];
-};
-
-// Return list of usernames in given room
-exports.room_clients_other_than_me = function(room, client) {
- if (rooms.hasOwnProperty(room))
- {
- var clients = rooms[room];
- console.dir(clients.array());
-
- clients.remove(client);
- console.dir(clients.array());
- return clients.array();
- }
- else
- {
- return [];
- }
-};
-
-//gets the current room of the client (assumes one room -- will select first one if in multiple)
-exports.get_room = function (client) {
- if (sid_rooms.hasOwnProperty(client.sessionId))
- {
- var client_rooms = sid_rooms[client.sessionId].array();
- }
-
- if ( typeof(client_rooms) != undefined )
- return client_rooms[0];
- else
- return null
-}
-
-
-// Generic server code
-
-exports.add_to_room_and_announce = function (client, room, msg) {
-
- // Add user info to the current dramatis personae
- exports.add_to_room(client, room, function(clients) {
- // Broadcast new-user notification
- for (var i = 0; i < clients.length; i++)
- {
- if (clients[i].sessionId != client.sessionId)
- clients[i].send(msg);
- }
- });
-}
-
-//remember that this announces to all rooms that this client was a member of
-exports.remove_from_all_rooms_and_announce = function (client, msg) {
- exports.remove_from_all_rooms(client, function(clients) {
- for (var i = 0; i < clients.length; i++)
- {
- if (clients[i].sessionId != client.sessionId)
- clients[i].send(msg);
- }
- });
-}
-
-//////////////////////////////
-// Broadcasting functions
-//////////////////////////////
-
-// Broadcast message to all clients
-exports.broadcast = function(msg) {
- if (socket) socket.broadcast(msg);
- net_server_streams.each(function(stream) {
- stream.write(JSON.stringify(msg)+'\r\n');
- });
-};
-
-// Broadcast message to all clients in a given room.
-exports.broadcast_room = function(room, msg) {
- var clients = exports.room_clients(room);
- for (var i = 0; i < clients.length; i++)
- clients[i].send(msg);
-};
-
-// Broadcast message to all the other clients that are in rooms with this client
-exports.broadcast_to_roommates = function (client, msg) {
- var roommates = new sets.Set();
-
- if (sid_rooms.hasOwnProperty(client.sessionId))
- {
- var client_rooms = sid_rooms[client.sessionId].array();
- for (var i = 0; i < client_rooms.length; i++)
- {
- var room = client_rooms[i];
- if (rooms.hasOwnProperty(room))
- {
- var this_room = rooms[room].array();
- for (var j = 0; j < this_room.length; j++)
- roommates.add(this_room[j]);
- }
- }
- }
-
- //remove self from the set
- roommates.remove(client);
- roommates = roommates.array();
-
- console.log('client: ' + client.sessionId + " is broadcasting to: ");
-
-
- for (var i = 0; i < roommates.length; i++)
- {
- console.log(' - ' + roommates[i].sessionId);
- roommates[i].send(msg);
- }
-}
-
View
56 models/model-native-driver.js
@@ -68,7 +68,7 @@ db.prototype.createDesk = function(deskName, callback) {
this.getCollection(function(error, desk_collection) {
if( error ) callback(error)
else {
- var currentDate = new Date();
+ var currentDate = new Date();
desk_collection.insert({name:deskName, date: currentDate}, function(error, objects) {
if( error ) callback(error)
else callback(null, objects);
@@ -137,7 +137,7 @@ db.prototype.getFile = function(id, callback) {
if(error) callback(error)
else {
desk_collection.findOne({'files._id':ObjectId(id)}, function(error, desk) {
- if(error) callback(error)
+ if(error) callback(error);
else {
if(desk) {
for(var i in desk.files) {
@@ -232,4 +232,56 @@ db.prototype.deleteFile = function(id, callback) {
});
};
+//Password protection Operations
+//-----
+db.prototype.setPassword = function(deskName, protectionObject, toRemove, callback) {
+ this.getCollection(function(error, desk_collection) {
+ if( error ) callback(error)
+ else {
+ if(toRemove) {
+
+ desk_collection.update(
+ {name: deskName},
+ { $unset : { 'protection' : 1} },
+ function(error, deskSecureObject) {
+ if( error ) callback()
+ else callback(null, deskSecureObject);
+ }
+ );
+
+
+ } else {
+ desk_collection.update(
+ {name: deskName},
+ {$set:{'protection': protectionObject}},
+ function(error, deskSecureObject) {
+ if( error ) callback()
+ else callback(null, deskSecureObject);
+ }
+ );
+ }
+ }
+ });
+};
+
+// Add a download-click to file
+//-----
+db.prototype.addDownloadClick = function(id, callback) {
+ this.getCollection(function(error, desk_collection) {
+ if( error ) callback(error)
+ else {
+ desk_collection.update(
+ {'files._id': ObjectId(id)},
+ {$inc:{'files.$.downloads': 1}},
+ function(error, file) {
+ if( error ) callback(file)
+ else callback(null, file);
+ }
+ );
+ }
+ });
+};
+
+
+
exports.db = db;
View
2  public/css/reset.css
@@ -60,7 +60,7 @@ body, select, input, textarea {
/* font-family: Georgia, serif; */
}
h1,h2,h3,h4,h5,h6 { font-weight: bold; }
-html { overflow-y: scroll; }
+/*html { overflow-y: scroll; }*/
a:hover, a:active { outline: none; }
a, a:active, a:visited { color: #607890; }
a:hover { color: #036; }
View
847 public/css/style.css
@@ -1,39 +1,230 @@
@import "reset.css";
-/* ----------------------------------------------------------------------*/
-/* --------------------------->>> GLOBAL <<<-----------------------------*/
-/* ----------------------------------------------------------------------*/
body {
background: url(../images/background.jpg);
}
-/* ----------------------------------------------------------------------*/
-/* -------------------------->>> STRUCTUR <<<----------------------------*/
-/* ----------------------------------------------------------------------*/
-#wrapper {
+@font-face {
+ font-family: 'AllerItalic';
+ src: url('../fonts/aller_it-webfont.eot');
+ src: url('../fonts/aller_it-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/aller_it-webfont.woff') format('woff'), url('../fonts/aller_it-webfont.ttf') format('truetype'), url('../fonts/aller_it-webfont.svg#AllerItalic') format('svg');
+ font-weight: normal;
+ font-style: normal;
+}
+@font-face {
+ font-family: 'AllerRegular';
+ src: url('../fonts/aller_rg-webfont.eot');
+ src: url('../fonts/aller_rg-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/aller_rg-webfont.woff') format('woff'), url('../fonts/aller_rg-webfont.ttf') format('truetype'), url('../fonts/aller_rg-webfont.svg#AllerRegular') format('svg');
+ font-weight: normal;
+ font-style: normal;
+}
+#shareDesk {
position: absolute;
- width: 100%;
+ top: 100px;
+ left: 50%;
+ margin-left: -200px;
+ width: 400px;
+ text-align: center;
+ color: #373739;
+ font-size: 65px;
+ font-family: 'AllerRegular', 'Arial', 'Courier';
+ text-decoration: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -o-user-select: none;
+ user-select: none;
+}
+/*
+ * ------------------><)
+ * HoMe STYLeS
+ * ------------------><)
+ */
+body.home {
+ border-top: solid 5px rgba(255, 255, 255, 0.3);
+ overflow-x: hidden;
+}
+#homeWrapper {
+ position: relative;
+ width: 322px;
+ height: 300px;
+ text-align: center;
+ margin: 220px auto 0 auto;
+}
+#homeWrapper div.start {
+ position: relative;
+ top: 0;
+ left: 0;
+}
+#homeWrapper div.start p {
+ color: #e4fff1;
+ font-family: 'AllerRegular', 'Arial', 'Courier';
+ font-size: 22px;
+ line-height: 30px;
+}
+#homeWrapper div.start p a {
+ color: #909090;
+ font-family: 'AllerItalic', 'Arial', 'Courier';
+ font-size: 20px;
+ text-decoration: none;
+}
+#homeWrapper div.start p a:hover {
+ color: #fff;
+}
+#homeWrapper div.about {
+ position: relative;
+ top: 0;
+ left: 1000px;
+ display: none;
+ opacity: 0;
+ /* Standard: FF gt 1.5, Opera, Safari */
+
+ filter: alpha(opacity=0);
+ /* IE lt 8 */
+
+ -ms-filter: "alpha(opacity=0)";
+ /* IE 8 */
+
+ -khtml-opacity: 0;
+ /* Safari 1.x */
+
+ -moz-opacity: 0;
+ /* FF lt 1.5, Netscape */
+}
+#homeWrapper div.about p {
+ color: #fff;
+ font-family: 'AllerRegular', 'Arial', 'Courier';
+}
+#homeWrapper div.about a {
+ color: #fff;
+}
+#homeWrapper div.about h1 {
+ color: #e4fff1;
+ font-family: 'AllerRegular', 'Arial', 'Courier';
+ font-size: 18px;
+ font-weight: normal;
+}
+#homeWrapper ul {
+ list-style: none;
+ margin: 0;
+}
+#homeWrapper ul li {
+ color: #fff;
+}
+#homeWrapper ul a {
+ font-family: 'AllerRegular', 'Arial', 'Courier';
+ text-decoration: none;
+ font-size: 13px;
+ color: #fff;
+ padding: 0 5px;
+}
+/* shareDesk Input/Button */
+.sdInput {
+ position: relative;
+ height: 73px;
+ width: 322px;
+ overflow: hidden;
+ display: inline-block;
+ -moz-box-shadow: 0px 0px 50px rgba(0, 0, 0, 0.5);
+ /* FF3.5+ */
+
+ -webkit-box-shadow: 0px 0px 50px rgba(0, 0, 0, 0.5);
+ /* Saf3.0+, Chrome */
+
+ box-shadow: 0px 0px 50px rgba(0, 0, 0, 0.5);
+ /* Opera 10.5, IE9, Chrome 10+ */
+
+}
+.sdInput .back {
+ position: absolute;
+ top: 0;
+ left: 0;
+ background: #e4e4e4;
height: 100%;
+ width: 100%;
+ opacity: .6;
+ /* Standard: FF gt 1.5, Opera, Safari */
+
+ filter: alpha(opacity=60);
+ /* IE lt 8 */
+
+ -ms-filter: "alpha(opacity=60)";
+ /* IE 8 */
+
+ -khtml-opacity: .60;
+ /* Safari 1.x */
+
+ -moz-opacity: .60;
+ /* FF lt 1.5, Netscape */
}
-#dragSignal {
+.sdInput .backgroundImage {
position: absolute;
- top: 20px;
- left: 20px;
- right: 20px;
- bottom: 20px;
- margin: 20px;
- border: solid 5px blue;
-}
-#uploadIcon {
+ top: 1px;
+ left: 1px;
+ right: 1px;
+ bottom: 1px;
+}
+.sdInput .backgroundImage img {
+ width: 100%;
+ display: block;
+ max-width: 100%;
+}
+.sdInput .illum {
+ position: absolute;
+ top: -148px;
+ left: -20px;
+ width: 388px;
+ height: 388px;
+ background: url(../images/ilumaBack.png) no-repeat;
+}
+.sdInput input {
+ position: absolute;
+ display: block;
+ border: none;
+ background: none;
+ color: #e4fff1;
+ font-size: 18px;
+ height: 100%;
+ font-family: 'Arial', 'Courier';
+ padding: 0 30px;
+}
+.sdInput input:focus {
+ outline: none;
+}
+.sdInput button {
position: absolute;
- top: 5px;
+ display: block;
+ border: none;
+ background: none;
+ color: #dfead2;
+ font-size: 14px;
+ height: 100%;
+ width: 100%;
+ font-family: 'AllerRegular', 'Arial', 'Courier';
+ text-align: center;
+}
+/*
+ * ------------------><)
+ * DeSK STYLeS
+ * ------------------><)
+ */
+#filesWrapper {
+ position: fixed;
+ top: 0;
left: 0;
right: 0;
bottom: 0;
- background: url(../images/newChalkFont.png) no-repeat center;
- display: none;
+ overflow-x: hidden;
}
-#dragArea {
+/* Files Area */
+#filesArea {
position: absolute;
- top: 5px;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+#dragBack {
+ position: fixed;
+ top: 0;
left: 0;
right: 0;
bottom: 0;
@@ -42,151 +233,310 @@ body {
display: none;
z-index: 99;
}
-.hasBackground {
+#dropSign {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 300px;
+ height: 300px;
+}
+#dropSign p {
+ position: relative;
+ top: 100px;
+ margin: 0 auto;
+ width: 100px;
+ height: 100px;
+ border: dashed 2px #606060;
+ background: #626262;
+ background: rgba(98, 98, 98, 0.2);
+ /*round borders*/
+
+ -moz-border-radius: 5px;
+ /* FF1-3.6 */
+
+ -webkit-border-radius: 5px;
+ /* Saf3-4, iOS 1-3.2, Android <1.6 */
+
+ border-radius: 5px;
+ /* Opera 10.5, IE9, Saf5, Chrome, FF4, iOS 4, Android 2.1+ */
+
+}
+.newDesktop {
background-image: url(../images/newChalkFont.png);
background-position: center;
background-repeat: no-repeat;
}
-#brokenFile {
- position: relative;
- top: 50px;
- width: 367px;
- height: 451px;
- margin: 0 auto;
- background: url(../images/broken.png) no-repeat center;
+#sort {
+ position: fixed;
+ top: 10px;
+ left: 5px;
+ color: #686868;
+ text-decoration: none;
+ font-size: 12px;
}
-#brokenMessage {
- position: absolute;
- top: 430px;
- color: #fff;
- font-size: 25px;
- font-family: 'Cabin Sketch', arial, serif;
+#sort:hover {
+ text-decoration: underline;
}
-#infoBar {
+/* Active Users */
+#userBar {
position: fixed;
+ top: 0;
left: 0;
- right: 0;
- bottom: 0;
- height: 20px;
- line-height: 20px;
- background: #000;
- background: rgba(0, 0, 0, 0.2);
+ width: 100%;
+ height: 5px;
+ background: #fff;
+ background: rgba(255, 255, 255, 0.3);
+ margin: 0;
+ z-index: 50;
+ -moz-box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.6);
+ /* FF3.5+ */
+
+ -webkit-box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.6);
+ /* Saf3.0+, Chrome */
+
+ box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.6);
+ /* Opera 10.5, IE9, Chrome 10+ */
+
+}
+#userBar li {
+ float: left;
+ width: 100px;
+ height: 10px;
+ list-style: none;
+ cursor: pointer;
}
-#timeLeft {
+#userBar li div {
+ background: red;
+ height: 5px;
+ text-indent: -9999px;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -o-user-select: none;
+ user-select: none;
+}
+#userBar .selected div {
+ height: 10px;
+}
+#userBar .me {
+ display: none;
+}
+/* FilesBody during upload */
+#uploadingFiles {
position: fixed;
left: 0;
- bottom: 0;
- height: 20px;
- background: #fff;
- background: rgba(255, 255, 255, 0.5);
- line-height: 20px;
- padding: 0 10px;
- color: #fff;
+ right: 0;
+ bottom: -145px;
+ height: 140px;
+ width: 100%;
+ background: #696969;
+ background: rgba(105, 105, 105, 0.2);
+ border-top: solid 5px rgba(105, 105, 105, 0.2);
+ z-index: 49;
}
-#fileSizeLegend {
+#uploadingFiles .file {
+ position: relative;
+ top: 0 !important;
+ left: 0 !important;
+ float: left;
+ padding: 0 5px;
+}
+/* BottomBar */
+#barWrapper {
position: fixed;
+ left: 0;
right: 0;
bottom: 0;
- height: 20px;
- line-height: 20px;
- list-style: none;
+ height: 25px;
+ width: 100%;
+ background: #000;
+ background: rgba(0, 0, 0, 0.3);
+ z-index: 50;
+ -moz-box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.6);
+ /* FF3.5+ */
+
+ -webkit-box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.6);
+ /* Saf3.0+, Chrome */
+
+ box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.6);
+ /* Opera 10.5, IE9, Chrome 10+ */
+
}
-#fileSizeLegend li {
+#rightMenu {
+ height: 25px;
float: right;
- padding: 0 5px;
+ width: 140px;
+}
+#meName {
+ line-height: 25px;
color: #fff;
- color: rgba(255, 255, 255, 0.5);
+ font-family: 'AllerRegular', 'Arial', 'Courier';
+ text-align: center;
+ margin: 0 1px;
+ padding: 0 3px;
+ width: 92px;
+ overflow: hidden;
}
-#fileSizeLegend li.legend {
- background: #3D3D3D;
- background: rgba(255, 255, 255, 0.5);
+#meName input {
+ border: none;
+ background: none;
+ outline: none !important;
+ color: #fff;
+ text-align: center;
+ font-family: 'AllerRegular', 'Arial', 'Courier';
}
-#fileSizeLegend li.small {
- background: #6FE85F;
- background: rgba(111, 232, 95, 0.5);
+#secure {
+ height: 25px;
+ width: 40px;
+ background: #e6e6e6;
+ float: right;
+ cursor: pointer;
}
-#fileSizeLegend li.big {
- background: #41914C;
- background: rgba(65, 145, 76, 0.5);
+#secure span.private {
+ width: 24px;
+ height: 17px;
+ display: block;
+ background: url(../images/secure.png) no-repeat;
+ text-indent: -9999px;
+ margin: 4px auto 0 auto;
}
-#fileSizeLegend li.bigger {
- background: #C9995B;
- background: rgba(201, 153, 91, 0.5);
+#secure span.public {
+ width: 24px;
+ height: 16px;
+ display: block;
+ background: url(../images/secure.png) no-repeat 0 -17px;
+ text-indent: -9999px;
+ margin: 4px auto 0 auto;
}
-#fileSizeLegend li.extrem {
- background: #C9605B;
- background: rgba(201, 96, 91, 0.5);
+#wrapLeft {
+ height: 25px;
+ margin-right: 140px;
+ /* width of rightMenu */
+
+ position: relative;
}
-/* home page */
-a.home {
- font-family: 'arial';
- font-size: 15px;
- color: #615A5C;
- width: 200px;
- margin: 10px auto 0 auto;
+.timer {
+ float: left;
+ height: 25px;
+ width: 140px;
+ background: #5a5a5a;
+ color: #fff;
+ font-family: 'AllerRegular', 'Arial', 'Courier';
+ line-height: 25px;
+ font-size: 12px;
+ padding: 0 5px;
text-align: center;
- display: block;
}
-form.home {
- position: fixed;
- top: 50%;
- left: 50%;
- widht: 300px;
- height: 200px;
- margin-top: -100px;
- margin-left: -150px;
- text-align: center;
+#chat {
+ position: relative;
+ height: 25px;
+ margin-left: 150px;
+ /* width of timer */
+
}
-form.home label {
- font-family: 'Cabin Sketch', arial, serif;
- font-size: 25px;
- margin: 10px 0;
- display: block;
+#chat #label {
+ float: left;
color: #fff;
+ height: 25px;
+ line-height: 25px;
+ padding: 0 10px 0 20px;
+ font-family: 'AllerRegular', 'Arial', 'Courier';
}
-form.home input {
- border: solid 10px #404040;
- background: #A39EA0;
- height: 40px;
- width: 260px;
- color: #fff;
- padding: 5px 10px;
- font-size: 20px;
- margin: 10px;
+#chat #label p {
+ display: inline;
}
-form.home input:focus {
- outline: none;
- background: #fff;
- color: #52494B;
+#chat #label p span {
+ padding: 0 0 0 3px;
}
-/* Active Users */
-#activeUser {
+#chat input {
+ border: none;
+ background: none;
+ color: #bcbcbc;
+ width: 100%;
+ height: 25px;
+ outline: none !important;
+}
+#inputWrap {
+ height: 25px;
+ overflow: hidden;
+}
+#chatWindow {
position: absolute;
- top: 0px;
- left: 0px;
+ top: 25px;
+ left: 0;
width: 100%;
- height: 5px;
- background: #fff;
- background: rgba(255, 255, 255, 0.3);
- margin: 0;
+ background: rgba(0, 0, 0, 0.5);
+ min-height: 200px;
}
-#activeUser li {
+#chatContentWrap {
+ position: absolute;
+ overflow: hidden;
+ width: 100%;
+ height: 100%;
+}
+#chatContent {
+ position: absolute;
+ bottom: 0;
+ padding: 25px 0 20px 0;
+ width: 100%;
+}
+#chatContent div {
+ clear: both;
+ overflow: hidden;
+ margin: 0 20px 20px 20px;
+}
+#chatContent span {
float: left;
- background: red;
+}
+#chatContent p {
+ overflow: hidden;
+ padding-left: 10px;
+ color: #fff;
+ line-height: 150%;
+}
+#chatButton {
+ position: absolute;
+ top: -25px;
+ right: 0;
width: 100px;
- height: 5px;
- list-style: none;
+ height: 25px;
+ color: #fff;
+ background: #989898;
+ cursor: pointer;
+ text-align: center;
+ line-height: 22px;
+ font-family: 'AllerRegular', 'Arial', 'Courier';
+}
+#chatButton span {
+ font-size: 19px;
}
-/* New Files */
+#chatExit {
+ position: absolute;
+ right: 0;
+ bottom: 0;
+ font-size: 11px;
+ color: #393939;
+ padding: 0 5px 3px 0;
+}
+/*
+ * ------------------><)
+ * FiLe STYLeS
+ * ------------------><)
+ */
.file {
- width: 100px;
position: absolute;
left: 0;
top: 0;
+}
+.fileWrapper {
+ position: relative;
+ top: 0;
+ left: 0;
+ width: 100px;
background: transparent;
text-align: center;
- padding: 3px;
- overflow-x: hidden;
+ /*overflow-x:hidden;*/
+
/*round borders*/
-moz-border-radius: 5px;
@@ -198,66 +548,36 @@ form.home input:focus {
border-radius: 5px;
/* Opera 10.5, IE9, Saf5, Chrome, FF4, iOS 4, Android 2.1+ */
- border: solid 3px transparent;
+ border: solid 2px transparent;
}
-.file:hover {
- border-top: solid 3px rgba(255, 255, 255, 0.4);
- border-left: solid 3px rgba(255, 255, 255, 0.4);
- border-right: solid 3px rgba(255, 255, 255, 0.4);
+.fileWrapper:hover {
+ border-top: solid 2px rgba(255, 255, 255, 0.4);
+ border-left: solid 2px rgba(255, 255, 255, 0.4);
+ border-right: solid 2px rgba(255, 255, 255, 0.4);
background: rgba(255, 255, 255, 0.1);
}
-.file h3 {
- color: #fff;
- font-family: 'Courier';
- font-size: 10px;
- width: 100px;
-}
-.fileSmall:hover {
- border-top: solid 3px rgba(111, 232, 95, 0.5);
- border-left: solid 3px rgba(111, 232, 95, 0.5);
- border-right: solid 3px rgba(111, 232, 95, 0.5);
- background: rgba(255, 255, 255, 0.1);
-}
-.fileBig:hover {
- border-top: solid 3px rgba(65, 145, 76, 0.5);
- border-left: solid 3px rgba(65, 145, 76, 0.5);
- border-right: solid 3px rgba(65, 145, 76, 0.5);
- background: rgba(255, 255, 255, 0.1);
-}
-.fileBigger:hover {
- border-top: solid 3px rgba(201, 153, 91, 0.5);
- border-left: solid 3px rgba(201, 153, 91, 0.5);
- border-right: solid 3px rgba(201, 153, 91, 0.5);
- background: rgba(255, 255, 255, 0.1);
-}
-.fileExtrem:hover {
- border-top: solid 3px rgba(201, 96, 91, 0.5);
- border-left: solid 3px rgba(201, 96, 91, 0.5);
- border-right: solid 3px rgba(201, 96, 91, 0.5);
+.active .fileWrapper {
+ border: solid 2px rgba(255, 255, 255, 0.4);
background: rgba(255, 255, 255, 0.1);
}
.format {
position: relative;
width: 100px;
height: 65px;
- z-index: 1;
-}
-.format .image {
- position: absolute;
- top: 0;
- left: 0;
- width: 100px;
- height: 65px;
background-position: center;
+ background-repeat: no-repeat;
+ margin: 10px 0 0 0;
+ cursor: pointer;
}
-.format .progress {
+.progress {
position: absolute;
- top: 9px;
+ top: 19px;
left: 25px;
width: 49px;
height: 46px;
background-color: transparent;
background-color: rgba(0, 0, 0, 0.5);
+ display: none;
}
.progressPercent {
position: absolute;
@@ -266,43 +586,169 @@ form.home input:focus {
width: 49px;
height: 46px;
}
-.progressPercent .progressCenter {
+.progressPercent .progressCentering {
height: 100%;
width: 49px;
display: table;
margin: 0px auto;
}
-.progressPercent .progressCenter span {
+.progressPercent .progressCentering span {
position: static;
display: table-cell;
text-align: center;
vertical-align: middle;
color: #fff;
font-size: 15px;
+ font-family: 'AllerRegular', 'Arial', 'Courier';
}
.progressBack {
background: #000;
}
+.title {
+ color: #fff;
+ font-family: 'AllerRegular', 'Arial', 'Courier';
+ font-size: 12px;
+ width: 90px;
+ margin: 0 5px 10px 5px;
+ word-wrap: break-word;
+}
+.titleHolder {
+ display: none;
+}
+.fileEditForm input {
+ color: #eaeaea;
+ background: #777777;
+ border: none;
+ padding: 0;
+ margin: 0;
+ font-family: 'AllerRegular', 'Arial', 'Courier';
+}
+.fileEditForm input:focus, .fileEditForm input:active {
+ outline: none !important;
+}
.operations {
- position: relative;
- margin: 0 20px;
- height: 10px;
- margin-bottom: -3px;
- z-index: 2;
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100px;
+ height: 100%;
+ background: rgba(31, 31, 32, 0.8);
+ display: none;
+}
+.operations p {
+ display: table-cell;
+ vertical-align: middle;
+ text-align: center;
+ font-family: 'AllerRegular', 'Arial', 'Courier';
+}
+.operations div {
+ display: table;
+ width: 100px;
+ text-decoration: none;
+ cursor: pointer;
+}
+.operations div:hover {
+ background: rgba(0, 0, 0, 0.46);
+}
+.operations .download {
+ color: #a3c181;
+ height: 70%;
}
-.operations a {
+.operations .download span {
display: block;
- text-indent: -9999px;
- width: 10px;
- height: 10px;
- float: right;
- padding-left: 5px;
}
-.operations a.download {
- background: url(../images/download.png) no-repeat;
+.operations .delete {
+ height: 30%;
+ color: #ef7f84;
+}
+/* File Types images*/
+.unknown {
+ background-image: url(../images/unknown.png);
+}
+.picture {
+ background-image: url(../images/picture.png);
}
-.operations a.delete {
- background: url(../images/delete.png) no-repeat;
+.video {
+ background-image: url(../images/video.png);
+}
+.audio {
+ background-image: url(../images/audio.png);
+}
+.text {
+ background-image: url(../images/text.png);
+}
+.pdf {
+ background-image: url(../images/pdf.png);
+}
+/* File Size Styles*/
+.fileSizeSmall:hover {
+ border-top: solid 2px rgba(111, 232, 95, 0.5);
+ border-left: solid 2px rgba(111, 232, 95, 0.5);
+ border-right: solid 2px rgba(111, 232, 95, 0.5);
+ background: rgba(255, 255, 255, 0.1);
+}
+.active .fileSizeSmall {
+ border: solid 2px rgba(111, 232, 95, 0.5);
+ background