protected void Page_Load(object sender, EventArgs e)
        {
            PageAuthorized.check(Request, Response);

            idStr = Request["id"];
            if (!String.IsNullOrEmpty(idStr))
            {
                try
                {
                    int id = int.Parse(idStr);
                    LiftDomain.Organization thisOrganization = new LiftDomain.Organization();
                    thisOrganization.id.Value = id;
                    thisOrganization.doCommand("delete");

                    Response.Redirect(Request["redirect_to_page"]);

                    //Response.ContentType = "text/javascript";
                }
                catch (Exception x)
                {
                    Logger.log(idStr, x, "Error deleting organization");
                }
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EmailValidator1.ErrorMessage = LiftDomain.Language.Current.SHARED_MUST_BE_A_VALID_EMAIL_ADDRESS;
            EmailValidator2.ErrorMessage = LiftDomain.Language.Current.SHARED_MUST_BE_A_VALID_EMAIL_ADDRESS;
            EmailValidator3.ErrorMessage = LiftDomain.Language.Current.SHARED_MUST_BE_A_VALID_EMAIL_ADDRESS;
            EmailValidator4.ErrorMessage = LiftDomain.Language.Current.SHARED_MUST_BE_A_VALID_EMAIL_ADDRESS;

            PageAuthorized.check(Request, Response);


            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            try
            {
                //-------------------------------------------------------------------------
                //-- do the language setting for the SUBMIT button here
                //-- (unable to place <%=LiftDomain.Language.Current.SHARED_SUBMIT %> in asp:Button Text field)
                //-------------------------------------------------------------------------
                this.submitBtn.Text = LiftDomain.Language.Current.SHARED_SUBMIT.Value;

                //-------------------------------------------------------------------------
                //-- instantiate object
                //-------------------------------------------------------------------------
                LiftDomain.OrgEmail thisOrgEmail = new LiftDomain.OrgEmail();
                organization_from_email_address.ReadOnly = true;

                if (IsPostBack)
                {
                    //-------------------------------------------------------------------------
                    //-- get the object ID from the hidden id field on the page;
                    //-- if there is a object ID value, then we are editing an EXISTING object
                    //-------------------------------------------------------------------------
                    if (!String.IsNullOrEmpty(id.Value) && (id.Value != "0"))
                    {
                        thisOrgEmail.id.Value = int.Parse(id.Value);
                    }

                    //-------------------------------------------------------------------------
                    //-- transfer screen values to the object
                    //-------------------------------------------------------------------------
                    //TODO: ???what if data field validation fails??? // TO BE DONE IN JAVASCRIPT
                    thisOrgEmail.webmaster_email_to.Value  = organization_email_to_webmaster.Text;
                    thisOrgEmail.contact_us_email_to.Value = organization_email_to_contact_us.Text;
                    thisOrgEmail.encourager_email_to.Value = organization_email_to_encourager.Text;
                    //thisOrgEmail.email_from.Value = organization_from_email_address.Text;

                    //-------------------------------------------------------------------------
                    //-- persist the object data to the database
                    //-------------------------------------------------------------------------
                    thisOrgEmail.id.Value = Convert.ToInt32(thisOrgEmail.doCommand("save"));

                    //-------------------------------------------------------------------------
                    //-- return to ???
                    //-------------------------------------------------------------------------
                    //TODO: ???where to redirect after editing this page???
                    //Response.Redirect("???");
                }
                else
                {
                    //-------------------------------------------------------------------------
                    //-- first time on this page, so get the organization ID from the ASP Request cache
                    //-------------------------------------------------------------------------
                    string orgIdStr = Request["o"];

                    if (String.IsNullOrEmpty(orgIdStr))
                    {
                        //TODO: ??? HOW DO WE NOTIFY THE USER
                        Logger.log(Logger.Level.ERROR, this, "Organization ID must be passed in the request string [EditOrganizationEmails.aspx].");
                        throw new ApplicationException("Organization ID must be passed in the request string [EditOrganizationEmails.aspx].");
                    }

                    else
                    {
                        orgId.Value = orgIdStr;
                    }


                    LiftDomain.Organization thisOrganization = new LiftDomain.Organization();
                    thisOrganization.id.Value = Convert.ToInt32(orgIdStr);

                    //-------------------------------------------------------------------------
                    //-- query database for data for this organization
                    //-------------------------------------------------------------------------
                    thisOrganization = thisOrganization.doSingleObjectQuery <LiftDomain.Organization>("select");
                    title_label.Text = LiftDomain.Language.Current.ORGANIZATION_EDITING_ORGANIZATION.Value + " " + thisOrganization.title;

                    //-------------------------------------------------------------------------
                    //-- query database for data for this organization's emails
                    //-------------------------------------------------------------------------
                    thisOrgEmail.organization_id.Value = thisOrganization.id.Value;
                    try
                    {
                        thisOrgEmail = thisOrgEmail.doSingleObjectQuery <LiftDomain.OrgEmail>("select");
                        id.Value     = thisOrgEmail.id.Value.ToString();
                        //-------------------------------------------------------------------------
                        //-- populate the screen controls
                        //-------------------------------------------------------------------------
                        organization_email_to_webmaster.Text  = thisOrgEmail.webmaster_email_to;
                        organization_email_to_contact_us.Text = thisOrgEmail.contact_us_email_to;
                        organization_email_to_encourager.Text = thisOrgEmail.encourager_email_to;
                    }
                    catch
                    {
                        id.Value = "0";
                    }

                    organization_from_email_address.Text     = Organization.Current.getFromEmail();
                    organization_from_email_address.ReadOnly = true;
                }
            }
            catch (Exception x)
            {
                //TODO: ??? WHAT DO WE DO IF THERE IS AN ERROR ???
                string m = x.Message;
                System.Diagnostics.Debug.Print("[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganizationEmails.aspx.cs::Page_Load(): " + m);
                Logger.log("EditOrganizationEmails.aspx.cs", x, "[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganizationEmails.aspx.cs::Page_Load(): " + m);
            }
            finally
            {
            }
        }
Exemple #3
0
        //-------------------------------------------------------------------------
        //-- 1) Create new org from scratch. There should be a placeholder for a terms of use agreement.
        //-- 2) Signup user as org admin for new org. This new user's email address will be copied to the webmaster email role in the org_emails table.
        //-- 3) Create email accounts using the HostingProvider interface
        //-- 4) Create org_emails records
        //-- 5) Create the /custom/org/images and /custom/org/stylesheets folders
        //-- 6) There will be a new org status - approved and unapproved. The org will initially be created in the unapproved state.
        //-- 7) The system will send an email to [email protected] to notify of org requesting approval.
        //-- 8) The org list page will show the approval status of orgs.
        //-- 9) The org edit page will enable the sys admin to approve an org.
        //-- 10) The system will generate an email to the org webmaster indicating that the new org has been approved.
        //-------------------------------------------------------------------------

        protected void Page_Load(object sender, EventArgs e)
        {
            EmailValidator.ErrorMessage = LiftDomain.Language.Current.SHARED_MUST_BE_A_VALID_EMAIL_ADDRESS;

            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            PageAuthorized.check(Request, Response);

            string initialTimeZone   = "Central Standard Time";
            int    initialLanguageId = 1; //-- 1 = English
            string saltValue         = string.Empty;
            string thisDirectory     = string.Empty;

            try
            {
                //-------------------------------------------------------------------------
                //-- do the language setting for the SUBMIT button here
                //-- (unable to place <%=LiftDomain.Language.Current.SHARED_SUBMIT %> in asp:Button Text field)
                //-------------------------------------------------------------------------
                this.submitBtn.Text = LiftDomain.Language.Current.SHARED_SUBMIT.Value;

                if (IsPostBack)
                {
                    //-------------------------------------------------------------------------
                    //-- instantiate the object
                    //-------------------------------------------------------------------------
                    LiftDomain.Organization thisOrganization = new LiftDomain.Organization();

                    //-------------------------------------------------------------------------
                    //-- transfer screen values to the object
                    //-------------------------------------------------------------------------
                    //TODO: ???what if data field validation fails??? // TO BE DONE IN JAVASCRIPT
                    //TODO: ???what if org title already exists??? // TO BE DONE IN JAVASCRIPT
                    //TODO: ???what if org subdomain already exists??? // TO BE DONE IN JAVASCRIPT
                    //TODO: ???should this be wrapped in a transaction???

                    //thisOrganization.id.Value = 0; //-- id of "0" means "new"
                    thisOrganization.title.Value          = organization_title.Text;
                    thisOrganization.user_id.Value        = 0; // LiftDomain.User.Current.id.Value;
                    thisOrganization.address.Value        = organization_address.Text;
                    thisOrganization.city.Value           = organization_city.Text;
                    thisOrganization.state_province.Value = organization_state.Text;
                    thisOrganization.postal_code.Value    = organization_postal_code.Text;
                    thisOrganization.phone.Value          = organization_phone.Text;
                    thisOrganization.subdomain.Value      = organization_subdomain.Text;
                    thisOrganization.time_zone.Value      = initialTimeZone;
                    thisOrganization.language_id.Value    = initialLanguageId;
                    thisOrganization.status.Value         = 0; //-- 0 = unapproved; 1 = approved
                    thisOrganization.created_at.Value     = LiftTime.CurrentTime;

                    //-------------------------------------------------------------------------
                    //-- persist the object data to the database
                    //-------------------------------------------------------------------------
                    thisOrganization.id.Value = Convert.ToInt32(thisOrganization.doCommand("save"));

                    if (thisOrganization.id.Value != 0)
                    {
                        //-------------------------------------------------------------------------
                        //-- instantiate the child object
                        //-------------------------------------------------------------------------
                        //TODO: ???what if data field validation fails??? // TO BE DONE IN JAVASCRIPT
                        LiftDomain.OrgEmail thisOrgEmail = new LiftDomain.OrgEmail();

                        //thisOrgEmail.id.Value = 0; //-- id of "0" means "new"
                        thisOrgEmail.organization_id.Value = thisOrganization.id.Value;
                        thisOrgEmail.smtp_server.Value     = "smtp.liftprayer.cc";
                        thisOrgEmail.smtp_username.Value   = thisOrganization.subdomain.Value + "*****@*****.**";
                        //thisOrgEmail.smtp_username.Value = "*****@*****.**";
                        thisOrgEmail.smtp_password.Value = "liftprayer";
                        thisOrgEmail.smtp_port.Value     = 25;
                        thisOrgEmail.email_from.Value    = thisOrganization.subdomain.Value + "*****@*****.**";
                        //thisOrgEmail.email_from.Value = "*****@*****.**";
                        thisOrgEmail.email_to.Value           = organization_email_to_webmaster.Text;
                        thisOrgEmail.webmaster_email_to.Value = organization_email_to_webmaster.Text;

                        //-------------------------------------------------------------------------
                        //-- persist the child object data to the database
                        //-------------------------------------------------------------------------
                        thisOrgEmail.doCommand("save");

                        //*************************************************************************
                        //TODO: ???create email accounts using the HostingProvider interface???
                        //*************************************************************************

                        //-------------------------------------------------------------------------
                        //-- create organization-specific file system directories
                        //-------------------------------------------------------------------------
                        thisDirectory = Server.MapPath(".");

                        if (!Directory.Exists(thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\images"))
                        {
                            Directory.CreateDirectory(thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\images");
                        }

                        if (!File.Exists(thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\images\\logo.gif"))
                        {
                            //File.Copy(thisDirectory + "\\..\\custom\\standard\\images\\logo.gif", thisDirectory + "\\custom\\" + thisOrganization.subdomain.Value + "\\images\\logo.gif");
                            copyDirectory(thisDirectory + "\\..\\custom\\standard\\images", thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\images");
                        }

                        if (!Directory.Exists(thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\stylesheets"))
                        {
                            Directory.CreateDirectory(thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\stylesheets");
                        }

                        if (!File.Exists(thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\stylesheets\\lift_custom.css"))
                        {
                            //File.Copy(thisDirectory + "\\..\\custom\\standard\\stylesheets\\lift_base.css", thisDirectory + "\\custom\\" + thisOrganization.subdomain.Value + "\\stylesheets\\lift_custom.css");
                            createStylesheet(thisDirectory + "\\..\\custom\\standard\\stylesheets", thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\stylesheets");
                        }

                        //-------------------------------------------------------------------------
                        //-- email a request for approval to the system administrator
                        //-------------------------------------------------------------------------

                        /*
                         * LiftCommon.Email emailHelper = new LiftCommon.Email();
                         *
                         * emailHelper.server = ConfigReader.getString("smtp_server", ""); // thisOrgEmail.smtp_server;
                         * // emailHelper.username = ConfigReader.getString("smtp_username", ""); // thisOrgEmail.smtp_username;
                         * emailHelper.password = ConfigReader.getString("smtp_password", ""); // thisOrgEmail.smtp_password;
                         * emailHelper.port = ConfigReader.getInt("smtp_port", 25); // thisOrgEmail.smtp_port;
                         *
                         * //email.replyTo = thisOrgEmail.emailReplyTo;  // not supported yet
                         *
                         * emailHelper.from = thisOrganization.getFromEmail();
                         *
                         * //TODO: ??? THIS NEEDS TO BE A VALID E-MAIL ADDRESS
                         * if (LiftCommon.Email.IsValidEmailAddress(thisOrgEmail.webmaster_email_to.Value))
                         * {
                         *
                         * }
                         * else
                         * {
                         *  //TODO: ??? HOW DO WE NOTIFY THE USER
                         *  Logger.log(Logger.Level.ERROR, this, "E-mail address '" + thisOrgEmail.webmaster_email_to.Value + "' is not in a correct format [SignupOrganization.aspx].");
                         *  throw new ApplicationException("E-mail address '" + thisOrgEmail.webmaster_email_to.Value + "' is not in a correct format [SignupOrganization.aspx].");
                         * }
                         *
                         * emailHelper.addTo("*****@*****.**");
                         * //emailHelper.addTo("*****@*****.**");
                         *
                         * emailHelper.subject = LiftDomain.Language.Current.SIGNUP_ORGANIZATION_APPROVAL_REQUEST_SUBJECT.Value;
                         * emailHelper.Body = LiftDomain.Language.Current.SIGNUP_ORGANIZATION_APPROVAL_REQUEST_MESSAGE.Value + "  " + thisOrganization.title.Value;
                         *
                         * //email.MIME = MIME.Text | MIME.HTML;  // just supposing that it supports multiple formats. May not be necessary
                         *
                         * emailHelper.send();
                         *
                         */
                    }
                    else
                    {
                        //else, org ID is zero, but try-catch did not handle it for some reason???
                    }

                    //-------------------------------------------------------------------------
                    //-- navigate to the Organization edit screen
                    //-------------------------------------------------------------------------
                    Response.Redirect("EditOrganization.aspx?id=" + thisOrganization.id.Value.ToString());
                }
                else
                {
                    organization_email_to_webmaster.Text = LiftDomain.User.Current.email.Value;
                }
            }
            catch (Exception x)
            {
                //TODO: ??? WHAT DO WE DO IF THERE IS AN ERROR ???
                string m = x.Message;
                System.Diagnostics.Debug.Print("[" + DateTime.Now.ToString() + "] *** ERROR IN SignupOrganization.aspx.cs::Page_Load(): " + m);
                Logger.log("SignupOrganization.aspx.cs", x, "[" + DateTime.Now.ToString() + "] *** ERROR IN SignupOrganization.aspx.cs::Page_Load(): " + m);
            }
            finally
            {
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            PageAuthorized.check(Request, Response);

            try
            {
                //-------------------------------------------------------------------------
                //-- do the language setting for the SUBMIT button here
                //-- (unable to place <%=LiftDomain.Language.Current.SHARED_SUBMIT %> in asp:Button Text field)
                //-------------------------------------------------------------------------
                this.submitBtn.Text = LiftDomain.Language.Current.SHARED_SUBMIT.Value;

                if (!IsPostBack)
                {
                    string idStr = Request["id"];

                    if (String.IsNullOrEmpty(idStr))
                    {
                        //TODO: ??? HOW DO WE NOTIFY THE USER
                        Logger.log(Logger.Level.ERROR, this, "Organization ID must be passed in the request string [EditOrganizationEmails.aspx].");
                        throw new ApplicationException("Organization ID must be passed in the request string [EditOrganizationEmails.aspx].");
                    }
                    else
                    {
                        id.Value = idStr;
                    }

                    LiftDomain.Organization thisOrganization = new LiftDomain.Organization();
                    thisOrganization.id.Value = Convert.ToInt32(id.Value);

                    //-------------------------------------------------------------------------
                    //-- query database for data for this organization
                    //-------------------------------------------------------------------------
                    thisOrganization     = thisOrganization.doSingleObjectQuery <LiftDomain.Organization>("select");
                    title_label.Text     = LiftDomain.Language.Current.ORGANIZATION_EDITING_ORGANIZATION.Value + " " + thisOrganization.title;
                    this.subdomain.Value = thisOrganization.subdomain;

                    string serverFileLocation = Server.MapPath("/custom/" + this.subdomain.Value + "/stylesheets/lift_custom.css");

                    if (File.Exists(serverFileLocation))
                    {
                        StreamReader sr;
                        sr = File.OpenText(serverFileLocation);
                        this.lift_custom_css.Text = sr.ReadToEnd();
                        sr.Close();
                    }
                }
            }
            catch (Exception x)
            {
                //TODO: ??? WHAT DO WE DO IF THERE IS AN ERROR ???
                string m = x.Message;
                System.Diagnostics.Debug.Print("[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganizationAppearance.aspx.cs::Page_Load(): " + m);
                Logger.log("EditOrganizationAppearance.aspx.cs", x, "[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganizationAppearance.aspx.cs::Page_Load(): " + m);
            }
            finally
            {
            }
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            PageAuthorized.check(Request, Response);

            Organization org = Organization.Current;

            if (org != null)
            {
                customImagePath  = "/custom/";
                customImagePath += org.subdomain;
                customImagePath += "/images";
            }

            string search = string.Empty;

            searchBtn.Text = LiftDomain.Language.Current.SHARED_SEARCH;

            LiftDomain.Organization thisOrganizationList = new LiftDomain.Organization();

            if (IsPostBack)
            {
                search = liveSearchBox.Text;
            }
            else
            {
                if (Session["last_organization_list_search"] != null)
                {
                    search = Session["last_organization_list_search"].ToString();
                }
                else
                {
                    search = string.Empty;
                }
            }

            //-------------------------------------------------------------------------
            //-- !!!KLUDGE ALERT:  if first time on this page -or- search string is blank,
            //-- !!!KLUDGE ALERT:  then use a dummy search value which will return no records
            //-------------------------------------------------------------------------
            if (String.IsNullOrEmpty(search))
            {
                search = "!l0v3TURTL3S";
            }

            Session["last_organization_list_search"] = search;

            thisOrganizationList["search"] = search;
            organizationListSet            = thisOrganizationList.doQuery("SearchOrganizationsByTitleOrSubdomain");

            if (organizationListSet.Tables[0].Rows.Count > 0)
            {
                organizationListSearchResultsLabel.Visible = false;
                organizationListTablePanel.Visible         = true;
                organizationListRenderer = new PartialRenderer(HttpContext.Current, organizationListSet, "_OrganizationList.htm", new PartialRenderer.RenderHelper(thisOrganizationList.organization_list_helper));
            }
            else
            {
                if (IsPostBack)
                {
                    organizationListSearchResultsLabel.Text = LiftDomain.Language.Current.ORGANIZATION_LIST_NO_MATCHING_RECORDS + ".";
                }
                else
                {
                    organizationListSearchResultsLabel.Text = LiftDomain.Language.Current.ORGANIZATION_LIST_ENTER_VALUE_TO_MATCH + ".";
                }
                organizationListSearchResultsLabel.Visible = true;

                organizationListTablePanel.Visible = false;
            }
        }
Exemple #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            PageAuthorized.check(Request, Response);

            try
            {
                //-------------------------------------------------------------------------
                //-- do the language settings for the buttons here
                //-- (e.g., unable to place <%=LiftDomain.Language.Current.SHARED_UPLOAD %> in asp:Button Text field)
                //-------------------------------------------------------------------------
                this.addBtn.Text    = LiftDomain.Language.Current.ORGANIZATION_IMAGES_ADD_TO_LIST.Value;
                this.removeBtn.Text = LiftDomain.Language.Current.ORGANIZATION_IMAGES_REMOVE_FROM_LIST.Value;
                this.uploadBtn.Text = LiftDomain.Language.Current.ORGANIZATION_IMAGES_UPLOAD_TO_SERVER.Value;

                if (!IsPostBack)
                {
                    string idStr = Request["id"];

                    if (String.IsNullOrEmpty(idStr))
                    {
                        //TODO: ??? HOW DO WE NOTIFY THE USER
                        Logger.log(Logger.Level.ERROR, this, "Organization ID must be passed in the request string [EditOrganizationEmails.aspx].");
                        throw new ApplicationException("Organization ID must be passed in the request string [EditOrganizationEmails.aspx].");
                    }
                    else
                    {
                        id.Value = idStr;
                    }

                    LiftDomain.Organization thisOrganization = new LiftDomain.Organization();
                    thisOrganization.id.Value = Convert.ToInt32(id.Value);

                    //-------------------------------------------------------------------------
                    //-- query database for data for this organization
                    //-------------------------------------------------------------------------
                    thisOrganization     = thisOrganization.doSingleObjectQuery <LiftDomain.Organization>("select");
                    title_label.Text     = LiftDomain.Language.Current.ORGANIZATION_EDITING_ORGANIZATION.Value + " " + thisOrganization.title;
                    this.subdomain.Value = thisOrganization.subdomain;
                }

                //-------------------------------------------------------------------------
                //-- display list of server-side image files for this organization
                //-------------------------------------------------------------------------
                DisplayOrganizationImageList();
            }
            catch (Exception x)
            {
                //TODO: ??? WHAT DO WE DO IF THERE IS AN ERROR ???
                string m = x.Message;
                System.Diagnostics.Debug.Print("[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganizationImages.aspx.cs::Page_Load(): " + m);
                Logger.log("EditOrganizationImages.aspx.cs", x, "[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganizationImages.aspx.cs::Page_Load(): " + m);
            }
            finally
            {
            }
        }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            PageAuthorized.check(Request, Response);

            string initialTimeZone        = "Central Standard Time";
            int    initialLanguageId      = 1; //-- 1 = English
            int    initialStatusId        = 0; //-- 0 = Unapproved; 1 = Approved
            string saltValue              = string.Empty;
            bool   sendOrgIsApprovedEmail = false;

            try
            {
                //-------------------------------------------------------------------------
                //-- do the language setting for the SUBMIT button here
                //-- (unable to place <%=LiftDomain.Language.Current.SHARED_SUBMIT %> in asp:Button Text field)
                //-------------------------------------------------------------------------
                this.submitBtn.Text = LiftDomain.Language.Current.SHARED_SUBMIT.Value;

                //-------------------------------------------------------------------------
                //-- do other language settings
                //-------------------------------------------------------------------------
                edit_organization_fieldset_legend = LiftDomain.Language.Current.ORGANIZATION_EDIT_ORGANIZATION.Value;

                LiftDomain.Organization thisOrganization = new LiftDomain.Organization();

                if (IsPostBack)
                {
                    //-------------------------------------------------------------------------
                    //-- get the object ID from the hidden id field on the page;
                    //-- if there is a object ID value, then we are editing an EXISTING object
                    //-------------------------------------------------------------------------
                    if (!String.IsNullOrEmpty(id.Value) && (id.Value != "0"))
                    {
                        thisOrganization.id.Value = int.Parse(id.Value);
                    }
                    else
                    {
                        //-------------------------------------------------------------------------
                        //-- if the object ID is blank or zero (0), then set some NEW object values (NOT id)
                        //-------------------------------------------------------------------------
                        thisOrganization.created_at.Value = LiftTime.CurrentTime;
                    }

                    //-------------------------------------------------------------------------
                    //-- transfer screen values to the object
                    //-------------------------------------------------------------------------
                    //TODO: ???what if data field validation fails??? // TO BE DONE IN JAVASCRIPT
                    //TODO: ???what if org title already exists??? // TO BE DONE IN JAVASCRIPT
                    //TODO: ???what if org subdomain already exists??? // TO BE DONE IN JAVASCRIPT
                    thisOrganization.title.Value          = organization_title.Text;
                    thisOrganization.user_id.Value        = 0; // LiftDomain.User.Current.id.Value;
                    thisOrganization.address.Value        = organization_address.Text;
                    thisOrganization.city.Value           = organization_city.Text;
                    thisOrganization.state_province.Value = organization_state.Text;
                    thisOrganization.postal_code.Value    = organization_postal_code.Text;
                    thisOrganization.phone.Value          = organization_phone.Text;
                    thisOrganization.subdomain.Value      = organization_subdomain.Text;
                    thisOrganization.time_zone.Value      = timezone_list.SelectedItem.Value;
                    thisOrganization.language_id.Value    = Convert.ToInt32(language_list.SelectedItem.Value);
                    thisOrganization.footer.Value         = organization_footer.Text;

                    thisOrganization.default_approval.Value = (default_approved.Checked ? 1 : 0);

                    thisOrganization.default_signup_mode.Value = (new_users_require_approval.Checked ? 1 : 0);


                    //-------------------------------------------------------------------------
                    //-- if the status changes from "Unapproved" to "Approved,"
                    //-- then we want to notify the organization's webmaster
                    //-------------------------------------------------------------------------
                    if (thisOrganization.id.Value != 0)
                    {
                        LiftDomain.Organization tempOrganization = new LiftDomain.Organization();
                        tempOrganization.id.Value = thisOrganization.id.Value;
                        tempOrganization          = tempOrganization.doSingleObjectQuery <LiftDomain.Organization>("select");

                        if ((tempOrganization.status == 0) && (Convert.ToInt32(language_list.SelectedItem.Value) == 1))
                        {
                            sendOrgIsApprovedEmail = true;
                        }
                    }
                    thisOrganization.status.Value = Convert.ToInt32(organization_status_list.SelectedItem.Value);

                    //-------------------------------------------------------------------------
                    //-- persist the object data to the database
                    //-------------------------------------------------------------------------
                    thisOrganization.id.Value = Convert.ToInt32(thisOrganization.doCommand("save"));

                    //id.Value = thisOrganization.id.Value.ToString();

                    //-------------------------------------------------------------------------
                    //-- send the approval email to the organization's webmaster
                    //-------------------------------------------------------------------------
                    if (sendOrgIsApprovedEmail)
                    {
                        LiftCommon.Email    emailHelper  = new LiftCommon.Email();
                        LiftDomain.OrgEmail thisOrgEmail = new LiftDomain.OrgEmail();
                        thisOrgEmail.organization_id.Value = thisOrganization.id.Value;
                        thisOrgEmail = thisOrgEmail.doSingleObjectQuery <LiftDomain.OrgEmail>("select");

                        //email.replyTo = thisOrgEmail.emailReplyTo;  // not supported yet

                        emailHelper.from = "*****@*****.**";

                        //TODO: ??? THIS NEEDS TO BE A VALID E-MAIL ADDRESS
                        if (LiftCommon.Email.IsValidEmailAddress(thisOrgEmail.webmaster_email_to.Value))
                        {
                            emailHelper.addTo(thisOrgEmail.webmaster_email_to.Value);
                        }
                        else
                        {
                            //TODO: ??? HOW DO WE NOTIFY THE USER
                            Logger.log(Logger.Level.ERROR, this, "E-mail address '" + thisOrgEmail.webmaster_email_to.Value + "' is not in a correct format [SignupOrganization.aspx].");
                            throw new ApplicationException("E-mail address '" + thisOrgEmail.webmaster_email_to.Value + "' is not in a correct format [SignupOrganization.aspx].");
                        }

                        emailHelper.subject = LiftDomain.Language.Current.SIGNUP_ORGANIZATION_APPROVAL_RESPONSE_SUBJECT.Value;
                        emailHelper.Body    = LiftDomain.Language.Current.SIGNUP_ORGANIZATION_APPROVAL_RESPONSE_MESSAGE.Value + "  " + thisOrganization.title.Value;

                        //email.MIME = MIME.Text | MIME.HTML;  // just supposing that it supports multiple formats. May not be necessary

                        emailHelper.send();
                    }

                    if (LiftDomain.User.Current.isSysAdmin)
                    {
                        //-------------------------------------------------------------------------
                        //-- return to the Organization List page
                        //-------------------------------------------------------------------------
                        if (Session["last_org_list_search"] != null)
                        {
                            Response.Redirect("OrganizationList.aspx?" + Session["last_org_list_search"]);
                        }
                        else
                        {
                            Response.Redirect("OrganizationList.aspx");
                        }
                    }
                    else
                    {
                        Response.Redirect("Admin.aspx");
                    }
                }
                else
                {
                    //-------------------------------------------------------------------------
                    //-- first time on this page, so get the organization ID from the ASP Request cache
                    //-------------------------------------------------------------------------
                    string idStr = Request["id"];

                    if (String.IsNullOrEmpty(idStr))
                    {
                        id.Value = "0";
                    }
                    else
                    {
                        id.Value = idStr;
                    }

                    thisOrganization.id.Value = Convert.ToInt32(id.Value);

                    //-------------------------------------------------------------------------
                    //-- if this is a NEW organization...
                    //-------------------------------------------------------------------------
                    if (id.Value == "0")
                    {
                        //-------------------------------------------------------------------------
                        //-- set default values
                        //-------------------------------------------------------------------------
                        initialTimeZone   = LiftDomain.Organization.Current.time_zone.Value;
                        initialLanguageId = LiftDomain.Organization.Current.language_id.Value;
                        initialStatusId   = 0; //-- 0 = Unapproved; 1 = Approved

                        title_label.Visible = false;
                        edit_organization_fieldset_legend = LiftDomain.Language.Current.ORGANIZATION_CREATE_A_NEW_ORGANIZATION.Value;

                        delete_organization_id        = string.Empty;
                        redirect_after_delete_to_page = string.Empty;
                    }

                    //-------------------------------------------------------------------------
                    //-- else, if this is an EXISTING organization...
                    //-------------------------------------------------------------------------
                    else
                    {
                        //-------------------------------------------------------------------------
                        //-- query database for data for this organization
                        //-------------------------------------------------------------------------
                        thisOrganization = thisOrganization.doSingleObjectQuery <LiftDomain.Organization>("select");

                        initialTimeZone   = thisOrganization.time_zone;
                        initialLanguageId = thisOrganization.language_id;
                        initialStatusId   = thisOrganization.status;

                        title_label.Text = LiftDomain.Language.Current.ORGANIZATION_EDITING_ORGANIZATION.Value + " " + thisOrganization.title;
                        edit_organization_fieldset_legend = LiftDomain.Language.Current.ORGANIZATION_EDIT_ORGANIZATION.Value;

                        delete_organization_id = id.Value;

                        if (Session["last_org_list_search"] != null)
                        {
                            redirect_after_delete_to_page = "OrganizationList.aspx?" + Session["last_org_list_search"];
                        }
                        else
                        {
                            redirect_after_delete_to_page = "OrganizationList.aspx";
                        }
                    }

                    //-------------------------------------------------------------------------
                    //-- populate the screen controls
                    //-------------------------------------------------------------------------
                    organization_title.Text       = thisOrganization.title;
                    organization_address.Text     = thisOrganization.address;
                    organization_city.Text        = thisOrganization.city;
                    organization_state.Text       = thisOrganization.state_province;
                    organization_postal_code.Text = thisOrganization.postal_code;
                    organization_phone.Text       = thisOrganization.phone;
                    organization_subdomain.Text   = thisOrganization.subdomain;
                    organization_footer.Text      = thisOrganization.footer;
                    if (thisOrganization.default_approval.Value == 1)
                    {
                        this.default_approved.Checked     = true;
                        this.default_not_approved.Checked = false;
                    }
                    else
                    {
                        this.default_approved.Checked     = false;
                        this.default_not_approved.Checked = true;
                    }

                    if (thisOrganization.default_signup_mode.Value == (int)UserSignupMode.user_create_account)
                    {
                        this.new_users_create_accounts.Checked  = true;
                        this.new_users_require_approval.Checked = false;
                    }
                    else
                    {
                        this.new_users_create_accounts.Checked  = false;
                        this.new_users_require_approval.Checked = true;
                    }

                    initTimeZoneList(initialTimeZone);
                    initLanguageList(initialLanguageId);
                    initOrganizationStatusList(initialStatusId);
                }
            }
            catch (Exception x)
            {
                //TODO: ??? WHAT DO WE DO IF THERE IS AN ERROR ???
                string m = x.Message;
                System.Diagnostics.Debug.Print("[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganization.aspx.cs::Page_Load(): " + m);
                Logger.log("EditOrganization.aspx.cs", x, "[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganization.aspx.cs::Page_Load(): " + m);
            }
            finally
            {
            }
        }