<commit_before><%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki"%>
<%@ page import="com.ecyrd.jspwiki.*" %>
<%@ page import="com.ecyrd.jspwiki.tags.*" %>
<%@ page import="com.ecyrd.jspwiki.ui.*" %>
<%@ page import="com.ecyrd.jspwiki.rpc.*" %>
<%@ page import="com.ecyrd.jspwiki.rpc.json.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<fmt:setBundle basename="templates.default"/>
<%--
        This is a plain editor for JSPWiki.
--%>
<% 
   WikiContext context = WikiContext.findContext( pageContext ); 
   WikiEngine engine = context.getEngine();
   JSONRPCManager.requestJSON( context );  //FIXME: to be replace by standard mootools lib

  TemplateManager.addResourceRequest( context, "script", "scripts/jspwiki-edit.js" );
  TemplateManager.addResourceRequest( context, "script", "scripts/posteditor.js" );
   String usertext = EditorManager.getEditedText( pageContext );
%>
<wiki:CheckRequestContext context="edit">
<wiki:NoSuchPage> <%-- this is a new page, check if we're cloning --%>
<%
  String clone = request.getParameter( "clone" ); 
  if( clone != null )
  {
    WikiPage p = engine.getPage( clone );
    if( p != null )
    {
      usertext = engine.getPureText( p );
    }
  }
%>
</wiki:NoSuchPage>
<%
  if( usertext == null )
  {
    usertext = engine.getPureText( context.getPage() );
  }
%>
</wiki:CheckRequestContext>
<% if( usertext == null ) usertext = "";  %>


<div style="width:100%"> <%-- Required for IE6 on Windows --%>

<%-- FIXME: better have it created by some js :: move it to jspwiki-edit.js --%>
<div id="findSuggestionMenu" style='visibility:hidden;'></div>

<form action="<wiki:CheckRequestContext 
     context='edit'><wiki:EditLink format='url'/></wiki:CheckRequestContext><wiki:CheckRequestContext 
     context='comment'><wiki:CommentLink format='url'/></wiki:CheckRequestContext>" 
       class="wikiform"
          id="editform" 
    onsubmit="return Wiki.submitOnce(this);"
      method="post" accept-charset="<wiki:ContentEncoding/>"
     enctype="application/x-www-form-urlencoded" >

  <%-- Edit.jsp relies on these being found.  So be careful, if you make changes. --%>
  <p id="submitbuttons">
  <input name="page" type="hidden" value="<wiki:Variable var='pagename' />" />
  <input name="action" type="hidden" value="save" />
  <input name="edittime" type="hidden" value="<c:out value='${lastchange}' />" />
  <input name="addr" type="hidden" value="<%=request.getRemoteAddr()%>" />
  <input type="submit" name="ok" value="<fmt:message key='editor.plain.save.submit'/>" 
    accesskey="s"
        title="<fmt:message key='editor.plain.save.title'/>" />
  <input type="submit" name="preview" value="<fmt:message key='editor.plain.preview.submit'/>" 
    accesskey="v"
        title="<fmt:message key='editor.plain.preview.title'/>" />
  <input type="submit" name="cancel" value="<fmt:message key='editor.plain.cancel.submit'/>" 
    accesskey="q" 
        title="<fmt:message key='editor.plain.cancel.title'/>" />
  </p>
  
  <div>
  <textarea id="editorarea" name="<%=EditorManager.REQ_EDITEDTEXT%>" 
         class="editor" 
       onkeyup="getSuggestions(this.id)"
       onclick="setCursorPos(this.id)" 
      onchange="setCursorPos(this.id)"
          rows="20" cols="80"><%=TextUtil.replaceEntities(usertext)%></textarea>
  </div>
  <div style="display:none;">
    <div id="editassist">
      <a href="#" class="tool closed" rel="" title="<fmt:message key='editor.plain.editassist.title'/>">
        <fmt:message key='editor.plain.editassist'/>
      </a>
    </div>

    <div id="toolbar">
	  <a href="#" class="tool" rel="" id="tbLink" title="<fmt:message key='editor.plain.tbLink.title'/>">link</a>
	  <a href="#" class="tool" rel="break" id="tbH1" title="<fmt:message key='editor.plain.tbH1.title'/>">h1</a>
	  <a href="#" class="tool" rel="break" id="tbH2" title="<fmt:message key='editor.plain.tbH2.title'/>">h2</a>
	  <a href="#" class="tool" rel="break" id="tbH3" title="<fmt:message key='editor.plain.tbH3.title'/>">h3</a>
      <span>&nbsp;</span>
	  <a href="#" class="tool" rel="break" id="tbHR" title="<fmt:message key='editor.plain.tbHR.title'/>">hr</a><commit_msg>Added automatic bot detection.<commit_after><%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki"%>
<%@ page import="com.ecyrd.jspwiki.*" %>
<%@ page import="com.ecyrd.jspwiki.tags.*" %>
<%@ page import="com.ecyrd.jspwiki.filters.SpamFilter" %>
<%@ page import="com.ecyrd.jspwiki.ui.*" %>
<%@ page import="com.ecyrd.jspwiki.rpc.*" %>
<%@ page import="com.ecyrd.jspwiki.rpc.json.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<fmt:setBundle basename="templates.default"/>
<%--
        This is a plain editor for JSPWiki.
