/// <summary>
        /// 特定の言語のjsonファイルをパースし、LanguageData形式として読み取ります。
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        private LanguageData ReadSingleFile(FileInfo file)
        {
            var dirName = file.Directory.Name;
            var list = new LanguageData(dirName);

            var obj = JObject.Parse(File.ReadAllText(file.FullName));
            Traverse(obj, ref list);

            return list;
        }
 public TerminalLookupByPrefix(LanguageData language) {
   var allTerms = language.GrammarData.Terminals;
   foreach(var term in allTerms) {
     var firsts = term.GetFirsts();
     if (firsts == null || firsts.Count == 0) continue; 
     // Check for key term (keywords and special symbols). Use only spec symbols, but exclude keywords
     var keyTerm = term as KeyTerm; 
     if (keyTerm != null && char.IsLetter(keyTerm.Text[0])) //if it starts with letter - it is keyword, so skip it
       continue; 
     AddTermLookupInfo(term, firsts); 
   } //foreach
 }//method
Beispiel #3
0
 public bool EditForm()
 {
     if (!(Page.IsPostBack))
         {
             language_data = m_refSiteApi.GetLanguageById(ContentLanguage);
             if (Convert.ToString(EnableMultilingual) == "1")
             {
                 lblLangName.Text = language_data.Name;
             }
             Display_EditForm();
         }
         else
         {
             Process_DoUpdate();
         }
         return true;
 }
Beispiel #4
0
 public bool AddForm()
 {
     if (!(Page.IsPostBack))
         {
             frm_folder_id.Value = Convert.ToString(m_intFolderId);
             frm_copy_lang_from.Value = Request.QueryString["back_LangType"];
             language_data = m_refSiteApi.GetLanguageById(ContentLanguage);
             if (Convert.ToString(EnableMultilingual) == "1")
             {
                 lblLangName.Text = language_data.Name;
             }
             Display_AddForm();
         }
         else
         {
             Process_DoAdd();
         }
         return true;
 }
        /// <summary>
        /// JSONのツリーを探索して、一つの言語分のデータをLangageData型のインスタンスとして作成します。
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="list"></param>
        private static void Traverse(JObject obj, ref LanguageData list)
        {
            foreach (var item in obj)
            {
                var value = item.Value;
                // itemがツリー構造の枝/葉のどちらか判定
                var isLeaf = value.Type != JTokenType.Object;

                if (isLeaf)
                {
                    var ns = TrimEnd(value.Path, "." + item.Key);

                    var str = value.Type != JTokenType.Array ? value.ToString() : value.ToString(Formatting.None);
                    var data = new LocalizationItem(ns, item.Key, str);
                    list.Add(data);
                }
                else
                {
                    Traverse((JObject)value, ref list);
                }
            }
        }
Beispiel #6
0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        RegisterResources();
            m_refMsg = m_refSiteApi.EkMsgRef;
            ContentLanguage = m_refSiteApi.ContentLanguage;
            if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || ContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES)
            {
                ContentLanguage = m_refSiteApi.DefaultContentLanguage;
            }
            language_data = m_refSiteApi.GetLanguageById(ContentLanguage);

            m_refContent = m_refSiteApi.EkContentRef;
            AppImgPath = m_refSiteApi.AppImgPath;

            if (Request.QueryString["id"] != null && Information.IsNumeric(Request.QueryString["id"]))
            {
                m_nId = Convert.ToInt64(Request.QueryString["id"]);
            }
            if (Request.QueryString["type"] != null)
            {
                m_nMetaTypeId = Convert.ToInt64(Request.QueryString["type"]);
            }
            if (Request.QueryString["tagtype"] != null)
            {
                m_nMetaTagType = Convert.ToInt32(Request.QueryString["tagtype"]);
            }
            if (Ektron.Cms.Common.EkConstants.MetaTagType_Menu == m_nMetaTagType)
            {
                _isMenu = true;
            }
            else if (Ektron.Cms.Common.EkConstants.MetaTagType_User == m_nMetaTagType)
            {
                _isUser = true;
                CollectSearchText();
            }
            else
            {
                _isCollection = true;
            }
            if (Request.QueryString["title"] != null)
            {
                m_strTitle = Request.QueryString["title"];
            }
            if (Request.QueryString["metadataformtagid"] != null)
            {
                m_nMetadataFormTagId = Convert.ToInt32(Request.QueryString["metadataformtagid"]);
            }

            ShowControls();
    }
 public LanguageDataBuilder(LanguageData language) {
   Language = language;
   _grammar = Language.Grammar;
 }
Beispiel #8
0
    void OnQuitInstanceButtonUp()
    {
        MogoUIManager.Instance.ShowMogoBattleMainUI();
        Debug.Log("QuitInstance");

        switch (MapData.dataMap.Get(MogoWorld.thePlayer.sceneId).type)
        {
        case MapType.TOWERDEFENCE:
            EventDispatcher.TriggerEvent(Events.CampaignEvent.ExitCampaign);
            break;

        case MapType.ClimbTower:
            if (m_TowerFinishSingle)
            {
                MogoGlobleUIManager.Instance.Confirm(LanguageData.GetContent(816), (rst) =>
                {
                    if (rst)
                    {
                        EventDispatcher.TriggerEvent(Events.InstanceEvent.ReturnHome);
                        MainUIViewManager.Instance.ShowBossTarget(false);
                        //InstanceUIViewManager.Instance.ResetFriendShip();
                        //MogoUIManager.Instance.ShowMogoNormalMainUI();
                        MogoGlobleUIManager.Instance.ConfirmHide();
                        m_TowerFinishSingle = false;
                    }
                    else
                    {
                        MogoUIManager.Instance.ShowMogoBattleMainUI();
                        MogoGlobleUIManager.Instance.ConfirmHide();
                    }
                }
                                                     );
            }
            else
            {
                MogoGlobleUIManager.Instance.Confirm(LanguageData.GetContent(817), (rst) =>
                {
                    if (rst)
                    {
                        EventDispatcher.TriggerEvent(Events.InstanceEvent.ReturnHome);
                        MainUIViewManager.Instance.ShowBossTarget(false);
                        //InstanceUIViewManager.Instance.ResetFriendShip();
                        //MogoUIManager.Instance.ShowMogoNormalMainUI();
                        MogoGlobleUIManager.Instance.ConfirmHide();
                    }
                    else
                    {
                        MogoUIManager.Instance.ShowMogoBattleMainUI();
                        MogoGlobleUIManager.Instance.ConfirmHide();
                    }
                }
                                                     );
            }
            break;

        default:
            EventDispatcher.TriggerEvent(Events.InstanceEvent.ReturnHome);
            MainUIViewManager.Instance.ShowBossTarget(false);
            //MogoUIManager.Instance.ShowMogoNormalMainUI();
            break;
        }
    }
    /// <summary>
    /// ǿ�����Խ���ǿ���ȼ�
    /// </summary>
    /// <param name="strenthenStep">����</param>
    /// <param name="progress">��������</param>
    public void SetEquipmentStarLevel(int strenthenStep, int progress)
    {
        int strenthenLevel = progress / 10;

        m_lblStarLevel.text = string.Format(LanguageData.GetContent(48007), strenthenStep, strenthenLevel);
    }
Beispiel #10
0
 public LanguageRuntime(LanguageData language)
 {
     Language = language;
     Init();
 }
Beispiel #11
0
 private CSharpLanguage()
 {
     _data = LanguageData.FromXml(Properties.Resources.CSharp);
     _stringFormatter = new CSharpStringFormatter();
     _numberFormatter = new CSharpNumberFormatter();
 }
Beispiel #12
0
    private void Display_AddForm()
    {
        //PostBackPage.Text = Utilities.SetPostBackPage("cmsform.aspx?LangType=" & ContentLanguage & "&Action=doAdd")
            string FormTitle = "";
            string FormDescription = "";
            string MailTo = "";
            string MailFrom = "";
            string MailCC = "";
            string MailPreamble = "";
            string MailSubject = "";
            string FormData = "";
            bool CanCreateContent = false;
            bool bCopyFromLang = false;
            FormTitle = Request.QueryString["form_title"];
            FormDescription = Request.QueryString["form_description"];
            MailTo = Request.QueryString["mail_to"];
            MailFrom = Request.QueryString["mail_from"];
            MailCC = Request.QueryString["mail_cc"];
            MailFrom = Request.QueryString["mail_from"];
            MailSubject = Request.QueryString["mail_subject"];
            MailPreamble = Request.QueryString["mail_preamble"];
            if (!string.IsNullOrEmpty(Request.Form[frm_form_mail.UniqueID]) && !string.IsNullOrEmpty(Request.Form[frm_form_db.UniqueID]))
            {
                FormData = "both";
            }
            else if (!string.IsNullOrEmpty(Request.Form[frm_form_mail.UniqueID]))
            {
                FormData = Request.Form[frm_form_mail.UniqueID];
            }
            else
            {
                FormData = Request.Form[frm_form_db.UniqueID];
            }
            frm_form_db.Checked = true;
            frm_form_af.Checked = true;
            security_data = m_refContentApi.LoadPermissions(m_intFolderId, "folder", 0);
            CanCreateContent = security_data.CanAdd;
            if (!string.IsNullOrEmpty(Request.QueryString["back_LangType"]) && !string.IsNullOrEmpty(Request.QueryString["form_id"]))
            {
                //load translated form title
                m_refContentApi.ContentLanguage = Convert.ToInt32(Request.QueryString["back_LangType"]);
                FormTitle = m_refContentApi.GetFormTitleById(m_intFormId);
                FormTitle = FormTitle + "_";
                bCopyFromLang = true;
            }
            AddToolBar();

            DisplayAssignTaskTo();

            frm_folder_id.Value = Convert.ToString(m_intFolderId);
            frm_copy_lang_from.Value = Request.QueryString["back_LangType"];
            frm_form_title.Value = Ektron.Cms.Common.EkFunctions.HtmlDecode(FormTitle);
            frm_form_description.Value = Ektron.Cms.Common.EkFunctions.HtmlDecode(FormDescription);
            frm_form_mailto.Value = MailTo;
            frm_form_mailfrom.Value = MailFrom;
            frm_form_mailcc.Value = MailCC;
            frm_form_mailpreamble.Value = MailPreamble;
            frm_form_mailsubject.Value = MailSubject;

            frm_initial_form.Value = "";
            frm_initial_response.Value = "";

            if (! bCopyFromLang)
            {
                string strFormsPath;
                string strManifestFilePath;
                string strXsltFilePath;
                frm_copy_lang_from.Value = "";
                strFormsPath = (string) (Server.MapPath(m_refContentApi.AppPath) + "controls\\forms\\");
                strManifestFilePath = Utilities.QualifyURL(strFormsPath, "InitialFormsManifest.xml");
                strXsltFilePath = Utilities.QualifyURL(strFormsPath, "SelectInitialForm.xslt");

                System.Xml.Xsl.XsltArgumentList objXsltArgs = null;
                if (m_refContentApi.ContentLanguage > 0)
                {
                    LanguageData language_data;
                    string strLang;
                    language_data = m_refSiteApi.GetLanguageById(m_refContentApi.ContentLanguage);
                    strLang = language_data.BrowserCode;
                    if (strLang != "")
                    {
                        objXsltArgs = new System.Xml.Xsl.XsltArgumentList();
                        objXsltArgs.AddParam("lang", string.Empty, strLang);
                    }
                }
                SelectInitialForm.Text = m_refContentApi.XSLTransform(strManifestFilePath, strXsltFilePath, true, true, objXsltArgs, false);
                if (!string.IsNullOrEmpty(SelectInitialForm.Text))
                {
                    if (SelectInitialForm.Text.Contains("Blank Form"))
                    {
                        SelectInitialForm.Text = SelectInitialForm.Text.Replace("Blank Form", m_refMsg.GetMessage("lbl Blank Form"));
                    }
                    if (SelectInitialForm.Text.Contains("Design a new form."))
                    {
                        SelectInitialForm.Text = SelectInitialForm.Text.Replace("Design a new form.", m_refMsg.GetMessage("lbl new form desc"));
                    }
                    if (SelectInitialForm.Text.Contains("Blank Survey"))
                    {
                        SelectInitialForm.Text = SelectInitialForm.Text.Replace("Blank Survey", m_refMsg.GetMessage("lbl Blank Survey"));
                    }
                    if (SelectInitialForm.Text.Contains("Standard Poll"))
                    {
                        SelectInitialForm.Text = SelectInitialForm.Text.Replace("Standard Poll", m_refMsg.GetMessage("lbl Standard Poll"));
                    }
                    if (SelectInitialForm.Text.Contains("Design a new survey."))
                    {
                        SelectInitialForm.Text = SelectInitialForm.Text.Replace("Design a new survey.", m_refMsg.GetMessage("lbl new survey desc"));
                    }
                    if (SelectInitialForm.Text.Contains("Design a new poll."))
                    {
                        SelectInitialForm.Text = SelectInitialForm.Text.Replace("Design a new poll.", m_refMsg.GetMessage("lbl new poll desc"));
                    }
                }
            }
    }
        /// <summary>
        /// Creates a language data item
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public Telerik.Sitefinity.Lifecycle.LanguageData CreateLanguageData(Guid id)
        {
            var languageData = new LanguageData(this.ApplicationName, id);
            ((IDataItem)languageData).Provider = this;

            if (id != Guid.Empty)
            {
                this.GetContext().Add(languageData);
            }
            return languageData;
        }
        private bool WriteSingleFile(LanguageData data, string dstPath)
        {
            var root = new JObject();

            var groups = data.GroupBy(o => o.Namespace);
            foreach (var g in groups)
            {
                var namespaces = g.Key.Split('.');

                var prev = new JObject(g.Select(o => new JProperty(o.Key, o.Value)));
                foreach (var ns in namespaces.Reverse())
                {
                    var temp = new JObject(new JProperty(ns, prev));
                    prev = temp;
                }

                // 各グループ要素を、全体のJSONオブジェクトにマージ
                root.Merge(prev);
            }

            File.WriteAllText(dstPath, root.ToString());

            return true;
        }
Beispiel #15
0
        internal int _lastItemId; //each LR0Item gets its unique ID, last assigned (max) Id is kept in this field

        internal GrammarDataBuilder(LanguageData language)
        {
            _language = language;
            _grammar  = _language.Grammar;
        }
Beispiel #16
0
    private void ViewCatalogToolBar(long entryCount)
    {
        System.Text.StringBuilder result = new System.Text.StringBuilder();
        string altText = "";
        long ParentId = _FolderData.ParentId;
        Ektron.Cms.Commerce.ProductType pProductType = new Ektron.Cms.Commerce.ProductType(_ContentApi.RequestInformationRef);
        bool bSelectedFound = false;
        bool bViewContent = System.Convert.ToBoolean("viewcontentbycategory" == _PageAction); // alternative is archived content
        bool bCommerceAdmin = true;
        bool bFolderAdmin = false;

        bCommerceAdmin = _ContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommerceAdmin);
        bFolderAdmin = System.Convert.ToBoolean(bFolderAdmin || bCommerceAdmin);

        if (bViewContent)
        {
            txtTitleBar.InnerHtml = _StyleHelper.GetTitleBar((string)(_MessageHelper.GetMessage("lbl view catalog") + " \"" + _FolderData.Name + "\"")) + "&nbsp;&nbsp;<img style=\'vertical-align:middle;\' src=\'" + _LocalizationApi.GetFlagUrlByLanguageID(_ContentLanguage) + "\' />";
            altText = _MessageHelper.GetMessage("Archive Content Title");
        }
        else
        {
            txtTitleBar.InnerHtml = _StyleHelper.GetTitleBar((string)(_MessageHelper.GetMessage("lbl view catalog archive") + " \"" + _FolderData.Name + "\"")) + "&nbsp;&nbsp;<img style=\'vertical-align:middle;\' src=\'" + _LocalizationApi.GetFlagUrlByLanguageID(_ContentLanguage) + "\' />";
            altText = _MessageHelper.GetMessage("view content title");
        }
        result.Append("<table><tr>" + "\r\n");
        if ((_PermissionData.CanAdd && bViewContent) || _PermissionData.IsReadOnly == true)
        {
            if (_PermissionData.CanAdd && bViewContent)
            {
                if (!bSelectedFound)
                {
                    _ContentType = System.Convert.ToInt32(_CMSContentType_AllTypes);
                }
            }
        }

        string buttonId;

        if ((_PermissionData.CanAdd || _PermissionData.CanAddFolders || bCommerceAdmin) && bViewContent)
        {
            buttonId = Guid.NewGuid().ToString();

            result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'file\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'file\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"new\">" + _MessageHelper.GetMessage("lbl New") + "</span></td>");
        }
        if ((_PermissionData.CanAdd) || _PermissionData.IsReadOnly || bCommerceAdmin)
        {
            buttonId = Guid.NewGuid().ToString();

            result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'view\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'view\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"folderView\">" + _MessageHelper.GetMessage("lbl View") + "</span></td>");
        }
        if (bViewContent && (_PermissionData.IsAdmin || bFolderAdmin || bCommerceAdmin) || (_PermissionData.CanDelete))
        {
            buttonId = Guid.NewGuid().ToString();

            result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'delete\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'delete\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"delete\">" + _MessageHelper.GetMessage("lbl Delete") + "</span></td>");
        }

        buttonId = Guid.NewGuid().ToString();

        result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'action\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'action\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"action\">" + _MessageHelper.GetMessage("lbl Action") + "</span></td>");

        if (_EnableMultilingual == 1)
        {
            SiteAPI m_refsite = new SiteAPI();
            LanguageData[] language_data = new LanguageData[1];
            language_data = m_refsite.GetAllActiveLanguages();

        }
        List<ProductTypeData> active_prod_list = new List<ProductTypeData>();
        active_prod_list = pProductType.GetFolderProductTypeList(_FolderData.Id);

        bool smartFormsRequired = System.Convert.ToBoolean(!Utilities.IsNonFormattedContentAllowed(active_prod_list.ToArray()));
        bool canAddAssets = System.Convert.ToBoolean((_PermissionData.CanAdd || _PermissionData.CanAddFolders) && bViewContent);

        result.Append(StyleHelper.ActionBarDivider);

        result.Append("<td>");
        result.Append(_StyleHelper.GetHelpButton(_PageAction, ""));
        result.Append("</td>");
        result.Append("</tr></table>");

        result.Append("<script type=\"text/javascript\">" + Environment.NewLine);

        result.Append("    var filemenu = new Menu( \"file\" );" + Environment.NewLine);
        if (_PermissionData.CanAddFolders || bCommerceAdmin)
        {
            result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/folderGreen.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl commerce catalog") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=AddSubFolder&type=catalog&id=" + _Id + "\' } );" + Environment.NewLine);
            result.Append("    filemenu.addBreak();" + Environment.NewLine);
        }

        if (_PermissionData.CanAdd)
        {
            if (active_prod_list.Count > 0)
            {
                int k;
                for (k = 0; k <= active_prod_list.Count - 1; k++)
                {
                    if (active_prod_list[k].Id != 0)
                    {

                        result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/ui/icons/");

                        if (active_prod_list[k].EntryClass == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct)
                        {

                            result.Append("bookGreen.png");
                        }
                        else if (active_prod_list[k].EntryClass == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Kit)
                        {

                            result.Append("box.png");
                        }
                        else if (active_prod_list[k].EntryClass == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Bundle)
                        {

                            result.Append("package.png");
                        }
                        else
                        {

                            result.Append("brick.png");
                        }

                        result.Append("\' />&nbsp;&nbsp;" + active_prod_list[k].Title + "\", function() { " + _StyleHelper.GetCatalogAddAnchorType(_Id, active_prod_list[k].Id) + " } );" + Environment.NewLine);
                    }
                }
            }
        }

        if (_PermissionData.CanAdd || _PermissionData.CanAddFolders)
        {
            result.Append("    MenuUtil.add( filemenu );" + Environment.NewLine);
        }

        result.Append("    var viewmenu = new Menu( \"view\" );" + Environment.NewLine);
        result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/ui/icons/folderGreenView.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl All Types"), -1, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes) + "\", function() { UpdateView(" + _CMSContentType_AllTypes + "); } );" + Environment.NewLine);
        result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "Images/ui/icons/brick.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl commerce products"), 0, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes) + "\", function() { UpdateView(" + Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product) + "); } );" + Environment.NewLine);
        result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/ui/icons/box.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl commerce kits"), 2, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes) + "\", function() { UpdateView(" + Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Kit) + "); } );" + Environment.NewLine);
        result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/ui/icons/package.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl commerce bundles"), 3, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes) + "\", function() { UpdateView(" + Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Bundle) + "); } );" + Environment.NewLine);
        result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/ui/icons/bookGreen.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl commerce subscriptions"), 4, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes) + "\", function() { UpdateView(" + Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct) + "); } );" + Environment.NewLine);

        if (((_PermissionData.CanAdd) && bViewContent) || _PermissionData.IsReadOnly == true)
        {
            AddLanguageMenu(result);

            if (bViewContent)
            {
                result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/contentArchived.png" + "\' />&nbsp;&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl archive entry title") + "\", function() { window.location.href = \'content.aspx?action=" + _NextActionType + "&id=" + _Id + "&LangType=" + _ContentLanguage + ((Ektron.Cms.Common.EkConstants.IsAssetContentType(Convert.ToInt64(_ContentTypeSelected), false)) ? ("&" + _ContentTypeUrlParam + "=" + Ektron.Cms.Common.EkConstants.MakeArchiveAssetContentType(Convert.ToInt64(_ContentTypeSelected))) : ((Ektron.Cms.Common.EkConstants.IsArchiveAssetContentType(Convert.ToInt64(_ContentTypeSelected))) ? ("&" + _ContentTypeUrlParam + "=" + Ektron.Cms.Common.EkConstants.MakeNonArchiveAssetContentType(Convert.ToInt64(_ContentTypeSelected))) : "")) + "\' } );" + Environment.NewLine);
            }
            else
            {
                result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/properties.png" + "\' />&nbsp;&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl catalog view entry") + "\", function() { window.location.href = \'content.aspx?action=" + _NextActionType + "&id=" + _Id + "&LangType=" + _ContentLanguage + ((Ektron.Cms.Common.EkConstants.IsAssetContentType(Convert.ToInt64(_ContentTypeSelected), false)) ? ("&" + _ContentTypeUrlParam + "=" + Ektron.Cms.Common.EkConstants.MakeArchiveAssetContentType(Convert.ToInt64(_ContentTypeSelected))) : ((Ektron.Cms.Common.EkConstants.IsArchiveAssetContentType(Convert.ToInt64(_ContentTypeSelected))) ? ("&" + _ContentTypeUrlParam + "=" + Ektron.Cms.Common.EkConstants.MakeNonArchiveAssetContentType(Convert.ToInt64(_ContentTypeSelected))) : "")) + "\' } );" + Environment.NewLine);
            }
            if (((_PermissionData.CanEditFolders || _PermissionData.CanEditApprovals) && bViewContent) || bFolderAdmin)
            {
                result.Append("    viewmenu.addBreak();" + Environment.NewLine);
                result.Append("    viewmenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/properties.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl catalog Properties") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=ViewFolder&id=" + _Id + "\' } );" + Environment.NewLine);
            }
            result.Append("    MenuUtil.add( viewmenu );" + Environment.NewLine);
            result.Append("    var deletemenu = new Menu( \"delete\" );" + Environment.NewLine);
            if ((_PermissionData.CanDeleteFolders || bCommerceAdmin) && bViewContent && _Id != 0)
            {
                result.Append("    deletemenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/folderGreenDelete.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl this catalog") + "\", function() { if( ConfirmFolderDelete(" + _Id + ") ) { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=DoDeleteFolder&id=" + _Id + "&ParentID=" + ParentId + "\'; }} );" + Environment.NewLine);
            }
            if ((entryCount > 0) && (bViewContent && (_PermissionData.IsAdmin || bFolderAdmin) || _PermissionData.CanDelete))
            {
                if (Convert.ToString(_EnableMultilingual) == "1" && _ContentLanguage < 1)
                {
                    result.Append("    deletemenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/brickDelete.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl catalog del entry") + "\", function() { alert(\'A language must be selected!\'); } );" + Environment.NewLine);
                }
                else
                {
                    //44595 -  Delete content from the archive view should show up archived list rather than live content list.
                    if (_PageAction == "viewarchivecontentbycategory")
                    {
                        result.Append("    deletemenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/brickDelete.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl catalog del entry") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=DeleteContentByCategory&id=" + _Id + "&showarchive=true\'; } );" + Environment.NewLine);
                    }
                    else
                    {
                        result.Append("    deletemenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/brickDelete.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl catalog del entry") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=DeleteContentByCategory&id=" + _Id + "\'; } );" + Environment.NewLine);
                    }
                }
            }
            result.Append("    MenuUtil.add( deletemenu );" + Environment.NewLine);
        }
        result.Append("    var actionmenu = new Menu( \"action\" );" + Environment.NewLine);
        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/magnifier.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("generic Search") + "\", function() { window.location.href = \'productsearch.aspx?LangType=" + _ContentLanguage + "&action=showdlg&folderid=" + _Id + "\'; } );" + Environment.NewLine);

        result.Append("    actionmenu.addBreak();" + Environment.NewLine);

        if (_CheckedInOrApproved && bViewContent && (_PermissionData.IsAdmin || IsFolderAdmin() || IsCopyOrMoveAdmin()) && (_PermissionData.CanAdd || _PermissionData.CanEdit))
        {
            if ((Convert.ToString(_EnableMultilingual) == "1") && (_ContentLanguage < 1))
            {
                result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/cut.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl cut") + "\", function() { alert(\'A language must be selected!\'); } );" + Environment.NewLine);
                result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/contentCopy.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl copy") + "\", function() { alert(\'A language must be selected!\'); } );" + Environment.NewLine);
            }
            else
            {
                result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/cut.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl cut") + "\", function() { setClipBoard(); } );" + Environment.NewLine);
                result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/contentCopy.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl copy") + "\", function() { setCopyClipBoard(); }) ;" + Environment.NewLine);
            }
        }

        result.Append("    MenuUtil.add( actionmenu );" + Environment.NewLine);
        result.Append("    </script>" + Environment.NewLine);
        result.Append("" + Environment.NewLine);
        htmToolBar.InnerHtml = result.ToString();
    }
        private void OnGUI()
        {
            _description = new GUIStyle(GUI.skin.label)
            {
                fontStyle = FontStyle.Italic, wordWrap = true
            };

            GUILayout.Space(20);

            GUILayout.BeginHorizontal("BOX");

            if (_creatingNewData)
            {
                if (GUILayout.Button("Create"))
                {
                    if (_newName == "" || string.IsNullOrWhiteSpace(_newName) || _filterName == "" || string.IsNullOrWhiteSpace(_filterName))
                    {
                        Debug.LogError("The name and filter name can't be null.");
                        return;
                    }

                    if (Resources.LoadAll <LanguageData>("LanguagePacks").Select(x => x.name).Any(x => x == _newName))
                    {
                        Debug.LogError($"The given name ({_newName}) is already taken.");
                        return;
                    }

                    LocalizationEditorUtilities.CreateLanguageData(_newName, _filterName, x =>
                    {
                        _cacheData.AddRange(x.answerNodeData);
                        _cacheData.AddRange(x.dropdownData);
                        _cacheData.AddRange(x.textData);
                        _cacheData.AddRange(x.textNodeData);

                        _cacheData = _cacheData.OrderBy(y => y.id).ToList();
                    });
                    _creatingNewData = false;
                    _cacheData       = new List <ParadoxLocalizationData>();
                    _startElement    = _endElement = 0;
                    _objectNames     = new List <string>();

                    Repaint();
                }

                if (GUILayout.Button("Cancel"))
                {
                    _creatingNewData = false;
                }
            }

            else if (dataPack == null)
            {
                if (GUILayout.Button("Create Language data"))
                {
                    _creatingNewData = true;
                }

                if (GUILayout.Button("Load Language data"))
                {
                    LocalizationEditorUtilities.LoadLanguageData(x =>
                    {
                        _cacheData.AddRange(x.answerNodeData);
                        _cacheData.AddRange(x.dropdownData);
                        _cacheData.AddRange(x.textData);
                        _cacheData.AddRange(x.textNodeData);

                        _objectNames.AddRange(x.objectsName);

                        _endElement   = _cacheData.Count - 5 <= 0 ? _cacheData.Count : 5;
                        _startElement = 0;
                    });
                }
            }

            else if (_toDelete)
            {
                if (GUILayout.Button("Delete"))
                {
                    _cacheData.Clear();
                    _objectNames.Clear();
                    _startElement = _endElement = 0;
                    LocalizationEditorUtilities.DeleteLanguage();
                    _toDelete = false;
                    Repaint();
                }

                if (GUILayout.Button("Cancel"))
                {
                    _toDelete = false;
                }
            }

            else if (_exportOptions)
            {
                if (GUILayout.Button("Import JSON"))
                {
                    LocalizationEditorUtilities.ImportJSONLanguageData(ImportJSON);
                    _exportOptions = false;
                }

                if (GUILayout.Button("Export JSON"))
                {
                    LocalizationEditorUtilities.ExportJSONLanguageData(dataPack);
                    _exportOptions = false;
                }

                if (GUILayout.Button("Return"))
                {
                    _exportOptions = false;
                }
            }

            else
            {
                if (GUILayout.Button("Save Language data"))
                {
                    var tempString = new List <string>(_objectNames);

                    dataPack.answerNodeData = _cacheData.Where(x => x.filterType == ELanguageGraphFilter.AnswerNode).Select(x => x as ParadoxAnswerNodeLocalizationData).ToList();
                    dataPack.dropdownData   = _cacheData.Where(x => x.filterType == ELanguageGraphFilter.Dropdown).Select(x => x as ParadoxDropdownLocalizationData).ToList();
                    dataPack.textData       = _cacheData.Where(x => x.filterType == ELanguageGraphFilter.Text).Select(x => x as ParadoxTextLocalizationData).ToList();
                    dataPack.textNodeData   = _cacheData.Where(x => x.filterType == ELanguageGraphFilter.TextNode).Select(x => x as ParadoxTextNodeLocalizationData).ToList();

                    dataPack.objectsName = tempString;

                    EditorUtility.SetDirty(dataPack);
                    AssetDatabase.SaveAssets();
                    AssetDatabase.Refresh();
                }

                if (GUILayout.Button("Delete Language data"))
                {
                    _toDelete = true;
                }

                if (GUILayout.Button("Export/Import"))
                {
                    _exportOptions = true;
                }
            }

            GUILayout.EndHorizontal();

            if (dataPack != null)
            {
                GUILayout.Space(5);

                if (GUILayout.Button("Unload Language data"))
                {
                    dataPack       = null;
                    _startElement  = _endElement = 0;
                    _exportOptions = false;
                    _cacheData.Clear();
                    _objectNames.Clear();
                    Repaint();
                }
            }

            GUILayout.Space(10);

            EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black);


            if (_creatingNewData)
            {
                GUILayout.Space(10);

                GUILayout.Label(new GUIContent("Name:", "Name of the file"));
                _newName = GUILayout.TextField(_newName);

                GUILayout.Label(new GUIContent("Filter name:", "Language type of this data."));
                _filterName = GUILayout.TextField(_filterName);
            }

            GUILayout.Space(15);

            if (dataPack == null)
            {
                DefaultView();
            }
            else
            {
                DataView();
            }


            GUILayout.Space(15);
        }
