PeterT.
Frischling

Offline
Beiträge: 25
|
 |
« Antworten #4 am: 08.03.10 - 17:39:49 » |
|
Hallo,
ich habe ein Problem mit der xtalk V0.9-Schablone (Domino 8.5.1).
Wenn ich im benutzerdefinierten Element "content_newTopic" den Code, der sich hinter dem Element "saveTopicLink" nur anfasse, z.B. ein Leerzeichen einfüge, wieder wegnehme und dann abspeichere erhalte ich immer folgende Fehlermeldung beim Anlegen eines neuen Topics:
"Fehler beim Ausführen eines von JavaScript berechneten Ausdrucks. Script-Interpreterfehler, Zeile=49, Spalte=10: Beim Aufrufen der Methode NotesDocument ist ein Fehler aufgetreten. copyItem(null) null"
Ich poste das Script mit, das hinter "saveTopicLink" verbirgt, und dass in der Fehlermeldung auch angezeigt wird:
var thisUID = @Unique(); var customUNID = session.evaluate("@middle(@password(\"" + thisUID + "\");1;32)").elementAt(0); var curDate = session.createDateTime("Today"); curDate.setNow();
var topDoc:NotesDocument = newTopicDoc.getDocument(true); var faDoc:NotesDocument = database.getDocumentByUNID(sessionScope.forumID);
topDoc.replaceItemValue("form","content_Topic"); topDoc.replaceItemValue("topic_TopicUID",thisUID); topDoc.replaceItemValue("topic_TopicUNID",customUNID); topDoc.replaceItemValue("topic_Author",@UserName()); topDoc.replaceItemValue("topic_DateTime",curDate); topDoc.replaceItemValue("topic_ForumUNID",faDoc.getUniversalID()); topDoc.replaceItemValue("topic_ForumUID",faDoc.getItemValueString("forum_UID")); topDoc.replaceItemValue("topic_LastTitle",getComponent("topic_Title").getValue()); topDoc.replaceItemValue("topic_LastAuthor",@UserName()); topDoc.replaceItemValue("topic_LastDate",curDate); topDoc.replaceItemValue("topic_LastTopicUNID",thisUID); topDoc.replaceItemValue("topic_Replies",0); topDoc.replaceItemValue("topic_Views",0); topDoc.replaceItemValue("topic_IsSticky","0"); topDoc.replaceItemValue("topic_IsHot","0"); topDoc.replaceItemValue("topic_IsLocked","0"); topDoc.replaceItemValue("CGI_RemoteAddr",facesContext.getExternalContext().getRequest().request.getRemoteAddr()); topDoc.replaceItemValue("CGI_RemoteHost",facesContext.getExternalContext().getRequest().request.getRemoteHost()); topDoc.replaceItemValue("HTTP_Referer",facesContext.getExternalContext().getRequest().request.getHeader("Referer")); topDoc.replaceItemValue("HTTP_UserAgent",facesContext.getExternalContext().getRequest().request.getHeader("User-Agent")); topDoc.setUniversalID(customUNID); topDoc.save();
// Recreate the topic doc as a response to itself var replyUID = @Unique(); var replyUNID = session.evaluate("@middle(@password(\"" + replyUID + "\");1;32)").elementAt(0); var replyDoc:NotesDocument = database.createDocument(); replyDoc.setUniversalID(replyUNID); replyDoc.replaceItemValue("topic_replyUID",replyUID); replyDoc.replaceItemValue("topic_replyUNID",replyUNID); replyDoc.replaceItemValue("topic_replyMaster",1); replyDoc.replaceItemValue("form","content_TopicReply"); replyDoc.replaceItemValue("CGI_RemoteAddr",facesContext.getExternalContext().getRequest().request.getRemoteAddr()); replyDoc.replaceItemValue("CGI_RemoteHost",facesContext.getExternalContext().getRequest().request.getRemoteHost()); replyDoc.replaceItemValue("HTTP_Referer",facesContext.getExternalContext().getRequest().request.getHeader("Referer")); replyDoc.replaceItemValue("HTTP_UserAgent",facesContext.getExternalContext().getRequest().request.getHeader("User-Agent")); // replyDoc.copyItem(newTopicDoc.getDocument().getFirstItem("$MIMETrack")); // replyDoc.copyItem(newTopicDoc.getDocument().getFirstItem("$NoteHasNativeMIME")); // replyDoc.copyItem(newTopicDoc.getDocument().getFirstItem("MIME_Version")); replyDoc.copyItem(newTopicDoc.getDocument().getFirstItem("topic_Author")); ------Die folgende Zeile wird im Browser rot dargestellt. ------Ich vermute aber, das die vorherige Zeile schon das Problem verursacht. replyDoc.copyItem(newTopicDoc.getDocument().getFirstItem("topic_Title")); replyDoc.copyItem(newTopicDoc.getDocument().getFirstItem("topic_Body")); replyDoc.copyItem(newTopicDoc.getDocument().getFirstItem("topic_DateTime")); replyDoc.copyItem(newTopicDoc.getDocument().getFirstItem("topic_ForumUNID")); replyDoc.copyItem(newTopicDoc.getDocument().getFirstItem("topic_ForumUID")); replyDoc.copyItem(newTopicDoc.getDocument().getFirstItem("topic_TopicUID")); replyDoc.copyItem(newTopicDoc.getDocument().getFirstItem("topic_TopicUNID")); replyDoc.makeResponse(newTopicDoc.getDocument()); replyDoc.save();
// Update the ForumArea document
faDoc.replaceItemValue("forum_LastTitle",getComponent("topic_Title").getValue()); faDoc.replaceItemValue("forum_LastAuthor",@UserName()); faDoc.replaceItemValue("forum_LastDate",curDate); faDoc.replaceItemValue("forum_LastTopicUNID",thisUID); var faThreads = faDoc.getItemValueInteger("forum_Threads") faDoc.replaceItemValue("forum_Threads",faThreads + 1); var faPosts = faDoc.getItemValueInteger("forum_Posts") faDoc.replaceItemValue("forum_Posts",faPosts + 1); faDoc.save();
// Increase The Posters 'New Topic' count by one. var userView:NotesView = database.getView("lkp_UserProfiles"); var userDoc:NotesDocument = userView.getDocumentByKey(sessionScope.userCommon); var userPosts = userDoc.getItemValueInteger("user_Posts"); userDoc.replaceItemValue("user_Posts",userPosts + 1); userDoc.save();
// Redirect to the new Topic page. context.redirectToPage("/listTopics.xsp?forumID=" + faDoc.getItemValueString("forum_UID"));
Irgendeiner eine Idee?
Mit besten Grüßen und Dank im voraus Peter T.
|