Dotclear


Ignore:
Location:
admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_post.js

    r1717 r1815  
    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 
     
    117124               return window.confirm(dotclear.msg.confirm_delete_post); 
    118125          }); 
     126 
     127          // Markup validator 
     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); 
     131          a.href = '#'; 
     132          a.className = 'button '; 
     133          $(a).click(function() { 
     134                
     135               excerpt_content = $('#post_excerpt').css('display') != 'none' ? $('#post_excerpt').val() : $('#excerpt-area iframe').contents().find('body').html(); 
     136               post_content    = $('#post_content').css('display') != 'none' ? $('#post_content').val() : $('#content-area iframe').contents().find('body').html(); 
     137                
     138               var params = { 
     139                    xd_check: dotclear.nonce, 
     140                    f: 'validatePostMarkup', 
     141                    excerpt: excerpt_content, 
     142                    content: post_content, 
     143                    format: $('#post_format').get(0).value, 
     144                    lang: $('#post_lang').get(0).value 
     145               }; 
     146 
     147               $.post('services.php',params,function(data) { 
     148                    if ($(data).find('rsp').attr('status') != 'ok') { 
     149                         alert($(data).find('rsp message').text()); 
     150                         return false; 
     151                    } 
     152 
     153                    if ($(data).find('valid').text() == 1) { 
     154                         var p = document.createElement('p'); 
     155                         p.id = 'markup-validator'; 
     156 
     157                         if ($('#markup-validator').length > 0) { 
     158                              $('#markup-validator').remove(); 
     159                         } 
     160 
     161                         $(p).addClass('message'); 
     162                         $(p).text(dotclear.msg.xhtml_valid); 
     163                         $('#entry-content h3').after(p); 
     164                         $(p).backgroundFade({sColor:'#666666',eColor:'#ffcc00',steps:50},function() { 
     165                                   $(this).backgroundFade({sColor:'#ffcc00',eColor:'#666666'}); 
     166                         }); 
     167                    } else { 
     168                         var div = document.createElement('div'); 
     169                         div.id = 'markup-validator'; 
     170 
     171                         if ($('#markup-validator').length > 0) { 
     172                              $('#markup-validator').remove(); 
     173                         } 
     174 
     175                         $(div).addClass('error'); 
     176                         $(div).html('<p><strong>' + dotclear.msg.xhtml_not_valid + '</strong></p>' + $(data).find('errors').text()); 
     177                         $('#entry-content h3').after(div); 
     178                         $(div).backgroundFade({sColor:'#ffffff',eColor:'#FFBABA',steps:50},function() { 
     179                                   $(this).backgroundFade({sColor:'#ffbaba',eColor:'#ffffff'}); 
     180                         }); 
     181                    } 
     182 
     183                    return false; 
     184               }); 
     185 
     186               return false; 
     187          }); 
     188 
     189          a.appendChild(document.createTextNode(dotclear.msg.xhtml_validator)); 
     190           
     191          $('.format_control > *').addClass('hide'); 
     192          if ( last_post_format == 'xhtml' ) { 
     193               $('.control_xhtml > *').removeClass('hide'); 
     194          } else if ( last_post_format == 'wiki' ) { 
     195               $('.control_wiki > *').removeClass('hide'); 
     196          } 
    119197 
    120198          // Hide some fields 
     
    184262          }); 
    185263 
    186           // Markup validator 
    187           var h = document.createElement('h4'); 
    188           var a = document.createElement('a'); 
    189           a.href = '#'; 
    190           a.className = 'button'; 
    191           $(a).click(function() { 
    192                var params = { 
    193                     xd_check: dotclear.nonce, 
    194                     f: 'validatePostMarkup', 
    195                     excerpt: $('#post_excerpt').text(), 
    196                     content: $('#post_content').text(), 
    197                     format: $('#post_format').get(0).value, 
    198                     lang: $('#post_lang').get(0).value 
    199                }; 
    200  
    201                $.post('services.php',params,function(data) { 
    202                     if ($(data).find('rsp').attr('status') != 'ok') { 
    203                          alert($(data).find('rsp message').text()); 
    204                          return false; 
    205                     } 
    206  
    207                     if ($(data).find('valid').text() == 1) { 
    208                          var p = document.createElement('p'); 
    209                          p.id = 'markup-validator'; 
    210  
    211                          if ($('#markup-validator').length > 0) { 
    212                               $('#markup-validator').remove(); 
    213                          } 
    214  
    215                          $(p).addClass('message'); 
    216                          $(p).text(dotclear.msg.xhtml_valid); 
    217                          $(p).insertAfter(h); 
    218                          $(p).backgroundFade({sColor:'#666666',eColor:'#ffcc00',steps:50},function() { 
    219                                    $(this).backgroundFade({sColor:'#ffcc00',eColor:'#666666'}); 
    220                          }); 
    221                     } else { 
    222                          var div = document.createElement('div'); 
    223                          div.id = 'markup-validator'; 
    224  
    225                          if ($('#markup-validator').length > 0) { 
    226                               $('#markup-validator').remove(); 
    227                          } 
    228  
    229                          $(div).addClass('error'); 
    230                          $(div).html('<p><strong>' + dotclear.msg.xhtml_not_valid + '</strong></p>' + $(data).find('errors').text()); 
    231                          $(div).insertAfter(h); 
    232                          $(div).backgroundFade({sColor:'#ffffff',eColor:'#FFBABA',steps:50},function() { 
    233                                    $(this).backgroundFade({sColor:'#ffbaba',eColor:'#ffffff'}); 
    234                          }); 
    235                     } 
    236  
    237                     return false; 
    238                }); 
    239  
    240                return false; 
    241           }); 
    242  
    243           a.appendChild(document.createTextNode(dotclear.msg.xhtml_validator)); 
    244           h.appendChild(a); 
    245           $(h).appendTo('#entry-content'); 
    246  
    247264          // Check unsaved changes before XHTML conversion 
    248265          var excerpt = $('#post_excerpt').val(); 
  • admin/post.php

    r1714 r1815  
    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'), 
     
    523523           
    524524          "post_content" => 
    525                '<p class="area"><label class="required" '. 
     525               '<p class="area" id="content-area"><label class="required" '. 
    526526               'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. 
    527527               form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 
  • admin/style/default.css

    r1698 r1815  
    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