Beispiel #18
0
    private void ViewContentByCategoryToolBar()
    {
        System.Text.StringBuilder result = new System.Text.StringBuilder();
        string altText = "";
        long ParentId = _FolderData.ParentId;
        int count = 0;
        int lAddMultiType = 0;
        bool bSelectedFound = false;
        bool bViewContent = System.Convert.ToBoolean("viewcontentbycategory" == _PageAction); // alternative is archived content
        Ektron.Cms.PageBuilder.WireframeModel wireframeModel = new Ektron.Cms.PageBuilder.WireframeModel();

        if (bViewContent)
        {
            txtTitleBar.InnerHtml = _StyleHelper.GetTitleBar((string)(_MessageHelper.GetMessage("view contents of folder msg") + " \"" + _FolderData.Name + "\"")) + "&nbsp;&nbsp;<img style=\'vertical-align:middle;\' src=\'" + _LocalizationApi.GetFlagUrlByLanguageID(_ContentLanguage) + "\' />";
            altText = _MessageHelper.GetMessage("Archive Content Title");
        }
        else
        {
            txtTitleBar.InnerHtml = _StyleHelper.GetTitleBar((string)(_MessageHelper.GetMessage("view archive content title") + " \"" + _FolderData.Name + "\"")) + "&nbsp;&nbsp;<img style=\'vertical-align:middle;\' src=\'" + _LocalizationApi.GetFlagUrlByLanguageID(_ContentLanguage) + "\' />";
            altText = _MessageHelper.GetMessage("view content title");
        }
        result.Append("<table><tr>" + "\r\n");
        if ((_PermissionData.CanAdd && bViewContent) || _PermissionData.IsReadOnly == true)
        {

            if (_PermissionData.CanAdd && bViewContent)
            {
                if (!bSelectedFound)
                {
                    _ContentType = System.Convert.ToInt32(_CMSContentType_AllTypes);
                }
            }
        }

        string buttonId;

        if ((_PermissionData.CanAdd || _PermissionData.CanAddFolders) && bViewContent)
        {
            buttonId = Guid.NewGuid().ToString();

            result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'file\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'file\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"new\">" + _MessageHelper.GetMessage("lbl New") + "</span></td>");
        }

        if ((_PermissionData.CanAdd) || _PermissionData.IsReadOnly)
        {
            buttonId = Guid.NewGuid().ToString();

            result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'view\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'view\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"folderView\">" + _MessageHelper.GetMessage("lbl View") + "</span></td>");
        }

        int totalPages = 1;
        if (_PageAction == "viewarchivecontentbycategory")
        {
            // no comparable method; use member variable holding page count when viewing archived items (maybe we should always do this and drop the api hit of doing it again?)
            totalPages = _PagingTotalPagesNumber;
        }
        else
        {
            _ContentApi.GetChildContentByFolderId(_Id, false, "name", 1, ref totalPages, 1);
        }

        if ((_PermissionData.CanDeleteFolders && bViewContent && _Id != 0) || ((bViewContent && (_PermissionData.IsAdmin || IsFolderAdmin()) || _PermissionData.CanDelete) && totalPages > 0))
        {
            buttonId = Guid.NewGuid().ToString();

            result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'delete\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'delete\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"delete\">" + _MessageHelper.GetMessage("lbl Delete") + "</span></td>");
        }

        buttonId = Guid.NewGuid().ToString();

        result.Append("<td class=\"menuRootItem\" onclick=\"MenuUtil.use(event, \'action\', \'" + buttonId + "\');\" onmouseover=\"this.className=\'menuRootItemSelected\';MenuUtil.use(event, \'action\', \'" + buttonId + "\');\" onmouseout=\"this.className=\'menuRootItem\'\"><span id=\"" + buttonId + "\" class=\"action\">" + _MessageHelper.GetMessage("lbl Action") + "</span></td>");

        if (_EnableMultilingual == 1)
        {
            SiteAPI m_refsite = new SiteAPI();
            LanguageData[] language_data = new LanguageData[1];
            language_data = m_refsite.GetAllActiveLanguages();
        }
        XmlConfigData[] active_xml_list;
        active_xml_list = _ContentApi.GetEnabledXmlConfigsByFolder(_FolderData.Id);
        bool smartFormsRequired = System.Convert.ToBoolean(!Utilities.IsNonFormattedContentAllowed(active_xml_list));
        bool canAddAssets = System.Convert.ToBoolean((_PermissionData.CanAdd || _PermissionData.CanAddFolders) && bViewContent);
        if (_ContentLanguage < 1 || _FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.Blog) || _FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum) || _FolderData.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionBoard) || smartFormsRequired == true || canAddAssets == false)
        {
        }
        else
        {
            if (Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(_ContentApi.RequestInformationRef, Feature.DocumentManagement, false))
            {
                if (Request.Browser.Browser == "IE" && Request.UserAgent.Contains("Windows NT 6.0") && Request.ServerVariables["HTTPS"] == "on") //Vista IE Https then take the user to file upload since vista https is not supported by webdav
                {
                    result.Append("<td id='DmsMenu'>&nbsp;<a class=\"ek_thickbox " + StyleHelper.MergeCssClasses(new string[2] { StyleHelper.SecondaryFunctionCssClass, StyleHelper.AddAssetButtonCssClass }) + "\" href=\"" + _ContentApi.AppPath + "edit.aspx?id=" + _FolderData.Id + "&ContType=103&type=add&close=false&lang_id=" + _ContentLanguage.ToString() + "title=\"" + _MessageHelper.GetMessage("lbl file upload") + "\"><img id=\"DeskTopHelp\" title= \"" + _MessageHelper.GetMessage("alt add assets text") + "\" border=\"0\" src=\"images/UI/Icons/Import.png\"/></a>&nbsp;</td>");
                }
                else
                {
                    //result.Append("<td id='DmsMenu'>&nbsp;<a class=\"ek_thickbox " + StyleHelper.MergeCssClasses(new string[2] { StyleHelper.SecondaryFunctionCssClass, StyleHelper.AddAssetButtonCssClass }) + "\" href=\"" + _ContentApi.AppPath + "DragDropCtl.aspx?id=" + _Id.ToString() + "&lang_id=" + _ContentLanguage.ToString() + "&EkTB_iframe=true&height=120&width=500&refreshCaller=true&scrolling=false&modal=true\" class=\"ek_thickbox\" title=\"" + _MessageHelper.GetMessage("document management system") + "\"><img id=\"DeskTopHelp\" title= \"" + _MessageHelper.GetMessage("alt add assets text") + "\" border=\"0\" src=\"images/UI/Icons/Import.png\"/></a>&nbsp;</td>");
                    result.Append("<td id='DmsMenu'>&nbsp;<a class=\"ek_thickbox " + StyleHelper.MergeCssClasses(new string[2] { StyleHelper.SecondaryFunctionCssClass, StyleHelper.AddAssetButtonCssClass }) + "\" href=\"#\" onclick=\"ektb_show('" + _MessageHelper.GetMessage("document management system") + "', '" + _ContentApi.AppPath + "DragDropCtl.aspx?id=" + _Id.ToString() + "&lang_id=" + _ContentLanguage.ToString() + "&height=120&width=500&refreshCaller=true&scrolling=false&modal=true&EkTB_iframe=true', null, '', false);\" class=\"ek_thickbox\" title=\"" + _MessageHelper.GetMessage("document management system") + "\"><img id=\"DeskTopHelp\" title= \"" + _MessageHelper.GetMessage("alt add assets text") + "\" border=\"0\" src=\"images/UI/Icons/Import.png\"/></a>&nbsp;</td>");
                }
            }
        }

        result.Append(StyleHelper.ActionBarDivider);

        result.Append("<td>");
        result.Append(_StyleHelper.GetHelpButton(_PageAction, ""));
        result.Append("</td>");
        result.Append("</tr></table>");

        result.Append("<script type=\"text/javascript\">" + Environment.NewLine);
        result.Append("    var filemenu = new Menu( \"file\" );" + Environment.NewLine);

        if (_PermissionData.CanAddFolders || (_ContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommerceAdmin) && Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(_ContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.eCommerce)))
        {

            if (_PermissionData.CanAddFolders)
            {

                if (!_FolderData.IsCommunityFolder)
                {
                    result.Append("    filemenu.addItem(\"&nbsp;<img src=\'images/UI/Icons/folder.png\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl Folder") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&type=folder&action=AddSubFolder&id=" + _Id + "\' } );" + Environment.NewLine);
                }

                result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/tree/folderBlogClosed.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl Blog") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=AddSubFolder&type=blog&id=" + _Id + "\' } );" + Environment.NewLine);
                result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/folderBoard.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl Discussion Board") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=AddSubFolder&type=discussionboard&id=" + _Id + "\' } );" + Environment.NewLine);
                result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/folderCommunity.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl Community Folder") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=AddSubFolder&type=communityfolder&id=" + _Id + "\' } );" + Environment.NewLine);
                result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/ui/icons/tree/folderCalendarClosed.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl Calendar Folder") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=AddSubFolder&type=calendar&id=" + _Id + "\' } );" + Environment.NewLine);

                if (Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(_ContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.eCommerce))
                {
                    result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/folderGreen.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl commerce catalog") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=AddSubFolder&type=catalog&id=" + _Id + "\' } );" + Environment.NewLine);
                }
                if (_Id == 0 && LicenseManager.IsFeatureEnable(_ContentApi.RequestInformationRef, Feature.MultiSite)) //domain folder
                {
                    result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/folderSite.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl site Folder") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&type=site&action=AddSubFolder&id=" + _Id + "\' } );" + Environment.NewLine);
                }
                result.Append("    filemenu.addBreak();" + Environment.NewLine);

            }
            else
            {

                result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/folderGreen.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl commerce catalog") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=AddSubFolder&type=catalog&id=" + _Id + "\' } );" + Environment.NewLine);
                result.Append("    filemenu.addBreak();" + Environment.NewLine);

            }

        }

        if (_PermissionData.CanAdd)
        {
            TemplateData[] active_templates;
            active_templates = _ContentApi.GetEnabledTemplatesByFolder(_FolderData.Id);
            bool foundWireframe = false;
            bool foundNormal = false;
            bool foundmasterlayout = false;

            foreach (TemplateData t in active_templates)
            {
                if (t.SubType == Ektron.Cms.Common.EkEnumeration.TemplateSubType.Wireframes)
                {
                    foundWireframe = true;
                }
                else if (t.SubType == Ektron.Cms.Common.EkEnumeration.TemplateSubType.MasterLayout)
                {
                    foundmasterlayout = true;
                }
                else
                {
                    foundNormal = true;
                }
                if (foundWireframe && foundNormal && foundmasterlayout)
                {
                    break;
                }
            }
            if (Utilities.IsNonFormattedContentAllowed(active_xml_list) && foundNormal)
            {
                result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/contentHtml.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl html content") + "\", function() { " + _StyleHelper.GetAddAnchorByContentType(_Id, Ektron.Cms.Common.EkConstants.CMSContentType_Content, true) + " } );" + Environment.NewLine);
                if (((!_IsMac) && (!(_AssetInfoData == null))) || ("ContentDesigner" == _SelectedEditControl))
                {
                    result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/contentForm.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl html formsurvey") + "\", function() { " + _StyleHelper.GetAddAnchorByContentType(_Id, Ektron.Cms.Common.EkConstants.CMSContentType_Forms, false) + " } );" + Environment.NewLine);
                }
            }

            if (foundWireframe || foundmasterlayout) //folder has a wireframe associated
            {
                // Register JS
                Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronJS);
                Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronXmlJS);
                Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronThickBoxJS);
                Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronModalJS);
                Ektron.Cms.API.JS.RegisterJS(this, _ContentApi.AppPath + "PageBuilder/Wizards/js/ektron.pagebuilder.wizards.js", "EktronPageBuilderWizardsJS");
                Ektron.Cms.API.JS.RegisterJS(this, _ContentApi.AppPath + "PageBuilder/Wizards/js/wizardResources.aspx", "EktronPageBuilderWizardResourcesJS");

                // register necessary CSS
                Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronModalCss);
                Ektron.Cms.API.Css.RegisterCss(this, _ContentApi.AppPath + "PageBuilder/Wizards/css/ektron.pagebuilder.wizards.css", "EktronPageBuilderWizardsCSS");

                if (foundWireframe || foundmasterlayout)
                {
                    string layoutstr;
                    layoutstr = "tmpContLang = AddNewPage(); if (tmpContLang > 0) { Ektron.PageBuilder.Wizards.showAddPage({mode: \'add\', folderId: " + _FolderData.Id + ", language: tmpContLang, fromWorkarea: true}) };";
                    result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/application/layout_content.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl pagebuilder layouts") + "\", function() { " + layoutstr + " } );" + Environment.NewLine);
                }

                if (foundWireframe && _ContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CreateMasterLayout))
                {
                    string masterstr;
                    masterstr = "tmpContLang = AddNewPage(); if (tmpContLang > 0) { Ektron.PageBuilder.Wizards.showAddMasterPage({mode: \'add\', folderId: " + _FolderData.Id + ", language: tmpContLang, fromWorkarea: true}) };";
                    result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/application/layout_content.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl pagebuilder master layouts") + "\", function() { " + masterstr + " } );" + Environment.NewLine);
                }
            }

            if (!_IsMac || ("ContentDesigner" == _SelectedEditControl))
            {
                if ((foundWireframe && foundNormal) || foundNormal)
                {
                    if (active_xml_list.Length > 0 && Utilities.IsNonFormattedContentAllowed(active_xml_list))
                    {
                        if ((active_xml_list.Length == 1 && active_xml_list[0] == null) || (active_xml_list.Length == 1 && active_xml_list[0].Id == 0))
                        {

                        }
                        else
                        {
                            result.Append("    var contentTypesMenu = new Menu( \"contentTypes\" );" + Environment.NewLine);
                            result.Append("    filemenu.addBreak();" + Environment.NewLine);
                            int k;
                            for (k = 0; k <= active_xml_list.Length - 1; k++)
                            {
                                if (active_xml_list[k].Id != 0)
                                {
                                    result.Append("    contentTypesMenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + _ContentApi.AppPath + "images/ui/icons/contentsmartform.png" + "\'/>&nbsp;&nbsp;" + active_xml_list[k].Title + "\", function() { " + _StyleHelper.GetTypeOverrideAddAnchor(_Id, active_xml_list[k].Id, Ektron.Cms.Common.EkConstants.CMSContentType_Content) + " } );" + Environment.NewLine);
                                }
                            }
                            //result.Append("    contentTypesMenu.addBreak();" & Environment.NewLine)
                            result.Append("    filemenu.addMenu(\"&nbsp;<img valign=\'middle\' src=\'" + _ContentApi.AppPath + "images/ui/icons/contentsmartform.png" + "\'/>&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl smart form") + "\", contentTypesMenu);" + Environment.NewLine);
                        }

                    }
                    else if (active_xml_list.Length > 0 && !Utilities.IsNonFormattedContentAllowed(active_xml_list))
                    {
                        result.Append("    filemenu.addBreak();" + Environment.NewLine);
                        int k;
                        for (k = 0; k <= active_xml_list.Length - 1; k++)
                        {
                            if (active_xml_list[k].Id != 0)
                            {
                                result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + _ContentApi.AppPath + "images/ui/icons/contentsmartform.png" + "\'/>&nbsp;&nbsp;" + active_xml_list[k].Title + "\", function() { " + _StyleHelper.GetTypeOverrideAddAnchor(_Id, active_xml_list[k].Id, Ektron.Cms.Common.EkConstants.CMSContentType_Content) + " } );" + Environment.NewLine);
                            }
                        }
                    }
                }
                result.Append("    filemenu.addBreak();" + Environment.NewLine);
            }

            //If ((Not m_bIsMac) AndAlso (Not (IsNothing(asset_data))) AndAlso Utilities.IsNonFormattedContentAllowed(active_xml_list)) Then
            if ((!(_AssetInfoData == null)) && Utilities.IsNonFormattedContentAllowed(active_xml_list))
            {
                if (_AssetInfoData.Length > 0)
                {
                    for (count = 0; count <= _AssetInfoData.Length - 1; count++)
                    {
                        if (_ManagedAsset_Min <= _AssetInfoData[count].TypeId && _AssetInfoData[count].TypeId <= _ManagedAsset_Max)
                        {
                            if ("*" == _AssetInfoData[count].PluginType)
                            {
                                lAddMultiType = _AssetInfoData[count].TypeId;
                            }
                        }
                    }
                    string imgsrc = string.Empty;
                    string txtCommName = string.Empty;
                    if (Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(_ContentApi.RequestInformationRef, Feature.DocumentManagement, false))
                    {

                        imgsrc = "&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/contentDMSDocument.png" + "\' />&nbsp;&nbsp;";
                        txtCommName = _MessageHelper.GetMessage("lbl dms documents");
                        result.Append("filemenu.addItem(\"" + imgsrc + "" + txtCommName + "\", function() { " + _StyleHelper.GetAddAnchorByContentType(_Id, 103, false) + " } );" + Environment.NewLine);
                        result.Append(" if (ShowMultipleUpload() && CheckSTSUpload()) {");
                        imgsrc = "&nbsp;<img valign=\'middle\' src=\'" + "images/ui/icons/contentStack.png" + "\' />&nbsp;&nbsp;";
                        txtCommName = _MessageHelper.GetMessage("lbl multiple documents");
                        if (Request.Cookies["DMS_Office_ver"] == null || string.IsNullOrEmpty(Request.Cookies["DMS_Office_ver"].Value))
                        {
                            result.Append("filemenu.addItem(\"" + imgsrc + "" + txtCommName + "\", function() { " + _StyleHelper.GetAddAnchorByContentType(_Id, 9875, false) + " } );" + Environment.NewLine);
                        }
                        else
                        {
                            result.Append("filemenu.addItem(\"" + imgsrc + "" + txtCommName + "\", function() { " + _StyleHelper.GetAddAnchorByContentType(_Id, 9876, false) + " } );" + Environment.NewLine);
                        }

                        result.Append("}");
                    }
                }
            }
        }
        if (CanDoCollections || CanDoMenus)
        {
            result.Append("    filemenu.addBreak();" + Environment.NewLine);

            if (CanDoCollections)
            {
                result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/collection.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl Collection") + "\", function() { window.location.href = \'collections.aspx?LangType=" + _ContentLanguage + "&action=Add&folderid=" + _Id + "\' } );" + Environment.NewLine);
            }

            if (CanDoMenus)
            {
                result.Append("    filemenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/menu.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl Menu") + "\", function() { window.location.href = \'collections.aspx?LangType=" + _ContentLanguage + "&action=AddMenu&back=" + EkFunctions.UrlEncode("content.aspx?action=ViewContentByCategory&id=" + _Id) + "&folderid=" + _Id + "\' } );" + Environment.NewLine);
            }

            result.Append("" + Environment.NewLine);
        }

        if (_PermissionData.CanAdd || _PermissionData.CanAddFolders)
        {
            result.Append("    MenuUtil.add( filemenu );" + Environment.NewLine);
        }

        result.Append("    var viewmenu = new Menu( \"view\" );" + Environment.NewLine);

        if (bViewContent)
        {
            result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/folderView.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl All Types"), 98, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes) + "\", function() { UpdateView(" + _CMSContentType_AllTypes + "); } );" + Environment.NewLine);
            result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/contentHtml.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl html content"), Ektron.Cms.Common.EkConstants.CMSContentType_Content, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.Content) + "\", function() { UpdateViewwithSubtype(" + Ektron.Cms.Common.EkConstants.CMSContentType_Content + ", " + (int)Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.Content + ",false" + "); } );" + Environment.NewLine);
            if (((!_IsMac) && (!(_AssetInfoData == null))) || ("ContentDesigner" == _SelectedEditControl))
            {
                result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/contentForm.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl html formsurvey"), Ektron.Cms.Common.EkConstants.CMSContentType_Forms, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes) + "\", function() { UpdateView(" + Ektron.Cms.Common.EkConstants.CMSContentType_Forms + "); } );" + Environment.NewLine);
            }
            if (wireframeModel.FindByFolderID(_FolderData.Id).Length > 0) //folder has a wireframe associated
            {
                result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/application/layout_content.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl pagebuilder layouts"), Ektron.Cms.Common.EkConstants.CMSContentType_Content, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData) + "\", function() { UpdateViewwithSubtype(" + Ektron.Cms.Common.EkConstants.CMSContentType_Content + ", " + (int)Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData + ",false " + "); } );" + Environment.NewLine);
                result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/application/layout_content.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl pagebuilder master layouts"), Ektron.Cms.Common.EkConstants.CMSContentType_Content, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) + "\", function() { UpdateViewwithSubtype(" + Ektron.Cms.Common.EkConstants.CMSContentType_Content + ", " + (int)Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData + ",false " + "); } );" + Environment.NewLine);
            }
        }
        else
        {
            result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/folderView.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl All Types"), 98, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes) + "\", function() { UpdateArchiveView(" + _CMSContentType_AllTypes + ",true " + "); } );" + Environment.NewLine);
            result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/contentHtml.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl html content"), Ektron.Cms.Common.EkConstants.CMSContentType_Content, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.Content) + "\", function() { UpdateViewwithSubtype(" + Ektron.Cms.Common.EkConstants.CMSContentType_Content + ", " + (int)Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.Content + ",true " + "); } );" + Environment.NewLine);
            if (((!_IsMac) && (!(_AssetInfoData == null))) || ("ContentDesigner" == _SelectedEditControl))
            {
                result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/contentForm.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl html formsurvey"), Ektron.Cms.Common.EkConstants.CMSContentType_Forms, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes) + "\", function() { UpdateArchiveView(" + Ektron.Cms.Common.EkConstants.CMSContentType_Forms + ",true " + "); } );" + Environment.NewLine);
            }
            if (wireframeModel.FindByFolderID(_FolderData.Id).Length > 0) //folder has a wireframe associated
            {
                result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/application/layout_content.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl pagebuilder layouts"), Ektron.Cms.Common.EkConstants.CMSContentType_Content, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData) + "\", function() { UpdateViewwithSubtype(" + Ektron.Cms.Common.EkConstants.CMSContentType_Content + ", " + (int)Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData + ",true " + "); } );" + Environment.NewLine);
                result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/application/layout_content.png" + "\' />&nbsp;&nbsp;" + MakeBold(_MessageHelper.GetMessage("lbl pagebuilder master layouts"), Ektron.Cms.Common.EkConstants.CMSContentType_Content, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) + "\", function() { UpdateViewwithSubtype(" + Ektron.Cms.Common.EkConstants.CMSContentType_Content + ", " + (int)Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData + ",true " + "); } );" + Environment.NewLine);
            }
        }

        result.Append("    viewmenu.addBreak();" + Environment.NewLine);
        if (((_PermissionData.CanAdd) && bViewContent) || _PermissionData.IsReadOnly == true)
        {
            if ((_AssetInfoData != null) && Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(_ContentApi.RequestInformationRef, Feature.DocumentManagement, false))
            {
                if (_AssetInfoData.Length > 0)
                {
                    for (count = 0; count <= _AssetInfoData.Length - 1; count++)
                    {
                        if (_ManagedAsset_Min <= _AssetInfoData[count].TypeId && _AssetInfoData[count].TypeId <= _ManagedAsset_Max)
                        {
                            if ("*" == _AssetInfoData[count].PluginType)
                            {
                                lAddMultiType = _AssetInfoData[count].TypeId;
                            }
                            else
                            {
                                string imgsrc = string.Empty;
                                string txtCommName = string.Empty;
                                if (_IsArchivedEvent)
                                {
                                    if (_AssetInfoData[count].TypeId + 1000 == 1101)
                                    {
                                        imgsrc = "&nbsp;<img src=\'" + "images/UI/Icons/FileTypes/word.png" + "\' />&nbsp;&nbsp;";
                                        txtCommName = _MessageHelper.GetMessage("lbl Office Documents");
                                    }
                                    else if (_AssetInfoData[count].TypeId + 1000 == 1102)
                                    {
                                        imgsrc = "&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/contentManagedFiles.png" + " \' />&nbsp;&nbsp;";
                                        txtCommName = _MessageHelper.GetMessage("lbl Managed Files");
                                    }
                                    else if (_AssetInfoData[count].TypeId + 1000 == 1106)
                                    {
                                        imgsrc = "&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/FileTypes/image.png" + " \' />&nbsp;&nbsp;";
                                        txtCommName = _MessageHelper.GetMessage("lbl image assets");
                                    }
                                    else if (_AssetInfoData[count].TypeId + 1000 == 1104)
                                    {
                                        imgsrc = "&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/film.png" + " \' />&nbsp;&nbsp;";
                                        txtCommName = _MessageHelper.GetMessage("lbl Multimedia");
                                    }
                                    else
                                    {
                                        imgsrc = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                                    }
                                    if (_AssetInfoData[count].TypeId + 1000 != 1105)
                                    {
                                        result.Append("viewmenu.addItem(\"" + imgsrc + "" + MakeBold(txtCommName, System.Convert.ToInt32(_AssetInfoData[count].TypeId + 1000), Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes) + "\", function() { UpdateView(" + (_AssetInfoData[count].TypeId + 1000) + "); } );" + Environment.NewLine);
                                    }
                                }
                                else
                                {

                                    if (_AssetInfoData[count].TypeId == 101)
                                    {
                                        imgsrc = "&nbsp;<img src=\'" + "images/UI/Icons/FileTypes/word.png" + "\' />&nbsp;&nbsp;";
                                        txtCommName = _MessageHelper.GetMessage("lbl Office Documents");
                                    }
                                    else if (_AssetInfoData[count].TypeId == 102)
                                    {
                                        imgsrc = "&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/contentManagedFiles.png" + " \' />&nbsp;&nbsp;";
                                        txtCommName = _MessageHelper.GetMessage("lbl Managed Files");
                                    }
                                    else if (_AssetInfoData[count].TypeId == 106)
                                    {
                                        imgsrc = "&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/FileTypes/image.png" + " \' />&nbsp;&nbsp;";
                                        txtCommName = _MessageHelper.GetMessage("lbl image assets");
                                    }
                                    else if (_AssetInfoData[count].TypeId == 104)
                                    {
                                        imgsrc = "&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/film.png" + " \' />&nbsp;&nbsp;";
                                        txtCommName = _MessageHelper.GetMessage("lbl Multimedia");
                                    }
                                    else
                                    {
                                        imgsrc = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                                    }
                                    if (_AssetInfoData[count].TypeId != 105)
                                    {
                                        result.Append("viewmenu.addItem(\"" + imgsrc + "" + MakeBold(txtCommName, _AssetInfoData[count].TypeId, Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes) + "\", function() { UpdateView(" + _AssetInfoData[count].TypeId + "); } );" + Environment.NewLine);
                                    }
                                }

                            }
                        }
                    }
                }
            }

            AddLanguageMenu(result);

            result.Append("    viewmenu.addBreak();" + Environment.NewLine);

            if (bViewContent && CanDoMenus)
            {
                result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/menu.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl Menu") + "\", function() { window.location.href = \'collections.aspx?LangType=" + _ContentLanguage + "&action=ViewAllMenus&folderid=" + _Id + "\' } );" + Environment.NewLine);
            }
            if (bViewContent && CanDoCollections)
            {
                result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/collection.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl Collection") + "\", function() { window.location.href = \'collections.aspx?LangType=" + _ContentLanguage + "&action=mainPage&folderid=" + _Id + "\' } );" + Environment.NewLine);
            }
            if (bViewContent)
            {
                result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/contentArchived.png" + "\' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("archive content") + "\", function() { window.location.href = \'content.aspx?action=" + _NextActionType + "&id=" + _Id + "&IsArchivedEvent=true" + "&LangType=" + _ContentLanguage + ((Ektron.Cms.Common.EkConstants.IsAssetContentType(Convert.ToInt64(_ContentTypeSelected), false)) ? ("&" + _ContentTypeUrlParam + "=" + Ektron.Cms.Common.EkConstants.MakeArchiveAssetContentType(Convert.ToInt64(_ContentTypeSelected))) : ((Ektron.Cms.Common.EkConstants.IsArchiveAssetContentType(Convert.ToInt64(_ContentTypeSelected))) ? ("&" + _ContentTypeUrlParam + "=" + Ektron.Cms.Common.EkConstants.MakeNonArchiveAssetContentType(Convert.ToInt64(_ContentTypeSelected))) : "")) + "\' } );" + Environment.NewLine);
            }
            else
            {
                result.Append("    viewmenu.addItem(\"&nbsp;<img valign=\'middle\' src=\'" + "images/UI/Icons/contentArchived.png" + "\' />&nbsp;&nbsp;&nbsp;" + _MessageHelper.GetMessage("top Content") + "\", function() { window.location.href = \'content.aspx?action=" + _NextActionType + "&id=" + _Id + "&LangType=" + _ContentLanguage + ((Ektron.Cms.Common.EkConstants.IsAssetContentType(Convert.ToInt64(_ContentTypeSelected), false)) ? ("&" + _ContentTypeUrlParam + "=" + (Convert.ToInt32(Ektron.Cms.Common.EkConstants.MakeArchiveAssetContentType(Convert.ToInt64(_ContentTypeSelected))))) : ((Ektron.Cms.Common.EkConstants.IsArchiveAssetContentType(Convert.ToInt64(_ContentTypeSelected))) ? ("&" + _ContentTypeUrlParam + "=" + Ektron.Cms.Common.EkConstants.MakeNonArchiveAssetContentType(Convert.ToInt64(_ContentTypeSelected))) : "")) + "\' } );" + Environment.NewLine);
            }

            if (((_PermissionData.CanEditFolders || _PermissionData.CanEditApprovals) && bViewContent) || IsFolderAdmin())
            {
                result.Append("    viewmenu.addBreak();" + Environment.NewLine);
                result.Append("    viewmenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/properties.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl Folder Properties") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=ViewFolder&id=" + _Id + "\' } );" + Environment.NewLine);
            }

            result.Append("    MenuUtil.add( viewmenu );" + Environment.NewLine);

            // Delete Menu
            if ((_PermissionData.CanDeleteFolders && bViewContent && _Id != 0) || ((bViewContent && (_PermissionData.IsAdmin || IsFolderAdmin()) || _PermissionData.CanDelete) && totalPages > 0))
            {

                result.Append("    var deletemenu = new Menu( \"delete\" );" + Environment.NewLine);
                if (_PermissionData.CanDeleteFolders && bViewContent && _Id != 0)
                {
                    string folderImgPath = "images/UI/Icons/folderDelete.png";

                    switch (_FolderType)
                    {
                        case 2: //Domain
                            folderImgPath = "images/UI/Icons/folderSiteDelete.png";
                            break;
                        case 6: //Community
                            folderImgPath = "images/UI/Icons/folderCommunityDelete.png";
                            break;
                        default:
                            break;
                        // use the default.
                    }
                    result.Append("    deletemenu.addItem(\"&nbsp;<img src=\'" + folderImgPath + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl This Folder") + "\", function() { if( ConfirmFolderDelete(" + _Id + ") ) { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=DoDeleteFolder&id=" + _Id + "&ParentID=" + ParentId + "\'; }} );" + Environment.NewLine);
                }
                if (bViewContent && (_PermissionData.IsAdmin || IsFolderAdmin()) || _PermissionData.CanDelete)
                {
                    // get a count for the content in this folder
                    if (totalPages > 0)
                    {
                        if ((Convert.ToString(_EnableMultilingual) == "1") && (_ContentLanguage < 1))
                        {
                            result.Append("    deletemenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/contentHtmlDelete.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("top Content") + "\", function() { alert(\'A language must be selected!\'); } );" + Environment.NewLine);
                        }
                        else
                        {
                            //44595 - Delete content from the archive view should show up archived list rather than live content list.
                            if (_PageAction == "viewarchivecontentbycategory")
                            {
                                result.Append("    deletemenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/contentDelete.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("top Content") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=DeleteContentByCategory&id=" + _Id + "&showarchive=true\'; } );" + Environment.NewLine);
                            }
                            else
                            {
                                result.Append("    deletemenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/contentDelete.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("top Content") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=DeleteContentByCategory&id=" + _Id + "\'; } );" + Environment.NewLine);
                            }
                        }
                    }
                }
                result.Append("    MenuUtil.add( deletemenu );" + Environment.NewLine);
            }
        }

        result.Append("    var actionmenu = new Menu( \"action\" );" + Environment.NewLine);
        if (_ContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.AdminXliff) && bViewContent && Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(_ContentApi.RequestInformationRef, Feature.Xliff, false))
        {
            result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/translationExport.png" + " \' />&nbsp;&nbsp;" + this._MessageHelper.GetMessage("lbl Export for translation") + "\", function() { window.location.href = \'content.aspx?LangType=" + _ContentLanguage + "&action=Localize&backpage=ViewContentByCategory&id=" + _Id + "\'; } );" + Environment.NewLine);
        }

        result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/magnifier.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("generic Search") + "\", function() { window.location.href = \'isearch.aspx?LangType=" + _ContentLanguage + "&action=showdlg&folderid=" + _Id + "\'; } );" + Environment.NewLine);

        result.Append("    actionmenu.addBreak();" + Environment.NewLine);

        if (_CheckedInOrApproved && bViewContent && (_PermissionData.IsAdmin || IsFolderAdmin() || IsCopyOrMoveAdmin()) && (_PermissionData.CanAdd || _PermissionData.CanEdit))
        {
            if (Convert.ToString(_EnableMultilingual) == "1" && _ContentLanguage < 1)
            {
                result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/cut.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl cut") + "\", function() { alert(\'A language must be selected!\'); } );" + Environment.NewLine);
                result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/contentCopy.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl copy") + "\", function() { alert(\'A language must be selected!\'); } );" + Environment.NewLine);
            }
            else
            {
                result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/cut.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl cut") + "\", function() { setClipBoard(); } );" + Environment.NewLine);
                result.Append("    actionmenu.addItem(\"&nbsp;<img src=\'" + "images/UI/Icons/contentCopy.png" + " \' />&nbsp;&nbsp;" + _MessageHelper.GetMessage("lbl copy") + "\", function() { setCopyClipBoard(); }) ;" + Environment.NewLine);
            }
        }

        SiteAPI site = new SiteAPI();
        EkSite ekSiteRef = site.EkSiteRef;
        if (_ContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.SyncAdmin) || _ContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.SyncUser))
        {
            result.Append(GetSyncMenuOption());
        }
        result.Append("    MenuUtil.add( actionmenu );" + Environment.NewLine);
        result.Append("    </script>" + Environment.NewLine);
        result.Append("" + Environment.NewLine);

        htmToolBar.InnerHtml = result.ToString();
    }
