Commit 79ac23a6 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Sebastien Robin

OfficeJS - Add: grunt tests, ICanHaz lib, light UI.

parent 9b2e03c8
This diff is collapsed.
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: '<json:package.json>',
meta: {
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - '+
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> Nexedi;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
},
concat: {
dist: {
src: ['<banner:meta.banner>',
'<file_strip_banner:../../src/<%= pkg.name %>.js>'],
dest: '../../lib/jio/<%= pkg.name %>.js'
}
},
min: {
dist: {
src: ['<banner:meta.banner>', '<config:concat.dist.dest>'],
dest: '../../lib/jio/<%= pkg.name %>.min.js'
}
},
qunit: {
files: []
},
lint: {
files: ['grunt.js','../../script/**/*.js']
},
watch: {
files: '<config:lint.files>',
tasks: 'lint'
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
browser: true
},
globals: {
jQuery: true,
LocalOrCookieStorage: true,
Base64: true,
JIO: true,
console: true,
unescape: true,
// Needed to avoid "not defined error" with requireJs
define: true,
require: true,
// Needed to avoid "not defined error" with sinonJs
sinon: true,
module: true,
test: true,
ok: true,
deepEqual: true,
expect: true,
stop: true,
start: true,
equal: true
}
},
uglify: {}
});
// Default task.
grunt.registerTask('default', 'lint');
};
{
"name": "officejs",
"title": "OfficeJS",
"description": "The Free HTML5 Cloud Office",
"version": "0.1.0",
"homepage": "",
"author": {
"name": "Tristan Cavelier",
"email": "tristan.cavelier@tiolive.com"
},
"repository": {
"type": "git",
"url": "http://git.erp5.org/repos/ung.git"
},
"bugs": {
"url": ""
},
"licenses": [
],
"dependencies": {
"jquery": "~1.7",
"require": "1.0.8"
},
"keywords": []
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<litk rel="icon" href="img/officejs/favicon.png" />
<link rel="shortcut icon" href="img/officejs/favicon.png" />
<link rel="stylesheet" href="css/officejs.css" />
<title>OfficeJS</title>
<!-- js scripts -->
<script type="text/javascript" src="lib/icanhaz/ICanHaz.min.js"></script>
<script data-main="script/loader"
type="text/javascript"
src="lib/require/require.js"></script>
<!-- html scripts -->
<script id="test" type="text/html">
<article>
<p>
test
</p>
</article>
</script>
</head>
<body>
<header>
<aside>
<nav id="header_navbar">
<ul class="nav">
<li><a href="#">Nav</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</aside>
<h1>OfficeJS</h1>
</header>
<nav id="left_navbar">
<ul class="nav">
<li class="nav-header">Documents</li>
<li class="create_document"><a href="#/create_document">Create Document</a></li>
<li><a href="#/test">Test</a></li>
<li class="other">Other</li>
</ul>
</nav>
<section id="main">
<!-- Body content -->
</section>
</body>
</html>
(function(){var q=function(){function c(a){return(""+a).replace(/&(?!\w+;)|[<>"']/g,function(a){return k[a]||a})}var e=Object.prototype.toString;Array.isArray=Array.isArray||function(a){return"[object Array]"==e.call(a)};var i=String.prototype.trim,g;if(i)g=function(a){return null==a?"":i.call(a)};else{var h,m;/\S/.test("\u00a0")?(h=/^[\s\xA0]+/,m=/[\s\xA0]+$/):(h=/^\s+/,m=/\s+$/);g=function(a){return null==a?"":a.toString().replace(h,"").replace(m,"")}}var k={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;",
"'":"&#39;"},o={},p=function(){};p.prototype={otag:"{{",ctag:"}}",pragmas:{},buffer:[],pragmas_implemented:{"IMPLICIT-ITERATOR":!0},context:{},render:function(a,d,b,f){if(!f)this.context=d,this.buffer=[];if(this.includes("",a)){var a=this.render_pragmas(a),j=this.render_section(a,d,b);!1===j&&(j=this.render_tags(a,d,b,f));if(f)return j;this.sendLines(j)}else{if(f)return a;this.send(a)}},send:function(a){""!==a&&this.buffer.push(a)},sendLines:function(a){if(a)for(var a=a.split("\n"),d=0;d<a.length;d++)this.send(a[d])},
render_pragmas:function(a){if(!this.includes("%",a))return a;var d=this,b=this.getCachedRegex("render_pragmas",function(a,d){return RegExp(a+"%([\\w-]+) ?([\\w]+=[\\w]+)?"+d,"g")});return a.replace(b,function(a,b,e){if(!d.pragmas_implemented[b])throw{message:"This implementation of mustache doesn't understand the '"+b+"' pragma"};d.pragmas[b]={};e&&(a=e.split("="),d.pragmas[b][a[0]]=a[1]);return""})},render_partial:function(a,d,b){a=g(a);if(!b||void 0===b[a])throw{message:"unknown_partial '"+a+"'"};
return!d||"object"!=typeof d[a]?this.render(b[a],d,b,!0):this.render(b[a],d[a],b,!0)},render_section:function(a,d,b){if(!this.includes("#",a)&&!this.includes("^",a))return!1;var f=this,j=this.getCachedRegex("render_section",function(a,b){return RegExp("^([\\s\\S]*?)"+a+"(\\^|\\#)\\s*(.+)\\s*"+b+"\n*([\\s\\S]*?)"+a+"\\/\\s*\\3\\s*"+b+"\\s*([\\s\\S]*)$","g")});return a.replace(j,function(a,j,e,c,g,h){var a=j?f.render_tags(j,d,b,!0):"",h=h?f.render(h,d,b,!0):"",n,c=f.find(c,d);"^"===e?n=!c||Array.isArray(c)&&
0===c.length?f.render(g,d,b,!0):"":"#"===e&&(n=Array.isArray(c)?f.map(c,function(a){return f.render(g,f.create_context(a),b,!0)}).join(""):f.is_object(c)?f.render(g,f.create_context(c),b,!0):"function"==typeof c?c.call(d,g,function(a){return f.render(a,d,b,!0)}):c?f.render(g,d,b,!0):"");return a+n+h})},render_tags:function(a,d,b,f){for(var j=this,e=function(){return j.getCachedRegex("render_tags",function(a,b){return RegExp(a+"(=|!|>|&|\\{|%)?([^#\\^]+?)\\1?"+b+"+","g")})},g=e(),h=function(a,f,h){switch(f){case "!":return"";
case "=":return j.set_delimiters(h),g=e(),"";case ">":return j.render_partial(h,d,b);case "{":case "&":return j.find(h,d);default:return c(j.find(h,d))}},a=a.split("\n"),i=0;i<a.length;i++)a[i]=a[i].replace(g,h,this),f||this.send(a[i]);if(f)return a.join("\n")},set_delimiters:function(a){a=a.split(" ");this.otag=this.escape_regex(a[0]);this.ctag=this.escape_regex(a[1])},escape_regex:function(a){if(!arguments.callee.sRE)arguments.callee.sRE=RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\)",
"g");return a.replace(arguments.callee.sRE,"\\$1")},find:function(a,d){function b(a){return!1===a||0===a||a}var a=g(a),f;if(a.match(/([a-z_]+)\./ig)){var c=this.walk_context(a,d);b(c)&&(f=c)}else b(d[a])?f=d[a]:b(this.context[a])&&(f=this.context[a]);return"function"==typeof f?f.apply(d):void 0!==f?f:""},walk_context:function(a,d){for(var b=a.split("."),f=void 0!=d[b[0]]?d:this.context,c=f[b.shift()];void 0!=c&&0<b.length;)f=c,c=c[b.shift()];return"function"==typeof c?c.apply(f):c},includes:function(a,
d){return-1!=d.indexOf(this.otag+a)},create_context:function(a){if(this.is_object(a))return a;var d=".";if(this.pragmas["IMPLICIT-ITERATOR"])d=this.pragmas["IMPLICIT-ITERATOR"].iterator;var b={};b[d]=a;return b},is_object:function(a){return a&&"object"==typeof a},map:function(a,d){if("function"==typeof a.map)return a.map(d);for(var b=[],c=a.length,e=0;e<c;e++)b.push(d(a[e]));return b},getCachedRegex:function(a,d){var b=o[this.otag];b||(b=o[this.otag]={});var c=b[this.ctag];c||(c=b[this.ctag]={});
(b=c[a])||(b=c[a]=d(this.otag,this.ctag));return b}};return{name:"mustache.js",version:"0.4.0",to_html:function(a,c,b,f){var e=new p;if(f)e.send=f;e.render(a,c||{},b);if(!f)return e.buffer.join("\n")}}}();(function(){var c={VERSION:"0.10",templates:{},$:"undefined"!==typeof window?window.jQuery||window.Zepto||null:null,addTemplate:function(e,i){if("object"===typeof e)for(var g in e)this.addTemplate(g,e[g]);else c[e]?console.error("Invalid name: "+e+"."):c.templates[e]?console.error('Template "'+e+
' " exists'):(c.templates[e]=i,c[e]=function(g,i){var g=g||{},k=q.to_html(c.templates[e],g,c.templates);return c.$&&!i?c.$(k):k})},clearAll:function(){for(var e in c.templates)delete c[e];c.templates={}},refresh:function(){c.clearAll();c.grabTemplates()},grabTemplates:function(){var e,i=document.getElementsByTagName("script"),g,h=[];for(e=0,l=i.length;e<l;e++)if((g=i[e])&&g.innerHTML&&g.id&&("text/html"===g.type||"text/x-icanhaz"===g.type))c.addTemplate(g.id,"".trim?g.innerHTML.trim():g.innerHTML.replace(/^\s+/,
"").replace(/\s+$/,"")),h.unshift(g);for(e=0,l=h.length;e<l;e++)h[e].parentNode.removeChild(h[e])}};"undefined"!==typeof require?module.exports=c:window.ich=c;"undefined"!==typeof document&&(c.$?c.$(function(){c.grabTemplates()}):document.addEventListener("DOMContentLoaded",function(){c.grabTemplates()},!0))})()})();
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 11 February 2007), see www.w3.org" />
<meta name="generator" content=
"ERP5 - Copyright (C) 2001 - 2008. All rights reserved." />
<meta name="description" content="ERP5 Free Open Source ERP and CRM" />
<meta name="keywords" content="" />
<meta name="robots" content="index, follow" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>Office JS</title>
<link type="text/css" rel="stylesheet" href="css/jquery-ui.css" />
<link type="text/css" rel="stylesheet" href="css/officejs.css" />
<link rel="icon" type="image/x-icon" href="img/officejs/favicon.ico" />
<link rel="shortcut icon"
type="image/x-icon" href="img/officejs/favicon.ico" />
<!-- dependencies: jquery sjcl base64 jio tools theme officejs login -->
<script data-main="scripts/login/loader" src="libs/require/require.js">
</script>
</head>
<body>
<div class="container">
<div class="navigation" style="display:none">
<!-- Each aggregate of groups is a div wrapper -->
<div class="wrapper" id="wrapper_navigation">
<div class=" navigation-right">
<fieldset class="widget">
<div class="field" title="">
<label>your_language</label>
<div class="input">
<div>
<div id="select_language">
<!-- todo : interface to change the language -->
</div>
</div>
</div>
</div>
</fieldset>
</div>
</div>
</div>
<div class="main">
<!-- Each aggregate of groups is a div wrapper -->
<div class="wrapper" id="wrapper_main">
<div class="content">
<fieldset class="widget">
<h2>Welcome to OfficeJS</h2>
<div id="main-content">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td valign="top">
<div id="advertisement">
<b>Sign in to edit documents, spreadsheets and drawing and share this document with other users</b><br />
<img src="img/officejs/logo.png" alt="" />
</div>
</td>
<td>
<table id="field_table" style="display: table; width: 78%;">
<tbody>
<tr>
<td align="center">
<table>
<tbody>
<tr>
<td align="center" colspan="2"><font size="-1">Login in</font></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td align="center"><label for="name">Name</label></td>
<td align="center"><input id="name" type="text" value="" name="name" /></td>
</tr>
<tr>
<td align="center"><label for="storage_location">Storage Location
<span class="tooltipElement" onmouseover="tooltip.show('please, indicate the storage server&lt;br/&gt;where your data will be stored&lt;br/&gt;let free to store on your computer')">(?)</span></label></td>
<td><input id="storage_location" type="text" value="" name="storage_location" /></td>
</tr>
<tr>
<td align="center" colspan="2"><input class="submit" onclick="logUser()" type="button" value="Login" name="logged_in:method" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td><br /></td>
<td>
<table id="create-new-user" style="width: 78%; display: none;">
<tbody>
<tr>
<td>
<form id="create-user" action="javascript:createNewUser()" method="post" name="create-user">
<table width="100%">
<tbody>
<tr>
<td align="center" colspan="2"><b>Create an account</b></td>
</tr>
<tr>
<td id="form-message" align="center" colspan="2"></td>
</tr>
<tr>
<td>First Name</td>
<td><input type="text" name="firstname" /></td>
</tr>
<tr>
<td>Last Name</td>
<td><input type="text" name="lastname" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td>Login name</td>
<td><input type="text" name="login_name" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" /></td>
</tr>
<tr>
<td>Confirm Password</td>
<td><input type="password" name="confirm" /></td>
</tr>
<tr>
<td align="center" colspan="2"><input class="submit" type="submit" value="Create Account" name="logged_in:method" /></td>
</tr>
<tr>
<td id="back-login" align="left" colspan="2"><a onclick="displayNewAccountForm(false)">&lt;&lt;Back</a></td>
</tr>
</tbody>
</table>
</form>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
<td>
<table id="new-account-table" style="display: table; width: 78%;">
<tbody>
<tr>
<td>
<table width="100%">
<tbody>
<tr>
<td align="center" colspan="2"><b>Don't have an <span class="tooltipElement" onmouseover="tooltip.show('register to store your data&lt;br/&gt;on our server&lt;br/&gt;(not implemented yet)')">OfficeJS Account</span> ?</b></td>
</tr>
<tr>
<td id="new-account-form" align="center" colspan="2"
onclick="displayNewAccountForm(true)">Create an
account now</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="footer">
<a href="http://www.freecloudalliance.org/">Free Cloud Alliance</a> - <a href="#">Help</a>
</div>
</fieldset>
</div>
</div>
</div>
</div>
<div id="page_bottom"></div>
<div class="toolLocation"></div>
</body>
</html>
require.config ({
paths: {
LocalOrCookieStorage: '../lib/jio/localorcookiestorage.min',
jQueryAPI: '../lib/jquery/jquery',
jQuery: '../lib/jio/jquery.requirejs_module',
JIO: '../src/jio',
Base64API: '../lib/base64/base64',
Base64: '../lib/jio/base64.requirejs_module',
JIOStorages: '../lib/jio/jio.storage.min',
OfficeJS: '../script/officejs'
}
});
require(['OfficeJS'],function (OJS) {
var JIO = OJS.JIO,
$ = OJS.jQuery,
Base64 = OJS.Base64,
ich = OJS.ich;
$('#main').html(ich['test']({},true));
});
define ('OfficeJS',
['LocalOrCookieStorage',
'jQuery',
'JIO',
'Base64',
'JIOStorages'],
function (LocalOrCookieStorage,
jQuery,
JIO,
Base64) {
return {LocalOrCookieStorage: LocalOrCookieStorage,
jQuery: jQuery,
JIO: JIO,
Base64: Base64,
ich: window.ich};
});
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