Example #1
0
    protected void DeletePage(object sender, EventArgs e)
    {
        CContentManagement cms = new CContentManagement(BaseMstr);

        long lPageID = -1;

        long.TryParse(htxtSelectedPageID.Value, out lPageID);
        if (lPageID > 0)
        {
            if (cms.DeleteCMSPage(lPageID))
            {
                GetPagesList();

                htxtPreSelPageID.Value   = "-1";
                htxtSelectedPageID.Value = "-1";

                divEditControls.Style.Add("display", "block");
                divAddPage.Style.Add("display", "block");
                divEditPage.Style.Add("display", "none");
                spDeletePage.Style.Add("display", "none");

                rblPageEditMode.SelectedIndex = 0;


                txtPageTitle.Text           = String.Empty;
                cboAuthors.SelectedValue    = BaseMstr.FXUserID.ToString();
                cboPageStatus.SelectedValue = "0";
                this.txtPageContents.Text   = String.Empty;
            }
        }
    }
Example #2
0
    protected bool Save()
    {
        bool bSave = false;

        CContentManagement cms = new CContentManagement(BaseMstr);

        if (ValidateContents())
        {
            int iSelectedIndex = rblPageEditMode.SelectedIndex; //delete this after testing

            //insert page
            if (rblPageEditMode.SelectedIndex == 0)
            {
                long   lAuthorID     = Convert.ToInt32(cboAuthors.SelectedValue);
                string strAuthorName = cboAuthors.SelectedItem.Text;

                long lPageID = -1;
                bool bInsert = cms.InsertPage(lAuthorID,
                                              txtPageTitle.Text.Trim(),
                                              txtPageContents.Text,
                                              Convert.ToInt32(cboPageStatus.SelectedValue),
                                              out lPageID);
                if (bInsert)
                {
                    bSave = true;

                    htxtSelectedPageID.Value      = lPageID.ToString();
                    rblPageEditMode.SelectedIndex = 1;

                    divStatus.InnerHtml = "<font color=\"green\"><img alt=\"\" src=\"Images/tick.png\">&nbsp;Page contents were saved!</font>";
                }

                ShowSysFeedback();
                return(bSave);
            }

            //update page
            if (rblPageEditMode.SelectedIndex == 1)
            {
                long lPageID = Convert.ToInt32(htxtSelectedPageID.Value);
                bool bUpdate = cms.EditPage(lPageID,
                                            Convert.ToInt32(cboAuthors.SelectedValue),
                                            txtPageTitle.Text.Trim(),
                                            txtPageContents.Text,
                                            Convert.ToInt32(cboPageStatus.SelectedValue));
                if (bUpdate)
                {
                    bSave = true;

                    divStatus.InnerHtml = "<font color=\"green\"><img alt=\"\" src=\"Images/tick.png\">&nbsp;Page contents were saved!</font>";
                }

                ShowSysFeedback();
                return(bSave);
            }
        }

        return(false);
    }
Example #3
0
    protected void GetPagesList()
    {
        CContentManagement cms     = new CContentManagement(BaseMstr);
        DataSet            dsPages = cms.GetPagesListDS();

        repPagesList.DataSource = dsPages;
        repPagesList.DataBind();
    }
Example #4
0
    protected void SelectPage(object sender, EventArgs e)
    {
        CContentManagement cms = new CContentManagement(BaseMstr);
        long lAuthorID         = 0;

        if (!String.IsNullOrEmpty(htxtPreSelPageID.Value))
        {
            long lPageID = Convert.ToInt32(htxtPreSelPageID.Value);

            DataSet dsPage = cms.GetPageContentsDS(lPageID);
            foreach (DataTable dt in dsPage.Tables)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (!dr.IsNull("TITLE"))
                    {
                        txtPageTitle.Text = dr["TITLE"].ToString();
                    }

                    if (!dr.IsNull("AUTHOR_ID"))
                    {
                        cboAuthors.SelectedValue = dr["AUTHOR_ID"].ToString();
                        lAuthorID = Convert.ToInt32(dr["AUTHOR_ID"]);
                    }

                    if (!dr.IsNull("STATUS"))
                    {
                        cboPageStatus.SelectedValue = dr["STATUS"].ToString();
                    }

                    if (!dr.IsNull("CONTENTS"))
                    {
                        this.txtPageContents.Text = dr["CONTENTS"].ToString();
                    }
                }
            }

            divStatus.InnerHtml = string.Empty;

            ScriptManager.RegisterStartupScript(upSelPage, typeof(string), "hideEditPopup", "winSelectPage.hide();", true);

            htxtPreSelPageID.Value   = String.Empty;
            htxtSelectedPageID.Value = lPageID.ToString();

            if (lPageID > 0)
            {
                divEditControls.Style.Add("display", "block");
                if (lAuthorID == BaseMstr.FXUserID || BaseMstr.APPMaster.HasUserRight(12582912)) // CMS Editor + CMS Publisher
                {
                    spDeletePage.Style.Add("display", "inline");
                }
                else
                {
                    spDeletePage.Style.Add("display", "none");
                }
            }
        }
    }
