Exemplo n.º 1
0
 public static void UpdateSkin(PanelPreferences preferences, string skinFolderPath, string dataPath)
 {
     //Changes added for Dynamic GUI creation
     foreach (GuiVariableGroup group in preferences.CurrentGuiTemplate.VariableGroups)
     {
         foreach (GuiVariable guiVar in group.Variables)
         {
             switch (guiVar.ReplacementDirectory.ToLower())
             {
                 case "portal":
                     UpdateSkinWithDynamicVariables(preferences, group.GroupName, guiVar, skinFolderPath, dataPath, true);
                     break;
                 case "survey":
                     UpdateSkinWithDynamicVariables(preferences, group.GroupName, guiVar, skinFolderPath, dataPath, false);
                     break;
                 case "both":
                     UpdateSkinWithDynamicVariables(preferences, group.GroupName, guiVar, skinFolderPath, dataPath, true);
                     UpdateSkinWithDynamicVariables(preferences, group.GroupName, guiVar, skinFolderPath, dataPath, false);
                     break;
             }
         }
     }
     //UpdatePortalSkin(preferences, skinFolderPath, dataPath);
     //UpdateSurveySkin(preferences, skinFolderPath, dataPath);
 }
Exemplo n.º 2
0
        public static void UpdateSkin(PanelPreferences preferences, string skinFolderPath, string dataPath)
        {
            //Changes added for Dynamic GUI creation by Optimus
            foreach (GuiVariableGroup group in preferences.CurrentGuiTemplate.VariableGroups)
            {
                foreach (GuiVariable guiVar in group.Variables)
                {
                    switch (guiVar.ReplacementDirectory.ToLower())
                    {
                        case Constants.Portal:
                            UpdateSkinWithDynamicVariables(preferences, group.GroupName, guiVar, skinFolderPath, dataPath, true);
                            break;
                        case Constants.Survey:
                            UpdateSkinWithDynamicVariables(preferences, group.GroupName, guiVar, skinFolderPath, dataPath, false);
                            break;
                        case Constants.Both:
                            UpdateSkinWithDynamicVariables(preferences, group.GroupName, guiVar, skinFolderPath, dataPath, true);
                            UpdateSkinWithDynamicVariables(preferences, group.GroupName, guiVar, skinFolderPath, dataPath, false);
                            break;
                    }
                }
            }
            UpdatePortalSkin(preferences, skinFolderPath, dataPath);

            //---- Code commented by Optimus : Code was used for the static controls on the web page---
            //UpdateSurveySkin(preferences, skinFolderPath, dataPath);
        }
Exemplo n.º 3
0
 public void UpdateSkin(PanelPreferences prefs, string dataPath)
 {
     //Changes added for Dynamic GUI creation by Optimus
     foreach (GuiVariableGroup group in prefs.CurrentGuiTemplate.VariableGroups)
     {
         if (null == group.Variables) continue;
         foreach (GuiVariable guiVar in group.Variables)
         {
             switch (guiVar.ReplacementDirectory.ToLower())
             {
                 case Constants.Portal:
                     ApplyDynamicVariables(prefs, group.GroupName, guiVar, portalUploadDir.FullName, dataPath, true);
                     break;
                 case Constants.Survey:
                     ApplyDynamicVariables(prefs, group.GroupName, guiVar, surveyUploadDir.FullName, dataPath, false);
                     break;
                 case Constants.Both:
                     ApplyDynamicVariables(prefs, group.GroupName, guiVar, portalUploadDir.FullName, dataPath, true);
                     ApplyDynamicVariables(prefs, group.GroupName, guiVar, surveyUploadDir.FullName, dataPath, false);
                     break;
             }
         }
     }
 }
