[6779] | 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 | 'lang_search' => lang('Search'), |
---|
| 81 | 'lang_configuration' => lang('Configuration'), |
---|
| 82 | )); |
---|
| 83 | |
---|
| 84 | $left = $this->nextmatchs->left('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=news_admin.uiexport.exportlist'); |
---|
| 85 | $right = $this->nextmatchs->right('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=news_admin.uiexport.exportlist'); |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | $GLOBALS['phpgw']->template->set_var(array( |
---|
| 89 | 'left' => $left, |
---|
| 90 | 'right' => $right, |
---|
| 91 | 'lang_showing' => $this->nextmatchs->show_hits($this->bo->catbo->total_records,$this->start), |
---|
| 92 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
| 93 | 'sort_cat' => $this->nextmatchs->show_sort_order( |
---|
| 94 | $this->sort,'cat_name','cat_name','/index.php',lang('Category'),'&menuaction=news_admin.uiexport.exportlist' |
---|
| 95 | ), |
---|
| 96 | 'query' => $this->query, |
---|
| 97 | )); |
---|
| 98 | |
---|
| 99 | @reset($this->bo->cats); |
---|
| 100 | while (list(,$cat) = @each($this->bo->cats)) |
---|
| 101 | { |
---|
| 102 | $config = $this->bo->readconfig($cat['id']); |
---|
| 103 | $tr_color = $this->nextmatchs->alternate_row_color($tr_color); |
---|
| 104 | $GLOBALS['phpgw']->template->set_var(array( |
---|
| 105 | 'tr_color' => $tr_color, |
---|
| 106 | 'catname' => $cat['name'], |
---|
| 107 | 'catid' => $cat['id'], |
---|
| 108 | 'lang_type' => lang('Format of export'), |
---|
| 109 | 'typeselectlist' => $this->selectlist($this->exporttypes,$config['type']), |
---|
| 110 | 'lang_item' => lang('Format for links to items'), |
---|
| 111 | 'itemsyntaxselectlist' => $this->selectlist($this->itemsyntaxtypes,$config['itemsyntax']) |
---|
| 112 | )); |
---|
| 113 | $GLOBALS['phpgw']->template->set_var('confblock',''); |
---|
| 114 | foreach (array( |
---|
| 115 | 'title' => lang('Title'), |
---|
| 116 | 'link' => lang('Link'), |
---|
| 117 | 'description' => lang('description'), |
---|
| 118 | 'img_title' => lang('Image Title'), |
---|
| 119 | 'img_url' => lang('Image URL'), |
---|
| 120 | 'img_link' => lang('Image Link')) as $setting => $label) |
---|
| 121 | { |
---|
| 122 | $GLOBALS['phpgw']->template->set_var(array( |
---|
| 123 | 'setting' => $label, |
---|
| 124 | 'value' => ('<input size="80" type="text" name="inputconfig[' . $cat['id'] . '][' . $setting . ']" value="' . |
---|
| 125 | $config[$setting] . '" />' |
---|
| 126 | ) |
---|
| 127 | )); |
---|
| 128 | $GLOBALS['phpgw']->template->parse('confblock','config',True); |
---|
| 129 | } |
---|
| 130 | $GLOBALS['phpgw']->template->parse('Cblock','cat_list',True); |
---|
| 131 | } |
---|
| 132 | $GLOBALS['phpgw']->template->pfp('out','export',True); |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | function selectlist($values,$default) |
---|
| 136 | { |
---|
| 137 | while (list($value,$type) = each($values)) |
---|
| 138 | { |
---|
| 139 | $selectlist .= '<option value="' . $value . '"'; |
---|
| 140 | if ($value == $default) |
---|
| 141 | { |
---|
| 142 | $selectlist .= ' selected="selected"'; |
---|
| 143 | } |
---|
| 144 | $selectlist .= '>' . $type . '</option>' . "\n"; |
---|
| 145 | } |
---|
| 146 | return $selectlist; |
---|
| 147 | } |
---|
| 148 | |
---|
| 149 | function deny() |
---|
| 150 | { |
---|
| 151 | echo '<p><center><b>'.lang('Access not permitted').'</b></center>'; |
---|
| 152 | $GLOBALS['phpgw']->common->phpgw_exit(True); |
---|
| 153 | } |
---|
| 154 | } |
---|
| 155 | ?> |
---|