Создать документ в строке просмотра. Два и более форм документов в поле зрения - PullRequest
0 голосов
/ 25 февраля 2020

Я набираю текст во встроенной форме и не закрываю встроенную форму, после этого я создаю верхний основной документ с помощью верхней формы. Не закрытая встроенная форма перемещается вверх по строке, которая только что создала основную строку документа. Но это должно остаться на старом месте. Как это исправить? Или как создать 2 или более документов с помощью встроенной формы, если у всех форм есть текст?

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xe="http://www.ibm.com/xsp/coreex"
    xmlns:xc="http://www.ibm.com/xsp/custom">
    <xp:this.beforePageLoad><![CDATA[#{javascript:var documentId : String = context.getUrlParameter('documentId');
if (documentId!="") {sessionScope.put("Channal",documentId)};
if (!sessionScope.containsKey("Channal")) {
var docChannal : NotesDocument = database.getView("subChannal").getDocumentByKey("True");
if (docChannal != null) {
sessionScope.put("Channal",docChannal.getUniversalID());
}
}}]]></xp:this.beforePageLoad>
    <xp:panel id="Main">
        <xp:this.rendered><![CDATA[#{javascript:try {
var docChannal : NotesDocument = database.getDocumentByUNID(sessionScope.get("Channal"));
return docChannal.getUniversalID()!=""
} catch(e) {
    return false
}}]]></xp:this.rendered>
        <xp:panel id="documentMessageCreate">
            <xp:this.data>
                <xp:dominoDocument var="documentMessageCreate"
                    formName="Message" computeWithForm="onsave" action="newDocument"
                    scope="request" ignoreRequestParams="true">
                    <xp:this.postNewDocument>
                        <xp:actionGroup>
                            <xp:this.condition><![CDATA[#{javascript:return currentDocument.isNewNote() && currentDocument.isResponse()}]]></xp:this.condition>
                            <xp:modifyField name="Read"
                                var="currentDocument">
                                <xp:this.value><![CDATA[#{javascript:database.getDocumentByUNID(currentDocument.getParentId()).getItemValue("Read")}]]></xp:this.value>
                            </xp:modifyField>
                        </xp:actionGroup>
                    </xp:this.postNewDocument>
                    <xp:this.parentId><![CDATA[#{javascript:sessionScope.get("Channal") }]]></xp:this.parentId>
                </xp:dominoDocument>
            </xp:this.data>
            <xp:this.rendered><![CDATA[#{javascript:var docChannal : NotesDocument = database.getDocumentByUNID(sessionScope.get("Channal"));
return ! @IsNotMember(@UserName() ,docChannal.getItemValue("MessageCreate"))  || docChannal.getItemValueString("MessageCreate")==""
/* var docChannal : NotesDocument = database.getDocumentByUNID(sessionScope.get("Channal"));
var ArrayName=[];
ArrayName=ArrayName.concat('[Manager]');
ArrayName=ArrayName.concat('[Administrator]');
return ! ( @IsNotMember(database.queryAccessRoles(@UserName()),ArrayName) && @IsNotMember(@UserName() ,docChannal.getItemValue("MessageCreate")) ) || docChannal.getItemValueString("MessageCreate")==""
*/}]]></xp:this.rendered>
            <xp:table style="width:100%" id="tableMessage"
                styleClass="messageCreate">
                <xp:tr>
                    <xp:td valign="top" style="width:32px">
                    </xp:td>
                    <xp:td>
                        <xp:inputRichText
                            value="#{documentMessageCreate.Body}" id="MainMessage">
                            <xp:this.dojoAttributes>
                                <xp:dojoAttribute
                                    name="autoGrow_minHeight" value="50">
                                </xp:dojoAttribute>
                            </xp:this.dojoAttributes>
                        </xp:inputRichText>
                    </xp:td>
                </xp:tr>
                <xp:tr>
                    <xp:td></xp:td>
                    <xp:td>
                        <xp:button
                            value="#{javascript:translateString('Send')}"
                            id="CreateMessage">
                        <xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="Main">
                            <xp:this.action>
                                <xp:actionGroup>
                                <xp:saveDocument
                                        var="documentMessageCreate">
                                    </xp:saveDocument>
                                                <xp:executeScript>
                                        <xp:this.script><![CDATA[#{javascript://context.redirectToPage("Main")
getComponent("MainMessage").setValue("")
}]]></xp:this.script>
                                    </xp:executeScript>
                                </xp:actionGroup>
                            </xp:this.action></xp:eventHandler></xp:button>
                    </xp:td>
                </xp:tr>
            </xp:table>
        </xp:panel>
        <xp:panel id="dataViewMessage">
            <xp:this.data>
                <xp:dominoView var="viewMessage"
                    viewName="(xpMessage)">
                    <xp:this.parentId><![CDATA[#{javascript:sessionScope.get("Channal") 

}]]></xp:this.parentId>
                </xp:dominoView>
            </xp:this.data>
            <xp:repeat rows="10" var="row" value="#{viewMessage}"
                id="viewRepeatMessage">
                <xp:panel id="documentMessage">
                    <xp:this.data>
                        <xp:dominoDocument var="documentMessage"
                            action="openDocument" documentId="#{javascript:row.getNoteID()}"
                            ignoreRequestParams="true" formName="Message" scope="request">
                        </xp:dominoDocument>
                    </xp:this.data>
                    <xp:table id="tableData">
                        <xp:this.style><![CDATA[#{javascript:if (row.getColumnIndentLevel()>0) {
 return "width:100%;margin-left:"+(row.getColumnIndentLevel()*32).toString()+"px;"
  }  else {
   return "width:100%;"
  }
 }]]></xp:this.style>
                        <xp:this.styleClass><![CDATA[#{javascript:if (row.getColumnIndentLevel()==0) {
return "message" }}]]></xp:this.styleClass>
                        <xp:tr>
                            <xp:td rowspan="3" style="width:32px"
                                valign="top">
                            </xp:td>
                            <xp:td>
                                <xp:text escape="true"
                                    style="font-size:8pt;font-family:Arial;color:rgb(128,128,128);margin-right:10.0px"
                                    id="dataAuthor">
                                    <xp:this.converter>
                                        <xp:convertDateTime
                                            type="date">
                                        </xp:convertDateTime>
                                    </xp:this.converter>
                                    <xp:this.value><![CDATA[#{javascript:var document : NotesDocument = row.getDocument();
return @Name('[CN]',document.getItemValue('Author'))}]]></xp:this.value>
                                </xp:text>
                                <xp:text id="dataCreated"
                                    style="font-size:8pt;color:rgb(128,128,128)">
                                    <xp:this.value><![CDATA[#{javascript:try{
    var document : NotesDocument = row.getDocument();
    var date : NotesDateTime = document.getItemValue('Created' )[0];
    var Today:NotesDateTime = session.createDateTime("Today");
    Today.setNow();
    if ( (Today.timeDifference(date) / 86400).toFixed(0) != 0) 
        {return date.toJavaDate()}
    else
        {return translateString('Today') +'  '+ @LeftBack(date.getTimeOnly(),6)}
} catch (e){}}]]></xp:this.value>
                                    <xp:this.converter>
                                        <xp:convertDateTime
                                            pattern="dd.MM.yyyy HH.mm">
                                        </xp:convertDateTime>
                                    </xp:this.converter>
                                </xp:text>
                            </xp:td>
                        </xp:tr>
                        <xp:tr>
                            <xp:td rowspan="2" valign="top">
                                <xp:text escape="false" id="messageBody"
                                    value="#{documentMessage.Body}">
                                </xp:text>
                            </xp:td>
                        </xp:tr>
                        <xp:tr>
                        </xp:tr>
                        <xp:tr>
                            <xp:td></xp:td>
                            <xp:td>
                            <xp:link
                                    text="#{javascript:translateString('CreateResponse')}"
                                    id="MessageResponse" style="font-size:8pt;margin-right:10.0px"
                                    escape="true">
                                    <xp:this.rendered><![CDATA[#{javascript:var docChannal : NotesDocument = database.getDocumentByUNID(sessionScope.get("Channal"));
return ! @IsNotMember(@UserName() ,docChannal.getItemValue("MessageReplyCreate"))  || docChannal.getItemValueString("MessageReplyCreate")==""}]]></xp:this.rendered>
                                    <xp:eventHandler event="onclick"
                                        submit="true" refreshMode="partial"
                                        refreshId="inPlaceFormMessageResponse" id="eventHandler1">
                                        <xp:this.action>
                                            <xp:actionGroup
                                                condition="#{javascript:true //!viewScope.containsKey('Response')}">
                                                <xp:executeScript>
                                                    <xp:this.script><![CDATA[#{javascript:   
     viewScope.put('Response',row.getNoteID());
     var c = getComponent("inPlaceFormMessageResponse");
c.toggle()
}]]></xp:this.script>
                                                </xp:executeScript>
                                            </xp:actionGroup>
                                        </xp:this.action>
                                    </xp:eventHandler>
                                </xp:link>
                            </xp:td>
                        </xp:tr>
                    </xp:table>
                    <xe:inPlaceForm id="inPlaceFormMessageResponse"
                        partialEvents="true">
                        <xp:panel>
                            <xp:this.data>
                                <xp:dominoDocument
                                    var="documentMessageResponseCreate" formName="Message"
                                    parentId="#{javascript:row.getNoteID()}"
                                    computeWithForm="onsave" scope="view">
                                <xp:this.postNewDocument>
                                        <xp:actionGroup>
                                            <xp:this.condition><![CDATA[#{javascript:return currentDocument.isNewNote() && currentDocument.isResponse()}]]></xp:this.condition>
                                            <xp:modifyField name="Read"
                                                var="currentDocument">
                                                <xp:this.value><![CDATA[#{javascript:database.getDocumentByID(currentDocument.getParentId()).getItemValue("Read")}]]></xp:this.value>
                                            </xp:modifyField>
                                        </xp:actionGroup>
                                    </xp:this.postNewDocument>
                                </xp:dominoDocument>
                            </xp:this.data>
                            <xp:table id="table2">
                                <xp:this.style><![CDATA[#{javascript:"width: calc(100% - "+(row.getColumnIndentLevel()*32+32).toString()+"px); margin-left:"+(row.getColumnIndentLevel()*32+32).toString()+"px;"}]]></xp:this.style>
                                <xp:tr>
                                    <xp:td>
                                        <xp:inputRichText
                                            id="inputRichText1"
                                            value="#{documentMessageResponseCreate.Body}">
                                            <xp:this.dojoAttributes>
                                                <xp:dojoAttribute
                                                    name="autoGrow_minHeight" value="50">
                                                </xp:dojoAttribute>
                                            </xp:this.dojoAttributes>
                                        </xp:inputRichText>
                                    </xp:td>
                                </xp:tr>
                                <xp:tr>
                                    <xp:td>
                                        <xp:button
                                            value="#{javascript:translateString('Send')}"
                                            id="CreateMessageResponse" style="margin-right:10.0px">
                                            <xp:eventHandler
                                                event="onclick" submit="true" refreshMode="partial"
                                                id="eventHandler3" refreshId="viewRepeatMessage">
                                                <xp:this.action>
                                                    <xp:actionGroup>
                                                        <xp:saveDocument
                                                            var="documentMessageResponseCreate">
                                                        </xp:saveDocument>
                                                        <xp:executeScript>
                                                            <xp:this.script><![CDATA[#{javascript:var Agent : NotesAgent;
var NoteID : string;
var AgentName : string;
AgentName = '(CreateEvent'+currentDocument.getDocument().getItemValueString('Form')+'Create)';
NoteID = currentDocument.getNoteID();
    Agent = database.getAgent(AgentName);
    if(Agent != null){
      Agent.runOnServer(NoteID);      
    }
}]]></xp:this.script>
                                                        </xp:executeScript>
                                                        <xp:executeScript>
                                                            <xp:this.script><![CDATA[#{javascript:viewScope.remove('Response');
database.getView("(xpMessage)").refresh();
var c = getComponent("inPlaceFormMessageResponse")
c.hide()
}]]></xp:this.script>
                                                        </xp:executeScript>
                                                    </xp:actionGroup>
                                                </xp:this.action>
                                            </xp:eventHandler>
                                        </xp:button>
                                    </xp:td>
                                </xp:tr>
                            </xp:table>
                        </xp:panel>
                    </xe:inPlaceForm>
                </xp:panel>
            </xp:repeat>
            <xp:div style="text-align:center">
                <xe:pagerAddRows id="pagerAddRowsMessage"
                    text="#{javascript:translateString('ShowMore')}"
                    disabledFormat="hide" refreshPage="true" for="viewRepeatMessage">
                </xe:pagerAddRows>
            </xp:div>
        </xp:panel>
    </xp:panel>
</xp:view>

Спасибо за любую помощь!

Создание форм ответов с текстом


Сохранить основную форму. Ответ InLine с текстом "1-resp = 1" перемещается вверх и остается под только что созданным Main do c (не под do c с текстом "1") enter image description here


Сохранить 1-респ = 1 enter image description here


...