1 | <?php |
---|
2 | |
---|
3 | /***************************************************************************\ |
---|
4 | * SPIP, Systeme de publication pour l'internet * |
---|
5 | * * |
---|
6 | * Copyright (c) 2001-2009 * |
---|
7 | * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
---|
8 | * * |
---|
9 | * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
---|
10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
---|
11 | \***************************************************************************/ |
---|
12 | |
---|
13 | if (!defined("_ECRIRE_INC_VERSION")) return; |
---|
14 | |
---|
15 | include_spip('inc/presentation'); |
---|
16 | |
---|
17 | function exec_documents_edit_dist() |
---|
18 | { |
---|
19 | exec_documents_edit_args(intval(_request('id_document')),_request('parent'),_request('new')); |
---|
20 | } |
---|
21 | |
---|
22 | /** |
---|
23 | * Edition d'un document |
---|
24 | * parent est de la forme id_objet|objet (ex : 123|article) |
---|
25 | * |
---|
26 | * @param int $id_document |
---|
27 | * @param string $parent |
---|
28 | * @param string $new |
---|
29 | */ |
---|
30 | function exec_documents_edit_args($id_document, $parent, $new){ |
---|
31 | |
---|
32 | $row = false; |
---|
33 | if (!( ($new!='oui' AND (!autoriser('voir','document',$id_document) OR !autoriser('modifier','document', $id_document))) |
---|
34 | OR ($new=='oui' AND !autoriser('creer','document')) )) { |
---|
35 | if ($new != "oui") |
---|
36 | $row = sql_fetsel("*", "spip_documents", "id_document=$id_document"); |
---|
37 | else $row = true; |
---|
38 | } |
---|
39 | if (!$row) { |
---|
40 | include_spip('inc/minipres'); |
---|
41 | echo minipres(); |
---|
42 | } |
---|
43 | else |
---|
44 | documents_edit_ok($row, $id_document, $parent, $new); |
---|
45 | } |
---|
46 | |
---|
47 | function documents_edit_ok($row, $id_document, $parent, $new) |
---|
48 | { |
---|
49 | |
---|
50 | if (defined('_AJAX') AND _AJAX){ |
---|
51 | $contexte = array( |
---|
52 | 'redirect'=>'',//generer_url_ecrire("portfolio"), |
---|
53 | 'new'=>$new == "oui"?$new:$id_document, |
---|
54 | 'parent'=>$parent, |
---|
55 | 'config_fonc'=>'documents_edit_config', |
---|
56 | 'fichier'=>$row['fichier'] |
---|
57 | ); |
---|
58 | |
---|
59 | include_spip('inc/actions'); |
---|
60 | ajax_retour(recuperer_fond("prive/editer/document_popup", $contexte)); |
---|
61 | return; |
---|
62 | } |
---|
63 | |
---|
64 | if ($new != 'oui') { |
---|
65 | $id_document=$row['id_document']; |
---|
66 | $titre=$row['titre']?$row['titre']:$row['fichier']; |
---|
67 | $statut=$row['statut']; |
---|
68 | } |
---|
69 | else { |
---|
70 | $titre = ""; |
---|
71 | $statut = "prop"; |
---|
72 | } |
---|
73 | |
---|
74 | $commencer_page = charger_fonction('commencer_page', 'inc'); |
---|
75 | pipeline('exec_init',array('args'=>array('exec'=>'documents_edit','id_document'=>$id_document),'data'=>'')); |
---|
76 | |
---|
77 | echo $commencer_page(_T('gestdoc:titre_page_documents_edit', array('titre' => $titre)), "naviguer", "documents"); |
---|
78 | |
---|
79 | echo debut_gauche('', true); |
---|
80 | $boite = pipeline ('boite_infos', array('data' => '', |
---|
81 | 'args' => array( |
---|
82 | 'type'=>'document', |
---|
83 | 'id' => $id_document, |
---|
84 | 'row' => $row |
---|
85 | ) |
---|
86 | )); |
---|
87 | |
---|
88 | echo debut_boite_info(true). $boite . fin_boite_info(true); |
---|
89 | |
---|
90 | echo recuperer_fond("prive/navigation/documents_edit",array('id_document'=>$id_document)); |
---|
91 | echo pipeline('affiche_gauche',array('args'=>array('exec'=>'documents_edit','id_document'=>$id_document),'data'=>'')); |
---|
92 | echo creer_colonne_droite('', true); |
---|
93 | echo pipeline('affiche_droite',array('args'=>array('exec'=>'documents_edit','id_document'=>$id_document),'data'=>'')); |
---|
94 | echo debut_droite('', true); |
---|
95 | |
---|
96 | $redirect = _request('redirect') ? _request('redirect') : generer_url_ecrire("portfolio"); |
---|
97 | $contexte = array( |
---|
98 | 'icone_retour'=>$new=='oui'?'':icone_inline(_T('icone_retour'),$redirect, find_in_path("images/document-24.png"), "rien.gif",$GLOBALS['spip_lang_left']), |
---|
99 | 'redirect'=>_request('redirect',''),//generer_url_ecrire("portfolio"), |
---|
100 | 'titre'=>$titre, |
---|
101 | 'new'=>$new == "oui"?$new:$id_document, |
---|
102 | 'parent'=>$parent, |
---|
103 | 'config_fonc'=>'documents_edit_config' |
---|
104 | ); |
---|
105 | |
---|
106 | $milieu = recuperer_fond("prive/editer/document", $contexte); |
---|
107 | echo pipeline('affiche_milieu',array('args'=>array('exec'=>'documents_edit','id_document'=>$id_document),'data'=>$milieu)); |
---|
108 | |
---|
109 | echo fin_gauche(), fin_page(); |
---|
110 | |
---|
111 | } |
---|
112 | |
---|
113 | ?> |
---|