コード例 #1
0
 /// <summary>
 /// Removes the cache amongst servers for a data type
 /// </summary>
 /// <param name="dc"></param>
 /// <param name="dataType"></param>
 public static void RemoveDataTypeCache(this DistributedCache dc, global::umbraco.cms.businesslogic.datatype.DataTypeDefinition dataType)
 {
     if (dataType != null)
     {
         dc.RefreshByJson(new Guid(DistributedCache.DataTypeCacheRefresherId),
                          DataTypeCacheRefresher.SerializeToJsonPayload(dataType));
     }
 }
コード例 #2
0
        /// <summary>
        /// Converts a macro to a jsonPayload object
        /// </summary>
        /// <param name="dataType"></param>
        /// <returns></returns>
        private static JsonPayload FromDataTypeDefinition(global::umbraco.cms.businesslogic.datatype.DataTypeDefinition dataType)
        {
            var payload = new JsonPayload
            {
                UniqueId = dataType.UniqueId,
                Id       = dataType.Id
            };

            return(payload);
        }
コード例 #3
0
        protected void confirmUnInstall(object sender, EventArgs e)
        {
            bool refreshCache = false;

            //Uninstall Stylesheets
            foreach (ListItem li in stylesheets.Items)
            {
                if (li.Selected)
                {
                    int nId;

                    if (int.TryParse(li.Value, out nId))
                    {
                        StyleSheet s = new StyleSheet(nId);
                        if (s != null)
                        {
                            s.delete();
                            pack.Data.Stylesheets.Remove(nId.ToString());
                        }
                    }
                }
            }

            //Uninstall templates
            foreach (ListItem li in templates.Items)
            {
                if (li.Selected)
                {
                    int nId;

                    if (int.TryParse(li.Value, out nId))
                    {
                        Template s = new Template(nId);
                        if (s != null)
                        {
                            s.RemoveAllReferences();
                            s.delete();
                            pack.Data.Templates.Remove(nId.ToString());
                        }
                    }
                }
            }

            //Uninstall macros
            foreach (ListItem li in macros.Items)
            {
                if (li.Selected)
                {
                    int nId;

                    if (int.TryParse(li.Value, out nId))
                    {
                        Macro s = new Macro(nId);
                        if (s != null && !String.IsNullOrEmpty(s.Name))
                        {
                            // remove from cache
                            runtimeMacro.GetMacro(s.Id).removeFromCache();
                            s.Delete();
                        }

                        pack.Data.Macros.Remove(nId.ToString());
                    }
                }
            }



            //Remove Document types
            foreach (ListItem li in documentTypes.Items)
            {
                if (li.Selected)
                {
                    int nId;

                    if (int.TryParse(li.Value, out nId))
                    {
                        DocumentType s = new DocumentType(nId);
                        if (s != null)
                        {
                            s.delete();
                            pack.Data.Documenttypes.Remove(nId.ToString());

                            // refresh content cache when document types are removed
                            refreshCache = true;
                        }
                    }
                }
            }

            //Remove Dictionary items
            foreach (ListItem li in dictionaryItems.Items)
            {
                if (li.Selected)
                {
                    int nId;

                    if (int.TryParse(li.Value, out nId))
                    {
                        cms.businesslogic.Dictionary.DictionaryItem di = new global::umbraco.cms.businesslogic.Dictionary.DictionaryItem(nId);
                        if (di != null)
                        {
                            di.delete();
                            pack.Data.DictionaryItems.Remove(nId.ToString());
                        }
                    }
                }
            }

            //Remove Data types
            foreach (ListItem li in dataTypes.Items)
            {
                if (li.Selected)
                {
                    int nId;

                    if (int.TryParse(li.Value, out nId))
                    {
                        cms.businesslogic.datatype.DataTypeDefinition dtd = new global::umbraco.cms.businesslogic.datatype.DataTypeDefinition(nId);
                        if (dtd != null)
                        {
                            dtd.delete();
                            pack.Data.DataTypes.Remove(nId.ToString());
                        }
                    }
                }
            }

            pack.Save();

            if (!isManifestEmpty())
            {
                Response.Redirect(Request.RawUrl);
            }
            else
            {
                BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, -1, "executing undo actions");

                // uninstall actions
                try {
                    System.Xml.XmlDocument actionsXml = new System.Xml.XmlDocument();
                    actionsXml.LoadXml("<Actions>" + pack.Data.Actions + "</Actions>");

                    BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, -1, actionsXml.OuterXml);
                    foreach (XmlNode n in actionsXml.DocumentElement.SelectNodes("//Action"))
                    {
                        try {
                            cms.businesslogic.packager.PackageAction.UndoPackageAction(pack.Data.Name, n.Attributes["alias"].Value, n);
                        } catch (Exception ex) {
                            BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
                        }
                    }
                } catch (Exception ex) {
                    BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
                }

                //moved remove of files here so custom package actions can still undo
                //Remove files
                foreach (ListItem li in files.Items)
                {
                    if (li.Selected)
                    {
                        //here we need to try to find the file in question as most packages does not support the tilde char

                        string file = IOHelper.FindFile(li.Value);

                        string filePath = IOHelper.MapPath(file);
                        if (System.IO.File.Exists(filePath))
                        {
                            System.IO.File.Delete(filePath);
                            pack.Data.Files.Remove(li.Value);
                        }
                    }
                }
                pack.Save();

                pack.Delete();

                packageUninstalled.Visible    = true;
                installedPackagePanel.Visible = false;
            }

            // refresh cache
            if (refreshCache)
            {
                library.RefreshContent();
            }

            //ensure that all tree's are refreshed after uninstall
            ClientTools.ClearClientTreeCache()
            .RefreshTree();

            TreeDefinitionCollection.Instance.ReRegisterTrees();

            BizLogicAction.ReRegisterActionsAndHandlers();
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] != null)
            {
                pack = cms.businesslogic.packager.InstalledPackage.GetById(int.Parse(Request.QueryString["id"]));

                lt_packagename.Text    = pack.Data.Name;
                lt_packageVersion.Text = pack.Data.Version;
                lt_packageAuthor.Text  = pack.Data.Author;
                lt_readme.Text         = library.ReplaceLineBreaks(pack.Data.Readme);

                bt_confirmUninstall.Attributes.Add("onClick", "jQuery('#buttons').hide(); jQuery('#loadingbar').show();; return true;");


                if (!Page.IsPostBack)
                {
                    //temp list to contain failing items...
                    List <string> tempList = new List <string>();

                    foreach (string str in pack.Data.Documenttypes)
                    {
                        int tId = 0;
                        if (int.TryParse(str, out tId))
                        {
                            try
                            {
                                DocumentType dc = new DocumentType(tId);
                                if (dc != null)
                                {
                                    ListItem li = new ListItem(dc.Text, dc.Id.ToString());
                                    li.Selected = true;
                                    documentTypes.Items.Add(li);
                                }
                                else
                                {
                                    tempList.Add(str);
                                }
                            }
                            catch
                            {
                                tempList.Add(str);
                            }
                        }
                    }
                    //removing failing documentTypes items from the uninstall manifest
                    syncLists(pack.Data.Documenttypes, tempList);


                    foreach (string str in pack.Data.Templates)
                    {
                        int tId = 0;
                        if (int.TryParse(str, out tId))
                        {
                            try
                            {
                                Template t = new Template(tId);
                                if (t != null)
                                {
                                    ListItem li = new ListItem(t.Text, t.Id.ToString());
                                    li.Selected = true;
                                    templates.Items.Add(li);
                                }
                                else
                                {
                                    tempList.Add(str);
                                }
                            }
                            catch
                            {
                                tempList.Add(str);
                            }
                        }
                    }
                    //removing failing template items from the uninstall manifest
                    syncLists(pack.Data.Templates, tempList);

                    foreach (string str in pack.Data.Stylesheets)
                    {
                        int tId = 0;
                        if (int.TryParse(str, out tId))
                        {
                            try
                            {
                                StyleSheet s = new StyleSheet(tId);
                                if (s != null)
                                {
                                    ListItem li = new ListItem(s.Text, s.Id.ToString());
                                    li.Selected = true;
                                    stylesheets.Items.Add(li);
                                }
                                else
                                {
                                    tempList.Add(str);
                                }
                            }
                            catch
                            {
                                tempList.Add(str);
                            }
                        }
                    }
                    //removing failing stylesheet items from the uninstall manifest
                    syncLists(pack.Data.Stylesheets, tempList);

                    foreach (string str in pack.Data.Macros)
                    {
                        int tId = 0;
                        if (int.TryParse(str, out tId))
                        {
                            try
                            {
                                Macro m = new Macro(tId);

                                if (m != null && !string.IsNullOrEmpty(m.Name))
                                { //Macros need an extra check to see if they actually exists. For some reason the macro does not return null, if the id is not found...
                                    ListItem li = new ListItem(m.Name, m.Id.ToString());
                                    li.Selected = true;
                                    macros.Items.Add(li);
                                }
                                else
                                {
                                    tempList.Add(str);
                                }
                            }
                            catch
                            {
                                tempList.Add(str);
                            }
                        }
                    }
                    //removing failing macros items from the uninstall manifest
                    syncLists(pack.Data.Macros, tempList);

                    foreach (string str in pack.Data.Files)
                    {
                        try
                        {
                            if (!String.IsNullOrEmpty(str) && System.IO.File.Exists(IOHelper.MapPath(str)))
                            {
                                ListItem li = new ListItem(str, str);
                                li.Selected = true;
                                files.Items.Add(li);
                            }
                            else
                            {
                                tempList.Add(str);
                            }
                        }
                        catch
                        {
                            tempList.Add(str);
                        }
                    }

                    //removing failing files from the uninstall manifest
                    syncLists(pack.Data.Files, tempList);

                    foreach (string str in pack.Data.DictionaryItems)
                    {
                        int tId = 0;

                        if (int.TryParse(str, out tId))
                        {
                            try
                            {
                                cms.businesslogic.Dictionary.DictionaryItem di = new global::umbraco.cms.businesslogic.Dictionary.DictionaryItem(tId);

                                if (di != null)
                                {
                                    ListItem li = new ListItem(di.key, di.id.ToString());
                                    li.Selected = true;

                                    dictionaryItems.Items.Add(li);
                                }
                                else
                                {
                                    tempList.Add(str);
                                }
                            }
                            catch
                            {
                                tempList.Add(str);
                            }
                        }
                    }

                    //removing failing files from the uninstall manifest
                    syncLists(pack.Data.DictionaryItems, tempList);


                    foreach (string str in pack.Data.DataTypes)
                    {
                        int tId = 0;

                        if (int.TryParse(str, out tId))
                        {
                            try
                            {
                                cms.businesslogic.datatype.DataTypeDefinition dtd = new global::umbraco.cms.businesslogic.datatype.DataTypeDefinition(tId);

                                if (dtd != null)
                                {
                                    ListItem li = new ListItem(dtd.Text, dtd.Id.ToString());
                                    li.Selected = true;

                                    dataTypes.Items.Add(li);
                                }
                                else
                                {
                                    tempList.Add(str);
                                }
                            }
                            catch
                            {
                                tempList.Add(str);
                            }
                        }
                    }

                    //removing failing files from the uninstall manifest
                    syncLists(pack.Data.DataTypes, tempList);

                    //save the install manifest, so even tho the user doesn't uninstall, it stays uptodate.
                    pack.Save();


                    //Look for updates on packages.
                    if (!String.IsNullOrEmpty(pack.Data.RepositoryGuid) && !String.IsNullOrEmpty(pack.Data.PackageGuid))
                    {
                        try
                        {
                            repo = cms.businesslogic.packager.repositories.Repository.getByGuid(pack.Data.RepositoryGuid);

                            if (repo != null)
                            {
                                hl_packageRepo.Text        = repo.Name;
                                hl_packageRepo.NavigateUrl = "BrowseRepository.aspx?repoGuid=" + repo.Guid;
                                pp_repository.Visible      = true;
                            }

                            cms.businesslogic.packager.repositories.Package repoPackage = repo.Webservice.PackageByGuid(pack.Data.PackageGuid);

                            if (repoPackage != null)
                            {
                                if (repoPackage.HasUpgrade && repoPackage.UpgradeVersion != pack.Data.Version)
                                {
                                    bt_update.Visible            = true;
                                    bt_update.Text               = "Update available: version: " + repoPackage.UpgradeVersion;
                                    lt_upgradeReadme.Text        = repoPackage.UpgradeReadMe;
                                    bt_gotoUpgrade.OnClientClick = "window.location.href = 'browseRepository.aspx?url=" + repoPackage.Url + "'; return true;";
                                    lt_noUpdate.Visible          = false;
                                }
                                else
                                {
                                    bt_update.Visible   = false;
                                    lt_noUpdate.Visible = true;
                                }

                                if (!string.IsNullOrEmpty(repoPackage.Demo))
                                {
                                    lb_demoLink.OnClientClick = "openDemo(this, '" + pack.Data.PackageGuid + "'); return false;";
                                    pp_documentation.Visible  = true;
                                }

                                if (!string.IsNullOrEmpty(repoPackage.Documentation))
                                {
                                    hl_docLink.NavigateUrl   = repoPackage.Documentation;
                                    hl_docLink.Target        = "_blank";
                                    pp_documentation.Visible = true;
                                }
                            }
                        }
                        catch
                        {
                            bt_update.Visible   = false;
                            lt_noUpdate.Visible = true;
                        }
                    }


                    bool deletePackage = true;
                    //sync the UI to match what is in the package
                    if (macros.Items.Count == 0)
                    {
                        pp_macros.Visible = false;
                    }
                    else
                    {
                        deletePackage = false;
                    }

                    if (documentTypes.Items.Count == 0)
                    {
                        pp_docTypes.Visible = false;
                    }
                    else
                    {
                        deletePackage = false;
                    }

                    if (files.Items.Count == 0)
                    {
                        pp_files.Visible = false;
                    }
                    else
                    {
                        deletePackage = false;
                    }

                    if (templates.Items.Count == 0)
                    {
                        pp_templates.Visible = false;
                    }
                    else
                    {
                        deletePackage = false;
                    }

                    if (stylesheets.Items.Count == 0)
                    {
                        pp_css.Visible = false;
                    }
                    else
                    {
                        deletePackage = false;
                    }

                    if (dictionaryItems.Items.Count == 0)
                    {
                        pp_di.Visible = false;
                    }
                    else
                    {
                        deletePackage = false;
                    }

                    if (dataTypes.Items.Count == 0)
                    {
                        pp_dt.Visible = false;
                    }
                    else
                    {
                        deletePackage = false;
                    }


                    if (deletePackage)
                    {
                        pane_noItems.Visible   = true;
                        bt_uninstall.Visible   = false;
                        pane_uninstall.Visible = false;
                    }
                }
            }
        }
コード例 #5
0
 static void DataTypeDefinitionDeleting(global::umbraco.cms.businesslogic.datatype.DataTypeDefinition sender, System.EventArgs e)
 {
     DistributedCache.Instance.RemoveDataTypeCache(sender);
 }
コード例 #6
0
        protected void confirmUnInstall(object sender, EventArgs e)
        {
			


            bool refreshCache = false;

            //Uninstall Stylesheets
            foreach (ListItem li in stylesheets.Items)
            {
                if (li.Selected)
                {
                    int nId;

                    if (int.TryParse(li.Value, out nId))
                    {
                        StyleSheet s = new StyleSheet(nId);
                        if (s != null)
                        {
                            s.delete();
                            pack.Data.Stylesheets.Remove(nId.ToString());
                        }
                    }
                }
            }

            //Uninstall templates
            foreach (ListItem li in templates.Items)
            {
                if (li.Selected)
                {
                    int nId;

                    if (int.TryParse(li.Value, out nId))
                    {
                        Template s = new Template(nId);
                        if (s != null)
                        {
                            s.RemoveAllReferences();
                            s.delete();
                            pack.Data.Templates.Remove(nId.ToString());
                        }
                    }
                }
            }

            //Uninstall macros
            foreach (ListItem li in macros.Items)
            {
                if (li.Selected)
                {
                    int nId;

                    if (int.TryParse(li.Value, out nId))
                    {
                        Macro s = new Macro(nId);
                        if (s != null && !String.IsNullOrEmpty(s.Name))
                        {
                            // remove from cache
                            runtimeMacro.GetMacro(s.Id).removeFromCache();
                            s.Delete();
                        }

                        pack.Data.Macros.Remove(nId.ToString());
                    }
                }
            }

           

            //Remove Document types
            foreach (ListItem li in documentTypes.Items)
            {
                if (li.Selected)
                {
                    int nId;

                    if (int.TryParse(li.Value, out nId))
                    {
                        DocumentType s = new DocumentType(nId);
                        if (s != null)
                        {
                            s.delete();
                            pack.Data.Documenttypes.Remove(nId.ToString());

                            // refresh content cache when document types are removed
                            refreshCache = true;

                        }
                    }
                }
            }

            //Remove Dictionary items
            foreach (ListItem li in dictionaryItems.Items)
            {
                if (li.Selected)
                {
                    int nId;

                    if (int.TryParse(li.Value, out nId))
                    {
                        cms.businesslogic.Dictionary.DictionaryItem di = new global::umbraco.cms.businesslogic.Dictionary.DictionaryItem(nId);
                        if (di != null)
                        {
                            di.delete();
                            pack.Data.DictionaryItems.Remove(nId.ToString());
                        }
                    }
                }
            }

            //Remove Data types
            foreach (ListItem li in dataTypes.Items)
            {
                if (li.Selected)
                {
                    int nId;

                    if (int.TryParse(li.Value, out nId))
                    {
                        cms.businesslogic.datatype.DataTypeDefinition dtd = new global::umbraco.cms.businesslogic.datatype.DataTypeDefinition(nId);
                        if (dtd != null)
                        {
                            dtd.delete();
                            pack.Data.DataTypes.Remove(nId.ToString());
                        }
                    }
                }
            }

            pack.Save();

            if (!isManifestEmpty())
            {
                Response.Redirect(Request.RawUrl);
            }
            else
            {
                BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, -1, "executing undo actions");

                // uninstall actions
                try {
                    System.Xml.XmlDocument actionsXml = new System.Xml.XmlDocument();
                    actionsXml.LoadXml("<Actions>" +  pack.Data.Actions + "</Actions>");

                    BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, -1, actionsXml.OuterXml);
                    foreach (XmlNode n in actionsXml.DocumentElement.SelectNodes("//Action")) {
                        try {
                            cms.businesslogic.packager.PackageAction.UndoPackageAction(pack.Data.Name, n.Attributes["alias"].Value, n);
                        } catch (Exception ex) {
                            BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
                        }
                    }
                } catch (Exception ex) {
                    BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
                }

                //moved remove of files here so custom package actions can still undo
                //Remove files
                foreach (ListItem li in files.Items)
                {
                    if (li.Selected)
                    {
                        //here we need to try to find the file in question as most packages does not support the tilde char

                        string file = IOHelper.FindFile(li.Value);

                        string filePath = IOHelper.MapPath(file);
                        if (System.IO.File.Exists(filePath))
                        {
                            System.IO.File.Delete(filePath);
                            pack.Data.Files.Remove(li.Value);
                        }
                    }
                }
                pack.Save();

                pack.Delete();

                packageUninstalled.Visible = true;
                installedPackagePanel.Visible = false;
            }

            // refresh cache
            if (refreshCache) {
                library.RefreshContent();
            }

            //ensure that all tree's are refreshed after uninstall
            ClientTools.ClearClientTreeCache()
                .RefreshTree();

            TreeDefinitionCollection.Instance.ReRegisterTrees();

            BizLogicAction.ReRegisterActionsAndHandlers();
            
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {

            if (Request.QueryString["id"] != null)
            {
                pack = cms.businesslogic.packager.InstalledPackage.GetById(int.Parse(Request.QueryString["id"]));

                lt_packagename.Text = pack.Data.Name;
                lt_packageVersion.Text = pack.Data.Version;
                lt_packageAuthor.Text = pack.Data.Author;
                lt_readme.Text = library.ReplaceLineBreaks( pack.Data.Readme );

                bt_confirmUninstall.Attributes.Add("onClick", "jQuery('#buttons').hide(); jQuery('#loadingbar').show();; return true;");


                if (!Page.IsPostBack)
                {
                    //temp list to contain failing items... 
                    List<string> tempList = new List<string>();

                    foreach (string str in pack.Data.Documenttypes)
                    {
                        int tId = 0;
                        if (int.TryParse(str, out tId))
                        {
                            try
                            {
                                DocumentType dc = new DocumentType(tId);
                                if (dc != null)
                                {
                                    ListItem li = new ListItem(dc.Text, dc.Id.ToString());
                                    li.Selected = true;
                                    documentTypes.Items.Add(li);
                                }
                                else
                                {
                                    tempList.Add(str);
                                }
                            }
                            catch
                            {
                                tempList.Add(str);
                            }
                        }
                    }
                    //removing failing documentTypes items from the uninstall manifest
                    syncLists(pack.Data.Documenttypes, tempList);


                    foreach (string str in pack.Data.Templates)
                    {
                        int tId = 0;
                        if (int.TryParse(str, out tId))
                        {
                            try
                            {
                                Template t = new Template(tId);
                                if (t != null)
                                {
                                    ListItem li = new ListItem(t.Text, t.Id.ToString());
                                    li.Selected = true;
                                    templates.Items.Add(li);
                                }
                                else
                                {
                                    tempList.Add(str);
                                }
                            }
                            catch
                            {
                                tempList.Add(str);
                            }
                        }
                    }
                    //removing failing template items from the uninstall manifest
                    syncLists(pack.Data.Templates, tempList);

                    foreach (string str in pack.Data.Stylesheets)
                    {
                        int tId = 0;
                        if (int.TryParse(str, out tId))
                        {
                            try
                            {
                                StyleSheet s = new StyleSheet(tId);
                                if (s != null)
                                {
                                    ListItem li = new ListItem(s.Text, s.Id.ToString());
                                    li.Selected = true;
                                    stylesheets.Items.Add(li);
                                }
                                else
                                {
                                    tempList.Add(str);
                                }
                            }
                            catch
                            {
                                tempList.Add(str);
                            }
                        }
                    }
                    //removing failing stylesheet items from the uninstall manifest
                    syncLists(pack.Data.Stylesheets, tempList);

                    foreach (string str in pack.Data.Macros)
                    {
                        int tId = 0;
                        if (int.TryParse(str, out tId))
                        {
                            try
                            {
                                Macro m = new Macro(tId);

                                if (m != null && !string.IsNullOrEmpty(m.Name))
                                { //Macros need an extra check to see if they actually exists. For some reason the macro does not return null, if the id is not found... 
                                    ListItem li = new ListItem(m.Name, m.Id.ToString());
                                    li.Selected = true;
                                    macros.Items.Add(li);
                                }
                                else
                                {
                                    tempList.Add(str);
                                }
                            }
                            catch
                            {
                                tempList.Add(str);
                            }
                        }
                    }
                    //removing failing macros items from the uninstall manifest
                    syncLists(pack.Data.Macros, tempList);

                    foreach (string str in pack.Data.Files)
                    {
                        try
                        {
                            
                            if (!String.IsNullOrEmpty(str) && System.IO.File.Exists( IOHelper.MapPath(str) ))
                            {
                                ListItem li = new ListItem(str, str);
                                li.Selected = true;
                                files.Items.Add(li);
                            }
                            else
                            {
                                tempList.Add(str);
                            }

                        }
                        catch
                        {
                            tempList.Add(str);
                        }
                    }

                    //removing failing files from the uninstall manifest
                    syncLists(pack.Data.Files, tempList);

                    foreach (string str in pack.Data.DictionaryItems)
                    {
                        int tId = 0;

                        if (int.TryParse(str, out tId))
                        {
                            try
                            {
                                cms.businesslogic.Dictionary.DictionaryItem di = new global::umbraco.cms.businesslogic.Dictionary.DictionaryItem(tId);

                                if (di != null)
                                {
                                    ListItem li = new ListItem(di.key, di.id.ToString());
                                    li.Selected = true;

                                    dictionaryItems.Items.Add(li);
                                }
                                else
                                {
                                    tempList.Add(str);
                                }
                            }
                            catch
                            {
                                tempList.Add(str);
                            }
                        }
                    }

                    //removing failing files from the uninstall manifest
                    syncLists(pack.Data.DictionaryItems, tempList);


                    foreach (string str in pack.Data.DataTypes)
                    {
                        int tId = 0;

                        if (int.TryParse(str, out tId))
                        {
                            try
                            {
                                cms.businesslogic.datatype.DataTypeDefinition dtd = new global::umbraco.cms.businesslogic.datatype.DataTypeDefinition(tId);

                                if (dtd != null)
                                {
                                    ListItem li = new ListItem(dtd.Text, dtd.Id.ToString());
                                    li.Selected = true;

                                    dataTypes.Items.Add(li);
                                }
                                else
                                {
                                    tempList.Add(str);
                                }
                            }
                            catch
                            {
                                tempList.Add(str);
                            }
                        }
                    }

                    //removing failing files from the uninstall manifest
                    syncLists(pack.Data.DataTypes, tempList);

                    //save the install manifest, so even tho the user doesn't uninstall, it stays uptodate.
                    pack.Save();


                    //Look for updates on packages.
                    if (!String.IsNullOrEmpty(pack.Data.RepositoryGuid) && !String.IsNullOrEmpty(pack.Data.PackageGuid))
                    {
                        try
                        {
                            
                            repo = cms.businesslogic.packager.repositories.Repository.getByGuid(pack.Data.RepositoryGuid);

                            if (repo != null)
                            {
                                hl_packageRepo.Text = repo.Name;
                                hl_packageRepo.NavigateUrl = "BrowseRepository.aspx?repoGuid=" + repo.Guid;
                                pp_repository.Visible = true;
                            }

                            cms.businesslogic.packager.repositories.Package repoPackage = repo.Webservice.PackageByGuid(pack.Data.PackageGuid);

                            if (repoPackage != null) {
                                if (repoPackage.HasUpgrade && repoPackage.UpgradeVersion != pack.Data.Version) {
                                    bt_update.Visible = true;
                                    bt_update.Text = "Update available: version: " + repoPackage.UpgradeVersion;
                                    lt_upgradeReadme.Text = repoPackage.UpgradeReadMe;
                                    bt_gotoUpgrade.OnClientClick = "window.location.href = 'browseRepository.aspx?url=" + repoPackage.Url + "'; return true;";
                                    lt_noUpdate.Visible = false;
                                } else {
                                    bt_update.Visible = false;
                                    lt_noUpdate.Visible = true;
                                }

                                if (!string.IsNullOrEmpty(repoPackage.Demo)) {
                                    lb_demoLink.OnClientClick = "openDemo(this, '" + pack.Data.PackageGuid + "'); return false;";
                                    pp_documentation.Visible = true;
                                }
                                    
                                if(!string.IsNullOrEmpty(repoPackage.Documentation)) {
                                    hl_docLink.NavigateUrl = repoPackage.Documentation;
                                    hl_docLink.Target = "_blank";
                                    pp_documentation.Visible = true;
                                }
                            }
                        }
                        catch
                        {
                            bt_update.Visible = false;
                            lt_noUpdate.Visible = true;
                        }
                    }


                    bool deletePackage = true;
                    //sync the UI to match what is in the package
                    if (macros.Items.Count == 0)
                        pp_macros.Visible = false;
                    else
                        deletePackage = false;

                    if (documentTypes.Items.Count == 0)
                        pp_docTypes.Visible = false;
                    else
                        deletePackage = false;

                    if (files.Items.Count == 0)
                        pp_files.Visible = false;
                    else
                        deletePackage = false;

                    if (templates.Items.Count == 0)
                        pp_templates.Visible = false;
                    else
                        deletePackage = false;

                    if (stylesheets.Items.Count == 0)
                        pp_css.Visible = false;
                    else
                        deletePackage = false;

                    if (dictionaryItems.Items.Count == 0)
                        pp_di.Visible = false;
                    else
                        deletePackage = false;

                    if (dataTypes.Items.Count == 0)
                        pp_dt.Visible = false;
                    else
                        deletePackage = false;


                    if (deletePackage)
                    {
                        pane_noItems.Visible = true;
                        bt_uninstall.Visible = false;
                        pane_uninstall.Visible = false;
                    }
                }
            }
        }