works but need some cleanup

This commit is contained in:
Wojciech Todryk 2011-06-24 23:48:08 +02:00
parent 0ec83db287
commit e40a859b7d
752 changed files with 4866 additions and 27923 deletions

1
.gitignore vendored
View file

@ -4,5 +4,4 @@ config/database.yml
config/site.rb config/site.rb
tmp tmp
mail_temp mail_temp
config/site.rb
.svn .svn

5
AUTHORS Normal file
View file

@ -0,0 +1,5 @@
* Luben Manolov <luben.manolov@gmail.com>
* Nick Penkov <nick.penkov@gmail.com>
* Eugene Korbut
* Emilio Blanco
* Wojciech Todryk <wojciech(at)todryk(dot).pl>

718
CHANGELOG
View file

@ -1,718 +0,0 @@
*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
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
>> @posts.first.title = "hello from a breakpoint"
=> "hello from a breakpoint"
...and even better is that you can examine how your runtime objects actually work:
>> f = @posts.first
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
>> f.
Display all 152 possibilities? (y or n)
Finally, when you're ready to resume execution, you press CTRL-D
* 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

36
Gemfile Executable file
View file

@ -0,0 +1,36 @@
source 'http://rubygems.org'
gem 'rails', '3.0.7'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby',:require => 'sqlite3'
gem 'arel'
gem 'mysql2'
gem 'will_paginate'
gem 'web-app-theme'
gem 'tmail'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end

81
Gemfile.lock Executable file
View file

@ -0,0 +1,81 @@
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.0.7)
actionpack (= 3.0.7)
mail (~> 2.2.15)
actionpack (3.0.7)
activemodel (= 3.0.7)
activesupport (= 3.0.7)
builder (~> 2.1.2)
erubis (>= 2.6.6)
i18n (~> 0.5.0)
rack (~> 1.2.1)
rack-mount (>= 0.6.14)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.7)
activesupport (= 3.0.7)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activerecord (3.0.7)
activemodel (= 3.0.7)
activesupport (= 3.0.7)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.7)
activemodel (= 3.0.7)
activesupport (= 3.0.7)
activesupport (3.0.7)
arel (2.0.4)
builder (2.1.2)
erubis (2.7.0)
i18n (0.5.0)
mail (2.2.18)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (>= 1.16)
treetop (>= 1.4.8)
mime-types (1.16)
mysql2 (0.2.7)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.7.3)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.7)
actionmailer (= 3.0.7)
actionpack (= 3.0.7)
activerecord (= 3.0.7)
activeresource (= 3.0.7)
activesupport (= 3.0.7)
bundler (~> 1.0)
railties (= 3.0.7)
railties (3.0.7)
actionpack (= 3.0.7)
activesupport (= 3.0.7)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
sqlite3 (1.3.3)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
thor (0.14.6)
tmail (1.2.7.1)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.24)
web-app-theme (0.6.3)
will_paginate (2.3.15)
PLATFORMS
ruby
DEPENDENCIES
arel
mysql2
rails (= 3.0.7)
sqlite3-ruby
tmail
web-app-theme
will_paginate

View file

@ -1,23 +0,0 @@
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.

34
README
View file

@ -1,34 +0,0 @@
Installation Guide
Requirements
* Ruby 1.8.7
* Rails 2.3.2
Installation
1. Checkout the source code
2. 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
3. Configure SMTP settings
# initializers/smtp_settings.rb
ActionMailer::Base.smtp_settings = {
:address => "mail.example.com.py",
:port => 26,
:authentication => :plain,
:enable_starttls_auto => true,
:user_name => "emilio@example.com.py",
:password => "yourpass"
}
4. Prepare config/database.yml file (see config/database.yml.example)
5. Migrate database (rake db:migrate)
6. Use it

40
README.markdown Executable file
View file

@ -0,0 +1,40 @@
## Introduction
_Mailr_ is a IMAP mail client based on _Ruby on Rails_ platform.
## Installation guide
**NOTE** All path and filenames are based on _Rails.root_ directory.
### Requirements
In _Rails 3_ all dependencies should be defined in file _<Rails.root>.Gemfile_. All needed gems can be installed using bundler.
### Installation procedure
1. Checkout the source code.
2. 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
3. Configure SMTP settings
# initializers/smtp_settings.rb
ActionMailer::Base.smtp_settings = {
:address => "mail.example.com.py",
:port => 26,
:authentication => :plain,
:enable_starttls_auto => true,
:user_name => "emilio@example.com.py",
:password => "yourpass"
}
4. Prepare config/database.yml file (see config/database.yml.example).
Check if proper gems (sqlite3/mysql/postgresql) are defined in _Gemfile_ and installed.
5. Migrate database (rake db:migrate)
6. Use it.

9
Rakefile Normal file → Executable file
View file

@ -1,10 +1,7 @@
# Add your own tasks in files placed in lib/tasks ending in .rake, # 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. # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require File.expand_path('../config/application', __FILE__)
require 'rake' require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails' Rails3::Application.load_tasks

24
UNLICENSE Normal file
View file

@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
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 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.
For more information, please refer to <http://unlicense.org/>

13
app/controllers/application_controller.rb Normal file → Executable file
View file

@ -1,12 +1,16 @@
# The filters added to this controller will be run for all controllers in the application. # 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. # Likewise will all the methods added be available for all controllers.
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :user_login_filter before_filter :user_login_filter
before_filter :add_scripts before_filter :add_scripts
#before_filter :localize #before_filter :localize
filter_parameter_logging :password #filter_parameter_logging :password #upgrade to Rails3
protected protected
def secure_user?() true end def secure_user?() true end
def secure_cust?() false end def secure_cust?() false end
@ -21,7 +25,12 @@ class ApplicationController < ActionController::Base
def user_login_filter def user_login_filter
if (secure_user? or secure_cust? )and logged_user.nil? if (secure_user? or secure_cust? )and logged_user.nil?
session["return_to"] = request.request_uri
#upgrade Rails 3
#session["return_to"] = request.request_uri
logger.debug "*** return_to => #{request.fullpath}"
session["return_to"] = request.fullpath
redirect_to :controller=>"/login", :action => "index" redirect_to :controller=>"/login", :action => "index"
return false return false
end end

