rejetto forum

Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: SilentPliz on August 13, 2010, 05:26:59 PM

Title: Sending messages to the server via {.notify.}
Post by: SilentPliz on August 13, 2010, 05:26:59 PM
Hi !  ;)

As rejetto added the ability to send notifications (tray baloons), I have incorporated this feature into the template of beta #266 #267.

If you want to try, the template is attached below of this message.

When you load the template, a Group named #notifications# will be created ... you need only include users of your choice into this group for enable them to send messages.

(http://img831.imageshack.us/img831/7691/47634059.th.png) (http://img831.imageshack.us/i/47634059.png/)
(http://img339.imageshack.us/img339/8204/25980097.th.png) (http://img339.imageshack.us/i/25980097.png/)
(http://img411.imageshack.us/img411/9029/52414637.th.png) (http://img411.imageshack.us/i/52414637.png/)
(http://img185.imageshack.us/img185/2743/92570809.th.png) (http://img185.imageshack.us/i/92570809.png/)

Updated template at August 31, 2010:

I took the opportunity to implement the possibility of sending an audio event at the same time as the written notification.

So when you load a template, are created two groups: #notifications# and #playsounds#  
You associate users allowed to send notifications to the server, into the group #notifications#, and into the group #playsounds# those which you also allowed the right to send sound events.

Note: #playsounds# is not independent, it's part of the notification form, dealing with sound event.
The group #playsounds# can be enabled or disabled only for authorized users in the group #notifications#, it can not be used alone.

Title: Re: Sending messages to the server via {.notify.}
Post by: rejetto on August 15, 2010, 09:10:30 AM
very nice idea SP!
i think you should publish it as a diff tpl, or people will
- go crazy trying to stay up to date
- not update at all, maybe even without knowing it
:)
Title: Re: Sending messages to the server via {.notify.}
Post by: SilentPliz on August 24, 2010, 01:49:25 AM
i think you should publish it as a diff tpl, or people will
- go crazy trying to stay up to date
- not update at all, maybe even without knowing it
:)

It's done! ;)

Notifications (Diff template release).

For use in folder(s) (or sub-folder(s)) of your choice.

1. Use a recent beta version of HFS (2.3 #266 at time of writing)

2. Create a folder that you name for example: Notifications (add it to the VFS)
  - Right-click on this folder > Properties... > Give Access permission to all users that you want.
  - Paste in the Diff template tab the "code" below, and save the Virtual File System:
 
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>{.!Notifications to the Server.}</title>
<link rel="stylesheet" href="/?mode=section&id=style.css" type="text/css">
<link rel="shortcut icon" href="/favicon.ico">
</head>

<body>
  <br />
<div style="margin-top:1em; margin-left:2em; max-width:400px;">
{.if|{.#notifications#.}|{:
  <br />
&nbsp;<font size=4>{.!Notifications to the Server.}</font>   
<form method='post' id='notifications'>
  :}.}
 <fieldset>
 {.if|{.#notifications#.}|{:
  <br />
{.repeat|20|&nbsp;.}<i><b>{.!Notification title.}{.!:.}</b></i>
  <br /> 
{.repeat|20|&nbsp;.}<input type='text' name='notifytitle'onMouseOver="this.focus();" style="background-color:#fff; border:2px solid #AB9F82; width:230px;">
  <br />
  <br />
{.repeat|20|&nbsp;.}<i><b>{.!Notification text.}{.!:.}</b></i>
  <br />
{.repeat|20|&nbsp;.}<textarea name="notifytext" wrap="soft" onMouseOver="this.focus();" style="width:230px; height:120px; background-color:#fff; border:2px solid #AB9F82;"></textarea>
  <br />
{.repeat|20|&nbsp;.}<b><SELECT name="type" style="background-color:#fff; border:2px solid #AB9F82; width:117px;">
<OPTION VALUE="none">{.!icon (none).}</OPTION>
<OPTION VALUE="error">{.!error.}</OPTION>
<OPTION VALUE="info">{.!info.}</OPTION>
<OPTION VALUE="warning">{.!warning.}</OPTION>
</b>
</SELECT>
<input type='text' name='timeout' value="{.! timeout.}" onclick="if(this.value=='{.! timeout.}')this.value=''" style="background-color:#fff; border:2px solid #AB9F82; width:109px;">
  <br />
 {.if|{.#playsounds#.}|{:
  <br />
{.repeat|20|&nbsp;.}<i><b>{.!Playing a sound event.}{.!:.}</b></i>
  <br />
{.repeat|20|&nbsp;.}<b><SELECT name="play" style="background-color:#fff; border:2px solid #AB9F82; width:234px;">
<OPTION VALUE="">{.!Sound event (none).}</OPTION>
<OPTION VALUE="CriticalBatteryAlarm">{.!Critical Battery Alarm.}</OPTION>
<OPTION VALUE="Close">{.!Close.}</OPTION>
<OPTION VALUE="DeviceConnect">{.!Device Connect.}</OPTION>
<OPTION VALUE="DeviceFail">{.!Device Fail.}</OPTION>
<OPTION VALUE="EmptyRecycleBin">{.!Empty Recycle Bin.}</OPTION>
<OPTION VALUE="InternetAlert">{.!Internet Alert.}</OPTION>
<OPTION VALUE="MailBeep">{.!Mail Beep.}</OPTION>
<OPTION VALUE="Open">{.!Open.}</OPTION>
<OPTION VALUE="SystemExclamation">{.!System Exclamation.}</OPTION>
<OPTION VALUE="SystemExit">{.!System Exit.}</OPTION>
<OPTION VALUE="SystemQuestion">{.!System Question.}</OPTION>
<OPTION VALUE="SystemStart">{.!System Start.}</OPTION>
</b>
</SELECT>
  <br />
:}.}
  <br />
{.repeat|20|&nbsp;.}<input type='submit' name='notify' value="{.!Notify.}">
  <br />
  <br /> 
</form>
</fieldset>
{.repeat|21|&nbsp;.}<a href=".."><img src="/~img14"> {.!Up.}</a>
</div>
</body>
:}.}
 {.if not|{.#notifications#.}|{:
<font size=4><center><img src="/~img11"> {.!You are not authorized to access at this feature.}. <br />{.!Please, contact the site administrator.}.</center></font>
</fieldset>
{.repeat|30|&nbsp;.}<a href=".."><img src="/~img14"> {.!Up.}</a>
</div>
</body>
:}.}
</html>

[+special:begin]

{.$special:forms.}

[special:forms]

{.if|{.#notifications#.}|{:
{.if|{.filename|{.postvar|notify.}.}|{:{.notify|{.force ansi|%user%{.!:.}
{.postvar|notifytext.}.}|title={.force ansi|{.postvar|notifytitle.}.}  [%time%]|type={.postvar|type.}|timeout={.postvar|timeout.}.}
{.add to log|.
{.force ansi|{.!*Begin Notification*.}.}  [%time%]

{.force ansi|%user%.}{.!:.}
::. {.force ansi|{.postvar|notifytitle.}.} .::
{.force ansi|{.postvar|notifytext.}.}

{.force ansi|{.!*End Notification*.}.}.}
{.if|{.#playsounds#.}|
{.play|{.postvar|play.}.}.}
:}.}:}.}

[+special:alias|private]
#notifications#={.member of|#notifications#.}
#playsounds#={.member of|#playsounds#.}

[* Pour les utilisateurs Français : Veuillez remplacer le symbole - par le symbole + dans la section [-special:strings] ci-dessous, pour utiliser cette fonctionnalité en français *]

[-special:strings]
 timeout= Dur&eacute;e
icon (none)=Aucune ic&ocirc;ne
Error=Erreur
warning=Alerte
info=Information
:= :
Critical Battery Alarm=Alarme critique
Close=Fermer
Device Connect=Connexion
Device Fail=Echec de la connexion
Empty Recycle Bin=Corbeille vid&eacute;e
Internet Alert=Alarme internet
Mail Beep=Mail entrant
Open=Ouvrir
System Exclamation=Exclamation
System Exit=Quitter
System Question=Question
System Start=D&ecute;marrage syst&egrave;me
Sound event (none)=Aucun &eacute;v&egrave;nement sonore
Notifications to the Server=Notifications vers le serveur
Playing a sound event=Jouer un &eacute;v&egrave;nement sonore
Sound event (none)=Aucun &eacute;v&egrave;nement sonore
Notification title=Titre de la notification
Notify=Envoyer la notification
Notification text=Texte de la notification
Up=Retour
You are not authorized to access at this feature=Vous n'&ecirc;tes pas autoris&eacute; &agrave; acc&eacute;der &agrave; cette fonctionnalit&eacute;
Please, contact the site administrator=Veuillez contacter l'administrateur du site
*Begin Notification*=*Début de la Notification*
*End Notification*=*Fin de la Notification*

 
3. Create two groups named:

#notifications#
#playsounds#


4. Bind the User Accounts of your choice with the #notifications# group, and optionally, with the group #playsounds#, depending on what you want to allow.
  - Validate and save options

Now, users can to send notifications to the server admin.

Note:
If you use this "diff template" with a main template different from the one provided by default with the "266" ... it will work, but you will have probably to correct the appearance of the diff template to match with your main template.


Pour les utilisateurs Français : Veuillez remplacer le symbole - par le symbole + dans la section [-special:strings] du "diff template", pour utiliser cette fonctionnalité en français.
Ou vous pouvez utiliser la version "françisée" de HFS, qui inclue cette fonctionnalité de manière plus directe.
Title: Re: Sending messages to the server via {.notify.}
Post by: CivicScootin on August 24, 2010, 06:30:39 AM
Confirmed working just fine on the new RAWR 0.1.3 Template..

Thank you Silent..
Just what I needed for my fellow mods on my site..

1 question however..
Is the notification logged in anyway?..
If so where would it be located in case Im away from my server at the time of the message..
Then when I return I can see what has been sent via {.notify.}~
Title: Re: Sending messages to the server via {.notify.}
Post by: r][m on August 24, 2010, 05:40:04 PM
@ SilentPliz
I'm running HFS on older computer used as network attached storage.
{.notify.} doesn't seem to work here.
Could it be operating system?
Title: Re: Sending messages to the server via {.notify.}
Post by: SilentPliz on August 24, 2010, 06:05:45 PM
@ SilentPliz
I'm running HFS on older computer used as network attached storage.
{.notify.} doesn't seem to work here.
Could it be operating system?


It's possible, or maybe the "balloons" notifications are disabled on your OS.

Which version of Windows you use on this "older computer"?
Title: Re: Sending messages to the server via {.notify.}
Post by: SilentPliz on August 24, 2010, 08:24:55 PM
1 question however..
If so where would it be located in case Im away from my server at the time of the message..
Then when I return I can see what has been sent via {.notify.}~

The easiest way (for me ;) ) is to use {.add to log.}

Replace this code:

Code: [Select]
{.if|{.#notifications#.}|{:
{.if|{.filename|{.postvar|notify.}.}|{:
{.notify|{.force ansi|%user%{.!:.}
{.postvar|notifytext.}.}|title={.force ansi|{.postvar|notifytitle.}.}  [%time%]|type={.postvar|type.}|timeout={.postvar|timeout.}.}
{.if|{.#playsounds#.}|
{.play|{.postvar|play.}.}.}
:}.}:}.}

By this code:

Code: [Select]
{.if|{.#notifications#.}|{:
{.if|{.filename|{.postvar|notify.}.}|{:{.notify|{.force ansi|%user%{.!:.}
{.postvar|notifytext.}.}|title={.force ansi|{.postvar|notifytitle.}.}  [%time%]|type={.postvar|type.}|timeout={.postvar|timeout.}.}
{.add to log|.
{.force ansi|{.!*Begin Notification*.}.}  [%time%]

{.force ansi|%user%.}{.!:.}
::. {.force ansi|{.postvar|notifytitle.}.} .::
{.force ansi|{.postvar|notifytext.}.}

{.force ansi|{.!*End Notification*.}.}.}
{.if|{.#playsounds#.}|
{.play|{.postvar|play.}.}.}
:}.}:}.}

You will just search in the log: Begin Notification

Edit:
I changed the code of yesterday, it's more easier ... you can copy it entirely.
Title: Re: Sending messages to the server via {.notify.}
Post by: CivicScootin on August 24, 2010, 08:30:35 PM
You guys truly are great!..
Thank you - the log works great
Title: Re: Sending messages to the server via {.notify.}
Post by: SilentPliz on August 24, 2010, 08:34:02 PM
You guys truly are great!..
Thank you - the log works great

Cool! 8)

Thanks!  ;)
Title: Re: Sending messages to the server via {.notify.}
Post by: BiGBOSS on August 28, 2010, 03:06:55 AM
ok..im new to this..
how do we import this in our template again? =_=
Title: Re: Sending messages to the server via {.notify.}
Post by: rejetto on August 28, 2010, 12:23:51 PM
i think instructions given in the 3rd post are quite clear
http://www.rejetto.com/forum/index.php/topic,9000.msg1051769.html#msg1051769
if you think they aren't, you should specify what part.
Title: Re: Sending messages to the server via {.notify.}
Post by: Fysack on August 21, 2011, 03:21:05 AM
wow..! f... that html course i took back in the 90`s  ::)