コード例 #1
0
        public HxXWDocwayDocument(HxXWDatabase db, HxXWPerson pe, String nrecord, bool bLock) : base("doc", db, -1, bLock)
        {
            _person = pe;
            _nrecord = nrecord;
            _udName = "doc";
            _db = db;

            //look for document in case of wanted $nrecord
            if (nrecord.Length > 0)
            {
                load(nrecord, bLock);
            }
            else
            {
                _idIUnit = -1;
            }
        }
コード例 #2
0
ファイル: XDocNewDocProc.cs プロジェクト: xwcs/xwcs.trediws
        override public void ProcessRequest(HttpContext context)
        {
            init(context, false); //skip content type

            response.ContentType = "text/html";

            response.Write("<html>\r\n");
            response.Write("<head>\r\n");
            response.Write("<script type=\"text/javascript\">\r\n");
            response.Write("//<![CDATA[\r\n");
            response.Write("function execResult(){\r\n");

            try
            {
                String dbid	        = pms["dbid"];
                String repid        = pms["repid"];
		        String groupid	    = pms["groupid"];
                String sgroupid     = pms["sgroupid"];
		        String dataInizioPubb	= formatDateToXW(pms["dataInizioPubb"]);
		        String dataFinePubb 	= formatDateToXW(pms["dataFinePubb"]);
		        String oggetto		= pms["oggetto"];
		        String note 	    = pms["note"];
		        String op			= pms["opertion"];
                
		        HxXWPerson person = new HxXWPerson(session, config.dbCon.getDatabaseByName("acl"));
		        HxXWDatabase xw = config.dbCon.setCurrentDb(dbid);
		
		        HxXWDocwayDocument xdoc = new HxXWDocwayDocument(xw, person);
		        //repertorio
                String repertorio = config.repertories.getRepertorioXML(person, repid);
		        //extra
                String extra = "";
		        extra += "	<extra>";
                extra += "		<tivdata grp=\"" + groupid + "\" subgrp=\"" + sgroupid + "\" pub_from=\"" + dataInizioPubb + "\" pub_to=\"" + dataFinePubb + "\"/>";
		        extra += "	</extra>";
		
		        xdoc.create(oggetto, repertorio, extra);
		        xdoc.save();
		
		        HxXWResponse resp = null;
                //now add postit
		        if(note.Length > 0)
			        resp = xw.postIt(xdoc.idIUnit, note);
		
		        
                HttpContext postedContext = HttpContext.Current;
                //File Collection that was submitted with posted data
                HttpFileCollection Files = postedContext.Request.Files;

                //Make sure a file was posted
                string fileName = (string)postedContext.Request.Form["file"];
                //if (Files.Count == 1 && Files[0].ContentLength > 0 && fileName != null && fileName != ""){
                if (Files.Count == 1 && Files[0].ContentLength > 0)
                {
                    //The byte array we'll use to write the file with
                    byte[] binaryWriteArray = new byte[Files[0].InputStream.Length];
                    //Read in the file from the InputStream
                    Files[0].InputStream.Read(binaryWriteArray, 0, (int)Files[0].InputStream.Length);
                    //Open the file stream
                    /*
                    FileStream objfilestream = new FileStream("c:\\test.txt", FileMode.Create, FileAccess.ReadWrite);
                    objfilestream.Write(binaryWriteArray, 0, binaryWriteArray.Length);
                    objfilestream.Close();
                     */
                    xw.checkInContentFile(xdoc.idIUnit, Files[0].FileName, "", binaryWriteArray);
                }

		        if(op.CompareTo("godoc") == 0){
                    context.Response.Write("parent.loadDocument(" + xdoc.idIUnit + ");\r\n");
		        }else{
			        context.Response.Write("parent.continueNew();\r\n");
		        }
	        }catch(Exception e){
                context.Response.Write("alert(\"" + e.Message + "\");\r\n");
                context.Response.Write("parent.handleError();\r\n");
	        }
            context.Response.Write("}\r\n");
            context.Response.Write("//]]>\r\n");
            context.Response.Write("</script>\r\n");
            context.Response.Write("</head>\r\n");
            context.Response.Write("<body onload=\"execResult()\">\r\n");
            context.Response.Write("</body>\r\n");
            context.Response.Write("</html>\r\n");
        }