0
app/controllers/contact_groups_controller.rb Normal file → Executable file
View file

0
app/controllers/contacts_controller.rb Normal file → Executable file
View file

0
app/controllers/folders_controller.rb Normal file → Executable file
View file

10
app/controllers/login_controller.rb Normal file → Executable file
View file

@ -1,4 +1,6 @@
require 'ezcrypto' require 'ezcrypto'
require 'imapmailbox'
class LoginController < ApplicationController class LoginController < ApplicationController
def index def index
@ -25,6 +27,7 @@ class LoginController < ApplicationController
redirect_to :action=>"index" redirect_to :action=>"index"
end end
else else
logger.debug "*** Not logged"
@login_user = Customer.new @login_user = Customer.new
flash["error"] = t :wrong_email_or_password flash["error"] = t :wrong_email_or_password
redirect_to :action => "index" redirect_to :action => "index"
@ -45,12 +48,15 @@ class LoginController < ApplicationController
private private
def auth(email, password) def auth(email, password)
mailbox = IMAPMailbox.new mailbox = IMAPMailbox.new(Rails.logger)
logger.info "*** mailbox #{mailbox.inspect}"
begin begin
mailbox.connect(email, password) mailbox.connect(email, password)
rescue rescue Exception => exc
logger.debug "*** auth/Mailbox Object => #{exc.message}"
return nil return nil
end end
mailbox.disconnect mailbox.disconnect
mailbox = nil mailbox = nil
if user = Customer.find_by_email(email) if user = Customer.find_by_email(email)

5
app/controllers/webmail_controller.rb Normal file → Executable file
View file

@ -3,10 +3,15 @@ require 'net/smtp'
require 'net/imap' require 'net/imap'
require 'mail2screen' require 'mail2screen'
require 'ezcrypto' require 'ezcrypto'
require 'imapmailbox'
require 'imap_utils'
class WebmailController < ApplicationController class WebmailController < ApplicationController
include ImapUtils include ImapUtils
logger.info "*** WebmailController #{logger.inspect}"
# Administrative functions # Administrative functions
before_filter :login_required before_filter :login_required
before_filter :obtain_cookies_for_search_and_nav, :only=>[:messages] before_filter :obtain_cookies_for_search_and_nav, :only=>[:messages]

0
app/helpers/application_helper.rb Normal file → Executable file
View file

0
app/helpers/contact_group_helper.rb Normal file → Executable file
View file

0
app/helpers/contacts_helper.rb Normal file → Executable file
View file

0
app/helpers/folders_helper.rb Normal file → Executable file
View file

0
app/helpers/navigation_helper.rb Normal file → Executable file
View file

3
app/helpers/webmail_helper.rb Normal file → Executable file
View file

@ -42,7 +42,8 @@ module WebmailHelper
title = folder.unseen > 0 ? "#{folder_name} (#{folder.unseen})" : "#{folder_name}" title = folder.unseen > 0 ? "#{folder_name} (#{folder.unseen})" : "#{folder_name}"
link = link_to title, :controller => 'webmail', :action => 'messages', :folder_name => folder.name link = link_to title, :controller => 'webmail', :action => 'messages', :folder_name => folder.name
link = content_tag('b', link) if folder.name == @folder_name link = content_tag('b', link) if folder.name == @folder_name
link += '&nbsp;' + empty_trash_link(folder.name) if folder.trash? link += raw('&nbsp;' + empty_trash_link(folder.name)) if folder.trash?
logger.info link
link link
end end

21
app/models/contact.rb Normal file → Executable file
View file

@ -3,6 +3,9 @@ require_association 'contact_group'
class Contact < ActiveRecord::Base class Contact < ActiveRecord::Base
validate :check_fname_and_lname, :check_mail_cannot_be_changed
validate :check_email, :on => :create
has_and_belongs_to_many :groups, :class_name => "ContactGroup", :join_table => "contact_contact_groups", :association_foreign_key => "contact_group_id", :foreign_key => "contact_id" has_and_belongs_to_many :groups, :class_name => "ContactGroup", :join_table => "contact_contact_groups", :association_foreign_key => "contact_group_id", :foreign_key => "contact_id"
# Finder methods follow # Finder methods follow
@ -26,8 +29,8 @@ class Contact < ActiveRecord::Base
result result
end end
named_scope :for_customer, lambda{ |customer_id| {:conditions => {:customer_id => customer_id}} } scope :for_customer, lambda{ |customer_id| {:conditions => {:customer_id => customer_id}} }
named_scope :letter, lambda{ |letter| {:conditions => ["contacts.fname LIKE ?", "#{letter}%"]} } scope :letter, lambda{ |letter| {:conditions => ["contacts.fname LIKE ?", "#{letter}%"]} }
def Contact.find_by_user_letter(user_id, letter) def Contact.find_by_user_letter(user_id, letter)
find_by_sql("select * from contacts where customer_id=#{user_id} and substr(UPPER(fname),1,1) = '#{letter}' order by fname") find_by_sql("select * from contacts where customer_id=#{user_id} and substr(UPPER(fname),1,1) = '#{letter}' order by fname")
@ -46,20 +49,22 @@ class Contact < ActiveRecord::Base
end end
protected protected
def validate def check_fname_and_lname
errors.add 'fname', I18n.t(:validate_fname_error) unless self.fname =~ /^.{2,20}$/i errors.add 'fname', t(:validate_fname_error) unless self.fname =~ /^.{2,20}$/i
errors.add 'lname', I18n.t(:validate_lname_error) unless self.lname =~ /^.{2,20}$/i errors.add 'lname', t(:validate_lname_error) unless self.lname =~ /^.{2,20}$/i
end
def check_mail_cannot_be_changed
# Contact e-mail cannot be changed # Contact e-mail cannot be changed
unless self.new_record? unless self.new_record?
old_record = Contact.find(self.id) old_record = Contact.find(self.id)
errors.add 'email', I18n.t(:contacto_cannot_be_changed) unless old_record.email == self.email errors.add 'email', t(:contact_cannot_be_changed) unless old_record.email == self.email
end end
end end
def validate_on_create def check_mail
# Contact e-mail cannot be changed, so we only need to validate it on create # Contact e-mail cannot be changed, so we only need to validate it on create
errors.add 'email', I18n.t(:validate_email_error) unless valid_email?(self.email) errors.add 'email', t(:validate_email_error) unless valid_email?(self.email)
# Already existing e-mail in contacts for this user is not allowed # Already existing e-mail in contacts for this user is not allowed
if self.new_record? if self.new_record?
if Contact.find :first, :conditions => {:email => email, :customer_id => customer_id} if Contact.find :first, :conditions => {:email => email, :customer_id => customer_id}

