Read the statement by Michael Teeuw here.
Show calendar based on IP Address accessed
-
@MMRIZE I understand, Ideally I would like to avoid opening multiple ports and use a common config to serve clients based on their IP. In fact, though DHCP is used by my home server, I have only assigned the IP address to reservations, hence static IP within my home network is not a problem.
Please suggest a simple code to use a specific calendar based on IP address of the client.
-
@Spinster
I’m out of my test PC, so I can’t show atm. (Maybe tomorrow possible, if you couldn’t success until that time)
You can add custom config attribute map-like objectcalendarMap
in your config.jsmodule: "calendar", position: "top_left", config: { calendarMap: { "192.168.178.100": ["calendar1", "calendar2"], "192.168.178.101": ["calebdar1", "calendar3"], }, calendars: [ { url: " … ", name: "calendar1", }, …
In
calendar.js
around line 176, whenCALENDAR_EVENTS
notification coming, you can filter the payload(array of events) of that notification by checkingcalendarName
of each event is matched tothis.config.calendarMap
.Sorry I can’t show the real code now. Maybe some hours later I may be able to. Anyway concept would be like this.
-
@MMRIZE Great, You have given me an idea, will wait for your code. Please share when possible.
-
@Spinster
Ah I suddenly remember that getting Internal IP with only JavaScript on client browseris hard.
Hmmm another approach might be needed. -
@MMRIZE that is why you need the express api call…
I would make a separate module that has ip in div, not shown, but w id
then call in calendar is document.get…
compare, your way or on cal entries
more synchronous… -
@sdetweil
Yes. I thought a small module with node_helper that could return clients’ ip as a result of REST api call from calendar module. -
@MMRIZE and that module calls its own rest call publishes the address in its getDom() result, with id= on div
and then cal module can use synchronous document.getElementsById()
to get that value.
-
so the little module is
https://github.com/sdetweil/getip
and it does correctly return the ip address of the client… tested from 4 different systems to the same MM…
see later post for final solution
-
-
I tried your code, but find that once I include getip module in config.js, I am not seeing any output for calendar. Is this the expected output. Without getip module, I find that client_ip = document.getElementById("getip is returning null.Please advice