diff --git a/Code.gs b/Code.gs
new file mode 100644
index 00000000..36f61b6b
--- /dev/null
+++ b/Code.gs
@@ -0,0 +1,123 @@
+// 양식에 대한 고정값
+let gAuthKey = "GbYfCPydIC5fKP5fmx5wz8gXeEOXpzWWd0UJ";
+let gFormNo = "152521"; //문자열로
+let gCallbackErpResultUrl = encodeURIComponent("callbackerpreturnurl?arg1={1}&arg2={2}&arg3={3}&arg4={4}");
+let gCallbackErpEventUrl = encodeURIComponent("callbackerpeventurl?arg1={1}&arg2={2}&arg3={3}&arg4={4}");
+
+// 문서마다 입력 받을 값
+let gErpUserID = "접속한 사용자의 Email주소 사용";
+let gDocSubject = "화면에서 입력받으세요";
+let gErpDocKey = "sheet고유의 ID를 자동으로 사용";
+let gBodyHtml = "눈에 보고 있는 Sheet 문서 자체를 자동으로 사용";
+
+// sheet
+let ui = SpreadsheetApp.getUi();
+let doc = SpreadsheetApp.getActiveSpreadsheet();
+let scriptPrp = PropertiesService.getScriptProperties()
+
+const onOpen = () => {
+ var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
+ spreadsheet.getRange('A1').setValue(getSpreadsheetName());
+
+ ui.createMenu("지오유")
+ .addItem("본 문서를 전자결재로 상신", "eSign")
+ .addItem("본 문서를 게시방에 게시", "eSign1")
+ .addItem("본 문서를 프로젝트 WBS에 게시", "eSign2")
+ .addSeparator()
+ .addSubMenu(
+ ui
+ .createMenu("바로가기")
+ .addItem("그룹웨어로 이동", "redirectToZioYou")
+ )
+ .addToUi();
+
+}
+
+const include = (filename) => {
+ return HtmlService.createHtmlOutputFromFile(filename).getContent();
+}
+
+const redirectToZioYou = () => {
+ let url = "http://login.zioyou.com";
+ let html = "";
+ let userInterface = HtmlService.createHtmlOutput(html).setHeight(50).setWidth(200);
+ ui.showModalDialog(userInterface, '로딩 중입니다.');
+}
+const redirectToWorkFlow = (url) => {
+ let html = "";
+ let userInterface = HtmlService.createHtmlOutput(html).setHeight(50).setWidth(200);
+ ui.showModalDialog(userInterface, '로딩 중입니다.');
+}
+
+const eSign = () => {
+ gErpUserID = fGetUserInfo().driveUser.emailAddress;
+ gBodyHtml = fGetPubUrl();
+ gErpDocKey = doc.getId();
+
+ scriptPrp.setProperty('gErpUserID', gErpUserID);
+ scriptPrp.setProperty('gBodyHtml', gBodyHtml);
+ scriptPrp.setProperty('gErpDocKey', gErpDocKey);
+
+ let template = HtmlService.createTemplateFromFile('form.html');
+ template.subj = doc.getName(); // HTML 파일에 값 전달
+ template.userid = fGetUserInfo().driveUser.emailAddress; //가능
+ template.userid = Session.getActiveUser().getEmail(); //가능
+ template.bodyhtml = gBodyHtml;
+ let output = template.evaluate();
+ output.setWidth(1400);
+ output.setHeight(600);
+ ui.showModalDialog(output, '전자결재 상신하기');
+}
+
+const processForm = (formObject) => {
+ callRestAPI(formObject);
+}
+
+const fGetPubUrl = () => {
+ var fileId = doc.getId();
+ //Drive : 좌메뉴->편집기->서비스->추가->Drive API
+ Drive.Revisions.update({published: true, publishedOutsideDomain: true, publishAuto: true}, fileId, 1);
+ return "https://docs.google.com/spreadsheet/pub?key=" + fileId;
+}
+
+function fGetUserInfo() {
+ var about = Drive.About.get();
+ var user = {
+ name: about.name,
+ permissionId: about.permissionId,
+ driveUser: about.user
+ };
+ return user;
+}
+
+const callRestAPI = (formObject) => {
+ const url = 'https://dev.zioyou.com/mashup/workflow.create.document';
+ const formData = {
+ "argErpUserID": scriptPrp.getProperty('gErpUserID'),
+ "argFormNo": gFormNo,
+ "argErpDocKey": scriptPrp.getProperty('gErpDocKey'),
+ "argCallbackErpEventUrl": gCallbackErpEventUrl,
+ "argDocSubject": formObject.txtSubject,
+ "argBodyHtml": encodeURIComponent(scriptPrp.getProperty('gBodyHtml')),
+ "argCallbackErpResultUrl": gCallbackErpResultUrl
+ };
+ const headers = {
+ "AuthKey": gAuthKey
+ };
+ const options = {
+ 'method' : 'post',
+ 'contentType': 'application/x-www-form-urlencoded', //application/json
+ 'headers': headers,
+ 'payload': formData //JSON.stringify(formData)
+ };
+ //ui.alert(JSON.stringify(formData));
+ let response = UrlFetchApp.fetch(url, options);
+ let data = JSON.parse(response.getContentText());
+ redirectToWorkFlow(data.result);
+}
+
+function getSpreadsheetName() {
+ var ss = SpreadsheetApp.getActiveSpreadsheet();
+ var name = ss.getName();
+ return name;
+}
diff --git a/README.md b/README.md
deleted file mode 100644
index a1c16095..00000000
--- a/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# 지오유 홈페이지
-http://www.zioyou.com
-
-# ziogle
-Google Workspace Plus
-
-# 참조
-## 구글 API 사용법, 키발급, oAuth인증 사용방법
-https://gomcine.tistory.com/entry/%EA%B5%AC%EA%B8%80-API-%EC%82%AC%EC%9A%A9%EB%B2%95-%ED%82%A4-%EB%B0%9C%EA%B8%89-oauth-%EC%9D%B8%EC%A6%9D-%EB%B0%A9%EB%B2%95-%EC%A0%95%EB%A6%AC
-
-## 부가정보
-
diff --git a/Web.html b/Web.html
new file mode 100644
index 00000000..41d7a25d
--- /dev/null
+++ b/Web.html
@@ -0,0 +1,300 @@
+
+
+
+
+
+ Drive API Quickstart
+
+
+
+
+
+
+ 전자결재 상신
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/index.html b/index.html
deleted file mode 100644
index 54de93b0..00000000
--- a/index.html
+++ /dev/null
@@ -1,30 +0,0 @@
-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 htmlOutput = HtmlService.createHtmlOutputFromFile('openUrl').setHeight(100);
- SpreadsheetApp.getUi().showModalDialog(htmlOutput, 'Opening ZioYou');
-}
diff --git a/note.txt b/note.txt
deleted file mode 100644
index 20d45345..00000000
--- a/note.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-0. PR(Pull Request) 검증
- 0-1. 학생별 검증
- 0-2. 포인트 발생(1,000 포인트)
- 0-3. Merge학생 1명 선발 (5,000 포인트)
-1. console.cloud.google.com
- - api 소개
- - 구글 API 사용법, 키발급, oAuth인증 사용방법
- https://gomcine.tistory.com/entry/%EA%B5%AC%EA%B8%80-API-%EC%82%AC%EC%9A%A9%EB%B2%95-%ED%82%A4-%EB%B0%9C%EA%B8%89-oauth-%EC%9D%B8%EC%A6%9D-%EB%B0%A9%EB%B2%95-%EC%A0%95%EB%A6%AC
-
-2. ziogle 프로젝트
- - 소개
- https://academy.zioyou.com/home2/contents?cateno=74
- - ojt1
- - ojt2
-
-3. 관련기술 학습
- - 웹서버 설치
- https://academy.zioyou.com/home2/single?cateno=63&atcno=2025
diff --git a/ojt1/index.html b/ojt1/index.html
deleted file mode 100644
index 41b168c6..00000000
--- a/ojt1/index.html
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-Google Sheet 문서를 Iframe으로 불러오기
-
-
-
-
-도전과제
-
- - 빈 엑셀 sheet를 만든다
- - iframe으로 불러온다
- - 수정할 수 있는 권한이 열려 수정작업을 한다.
- - 내 로컬저장소에 저장한다.
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ojt2/index.html b/ojt2/index.html
deleted file mode 100644
index 62575ad0..00000000
--- a/ojt2/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/ojt2/main.js b/ojt2/main.js
deleted file mode 100644
index 7ee504d5..00000000
--- a/ojt2/main.js
+++ /dev/null
@@ -1,146 +0,0 @@
- /* exported gapiLoaded */
- /* exported gisLoaded */
- /* exported handleAuthClick */
- /* exported handleSignoutClick */
-
- // Authorization scopes required by the API; multiple scopes can be
- // included, separated by spaces.
- const SCOPES = 'https://www.googleapis.com/auth/drive.metadata.readonly';
-
- // TODO(developer): Set to client ID and API key from the Developer Console
- const CLIENT_ID = '1027688762450-r0m066b7e42l6kqg0rlklk1qa3ttd1ij.apps.googleusercontent.com';
- const API_KEY = 'AIzaSyDARPEDd0WtdfvXJ6H7vTM2G_oG6dUraAw';
-
- // TODO(developer): Replace with your own project number from console.developers.google.com.
- const APP_ID = '1027688762450'; // 프로젝트번호
-
- let tokenClient;
- let accessToken = null;
- let pickerInited = false;
- let gisInited = false;
-
- /**
- * Callback after api.js is loaded.
- */
- function gapiLoaded() {
- gapi.load('client:picker', initializePicker);
- }
-
- /**
- * Callback after the API client is loaded. Loads the
- * discovery doc to initialize the API.
- */
- async function initializePicker() {
- await gapi.client.load('https://www.googleapis.com/discovery/v1/apis/drive/v3/rest');
- pickerInited = true;
- }
-
- /**
- * Callback after Google Identity Services are loaded.
- */
- function gisLoaded() {
- tokenClient = google.accounts.oauth2.initTokenClient({
- client_id: CLIENT_ID,
- scope: SCOPES,
- callback: '', // defined later
- });
- gisInited = true;
- }
-
- /**
- * Sign in the user upon button click.
- */
- function handleAuthClick() {
- tokenClient.callback = async (response) => {
- if (response.error !== undefined) {
- throw (response);
- }
- accessToken = response.access_token;
- await createPicker();
- };
-
- if (accessToken === null) {
- // Prompt the user to select a Google Account and ask for consent to share their data
- // when establishing a new session.
- tokenClient.requestAccessToken({prompt: 'consent'});
- } else {
- // Skip display of account chooser and consent dialog for an existing session.
- tokenClient.requestAccessToken({prompt: ''});
- }
- }
-
- /**
- * Sign out the user upon button click.
- */
- function handleSignoutClick() {
- if (accessToken) {
- accessToken = null;
- google.accounts.oauth2.revoke(accessToken);
- }
- }
-
- /**
- * Create and render a Picker object for searching images.
- */
- function createPicker() {
- const view = new google.picker.View(google.picker.ViewId.DOCS);
- //view.setMimeTypes('image/png,image/jpeg,image/jpg');
- const picker = new google.picker.PickerBuilder()
- .enableFeature(google.picker.Feature.NAV_HIDDEN)
- .enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
- .setDeveloperKey(API_KEY)
- .setAppId(APP_ID)
- .setOAuthToken(accessToken)
- .addView(view)
- .addView(new google.picker.DocsUploadView())
- .setCallback(pickerCallback)
- .build();
- picker.setVisible(true);
- }
-
- /**
- * Displays the file details of the user's selection.
- * @param {object} data - Containers the user selection from the picker
- */
- async function pickerCallback__(data) {
- if (data.action === google.picker.Action.PICKED) {
- var files = data[google.picker.Response.DOCUMENTS];
- var aData = new Array();
- var bData = new Array();
- for (var i=0; i