This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
330 lines (296 loc) · 11.9 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<?php
/*
Meldbox
Version: 1.6
Author:
Shawn Welch <[email protected]>
Web:
https://github.com/shrimpwagon/meldbox
http://meldbox.net
License:
GPL v3 http://www.gnu.org/licenses/gpl.html
Meldbox is an open source, in-browser web page and app designer for developers
Copyright (C) 2013 by Shawn Welch <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Get list of saved files
$files = array();
foreach(new DirectoryIterator('saved') as $file) {
if($file->isFile()) $files[] = $file->getFilename();
}
sort($files);
// Get available CSS libs
$css_libs = array();
foreach(new DirectoryIterator('css/lib') as $css_lib) {
if($css_lib->isFile()) $css_libs[] = $css_lib->getFilename();
}
sort($css_libs);
// Panel control buttons
/* Add these later
<i class="icon icon-chevron-sign-left panel-control shift-left-panel"></i>
<i class="icon icon-chevron-sign-right panel-control shift-right-panel"></i>
*/
$panel_controls = '
<div class="panel-controls">
<i class="icon icon-chevron-sign-up panel-control shift-up-panel"></i>
<i class="icon icon-chevron-sign-down panel-control shift-down-panel"></i>
<i class="icon icon-minus-sign panel-control expand-panel"></i>
<i class="icon icon-remove-sign panel-control remove-panel"></i>
</div>';
// Default file open
$open_file = ($_GET['open_file']) ? $_GET['open_file'] : $_COOKIE['open_file'];
if($open_file && !is_file('saved/' . $open_file)) $open_file = '';
if(!$open_file && is_file('saved/Welcome')) $open_file = 'Welcome';
// Open in preiview mode
$preview_mode = $_GET['preview_mode'];
?>
<!DOCTYPE html>
<html>
<head>
<title>Meldbox - Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/jquery.contextMenu.css" />
<link rel="stylesheet" type="text/css" href="css/meldbox.css" />
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="css/codemirror.css" />
<script>
var init = function() {
$.Meldbox = new Meldbox();
$.Meldbox.openFile('<?php echo $open_file ?>', true);
<?php if($preview_mode) { ?>$.Meldbox.previewMode(true); <?php } ?>
}
</script>
<script data-main="js/app" src="js/lib/require.js"></script>
</head>
<body>
<!-- Menu -->
<div id="menu">
<a href="http://meldbox.net" target="_blank" style="float: left; display: block;"><img src="img/logo-small.png" /></a>
<div style="margin-left: 20px;">
<a href="javascript: void(0)">File</a>
<div>
<a href="javascript: $.Meldbox.newDesign()">New</a>
<a href="javascript: $.Meldbox.toggleDialog('open', true)">Open</a>
<a href="javascript: $.Meldbox.saveDesign()">Save</a>
<a href="javascript: $.Meldbox.saveDesign(true)">Save As...</a>
</div>
</div>
<div>
<a href="javascript: void(0)">Edit</a>
<div>
<a href="javascript: $.Meldbox.undo()">Undo<span style="float: right;">Ctrl + Z</span></a>
<a href="javascript: $.Meldbox.redo()">Redo<span style="float: right;">Ctrl + Y</span></a>
<div class="seperator"></div>
<a href="javascript: $.Meldbox.insertMeldbox({'top': '0px', 'left': '0px'})">Insert Meldbox</a>
<div class="seperator"></div>
<a href="javascript: $.Meldbox.cut()">Cut<span style="float: right;">Ctrl + X</span></a>
<a href="javascript: $.Meldbox.copy()">Copy<span style="float: right;">Ctrl + C</span></a>
<a href="javascript: $.Meldbox.paste()">Paste<span style="float: right;">Ctrl + V</span></a>
<a href="javascript: $.Meldbox.clear()">Clear<span style="float: right;">Backspace</span></a>
</div>
</div>
<div>
<a href="javascript: void(0)">Select</a>
<div>
<a href="javascript: $.Meldbox.selectAll()">Select All<span style="float: right;">Ctrl + A</span></a>
<a href="javascript: $.Meldbox.deselect()">Deselect<span style="float: right;">Ctrl + D</span></a>
</div>
</div>
<div>
<a href="javascript: void(0)">Modify</a>
<div>
<a href="javascript: $.Meldbox.toggleDialog('canvas', true)">Canvas</a>
<div class="seperator"></div>
<a href="javascript: $.Meldbox.lockSelection()">Lock<span style="float: right;">Ctrl + Alt + L</span></a>
<a href="javascript: $.Meldbox.unlockAll()">Unlock All</a>
</div>
</div>
<div>
<a href="javascript: void(0)">Window</a>
<div>
<a href="javascript: $.Meldbox.closeDialogs()" id="menu-closedialogs">Close All</a>
<div class="seperator"></div>
<a href="javascript: $.Meldbox.toggleDialog('about')" id="menu-about"><span class="icon icon-check"></span> About</a>
<a href="javascript: $.Meldbox.toggleDialog('canvas')" id="menu-canvas"><span class="icon icon-check-empty"></span> Canvas</a>
<a href="javascript: $.Meldbox.toggleDialog('style')" id="menu-style"><span class="icon icon-check"></span> CSS Element Style</a>
<a href="javascript: $.Meldbox.toggleDialog('css')" id="menu-css"><span class="icon icon-check-empty"></span> CSS Library</a>
<a href="javascript: $.Meldbox.toggleDialog('distribute')" id="menu-distribute"><span class="icon icon-check-empty"></span> Distribute</a>
<a href="javascript: $.Meldbox.toggleDialog('innerhtml')" id="menu-innerhtml"><span class="icon icon-check"></span> Inner HTML</a>
<a href="javascript: $.Meldbox.toggleDialog('open')" id="menu-open"><span class="icon icon-check-empty"></span> Open File</a>
</div>
</div>
<div>
<a href="javascript: void(0)">Help</a>
<div>
<a href="http://css3gen.com/box-shadow/" target="_blank">Box Shadows</a>
<a href="http://www.html5rocks.com/en/tutorials/masking/adobe/" target="_blank">Clipping & Masking</a>
<a href="http://www.colorzilla.com/gradient-editor/" target="_blank">Gradient Generator</a>
<a href="http://davidwalsh.name/css-transform-rotate" target="_blank">Rotation</a>
<a href="http://svg-edit.googlecode.com/svn/branches/2.6/editor/svg-editor.html" target="_blank">SVG Editor</a>
<a href="http://css3gen.com/text-shadow/" target="_blank">Text Shadows</a>
</div>
</div>
<div>
<a href="javascript: $.Meldbox.previewMode(true)">Preview</a>
</div>
<div id="file-title">Untitled</div>
<br style="clear: both;" />
</div>
<!-- Page -->
<div id="design-area">
<div id="design-canvas" class="clickable">
<div id="mb-multi-select"></div>
<div id="selection-boxes"></div>
<div id="container" class="clickable"></div>
</div>
</div>
<!-- DIALOGS -->
<div id="pd-tool-container-left" class="pd-tool-container">
<div id="css-panel" data-panel="css" class="pd-tool-panel" style="display: none;">
<h4 class="panel-header">CSS Library
<?php echo $panel_controls ?>
</h4>
<div>
<select id="css-file-select" size="5" style="width: 100%;">
<?php
foreach($css_libs as $css_lib) {
echo '
<option value="' . $css_lib . '">' . $css_lib . '</option>';
}
?>
</select><br />
<button type="button" id="import-css-btn">Import</button><br /><br />
<div id="css-libraries"></div><br />
</div>
</div>
<div id="open-panel" data-panel="open" class="pd-tool-panel" style="display: none;">
<h4 class="panel-header">Open File
<?php echo $panel_controls ?>
</h4>
<div>
<select id="open-file-select" size="10" style="width: 100%;">
<?php
foreach($files as $file) {
echo '
<option value="' . $file . '">' . $file . '</option>';
}
?>
</select><br /><br />
<button type="button" id="open-file-btn">Open</button>
</div>
</div>
<div id="canvas-panel" data-panel="canvas" class="pd-tool-panel" style="display: none;">
<h4 class="panel-header">Canvas
<?php echo $panel_controls ?>
</h4>
<div>
Alignment:
<select id="canvas-alignment">
<option value="left">Left</option>
<option value="none">Center</option>
<option value="right">Right</option>
</select>
<br /><br />
<table cellspacing="0" cellpadding="0">
<tr>
<td class="panel-field-label">Resize Origin:</td>
<td>
<select id="canvas-resize-origin">
<option value="top-left">Top, Left</option>
<option value="top-center">Top, Center</option>
<option value="top-right">Top, Right</option>
<option value="middle-left">Middle, Left</option>
<option value="middle-center">Middle, Center</option>
<option value="middle-right">Middle, Right</option>
<option value="bottom-left">Bottom, Left</option>
<option value="bottom-center">Bottom, Center</option>
<option value="bottom-right">Bottom, Right</option>
</select>
</td>
</tr>
<tr>
<td class="panel-field-label">Resize Width:</td>
<td><input type="text" class="panel-px-input" id="canvas-resize-width" /> px</td>
</tr>
<tr>
<td class="panel-field-label">Resize Height:</td>
<td><input type="text" class="panel-px-input" id="canvas-resize-height" /> px</td>
</tr>
</table>
<span class="panel-note">Update: (Enter)</span>
</div>
</div>
<div id="distribute-panel" data-panel="distribute" class="pd-tool-panel" style="display: none;">
<h4 class="panel-header">Distribute
<?php echo $panel_controls ?>
</h4>
<div>
<table cellspacing="0" cellpadding="0">
<tr>
<td>Horizontal:</td>
<td><input type="text" id="distrib-horz-txt" class="panel-px-input" /> px</td>
</tr>
<tr>
<td class="panel-field-label">Vertical:</td>
<td><input type="text" id="distrib-vert-txt" class="panel-px-input" /> px</td>
</tr>
</table>
<span class="panel-note">Update: (Enter)</span>
</div>
</div>
<div id="about-panel" data-panel="about" class="pd-tool-panel">
<h4 class="panel-header">About
<?php echo $panel_controls ?>
</h4>
<div>
<p style="text-align: center; font-size: 12px">
Meldbox v1.6<br /><br />
Author:<br />
Shawn Welch <<a href="mailto:[email protected]">[email protected]</a>><br /><br />
Source and Issues:<br /><a href="https://github.com/shrimpwagon/meldbox" target="_blank">github.com/shrimpwagon/meldbox</a><br /><br />
</p>
<div style="text-align: center; font-size: 12px">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="MF2WXBZSLGBW8">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</div>
</div>
</div>
<div id="innerhtml-panel" data-panel="innerhtml" class="pd-tool-panel">
<h4 class="panel-header">mBox Inner HTML
<?php echo $panel_controls ?>
</h4>
<div>
<textarea id="edit-text" class="dialog-text edit-area" data-editarea="html" wrap="off"></textarea>
<span class="panel-note">Update: (Ctrl + Enter)</span>
<span style="float: right;"><input type="checkbox" onclick="$.Meldbox.toggleWrap(this)" data-cm="EditText" /> Wrap text</span>
</div>
</div>
<div id="style-panel" data-panel="style" class="pd-tool-panel">
<h4 class="panel-header">mBox CSS Style
<?php echo $panel_controls ?>
</h4>
<div>
<textarea id="style-text" class="dialog-text edit-area" data-editarea="css" wrap="off"></textarea>
<span class="panel-note">Update: (Ctrl + Enter)</span>
<span style="float: right;"><input type="checkbox" onclick="$.Meldbox.toggleWrap(this)" data-cm="StyleText" /> Wrap text</span>
</div>
</div>
</div>
<!--
<div id="pd-tool-container-right" class="pd-tool-container"></div>
-->
</body>
</html>