1 | <?php |
---|
2 | /**************************************************************************\ |
---|
3 | * eGroupWare - News * |
---|
4 | * http://www.egroupware.org * |
---|
5 | * -------------------------------------------- * |
---|
6 | * This program is free software; you can redistribute it and/or modify it * |
---|
7 | * under the terms of the GNU General Public License as published by the * |
---|
8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
9 | * option) any later version. * |
---|
10 | * -------------------------------------------- * |
---|
11 | \**************************************************************************/ |
---|
12 | |
---|
13 | |
---|
14 | class uiexport |
---|
15 | { |
---|
16 | var $start = 0; |
---|
17 | var $query = ''; |
---|
18 | var $sort = ''; |
---|
19 | var $order = ''; |
---|
20 | var $bo; |
---|
21 | var $nextmatchs = ''; |
---|
22 | var $public_functions = array( |
---|
23 | 'exportlist' => True, |
---|
24 | ); |
---|
25 | var $exporttypes; |
---|
26 | |
---|
27 | function uiexport() |
---|
28 | { |
---|
29 | $this->bo = createobject('news_admin.boexport',True); |
---|
30 | $this->nextmatchs = createobject('phpgwapi.nextmatchs'); |
---|
31 | $this->start = $this->bo->start; |
---|
32 | $this->query = $this->bo->query; |
---|
33 | $this->order = $this->bo->order; |
---|
34 | $this->sort = $this->bo->sort; |
---|
35 | $this->exporttypes = array( |
---|
36 | 0 => lang('No RSS export'), |
---|
37 | 1 => 'RSS 0.91', |
---|
38 | 2 => 'RSS 1.0', |
---|
39 | 3 => 'RSS 2.0' |
---|
40 | ); |
---|
41 | $this->itemsyntaxtypes = array( |
---|
42 | 0 => '?item=n', |
---|
43 | 1 => '&item=n', |
---|
44 | 2 => '?news%5Bitem%5D=n', |
---|
45 | 3 => '&news%5Bitem%5D=n' |
---|
46 | ); |
---|
47 | } |
---|
48 | |
---|
49 | function exportlist() |
---|
50 | { |
---|
51 | if (!$GLOBALS['phpgw']->acl->check('run',1,'admin')) |
---|
52 | { |
---|
53 | $this->deny(); |
---|
54 | } |
---|
55 | |
---|
56 | if ($_POST['btnDone']) |
---|
57 | { |
---|
58 | $GLOBALS['phpgw']->redirect_link('/admin/index.php'); |
---|
59 | } |
---|
60 | |
---|
61 | //$GLOBALS['phpgw']->common->phpgw_header(); |
---|
62 | //echo parse_navbar(); |
---|
63 | |
---|
64 | if ($_POST['btnSave']) |
---|
65 | { |
---|
66 | foreach($_POST['catids'] as $cat_id) |
---|
67 | { |
---|
68 | $this->bo->saveconfig($cat_id,$_POST['inputconfig'][$cat_id]); |
---|
69 | } |
---|
70 | } |
---|
71 | |
---|
72 | $GLOBALS['phpgw']->template->set_file('export', 'export.tpl'); |
---|
73 | $GLOBALS['phpgw']->template->set_block('export','cat_list','Cblock'); |
---|
74 | $GLOBALS['phpgw']->template->set_block('cat_list','config','confblock'); |
---|
75 | $GLOBALS['phpgw']->template->set_var(array( |
---|
76 | 'title' => $GLOBALS['phpgw_info']['apps']['news_admin']['title'] . ' - ' . lang('Configure RSS exports'), |
---|
77 | 'lang_search' => lang('Search'), |
---|
78 | 'lang_save' => lang('Save'), |
---|
79 | 'lang_done' => lang('Done'), |
---|
80 | 'done_button' => $GLOBALS[ 'phpgw' ] -> link( '/admin/' ), |
---|
81 | 'lang_search' => lang('Search'), |
---|
82 | 'lang_configuration' => lang('Configuration'), |
---|
83 | )); |
---|
84 | |
---|
85 | $left = $this->nextmatchs->left('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=news_admin.uiexport.exportlist'); |
---|
86 | $right = $this->nextmatchs->right('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=news_admin.uiexport.exportlist'); |
---|
87 | |
---|
88 | |
---|
89 | $GLOBALS['phpgw']->template->set_var(array( |
---|
90 | 'left' => $left, |
---|
91 | 'right' => $right, |
---|
92 | 'lang_showing' => $this->nextmatchs->show_hits($this->bo->catbo->total_records,$this->start), |
---|
93 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
94 | 'sort_cat' => $this->nextmatchs->show_sort_order( |
---|
95 | $this->sort,'cat_name','cat_name','/index.php',lang('Category'),'&menuaction=news_admin.uiexport.exportlist' |
---|
96 | ), |
---|
97 | 'query' => $this->query, |
---|
98 | )); |
---|
99 | |
---|
100 | @reset($this->bo->cats); |
---|
101 | while (list(,$cat) = @each($this->bo->cats)) |
---|
102 | { |
---|
103 | $config = $this->bo->readconfig($cat['id']); |
---|
104 | $tr_color = $this->nextmatchs->alternate_row_color($tr_color); |
---|
105 | $GLOBALS['phpgw']->template->set_var(array( |
---|
106 | 'tr_color' => $tr_color, |
---|
107 | 'catname' => $cat['name'], |
---|
108 | 'catid' => $cat['id'], |
---|
109 | 'lang_type' => lang('Format of export'), |
---|
110 | 'typeselectlist' => $this->selectlist($this->exporttypes,$config['type']), |
---|
111 | 'lang_item' => lang('Format for links to items'), |
---|
112 | 'itemsyntaxselectlist' => $this->selectlist($this->itemsyntaxtypes,$config['itemsyntax']) |
---|
113 | )); |
---|
114 | $GLOBALS['phpgw']->template->set_var('confblock',''); |
---|
115 | foreach (array( |
---|
116 | 'title' => lang('Title'), |
---|
117 | 'link' => lang('Link'), |
---|
118 | 'description' => lang('description'), |
---|
119 | 'img_title' => lang('Image Title'), |
---|
120 | 'img_url' => lang('Image URL'), |
---|
121 | 'img_link' => lang('Image Link')) as $setting => $label) |
---|
122 | { |
---|
123 | $GLOBALS['phpgw']->template->set_var(array( |
---|
124 | 'setting' => $label, |
---|
125 | 'value' => ('<input size="80" type="text" name="inputconfig[' . $cat['id'] . '][' . $setting . ']" value="' . |
---|
126 | $config[$setting] . '" />' |
---|
127 | ) |
---|
128 | )); |
---|
129 | $GLOBALS['phpgw']->template->parse('confblock','config',True); |
---|
130 | } |
---|
131 | $GLOBALS['phpgw']->template->parse('Cblock','cat_list',True); |
---|
132 | } |
---|
133 | $GLOBALS['phpgw']->template->pfp('out','export',True); |
---|
134 | } |
---|
135 | |
---|
136 | function selectlist($values,$default) |
---|
137 | { |
---|
138 | while (list($value,$type) = each($values)) |
---|
139 | { |
---|
140 | $selectlist .= '<option value="' . $value . '"'; |
---|
141 | if ($value == $default) |
---|
142 | { |
---|
143 | $selectlist .= ' selected="selected"'; |
---|
144 | } |
---|
145 | $selectlist .= '>' . $type . '</option>' . "\n"; |
---|
146 | } |
---|
147 | return $selectlist; |
---|
148 | } |
---|
149 | |
---|
150 | function deny() |
---|
151 | { |
---|
152 | echo '<p><center><b>'.lang('Access not permitted').'</b></center>'; |
---|
153 | $GLOBALS['phpgw']->common->phpgw_exit(True); |
---|
154 | } |
---|
155 | } |
---|
156 | ?> |
---|