123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- /*
-
- (SMMNW04703.xrw - JScript )
- - Version :
- 1) : Ver.1.00.01
- - Desc : 피부욕창상처기록첨부파일 화면에서 사용하는 스크립트
- */
- var isUpdated = false;
- /**
- * @group :
- * @ver : 2008.05.31
- * @by : dhkim
- * @-------------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 화면을 초기화한다. 화면로딩이 끝난 시점에 호출된다.
- * @param :
- * @return :
- * @-------------------------------------------------------
- */
- function fInit(){
- model.removeNodeset("/root/main/list/reportlist");
- model.removeNodeset("/root/send/attach");
- model.resetInstanceNode("/root/send");
-
- var pid = opener.javascript.getParameter('pid');
- var grupcd = opener.javascript.getParameter('grupcd');
- var obsrecseq = opener.javascript.getParameter('obsrecseq');
-
- //alert(pid + grupcd + obsrecseq);
-
- if(pid != '' && grupcd != '' && obsrecseq != ''){
-
- model.removenode('/root/init');
- model.makeValue('/root/init/pid', pid);
- model.makeValue('/root/init/grupcd', grupcd);
- model.makeValue('/root/init/obsrecseq', obsrecseq);
-
- fSearch();
-
- }else{
- messageBox('화면을 초기화 할 수', 'I004');
- }
- }
-
-
-
- /**
- * @group :
- * @ver : 2008.05.31
- * @by : dhkim
- * @-------------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 조건에 해당하는 첨부파일을 조회한다.
- * @param :
- * @return :
- * @-------------------------------------------------------
- */
- function fSearch(){
- model.removenode('/root/send');
- model.makenode('/root/send');
- model.copyNode('/root/send', '/root/init');
-
- /*//그리드 초기화가 안되서 임시방편.. 수정할것!
- for(var i = 1; i <= grd_report.rows; i++){
- grd_report.deleteRow(i);
- }
- //그리드 초기화가 안되서 임시방편.. 수정할것!
- for(var i = 1; i <= grd_attach.rows; i++){
- grd_attach.deleteRow(i);
- }*/
-
- if(!submit('TRMNW04704')){
- messageBox('첨부파일 조회를', 'E009');
- }else{
- model.refresh();
- }
- }
- /**
- * @group :
- * @ver : 2008.06.16
- * @by : dhkim
- * @-------------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 첨부파일을 그리드에 추가한다.
- * @param :
- * @return :
- * @-------------------------------------------------------
- */
- function fAddRow(){
- var maxsize = upload1.attribute("filesize");
-
- files = window.fileDialog("open", "|", true);
- filelist = files.split("|");
- for(var i = 0 ; i < filelist.length ; i++ ) {
- grd_attach.addRow(false);
- grd_attach.valueMatrix(grd_attach.rows - 1, 0) = filelist[i];
- grd_report.addRow(false);
- grd_report.valueMatrix(grd_report.rows - 1, 0) = filelist[i];
- if (!checkFileSize(upload1)){
- grd_attach.removeItem();
- grd_report.removeItem();
- messageBox("파일 크기가 최대치("+maxsize+"Byte)를", "E003");
- }else{
- isUpdated = true;
- }
- }
- }
- /**
- * @group :
- * @ver : 2008.06.16
- * @by : dhkim
- * @-------------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 첨부파일을 저장한다.
- * @param :
- * @return :
- * @-------------------------------------------------------
- */
- function fSave(){
- if(grd_report.rows < 1 || !isUpdated){
- return;
- }
-
- if(submit("TXMNW04701")) {
- model.removeNodeset("/root/send/attach");
- model.resetInstanceNode("/root/send/title");
- model.refresh();
- }else{
- messageBox('첨부파일 저장을', 'E009');
- return ;
- }
-
- }
- /**
- * @group :
- * @ver : 2008.06.16
- * @by : dhkim
- * @-------------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 선택한 첨부파일을 삭제한다.
- * @param :
- * @return :
- * @-------------------------------------------------------
- */
- function fDelete(cur_row){
-
-
- if(cur_row < 0){
- messageBox('삭제할 파일을', 'C002');
- return;
- }else{
-
- var rptid = model.getValue("/root/main/list/reportlist["+cur_row+"]/reportid");
- var pid = model.getValue("/root/main/list/reportlist["+cur_row+"]/pid");
- var grupcd = model.getValue("/root/main/list/reportlist["+cur_row+"]/grupcd");
- var obsrecseq = model.getValue("/root/main/list/reportlist["+cur_row+"]/obsrecseq");
- var filenm = model.getValue("/root/main/list/reportlist["+cur_row+"]/filenm");
- var filesize = model.getValue("/root/main/list/reportlist["+cur_row+"]/filesize");
- var filetype = model.getValue("/root/main/list/reportlist["+cur_row+"]/filetype");
- var filepath = model.getValue("/root/main/list/reportlist["+cur_row+"]/filepath");
-
- //alert(rptid + ', ' + pid+ ', ' + grupcd + ', ' + obsrecseq + ', ' + filenm + ', ' + filesize + ', ' + filetype + ', ' + filepath);
-
- model.removenode("/root/send");
- model.makeValue('/root/send/reportid', rptid);
- model.makeValue('/root/send/pid', pid);
- model.makeValue('/root/send/grupcd', grupcd);
- model.makeValue('/root/send/obsrecseq', obsrecseq);
- model.makeValue('/root/send/filenm', filenm);
- model.makeValue('/root/send/filesize', filesize);
- model.makeValue('/root/send/filetype', filetype);
- model.makeValue('/root/send/filepath', filepath);
-
-
- if(!submit("TXMNW04702")){
- messageBox('첨부파일의 삭제를', 'E009');
- }
- }
-
- }
- /**
- * @group :
- * @ver : 2008.05.31
- * @by : dhkim
- * @-------------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 저장되 있는 첨부파일을 다운로드 한다.
- * 이미지가 아니면 pc에 미리 저장한 후 파일을 연다.(미구현)
- * @param :
- * @return :
- * @-------------------------------------------------------
- */
- function fDownLoad(){
- //저장되어 있는 파일만 열 수 있다.
- if(model.getValue('/root/main/list/reportlist[' + (grd_report.row) + ']/reportid') != ''){
- //alert(getActionURL("TRMNW04706"));
- var idx = grd_report.row;
- var filepath = model.getValue("/root/main/list/reportlist["+idx+"]/filepath");
- var filenm = model.getValue("/root/main/list/reportlist["+idx+"]/filenm");
- //var isImg = fIsImg(filenm);
- var realfile = getActionURL("TRMNW04706") + "&filepath=" + filepath;
-
-
- var localfile = window.fileDialog("save", "|", false, filenm, "", "All Files(*.*)|*.*");
- if (localfile != "") {
- model.download(realfile, localfile);
- window.exec(localfile);
- }
-
- /*
- if(isImg){
- alert(realfile);
- return;
- window.exec(realfile);
- }else{
- var localfile = window.fileDialog("save", "|", false, filenm, "", "All Files(*.*)|*.*");
- if (localfile != "") {
- model.download(realfile, localfile);
- window.exec(localfile);
- }
- }
- */
-
- }
-
- }
- /**
- * @group :
- * @ver : 2008.05.31
- * @by : dhkim
- * @-------------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 해당 파일 확장자가 이미지 파일인지 아닌지 판단한다.
- * @param :
- * @return :
- * @-------------------------------------------------------
- */
- function fIsImg(file){
- var pos = file.toString().lastIndexOf('.');
- var ext = file.toString().substring(pos+1).toLowerCase();
-
- if(ext != 'jpg' || ext != 'jpeg' || ext != 'bmp' || ext != 'gif' || ext != 'png' || ext != 'tif' || ext != 'tiff'
- || ext != 'tga' || ext != 'pdf' || ext != 'psd' || ext != 'cdr' || ext != 'drw' || ext != 'dxf' || ext != 'kdc'
- || ext != 'pcd' || ext != 'swf'){
- //alert('img');
- return true;
- }else{
- //alert('is not img');
- return false;
- }
- }
|