Beispiel #19
0
    public Dictionary <TDBID, Mail> m_mailList = new Dictionary <TDBID, Mail>();// 邮件详细内容列表,用于拖动切换邮件
    void OnReadMailResp(Mail mail)
    {
        m_mailList[mail.mailId] = mail;

        LoggerHelper.Debug(mail.from + " " + mail.to);
        SocietyUIViewManager.Instance.ShowMailGridListDialog(false);
        SocietyUIViewManager.Instance.ShowMailDetailDialog(true);

        MailDetailData md = new MailDetailData();

        if (mail.state == MAIL_STATE.NO_ATTACH_NO_READ || mail.state == MAIL_STATE.NO_ATTACH_READ)
        {
            SocietyUIViewManager.Instance.ShowOneKeyGetItemBtn(false);
            SocietyUIViewManager.Instance.ShowMailItemGetSign(false);
        }
        else if (mail.state == MAIL_STATE.ATTACH_READ || mail.state == MAIL_STATE.ATTACH_NO_READ)
        {
            SocietyUIViewManager.Instance.ShowOneKeyGetItemBtn(true);
            SocietyUIViewManager.Instance.ShowMailItemGetSign(false);
        }
        else
        {
            SocietyUIViewManager.Instance.ShowOneKeyGetItemBtn(false);
            SocietyUIViewManager.Instance.ShowMailItemGetSign(true);
        }

        if (mail.mailType == MAIL_TYPE.ID)
        {
            try
            {
                int fromId = System.Int32.Parse(mail.from);
                md.senderName = LanguageData.GetContent(fromId);
                int titleId = System.Int32.Parse(mail.title);
                md.title = LanguageData.GetContent(titleId);
                int textId = System.Int32.Parse(mail.text);
                md.infoText = LanguageData.GetContent(textId, mail.args.ToArray());
            }
            catch (System.Exception ex)
            {
                md.infoText   = mail.text;
                md.senderName = mail.from;
                md.title      = mail.title;
            }
        }
        else
        {
            md.infoText   = mail.text;
            md.senderName = mail.from;
            md.title      = mail.title;
        }
        md.reciverName = mail.to;

        md.time = mail.time.ToString();

        md.listItemImg = new List <string>();
        md.listItemNum = new List <int>();
        md.listItemID  = new List <int>();

        Mogo.Util.LoggerHelper.Debug(mail);

        for (int i = 0; i < mail.items.Count; ++i)
        {
            //  Mogo.Util.LoggerHelper.Debug(ItemParentData.GetItem(mail.items[i]).Icon);
            ItemParentData data = ItemParentData.GetItem(mail.items[i]);
            if (data != null)
            {
                md.listItemImg.Add(data.Icon);
                md.listItemID.Add(mail.items[i]);
            }
            else
            {
                md.listItemImg.Add("");
            }
            Mogo.Util.LoggerHelper.Debug(mail.nums.Count);
            md.listItemNum.Add(mail.nums[i]);
        }

        md.mailId = mail.mailId;
        SocietyUIViewManager.Instance.FillMailDetailData(md);

        if (mail.state == MAIL_STATE.NO_ATTACH_NO_READ || mail.state == MAIL_STATE.NO_ATTACH_READ)
        {
            SocietyUIViewManager.Instance.ShowOneKeyGetItemBtn(false);
            SocietyUIViewManager.Instance.ShowMailItemGetSign(false);
        }
        else if (mail.state == MAIL_STATE.ATTACH_READ || mail.state == MAIL_STATE.ATTACH_NO_READ)
        {
            SocietyUIViewManager.Instance.ShowOneKeyGetItemBtn(true);
            SocietyUIViewManager.Instance.ShowMailItemGetSign(false);
        }
        else
        {
            SocietyUIViewManager.Instance.ShowOneKeyGetItemBtn(false);
            SocietyUIViewManager.Instance.ShowMailItemGetSign(true);
        }
    }
