includes/clientside/static/editor.js
changeset 541 acb7e23b6ffa
parent 504 bc8e0e9ee01d
child 544 81b4499a963e
equal deleted inserted replaced
540:1e4b759da336 541:acb7e23b6ffa
   364       small2.appendChild(document.createTextNode($lang.get('editor_msg_captcha_blind')));
   364       small2.appendChild(document.createTextNode($lang.get('editor_msg_captcha_blind')));
   365       td4_1.appendChild(small2);
   365       td4_1.appendChild(small2);
   366       
   366       
   367       var img = document.createElement('img');
   367       var img = document.createElement('img');
   368       img.src = makeUrlNS('Special', 'Captcha/' + captcha_hash);
   368       img.src = makeUrlNS('Special', 'Captcha/' + captcha_hash);
   369       img._captchaHash = captcha_hash;
   369       img.setAttribute('enano:captcha_hash', captcha_hash);
   370       img.id = 'enano_editor_captcha_img';
   370       img.id = 'enano_editor_captcha_img';
   371       img.onclick = function()
   371       img.onclick = function()
   372       {
   372       {
   373         this.src = makeUrlNS('Special', 'Captcha/' + this._captchaHash + '/' + Math.floor(Math.random() * 100000));
   373         this.src = makeUrlNS('Special', 'Captcha/' + this.getAttribute('enano:captcha_hash') + '/' + Math.floor(Math.random() * 100000));
   374       }
   374       }
   375       img.style.cursor = 'pointer';
   375       img.style.cursor = 'pointer';
   376       td4_2.appendChild(img);
   376       td4_2.appendChild(img);
   377       td4_2.appendChild(document.createElement('br'));
   377       td4_2.appendChild(document.createElement('br'));
   378       td4_2.appendChild(document.createTextNode($lang.get('editor_lbl_field_captcha_code') + ' '));
   378       td4_2.appendChild(document.createTextNode($lang.get('editor_lbl_field_captcha_code') + ' '));
   379       var input = document.createElement('input');
   379       var input = document.createElement('input');
   380       input.type = 'text';
   380       input.type = 'text';
   381       input.id = 'enano_editor_field_captcha';
   381       input.id = 'enano_editor_field_captcha';
   382       input._captchaHash = captcha_hash;
   382       input.setAttribute('enano:captcha_hash', captcha_hash);
   383       input.size = '9';
   383       input.size = '9';
   384       td4_2.appendChild(input);
   384       td4_2.appendChild(input);
   385       
   385       
   386       tr4.appendChild(td4_1);
   386       tr4.appendChild(td4_1);
   387       tr4.appendChild(td4_2);
   387       tr4.appendChild(td4_2);
   620     draft: ( is_draft == true ),
   620     draft: ( is_draft == true ),
   621     used_draft: used_draft
   621     used_draft: used_draft
   622   };
   622   };
   623   
   623   
   624   // Do we need to add captcha info?
   624   // Do we need to add captcha info?
   625   if ( document.getElementById('enano_editor_field_captcha') )
   625   if ( document.getElementById('enano_editor_field_captcha') && !is_draft )
   626   {
   626   {
   627     var captcha_field = document.getElementById('enano_editor_field_captcha');
   627     var captcha_field = document.getElementById('enano_editor_field_captcha');
   628     if ( captcha_field.value == '' )
   628     if ( captcha_field.value == '' )
   629     {
   629     {
   630       new messagebox(MB_OK|MB_ICONSTOP, $lang.get('editor_err_need_captcha_title'), $lang.get('editor_err_need_captcha_body'));
   630       new messagebox(MB_OK|MB_ICONSTOP, $lang.get('editor_err_need_captcha_title'), $lang.get('editor_err_need_captcha_body'));
   631       ajaxUnSetEditorLoading();
   631       ajaxUnSetEditorLoading();
   632       return false;
   632       return false;
   633     }
   633     }
   634     json_packet.captcha_code = captcha_field.value;
   634     json_packet.captcha_code = captcha_field.value;
   635     json_packet.captcha_id = captcha_field._captchaHash;
   635     json_packet.captcha_id = captcha_field.getAttribute('enano:captcha_hash');
   636   }
   636   }
   637   
   637   
   638   json_packet = ajaxEscape(toJSONString(json_packet));
   638   json_packet = ajaxEscape(toJSONString(json_packet));
   639   ajaxPost(stdAjaxPrefix + '&_mode=savepage_json', 'r=' + json_packet, function()
   639   ajaxPost(stdAjaxPrefix + '&_mode=savepage_json', 'r=' + json_packet, function()
   640     {
   640     {