New steps on page customization.

This commit is contained in:
Paulo Veiga 2012-02-03 21:21:29 -03:00
parent af240506ea
commit 0101ec2ae7
11 changed files with 303 additions and 153 deletions

View File

@ -25,6 +25,9 @@ mindplot.Designer = new Class({
this._options = options;
// Set full div elem render area ...
divElement.setStyles(options.size);
// Dispatcher manager ...
var commandContext = new mindplot.CommandContext(this);
if (!$defined(options.collab) || options.collab == 'standalone') {
@ -54,6 +57,10 @@ mindplot.Designer = new Class({
}
this._relPivot = new mindplot.RelationshipPivot(this._workspace, this);
// Set editor working area ...
this.setViewPort(options.viewPort);
},
_registerEvents : function() {

View File

@ -0,0 +1,32 @@
@import "editor.less";
/* Overwrite some styles */
div#headerInfo{
height:0;
}
div#header {
height:35px;
}
div#headerMapTitle,#headerActions,#headerLogo {
display:none;
}
/* Footer Styles */
div#footer {
position: absolute;
height: 0px;
width: 100%;
bottom: 0;
left: 0;
}
div#footerLogo {
height: 65px;
width: 80px;
position: absolute;
background: url(../images/logo-small.png) no-repeat right top;
right: 10px;
top: -50px;
}

View File

@ -82,3 +82,14 @@ div#headerNotifier {
}
@import "toolbar.less";
div#embFooter {
position: absolute;
height: 35px;
width: 100%;
bottom: 0;
left: 0;
border-top: 1px solid black;
background: #E5E5E5;
font-family: Arial;
}

View File

@ -44,7 +44,8 @@ html {
}
/* ------------- Footer Styles -------------------------*/
div#embFooter {
div# <div id="footer"></div>
{
position: absolute;
height: 35px;
width: 100%;

View File

@ -4,18 +4,63 @@
<head>
<title>WiseMapping - Embedded Sample </title>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
<style>
body {
font-family: Arial, Tahoma;
background: #a9a9a9;
padding: 10px 30px;
}
iframe {
border: 0;
}
#editor {
width: 100%;
text-align: center;
}
#code {
border: 1px dashed #f5f5dc;
padding: 10px;
background: #838383;
}
</style>
<link rel="icon" href="../images/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon">
</head>
<body>
<div>
<div id="doc">
<h1>Embedded editor sample</h1>
<div style="text-align:right">
<iframe src="editor.html?confUrl=../html/container.json" width="800" height="600"></iframe>
<p>
This is a simple example of how WiseMapping can be embedded in a page.
Embedding WiseMapping editor is such simple as copying this line in your page:
</p>
<div id="code">&lt;iframe src="embedded.html?confUrl=../html/container.json" width="800" height="600"&gt;&lt;/iframe&gt;</div>
<p>
The container.json file contains a set of properties that must be configured. Properties:
</p>
<ul>
<li>size: Must match with the size of the iframe</li>
<li>zoom: Scale to be applied to the map</li>
<li>readOnly: If the map could be modified.</li>
<li>persistenceManager: Persistence managers to be used. By default, local browser storage is used.</li>
<li>mapId: UUID of the map to be loaded..</li>
</ul>
<p>
It's important to point out that embedded.html is a static html page that it's mean to be a template page
for advanced customization. In few words, go ahead and modify it.
</p>
</div>
<div id="editor">
<iframe src="embedded.html?confUrl=../html/container.json" width="800" height="400"></iframe>
</div>
</div>
</body>
</html>

View File

@ -1,9 +1,15 @@
{
"readOnly":"false",
"zoom":0.85,
"saveOnLoad":false,
"readOnly":false,
"zoom":1.3,
"size":{
"width":800,
"height":600
}
"height":400
},
"viewPort":
{
"width":800,
"height":400
},
"persistenceManager": "mindplot.LocalStorageManager",
"mapId": "welcome"
}

View File

@ -157,12 +157,14 @@
</div>
<div id="fontColor" class="buttonExtOn" title="Fond Color" style="padding-top:4px">
<img src="../images/font-color.png"/>
</div>
</div>
</div>
</div>
<div id="headerNotifier"></div>
<div id="footer">
<div id="footerLogo"></div>
</div>
</div>
<div id="mindplot"></div>

View File

