⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 post.jsp

📁 LyBBS基于Struts1.3/Ajax的架构
💻 JSP
📖 第 1 页 / 共 4 页
字号:
<%@ page contentType="text/html; charset=GBK" %>
<%@ include file="common/include/taglibs.jsp" %>
<html:html>
<head>
<title><lybbs:web key="forumName"/></title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="bookmark" href="favicon.ico" type="image/x-icon">
<%@ include file="common/include/header.jsp" %>
<script language="javascript" src="lybbs/common/js/htmleditor.js" type="text/javascript"></script>
<script language="JavaScript">
  var userAgent = navigator.userAgent.toLowerCase();
  var is_ie     = userAgent.indexOf('msie') != -1;
  var text = "";
  var AddTxt = "";
  var theform;
  helpstat = false;
  stprompt = true;
  basic = false;
  var IframeID;
  var lybbs_bIsIE5=document.all;
  var word="<bean:message key="jsp.post.advpost.word"/>";
  function init() {
    theform=document.submitok;
  }
  function DoTitle(addTitle) {
    var revisedTitle;
    var currentTitle = document.submitok.title.value;
    revisedTitle = addTitle+currentTitle;
    document.submitok.title.value=revisedTitle;
    document.submitok.title.focus();
    return;
  }
  function open_smilie_window(x_width, y_width) {
    window.open("bbs_misc.do?action=showsmilies", "smilies", "statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=" + x_width + ",height=" + y_width);
  }
  function thelp(swtch){
   if (swtch == 1){ basic = false; stprompt = false; helpstat = true;} else if (swtch == 0) {helpstat = false;stprompt = false;basic = true;} else if (swtch == 2) {helpstat = false;basic = false;stprompt = true;}
  }
  function getActiveText() {
    setfocus();
    if (!is_ie || (is_ie && !document.selection)) {
       return false;
    }
    var sel = document.selection;
    var rng = sel.createRange();
    rng.colapse;
    if (rng != null && (sel.type == "Text" || sel.type == "None")) {
       text = rng.text;
    }
    if (theform.content.createTextRange) {
       theform.content.caretPos = rng.duplicate();
    }
    return true;
  }
  function setfocus() {
    theform.content.focus();
  }
  //function AddText(NewCode) {theform.content.value+=NewCode}
  function AddText(NewCode) {
    if (typeof(theform.content.createTextRange) != "undefined" && theform.content.caretPos) {
      var caretPos = theform.content.caretPos;
      caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? NewCode + ' ' : NewCode;
    } else {
      theform.content.value += NewCode;
    }
    setfocus();
    getActiveText();
    AddTxt = "";
  }
  function lycode(lycode, optioncompiled, prompttip, prompttext) {
    if(optioncompiled!='') {
      optioncompiled="="+optioncompiled;
    }
    // lets call this when they try and use lycode rather than on change
    getActiveText();
    if (text) {
       // its IE to the rescue
       if (text.substring(0, lycode.length + 2 ) == "[" + lycode + "]" && text.substring(text.length - lycode.length - 3, text.length) == "[/" + lycode + "]") {
         AddTxt = text.substring(lycode.length + 2, text.length - lycode.length - 3);
       } else {
         AddTxt = "[" + lycode + optioncompiled + "]" + text + "[/" + lycode + "]";
       }
       AddText(AddTxt);
    } else if (theform.content.selectionEnd && (theform.content.selectionEnd - theform.content.selectionStart > 0)) {
      // its mozilla and we'll need to re-write entire text
      var start_selection = theform.content.selectionStart;
      var end_selection = theform.content.selectionEnd;
      if (end_selection <= 2) {
        end_selection = theform.content.textLength;
      }

      // fetch everything from start of text area to selection start
      var start = (theform.content.value).substring(0, start_selection);
      // fetch everything from start of selection to end of selection
      var middle = (theform.content.value).substring(start_selection, end_selection);
      // fetch everything from end of selection to end of text area
      var end = (theform.content.value).substring(end_selection, theform.content.textLength);

      if (middle.substring(0, lycode.length + 2 ) == "[" + lycode + "]" && middle.substring(middle.length - lycode.length - 3, middle.length) == "[/" + lycode + "]") {
        middle = middle.substring(lycode.length + 2, middle.length - lycode.length - 3);
      } else {
        middle = "[" + lycode + optioncompiled + "]" + middle + "[/" + lycode + "]";
      }

      theform.content.value = start + middle + end;
    }
    else {
      if(prompttip=='') {
         AddTxt = "[" + lycode + optioncompiled + "]"+prompttext+"[/" + lycode + "] ";
      } else {
        var inserttext = prompt(prompttip, prompttext);
        if (inserttext != null) {
          AddTxt = "[" + lycode + optioncompiled + "]" + inserttext + "[/" + lycode + "] ";
        }
      }
      AddText(AddTxt);
    }
    setfocus();
    return false;
  }
  function smilie(smilietext) { 
    getActiveText();
    var AddSmilie = " " + smilietext + " ";
    AddText(AddSmilie);
  }
  function n_display(t_id) {
    t_id.style.display="";
  }
  function h_display(t_id) {
    t_id.style.display="none";
  }
  function displayViewNumber() {
    var viewMode=document.submitok.viewMode.options[document.submitok.viewMode.selectedIndex].value;
    var t_id=document.submitok.viewNumber;
    var t_id2=document.submitok.viewUserName;
    if(viewMode==4 || viewMode==5 || viewMode==6) {
      h_display(t_id2);
      n_display(t_id);
    }
    else if(viewMode==7) {
      h_display(t_id);
      n_display(t_id2);
    }
    else {
      h_display(t_id);
      h_display(t_id2);
    }
  }
  function setAccessary(accessary) {
    if(theform==null) init();
    theform.accessary.value=accessary;
    theform.updateAttachment.value=accessary;
  }
  function setAccessary2(accessary) {
    //if(theform==null) init();
    theform.accessary.value=accessary;
  }
  function setAccessaryName(accessaryName) {
    theform.accessaryName.value=accessaryName;
  }
  function votecondition(t_id,displayValue) {
    t_id.style.display=displayValue;
  }
  function checkPost() {
    var isCheckedPost=true;
    var maxContentLength=20000;
    if(theform.title!=null && theform.title.value=='') {
      alert("<bean:message key="error.message.send.title"/>");
      theform.title.focus();
      isCheckedPost=false;
    }
    else if(theform.content.value=='') {
      alert("<bean:message key="error.message.send.content"/>");
      theform.content.focus();
      isCheckedPost=false;
    }
    else if(theform.content.value.length>maxContentLength) {
      alert("<bean:message key="errors.maxlength" arg0="Content" arg1="20000"/>");
      theform.content.focus();
      isCheckedPost=false;
    }
    else {
      if(theform.accessaryName.value.length==0)  {
        if(theform.content.value.indexOf("[/mp]")>0) {
          setAccessaryName(".wmv");
        }
        else if(theform.content.value.indexOf("[/qt]")>0) {
          setAccessaryName(".qt");
        }
        else if(theform.content.value.indexOf("[/rm]")>0) {
          setAccessaryName(".rm");
        }
      }
      theform.submit1.disabled=true;
      <logic:equal name="forumBean" property="htmlStat" value="1">
        if(theform.htmlSupport!=null && theform.htmlSupport.checked==true) {
          isCheckedPost=lybbs_CheckData();
        }
      </logic:equal>
    }
    if(isCheckedPost) {
      theform.submit();
    }
  }
