diff --git a/README b/README
index 6610751..01fc4d0 100644
--- a/README
+++ b/README
@@ -2,4 +2,3 @@ Pages expects to find FileBase datastores for each domain in a directory named "
$ mkdir db
$ cp -pr example_db/localhost db/
-
\ No newline at end of file
diff --git a/configurations/development.rb b/configurations/development.rb
index 696a572..3c0f778 100644
--- a/configurations/development.rb
+++ b/configurations/development.rb
@@ -2,16 +2,16 @@
module Pages
module Configurations
class Development < Default
-
+
reloadable [ Pages ]
-
+
#include Waves::Cache::RackCache
application.use Rack::Session::Cookie, :key => 'rack.session',
# :domain => 'foo.com',
:path => '/',
:expire_after => 2592000,
:secret => 'Change it'
-
+
application.run Waves::Dispatchers::Default.new
server Waves::Servers::Mongrel
diff --git a/configurations/production.rb b/configurations/production.rb
index 1313271..90b7594 100644
--- a/configurations/production.rb
+++ b/configurations/production.rb
@@ -2,24 +2,24 @@
module Pages
module Configurations
-
+
class Production < Default
-
+
reloadable []
log :level => :info, :output => ( :log / 'log.out' )
host '0.0.0.0'
port 2020
debug false
-
+
include Waves::Cache::RackCache
application.use Rack::Session::Cookie, :key => 'rack.session',
# :domain => 'foo.com',
:path => '/',
:expire_after => 2592000,
:secret => 'Change it'
-
+
application.run Waves::Dispatchers::Default.new
-
+
server Waves::Servers::Mongrel
end
end
diff --git a/controllers/blog.rb b/controllers/blog.rb
index 6b589ea..938ea8c 100644
--- a/controllers/blog.rb
+++ b/controllers/blog.rb
@@ -1,17 +1,17 @@
module Pages
module Controllers
-
+
class Blog < Default
-
+
def update( name )
# Hack for supporting single story added to the blog
query[model_name].entries = query[model_name].entries.to_a if query[model_name].entries
super
end
-
+
end
-
+
end
end
\ No newline at end of file
diff --git a/controllers/calendar.rb b/controllers/calendar.rb
index 0075fc5..c10dfe7 100644
--- a/controllers/calendar.rb
+++ b/controllers/calendar.rb
@@ -1,17 +1,17 @@
module Pages
module Controllers
-
+
class Calendar < Default
-
+
def update( name )
# Hack for supporting single event added to the calendar
query[model_name].events = query[model_name].events.to_a if query[model_name].events
super
end
-
+
end
-
+
end
end
\ No newline at end of file
diff --git a/controllers/default.rb b/controllers/default.rb
index efdfd5d..42d1dae 100644
--- a/controllers/default.rb
+++ b/controllers/default.rb
@@ -16,7 +16,7 @@ def update( name )
obj.save
end
def delete( name ) ; find( name ).delete ; end
-
+
def assign( assigns )
assigns[ :key ] ||= assigns['title'].downcase.gsub(/\s+/,'-').gsub(/[^\w\-]/,'')
assigns[ :published ] ||= Time.now
diff --git a/controllers/gallery.rb b/controllers/gallery.rb
index e909bc1..89c11c8 100644
--- a/controllers/gallery.rb
+++ b/controllers/gallery.rb
@@ -1,17 +1,17 @@
module Pages
module Controllers
-
+
class Gallery < Default
-
+
def update( name )
# Hack for supporting single image added to the gallery
query[model_name].images = query[model_name].images.to_a if query[model_name].images
super
end
-
+
end
-
+
end
end
\ No newline at end of file
diff --git a/controllers/media.rb b/controllers/media.rb
index bf5883c..a68c861 100644
--- a/controllers/media.rb
+++ b/controllers/media.rb
@@ -1,10 +1,10 @@
module Pages
module Controllers
class Media < Default
-
+
def get( media, name )
- data = [ :public / media / name,
- :db / domain / :file / name,
+ data = [ :public / media / name,
+ :db / domain / :file / name,
:db / domain / :theme / name ].each do |path|
return File.read( path ) if File.exist?( path )
end
diff --git a/controllers/payment.rb b/controllers/payment.rb
index 6e1fe13..c650253 100644
--- a/controllers/payment.rb
+++ b/controllers/payment.rb
@@ -1,19 +1,19 @@
module Pages
module Controllers
-
+
class Payment < Default
-
+
def store( transaction )
model.create( transaction )
end
-
+
def notification( transaction )
model.find( transaction['key'] ).assign( info ).save
end
-
+
end
-
+
end
-
+
end
\ No newline at end of file
diff --git a/controllers/site_old.rb b/controllers/site_old.rb
index e32af13..09944ba 100644
--- a/controllers/site_old.rb
+++ b/controllers/site_old.rb
@@ -1,11 +1,11 @@
# module Pages
# module Controllers
# class Site < Default
-#
-#
-#
+#
+#
+#
# end
-#
+#
# end
-#
+#
# end
diff --git a/controllers/story.rb b/controllers/story.rb
index f7b6ab4..669e470 100644
--- a/controllers/story.rb
+++ b/controllers/story.rb
@@ -1,13 +1,13 @@
module Pages
module Controllers
-
+
class Story < Default
-
-
-
+
+
+
end
-
+
end
end
diff --git a/controllers/user.rb b/controllers/user.rb
index 253da5c..3b8ba8b 100644
--- a/controllers/user.rb
+++ b/controllers/user.rb
@@ -1,18 +1,18 @@
module Pages
module Controllers
class User < Default
-
+
def assign( assigns )
assigns[ :key ] ||= assigns['email'].downcase.gsub(/\s+/,'-').gsub(/[^\w\-]/,'-')
assigns[ :date_joined ] ||= Time.now
assigns
end
-
+
def authenticate
email_key = attributes[ :email ].gsub(/\s+/,'-').gsub(/[^\w\-]/,'-')
user = find( email_key )
auth = false
- if(user && ( user['email'] == attributes[:email] ) &&
+ if(user && ( user['email'] == attributes[:email] ) &&
( user['password'] == attributes[:password] ))
auth = true
end
@@ -26,12 +26,12 @@ def authenticate
# redirect(paths.login)
end
end
-
+
def logout
session.clear
redirect('/')
end
-
+
end
end
end
diff --git a/doc/TODO b/doc/TODO
index 4cee8f5..c457d71 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -7,7 +7,7 @@
- field validation
- comment support for stories - in progress
- theme development / selection
- - user registration
+ - user registration
- change password
- wiki support
- mailing list support
@@ -26,17 +26,17 @@ TODO - 3/5/2009 - above list is still valid
- model
- relation has_one :x, is not validate/enforced/respected (I can associate a story to different blogs, which brings to incongruence in the story model )
-
+
- published method (and the alias date) is sort of an hack for supporting old Date type and new Time type.
- controller
- deleting a story/image/event doesn't remove that from his container, causing the admin page to crash trying to render an entry not available anymore.
-
+
- view
- rethink the design of admin page. maybe is ok, but look to some alternative way to display categories. It doesn't seem to scale very well if we add lot of possible entries.
-
+
- replace the horrible javascript hack in base.js (for posting the drag&drop box) with ajax call.
-
+
- the checkbox in stories and images editor where you can choose one blog/gallery doesn't have much sense.. and
it complicates a lot the controller.update.
diff --git a/example_db/localhost/blog/test-blog.yml b/example_db/localhost/blog/test-blog.yml
index 00f630e..e639771 100644
--- a/example_db/localhost/blog/test-blog.yml
+++ b/example_db/localhost/blog/test-blog.yml
@@ -1,10 +1,10 @@
----
+---
title: test blog
tags: ""
published: Sun Apr 19 12:53:04 -0700 2009
author: Example
summary: my first blog.
-entries:
+entries:
- test-story-1
- test-story-2
key: test-blog
diff --git a/example_db/localhost/image/banner.yml b/example_db/localhost/image/banner.yml
index 3246a62..8158631 100644
--- a/example_db/localhost/image/banner.yml
+++ b/example_db/localhost/image/banner.yml
@@ -1,4 +1,4 @@
----
+---
content_type: image/jpeg
title: banner
published: "2009-04-29"
@@ -8,4 +8,4 @@ filepath: files/banner
summary: ""
orig_name: banner.jpg
key: banner
-file:
+file:
diff --git a/example_db/localhost/site.yml b/example_db/localhost/site.yml
index 535fd12..ce5142c 100644
--- a/example_db/localhost/site.yml
+++ b/example_db/localhost/site.yml
@@ -1,14 +1,14 @@
----
+---
twitter_password: none
name: Pages.CMS
-roles:
+roles:
- Admin
- Member
twitter_account: none
title: hello world
domain: localhost
description: sample app.
-Admin:
+Admin:
- property
- story
- image
@@ -17,6 +17,6 @@ Admin:
Member:
- story
- image
-authors:
+authors:
- Example
key: site
diff --git a/example_db/localhost/story/banner.yml b/example_db/localhost/story/banner.yml
index 4af18b7..59c448e 100644
--- a/example_db/localhost/story/banner.yml
+++ b/example_db/localhost/story/banner.yml
@@ -1,4 +1,4 @@
----
+---
format: mab
blog: ""
title: ""
diff --git a/example_db/localhost/story/footer.yml b/example_db/localhost/story/footer.yml
index bd1d2d2..fdd6ae4 100644
--- a/example_db/localhost/story/footer.yml
+++ b/example_db/localhost/story/footer.yml
@@ -1,4 +1,4 @@
----
+---
format: textile
title: ""
blog: ""
diff --git a/example_db/localhost/story/head.yml b/example_db/localhost/story/head.yml
index 3deb188..7a49a55 100644
--- a/example_db/localhost/story/head.yml
+++ b/example_db/localhost/story/head.yml
@@ -1,4 +1,4 @@
----
+---
format: mab
blog: ""
title: ""
diff --git a/example_db/localhost/story/home.yml b/example_db/localhost/story/home.yml
index 6629a8e..9021bab 100644
--- a/example_db/localhost/story/home.yml
+++ b/example_db/localhost/story/home.yml
@@ -1,4 +1,4 @@
----
+---
format: mab
blog: ""
title: ""
@@ -8,6 +8,6 @@ author: Example
summary: ""
content: |-
p "Hello world."
-
+
p "This is my first app.. :)"
key: home
diff --git a/example_db/localhost/story/menu.yml b/example_db/localhost/story/menu.yml
index 52ff684..ac30d4e 100644
--- a/example_db/localhost/story/menu.yml
+++ b/example_db/localhost/story/menu.yml
@@ -1,4 +1,4 @@
----
+---
format: mab
blog: ""
title: ""
diff --git a/example_db/localhost/story/sidebar.yml b/example_db/localhost/story/sidebar.yml
index 1ec07c7..cb14545 100644
--- a/example_db/localhost/story/sidebar.yml
+++ b/example_db/localhost/story/sidebar.yml
@@ -1,4 +1,4 @@
----
+---
format: mab
title: ""
blog: ""
diff --git a/example_db/localhost/story/test-story-1.yml b/example_db/localhost/story/test-story-1.yml
index 617a129..09bfdfb 100644
--- a/example_db/localhost/story/test-story-1.yml
+++ b/example_db/localhost/story/test-story-1.yml
@@ -1,4 +1,4 @@
----
+---
format: wysiwyg
blog: ""
title: test story 1
diff --git a/example_db/localhost/story/test-story-2.yml b/example_db/localhost/story/test-story-2.yml
index 243fcfb..3a5fc88 100644
--- a/example_db/localhost/story/test-story-2.yml
+++ b/example_db/localhost/story/test-story-2.yml
@@ -1,4 +1,4 @@
----
+---
format: mab
blog: ""
title: test story 2
@@ -8,8 +8,8 @@ author: Example
summary: "i'm on the way"
content: |-
p "Well, using this think is easy after all.."
-
- p "Remember, this is what you need:"
+
+ p "Remember, this is what you need:"
ul.rooms do
li {"#Waves"}
li {"#Filebase"}
diff --git a/example_db/localhost/theme/comments.css b/example_db/localhost/theme/comments.css
index 4a1d167..c68bce3 100644
--- a/example_db/localhost/theme/comments.css
+++ b/example_db/localhost/theme/comments.css
@@ -5,8 +5,8 @@ div.comment p { font-size: 10pt; }
div.comment p.byline { font-family: verdana, arial, sans-serif; font-size: 8pt; }
/* formatting specific to the comment form */
-form.comment { height: 640px; width: 515px;
+form.comment { height: 640px; width: 515px;
background: url(http://studio.zeraweb.com/s/rectangle?w=516&h=648&r=12&c=060) no-repeat; }
-form.comment h1, form.comment h2, form.comment h3,
+form.comment h1, form.comment h2, form.comment h3,
form.comment p, form.comment label { color: white; }
form.comment *.value { color: #333; }
diff --git a/example_db/localhost/theme/site.css b/example_db/localhost/theme/site.css
index 6343281..0452389 100644
--- a/example_db/localhost/theme/site.css
+++ b/example_db/localhost/theme/site.css
@@ -1,8 +1,8 @@
-* { margin: 0; padding: 0;
+* { margin: 0; padding: 0;
font-family: helvetica, verdana, sans-serif; }
/* basic page outline */
-body {
+body {
background: #110f0d;
}
@@ -16,11 +16,11 @@ h2 { font-size: 17pt; }
h2, p, li { font-size: 12pt; }
p { text-align: justify; }
h3 { font-size: 12pt; }
-p.subtitle {
+p.subtitle {
display: none;
margin-top: 1px; margin-left: 2px;
- font-family: verdana, arial, sans-serif;
- font-size: 14px; font-style: italic;
+ font-family: verdana, arial, sans-serif;
+ font-size: 14px; font-style: italic;
border-bottom: 1px dotted #390; }
p.warning, p.error { border-top: 1px solid; border-bottom: 1px solid; }
p.warning { color: orange; }
@@ -34,13 +34,13 @@ a:hover { color: #110f0d; text-decoration: underline; }
/* page layout */
/*div.banner > div.menu { height: 30px; }*/
/*div.banner > div.title h1 {
- font-size: 15pt; text-align: right; letter-spacing: 0; padding-top: 20px; margin-right:30px;
+ font-size: 15pt; text-align: right; letter-spacing: 0; padding-top: 20px; margin-right:30px;
color: #110f0d; margin-bottom: 0;
}*/
div.banner.image { width:1050px; background-image: url( /images/banner );}
/*div.banner h1 { font-size: 40px; }*/
div.banner ul.menu { display: block; float: right; margin-right: 30px; }
-div.banner ul.menu li { display: block; float: right; margin-left: 20px; text-transform: uppercase; font-size: 14px; }
+div.banner ul.menu li { display: block; float: right; margin-left: 20px; text-transform: uppercase; font-size: 14px; }
div.banner img { width: 1050px; }
/*div.menu { height: 50px; background: url(/images/bar-bg) repeat-x; }*/
@@ -57,7 +57,7 @@ div.sidebar hr { margin: 20px 0; }
div.sidebar div.block { margin-bottom: 30px; }
div.main { border-top: 2px solid ##110f0d; padding: 50px 35px; min-height: 400px; margin-left: 320px; }
-
+
/* default image formatting */
/*img { border: none }*/
#home img { width:180px; height:250px; }
@@ -79,8 +79,8 @@ div.entries h2 { font-family: verdana, arial, sans-serif; margin-top: 20px; }
span.author, span.date { font-weight: bold; }
-p.more { font-family: verdana, arial, sans-serif; font-size: 12pt;
- padding-bottom: 20px;
+p.more { font-family: verdana, arial, sans-serif; font-size: 12pt;
+ padding-bottom: 20px;
border-bottom: 1px solid #390; }
div.footer { clear: both; text-align: center; }
diff --git a/example_db/localhost/theme/site.js b/example_db/localhost/theme/site.js
index 72f1aa1..8f579fe 100644
--- a/example_db/localhost/theme/site.js
+++ b/example_db/localhost/theme/site.js
@@ -1,7 +1,7 @@
-//$(document).ready( function() {
+//$(document).ready( function() {
// $.ajax({ type: 'get', url: '/social/twitter-this',
// beforeSend : function(xhr) { xhr.setRequestHeader('Accept','text/html-fragment') },
// success: function( html ) {
-// $('div.twitter_this').replaceWith( html );
+// $('div.twitter_this').replaceWith( html );
// }});
//});
diff --git a/helpers/default.rb b/helpers/default.rb
index 86f8f09..944e269 100644
--- a/helpers/default.rb
+++ b/helpers/default.rb
@@ -1,33 +1,33 @@
require 'simple-rss'
require 'open-uri'
module Pages
-
+
module Helpers
-
+
module Default
-
+
include Waves::Helpers::Extended
include Pages::ResponseMixin
-
+
def show( model, name, assigns = {} )
assigns[ model ] = find( model, name )
view( model, :content, assigns ) if assigns[ model ]
end
-
+
def story( name, assigns = {} )
show( :story, name, assigns )
end
-
+
def format( options )
- self << if ( options[:format] &&
- options[:format] != 'html' &&
+ self << if ( options[:format] &&
+ options[:format] != 'html' &&
respond_to?( options[:format] ) )
self.send options[:format], options[:content]
else
options[:content]
end
end
-
+
def feed( options )
begin
SimpleRSS.parse( open( options[:url] ) )
@@ -35,9 +35,9 @@ def feed( options )
options[:url]
end
end
-
+
def mab( content ) ; markaby( content ) ; end
-
+
def buttons( list )
div.buttons do
list.each do |button|
@@ -45,7 +45,7 @@ def buttons( list )
end
end
end
-
+
end
end
end
\ No newline at end of file
diff --git a/lib/gallery.rb b/lib/gallery.rb
index 7afd398..12e3eef 100644
--- a/lib/gallery.rb
+++ b/lib/gallery.rb
@@ -1,42 +1,42 @@
module Pages
module Utilities
-
+
# WARNING: this code has not been tested! It was extracted from an IRB session
# and generalized. It needs to be tested.
#
# TODO: Need to add zip file support. Then we can do an upload gallery feature
# using the file upload of the zip. See rubyzip on sourceforge.
#
-
+
module Gallery
-
+
# options should include domain, path, title, and key
def self.import( options )
I = Pages::Models::Images[ options[ :domain ] ]
G = Pages::Models::Gallery[ options[ :domain ] ]
# first copy the files into the file directory
- Dir["#{path}/*"].each do |path|
+ Dir["#{path}/*"].each do |path|
src = options[ :path ]
dst = :db / options[ :domain ] / :file / File.basename( options[ :path ] )
FileUtils.cp( src, dst )
end
# next, create all the images ...
- keys = Dir[ "#{ options[ :path ] }/*" ].map do |path|
+ keys = Dir[ "#{ options[ :path ] }/*" ].map do |path|
type = path.match( /\.(\w+)$/ )
key = File.basename( path, ".#{type}" )
I.create( 'key' => key, 'file' => "#{key}.#{type}", 'content-type' => "image/#{type}" )
end.map { |image| image.key }
# finally, create the gallery
- G.create( 'key' => options[ :key ],
- 'title' => options[ :title ],
- 'display' => 'Album', 'images' => keys )
+ G.create( 'key' => options[ :key ],
+ 'title' => options[ :title ],
+ 'display' => 'Album', 'images' => keys )
end
-
+
end
-
+
end
-
+
end
\ No newline at end of file
diff --git a/lib/image.rb b/lib/image.rb
index 059be2b..40c13b0 100644
--- a/lib/image.rb
+++ b/lib/image.rb
@@ -1,23 +1,23 @@
require 'RMagick'
class Image
-
+
API = Magick::Image
# width, height
Dimensions = { :xlarge => [ 1200, 900 ], :large => [ 800, 600 ], :medium => [ 600, 400 ],
:small => [ 300, 200 ], :xsmall => [ 200, 150 ], :thumb => [ 150, 100 ] }
-
+
attr_reader :data
def initialize( data = nil )
@data = data
end
-
+
def Image.read( path )
- Image.new( ::File.read( path ) )
+ Image.new( ::File.read( path ) )
end
-
+
def resize!( size = nil )
return self unless ( size && Array === size )
width, height = *size
@@ -25,7 +25,7 @@ def resize!( size = nil )
@data = image.resize_to_fit!(width,height).to_blob
self
end
-
+
def to_blob ; @data ; end
end
\ No newline at end of file
diff --git a/lib/response_mixin.rb b/lib/response_mixin.rb
index 1cf9c6e..bdad20d 100644
--- a/lib/response_mixin.rb
+++ b/lib/response_mixin.rb
@@ -6,5 +6,5 @@ def model( name ) ; app::Models[ name ][ domain ]; end
alias_method :models, :model
def find( m, n ); model( m ).find(n) ; end
def all( m ) ; model(m).all ; end
- end
+ end
end
\ No newline at end of file
diff --git a/lib/short_url.rb b/lib/short_url.rb
index be74d79..aec2474 100644
--- a/lib/short_url.rb
+++ b/lib/short_url.rb
@@ -1,45 +1,45 @@
require 'net/http'
require 'json'
require 'logger'
-
+
module ShortUrl
class Client
-
+
# wrapping my key here
def initialize
@auth = { :user => 'polymar', :password => 'R_9d491bcf62b85b75c42d415a561c5d74' }
end
-
+
# get a shorter url.
- # the json returned looks like this:
+ # the json returned looks like this:
# {"results"=>{"http://dev.zeraweb.com"=>{"userHash"=>"YrDMv", "hash"=>"AbLkr", "shortKeywordUrl"=>"", "shortUrl"=>"http://bit.ly/YrDMv"}}, "errorMessage"=>"", "errorCode"=>0, "statusCode"=>"OK"}
def short_url( dest_url )
return '' if dest_url.nil? or dest_url.empty?
http_reg = Regexp.new('^([a-zA-Z]+:\/\/)')
dest_url = 'http://' + dest_url if( !http_reg.match( dest_url ))
bit_reg = Regexp.new('^([a-zA-Z]+:\/\/bit.ly\/)')
- return dest_url if bit_reg.match( dest_url )
+ return dest_url if bit_reg.match( dest_url )
call( 'shorten', { :longUrl => dest_url, :version => '2.0.1', :format => 'json' } ) # this is not documented, but adding :history => 1 should add the short_url to your history on bit.ly.
end
-
+
private
-
+
def call( path, params = {} )
logger.info "Calling #{url( path, params ) } ..."
request = Net::HTTP::Get.new( url( path, params ) )
request.basic_auth( login, password )
- response = Net::HTTP.start( 'api.bit.ly' ) do |h|
+ response = Net::HTTP.start( 'api.bit.ly' ) do |h|
h.request( request )
end
response.value # triggers error if not 2xx
logger.info "Success!"
JSON.parse( response.body )['results'][params[:longUrl]]['shortUrl']
end
-
+
def url( path, params )
"http://api.bit.ly/#{path}#{query(params)}"
end
-
+
def query( params )
return '' if params.nil? or params.empty?
params.inject('?') { |q,p| q << "#{p[0]}=#{p[1]}&" }
@@ -48,17 +48,17 @@ def query( params )
def logger
@logger ||= Logger.new( $stderr )
end
-
+
def login
@auth[:user]
end
-
+
def password
@auth[:password]
end
-
+
end
-
+
end
#client = ShortUrl::Client.new
@@ -66,23 +66,23 @@ def password
# resp = client.short_url( 'http://www.google.com' )
# p resp
#rescue Object => e
-# puts "Log to logger message: #{e.message}"
+# puts "Log to logger message: #{e.message}"
#end
#begin
# resp = client.short_url( 'www.google.com' )
# p resp
#rescue Object => e
-# puts "Log to logger message: #{e.message}"
+# puts "Log to logger message: #{e.message}"
#end
#begin
# resp = client.short_url( 'google.com' )
# p resp
#rescue Object => e
-# puts "Log to logger message: #{e.message}"
+# puts "Log to logger message: #{e.message}"
#end
#begin
# resp = client.short_url( 'http://bit.ly/fICXX' )
# p resp
#rescue Object => e
-# puts "Log to logger message: #{e.message}"
+# puts "Log to logger message: #{e.message}"
#end
\ No newline at end of file
diff --git a/lib/twitter_client.rb b/lib/twitter_client.rb
index bd63dc8..8cf71c5 100644
--- a/lib/twitter_client.rb
+++ b/lib/twitter_client.rb
@@ -2,14 +2,14 @@
require 'json'
require 'lib/short_url'
require 'logger'
-
+
module Twitter
class Client
-
+
def initialize( auth )
@auth = auth
end
-
+
# public method for updating twitter status
def update_status( status ) # status = { :message => 'new post on ruby', :url => 'http://www.ruby-lang.com' }
message = status[:message]
@@ -26,14 +26,14 @@ def update_status( status ) # status = { :message => 'new post on ruby', :url =>
call( 'statuses/update', { :status => posted } , :post )
end
end
-
+
# public method for getting public timelines
def public_timeline
call( 'statuses/public_timeline.json' )
end
-
+
private
-
+
def call( path, params = {}, method = :get )
if method == :get
logger.info "Calling #{get_url( path, params ) } ..."
@@ -44,7 +44,7 @@ def call( path, params = {}, method = :get )
request.set_form_data( params )
end
request.basic_auth( login, password )
- response = Net::HTTP.start( 'twitter.com' ) do |h|
+ response = Net::HTTP.start( 'twitter.com' ) do |h|
h.request( request )
end
logger.info "tweet: " + response.code
@@ -52,7 +52,7 @@ def call( path, params = {}, method = :get )
logger.info "Success!"
JSON.parse( response.body )
end
-
+
def get_url( path, params )
"http://twitter.com/#{path}.json#{query(params)}"
end
@@ -60,7 +60,7 @@ def get_url( path, params )
def post_url( path )
"http://twitter.com/#{path}.json"
end
-
+
def query( params )
return '' if params.nil? or params.empty?
params.inject('?') { |q,p| q << "#{p[0]}=#{p[1]}&" }
@@ -69,17 +69,17 @@ def query( params )
def login
@auth[:user]
end
-
+
def password
@auth[:password]
- end
-
+ end
+
def logger
@logger ||= Logger.new( $stderr )
end
-
+
end
-
+
end
# client = Twitter::Client.new( :user => 'duckonice', :password => 'bolognasalvati' )
@@ -87,23 +87,23 @@ def logger
# resp = client.update_status( { :message => 'testing from' } )
# p resp
# rescue Object => e
-# puts "Log to logger message: #{e.message}"
+# puts "Log to logger message: #{e.message}"
# end
# begin
# resp = client.update_status( { :url => 'http://www.gazzetta.it' } )
# p resp
# rescue Object => e
-# puts "Log to logger message: #{e.message}"
+# puts "Log to logger message: #{e.message}"
# end
# begin
# resp = client.update_status( { :message => 'testing from' , :url => 'http://www.google.com' } )
# p resp
# rescue Object => e
-# puts "Log to logger message: #{e.message}"
+# puts "Log to logger message: #{e.message}"
# end
# begin
# resp = client.update_status( { :ciao => 'testing from' } )
# p resp
# rescue Object => e
-# puts "Log to logger message: #{e.message}"
+# puts "Log to logger message: #{e.message}"
# end
diff --git a/models/blog.rb b/models/blog.rb
index 797c8a1..8817c71 100644
--- a/models/blog.rb
+++ b/models/blog.rb
@@ -1,9 +1,9 @@
module Pages
-
- module Models
-
+
+ module Models
+
class Blog < Default
-
+
def self.[]( domain )
Class.new( self ) do
include( Filebase::Model[ :db / domain / superclass.basename.snake_case ] )
@@ -25,14 +25,14 @@ def self.[]( domain )
end
end
-
+
def self.associate( domain )
has_many :entries, :class => Pages::Models::Story[ domain ]
end
-
+
end
-
+
end
-
+
end
-
+
diff --git a/models/calendar.rb b/models/calendar.rb
index f15d8b3..9c49585 100644
--- a/models/calendar.rb
+++ b/models/calendar.rb
@@ -1,9 +1,9 @@
module Pages
-
- module Models
-
+
+ module Models
+
class Calendar < Default
-
+
def self.[]( domain )
Class.new( self ) do
include( Filebase::Model[ :db / domain / superclass.basename.snake_case ] )
@@ -25,13 +25,13 @@ def self.[]( domain )
end
end
-
+
def self.associate( domain )
has_many :events, :class => Pages::Models::Event[ domain ]
end
-
+
end
-
+
end
-
+
end
\ No newline at end of file
diff --git a/models/comment.rb b/models/comment.rb
index 2ef02cb..eadbfa4 100644
--- a/models/comment.rb
+++ b/models/comment.rb
@@ -1,19 +1,19 @@
module Pages
-
- module Models
-
+
+ module Models
+
class Comment < Default
-
+
def associate( domain )
has_one :story, :class => Pages::Models::Story[ domain ]
end
-
+
def attribution
name.nil? || name.empty? ? 'anonymous coward' : name
end
-
+
end
-
+
end
-
+
end
\ No newline at end of file
diff --git a/models/default.rb b/models/default.rb
index 34d4e72..420c314 100644
--- a/models/default.rb
+++ b/models/default.rb
@@ -23,14 +23,14 @@ def title ; get( :title ) or ''; end
# def readable_key
# return get( :key ).to_s.gsub(/\b\w/){$&.upcase}.gsub('-',' ')
# end
-
+
# used whenever we want to display a human readable
- # name for this object ...
+ # name for this object ...
def label
return name.titlecase if title.nil? or title.empty?
title
end
-
+
# we have to support old formats.
def published
diff --git a/models/event.rb b/models/event.rb
index 7024938..7a9188a 100644
--- a/models/event.rb
+++ b/models/event.rb
@@ -1,14 +1,14 @@
module Pages
-
- module Models
-
+
+ module Models
+
class Event < Default
-
+
def self.[]( domain )
Class.new( self ) do
include( Filebase::Model[ :db / domain / superclass.basename.snake_case ] )
associate( domain )
-
+
# callback from filebase before deleting
before_delete do |obj|
g = Pages::Models[ 'calendar' ][ domain ].find( obj.calendar )
@@ -17,31 +17,31 @@ def self.[]( domain )
end
obj
end
-
+
end
end
-
+
def associate( domain )
has_one :calendar, :class => Pages::Models::Calendar[ domain ]
end
-
- FORMATS = [
+
+ FORMATS = [
['Formatted Text','wysiwyg'],
- ['Plain Text','text'],
- ['HTML','html'],
+ ['Plain Text','text'],
+ ['HTML','html'],
['Textile','textile']
]
-
+
def self.formats
FORMATS
end
-
+
def date
published
end
-
+
end
-
+
end
-
+
end
diff --git a/models/gallery.rb b/models/gallery.rb
index 45b419c..43cd017 100644
--- a/models/gallery.rb
+++ b/models/gallery.rb
@@ -1,9 +1,9 @@
module Pages
-
- module Models
-
+
+ module Models
+
class Gallery < Default
-
+
def self.[]( domain )
Class.new( self ) do
include( Filebase::Model[ :db / domain / superclass.basename.snake_case ] )
@@ -25,18 +25,18 @@ def self.[]( domain )
end
end
-
+
def self.associate( domain )
has_many :images, :class => Pages::Models::Image[ domain ]
end
-
+
DISPLAYS = [ ['Album', 'Album' ], ['Slideshow','Slideshow'] ]
-
+
def self.displays; DISPLAYS; end
-
+
end
-
+
end
-
+
end
-
+
diff --git a/models/listing.rb b/models/listing.rb
index 38e26e7..072af75 100644
--- a/models/listing.rb
+++ b/models/listing.rb
@@ -1,25 +1,25 @@
module Pages
-
- module Models
-
+
+ module Models
+
class Listing < Default
-
+
def associate( domain )
# TODO associate listing with announcements
end
-
- PHONE_TYPE = [
+
+ PHONE_TYPE = [
'Phone',
'Fax',
'Messages'
]
-
+
def self.phone_types
PHONE_TYPE
end
-
+
end
-
+
end
-
+
end
diff --git a/models/site.rb b/models/site.rb
index 9f731da..5bed421 100644
--- a/models/site.rb
+++ b/models/site.rb
@@ -1,28 +1,28 @@
module Pages
-
+
module Models
-
+
class Site < Default
-
- ROLES = [
+
+ ROLES = [
'administrator',
'member',
'subscriber'
]
-
+
def self.roles
ROLES
end
-
- def self.[]( domain )
+
+ def self.[]( domain )
Class.new( self ) do
include( Filebase::Model[ :db / domain ] )
associate( domain )
end
end
-
+
end
-
+
end
-
+
end
diff --git a/models/story.rb b/models/story.rb
index c966ac7..11fbe2f 100644
--- a/models/story.rb
+++ b/models/story.rb
@@ -1,14 +1,14 @@
module Pages
-
- module Models
-
+
+ module Models
+
class Story < Default
-
+
def self.[]( domain )
Class.new( self ) do
include( Filebase::Model[ :db / domain / superclass.basename.snake_case ] )
associate( domain )
-
+
# callback from filebase before deleting
before_delete do |obj|
g = Pages::Models[ 'blog' ][ domain ].find( obj.blog )
@@ -17,15 +17,15 @@ def self.[]( domain )
end
obj
end
-
+
end
end
-
+
def associate( domain )
has_one :blog, :class => Pages::Models::Blog[ domain ]
has_many :comments, :class => Pages::Models::Comment[ domain ]
end
-
+
def comment_number
n = comments.size
case n
@@ -37,26 +37,26 @@ def comment_number
"#{n} Comments"
end
end
-
- FORMATS = [
+
+ FORMATS = [
['Formatted Text','wysiwyg'],
- ['Plain Text','text'],
- ['HTML','html'],
+ ['Plain Text','text'],
+ ['HTML','html'],
['Textile','textile']
]
-
+
LAYOUTS = [ 'home', 'head', 'menu', 'banner', 'sidebar', 'footer', 'feed']
-
+
def self.formats
FORMATS
end
-
+
def self.layouts
LAYOUTS
end
-
+
end
-
+
end
-
+
end
diff --git a/models/user.rb b/models/user.rb
index c721394..e626d33 100644
--- a/models/user.rb
+++ b/models/user.rb
@@ -1,22 +1,22 @@
module Pages
-
+
module Models
-
+
class User < Default
-
- def self.[]( domain )
+
+ def self.[]( domain )
Class.new( self ) do
include( Filebase::Model[ :db / domain / superclass.basename.snake_case ] )
associate( domain )
end
end
-
+
def self.associate( domain )
has_many :entries, :class => Pages::Models::Story[ domain ]
has_many :listings, :class => Pages::Models::Listing[ domain ]
#has_many :announcements, :class => Pages::Models::Announcement[ domain ]
end
-
+
def date_joined
rval = get( :date_joined )
return rval if rval.is_a? Time
@@ -25,21 +25,21 @@ def date_joined
end
def username ; get( :key ) or '' ; end
-
+
# TODO .. better identify the hierarchy of roles, not only driven by DW
- ROLES = [
- ['Admin', 'Admin' ],
+ ROLES = [
+ ['Admin', 'Admin' ],
['Member','Member'],
['Subscriber', 'Subscriber' ]
]
-
+
def self.roles
ROLES
end
-
+
end
-
+
end
-
+
end
-
+
diff --git a/public/css/.old/admin.css.old b/public/css/.old/admin.css.old
index 4c4a58b..2968d27 100644
--- a/public/css/.old/admin.css.old
+++ b/public/css/.old/admin.css.old
@@ -2,7 +2,7 @@
body { margin-left: 40px; width: 1000px; padding: 10px; font-family: verdana; font-size: 12px; background: white; }
h1 { margin-bottom: 10px; color: #666; float: left; font-size: 20px; width: 300px;}
h2, h3 { color: #999; margin-bottom: 10px; }
-a, a:visited, a:hover { color: #393; }
+a, a:visited, a:hover { color: #393; }
a, a:visited { text-decoration: none; }
a:hover { text-decoration: underline; }
div.header { margin: 5px; padding: 5px; }
@@ -10,16 +10,16 @@ p.warning { clear: both; color: #993; }
div.dialog { display: none; }
div.page#admin p { margin: 10px 0 10px 0; }
div.page#admin div.add { margin-top: 10px; margin-bottom: 10px;}
-div.page#admin div.add form { display: none;
+div.page#admin div.add form { display: none;
padding: 5px; border: 1px solid #ccc; }
-div.page#admin div.add form a.close { float: right; border: 1px solid #ccc;
+div.page#admin div.add form a.close { float: right; border: 1px solid #ccc;
padding: 0px 3px; margin-top: -2px; cursor: pointer; }
div.page#admin div.add div.property { margin-bottom: 4px;}
-div.page#admin div.add label { margin: 0 5px;
+div.page#admin div.add label { margin: 0 5px;
font-weight: bold; font-size: 11px; color: #666; }
-div.page#admin div.add input {
- margin: 0 5px; padding: 5px;
- width: 150px; border: 1px solid #999;
+div.page#admin div.add input {
+ margin: 0 5px; padding: 5px;
+ width: 150px; border: 1px solid #999;
font-size: 11px; }
div.page#admin div.add div.buttons input {
width: 90px; font-size: 10px; padding: 2px;
@@ -29,32 +29,32 @@ div.page#admin div.add p { margin: 5px; float: none;
font-size: 11px; }
div.page#admin div.list#images { width: 200px; }
div.page#admin div.list { overflow: hidden; }
-div.page#admin div.list li, #editor ul.container li { display: block; clear: both;
+div.page#admin div.list li, #editor ul.container li { display: block; clear: both;
margin-left: 0; }
-div.page#admin div.list#images li, div.gallery#editor ul.container li { display: block;
+div.page#admin div.list#images li, div.gallery#editor ul.container li { display: block;
clear: none; float: left; margin-left: 0; padding: 2px; height: 54px; }
div.list#images a:hover img, div.gallery#editor a:hover img { border: 1px solid #393; }
-div.list#images img, div.gallery#editor img { border: 1px solid white;
+div.list#images img, div.gallery#editor img { border: 1px solid white;
width: 50px; height: 50px; }
-div#editor div.main { float: left; clear: both; width: 650px; margin: 5px; padding: 5px;
+div#editor div.main { float: left; clear: both; width: 650px; margin: 5px; padding: 5px;
border: 1px dotted #ccc; }
#login div.main { width: 400px; }
div.main div.properties { padding: 10px;}
div.main div.property {}
div.main label { clear: both; display: block; margin-bottom: 10px; padding-top: 5px;
font-weight: bold; font-size: 12px; color: #666; }
-div.main div.property input,
+div.main div.property input,
div.main div.property textarea,
-div.main div.property select {
+div.main div.property select {
font-size: 12px;
- display: block; margin-bottom: 10px; padding: 5px;
+ display: block; margin-bottom: 10px; padding: 5px;
border: 1px solid #333; }
div.main div.property #wysiwyg_container { margin: 10px; }
#wysiwyg_container iframe { padding: 10px; }
div.image#editor div.property img { display: block; margin: 10px; padding: 10px; border: 1px solid #ccc; }
-p.help, p.error { clear: both; float: left;
+p.help, p.error { clear: both; float: left;
font-size: 10px; color: #999; }
div.page#admin p.help { float: none; }
form p { margin-bottom: 20px; }
@@ -66,31 +66,31 @@ div.main #content textarea { width: 600px; height: 450px;
div.main #email input { width: 200px; }
div.main #password input { width: 200px; }
div.main select { width: 200px;}
-
+
div.sidebar { float: left; width: 280px; border: 1px dotted #ccc; margin: 5px; padding: 5px; }
div.sidebar div.property { float: left; }
div.sidebar label { float: left; width: 90px; margin: 5px; padding-top: 5px;
font-weight: bold; font-size: 11px; text-align: right; color: #666; }
-div.sidebar div.property input,
+div.sidebar div.property input,
div.sidebar div.property textarea,
- div.sidebar div.property select {
- float: left; margin: 5px; padding: 5px;
- width: 150px; border: 1px solid #333;
+ div.sidebar div.property select {
+ float: left; margin: 5px; padding: 5px;
+ width: 150px; border: 1px solid #333;
font-size: 11px; }
div.sidebar p.help { clear: both; float: left; margin-left: 105px; margin-bottom: 10px;
font-size: 10px; color: #999; }
div.sidebar #summary textarea { height: 150px;
font-family: 'Lucida Sans Typewriter', 'Courier New', courier; }
div.header div.buttons { float: left; width: 400px;
- margin-bottom: 10px; padding-bottom: 10px;
+ margin-bottom: 10px; padding-bottom: 10px;
text-align: left; }
div.header div.confirmation { display: inline; margin-left: 20px; }
div.page#login div.buttons { clear: both; margin: 5px; padding-top: 20px;}
div.buttons input { padding: 5px; }
-div.buttons input, div.buttons a {
+div.buttons input, div.buttons a {
margin-right: 10px;
- font-size: 11px; font-weight: bold;
+ font-size: 11px; font-weight: bold;
cursor: pointer; font-weight: bold; }
form.site div.buttons input { float: left; margin-top: 20px; }
form.site div.buttons a { float: left; margin-top: 20px; }
diff --git a/public/css/.old/editor.css.old b/public/css/.old/editor.css.old
index a2d2035..a84f72d 100644
--- a/public/css/.old/editor.css.old
+++ b/public/css/.old/editor.css.old
@@ -1 +1 @@
-* { font-family: verdana,arial,sans-serif; font-size: 14px; color: #666; }
\ No newline at end of file
+* { font-family: verdana,arial,sans-serif; font-size: 14px; color: #666; }
\ No newline at end of file
diff --git a/public/css/admin.css b/public/css/admin.css
index 0d2dfae..01bccea 100644
--- a/public/css/admin.css
+++ b/public/css/admin.css
@@ -2,9 +2,9 @@
@import url(/media/css/quick_add.css);
div.page { width: 1200px; }
-div.panel { float: left; width: 250px; height: 622px;
- border: solid 1px #ccc; padding: 5px;
- margin-right: 10px; margin-bottom: 10px;
+div.panel { float: left; width: 250px; height: 622px;
+ border: solid 1px #ccc; padding: 5px;
+ margin-right: 10px; margin-bottom: 10px;
overflow-y: scroll; }
div.panel ul { margin: 20px 0 0 0; padding: 0; }
div.panel ul * { margin: 0; padding: 0; }
diff --git a/public/css/container.css b/public/css/container.css
index 3803114..81e134d 100644
--- a/public/css/container.css
+++ b/public/css/container.css
@@ -3,5 +3,5 @@ ul.container:first { clear: both; } /* actually implemented in javascript */
ul.container { float: left; width: 290px; border: 1px solid #ccc; padding: 5px;
margin: 2px; min-height: 100px; }
#gallery-editor ul.container li { display: inline; }
-#gallery-editor ul.container img { border: 1px solid white;
+#gallery-editor ul.container img { border: 1px solid white;
width: 50px; height: 50px; }
diff --git a/public/css/editor.css b/public/css/editor.css
index d10a1c3..d804fba 100644
--- a/public/css/editor.css
+++ b/public/css/editor.css
@@ -22,9 +22,9 @@ div.property select {
div.sidebar div.property input,
div.sidebar div.property textarea,
div.sidebar div.property select { float: left; width: 150px; font-size: 11px; }
-div.sidebar label { float: left; width: 75px; text-align: right;
+div.sidebar label { float: left; width: 75px; text-align: right;
margin-right: 10px; padding-top: 5px; }
-div.sidebar p.help { clear: both; margin-left: 85px;
+div.sidebar p.help { clear: both; margin-left: 85px;
font-size: 11px; }
div.main div.property input.text { width: 500px; }
diff --git a/public/css/quick_add.css b/public/css/quick_add.css
index a8bc39a..302f87b 100644
--- a/public/css/quick_add.css
+++ b/public/css/quick_add.css
@@ -3,7 +3,7 @@ div.quick_add a.open, div.quick_add a.submit { font-weight: bold; font-size: 12p
div.quick_add a.close { display: block; float: right; cursor: pointer; }
div.quick_add label,
div.quick_add input.text { float: left; }
-div.quick_add label { font-weight: bold; font-size: 11px;
+div.quick_add label { font-weight: bold; font-size: 11px;
margin-top: 5px; margin-right: 5px; }
div.quick_add p { clear: both; margin-top: 10px; font-size: 11px; color: #666; }
div.quick_add p.error { color: #933; }
\ No newline at end of file
diff --git a/public/css/wysiwyg.css b/public/css/wysiwyg.css
index 9308305..380c9f4 100644
--- a/public/css/wysiwyg.css
+++ b/public/css/wysiwyg.css
@@ -1 +1 @@
-body { font-family: verdana,arial,sans-serif; font-size: 14px; color: #666; }
\ No newline at end of file
+body { font-family: verdana,arial,sans-serif; font-size: 14px; color: #666; }
\ No newline at end of file
diff --git a/public/javascript/.old/admin.js.old b/public/javascript/.old/admin.js.old
index d03b8e9..30395b2 100644
--- a/public/javascript/.old/admin.js.old
+++ b/public/javascript/.old/admin.js.old
@@ -1,5 +1,5 @@
$(document).ready( function() {
-
+
$('input[type="submit"]').each( function() {
$(this).replaceWith(""+$(this).val()+"");
});
@@ -23,7 +23,7 @@ $(document).ready( function() {
}
});
}
-
+
$('div.buttons a.submit').click( function() {
var form = $(this).parents('form');
var failed = form.find('.required')
@@ -33,17 +33,17 @@ $(document).ready( function() {
if ( failed.size() == 0 ) { form.submit(); }
return false;
});
-
-
+
+
$('#site, #stories, #images').each( function() {
if ( this.scrollHeight > 580 ) {
$(this).css({'overflow-y': 'scroll'});
- }
+ }
});
$('#galleries, #blogs').each( function() {
if ( this.scrollHeight > 290 ) {
$(this).css({'overflow-y': 'scroll'});
- }
+ }
});
$('div.list').hover( function() {
$(this).css({ border: '1px solid #333'});
@@ -52,7 +52,7 @@ $(document).ready( function() {
$(this).find('h2, h3').css({color: '#999' });
$(this).css({ border: '1px solid #999'});
});
-
+
$('a.delete').click( function() {
var href = $(this).attr('href');
$(this).hide();
@@ -63,12 +63,12 @@ $(document).ready( function() {
);
$('a.yes').click( function() {
var el = this;
- $.blockUI("Okay, just a second ...",
+ $.blockUI("Okay, just a second ...",
{ 'font-weight': 'bold', border: 'none' });
- $.ajax({
- type: 'delete',
- url: href,
- success: function() {
+ $.ajax({
+ type: 'delete',
+ url: href,
+ success: function() {
window.location = '/admin';
},
error: function() {
diff --git a/public/javascript/.old/editor.js.old b/public/javascript/.old/editor.js.old
index 409c6ac..8bfa0cf 100644
--- a/public/javascript/.old/editor.js.old
+++ b/public/javascript/.old/editor.js.old
@@ -1,9 +1,9 @@
$(document).ready( function() {
-
+
var wysiwyg = function() {
var el;
if ( $(this).val() == 'wysiwyg' ) {
- tinyMCE.execCommand('mceAddControl',false,'wysiwyg');
+ tinyMCE.execCommand('mceAddControl',false,'wysiwyg');
} else if ( el = tinyMCE.getInstanceById('wysiwyg') ) {
tinyMCE.execCommand('mceRemoveControl',false,'wysiwyg');
$('#wysiwyg_container').hide();
@@ -27,4 +27,4 @@ tinyMCE.init({ mode : "none", theme : "advanced",
theme_advanced_buttons2: '',
theme_advanced_buttons3: '',
relative_urls: false
-});
+});
diff --git a/public/javascript/.svn/text-base/core.js.svn-base b/public/javascript/.svn/text-base/core.js.svn-base
index 07b5269..c1c3ebe 100644
--- a/public/javascript/.svn/text-base/core.js.svn-base
+++ b/public/javascript/.svn/text-base/core.js.svn-base
@@ -23,7 +23,7 @@ Cruiser.String = {
map: function( args, f ) {
var g = function( s, p ) { return f.apply( s, p ); }
return args.inject( this, g );
- },
+ },
toCharArray: String.prototype.toArray,
toArray: function( separator ) {
if ( separator ) {
diff --git a/public/javascript/.svn/text-base/enumerable.js.svn-base b/public/javascript/.svn/text-base/enumerable.js.svn-base
index fb23454..662817d 100644
--- a/public/javascript/.svn/text-base/enumerable.js.svn-base
+++ b/public/javascript/.svn/text-base/enumerable.js.svn-base
@@ -4,21 +4,21 @@ var Hash = function(object) {
}
};
Hash.convert = function(object) {
- for( var k in Hash.prototype ) { object[k] = Hash.prototype[k] }; return object;
+ for( var k in Hash.prototype ) { object[k] = Hash.prototype[k] }; return object;
};
Hash.prototype = {
- each: function( fn ) {
+ each: function( fn ) {
for( var k in this ) {
if (! ( typeof this[k] == 'function' )) { fn({0:k, 1: this[k], key: k, value: this[k]}) }
}
- return this;
+ return this;
},
merge: function( hash ) {
var self = this;
new Hash(hash).each( function(item) { self[item.key] = item.value }); return this;
}
};
-Array.convert = function(object) {
+Array.convert = function(object) {
if (object instanceof Array ) { return object }
else if (object.toArray) { return object.toArray() }
else {
@@ -30,7 +30,7 @@ Array.prototype.each = function( fn ) {
for(var i = 0; i
-
+