Example #5
0
    protected void RenderMenuTree()
    {
        CContentManagement cms = new CContentManagement(BaseMstr);

        cms.RenderTreePanel(divMenuTree);

        DataSet dsMenus = cms.GetALLMenuItems();

        htxtMenuData.Value = utils.GetJSONString(dsMenus);
    }
Example #6
0
    protected void LoadPagesListDD()
    {
        CContentManagement cms     = new CContentManagement(BaseMstr);
        DataSet            dsPages = cms.GetPagesListDS();

        cboTargetPage.DataSource     = dsPages;
        cboTargetPage.DataTextField  = "TITLE";
        cboTargetPage.DataValueField = "PAGE_ID";
        cboTargetPage.DataBind();

        cboTargetPage.Items.Insert(0, new ListItem("--MENU GROUP--", "0"));
    }
Example #7
0
    protected void GetTemplatesList()
    {
        if (Session["CMS_TEMPLATES_DS"] == null)
        {
            CContentManagement cms = new CContentManagement(BaseMstr);
            DataSet            ds  = cms.GetTemplatesListDS();
            Session["CMS_TEMPLATES_DS"] = ds;
        }

        DataSet dsTemplates = (DataSet)Session["CMS_TEMPLATES_DS"];

        cboTemplates.DataSource     = dsTemplates;
        cboTemplates.DataTextField  = "TITLE";
        cboTemplates.DataValueField = "PAGE_ID";
        cboTemplates.DataBind();

        cboTemplates.Items.Insert(0, new ListItem("-- Select Template --", "-1"));
    }
Example #8
0
    protected void GetPageContents(long lPageID)
    {
        CContentManagement cms    = new CContentManagement(Master);
        DataSet            dsPage = cms.GetPageContentsDS(lPageID);

        foreach (DataTable dt in dsPage.Tables)
        {
            foreach (DataRow dr in dt.Rows)
            {
                if (!dr.IsNull("TITLE"))
                {
                    litTitle.Text = dr["TITLE"].ToString();
                }

                if (!dr.IsNull("CONTENTS"))
                {
                    litContents.Text = dr["CONTENTS"].ToString();
                }
            }
        }
    }
Example #9
0
    protected void GetAuthorList()
    {
        CContentManagement cms       = new CContentManagement(BaseMstr);
        DataSet            dsAuthors = cms.GetAuthorDS();

        //load combo for the main screen
        cboAuthors.DataTextField  = "NAME";
        cboAuthors.DataValueField = "FX_USER_ID";
        cboAuthors.DataSource     = dsAuthors;
        cboAuthors.DataBind();
        cboAuthors.ClearSelection();

        //load combo for the popup
        cboAuthorsPopup.DataTextField  = "NAME";
        cboAuthorsPopup.DataValueField = "FX_USER_ID";
        cboAuthorsPopup.DataSource     = dsAuthors;
        cboAuthorsPopup.DataBind();

        cboAuthorsPopup.Items.Insert(0, new ListItem("-View All-", "-1"));
        cboAuthorsPopup.SelectedIndex = 0;
    }
Example #10
0
    protected void upEduContents_OnLoad(object sender, EventArgs e)
    {
        long lEduID = -1;

        if (htxtEduID.Value.Length > 0)
        {
            lEduID = Convert.ToInt32(htxtEduID.Value);
        }

        string strTitle = String.Empty;

        CContentManagement cms    = new CContentManagement(Master);
        DataSet            dsPage = cms.GetPageContentsDS(lEduID);

        foreach (DataTable dt in dsPage.Tables)
        {
            foreach (DataRow dr in dt.Rows)
            {
                if (!dr.IsNull("TITLE"))
                {
                    litTitle.Text = dr["TITLE"].ToString();
                    strTitle      = dr["TITLE"].ToString();
                }

                if (!dr.IsNull("CONTENTS"))
                {
                    litContents.Text = dr["CONTENTS"].ToString();
                }
            }
        }

        if (!String.IsNullOrEmpty(strTitle))
        {
            ScriptManager.RegisterStartupScript(upEduContents, GetType(), "trackTitle", "window.eduTitle = '" + HttpUtility.HtmlEncode(strTitle) + "'", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(upEduContents, GetType(), "trackTitle", "if(typeof(window.eduTitle)!=\"undefined\"){delete window.eduTitle;}", true);
        }
    }
Example #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_cms = new CContentManagement(BaseMstr);

        if (!IsPostBack)
        {
            LoadPagesListDD();
            LoadUserRightsChkbx();
        }

        if (IsPostBack)
        {
            if (BaseMstr.OnMasterSAVE())
            {
                if (Save())
                {
                    divStatus.InnerHtml = "<font color=\"green\"><img alt=\"\" src=\"Images/tick.png\">&nbsp;Menu item was saved!</font>";
                    ScriptManager.RegisterClientScriptBlock((UpdatePanel)this.Parent.FindControl("upWrapperUpdatePanel"), typeof(string), "saved", "clearStatusDiv(1.2);", true);
                }
            }
        }

        InitMenuEdit();
    }
