Welcome, Guest
Please Login or Register.    Lost Password?

New context menu button?
(1 viewing) (1) Guest
Go to bottomPage: 12345
TOPIC: New context menu button?
#10742
Re:New context menu button? 5 Years ago  
Yes, that should work. You might want to create a separate function from it (e.g. Private_AddIcalProperty) and leave the current one as it was.
Rainy
Moderator
Posts: 5956
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#10745
Re:New context menu button? 5 Years ago  
Yeah nice, finally This works as I wanted it to be:

Code:


--
-- Adds given category to a certain event and thus helps to
-- blend out an event if the category is set to hidden
--
-- Parameters: 
--    strGuid - The unique identifier of the task.
--    eventDate - The date when the clicked event occurs (important for ignoring recurrent events)
-- Return:
--    Nothing
--
function Global_AddCategoryToEvent(strGuid, eventDate)
  strEvent = Rainlendar_GetComponent(strGuid)

  if (strEvent) then
prule =  Private_GetIcalProperty(strEvent, "RRULE")
if(prule) then
  -- if the event is recurrent -> add date of day to ignore-list
  strEvent = Private_AddIcalProperty(strEvent, "EXDATE", eventDate)
else
  -- else -> add hidden category
  strEvent = Private_AddIcalProperty(strEvent, "CATEGORIES", "Ausblenden")
end

Rainlendar_UpdateComponent(strEvent)
bChanges = Rainlendar_FlushComponents()
if (bChanges == true) then
  -- Redraw the windows if there were changes that need to be shown
  Rainlendar_Redraw(1)
    end
  end
end

function Private_AddIcalProperty(strComponent, strProperty, strValue) 
  return string.gsub(strComponent, "END:", strProperty .. ":" .. strValue .. "\r\nEND:") 
end 

yoodilo
Expert Boarder
Posts: 103
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#10934
Re:New context menu button? 4 Years, 11 Months ago  
OK one more thing about it: When the event has an end-date, like:

19:30h - 20:30h

than the script first sets 20:30 to 19:30 (so that it only has a start-date) and when clicking again, it hides the event.

Why??
thanks!
yoodilo
Expert Boarder
Posts: 103
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#10936
Re:New context menu button? 4 Years, 11 Months ago  
It will probably break the "DTEND" property in the events. Try if this works:

Code:


function Private_AddIcalProperty(strComponent, strProperty, strValue)  
  return string.gsub(strComponent, "\r\nEND:", "\r\n" .. strProperty .. ":" .. strValue .. "\r\nEND:")
end 

Rainy
Moderator
Posts: 5956
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#10939
Re:New context menu button? 4 Years, 11 Months ago  
Yeah nice, that fixed it
yoodilo
Expert Boarder
Posts: 103
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 12345
get the latest posts directly to your desktop