13
app/models/contact_group.rb Normal file → Executable file
View file

@ -1,22 +1,27 @@
class ContactGroup < ActiveRecord::Base 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" has_and_belongs_to_many :contacts, :class_name => "Contact", :join_table => "contact_contact_groups", :association_foreign_key => "contact_id", :foreign_key => "contact_group_id"
validate :check_group_name
validate :check_group_id, :on => :create
validate :check_group_uniqness, :on => :update
def ContactGroup.find_by_user(user_id) def ContactGroup.find_by_user(user_id)
find_by_sql("select * from contact_groups where customer_id = #{user_id} order by name asc") find_by_sql("select * from contact_groups where customer_id = #{user_id} order by name asc")
end end
protected protected
def validate
errors.add('name', :contactgroup_name_invalid) unless self.name =~ /^.{1,50}$/i def check_group_name
errors.add('name', t(:contactgroup_name_invalid)) unless self.name =~ /^.{1,50}$/i
end end
def validate_on_create def check_group_id
if ContactGroup.find_first(["name = '#{name}' and customer_id = #{user_id}"]) if ContactGroup.find_first(["name = '#{name}' and customer_id = #{user_id}"])
errors.add("name", _('Please enter group name (1 to 50 characters)')) errors.add("name", _('Please enter group name (1 to 50 characters)'))
end end
end end
def validate_on_update def check_group_uniqness
if ContactGroup.find_first(["name = '#{name}' and customer_id = #{user_id} and id <> #{id}"]) 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')) errors.add("name", _('You already have contact group with this name'))
end end

0
app/models/customer.rb Normal file → Executable file
View file

0
app/models/mail_pref.rb Normal file → Executable file
View file

0
app/views/contact_groups/index.html.erb Normal file → Executable file
View file

View file

0
app/views/contacts/index.html.erb Normal file → Executable file
View file

2
app/views/contacts/new.html.erb Normal file → Executable file
View file

@ -20,7 +20,7 @@
<div id="tab_content"> <div id="tab_content">
<% form_tag( contacts_path, 'method' => 'post', 'class' => 'two_columns') do %> <%= form_tag( contacts_path, 'method' => 'post', 'class' => 'two_columns') do %>
<%= form_input(:hidden_field, 'contact', 'id') %> <%= form_input(:hidden_field, 'contact', 'id') %>
<%= form_input(:hidden_field, 'contact', 'customer_id') %> <%= form_input(:hidden_field, 'contact', 'customer_id') %>

2
app/views/folders/index.html.erb Normal file → Executable file
View file

@ -19,7 +19,7 @@
<div id="folders"> <div id="folders">
<h4><%= t :add_folder %></h4> <h4><%= t :add_folder %></h4>
<hr/> <hr/>
<% form_tag folders_path, :id => 'new_folder' do %> <%= form_tag folders_path, :id => 'new_folder' do %>
<ul> <ul>
<li><label for='folder'><%= t :name %>:</label></li> <li><label for='folder'><%= t :name %>:</label></li>
<li><%= text_field_tag 'folder', '', :size => 18 %></li> <li><%= text_field_tag 'folder', '', :size => 18 %></li>

0
app/views/layouts/chooser.html.erb Normal file → Executable file
View file

0
app/views/layouts/login.html.erb Normal file → Executable file
View file

5
app/views/layouts/public.html.erb Normal file → Executable file
View file

@ -14,7 +14,10 @@
<div id="wholepage"> <div id="wholepage">
<div id="container"> <div id="container">
<div id="sidebar_outer"> <div id="sidebar_outer">
<div id="sidebar"><%= yield :sidebar %></div> <div id="logo"></div>
<div id="sidebar">
<%= yield :sidebar %>
</div>
</div> </div>
<div id="content"><%= yield %></div> <div id="content"><%= yield %></div>
<br class="clear"/> <br class="clear"/>

0
app/views/login/index.rhtml Normal file → Executable file
View file

2
app/views/shared/_folders.html.erb Normal file → Executable file
View file

@ -3,7 +3,7 @@
<hr/> <hr/>
<ul> <ul>
<% @folders.each do |folder| -%> <% @folders.each do |folder| -%>
<li><%= folder_link(folder) %></li> <li><%= raw folder_link(folder) %></li>
<% end -%> <% end -%>
</ul> </ul>
</div> </div>

View file

View file

View file

View file

View file

View file

View file

View file

View file

@ -15,9 +15,9 @@
<div id="tab_main"> <div id="tab_main">
<div id="tab_content"> <div id="tab_content">
<% content_for('sidebar') { %> <% content_for :sidebar do %>
<%= render :partial => 'shared/folders' %> <%= render :partial => 'shared/folders' %>
<% } %> <% end %>
<div id="messages"> <div id="messages">
<div id="msglist"> <div id="msglist">

View file

BIN
arts/logo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
arts/logo.xcf Executable file

Binary file not shown.

4
config.ru Executable file
View file

@ -0,0 +1,4 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Rails3::Application

63
config/application.rb Executable file
View file

