diff -cr ojs2/plugins/generic/customBlockManager/CustomBlockEditForm.inc.php ocs2/plugins/generic/customBlockManager/CustomBlockEditForm.inc.php
*** ojs2/plugins/generic/customBlockManager/CustomBlockEditForm.inc.php 2009-10-01 13:01:01.000000000 -0700
--- ocs2/plugins/generic/customBlockManager/CustomBlockEditForm.inc.php 2009-10-16 19:03:27.000000000 -0700
***************
*** 9,23 ****
* @package plugins.generic.customBlockManager
* @class CustomBlockEditForm
*
! * Form for journal managers to create and modify sidebar blocks
*
*/
import('form.Form');
class CustomBlockEditForm extends Form {
! /** @var $journalId int */
! var $journalId;
/** @var $plugin object */
var $plugin;
--- 9,23 ----
* @package plugins.generic.customBlockManager
* @class CustomBlockEditForm
*
! * Form for conference managers to create and modify sidebar blocks
*
*/
import('form.Form');
class CustomBlockEditForm extends Form {
! /** @var $conferenceId int */
! var $conferenceId;
/** @var $plugin object */
var $plugin;
***************
*** 27,39 ****
/**
* Constructor
! * @param $journalId int
*/
! function CustomBlockEditForm(&$plugin, $journalId) {
parent::Form($plugin->getTemplatePath() . 'editCustomBlockForm.tpl');
! $this->journalId = $journalId;
$this->plugin =& $plugin;
$this->addCheck(new FormValidatorPost($this));
--- 27,39 ----
/**
* Constructor
! * @param $conferenceId int
*/
! function CustomBlockEditForm(&$plugin, $conferenceId) {
parent::Form($plugin->getTemplatePath() . 'editCustomBlockForm.tpl');
! $this->conferenceId = $conferenceId;
$this->plugin =& $plugin;
$this->addCheck(new FormValidatorPost($this));
***************
*** 45,70 ****
* Initialize form data from current group group.
*/
function initData() {
! $journalId = $this->journalId;
$plugin =& $this->plugin;
// add the tiny MCE script
$this->addTinyMCE();
! $this->setData('blockContent', $plugin->getSetting($journalId, 'blockContent'));
}
/**
* Add the tinyMCE script for editing sidebar blocks with a WYSIWYG editor
*/
function addTinyMCE() {
! $journalId = $this->journalId;
$plugin =& $this->plugin;
$templateMgr =& TemplateManager::getManager();
// Enable TinyMCE with specific params
$additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
! import('file.JournalFileManager');
$publicFileManager = new PublicFileManager();
$tinyMCE_script = '
--- 45,70 ----
* Initialize form data from current group group.
*/
function initData() {
! $conferenceId = $this->conferenceId;
$plugin =& $this->plugin;
// add the tiny MCE script
$this->addTinyMCE();
! $this->setData('blockContent', $plugin->getSetting($conferenceId, 0, 'blockContent'));
}
/**
* Add the tinyMCE script for editing sidebar blocks with a WYSIWYG editor
*/
function addTinyMCE() {
! $conferenceId = $this->conferenceId;
$plugin =& $this->plugin;
$templateMgr =& TemplateManager::getManager();
// Enable TinyMCE with specific params
$additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
! import('file.ConferenceFileManager');
$publicFileManager = new PublicFileManager();
$tinyMCE_script = '
***************
*** 80,86 ****
theme_advanced_toolbar_align : "left",
content_css : "' . Request::getBaseUrl() . '/styles/common.css",
relative_urls : false,
! document_base_url : "'. Request::getBaseUrl() .'/'.$publicFileManager->getJournalFilesPath($journalId) .'/",
extended_valid_elements : "span[*], div[*]"
});
';
--- 80,86 ----
theme_advanced_toolbar_align : "left",
content_css : "' . Request::getBaseUrl() . '/styles/common.css",
relative_urls : false,
! document_base_url : "'. Request::getBaseUrl() .'/'.$publicFileManager->getConferenceFilesPath($conferenceId) .'/",
extended_valid_elements : "span[*], div[*]"
});
';
***************
*** 101,108 ****
*/
function save() {
$plugin =& $this->plugin;
! $journalId = $this->journalId;
! $plugin->updateSetting($journalId, 'blockContent', $this->getData('blockContent'));
}
}
--- 101,108 ----
*/
function save() {
$plugin =& $this->plugin;
! $conferenceId = $this->conferenceId;
! $plugin->updateSetting($conferenceId, 0, 'blockContent', $this->getData('blockContent'));
}
}
diff -cr ojs2/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php ocs2/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php
*** ojs2/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php 2009-10-01 13:01:02.000000000 -0700
--- ocs2/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php 2009-10-16 19:03:26.000000000 -0700
***************
*** 54,63 ****
case 'blocks':
$this->import('CustomBlockPlugin');
! $journal =& Request::getJournal();
! if ( !$journal ) return false;
! $blocks = $this->getSetting($journal->getJournalId(), 'blocks');
if ( !is_array($blocks) ) break;
$i= 0;
foreach ( $blocks as $block ) {
--- 54,63 ----
case 'blocks':
$this->import('CustomBlockPlugin');
! $conference =& Request::getConference();
! if ( !$conference ) return false;
! $blocks = $this->getSetting($conference->getConferenceId(), 0, 'blocks');
if ( !is_array($blocks) ) break;
$i= 0;
foreach ( $blocks as $block ) {
***************
*** 84,104 ****
* Determine whether or not this plugin is enabled.
*/
function getEnabled() {
! $journal =& Request::getJournal();
! if (!$journal) return false;
! return $this->getSetting($journal->getJournalId(), 'enabled');
}
/**
* Set the enabled/disabled state of this plugin
*/
function setEnabled($enabled) {
! $journal =& Request::getJournal();
! if ($journal) {
! $this->updateSetting($journal->getJournalId(), 'enabled', $enabled ? true : false);
! return true;
! }
! return false;
}
/**
--- 84,101 ----
* Determine whether or not this plugin is enabled.
*/
function getEnabled() {
! $conference =& Request::getConference();
! $conferenceId = $conference?$conference->getConferenceId():0;
! return $this->getSetting($conferenceId, 0, 'enabled');
}
/**
* Set the enabled/disabled state of this plugin
*/
function setEnabled($enabled) {
! $conference =& Request::getConference();
! $conferenceId = $conference?$conference->getConferenceId():0;
! $this->updateSetting($conferenceId, 0, 'enabled', $enabled);
}
/**
***************
*** 135,150 ****
$pageCrumbs = array(
array(
! Request::url(null, 'user'),
'navigation.user'
),
array(
! Request::url(null, 'manager'),
'user.role.manager'
)
);
! $journal =& Request::getJournal();
switch ($verb) {
case 'enable':
--- 132,147 ----
$pageCrumbs = array(
array(
! Request::url(null, null, 'user'),
'navigation.user'
),
array(
! Request::url(null, null, 'manager'),
'user.role.manager'
)
);
! $conference =& Request::getConference();
switch ($verb) {
case 'enable':
***************
*** 155,168 ****
break;
case 'settings':
$pageCrumbs[] = array(
! Request::url(null, 'manager', 'plugins'),
Locale::translate('manager.plugins'),
true
);
$templateMgr->assign('pageHierarchy', $pageCrumbs);
$this->import('SettingsForm');
! $form = new SettingsForm($this, $journal->getJournalId());
$form->readInputData();
if (Request::getUserVar('addBlock')) {
--- 152,165 ----
break;
case 'settings':
$pageCrumbs[] = array(
! Request::url(null, null, 'manager', 'plugins'),
Locale::translate('manager.plugins'),
true
);
$templateMgr->assign('pageHierarchy', $pageCrumbs);
$this->import('SettingsForm');
! $form = new SettingsForm($this, $conference->getConferenceId());
$form->readInputData();
if (Request::getUserVar('addBlock')) {
***************
*** 172,178 ****
$blocks = $form->getData('blocks');
array_push($blocks, '');
$form->_data['blocks'] = $blocks;
-
} else if (($delBlock = Request::getUserVar('delBlock')) && count($delBlock) == 1) {
// Delete an block
$editData = true;
--- 169,174 ----
***************
*** 186,192 ****
}
array_splice($blocks, $delBlock, 1);
$form->_data['blocks'] = $blocks;
-
} else if ( Request::getUserVar('save') ) {
$editData = true;
$form->execute();
--- 182,187 ----
diff -cr ojs2/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php ocs2/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php
*** ojs2/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php 2009-10-01 13:01:02.000000000 -0700
--- ocs2/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php 2009-10-16 19:12:26.000000000 -0700
***************
*** 97,106 ****
)
);
! $journal =& Request::getJournal();
$this->import('CustomBlockEditForm');
! $form = new CustomBlockEditForm($this, $journal->getJournalId());
switch ($verb) {
case 'enable':
--- 97,106 ----
)
);
! $conference =& Request::getConference();
$this->import('CustomBlockEditForm');
! $form = new CustomBlockEditForm($this, $conference->getConferenceId());
switch ($verb) {
case 'enable':
***************
*** 111,117 ****
break;
case 'edit':
$pageCrumbs[] = array(
! Request::url(null, 'manager', 'plugins'),
Locale::translate('manager.plugins'),
true
);
--- 111,117 ----
break;
case 'edit':
$pageCrumbs[] = array(
! Request::url(null, null, 'manager', 'plugins'),
Locale::translate('manager.plugins'),
true
);
***************
*** 131,137 ****
'pageTitleTranslated' => $this->getDisplayName(),
'pageHierarchy' => $pageCrumbs,
'message' => 'plugins.generic.customBlock.saved',
! 'backLink' => Request::url(null, 'manager', 'plugins'),
'backLinkLabel' => 'common.continue'
));
$templateMgr->display('common/message.tpl');
--- 131,137 ----
'pageTitleTranslated' => $this->getDisplayName(),
'pageHierarchy' => $pageCrumbs,
'message' => 'plugins.generic.customBlock.saved',
! 'backLink' => Request::url(null, null, 'manager', 'plugins'),
'backLinkLabel' => 'common.continue'
));
$templateMgr->display('common/message.tpl');
***************
*** 152,161 ****
* @return string
*/
function getContents(&$templateMgr) {
! $journal =& Request::getJournal();
! if (!$journal) return '';
! $templateMgr->assign('customBlockContent', $this->getSetting($journal->getJournalId(), 'blockContent'));
return parent::getContents($templateMgr);
}
--- 152,161 ----
* @return string
*/
function getContents(&$templateMgr) {
! $conference =& Request::getConference();
! if (!$conference) return '';
! $templateMgr->assign('customBlockContent', $this->getSetting($conference->getConferenceId(), 0, 'blockContent'));
return parent::getContents($templateMgr);
}
Sólo en ojs2/plugins/generic/customBlockManager/: CVS
diff -cr ojs2/plugins/generic/customBlockManager/locale/en_US/locale.xml ocs2/plugins/generic/customBlockManager/locale/en_US/locale.xml
*** ojs2/plugins/generic/customBlockManager/locale/en_US/locale.xml 2009-10-16 19:22:17.000000000 -0700
--- ocs2/plugins/generic/customBlockManager/locale/en_US/locale.xml 2009-10-16 19:21:14.000000000 -0700
***************
*** 15,21 ****
Custom Block Manager
This plugin lets you create addition sidebar blocks. Once they are created, you can edit their content and rearrange them within the sidebars.
! System Plugins page (in the Blocks Plugin section). To place your plugin in the desired location in the sidebar, go to Setup step 5.6]]>
Settings
This Plugin lets you manage custom sidebar blocks. You can edit the blocks in the settings of each plugin that you create here.
Block Name
--- 15,21 ----
Custom Block Manager
This plugin lets you create addition sidebar blocks. Once they are created, you can edit their content and rearrange them within the sidebars.
! System Plugins page (in the Blocks Plugin section). To place your plugin in the desired location in the sidebar, go to Set up step 4]]>
Settings
This Plugin lets you manage custom sidebar blocks. You can edit the blocks in the settings of each plugin that you create here.
Block Name
diff -cr ojs2/plugins/generic/customBlockManager/README ocs2/plugins/generic/customBlockManager/README
*** ojs2/plugins/generic/customBlockManager/README 2009-07-22 11:06:36.000000000 -0700
--- ocs2/plugins/generic/customBlockManager/README 2009-10-16 19:19:21.000000000 -0700
***************
*** 1,12 ****
================================
! === OJS Custom Block Manager Plugin
=== Version: 1.0
=== Author: Juan Pablo Alperin
================================
About
-----
! This plugin is intended to enable users to create customizable HTML blocks for the sidebars. The plugin works in conjunction with Step 5 of the Journal Setup.
License
-------
--- 1,14 ----
================================
! === OCS Custom Block Manager Plugin
=== Version: 1.0
=== Author: Juan Pablo Alperin
================================
About
-----
! This plugin is intended to enable users to create customizable HTML blocks for the sidebars. The plugin works in conjunction with Step 4 of the Conference Setup.
!
! This plugin was ported from the OJS 2.3 Custom Block Manager Plugin.
License
-------
***************
*** 14,33 ****
System Requirements
-------------------
! Same requirements as the OJS 2.2 core.
! Installation
------------
To install the plugin:
! - copy the plugin tar.gz file to your OJS/plugins/generic directory
- to unzip the plugin inside the plugins/generic directory:
$ tar xvzf customBlockManager-1.0.tar.gz
! - enable the plugin by going to: Home > User > Journal Management > Plugin Management > Generic Plugins and selecting "ENABLE" under "Custom Block Manager Plugin"
Configuration
------------
! The Plugin management interface can be found at Home -> User -> Journal Management > Plugin Management > Generic Plugins. Once the plugin is enabled, blocks can be added and deleted through this interface. Blocks which are created through this interface will subsequently appear as their own Block Plugin (found under Plugin Management > Block Plugins) and their content can be edited by clicking on the "EDIT" link underneath the name.
! NOTE: The plugin will NOT appear in the sidebar until a sidebar location has bee chosen through Journal Manager -> Setup -> 5. The Look (Specifically, under Journal Layout, step 5.6).
Contact/Support
--- 16,35 ----
System Requirements
-------------------
! ??? Same requirements as the OCS 2.3 core.
! ??? Installation
------------
To install the plugin:
! - copy the plugin tar.gz file to your OCS/plugins/generic directory
- to unzip the plugin inside the plugins/generic directory:
$ tar xvzf customBlockManager-1.0.tar.gz
! - enable the plugin by going to: Home > User > Conference Management > System Plugins > Generic Plugins and selecting "ENABLE" under "Custom Block Manager Plugin"
Configuration
------------
! The Plugin management interface can be found at Home -> User -> Conference Management > System Plugins > Generic Plugins. Once the plugin is enabled, blocks can be added and deleted through this interface. Blocks which are created through this interface will subsequently appear as their own Block Plugin (found under Plugin Management > Block Plugins) and their content can be edited by clicking on the "EDIT" link underneath the name.
! NOTE: The plugin will NOT appear in the sidebar until a sidebar location has been chosen through Conference Manager -> Conference Site Management -> 4. Conference Style.
Contact/Support
diff -cr ojs2/plugins/generic/customBlockManager/SettingsForm.inc.php ocs2/plugins/generic/customBlockManager/SettingsForm.inc.php
*** ojs2/plugins/generic/customBlockManager/SettingsForm.inc.php 2009-08-18 16:04:18.000000000 -0700
--- ocs2/plugins/generic/customBlockManager/SettingsForm.inc.php 2009-10-17 00:11:15.000000000 -0700
***************
*** 7,21 ****
*
* @class SettingsForm
*
! * @brief Form for journal managers to add or delete sidebar blocks
*
*/
import('form.Form');
class SettingsForm extends Form {
! /** @var $journalId int */
! var $journalId;
/** @var $plugin object */
var $plugin;
--- 7,21 ----
*
* @class SettingsForm
*
! * @brief Form for conference managers to add or delete sidebar blocks
*
*/
import('form.Form');
class SettingsForm extends Form {
! /** @var $conferenceId int */
! var $conferenceId;
/** @var $plugin object */
var $plugin;
***************
*** 25,37 ****
/**
* Constructor
! * @param $journalId int
*/
! function SettingsForm(&$plugin, $journalId) {
parent::Form($plugin->getTemplatePath() . 'settingsForm.tpl');
! $this->journalId = $journalId;
$this->plugin =& $plugin;
}
--- 25,37 ----
/**
* Constructor
! * @param $conferenceId int
*/
! function SettingsForm(&$plugin, $conferenceId) {
parent::Form($plugin->getTemplatePath() . 'settingsForm.tpl');
! $this->conferenceId = $conferenceId;
$this->plugin =& $plugin;
}
***************
*** 40,51 ****
* Initialize form data from the plugin settings to the form
*/
function initData() {
! $journalId = $this->journalId;
$plugin =& $this->plugin;
$templateMgr =& TemplateManager::getManager();
! $blocks = $plugin->getSetting($journalId, 'blocks');
if ( !is_array($blocks) ) {
$this->setData('blocks', array());
--- 40,51 ----
* Initialize form data from the plugin settings to the form
*/
function initData() {
! $conferenceId = $this->conferenceId;
$plugin =& $this->plugin;
$templateMgr =& TemplateManager::getManager();
! $blocks = $plugin->getSetting($conferenceId, 0, 'blocks');
if ( !is_array($blocks) ) {
$this->setData('blocks', array());
***************
*** 71,86 ****
*/
function execute() {
$plugin =& $this->plugin;
! $journalId = $this->journalId;
$pluginSettingsDAO =& DAORegistry::getDAO('PluginSettingsDAO');
$deletedBlocks = explode(':',$this->getData('deletedBlocks'));
foreach ($deletedBlocks as $deletedBlock) {
! $pluginSettingsDAO->deleteSetting($journalId, $deletedBlock.'CustomBlockPlugin', 'enabled');
! $pluginSettingsDAO->deleteSetting($journalId, $deletedBlock.'CustomBlockPlugin', 'seq');
! $pluginSettingsDAO->deleteSetting($journalId, $deletedBlock.'CustomBlockPlugin', 'context');
! $pluginSettingsDAO->deleteSetting($journalId, $deletedBlock.'CustomBlockPlugin', 'blockContent');
}
//sort the blocks in alphabetical order
--- 71,86 ----
*/
function execute() {
$plugin =& $this->plugin;
! $conferenceId = $this->conferenceId;
$pluginSettingsDAO =& DAORegistry::getDAO('PluginSettingsDAO');
$deletedBlocks = explode(':',$this->getData('deletedBlocks'));
foreach ($deletedBlocks as $deletedBlock) {
! $pluginSettingsDAO->deleteSetting($conferenceId, 0, $deletedBlock.'CustomBlockPlugin', 'enabled');
! $pluginSettingsDAO->deleteSetting($conferenceId, 0, $deletedBlock.'CustomBlockPlugin', 'seq');
! $pluginSettingsDAO->deleteSetting($conferenceId, 0, $deletedBlock.'CustomBlockPlugin', 'context');
! $pluginSettingsDAO->deleteSetting($conferenceId, 0, $deletedBlock.'CustomBlockPlugin', 'blockContent');
}
//sort the blocks in alphabetical order
***************
*** 95,101 ****
}
// Update blocks
! $plugin->updateSetting($journalId, 'blocks', $blocks);
$this->setData('blocks',$blocks);
}
}
--- 95,101 ----
}
// Update blocks
! $plugin->updateSetting($conferenceId, 0, 'blocks', $blocks);
$this->setData('blocks',$blocks);
}
}