本文整理汇总了C#中DotNetNuke.Entities.Tabs.TabController.GiveTranslatorRoleEditRights方法的典型用法代码示例。如果您正苦于以下问题:C# TabController.GiveTranslatorRoleEditRights方法的具体用法?C# TabController.GiveTranslatorRoleEditRights怎么用?C# TabController.GiveTranslatorRoleEditRights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Tabs.TabController
的用法示例。
在下文中一共展示了TabController.GiveTranslatorRoleEditRights方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: submitTranslation_Click
protected void submitTranslation_Click(object sender, EventArgs e)
{
var modCtrl = new ModuleController();
var tabCtrl = new TabController();
foreach (TabInfo localizedTab in Tab.LocalizedTabs.Values)
{
//Make Deep copies of all modules
var moduleCtrl = new ModuleController();
foreach (KeyValuePair<int, ModuleInfo> kvp in moduleCtrl.GetTabModules(Tab.TabID))
{
ModuleInfo sourceModule = kvp.Value;
ModuleInfo localizedModule = null;
//Make sure module has the correct culture code
if (string.IsNullOrEmpty(sourceModule.CultureCode))
{
sourceModule.CultureCode = Tab.CultureCode;
moduleCtrl.UpdateModule(sourceModule);
}
if (!sourceModule.LocalizedModules.TryGetValue(localizedTab.CultureCode, out localizedModule))
{
if (!sourceModule.IsDeleted)
{
//Shallow (Reference Copy)
{
if (sourceModule.AllTabs)
{
foreach (ModuleInfo m in moduleCtrl.GetModuleTabs(sourceModule.ModuleID))
{
//Get the tab
TabInfo allTabsTab = tabCtrl.GetTab(m.TabID, m.PortalID, false);
TabInfo localizedAllTabsTab = null;
if (allTabsTab.LocalizedTabs.TryGetValue(localizedTab.CultureCode, out localizedAllTabsTab))
{
moduleCtrl.CopyModule(m, localizedAllTabsTab, Null.NullString, true);
}
}
}
else
{
moduleCtrl.CopyModule(sourceModule, localizedTab, Null.NullString, true);
}
}
//Fetch new module
localizedModule = moduleCtrl.GetModule(sourceModule.ModuleID, localizedTab.TabID);
//Convert to deep copy
moduleCtrl.LocalizeModule(localizedModule, LocaleController.Instance.GetLocale(localizedTab.CultureCode));
}
}
}
var users = new Dictionary<int, UserInfo>();
//Give default translators for this language and administrators permissions
tabCtrl.GiveTranslatorRoleEditRights(localizedTab, users);
//Send Messages to all the translators of new content
foreach (var translator in users.Values.Where(user => user.UserID != PortalSettings.AdministratorId))
{
AddTranslationSubmittedNotification(localizedTab, translator);
}
}
//Redirect to refresh page (and skinobjects)
Response.Redirect(Request.RawUrl, true);
}
示例2: submitTranslation_Click
protected void submitTranslation_Click(object sender, EventArgs e)
{
sendTranslationMessageConfirm.Visible = true;
try
{
var tabCtrl = new TabController();
// loop through all localized version of this page
foreach (TabInfo localizedTab in Tab.LocalizedTabs.Values)
{
var users = new Dictionary<int, UserInfo>();
//Give default translators for this language and administrators permissions
tabCtrl.GiveTranslatorRoleEditRights(localizedTab, users);
//Send Messages to all the translators of new content
foreach (var translator in users.Values.Where(user => user.UserID != PortalSettings.AdministratorId))
{
AddTranslationSubmittedNotification(localizedTab, translator);
}
}
txtTranslationComment.Text = "";
sendTranslationMessageRow.Visible = false;
sendTranslationMessageConfirm.Attributes.Remove("class");
sendTranslationMessageConfirm.Attributes.Add("class", "dnnFormMessage dnnFormSuccess");
sendTranslationMessageConfirmMessage.Text = LocalizeString("TranslationMessageConfirmMessage.Text");
}
catch (Exception)
{
sendTranslationMessageConfirm.Attributes.Remove("class");
sendTranslationMessageConfirm.Attributes.Add("class", "dnnFormMessage dnnFormError");
sendTranslationMessageConfirmMessage.Text = LocalizeString("TranslationMessageConfirmMessage.Error");
throw;
}
}
示例3: readyForTranslationButton_Click
protected void readyForTranslationButton_Click(object sender, EventArgs e)
{
var modCtrl = new ModuleController();
var tabCtrl = new TabController();
foreach (TabInfo localizedTab in Tab.LocalizedTabs.Values)
{
//Make Deep copies of all modules
var moduleCtrl = new ModuleController();
foreach (KeyValuePair<int, ModuleInfo> kvp in moduleCtrl.GetTabModules(Tab.TabID))
{
ModuleInfo sourceModule = kvp.Value;
ModuleInfo localizedModule = null;
//Make sure module has the correct culture code
if (string.IsNullOrEmpty(sourceModule.CultureCode))
{
sourceModule.CultureCode = Tab.CultureCode;
moduleCtrl.UpdateModule(sourceModule);
}
if (!sourceModule.LocalizedModules.TryGetValue(localizedTab.CultureCode, out localizedModule))
{
if (!sourceModule.IsDeleted)
{
//Shallow (Reference Copy)
{
if (sourceModule.AllTabs)
{
foreach (ModuleInfo m in moduleCtrl.GetModuleTabs(sourceModule.ModuleID))
{
//Get the tab
TabInfo allTabsTab = tabCtrl.GetTab(m.TabID, m.PortalID, false);
TabInfo localizedAllTabsTab = null;
if (allTabsTab.LocalizedTabs.TryGetValue(localizedTab.CultureCode, out localizedAllTabsTab))
{
moduleCtrl.CopyModule(m, localizedAllTabsTab, Null.NullString, true);
}
}
}
else
{
moduleCtrl.CopyModule(sourceModule, localizedTab, Null.NullString, true);
}
}
//Fetch new module
localizedModule = moduleCtrl.GetModule(sourceModule.ModuleID, localizedTab.TabID);
//Convert to deep copy
moduleCtrl.LocalizeModule(localizedModule, LocaleController.Instance.GetLocale(localizedTab.CultureCode));
}
}
}
var users = new Dictionary<int, UserInfo>();
//Give default translators for this language and administrators permissions
tabCtrl.GiveTranslatorRoleEditRights(localizedTab, users);
//Send Messages to all the translators of new content
foreach (UserInfo translator in users.Values)
{
if (translator.UserID != PortalSettings.AdministratorId)
{
var message = new Message();
message.FromUserID = PortalSettings.AdministratorId;
message.ToUserID = translator.UserID;
message.Subject = Localization.GetString("NewContentMessage.Subject", LocalResourceFile);
message.Status = MessageStatusType.Unread;
message.Body = string.Format(Localization.GetString("NewContentMessage.Body", LocalResourceFile),
localizedTab.TabName,
Globals.NavigateURL(localizedTab.TabID, false, PortalSettings, Null.NullString, localizedTab.CultureCode, new string[] { }));
var messageCtrl = new MessagingController();
messageCtrl.SaveMessage(message);
}
}
}
//Redirect to refresh page (and skinobjects)
Response.Redirect(Request.RawUrl, true);
}