Permalink
Browse files

initial copy from 'wagon' project

git-svn-id: svn+ssh://rubyforge.org/var/svn/wagn/trunk@1 ec9d8473-2c57-4e18-8d51-132f0e30f32e
  • Loading branch information...
0 parents commit 449defe939ee349cf7447aaecbc4ea2776a03661 @leword leword committed Jun 8, 2007
Showing 654 changed files with 49,817 additions and 0 deletions.
@@ -0,0 +1,65 @@
+=== 0.5.3 (May 26, 2007)
+* update install, remove debugging code & unused file
+* fix search in mysql
+* merge -r563:564 from branches/lhoffman: fix remove bug
+* merge -r564:567 from branches/lhoffman: version
+* merged -r553:561 from branches/lhoffman: rename
+* fixed <p> css
+* fixed overflow bug and showed cardtype on line view
+* replace obsolete INSTALL instructions with link to wagn.org
+
+
+=== 0.5.3 (May 14, 2007)
+ * workspace spacing, table of contents css, and card lists
+ * fix sidebar bug
+ * add discussion datatype
+ * allow hr
+ * fix table of contents
+ * fix save update for same card twice on page. (sidebar card in main slot)
+ * unbreak table of contents
+ * latest compile of js
+ * fix tag cloud css
+ * fix url on search/recent changes requests
+ * fix incomplete thought in permission test
+ * browser detection, link fixes
+ * more instructions on connection cards.
+ * bug fixes, including auth permission
+ * cardtype cards give valid ruby class, cardtype creation gives more attractive name.
+ * misc small fixes
+ * lots of small bugs -- sidebar issues, transclusion titles, etc...
+ * swipe at little bugs on 0.5.3 list
+ * fixed new wagn text and transclusion typo for nonexistent cards.
+ * fix edit NOT ok js message?
+ * link to images
+ * css fix for wadget
+ * quick hack for non-word characters in search. fix js alert
+ * fix cardtype dropdown, error on cardtype update
+ * fixing absolute/relative urls in wadget, make open/close work, refactor, etc.
+ * forgot to commit js
+ * undo some wadget changes, fix css
+ * adding wadget.js
+ * remove wadget symlink
+ * merge -r471:512 from branches/wadget
+ * data touchups
+ * reset test fixtures to new install. fix tests accordingly
+ * fix transclusion editing (broken by delayed editor load) via terrible hack
+ * merge -r503:505 from branches/lhoffman: delayed edit optimization
+ * merge -r500:502 from branches/lhoffman : import-export hack
+ * make search case insensitive in Postgresql, refactor adapter specific matching
+ * generic defaults
+ * selenium test updates
+ * yast (yet another stylesheet tweak)
+ * better test name
+ * new selenium tests
+ * css tweak for lists
+ * additional css tweaks for header spacing
+ * line-height tweak
+
+=== 0.3.2 (July 28, 2006)
+ * unit/functional tests running again
+ * handle invalid activation code on activation landing page
+ * handle invalid emails on invitation page
+ * better Exception handling defaults in sample_wagn.rb
+
+=== 0.3.1 (July 06, 2006)
+ * First real release
331 GPL

Large diffs are not rendered by default.