--%>
<% 
   WikiContext context = WikiContext.findContext( pageContext ); 
   WikiEngine engine = context.getEngine();
   JSONRPCManager.requestJSON( context );  //FIXME: to be replace by standard mootools lib

  TemplateManager.addResourceRequest( context, "script", "scripts/jspwiki-edit.js" );
  TemplateManager.addResourceRequest( context, "script", "scripts/posteditor.js" );
   String usertext = EditorManager.getEditedText( pageContext );
%>
<wiki:CheckRequestContext context="edit">
<wiki:NoSuchPage> <%-- this is a new page, check if we're cloning --%>
<%
  String clone = request.getParameter( "clone" ); 
  if( clone != null )
  {
    WikiPage p = engine.getPage( clone );
    if( p != null )
    {
      usertext = engine.getPureText( p );
    }
  }
%>
</wiki:NoSuchPage>
<%
  if( usertext == null )
  {
    usertext = engine.getPureText( context.getPage() );
  }
%>
</wiki:CheckRequestContext>
<% if( usertext == null ) usertext = "";  %>


<div style="width:100%"> <%-- Required for IE6 on Windows --%>

<%-- FIXME: better have it created by some js :: move it to jspwiki-edit.js --%>
<div id="findSuggestionMenu" style='visibility:hidden;'></div>

<form action="<wiki:CheckRequestContext 
     context='edit'><wiki:EditLink format='url'/></wiki:CheckRequestContext><wiki:CheckRequestContext 
     context='comment'><wiki:CommentLink format='url'/></wiki:CheckRequestContext>" 
       class="wikiform"
          id="editform" 
    onsubmit="return Wiki.submitOnce(this);"
      method="post" accept-charset="<wiki:ContentEncoding/>"
     enctype="application/x-www-form-urlencoded" >

  <%-- Edit.jsp relies on these being found.  So be careful, if you make changes. --%>
  <p id="submitbuttons">
  <input name="page" type="hidden" value="<wiki:Variable var='pagename' />" />
  <input name="action" type="hidden" value="save" />
  <input name="edittime" type="hidden" value="<c:out value='${lastchange}' />" />
  <input name="addr" type="hidden" value="<%=request.getRemoteAddr()%>" />
  <input type="submit" name="ok" value="<fmt:message key='editor.plain.save.submit'/>" 
    accesskey="s"
        title="<fmt:message key='editor.plain.save.title'/>" />
  <input type="submit" name="preview" value="<fmt:message key='editor.plain.preview.submit'/>" 
    accesskey="v"
        title="<fmt:message key='editor.plain.preview.title'/>" />
  <input type="submit" name="cancel" value="<fmt:message key='editor.plain.cancel.submit'/>" 
    accesskey="q" 
        title="<fmt:message key='editor.plain.cancel.title'/>" />
  </p>
  
  <div>
  <textarea id="editorarea" name="<%=EditorManager.REQ_EDITEDTEXT%>" 
         class="editor" 
       onkeyup="getSuggestions(this.id)"
       onclick="setCursorPos(this.id)" 
      onchange="setCursorPos(this.id)"
          rows="20" cols="80"><%=TextUtil.replaceEntities(usertext)%></textarea>
  </div>
  <%-- This following field is only for the SpamFilter to catch bots which are just randomly filling all fields and submitting.
       Normal user should never see this field, nor type anything in it. --%>
  <div style="display:block;">Authentication code: <input type="text" name="<%=SpamFilter.getBotFieldName()%>" id="<%=SpamFilter.getBotFieldName()%>" value=""/></div>
  <div style="display:none;">
    <div id="editassist">
      <a href="#" class="tool closed" rel="" title="<fmt:message key='editor.plain.editassist.title'/>">
        <fmt:message key='editor.plain.editassist'/>
      </a>
    </div>

    <div id="toolbar">
	  <a href="#" class="tool" rel="" id="tbLink" title="<fmt:message key='editor.plain.tbLink.title'/>">link</a>
	  <a href="#" class="tool" rel="break" id="tbH1" title="<fmt:message key='editor.plain.tbH1.title'/>">h1</a>
	  <a href="#" class="tool" rel="break" id="tbH2" title="<fmt:message key='editor.plain.tbH2.title'/>">h2</a>
	  <a href="#" class="tool" rel="break" id="tbH3" title="<fmt:message key='editor.plain.tbH3.title'/>">h3</a>
      <span>&nbsp;</span>
	  <a href="#" class="tool" rel="break" id="tbHR" title="<fmt:message key='editor.plain.tbHR.title'/>">hr</a>
{'fraction_non_alphanumeric': 0.20465116279069767, 'fraction_numerical': 0.003986710963455149, 'mean_word_length': 4.375595238095238, 'pattern_counts': {'":': 0, '<': 176, '<?xml version=': 0, '>': 176, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1208444', 'n_tokens_mistral': 3210, 'n_tokens_neox': 3072, 'n_words': 564}