Beispiel #20
0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        PermissionData security_lib_data;
            string strBrowserCode = "";
            if (Request.Browser.Type.IndexOf("IE") != -1)
            {
                _IsBrowserIE = true;
            }
            if (!String.IsNullOrEmpty(Request.QueryString["type"]))
            {
                _IsProduct = System.Convert.ToBoolean(Request.QueryString["type"].ToLower() == "product");
            }
            _MessageHelper = _ContentApi.EkMsgRef;
            _EkContent = _ContentApi.EkContentRef;
            if (_EkContent.IsAllowed(0, 0, "users", "IsLoggedIn", 0) == false || _EkContent.IsAllowed(0, 0, "users", "IsAdmin", 0) == false)
            {
                if ((_IsProduct && ! _EkContent.IsARoleMember(Convert.ToInt64(EkEnumeration.CmsRoleIds.CommerceAdmin), _EkContent.RequestInformation.UserId, false)) || (! _IsProduct && ! _EkContent.IsARoleMember(Convert.ToInt64(EkEnumeration.CmsRoleIds.AdminXmlConfig), _EkContent.RequestInformation.UserId, false)))
                    {
                    Utilities.ShowError(_MessageHelper.GetMessage("com: user does not have permission"));
                }
            }

            RegisterResources();
            StyleSheetJS.Text = _StyleHelper.GetClientScript();

            _CurrentUserId = _ContentApi.UserId;
            _ContentLanguage = _ContentApi.ContentLanguage;
            _AppImgPath = _ContentApi.AppImgPath;
            _AppImgPath = _ContentApi.AppPath;
            _SitePath = _ContentApi.SitePath;
            _AppeWebPath = _ContentApi.ApplicationPath + _ContentApi.AppeWebPath;
            _AppName = _ContentApi.AppName;
            _Id = Convert.ToInt64(Request.QueryString["id"]);
            _PageAction = Request.QueryString["action"];
            _Var1 = Request.ServerVariables["SERVER_NAME"];
            _LanguageData = (new SiteAPI()).GetLanguageById(_ContentLanguage);
            _Var2 = _EkContent.GetEditorVariablev2_0(_Id, _PageAction);
            if (_LanguageData != null)
            {
                _LocaleFileNumber = Convert.ToString(_LanguageData.Id);
                strBrowserCode = _LanguageData.BrowserCode;
            }

            Page.Title = _AppName + " " + _MessageHelper.GetMessage("edit content page title") + " \"" + Ektron.Cms.CommonApi.GetEcmCookie()["username"] + "\"";
            _LocaleFileString = GetLocaleFileString(_LocaleFileNumber);

            SiteAPI refSiteApi = new SiteAPI();
            SettingsData settings_data;
            settings_data = refSiteApi.GetSiteVariables(refSiteApi.UserId);
            _AppLocaleString = GetLocaleFileString(settings_data.Language);

            _SelectedEditControl = "eWebEditPro";
            bool bIsMac = false;
            try
            {
                if (Request.Browser.Platform.IndexOf("Win") == -1)
                {
                    bIsMac = true;
                }
                if (bIsMac)
                {
                    _SelectedEditControl = "ContentDesigner";
                }
                else
                {
                    if (ConfigurationManager.AppSettings["ek_DataDesignControl"] != null)
                    {
                        _SelectedEditControl = (string) (ConfigurationManager.AppSettings["ek_DataDesignControl"].ToString());
                    }
                }
            }
            catch (Exception)
            {
                _SelectedEditControl = "ContentDesigner";
            }

            if (_SelectedEditControl == "eWebEditPro")
            {
                EditorJS.Text = Utilities.EditorScripts(_Var2, _AppeWebPath, strBrowserCode);
            }
            else
            {
                EditorJS.Text = "";
            }

            security_lib_data = _ContentApi.LoadPermissions(_Id, "folder", 0);
            _UploadPrivs = security_lib_data.CanAddToFileLib || security_lib_data.CanAddToImageLib;

            _EditAction = Request.QueryString["editaction"];
            if (!(Page.IsPostBack))
            {
                if (_EditAction == "cancel")
                {
                    //do nothing
                }
                else
                {
                    DisplayControl();
                }

            }
            else
            {
                UpdateEditDesign();
            }
            jsAppeWebPath.Text = _AppeWebPath;
            jsAppLocaleString.Text = _AppLocaleString;
            jsSitePath.Text = _SitePath;
            jsPath.Text = Strings.Replace(_Path, "\\", "\\\\", 1, -1, 0);
            jsTitle.Text = _MessageHelper.GetMessage("generic title label");
            jsXmlStyle.Text = _MessageHelper.GetMessage("lbl select style for xml design");
            jsInputTmpStyleSheet.Text = "<input type=\"text\" maxlength=\"255\" size=\"45\" value=\"" + _StyleSheet + "\" name=\"stylesheet\" id=\"stylesheet\" onchange=\"SetStyleSheetFromInput();\" />";
            jsTmpStyleSheet.Text = _StyleSheet;
            jshdnContentLanguage.Text = "<input type=\"hidden\" name=\"content_language\" value=\"" + _ContentLanguage + "\"/>";
            jshdnMaxContLength.Text = "<input type=\"hidden\" name=\"maxcontentsize\" value=\"" + _MaxContLength + "\"/>";
            jshdnXml_id.Text = "<input type=\"hidden\" name=\"xml_collection_id\" value=\"" + _XmlId + "\"/>";
            jshdnIndex_cms.Text = "<input type=\"hidden\" name=\"index_cms\" value=\"" + _IndexCms + "\"/>";
            jshdniSegment.Text = "<input type=\"hidden\" name=\"numberoffields\" value=\"" + _Segment + "\"/>";
            jsMaxContLength.Text = _MaxContLength.ToString();
            jsEditorMsg.Text = _MessageHelper.GetMessage("lbl wait editor not loaded");
            sContentInvalid.Text = _MessageHelper.GetMessage("msg content invalid");
            sDesignIncompatible.Text = _MessageHelper.GetMessage("msg design incompatible");
            sContinue.Text = _MessageHelper.GetMessage("msg wish to continue");
            sWarnOnUnload.Text = _MessageHelper.GetMessage("js: alert confirm close no save");
    }
Beispiel #21
0
        public override void OnGrammarDataConstructed(LanguageData language)
        {
            SetDecimalSeparatorOnNumberLiterals();      // it works with Irony.Parser as well, not just with Sarcasm.MultiParser

            base.OnGrammarDataConstructed(language);
        }
Beispiel #22
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        try
            {
                m_refMsg = m_refApi.EkMsgRef;
                AppImgPath = m_refApi.AppImgPath;
                AppPath = m_refApi.AppPath;
                ltr_sitepath.Text = m_refApi.SitePath;
                m_strPageAction = Request.QueryString["action"];
                Utilities.SetLanguage(m_refApi);
                TaxonomyLanguage = m_refApi.ContentLanguage;
                if (TaxonomyLanguage == -1)
                {
                    TaxonomyLanguage = m_refApi.DefaultContentLanguage;
                }
                if (Request.QueryString["taxonomyid"] != null)
                {
                    TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
                }
                if (Request.QueryString["parentid"] != null)
                {
                    TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]);
                    if (TaxonomyParentId > 0)
                    {
                        TitleLabel = "categorytitle";
                        DescriptionLabel = "categorydescription";
                    }
                }
                if (Request.QueryString["iframe"] == "true")
                {
                    styles.Visible = true;
                }

                chkConfigContent.Text = chkConfigContent.ToolTip = m_refMsg.GetMessage("content text");
                chkConfigUser.Text = chkConfigUser.ToolTip = m_refMsg.GetMessage("generic user");
                chkConfigGroup.Text = chkConfigGroup.ToolTip = m_refMsg.GetMessage("lbl group");

                if (Page.IsPostBack)
                {
                    TaxonomyData taxonomy_data = new TaxonomyData();
                    taxonomy_data.TaxonomyDescription = Request.Form[taxonomydescription.UniqueID];
                    taxonomy_data.TaxonomyName = Request.Form[taxonomytitle.UniqueID];
                    taxonomy_data.TaxonomyLanguage = TaxonomyLanguage;
                    taxonomy_data.TaxonomyParentId = TaxonomyParentId;
                    taxonomy_data.TaxonomyImage = Request.Form[taxonomy_image.UniqueID];
                    taxonomy_data.CategoryUrl = Request.Form[categoryLink.UniqueID];
                    if (tr_enableDisable.Visible == true)
                    {
                        if (! string.IsNullOrEmpty(Request.Form[chkEnableDisable.UniqueID]))
                        {
                            taxonomy_data.Visible = true;
                        }
                        else
                        {
                            taxonomy_data.Visible = false;
                        }
                    }
                    else
                    {
                        taxonomy_data.Visible = true;
                    }

                    if (Request.Form[inherittemplate.UniqueID] != null)
                    {
                        taxonomy_data.TemplateInherited = true;
                    }
                    if (Request.Form[taxonomytemplate.UniqueID] != null)
                    {
                        taxonomy_data.TemplateId = Convert.ToInt64(Request.Form[taxonomytemplate.UniqueID]);
                    }
                    else
                    {
                        taxonomy_data.TemplateId = 0;
                    }

                    //If (TaxonomyId <> 0) Then
                    //  taxonomy_data.TaxonomyId = TaxonomyId
                    //End If
                    m_refContent = m_refApi.EkContentRef;
                    TaxonomyId = m_refContent.CreateTaxonomy(taxonomy_data);
                    if (Request.Form[alllanguages.UniqueID] == "false")
                    {
                        m_refContent.UpdateTaxonomyVisible(TaxonomyId, -1, false);
                    }
                    m_refContent.UpdateTaxonomySynchronization(TaxonomyId, GetCheckBoxValue(chkTaxSynch));
                    // chkCreateLang
                    if (TaxonomyParentId == 0)
                    {
                        string strConfig = string.Empty;
                        if (! string.IsNullOrEmpty(Request.Form[chkConfigContent.UniqueID]))
                        {
                            strConfig = "0";
                        }
                        if (! string.IsNullOrEmpty(Request.Form[chkConfigUser.UniqueID]))
                        {
                            if (string.IsNullOrEmpty(strConfig))
                            {
                                strConfig = "1";
                            }
                            else
                            {
                                strConfig = strConfig + ",1";
                            }
                        }
                        if (! string.IsNullOrEmpty(Request.Form[chkConfigGroup.UniqueID]))
                        {
                            if (string.IsNullOrEmpty(strConfig))
                            {
                                strConfig = "2";
                            }
                            else
                            {
                                strConfig = strConfig + ",2";
                            }
                        }
                        if (!(string.IsNullOrEmpty(strConfig)))
                        {
                            m_refContent.UpdateTaxonomyConfig(TaxonomyId, strConfig);
                        }
                    }
                    //++++++++++++++++++++++++++++++++++++++++++++++++
                    //+++++++++ Adding MetaData Information '+++++++++
                    //++++++++++++++++++++++++++++++++++++++++++++++++
                    AddCustomProperties();
                    //++++++++++++++++++++++++++++++++++++++++++++++++
                    //+++++++++ Adding Other Langs (If Applicable) +++
                    //++++++++++++++++++++++++++++++++++++++++++++++++
                    if (!GetCheckBoxValue(chkTaxSynch) && GetCheckBoxValue(chkCreateLang))
                    {   // Figure out which ones were created.
                        IList<LanguageData> result_language = null;
                        TaxonomyLanguageRequest taxonomy_language_request = new TaxonomyLanguageRequest();
                        taxonomy_language_request.TaxonomyId = TaxonomyId;
                        taxonomy_language_request.IsTranslated = false; // langs that we still need
                        result_language = m_refContent.LoadLanguageForTaxonomy(taxonomy_language_request);
                        if (result_language != null)
                        {
                            foreach(LanguageData lang in result_language)
                            {
                                UsingLanguage(m_refContent.RequestInformation, lang.Id, delegate
                                {
                                    taxonomy_data.TaxonomyId = TaxonomyId;
                                    taxonomy_data.LanguageId = lang.Id;
                                    m_refContent.CreateTaxonomy(taxonomy_data);
                                });
                            }
                        }
                    }

                    if (Request.QueryString["iframe"] == "true")
                    {
                        Packages.EktronCoreJS.Register(this);
                        closeWindow = "Ektron.ready(function(){parent.CloseChildPage();});";
                    }
                    else
                    {
                        //this should jump back to taxonomy that was added
                        //Response.Redirect("taxonomy.aspx?rf=1", True)
                        Response.Redirect("taxonomy.aspx?action=view&view=item&taxonomyid=" + TaxonomyId + "&rf=1&reloadtrees=Tax", true);
                    }
                }
                else
                {
                    m_refContent = m_refApi.EkContentRef;
                    TaxonomyRequest req = new TaxonomyRequest();
                    req.TaxonomyId = TaxonomyParentId;
                    req.TaxonomyLanguage = TaxonomyLanguage;

                    if (TaxonomyParentId > 0)
                    {
                        m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyParentId, TaxonomyLanguage);
                    }
                    else if (TaxonomyId > 0)
                    {
                        m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage);
                    }
                    chkTaxSynch.Checked = m_bSynchronized;
                    chkTaxSynch.Attributes.Add("onclick",
                        string.Format("ToggleTaxSynch(this, '{0}');", chkCreateLang.ClientID)
                        );
                    if (m_bSynchronized)
                    {
                        fs_taxsynccreate.Attributes.Add("style", "display:none;");
                    }
                    if (! m_bSynchronized)
                    {
                        tr_enableDisable.Visible = false;
                    }
                    TaxonomyBaseData data = m_refContent.ReadTaxonomy(ref req);
                    if (data == null)
                    {
                        EkException.ThrowException(new Exception("Invalid taxonomy ID: " + TaxonomyId + " parent: " + TaxonomyParentId));
                    }
                    language_data = (new SiteAPI()).GetLanguageById(TaxonomyLanguage);
                    if ((language_data != null) && (m_refApi.EnableMultilingual == 1))
                    {
                        lblLanguage.Text = "[" + language_data.Name + "]";
                    }
                    taxonomy_image_thumb.ImageUrl = m_refApi.AppImgPath + "spacer.gif";
                    m_strCurrentBreadcrumb = (string) (data.TaxonomyPath.Remove(0, 1).Replace("\\", " > "));
                    if (m_strCurrentBreadcrumb == "")
                    {
                        m_strCurrentBreadcrumb = "Root";
                    }
                    if (TaxonomyParentId == 0)
                    {
                        inherittemplate.Visible = false;
                        lblInherited.Text = "No";
                        lblInherited.ToolTip = lblInherited.Text;
                    }
                    else
                    {
                        inherittemplate.Checked = true;
                        taxonomytemplate.Enabled = false;
                        inherittemplate.Visible = true;
                        lblInherited.Text = "";
                    }
                    TemplateData[] templates = null;
                    templates = m_refApi.GetAllTemplates("TemplateFileName");
                    taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem("- " + m_refMsg.GetMessage("generic select template") + " -", "0"));
                    if ((templates != null)&& templates.Length > 0)
                    {
                        for (int i = 0; i <= templates.Length - 1; i++)
                        {
                            taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem(templates[i].FileName, templates[i].Id.ToString()));
                        }
                    }

                    inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)");
                    inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)");
                    if (TaxonomyParentId == 0)
                    {
                        tr_config.Visible = true;
                    }
                    else
                    {
                        tr_config.Visible = false;
                    }
                    chkConfigContent.Checked = true;
                    LoadCustomPropertyList();
                    TaxonomyToolBar();
                }
            }
            catch (System.Threading.ThreadAbortException)
            {
                //Do nothing
            }
            catch (Exception ex)
            {
                Response.Redirect((string) ("reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message + ".") + "&LangType=" + TaxonomyLanguage), false);
            }
    }
Beispiel #23
0
 public AstContext(LanguageData language)
 {
     Language = language;
 }
Beispiel #24
0
    private string AddLanguageOption(LanguageData lang, int currentLanguageId, bool showOnlySiteEnabled)
    {
        string langName = lang.Name;
        if (lang.Id == currentLanguageId)
        {
            langName = (string.IsNullOrEmpty(lang.LocalName) ? lang.Name : lang.LocalName);
        }
        else
        {
            string resourceName = m_refMsg.GetMessage(string.Format("languagename {0}", lang.Id));
            langName = (resourceName.EndsWith("-HC") ? lang.Name : resourceName);
        }
        string selectedLang = "";
        if (lang.Id != 0 && (lang.SiteEnabled || showOnlySiteEnabled == false))
        {

            if (currentLanguageId == lang.Id)
            {
                selectedLang = " selected=\"selected\"";
            }
        }

        return string.Format("<option value=\"{0}\" {1}>{2}</option>", lang.Id, selectedLang, langName);
    }
        public TerminalSet NoPrefixTerminals = new TerminalSet(); //Terminals that have no limited set of prefixes

        public GrammarData(LanguageData language)
        {
            Language = language;
            Grammar = language.Grammar;
        }
Beispiel #26
0
    public bool TestContentWS(string sSiteUrl)
    {
        bool bReturn = false;
        string sResults = "";
        string defaultContentLanguage = System.Configuration.ConfigurationManager.AppSettings["ek_DefaultContentLanguage"];
        Ektron.Cms.LanguageData language_data = new LanguageData();
        language_data = m_refSiteApi.GetLanguageById(Int32.Parse(defaultContentLanguage));
        string langName = language_data.LocalName;

        try
        {
            //----- Create url to the webservice.
            if (sSiteUrl != "")
            {
                sSiteUrl = sSiteUrl.Substring(0, sSiteUrl.LastIndexOf('/'));
                sSiteUrl = sSiteUrl.Substring(0, sSiteUrl.LastIndexOf('/') + 1);
                sSiteUrl = sSiteUrl + "webservices/ContentWS.asmx/ecmLanguageSelect?SiteLanguage=" + defaultContentLanguage;
            }
            else
            {
                //----- Default to the usual if no value passed in.
                sSiteUrl = "http://localhost/CMS400Demo/WorkArea/webservices/ContentWS.asmx/ecmLanguageSelect?SiteLanguage=" + defaultContentLanguage;
            }

            //----- Call to connect to url.
            sResults = ConnectToURL(sSiteUrl);

            //----- Check results with what we expect.
            if (sResults.Contains("&lt;option value=\"" + defaultContentLanguage + "\" selected=\"selected\"&gt;" + langName + "&lt;/option&gt;"))
            {
                bReturn = true;
            }
            else
            {
                m_sLastError = sResults;
                bReturn = false;
            }
        }
        catch (Exception exThrown)
        {
            //----- If something threw, record the last message.
            m_sLastError = exThrown.Message;
            bReturn = false;
        }

        return bReturn;
    }
Beispiel #27
0
    private void ViewToolBar(HtmlGenericControl objTitleBar, HtmlGenericControl objHTMToolBar)
    {
        System.Text.StringBuilder result = new System.Text.StringBuilder();
            // place the proper title in the Title Bar
            objTitleBar.InnerHtml = m_refStyle.GetTitleBar(m_refMsg.GetMessage("msg view synonyms"));

            // build the string for rendering the htmToolBar
            result.Append("<table cellspacing=\"0\"><tr>");

            bool addHelpDivider = false;

            if (ContentLanguage != -1)
            {
                result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/add.png", (string)("synonyms.aspx?action=AddSynonym&LangType=" + ContentLanguage), m_refMsg.GetMessage("alt add button text synonym"), m_refMsg.GetMessage("btn add synonym"), "", StyleHelper.AddButtonCssClass, true));

                addHelpDivider = true;
            }
            // if the system is
            if (m_refContentApi.EnableMultilingual == 1)
            {
                result.Append(StyleHelper.ActionBarDivider);

                SiteAPI m_refsite = new SiteAPI();
                LanguageData[] language_data = new LanguageData[1];
                language_data = m_refsite.GetAllActiveLanguages();

                result.Append("<td class=\"label\" id=\"viewText\">");

                result.Append("&nbsp;" + m_refMsg.GetMessage("generic view") + ": ");
                result.Append("<select id=\'LangType\' name=\'LangType\'OnChange=\"javascript:LoadLanguage(this.options[this.selectedIndex].value);\">");
                if (ContentLanguage == -1)
                {
                    result.Append("<option value=" + Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES + " selected>" + m_refMsg.GetMessage("generic all") + "</option>");
                }
                else
                {
                    result.Append("<option value=" + Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES + ">" + m_refMsg.GetMessage("generic all") + "</option>");
                }

                for (int count = 0; count <= language_data.Length - 1; count++)
                {
                    if (Convert.ToString((short) ContentLanguage) == Convert.ToString(language_data[count].Id))
                    {
                        result.Append("<option value=" + language_data[count].Id + " selected>" + language_data[count].Name + "</option>");
                    }
                    else
                    {
                        result.Append("<option value=" + language_data[count].Id + ">" + language_data[count].Name + "</option>");
                    }
                }
                result.Append("</select></td>");

                addHelpDivider = true;
            }

            if (addHelpDivider)
            {
                result.Append(StyleHelper.ActionBarDivider);
            }

            result.Append("<td>");
            result.Append(m_refStyle.GetHelpButton("synonymsets", ""));
            result.Append("</td>");
            result.Append("</tr></table>");

            // output the result string to the htmToolBar
            objHTMToolBar.InnerHtml = result.ToString();
    }
Beispiel #28
0
 public PrefixBasedScanner(LanguageData language) {
   Language = language;
   _terminalLookup = new TerminalLookupByPrefix(language); 
 }
Beispiel #29
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        m_refMsg = m_refApi.EkMsgRef;
        AppImgPath = m_refApi.AppImgPath;
        m_strPageAction = Request.QueryString["action"];
        object refAPI = m_refApi as object;
        Utilities.SetLanguage(m_refApi);
        TaxonomyLanguage = m_refApi.ContentLanguage;
        if (TaxonomyLanguage == -1)
        {
            TaxonomyLanguage = m_refApi.DefaultContentLanguage;
        }
        if (Request.QueryString["taxonomyid"] != null)
        {
            TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
            hdnTaxonomyId.Value = TaxonomyId.ToString();
        }
        if (Request.QueryString["parentid"] != null)
        {
            TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]);
        }
        m_refContent = m_refApi.EkContentRef;
        if (Request.QueryString["reorder"] != null)
        {
            m_strReorderAction = Convert.ToString(Request.QueryString["reorder"]);
        }
        chkApplyDisplayAllLanguages.Text = m_refMsg.GetMessage("lbl apply display taxonomy languages");
        chkConfigContent.Text = chkConfigContent.ToolTip = m_refMsg.GetMessage("content text");
        chkConfigUser.Text = chkConfigUser.ToolTip = m_refMsg.GetMessage("generic user");
        chkConfigGroup.Text = chkConfigGroup.ToolTip = m_refMsg.GetMessage("lbl group");
        if (Page.IsPostBack)
        {
            if (m_strPageAction == "edit")
            {
                taxonomy_data.TaxonomyLanguage = TaxonomyLanguage;
                taxonomy_data.TaxonomyParentId = TaxonomyParentId;
                taxonomy_data.TaxonomyId = TaxonomyId;
                taxonomy_data.TaxonomyDescription = Request.Form[taxonomydescription.UniqueID];
                taxonomy_data.TaxonomyName = Request.Form[taxonomytitle.UniqueID];
                taxonomy_data.TaxonomyImage = Request.Form[taxonomy_image.UniqueID];
                taxonomy_data.CategoryUrl = Request.Form[categoryLink.UniqueID];
                if (tr_enableDisable.Visible == true)
                {
                    if (!string.IsNullOrEmpty(Request.Form[chkEnableDisable.UniqueID]))
                    {
                        taxonomy_data.Visible = true;
                    }
                    else
                    {
                        taxonomy_data.Visible = false;
                    }
                }
                else
                {
                    taxonomy_data.Visible = Convert.ToBoolean(Request.Form[visibility.UniqueID]);
                }
                if (Request.Form[inherittemplate.UniqueID] != null)
                {
                    taxonomy_data.TemplateInherited = true;
                }
                if (Request.Form[taxonomytemplate.UniqueID] != null)
                {
                    taxonomy_data.TemplateId = Convert.ToInt64(Request.Form[taxonomytemplate.UniqueID]);
                }
                else
                {
                    taxonomy_data.TemplateId = 0;
                }

                try
                {
                    m_refContent.UpdateTaxonomy(taxonomy_data);
                }
                catch (Exception ex)
                {
                    Utilities.ShowError(ex.Message);
                }
                if ((!(Request.Form[chkApplyDisplayAllLanguages.UniqueID] == null)) && (Request.Form[chkApplyDisplayAllLanguages.UniqueID].ToString().ToLower() == "on"))
                {
                    m_refContent.UpdateTaxonomyVisible(TaxonomyId, -1, taxonomy_data.Visible);
                }
                m_refContent.UpdateTaxonomySynchronization(TaxonomyId, GetCheckBoxValue(chkTaxSynch));
                //else
                //{
                //    m_refContent.UpdateTaxonomyVisible(TaxonomyId, TaxonomyLanguage, taxonomy_data.Visible);
                //}
                if (TaxonomyParentId == 0)
                {
                    string strConfig = string.Empty;
                    if (!string.IsNullOrEmpty(Request.Form[chkConfigContent.UniqueID]))
                    {
                        strConfig = "0";
                    }
                    if (!string.IsNullOrEmpty(Request.Form[chkConfigUser.UniqueID]))
                    {
                        if (string.IsNullOrEmpty(strConfig))
                        {
                            strConfig = "1";
                        }
                        else
                        {
                            strConfig = strConfig + ",1";
                        }
                    }
                    if (!string.IsNullOrEmpty(Request.Form[chkConfigGroup.UniqueID]))
                    {
                        if (string.IsNullOrEmpty(strConfig))
                        {
                            strConfig = "2";
                        }
                        else
                        {
                            strConfig = strConfig + ",2";
                        }
                    }
                    if (!(string.IsNullOrEmpty(strConfig)))
                    {
                        m_refContent.UpdateTaxonomyConfig(TaxonomyId, strConfig);
                    }
                }
                UpdateCustomProperties();

                if (Request.QueryString["iframe"] == "true")
                {
                    Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>");
                }
                else
                {
                    if ((Request.QueryString["backaction"] != null) && Convert.ToString(Request.QueryString["backaction"]).ToLower() == "viewtree")
                    {
                        Response.Redirect((string)("taxonomy.aspx?action=viewtree&taxonomyid=" + TaxonomyId + "&LangType=" + TaxonomyLanguage), true);
                    }
                    else
                    {
                        Response.Redirect("taxonomy.aspx?action=view&view=item&taxonomyid=" + TaxonomyId + "&rf=1", true);
                    }
                }
            }
            else
            {
                if (Request.Form[LinkOrder.UniqueID] != "")
                {
                    taxonomy_request = new TaxonomyRequest();
                    taxonomy_request.TaxonomyId = TaxonomyId;
                    taxonomy_request.TaxonomyLanguage = TaxonomyLanguage;
                    taxonomy_request.TaxonomyIdList = Request.Form[LinkOrder.UniqueID];
                    if (!string.IsNullOrEmpty(Request.Form[chkOrderAllLang.UniqueID]))
                    {
                        if (m_strReorderAction == "category")
                        {
                            m_refContent.ReOrderAllLanguageCategories(taxonomy_request);
                        }
                        else if (m_strReorderAction == "users")
                        {

                                taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.User;
                            m_refContent.ReOrderTaxonomyItems(taxonomy_request);
                        }
                    }
                    else
                    {
                        if (m_strReorderAction == "category")
                        {
                            m_refContent.ReOrderCategories(taxonomy_request);
                        }
                        else
                        {
                            if (m_strReorderAction == "users")
                            {
                                taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.User;
                            }
                            m_refContent.ReOrderTaxonomyItems(taxonomy_request);
                        }
                    }
                }
                if (Request.QueryString["iframe"] == "true")
                {
                    Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>");
                }
                else
                {
                    if(m_strReorderAction == "category")
                        Response.Redirect("taxonomy.aspx?action=view&taxonomyid=" + TaxonomyId + "&rf=1&reloadtrees=Tax", true);
                    else
                        Response.Redirect("taxonomy.aspx?action=view&taxonomyid=" + TaxonomyId + "&rf=1", true);
                }
            }
        }
        else
        {
            ltr_sitepath.Text = m_refApi.SitePath;
            taxonomy_request = new TaxonomyRequest();
            taxonomy_request.TaxonomyId = TaxonomyId;
            taxonomy_request.TaxonomyLanguage = TaxonomyLanguage;

            if (m_strPageAction == "edit")
            {
                taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request);

                taxonomydescription.Text = taxonomy_data.TaxonomyDescription;
                taxonomydescription.ToolTip = taxonomydescription.Text;
                taxonomytitle.Text = taxonomy_data.TaxonomyName;
                taxonomytitle.ToolTip = taxonomytitle.Text;
                taxonomy_image.Text = taxonomy_data.TaxonomyImage;
                taxonomy_image.ToolTip = taxonomy_image.Text;
                taxonomy_image_thumb.ImageUrl = taxonomy_data.TaxonomyImage;
                categoryLink.Text = taxonomy_data.CategoryUrl;
                visibility.Value = taxonomy_data.Visible.ToString();
                if (Request.QueryString["taxonomyid"] != null)
                {
                    TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
                }

                if (TaxonomyParentId > 0)
                {
                    m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyParentId, TaxonomyLanguage);
                    if (TaxonomyId > 0)
                        chkTaxSynch.Checked = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage);
                }
                else if (TaxonomyId > 0)
                {
                    m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage);
                    chkTaxSynch.Checked = m_bSynchronized;
                }
                if (taxonomy_data.Visible == true)
                {
                    chkEnableDisable.Checked = true;
                }
                else
                {
                    chkEnableDisable.Checked = false;
                }
                if (taxonomy_data.TaxonomyImage != "")
                {
                    taxonomy_image_thumb.ImageUrl = (taxonomy_data.TaxonomyImage.IndexOf("/") == 0) ? taxonomy_data.TaxonomyImage : m_refApi.SitePath + taxonomy_data.TaxonomyImage;
                }
                else
                {
                    taxonomy_image_thumb.ImageUrl = m_refApi.AppImgPath + "spacer.gif";
                }
                language_data = (new SiteAPI()).GetLanguageById(TaxonomyLanguage);
                if (taxonomy_data.TaxonomyParentId == 0)
                {
                    inherittemplate.Visible = false;
                    lblInherited.Text = "No";
                    lblInherited.ToolTip = lblInherited.Text;
                    inherittemplate.Checked = taxonomy_data.TemplateInherited;
                }
                else
                {
                    inherittemplate.Visible = true;
                    lblInherited.Text = "";
                    inherittemplate.Checked = taxonomy_data.TemplateInherited;
                    if (taxonomy_data.TemplateInherited)
                    {
                        taxonomytemplate.Enabled = false;
                    }
                }
                TemplateData[] templates = null;
                templates = m_refApi.GetAllTemplates("TemplateFileName");
                taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem("- " + m_refMsg.GetMessage("generic select template") + " -", "0"));
                if ((templates != null) && templates.Length > 0)
                {
                    for (int i = 0; i <= templates.Length - 1; i++)
                    {
                        taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem(templates[i].FileName, templates[i].Id.ToString()));
                        if (taxonomy_data.TemplateId == templates[i].Id)
                        {
                            taxonomytemplate.SelectedIndex = i + 1;
                        }
                    }
                }
                if ((language_data != null) && (m_refApi.EnableMultilingual == 1))
                {
                    lblLanguage.Text = "[" + language_data.Name + "]";
                    lblLanguage.ToolTip = lblLanguage.Text;
                }
                m_strCurrentBreadcrumb = (string)(taxonomy_data.TaxonomyPath.Remove(0, 1).Replace("\\", " > "));
                if (m_strCurrentBreadcrumb == "")
                {
                    m_strCurrentBreadcrumb = "Root";
                }
                inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)");
                if (TaxonomyParentId == 0)
                {
                    tr_config.Visible = true;
                    List<int> config_list = m_refApi.EkContentRef.GetAllConfigIdListByTaxonomy(TaxonomyId, TaxonomyLanguage);
                    for (int i = 0; i <= config_list.Count - 1; i++)
                    {
                        if (config_list[i] == 0)
                        {
                            chkConfigContent.Checked = true;
                        }
                        else if (config_list[i] == 1)
                        {
                            chkConfigUser.Checked = true;
                        }
                        else if (config_list[i] == 2)
                        {
                            chkConfigGroup.Checked = true;
                        }
                    }
                }
                else
                {
                    tr_config.Visible = false;
                }

                LoadCustomPropertyList();

            }
            else
            {
                if (m_strReorderAction == "category")
                {
                    taxonomy_request.PageSize = 99999999; // pagesize of 0 used to mean "all"
                    taxonomy_arr = m_refContent.ReadAllSubCategories(taxonomy_request);
                    if (taxonomy_arr != null)
                    {
                        TotalItems = taxonomy_arr.Length;
                    }
                    else
                    {
                        TotalItems = 0;
                    }
                    if (TotalItems > 1)
                    {
                        td_msg.Text = m_refMsg.GetMessage("generic first msg");
                        OrderList.DataSource = taxonomy_arr;
                        OrderList.DataTextField = "TaxonomyName";
                        OrderList.DataValueField = "TaxonomyId";
                        OrderList.DataBind();
                        OrderList.SelectionMode = ListSelectionMode.Multiple;
                        OrderList.CssClass = "width: 100%; border-style: none; border-color: White; font-family: Verdana;font-size: x-small;";
                        if (TotalItems > 20)
                        {
                            OrderList.Rows = 20;
                        }
                        else
                        {
                            OrderList.Rows = TotalItems;
                        }
                        OrderList.Width = 300;
                        if (TotalItems > 0)
                        {
                            loadscript.Text = "document.forms[0].taxonomy_OrderList[0].selected = true;";
                        }
                        for (int i = 0; i <= taxonomy_arr.Length - 1; i++)
                        {
                            if (LinkOrder.Value == "")
                            {
                                LinkOrder.Value = Convert.ToString(taxonomy_arr[i].TaxonomyId);
                            }
                            else
                            {
                                LinkOrder.Value = Convert.ToString(taxonomy_arr[i].TaxonomyId) + ",";
                            }
                        }
                    }
                    else
                    {
                        LoadNoItem();
                    }
                }
                else if (m_strReorderAction == "users")
                {
                    DirectoryUserRequest uReq = new DirectoryUserRequest();
                    DirectoryAdvancedUserData uDirectory = new DirectoryAdvancedUserData();
                    uReq.GetItems = true;
                    uReq.DirectoryId = TaxonomyId;
                    uReq.DirectoryLanguage = TaxonomyLanguage;
                    uReq.PageSize = 99999;
                    uReq.CurrentPage = 1;
                    uDirectory = this.m_refContent.LoadDirectory(ref uReq);
                    TotalItems = uDirectory.DirectoryItems.Count();
                    if (TotalItems > 1)
                    {
                        td_msg.Text = m_refMsg.GetMessage("generic first msg");
                        OrderList.DataSource = uDirectory.DirectoryItems;
                        OrderList.DataTextField = "Username";
                        OrderList.DataValueField = "Id";
                        OrderList.DataBind();
                        OrderList.SelectionMode = ListSelectionMode.Multiple;
                        OrderList.CssClass = "width: 100%; border-style: none; border-color: White; font-family: Verdana;font-size: x-small;";
                        if (TotalItems > 20)
                        {
                            OrderList.Rows = 20;
                        }
                        else
                        {
                            OrderList.Rows = TotalItems;
                        }
                        OrderList.Width = 300;
                        if (TotalItems > 0)
                        {
                            loadscript.Text = "document.forms[0].taxonomy_OrderList[0].selected = true;";
                        }
                        for (int i = 0; i <= TotalItems - 1; i++)
                        {
                            if (LinkOrder.Value == "")
                            {
                                LinkOrder.Value = Convert.ToString(uDirectory.DirectoryItems[i].Id);
                            }
                            else
                            {
                                LinkOrder.Value = Convert.ToString(uDirectory.DirectoryItems[i].Id) + ",";
                            }
                        }
                    }
                    else
                    {
                        LoadNoItem();
                    }
                }
                else
                {
                    AllLangForm.Visible = false; // the all languages checkbox is only valid for categories
                    taxonomy_request.PageSize = 99999999;
                    taxonomy_request.IncludeItems = true;
                    taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request);
                    tr_ordering.Visible = true; //Not showing for items
                    if (taxonomy_data.TaxonomyItems != null)
                    {
                        TotalItems = taxonomy_data.TaxonomyItems.Length;
                        if (TotalItems > 1)
                        {
                            td_msg.Text = m_refMsg.GetMessage("generic first msg");
                            OrderList.DataSource = taxonomy_data.TaxonomyItems;
                            OrderList.DataTextField = "TaxonomyItemTitle";
                            OrderList.DataValueField = "TaxonomyItemId";
                            OrderList.DataBind();
                            OrderList.SelectionMode = ListSelectionMode.Multiple;
                            OrderList.CssClass = "width: 100%; border-style: none; border-color: White; font-family: Verdana;font-size: x-small;";
                            if (TotalItems > 20)
                            {
                                OrderList.Rows = 20;
                            }
                            else
                            {
                                OrderList.Rows = TotalItems;
                            }
                            OrderList.Width = 300;
                            if (TotalItems > 0)
                            {
                                loadscript.Text = "document.forms[0].taxonomy_OrderList[0].selected = true;";
                            }
                            foreach (TaxonomyItemData taxonomy_item in taxonomy_data.TaxonomyItems)
                            {
                                if (LinkOrder.Value == "")
                                {
                                    LinkOrder.Value = Convert.ToString(taxonomy_item.TaxonomyItemId);
                                }
                                else
                                {
                                    LinkOrder.Value = Convert.ToString(taxonomy_item.TaxonomyItemId) + ",";
                                }
                            }
                        }
                        else
                        {
                            LoadNoItem();
                        }
                    }
                }
            }
            TaxonomyToolBar();
        }
    }