Exemplo n.º 4
0
 // Updating Portal and Survey Skin with Dynamic Variable Values by Optimus
 private static void ApplyDynamicVariables(PanelPreferences preferences, string groupName, GuiVariable guiVar, string skinFolderPath,
     string dataPath, ReplacementDirectory.Replacement replacementDirectory)
 {
     switch (guiVar.UiComponent)
     {
         // Modified by K.G for phase2 task 'Support upload/processing of non-image files (e.g. pdf)'.
         case "FileUpload()":
             SkinManagerHelper.UpdateDynamicFile(preferences.DynamicGuiVariables[guiVar.ComponentName],
                 skinFolderPath, dataPath, guiVar.PropertyName, replacementDirectory, guiVar.PathToUpload);
             break;
         case "ChoiceSelector()":
             var replaceValues = guiVar.PropertyName.Split(',');
             if (replaceValues.Length != 2) throw new Exception("Choice Selections must provide values for selected and unselected in PropertyName (e.g. 'block,none')");
             var replacementValue = preferences.DynamicGuiVariables[guiVar.ComponentName] == "true" ? replaceValues[0] : replaceValues[1];
             SkinManagerHelper.UpdateSkinDynamicVariable(replacementValue, skinFolderPath, guiVar.Substitution, guiVar.PropertyName, replacementDirectory);
             break;
         default:
             SkinManagerHelper.UpdateSkinDynamicVariable(preferences.DynamicGuiVariables[guiVar.ComponentName],
                 skinFolderPath, guiVar.Substitution, guiVar.PropertyName, replacementDirectory);
             break;
     }
 }
Exemplo n.º 5
0
        // Added by K.G for phase 2 task: To update substitution file
        public void UpdateSubstitutionFile(PanelPreferences prefs)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(Path.Combine(skinPackageUploadDir.FullName, "Substitution.xml"));
            XmlNode variablesNode = doc.SelectSingleNode(Res.SubstitutionVariablesPath);

            foreach (XmlNode variableNode in variablesNode.ChildNodes)
            {
                foreach (var keyValuePair in prefs.DynamicGuiVariables)
                {
                    if (variableNode.Attributes[Res.ComponentNameAttribute].Value == keyValuePair.Key)
                    {
                        variableNode.Attributes[Res.DefaultAttribute].Value = keyValuePair.Value;
                        break;
                    }
                }
            }
            doc.Save(Path.Combine(skinPackageUploadDir.FullName, "Substitution.xml"));
        }
Exemplo n.º 6
0
        // Added by K.G(29/11/2011) to include email template files in search & replace methods and prefixed template names with .
        public void UpdateEmailTemplates(PanelPreferences prefs, string dataPath, string folderName)
        {
            var emailTemplateFiles = skinPackageUploadDir.GetFiles("EmailTemplate*.xml");
            foreach (var file in emailTemplateFiles)
            {

                string newEmailTemplateFileName = folderName + "_" + file.Name;
                file.MoveTo(Path.Combine(skinPackageUploadDir.ToString(), newEmailTemplateFileName));
            }
            var newEmailTemplateFiles = skinPackageUploadDir.GetFiles(folderName + "*.xml");
            if (newEmailTemplateFiles.Length > 0)
            {
                foreach (GuiVariableGroup group in prefs.CurrentGuiTemplate.VariableGroups)
                {

                    if (null == group.Variables) continue;
                    foreach (GuiVariable guiVar in group.Variables)
                    {
                        foreach (var file in newEmailTemplateFiles)
                        {
                            TextReader reader = new StreamReader(file.FullName);
                            string contents = reader.ReadToEnd();
                            reader.Close();
                            if (contents.Contains(guiVar.Substitution))
                            {
                                contents = contents.Replace(guiVar.Substitution, prefs.DynamicGuiVariables[guiVar.ComponentName]);
                            }

                            TextWriter writer = new StreamWriter(file.FullName);
                            writer.Write(contents);
                            writer.Close();

                        }
                    }
                }
            }
        }
