Jump to content

Recommended Posts

Posted

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
  • 8 months later...
  • 2 months later...
Posted

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

Posted

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

  • 3 months later...
Posted

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

Posted

Hi Fenix, 

 

Works on my local machine for Chrome, IE and Edge with the program as stand-alone server. On IIS/ISAPI on the server as dll, only Edge is working.

 

Any idea?

 

Leon

  • 5 years later...
Posted
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.

Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...