Beispiel #30
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        try
        {
            m_refMsg = m_refApi.EkMsgRef;
            AppImgPath = m_refApi.AppImgPath;
            AppPath = m_refApi.AppPath;
            m_strPageAction = Request.QueryString["action"];
            Utilities.SetLanguage(m_refApi);
            TaxonomyLanguage = m_refApi.ContentLanguage;
            if ((TaxonomyLanguage == -1))
            {
                TaxonomyLanguage = m_refApi.DefaultContentLanguage;
            }
            if ((Request.QueryString["taxonomyid"] != null))
            {
                TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
            }
            if ((Request.QueryString["parentid"] != null))
            {
                TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]);
                if ((TaxonomyParentId > 0))
                {
                    TitleLabel = "categorytitle";
                    DescriptionLabel = "categorydescription";
                }
            }

            if ((Page.IsPostBack))
            {
                TaxonomyData taxonomy_data = new TaxonomyData();
                taxonomy_data.TaxonomyType = Ektron.Cms.Common.EkEnumeration.TaxonomyType.Locale;
                taxonomy_data.TaxonomyDescription = Request.Form[taxonomydescription.UniqueID];
                taxonomy_data.TaxonomyName = Request.Form[taxonomytitle.UniqueID];
                taxonomy_data.TaxonomyLanguage = TaxonomyLanguage;
                taxonomy_data.TaxonomyParentId = TaxonomyParentId;
               // taxonomy_data.TaxonomyImage = Request.Form[taxonomy_image.UniqueID];
               // taxonomy_data.CategoryUrl = Request.Form[categoryLink.UniqueID];
                //if (tr_enableDisable.Visible == true)
                //{
                //    if (!string.IsNullOrEmpty(Request.Form[chkEnableDisable.UniqueID]))
                //    {
                //        taxonomy_data.Visible = true;
                //    }
                //    else
                //    {
                //        taxonomy_data.Visible = false;
                //    }
                //}
                //else
                //{
                //    taxonomy_data.Visible = true;
                //}

                //if ((Request.Form[inherittemplate.UniqueID] != null))
                //{
                //    taxonomy_data.TemplateInherited = true;
                //}
                //if ((Request.Form[taxonomytemplate.UniqueID] != null))
                //{
                //    taxonomy_data.TemplateId = Convert.ToInt64(Request.Form[taxonomytemplate.UniqueID]);
                //}
                //else
                //{
                //    taxonomy_data.TemplateId = 0;
                //}

                //If (TaxonomyId <> 0) Then
                //  taxonomy_data.TaxonomyId = TaxonomyId
                //End If
                m_refContent = m_refApi.EkContentRef;
                TaxonomyId = m_refContent.CreateTaxonomy(taxonomy_data);
                //add the default language by Default.
                TaxonomyRequest item_request = new TaxonomyRequest();
                item_request.TaxonomyId = TaxonomyId;
                item_request.TaxonomyIdList =Convert.ToString(TaxonomyLanguage);
                item_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Locale;
                item_request.TaxonomyLanguage = TaxonomyLanguage;
                m_refContent.AddTaxonomyItem(item_request);
                if (Request.Form[alllanguages.UniqueID] == "false")
                {
                    m_refContent.UpdateTaxonomyVisible(TaxonomyId, -1, false);
                }
                if ((TaxonomyParentId == 0))
                {
                    string strConfig = string.Empty;
                    //if ((!string.IsNullOrEmpty(Request.Form[chkConfigContent.UniqueID])))
                    //{
                    //    strConfig = "0";
                    //}
                    //if ((!string.IsNullOrEmpty(Request.Form[chkConfigUser.UniqueID])))
                    //{
                    //    if ((string.IsNullOrEmpty(strConfig)))
                    //    {
                    //        strConfig = "1";
                    //    }
                    //    else
                    //    {
                    //        strConfig = strConfig + ",1";
                    //    }
                    //}
                    //if ((!string.IsNullOrEmpty(Request.Form[chkConfigGroup.UniqueID])))
                    //{
                    //    if ((string.IsNullOrEmpty(strConfig)))
                    //    {
                    //        strConfig = "2";
                    //    }
                    //    else
                    //    {
                    //        strConfig = strConfig + ",2";
                    //    }
                    //}
                    if ((!(string.IsNullOrEmpty(strConfig))))
                    {
                        m_refContent.UpdateTaxonomyConfig(TaxonomyId, strConfig);
                    }
                }
                //++++++++++++++++++++++++++++++++++++++++++++++++
                //+++++++++ Adding MetaData Information '+++++++++
                //++++++++++++++++++++++++++++++++++++++++++++++++
                //Commeneted as per Doug suggestion
                //AddCustomProperties();

                if ((Request.QueryString["iframe"] == "true"))
                {
                    Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>");
                }
                else
                {
                    //this should jump back to taxonomy that was added
                    //Response.Redirect("taxonomy.aspx?rf=1", True)
                    Response.Redirect("LocaleTaxonomy.aspx?action=view&view=locale&taxonomyid=" + TaxonomyId + "&rf=1", true);
                }
            }
            else
            {
                m_refContent = m_refApi.EkContentRef;
                TaxonomyRequest req = new TaxonomyRequest();
                req.TaxonomyId = TaxonomyParentId;
                req.TaxonomyLanguage = TaxonomyLanguage;

                if (TaxonomyParentId > 0)
                {
                    m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyParentId, TaxonomyLanguage);
                }
                else if (TaxonomyId > 0)
                {
                    m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage);
                }
                //if (!m_bSynchronized)
                //{
                //    tr_enableDisable.Visible = false;
                //}
                TaxonomyBaseData data = m_refContent.ReadTaxonomy(ref req);
                if ((data == null))
                {
                    EkException.ThrowException(new Exception("Invalid taxonomy ID: " + TaxonomyId + " parent: " + TaxonomyParentId));
                }
                language_data = (new SiteAPI()).GetLanguageById(TaxonomyLanguage);
                if (((language_data != null) && (m_refApi.EnableMultilingual == 1)))
                {
                    lblLanguage.Text = "[" + language_data.Name + "]";
                }
              //  taxonomy_image_thumb.ImageUrl = m_refApi.AppImgPath + "spacer.gif";
                m_strCurrentBreadcrumb = data.TaxonomyPath.Remove(0, 1).Replace("\\", " > ");
                if ((string.IsNullOrEmpty(m_strCurrentBreadcrumb)))
                {
                    m_strCurrentBreadcrumb = "Root";
                }
                //if ((TaxonomyParentId == 0))
                //{
                //    inherittemplate.Visible = false;
                //    lblInherited.Text = "No";
                //}
                //else
                //{
                //    inherittemplate.Checked = true;
                //    taxonomytemplate.Enabled = false;
                //    inherittemplate.Visible = true;
                //    lblInherited.Text = "";
                //}
             //   TemplateData[] templates = null;
               // templates = m_refApi.GetAllTemplates("TemplateFileName");
                //taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem("-select template-", "0"));
                //if ((templates != null && templates.Length > 0))
                //{
                //    for (int i = 0; i <= templates.Length - 1; i++)
                //    {
                //        taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem(templates[i].FileName, templates[i].Id.ToString()));
                //    }
                //}

               // inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)");
               // inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)");
                //if ((TaxonomyParentId == 0))
                //{
                //    tr_config.Visible = true;
                //}
                //else
                //{
                //    tr_config.Visible = false;
                //}
               // chkConfigContent.Checked = true;
                //LoadCustomPropertyList();
                TaxonomyToolBar();
            }
        }
        catch (System.Threading.ThreadAbortException)
        {
            //Do nothing
        }
        catch (Exception ex)
        {
            Response.Redirect(AppPath + "reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message + ".") + "&LangType=" + TaxonomyLanguage, false);
        }
    }
    void Awake()
    {
        m_instance    = this;
        m_myTransform = transform;
        FillFullNameData(m_myTransform);

        m_tranInstanceBossTreasureUIGridlList = m_myTransform.Find(m_widgetToFullName["InstanceBossTreasureUIGridList"]);
        m_gridListCamera           = m_myTransform.Find(m_widgetToFullName["InstanceBossTreasureUIGridListCamera"]).GetComponentsInChildren <Camera>(true)[0];
        m_camRewardItemListInitPos = m_gridListCamera.transform.localPosition;

        m_gridListMyDragableCamera            = m_gridListCamera.GetComponentsInChildren <MyDragableCamera>(true)[0];
        m_gridListMyDragableCamera.LeftArrow  = FindTransform("InstanceBossTreasureUIArrowL").gameObject;
        m_gridListMyDragableCamera.RightArrow = FindTransform("InstanceBossTreasureUIArrowR").gameObject;

        FindTransform("InstanceBossTreasureUIBtnOK").gameObject.AddComponent <InstanceBossTreasureUIButton>();

        m_gridListCameraFX = FindTransform("InstanceBossTreasureUIGridListCameraFX").GetComponentsInChildren <Camera>(true)[0];
        m_tranInstanceBossTreasureUIGridListFX = FindTransform("InstanceBossTreasureUIGridListFX");

        // Boss宝箱奖励UI
        m_goInstanceBossTreasureUIRewardUI = FindTransform("InstanceBossTreasureUIRewardUI").gameObject;
        m_goInstanceBossTreasureUIRewardUI.SetActive(false);
        m_listInstanceBossTreasureUIRewardUIInfo.Clear();
        m_listInstanceBossTreasureUIRewardUIInfoText.Clear();
        for (int i = 1; i <= MAX_REWARD_COUNT; i++)
        {
            GameObject goReward = FindTransform("InstanceBossTreasureUIRewardUIInfo" + i).gameObject;
            m_listInstanceBossTreasureUIRewardUIInfo.Add(goReward);
            m_listInstanceBossTreasureUIRewardUIInfoText.Add(goReward.GetComponentsInChildren <UILabel>(true)[0]);
        }

        // ChineseData
        FindTransform("InstanceBossTreasureUITitle").GetComponentsInChildren <UILabel>(true)[0].text = LanguageData.GetContent(46982);
        FindTransform("InstanceBossTreasureUITip").GetComponentsInChildren <UILabel>(true)[0].text   = LanguageData.GetContent(46983);

        Initialize();
    }
Beispiel #32
0
 /// <summary>
 /// 设置剩余购买次数
 /// </summary>
 /// <param name="times"></param>
 public void SetLastTimes(int times)
 {
     m_lblEnergyUITipLastTimesText.text = string.Format(LanguageData.GetContent(47504), times);
 }
Beispiel #33
0
        public Result Run(ConverterOptions opts, Func <string, AssemblyDefinition> resolveAssembly, Func <string, string, string> outputFilenameSelector)
        {
            var result   = new Result();
            var database = new BindingDatabase(opts.References, resolveAssembly);
            var lang     = new LanguageData(new AidlGrammar()
            {
                LanguageFlags = LanguageFlags.Default | LanguageFlags.CreateAst
            });
            var parser = new Parser(lang);

            output_path = opts.OutputDirectory;
            output_ns   = opts.OutputNS;
            foreach (var file in opts.InputFiles)
            {
                var pt = parser.Parse(File.ReadAllText(file), file);
                if (pt.HasErrors())
                {
                    foreach (var l in pt.ParserMessages)
                    {
                        result.LogMessages.Add(file, l);
                    }
                }
                else
                {
                    units.Add(file, (CompilationUnit)pt.Root.AstNode);
                }
            }
            if (result.LogMessages.Any(e => e.Value.Level == Irony.ErrorLevel.Error))
            {
                return(result);
            }

            if (output_path != null && !Directory.Exists(output_path))
            {
                Directory.CreateDirectory(output_path);
            }
            output_path = output_path ?? "./";

            var parcelables = new List <TypeName> ();

            foreach (var u in units.Values)
            {
                foreach (Parcelable t in u.Types.Where(t => t is Parcelable))
                {
                    parcelables.Add(u.Package == null ? t.Name : new TypeName(u.Package.Identifiers.Concat(t.Name.Identifiers).ToArray()));
                }
            }

            foreach (var pair in units)
            {
                string file = outputFilenameSelector(output_path, pair.Key);
                var    sw   = new StringWriter();
                new CSharpCodeGenerator(sw, database).GenerateCode(pair.Value, parcelables, opts);
                string csharp = sw.ToString();
                if (pair.Value.Package != null && output_ns != null)
                {
                    csharp = csharp.Replace(pair.Value.Package.ToString(), output_ns);
                }
                using (var fw = File.CreateText(file))
                    fw.Write(csharp);
                FileWritten(file, csharp);
            }

            return(result);
        }
Beispiel #34
0
 /// <summary>
 /// 设置体力
 /// </summary>
 /// <param name="energy"></param>
 public void SetEnergy(string energy)
 {
     m_lblEnergyUIProgressBarText.text = string.Format(LanguageData.GetContent(47503), energy);
 }
