From 3b1413b4f4f7c92993cfbe49f1203c6d6c76287e Mon Sep 17 00:00:00 2001 From: pjmuo03 Date: Wed, 31 May 2023 00:18:02 +0900 Subject: [PATCH 1/6] ziogle --- index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 54de93b0..8ec0fdf1 100644 --- a/index.html +++ b/index.html @@ -24,7 +24,9 @@ myFunction(); } -function OpenZioYou(){ - var htmlOutput = HtmlService.createHtmlOutputFromFile('openUrl').setHeight(100); +function OpenZioYou() { + var html = '지오유로 이동'; + var htmlOutput = HtmlService.createHtmlOutput(html).setWidth(300).setHeight(100); SpreadsheetApp.getUi().showModalDialog(htmlOutput, 'Opening ZioYou'); -} + } + \ No newline at end of file From 9b94a390897bc167644257a63a2b07baf59cd9fd Mon Sep 17 00:00:00 2001 From: pjmuo03 Date: Tue, 6 Jun 2023 23:52:40 +0900 Subject: [PATCH 2/6] index --- index.html | 57 ++++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/index.html b/index.html index 8ec0fdf1..d53cdceb 100644 --- a/index.html +++ b/index.html @@ -1,32 +1,25 @@ -function myFunction() { - -} - -function onOpen() { - var ui = SpreadsheetApp.getUi(); - // Or DocumentApp or FormApp. - ui.createMenu('지오유') - .addItem('본 문서를 전자결재로 상신', 'menuItem1') - .addSeparator() - .addSubMenu(ui.createMenu('바로가기') - .addItem('그룹웨어로 이동', 'menuItem2')) - .addToUi(); -} - -function menuItem1() { - SpreadsheetApp.getUi() // Or DocumentApp or FormApp. - .alert('You clicked the first menu item!'); -} - -function menuItem2() { - SpreadsheetApp.getUi() // Or DocumentApp or FormApp. - .alert('You clicked the second menu item!'); - myFunction(); -} - -function OpenZioYou() { - var html = '지오유로 이동'; - var htmlOutput = HtmlService.createHtmlOutput(html).setWidth(300).setHeight(100); - SpreadsheetApp.getUi().showModalDialog(htmlOutput, 'Opening ZioYou'); - } - \ No newline at end of file + + + + + + + + + + + + From 507f6295abe1d88ddb09a8357117b6c2aa083726 Mon Sep 17 00:00:00 2001 From: pjmuo03 Date: Tue, 6 Jun 2023 23:53:12 +0900 Subject: [PATCH 3/6] Code --- Code.gs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Code.gs diff --git a/Code.gs b/Code.gs new file mode 100644 index 00000000..e4e04c88 --- /dev/null +++ b/Code.gs @@ -0,0 +1,39 @@ +// 스프레드시트 메뉴를 생성하고 초기화할 때 호출되는 함수 +function onOpen() { + var ui = SpreadsheetApp.getUi(); + ui.createMenu('지오유') + .addItem('본 문서를 전자결재로 생산', 'sendDocument') + .addSeparator() + .addSubMenu(ui.createMenu('바로가기') + .addItem('그룹웨이로 이동', 'openZioYou') + ) + .addToUi(); +} + +// "본 문서를 전자결재로 생산" 메뉴 클릭 시 실행되는 함수 +function sendDocument() { + var htmlOutput = HtmlService.createHtmlOutputFromFile('index.html').setHeight(400); + SpreadsheetApp.getUi().showModalDialog(htmlOutput, '전자결재 상신'); +} + +// "상신하기" 버튼 클릭 시 실행되는 함수 +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 a653ff924587600386fa7cff20c47cd29baf5450 Mon Sep 17 00:00:00 2001 From: pjmuo03 <97003950+pjmuo03@users.noreply.github.com> Date: Wed, 7 Jun 2023 11:54:08 +0900 Subject: [PATCH 4/6] Update Code.gs --- Code.gs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code.gs b/Code.gs index e4e04c88..09283a20 100644 --- a/Code.gs +++ b/Code.gs @@ -18,7 +18,7 @@ function sendDocument() { // "상신하기" 버튼 클릭 시 실행되는 함수 function fSend() { - if (confirm("위 문서를 정말로 생산하시겠습니까?")) { + if (confirm("위 문서를 정말로 상신하시겠습니까?")) { google.script.run.processForm(); } } From 3f122a30e8be589f14f28e7d3cb01a929b3b3c06 Mon Sep 17 00:00:00 2001 From: pjmuo03 Date: Wed, 21 Jun 2023 01:21:10 +0900 Subject: [PATCH 5/6] Code --- Code.gs | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/Code.gs b/Code.gs index 09283a20..597597d5 100644 --- a/Code.gs +++ b/Code.gs @@ -1,6 +1,8 @@ // 스프레드시트 메뉴를 생성하고 초기화할 때 호출되는 함수 function onOpen() { var ui = SpreadsheetApp.getUi(); + + // "지오유" 메뉴 생성 ui.createMenu('지오유') .addItem('본 문서를 전자결재로 생산', 'sendDocument') .addSeparator() @@ -10,17 +12,34 @@ function onOpen() { .addToUi(); } -// "본 문서를 전자결재로 생산" 메뉴 클릭 시 실행되는 함수 -function sendDocument() { - var htmlOutput = HtmlService.createHtmlOutputFromFile('index.html').setHeight(400); - SpreadsheetApp.getUi().showModalDialog(htmlOutput, '전자결재 상신'); +// 공개 URL을 가져오는 함수 +function fGetPubUrl() { + var fileId = SpreadsheetApp.getActiveSpreadsheet().getId(); + Drive.Revisions.update({ published: true, publishOutsideDomain: true, publishAuto: true }, fileId, 1); + return "https://docs.google.com/spreadsheet/pub?key=" + fileId; } -// "상신하기" 버튼 클릭 시 실행되는 함수 -function fSend() { - if (confirm("위 문서를 정말로 상신하시겠습니까?")) { - google.script.run.processForm(); - } +// 사용자 정보를 가져오는 함수 +function fGetUserInfo() { + var about = Drive.About.get(); + var user = { + name: about.name, + permissionId: about.permissionId, + driveUser: about.user + }; + return user; +} + +// "본 문서를 전자결재로 생산" 메뉴 클릭 시 실행되는 함수 +function sendDocument() { + var tpl = HtmlService.createTemplateFromFile("index.html"); + tpl.bodyhtml = fGetPubUrl(); + tpl.subj = SpreadsheetApp.getActiveSpreadsheet().getName(); + tpl.userid = fGetUserInfo().driveUser.emailAddress; + var output = tpl.evaluate(); + output.setWidth(1400); + output.setHeight(700); + SpreadsheetApp.getUi().showModalDialog(output, '전자결재 eSign'); } // "그룹웨이로 이동" 메뉴 클릭 시 실행되는 함수 @@ -28,12 +47,4 @@ 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('상신되었습니다.'); -} +} \ No newline at end of file From 85ee812d09fad648f3971dada32642a7d809e21c Mon Sep 17 00:00:00 2001 From: pjmuo03 Date: Wed, 21 Jun 2023 01:21:30 +0900 Subject: [PATCH 6/6] index --- index.html | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index d53cdceb..ba2c1a11 100644 --- a/index.html +++ b/index.html @@ -2,6 +2,7 @@ + - - +
+
+ + +
전자결재 문서제목을 반드시 입력하세요.
+
+
+ + +
+ + +
+ + - + \ No newline at end of file