当前位置: 首页>>代码示例>>C#>>正文


C# SobekCM_Navigation_Object.Redirect方法代码示例

本文整理汇总了C#中SobekCM.Library.Navigation.SobekCM_Navigation_Object.Redirect方法的典型用法代码示例。如果您正苦于以下问题:C# SobekCM_Navigation_Object.Redirect方法的具体用法?C# SobekCM_Navigation_Object.Redirect怎么用?C# SobekCM_Navigation_Object.Redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SobekCM.Library.Navigation.SobekCM_Navigation_Object的用法示例。


在下文中一共展示了SobekCM_Navigation_Object.Redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Builder_AdminViewer

        /// <summary> Constructor for a new instance of the Builder_AdminViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public Builder_AdminViewer(User_Object User, SobekCM_Navigation_Object Current_Mode)
            : base(User)
        {
            currentMode = Current_Mode;

            // Ensure the user is the system admin
            if ((User == null) || ((!User.Is_System_Admin) && (!User.Is_Portal_Admin )))
            {
                Current_Mode.Mode = Display_Mode_Enum.My_Sobek;
                Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Home;
                Current_Mode.Redirect();
                return;
            }

               // If this is a postback, handle any events first
            if ((Current_Mode.isPostBack) && ( User.Is_System_Admin ))
            {
                // Pull the hidden value
                string save_value = HttpContext.Current.Request.Form["admin_builder_tosave"].ToUpper().Trim();
                if (save_value.Length > 0)
                {
                    // Set this value
                    SobekCM_Database.Set_Setting("Builder Operation Flag", save_value);
                    Current_Mode.Redirect();
                }
            }
        }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:30,代码来源:Builder_AdminViewer.cs

示例2: ManageMenu_ItemViewer

        /// <summary> Constructor for a new instance of the ManageMenu_ItemViewer class </summary>
        /// <param name="Current_Object"> Digital resource to display </param>
        /// <param name="Current_User"> Current user for this session </param>
        /// <param name="Current_Mode"> Navigation object which encapsulates the user's current request </param>
        public ManageMenu_ItemViewer(SobekCM_Item Current_Object, User_Object Current_User, SobekCM_Navigation_Object Current_Mode)
        {
            // Save the current user and current mode information (this is usually populated AFTER the constructor completes,
            // but in this case (QC viewer) we need the information for early processing
            CurrentMode = Current_Mode;
            CurrentUser = Current_User;
            CurrentItem = Current_Object;

            // Determine if this user can edit this item
            if (CurrentUser == null)
            {
                Current_Mode.ViewerCode = String.Empty;
                Current_Mode.Redirect();
                return;
            }
            else
            {
                bool userCanEditItem = CurrentUser.Can_Edit_This_Item(CurrentItem);
                if (!userCanEditItem)
                {
                    Current_Mode.ViewerCode = String.Empty;
                    Current_Mode.Redirect();
                    return;
                }
            }
        }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:30,代码来源:ManageMenu_ItemViewer.cs

示例3: Google_Coordinate_Entry_ItemViewer

        /// <summary> init viewer instance </summary>
        public Google_Coordinate_Entry_ItemViewer(User_Object Current_User, SobekCM_Item Current_Item, SobekCM_Navigation_Object Current_Mode)
        {
            try
            {

            CurrentUser = Current_User;
            CurrentItem = Current_Item;
            CurrentMode = Current_Mode;

            //string resource_directory = SobekCM_Library_Settings.Image_Server_Network + CurrentItem.Web.AssocFilePath;
            //string current_mets = resource_directory + CurrentItem.METS_Header.ObjectID + ".mets.xml";

            // If there is no user, send to the login
            if (CurrentUser == null)
            {
                CurrentMode.Mode = Display_Mode_Enum.My_Sobek;
                CurrentMode.My_Sobek_Type = My_Sobek_Type_Enum.Logon;
                CurrentMode.Return_URL = Current_Item.BibID + "/" + Current_Item.VID + "/mapedit";
                CurrentMode.Redirect();
                return;
            }

            //holds actions from page
            string action = HttpContext.Current.Request.Form["action"] ?? String.Empty;
            string payload = HttpContext.Current.Request.Form["payload"] ?? String.Empty;

            // See if there were hidden requests
            if (!String.IsNullOrEmpty(action))
            {
               if ( action == "save")
                   SaveContent(payload);
            }

            ////create a backup of the mets
            //string backup_directory = SobekCM_Library_Settings.Image_Server_Network + Current_Item.Web.AssocFilePath + SobekCM_Library_Settings.Backup_Files_Folder_Name;
            //string backup_mets_name = backup_directory + "\\" + CurrentItem.METS_Header.ObjectID + "_" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + ".mets.bak";
            //File.Copy(current_mets, backup_mets_name);

            }
            catch (Exception ee)
            {
                //Custom_Tracer.Add_Trace("MapEdit Start Failure");
                throw new ApplicationException("MapEdit Start Failure");
            }
        }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:46,代码来源:Google_Coordinate_Entry_ItemViewer.cs

示例4: Preferences_HtmlSubwriter

        /// <summary> Constructor for a new instance of the Preferences_HtmlSubwriter class </summary>
        public Preferences_HtmlSubwriter( SobekCM_Navigation_Object Current_Mode )
        {
            currentMode = Current_Mode;

            // See if there was a hidden request
            string hidden_request = HttpContext.Current.Request.Form["hidden_request"] ?? String.Empty;

            if (hidden_request == "submit")
            {
                NameValueCollection form = HttpContext.Current.Request.Form;

                string language_option = form["languageDropDown"];
                switch (language_option)
                {
                    case "en":
                        currentMode.Language = Web_Language_Enum.English;
                        break;

                    case "fr":
                        currentMode.Language = Web_Language_Enum.French;
                        break;

                    case "es":
                        currentMode.Language = Web_Language_Enum.Spanish;
                        break;

                }

                string defaultViewDropDown = form["defaultViewDropDown"];
                HttpContext.Current.Session["User_Default_View"] = defaultViewDropDown;

                int user_sort = Convert.ToInt32(form["defaultSortDropDown"]);
                HttpContext.Current.Session["User_Default_Sort"] = user_sort;

                currentMode.Mode = Display_Mode_Enum.Aggregation;
                currentMode.Aggregation_Type = Aggregation_Type_Enum.Home;
                currentMode.Redirect();

            }
        }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:41,代码来源:Preferences_HtmlSubwriter.cs

