Changeset 1215
- Timestamp:
- 2008-10-05 15:58:26 (3 months ago)
- Files:
-
- trunk/app/models/contact_version.rb (modified) (1 diff)
- trunk/app/models/node.rb (modified) (3 diffs)
- trunk/config/zena.rb (modified) (2 diffs)
- trunk/db/init/base/skins/default/Node.zafu (modified) (1 diff)
- trunk/lib/multiversion.rb (modified) (2 diffs)
- trunk/lib/parser/lib/rules/zena.rb (modified) (1 diff)
- trunk/test/unit/node_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/app/models/contact_version.rb
r1192 r1215 31 31 end 32 32 33 old = node.old_version34 return true if old .nil?33 old_title = node.old_title 34 return true if old_title.nil? 35 35 # what changed ? 36 title_changed = title != old .title36 title_changed = title != old_title 37 37 fullname_changed = content.fullname != @old_fullname 38 38 # 1. both 39 39 if title_changed && fullname_changed 40 40 # ignore 41 elsif fullname_changed && node.old_ version.title == @old_fullname41 elsif fullname_changed && node.old_title == @old_fullname 42 42 # content changed and title was in sync 43 43 self.title = content.fullname trunk/app/models/node.rb
r1197 r1215 128 128 =end 129 129 class Node < ActiveRecord::Base 130 attr_accessor :link, :old_ version130 attr_accessor :link, :old_title 131 131 zafu_readable :name, :created_at, :updated_at, :event_at, :log_at, :kpath, :user_zip, :parent_zip, :project_zip, 132 132 :section_zip, :skin, :ref_lang, :fullpath, :rootpath, :position, :publish_from, :max_status, :rgroup_id, … … 486 486 define_method(:read) do 487 487 if insert_zafu_headings 488 o_read.sub(%r{</head>}," <r:stylesheets/>\n <r:javascripts/>\n </head>")488 o_read.sub(%r{</head>}," <r:stylesheets/>\n <r:javascripts/>\n <r:uses_calendar/>\n</head>") 489 489 else 490 490 o_read … … 1558 1558 # Try to keep node name in sync with published v_title in ref_lang. This is set after_publish. 1559 1559 def sync_name 1560 return true if @old_ version.nil? || version.lang != ref_lang || name == version.title.url_name || old.name != @old_version.title.url_name1560 return true if @old_title.nil? || version.lang != ref_lang || name == version.title.url_name || old.name != @old_title.url_name 1561 1561 update_attributes(:name => version.title.url_name) 1562 1562 end trunk/config/zena.rb
r1185 r1215 3 3 require 'uuidtools' 4 4 require "#{RAILS_ROOT}/config/version" 5 require 'fileutils' 6 5 7 AUTHENTICATED_PREFIX = "oo" 6 8 SITES_ROOT = "#{RAILS_ROOT}/sites" … … 22 24 puts "\n** WARNING: drb server not running. Upload progress will not work." 23 25 puts " * WARNING: you should start the drb server with 'lib/upload_progress_server.rb start'\n\n" 26 end 27 28 unless File.exist?(File.join(File.dirname(__FILE__), 'database.yml')) 29 FileUtils.cp(File.join(File.dirname(__FILE__), 'database_example.yml'), File.join(File.dirname(__FILE__), 'database.yml')) 30 end 31 32 unless File.exist?(File.join(File.dirname(__FILE__), '..', 'log')) 33 FileUtils.mkpath(File.join(File.dirname(__FILE__), '..', 'log')) 24 34 end 25 35 trunk/db/init/base/skins/default/Node.zafu
r1212 r1215 11 11 </r:void> 12 12 13 <r:javascripts list='prototype,effects,zena'/>13 <r:javascripts/> 14 14 <r:uses_calendar/> 15 15 </head> trunk/lib/multiversion.rb
r1192 r1215 484 484 485 485 if ok && publish_after_save 486 if can_apply?(:publish) 486 if v_status == Zena::Status[:pub] 487 ok = after_publish && update_publish_from 488 elsif can_apply?(:publish) 487 489 ok = apply(:publish) 488 490 elsif can_apply?(:propose) … … 545 547 546 548 if v && (v.user_id == visitor[:id]) && (v.status == Zena::Status[:red] || redit) 547 @old_ version = @version548 @redaction = @version = v549 @old_title = @version.title # node sync_name leaking here... 550 @redaction = @version = v 549 551 elsif v 550 552 errors.add('base', "(#{v.user.login}) is editing this node") trunk/lib/parser/lib/rules/zena.rb
r1211 r1215 3038 3038 elsif node_kind_of?(Node) 3039 3039 "<%= #{node}.v_title %>" 3040 elsif node_kind_of?(Version) 3041 "<%= #{node}.title %>" 3040 3042 else 3041 3043 _('edit') trunk/test/unit/node_test.rb
r1193 r1215 1378 1378 end 1379 1379 1380 def test_sync_name_on_v_title_change_auto_pub_no_sync 1381 Site.connection.execute "UPDATE sites set auto_publish = 1, redit_time = 3600 WHERE id = #{sites_id(:zena)}" 1382 Version.connection.execute "UPDATE versions set updated_at = '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}' WHERE node_id IN (#{nodes_id(:status)},#{nodes_id(:people)})" 1383 login(:tiger) 1384 # was not in sync 1385 node = secure!(Node) { nodes(:status) } 1386 assert node.update_attributes(:v_title => 'simply different') 1387 assert_equal 'status', node.name 1388 visitor.lang = 'fr' 1389 # not ref lang 1390 node = secure!(Node) { nodes(:people) } 1391 assert node.update_attributes(:v_title => 'nice people') 1392 assert_equal 'fr', node.v_lang 1393 assert_equal 'people', node.name 1394 end 1395 1396 def test_sync_name_on_v_title_change_auto_pub 1397 Site.connection.execute "UPDATE sites set auto_publish = 1, redit_time = 3600 WHERE id = #{sites_id(:zena)}" 1398 Version.connection.execute "UPDATE versions set updated_at = '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}' WHERE node_id IN (#{nodes_id(:people)})" 1399 login(:tiger) 1400 # was in sync, correct lang 1401 node = secure!(Node) { nodes(:people) } 1402 assert node.update_attributes(:v_title => 'nice people') 1403 assert_equal 'nicePeople', node.name 1404 end 1405 1380 1406 # FIXME: write test 1381 1407 def test_assets