Example #12
0
    // Build the Menu's HTML string
    public string RenderMenuHTML()
    {
        String  strMenuHTML = String.Empty;
        DataSet dsRootLevel = GetRootLevelItemsDS();
        DataSet dsMenuItems = GetMenuItemsDS();

        bool bSelectedPatient   = (!String.IsNullOrEmpty(m_BaseMstr.SelectedPatientID));
        bool bSelectedEncounter = (!String.IsNullOrEmpty(m_BaseMstr.SelectedEncounterID));
        bool bHasOpenCase       = false;

        if (bSelectedPatient)
        {
            bHasOpenCase = m_BaseMstr.APPMaster.PatientHasOpenCase;
        }

        //menu outter wrapper <UL>
        strMenuHTML += "<ul id=\"simple-horizontal-menu\">\n";

        if (dsRootLevel.Tables[0].Rows.Count > 0)
        {
            foreach (DataTable dt in dsRootLevel.Tables)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    bool bItmSelectedPatient   = false;
                    bool bItmSelectedEncounter = false;
                    bool bItmHasOpenCase       = false;
                    bool bCheckPatLock         = false;

                    string strMenuItem = String.Empty;

                    if (!dr.IsNull("MENU_ITEM"))
                    {
                        strMenuItem += "<li>\n";
                        strMenuItem += "<a href=\"" + dr["href"].ToString() + "\" ";

                        if (!dr.IsNull("HTML_PROPERTY"))
                        {
                            strMenuItem += dr["HTML_PROPERTY"].ToString() + " ";
                        }

                        if (!dr.IsNull("JS_PROPERTY"))
                        {
                            strMenuItem += dr["JS_PROPERTY"].ToString() + " ";
                        }

                        strMenuItem += " >";
                        strMenuItem += dr["MENU_ITEM"].ToString();
                        strMenuItem += "</a>\n";

                        strMenuItem += RenderSubMenusHTML(dsMenuItems, Convert.ToInt32(dr["MENU_ITEM_ID"]));

                        strMenuItem += "</li>\n";
                    }

                    bItmSelectedPatient   = (Convert.ToInt32(dr["SELECTED_PATIENT"]) > 0);
                    bItmSelectedEncounter = (Convert.ToInt32(dr["SELECTED_ENCOUNTER"]) > 0);
                    bItmHasOpenCase       = (Convert.ToInt32(dr["HAS_OPEN_CASE"]) > 0);
                    bCheckPatLock         = (Convert.ToInt32(dr["CHECK_PAT_LOCK"]) > 0);

                    if (!bItmHasOpenCase || bHasOpenCase)
                    {
                        // check if the menu item requires a selected patient
                        // if there is no selected patient the menu item is ignored
                        // if there is a selected patient, replace the patient place holder string ~%P~
                        if (bItmSelectedPatient && !bSelectedPatient)
                        {
                            strMenuItem = String.Empty;
                        }

                        if (bItmSelectedPatient && bSelectedPatient)
                        {
                            strMenuItem = strMenuItem.Replace("~%P~", m_BaseMstr.SelectedPatientID);
                            strMenuItem = strMenuItem.Replace("~%T~", m_BaseMstr.SelectedTreatmentID.ToString());
                        }

                        // check if the menu item requires a selected encounter
                        // if there is no selected encounter the menu item is ignored
                        // if there is a selected encounter, replace the encounter place holder string ~%E~
                        if (bItmSelectedEncounter && !bSelectedEncounter)
                        {
                            strMenuItem = String.Empty;
                        }

                        if (bItmSelectedEncounter && bSelectedEncounter)
                        {
                            strMenuItem = strMenuItem.Replace("~%E~", m_BaseMstr.SelectedEncounterID);
                            // replace the treatment id place holder ~%T~
                            strMenuItem = strMenuItem.Replace("~%T~", m_BaseMstr.SelectedTreatmentID.ToString());
                        }
                    }
                    else
                    {
                        strMenuItem = String.Empty;
                    }

                    if (bCheckPatLock && m_BaseMstr.IsPatientLocked)
                    {
                        strMenuItem = String.Empty;
                    }

                    strMenuHTML += strMenuItem;
                }
            }
        }

        //add the cms items
        //Get CMS MENU
        CContentManagement cms = new CContentManagement(m_BaseMstr);

        strMenuHTML += cms.RenderMenuHTML(1); //1 is patient website; 2 is practitioner website

        strMenuHTML += "</ul>";

        return(strMenuHTML);
    }