Beispiel #35
0
        public DbShellLanguageProvider()
        {
            //Terminals
            var tident            = new IdentifierTerminal("identifier");
            var tstringQuot       = new StringLiteral("stringQuot", "\"");
            var tstringApos       = new StringLiteral("stringSpos", "'");
            var tstringTripleQuot = new StringLiteral("stringTripleQuot", "\"\"\"", StringOptions.AllowsLineBreak);
            var tstringTripleApos = new StringLiteral("stringTripleApos", "'''", StringOptions.AllowsLineBreak);
            var tnumber           = new NumberLiteral("number");
            var tcomma            = ToTerm(",");
            var litTrue           = ToTerm("true", "true");
            var litFalse          = ToTerm("false", "false");

            //Nonterminals
            var nCommand = new NonTerminal("Command");
            var nAssign  = new NonTerminal("Assign");
            var nCommandWithSemicolon = new NonTerminal("CommandWithSemicolon");
            var nCommandList          = new NonTerminal("CommandList");
            var nCommandPropList      = new NonTerminal("CommandPropList");
            var nCommandProp          = new NonTerminal("CommandProp");
            var nSubcommandList       = new NonTerminal("SubCommandList");
            var nSubcommand           = new NonTerminal("SubCommand");
            var nCommandValue         = new NonTerminal("CommandValue");
            var nOptionalIdent        = new NonTerminal("OptionalIdent");
            var nCommandParams        = new NonTerminal("CommandParams");
            var nString = new NonTerminal("String");

            var narray   = new NonTerminal("Array");
            var narrayBr = new NonTerminal("ArrayBr");
            var nvalue   = new NonTerminal("Value");
            var nprop    = new NonTerminal("Property");

            nCommand.Rule  = tident + "(" + nCommandParams + ")" + nSubcommandList;
            nCommand.Rule |= nAssign;
            nAssign.Rule   = tident + "=" + nString;
            nCommandWithSemicolon.Rule  = nCommand;
            nCommandWithSemicolon.Rule |= nCommand + ";";
            nCommandList.Rule           = MakeStarRule(nCommandList, nCommandWithSemicolon);

            nCommandPropList.Rule = MakeStarRule(nCommandPropList, tcomma, nCommandProp);
            nCommandParams.Rule   = nCommandPropList | nCommandValue;
            nCommandValue.Rule    = nString | nCommand | litTrue | litFalse;
            nCommandProp.Rule     = tident + "=" + nCommandValue;
            nSubcommandList.Rule  = MakeStarRule(nSubcommandList, nSubcommand);
            nOptionalIdent.Rule   = Empty | tident;
            nSubcommand.Rule      = nOptionalIdent + "{" + nCommandList + "}";
            nString.Rule          = tstringQuot | tstringApos | tstringTripleQuot | tstringTripleApos;

            MarkPunctuation("{", "}", "(", ")", "=", ",", ";");
            MarkTransient(nCommandWithSemicolon, nOptionalIdent, nCommandParams, nString);

            var singleLineComment = new CommentTerminal("SingleLineComment", "//", "\r", "\n", "\u2085", "\u2028", "\u2029");
            var delimitedComment  = new CommentTerminal("DelimitedComment", "/*", "*/");

            NonGrammarTerminals.Add(singleLineComment);
            NonGrammarTerminals.Add(delimitedComment);

            this.Root = nCommandList;

            // build language
            DbShellLanguage = new LanguageData(this);
        }
Beispiel #36
0
 /// <summary>
 /// 设置体力购买次数刷新时间
 /// </summary>
 /// <param name="time"></param>
 public void SetTipRefresh(int time)
 {
     m_lblEnergyUITipRefreshText.text = string.Format(LanguageData.GetContent(47502), time);
 }
Beispiel #37
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            if (!TextArea.Text.Equals(string.Empty))
            {
                Consola.Text = "";
                Gramatica    grammar  = new Gramatica();
                LanguageData lenguaje = new LanguageData(grammar);
                Parser       parser   = new Parser(lenguaje);
                ParseTree    arbol    = parser.Parse(TextArea.Text);

                if (arbol.ParserMessages.Count != 0)
                {
                    MessageBox.Show("Se han encontrado errores", "Errores",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);

                    List <LogMessage> errores = arbol.ParserMessages;
                    foreach (LogMessage error in errores)
                    {
                        if (error.Message.Contains("Sintax"))
                        {
                            Consola.AppendText("Error Sintactico, " + error.Message + " Linea: " + error.Location.Line + ", Columna: " + error.Location.Column);
                        }
                        else
                        {
                            Consola.AppendText("Error Lexico, " + error.Message + " Linea: " + error.Location.Line + ", Columna: " + error.Location.Column);
                        }
                    }
                }
                else
                {
                    GeneradorAST generadorAST = new GeneradorAST(arbol);
                    AST          ast          = generadorAST.arbol;
                    Entorno      ent          = new Entorno(null);

                    if (ast != null)
                    {
                        foreach (Instruccion ins in ast.Instrucciones)
                        {
                            ins.ejecutar(ent, ast);
                        }

                        if (ast.existeFuncion("main"))
                        {
                            Funcion main = ast.getFuncion("main");
                            foreach (Instruccion ins in main.instrucciones)
                            {
                                ins.ejecutar(ent, ast);
                            }
                        }
                        else
                        {
                            MessageBox.Show("No se encontró la funcion main!!", "Errores",
                                            MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                        }

                        Graficador j = new Graficador();
                        j.graficar(arbol.Root);
                    }
                    else
                    {
                        MessageBox.Show("Error generando el AST", "Errores",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    }
                }
            }
        }
Beispiel #38
0
 /// <summary>
 /// 设置玩家自己的排名
 /// </summary>
 /// <param name="rank"></param>
 public void SetMyRankNum(int rank)
 {
     if (rank > 0 && rank <= MAXRANKNUM)
     {
         m_lblRankingUIMyRankText.text = string.Format(LanguageData.GetContent(47401), rank);
     }
     else
     {
         m_lblRankingUIMyRankText.text = string.Format(LanguageData.GetContent(47401), LanguageData.GetContent(47400));
     }
 }
Beispiel #39
0
    void OnRefreshMailGridList()
    {
        LoggerHelper.Debug("RefreshMailGridList " + MailManager.Instance.IsMailInfoDirty);

        if (MailManager.Instance.GetMailInfoList().Count > 0)
        {
            SocietyUIViewManager.Instance.ShowDeleteReadBtn(true);
            SocietyUIViewManager.Instance.ShowMailVolume(true);
            SocietyUIViewManager.Instance.ShowNoMailBoxText(false);
            SocietyUIViewManager.Instance.SetMailVolume(MailManager.Instance.GetMailInfoList().Count.ToString() + "/60");
        }
        else
        {
            SocietyUIViewManager.Instance.ShowDeleteReadBtn(false);
            SocietyUIViewManager.Instance.ShowMailVolume(false);
            SocietyUIViewManager.Instance.ShowNoMailBoxText(true);
        }


        if (true)
        {
            MailManager.Instance.IsMailInfoDirty = false;

            SocietyUIViewManager.Instance.ClearMailGridList();
            List <Mogo.Game.MailInfo> m_listMailInfo = MailManager.Instance.GetMailInfoList();
            //sort

            System.Comparison <Mogo.Game.MailInfo> com = new System.Comparison <Mogo.Game.MailInfo>(
                (a, b) =>
            {
                if (a.state == b.state)
                {
                    return(b.time - a.time);
                }

                if (a.state == MAIL_STATE.ATTACH_NO_READ)
                {
                    return(-1);
                }

                if (b.state == MAIL_STATE.ATTACH_NO_READ)
                {
                    return(1);
                }


                if (a.state == MAIL_STATE.NO_ATTACH_NO_READ)
                {
                    return(-1);
                }

                if (b.state == MAIL_STATE.NO_ATTACH_NO_READ)
                {
                    return(1);
                }


                if (a.state == MAIL_STATE.ATTACH_READ)
                {
                    return(-1);
                }

                if (b.state == MAIL_STATE.ATTACH_READ)
                {
                    return(1);
                }


                //默认按时间降序
                return(b.time - a.time);
            }
                );
            m_listMailInfo.Sort(com);

            Mogo.Util.LoggerHelper.Debug(m_listMailInfo.Count);


            for (int i = 0; i < m_listMailInfo.Count; ++i)
            {
                MailGridData md = new MailGridData();
                if (m_listMailInfo[i].mailType == MAIL_TYPE.ID)
                {
                    try
                    {
                        int fromId = System.Int32.Parse(m_listMailInfo[i].from);
                        md.name = LanguageData.GetContent(fromId);
                        int titleId = System.Int32.Parse(m_listMailInfo[i].title);
                        md.topic = LanguageData.GetContent(titleId);
                    }
                    catch (System.Exception ex)
                    {
                        md.name  = m_listMailInfo[i].from;
                        md.topic = m_listMailInfo[i].title;
                        LoggerHelper.Except(ex);
                    }
                }
                else
                {
                    md.name  = m_listMailInfo[i].from;
                    md.topic = m_listMailInfo[i].title;
                }

                md.mailId = m_listMailInfo[i].id;

                switch (m_listMailInfo[i].state)
                {
                case MAIL_STATE.NO_ATTACH_NO_READ:
                    md.isNoRead       = true;
                    md.isAttachNoRead = false;
                    md.isAttachRead   = false;
                    md.isRead         = false;
                    break;

                case MAIL_STATE.ATTACH_NO_READ:
                    md.isNoRead       = false;
                    md.isAttachNoRead = true;
                    md.isAttachRead   = false;
                    md.isRead         = false;
                    break;

                case MAIL_STATE.NO_ATTACH_READ:
                    md.isNoRead       = false;
                    md.isAttachNoRead = false;
                    md.isAttachRead   = false;
                    md.isRead         = true;
                    break;

                case MAIL_STATE.ATTACH_READ:
                    md.isNoRead       = false;
                    md.isAttachNoRead = false;
                    md.isAttachRead   = true;
                    md.isRead         = false;
                    break;

                case MAIL_STATE.RECV_ATTACH_READ:
                    md.isNoRead       = false;
                    md.isAttachNoRead = false;
                    md.isAttachRead   = false;
                    md.isRead         = true;
                    break;
                }
                md.time = Utils.GetTime(m_listMailInfo[i].time).ToString("MM/dd");
                SocietyUIViewManager.Instance.AddMailGrid(md);
            }

            MailManager.Instance.IsMailInfoDirty = false;
        }
    }
Beispiel #40
0
        static long runTestCode()
        {
            /*
             * Console.WriteLine("benckmark:start");
             * System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
             * sw.Start();
             */
            //string code = readFile(argv[0]);
            //string code = "/* 111 */ 2";
            //string code = "1";
            //string code = ":aaaa";
            //string code = "\"Hello\"";
            //string code = "true";
            //string code = "nl";
            //string code = "/regex/";
            //string code = "[]";
            //string code = "{}";
            //string code = "do |a| end";
            //string code = "-> do |a| end";
            //string code = "a=1";
            //string code = "a=1; a";
            //string code = "let a=1; a";
            //string code = "b? = 2; b?";
            //string code = "@a = 3; @a";
            //string code = "@@a = 4; @@a";
            //string code = "let a";
            //string code = "1; 2; 3";
            //string code = "a='(1+2); ?a";
            //string code = "a='(1+2); `(1+3)";
            //string code = "a='(2+3); `(1+?a)";
            //string code = "1+a";
            //string code = "1+1";
            //string code = "2*3";
            //string code = "!true";
            //string code = "1+2*3+4";
            //string code = "1.to_s()";
            //string code = "Console";
            string code = "Console.WriteLine(\"Hello,World\")";

            //string code = "def hoge() end";
            //string code = "def hoge(a) 1; 2; 3 end";
            //string code = "def hoge(a, b) 1; 2; 3 end";
            //string code = "public def hoge(a) 1; 2; 3 end";
            //string code = "abc=1+5*5; abc";
            //string code = "def bbb(a,b,c) 1; 2; c end; bbb(1,2,3)";
            //string code = "class Aaa; 1;2;3 end";
            //string code = "public class A; 1;2;3 end";
            //string code = "public class A < B; 1;2;3 end";
            //string code = "module Aaa; 1;2;3 end";
            //string code = "public module Aaa; 1;2;3 end";
            //string code = "if true; 1 end";
            //string code = "if false; 1 else 2 end";
            //string code = "if false; 1 elsif true; 2 end";
            //string code = "case 1; end";
            //string code = "case false; else 1 end";
            //string code = "case 1; when 1; 3 end";
            Debug.WriteLine("initialize");
            var parser = new Parser.LpGrammer();
            //Console.WriteLine("initialize parser");
            var language = new LanguageData(parser);
            //Console.WriteLine("initialize language");
            ScriptApp app = new ScriptApp(language);

            Debug.WriteLine("parse");
            var tree = app.Parser.Parse(code);

            //Console.WriteLine("tree");
            //Console.WriteLine(tree);

            /*
             * if (tree.HasErrors())
             * {
             *  Console.WriteLine(tree.ParserMessages.First().Message);
             *  Console.WriteLine(tree.FileName);
             *  Console.WriteLine(tree.ParserMessages.First().Location);
             *  return 0;
             * }
             */


            Debug.WriteLine("evaluate");

            Object.LpObject result = null;
            try
            {
                result = (Object.LpObject)app.Evaluate(tree);
                if (result == null)
                {
                    Debug.WriteLine("null");
                }
                else
                {
                    Console.WriteLine(result);
                    Console.WriteLine("result: {0}", result);
                    result.funcall("display", new Object.LpObject[] { }, null);
                }
            }
            catch (Error.LpError e)
            {
                Console.WriteLine(e.ToString());
            }
            Debug.WriteLine("Finish");

            /*
             * sw.Stop();
             * Console.WriteLine(sw.Elapsed.TotalSeconds);
             * Console.WriteLine("benckmark:end");
             */
            return(0);
        }
Beispiel #41
0
        private object Ejecutar(ParseTreeNode nodo)
        {
            string produccion = nodo.Term.Name.ToString();
            int    tipo_real  = 0;

            switch (produccion)
            {
            case "DATABASES2":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Database> bases = (List <Database>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    bases.Add((Database)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(bases);
                }
                else if (nodo.ChildNodes.Count == 1)
                {
                    List <Database> bases = new List <Database>
                    {
                        (Database)Ejecutar(nodo.ChildNodes.ElementAt(0))
                    };
                    return(bases);
                }
                else
                {
                    return(new List <Database>());
                }

            case "DATABASE":
                List <Tipo_Objeto> lst_objetos = (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(1));
                Database           new_db      = new Database();

                foreach (Tipo_Objeto item in lst_objetos)
                {
                    if (item.Name.ToLower().Equals("\"name\""))
                    {
                        new_db.Name = item.Valor.ToString();
                    }
                    else if (item.Name.ToLower().Equals("\"data\""))
                    {
                        if (item.Valor != null)
                        {
                            try
                            {
                                foreach (Tipo_Objeto item2 in (List <Tipo_Objeto>)item.Valor)
                                {
                                    if (item2.Name.Equals("table"))
                                    {
                                        new_db.Tablas.Add((Tabla)item2.Valor);
                                    }
                                    else if (item2.Name.Equals("object"))
                                    {
                                        new_db.Objetos.Add((Objeto)item2.Valor);
                                    }
                                    else if (item2.Name.Equals("procedure"))
                                    {
                                        new_db.Procedures.Add((Procedure)item2.Valor);
                                    }
                                }
                            }
                            catch (Exception)
                            {
                                Tipo_Objeto val_aux = (Tipo_Objeto)item.Valor;
                                new_db.Link      = val_aux.Link;
                                new_db.Exportada = val_aux.Export;

                                //aqui exportamos los archivos de bases de datos

                                String text = System.IO.File.ReadAllText("./NOSQL/Generados/" + new_db.Link);

                                LanguageData  lenguaje = new LanguageData(new Gramatica_Import_DATABASE());
                                Parser        parser   = new Parser(lenguaje);
                                ParseTree     arbol    = parser.Parse(text);
                                ParseTreeNode raiz     = arbol.Root;

                                if (raiz != null && arbol.ParserMessages.Count == 0)
                                {
                                    foreach (Tipo_Objeto item2 in (List <Tipo_Objeto>)Ejecutar(raiz.ChildNodes.ElementAt(0)))
                                    {
                                        if (item2.Name.Equals("table"))
                                        {
                                            new_db.Tablas.Add((Tabla)item2.Valor);
                                        }
                                        else if (item2.Name.Equals("object"))
                                        {
                                            new_db.Objetos.Add((Objeto)item2.Valor);
                                        }
                                        else if (item2.Name.Equals("procedure"))
                                        {
                                            new_db.Procedures.Add((Procedure)item2.Valor);
                                        }
                                    }
                                }
                                else
                                {
                                    Program.addError(arbol);
                                }
                            }
                        }
                    }
                }
                return(new_db);

            case "DATABASE2":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Tipo_Objeto> tipo_Objetos = (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    tipo_Objetos.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(tipo_Objetos);
                }
                else
                {
                    List <Tipo_Objeto> objetos = new List <Tipo_Objeto>
                    {
                        (Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(0))
                    };

                    return(objetos);
                }

            case "DATABASE3":
                return((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(0)));

            case "DATA":
                Tipo_Objeto objeto1 = new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), Ejecutar(nodo.ChildNodes.ElementAt(3)));
                return(objeto1);

            case "DATA5":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Tipo_Objeto> lst_general = (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    lst_general.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(lst_general);
                }
                else if (nodo.ChildNodes.Count == 1)
                {
                    if (nodo.ChildNodes.ElementAt(0).Term.Name.Equals("ruta_import"))
                    {
                        Tipo_Objeto aux__ = new Tipo_Objeto("null", "null");
                        aux__.Export = true;
                        string link = nodo.ChildNodes.ElementAt(0).Token.Text.Replace("${ ", "");
                        link       = link.Replace(" }$", "");
                        aux__.Link = link;
                        return(aux__);
                    }

                    List <Tipo_Objeto> lst_general = new List <Tipo_Objeto>();
                    lst_general.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(lst_general);
                }
                else
                {
                    return(null);
                }

            case "DATA2":
                Tabla              tabla_aux = new Tabla();
                Objeto             objeto_aux = new Objeto();
                Procedure          procedure_aux = new Procedure();
                string             name = "", cql_type = "";
                object             columna = null, data = null, attrs = null, parametros = null, instr = null;
                List <Tipo_Objeto> lst = (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(1));
                foreach (Tipo_Objeto item in lst)
                {
                    if (item.Name.ToLower().Equals("\"name\""))
                    {
                        name = item.Valor.ToString();
                    }
                    else if (item.Name.ToLower().Equals("\"cql-type\""))
                    {
                        cql_type = item.Valor.ToString();
                    }
                    else if (item.Name.ToLower().Equals("\"columns\""))
                    {
                        columna = item.Valor;
                    }
                    else if (item.Name.ToLower().Equals("\"data\""))
                    {
                        data = item.Valor;
                    }
                    else if (item.Name.ToLower().Equals("\"attrs\""))
                    {
                        attrs = item.Valor;
                    }
                    else if (item.Name.ToLower().Equals("\"parameters\""))
                    {
                        parametros = item.Valor;
                    }
                    else if (item.Name.ToLower().Equals("\"instr\""))
                    {
                        instr = item.Valor;
                    }
                }

                if (cql_type.ToLower().Equals("table"))
                {
                    tabla_aux      = new Tabla();
                    tabla_aux.Name = name;
                    if (columna != null)
                    {
                        tabla_aux.Columnas = (List <Columna>)columna;
                    }
                    else
                    {
                        tabla_aux.Columnas = new List <Columna>();
                    }
                    if (data != null)
                    {
                        try
                        {
                            List <Fila> filas = (List <Fila>)data;
                            tabla_aux.Filas = filas;
                        }
                        catch (Exception)
                        {
                            Tipo_Objeto aux2 = (Tipo_Objeto)data;
                            tabla_aux.Link      = aux2.Link;
                            tabla_aux.Exportada = aux2.Export;

                            String text = System.IO.File.ReadAllText("./NOSQL/Generados/" + tabla_aux.Link);

                            LanguageData  lenguaje = new LanguageData(new Gramatica_Import_DATA());
                            Parser        parser   = new Parser(lenguaje);
                            ParseTree     arbol    = parser.Parse(text);
                            ParseTreeNode raiz     = arbol.Root;

                            if (raiz != null && arbol.ParserMessages.Count == 0)
                            {
                                tabla_aux.Filas = (List <Fila>)Ejecutar(raiz.ChildNodes.ElementAt(0));
                            }
                            else
                            {
                                Program.addError(arbol);
                            }

                            //instanciamos un objeto para la base de datos no-sql
                        }
                    }
                    else
                    {
                        tabla_aux.Filas = new List <Fila>();
                    }

                    return(new Tipo_Objeto("table", tabla_aux));
                }
                else if (cql_type.ToLower().Equals("object"))
                {
                    objeto_aux.Name = name;
                    if (attrs != null)
                    {
                        objeto_aux.Atributos = (List <Atributo>)attrs;
                    }
                    else
                    {
                        objeto_aux.Atributos = new List <Atributo>();
                    }
                    return(new Tipo_Objeto("object", objeto_aux));
                }
                else if (cql_type.ToLower().Equals("procedure"))
                {
                    procedure_aux.Name = name;
                    if (instr != null)
                    {
                        procedure_aux.Instr = instr.ToString();
                    }
                    else
                    {
                        procedure_aux.Instr = "";
                    }
                    if (parametros != null)
                    {
                        procedure_aux.Parametros = (List <Parametro>)parametros;
                    }
                    else
                    {
                        procedure_aux.Parametros = new List <Parametro>();
                    }

                    return(new Tipo_Objeto("procedure", procedure_aux));
                }
                else
                {
                    return(new Tipo_Objeto("table", tabla_aux));
                }

            case "DATA3":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Tipo_Objeto> lst_general = (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    lst_general.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(lst_general);
                }
                else
                {
                    List <Tipo_Objeto> lst_general = new List <Tipo_Objeto>();
                    lst_general.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(lst_general);
                }

            case "DATA4":
                return((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(0)));

            case "TABLA":
                return((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(0)));

            case "OBJETO":
                return((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(0)));

            case "PROCEDURE":
                return((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(0)));

            case "COLUMNS":
                if (Ejecutar(nodo.ChildNodes.ElementAt(3)) != null)
                {
                    return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), Ejecutar(nodo.ChildNodes.ElementAt(3))));
                }
                else
                {
                    return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), null));
                }

            case "COLUMNS4":

                if (nodo.ChildNodes.Count == 3)
                {
                    List <Columna> columnas = (List <Columna>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    columnas.Add((Columna)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(columnas);
                }
                else if (nodo.ChildNodes.Count == 1)
                {
                    List <Columna> columnas = new List <Columna>();
                    columnas.Add((Columna)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(columnas);
                }
                else
                {
                    return(null);
                }

            case "COLUMNS2":

                Columna new_column = new Columna();
                foreach (Tipo_Objeto item in (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(1)))
                {
                    if (item.Name.ToLower().Equals("\"name\""))
                    {
                        new_column.Name = item.Valor.ToString();
                    }
                    else if (item.Name.ToLower().Equals("\"type\""))
                    {
                        if (item.Valor.ToString().ToLower().Contains("set"))
                        {
                            new_column.Type  = "SET";
                            new_column.Attr1 = item.Valor.ToString().ToLower().Replace("set<", "").Replace(">", "");
                        }
                        else if (item.Valor.ToString().ToLower().Contains("map"))
                        {
                            new_column.Type = "MAP";
                            string[] attrsa = item.Valor.ToString().ToLower().Replace("map<", "").Replace(">", "").Split(",");

                            new_column.Attr1 = attrsa.ElementAt(0);
                            new_column.Attr2 = attrsa.ElementAt(1);
                        }
                        else if (item.Valor.ToString().ToLower().Contains("list"))
                        {
                            new_column.Type  = "LIST";
                            new_column.Attr1 = item.Valor.ToString().ToLower().Replace("list<", "").Replace(">", "");
                        }
                        else
                        {
                            new_column.Type = item.Valor.ToString();
                        }
                    }
                    else if (item.Name.ToLower().Equals("\"pk\""))
                    {
                        if (item.Valor.ToString().ToLower().Equals("false"))
                        {
                            new_column.Pk = false;
                        }
                        else if (item.Valor.ToString().ToLower().Equals("true"))
                        {
                            new_column.Pk = true;
                        }
                        else
                        {
                            //algun error
                        }
                    }
                }
                return(new_column);

            case "COLUMNS3":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Tipo_Objeto> tipo_Objetos = (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    tipo_Objetos.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(tipo_Objetos);
                }
                else
                {
                    List <Tipo_Objeto> objetos = new List <Tipo_Objeto>();
                    objetos.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(objetos);
                }

            case "COLUMN":
                return(Ejecutar(nodo.ChildNodes.ElementAt(0)));

            case "TYPE":
                return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), Ejecutar(nodo.ChildNodes.ElementAt(2)).ToString()));

            case "PK":
                return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), Ejecutar(nodo.ChildNodes.ElementAt(2)).ToString()));

            case "BOOL":
                return(nodo.ChildNodes[0].Term.Name);

            case "AS":
                return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), Ejecutar(nodo.ChildNodes.ElementAt(2)).ToString()));

            case "IN_OUT":
                return(nodo.ChildNodes[0].Token.Text);

            case "DATA_DATA":
                //Aqui armamos las filas;
                if (Ejecutar(nodo.ChildNodes.ElementAt(3)) != null)
                {
                    return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), Ejecutar(nodo.ChildNodes.ElementAt(3))));
                }
                else
                {
                    return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), null));
                }

            case "DATA_DATA2":

                if (nodo.ChildNodes.Count == 1)
                {
                    if (nodo.ChildNodes.ElementAt(0).Term.Name.Equals("ruta_import"))
                    {
                        Tipo_Objeto aux__ = new Tipo_Objeto("null", "null");
                        string      link  = nodo.ChildNodes.ElementAt(0).Token.Text.Replace("${ ", "");
                        link         = link.Replace(" }$", "");
                        aux__.Export = true;
                        aux__.Link   = link;

                        return(aux__);
                    }

                    return(Ejecutar(nodo.ChildNodes.ElementAt(0)));
                }
                else
                {
                    return(null);
                }


            case "DATA_DATA3":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Fila> filas = (List <Fila>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    filas.Add((Fila)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(filas);
                }
                else
                {
                    List <Fila> filas = new List <Fila>();
                    filas.Add((Fila)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(filas);
                }

            case "DATA_DATA4":
                //aqui armamos la fila
                Fila fila = new Fila();
                fila.Valores = (List <Valor>)Ejecutar(nodo.ChildNodes.ElementAt(1));
                return(fila);

            case "DATA_DATA5":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Valor> valors = (List <Valor>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    valors.Add((Valor)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(valors);
                }
                else
                {
                    List <Valor> valors = new List <Valor>();
                    valors.Add((Valor)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(valors);
                }

            case "DATA_DATA6":
                tipo_real = getType(nodo.ChildNodes[2].ChildNodes.ElementAt(0));
                Valor val = new Valor(Ejecutar(nodo.ChildNodes.ElementAt(0)).ToString(), Ejecutar(nodo.ChildNodes.ElementAt(2)), tipo_real);
                return(val);

            case "ATTRIBUTES":
                return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), Ejecutar(nodo.ChildNodes.ElementAt(3))));

            case "ATTRIBUTES2":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Atributo> atributos = (List <Atributo>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    atributos.Add((Atributo)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(atributos);
                }
                else if (nodo.ChildNodes.Count == 1)
                {
                    List <Atributo> atributos = new List <Atributo>();
                    atributos.Add((Atributo)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(atributos);
                }
                else
                {
                    return(new List <Atributo>());
                }

            case "ATTRIBUTES3":
                Atributo atributo_new = new Atributo();

                foreach (Tipo_Objeto item in (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(1)))
                {
                    if (item.Name.ToLower().Equals("\"name\""))
                    {
                        atributo_new.Name = item.Valor.ToString();
                    }
                    else if (item.Name.ToLower().Equals("\"type\""))
                    {
                        if (item.Valor.ToString().ToLower().Contains("set"))
                        {
                            atributo_new.Type  = "SET";
                            atributo_new.Attr1 = item.Valor.ToString().ToLower().Replace("set<", "").Replace(">", "");
                        }
                        else if (item.Valor.ToString().ToLower().Contains("map"))
                        {
                            atributo_new.Type = "MAP";
                            string[] attrsa = item.Valor.ToString().ToLower().Replace("map<", "").Replace(">", "").Split(",");

                            atributo_new.Attr1 = attrsa.ElementAt(0);
                            atributo_new.Attr2 = attrsa.ElementAt(1);
                        }
                        else if (item.Valor.ToString().ToLower().Contains("list"))
                        {
                            atributo_new.Type  = "LIST";
                            atributo_new.Attr1 = item.Valor.ToString().ToLower().Replace("list<", "").Replace(">", "");
                        }
                        else
                        {
                            atributo_new.Type = item.Valor.ToString();
                        }
                    }
                    else
                    {
                        //algun error
                    }
                }
                return(atributo_new);

            case "ATTRIBUTES4":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Tipo_Objeto> tipo_Objetos = (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    tipo_Objetos.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(tipo_Objetos);
                }
                else
                {
                    List <Tipo_Objeto> objetos = new List <Tipo_Objeto>();
                    objetos.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(objetos);
                }

            case "ATTRIBUTE":
                return(Ejecutar(nodo.ChildNodes.ElementAt(0)));

            case "INSTR":
                return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), nodo.ChildNodes.ElementAt(2).Token.Text));

            case "PARAMETERS":
                return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), Ejecutar(nodo.ChildNodes.ElementAt(3))));

            case "PARAMETERS2":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Parametro> param = (List <Parametro>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    param.Add((Parametro)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(param);
                }
                else if (nodo.ChildNodes.Count == 1)
                {
                    List <Parametro> param = new List <Parametro>();
                    param.Add((Parametro)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(param);
                }
                else
                {
                    return(new List <Parametro>());
                }

            case "PARAMETERS3":
                Parametro new_param = new Parametro();

                foreach (Tipo_Objeto item in (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(1)))
                {
                    if (item.Name.ToLower().Equals("\"name\""))
                    {
                        new_param.Name = item.Valor.ToString();
                    }
                    else if (item.Name.ToLower().Equals("\"type\""))
                    {
                        if (item.Valor.ToString().ToLower().Contains("set"))
                        {
                            new_param.Type  = "SET";
                            new_param.Attr1 = item.Valor.ToString().ToLower().Replace("set<", "").Replace(">", "");
                        }
                        else if (item.Valor.ToString().ToLower().Contains("map"))
                        {
                            new_param.Type = "MAP";
                            string[] attrsa = item.Valor.ToString().ToLower().Replace("map<", "").Replace(">", "").Split(",");

                            new_param.Attr1 = attrsa.ElementAt(0);
                            new_param.Attr2 = attrsa.ElementAt(1);
                        }
                        else if (item.Valor.ToString().ToLower().Contains("list"))
                        {
                            new_param.Type  = "LIST";
                            new_param.Attr1 = item.Valor.ToString().ToLower().Replace("list<", "").Replace(">", "");
                        }
                        else
                        {
                            new_param.Type = item.Valor.ToString();
                        }
                    }
                    else if (item.Name.ToLower().Equals("\"as\""))
                    {
                        if (item.Valor.ToString().ToLower().Equals("in"))
                        {
                            new_param.Out_ = false; new_param.Out__ = item.Valor.ToString();
                        }
                        else
                        {
                            new_param.Out_ = true; new_param.Out__ = item.Valor.ToString();
                        }
                    }
                    else
                    {
                        //algun error
                    }
                }
                return(new_param);

            case "PARAMETERS4":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Tipo_Objeto> tipo_Objetos = (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    tipo_Objetos.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(tipo_Objetos);
                }
                else
                {
                    List <Tipo_Objeto> objetos = new List <Tipo_Objeto>();
                    objetos.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(objetos);
                }

            case "PARAMETER":
                return(Ejecutar(nodo.ChildNodes.ElementAt(0)));

            case "LISTAS":
                return(Ejecutar(nodo.ChildNodes.ElementAt(1)));

            case "MAPA":
                return(Ejecutar(nodo.ChildNodes.ElementAt(1)));

            case "MAPA2":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Tipo_Objeto> valores = (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    valores.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(valores);
                }
                else if (nodo.ChildNodes.Count == 1)
                {
                    List <Tipo_Objeto> valores = new List <Tipo_Objeto>();
                    valores.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(valores);
                }
                else
                {
                    return(new List <Tipo_Objeto>());
                }

            case "MAPA3":
                tipo_real = getType(nodo.ChildNodes[2].ChildNodes.ElementAt(0));
                Tipo_Objeto ret = new Tipo_Objeto(Ejecutar(nodo.ChildNodes.ElementAt(0)).ToString(), Ejecutar(nodo.ChildNodes.ElementAt(2)));
                ret.Type = tipo_real;
                return(ret);

            case "LISTAS2":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Item_List> valores = (List <Item_List>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    valores.Add((Item_List)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(valores);
                }
                else if (nodo.ChildNodes.Count == 1)
                {
                    List <Item_List> valores = new List <Item_List>();
                    valores.Add((Item_List)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(valores);
                }
                else
                {
                    return(new List <Item_List>());
                }

            case "LISTAS3":
                tipo_real = getType(nodo.ChildNodes[0].ChildNodes.ElementAt(0));

                return(new Item_List(tipo_real, Ejecutar(nodo.ChildNodes.ElementAt(0))));


            case "USERS2":
                if (nodo.ChildNodes.ElementAt(0).Term.Name.Equals("ruta_import"))
                {
                    string link = nodo.ChildNodes.ElementAt(0).Token.Text.Replace("${ ", "");
                    link               = link.Replace(" }$", "");
                    db_nosql.Link      = link;
                    db_nosql.Importada = true;
                    String text = System.IO.File.ReadAllText("./NOSQL/Generados/" + link);

                    LanguageData  lenguaje = new LanguageData(new Gramatica_Import_User());
                    Parser        parser   = new Parser(lenguaje);
                    ParseTree     arbol    = parser.Parse(text);
                    ParseTreeNode raiz     = arbol.Root;

                    if (raiz != null && arbol.ParserMessages.Count == 0)
                    {
                        return((List <Usuario>)Ejecutar(raiz.ChildNodes.ElementAt(0)));
                    }
                    else
                    {
                        Program.addError(arbol);
                        return(new List <Usuario>());
                    }
                }
                else if (nodo.ChildNodes.Count == 3)
                {
                    List <Usuario> usuarios = (List <Usuario>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    usuarios.Add((Usuario)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(usuarios);
                }
                else if (nodo.ChildNodes.Count == 1)
                {
                    List <Usuario> users = new List <Usuario>();
                    users.Add((Usuario)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(users);
                }
                else
                {
                    return(new List <Usuario>());
                }

            case "USERS3":
                Usuario new_user = new Usuario();

                foreach (Tipo_Objeto item in (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(1)))
                {
                    if (item.Name.ToLower().Equals("\"name\""))
                    {
                        new_user.Name = item.Valor.ToString();
                    }
                    else if (item.Name.ToLower().Equals("\"password\""))
                    {
                        new_user.Password = item.Valor.ToString();
                    }
                    else if (item.Name.ToLower().Equals("\"permissions\""))
                    {
                        new_user.Permisos = (List <Permiso>)item.Valor;
                    }
                }
                return(new_user);

            case "USERS4":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Tipo_Objeto> tipo_Objetos = (List <Tipo_Objeto>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    tipo_Objetos.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(tipo_Objetos);
                }
                else
                {
                    List <Tipo_Objeto> objetos = new List <Tipo_Objeto>();
                    objetos.Add((Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(objetos);
                }

            case "USER":
                return(Ejecutar(nodo.ChildNodes.ElementAt(0)));

            case "CQL_TYPE":
                return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), Ejecutar(nodo.ChildNodes.ElementAt(2)).ToString()));

            case "NAME":
                return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), Ejecutar(nodo.ChildNodes.ElementAt(2)).ToString()));

            case "PASSWORD":
                return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), Ejecutar(nodo.ChildNodes.ElementAt(2)).ToString()));

            case "PERMISSIONS":
                return(new Tipo_Objeto(nodo.ChildNodes[0].Term.Name.ToString(), Ejecutar(nodo.ChildNodes.ElementAt(3))));

            case "VALOR":
                String evaluar = nodo.ChildNodes[0].Term.Name;
                switch (evaluar)
                {
                case "Cadena":
                    return(nodo.ChildNodes[0].ToString().Replace(" (Cadena)", ""));

                case "Identificador":
                    return(nodo.ChildNodes[0].ToString().Replace(" (Identificador)", ""));

                case "Numero":
                    return(nodo.ChildNodes[0].Token.Text);

                case "NULL":
                    return(null);

                case "Time":
                    return(nodo.ChildNodes[0].Token.Text);

                case "FALSE":
                    return(false);

                case "TRUE":
                    return(true);

                case "Date":
                    return(nodo.ChildNodes[0].Token.Text);

                case "LISTAS":
                    return(Ejecutar(nodo.ChildNodes.ElementAt(0)));

                case "MAPA":
                    return(Ejecutar(nodo.ChildNodes.ElementAt(0)));

                default:
                    return("");
                }

            case "PERMISSIONS2":
                if (nodo.ChildNodes.Count == 3)
                {
                    List <Permiso> permisos = (List <Permiso>)Ejecutar(nodo.ChildNodes.ElementAt(0));
                    permisos.Add((Permiso)Ejecutar(nodo.ChildNodes.ElementAt(2)));
                    return(permisos);
                }
                else if (nodo.ChildNodes.Count == 1)
                {
                    List <Permiso> permisos = new List <Permiso>();
                    permisos.Add((Permiso)Ejecutar(nodo.ChildNodes.ElementAt(0)));
                    return(permisos);
                }
                else
                {
                    return(new List <Permiso>());
                }

            case "PERMISSION":
                Tipo_Objeto aux     = (Tipo_Objeto)Ejecutar(nodo.ChildNodes.ElementAt(1));
                Permiso     permiso = new Permiso(aux.Valor.ToString());
                return(permiso);
            }
            return(null);
        }