Exemplo n.º 7
0
        private static bool UpdateSurveySkin(PanelPreferences preferences, string skinFolderPath, string dataPath)
        {
            SkinManagerHelper.UpdateSurveyPageBackgroundColor(preferences.PageBackgroundHexCode, skinFolderPath);
            SkinManagerHelper.UpdateSurveyHeader(preferences.HeaderFileName, skinFolderPath, dataPath);

            SkinManagerHelper.UpdateSurveyContentBackgroundColor(preferences.ContentBackgroundHexCode, skinFolderPath);
            SkinManagerHelper.UpdateSurveyPrimaryTextColor(preferences.PrimaryTextHexCode, skinFolderPath);

            //UpdateSkinWithDynamicVariables(preferences, skinFolderPath, dataPath, false);

            return true;
        }
Exemplo n.º 8
0
 // Updating Portal and Survey Skin with Dynamic Variable Values
 private static void UpdateSkinWithDynamicVariables(PanelPreferences preferences, string groupName, GuiVariable guiVar, string skinFolderPath,
     string dataPath, bool isPortal)
 {
     switch (groupName)
     {
         case "TemplateColors":
             SkinManagerHelper.UpdateSkinDynamicVariableColor(preferences.DynamicGuiVariables[guiVar.ComponentName],
                 skinFolderPath, guiVar.Substitution, guiVar.PropertyName, isPortal);
             break;
         case "List":
         case "Choices":
         case "Text":
             SkinManagerHelper.UpdateSkinVariableListChoiceText(preferences.DynamicGuiVariables[guiVar.ComponentName],
                 skinFolderPath, guiVar.Substitution, guiVar.PropertyName, isPortal);
             break;
         case "Images":
             SkinManagerHelper.UpdateDynamicImage(preferences.DynamicGuiVariables[guiVar.ComponentName],
                 skinFolderPath, dataPath, guiVar.PropertyName, isPortal);
             break;
     }
 }
Exemplo n.º 9
0
        private static bool UpdatePortalSkin(PanelPreferences preferences, string skinFolderPath, string dataPath)
        {
            SkinManagerHelper.UpdatePortalHeader(preferences.HeaderFileName, skinFolderPath, dataPath);
            SkinManagerHelper.UpdatePortalLogo(preferences.LogoFileName, skinFolderPath, dataPath);

            SkinManagerHelper.UpdatePortalPageBackgroundColor(preferences.PageBackgroundHexCode, skinFolderPath);
            SkinManagerHelper.UpdatePortalContentBackgroundColor(preferences.ContentBackgroundHexCode, skinFolderPath);
            SkinManagerHelper.UpdatePortalPrimaryTextColor(preferences.PrimaryTextHexCode, skinFolderPath);
            SkinManagerHelper.UpdatePortalSecondaryTextColor(preferences.SecondaryTextHexCode, skinFolderPath);

            SkinManagerHelper.UpdatePortalNewsletterVisibility(preferences.NewsletterVisible, skinFolderPath);
            SkinManagerHelper.UpdatePortalQuickPollsVisibility(preferences.QuickPollVisible, skinFolderPath);

            //UpdateSkinWithDynamicVariables(preferences, skinFolderPath, dataPath, true);

            return true;
        }
Exemplo n.º 10
0
 // Updating Portal and Survey Skin with Dynamic Variable Values by Optimus
 private static void ApplyDynamicVariables(PanelPreferences preferences, string groupName, GuiVariable guiVar, string skinFolderPath,
     string dataPath, bool isPortal)
 {
     switch (guiVar.UiComponent)
     {
         case "ImageUpload()":
             SkinManagerHelper.UpdateDynamicImage(preferences.DynamicGuiVariables[guiVar.ComponentName],
                 skinFolderPath, dataPath, guiVar.PropertyName, isPortal);
             break;
         case "ChoiceSelector()":
             var replaceValues = guiVar.PropertyName.Split(',');
             if (replaceValues.Length != 2) throw new Exception("Choice Selections must provide values for selected and unselected in PropertyName (e.g. 'block,none')");
             var replacementValue = preferences.DynamicGuiVariables[guiVar.ComponentName] == "true" ? replaceValues[0]  : replaceValues[1];
             SkinManagerHelper.UpdateSkinDynamicVariable(replacementValue, skinFolderPath, guiVar.Substitution, guiVar.PropertyName, isPortal);
             break;
         default:
             SkinManagerHelper.UpdateSkinDynamicVariable(preferences.DynamicGuiVariables[guiVar.ComponentName],
                 skinFolderPath, guiVar.Substitution, guiVar.PropertyName, isPortal);
             break;
     }
 }
Exemplo n.º 11
0
        // Added by K.G for phase 2 task: To update substitution file
        public void UpdateSubstitutionFile(PanelPreferences prefs)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(Path.Combine(skinPackageUploadDir.FullName, "Substitution.xml"));
            XmlNode variablesNode = doc.SelectSingleNode(Res.SubstitutionVariablesPath);

            foreach (XmlNode variableNode in variablesNode.ChildNodes)
            {
                foreach (var keyValuePair in prefs.DynamicGuiVariables)
                {
                    if (variableNode.Attributes[Res.ComponentNameAttribute].Value == keyValuePair.Key)
                    {
                        variableNode.Attributes[Res.DefaultAttribute].Value = keyValuePair.Value;
                        break;
                    }
                }
            }
            // Added by K.G(16-JAN-2012) to complete load from zip functionality
            XmlNode QuestionnaireName = doc.SelectSingleNode(Res.SubstitutionQuestionnaireNamePath);
            XmlNode CompanyName = doc.SelectSingleNode(Res.SubstitutionCompanyNamePath);
            XmlNode ContactEmail = doc.SelectSingleNode(Res.SubstitutionContactEmailPath);
            XmlNode Language = doc.SelectSingleNode(Res.SubstitutionLanguagePath);
            QuestionnaireName.InnerText = prefs.QuestionnaireName;
            CompanyName.InnerText = prefs.CompanyName;
            ContactEmail.InnerText = prefs.ContactEmail;
            Language.InnerText = prefs.Language;
            doc.Save(Path.Combine(skinPackageUploadDir.FullName, "Substitution.xml"));
        }
Exemplo n.º 12
0
        private static bool UpdateSurveySkin(PanelPreferences preferences, string skinFolderPath, string dataPath)
        {
            //---- Code commented by Optimus : Code was used for the static controls on the web page---
            /*
             SkinManagerHelper.UpdateSurveyPageBackgroundColor(preferences.PageBackgroundHexCode, skinFolderPath);
             SkinManagerHelper.UpdateSurveyHeader(preferences.HeaderFileName, skinFolderPath, dataPath);

             SkinManagerHelper.UpdateSurveyContentBackgroundColor(preferences.ContentBackgroundHexCode, skinFolderPath);
             SkinManagerHelper.UpdateSurveyPrimaryTextColor(preferences.PrimaryTextHexCode, skinFolderPath);
             */
            return true;
        }
Exemplo n.º 13
0
        private static bool UpdatePortalSkin(PanelPreferences preferences, string skinFolderPath, string dataPath)
        {
            //---- Code commented by Optimus : Code was used for the static controls on the web page---
            /*
            SkinManagerHelper.UpdatePortalHeader(preferences.HeaderFileName, skinFolderPath, dataPath);
            SkinManagerHelper.UpdatePortalLogo(preferences.LogoFileName, skinFolderPath, dataPath);

            SkinManagerHelper.UpdatePortalPageBackgroundColor(preferences.PageBackgroundHexCode, skinFolderPath);
            SkinManagerHelper.UpdatePortalContentBackgroundColor(preferences.ContentBackgroundHexCode, skinFolderPath);
            SkinManagerHelper.UpdatePortalPrimaryTextColor(preferences.PrimaryTextHexCode, skinFolderPath);
            SkinManagerHelper.UpdatePortalSecondaryTextColor(preferences.SecondaryTextHexCode, skinFolderPath);
             */

            SkinManagerHelper.UpdatePortalNewsletterVisibility(preferences.NewsletterVisible, skinFolderPath);
            SkinManagerHelper.UpdatePortalQuickPollsVisibility(preferences.QuickPollVisible, skinFolderPath);

            return true;
        }