@ -0,0 +1,63 @@
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module Rails3
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
config.autoload_paths << Rails.root.join("vendor/ezcrypto-0.1.1/lib")
config.autoload_paths << Rails.root.join("lib/webmail")
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
#config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
#config.i18n.default_locale = :en
# JavaScript files you want as :defaults (application.js is always included).
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
default_config_path = 'config/default_site'
default_config = Rails.root.join(default_config_path)
require default_config
begin
require Rails.root.join("config/site")
CDF::CONFIG.update(CDF::LOCALCONFIG) if CDF::LOCALCONFIG
rescue LoadError
STDERR.puts 'WARNING: config/site.rb not found, using default settings from ' + default_config_path
end
#if CONFIG[:locale] is nil then I18n.default_locale will be used
config.i18n.default_locale = CDF::CONFIG[:locale]
require 'tmail_patch'
$KCODE = 'u'
require 'jcode'
end
end

109
config/boot.rb Normal file → Executable file
View file

@ -1,109 +1,6 @@
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
defined? Rails::Initializer
end
def pick_boot
(vendor_rails? ? VendorBoot : GemBoot).new
end
def vendor_rails?
File.exist?("#{RAILS_ROOT}/vendor/rails")
end
def preinitialize
load(preinitializer_path) if File.exist?(preinitializer_path)
end
def preinitializer_path
"#{RAILS_ROOT}/config/preinitializer.rb"
end
end
class Boot
def run
load_initializer
Rails::Initializer.run(:set_load_path)
end
end
class VendorBoot < Boot
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
end
end
class GemBoot < Boot
def load_initializer
self.class.load_rubygems
load_rails_gem
require 'initializer'
end
def load_rails_gem
if version = self.class.gem_version
gem 'rails', version
else
gem 'rails'
end
rescue Gem::LoadError => load_error
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
exit 1
end
class << self
def rubygems_version
Gem::RubyGemsVersion rescue nil
end
def gem_version
if defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION
elsif ENV.include?('RAILS_GEM_VERSION')
ENV['RAILS_GEM_VERSION']
else
parse_gem_version(read_environment_rb)
end
end
def load_rubygems
require 'rubygems' require 'rubygems'
min_version = '1.3.1'
unless rubygems_version >= min_version
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
end
rescue LoadError # Set up gems listed in the Gemfile.
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org) ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
exit 1
end
def parse_gem_version(text) require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
end
private
def read_environment_rb
File.read("#{RAILS_ROOT}/config/environment.rb")
end
end
end
end
# All that for this:
Rails.boot!

0
config/default_site.rb Normal file → Executable file
View file

84
config/environment.rb Normal file → Executable file
View file

