From e52a9b4979972cfd9e7db71e96e08af0757e0d69 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Mon, 20 Apr 2009 19:49:11 -0300 Subject: [PATCH] ActionItem305: importing menus --- script/import-cooperation.net | 15 +++++++++++++++ 1 file changed, 15 insertions(+), 0 deletions(-) diff --git a/script/import-cooperation.net b/script/import-cooperation.net index 75ba492..012936c 100755 --- a/script/import-cooperation.net +++ b/script/import-cooperation.net @@ -116,6 +116,21 @@ for username in ARGV end end + + # import menus + for i in [1,2] + links = [] + data = Hash.from_xml(File.read(File.join(IMPORT_DIR, username, "menu#{i}.xml"))) + data['menu']['items'].each do |item| + links << { :name => item['title'], :address => item['url'] } + end + block = person.blocks.select { |block| block.class == LinkListBlock }[i-1] + block.title = data['menu']['title'] + block.links = links + block.save! + puts "imported links: #{links.inspect}" + end + end rescue Exception => e $stderr.puts "==================================" -- libgit2 0.21.2