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.
374 375 376 |
# File 'lib/vortex_client.rb', line 374 def initialize(={}) .each{|k,v|send("#{k}=",v)} end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def body @body end |
#date ⇒ Object
Returns the value of attribute date.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def date @date end |
#endDate ⇒ Object
Returns the value of attribute endDate.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def endDate @endDate end |
#filename ⇒ Object
Returns the value of attribute filename.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def filename @filename end |
#introduction ⇒ Object
Returns the value of attribute introduction.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def introduction @introduction end |
#location ⇒ Object
Returns the value of attribute location.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def location @location end |
#mapUrl ⇒ Object
Returns the value of attribute mapUrl.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def mapUrl @mapUrl end |
#modifiedDate ⇒ Object
Returns the value of attribute modifiedDate.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def modifiedDate @modifiedDate end |
#owner ⇒ Object
Returns the value of attribute owner.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def owner @owner end |
#publishedDate ⇒ Object
Returns the value of attribute publishedDate.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def publishedDate @publishedDate end |
#startDate ⇒ Object
Returns the value of attribute startDate.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def startDate @startDate end |
#tags ⇒ Object
Returns the value of attribute tags.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def @tags end |
#title ⇒ Object
Returns the value of attribute title.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
369 370 371 |
# File 'lib/vortex_client.rb', line 369 def url @url end |
Instance Method Details
#content ⇒ Object
TODO: Samme kode som i article… Bruk arv!
465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/vortex_client.rb', line 465 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
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 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
# File 'lib/vortex_client.rb', line 397 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
378 379 380 |
# File 'lib/vortex_client.rb', line 378 def to_s "#<Vortex::HtmlEvent "+instance_variables.collect{|var|var+": "+instance_variable_get(var).to_s}.join(",")+">" end |