Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            public_private_selected.ErrorMessage = Language.Current.REQUEST_PUBLIC_OR_PRIVATE;

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

            PageAuthorized.check(Request, Response);

            L = LiftDomain.Language.Current;
            LiftDomain.User U = LiftDomain.User.Current;

            submitBtn.Text = L.SHARED_SUBMIT;

            string idStr = Request.Params["id"];

            if (idStr != null)
            {
                if (idStr.Length > 0)
                {
                    request_id.Value = idStr;
                }
            }


            int active = 1;

            LiftDomain.Request prayerRequest = new LiftDomain.Request();
            prayerRequest.id.Value = Convert.ToInt32(request_id.Value);

            // TODO - turn off links to updates and subscriptions here
            // prayerRequest["mode"] = "update_request";
            requestSet                = prayerRequest.doQuery("get_request");
            requestRenderer           = new RequestRenderer(requestSet);
            requestRenderer.ShowLinks = false;

            LiftDomain.Encouragement enc = new LiftDomain.Encouragement();
            enc.request_id.Value      = Convert.ToInt32(request_id.Value);
            enc["listed_threshold"]   = (U.canSeePrivateRequests ? 0 : 1);
            enc["approval_threshold"] = (U.canApproveRequests ? 0 : 1);
            encSet = enc.doQuery("get_updates");

            encRenderer = new EncouragementRenderer(encSet);

            if (IsPostBack)
            {
                if (txtCaptcha.Text.ToString().Trim().ToUpper() == Session["captchaValue"].ToString().Trim().ToUpper())
                {
                    //Response.Write("CAPTCHA verification succeeded");

                    LiftDomain.Encouragement en = new LiftDomain.Encouragement();
                    en.note.Value = note.Text;
                    int t = Convert.ToInt32(encouragement_type.SelectedValue);
                    en.encouragement_type.Value = t;
                    en.from.Value       = from.Text;
                    en.from_email.Value = from_email.Text;

                    if (request_is_public.Checked)
                    {
                        en.listed.Value = 1;
                    }
                    else
                    {
                        en.listed.Value = 0;
                    }

                    en.is_approved.Value = 1;
                    en.created_at.Value  = LiftDomain.LiftTime.CurrentTime;
                    en.post_date.Value   = LiftDomain.LiftTime.CurrentTime;
                    en.updated_at.Value  = LiftDomain.LiftTime.CurrentTime;
                    en.user_id.Value     = LiftDomain.User.Current.id;
                    en.request_id.Value  = Convert.ToInt32(request_id.Value);

                    en.doCommand("save_encouragement");

                    LiftDomain.Request savedRequest = new Request();
                    savedRequest.id.Value = en.request_id.Value;
                    savedRequest          = savedRequest.doSingleObjectQuery <Request>("getobject");
                    active = savedRequest.active.Value;

                    Response.Redirect("Requests.aspx?active=" + active.ToString());
                }
                else
                {
                    errMsg.Text = LiftDomain.Language.Current.REQUEST_UPDATE_NOT_SUCCESSFUL;
                }
            }
            else
            {
                initEncTypes(0);

                from.Text       = LiftDomain.User.Current.FullName;
                from_email.Text = LiftDomain.User.Current.email;
            }

            note.Focus();
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            Organization org = Organization.Current;

            if (org != null)
            {
                customPath  = "/custom/";
                customPath += org.subdomain;
                if (org.subdomain == "upward")
                {
                    initialTimeframe      = -100;
                    duringTheLast         = "&nbsp;";
                    requesttype.Visible   = false;
                    timeframe.Visible     = false;
                    searchBtn.Visible     = false;
                    liveSearchBox.Visible = false;
                    viewingRequestsFor    = string.Empty;
                }
                else
                {
                    initialTimeframe   = -7;
                    duringTheLast      = LiftDomain.Language.Current.REQUESTS_DURING_THE_LAST;
                    viewingRequestsFor = LiftDomain.Language.Current.REQUESTS_VISUALIZE_PRAYER_REQUESTS;
                }
            }

            PageAuthorized.check(Request, Response);

            User U = LiftDomain.User.Current;

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

            LiftDomain.Request prayerRequest = new LiftDomain.Request();

            prayerRequest["listed_threshold"] = (U.canSeePrivateRequests ? 0 : 1);

            prayerRequest["approval_threshold"] = (U.canApproveRequests ? 0 : 1);

            string strActive = Request["active"];

            if (!string.IsNullOrEmpty(strActive))
            {
                try
                {
                    active = int.Parse(strActive);
                }
                catch
                {
                    active = 1;
                }
            }

            active = (U.canApproveRequests ? active : 1);

            prayerRequest["active"] = active;

            if (IsPostBack)
            {
                int    tf     = Convert.ToInt32(timeframe.SelectedItem.Value);
                int    rt     = Convert.ToInt32(requesttype.SelectedItem.Value);
                string search = liveSearchBox.Text;
                prayerRequest["timeframe"]   = tf;
                prayerRequest["requesttype"] = rt;
                prayerRequest["search"]      = search;
                initTimeframe(tf);
                initRequestTypes(rt);
            }
            else
            {
                initRequestTypes(initialRequestType);
                initTimeframe(initialTimeframe);
                prayerRequest["search"]      = "";
                prayerRequest["timeframe"]   = initialTimeframe;
                prayerRequest["requesttype"] = initialRequestType;
            }

            requestSet                  = prayerRequest.doQuery("get_requests");
            requestRenderer             = new RequestRenderer(requestSet);
            requestRenderer.ShowUpdates = true;
            requestRenderer.ShowActive  = (active == 1);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            string foo = LiftDomain.Language.Current.REQUEST_FIELDS_OPTIONAL;



            PageAuthorized.check(Request, Response);

            L = LiftDomain.Language.Current;
            LiftDomain.User U = LiftDomain.User.Current;

            submitBtn.Text = L.SHARED_SUBMIT;

            string idStr = Request.Params["id"];

            if (idStr != null)
            {
                if (idStr.Length > 0)
                {
                    request_id.Value = idStr;
                }
            }

            LiftDomain.Request prayerRequest = new LiftDomain.Request();
            prayerRequest.id.Value = Convert.ToInt32(request_id.Value);

            // TODO - turn off links to updates and subscriptions here
            // prayerRequest["mode"] = "update_request";
            requestSet                = prayerRequest.doQuery("get_request");
            requestRenderer           = new RequestRenderer(requestSet);
            requestRenderer.ShowLinks = false;

            LiftDomain.Encouragement enc = new LiftDomain.Encouragement();
            enc.request_id.Value      = Convert.ToInt32(request_id.Value);
            enc["listed_threshold"]   = (U.canSeePrivateRequests ? 0 : 1);
            enc["approval_threshold"] = (U.canApproveRequests ? 0 : 1);
            encSet = enc.doQuery("get_updates");

            encRenderer = new EncouragementRenderer(encSet);

            if (IsPostBack)
            {
                if (txtCaptcha.Text.ToString().Trim().ToUpper() == Session["captchaValue"].ToString().Trim().ToUpper())
                {
                    //Response.Write("CAPTCHA verification succeeded");

                    LiftDomain.Encouragement en = new LiftDomain.Encouragement();
                    en.note.Value = note.Text;

                    en.encouragement_type.Value = (int)Encouragement.Report;
                    en.from.Value       = from.Text;
                    en.from_email.Value = from_email.Text;


                    en.listed.Value = 0;  // always make reports private


                    en.is_approved.Value = 0;
                    en.created_at.Value  = LiftDomain.LiftTime.CurrentTime;
                    en.post_date.Value   = LiftDomain.LiftTime.CurrentTime;
                    en.updated_at.Value  = LiftDomain.LiftTime.CurrentTime;
                    en.user_id.Value     = LiftDomain.User.Current.id;
                    en.request_id.Value  = Convert.ToInt32(request_id.Value);

                    en.doCommand("save_encouragement");

                    LiftDomain.Request pr = new LiftDomain.Request();
                    pr.id.Value          = Convert.ToInt32(request_id.Value);
                    pr.is_approved.Value = 0;
                    pr.last_action.Value = LiftDomain.LiftTime.CurrentTime;
                    pr.updated_at.Value  = LiftDomain.LiftTime.CurrentTime;

                    pr.doCommand("approve");

                    LiftDomain.Encouragement allEnc = new LiftDomain.Encouragement();
                    allEnc.request_id.Value  = Convert.ToInt32(request_id.Value);
                    allEnc.is_approved.Value = 0;
                    allEnc.approved_at.Value = LiftDomain.LiftTime.CurrentTime;
                    allEnc.doCommand("approve_all");

                    Response.Redirect("Requests.aspx");
                }
                else
                {
                    errMsg.Text = LiftDomain.Language.Current.REQUEST_UPDATE_NOT_SUCCESSFUL;
                }
            }
            else
            {
                from.Text       = "";
                from_email.Text = "";
            }

            this.note.Focus();
        }