1
|
# encoding: utf-8
|
2
|
#
|
3
|
# Created L/21/05/2012
|
4
|
# Updated D/08/06/2014
|
5
|
# Version 15
|
6
|
#
|
7
|
# Copyright 2008-2014 | Fabrice Creuzot (luigifab) <code~luigifab~info>
|
8
|
# https://redmine.luigifab.info/projects/redmine/wiki/apijs
|
9
|
#
|
10
|
# This program is free software, you can redistribute it or modify
|
11
|
# it under the terms of the GNU General Public License (GPL) as published
|
12
|
# by the free software foundation, either version 2 of the license, or
|
13
|
# (at your option) any later version.
|
14
|
#
|
15
|
# This program is distributed in the hope that it will be useful,
|
16
|
# but without any warranty, without even the implied warranty of
|
17
|
# merchantability or fitness for a particular purpose. See the
|
18
|
# GNU General Public License (GPL) for more details.
|
19
|
|
20
|
require 'redmine'
|
21
|
require 'files_hook'
|
22
|
require 'attachment_patch'
|
23
|
|
24
|
root = (ENV['RAILS_TMP'].to_s.length > 0) ? (ENV['RAILS_TMP'].to_s + '/apijs') : nil # /var/cache/redmine/default/apijs/
|
25
|
root = (!root && Rails.root.to_s.length > 0) ? (Rails.root.to_s + '/tmp/apijs') : root # /home/user/redmine-2.5.1/tmp/apijs/
|
26
|
root = (!root && RAILS_ROOT.to_s.length > 0) ? (RAILS_ROOT.to_s + '/tmp/apijs') : root # /home/user/redmine-2.5.1/tmp/apijs/
|
27
|
root = (!root) ? '/tmp/apijs' : root # /tmp/apijs/
|
28
|
APIJS_ROOT = root.to_s
|
29
|
|
30
|
Redmine::Plugin.register :redmine_apijs do
|
31
|
name 'Redmine Apijs plugin'
|
32
|
author 'Fabrice Creuzot'
|
33
|
description 'Integrate the apijs javascript library into Redmine.'
|
34
|
version '5.0.0'
|
35
|
url 'https://redmine.luigifab.info/projects/redmine/wiki/apijs'
|
36
|
author_url 'http://www.luigifab.info/'
|
37
|
|
38
|
permission :edit_attachments, { :apijs => :edit }, { :require => :loggedin }
|
39
|
permission :delete_attachments, { :apijs => :delete }, { :require => :loggedin, :require => :member }
|
40
|
|
41
|
settings({
|
42
|
:partial => 'settings/apijs',
|
43
|
:default => {
|
44
|
:enabled => '0',
|
45
|
:sort_attachments => '0',
|
46
|
:show_album => '0',
|
47
|
:show_filename => '0',
|
48
|
:show_exifdate => '0',
|
49
|
:album_exclude_name => '',
|
50
|
:album_exclude_desc => '',
|
51
|
:create_all => '0'
|
52
|
}
|
53
|
})
|
54
|
end
|