Class: Vortex::HtmlEvent
- Defined in:
- lib/vortex_client.rb
Overview
HtmlEvent: Event document. Article with location, map url, start and end dates.
Examples:
event = Vortex::HtmlEvent.new(:title => "Sample Event 1",
:introduction => "Sample event introduction",
:body => "<p>Hello world</p>",
:startDate => Time.now, ## "22.01.2010 12:15",
:endDate => Time.now + 60*60, ## "22.01.2010 13:00",
:location => "Forskningsveien 3B",
:mapUrl => "http://maps.google.com/123",
:tags => ["vortex","testing"],
:publishedDate => "05.01.2010 12:00")
vortex.publish(event)
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#date ⇒ Object
Returns the value of attribute date.
-
#endDate ⇒ Object
Returns the value of attribute endDate.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#introduction ⇒ Object
Returns the value of attribute introduction.
-
#location ⇒ Object
Returns the value of attribute location.
-
#mapUrl ⇒ Object
Returns the value of attribute mapUrl.
-
#modifiedDate ⇒ Object
Returns the value of attribute modifiedDate.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#publishedDate ⇒ Object
Returns the value of attribute publishedDate.
-
#startDate ⇒ Object
Returns the value of attribute startDate.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#content ⇒ Object
TODO: Samme kode som i article…
-
#initialize(options = {}) ⇒ HtmlEvent
constructor
Create a new article of type html-article: plain html file with introduction stored as a webdav property.
- #properties ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ HtmlEvent
Create a new article of type html-article: plain html file with introduction stored as a webdav property.
333 334 335 |
# File 'lib/vortex_client.rb', line 333 def initialize(={}) .each{|k,v|send("#{k}=",v)} end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def body @body end |
#date ⇒ Object
Returns the value of attribute date.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def date @date end |
#endDate ⇒ Object
Returns the value of attribute endDate.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def endDate @endDate end |
#filename ⇒ Object
Returns the value of attribute filename.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def filename @filename end |
#introduction ⇒ Object
Returns the value of attribute introduction.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def introduction @introduction end |
#location ⇒ Object
Returns the value of attribute location.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def location @location end |
#mapUrl ⇒ Object
Returns the value of attribute mapUrl.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def mapUrl @mapUrl end |
#modifiedDate ⇒ Object
Returns the value of attribute modifiedDate.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def modifiedDate @modifiedDate end |
#owner ⇒ Object
Returns the value of attribute owner.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def owner @owner end |
#publishedDate ⇒ Object
Returns the value of attribute publishedDate.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def publishedDate @publishedDate end |
#startDate ⇒ Object
Returns the value of attribute startDate.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def startDate @startDate end |
#tags ⇒ Object
Returns the value of attribute tags.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def @tags end |
#title ⇒ Object
Returns the value of attribute title.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
328 329 330 |
# File 'lib/vortex_client.rb', line 328 def url @url end |
Instance Method Details
#content ⇒ Object
TODO: Samme kode som i article… Bruk arv!
424 425 426 427 428 429 430 431 432 433 434 |
# File 'lib/vortex_client.rb', line 424 def content content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' + '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>' + title + '</title>' + ' <link href="http://www.uio.no/profil/kupu/kupucontentstyles.css" type="text/css" rel="stylesheet"/>' + '</head><body>' if(body) content += body end content += '</body></html>' end |
#properties ⇒ Object
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/vortex_client.rb', line 356 def properties props = '<v:resourceType xmlns:v="vrtx">event</v:resourceType>' + '<v:xhtml10-type xmlns:v="vrtx">event</v:xhtml10-type>' + '<v:userSpecifiedCharacterEncoding xmlns:v="vrtx">utf-8</v:userSpecifiedCharacterEncoding>' if(@publishedDate and @publishedDate != "") if(@publishedDate.kind_of? Time) @publishedDate = @publishedDate.httpdate.to_s end props += '<v:published-date xmlns:v="vrtx">' + @publishedDate + '</v:published-date>' end if(@date and @date != "") if(@date.kind_of? Time) @date = @date.httpdate.to_s end if(@publishedDate == nil or @publishedDate != "") props += '<v:published-date xmlns:v="vrtx">' + date + '</v:published-date>' end props += '<d:getlastmodified>' + date + '</d:getlastmodified>' + '<v:contentLastModified xmlns:v="vrtx">' + date + '</v:contentLastModified>' + '<v:propertiesLastModified xmlns:v="vrtx">' + date + '</v:propertiesLastModified>' + '<v:creationTime xmlns:v="vrtx">' + date + '</v:creationTime>' end if(title) props += '<v:userTitle xmlns:v="vrtx">' + title + '</v:userTitle>' end if(owner) props += '<owner xmlns="vrtx">' + owner + '</owner>' end if(introduction and introduction != "") props += '<introduction xmlns="vrtx">' + introduction + '</introduction>' end if( and .kind_of?(Array) and .size > 0) props += '<v:tags xmlns:v="vrtx">' + '<vrtx:values xmlns:vrtx="http://vortikal.org/xml-value-list">' .each do |tag| props += "<vrtx:value>#{tag}</vrtx:value>" end props += '</vrtx:values></v:tags>' end if(@startDate and @startDate != "") if(@startDate.kind_of? Time) @startDate = @startDate.httpdate.to_s end props += '<v:start-date xmlns:v="vrtx">' + @startDate + '</v:start-date>' end if(@endDate and @endDate != "") if(@endDate.kind_of? Time) @endDate = @endDate.httpdate.to_s end props += '<v:end-date xmlns:v="vrtx">' + @endDate + '</v:end-date>' end if(@location and @location != "") props += '<v:location xmlns:v="vrtx">' + @location + '</v:location>' end if(@mapUrl and @mapUrl != "") props += '<v:mapurl xmlns:v="vrtx">' + @mapUrl + '</v:mapurl>' end return props end |
#to_s ⇒ Object
337 338 339 |
# File 'lib/vortex_client.rb', line 337 def to_s "#<Vortex::HtmlEvent "+instance_variables.collect{|var|var+": "+instance_variable_get(var).to_s}.join(",")+">" end |