mirror of
https://github.com/joomla/joomla-cms.git
synced 2024-09-06 02:14:40 +00:00
Merge commit 'ac792d8' into 4.0-dev
This commit is contained in:
commit
ca98a1f900
@ -80,10 +80,10 @@ class FieldsHelper
|
||||
* The values of the fields can be overridden by an associative array where the keys
|
||||
* have to be a name and its corresponding value.
|
||||
*
|
||||
* @param string $context The context of the content passed to the helper
|
||||
* @param stdClass $item item
|
||||
* @param boolean $prepareValue prepareValue
|
||||
* @param array $valuesToOverride The values to override
|
||||
* @param string $context The context of the content passed to the helper
|
||||
* @param \stdClass $item item
|
||||
* @param int|bool $prepareValue (if int is display event): 1 - AfterTitle, 2 - BeforeDisplay, 3 - AfterDisplay, 0 - OFF
|
||||
* @param array $valuesToOverride The values to override
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
@ -189,7 +189,8 @@ class FieldsHelper
|
||||
|
||||
$field->rawvalue = $field->value;
|
||||
|
||||
if ($prepareValue)
|
||||
// If boolean prepare, if int, it is the event type: 1 - After Title, 2 - Before Display, 3 - After Display, 0 - Do not prepare
|
||||
if ($prepareValue && (is_bool($prepareValue) || $prepareValue === (int) $field->params->get('display', '2')))
|
||||
{
|
||||
PluginHelper::importPlugin('fields');
|
||||
|
||||
|
@ -32,7 +32,7 @@ class MessageController extends BaseController
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
/** @var Messages $model */
|
||||
/** @var MessagesModel $model */
|
||||
$model = $this->getModel('Messages', '', array('ignore_request' => true));
|
||||
|
||||
$eid = (int) $model->getState('eid', '700');
|
||||
@ -116,4 +116,26 @@ class MessageController extends BaseController
|
||||
|
||||
$this->setRedirect('index.php?option=com_postinstall');
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides all post-installation messages of the specified extension.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since __DEPLOY_VERSION__
|
||||
*/
|
||||
public function hideAll()
|
||||
{
|
||||
/** @var MessagesModel $model */
|
||||
$model = $this->getModel('Messages', '', array('ignore_request' => true));
|
||||
$eid = (int) $model->getState('eid', '700', 'int');
|
||||
|
||||
if (empty($eid))
|
||||
{
|
||||
$eid = 700;
|
||||
}
|
||||
|
||||
$model->hideMessages($eid);
|
||||
$this->setRedirect('index.php?option=com_postinstall&eid=' . $eid);
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class MessagesModel extends BaseDatabaseModel
|
||||
|
||||
// Force filter only enabled messages
|
||||
$published = $this->getState('published', 1);
|
||||
$query->where($db->qn('enabled') . ' = ' . $db->q($published));
|
||||
$query->where($db->qn('enabled') . ' = ' . (int) $published);
|
||||
|
||||
$query->from($db->quoteName('#__postinstall_messages'));
|
||||
|
||||
@ -153,7 +153,7 @@ class MessagesModel extends BaseDatabaseModel
|
||||
$query = $db->getQuery(true)
|
||||
->select(array('name', 'element', 'client_id'))
|
||||
->from($db->qn('#__extensions'))
|
||||
->where($db->qn('extension_id') . ' = ' . $db->q((int) $eid));
|
||||
->where($db->qn('extension_id') . ' = ' . (int) $eid);
|
||||
|
||||
$db->setQuery($query, 0, 1);
|
||||
|
||||
@ -194,8 +194,30 @@ class MessagesModel extends BaseDatabaseModel
|
||||
|
||||
$query = $db->getQuery(true)
|
||||
->update($db->qn('#__postinstall_messages'))
|
||||
->set($db->qn('enabled') . ' = ' . $db->q(1))
|
||||
->where($db->qn('extension_id') . ' = ' . $db->q($eid));
|
||||
->set($db->qn('enabled') . ' = 1')
|
||||
->where($db->qn('extension_id') . ' = ' . (int) $eid);
|
||||
$db->setQuery($query);
|
||||
|
||||
return $db->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides all messages for an extension
|
||||
*
|
||||
* @param integer $eid The extension ID whose messages we'll hide
|
||||
*
|
||||
* @return mixed False if we fail, a db cursor otherwise
|
||||
*
|
||||
* @since __DEPLOY_VERSION__
|
||||
*/
|
||||
public function hideMessages($eid)
|
||||
{
|
||||
$db = $this->getDbo();
|
||||
|
||||
$query = $db->getQuery(true)
|
||||
->update($db->qn('#__postinstall_messages'))
|
||||
->set($db->qn('enabled') . ' = 0')
|
||||
->where($db->qn('extension_id') . ' = ' . (int) $eid);
|
||||
$db->setQuery($query);
|
||||
|
||||
return $db->execute();
|
||||
@ -515,7 +537,7 @@ class MessagesModel extends BaseDatabaseModel
|
||||
$query = $db->getQuery(true)
|
||||
->select('*')
|
||||
->from($db->qn($tableName))
|
||||
->where($db->qn('extension_id') . ' = ' . $db->q($options['extension_id']))
|
||||
->where($db->qn('extension_id') . ' = ' . (int) $options['extension_id'])
|
||||
->where($db->qn('type') . ' = ' . $db->q($options['type']))
|
||||
->where($db->qn('title_key') . ' = ' . $db->q($options['title_key']));
|
||||
|
||||
@ -544,7 +566,7 @@ class MessagesModel extends BaseDatabaseModel
|
||||
// Otherwise it's not the same row. Remove the old row before insert a new one.
|
||||
$query = $db->getQuery(true)
|
||||
->delete($db->qn($tableName))
|
||||
->where($db->q('extension_id') . ' = ' . $db->q($options['extension_id']))
|
||||
->where($db->q('extension_id') . ' = ' . (int) $options['extension_id'])
|
||||
->where($db->q('type') . ' = ' . $db->q($options['type']))
|
||||
->where($db->q('title_key') . ' = ' . $db->q($options['title_key']));
|
||||
|
||||
|
@ -72,5 +72,10 @@ class HtmlView extends BaseHtmlView
|
||||
ToolbarHelper::preferences('com_postinstall', 550, 875);
|
||||
ToolbarHelper::help('JHELP_COMPONENTS_POST_INSTALLATION_MESSAGES');
|
||||
}
|
||||
|
||||
if (!empty($this->items))
|
||||
{
|
||||
ToolbarHelper::custom('hideAll', 'unpublish.png', 'unpublish_f2.png', 'COM_POSTINSTALL_HIDE_ALL_MESSAGES', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,9 @@ $params = array('params' => json_encode($param));
|
||||
|
||||
?>
|
||||
|
||||
<form action="index.php" method="post" name="adminForm" class="form-inline mb-3">
|
||||
<form action="index.php" method="post" name="adminForm" class="form-inline mb-3" id="adminForm">
|
||||
<input type="hidden" name="option" value="com_postinstall">
|
||||
<input type="hidden" name="task" value="">
|
||||
<label for="eid" class="mr-sm-2"><?php echo Text::_('COM_POSTINSTALL_MESSAGES_FOR'); ?></label>
|
||||
<?php echo HTMLHelper::_('select.genericlist', $this->extension_options, 'eid', array('onchange' => 'this.form.submit()', 'class' => 'form-control custom-select'), 'value', 'text', $this->eid, 'eid'); ?>
|
||||
</form>
|
||||
|
@ -7,6 +7,7 @@ COM_POSTINSTALL="Post-installation Messages"
|
||||
COM_POSTINSTALL_BTN_HIDE="Hide this message"
|
||||
COM_POSTINSTALL_BTN_RESET="Reset Messages"
|
||||
COM_POSTINSTALL_CONFIGURATION="Post-installation Messages: Options"
|
||||
COM_POSTINSTALL_HIDE_ALL_MESSAGES="Hide all messages"
|
||||
COM_POSTINSTALL_LBL_MESSAGES="Post-installation and Upgrade Messages"
|
||||
COM_POSTINSTALL_LBL_NOMESSAGES_DESC="You have read all the messages."
|
||||
COM_POSTINSTALL_LBL_NOMESSAGES_TITLE="No Messages"
|
||||
|
@ -120,13 +120,9 @@ class TagModel extends ListModel
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,6 +16,6 @@ COM_MAILTO_EMAIL_TO_A_FRIEND="Email this link to a friend."
|
||||
COM_MAILTO_LINK_IS_MISSING="Link is missing"
|
||||
COM_MAILTO_SEND="Send"
|
||||
COM_MAILTO_SENDER="Sender"
|
||||
COM_MAILTO_SENT_BY="Item sent by"
|
||||
COM_MAILTO_SENT_BY="Item sent by %s"
|
||||
COM_MAILTO_SUBJECT="Subject"
|
||||
COM_MAILTO_YOUR_EMAIL="Your Email"
|
||||
|
@ -382,7 +382,7 @@ class PlgSystemFields extends CMSPlugin
|
||||
$params = new Registry($params);
|
||||
}
|
||||
|
||||
$fields = FieldsHelper::getFields($context, $item, true);
|
||||
$fields = FieldsHelper::getFields($context, $item, $displayType);
|
||||
|
||||
if ($fields)
|
||||
{
|
||||
@ -447,6 +447,12 @@ class PlgSystemFields extends CMSPlugin
|
||||
*/
|
||||
public function onContentPrepare($context, $item)
|
||||
{
|
||||
// Check property exists (avoid costly & useless recreation), if need to recreate them, just unset the property!
|
||||
if (isset($item->jcfields))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$parts = FieldsHelper::extract($context, $item);
|
||||
|
||||
if (!$parts)
|
||||
@ -465,6 +471,8 @@ class PlgSystemFields extends CMSPlugin
|
||||
$item = $this->prepareTagItem($item);
|
||||
}
|
||||
|
||||
// Get item's fields, also preparing their value property for manual display
|
||||
// (calling plugins events and loading layouts to get their HTML display)
|
||||
$fields = FieldsHelper::getFields($context, $item, true);
|
||||
|
||||
// Adding the fields to the object
|
||||
|
Loading…
Reference in New Issue
Block a user