1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: 15: 16: 17: 18: 19: 20: 21: 22: 23:
24: class IMP_Script_Package_ComposeBase extends Horde_Script_Package
25: {
26: 27: 28:
29: public function __construct()
30: {
31: global $page_output, $registry, $session;
32:
33: $this->_files[] = new Horde_Script_File_JsDir('compose-base.js', 'imp');
34:
35: if ($session->get('imp', 'rteavail')) {
36: switch ($registry->getView()) {
37: case $registry::VIEW_DYNAMIC:
38: $this->_files[] = new Horde_Script_File_JsDir('ckeditor/imageupload.js', 'imp');
39: $this->_files[] = new Horde_Script_File_JsDir('ckeditor/imagepoll.js', 'imp');
40: $page_output->addInlineJsVars(array(
41: 'IMP_Ckeditor_Imagepoll.related_attr' => IMP_Compose::RELATED_ATTR
42: ));
43:
44: $plugin = 'pasteattachment';
45: $upload_url = $registry->getServiceLink('ajax', 'imp')->url . 'addAttachmentCkeditor';
46: break;
47:
48: default:
49: $plugin = 'pasteignore';
50: $upload_url = '';
51: break;
52: }
53:
54: $js = new Horde_Script_File_JsDir('ckeditor/' . $plugin . '.js', 'imp');
55: $page_output->addInlineScript(array(
56: 'if (window.CKEDITOR) { CKEDITOR.on("loaded", function(e) {' .
57: 'CKEDITOR.plugins.addExternal("' . $plugin . '", "' . $js->url->url . '", "");' .
58: 'CKEDITOR.config.filebrowserImageUploadUrl = "' . $upload_url . '";' .
59: '}); };'
60: ), true);
61: }
62: }
63:
64: }
65: