Commit df16f201 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Sebastien Robin

Rename vars.

parent 4a4b4a5b
......@@ -49,7 +49,7 @@ $().ready(function() {
<div>
<input type="text"
name="fileName"
id="input_fileName"
id="input_file_name"
value=""
placeholder="File name here" />&nbsp;
<button type="submit"
......
......@@ -208,7 +208,7 @@ function goToObj(s){
<div>
<input type="text"
name="fileName"
id="input_fileName"
id="input_file_name"
value=""
placeholder="File name here" />&nbsp;
<button type="submit"
......
......@@ -20,7 +20,7 @@
<li class="texteditor left-nav-tools">
<a href="#/texteditor"
onclick="javascript:
OfficeJS.open({app:'textEditor'});
OfficeJS.open({app:'text_editor'});
return false;">
<i class="icon-font"></i>
New Text Document
......@@ -29,7 +29,7 @@
<li class="imgeditor left-nav-tools">
<a href="#/imgeditor"
onclick="javascript:
OfficeJS.open({app:'imgEditor'});
OfficeJS.open({app:'img_editor'});
return false;">
<i class="icon-pencil"></i>
New Image
......@@ -38,16 +38,16 @@
<li class="spreadsheet left-nav-tools">
<a href="#/spreadsheet"
onclick="javascript:
OfficeJS.open({app:'speadsheet'});
OfficeJS.open({app:'spreadsheet'});
return false;">
<i class="icon-signal"></i>
New Spreadsheet
</a>
</li>
<!-- <li class="editpreferences left-nav-tools"> -->
<!-- <a href="#/editpreferences" -->
<!-- <a href="#/edit_preferences" -->
<!-- onclick="javascript: -->
<!-- OfficeJS.open({app:'editpreferences'}); -->
<!-- OfficeJS.open({app:'edit_preferences'}); -->
<!-- return false;"> -->
<!-- <i class="icon-check"></i> -->
<!-- Edit Preferences -->
......@@ -56,7 +56,7 @@
<li id="nav_document_list_header left-nav-tools">
<a href="#/doclist"
onclick="javascript:
OfficeJS.open({app:'documentLister'});
OfficeJS.open({app:'document_lister'});
return false;">
<i class="icon-list"></i>
Document List
......
......@@ -43,9 +43,9 @@
<script type="text/javascript">
<!--
(function () {
var grid, onSortFunction, onClickFunction, checkboxselector,
var grid, onSortFunction, onClickFunction, check_box_selector,
onRemoveSeveral, showIconFormatter,
documentlist = OfficeJS.cloneCurrentDocumentList(),
document_list = OfficeJS.cloneCurrentDocumentList(),
columns = [],
options = {
enableCellNavigation: true,
......@@ -62,18 +62,18 @@
var i, lm, cd, split, mime;
for (i = 0; i < array.length; i += 1) {
// file names
split = array[i].fileName.split('.');
array[i].fileExt = '';
split = array[i].name.split('.');
array[i].ext = '';
if (split.length > 1) {
array[i].fileExt = split[split.length-1];
array[i].ext = split[split.length-1];
split.length -= 1;
}
array[i].fileBaseName = split.join('.');
array[i].base_name = split.join('.');
// app & icon
mime = OfficeJS.getMimeOfExt (array[i].fileExt);
mime = OfficeJS.getMimeOfExt (array[i].ext);
if (!mime) {
array[i].icon = '?';
array[i].app = 'textEditor';
array[i].app = 'text_editor';
} else {
array[i].icon = mime.icon;
array[i].app = mime.pref || mime.app;
......@@ -81,51 +81,51 @@
// dates
// FIXME : we can have 2012/1/1 12:5
// we should have 2012/01/01 12:05
lm = (new Date(array[i].lastModified));
cd = (new Date(array[i].creationDate));
array[i].lastModified = lm.getFullYear()+'/'+
lm = (new Date(array[i].last_modified));
cd = (new Date(array[i].creation_date));
array[i].last_modified = lm.getFullYear()+'/'+
(lm.getMonth()+1)+'/'+lm.getDate()+' '+
lm.getHours()+':'+lm.getMinutes();
array[i].creationDate = cd.getFullYear()+'/'+
array[i].creation_date = cd.getFullYear()+'/'+
(cd.getMonth()+1)+'/'+cd.getDate()+' '+
cd.getHours()+':'+cd.getMinutes();
}
}(documentlist));
}(document_list));
$(function () {
checkboxselector = new Slick.CheckboxSelectColumn({
check_box_selector = new Slick.CheckboxSelectColumn({
cssClass: "slick-cell-checkboxsel"
});
columns.push(checkboxselector.getColumnDefinition());
columns.push(check_box_selector.getColumnDefinition());
columns.push({id:"icon",name:"",field:"icon",
sortable:true,resizable:false,width:24,
formatter:showIconFormatter});
columns.push({id:"fileName",name:"Document",
field:"fileBaseName",sortable:true});
columns.push({id:"lastModified",name:"Modified",
field:"lastModified",sortable:true});
columns.push({id:"creationDate",name:"Created",
field:"creationDate",sortable:true});
columns.push({id:"file_name",name:"Document",
field:"base_name",sortable:true});
columns.push({id:"last_modified",name:"Modified",
field:"last_modified",sortable:true});
columns.push({id:"creation_date",name:"Created",
field:"creation_date",sortable:true});
grid = new Slick.Grid("#myDocumentList",
documentlist,
document_list,
columns,
options);
grid.setSelectionModel(new Slick.RowSelectionModel(
{selectActiveRow: false}));
grid.registerPlugin(checkboxselector);
grid.registerPlugin(check_box_selector);
onSortFunction = function (e, args) {
var cols = args.sortCols;
documentlist.sort(function (dataRow1, dataRow2) {
document_list.sort(function (data_row1, data_row2) {
var i, l, field, sign, value1, value2, result;
for (i = 0, l = cols.length; i < l; i++) {
field = cols[i].sortCol.field;
sign = cols[i].sortAsc ? 1 : -1;
value1 = dataRow1[field];
value2 = dataRow2[field];
value1 = data_row1[field];
value2 = data_row2[field];
result = (value1==value2?0:(value1>value2?1:-1))*sign;
if (result != 0) {
return result;
......@@ -138,18 +138,18 @@
};
onClickFunction = function (e) {
var cell = grid.getCellFromEvent(e);
if (cell.cell === grid.getColumnIndex('fileName')) {
OfficeJS.open({app:documentlist[cell.row].app,
fileName:documentlist[cell.row].fileName});
if (cell.cell === grid.getColumnIndex('file_name')) {
OfficeJS.open({app:document_list[cell.row].app,
file_name:document_list[cell.row].name});
}
};
onRemoveSeveral = function () {
var documentnamesarray = [], selected, i, l;
var document_name_array = [], selected, i, l;
selected = grid.getSelectedRows();
for (i = 0, l = selected.length; i < l; i+= 1) {
documentnamesarray.push(documentlist[selected[i]].fileName);
document_name_array.push(document_list[selected[i]].name);
}
OfficeJS.removeSeveralFromArray (documentnamesarray);
OfficeJS.removeSeveralFromArray (document_name_array);
};
document.querySelector ('#slickgrid_document_lister_remove_selected').
onclick = onRemoveSeveral;
......
<div>
<input type="text"
name="fileName"
id="input_fileName"
id="input_file_name"
value=""
placeholder="File name here" />&nbsp;
<button type="submit"
......
......@@ -13,6 +13,7 @@
<script type="text/javascript" src="src/localorcookiestorage.js"></script>
<script type="text/javascript" src="src/jio.js"></script>
<script type="text/javascript" src="lib/base64/base64.js"></script>
<script type="text/javascript" src="lib/sjcl/sjcl.js"></script>
<script type="text/javascript" src="src/jio.storage.js"></script>
</head>
<body>
......
This diff is collapsed.
......@@ -5,7 +5,7 @@
// - dummyallfail
// - dummyallnotfound
// - dummyall3tries
(function () { var jio_dummy_storage_loader = function ( Jio ) {
(function () { var jioDummyStorageLoader = function ( Jio ) {
////////////////////////////////////////////////////////////////////////////
// Dummy Storage 1 : all ok
......@@ -33,16 +33,16 @@
// Returns a document object containing all information of the
// document and its content.
// document object is {'fileName':string,'fileContent':string,
// 'creationDate':date,'lastModified':date}
// document object is {'name':string,'content':string,
// 'creation_date':date,'last_modified':date}
// wait a little in order to simulate asynchronous operation
setTimeout(function () {
var doc = {
'fileContent': 'content',
'fileName': 'file',
'creationDate': 10000,
'lastModified': 15000};
'content': 'content',
'name': 'file',
'creation_date': 10000,
'last_modified': 15000};
that.done(doc);
}, 100);
}; // end loadDocument
......@@ -51,17 +51,17 @@
// It returns a document array containing all the user documents
// informations, but not their content.
// the list is [object,object] -> object = {'fileName':string,
// 'lastModified':date,'creationDate':date}
// the list is [object,object] -> object = {'name':string,
// 'last_modified':date,'creation_date':date}
setTimeout(function () {
var list = [
{'fileName':'file',
'creationDate':10000,
'lastModified':15000},
{'fileName':'memo',
'creationDate':20000,
'lastModified':25000
{'name':'file',
'creation_date':10000,
'last_modified':15000},
{'name':'memo',
'creation_date':20000,
'last_modified':25000
}];
that.done(list);
}, 100);
......@@ -107,8 +107,8 @@
that.loadDocument = function () {
// Returns a document object containing nothing.
// document object is {'fileName':string,'fileContent':string,
// 'creationDate':date,'lastModified':date}
// document object is {'name':string,'content':string,
// 'creation_date':date,'last_modified':date}
// wait a little in order to simulate asynchronous operation
setTimeout(function () {
......@@ -120,8 +120,8 @@
that.getDocumentList = function () {
// It returns nothing.
// the list is [object,object] -> object = {'fileName':string,
// 'lastModified':date,'creationDate':date}
// the list is [object,object] -> object = {'name':string,
// 'last_modified':date,'creation_date':date}
setTimeout(function () {
that.fail({status:0,statusText:'Unknown Error',
......@@ -171,8 +171,8 @@
that.loadDocument = function () {
// Returns a document object containing nothing.
// document object is {'fileName':string,'fileContent':string,
// 'creationDate':date,'lastModified':date}
// document object is {'name':string,'content':string,
// 'creation_date':date,'last_modified':date}
// wait a little in order to simulate asynchronous operation
setTimeout(function () {
......@@ -185,8 +185,8 @@
that.getDocumentList = function () {
// It returns nothing.
// the list is [object,object] -> object = {'fileName':string,
// 'lastModified':date,'creationDate':date}
// the list is [object,object] -> object = {'name':string,
// 'last_modified':date,'creation_date':date}
setTimeout(function () {
that.fail({status:404,statusText:'Not Found',
......@@ -214,15 +214,15 @@
newDummyStorageAll3Tries = function ( spec, my ) {
var that = Jio.newBaseStorage( spec, my ), priv = {};
priv.doJob = function (ifokreturn) {
priv.doJob = function (if_ok_return) {
// wait a little in order to simulate asynchronous operation
setTimeout(function () {
priv.Try3OKElseFail (that.cloneJob().tries,ifokreturn);
priv.Try3OKElseFail (that.cloneJob().tries,if_ok_return);
}, 100);
};
priv.Try3OKElseFail = function (tries,ifokreturn) {
priv.Try3OKElseFail = function (tries,if_ok_return) {
if ( tries === 3 ) {
return that.done(ifokreturn);
return that.done(if_ok_return);
}
if ( tries < 3 ) {
return that.fail({message:'' + (3 - tries) + ' tries left.'});
......@@ -242,20 +242,20 @@
that.loadDocument = function () {
priv.doJob ({
'fileContent': 'content2',
'fileName': 'file',
'creationDate': 11000,
'lastModified': 17000
'content': 'content2',
'name': 'file',
'creation_date': 11000,
'last_modified': 17000
});
}; // end loadDocument
that.getDocumentList = function () {
priv.doJob([{'fileName':'file',
'creationDate':10000,
'lastModified':15000},
{'fileName':'memo',
'creationDate':20000,
'lastModified':25000}
priv.doJob([{'name':'file',
'creation_date':10000,
'last_modified':15000},
{'name':'memo',
'creation_date':20000,
'last_modified':25000}
]);
}; // end getDocumentList
......@@ -269,25 +269,17 @@
////////////////////////////////////////////////////////////////////////////
// add key to storageObjectType of global jio
Jio.addStorageType('dummyallok', function (options) {
return newDummyStorageAllOk(options);
});
Jio.addStorageType('dummyallfail', function (options) {
return newDummyStorageAllFail(options);
});
Jio.addStorageType('dummyallnotfound', function (options) {
return newDummyStorageAllNotFound(options);
});
Jio.addStorageType('dummyall3tries', function (options) {
return newDummyStorageAll3Tries(options);
});
Jio.addStorageType('dummyallok', newDummyStorageAllOk);
Jio.addStorageType('dummyallfail', newDummyStorageAllFail);
Jio.addStorageType('dummyallnotfound', newDummyStorageAllNotFound);
Jio.addStorageType('dummyall3tries', newDummyStorageAll3Tries);
};
if (window.requirejs) {
define ('JIODummyStorages',['JIO'], jio_dummy_storage_loader);
define ('JIODummyStorages',['JIO'], jioDummyStorageLoader);
} else {
jio_dummy_storage_loader ( JIO );
jioDummyStorageLoader ( JIO );
}
}());
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment