Beispiel #1
0
        public override void appendData(StringBuilder sb, ContentBlock block, BlockData blockdata)
        {
            Object dicValue;

            blockdata.getDic().TryGetValue(this.getName(), out dicValue);

            if (dicValue != null)
            {
                sb.Append(dicValue);
                return;
            }

            if (this.isObject())
            {
                Dictionary <String, Object> dicValues = blockdata.getDic();
                Object obj;
                dicValues.TryGetValue(this.getObjName(), out obj);

                if (obj != null)
                {
                    Object pval = getPropertyValue(obj, _objAccessor, this.getObjName());
                    sb.Append(pval);
                    return;
                }
            }

            sb.Append(this.getRawLabelAndVar());
        }
Beispiel #2
0
        private ContentBlock CreateLocalContentBlock()
        {
            ContentBlock block = new ContentBlock();

            block.SetGadgetMaster(this);
            return(block);
        }
    public void BlockSelect(ContentBlock block, bool isOpend)
    {
        ContentBlock.AnimationType animationType;

        if (isOpend)
        {
            animationType = ContentBlock.AnimationType.Default;
        }
        else
        {
            animationType = ContentBlock.AnimationType.Close;
        }
        for (int i = 0; i < _ContentBlocks.Length; ++i)
        {
            _ContentBlocks[i].PlayAnimation(animationType);
        }
        if (isOpend)
        {
            MainCamera.Instance.ColorChange(ContentBlock.AnimationTime, Color.white);
        }
        else
        {
            MainCamera.Instance.ColorChange(2.5f, block.BackGroundColor);

            block.PlayAnimation(ContentBlock.AnimationType.Open);
        }
    }
Beispiel #4
0
        public void IsAnonymousViewCorrect(string content, bool expected)
        {
            GadgetMaster master = new GadgetMaster(testFactory);
            ContentBlock target = new ContentBlock(content, master);

            Assert.AreEqual(expected, target.IsAnonymousView());
        }
Beispiel #5
0
        public void IsProfileSubViewCorrect(string content, string testview, bool expected)
        {
            GadgetMaster master = new GadgetMaster(testFactory);
            ContentBlock target = new ContentBlock(content, master);

            Assert.AreEqual(expected, target.IsSubView(testview));
        }
Beispiel #6
0
        protected void AddImageButton_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            ContentBlock b = MyPage.MTApp.ContentServices.Columns.FindBlock(this.BlockId);

            if (b != null)
            {
                List <ContentBlockSettingListItem> settings = b.Lists.FindList("Categories");

                foreach (string category in CategoryPicker1.SelectedCategories)
                {
                    bool @add = true;
                    foreach (ContentBlockSettingListItem item in settings)
                    {
                        if (item.Setting1 == category)
                        {
                            @add = false;
                            break;
                        }
                    }
                    if (@add)
                    {
                        ContentBlockSettingListItem c = new ContentBlockSettingListItem();
                        c.Setting1 = category;
                        c.ListName = "Categories";
                        b.Lists.AddItem(c);
                        MyPage.MTApp.ContentServices.Columns.UpdateBlock(b);
                    }
                }
                BindCategoryGridView(b);
            }
        }
        //
        // GET: /ContentBlocks/CategoryMenu/
        public ActionResult Index(ContentBlock block)
        {
            CategoryMenuViewModel model = new CategoryMenuViewModel();

            LoadMenu(model, block);
            return(View(model));
        }
 public void OnPartChanged()
 {
     BackupData();
     _currentBlock = _activeBlock = _selectedBlock = null;
     UpdateData();
     ResetWidgets();
 }
Beispiel #9
0
        private void SaveData()
        {
            ContentBlock b = MyPage.MTApp.ContentServices.Columns.FindBlock(this.BlockId);

            if (b != null)
            {
                b.BaseSettings.AddOrUpdate("Title", this.TitleField.Text.Trim());

                string mode = "0";
                if (ModeField.SelectedValue != null)
                {
                    mode = ModeField.SelectedValue;
                }
                b.BaseSettings.AddOrUpdate("CategoryMenuMode", mode);
                b.BaseSettings.SetBoolSetting("ShowProductCount", this.ProductCountCheckBox.Checked);
                b.BaseSettings.SetBoolSetting("ShowCategoryCount", this.SubCategoryCountCheckBox.Checked);
                b.BaseSettings.SetBoolSetting("HomeLink", this.HomeLinkField.Checked);

                int maxDepth = 0;
                int.TryParse(this.MaximumDepth.Text.Trim(), out maxDepth);
                b.BaseSettings.SetIntegerSetting("MaximumDepth", maxDepth);

                MyPage.MTApp.ContentServices.Columns.UpdateBlock(b);
            }
        }
Beispiel #10
0
        protected void btnOkay_Click(object sender, ImageClickEventArgs e)
        {
            ContentBlock b = MyPage.MTApp.ContentServices.Columns.FindBlock(this.BlockId);

            b.BaseSettings["cssclass"] = this.cssclass.Text.Trim();
            b.BaseSettings.SetBoolSetting("ShowInOrder", this.chkShowInOrder.Checked);

            int width = 0;

            int.TryParse(this.WidthField.Text.Trim(), out width);
            if (width < 0)
            {
                width = 220;
            }
            b.BaseSettings.SetIntegerSetting("Width", width);

            int height = 0;

            int.TryParse(this.HeighField.Text.Trim(), out height);
            if (height < 0)
            {
                height = 220;
            }
            b.BaseSettings.SetIntegerSetting("Height", height);

            int pause = 0;

            int.TryParse(this.PauseField.Text.Trim(), out pause);
            b.BaseSettings.SetIntegerSetting("Pause", pause);

            this.MyPage.MTApp.ContentServices.Columns.UpdateBlock(b);

            this.NotifyFinishedEditing();
        }
        public void OnContentChanged(string[] blockIds)
        {
            if (_editor == null)
            {
                ResetWidgets();
                return;
            }

            // The active block may have been removed then added again in which case
            // the old instance is invalid but can be restored by remapping the identifier
            if ((_activeBlock != null) && !_activeBlock.IsValid())
            {
                _activeBlock = _editor.GetBlockById(_activeBlock.Id);
                if (_activeBlock == null)
                {
                    ResetWidgets();
                }
            }

            if (_activeBlock != null)
            {
                if (blockIds.Contains(_activeBlock.Id))
                {
                    _currentBlock = _activeBlock;
                    BackupData();
                    UpdateData();
                    UpdateWidgets(UpdateCause.Edit);
                }
            }
        }
Beispiel #12
0
        protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            ContentBlock b = MyPage.MTApp.ContentServices.Columns.FindBlock(this.BlockId);

            string bvin = string.Empty;

            bvin = ((GridView)sender).DataKeys[e.NewEditIndex].Value.ToString();

            ContentBlockSettingListItem c = new ContentBlockSettingListItem();

            c = b.Lists.FindSingleItem(bvin);

            if (c.Id != string.Empty)
            {
                this.EditBvinField.Value = c.Id;
                this.ImageLinkField.Text = c.Setting2;
                this.ImageUrlField.Text  = c.Setting1;
                if (c.Setting3 == "1")
                {
                    this.chkOpenInNewWindow.Checked = true;
                }
                else
                {
                    this.chkOpenInNewWindow.Checked = false;
                }
                this.AltTextField.Text = c.Setting4;
                this.btnNew.ImageUrl   = "~/BVAdmin/Images/Buttons/SaveChanges.png";
            }
        }
Beispiel #13
0
        private async void NewFile()
        {
            var cancelable = _editor.Part != null;
            var partType   = await ChoosePartType(cancelable);

            if (string.IsNullOrEmpty(partType))
            {
                return;
            }

            _lastSelectedBlock?.Dispose();
            _lastSelectedBlock = null;

            try
            {
                // Save and close current package
                SavePackage();
                ClosePackage();

                // Create package and part
                var packageName = MakeUntitledFilename();
                var package     = _engine.CreatePackage(packageName);
                var part        = package.CreatePart(partType);
                _editor.Part = part;
                _packageName = System.IO.Path.GetFileName(packageName);
                Title.Text   = _packageName + " - " + part.Type;
            }
            catch (Exception ex)
            {
                ClosePackage();

                var msgDialog = new MessageDialog(ex.ToString());
                await msgDialog.ShowAsync();
            }
        }
Beispiel #14
0
        private bool AreContentBlocksEqual(ContentBlock a, ContentBlock b)
        {
            if (a.Id != b.Id)
            {
                return(false);
            }

            if (a.Title != b.Title)
            {
                return(false);
            }

            if (a.Content != b.Content)
            {
                return(false);
            }

            if (a.Type != b.Type)
            {
                return(false);
            }

            if (a.Category != b.Category)
            {
                return(false);
            }

            return(true);
        }
        private async void NewFile()
        {
            var cancelable = _editor.Part != null;
            var partType   = await ChoosePartType(cancelable);

            if (string.IsNullOrEmpty(partType))
            {
                return;
            }

            // Close current package
            _lastSelectedBlock?.Dispose();
            _lastSelectedBlock = null;

            if (_editor.Part != null)
            {
                var part    = _editor.Part;
                var package = part?.Package;
                _editor.Part = null;
                part?.Dispose();
                package?.Dispose();
            }

            // Create package and part
            {
                var packageName = MakeUntitledFilename();
                var package     = _engine.CreatePackage(packageName);
                var part        = package.CreatePart(partType);
                _editor.Part = part;
                _packageName = System.IO.Path.GetFileName(packageName);
                Title.Text   = _packageName + " - " + part.Type;
            }
        }
        private void Next_Click(object sender, RoutedEventArgs e)
        {
            var part = _editor.Part;

            if (part != null)
            {
                var index = part.Package.IndexOfPart(part);

                if (index < part.Package.PartCount - 1)
                {
                    // Reset viewing parameters
                    UcEditor.ResetView(false);

                    // Select new part
                    _lastSelectedBlock?.Dispose();
                    _lastSelectedBlock = null;

                    _editor.Part = null;

                    var newPart = part.Package.GetPart(index + 1);
                    _editor.Part = newPart;
                    Type.Text    = _packageName + " - " + newPart.Type;

                    part.Dispose();
                }
            }
        }
Beispiel #17
0
        public static void Seed(BlogDbContext context)
        {
            context.Database.EnsureCreated();
            var blog = new BlogSite {
                Title = "Fluss", SubTitle = "Cnblogs"
            };

            context.Add(blog);
            context.SaveChanges();
            var body = new ContentBlock()
            {
                BlogId = blog.Id, Content = "<p>content block can be referred</p>"
            };
            var post = new BlogPost
            {
                Title         = "Fluss is a open-source blog engine",
                Description   = "based on .NET,fluss can save and display your work plan or blog posts。Content block referring can save your time of maintaining same content between different posts",
                AutoDesc      = "based on .NET,fluss can save and display your work plan or blog posts。Content block referring can save your time of maintaining same content between different posts",
                ContentBlocks = new List <ContentBlock> {
                    body
                }
            };

            blog.BlogPosts = new List <BlogPost> {
                post
            };
            context.SaveChanges();
            var referBlock = new ContentBlock()
            {
                BlogId = blog.Id, Refer = body.Id
            };

            post.ContentBlocks.Add(referBlock);
            context.SaveChanges();
        }
Beispiel #18
0
        public override void appendData(StringBuilder sb, ContentBlock block, BlockData blockdata)
        {
            Object dicValue;

            blockdata.getDic().TryGetValue(this.getName(), out dicValue);

            if (dicValue != null)
            {
                sb.Append(dicValue);
                return;
            }

            if (this.isObject() && blockdata.getDic().ContainsKey(this.getObjName()))
            {
                Object obj = blockdata.getDic()[this.getObjName()];
                if (obj == null)
                {
                    throw new NullReferenceException("view's data " + this.getObjName() + " is null");
                }

                Object pval = getPropertyValue(obj, _objAccessor);
                sb.Append(pval);

                return;
            }

            sb.Append(this.getRawLabelAndVar());
        }
        private async void AppBar_NewPartButton_Click(object sender, RoutedEventArgs e)
        {
            if (_editor.Part == null)
            {
                NewFile();
                return;
            }

            var partType = await ChoosePartType(true);

            if (!string.IsNullOrEmpty(partType))
            {
                // Reset viewing parameters
                UcEditor.ResetView(false);

                // Create package and part
                var package = _editor.Part.Package;

                _lastSelectedBlock?.Dispose();
                _lastSelectedBlock = null;

                _editor.Part.Dispose();
                _editor.Part = null;

                var part = package.CreatePart(partType);
                _editor.Part = part;
                Title.Text   = _packageName + " - " + part.Type;
            }
        }
Beispiel #20
0
        //
        // GET: /ContentBlocks/FeaturedProducts/
        public ActionResult Index(ContentBlock block)
        {
            FeaturedProductsViewModel model = new FeaturedProductsViewModel();

            model.Items = PrepProducts(MTApp.CatalogServices.Products.FindFeatured(1, 100));
            return(View(model));
        }
Beispiel #21
0
        protected void btnNew_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            ContentBlock b = MyPage.MTApp.ContentServices.Columns.FindBlock(this.BlockId);

            if (b != null)
            {
                //Inserting
                //SettingsManager.GetSettingList("ProductGrid");
                foreach (string product in ProductPicker1.SelectedProducts)
                {
                    ContentBlockSettingListItem c = new ContentBlockSettingListItem();
                    Product p = MyPage.MTApp.CatalogServices.Products.Find(product);
                    c.Setting1 = product;
                    c.Setting2 = p.Sku;
                    c.Setting3 = p.ProductName;
                    c.Setting4 = Page.ResolveUrl(ImageHelper.GetValidImage(p.ImageFileSmall, true));
                    c.Setting5 = UrlRewriter.BuildUrlForProduct(p, this.Page);
                    c.Setting6 = p.SitePrice.ToString();
                    c.ListName = "ProductGrid";
                    b.Lists.AddItem(c);
                    MyPage.MTApp.ContentServices.Columns.UpdateBlock(b);
                }
                LoadItems(b);
            }
        }
Beispiel #22
0
        public async Task <IActionResult> Edit(int id, [Bind("ContentBlockID,Kind,Title,OrderNum,Content")] ContentBlock contentBlock)
        {
            if (id != contentBlock.ContentBlockID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contentBlock);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContentBlockExists(contentBlock.ContentBlockID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(contentBlock));
        }
        private void UcEditor_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e)
        {
            // Only for Mouse to avoid issue with LongPress becoming RightTap with Pen/Touch
            if (e.PointerDeviceType != Windows.Devices.Input.PointerDeviceType.Mouse)
            {
                return;
            }

            var uiElement = sender as UIElement;
            var pos       = e.GetPosition(uiElement);

            _lastPointerPosition = new Graphics.Point((float)pos.X, (float)pos.Y);
            _lastSelectedBlock?.Dispose();
            _lastSelectedBlock = _editor.HitBlock(_lastPointerPosition.X, _lastPointerPosition.Y);

            if ((_lastSelectedBlock == null) || (_lastSelectedBlock.Type == "Container"))
            {
                _lastSelectedBlock?.Dispose();
                _lastSelectedBlock = _editor.GetRootBlock();
            }

            if (_lastSelectedBlock != null)
            {
                var globalPos = e.GetPosition(null);
                DisplayContextualMenu(globalPos);
            }

            e.Handled = true;
        }
Beispiel #24
0
        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            ContentBlock b = MyPage.MTApp.ContentServices.Columns.FindBlock(this.BlockId);

            this.RegisterWindowScripts();

            if (!Page.IsPostBack)
            {
                LoadItems(b);
                this.chkShowInOrder.Checked = b.BaseSettings.GetBoolSetting("ShowInOrder");
                this.cssclass.Text          = b.BaseSettings.GetSettingOrEmpty("cssclass");


                this.WidthField.Text = b.BaseSettings.GetIntegerSetting("Width").ToString();
                if ((this.WidthField.Text.Trim() == String.Empty) || (this.WidthField.Text == "0"))
                {
                    this.WidthField.Text = "220";
                }

                this.HeighField.Text = b.BaseSettings.GetIntegerSetting("Height").ToString();
                if ((this.HeighField.Text.Trim() == String.Empty) || (this.HeighField.Text == "0"))
                {
                    this.HeighField.Text = "220";
                }

                int seconds = b.BaseSettings.GetIntegerSetting("Pause");
                if (seconds < 0)
                {
                    seconds = 3;
                }
                this.PauseField.Text = seconds.ToString();
            }
        }
        //
        // GET: /ContentBlocks/ImageRotator/
        public ActionResult Index(ContentBlock block)
        {
            ImageRotatorViewModel model = new ImageRotatorViewModel();

            if (block != null)
            {
                var imageList = block.Lists.FindList("Images");
                foreach (var listItem in imageList)
                {
                    ImageRotatorImageViewModel img = new ImageRotatorImageViewModel();
                    img.ImageUrl = ResolveUrl(listItem.Setting1);
                    img.Url      = listItem.Setting2;
                    if (img.Url.StartsWith("~"))
                    {
                        img.Url = Url.Content(img.Url);
                    }
                    img.NewWindow = (listItem.Setting3 == "1");
                    img.Caption   = listItem.Setting4;
                    model.Images.Add(img);
                }
                string cleanId = MerchantTribe.Web.Text.ForceAlphaNumericOnly(block.Bvin);
                model.CssId    = "rotator" + cleanId;
                model.CssClass = block.BaseSettings.GetSettingOrEmpty("cssclass");

                model.Height = block.BaseSettings.GetIntegerSetting("Height");
                model.Width  = block.BaseSettings.GetIntegerSetting("Width");

                if (block.BaseSettings.GetBoolSetting("ShowInOrder") == false)
                {
                    RandomizeList(model.Images);
                }
            }

            return(View(model));
        }
Beispiel #26
0
        private void LoadMenu()
        {
            ContentBlock b = MyPage.MTApp.ContentServices.Columns.FindBlock(this.BlockId);

            if (b != null)
            {
                this.TitlePlaceHolder.Controls.Clear();
                string title = b.BaseSettings.GetSettingOrEmpty("Title");
                if (title.Trim().Length > 0)
                {
                    this.TitlePlaceHolder.Controls.Add(new LiteralControl("<h4>" + title + "</h4>"));
                }

                this.MenuControl.Controls.Clear();
                MenuControl.EnableViewState = false;
                List <ContentBlockSettingListItem> links = b.Lists.FindList("Links");
                if (links != null)
                {
                    this.MenuControl.Controls.Add(new LiteralControl("<ul>"));
                    foreach (ContentBlockSettingListItem l in links)
                    {
                        AddSingleLink(l);
                    }
                    this.MenuControl.Controls.Add(new LiteralControl("</ul>"));
                }
            }
        }
        private void UcEditor_RightDown(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            // Only for Pen to avoid issue with LongPress becoming RightTap with Pen/Touch
            var uiElement = sender as UIElement;
            var p         = e.GetCurrentPoint(uiElement);

            if (e.Pointer.PointerDeviceType != Windows.Devices.Input.PointerDeviceType.Pen)
            {
                return;
            }

            if (!p.Properties.IsRightButtonPressed)
            {
                return;
            }

            _lastPointerPosition = new Graphics.Point((float)p.Position.X, (float)p.Position.Y);
            _lastSelectedBlock?.Dispose();
            _lastSelectedBlock = _editor.HitBlock(_lastPointerPosition.X, _lastPointerPosition.Y);

            if ((_lastSelectedBlock == null) || (_lastSelectedBlock.Type == "Container"))
            {
                _lastSelectedBlock?.Dispose();
                _lastSelectedBlock = _editor.GetRootBlock();
            }

            if (_lastSelectedBlock != null)
            {
                var globalPos = e.GetCurrentPoint(null).Position;
                DisplayContextualMenu(globalPos);
            }

            e.Handled = true;
        }
Beispiel #28
0
        private async Task <T> SaveMethodology <T>(ContentBlock block, MethodologyVersion methodologyVersion)
            where T : IContentBlockViewModel
        {
            _context.Update(methodologyVersion);
            await _context.SaveChangesAsync();

            return(_mapper.Map <T>(block));
        }
Beispiel #29
0
        private async Task <T> SaveContentBlock <T>(ContentBlock blockToUpdate)
            where T : IContentBlockViewModel
        {
            _context.ContentBlocks.Update(blockToUpdate);
            await _context.SaveChangesAsync();

            return(_mapper.Map <T>(blockToUpdate));
        }
Beispiel #30
0
 public void addBlock(ContentBlock block)
 {
     if (_blocks.ContainsKey(block.Name))
     {
         throw new TemplateException("请勿重复绑定(getBlock)区块。区块名=" + block.Name + ",模板文件=" + block.getTemplatePath());
     }
     _blocks.Add(block.Name, block);
 }
Beispiel #31
0
        //public Token getByName( String tokenName ) {
        //    Token x;
        //    this.tokenMap.TryGetValue( tokenName, out x );
        //    return x;
        //}
        //private void addMap( List<Token> tokens ) {
        //    if (tokens == null) return;
        //    foreach (Token x in tokens) {
        //        if (x.getName() == null) continue;
        //        // 允许变量存在多次
        //        if (tokenMap.ContainsKey( x.getName() )) continue;
        //        tokenMap.Add( x.getName(), x );
        //    }
        //}
        public override void appendData( StringBuilder sb, ContentBlock block, BlockData blockdata )
        {
            ContentBlock subBlock = blockdata.getBlock( this.getName() );
            if (subBlock == null) return;

            List<BlockData> datalist = subBlock.getDataList();
            foreach (BlockData oneData in datalist) {
                subBlock.addResultOne( sb, oneData );
            }
        }
        /// <summary>
        /// Adds a control to page.
        /// </summary>
        public static void AddControlToPage()
        {
            //get a PageManager object
            PageManager pageManager = PageManager.GetManager();
            var pageData = pageManager.GetPageNode(Installer.pageId).GetPageData();

            var draftPage = pageManager.EditPage(pageData.Id);
            var contentBlock = new ContentBlock();
            contentBlock.Html = Installer.weekdayContent + Installer.instructionContent;

            var draftControl = pageManager.CreateControl<PageDraftControl>(contentBlock, "Body");
            draftControl.Caption = "Content block";
            draftPage.Controls.Add(draftControl);

            //Save the changes
            pageManager.PublishPageDraft(draftPage, CultureInfo.CurrentUICulture);
            pageManager.SaveChanges();
        }
Beispiel #33
0
        public override void appendData( StringBuilder sb, ContentBlock block, BlockData blockdata )
        {
            Object dicValue;
            blockdata.getDic().TryGetValue( this.getName(), out dicValue );

            if (dicValue != null) {
                sb.Append( dicValue );
                return;
            }

            if (this.isObject() && blockdata.getDic().ContainsKey( this.getObjName() )) {

                Object obj = blockdata.getDic()[this.getObjName()];
                if (obj == null) throw new NullReferenceException( "view's data " + this.getObjName() + " is null" );

                Object pval = getPropertyValue( obj, _objAccessor );
                sb.Append( pval );

                return;
            }

            sb.Append( this.getRawLabelAndVar() );
        }
Beispiel #34
0
 public override void appendData( StringBuilder sb, ContentBlock block, BlockData blockdata )
 {
     sb.Append( this.getValue() );
 }
Beispiel #35
0
        /// <summary>
        /// 返回一个做数据容器的block(可以作为数据容器,并包括tokens信息)
        /// </summary>
        /// <param name="blockName"></param>
        /// <returns></returns>
        public IBlock GetBlock( String blockName )
        {
            if (_isTemplateExist == false) {
                throw new TemplateException( lang.get( "exTemplateNotExist" ) + ": " + _templatePath );
            }

            BlockToken blockToken = getBlockToken( blockName );
            if (blockToken == null) throw new TemplateException(
                string.Format( lang.get( "exBlockExist" ), blockName, _templatePath, "&lt;!-- BEGIN " + blockName + " --&gt;" )
                );

            ContentBlock block = new ContentBlock();
            block.Name = blockName;
            block._thisToken = blockToken;
            block._templatePath = _templatePath;

            // 将上级变量放入下级循环可用
            block._blockData = new BlockData( _blockData.getDic() );

            _blockData.addBlock( block );

            return block;
        }
        private void CreateEducationThemeAndTemplate()
        {
            SampleUtilities.RegisterTheme(SampleConstants.EducationThemeName, SampleConstants.EducationThemePath);
            SampleUtilities.RegisterTheme(SampleConstants.EducationInGermanThemeName, SampleConstants.EducationInGermanThemePath);

            SampleUtilities.RegisterTemplate(new Guid(SampleConstants.EducationTemplateId), SampleConstants.EducationTemplateName, SampleConstants.EducationTemplateName, SampleConstants.EducationTemplateMasterPage, SampleConstants.EducationThemeName, CultureInfo.GetCultureInfo("en"));
            var result = SampleUtilities.RegisterTemplate(new Guid(SampleConstants.EducationTemplateId), SampleConstants.EducationInGermanTemplateName, SampleConstants.EducationInGermanTemplateName, SampleConstants.EducationTemplateMasterPage, SampleConstants.EducationInGermanThemeName, CultureInfo.GetCultureInfo("de"));

            if (result)
            {
                // Main layout
                var mainLayoutControl = new LayoutControl();
                List<ColumnDetails> mainLayoutColumns = new List<ColumnDetails>();
                ColumnDetails mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 50),
                    ColumnWidthPercentage = 70,
                    PlaceholderId = "Left"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);
                ColumnDetails mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnWidthPercentage = 30,
                    PlaceholderId = "Right"
                };
                mainLayoutColumns.Add(mainLayoutColumn2);
                mainLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControl.ID = "Header";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), mainLayoutControl, "headerInfo", "Header");

                // Logo
                var logoBlock = new ContentBlock();
                logoBlock.Html = string.Format(@"<h1><a href=""[pages]{0}"">Telerik International University</a></h1> <h3>established 2005, Sofia</h3>", SampleConstants.HomePageId);
                logoBlock.CssClass = "sfContentBlock";
                string logoId = SampleUtilities.AddLocalizedControlToTemplate(new Guid(SampleConstants.EducationTemplateId), logoBlock, "Header_Left", "Content block", "en");

                Dictionary<string, object> logoProperties = new Dictionary<string, object>();

                logoProperties.Add("Html", string.Format(@"<h1><a href=""[pages]{0}"">Internationale Universit&auml;t Telerik</a></h1> <h3>gegr&uuml;ndet im 2005, in Sofia</h3>", SampleConstants.HomePageId));
                SampleUtilities.UpdateLocalizedControlInTemplate(logoId, new Guid(SampleConstants.EducationTemplateId), logoProperties, "de");

                // Language/search layout
                var languagesSearchLayoutControl = new LayoutControl();
                List<ColumnDetails> languagesSearchLayoutColumns = new List<ColumnDetails>();
                ColumnDetails languagesSearchLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 46,
                    PlaceholderId = "Left"
                };
                languagesSearchLayoutColumns.Add(languagesSearchLayoutColumn1);
                ColumnDetails languagesSearchLayoutColumn2 = new ColumnDetails()
                {
                    ColumnWidthPercentage = 54,
                    PlaceholderId = "Right"
                };
                languagesSearchLayoutColumns.Add(languagesSearchLayoutColumn2);
                languagesSearchLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(languagesSearchLayoutColumns, string.Empty);
                languagesSearchLayoutControl.ID = "LanguageSearch";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), languagesSearchLayoutControl, "Header_Right", "Language and Search");

                // Language
                var languages = new LanguageSelectorControl();
                languages.SelectorType = LanguageSelectorType.Vertical;
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), languages, "LanguageSearch_Right", "Language selector");

                // Login layout
                //var loginLayoutControl = new LayoutControl();
                //List<ColumnDetails> loginLayoutColumns = new List<ColumnDetails>();
                //ColumnDetails loginLayoutColumn1 = new ColumnDetails()
                //{
                //    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                //    PlaceholderId = "Center"
                //};
                //loginLayoutColumns.Add(loginLayoutColumn1);
                //loginLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(loginLayoutColumns, "login-status");
                //loginLayoutControl.ID = "Login";
                //SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), loginLayoutControl, "Header_Right", "Login");

                //// Login name
                //LoginNameControl loginNameControl = new LoginNameControl();
                //SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), loginNameControl, "Login_Center", "Login name");

                //// Login status
                //LoginStatusControl loginStatusControl = new LoginStatusControl();
                //SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), loginStatusControl, "Login_Center", "Login status");

                // Image
                ImageControl headerImage = new ImageControl();
                headerImage.ImageId = SampleUtilities.GetLocalizedImageId("the_building", "en");
                headerImage.CssClass = "headerImage";
                string controlId = SampleUtilities.AddLocalizedControlToTemplate(new Guid(SampleConstants.EducationTemplateId), headerImage, "image", "Image", "en");

                Dictionary<string, object> properties = new Dictionary<string, object>();
                properties.Add("ImageId", SampleUtilities.GetLocalizedImageId("headerspring1", "de"));
                SampleUtilities.UpdateLocalizedControlInTemplate(controlId, new Guid(SampleConstants.EducationTemplateId), properties, "de");

                // Explore your potentials
                ContentBlockBase exploreContentBlock = new ContentBlockBase();
                exploreContentBlock.Html = @"<h4>Explore your potentials</h4> <p>Share your voice and unlock your potentials while we will equip you with the skills you need for the future!</p>";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), exploreContentBlock, "tagline", "Content block");

                // Header navigation
                var headerNavigationControl = new NavigationControl();
                headerNavigationControl.NavigationMode = NavigationModes.HorizontalSimple;
                headerNavigationControl.SelectionMode = PageSelectionModes.TopLevelPages;
                headerNavigationControl.Skin = "education";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), headerNavigationControl, "header", "Navigation");

                // Footer navigation
                var footerNavigationControl = new NavigationControl();
                footerNavigationControl.NavigationMode = NavigationModes.SiteMapInColumns;
                footerNavigationControl.SelectionMode = PageSelectionModes.TopLevelPages;
                footerNavigationControl.Skin = "footer";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), footerNavigationControl, "footernavigation", "Navigation");
            }
        }
