mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Fix #1532 : Add checkbox on feed creation to disable email notifications
This commit is contained in:
@@ -58,7 +58,7 @@ class Feed implements ControllerProviderInterface
|
|||||||
$author_name = $request->request->get('author_name');
|
$author_name = $request->request->get('author_name');
|
||||||
$author_mail = $request->request->get('author_mail');
|
$author_mail = $request->request->get('author_mail');
|
||||||
|
|
||||||
$entry = \Feed_Entry_Adapter::create($app, $feed, $publisher, $title, $subtitle, $author_name, $author_mail);
|
$entry = \Feed_Entry_Adapter::create($app, $feed, $publisher, $title, $subtitle, $author_name, $author_mail, $request->request->get('notify'));
|
||||||
|
|
||||||
$publishing = RecordsRequest::fromRequest($app, $request, true, array(), array('bas_chupub'));
|
$publishing = RecordsRequest::fromRequest($app, $request, true, array(), array('bas_chupub'));
|
||||||
|
|
||||||
|
@@ -508,7 +508,7 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function create(Application $app, Feed_Adapter $feed
|
public static function create(Application $app, Feed_Adapter $feed
|
||||||
, Feed_Publisher_Adapter $publisher, $title, $subtitle, $author_name, $author_mail)
|
, Feed_Publisher_Adapter $publisher, $title, $subtitle, $author_name, $author_mail, $notify = true)
|
||||||
{
|
{
|
||||||
if ( ! $feed->is_publisher($publisher->get_user())) {
|
if ( ! $feed->is_publisher($publisher->get_user())) {
|
||||||
throw new Exception_Feed_PublisherNotFound("Publisher not found");
|
throw new Exception_Feed_PublisherNotFound("Publisher not found");
|
||||||
@@ -544,7 +544,7 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
|
|
||||||
$entry = new self($app, $feed, $entry_id);
|
$entry = new self($app, $feed, $entry_id);
|
||||||
|
|
||||||
$app['events-manager']->trigger('__FEED_ENTRY_CREATE__', array('entry_id' => $entry_id), $entry);
|
$app['events-manager']->trigger('__FEED_ENTRY_CREATE__', array('entry_id' => $entry_id, 'notify_email' => (Boolean) $notify), $entry);
|
||||||
|
|
||||||
return $entry;
|
return $entry;
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,8 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
|
|||||||
public function fire($event, $params, &$entry)
|
public function fire($event, $params, &$entry)
|
||||||
{
|
{
|
||||||
$params = array(
|
$params = array(
|
||||||
'entry_id' => $entry->get_id()
|
'entry_id' => $entry->get_id(),
|
||||||
|
'notify_email' => $params['notify_email'],
|
||||||
);
|
);
|
||||||
|
|
||||||
$dom_xml = new DOMDocument('1.0', 'UTF-8');
|
$dom_xml = new DOMDocument('1.0', 'UTF-8');
|
||||||
@@ -91,7 +92,7 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
|
|||||||
/* @var $user_to_notif \User_Adapter */
|
/* @var $user_to_notif \User_Adapter */
|
||||||
$mailed = false;
|
$mailed = false;
|
||||||
|
|
||||||
if ($this->shouldSendNotificationFor($user_to_notif->get_id())) {
|
if ($params['notify_email'] && $this->shouldSendNotificationFor($user_to_notif->get_id())) {
|
||||||
$readyToSend = false;
|
$readyToSend = false;
|
||||||
try {
|
try {
|
||||||
$token = $this->app['tokens']->getUrlToken(
|
$token = $this->app['tokens']->getUrlToken(
|
||||||
|
@@ -39,6 +39,8 @@
|
|||||||
{% set title = publishing.basket().getName() %}
|
{% set title = publishing.basket().getName() %}
|
||||||
{% set desc = publishing.basket().getDescription() %}
|
{% set desc = publishing.basket().getDescription() %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<input class="required_text checkbox" checked="checked" type="checkbox" name="notify" id="feed_add_notify" value="1" />
|
||||||
|
<label for="feed_add_notify">{% trans 'Notify users about this publication' %}</label><br/>
|
||||||
<label for="feed_add_title">{% trans 'publication : titre' %}</label>
|
<label for="feed_add_title">{% trans 'publication : titre' %}</label>
|
||||||
<input class="required_text" type="text" name="title" id="feed_add_title" value="{{title}}" />
|
<input class="required_text" type="text" name="title" id="feed_add_title" value="{{title}}" />
|
||||||
<label for="feed_add_subtitle">{% trans 'publication : sous titre' %}</label>
|
<label for="feed_add_subtitle">{% trans 'publication : sous titre' %}</label>
|
||||||
|
@@ -3203,6 +3203,14 @@ dans l'onglet thesaurus : arbres, menus contextuels
|
|||||||
margin: 3px 0 10px 0;
|
margin: 3px 0 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#modal_feed form label {
|
||||||
|
display:inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
#modal_feed form input.checkbox {
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
#modal_feed form textarea {
|
#modal_feed form textarea {
|
||||||
height: 60px;
|
height: 60px;
|
||||||
resize: none;
|
resize: none;
|
||||||
|
@@ -3283,6 +3283,14 @@ dans l'onglet thesaurus : arbres, menus contextuels
|
|||||||
margin: 3px 0 10px 0;
|
margin: 3px 0 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#modal_feed form label {
|
||||||
|
display:inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
#modal_feed form input.checkbox {
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
#modal_feed form textarea {
|
#modal_feed form textarea {
|
||||||
height: 60px;
|
height: 60px;
|
||||||
resize: none;
|
resize: none;
|
||||||
|
Reference in New Issue
Block a user