1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # |
---|
4 | # This file is part of pacKman, a plugin for Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2009-2013 Jean-Christian Denis and contributors |
---|
7 | # contact@jcdenis.fr |
---|
8 | # |
---|
9 | # Licensed under the GPL version 2.0 license. |
---|
10 | # A copy of this license is available in LICENSE file or at |
---|
11 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
12 | # |
---|
13 | # -- END LICENSE BLOCK ------------------------------------ |
---|
14 | |
---|
15 | if (!defined('DC_CONTEXT_MODULE')) { |
---|
16 | |
---|
17 | return null; |
---|
18 | } |
---|
19 | |
---|
20 | $redir = empty($_REQUEST['redir']) ? |
---|
21 | $list->getURL().'#plugins' : $_REQUEST['redir']; |
---|
22 | |
---|
23 | # -- Get settings -- |
---|
24 | $core->blog->settings->addNamespace('pacKman'); |
---|
25 | $s = $core->blog->settings->pacKman; |
---|
26 | |
---|
27 | $packman_pack_nocomment = $s->packman_pack_nocomment; |
---|
28 | $packman_pack_overwrite = $s->packman_pack_overwrite; |
---|
29 | $packman_pack_filename = $s->packman_pack_filename; |
---|
30 | $packman_secondpack_filename = $s->packman_secondpack_filename; |
---|
31 | $packman_pack_repository = $s->packman_pack_repository; |
---|
32 | $packman_pack_excludefiles = $s->packman_pack_excludefiles; |
---|
33 | |
---|
34 | # -- Set settings -- |
---|
35 | if (!empty($_POST['save'])) { |
---|
36 | |
---|
37 | try { |
---|
38 | $packman_pack_nocomment = !empty($_POST['packman_pack_nocomment']); |
---|
39 | $packman_pack_overwrite = !empty($_POST['packman_pack_overwrite']); |
---|
40 | $packman_pack_filename = $_POST['packman_pack_filename']; |
---|
41 | $packman_secondpack_filename = $_POST['packman_secondpack_filename']; |
---|
42 | $packman_pack_repository = path::real($_POST['packman_pack_repository'], false); |
---|
43 | $packman_pack_excludefiles = $_POST['packman_pack_excludefiles']; |
---|
44 | |
---|
45 | $check = libPackman::is_configured( |
---|
46 | $core, |
---|
47 | $packman_pack_repository, |
---|
48 | $packman_pack_filename, |
---|
49 | $packman_secondpack_filename |
---|
50 | ); |
---|
51 | |
---|
52 | if ($check) { |
---|
53 | |
---|
54 | $s->put('packman_pack_nocomment', $packman_pack_nocomment); |
---|
55 | $s->put('packman_pack_overwrite', $packman_pack_overwrite); |
---|
56 | $s->put('packman_pack_filename', $packman_pack_filename); |
---|
57 | $s->put('packman_secondpack_filename', $packman_secondpack_filename); |
---|
58 | $s->put('packman_pack_repository', $packman_pack_repository); |
---|
59 | $s->put('packman_pack_excludefiles', $packman_pack_excludefiles); |
---|
60 | |
---|
61 | dcPage::addSuccessNotice( |
---|
62 | __('Configuration has been successfully updated.') |
---|
63 | ); |
---|
64 | http::redirect( |
---|
65 | $list->getURL('module=pacKman&conf=1&redir='. |
---|
66 | $list->getRedir()) |
---|
67 | ); |
---|
68 | } |
---|
69 | } |
---|
70 | catch (Exception $e) { |
---|
71 | $core->error->add($e->getMessage()); |
---|
72 | } |
---|
73 | } |
---|
74 | |
---|
75 | # -- Display form -- |
---|
76 | echo ' |
---|
77 | |
---|
78 | <div class="fieldset"> |
---|
79 | <h4>'.__('Root').'</h4> |
---|
80 | |
---|
81 | <p><label for="packman_pack_repository">'.__('Path to repository:').' '. |
---|
82 | form::field('packman_pack_repository', 65, 255, $packman_pack_repository, 'maximal'). |
---|
83 | '</label></p>'. |
---|
84 | '<p class="form-note">'.sprintf(__('Preconization: %s'), $core->blog->public_path ? |
---|
85 | $core->blog->public_path : __("Blog's public directory") |
---|
86 | ).'</p> |
---|
87 | </div> |
---|
88 | |
---|
89 | <div class="fieldset"> |
---|
90 | <h4>'.__('Files').'</h4> |
---|
91 | |
---|
92 | <p><label for="packman_pack_filename">'.__('Name of exported package:').' '. |
---|
93 | form::field('packman_pack_filename', 65, 255, $packman_pack_filename, 'maximal'). |
---|
94 | '</label></p> |
---|
95 | <p class="form-note">'.sprintf(__('Preconization: %s'), '%type%-%id%-%version%').'</p> |
---|
96 | |
---|
97 | <p><label for="packman_secondpack_filename">'.__('Name of second exported package:').' '. |
---|
98 | form::field('packman_secondpack_filename', 65, 255, $packman_secondpack_filename, 'maximal'). |
---|
99 | '</label></p> |
---|
100 | <p class="form-note">'.sprintf(__('Preconization: %s'), '%type%-%id%').'</p> |
---|
101 | |
---|
102 | <p><label class="classic" for="packman_pack_overwrite">'. |
---|
103 | form::checkbox('packman_pack_overwrite', 1, $packman_pack_overwrite).' '. |
---|
104 | __('Overwrite existing package').'</label></p> |
---|
105 | |
---|
106 | </div> |
---|
107 | |
---|
108 | <div class="fieldset"> |
---|
109 | <h4>'.__('Content').'</h4> |
---|
110 | |
---|
111 | <p><label for="packman_pack_excludefiles">'.__('Extra files to exclude from package:').' '. |
---|
112 | form::field('packman_pack_excludefiles', 65, 255, $packman_pack_excludefiles, 'maximal'). |
---|
113 | '</label></p> |
---|
114 | <p class="form-note">'.sprintf(__('Preconization: %s'), '*.zip,*.tar,*.tar.gz').'</p> |
---|
115 | |
---|
116 | <p><label class="classic" for="packman_pack_nocomment">'. |
---|
117 | form::checkbox('packman_pack_nocomment', 1, $packman_pack_nocomment).' '. |
---|
118 | __('Remove comments from files').'</label></p> |
---|
119 | |
---|
120 | </div>'; |
---|