示例#1
0
        public ActionResult RQItemList(string queryString, string dbname)
        {
            RQLib.RQQueryForm.RQquery query = modelRepository.GetQuery(queryString); // stores query under appropriate view state according to query string

            if (!string.IsNullOrEmpty(queryString) && (queryString.StartsWith("Signature: R*")))
            {
                this.modelRepository.sortParameter = new SortParameter(SortParameter.SortOrderEnum.ByShelf);
            }
            ViewBag.docNo = HttpContext.Request.QueryString.Get("d") != null?HttpContext.Request.QueryString.Get("d") : query.DocId;

            ViewBag.HasAddPermit  = User.IsInRole("admin"); // Enable the add new button if user is allowed to add RQItems to the database.
            ViewBag.GetRQItemVerb = "ListViewState";        // Tell GetRQItem() in ResultViewer the appropiate verb for saving the user state.
            return(View("Index"));
        }
示例#2
0
        public ActionResult RQItemList(string verb, string queryString, string serviceId, string dbname)
        {
            if (!string.IsNullOrEmpty(queryString) && (queryString.StartsWith("Signature: R*")))
            {
                this.modelRepository.modelParameters.SortType = ModelParameters.SortTypeEnum.ByShelf;
            }

            if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "new") || (verb == RQResources.Views.Shared.SharedStrings.add)))
            {
                if (MvcRQ.Helpers.AccessRightsResolver.HasAddAccess())
                {
                    ViewBag.Title  = "RiQuest | Add";
                    ViewBag.Header = "Neues Dokument";
                    if (bClientEditing)
                    {
                        return(View("ClientEditor"));
                    }
                    else
                    {
                        ViewBag.EditButton1 = RQResources.Views.Shared.SharedStrings.add;
                        ViewBag.EditButton2 = RQResources.Views.Shared.SharedStrings.cancel;
                        return(View("EditRQItem", new RQItem()));
                    }
                }
                else
                {
                    throw new AccessViolationException("Not authorized for this function!");
                }
            }
            else if ((!string.IsNullOrEmpty(verb)) && (verb.ToLower() == "querylist"))
            {
                return(this.Content(modelRepository.GetModel(queryString, UserState.States.ListViewState).TransformModel(verb, 1, 0), "text/html", System.Text.Encoding.UTF8));
            }
            else if ((!string.IsNullOrEmpty(verb)) && (verb.ToLower() == "browselist"))
            {
                if (MvcRQ.Helpers.StateStorage.GetClasstreeOptionsState() == true)
                {
                    modelRepository.modelParameters.SortType = ModelParameters.SortTypeEnum.ByShelfClass;
                }
                return(this.Content(modelRepository.GetModel(queryString, UserState.States.BrowseViewState).TransformModel(verb, 1, 0), "text/html", System.Text.Encoding.UTF8));
            }
            else if (!string.IsNullOrEmpty(serviceId))
            {
                ViewBag.ServiceType = serviceId;
                ViewBag.TextSeg0    = "a list of RQItems";
                switch (serviceId)
                {
                case "mods":
                    throw new NotImplementedException("RiQuest data service not yet implemented for mods format.");

                case "oai_dc":
                    EnableXmlAttribute.XSLTransform = "~/xslt/rqi2dc.xslt";
                    break;

                case "srw_dc":
                    throw new NotImplementedException("RiQuest data service not yet implemented for srw_dc format.");

                case "info_ofi":
                    throw new NotImplementedException("RiQuest data service not yet implemented for info_ofi format.");

                case "rqi":
                    EnableXmlAttribute.XSLTransform = "";
                    break;

                case "rq":
                    EnableXmlAttribute.XSLTransform = "~/xslt/rqi2rq.xslt";
                    break;

                default:
                    throw new NotImplementedException("RiQuest data service not implemented for unknown format.");
                }
                return(View("ServRQItem", modelRepository.GetModel(queryString)));
            }
            else
            {
                ViewBag.docNo = HttpContext.Request.QueryString.Get("d") != null?HttpContext.Request.QueryString.Get("d") : modelRepository.GetQuery(queryString).DocId;

                ViewBag.HasAddPermit  = MvcRQ.Helpers.AccessRightsResolver.HasAddAccess(); // Enable the add new button if user is allowed to add RQItems ti the database.
                ViewBag.GetRQItemVerb = "QueryItem";                                       // Tell GetRQItem() in ResultViewer the appropiate verb for saving the user state.
                return(View("Index"));
            }
        }