A container for parameters to be passed to the ViewerLoader javascript class.
예제 #1
0
    public static JsonWrappers.ViewerLoadParams Step1_Submit(string TitleInput, string DescriptionInput, string TagsInput)
    {
        FileStatus currentStatus = (FileStatus)HttpContext.Current.Session["fileStatus"];
        var        fileName      = TitleInput.Trim().Replace(' ', '_').ToLower();

        if (currentStatus.hashname.LastIndexOf(".skp") != -1)
        {
            fileName += ".skp";
        }
        else
        {
            fileName += ".zip";
        }
        if (currentStatus != null)
        {
            currentStatus.filename = fileName;
        }

        ContentObject tempFedoraCO = (ContentObject)HttpContext.Current.Session["contentObject"];

        tempFedoraCO.PID = "";

        HttpServerUtility serverUtil = HttpContext.Current.Server;

        tempFedoraCO.Title       = serverUtil.HtmlEncode(TitleInput.Trim());
        tempFedoraCO.Description = serverUtil.HtmlEncode(DescriptionInput.Trim());

        if (currentStatus.type == FormatType.VIEWABLE)
        {
            tempFedoraCO.Location = fileName.Replace(".skp", ".zip");
        }

        string cleanTags = "";

        foreach (string s in TagsInput.Split(','))
        {
            cleanTags += s.Trim() + ",";
        }
        cleanTags             = serverUtil.HtmlEncode(cleanTags.Trim(','));
        tempFedoraCO.Keywords = cleanTags;

        JsonWrappers.ViewerLoadParams jsReturnParams = new JsonWrappers.ViewerLoadParams();


        if (currentStatus.type == FormatType.VIEWABLE)
        {
            tempFedoraCO.DisplayFile       = currentStatus.filename.Replace("zip", "o3d").Replace("skp", "o3d");
            jsReturnParams.IsViewable      = true;
            jsReturnParams.BasePath        = "../Public/Serve.ashx?mode=PreviewTempModel";
            jsReturnParams.TempArchiveName = currentStatus.hashname.Replace("skp", "zip");
            jsReturnParams.UpAxis          = tempFedoraCO.UpAxis;
            jsReturnParams.UnitScale       = tempFedoraCO.UnitScale;
            jsReturnParams.NumPolygons     = tempFedoraCO.NumPolygons;
        }
        HttpContext.Current.Session["contentObject"] = tempFedoraCO;
        return(jsReturnParams);
    }
예제 #2
0
    public static JsonWrappers.ViewerLoadParams Step1_Submit(string TitleInput, string DescriptionInput, string TagsInput)
    {
        FileStatus currentStatus = (FileStatus)HttpContext.Current.Session["fileStatus"];
        var fileName = TitleInput.Trim().Replace(' ', '_').ToLower();

        if (currentStatus.hashname.LastIndexOf(".skp") != -1)
        {
            fileName += ".skp";
        }
        else
        {
            fileName += ".zip";
        }
        if (currentStatus != null)
        {
            currentStatus.filename = fileName;
        }

        ContentObject tempFedoraCO = (ContentObject)HttpContext.Current.Session["contentObject"];
        tempFedoraCO.PID = "";

        HttpServerUtility serverUtil = HttpContext.Current.Server;

        tempFedoraCO.Title = serverUtil.HtmlEncode(TitleInput.Trim());
        tempFedoraCO.Description = serverUtil.HtmlEncode(DescriptionInput.Trim());

        if(currentStatus.type == FormatType.VIEWABLE)
            tempFedoraCO.Location = fileName.Replace(".skp", ".zip");

        string cleanTags = "";
        foreach (string s in TagsInput.Split(','))
        {
            cleanTags += s.Trim() + ",";
        }
        cleanTags = serverUtil.HtmlEncode(cleanTags.Trim(','));
        tempFedoraCO.Keywords = cleanTags;

        JsonWrappers.ViewerLoadParams jsReturnParams = new JsonWrappers.ViewerLoadParams();

        if (currentStatus.type == FormatType.VIEWABLE)
        {
            tempFedoraCO.DisplayFile = currentStatus.filename.Replace("zip", "o3d").Replace("skp", "o3d");
            jsReturnParams.IsViewable = true;
            jsReturnParams.BasePath = "../Public/Serve.ashx?mode=PreviewTempModel";
            jsReturnParams.TempArchiveName = currentStatus.hashname.Replace("skp", "zip");
            jsReturnParams.UpAxis = tempFedoraCO.UpAxis;
            jsReturnParams.UnitScale = tempFedoraCO.UnitScale;
            jsReturnParams.NumPolygons = tempFedoraCO.NumPolygons;
        }
        HttpContext.Current.Session["contentObject"] = tempFedoraCO;
        return jsReturnParams;
    }