Beispiel #42
0
        public virtual async Task RebuildAsync(XmlSitemapBuildContext ctx)
        {
            Guard.NotNull(ctx, nameof(ctx));

            var languageData = new Dictionary <int, LanguageData>();

            foreach (var language in ctx.Languages)
            {
                var lockFilePath = GetLockFilePath(ctx.Store.Id, language.Id);

                if (_lockFileManager.TryAcquireLock(lockFilePath, out var lockFile))
                {
                    // Process only languages that are unlocked right now
                    // It is possible that an HTTP request triggered the generation
                    // of a language specific sitemap.

                    var sitemapDir = BuildSitemapDirPath(ctx.Store.Id, language.Id);
                    var data       = new LanguageData
                    {
                        Store        = ctx.Store,
                        Language     = language,
                        LockFile     = lockFile,
                        LockFilePath = lockFilePath,
                        TempDir      = sitemapDir + "~",
                        FinalDir     = sitemapDir,
                        BaseUrl      = BuildBaseUrl(ctx.Store, language)
                    };

                    _tenantFolder.TryDeleteDirectory(data.TempDir);
                    _tenantFolder.CreateDirectory(data.TempDir);

                    languageData[language.Id] = data;
                }
            }

            if (languageData.Count == 0)
            {
                Logger.Warn("XML sitemap rebuild already in process.");
                return;
            }

            var languages   = languageData.Values.Select(x => x.Language);
            var languageIds = languages.Select(x => x.Id).Concat(new[] { 0 }).ToArray();

            // All sitemaps grouped by language
            var sitemaps = new Multimap <int, XmlSitemapNode>();

            var compositeFileLock = new ActionDisposable(() =>
            {
                foreach (var data in languageData.Values)
                {
                    data.LockFile.Release();
                }
            });

            using (compositeFileLock)
            {
                // Impersonate
                var prevCustomer = _services.WorkContext.CurrentCustomer;
                // no need to vary xml sitemap by customer roles: it's relevant to crawlers only.
                _services.WorkContext.CurrentCustomer = _customerService.GetCustomerBySystemName(SystemCustomerNames.SearchEngine);

                try
                {
                    var nodes = new List <XmlSitemapNode>();

                    var queries = CreateQueries(ctx);
                    var total   = await queries.GetTotalRecordCountAsync();

                    var totalSegments = (int)Math.Ceiling(total / (double)MaximumSiteMapNodeCount);
                    var hasIndex      = totalSegments > 1;
                    var indexNodes    = new Multimap <int, XmlSitemapNode>();
                    var segment       = 0;
                    var numProcessed  = 0;

                    CheckSitemapCount(totalSegments);

                    using (new DbContextScope(autoDetectChanges: false, forceNoTracking: true, proxyCreation: false, lazyLoading: false))
                    {
                        var entities = EnumerateEntities(queries);

                        foreach (var batch in entities.Slice(MaximumSiteMapNodeCount))
                        {
                            if (ctx.CancellationToken.IsCancellationRequested)
                            {
                                break;
                            }

                            segment++;
                            numProcessed = segment * MaximumSiteMapNodeCount;
                            ctx.ProgressCallback?.Invoke(numProcessed, total, "{0} / {1}".FormatCurrent(numProcessed, total));

                            var firstEntityName = batch.First().EntityName;
                            var lastEntityName  = batch.Last().EntityName;

                            var slugs = GetUrlRecordCollectionsForBatch(batch, languageIds);

                            foreach (var data in languageData.Values)
                            {
                                var language = data.Language;
                                var baseUrl  = data.BaseUrl;

                                // Create all node entries for this segment
                                sitemaps[language.Id].AddRange(batch.Select(x => new XmlSitemapNode
                                {
                                    LastMod = x.LastMod,
                                    Loc     = BuildNodeUrl(baseUrl, x, slugs[x.EntityName], language)
                                }));

                                // Create index node for this segment/language combination
                                if (hasIndex)
                                {
                                    indexNodes[language.Id].Add(new XmlSitemapNode
                                    {
                                        LastMod = sitemaps[language.Id].Select(x => x.LastMod).Where(x => x.HasValue).DefaultIfEmpty().Max(),
                                        Loc     = GetSitemapIndexUrl(segment, baseUrl),
                                    });
                                }

                                if (segment % 5 == 0 || segment == totalSegments)
                                {
                                    // Commit every 5th segment (10.000 nodes) temporarily to disk to minimize RAM usage
                                    var documents = GetSiteMapDocuments((IReadOnlyCollection <XmlSitemapNode>)sitemaps[language.Id]);
                                    await SaveTempAsync(documents, data, segment - documents.Count + (hasIndex ? 1 : 0));

                                    documents.Clear();
                                    sitemaps.RemoveAll(language.Id);
                                }
                            }

                            slugs.Clear();

                            //GC.Collect();
                            //GC.WaitForPendingFinalizers();
                        }

                        // Process custom nodes
                        if (!ctx.CancellationToken.IsCancellationRequested)
                        {
                            ctx.ProgressCallback?.Invoke(numProcessed, total, "Processing custom nodes".FormatCurrent(numProcessed, total));
                            ProcessCustomNodes(ctx, sitemaps);

                            foreach (var data in languageData.Values)
                            {
                                if (sitemaps.ContainsKey(data.Language.Id) && sitemaps[data.Language.Id].Count > 0)
                                {
                                    var documents = GetSiteMapDocuments((IReadOnlyCollection <XmlSitemapNode>)sitemaps[data.Language.Id]);
                                    await SaveTempAsync(documents, data, (segment + 1) - documents.Count + (hasIndex ? 1 : 0));
                                }
                                else if (segment == 0)
                                {
                                    // Ensure that at least one entry exists. Otherwise,
                                    // the system will try to rebuild again.
                                    var homeNode = new XmlSitemapNode {
                                        LastMod = DateTime.UtcNow, Loc = data.BaseUrl
                                    };
                                    var documents = GetSiteMapDocuments(new List <XmlSitemapNode> {
                                        homeNode
                                    });
                                    await SaveTempAsync(documents, data, 0);
                                }
                            }
                        }
                    }

                    ctx.CancellationToken.ThrowIfCancellationRequested();

                    ctx.ProgressCallback?.Invoke(totalSegments, totalSegments, "Finalizing...'");

                    foreach (var data in languageData.Values)
                    {
                        // Create index documents (if any)
                        if (hasIndex && indexNodes.Any())
                        {
                            var indexDocument = CreateSitemapIndexDocument(indexNodes[data.Language.Id]);
                            await SaveTempAsync(new List <string> {
                                indexDocument
                            }, data, 0);
                        }

                        // Save finally (actually renames temp folder)
                        SaveFinal(data);
                    }
                }
                finally
                {
                    // Undo impersonation
                    _services.WorkContext.CurrentCustomer = prevCustomer;
                    sitemaps.Clear();

                    foreach (var data in languageData.Values)
                    {
                        if (_tenantFolder.DirectoryExists(data.TempDir))
                        {
                            _tenantFolder.TryDeleteDirectory(data.TempDir);
                        }
                    }

                    //GC.Collect();
                    //GC.WaitForPendingFinalizers();
                }
            }
        }
