<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ITSWebMgmt
{
    public partial class CreateWorkItem : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {


            if (!IsPostBack)
            {
                var userID = Request.QueryString["userID"];
                var userDisplayName = Request.QueryString["userDisplayName"];

                tb_affectedUser.Text = userDisplayName;



            }

        }

        protected void createRedirectCode(string userID, string displayName, string title, string description, string submiturl)
        {
            
            Response.Clear();
            string jsondata = "{\"Title\":\"" + title + "\",\"Description\":\"" + description + "\",\"RequestedWorkItem\":{\"BaseId\":\"" + userID + "\",\"DisplayName\":\"" + displayName + "\",}}";
            var sb = new StringBuilder();

            sb.Append("<html><head>");
            //sb.Append("<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js\" ></script>");
            sb.Append("</head>");
            sb.Append(@"<body onload='document.forms[""form""].submit()'>");

            sb.Append("<form name='form' target='_blank' method='post' action='" + submiturl + "'>");
            
            sb.Append("<input hidden='true' name='vm' value='"+jsondata+"'/>");
            sb.Append("<input type='submit' value='Recreate IR/SR (if someting whent wrong)' />");

            sb.Append(@"<br /><br /><a href=""#"" onclick=""window.history.go(-2); return false;""> Go back to UserInfo </a>");
                    
            sb.Append("</form>");
            sb.Append("</body></html>");
            Response.Write(sb.ToString());
            Response.End();


        }


        protected void createForm(string url){
                createRedirectCode(Request.QueryString["userID"], tb_affectedUser.Text, tb_title.Text, tb_description.Text, url);
        
        }
        protected void createSR_OnClick(object sender, EventArgs e)
        {
            createForm("https://service.aau.dk/ServiceRequest/New/");
        }

        protected void createIR_OnClick(object sender, EventArgs e)
        {

            createForm("https://service.aau.dk/Incident/New/");
        
        }
    }
}<commit_msg>Bugfix CreateWorkItem now keeps linebreaks<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ITSWebMgmt
{
    public partial class CreateWorkItem : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {


            if (!IsPostBack)
            {
                var userID = Request.QueryString["userID"];
                var userDisplayName = Request.QueryString["userDisplayName"];

                tb_affectedUser.Text = userDisplayName;



            }

        }

        protected void createRedirectCode(string userID, string displayName, string title, string description, string submiturl)
        {
            
            Response.Clear();
            string jsondata = "{\"Title\":\"" + title + "\",\"Description\":\"" + description + "\",\"RequestedWorkItem\":{\"BaseId\":\"" + userID + "\",\"DisplayName\":\"" + displayName + "\",}}";
            var sb = new StringBuilder();

            sb.Append("<html><head>");
            //sb.Append("<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js\" ></script>");
            sb.Append("</head>");
            sb.Append(@"<body onload='document.forms[""form""].submit()'>");

            sb.Append("<form name='form' target='_blank' method='post' action='" + submiturl + "'>");
            
            sb.Append("<input hidden='true' name='vm' value='"+jsondata+"'/>");
            sb.Append("<input type='submit' value='Recreate IR/SR (if someting whent wrong)' />");

            sb.Append(@"<br /><br /><a href=""#"" onclick=""window.history.go(-2); return false;""> Go back to UserInfo </a>");
                    
            sb.Append("</form>");
            sb.Append("</body></html>");
            Response.Write(sb.ToString());
            Response.End();


        }


        protected void createForm(string url){
            string descriptionConverted = tb_description.Text.Replace("\n", "\\n").Replace("\r", "\\r");
            createRedirectCode(Request.QueryString["userID"], tb_affectedUser.Text, tb_title.Text, descriptionConverted, url);        
        }
        protected void createSR_OnClick(object sender, EventArgs e)
        {
            createForm("https://service.aau.dk/ServiceRequest/New/");
        }

        protected void createIR_OnClick(object sender, EventArgs e)
        {

            createForm("https://service.aau.dk/Incident/New/");
        
        }
    }
}
{'fraction_non_alphanumeric': 0.16480891719745222, 'fraction_numerical': 0.0019904458598726115, 'mean_word_length': 2.200636942675159, 'pattern_counts': {'":': 10, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1535486', 'n_tokens_mistral': 1444, 'n_tokens_neox': 1374, 'n_words': 265}