@ -0,0 +1,171 @@
<!DOCTYPE HTML>
<html>
<head>
<title>WiseMapping - Editor </title>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
<!--[if lt IE 9]>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<![endif]-->
<link rel="stylesheet/less" type="text/css" href="../css/embedded.less"/>
<script type='text/javascript' src='../js/mootools-core-1.3.2.js'></script>
<script type='text/javascript' src='../js/mootools-more-1.3.2.js'></script>
<script type='text/javascript' src='../js/core.js'></script>
<script type='text/javascript' src='../js/less-1.1.3.min.js'></script>
<link rel="icon" href="../images/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon">
<script type="text/javascript">
$(document).addEvent('loadcomplete', function(resource) {
var options = loadDesignerOptions();
var designer = buildDesigner(options);
// Load map from XML ...
var mapId = options.mapId ? options.mapId : 'welcome';
var mindmap;
try {
var persistence = mindplot.PersistenceManager.getInstance();
mindmap = persistence.load(mapId);
} catch(e) {
// If the map could not be loaded, create a new empty map...
mindmap = mindplot.model.Mindmap.buildEmpty(mapId);
}
designer.loadMap(mindmap);
// If not problem has arisen, close the dialog ...
if (!window.hasUnexpectedErrors) {
waitDialog.deactivate();
}
});
</script>
</head>
<body>
<div id="waitDialog" style="display:none">
<div id="waitingContainer">
<div class="loadingIcon"></div>
<div class="loadingText">
Loading ...
</div>
</div>
</div>
<div id="errorDialog" style="display:none">
<div id="errorContainer">
<div class="loadingIcon"></div>
<div class="loadingText">
Unexpected error loading your map :(
</div>
</div>
</div>
<script type="text/javascript">
var waitDialog = new core.WaitDialog();
waitDialog.activate(true, $("waitDialog"));
$(window).addEvent("error", function(event) {
// Show error dialog ...
waitDialog.changeContent($("errorDialog"), false);
return false;
});
</script>
<div id="header">
<div id="headerInfo">
<div id="headerActions"></div>
<div id="headerLogo"></div>
<div id="headerMapTitle">Title: <span>Welcome</span></div>
</div>
<div id="toolbar">
<div id="editTab" class="tabContent">
<div id="persist" class="buttonContainer">
<div id="save" class="buttonOn" title="Save">
<img src="../images/save.png"/>
</div>
<div id="discard" class="buttonOn" title="Discard">
<img src="../images/discard.png"/>
</div>
</div>
<div id="edit" class="buttonContainer">
<div id="undoEdition" class="buttonOn" title="Undo Edition">
<img src="../images/undo.png"/>
</div>
<div id="redoEdition" class="buttonOn" title="Redo Edition">
<img src="../images/redo.png"/>
</div>
</div>
<div id="zoom" class="buttonContainer">
<div id="zoomIn" class="buttonOn" title="Zoom In">
<img src="../images/zoom-in.png"/>
</div>
<div id="zoomOut" class="buttonOn" title="Zoom Out">
<img src="../images/zoom-out.png"/>
</div>
</div>
<div id="node" class="buttonContainer">
<div id="topicShape" class="buttonExtOn" title="Topic Shape">
<img src="../images/topic-shape.png"/>
</div>
<div id="addTopic" class="buttonOn" title="Add Topic">
<img src="../images/topic-add.png"/>
</div>
<div id="deleteTopic" class="buttonOn" title="Delete">
<img src="../images/topic-delete.png"/>
</div>
<div id="topicBorder" class="buttonOn" title="Border Color">
<img src="../images/topic-border.png"/>
</div>
<div id="topicColor" class="buttonExtOn" title="Background Color">
<img src="../images/topic-color.png"/>
</div>
<div id="topicIcon" class="buttonExtOn" title="Add Icon">
<img src="../images/topic-icon.png"/>
</div>
<div id="topicNote" class="buttonOn" title="Add Note">
<img src="../images/topic-note.png"/>
</div>
<div id="topicLink" class="buttonOn" title="Add Link">
<img src="../images/topic-link.png"/>
</div>
<div id="topicRelation" class="buttonOn" title="Add Relationship">
<img src="../images/topic-relation.png"/>
</div>
</div>
<div id="font" class="buttonContainer">
<div id="fontFamily" class="buttonOn" title="Font Style">
<img src="../images/font-type.png"/>
</div>
<div id="fontSize" class="buttonExtOn" title="Font Size">
<img src="../images/font-size.png"/>
</div>
<div id="fontBold" class="buttonOn" title="Bold Style">
<img src="../images/font-bold.png"/>
</div>
<div id="fontItalic" class="buttonOn" title="Italic Style">
<img src="../images/font-italic.png"/>
</div>
<div id="fontColor" class="buttonExtOn" title="Fond Color" style="padding-top:4px">
<img src="../images/font-color.png"/>
</div>
</div>
</div>
</div>
<div id="headerNotifier"></div>
<div id="footer">
<div id="footerLogo"></div>
</div>
</div>
<div id="mindplot"></div>
<script type="text/javascript" src="../js/editor.js"></script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<!--[if lt IE 9]>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<![endif]-->
<link rel="stylesheet" type="text/css" href="../css/embedded.css"/>
<link rel="stylesheet" type="text/css" href="../css/viewmode.css"/>
<script type='text/javascript' src='../js/mootools-core-1.3.2.js'></script>
<script type='text/javascript' src='../js/mootools-more-1.3.2.js'></script>
<script type='text/javascript' src='../js/core.js'></script>

View File

@ -21,13 +21,18 @@ var designer = null;
function buildDesigner(options) {
var container = $('mindplot');
container.setStyles(options.size);
designer = new mindplot.Designer(options, container);
designer.setViewPort({
height: parseInt(window.innerHeight - 70), // Footer and Header
width: parseInt(window.innerWidth)
});
// Configure default persistence manager ...
var persistence;
if (options.persistenceManager) {
persistence = eval("new " + options.persistenceManager + "()");
} else {
persistence = new mindplot.LocalStorageManager();
}
mindplot.PersistenceManager.init(persistence);
if (!options.readOnly) {
if ($('toolbar')) {
@ -70,7 +75,12 @@ function loadDesignerOptions() {
height: parseInt(screen.height),
width: parseInt(screen.width)
};
result = {readOnly:false,zoom:0.85,saveOnLoad:true,size:containerSize};
var viewPort = {
height: parseInt(window.innerHeight - 70), // Footer and Header
width: parseInt(window.innerWidth)
};
result = {readOnly:false,zoom:0.85,saveOnLoad:true,size:containerSize,viewPort:viewPort};
}
return result;
}

View File

@ -1,135 +0,0 @@
html {
overflow: hidden;
}
#waitDialog {
position: absolute;
top: 10px;
left: 10px;
height: 100px;
}
#firstHeader {
width: 100%;
}
#subHeader {
position: absolute;
width: 100%;
height: 55px;
top: 30px;
}
#loadingContainer {
position: relative;
top: 80px;
height: 120px; /*background: whitesmoke;*/
background: #FEFEFE;
opacity: .99;
padding: 15px;
width: 100%;
border: 1px solid;
border-color: #a9a9a9;
}
#loadingContainer .loadingText {
position: relative;
top: 50%;
margin-top: -35px;
font-size: 30px;
font-weight: bold;
vertical-align: text-bottom;
height: 30px;
float: left;
}
#loadingContainer .loadingIcon {
position: relative;
background: url(../images/ajax-loader2.gif) no-repeat;
top: 25px;
height: 100px;
width: 70px;
float: left;
clear: both;
}
/* ------------- Footer Styles -------------------------*/
div#embFooter {
position: absolute;
height: 35px;
width: 100%;
bottom: 0;
left: 0;
border-top: 1px solid black;
background: #E5E5E5;
}
div#logo {
height: 65px;
width: 80px;
position: absolute;
background: url(../images/logo-small.png) no-repeat right top;
right: 10px;
top: -10px;
}
.button {
width: 20px;
height: 20px;
float: left;
cursor: pointer;
white-space: nowrap;
margin: 1px;
}
.button:hover {
float: left;
cursor: pointer;
border: 1px solid black;
border-top-color: white;
border-left-color: white;
margin: 0px;
}
div#zoomIn {
background: url(../images/zoom-in.png) no-repeat left top;
margin-top: 10px;
margin-left: 10px;
}
#zoomOut {
background: url(../images/zoom-out.png) no-repeat left top;;
margin-top: 10px;
margin-left: 5px;
}
div#mindplot {
position: relative;
top: 0;
left: 0;
width: 100%;
}
div#mapContainer {
border-bottom: 1px solid black;
padding-bottom: 40px;
height: 400px;
width: 100%;
}
div#mapDetails {
float: right;
padding-top: 10px;
margin-right: 100px;
font-family: arial,serif;
font-size: 11px;
}
div#mapDetails .title {
font-weight: bold;
margin-left: 10px;
margin-right: 3px;
}