Example #13
0
    protected void ShowResults(string strSearch)
    {
        CContentManagement cms       = new CContentManagement(Master);
        DataSet            dsResults = cms.SearchPagesDS(strSearch);

        string strResults = String.Empty;

        if (dsResults != null)
        {
            strResults += "<ol>";
            foreach (DataTable dt in dsResults.Tables)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    strResults += "<li><div><a href=\"cms_contents.aspx?id=" + dr["PAGE_ID"].ToString();
                    strResults += "\" style=\"font-weight: bold; color: blue;\" \">";
                    strResults += dr["TITLE"].ToString();
                    strResults += "</a><br/>";

                    //show matches inside the contents ------------------------------------------
                    strResults += "<ul>";

                    Regex regex = new Regex("</?(.*)>", RegexOptions.IgnoreCase | RegexOptions.Multiline);

                    string strLSearch   = strSearch.ToLower();
                    string strContents  = dr["CONTENTS"].ToString();
                    string strLContents = strContents.ToLower();

                    int iStringIndex = strLContents.IndexOf(strLSearch);
                    int iStartIndex  = 0;
                    int iLeftPad     = 35;
                    int iMaxLen      = 400;

                    if (iStringIndex >= iLeftPad)
                    {
                        iStartIndex = iStringIndex - iLeftPad;
                    }

                    string strSub1 = strContents.Substring(iStartIndex);
                    string strSub2 = String.Empty;

                    if (strSub1.Length > iMaxLen)
                    {
                        strSub2 = strSub1.Substring(0, iMaxLen);
                    }
                    else
                    {
                        strSub2 = strSub1;
                    }

                    if (strSub2.Trim().Length > 0)
                    {
                        Regex reSearch = new Regex("(" + strSearch + ")", RegexOptions.IgnoreCase | RegexOptions.Multiline);
                        //reSearch.Replace(strSub2, "<span style=\"background-color: yellow;\">$1</span>")

                        strResults += "<li>";
                        strResults += "<p>[...]";
                        strResults += reSearch.Replace(strSub2, "<span style=\"background-color: yellow;\">$1</span>");
                        strResults += "[...]</p>";
                        strResults += "</li>";
                    }

                    strResults += "</ul>";
                    // --------------------------------------------------------------------------

                    strResults += "</div></li>";
                }
            }
            strResults += "</ol>";
        }

        divResults.InnerHtml = strResults;
    }
Example #14
0
    protected void RenderEducationTree()
    {
        CContentManagement cms = new CContentManagement(Master);

        cms.RenderEduTreePanel(divMenuTree);
    }
Example #15
0
    protected bool Save()
    {
        bool bSave = false;

        long lSortOrder = -1;

        if (Regex.Replace(txtSortOrder.Text, "\\D", String.Empty).Length > 0)
        {
            lSortOrder = Convert.ToInt32(txtSortOrder.Text);
        }

        CContentManagement cms = new CContentManagement(BaseMstr);

        if (ValidateMenuItm())
        {
            if (!String.IsNullOrEmpty(htxtEditMode.Value) || htxtCurrentID.Value != "0")
            {
                long lMode = Convert.ToInt32(htxtEditMode.Value);

                //Insert mode
                if (lMode == 1)
                {
                    if (cms.InsertMenuItem(txtMenuTitle.Text.Trim(),
                                           Convert.ToInt32(htxtCurrentID.Value),
                                           Convert.ToInt32(cboTargetPage.SelectedValue),
                                           Convert.ToInt32(htxtUserRights.Value),
                                           Convert.ToInt32(rblTargetPortal.SelectedValue),
                                           lSortOrder))
                    {
                        bSave = true;
                    }
                }

                //update mode
                if (lMode == 2)
                {
                    if (cms.UpdatetMenuItem(Convert.ToInt32(htxtCurrentID.Value),
                                            txtMenuTitle.Text.Trim(),
                                            Convert.ToInt32(htxtParentID.Value),
                                            Convert.ToInt32(cboTargetPage.SelectedValue),
                                            Convert.ToInt32(htxtUserRights.Value),
                                            Convert.ToInt32(rblTargetPortal.SelectedValue),
                                            lSortOrder))
                    {
                        bSave = true;
                    }
                }
            }
        }

        //clear hidden fields
        htxtCurrentID.Value  = String.Empty;
        htxtParentID.Value   = String.Empty;
        htxtUserRights.Value = String.Empty;
        htxtEditMode.Value   = String.Empty;

        txtMenuTitle.Text = String.Empty;

        //sysfeedback
        ShowSysFeedback();

        return(bSave);
    }