Redmine1.4 在ubuntu server 11.10上安装了多次,已经很熟练了,现在已经部署到生产环境,使用起来比较顺手。但是,有个功能让人不放心,“我的帐号(My account)”里面有个“Delete my account”功能,而且提示“帐号一旦删除就是永久的,无法恢复”。这个很不爽,非常不爽。我要把它屏蔽掉!
屏蔽有两个办法,一个是删除“Delete my account”链接,这个指标不治本(http://redmineserverip:3000/my/account/destroy)。另一个是修改链接处理程序,我选这个。呵呵,开源的东西就是好啊。
找代码。
cares@ubuntu:/opt/redmine-1.4$ find -name my ./app/views/my ./extra/sample_plugin/app/views/my cares@ubuntu:/opt/redmine-1.4$ cd app/views/my cares@ubuntu:/opt/redmine-1.4/app/views/my$ ll total 52 drwxr-xr-x 4 root root 4096 Apr 28 18:22 ./ drwxr-xr-x 47 root root 4096 Apr 28 15:55 ../ drwxr-xr-x 6 root root 4096 Apr 28 15:55 .svn/ -rw-r--r-- 1 root root 479 Apr 28 15:55 _block.html.erb -rw-r--r-- 1 root root 1278 Apr 28 15:55 _sidebar.html.erb -rw-r--r-- 1 root root 1643 Apr 28 15:55 account.html.erb drwxr-xr-x 3 root root 4096 Apr 28 15:55 blocks/ -rw-r--r-- 1 root root 260 Apr 28 18:22 destroy.html.erb -rw-r--r-- 1 root root 1065 Apr 28 15:55 page.html.erb -rw-r--r-- 1 root root 4296 Apr 28 15:55 page_layout.html.erb -rw-r--r-- 1 root root 866 Apr 28 15:55 password.html.erb cares@ubuntu:/opt/redmine-1.4/app/views/my$ |
程序文件应该是destroy.html.erb,看看里面怎么写的:
- <h2><%=l(:label_confirmation)%></h2>
- <div class="warning">
- <p><%= simple_format l(:text_account_destroy_confirmation)%></p>
- <p>
- <% form_tag({}) do %>
- <label><%= check_box_tag 'confirm', 1 %> <%= l(:general_text_Yes) %></label>
- <%= submit_tag l(:button_delete_my_account) %> |
- <%= link_to l(:button_cancel), :action => 'account' %>
- <% end %>
- </p>
- </div>
我没学过ruby,但是我能改,嘿嘿嘿。
复制 destroy.html.erb 为 destroy.html.erb.bak,然后把destroy.html.erb改成这样:
- <h2><%=l(:label_confirmation)%></h2>
- <div class="warning">
- <p><%= simple_format l(:text_account_destroy_confirmation)%></p>
- <p>
- <% form_tag({}) do %>
- <label> </label>
- <%= link_to l(:button_cancel), :action => 'account' %>
- <% end %>
- </p>
- </div>
重启 redmine:
cares@ubuntu:~$ sudo ps -e |grep ruby 920 ? 00:00:20 ruby cares@ubuntu:~$ sudo kill 920 cares@ubuntu:~$ ruby /opt/redmine-1.4/script/server mongrel -d -e production |
再进入redmine,点 Delete my account,看看,不错哦。
redmine1.4安装方法,参考:
安装 Redmine 1.4 ,用Ubuntu Server 11.10