WordPress File Upload - Version 3.8.2

Version Description

  • fixed bug in wfu_after_file_loaded filter that was not working and was overriden by obsolete wfu_after_file_completed filter
  • added option in plugin's Settings in Dashboard to include additional files in plugin's database
  • added feature in Dashboard File Browser for admins to include additional files in plugin's database
Download this release

Release Info

Developer nickboss
Plugin Icon 128x128 WordPress File Upload
Version 3.8.2
Comparing to
See all releases

Code changes from version 3.8.1 to 3.8.2

js/wordpress_file_upload_adminfunctions.js CHANGED
@@ -1,3 +1,3 @@
1
- function wfu_admin_activate_tab(e){for(var t,a,l=document.getElementById("wfu_tab_container"),n=0;n<l.childNodes.length;n++)t=l.childNodes[n],1===t.nodeType&&(a=t.id.substr(8),t.className.indexOf("nav-tab-active")>-1&&(t.className="nav-tab",document.getElementById("wfu_container_"+a).style.display="none"));document.getElementById("wfu_tab_"+e).className="nav-tab nav-tab-active",document.getElementById("wfu_container_"+e).style.display="block"}function wfu_admin_onoff_clicked(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_"+e,"div",a),n=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",a),d="on"==t.className.substr(t.className.length-2);if(d=!d){document.getElementById("wfu_attribute_value_"+e).value="true",t.className="wfu_onoff_container_on";for(var o=0;o<l.length;o++)l[o].style.display="none";for(var o=0;o<n.length;o++)n[o].style.display="block"}else{document.getElementById("wfu_attribute_value_"+e).value="false",t.className="wfu_onoff_container_off";for(var o=0;o<l.length;o++)l[o].style.display="block";for(var o=0;o<n.length;o++)n[o].style.display="none"}wfu_generate_shortcode(),("userdata"==e||"formdata"==e)&&wfu_update_formfield_variables()}function wfu_admin_radio_clicked(e){var t=document.getElementsByName("wfu_radioattribute_"+e),a=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_"+e,"div",a),n=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",a),d="";for(u=0;u<t.length;u++)t[u].checked&&(d=t[u].value);var o="*"==d.substr(0,1);if(o){d=d.substr(1);for(var u=0;u<l.length;u++)l[u].style.display="none";for(var u=0;u<n.length;u++)n[u].style.display="block"}else{for(var u=0;u<l.length;u++)l[u].style.display="block";for(var u=0;u<n.length;u++)n[u].style.display="none"}document.getElementById("wfu_attribute_value_"+e).value=d,wfu_generate_shortcode()}function wfu_addEventHandler(e,t,a){e.addEventListener?e.addEventListener(t,a,!1):e.attachEvent?e.attachEvent("on"+t,a):e["on"+t]=a}function wfu_attach_separator_dragdrop_events(){for(var e,t=document.getElementById("wfu_placements_container"),a=0;a<t.childNodes.length;a++)e=t.childNodes[a],("wfu_component_separator_hor"==e.className||"wfu_component_separator_ver"==e.className)&&(wfu_addEventHandler(e,"dragenter",wfu_separator_dragenter),wfu_addEventHandler(e,"dragover",wfu_default_dragover),wfu_addEventHandler(e,"dragleave",wfu_separator_dragleave),wfu_addEventHandler(e,"drop",wfu_separator_drop))}function wfu_Attach_Admin_DragDrop_Events(){if(window.FileReader){var e=document.getElementById("wfu_placements_container");if(e){for(var t,a=document.getElementById("wfu_componentlist_container"),l=0;l<e.childNodes.length;l++)t=e.childNodes[l],"wfu_component_box"==t.className&&(wfu_addEventHandler(t,"dragstart",wfu_component_dragstart),wfu_addEventHandler(t,"dragend",wfu_component_dragend));for(var l=0;l<a.childNodes.length;l++)if(t=a.childNodes[l],"wfu_component_box_container"==t.className)for(var n=0;n<t.childNodes.length;n++)"wfu_component_box wfu_inbase"==t.childNodes[n].className&&(wfu_addEventHandler(t.childNodes[n],"dragstart",wfu_component_dragstart),wfu_addEventHandler(t.childNodes[n],"dragend",wfu_component_dragend));t=document.getElementById("wfu_componentlist_dragdrop"),wfu_addEventHandler(t,"dragenter",wfu_componentlist_dragenter),wfu_addEventHandler(t,"dragover",wfu_default_dragover),wfu_addEventHandler(t,"dragleave",wfu_componentlist_dragleave),wfu_addEventHandler(t,"drop",wfu_componentlist_drop),wfu_attach_separator_dragdrop_events()}}}function wfu_componentlist_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return-1==t.className.indexOf("wfu_componentlist_dragdrop_dragover")&&(t.className+=" wfu_componentlist_dragdrop_dragover"),!1}function wfu_componentlist_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className=t.className.replace(" wfu_componentlist_dragdrop_dragover",""),!1}function wfu_componentlist_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var a=t.split("_"),l=a[0],n=parseInt(a[1]),d=document.getElementById("wfu_component_box_"+l+"_"+n);0==n?(d.className="wfu_component_box wfu_inbase",d.style.display="block",document.getElementById("wfu_component_box_container_"+l).appendChild(d)):d.parentNode.removeChild(d);var o=wfu_admin_recreate_placements_text(null,"");return wfu_admin_recreate_placements_panel(o),document.getElementById("wfu_attribute_value_placements").value=o,wfu_update_multiplacement_attributes(),wfu_generate_shortcode(),!1}function wfu_separator_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.top=e.target.offsetTop+"px",t.style.display="block"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.top=e.target.offsetTop+"px",t.style.left=e.target.offsetLeft+"px",t.style.display="block"}return!1}function wfu_default_dragover(e){return e=e||window.event,e.preventDefault&&e.preventDefault(),!1}function wfu_separator_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.display="none"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.display="none"}return!1}function wfu_separator_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var a=t.split("_"),l=a[0],n=parseInt(a[1]),d=document.getElementById("wfu_component_box_"+l+"_"+n);d.style.display="none",d.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+l).appendChild(d);var o=wfu_admin_recreate_placements_text(e.target,l);return wfu_admin_recreate_placements_panel(o),document.getElementById("wfu_attribute_value_placements").value=o,wfu_update_multiplacement_attributes(),wfu_generate_shortcode(),!1}function wfu_component_dragstart(e){e=e||window.event,e.dataTransfer.setData("Component",e.target.id.replace("wfu_component_box_","")),-1==e.target.className.indexOf("wfu_component_box_dragged")&&(e.target.className+=" wfu_component_box_dragged",DraggedItem=e.target),e.target.style.zIndex=3;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className="wfu_componentlist_dragdrop wfu_componentlist_dragdrop_dragover",t.style.display="block",!1}function wfu_component_dragend(e){e=e||window.event,DraggedItem=null,e.target.style.zIndex=1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.style.display="none",t.className="wfu_componentlist_dragdrop",e.target.className=e.target.className.replace(" wfu_component_box_dragged",""),document.getElementById("wfu_component_bar_ver").style.display="none",document.getElementById("wfu_component_bar_hor").style.display="none",!1}function wfu_admin_recreate_placements_text(e,t){function a(e){""!=d&&(d+=n),d+=e,n=""}for(var l=document.getElementById("wfu_placements_container"),n="",d="",o=0;o<l.childNodes.length;o++)item=l.childNodes[o],"wfu_component_separator_ver"==item.className?(""==n&&(n="+"),item==e&&(a(t),n="+")):"wfu_component_separator_hor"==item.className?(n="/",item==e&&(a(t),n="/")):"wfu_component_box"==item.className&&a(item.id.replace("wfu_component_box_","").replace(/_.*$/,""));return d}function wfu_admin_recreate_placements_panel(e){for(var t,a,l,n,d,o,u,r=document.getElementById("wfu_placements_container"),_="",s=0;s<r.childNodes.length;s++)t=r.childNodes[s],"wfu_component_box"==t.className&&(n=t.id.replace("wfu_component_box_",""),d=n.split("_"),_=d[0],o=parseInt(d[1]),0==o?(t.style.display="inline-block",t.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+_).appendChild(t)):t.parentNode.removeChild(t));for(var c=document.querySelectorAll("div.wfu_component_box_container"),i={},s=0;s<c.length;s++)_=c[s].id.replace("wfu_component_box_container_",""),i[_]=0,u=document.querySelector("div#"+c[s].id+" div.wfu_component_box_index"),u&&(u.innerHTML="1");r.innerHTML="",a=e.split("/");for(var s=0;s<a.length;s++){t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),r.appendChild(t),t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),r.appendChild(t),l=a[s].split("+");for(var f=0;f<l.length;f++)t=document.querySelector("div#wfu_component_box_container_"+l[f]+" div.wfu_component_box.wfu_inbase"),t&&(n=t.id.replace("wfu_component_box_",""),d=n.split("_"),_=d[0],o=parseInt(d[1]),0==o?r.appendChild(t):(i[_]++,t.id="wfu_component_box_"+_+"_"+(i[_]+1).toString(),t.style.display="block",u=document.querySelector("div#"+t.id+" div.wfu_component_box_index"),u.innerHTML=(i[_]+1).toString(),t=t.cloneNode(!0),r.appendChild(t),t.id="wfu_component_box_"+_+"_"+i[_].toString(),u=document.querySelector("div#"+t.id+" div.wfu_component_box_index"),u.innerHTML=i[_].toString(),wfu_addEventHandler(t,"dragstart",wfu_component_dragstart),wfu_addEventHandler(t,"dragend",wfu_component_dragend)),t.className="wfu_component_box",t.style.display="inline-block",t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),r.appendChild(t))}t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),r.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_hor",t.className="wfu_component_bar_hor",r.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_ver",t.className="wfu_component_bar_ver",r.appendChild(t),wfu_attach_separator_dragdrop_events()}function wfu_update_multiplacement_attributes(){for(var e=document.querySelectorAll("div.wfu_component_box_container"),t=0;t<e.length;t++){itemname=e[t].id.replace("wfu_component_box_container_","");var a=document.querySelector("div#"+e[t].id+" div.wfu_component_box_index");if(a)for(var l=Math.max(1,parseInt(a.innerHTML)-1),n=document.getElementsByName("wfu_attribute_governor_"+itemname),d=0;d<n.length;d++)wfu_update_multiplacement_attribute(n[d].value,l)}}function wfu_update_multiplacement_attribute(e,t){if("userdatalabel"==e){var a=document.querySelectorAll("div.wfu_formdata_container"),l=a.length;if(1>l)return;for(var n,d,o=a[0],u=2;u<=Math.max(l,t);){if(u>l){var r=e+u.toString();for(n=o.parentNode;null!=n&&"TR"!=n.tagName;)n=n.parentNode;if(null==n||"TR"!=n.tagName)return;d=n.cloneNode(!0),d.id="tr_"+wfu_randomString(4),n.parentNode.appendChild(d);var _=document.querySelector("tr#"+d.id+' label[for="wfu_attribute_'+e+'"]');_.setAttribute("for","wfu_attribute_"+r),_.innerHTML+=" ("+u.toString()+")",_=document.querySelector("tr#"+d.id+" input.wfu_attribute_governor"),_.setAttribute("name","wfu_attribute_governor_independent"),_.value=r,_=document.querySelector("tr#"+d.id+" div.wfu_formdata_container"),_.id+=u.toString();var s=document.getElementById("wfu_attribute_default_"+r);s||(s=document.createElement("INPUT"),s.id="wfu_attribute_default_"+r,s.type="hidden",s.value=document.getElementById("wfu_attribute_default_"+e).value,document.getElementById("wfu_attribute_defaults").appendChild(s));var c=document.getElementById("wfu_attribute_value_"+r);c||(c=document.createElement("INPUT"),c.id="wfu_attribute_value_"+r,c.type="hidden",c.value=s.value,document.getElementById("wfu_attribute_values").appendChild(c)),window["wfu_attribute_"+r+"_formtemplate"]=window["wfu_attribute_"+e+"_formtemplate"],window["wfu_attribute_"+r+"_typeprops"]=window["wfu_attribute_"+e+"_typeprops"],wfu_apply_value(r,"formfields",c.value)}else if(u>t){for(d=a[u-1].parentNode;null!=d&&"TR"!=d.tagName;)d=d.parentNode;if(null==d||"TR"!=d.tagName)return;d.parentNode.removeChild(d),wfu_update_formfield_variables()}u++}}}function wfu_subfolders_input_changed(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_subfolders_path_","");a=a.replace("wfu_subfolders_label_","");var l=document.getElementById("wfu_attribute_"+a);if(!(l.selectedIndex<0)){var n,d,o=document.getElementById("wfu_subfolders_path_"+a),u=document.getElementById("wfu_subfolders_label_"+a),r=document.getElementById("wfu_subfolders_ok_"+a),_="1"==document.getElementById("wfu_subfolders_isnewitem_"+a).value;if(_)n="",d="";else{var s=l.data;t=s[l.selectedIndex],n=t.path,d=t.label}if(o.value==n&&u.value==d)r.disabled=!0,_||wfu_subfolders_update_nav(a);else{r.disabled=!1;for(var c=document.getElementsByName("wfu_subfolder_nav_"+a),i=0;i<c.length;i++)c[i].disabled=!0}}}function wfu_subfolders_auto_changed(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_subfolders_auto_"+e),l=document.getElementById("wfu_subfolders_editable_"+e),n=document.getElementById("wfu_subfolders_manualtext_"+e);if(a.checked){var d=document.getElementById("wfu_attribute_value_"+e).value;"auto"!=d.substr(0,4)&&(n.value=d),l.parentNode.style.display="inline",wfu_apply_value(e,"folderlist","auto"+(l.checked?"+":"")),t.disabled=!0}else t.disabled=!1,l.parentNode.style.display="none",wfu_apply_value(e,"folderlist",n.value)}function wfu_subfolders_up_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=item.index-1;if(!(0>l)){for(var n=-1,d=t.selectedIndex-1;d>=0;){if(a[d].level==item.level&&a[d].index==l){n=d;break}d--}if(-1!=n){var o=0;for(d=t.selectedIndex+1;d<a.length&&a[d].level>item.level;)o++,d++;a[n].index=item.index,item.index=l,t.data=a.slice(0,n).concat(a.slice(t.selectedIndex,t.selectedIndex+1+o)).concat(a.slice(n,t.selectedIndex)).concat(a.slice(t.selectedIndex+1+o));var u=wfu_update_subfolder_list(e);t.selectedIndex=n,wfu_subfolders_update_toolnav(e),item=t,u!==item.oldVal&&(item.oldVal=u,document.getElementById("wfu_attribute_value_"+e).value=u,wfu_generate_shortcode())}}}}function wfu_subfolders_down_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=item.index+1,n=-1;for(curind=t.selectedIndex+1;curind<a.length;){if(a[curind].level==item.level){n=curind;break}if(a[curind].level<item.level)break;curind++}if(-1!=n){var d=0;for(curind=n+1;curind<a.length&&a[curind].level>item.level;)d++,curind++;a[n].index=item.index,item.index=l,t.data=a.slice(0,t.selectedIndex).concat(a.slice(n,n+1+d)).concat(a.slice(t.selectedIndex,n)).concat(a.slice(n+1+d));var o=wfu_update_subfolder_list(e);t.selectedIndex=t.selectedIndex+d+1,wfu_subfolders_update_toolnav(e),item=t,o!==item.oldVal&&(item.oldVal=o,document.getElementById("wfu_attribute_value_"+e).value=o,wfu_generate_shortcode())}}}function wfu_subfolders_left_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;for(item=a[t.selectedIndex],curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)a[curind].level--,curind++;item.level--;var l=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,l!==item.oldVal&&(item.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_subfolders_right_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;for(item=a[t.selectedIndex],curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)a[curind].level++,curind++;item.level++;var l=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,l!==item.oldVal&&(item.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_subfolders_def_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;if(item=a[t.selectedIndex],item["default"])item["default"]=!1;else{for(var l=0;l<a.length;l++)a[l]["default"]=!1;item["default"]=!0}var n=wfu_update_subfolder_list(e);wfu_subfolders_update_toolnav(e),item=t,n!==item.oldVal&&(item.oldVal=n,document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode())}}function wfu_subfolders_ok_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=document.getElementById("wfu_subfolders_path_"+e),l=document.getElementById("wfu_subfolders_label_"+e);if(""==a.value||""==l.value)return void alert("Path or label cannot be empty!");var n=t.data,d="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;if(d){var o=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value),u={label:l.value,path:a.value,level:o,"default":!1},r=parseInt(document.getElementById("wfu_subfolders_newitemindex_"+e).value);r>=n.length?n.push(u):n.splice(r,0,u)}else item=n[t.selectedIndex],item.path=a.value,item.label=l.value;var _=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,_!==item.oldVal&&(item.oldVal=_,document.getElementById("wfu_attribute_value_"+e).value=_,wfu_generate_shortcode())}}function wfu_subfolders_del_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=0;for(curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)l++,curind++;if(!(l>0)||confirm("Children items will be deleted as well. Proceed?")){a.splice(t.selectedIndex,1+l);var n=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,n!==item.oldVal&&(item.oldVal=n,document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode())}}}function wfu_subfolders_add_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data,l=t.selectedIndex;item=a[l];var n=t.options,d=document.createElement("option");d.value="",d.innerHTML="",n.add(d,l),t.selectedIndex=l;var o=document.getElementById("wfu_subfolder_tools_"+e),u=document.getElementById("wfu_subfolders_path_"+e),r=document.getElementById("wfu_subfolders_label_"+e),_=document.getElementById("wfu_subfolders_ok_"+e),s=document.getElementById("wfu_subfolders_browse_"+e);o.className="wfu_subfolder_tools_container",r.disabled=!1,_.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=l,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=item.level,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",u.disabled=0==item.level,s.disabled=0==item.level,0==item.level?(u.value="{root}",r.value="{upload folder}"):(u.value="",r.value="");for(var c=document.getElementsByName("wfu_subfolder_nav_"+e),i=0;i<c.length;i++)c[i].disabled=!0}}function wfu_subfolders_browse_clicked(e){var t=wfu_GetHttpRequestObject();if(null!=t){var a=null;try{var a=new FormData}catch(l){}if(null!=a){for(var n=document.getElementById("wfu_global_dialog_container"),d=document.getElementById("wfu_subfolders_browser_"+e),o=document.getElementById("wfu_subfolders_browse_"+e),u=document.getElementById("wfu_subfolders_inner_shadow_"+e),r=document.getElementById("wfu_subfolders_browser_msgcont_"+e),_=document.getElementById("wfu_subfolders_browser_msg_"+e),s=document.getElementById("wfu_subfolders_browser_img_"+e),c=document.getElementById("wfu_subfolders_browser_ok_"+e),i=document.getElementById("wfu_subfolders_browser_list_"+e);i.options.length>0;)i.options.remove(0);c.disabled=!0,c.onclick=function(){wfu_folder_browser_cancel_clicked(e)},_.innerHTML="loading folder contents...",s.style.display="inline",r.style.display="block",n.style.display="block",d.style.display="block",d.style.left=o.offsetLeft+o.offsetWidth-d.offsetWidth+"px",d.style.top=o.offsetTop+o.offsetHeight-d.offsetHeight+"px",u.style.display="block",n.onclick=function(){wfu_folder_browser_cancel_clicked(e)};var f=document.getElementById("wfu_attribute_uploadpath").value;"/"==f.substr(f.length-1)&&(f=f.substr(0,f.length-1));var m=wfu_get_relative_path(e).split(","),p=f+m[0];"/"!=p.substr(0)&&(p="/"+p);var w="";2==m.length&&(w=m[1]),a.append("action","wfu_ajax_action_read_subfolders"),a.append("folder1",wfu_plugin_encode_string(p)),a.append("folder2",wfu_plugin_encode_string(w)),t.key=e,t.addEventListener("load",wfu_readfolderComplete,!1),t.addEventListener("error",wfu_readfolderFailed,!1),t.addEventListener("abort",wfu_readfolderCanceled,!1),t.open("POST",AdminParams.wfu_ajax_url),t.send(a)}}}function wfu_readfolderComplete(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msgcont_"+t),l=document.getElementById("wfu_subfolders_browser_msg_"+t),n=document.getElementById("wfu_subfolders_browser_img_"+t),d=document.getElementById("wfu_subfolders_browser_list_"+t),o=document.getElementById("wfu_subfolders_browser_ok_"+t),u=document.getElementById("wfu_subfolders_path_"+t),r=document.getElementById("wfu_subfolders_label_"+t),_=e.target.responseText;if(-1!=_){var s="wfu_read_subfolders:",c=e.target.responseText.indexOf(s);-1==c&&(c=e.target.responseText.length);var i=(e.target.responseText.substr(0,c),e.target.responseText.substr(c+s.length,e.target.responseText.length-c-s.length));c=i.indexOf(":");var f=i.substr(0,c);if(txt_value=i.substr(c+1,i.length-c-1),"success"==f){for(var m,p=wfu_plugin_decode_string(txt_value),w=p.split(","),g=0,v=0;v<w.length;v++)""!=w[v]&&(m=document.createElement("option"),m.value=w[v],m.innerHTML=w[v].replace("*","&nbsp;&nbsp;&nbsp;"),d.add(m),g++);0==g&&(m=document.createElement("option"),m.value="",m.innerHTML="{empty}",m.disabled=!0,d.add(m)),d.selectedIndex=-1,o.onclick=function(){var e=d.options[d.selectedIndex].value,a=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+t).value);("*"==e.substr(0,1)||0==a)&&(document.getElementById("wfu_subfolders_newitemlevel_"+t).value=a+1,a>0&&(e=e.substr(1))),u.value=e,r.value=e,wfu_folder_browser_cancel_clicked(t),wfu_subfolders_ok_clicked(t)},a.style.display="none"}else"error"==f?(l.innerHTML=txt_value,n.style.display="none",o.disabled=!1):(l.innerHTML="Unknown error",n.style.display="none",o.disabled=!1)}}function wfu_readfolderFailed(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msg_"+t),l=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_ok_"+t);a.innerHTML="Unknown error",l.style.display="none",n.disabled=!1}function wfu_readfolderCanceled(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msg_"+t),l=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_ok_"+t);a.innerHTML="Unknown error",l.style.display="none",n.disabled=!1}function wfu_subfolders_browser_list_changed(e){var t=document.getElementById("wfu_subfolders_browser_list_"+e),a=document.getElementById("wfu_subfolders_browser_ok_"+e);a.disabled=t.selectedIndex<0}function wfu_folder_browser_cancel_clicked(e){var t=document.getElementById("wfu_global_dialog_container"),a=document.getElementById("wfu_subfolders_browser_"+e),l=(document.getElementById("wfu_subfolders_browse_"+e),document.getElementById("wfu_subfolders_inner_shadow_"+e));t.onclick=null,l.style.display="none",a.style.display="none",t.style.display="none"}function wfu_get_relative_path(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a,l=t.data,n="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;a=n?parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value):l[t.selectedIndex].level;for(var d="/",o=t.selectedIndex-1,u=a;o>=0&&u>1;)l[o].level<u&&(d="/"+l[o].path+d,u=l[o].level),o--;return n&&"1"==document.getElementById("wfu_subfolders_newitemlevel2_"+e).value&&a>0&&t.selectedIndex>0&&(d+=","+l[t.selectedIndex-1].path),d}}function wfu_subfolders_changed(e){wfu_update_subfolder_list(e),wfu_subfolders_update_toolnav(e)}function wfu_subfolders_update_toolnav(e){var t,a,l=document.getElementById("wfu_attribute_"+e),n=document.getElementById("wfu_subfolder_tools_"+e),d=document.getElementById("wfu_subfolders_path_"+e),o=document.getElementById("wfu_subfolders_label_"+e),u=document.getElementById("wfu_subfolders_ok_"+e),r=document.getElementById("wfu_subfolders_browse_"+e),_=document.getElementById("wfu_subfolders_auto_"+e);if(document.getElementById("wfu_subfolders_isnewitem_"+e).value="",document.getElementById("wfu_subfolders_newitemindex_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",null==l.data?(t=wfu_decode_subfolder_list(e),l.data=t):t=l.data,0===l.data.length?(l.className="wfu_select_folders wfu_select_folders_empty",l.options[0].innerHTML=_.checked?"":"press here"):l.className="wfu_select_folders",l.selectedIndex<0)n.className="wfu_subfolder_tools_container wfu_subfolder_tools_disabled",d.disabled=!0,o.disabled=!0,u.disabled=!0,r.disabled=!0,o.value="",d.value="";else if(l.selectedIndex>=l.options.length-1){n.className="wfu_subfolder_tools_container",o.disabled=!1,u.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=t.length;var s;s=0==t.length?0:0==t[t.length-1].level?1:t[t.length-1].level,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=s,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="1",d.disabled=0==s,r.disabled=!1,0==s?(d.value="{root}",o.value="{upload folder}"):(d.value="",o.value="")}else n.className="wfu_subfolder_tools_container",o.disabled=!1,u.disabled=!0,a=t[l.selectedIndex],d.disabled=0==a.level,r.disabled=0==a.level,o.value=a.label,d.value=a.path;var c=document.getElementsByName("wfu_subfolder_nav_"+e);if(l.selectedIndex<0||l.selectedIndex>=l.options.length-1)for(var i=0;i<c.length;i++)c[i].disabled=!0;else wfu_subfolders_update_nav(e)}function wfu_subfolders_update_nav(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_subfolders_up_"+e),l=document.getElementById("wfu_subfolders_down_"+e),n=document.getElementById("wfu_subfolders_left_"+e),d=document.getElementById("wfu_subfolders_right_"+e),o=document.getElementById("wfu_subfolders_add_"+e),u=document.getElementById("wfu_subfolders_def_"+e),r=document.getElementById("wfu_subfolders_del_"+e),_=t.data,s=_[t.selectedIndex];for(a.disabled=s.index<=0,ind=t.selectedIndex+1,nextind=0;ind<_.length;){if(_[ind].level==s.level){nextind=_[ind].index;break}if(_[ind].level<s.level)break;ind++}l.disabled=0==s.level||0==nextind,n.disabled=0==t.selectedIndex&&s.level<1||t.selectedIndex>0&&s.level<=1,t.selectedIndex>=1?prevlevel=_[t.selectedIndex-1].level:prevlevel=0,d.disabled=s.level-prevlevel>0,o.disabled=0==s.level,u.disabled=!1,u.className="button"+(s["default"]?" wfu_subfolder_nav_pressed":""),r.disabled=!1}function wfu_decode_subfolder(e){var t={label:"",path:"",level:0,"default":!1};e=e.trim();for(var a=0,l=!1;a<e.length&&"*"==e.substr(a,1);)a++;e=e.substr(a,e.length-a),"&"==e.substr(0,1)&&(e=e.substr(1),l=!0),t.level=a,t["default"]=l;var n=e.split("/");return 1==n.length?(t.path=n[0],t.label=n[0]):n.length>1&&(t.path=n[0],t.label=n[1]),0==a&&(t.path="{root}",""==t.label&&(t.label="{upload folder}")),t}function wfu_decode_subfolder_list(e){for(var t,a=document.getElementById("wfu_attribute_"+e).options,l=Array(),n=["root"],d=[0],o=-1,u=0;u<a.length-1;u++){for(l.push(wfu_decode_subfolder(wfu_plugin_decode_string(a[u].value))),n.length>l[u].level?n[l[u].level]=l[u].path:n.push(l[u].path),t="",j=1;j<=l[u].level;j++)t+=n[j]+"/";l[u].fullpath=t,d.length<=l[u].level&&d.push(0),l[u].level>o?l[u].index=0:l[u].index=d[l[u].level]+1,d[l[u].level]=l[u].index,o=l[u].level}return l}function wfu_update_subfolder_list(e){var t=document.getElementById("wfu_attribute_"+e).options,a=document.getElementById("wfu_attribute_"+e),l=a.data;if(null!=l){var n,d,o="";t.length=l.length+1;for(var u=0;u<l.length;u++){for(n="",d="",j=0;j<l[u].level;j++)n+="*",d+="&nbsp;&nbsp;&nbsp;";l[u]["default"]?(n+="&",t[u].className="wfu_select_folders_option_default"):t[u].className="",n+=l[u].path+"/"+l[u].label,d+=l[u].label,t[u].value=wfu_plugin_encode_string(n),t[u].innerHTML=d,""!=o&&(o+=","),o+=n}return t[l.length].value="",t[l.length].innerHTML="",o}}function wfu_userdata_edit_field(e,t,a){for(var l,n=0;n<e.childNodes.length;n++)l=e.childNodes[n],"INPUT"==l.tagName?"text"==l.type?(l.value=t,wfu_attach_element_handlers(l,wfu_update_userfield_value)):"checkbox"==l.type&&(l.checked=a):"DIV"==l.tagName&&(l.className="wfu_userdata_action")}function wfu_formdata_edit_field(e,t,a){}function wfu_formdata_type_changed(e){var t=e.split("_"),a=t[0],l="wfu_formfield_"+e,n=(document.getElementById("wfu_attribute_"+a),document.getElementById(l+"_container")),d=window["wfu_attribute_"+a+"_typeprops"][document.getElementById(l+"_type").value],o={type:document.getElementById(l+"_type").value,label:document.getElementById(l+"_label").value,labelposition:document.getElementById(l+"_labelposition").value,required:"show"==d.required.substr(0,4)&&document.getElementById(l+"_required")?document.getElementById(l+"_required").checked:"true"==d.required.substr(5),donotautocomplete:"show"==d.donotautocomplete.substr(0,4)&&document.getElementById(l+"_donotautocomplete")?document.getElementById(l+"_donotautocomplete").checked:"true"==d.donotautocomplete.substr(5),validate:"show"==d.validate.substr(0,4)&&document.getElementById(l+"_validate")?document.getElementById(l+"_validate").checked:"true"==d.validate.substr(5),typehook:"show"==d.typehook.substr(0,4)&&document.getElementById(l+"_typehook")?document.getElementById(l+"_typehook").checked:"true"==d.typehook.substr(5),hintposition:"show"==d.hintposition.substr(0,4)&&document.getElementById(l+"_hintposition")?document.getElementById(l+"_hintposition").value:d.hintposition.substr(5),"default":"show"==d["default"].substr(0,4)&&document.getElementById(l+"_default")?document.getElementById(l+"_default").value:d["default"].substr(5),data:"show"==d.data.substr(0,4)&&document.getElementById(l+"_data")?document.getElementById(l+"_data").value:d.data.substr(5),group:"show"==d.group.substr(0,4)&&document.getElementById(l+"_group")?document.getElementById(l+"_group").value:d.group.substr(5),format:"show"==d.format.substr(0,4)&&document.getElementById(l+"_format")?document.getElementById(l+"_format").value:d.format.substr(5)},u=wfu_formdata_prepare_template(a,o,e);n.innerHTML=u;for(var r=document.querySelectorAll("div#"+l+'_container input[name="wfu_formfield_elements"]'),_=0;_<r.length;_++)wfu_attach_element_handlers(r[_],wfu_update_formfield_value);for(var s=document.querySelectorAll("div#wfu_attribute_"+a+" .wfu_formdata_action_remove"),_=0;_<s.length;_++)s[_].className="wfu_formdata_action wfu_formdata_action_remove"+(s.length>1?"":" wfu_formdata_action_disabled");wfu_update_formfield_value({target:n})}function wfu_userdata_add_field(e){var t=e.parentNode,a=t.cloneNode(!0);wfu_userdata_edit_field(a,"",!1),t.parentNode.insertBefore(a,t.nextSibling)}function wfu_formdata_add_field(e){var t=e.split("_"),a=t[0],l=(t[1],document.getElementById("wfu_attribute_"+a)),n=document.getElementById("wfu_formfield_"+e+"_container"),d=document.createElement("DIV"),o=a+"_"+wfu_randomString(4);d.id="wfu_formfield_"+o+"_container",d.className="wfu_formdata_line_container",l.insertBefore(d,n.nextSibling);var u={type:"text",label:"",labelposition:"left",required:!1,donotautocomplete:!1,validate:!1,"default":"",data:"",group:"",format:"",hintposition:"right",typehook:!1},r=wfu_formdata_prepare_template(a,u,o);
2
- d.innerHTML=r;for(var _=document.querySelectorAll("div#wfu_formfield_"+o+'_container input[name="wfu_formfield_elements"]'),s=0;s<_.length;s++)wfu_attach_element_handlers(_[s],wfu_update_formfield_value);for(var c=document.querySelectorAll("div#wfu_attribute_"+a+" .wfu_formdata_action_remove"),s=0;s<c.length;s++)c[s].className="wfu_formdata_action wfu_formdata_action_remove"+(c.length>1?"":" wfu_formdata_action_disabled");wfu_update_formfield_value({target:d})}function wfu_formdata_prepare_template(e,t,a){var l=wfu_plugin_decode_string(window["wfu_attribute_"+e+"_formtemplate"]),n=window["wfu_attribute_"+e+"_typeprops"][t.type],d=window["wfu_attribute_"+e+"_typeprops"][0].split(","),o=["required","donotautocomplete","validate","typehook","labelposition","hintposition","default","data","group","format"],u=["none","top","right","bottom","left"],r=["none","inline","top","right","bottom","left"];l=l.replace(/\[\[key\]\]/g,a).replace(/\[\[t\]\]/g,t.type).replace(/\[\[label\]\]/g,t.label).replace(/\[\[s\]\]/g,t.labelposition).replace(/\[\[d\]\]/g,t["default"]).replace(/\[\[l\]\]/g,t.data).replace(/\[\[data_label\]\]/g,n.data_label).replace(/\[\[g\]\]/g,t.group).replace(/\[\[f\]\]/g,t.format).replace(/\[\[p\]\]/g,t.hintposition);for(var _=0;_<o.length;_++)l=l.replace(new RegExp("\\[\\["+o[_]+"_hint\\]\\]","g"),n[o[_]+"_hint"]);for(var _=0;_<d.length;_++)l=l.replace("[[type_"+d[_]+"_selected]]",d[_]==t.type?' selected="selected"':"");for(var _=0;_<u.length;_++)l=l.replace("[[labelposition_"+u[_]+"_selected]]",u[_]==t.labelposition?' selected="selected"':"");for(var _=0;_<r.length;_++)l=l.replace("[[hintposition_"+r[_]+"_selected]]",r[_]==t.hintposition?' selected="selected"':"");return l=l.replace("[[remove_disabled]]",""),l=t.required?l.replace(/\[\[r\-\>\]\]|\[\[\<\-r\]\]/g,""):l.replace(/\[\[r\-\>\]\].*\[\[\<\-r\]\]/g,""),l=t.donotautocomplete?l.replace(/\[\[a\-\>\]\]|\[\[\<\-a\]\]/g,""):l.replace(/\[\[a\-\>\]\].*\[\[\<\-a\]\]/g,""),l=t.validate?l.replace(/\[\[v\-\>\]\]|\[\[\<\-v\]\]/g,""):l.replace(/\[\[v\-\>\]\].*\[\[\<\-v\]\]/g,""),l=t.typehook?l.replace(/\[\[h\-\>\]\]|\[\[\<\-h\]\]/g,""):l.replace(/\[\[h\-\>\]\].*\[\[\<\-h\]\]/g,""),l="show"==n.required.substr(0,4)?l.replace(/\[\[R\-\>\]\]|\[\[\<\-R\]\]/g,""):l.replace(/\[\[R\-\>\]\][^]*\[\[\<\-R\]\]/g,""),l="show"==n.donotautocomplete.substr(0,4)?l.replace(/\[\[A\-\>\]\]|\[\[\<\-A\]\]/g,""):l.replace(/\[\[A\-\>\]\][^]*\[\[\<\-A\]\]/g,""),l="show"==n.validate.substr(0,4)?l.replace(/\[\[V\-\>\]\]|\[\[\<\-V\]\]/g,""):l.replace(/\[\[V\-\>\]\][^]*\[\[\<\-V\]\]/g,""),l="show"==n.hintposition.substr(0,4)?l.replace(/\[\[P\-\>\]\]|\[\[\<\-P\]\]/g,""):l.replace(/\[\[P\-\>\]\][^]*\[\[\<\-P\]\]/g,""),l="show"==n.typehook.substr(0,4)?l.replace(/\[\[H\-\>\]\]|\[\[\<\-H\]\]/g,""):l.replace(/\[\[H\-\>\]\][^]*\[\[\<\-H\]\]/g,""),l="show"==n["default"].substr(0,4)?l.replace(/\[\[D\-\>\]\]|\[\[\<\-D\]\]/g,""):l.replace(/\[\[D\-\>\]\][^]*\[\[\<\-D\]\]/g,""),l="show"==n.data.substr(0,4)?l.replace(/\[\[L\-\>\]\]|\[\[\<\-L\]\]/g,""):l.replace(/\[\[L\-\>\]\][^]*\[\[\<\-L\]\]/g,""),l="show"==n.group.substr(0,4)?l.replace(/\[\[G\-\>\]\]|\[\[\<\-G\]\]/g,""):l.replace(/\[\[G\-\>\]\][^]*\[\[\<\-G\]\]/g,""),l="show"==n.format.substr(0,4)?l.replace(/\[\[F\-\>\]\]|\[\[\<\-F\]\]/g,""):l.replace(/\[\[F\-\>\]\][^]*\[\[\<\-F\]\]/g,"")}function wfu_userdata_remove_field(e){for(var t=e.parentNode,a=t.parentNode,l=null,n=0;n<a.childNodes.length;n++)if(1===a.childNodes[n].nodeType){l=a.childNodes[n];break}if(t!=l){t.parentNode.removeChild(t);for(var n=0;n<l.childNodes.length;n++)if(1===l.childNodes[n].nodeType){wfu_update_userfield_value({target:l.childNodes[n]});break}}}function wfu_formdata_remove_field(e){var t=e.split("_"),a=t[0],l=document.querySelectorAll("div#wfu_attribute_"+a+" .wfu_formdata_line_container");if(!(l.length<2)){var n=document.getElementById("wfu_attribute_"+a),d=document.getElementById("wfu_formfield_"+e+"_container");n.removeChild(d),d=document.querySelector("div#wfu_attribute_"+a+" .wfu_formdata_line_container");for(var o=document.querySelectorAll("div#wfu_attribute_"+a+" .wfu_formdata_action_remove"),u=0;u<o.length;u++)o[u].className="wfu_formdata_action wfu_formdata_action_remove"+(o.length>1?"":" wfu_formdata_action_disabled");wfu_update_formfield_value({target:d})}}function wfu_generate_shortcode(){for(var e,t=document.getElementById("wfu_shortcode_tag").value,a=document.getElementById("wfu_attribute_defaults"),l=(document.getElementById("wfu_attribute_values"),""),n="",d="["+t,o="",u=0;u<a.childNodes.length;u++)e=a.childNodes[u],1===e.nodeType&&(l=e.id.replace("wfu_attribute_default_",""),n=document.getElementById("wfu_attribute_value_"+l).value,e.value!=n&&(o+=" "+l+'="'+n+'"'));d+=o+"]",document.getElementById("wfu_shortcode").value=d,ShortcodeString=o.substr(1),document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=wfu_plugin_encode_string(d)==document.getElementById("wfu_shortcode_original_enc").value),Autosave&&wfu_schedule_save_shortcode()}function wfu_update_text_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_",""),l=t.value;l=l.replace(/(\r\n|\n|\r)/gm,"%n%"),l=l.replace(/\"/gm,"%dq%"),l=l.replace(/\[/gm,"%brl%"),l=l.replace(/\]/gm,"%brr%"),l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_date_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_",""),l=t.value;l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_stringmatch_textvalue(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.replace("_matchfield","").replace("_matchvalue",""),wfu_update_stringmatch_value(a)}function wfu_update_triplecolor_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.replace("_color",""),a=a.replace("_bgcolor",""),a=a.replace("_borcolor",""),t=document.getElementById("wfu_attribute_"+a+"_color");var l=t.value+","+document.getElementById("wfu_attribute_"+a+"_bgcolor").value+","+document.getElementById("wfu_attribute_"+a+"_borcolor").value;l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_dimension_value(e){e=e||window.event;var t=e.target,a=t.name.replace("wfu_dimension_elements_",""),l=document.getElementsByName(t.name);t=l[0];for(var n="",d="",o=0;o<l.length;o++)d=l[o].id.replace("wfu_attribute_"+a+"_",""),""!=n&&""!=l[o].value&&(n+=", "),""!=l[o].value&&(n+=d+":"+l[o].value);n!==t.oldVal&&(t.oldVal=n,document.getElementById("wfu_attribute_value_"+a).value=n,wfu_generate_shortcode())}function wfu_update_ptext_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.substr(2);var l=document.getElementById("wfu_attribute_s_"+a).value,n=document.getElementById("wfu_attribute_p_"+a).value,d=l+"/"+n;d!==t.oldVal&&(t.oldVal=d,document.getElementById("wfu_attribute_value_"+a).value=d),wfu_generate_shortcode()}function wfu_update_mchecklist_value(e){var t="",a=(document.getElementById("wfu_attribute_"+e),document.getElementById("wfu_attribute_"+e+"_all"));a.checked?(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!0),jQuery("#wfu_attribute_"+e+" input").prop("checked",!0),t="all"):(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!1),jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked")&&(t+=","+jQuery(this).next().html())}),t=t.substr(1)),document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_rolelist_value(e){var t="",a=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_attribute_"+e+"_guests"),n=document.getElementById("wfu_attribute_"+e+"_all");if(n.checked)a.disabled=!0,t="all";else{a.disabled=!1;for(var d=a.options,o=0;o<d.length;o++)d[o].selected&&(""!=t&&(t+=","),t+=d[o].value)}l.checked&&(""!=t&&(t+=","),t+="guests"),document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_userlist_value(e){var t="",a=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_attribute_"+e+"_current"),n=document.getElementById("wfu_attribute_"+e+"_guests"),d=document.getElementById("wfu_attribute_"+e+"_all");if(l&&l.checked)a.disabled=!0,d.disabled=!0,n.disabled=!0,t="current";else{if(d.disabled=!1,n.disabled=!1,d.checked)a.disabled=!0,t="all";else{a.disabled=!1;for(var o=a.options,u=0;u<o.length;u++)o[u].selected&&(""!=t&&(t+=","),t+=o[u].value)}n.checked&&(""!=t&&(t+=","),t+="guests")}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_postlist_value(e){for(var t="",a=Array(),l=Array(),n=document.getElementById("wfu_attribute_"+e+"_postlist").value.split(","),d=0;d<n.length;d++)a.push(document.getElementById("wfu_attribute_"+e+"_"+n[d])),l.push(document.getElementById("wfu_attribute_"+e+"_all_"+n[d]));var o=document.getElementById("wfu_attribute_"+e+"_current");if(o&&o.checked){for(var d=0;d<n.length;d++)a[d].disabled=!0,l[d].disabled=!0;t="current"}else{var u=!0;t="";for(var d=0;d<n.length;d++)if(l[d].disabled=!1,l[d].checked)a[d].disabled=!0,""!=t&&(t+=","),t+="all"+n[d];else{a[d].disabled=!1,u=!1;for(var r=a[d].options,_=0;_<r.length;_++)r[_].selected&&(""!=t&&(t+=","),t+=r[_].value)}u&&(t="all")}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_bloglist_value(e){var t="",a=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_attribute_"+e+"_current"),n=document.getElementById("wfu_attribute_"+e+"_all");if(l&&l.checked)a.disabled=!0,n.disabled=!0,t="current";else if(n.disabled=!1,n.checked)a.disabled=!0,t="all";else{a.disabled=!1;for(var d=a.options,o=0;o<d.length;o++)d[o].selected&&(""!=t&&(t+=","),t+=d[o].value)}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_stringmatch_value(e){var t=document.getElementById("wfu_attribute_"+e+"_matchfield").value,a=document.getElementById("wfu_attribute_"+e+"_matchcriterion").value,l=document.getElementById("wfu_attribute_"+e+"_matchvalue").value;t=t.replace(";",""),""==t.trim()?document.getElementById("wfu_attribute_value_"+e).value="":document.getElementById("wfu_attribute_value_"+e).value="field:"+t+";criterion:"+a+";value:"+l,wfu_generate_shortcode()}function wfu_update_userfield_value(e){e=e||window.event;for(var t=e.target,a=t.parentNode,l=a.parentNode,n="",d=!1,o="",u=0;u<l.childNodes.length;u++)if(a=l.childNodes[u],"DIV"===a.tagName){for(var r=0;r<a.childNodes.length;r++)"INPUT"==a.childNodes[r].tagName&&("text"==a.childNodes[r].type?(n=a.childNodes[r].value,0==u&&(t=a.childNodes[r])):"checkbox"==a.childNodes[r].type&&(d=a.childNodes[r].checked));""!=o&&""!=n&&(o+="/"),""!=n&&d&&(o+="*"),""!=n&&(o+=n)}o!==t.oldVal&&(t.oldVal=o,document.getElementById("wfu_attribute_value_userdatalabel").value=o,wfu_generate_shortcode(),wfu_update_formfield_variables())}function wfu_update_formfield_value(e){e=e||window.event;for(var t=e.target,a=t.id.match(/^wfu_formfield_(.*?)_/)[1],l=document.querySelectorAll("div#wfu_attribute_"+a+" .wfu_formdata_line_container"),n="",d=0;d<l.length;d++){var o="",u=l[d].id.match(/^wfu_formfield_.*?_(.*?)_/)[1],r=a+"_"+u,_=document.getElementById("wfu_formfield_"+r+"_label").value;if(""!=_.trim()){o=_.trim();var s=document.getElementById("wfu_formfield_"+r+"_type").value,c=window["wfu_attribute_"+a+"_typeprops"];o+="|t:"+s,o+="|s:"+document.getElementById("wfu_formfield_"+r+"_labelposition").value,"show"==c[s].required.substr(0,4)&&(o+="|r:"+(document.getElementById("wfu_formfield_"+r+"_required").checked?"1":"0")),"show"==c[s].donotautocomplete.substr(0,4)&&(o+="|a:"+(document.getElementById("wfu_formfield_"+r+"_donotautocomplete").checked?"1":"0")),"show"==c[s].validate.substr(0,4)&&(o+="|v:"+(document.getElementById("wfu_formfield_"+r+"_validate").checked?"1":"0")),"show"==c[s].typehook.substr(0,4)&&(o+="|h:"+(document.getElementById("wfu_formfield_"+r+"_typehook").checked?"1":"0")),"show"==c[s].hintposition.substr(0,4)&&(o+="|p:"+document.getElementById("wfu_formfield_"+r+"_hintposition").value),"show"==c[s]["default"].substr(0,4)&&(o+="|d:"+document.getElementById("wfu_formfield_"+r+"_default").value),"show"==c[s].data.substr(0,4)&&(o+="|l:"+document.getElementById("wfu_formfield_"+r+"_data").value),"show"==c[s].group.substr(0,4)&&(o+="|g:"+document.getElementById("wfu_formfield_"+r+"_group").value),"show"==c[s].format.substr(0,4)&&(o+="|f:"+document.getElementById("wfu_formfield_"+r+"_format").value)}""!=o&&(""!=n&&(n+="/"),n+=o)}n!==t.oldVal&&(t.oldVal=n,document.getElementById("wfu_attribute_value_"+a).value=n,wfu_generate_shortcode(),wfu_update_formfield_variables())}function wfu_update_formfield_variables(){var e=document.getElementById("wfu_attribute_value_userdatalabel");if(e){for(var t=document.getElementById("wfu_wrapper"),a=document.getElementsByClassName("wfu_shadow_userdata","div",t),l=document.getElementsByName("wfu_formfield_select"),n=0;n<l.length;n++)l[n].style.display="none";if(0!=a.length&&"block"!=a[0].style.display){for(var d='<option style="display:none;">%userdataXXX%</option>',o=e.value.replace(/\//g,"[/]").replace(/\(.*\)/,function(e){return e.replace(/\[\/\]/g,"/")}).split("[/]"),u=2;document.getElementById("wfu_attribute_userdatalabel"+u);){var r=document.getElementById("wfu_attribute_value_userdatalabel"+u).value.replace(/\//g,"[/]").replace(/\(.*\)/,function(e){return e.replace(/\[\/\]/g,"/")}).split("[/]");o=o.concat(r),u++}var _="",s=0;u=1;for(var n=0;n<o.length;n++)_=o[n],"*"==_[0]&&(_=_.substr(1)),s=_.indexOf("|"),s>-1&&(_=_.substr(0,s)),""!=_.trim()&&(d+='<option value="%userdata'+u+'%">'+u+": "+_.trim()+"</option>",u++);for(var n=0;n<l.length;n++)l[n].innerHTML=d,l[n].style.display="inline-block"}}}function wfu_attach_element_handlers(e,t){for(var a=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],l=0;l<a.length;l++)wfu_addEventHandler(e,a[l],t)}function wfu_Attach_Admin_Events(e){Autosave=e,wfu_generate_shortcode(),wfu_update_formfield_variables(),wfu_Attach_Admin_DragDrop_Events();for(var t=document.getElementsByName("wfu_text_elements"),a=0;a<t.length;a++)wfu_attach_element_handlers(t[a],wfu_update_text_value);for(var l=document.getElementsByName("wfu_ptext_elements"),a=0;a<l.length;a++)wfu_attach_element_handlers(l[a],wfu_update_ptext_value);for(var n=document.getElementsByName("wfu_stringmatch_elements"),a=0;a<n.length;a++)wfu_attach_element_handlers(n[a],wfu_update_stringmatch_textvalue);for(var d=document.getElementsByName("wfu_triplecolor_elements"),a=0;a<d.length;a++)wfu_attach_element_handlers(d[a],wfu_update_triplecolor_value);for(var o=document.getElementsByName("wfu_dimension_elements_widths"),a=0;a<o.length;a++)wfu_attach_element_handlers(o[a],wfu_update_dimension_value);o=document.getElementsByName("wfu_dimension_elements_heights");for(var a=0;a<o.length;a++)wfu_attach_element_handlers(o[a],wfu_update_dimension_value);for(var u=document.getElementsByName("wfu_userfield_elements"),a=0;a<u.length;a++)wfu_attach_element_handlers(u[a],wfu_update_userfield_value);for(var r=document.getElementsByName("wfu_formfield_elements"),a=0;a<r.length;a++)wfu_attach_element_handlers(r[a],wfu_update_formfield_value);for(var _=document.getElementsByName("wfu_subfolder_tools_input"),a=0;a<_.length;a++)wfu_attach_element_handlers(_[a],wfu_subfolders_input_changed);for(var s=document.getElementsByName("wfu_columnprops_elements"),a=0;a<s.length;a++)wfu_attach_element_handlers(s[a],wfu_columnprops_element_changed);""!=document.getElementById("wfu_shortcode_postid").value&&setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut)}function wfu_insert_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),a=document.getElementById("wfu_attribute_"+t),l=a.selectionStart,n=a.value;a.value=n.substr(0,l)+e.innerHTML+n.substr(l),wfu_update_text_value({target:a})}function wfu_insert_userfield_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),a=document.getElementById("wfu_attribute_"+t),l=a.selectionStart,n=a.value;a.value=n.substr(0,l)+e.value+n.substr(l),e.value="%userdataXXX%",wfu_update_text_value({target:a})}function wfu_columns_itemclicked(e,t){var a=e.parentNode;if("SELECT"==a.tagName){for(var l=0;l<a.options.length;l++)a.options[l].selected=a.options[l]==e;wfu_update_column_props(t)}}function wfu_columns_buttonaction(e,t){var a=document.getElementById("wfu_attribute_"+e+"_sourcelist"),l=document.getElementById("wfu_attribute_"+e);if("add"==t){for(var n=0;n<a.options.length;n++)if(a.options[n].selected||"wfu_columns_item_required"==a.options[n].className){for(var d=!1,o=a.options[n].value.replace(/:.*/,""),u=0;u<l.options.length;u++){var r=l.options[u].value.replace(/:.*/,"");if(r==o){d=!0;break}}if(!d){var _=a.options[n].value.match(/(.*?):(.*?)\/(.*)/),s=_[1],c="custom"==s?"+-"+(""==_[2]?"s":_[2]):""!=_[2]?"-+"+_[2]:"",i=_[3];"custom"==s&&(s="custom1");var f=document.createElement("OPTION");f.value=s+":"+c+"/"+a.options[n].innerHTML+"/"+i,f.innerHTML=a.options[n].innerHTML+(""!=i&&i!=a.options[n].innerHTML?" ("+i+")":""),f.className=a.options[n].className,f.onclick=a.options[n].onclick,l.appendChild(f),l.selectedIndex=l.options.length-1}}}else if("del"==t)for(var n=0;n<l.options.length;)l.options[n].selected&&"wfu_columns_item_required"!=l.options[n].className?l.options.remove(n):n++;else if("up"==t||"down"==t){for(var m=-1,n=0;n<l.options.length;n++)l.options[n].selected&&-1==m?m=n:l.options[n].selected&&m>-1&&(l.options[n].selected=!1);"up"==t&&m>0?l.insertBefore(l.options[m],l.options[m-1]):"down"==t&&m<l.options.length-1&&l.insertBefore(l.options[m+1],l.options[m])}wfu_update_column_props(e),wfu_update_columns(e)}function wfu_update_column_props(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_attribute_"+e+"_columnprops_container"),l=document.getElementById("wfu_attribute_"+e+"_columnprops_title"),n=(document.getElementById("wfu_attribute_"+e+"_columnprops_title_label"),document.getElementById("wfu_attribute_"+e+"_columnprops_id")),d=document.getElementById("wfu_attribute_"+e+"_columnprops_id_label"),o=document.getElementById("wfu_attribute_"+e+"_columnprops_sort"),u=document.getElementById("wfu_attribute_"+e+"_columnprops_sort_label"),r=document.getElementById("wfu_attribute_"+e+"_columnprops_sorttype"),_=document.getElementById("wfu_attribute_"+e+"_columnprops_sorttype_label"),s=t.selectedIndex;if(""==r.options[0].value&&r.options.remove(0),-1==s)a.className="wfu_columnprops_container wfu_columnprops_container_disabled",l.value="",l.disabled=!0,n.value="",n.disabled=!0,o.checked=!1,o.disabled=!0,r.selectedIndex=-1,r.disabled=!0;else{var c=t.options[s].value.match(/(.*?):(.*?)\/(.*?)\/(.*)/),i=c[1],f="custom"==i.substr(0,6),m=f?i.substr(6):"",p=""!=c[2],w=p&&"+"==c[2].substr(1,1),g=w&&"+"==c[2].substr(0,1),v=w?c[2].substr(2):"",b=c[4];a.className="wfu_columnprops_container",l.value=b,l.disabled=!1,d.className=f?"":"wfu_columnprops_label_disabled",n.value=m,n.disabled=!f,u.className=p?"":"wfu_columnprops_label_disabled",o.checked=w,o.disabled=!p,_.className=g?"":"wfu_columnprops_label_disabled",r.value=v,r.disabled=!g}}function wfu_columnprops_element_changed(e){e=e||window.event;var t=e.target,a=t.id.match(/^wfu_attribute_(.*?)_columnprops_/)[1],l=document.getElementById("wfu_attribute_"+a),n=document.getElementById("wfu_attribute_"+a+"_columnprops_title"),d=document.getElementById("wfu_attribute_"+a+"_columnprops_id"),o=document.getElementById("wfu_attribute_"+a+"_columnprops_sort"),u=document.getElementById("wfu_attribute_"+a+"_columnprops_sorttype"),r=l.selectedIndex;if(-1!=r){var _=l.options[r].value.match(/(.*?):(.*?)\/(.*?)\/(.*)/),s=_[1],c="custom"==s.substr(0,6)?"custom":s,i="custom"==c,f=i?parseInt(d.value)>=1?d.value:"1":"",m=""!=_[2]?_[2].substr(0,1)+(o.checked?"+":"-")+(""!=u.value?u.value:""!=_[2].substr(2)?_[2].substr(2):"s"):"",p=_[3],w=""!=n.value?n.value:p;l.options[r].value=c+f+":"+m+"/"+p+"/"+w,l.options[r].innerHTML=p+(w!=p?" ("+w+")":""),wfu_update_column_props(a),wfu_update_columns(a)}}function wfu_update_columns(e){for(var t=document.getElementById("wfu_attribute_"+e),a="",l=0;l<t.options.length;l++){var n=t.options[l].value.match(/(.*?):(.*?)\/(.*?)\/(.*)/),d=n[1]+":"+("+"==n[2].substr(1,1)?n[2].substr(2):"")+"/"+n[4];""!=a&&(a+=","),a+=d}document.getElementById("wfu_attribute_value_"+e).value=a,wfu_generate_shortcode()}function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(t){}return e}function wfu_plugin_encode_string(e){var t,a=0,l="",n="";for(a=0;a<e.length;a++)t=e.charCodeAt(a),t>=2048?t=((16773120&t|917504)<<4)+((4032&t|8192)<<2)+(63&t|128):t>=128&&(t=((65472&t|12288)<<2)+(63&t|128)),n=t.toString(16),(1==n.length||3==n.length||5==n.length)&&(n="0"+n),l+=n;return l}function wfu_plugin_decode_string(e){for(var t,a,l=0,n="";l<e.length;)t=parseInt(e.substr(l,2),16),a=128>t?t:224>t?((31&t)<<6)+(63&parseInt(e.substr(l+=2,2),16)):((15&t)<<12)+((63&parseInt(e.substr(l+=2,2),16))<<6)+(63&parseInt(e.substr(l+=2,2),16)),n+=String.fromCharCode(a),l+=2;return n}function wfu_randomString(e){for(var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",a=e,l="",n=0;a>n;n++){var d=Math.floor(Math.random()*t.length);l+=t.substring(d,d+1)}return l}function wfu_schedule_save_shortcode(){var e=new Date,t=ShortcodeNextSave-e.getTime();null!=ShortcodeTimeOut&&(clearTimeout(ShortcodeTimeOut),ShortcodeTimeOut=null),0>=t?wfu_save_shortcode():ShortcodeTimeOut=setTimeout(function(){wfu_save_shortcode()},t)}function wfu_check_page_obsolescence(){PageObsolete||PageUpdating||""==document.getElementById("wfu_shortcode_postid").value}function wfu_save_shortcode(){if(!PageObsolete){var e=wfu_GetHttpRequestObject();if(null!=e){PageUpdating=!0,document.getElementById("wfu_update_failed_message").style.display="none";var t=AdminParams.wfu_ajax_url;params=new Array(8),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_save_shortcode",params[1]=new Array(2),params[1][0]="shortcode",params[1][1]=wfu_plugin_encode_string(ShortcodeString),params[2]=new Array(2),params[2][0]="shortcode_original",params[2][1]=document.getElementById("wfu_shortcode_original_enc").value,params[3]=new Array(2),params[3][0]="post_id",params[3][1]=document.getElementById("wfu_shortcode_postid").value,params[4]=new Array(2),params[4][0]="post_hash",params[4][1]=document.getElementById("wfu_shortcode_posthash").value,params[5]=new Array(2),params[5][0]="shortcode_position",params[5][1]=document.getElementById("wfu_shortcode_position").value,params[6]=new Array(2),params[6][0]="shortcode_tag",params[6][1]=document.getElementById("wfu_shortcode_tag").value,params[7]=new Array(2),params[7][0]="widget_id",params[7][1]=document.getElementById("wfu_shortcode_widgetid").value;for(var a="",l=0;l<params.length;l++)a+=(l>0?"&":"")+params[l][0]+"="+encodeURI(params[l][1]);var n=new Date;Autosave?ShortcodeNextSave=n.getTime()+5e3:document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="inline"),e.open("POST",t,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.onreadystatechange=function(){if(4==e.readyState&&200==e.status){PageUpdating=!1;var t="wfu_save_shortcode:",a=e.responseText.indexOf(t);-1==a&&(a=e.responseText.length);var l=(e.responseText.substr(0,a),e.responseText.substr(a+t.length,e.responseText.length-a-t.length));a=l.indexOf(":");var d=l.substr(0,a);if(txt_value=l.substr(a+1,l.length-a-1),"success"==d){if(Autosave?(document.getElementById("wfu_save_label").innerHTML="saved",document.getElementById("wfu_save_label").className="wfu_save_label",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300),ShortcodeNextSave=n.getTime()+1e3,null!=ShortcodeTimeOut&&wfu_schedule_save_shortcode()):document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="none",document.getElementById("wfu_update_shortcode").disabled=!0,window.plugin_window&&window.plugin_window.location.reload(!0)),""!=document.getElementById("wfu_shortcode_postid").value){var o=document.getElementById("wfu_shortcode_tag").value;document.getElementById("wfu_shortcode_original_enc").value=wfu_plugin_encode_string("["+o+" "+ShortcodeString+"]"),document.getElementById("wfu_shortcode_posthash").value=txt_value,setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut)}}else Autosave&&(document.getElementById("wfu_save_label").innerHTML="not saved",document.getElementById("wfu_save_label").className="wfu_save_label_fail",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300)),"fail"==d&&("post_modified"==txt_value?(PageObsolete=!0,document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=!0),document.getElementById("wfu_update_rejected_message").style.display="block"):document.getElementById("wfu_update_failed_message").style.display="block")}},e.send(a)}}}function wfu_adjust_opacity(e){document.getElementById("wfu_save_label").style.opacity=e}function wfu_fadeout_element(e){for(var t=20,a=0,l=0;t>l;l++)a=1-l/t,setTimeout('wfu_adjust_opacity("'+a.toString()+'")',l*e/t);setTimeout('wfu_adjust_opacity("0.0")',l*e/t)}function wfu_apply_value(e,t,a){if("onoff"==t)document.getElementById("wfu_attribute_"+e).className="wfu_onoff_container_"+("true"!=a?"on":"off"),wfu_admin_onoff_clicked(e);else if("text"==t||"ltext"==t||"integer"==t||"float"==t||"mtext"==t||"color"==t){var l=document.getElementById("wfu_attribute_"+e);if(a=a.replace(/\%n\%/gm,"\n"),a=a.replace(/\%dq\%/gm,'"'),a=a.replace(/\%brl\%/gm,"["),a=a.replace(/\%brr\%/gm,"]"),"color"==t){var n=colourNameToHex(a);n||(n=a),jQuery("#wfu_attribute_"+e).wpColorPicker("color",n)}l.value=a,wfu_update_text_value({target:l})}else if("date"==t){var l=document.getElementById("wfu_attribute_"+e);l.value=a,wfu_update_date_value({target:l})}else if("placements"==t)wfu_admin_recreate_placements_panel(a),document.getElementById("wfu_attribute_value_placements").value=a,wfu_generate_shortcode();else if("radio"==t){for(var d=document.getElementsByName("wfu_radioattribute_"+e),o=0;o<d.length;o++)d[o].checked=d[o].value==a||"*"+d[o].value==a;wfu_admin_radio_clicked(e)}else if("ptext"==t){a=a.replace(/\%n\%/gm,"\n"),a=a.replace(/\%dq\%/gm,'"'),a=a.replace(/\%brl\%/gm,"["),a=a.replace(/\%brr\%/gm,"]");var u=a.split("/"),r=u.length<1?"":u[0],_=u.length<2?r:u[1],s=document.getElementById("wfu_attribute_s_"+e);s.value=r;var c=document.getElementById("wfu_attribute_p_"+e);c.value=_,wfu_update_ptext_value({target:s}),wfu_update_ptext_value({target:c})}else if("mchecklist"==t){if(a=a.toLowerCase(),"all"==a)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var i=a.split(","),o=0;o<i.length;o++)i[o]=i[o].trim();jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked",i.indexOf(jQuery(this).next().html())>-1)})}wfu_update_mchecklist_value(e)}else if("rolelist"==t){var l=document.getElementById("wfu_attribute_"+e),f=document.getElementById("wfu_attribute_"+e+"_all"),m=f.className.indexOf("wfu_default_administrator")>-1,p=a.split(",");if(p.indexOf("all")>-1){f.checked=!0;for(var o=0;o<l.options.length;o++)l.options[o].selected=m&&"administrator"==l.options[o].value}else{f.checked=!1;for(var o=0;o<p.length;o++)p[o]=p[o].trim();for(var o=0;o<l.options.length;o++)l.options[o].selected=p.indexOf(l.options[o].value)>-1}document.getElementById("wfu_attribute_"+e+"_guests").checked=p.indexOf("guests")>-1,wfu_update_rolelist_value(e)}else if("userlist"==t){var l=document.getElementById("wfu_attribute_"+e),f=document.getElementById("wfu_attribute_"+e+"_all"),w=f.className.indexOf("wfu_default_0")>-1,g=document.getElementById("wfu_attribute_"+e+"_current");if(g&&"current"==a){g.checked=!0,f.checked=!1,document.getElementById("wfu_attribute_"+e+"_guests").checked=!1;for(var o=0;o<l.options.length;o++)l.options[o].selected=w&&1>o}else{g&&(g.checked=!1);var v=a.split(",");if(v.indexOf("all")>-1){f.checked=!0;for(var o=0;o<l.options.length;o++)l.options[o].selected=w&&1>o}else{f.checked=!1;for(var o=0;o<v.length;o++)v[o]=v[o].trim();for(var o=0;o<l.options.length;o++)l.options[o].selected=v.indexOf(l.options[o].value)>-1}document.getElementById("wfu_attribute_"+e+"_guests").checked=v.indexOf("guests")>-1}wfu_update_userlist_value(e)}else if("postlist"==t){for(var b=Array(),f=Array(),h=document.getElementById("wfu_attribute_"+e+"_postlist").value.split(","),o=0;o<h.length;o++)b.push(document.getElementById("wfu_attribute_"+e+"_"+h[o])),f.push(document.getElementById("wfu_attribute_"+e+"_all_"+h[o]));var g=document.getElementById("wfu_attribute_"+e+"_current");if(g&&"current"==a){g.checked=!0;for(var o=0;o<h.length;o++){f[o].checked=!1;for(var y=0;y<b[o].options.length;y++)b[o].options[y].selected=!1}}else{g&&(g.checked=!1);for(var I=a.split(","),o=0;o<h.length;o++){("all"==a||I.indexOf("all"+h[o])>-1)&&(f[o].checked=!0);for(var y=0;y<b[o].options.length;y++)b[o].options[y].selected=I.indexOf(b[o].options[y].value)>-1}}wfu_update_postlist_value(e)}else if("bloglist"==t){var g=document.getElementById("wfu_attribute_"+e+"_current");if(g&&"current"==a){g.checked=!0,document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var l=document.getElementById("wfu_attribute_"+e),o=0;o<l.options.length;o++)l.options[o].selected=!1}else{g&&(g.checked=!1);var E=a.split(",");if("all"==a)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var o=0;o<E.length;o++)E[o]=E[o].trim();for(var l=document.getElementById("wfu_attribute_"+e),o=0;o<l.options.length;o++)l.options[o].selected=E.indexOf(l.options[o].value)>-1}}wfu_update_bloglist_value(e)}else if("stringmatch"==t){var B="",k="equal to",x="",N=a.match(/^field:(.*?);\s*criterion:(.*?)\s*;\s*value:(.*)$/);N&&4==N.length&&(B=N[1],k=N[2],x=N[3]),document.getElementById("wfu_attribute_"+e+"_matchfield").value=B,document.getElementById("wfu_attribute_"+e+"_matchcriterion").value=k,document.getElementById("wfu_attribute_"+e+"_matchvalue").value=x,wfu_update_stringmatch_value(e)}else if("columns"==t){var T=document.getElementById("wfu_attribute_"+e+"_sourcelist"),A=document.getElementById("wfu_attribute_"+e);A.innerHTML="";for(var H=a.replace(/(:|\/).*?(,|$)/g,"$2").split(","),o=0;o<T.options.length;o++){var u=T.options[o].value.match(/(.*?):(.*?)\/(.*)/),S=u[1];if("wfu_columns_item_required"==T.options[o].className&&-1==H.indexOf(S)){var q="custom"==S?"+-"+(""==u[2]?"s":u[2]):""!=u[2]?"-+"+u[2]:"",O=u[3];"custom"==S&&(S="custom1");var L=document.createElement("OPTION");L.value=S+":"+q+"/"+T.options[o].innerHTML+"/"+O,L.innerHTML=T.options[o].innerHTML+(""!=O&&O!=T.options[o].innerHTML?" ("+O+")":""),L.className=T.options[o].className,L.onclick=T.options[o].onclick,A.appendChild(L)}}for(var C=a.split(","),o=0;o<C.length;o++){var M=C[o].split("/",2),S=M[0],D="";M.length>1&&(D=M[1]),M=S.split(":",2),S=M[0];for(var j=S.replace(/custom[0-9]+$/,"custom"),V=-1,y=0;y<T.options.length;y++){var P=T.options[y].value.replace(/:.*/,"");if(P==j){V=y;break}}for(var R=!1,y=0;y<A.options.length;y++){var F=A.options[y].value.replace(/:.*/,"");if(F==S){R=!0;break}}if("custom"!=S&&V>-1&&!R){var u=T.options[V].value.match(/(.*?):(.*?)\/(.*)/),U="custom"==j||""!=u[2],q=u[2],Q=T.options[V].innerHTML,O=u[3],X="";X=1==M.length?"custom"==j?"+-s":U?"-+"+q:"":"custom"==j?"+"+(""==M[1]?"-s":"+"+M[1]):U?"-"+(""==M[1]?"-":"+")+q:"",
3
- ""==D&&(D=O);var L=document.createElement("OPTION");L.value=S+":"+X+"/"+Q+"/"+D,L.innerHTML=Q+(O!=Q?" ("+O+")":""),L.className=T.options[V].className,L.onclick=T.options[o].onclick,A.appendChild(L)}}wfu_update_column_props(e),wfu_update_columns(e)}else if("dimensions"==t){for(var G,W,$,l,z=a.split(","),J=document.getElementsByName("wfu_dimension_elements_"+e),o=0;o<J.length;o++)J[o].value="";for(var o=0;o<z.length;o++)G=z[o].split(":",2),W=G.length<1?"":G[0],$=G.length<2?W:G[1],l=document.getElementById("wfu_attribute_"+e+"_"+W.trim()),l&&(l.value=$.trim());l=J[0],wfu_update_dimension_value({target:l})}else if("userfields"==t){for(var K,Z=a.replace(/\//g,"[/]").replace(/\(.*\)/,function(e){return e.replace(/\[\/\]/g,"/")}).split("[/]"),Y=Array(),o=0;o<Z.length;o++)K="*"==Z[o].substr(0,1),K&&(Z[o]=Z[o].substr(1)),""!=Z[o]&&Y.push({name:Z[o],required:K});for(var ee=document.getElementById("wfu_attribute_"+e),te=null,ae=Array(),o=0;o<ee.childNodes.length;o++)1===ee.childNodes[o].nodeType&&(null==te?te=ee.childNodes[o]:ae.push(ee.childNodes[o]));for(var o=0;o<ae.length;o++)ee.removeChild(ae[o]);wfu_userdata_edit_field(te,"",!1);for(var le,ne=te,o=0;o<Y.length;o++)0==o?wfu_userdata_edit_field(te,Y[o].name,Y[o].required):(le=ne.cloneNode(!0),wfu_userdata_edit_field(le,Y[o].name,Y[o].required),ee.insertBefore(le,ne.nextSibling),ne=le);for(var l,o=0;o<te.childNodes.length&&(l=te.childNodes[o],"INPUT"!=l.tagName);o++);wfu_update_userfield_value({target:l})}else if("formfields"==t){for(var Y=Array(),de=window["wfu_attribute_"+e+"_typeprops"],oe=de[0].split(","),ue={},o=0;o<oe.length;o++){var re=de[oe[o]],_e={};_e.type=oe[o],_e.label="",_e.labelposition=re.labelposition.substr(5),_e.required="true"==re.required.substr(5),_e.donotautocomplete="true"==re.donotautocomplete.substr(5),_e.validate="true"==re.validate.substr(5),_e.typehook="true"==re.typehook.substr(5),_e.hintposition=re.hintposition.substr(5),_e["default"]=re["default"].substr(5),_e.data=re.data.substr(5),_e.group=re.group.substr(5),_e.format=re.format.substr(5),ue[oe[o]]=_e}for(var Z=a.replace(/\//g,"[/]").replace(/\(.*\)/,function(e){return e.replace(/\[\/\]/g,"/")}).split("[/]"),o=0;o<Z.length;o++){var se=Z[o].trim(),ce={};for(prop in ue.text)ce[prop]=ue.text[prop];"*"==se.substr(0,1)&&(ce.required=!0,se=se.substr(1));var ie=se.split("|");if(""!=ie[0].trim()){for(var fe=-1,me="",y=0;y<ie.length;y++){var pe=ie[y].replace(/^\s+/gm,""),we=pe.substr(0,2),$=pe.substr(2);if("t:"==we&&y>0&&oe.indexOf($)>-1){me=$,fe=y;break}}if(""!=me){for(prop in ue[me])ce[prop]=ue[me][prop];ie.splice(fe,1)}ce.label=ie[0].trim(),ie.splice(0,1);for(var y=0;y<ie.length;y++){var pe=ie[y].replace(/^\s+/gm,""),we=pe.substr(0,2),$=pe.substr(2);"s:"==we?ce.labelposition=$:"r:"==we?ce.required="1"==$:"a:"==we?ce.donotautocomplete="1"==$:"v:"==we?ce.validate="1"==$:"d:"==we?ce["default"]=$:"l:"==we?ce.data=$:"g:"==we?ce.group=$:"f:"==we?ce.format=$:"p:"==we?ce.hintposition=$:"h:"==we&&(ce.typehook="1"==$)}Y.push(ce)}}0==Y.length&&Y.push(fieldprops_default);for(var ee=document.getElementById("wfu_attribute_"+e),ge=document.querySelectorAll("div#wfu_attribute_"+e+" .wfu_formdata_line_container"),o=1;o<ge.length;o++)ee.removeChild(ge[o]);for(var ve=ge[0],o=0;o<Y.length;o++){var be=e+"_"+wfu_randomString(4),he=wfu_formdata_prepare_template(e,Y[o],be);o>0&&(ve=document.createElement("DIV")),ve.id="wfu_formfield_"+be+"_container",ve.className="wfu_formdata_line_container",o>0&&ee.insertBefore(ve,null),ve.innerHTML=he}for(var ye=document.querySelectorAll("div#wfu_attribute_"+e+' input[name="wfu_formfield_elements"]'),o=0;o<ye.length;o++)wfu_attach_element_handlers(ye[o],wfu_update_formfield_value);for(var Ie=document.querySelectorAll("div#wfu_attribute_"+e+" .wfu_formdata_action_remove"),o=0;o<Ie.length;o++)Ie[o].className="wfu_formdata_action wfu_formdata_action_remove"+(Ie.length>1?"":" wfu_formdata_action_disabled");wfu_update_formfield_value({target:ge[0]})}else if("color-triplet"==t){for(var Ee=a.split(","),o=0;o<Ee.length;o++)Ee[o]=Ee[o].trim();2==Ee.length?Ee=[Ee[0],Ee[1],"#000000"]:1==Ee.length?Ee=[Ee[0],"#FFFFFF","#000000"]:Ee.length<3&&(Ee=["#000000","#FFFFFF","#000000"]);var n=colourNameToHex(Ee[0]);n||(n=Ee[0]),jQuery("#wfu_attribute_"+e+"_color").wpColorPicker("color",n);var l=document.getElementById("wfu_attribute_"+e+"_color");l.value=Ee[0],n=colourNameToHex(Ee[1]),n||(n=Ee[1]),jQuery("#wfu_attribute_"+e+"_bgcolor").wpColorPicker("color",n),document.getElementById("wfu_attribute_"+e+"_bgcolor").value=Ee[1],n=colourNameToHex(Ee[2]),n||(n=Ee[2]),jQuery("#wfu_attribute_"+e+"_borcolor").wpColorPicker("color",n),document.getElementById("wfu_attribute_"+e+"_borcolor").value=Ee[2],wfu_update_triplecolor_value({target:l})}else if("folderlist"==t){for(var i=wfu_parse_folderlist_js(a),Be=document.getElementById("wfu_attribute_"+e).options;Be.length>0;)Be.remove(0);for(var L,ke,xe,Ne,Te,Ae,o=0;o<i.path.length;o++){ke=i.path[o],"/"==ke.substr(ke.length,1)&&(ke=ke.substr(0,ke.length-1)),xe=ke.split("/"),ke=xe[xe.length-1],Te=parseInt(i.level[o]),Ne="",Ae="";for(var y=0;Te>y;y++)Ne+="&nbsp;&nbsp;&nbsp;",Ae+="*";Ne+=i.label[o],i["default"][o]&&(Ae+="&"),Ae+=""==ke?"{root}/"+i.label[o]:ke+i.label[o],L=document.createElement("option"),i["default"][o]?L.className="wfu_select_folders_option_default":L.className="",L.value=wfu_plugin_encode_string(Ae),L.innerHTML=Ne,Be.add(L)}L=document.createElement("option"),L.value="",L.innerHTML="",Be.add(L);var He=document.getElementById("wfu_attribute_"+e);He.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),l=He,a!==l.oldVal&&(l.oldVal=a,document.getElementById("wfu_attribute_value_"+e).value=a,wfu_generate_shortcode())}}function wfu_parse_folderlist_js(e){var t=Object();if(t.path=Array(),t.label=Array(),t.level=Array(),t["default"]=Array(),"auto"==e.substr(0,4))return t;var a=e.split(",");if(0==a.length)return t;if(1==a.length&&""==a[0].trim())return t;for(var l,n,d,o,u,r,_,s=["root"],c=0,i=0,f=-1,m=0;m<a.length;m++){for(l=a[m].trim(),n=0,d="",o=!1;n<l.length&&"*"==l.substr(n,1);)n++,d+="&nbsp;&nbsp;&nbsp;";if(1>=n-c&&(n>0||0==i)&&(l=l.substr(n,l.length-n),"&"==l.substr(0,1)&&(l=l.substr(1),o=!0),subfolder_items=l.split("/"),subfolder_items.length<2&&subfolder_items.push(""),""!=subfolder_items[1]?(u=subfolder_items[0],r=subfolder_items[1]):(u=l,r=l),""!=u)){o&&-1==f?f=t.path.length:o=!1,0==n&&(i=1),s.length>n?s[n]=u:s.push(u),_="";for(var p=1;n>=p;p++)_+=s[p]+"/";t.path.push(_),t.label.push(r),t.level.push(n),t["default"].push(o),c=n}}return t}function colourNameToHex(e){var t={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c","indigo ":"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return"undefined"!=typeof t[e.toLowerCase()]?t[e.toLowerCase()]:!1}function wfu_download_file(e,t,a){var l=wfu_GetHttpRequestObject();if(null!=l){var n=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_invoker",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="nonce",params[2][1]=a;for(var d="",o=0;o<params.length;o++)d+=(o>0?"&":"")+params[o][0]+"="+encodeURI(params[o][1]);l.open("POST",n,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(){if(4==l.readyState&&200==l.status){var a="wfu_ajax_action_download_file_invoker:",n=l.responseText.indexOf(a);-1==n&&(n=l.responseText.length);var d=(l.responseText.substr(0,n),l.responseText.substr(n+a.length,l.responseText.length-n-a.length));n=d.indexOf(":");var o=d.substr(0,n);if(txt_value=d.substr(n+1,d.length-n-1),"wfu_download_id;"==o.substr(0,16)){var u=o.substr(16),r=document.getElementById("wfu_file_download_container_"+t);r.innerHTML=txt_value,setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+u+"')",100)}}},l.send(d)}}function wfu_download_file_monitor(e,t,a){var l=wfu_GetHttpRequestObject();if(null!=l){var n=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_monitor",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="id",params[2][1]=a;for(var d="",o=0;o<params.length;o++)d+=(o>0?"&":"")+params[o][0]+"="+encodeURI(params[o][1]);l.open("POST",n,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(){if(4==l.readyState&&200==l.status){var a="wfu_ajax_action_download_file_monitor:",n=l.responseText.indexOf(a);-1==n&&(n=l.responseText.length);var d=(l.responseText.substr(0,n),l.responseText.substr(n+a.length,l.responseText.length-n-a.length));n=d.indexOf(":");var o=d.substr(0,n);if(txt_value=d.substr(n+1,d.length-n-1),"repeat"!=o){var u=document.getElementById("wfu_file_download_container_"+t);u.innerHTML=""}else"repeat"==o&&setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+txt_value+"')",100)}},l.send(d)}}function wfu_filedetails_userdata_changed(e){for(var t,a,l=document.getElementsByName("wfu_filedetails_userdata"),n=!1,d=0;d<l.length;d++)if(t=document.getElementById(l[d].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_default_")),a=document.getElementById(l[d].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_")),a.value=l[d].value,l[d].value!=t.value){n=!0;break}document.getElementById("dp_filedetails_submit_fields").disabled=!n}function wfu_Attach_FileDetails_Admin_Events(){for(var e=document.getElementsByName("wfu_filedetails_userdata"),t=0;t<e.length;t++)wfu_attach_element_handlers(e[t],wfu_filedetails_userdata_changed)}function wfu_update_browserpermission_option(e,t,a){var l=document.getElementById("wfu_fbperm_users"),n=document.getElementById("wfu_fbperm_roles"),d=document.getElementById("wfu_fbperm_"+e+"_"+t+"_view"),o=document.getElementById("wfu_fbperm_"+e+"_"+t+"_dl"),u=document.getElementById("wfu_fbperm_"+e+"_"+t+"_edit"),r=document.getElementById("wfu_fbperm_"+e+"_"+t+"_del");if("role"==e){if("0"==t){o.checked=d.checked&&o.checked,u.checked=d.checked&&u.checked,r.checked=d.checked&&r.checked,o.disabled=!d.checked,u.disabled=!d.checked,r.disabled=!d.checked;for(var _=document.querySelectorAll("tr.wfu_fbperm_role_tr"),s=0;s<_.length;s++){var c=_[s].id.substr(16,_[s].id.length-20);wfu_update_browserpermission_option("role",c,!1)}if(a){var i=(d.checked?"v":"")+(o.checked?"d":"")+(u.checked?"e":"")+(r.checked?"l":"");n.value=n.value.replace(/^0\[\w*\]/,"0["+i+"]")}}else if("administrator"!=t){var f=document.getElementById("wfu_fbperm_role_"+t+"_row"),m=document.getElementById("wfu_fbperm_role_"+t+"_def"),p=document.getElementById("wfu_fbperm_role_0_view"),w=document.getElementById("wfu_fbperm_role_0_dl"),g=document.getElementById("wfu_fbperm_role_0_edit"),v=document.getElementById("wfu_fbperm_role_0_del");if(d.checked=m.checked?p.checked:d.checked,f.style.fontWeight=m.checked?"":"bold",o.checked=m.checked?w.checked:d.checked&&o.checked,u.checked=m.checked?g.checked:d.checked&&u.checked,r.checked=m.checked?v.checked:d.checked&&r.checked,d.disabled=m.checked,o.disabled=m.checked||!d.checked,u.disabled=m.checked||!d.checked,r.disabled=m.checked||!d.checked,a){var i=m.checked?"":"D"+(d.checked?"v":"")+(o.checked?"d":"")+(u.checked?"e":"")+(r.checked?"l":"");n.value=n.value.replace(new RegExp(","+t+"\\[\\w*\\]"),","+t+"["+i+"]")}}for(var b=document.querySelectorAll("tr.wfu_fbperm_user_tr"),s=0;s<b.length;s++){var h=b[s].id.substr(16,b[s].id.length-20);wfu_update_browserpermission_option("user",h,!1)}}else if("user"==e){var y=document.getElementById("wfu_fbperm_user_"+t+"_role");if("0"==t){d.checked=y.checked?!1:d.checked,o.checked=y.checked?!1:d.checked&&o.checked,u.checked=y.checked?!1:d.checked&&u.checked,r.checked=y.checked?!1:d.checked&&r.checked,d.disabled=y.checked,o.disabled=y.checked||!d.checked,u.disabled=y.checked||!d.checked,r.disabled=y.checked||!d.checked,d.indeterminate=y.checked,o.indeterminate=y.checked,u.indeterminate=y.checked,r.indeterminate=y.checked;for(var b=document.querySelectorAll("tr.wfu_fbperm_user_tr"),s=0;s<b.length;s++){var h=b[s].id.substr(16,b[s].id.length-20);wfu_update_browserpermission_option("user",h,!1)}if(a){var i=y.checked?"":"R"+(d.checked?"v":"")+(o.checked?"d":"")+(u.checked?"e":"")+(r.checked?"l":"");l.value=l.value.replace(/^0\[\w*\],?/,""),l.value="0["+i+"]"+(""==l.value?"":","+l.value)}}else{var I=document.getElementById("wfu_fbperm_user_"+t+"_roles").value.split(",");if(1==I.length&&""==I[0]&&(I=Array()),I.indexOf("administrator")<0){var f=document.getElementById("wfu_fbperm_user_"+t+"_row"),m=document.getElementById("wfu_fbperm_user_"+t+"_def"),E=document.getElementById("wfu_fbperm_user_0_role"),p=document.getElementById("wfu_fbperm_user_0_view"),w=document.getElementById("wfu_fbperm_user_0_dl"),g=document.getElementById("wfu_fbperm_user_0_edit"),v=document.getElementById("wfu_fbperm_user_0_del");if(I.length>0)for(var B=!1,k=!1,x=!1,N=!1,s=0;s<I.length;s++)B=B||document.getElementById("wfu_fbperm_role_"+I[s]+"_view").checked,k=B&&(k||document.getElementById("wfu_fbperm_role_"+I[s]+"_dl").checked),x=B&&(x||document.getElementById("wfu_fbperm_role_"+I[s]+"_edit").checked),N=B&&(N||document.getElementById("wfu_fbperm_role_"+I[s]+"_del").checked);else var B=document.getElementById("wfu_fbperm_role_0_view"),k=document.getElementById("wfu_fbperm_role_0_dl"),x=document.getElementById("wfu_fbperm_role_0_edit"),N=document.getElementById("wfu_fbperm_role_0_del");if(f.style.fontWeight=m.checked?"":"bold",y.checked=m.checked?E.checked:y.checked,d.checked=m.checked?E.checked?B:p.checked:y.checked?B:d.checked,o.checked=m.checked?E.checked?k:w.checked:y.checked?k:d.checked&&o.checked,u.checked=m.checked?E.checked?x:g.checked:y.checked?x:d.checked&&u.checked,r.checked=m.checked?E.checked?N:v.checked:y.checked?N:d.checked&&r.checked,y.disabled=m.checked,d.disabled=m.checked||y.checked,o.disabled=m.checked||y.checked||!d.checked,u.disabled=m.checked||y.checked||!d.checked,r.disabled=m.checked||y.checked||!d.checked,a){var i=m.checked?"":"D"+(y.checked?"":"R"+(d.checked?"v":"")+(o.checked?"d":"")+(u.checked?"e":"")+(r.checked?"l":""));l.value=l.value.replace(new RegExp(","+t+"\\[\\w*\\]|"+t+"\\[\\w*\\],|"+t+"\\[\\w*\\]"),""),l.value+=(""==l.value?"":",")+t+"["+i+"]"}}}}}function wfu_goto_historylog_page(e,t){var a=document.getElementById("wfu_historylog_pages"),l=a.selectedIndex+1,n=l;if("next"==t?n=Math.min(l+1,a.options.length):"prev"==t?n=Math.max(l-1,1):"last"==t?n=a.options.length:"first"==t?n=1:"sel"==t&&(l=-1),n!=l){var d=wfu_GetHttpRequestObject();if(null!=d){var o=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_get_historylog_page",params[1]=new Array(2),params[1][0]="token",params[1][1]=e,params[2]=new Array(2),params[2][0]="page",params[2][1]=n;for(var u="",r=0;r<params.length;r++)u+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);document.getElementById("wfu_historylog_overlay").style.display="block",d.open("POST",o,!0),d.setRequestHeader("Content-type","application/x-www-form-urlencoded"),d.onreadystatechange=function(){if(4==d.readyState&&200==d.status){document.getElementById("wfu_historylog_overlay").style.display="none";var e="wfu_historylog_page_success:",t=d.responseText.indexOf(e);-1==t&&(t=d.responseText.length);var l=(d.responseText.substr(0,t),d.responseText.substr(t+e.length,d.responseText.length-t-e.length));if(""!=l){var o=document.getElementById("wfu_historylog_table");o.tBodies[0].innerHTML=wfu_plugin_decode_string(l),a.selectedIndex=n-1,document.getElementById("wfu_historylog_first_disabled").style.display=1==n?"inline":"none",document.getElementById("wfu_historylog_prev_disabled").style.display=1==n?"inline":"none",document.getElementById("wfu_historylog_first").style.display=1==n?"none":"inline",document.getElementById("wfu_historylog_prev").style.display=1==n?"none":"inline",document.getElementById("wfu_historylog_last_disabled").style.display=n==a.options.length?"inline":"none",document.getElementById("wfu_historylog_next_disabled").style.display=n==a.options.length?"inline":"none",document.getElementById("wfu_historylog_last").style.display=n==a.options.length?"none":"inline",document.getElementById("wfu_historylog_next").style.display=n==a.options.length?"none":"inline"}}},d.send(u)}}}var DraggedItem=null,ShortcodeNextSave=0,ShortcodeTimeOut=null,ShortcodeString="",Autosave=!1,PageObsolete=!1,PageUpdating=!1,CheckObsolescenceTimeOut=5e3;jQuery(document).ready(function(e){e(".wfu_color_field").wpColorPicker({change:function(e,t){e.target.value=t.color.toString(),"wfu_text_elements"==e.target.name?wfu_update_text_value(e):"wfu_triplecolor_elements"==e.target.name&&wfu_update_triplecolor_value(e)}})});
1
+ function wfu_admin_activate_tab(e){for(var t,a,l=document.getElementById("wfu_tab_container"),n=0;n<l.childNodes.length;n++)t=l.childNodes[n],1===t.nodeType&&(a=t.id.substr(8),t.className.indexOf("nav-tab-active")>-1&&(t.className="nav-tab",document.getElementById("wfu_container_"+a).style.display="none"));document.getElementById("wfu_tab_"+e).className="nav-tab nav-tab-active",document.getElementById("wfu_container_"+e).style.display="block"}function wfu_admin_onoff_clicked(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_"+e,"div",a),n=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",a),d="on"==t.className.substr(t.className.length-2);if(d=!d){document.getElementById("wfu_attribute_value_"+e).value="true",t.className="wfu_onoff_container_on";for(var u=0;u<l.length;u++)l[u].style.display="none";for(var u=0;u<n.length;u++)n[u].style.display="block"}else{document.getElementById("wfu_attribute_value_"+e).value="false",t.className="wfu_onoff_container_off";for(var u=0;u<l.length;u++)l[u].style.display="block";for(var u=0;u<n.length;u++)n[u].style.display="none"}wfu_generate_shortcode(),("userdata"==e||"formdata"==e)&&wfu_update_formfield_variables()}function wfu_admin_radio_clicked(e){var t=document.getElementsByName("wfu_radioattribute_"+e),a=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_"+e,"div",a),n=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",a),d="";for(o=0;o<t.length;o++)t[o].checked&&(d=t[o].value);var u="*"==d.substr(0,1);if(u){d=d.substr(1);for(var o=0;o<l.length;o++)l[o].style.display="none";for(var o=0;o<n.length;o++)n[o].style.display="block"}else{for(var o=0;o<l.length;o++)l[o].style.display="block";for(var o=0;o<n.length;o++)n[o].style.display="none"}document.getElementById("wfu_attribute_value_"+e).value=d,wfu_generate_shortcode()}function wfu_addEventHandler(e,t,a){e.addEventListener?e.addEventListener(t,a,!1):e.attachEvent?e.attachEvent("on"+t,a):e["on"+t]=a}function wfu_attach_separator_dragdrop_events(){for(var e,t=document.getElementById("wfu_placements_container"),a=0;a<t.childNodes.length;a++)e=t.childNodes[a],("wfu_component_separator_hor"==e.className||"wfu_component_separator_ver"==e.className)&&(wfu_addEventHandler(e,"dragenter",wfu_separator_dragenter),wfu_addEventHandler(e,"dragover",wfu_default_dragover),wfu_addEventHandler(e,"dragleave",wfu_separator_dragleave),wfu_addEventHandler(e,"drop",wfu_separator_drop))}function wfu_Attach_Admin_DragDrop_Events(){if(window.FileReader){var e=document.getElementById("wfu_placements_container");if(e){for(var t,a=document.getElementById("wfu_componentlist_container"),l=0;l<e.childNodes.length;l++)t=e.childNodes[l],"wfu_component_box"==t.className&&(wfu_addEventHandler(t,"dragstart",wfu_component_dragstart),wfu_addEventHandler(t,"dragend",wfu_component_dragend));for(var l=0;l<a.childNodes.length;l++)if(t=a.childNodes[l],"wfu_component_box_container"==t.className)for(var n=0;n<t.childNodes.length;n++)"wfu_component_box wfu_inbase"==t.childNodes[n].className&&(wfu_addEventHandler(t.childNodes[n],"dragstart",wfu_component_dragstart),wfu_addEventHandler(t.childNodes[n],"dragend",wfu_component_dragend));t=document.getElementById("wfu_componentlist_dragdrop"),wfu_addEventHandler(t,"dragenter",wfu_componentlist_dragenter),wfu_addEventHandler(t,"dragover",wfu_default_dragover),wfu_addEventHandler(t,"dragleave",wfu_componentlist_dragleave),wfu_addEventHandler(t,"drop",wfu_componentlist_drop),wfu_attach_separator_dragdrop_events()}}}function wfu_componentlist_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return-1==t.className.indexOf("wfu_componentlist_dragdrop_dragover")&&(t.className+=" wfu_componentlist_dragdrop_dragover"),!1}function wfu_componentlist_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className=t.className.replace(" wfu_componentlist_dragdrop_dragover",""),!1}function wfu_componentlist_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var a=t.split("_"),l=a[0],n=parseInt(a[1]),d=document.getElementById("wfu_component_box_"+l+"_"+n);0==n?(d.className="wfu_component_box wfu_inbase",d.style.display="block",document.getElementById("wfu_component_box_container_"+l).appendChild(d)):d.parentNode.removeChild(d);var u=wfu_admin_recreate_placements_text(null,"");return wfu_admin_recreate_placements_panel(u),document.getElementById("wfu_attribute_value_placements").value=u,wfu_update_multiplacement_attributes(),wfu_generate_shortcode(),!1}function wfu_separator_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.top=e.target.offsetTop+"px",t.style.display="block"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.top=e.target.offsetTop+"px",t.style.left=e.target.offsetLeft+"px",t.style.display="block"}return!1}function wfu_default_dragover(e){return e=e||window.event,e.preventDefault&&e.preventDefault(),!1}function wfu_separator_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.display="none"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.display="none"}return!1}function wfu_separator_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var a=t.split("_"),l=a[0],n=parseInt(a[1]),d=document.getElementById("wfu_component_box_"+l+"_"+n);d.style.display="none",d.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+l).appendChild(d);var u=wfu_admin_recreate_placements_text(e.target,l);return wfu_admin_recreate_placements_panel(u),document.getElementById("wfu_attribute_value_placements").value=u,wfu_update_multiplacement_attributes(),wfu_generate_shortcode(),!1}function wfu_component_dragstart(e){e=e||window.event,e.dataTransfer.setData("Component",e.target.id.replace("wfu_component_box_","")),-1==e.target.className.indexOf("wfu_component_box_dragged")&&(e.target.className+=" wfu_component_box_dragged",DraggedItem=e.target),e.target.style.zIndex=3;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className="wfu_componentlist_dragdrop wfu_componentlist_dragdrop_dragover",t.style.display="block",!1}function wfu_component_dragend(e){e=e||window.event,DraggedItem=null,e.target.style.zIndex=1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.style.display="none",t.className="wfu_componentlist_dragdrop",e.target.className=e.target.className.replace(" wfu_component_box_dragged",""),document.getElementById("wfu_component_bar_ver").style.display="none",document.getElementById("wfu_component_bar_hor").style.display="none",!1}function wfu_admin_recreate_placements_text(e,t){function a(e){""!=d&&(d+=n),d+=e,n=""}for(var l=document.getElementById("wfu_placements_container"),n="",d="",u=0;u<l.childNodes.length;u++)item=l.childNodes[u],"wfu_component_separator_ver"==item.className?(""==n&&(n="+"),item==e&&(a(t),n="+")):"wfu_component_separator_hor"==item.className?(n="/",item==e&&(a(t),n="/")):"wfu_component_box"==item.className&&a(item.id.replace("wfu_component_box_","").replace(/_.*$/,""));return d}function wfu_admin_recreate_placements_panel(e){for(var t,a,l,n,d,u,o,r=document.getElementById("wfu_placements_container"),_="",s=0;s<r.childNodes.length;s++)t=r.childNodes[s],"wfu_component_box"==t.className&&(n=t.id.replace("wfu_component_box_",""),d=n.split("_"),_=d[0],u=parseInt(d[1]),0==u?(t.style.display="inline-block",t.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+_).appendChild(t)):t.parentNode.removeChild(t));for(var i=document.querySelectorAll("div.wfu_component_box_container"),c={},s=0;s<i.length;s++)_=i[s].id.replace("wfu_component_box_container_",""),c[_]=0,o=document.querySelector("div#"+i[s].id+" div.wfu_component_box_index"),o&&(o.innerHTML="1");r.innerHTML="",a=e.split("/");for(var s=0;s<a.length;s++){t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),r.appendChild(t),t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),r.appendChild(t),l=a[s].split("+");for(var f=0;f<l.length;f++)t=document.querySelector("div#wfu_component_box_container_"+l[f]+" div.wfu_component_box.wfu_inbase"),t&&(n=t.id.replace("wfu_component_box_",""),d=n.split("_"),_=d[0],u=parseInt(d[1]),0==u?r.appendChild(t):(c[_]++,t.id="wfu_component_box_"+_+"_"+(c[_]+1).toString(),t.style.display="block",o=document.querySelector("div#"+t.id+" div.wfu_component_box_index"),o.innerHTML=(c[_]+1).toString(),t=t.cloneNode(!0),r.appendChild(t),t.id="wfu_component_box_"+_+"_"+c[_].toString(),o=document.querySelector("div#"+t.id+" div.wfu_component_box_index"),o.innerHTML=c[_].toString(),wfu_addEventHandler(t,"dragstart",wfu_component_dragstart),wfu_addEventHandler(t,"dragend",wfu_component_dragend)),t.className="wfu_component_box",t.style.display="inline-block",t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),r.appendChild(t))}t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),r.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_hor",t.className="wfu_component_bar_hor",r.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_ver",t.className="wfu_component_bar_ver",r.appendChild(t),wfu_attach_separator_dragdrop_events()}function wfu_update_multiplacement_attributes(){for(var e=document.querySelectorAll("div.wfu_component_box_container"),t=0;t<e.length;t++){itemname=e[t].id.replace("wfu_component_box_container_","");var a=document.querySelector("div#"+e[t].id+" div.wfu_component_box_index");if(a)for(var l=Math.max(1,parseInt(a.innerHTML)-1),n=document.getElementsByName("wfu_attribute_governor_"+itemname),d=0;d<n.length;d++)wfu_update_multiplacement_attribute(n[d].value,l)}}function wfu_update_multiplacement_attribute(e,t){if("userdatalabel"==e){var a=document.querySelectorAll("div.wfu_formdata_container"),l=a.length;if(1>l)return;for(var n,d,u=a[0],o=2;o<=Math.max(l,t);){if(o>l){var r=e+o.toString();for(n=u.parentNode;null!=n&&"TR"!=n.tagName;)n=n.parentNode;if(null==n||"TR"!=n.tagName)return;d=n.cloneNode(!0),d.id="tr_"+wfu_randomString(4),n.parentNode.appendChild(d);var _=document.querySelector("tr#"+d.id+' label[for="wfu_attribute_'+e+'"]');_.setAttribute("for","wfu_attribute_"+r),_.innerHTML+=" ("+o.toString()+")",_=document.querySelector("tr#"+d.id+" input.wfu_attribute_governor"),_.setAttribute("name","wfu_attribute_governor_independent"),_.value=r,_=document.querySelector("tr#"+d.id+" div.wfu_formdata_container"),_.id+=o.toString();var s=document.getElementById("wfu_attribute_default_"+r);s||(s=document.createElement("INPUT"),s.id="wfu_attribute_default_"+r,s.type="hidden",s.value=document.getElementById("wfu_attribute_default_"+e).value,document.getElementById("wfu_attribute_defaults").appendChild(s));var i=document.getElementById("wfu_attribute_value_"+r);i||(i=document.createElement("INPUT"),i.id="wfu_attribute_value_"+r,i.type="hidden",i.value=s.value,document.getElementById("wfu_attribute_values").appendChild(i)),window["wfu_attribute_"+r+"_formtemplate"]=window["wfu_attribute_"+e+"_formtemplate"],window["wfu_attribute_"+r+"_typeprops"]=window["wfu_attribute_"+e+"_typeprops"],wfu_apply_value(r,"formfields",i.value)}else if(o>t){for(d=a[o-1].parentNode;null!=d&&"TR"!=d.tagName;)d=d.parentNode;if(null==d||"TR"!=d.tagName)return;d.parentNode.removeChild(d),wfu_update_formfield_variables()}o++}}}function wfu_subfolders_input_changed(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_subfolders_path_","");a=a.replace("wfu_subfolders_label_","");var l=document.getElementById("wfu_attribute_"+a);if(!(l.selectedIndex<0)){var n,d,u=document.getElementById("wfu_subfolders_path_"+a),o=document.getElementById("wfu_subfolders_label_"+a),r=document.getElementById("wfu_subfolders_ok_"+a),_="1"==document.getElementById("wfu_subfolders_isnewitem_"+a).value;if(_)n="",d="";else{var s=l.data;t=s[l.selectedIndex],n=t.path,d=t.label}if(u.value==n&&o.value==d)r.disabled=!0,_||wfu_subfolders_update_nav(a);else{r.disabled=!1;for(var i=document.getElementsByName("wfu_subfolder_nav_"+a),c=0;c<i.length;c++)i[c].disabled=!0}}}function wfu_subfolders_auto_changed(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_subfolders_auto_"+e),l=document.getElementById("wfu_subfolders_editable_"+e),n=document.getElementById("wfu_subfolders_manualtext_"+e);if(a.checked){var d=document.getElementById("wfu_attribute_value_"+e).value;"auto"!=d.substr(0,4)&&(n.value=d),l.parentNode.style.display="inline",wfu_apply_value(e,"folderlist","auto"+(l.checked?"+":"")),t.disabled=!0}else t.disabled=!1,l.parentNode.style.display="none",wfu_apply_value(e,"folderlist",n.value)}function wfu_subfolders_up_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=item.index-1;if(!(0>l)){for(var n=-1,d=t.selectedIndex-1;d>=0;){if(a[d].level==item.level&&a[d].index==l){n=d;break}d--}if(-1!=n){var u=0;for(d=t.selectedIndex+1;d<a.length&&a[d].level>item.level;)u++,d++;a[n].index=item.index,item.index=l,t.data=a.slice(0,n).concat(a.slice(t.selectedIndex,t.selectedIndex+1+u)).concat(a.slice(n,t.selectedIndex)).concat(a.slice(t.selectedIndex+1+u));var o=wfu_update_subfolder_list(e);t.selectedIndex=n,wfu_subfolders_update_toolnav(e),item=t,o!==item.oldVal&&(item.oldVal=o,document.getElementById("wfu_attribute_value_"+e).value=o,wfu_generate_shortcode())}}}}function wfu_subfolders_down_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=item.index+1,n=-1;for(curind=t.selectedIndex+1;curind<a.length;){if(a[curind].level==item.level){n=curind;break}if(a[curind].level<item.level)break;curind++}if(-1!=n){var d=0;for(curind=n+1;curind<a.length&&a[curind].level>item.level;)d++,curind++;a[n].index=item.index,item.index=l,t.data=a.slice(0,t.selectedIndex).concat(a.slice(n,n+1+d)).concat(a.slice(t.selectedIndex,n)).concat(a.slice(n+1+d));var u=wfu_update_subfolder_list(e);t.selectedIndex=t.selectedIndex+d+1,wfu_subfolders_update_toolnav(e),item=t,u!==item.oldVal&&(item.oldVal=u,document.getElementById("wfu_attribute_value_"+e).value=u,wfu_generate_shortcode())}}}function wfu_subfolders_left_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;for(item=a[t.selectedIndex],curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)a[curind].level--,curind++;item.level--;var l=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,l!==item.oldVal&&(item.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_subfolders_right_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;for(item=a[t.selectedIndex],curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)a[curind].level++,curind++;item.level++;var l=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,l!==item.oldVal&&(item.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_subfolders_def_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;if(item=a[t.selectedIndex],item["default"])item["default"]=!1;else{for(var l=0;l<a.length;l++)a[l]["default"]=!1;item["default"]=!0}var n=wfu_update_subfolder_list(e);wfu_subfolders_update_toolnav(e),item=t,n!==item.oldVal&&(item.oldVal=n,document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode())}}function wfu_subfolders_ok_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=document.getElementById("wfu_subfolders_path_"+e),l=document.getElementById("wfu_subfolders_label_"+e);if(""==a.value||""==l.value)return void alert("Path or label cannot be empty!");var n=t.data,d="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;if(d){var u=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value),o={label:l.value,path:a.value,level:u,"default":!1},r=parseInt(document.getElementById("wfu_subfolders_newitemindex_"+e).value);r>=n.length?n.push(o):n.splice(r,0,o)}else item=n[t.selectedIndex],item.path=a.value,item.label=l.value;var _=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,_!==item.oldVal&&(item.oldVal=_,document.getElementById("wfu_attribute_value_"+e).value=_,wfu_generate_shortcode())}}function wfu_subfolders_del_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=0;for(curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)l++,curind++;if(!(l>0)||confirm("Children items will be deleted as well. Proceed?")){a.splice(t.selectedIndex,1+l);var n=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,n!==item.oldVal&&(item.oldVal=n,document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode())}}}function wfu_subfolders_add_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data,l=t.selectedIndex;item=a[l];var n=t.options,d=document.createElement("option");d.value="",d.innerHTML="",n.add(d,l),t.selectedIndex=l;var u=document.getElementById("wfu_subfolder_tools_"+e),o=document.getElementById("wfu_subfolders_path_"+e),r=document.getElementById("wfu_subfolders_label_"+e),_=document.getElementById("wfu_subfolders_ok_"+e),s=document.getElementById("wfu_subfolders_browse_"+e);u.className="wfu_subfolder_tools_container",r.disabled=!1,_.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=l,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=item.level,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",o.disabled=0==item.level,s.disabled=0==item.level,0==item.level?(o.value="{root}",r.value="{upload folder}"):(o.value="",r.value="");for(var i=document.getElementsByName("wfu_subfolder_nav_"+e),c=0;c<i.length;c++)i[c].disabled=!0}}function wfu_subfolders_browse_clicked(e){var t=wfu_GetHttpRequestObject();if(null!=t){var a=null;try{var a=new FormData}catch(l){}if(null!=a){for(var n=document.getElementById("wfu_global_dialog_container"),d=document.getElementById("wfu_subfolders_browser_"+e),u=document.getElementById("wfu_subfolders_browse_"+e),o=document.getElementById("wfu_subfolders_inner_shadow_"+e),r=document.getElementById("wfu_subfolders_browser_msgcont_"+e),_=document.getElementById("wfu_subfolders_browser_msg_"+e),s=document.getElementById("wfu_subfolders_browser_img_"+e),i=document.getElementById("wfu_subfolders_browser_ok_"+e),c=document.getElementById("wfu_subfolders_browser_list_"+e);c.options.length>0;)c.options.remove(0);i.disabled=!0,i.onclick=function(){wfu_folder_browser_cancel_clicked(e)},_.innerHTML="loading folder contents...",s.style.display="inline",r.style.display="block",n.style.display="block",d.style.display="block",d.style.left=u.offsetLeft+u.offsetWidth-d.offsetWidth+"px",d.style.top=u.offsetTop+u.offsetHeight-d.offsetHeight+"px",o.style.display="block",n.onclick=function(){wfu_folder_browser_cancel_clicked(e)};var f=document.getElementById("wfu_attribute_uploadpath").value;"/"==f.substr(f.length-1)&&(f=f.substr(0,f.length-1));var m=wfu_get_relative_path(e).split(","),p=f+m[0];"/"!=p.substr(0)&&(p="/"+p);var w="";2==m.length&&(w=m[1]),a.append("action","wfu_ajax_action_read_subfolders"),a.append("folder1",wfu_plugin_encode_string(p)),a.append("folder2",wfu_plugin_encode_string(w)),t.key=e,t.addEventListener("load",wfu_readfolderComplete,!1),t.addEventListener("error",wfu_readfolderFailed,!1),t.addEventListener("abort",wfu_readfolderCanceled,!1),t.open("POST",AdminParams.wfu_ajax_url),t.send(a)}}}function wfu_readfolderComplete(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msgcont_"+t),l=document.getElementById("wfu_subfolders_browser_msg_"+t),n=document.getElementById("wfu_subfolders_browser_img_"+t),d=document.getElementById("wfu_subfolders_browser_list_"+t),u=document.getElementById("wfu_subfolders_browser_ok_"+t),o=document.getElementById("wfu_subfolders_path_"+t),r=document.getElementById("wfu_subfolders_label_"+t),_=e.target.responseText;if(-1!=_){var s="wfu_read_subfolders:",i=e.target.responseText.indexOf(s);-1==i&&(i=e.target.responseText.length);var c=(e.target.responseText.substr(0,i),e.target.responseText.substr(i+s.length,e.target.responseText.length-i-s.length));i=c.indexOf(":");var f=c.substr(0,i);if(txt_value=c.substr(i+1,c.length-i-1),"success"==f){for(var m,p=wfu_plugin_decode_string(txt_value),w=p.split(","),g=0,v=0;v<w.length;v++)""!=w[v]&&(m=document.createElement("option"),m.value=w[v],m.innerHTML=w[v].replace("*","&nbsp;&nbsp;&nbsp;"),d.add(m),g++);0==g&&(m=document.createElement("option"),m.value="",m.innerHTML="{empty}",m.disabled=!0,d.add(m)),d.selectedIndex=-1,u.onclick=function(){var e=d.options[d.selectedIndex].value,a=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+t).value);("*"==e.substr(0,1)||0==a)&&(document.getElementById("wfu_subfolders_newitemlevel_"+t).value=a+1,a>0&&(e=e.substr(1))),o.value=e,r.value=e,wfu_folder_browser_cancel_clicked(t),wfu_subfolders_ok_clicked(t)},a.style.display="none"}else"error"==f?(l.innerHTML=txt_value,n.style.display="none",u.disabled=!1):(l.innerHTML="Unknown error",n.style.display="none",u.disabled=!1)}}function wfu_readfolderFailed(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msg_"+t),l=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_ok_"+t);a.innerHTML="Unknown error",l.style.display="none",n.disabled=!1}function wfu_readfolderCanceled(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msg_"+t),l=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_ok_"+t);a.innerHTML="Unknown error",l.style.display="none",n.disabled=!1}function wfu_subfolders_browser_list_changed(e){var t=document.getElementById("wfu_subfolders_browser_list_"+e),a=document.getElementById("wfu_subfolders_browser_ok_"+e);a.disabled=t.selectedIndex<0}function wfu_folder_browser_cancel_clicked(e){var t=document.getElementById("wfu_global_dialog_container"),a=document.getElementById("wfu_subfolders_browser_"+e),l=(document.getElementById("wfu_subfolders_browse_"+e),document.getElementById("wfu_subfolders_inner_shadow_"+e));t.onclick=null,l.style.display="none",a.style.display="none",t.style.display="none"}function wfu_get_relative_path(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a,l=t.data,n="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;a=n?parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value):l[t.selectedIndex].level;for(var d="/",u=t.selectedIndex-1,o=a;u>=0&&o>1;)l[u].level<o&&(d="/"+l[u].path+d,o=l[u].level),u--;return n&&"1"==document.getElementById("wfu_subfolders_newitemlevel2_"+e).value&&a>0&&t.selectedIndex>0&&(d+=","+l[t.selectedIndex-1].path),d}}function wfu_subfolders_changed(e){wfu_update_subfolder_list(e),wfu_subfolders_update_toolnav(e)}function wfu_subfolders_update_toolnav(e){var t,a,l=document.getElementById("wfu_attribute_"+e),n=document.getElementById("wfu_subfolder_tools_"+e),d=document.getElementById("wfu_subfolders_path_"+e),u=document.getElementById("wfu_subfolders_label_"+e),o=document.getElementById("wfu_subfolders_ok_"+e),r=document.getElementById("wfu_subfolders_browse_"+e),_=document.getElementById("wfu_subfolders_auto_"+e);if(document.getElementById("wfu_subfolders_isnewitem_"+e).value="",document.getElementById("wfu_subfolders_newitemindex_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",null==l.data?(t=wfu_decode_subfolder_list(e),l.data=t):t=l.data,0===l.data.length?(l.className="wfu_select_folders wfu_select_folders_empty",l.options[0].innerHTML=_.checked?"":"press here"):l.className="wfu_select_folders",l.selectedIndex<0)n.className="wfu_subfolder_tools_container wfu_subfolder_tools_disabled",d.disabled=!0,u.disabled=!0,o.disabled=!0,r.disabled=!0,u.value="",d.value="";else if(l.selectedIndex>=l.options.length-1){n.className="wfu_subfolder_tools_container",u.disabled=!1,o.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=t.length;var s;s=0==t.length?0:0==t[t.length-1].level?1:t[t.length-1].level,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=s,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="1",d.disabled=0==s,r.disabled=!1,0==s?(d.value="{root}",u.value="{upload folder}"):(d.value="",u.value="")}else n.className="wfu_subfolder_tools_container",u.disabled=!1,o.disabled=!0,a=t[l.selectedIndex],d.disabled=0==a.level,r.disabled=0==a.level,u.value=a.label,d.value=a.path;var i=document.getElementsByName("wfu_subfolder_nav_"+e);if(l.selectedIndex<0||l.selectedIndex>=l.options.length-1)for(var c=0;c<i.length;c++)i[c].disabled=!0;else wfu_subfolders_update_nav(e)}function wfu_subfolders_update_nav(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_subfolders_up_"+e),l=document.getElementById("wfu_subfolders_down_"+e),n=document.getElementById("wfu_subfolders_left_"+e),d=document.getElementById("wfu_subfolders_right_"+e),u=document.getElementById("wfu_subfolders_add_"+e),o=document.getElementById("wfu_subfolders_def_"+e),r=document.getElementById("wfu_subfolders_del_"+e),_=t.data,s=_[t.selectedIndex];for(a.disabled=s.index<=0,ind=t.selectedIndex+1,nextind=0;ind<_.length;){if(_[ind].level==s.level){nextind=_[ind].index;break}if(_[ind].level<s.level)break;ind++}l.disabled=0==s.level||0==nextind,n.disabled=0==t.selectedIndex&&s.level<1||t.selectedIndex>0&&s.level<=1,t.selectedIndex>=1?prevlevel=_[t.selectedIndex-1].level:prevlevel=0,d.disabled=s.level-prevlevel>0,u.disabled=0==s.level,o.disabled=!1,o.className="button"+(s["default"]?" wfu_subfolder_nav_pressed":""),r.disabled=!1}function wfu_decode_subfolder(e){var t={label:"",path:"",level:0,"default":!1};e=e.trim();for(var a=0,l=!1;a<e.length&&"*"==e.substr(a,1);)a++;e=e.substr(a,e.length-a),"&"==e.substr(0,1)&&(e=e.substr(1),l=!0),t.level=a,t["default"]=l;var n=e.split("/");return 1==n.length?(t.path=n[0],t.label=n[0]):n.length>1&&(t.path=n[0],t.label=n[1]),0==a&&(t.path="{root}",""==t.label&&(t.label="{upload folder}")),t}function wfu_decode_subfolder_list(e){for(var t,a=document.getElementById("wfu_attribute_"+e).options,l=Array(),n=["root"],d=[0],u=-1,o=0;o<a.length-1;o++){for(l.push(wfu_decode_subfolder(wfu_plugin_decode_string(a[o].value))),n.length>l[o].level?n[l[o].level]=l[o].path:n.push(l[o].path),t="",j=1;j<=l[o].level;j++)t+=n[j]+"/";l[o].fullpath=t,d.length<=l[o].level&&d.push(0),l[o].level>u?l[o].index=0:l[o].index=d[l[o].level]+1,d[l[o].level]=l[o].index,u=l[o].level}return l}function wfu_update_subfolder_list(e){var t=document.getElementById("wfu_attribute_"+e).options,a=document.getElementById("wfu_attribute_"+e),l=a.data;if(null!=l){var n,d,u="";t.length=l.length+1;for(var o=0;o<l.length;o++){for(n="",d="",j=0;j<l[o].level;j++)n+="*",d+="&nbsp;&nbsp;&nbsp;";l[o]["default"]?(n+="&",t[o].className="wfu_select_folders_option_default"):t[o].className="",n+=l[o].path+"/"+l[o].label,d+=l[o].label,t[o].value=wfu_plugin_encode_string(n),t[o].innerHTML=d,""!=u&&(u+=","),u+=n}return t[l.length].value="",t[l.length].innerHTML="",u}}function wfu_userdata_edit_field(e,t,a){for(var l,n=0;n<e.childNodes.length;n++)l=e.childNodes[n],"INPUT"==l.tagName?"text"==l.type?(l.value=t,wfu_attach_element_handlers(l,wfu_update_userfield_value)):"checkbox"==l.type&&(l.checked=a):"DIV"==l.tagName&&(l.className="wfu_userdata_action")}function wfu_formdata_edit_field(e,t,a){}function wfu_formdata_type_changed(e){var t=e.split("_"),a=t[0],l="wfu_formfield_"+e,n=(document.getElementById("wfu_attribute_"+a),document.getElementById(l+"_container")),d=window["wfu_attribute_"+a+"_typeprops"][document.getElementById(l+"_type").value],u={type:document.getElementById(l+"_type").value,label:document.getElementById(l+"_label").value,labelposition:document.getElementById(l+"_labelposition").value,required:"show"==d.required.substr(0,4)&&document.getElementById(l+"_required")?document.getElementById(l+"_required").checked:"true"==d.required.substr(5),donotautocomplete:"show"==d.donotautocomplete.substr(0,4)&&document.getElementById(l+"_donotautocomplete")?document.getElementById(l+"_donotautocomplete").checked:"true"==d.donotautocomplete.substr(5),validate:"show"==d.validate.substr(0,4)&&document.getElementById(l+"_validate")?document.getElementById(l+"_validate").checked:"true"==d.validate.substr(5),typehook:"show"==d.typehook.substr(0,4)&&document.getElementById(l+"_typehook")?document.getElementById(l+"_typehook").checked:"true"==d.typehook.substr(5),hintposition:"show"==d.hintposition.substr(0,4)&&document.getElementById(l+"_hintposition")?document.getElementById(l+"_hintposition").value:d.hintposition.substr(5),"default":"show"==d["default"].substr(0,4)&&document.getElementById(l+"_default")?document.getElementById(l+"_default").value:d["default"].substr(5),data:"show"==d.data.substr(0,4)&&document.getElementById(l+"_data")?document.getElementById(l+"_data").value:d.data.substr(5),group:"show"==d.group.substr(0,4)&&document.getElementById(l+"_group")?document.getElementById(l+"_group").value:d.group.substr(5),format:"show"==d.format.substr(0,4)&&document.getElementById(l+"_format")?document.getElementById(l+"_format").value:d.format.substr(5)},o=wfu_formdata_prepare_template(a,u,e);n.innerHTML=o;for(var r=document.querySelectorAll("div#"+l+'_container input[name="wfu_formfield_elements"]'),_=0;_<r.length;_++)wfu_attach_element_handlers(r[_],wfu_update_formfield_value);for(var s=document.querySelectorAll("div#wfu_attribute_"+a+" .wfu_formdata_action_remove"),_=0;_<s.length;_++)s[_].className="wfu_formdata_action wfu_formdata_action_remove"+(s.length>1?"":" wfu_formdata_action_disabled");wfu_update_formfield_value({target:n})}function wfu_userdata_add_field(e){var t=e.parentNode,a=t.cloneNode(!0);wfu_userdata_edit_field(a,"",!1),t.parentNode.insertBefore(a,t.nextSibling)}function wfu_formdata_add_field(e){var t=e.split("_"),a=t[0],l=(t[1],document.getElementById("wfu_attribute_"+a)),n=document.getElementById("wfu_formfield_"+e+"_container"),d=document.createElement("DIV"),u=a+"_"+wfu_randomString(4);d.id="wfu_formfield_"+u+"_container",d.className="wfu_formdata_line_container",l.insertBefore(d,n.nextSibling);var o={type:"text",label:"",labelposition:"left",required:!1,donotautocomplete:!1,validate:!1,"default":"",data:"",group:"",format:"",hintposition:"right",typehook:!1},r=wfu_formdata_prepare_template(a,o,u);
2
+ d.innerHTML=r;for(var _=document.querySelectorAll("div#wfu_formfield_"+u+'_container input[name="wfu_formfield_elements"]'),s=0;s<_.length;s++)wfu_attach_element_handlers(_[s],wfu_update_formfield_value);for(var i=document.querySelectorAll("div#wfu_attribute_"+a+" .wfu_formdata_action_remove"),s=0;s<i.length;s++)i[s].className="wfu_formdata_action wfu_formdata_action_remove"+(i.length>1?"":" wfu_formdata_action_disabled");wfu_update_formfield_value({target:d})}function wfu_formdata_prepare_template(e,t,a){var l=wfu_plugin_decode_string(window["wfu_attribute_"+e+"_formtemplate"]),n=window["wfu_attribute_"+e+"_typeprops"][t.type],d=window["wfu_attribute_"+e+"_typeprops"][0].split(","),u=["required","donotautocomplete","validate","typehook","labelposition","hintposition","default","data","group","format"],o=["none","top","right","bottom","left"],r=["none","inline","top","right","bottom","left"];l=l.replace(/\[\[key\]\]/g,a).replace(/\[\[t\]\]/g,t.type).replace(/\[\[label\]\]/g,t.label).replace(/\[\[s\]\]/g,t.labelposition).replace(/\[\[d\]\]/g,t["default"]).replace(/\[\[l\]\]/g,t.data).replace(/\[\[data_label\]\]/g,n.data_label).replace(/\[\[g\]\]/g,t.group).replace(/\[\[f\]\]/g,t.format).replace(/\[\[p\]\]/g,t.hintposition);for(var _=0;_<u.length;_++)l=l.replace(new RegExp("\\[\\["+u[_]+"_hint\\]\\]","g"),n[u[_]+"_hint"]);for(var _=0;_<d.length;_++)l=l.replace("[[type_"+d[_]+"_selected]]",d[_]==t.type?' selected="selected"':"");for(var _=0;_<o.length;_++)l=l.replace("[[labelposition_"+o[_]+"_selected]]",o[_]==t.labelposition?' selected="selected"':"");for(var _=0;_<r.length;_++)l=l.replace("[[hintposition_"+r[_]+"_selected]]",r[_]==t.hintposition?' selected="selected"':"");return l=l.replace("[[remove_disabled]]",""),l=t.required?l.replace(/\[\[r\-\>\]\]|\[\[\<\-r\]\]/g,""):l.replace(/\[\[r\-\>\]\].*\[\[\<\-r\]\]/g,""),l=t.donotautocomplete?l.replace(/\[\[a\-\>\]\]|\[\[\<\-a\]\]/g,""):l.replace(/\[\[a\-\>\]\].*\[\[\<\-a\]\]/g,""),l=t.validate?l.replace(/\[\[v\-\>\]\]|\[\[\<\-v\]\]/g,""):l.replace(/\[\[v\-\>\]\].*\[\[\<\-v\]\]/g,""),l=t.typehook?l.replace(/\[\[h\-\>\]\]|\[\[\<\-h\]\]/g,""):l.replace(/\[\[h\-\>\]\].*\[\[\<\-h\]\]/g,""),l="show"==n.required.substr(0,4)?l.replace(/\[\[R\-\>\]\]|\[\[\<\-R\]\]/g,""):l.replace(/\[\[R\-\>\]\][^]*\[\[\<\-R\]\]/g,""),l="show"==n.donotautocomplete.substr(0,4)?l.replace(/\[\[A\-\>\]\]|\[\[\<\-A\]\]/g,""):l.replace(/\[\[A\-\>\]\][^]*\[\[\<\-A\]\]/g,""),l="show"==n.validate.substr(0,4)?l.replace(/\[\[V\-\>\]\]|\[\[\<\-V\]\]/g,""):l.replace(/\[\[V\-\>\]\][^]*\[\[\<\-V\]\]/g,""),l="show"==n.hintposition.substr(0,4)?l.replace(/\[\[P\-\>\]\]|\[\[\<\-P\]\]/g,""):l.replace(/\[\[P\-\>\]\][^]*\[\[\<\-P\]\]/g,""),l="show"==n.typehook.substr(0,4)?l.replace(/\[\[H\-\>\]\]|\[\[\<\-H\]\]/g,""):l.replace(/\[\[H\-\>\]\][^]*\[\[\<\-H\]\]/g,""),l="show"==n["default"].substr(0,4)?l.replace(/\[\[D\-\>\]\]|\[\[\<\-D\]\]/g,""):l.replace(/\[\[D\-\>\]\][^]*\[\[\<\-D\]\]/g,""),l="show"==n.data.substr(0,4)?l.replace(/\[\[L\-\>\]\]|\[\[\<\-L\]\]/g,""):l.replace(/\[\[L\-\>\]\][^]*\[\[\<\-L\]\]/g,""),l="show"==n.group.substr(0,4)?l.replace(/\[\[G\-\>\]\]|\[\[\<\-G\]\]/g,""):l.replace(/\[\[G\-\>\]\][^]*\[\[\<\-G\]\]/g,""),l="show"==n.format.substr(0,4)?l.replace(/\[\[F\-\>\]\]|\[\[\<\-F\]\]/g,""):l.replace(/\[\[F\-\>\]\][^]*\[\[\<\-F\]\]/g,"")}function wfu_userdata_remove_field(e){for(var t=e.parentNode,a=t.parentNode,l=null,n=0;n<a.childNodes.length;n++)if(1===a.childNodes[n].nodeType){l=a.childNodes[n];break}if(t!=l){t.parentNode.removeChild(t);for(var n=0;n<l.childNodes.length;n++)if(1===l.childNodes[n].nodeType){wfu_update_userfield_value({target:l.childNodes[n]});break}}}function wfu_formdata_remove_field(e){var t=e.split("_"),a=t[0],l=document.querySelectorAll("div#wfu_attribute_"+a+" .wfu_formdata_line_container");if(!(l.length<2)){var n=document.getElementById("wfu_attribute_"+a),d=document.getElementById("wfu_formfield_"+e+"_container");n.removeChild(d),d=document.querySelector("div#wfu_attribute_"+a+" .wfu_formdata_line_container");for(var u=document.querySelectorAll("div#wfu_attribute_"+a+" .wfu_formdata_action_remove"),o=0;o<u.length;o++)u[o].className="wfu_formdata_action wfu_formdata_action_remove"+(u.length>1?"":" wfu_formdata_action_disabled");wfu_update_formfield_value({target:d})}}function wfu_generate_shortcode(){for(var e,t=document.getElementById("wfu_shortcode_tag").value,a=document.getElementById("wfu_attribute_defaults"),l=(document.getElementById("wfu_attribute_values"),""),n="",d="["+t,u="",o=0;o<a.childNodes.length;o++)e=a.childNodes[o],1===e.nodeType&&(l=e.id.replace("wfu_attribute_default_",""),n=document.getElementById("wfu_attribute_value_"+l).value,e.value!=n&&(u+=" "+l+'="'+n+'"'));d+=u+"]",document.getElementById("wfu_shortcode").value=d,ShortcodeString=u.substr(1),document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=wfu_plugin_encode_string(d)==document.getElementById("wfu_shortcode_original_enc").value),Autosave&&wfu_schedule_save_shortcode()}function wfu_update_text_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_",""),l=t.value;l=l.replace(/(\r\n|\n|\r)/gm,"%n%"),l=l.replace(/\"/gm,"%dq%"),l=l.replace(/\[/gm,"%brl%"),l=l.replace(/\]/gm,"%brr%"),l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_date_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_",""),l=t.value;l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_stringmatch_textvalue(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.replace("_matchfield","").replace("_matchvalue",""),wfu_update_stringmatch_value(a)}function wfu_update_triplecolor_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.replace("_color",""),a=a.replace("_bgcolor",""),a=a.replace("_borcolor",""),t=document.getElementById("wfu_attribute_"+a+"_color");var l=t.value+","+document.getElementById("wfu_attribute_"+a+"_bgcolor").value+","+document.getElementById("wfu_attribute_"+a+"_borcolor").value;l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_dimension_value(e){e=e||window.event;var t=e.target,a=t.name.replace("wfu_dimension_elements_",""),l=document.getElementsByName(t.name);t=l[0];for(var n="",d="",u=0;u<l.length;u++)d=l[u].id.replace("wfu_attribute_"+a+"_",""),""!=n&&""!=l[u].value&&(n+=", "),""!=l[u].value&&(n+=d+":"+l[u].value);n!==t.oldVal&&(t.oldVal=n,document.getElementById("wfu_attribute_value_"+a).value=n,wfu_generate_shortcode())}function wfu_update_ptext_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.substr(2);var l=document.getElementById("wfu_attribute_s_"+a).value,n=document.getElementById("wfu_attribute_p_"+a).value,d=l+"/"+n;d!==t.oldVal&&(t.oldVal=d,document.getElementById("wfu_attribute_value_"+a).value=d),wfu_generate_shortcode()}function wfu_update_mchecklist_value(e){var t="",a=(document.getElementById("wfu_attribute_"+e),document.getElementById("wfu_attribute_"+e+"_all"));a.checked?(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!0),jQuery("#wfu_attribute_"+e+" input").prop("checked",!0),t="all"):(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!1),jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked")&&(t+=","+jQuery(this).next().html())}),t=t.substr(1)),document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_rolelist_value(e){var t="",a=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_attribute_"+e+"_guests"),n=document.getElementById("wfu_attribute_"+e+"_all");if(n.checked)a.disabled=!0,t="all";else{a.disabled=!1;for(var d=a.options,u=0;u<d.length;u++)d[u].selected&&(""!=t&&(t+=","),t+=d[u].value)}l.checked&&(""!=t&&(t+=","),t+="guests"),document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_userlist_value(e){var t="",a=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_attribute_"+e+"_current"),n=document.getElementById("wfu_attribute_"+e+"_guests"),d=document.getElementById("wfu_attribute_"+e+"_all");if(l&&l.checked)a.disabled=!0,d.disabled=!0,n.disabled=!0,t="current";else{if(d.disabled=!1,n.disabled=!1,d.checked)a.disabled=!0,t="all";else{a.disabled=!1;for(var u=a.options,o=0;o<u.length;o++)u[o].selected&&(""!=t&&(t+=","),t+=u[o].value)}n.checked&&(""!=t&&(t+=","),t+="guests")}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_postlist_value(e){for(var t="",a=Array(),l=Array(),n=document.getElementById("wfu_attribute_"+e+"_postlist").value.split(","),d=0;d<n.length;d++)a.push(document.getElementById("wfu_attribute_"+e+"_"+n[d])),l.push(document.getElementById("wfu_attribute_"+e+"_all_"+n[d]));var u=document.getElementById("wfu_attribute_"+e+"_current");if(u&&u.checked){for(var d=0;d<n.length;d++)a[d].disabled=!0,l[d].disabled=!0;t="current"}else{var o=!0;t="";for(var d=0;d<n.length;d++)if(l[d].disabled=!1,l[d].checked)a[d].disabled=!0,""!=t&&(t+=","),t+="all"+n[d];else{a[d].disabled=!1,o=!1;for(var r=a[d].options,_=0;_<r.length;_++)r[_].selected&&(""!=t&&(t+=","),t+=r[_].value)}o&&(t="all")}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_bloglist_value(e){var t="",a=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_attribute_"+e+"_current"),n=document.getElementById("wfu_attribute_"+e+"_all");if(l&&l.checked)a.disabled=!0,n.disabled=!0,t="current";else if(n.disabled=!1,n.checked)a.disabled=!0,t="all";else{a.disabled=!1;for(var d=a.options,u=0;u<d.length;u++)d[u].selected&&(""!=t&&(t+=","),t+=d[u].value)}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_stringmatch_value(e){var t=document.getElementById("wfu_attribute_"+e+"_matchfield").value,a=document.getElementById("wfu_attribute_"+e+"_matchcriterion").value,l=document.getElementById("wfu_attribute_"+e+"_matchvalue").value;t=t.replace(";",""),""==t.trim()?document.getElementById("wfu_attribute_value_"+e).value="":document.getElementById("wfu_attribute_value_"+e).value="field:"+t+";criterion:"+a+";value:"+l,wfu_generate_shortcode()}function wfu_update_userfield_value(e){e=e||window.event;for(var t=e.target,a=t.parentNode,l=a.parentNode,n="",d=!1,u="",o=0;o<l.childNodes.length;o++)if(a=l.childNodes[o],"DIV"===a.tagName){for(var r=0;r<a.childNodes.length;r++)"INPUT"==a.childNodes[r].tagName&&("text"==a.childNodes[r].type?(n=a.childNodes[r].value,0==o&&(t=a.childNodes[r])):"checkbox"==a.childNodes[r].type&&(d=a.childNodes[r].checked));""!=u&&""!=n&&(u+="/"),""!=n&&d&&(u+="*"),""!=n&&(u+=n)}u!==t.oldVal&&(t.oldVal=u,document.getElementById("wfu_attribute_value_userdatalabel").value=u,wfu_generate_shortcode(),wfu_update_formfield_variables())}function wfu_update_formfield_value(e){e=e||window.event;for(var t=e.target,a=t.id.match(/^wfu_formfield_(.*?)_/)[1],l=document.querySelectorAll("div#wfu_attribute_"+a+" .wfu_formdata_line_container"),n="",d=0;d<l.length;d++){var u="",o=l[d].id.match(/^wfu_formfield_.*?_(.*?)_/)[1],r=a+"_"+o,_=document.getElementById("wfu_formfield_"+r+"_label").value;if(""!=_.trim()){u=_.trim();var s=document.getElementById("wfu_formfield_"+r+"_type").value,i=window["wfu_attribute_"+a+"_typeprops"];u+="|t:"+s,u+="|s:"+document.getElementById("wfu_formfield_"+r+"_labelposition").value,"show"==i[s].required.substr(0,4)&&(u+="|r:"+(document.getElementById("wfu_formfield_"+r+"_required").checked?"1":"0")),"show"==i[s].donotautocomplete.substr(0,4)&&(u+="|a:"+(document.getElementById("wfu_formfield_"+r+"_donotautocomplete").checked?"1":"0")),"show"==i[s].validate.substr(0,4)&&(u+="|v:"+(document.getElementById("wfu_formfield_"+r+"_validate").checked?"1":"0")),"show"==i[s].typehook.substr(0,4)&&(u+="|h:"+(document.getElementById("wfu_formfield_"+r+"_typehook").checked?"1":"0")),"show"==i[s].hintposition.substr(0,4)&&(u+="|p:"+document.getElementById("wfu_formfield_"+r+"_hintposition").value),"show"==i[s]["default"].substr(0,4)&&(u+="|d:"+document.getElementById("wfu_formfield_"+r+"_default").value),"show"==i[s].data.substr(0,4)&&(u+="|l:"+document.getElementById("wfu_formfield_"+r+"_data").value),"show"==i[s].group.substr(0,4)&&(u+="|g:"+document.getElementById("wfu_formfield_"+r+"_group").value),"show"==i[s].format.substr(0,4)&&(u+="|f:"+document.getElementById("wfu_formfield_"+r+"_format").value)}""!=u&&(""!=n&&(n+="/"),n+=u)}n!==t.oldVal&&(t.oldVal=n,document.getElementById("wfu_attribute_value_"+a).value=n,wfu_generate_shortcode(),wfu_update_formfield_variables())}function wfu_update_formfield_variables(){var e=document.getElementById("wfu_attribute_value_userdatalabel");if(e){for(var t=document.getElementById("wfu_wrapper"),a=document.getElementsByClassName("wfu_shadow_userdata","div",t),l=document.getElementsByName("wfu_formfield_select"),n=0;n<l.length;n++)l[n].style.display="none";if(0!=a.length&&"block"!=a[0].style.display){for(var d='<option style="display:none;">%userdataXXX%</option>',u=e.value.replace(/\//g,"[/]").replace(/\(.*\)/,function(e){return e.replace(/\[\/\]/g,"/")}).split("[/]"),o=2;document.getElementById("wfu_attribute_userdatalabel"+o);){var r=document.getElementById("wfu_attribute_value_userdatalabel"+o).value.replace(/\//g,"[/]").replace(/\(.*\)/,function(e){return e.replace(/\[\/\]/g,"/")}).split("[/]");u=u.concat(r),o++}var _="",s=0;o=1;for(var n=0;n<u.length;n++)_=u[n],"*"==_[0]&&(_=_.substr(1)),s=_.indexOf("|"),s>-1&&(_=_.substr(0,s)),""!=_.trim()&&(d+='<option value="%userdata'+o+'%">'+o+": "+_.trim()+"</option>",o++);for(var n=0;n<l.length;n++)l[n].innerHTML=d,l[n].style.display="inline-block"}}}function wfu_attach_element_handlers(e,t){for(var a=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],l=0;l<a.length;l++)wfu_addEventHandler(e,a[l],t)}function wfu_Attach_Admin_Events(e){Autosave=e,wfu_generate_shortcode(),wfu_update_formfield_variables(),wfu_Attach_Admin_DragDrop_Events();for(var t=document.getElementsByName("wfu_text_elements"),a=0;a<t.length;a++)wfu_attach_element_handlers(t[a],wfu_update_text_value);for(var l=document.getElementsByName("wfu_ptext_elements"),a=0;a<l.length;a++)wfu_attach_element_handlers(l[a],wfu_update_ptext_value);for(var n=document.getElementsByName("wfu_stringmatch_elements"),a=0;a<n.length;a++)wfu_attach_element_handlers(n[a],wfu_update_stringmatch_textvalue);for(var d=document.getElementsByName("wfu_triplecolor_elements"),a=0;a<d.length;a++)wfu_attach_element_handlers(d[a],wfu_update_triplecolor_value);for(var u=document.getElementsByName("wfu_dimension_elements_widths"),a=0;a<u.length;a++)wfu_attach_element_handlers(u[a],wfu_update_dimension_value);u=document.getElementsByName("wfu_dimension_elements_heights");for(var a=0;a<u.length;a++)wfu_attach_element_handlers(u[a],wfu_update_dimension_value);for(var o=document.getElementsByName("wfu_userfield_elements"),a=0;a<o.length;a++)wfu_attach_element_handlers(o[a],wfu_update_userfield_value);for(var r=document.getElementsByName("wfu_formfield_elements"),a=0;a<r.length;a++)wfu_attach_element_handlers(r[a],wfu_update_formfield_value);for(var _=document.getElementsByName("wfu_subfolder_tools_input"),a=0;a<_.length;a++)wfu_attach_element_handlers(_[a],wfu_subfolders_input_changed);for(var s=document.getElementsByName("wfu_columnprops_elements"),a=0;a<s.length;a++)wfu_attach_element_handlers(s[a],wfu_columnprops_element_changed);""!=document.getElementById("wfu_shortcode_postid").value&&setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut)}function wfu_insert_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),a=document.getElementById("wfu_attribute_"+t),l=a.selectionStart,n=a.value;a.value=n.substr(0,l)+e.innerHTML+n.substr(l),wfu_update_text_value({target:a})}function wfu_insert_userfield_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),a=document.getElementById("wfu_attribute_"+t),l=a.selectionStart,n=a.value;a.value=n.substr(0,l)+e.value+n.substr(l),e.value="%userdataXXX%",wfu_update_text_value({target:a})}function wfu_columns_itemclicked(e,t){var a=e.parentNode;if("SELECT"==a.tagName){for(var l=0;l<a.options.length;l++)a.options[l].selected=a.options[l]==e;wfu_update_column_props(t)}}function wfu_columns_buttonaction(e,t){var a=document.getElementById("wfu_attribute_"+e+"_sourcelist"),l=document.getElementById("wfu_attribute_"+e);if("add"==t){for(var n=0;n<a.options.length;n++)if(a.options[n].selected||"wfu_columns_item_required"==a.options[n].className){for(var d=!1,u=a.options[n].value.replace(/:.*/,""),o=0;o<l.options.length;o++){var r=l.options[o].value.replace(/:.*/,"");if(r==u){d=!0;break}}if(!d){var _=a.options[n].value.match(/(.*?):(.*?)\/(.*)/),s=_[1],i="custom"==s?"+-"+(""==_[2]?"s":_[2]):""!=_[2]?"-+"+_[2]:"",c=_[3];"custom"==s&&(s="custom1");var f=document.createElement("OPTION");f.value=s+":"+i+"/"+a.options[n].innerHTML+"/"+c,f.innerHTML=a.options[n].innerHTML+(""!=c&&c!=a.options[n].innerHTML?" ("+c+")":""),f.className=a.options[n].className,f.onclick=a.options[n].onclick,l.appendChild(f),l.selectedIndex=l.options.length-1}}}else if("del"==t)for(var n=0;n<l.options.length;)l.options[n].selected&&"wfu_columns_item_required"!=l.options[n].className?l.options.remove(n):n++;else if("up"==t||"down"==t){for(var m=-1,n=0;n<l.options.length;n++)l.options[n].selected&&-1==m?m=n:l.options[n].selected&&m>-1&&(l.options[n].selected=!1);"up"==t&&m>0?l.insertBefore(l.options[m],l.options[m-1]):"down"==t&&m<l.options.length-1&&l.insertBefore(l.options[m+1],l.options[m])}wfu_update_column_props(e),wfu_update_columns(e)}function wfu_update_column_props(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_attribute_"+e+"_columnprops_container"),l=document.getElementById("wfu_attribute_"+e+"_columnprops_title"),n=(document.getElementById("wfu_attribute_"+e+"_columnprops_title_label"),document.getElementById("wfu_attribute_"+e+"_columnprops_id")),d=document.getElementById("wfu_attribute_"+e+"_columnprops_id_label"),u=document.getElementById("wfu_attribute_"+e+"_columnprops_sort"),o=document.getElementById("wfu_attribute_"+e+"_columnprops_sort_label"),r=document.getElementById("wfu_attribute_"+e+"_columnprops_sorttype"),_=document.getElementById("wfu_attribute_"+e+"_columnprops_sorttype_label"),s=t.selectedIndex;if(""==r.options[0].value&&r.options.remove(0),-1==s)a.className="wfu_columnprops_container wfu_columnprops_container_disabled",l.value="",l.disabled=!0,n.value="",n.disabled=!0,u.checked=!1,u.disabled=!0,r.selectedIndex=-1,r.disabled=!0;else{var i=t.options[s].value.match(/(.*?):(.*?)\/(.*?)\/(.*)/),c=i[1],f="custom"==c.substr(0,6),m=f?c.substr(6):"",p=""!=i[2],w=p&&"+"==i[2].substr(1,1),g=w&&"+"==i[2].substr(0,1),v=w?i[2].substr(2):"",b=i[4];a.className="wfu_columnprops_container",l.value=b,l.disabled=!1,d.className=f?"":"wfu_columnprops_label_disabled",n.value=m,n.disabled=!f,o.className=p?"":"wfu_columnprops_label_disabled",u.checked=w,u.disabled=!p,_.className=g?"":"wfu_columnprops_label_disabled",r.value=v,r.disabled=!g}}function wfu_columnprops_element_changed(e){e=e||window.event;var t=e.target,a=t.id.match(/^wfu_attribute_(.*?)_columnprops_/)[1],l=document.getElementById("wfu_attribute_"+a),n=document.getElementById("wfu_attribute_"+a+"_columnprops_title"),d=document.getElementById("wfu_attribute_"+a+"_columnprops_id"),u=document.getElementById("wfu_attribute_"+a+"_columnprops_sort"),o=document.getElementById("wfu_attribute_"+a+"_columnprops_sorttype"),r=l.selectedIndex;if(-1!=r){var _=l.options[r].value.match(/(.*?):(.*?)\/(.*?)\/(.*)/),s=_[1],i="custom"==s.substr(0,6)?"custom":s,c="custom"==i,f=c?parseInt(d.value)>=1?d.value:"1":"",m=""!=_[2]?_[2].substr(0,1)+(u.checked?"+":"-")+(""!=o.value?o.value:""!=_[2].substr(2)?_[2].substr(2):"s"):"",p=_[3],w=""!=n.value?n.value:p;l.options[r].value=i+f+":"+m+"/"+p+"/"+w,l.options[r].innerHTML=p+(w!=p?" ("+w+")":""),wfu_update_column_props(a),wfu_update_columns(a)}}function wfu_update_columns(e){for(var t=document.getElementById("wfu_attribute_"+e),a="",l=0;l<t.options.length;l++){var n=t.options[l].value.match(/(.*?):(.*?)\/(.*?)\/(.*)/),d=n[1]+":"+("+"==n[2].substr(1,1)?n[2].substr(2):"")+"/"+n[4];""!=a&&(a+=","),a+=d}document.getElementById("wfu_attribute_value_"+e).value=a,wfu_generate_shortcode()}function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(t){}return e}function wfu_plugin_encode_string(e){var t,a=0,l="",n="";for(a=0;a<e.length;a++)t=e.charCodeAt(a),t>=2048?t=((16773120&t|917504)<<4)+((4032&t|8192)<<2)+(63&t|128):t>=128&&(t=((65472&t|12288)<<2)+(63&t|128)),n=t.toString(16),(1==n.length||3==n.length||5==n.length)&&(n="0"+n),l+=n;return l}function wfu_plugin_decode_string(e){for(var t,a,l=0,n="";l<e.length;)t=parseInt(e.substr(l,2),16),a=128>t?t:224>t?((31&t)<<6)+(63&parseInt(e.substr(l+=2,2),16)):((15&t)<<12)+((63&parseInt(e.substr(l+=2,2),16))<<6)+(63&parseInt(e.substr(l+=2,2),16)),n+=String.fromCharCode(a),l+=2;return n}function wfu_randomString(e){for(var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",a=e,l="",n=0;a>n;n++){var d=Math.floor(Math.random()*t.length);l+=t.substring(d,d+1)}return l}function wfu_schedule_save_shortcode(){var e=new Date,t=ShortcodeNextSave-e.getTime();null!=ShortcodeTimeOut&&(clearTimeout(ShortcodeTimeOut),ShortcodeTimeOut=null),0>=t?wfu_save_shortcode():ShortcodeTimeOut=setTimeout(function(){wfu_save_shortcode()},t)}function wfu_check_page_obsolescence(){PageObsolete||PageUpdating||""==document.getElementById("wfu_shortcode_postid").value}function wfu_save_shortcode(){if(!PageObsolete){var e=wfu_GetHttpRequestObject();if(null!=e){PageUpdating=!0,document.getElementById("wfu_update_failed_message").style.display="none";var t=AdminParams.wfu_ajax_url;params=new Array(8),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_save_shortcode",params[1]=new Array(2),params[1][0]="shortcode",params[1][1]=wfu_plugin_encode_string(ShortcodeString),params[2]=new Array(2),params[2][0]="shortcode_original",params[2][1]=document.getElementById("wfu_shortcode_original_enc").value,params[3]=new Array(2),params[3][0]="post_id",params[3][1]=document.getElementById("wfu_shortcode_postid").value,params[4]=new Array(2),params[4][0]="post_hash",params[4][1]=document.getElementById("wfu_shortcode_posthash").value,params[5]=new Array(2),params[5][0]="shortcode_position",params[5][1]=document.getElementById("wfu_shortcode_position").value,params[6]=new Array(2),params[6][0]="shortcode_tag",params[6][1]=document.getElementById("wfu_shortcode_tag").value,params[7]=new Array(2),params[7][0]="widget_id",params[7][1]=document.getElementById("wfu_shortcode_widgetid").value;for(var a="",l=0;l<params.length;l++)a+=(l>0?"&":"")+params[l][0]+"="+encodeURI(params[l][1]);var n=new Date;Autosave?ShortcodeNextSave=n.getTime()+5e3:document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="inline"),e.open("POST",t,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.onreadystatechange=function(){if(4==e.readyState&&200==e.status){PageUpdating=!1;var t="wfu_save_shortcode:",a=e.responseText.indexOf(t);-1==a&&(a=e.responseText.length);var l=(e.responseText.substr(0,a),e.responseText.substr(a+t.length,e.responseText.length-a-t.length));a=l.indexOf(":");var d=l.substr(0,a);if(txt_value=l.substr(a+1,l.length-a-1),"success"==d){if(Autosave?(document.getElementById("wfu_save_label").innerHTML="saved",document.getElementById("wfu_save_label").className="wfu_save_label",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300),ShortcodeNextSave=n.getTime()+1e3,null!=ShortcodeTimeOut&&wfu_schedule_save_shortcode()):document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="none",document.getElementById("wfu_update_shortcode").disabled=!0,window.plugin_window&&window.plugin_window.location.reload(!0)),""!=document.getElementById("wfu_shortcode_postid").value){var u=document.getElementById("wfu_shortcode_tag").value;document.getElementById("wfu_shortcode_original_enc").value=wfu_plugin_encode_string("["+u+" "+ShortcodeString+"]"),document.getElementById("wfu_shortcode_posthash").value=txt_value,setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut)}}else Autosave&&(document.getElementById("wfu_save_label").innerHTML="not saved",document.getElementById("wfu_save_label").className="wfu_save_label_fail",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300)),"fail"==d&&("post_modified"==txt_value?(PageObsolete=!0,document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=!0),document.getElementById("wfu_update_rejected_message").style.display="block"):document.getElementById("wfu_update_failed_message").style.display="block")}},e.send(a)}}}function wfu_adjust_opacity(e){document.getElementById("wfu_save_label").style.opacity=e}function wfu_fadeout_element(e){for(var t=20,a=0,l=0;t>l;l++)a=1-l/t,setTimeout('wfu_adjust_opacity("'+a.toString()+'")',l*e/t);setTimeout('wfu_adjust_opacity("0.0")',l*e/t)}function wfu_apply_value(e,t,a){if("onoff"==t)document.getElementById("wfu_attribute_"+e).className="wfu_onoff_container_"+("true"!=a?"on":"off"),wfu_admin_onoff_clicked(e);else if("text"==t||"ltext"==t||"integer"==t||"float"==t||"mtext"==t||"color"==t){var l=document.getElementById("wfu_attribute_"+e);if(a=a.replace(/\%n\%/gm,"\n"),a=a.replace(/\%dq\%/gm,'"'),a=a.replace(/\%brl\%/gm,"["),a=a.replace(/\%brr\%/gm,"]"),"color"==t){var n=colourNameToHex(a);n||(n=a),jQuery("#wfu_attribute_"+e).wpColorPicker("color",n)}l.value=a,wfu_update_text_value({target:l})}else if("date"==t){var l=document.getElementById("wfu_attribute_"+e);l.value=a,wfu_update_date_value({target:l})}else if("placements"==t)wfu_admin_recreate_placements_panel(a),document.getElementById("wfu_attribute_value_placements").value=a,wfu_generate_shortcode();else if("radio"==t){for(var d=document.getElementsByName("wfu_radioattribute_"+e),u=0;u<d.length;u++)d[u].checked=d[u].value==a||"*"+d[u].value==a;wfu_admin_radio_clicked(e)}else if("ptext"==t){a=a.replace(/\%n\%/gm,"\n"),a=a.replace(/\%dq\%/gm,'"'),a=a.replace(/\%brl\%/gm,"["),a=a.replace(/\%brr\%/gm,"]");var o=a.split("/"),r=o.length<1?"":o[0],_=o.length<2?r:o[1],s=document.getElementById("wfu_attribute_s_"+e);s.value=r;var i=document.getElementById("wfu_attribute_p_"+e);i.value=_,wfu_update_ptext_value({target:s}),wfu_update_ptext_value({target:i})}else if("mchecklist"==t){if(a=a.toLowerCase(),"all"==a)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var c=a.split(","),u=0;u<c.length;u++)c[u]=c[u].trim();jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked",c.indexOf(jQuery(this).next().html())>-1)})}wfu_update_mchecklist_value(e)}else if("rolelist"==t){var l=document.getElementById("wfu_attribute_"+e),f=document.getElementById("wfu_attribute_"+e+"_all"),m=f.className.indexOf("wfu_default_administrator")>-1,p=a.split(",");if(p.indexOf("all")>-1){f.checked=!0;for(var u=0;u<l.options.length;u++)l.options[u].selected=m&&"administrator"==l.options[u].value}else{f.checked=!1;for(var u=0;u<p.length;u++)p[u]=p[u].trim();for(var u=0;u<l.options.length;u++)l.options[u].selected=p.indexOf(l.options[u].value)>-1}document.getElementById("wfu_attribute_"+e+"_guests").checked=p.indexOf("guests")>-1,wfu_update_rolelist_value(e)}else if("userlist"==t){var l=document.getElementById("wfu_attribute_"+e),f=document.getElementById("wfu_attribute_"+e+"_all"),w=f.className.indexOf("wfu_default_0")>-1,g=document.getElementById("wfu_attribute_"+e+"_current");if(g&&"current"==a){g.checked=!0,f.checked=!1,document.getElementById("wfu_attribute_"+e+"_guests").checked=!1;for(var u=0;u<l.options.length;u++)l.options[u].selected=w&&1>u}else{g&&(g.checked=!1);var v=a.split(",");if(v.indexOf("all")>-1){f.checked=!0;for(var u=0;u<l.options.length;u++)l.options[u].selected=w&&1>u}else{f.checked=!1;for(var u=0;u<v.length;u++)v[u]=v[u].trim();for(var u=0;u<l.options.length;u++)l.options[u].selected=v.indexOf(l.options[u].value)>-1}document.getElementById("wfu_attribute_"+e+"_guests").checked=v.indexOf("guests")>-1}wfu_update_userlist_value(e)}else if("postlist"==t){for(var b=Array(),f=Array(),h=document.getElementById("wfu_attribute_"+e+"_postlist").value.split(","),u=0;u<h.length;u++)b.push(document.getElementById("wfu_attribute_"+e+"_"+h[u])),f.push(document.getElementById("wfu_attribute_"+e+"_all_"+h[u]));var g=document.getElementById("wfu_attribute_"+e+"_current");if(g&&"current"==a){g.checked=!0;for(var u=0;u<h.length;u++){f[u].checked=!1;for(var y=0;y<b[u].options.length;y++)b[u].options[y].selected=!1}}else{g&&(g.checked=!1);for(var I=a.split(","),u=0;u<h.length;u++){("all"==a||I.indexOf("all"+h[u])>-1)&&(f[u].checked=!0);for(var y=0;y<b[u].options.length;y++)b[u].options[y].selected=I.indexOf(b[u].options[y].value)>-1}}wfu_update_postlist_value(e)}else if("bloglist"==t){var g=document.getElementById("wfu_attribute_"+e+"_current");if(g&&"current"==a){g.checked=!0,document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var l=document.getElementById("wfu_attribute_"+e),u=0;u<l.options.length;u++)l.options[u].selected=!1}else{g&&(g.checked=!1);var E=a.split(",");if("all"==a)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var u=0;u<E.length;u++)E[u]=E[u].trim();for(var l=document.getElementById("wfu_attribute_"+e),u=0;u<l.options.length;u++)l.options[u].selected=E.indexOf(l.options[u].value)>-1}}wfu_update_bloglist_value(e)}else if("stringmatch"==t){var B="",k="equal to",x="",N=a.match(/^field:(.*?);\s*criterion:(.*?)\s*;\s*value:(.*)$/);N&&4==N.length&&(B=N[1],k=N[2],x=N[3]),document.getElementById("wfu_attribute_"+e+"_matchfield").value=B,document.getElementById("wfu_attribute_"+e+"_matchcriterion").value=k,document.getElementById("wfu_attribute_"+e+"_matchvalue").value=x,wfu_update_stringmatch_value(e)}else if("columns"==t){var T=document.getElementById("wfu_attribute_"+e+"_sourcelist"),A=document.getElementById("wfu_attribute_"+e);A.innerHTML="";for(var H=a.replace(/(:|\/).*?(,|$)/g,"$2").split(","),u=0;u<T.options.length;u++){var o=T.options[u].value.match(/(.*?):(.*?)\/(.*)/),S=o[1];if("wfu_columns_item_required"==T.options[u].className&&-1==H.indexOf(S)){var q="custom"==S?"+-"+(""==o[2]?"s":o[2]):""!=o[2]?"-+"+o[2]:"",O=o[3];"custom"==S&&(S="custom1");var L=document.createElement("OPTION");L.value=S+":"+q+"/"+T.options[u].innerHTML+"/"+O,L.innerHTML=T.options[u].innerHTML+(""!=O&&O!=T.options[u].innerHTML?" ("+O+")":""),L.className=T.options[u].className,L.onclick=T.options[u].onclick,A.appendChild(L)}}for(var C=a.split(","),u=0;u<C.length;u++){var M=C[u].split("/",2),S=M[0],j="";M.length>1&&(j=M[1]),M=S.split(":",2),S=M[0];for(var D=S.replace(/custom[0-9]+$/,"custom"),V=-1,y=0;y<T.options.length;y++){var P=T.options[y].value.replace(/:.*/,"");if(P==D){V=y;break}}for(var R=!1,y=0;y<A.options.length;y++){var F=A.options[y].value.replace(/:.*/,"");if(F==S){R=!0;break}}if("custom"!=S&&V>-1&&!R){var o=T.options[V].value.match(/(.*?):(.*?)\/(.*)/),U="custom"==D||""!=o[2],q=o[2],Q=T.options[V].innerHTML,O=o[3],G="";G=1==M.length?"custom"==D?"+-s":U?"-+"+q:"":"custom"==D?"+"+(""==M[1]?"-s":"+"+M[1]):U?"-"+(""==M[1]?"-":"+")+q:"",
3
+ ""==j&&(j=O);var L=document.createElement("OPTION");L.value=S+":"+G+"/"+Q+"/"+j,L.innerHTML=Q+(O!=Q?" ("+O+")":""),L.className=T.options[V].className,L.onclick=T.options[u].onclick,A.appendChild(L)}}wfu_update_column_props(e),wfu_update_columns(e)}else if("dimensions"==t){for(var X,W,$,l,z=a.split(","),J=document.getElementsByName("wfu_dimension_elements_"+e),u=0;u<J.length;u++)J[u].value="";for(var u=0;u<z.length;u++)X=z[u].split(":",2),W=X.length<1?"":X[0],$=X.length<2?W:X[1],l=document.getElementById("wfu_attribute_"+e+"_"+W.trim()),l&&(l.value=$.trim());l=J[0],wfu_update_dimension_value({target:l})}else if("userfields"==t){for(var K,Z=a.replace(/\//g,"[/]").replace(/\(.*\)/,function(e){return e.replace(/\[\/\]/g,"/")}).split("[/]"),Y=Array(),u=0;u<Z.length;u++)K="*"==Z[u].substr(0,1),K&&(Z[u]=Z[u].substr(1)),""!=Z[u]&&Y.push({name:Z[u],required:K});for(var ee=document.getElementById("wfu_attribute_"+e),te=null,ae=Array(),u=0;u<ee.childNodes.length;u++)1===ee.childNodes[u].nodeType&&(null==te?te=ee.childNodes[u]:ae.push(ee.childNodes[u]));for(var u=0;u<ae.length;u++)ee.removeChild(ae[u]);wfu_userdata_edit_field(te,"",!1);for(var le,ne=te,u=0;u<Y.length;u++)0==u?wfu_userdata_edit_field(te,Y[u].name,Y[u].required):(le=ne.cloneNode(!0),wfu_userdata_edit_field(le,Y[u].name,Y[u].required),ee.insertBefore(le,ne.nextSibling),ne=le);for(var l,u=0;u<te.childNodes.length&&(l=te.childNodes[u],"INPUT"!=l.tagName);u++);wfu_update_userfield_value({target:l})}else if("formfields"==t){for(var Y=Array(),de=window["wfu_attribute_"+e+"_typeprops"],ue=de[0].split(","),oe={},u=0;u<ue.length;u++){var re=de[ue[u]],_e={};_e.type=ue[u],_e.label="",_e.labelposition=re.labelposition.substr(5),_e.required="true"==re.required.substr(5),_e.donotautocomplete="true"==re.donotautocomplete.substr(5),_e.validate="true"==re.validate.substr(5),_e.typehook="true"==re.typehook.substr(5),_e.hintposition=re.hintposition.substr(5),_e["default"]=re["default"].substr(5),_e.data=re.data.substr(5),_e.group=re.group.substr(5),_e.format=re.format.substr(5),oe[ue[u]]=_e}for(var Z=a.replace(/\//g,"[/]").replace(/\(.*\)/,function(e){return e.replace(/\[\/\]/g,"/")}).split("[/]"),u=0;u<Z.length;u++){var se=Z[u].trim(),ie={};for(prop in oe.text)ie[prop]=oe.text[prop];"*"==se.substr(0,1)&&(ie.required=!0,se=se.substr(1));var ce=se.split("|");if(""!=ce[0].trim()){for(var fe=-1,me="",y=0;y<ce.length;y++){var pe=ce[y].replace(/^\s+/gm,""),we=pe.substr(0,2),$=pe.substr(2);if("t:"==we&&y>0&&ue.indexOf($)>-1){me=$,fe=y;break}}if(""!=me){for(prop in oe[me])ie[prop]=oe[me][prop];ce.splice(fe,1)}ie.label=ce[0].trim(),ce.splice(0,1);for(var y=0;y<ce.length;y++){var pe=ce[y].replace(/^\s+/gm,""),we=pe.substr(0,2),$=pe.substr(2);"s:"==we?ie.labelposition=$:"r:"==we?ie.required="1"==$:"a:"==we?ie.donotautocomplete="1"==$:"v:"==we?ie.validate="1"==$:"d:"==we?ie["default"]=$:"l:"==we?ie.data=$:"g:"==we?ie.group=$:"f:"==we?ie.format=$:"p:"==we?ie.hintposition=$:"h:"==we&&(ie.typehook="1"==$)}Y.push(ie)}}0==Y.length&&Y.push(fieldprops_default);for(var ee=document.getElementById("wfu_attribute_"+e),ge=document.querySelectorAll("div#wfu_attribute_"+e+" .wfu_formdata_line_container"),u=1;u<ge.length;u++)ee.removeChild(ge[u]);for(var ve=ge[0],u=0;u<Y.length;u++){var be=e+"_"+wfu_randomString(4),he=wfu_formdata_prepare_template(e,Y[u],be);u>0&&(ve=document.createElement("DIV")),ve.id="wfu_formfield_"+be+"_container",ve.className="wfu_formdata_line_container",u>0&&ee.insertBefore(ve,null),ve.innerHTML=he}for(var ye=document.querySelectorAll("div#wfu_attribute_"+e+' input[name="wfu_formfield_elements"]'),u=0;u<ye.length;u++)wfu_attach_element_handlers(ye[u],wfu_update_formfield_value);for(var Ie=document.querySelectorAll("div#wfu_attribute_"+e+" .wfu_formdata_action_remove"),u=0;u<Ie.length;u++)Ie[u].className="wfu_formdata_action wfu_formdata_action_remove"+(Ie.length>1?"":" wfu_formdata_action_disabled");wfu_update_formfield_value({target:ge[0]})}else if("color-triplet"==t){for(var Ee=a.split(","),u=0;u<Ee.length;u++)Ee[u]=Ee[u].trim();2==Ee.length?Ee=[Ee[0],Ee[1],"#000000"]:1==Ee.length?Ee=[Ee[0],"#FFFFFF","#000000"]:Ee.length<3&&(Ee=["#000000","#FFFFFF","#000000"]);var n=colourNameToHex(Ee[0]);n||(n=Ee[0]),jQuery("#wfu_attribute_"+e+"_color").wpColorPicker("color",n);var l=document.getElementById("wfu_attribute_"+e+"_color");l.value=Ee[0],n=colourNameToHex(Ee[1]),n||(n=Ee[1]),jQuery("#wfu_attribute_"+e+"_bgcolor").wpColorPicker("color",n),document.getElementById("wfu_attribute_"+e+"_bgcolor").value=Ee[1],n=colourNameToHex(Ee[2]),n||(n=Ee[2]),jQuery("#wfu_attribute_"+e+"_borcolor").wpColorPicker("color",n),document.getElementById("wfu_attribute_"+e+"_borcolor").value=Ee[2],wfu_update_triplecolor_value({target:l})}else if("folderlist"==t){for(var c=wfu_parse_folderlist_js(a),Be=document.getElementById("wfu_attribute_"+e).options;Be.length>0;)Be.remove(0);for(var L,ke,xe,Ne,Te,Ae,u=0;u<c.path.length;u++){ke=c.path[u],"/"==ke.substr(ke.length,1)&&(ke=ke.substr(0,ke.length-1)),xe=ke.split("/"),ke=xe[xe.length-1],Te=parseInt(c.level[u]),Ne="",Ae="";for(var y=0;Te>y;y++)Ne+="&nbsp;&nbsp;&nbsp;",Ae+="*";Ne+=c.label[u],c["default"][u]&&(Ae+="&"),Ae+=""==ke?"{root}/"+c.label[u]:ke+c.label[u],L=document.createElement("option"),c["default"][u]?L.className="wfu_select_folders_option_default":L.className="",L.value=wfu_plugin_encode_string(Ae),L.innerHTML=Ne,Be.add(L)}L=document.createElement("option"),L.value="",L.innerHTML="",Be.add(L);var He=document.getElementById("wfu_attribute_"+e);He.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),l=He,a!==l.oldVal&&(l.oldVal=a,document.getElementById("wfu_attribute_value_"+e).value=a,wfu_generate_shortcode())}}function wfu_parse_folderlist_js(e){var t=Object();if(t.path=Array(),t.label=Array(),t.level=Array(),t["default"]=Array(),"auto"==e.substr(0,4))return t;var a=e.split(",");if(0==a.length)return t;if(1==a.length&&""==a[0].trim())return t;for(var l,n,d,u,o,r,_,s=["root"],i=0,c=0,f=-1,m=0;m<a.length;m++){for(l=a[m].trim(),n=0,d="",u=!1;n<l.length&&"*"==l.substr(n,1);)n++,d+="&nbsp;&nbsp;&nbsp;";if(1>=n-i&&(n>0||0==c)&&(l=l.substr(n,l.length-n),"&"==l.substr(0,1)&&(l=l.substr(1),u=!0),subfolder_items=l.split("/"),subfolder_items.length<2&&subfolder_items.push(""),""!=subfolder_items[1]?(o=subfolder_items[0],r=subfolder_items[1]):(o=l,r=l),""!=o)){u&&-1==f?f=t.path.length:u=!1,0==n&&(c=1),s.length>n?s[n]=o:s.push(o),_="";for(var p=1;n>=p;p++)_+=s[p]+"/";t.path.push(_),t.label.push(r),t.level.push(n),t["default"].push(u),i=n}}return t}function colourNameToHex(e){var t={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c","indigo ":"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return"undefined"!=typeof t[e.toLowerCase()]?t[e.toLowerCase()]:!1}function wfu_download_file(e,t,a){var l=wfu_GetHttpRequestObject();if(null!=l){var n=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_invoker",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="nonce",params[2][1]=a;for(var d="",u=0;u<params.length;u++)d+=(u>0?"&":"")+params[u][0]+"="+encodeURI(params[u][1]);l.open("POST",n,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(){if(4==l.readyState&&200==l.status){var a="wfu_ajax_action_download_file_invoker:",n=l.responseText.indexOf(a);-1==n&&(n=l.responseText.length);var d=(l.responseText.substr(0,n),l.responseText.substr(n+a.length,l.responseText.length-n-a.length));n=d.indexOf(":");var u=d.substr(0,n);if(txt_value=d.substr(n+1,d.length-n-1),"wfu_download_id;"==u.substr(0,16)){var o=u.substr(16),r=document.getElementById("wfu_file_download_container_"+t);r.innerHTML=txt_value,setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+o+"')",100)}}},l.send(d)}}function wfu_download_file_monitor(e,t,a){var l=wfu_GetHttpRequestObject();if(null!=l){var n=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_monitor",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="id",params[2][1]=a;for(var d="",u=0;u<params.length;u++)d+=(u>0?"&":"")+params[u][0]+"="+encodeURI(params[u][1]);l.open("POST",n,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(){if(4==l.readyState&&200==l.status){var a="wfu_ajax_action_download_file_monitor:",n=l.responseText.indexOf(a);-1==n&&(n=l.responseText.length);var d=(l.responseText.substr(0,n),l.responseText.substr(n+a.length,l.responseText.length-n-a.length));n=d.indexOf(":");var u=d.substr(0,n);if(txt_value=d.substr(n+1,d.length-n-1),"repeat"!=u){var o=document.getElementById("wfu_file_download_container_"+t);o.innerHTML=""}else"repeat"==u&&setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+txt_value+"')",100)}},l.send(d)}}function wfu_filedetails_userdata_changed(e){for(var t,a,l=document.getElementsByName("wfu_filedetails_userdata"),n=!1,d=0;d<l.length;d++)if(t=document.getElementById(l[d].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_default_")),a=document.getElementById(l[d].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_")),a.value=l[d].value,l[d].value!=t.value){n=!0;break}document.getElementById("dp_filedetails_submit_fields").disabled=!n}function wfu_Attach_FileDetails_Admin_Events(){for(var e=document.getElementsByName("wfu_filedetails_userdata"),t=0;t<e.length;t++)wfu_attach_element_handlers(e[t],wfu_filedetails_userdata_changed)}function wfu_update_browserpermission_option(e,t,a){var l=document.getElementById("wfu_fbperm_users"),n=document.getElementById("wfu_fbperm_roles"),d=document.getElementById("wfu_fbperm_"+e+"_"+t+"_view"),u=document.getElementById("wfu_fbperm_"+e+"_"+t+"_dl"),o=document.getElementById("wfu_fbperm_"+e+"_"+t+"_edit"),r=document.getElementById("wfu_fbperm_"+e+"_"+t+"_del");if("role"==e){if("0"==t){u.checked=d.checked&&u.checked,o.checked=d.checked&&o.checked,r.checked=d.checked&&r.checked,u.disabled=!d.checked,o.disabled=!d.checked,r.disabled=!d.checked;for(var _=document.querySelectorAll("tr.wfu_fbperm_role_tr"),s=0;s<_.length;s++){var i=_[s].id.substr(16,_[s].id.length-20);wfu_update_browserpermission_option("role",i,!1)}if(a){var c=(d.checked?"v":"")+(u.checked?"d":"")+(o.checked?"e":"")+(r.checked?"l":"");n.value=n.value.replace(/^0\[\w*\]/,"0["+c+"]")}}else if("administrator"!=t){var f=document.getElementById("wfu_fbperm_role_"+t+"_row"),m=document.getElementById("wfu_fbperm_role_"+t+"_def"),p=document.getElementById("wfu_fbperm_role_0_view"),w=document.getElementById("wfu_fbperm_role_0_dl"),g=document.getElementById("wfu_fbperm_role_0_edit"),v=document.getElementById("wfu_fbperm_role_0_del");if(d.checked=m.checked?p.checked:d.checked,f.style.fontWeight=m.checked?"":"bold",u.checked=m.checked?w.checked:d.checked&&u.checked,o.checked=m.checked?g.checked:d.checked&&o.checked,r.checked=m.checked?v.checked:d.checked&&r.checked,d.disabled=m.checked,u.disabled=m.checked||!d.checked,o.disabled=m.checked||!d.checked,r.disabled=m.checked||!d.checked,a){var c=m.checked?"":"D"+(d.checked?"v":"")+(u.checked?"d":"")+(o.checked?"e":"")+(r.checked?"l":"");n.value=n.value.replace(new RegExp(","+t+"\\[\\w*\\]"),","+t+"["+c+"]")}}for(var b=document.querySelectorAll("tr.wfu_fbperm_user_tr"),s=0;s<b.length;s++){var h=b[s].id.substr(16,b[s].id.length-20);wfu_update_browserpermission_option("user",h,!1)}}else if("user"==e){var y=document.getElementById("wfu_fbperm_user_"+t+"_role");if("0"==t){d.checked=y.checked?!1:d.checked,u.checked=y.checked?!1:d.checked&&u.checked,o.checked=y.checked?!1:d.checked&&o.checked,r.checked=y.checked?!1:d.checked&&r.checked,d.disabled=y.checked,u.disabled=y.checked||!d.checked,o.disabled=y.checked||!d.checked,r.disabled=y.checked||!d.checked,d.indeterminate=y.checked,u.indeterminate=y.checked,o.indeterminate=y.checked,r.indeterminate=y.checked;for(var b=document.querySelectorAll("tr.wfu_fbperm_user_tr"),s=0;s<b.length;s++){var h=b[s].id.substr(16,b[s].id.length-20);wfu_update_browserpermission_option("user",h,!1)}if(a){var c=y.checked?"":"R"+(d.checked?"v":"")+(u.checked?"d":"")+(o.checked?"e":"")+(r.checked?"l":"");l.value=l.value.replace(/^0\[\w*\],?/,""),l.value="0["+c+"]"+(""==l.value?"":","+l.value)}}else{var I=document.getElementById("wfu_fbperm_user_"+t+"_roles").value.split(",");if(1==I.length&&""==I[0]&&(I=Array()),I.indexOf("administrator")<0){var f=document.getElementById("wfu_fbperm_user_"+t+"_row"),m=document.getElementById("wfu_fbperm_user_"+t+"_def"),E=document.getElementById("wfu_fbperm_user_0_role"),p=document.getElementById("wfu_fbperm_user_0_view"),w=document.getElementById("wfu_fbperm_user_0_dl"),g=document.getElementById("wfu_fbperm_user_0_edit"),v=document.getElementById("wfu_fbperm_user_0_del");if(I.length>0)for(var B=!1,k=!1,x=!1,N=!1,s=0;s<I.length;s++)B=B||document.getElementById("wfu_fbperm_role_"+I[s]+"_view").checked,k=B&&(k||document.getElementById("wfu_fbperm_role_"+I[s]+"_dl").checked),x=B&&(x||document.getElementById("wfu_fbperm_role_"+I[s]+"_edit").checked),N=B&&(N||document.getElementById("wfu_fbperm_role_"+I[s]+"_del").checked);else var B=document.getElementById("wfu_fbperm_role_0_view"),k=document.getElementById("wfu_fbperm_role_0_dl"),x=document.getElementById("wfu_fbperm_role_0_edit"),N=document.getElementById("wfu_fbperm_role_0_del");if(f.style.fontWeight=m.checked?"":"bold",y.checked=m.checked?E.checked:y.checked,d.checked=m.checked?E.checked?B:p.checked:y.checked?B:d.checked,u.checked=m.checked?E.checked?k:w.checked:y.checked?k:d.checked&&u.checked,o.checked=m.checked?E.checked?x:g.checked:y.checked?x:d.checked&&o.checked,r.checked=m.checked?E.checked?N:v.checked:y.checked?N:d.checked&&r.checked,y.disabled=m.checked,d.disabled=m.checked||y.checked,u.disabled=m.checked||y.checked||!d.checked,o.disabled=m.checked||y.checked||!d.checked,r.disabled=m.checked||y.checked||!d.checked,a){var c=m.checked?"":"D"+(y.checked?"":"R"+(d.checked?"v":"")+(u.checked?"d":"")+(o.checked?"e":"")+(r.checked?"l":""));l.value=l.value.replace(new RegExp(","+t+"\\[\\w*\\]|"+t+"\\[\\w*\\],|"+t+"\\[\\w*\\]"),""),l.value+=(""==l.value?"":",")+t+"["+c+"]"}}}}}function wfu_goto_historylog_page(e,t){var a=document.getElementById("wfu_historylog_pages"),l=a.selectedIndex+1,n=l;if("next"==t?n=Math.min(l+1,a.options.length):"prev"==t?n=Math.max(l-1,1):"last"==t?n=a.options.length:"first"==t?n=1:"sel"==t&&(l=-1),n!=l){var d=wfu_GetHttpRequestObject();if(null!=d){var u=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_get_historylog_page",params[1]=new Array(2),params[1][0]="token",params[1][1]=e,params[2]=new Array(2),params[2][0]="page",params[2][1]=n;for(var o="",r=0;r<params.length;r++)o+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);document.getElementById("wfu_historylog_overlay").style.display="block",d.open("POST",u,!0),d.setRequestHeader("Content-type","application/x-www-form-urlencoded"),d.onreadystatechange=function(){if(4==d.readyState&&200==d.status){document.getElementById("wfu_historylog_overlay").style.display="none";var e="wfu_historylog_page_success:",t=d.responseText.indexOf(e);-1==t&&(t=d.responseText.length);var l=(d.responseText.substr(0,t),d.responseText.substr(t+e.length,d.responseText.length-t-e.length));if(""!=l){var u=document.getElementById("wfu_historylog_table");u.tBodies[0].innerHTML=wfu_plugin_decode_string(l),a.selectedIndex=n-1,document.getElementById("wfu_historylog_first_disabled").style.display=1==n?"inline":"none",document.getElementById("wfu_historylog_prev_disabled").style.display=1==n?"inline":"none",document.getElementById("wfu_historylog_first").style.display=1==n?"none":"inline",document.getElementById("wfu_historylog_prev").style.display=1==n?"none":"inline",document.getElementById("wfu_historylog_last_disabled").style.display=n==a.options.length?"inline":"none",document.getElementById("wfu_historylog_next_disabled").style.display=n==a.options.length?"inline":"none",document.getElementById("wfu_historylog_last").style.display=n==a.options.length?"none":"inline",document.getElementById("wfu_historylog_next").style.display=n==a.options.length?"none":"inline"}}},d.send(o)}}}function wfu_include_file(e,t,a){var l=wfu_GetHttpRequestObject();if(null!=l){var n=AdminParams.wfu_ajax_url;params=new Array(2),params[0]=new Array(3),params[0][0]="action",params[0][1]="wfu_ajax_action_include_file",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="nonce",params[2][1]=a;for(var d="",u=0;u<params.length;u++)d+=(u>0?"&":"")+params[u][0]+"="+encodeURI(params[u][1]);document.getElementById("wfu_include_file_"+t+"_a").href="javascript: void(0)",document.getElementById("wfu_include_file_"+t+"_img").style.display="inline",l.open("POST",n,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(){if(4==l.readyState&&(document.getElementById("wfu_include_file_"+t+"_img").style.display="none",200==l.status)){var e="wfu_include_file:",a=l.responseText.indexOf(e);-1==a&&(a=l.responseText.length);var n=(l.responseText.substr(0,a),l.responseText.substr(a+e.length,l.responseText.length-a-e.length));a=n.indexOf(":");var d=n.substr(0,a);txt_value=n.substr(a+1,n.length-a-1),"success"==d?(document.getElementById("wfu_file_flat_"+t).style.display="none",document.getElementById("wfu_file_link_"+t).style.display="inline",document.getElementById("wfu_file_can_be_included_actions_"+t).style.display="none",document.getElementById("wfu_file_is_included_actions_"+t).style.display="block"):document.getElementById("wfu_include_file_"+t+"_a").innerHTML=document.getElementById("wfu_include_file_"+t+"_inpfail").value}},l.send(d)}}var DraggedItem=null,ShortcodeNextSave=0,ShortcodeTimeOut=null,ShortcodeString="",Autosave=!1,PageObsolete=!1,PageUpdating=!1,CheckObsolescenceTimeOut=5e3;jQuery(document).ready(function(e){e(".wfu_color_field").wpColorPicker({change:function(e,t){e.target.value=t.color.toString(),"wfu_text_elements"==e.target.name?wfu_update_text_value(e):"wfu_triplecolor_elements"==e.target.name&&wfu_update_triplecolor_value(e)}})});
lib/wfu_admin_browser.php CHANGED
@@ -178,30 +178,42 @@ function wfu_browse_files($basedir_code) {
178
  }
179
  //show contained files
180
  foreach ( $filelist as $file ) {
181
- if ( $file['filedata'] != null ) $file_code = wfu_safe_store_filepath(wfu_path_abs2rel($file['fullpath']).'[['.$sort.']]');
 
 
 
182
  $echo_str .= "\n\t\t\t\t".'<tr onmouseover="var actions=document.getElementsByName(\'wfu_file_actions\'); for (var i=0; i<actions.length; i++) {actions[i].style.visibility=\'hidden\';} document.getElementById(\'wfu_file_actions_'.$ii.'\').style.visibility=\'visible\'" onmouseout="var actions=document.getElementsByName(\'wfu_file_actions\'); for (var i=0; i<actions.length; i++) {actions[i].style.visibility=\'hidden\';}">';
183
  $echo_str .= "\n\t\t\t\t\t".'<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
184
- if ( $file['filedata'] != null )
185
- $echo_str .= "\n\t\t\t\t\t\t".'<a class="row-title" href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_details&file='.$file_code.'" title="View and edit file details" style="font-weight:normal;">'.$file['name'].'</a>';
186
- else
187
- $echo_str .= "\n\t\t\t\t\t\t".'<span>'.$file['name'].'</span>';
188
  $echo_str .= "\n\t\t\t\t\t\t".'<div id="wfu_file_actions_'.$ii.'" name="wfu_file_actions" style="visibility:hidden;">';
189
- if ( $file['filedata'] != null ) {
190
- $echo_str .= "\n\t\t\t\t\t\t\t".'<span>';
191
- $echo_str .= "\n\t\t\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_details&file='.$file_code.'" title="View and edit file details">Details</a>';
192
- $echo_str .= "\n\t\t\t\t\t\t\t\t".' | ';
193
- $echo_str .= "\n\t\t\t\t\t\t\t".'</span>';
194
- $echo_str .= "\n\t\t\t\t\t\t\t".'<span>';
195
- $echo_str .= "\n\t\t\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=rename_file&file='.$file_code.'" title="Rename this file">Rename</a>';
196
- $echo_str .= "\n\t\t\t\t\t\t\t\t".' | ';
197
- $echo_str .= "\n\t\t\t\t\t\t\t".'</span>';
198
- $echo_str .= "\n\t\t\t\t\t\t\t".'<span>';
199
- $echo_str .= "\n\t\t\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=delete_file&file='.$file_code.'" title="Delete this file">Delete</a>';
200
- $echo_str .= "\n\t\t\t\t\t\t\t\t".' | ';
201
- $echo_str .= "\n\t\t\t\t\t\t\t".'</span>';
202
- $echo_str .= "\n\t\t\t\t\t\t\t".'<span>';
203
- $echo_str .= "\n\t\t\t\t\t\t\t\t".'<a href="javascript:wfu_download_file(\''.$file_code.'\', '.$ii.', \''.wp_create_nonce('wfu_download_file_invoker').'\');" title="Download this file">Download</a>';
204
- $echo_str .= "\n\t\t\t\t\t\t\t".'</span>';
 
 
 
 
 
 
 
 
 
205
  }
206
  else {
207
  $echo_str .= "\n\t\t\t\t\t\t\t".'<span style="visibility:hidden;">';
@@ -216,7 +228,7 @@ function wfu_browse_files($basedir_code) {
216
  $echo_str .= "\n\t\t\t\t\t".'<td width="20%" style="padding: 5px 5px 5px 10px; text-align:left;">'.date("d/m/Y H:i:s", $file['mdate']).'</td>';
217
  $echo_str .= "\n\t\t\t\t\t".'<td width="10%" style="padding: 5px 5px 5px 10px; text-align:center;">'.$file['user'].'</td>';
218
  $echo_str .= "\n\t\t\t\t\t".'<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
219
- if ( $file['filedata'] != null ) {
220
  if ( count($file['filedata']->userdata) > 0 ) {
221
  $echo_str .= "\n\t\t\t\t\t\t".'<select multiple="multiple" style="width:100%; height:40px; background:none; font-size:small;">';
222
  foreach ( $file['filedata']->userdata as $userdata )
@@ -660,6 +672,8 @@ function wfu_file_details($file_code, $errorstatus) {
660
  $rep .= '<strong>['.$filerec->date_from.']</strong> ';
661
  if ( $filerec->action == 'upload' )
662
  $rep .= 'File uploaded with name <strong>'.$fileparts['basename'].'</strong> by user <strong>'.$username.'</strong>';
 
 
663
  elseif ( $filerec->action == 'download' )
664
  $rep .= 'File downloaded by user <strong>'.$username.'</strong>';
665
  elseif ( $filerec->action == 'rename' )
178
  }
179
  //show contained files
180
  foreach ( $filelist as $file ) {
181
+ $is_included = ( $file['filedata'] != null );
182
+ $can_be_included = ( $plugin_options['includeotherfiles'] == "1" ) && !wfu_file_extension_restricted($file['name']);
183
+ $file_code = '';
184
+ if ( $is_included || $can_be_included ) $file_code = wfu_safe_store_filepath(wfu_path_abs2rel($file['fullpath']).'[['.$sort.']]');
185
  $echo_str .= "\n\t\t\t\t".'<tr onmouseover="var actions=document.getElementsByName(\'wfu_file_actions\'); for (var i=0; i<actions.length; i++) {actions[i].style.visibility=\'hidden\';} document.getElementById(\'wfu_file_actions_'.$ii.'\').style.visibility=\'visible\'" onmouseout="var actions=document.getElementsByName(\'wfu_file_actions\'); for (var i=0; i<actions.length; i++) {actions[i].style.visibility=\'hidden\';}">';
186
  $echo_str .= "\n\t\t\t\t\t".'<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
187
+ if ( $is_included || $can_be_included )
188
+ $echo_str .= "\n\t\t\t\t\t\t".'<a id="wfu_file_link_'.$ii.'" class="row-title" href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_details&file='.$file_code.'" title="View and edit file details" style="font-weight:normal;'.( $is_included ? '' : ' display:none;' ).'">'.$file['name'].'</a>';
189
+ if ( !$is_included )
190
+ $echo_str .= "\n\t\t\t\t\t\t".'<span id="wfu_file_flat_'.$ii.'">'.$file['name'].'</span>';
191
  $echo_str .= "\n\t\t\t\t\t\t".'<div id="wfu_file_actions_'.$ii.'" name="wfu_file_actions" style="visibility:hidden;">';
192
+ if ( $is_included || $can_be_included ) {
193
+ $echo_str .= "\n\t\t\t\t\t\t\t".'<div id="wfu_file_is_included_actions_'.$ii.'" style="display:'.( $is_included ? 'block' : 'none' ).';">';
194
+ $echo_str .= "\n\t\t\t\t\t\t\t\t".'<span>';
195
+ $echo_str .= "\n\t\t\t\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_details&file='.$file_code.'" title="View and edit file details">Details</a>';
196
+ $echo_str .= "\n\t\t\t\t\t\t\t\t\t".' | ';
197
+ $echo_str .= "\n\t\t\t\t\t\t\t\t".'</span>';
198
+ $echo_str .= "\n\t\t\t\t\t\t\t\t".'<span>';
199
+ $echo_str .= "\n\t\t\t\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=rename_file&file='.$file_code.'" title="Rename this file">Rename</a>';
200
+ $echo_str .= "\n\t\t\t\t\t\t\t\t\t".' | ';
201
+ $echo_str .= "\n\t\t\t\t\t\t\t\t".'</span>';
202
+ $echo_str .= "\n\t\t\t\t\t\t\t\t".'<span>';
203
+ $echo_str .= "\n\t\t\t\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=delete_file&file='.$file_code.'" title="Delete this file">Delete</a>';
204
+ $echo_str .= "\n\t\t\t\t\t\t\t\t\t".' | ';
205
+ $echo_str .= "\n\t\t\t\t\t\t\t\t".'</span>';
206
+ $echo_str .= "\n\t\t\t\t\t\t\t\t".'<span>';
207
+ $echo_str .= "\n\t\t\t\t\t\t\t\t\t".'<a href="javascript:wfu_download_file(\''.$file_code.'\', '.$ii.', \''.wp_create_nonce('wfu_download_file_invoker').'\');" title="Download this file">Download</a>';
208
+ $echo_str .= "\n\t\t\t\t\t\t\t\t".'</span>';
209
+ $echo_str .= "\n\t\t\t\t\t\t\t".'</div>';
210
+ $echo_str .= "\n\t\t\t\t\t\t\t".'<div id="wfu_file_can_be_included_actions_'.$ii.'" style="display:'.( $is_included ? 'none' : 'block' ).';">';
211
+ $echo_str .= "\n\t\t\t\t\t\t\t\t".'<span>';
212
+ $echo_str .= "\n\t\t\t\t\t\t\t\t\t".'<a id="wfu_include_file_'.$ii.'_a" href="javascript:wfu_include_file(\''.$file_code.'\', '.$ii.', \''.wp_create_nonce('wfu_include_file').'\');" title="Include file in plugin\'s database">Include File</a>';
213
+ $echo_str .= "\n\t\t\t\t\t\t\t\t\t".'<img id="wfu_include_file_'.$ii.'_img" src="'.WFU_IMAGE_ADMIN_SUBFOLDER_LOADING.'" style="width:12px; display:none;" />';
214
+ $echo_str .= "\n\t\t\t\t\t\t\t\t\t".'<input id="wfu_include_file_'.$ii.'_inpfail" type="hidden" value="File could not be included!" />';
215
+ $echo_str .= "\n\t\t\t\t\t\t\t\t".'</span>';
216
+ $echo_str .= "\n\t\t\t\t\t\t\t".'</div>';
217
  }
218
  else {
219
  $echo_str .= "\n\t\t\t\t\t\t\t".'<span style="visibility:hidden;">';
228
  $echo_str .= "\n\t\t\t\t\t".'<td width="20%" style="padding: 5px 5px 5px 10px; text-align:left;">'.date("d/m/Y H:i:s", $file['mdate']).'</td>';
229
  $echo_str .= "\n\t\t\t\t\t".'<td width="10%" style="padding: 5px 5px 5px 10px; text-align:center;">'.$file['user'].'</td>';
230
  $echo_str .= "\n\t\t\t\t\t".'<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
231
+ if ( $is_included ) {
232
  if ( count($file['filedata']->userdata) > 0 ) {
233
  $echo_str .= "\n\t\t\t\t\t\t".'<select multiple="multiple" style="width:100%; height:40px; background:none; font-size:small;">';
234
  foreach ( $file['filedata']->userdata as $userdata )
672
  $rep .= '<strong>['.$filerec->date_from.']</strong> ';
673
  if ( $filerec->action == 'upload' )
674
  $rep .= 'File uploaded with name <strong>'.$fileparts['basename'].'</strong> by user <strong>'.$username.'</strong>';
675
+ elseif ( $filerec->action == 'include' )
676
+ $rep .= 'File included in database with name <strong>'.$fileparts['basename'].'</strong> by user <strong>'.$username.'</strong>';
677
  elseif ( $filerec->action == 'download' )
678
  $rep .= 'File downloaded by user <strong>'.$username.'</strong>';
679
  elseif ( $filerec->action == 'rename' )
lib/wfu_admin_log.php CHANGED
@@ -104,7 +104,7 @@ function wfu_view_log($page = 1, $only_table_rows = false) {
104
  if ( in_array($filerec->linkedto, $deletedfiles) || in_array($filerec->idlog, $deletedfiles) ) $echo_str .= "\n\t\t\t\t\t\t".'<span>'.$filerec->filepath.'</span>';
105
  else {
106
  $lid = 0;
107
- if ( $filerec->action == 'upload' ) $lid = $filerec->idlog;
108
  elseif ( $filerec->linkedto > 0 ) $lid = $filerec->linkedto;
109
  if ( $lid > 0 ) {
110
  if ( !isset($filecodes[$lid]) ) $filecodes[$lid] = wfu_safe_store_filepath($filerec->filepath);
104
  if ( in_array($filerec->linkedto, $deletedfiles) || in_array($filerec->idlog, $deletedfiles) ) $echo_str .= "\n\t\t\t\t\t\t".'<span>'.$filerec->filepath.'</span>';
105
  else {
106
  $lid = 0;
107
+ if ( $filerec->action == 'upload' || $filerec->action == 'include' ) $lid = $filerec->idlog;
108
  elseif ( $filerec->linkedto > 0 ) $lid = $filerec->linkedto;
109
  if ( $lid > 0 ) {
110
  if ( !isset($filecodes[$lid]) ) $filecodes[$lid] = wfu_safe_store_filepath($filerec->filepath);
lib/wfu_admin_settings.php CHANGED
@@ -79,6 +79,14 @@ function wfu_manage_settings($message = '') {
79
  $echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>'.($plugin_options['mediacustom'] == '1' ? 'Yes' : 'No' ).'</strong></p>';
80
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
81
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
 
 
 
 
 
 
 
 
82
  $echo_str .= "\n\t\t\t\t".'</tbody>';
83
  $echo_str .= "\n\t\t\t".'</table>';
84
  $echo_str .= "\n\t\t\t".'<p class="submit">';
@@ -102,6 +110,7 @@ function wfu_update_settings() {
102
  $hashfiles = ( isset($_POST['wfu_hashfiles']) ? ( $_POST['wfu_hashfiles'] == "on" ? 1 : 0 ) : 0 );
103
  $relaxcss = ( isset($_POST['wfu_relaxcss']) ? ( $_POST['wfu_relaxcss'] == "on" ? 1 : 0 ) : 0 );
104
  $mediacustom = ( isset($_POST['wfu_mediacustom']) ? ( $_POST['wfu_mediacustom'] == "on" ? 1 : 0 ) : 0 );
 
105
  if ( isset($_POST['wfu_basedir']) && isset($_POST['wfu_postmethod']) && isset($_POST['wfu_admindomain']) && isset($_POST['submitform']) ) {
106
  if ( $_POST['submitform'] == "Update" ) {
107
  $new_plugin_options['version'] = '1.0';
@@ -112,6 +121,7 @@ function wfu_update_settings() {
112
  $new_plugin_options['relaxcss'] = $relaxcss;
113
  $new_plugin_options['admindomain'] = $_POST['wfu_admindomain'];
114
  $new_plugin_options['mediacustom'] = $mediacustom;
 
115
  $encoded_options = wfu_encode_plugin_options($new_plugin_options);
116
  update_option( "wordpress_file_upload_options", $encoded_options );
117
  if ( $new_plugin_options['hashfiles'] == '1' && $plugin_options['hashfiles'] != '1' )
79
  $echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>'.($plugin_options['mediacustom'] == '1' ? 'Yes' : 'No' ).'</strong></p>';
80
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
81
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
82
+ $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
83
+ $echo_str .= "\n\t\t\t\t\t\t\t".'<label for="wfu_includeotherfiles">Include Other Files in Plugin\'s Database</label>';
84
+ $echo_str .= "\n\t\t\t\t\t\t".'</th>';
85
+ $echo_str .= "\n\t\t\t\t\t\t".'<td>';
86
+ $echo_str .= "\n\t\t\t\t\t\t\t".'<input name="wfu_includeotherfiles" id="wfu_includeotherfiles" type="checkbox"'.($plugin_options['includeotherfiles'] == '1' ? ' checked="checked"' : '' ).' style="width:auto;" /> If enabled administrators can include in the plugin\'s database additional files through the File Browser';
87
+ $echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>'.($plugin_options['includeotherfiles'] == '1' ? 'Yes' : 'No' ).'</strong></p>';
88
+ $echo_str .= "\n\t\t\t\t\t\t".'</td>';
89
+ $echo_str .= "\n\t\t\t\t\t".'</tr>';
90
  $echo_str .= "\n\t\t\t\t".'</tbody>';
91
  $echo_str .= "\n\t\t\t".'</table>';
92
  $echo_str .= "\n\t\t\t".'<p class="submit">';
110
  $hashfiles = ( isset($_POST['wfu_hashfiles']) ? ( $_POST['wfu_hashfiles'] == "on" ? 1 : 0 ) : 0 );
111
  $relaxcss = ( isset($_POST['wfu_relaxcss']) ? ( $_POST['wfu_relaxcss'] == "on" ? 1 : 0 ) : 0 );
112
  $mediacustom = ( isset($_POST['wfu_mediacustom']) ? ( $_POST['wfu_mediacustom'] == "on" ? 1 : 0 ) : 0 );
113
+ $includeotherfiles = ( isset($_POST['wfu_includeotherfiles']) ? ( $_POST['wfu_includeotherfiles'] == "on" ? 1 : 0 ) : 0 );
114
  if ( isset($_POST['wfu_basedir']) && isset($_POST['wfu_postmethod']) && isset($_POST['wfu_admindomain']) && isset($_POST['submitform']) ) {
115
  if ( $_POST['submitform'] == "Update" ) {
116
  $new_plugin_options['version'] = '1.0';
121
  $new_plugin_options['relaxcss'] = $relaxcss;
122
  $new_plugin_options['admindomain'] = $_POST['wfu_admindomain'];
123
  $new_plugin_options['mediacustom'] = $mediacustom;
124
+ $new_plugin_options['includeotherfiles'] = $includeotherfiles;
125
  $encoded_options = wfu_encode_plugin_options($new_plugin_options);
126
  update_option( "wordpress_file_upload_options", $encoded_options );
127
  if ( $new_plugin_options['hashfiles'] == '1' && $plugin_options['hashfiles'] != '1' )
lib/wfu_ajaxactions.php CHANGED
@@ -487,6 +487,30 @@ function wfu_ajax_action_get_historylog_page() {
487
  die('wfu_historylog_page_success:'.wfu_plugin_encode_string($rows));
488
  }
489
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
  function wfu_ajax_action_notify_wpfilebase() {
491
  $params_index = (isset($_POST['params_index']) ? $_POST['params_index'] : (isset($_GET['params_index']) ? $_GET['params_index'] : ''));
492
  $session_token = (isset($_POST['session_token']) ? $_POST['session_token'] : (isset($_GET['session_token']) ? $_GET['session_token'] : ''));
487
  die('wfu_historylog_page_success:'.wfu_plugin_encode_string($rows));
488
  }
489
 
490
+ function wfu_ajax_action_include_file() {
491
+ $file_code = (isset($_POST['file']) ? $_POST['file'] : (isset($_GET['file']) ? $_GET['file'] : ''));
492
+ $nonce = (isset($_POST['nonce']) ? $_POST['nonce'] : (isset($_GET['nonce']) ? $_GET['nonce'] : ''));
493
+ if ( $file_code == '' || $nonce == '' ) die();
494
+
495
+ if ( !current_user_can( 'manage_options' ) ) die();
496
+ //security check to avoid CSRF attacks
497
+ if ( !wp_verify_nonce($nonce, 'wfu_include_file') ) die();
498
+
499
+ $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
500
+ if ( $plugin_options['includeotherfiles'] != "1" ) die();
501
+
502
+ $file_code = wfu_sanitize_code($file_code);
503
+ $dec_file = wfu_get_filepath_from_safe($file_code);
504
+ if ( $dec_file === false ) die();
505
+
506
+ $user = wp_get_current_user();
507
+ $dec_file = wfu_path_rel2abs(wfu_flatten_path($dec_file));
508
+ $fileid = wfu_log_action('include', $dec_file, $user->ID, '', '', get_current_blog_id(), '', null);
509
+
510
+ if ( $fileid !== false ) die("wfu_include_file:success:");
511
+ else die("wfu_include_file:fail:");
512
+ }
513
+
514
  function wfu_ajax_action_notify_wpfilebase() {
515
  $params_index = (isset($_POST['params_index']) ? $_POST['params_index'] : (isset($_GET['params_index']) ? $_GET['params_index'] : ''));
516
  $session_token = (isset($_POST['session_token']) ? $_POST['session_token'] : (isset($_GET['session_token']) ? $_GET['session_token'] : ''));
lib/wfu_functions.php CHANGED
@@ -300,6 +300,7 @@ function wfu_encode_plugin_options($plugin_options) {
300
  $encoded_options .= 'relaxcss='.( isset($plugin_options['relaxcss']) ? $plugin_options['relaxcss'] : "" ).';';
301
  $encoded_options .= 'admindomain='.( isset($plugin_options['admindomain']) ? $plugin_options['admindomain'] : "" ).';';
302
  $encoded_options .= 'mediacustom='.( isset($plugin_options['mediacustom']) ? $plugin_options['mediacustom'] : "" ).';';
 
303
  $encoded_options .= 'captcha_sitekey='.( isset($plugin_options['captcha_sitekey']) ? wfu_plugin_encode_string($plugin_options['captcha_sitekey']) : "" ).';';
304
  $encoded_options .= 'captcha_secretkey='.( isset($plugin_options['captcha_secretkey']) ? wfu_plugin_encode_string($plugin_options['captcha_secretkey']) : "" ).';';
305
  $encoded_options .= 'dropbox_accesstoken='.( isset($plugin_options['dropbox_accesstoken']) ? wfu_plugin_encode_string($plugin_options['dropbox_accesstoken']) : "" ).';';
@@ -318,6 +319,7 @@ function wfu_decode_plugin_options($encoded_options) {
318
  $plugin_options['relaxcss'] = "";
319
  $plugin_options['admindomain'] = "";
320
  $plugin_options['mediacustom'] = "";
 
321
  $plugin_options['captcha_sitekey'] = "";
322
  $plugin_options['captcha_secretkey'] = "";
323
  $plugin_options['dropbox_accesstoken'] = "";
@@ -772,7 +774,7 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $blogid
772
  // if ( substr($relativepath, 0, 1) != '/' ) $relativepath = '/'.$relativepath;
773
 
774
  $retid = 0;
775
- if ( $action == 'upload' ) {
776
  // calculate and store file hash if this setting is enabled from Settings
777
  $filehash = '';
778
  if ( $plugin_options['hashfiles'] == '1' ) $filehash = md5_file($filepath);
@@ -802,7 +804,7 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $blogid
802
  'sid' => $sid,
803
  'date_from' => $now_date,
804
  'date_to' => 0,
805
- 'action' => 'upload'
806
  ),
807
  array(
808
  '%d',
300
  $encoded_options .= 'relaxcss='.( isset($plugin_options['relaxcss']) ? $plugin_options['relaxcss'] : "" ).';';
301
  $encoded_options .= 'admindomain='.( isset($plugin_options['admindomain']) ? $plugin_options['admindomain'] : "" ).';';
302
  $encoded_options .= 'mediacustom='.( isset($plugin_options['mediacustom']) ? $plugin_options['mediacustom'] : "" ).';';
303
+ $encoded_options .= 'includeotherfiles='.( isset($plugin_options['includeotherfiles']) ? $plugin_options['includeotherfiles'] : "" ).';';
304
  $encoded_options .= 'captcha_sitekey='.( isset($plugin_options['captcha_sitekey']) ? wfu_plugin_encode_string($plugin_options['captcha_sitekey']) : "" ).';';
305
  $encoded_options .= 'captcha_secretkey='.( isset($plugin_options['captcha_secretkey']) ? wfu_plugin_encode_string($plugin_options['captcha_secretkey']) : "" ).';';
306
  $encoded_options .= 'dropbox_accesstoken='.( isset($plugin_options['dropbox_accesstoken']) ? wfu_plugin_encode_string($plugin_options['dropbox_accesstoken']) : "" ).';';
319
  $plugin_options['relaxcss'] = "";
320
  $plugin_options['admindomain'] = "";
321
  $plugin_options['mediacustom'] = "";
322
+ $plugin_options['includeotherfiles'] = "";
323
  $plugin_options['captcha_sitekey'] = "";
324
  $plugin_options['captcha_secretkey'] = "";
325
  $plugin_options['dropbox_accesstoken'] = "";
774
  // if ( substr($relativepath, 0, 1) != '/' ) $relativepath = '/'.$relativepath;
775
 
776
  $retid = 0;
777
+ if ( $action == 'upload' || $action == 'include' ) {
778
  // calculate and store file hash if this setting is enabled from Settings
779
  $filehash = '';
780
  if ( $plugin_options['hashfiles'] == '1' ) $filehash = md5_file($filepath);
804
  'sid' => $sid,
805
  'date_from' => $now_date,
806
  'date_to' => 0,
807
+ 'action' => $action
808
  ),
809
  array(
810
  '%d',
lib/wfu_processfiles.php CHANGED
@@ -542,6 +542,7 @@ function wfu_process_files($params, $method) {
542
  //this is a call to wfu_after_file_complete filters, which is
543
  //the old name of wfu_after_file_loaded filters, for maintaining
544
  //backward compatibility
 
545
  $ret_data = apply_filters('wfu_after_file_complete', $changable_data, $additional_data);
546
  $filter_error_message = $ret_data['error_message'];
547
  $filter_admin_message = $ret_data['admin_message'];
542
  //this is a call to wfu_after_file_complete filters, which is
543
  //the old name of wfu_after_file_loaded filters, for maintaining
544
  //backward compatibility
545
+ $changable_data = $ret_data;
546
  $ret_data = apply_filters('wfu_after_file_complete', $changable_data, $additional_data);
547
  $filter_error_message = $ret_data['error_message'];
548
  $filter_admin_message = $ret_data['admin_message'];
readme.txt CHANGED
@@ -137,6 +137,11 @@ There is an option in plugin's settings in Dashboard to relax the CSS rules, so
137
 
138
  == Changelog ==
139
 
 
 
 
 
 
140
  = 3.8.1 =
141
  * fixed bug with duplicate userdata IDs in HTML when using more than one userdata occurrences
142
 
137
 
138
  == Changelog ==
139
 
140
+ = 3.8.2 =
141
+ * fixed bug in wfu_after_file_loaded filter that was not working and was overriden by obsolete wfu_after_file_completed filter
142
+ * added option in plugin's Settings in Dashboard to include additional files in plugin's database
143
+ * added feature in Dashboard File Browser for admins to include additional files in plugin's database
144
+
145
  = 3.8.1 =
146
  * fixed bug with duplicate userdata IDs in HTML when using more than one userdata occurrences
147
 
release_notes.txt CHANGED
@@ -1,3 +1,3 @@
1
- <!-- --><span><strong>Latest release notes: </strong>This release introduces some minor bug fixes related to userdata functionality. The Professional version of the plugin contains some more important improvements related to <strong>Code Hooks</strong> and <strong>Dropbox</strong> features.</span><!-- --><!-- --><br /><br /><span>
2
 
3
  For more details about this version's changes please visit the Release Notes of the plugin's </span><a href="http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/">support page</a><span>.</span>
1
+ <span><strong>Latest release notes: </strong>This release is a minor update and introduces a new feature for admins, the ability to </span><span style="text-decoration: underline;">include additional files</span><span> in the plugin's database through the Dashboard <strong>File Browser</strong>. An option has been added in the plugin's Settings in Dashboard to enable this feature. This releases corrects also a bug in <strong>wfu_after_file_loaded</strong> filter that was not working and was overriden by obsolete <em>wfu_after_file_completed</em> filter.</span><br /><br /><span>
2
 
3
  For more details about this version's changes please visit the Release Notes of the plugin's </span><a href="http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/">support page</a><span>.</span>
wordpress_file_upload.php CHANGED
@@ -4,7 +4,7 @@ if( !session_id() ) { session_start(); }
4
  /*
5
  Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
  Description: Simple interface to upload files from a page.
7
- Version: 3.8.1
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
@@ -76,6 +76,7 @@ add_action('wp_ajax_wfu_ajax_action_download_file_monitor', 'wfu_ajax_action_dow
76
  add_action('wp_ajax_nopriv_wfu_ajax_action_download_file_monitor', 'wfu_ajax_action_download_file_monitor');
77
  add_action('wp_ajax_wfu_ajax_action_edit_shortcode', 'wfu_ajax_action_edit_shortcode');
78
  add_action('wp_ajax_wfu_ajax_action_get_historylog_page', 'wfu_ajax_action_get_historylog_page');
 
79
  add_action('wp_ajax_wfu_ajax_action_update_envar', 'wfu_ajax_action_update_envar');
80
  wfu_include_lib();
81
  //widget
4
  /*
5
  Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
  Description: Simple interface to upload files from a page.
7
+ Version: 3.8.2
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
76
  add_action('wp_ajax_nopriv_wfu_ajax_action_download_file_monitor', 'wfu_ajax_action_download_file_monitor');
77
  add_action('wp_ajax_wfu_ajax_action_edit_shortcode', 'wfu_ajax_action_edit_shortcode');
78
  add_action('wp_ajax_wfu_ajax_action_get_historylog_page', 'wfu_ajax_action_get_historylog_page');
79
+ add_action('wp_ajax_wfu_ajax_action_include_file', 'wfu_ajax_action_include_file');
80
  add_action('wp_ajax_wfu_ajax_action_update_envar', 'wfu_ajax_action_update_envar');
81
  wfu_include_lib();
82
  //widget