Jump to content

Notification by the browser with Unigui


Sistema Fenix

Recommended Posts

Hi 

 

Follows a tip for using the notification by the browser.

 

Add push_notification.js in folder files

Add in the uniServerModule->CustomFiles

 

To dispare notification:

procedure FenixNotification(pTitle, pMessage:String);
var
 vJS: String;
begin
 vjs := format('jQuery(document).ready(function($){$.notify("%s",{title: "%s", icon: "http:\\dominio.com\yourimage.png"});});',[pMessage,pTitle]);
 UniSession.AddJS(vjs);
end;

procedure TFMenu.ButtonNotrClick(Sender: TObject);
begin
  FenixNotification('Fenix','Your session is expiring.';
end;

Best regards

push_notification.zip

  • Like 1
  • Upvote 3
Link to comment
Share on other sites

  • 8 months later...
  • 2 months later...

Fenix, this looks like a really useful bit of code. I'm new to the java side and am struggling to get this to work - I get "$.notify is not a function" errors. I suspect because I haven't setup things correctly.

 

Have you got a sample project with this or some other bit of JS so I can learn from it.

 

Thanks

Link to comment
Share on other sites

The .js file is included in the server CustomFiles: files/push_notification.js
 
I'm calling the following on a button click in the client main form:

procedure PushNotification(sTitle, sMessage: String);
var
  sJS: String;
begin
  sJS := Format('jQuery(document).ready(function($){$.notify("%s",{title: "%s", icon: ""});});', [sMessage, sTitle]);
  UniSession.AddJS(sJS);
end;

But I get the following error:

 

post-5352-0-10257100-1504973953_thumb.jpg

 

I can put the JS code into the script directly and it works fine but I can't get the interaction between calling the "notify" function and the library .js file to work. I assume it's not finding the library?

 

It seems to be one of those aspects not well documented, I'd really appreciate if someone could tell me what I may be missing... :unsure:

JSTest.zip

Link to comment
Share on other sites

  • 3 months later...

Same problem to me : "$.notify is not a function"

 

Fenix, this looks like a really useful bit of code. I'm new to the java side and am struggling to get this to work - I get "$.notify is not a function" errors. I suspect because I haven't setup things correctly.

 

Have you got a sample project with this or some other bit of JS so I can learn from it.

 

Thanks

Link to comment
Share on other sites

  • 5 years later...
On 10/19/2016 at 8:47 AM, Sistema Fenix said:

Hi 

 

Follows a tip for using the notification by the browser.

 

Add push_notification.js in folder files

Add in the uniServerModule->CustomFiles

 

To dispare notification:

procedure FenixNotification(pTitle, pMessage:String);
var
 vJS: String;
begin
 vjs := format('jQuery(document).ready(function($){$.notify("%s",{title: "%s", icon: "http:\\dominio.com\yourimage.png"});});',[pMessage,pTitle]);
 UniSession.AddJS(vjs);
end;

procedure TFMenu.ButtonNotrClick(Sender: TObject);
begin
  FenixNotification('Fenix','Your session is expiring.';
end;

Best regards

push_notification.zipUnavailable

Alguém ainda tem esse arquivo (push_notification.zippara disponibilizar? Gostaria de implementar no meu projeto.

Link to comment
Share on other sites

2 hours ago, Sherzod said:

Em seguida, ajuste primeiro o endereço de e-mail do seu fórum:

 

Estava com a cabeça cheia, respondi errado, uso uma versão trial, ainda estamos estudando a possibilidade de comprar a versão completa. desculpe-me por isso.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...