コード例 #1
0
        /// <summary>
        /// 实现执行函数
        /// </summary>
        override public void Execute()
        {
            if (NewSnipData == null)
            {
                return;
            }
            TmpltDesignerPanel tDpanel = dPanel as TmpltDesignerPanel;

            tDpanel.SaveRects();
            foreach (Rect rect in PastedSnipRects)
            {
                rect.SnipData = new SnipData(NewSnipData);
                SnipXmlElement newEle = (SnipXmlElement)Doc.ParseElement(rect.SnipData.SnipElementText);
                if (Doc.HasContentSnip && newEle.SnipType == PageSnipType.Content)
                {
                    MessageService.Show("${res:tmpltDesign.tmpltDrawPanel.message.hasContentSnip}");
                    return;
                }
                SnipXmlElement ele = Doc.GetSnipElementById(rect.SnipID);
                ele.SelectSingleNode("parts").RemoveAll();
                ele.SetAttribute("hasSnip", newEle.GetAttribute("hasSnip"));
                ele.SetAttribute("type", newEle.GetAttribute("type"));

                XmlNodeList nodes = newEle.SelectSingleNode("parts").SelectNodes("//part");
                foreach (XmlNode partNode in nodes)
                {
                    (partNode as XmlElement).SetAttribute("partId", XmlUtilService.CreateIncreaseId());
                    ele.SelectSingleNode("parts").AppendChild(partNode);
                }
                rect.HasSnip = true;
            }
            dPanel.Modified = true;
        }
コード例 #2
0
 /// <summary>
 /// 通过模板及snipID获得页面片的HTml,并将该SnipEle实例加入到字典中,为Tocss做准备
 /// </summary>
 static public string GetSnipContent(string tmpltId, string snipId)
 {
     try
     {
         TmpltXmlDocument tmpltDoc = ToHtmlSdsiteService.SdsiteXmlDocument.GetTmpltDocumentById(tmpltId);
         SnipXmlElement   snipEle  = tmpltDoc.GetSnipElementById(snipId);
         string           snipHtml = "";// lukan, 2008-6-23 10:38:45, 重构             snipEle.ToRealHtml();
         //if (!string.IsNullOrEmpty(snipEle.ToRealCss()))
         //{
         //    ActiveTmpltAndSnip.AddSnipElementIntoDictionary(snipEle);
         //}
         return(snipHtml);
     }
     catch (Exception e)
     {
         ExceptionService.CreateException(e);
         return(string.Empty);
     }
 }
コード例 #3
0
        private void NewMethod(string channelId)
        {
            //查找拥有此页面直属的频道节点的所有的模板节点,返回模板ID集合
            string[] tmpltIdArray = SdsiteDocument.GetTmpltIdArray(channelId);

            foreach (var tmpltId in tmpltIdArray)
            {
                TmpltXmlDocument tmpltDoc = SdsiteDocument.GetTmpltDocumentById(tmpltId);

                //得到当前模板下拥有此页面所属频道的类型为list的所有part的父父级snip的集合
                string[] snipIdArray = SdsiteDocument.GetSnipIdArray(tmpltId, channelId);

                //循环snip集合,获得每个snip节点下的分别有拥有此页面所属的频道的类型为list的part节点的集合
                foreach (var snipId in snipIdArray)
                {
                    //重新生成 snip 页面
                    SnipXmlElement snipEle = tmpltDoc.GetSnipElementById(snipId);
                    if (!snipEle.IsModified)
                    {
                        snipEle.SaveXhtml(ToHtmlHelperObj);
                    }

                    //对其part 的处理
                    snipEle.GetPartsElement();
                }

                //不论按哪种排序,则先将其所属的snip节点重新生成一遍


                //如果其排序方式为自动提取关键字,则取出此part下的所有频道id,及页面类型集合


                //循环这些频道,找出页面类型为以上类型集合的所有页面


                //此处应有一些分支操作:=====isModified = false的一定要重新生成(并记录下isModified=false,并记录重新生成过的页面),而ismodified为真或是isAlreadyPublish =false,或是isdeleted=true自然会有一些相应的操作


                //最后,将重新生成这些页面
            }
        }
コード例 #4
0
        /// <summary>
        /// 打开或添加页面片属性
        /// </summary>
        /// <param name="selectedRect"></param>
        private void ChangeSnipPerperty(SnipRect selectedRect)
        {
            if (selectedRect.HasSnip)
            {
                ///打开页面片
                Form snipForm = Service.Workbench.OpenWorkDocument(WorkDocumentType.SnipDesigner, selectedRect.SnipID, (TDPanel as TmpltDesignerPanel).TmpltID);
            }
            else
            {
                TmpltXmlDocument   doc     = TmpltDoc;
                TmpltDesignerPanel tDpanel = TDPanel as TmpltDesignerPanel;
                //tDpanel.SaveTmplt(doc);
                tDpanel.SaveRects();
                NewSnipSetupForm form = new NewSnipSetupForm(doc, selectedRect, GetHasContentSnip());
                if (form.ShowDialog() == DialogResult.OK)
                {
                    SnipXmlElement snipElement = doc.GetSnipElementById(selectedRect.SnipID);
                    snipElement.SnipName = form.SnipName;
                    snipElement.SnipType = form.SnipType;
                    snipElement.Width    = selectedRect.Width.ToString() + "px";
                    snipElement.Height   = selectedRect.Height.ToString() + "px";
                    snipElement.Title    = form.SnipName;
                    snipElement.HasSnip  = true;

                    tDpanel.SaveRects();
                    selectedRect.HasSnip  = true;
                    TDPanel.Modified      = true;
                    selectedRect.SnipType = form.IsContent ? PageSnipType.Content : PageSnipType.General;
                    if (form.IsContent)
                    {
                        if (!doc.HasContentSnip)
                        {
                            doc.HasContentSnip = true;
                        }
                    }
                    TDPanel.HasContentSnip = form.IsContent;
                    ///打开页面片
                    Form snipForm = Service.Workbench.OpenWorkDocument(WorkDocumentType.SnipDesigner, selectedRect.SnipID, (TDPanel as TmpltDesignerPanel).TmpltID);
                }
            }
        }