Exemplo n.º 1
0
    /// <summary>
    /// Sets buttons actions.
    /// </summary>
    protected void Initialize()
    {
        ScriptHelper.RegisterDialogScript(Page);
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "GetSelectedItem" + ItemType.ToString(), ScriptHelper.GetScript(@"
            function getSelectedItem_" + ItemType.ToString() + "() { \n" +
                                                                                                                                     "   if (document.getElementById('" + brsItems.UniSelectorClientID + "') != null) { \n" +
                                                                                                                                     "      return document.getElementById('" + brsItems.UniSelectorClientID + "').value; " +
                                                                                                                                     "   } \n" +
                                                                                                                                     "   return 0; } \n\n" +

                                                                                                                                     "function DeleteItem_" + ItemType.ToString() + "() { \n" +
                                                                                                                                     "   if ((document.getElementById('" + brsItems.UniSelectorClientID + "') != null) && (document.getElementById('" + brsItems.UniSelectorClientID + "').value != '0')) { \n" +
                                                                                                                                     "       if (confirm(" + ScriptHelper.GetString(ResHelper.GetString("general.confirmdelete")) + ")) { \n" +
                                                                                                                                     "           document.getElementById('" + hdnItemId.ClientID + "').value = getSelectedItem_" + ItemType.ToString() + "();  " + Page.ClientScript.GetPostBackEventReference(btnHdnDelete, null) + " } \n" +
                                                                                                                                     "   } else { alert(" + ScriptHelper.GetString(ResHelper.GetString("Reporting_General.SelectObjectFirst")) + "); } \n" +
                                                                                                                                     "} \n\n" +

                                                                                                                                     "function InserMacro_" + ItemType.ToString() + "() { \n" +
                                                                                                                                     "   if ((document.getElementById('" + brsItems.UniSelectorClientID + "') != null) && (document.getElementById('" + brsItems.UniSelectorClientID + "').value != '0')) { \n" +
                                                                                                                                     "       PageMethods.GetReportItemName('" + ReportInfoProvider.ReportItemTypeToString(ItemType) + "',getSelectedItem_" + ItemType.ToString() + "(),OnComplete_" + ItemType.ToString() + ");\n" +
                                                                                                                                     "   } else { alert(" + ScriptHelper.GetString(ResHelper.GetString("Reporting_General.SelectObjectFirst")) + "); } \n" +
                                                                                                                                     @"} 

             function OnComplete_" + ItemType.ToString() + @"(result, response, context){
                InsertHTML('%%control:Report" + ItemType.ToString() + "?" + Report.ReportName + @".' + result +'%%');
             }  

             function CloneItem_" + ItemType.ToString() + @"(id){
               if ((document.getElementById('" + brsItems.UniSelectorClientID + @"') != null) && (document.getElementById('" + brsItems.UniSelectorClientID + @"').value != '0')) { 
                modalDialog('" + URLHelper.ResolveUrl("~/CMSModules/Objects/Dialogs/CloneObjectDialog.aspx?objectType=" + GetObjectType() + @"&objectId='+id") + @", 'CloneObject', 750, 400);
              } else { alert(" + ScriptHelper.GetString(ResHelper.GetString("Reporting_General.SelectObjectFirst")) + @"); } 
             }"));


        string modalHeight = "760";
        string modalWidth  = "1050";

        if (Report != null)
        {
            btnAdd.OnClientClick    = "modalDialog('" + ResolveUrl(mEditUrl) + "?reportId=" + Report.ReportID + "','ReportItemEdit'," + modalWidth + "," + modalHeight + ");return false;";
            btnEdit.OnClientClick   = "if (getSelectedItem_" + ItemType.ToString() + "() != '0') { modalDialog('" + ResolveUrl(mEditUrl) + "?reportId=" + Report.ReportID + "&itemid='+ getSelectedItem_" + ItemType.ToString() + "(),'ReportItemEdit'," + modalWidth + "," + modalHeight + "); } else { alert(" + ScriptHelper.GetString(ResHelper.GetString("Reporting_General.SelectObjectFirst")) + ");} return false;";
            btnDelete.OnClientClick = "DeleteItem_" + ItemType.ToString() + "(); return false;";
            btnInsert.OnClientClick = "InserMacro_" + mItemType.ToString() + "(); return false;";
            btnClone.OnClientClick  = "CloneItem_" + ItemType.ToString() + @"(getSelectedItem_" + ItemType.ToString() + "()); return false;";

            btnPreview.OnClientClick = "if (getSelectedItem_" + ItemType.ToString() + "() != '0') { modalDialog('" + ResolveUrl(mEditUrl) + "?preview=true&reportId=" + Report.ReportID + "&itemid='+ getSelectedItem_" + ItemType.ToString() + "(),'ReportItemEdit'," + modalWidth + "," + modalHeight + "); } else { alert(" + ScriptHelper.GetString(ResHelper.GetString("Reporting_General.SelectObjectFirst")) + ");} return false;";
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Sets buttons actions.
    /// </summary>
    protected void Initialize()
    {
        ScriptHelper.RegisterDialogScript(this.Page);
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), @"       
        
        GetSelectedItem" + mItemType.ToString(), ScriptHelper.GetScript(
            "function getSelectedItem_" + mItemType.ToString() + "() { \n" +
            "   if (document.getElementById('" + brsItems.UniSelectorClientID + "') != null) { \n" +
            "      return document.getElementById('" + brsItems.UniSelectorClientID + "').value; " +
            "   } \n" +
            "   return 0; } \n\n" +
            "function DeleteItem_" + mItemType.ToString() + "() { \n" +
            "   if ((document.getElementById('" + brsItems.UniSelectorClientID + "') != null) && (document.getElementById('" + brsItems.UniSelectorClientID + "').value != '0')) { \n" +
            "       if (confirm(" + ScriptHelper.GetString(ResHelper.GetString("general.confirmdelete")) + ")) { \n" +
            "           document.getElementById('" + this.hdnItemId.ClientID + "').value = getSelectedItem_" + mItemType.ToString() + "();  " + this.Page.ClientScript.GetPostBackEventReference(btnHdnDelete, null) + " } \n" +
            "   } else { alert('" + ResHelper.GetString("Reporting_General.SelectObjectFirst") + "'); } \n" +
            "} \n\n" +
            "function InserMacro_" + mItemType.ToString() + "() { \n" +
            "   if ((document.getElementById('" + brsItems.UniSelectorClientID + "') != null) && (document.getElementById('" + brsItems.UniSelectorClientID + "').value != '0')) { \n" +
            "       InsertHTML('%%control:Report" + ItemType.ToString() + "?" + Report.ReportName + ".' + getSelectedItem_" + mItemType.ToString() + "() + '%%'); \n" +
            "   } else { alert('" + ResHelper.GetString("Reporting_General.SelectObjectFirst") + "'); } \n" +
            "} \n"
            ));


        string modalHeight = "760";
        string modalWidth = "1050";

        if (this.Report != null)
        {
            btnAdd.OnClientClick = "modalDialog('" + ResolveUrl(mEditUrl) + "?reportId=" + Report.ReportID + "','ReportItemEdit'," + modalWidth + "," + modalHeight + ");return false;";
            btnEdit.OnClientClick = "if (getSelectedItem_" + mItemType.ToString() + "() != '0') { modalDialog('" + ResolveUrl(mEditUrl) + "?reportId=" + Report.ReportID + "&itemName='+ getSelectedItem_" + mItemType.ToString() + "(),'ReportItemEdit'," + modalWidth + "," + modalHeight + "); } else { alert('" + ResHelper.GetString("Reporting_General.SelectObjectFirst") + "');} return false;";
            btnDelete.OnClientClick = "DeleteItem_" + mItemType.ToString() + "(); return false;";
            btnInsert.OnClientClick = "InserMacro_" + mItemType.ToString() + "(); return false;";

            btnPreview.OnClientClick = "if (getSelectedItem_" + mItemType.ToString() + "() != '0') { modalDialog('" + ResolveUrl(mEditUrl) + "?preview=true&reportId=" + Report.ReportID + "&itemName='+ getSelectedItem_" + mItemType.ToString() + "(),'ReportItemEdit'," + modalWidth + "," + modalHeight + "); } else { alert('" + ResHelper.GetString("Reporting_General.SelectObjectFirst") + "');} return false;";


        }
    }