コード例 #3
0
ファイル: XDocNewDoc.cs プロジェクト: xwcs/xwcs.trediws
        override public void ProcessRequest(HttpContext context)
        {
            init(context);

            try
            {
                frm = loadFormTemplate("/" + layouts + "/xdoc/forms/newDocForm.htx");        

                
                //make replaces
                frm = frm.Replace("<?=$layouts?>",   layouts);
                frm = frm.Replace("<?=$target?>",    target);
                frm = frm.Replace("<?=$handler?>",   handler);
                frm = frm.Replace("<?=$skin?>",      skin);

                //repertories
                HxXWPerson personObject = new HxXWPerson(session, config.dbCon.getDatabaseById("ACL1"));

                Boolean hasRepertories = config.repertories.hasRepertories(personObject, true);
                //has repertories dependant peaces
                String hr_part1 = "";
                String hr_part2 = "";
                String hr_part3 = "";
                String hr_part4 = "";
                String hr_part5 = "";
                String hr_part6 = "";
                String repid = "";
                String groupid = "";
                String sgroupid = "";
                if (hasRepertories)
                {
                    hr_part1 = "<script type=\"text/javascript\" src=\"" + layouts + "/xdoc/js/repertoryCmbSupport.js\"></script>";

                    hr_part2 = @"
				        <div class=""formRow"">
					        <div class=""formCellFirst""><span>Repertorio: </span></div>
					        <div class=""formCellLast""><select name=""repid"" id=""repid"" class=""asInput"" onchange=""callChangeGroup(this.value)""></select></div>
					        <p class=""clearL""/>
				        </div>
				        <div class=""formRow"">
					        <div class=""formCellFirst"">Classificazione:</div>
					        <div class=""formCell""><span id=""grpLabel"">Tipo pubbl.:</span><br /><select name=""groupid"" id=""groupid"" class=""asInput""  onchange=""callChangeSGroup(document.getElementById('repid').value, this.value)""></select></div>
					        <div class=""formCellLast""><span id=""sgrpLabel"">Classificazione:</span><br /><select name=""sgroupid"" id=""sgroupid"" class=""asInput""></select></div>
					        <p class=""clearL""/>
				        </div>";

                    hr_part3 = config.repertories.dumpRepertories(personObject, true);
                    hr_part4 = "changeRepertory(reps, '-1');";
                    hr_part5 = "changeRepertory(reps, '" + repid + "');";
                    if (groupid != "")
                    {
                        hr_part5 += "changeGroup(reps, '" + repid + "', '" + groupid + "');";
                        if (sgroupid != "")
                        {
                            hr_part5 += "changeSGroup(reps, '" + repid + "', '" + groupid + "', '" + sgroupid + "');";
                        }
                    }
                    hr_part6 = @"
				        this.callChangeGroup = function(repid){
					        changeGroup(reps, repid);
				        };
				        this.callChangeSGroup = function(repid, groupid){
					        changeSGroup(reps, repid, groupid);
				        };";
                }

                frm = frm.Replace("<?=$hr_part1?>", hr_part1);
                frm = frm.Replace("<?=$hr_part2?>", hr_part2);
                frm = frm.Replace("<?=$hr_part3?>", hr_part3);
                frm = frm.Replace("<?=$hr_part4?>", hr_part4);
                frm = frm.Replace("<?=$hr_part5?>", hr_part5);
                frm = frm.Replace("<?=$hr_part6?>", hr_part6);

                //dblist
                XDocBase.Web.CONTAINER.Map dbList = config.dbCon.getDbList();
                String outDbList1 = "";
                String outDbListMore = "";
                if (dbList.Count <= 1)
                {
                    foreach (KeyValuePair<String, Object> p in dbList)
                    {
                        outDbList1 += "<input type=\"hidden\" name=\"dbid\" id=\"dbid\" value=\"" + p.Key + "\"/>";
                    }
                }
                else
                {
                    outDbListMore += @"<div  class=""formRow"">
			        	                <div class=""formCellFirst"">Archivio:</div>
			                        	<div class=""formCellLast""><select name=""dbid"" id=""dbid"" class=""asInput"">";
                    foreach (KeyValuePair<String, Object> p in dbList)
                    {
                        outDbListMore += "<option id=\"" + p.Key + "\" value=\"" + p.Key + "\">" + ((String)p.Value) + "</option>";
                    }
                    outDbListMore += @"		</select></div><p class=""clearL""/>
			                            </div>";
                }
                frm = frm.Replace("<?=$outDbList1?>", outDbList1);
                frm = frm.Replace("<?=$outDbListMore?>", outDbListMore);



                frm = frm.Replace("<?=$today?>", DateTime.Now.ToString("d"));
                frm = frm.Replace("<?=$today1M?>", DateTime.Now.AddMonths(1).ToString("d"));
                frm = frm.Replace("<?=$service?>", appSettings["xDocServicesPath"] + "/newdocproc." + appSettings["xDocServiceExt"]); 

                //render output
                context.Response.Write(frm);
            }
            catch (Exception ex)
            {
                context.Response.Write(new AjaxServiceError(ex, target != "" ? target : "xDocDesktopHolderID"));
            }
        }
コード例 #4
0
 public HxXWDocwayDocument(HxXWDatabase db, HxXWPerson pe, String nrecord)
     : this(db, pe, nrecord, false)
 {
 }
コード例 #5
0
 public HxXWDocwayDocument(HxXWDatabase db, HxXWPerson pe)
     : this(db, pe, "", false)
 {
 }