forked from mikrobi/babel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…s using AJAX [mikrobi#83][mikrobi#59] extend babel plugin OnResourceDuplicate for nested resources [mikrobi#67] italian translation [mikrobi#60] Added Dutch translation [mikrobi#58][mikrobi#64] Fixed the error with updating a resource, at least in the quick update window
- Loading branch information
Showing
13 changed files
with
744 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* Babel | ||
* | ||
* Copyright 2010 by Jakob Class <jakob.class@class-zec.de> | ||
* | ||
* This file is part of Babel. | ||
* | ||
* Babel 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 2 of the License, or (at your option) any later | ||
* version. | ||
* | ||
* Babel 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 | ||
* Babel; if not, write to the Free Software Foundation, Inc., 59 Temple Place, | ||
* Suite 330, Boston, MA 02111-1307 USA | ||
* | ||
* @package babel | ||
*/ | ||
/** | ||
* Babel AJAX connector in the manager. | ||
* | ||
* @author goldsky <goldsky@virtudraft.com> | ||
* | ||
* @package babel | ||
*/ | ||
|
||
require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/config.core.php'; | ||
require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php'; | ||
require_once MODX_CONNECTORS_PATH . 'index.php'; | ||
|
||
$corePath = $modx->getOption('babel.core_path', null, $modx->getOption('core_path') . 'components/babel/'); | ||
require_once $corePath . 'model/babel/babel.class.php'; | ||
$modx->babel = new Babel($modx); | ||
|
||
$modx->lexicon->load('babel:default'); | ||
|
||
/* handle request */ | ||
$path = $modx->getOption('processorsPath', $modx->babel->config, $corePath . 'processors/'); | ||
$modx->request->handleRequest(array( | ||
'processors_path' => $path, | ||
'location' => '', | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,7 @@ | ||
/** | ||
* Babel CSS file | ||
* | ||
* @author Jakob Class <jakob.class@class-zec.de> | ||
* @author goldsky <goldsky@virtudraft.com> | ||
* | ||
* @package babel | ||
*/ | ||
#babel-box{ | ||
background: rgba(224, 224, 224, 0.75); | ||
margin:15px 0 0; | ||
padding:10px; | ||
-moz-border-radius: 3px; | ||
border-radius: 3px; | ||
/*display: inline-block; */ | ||
position: fixed; | ||
top: 124px; | ||
right: 20px; | ||
z-index: 12; | ||
} | ||
#babel-box a{ | ||
display:block; | ||
padding:5px 12px 4px 12px; | ||
background:#779937; | ||
color:white; | ||
text-decoration:none; | ||
-moz-border-radius: 3px; | ||
border-radius: 3px; | ||
text-shadow: 0 2px 1px #666; | ||
} | ||
|
||
#babel-box div.selected a{ | ||
background:#666; | ||
} | ||
#babel-box div.notset a{ | ||
background:#999; | ||
cursor:default; | ||
} | ||
#babel-box a:hover{ | ||
background:#628f2c; | ||
} | ||
#babel-box div.notset a:hover{ | ||
background:#999; | ||
} | ||
#babel-box div.babel-language { | ||
position: relative; | ||
float:left; | ||
margin:0 12px 0 0; | ||
} | ||
#babel-box div.babel-language-layer { | ||
z-index: 1000; | ||
display: none; | ||
position: absolute; | ||
top: 24px; | ||
right: 0; | ||
padding:11px; | ||
background:#ddd; | ||
border: 1px solid #ccc; | ||
-moz-border-radius: 4px; | ||
border-radius: 4px; | ||
-moz-box-shadow: 2px 2px 3px #666; | ||
-webkit-box-shadow: 2px 2px 3px #666; | ||
box-shadow: 2px 2px 3px #666; | ||
/* For IE 8 */ | ||
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=3, Direction=135, Color='#666666')"; | ||
/* For IE 5.5 - 7 */ | ||
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=3, Direction=135, Color='#666666'); | ||
} | ||
#babel-box input.x-form-text { | ||
padding: 0 2px; | ||
width: 20px; | ||
font-size: 11px; | ||
line-height: 18px; | ||
margin-right: 5px; | ||
} | ||
#babel-box input.x-btn { | ||
line-height: 14px; | ||
padding: 3px; | ||
margin: 2px 0; | ||
} | ||
#babel-second-row { | ||
white-space: nowrap; | ||
} | ||
#babel-error{ | ||
padding-bottom:10px; | ||
color: red; | ||
font-weight: bold; | ||
} | ||
#babel-box hr { | ||
margin: 8px 0; | ||
} | ||
#babel-box strong { | ||
font-weight: bold; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
/** | ||
* Babel | ||
* | ||
* Copyright 2010 by Jakob Class <jakob.class@class-zec.de> | ||
* | ||
* This file is part of Babel. | ||
* | ||
* Babel 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 2 of the License, or (at your option) any later | ||
* version. | ||
* | ||
* Babel 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 | ||
* Babel; if not, write to the Free Software Foundation, Inc., 59 Temple Place, | ||
* Suite 330, Boston, MA 02111-1307 USA | ||
* | ||
* @package babel | ||
*/ | ||
/** | ||
* Babel JavaScript class file for the menu in the manager. | ||
* | ||
* @author goldsky <goldsky@virtudraft.com> | ||
* | ||
* @package babel | ||
*/ | ||
|
||
function Babel(config) { | ||
this.config = config; | ||
} | ||
|
||
Babel.prototype.getMenu = function (menus) { | ||
var actionButtons = Ext.getCmp("modx-action-buttons"); | ||
if (actionButtons) { | ||
var menu = []; | ||
for (ctx in menus) { | ||
if (typeof(menus[ctx]["resourceUrl"]) !== 'undefined' && | ||
menus[ctx]["resourceUrl"] !== "" && | ||
menus[ctx]["resourceUrl"] !== "#" ) { | ||
if (ctx === Babel.config.context_key) { | ||
continue; | ||
} | ||
menu.push({ | ||
text: menus[ctx]["displayText"], | ||
menu: { | ||
items: [ | ||
{ | ||
text: _('babel.open') + " <b>" + menus[ctx]["resourceTitle"] + " (" + menus[ctx]["resourceId"] + ")</b>", | ||
resourceUrl: menus[ctx]["resourceUrl"], | ||
handler: function() { | ||
window.location.href = window.location.origin + window.location.pathname + this.resourceUrl; | ||
} | ||
}, '-', { | ||
text: _('babel.unlink') + " <b>" + menus[ctx]["resourceTitle"] + " (" + menus[ctx]["resourceId"] + ")</b>", | ||
contextKey: ctx, | ||
target: menus[ctx]["resourceId"], | ||
handler: function() { | ||
Babel.unlinkTranslation(this.contextKey, MODx.request.id, this.target); | ||
} | ||
} | ||
] | ||
} | ||
}); | ||
} else { | ||
menu.push({ | ||
text: menus[ctx]["displayText"], | ||
handler: Ext.emptyFn, | ||
menu: { | ||
items: [ | ||
{ | ||
text: _('babel.create_translation'), | ||
contextKey: ctx, | ||
handler: function() { | ||
Babel.createTranslation(this.contextKey, MODx.request.id); | ||
} | ||
}, '-', { | ||
text: _('babel.link_translation'), | ||
contextKey: ctx, | ||
handler: function() { | ||
Babel.linkTranslation(this.contextKey, MODx.request.id); | ||
} | ||
} | ||
] | ||
} | ||
}); | ||
} | ||
} | ||
var buttonMenu = new Ext.Button({ | ||
text: 'Select Language', | ||
menu: menu, | ||
listeners: { | ||
render: { | ||
fn: function (btn) { | ||
btn.setText(menus[Babel.config.context_key]["displayText"]); | ||
}, | ||
scope: this | ||
} | ||
} | ||
}); | ||
actionButtons.insertButton(0, [buttonMenu, "-"]); | ||
actionButtons.doLayout(); | ||
} | ||
}; | ||
|
||
Babel.prototype.linkTranslation = function (ctx, id) { | ||
var win = MODx.load({ | ||
xtype: 'modx-window', | ||
title: _('babel.link_translation'), | ||
url: Babel.config.connector_url, | ||
baseParams: { | ||
action: 'mgr/resource/link', | ||
context: ctx, | ||
id: id | ||
}, | ||
listeners: { | ||
'success': { | ||
fn: function (r) { | ||
MODx.msg.status({ | ||
title: _('success'), | ||
message: r.message || _('save_successful') | ||
}); | ||
}, | ||
scope: this} | ||
}, | ||
fields: [ | ||
{ | ||
xtype: 'textfield', | ||
fieldLabel: _('context'), | ||
disabled: true, | ||
emptyText: ctx | ||
}, { | ||
xtype: 'hidden', | ||
name: 'target' | ||
}, { | ||
xtype: 'modx-field-parent-change', | ||
fieldLabel: _('babel.id_of_target'), | ||
id: '', | ||
width: 370, | ||
name: 'target-combo', | ||
end: function (p) { | ||
var t = Ext.getCmp('modx-resource-tree'); | ||
if (!t) | ||
return; | ||
p.d = p.d || p.v; | ||
win.fp.getForm().findField('target').setValue(p.v); | ||
this.setValue(p.d); | ||
this.oldValue = false; | ||
} | ||
}, { | ||
xtype: 'xcheckbox', | ||
boxLabel: _('babel.copy_tv_values'), | ||
name: 'copy-tv-values' | ||
} | ||
] | ||
}); | ||
win.reset(); | ||
win.show(); | ||
}; | ||
|
||
Babel.prototype.unlinkTranslation = function (ctx, id, target) { | ||
return MODx.msg.confirm({ | ||
title: _('confirm'), | ||
text: _('babel.unlink_translation_confirm', {context: ctx, id: id}), | ||
url: Babel.config.connector_url, | ||
params: { | ||
action: 'mgr/resource/unlink', | ||
context: ctx, | ||
id: id, | ||
target: target | ||
}, | ||
listeners: { | ||
'success': { | ||
fn: function (r) { | ||
MODx.msg.status({ | ||
title: _('success'), | ||
message: r.message || _('save_successful') | ||
}); | ||
}, | ||
scope: this} | ||
} | ||
}); | ||
}; | ||
|
||
Babel.prototype.createTranslation = function (ctx, id) { | ||
return MODx.msg.confirm({ | ||
title: _('confirm'), | ||
text: _('babel.create_translation_confirm', {context: ctx, id: id}), | ||
url: Babel.config.connector_url, | ||
params: { | ||
action: 'mgr/resource/duplicate', | ||
context_key: ctx, | ||
id: id | ||
}, | ||
listeners: { | ||
'success': { | ||
fn: function (r) { | ||
MODx.loadPage('resource/update', 'id=' + r.object.id); | ||
}, | ||
scope: this} | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.