コード例 #1
0
        public ThemeFileInfo GetThemeFile(PortalSettings portalSettings, string filePath, ThemeType type)
        {
            var themeName = SkinController.FormatSkinPath(filePath)
                            .Substring(filePath.IndexOf("/", StringComparison.OrdinalIgnoreCase) + 1)
                            .Replace("/", string.Empty);
            var themeLevel = GetThemeLevel(filePath);

            var themeInfo = (type == ThemeType.Skin ? this.GetLayouts(portalSettings, ThemeLevel.All)
                                                    : this.GetContainers(portalSettings, ThemeLevel.All))
                            .FirstOrDefault(t => t.PackageName.Equals(themeName, StringComparison.OrdinalIgnoreCase) && t.Level == themeLevel);

            if (themeInfo != null)
            {
                return(this.GetThemeFiles(portalSettings, themeInfo).FirstOrDefault(f => (f.Path + ".ascx").Equals(filePath, StringComparison.OrdinalIgnoreCase)));
            }

            return(null);
        }
コード例 #2
0
        private static void ConfigureModule(ModuleInfo cloneModule, TabInfo tab)
        {
            if (Null.IsNull(cloneModule.StartDate))
            {
                cloneModule.StartDate = DateTime.MinValue;
            }
            if (Null.IsNull(cloneModule.EndDate))
            {
                cloneModule.EndDate = DateTime.MaxValue;
            }
            if (String.IsNullOrEmpty(cloneModule.ContainerSrc))
            {
                cloneModule.ContainerSrc = tab.ContainerSrc;
            }

            cloneModule.ContainerSrc  = SkinController.FormatSkinSrc(cloneModule.ContainerSrc, PortalSettings.Current);
            cloneModule.ContainerPath = SkinController.FormatSkinPath(cloneModule.ContainerSrc);
        }