</script>
</head>
<bean:define id="publicStyle" name="publicStyleBean" type="net.lybbs.publicstyle.bean.IPublicStyle"/>
<bean:define id="emailCache" name="emailBean" type="net.lybbs.mail.cache.EmailCache"/>
<%
net.lybbs.post.bean.ITopic topic=(net.lybbs.post.bean.ITopic)request.getAttribute("topicBean");
String arrowUpload=publicStyle.getArrowUpload();
String allowAttachment=publicStyle.getAllowAttachment();
int forumID=ParameterUtils.getInt(request,"forumID");
int postID=ParameterUtils.getInt(request,"postID");
String action=ParameterUtils.getString(request,"action");
net.lybbs.util.PropertiesCache propertiesCache=net.lybbs.util.PropertiesCache.getInstance();
long uploadMaxTopicSize=propertiesCache.getUploadMaxTopicSize();
long uploadMaxReplySize=propertiesCache.getUploadMaxReplySize();
String[] uploadAllowedExtArray=propertiesCache.getUploadAllowedExtArray();
boolean emailTopicEnabled=emailCache.isEmailTopicEnabled();
boolean emailReplyEnabled=emailCache.isEmailReplyEnabled();
//check isTopic when do edit, only validate when action is edit.
boolean isTopic=false;
if(action.equals("edit")) {
%>
  <logic:equal name="topicBean" property="parentID" value="0">
  <%isTopic=true;%>
  </logic:equal>
<%
}
//if copy or replyquote,need set parentID to the id of be copied or be replyquoted
int parentID=0;
if(action.equals("replyquote") || action.equals("copy")) {
  parentID=topic.getParentID();
  if(parentID==0) parentID=postID;
}
else {
  //others,parentID is the id of operate.
  parentID=postID;
}
%>

<body topmargin=0 leftmargin=0 onload="init()">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -