commit 51b79e7298ba1cb03ee03526f80202b46efac24b
Author: Eugene Korbut
Date: Thu Jan 8 05:27:12 2009 +1000
init import from old mailr project (http://svn.littlegreen.org/mailr/trunk)
diff --git a/CHANGELOG b/CHANGELOG
new file mode 100644
index 0000000..18b4288
--- /dev/null
+++ b/CHANGELOG
@@ -0,0 +1,718 @@
+*0.14.2 (RC3)* (October 26th, 2005)
+
+* Constants set in the development/test/production environment file are set in Object
+
+* Scaffold generator pays attention to the controller name. #2562 [self@mattmower.com]
+
+* Include tasks from vendor/plugins/*/tasks in the Rakefile #2545 [Rick Olson]
+
+
+*0.14.1 (RC2)* (October 19th, 2005)
+
+* Don't clean RAILS_ROOT on windows
+
+* Remove trailing '/' from RAILS_ROOT [Nicholas Seckar]
+
+* Upgraded to Active Record 1.12.1 and Action Pack 1.10.1
+
+
+*0.14.0 (RC1)* (October 16th, 2005)
+
+* Moved generator folder from RAILS_ROOT/generators to RAILS_ROOT/lib/generators [Tobias Luetke]
+
+* Fix rake dev and related commands [Nicholas Seckar]
+
+* The rails command tries to deduce your MySQL socket by running `mysql_config
+--socket`. If it fails, default to /path/to/your/mysql.sock
+
+* Made the rails command use the application name for database names in the tailored database.yml file. Example: "rails ~/projects/blog" will use "blog_development" instead of "rails_development". [Florian Weber]
+
+* Added Rails framework freezing tasks: freeze_gems (freeze to current gems), freeze_edge (freeze to Rails SVN trunk), unfreeze_rails (float with newest gems on system)
+
+* Added update_javascripts task which will fetch all the latest js files from your current rails install. Use after updating rails. [Tobias Luetke]
+
+* Added cleaning of RAILS_ROOT to useless elements such as '../non-dot-dot/'. Provides cleaner backtraces and error messages. [Nicholas Seckar]
+
+* Made the instantiated/transactional fixtures settings be controlled through Rails::Initializer. Transactional and non-instantiated fixtures are default from now on. [Florian Weber]
+
+* Support using different database adapters for development and test with ActiveRecord::Base.schema_format = :ruby [Sam Stephenson]
+
+* Make webrick work with session(:off)
+
+* Add --version, -v option to the Rails command. Closes #1840. [stancell]
+
+* Update Prototype to V1.4.0_pre11, script.aculo.us to V1.5_rc3 [2504] and fix the rails generator to include the new .js files [Thomas Fuchs]
+
+* Make the generator skip a file if it already exists and is identical to the new file.
+
+* Add experimental plugin support #2335
+
+* Made Rakefile aware of new .js files in script.aculo.us [Thomas Fuchs]
+
+* Make table_name and controller_name in generators honor AR::Base.pluralize_table_names. #1216 #2213 [kazuhiko@fdiary.net]
+
+* Clearly label functional and unit tests in rake stats output. #2297 [lasse.koskela@gmail.com]
+
+* Make the migration generator only check files ending in *.rb when calculating the next file name #2317 [Chad Fowler]
+
+* Added prevention of duplicate migrations from the generator #2240 [fbeausoleil@ftml.net]
+
+* Add db_schema_dump and db_schema_import rake tasks to work with the new ActiveRecord::SchemaDumper (for dumping a schema to and reading a schema from a ruby file).
+
+* Reformed all the config/environments/* files to conform to the new Rails::Configuration approach. Fully backwards compatible.
+
+* Added create_sessions_table, drop_sessions_table, and purge_sessions_table as rake tasks for databases that supports migrations (MySQL, PostgreSQL, SQLite) to get a table for use with CGI::Session::ActiveRecordStore
+
+* Added dump of schema version to the db_structure_dump task for databases that support migrations #1835 [Rick Olson]
+
+* Fixed script/profiler for Ruby 1.8.2 #1863 [Rick Olson]
+
+* Fixed clone_structure_to_test task for SQLite #1864 [jon@burningbush.us]
+
+* Added -m/--mime-types option to the WEBrick server, so you can specify a Apache-style mime.types file to load #2059 [ask@develooper.com]
+
+* Added -c/--svn option to the generator that'll add new files and remove destroyed files using svn add/revert/remove as appropriate #2064 [kevin.clark@gmail.com]
+
+* Added -c/--charset option to WEBrick server, so you can specify a default charset (which without changes is UTF-8) #2084 [wejn@box.cz]
+
+* Make the default stats task extendable by modifying the STATS_DIRECTORIES constant
+
+* Allow the selected environment to define RAILS_DEFAULT_LOGGER, and have Rails::Initializer use it if it exists.
+
+* Moved all the shared tasks from Rakefile into Rails, so that the Rakefile is empty and doesn't require updating.
+
+* Added Rails::Initializer and Rails::Configuration to abstract all of the common setup out of config/environment.rb (uses config/boot.rb to bootstrap the initializer and paths)
+
+* Fixed the scaffold generator to fail right away if the database isn't accessible instead of in mid-air #1169 [Chad Fowler]
+
+* Corrected project-local generator location in scripts.rb #2010 [Michael Schuerig]
+
+* Don't require the environment just to clear the logs #2093 [Scott Barron]
+
+* Make the default rakefile read *.rake files from config/tasks (for easy extension of the rakefile by e.g. generators)
+
+* Only load breakpoint in development mode and when BREAKPOINT_SERVER_PORT is defined.
+
+* Allow the --toggle-spin switch on process/reaper to be negated
+
+* Replace render_partial with render :partial in scaffold generator [Nicholas Seckar]
+
+* Added -w flag to ps in process/reaper #1934 [Scott Barron]
+
+* Allow ERb in the database.yml file (just like with fixtures), so you can pull out the database configuration in environment variables #1822 [Duane Johnson]
+
+* Added convenience controls for FCGI processes (especially when managed remotely): spinner, spawner, and reaper. They reside in script/process. More details can be had by calling them with -h/--help.
+
+* Added load_fixtures task to the Rakefile, which will load all the fixtures into the database for the current environment #1791 [Marcel Molina]
+
+* Added an empty robots.txt to public/, so that web servers asking for it won't trigger a dynamic call, like favicon.ico #1738 [michael@schubert]
+
+* Dropped the 'immediate close-down' of FCGI processes since it didn't work consistently and produced bad responses when it didn't. So now a TERM ensures exit after the next request (just as if the process is handling a request when it receives the signal). This means that you'll have to 'nudge' all FCGI processes with a request in order to ensure that they have all reloaded. This can be done by something like ./script/process/repear --nudge 'http://www.myapp.com' --instances 10, which will load the myapp site 10 times (and thus hit all of the 10 FCGI processes once, enough to shut down).
+
+
+*0.13.1* (11 July, 2005)
+
+* Look for app-specific generators in RAILS_ROOT/generators rather than the clunky old RAILS_ROOT/script/generators. Nobody really uses this feature except for the unit tests, so it's a negligible-impact change. If you want to work with third-party generators, drop them in ~/.rails/generators or simply install gems.
+
+* Fixed that each request with the WEBrick adapter would open a new database connection #1685 [Sam Stephenson]
+
+* Added support for SQL Server in the database rake tasks #1652 [ken.barker@gmail.com] Note: osql and scptxfr may need to be installed on your development environment. This involves getting the .exes and a .rll (scptxfr) from a production SQL Server (not developer level SQL Server). Add their location to your Environment PATH and you are all set.
+
+* Added a VERSION parameter to the migrate task that allows you to do "rake migrate VERSION=34" to migrate to the 34th version traveling up or down depending on the current version
+
+* Extend Ruby version check to include RUBY_RELEASE_DATE >= '2005-12-25', the final Ruby 1.8.2 release #1674 [court3nay@gmail.com]
+
+* Improved documentation for environment config files #1625 [court3nay@gmail.com]
+
+
+*0.13.0* (6 July, 2005)
+
+* Changed the default logging level in config/environment.rb to INFO for production (so SQL statements won't be logged)
+
+* Added migration generator: ./script/generate migration add_system_settings
+
+* Added "migrate" as rake task to execute all the pending migrations from db/migrate
+
+* Fixed that model generator would make fixtures plural, even if ActiveRecord::Base.pluralize_table_names was false #1185 [Marcel Molina]
+
+* Added a DOCTYPE of HTML transitional to the HTML files generated by Rails #1124 [Michael Koziarski]
+
+* SIGTERM also gracefully exits dispatch.fcgi. Ignore SIGUSR1 on Windows.
+
+* Add the option to manually manage garbage collection in the FastCGI dispatcher. Set the number of requests between GC runs in your public/dispatch.fcgi [skaes@web.de]
+
+* Allow dynamic application reloading for dispatch.fcgi processes by sending a SIGHUP. If the process is currently handling a request, the request will be allowed to complete first. This allows production fcgi's to be reloaded without having to restart them.
+
+* RailsFCGIHandler (dispatch.fcgi) no longer tries to explicitly flush $stdout (CgiProcess#out always calls flush)
+
+* Fixed rakefile actions against PostgreSQL when the password is all numeric #1462 [michael@schubert.cx]
+
+* ActionMailer::Base subclasses are reloaded with the other rails components #1262
+
+* Made the WEBrick adapter not use a mutex around action performance if ActionController::Base.allow_concurrency is true (default is false)
+
+* Fixed that mailer generator generated fixtures/plural while units expected fixtures/singular #1457 [Scott Barron]
+
+* Added a 'whiny nil' that's aim to ensure that when users pass nil to methods where that isn't appropriate, instead of NoMethodError? and the name of some method used by the framework users will see a message explaining what type of object was expected. Only active in test and development environments by default #1209 [Michael Koziarski]
+
+* Fixed the test_helper.rb to be safe for requiring controllers from multiple spots, like app/controllers/article_controller.rb and app/controllers/admin/article_controller.rb, without reloading the environment twice #1390 [Nicholas Seckar]
+
+* Fixed Webrick to escape + characters in URL's the same way that lighttpd and apache do #1397 [Nicholas Seckar]
+
+* Added -e/--environment option to script/runner #1408 [fbeausoleil@ftml.net]
+
+* Modernize the scaffold generator to use the simplified render and test methods and to change style from @params["id"] to params[:id]. #1367
+
+* Added graceful exit from pressing CTRL-C during the run of the rails command #1150 [Caleb Tennis]
+
+* Allow graceful exits for dispatch.fcgi processes by sending a SIGUSR1. If the process is currently handling a request, the request will be allowed to complete and then will terminate itself. If a request is not being handled, the process is terminated immediately (via #exit). This basically works like restart graceful on Apache. [Jamis Buck]
+
+* Made dispatch.fcgi more robust by catching fluke errors and retrying unless its a permanent condition. [Jamis Buck]
+
+* Added console --profile for profiling an IRB session #1154 [Jeremy Kemper]
+
+* Changed console_sandbox into console --sandbox #1154 [Jeremy Kemper]
+
+
+*0.12.1* (20th April, 2005)
+
+* Upgraded to Active Record 1.10.1, Action Pack 1.8.1, Action Mailer 0.9.1, Action Web Service 0.7.1
+
+
+*0.12.0* (19th April, 2005)
+
+* Fixed that purge_test_database would use database settings from the development environment when recreating the test database #1122 [rails@cogentdude.com]
+
+* Added script/benchmarker to easily benchmark one or more statement a number of times from within the environment. Examples:
+
+ # runs the one statement 10 times
+ script/benchmarker 10 'Person.expensive_method(10)'
+
+ # pits the two statements against each other with 50 runs each
+ script/benchmarker 50 'Person.expensive_method(10)' 'Person.cheap_method(10)'
+
+* Added script/profiler to easily profile a single statement from within the environment. Examples:
+
+ script/profiler 'Person.expensive_method(10)'
+ script/profiler 'Person.expensive_method(10)' 10 # runs the statement 10 times
+
+* Added Rake target clear_logs that'll truncate all the *.log files in log/ to zero #1079 [Lucas Carlson]
+
+* Added lazy typing for generate, such that ./script/generate cn == ./script/generate controller and the likes #1051 [k@v2studio.com]
+
+* Fixed that ownership is brought over in pg_dump during tests for PostgreSQL #1060 [pburleson@gmail.com]
+
+* Upgraded to Active Record 1.10.0, Action Pack 1.8.0, Action Mailer 0.9.0, Action Web Service 0.7.0, Active Support 1.0.4
+
+
+*0.11.1* (27th March, 2005)
+
+* Fixed the dispatch.fcgi use of a logger
+
+* Upgraded to Active Record 1.9.1, Action Pack 1.7.0, Action Mailer 0.8.1, Action Web Service 0.6.2, Active Support 1.0.3
+
+
+*0.11.0* (22th March, 2005)
+
+* Removed SCRIPT_NAME from the WEBrick environment to prevent conflicts with PATH_INFO #896 [Nicholas Seckar]
+
+* Removed ?$1 from the dispatch.f/cgi redirect line to get rid of 'complete/path/from/request.html' => nil being in the @params now that the ENV["REQUEST_URI"] is used to determine the path #895 [dblack/Nicholas Seckar]
+
+* Added additional error handling to the FastCGI dispatcher to catch even errors taking down the entire process
+
+* Improved the generated scaffold code a lot to take advantage of recent Rails developments #882 [Tobias Luetke]
+
+* Combined the script/environment.rb used for gems and regular files version. If vendor/rails/* has all the frameworks, then files version is used, otherwise gems #878 [Nicholas Seckar]
+
+* Changed .htaccess to allow dispatch.* to be called from a sub-directory as part of the push with Action Pack to make Rails work on non-vhost setups #826 [Nicholas Seckar/Tobias Luetke]
+
+* Added script/runner which can be used to run code inside the environment by eval'ing the first parameter. Examples:
+
+ ./script/runner 'ReminderService.deliver'
+ ./script/runner 'Mailer.receive(STDIN.read)'
+
+ This makes it easier to do CRON and postfix scripts without actually making a script just to trigger 1 line of code.
+
+* Fixed webrick_server cookie handling to allow multiple cookes to be set at once #800, #813 [dave@cherryville.org]
+
+* Fixed the Rakefile's interaction with postgresql to:
+
+ 1. Use PGPASSWORD and PGHOST in the environment to fix prompting for
+ passwords when connecting to a remote db and local socket connections.
+ 2. Add a '-x' flag to pg_dump which stops it dumping privileges #807 [rasputnik]
+ 3. Quote the user name and use template0 when dumping so the functions doesn't get dumped too #855 [pburleson]
+ 4. Use the port if available #875 [madrobby]
+
+* Upgraded to Active Record 1.9.0, Action Pack 1.6.0, Action Mailer 0.8.0, Action Web Service 0.6.1, Active Support 1.0.2
+
+
+*0.10.1* (7th March, 2005)
+
+* Fixed rake stats to ignore editor backup files like model.rb~ #791 [skanthak]
+
+* Added exception shallowing if the DRb server can't be started (not worth making a fuss about to distract new users) #779 [Tobias Luetke]
+
+* Added an empty favicon.ico file to the public directory of new applications (so the logs are not spammed by its absence)
+
+* Fixed that scaffold generator new template should use local variable instead of instance variable #778 [Dan Peterson]
+
+* Allow unit tests to run on a remote server for PostgreSQL #781 [adamm@galacticasoftware.com]
+
+* Added web_service generator (run ./script/generate web_service for help) #776 [Leon Bredt]
+
+* Added app/apis and components to code statistics report #729 [Scott Barron]
+
+* Fixed WEBrick server to use ABSOLUTE_RAILS_ROOT instead of working_directory #687 [Nicholas Seckar]
+
+* Fixed rails_generator to be usable without RubyGems #686 [Cristi BALAN]
+
+* Fixed -h/--help for generate and destroy generators #331
+
+* Added begin/rescue around the FCGI dispatcher so no uncaught exceptions can bubble up to kill the process (logs to log/fastcgi.crash.log)
+
+* Fixed that association#count would produce invalid sql when called sequentialy #659 [kanis@comcard.de]
+
+* Fixed test/mocks/testing to the correct test/mocks/test #740
+
+* Added early failure if the Ruby version isn't 1.8.2 or above #735
+
+* Removed the obsolete -i/--index option from the WEBrick servlet #743
+
+* Upgraded to Active Record 1.8.0, Action Pack 1.5.1, Action Mailer 0.7.1, Action Web Service 0.6.0, Active Support 1.0.1
+
+
+*0.10.0* (24th February, 2005)
+
+* Changed default IP binding for WEBrick from 127.0.0.1 to 0.0.0.0 so that the server is accessible both locally and remotely #696 [Marcel]
+
+* Fixed that script/server -d was broken so daemon mode couldn't be used #687 [Nicholas Seckar]
+
+* Upgraded to breakpoint 92 which fixes:
+
+ * overload IRB.parse_opts(), fixes #443
+ => breakpoints in tests work even when running them via rake
+ * untaint handlers, might fix an issue discussed on the Rails ML
+ * added verbose mode to breakpoint_client
+ * less noise caused by breakpoint_client by default
+ * ignored TerminateLineInput exception in signal handler
+ => quiet exit on Ctrl-C
+
+* Added support for independent components residing in /components. Example:
+
+ Controller: components/list/items_controller.rb
+ (holds a List::ItemsController class with uses_component_template_root called)
+
+ Model : components/list/item.rb
+ (namespace is still shared, so an Item model in app/models will take precedence)
+
+ Views : components/list/items/show.rhtml
+
+
+* Added --sandbox option to script/console that'll roll back all changes made to the database when you quit #672 [Jeremy Kemper]
+
+* Added 'recent' as a rake target that'll run tests for files that changed in the last 10 minutes #612 [Jeremy Kemper]
+
+* Changed script/console to default to development environment and drop --no-inspect #650 [Jeremy Kemper]
+
+* Added that the 'fixture :posts' syntax can be used for has_and_belongs_to_many fixtures where a model doesn't exist #572 [Jeremy Kemper]
+
+* Added that running test_units and test_functional now performs the clone_structure_to_test as well #566 [rasputnik]
+
+* Added new generator framework that informs about its doings on generation and enables updating and destruction of generated artifacts. See the new script/destroy and script/update for more details #487 [Jeremy Kemper]
+
+* Added Action Web Service as a new add-on framework for Action Pack [Leon Bredt]
+
+* Added Active Support as an independent utility and standard library extension bundle
+
+* Upgraded to Active Record 1.7.0, Action Pack 1.5.0, Action Mailer 0.7.0
+
+
+*0.9.5* (January 25th, 2005)
+
+* Fixed dependency reloading by switching to a remove_const approach where all Active Records, Active Record Observers, and Action Controllers are reloading by undefining their classes. This enables you to remove methods in all three types and see the change reflected immediately and it fixes #539. This also means that only those three types of classes will benefit from the const_missing and reloading approach. If you want other classes (like some in lib/) to reload, you must use require_dependency to do it.
+
+* Added Florian Gross' latest version of Breakpointer and friends that fixes a variaty of bugs #441 [Florian Gross]
+
+* Fixed skeleton Rakefile to work with sqlite3 out of the box #521 [rasputnik]
+
+* Fixed that script/breakpointer didn't get the Ruby path rewritten as the other scripts #523 [brandt@kurowski.net]
+
+* Fixed handling of syntax errors in models that had already been succesfully required once in the current interpreter
+
+* Fixed that models that weren't referenced in associations weren't being reloaded in the development mode by reinstating the reload
+
+* Fixed that generate scaffold would produce bad functional tests
+
+* Fixed that FCGI can also display SyntaxErrors
+
+* Upgraded to Active Record 1.6.0, Action Pack 1.4.0
+
+
+*0.9.4.1* (January 18th, 2005)
+
+* Added 5-second timeout to WordNet alternatives on creating reserved-word models #501 [Marcel Molina]
+
+* Fixed binding of caller #496 [Alexey]
+
+* Upgraded to Active Record 1.5.1, Action Pack 1.3.1, Action Mailer 0.6.1
+
+
+*0.9.4* (January 17th, 2005)
+
+* Added that ApplicationController will catch a ControllerNotFound exception if someone attempts to access a url pointing to an unexisting controller [Tobias Luetke]
+
+* Flipped code-to-test ratio around to be more readable #468 [Scott Baron]
+
+* Fixed log file permissions to be 666 instead of 777 (so they're not executable) #471 [Lucas Carlson]
+
+* Fixed that auto reloading would some times not work or would reload the models twice #475 [Tobias Luetke]
+
+* Added rewrite rules to deal with caching to public/.htaccess
+
+* Added the option to specify a controller name to "generate scaffold" and made the default controller name the plural form of the model.
+
+* Added that rake clone_structure_to_test, db_structure_dump, and purge_test_database tasks now pick up the source database to use from
+ RAILS_ENV instead of just forcing development #424 [Tobias Luetke]
+
+* Fixed script/console to work with Windows (that requires the use of irb.bat) #418 [octopod]
+
+* Fixed WEBrick servlet slowdown over time by restricting the load path reloading to mod_ruby
+
+* Removed Fancy Indexing as a default option on the WEBrick servlet as it made it harder to use various caching schemes
+
+* Upgraded to Active Record 1.5, Action Pack 1.3, Action Mailer 0.6
+
+
+*0.9.3* (January 4th, 2005)
+
+* Added support for SQLite in the auto-dumping/importing of schemas for development -> test #416
+
+* Added automated rewriting of the shebang lines on installs through the gem rails command #379 [Manfred Stienstra]
+
+* Added ActionMailer::Base.deliver_method = :test to the test environment so that mail objects are available in ActionMailer::Base.deliveries
+ for functional testing.
+
+* Added protection for creating a model through the generators with a name of an existing class, like Thread or Date.
+ It'll even offer you a synonym using wordnet.princeton.edu as a look-up. No, I'm not kidding :) [Florian Gross]
+
+* Fixed dependency management to happen in a unified fashion for Active Record and Action Pack using the new Dependencies module. This means that
+ the environment options needs to change from:
+
+ Before in development.rb:
+ ActionController::Base.reload_dependencies = true
+ ActiveRecord::Base.reload_associations = true
+
+ Now in development.rb:
+ Dependencies.mechanism = :load
+
+ Before in production.rb and test.rb:
+ ActionController::Base.reload_dependencies = false
+ ActiveRecord::Base.reload_associations = false
+
+ Now in production.rb and test.rb:
+ Dependencies.mechanism = :require
+
+* Fixed problems with dependency caching and controller hierarchies on Ruby 1.8.2 in development mode #351
+
+* Fixed that generated action_mailers doesnt need to require the action_mailer since thats already done in the environment #382 [Lucas Carlson]
+
+* Upgraded to Action Pack 1.2.0 and Active Record 1.4.0
+
+
+*0.9.2*
+
+* Fixed CTRL-C exists from the Breakpointer to be a clean affair without error dumping [Kent Sibilev]
+
+* Fixed "rake stats" to work with sub-directories in models and controllers and to report the code to test ration [Scott Baron]
+
+* Added that Active Record associations are now reloaded instead of cleared to work with the new const_missing hook in Active Record.
+
+* Added graceful handling of an inaccessible log file by redirecting output to STDERR with a warning #330 [rainmkr]
+
+* Added support for a -h/--help parameter in the generator #331 [Ulysses]
+
+* Fixed that File.expand_path in config/environment.rb would fail when dealing with symlinked public directories [mjobin]
+
+* Upgraded to Action Pack 1.1.0 and Active Record 1.3.0
+
+
+*0.9.1*
+
+* Upgraded to Action Pack 1.0.1 for important bug fix
+
+* Updated gem dependencies
+
+
+*0.9.0*
+
+* Renamed public/dispatch.servlet to script/server -- it wasn't really dispatching anyway as its delegating calls to public/dispatch.rb
+
+* Renamed AbstractApplicationController and abstract_application.rb to ApplicationController and application.rb, so that it will be possible
+ for the framework to automatically pick up on app/views/layouts/application.rhtml and app/helpers/application.rb
+
+* Added script/console that makes it even easier to start an IRB session for interacting with the domain model. Run with no-args to
+ see help.
+
+* Added breakpoint support 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
+ => "[#nil, \"body\"=>nil, \"id\"=>\"1\"}>,
+ #\"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
+ => #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
+
+* Changed environments to be configurable through an environment variable. By default, the environment is "development", but you
+ can change that and set your own by configuring the Apache vhost with a string like (mod_env must be available on the server):
+
+ SetEnv RAILS_ENV production
+
+ ...if you're using WEBrick, you can pick the environment to use with the command-line parameters -e/--environment, like this:
+
+ ruby public/dispatcher.servlet -e production
+
+* Added a new default environment called "development", which leaves the production environment to be tuned exclusively for that.
+
+* Added a start_server in the root of the Rails application to make it even easier to get started
+
+* Fixed public/.htaccess to use RewriteBase and share the same rewrite rules for all the dispatch methods
+
+* Fixed webrick_server to handle requests in a serialized manner (the Rails reloading infrastructure is not thread-safe)
+
+* Added support for controllers in directories. So you can have:
+
+ app/controllers/account_controller.rb # URL: /account/
+ app/controllers/admin/account_controller.rb # URL: /admin/account/
+
+ NOTE: You need to update your public/.htaccess with the new rules to pick it up
+
+* Added reloading for associations and dependencies under cached environments like FastCGI and mod_ruby. This makes it possible to use
+ those environments for development. This is turned on by default, but can be turned off with
+ ActiveRecord::Base.reload_associations = false and ActionController::Base.reload_dependencies = false in production environments.
+
+* Added support for sub-directories in app/models. So now you can have something like Basecamp with:
+
+ app/models/accounting
+ app/models/project
+ app/models/participants
+ app/models/settings
+
+ It's poor man's namespacing, but only for file-system organization. You still require files just like before.
+ Nothing changes inside the files themselves.
+
+
+* Fixed a few references in the tests generated by new_mailer [Jeremy Kemper]
+
+* Added support for mocks in testing with test/mocks
+
+* Cleaned up the environments a bit and added global constant RAILS_ROOT
+
+
+*0.8.5* (9)
+
+* Made dev-util available to all tests, so you can insert breakpoints in any test case to get an IRB prompt at that point [Jeremy Kemper]:
+
+ def test_complex_stuff
+ @david.projects << @new_project
+ breakpoint "Let's have a closer look at @david"
+ end
+
+ You need to install dev-utils yourself for this to work ("gem install dev-util").
+
+* Added shared generator behavior so future upgrades should be possible without manually copying over files [Jeremy Kemper]
+
+* Added the new helper style to both controller and helper templates [Jeremy Kemper]
+
+* Added new_crud generator for creating a model and controller at the same time with explicit scaffolding [Jeremy Kemper]
+
+* Added configuration of Test::Unit::TestCase.fixture_path to test_helper to concide with the new AR fixtures style
+
+* Fixed that new_model was generating singular table/fixture names
+
+* Upgraded to Action Mailer 0.4.0
+
+* Upgraded to Action Pack 0.9.5
+
+* Upgraded to Active Record 1.1.0
+
+
+*0.8.0 (15)*
+
+* Removed custom_table_name option for new_model now that the Inflector is as powerful as it is
+
+* Changed the default rake action to just do testing and separate API generation and coding statistics into a "doc" task.
+
+* Fixed WEBrick dispatcher to handle missing slashes in the URLs gracefully [alexey]
+
+* Added user option for all postgresql tool calls in the rakefile [elvstone]
+
+* Fixed problem with running "ruby public/dispatch.servlet" instead of "cd public; ruby dispatch.servlet" [alexey]
+
+* Fixed WEBrick server so that it no longer hardcodes the ruby interpreter used to "ruby" but will get the one used based
+ on the Ruby runtime configuration. [Marcel Molina Jr.]
+
+* Fixed Dispatcher so it'll route requests to magic_beans to MagicBeansController/magic_beans_controller.rb [Caio Chassot]
+
+* "new_controller MagicBeans" and "new_model SubscriptionPayments" will now both behave properly as they use the new Inflector.
+
+* Fixed problem with MySQL foreign key constraint checks in Rake :clone_production_structure_to_test target [Andreas Schwarz]
+
+* Changed WEBrick server to by default be auto-reloading, which is slower but makes source changes instant.
+ Class compilation cache can be turned on with "-c" or "--cache-classes".
+
+* Added "-b/--binding" option to WEBrick dispatcher to bind the server to a specific IP address (default: 127.0.0.1) [Kevin Temp]
+
+* dispatch.fcgi now DOESN'T set FCGI_PURE_RUBY as it was slowing things down for now reason [Andreas Schwarz]
+
+* Added new_mailer generator to work with Action Mailer
+
+* Included new framework: Action Mailer 0.3
+
+* Upgraded to Action Pack 0.9.0
+
+* Upgraded to Active Record 1.0.0
+
+
+*0.7.0*
+
+* Added an optional second argument to the new_model script that allows the programmer to specify the table name,
+ which will used to generate a custom table_name method in the model and will also be used in the creation of fixtures.
+ [Kevin Radloff]
+
+* script/new_model now turns AccountHolder into account_holder instead of accountholder [Kevin Radloff]
+
+* Fixed the faulty handleing of static files with WEBrick [Andreas Schwarz]
+
+* Unified function_test_helper and unit_test_helper into test_helper
+
+* Fixed bug with the automated production => test database dropping on PostgreSQL [dhawkins]
+
+* create_fixtures in both the functional and unit test helper now turns off the log during fixture generation
+ and can generate more than one fixture at a time. Which makes it possible for assignments like:
+
+ @people, @projects, @project_access, @companies, @accounts =
+ create_fixtures "people", "projects", "project_access", "companies", "accounts"
+
+* Upgraded to Action Pack 0.8.5 (locally-scoped variables, partials, advanced send_file)
+
+* Upgraded to Active Record 0.9.5 (better table_name guessing, cloning, find_all_in_collection)
+
+
+*0.6.5*
+
+* No longer specifies a template for rdoc, so it'll use whatever is default (you can change it in the rakefile)
+
+* The new_model generator will now use the same rules for plural wordings as Active Record
+ (so Category will give categories, not categorys) [Kevin Radloff]
+
+* dispatch.fcgi now sets FCGI_PURE_RUBY to true to ensure that it's the Ruby version that's loaded [danp]
+
+* Made the GEM work with Windows
+
+* Fixed bug where mod_ruby would "forget" the load paths added when switching between controllers
+
+* PostgreSQL are now supported for the automated production => test database dropping [Kevin Radloff]
+
+* Errors thrown by the dispatcher are now properly handled in FCGI.
+
+* Upgraded to Action Pack 0.8.0 (lots and lots and lots of fixes)
+
+* Upgraded to Active Record 0.9.4 (a bunch of fixes)
+
+
+*0.6.0*
+
+* Added AbstractionApplicationController as a superclass for all controllers generated. This class can be used
+ to carry filters and methods that are to be shared by all. It has an accompanying ApplicationHelper that all
+ controllers will also automatically have available.
+
+* Added environments that can be included from any script to get the full Active Record and Action Controller
+ context running. This can be used by maintenance scripts or to interact with the model through IRB. Example:
+
+ require 'config/environments/production'
+
+ for account in Account.find_all
+ account.recalculate_interests
+ end
+
+ A short migration script for an account model that had it's interest calculation strategy changed.
+
+* Accessing the index of a controller with "/weblog" will now redirect to "/weblog/" (only on Apache, not WEBrick)
+
+* Simplified the default Apache config so even remote requests are served off CGI as a default.
+ You'll now have to do something specific to activate mod_ruby and FCGI (like using the force urls).
+ This should make it easier for new comers that start on an external server.
+
+* Added more of the necessary Apache options to .htaccess to make it easier to setup
+
+* Upgraded to Action Pack 0.7.9 (lots of fixes)
+
+* Upgraded to Active Record 0.9.3 (lots of fixes)
+
+
+*0.5.7*
+
+* Fixed bug in the WEBrick dispatcher that prevented it from getting parameters from the URL
+ (through GET requests or otherwise)
+
+* Added lib in root as a place to store app specific libraries
+
+* Added lib and vendor to load_path, so anything store within can be loaded directly.
+ Hence lib/redcloth.rb can be loaded with require "redcloth"
+
+* Upgraded to Action Pack 0.7.8 (lots of fixes)
+
+* Upgraded to Active Record 0.9.2 (minor upgrade)
+
+
+*0.5.6*
+
+* Upgraded to Action Pack 0.7.7 (multipart form fix)
+
+* Updated the generated template stubs to valid XHTML files
+
+* Ensure that controllers generated are capitalized, so "new_controller TodoLists"
+ gives the same as "new_controller Todolists" and "new_controller todolists".
+
+
+*0.5.5*
+
+* Works on Windows out of the box! (Dropped symlinks)
+
+* Added webrick dispatcher: Try "ruby public/dispatch.servlet --help" [Florian Gross]
+
+* Report errors about initialization to browser (instead of attempting to use uninitialized logger)
+
+* Upgraded to Action Pack 0.7.6
+
+* Upgraded to Active Record 0.9.1
+
+* Added distinct 500.html instead of reusing 404.html
+
+* Added MIT license
+
+
+*0.5.0*
+
+* First public release
diff --git a/MIT-LICENSE b/MIT-LICENSE
new file mode 100644
index 0000000..67625d0
--- /dev/null
+++ b/MIT-LICENSE
@@ -0,0 +1,23 @@
+Copyright (c) 2005, 2006 VibrantPlanet Ltd.
+Copyright (c) 2005, 2006 Luben Manolov
+Copyright (c) 2005, 2006 Nick Penkov
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/README b/README
new file mode 100644
index 0000000..8e41e2b
--- /dev/null
+++ b/README
@@ -0,0 +1,26 @@
+
+Installation Guide
+Requirements
+
+ * Ruby 1.8.2 or higher
+ * Rails 0.14.2
+ * MySQL or PostgreSQL with Ruby bindings
+ * Ruby-GetText? 0.8.0 or higher (http://ponx.s5.xrea.com/hiki/ruby-gettext.html)
+
+Installation
+
+ 1. Checkout the source code
+ 2. Create database called mailr. Create the database schema using db/schema.mysql.sql or db/schema.pgsql.sql
+ 3. Change the config/database.yml to reflect your newly created database configuration
+ 4. If you need to override some of the default constants used in the application take a look at config/default_site.rb. Then create config/site.rb that contains only the keys which you want to override. Example content of config/site.rb is:
+
+ module CDF
+
+ LOCALCONFIG = {
+ :imap_server => 'your.imap.server'
+ }
+ end
+
+
+ 5. Start your web server and login in the application with your IMAP user and password.
+
diff --git a/README_LOCALIZE b/README_LOCALIZE
new file mode 100644
index 0000000..9a75d75
--- /dev/null
+++ b/README_LOCALIZE
@@ -0,0 +1,27 @@
+Here we will describe how to make translations for Mailr
+
+1. Supose we will translate Mailr in French
+2. In locale directory create subirectory fr_FR
+3. In newly created directory fr_FR create subdirectory LC_MESSAGES
+
+result:
+ |
+ |_ locale
+ |
+ |- bg_BG
+ |
+ |- fr_FR
+ |
+ |- LC_MESSAGES
+4. Run script for extracting strings from rails application to po files
+
+script/localize
+
+5. Run PoEdit (http://poedit.sourceforge.net/)
+
+6. Make translations to your newlly created file (locale/fr_FR/LC_MESSAGES/messages.po)
+
+7. Compile po file to mo file using PoEdit
+
+
+NOTE: Switching of locales is made in ApplicationController localize filter - by default mailr looks for HTTP_ACCEPT_LANGUAGE of remote browser and switches translation
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..cffd19f
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,10 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/switchtower.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'
\ No newline at end of file
diff --git a/app/controllers/application.rb b/app/controllers/application.rb
new file mode 100644
index 0000000..f628e5b
--- /dev/null
+++ b/app/controllers/application.rb
@@ -0,0 +1,170 @@
+# The filters added to this controller will be run for all controllers in the application.
+# Likewise will all the methods added be available for all controllers.
+class ApplicationController < ActionController::Base
+ before_filter :localize
+ before_filter :user_login_filter
+ before_filter :add_scripts
+
+ model :customer
+
+ protected
+ def secure_user?() true end
+ def secure_cust?() false end
+ def additional_scripts() "" end
+ def onload_function() "" end
+
+ private
+ def add_scripts
+ @additional_scripts = additional_scripts()
+ @onload_function = onload_function()
+ end
+
+ def user_login_filter
+ if (secure_user? or secure_cust? )and logged_user.nil?
+ @session["return_to"] = @request.request_uri
+ redirect_to :controller=>"/login", :action => "index"
+ return false
+ end
+ end
+
+ alias login_required user_login_filter
+
+ def logged_user # returns customer id
+ @session['user']
+ end
+
+ def logged_customer
+ @session['user']
+ end
+
+ def localize
+ # We will use instance vars for the locale so we can make use of them in
+ # the templates.
+ @charset = 'utf-8'
+ @headers['Content-Type'] = "text/html; charset=#{@charset}"
+ # Here is a very simplified approach to extract the prefered language
+ # from the request. If all fails, just use 'en_EN' as the default.
+ temp = if @request.env['HTTP_ACCEPT_LANGUAGE'].nil?
+ []
+ else
+ @request.env['HTTP_ACCEPT_LANGUAGE'].split(',').first.split('-') rescue []
+ end
+ language = temp.slice(0)
+ dialect = temp.slice(1)
+ @language = language.nil? ? 'en' : language.downcase # default is en
+ # If there is no dialect use the language code ('en' becomes 'en_EN').
+ @dialect = dialect.nil? ? @language.upcase : dialect
+ # The complete locale string consists of
+ # language_DIALECT (en_EN, en_GB, de_DE, ...)
+ @locale = "#{@language}_#{@dialect.upcase}"
+ @htmllang = @language == @dialect ? @language : "#{@language}-#{@dialect}"
+ # Finally, bind the textdomain to the locale. From now on every used
+ # _('String') will get translated into the right language. (Provided
+ # that we have a corresponding mo file in the right place).
+ bindtextdomain('messages', "#{RAILS_ROOT}/locale", @locale, @charset)
+ end
+
+ public
+
+ def include_tinymce(mode="textareas",elements="")
+ tinymce=''
+ tinymce << '
+
+ '
+ tinymce
+ end
+
+ helper_method :include_tinymce
+
+ def include_simple_tinymce(mode="textareas",elements="")
+ tinymce = ''
+ tinymce << '
+ '
+ tinymce
+ end
+
+ helper_method :include_simple_tinymce
+
+end
diff --git a/app/controllers/login_controller.rb b/app/controllers/login_controller.rb
new file mode 100644
index 0000000..48bcc50
--- /dev/null
+++ b/app/controllers/login_controller.rb
@@ -0,0 +1,67 @@
+require 'ezcrypto'
+class LoginController < ApplicationController
+
+ model :customer
+
+ def index
+ if not(logged_user.nil?)
+ redirect_to :controller =>"webmail", :action=>"index"
+ else
+ @login_user = Customer.new
+ end
+ end
+
+ def authenticate
+ if user = auth(@params['login_user']["email"], @params['login_user']["password"])
+ @session["user"] = user.id
+ if CDF::CONFIG[:crypt_session_pass]
+ @session["wmp"] = EzCrypto::Key.encrypt_with_password(CDF::CONFIG[:encryption_password], CDF::CONFIG[:encryption_salt], @params['login_user']["password"])
+ else
+ # dont use crypt
+ @session["wmp"] = @params['login_user']["password"]
+ end
+ if @session["return_to"]
+ redirect_to_path(@session["return_to"])
+ @session["return_to"] = nil
+ else
+ redirect_to :action=>"index"
+ end
+ else
+ @login_user = Customer.new
+ flash["error"] = _('Wrong email or password specified.')
+ redirect_to :action => "index"
+ end
+ end
+
+ def logout
+ reset_session
+ flash["status"] = _('User successfully logged out')
+ redirect_to :action => "index"
+ end
+
+ protected
+
+ def need_subdomain?() true end
+ def secure_user?() false end
+
+ private
+
+ def auth(email, password)
+ mailbox = IMAPMailbox.new
+ begin
+ mailbox.connect(email, password)
+ rescue
+ return nil
+ end
+ mailbox.disconnect
+ mailbox = nil
+ if user = Customer.find_by_email(email)
+ return user
+ else
+ # create record in database
+ user = Customer.create("email"=>email)
+ MailPref.create('customer_id' => user.id)
+ return user
+ end
+ end
+end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
new file mode 100644
index 0000000..fac9c0d
--- /dev/null
+++ b/app/helpers/application_helper.rb
@@ -0,0 +1,137 @@
+# The methods added to this helper will be available to all templates in the application.
+module ApplicationHelper
+
+ protected
+
+ def format_datetime(datetime)
+ datetime.strftime "%d.%m.%Y %H:%M"
+ end
+
+ def errors_base(form_name)
+ errors = instance_variable_get("@#{form_name}").errors.on_base()
+ errors_out = ""
+ if errors
+ errors = [errors] unless errors.is_a? Array
+ errors.each do |e|
+ errors_out << "#{e}"
+ end
+ end
+ errors_out
+ end
+
+ # Useful abstraction for form input fields - combines an input field with error message (if any)
+ # and writes an appropriate style (for errors)
+ # Usage:
+ # form_input :text_field, 'postform', 'subject'
+ # form_input :text_area, 'postform', 'text', 'Please enter text:', 'cols' => 80
+ # form_input :hidden_field, 'postform', 'topic_id'
+ def form_input(helper_method, form_name, field_name, prompt = field_name.capitalize, options = {})
+ case helper_method.to_s
+ when 'hidden_field'
+ self.hidden_field(form_name, field_name)
+ when /^.*button$/
+ <<-EOL
+
+ EOL
+ end
+ end
+ end
+
+ # Helper method that has the same signature as real input field helpers, but simply displays
+ # the value of a given field enclosed within
tags.
+ # Usage:
+ # <%= form_input :read_only_field, 'new_user', 'name', _('user_name')) %>
+ def read_only_field(form_name, field_name, html_options)
+ "#{instance_variable_get('@' + form_name)[field_name]}"
+ end
+
+ def submit_button(form_name, prompt, html_options)
+ %{}
+ end
+
+ # Converts a hash to XML attributes string. E.g.:
+ # to_attributes('a' => 'aaa', 'b' => 1)
+ # => 'a="aaa" b="1" '
+ def attributes(hash)
+ hash.keys.inject("") { |attrs, key| attrs + %{#{key}="#{hash[key]}" } }
+ end
+
+ def initListClass
+ @itClass = 1
+ end
+
+ def popListClass
+ ret = getListClass
+ @itClass = @itClass + 1
+ return ret
+ end
+
+ def getListClass
+ return "even" if @itClass%2 == 0
+ return "odd" if @itClass%2 == 1
+ end
+
+ def get_meta_info
+ ''
+ ''
+ ''
+ ''
+ ''
+ end
+
+ def user
+ @user = Customer.find(@session["user"]) if @user.nil?
+ @user
+ end
+
+ def link_main
+ link_to(_('Contacts'), :controller => '/contacts/contact', :action => 'list')
+ end
+
+ def alternator
+ if @alternator.nil?
+ @alternator = 1
+ end
+
+ @alternator = -@alternator
+
+ if @alternator == -1
+ return "even"
+ else
+ return "odd"
+ end
+ end
+
+end
diff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rb
new file mode 100644
index 0000000..6314096
--- /dev/null
+++ b/app/helpers/pagination_helper.rb
@@ -0,0 +1,487 @@
+# == Pagination Helper
+#
+# === Action Pack pagination for Active Record collections
+#
+# Sam Stephenson
+#
+# Pagination Helper aids in the process of paging large collections of Active
+# Record objects. It offers macro-style automatic fetching of your model for
+# multiple views, or explicit fetching for single actions. And if the magic
+# isn't flexible enough for your needs, you can create your own paginators
+# with a minimal amount of code.
+#
+# Unlike most helpers, Pagination Helper is available to all of Action Pack:
+# it helps you query your models with Action Controller and render links in
+# Action View.
+#
+# ----
+#
+# === Controller examples
+#
+# Pagination Helper can handle as much or as little as you wish. In the
+# controller, have it automatically query your model for pagination; or,
+# if you prefer, create Paginator objects yourself.
+#
+# ==== Automatic pagination for every action in a controller
+#
+# class PersonController < ApplicationController
+# helper :pagination
+# model :person
+#
+# paginate :people, :order_by => 'last_name, first_name',
+# :per_page => 20
+#
+# # ...
+# end
+#
+# Each action in this controller now has access to a @people instance
+# variable, which is an ordered collection of model objects for the current
+# page (at most 20, sorted by last name and first name), and a
+# @person_pages Paginator instance. The current page is determined by
+# the @params['page'] variable.
+#
+# ==== Pagination for a single action
+#
+# def list
+# @person_pages, @people =
+# paginate :people, :order_by => 'last_name, first_name'
+# end
+#
+# Like the previous example, but explicitly creates @person_pages and
+# @people for a single action, and uses the default of 10 items per
+# page.
+#
+# ==== Custom/"classic" pagination
+#
+# def list
+# @person_pages = Paginator.new self, Person.count, 10, @params['page']
+# @people = Person.find_all nil, 'last_name, first_name',
+# @person_pages.current.to_sql
+# end
+#
+# Explicitly creates the paginator from the previous example and uses
+# Paginator#to_sql to retrieve @people from the model.
+#
+# === View examples
+#
+# Paginator Helper includes various methods to help you display pagination
+# links in your views. (For information on displaying the paginated
+# collections you retrieve in the controller, see the documentation for
+# ActionView::Partials#render_collection_of_partials.)
+#
+# ==== Using Paginator#basic_html
+#
+# Use the +basic_html+ method to get a simple list of pages (always including
+# the first and last page) with a window around the current page. In your
+# view, using one of the controller examples above,
+#
+# <%= @person_pages.basic_html(self) %>
+#
+# will render a list of links. For a list of parameters, see the documentation
+# for Page#basic_html.
+#
+# ==== Using a paginator partial
+#
+# If you need more advanced control over pagination links and need to paginate
+# multiple actions and controllers, consider using a shared paginator partial.
+# For instance, _why suggests this partial, which you might place in
+# app/views/partial/_paginator.rhtml:
+#
+#
+#
+# Then in your views, simply call
+#
+# <%= render_partial "partial/paginator", @person_pages %>
+#
+# wherever you want your pagination links to appear.
+#
+# ----
+#
+# ==== Thanks
+#
+# Thanks to the following people for their contributions to Pagination Helper:
+# * Marcel Molina Jr (noradio), who provided the idea for and original
+# implementation of Paginator::Window, as well as endless mental support.
+# * evl, who pointed out that Page#link_to should take and merge in a hash of
+# additional parameters.
+# * why the lucky stiff, who wrote a lovely article on the original Pagination
+# Helper alongside the first implementation of Paginator#base_html, created
+# Page#first_item and Page#last_item, and who provided inspiration for
+# revising Pagination Helper to make it more "Rails-ish."
+# * xal, who saw the limitations of having only the macro-style paginate
+# method and suggested the single-action version, and who also suggested the
+# automatic inclusion into ActionController::Base.
+# * jbd for feedback and debugging help.
+# * ##rubyonrails on Freenode and the Rails mailing list.
+#
+module PaginationHelper
+ # A hash holding options for controllers using macro-style pagination
+ OPTIONS = Hash.new
+
+ # The default options for pagination
+ DEFAULT_OPTIONS = {
+ :class_name => nil,
+ :per_page => 10,
+ :parameter => 'page',
+ :conditions => nil,
+ :order_by => nil
+ }
+
+ def self.included(base) #:nodoc:
+ super
+ base.extend(ClassMethods)
+ end
+
+ def self.validate_options!(collection_id, options, in_action) #:nodoc:
+ options.merge!(DEFAULT_OPTIONS) {|key, old, new| old}
+
+ valid_options = [:class_name, :per_page,
+ :parameter, :conditions, :order_by]
+ valid_options << :actions unless in_action
+
+ unknown_option_keys = options.keys - valid_options
+ raise ActionController::ActionControllerError,
+ "Unknown options: #{unknown_option_keys.join(', ')}" unless
+ unknown_option_keys.empty?
+
+ options[:singular_name] = Inflector.singularize(collection_id.to_s)
+ options[:class_name] ||= Inflector.camelize(options[:singular_name])
+ end
+
+ # Returns a paginator and a collection of Active Record model instances for
+ # the paginator's current page. This is designed to be used in a single
+ # action; to automatically paginate multiple actions, consider
+ # ClassMethods#paginate.
+ #
+ # +options+ are:
+ # :class_name:: the class name to use, if it can't be inferred by
+ # singularizing the collection name.
+ # :per_page:: the maximum number of items to include in a
+ # single page. Defaults to 10.
+ # :parameter:: the CGI parameter from which the current page is
+ # determined. Defaults to 'page'; i.e., the current
+ # page is specified by @params['page'].
+ # :conditions:: optional conditions passed to Model.find_all.
+ # :order_by:: optional order parameter passed to Model.find_all
+ # and Model.count.
+ def paginate(collection_id, options={})
+ PaginationHelper.validate_options!(collection_id, options, true)
+ paginator_and_collection_for(collection_id, options)
+ end
+
+ # These methods become class methods on any controller which includes
+ # PaginationHelper.
+ module ClassMethods
+ # Creates a +before_filter+ which automatically paginates an Active Record
+ # model for all actions in a controller (or certain actions if specified
+ # with the :actions option).
+ #
+ # +options+ are the same as PaginationHelper#paginate, with the addition
+ # of:
+ # :actions:: an array of actions for which the pagination is
+ # active. Defaults to +nil+ (i.e., every action).
+ def paginate(collection_id, options={})
+ PaginationHelper.validate_options!(collection_id, options, false)
+ module_eval do
+ before_filter :create_paginators_and_retrieve_collections
+ OPTIONS[self] ||= Hash.new
+ OPTIONS[self][collection_id] = options
+ end
+ end
+ end
+
+ def create_paginators_and_retrieve_collections #:nodoc:
+ PaginationHelper::OPTIONS[self.class].each do |collection_id, options|
+ next unless options[:actions].include? action_name if options[:actions]
+
+ paginator, collection =
+ paginator_and_collection_for(collection_id, options)
+
+ paginator_name = "@#{options[:singular_name]}_pages"
+ self.instance_variable_set(paginator_name, paginator)
+
+ collection_name = "@#{collection_id.to_s}"
+ self.instance_variable_set(collection_name, collection)
+ end
+ end
+
+ # Returns the total number of items in the collection to be paginated for
+ # the +model+ and given +conditions+. Override this method to implement a
+ # custom counter.
+ def count_collection_for_pagination(model, conditions)
+ model.count(conditions)
+ end
+
+ # Returns a collection of items for the given +model+ and +conditions+,
+ # ordered by +order_by+, for the current page in the given +paginator+.
+ # Override this method to implement a custom finder.
+ def find_collection_for_pagination(model, conditions, order_by, paginator)
+ model.find_all(conditions, order_by, paginator.current.to_sql)
+ end
+
+ protected :create_paginators_and_retrieve_collections,
+ :count_collection_for_pagination, :find_collection_for_pagination
+
+ def paginator_and_collection_for(collection_id, options) #:nodoc:
+ klass = eval options[:class_name]
+ page = @params[options[:parameter]]
+ count = count_collection_for_pagination(klass, options[:conditions])
+
+ paginator = Paginator.new(self, count,
+ options[:per_page], page, options[:parameter])
+
+ collection = find_collection_for_pagination(klass,
+ options[:conditions], options[:order_by], paginator)
+
+ return paginator, collection
+ end
+
+ private :paginator_and_collection_for
+
+ # A class representing a paginator for an Active Record collection.
+ class Paginator
+ include Enumerable
+
+ # Creates a new Paginator on the given +controller+ for a set of items of
+ # size +item_count+ and having +items_per_page+ items per page. Raises
+ # ArgumentError if items_per_page is out of bounds (i.e., less than or
+ # equal to zero). The page CGI parameter for links defaults to "page" and
+ # can be overridden with +page_parameter+.
+ def initialize(controller, item_count, items_per_page, current_page=1,
+ page_parameter='page')
+ raise ArgumentError, 'must have at least one item per page' if
+ items_per_page <= 0
+
+ @controller = controller
+ @item_count = item_count || 0
+ @items_per_page = items_per_page
+ @page_parameter = page_parameter
+
+ self.current_page = current_page
+ end
+ attr_reader :controller, :item_count, :items_per_page, :page_parameter
+
+ # Sets the current page number of this paginator. If +page+ is a Page
+ # object, its +number+ attribute is used as the value; if the page does
+ # not belong to this Paginator, an ArgumentError is raised.
+ def current_page=(page)
+ if page.is_a? Page
+ raise ArgumentError, 'Page/Paginator mismatch' unless
+ page.paginator == self
+ end
+ page = page.to_i
+ @current_page = has_page_number?(page) ? page : 1
+ end
+
+ # Returns a Page object representing this paginator's current page.
+ def current_page
+ self[@current_page]
+ end
+ alias current :current_page
+
+ # Returns a new Page representing the first page in this paginator.
+ def first_page
+ self[1]
+ end
+ alias first :first_page
+
+ # Returns a new Page representing the last page in this paginator.
+ def last_page
+ self[page_count]
+ end
+ alias last :last_page
+
+ # Returns the number of pages in this paginator.
+ def page_count
+ return 1 if @item_count.zero?
+ (@item_count / @items_per_page.to_f).ceil
+ end
+ alias length :page_count
+
+ # Returns true if this paginator contains the page of index +number+.
+ def has_page_number?(number)
+ return false unless number.is_a? Fixnum
+ number >= 1 and number <= page_count
+ end
+
+ # Returns a new Page representing the page with the given index +number+.
+ def [](number)
+ Page.new(self, number)
+ end
+
+ # Successively yields all the paginator's pages to the given block.
+ def each(&block)
+ page_count.times do |n|
+ yield self[n+1]
+ end
+ end
+
+ # Creates a basic HTML link bar for the given +view+. The first and last
+ # pages of the paginator are always shown, along with +window_size+ pages
+ # around the current page. By default, the current page is displayed, but
+ # not linked; to change this behavior, pass true to the
+ # +link_to_current_page+ argument. Specify additional link_to parameters
+ # with +params+.
+ def basic_html(view, window_size=2, link_to_current_page=false, params={})
+ window_pages = current.window(window_size).pages
+ return if window_pages.length <= 1 unless link_to_current_page
+
+ html = ''
+ unless window_pages[0].first?
+ html << view.link_to(first.number, first.to_link(params))
+ html << ' ... ' if window_pages[0].number - first.number > 1
+ html << ' '
+ end
+
+ window_pages.each do |page|
+ if current == page and not link_to_current_page
+ html << page.number.to_s
+ else
+ html << view.link_to(page.number, page.to_link(params))
+ end
+ html << ' '
+ end
+
+ unless window_pages.last.last?
+ html << ' ... ' if last.number - window_pages[-1].number > 1
+ html << view.link_to(last.number, last.to_link(params))
+ end
+
+ html
+ end
+
+ # A class representing a single page in a paginator.
+ class Page
+ include Comparable
+
+ # Creates a new Page for the given +paginator+ with the index +number+.
+ # If +number+ is not in the range of valid page numbers or is not a
+ # number at all, it defaults to 1.
+ def initialize(paginator, number)
+ @paginator = paginator
+ @number = number.to_i
+ @number = 1 unless @paginator.has_page_number? @number
+ end
+ attr_reader :paginator, :number
+ alias to_i :number
+
+ # Compares two Page objects and returns true when they represent the
+ # same page (i.e., their paginators are the same and they have the same
+ # page number).
+ def ==(page)
+ @paginator == page.paginator and
+ @number == page.number
+ end
+
+ # Compares two Page objects and returns -1 if the left-hand page comes
+ # before the right-hand page, 0 if the pages are equal, and 1 if the
+ # left-hand page comes after the right-hand page. Raises ArgumentError
+ # if the pages do not belong to the same Paginator object.
+ def <=>(page)
+ raise ArgumentError unless @paginator == page.paginator
+ @number <=> page.number
+ end
+
+ # Returns the item offset for the first item in this page.
+ def offset
+ @paginator.items_per_page * (@number - 1)
+ end
+
+ # Returns the number of the first item displayed.
+ def first_item
+ offset + 1
+ end
+
+ # Returns the number of the last item displayed.
+ def last_item
+ [@paginator.items_per_page * @number, @paginator.item_count].min
+ end
+
+ # Returns true if this page is the first page in the paginator.
+ def first?
+ self == @paginator.first
+ end
+
+ # Returns true if this page is the last page in the paginator.
+ def last?
+ self == @paginator.last
+ end
+
+ # Returns a new Page object representing the page just before this page,
+ # or nil if this is the first page.
+ def previous
+ if first? then nil else Page.new(@paginator, @number - 1) end
+ end
+
+ # Returns a new Page object representing the page just after this page,
+ # or nil if this is the last page.
+ def next
+ if last? then nil else Page.new(@paginator, @number + 1) end
+ end
+
+ # Returns a new Window object for this page with the specified
+ # +padding+.
+ def window(padding=2)
+ Window.new(self, padding)
+ end
+
+ # Returns a hash appropriate for using with link_to or url_for. Takes an
+ # optional +params+ hash for specifying additional link parameters.
+ def to_link(params={})
+ {:params => {@paginator.page_parameter => @number.to_s}.merge(params)}
+ end
+
+ # Returns the SQL "LIMIT ... OFFSET" clause for this page.
+ def to_sql
+ ['? OFFSET ?', @paginator.items_per_page, offset]
+ end
+ end
+
+ # A class for representing ranges around a given page.
+ class Window
+ # Creates a new Window object for the given +page+ with the specified
+ # +padding+.
+ def initialize(page, padding=2)
+ @paginator = page.paginator
+ @page = page
+ self.padding = padding
+ end
+ attr_reader :paginator, :page
+
+ # Sets the window's padding (the number of pages on either side of the
+ # window page).
+ def padding=(padding)
+ @padding = padding < 0 ? 0 : padding
+ # Find the beginning and end pages of the window
+ @first = @paginator.has_page_number?(@page.number - @padding) ?
+ @paginator[@page.number - @padding] : @paginator.first
+ @last = @paginator.has_page_number?(@page.number + @padding) ?
+ @paginator[@page.number + @padding] : @paginator.last
+ end
+ attr_reader :padding, :first, :last
+
+ # Returns an array of Page objects in the current window.
+ def pages
+ (@first.number..@last.number).to_a.map {|n| @paginator[n]}
+ end
+ alias to_a :pages
+ end
+ end
+end
+
+module ActionController #:nodoc:
+ class Base #:nodoc:
+ # Automatically include PaginationHelper.
+ include PaginationHelper
+ end
+end
diff --git a/app/views/layouts/chooser.rhtml b/app/views/layouts/chooser.rhtml
new file mode 100644
index 0000000..ffe7b25
--- /dev/null
+++ b/app/views/layouts/chooser.rhtml
@@ -0,0 +1,18 @@
+
+
+
+<%=@title%>
+
+
+
+
+
+<%=@additional_scripts%>
+
+
+<%= @content_for_layout %>
+
+
+
+
diff --git a/app/views/layouts/public.rhtml b/app/views/layouts/public.rhtml
new file mode 100644
index 0000000..a7bf860
--- /dev/null
+++ b/app/views/layouts/public.rhtml
@@ -0,0 +1,25 @@
+
+
+
+ <%=_('Mailr')%>
+
+
+
+
+
+
+ <%=(@content_for_scripts ? @content_for_scripts : @additional_scripts )%>
+
+
+
+
+ <% for group in @contactgroups %>
+
+ <% end %>
+ <% if not(@contactgroups.empty?) %>
+ <%=_('Contact belong to these groups')%>:
+
+
+ <%
+ end
+ col = 1
+ for group in @contactgroups %>
+
+ >
+ <%=group.name %>
+
+ <% if col%2 == 0 %>
+
+
+ <% end
+ col = col + 1 %>
+ <% end %>
+ <% if col%2 == 0 and not(@contactgroups.empty?) %>
+
+ <% end %>
+ <% if not(@contactgroups.empty?) %>
+
+
+ <% end %>
+
+
+
+
+
+
+
+
+
+ <%= end_form_tag %>
+
+
diff --git a/components/contacts/contact/add_multiple.rhtml b/components/contacts/contact/add_multiple.rhtml
new file mode 100644
index 0000000..4bfcf3c
--- /dev/null
+++ b/components/contacts/contact/add_multiple.rhtml
@@ -0,0 +1,26 @@
+
<%=_('Add multiple contacts')%>
+<% if @flash["errors"] and not @flash["errors"].empty?%>
+ <%= _('Errors')%>
+
+ <% @flash["errors"].each do |message| %>
+
<%= message %>
+ <% end %>
+
+<% end %>
+
\ No newline at end of file
diff --git a/components/contacts/contact/choose.rhtml b/components/contacts/contact/choose.rhtml
new file mode 100644
index 0000000..65fb2ac
--- /dev/null
+++ b/components/contacts/contact/choose.rhtml
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/components/contacts/contact/import_preview.rhtml b/components/contacts/contact/import_preview.rhtml
new file mode 100644
index 0000000..3077b94
--- /dev/null
+++ b/components/contacts/contact/import_preview.rhtml
@@ -0,0 +1,43 @@
+
<%= _('Contacts You Are About To Import')%>
+
+<% if @flash["errors"] and not @flash["errors"].empty?%>
+ <%= _('Errors')%>
+
+ <% @flash["errors"].each do |message| %>
+
<%= message %>
+ <% end %>
+
+<% end %>
+
+
diff --git a/components/contacts/contact/list.rhtml b/components/contacts/contact/list.rhtml
new file mode 100644
index 0000000..4fe98d8
--- /dev/null
+++ b/components/contacts/contact/list.rhtml
@@ -0,0 +1,114 @@
+
<%= _('Contacts')%>
+
+
+
<%=link_folders%>
+
<%=link_send_mail%>
+
<%=link_mail_prefs%>
+
<%=link_mail_filters%>
+
<%= _('Contacts') %>
+
+
<%=link_contact_add_one%>
+
<%=link_contact_add_multiple%>
+ <% if ret = @session["return_to"] %>
+
<%=link_to(_('Back to message'), ret) %>
+ <% end %>
+
+
+
+
+
+
+
+
+ <% if @flash["alert"] %>
<%= @flash["alert"] %>
<% end %>
+
+
+
diff --git a/components/contacts/contact_controller.rb b/components/contacts/contact_controller.rb
new file mode 100644
index 0000000..88e3129
--- /dev/null
+++ b/components/contacts/contact_controller.rb
@@ -0,0 +1,398 @@
+class Contacts::ContactController < ApplicationController
+
+ uses_component_template_root
+
+ model :customer
+ model :contact
+ model :contact_group
+ helper :pagination
+ layout :select_layout
+
+ def index
+ redirect_to(:action =>"list")
+ end
+
+ def list
+ @contact_pages = Paginator.new(self, Contact.count("customer_id = #{logged_user}"), CDF::CONFIG[:contacts_per_page], @params['page'])
+ @contacts = Contact.find(:all, :conditions=>["customer_id = #{logged_user}"], :order=>['fname'], :limit=>CDF::CONFIG[:contacts_per_page], :offset=>@contact_pages.current.offset)
+
+ if @params["mode"] == "groups"
+ if @params["id"] and not @params["id"].nil? and not @params["id"] == ''
+ @group_id = @params["id"].to_i
+ @contacts_for_group = Hash.new
+ for contact in @contacts
+ @contacts_for_group[contact.id] = 0 # initialize
+ for gr in contact.groups
+ if gr.contact_group_id.to_i == @group_id
+ @contacts_for_group[contact.id] = 1 # checked
+ end
+ end
+ end
+ end
+ end
+ end
+
+ def listLetter
+ letters = CDF::CONFIG[:contact_letters]
+ @contact_pages = Paginator.new(self, Contact.count(
+ ["customer_id = %s and substr(UPPER(fname),1,1) = '%s'", logged_user, letters[@params['id'].to_i]]), CDF::CONFIG[:contacts_per_page], @params['page'])
+ @contacts = Contact.find(:all, :conditions=>["customer_id = %s and substr(UPPER(fname),1,1) = '%s'", logged_user, letters[@params['id'].to_i]],
+ :order=>['fname'], :limit=>CDF::CONFIG[:contacts_per_page], :offset=>@contact_pages.current.offset)
+
+ if @params["mode"] == "groups"
+ if @params["group_id"] and not @params["group_id"].nil? and not @params["group_id"] == ''
+ @group_id = @params["group_id"].to_i
+ @contacts_for_group = Hash.new
+ for contact in @contacts
+ @contacts_for_group[contact.id] = 0 # initialize
+ for gr in contact.groups
+ if gr.contact_group_id.to_i == @group_id
+ @contacts_for_group[contact.id] = 1 # checked
+ end
+ end
+ end
+ end
+ end
+
+ render :action => "list"
+ end
+
+ def add
+ @contact = Contact.new
+ @contact.customer_id = logged_user
+
+ # load related lists
+ loadLists
+
+ # Init groups: because of checkbox
+ # Set all to 0 => unchecked
+ @groups = Hash.new
+ @contactgroups.each {|g|
+ @groups[g.id] = 0
+ }
+ end
+
+ def add_multiple
+ @contact = Contact.new
+ @contact["file_type"] = "1"
+ end
+
+ def add_from_mail
+ cstr = @params['cstr']
+ retmsg = @params['retmsg']
+ @session["return_to"] = url_for(:controller=>'/webmail/webmail',
+ :action=>'folders',
+ :msg_id=>retmsg)
+ # parse string
+ if i = cstr.index("<")
+ name, email = cstr.slice(0, i), cstr.slice((i+1)..(cstr.strip().index(">")-1))
+ fname = name.split().first
+ lname = name.split().last if name.split().size() > 1
+ else
+ fname, lname, email = "", "", cstr
+ end
+
+ if @contact = Contact.find_by_user_email(logged_user, email)
+ # load related lists
+ loadLists
+
+ @contact.fname, @contact.lname = fname, lname
+
+ # groups = @contact.groups
+ @groups = Hash.new
+ @contactgroups.each {|g|
+ groupSelected = false
+ @contact.groups.each {|gr|
+ if gr.contact_group_id.to_i == g.id.to_i
+ groupSelected = true
+ break
+ end
+ }
+ if groupSelected
+ @groups[g.id] = 1 # checked
+ else
+ @groups[g.id] = 0 # unchecked
+ end
+ }
+ else
+ @contact = Contact.new("fname"=>fname, "lname" => lname, "email" => email)
+ @contact.customer_id = logged_user
+
+ # load related lists
+ loadLists
+
+ # Init groups: because of checkbox
+ # Set all to 0 => unchecked
+ @groups = Hash.new
+ @contactgroups.each {|g|
+ @groups[g.id] = 0
+ }
+ end
+ render :action => "add"
+ end
+
+ def import_preview
+ file = @params["contact"]["data"]
+
+ flash["errors"] = Array.new
+
+ if file.size == 0
+ flash["errors"] << _('You haven\'t selected file or the file is empty')
+ @contact = Contact.new
+ @contact["file_type"] = @params["contact"]["file_type"]
+ render :action => "add_multiple"
+ end
+
+ file_type = @params["contact"]["file_type"]
+ if file_type.nil? or file_type == '1'
+ separator = ','
+ else
+ separator = /\t/
+
+ end
+
+ @contacts = Array.new
+ emails = Array.new
+
+ file.each {|line|
+ cdata = line.strip.chomp.split(separator)
+ cont = Contact.new
+ cont.fname = cdata[0].to_s.strip.chomp
+ cont.lname = cdata[1].to_s.strip.chomp
+ cont.email = cdata[2].to_s.strip.chomp
+
+ # Check for duplicate emails in the file
+ if emails.include?(cont.email)
+ flash["errors"] << sprintf(_('Contact %'), file.lineno.to_s) + ": " + _('The e-mail duplicates the e-mail of another record!')
+ else
+ emails << cont.email
+ end
+
+ @contacts << cont
+ }
+
+ end
+
+ def import
+ contacts_count = @params["contact"].length
+ contacts_to_import = @params["contact"]
+ @contacts = Array.new
+ emails = Array.new
+
+ flash["errors"] = Array.new
+
+ for i in 0...contacts_count
+ contact = Contact.new
+ contact.customer_id = logged_user
+ contact.fname = contacts_to_import[i.to_s]["fname"]
+ contact.lname = contacts_to_import[i.to_s]["lname"]
+ contact.email = contacts_to_import[i.to_s]["email"]
+
+ begin
+ # Check for duplicate emails in the submitted data
+ if emails.include?(contact.email)
+ flash["errors"] << sprintf(_('Contact %'), (i+1).to_s) + ": " + _('The e-mail duplicates the e-mail of another record!')
+ else
+ emails << contact.email
+ end
+ # Check if contact is valid
+ contact.valid?
+ rescue CDF::ValidationError => e
+ if not contact.errors.empty?
+ ["fname", "lname", "email"].each do |attr|
+ attr_errors = contact.errors.on(attr)
+ attr_errors = [attr_errors] unless attr_errors.nil? or attr_errors.is_a? Array
+
+ if not attr_errors.nil?
+ attr_errors.each do |msg|
+ flash["errors"] << l(:contact_addmultiple_errorforcontact, (i+1).to_s) + ": " + l(msg)
+ end
+ end
+ end
+ end
+ end # rescue
+
+ @contacts << contact
+ end # for
+
+ # If there are validation errors - display them
+ if not flash["errors"].nil? and not flash["errors"].empty?
+ render :action => "import_preview"
+ else
+ # save
+ begin
+ for contact in @contacts
+ Contact.create(contact.attributes)
+ end
+ # Set message for successful import
+ flash["alert"] = Array.new
+ flash["alert"] << l(:contact_addmultiple_success, @contacts.length.to_s)
+ keep_flash()
+ redirect_to(:action=>"list")
+ rescue Exception => exc
+ flash["errors"] << exc
+ render :action => "import_preview"
+ end
+ end
+ end
+
+
+ def choose
+ if @params["mode"] == "groups"
+ save_groups
+ end
+
+ @tos, @ccs, @bccs = Array.new, Array.new, Array.new
+
+ @params["contacts_to"].each{ |id,value| @tos << Contact.find(id) if value == "1" } if @params["contacts_to"]
+ @params["contacts_cc"].each{ |id,value| @ccs << Contact.find(id) if value == "1" } if @params["contacts_cc"]
+ @params["contacts_bcc"].each{ |id,value| @bccs << Contact.find(id) if value == "1" } if @params["contacts_bcc"]
+
+ @params["groups_to"].each{ |id,value|
+ ContactGroup.find(id).contacts.each {|c| @tos << c} if value == "1" } if @params["groups_to"]
+ @params["groups_cc"].each{ |id,value|
+ ContactGroup.find(id).contacts.each {|c| @ccs << c} if value == "1" } if @params["groups_cc"]
+ @params["groups_bcc"].each{ |id,value|
+ ContactGroup.find(id).contacts.each {|c| @bccs << c} if value == "1" } if @params["groups_bcc"]
+ end
+
+ def save_groups
+ contacts_for_group = @params["contacts_for_group"]
+ group_id = @params["group_id"]
+ contact_group = ContactGroup.find(group_id)
+
+
+ contacts_for_group.each { |contact_id,value|
+ contact = Contact.find(contact_id)
+ if value == "1" and not contact_group.contacts.include?(contact)
+ contact_group.contacts << contact
+ end
+ if value == "0" and contact_group.contacts.include?(contact)
+ contact_group.contacts.delete(contact)
+ end
+ }
+ redirect_to(:action=>"list", :id=>group_id, :params=>{"mode"=>@params["mode"]})
+ end
+
+ def edit
+ @contact = Contact.find(@params["id"])
+ # load related lists
+ loadLists
+
+ # groups = @contact.groups
+ @groups = Hash.new
+ @contactgroups.each {|g|
+ groupSelected = false
+ @contact.groups.each {|gr|
+ if gr.contact_group_id.to_i == g.id.to_i
+ groupSelected = true
+ break
+ end
+ }
+ if groupSelected
+ @groups[g.id] = 1 # checked
+ else
+ @groups[g.id] = 0 # unchecked
+ end
+ }
+ render :action => "add"
+ end
+
+ # Insert or update
+ def save
+ logger.info("BEGIN")
+ if @params["contact"]["id"] == ""
+ # New contact
+ @contact = Contact.create(@params["contact"])
+ else
+ # Edit existing
+ @contact = Contact.find(@params["contact"]["id"])
+ @contact.attributes = @params["contact"]
+ end
+
+ @contactgroups = ContactGroup.find_by_user(logged_user)
+ # Groups displayed
+ groups = @params['groups']
+ tempGroups = Array.new
+ tempGroups.concat(@contact.groups)
+
+ @contactgroups.each { |cgroup|
+ includesCGroup = false
+ tempGroups.each {|gr|
+ if gr.contact_group_id.to_i == cgroup.id.to_i
+ includesCGroup = true
+ break
+ end
+ }
+ if groups["#{cgroup.id}"] == "1" and not includesCGroup
+ @contact.groups << cgroup
+ end
+
+ if groups["#{cgroup.id}"] == "0" and includesCGroup
+ @contact.groups.delete(cgroup)
+ end
+ }
+ if @contact.save
+ if @params["paction"] == _('Save')
+ redirect_to :controller => "/contacts/contact", :action =>"list"
+ else
+ redirect_to :controller => "/contacts/contact", :action =>"add"
+ end
+ else
+ loadLists
+ @groups = Hash.new
+ @contactgroups.each {|g|
+ if @contact.groups.include?(g)
+ @groups[g.id] = 1
+ else
+ @groups[g.id] = 0
+ end
+ }
+ render :action => "add"
+ end
+ end
+
+ def delete
+ Contact.destroy(@params['id'])
+ redirect_to(:action=>'list')
+ end
+
+ protected
+ def secure_user?() true end
+ def additional_scripts()
+ add_s = ''
+ if action_name == "choose"
+ add_s<<''
+ add_s<<''
+ end
+ add_s
+ end
+
+ def onload_function()
+ if action_name == "choose"
+ "javascript:respondToCaller();"
+ else
+ ""
+ end
+ end
+ private
+ def select_layout
+ if @params["mode"] == "choose"
+ @mode = "choose"
+ @contactgroups = ContactGroup.find_by_user(logged_user)
+ 'chooser'
+ elsif @params["mode"] == "groups"
+ @mode = "groups"
+ 'public'
+ else
+ @mode = "normal"
+ 'public'
+ end
+ end
+
+ def loadLists
+ if @contactgroups.nil?
+ @contactgroups = ContactGroup.find_by_user(logged_user)
+ end
+ end
+end
diff --git a/components/contacts/contact_group.rb b/components/contacts/contact_group.rb
new file mode 100644
index 0000000..628d69a
--- /dev/null
+++ b/components/contacts/contact_group.rb
@@ -0,0 +1,25 @@
+class ContactGroup < ActiveRecord::Base
+ has_and_belongs_to_many :contacts, :class_name => "Contact", :join_table => "contact_contact_groups", :association_foreign_key => "contact_id", :foreign_key => "contact_group_id"
+
+ def ContactGroup.find_by_user(user_id)
+ find_by_sql("select * from contact_groups where customer_id = #{user_id} order by name asc")
+ end
+
+ protected
+ def validate
+ errors.add('name', :contactgroup_name_invalid) unless self.name =~ /^.{1,50}$/i
+ end
+
+ def validate_on_create
+ if ContactGroup.find_first(["name = '#{name}' and customer_id = #{user_id}"])
+ errors.add("name", _('Please enter group name (1 to 50 characters)'))
+ end
+ end
+
+ def validate_on_update
+ if ContactGroup.find_first(["name = '#{name}' and customer_id = #{user_id} and id <> #{id}"])
+ errors.add("name", _('You already have contact group with this name'))
+ end
+ end
+
+end
diff --git a/components/contacts/contact_group/edit.rhtml b/components/contacts/contact_group/edit.rhtml
new file mode 100644
index 0000000..16dad94
--- /dev/null
+++ b/components/contacts/contact_group/edit.rhtml
@@ -0,0 +1,24 @@
+
\ No newline at end of file
diff --git a/components/webmail/webmail/_filter.rhtml b/components/webmail/webmail/_filter.rhtml
new file mode 100644
index 0000000..f4fbe10
--- /dev/null
+++ b/components/webmail/webmail/_filter.rhtml
@@ -0,0 +1,19 @@
+
+
<%=h @user.filters[filter_counter].name%>
+
+ <% if filter_counter > 0 %>
+ <%=link_filter_up(@user.filters[filter_counter].id)%>
+ <% else %>
+
+ <% end %>
+
\ No newline at end of file
diff --git a/components/webmail/webmail/_message_row.rhtml b/components/webmail/webmail/_message_row.rhtml
new file mode 100644
index 0000000..e5f003c
--- /dev/null
+++ b/components/webmail/webmail/_message_row.rhtml
@@ -0,0 +1,14 @@
+
+
+ <% if @folder_name == CDF::CONFIG[:mail_sent] %>
+
" }
+ replacements.fetch(tag.downcase, ("<" << tag.downcase << replace_attr(attrs) << ">"))
+end
+
+def replace_attr(attrs)
+ if attrs
+ attrs.downcase.gsub("onload", "onfilter").
+ gsub("onclick", "onfilter").
+ gsub("onkeypress", "onfilter").
+ gsub("javascript", "_javascript").
+ gsub("JavaScript", "_javascript")
+ else
+ ""
+ end
+end
+
+def clear_html(text)
+ attribute_key = /[\w:_-]+/
+ attribute_value = /(?:[A-Za-z0-9\-_#\%\.,\/\:]+|(?:'[^']*?'|"[^"]*?"))/
+ attribute = /(?:#{attribute_key}(?:\s*=\s*#{attribute_value})?)/
+ attributes = /(?:#{attribute}(?:\s+#{attribute})*)/
+ tag_key = attribute_key
+ tag = %r{<([!/?\[]?(?:#{tag_key}|--))((?:\s+#{attributes})?\s*(?:[!/?\]]+|--)?)>}
+ text.gsub(tag, '').gsub(/\s+/, ' ').strip
+ CGI::escape(text)
+end
+
+def strip_html(text)
+ attribute_key = /[\w:_-]+/
+ attribute_value = /(?:[A-Za-z0-9\-_#\%\.,\/\:]+|(?:'[^']*?'|"[^"]*?"))/
+ attribute = /(?:#{attribute_key}(?:\s*=\s*#{attribute_value})?)/
+ attributes = /(?:#{attribute}(?:\s+#{attribute})*)/
+ tag_key = attribute_key
+ tag = %r{<([!/?\[]?(?:#{tag_key}|--))((?:\s+#{attributes})?\s*(?:[!/?\]]+|--)?)>}
+ res = text.gsub(tag) { |match|
+ ret = ""
+ match.scan(tag) { |token|
+ ret << replace_tag(token[0], token[1])
+ }
+ ret
+ }
+ # remove doctype tags
+ xattributes = /(?:#{attribute_value}(?:\s+#{attribute_value})*)/
+ xtag = %r{}
+ res.gsub(xtag, '')
+end
diff --git a/lib/gettext_extension.rb b/lib/gettext_extension.rb
new file mode 100755
index 0000000..a4a35ab
--- /dev/null
+++ b/lib/gettext_extension.rb
@@ -0,0 +1,11 @@
+require 'gettext'
+include GetText # we want to be able to translate everywhere
+
+module GetText
+ # GetText has this behaviour that it saves the binding to the mo file
+ # on a file by file basis. Every ruby file gets its own binding. We have to
+ # override this behaviour because it doesn't make any sense for a web
+ # application. We want one message catalog for all our files.
+ module_function
+ def callersrc; '*' end
+end
diff --git a/lib/tmail_patch.rb b/lib/tmail_patch.rb
new file mode 100644
index 0000000..bb86dd7
--- /dev/null
+++ b/lib/tmail_patch.rb
@@ -0,0 +1,38 @@
+module TMail
+ class Mail
+ def parse_header( f )
+ name = field = nil
+ unixfrom = nil
+
+ while line = f.gets
+ case line
+ when /\A[ \t]/ # continue from prev line
+ raise SyntaxError, 'mail is began by space' unless field
+ field << ' ' << line.strip
+
+ when /\A([^\: \t]+):\s*/ # new header line
+ add_hf name, field if field
+ name = $1
+ field = $' #.strip
+
+ when /\A\-*\s*\z/ # end of header
+ add_hf name, field if field
+ name = field = nil
+ break
+
+ when /\AFrom (\S+)/
+ unixfrom = $1
+ else
+ # treat as continue from previos
+ raise SyntaxError, 'mail is began by space' unless field
+ field << ' ' << line.strip
+ end
+ end
+ add_hf name, field if name
+
+ if unixfrom
+ add_hf 'Return-Path', "<#{unixfrom}>" unless @header['return-path']
+ end
+ end
+ end
+end
diff --git a/locale/.messages.pot b/locale/.messages.pot
new file mode 100644
index 0000000..b1f9059
--- /dev/null
+++ b/locale/.messages.pot
@@ -0,0 +1,466 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2005-04-07 18:17+0300\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: app/controllers/webmail_controller.rb:57 /tmp/erb-gettext18743.0:30
+msgid "Add new folder"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:59 app/helpers/webmail_helper.rb:74 app/helpers/webmail_helper.rb:74
+msgid "(Delete)"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:61
+msgid "(Subscribe)"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:62
+msgid "(Select)"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:79 /tmp/erb-gettext18743.0:23
+msgid "copy"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:83 /tmp/erb-gettext18743.0:24
+msgid "move"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:87 /tmp/erb-gettext18743.0:89 /tmp/erb-gettext18743.0:16
+#: /tmp/erb-gettext18743.0:22
+msgid "delete"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:91 /tmp/erb-gettext18743.0:25
+msgid "mark read"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:98 /tmp/erb-gettext18743.0:26
+msgid "mark unread"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:110 /tmp/erb-gettext18743.0:17 /tmp/erb-gettext18743.0:8
+msgid "Search"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:115 /tmp/erb-gettext18743.0:18 /tmp/erb-gettext18743.0:9
+msgid "Show all"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:143
+msgid "Password changed successfully"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:146
+msgid "Password not changed - please enter correct password."
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:181 /tmp/erb-gettext18743.0:18
+msgid "Send"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:190 app/controllers/webmail_controller.rb:245
+#: /tmp/erb-gettext18743.0:23 /tmp/erb-gettext18743.0:46 /tmp/erb-gettext18743.0:27
+msgid "Add"
+msgstr ""
+
+#: app/controllers/webmail_controller.rb:228 app/controllers/webmail_controller.rb:247
+#: /tmp/erb-gettext18743.0:51 /tmp/erb-gettext18743.0:73 /tmp/erb-gettext18743.0:18
+#: /tmp/erb-gettext18743.0:33 /tmp/erb-gettext18743.0:35
+msgid "Save"
+msgstr ""
+
+#: app/controllers/login_controller.rb:26
+msgid "Wrong email or password specified."
+msgstr ""
+
+#: app/controllers/login_controller.rb:33
+msgid "User successfully logged out"
+msgstr ""
+
+#: app/controllers/contact_controller.rb:135
+msgid "You havent selected file or the file is empty"
+msgstr ""
+
+#: app/controllers/contact_controller.rb:161 app/controllers/contact_controller.rb:189
+msgid "Contact %"
+msgstr ""
+
+#: app/controllers/contact_controller.rb:161 app/controllers/contact_controller.rb:189
+msgid "The e-mail duplicates the e-mail of another record!"
+msgstr ""
+
+#: app/models/contact.rb:47
+msgid "Please enter your first name (2 to 20 characters)."
+msgstr ""
+
+#: app/models/contact.rb:48
+msgid "Please enter your surname (2 to 20 characters)."
+msgstr ""
+
+#: app/models/contact.rb:53
+msgid "Contacts email cannot be changed."
+msgstr ""
+
+#: app/models/contact.rb:59
+msgid "Please enter a valid email address."
+msgstr ""
+
+#: app/models/contact.rb:63
+msgid "An account for your email address already exists."
+msgstr ""
+
+#: app/models/contact_group.rb:15
+msgid "Please enter group name (1 to 50 characters)"
+msgstr ""
+
+#: app/models/contact_group.rb:21
+msgid "You already have contact group with this name"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:6
+msgid "Folders"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:10
+msgid "Compose"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:14
+msgid "Refresh"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:18
+msgid "Message list"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:22
+msgid "Reply"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:26
+msgid "Forward"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:30 app/helpers/webmail_helper.rb:123
+msgid "Delete"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:34
+msgid "View source"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:38
+msgid "Manage folders"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:42 /tmp/erb-gettext18743.0:1
+msgid "Change password"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:46
+msgid "Preferences"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:50
+msgid "Mail Filters"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:54 /tmp/erb-gettext18743.0:1 /tmp/erb-gettext18743.0:19
+msgid "Contacts"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:58
+msgid "Logout"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:63
+msgid "(Empty)"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:111
+msgid "Up"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:115
+msgid "Down"
+msgstr ""
+
+#: app/helpers/webmail_helper.rb:119
+msgid "Edit"
+msgstr ""
+
+#: app/helpers/application_helper.rb:156
+msgid "First"
+msgstr ""
+
+#: app/helpers/application_helper.rb:157
+msgid "Prev"
+msgstr ""
+
+#: app/helpers/application_helper.rb:158
+msgid "Next"
+msgstr ""
+
+#: app/helpers/application_helper.rb:159
+msgid "Last"
+msgstr ""
+
+#: app/views/contact/add.rhtml:1
+msgid "Edit/Create contact"
+msgstr ""
+
+#: app/views/contact/add.rhtml:13 /tmp/erb-gettext18743.0:17 /tmp/erb-gettext18743.0:17
+msgid "First name"
+msgstr ""
+
+#: app/views/contact/add.rhtml:14 /tmp/erb-gettext18743.0:18 /tmp/erb-gettext18743.0:18
+msgid "Last name"
+msgstr ""
+
+#: app/views/contact/add.rhtml:15 /tmp/erb-gettext18743.0:19 /tmp/erb-gettext18743.0:28
+#: /tmp/erb-gettext18743.0:59 /tmp/erb-gettext18743.0:80 /tmp/erb-gettext18743.0:14
+msgid "E-mail"
+msgstr ""
+
+#: app/views/contact/add.rhtml:22
+msgid "Contact belong to these groups"
+msgstr ""
+
+#: app/views/contact/add.rhtml:52
+msgid "Save and add another"
+msgstr ""
+
+#: app/views/contact/add.rhtml:53 /tmp/erb-gettext18743.0:38 /tmp/erb-gettext18743.0:21
+msgid "Back to contacts"
+msgstr ""
+
+#: app/views/contact/add.rhtml:55 /tmp/erb-gettext18743.0:99
+msgid "Back to message"
+msgstr ""
+
+#: app/views/contact/import_preview.rhtml:1
+msgid "Contacts You Are About To Import"
+msgstr ""
+
+#: app/views/contact/import_preview.rhtml:4 /tmp/erb-gettext18743.0:3
+msgid "Errors"
+msgstr ""
+
+#: app/views/contact/import_preview.rhtml:36 /tmp/erb-gettext18743.0:20
+msgid "Import"
+msgstr ""
+
+#: app/views/contact/import_preview.rhtml:37
+msgid "Choose another file"
+msgstr ""
+
+#: app/views/contact/import_preview.rhtml:39 app/views/contact/list.rhtml:96 /tmp/erb-gettext18743.0:22
+#: /tmp/erb-gettext18743.0:22
+msgid "Back to folders"
+msgstr ""
+
+#: app/views/contact/list.rhtml:26
+msgid "To CC BCC"
+msgstr ""
+
+#: app/views/contact/list.rhtml:27 app/views/contact/list.rhtml:58 app/views/contact/list.rhtml:79
+#: /tmp/erb-gettext18743.0:7 /tmp/erb-gettext18743.0:13
+msgid "Name"
+msgstr ""
+
+#: app/views/contact/list.rhtml:39 app/views/contact/list.rhtml:97
+msgid "Groups"
+msgstr ""
+
+#: app/views/contact/list.rhtml:51
+msgid "choose"
+msgstr ""
+
+#: app/views/contact/list.rhtml:52
+msgid "cancel"
+msgstr ""
+
+#: app/views/contact/list.rhtml:74 /tmp/erb-gettext18743.0:19
+msgid "Back to groups"
+msgstr ""
+
+#: app/views/contact/list.rhtml:89
+msgid "DELETE CONTACT?\r\name - %s\r\nE-mail - %s"
+msgstr ""
+
+#: app/views/contact/list.rhtml:94
+msgid "Add One Contact"
+msgstr ""
+
+#: app/views/contact/list.rhtml:95
+msgid "Add Multiple Contacts"
+msgstr ""
+
+#: app/views/contact/add_multiple.rhtml:1
+msgid "Add multiple contacts"
+msgstr ""
+
+#: app/views/contact/add_multiple.rhtml:11
+msgid "Comma-separated (CSV) file"
+msgstr ""
+
+#: app/views/contact/add_multiple.rhtml:12
+msgid "Tab-delimited text file"
+msgstr ""
+
+#: app/views/contact/add_multiple.rhtml:15
+msgid "Select file"
+msgstr ""
+
+#: app/views/login/index.rhtml:20 app/views/login/index.rhtml:20
+msgid "Email"
+msgstr ""
+
+#: app/views/login/index.rhtml:24 app/views/login/index.rhtml:24 /tmp/erb-gettext18743.0:16
+msgid "Password"
+msgstr ""
+
+#: app/views/login/index.rhtml:29
+msgid "Log In"
+msgstr ""
+
+#: app/views/layouts/public.rhtml:5 /tmp/erb-gettext18743.0:5
+msgid "Mailr"
+msgstr ""
+
+#: app/views/contact_group/list.rhtml:1
+msgid "Contact Groups"
+msgstr ""
+
+#: app/views/contact_group/list.rhtml:14
+msgid "members"
+msgstr ""
+
+#: app/views/contact_group/list.rhtml:15
+msgid "edit"
+msgstr ""
+
+#: app/views/contact_group/list.rhtml:16
+msgid "DELETE CONTACT GROUP %s?"
+msgstr ""
+
+#: app/views/contact_group/list.rhtml:21
+msgid "Add Contact Group"
+msgstr ""
+
+#: app/views/contact_group/edit.rhtml:1
+msgid "Edit/Create Contact Group"
+msgstr ""
+
+#: app/views/webmail/filter.rhtml:1 /tmp/erb-gettext18743.0:1 /tmp/erb-gettext18743.0:1
+#: /tmp/erb-gettext18743.0:1 /tmp/erb-gettext18743.0:1 /tmp/erb-gettext18743.0:1
+#: /tmp/erb-gettext18743.0:1 /tmp/erb-gettext18743.0:1 /tmp/erb-gettext18743.0:1
+msgid "Mailbox of (%s)"
+msgstr ""
+
+#: app/views/webmail/filter.rhtml:18 /tmp/erb-gettext18743.0:18
+msgid "Filter name"
+msgstr ""
+
+#: app/views/webmail/filter.rhtml:21
+msgid "Messages matching"
+msgstr ""
+
+#: app/views/webmail/filter.rhtml:25
+msgid "Will be placed in"
+msgstr ""
+
+#: app/views/webmail/filter.rhtml:34 /tmp/erb-gettext18743.0:36
+msgid "Cancel"
+msgstr ""
+
+#: app/views/webmail/manage_folders.rhtml:15
+msgid "Folder list"
+msgstr ""
+
+#: app/views/webmail/manage_folders.rhtml:30
+msgid "Folder name"
+msgstr ""
+
+#: app/views/webmail/messages.rhtml:20
+msgid "Operations on marked messages"
+msgstr ""
+
+#: app/views/webmail/messages.rhtml:29
+msgid "Destination for move and copy operations"
+msgstr ""
+
+#: app/views/webmail/messages.rhtml:44 /tmp/erb-gettext18743.0:16 /tmp/erb-gettext18743.0:21
+msgid "To"
+msgstr ""
+
+#: app/views/webmail/messages.rhtml:46
+msgid "From"
+msgstr ""
+
+#: app/views/webmail/messages.rhtml:48 /tmp/erb-gettext18743.0:23 /tmp/erb-gettext18743.0:24
+msgid "Subject"
+msgstr ""
+
+#: app/views/webmail/messages.rhtml:49
+msgid "Date"
+msgstr ""
+
+#: app/views/webmail/change_password.rhtml:18
+msgid "New password"
+msgstr ""
+
+#: app/views/webmail/change_password.rhtml:20
+msgid "Change"
+msgstr ""
+
+#: app/views/webmail/folders.rhtml:16
+msgid "Mailbox folders"
+msgstr ""
+
+#: app/views/webmail/prefs.rhtml:20
+msgid "Send type message"
+msgstr ""
+
+#: app/views/webmail/prefs.rhtml:27
+msgid "Messages per page"
+msgstr ""
+
+#: app/views/webmail/mailsent.rhtml:18 /tmp/erb-gettext18743.0:22
+msgid "CC"
+msgstr ""
+
+#: app/views/webmail/mailsent.rhtml:21 /tmp/erb-gettext18743.0:23
+msgid "BCC"
+msgstr ""
+
+#: app/views/webmail/_search.rhtml:2
+msgid "Search in message field"
+msgstr ""
+
+#: app/views/webmail/_search.rhtml:6
+msgid "for"
+msgstr ""
+
+#: app/views/webmail/compose.rhtml:45
+msgid "Attachment"
+msgstr ""
+
+#: app/views/webmail/_expr.rhtml:15
+msgid "case sensitive"
+msgstr ""
diff --git a/locale/bg_BG/LC_MESSAGES/messages.mo b/locale/bg_BG/LC_MESSAGES/messages.mo
new file mode 100644
index 0000000..ca1894e
Binary files /dev/null and b/locale/bg_BG/LC_MESSAGES/messages.mo differ
diff --git a/locale/bg_BG/LC_MESSAGES/messages.po b/locale/bg_BG/LC_MESSAGES/messages.po
new file mode 100644
index 0000000..f74fb3d
--- /dev/null
+++ b/locale/bg_BG/LC_MESSAGES/messages.po
@@ -0,0 +1,527 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Mailr 1.0\n"
+"POT-Creation-Date: 2005-04-07 18:17+0300\n"
+"PO-Revision-Date: 2005-04-07 18:39+0200\n"
+"Last-Translator: Nick Penkov \n"
+"Language-Team: bg \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Language: Bulgarian\n"
+"X-Poedit-Country: BULGARIA\n"
+"X-Poedit-SourceCharset: iso-8859-1\n"
+"X-Poedit-Basepath: /projects/mailr\n"
+
+#: app/controllers/webmail_controller.rb:57
+#: /tmp/erb-gettext18743.0:30
+msgid "Add new folder"
+msgstr "Добавяне на папка"
+
+#: app/controllers/webmail_controller.rb:59
+#: app/helpers/webmail_helper.rb:74
+msgid "(Delete)"
+msgstr "(Изтриване)"
+
+#: app/controllers/webmail_controller.rb:61
+msgid "(Subscribe)"
+msgstr "(Абонирне)"
+
+#: app/controllers/webmail_controller.rb:62
+msgid "(Select)"
+msgstr "(Избиране)"
+
+#: app/controllers/webmail_controller.rb:79
+#: /tmp/erb-gettext18743.0:23
+msgid "copy"
+msgstr "копирай"
+
+#: app/controllers/webmail_controller.rb:83
+#: /tmp/erb-gettext18743.0:24
+msgid "move"
+msgstr "премести"
+
+#: app/controllers/webmail_controller.rb:87
+#: /tmp/erb-gettext18743.0:89
+#: /tmp/erb-gettext18743.0:16
+#: /tmp/erb-gettext18743.0:22
+msgid "delete"
+msgstr "изтриий"
+
+#: app/controllers/webmail_controller.rb:91
+#: /tmp/erb-gettext18743.0:25
+msgid "mark read"
+msgstr "прочетено"
+
+#: app/controllers/webmail_controller.rb:98
+#: /tmp/erb-gettext18743.0:26
+msgid "mark unread"
+msgstr "непрочетено"
+
+#: app/controllers/webmail_controller.rb:110
+#: /tmp/erb-gettext18743.0:17
+#: /tmp/erb-gettext18743.0:8
+msgid "Search"
+msgstr "Търси"
+
+#: app/controllers/webmail_controller.rb:115
+#: /tmp/erb-gettext18743.0:18
+#: /tmp/erb-gettext18743.0:9
+msgid "Show all"
+msgstr "Покажи всички"
+
+#: app/controllers/webmail_controller.rb:143
+msgid "Password changed successfully"
+msgstr "Паролата е сменена успешно."
+
+#: app/controllers/webmail_controller.rb:146
+msgid "Password not changed - please enter correct password."
+msgstr "Паролата не е сменена - моля въведете коректна парола."
+
+#: app/controllers/webmail_controller.rb:181
+#: /tmp/erb-gettext18743.0:18
+msgid "Send"
+msgstr "Изпрати"
+
+#: app/controllers/webmail_controller.rb:190
+#: app/controllers/webmail_controller.rb:245
+#: /tmp/erb-gettext18743.0:23
+#: /tmp/erb-gettext18743.0:46
+#: /tmp/erb-gettext18743.0:27
+msgid "Add"
+msgstr "Добави"
+
+#: app/controllers/webmail_controller.rb:228
+#: app/controllers/webmail_controller.rb:247
+#: /tmp/erb-gettext18743.0:51
+#: /tmp/erb-gettext18743.0:73
+#: /tmp/erb-gettext18743.0:18
+#: /tmp/erb-gettext18743.0:33
+#: /tmp/erb-gettext18743.0:35
+msgid "Save"
+msgstr "Съхрани"
+
+#: app/controllers/login_controller.rb:26
+msgid "Wrong email or password specified."
+msgstr "Грешен e-mail или парола са въведени."
+
+#: app/controllers/login_controller.rb:33
+msgid "User successfully logged out"
+msgstr "Потребителя успешно излезе от системата."
+
+#: app/controllers/contact_controller.rb:135
+msgid "You havent selected file or the file is empty"
+msgstr "Не сте избрали файл или файлът е празен."
+
+#: app/controllers/contact_controller.rb:161
+#: app/controllers/contact_controller.rb:189
+msgid "Contact %"
+msgstr "Адрес %"
+
+#: app/controllers/contact_controller.rb:161
+#: app/controllers/contact_controller.rb:189
+msgid "The e-mail duplicates the e-mail of another record!"
+msgstr "The e-mail duplicates the e-mail of another record!"
+
+#: app/models/contact.rb:47
+msgid "Please enter your first name (2 to 20 characters)."
+msgstr "Please enter your first name (2 to 20 characters)."
+
+#: app/models/contact.rb:48
+msgid "Please enter your surname (2 to 20 characters)."
+msgstr "Please enter your surname (2 to 20 characters)."
+
+#: app/models/contact.rb:53
+msgid "Contacts email cannot be changed."
+msgstr "Contacts email cannot be changed."
+
+#: app/models/contact.rb:59
+msgid "Please enter a valid email address."
+msgstr "Please enter a valid email address."
+
+#: app/models/contact.rb:63
+msgid "An account for your email address already exists."
+msgstr "An account for your email address already exists."
+
+#: app/models/contact_group.rb:15
+msgid "Please enter group name (1 to 50 characters)"
+msgstr "Please enter group name (1 to 50 characters)"
+
+#: app/models/contact_group.rb:21
+msgid "You already have contact group with this name"
+msgstr "You already have contact group with this name"
+
+#: app/helpers/webmail_helper.rb:6
+msgid "Folders"
+msgstr "Папки"
+
+#: app/helpers/webmail_helper.rb:10
+msgid "Compose"
+msgstr "Ново писмо"
+
+#: app/helpers/webmail_helper.rb:14
+msgid "Refresh"
+msgstr "Refresh"
+
+#: app/helpers/webmail_helper.rb:18
+msgid "Message list"
+msgstr "Списък съобщения"
+
+#: app/helpers/webmail_helper.rb:22
+msgid "Reply"
+msgstr "Отговори"
+
+#: app/helpers/webmail_helper.rb:26
+msgid "Forward"
+msgstr "Препрати"
+
+#: app/helpers/webmail_helper.rb:30
+#: app/helpers/webmail_helper.rb:123
+msgid "Delete"
+msgstr "Изтрий"
+
+#: app/helpers/webmail_helper.rb:34
+msgid "View source"
+msgstr "Преглед на оригинала"
+
+#: app/helpers/webmail_helper.rb:38
+msgid "Manage folders"
+msgstr "Управление на папки"
+
+#: app/helpers/webmail_helper.rb:42
+#: /tmp/erb-gettext18743.0:1
+msgid "Change password"
+msgstr "Смени парола"
+
+#: app/helpers/webmail_helper.rb:46
+msgid "Preferences"
+msgstr "Настройки"
+
+#: app/helpers/webmail_helper.rb:50
+msgid "Mail Filters"
+msgstr "Филтри"
+
+#: app/helpers/webmail_helper.rb:54
+#: /tmp/erb-gettext18743.0:1
+#: /tmp/erb-gettext18743.0:19
+msgid "Contacts"
+msgstr "Адреси"
+
+#: app/helpers/webmail_helper.rb:58
+msgid "Logout"
+msgstr "Изход"
+
+#: app/helpers/webmail_helper.rb:63
+msgid "(Empty)"
+msgstr "(Empty)"
+
+#: app/helpers/webmail_helper.rb:111
+msgid "Up"
+msgstr "Нагоре"
+
+#: app/helpers/webmail_helper.rb:115
+msgid "Down"
+msgstr "Надолу"
+
+#: app/helpers/webmail_helper.rb:119
+msgid "Edit"
+msgstr "Редактирай"
+
+#: app/helpers/application_helper.rb:156
+msgid "First"
+msgstr "Първи"
+
+#: app/helpers/application_helper.rb:157
+msgid "Prev"
+msgstr "Следващ"
+
+#: app/helpers/application_helper.rb:158
+msgid "Next"
+msgstr "Предишен"
+
+#: app/helpers/application_helper.rb:159
+msgid "Last"
+msgstr "Последен"
+
+#: app/views/contact/add.rhtml:1
+msgid "Edit/Create contact"
+msgstr "Edit/Create contact"
+
+#: app/views/contact/add.rhtml:13
+#: /tmp/erb-gettext18743.0:17
+msgid "First name"
+msgstr "First name"
+
+#: app/views/contact/add.rhtml:14
+#: /tmp/erb-gettext18743.0:18
+msgid "Last name"
+msgstr "Last name"
+
+#: app/views/contact/add.rhtml:15
+#: /tmp/erb-gettext18743.0:19
+#: /tmp/erb-gettext18743.0:28
+#: /tmp/erb-gettext18743.0:59
+#: /tmp/erb-gettext18743.0:80
+#: /tmp/erb-gettext18743.0:14
+msgid "E-mail"
+msgstr "E-mail"
+
+#: app/views/contact/add.rhtml:22
+msgid "Contact belong to these groups"
+msgstr "Contact belong to these groups"
+
+#: app/views/contact/add.rhtml:52
+msgid "Save and add another"
+msgstr "Save and add another"
+
+#: app/views/contact/add.rhtml:53
+#: /tmp/erb-gettext18743.0:38
+#: /tmp/erb-gettext18743.0:21
+msgid "Back to contacts"
+msgstr "Back to contacts"
+
+#: app/views/contact/add.rhtml:55
+#: /tmp/erb-gettext18743.0:99
+msgid "Back to message"
+msgstr "Back to message"
+
+#: app/views/contact/import_preview.rhtml:1
+msgid "Contacts You Are About To Import"
+msgstr "Contacts You Are About To Import"
+
+#: app/views/contact/import_preview.rhtml:4
+#: /tmp/erb-gettext18743.0:3
+msgid "Errors"
+msgstr "Errors"
+
+#: app/views/contact/import_preview.rhtml:36
+#: /tmp/erb-gettext18743.0:20
+msgid "Import"
+msgstr "Import"
+
+#: app/views/contact/import_preview.rhtml:37
+msgid "Choose another file"
+msgstr "Choose another file"
+
+#: app/views/contact/import_preview.rhtml:39
+#: app/views/contact/list.rhtml:96
+#: /tmp/erb-gettext18743.0:22
+msgid "Back to folders"
+msgstr "Back to folders"
+
+#: app/views/contact/list.rhtml:26
+msgid "To CC BCC"
+msgstr "To CC BCC"
+
+#: app/views/contact/list.rhtml:27
+#: app/views/contact/list.rhtml:58
+#: app/views/contact/list.rhtml:79
+#: /tmp/erb-gettext18743.0:7
+#: /tmp/erb-gettext18743.0:13
+msgid "Name"
+msgstr "Name"
+
+#: app/views/contact/list.rhtml:39
+#: app/views/contact/list.rhtml:97
+msgid "Groups"
+msgstr "Groups"
+
+#: app/views/contact/list.rhtml:51
+msgid "choose"
+msgstr "choose"
+
+#: app/views/contact/list.rhtml:52
+msgid "cancel"
+msgstr "cancel"
+
+#: app/views/contact/list.rhtml:74
+#: /tmp/erb-gettext18743.0:19
+msgid "Back to groups"
+msgstr "Back to groups"
+
+#: app/views/contact/list.rhtml:89
+msgid ""
+"DELETE CONTACT?\r\n"
+"ame - %s\r\n"
+"E-mail - %s"
+msgstr ""
+"DELETE CONTACT?\r\n"
+"ame - %s\r\n"
+"E-mail - %s"
+
+#: app/views/contact/list.rhtml:94
+msgid "Add One Contact"
+msgstr "Add One Contact"
+
+#: app/views/contact/list.rhtml:95
+msgid "Add Multiple Contacts"
+msgstr "Add Multiple Contacts"
+
+#: app/views/contact/add_multiple.rhtml:1
+msgid "Add multiple contacts"
+msgstr "Add multiple contacts"
+
+#: app/views/contact/add_multiple.rhtml:11
+msgid "Comma-separated (CSV) file"
+msgstr "Comma-separated (CSV) file"
+
+#: app/views/contact/add_multiple.rhtml:12
+msgid "Tab-delimited text file"
+msgstr "Tab-delimited text file"
+
+#: app/views/contact/add_multiple.rhtml:15
+msgid "Select file"
+msgstr "Select file"
+
+#: app/views/login/index.rhtml:20
+msgid "Email"
+msgstr "Email"
+
+#: app/views/login/index.rhtml:24
+#: /tmp/erb-gettext18743.0:16
+msgid "Password"
+msgstr "Password"
+
+#: app/views/login/index.rhtml:29
+msgid "Log In"
+msgstr "Log In"
+
+#: app/views/layouts/public.rhtml:5
+#: /tmp/erb-gettext18743.0:5
+msgid "Mailr"
+msgstr "Mailr"
+
+#: app/views/contact_group/list.rhtml:1
+msgid "Contact Groups"
+msgstr "Contact Groups"
+
+#: app/views/contact_group/list.rhtml:14
+msgid "members"
+msgstr "members"
+
+#: app/views/contact_group/list.rhtml:15
+msgid "edit"
+msgstr "edit"
+
+#: app/views/contact_group/list.rhtml:16
+msgid "DELETE CONTACT GROUP %s?"
+msgstr "DELETE CONTACT GROUP %s?"
+
+#: app/views/contact_group/list.rhtml:21
+msgid "Add Contact Group"
+msgstr "Add Contact Group"
+
+#: app/views/contact_group/edit.rhtml:1
+msgid "Edit/Create Contact Group"
+msgstr "Edit/Create Contact Group"
+
+#: app/views/webmail/filter.rhtml:1
+#: /tmp/erb-gettext18743.0:1
+msgid "Mailbox of (%s)"
+msgstr "Пощенска кутия на (%s)"
+
+#: app/views/webmail/filter.rhtml:18
+#: /tmp/erb-gettext18743.0:18
+msgid "Filter name"
+msgstr "Filter name"
+
+#: app/views/webmail/filter.rhtml:21
+msgid "Messages matching"
+msgstr "Messages matching"
+
+#: app/views/webmail/filter.rhtml:25
+msgid "Will be placed in"
+msgstr "Will be placed in"
+
+#: app/views/webmail/filter.rhtml:34
+#: /tmp/erb-gettext18743.0:36
+msgid "Cancel"
+msgstr "Cancel"
+
+#: app/views/webmail/manage_folders.rhtml:15
+msgid "Folder list"
+msgstr "Folder list"
+
+#: app/views/webmail/manage_folders.rhtml:30
+msgid "Folder name"
+msgstr "Folder name"
+
+#: app/views/webmail/messages.rhtml:20
+msgid "Operations on marked messages"
+msgstr "Operations on marked messages"
+
+#: app/views/webmail/messages.rhtml:29
+msgid "Destination for move and copy operations"
+msgstr "Destination for move and copy operations"
+
+#: app/views/webmail/messages.rhtml:44
+#: /tmp/erb-gettext18743.0:16
+#: /tmp/erb-gettext18743.0:21
+msgid "To"
+msgstr "To"
+
+#: app/views/webmail/messages.rhtml:46
+msgid "From"
+msgstr "From"
+
+#: app/views/webmail/messages.rhtml:48
+#: /tmp/erb-gettext18743.0:23
+#: /tmp/erb-gettext18743.0:24
+msgid "Subject"
+msgstr "Subject"
+
+#: app/views/webmail/messages.rhtml:49
+msgid "Date"
+msgstr "Date"
+
+#: app/views/webmail/change_password.rhtml:18
+msgid "New password"
+msgstr "New password"
+
+#: app/views/webmail/change_password.rhtml:20
+msgid "Change"
+msgstr "Change"
+
+#: app/views/webmail/folders.rhtml:16
+msgid "Mailbox folders"
+msgstr "Mailbox folders"
+
+#: app/views/webmail/prefs.rhtml:20
+msgid "Send type message"
+msgstr "Send type message"
+
+#: app/views/webmail/prefs.rhtml:27
+msgid "Messages per page"
+msgstr "Messages per page"
+
+#: app/views/webmail/mailsent.rhtml:18
+#: /tmp/erb-gettext18743.0:22
+msgid "CC"
+msgstr "CC"
+
+#: app/views/webmail/mailsent.rhtml:21
+#: /tmp/erb-gettext18743.0:23
+msgid "BCC"
+msgstr "BCC"
+
+#: app/views/webmail/_search.rhtml:2
+msgid "Search in message field"
+msgstr "Search in message field"
+
+#: app/views/webmail/_search.rhtml:6
+msgid "for"
+msgstr "for"
+
+#: app/views/webmail/compose.rhtml:45
+msgid "Attachment"
+msgstr "Attachment"
+
+#: app/views/webmail/_expr.rhtml:15
+msgid "case sensitive"
+msgstr "case sensitive"
+
diff --git a/public/.htaccess b/public/.htaccess
new file mode 100644
index 0000000..8e8d1fe
--- /dev/null
+++ b/public/.htaccess
@@ -0,0 +1,40 @@
+# General Apache options
+AddHandler fastcgi-script .fcgi
+AddHandler cgi-script .cgi
+Options +FollowSymLinks +ExecCGI
+
+# If you don't want Rails to look in certain directories,
+# use the following rewrite rules so that Apache won't rewrite certain requests
+#
+# Example:
+# RewriteCond %{REQUEST_URI} ^/notrails.*
+# RewriteRule .* - [L]
+
+# Redirect all requests not available on the filesystem to Rails
+# By default the cgi dispatcher is used which is very slow
+#
+# For better performance replace the dispatcher with the fastcgi one
+#
+# Example:
+# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
+RewriteEngine On
+
+# If your Rails application is accessed via an Alias directive,
+# then you MUST also set the RewriteBase in this htaccess file.
+#
+# Example:
+# Alias /myrailsapp /path/to/myrailsapp/public
+# RewriteBase /myrailsapp
+
+RewriteRule ^$ /login [QSA]
+RewriteRule ^([^.]+)$ $1.html [QSA]
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
+
+# In case Rails experiences terminal errors
+# Instead of displaying this message you can supply a file here which will be rendered instead
+#
+# Example:
+# ErrorDocument 500 /500.html
+
+ErrorDocument 500 "
Application error
Rails application failed to start properly"
diff --git a/public/404.html b/public/404.html
new file mode 100644
index 0000000..0e18456
--- /dev/null
+++ b/public/404.html
@@ -0,0 +1,8 @@
+
+
+
+
File not found
+
Change this error message for pages not found in public/404.html
+
+
\ No newline at end of file
diff --git a/public/500.html b/public/500.html
new file mode 100644
index 0000000..a1001a0
--- /dev/null
+++ b/public/500.html
@@ -0,0 +1,8 @@
+
+
+
+
Application error (Apache)
+
Change this error message for exceptions thrown outside of an action (like in Dispatcher setups or broken Ruby code) in public/500.html
+
+
\ No newline at end of file
diff --git a/public/dispatch.cgi b/public/dispatch.cgi
new file mode 100755
index 0000000..32fa3b2
--- /dev/null
+++ b/public/dispatch.cgi
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
+
+# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
+# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
+require "dispatcher"
+
+ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
+Dispatcher.dispatch
diff --git a/public/dispatch.fcgi b/public/dispatch.fcgi
new file mode 100755
index 0000000..664dbbb
--- /dev/null
+++ b/public/dispatch.fcgi
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+#
+# You may specify the path to the FastCGI crash log (a log of unhandled
+# exceptions which forced the FastCGI instance to exit, great for debugging)
+# and the number of requests to process before running garbage collection.
+#
+# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
+# and the GC period is nil (turned off). A reasonable number of requests
+# could range from 10-100 depending on the memory footprint of your app.
+#
+# Example:
+# # Default log path, normal GC behavior.
+# RailsFCGIHandler.process!
+#
+# # Default log path, 50 requests between GC.
+# RailsFCGIHandler.process! nil, 50
+#
+# # Custom log path, normal GC behavior.
+# RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
+#
+require File.dirname(__FILE__) + "/../config/environment"
+require 'fcgi_handler'
+
+RailsFCGIHandler.process!
diff --git a/public/dispatch.rb b/public/dispatch.rb
new file mode 100755
index 0000000..32fa3b2
--- /dev/null
+++ b/public/dispatch.rb
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
+
+# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
+# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
+require "dispatcher"
+
+ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
+Dispatcher.dispatch
diff --git a/public/favicon.ico b/public/favicon.ico
new file mode 100644
index 0000000..e69de29
diff --git a/public/images/attachment.png b/public/images/attachment.png
new file mode 100644
index 0000000..0fcf464
Binary files /dev/null and b/public/images/attachment.png differ
diff --git a/public/images/d6deec.gif b/public/images/d6deec.gif
new file mode 100644
index 0000000..c3b04b6
Binary files /dev/null and b/public/images/d6deec.gif differ
diff --git a/public/images/deselect.png b/public/images/deselect.png
new file mode 100644
index 0000000..a487186
Binary files /dev/null and b/public/images/deselect.png differ
diff --git a/public/images/icon-folder-open.gif b/public/images/icon-folder-open.gif
new file mode 100644
index 0000000..5cfb2c6
Binary files /dev/null and b/public/images/icon-folder-open.gif differ
diff --git a/public/images/list_closed.gif b/public/images/list_closed.gif
new file mode 100644
index 0000000..0e76b13
Binary files /dev/null and b/public/images/list_closed.gif differ
diff --git a/public/images/list_opened.gif b/public/images/list_opened.gif
new file mode 100644
index 0000000..7e1561b
Binary files /dev/null and b/public/images/list_opened.gif differ
diff --git a/public/images/noprogress.gif b/public/images/noprogress.gif
new file mode 100644
index 0000000..facbced
Binary files /dev/null and b/public/images/noprogress.gif differ
diff --git a/public/images/select.png b/public/images/select.png
new file mode 100644
index 0000000..2037e27
Binary files /dev/null and b/public/images/select.png differ
diff --git a/public/images/white.gif b/public/images/white.gif
new file mode 100644
index 0000000..d7960f2
Binary files /dev/null and b/public/images/white.gif differ
diff --git a/public/images/white.png b/public/images/white.png
new file mode 100644
index 0000000..90166ec
Binary files /dev/null and b/public/images/white.png differ
diff --git a/public/index.html b/public/index.html
new file mode 100644
index 0000000..d780f8e
--- /dev/null
+++ b/public/index.html
@@ -0,0 +1,78 @@
+
+
+
+ Rails: Welcome on board
+
+
+
+
+
Congratulations, you've put Ruby on Rails!
+
+
Before you move on, verify that the following conditions have been met:
+
+
+
The log and public directories must be writable to the web server (chmod -R 775 log and chmod -R 775 public).
+
+ The shebang line in the public/dispatch* files must reference your Ruby installation.
+ You might need to change it to #!/usr/bin/env ruby or point directly at the installation.
+
+
+ Rails on Apache needs to have the cgi handler and mod_rewrite enabled.
+ Somewhere in your httpd.conf, you should have:
+ AddHandler cgi-script .cgi
+ LoadModule rewrite_module libexec/httpd/mod_rewrite.so
+ AddModule mod_rewrite.c
+
+
+
+
Take the following steps to get started:
+
+
+
Create empty development and test databases for your application.
+ Recommendation: Use *_development and *_test names, such as basecamp_development and basecamp_test
+ Warning: Don't point your test database at your development database, it'll destroy the latter on test runs!
+
Edit config/database.yml with your database settings.
+
Create controllers and models using the generator in script/generate
+ Help: Run the generator with no arguments for documentation
+
Remove the dispatches you don't use (so if you're on FastCGI, delete/move dispatch.rb, dispatch.cgi and gateway.cgi)
+
+
+
+ Trying to setup a default page for Rails using Routes? You'll have to delete this file (public/index.html) to get under way. Then define a new route in config/routes.rb of the form:
+
+ Having problems getting up and running? First try debugging it yourself by looking at the log files.
+ Then try the friendly Rails community on the web or on IRC
+ (FreeNode#rubyonrails).
+
+
+
+
diff --git a/public/javascripts/contact_choose.js b/public/javascripts/contact_choose.js
new file mode 100755
index 0000000..fc27f07
--- /dev/null
+++ b/public/javascripts/contact_choose.js
@@ -0,0 +1,52 @@
+
+var fieldTo = ""
+var fieldToc = ""
+var fieldCC = ""
+var fieldBCC = ""
+
+function respondTo(str) {
+ if (fieldTo == "") fieldTo += str
+ else fieldTo += "," + str
+}
+
+function respondTo(str, contactId) {
+ if (fieldTo == "") fieldTo += str
+ else fieldTo += "," + str
+
+ if (fieldToc == "") fieldToc += contactId
+ else fieldToc += "," + contactId
+}
+
+function respondCC(str) {
+ if (fieldCC == "") fieldCC += str
+ else fieldCC += "," + str
+}
+
+function respondBCC(str) {
+ if (fieldBCC == "") fieldBCC += str
+ else fieldBCC += "," + str
+}
+
+function respondToCaller() {
+ if (window.opener) {
+ doc = window.opener.document;
+ setAddrField(getFormFieldPoint(doc, 'mail_to'), fieldTo);
+ setAddrField(getFormFieldPoint(doc, 'mail_toc'), fieldToc);
+ setAddrField(getFormFieldPoint(doc, 'mail_cc'), fieldCC);
+ setAddrField(getFormFieldPoint(doc, 'mail_bcc'), fieldBCC);
+ window.close();
+ }
+}
+
+function getFormFieldPoint(doc, id) {
+ if ( doc.getElementById ) elem = doc.getElementById( id );
+ else if ( doc.all ) elem = doc.eval( "document.all." + id );
+ return elem
+}
+
+function setAddrField(fld, value) {
+ if (value != "") {
+ if (fld.value == "") fld.value = value;
+ else fld.value += "," + value;
+ }
+}
\ No newline at end of file
diff --git a/public/javascripts/controls.js b/public/javascripts/controls.js
new file mode 100644
index 0000000..a7436bc
--- /dev/null
+++ b/public/javascripts/controls.js
@@ -0,0 +1,708 @@
+// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// (c) 2005 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
+// (c) 2005 Jon Tirsen (http://www.tirsen.com)
+// Contributors:
+// Richard Livsey
+// Rahul Bhargava
+// Rob Wills
+//
+// See scriptaculous.js for full license.
+
+// Autocompleter.Base handles all the autocompletion functionality
+// that's independent of the data source for autocompletion. This
+// includes drawing the autocompletion menu, observing keyboard
+// and mouse events, and similar.
+//
+// Specific autocompleters need to provide, at the very least,
+// a getUpdatedChoices function that will be invoked every time
+// the text inside the monitored textbox changes. This method
+// should get the text for which to provide autocompletion by
+// invoking this.getToken(), NOT by directly accessing
+// this.element.value. This is to allow incremental tokenized
+// autocompletion. Specific auto-completion logic (AJAX, etc)
+// belongs in getUpdatedChoices.
+//
+// Tokenized incremental autocompletion is enabled automatically
+// when an autocompleter is instantiated with the 'tokens' option
+// in the options parameter, e.g.:
+// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
+// will incrementally autocomplete with a comma as the token.
+// Additionally, ',' in the above example can be replaced with
+// a token array, e.g. { tokens: [',', '\n'] } which
+// enables autocompletion on multiple tokens. This is most
+// useful when one of the tokens is \n (a newline), as it
+// allows smart autocompletion after linebreaks.
+
+var Autocompleter = {}
+Autocompleter.Base = function() {};
+Autocompleter.Base.prototype = {
+ baseInitialize: function(element, update, options) {
+ this.element = $(element);
+ this.update = $(update);
+ this.hasFocus = false;
+ this.changed = false;
+ this.active = false;
+ this.index = 0;
+ this.entryCount = 0;
+
+ if (this.setOptions)
+ this.setOptions(options);
+ else
+ this.options = options || {};
+
+ this.options.paramName = this.options.paramName || this.element.name;
+ this.options.tokens = this.options.tokens || [];
+ this.options.frequency = this.options.frequency || 0.4;
+ this.options.minChars = this.options.minChars || 1;
+ this.options.onShow = this.options.onShow ||
+ function(element, update){
+ if(!update.style.position || update.style.position=='absolute') {
+ update.style.position = 'absolute';
+ Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight});
+ }
+ Effect.Appear(update,{duration:0.15});
+ };
+ this.options.onHide = this.options.onHide ||
+ function(element, update){ new Effect.Fade(update,{duration:0.15}) };
+
+ if (typeof(this.options.tokens) == 'string')
+ this.options.tokens = new Array(this.options.tokens);
+
+ this.observer = null;
+
+ this.element.setAttribute('autocomplete','off');
+
+ Element.hide(this.update);
+
+ Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this));
+ Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this));
+ },
+
+ show: function() {
+ if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
+ if(!this.iefix && (navigator.appVersion.indexOf('MSIE')>0) && (Element.getStyle(this.update, 'position')=='absolute')) {
+ new Insertion.After(this.update,
+ '');
+ this.iefix = $(this.update.id+'_iefix');
+ }
+ if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
+ },
+
+ fixIEOverlapping: function() {
+ Position.clone(this.update, this.iefix);
+ this.iefix.style.zIndex = 1;
+ this.update.style.zIndex = 2;
+ Element.show(this.iefix);
+ },
+
+ hide: function() {
+ this.stopIndicator();
+ if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
+ if(this.iefix) Element.hide(this.iefix);
+ },
+
+ startIndicator: function() {
+ if(this.options.indicator) Element.show(this.options.indicator);
+ },
+
+ stopIndicator: function() {
+ if(this.options.indicator) Element.hide(this.options.indicator);
+ },
+
+ onKeyPress: function(event) {
+ if(this.active)
+ switch(event.keyCode) {
+ case Event.KEY_TAB:
+ case Event.KEY_RETURN:
+ this.selectEntry();
+ Event.stop(event);
+ case Event.KEY_ESC:
+ this.hide();
+ this.active = false;
+ Event.stop(event);
+ return;
+ case Event.KEY_LEFT:
+ case Event.KEY_RIGHT:
+ return;
+ case Event.KEY_UP:
+ this.markPrevious();
+ this.render();
+ if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
+ return;
+ case Event.KEY_DOWN:
+ this.markNext();
+ this.render();
+ if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
+ return;
+ }
+ else
+ if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN)
+ return;
+
+ this.changed = true;
+ this.hasFocus = true;
+
+ if(this.observer) clearTimeout(this.observer);
+ this.observer =
+ setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
+ },
+
+ onHover: function(event) {
+ var element = Event.findElement(event, 'LI');
+ if(this.index != element.autocompleteIndex)
+ {
+ this.index = element.autocompleteIndex;
+ this.render();
+ }
+ Event.stop(event);
+ },
+
+ onClick: function(event) {
+ var element = Event.findElement(event, 'LI');
+ this.index = element.autocompleteIndex;
+ this.selectEntry();
+ this.hide();
+ },
+
+ onBlur: function(event) {
+ // needed to make click events working
+ setTimeout(this.hide.bind(this), 250);
+ this.hasFocus = false;
+ this.active = false;
+ },
+
+ render: function() {
+ if(this.entryCount > 0) {
+ for (var i = 0; i < this.entryCount; i++)
+ this.index==i ?
+ Element.addClassName(this.getEntry(i),"selected") :
+ Element.removeClassName(this.getEntry(i),"selected");
+
+ if(this.hasFocus) {
+ this.show();
+ this.active = true;
+ }
+ } else this.hide();
+ },
+
+ markPrevious: function() {
+ if(this.index > 0) this.index--
+ else this.index = this.entryCount-1;
+ },
+
+ markNext: function() {
+ if(this.index < this.entryCount-1) this.index++
+ else this.index = 0;
+ },
+
+ getEntry: function(index) {
+ return this.update.firstChild.childNodes[index];
+ },
+
+ getCurrentEntry: function() {
+ return this.getEntry(this.index);
+ },
+
+ selectEntry: function() {
+ this.active = false;
+ this.updateElement(this.getCurrentEntry());
+ },
+
+ updateElement: function(selectedElement) {
+ if (this.options.updateElement) {
+ this.options.updateElement(selectedElement);
+ return;
+ }
+
+ var value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
+ var lastTokenPos = this.findLastToken();
+ if (lastTokenPos != -1) {
+ var newValue = this.element.value.substr(0, lastTokenPos + 1);
+ var whitespace = this.element.value.substr(lastTokenPos + 1).match(/^\s+/);
+ if (whitespace)
+ newValue += whitespace[0];
+ this.element.value = newValue + value;
+ } else {
+ this.element.value = value;
+ }
+ this.element.focus();
+
+ if (this.options.afterUpdateElement)
+ this.options.afterUpdateElement(this.element, selectedElement);
+ },
+
+ updateChoices: function(choices) {
+ if(!this.changed && this.hasFocus) {
+ this.update.innerHTML = choices;
+ Element.cleanWhitespace(this.update);
+ Element.cleanWhitespace(this.update.firstChild);
+
+ if(this.update.firstChild && this.update.firstChild.childNodes) {
+ this.entryCount =
+ this.update.firstChild.childNodes.length;
+ for (var i = 0; i < this.entryCount; i++) {
+ var entry = this.getEntry(i);
+ entry.autocompleteIndex = i;
+ this.addObservers(entry);
+ }
+ } else {
+ this.entryCount = 0;
+ }
+
+ this.stopIndicator();
+
+ this.index = 0;
+ this.render();
+ }
+ },
+
+ addObservers: function(element) {
+ Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
+ Event.observe(element, "click", this.onClick.bindAsEventListener(this));
+ },
+
+ onObserverEvent: function() {
+ this.changed = false;
+ if(this.getToken().length>=this.options.minChars) {
+ this.startIndicator();
+ this.getUpdatedChoices();
+ } else {
+ this.active = false;
+ this.hide();
+ }
+ },
+
+ getToken: function() {
+ var tokenPos = this.findLastToken();
+ if (tokenPos != -1)
+ var ret = this.element.value.substr(tokenPos + 1).replace(/^\s+/,'').replace(/\s+$/,'');
+ else
+ var ret = this.element.value;
+
+ return /\n/.test(ret) ? '' : ret;
+ },
+
+ findLastToken: function() {
+ var lastTokenPos = -1;
+
+ for (var i=0; i lastTokenPos)
+ lastTokenPos = thisTokenPos;
+ }
+ return lastTokenPos;
+ }
+}
+
+Ajax.Autocompleter = Class.create();
+Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), {
+ initialize: function(element, update, url, options) {
+ this.baseInitialize(element, update, options);
+ this.options.asynchronous = true;
+ this.options.onComplete = this.onComplete.bind(this);
+ this.options.defaultParams = this.options.parameters || null;
+ this.url = url;
+ },
+
+ getUpdatedChoices: function() {
+ entry = encodeURIComponent(this.options.paramName) + '=' +
+ encodeURIComponent(this.getToken());
+
+ this.options.parameters = this.options.callback ?
+ this.options.callback(this.element, entry) : entry;
+
+ if(this.options.defaultParams)
+ this.options.parameters += '&' + this.options.defaultParams;
+
+ new Ajax.Request(this.url, this.options);
+ },
+
+ onComplete: function(request) {
+ this.updateChoices(request.responseText);
+ }
+
+});
+
+// The local array autocompleter. Used when you'd prefer to
+// inject an array of autocompletion options into the page, rather
+// than sending out Ajax queries, which can be quite slow sometimes.
+//
+// The constructor takes four parameters. The first two are, as usual,
+// the id of the monitored textbox, and id of the autocompletion menu.
+// The third is the array you want to autocomplete from, and the fourth
+// is the options block.
+//
+// Extra local autocompletion options:
+// - choices - How many autocompletion choices to offer
+//
+// - partialSearch - If false, the autocompleter will match entered
+// text only at the beginning of strings in the
+// autocomplete array. Defaults to true, which will
+// match text at the beginning of any *word* in the
+// strings in the autocomplete array. If you want to
+// search anywhere in the string, additionally set
+// the option fullSearch to true (default: off).
+//
+// - fullSsearch - Search anywhere in autocomplete array strings.
+//
+// - partialChars - How many characters to enter before triggering
+// a partial match (unlike minChars, which defines
+// how many characters are required to do any match
+// at all). Defaults to 2.
+//
+// - ignoreCase - Whether to ignore case when autocompleting.
+// Defaults to true.
+//
+// It's possible to pass in a custom function as the 'selector'
+// option, if you prefer to write your own autocompletion logic.
+// In that case, the other options above will not apply unless
+// you support them.
+
+Autocompleter.Local = Class.create();
+Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), {
+ initialize: function(element, update, array, options) {
+ this.baseInitialize(element, update, options);
+ this.options.array = array;
+ },
+
+ getUpdatedChoices: function() {
+ this.updateChoices(this.options.selector(this));
+ },
+
+ setOptions: function(options) {
+ this.options = Object.extend({
+ choices: 10,
+ partialSearch: true,
+ partialChars: 2,
+ ignoreCase: true,
+ fullSearch: false,
+ selector: function(instance) {
+ var ret = []; // Beginning matches
+ var partial = []; // Inside matches
+ var entry = instance.getToken();
+ var count = 0;
+
+ for (var i = 0; i < instance.options.array.length &&
+ ret.length < instance.options.choices ; i++) {
+
+ var elem = instance.options.array[i];
+ var foundPos = instance.options.ignoreCase ?
+ elem.toLowerCase().indexOf(entry.toLowerCase()) :
+ elem.indexOf(entry);
+
+ while (foundPos != -1) {
+ if (foundPos == 0 && elem.length != entry.length) {
+ ret.push("