コード例 #3
0
        public HttpResponseMessage RestoreTheme(string language)
        {
            try
            {
                SkinController.SetSkin(SkinController.RootSkin, PortalId, SkinType.Portal, "");
                SkinController.SetSkin(SkinController.RootContainer, PortalId, SkinType.Portal, "");
                SkinController.SetSkin(SkinController.RootSkin, PortalId, SkinType.Admin, "");
                SkinController.SetSkin(SkinController.RootContainer, PortalId, SkinType.Admin, "");
                DataCache.ClearPortalCache(PortalId, true);

                return(Request.CreateResponse(HttpStatusCode.OK, GetCurrentThemeObject()));
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
コード例 #4
0
ファイル: SkinEditor.ascx.cs プロジェクト: ds-rod/dnnIJT
        private void BindSkin()
        {
            SkinPackageInfo skin = SkinController.GetSkinByPackageID(PackageID);

            if (!ModuleContext.PortalSettings.ActiveTab.IsSuperTab)
            {
                skinFormReadOnly.DataSource = skin;
                skinFormReadOnly.DataBind();
                skinFormReadOnly.Visible = true;

                lblHelp.Visible = false;
            }
            if (skin != null && ModuleContext.PortalSettings.ActiveTab.IsSuperTab)
            {
                skinForm.DataSource = skin;
                skinForm.DataBind();
                skinForm.Visible = true;
            }
        }
コード例 #5
0
        private void OnPreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            SkinController.SelectElement(this);

            if (SkinController.IsPreviewMode)
            {
                switch (SkinElement.GetType().Name)
                {
                case "SkinButton":
                    var button = (SkinButton)SkinElement;
                    DrawButton(SkinButtonState.Clicked);
                    if (button.Commands.Any(t => t.Name == "PlaySound"))
                    {
                        Core.PlaySound(SkinController.GetFullPath(button.Commands.First(t => t.Name == "PlaySound").FileName));
                    }
                    if (button.Commands.Any(t => !string.IsNullOrEmpty(t.Url)))
                    {
                        System.Diagnostics.Process.Start(button.Commands.First(t => !string.IsNullOrEmpty(t.Url)).Url);
                    }
                    break;

                case "SkinComboBox":
                    var comboBox = (SkinComboBox)SkinElement;
                    DrawComboBox(SkinButtonState.Clicked);
                    if (comboBox.Commands.Any(t => t.Name == "PlaySound"))
                    {
                        Core.PlaySound(SkinController.GetFullPath(comboBox.Commands.First(t => t.Name == "PlaySound").FileName));
                    }
                    break;

                case "SkinSlider":
                    DrawSlider(SkinButtonState.Clicked);
                    break;
                }
            }
            else
            {
                if (e.LeftButton == MouseButtonState.Pressed)
                {
                    Cursor = Cursors.SizeAll;
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// GetContainers gets the containers and binds the lists to the controls
        ///	the buttons
        /// </summary>
        /// <param name="type">An enum indicating what type of containers to load</param>
        /// <param name="skinType">A string that identifies whether the skin is Host "[G]" or Site "[L]"</param>
        /// <param name="strFolder">The folder to search for skins</param>
        /// <history>
        ///     [cnurse]	12/14/2004	created
        /// </history>
        private void GetContainers(ContainerType type, string skinType, string strFolder)
        {
            //Configure SkinControl
            ctlPortalContainer.Width    = "500px";
            ctlPortalContainer.Height   = "250px";
            ctlPortalContainer.Border   = "black 1px solid";
            ctlPortalContainer.Columns  = 3;
            ctlPortalContainer.SkinRoot = SkinInfo.RootContainer;
            switch (type)
            {
            case ContainerType.Folder:

                ctlPortalContainer.LoadSkins(strFolder, skinType, false);
                break;

            case ContainerType.Portal:

                ctlPortalContainer.LoadPortalSkins(false);
                break;

            case ContainerType.Host:

                ctlPortalContainer.LoadHostSkins(false);
                break;

            case ContainerType.All:

                ctlPortalContainer.LoadAllSkins(false);
                break;
            }

            //Get current container and set selected skin
            SkinInfo objSkin = SkinController.GetSkin(SkinInfo.RootContainer, PortalId, SkinType.Portal);

            if (objSkin != null)
            {
                if (objSkin.PortalId == PortalId)
                {
                    ctlPortalContainer.SkinSrc = objSkin.SkinSrc;
                }
            }
        }
コード例 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="portalSettings"></param>
        /// <param name="theme"></param>
        public void DeleteThemePackage(PortalSettings portalSettings, ThemeInfo theme)
        {
            var themePath = Path.Combine(Globals.ApplicationMapPath, theme.Path);
            var user      = UserController.Instance.GetCurrentUserInfo();

            if (!user.IsSuperUser && themePath.IndexOf("\\portals\\_default\\", StringComparison.InvariantCultureIgnoreCase) != Null.NullInteger)
            {
                throw new SecurityException("NoPermission");
            }

            if (theme.Type == ThemeType.Skin)
            {
                var skinPackage = SkinController.GetSkinPackage(portalSettings.PortalId, theme.PackageName, "Skin");
                if (skinPackage != null)
                {
                    throw new InvalidOperationException("UsePackageUninstall");
                }

                if (Directory.Exists(themePath))
                {
                    Globals.DeleteFolderRecursive(themePath);
                }
                if (Directory.Exists(themePath.Replace("\\" + SkinController.RootSkin.ToLower() + "\\", "\\" + SkinController.RootContainer + "\\")))
                {
                    Globals.DeleteFolderRecursive(themePath.Replace("\\" + SkinController.RootSkin.ToLower() + "\\", "\\" + SkinController.RootContainer + "\\"));
                }
            }
            else if (theme.Type == ThemeType.Container)
            {
                var skinPackage = SkinController.GetSkinPackage(portalSettings.PortalId, theme.PackageName, "Container");
                if (skinPackage != null)
                {
                    throw new InvalidOperationException("UsePackageUninstall");
                }

                if (Directory.Exists(themePath))
                {
                    Globals.DeleteFolderRecursive(themePath);
                }
            }
        }
コード例 #8
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            DataTextField  = "Key";
            DataValueField = "Value";

            if (!Page.IsPostBack && !string.IsNullOrEmpty(RootPath))
            {
                DataSource = SkinController.GetSkins(Portal, RootPath, Scope)
                             .ToDictionary(skin => skin.Key, skin => skin.Value);
                DataBind(SelectedValue);

                if (IncludeNoneSpecificItem)
                {
                    InsertItem(0, NoneSpecificText, string.Empty);
                }
            }

            AttachEvents();
        }
コード例 #9
0
        /// <summary>
        /// GetSkins gets the skins and containers and binds the lists to the controls
        ///	the buttons
        /// </summary>
        /// <history>
        ///     [cnurse]	11/04/2004	created
        /// </history>
        private void GetSkins()
        {
            //Configure SkinControl
            ctlPortalSkin.Width    = "500px";
            ctlPortalSkin.Height   = "250px";
            ctlPortalSkin.Border   = "black 1px solid";
            ctlPortalSkin.Columns  = 3;
            ctlPortalSkin.SkinRoot = SkinInfo.RootSkin;
            ctlPortalSkin.LoadAllSkins(false);

            //Get current skin and set selected skin
            SkinInfo objSkin = SkinController.GetSkin(SkinInfo.RootSkin, PortalId, SkinType.Portal);

            if (objSkin != null)
            {
                if (objSkin.PortalId == PortalId)
                {
                    ctlPortalSkin.SkinSrc = objSkin.SkinSrc;
                }
            }
        }
コード例 #10
0
        private void PgElementOnPropertyValueChanged(object sender, PropertyValueChangedEventArgs e)
        {
            var skinElement = (SkinElement)PgElement.SelectedObject;

            if (SkinController.SelectedWindow != null &&
                SkinController.SelectedWindow.ColorPositions.Any(t => t.MapColor == Core.MapColor2Color(SkinController.SelectedElement.SkinElement.MapColor)))
            {
                var pos = SkinController.SelectedWindow.ColorPositions.First(t => t.MapColor == Core.MapColor2Color(SkinController.SelectedElement.SkinElement.MapColor));
                switch (((PropertyItem)e.OriginalSource).DisplayName)
                {
                case "X": pos.X = (double)e.NewValue; break;

                case "Y": pos.Y = (double)e.NewValue; break;

                case "Width": pos.Width = (double)e.NewValue; break;

                case "Height": pos.Height = (double)e.NewValue; break;
                }
            }
            SkinController.DrawElement(skinElement);
        }
コード例 #11
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        Screen.sleepTimeout         = SleepTimeout.NeverSleep;
        Application.targetFrameRate = 30;

        c_AchievementCtrl = AchievementController.Instance;
        c_FightCtrl       = FightController.Instance;
        c_FontCtrl        = FontController.Instance;
        c_LayoutCtrl      = LayoutController.Instance;
        c_LanguageCtrl    = LanguageController.Instance;
        c_SkinCtrl        = SkinController.Instance;
        c_TextColorCtrl   = TextColorController.Instance;
        c_RecordCtrl      = RecordController.Instance;
        c_RankCtrl        = RankController.Instance;
        c_GuiCtrl         = GuiController.Instance;
        c_BluetoothCtrl   = BluetoothController.Instance;
    }
コード例 #12
0
    private void Refresh()
    {
        //textPrice.text = price.ToString("000");
        if (SkinController.IsOwned(skin.SkinReference))
        {
            //GetComponent<Image>().sprite = owned;
            imgSkin.sprite = skin.ImageNormal;
            textPrice.gameObject.SetActive(false);
            buttonBuy.gameObject.SetActive(false);
            if (skin.SkinReference == SkinController.ActualSkin)
            {
                buttonOff.gameObject.SetActive(false);
                buttonOn.gameObject.SetActive(true);
            }
            else
            {
                buttonOff.gameObject.SetActive(true);
                buttonOn.gameObject.SetActive(false);
            }
        }
        else
        {
            imgSkin.sprite = skin.ImageNotOwned;

            textPrice.gameObject.SetActive(true);
            if (skin.Price > 0)
            {
                textPrice.text = skin.Price.ToString("000");
            }
            else
            {
                textPrice.text = textFree.text;
            }

            buttonBuy.gameObject.SetActive(true);
            buttonOff.gameObject.SetActive(false);
            buttonOn.gameObject.SetActive(false);
        }
    }
コード例 #13
0
        private void ShowSkins()
        {
            tblSkins.Rows.Clear();
            var intPortalId = PortalId;

            var strSkinPath = Globals.ApplicationMapPath.ToLower() + cboSkins.SelectedItem.Value;

            if (strSkinPath.ToLowerInvariant().Contains(Globals.HostMapPath.ToLowerInvariant()))
            {
                intPortalId = Null.NullInteger;
            }
            var skinPackage = SkinController.GetSkinPackage(intPortalId, cboSkins.SelectedItem.Text, "Skin");

            if (skinPackage == null)
            {
                lblLegacy.Visible = (cboSkins.SelectedIndex > 0);
            }
            if (cboSkins.SelectedIndex > 0)
            {
                ProcessSkins(strSkinPath, "Skin");
                pnlSkin.Visible = true;
                if (UserInfo.IsSuperUser || strSkinPath.IndexOf(Globals.HostMapPath.ToLower()) == -1)
                {
                    cmdParse.Visible = true;
                    pnlParse.Visible = true;
                }
                else
                {
                    cmdParse.Visible = false;
                    pnlParse.Visible = false;
                }
            }
            else
            {
                pnlSkin.Visible  = false;
                pnlParse.Visible = false;
            }
        }
コード例 #14
0
        private string GetSkin()
        {
            //attempt to find and load a  skin from the assigned skinned source
            var skinSource = PortalSettings.DefaultPortalSkin;

            var tab = TabController.Instance.GetTab(TabId, PortalId, false);

            if (!string.IsNullOrEmpty(tab.SkinSrc))
            {
                skinSource = tab.SkinSrc;
            }
            else
            {
                skinSource = SkinController.FormatSkinPath(skinSource) + "groups.ascx";
                var physicalSkinFile = SkinController.FormatSkinSrc(skinSource, PortalSettings);

                if (!File.Exists(HttpContext.Current.Server.MapPath(physicalSkinFile)))
                {
                    skinSource = ""; //this will load the default skin
                }
            }
            return(skinSource);
        }
コード例 #15
0
        public void ConfigureTab_Formats_Tab_SkinSrc_If_Neccessary()
        {
            //Arrange
            var controller = new PortalSettingsController();
            var settings   = new PortalSettings {
                PortalId = ValidPortalId, DefaultPortalSkin = DefaultSkin, CultureCode = Null.NullString
            };
            var validTab = new TabInfo {
                TabID = ValidTabId, PortalID = ValidPortalId, SkinSrc = GlobalTabSkin
            };

            settings.ActiveTab = validTab;

            var mockLocaleController = new Mock <ILocaleController>();

            mockLocaleController.Setup(c => c.GetLocales(It.IsAny <int>())).Returns(new Dictionary <string, Locale>());
            LocaleController.RegisterInstance(mockLocaleController.Object);

            var mockTabController = new Mock <ITabController>();

            mockTabController.Setup(c => c.GetTabsByPortal(ValidPortalId)).Returns(new TabCollection(new List <TabInfo> {
                validTab
            }));
            mockTabController.Setup(c => c.GetTabsByPortal(HostPortalId)).Returns(new TabCollection());
            TabController.SetTestableInstance(mockTabController.Object);

            var mockHostController = new Mock <IHostController>();

            mockHostController.Setup(c => c.GetString("DefaultPortalContainer")).Returns("DefaultPortalContainer");
            HostController.RegisterInstance(mockHostController.Object);

            //Act
            controller.ConfigureActiveTab(settings);

            //Assert
            Assert.AreEqual(SkinController.FormatSkinSrc(GlobalTabSkin, settings), settings.ActiveTab.SkinSrc);
        }
コード例 #16
0
ファイル: Player.cs プロジェクト: wenright/Chromatic
    void Awake()
    {
        trail      = GetComponent <TrailRenderer>();
        sprite     = GetComponent <SpriteRenderer>();
        color      = ColorList.white;
        gc         = GameObject.FindWithTag("GameController").GetComponent <Controller>();
        pulsetimer = 1;

        SpriteRenderer playerRenderer = GetComponent <SpriteRenderer>();
        SkinController skinController = GetComponent <SkinController>();

        int defaultSkin = 3;

        switch (PlayerPrefs.GetInt("skin", defaultSkin))
        {
        case (int)SkinController.Skins.skull:
            playerRenderer.sprite = skinController.skull;
            break;

        case (int)SkinController.Skins.square:
            playerRenderer.sprite = skinController.square;
            break;

        case (int)SkinController.Skins.circle:
            playerRenderer.sprite = skinController.circle;
            break;

        case (int)SkinController.Skins.star:
            playerRenderer.sprite = skinController.star;
            break;

        default:
            Debug.LogError("Unknown skin selected!");
            break;
        }
    }
コード例 #17
0
        /// <summary>
        /// Update Theme Attributes.
        /// </summary>
        /// <param name="portalSettings"></param>
        /// <param name="updateTheme"></param>
        public void UpdateTheme(PortalSettings portalSettings, UpdateThemeInfo updateTheme)
        {
            var themePath = SkinController.FormatSkinSrc(updateTheme.Path + ".ascx", portalSettings);

            themePath = Path.Combine(Globals.ApplicationMapPath, themePath.TrimStart('/'));

            var objStreamReader = File.OpenText(themePath);
            var strSkin         = objStreamReader.ReadToEnd();

            objStreamReader.Close();
            var strTag     = "<dnn:" + updateTheme.Token + " runat=\"server\" id=\"dnn" + updateTheme.Token + "\"";
            var intOpenTag = strSkin.IndexOf(strTag);

            if (intOpenTag != -1)
            {
                var    intCloseTag       = strSkin.IndexOf(" />", intOpenTag);
                var    strAttribute      = updateTheme.Setting;
                var    intStartAttribute = strSkin.IndexOf(strAttribute, intOpenTag);
                string strValue          = updateTheme.Value;
                if (intStartAttribute != -1 && intStartAttribute < intCloseTag)
                {
                    //remove attribute
                    var intEndAttribute = strSkin.IndexOf("\" ", intStartAttribute);
                    strSkin = strSkin.Substring(0, intStartAttribute) + strSkin.Substring(intEndAttribute + 2);
                }
                //add attribute
                strSkin = strSkin.Insert(intOpenTag + strTag.Length, " " + strAttribute + "=\"" + strValue + "\"");

                File.SetAttributes(themePath, FileAttributes.Normal);
                var objStream = File.CreateText(themePath);
                objStream.WriteLine(strSkin);
                objStream.Close();

                UpdateManifest(portalSettings, updateTheme);
            }
        }
コード例 #18
0
        protected virtual void UpdateSkinSettings(TabInfo activeTab, PortalSettings portalSettings)
        {
            if (Globals.IsAdminSkin())
            {
                // DNN-6170 ensure skin value is culture specific
                activeTab.SkinSrc = string.IsNullOrEmpty(PortalController.GetPortalSetting("DefaultAdminSkin", portalSettings.PortalId,
                                                                                           Host.Host.DefaultAdminSkin, portalSettings.CultureCode)) ? portalSettings.DefaultAdminSkin : PortalController.GetPortalSetting("DefaultAdminSkin", portalSettings.PortalId,
                                                                                                                                                                                                                          Host.Host.DefaultAdminSkin, portalSettings.CultureCode);
            }
            else if (string.IsNullOrEmpty(activeTab.SkinSrc))
            {
                // DNN-6170 ensure skin value is culture specific
                activeTab.SkinSrc = string.IsNullOrEmpty(PortalController.GetPortalSetting("DefaultPortalSkin", portalSettings.PortalId,
                                                                                           Host.Host.DefaultPortalSkin, portalSettings.CultureCode)) ? portalSettings.DefaultPortalSkin : PortalController.GetPortalSetting("DefaultPortalSkin", portalSettings.PortalId,
                                                                                                                                                                                                                            Host.Host.DefaultPortalSkin, portalSettings.CultureCode);
            }

            activeTab.SkinSrc  = SkinController.FormatSkinSrc(activeTab.SkinSrc, portalSettings);
            activeTab.SkinPath = SkinController.FormatSkinPath(activeTab.SkinSrc);

            if (Globals.IsAdminSkin())
            {
                activeTab.ContainerSrc = string.IsNullOrEmpty(PortalController.GetPortalSetting("DefaultAdminContainer", portalSettings.PortalId,
                                                                                                Host.Host.DefaultAdminContainer, portalSettings.CultureCode)) ? portalSettings.DefaultAdminContainer : PortalController.GetPortalSetting("DefaultAdminContainer", portalSettings.PortalId,
                                                                                                                                                                                                                                         Host.Host.DefaultAdminContainer, portalSettings.CultureCode);
            }
            else if (string.IsNullOrEmpty(activeTab.ContainerSrc))
            {
                activeTab.ContainerSrc = string.IsNullOrEmpty(PortalController.GetPortalSetting("DefaultPortalContainer", portalSettings.PortalId,
                                                                                                Host.Host.DefaultPortalContainer, portalSettings.CultureCode)) ? portalSettings.DefaultPortalContainer : PortalController.GetPortalSetting("DefaultPortalContainer", portalSettings.PortalId,
                                                                                                                                                                                                                                           Host.Host.DefaultPortalContainer, portalSettings.CultureCode);
            }

            activeTab.ContainerSrc  = SkinController.FormatSkinSrc(activeTab.ContainerSrc, portalSettings);
            activeTab.ContainerPath = SkinController.FormatSkinPath(activeTab.ContainerSrc);
        }
コード例 #19
0
        public static bool CanDeletePackage(PackageInfo package, PortalSettings portalSettings)
        {
            bool bCanDelete = true;

            var dependencies = Instance.GetPackageDependencies(d => d.PackageName == package.Name && d.Version <= package.Version);

            if (dependencies.Count > 0)
            {
                //There is at least one package dependent on this package.
                foreach (var dependency in dependencies)
                {
                    var dep = dependency;

                    //Check if there is an alternative package
                    var packages = Instance.GetExtensionPackages(package.PortalID,
                                                                 p => p.Name == dep.PackageName &&
                                                                 p.Version >= dep.Version &&
                                                                 p.PackageID != package.PackageID);
                    if (packages.Count == 0)
                    {
                        bCanDelete = false;
                    }
                }
            }

            if (bCanDelete)
            {
                switch (package.PackageType)
                {
                case "Skin":
                case "Container":
                    //Need to get path of skin being deleted so we can call the public CanDeleteSkin function in the SkinController
                    string          strRootSkin      = package.PackageType == "Skin" ? SkinController.RootSkin : SkinController.RootContainer;
                    SkinPackageInfo _SkinPackageInfo = SkinController.GetSkinByPackageID(package.PackageID);
                    string          strFolderPath    = Path.Combine(_SkinPackageInfo.PortalID == Null.NullInteger
                                                                ? Path.Combine(Globals.HostMapPath, strRootSkin)
                                                                : Path.Combine(portalSettings.HomeDirectoryMapPath, strRootSkin), _SkinPackageInfo.SkinName);

                    bCanDelete = SkinController.CanDeleteSkin(strFolderPath, portalSettings.HomeDirectoryMapPath);
                    break;

                case "Provider":
                    //Check if the provider is the default provider
                    XmlDocument configDoc    = Config.Load();
                    string      providerName = package.Name;
                    if (providerName.IndexOf(".", StringComparison.Ordinal) > Null.NullInteger)
                    {
                        providerName = providerName.Substring(providerName.IndexOf(".", StringComparison.Ordinal) + 1);
                    }
                    switch (providerName)
                    {
                    case "SchedulingProvider":
                        providerName = "DNNScheduler";
                        break;

                    case "SearchIndexProvider":
                        providerName = "ModuleIndexProvider";
                        break;

                    case "SearchProvider":
                        providerName = "SearchDataStoreProvider";
                        break;
                    }
                    XPathNavigator providerNavigator = configDoc.CreateNavigator().SelectSingleNode("/configuration/dotnetnuke/*[@defaultProvider='" + providerName + "']");
                    bCanDelete = (providerNavigator == null);
                    break;
                }
            }

            return(bCanDelete);
        }
コード例 #20
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Install method installs the skin component
        /// </summary>
        public override void Install()
        {
            bool bAdd = Null.NullBoolean;

            try
            {
                //Attempt to get the Skin Package
                TempSkinPackage = SkinController.GetSkinPackage(SkinPackage.PortalID, SkinPackage.SkinName, SkinType);
                if (TempSkinPackage == null)
                {
                    bAdd = true;
                    SkinPackage.PackageID = Package.PackageID;
                }
                else
                {
                    SkinPackage.SkinPackageID = TempSkinPackage.SkinPackageID;
                    if (TempSkinPackage.PackageID != Package.PackageID)
                    {
                        Completed = false;
                        Log.AddFailure(Util.SKIN_Installed);
                        return;
                    }
                    else
                    {
                        SkinPackage.PackageID = TempSkinPackage.PackageID;
                    }
                }
                SkinPackage.SkinType = SkinType;
                if (bAdd)
                {
                    //Add new skin package
                    SkinPackage.SkinPackageID = SkinController.AddSkinPackage(SkinPackage);
                }
                else
                {
                    //Update skin package
                    SkinController.UpdateSkinPackage(SkinPackage);
                }
                Log.AddInfo(string.Format(Util.SKIN_Registered, SkinPackage.SkinName));

                //install (copy the files) by calling the base class
                base.Install();

                //process the list of skin files
                if (SkinFiles.Count > 0)
                {
                    Log.StartJob(Util.SKIN_BeginProcessing);
                    string strMessage = Null.NullString;
                    var    NewSkin    = new SkinFileProcessor(RootPath, SkinRoot, SkinPackage.SkinName);
                    foreach (string skinFile in SkinFiles)
                    {
                        strMessage += NewSkin.ProcessFile(skinFile, SkinParser.Portable);
                        skinFile.Replace(Globals.HostMapPath + "\\", "[G]");
                        switch (Path.GetExtension(skinFile))
                        {
                        case ".htm":
                            SkinController.AddSkin(SkinPackage.SkinPackageID, skinFile.Replace("htm", "ascx"));
                            break;

                        case ".html":
                            SkinController.AddSkin(SkinPackage.SkinPackageID, skinFile.Replace("html", "ascx"));
                            break;

                        case ".ascx":
                            SkinController.AddSkin(SkinPackage.SkinPackageID, skinFile);
                            break;
                        }
                    }
                    Array arrMessage = strMessage.Split(new[] { "<br />" }, StringSplitOptions.None);
                    foreach (string strRow in arrMessage)
                    {
                        Log.AddInfo(HtmlUtils.StripTags(strRow, true));
                    }
                    Log.EndJob(Util.SKIN_EndProcessing);
                }
                Completed = true;
            }
            catch (Exception ex)
            {
                Log.AddFailure(ex);
            }
        }
コード例 #21
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            try
            {
                bool   blnIndicateChildren = bool.Parse(GetValue(IndicateChildren, "True"));
                string strRightArrow;
                string strDownArrow;
                var    objSkins = new SkinController();

                //image for right facing arrow
                if (!String.IsNullOrEmpty(IndicateChildImageSub))
                {
                    strRightArrow = IndicateChildImageSub;
                }
                else
                {
                    strRightArrow = "breadcrumb.gif"; //removed APPIMAGEPATH token - https://www.dnnsoftware.com/Community/ForumsDotNetNuke/tabid/795/forumid/76/threadid/85554/scope/posts/Default.aspx
                }

                //image for down facing arrow
                if (!String.IsNullOrEmpty(IndicateChildImageRoot))
                {
                    strDownArrow = IndicateChildImageRoot;
                }
                else
                {
                    strDownArrow = "menu_down.gif"; //removed APPIMAGEPATH token - https://www.dnnsoftware.com/Community/ForumsDotNetNuke/tabid/795/forumid/76/threadid/85554/scope/posts/Default.aspx
                }

                //Set correct image path for all separator images
                if (!String.IsNullOrEmpty(SeparatorHTML))
                {
                    SeparatorHTML = FixImagePath(SeparatorHTML);
                }

                if (!String.IsNullOrEmpty(SeparatorLeftHTML))
                {
                    SeparatorLeftHTML = FixImagePath(SeparatorLeftHTML);
                }

                if (!String.IsNullOrEmpty(SeparatorRightHTML))
                {
                    SeparatorRightHTML = FixImagePath(SeparatorRightHTML);
                }
                if (!String.IsNullOrEmpty(SeparatorLeftHTMLBreadCrumb))
                {
                    SeparatorLeftHTMLBreadCrumb = FixImagePath(SeparatorLeftHTMLBreadCrumb);
                }

                if (!String.IsNullOrEmpty(SeparatorRightHTMLBreadCrumb))
                {
                    SeparatorRightHTMLBreadCrumb = FixImagePath(SeparatorRightHTMLBreadCrumb);
                }

                if (!String.IsNullOrEmpty(SeparatorLeftHTMLActive))
                {
                    SeparatorLeftHTMLActive = FixImagePath(SeparatorLeftHTMLActive);
                }

                if (!String.IsNullOrEmpty(SeparatorRightHTMLActive))
                {
                    SeparatorRightHTMLActive = FixImagePath(SeparatorRightHTMLActive);
                }

                if (!String.IsNullOrEmpty(NodeLeftHTMLBreadCrumbRoot))
                {
                    NodeLeftHTMLBreadCrumbRoot = FixImagePath(NodeLeftHTMLBreadCrumbRoot);
                }

                if (!String.IsNullOrEmpty(NodeRightHTMLBreadCrumbRoot))
                {
                    NodeRightHTMLBreadCrumbRoot = FixImagePath(NodeRightHTMLBreadCrumbRoot);
                }

                if (!String.IsNullOrEmpty(NodeLeftHTMLBreadCrumbSub))
                {
                    NodeLeftHTMLBreadCrumbSub = FixImagePath(NodeLeftHTMLBreadCrumbSub);
                }

                if (!String.IsNullOrEmpty(NodeRightHTMLBreadCrumbSub))
                {
                    NodeRightHTMLBreadCrumbSub = FixImagePath(NodeRightHTMLBreadCrumbSub);
                }

                if (!String.IsNullOrEmpty(NodeLeftHTMLRoot))
                {
                    NodeLeftHTMLRoot = FixImagePath(NodeLeftHTMLRoot);
                }

                if (!String.IsNullOrEmpty(NodeRightHTMLRoot))
                {
                    NodeRightHTMLRoot = FixImagePath(NodeRightHTMLRoot);
                }

                if (!String.IsNullOrEmpty(NodeLeftHTMLSub))
                {
                    NodeLeftHTMLSub = FixImagePath(NodeLeftHTMLSub);
                }

                if (!String.IsNullOrEmpty(NodeRightHTMLSub))
                {
                    NodeRightHTMLSub = FixImagePath(NodeRightHTMLSub);
                }

                if (String.IsNullOrEmpty(PathImage))
                {
                    PathImage = PortalSettings.HomeDirectory;
                }

                if (blnIndicateChildren)
                {
                    IndicateChildImageSub = strRightArrow;
                    if (ControlOrientation.ToLowerInvariant() == "vertical")
                    {
                        IndicateChildImageRoot = strRightArrow;
                    }
                    else
                    {
                        IndicateChildImageRoot = strDownArrow;
                    }
                }
                else
                {
                    IndicateChildImageSub = "[APPIMAGEPATH]spacer.gif";
                }

                PathSystemScript = Globals.ApplicationPath + "/controls/SolpartMenu/";
                PathSystemImage  = "[APPIMAGEPATH]";
                BuildNodes(null);
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #22
0
ファイル: Collada.cs プロジェクト: klightspeed/RS5-Extractor
        public Collada(IEnumerable<List<Triangle>> meshes, Joint rootjoint, IEnumerable<XElement> extradata, string path, DateTime creattime, DateTime modtime)
        {
            basepath = path;
            List<Geometry> geometries = new List<Geometry>();
            List<Node> scenenodes = new List<Node>();
            List<Node> modelnodes = new List<Node>();
            List<SkinController> controllers = new List<SkinController>();
            Skeleton skeleton = rootjoint == null ? null : new Skeleton("model_skel", rootjoint);
            Animation animation = rootjoint == null ? null : skeleton.GetAnimatedBones().Count() != 0 ? new Animation(skeleton) : null;
            List<InstanceBase> instnodes = new List<InstanceBase>();

            foreach (List<Triangle> mesh in meshes.Where(m => m.Count != 0))
            {
                Geometry geometry = new Geometry(this, CreateSymbol("model_mesh"), mesh);
                Node node = new Node(geometry.ID + "_node", geometry.GetInstance());
                geometries.Add(geometry);
                if (skeleton != null)
                {
                    SkinController controller = new SkinController(geometry, skeleton);
                    controllers.Add(controller);
                    node = new Node(controller.ID + "_node", controller.GetInstance());
                }
                modelnodes.Add(node);
            }

            Node modelroot = new Node("model", modelnodes, skeleton);
            scenenodes.Add(modelroot);

            this.Add(
                new XElement(ns + "COLLADA",
                    new XAttribute("version", "1.4.1"),
                    new XElement(ns + "asset",
                        new XElement(ns + "contributor",
                            new XElement(ns + "author", "IonFx")
                        ),
                        new XElement(ns + "created", creattime.ToString("O")),
                        new XElement(ns + "modified", modtime.ToString("O")),
                        new XElement(ns + "up_axis", "Z_UP")
                    ),
                    new XElement(ns + "library_images", Materials.Values.Select(m => m.Effect.Image)),
                    new XElement(ns + "library_effects", Materials.Values.Select(m => m.Effect)),
                    new XElement(ns + "library_materials", Materials.Values),
                    new XElement(ns + "library_geometries",
                        geometries,
                        extradata == null ? null : new XElement(ns + "extra",
                            new XElement(ns + "technique",
                                new XAttribute("profile", "RS5-Extra"),
                                extradata
                            )
                        )
                    ),
                    controllers.Count == 0 ? null : new XElement(ns + "library_controllers", controllers),
                    animation == null ? null : new XElement(ns + "library_animations", animation),
                    new XElement(ns + "library_visual_scenes",
                        new XElement(ns + "visual_scene",
                            new XAttribute("id", "visual_scene"),
                            scenenodes
                        )
                    ),
                    new XElement(ns + "scene",
                        new XElement(ns + "instance_visual_scene",
                            new XAttribute("url", "#visual_scene")
                        )
                    )
                )
            );
        }
コード例 #23
0
ファイル: Nav.ascx.cs プロジェクト: hackoose/cfi-team05
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            try
            {
                bool blnIndicateChildren = bool.Parse(GetValue(IndicateChildren, "True"));
                string strRightArrow;
                string strDownArrow;
                var objSkins = new SkinController();

                //image for right facing arrow
                if (!String.IsNullOrEmpty(IndicateChildImageSub))
                {
                    strRightArrow = IndicateChildImageSub;
                }
                else
                {
                    strRightArrow = "breadcrumb.gif"; //removed APPIMAGEPATH token - http://www.dotnetnuke.com/Community/ForumsDotNetNuke/tabid/795/forumid/76/threadid/85554/scope/posts/Default.aspx
                }

                //image for down facing arrow
                if (!String.IsNullOrEmpty(IndicateChildImageRoot))
                {
                    strDownArrow = IndicateChildImageRoot;
                }
                else
                {
                    strDownArrow = "menu_down.gif"; //removed APPIMAGEPATH token - http://www.dotnetnuke.com/Community/ForumsDotNetNuke/tabid/795/forumid/76/threadid/85554/scope/posts/Default.aspx
                }

                //Set correct image path for all separator images
                if (!String.IsNullOrEmpty(SeparatorHTML))
                {
                    SeparatorHTML = FixImagePath(SeparatorHTML);
                }

                if (!String.IsNullOrEmpty(SeparatorLeftHTML))
                {
                    SeparatorLeftHTML = FixImagePath(SeparatorLeftHTML);
                }

                if (!String.IsNullOrEmpty(SeparatorRightHTML))
                {
                    SeparatorRightHTML = FixImagePath(SeparatorRightHTML);
                }
                if (!String.IsNullOrEmpty(SeparatorLeftHTMLBreadCrumb))
                {
                    SeparatorLeftHTMLBreadCrumb = FixImagePath(SeparatorLeftHTMLBreadCrumb);
                }

                if (!String.IsNullOrEmpty(SeparatorRightHTMLBreadCrumb))
                {
                    SeparatorRightHTMLBreadCrumb = FixImagePath(SeparatorRightHTMLBreadCrumb);
                }

                if (!String.IsNullOrEmpty(SeparatorLeftHTMLActive))
                {
                    SeparatorLeftHTMLActive = FixImagePath(SeparatorLeftHTMLActive);
                }

                if (!String.IsNullOrEmpty(SeparatorRightHTMLActive))
                {
                    SeparatorRightHTMLActive = FixImagePath(SeparatorRightHTMLActive);
                }

                if (!String.IsNullOrEmpty(NodeLeftHTMLBreadCrumbRoot))
                {
                    NodeLeftHTMLBreadCrumbRoot = FixImagePath(NodeLeftHTMLBreadCrumbRoot);
                }

                if (!String.IsNullOrEmpty(NodeRightHTMLBreadCrumbRoot))
                {
                    NodeRightHTMLBreadCrumbRoot = FixImagePath(NodeRightHTMLBreadCrumbRoot);
                }

                if (!String.IsNullOrEmpty(NodeLeftHTMLBreadCrumbSub))
                {
                    NodeLeftHTMLBreadCrumbSub = FixImagePath(NodeLeftHTMLBreadCrumbSub);
                }

                if (!String.IsNullOrEmpty(NodeRightHTMLBreadCrumbSub))
                {
                    NodeRightHTMLBreadCrumbSub = FixImagePath(NodeRightHTMLBreadCrumbSub);
                }

                if (!String.IsNullOrEmpty(NodeLeftHTMLRoot))
                {
                    NodeLeftHTMLRoot = FixImagePath(NodeLeftHTMLRoot);
                }

                if (!String.IsNullOrEmpty(NodeRightHTMLRoot))
                {
                    NodeRightHTMLRoot = FixImagePath(NodeRightHTMLRoot);
                }

                if (!String.IsNullOrEmpty(NodeLeftHTMLSub))
                {
                    NodeLeftHTMLSub = FixImagePath(NodeLeftHTMLSub);
                }

                if (!String.IsNullOrEmpty(NodeRightHTMLSub))
                {
                    NodeRightHTMLSub = FixImagePath(NodeRightHTMLSub);
                }

                if (String.IsNullOrEmpty(PathImage))
                {
                    PathImage = PortalSettings.HomeDirectory;
                }

                if (blnIndicateChildren)
                {
                    IndicateChildImageSub = strRightArrow;
                    if (ControlOrientation.ToLower() == "vertical")
                    {
                        IndicateChildImageRoot = strRightArrow;
                    }
                    else
                    {
                        IndicateChildImageRoot = strDownArrow;
                    }
                }
                else
                {
                    IndicateChildImageSub = "[APPIMAGEPATH]spacer.gif";
                }

                PathSystemScript = Globals.ApplicationPath + "/controls/SolpartMenu/";
                PathSystemImage = "[APPIMAGEPATH]";
                BuildNodes(null);
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #24
0
        public override void ExportData(ExportImportJob exportJob, ExportDto exportDto)
        {
            if (this.CheckCancelled(exportJob))
            {
                return;
            }

            // Skip the export if all the folders have been processed already.
            if (this.CheckPoint.Stage >= 1)
            {
                return;
            }

            this.exportImportJob = exportJob;
            this.portalSettings  = new PortalSettings(exportJob.PortalId);

            // Create Zip File to hold files
            var currentIndex        = 0;
            var totalThemesExported = 0;

            try
            {
                var packagesZipFileFormat = $"{Globals.ApplicationMapPath}{Constants.ExportFolder}{{0}}\\{Constants.ExportZipThemes}";
                var packagesZipFile       = string.Format(packagesZipFileFormat, exportJob.Directory.TrimEnd('\\').TrimEnd('/'));

                if (this.CheckPoint.Stage == 0)
                {
                    // export skin packages.
                    var exportThemes = this.GetExportThemes();
                    var totalThemes  = exportThemes.Count;

                    // Update the total items count in the check points. This should be updated only once.
                    this.CheckPoint.TotalItems = this.CheckPoint.TotalItems <= 0 ? totalThemes : this.CheckPoint.TotalItems;
                    if (this.CheckPointStageCallback(this))
                    {
                        return;
                    }

                    using (var archive = CompressionUtil.OpenCreate(packagesZipFile))
                    {
                        foreach (var theme in exportThemes)
                        {
                            var filePath     = SkinController.FormatSkinSrc(theme, this.portalSettings);
                            var physicalPath = Path.Combine(Globals.ApplicationMapPath, filePath.TrimStart('/'));
                            if (Directory.Exists(physicalPath))
                            {
                                foreach (var file in Directory.GetFiles(physicalPath, "*.*", SearchOption.AllDirectories))
                                {
                                    var folderOffset = Path.Combine(Globals.ApplicationMapPath, "Portals").Length + 1;
                                    CompressionUtil.AddFileToArchive(archive, file, folderOffset);
                                }

                                totalThemesExported += 1;
                            }

                            this.CheckPoint.ProcessedItems++;
                            this.CheckPoint.Progress = this.CheckPoint.ProcessedItems * 100.0 / totalThemes;
                            currentIndex++;

                            // After every 10 items, call the checkpoint stage. This is to avoid too many frequent updates to DB.
                            if (currentIndex % 10 == 0 && this.CheckPointStageCallback(this))
                            {
                                return;
                            }
                        }
                    }

                    this.CheckPoint.Stage++;
                    this.CheckPoint.Completed = true;
                    this.CheckPoint.Progress  = 100;
                }
            }
            finally
            {
                this.CheckPointStageCallback(this);
                this.Result.AddSummary("Exported Themes", totalThemesExported.ToString());
            }
        }
コード例 #25
0
        protected void Page_Init(Object sender, EventArgs e)
        {
            InitializePage();

            UserControl ctlSkin = null;

            if (Request.QueryString["SkinSrc"] != null)
            {
                PortalSettings.ActiveTab.SkinSrc = SkinController.FormatSkinSrc(Globals.QueryStringDecode(Request.QueryString["SkinSrc"]) + ".ascx", PortalSettings);
                ctlSkin = LoadSkin(PortalSettings.ActiveTab.SkinSrc);
            }

            // load user skin ( based on cookie )
            if (ctlSkin == null)
            {
                if (Request.Cookies["_SkinSrc" + PortalSettings.PortalId] != null)
                {
                    if (!String.IsNullOrEmpty(Request.Cookies["_SkinSrc" + PortalSettings.PortalId].Value))
                    {
                        PortalSettings.ActiveTab.SkinSrc = SkinController.FormatSkinSrc(Request.Cookies["_SkinSrc" + PortalSettings.PortalId].Value + ".ascx", PortalSettings);
                        ctlSkin = LoadSkin(PortalSettings.ActiveTab.SkinSrc);
                    }
                }
            }

            // load assigned skin
            if (ctlSkin == null)
            {
                if (Globals.IsAdminSkin(PortalSettings.ActiveTab.IsAdminTab))
                {
                    SkinInfo objSkin = SkinController.GetSkin(SkinInfo.RootSkin, PortalSettings.PortalId, SkinType.Admin);
                    if (objSkin != null)
                    {
                        PortalSettings.ActiveTab.SkinSrc = objSkin.SkinSrc;
                    }
                    else
                    {
                        PortalSettings.ActiveTab.SkinSrc = "";
                    }
                }

                if (!String.IsNullOrEmpty(PortalSettings.ActiveTab.SkinSrc))
                {
                    PortalSettings.ActiveTab.SkinSrc = SkinController.FormatSkinSrc(PortalSettings.ActiveTab.SkinSrc, PortalSettings);
                    ctlSkin = LoadSkin(PortalSettings.ActiveTab.SkinSrc);
                }
            }

            // error loading skin - load default
            if (ctlSkin == null)
            {
                // could not load skin control - load default skin
                if (Globals.IsAdminSkin(PortalSettings.ActiveTab.IsAdminTab))
                {
                    PortalSettings.ActiveTab.SkinSrc = Globals.HostPath + SkinInfo.RootSkin + Globals.glbDefaultSkinFolder + Globals.glbDefaultAdminSkin;
                }
                else
                {
                    PortalSettings.ActiveTab.SkinSrc = Globals.HostPath + SkinInfo.RootSkin + Globals.glbDefaultSkinFolder + Globals.glbDefaultSkin;
                }
                ctlSkin = LoadSkin(PortalSettings.ActiveTab.SkinSrc);
            }

            // set skin path
            PortalSettings.ActiveTab.SkinPath = SkinController.FormatSkinPath(PortalSettings.ActiveTab.SkinSrc);

            // set skin id to an explicit short name to reduce page payload and make it standards compliant
            ctlSkin.ID = "dnn";

            // add CSS links
            ManageStyleSheets(false);

            // add skin to page
            SkinPlaceHolder.Controls.Add(ctlSkin);

            // add CSS links
            ManageStyleSheets(true);

            // ClientCallback Logic
            ClientAPI.HandleClientAPICallbackEvent(this);
        }
コード例 #26
0
ファイル: Form1.cs プロジェクト: windwp/mytool
        public void mPaintPlayer(string skin,string weaponid)
        {
            int[] lv = new[] { 77, 40, 47, 0, 82, 51, 74, 39, 81, 97, 81, 96 };
            var skinController = new SkinController();
            skinController.SetSkin(skin);
            var bodyimage = Image.FromFile(GetPath("body", skinController.CBody));
            var headimage = Image.FromFile(GetPath("head", skinController.Chead));


            var g = botskin_pnl.CreateGraphics();
            g.Clear(Color.White);
            g.DrawImage(bodyimage, new Point(lv[8], lv[9]));
            g.DrawImage(headimage, new Point(lv[0], lv[1]));

            if (skinController.Cglass >= 0)
            {
                var glassimage = Image.FromFile(GetPath("glass", skinController.Cglass));
                g.DrawImage(glassimage, new Point(lv[4], lv[5]));
            }
            if (skinController.Cshirt >= 0)
            {
                var shirtimage = Image.FromFile(GetPath("shirt", skinController.Cshirt));
                g.DrawImage(shirtimage, new Point(lv[8], lv[9]));
            }
            if (skinController.Cskirt >= 0)
            {
                var skirtimage = Image.FromFile(GetPath("skirt", skinController.Cskirt));
                //MessageBox.Show(_SkinController.Cskirt.ToString());
                g.DrawImage(skirtimage, new Point(lv[10], lv[11]));
            }
            if (skinController.Cbear >= 0)
            {
                var bearimage = Image.FromFile(GetPath("bear", skinController.Cbear));
                g.DrawImage(bearimage, new Point(lv[6], lv[7]));
            }
            if (skinController.Chat >= 0)
            {
                var hatimage = Image.FromFile(GetPath("hat", skinController.Chat));
                g.DrawImage(hatimage, new Point(lv[2], lv[3]));
            }

            var path = string.Format("./image/gun{0}.png", weaponid).ToLower();
            if (File.Exists(path))
            {
                var image = Image.FromFile(path);
                g.DrawImage(image, new Point(lv[10]-10, lv[11]+10));
            }

        }
コード例 #27
0
        private void ProcessSkins(string strFolderPath, string type)
        {
            const int kColSpan = 5;

            HtmlTable     tbl;
            HtmlTableRow  row = null;
            HtmlTableCell cell;
            Panel         pnlMsg;

            string[] arrFiles;
            string   strURL;
            var      intIndex = 0;

            if (Directory.Exists(strFolderPath))
            {
                bool   fallbackSkin;
                string strRootSkin;
                if (type == "Skin")
                {
                    tbl          = tblSkins;
                    strRootSkin  = SkinController.RootSkin.ToLower();
                    fallbackSkin = IsFallbackSkin(strFolderPath);
                    pnlMsg       = pnlMsgSkins;
                }
                else
                {
                    tbl          = tblContainers;
                    strRootSkin  = SkinController.RootContainer.ToLower();
                    fallbackSkin = IsFallbackContainer(strFolderPath);
                    pnlMsg       = pnlMsgContainers;
                }
                var strSkinType = strFolderPath.ToLower().IndexOf(Globals.HostMapPath.ToLower()) != -1 ? "G" : "L";

                var canDeleteSkin = SkinController.CanDeleteSkin(strFolderPath, PortalSettings.HomeDirectoryMapPath);
                arrFiles = Directory.GetFiles(strFolderPath, "*.ascx");
                int colSpan = arrFiles.Length == 0 ? 1: arrFiles.Length;
                tbl.Width = "auto";
                if (fallbackSkin || !canDeleteSkin)
                {
                    var pnl = new Panel {
                        CssClass = "dnnFormMessage dnnFormWarning"
                    };
                    var lbl = new Label {
                        Text = Localization.GetString(type == "Skin" ? "CannotDeleteSkin.ErrorMessage" : "CannotDeleteContainer.ErrorMessage", LocalResourceFile)
                    };
                    pnl.Controls.Add(lbl);
                    pnlMsg.Controls.Add(pnl);

                    cmdDelete.Visible = false;
                }
                if (arrFiles.Length == 0)
                {
                    var pnl = new Panel {
                        CssClass = "dnnFormMessage dnnFormWarning"
                    };
                    var lbl = new Label {
                        Text = Localization.GetString(type == "Skin" ? "NoSkin.ErrorMessage" : "NoContainer.ErrorMessage", LocalResourceFile)
                    };
                    pnl.Controls.Add(lbl);
                    pnlMsg.Controls.Add(pnl);
                }

                var strFolder = strFolderPath.Substring(strFolderPath.LastIndexOf("\\") + 1);
                foreach (var strFile in arrFiles)
                {
                    var file = strFile.ToLower();
                    intIndex += 1;
                    if (intIndex == kColSpan + 1)
                    {
                        intIndex = 1;
                    }
                    if (intIndex == 1)
                    {
                        //Create new row
                        row = new HtmlTableRow();
                        tbl.Rows.Add(row);
                    }
                    cell = new HtmlTableCell {
                        Align = "center", VAlign = "bottom"
                    };
                    cell.Attributes["class"] = "NormalBold";


                    //thumbnail
                    if (File.Exists(file.Replace(".ascx", ".jpg")))
                    {
                        var imgLink = new HyperLink();
                        strURL = file.Substring(strFile.LastIndexOf("\\portals\\"));
                        imgLink.NavigateUrl = ResolveUrl("~" + strURL.Replace(".ascx", ".jpg"));
                        imgLink.Target      = "_new";


                        var img = new System.Web.UI.WebControls.Image {
                            ImageUrl = CreateThumbnail(file.Replace(".ascx", ".jpg")), BorderWidth = new Unit(1)
                        };

                        imgLink.Controls.Add(img);
                        cell.Controls.Add(imgLink);
                    }
                    else
                    {
                        var img = new System.Web.UI.WebControls.Image {
                            ImageUrl = ResolveUrl("~/images/thumbnail_black.png"), BorderWidth = new Unit(1)
                        };
                        cell.Controls.Add(img);
                    }
                    cell.Controls.Add(new LiteralControl("<br />"));

                    strURL = file.Substring(strFile.IndexOf("\\" + strRootSkin + "\\"));
                    strURL.Replace(".ascx", "");

                    //name
                    var label = new Label {
                        Text = getReducedFileName(Path.GetFileNameWithoutExtension(file)), ToolTip = Path.GetFileNameWithoutExtension(file), CssClass = "skinTitle"
                    };
                    cell.Controls.Add(label);
                    cell.Controls.Add(new LiteralControl("<br />"));

                    //Actions
                    var previewLink = new HyperLink();

                    if (type == "Skin")
                    {
                        previewLink.NavigateUrl = Globals.NavigateURL(PortalSettings.HomeTabId,
                                                                      Null.NullString,
                                                                      "SkinSrc=" + "[" + strSkinType + "]" + Globals.QueryStringEncode(strURL.Replace(".ascx", "").Replace("\\", "/")));
                    }
                    else
                    {
                        previewLink.NavigateUrl = Globals.NavigateURL(PortalSettings.HomeTabId,
                                                                      Null.NullString,
                                                                      "ContainerSrc=" + "[" + strSkinType + "]" + Globals.QueryStringEncode(strURL.Replace(".ascx", "").Replace("\\", "/")));
                    }

                    previewLink.CssClass = "dnnSecondaryAction";
                    previewLink.Target   = "_new";
                    previewLink.Text     = Localization.GetString("cmdPreview", LocalResourceFile);
                    cell.Controls.Add(previewLink);

                    cell.Controls.Add(new LiteralControl("&nbsp;"));

                    var applyButton = new LinkButton
                    {
                        Text            = Localization.GetString("cmdApply", LocalResourceFile),
                        CommandName     = "Apply" + type,
                        CommandArgument = "[" + strSkinType + "]" + strRootSkin + "/" + strFolder + "/" + Path.GetFileName(strFile),
                        CssClass        = "dnnSecondaryAction applyAction"
                    };
                    applyButton.Command += OnCommand;
                    cell.Controls.Add(applyButton);

                    if ((UserInfo.IsSuperUser || strSkinType == "L") && (!fallbackSkin && canDeleteSkin))
                    {
                        cell.Controls.Add(new LiteralControl("&nbsp;"));

                        var deleteButton = new LinkButton
                        {
                            Text            = Localization.GetString("cmdDelete"),
                            CommandName     = "Delete",
                            CommandArgument = "[" + strSkinType + "]" + strRootSkin + "/" + strFolder + "/" + Path.GetFileName(strFile),
                            CssClass        = "dnnSecondaryAction"
                        };
                        deleteButton.Command += OnCommand;
                        cell.Controls.Add(deleteButton);
                    }
                    row.Cells.Add(cell);
                }
                if (File.Exists(strFolderPath + "/" + Globals.glbAboutPage))
                {
                    row  = new HtmlTableRow();
                    cell = new HtmlTableCell {
                        ColSpan = colSpan, Align = "center"
                    };
                    var strFile = strFolderPath + "/" + Globals.glbAboutPage;
                    strURL = strFile.Substring(strFile.IndexOf("\\portals\\"));

                    var copyrightLink = new HyperLink
                    {
                        NavigateUrl = ResolveUrl("~" + strURL),
                        CssClass    = "dnnSecondaryAction",
                        Target      = "_new",
                        Text        = string.Format(Localization.GetString("About", LocalResourceFile), strFolder)
                    };
                    cell.Controls.Add(copyrightLink);

                    row.Cells.Add(cell);
                    tbl.Rows.Add(row);
                }
            }
        }
コード例 #28
0
ファイル: Collada.cs プロジェクト: klightspeed/RS5-Extractor
 public Instance(SkinController controller, Skeleton skeleton, Geometry geometry)
     : base(ns + "instance_controller")
 {
     this.Add(
         new XAttribute("url", "#" + controller.ID),
         new XElement(ns + "skeleton", "#" + skeleton.ID),
         geometry.GetMaterialBinding()
     );
 }
コード例 #29
0
		/// <summary>
		/// The Page_Load server event handler on this page is used
        /// to populate the role information for the page
		/// </summary>
		protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);


            try
            {
                bool blnUseSkinPathArrowImages = bool.Parse(GetValue(UseSkinPathArrowImages, "False"));
                bool blnUseRootBreadcrumbArrow = bool.Parse(GetValue(UseRootBreadCrumbArrow, "True"));
                bool blnUseSubMenuBreadcrumbArrow = bool.Parse(GetValue(UseSubMenuBreadCrumbArrow, "False"));
                bool blnUseArrows = bool.Parse(GetValue(UseArrows, "True"));
                bool blnRootOnly = bool.Parse(GetValue(RootOnly, "False"));
                string strRootBreadcrumbArrow;
                string strSubMenuBreadcrumbArrow;
                string strRightArrow;
                string strDownArrow;
                if (blnRootOnly)
                {
                    blnUseArrows = false;
                    PopulateNodesFromClient = false;
                    StartTabId = -1;
                    ExpandDepth = 1;
                }
                var objSkins = new SkinController();
                //image for root menu breadcrumb marking
                if (!String.IsNullOrEmpty(RootBreadCrumbArrow))
                {
                    strRootBreadcrumbArrow = PortalSettings.ActiveTab.SkinPath + RootBreadCrumbArrow;
                }
                else
                {
                    strRootBreadcrumbArrow = Globals.ApplicationPath + "/images/breadcrumb.gif";
                }
				
				//image for submenu breadcrumb marking
                if (!String.IsNullOrEmpty(SubMenuBreadCrumbArrow))
                {
                    strSubMenuBreadcrumbArrow = PortalSettings.ActiveTab.SkinPath + SubMenuBreadCrumbArrow;
                }
                if (blnUseSubMenuBreadcrumbArrow)
                {
                    strSubMenuBreadcrumbArrow = Globals.ApplicationPath + "/images/breadcrumb.gif";
                    NodeLeftHTMLBreadCrumbSub = "<img alt=\"*\" BORDER=\"0\" src=\"" + strSubMenuBreadcrumbArrow + "\">";
                }
                if (blnUseRootBreadcrumbArrow)
                {
                    NodeLeftHTMLBreadCrumbRoot = "<img alt=\"*\" BORDER=\"0\" src=\"" + strRootBreadcrumbArrow + "\">";
                }
				
				//image for right facing arrow
                if (!String.IsNullOrEmpty(RightArrow))
                {
                    strRightArrow = RightArrow;
                }
                else
                {
                    strRightArrow = "breadcrumb.gif";
                }
                if (!String.IsNullOrEmpty(DownArrow))
                {
                    strDownArrow = DownArrow;
                }
                else
                {
                    strDownArrow = "menu_down.gif";
                }
				
				//Set correct image path for all separator images
                if (!String.IsNullOrEmpty(Separator))
                {
                    if (Separator.IndexOf("src=") != -1)
                    {
                        Separator = Separator.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(LeftSeparator))
                {
                    if (LeftSeparator.IndexOf("src=") != -1)
                    {
                        LeftSeparator = LeftSeparator.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(RightSeparator))
                {
                    if (RightSeparator.IndexOf("src=") != -1)
                    {
                        RightSeparator = RightSeparator.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(LeftSeparatorBreadCrumb))
                {
                    if (LeftSeparatorBreadCrumb.IndexOf("src=") != -1)
                    {
                        LeftSeparatorBreadCrumb = LeftSeparatorBreadCrumb.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(RightSeparatorBreadCrumb))
                {
                    if (RightSeparatorBreadCrumb.IndexOf("src=") != -1)
                    {
                        RightSeparatorBreadCrumb = RightSeparatorBreadCrumb.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(LeftSeparatorActive))
                {
                    if (LeftSeparatorActive.IndexOf("src=") != -1)
                    {
                        LeftSeparatorActive = LeftSeparatorActive.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(RightSeparatorActive))
                {
                    if (RightSeparatorActive.IndexOf("src=") != -1)
                    {
                        RightSeparatorActive = RightSeparatorActive.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
				
				//generate dynamic menu
                if (blnUseSkinPathArrowImages)
                {
                    PathSystemImage = PortalSettings.ActiveTab.SkinPath;
                }
                else
                {
                    PathSystemImage = Globals.ApplicationPath + "/images/";
                }
                if (String.IsNullOrEmpty(PathImage))
                {
                    PathImage = PortalSettings.HomeDirectory;
                }
                if (blnUseArrows)
                {
                    IndicateChildImageSub = strRightArrow;
                    if (ControlOrientation.ToLower() == "vertical") //NavigationProvider.NavigationProvider.Orientation.Vertical Then
                    {
                        IndicateChildImageRoot = strRightArrow;
                    }
                    else
                    {
                        IndicateChildImageRoot = strDownArrow;
                    }
                }
                else
                {
                    PathSystemImage = Globals.ApplicationPath + "/images/";
                    IndicateChildImageSub = "spacer.gif";
                }
                if (String.IsNullOrEmpty(PathSystemScript))
                {
                    PathSystemScript = Globals.ApplicationPath + "/controls/SolpartMenu/";
                }
                BuildNodes(null);
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #30
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            chkHost.CheckedChanged += OnHostCheckChanged;
            chkSite.CheckedChanged += OnSiteCheckChanged;
            cmdDelete.Click        += OnDeleteClick;
            cmdParse.Click         += OnParseClick;
            cmdRestore.Click       += OnRestoreClick;
            lblLegacy.Visible       = false;

            string strSkin;
            var    strContainer = Null.NullString;

            try
            {
                cmdDelete.Visible = true;

                if (Page.IsPostBack == false)
                {
                    LoadCombos();
                }
                typeRow.Visible = !PortalSettings.ActiveTab.IsSuperTab;

                if (!Page.IsPostBack)
                {
                    string strURL;

                    if (Request.QueryString["Name"] != null)
                    {
                        strURL  = Request.MapPath(GetSkinPath(Convert.ToString(Request.QueryString["Type"]), Convert.ToString(Request.QueryString["Root"]), Convert.ToString(Request.QueryString["Name"])));
                        strSkin = strURL.Replace(Globals.ApplicationMapPath, "").ToLowerInvariant();
                    }
                    else
                    {
                        //Get the current portal skin
                        var skinSrc = !string.IsNullOrEmpty(PortalSettings.DefaultPortalSkin) ? PortalSettings.DefaultPortalSkin : SkinController.GetDefaultPortalSkin();
                        strURL  = Request.MapPath(SkinController.FormatSkinPath(SkinController.FormatSkinSrc(skinSrc, PortalSettings)));
                        strURL  = strURL.Substring(0, strURL.LastIndexOf("\\"));
                        strSkin = strURL.Replace(Globals.ApplicationMapPath, "").ToLowerInvariant();
                    }
                    if (!string.IsNullOrEmpty(strSkin))
                    {
                        strContainer = strSkin.Replace("\\" + SkinController.RootSkin.ToLowerInvariant() + "\\", "\\" + SkinController.RootContainer.ToLowerInvariant() + "\\");
                    }
                    SetSkin(strSkin);
                    SetContainer(strContainer);
                }
                else
                {
                    strSkin      = cboSkins.SelectedValue;
                    strContainer = cboContainers.SelectedValue;
                    if (strSkin != CurrentSkin)
                    {
                        strContainer = strSkin.Replace("\\" + SkinController.RootSkin.ToLowerInvariant() + "\\", "\\" + SkinController.RootContainer.ToLowerInvariant() + "\\");
                        SetSkin(strSkin);
                        SetContainer(strContainer);
                    }
                    else if (strContainer != CurrentContainer)
                    {
                        SetSkin(_notSpecified);
                        SetContainer(strContainer);
                    }
                }
                ShowSkins();
                ShowContainers();
            }
            catch (Exception exc)             //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #31
0
        private void GetPortalSettings(int tabID, PortalInfo portal)
        {
            ModuleController objModules = new ModuleController();
            ModuleInfo       objModule;

            this.PortalId              = portal.PortalID;
            this.PortalName            = portal.PortalName;
            this.LogoFile              = portal.LogoFile;
            this.FooterText            = portal.FooterText;
            this.ExpiryDate            = portal.ExpiryDate;
            this.UserRegistration      = portal.UserRegistration;
            this.BannerAdvertising     = portal.BannerAdvertising;
            this.Currency              = portal.Currency;
            this.AdministratorId       = portal.AdministratorId;
            this.Email                 = portal.Email;
            this.HostFee               = portal.HostFee;
            this.HostSpace             = portal.HostSpace;
            this.PageQuota             = portal.PageQuota;
            this.UserQuota             = portal.UserQuota;
            this.AdministratorRoleId   = portal.AdministratorRoleId;
            this.AdministratorRoleName = portal.AdministratorRoleName;
            this.RegisteredRoleId      = portal.RegisteredRoleId;
            this.RegisteredRoleName    = portal.RegisteredRoleName;
            this.Description           = portal.Description;
            this.KeyWords              = portal.KeyWords;
            this.BackgroundFile        = portal.BackgroundFile;
            this.GUID            = portal.GUID;
            this.SiteLogHistory  = portal.SiteLogHistory;
            this.AdminTabId      = portal.AdminTabId;
            this.SuperTabId      = portal.SuperTabId;
            this.SplashTabId     = portal.SplashTabId;
            this.HomeTabId       = portal.HomeTabId;
            this.LoginTabId      = portal.LoginTabId;
            this.RegisterTabId   = portal.RegisterTabId;
            this.UserTabId       = portal.UserTabId;
            this.DefaultLanguage = portal.DefaultLanguage;
            this.TimeZoneOffset  = portal.TimeZoneOffset;
            this.HomeDirectory   = portal.HomeDirectory;
            this.Pages           = portal.Pages;
            this.Users           = portal.Users;
            if (Null.IsNull(this.HostSpace))
            {
                this.HostSpace = 0;
            }
            if (Null.IsNull(this.DefaultLanguage))
            {
                this.DefaultLanguage = Localization.SystemLocale;
            }
            if (Null.IsNull(this.TimeZoneOffset))
            {
                this.TimeZoneOffset = Localization.SystemTimeZoneOffset;
            }
            this.HomeDirectory = Common.Globals.ApplicationPath + "/" + portal.HomeDirectory + "/";
            if (VerifyPortalTab(PortalId, tabID))
            {
                if (this.ActiveTab != null)
                {
                    if (Globals.IsAdminSkin())
                    {
                        this.ActiveTab.SkinSrc = this.DefaultAdminSkin;
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(this.ActiveTab.SkinSrc))
                        {
                            this.ActiveTab.SkinSrc = this.DefaultPortalSkin;
                        }
                    }
                    this.ActiveTab.SkinSrc  = SkinController.FormatSkinSrc(this.ActiveTab.SkinSrc, this);
                    this.ActiveTab.SkinPath = SkinController.FormatSkinPath(this.ActiveTab.SkinSrc);
                    if (Globals.IsAdminSkin())
                    {
                        this.ActiveTab.ContainerSrc = this.DefaultAdminContainer;
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(this.ActiveTab.ContainerSrc))
                        {
                            this.ActiveTab.ContainerSrc = this.DefaultPortalContainer;
                        }
                    }
                    this.ActiveTab.ContainerSrc  = SkinController.FormatSkinSrc(this.ActiveTab.ContainerSrc, this);
                    this.ActiveTab.ContainerPath = SkinController.FormatSkinPath(this.ActiveTab.ContainerSrc);
                    this.ActiveTab.Panes         = new ArrayList();
                    this.ActiveTab.Modules       = new ArrayList();
                    ArrayList crumbs = new ArrayList();
                    GetBreadCrumbsRecursively(ref crumbs, this.ActiveTab.TabID);
                    this.ActiveTab.BreadCrumbs = crumbs;
                }
            }
            if (this.ActiveTab != null)
            {
                Dictionary <string, int> objPaneModules = new Dictionary <string, int>();
                foreach (KeyValuePair <int, ModuleInfo> kvp in objModules.GetTabModules(this.ActiveTab.TabID))
                {
                    ModuleInfo cloneModule = kvp.Value.Clone();
                    if (Null.IsNull(cloneModule.StartDate))
                    {
                        cloneModule.StartDate = System.DateTime.MinValue;
                    }
                    if (Null.IsNull(cloneModule.EndDate))
                    {
                        cloneModule.EndDate = System.DateTime.MaxValue;
                    }
                    if (String.IsNullOrEmpty(cloneModule.ContainerSrc))
                    {
                        cloneModule.ContainerSrc = this.ActiveTab.ContainerSrc;
                    }
                    cloneModule.ContainerSrc  = SkinController.FormatSkinSrc(cloneModule.ContainerSrc, this);
                    cloneModule.ContainerPath = SkinController.FormatSkinPath(cloneModule.ContainerSrc);
                    if (objPaneModules.ContainsKey(cloneModule.PaneName) == false)
                    {
                        objPaneModules.Add(cloneModule.PaneName, 0);
                    }
                    cloneModule.PaneModuleCount = 0;
                    if (!cloneModule.IsDeleted)
                    {
                        objPaneModules[cloneModule.PaneName] = objPaneModules[cloneModule.PaneName] + 1;
                        cloneModule.PaneModuleIndex          = objPaneModules[cloneModule.PaneName] - 1;
                    }
                    this.ActiveTab.Modules.Add(cloneModule);
                }
                foreach (ModuleInfo module in this.ActiveTab.Modules)
                {
                    module.PaneModuleCount = objPaneModules[module.PaneName];
                }
            }
        }
コード例 #32
0
        private void UpdateManifest(PortalSettings portalSettings, UpdateThemeInfo updateTheme)
        {
            var themePath = SkinController.FormatSkinSrc(updateTheme.Path, portalSettings);

            if (File.Exists(themePath.Replace(".ascx", ".htm")))
            {
                var strFile = themePath.Replace(".ascx", ".xml");
                if (File.Exists(strFile) == false)
                {
                    strFile = strFile.Replace(Path.GetFileName(strFile), "skin.xml");
                }
                XmlDocument xmlDoc = null;
                try
                {
                    xmlDoc = new XmlDocument();
                    xmlDoc.Load(strFile);
                }
                catch
                {
                    xmlDoc.InnerXml = "<Objects></Objects>";
                }
                var xmlToken = xmlDoc.DocumentElement.SelectSingleNode("descendant::Object[Token='[" + updateTheme.Token + "]']");
                if (xmlToken == null)
                {
                    //add token
                    string strToken = "<Token>[" + updateTheme.Token + "]</Token><Settings></Settings>";
                    xmlToken          = xmlDoc.CreateElement("Object");
                    xmlToken.InnerXml = strToken;
                    xmlDoc.SelectSingleNode("Objects").AppendChild(xmlToken);
                    xmlToken = xmlDoc.DocumentElement.SelectSingleNode("descendant::Object[Token='[" + updateTheme.Token + "]']");
                }
                var strValue = updateTheme.Value;

                var blnUpdate = false;
                foreach (XmlNode xmlSetting in xmlToken.SelectNodes(".//Settings/Setting"))
                {
                    if (xmlSetting.SelectSingleNode("Name").InnerText == updateTheme.Setting)
                    {
                        xmlSetting.SelectSingleNode("Value").InnerText = strValue;
                        blnUpdate = true;
                    }
                }
                if (blnUpdate == false)
                {
                    var     strSetting = "<Name>" + updateTheme.Setting + "</Name><Value>" + strValue + "</Value>";
                    XmlNode xmlSetting = xmlDoc.CreateElement("Setting");
                    xmlSetting.InnerXml = strSetting;
                    xmlToken.SelectSingleNode("Settings").AppendChild(xmlSetting);
                }
                try
                {
                    if (File.Exists(strFile))
                    {
                        File.SetAttributes(strFile, FileAttributes.Normal);
                    }
                    var objStream = File.CreateText(strFile);
                    var strXML    = xmlDoc.InnerXml;
                    strXML = strXML.Replace("><", ">" + Environment.NewLine + "<");
                    objStream.WriteLine(strXML);
                    objStream.Close();
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                }
            }
        }
コード例 #33
0
        private void LoadSkins()
        {
            string strRoot;
            string strFolder;

            string[] arrFolders;
            string   strName;
            string   strSkin;

            cboSkins.Items.Clear();
            cboSkins.Items.Add("<" + Localization.GetString("Not_Specified") + ">");

            // load host skins
            if (chkHost.Checked)
            {
                strRoot = Request.MapPath(Globals.HostPath + SkinInfo.RootSkin);
                if (Directory.Exists(strRoot))
                {
                    arrFolders = Directory.GetDirectories(strRoot);
                    foreach (string tempLoopVar_strFolder in arrFolders)
                    {
                        strFolder = tempLoopVar_strFolder;
                        //strName = strFolder.Substring( strFolder.LastIndexOf( "\\" ) + 1 - 1 );
                        strName = strFolder.Substring(strFolder.LastIndexOf("\\") + 1 - 1);
                        strSkin = strFolder.Replace(Globals.ApplicationMapPath, "");
                        if (strName != "_default")
                        {
                            cboSkins.Items.Add(new ListItem(strName, strSkin.ToLower()));
                        }
                    }
                }
            }

            // load portal skins
            if (chkSite.Checked)
            {
                strRoot = PortalSettings.HomeDirectoryMapPath + SkinInfo.RootSkin;
                if (Directory.Exists(strRoot))
                {
                    arrFolders = Directory.GetDirectories(strRoot);
                    foreach (string tempLoopVar_strFolder in arrFolders)
                    {
                        strFolder = tempLoopVar_strFolder;
                        strName   = strFolder.Substring(strFolder.LastIndexOf("\\") + 1 - 1);
                        strSkin   = strFolder.Replace(Globals.ApplicationMapPath, "");
                        cboSkins.Items.Add(new ListItem(strName, strSkin.ToLower()));
                    }
                }
            }

            if (!Page.IsPostBack)
            {
                string strURL;
                if (Request.QueryString["Name"] != null)
                {
                    strURL = Request.MapPath(GetSkinPath(Convert.ToString(Request.QueryString["Type"]), SkinInfo.RootSkin, Convert.ToString(Request.QueryString["Name"])));
                }
                else
                {
                    //Get the current portal skin
                    string   skinSrc;
                    SkinInfo objSkin = SkinController.GetSkin(SkinInfo.RootSkin, PortalSettings.PortalId, SkinType.Portal);
                    if (objSkin != null)
                    {
                        skinSrc = objSkin.SkinSrc;
                    }
                    else
                    {
                        skinSrc = "[G]" + SkinInfo.RootSkin + Globals.glbDefaultSkinFolder + Globals.glbDefaultSkin;
                    }
                    strURL = Request.MapPath(SkinController.FormatSkinPath(SkinController.FormatSkinSrc(skinSrc, PortalSettings)));
                    strURL = strURL.Substring(0, strURL.LastIndexOf("\\"));
                }
                strSkin = strURL.Replace(Globals.ApplicationMapPath, "");
                if (cboSkins.Items.FindByValue(strSkin.ToLower()) != null)
                {
                    cboSkins.Items.FindByValue(strSkin.ToLower()).Selected = true;
                    ShowSkins();
                }
            }
        }
コード例 #34
0
 public SkinPackageWriter(PackageInfo package) : base(package)
 {
     _SkinPackage = SkinController.GetSkinByPackageID(package.PackageID);
     SetBasePath();
 }
コード例 #35
0
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                if (Page.IsPostBack == false)
                {
                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));

                    LoadSkins();
                    LoadContainers();

                    if (Request.QueryString["action"] != null)
                    {
                        string strType = Request.QueryString["Type"];
                        string strRoot = Request.QueryString["Root"];
                        string strName = Request.QueryString["Name"];
                        string strSrc  = "[" + strType + "]" + strRoot + "/" + strName + "/" + Request.QueryString["Src"];

                        switch (Request.QueryString["action"])
                        {
                        case "apply":

                            if (strRoot == SkinInfo.RootSkin)
                            {
                                if (chkPortal.Checked)
                                {
                                    SkinController.SetSkin(SkinInfo.RootSkin, PortalId, SkinType.Portal, strSrc);
                                }
                                if (chkAdmin.Checked)
                                {
                                    SkinController.SetSkin(SkinInfo.RootSkin, PortalId, SkinType.Admin, strSrc);
                                }
                            }
                            if (strRoot == SkinInfo.RootContainer)
                            {
                                if (chkPortal.Checked)
                                {
                                    SkinController.SetSkin(SkinInfo.RootContainer, PortalId, SkinType.Portal, strSrc);
                                }
                                if (chkAdmin.Checked)
                                {
                                    SkinController.SetSkin(SkinInfo.RootContainer, PortalId, SkinType.Admin, strSrc);
                                }
                            }
                            DataCache.ClearPortalCache(PortalId, true);
                            Response.Redirect(Request.RawUrl.Replace("&action=apply", ""));
                            break;

                        case "delete":

                            File.Delete(Request.MapPath(SkinController.FormatSkinSrc(strSrc, PortalSettings)));
                            LoadSkins();
                            LoadContainers();
                            break;
                        }
                    }
                }

                if (PortalSettings.ActiveTab.IsSuperTab)
                {
                    typeRow.Visible = false;
                }
                else
                {
                    typeRow.Visible = true;
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }