Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
From time to time I have an urgent need to communicate to my Windchill users. For example if I need to bring the system down for some sort of emergency reason. I would like to find a way that I can send some sort of broadcast message to the users directly through Windchill. Any ideas would be greatly appreciated.
Thank you,
Barry
Solved! Go to Solution.
Hi Barry,
I have a more elegant and yet simple way to do this. Please try below and let us know if it works:
<%@ include file="/netmarkets/jsp/util/banner_custom.jspf"%>
<div class="bannerdiv">
Kindly, Create user & context with your own name and test your issue within it. Unnecessarily do not mess Site/Org setting.<br>
Use <a href="http://abc.xyz" target="_blank">Knowledge base</a> for your queries.
</div>
.bannerdiv {
color: red; position: absolute; top: 2px; z-index: 1000; left: 200px; font-size: 14px ; font-weight:bold;
background: white;
width: 45%;
}
Thanks,
Shirish
Search PTC's knowledge base for: banner.txt
For my test servers I do put the following in <WindChill>/codebase/netmarkets/jsp/util/banner.txt :
<div style="position: absolute; background-color: white; top: 3px;
z-index:1000; left: 170px;border:1px solid
#000;color:#f00;padding:2px;font-weight:bold;font-size: 16px;">
<!-- Banner begins here -->
Windchill 10.2 M020 test server
<!-- Banner ends here -->
</div>
We have a message that is displayed in our header, that is controlled in the begin_custom.jspf file. By default it will only show a new message on restart of your system, which will not meet your needs.
What we did to address this is put some javascript into the begin_custom.jspf to read a file from the server each time the page was called. We can now change the contents of the text file that is read in and a new message will appear.
We included these two imports in the begin_custom.jspf file
<%@page import="java.io.FileReader"%>
<%@page import="java.io.BufferedReader"%>
We also added some style which i'm omitting
then where we want the message to appear we had the following code
<div class="boxStyle" > | ||||
<!-- Banner begins here --> | ||||
<% | ||||
BufferedReader reader2 = new BufferedReader(new FileReader(application.getRealPath("/") + "netmarkets/jsp/util/FILENAME.txt")); | ||||
StringBuilder sb2 = new StringBuilder(); | ||||
String line2; |
while((line2 = reader2.readLine())!= null){ | |||||
sb2.append(line2+"\n"); | |||||
} | |||||
out.println(sb2.toString()); | |||||
%> | |||||
<!-- Banner ends here --> | |||||
</div> |
In the text file put whatever text/html you want to display. Change as necessary and watch the message update the next time the page is reloaded. You could probably get fancier and add some AJAX if you wanted the message to update on the page without the user refreshing the page, but that wasn't what we needed.
I think that don't good idea for WC perfomance to read a file online for every request.
May be need add some cache?
Hi Barry,
We also use the alter banner like Randy. In addition to modifying the banner.txt you'll need to add the following line to the codebase/netmarkets/jsp/util/begin_custom.jspf:
<%@ include file="/netmarkets/jsp/util/banner_custom.jspf"%>
Restart Windchill and you'll have the banner. It will update in real time, with no need for a restart. If you want to take it down, clear the contents of banner.txt and leave it blank. It will disappear. We leave ours blank until we have messages to send to our users.
For more information check out the customizers guide.
-Adam
Hi Barry,
There have been a lot of good ideas mentioned here, but the recommended way is to use the header to send mass messages.
Here is an article that covers it.
https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS77184
Good Luck,
Jarrett
Hi Barry,
I have a more elegant and yet simple way to do this. Please try below and let us know if it works:
<%@ include file="/netmarkets/jsp/util/banner_custom.jspf"%>
<div class="bannerdiv">
Kindly, Create user & context with your own name and test your issue within it. Unnecessarily do not mess Site/Org setting.<br>
Use <a href="http://abc.xyz" target="_blank">Knowledge base</a> for your queries.
</div>
.bannerdiv {
color: red; position: absolute; top: 2px; z-index: 1000; left: 200px; font-size: 14px ; font-weight:bold;
background: white;
width: 45%;
}
Thanks,
Shirish
Hi,
I have some problem that the link does not work when only having 2 rows in the banner. Anyone knows how to fix?
Link does not work:
<div class="bannerdiv">
Prod Server<br>
Methods is found: <a href="http://xxx.yyy" target="_blank">Here</a>
</div>
Link works fine:
<div class="bannerdiv">
Prod Server<br>
<br>
Methods is found: <a href="http://xxx.yyy" target="_blank">Here</a>
</div>
I have a question.
I'm looking at the default banner_custom.jspf file. All the lines except for the first one has a %> at the beginning. Is that to indicate it's commented out?
No, "%>" it does not mean that the line is commented out. Basically this is jsp directive. You can Google it for additional information.
Thank you.