Oops, something went wrong.
27 INSTALL
@@ -0,0 +1,27 @@
+See http://wagn.org/wiki/Wagn_Installation for the latest version of these instructions.
+
+New Installation
+
+ 1. Download Wagn from rubyforge, or checkout the source from svn
+ 2. untar or unzip the package
+ 3. copy `config/sample-database.yml` to `config/database.yml` and `config/sample-wagn.rb` to `config/wagn.rb`
+ 4. create databases (dev,test,prod). edit `config/database.yml` accordingly.
+ 5. edit `config/wagn.rb` -- set System.base_url and System.site_name
+ 6. `rake db:migrate` this will set up the database.
+ 7. start the server `./script/server`. make sure the user youre running the server as has write access to the `tmp/` and `log/` directories
+ 8. point your browser to http://myhost:3000/
+ this should give you a form to update the account information for the admin user and log you in as admin.
+ 9. Click the 'permissions' link on the sidebar and setup the permissions for anonymous and signed-in users.
+ 10. you can start wagging as admin, but its recommended to send an invitation to yourself to set up a new user.
+
+Upgrade
+
+ 1. untar or unzip the new package
+ 2. copy the following files from the old installation into the new one:
+ * config/database.yml
+ * config/wagn.rb
+ * image/* [if you've uploaded any images]
+ * file/* [if you've uploaded any other files]
+ * public/stylesheets/local.css [if you've made any local css changes]
+ 3. in the new directory run: rake db:migrate
+ 4. start the server in the new directory
16 LICENSE
@@ -0,0 +1,16 @@
+WagN -- wiki and tagging web application
+Copyright (C) 2005 Grass Commons
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
180 README
@@ -0,0 +1,180 @@
+== Welcome to Rails
+
+Rails is a web-application and persistence framework that includes everything
+needed to create database-backed web-applications according to the
+Model-View-Control pattern of separation. This pattern splits the view (also
+called the presentation) into "dumb" templates that are primarily responsible
+for inserting pre-built data in between HTML tags. The model contains the
+"smart" domain objects (such as Account, Product, Person, Post) that holds all
+the business logic and knows how to persist themselves to a database. The
+controller handles the incoming requests (such as Save New Account, Update
+Product, Show Post) by manipulating the model and directing data to the view.
+
+In Rails, the model is handled by what's called an object-relational mapping
+layer entitled Active Record. This layer allows you to present the data from
+database rows as objects and embellish these data objects with business logic
+methods. You can read more about Active Record in
+link:files/vendor/rails/activerecord/README.html.
+
+The controller and view are handled by the Action Pack, which handles both
+layers by its two parts: Action View and Action Controller. These two layers
+are bundled in a single package due to their heavy interdependence. This is
+unlike the relationship between the Active Record and Action Pack that is much
+more separate. Each of these packages can be used independently outside of
+Rails. You can read more about Action Pack in
+link:files/vendor/rails/actionpack/README.html.
+
+
+== Getting started
+
+1. Start the web server: <tt>ruby script/server</tt> (run with --help for options)
+2. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!"
+3. Follow the guidelines to start developing your application
+
+
+== Web servers
+
+Rails uses the built-in web server in Ruby called WEBrick by default, so you don't
+have to install or configure anything to play around.
+
+If you have lighttpd installed, though, it'll be used instead when running script/server.
+It's considerably faster than WEBrick and suited for production use, but requires additional
+installation and currently only works well on OS X/Unix (Windows users are encouraged
+to start with WEBrick). We recommend version 1.4.11 and higher. You can download it from
+http://www.lighttpd.net.
+
+If you want something that's halfway between WEBrick and lighttpd, we heartily recommend
+Mongrel. It's a Ruby-based web server with a C-component (so it requires compilation) that
+also works very well with Windows. See more at http://mongrel.rubyforge.org/.
+
+But of course its also possible to run Rails with the premiere open source web server Apache.
+To get decent performance, though, you'll need to install FastCGI. For Apache 1.3, you want
+to use mod_fastcgi. For Apache 2.0+, you want to use mod_fcgid.
+
+See http://wiki.rubyonrails.com/rails/pages/FastCGI for more information on FastCGI.
+
+== Example for Apache conf
+
+ <VirtualHost *:80>
+ ServerName rails
+ DocumentRoot /path/application/public/
+ ErrorLog /path/application/log/server.log
+
+ <Directory /path/application/public/>
+ Options ExecCGI FollowSymLinks
+ AllowOverride all
+ Allow from all
+ Order allow,deny
+ </Directory>
+ </VirtualHost>
+
+NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI
+should be on and ".cgi" should respond. All requests from 127.0.0.1 go
+through CGI, so no Apache restart is necessary for changes. All other requests
+go through FCGI (or mod_ruby), which requires a restart to show changes.
+
+
+== Debugging Rails
+
+Have "tail -f" commands running on both the server.log, production.log, and
+test.log files. Rails will automatically display debugging and runtime
+information to these files. Debugging info will also be shown in the browser
+on requests from 127.0.0.1.
+
+
+== Breakpoints
+
+Breakpoint support is available through the script/breakpointer client. This
+means that you can break out of execution at any point in the code, investigate
+and change the model, AND then resume execution! Example:
+
+ class WeblogController < ActionController::Base
+ def index
+ @posts = Post.find_all
+ breakpoint "Breaking out from the list"
+ end
+ end
+
+So the controller will accept the action, run the first line, then present you
+with a IRB prompt in the breakpointer window. Here you can do things like:
+
+Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
+
+ >> @posts.inspect
+ => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
+ #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
+ >> @posts.first.title = "hello from a breakpoint"
+ => "hello from a breakpoint"
+
+...and even better is that you can examine how your runtime objects actually work:
+
+ >> f = @posts.first
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
+ >> f.
+ Display all 152 possibilities? (y or n)
+
+Finally, when you're ready to resume execution, you press CTRL-D
+
+
+== Console
+
+You can interact with the domain model by starting the console through script/console.
+Here you'll have all parts of the application configured, just like it is when the
+application is running. You can inspect domain models, change values, and save to the
+database. Starting the script without arguments will launch it in the development environment.
+Passing an argument will specify a different environment, like <tt>script/console production</tt>.
+
+
+== Description of contents
+
+app
+ Holds all the code that's specific to this particular application.
+
+app/controllers
+ Holds controllers that should be named like weblog_controller.rb for
+ automated URL mapping. All controllers should descend from
+ ActionController::Base.
+
+app/models
+ Holds models that should be named like post.rb.
+ Most models will descend from ActiveRecord::Base.
+
+app/views
+ Holds the template files for the view that should be named like
+ weblog/index.rhtml for the WeblogController#index action. All views use eRuby
+ syntax. This directory can also be used to keep stylesheets, images, and so on
+ that can be symlinked to public.
+
+app/helpers
+ Holds view helpers that should be named like weblog_helper.rb.
+
+app/apis
+ Holds API classes for web services.
+
+config
+ Configuration files for the Rails environment, the routing map, the database, and other dependencies.
+
+components
+ Self-contained mini-applications that can bundle together controllers, models, and views.
+
+db
+ Contains the database schema in schema.rb. db/migrate contains all
+ the sequence of Migrations for your schema.
+
+lib
+ Application specific libraries. Basically, any kind of custom code that doesn't
+ belong under controllers, models, or helpers. This directory is in the load path.
+
+public
+ The directory available for the web server. Contains subdirectories for images, stylesheets,
+ and javascripts. Also contains the dispatchers and the default HTML files.
+
+script
+ Helper scripts for automation and generation.
+
+test
+ Unit and functional tests along with fixtures.
+
+vendor
+ External libraries that the application depends on. Also includes the plugins subdirectory.
+ This directory is in the load path.
@@ -0,0 +1,10 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require(File.join(File.dirname(__FILE__), 'config', 'boot'))
+
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+require 'tasks/rails'
@@ -0,0 +1,93 @@
+class InvitationError < StandardError; end
+
+class AccountController < ApplicationController
+ layout 'application'
+ before_filter :login_required, :only => [ :invite, :create, :update ]
+ #observer :card_observer, :tag_observer
+ helper :wagn
+
+ def invite
+ end
+
+ def login
+ return unless request.post?
+ self.current_user = User.authenticate(params[:login], params[:password])
+ if current_user
+ flash[:notice] = "Welcome to #{System.site_name}"
+ #render :text=>"woohoo you logged in: #{current_user.inspect} <br> session: #{session.inspect}"
+ return_to_rememberd_page
+ else
+ flash[:notice] = "Login Failed"
+ end
+ end
+
+ def logout
+ self.current_user = nil
+ flash[:notice] = "You have been logged out."
+ return_to_rememberd_page
+ end
+
+ def forgot_password
+ return unless request.post?
+ if @user = User.find_by_email(params[:email])
+ @user.generate_password
+ @user.save
+ subject = "Password Reset"
+ message = "You have been give a new temporary password. " +
+ "Please update your password once you've logged in. "
+ UserNotifier.deliver_account_info(@user, subject, message)
+ flash[:notice] = "A new temporary password has been set on your account and sent to your email address"
+ return_to_rememberd_page
+ else
+ flash[:notice] = "Could not find a user with that email address"
+ end
+ end
+
+ def create
+ return unless request.post?
+ # FIXME: not hardcode user cardtype??
+ @tag = Tag.new( :datatype_key => 'User', :name=>params[:card][:name] )
+ @card = Card::User.new( {:tag=>@tag}.merge(params[:card]))
+ @user = User.new( params[:user].merge( :invited_by=>current_user.id ))
+ if @user.password.blank?
+ @user.generate_password
+ end
+ @user.save!
+ @card.extension = @user
+ @card.save!
+ raise(Wagn::Oops, "Failed to connect card to user") unless (User.find_by_email(params[:user][:email]).card)
+ raise(Wagn::Oops, "Failed to set datatype for user") unless (User.find_by_email(params[:user][:email]).card.tag.datatype_key=='User')
+ raise(Wagn::Oops, "Invitation Email subject is required") unless (params[:email] and params[:email][:subject])
+ raise(Wagn::Oops, "Invitation Email message is required") unless (params[:email] and params[:email][:message])
+ UserNotifier.deliver_account_info(@user, params[:email][:subject], params[:email][:message])
+ flash[:notice] = "User #{@card.name} has been created"
+ rescue Exception=>e
+ # if anything went wrong, don't leave any junk lying around
+ # FIXME: this code has caused a lot of bug chasing-- would be cleaner and
+ # more robust to have the card & extension creation together in a database transaction
+ # at the model level.
+ @user.destroy if @user && !@user.new_record?
+ @card.destroy_without_permissions if @card && !@card.new_record?
+ raise Wagn::Oops, e.message
+ end
+
+ def update
+ load_card
+ @user = @card.extension or raise("extension gotta be a user")
+ element_id = params[:element]
+ context = edit_user_context(@card)
+ #TODO: need to check context for security
+
+ if @user.update_attributes params[:user]
+ render :update do |page|
+ page.wagn.card.find("#{element_id}").continue_save()
+ end
+ else
+ error_message = render_to_string :inline=>'<%= error_messages_for :user %>'
+ render :update do |page|
+ page.wagn.messenger.note "Update user failed" + error_message
+
+ end
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 449defe

Please sign in to comment.