Forums / Developer / New notification system - (for preventing spam)

New notification system - (for preventing spam)

Author Message

K259

Monday 21 June 2004 4:29:39 am

<b>The template notification/list.tpl lists all subscribers to the site with attributes:</b>

ID: (the id of the notification)
Rule Type: (i.e. ez-notification)
Class Name: (i.e. class of the object)
Path: (which node does the subscriber want to subscribe on, i.e. /content/view/full/2)
Keyword: (send a message if these keywords are published in i.e. any new article)
Additional constraint:
Edit: (button so the administrator can change the content of the notification)
Remove: (button so the administrator can remove an unwanted notification)

<b>When I try to delete one of these notifications, it's not beeing removed.
Is this a bug, or is this notification-system not complete?
The edit-function is also not working.</b>

<b>I wish to see the email-address in this list of the user which
is subscribing. Does anyone know how I can add Subscriber to this
list (tables and question are included down at the page)? </b>

<b>Another task we have to implement is then to make a function where
the administrator can confirm that the registered users are allowed to
subscribe, before an email is beeing sent.</b>

This is the code for notificationlist.tpl(view):

<form action={concat($module.functions.list.uri)|ezurl} method="post" 
name="RuleList">

{section show=$rule_list}
<table class="list" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
    <th>{"ID:"|i18n("design/standard/notification")}</th>
    <th>{"Rule Type:"|i18n("design/standard/notification")}</th>
    <th>{"Class Name:"|i18n("design/standard/notification")}</th>
    <th>{"Path:"|i18n("design/standard/notification")}</th>
    <th>{"Keyword:"|i18n("design/standard/notification")}</th>
    <th>{"Additional constraint:"|i18n("design/standard/notification")}</th>
    <th>{"Edit:"|i18n("design/standard/notification")}</th>
    <th>{"Remove:"|i18n("design/standard/notification")}</th>
</tr>

{section name=Rule loop=$rule_list sequence=array(bglight,bgdark)}
<tr>
    <td class="{$Rule:sequence}" width="1%">{$Rule:item.id}</td>
    <td class="{$Rule:sequence}">{$Rule:item.type}</td>
    <td class="{$Rule:sequence}">{$Rule:item.contentclass_name}</td>
    <td class="{$Rule:sequence}">{$Rule:item.path}</td>
    <td class="{$Rule:sequence}">{$Rule:item.keyword}</td>
    <td class="{$Rule:sequence}">{section show=$Rule:item.has_constraint}Yes{/section}</td>
    <td class="{$Rule:sequence}" width="1%"><a href={concat($module.functions.edit.uri,"/",$Rule:item.type,"/",$Rule:item.id)
|ezurl}><img name="edit" src={"e
dit.png"|ezimage} width="16" height="16" alt="{'Edit'|i18n('design/standard/notification')}" /></a></td>
    <td class="{$Rule:sequence}" width="1%"><input type="checkbox" 
name="Rule_id_checked[]" value="{$Rule:item.id}" /></td>
</tr>
{/section}
</table>
{/section}

<div class="buttonblock">
<select name="notification_rule_type">
{section name=Rules loop=$rule_type}
<option value="{$Rules:item.information.name}">{$Rules:item.information.
name}</option>
{/section}
</select>
{include uri="design:gui/button.tpl" name=new id_name=NewRuleButton 
value="New Rule"|i18n("design/standard/notification")}
{include uri="design:gui/button.tpl" name=delete id_name=DeleteRuleButton value="Remove"|i18n("design/standard/notification")}
{include uri="design:gui/button.tpl" name=send id_name=SendButton value="Send Message"|i18n("design/standard/notification")}
</div>
</form>

<b>These are the tables which are important:</b>

mysql> describe eznotification_user_link;
+---------------------+-------------+------+-----+---------+-------+
| Field               | Type        | Null | Key | Default | Extra |
+---------------------+-------------+------+-----+---------+-------+
| rule_id             | int(11)     |      | PRI | 0       |       |
| user_id             | int(11)     |      | PRI | 0       |       |
| send_method         | varchar(50) |      |     |         |       |
| send_weekday        | varchar(50) |      |     |         |       |
| send_time           | varchar(50) |      |     |         |       |
| destination_address | varchar(50) |      |     |         |       |
+---------------------+-------------+------+-----+---------+-------+
6 rows in set (0.00 sec)

mysql> describe ezuser;
+--------------------+--------------+------+-----+---------+-------+
| Field              | Type         | Null | Key | Default | Extra |
+--------------------+--------------+------+-----+---------+-------+
| contentobject_id   | int(11)      |      | PRI | 0       |       |
| login              | varchar(150) |      |     |         |       |
| email              | varchar(150) |      |     |         |       |
| password_hash_type | int(11)      |      |     | 1       |       |
| password_hash      | varchar(50)  | YES  |     | NULL    |       |
+--------------------+--------------+------+-----+---------+-------+
5 rows in set (0.00 sec)

mysql> describe eznotification_rule;
+-------------------+--------------+------+-----+---------+----------------+
| Field             | Type         | Null | Key | Default | Extra          |
+-------------------+--------------+------+-----+---------+----------------+
| id                | int(11)      |      | PRI | NULL    | auto_increment |
| type              | varchar(250) |      |     |         |                |
| contentclass_name | varchar(250) |      |     |         |                |
| path              | varchar(250) | YES  |     | NULL    |                |
| keyword           | varchar(250) | YES  |     | NULL    |                |
| has_constraint    | int(1)       |      |     | 0       |                |
+-------------------+--------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

<b>In the notificationlist.tpl I also want to list the subscribers
email-address.</b>

The user_id in the table eznotification_user_link has relation to ezuser.contentobject_id, and it's from here I have the possibillity
to get the email which I want to add to the notification/list.tpl,
so I can see which user who's subscribing which nodes.

<b>To get this data with sql:</b>

select email,rule_id,user_id from ezuser,eznotification_user_link 
where ezuser.contentobject_id=eznotification_user_link.user_id;

I'm just unsure howto get this data inside the tpl in the ez
templatesystem.

Zinistry