コード例 #1
0
ファイル: Default.ascx.cs プロジェクト: liqueflies/pigeoncms
    protected void GridModules_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            PigeonCms.ModuleType item = new PigeonCms.ModuleType();
            item = (PigeonCms.ModuleType)e.Row.DataItem;

            //Literal LitName = (Literal)e.Row.FindControl("LitName");
            //if (item.ContentType == MenuContentType.Url && !string.IsNullOrEmpty(item.Link))
            //    LitName.Text = "<a href='" + item.Link + "' target='_blank' title='" + item.Link + "'>" +
            //        Utility.GetTextPreview(item.Name, 20, "") + "</a>";
            //else
            //    LitName.Text = Utility.GetTextPreview(item.Name, 20, "");

            var LnkModuleLabels = (HyperLink)e.Row.FindControl("LnkModuleLabels");
            LnkModuleLabels.NavigateUrl = this.LabelsPopupUrl
                + "?ModuleFullName=" + item.FullName;

            //Uninstall button
            ImageButton img1 = (ImageButton)e.Row.FindControl("LnkDel");
            if (item.IsCore)
                img1.Visible = false;
            else
                img1.Visible = true;
        }
    }
コード例 #2
0
ファイル: Default.ascx.cs プロジェクト: liqueflies/pigeoncms
    private void editModule(string recordId)
    {
        var obj = new PigeonCms.ModuleType();
        LblOk.Text = "";
        LblErr.Text = "";

        clearForm();
        base.CurrentKey = recordId;

        obj = new ModuleTypeManager().GetByFullName(base.CurrentKey);
        obj2form(obj);

        MultiView1.ActiveViewIndex = (int)ViewIndex.EditModule;
    }
コード例 #3
0
ファイル: InstallHelper.cs プロジェクト: liqueflies/pigeoncms
        /// <summary>
        /// install additional components (modules, themes, etc)
        /// </summary>
        /// <param name="sourceFolder">
        /// absolute path of source folder ex:c:\..\..\..\installation\tmp\modulename
        /// with unpacked installation files and folders
        /// </param>
        public static void Install(string sourceFolder)
        {
            DbProviderFactory myProv = Database.ProviderFactory;
            DbTransaction myTrans = null;
            DbConnection myConn = myProv.CreateConnection();
            DbDataReader myRd = null;
            DbCommand myCmd = myConn.CreateCommand();
            string sqlQuery = ""; ;

            ModuleType moduleType = new ModuleType();

            try
            {
                moduleType = new ModuleTypeManager().GetByPath(sourceFolder, "install.xml");

                //execute sql install
                if (moduleType.InstallQueries.Count > 0)
                {
                    try
                    {
                        myConn.ConnectionString = Database.ConnString;
                        myConn.Open();
                        myCmd.Connection = myConn;
                        myTrans = myConn.BeginTransaction();
                        myCmd.Transaction = myTrans;

                        foreach (string query in moduleType.InstallQueries)
                        {
                            sqlQuery += Database.ParseSql(query);
                        }
                        Database.ExecuteQuery(myRd, myCmd, sqlQuery);
                    }
                    catch (Exception ex)
                    {
                        myTrans.Rollback();
                        throw ex;
                    }
                    finally
                    {
                        myTrans.Dispose();
                        myConn.Dispose();
                    }
                }

                string currFolder;
                string destFolder;
                //code folder
                currFolder = Path.Combine(sourceFolder, "_install\\code");
                destFolder = HttpContext.Current.Request.MapPath("~/App_Code/modules/"+ moduleType.FullName);
                if (Directory.Exists(currFolder))
                    Utility.CopyFolder(currFolder, destFolder);
                //admin folder
                currFolder = Path.Combine(sourceFolder, "_install\\admin");
                destFolder = HttpContext.Current.Request.MapPath("~/Admin/" + moduleType.FullName);
                if (Directory.Exists(currFolder))
                    Utility.CopyFolder(currFolder, destFolder);
                //module folders
                currFolder = Path.Combine(sourceFolder, "");
                destFolder = HttpContext.Current.Request.MapPath("~/Modules/" + moduleType.FullName);
                if (Directory.Exists(currFolder))
                    Utility.CopyFolder(currFolder, destFolder);
            }
            catch (Exception e)
            {
                PigeonCms.Tracer.Log("Error installing " + sourceFolder + ": " + e.ToString(), TracerItemType.Error);
                throw e;
            }
            finally
            {

            }
        }