Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mnt/113/sda/5/4/mathematiques.ac/ecrire/req/mysql.php on line 499
var spipDataProcessor={ toDataFormat:function(html, fixForBody){ return $.ajax({ url:CKEDITOR.spipurl+'?page=ckspip_convert', data:{text_area:html,cvt:'html2spip'}, global:false, type:"POST", dataType:"text", async:false } ).responseText; }, toHtml:function(data, fixForBody){ return $.ajax({ url:CKEDITOR.spipurl+'?page=ckspip_convert', data:{text_area:data,cvt:'spip2html'}, global:false, type:"POST", dataType:"text", async:false } ).responseText; } }; function htmldecode(s){ return $('
').html(s).text(); } function HideSpipUI(editor_id){ var crayon=editor_id.match(/^(#crayon_\d+)\s/); if(crayon) { stack[editor_id].crborder=$(crayon[1]+' .formulaire_spip').css('border'); stack[editor_id].crbg=$(crayon[1]+' .formulaire_spip').css('background-color'); $(crayon[1]+' .formulaire_spip') .css('border','none') .css('background-color','white'); } var item; if (editor_id.match(/^#formulaire_forum\s/)) { item=$('.forum'); stack[editor_id].fobd=item.css('border'); stack[editor_id].fobg=item.css('background'); item.css('border','none'); item.css('background','none'); }else{ item=$(editor_id).parents().find('.edition'); } item .find('.spip_barre').css('display','none').end() .find('.explication').css('display','none').end() .find('.markItUpHeader').css('display','none').end() .find('.markItUpTabs').css('display','none').end() .find('.markItUpPreview').css('display','none').end() .find('.markItUpFooter').css('display','none'); } function ShowSpipUI(editor_id){ var item; if (editor_id.match(/^#formulaire_forum\s/)) { item=$('.forum'); item.css('border',stack[editor_id].fobd); item.css('background',stack[editor_id].fobg); }else{ item=$(stack[editor_id]).parents().find('.edition'); } var crayon=editor_id.match(/^(#crayon_\d+)\s/); if(crayon) { $(crayon[1]+' .formulaire_spip') .css('border', stack[editor_id].crborder) .css('background-color',stack[editor_id].crbg); } if(item.find('.markItUpTabs .previsuVoir').hasClass('on')){ item.find('.markItUpTabs').css('display','').end() .find('.markItUpPreview').css('display','block').end() .find('.markItUpEditor').css('display','none'); }else{ item.find('.spip_barre').css('display','').end() .find('.explication').css('display','').end() .find('.markItUpHeader').css('display','').end() .find('.markItUpTabs').css('display','').end() .find('.markItUpFooter').css('display','').end() .find('.markItUpEditor').css('display','block').end() .find('.markItUpPreview').css('display','none'); } } var stack=[]; function SpipEditor2CKEditor(editor_id){ if ($(editor_id).size()==0) {return;} $('#swapeditor_'+stack[editor_id].ndx) .attr('disabled',true) .attr('title', htmldecode('Chargement')) .find('img') .attr('src', CKEDITOR.img_loading); $(editor_id).attr('disabled',true); var EdConfig={};$.extend(EdConfig,CKEDITOR.ckConfig) ; EdConfig.toolbar='Spip'+stack[editor_id].tb; $(editor_id).ckeditor(function (){ stack[editor_id].n='#'+this.container.getId(); stack[editor_id].w=$(stack[editor_id].n).width(); $(stack[editor_id].n).css('position','absolute'); useColumnWidth(editor_id); $(editor_id).ckeditorGet().on('resize', function(ev){ if(stack[editor_id].wr) clearTimeout(stack[editor_id].wr); stack[editor_id].wr=setTimeout(function(){ stack[editor_id].wr=null; fixEditorHeight(editor_id); for(var ed in stack){ if(ed!=editor_id) useColumnWidth(ed); } },750); }); $('.mot-cle-24').click(function(){fixEditorOffset(editor_id);fixEditorHeight(editor_id);}); $('[id^=bouton_modifier] a').click(function(){fixEditorOffset(editor_id);fixEditorHeight(editor_id);}); for(var ed in stack){ if(ed!=editor_id) fixEditorOffset(ed); } contexteChange(editor_id); $(editor_id).attr('disabled',''); HideSpipUI(editor_id); $('#swapeditor_'+stack[editor_id].ndx) .attr('title', htmldecode('Utiliser l'éditeur de SPIP')) .find('img') .attr('src', CKEDITOR.img_spip) .end() .attr('disabled',''); },EdConfig); } function CKEditor2SpipEditor(editor_id){ if($(editor_id).size()==0){return;} $('#swapeditor_'+stack[editor_id].ndx) .attr('disabled',true) .attr('title', htmldecode('Chargement')) .find('img') .attr('src',CKEDITOR.img_loading); $(editor_id) .attr('disabled',true) .css('display','block') .ckeditorGet().destroy(); ShowSpipUI(editor_id); $('#cke_fixheight_'+stack[editor_id].ndx).css('height',0); for(var ed in stack){ if(ed!=editor_id)fixEditorOffset(ed); } $('#swapeditor_'+stack[editor_id].ndx) .attr('title',htmldecode('Utiliser CKEditor')) .find('img') .attr('src',CKEDITOR.img_ckeditor) .end() .attr('disabled',''); $(editor_id) .attr('disabled',''); } function SwapEditor(editor_id){ try{ CKEditor2SpipEditor(editor_id); }catch(e){ SpipEditor2CKEditor(editor_id); } } function contexteChange(editor_id){ if($("#contexte_"+stack[editor_id].ndx).length){ var contexte=$("#contexte_"+stack[editor_id].ndx).val().match(/^([\.#])(.*)$/); if(stack[editor_id].ctx){ if(stack[editor_id].ctx[1]=="#"){ $(stack[editor_id].n+' iframe').contents().find('body').attr('id',''); }else{ $(stack[editor_id].n+' iframe').contents().find('body').removeClass(stack[editor_id].ctx[2]); } } stack[editor_id].ctx=contexte; if(contexte){ if(contexte[1]=="#"){ $(stack[editor_id].n+' iframe').contents().find('body').attr('id', contexte[2]); }else{ $(stack[editor_id].n+' iframe').contents().find('body').addClass(contexte[2]); } } } } function fixEditorOffset(editor_id){ var cke_buttons=$('#cke_buttons_'+stack[editor_id].ndx), offset=cke_buttons.offset(); if(offset){ offset.top=offset.top+cke_buttons.height(); $(stack[editor_id].n).offset(offset); } } function fixEditorHeight(editor_id){ $('#cke_fixheight_'+stack[editor_id].ndx).css('height',$(stack[editor_id].n).height()+7); } function useColumnWidth(editor_id){ $(stack[editor_id].n).width(Math.max(CKEDITOR.ckConfig.minwidth+2,stack[editor_id].w)); fixEditorOffset(editor_id); fixEditorHeight(editor_id); } function useAllWidth(editor_id){ var cke_buttons=$('#cke_buttons_'+stack[editor_id].ndx); $(stack[editor_id].n).offset({'top':cke_buttons.offset().top+cke_buttons.height(),'left':0 }); $(editor_id).ckeditorGet() .resize($(window).width(),$(window).height()-cke_buttons.height()-6-stack[editor_id].crayons); window.location.href='#cke_buttons_ancre_'+stack[editor_id].ndx; } function cke_crayon_submit(editor_id){ try{ $(editor_id).ckeditorGet().updateElement(); }catch(e){ /* rien */ } $(this).parents('.formulaire_crayon').submit(); } function fullInitCKEDITOR(editor_ids){ if(!editor_ids)editor_ids=[["textarea[name=texte]","Full"]]; initCKEDITOR(); CKEDITOR.ckConfig.on={ 'pluginsLoaded':function(ev){ev.editor.dataProcessor=spipDataProcessor;} }; if (!CKEDITOR.fullInitDone) { CKEDITOR.on('dialogDefinition',function(ev){ var dialogName=ev.data.name, dialogDefinition=ev.data.definition; if(dialogName==='about'){ var aboutTab=dialogDefinition.getContents('tab1'); aboutTab.add({ 'type':'html', 'html':'
Copyright © 2009 Plugin SPIP - Frédéric Bonnaud, Mehdi Cherifi, Emmanuel Dreyfus
' }); } var advTab=dialogDefinition.getContents('advanced'); if(advTab){ var advClasses=advTab.get('advCSSClasses'); if(advClasses){ advClasses['default']='spip'; } } }); for(var plugin in CKEDITOR.ckConfig.loadExtraPlugins){ CKEDITOR.plugins.addExternal(plugin, CKEDITOR.ckConfig.loadExtraPlugins[plugin]); } CKEDITOR.fullInitDone=true; } for(var id in editor_ids){ var editor_id=editor_ids[id][0], editor_tb=editor_ids[id][1], crayon=editor_ids[id][2]; if(CKEDITOR.version'+pref.replace(/%2/,CKEDITOR.ckpreferedversion).replace(/%1/,CKEDITOR.version)+'
' ); } var ndx=$('div[id^=cke_fixheight_]').size(),buttons=''; stack[editor_id]={'n':null,'w':null,'wr':null,'ctx':null,'crayons':0,'ndx':ndx,'tb':editor_tb}; $(editor_id).after('
 
'); if(!CKEDITOR.cache_redim) buttons='' + ''; if(CKEDITOR.ckeditmode!='ckeditor-exclu'){ buttons=buttons + ''; } ; if(buttons) $(editor_id).before('
'+buttons+'
'); if(crayon){ $('#'+crayon+' .crayon-submit') .after('') .remove(); } } if(CKEDITOR.ckeditmode!='spip'){ for(var id in editor_ids){ SpipEditor2CKEditor(editor_ids[id][0]); } } $("div[ondblclick^=barre_inserer]").each(function(){ var spip_dblclick=$(this).attr('ondblclick'), str_dblclick=""+spip_dblclick; params=str_dblclick.match(/barre_inserer\(\s*"(.*)"\s*,\s*\$\("(.*)"\)/); if(params[1] && params[2]){ var insert_text=params[1],insert_html=null, doc=insert_text.match(/^(<|<|<|\u003c)([a-zA-Z]*)(\d*)(.*)(>|>|>|\u003e)$/); if(doc){ var doc_url=$.trim($.ajax({ url: CKEDITOR.spipurl+'?page=ckdoc&id='+doc[3], async: false, dataType:'text' }).responseText), alignement=doc[4].match(/(.*)\|(left|center|right)(|\|(.*))/),style='',align=''; if(alignement){ if(alignement[2]=='left'){ align=" align='left'"; }else if(alignement[2]=='right'){ align=" align='right'"; }else if(alignement[2]=='center'){ align=" align='middle'"; style="display:block;margin-left:auto;margin-right:auto;"; } } if(CKEDITOR.ckConfig.vignette>0){ style=style+"max-width:"+CKEDITOR.ckConfig.vignette+"px;max-height:"+CKEDITOR.ckConfig.vignette+"px;"; } style=(style?" style='"+style+"'":''); insert_html=""+doc[2]+doc[3]+doc[4]+""; } $(this) .attr('ondblclick',null) .dblclick(function(){ try{ if(insert_html){ $(params[2]).ckeditorGet().insertHtml(insert_html); }else if(insert_text){ $(params[2]).ckeditorGet().insertText(insert_text); } }catch(e){ spip_dblclick(); } }); } }); }