diff --git a/.gitattributes b/.gitattributes index 7c6716be8bcfa573d5b7204db05bcef2b72b4497..13761c176c4703027bf8737f19f19a6375a02072 100644 --- a/.gitattributes +++ b/.gitattributes @@ -18,7 +18,6 @@ formulaires/editer_document.html -text formulaires/editer_document.php -text formulaires/illustrer_document.html -text formulaires/illustrer_document.php -text -formulaires/inc-colonne_documents.html -text formulaires/inc-lister_archive_jointe.html -text formulaires/inc-upload_document.html -text formulaires/joindre_document.html -text @@ -88,6 +87,7 @@ prive/squelettes/contenu/document_edit.html -text prive/squelettes/contenu/mediatheque.html -text prive/squelettes/inclure/ajouter-documents.html -text prive/squelettes/inclure/bouton-supprimer-orphelins.html -text +prive/squelettes/inclure/colonne-documents.html -text prive/squelettes/inclure/document_infos.html -text prive/squelettes/inclure/mediatheque-galerie.html -text prive/squelettes/inclure/mediatheque-navigation.html -text diff --git a/formulaires/inc-upload_document.html b/formulaires/inc-upload_document.html index 86882f1ca094d078439e24d40edddda14683c95f..52440efee1948c2c1710653cfad5e2142ac21817 100644 --- a/formulaires/inc-upload_document.html +++ b/formulaires/inc-upload_document.html @@ -1,9 +1,15 @@ #SET{domid,_#ENV{mode}|concat{'_',#ENV{id,new}}} +#SET{methode,upload} +[(#ENV{joindre_mediatheque}|oui)#SET{methode,mediatheque}] +[(#ENV{joindre_distant}|oui)#SET{methode,distant}] +[(#ENV{joindre_ftp}|oui)#SET{methode,ftp}] + +<div id="defaultsubmit#GET{domid}"></div> [ (#REM) Formulaire d'upload de fichier -]<div class='joindre_mode#GET{domid}' id='joindre_upload#GET{domid}'> +]<div class='joindre_mode#GET{domid}[(#GET{methode}|=={upload}|non)jsnone]' id='joindre_upload#GET{domid}'> <ul> <li class='editer_fichier_upload[ (#ENV**{erreurs}|table_valeur{fichier_upload}|oui)erreur]'> <label for='fichier_upload#GET{domid}'><:info_telecharger:></label>[ @@ -15,10 +21,10 @@ <:medias:bouton_download_depuis:> <:medias:bouton_download_local:> [(#ENV{mediatheque,''}|oui) - | <a href='#' onclick="if (jQuery('#joindre_media#GET{domid}').is(':hidden')) {jQuery('div.joindre_mode#GET{domid}:visible').slideUp('fast');jQuery('#joindre_media#GET{domid}').slideDown('fast');}return false;"><:medias:bouton_download_par_mediatheque:></a>] + | <a href='#' onclick="change_methode('mediatheque');return false;"><:medias:bouton_download_par_mediatheque:></a>] [(#ENV{proposer_ftp,''}|oui) - | <a href='#' onclick="if (jQuery('#joindre_ftp#GET{domid}').is(':hidden')) {jQuery('div.joindre_mode#GET{domid}:visible').slideUp('fast');jQuery('#joindre_ftp#GET{domid}').slideDown('fast');}return false;"><:medias:bouton_download_par_ftp:></a>] - | <a href='#' onclick="if (jQuery('#joindre_distant#GET{domid}').is(':hidden')) {jQuery('div.joindre_mode#GET{domid}:visible').slideUp('fast');jQuery('#joindre_distant#GET{domid}').slideDown('fast');}return false;"><:medias:bouton_download_sur_le_web:></a> + | <a href='#' onclick="change_methode('ftp');return false;"><:medias:bouton_download_par_ftp:></a>] + | <a href='#' onclick="change_methode('distant');return false;"><:medias:bouton_download_sur_le_web:></a> </div> <p class='boutons'><input class='submit' type="submit" name="joindre_upload" value="<:medias:bouton_upload:>"/></p> </div>[ @@ -28,7 +34,7 @@ (#REM) Formulaire pour document dans mediatheque ][(#ENV{mediatheque,''}|oui) -<div class='joindre_mode#GET{domid}' id='joindre_media#GET{domid}'> +<div class='joindre_mode#GET{domid}[(#GET{methode}|=={mediatheque}|non)jsnone]' id='joindre_mediatheque#GET{domid}'> <ul> <li class='editer_refdoc_joindre[ (#ENV**{erreurs}|table_valeur{refdoc_joindre}|oui)erreur]'> <label for='refdoc_joindre#GET{domid}'><:medias:label_refdoc_joindre:></label>[ @@ -50,11 +56,11 @@ </script> <div class='sourceup'> <:medias:bouton_download_depuis:> - <a href='#' onclick="if (jQuery('#joindre_upload#GET{domid}').is(':hidden')) {jQuery('div.joindre_mode#GET{domid}:visible').slideUp('fast');jQuery('#joindre_upload#GET{domid}').slideDown('fast');}return false;"><:medias:bouton_download_local:></a> + <a href='#' onclick="change_methode('upload');return false;"><:medias:bouton_download_local:></a> | <:medias:bouton_download_par_mediatheque:> [(#ENV{proposer_ftp,''}|oui) - | <a href='#' onclick="if (jQuery('#joindre_ftp#GET{domid}').is(':hidden')) {jQuery('div.joindre_mode#GET{domid}:visible').slideUp('fast');jQuery('#joindre_ftp#GET{domid}').slideDown('fast');}return false;"><:medias:bouton_download_par_ftp:></a>] - | <a href='#' onclick="if (jQuery('#joindre_distant#GET{domid}').is(':hidden')) {jQuery('div.joindre_mode#GET{domid}:visible').slideUp('fast');jQuery('#joindre_distant#GET{domid}').slideDown('fast');}return false;"><:medias:bouton_download_sur_le_web:></a> + | <a href='#' onclick="change_methode('ftp');return false;"><:medias:bouton_download_par_ftp:></a>] + | <a href='#' onclick="change_methode('distant');return false;"><:medias:bouton_download_sur_le_web:></a> </div> <p class='boutons'><input class='submit' type="submit" name="joindre_mediatheque" value="<:medias:bouton_attacher_document:>"/></p> </div> @@ -65,7 +71,7 @@ (#REM) Formulaire pour upload ftp ][(#ENV{proposer_ftp,''}|oui) -<div class='joindre_mode#GET{domid}' id='joindre_ftp#GET{domid}'> +<div class='joindre_mode#GET{domid}[(#GET{methode}|=={ftp}|non)jsnone]' id='joindre_ftp#GET{domid}'> [ <ul> <li class='editer_cheminftp[ (#ENV**{erreurs}|table_valeur{cheminftp}|oui)erreur]'> @@ -77,21 +83,23 @@ </select> </li> </ul>][(#ENV{_dir_upload_ftp}|et{#ENV{_options_upload_ftp}|non}|oui) - <div class="infos"> + <p class="infos"> [(#VAL{info_installer_ftp}|_T{#ARRAY{upload,#ENV*{_dir_upload_ftp}}})] #AIDER{ins_upload} - </div> + </p> ] <div class='sourceup'> <:medias:bouton_download_depuis:> - <a href='#' onclick="if (jQuery('#joindre_upload#GET{domid}').is(':hidden')) {jQuery('div.joindre_mode#GET{domid}:visible').slideUp('fast');jQuery('#joindre_upload#GET{domid}').slideDown('fast');}return false;"><:medias:bouton_download_local:></a> + <a href='#' onclick="change_methode('upload');return false;"><:medias:bouton_download_local:></a> [(#ENV{mediatheque,''}|oui) - | <a href='#' onclick="if (jQuery('#joindre_media#GET{domid}').is(':hidden')) {jQuery('div.joindre_mode#GET{domid}:visible').slideUp('fast');jQuery('#joindre_media#GET{domid}').slideDown('fast');}return false;"><:medias:bouton_download_par_mediatheque:></a>] + | <a href='#' onclick="change_methode('mediatheque');return false;"><:medias:bouton_download_par_mediatheque:></a>] | <:medias:bouton_download_par_ftp:> - | <a href='#' onclick="if (jQuery('#joindre_distant#GET{domid}').is(':hidden')) {jQuery('div.joindre_mode#GET{domid}:visible').slideUp('fast');jQuery('#joindre_distant#GET{domid}').slideDown('fast');}return false;"><:medias:bouton_download_sur_le_web:></a> + | <a href='#' onclick="change_methode('distant');return false;"><:medias:bouton_download_sur_le_web:></a> </div> - [(#ENV*{_options_upload_ftp}|oui) - <p class='boutons'><input class='submit' type="submit" name="joindre_ftp" value="<:bouton_choisir:>"/></p> - ] + <p class='boutons'> + [(#ENV*{_options_upload_ftp}|oui) + <input class='submit' type="submit" name="joindre_ftp" value="<:bouton_choisir:>"/> + ] + </p> </div> ][ @@ -99,7 +107,7 @@ (#REM) Formulaire pour document distant -]<div class='joindre_mode#GET{domid}' id='joindre_distant#GET{domid}'> +]<div class='joindre_mode#GET{domid}[(#GET{methode}|=={distant}|non)jsnone]' id='joindre_distant#GET{domid}'> <ul> <li class='editer_url[ (#ENV**{erreurs}|table_valeur{url}|oui)erreur]'> <label for='url#GET{domid}'><:info_referencer_doc_distant:></label>[ @@ -109,11 +117,11 @@ </ul> <div class='sourceup'> <:medias:bouton_download_depuis:> - <a href='#' onclick="if (jQuery('#joindre_upload#GET{domid}').is(':hidden')) {jQuery('div.joindre_mode#GET{domid}:visible').slideUp('fast');jQuery('#joindre_upload#GET{domid}').slideDown('fast');}return false;"><:medias:bouton_download_local:></a> + <a href='#' onclick="change_methode('upload');return false;"><:medias:bouton_download_local:></a> [(#ENV{mediatheque,''}|oui) - | <a href='#' onclick="if (jQuery('#joindre_media#GET{domid}').is(':hidden')) {jQuery('div.joindre_mode#GET{domid}:visible').slideUp('fast');jQuery('#joindre_media#GET{domid}').slideDown('fast');}return false;"><:medias:bouton_download_par_mediatheque:></a>] + | <a href='#' onclick="change_methode('mediatheque');return false;"><:medias:bouton_download_par_mediatheque:></a>] [(#ENV{proposer_ftp,''}|oui) - | <a href='#' onclick="if (jQuery('#joindre_ftp#GET{domid}').is(':hidden')) {jQuery('div.joindre_mode#GET{domid}:visible').slideUp('fast');jQuery('#joindre_ftp#GET{domid}').slideDown('fast');}return false;"><:medias:bouton_download_par_ftp:></a>] + | <a href='#' onclick="change_methode('ftp');return false;"><:medias:bouton_download_par_ftp:></a>] | <:medias:bouton_download_sur_le_web:> </div> <p class='boutons'><input class='submit' type="submit" name="joindre_distant" value="<:bouton_choisir:>"/></p> @@ -126,24 +134,14 @@ ][<ul><li class='fieldset deballer_zip'>(#ENV**{erreurs}|table_valeur{lister_contenu_archive})</li></ul>] <script type='text/javascript'>/*<!#EVAL{chr(91)}CDATA#EVAL{chr(91)}*/ -setTimeout(function(){ -if (window.jQuery){ -jQuery(document).ready(function(){ - [(#ENV{joindre_upload}|oui) - jQuery('.joindre_mode#GET{domid}:not(#joindre_upload#GET{domid})').hide(); - ] - [(#ENV{joindre_mediatheque}|oui) - jQuery('.joindre_mode#GET{domid}:not(#joindre_media#GET{domid})').hide(); - ] - [(#ENV{joindre_distant}|oui) - jQuery('.joindre_mode#GET{domid}:not(#joindre_distant#GET{domid})').hide(); - ] - [(#ENV{joindre_ftp}|oui) - jQuery('.joindre_mode#GET{domid}:not(#joindre_ftp#GET{domid})').hide(); - ] - if (jQuery('.joindre_mode#GET{domid}:visible').length>1) - jQuery('.joindre_mode#GET{domid}:not(#joindre_upload#GET{domid})').hide(); -}); +function change_methode(methode){ + var id = "#joindre_"+methode+"#GET{domid}"; + if (jQuery(id).is(':hidden')) { + jQuery('div.joindre_mode#GET{domid}:visible').slideUp('fast'); + jQuery(id).slideDown('fast'); + } + // placer en haut du formulaire les boutons submit par defaut correspondant a la methode active + jQuery("#defaultsubmit#GET{domid}").html('').append(jQuery(id).find('.boutons').eq(-1).find('input').clone(true)); } -},10); +jQuery(function(){change_methode('#GET{methode}');}); /*#EVAL{chr(93)}[(#EVAL{chr(93)})]>*/</script> diff --git a/formulaires/joindre_document.php b/formulaires/joindre_document.php index 69f25c3401d5111bf8355475dd4f365cca505387..1289d2ccfc7212841edfa7e2349111fe5e73436a 100644 --- a/formulaires/joindre_document.php +++ b/formulaires/joindre_document.php @@ -73,7 +73,9 @@ function formulaires_joindre_document_charger_dist($id_document='new',$id_objet= $valeurs['proposer_ftp'] = ($valeurs['_options_upload_ftp'] or $valeurs['_dir_upload_ftp']); if ($galerie){ - # colonne documents ou portfolio ? + # passer optionnellement une galerie jointe au form + # plus utilise nativement, on prefere la mise a jour + # apres upload par ajaxReload('documents') $valeurs['_galerie'] = $galerie; } if ($objet AND $id_objet){ @@ -187,17 +189,20 @@ function formulaires_joindre_document_traiter_dist($id_document='new',$id_objet= if (count($messages_erreur)) $res['message_erreur'] = implode('<br />',$messages_erreur); if ($nb_docs){ - $sel = "#doc".implode(",#doc",$sel); - $js = "if (window.jQuery) jQuery(function(){ajaxReload('documents');});"; - if ($nb_docs==1) - $js .= "setTimeout(function(){if (window.jQuery) jQuery('#doc$ancre a.editbox').get(0).focus();},30);"; - $js = "<script type='text/javascript'>$js</script>"; + #$sel = "#doc".implode(",#doc",$sel); $res['message_ok'] = singulier_ou_pluriel($nb_docs,'medias:document_installe_succes','medias:nb_documents_installe_succes').$js; } if ($ancre) $res['redirect'] = "#doc$ancre"; } - + if (isset($res['message_ok'])){ + $js = "if (window.jQuery) jQuery(function(){ajaxReload('documents');});"; + if ($ancre) + $js .= "setTimeout(function(){if (window.jQuery) jQuery('#doc$ancre a.editbox').get(0).focus();},900);"; + $js = "<script type='text/javascript'>$js</script>"; + $res['message_ok'] .= $js; + } + return $res; } diff --git a/inc/documents.php b/inc/documents.php index 9409876c1a74210792db60c6930aca33dd488f87..1c34b9baee7a25736f748631e1d2f4dc00b3d114 100644 --- a/inc/documents.php +++ b/inc/documents.php @@ -195,9 +195,7 @@ function affiche_raccourci_doc($doc, $id, $align) { $align='center'; } - return - ((++$num > 1) ? "" : http_script('', "spip_barre.js")) - . "\n<div style='text-align: $align'$onclick><$doc$id$pipe></div>\n"; + return "\n<div style='text-align: $align'$onclick><$doc$id$pipe></div>\n"; } ?> diff --git a/prive/editer/colonne_document.html b/prive/editer/colonne_document.html index 46416b455904d655b76a8d5be375328eac7f2e12..1103714c378026645cf09edc9dc945ed9fdf5392 100644 --- a/prive/editer/colonne_document.html +++ b/prive/editer/colonne_document.html @@ -1,6 +1,7 @@ <div class='ajax'> -#FORMULAIRE_JOINDRE_DOCUMENT{new,#ENV{id_objet},#ENV{objet},'auto','formulaires/inc-colonne_documents'} +#FORMULAIRE_JOINDRE_DOCUMENT{new,#ENV{id_objet},#ENV{objet}} </div> +<INCLURE{fond=prive/squelettes/inclure/colonne-documents,env,ajax=documents}> [<script type="text/javascript" src='(#CHEMIN{javascript/jquery.MultiFile.js})'></script> <script type='text/javascript'> jQuery.MultiFile(); diff --git a/formulaires/inc-colonne_documents.html b/prive/squelettes/inclure/colonne-documents.html similarity index 100% rename from formulaires/inc-colonne_documents.html rename to prive/squelettes/inclure/colonne-documents.html