@ -1,81 +1,5 @@
# Be sure to restart your webserver when you modify this file. # Load the rails application
require File.expand_path('../application', __FILE__)
# Uncomment below to force Rails into production mode # Initialize the rails application
# (Use only when you can't set environment variables through your web/app server) Rails3::Application.initialize!
# ENV['RAILS_ENV'] = 'production'
#RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
# Skip frameworks you're not going to use
# config.frameworks -= [ :action_web_service, :action_mailer ]
# Add additional load paths for your own custom dirs
config.load_paths += %W( #{RAILS_ROOT}/vendor/ezcrypto-0.1.1/lib )
config.load_paths += %W( #{RAILS_ROOT}/lib/webmail )
# Force all environments to use the same logger level
# (by default production uses :info, the others :debug)
# config.log_level = :debug
# Use the database for sessions instead of the file system
# (create the session table with 'rake create_sessions_table')
#config.action_controller.session_store = :active_record_store
# Enable page/fragment caching by setting a file-based store
# (remember to create the caching directory and make it readable to the application)
# config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/cache"
# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector
# Make Active Record use UTC-base instead of local time
config.active_record.default_timezone = :utc
config.i18n.default_locale = "en"
# Use Active Record's schema dumper instead of SQL when creating the test database
# (enables use of different database adapters for development and test environments)
# config.active_record.schema_format = :ruby
# See Rails::Configuration for more options
config.action_controller.session = { :session_key => "_mailr_session", :secret => "123456789012345678901234567890" }
end
# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# Include your application configuration below
default_config_path = 'config/default_site'
default_config = File.join(RAILS_ROOT, default_config_path)
require default_config
begin
require File.join(RAILS_ROOT, 'config/site')
CDF::CONFIG.update(CDF::LOCALCONFIG) if CDF::LOCALCONFIG
rescue LoadError
STDERR.puts 'WARNING: config/site.rb not found, using default settings from ' + default_config_path
end
#if CONFIG[:locale] is nil then I18n.default_locale will be used
I18n.default_locale = CDF::CONFIG[:locale]
require 'tmail_patch'
$KCODE = 'u'
require 'jcode'
# set UTF8 as a client interface to Database
RAILS_DEFAULT_LOGGER.debug("Using MySQL Version #{CDF::CONFIG[:mysql_version]}")
ActiveRecord::Base.connection.execute("SET NAMES utf8", 'Set Client encoding to UTF8') if CDF::CONFIG[:mysql_version] == '4.1'
ActiveRecord::Base.connection.execute("set character set utf8", 'Set Connection encoding to UTF8') if CDF::CONFIG[:mysql_version] == '4.1'
require 'imapmailbox'
[IMAPMailbox, IMAPFolderList, IMAPFolder].each { |mod| mod.logger ||= RAILS_DEFAULT_LOGGER }

14
config/environments/development.rb Normal file → Executable file
View file

@ -1,3 +1,6 @@
Rails3::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on # In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development # every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes. # since you don't have to restart the webserver when you make code changes.
@ -7,8 +10,17 @@ config.cache_classes = false
config.whiny_nils = true config.whiny_nils = true
# Show full error reports and disable caching # Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
# Don't care if the mailer can't send # Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
end

40
config/environments/production.rb Normal file → Executable file
View file

@ -1,17 +1,49 @@
Rails3::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps. # The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests # Code is not reloaded between requests
config.cache_classes = true config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile"
# For nginx:
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# If you have no front-end server that supports something like X-Sendfile,
# just comment this out and Rails will serve the files
# See everything in the log (default is :info)
# config.log_level = :debug
# Use a different logger for distributed setups # Use a different logger for distributed setups
# config.logger = SyslogLogger.new # config.logger = SyslogLogger.new
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Full error reports are disabled and caching is turned on # Disable Rails's static asset server
config.action_controller.consider_all_requests_local = false # In production, Apache or nginx will already do this
config.action_controller.perform_caching = true config.serve_static_assets = false
# Enable serving of images, stylesheets, and javascripts from an asset server # Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com" # config.action_controller.asset_host = "http://assets.example.com"
# Disable delivery errors if you bad email addresses should just be ignored # Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false # config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end

24
config/environments/test.rb Normal file → Executable file
View file

@ -1,3 +1,6 @@
Rails3::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's # The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that # test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped # your test database is "scratch space" for the test suite and is wiped
@ -8,16 +11,25 @@ config.cache_classes = true
config.whiny_nils = true config.whiny_nils = true
# Show full error reports and disable caching # Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world. # Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the # The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array. # ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test config.action_mailer.delivery_method = :test
# Overwrite the default settings for fixtures in tests. See Fixtures # Use SQL instead of Active Record's schema dumper when creating the test database.
# for more details about these settings. # This is necessary if your schema can't be completely dumped by the schema dumper,
# config.transactional_fixtures = true # like if you have constraints or database-specific column types
# config.instantiated_fixtures = false # config.active_record.schema_format = :sql
# config.pre_loaded_fixtures = false
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
end

View file

@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!

View file

@ -0,0 +1,10 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end

View file

@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone

View file

@ -0,0 +1,36 @@
# config/initializers/pluralization.rb
module I18n::Backend::Pluralization
# rules taken from : http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
def pluralize(locale, entry, n)
return entry unless entry.is_a?(Hash) && n
if n == 0 && entry.has_key?(:zero)
key = :zero
else
key = case locale
when :pl # Polish
n==1 ? :one : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? :few : :other
when :cs, :sk # Czech, Slovak
n==1 ? :one : (n>=2 && n<=4) ? :few : :other
when lt # Lithuanian
n%10==1 && n%100!=11 ? :one : n%10>=2 && (n%100<10 || n%100>=20) ? :few : :other
when :lv # Latvian
n%10==1 && n%100!=11 ? :one : n != 0 ? :few : :other
when :ru, :uk, :sr, :hr # Russian, Ukrainian, Serbian, Croatian
n%10==1 && n%100!=11 ? :one : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? :few : :other
when :sl # Slovenian
n%100==1 ? :one : n%100==2 ? :few : n%100==3 || n%100==4 ? :many : :other
when :ro # Romanian
n==1 ? :one : (n==0 || (n%100 > 0 && n%100 < 20)) ? :few : :other
when :gd # Gaeilge
n==1 ? :one : n==2 ? :two : :other;
# add another language if you like...
else
n==1 ? :one : :other # default :en
end
end
raise InvalidPluralizationData.new(entry, n) unless entry.has_key?(key)
entry[key]
end
end
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)

View file

@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Rails3::Application.config.secret_token = 'ade84d567b0c637fd3547fd18b97d1677fd6ca3c5331e6ed1a1b13bb6a7823cc367cbe317caf102f29f8c35eb487ff3ca33e6321d037c14ebb055eb530841ff6'

View file

@ -0,0 +1,8 @@
# Be sure to restart your server when you modify this file.
Rails3::Application.config.session_store :cookie_store, :key => '_rails3_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Rails3::Application.config.session_store :active_record_store

View file

@ -1,79 +0,0 @@
server.port = 80
server.bind = "127.0.0.1"
#server.event-handler = "freebsd-kqueue"
server.modules = ( "mod_rewrite", "mod_fastcgi", )
server.indexfiles = ( "dispatch.fcgi" )
server.document-root = "public/"
server.error-handler-404 = "/dispatch.fcgi"
server.errorlog = "log/error.log"
url.rewrite = ( "^/$" => "/login", "^([^.]+)$" => "$1.html" )
#### fastcgi module
fastcgi.server = (
".fcgi" => (
"mailr" => (
"min-procs" => 2,
"max-procs" => 2,
"socket" => "/tmp/mailr1.socket",
"bin-path" => "public/dispatch.fcgi",
"idle-timeout" => 120,
"bin-environment" => ( "RAILS_ENV" => "production" )
)
)
)
mimetype.assign = (
".rpm" => "application/x-rpm",
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".gz" => "application/x-gzip",
".pac" => "application/x-ns-proxy-autoconfig",
".swf" => "application/x-shockwave-flash",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "audio/x-wav",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain",
".c" => "text/plain",
".conf" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".dtd" => "text/xml",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".bz2" => "application/x-bzip",
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar"
)

1
config/locales/en.yml Normal file → Executable file
View file

@ -64,3 +64,4 @@ en:
add_folder: Add folder add_folder: Add folder
total_messages: Total messages total_messages: Total messages
unseen: Unseen unseen: Unseen
please_login: Log in

0
config/locales/es-ES.yml Normal file → Executable file
View file

6
config/locales/pl-PL.yml → config/locales/pl.yml Normal file → Executable file
View file

@ -1,4 +1,4 @@
pl-PL: pl:
mailr: Mailr mailr: Mailr
email: E-mail email: E-mail
password: Hasło password: Hasło
@ -7,7 +7,7 @@ pl-PL:
mailbox: Poczta mailbox: Poczta
folders: Foldery folders: Foldery
folder: Folder folder: Folder
empty: Pusty empty: Opróżnij
logout: Wyloguj logout: Wyloguj
compose: Nowa wiadomość compose: Nowa wiadomość
preferences: Ustawienia preferences: Ustawienia
@ -68,3 +68,5 @@ pl-PL:
user_logged_out: Użytkownik został wylogowany user_logged_out: Użytkownik został wylogowany
please_login: Logowanie please_login: Logowanie
add_to_contacts: Dodaj do kontaktów add_to_contacts: Dodaj do kontaktów
want_to_empty_trash_message: Czy chcesz opróznic kosz?

103
config/routes.rb Normal file → Executable file
View file

@ -1,27 +1,78 @@
ActionController::Routing::Routes.draw do |map| Rails3::Application.routes.draw do
map.resources :folders, :requirements => {:id => /[^\/]+/} resources :folders
map.resources :contacts, :member => {:add_from_mail => :get}, :collection => {:add_multiple => :get} resources :contacts do
map.resources :contact_groups collection do
get :add_multiple
# Add your own custom routes here.
# The priority is based upon order of creation: first created -> highest priority.
# Here's a sample route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
map.root :controller=>'webmail', :action=>'index'
map.connect 'webmail', :controller=>'webmail', :action=>'index'
map.connect 'webmail/:action', :controller=>'webmail'
map.connect '/contact/:action', :controller=>'contacts'
map.connect 'admin/main', :controller=> 'login', :action=>'logout'
# Allow downloading Web Service WSDL as a file with an extension
# instead of a file named 'wsdl'
map.connect ':controller/service.wsdl', :action => 'wsdl'
# Install the default route as the lowest priority.
map.connect ':controller/:action/:id'
end end
member do
get :add_from_mail
end
end
resources :contact_groups
match '/' => 'webmail#index'
match 'webmail' => 'webmail#index'
match 'webmail/:action' => 'webmail#index'
match '/contact/:action' => 'contacts#index'
match 'admin/main' => 'login#logout'
match ':controller/service.wsdl' => '#wsdl'
match '/:controller(/:action(/:id))'
end
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => "welcome#index"
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'

0
db/migrate/20090107193228_init.rb Normal file → Executable file
View file

View file

@ -1,111 +0,0 @@
CREATE TABLE customers (
id bigint(20) NOT NULL auto_increment,
fname varchar(50) default NULL,
lname varchar(50) default NULL,
email varchar(100) NOT NULL,
PRIMARY KEY (id),
UNIQUE INDEX (email)
) TYPE=MyISAM;
CREATE TABLE filters (
id bigint(20) NOT NULL auto_increment,
name varchar(50) default NULL,
destination_folder varchar(50) default NULL,
customer_id bigint(20) NOT NULL,
order_num int default 1,
PRIMARY KEY (id),
INDEX (customer_id),
FOREIGN KEY (customer_id) REFERENCES customers(id)
) TYPE=MyISAM;
CREATE TABLE expressions (
id bigint(20) NOT NULL auto_increment,
field_name varchar(20) default '^Subject' NOT NULL,
operator varchar(20) default 'contains' NOT NULL,
expr_value varchar(100) default '' NOT NULL,
case_sensitive bool default 0,
filter_id bigint(20) NOT NULL,
PRIMARY KEY (id),
INDEX (filter_id),
FOREIGN KEY (filter_id) REFERENCES filters(id)
) TYPE=MyISAM;
CREATE TABLE `mail_prefs` (
`id` int(11) NOT NULL auto_increment,
`mail_type` varchar(10) default 'text/plain',
`wm_rows` int(11) default '20',
`customer_id` bigint(20) default NULL,
`check_external_mail` tinyint(1) default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `customer_id` (`customer_id`)
) TYPE=MyISAM;
CREATE TABLE contacts (
id bigint(20) NOT NULL auto_increment,
fname varchar(50) default NULL,
lname varchar(50) default NULL,
email varchar(100) default NULL,
hphone varchar(20) default NULL,
wphone varchar(20) default NULL,
mobile varchar(20) default NULL,
fax varchar(20) default NULL,
notes text,
create_date datetime default NULL,
delete_date datetime default NULL,
customer_id bigint(20) default NULL,
PRIMARY KEY (id),
INDEX (customer_id),
INDEX (customer_id, email),
INDEX (email),
FOREIGN KEY (customer_id) REFERENCES customers(id)
) TYPE=MyISAM;
CREATE TABLE contact_groups (
id bigint(20) NOT NULL auto_increment,
name varchar(50) default NULL,
customer_id bigint(20) default NULL,
PRIMARY KEY (id),
INDEX (customer_id),
FOREIGN KEY (customer_id) REFERENCES customers(id)
) TYPE=MyISAM;
CREATE TABLE contact_contact_groups (
contact_id bigint(20) NOT NULL,
contact_group_id bigint(20) NOT NULL,
PRIMARY KEY (contact_id, contact_group_id),
INDEX (contact_id),
INDEX (contact_group_id),
FOREIGN KEY (contact_id) REFERENCES contacts(id),
FOREIGN KEY (contact_group_id) REFERENCES contact_groups(id)
) TYPE=MyISAM;
-- Mysql Sessions
create table sessions (
id bigint(20) NOT NULL auto_increment,
session_id varchar(255),
data text,
updated_at timestamp,
primary key(id),
index(session_id)
);
-- Cache
CREATE TABLE imap_messages (
id bigint(20) NOT NULL auto_increment,
folder_name varchar(100) NOT NULL,
username varchar(100) NOT NULL,
msg_id varchar(100),
uid bigint(20) NOT NULL,
`from` varchar(255),
`from_flat` varchar(255),
`to` varchar(255),
`to_flat` varchar(255),
`subject` varchar(255),
`content_type` varchar(30),
`date` timestamp,
`unread` tinyint(1),
`size` bigint(20),
PRIMARY KEY (id),
INDEX (folder_name, username),
INDEX (folder_name, username,uid)
) TYPE=MyISAM;

View file

@ -1,111 +0,0 @@
CREATE TABLE customers (
id bigserial NOT NULL,
fname varchar(50) default NULL,
lname varchar(50) default NULL,
email varchar(100) NOT NULL,
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX customers_email_idx ON customers(email);
CREATE TABLE filters (
id bigserial NOT NULL,
name varchar(50) default NULL,
destination_folder varchar(50) default NULL,
customer_id bigint NOT NULL,
order_num int default 1,
PRIMARY KEY (id),
FOREIGN KEY (customer_id) REFERENCES customers(id)
);
CREATE INDEX filters_customer_id_idx ON filters(customer_id);
CREATE TABLE expressions (
id bigserial NOT NULL,
field_name varchar(20) default '^Subject' NOT NULL,
operator varchar(20) default 'contains' NOT NULL,
expr_value varchar(100) default '' NOT NULL,
case_sensitive bool default FALSE,
filter_id bigint NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (filter_id) REFERENCES filters(id)
);
CREATE INDEX expressions_filter_id_idx ON expressions(filter_id);
CREATE TABLE mail_prefs (
id serial NOT NULL,
mail_type varchar(10) default 'text/plain',
wm_rows int default '20',
customer_id bigint default NULL,
check_external_mail bool default false,
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX mail_prefs_customer_id_idx ON mail_prefs(customer_id);
CREATE TABLE contacts (
id bigserial NOT NULL,
fname varchar(50) default NULL,
lname varchar(50) default NULL,
email varchar(100) default NULL,
hphone varchar(20) default NULL,
wphone varchar(20) default NULL,
mobile varchar(20) default NULL,
fax varchar(20) default NULL,
notes text,
create_date timestamp default NULL,
delete_date timestamp default NULL,
customer_id bigint default NULL,
PRIMARY KEY (id),
FOREIGN KEY (customer_id) REFERENCES customers(id)
);
CREATE INDEX contacts_customer_id_idx ON contacts(customer_id);
CREATE INDEX contacts_customer_id_email_idx ON contacts(customer_id,email);
CREATE INDEX contacts_email_idx ON contacts(email);
CREATE TABLE contact_groups (
id bigserial NOT NULL,
name varchar(50) default NULL,
customer_id bigint default NULL,
PRIMARY KEY (id),
FOREIGN KEY (customer_id) REFERENCES customers(id)
);
CREATE INDEX contact_groups_customer_id_idx ON contact_groups(customer_id);
CREATE TABLE contact_contact_groups (
contact_id bigint NOT NULL,
contact_group_id bigint NOT NULL,
PRIMARY KEY (contact_id, contact_group_id),
FOREIGN KEY (contact_id) REFERENCES contacts(id),
FOREIGN KEY (contact_group_id) REFERENCES contact_groups(id)
);
CREATE INDEX contact_contact_groups_contact_id_idx ON contact_contact_groups(contact_id);
CREATE INDEX contact_contact_groups_contact_group_id_idx ON contact_contact_groups(contact_group_id);
create table sessions (
id BIGSERIAL NOT NULL,
session_id VARCHAR(255) NULL,
data TEXT NULL,
updated_at TIMESTAMP default null,
PRIMARY KEY (id)
);
CREATE INDEX session_idx ON sessions(session_id);
CREATE TABLE imap_messages (
id BIGSERIAL NOT NULL,
folder_name VARCHAR(100) NOT NULL,
username VARCHAR(100) NOT NULL,
msg_id VARCHAR(100),
uid BIGINT NOT NULL,
"from" TEXT,
"from_flat" TEXT,
"to" TEXT,
"to_flat" TEXT,
"subject" TEXT,
"content_type" VARCHAR(30),
"date" TIMESTAMP,
"unread" BOOL default false,
"size" BIGINT,
PRIMARY KEY (id)
);
CREATE INDEX msg_cache_fu_idx ON imap_messages(folder_name, username);
CREATE INDEX msg_cache_fuui_idx ON imap_messages(folder_name, username, uid);

13
db/schema.rb Normal file → Executable file
View file

@ -1,10 +1,11 @@
# This file is auto-generated from the current state of the database. Instead of editing this file, # This file is auto-generated from the current state of the database. Instead
# please use the migrations feature of Active Record to incrementally modify your database, and # of editing this file, please use the migrations feature of Active Record to
# then regenerate this schema definition. # incrementally modify your database, and then regenerate this schema definition.
# #
# Note that this schema.rb definition is the authoritative source for your database schema. If you need # Note that this schema.rb definition is the authoritative source for your
# to create the application database on another system, you should be using db:schema:load, not running # database schema. If you need to create the application database on another
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations # system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues). # you'll amass, the slower it'll run and the greater likelihood for issues).
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.

7
db/seeds.rb Executable file
View file

@ -0,0 +1,7 @@
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name => 'Daley', :city => cities.first)

2
doc/README_FOR_APP Normal file → Executable file
View file

@ -1,2 +1,2 @@
Use this README file to introduce your application and point to useful places in the API for learning more. Use this README file to introduce your application and point to useful places in the API for learning more.
Run "rake appdoc" to generate API documentation for your models and controllers. Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.

0
lib/cdfutils.rb Normal file → Executable file
View file

2
lib/imap_utils.rb Normal file → Executable file
View file

@ -8,7 +8,7 @@ module ImapUtils
def get_imap_session def get_imap_session
begin begin
@mailbox = IMAPMailbox.new @mailbox = IMAPMailbox.new(self.logger)
uname = (get_mail_prefs.check_external_mail == 1 ? user.email : user.local_email) uname = (get_mail_prefs.check_external_mail == 1 ? user.email : user.local_email)
upass = get_upass upass = get_upass
@mailbox.connect(uname, upass) @mailbox.connect(uname, upass)

0
lib/tasks/.gitkeep Executable file
View file

0
lib/tmail_patch.rb Normal file → Executable file
View file

0
lib/webmail/bounced_mail.rb Normal file → Executable file
View file

2
lib/webmail/cdfmail.rb Normal file → Executable file
View file

@ -6,7 +6,7 @@ module CDF
end end
class CDF::Mail class CDF::Mail
include ActionMailer::Quoting #include ActionMailer::Quoting #upgrade to Rails3
def initialize(senderTempLocation) def initialize(senderTempLocation)
@attachments = Array.new @attachments = Array.new

0
lib/webmail/environment.rb Normal file → Executable file
View file

0
lib/webmail/expression.rb Normal file → Executable file
View file

0
lib/webmail/filter.rb Normal file → Executable file
View file

0
lib/webmail/imap_message.rb Normal file → Executable file
View file

33
lib/webmail/imapmailbox.rb Normal file → Executable file
View file

@ -62,16 +62,19 @@ class IMAPMailbox
attr_accessor :selected_mailbox attr_accessor :selected_mailbox
cattr_accessor :logger cattr_accessor :logger
def initialize def initialize(logger)
@selected_mailbox = '' @selected_mailbox = ''
@folders = {} @folders = {}
@connected = false @connected = false
@logger = logger
end end
def connect(username, password) def connect(username, password)
#logger.debug "*** connect: @connected"
unless @connected unless @connected
use_ssl = CDF::CONFIG[:imap_use_ssl] ? true : false use_ssl = CDF::CONFIG[:imap_use_ssl] ? true : false
port = CDF::CONFIG[:imap_port] || (use_ssl ? 993 : 143) port = CDF::CONFIG[:imap_port] || (use_ssl ? 993 : 143)
# logger.debug "*** IMAP params: use_ssl => #{use_ssl}, port => #{port}"
begin begin
@imap = Net::IMAP.new(CDF::CONFIG[:imap_server], port, use_ssl) @imap = Net::IMAP.new(CDF::CONFIG[:imap_server], port, use_ssl)
rescue Net::IMAP::ByeResponseError => bye rescue Net::IMAP::ByeResponseError => bye
@ -80,26 +83,26 @@ class IMAPMailbox
System.sleep(CDF::CONFIG[:imap_bye_timeout_retry_seconds]) System.sleep(CDF::CONFIG[:imap_bye_timeout_retry_seconds])
@imap = Net::IMAP.new(CDF::CONFIG[:imap_server], port, use_ssl) @imap = Net::IMAP.new(CDF::CONFIG[:imap_server], port, use_ssl)
rescue Error => ex rescue Error => ex
logger.error "Error on authentication!" # logger.error "Error on authentication!"
logger.error bye.backtrace.join("\n") # logger.error bye.backtrace.join("\n")
raise AuthenticationError.new raise AuthenticationError.new
end end
rescue Net::IMAP::NoResponseError => noresp rescue Net::IMAP::NoResponseError => noresp
logger.error "Error on authentication!" # logger.error "Error on authentication!"
logger.error noresp.backtrace.join("\n") # logger.error noresp.backtrace.join("\n")
raise AuthenticationError.new raise AuthenticationError.new
rescue Net::IMAP::BadResponseError => bad rescue Net::IMAP::BadResponseError => bad
logger.error "Error on authentication!" # logger.error "Error on authentication!"
logger.error bad.backtrace.join("\n") # logger.error bad.backtrace.join("\n")
raise AuthenticationError.new raise AuthenticationError.new
rescue Net::IMAP::ResponseError => resp rescue Net::IMAP::ResponseError => resp
logger.error "Error on authentication!" # logger.error "Error on authentication!"
logger.error resp.backtrace.join("\n") # logger.error resp.backtrace.join("\n")
raise AuthenticationError.new raise AuthenticationError.new
end end
@username = username @username = username
begin begin
logger.error "IMAP authentication - #{CDF::CONFIG[:imap_auth]}." # logger.error "IMAP authentication - #{CDF::CONFIG[:imap_auth]}."
if CDF::CONFIG[:imap_auth] == 'NOAUTH' if CDF::CONFIG[:imap_auth] == 'NOAUTH'
@imap.login(username, password) @imap.login(username, password)
else else
@ -107,8 +110,8 @@ class IMAPMailbox
end end
@connected = true @connected = true
rescue Exception => ex rescue Exception => ex
logger.error "Error on authentication!" # logger.error "Error on authentication!"
logger.error ex.backtrace.join("\n") # logger.error ex.backtrace.join("\n")
raise AuthenticationError.new raise AuthenticationError.new
end end
end end
@ -387,7 +390,7 @@ class IMAPFolder
range = (offset..to) range = (offset..to)
logger.info range.inspect #logger.info range.inspect
server_messages = @mailbox.imap.fetch(range, "(UID FLAGS)") server_messages = @mailbox.imap.fetch(range, "(UID FLAGS)")
#server_messages = @mailbox.imap.uid_fetch(sequence_uids, ["UID", "FLAGS"]) #server_messages = @mailbox.imap.uid_fetch(sequence_uids, ["UID", "FLAGS"])
@ -433,13 +436,13 @@ class IMAPFolder
# fetch and store not cached messages # fetch and store not cached messages
unless uids_to_be_fetched.empty? unless uids_to_be_fetched.empty?
logger.debug("About to fetch #{uids_to_be_fetched.join(",")}") # logger.debug("About to fetch #{uids_to_be_fetched.join(",")}")
uids_to_be_fetched.each_slice(20) do |slice| uids_to_be_fetched.each_slice(20) do |slice|
fetch_uids(slice) fetch_uids(slice)
end end
end end
#FIX: @mcached = true #FIX: @mcached = true
logger.debug("Synchonization done for folder #{@name} in #{Time.now - startSync} ms.") # logger.debug("Synchonization done for folder #{@name} in #{Time.now - startSync} ms.")
end end
def fetch_uids(uids) def fetch_uids(uids)

0
lib/webmail/mail2screen.rb Normal file → Executable file
View file

0
lib/webmail/mail_transform.rb Normal file → Executable file
View file

0
lib/webmail/maildropserializator.rb Normal file → Executable file
View file

0
lib/webmail/routes.rb Normal file → Executable file
View file

0
lib/webmail/virtual_email.rb Normal file → Executable file
View file

26
public/404.html Normal file → Executable file
View file

@ -1,8 +1,26 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body> <body>
<h1>File not found</h1> <!-- This file lives in public/404.html -->
<p>Change this error message for pages not found in public/404.html</p> <div class="dialog">
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
</body> </body>
</html> </html>

26
public/422.html Executable file
View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>The change you wanted was rejected (422)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/422.html -->
<div class="dialog">
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show more