Beispiel #37
0
 //public String getVarString() {
 //    return TemplateUtil.getVarString( this.getName() );
 //}
 public abstract void appendData( StringBuilder sb, ContentBlock block, BlockData blockdata );
        private void CreateFacebookThemeAndTemplate()
        {
            SampleUtilities.RegisterTheme(SampleConstants.FacebookThemeName, SampleConstants.FacebookThemePath);

            var result = SampleUtilities.RegisterTemplate(new Guid(SampleConstants.FacebookTemplateId), SampleConstants.FacebookTemplateName, SampleConstants.FacebookTemplateName,
                SampleConstants.FacebookTemplateMasterPage, SampleConstants.FacebookThemeName, CultureInfo.GetCultureInfo("en"));

            if (result)
            {
                var mainLayoutControl = new LayoutControl();
                List<ColumnDetails> mainLayoutColumns = new List<ColumnDetails>();
                ColumnDetails mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 100,
                    PlaceholderId = "Center"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);
                mainLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, "header");
                mainLayoutControl.ID = "Header";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.FacebookTemplateId), mainLayoutControl, "content_inside", "100% (custom)");

                // Logo
                var logoBlock = new ContentBlock();
                logoBlock.Html = @"<h1>Telerik International University</h1>";
                logoBlock.CssClass = "sfContentBlock";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.FacebookTemplateId), logoBlock, "Header_Center", "Content block");

                // Image
                ImageControl universityImage = new ImageControl();
                universityImage.ImageId = SampleUtilities.GetLocalizedImageId("university_520", "en");
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.FacebookTemplateId), universityImage, "Header_Center", "Image");

                var contentLayoutControl = new LayoutControl();
                List<ColumnDetails> contentLayoutColumns = new List<ColumnDetails>();
                ColumnDetails contentLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 100,
                    PlaceholderId = "Center"
                };
                contentLayoutColumns.Add(contentLayoutColumn1);
                contentLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(contentLayoutColumns, "content");
                contentLayoutControl.ID = "Content";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.FacebookTemplateId), contentLayoutControl, "Header_Center", "100% (custom)");

                var footerLayoutControl = new LayoutControl();
                List<ColumnDetails> footerLayoutColumns = new List<ColumnDetails>();
                ColumnDetails footerLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 50,
                    PlaceholderId = "Left"
                };
                footerLayoutColumns.Add(footerLayoutColumn1);
                ColumnDetails footerLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 50,
                    PlaceholderId = "Right"
                };
                footerLayoutColumns.Add(footerLayoutColumn2);
                footerLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(footerLayoutColumns, "footer");
                footerLayoutControl.ID = "Footer";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.FacebookTemplateId), footerLayoutControl, "Header_Center", "50% + 50% (custom)");
            }
        }
        private void CreateWhyTIUPage()
        {
            var result = SampleUtilities.CreateLocalizedPage(new Guid(SampleConstants.WhyTIUPageId), "Why TIU", new Guid(SampleConstants.AboutTheUniversityPageId), "en");

            if (result)
            {
                SampleUtilities.SetTemplateToLocalizedPage(new Guid(SampleConstants.WhyTIUPageId), new Guid(SampleConstants.EducationTemplateId), "en");

                ContentBlock whyBlock = new ContentBlock();
                whyBlock.Html = @"<h2>Why TIU?</h2>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.WhyTIUPageId), whyBlock, "content", "Content block", "en");

                var mainLayoutControl = new LayoutControl();
                List<ColumnDetails> mainLayoutColumns = new List<ColumnDetails>();
                ColumnDetails mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 25,
                    PlaceholderId = "Left"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);
                ColumnDetails mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 75,
                    PlaceholderId = "Right"
                };
                mainLayoutColumns.Add(mainLayoutColumn2);

                mainLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControl.ID = "Main";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.WhyTIUPageId), mainLayoutControl, "content", "25% + 75%", "en");

                var navigationControl = new NavigationControl();
                navigationControl.NavigationMode = NavigationModes.VerticalSimple;
                navigationControl.SelectionMode = PageSelectionModes.CurrentPageSiblings;
                navigationControl.Skin = "left";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.WhyTIUPageId), navigationControl, "Main_Left", "Navigation", "en");

                ContentBlock contentBlock = new ContentBlock();
                var students_tiuImageId = SampleUtilities.GetLocalizedImageId("students_tiu", "en");

                contentBlock.Html = string.Format(@"<p><img class=""special"" alt=""Lorem ipsum dolor sit amet"" src=""[images]{0}"" style=""width: 350px; height: 273px; float: left; margin-right: 15px; margin-bottom: 5px;"" longdesc=""Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."" /></p> <h3>Know how to live!</h3> <p> At TIU we believe in teaching you the knowhow of life. In order to lead a good life, one must excel in education, succeed in his profession and enjoy the free time in between. This is why life at TIU encompasses not only academics, but also activities that will shape your character and lead you to success. </p> <h3>Excellence </h3> <p>In order to expect you to excel, we must excel at what we do. We believe in making a real impact on the world by constantly growing, hiring the best staff and investing in the newest technology. You will have access to an impressive range of resources to support your studies including an outstanding academic library and some of the best computing resources. </p> <h3>Careers </h3> <p>Education is the prelude to profession. What use is a diploma unless it makes you highly demanded by the world of employers? TIU&rsquo;s reputation in the business world combined with its contacts and internship programs is a guarantee for your ability to land directly into your dream job right after graduation.</p>", students_tiuImageId);
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.WhyTIUPageId), contentBlock, "Main_Right", "Content block", "en");
            }

            result = SampleUtilities.CreateLocalizedPage(new Guid(SampleConstants.WhyTIUPageId), "Warum TIU", false, "de");

            if (result)
            {
                SampleUtilities.SetTemplateToLocalizedPage(new Guid(SampleConstants.WhyTIUPageId), new Guid(SampleConstants.EducationTemplateId), "de");

                ContentBlock whyBlockDE = new ContentBlock();
                whyBlockDE.Html = @"<h2>Warum TIU?</h2>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.WhyTIUPageId), whyBlockDE, "content", "Content block", "de");

                var mainLayoutControlDE = new LayoutControl();
                List<ColumnDetails> mainLayoutColumns = new List<ColumnDetails>();
                ColumnDetails mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 25,
                    PlaceholderId = "Left"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);
                ColumnDetails mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 75,
                    PlaceholderId = "Right"
                };
                mainLayoutColumns.Add(mainLayoutColumn2);

                mainLayoutControlDE.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControlDE.ID = "Main";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.WhyTIUPageId), mainLayoutControlDE, "content", "25% + 75%", "de");

                var navigationControlDE = new NavigationControl();
                navigationControlDE.NavigationMode = NavigationModes.VerticalSimple;
                navigationControlDE.SelectionMode = PageSelectionModes.CurrentPageSiblings;
                navigationControlDE.Skin = "left";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.WhyTIUPageId), navigationControlDE, "Main_Left", "Navigation", "de");

                ContentBlock contentBlockDE = new ContentBlock();
                var students_tiuImageIdDE = SampleUtilities.GetLocalizedImageId("students_tiu", "de");

                contentBlockDE.Html = string.Format(@"<p><img alt="""" style=""float: left; margin-right: 15px; margin-bottom: 5px;"" src=""[images]{0}"" /></p> <h3>Wissen, wie man lebt!</h3> <p> Am TIU wir glauben, in der Lehre Sie das Know-how des Lebens. Um ein gutes Leben zu f&uuml;hren, muss man excel im Bildungswesen, in seinem Beruf erfolgreich zu sein und genie&szlig;en die freie Zeit dazwischen. Dies ist, warum das Leben in TIU nicht nur Akademiker umfasst, sondern auch Aktivit&auml;ten, die Ihren Charakter Form und f&uuml;hren Sie zum Erfolg wird.</p> <h3>Exzellenzinitiative</h3> <p>Um Ihnen zu &uuml;bertreffen erwarten, m&uuml;ssen wir, was wir tun Excel. Wir glauben an einen echten Einfluss auf die Welt durch st&auml;ndig wachsende,, die besten Mitarbeiter und investieren in die neueste Technologie. Sie haben Zugriff auf eine beeindruckende Vielfalt an Ressourcen, um Ihre Studien mit einem hervorragenden akademischen Bibliothek und einige der besten IT-Ressourcen zu unterst&uuml;tzen.</p> <h3>Karriere</h3> <p>Bildung ist der Auftakt zu Beruf. Was n&uuml;tzt ein Diplom, es sei denn es macht dich stark nachgefragten durch die Welt der Arbeitgeber? TIU Ruf in der Gesch&auml;ftswelt mit ihren Kontakten und Praktika in Kombination ist ein Garant f&uuml;r Ihre F&auml;higkeit, direkt Land in Ihren Traumjob nach dem Studium.</p>", students_tiuImageIdDE);
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.WhyTIUPageId), contentBlockDE, "Main_Right", "Content block", "de");
            }
        }
        private void CreateLoginPage()
        {
            Guid parentPageID = new Guid(SampleConstants.InternalResourcesGroupPageId);
            var hasCreatedPage = SampleUtilities.CreateLocalizedPage(new Guid(SampleConstants.LoginPageId), "Login", parentPageID, false, false, "en");
            if (hasCreatedPage)
            {
                SampleUtilities.SetTemplateToLocalizedPage(new Guid(SampleConstants.LoginPageId), new Guid(SampleConstants.EducationTemplateId), "en");

                // Add layout control
                var mainLayoutControl = new LayoutControl();
                var mainLayoutColumns = new List<ColumnDetails>();

                var mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 15, 0, 0),
                    PlaceholderId = "Left",
                    ColumnWidthPercentage = 50
                };
                mainLayoutColumns.Add(mainLayoutColumn1);

                var mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 15),
                    PlaceholderId = "Right",
                    ColumnWidthPercentage = 50
                };
                mainLayoutColumns.Add(mainLayoutColumn2);

                mainLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControl.ID = "Main";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.LoginPageId), mainLayoutControl, "content", "50% + 50% (custom)", "en");

                ContentBlockBase pageTitle = new ContentBlockBase();
                pageTitle.Html = "<h1>Login</h1>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.LoginPageId), pageTitle, "Main_Left", "Content block", "en");

                LoginWidget login = new LoginWidget();
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.LoginPageId), login, "Main_Left", "Login", "en");

                string registerPageUrl = string.Empty;
                var count = 0;
                App.WorkWith().Pages().Where(pN => pN.Id == new Guid(SampleConstants.RegistrationPageId)).Count(out count);
                if (count != 0)
                {
                    PageNode node = App.WorkWith().Page(new Guid(SampleConstants.RegistrationPageId)).Get();
                    registerPageUrl = node.UrlName;
                }

                ContentBlock registerInfo = new ContentBlock();
                registerInfo.Html =
                    String.Format(@"<div>
                    <div>
                    <p>Please click on ""Register"" and complete the form on the next screen to register for our service. You will receive a confirmation email during the next few minutes. <br />
                    <br />
                    Once registered, you are ready to use our service in full mode.&nbsp;</p>
                    <p><strong>You need to be logged in to:</strong></p>
                    <ul>
                        <li>post in forums</li>
                        <li>manage your account</li>
                        <li>download documents</li>
                    </ul>
                    <a class=""important"" href=""{0}"">Register</a></div>
                    </div>", registerPageUrl);

                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.LoginPageId), registerInfo, "Main_Right", "Login", "en");
            }

            hasCreatedPage = SampleUtilities.CreateLocalizedPage(new Guid(SampleConstants.LoginPageId), "Login", parentPageID, false, false, "de");
            if (hasCreatedPage)
            {
                SampleUtilities.SetTemplateToLocalizedPage(new Guid(SampleConstants.LoginPageId), new Guid(SampleConstants.EducationTemplateId), "de");

                // Add layout control
                var mainLayoutControl = new LayoutControl();
                var mainLayoutColumns = new List<ColumnDetails>();

                var mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 15, 0, 0),
                    PlaceholderId = "Left",
                    ColumnWidthPercentage = 50
                };
                mainLayoutColumns.Add(mainLayoutColumn1);

                var mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 15),
                    PlaceholderId = "Right",
                    ColumnWidthPercentage = 50
                };
                mainLayoutColumns.Add(mainLayoutColumn2);

                mainLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControl.ID = "Main";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.LoginPageId), mainLayoutControl, "content", "50% + 50% (custom)", "de");

                ContentBlockBase pageTitle = new ContentBlockBase();
                pageTitle.Html = "<h1>Login</h1>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.LoginPageId), pageTitle, "Main_Left", "Content block", "de");

                LoginWidget login = new LoginWidget();
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.LoginPageId), login, "Main_Left", "Login", "de");

                string registerPageUrl = string.Empty;
                var count = 0;
                App.WorkWith().Pages().Where(pN => pN.Id == new Guid(SampleConstants.RegistrationPageId)).Count(out count);
                if (count != 0)
                {
                    PageNode node = App.WorkWith().Page(new Guid(SampleConstants.RegistrationPageId)).Get();
                    registerPageUrl = node.UrlName;
                }

                ContentBlock registerInfo = new ContentBlock();
                registerInfo.Html =
                    String.Format(@"<div>
                    <p>Bitte klicken Sie auf ""Registrieren"" und f&uuml;llen Sie das Formular auf der n&auml;chsten Seite, um f&uuml;r unseren Service registrieren. Sie erhalten eine Best&auml;tigung per E-Mail in den n&auml;chsten Minuten erhalten.<br />
                    <br />
                    Einmal registriert, k&ouml;nnen Sie unseren Service in Voll-Modus verwenden.&nbsp;</p>
                    <p><strong>Sie m&uuml;ssen registriert sein, um Folgendes machen zu k&ouml;nnen:</strong></p>
                    <ul>
                        <li>In den Foren schreiben</li>
                        <li>Ihr Account managen</li>
                        <li>Dokumente herunterladen</li>
                    </ul>
                    <p><a href=""{0}"">Registrierung</a></p>
                    </div>", registerPageUrl);

                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.LoginPageId), registerInfo, "Main_Right", "Login", "de");
            }
        }
        private void CreatePreArrivalInformationPage()
        {
            var result = SampleUtilities.CreateLocalizedPage(new Guid(SampleConstants.PreArrivalInformationPageId), "Pre-arrival information", new Guid(SampleConstants.AdmissionsPageId), "en");

            if (result)
            {
                SampleUtilities.SetTemplateToLocalizedPage(new Guid(SampleConstants.PreArrivalInformationPageId), new Guid(SampleConstants.EducationTemplateId), "en");

                ContentBlockBase titleBlock = new ContentBlockBase();
                titleBlock.Html = @"<h2>Pre-arrival Information</h2>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.PreArrivalInformationPageId), titleBlock, "content", "Content block", "en");

                var mainLayoutControl = new LayoutControl();
                List<ColumnDetails> mainLayoutColumns = new List<ColumnDetails>();
                ColumnDetails mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 25,
                    PlaceholderId = "Left"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);
                ColumnDetails mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 75,
                    PlaceholderId = "Right"
                };
                mainLayoutColumns.Add(mainLayoutColumn2);

                mainLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControl.ID = "Main";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.PreArrivalInformationPageId), mainLayoutControl, "content", "25% + 75%", "en");

                var navigationControl = new NavigationControl();
                navigationControl.NavigationMode = NavigationModes.VerticalSimple;
                navigationControl.SelectionMode = PageSelectionModes.CurrentPageSiblings;
                navigationControl.Skin = "left";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.PreArrivalInformationPageId), navigationControl, "Main_Left", "Navigation", "en");

                ContentBlock contentBlock = new ContentBlock();
                var prearrivalImageId = SampleUtilities.GetLocalizedImageId("prearrival", "en");

                contentBlock.Html = string.Format(@"<p><img alt="""" style=""float: left; margin-right: 15px; margin-bottom: 5px;"" src=""[images]{3}"" /></p> <h3>Pre-arrival</h3> <p>College is a step towards the beginning of your new life.&nbsp; We will try to make getting there as easy as possible for you.&nbsp; The information in this section of our website is intended to be used before you arrive on campus. Once you are on campus we will be here to meet and greet you and to make your experience here unforgettable and beneficial.&nbsp; If you have a specific question that is not answered here please feel free to contact us. We are very pleased that you are interested in studying at the Telerik International University.</p> <br /> <br style=""clear: left"" /> <p>Here are some helpful links on different topics:</p> <ul> <li><a href=""[pages]{0}"" >Contact us</a></li> <li><a href=""[pages]{1}"" >Housing opportunities</a></li> <li><a href=""[pages]{2}"" >Documents base</a></li> </ul>", SampleConstants.ContactUsPageId, SampleConstants.HousingOpportunitiesPageId, SampleConstants.DocumentsBasePageId, prearrivalImageId);
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.PreArrivalInformationPageId), contentBlock, "Main_Right", "Content block", "en");
            }

            result = SampleUtilities.CreateLocalizedPage(new Guid(SampleConstants.PreArrivalInformationPageId), "Vor der Ankunft", "de");

            if (result)
            {
                SampleUtilities.SetTemplateToLocalizedPage(new Guid(SampleConstants.PreArrivalInformationPageId), new Guid(SampleConstants.EducationTemplateId), "de");

                ContentBlock titleBlockDE = new ContentBlock();
                titleBlockDE.Html = @"<h2>Vor der Ankunft</h2>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.PreArrivalInformationPageId), titleBlockDE, "content", "Content block", "de");

                var mainLayoutControlDE = new LayoutControl();
                List<ColumnDetails> mainLayoutColumns = new List<ColumnDetails>();
                ColumnDetails mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 25,
                    PlaceholderId = "Left"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);
                ColumnDetails mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 75,
                    PlaceholderId = "Right"
                };
                mainLayoutColumns.Add(mainLayoutColumn2);

                mainLayoutControlDE.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControlDE.ID = "Main";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.PreArrivalInformationPageId), mainLayoutControlDE, "content", "25% + 75%", "de");

                var navigationControlDE = new NavigationControl();
                navigationControlDE.NavigationMode = NavigationModes.VerticalSimple;
                navigationControlDE.SelectionMode = PageSelectionModes.CurrentPageSiblings;
                navigationControlDE.Skin = "left";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.PreArrivalInformationPageId), navigationControlDE, "Main_Left", "Navigation", "de");

                ContentBlock contentBlockDE = new ContentBlock();
                var prearrivalImageIdDE = SampleUtilities.GetLocalizedImageId("prearrival", "de");

                contentBlockDE.Html = string.Format(@"<p><img alt="""" style=""float: left; margin-right: 15px; margin-bottom: 5px;"" src=""[images]{3}"" /></p> <h3>Vor der Ankunft</h3> <p>College ist ein Schritt in Richtung der Beginn Ihres neuen Lebens. Wir werden versuchen, dorthin zu gelangen so einfach wie m&ouml;glich f&uuml;r Sie. Die Informationen in diesem Bereich unserer Website soll verwendet werden, bevor Sie auf dem Campus zu gelangen. Sobald Sie sich auf dem Campus werden wir hier zu treffen und gr&uuml;&szlig;en Sie und machen Ihre Erfahrungen hier unvergessliche und n&uuml;tzlich. Wenn Sie eine spezifische Frage, die hier nicht beantwortet haben, z&ouml;gern Sie nicht uns zu kontaktieren.</p> <br /> <br style=""clear: left"" /> <p>Hier sind einige hilfreiche Links zu verschiedenen Themen:</p> <ul> <li><a href=""[pages]{0}"" >Kontakt</a></li> <li><a href=""[pages]{1}"" >Wohnmöglichkeiten</a></li> <li><a href=""[pages]{2}"" >Downloads</a></li> </ul>", SampleConstants.ContactUsPageId, SampleConstants.HousingOpportunitiesPageId, SampleConstants.DocumentsBasePageId, prearrivalImageIdDE);
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.PreArrivalInformationPageId), contentBlockDE, "Main_Right", "Content block", "de");
            }
        }
        private void CreateCampusMapPage()
        {
            var result = SampleUtilities.CreateLocalizedPage(new Guid(SampleConstants.CampusMapPageId), "Campus map", new Guid(SampleConstants.CampusLifePageId), "en");

            if (result)
            {
                SampleUtilities.SetTemplateToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), new Guid(SampleConstants.EducationTemplateId), "en");

                ContentBlockBase campusMapBlock = new ContentBlockBase();
                campusMapBlock.Html = @"<h2>Campus map</h2>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), campusMapBlock, "content", "Content block", "en");

                var mainLayoutControl = new LayoutControl();
                List<ColumnDetails> mainLayoutColumns = new List<ColumnDetails>();
                ColumnDetails mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 25,
                    PlaceholderId = "Left"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);
                ColumnDetails mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 75,
                    PlaceholderId = "Right"
                };
                mainLayoutColumns.Add(mainLayoutColumn2);

                mainLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControl.ID = "Main";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), mainLayoutControl, "content", "25% + 75%", "en");

                var navigationControl = new NavigationControl();
                navigationControl.NavigationMode = NavigationModes.VerticalSimple;
                navigationControl.SelectionMode = PageSelectionModes.CurrentPageSiblings;
                navigationControl.Skin = "left";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), navigationControl, "Main_Left", "Navigation", "en");

                ImageControl campusMapImage = new ImageControl();
                campusMapImage.ImageId = SampleUtilities.GetLocalizedImageId("campus", "en");
                campusMapImage.Width = 676;
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), campusMapImage, "Main_Right", "Image", "en");

                var legendHeaderLayoutControl = new LayoutControl();
                List<ColumnDetails> legendHeaderLayoutColumns = new List<ColumnDetails>();
                ColumnDetails legendHeaderLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 100,
                    PlaceholderId = "Center"
                };
                legendHeaderLayoutColumns.Add(legendHeaderLayoutColumn1);

                legendHeaderLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(legendHeaderLayoutColumns, string.Empty);
                legendHeaderLayoutControl.ID = "LegendHeader";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), legendHeaderLayoutControl, "Main_Right", "100%", "en");

                ContentBlock legendBlock = new ContentBlock();
                legendBlock.Html = @"<h3>Legend</h3>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), legendBlock, "LegendHeader_Center", "Content block", "en");

                var legendLayoutControl = new LayoutControl();
                List<ColumnDetails> legendLayoutColumns = new List<ColumnDetails>();
                ColumnDetails legendLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 33,
                    PlaceholderId = "Left33"
                };
                legendLayoutColumns.Add(legendLayoutColumn1);
                ColumnDetails legendLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 34,
                    PlaceholderId = "Middle34"
                };
                legendLayoutColumns.Add(legendLayoutColumn2);
                ColumnDetails legendLayoutColumn3 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 33,
                    PlaceholderId = "Right33"
                };
                legendLayoutColumns.Add(legendLayoutColumn3);

                legendLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(legendLayoutColumns, string.Empty);
                legendLayoutControl.ID = "Legend";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), legendLayoutControl, "Main_Right", "33% + 34% + 33%", "en");

                ContentBlockBase contentBlockLeft = new ContentBlockBase();
                contentBlockLeft.Html = @"1. Dorm A (Ryan Mcguire)<br /> 2. Fine Arts building<br /> 3. Computing center<br /> 4. Dorm B (Tomas Newman)";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), contentBlockLeft, "Legend_Left33", "Content block", "en");

                ContentBlockBase contentBlockMiddle = new ContentBlockBase();
                contentBlockMiddle.Html = @"5. Biology faculty<br /> 6. Chemistry building<br /> 7. Dorm C (Micheal Burgess)<br /> 8. Administration center";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), contentBlockMiddle, "Legend_Middle34", "Content block", "en");

                ContentBlockBase contentBlockRight = new ContentBlockBase();
                contentBlockRight.Html = @"9. Athletics facilities<br /> 10.Main Building<br /> 11.Liberal arts building<br /> 12. Dorm D (Melvin Richards)";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), contentBlockRight, "Legend_Right33", "Content block", "en");
            }

            result = SampleUtilities.CreateLocalizedPage(new Guid(SampleConstants.CampusMapPageId), "Campus-Karte", "de");

            if (result)
            {
                SampleUtilities.SetTemplateToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), new Guid(SampleConstants.EducationTemplateId), "de");

                ContentBlockBase campusMapBlockDE = new ContentBlockBase();
                campusMapBlockDE.Html = @"<h2>Campus-Karte</h2>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), campusMapBlockDE, "content", "Content block", "de");

                var mainLayoutControlDE = new LayoutControl();
                List<ColumnDetails> mainLayoutColumns = new List<ColumnDetails>();
                ColumnDetails mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 25,
                    PlaceholderId = "Left"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);
                ColumnDetails mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 75,
                    PlaceholderId = "Right"
                };
                mainLayoutColumns.Add(mainLayoutColumn2);

                mainLayoutControlDE.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControlDE.ID = "Main";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), mainLayoutControlDE, "content", "25% + 75%", "de");

                var navigationControlDE = new NavigationControl();
                navigationControlDE.NavigationMode = NavigationModes.VerticalSimple;
                navigationControlDE.SelectionMode = PageSelectionModes.CurrentPageSiblings;
                navigationControlDE.Skin = "left";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), navigationControlDE, "Main_Left", "Navigation", "de");

                ImageControl campusMapImageDE = new ImageControl();
                campusMapImageDE.ImageId = SampleUtilities.GetLocalizedImageId("campus", "de");
                campusMapImageDE.Width = 676;
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), campusMapImageDE, "Main_Right", "Image", "de");

                var legendHeaderLayoutControlDE = new LayoutControl();
                List<ColumnDetails> legendHeaderLayoutColumns = new List<ColumnDetails>();
                ColumnDetails legendHeaderLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 100,
                    PlaceholderId = "Center"
                };
                legendHeaderLayoutColumns.Add(legendHeaderLayoutColumn1);

                legendHeaderLayoutControlDE.Layout = SampleUtilities.GenerateLayoutTemplate(legendHeaderLayoutColumns, string.Empty);
                legendHeaderLayoutControlDE.ID = "LegendHeader";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), legendHeaderLayoutControlDE, "Main_Right", "100%", "de");

                ContentBlock legendBlockDE = new ContentBlock();
                legendBlockDE.Html = @"<h3>Legend</h3>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), legendBlockDE, "LegendHeader_Center", "Content block", "de");

                var legendLayoutControlDE = new LayoutControl();
                List<ColumnDetails> legendLayoutColumns = new List<ColumnDetails>();
                ColumnDetails legendLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 33,
                    PlaceholderId = "Left33"
                };
                legendLayoutColumns.Add(legendLayoutColumn1);
                ColumnDetails legendLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 34,
                    PlaceholderId = "Middle34"
                };
                legendLayoutColumns.Add(legendLayoutColumn2);
                ColumnDetails legendLayoutColumn3 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 33,
                    PlaceholderId = "Right33"
                };
                legendLayoutColumns.Add(legendLayoutColumn3);

                legendLayoutControlDE.Layout = SampleUtilities.GenerateLayoutTemplate(legendLayoutColumns, string.Empty);
                legendLayoutControlDE.ID = "Legend";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), legendLayoutControlDE, "Main_Right", "33% + 34% + 33%", "de");

                ContentBlockBase contentBlockLeftDE = new ContentBlockBase();
                contentBlockLeftDE.Html = @"1. Dorm A (Ryan Mcguire)<br /> 2. Fine Arts building<br /> 3. Computing center<br /> 4. Dorm B (Tomas Newman)";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), contentBlockLeftDE, "Legend_Left33", "Content block", "de");

                ContentBlockBase contentBlockMiddleDE = new ContentBlockBase();
                contentBlockMiddleDE.Html = @"5. Biology faculty<br /> 6. Chemistry building<br /> 7. Dorm C (Micheal Burgess)<br /> 8. Administration center";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), contentBlockMiddleDE, "Legend_Middle34", "Content block", "de");

                ContentBlockBase contentBlockRightDE = new ContentBlockBase();
                contentBlockRightDE.Html = @"9. Athletics facilities<br /> 10.Main Building<br /> 11.Liberal arts building<br /> 12. Dorm D (Melvin Richards)";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), contentBlockRightDE, "Legend_Right33", "Content block", "de");
            }
        }
Beispiel #43
0
 public void addBlock( ContentBlock block )
 {
     _blocks.Add( block.Name, block );
 }
Beispiel #44
0
 public override void appendData( StringBuilder sb, ContentBlock block, BlockData blockdata )
 {
 }
Beispiel #45
0
 public void addBlock( ContentBlock block )
 {
     if (_blocks.ContainsKey( block.Name )) throw new TemplateException( "请勿重复绑定(getBlock)区块。区块名=" + block.Name + ",模板文件=" + block.getTemplatePath() );
     _blocks.Add( block.Name, block );
 }