X-Git-Url: http://git.cyclocoop.org/?p=velocampus%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fecrire%2Faction%2Fediter_mots.php;fp=www%2Fecrire%2Faction%2Fediter_mots.php;h=3e73e7eec683e4f481f591037f7e7cf9ac88ab35;hp=0000000000000000000000000000000000000000;hb=80b4d3e85f78d402ed2e73f8f5d1bf4c19962eed;hpb=aaf970bf4cdaf76689ecc10609048e18d073820c diff --git a/www/ecrire/action/editer_mots.php b/www/ecrire/action/editer_mots.php new file mode 100644 index 0000000..3e73e7e --- /dev/null +++ b/www/ecrire/action/editer_mots.php @@ -0,0 +1,96 @@ +'mot','id'=>$id_mot) + ) + ); + } + } + if ($nouv_mot ? $nouv_mot : ($nouv_mot = _request('nouv_mot'))) { + // recopie de: + // inserer_mot("spip_mots_$table", $table_id, $id_objet, $nouv_mot); + $result = sql_countsel("spip_mots_$table", "id_mot=".intval($nouv_mot)." AND $table_id=$id_objet"); + if (!$result) + sql_insertq("spip_mots_$table", array('id_mot' => $nouv_mot, $table_id =>$id_objet)); + } + + // Notifications, gestion des revisions, reindexation... + if ($table) + pipeline('post_edition', + array( + 'args' => array( + 'operation' => 'editer_mots', + 'table' => 'spip_'.$table, + 'id_objet' => $id_objet + ), + 'data' => null + ) + ); + + $redirect = rawurldecode($redirect); + + // hack du retour croise editer/grouper + + if (preg_match('/^(.*exec=)editer_mots(&.*)script=(grouper_mots)(.*)$/', $redirect, $r)) + $redirect = $r[1] . $r[3] . $r[2] . $r[4]; + if (preg_match(',exec=grouper_mots,',$redirect)){ + // mettre a jour le total de mots dans la liste pour eviter les pb de cache navigateur avec ajax + $id_groupe = parametre_url($redirect,'id_groupe'); // recuperer l'id_groupe dans l'url + $groupe = sql_countsel("spip_mots", "id_groupe=".sql_quote($id_groupe)); + $redirect = parametre_url($redirect,'total',$groupe,'&'); + } + + if ($cherche_mot) { + if ($p = strpos($redirect, '#')) { + $a = substr($redirect,$p); + $redirect = substr($redirect,0,$p); + } else $a=''; + $redirect .= "&cherche_mot=".urlencode($cherche_mot) + ."&select_groupe=$select_groupe$a"; + } + redirige_par_entete($redirect); +} +?>