zena 0.15.2 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +20 -0
- data/CREDITS +27 -0
- data/Capfile +3 -0
- data/DEVELOPERS +46 -0
- data/History.txt +15 -0
- data/MIT-LICENSE +19 -0
- data/Rakefile +44 -0
- data/TODO +24 -0
- data/TODO_ZENA_1_0 +23 -0
- data/app/controllers/application_controller.rb +3 -0
- data/app/controllers/documents_controller.rb +22 -56
- data/app/controllers/nodes_controller.rb +42 -27
- data/app/controllers/pings_controller.rb +19 -0
- data/app/controllers/relations_controller.rb +5 -1
- data/app/controllers/sites_controller.rb +1 -46
- data/app/controllers/user_sessions_controller.rb +47 -0
- data/app/controllers/users_controller.rb +1 -0
- data/app/controllers/versions_controller.rb +25 -7
- data/app/controllers/virtual_classes_controller.rb +1 -1
- data/app/helpers/application_helper.rb +1 -1
- data/app/models/comment.rb +2 -1
- data/app/models/contact_content.rb +2 -2
- data/app/models/data_entry.rb +5 -6
- data/app/models/document.rb +14 -10
- data/app/models/document_content.rb +4 -6
- data/app/models/iformat.rb +2 -2
- data/app/models/image_content.rb +6 -9
- data/app/models/node.rb +106 -164
- data/app/models/page.rb +0 -20
- data/app/models/site.rb +42 -12
- data/app/models/template.rb +3 -8
- data/app/models/template_content.rb +2 -0
- data/app/models/text_document.rb +13 -8
- data/app/models/user.rb +47 -100
- data/app/models/user_session.rb +4 -0
- data/app/models/version.rb +1 -1
- data/app/views/comments/create.rjs +3 -3
- data/app/views/comments/edit.rjs +1 -1
- data/app/views/comments/update.rjs +1 -1
- data/app/views/nodes/_import_results.rhtml +1 -1
- data/app/views/nodes/create.rjs +3 -3
- data/app/views/templates/document_create_tabs/_file.rhtml +1 -2
- data/app/views/templates/document_create_tabs/_import.rhtml +7 -2
- data/app/views/templates/edit_tabs/_document.rhtml +1 -3
- data/app/views/templates/edit_tabs/_image.rhtml +1 -3
- data/app/views/versions/_tr.rhtml +1 -1
- data/app/views/versions/edit.rhtml +2 -26
- data/bin/zena +6 -1
- data/bricks/delayed_job/README +18 -0
- data/bricks/delayed_job/migrate/20091104191643_create_delayed_jobs_table.rb +19 -0
- data/bricks/delayed_job/misc/init.rb +8 -0
- data/bricks/delayed_job/misc/tasks.rb +2 -0
- data/bricks/math/patch/application_helper.rb +1 -1
- data/bricks/sphinx/MIT-LICENSE +19 -0
- data/bricks/sphinx/README +19 -0
- data/bricks/sphinx/lib/use_sphinx.rb +78 -0
- data/bricks/sphinx/migrate/20091102171258_add_delta_for_sphinx.rb +9 -0
- data/bricks/sphinx/misc/deploy.rb +20 -0
- data/bricks/sphinx/misc/sphinx.yml +12 -0
- data/bricks/sphinx/misc/tasks.rb +21 -0
- data/bricks/sphinx/patch/node.rb +8 -0
- data/bricks/tags/lib/has_tags.rb +5 -3
- data/bricks/tags/test/zafu/tags.yml +13 -1
- data/config/bricks.yml +35 -0
- data/config/deploy.rb +8 -1
- data/config/environment.rb +1 -1
- data/config/environments/production.rb +1 -1
- data/config/gems.yml +28 -5
- data/config/sphinx.yml +12 -0
- data/db/init/base/skins/default/Node-+popupLayout.zafu +1 -16
- data/db/migrate/20091026161708_add_persistence_token.rb +13 -0
- data/db/migrate/20091101184952_add_session_table.rb +16 -0
- data/db/migrate/20091123175137_add_single_access_token.rb +9 -0
- data/db/migrate/20091124161608_rebuild_fullpath.rb +11 -0
- data/db/schema.rb +21 -8
- data/doc/README_FOR_APP +24 -0
- data/doc/fixtures.graffle +19568 -0
- data/doc/fixtures.pdf +0 -0
- data/doc/template/LICENSE +184 -0
- data/doc/template/README +37 -0
- data/doc/template/allison.css +283 -0
- data/doc/template/allison.js +307 -0
- data/doc/template/allison.rb +260 -0
- data/doc/template/cache/BODY +588 -0
- data/doc/template/cache/CLASS_INDEX +4 -0
- data/doc/template/cache/CLASS_PAGE +1 -0
- data/doc/template/cache/FILE_INDEX +4 -0
- data/doc/template/cache/FILE_PAGE +1 -0
- data/doc/template/cache/FONTS +1 -0
- data/doc/template/cache/FR_INDEX_BODY +1 -0
- data/doc/template/cache/IMGPATH +1 -0
- data/doc/template/cache/INDEX +1 -0
- data/doc/template/cache/JAVASCRIPT +307 -0
- data/doc/template/cache/METHOD_INDEX +4 -0
- data/doc/template/cache/METHOD_LIST +1 -0
- data/doc/template/cache/SRC_PAGE +1 -0
- data/doc/template/cache/STYLE +283 -0
- data/doc/template/cache/URL +1 -0
- data/doc/zafu_changes.yml +29 -0
- data/lib/base_additions.rb +1 -1
- data/lib/bricks.rb +9 -0
- data/lib/bricks/loader.rb +86 -0
- data/lib/bricks/requirements_validation.rb +71 -0
- data/lib/tasks/zena.rake +42 -4
- data/lib/zafu/action.rb +285 -0
- data/lib/zafu/ajax.rb +93 -0
- data/lib/zafu/attributes.rb +117 -0
- data/lib/zafu/calendar.rb +159 -0
- data/lib/zafu/context.rb +330 -0
- data/lib/zafu/core/html.rb +102 -0
- data/lib/zafu/core/move_to_parser.rb +167 -0
- data/lib/zafu/dates.rb +58 -0
- data/lib/zafu/display.rb +502 -0
- data/lib/zafu/eval.rb +66 -0
- data/lib/zafu/experimental.rb +66 -0
- data/lib/zafu/i18n.rb +64 -0
- data/lib/zafu/meta.rb +25 -0
- data/lib/zafu/refactor.rb +73 -0
- data/lib/zafu/support/context.rb +265 -0
- data/lib/zafu/support/dom.rb +145 -0
- data/lib/zafu/support/erb.rb +62 -0
- data/lib/zafu/support/flow.rb +401 -0
- data/lib/zafu/support/forms.rb +461 -0
- data/lib/zafu/support/links.rb +306 -0
- data/lib/zafu_parser.rb +26 -2
- data/lib/zena.rb +34 -15
- data/lib/zena/acts/multiversion.rb +2 -2
- data/lib/zena/acts/secure.rb +41 -30
- data/lib/zena/app.rb +7 -10
- data/lib/zena/controller/test_case.rb +12 -7
- data/lib/zena/crypto_provider/initial.rb +15 -0
- data/lib/zena/db.rb +6 -1
- data/lib/zena/deploy.rb +34 -6
- data/lib/zena/deploy/logrotate_app.rhtml +9 -0
- data/lib/zena/deploy/logrotate_host.rhtml +34 -0
- data/lib/zena/deploy/template.rb +1 -9
- data/lib/zena/foxy_parser.rb +1 -1
- data/lib/zena/info.rb +3 -1
- data/lib/zena/migrator.rb +1 -1
- data/lib/zena/parser.rb +12 -4
- data/lib/zena/parser/zazen_rules.rb +6 -6
- data/lib/zena/parser/zena_rules.rb +1 -7
- data/lib/zena/routes.rb +5 -5
- data/lib/zena/test_controller.rb +7 -2
- data/lib/zena/unit/test_case.rb +6 -8
- data/lib/zena/use/ajax.rb +10 -10
- data/lib/zena/use/authlogic.rb +93 -0
- data/lib/zena/use/dyn_attributes.rb +5 -0
- data/lib/zena/use/html_tags.rb +16 -34
- data/lib/zena/use/i18n.rb +4 -1
- data/lib/zena/use/node_query_finders.rb +8 -4
- data/lib/zena/use/refactor.rb +8 -20
- data/lib/zena/use/relations.rb +1 -0
- data/lib/zena/use/rendering.rb +4 -2
- data/lib/zena/use/search.rb +52 -0
- data/lib/zena/use/test_helper.rb +27 -28
- data/lib/zena/use/upload.rb +188 -0
- data/lib/zena/use/urls.rb +16 -14
- data/lib/zena/use/zafu.rb +16 -63
- data/lib/zena/use/zazen.rb +8 -8
- data/lib/zena/view/test_case.rb +8 -4
- data/locale/en/LC_MESSAGES/zena.mo +0 -0
- data/locale/en/zena.po +3 -3
- data/public/.htaccess +40 -0
- data/public/javascripts/upload-progress.js +17 -8
- data/public/javascripts/zena.js +8 -2
- data/public/stylesheets/popup.css +1 -0
- data/script/about +3 -0
- data/script/apache_logging +25 -0
- data/script/breakpointer +3 -0
- data/script/console +3 -0
- data/script/dbconsole +3 -0
- data/script/destroy +3 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/plugin +3 -0
- data/script/process/inspector +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/script/set_revision +29 -0
- data/spec/controllers/versions_controller_spec.rb +11 -0
- data/test/fixtures/files/Node-test.zafu +1 -1
- data/test/functional/nodes_controller_test.rb +25 -0
- data/test/functional/pings_controller_test.rb +8 -0
- data/test/functional/user_sessions_controller_test.rb +59 -0
- data/test/functional/users_controller_test.rb +81 -19
- data/test/helpers/node_query/filters.yml +5 -0
- data/test/helpers/node_query_test.rb +3 -3
- data/test/integration/multiple_hosts_test.rb +1 -1
- data/test/integration/navigation_test.rb +1 -1
- data/test/sites/complex/users.yml +1 -1
- data/test/sites/ocean/users.yml +3 -3
- data/test/sites/zena/users.yml +5 -4
- data/test/test_zena.rb +38 -38
- data/test/unit/cached_page_test.rb +2 -2
- data/test/unit/comment_test.rb +0 -1
- data/test/unit/document_test.rb +23 -11
- data/test/unit/helpers/ping_helper_test.rb +4 -0
- data/test/unit/multiversion_test.rb +24 -16
- data/test/unit/node_test.rb +32 -93
- data/test/unit/note_test.rb +9 -0
- data/test/unit/page_test.rb +2 -2
- data/test/unit/secure_test.rb +2 -12
- data/test/unit/site_test.rb +43 -24
- data/test/unit/template_test.rb +45 -3
- data/test/unit/text_document_test.rb +4 -3
- data/test/unit/user_test.rb +13 -33
- data/test/unit/zena/db_test.rb +8 -0
- data/test/unit/zena/parser/zazen.yml +4 -4
- data/test/unit/zena/use/dates_view_methods_test.rb +2 -1
- data/test/unit/zena/use/html_tags_test.rb +12 -4
- data/test/unit/zena/use/refactor_test.rb +4 -3
- data/test/unit/zena/use/rendering_test.rb +1 -0
- data/test/unit/zena/use/upload_test.rb +76 -0
- data/test/unit/zena/use/urls_test.rb +4 -0
- data/test/unit/zena/use/zafu_test.rb +8 -0
- data/test/unit/zena/workflow/status_version_test.rb +6 -0
- data/test/unit/zena/zena_tags/ajax.yml +4 -4
- data/test/unit/zena/zena_tags/basic.yml +21 -10
- data/test/unit/zena/zena_tags/relations.yml +0 -6
- data/test/unit/zena/zena_tags/rubyless.yml +35 -0
- data/test/unit/zena/zena_tags/zazen.yml +4 -4
- data/test/unit/zena/zena_tags_test.rb +36 -4
- data/vendor/TextMate/Zena.tmbundle/Commands/Run all yaml tests.tmCommand +1 -1
- data/vendor/TextMate/Zena.tmbundle/Commands/Run focused yaml test.tmCommand +2 -3
- data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/catch_exception.rb +39 -0
- data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/run_script.rb +102 -58
- data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/stdin_dialog.rb +14 -0
- data/vendor/TextMate/Zena.tmbundle/info.plist +2 -0
- data/zena.gemspec +2085 -0
- metadata +265 -90
- data/app/controllers/sessions_controller.rb +0 -41
- data/app/views/sites/zena_up.html.erb +0 -11
- data/config/database.yml +0 -40
- data/db/production.sqlite3 +0 -0
- data/lib/bricks/patcher.rb +0 -68
- data/lib/zena/parser/zena_tags.rb +0 -3562
- data/lib/zena/use/authentification.rb +0 -120
- data/public/images/ext/contact_pv.png +0 -0
- data/public/images/ext/other_pv.png +0 -0
- data/public/images/ext/page_pv.png +0 -0
- data/public/images/ext/page_tiny.png +0 -0
- data/public/images/ext/pdf_pv.png +0 -0
- data/public/images/ext/post_pv.png +0 -0
- data/public/images/ext/post_tiny.png +0 -0
- data/public/images/ext/project_pv.png +0 -0
- data/public/images/ext/project_tiny.png +0 -0
- data/public/images/ext/tag_pv.png +0 -0
- data/public/images/ext/zip_pv.png +0 -0
- data/tasks/ann.rake +0 -80
- data/tasks/bones.rake +0 -20
- data/tasks/gem.rake +0 -201
- data/tasks/git.rake +0 -40
- data/tasks/notes.rake +0 -27
- data/tasks/post_load.rake +0 -34
- data/tasks/rdoc.rake +0 -51
- data/tasks/rubyforge.rake +0 -55
- data/tasks/setup.rb +0 -292
- data/tasks/spec.rake +0 -54
- data/tasks/svn.rake +0 -47
- data/tasks/test.rake +0 -40
- data/tasks/zentest.rake +0 -36
- data/test/fixtures/comments.yml +0 -126
- data/test/fixtures/contact_contents.yml +0 -132
- data/test/fixtures/data_entries.yml +0 -65
- data/test/fixtures/discussions.yml +0 -48
- data/test/fixtures/document_contents.yml +0 -108
- data/test/fixtures/dyn_attributes.yml +0 -66
- data/test/fixtures/groups.yml +0 -86
- data/test/fixtures/groups_users.yml +0 -81
- data/test/fixtures/iformats.yml +0 -29
- data/test/fixtures/links.yml +0 -313
- data/test/fixtures/nodes.yml +0 -2592
- data/test/fixtures/relations.yml +0 -126
- data/test/fixtures/sites.yml +0 -58
- data/test/fixtures/template_contents.yml +0 -172
- data/test/fixtures/users.yml +0 -167
- data/test/fixtures/versions.yml +0 -1911
- data/test/fixtures/virtual_classes.yml +0 -87
- data/test/fixtures/zips.yml +0 -15
- data/test/functional/sessions_controller_test.rb +0 -73
data/.gitignore
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
.DS_Store
|
2
|
+
config/deploy_config.rb
|
3
|
+
config/database.yml
|
4
|
+
config/*.sphinx.conf
|
5
|
+
db/sphinx
|
6
|
+
doc/coverage
|
7
|
+
log/
|
8
|
+
pkg/*
|
9
|
+
public/images/ext/*_pv.png
|
10
|
+
public/images/ext/*_std.png
|
11
|
+
public/images/ext/*_tiny.png
|
12
|
+
public/images/ext/*_mini.png
|
13
|
+
REVISION
|
14
|
+
sandbox
|
15
|
+
sites/*
|
16
|
+
test/fixtures/*.yml
|
17
|
+
tmp/*
|
18
|
+
db/*.sqlite3
|
19
|
+
coverage
|
20
|
+
vendor/apache2_upload_progress/*
|
data/CREDITS
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
javascript date selection
|
2
|
+
-------------------------
|
3
|
+
Mihai Bazon
|
4
|
+
http://dynarch.com
|
5
|
+
adapted to Rails by Gaspard Bucher
|
6
|
+
|
7
|
+
tablekit table editor
|
8
|
+
---------------------
|
9
|
+
Andrew Tetlaw & Millstream Web Software
|
10
|
+
http://www.millstream.com.au/view/code/tablekit/
|
11
|
+
add/remove columns and drag&drop support added by Gaspard Bucher
|
12
|
+
|
13
|
+
soft icons
|
14
|
+
----------
|
15
|
+
Mark James
|
16
|
+
http://www.famfamfam.com/lab/icons/silk/
|
17
|
+
|
18
|
+
xspf mp3 player
|
19
|
+
---------------
|
20
|
+
Fabricio Zuardi
|
21
|
+
http://musicplayer.sourceforge.net/
|
22
|
+
|
23
|
+
upload progress bar (sample application demo)
|
24
|
+
-------------------
|
25
|
+
Tim
|
26
|
+
http://itblog.mcgeecorp.com/articles/2007/05/15/mongrel-upload-progress-demo
|
27
|
+
|
data/Capfile
ADDED
data/DEVELOPERS
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
style
|
2
|
+
=====
|
3
|
+
|
4
|
+
Please strip trailing whitespace from your files before commit. You can "strip on save"
|
5
|
+
in TextMate (http://blogobaggins.com/2009/03/31/waging-war-on-whitespace.html#fn3) or
|
6
|
+
any other well built editor.
|
7
|
+
|
8
|
+
==== start server with mongrel upload progress (done through mongrel)
|
9
|
+
> lib/upload_progress_server.rb start
|
10
|
+
> mongrel_rails start -s config/mongrel_upload_progress.conf
|
11
|
+
|
12
|
+
==== development using passenger
|
13
|
+
Install version >= 2.1.1, install mod_upload_progress (file in vendor/apache_upload)
|
14
|
+
|
15
|
+
example config:
|
16
|
+
-------------------
|
17
|
+
ServerName test.host
|
18
|
+
|
19
|
+
LoadModule upload_progress_module libexec/apache2/mod_upload_progress.so
|
20
|
+
LoadModule passenger_module /Users/gaspard/git/passenger/ext/apache2/mod_passenger.so
|
21
|
+
PassengerRoot /Users/gaspard/git/passenger
|
22
|
+
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
|
23
|
+
|
24
|
+
<VirtualHost test.host>
|
25
|
+
ServerName test.host
|
26
|
+
DocumentRoot /Users/gaspard/git/zena/sites/test.host/public
|
27
|
+
CustomLog "/Users/gaspard/git/zena/sites/test.host/log/access.log" common
|
28
|
+
ErrorLog "/Users/gaspard/git/zena/sites/test.host/log/error.log"
|
29
|
+
|
30
|
+
PassengerAppRoot /Users/gaspard/git/zena
|
31
|
+
RailsEnv production
|
32
|
+
|
33
|
+
<Directory /Users/gaspard/git/zena/sites/test.host/public>
|
34
|
+
Order deny,allow
|
35
|
+
Allow from all
|
36
|
+
</Directory>
|
37
|
+
|
38
|
+
<Location />
|
39
|
+
TrackUploads On
|
40
|
+
</Location>
|
41
|
+
|
42
|
+
<Location /upload_progress>
|
43
|
+
ReportUploads On
|
44
|
+
</Location>
|
45
|
+
</VirtualHost>
|
46
|
+
-------------------
|
data/History.txt
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
== 0.16.0 2010-01-15
|
2
|
+
|
3
|
+
* 3 major enhancements:
|
4
|
+
* Sphinx search support
|
5
|
+
* Authlogic authentification
|
6
|
+
* attachments can now be provided with an url
|
7
|
+
* added [node:attribute_name] to use in querybuilder
|
8
|
+
|
9
|
+
* 5 minor enhancement
|
10
|
+
* logrotate setup support with capistrano
|
11
|
+
* fixed contact content zip bug
|
12
|
+
* fixed fullpath set to NULL instead of kept in sync
|
13
|
+
* fixed zafu generated partials not reloaded bug
|
14
|
+
* using jeweler instead of bones for gem management
|
15
|
+
|
1
16
|
== 0.15.2 2010-01-06
|
2
17
|
|
3
18
|
* 1 minor enhancement
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2007-2009 Gaspard Bucher
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
+
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/testtask'
|
8
|
+
require 'rake/rdoctask'
|
9
|
+
|
10
|
+
require 'tasks/rails'
|
11
|
+
|
12
|
+
task :default => 'zena:test'
|
13
|
+
|
14
|
+
require 'zena'
|
15
|
+
|
16
|
+
# GEM management
|
17
|
+
begin
|
18
|
+
require 'jeweler'
|
19
|
+
Jeweler::Tasks.new do |gemspec|
|
20
|
+
gemspec.name = 'zena'
|
21
|
+
gemspec.summary = 'CMS with super natural powers, based on Ruby on Rails'
|
22
|
+
gemspec.description = "zena is a Ruby on Rails CMS (content managment system) with a focus on usability, ease of customization and web 2.0 goodness (application like behaviour)."
|
23
|
+
gemspec.email = "gaspard@teti.ch"
|
24
|
+
gemspec.homepage = "http://zenadmin.org"
|
25
|
+
gemspec.authors = ['Gaspard Bucher']
|
26
|
+
gemspec.version = Zena::VERSION
|
27
|
+
gemspec.rubyforge_project = 'zena'
|
28
|
+
|
29
|
+
# Gem dependecies
|
30
|
+
Zena.gem_configuration.each do |gem_name, gem_config|
|
31
|
+
if gem_config
|
32
|
+
if gem_config['development_only']
|
33
|
+
gemspec.add_development_dependency(gem_name, gem_config['version'])
|
34
|
+
else
|
35
|
+
gemspec.add_dependency(gem_name, gem_config['version'])
|
36
|
+
end
|
37
|
+
else
|
38
|
+
gemspec.add_dependency(gem_name)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
rescue LoadError
|
43
|
+
puts "Jeweler not available. Gem packaging tasks not available."
|
44
|
+
end
|
data/TODO
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
== Parts that need an urgent cleanup ==
|
2
|
+
|
3
|
+
Some parts of zena have become really messy and need an URGENT cleanup. These parts are mostly
|
4
|
+
related to nested attributes and the cleanup should be made during the move to rails 2.3+.
|
5
|
+
|
6
|
+
Some really ugly parts:
|
7
|
+
|
8
|
+
=== links ===
|
9
|
+
|
10
|
+
We support many different ways to alter links and it's becoming hard to maintain:
|
11
|
+
|
12
|
+
node[hot_id] = ZIP
|
13
|
+
node[link][hot][other_id] = ZIP
|
14
|
+
node[link][1][other_id] = ZIP along with node[link][1][role] = 'hot'
|
15
|
+
link[other_id] = ZIP
|
16
|
+
link[other_zip] = ZIP
|
17
|
+
|
18
|
+
We need 'other_zip' because select_id helper needs to read the value... "select_id" is really bad code. yuk.
|
19
|
+
|
20
|
+
===== documentation ======
|
21
|
+
|
22
|
+
using negative ids to remove links:
|
23
|
+
|
24
|
+
friend_id = -ZIP ====> ensure there is no 'friend' relationship with node ZIP.
|
data/TODO_ZENA_1_0
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
List of things to discuss
|
2
|
+
=========================
|
3
|
+
|
4
|
+
Relation between zena, custom applications and bricks:
|
5
|
+
|
6
|
+
1. custom models
|
7
|
+
2. custom migrations
|
8
|
+
3. custom zafu rules
|
9
|
+
4. custom tests
|
10
|
+
|
11
|
+
Folder structure should be like a rails application with some elements missing (all zena controllers, views, helpers, etc). It
|
12
|
+
should still launch in Passenger and all other servers like mongrel.
|
13
|
+
|
14
|
+
my_app
|
15
|
+
+-- app (same structure as a brick)
|
16
|
+
| +-- models (custom application stuff)
|
17
|
+
| +-- controllers
|
18
|
+
| +-- helpers
|
19
|
+
| +-- zafu (custom zafu tags)
|
20
|
+
+-- bricks
|
21
|
+
+-- config
|
22
|
+
+-- sites
|
23
|
+
+-- vendor
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class DocumentsController < ApplicationController
|
2
|
-
before_filter :find_node, :except => [ :
|
2
|
+
before_filter :find_node, :except => [ :get_uf, :upload_progress ]
|
3
3
|
|
4
4
|
skip_before_filter :set_lang, :only => :upload_progress
|
5
5
|
skip_before_filter :authorize, :only => :upload_progress
|
@@ -44,57 +44,29 @@ class DocumentsController < ApplicationController
|
|
44
44
|
def upload
|
45
45
|
create_document
|
46
46
|
|
47
|
-
responds_to_parent do # execute the redirect in the
|
47
|
+
responds_to_parent do # execute the redirect in the iframe's parent window
|
48
48
|
render :update do |page|
|
49
|
-
|
50
|
-
|
51
|
-
page.
|
49
|
+
if @node.new_record?
|
50
|
+
page.replace_html 'form_errors', error_messages_for(@node)
|
51
|
+
page.call 'UploadProgress.setAsError'
|
52
|
+
else
|
53
|
+
page.call 'UploadProgress.setAsFinished'
|
54
|
+
page.delay(1) do # allow the progress bar fade to complete
|
55
|
+
page.redirect_to document_url(@node[:zip])
|
56
|
+
end
|
52
57
|
end
|
53
58
|
end
|
54
59
|
end
|
55
60
|
end
|
56
61
|
|
57
62
|
def upload_progress
|
58
|
-
|
59
|
-
# <Location /upload_progress>
|
60
|
-
# ReportUploads On
|
61
|
-
# </Location>
|
62
|
-
#
|
63
|
-
# When using Mongrel: mimic apache2 mod_upload_progress
|
64
|
-
#
|
65
|
-
# if (!found) {
|
66
|
-
# response = apr_psprintf(r->pool, "new Object({ 'state' : 'starting' })");
|
67
|
-
# } else if (err_status >= HTTP_BAD_REQUEST ) {
|
68
|
-
# response = apr_psprintf(r->pool, "new Object({ 'state' : 'error', 'status' : %d })", err_status);
|
69
|
-
# } else if (done) {
|
70
|
-
# response = apr_psprintf(r->pool, "new Object({ 'state' : 'done' })");
|
71
|
-
# } else if ( length == 0 && received == 0 ) {
|
72
|
-
# response = apr_psprintf(r->pool, "new Object({ 'state' : 'starting' })");
|
73
|
-
# } else {
|
74
|
-
# response = apr_psprintf(r->pool, "new Object({ 'state' : 'uploading', 'received' : %d, 'size' : %d, 'speed' : %d })", received, length, speed);
|
75
|
-
# }
|
76
|
-
render :update do |page|
|
77
|
-
begin
|
78
|
-
@status = Mongrel::Uploads.check(params[:"X-Progress-ID"])
|
79
|
-
if @status
|
80
|
-
if @status[:received] != @status[:size]
|
81
|
-
page << "new Object({ 'state' : 'uploading', 'received' : #{@status[:received]}, 'size' : #{@status[:size]} })"
|
82
|
-
else
|
83
|
-
page << "new Object({ 'state' : 'done' })"
|
84
|
-
end
|
85
|
-
else
|
86
|
-
#page << "new Object({ 'state' : 'done' })"
|
87
|
-
end
|
88
|
-
rescue NameError
|
89
|
-
page << "new Object({ 'state' : 'upload in progress..' })"
|
90
|
-
end
|
91
|
-
end
|
63
|
+
render_upload_progress
|
92
64
|
end
|
93
65
|
|
94
66
|
# TODO: test
|
95
67
|
# display an upload field.
|
96
|
-
def
|
97
|
-
|
68
|
+
def get_uf
|
69
|
+
render_get_uf
|
98
70
|
end
|
99
71
|
|
100
72
|
# TODO: test
|
@@ -120,22 +92,16 @@ class DocumentsController < ApplicationController
|
|
120
92
|
|
121
93
|
def create_document
|
122
94
|
attrs = params['node']
|
123
|
-
|
124
|
-
attrs[
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
end
|
133
|
-
(class << attrs['c_file']; self; end;).class_eval do
|
134
|
-
define_method(:content_type) { content_type }
|
135
|
-
define_method(:original_filename) { attrs['name'] || 'file.txt' }
|
136
|
-
end
|
95
|
+
file, error = get_attachment
|
96
|
+
attrs['c_file'] = file if file
|
97
|
+
attrs['klass'] ||= 'Document'
|
98
|
+
if error
|
99
|
+
@node = secure!(Document) { Document.new }
|
100
|
+
@node.attributes = attrs
|
101
|
+
@node.errors.add('c_file', error)
|
102
|
+
else
|
103
|
+
@node = secure!(Document) { Document.create_node(attrs) }
|
137
104
|
end
|
138
|
-
@node = secure!(Document) { Document.create_node(attrs) }
|
139
105
|
end
|
140
106
|
|
141
107
|
end
|
@@ -118,10 +118,10 @@ class NodesController < ApplicationController
|
|
118
118
|
# math rendered as png, ...
|
119
119
|
filename = "#{asset}.#{params[:format]}"
|
120
120
|
content_path = @node.asset_path(filename)
|
121
|
-
content_type = (EXT_TO_TYPE[params[:format]] || ['application/octet-stream'])[0]
|
121
|
+
content_type = (Zena::EXT_TO_TYPE[params[:format]] || ['application/octet-stream'])[0]
|
122
122
|
send_file(content_path, :filename=>filename, :type => content_type, :disposition=>'inline', :x_sendfile => ENABLE_XSENDFILE)
|
123
123
|
cache_page(:content_path => content_path, :authenticated => @node.public?) # content_path is used to cache by creating a symlink
|
124
|
-
elsif @node.kind_of?(Document) && params[:format] == @node.
|
124
|
+
elsif @node.kind_of?(Document) && params[:format] == @node.version.content.ext
|
125
125
|
# Get document data (inline if possible)
|
126
126
|
content_path = nil
|
127
127
|
|
@@ -160,7 +160,14 @@ class NodesController < ApplicationController
|
|
160
160
|
|
161
161
|
def create
|
162
162
|
attrs = params['node']
|
163
|
+
file, file_error = get_attachment
|
164
|
+
if file
|
165
|
+
attrs['c_file'] = file
|
166
|
+
attrs['klass'] = 'Document'
|
167
|
+
end
|
168
|
+
|
163
169
|
@node = secure!(Node) { Node.create_node(attrs) }
|
170
|
+
@node.errors.add('c_file', file_error) if file_error
|
164
171
|
|
165
172
|
respond_to do |format|
|
166
173
|
if @node.errors.empty?
|
@@ -213,20 +220,28 @@ class NodesController < ApplicationController
|
|
213
220
|
if klass == 'Skin' && !defaults.has_key?('v_status')
|
214
221
|
defaults['v_status'] = Zena::Status[:pub]
|
215
222
|
end
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
223
|
+
attachment, error = get_attachment
|
224
|
+
if error
|
225
|
+
responds_to_parent do
|
226
|
+
page.replace 'form_errors', error
|
227
|
+
end
|
228
|
+
else
|
229
|
+
# TODO: UploadProgress.setAsProcessing..... would be nice...
|
230
|
+
@nodes = secure!(Node) { Node.create_nodes_from_folder(
|
231
|
+
:klass => klass,
|
232
|
+
:archive => attachment,
|
233
|
+
:parent => @node,
|
234
|
+
:defaults => defaults
|
235
|
+
)}.values
|
236
|
+
# parse pseudo_ids
|
237
|
+
parse_assets(@nodes)
|
238
|
+
|
239
|
+
responds_to_parent do # execute the redirect in the main window
|
240
|
+
render :update do |page|
|
241
|
+
page.call 'UploadProgress.setAsFinished'
|
242
|
+
page.delay(1) do # allow the progress bar fade to complete
|
243
|
+
page.replace_html 'import_tab', :partial => 'import_results'
|
244
|
+
end
|
230
245
|
end
|
231
246
|
end
|
232
247
|
end
|
@@ -237,9 +252,12 @@ class NodesController < ApplicationController
|
|
237
252
|
end
|
238
253
|
|
239
254
|
def update
|
240
|
-
|
255
|
+
file, file_error = get_attachment
|
256
|
+
params['node']['c_file'] = file if file
|
257
|
+
|
241
258
|
@v_status_before_update = @node.v_status
|
242
259
|
@node.update_attributes_with_transformation(params['node'])
|
260
|
+
@node.errors.add('c_file', file_error) if file_error
|
243
261
|
|
244
262
|
if @node.errors.empty?
|
245
263
|
flash.now[:notice] = _('node updated')
|
@@ -247,8 +265,8 @@ class NodesController < ApplicationController
|
|
247
265
|
flash.now[:error] = _('could not update')
|
248
266
|
end
|
249
267
|
|
250
|
-
if params[:
|
251
|
-
responds_to_parent do # execute the redirect in the
|
268
|
+
if params[:iframe]
|
269
|
+
responds_to_parent do # execute the redirect in the iframe's parent window
|
252
270
|
render :update do |page|
|
253
271
|
page.call "UploadProgress.setAsFinished"
|
254
272
|
page.delay(1) do # allow the progress bar fade to complete
|
@@ -265,7 +283,7 @@ class NodesController < ApplicationController
|
|
265
283
|
redirect_to zen_path(@node, :mode => params[:mode])
|
266
284
|
end
|
267
285
|
end
|
268
|
-
format.js
|
286
|
+
format.js { @flash = flash }
|
269
287
|
end
|
270
288
|
end
|
271
289
|
end
|
@@ -458,17 +476,14 @@ class NodesController < ApplicationController
|
|
458
476
|
|
459
477
|
def do_search
|
460
478
|
@node = current_site.root_node
|
461
|
-
|
462
|
-
|
463
|
-
@
|
464
|
-
@nodes_previous_page, @nodes, @nodes_next_page = Node.find_with_pagination(:all,query.merge(:per_page => 10, :page => params[:page]))
|
465
|
-
@nodes # important: this is the 'secure' yield return, it is used to secure found nodes
|
466
|
-
end
|
479
|
+
@search_per_page = params[:per_page] ? params[:per_page].to_i : 20
|
480
|
+
@nodes = secure(Node) { Node.search_records(params[:q], :node => @node, :page => params[:page], :per_page => @search_per_page) }
|
481
|
+
@search_count = 100 # FIXME: @nodes ? @nodes.total_entries : 0
|
467
482
|
end
|
468
483
|
|
469
484
|
# Document data do not change session[:lang] and can point at cached content (no nee to redirect to AUTHENTICATED_PREFIX).
|
470
485
|
def avoid_prefix_redirect
|
471
|
-
@node.kind_of?(Document) && params[:format] == @node.
|
486
|
+
@node.kind_of?(Document) && params[:format] == @node.version.content.ext
|
472
487
|
end
|
473
488
|
|
474
489
|
# Transform pseudo id into absolute paths (used after import)
|