source: trunk/news_admin/admin_edit.php @ 45

Revision 45, 5.3 KB checked in by niltonneto, 17 years ago (diff)

Implementação do FCKEDITOR na edição de artigos no news_admin, para permitir texto rico.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2  /**************************************************************************\
3  * eGroupWare - Webpage news admin                                          *
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  * This program was sponsered by Golden Glair productions                   *
12  * http://www.goldenglair.com                                               *
13  \**************************************************************************/
14
15  /* $Id$ */
16
17        $phpgw_info = array();
18        $GLOBALS['phpgw_info']['flags'] = array(
19                'currentapp'              => 'news_admin',
20                'enable_nextmatchs_class' => True
21        );
22        if($submit)
23        {
24                $GLOBALS['phpgw_info']['flags']['noheader'] = True;
25                $GLOBALS['phpgw_info']['flags']['nonavbar'] = True;
26        }
27        include('../header.inc.php');
28
29        $GLOBALS['phpgw']->sbox = CreateObject('phpgwapi.sbox');
30
31        if($submit)
32        {
33                // Its possiable that this could get messed up becuase of there timezone offset
34                if($date_ap == 'pm')
35                {
36                        $date_hour = $date_hour + 12;
37                }
38                $date = mktime($date_hour,$date_min,$date_sec,$date_month,$date_day,$date_year);
39                $GLOBALS['phpgw']->db->query("UPDATE phpgw_news SET news_subject='" . addslashes($subject) . "',"
40                        . "news_content='" . addslashes($content) . "',news_status='$status',news_date='$date' "
41                        . "WHERE news_id='$news_id'",__LINE__,__FILE__);
42                Header('Location: ' . $GLOBALS['phpgw']->link('/news_admin/index.php'));
43                $GLOBALS['phpgw']->common->phpgw_exit();
44        }
45
46        $GLOBALS['phpgw']->template->set_file(array(
47                'form' => 'form.tpl',
48                'row'  => 'form_row.tpl'
49        ));
50
51        $GLOBALS['phpgw']->db->query("select * from phpgw_news where news_id='$news_id'",__LINE__,__FILE__);
52        $GLOBALS['phpgw']->db->next_record();
53
54        $GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
55        $GLOBALS['phpgw']->template->set_var('bgcolor',$GLOBALS['phpgw_info']['theme']['bgcolor']);
56
57        $GLOBALS['phpgw']->template->set_var('lang_header',lang('Edit news item'));
58        $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/news_admin/edit.php','news_id=' . $GLOBALS['phpgw']->db->f('news_id')));
59        $GLOBALS['phpgw']->template->set_var('form_button','<input type="submit" name="submit" value="' . lang("Edit") . '">');
60
61        $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw']->nextmatchs->alternate_row_color());
62        $GLOBALS['phpgw']->template->set_var('label',lang('subject') . ':');
63        $GLOBALS['phpgw']->template->set_var('value','<input name="subject" size="60" value="' . $GLOBALS['phpgw']->db->f('news_subject') . '">');
64        $GLOBALS['phpgw']->template->parse('rows','row',True);
65
66        $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw']->nextmatchs->alternate_row_color());
67        $GLOBALS['phpgw']->template->set_var('label',lang('Content') . ':');
68        $GLOBALS['phpgw']->template->set_var('value','<textarea cols="60" rows="6" name="content" wrap="virtual">' . stripslashes($GLOBALS['phpgw']->db->f('news_content')) . '</textarea>');
69        $GLOBALS['phpgw']->template->parse('rows','row',True);
70
71        $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw']->nextmatchs->alternate_row_color());
72        $GLOBALS['phpgw']->template->set_var('label',lang('Status') . ':');
73        $s[$GLOBALS['phpgw']->db->f('news_status')] = ' selected';
74        $GLOBALS['phpgw']->template->set_var("value",'<select name="status"><option value="Active"' . $s['Active'] . '>'
75                . lang('active') . '</option><option value="Disabled"' . $s['Disabled'] . '>'
76                . lang('Disabled') . '</option></select>');
77        $GLOBALS['phpgw']->template->parse('rows','row',True);
78
79        $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw']->nextmatchs->alternate_row_color());
80        $GLOBALS['phpgw']->template->set_var('label',lang('Date') . ':');
81
82        $d_html = $GLOBALS['phpgw']->common->dateformatorder($GLOBALS['phpgw']->sbox->getYears('date_year', date('Y',$GLOBALS['phpgw']->db->f('news_date'))),
83                $GLOBALS['phpgw']->sbox->getMonthText('date_month', date('m',$GLOBALS['phpgw']->db->f('news_date'))),
84                $GLOBALS['phpgw']->sbox->getDays('date_day', date('d',$GLOBALS['phpgw']->db->f('news_date')))
85        );
86        $d_html .= " - ";
87        $d_html .= $GLOBALS['phpgw']->sbox->full_time('date_hour',$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('news_date'),'h'),
88                'date_min',$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('news_date'),'i'),
89                'date_sec',$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('news_date'),'s'),
90                'date_ap',$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('news_date'),'a')
91        );
92        $GLOBALS['phpgw']->template->set_var('value',$d_html);
93
94        $h = '<select name="status"><option value="Active"' . $s['Active'] . '>'
95                . lang('Active') . '</option><option value="Disabled"' . $s['Disabled'] . '>'
96                . lang('Disabled') . '</option></select>';
97        $GLOBALS['phpgw']->template->parse('rows','row',True);
98
99        $GLOBALS['phpgw']->template->pparse('out','form');
100        $GLOBALS['phpgw']->common->phpgw_footer();
101?>
Note: See TracBrowser for help on using the repository browser.