mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +02:00
Menu Manager - huge cleanup - almost a rewrite. Also added experimental option for drag and drop - needs testing and refining.
This commit is contained in:
1025
e107_admin/menus.php
1025
e107_admin/menus.php
File diff suppressed because it is too large
Load Diff
130
e107_files/jslib/portal/portal.css
Normal file
130
e107_files/jslib/portal/portal.css
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
#content{
|
||||||
|
margin: 0 auto 0 auto;
|
||||||
|
width: 700px;
|
||||||
|
border: 1px solid red;
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block{
|
||||||
|
padding-top: 5px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .block h3{
|
||||||
|
margin:0;
|
||||||
|
background:transparent none repeat scroll 0 0;
|
||||||
|
border-bottom:1px solid #CCCCCC;
|
||||||
|
color:#4D3870;
|
||||||
|
font-size:18px;
|
||||||
|
height:36px;
|
||||||
|
padding:0px;
|
||||||
|
padding-left:10px;
|
||||||
|
line-height: 35px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block {
|
||||||
|
cursor: move;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#portal .block .content{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .block .config{
|
||||||
|
padding: 5px;
|
||||||
|
border-bottom:1px solid #CCCCCC;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .block .config .cancel-button{
|
||||||
|
border: 1px solid #c1c1c1;
|
||||||
|
3
|
||||||
|
color: #333333;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .block .config .save-button{
|
||||||
|
border: 1px solid #c1c1c1;
|
||||||
|
color: #000000;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .block .block-config, #portal .block .block-remove{
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .block-list-handle, #portal .handle {
|
||||||
|
cursor: default;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-controls{
|
||||||
|
float: right;
|
||||||
|
z-index: 101;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .block-controls a{
|
||||||
|
color: #999;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
#portal .block-controls a:hover{
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .handle a {
|
||||||
|
color: #999;
|
||||||
|
font-size: 11px;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .block-controls .block-remove span, #portal .block-controls .block-config span, #portal .handle span{
|
||||||
|
border: 1px solid #EFF0F1;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .block-controls .block-remove span:hover, #portal .block-controls .block-config span:hover, #portal .handle span:hover{
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .dropHelper{
|
||||||
|
border: 1px solid blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .dropHelper div{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
border: 1px dashed blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .block-horizontal ul {
|
||||||
|
list-style-image:none;
|
||||||
|
list-style-position:outside;
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal .block-horizontal ul li {
|
||||||
|
display: inline;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
#portal .block .block-toggle{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#portal #portal-column-block-list .block-archive .block-toggle{
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
#portal #portal-column-block-list .block .content {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#portal .block-hover {
|
||||||
|
border: 1px dashed #f00;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
253
e107_files/jslib/portal/portal.js
Normal file
253
e107_files/jslib/portal/portal.js
Normal file
@@ -0,0 +1,253 @@
|
|||||||
|
/**
|
||||||
|
iGoogle-style Drag&Drop Portal v1
|
||||||
|
|
||||||
|
Author: M.D.A. (Michel) Hiemstra
|
||||||
|
mhiemstra@php.net
|
||||||
|
www.michelhiemstra.nl
|
||||||
|
|
||||||
|
Inspired by 'Drag/Drop Portal Interface with Drupal'
|
||||||
|
|
||||||
|
Required: Prototype (1.6 and higher)
|
||||||
|
Script.aculo.us (with Effects and DragDrop) v1.8.2
|
||||||
|
|
||||||
|
Recoded and optimized for Prototype 1.6.0.3
|
||||||
|
|
||||||
|
Licenced CC BY-SA - http://creativecommons.org/licenses/by-sa/3.0/
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var settings = { 'portal-column-1':['block-test'] };
|
||||||
|
var options = { editorEnabled : true, 'saveurl' : '/path/to/script' };
|
||||||
|
var data = { };
|
||||||
|
|
||||||
|
var portal;
|
||||||
|
|
||||||
|
Event.observe(window, 'load', function() {
|
||||||
|
portal = new Portal(settings, options, data);
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- These are destinations of 'blocks' -->
|
||||||
|
<div id="portal">
|
||||||
|
<div class="portal-column dir-horizontal" id="portal-column-0"></div>
|
||||||
|
<div class="portal-column dir-vertical" id="portal-column-1"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- These are the blocks you can choose from -->
|
||||||
|
<div class="portal-column" id="portal-column-block-list">
|
||||||
|
<h2 class="block-list-handle">Block List</h2>
|
||||||
|
|
||||||
|
<!-- Block: testblock -->
|
||||||
|
<div class="block block-test" id="block-test">
|
||||||
|
<h3 class="handle"><div class="block-controls" style="display: none;"><a class="block-remove"><span>x</span></a> <a class="block-config"><span>e</span></a></div>Testblock</h3>
|
||||||
|
|
||||||
|
<div class="config" style="display: none;">
|
||||||
|
<div>config-params</div>
|
||||||
|
<div align="right">
|
||||||
|
<a href="#" class="cancel-button">cancel</a>
|
||||||
|
<a href="#" class="save-button">cancel</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div id="block-test-content">
|
||||||
|
test
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End: testblock -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var Portal = Class.create();
|
||||||
|
|
||||||
|
Portal.prototype = {
|
||||||
|
|
||||||
|
initialize : function (settings, options, data) {
|
||||||
|
// set options
|
||||||
|
this.setOptions(options);
|
||||||
|
|
||||||
|
// set blocks to their positions
|
||||||
|
this.applySettings(settings);
|
||||||
|
|
||||||
|
// load data to blocks
|
||||||
|
this.loadData(data);
|
||||||
|
|
||||||
|
// set styles of blocks
|
||||||
|
this.set_styles();
|
||||||
|
|
||||||
|
// if editor is enabled we proceed
|
||||||
|
if (!this.options.editorEnabled) return;
|
||||||
|
|
||||||
|
// get all available columns
|
||||||
|
var columns = $(this.options.portal).getElementsByClassName(this.options.column);
|
||||||
|
|
||||||
|
// loop trough columns array
|
||||||
|
$A(columns).each(function(column) {
|
||||||
|
|
||||||
|
// create sortable
|
||||||
|
Sortable.create(column, {
|
||||||
|
containment : $A(columns),
|
||||||
|
constraint : false,
|
||||||
|
ghosting : true,
|
||||||
|
tag : 'div',
|
||||||
|
only : this.options.block,
|
||||||
|
dropOnEmpty : true,
|
||||||
|
handle : this.options.handle,
|
||||||
|
hoverclass : this.options.hoverclass,
|
||||||
|
|
||||||
|
onUpdate : function (container) {
|
||||||
|
|
||||||
|
// if we dont have a save url we dont update
|
||||||
|
if (!this.options.saveurl) return;
|
||||||
|
|
||||||
|
// if we are in the same container we do nothing
|
||||||
|
if (container.id == this.options.blocklist) return;
|
||||||
|
|
||||||
|
// get blocks in this container
|
||||||
|
var blocks = container.getElementsByClassName(this.options.block);
|
||||||
|
|
||||||
|
// serialize all blocks in this container
|
||||||
|
var postBody = container.id + ':';
|
||||||
|
postBody += $A(blocks).pluck('id').join(',');
|
||||||
|
postBody = 'value=' + escape(postBody);
|
||||||
|
|
||||||
|
// save it to the database
|
||||||
|
//new Ajax.Request(this.options.saveurl, { method: 'post', postBody: postBody });
|
||||||
|
|
||||||
|
/* DEMO ONLY, REMOVE THIS */
|
||||||
|
new Ajax.Updater('debug', this.options.saveurl, {
|
||||||
|
method: 'post', postBody: postBody,
|
||||||
|
insertion: Insertion.Top
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// reset styles
|
||||||
|
this.set_styles();
|
||||||
|
|
||||||
|
}.bind(this)
|
||||||
|
});
|
||||||
|
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
|
||||||
|
//-----------//
|
||||||
|
|
||||||
|
// get all blocks
|
||||||
|
var blocks = $(this.options.portal).getElementsByClassName(this.options.block);
|
||||||
|
|
||||||
|
// loop trough blocks
|
||||||
|
$A(blocks).each(function(block) {
|
||||||
|
|
||||||
|
// enable controls if available
|
||||||
|
if (typeof(block.getElementsByClassName('block-controls').item(0)) == 'object') {
|
||||||
|
block.getElementsByClassName('block-controls').item(0).setStyle({'display' : 'block'});
|
||||||
|
}
|
||||||
|
|
||||||
|
// detail, set cursor style to move when in admin modus
|
||||||
|
if (typeof(block.getElementsByClassName('handle').item(0)) == 'object') {
|
||||||
|
// block.getElementsByClassName('handle').item(0).setStyle({'cursor' : 'move'});
|
||||||
|
}
|
||||||
|
|
||||||
|
// toggle configuration element
|
||||||
|
if (typeof(block.getElementsByClassName(this.options.config).item(0)) == 'object') {
|
||||||
|
Event.observe(block.getElementsByClassName(this.options.config).item(0), 'click', function () {
|
||||||
|
block.getElementsByClassName(this.options.configElement).item(0).toggle();
|
||||||
|
}.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
// observe save button
|
||||||
|
if (typeof(block.getElementsByClassName(this.options.configSave).item(0)) == 'object') {
|
||||||
|
Event.observe(block.getElementsByClassName(this.options.configSave).item(0), 'click', function (e) {
|
||||||
|
alert('save');
|
||||||
|
}.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
// observe cancel button
|
||||||
|
if (typeof(block.getElementsByClassName(this.options.configCancel).item(0)) == 'object') {
|
||||||
|
Event.observe(block.getElementsByClassName(this.options.configCancel).item(0), 'click', function (e) {
|
||||||
|
block.getElementsByClassName(this.options.configElement).item(0).toggle();
|
||||||
|
}.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
// observe delete block button
|
||||||
|
if (typeof(block.getElementsByClassName(this.options.remove).item(0)) == 'object') {
|
||||||
|
Event.observe(block.getElementsByClassName(this.options.remove).item(0), 'click', function (e) {
|
||||||
|
if (confirm('Are you sure you wish to delete this block?')) {
|
||||||
|
// alert(this.options.saveurl + '?delete')
|
||||||
|
new Ajax.Request(this.options.saveurl + 'delete', { method: 'post', postBody: 'block='+block.id }); $(block.id).hide();
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
set_styles : function () {
|
||||||
|
|
||||||
|
// get all blocks
|
||||||
|
var blocks = $(this.options.portal).getElementsByClassName(this.options.block);
|
||||||
|
|
||||||
|
// loop trough blocks
|
||||||
|
$A(blocks).each(function(block) {
|
||||||
|
if (block.up().hasClassName('dir-vertical')) {
|
||||||
|
|
||||||
|
block.removeClassName('block-horizontal').addClassName('block-vertical');
|
||||||
|
} else {
|
||||||
|
block.removeClassName('block-vertical').addClassName('block-horizontal');
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
applySettings : function (settings) {
|
||||||
|
// apply settings to the array
|
||||||
|
for (var container in settings) {
|
||||||
|
settings[container].each(function (block) { $(container).appendChild($(block)); });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setOptions : function (options) {
|
||||||
|
// set options
|
||||||
|
this.options = {
|
||||||
|
editorEnabled : false,
|
||||||
|
portal : 'portal',
|
||||||
|
column : 'portal-column',
|
||||||
|
block : 'block',
|
||||||
|
content : 'content',
|
||||||
|
configElement : 'config',
|
||||||
|
configSave : 'save-button',
|
||||||
|
configCancel : 'cancel-button',
|
||||||
|
handle : 'handle',
|
||||||
|
hoverclass : false,
|
||||||
|
remove : 'block-remove',
|
||||||
|
config : 'block-config',
|
||||||
|
blocklist : 'portal-column-block-list',
|
||||||
|
blocklistlink : 'portal-block-list-link',
|
||||||
|
blocklisthandle : 'block-list-handle',
|
||||||
|
saveurl : false
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.extend(this.options, options || {});
|
||||||
|
},
|
||||||
|
|
||||||
|
loadData : function (data) {
|
||||||
|
// load data for each block
|
||||||
|
for (var type in data) {
|
||||||
|
data[type].each(function(block) {
|
||||||
|
for (var blockname in block) {
|
||||||
|
// your code to load data here
|
||||||
|
new Ajax.Updater(blockname + '-content', '/url?'+type+'?data='+block[blockname]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/e_meta.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/e_meta.php,v $
|
||||||
| $Revision: 1.3 $
|
| $Revision: 1.4 $
|
||||||
| $Date: 2009-07-01 02:52:08 $
|
| $Date: 2009-07-10 14:27:31 $
|
||||||
| $Author: e107coders $
|
| $Author: e107coders $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user