Dotclear

Changeset 1812:39cc57b045d6


Ignore:
Timestamp:
08/31/13 15:07:38 (11 years ago)
Author:
Lepeltier kévin
Branch:
Ticket #1539
Message:

Ticket #1539: Si wiki est choisi, affichage du bouton "Convertir en xhtml"
Si xhtml est choisi, affichage du bouton "Vérifier la validité xhtml"

Location:
admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_post.js

    r1638 r1812  
    9090                    $(this).val(last_post_format); 
    9191               } 
     92                
     93               $('.format_control > *').addClass('hide'); 
     94               if( $(this).val() == 'xhtml' ) { 
     95                    $('.control_xhtml > *').removeClass('hide'); 
     96               } else if ( $(this).val() == 'wiki' ) { 
     97                    $('.control_wiki > *').removeClass('hide'); 
     98               } 
    9299          }); 
    93100 
     
    118125          }); 
    119126 
    120           // Hide some fields 
    121           $('#notes-area label').toggleWithLegend($('#notes-area').children().not('label'),{ 
    122                cookie: 'dcx_post_notes', 
    123                legend_click:true, 
    124                hide: $('#post_notes').val() == '' 
    125           }); 
    126           $('#create_cat').toggleWithLegend($('#create_cat').parent().children().not('#create_cat'),{ 
    127                // no cookie on new category as we don't use this every day 
    128                legend_click: true 
    129           }); 
    130           $('#post_lang').parent().children('label').toggleWithLegend($('#post_lang'),{ 
    131                cookie: 'dcx_post_lang', 
    132                legend_click: true 
    133           }); 
    134           $('#post_password').parent().children('label').toggleWithLegend($('#post_password'),{ 
    135                cookie: 'dcx_post_password', 
    136                legend_click: true, 
    137                hide: $('#post_password').val() == '' 
    138           }); 
    139           $('#post_status').parent().children('label').toggleWithLegend($('#post_status'),{ 
    140                cookie: 'dcx_post_status', 
    141                legend_click: true 
    142           }); 
    143           $('#post_dt').parent().children('label').toggleWithLegend($('#post_dt').parent().children().not('label'),{ 
    144                cookie: 'dcx_post_dt', 
    145                legend_click: true 
    146           }); 
    147           $('#label_format').toggleWithLegend($('#label_format').parent().children().not('#label_format'),{ 
    148                cookie: 'dcx_post_format', 
    149                legend_click: true 
    150           }); 
    151           $('#cat_id').parent().children('label').toggleWithLegend($('#cat_id'),{ 
    152                cookie: 'cat_id', 
    153                legend_click: true 
    154           }); 
    155           $('#post_url').parent().children('label').toggleWithLegend($('#post_url').parent().children().not('label'),{ 
    156                cookie: 'post_url', 
    157                legend_click: true 
    158           }); 
    159           // We load toolbar on excerpt only when it's ready 
    160           $('#excerpt-area label').toggleWithLegend($('#excerpt-area').children().not('label'),{ 
    161                cookie: 'dcx_post_excerpt', 
    162                legend_click: true, 
    163                hide: $('#post_excerpt').val() == '' 
    164           }); 
    165  
    166           // Load toolbars 
    167           contentTb.switchMode(formatField.value); 
    168           excerptTb.switchMode(formatField.value); 
    169  
    170           // Replace attachment remove links by a POST form submit 
    171           $('a.attachment-remove').click(function() { 
    172                this.href = ''; 
    173                var m_name = $(this).parents('ul').find('li:first>a').attr('title'); 
    174                if (window.confirm(dotclear.msg.confirm_remove_attachment.replace('%s',m_name))) { 
    175                     var f = $('#attachment-remove-hide').get(0); 
    176                     f.elements['media_id'].value = this.id.substring(11); 
    177                     f.submit(); 
    178                } 
    179                return false; 
    180           }); 
    181  
    182127          // Markup validator 
    183           var h = document.createElement('h4'); 
    184           var a = document.createElement('a'); 
     128          var v = $('<div class="format_control control_xhtml"><p><a id="a-validator"></a></p><div/>').get(0); 
     129          $('.control_wiki').before(v); 
     130          var a = $('#a-validator').get(0); 
    185131          a.href = '#'; 
    186           a.className = 'button'; 
     132          a.className = 'button '; 
    187133          $(a).click(function() { 
    188134               var params = { 
     
    211157                         $(p).addClass('message'); 
    212158                         $(p).text(dotclear.msg.xhtml_valid); 
    213                          $(p).insertAfter(h); 
     159                         $(v).append(p); 
    214160                         $(p).backgroundFade({sColor:'#666666',eColor:'#ffcc00',steps:50},function() { 
    215161                                   $(this).backgroundFade({sColor:'#ffcc00',eColor:'#666666'}); 
     
    225171                         $(div).addClass('error'); 
    226172                         $(div).html('<p><strong>' + dotclear.msg.xhtml_not_valid + '</strong></p>' + $(data).find('errors').text()); 
    227                          $(div).insertAfter(h); 
     173                         $(v).append(div); 
    228174                         $(div).backgroundFade({sColor:'#ffffff',eColor:'#FFBABA',steps:50},function() { 
    229175                                   $(this).backgroundFade({sColor:'#ffbaba',eColor:'#ffffff'}); 
     
    238184 
    239185          a.appendChild(document.createTextNode(dotclear.msg.xhtml_validator)); 
    240           h.appendChild(a); 
    241           $(h).appendTo('#entry-content'); 
     186           
     187          $('.format_control > *').addClass('hide'); 
     188          if ( last_post_format == 'xhtml' ) { 
     189               $('.control_xhtml > *').removeClass('hide'); 
     190          } else if ( last_post_format == 'wiki' ) { 
     191               $('.control_wiki > *').removeClass('hide'); 
     192          } 
     193 
     194          // Hide some fields 
     195          $('#notes-area label').toggleWithLegend($('#notes-area').children().not('label'),{ 
     196               cookie: 'dcx_post_notes', 
     197               legend_click:true, 
     198               hide: $('#post_notes').val() == '' 
     199          }); 
     200          $('#create_cat').toggleWithLegend($('#create_cat').parent().children().not('#create_cat'),{ 
     201               // no cookie on new category as we don't use this every day 
     202               legend_click: true 
     203          }); 
     204          $('#post_lang').parent().children('label').toggleWithLegend($('#post_lang'),{ 
     205               cookie: 'dcx_post_lang', 
     206               legend_click: true 
     207          }); 
     208          $('#post_password').parent().children('label').toggleWithLegend($('#post_password'),{ 
     209               cookie: 'dcx_post_password', 
     210               legend_click: true, 
     211               hide: $('#post_password').val() == '' 
     212          }); 
     213          $('#post_status').parent().children('label').toggleWithLegend($('#post_status'),{ 
     214               cookie: 'dcx_post_status', 
     215               legend_click: true 
     216          }); 
     217          $('#post_dt').parent().children('label').toggleWithLegend($('#post_dt').parent().children().not('label'),{ 
     218               cookie: 'dcx_post_dt', 
     219               legend_click: true 
     220          }); 
     221          $('#label_format').toggleWithLegend($('#label_format').parent().children().not('#label_format'),{ 
     222               cookie: 'dcx_post_format', 
     223               legend_click: true 
     224          }); 
     225          $('#cat_id').parent().children('label').toggleWithLegend($('#cat_id'),{ 
     226               cookie: 'cat_id', 
     227               legend_click: true 
     228          }); 
     229          $('#post_url').parent().children('label').toggleWithLegend($('#post_url').parent().children().not('label'),{ 
     230               cookie: 'post_url', 
     231               legend_click: true 
     232          }); 
     233          // We load toolbar on excerpt only when it's ready 
     234          $('#excerpt-area label').toggleWithLegend($('#excerpt-area').children().not('label'),{ 
     235               cookie: 'dcx_post_excerpt', 
     236               legend_click: true, 
     237               hide: $('#post_excerpt').val() == '' 
     238          }); 
     239 
     240          // Load toolbars 
     241          contentTb.switchMode(formatField.value); 
     242          excerptTb.switchMode(formatField.value); 
     243 
     244          // Replace attachment remove links by a POST form submit 
     245          $('a.attachment-remove').click(function() { 
     246               this.href = ''; 
     247               var m_name = $(this).parents('ul').find('li:first>a').attr('title'); 
     248               if (window.confirm(dotclear.msg.confirm_remove_attachment.replace('%s',m_name))) { 
     249                    var f = $('#attachment-remove-hide').get(0); 
     250                    f.elements['media_id'].value = this.id.substring(11); 
     251                    f.submit(); 
     252               } 
     253               return false; 
     254          }); 
    242255 
    243256          // Check unsaved changes before XHTML conversion 
  • admin/post.php

    r1625 r1812  
    445445                         '<p>'.form::combo('post_format',$formaters_combo,$post_format,'maximal'). 
    446446                         '</p>'. 
    447                          '<p>'.($post_id && $post_format != 'xhtml' ?  
    448                          '<a id="convert-xhtml" class="button maximal" href="post.php?id='.$post_id.'&amp;xconv=1">'. 
    449                          __('Convert to XHTML').'</a>' : '').'</p></div>')), 
     447                         '<p class="format_control control_wiki">'. 
     448                         '<a id="convert-xhtml" class="button maximal '.($post_id && $post_format != 'wiki' ? 'hide' : '').'" href="post.php?id='.$post_id.'&amp;xconv=1">'. 
     449                         __('Convert to XHTML').'</a></p></div>')), 
    450450          'metas-box' => array( 
    451451               'title' => __('Ordering'), 
  • admin/style/default.css

    r1636 r1812  
    3434a:hover, a:active, a:focus { 
    3535     text-decoration: underline; 
     36} 
     37a.hide, a.button.hide, a.submit.hide { 
     38     display: none; 
    3639} 
    3740a img, a:link img, a:visited img { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map