matsukaz's blog

Agile, node.js, ruby, AWS, cocos2d-xなどなどいろいろやってます

Redmine Dropbox Pluginを試してみた

RedmineDropboxを連携したくて、Redmine Dropbox Pluginを試してみた。


プラグインの機能

プラグインの機能は以下の通り。

  • Dropboxタブで文書(タイトル/説明/添付ファイルなど)を登録可能
  • 文書登録時にファイルを添付した場合は、Dropboxの以下のディレクトリに保存される
    • /Dropbox/ベースパス/文書カテゴリ名/タイトル名/
  • 登録された文書は、文書カテゴリ別に表示される
  • Dropboxに以下の階層で直接アップロードしたものは、後からRedmineに同期を取ることも可能
    • /Dropbox/ベースパス/文書カテゴリ名/フォルダ名/添付ファイル
    • ただし、「/Dropbox/ベースパス/文書カテゴリ名」に添付ファイルをアップロードして同期を取ってしまうと、添付ファイルがフォルダ名だと判断しておかしなことになるので注意が必要

登録画面があって、

一覧画面があって、

詳細画面がこんな感じ。


注意点

日本語だといくつか問題点がありました。解決方法含め、以下の通り。

タイトルに日本語を入れると登録に失敗する

URLエンコーディングされてないのが原因でした。
redmine_drop_box/lib/dropbox/lib/dropbox.rb を以下のように変更すればOK。

--- dropbox.rb  2011-05-12 11:19:25.136660004 +0000
+++ dropbox.rb.new      2011-05-12 11:18:56.866660002 +0000
@@ -214,7 +214,7 @@
 
     def build_url(host, port, url, params=nil)
         port = port == 80 ? nil : port
-        versioned_url = "/#{API_VERSION}#{url}"
+        versioned_url = URI.escape("/#{API_VERSION}#{url}")
 
         target = URI::Generic.new("http", nil, host, port, nil, versioned_url, nil, nil, nil)
ラベルやボタンでエラーメッセージが出る

jaのロケールファイルがないのが原因でした。
redmine_drop_box/config/locales/en.yml を参考に、同じ場所にja.ymlを作成すればOK。項目ぐらいは日本語にしたかったので、以下のようにしました。

ja:
  permission_view_dropbox_documents: "文書参照"
  permission_manage_dropbox_documents: "文書管理"
  label_usuario_dropbox: "Dropboxユーザ"
  label_password_usuario_dropbox: "Dropboxパスワード"
  label_path_base_documentos: "文書管理用ベースパス"
  formato_nombre_fichero: "ファイル"
  text_modificado: "更新日"
  field_category: "カテゴリ"
  formato_nombre_titulo: "タイトル"
  field_description: "説明"
  label_titulo_configuracion: "情報"
  label_info_configuracion: "You should write user / password of your Dropbox account. You must also specify the base path where files are stored in your account. The path can not contain special characters"
  error_conexion_dropbox: "Dropbox connection error. Check user / password Dropbox account on plugin page configuration."
  warning_falta_archivo: "You must select a file"
  warning_error_nombre_archivo: "Filename incorrect. The name can not contain special characters."
  error_fichero_no_enco_dropbox: "File not found in your Dropbox account. It is possible that it was deleted from your account"
  error_caracteres_finales: "Error: not supported at the end of the filename of the attachment, the characters: * % ? & : ; | < > / + ¬ £ ."
  label_sincronizar_dropbox: "Dropboxと同期"
  label_sincronizacion_dropbox: "Dropboxと同期"
  label_document_import: "Dropboxから文書をインポート"
  label_documentos_eliminados_dropbox: "Dropbox deleted documents"
  label_documentos_anyadidos_dropbox: "Documents added in Dropbox"
  label_no_enco_ficheros_sincronizar: "No files were found still to synchronize"
  label_ayuda_sincronizar: "Dropbox Sync Help"
  label_info_sincronizacion: "You can upload files directly to your Dropbox account and then add them to Redmine from this tab. Select the files you want to import."
  button_import: "Import"
  label_filesize_reached: "You have exceeded the size limit for sending files to Dropbox ({{value}} Mb). Please add this file directly from Dropbox and sync with Dropbox to add it to the project"
  label_por: "by"
  asunto_documento_add: "Document added by {{autor}} to {{proyecto}} project."
  mensaje_documento_add: "User {{autor}} added {{documento}} to {{proyecto}} project"
  documento_repetido: "There is already a document with the selected name"
  documento_sincronizado: "Document successfully synchronized ({{anadidos}} files added / s, {{eliminados}} file / s removed)"

ちなみに、項目とか見ると英語ですらなかったりする・・・スペイン語とか?プログラム中も変数名とかこんな感じ。びっくりした。