Link to add and save event in google calendar - google-calendar-api

I'm trying to make a link that adds an event in my Google Calendar. Following an earlier entry (Link to add to google calendar) I've been able to it, but it takes me to a page where I have to press the "Save" button to end the process. Is it possible to add a parameter to add the event without having to press the "Save" button?
Thanks in advance!

You may refer with this thread. Try to add these parameters in your link:
action=TEMPLATE (required)
text (url encoded name of the event)
dates (ISO date format, startdate/enddate - must have both start and end time - the button generator will let you leave the endtime blank, but you must have one or it won't work.)
to use the user's timezone: 20131208T160000/20131208T180000
to use global time, convert to UTC, then use 20131208T160000Z/20131208T180000Z
all day events, you can use 20131208/20131209 - note that the button generator gets it wrong. You must use the following date as the end date for a one day all day event, or +1 day to whatever you want the end date to be.
details (url encoded event description/details)
location (url encoded location of the event - make sure it's an address google maps can read easily)

Related

Change Wordpress REST response

I have a plugin that puts custom post types onto a map. It uses Leaflet and specifies a REST API link as the source of its data. A map is displayed with a number of location markers and when clicked a details box pops up with the name of what's at that location and there's a hyperlink in this details box which when clicked takes the user to another page on the site. Here's what is specified as the data-endpoint source:
http://rd-dev.local/wp-json/citadela-directory/map-data/points/citadela-item?dataType=markers&category=&location=&only_featured=0
This call returns JSON that looks like this:
{"total":40,"points":[{"track":[],"coordinates":{"longitude":14.726660728455,"latitude":46.813816070557003},"title":"Name of place","permalink":"http:\/\/rd-dev.local\/item\/something\/","address":"Address, line 2, Someplace, Some Country","image":"http:\/\/rd-dev.local\/wp-content\/uploads\/2020\/12\/0b-1-150x150.jpeg","postType":"citadela-item","faIcon":"fas fa-circle","color":"#0085ba"}, ... etc
Part of each record in the response is a link to a url on the site, which the user clicks to see the detail:
http:\/\/rd-dev.local\/item\/something
I want to change the page that users see when they click a location so it occurred to me that one way, and which at my level of knowledge is probably the simplest, is to alter the JSON response that Wordpress gives. Specifically, i want to change all occurrences of "item" to a something different.
Is there a way to change the JSON stream as it is sent out by the REST API?
I solved this. I searched for register_rest_route occurrences in the source files and was able to find one for this particular route. The register_rest_route call includes a callback function where the response is constructed. It was then a case of putting that response through text replacement calls.

2sxc: Field Date and Time default value

I need to have in my fields a datetime content type.
Looking for documentation I found same here http://2sxc.org/en/Docs-Manuals/Feature/feature/2874
Date and Time
no relevant settings to explain. Note that the
output-template will usually choose to show only the date, only the
time etc.
So it's the same data-field no matter what you're actually
entering.
How can I set a default date value like a Datetime.Now for the editing input data field?
I tryed with varius commands but it gives me invalid date.
I alsa tryed the dnn token [DateTime: Now] but it doesn't work.
Thanks
To prefil the date-time there are two options
the link in the dnn-page which creates a new-item could pass this in as a prefill - http://2sxc.org/en/Docs-Manuals/Prefill-new-Forms
there is a hidden API which could do it using JavaScript, but it's not official yet, fairly technical and still prone to change. So I would use #1

Extract part of an URL behind a login page with Paw

I'm a newbie but I think Paw can do what i need :
I need to extract a session id behind a login page.
I go to https://admin.booking.com, filling the form (login and pass) and the landing page behind includes a session id :
https://admin.booking.com/pc/index.html?ses=xxxxyyyyyzzzzz11112222233333
I'd like to :
1) Push credentials with Paw as part of my request,
2) get the above item (ses) item as a response so i can use the php script extension provided by Paw and then call this script "on demand".
Is this possible ? If so, what should i do ?
Thanks for your help
UPDATE*: we've added a documentation article to describe the process a little more: Login via a web form in Paw. We've detailed the process to deal with CSRF tokens too.
Paw isn't quite yet ready for handling web/HTML forms. Though, there's one way to do it the right way: if you inspect the form with the Chrome dev tools you'll find the name of the input from the DOM/HTML:
In your case, you have the inputs: loginname, password, lang.
Also, find the <form…> tag to see what's the action attribute. If there's no action attribute (like in your example), it means the target URL for your form is the current page's URL (https://admin.booking.com/ in your case). Also, make sure the method="POST" is also there in the <form…> tag, otherwise this method won't work.
Then jump into Paw and set:
URL (in your case https://admin.booking.com/)
method to POST
go to the Body tab and use "Form URL-Encoded + fill up the fields from your form
If all works, you'll see Paw show a redirection request, and if you go to the right-hand side panel under "Response" > "Headers", you should see a Location header with a value similar to the URL you initially mentioned (https://admin.booking.com/pc/index.html?ses=xxxxyyyyyzzzzz11112222233333). Hurray! You got your value into Paw!
Now that you have that, you can create in a new request (click on the + button at the bottom of the left-hand side list). And wherever you want to use this session token/ID, you can insert a dynamic value to retrieve that URL value. You have more infos here, in our docs, but I'll describe the steps here:
On whichever field you want to insert the token, right-click and pick Responses > Response Header.
Make sure you pick the first request in the "Request" dropdown menu, and enter Location in the "Header" field:
You should see the value of the Location header of the previous response appear here.
Now what you want to do is to extract only the part you want (i.e. the value of the ses param in your case). For that you'll need that extension for Paw, so please install it now: https://luckymarmot.com/paw/extensions/RegExMatch
Copy the dynamic value you have just inserted (the blue token), and right-click on that field to insert a new dynamic value, and pick Extensions > RegExp match:
In the Input field, paste the previous dynamic value you copied. And use the RegExp field to write a regular expression that will successfully extract the part of the URL you want (this should work in your case ses=(.*)).
Now that you're set up. You should be able to use this little new blue token wherever you like and automagically extract the value from the previous form. And whenever you send again the initial request, and get a new token, everything else will also update! :)
It was a little long guide, but I hope this will help you and hopefully others too.

ASP.NET AJAX toolkit MaskEditExtender Date autocomplete mask

I'm using the asp.net ajax toolkit maskeditextender to mask a textbox for date input. Problem is, though, I can't get it to validate against the date they enter properly. If I turn off autocomplete mask and they type 7 slash 6 slash 88 it will fill in "07/06/88" which, funny enough, is not a valid date. If I autocomplete the mask it should autocomplete to "07/06/1988" but it autocompletes to "07/06/0088" even though I set the century to 1900...
Any advice?
My Solution:
So, autocomplete is terrible. You'd probably have to write some JS to put a 19 in front of the YY because it just appends 00. So you get "07/06/0088"...
As the answerer suggested I turned autocomplete off but it would still not validate the date right. I was using a compare validator against the date datatype. But as it turns out it needs a very specific format:
"07/06/1988"
and nothing else. So, I wrote a custom validator that padds zeros to the month and day and 19 to the year. Also, when I used the txt box's value I had to replicate the same fix to get it convert to datetime without throwing an exception.
I've seen this issue before and there are a few differnet fixes. Are you setting the MaskType to "Date" or "None"? If you're using Date, you may need to write some custom code to autocomplete with the correct digits. If you're using None, you should be able to force the four-digit year which will effectively eliminate the autocomplete issue. This is probably the route that I'd suggest you go becasue you can still restrict the input to digits and validate the input as a date, but you dont have to worry about it autocompleting the wrong century.

Converting Plain Text to Clickable link or Link to PlainText in asp.net

I need your advice with converting plain text to an URL.
The scenario will be this: The user will select some entry and then click a "convert to link" button.
The entry text the user selected will convert to (link: selected_text). I do it with JavaScript. And after that, when he clicks the Save button to save all his entry, I don't know how to store (link: selected_text) in tha database.
The URL will be like this: www.mysite.aspx?t=selected_text.
I can convert (link: selected_text) by using replace function in code-behind. But then I don't know how to show user as clickable and also by not showing <a href="www.mysite.aspx?t=selected_text">
It can be difficult to understand therefore I will show some of my codes to explain.
Private Sub Save(ByVal Entry As String) ' Entry Comes from entry textbox '
Dim elected As String
selected = Entry.Replace("(link: ", "<a href http://www.mysite.com?link=")
selected = Entry.Replace(")", ">")
' then here starts save but not necessary to show '
End Sub
If you must save processed input for some reason
(link: here)
must be converted to
(link: here)
To store in database, you'll have to track the changes separately somehow and post them back to the server. I'd suggest a HiddenInput control.
Do not save it as www.mysite.com?t=here. Just save the entry as the user types it. While showing it to user later, convert the "(link: here)" to link and show that.
Save the post as the user wrote it. This will make it easier to allow editing of the post later. When you render the message you should use a regular expression to replace it with a real link. You should never replace all ")" with ">". What happends if i write "hello (world)"?
The result:
Hello (world>
You can find great regular expressions here:
http://regexlib.com

Resources