Exemple #1
0
 public void AddAnnotations(List <Annotation> annotations)
 {
     foreach (Annotation annotation in annotations)
     {
         NameValueCollection nvc = annotation.ToNameValuePairs();
         client.AddObject(annotation.PageId, ANNOTATION_CLASS_NAME, nvc);
     }
 }
        /// <summary>
        /// Adds to server SSX objects for the current page.
        /// </summary>
        public void UploadStyleSheetExtensions()
        {
            IXWikiClient client = pageConverter.XWikiClient;
            int          i      = 0;

            foreach (XWikiObject ssxObject in pageStyleSheetExtensions)
            {
                NameValueCollection fieldsValues = new NameValueCollection();

                fieldsValues.Add("code", ssxObject.objectDictionary["code"].ToString());
                fieldsValues.Add("name", ssxObject.objectDictionary["name"].ToString());
                fieldsValues.Add("use", ssxObject.objectDictionary["use"].ToString());
                fieldsValues.Add("parse", ssxObject.objectDictionary["parse"].ToString());
                fieldsValues.Add("cache", ssxObject.objectDictionary["cache"].ToString());

                bool ssxExists = false;
                List <XWikiObject> existingSSXObjects = RetrieveStyleSheetExtensions();
                foreach (XWikiObject existingSSX in existingSSXObjects)
                {
                    if (existingSSX.objectDictionary["name"] + "" == XOFFICE_SSX || existingSSX.prettyName == XOFFICE_SSX)
                    {
                        //
                        //client.RemoveObject(pageFullName, SSX_CLASS_NAME, existingSSX.id);
                        ssxExists = true;
                    }
                }
                if (ssxExists)
                {
                    client.UpdateObject(pageFullName, ssxObject.className, fieldsValues);
                }
                else
                {
                    client.AddObject(pageFullName, ssxObject.className, fieldsValues);
                }
            }
        }