示例5: Users_AdminViewer

        /// <summary> Constructor for a new instance of the Users_AdminViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="currentMode"> Mode / navigation information for the current request</param>
        /// <param name="Code_Manager"> List of valid collection codes, including mapping from the Sobek collections to Greenstone collections</param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks> Postback from a user edit or from reseting a user's password is handled here in the constructor </remarks>
        public Users_AdminViewer(User_Object User, SobekCM_Navigation_Object currentMode, Aggregation_Code_Manager Code_Manager, Custom_Tracer Tracer)
            : base(User)
        {
            Tracer.Add_Trace("Users_AdminViewer.Constructor", String.Empty);

            this.currentMode = currentMode;

            // Ensure the user is the system admin
            if ((User == null) || (!User.Is_System_Admin))
            {
                currentMode.Mode = Display_Mode_Enum.My_Sobek;
                currentMode.My_Sobek_Type = My_Sobek_Type_Enum.Home;
                currentMode.Redirect();
                return;
            }

            // Set the action message to clear initially
            actionMessage = String.Empty;
            codeManager = Code_Manager;

            // Get the user to edit, if there was a user id in the submode
            editUser = null;
            if (currentMode.My_Sobek_SubMode.Length > 0)
            {
                try
                {
                    int edit_userid = Convert.ToInt32(currentMode.My_Sobek_SubMode.Replace("a", "").Replace("b", "").Replace("c", "").Replace("v", ""));

                    // Check this admin's session for this user object
                    Object sessionEditUser = HttpContext.Current.Session["Edit_User_" + edit_userid];
                    if (sessionEditUser != null)
                        editUser = (User_Object)sessionEditUser;
                    else
                    {
                        editUser = SobekCM_Database.Get_User(edit_userid, Tracer);
                        editUser.Should_Be_Able_To_Edit_All_Items = false;
                        if (editUser.Editable_Regular_Expressions.Any(thisRegularExpression => thisRegularExpression == "[A-Z]{2}[A-Z|0-9]{4}[0-9]{4}"))
                        {
                            editUser.Should_Be_Able_To_Edit_All_Items = true;
                        }
                    }
                }
                catch (Exception)
                {
                    actionMessage = "Error while handing your request";
                }
            }

            // Determine the mode
            mode = Users_Admin_Mode_Enum.List_Users_And_Groups;
            if (editUser != null)
            {
                mode = currentMode.My_Sobek_SubMode.IndexOf("v") > 0 ? Users_Admin_Mode_Enum.View_User : Users_Admin_Mode_Enum.Edit_User;
            }
            else
            {
                currentMode.My_Sobek_SubMode = String.Empty;
            }

            // Perform post back work
            if (currentMode.isPostBack)
            {
                if (mode == Users_Admin_Mode_Enum.List_Users_And_Groups)
                {
                    try
                    {
                        string reset_value = HttpContext.Current.Request.Form["admin_user_reset"];
                        if (reset_value.Length > 0)
                        {
                            int userid = Convert.ToInt32(reset_value);
                            User_Object reset_user = SobekCM_Database.Get_User(userid, Tracer);

                            // Create the random password
                            StringBuilder passwordBuilder = new StringBuilder();
                            Random randomGenerator = new Random(DateTime.Now.Millisecond);
                            while (passwordBuilder.Length < 12)
                            {
                                switch (randomGenerator.Next(0, 3))
                                {
                                    case 0:
                                        int randomNumber = randomGenerator.Next(65, 91);
                                        if ((randomNumber != 79) && (randomNumber != 75)) // Omit the 'O' and the 'K', confusing
                                            passwordBuilder.Append((char)randomNumber);
                                        break;

                                    case 1:
                                        int randomNumber2 = randomGenerator.Next(97, 123);
                                        if ((randomNumber2 != 111) && (randomNumber2 != 108) && (randomNumber2 != 107))  // Omit the 'o' and the 'l' and the 'k', confusing
                                            passwordBuilder.Append((char)randomNumber2);
                                        break;

                                    case 2:
                                        // Zero and one is omitted in this range, confusing
                                        int randomNumber3 = randomGenerator.Next(50, 58);
//.........这里部分代码省略.........
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:Users_AdminViewer.cs

示例6: Portals_AdminViewer

        /// <summary> Constructor for a new instance of the Portals_AdminViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="URL_Portals"> List of all web portals into this system </param>
        /// <param name="Web_Skin_Collection"> Contains the collection of all the default skins and the data to create any additional skins on request</param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        public Portals_AdminViewer(User_Object User, SobekCM_Navigation_Object Current_Mode, Portal_List URL_Portals, SobekCM_Skin_Collection Web_Skin_Collection, Custom_Tracer Tracer)
            : base(User)
        {
            Tracer.Add_Trace("Portals_AdminViewer.Constructor", String.Empty);

            portals = URL_Portals;
            skinCollection = Web_Skin_Collection;

            // Save the mode
            currentMode = Current_Mode;

            // Set action message to nothing to start
            actionMessage = String.Empty;

            // If the user cannot edit this, go back
            if (( user == null ) || ((!user.Is_System_Admin) && ( !user.Is_Portal_Admin )))
            {
                Current_Mode.Mode = Display_Mode_Enum.My_Sobek;
                Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Home;
                currentMode.Redirect();
                return;
            }

            // Handle any post backs
            if ((Current_Mode.isPostBack) && ( user.Is_System_Admin ))
            {
                try
                {
                    // Pull the standard values from the form
                    NameValueCollection form = HttpContext.Current.Request.Form;
                    string save_value = form["admin_portal_tosave"];
                    string action_value = form["admin_portal_action"];

                    // Switch, depending on the request
                    if (action_value != null)
                    {
                        switch (action_value.Trim().ToLower())
                        {
                            case "edit":
                                // Get the values from the form for this new portal
                                string edit_name = form["form_portal_name"].Trim();
                                string edit_abbr = form["form_portal_abbr"].Trim();
                                string edit_skin = form["form_portal_skin"].Trim();
                                string edit_aggr = form["form_portal_aggregation"].Trim();
                                string edit_url = form["form_portal_url"].Trim();
                                string edit_purl = form["form_portal_purl"].Trim();
                                int portalid = Convert.ToInt32(save_value);

                                // Look for this to see if this was the pre-existing default
                                bool isDefault = portals.Default_Portal.ID == portalid;

                                // Don't edit if the URL segment is empty and this is NOT default
                                if ((!isDefault) && (edit_url.Trim().Length == 0))
                                {
                                    actionMessage = "ERROR: Non default portals MUST have a url segment associated.";
                                }
                                else
                                {
                                    // Now, save this portal information
                                    int edit_id = SobekCM_Database.Edit_URL_Portal(portalid, edit_url, true, isDefault, edit_abbr, edit_name, edit_aggr, edit_skin, edit_purl, Tracer);
                                    if (edit_id > 0)
                                        actionMessage = "Edited existing URL portal '" + edit_name + "'";
                                    else
                                        actionMessage = "Error editing URL portal.";
                                }
                                break;

                            case "delete":
                                actionMessage = SobekCM_Database.Delete_URL_Portal(Convert.ToInt32(save_value), Tracer) ? "URL portal deleted" : "Error deleting the URL portal";
                                break;

                            case "new":
                                // Get the values from the form for this new portal
                                string new_name = form["admin_portal_name"];
                                string new_abbr = form["admin_portal_abbr"];
                                string new_skin = form["admin_portal_skin"];
                                string new_aggr = form["admin_portal_aggregation"];
                                string new_url = form["admin_portal_url"];
                                string new_purl = form["admin_portal_purl"];

                                // Save this to the database
                                int new_id = SobekCM_Database.Edit_URL_Portal(-1, new_url, true, false, new_abbr, new_name, new_aggr, new_skin, new_purl, Tracer);
                                if (new_id > 0)
                                    actionMessage = "Saved new URL portal '" + new_name + "'";
                                else
                                    actionMessage = "Error saving URL portal.";
                                break;
                        }
                    }
                }
                catch (Exception)
                {
                    actionMessage = "Exception caught while handling request";
                }
//.........这里部分代码省略.........
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:Portals_AdminViewer.cs

示例7: Edit_Item_Metadata_MySobekViewer

        /// <summary> Constructor for a new instance of the Edit_Item_Metadata_MySobekViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="All_Items_Lookup"> Allows individual items to be retrieved by various methods as <see cref="Single_Item"/> objects.</param>
        /// <param name="Current_Item"> Individual digital resource to be edited by the user </param>
        /// <param name="Code_Manager"> Code manager contains the list of all valid aggregation codes </param>
        /// <param name="HTML_Skin"> HTML Web skin which controls the overall appearance of this digital library </param>
        /// <param name="Icon_Table"> Dictionary of all the wordmark/icons which can be tagged to the items </param>
        /// <param name="HTML_Skin_Collection"> HTML Web skin collection which controls the overall appearance of this digital library </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        public Edit_Item_Metadata_MySobekViewer(User_Object User,
            SobekCM_Navigation_Object Current_Mode,
            Item_Lookup_Object All_Items_Lookup,
            SobekCM_Item Current_Item, Aggregation_Code_Manager Code_Manager,
            Dictionary<string, Wordmark_Icon> Icon_Table,
            SobekCM_Skin_Object HTML_Skin,
            Language_Support_Info Translator,
            SobekCM_Skin_Collection HTML_Skin_Collection,
            Custom_Tracer Tracer)
            : base(User)
        {
            Tracer.Add_Trace("Edit_Item_Metadata_MySobekViewer.Constructor", String.Empty);

            currentMode = Current_Mode;
            item = Current_Item;
            itemList = All_Items_Lookup;
            codeManager = Code_Manager;
            iconList = Icon_Table;
            webSkin = HTML_Skin;
            popUpFormsHtml = String.Empty;
            delayed_popup = String.Empty;
            base.Translator = Translator;
            skins = HTML_Skin_Collection;

            // If the user cannot edit this item, go back
            if (!user.Can_Edit_This_Item( item ))
            {
                currentMode.My_Sobek_Type = My_Sobek_Type_Enum.Home;
                HttpContext.Current.Response.Redirect(currentMode.Redirect_URL());
            }

            // Is this a project
            isProject = item.Bib_Info.SobekCM_Type == TypeOfResource_SobekCM_Enum.Project;

            string template_code = user.Edit_Template_Code;
            if ((isProject) || (item.Contains_Complex_Content) || (item.Using_Complex_Template))
            {
                template_code = user.Edit_Template_MARC_Code;
            }
            template = Cached_Data_Manager.Retrieve_Template(template_code, Tracer);
            if (template != null)
            {
                Tracer.Add_Trace("Edit_Item_Metadata_MySobekViewer.Constructor", "Found template in cache");
            }
            else
            {
                Tracer.Add_Trace("Edit_Item_Metadata_MySobekViewer.Constructor", "Reading template file");

                // Read this template
                Template_XML_Reader reader = new Template_XML_Reader();
                template = new Template();
                reader.Read_XML( SobekCM_Library_Settings.Base_MySobek_Directory + "templates\\edit\\" + template_code + ".xml", template, true);

                // Add the current codes to this template
                template.Add_Codes(Code_Manager);

                // Save this into the cache
                Cached_Data_Manager.Store_Template(template_code, template, Tracer);
            }

            // Get the current page number, or default to 1
            page = 1;
            if (currentMode.My_Sobek_SubMode.Length > 0)
            {
                if ((currentMode.My_Sobek_SubMode == "preview") || (currentMode.My_Sobek_SubMode == "marc") || (currentMode.My_Sobek_SubMode == "mets"))
                {
                    page = 0;
                }
                else
                {
                    page = 1;
                    bool isNumber = currentMode.My_Sobek_SubMode.All(Char.IsNumber);
                    if (isNumber)
                    {
                        if (isProject)
                            Double.TryParse(currentMode.My_Sobek_SubMode[0].ToString(), out page);
                        else
                            Double.TryParse(currentMode.My_Sobek_SubMode, out page);
                    }
                    else if ( isProject )
                    {
                        if ( Char.IsNumber(currentMode.My_Sobek_SubMode[0]))
                            Double.TryParse(currentMode.My_Sobek_SubMode[0].ToString(), out page);
                    }
                }
            }

            // Handle post backs
            if (Current_Mode.isPostBack)
//.........这里部分代码省略.........
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:Edit_Item_Metadata_MySobekViewer.cs

示例8: IP_Restrictions_AdminViewer

        /// <summary> Constructor for a new instance of the IP_Restrictions_AdminViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="CurrentMode"> Mode / navigation information for the current request</param>
        /// <param name="IP_Restrictions"> List of all IP restrictions ranges used in this digital library to restrict access to certain digital resources </param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks> Postback from handling an edit or new item aggregation alias is handled here in the constructor </remarks>
        public IP_Restrictions_AdminViewer( User_Object User, SobekCM_Navigation_Object CurrentMode, IP_Restriction_Ranges IP_Restrictions, Custom_Tracer Tracer )
            : base(User)
        {
            Tracer.Add_Trace("IP_Restrictions_AdminViewer.Constructor", String.Empty);

            ipRestrictionInfo = IP_Restrictions;
            currentMode = CurrentMode;

            // Ensure the user is the system admin
            if ((User == null) || ((!User.Is_System_Admin) && ( !User.Is_Portal_Admin )))
            {
                currentMode.Mode = Display_Mode_Enum.My_Sobek;
                currentMode.My_Sobek_Type = My_Sobek_Type_Enum.Home;
                currentMode.Redirect();
                return;
            }

            // Determine if there is an specific IP address range for editing
            index = -1;
            if (currentMode.My_Sobek_SubMode.Length > 0)
            {
                if ( !Int32.TryParse(currentMode.My_Sobek_SubMode, out index ))
                    index = -1;
            }

            // If there was an index included, try to pull the information about it
            thisRange = null;
            details = null;
            if ((index >= 1) && (index <= ipRestrictionInfo.Count))
            {
                thisRange = ipRestrictionInfo[index - 1];
                if (thisRange != null)
                {
                    details = SobekCM_Database.Get_IP_Restriction_Range_Details(thisRange.RangeID, Tracer);
                }
            }

            if ((currentMode.isPostBack) && ( user.Is_System_Admin ))
            {
                // Get a reference to this form
                NameValueCollection form = HttpContext.Current.Request.Form;

                string action = form["action"].Trim();

                if (action == "new")
                {
                    // Pull the main values
                    string title = form["new_admin_title"].Trim();
                    string notes = form["new_admin_notes"].Trim();
                    string message = form["new_admin_message"].Trim();

                    if ((title.Length == 0) || (message.Length == 0))
                    {
                        actionMessage = "Both title and message are required fields";
                    }
                    else
                    {
                        if ( SobekCM_Database.Edit_IP_Range(-1, title, notes, message, Tracer))
                            actionMessage = "Saved new IP range '" + title + "'";
                        else
                            actionMessage = "Error saving new IP range '" + title + "'";
                    }
                }
                else if (( details != null ) && ( thisRange != null ))
                {
                    try
                    {
                        // Pull the main values
                        string title = form["admin_title"].Trim();
                        string notes = form["admin_notes"].Trim();
                        string message = form["admin_message"].Trim();

                        if (title.Length == 0)
                        {
                            title = thisRange.Title;
                        }

                        // Edit the main values in the database
                        SobekCM_Database.Edit_IP_Range(thisRange.RangeID, title, notes, message, Tracer);
                        thisRange.Title = title;
                        thisRange.Notes = notes;
                        thisRange.Item_Restricted_Statement = message;

                        // Now check each individual IP address range
                        string[] getKeys = form.AllKeys;
                        int single_ip_index = 0;
                        foreach (string thisKey in getKeys)
                        {
                            // Is this for a new ip address?
                            if (thisKey.IndexOf("admin_ipstart_") == 0)
                            {
                                // Get the basic information for this single ip address
                                string ip_index = thisKey.Replace("admin_ipstart_", "");
                                string thisIpStart = form["admin_ipstart_" + ip_index].Trim();
//.........这里部分代码省略.........
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:IP_Restrictions_AdminViewer.cs

示例9: Page_Image_Upload_MySobekViewer

        /// <summary> Constructor for a new instance of the New_Group_And_Item_MySobekViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="Current_Item"> Digital resource selected for file management </param>
        /// <param name="Item_List"> Allows individual items to be retrieved by various methods as <see cref="Single_Item"/> objects.</param>
        /// <param name="Code_Manager"> Code manager contains the list of all valid aggregation codes </param>
        /// <param name="HTML_Skin"> HTML Web skin which controls the overall appearance of this digital library </param>
        /// <param name="Icon_Table"> Dictionary of all the wordmark/icons which can be tagged to the items </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        public Page_Image_Upload_MySobekViewer(User_Object User,
                                             SobekCM_Navigation_Object Current_Mode,
                                             SobekCM_Item Current_Item,
                                             Item_Lookup_Object Item_List,
                                             Aggregation_Code_Manager Code_Manager,
                                             Dictionary<string, Wordmark_Icon> Icon_Table,
                                             SobekCM_Skin_Object HTML_Skin,
                                             Language_Support_Info Translator,
                                             Custom_Tracer Tracer)
            : base(User)
        {
            Tracer.Add_Trace("Page_Image_Upload_MySobekViewer.Constructor", String.Empty);

            // Save the parameters
            codeManager = Code_Manager;
            itemList = Item_List;
            iconList = Icon_Table;
            currentMode = Current_Mode;
            webSkin = HTML_Skin;
            this.validationErrors = validationErrors;
            base.Translator = Translator;
            item = Current_Item;

            // If the user cannot edit this item, go back
            if (!user.Can_Edit_This_Item(item))
            {
                currentMode.My_Sobek_Type = My_Sobek_Type_Enum.Home;
                currentMode.Redirect();
                return;
            }

            // Determine the in process directory for this
            digitalResourceDirectory = SobekCM_Library_Settings.In_Process_Submission_Location + "\\" + User.UserName.Replace(".", "").Replace("@", "") + "\\uploadimages\\" + Current_Item.METS_Header.ObjectID;
            if (User.ShibbID.Trim().Length > 0)
                digitalResourceDirectory = SobekCM_Library_Settings.In_Process_Submission_Location + "\\" + User.ShibbID + "\\uploadimages\\" + Current_Item.METS_Header.ObjectID;

            // Make the folder for the user in process directory
            if (!Directory.Exists(digitalResourceDirectory))
                Directory.CreateDirectory(digitalResourceDirectory);
            else
            {
                // Any post-processing to do?
                string[] files = Directory.GetFiles(digitalResourceDirectory);
                foreach (string thisFile in files)
                {
                    FileInfo thisFileInfo = new FileInfo(thisFile);
                    if ((thisFileInfo.Extension.ToUpper() == ".TIF") || (thisFileInfo.Extension.ToUpper() == ".TIFF"))
                    {
                        // Is there a JPEG and/or thumbnail?
                        string jpeg = digitalResourceDirectory + "\\" + thisFileInfo.Name.Replace(thisFileInfo.Extension, "") + ".jpg";
                        string jpeg_thumbnail = digitalResourceDirectory + "\\" + thisFileInfo.Name.Replace(thisFileInfo.Extension, "") + "thm.jpg";

                        // Is one missing?
                        if ((!File.Exists(jpeg)) || (!File.Exists(jpeg_thumbnail)))
                        {
                            try
                            {
                                var tiffImg = System.Drawing.Image.FromFile(thisFile);
                                var mainImg = ScaleImage(tiffImg, SobekCM_Library_Settings.JPEG_Width, SobekCM_Library_Settings.JPEG_Height);
                                mainImg.Save(jpeg, ImageFormat.Jpeg);
                                var thumbnailImg = ScaleImage(tiffImg, 150, 400);
                                thumbnailImg.Save(jpeg_thumbnail, ImageFormat.Jpeg);

                            }
                            catch (Exception)
                            {
                                bool error = true;
                            }
                        }
                    }
                }
            }

            // If this is post-back, handle it
            if (currentMode.isPostBack)
            {
                string[] getKeys = HttpContext.Current.Request.Form.AllKeys;
                string file_name_from_keys = String.Empty;
                string label_from_keys = String.Empty;
                foreach (string thisKey in getKeys)
                {
                    if (thisKey.IndexOf("upload_file") == 0)
                    {
                        file_name_from_keys = HttpContext.Current.Request.Form[thisKey];
                    }
                    if (thisKey.IndexOf("upload_label") == 0)
                    {
                        label_from_keys = HttpContext.Current.Request.Form[thisKey];
                    }
                    if ((file_name_from_keys.Length > 0) && (label_from_keys.Length > 0))
//.........这里部分代码省略.........
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:Page_Image_Upload_MySobekViewer.cs

示例10: User_Group_AdminViewer

        /// <summary> Constructor for a new instance of the User_Group_AdminViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="currentMode"> Mode / navigation information for the current request</param>
        /// <param name="Code_Manager"> List of valid collection codes, including mapping from the Sobek collections to Greenstone collections</param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks> Postback from a user group edit is handled here in the constructor </remarks>
        public User_Group_AdminViewer(User_Object User, SobekCM_Navigation_Object currentMode, Aggregation_Code_Manager Code_Manager, Custom_Tracer Tracer)
            : base(User)
        {
            Tracer.Add_Trace("User_Group_AdminViewer.Constructor", String.Empty);

            // Set the action message to clear initially
            actionMessage = String.Empty;
            codeManager = Code_Manager;

            // Get the user to edit, if there was a user id in the submode
            int edit_usergroupid = -100;
            editGroup = null;
            if (currentMode.My_Sobek_SubMode.Length > 0)
            {
                if (currentMode.My_Sobek_SubMode == "new")
                {
                    edit_usergroupid = -1;
                }
                else
                {
                    if (Int32.TryParse(currentMode.My_Sobek_SubMode.Replace("a", "").Replace("b", "").Replace("c", "").Replace("v", ""), out edit_usergroupid))
                        editGroup = SobekCM_Database.Get_User_Group(edit_usergroupid, Tracer);
                }
            }

            // Determine the mode
            mode = Users_Group_Admin_Mode_Enum.Error;
            if ((editGroup != null) || (edit_usergroupid == -1))
            {
                if ((currentMode.My_Sobek_SubMode.IndexOf("v") > 0) && (edit_usergroupid > 0))
                    mode = Users_Group_Admin_Mode_Enum.View_User_Group;
                else
                    mode = Users_Group_Admin_Mode_Enum.Edit_User_Group;
            }
            else
            {
                currentMode.My_Sobek_SubMode = String.Empty;
                currentMode.Admin_Type = Admin_Type_Enum.Users;
                currentMode.Redirect();
                return;
            }

            // Set an empty user group object for a new item
            if (edit_usergroupid < 0)
            {
                editGroup = new User_Group(String.Empty, String.Empty, -1);
            }

            // Perform post back work
            if (currentMode.isPostBack)
            {
                if ((mode == Users_Group_Admin_Mode_Enum.Edit_User_Group) && (editGroup != null))
                {
                    // Get a reference to this form
                    NameValueCollection form = HttpContext.Current.Request.Form;
                    string[] getKeys = form.AllKeys;

                    bool successful_save = true;
                    bool can_editall = editGroup.Editable_Regular_Expressions.Any(thisRegularExpression => thisRegularExpression == "[A-Z]{2}[A-Z|0-9]{4}[0-9]{4}");

                    bool can_submit = false;
                    bool is_internal = false;
                    bool is_admin = false;
                    bool is_portal = false;
                    string name = editGroup.Name;
                    string description = editGroup.Description;
                    bool is_sobek_default = false;
                    bool is_shibboleth_default = false;
                    bool is_ldap_default = false;

                    List<string> projects = new List<string>();
                    List<string> templates = new List<string>();

                    Dictionary<string, User_Editable_Aggregation> aggregations = new Dictionary<string, User_Editable_Aggregation>();

                    // Step through each key
                    foreach (string thisKey in getKeys)
                    {
                        switch (thisKey)
                        {
                            case "groupName":
                                name = form[thisKey].Trim();
                                break;

                            case "groupDescription":
                                description = form[thisKey].Trim();
                                break;

                            case "admin_user_submit":
                                can_submit = true;
                                break;

                            case "admin_user_internal":
                                is_internal = true;
//.........这里部分代码省略.........
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:User_Group_AdminViewer.cs

示例11: Group_Add_Volume_MySobekViewer

        /// <summary> Constructor for a new instance of the Group_Add_Volume_MySobekViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="All_Items_Lookup"> Allows individual items to be retrieved by various methods as <see cref="Single_Item"/> objects.</param>
        /// <param name="Current_Item"> Individual digital resource to be edited by the user </param>
        /// <param name="Code_Manager"> Code manager contains the list of all valid aggregation codes </param>
        /// <param name="HTML_Skin"> HTML Web skin which controls the overall appearance of this digital library </param>
        /// <param name="Icon_Table"> Dictionary of all the wordmark/icons which can be tagged to the items </param>
        /// <param name="Items_In_Title"> List of items within this title </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="HTML_Skin_Collection"> HTML Web skin collection which controls the overall appearance of this digital library </param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        public Group_Add_Volume_MySobekViewer(User_Object User,
            SobekCM_Navigation_Object Current_Mode,
            Item_Lookup_Object All_Items_Lookup,
            SobekCM_Item Current_Item, Aggregation_Code_Manager Code_Manager,
            Dictionary<string, Wordmark_Icon> Icon_Table,
            SobekCM_Skin_Object HTML_Skin,
            SobekCM_Items_In_Title Items_In_Title,
            Language_Support_Info Translator,
			SobekCM_Skin_Collection HTML_Skin_Collection,
            Custom_Tracer Tracer)
            : base(User)
        {
            Tracer.Add_Trace("Group_Add_Volume_MySobekViewer.Constructor", String.Empty);

            currentMode = Current_Mode;
            item = Current_Item;
            itemList = All_Items_Lookup;
            codeManager = Code_Manager;
            iconList = Icon_Table;
            webSkin = HTML_Skin;
            itemsInTitle = Items_In_Title;
            base.Translator = Translator;
            skins = HTML_Skin_Collection;

            // Set some defaults
            ipRestrict = -1;
            title = String.Empty;
            date = String.Empty;
            level1 = String.Empty;
            level2 = String.Empty;
            level3 = String.Empty;
            level1Order = -1;
            level2Order = -1;
            level3Order = -1;
            hierarchyCopiedFromDate = false;
            message = String.Empty;
            trackingBox = String.Empty;
            bornDigital = false;
            materialRecdDate = null;
            materialRecdNotes = String.Empty;
            dispositionAdvice = -1;
            dispositionAdviceNotes = String.Empty;

            // If the user cannot edit this item, go back
            if (!user.Can_Edit_This_Item(item))
            {
                currentMode.My_Sobek_Type = My_Sobek_Type_Enum.Home;
                currentMode.Redirect();
                return;
            }

            // Determine the default template code
            string template_code = "addvolume";
            if (!user.Include_Tracking_In_Standard_Forms)
                template_code = "addvolume_notracking";

            // Load this template
            template = Cached_Data_Manager.Retrieve_Template(template_code, Tracer);
            if (template != null)
            {
                Tracer.Add_Trace("Group_Add_Volume_MySobekViewer.Constructor", "Found template in cache");
            }
            else
            {
                Tracer.Add_Trace("Group_Add_Volume_MySobekViewer.Constructor", "Reading template file");

                // Read this template
                Template_XML_Reader reader = new Template_XML_Reader();
                template = new Template();
                reader.Read_XML(SobekCM_Library_Settings.Base_MySobek_Directory + "templates\\defaults\\" + template_code + ".xml", template, true);

                // Add the current codes to this template
                template.Add_Codes(Code_Manager);

                // Save this into the cache
                Cached_Data_Manager.Store_Template(template_code, template, Tracer);
            }

            // See if there was a hidden request
            string hidden_request = HttpContext.Current.Request.Form["action"] ?? String.Empty;

            // If this was a cancel request do that
            if (hidden_request == "cancel")
            {
                currentMode.Mode = Display_Mode_Enum.Item_Display;
                currentMode.Redirect();
            }
            else if (hidden_request.IndexOf("save") == 0 )
//.........这里部分代码省略.........
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:Group_Add_Volume_MySobekViewer.cs

示例12: New_Group_And_Item_MySobekViewer

        /// <summary> Constructor for a new instance of the New_Group_And_Item_MySobekViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="Item_List"> Allows individual items to be retrieved by various methods as <see cref="Single_Item"/> objects.</param>
        /// <param name="Code_Manager"> Code manager contains the list of all valid aggregation codes </param>
        /// <param name="HTML_Skin"> HTML Web skin which controls the overall appearance of this digital library </param>
        /// <param name="Icon_Table"> Dictionary of all the wordmark/icons which can be tagged to the items </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="HTML_Skin_Collection"> HTML Web skin collection which controls the overall appearance of this digital library </param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        public New_Group_And_Item_MySobekViewer(User_Object User, 
                                                SobekCM_Navigation_Object Current_Mode, Item_Lookup_Object Item_List,
                                                Aggregation_Code_Manager Code_Manager,
                                                Dictionary<string, Wordmark_Icon> Icon_Table,
                                                SobekCM_Skin_Object HTML_Skin,
                                                Language_Support_Info Translator,
												SobekCM_Skin_Collection HTML_Skin_Collection,
                                                Custom_Tracer Tracer)
            : base(User)
        {
            Tracer.Add_Trace("New_Group_And_Item_MySobekViewer.Constructor", String.Empty);

            // Save the parameters
            currentMode = Current_Mode;
            codeManager = Code_Manager;
            iconList = Icon_Table;
            webSkin = HTML_Skin;
            base.Translator = Translator;
            skins = HTML_Skin_Collection;

            // If the user cannot submit items, go back
            if (!user.Can_Submit)
            {
                currentMode.My_Sobek_Type = My_Sobek_Type_Enum.Home;
                currentMode.Redirect();
                return;
            }
            itemList = Item_List;

            // Determine the in process directory for this
            if (user.ShibbID.Trim().Length > 0)
                userInProcessDirectory = SobekCM_Library_Settings.In_Process_Submission_Location + "\\" + user.ShibbID + "\\newgroup";
            else
                userInProcessDirectory = SobekCM_Library_Settings.In_Process_Submission_Location + "\\" + user.UserName.Replace(".","").Replace("@","") + "\\newgroup";

            // Handle postback for changing the template or project
            templateCode = user.Current_Template;
            if (currentMode.isPostBack)
            {
                string action1 = HttpContext.Current.Request.Form["action"];
                if ((action1 != null) && ((action1 == "template") || (action1 == "project")))
                {
                    string newvalue = HttpContext.Current.Request.Form["phase"];
                    if ((action1 == "template") && ( newvalue != templateCode ))
                    {
                        user.Current_Template = newvalue;
                        templateCode = user.Current_Template;
                        if (File.Exists(userInProcessDirectory + "\\agreement.txt"))
                            File.Delete(userInProcessDirectory + "\\agreement.txt");
                    }
                    if ((action1 == "project") && (newvalue != user.Current_Default_Metadata))
                    {
                        user.Current_Default_Metadata = newvalue;
                    }
                    HttpContext.Current.Session["item"] = null;
                }
            }

            // Load the template
            templateCode = user.Current_Template;
            template = Cached_Data_Manager.Retrieve_Template(templateCode, Tracer);
            if ( template != null )
            {
                Tracer.Add_Trace("New_Group_And_Item_MySobekViewer.Constructor", "Found template in cache");
            }
            else
            {
                Tracer.Add_Trace("New_Group_And_Item_MySobekViewer.Constructor", "Reading template");

                // Read this template
                Template_XML_Reader reader = new Template_XML_Reader();
                template = new Template();
                reader.Read_XML( SobekCM_Library_Settings.Base_MySobek_Directory + "templates\\" + templateCode + ".xml", template, true);

                // Add the current codes to this template
                template.Add_Codes(Code_Manager);

                // Save this into the cache
                Cached_Data_Manager.Store_Template(templateCode, template, Tracer);
            }

            // Determine the number of total template pages
            totalTemplatePages = template.InputPages_Count;
            if (template.Permissions_Agreement.Length > 0)
                totalTemplatePages++;
            if (template.Upload_Types != Template.Template_Upload_Types.None)
                totalTemplatePages++;

            // Determine the title for this template, or use a default
            toolTitle = template.Title;
//.........这里部分代码省略.........
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:New_Group_And_Item_MySobekViewer.cs

示例13: QC_ItemViewer

        /// <summary> Constructor for a new instance of the QC_ItemViewer class </summary>
        /// <param name="Current_Object"> Digital resource to display </param>
        /// <param name="Current_User"> Current user for this session </param>
        /// <param name="Current_Mode"> Navigation object which encapsulates the user's current request </param>
        public QC_ItemViewer(SobekCM_Item Current_Object, User_Object Current_User, SobekCM_Navigation_Object Current_Mode)
        {
            // Save the current user and current mode information (this is usually populated AFTER the constructor completes,
            // but in this case (QC viewer) we need the information for early processing
            CurrentMode = Current_Mode;
            CurrentUser = Current_User;

            //Assign the current resource object to qc_item
            qc_item = Current_Object;
            //Save to the User's session
            HttpContext.Current.Session[Current_Object.BibID + "_" + Current_Object.VID + " QC Work"] = qc_item;

            // If there is no user, send to the login
            if (CurrentUser == null)
            {
                CurrentMode.Mode = Display_Mode_Enum.My_Sobek;
                CurrentMode.My_Sobek_Type = My_Sobek_Type_Enum.Logon;
                CurrentMode.Redirect();
                return;
            }

            // If the user cannot edit this item, go back
            if (!CurrentUser.Can_Edit_This_Item(Current_Object))
            {
                CurrentMode.ViewerCode = String.Empty;
                CurrentMode.Redirect();
                return;
            }

            //If there are no pages for this item, redirect to the image upload screen
            if (qc_item.Web.Static_PageCount == 0)
            {
                CurrentMode.Mode = Display_Mode_Enum.My_Sobek;
                CurrentMode.My_Sobek_Type = My_Sobek_Type_Enum.Page_Images_Management;
                CurrentMode.Redirect();
                return;
            }

            // Get the links for the METS
            string greenstoneLocation = Current_Object.Web.Source_URL + "/";
            complete_mets = greenstoneLocation + Current_Object.BibID + "_" + Current_Object.VID + ".mets.xml";

            // MAKE THIS USE THE FILES.ASPX WEB PAGE if this is restricted (or dark)
            if ((Current_Object.Behaviors.Dark_Flag) || (Current_Object.Behaviors.IP_Restriction_Membership > 0))
            {
                complete_mets = CurrentMode.Base_URL + "files/" + qc_item.BibID + "/" + qc_item.VID + "/" + qc_item.BibID + "_" + qc_item.VID + ".mets.xml";
            }

            // Get the special qc_item, which matches the passed in Current_Object, at least the first time.
            // If the QC work is already in process, we may find a temporary METS file to read.

            // Determine the in process directory for this
            userInProcessDirectory = SobekCM_Library_Settings.In_Process_Submission_Location + "\\" + Current_User.UserName.Replace(".", "").Replace("@", "") + "\\qcwork\\" + qc_item.METS_Header.ObjectID;
            if (Current_User.ShibbID.Trim().Length > 0)
                userInProcessDirectory = SobekCM_Library_Settings.In_Process_Submission_Location + "\\" + Current_User.ShibbID + "\\qcwork\\" + qc_item.METS_Header.ObjectID;

            // Make the folder for the user in process directory
            if (!Directory.Exists(userInProcessDirectory))
                Directory.CreateDirectory(userInProcessDirectory);

            // Create the name for the tempoary METS file?
            metsInProcessFile = userInProcessDirectory + "\\" + Current_Object.BibID + "_" + Current_Object.VID + ".mets.xml";

            // Is this work in the user's SESSION state?
            qc_item = HttpContext.Current.Session[Current_Object.BibID + "_" + Current_Object.VID + " QC Work"] as SobekCM_Item;
            if (qc_item == null)
            {

                // Is there a temporary METS for this item, which is not expired?
                if ((File.Exists(metsInProcessFile)) &&
                    (File.GetLastWriteTime(metsInProcessFile).Subtract(DateTime.Now).Hours < 8))
                {
                    // Read the temporary METS file, and use that to build the qc_item
                    qc_item = SobekCM_Item_Factory.Get_Item(metsInProcessFile, Current_Object.BibID, Current_Object.VID, null, null, null);
                    qc_item.Source_Directory = Current_Object.Source_Directory;
                }
                else
                {
                    // Just read the normal otherwise ( if we had the ability to deep copy a SobekCM_Item, we could skip this )
                    qc_item = SobekCM_Item_Factory.Get_Item(Current_Object.BibID, Current_Object.VID, null, null, null);
                }

                // Save to the session, so it is easily available for next time
                HttpContext.Current.Session[Current_Object.BibID + "_" + Current_Object.VID + " QC Work"] = qc_item;
            }

            // If no QC item, this is an error
            if (qc_item == null)
            {
                throw new ApplicationException("Unable to retrieve the item for Quality Control in QC_ItemViewer.Constructor");
            }

            // Get the default QC profile
            qc_profile = QualityControl_Configuration.Default_Profile;

            title = "Quality Control";
//.........这里部分代码省略.........
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:QC_ItemViewer.cs

示例14: Edit_Group_Behaviors_MySobekViewer

        /// <summary> Constructor for a new instance of the Edit_Group_Behaviors_MySobekViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="Current_Item"> Individual digital resource to be edited by the user </param>
        /// <param name="Code_Manager"> Code manager contains the list of all valid aggregation codes </param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        public Edit_Group_Behaviors_MySobekViewer(User_Object User, SobekCM_Navigation_Object Current_Mode, SobekCM_Item Current_Item, Aggregation_Code_Manager Code_Manager, Custom_Tracer Tracer)
            : base(User)
        {
            Tracer.Add_Trace("Edit_Group_Behaviors_MySobekViewer.Constructor", String.Empty);

               currentMode = Current_Mode;
               item = Current_Item;

               // If the user cannot edit this item, go back
               if (!user.Can_Edit_This_Item(item))
               {
               currentMode.My_Sobek_Type = My_Sobek_Type_Enum.Home;
               currentMode.Redirect();
               return;
               }

               const string TEMPLATE_CODE = "groupbehaviors";
               template = Cached_Data_Manager.Retrieve_Template(TEMPLATE_CODE, Tracer);
               if (template != null)
               {
               Tracer.Add_Trace("Edit_Group_Behaviors_MySobekViewer.Constructor", "Found template in cache");
               }
               else
               {
               Tracer.Add_Trace("Edit_Group_Behaviors_MySobekViewer.Constructor", "Reading template file");

               // Read this template
               Template_XML_Reader reader = new Template_XML_Reader();
               template = new Template();
               reader.Read_XML(SobekCM_Library_Settings.Base_MySobek_Directory + "templates\\defaults\\" + TEMPLATE_CODE + ".xml", template, true);

               // Add the current codes to this template
               template.Add_Codes(Code_Manager);

               // Save this into the cache
               Cached_Data_Manager.Store_Template(TEMPLATE_CODE, template, Tracer);
               }

               // See if there was a hidden request
               string hidden_request = HttpContext.Current.Request.Form["behaviors_request"] ?? String.Empty;

               // If this was a cancel request do that
               if (hidden_request == "cancel")
               {
               currentMode.Mode = Display_Mode_Enum.Item_Display;
               currentMode.Redirect();
               }
               else if (hidden_request == "save")
               {
               // Save these changes to bib
               template.Save_To_Bib(item, user, 1);

               // Save the group title
               SobekCM_Database.Update_Item_Group(item.BibID, item.Behaviors.GroupTitle, item.Bib_Info.SortSafeTitle(item.Behaviors.GroupTitle, true), String.Empty, item.Behaviors.Primary_Identifier.Type, item.Behaviors.Primary_Identifier.Identifier );

               // Save the interfaces to the group item as well
               SobekCM_Database.Save_Item_Group_Web_Skins(item.Web.GroupID, item );

               // Store on the caches (to replace the other)
               Cached_Data_Manager.Remove_Digital_Resource_Objects(item.BibID, Tracer);

               // Forward
               currentMode.Mode = Display_Mode_Enum.Item_Display;
               currentMode.Redirect();
               }
        }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:72,代码来源:Edit_Group_Behaviors_MySobekViewer.cs

示例15: Contact_HtmlSubwriter

        /// <summary> Constructor for a new instance of the Contact_HtmlSubwriter class </summary>
        /// <param name="Last_Mode"> URL for the last mode this user was in before selecting contact us</param>
        /// <param name="UserHistoryRequestInfo"> Some history and user information to include in the final email </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="Hierarchy_Object"> Current item aggregation object to display </param>
        public Contact_HtmlSubwriter(string Last_Mode, string UserHistoryRequestInfo, SobekCM_Navigation_Object Current_Mode, Item_Aggregation Hierarchy_Object)
        {
            // Save the parameters
            lastMode = Last_Mode;
            userHistoryRequestInfo = UserHistoryRequestInfo;
            currentMode = Current_Mode;
            this.Current_Aggregation = Hierarchy_Object;

            // If this is a post back, send email
            if (HttpContext.Current.Request.Form["item_action"] == null) return;

            string action = HttpContext.Current.Request.Form["item_action"];
            if (action == "email")
            {
                string notes = HttpContext.Current.Request.Form["notesTextBox"].Trim();
                string subject = HttpContext.Current.Request.Form["subjectTextBox"].Trim();
                string message_from = SobekCM_Library_Settings.System_Email;
                string email = HttpContext.Current.Request.Form["emailTextBox"].Trim();
                string name = HttpContext.Current.Request.Form["nameTextBox"].Trim();

                if ((notes.Length > 0) || (subject.Length > 0))
                {
                    // Create the mail message
                    if (email.Length > 0)
                    {
                        message_from = email;
                    }

                    // Start the body
                    StringBuilder builder = new StringBuilder(1000);
                    builder.Append(notes + "\n\n\n\n");
                    builder.Append("The following information is collected to allow us better serve your needs.\n\n");
                    builder.Append("PERSONAL INFORMATION\n");
                    builder.Append("\tName:\t\t\t\t" + name + "\n");
                    builder.Append("\tEmail:\t\t\t" + email + "\n");
                    builder.Append(userHistoryRequestInfo);
                    string email_body = builder.ToString();

                    try
                    {
                        MailMessage myMail = new MailMessage(message_from, base.Current_Aggregation.Contact_Email.Replace(";", ","))
                                                 {
                                                     Subject =subject + "  [" + currentMode.SobekCM_Instance_Abbreviation +" Submission]",
                                                     Body = email_body
                                                 };
                        // Mail this
                        SmtpClient client = new SmtpClient("smtp.ufl.edu");
                        client.Send(myMail);

                        // Log this
                        string sender = message_from;
                        if (name.Length > 0)
                            sender = name + " ( " + message_from + " )";
                        SobekCM_Database.Log_Sent_Email(sender, base.Current_Aggregation.Contact_Email.Replace(";", ","), subject + "  [" + currentMode.SobekCM_Instance_Abbreviation + " Submission]", email_body, false, true, -1);

                        // Send back to the home for this collection, sub, or group
                        Current_Mode.Mode = Display_Mode_Enum.Contact_Sent;
                        Current_Mode.Redirect();
                        return;
                    }
                    catch
                    {
                        bool email_error = SobekCM_Database.Send_Database_Email(base.Current_Aggregation.Contact_Email.Replace(";", ","), subject + "  [" + currentMode.SobekCM_Instance_Abbreviation + " Submission]", email_body, false, true, -1, -1 );

                        // Send back to the home for this collection, sub, or group
                        if (email_error)
                        {
                            HttpContext.Current.Response.Redirect(SobekCM_Library_Settings.System_Error_URL, false);
                            HttpContext.Current.ApplicationInstance.CompleteRequest();
                            return;
                        }
                        else
                        {
                            // Send back to the home for this collection, sub, or group
                            Current_Mode.Mode = Display_Mode_Enum.Contact_Sent;
                            Current_Mode.Redirect();
                            return;
                        }
                    }
                }
            }
        }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:87,代码来源:Contact_HtmlSubwriter.cs


注:本文中的SobekCM.Library.Navigation.SobekCM_Navigation_Object.Redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。