Created
September 19, 2017 12:09
-
-
Save webbash/d0e4235cab5232b7fb856297f212043c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?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