Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save webbash/d0e4235cab5232b7fb856297f212043c to your computer and use it in GitHub Desktop.
Save webbash/d0e4235cab5232b7fb856297f212043c to your computer and use it in GitHub Desktop.
<?php
$id = $_GET['id'];
if ($res = $modx->getObject('modResource',intval($id))) {
if(intval($res->get('template')) == 2)
{
$js ="
<script type='text/javascript'>
Ext.onReady(function () {
var tb = Ext.getCmp('modx-action-buttons');
tb.add({
text: 'Создать элемент',
cls: 'x-btn-text bmenu',
style: 'marginRight: 5px',
menuAlign: 'tr-br',
menu: {
id: 'xbuttons-x-menu',
items: [{
text: 'Ссылка на документ',
handler: function() {
MODx.loadPage('resource/create', 'parent=$id&template=6')
},
scope: this
}, {
text: 'Ссылка на сторонний ресурс',
handler: function() {
xButtons.saveToFile();
},
scope: this
}, '-', {
text: 'Текст (редактор)',
handler: function() {
document.getElementById('xbuttons_upload_file').click();
},
scope: this
}, {
text: 'Изображение (полная ширина)',
handler: function() {
xButtons.saveToPC();
},
scope: this
}, '-', {
text: 'Изображение (50% ширина)',
handler: function() {
document.getElementById('xbuttons_upload_properties').click();
},
scope: this
}, {
text: 'Таблицы (редактор)',
handler: function() {
xButtons.saveProp();
},
scope: this
}]
},
handler: function(){return false;}
});
tb.doLayout();
});
</script>";
$modx->regClientStartupHTMLBlock($js);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment