1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-29 02:40:25 +02:00

FAQs now triggers events on create/update/delete. AdminUI: Removed unnecessary data from default event trigger.

This commit is contained in:
Cameron
2015-06-06 13:17:58 -07:00
parent 143784974d
commit e75498fa5d
4 changed files with 20 additions and 6 deletions

View File

@@ -816,8 +816,9 @@ class users_admin_ui extends e_admin_ui
$rplc_from = array('[x]', '[y]', '[z]');
$rplc_to = array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email'));
$message = str_replace($rplc_from, $rplc_to, USRLAN_228);
$message = e107::getParser()->toHtml($message,true);
$mes->addWarning($message);
$mes->addWarning(USRLAN_229);
$mes->addWarning(e107::getParser()->toHtml(USRLAN_229,true));
}
}

View File

@@ -4026,9 +4026,10 @@ class e_admin_controller_ui extends e_admin_controller
{
$eventData = array('newData'=>$_posted,'oldData'=>$old_data,'id'=> $id);
$model->addMessageDebug('Admin-ui Trigger fired: <b>'.$triggerName.'</b>');
if(E107_DBG_ALLERRORS >0 )
{
$model->addMessageDebug('Admin-ui Trigger fired: <b>'.$triggerName.'</b> with data '.print_a($eventData,true));
$model->addMessageDebug($triggerName.' data: '.print_a($eventData,true));
}
if($halt = e107::getEvent()->trigger($triggerName, $eventData))
@@ -4057,10 +4058,15 @@ class e_admin_controller_ui extends e_admin_controller
// Trigger Admin-ui event. 'post'
if($triggerName = $this->getEventTriggerName($_posted['etrigger_submit'],'after')) // 'created' or 'updated';
{
$eventData = array('newData'=>$_posted,'oldData'=>$old_data,'id'=> $id);
unset($_posted['etrigger_submit'], $_posted['__after_submit_action'], $_posted['submit_value'], $_posted['e-token']);
$pid = $this->getPrimaryName();
$_posted[$pid] = $id; // add in the primary ID field.
$eventData = array('newData'=>$_posted,'oldData'=>$old_data,'id'=> $id); // use $_posted as it may include unsaved data.
$model->addMessageDebug('Admin-ui Trigger fired: <b>'.$triggerName.'</b>');
if(E107_DBG_ALLERRORS >0 )
{
$model->addMessageDebug('Admin-ui Trigger fired: <b>'.$triggerName.'</b> with data '.print_a($eventData,true));
$model->addMessageDebug($triggerName.' data: '.print_a($eventData,true));
}
e107::getEvent()->trigger($triggerName, $eventData);
}

View File

@@ -1287,8 +1287,8 @@ class e_userperms
// Content
"5" => array(ADMSLAN_23,E_16_CUST, E_32_CUST), // create/edit custom PAGES
"J" => array(ADMSLAN_41,E_16_CUST, E_32_CUST), // create/edit custom MENUS
"H" => array(ADMSLAN_39,E_16_NEWS, E_32_NEWS), // Post News
"H" => array(ADMSLAN_39,E_16_NEWS, E_32_NEWS), // Post News - All Areas except settings.
"H0" => array(ADMSLAN_39." (".LAN_CREATE.")",E_16_NEWS, E_32_NEWS), // Create News Items
"H1" => array(ADMSLAN_39." (".LAN_EDIT.")",E_16_NEWS, E_32_NEWS), // Edit News Items
"H2" => array(ADMSLAN_39." (".LAN_DELETE.")",E_16_NEWS, E_32_NEWS), // Delete News Items

View File

@@ -48,6 +48,11 @@ class faq_admin extends e_admin_dispatcher
// 'main/custom' => array('caption'=> 'Custom Page', 'perm' => '0')
);
protected $perm = array(
'main/prefs' => '0'
);
protected $adminMenuAliases = array(
'main/edit' => 'main/list'
);
@@ -70,6 +75,7 @@ class faq_cat_ui extends e_admin_ui
{
protected $pluginTitle = LAN_PLUGIN_FAQS_NAME;
protected $pluginName = 'plugin';
protected $table = "faqs_info";
protected $pid = "faq_info_id";
protected $perPage = 5; //no limit
@@ -171,9 +177,10 @@ class faq_cat_form_ui extends e_admin_form_ui
class faq_main_ui extends e_admin_ui
{
//TODO Move to Class above.
protected $pluginTitle = 'FAQs';
protected $pluginName = 'faqs';
protected $eventName = 'faqs';
protected $table = "faqs";
// without any Order or Limit.