You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Thursday, May 31st 2018, 11:59am

show expiry date

Hi,

I have set an expire date via krpanotools, is there anyway I can show this in the context-menu or call it as a variable?
Thanks!

2

Friday, June 1st 2018, 10:03pm

Hi,

there is currently no API to access the expire date, but I will consider one of the next releases.

Best regards,
Klaus

Fernando

Intermediate

Posts: 202

Location: Habana, Cuba

Occupation: Architect, Photographer, Programmer.

  • Send private message

3

Monday, July 2nd 2018, 3:43pm

Hi, Klaus this feature is very important. Now the only option is to link to Website. Another option as: "Message to show when expired" would be very good.
Best Regards,
Fernando.

jordi

Intermediate

Posts: 427

Location: Barcelona

Occupation: creating ideas & coding them

  • Send private message

4

Monday, July 2nd 2018, 9:28pm

Fernando, you can already do that. Just set a variable with the value of expiration and check if current time is lower or bigger...
everpano.com smart virtual tours

Fernando

Intermediate

Posts: 202

Location: Habana, Cuba

Occupation: Architect, Photographer, Programmer.

  • Send private message

5

Tuesday, July 3rd 2018, 4:44pm

Thanks Jordy, this is very important for me.
Just set a variable with the value of expiration and check if current time is lower or bigger...
Where is that info? How to get that variable? Any example please.

Greets,
Fernando

Scott Witte

Intermediate

Posts: 243

Location: Milwaukee, WI USA

Occupation: Professional Photographer

  • Send private message

6

Friday, July 6th 2018, 4:11am

Where is that info? How to get that variable? Any example please.

Just add it to the skin_settings variables:

Source code

1
2
3
4
5
<skin_settings
      expiry="######"
      gyro="true"
      ....
/>

If you want a message to appear add a textfield and display it there.

Fernando

Intermediate

Posts: 202

Location: Habana, Cuba

Occupation: Architect, Photographer, Programmer.

  • Send private message

7

Monday, July 9th 2018, 3:45pm

Thanks Scott and Jordy,
1) Is there any krpano current date variable or it is javascript variable?
2) The idea is before to load the complete project, check this var: if the date expired then show message, if not run normally?
Greets,
Fernando

Scott Witte

Intermediate

Posts: 243

Location: Milwaukee, WI USA

Occupation: Professional Photographer

  • Send private message

8

Monday, July 9th 2018, 5:18pm

Pretty sure you need to do a js call to get the system date.

jordi

Intermediate

Posts: 427

Location: Barcelona

Occupation: creating ideas & coding them

  • Send private message

9

Wednesday, July 11th 2018, 7:17am

You should use unix time, so if you don't want to make it dynamic go this web page and transform your expiration date into unix timesatamp

https://www.unixtimestamp.com/

then set in your krpano tag the expirationDate atribute

Source code

1
<krpano expirationDate="1594451340" onstart="checkExpiration();" >


then it comes the action that you will probably need to execute on start

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
<action name="checkExpiration" type="javascript"><![CDATA[

    var expirationDate = krpano.get("expirationDate");
    var currentTime = new Date().getTime()/1000; // UNIX TIME IN SECONDS
   

    if (currentTime > expirationDate) {
        doSomething(); // Javascript Action
        // or 
        krpano.call("myKrpanoAction()");
    }

]]></action> 
everpano.com smart virtual tours

Fernando

Intermediate

Posts: 202

Location: Habana, Cuba

Occupation: Architect, Photographer, Programmer.

  • Send private message

10

Wednesday, July 25th 2018, 6:31am

Thanks Jordi, your example is very usefull. It works fine *thumbsup*
Greets,
Fernando

11

Wednesday, July 25th 2018, 6:49pm

Fernando,
This code does not check expiration date but installation version of krpano but may be useful, too. Just set the expire_date before.

Source code

1
2
3
4
5
6
7
8
9
	<!-- krpano version check -->
	<action name="combobox_versioncheck" autorun="preinit">
		if(build LT '2017-09-13',
			error('combobox.xml - too old krpano version!');
			set(events[combobox_xml_plugin_events].name, null);
			set(action[addComboboxLayer].content, '');
			set(action[removeComboboxLayer].content, '');
		);
	</action>

It is located in the krapno examples ..\krpano\krpano-1.19-pr16-win\viewer\plugins\combobox.xml file.

Regards,
Pavel

Fernando

Intermediate

Posts: 202

Location: Habana, Cuba

Occupation: Architect, Photographer, Programmer.

  • Send private message

12

Thursday, July 26th 2018, 9:09pm

Thanks Pavel,
if(build LT '2017-09-13',

in this case, the problem is how to get the current date in krpano ... Do you know how?

Greets,
Fernando.

13

Saturday, July 28th 2018, 1:07pm

Hi Fernando,
Here is the action

Source code

1
2
3
4
5
6
7
8
9
	<!-- Expiration check  -->
	<action name="check_expire" scope="localonly" args="exp_date">
		jsget(today, 'new Date().toISOString().slice(0,10);');
		trace('Today is ', get(today));			
		if(today GT exp_date,
			//your actions here e.g.:
			error('Sorry, your creditcard has expired!');
		);
	</action>

and the call is:

Source code

1
check_expire('2017-12-31');


Regards,
Pavel

Fernando

Intermediate

Posts: 202

Location: Habana, Cuba

Occupation: Architect, Photographer, Programmer.

  • Send private message

14

Saturday, July 28th 2018, 2:52pm

Thanks Pavel, very good solution! *thumbsup*
Greets,
Fernando

Similar threads