Dotclear

source: plugins/blogroll/edit.php @ 2002:a0de6679a058

Revision 2002:a0de6679a058, 7.7 KB checked in by Anne Kozlika <kozlika@…>, 12 years ago (diff)

Tableaux responsive. Poke jcDenis :-)

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12if (!defined('DC_CONTEXT_ADMIN')) { return; }
13
14$id = $_REQUEST['id'];
15
16try {
17     $rs = $blogroll->getLink($id);
18} catch (Exception $e) {
19     $core->error->add($e->getMessage());
20}
21
22if (!$core->error->flag() && $rs->isEmpty()) {
23     $core->error->add(__('No such link or title'));
24} else {
25     $link_title = $rs->link_title;
26     $link_href = $rs->link_href;
27     $link_desc = $rs->link_desc;
28     $link_lang = $rs->link_lang;
29     $link_xfn = $rs->link_xfn;
30}
31
32# Update a link
33if (isset($rs) && !$rs->is_cat && !empty($_POST['edit_link']))
34{
35     $link_title = $_POST['link_title'];
36     $link_href = $_POST['link_href'];
37     $link_desc = $_POST['link_desc'];
38     $link_lang = $_POST['link_lang'];
39     
40     $link_xfn = '';
41         
42     if (!empty($_POST['identity']))
43     {
44          $link_xfn .= $_POST['identity'];
45     }
46     else
47     {
48          if(!empty($_POST['friendship']))   {
49               $link_xfn .= ' '.$_POST['friendship'];
50          }
51          if(!empty($_POST['physical'])) {
52               $link_xfn .= ' met';
53          }
54          if(!empty($_POST['professional'])) {
55               $link_xfn .= ' '.implode(' ',$_POST['professional']);
56          }
57          if(!empty($_POST['geographical'])) {
58               $link_xfn .= ' '.$_POST['geographical'];
59          }
60          if(!empty($_POST['family'])) {
61               $link_xfn .= ' '.$_POST['family'];
62          }
63          if(!empty($_POST['romantic'])) {
64               $link_xfn .= ' '.implode(' ',$_POST['romantic']);
65          }
66     }
67     
68     try {
69          $blogroll->updateLink($id,$link_title,$link_href,$link_desc,$link_lang,trim($link_xfn));
70          http::redirect($p_url.'&edit=1&id='.$id.'&upd=1');
71     } catch (Exception $e) {
72          $core->error->add($e->getMessage());
73     }
74}
75
76
77# Update a category
78if (isset($rs) && $rs->is_cat && !empty($_POST['edit_cat']))
79{
80     $link_desc = $_POST['link_desc'];
81     
82     try {
83          $blogroll->updateCategory($id,$link_desc);
84          http::redirect($p_url.'&edit=1&id='.$id.'&upd=1');
85     } catch (Exception $e) {
86          $core->error->add($e->getMessage());
87     }
88}
89
90?>
91<html>
92<head>
93  <title>Blogroll</title>
94</head>
95
96<body>
97<?php
98     echo dcPage::breadcrumb(
99          array(
100               html::escapeHTML($core->blog->name) => '',
101               '<span class="page-title">'.__('Blogroll').'</span>' => $p_url
102          ));
103?>
104
105<?php echo '<p><a class="back" href="'.$p_url.'">'.__('Return to blogroll').'</a></p>'; ?>
106
107<?php
108if (isset($rs) && $rs->is_cat)
109{
110     if (!empty($_GET['upd'])) {
111          dcPage::success(__('Category has been successfully updated'));
112     }
113     
114     echo
115     '<form action="'.$p_url.'" method="post">'.
116     '<h3>'.__('Edit category').'</h3>'.
117     
118     '<p><label for="link_desc" class="required classic"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:').'</label> '.
119     form::field('link_desc',30,255,html::escapeHTML($link_desc)).
120     
121     form::hidden('edit',1).
122     form::hidden('id',$id).
123     $core->formNonce().
124     '<input type="submit" name="edit_cat" value="'.__('Save').'"/></p>'.
125     '</form>';
126}
127if (isset($rs) && !$rs->is_cat)
128{
129     if (!empty($_GET['upd'])) {
130          dcPage::success(__('Link has been successfully updated'));
131     }
132     
133     echo
134     '<form action="plugin.php" method="post" class="two-cols fieldset">'.
135
136     '<div class="col30 first-col">'.
137     '<h3>'.__('Edit link').'</h3>'.
138     
139     '<p><label for="link_title" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:').'</label> '.
140     form::field('link_title',30,255,html::escapeHTML($link_title)).'</p>'.
141     
142     '<p><label for="link_href" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('URL:').'</label> '.
143     form::field('link_href',30,255,html::escapeHTML($link_href)).'</p>'.
144     
145     '<p><label for="link_desc">'.__('Description:').'</label> '.
146     form::field('link_desc',30,255,html::escapeHTML($link_desc)).'</p>'.
147     
148     '<p><label for="link_lang">'.__('Language:').'</label> '.
149     form::field('link_lang',5,5,html::escapeHTML($link_lang)).'</p>'.
150     '</div>'.
151     
152     
153     # XFN nightmare
154     '<div class="col70 last-col">'.
155     '<h3>'.__('XFN information').'</h3>'.
156     '<div class="table-outer">'.
157     '<table class="noborder">'.
158     
159     '<tr class="line">'.
160     '<th>'.__('_xfn_Me').'</th>'.
161     '<td><p>'.'<label class="classic">'.
162     form::checkbox(array('identity'), 'me', ($link_xfn == 'me')).' '.
163     __('_xfn_Another link for myself').'</label></p></td>'.
164     '</tr>'.
165     
166     '<tr class="line">'.
167     '<th>'.__('_xfn_Friendship').'</th>'.
168     '<td><p>'.
169     '<label class="classic">'.form::radio(array('friendship'),'contact',
170     strpos($link_xfn,'contact') !== false).__('_xfn_Contact').'</label> '.
171     '<label class="classic">'.form::radio(array('friendship'),'acquaintance',
172     strpos($link_xfn,'acquaintance') !== false).__('_xfn_Acquaintance').'</label> '.
173     '<label class="classic">'.form::radio(array('friendship'),'friend',
174     strpos($link_xfn,'friend') !== false).__('_xfn_Friend').'</label> '.
175     '<label class="classic">'.form::radio(array('friendship'),'').__('None').'</label>'.
176     '</p></td>'.
177     '</tr>'.
178     
179     '<tr class="line">'.
180     '<th>'.__('_xfn_Physical').'</th>'.
181     '<td><p>'.
182     '<label class="classic">'.form::checkbox(array('physical'),'met',
183     strpos($link_xfn,'met') !== false).__('_xfn_Met').'</label>'.
184     '</p></td>'.
185     '</tr>'.
186     
187     '<tr class="line">'.
188     '<th>'.__('_xfn_Professional').'</th>'.
189     '<td><p>'.
190     '<label class="classic">'.form::checkbox(array('professional[]'),'co-worker',
191     strpos($link_xfn,'co-worker') !== false).__('_xfn_Co-worker').'</label> '.
192     '<label class="classic">'.form::checkbox(array('professional[]'),'colleague',
193     strpos($link_xfn,'colleague') !== false).__('_xfn_Colleague').'</label>'.
194     '</p></td>'.
195     '</tr>'.
196     
197     '<tr class="line">'.
198     '<th>'.__('_xfn_Geographical').'</th>'.
199     '<td><p>'.
200     '<label class="classic">'.form::radio(array('geographical'),'co-resident',
201     strpos($link_xfn,'co-resident') !== false).__('_xfn_Co-resident').'</label> '.
202     '<label class="classic">'.form::radio(array('geographical'),'neighbor',
203     strpos($link_xfn,'neighbor') !== false).__('_xfn_Neighbor').'</label> '.
204     '<label class="classic">'.form::radio(array('geographical'),'').__('None').'</label>'.
205     '</p></td>'.
206     '</tr>'.
207     
208     '<tr class="line">'.
209     '<th>'.__('_xfn_Family').'</th>'.
210     '<td><p>'.
211     '<label class="classic">'.form::radio(array('family'),'child',
212     strpos($link_xfn,'child') !== false).__('_xfn_Child').'</label> '.
213     '<label class="classic">'.form::radio(array('family'),'parent',
214     strpos($link_xfn,'parent') !== false).__('_xfn_Parent').'</label> '.
215     '<label class="classic">'.form::radio(array('family'),'sibling',
216     strpos($link_xfn, 'sibling') !== false).__('_xfn_Sibling').'</label> '.
217     '<label class="classic">'.form::radio(array('family'),'spouse',
218     strpos($link_xfn, 'spouse') !== false).__('_xfn_Spouse').'</label> '.
219     '<label class="classic">'.form::radio(array('family'),'kin',
220     strpos($link_xfn, 'kin') !== false).__('_xfn_Kin').'</label> '.
221     '<label class="classic">'.form::radio(array('family'),'').__('None').'</label>'.
222     '</p></td>'.
223     '</tr>'.
224     
225     '<tr class="line">'.
226     '<th>'.__('_xfn_Romantic').'</th>'.
227     '<td><p>'.
228     '<label class="classic">'.form::checkbox(array('romantic[]'),'muse',
229     strpos($link_xfn,'muse') !== false).__('_xfn_Muse').'</label> '.
230     '<label class="classic">'.form::checkbox(array('romantic[]'),'crush',
231     strpos($link_xfn,'crush') !== false).__('_xfn_Crush').'</label> '.
232     '<label class="classic">'.form::checkbox(array('romantic[]'),'date',
233     strpos($link_xfn,'date') !== false).__('_xfn_Date').'</label> '.
234     '<label class="classic">'.form::checkbox(array('romantic[]'),'sweetheart',
235     strpos($link_xfn,'sweetheart') !== false).__('_xfn_Sweetheart').'</label> '.
236     '</p></td>'.
237     '</tr>'.
238     '</table></div>'.
239     
240     '</div>'.
241     '<p class="clear">'.form::hidden('p','blogroll').
242     form::hidden('edit',1).
243     form::hidden('id',$id).
244     $core->formNonce().
245     '<input type="submit" name="edit_link" value="'.__('Save').'"/></p>'.
246     
247     '</form>';
248}
249?>
250</body>
251</html>
Note: See TracBrowser for help on using the repository browser.

Sites map