Beispiel #43
0
    public void SetView(TowerData data)
    {
        int vipLevel = MogoWorld.thePlayer.VipLevel;

        TimerManager.GetTimer(m_buttonNormal.gameObject).StartTimer(data.CountDown,
                                                                    (sec) => { m_buttonNormal.GetComponentsInChildren <UILabel>(true)[0].text = String.Concat((sec / 3600), ":", (sec % 3600) / 60, ":", ((sec % 3600) % 60)); m_sweepReady = true; },
                                                                    () => { m_buttonNormal.GetComponentsInChildren <UILabel>(true)[0].text = LanguageData.dataMap.Get(810).content; m_sweepReady = false; });
        m_highHistory.text = LanguageData.GetContent(801, data.Highest);
        //m_currentLevel.text = LanguageData.GetContent(802, data.CurrentLevel);

        if (vipLevel == 0)
        {
            //非VIP
            m_buttonVIP.SetButtonText(LanguageData.GetContent(808));
            m_leftVIPSweepCount.text = LanguageData.GetContent(20019, vipLevel + 1, PrivilegeData.dataMap[vipLevel + 1].dailyTowerSweepLimit);
        }
        else
        {
            int leftCount = PrivilegeData.dataMap[vipLevel].dailyTowerSweepLimit - data.VIPSweepUsed;
            m_buttonVIP.SetButtonText(LanguageData.GetContent(807, leftCount));

            if (vipLevel >= GlobalData.dataMap[0].tower_all_sweep_vip_level)
            {
                m_leftVIPSweepCount.text = LanguageData.GetContent(20021, vipLevel);
                //隐藏普通扫荡,vip扫荡改为全部扫荡
                m_buttonNormal.gameObject.SetActive(false);
                m_buttonVIP.SetButtonText(LanguageData.GetContent(809));
            }
            else if (vipLevel + 1 == GlobalData.dataMap[0].tower_all_sweep_vip_level)
            {
                m_leftVIPSweepCount.text = LanguageData.GetContent(20020, vipLevel + 1);
            }
            else
            {
                m_leftVIPSweepCount.text = LanguageData.GetContent(20019, vipLevel + 1, PrivilegeData.dataMap[vipLevel + 1].dailyTowerSweepLimit);
            }
        }
        m_leftChallengeCount.text = LanguageData.GetContent(803, data.FailCount);
        m_lblGuide.text           = LanguageData.dataMap.Get(vipLevel + 20006).content;

        if (data.CurrentLevel > data.Highest)
        {
            m_buttonVIP.Clickable    = false;
            m_buttonNormal.Clickable = false;
        }
        else
        {
            m_buttonVIP.Clickable    = true;
            m_buttonNormal.Clickable = true;
        }
        int iter    = 0;
        var rwdList = m_rewardList.GetComponentsInChildren <MogoListImproved>(true);

        if (rwdList[0].DataList.Count > 0)
        {
            foreach (var towerXML in TowerXMLData.dataMap)
            {
                TowerRewardUnit unit = (TowerRewardUnit)(rwdList[0].DataList[iter]);
                if (data.Items.ContainsValue(towerXML.Key))
                {
                    unit.IsAlreadyGet = true;
                }
                else
                {
                    unit.IsAlreadyGet = false;
                }
                unit.force = LanguageData.GetContent(20099, MissionData.dataMap.FirstOrDefault(
                                                         x =>
                                                         MapData.dataMap.Get(x.Value.mission).type == MapType.ClimbTower &&
                                                         x.Value.difficulty == unit.RewardID - 9)
                                                     .Value.minimumFight.ToString());
                unit.PicID = (unit.RewardID / 10 - 1) % 3;

                if (((data.CurrentLevel % 10 == 0 ? data.CurrentLevel : (data.CurrentLevel / 10 + 1) * 10) == unit.RewardID))
                {
                    unit.TowerDesc    = LanguageData.GetContent(802, data.CurrentLevel);
                    unit.forceCurrent = LanguageData.GetContent(20099,
                                                                (MissionData.dataMap.FirstOrDefault(x =>
                                                                                                    MapData.dataMap.Get(x.Value.mission).type == MapType.ClimbTower &&
                                                                                                    x.Value.difficulty == data.CurrentLevel)
                                                                 .Value.minimumFight).ToString());
                    unit.Grey      = false;
                    unit.HighLight = true;
                    unit.Unlocked  = true;
                }
                else if (((data.CurrentLevel % 10 == 0 ? data.CurrentLevel : (data.CurrentLevel / 10 + 1) * 10) < unit.RewardID))
                {
                    unit.TowerDesc = string.Empty;
                    unit.Grey      = true;// true;
                    unit.Unlocked  = false;
                    unit.HighLight = false;
                }
                else
                {
                    unit.TowerDesc = string.Empty;
                    unit.Grey      = false;
                    unit.HighLight = false;
                    unit.Unlocked  = true;
                }

                iter++;
            }
        }
        MogoGlobleUIManager.Instance.ShowWaitingTip(false);
    }
        public void analizer(String cadena, string paths)
        {
            ReporteController.Instance.set_path(paths);


            GrammarPascal grammar      = new GrammarPascal();
            LanguageData  languageData = new LanguageData(grammar);
            //ArrayList elemetos_heredados = new ArrayList();


            var i = new LanguageData(grammar);

            foreach (var item in i.Errors)
            {
                System.Diagnostics.Debug.WriteLine(item);
            }
            Parser        parser = new Parser(new LanguageData(grammar));
            ParseTree     tree   = parser.Parse(cadena);
            ParseTreeNode root   = tree.Root;



            if (tree.ParserMessages.Count > 0)
            {
                foreach (var err in tree.ParserMessages)
                {
                    //Errores lexicos
                    if (err.Message.Contains("Invalid character"))
                    {
                        ErrorController.Instance.LexicalError(err.Message, err.Location.Line + 1, err.Location.Column);
                    }
                    //Errores sintacticos
                    else
                    {
                        ErrorController.Instance.SyntacticError(err.Message, err.Location.Line + 1, err.Location.Column);
                    }
                }
                return;
            }
            if (root == null)
            {
                return;
            }
            //PROGRAM BODY -> GRAMATICA

            var program_body = root.ChildNodes[0].ChildNodes[3];

            //LISTADO DE TYPES Y ARREGLOS
            LinkedList <Instruction> lista_types = new LinkedList <Instruction>();

            lista_types = (new TypeAST()).TYPE_LIST(program_body.ChildNodes[0], lista_types, 1);

            //LISTADO DE DECLARACIONES
            LinkedList <Instruction> lista_declaraciones = new LinkedList <Instruction>();
            ArrayList elemetos_heredados = new ArrayList();

            lista_declaraciones = (new DeclarationAST()).LIST_DECLARATIONS(program_body.ChildNodes[1], lista_declaraciones, elemetos_heredados, 1);

            //LISTA DE FUNCIONES
            LinkedList <Instruction> lista_funciones = new LinkedList <Instruction>();

            elemetos_heredados.Clear();
            lista_funciones = (new FunctionAST()).FUNCTION_LIST(program_body.ChildNodes[2], lista_funciones, elemetos_heredados, 0);

            //LISTADO DE SENTENCIAS SENTENCIAS
            LinkedList <Instruction> listaInstrucciones = (new InstructionAST()).INSTRUCTIONS_BODY(program_body.ChildNodes[3], 1);


            execute(lista_declaraciones, lista_funciones, listaInstrucciones);
        }
Beispiel #45
0
 void ShowTooltips(String text)
 {
     MogoGlobleUIManager.Instance.Confirm(text, (rst) => { MogoGlobleUIManager.Instance.ConfirmHide(); }, LanguageData.GetContent(25561), LanguageData.GetContent(25562));
 }
Beispiel #46
0
 /// <summary>
 /// 设置自动退出副本时间
 /// </summary>
 /// <param name="downCount"></param>
 private void SetLeaveTime(int downCount)
 {
     m_lblOccupyTowerPassUICountDown.text = string.Format(LanguageData.GetContent(48904), downCount);
 }
Beispiel #47
0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        //Put user code to initialize the page here
        //string var1 = "";
        string var2 = "";

        if (!string.IsNullOrEmpty(Request.QueryString["fromModal"]))
        {

            fromModal = Convert.ToBoolean(Request.QueryString["fromModal"]);
            commerceAdmin = m_refSiteApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommerceAdmin);
            cancelJavascript = "if ('function' == typeof parent.EktronUiDialogClose) { parent.EktronUiDialogClose('email'); } else { parent.ektb_remove(); }";

        }

        RegisterResources();
        m_refMsg = m_refSiteApi.EkMsgRef;
        if (!Utilities.ValidateUserLogin())
        {
            return;
        }
        if (m_refSiteApi.RequestInformationRef.IsMembershipUser > 0)
        {
            Response.Redirect((string)("reterror.aspx?info=" + m_refSiteApi.EkMsgRef.GetMessage("msg login cms user")), true);
            return;
        }
        ContentLanguage = m_refSiteApi.ContentLanguage;
        if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || ContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES)
        {
            ContentLanguage = m_refSiteApi.DefaultContentLanguage;
        }
        language_data = m_refSiteApi.GetLanguageById(ContentLanguage);
        BrowserCode = language_data.BrowserCode;
        strTargUserEmail = "";
        strUserFName = "";
        strUserLName = "";
        globalWarningMsg = "";
        iMaxContLength = 65000;
        localeFileString = "0000";
        m_refUser = m_refSiteApi.EkUserRef;
        m_refContent = m_refSiteApi.EkContentRef;
        UserId = Convert.ToInt64(Request.QueryString["userid"]);
        GroupId = Convert.ToInt64(Request.QueryString["groupid"]);

        UserArray = Request.QueryString["userarray"];
        GroupArray = Request.QueryString["grouparray"];
        MsgNotes = Request.QueryString["notes"];
        ContentId = Convert.ToInt64(Request.QueryString["contentid"]);
        emailclangid = Request.QueryString["emailclangid"];
        target = Request.Form["target"];
        source = Request.Form["source"];
        subject = Request.Form["subject"];
        sMessage = this.message.Content;
        AppeWebPath = m_refSiteApi.ApplicationPath + m_refSiteApi.AppeWebPath;
        var2 = m_refContent.GetEditorVariablev2_0(0, "email");
        EmailData.Text += m_refMail.EmailJS();
        DisplayControl();
    }
Beispiel #48
0
 private string GetName(int id)
 {
     return(LanguageData.GetContent(id));
 }
Beispiel #49
0
        private void Display_ContentTab()
        {
            content_title.Value = entry_edit_data.Title;
            if (Util_GetMode() == workareaCommerce.ModeType.Add)
                tr_Properties.Visible = true;
            if (this.m_sEditAction == "addlang")
            {
                language_data = m_refSiteApi.GetLanguageById(ContentLanguage);
                lblLangName.Text = "[" + language_data.Name + "]";
            }
            else
            {
                lblLangName.Text = string.Empty;
            }
            contentEditor.Toolbars = Ektron.ContentDesignerWithValidator.Configuration.DataEntry;
            contentEditor.SetPermissions(m_cPerms);
            contentEditor.AllowFonts = true;
            if (_stylesheet != "")
            {
                contentEditor.Stylesheet = _stylesheetPath;
            }

            contentEditor.LoadPackage(m_refContentApi, editorPackage);
            string strXml = "";
            if (entry_edit_data != null)
            {
                strXml = entry_edit_data.Html;
            }
            if (Strings.Trim(strXml.Length.ToString()) == "0")
            {
                if (editorPackage.Length > 0)
                {
                    strXml = m_refContentApi.TransformXsltPackage(editorPackage, Server.MapPath((string)(contentEditor.ScriptLocation + "unpackageDocument.xslt")), true);
                }
            }
            contentEditor.DataDocumentXml = strXml;

            //set CatalogEntry_PageFunctions_Js vars - see RegisterJS() and CatalogEntry.PageFunctions.aspx under CatalogEntry/js
            _JsPageFunctions_ContentEditorId = "contentEditor";
        }
Beispiel #50
0
    private void RefreshDoorsUI()
    {
        m_currentCopyId = -1;
        DoorOfBuryUIViewManager view = DoorOfBuryUIViewManager.Instance;

        Mogo.Util.LoggerHelper.Debug("clear");
        view.ClearFriendList();
        Mogo.Util.LoggerHelper.Debug("clear done");

        // 设置湮灭之门数量
        view.SetGridNum(m_doorList.Count);

        // 创建湮灭之门Grid
        if (m_doorList.Count > 0)
        {
            for (int i = 0; i < m_doorList.Count; ++i)
            {
                FriendGridData  fd   = new FriendGridData();
                DoorOfBurryData data = m_doorList[i];
                fd.Id = i;

                //LoggerHelper.Error(data.leftTime);
                int leftTime = (int)data.leftTime;

                fd.hour  = leftTime / 3600;
                fd.minus = (leftTime % 3600) / 60;
                //Debug.LogError("hour:" + fd.hour);
                //Debug.LogError("minus:" + fd.minus);
                //Mogo.Util.LoggerHelper.Debug("data.progress:" + data.progress);
                fd.bossHP = (int)(data.progress * 100) + "";//* 100 + "%"

                fd.bossLevel = "     level:" + data.level;
                //fd.bossName = LanguageData.dataMap.Get(monster.hpShow.Get(1)).content;
                fd.bossName = data.bossName;
                //Mogo.Util.LoggerHelper.Debug("bossName:" + fd.bossName);
                fd.name    = data.ownerName;
                fd.headImg = IconData.GetHeadImgByVocation(data.ownerVocation);
                Mogo.Util.LoggerHelper.Debug(fd.headImg);

                fd.isHelp = false;
                fd.isKill = false;
                fd.isLose = false;
                fd.isWin  = false;

                switch ((int)data.killWay)
                {
                case (int)DoorOfBurryKillWay.Help:
                    fd.isHelp = true;
                    break;

                case (int)DoorOfBurryKillWay.Kill:
                    fd.isKill = true;
                    break;

                case (int)DoorOfBurryKillWay.None:
                    break;
                }

                //必须在最后设置
                fd.battleInfo = data.battleInfo;
                fd.isWin      = data.isWin;
                fd.isLose     = data.isLose;

                view.AddFriendListGrid(fd);
            }
        }


        int minute = CD / 60;

        if (minute > 0)
        {
            view.SetDoorTitle(LanguageData.GetContent(47110));// "湮灭之门封印中"
            view.BeginCountDown(minute + 1);
        }
        else
        {
            view.SetDoorTitle(LanguageData.GetContent(47111));// "湮灭之门"
            view.ClearDoorCD();
        }

        if (MogoUIManager.Instance != null)
        {
            //MogoUIManager.Instance.ShowMogoCommuntiyUI(CommunityUIParent.NormalMainUI, false);

            MogoUIManager.Instance.m_CommunityUI.SetActive(false);
            NormalMainUIViewManager.Instance.ShowCommunityButton(true);
        }
    }
 private VisualBasicLanguage()
 {
     _data = LanguageData.FromXml(Properties.Resources.VisualBasic);
     _stringFormatter = new VisualBasicStringFormatter();
     _numberFormatter = new VisualBasicNumberFormatter();
 }
Beispiel #52
0
        /// <summary>
        ///     Sends string(s) in a post request to the specified engine.
        /// </summary>
        /// <param name="url">The url to send the post request to.</param>
        /// <param name="input">The string(s) being sent in the post request.</param>
        /// <param name="options">The MT-Hub options.</param>
        /// <param name="srcLangCode">If an alias is being used, the source language code to use.</param>
        /// <param name="trgLangCode">If an alias is being used, the target language code to use.</param>
        /// <returns>The response from the post request.</returns>
        private static string DoPostRequest(string url, Dictionary <string, string> input, MtHubOptions options,
                                            string srcLangCode, string trgLangCode)
        {
            var apiToken = options.SecureSettings.ApiToken;

            var request = WebRequest.Create(url);

            request.Timeout = TimeOut;
            request.Method  = "POST";
            var postData = "token=" + apiToken;

            srcLangCode = LanguageData.GetIsoCode2LetterFromIsoCode3Letter(srcLangCode);
            trgLangCode = LanguageData.GetIsoCode2LetterFromIsoCode3Letter(trgLangCode);
            postData   += "&source=" + srcLangCode + "&target=" + trgLangCode;

            // if the input is not empty add the parameters (count())
            if (input != null)
            {
                foreach (var parameterKeyValuePair in input)
                {
                    var parameterValue = parameterKeyValuePair.Value.Replace("&", "%2526");
                    postData += "&segments[" + parameterKeyValuePair.Key + "]=" + parameterValue;
                }
            }

            var byteArray = Encoding.UTF8.GetBytes(postData);

            request.ContentType = "application/x-www-form-urlencoded";

            // Set the ContentLength property of the WebRequest.
            request.ContentLength = byteArray.Length;

            // Get the request stream.
            using (var dataStream = request.GetRequestStream())
            {
                // Write the data to the request stream.
                dataStream.Write(byteArray, 0, byteArray.Length);
            }

            try
            {
                using (var reader = new StreamReader(request.GetResponse().GetResponseStream()))
                {
                    var json = string.Empty;
                    var line = string.Empty;
                    while ((line = reader.ReadLine()) != null)
                    {
                        json += line;
                    }

                    return(json);
                }
            }
            catch (WebException ex)
            {
                string exMessage = ex.Message;

                if (ex.Response != null)
                {
                    using (var responseReader = new StreamReader(ex.Response.GetResponseStream()))
                    {
                        exMessage = responseReader.ReadToEnd();
                    }
                }

                return(exMessage);
            }
        }
 public LanguageDataBuilder(Grammar grammar) {
   _grammar = grammar;
   Language = new LanguageData(grammar);
 }
Beispiel #54
0
 public DefaultFluidParser(LanguageData languageData, Dictionary <string, ITag> tags, Dictionary <string, ITag> blocks)
 {
     _languageData = languageData;
     _tags         = tags;
     _blocks       = blocks;
 }
Beispiel #55
0
 internal ScannerDataBuilder(LanguageData language)
 {
     _language = language;
       _grammar = _language.Grammar;
       _grammarData = language.GrammarData;
 }
Beispiel #56
0
    private void LoginReward()
    {
        MFUIManager.GetSingleton().SwitchUIWithLoad(MFUIManager.MFUIID.RewardUI);
        RewardUILogicManager.Instance.SetUIDirty();
        MFUIManager.GetSingleton().SwitchUIWithLoad(MFUIManager.MFUIID.NewLoginRewardUI, MFUIManager.MFUIID.None, 0, true);
        List <NewLoginRewardGridData> rst = new List <NewLoginRewardGridData>();

        foreach (var item in RewardLoginData.dataMap)
        {
            if (item.Value.level.Count != 2)
            {
                Debug.Log("RewardLoginData level wrong, id: " + item.Key);
                continue;
            }
            if (m_self.level < item.Value.level[0] || m_self.level > item.Value.level[1])
            {
                continue;
            }
            NewLoginRewardGridData d = new NewLoginRewardGridData();
            d.strDays = LanguageData.GetContent(47003, item.Value.days);
            switch (MogoWorld.thePlayer.vocation)
            {
            case Vocation.Warrior:
                foreach (var i in item.Value.items1)
                {
                    d.listItemID.Add(i.Key);
                    d.listItemNum.Add(i.Value);
                }
                break;

            case Vocation.Assassin:
                foreach (var i in item.Value.items2)
                {
                    d.listItemID.Add(i.Key);
                    d.listItemNum.Add(i.Value);
                }
                break;

            case Vocation.Archer:
                foreach (var i in item.Value.items3)
                {
                    d.listItemID.Add(i.Key);
                    d.listItemNum.Add(i.Value);
                }
                break;

            case Vocation.Mage:
                foreach (var i in item.Value.items4)
                {
                    d.listItemID.Add(i.Key);
                    d.listItemNum.Add(i.Value);
                }
                break;
            }
            if (m_self.login_days < item.Value.days)
            {
                d.IsGot           = false;
                d.IsSendToMailBox = false;
            }
            else if (m_self.login_days == item.Value.days)
            {
                d.IsGot           = m_self.IsLoginRewardHasGot;
                d.IsSendToMailBox = false;
            }
            else
            {
                d.IsGot           = true;
                d.IsSendToMailBox = true;
            }
            rst.Add(d);
        }
        NewLoginRewardUILogicManager.Instance.RefreshGridList(rst);
        NewLoginRewardUILogicManager.Instance.SetUIDirty();
    }
Beispiel #57
0
    public bool ViewContent()
    {
        if (!(Request.QueryString["id"] == null))
        {
            m_intId = Convert.ToInt64(Request.QueryString["id"]);
            if (m_intId == 0)
            {
                if (!(Request.QueryString["contentid"] == null))
                {
                    m_intId = Convert.ToInt64(Request.QueryString["contentid"]);
                }
            }
        }

        if (!(Request.QueryString["action"] == null))
        {
            m_strPageAction = Convert.ToString(Request.QueryString["action"]).ToLower().Trim();
        }
        if (!(Request.QueryString["orderby"] == null))
        {
            m_strOrderBy = Convert.ToString(Request.QueryString["orderby"]);
        }
        if (!(Request.QueryString["LangType"] == null))
        {
            if (Request.QueryString["LangType"] != "")
            {
                ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]);
                m_refContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString());
            }
            else
            {
                if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "")
                {
                    ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID"));
                }
            }
        }
        else
        {
            if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "")
            {
                ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID"));
            }
        }
        if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
        {
            m_refContentApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
        }
        else
        {
            m_refContentApi.ContentLanguage = ContentLanguage;
        }
        if (!(Request.QueryString["cancelaction"] == null))
        {
            if (Convert.ToString(Request.QueryString["cancelaction"]).ToLower() == "undocheckout")
            {
                bool retval = false;
                m_refContent = m_refContentApi.EkContentRef;
                retval = m_refContent.UndoCheckOutv2_0(m_intId);
            }
        }
        language_data = (new SiteAPI()).GetLanguageById(ContentLanguage);
        LanguageName = language_data.Name;
        m_refContent = m_refContentApi.EkContentRef;
        TaskExists = m_refContent.DoesTaskExistForContent(m_intId);

        CurrentUserId = m_refContentApi.UserId;
        AppImgPath = m_refContentApi.AppImgPath;
        SitePath = m_refContentApi.SitePath;
        EnableMultilingual = m_refContentApi.EnableMultilingual;
        if (!(Request.QueryString["callerpage"] == null))
        {
            CallerPage = AntiXss.UrlEncode(Request.QueryString["callerpage"]);
        }

        if (CallerPage == "")
        {
            if (!(Request.QueryString["calledfrom"] == null))
            {
                CallerPage = AntiXss.UrlEncode(Request.QueryString["calledfrom"]);
            }
        }
        if (!(Request.QueryString["folder_id"] == null))
        {
            if (Request.QueryString["folder_id"] != "")
            {
                m_intFolderId = Convert.ToInt64(Request.QueryString["folder_id"]);
            }
        }
        if (m_intFolderId == -1)
        {
            //let try again to get folder id
            if (!(Request.QueryString["fldid"] == null))
            {
                if (Request.QueryString["fldid"] != "")
                {
                    m_intFolderId = Convert.ToInt64(Request.QueryString["fldid"]);
                }
            }
        }
        Display_ViewContent();
        return true;
    }
Beispiel #58
0
 private void UpdateChargeRewardView()
 {
     initrrd();
     if (m_self.chargeSum > 0)
     {
         List <string> prices = new List <string>();
         int           curr   = 0;
         for (int i = 0; i < rrds.Count; i++)
         {
             if (m_self.chargeSum >= rrds[i].money)
             {
                 curr = i;
                 NewChargeRewardUILogicManager.Instance.SetProgressSize(500);
             }
             if (chargedReward.Contains(rrds[i].id))
             {
                 prices.Add(LanguageData.GetContent(7802));
             }
             else
             {
                 prices.Add(rrds[i].money + "");
             }
         }
         currStep = curr;
         int size = CalChargePrg(curr, rrds[curr]);
         NewChargeRewardUILogicManager.Instance.SetProgressSize(size);
         NewChargeRewardUILogicManager.Instance.AddChargePriceItem(prices);
         NewChargeRewardUILogicManager.Instance.ShowAsCharged(true);
         var        items = GetChargeReward(rrds[curr]);
         List <int> ids   = new List <int>();
         if (items != null)
         {
             foreach (var item in items)
             {
                 if (ItemParentData.GetItem(item.Key) != null)
                 {
                     ids.Add(item.Key);
                 }
             }
             NewChargeRewardUILogicManager.Instance.SetItemList(ids);
         }
         //TimerHeap.AddTimer(500, 0, UpdateChargeBtnSt);
         //NewChargeRewardUILogicManager.Instance.ShowGetBtn(true);
     }
     else
     {
         NewChargeRewardUILogicManager.Instance.ShowAsCharged(false);
         var        items = GetDefaultChargeReward();
         List <int> ids   = new List <int>();
         if (items != null)
         {
             foreach (var item in items)
             {
                 if (ItemParentData.GetItem(item.Key) != null)
                 {
                     ids.Add(item.Key);
                 }
             }
             NewChargeRewardUILogicManager.Instance.SetItemList(ids);
         }
     }
     NewChargeRewardUILogicManager.Instance.SetUIDirty();
 }
Beispiel #59
0
 internal ParserDataBuilder(LanguageData language)
 {
     _language = language;
       _grammar = _language.Grammar;
 }
Beispiel #60
0
    /*
    ============================================================================
    Init functions
    ============================================================================
    */
    public void Init()
    {
        // first init languages
        languages = new LanguageData();

        statusValues = new  StatusValueData();
        elements = new  ElementData();
        races = new RaceData();
        sizes = new SizeData();
        areaNames = new AreaNameData();
        armors = new ArmorData();
        cameraPositions = new  CameraPositionData();
        attacks = new BaseAttackData();
        characters = new  CharacterData();
        classes = new  ClassData();
        colors = new  ColorData();
        dialoguePositions = new  DialoguePositionData();
        battleAIs = new  BattleAIData();
        enemies = new  EnemyData();
        equipParts = new  EquipmentPartData();
        formulas = new  FormulaData();
        gameSettings = new  GameSettingsData();
        items = new  ItemData();
        itemTypes = new  ItemTypeData();
        loadSaveHUD = new LoadSaveHUDData();
        mainMenu = new MainMenuData();
        skillTypes = new  SkillTypeData();
        effects = new  StatusEffectData();
        skills = new  SkillData();
        weapons = new  WeaponData();
        music = new MusicData();
        huds = new HUDData();
        recipes = new ItemRecipeData();
        fonts = new FontData();
        globalEvents = new GlobalEventData();
        teleports = new TeleportData();
        difficulties = new DifficultyData();

        // battle system
        battleAnimations = new BattleAnimationData();
        battleSystem = new BattleSystemData();
    }