From dc82e4242560a075627f1998bae8f72ffa451e2d Mon Sep 17 00:00:00 2001 From: leejh00 <109499626+leejh00@users.noreply.github.com> Date: Tue, 20 Jun 2023 12:28:01 +0900 Subject: [PATCH 1/2] Create code.gs --- code.gs | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 code.gs diff --git a/code.gs b/code.gs new file mode 100644 index 00000000..979cdc48 --- /dev/null +++ b/code.gs @@ -0,0 +1,62 @@ +// 스프레드시트 메뉴를 생성하고 초기화할 때 호출되는 함수 +function onOpen() { + var ui = SpreadsheetApp.getUi(); + ui.createMenu('지오유') + .addItem('본 문서를 전자결재로 생산', 'sendDocument') + .addSeparator() + .addSubMenu(ui.createMenu('바로가기') + .addItem('그룹웨이로 이동', 'openZioYou') + ) + .addToUi(); +} + +function fGetUserInfo(){ + var about = Drive.About.get(); + var user = { + name : about.name, + permissionId : about.permissionId, + driverUser: about.user + } + return user; +} +function fGetPubUrl(){ + var fileid = SpreadsheetApp.getActiveSpreadsheet().getId(); + Drive.Revisions.update({published: true, publishedOutsideDown: true, publishAuto: true}.fileid,1); + return "https://docs.google.com/spreadsheet/pub?key" + key; +} + +// "본 문서를 전자결재로 생산" 메뉴 클릭 시 실행되는 함수 +function sendDocument() { + var tpl = HtmlService.createTemplateFromFile('index.html'); + tpl.bodyhtml = fGetPubUrl; + tpl.sub1 = SpreadsheetApp.getActiveSpreadsheet().getName(); + tpl.userid = fGetUserInfo().driverUser.emailAddress; + + + var output = tpl.evaluate(); + output.setWidth(1400); + output.setHeight(700); + SpreadsheetApp.getUi().showModalDialog(output,'전자결재 esign'); +} + +// "상신하기" 버튼 클릭 시 실행되는 함수 +function fSend() { + if (confirm("위 문서를 정말로 상신하시겠습니까?")) { + google.script.run.processForm(); + } +} + +// "그룹웨이로 이동" 메뉴 클릭 시 실행되는 함수 +function openZioYou() { + var html = '지오유로 이동'; + var htmlOutput = HtmlService.createHtmlOutput(html).setWidth(300).setHeight(100); + SpreadsheetApp.getUi().showModalDialog(htmlOutput, '지오유 사이트'); +} + +// 전자결재 상신 처리 함수 +function processForm() { + var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); + + // A1 셀에 상신 메시지 표시 + sheet.getRange('A1').setValue('상신되었습니다.'); +} From f7c36934ec95ed635f8ac38180b75aebaeb22213 Mon Sep 17 00:00:00 2001 From: leejh00 <109499626+leejh00@users.noreply.github.com> Date: Tue, 20 Jun 2023 12:28:30 +0900 Subject: [PATCH 2/2] Create index.html --- index.html | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 00000000..04e1b753 --- /dev/null +++ b/index.html @@ -0,0 +1,30 @@ + + + + + + + + +
+
+ + +
전자결재 문서제목을 반드시 입력하세요.
+
+
+ + +
+ +
+ + + +