tag:help-archives.hannonhill.com,2010-02-09:/discussions/how-do-i/20299-how-do-i-send-email-notification-to-the-users-when-content-will-updateCascade CMS: Discussion 2018-10-18T20:37:45Ztag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-02T13:47:31Z2015-11-02T13:47:31ZHow do I send email notification to the users when content will update<div><p>Hi Uthman,</p>
<p>To confirm, are the users within the CSV file always the same
regardless of the page, or does the list vary depending on the
page?</p>
<p>Off-hand I think you could accomplish this in one of two
ways:</p>
<ul>
<li>Attach a CREATE/EDIT type Workflow that sends an email when a
page is created or updated. The workflow would be slightly
different if the recipients vary based on the page, but I think
this still might be possible and we can discuss that further.</li>
<li>If you are willing to consider publishing the page an "update,"
you could use a custom publish trigger that calls an external
script which reads your CSV file and emails accordingly. Again, if
the recipients vary based on page you would need to tweak things a
bit to determine who to send the email to, but it should be
possible.</li>
</ul>
<p>Looking forward, we are discussing adding the ability for users
to watch pages, which might help you in this case. Basically,
anyone who wants to get an email about the page being updated would
need to watch the page. This would in-turn allow them to opt out of
being notified by un-watching. Also, with the addition of content
owners, we are looking into adding more automated functionality to
notify owners of assets.</p>
<p>Here is a <a href="http://ideas.hannonhill.com/forums/52559-cascade-cms-ideas/suggestions/7679730-provide-the-ability-for-a-specific-user-to-receive">
related suggestion</a> on our Idea Exchange, please feel free to
vote it up if you would like this feature to be considered for a
future release.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-03T04:26:11Z2015-11-03T04:26:11ZHow do I send email notification to the users when content will update<div><p>Hello,</p>
<p>The list stays same for each page for now. the second option
might be useful for me</p>
<p>" If you are willing to consider publishing the page an
"update," you could use a custom publish trigger that calls an
external script which reads your CSV file and emails accordingly.
Again, if the recipients vary based on page you would need to tweak
things a bit to determine who to send the email to, but it should
be possible. "</p>
<p>How can i implement the above. where should i place external
script , i am interesting to use javascript / jquery to send the
request to some external php script.</p>
<p>Thanks,</p></div>usmanehsan0613tag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-03T13:20:53Z2015-11-03T13:20:53ZHow do I send email notification to the users when content will update<div><p>Hi Uthman,</p>
<p>My initial thought for the second option would be a custom
<a href="http://www.hannonhill.com/kb/Publish-Triggers/">Publish
Trigger</a> that would be executed every time an asset is
published. In this publish trigger, you would check the asset type
and send out an email.</p>
<blockquote>
<p>where should i place external script , i am interesting to use
javascript / jquery to send the request to some external php
script.</p>
</blockquote>
<p>Thinking through this a bit more, we suggested something similar
to a client not long ago that might be of use.</p>
<p>To summarize:</p>
<ul>
<li>Your page contains a Velocity Format that generates a block of
JavaScript code wrapped with <code>#protect</code> and
<code>[system-view:internal]</code> pseudo tags</li>
<li>The JavaScript calls an external script passing some data about
the asset. I'm thinking ID, name, path, site, last modified
timestamp, last modified by</li>
<li>The external script uses the passed data and compares it to a
cache or lookup table to determine if a notification needs to be
sent</li>
<li>If a notification should be sent, the script sends an email and
updates the cache accordingly. I would say keep it simple where you
use the ID as the key and lasy modified timestamp as the
value.</li>
</ul>
<p>With this setup, the JavaScript would run each time the page is
viewed and is only output/ran when viewing the page within Cascade
(hence the <code>[system-view:external]</code> tag). The
cache/lookup would avoid sending notifications unnecessarily.</p>
<p>I like this setup because it's much easier to add a region to
the bottom of your Templates and drop a Velocity Format in for
pages you want to send notifications for as opposed to maintaining
the publish trigger. The downside is you are restricted to only
page assets.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-04T04:18:27Z2015-11-04T04:18:27ZHow do I send email notification to the users when content will update<div><p>Hi,</p>
<p>Can you please give me some example for such format. I am using
xslt format .</p>
<p>Thanks,</p></div>usmanehsan0613tag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-04T04:22:28Z2015-11-04T04:22:28ZHow do I send email notification to the users when content will update<div><p>e.g in wordpress you would do something like</p>
<p>add_action('save_post', 'send_email);</p>
<p>function send_email()<br>
{ // here i can do whatever stuff i need to do . with a simple
hook. // it will execute this function after post / page is saved.
}</p>
<p>Would be great if you please give some quick and simple solution
as we need to implement this quickly. Several days are passed and
still no solution. Please help.</p>
<p>Thankyou.<br>
Uthman</p></div>usmanehsan0613tag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-04T08:55:16Z2015-11-04T08:55:16ZHow do I send email notification to the users when content will update<div><p>[system-view:external] or [system-view:internal]</p>
<p>If we put some javascript that will execute everytime that will
create another issue. I only need some javascript code to run
whenever the page is published.</p>
<p>Thanks,</p></div>usmanehsan0613tag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-04T15:07:05Z2015-11-04T15:07:05ZHow do I send email notification to the users when content will update<div><p>Hi Uthman,</p>
<p>You would use <code>[system-view:internal]</code> so the code is
only executed and output when viewing the page within Cascade.</p>
<blockquote>
<p>If we put some javascript that will execute everytime that will
create another issue. I only need some javascript code to run
whenever the page is published.</p>
</blockquote>
<p>As long as you use a caching system to check if the asset was
updated after the cached timestamp, I don't foresee any major
issues with the AJAX request executing each time the page is
viewed. Are there other concerns you have?</p>
<p>The only other way to accomplish this would be a custom Publish
Trigger, which also has it's downsides. For instance, a publish
trigger will be invoked for every publishable asset type and, for
pages, every individual output (since it's a separate publish
job).</p>
<p>You could add a couple of checks to make sure the asset being
published is a page and you are running the code for a single
output, but you would still need a way to determine if the page was
updated or not since a publish is not the same as an update.
Similar to the JavaScript solution, you would need a means of
recording the last time an email was sent to compare the asset's
last modification time at the time of the publish.</p>
<p>With that said, IMO the JavaScript solution would be the
simplest to implement and maintain since it won't require compiling
a publish trigger <code>.jar</code>, dropping it into the
installation directory, and restarting Cascade. Additionally, the
<code>.jar</code> needs to be re-added after upgrades.</p>
<blockquote>
<p>Would be great if you please give some quick and simple solution
as we need to implement this quickly.</p>
</blockquote>
<p>Assuming you are already loading jQuery on your pages, you could
drop the following Velocity Format into a region that is at the
bottom of your Template to issue a POST to an external script (ie
<code>//domain.edu/script.php</code>) and passing some data about
the page:</p>
<pre>
<code>[system-view:internal]
<script><![CDATA[#protect
$.post('//domain.edu/script.php', {id: '${currentPage.identifier.id}', lastmodifiedon: '${currentPage.lastModified.time}', lastmodifiedby: '${currentPage.lastModifiedBy}' });
#protect]]></script>
[/system-view:internal]</code>
</pre>
<p>In your external script, you would use the asset's ID as a key
for the lookup table and compare it to the cached last modified
timestamp to see if the timestamp provided is newer. If it is
newer, send an email and update the cache with the new
timestamp.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-05T08:10:23Z2015-11-05T08:10:23ZHow do I send email notification to the users when content will update<div><p>Hello,</p>
<p>thanks for your detail reply.</p>
<p>For custom publisher it will be more complex to implement as
server is mantained by other department.</p>
<p>For second option of using javascript / jquery ,I will not send
email notification for each page rather i will fill a form within
cascade having following fields.</p>
<ul>
<li>Title</li>
<li>URL</li>
<li>Photo (if have any)
<ul>
<li>Last Updated time</li>
<li>Updated By (i.e username)</li>
</ul>
</li>
</ul>
<p>and after filling this form i will submit and than jquery /
javascript will post this information to some external script ie.
domain.com/script.php , this script will do its job to send email
notifications to all users.</p>
<p>I think above is easy to implement within cascades. Actually i
want to keep control within cascade.</p>
<p>** So what i need from you is to know how can I fetch the form
information within cascades and pass this information as json
object. **</p>
<p>Hope above is clear and have a very easy solution.</p>
<p>Thanks & Best Regards,<br>
Uthman</p></div>usmanehsan0613tag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-06T20:29:30Z2015-11-06T20:29:30ZHow do I send email notification to the users when content will update<div><p>Hi Uthman,</p>
<p>What you can do is give the form an ID attribute (e.g.
<code>id="myform"</code>) and then you can use jQuery's
<code>serialize()</code> method to serialize the form data to be
sent to your script.</p>
<p>If you are going this route, what you can do is output the form
within your Velocity Format so you can essentially pre-fill the
form. If you went this route, you could use hidden form fields with
a submit button or link to submits the form, so you don't affect
your page's markup too much.</p>
<p>You would have something like the following in your Format for
example:</p>
<pre>
<code>[system-view:internal]
<form id="myform">
<input type="hidden" name="id" value="${currentPage.identifier.id}"/>
<input type="hidden" name="lastModifiedOn" value="${currentPage.lastModified.time}"/>
<input type="hidden" name="lastModifiedBy" value="${currentPage.lastModifiedBy}"/>
...
</form>
<script><![CDATA[#protect
$(document).ready(function() {
var $form = $('#myform');
$form.on('submit', function() {
$.post('//domain.edu/script.php', $form.serialize());
$form.replaceWith('<p>Notification sent.</p>');
return false;
});
});
#protect]]></script>
[/system-view:internal]</code>
</pre>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-08T08:33:42Z2015-11-09T14:11:49ZHow do I send email notification to the users when content will update<div><p>Hi,</p>
<p>In my format i tried following</p>
<pre>
<code> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes="date-converter" version="1.0" xmlns:date-converter="http://www.hannonhill.com/dateConverter/1.0/" xmlns:xalan="http://xml.apache.org/xalan">
<!-- Xalan component for date conversion from CMS date format to RSS 2.0 pubDate format -->
<form id="myform">
<input type="hidden" name="id" value="${currentPage.identifier.id}"/>
<input type="hidden" name="lastModifiedOn" value="${currentPage.lastModified.time}"/>
<input type="hidden" name="lastModifiedBy" value="${currentPage.lastModifiedBy}"/>
</form>
</xsl:stylesheet></code>
</pre>
<p>it throws error : Invalid XSLT: form is not allowed in this
position in the stylesheet!</p></div>usmanehsan0613tag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-08T08:34:12Z2015-11-08T08:34:12ZHow do I send email notification to the users when content will update<div></div>usmanehsan0613tag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-08T08:34:48Z2015-11-08T08:34:48ZHow do I send email notification to the users when content will update<div><p>I tried to put the form in xslt but it throws error.</p></div>usmanehsan0613tag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-09T14:13:17Z2015-11-09T14:13:17ZHow do I send email notification to the users when content will update<div><p>Hi Uthman,</p>
<p>The code I provided is for a Velocity Format and not XSLT, this
would explain the issue you are seeing.</p>
<p>Simply copy the code I provided and the
<code><form></code> markup you were using into a Velocity
Format and apply it to your page region and that should do the
trick.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-10T05:15:54Z2015-11-11T20:10:09ZHow do I send email notification to the users when content will update<div><p>Hi Ryan,</p>
<p>Can we say that <code><form></code> is not supported by
XSLT in cascades as in other examples for XSLT it does supports
form tag.</p>
<p>I do prefer to use XSLT because in my whole site i am using XSLT
format.</p>
<p>Thanks,<br>
Uthman</p></div>usmanehsan0613tag:help-archives.hannonhill.com,2010-02-09:Comment/383514172015-11-11T20:18:45Z2015-11-11T20:18:45ZHow do I send email notification to the users when content will update<div><p>Hi Uthman,</p>
<p>You can certainly use XSLT to accomplish this, I was just
stating that you were combining Velocity code (i.e.
<code>$currentPage</code>) with XSLT, which will not work. Also,
your XSLT was not a valid Format.</p>
<p>If you choose to use XSLT, you will need to apply a <a href="http://help.hannonhill.com/kb/frequently-asked-questions/create-a-calling-page-index-block">
calling page Index Block</a> along with the Format that also
includes the asset's system metadata so you have access to the
information you need.</p>
<p>When you have a moment, give the following a try for starters
and let me know how it goes:</p>
<pre>
<code> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/system-index-block">
<xsl:variable name="currentPage" select="calling-page/system-page"/>
<form id="myform">
<input type="hidden" name="id" value="{$currentPage/@id}"/>
<input type="hidden" name="lastModifiedOn" value="{$currentPage/last-modified}"/>
<input type="hidden" name="lastModifiedBy" value="{$currentPage/last-modified-by}"/>
</form>
</xsl:template>
</xsl:stylesheet></code>
</pre>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffith