本文整理汇总了C#中DotNetNuke.Services.Installer.Packages.PackageInfo类的典型用法代码示例。如果您正苦于以下问题:C# PackageInfo类的具体用法?C# PackageInfo怎么用?C# PackageInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PackageInfo类属于DotNetNuke.Services.Installer.Packages命名空间,在下文中一共展示了PackageInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PackageInstaller
/// -----------------------------------------------------------------------------
/// <summary>
/// This Constructor creates a new PackageInstaller instance
/// </summary>
/// <param name="package">A PackageInfo instance</param>
/// <history>
/// [cnurse] 01/21/2008 created
/// </history>
/// -----------------------------------------------------------------------------
public PackageInstaller(PackageInfo package)
{
IsValid = true;
DeleteFiles = Null.NullBoolean;
Package = package;
if (!string.IsNullOrEmpty(package.Manifest))
{
//Create an XPathDocument from the Xml
var doc = new XPathDocument(new StringReader(package.Manifest));
XPathNavigator nav = doc.CreateNavigator().SelectSingleNode("package");
ReadComponents(nav);
}
else
{
ComponentInstallerBase installer = InstallerFactory.GetInstaller(package.PackageType);
if (installer != null)
{
//Set package
installer.Package = package;
//Set type
installer.Type = package.PackageType;
_componentInstallers.Add(0, installer);
}
}
}
开发者ID:rrsc,项目名称:Dnn.Platform,代码行数:35,代码来源:PackageInstaller.cs
示例2: WidgetPackageWriter
public WidgetPackageWriter(PackageInfo package) : base(package)
{
string company = package.Name;
if(company.Contains("."))
{
company = company.Substring(0, company.IndexOf("."));
}
BasePath = Path.Combine("Resources\\Widgets\\User", company);
}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:10,代码来源:WidgetPackageWriter.cs
示例3: CreateCorePackage
private void CreateCorePackage(bool createZip)
{
var Package = new PackageInfo();
Package.Name = Globals.CleanFileName(txtFileName.Text);
Package.Version = DotNetNukeContext.Current.Application.Version;
Package.License = Util.PACKAGE_NoLicense;
string fileName = Path.Combine(BasePath, "ResourcePack." + Package.Name);
CreatePackage(Package, -2, "", fileName, createZip);
}
开发者ID:chutinhha,项目名称:onlineexampro,代码行数:11,代码来源:LanguagePackWriter.ascx.cs
示例4: ModulePackageWriter
public ModulePackageWriter(DesktopModuleInfo desktopModule, XPathNavigator manifestNav, PackageInfo package) : base(package)
{
DesktopModule = desktopModule;
Initialize(desktopModule.FolderName);
if (manifestNav != null)
{
ReadLegacyManifest(manifestNav.SelectSingleNode("folders/folder"), false);
}
string physicalFolderPath = Path.Combine(Globals.ApplicationMapPath, BasePath);
ProcessModuleFolders(physicalFolderPath, physicalFolderPath);
}
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:12,代码来源:ModulePackageWriter.cs
示例5: ProviderPackageWriter
public ProviderPackageWriter(PackageInfo package) : base(package)
{
XmlDocument configDoc = Config.Load();
XPathNavigator providerNavigator = configDoc.CreateNavigator().SelectSingleNode("/configuration/dotnetnuke/*/providers/add[@name='" + package.Name + "']");
string providerPath = Null.NullString;
if (providerNavigator != null)
{
providerPath = Util.ReadAttribute(providerNavigator, "providerPath");
}
if (!string.IsNullOrEmpty(providerPath))
{
BasePath = providerPath.Replace("~/", "").Replace("/", "\\");
}
}
开发者ID:biganth,项目名称:Curt,代码行数:14,代码来源:ProviderPackageWriter.cs
示例6: CreateAuthSystemPackage
private void CreateAuthSystemPackage(PackageInfo authPackage, bool createZip)
{
var Package = new PackageInfo();
Package.Name = authPackage.Name;
Package.FriendlyName = authPackage.Name;
Package.Version = authPackage.Version;
Package.License = Util.PACKAGE_NoLicense;
string fileName = Path.Combine(BasePath, "ResourcePack." + Package.Name);
AuthenticationInfo authSystem = AuthenticationController.GetAuthenticationServiceByPackageID(authPackage.PackageID);
string authPath = authSystem.LoginControlSrc.Substring(0, authSystem.LoginControlSrc.LastIndexOf("/"));
CreatePackage(Package, authPackage.PackageID, authPath.Replace("/", "\\"), fileName, createZip);
}
开发者ID:chutinhha,项目名称:onlineexampro,代码行数:14,代码来源:LanguagePackWriter.ascx.cs
示例7: CreateSkinPackage
private static PackageInfo CreateSkinPackage(SkinPackageInfo skin)
{
//Create a Package
var package = new PackageInfo(new InstallerInfo());
package.Name = skin.SkinName;
package.FriendlyName = skin.SkinName;
package.Description = Null.NullString;
package.Version = new Version(1, 0, 0);
package.PackageType = skin.SkinType;
package.License = Util.PACKAGE_NoLicense;
//See if the Skin is using a Namespace (or is a known skin)
ParsePackageName(package);
return package;
}
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:16,代码来源:LegacyUtil.cs
示例8: GetWriter
/// -----------------------------------------------------------------------------
/// <summary>
/// The GetWriter method instantiates the relevant PackageWriter Installer
/// </summary>
/// <param name="package">The associated PackageInfo instance</param>
/// <history>
/// [cnurse] 01/31/2008 created
/// </history>
/// -----------------------------------------------------------------------------
public static PackageWriterBase GetWriter(PackageInfo package)
{
PackageWriterBase writer = null;
switch (package.PackageType)
{
case "Auth_System":
writer = new AuthenticationPackageWriter(package);
break;
case "Module":
writer = new ModulePackageWriter(package);
break;
case "Container":
writer = new ContainerPackageWriter(package);
break;
case "Skin":
writer = new SkinPackageWriter(package);
break;
case "CoreLanguagePack":
case "ExtensionLanguagePack":
writer = new LanguagePackWriter(package);
break;
case "SkinObject":
writer = new SkinControlPackageWriter(package);
break;
case "Provider":
writer = new ProviderPackageWriter(package);
break;
case "Library":
writer = new LibraryPackageWriter(package);
break;
case "Widget":
writer = new WidgetPackageWriter(package);
break;
default:
//PackageType is defined in the List
var listController = new ListController();
ListEntryInfo entry = listController.GetListEntryInfo("PackageWriter", package.PackageType);
if (entry != null && !string.IsNullOrEmpty(entry.Text))
{
//The class for the Installer is specified in the Text property
writer = (PackageWriterBase) Reflection.CreateObject(entry.Text, "PackageWriter_" + entry.Value);
}
break;
}
return writer;
}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:56,代码来源:PackageWriterFactory.cs
示例9: SkinControlPackageWriter
public SkinControlPackageWriter(XPathNavigator manifestNav, InstallerInfo installer)
{
SkinControl = new SkinControlInfo();
//Create a Package
Package = new PackageInfo(installer);
ReadLegacyManifest(manifestNav, true);
Package.Description = Null.NullString;
Package.Version = new Version(1, 0, 0);
Package.PackageType = "SkinObject";
Package.License = Util.PACKAGE_NoLicense;
BasePath = Path.Combine("DesktopModules", Package.Name.ToLower()).Replace("/", "\\");
AppCodePath = Path.Combine("App_Code", Package.Name.ToLower()).Replace("/", "\\");
}
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:17,代码来源:SkinControlPackageWriter.cs
示例10: LanguagePackWriter
public LanguagePackWriter(PackageInfo package) : base(package)
{
_LanguagePack = LanguagePackController.GetLanguagePackByPackage(package.PackageID);
if (LanguagePack != null)
{
_Language = LocaleController.Instance.GetLocale(_LanguagePack.LanguageID);
if (LanguagePack.PackageType == LanguagePackType.Core)
{
BasePath = Null.NullString;
}
else
{
//Get the BasePath of the Dependent Package
PackageInfo dependendentPackage = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.PackageID == LanguagePack.DependentPackageID);
PackageWriterBase dependentPackageWriter = PackageWriterFactory.GetWriter(dependendentPackage);
BasePath = dependentPackageWriter.BasePath;
}
}
else
{
BasePath = Null.NullString;
}
}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:23,代码来源:LanguagePackWriter.cs
示例11: BindLanguageList
private void BindLanguageList()
{
try
{
var myResponseReader = UpdateService.GetLanguageList();
//empty language list
languageList.Items.Clear();
//Loading into XML doc
var xmlDoc = new XmlDocument();
xmlDoc.Load(myResponseReader);
var languages = xmlDoc.SelectNodes("available/language");
var packages = new List<PackageInfo>();
if (languages != null)
{
foreach (XmlNode language in languages)
{
string cultureCode = "";
string version = "";
foreach (XmlNode child in language.ChildNodes)
{
if (child.Name == "culturecode")
{
cultureCode = child.InnerText;
}
if (child.Name == "version")
{
version = child.InnerText;
}
}
if (!string.IsNullOrEmpty(cultureCode) && !string.IsNullOrEmpty(version) && version.Length == 6)
{
var myCIintl = new CultureInfo(cultureCode, true);
version = version.Insert(4, ".").Insert(2, ".");
var package = new PackageInfo { Name = "LanguagePack-" + myCIintl.Name, FriendlyName = myCIintl.NativeName };
package.Name = myCIintl.NativeName;
package.Description = cultureCode;
Version ver = null;
Version.TryParse(version, out ver);
package.Version = ver;
if (packages.Any(p => p.Name == package.Name))
{
var existPackage = packages.First(p => p.Name == package.Name);
if (package.Version > existPackage.Version)
{
packages.Remove(existPackage);
packages.Add(package);
}
}
else
{
packages.Add(package);
}
}
}
}
foreach (var package in packages)
{
var li = new ListItem { Value = package.Description, Text = package.Name };
languageList.AddItem(li.Text, li.Value);
RadComboBoxItem lastItem = languageList.Items[languageList.Items.Count - 1];
if (DotNetNukeContext.Current.Application.Version.Major != package.Version.Major
|| DotNetNukeContext.Current.Application.Version.Minor != package.Version.Minor
|| DotNetNukeContext.Current.Application.Version.Build != package.Version.Build)
{
lastItem.Attributes.Add("onclick", "javascript:LegacyLangaugePack('" + package.Version + "');");
}
}
}
catch (Exception)
{
//suppress for now - need to decide what to do when webservice is unreachable
//throw;
}
finally
{
//ensure there is always an en-us
if (languageList.Items.FindItemByValue("en-US") == null)
{
var myCIintl = new CultureInfo("en-US", true);
var li = new ListItem {Value = "en-US", Text = myCIintl.NativeName};
languageList.AddItem(li.Text, li.Value);
RadComboBoxItem lastItem = languageList.Items[languageList.Items.Count - 1];
lastItem.Attributes.Add("onclick", "javascript:ClearLegacyLangaugePack();");
languageList.Sort = RadComboBoxSort.Ascending;
languageList.Items.Sort();
}
var item = languageList.Items.FindItemByValue(_culture);
languageList.SelectedIndex = item != null ? item.Index : languageList.Items.FindItemByValue("en-US").Index;
languageList.Sort = RadComboBoxSort.Ascending;
languageList.Items.Sort();
}
}
开发者ID:RichardHowells,项目名称:dnnextensions,代码行数:96,代码来源:InstallWizard.aspx.cs
示例12: BindGrid
private void BindGrid(string installPath, DataGrid grid)
{
var packages = new List<PackageInfo>();
var invalidPackages = new List<string>();
foreach (string file in Directory.GetFiles(installPath))
{
if (file.ToLower().EndsWith(".zip") || file.ToLower().EndsWith(".resources"))
{
Stream inputStream = new FileStream(file, FileMode.Open, FileAccess.Read);
var unzip = new ZipInputStream(inputStream);
try
{
ZipEntry entry = unzip.GetNextEntry();
while (entry != null)
{
if (!entry.IsDirectory)
{
var fileName = entry.Name;
string extension = System.IO.Path.GetExtension(fileName);
if (extension.ToLower() == ".dnn" || extension.ToLower() == ".dnn5")
{
//Manifest
var manifestReader = new StreamReader(unzip);
var manifest = manifestReader.ReadToEnd();
var package = new PackageInfo();
package.Manifest = manifest;
if (!string.IsNullOrEmpty(manifest))
{
var doc = new XPathDocument(new StringReader(manifest));
XPathNavigator rootNav = doc.CreateNavigator().SelectSingleNode("dotnetnuke");
string packageType = String.Empty;
if (rootNav.Name == "dotnetnuke")
{
packageType = XmlUtils.GetAttributeValue(rootNav, "type");
}
else if (rootNav.Name.ToLower() == "languagepack")
{
packageType = "LanguagePack";
}
XPathNavigator nav = null;
switch (packageType.ToLower())
{
case "package":
nav = rootNav.SelectSingleNode("packages/package");
break;
case "module":
case "languagepack":
case "skinobject":
nav = Installer.ConvertLegacyNavigator(rootNav, new InstallerInfo()).SelectSingleNode("packages/package");
break;
}
if (nav != null)
{
package.Name = XmlUtils.GetAttributeValue(nav, "name");
package.PackageType = XmlUtils.GetAttributeValue(nav, "type");
package.IsSystemPackage = XmlUtils.GetAttributeValueAsBoolean(nav, "isSystem", false);
package.Version = new Version(XmlUtils.GetAttributeValue(nav, "version"));
package.FriendlyName = XmlUtils.GetNodeValue(nav, "friendlyName");
if (String.IsNullOrEmpty(package.FriendlyName))
{
package.FriendlyName = package.Name;
}
package.Description = XmlUtils.GetNodeValue(nav, "description");
package.FileName = file.Replace(installPath + "\\", "");
XPathNavigator foldernameNav = null;
switch (package.PackageType)
{
case "Module":
case "Auth_System":
foldernameNav = nav.SelectSingleNode("components/component/files");
if (foldernameNav != null) package.FolderName = Util.ReadElement(foldernameNav, "basePath").Replace('\\', '/');
break;
case "Container":
foldernameNav = nav.SelectSingleNode("components/component/containerFiles");
if (foldernameNav != null) package.FolderName = Globals.glbContainersPath + Util.ReadElement(foldernameNav, "containerName").Replace('\\', '/');
break;
case "Skin":
foldernameNav = nav.SelectSingleNode("components/component/skinFiles");
if (foldernameNav != null) package.FolderName = Globals.glbSkinsPath + Util.ReadElement(foldernameNav, "skinName").Replace('\\', '/');
break;
default:
break;
}
XPathNavigator iconFileNav = nav.SelectSingleNode("iconFile");
if (package.FolderName != string.Empty && iconFileNav != null)
{
if ((iconFileNav.Value != string.Empty) && (package.PackageType == "Module" || package.PackageType == "Auth_System" || package.PackageType == "Container" || package.PackageType == "Skin"))
{
package.IconFile = package.FolderName + "/" + iconFileNav.Value;
package.IconFile = (!package.IconFile.StartsWith("~/")) ? "~/" + package.IconFile : package.IconFile;
}
}
//.........这里部分代码省略.........
开发者ID:SiddharthMishraPersonal,项目名称:dnndev,代码行数:101,代码来源:AvailableExtensions.ascx.cs
示例13: ProcessLegacySkinControls
public static void ProcessLegacySkinControls()
{
foreach (SkinControlInfo skinControl in SkinControlController.GetSkinControls().Values)
{
if (skinControl.PackageID == Null.NullInteger)
{
try
{
//SkinControl is not affiliated with a Package
var package = new PackageInfo(new InstallerInfo());
package.Name = skinControl.ControlKey;
package.FriendlyName = skinControl.ControlKey;
package.Description = Null.NullString;
package.Version = new Version(1, 0, 0);
package.PackageType = "SkinObject";
//See if the SkinControl is using a "Namespace" for its name
ParsePackageName(package);
var skinControlWriter = new SkinControlPackageWriter(skinControl, package);
package.Manifest = skinControlWriter.WriteManifest(true);
//Save Package
PackageController.Instance.SaveExtensionPackage(package);
//Update SkinControl with new PackageID
skinControl.PackageID = package.PackageID;
//Save SkinControl
SkinControlController.SaveSkinControl(skinControl);
}
catch (Exception exc)
{
Logger.Error(exc);
}
}
}
}
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:40,代码来源:LegacyUtil.cs
示例14: ParsePackageName
public static void ParsePackageName(PackageInfo package)
{
ParsePackageName(package, ".");
if (string.IsNullOrEmpty(package.Owner))
{
ParsePackageName(package, "\\");
}
if (string.IsNullOrEmpty(package.Owner))
{
ParsePackageName(package, "_");
}
if (package.PackageType == "Module" && AdminModules.Contains(package.Name + ",") || package.PackageType == "Module" && CoreModules.Contains(package.Name + ",") ||
(package.PackageType == "Container" || package.PackageType == "Skin") && KnownSkins.Contains(package.Name + ",") ||
package.PackageType == "SkinObject" && KnownSkinObjects.Contains(package.Name + ","))
{
if (string.IsNullOrEmpty(package.Owner))
{
package.Owner = "DotNetNuke";
package.Name = "DotNetNuke." + package.Name;
switch (package.PackageType)
{
case "Skin":
package.Name += ".Skin";
package.FriendlyName += " Skin";
break;
case "Container":
package.Name += ".Container";
package.FriendlyName += " Container";
break;
case "SkinObject":
package.Name += "SkinObject";
package.FriendlyName += " SkinObject";
break;
}
}
}
if (package.Owner == "DotNetNuke" || package.Owner == "DNN")
{
package.License = Localization.Localization.GetString("License", Localization.Localization.GlobalResourceFile);
package.Organization = "DNN Corp.";
package.Url = "http://www.dnnsoftware.com";
package.Email = "[email protected]";
package.ReleaseNotes = "There are no release notes for this version.";
}
else
{
package.License = Util.PACKAGE_NoLicense;
}
}
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:49,代码来源:LegacyUtil.cs
示例15: ProcessLegacyLanguages
public static void ProcessLegacyLanguages()
{
string filePath = Globals.ApplicationMapPath + Localization.Localization.SupportedLocalesFile.Substring(1).Replace("/", "\\");
if (File.Exists(filePath))
{
var doc = new XPathDocument(filePath);
//Check for Browser and Url settings
XPathNavigator browserNav = doc.CreateNavigator().SelectSingleNode("root/browserDetection");
if (browserNav != null)
{
HostController.Instance.Update("EnableBrowserLanguage", Util.ReadAttribute(browserNav, "enabled", false, null, Null.NullString, "true"));
}
XPathNavigator urlNav = doc.CreateNavigator().SelectSingleNode("root/languageInUrl");
if (urlNav != null)
{
HostController.Instance.Update("EnableUrlLanguage", Util.ReadAttribute(urlNav, "enabled", false, null, Null.NullString, "true"));
}
//Process each language
foreach (XPathNavigator nav in doc.CreateNavigator().Select("root/language"))
{
if (nav.NodeType != XPathNodeType.Comment)
{
var language = new Locale();
language.Text = Util.ReadAttribute(nav, "name");
language.Code = Util.ReadAttribute(nav, "key");
language.Fallback = Util.ReadAttribute(nav, "fallback");
//Save Language
Localization.Localization.SaveLanguage(language);
if (language.Code != Localization.Localization.SystemLocale)
{
//Create a Package
var package = new PackageInfo(new InstallerInfo())
{
Name = language.Text,
FriendlyName = language.Text,
Description = Null.NullString,
Version = new Version(1, 0, 0),
PackageType = "CoreLanguagePack",
License = Util.PACKAGE_NoLicense
};
//Create a LanguagePackWriter
var packageWriter = new LanguagePackWriter(language, package);
//Save the manifest
package.Manifest = packageWriter.WriteManifest(true);
//Save Package
PackageController.Instance.SaveExtensionPackage(package);
var languagePack = new LanguagePackInfo
{
LanguageID = language.LanguageId,
PackageID = package.PackageID,
DependentPackageID = -2
};
LanguagePackController.SaveLanguagePack(languagePack);
}
}
}
}
//Process Portal Locales files
foreach (PortalInfo portal in PortalController.Instance.GetPortals())
{
int portalID = portal.PortalID;
filePath = string.Format(Globals.ApplicationMapPath + Localization.Localization.ApplicationResourceDirectory.Substring(1).Replace("/", "\\") + "\\Locales.Portal-{0}.xml", portalID);
if (File.Exists(filePath))
{
var doc = new XPathDocument(filePath);
//Check for Browser and Url settings
XPathNavigator browserNav = doc.CreateNavigator().SelectSingleNode("locales/browserDetection");
if (browserNav != null)
{
PortalController.UpdatePortalSetting(portalID, "EnableBrowserLanguage", Util.ReadAttribute(browserNav, "enabled", false, null, Null.NullString, "true"));
}
XPathNavigator urlNav = doc.CreateNavigator().SelectSingleNode("locales/languageInUrl");
if (urlNav != null)
{
PortalController.UpdatePortalSetting(portalID, "EnableUrlLanguage", Util.ReadAttribute(urlNav, "enabled", false, null, Null.NullString, "true"));
}
foreach (Locale installedLanguage in LocaleController.Instance.GetLocales(Null.NullInteger).Values)
{
string code = installedLanguage.Code;
bool bFound = false;
//Check if this language is "inactive"
foreach (XPathNavigator inactiveNav in doc.CreateNavigator().Select("locales/inactive/locale"))
{
if (inactiveNav.Value == code)
{
bFound = true;
break;
}
}
if (!bFound)
//.........这里部分代码省略.........
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:101,代码来源:LegacyUtil.cs
示例16: CreateModuleDefinition
/// <summary>
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// </history>
private bool CreateModuleDefinition()
{
try
{
if (PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.Name == GetClassName()) == null)
{
var controlName = Null.NullString;
//Create module folder
CreateModuleFolder();
//Create module control
controlName = CreateModuleControl();
if (controlName != "")
{
//Create package
var objPackage = new PackageInfo();
objPackage.Name = GetClassName();
objPackage.FriendlyName = txtModule.Text;
objPackage.Description = txtDescription.Text;
objPackage.Version = new Version(1, 0, 0);
objPackage.PackageType = "Module";
objPackage.License = "";
objPackage.Owner = txtOwner.Text;
objPackage.Organization = txtOwner.Text;
objPackage.FolderName = "DesktopModules/" + GetFolderName();
objPackage.License = "The license for this package is not currently included within the installation file, please check with the vendor for full license details.";
objPackage.ReleaseNotes = "This package has no Release Notes.";
PackageController.Instance.SaveExtensionPackage(objPackage);
//Create desktopmodule
var objDesktopModules = new DesktopModuleController();
var objDesktopModule = new DesktopModuleInfo();
objDesktopModule.DesktopModuleID = Null.NullInteger;
objDesktopModule.ModuleName = GetClassName();
objDesktopModule.FolderName = GetFolderName();
objDesktopModule.FriendlyName = txtModule.Text;
objDesktopModule.Description = txtDescription.Text;
objDesktopModule.IsPremium = false;
objDesktopModule.IsAdmin = false;
objDesktopModule.Version = "01.00.00";
objDesktopModule.BusinessControllerClass = "";
objDesktopModule.CompatibleVersions = "";
objDesktopModule.Dependencies = "";
objDesktopModule.Permissions = "";
objDesktopModule.PackageID = objPackage.PackageID;
objDesktopModule.DesktopModuleID = objDesktopModules.AddDesktopModule(objDesktopModule);
objDesktopModule = objDesktopModules.GetDesktopModule(objDesktopModule.DesktopModuleID);
//Add OwnerName to the DesktopModule taxonomy and associate it with this module
var vocabularyId = -1;
var termId = -1;
var objTermController = DotNetNuke.Entities.Content.Common.Util.GetTermController();
var objTerms = objTermController.GetTermsByVocabulary("Module_Categories");
foreach (Term term in objTerms)
{
vocabularyId = term.VocabularyId;
if (term.Name == txtOwner.Text)
{
termId = term.TermId;
}
}
if (termId == -1)
{
termId = objTermController.AddTerm(new Term(vocabularyId) { Name = txtOwner.Text });
}
var objTerm = objTermController.GetTerm(termId);
var objContentController = DotNetNuke.Entities.Content.Common.Util.GetContentController();
var objContent = objContentController.GetContentItem(objDesktopModule.ContentItemId);
objTermController.AddTermToContent(objTerm, objContent);
//Add desktopmodule to all portals
DesktopModuleController.AddDesktopModuleToPortals(objDesktopModule.DesktopModuleID);
//Create module definition
var objModuleDefinition = new ModuleDefinitionInfo();
objModuleDefinition.ModuleDefID = Null.NullInteger;
objModuleDefinition.DesktopModuleID = objDesktopModule.DesktopModuleID;
// need core enhancement to have a unique DefinitionName
objModuleDefinition.FriendlyName = GetClassName();
//objModuleDefinition.FriendlyName = txtModule.Text;
//objModuleDefinition.DefinitionName = GetClassName();
objModuleDefinition.DefaultCacheTime = 0;
objModuleDefinition.ModuleDefID = ModuleDefinitionController.SaveModuleDefinition(objModuleDefinition, false, true);
//Create modulecontrol
var objModuleControl = new ModuleControlInfo();
objModuleControl.ModuleControlID = Null.NullInteger;
objModuleControl.ModuleDefID = objModuleDefinition.ModuleDefID;
objModuleControl.ControlKey = "";
objModuleControl.ControlSrc = "DesktopModules/" + GetFolderName() + "/" + controlName;
objModuleControl.ControlTitle = "";
objModuleControl.ControlType = SecurityAccessLevel.View;
objModuleControl.HelpURL = "";
//.........这里部分代码省略.........
开发者ID:RichardHowells,项目名称:dnnextensions,代码行数:101,代码来源:CreateModule.ascx.cs
示例17: AddModuleDefinition
/// -----------------------------------------------------------------------------
/// <summary>
/// AddModuleDefinition adds a new Core Module Definition to the system
/// </summary>
/// <remarks>
/// This overload allows the caller to determine whether the module has a controller
/// class
/// </remarks>
/// <param name="desktopModuleName">The Friendly Name of the Module to Add</param>
/// <param name="description">Description of the Module</param>
/// <param name="moduleDefinitionName">The Module Definition Name</param>
/// <param name="businessControllerClass">Business Control Class.</param>
/// <param name="isPortable">Whether the module is enable for portals.</param>
/// <param name="premium">A flag representing whether the module is a Premium module</param>
/// <param name="admin">A flag representing whether the module is an Admin module</param>
/// <returns>The Module Definition Id of the new Module</returns>
/// <history>
/// [cnurse] 10/14/2004 documented
/// [cnurse] 11/11/2004 removed addition of Module Control (now in AddMOduleControl)
/// </history>
/// -----------------------------------------------------------------------------
private static int AddModuleDefinition(string desktopModuleName, string description, string moduleDefinitionName, string businessControllerClass, bool isPortable, bool premium, bool admin)
{
DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "AddModuleDefinition:" + desktopModuleName);
// check if desktop module exists
var desktopModule = DesktopModuleController.GetDesktopModuleByModuleName(desktopModuleName, Null.NullInteger);
if (desktopModule == null)
{
var package = new PackageInfo
{
Description = description,
FriendlyName = desktopModuleName,
Name = string.Concat("DotNetNuke.", desktopModuleName),
PackageType = "Module",
Owner = "DNN",
Organization = "DNN Corp.",
Url = "http://www.dnnsoftware.com",
Email = "[email protected]"
};
if (desktopModuleName == "Extensions" || desktopModuleName == "Skin Designer" || desktopModuleName == "Dashboard")
{
package.IsSystemPackage = true;
}
package.Version = new Version(1, 0, 0);
PackageController.Instance.SaveExtensionPackage(package);
string moduleName = desktopModuleName.Replace(" ", "");
desktopModule = new DesktopModuleInfo
{
DesktopModuleID = Null.NullInteger,
PackageID = package.PackageID,
FriendlyName = desktopModuleName,
FolderName = "Admin/" + moduleNa
|
请发表评论