|
|
| 9 |
* @package plugins.generic.customBlockManager |
9 |
* @package plugins.generic.customBlockManager |
| 10 |
* @class CustomBlockEditForm |
10 |
* @class CustomBlockEditForm |
| 11 |
* |
11 |
* |
| 12 |
* Form for journal managers to create and modify sidebar blocks |
12 |
* Form for conference managers to create and modify sidebar blocks |
| 13 |
* |
13 |
* |
| 14 |
*/ |
14 |
*/ |
| 15 |
|
15 |
|
| 16 |
import('form.Form'); |
16 |
import('form.Form'); |
| 17 |
|
17 |
|
| 18 |
class CustomBlockEditForm extends Form { |
18 |
class CustomBlockEditForm extends Form { |
| 19 |
/** @var $journalId int */ |
19 |
/** @var $conferenceId int */ |
| 20 |
var $journalId; |
20 |
var $conferenceId; |
| 21 |
|
21 |
|
| 22 |
/** @var $plugin object */ |
22 |
/** @var $plugin object */ |
| 23 |
var $plugin; |
23 |
var $plugin; |
|
|
| 27 |
|
27 |
|
| 28 |
/** |
28 |
/** |
| 29 |
* Constructor |
29 |
* Constructor |
| 30 |
* @param $journalId int |
30 |
* @param $conferenceId int |
| 31 |
*/ |
31 |
*/ |
| 32 |
function CustomBlockEditForm(&$plugin, $journalId) { |
32 |
function CustomBlockEditForm(&$plugin, $conferenceId) { |
| 33 |
|
33 |
|
| 34 |
parent::Form($plugin->getTemplatePath() . 'editCustomBlockForm.tpl'); |
34 |
parent::Form($plugin->getTemplatePath() . 'editCustomBlockForm.tpl'); |
| 35 |
|
35 |
|
| 36 |
$this->journalId = $journalId; |
36 |
$this->conferenceId = $conferenceId; |
| 37 |
$this->plugin =& $plugin; |
37 |
$this->plugin =& $plugin; |
| 38 |
|
38 |
|
| 39 |
$this->addCheck(new FormValidatorPost($this)); |
39 |
$this->addCheck(new FormValidatorPost($this)); |
|
|
| 45 |
* Initialize form data from current group group. |
45 |
* Initialize form data from current group group. |
| 46 |
*/ |
46 |
*/ |
| 47 |
function initData() { |
47 |
function initData() { |
| 48 |
$journalId = $this->journalId; |
48 |
$conferenceId = $this->conferenceId; |
| 49 |
$plugin =& $this->plugin; |
49 |
$plugin =& $this->plugin; |
| 50 |
|
50 |
|
| 51 |
// add the tiny MCE script |
51 |
// add the tiny MCE script |
| 52 |
$this->addTinyMCE(); |
52 |
$this->addTinyMCE(); |
| 53 |
$this->setData('blockContent', $plugin->getSetting($journalId, 'blockContent')); |
53 |
$this->setData('blockContent', $plugin->getSetting($conferenceId, 0, 'blockContent')); |
| 54 |
} |
54 |
} |
| 55 |
|
55 |
|
| 56 |
/** |
56 |
/** |
| 57 |
* Add the tinyMCE script for editing sidebar blocks with a WYSIWYG editor |
57 |
* Add the tinyMCE script for editing sidebar blocks with a WYSIWYG editor |
| 58 |
*/ |
58 |
*/ |
| 59 |
function addTinyMCE() { |
59 |
function addTinyMCE() { |
| 60 |
$journalId = $this->journalId; |
60 |
$conferenceId = $this->conferenceId; |
| 61 |
$plugin =& $this->plugin; |
61 |
$plugin =& $this->plugin; |
| 62 |
$templateMgr =& TemplateManager::getManager(); |
62 |
$templateMgr =& TemplateManager::getManager(); |
| 63 |
|
63 |
|
| 64 |
// Enable TinyMCE with specific params |
64 |
// Enable TinyMCE with specific params |
| 65 |
$additionalHeadData = $templateMgr->get_template_vars('additionalHeadData'); |
65 |
$additionalHeadData = $templateMgr->get_template_vars('additionalHeadData'); |
| 66 |
|
66 |
|
| 67 |
import('file.JournalFileManager'); |
67 |
import('file.ConferenceFileManager'); |
| 68 |
$publicFileManager = new PublicFileManager(); |
68 |
$publicFileManager = new PublicFileManager(); |
| 69 |
$tinyMCE_script = ' |
69 |
$tinyMCE_script = ' |
| 70 |
<script language="javascript" type="text/javascript" src="'.Request::getBaseUrl().'/'.TINYMCE_JS_PATH.'/tiny_mce.js"></script> |
70 |
<script language="javascript" type="text/javascript" src="'.Request::getBaseUrl().'/'.TINYMCE_JS_PATH.'/tiny_mce.js"></script> |
|
|
| 80 |
theme_advanced_toolbar_align : "left", |
80 |
theme_advanced_toolbar_align : "left", |
| 81 |
content_css : "' . Request::getBaseUrl() . '/styles/common.css", |
81 |
content_css : "' . Request::getBaseUrl() . '/styles/common.css", |
| 82 |
relative_urls : false, |
82 |
relative_urls : false, |
| 83 |
document_base_url : "'. Request::getBaseUrl() .'/'.$publicFileManager->getJournalFilesPath($journalId) .'/", |
83 |
document_base_url : "'. Request::getBaseUrl() .'/'.$publicFileManager->getConferenceFilesPath($conferenceId) .'/", |
| 84 |
extended_valid_elements : "span[*], div[*]" |
84 |
extended_valid_elements : "span[*], div[*]" |
| 85 |
}); |
85 |
}); |
| 86 |
</script>'; |
86 |
</script>'; |
|
|
| 101 |
*/ |
101 |
*/ |
| 102 |
function save() { |
102 |
function save() { |
| 103 |
$plugin =& $this->plugin; |
103 |
$plugin =& $this->plugin; |
| 104 |
$journalId = $this->journalId; |
104 |
$conferenceId = $this->conferenceId; |
| 105 |
$plugin->updateSetting($journalId, 'blockContent', $this->getData('blockContent')); |
105 |
$plugin->updateSetting($conferenceId, 0, 'blockContent', $this->getData('blockContent')); |
| 106 |
} |
106 |
} |
| 107 |
|
107 |
|
| 108 |
} |
108 |
} |