protected void DebugRender(HtmlTextWriter writer)
        {
            SPSEditorPartsTools editorTools = new SPSEditorPartsTools(writer);

            if (DebugQuery)
            {
                string resultQuery = editorTools.FormatXml(CamlQuery);
                writer.Write("<font color=red>DEBUG CAML Query (Original)</font><br><font color=blue>");
                writer.Write("<pre>" + SPEncode.HtmlEncode(resultQuery) + "</pre>");
                writer.Write("</font><br>");
                resultQuery = editorTools.FormatXml(_camlPreprocessor.Preprocess());
                writer.Write("<font color=red>DEBUG CAML Query (Processed)</font><br><font color=blue>");
                writer.Write("<pre>" + SPEncode.HtmlEncode(resultQuery) + "</pre>");
                writer.Write("</font><br>");
            }


            if (DebugResults)
            {
                writer.Write("<font color=red>DEBUG XML DATA</font><br><font color=blue>");
                writer.Write("<pre>" +
                             SPEncode.HtmlEncode(editorTools.FormatXml(_rollupEngine.Data.GetXml())) +
                             "</pre>");
                writer.Write("</font><br>");
            }

            if (DebugEvaluator)
            {
                writer.Write("<font color=red>DEBUG Evaluator</font><br>");
                writer.Write(EvaluatorSample());
                writer.Write("<br>");
            }
        }
        internal void AddMenuItem(IDictionary inst, string id, string caption, string img, string desc, string clickUrl, string clickScript, int cmdNo)
        {
            MenuItemTemplate child = new MenuItemTemplate(caption, img)
            {
                ID                = id,
                Description       = desc,
                PermissionContext = this.PermContext,
                Permissions       = this.Perms
            };

            if (string.IsNullOrEmpty(clickScript))
            {
                child.ClientOnClickNavigateUrl = SPEncode.ScriptEncode(clickUrl);
            }
            else
            {
                child.ClientOnClickScript = clickScript;
            }
            this.Controls.Add(child);
            if (ProductPage.Is14)
            {
                this.ribbons.Add(new RibbonItem(child, inst, this.ClientID + id, caption, img, desc, clickUrl, clickScript, cmdNo));
                this.WebPartIDs.ToString();
            }
        }
Пример #3
0
        public void RecuperaDadosInternacao(int varIDInternacao)
        {
            //Acessando a lista Visita
            SPList lstInternacao = web.Lists["Internações"];

            //Construindo a Query CAML
            SPQuery oQuery = new SPQuery();

            oQuery.Query = "<Where>" +
                           "<Eq>" +
                           "<FieldRef Name='ID' /><Value Type='Number'>" + intIDInternacao + "</Value>" +
                           "</Eq>" +
                           "</Where>";

            //Criando uma coleção de itens, utilizando a Query CAML
            SPListItemCollection collListItems = lstInternacao.GetItems(oQuery);

            //Recupera o item
            foreach (SPListItem oListItem in collListItems)
            {
                //Guarda resultado nas variáveis
                strProntuario = SPEncode.HtmlEncode(oListItem["Prontu_x00e1_rio"].ToString());
                strPaciente   = SPEncode.HtmlEncode(oListItem["Paciente"].ToString());
            }
        }
Пример #4
0
        public string RecuperaDadosMedico(string strMedico)
        {
            strMedico = strMedico.Substring(strMedico.IndexOf("#") + 1);

            string strEspecialidade = "";

            //Acessando a lista Visita
            SPList lstMedico = web.Lists["Medicos"];

            //Construindo a Query CAML
            SPQuery oQuery = new SPQuery();

            oQuery.Query = "<Where>" +
                           "<Eq>" +
                           "<FieldRef Name='Title' /><Value Type='Text'>" + strMedico + "</Value>" +
                           "</Eq>" +
                           "</Where>";


            //Criando uma coleção de itens, utilizando a Query CAML
            SPListItemCollection collListItems = lstMedico.GetItems(oQuery);

            //Recupera o item
            foreach (SPListItem oListItem in collListItems)
            {
                strEspecialidade = oListItem["Especialidade"].ToString() != null?SPEncode.HtmlEncode(oListItem["Especialidade"].ToString()) : "";
            }

            return(strEspecialidade);
        }
Пример #5
0
        // Thank you to the following blog for the code to enable AJAX use of the TaxonomyWebTaggingControl
        // http://pholpar.wordpress.com/2010/03/03/ajax-enabling-the-taxonomywebtaggingcontrol/

        private string GetReloadJavaScript(TaxonomyWebTaggingControl taxonomyControl)
        {
            String script = String.Empty;

            String containerId = SPEncode.ScriptEncode(taxonomyControl.Controls[1].ClientID);

            Type type_TaxonomyWebTaggingControl = typeof(TaxonomyWebTaggingControl);

            MethodInfo mi_getOnloadJavascript = type_TaxonomyWebTaggingControl.GetMethod("getOnloadJavascript", BindingFlags.NonPublic | BindingFlags.Instance);
            String     fullScript             = (String)mi_getOnloadJavascript.Invoke(taxonomyControl, null);
            int        pos = fullScript.IndexOf(String.Format("function {0}_load()", containerId));

            if (pos > -1)
            {
                string endRequestFunctionName = string.Format("{0}_EndRequest", containerId);

                StringBuilder builder = new StringBuilder();
                builder.Append("var myPrm = Sys.WebForms.PageRequestManager.getInstance();");
                builder.Append("myPrm.add_endRequest(").Append(endRequestFunctionName).Append(");");
                builder.Append("function ").Append(endRequestFunctionName).Append("(sender, args)");
                builder.Append("{");
                // we get te first part of the script needed to initialization
                // we start from pos 1, because we don't need the leading '{'
                builder.Append(fullScript.Substring(1, pos - 1));
                builder.Append("Microsoft.SharePoint.Taxonomy.ScriptForWebTaggingUI.onLoad('");
                builder.Append(containerId);
                builder.Append("');");
                builder.Append("}}");

                script = builder.ToString();
            }

            return(script);
        }
        protected override void OnInit(EventArgs e)
        {
            string tmp = string.Empty, siteUrl = SPContext.Current.Web.Url.TrimEnd('/'), html, tmpCssClass = "c" + ProductPage.GuidLower(Guid.NewGuid(), false);
            bool   hasL = ProductPage.LicEdition(ProductPage.GetContext(), (ProductPage.LicInfo)null, 0), is14Popup = "1".Equals(Context.Request.QueryString ["roxDlg"]);
            Random rnd = new Random();

            if (!(ProductPage.Config <bool> (null, "_nojquery") || Page.Items.Contains("jquery")))
            {
                Page.Items ["jquery"] = new object();
                Page.ClientScript.RegisterClientScriptInclude("jquery", siteUrl + "/_layouts/" + ProductPage.AssemblyName + "/jQuery.js?v=" + ProductPage.Version);
            }
            Page.ClientScript.RegisterClientScriptInclude(ProductPage.AssemblyName, siteUrl + "/_layouts/" + ProductPage.AssemblyName + "/" + ProductPage.AssemblyName + ".js?r=" + "&v=" + ProductPage.Version);
            base.OnInit(e);
            if (!string.IsNullOrEmpty(Context.Request.QueryString ["roxPrintZen"]))
            {
                html = "<div class=\"rox-prz-toolbar\"><button type=\"button\" onclick=\"roxDoPrint();\">" + (is14Popup ? "&nbsp;&nbsp;" : string.Empty) + ProductPage.GetProductResource("ToolBar_PrintNow" + (is14Popup ? "Ctx" : string.Empty)) + "</button>&nbsp;<span>" + ProductPage.GetProductResource("ToolBar_PrintPreview" + (is14Popup ? "Ctx" : string.Empty));
                if (is14Popup)
                {
                    html += (" | Zoom: <select id=\"roxpzzoomer\" onchange=\"roxPrintZoom(this.options[this.selectedIndex].value);\"><option value=\"100\">100%</option><option value=\"120\">120%</option><option value=\"150\">150%</option><option value=\"200\">200% " + ProductPage.GetResource("Recommended") + "</option></select>");
                }
                html += "</span></div>";
                if (!ProductPage.LicEdition(ProductPage.GetContext(), (ProductPage.LicInfo)null, 2))
                {
                    html += ("<div class=\"" + tmpCssClass + "\">Powered by <b>SharePoint-Tools.net/PrintZen</b></div><style type=\"text/css\"> ." + tmpCssClass + " { text-align: center; font-size: " + rnd.Next(24, 37) + "px; padding-bottom: 12px; display: none; } @media print { div." + tmpCssClass + " { display: block !important; } } </style>");
                }
                tmp += "<link type=\"text/css\" rel=\"stylesheet\" href=\"" + siteUrl + "/_layouts/" + ProductPage.AssemblyName + "/" + ProductPage.AssemblyName + ".css?r=" + "&v=" + ProductPage.Version + "\"/>";
                tmp += "<style type=\"text/css\"> div.rox-prz-toolbar button { padding-left: 18px; padding-right: 18px; } </style>";
                tmp += "<script> roxPrintPage = '" + SPEncode.ScriptEncode(html) + "'; roxDlgOnLoad = " + "1".Equals(Context.Request.QueryString ["roxDlgShow"]).ToString().ToLowerInvariant() + "; " + (hasL ? string.Empty : "setInterval(function() { jQuery('div.ms-bodyareacell').hide(); }, 250);") + " </script>";
                Page.ClientScript.RegisterClientScriptInclude(ProductPage.AssemblyName + "2", siteUrl + "/_layouts/" + ProductPage.AssemblyName + "/mash.tl.aspx?op=r&r=" + rnd.Next(100, 1000) + "&o=" + Context.Server.UrlEncode(tmp));
            }
        }
Пример #7
0
        public bool LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            selectedItems = new List <string>();
            var postValues = postCollection[postDataKey];

            foreach (var postValue in postValues.Split(','))
            {
                selectedItems.Add(SPEncode.HtmlDecode(postValue));
            }

            fillInValue = postCollection[postDataKey + "$FillInChoiceValue"];
            if (!string.IsNullOrEmpty(fillInValue))
            {
                fillInValue = fillInValue.Trim();
            }

            if (!string.IsNullOrEmpty(fillInValue))
            {
                selectedItems.Add(fillInValue);
            }

            var oldSelectedItems = new List <string>();

            if (!string.IsNullOrEmpty(selectedItemsString))
            {
                oldSelectedItems.AddRange(selectedItemsString.Split(new [] { ";#" }, StringSplitOptions.None));
            }

            // Sort
            selectedItems.Sort();
            oldSelectedItems.Sort();

            return(!selectedItems.SequenceEqual(oldSelectedItems));
        }
Пример #8
0
        public bool LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            var keys = new List <string>(postCollection.AllKeys);

            if (!keys.Contains(postDataKey) && !keys.Contains(postDataKey + "$FillInChoice"))
            {
                return(false);
            }

            var postedValue = postCollection[postDataKey];

            if (string.Equals(postedValue, FillInChoiceValue))
            {
                postedValue = Utilities.Trim(postCollection[postDataKey + "$FillInChoice"]);
            }
            else
            {
                postedValue = SPEncode.HtmlDecode(postedValue);
            }

            if (!string.Equals(postedValue, Value))
            {
                Value = postedValue;
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// Gets and ensure the field data.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="fieldName">Name of the field.</param>
        /// <returns>The field content</returns>
        private string GetFieldData(SPItem item, string fieldName)
        {
            string fieldData = string.Empty;

            if (item[fieldName] != null)
            {
                fieldData = SPEncode.HtmlDecode(item[fieldName].ToString());

                // Dates in ISO8601
                if (_bDateTimeISO8601 &&
                    item.Fields.GetField(fieldName).Type == SPFieldType.DateTime)
                {
                    fieldData = SPUtility.CreateISO8601DateTimeFromSystemDateTime(
                        DateTime.Parse(fieldData, CultureInfo.InvariantCulture).ToUniversalTime().ToLocalTime());
                }
                else
                {
                    // fix: lookup fields
                    if (_bFixLookUp)
                    {
                        if (fieldData.IndexOf(LOOKUP_FIELD_SEPARATOR) > 0)
                        {
                            fieldData = fieldData.Substring(fieldData.IndexOf(LOOKUP_FIELD_SEPARATOR) + 2);
                        }
                    }
                }
            }
            return(fieldData);
        }
        internal void ProcessPostBack()
        {
            // Get Postback data
            if (Page.IsPostBack)
            {
                // Decode data
                string eventArg = Page.Request["__EVENTARGUMENT"];
                string eventId  = Page.Request["__EVENTTARGET"];
                if (eventArg != null && eventId == ID)
                {
                    _eventArgs = SPEncode.HtmlDecode(eventArg);
                }

                // Get data
                if (!string.IsNullOrEmpty(_eventArgs) &&
                    (_eventArgs.StartsWith("ProCopy|") ||
                     _eventArgs.StartsWith("ProCut|")))
                {
                    PasteHere();
                }

                // Get data
                if (!string.IsNullOrEmpty(_eventArgs) &&
                    (_eventArgs.StartsWith("ProCopyPic|") ||
                     _eventArgs.StartsWith("ProCutPic|")))
                {
                    PastePicsHere();
                }
            }
        }
Пример #11
0
        /// <summary>
        /// Render this Tool part to the output parameter
        /// specified.
        /// </summary>
        /// <param name="output">
        /// The HTML writer to write out to
        /// </param>
        protected override void RenderToolPart(HtmlTextWriter output)
        {
            // Establish a reference to the Web Part.
            SharePointForumWebPart wp1 = (SharePointForumWebPart)this.ParentToolPane.SelectedWebPart;

            output.Write("Enter your custom text: ");
            output.Write("<input name= '" + inputname);
            output.Write("' type='text' value='" + SPEncode.HtmlEncode(ForumApplication.Instance.Title) + "'> <br>");
        }
Пример #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string encodedListId = SPEncode.UrlEncode(this.ListGuid.ToString("B").ToUpper());
         linkNewView.NavigateUrl         += "List=" + encodedListId;
         linkNewViewCalendar.NavigateUrl += "List=" + encodedListId;
     }
 }
Пример #13
0
        protected override void CreateChildControls()
        {
            Controls.Clear();

            SPWeb web = SPContext.Current.Web;

            newItemPanel = new Panel()
            {
                ID = "panelNewItem"
            };

            string navigateUrl = "javascript:void(0);";
            string webUrl      = SPContext.Current.Web.ServerRelativeUrl.TrimEnd('/');
            string listId      = SPEncode.UrlEncode(this.List.Id.ToString("B").ToUpper());

            if (!this.IsMultiContentTypeList)
            {
                navigateUrl = string.Format("javascript:SP.UI.ModalDialog.ShowPopupDialog('{0}')",
                                            BuidUri(string.Format(URL_FORMAT, webUrl, this.List.DefaultContent.NewItemUrl.TrimStart('/'), listId), this.UrlParamsFromParent));
            }

            HyperLink addNewLink = new HyperLink {
                ID          = "linkAddNewItem", ToolTip = "new item",
                CssClass    = "ms-heroCommandLink " + this.List.Id.ToString("N"),
                NavigateUrl = navigateUrl
            };
            Label addNewImgLabel = new Label()
            {
                CssClass = "ms-list-addnew-imgSpan20"
            };
            Image addNewImg = new Image {
                ImageUrl = "/_layouts/15/images/spcommon.png?rev=23",
                CssClass = "ms-list-addnew-img20"
            };
            Label addNewLabel = new Label()
            {
                Text = "new item"
            };

            addNewImgLabel.Controls.Add(addNewImg);
            addNewLink.Controls.Add(addNewImgLabel);
            addNewLink.Controls.Add(addNewLabel);

            // add extra hidden SELECT control to access all list Content types from Ribbon Button
            DropDownList ctList = new DropDownList {
                ID = "listOfContentTypes", CssClass = "ct-for-" + this.List.Id.ToString("N").ToUpper()
            };

            ctList.Style.Add("display", "none");
            ctList.Items.AddRange(this.VisibleContentTypes.Select(item => new ListItem(item.Name,
                                                                                       BuidUri(string.Format(URL_FORMAT, webUrl, item.NewItemUrl.TrimStart('/'), listId), UrlParamsFromParent))).ToArray());

            newItemPanel.Controls.Add(addNewLink);
            newItemPanel.Controls.Add(ctList);
            this.Controls.Add(newItemPanel);
        }
Пример #14
0
 protected override void RenderFieldForDisplay(HtmlTextWriter writer)
 {
     if (SPContext.Current.FormContext.FormMode == SPControlMode.New)
     {
         writer.Write("&nbsp;");
     }
     else
     {
         writer.Write(ItemFieldValue == null ? "&nbsp;" : SPEncode.HtmlEncode(ItemFieldValue.ToString()));
     }
 }
        protected override void ValidateInstance(IDictionary inst, ref string clickScript)
        {
            string str;
            bool   flag = false;
            string str2 = ",";

            if (inst["unix"] != null)
            {
                try
                {
                    flag = (bool)inst["unix"];
                }
                catch
                {
                    flag = false;
                }
            }
            if (flag && !ZenMenuItem.IsLic(2))
            {
                flag        = false;
                clickScript = "alert('" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", new object[] { ProductPage.GetProductResource("PC_" + base.SchemaName + "_unix", new object[0]), "Basic" })) + "');";
            }
            if (!string.IsNullOrEmpty(str = inst["sep"] + string.Empty))
            {
                if (str == "s")
                {
                    str2 = ";";
                }
                else if (str == "t")
                {
                    str2 = "\t";
                }
            }
            else if (inst["excel"] != null)
            {
                try
                {
                    if ((bool)inst["excel"])
                    {
                        str2 = ";";
                    }
                }
                catch
                {
                }
            }
            if ((str2 != ",") && !ZenMenuItem.IsLic(2))
            {
                str2        = ",";
                clickScript = "alert('" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", new object[] { ProductPage.GetProductResource("PC_" + base.SchemaName + "_sep", new object[0]), "Basic" })) + "');";
            }
            this.seps[inst["id"]]   = str2;
            this.unixes[inst["id"]] = flag;
        }
Пример #16
0
        private string GetMenuJsScript()
        {
            var webUrl = SPContext.Current.Web.ServerRelativeUrl.TrimEnd('/');
            var listId = SPEncode.UrlEncode(this.List.Id.ToString("B").ToUpper());

            const string menuItemFormat = "\"{0}\": {{name: \"{0}\", callback: function(key, opt){{ SP.UI.ModalDialog.ShowPopupDialog('{1}'); }}}}";
            var          menuItems      = VisibleContentTypes.Select(item => string.Format(menuItemFormat,
                                                                                           item.Name, BuidUri(string.Format(URL_FORMAT, webUrl, item.NewItemUrl.TrimStart('/'), listId), UrlParamsFromParent))).ToList();

            return(string.Format("{{{0}}}", string.Join(",", menuItems)));
        }
Пример #17
0
        public override string GetCellTextValue(DataRow row)
        {
            var value = row[FieldName];

            if (value is DBNull)
            {
                return(DefaultValue);
            }

            return(SPEncode.HtmlEncode(value.ToString()));
        }
Пример #18
0
        public virtual void RenderCell(HtmlTextWriter writer, IGrouping <object, DataRow> grouping)
        {
            var groupKey = Convert.ToString(grouping.Key);

            if (string.IsNullOrEmpty(groupKey))
            {
                groupKey = EmptyGroupString;
            }

            writer.Write(SPEncode.HtmlEncode(groupKey));
        }
Пример #19
0
        private void InitializeApplication()
        {
            UrlQuery query = new UrlQuery(this.Page.Request.Url.ToString());

            ForumApplication.Instance.BasePath          = SPEncode.UrlEncodeAsUrl(query.Url);
            ForumApplication.Instance.Title             = this.Name;
            ForumApplication.Instance.ForumCache        = this.Page.Cache;
            ForumApplication.Instance.ClassResourcePath = this.ClassResourcePath;
            ForumApplication.Instance.SpUser            = SPControl.GetContextWeb(Context).CurrentUser;
            ForumApplication.Instance.AppPoolUser       = SPControl.GetContextSite(Context).OpenWeb().CurrentUser;
            ForumApplication.Instance.SpWeb             = SPControl.GetContextSite(Context).OpenWeb();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    if (this.List == null)
                    {
                        throw new Exception("List not found");
                    }

                    // init List name
                    lblListName.Text = this.List.Name;

                    // Add fields
                    var allFields = this.List.ListMetadataContentTypes.SelectMany(ct => ct.ListMetadataFieldContentTypes.Select(ctf => new {
                        ContentType = ct.Name,
                        FieldId     = ctf.ListMetadataFieldId,
                        Field       = ctf.ListMetadataField
                    }));
                    ColumnsRepeater.DataSource = allFields.GroupBy(g => g.FieldId).Select(g => new {
                        Id        = g.Key,
                        FieldName = g.First().Field.FieldName,
                        FieldType = g.First().Field.FieldType,
                        UsedIn    = string.Join(", ", g.Select(x => x.ContentType))
                    }).OrderBy(f => f.FieldName);
                    ColumnsRepeater.DataBind();

                    // Add Content Types
                    ContTypesRepeater.DataSource = this.List.ListMetadataContentTypes.OrderBy(ct => ct.IsDefault);
                    ContTypesRepeater.DataBind();

                    // Add Views
                    ViewsRepeater.DataSource = this.ListViews.OrderBy(f => f.Name);
                    ViewsRepeater.DataBind();

                    // add 'List' url param to links
                    string encodedListId = SPEncode.UrlEncode(this.ListGuid.ToString("B").ToUpper());
                    linkNewField.NavigateUrl        += "?List=" + encodedListId;
                    linkNewView.NavigateUrl         += "?List=" + encodedListId;
                    linkNewContentType.NavigateUrl  += "?List=" + encodedListId;
                    linkListPermissions.NavigateUrl += "?ListId=" + encodedListId;
                }
                catch (Exception ex) {
                    panelErrror.Controls.Add(new Microsoft.SharePoint.Mobile.Controls.Label()
                    {
                        Text = ex.Message
                    });
                }
            }
        }
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            SPWeb web = __Context.Web;

            SPList list = web.Lists[Microsoft.SharePoint.WorkflowActions.Helper.GetListGuid(__Context, ListId)];

            SPFolder folder = list.RootFolder;

            SPFile file = folder.Files.Add(FileName, Encoding.UTF8.GetBytes(Xml), Overwrite);

            FileItemId = new SPItemKey(file.Item.ID);
            FileUrl    = SPEncode.UrlEncode(web.Url + "/" + file.Url);

            return(ActivityExecutionStatus.Closed);
        }
Пример #22
0
        public override void RenderCell(HtmlTextWriter writer, DataRow row)
        {
            var value = Convert.ToString(row[FieldName]);

            if (string.IsNullOrEmpty(value))
            {
                writer.Write(DefaultValue);
                return;
            }

            value = SPEncode.HtmlEncode(value);
            var split = value.Split(new[] { ";#" }, StringSplitOptions.RemoveEmptyEntries);

            writer.Write(string.Join("; ", split));
        }
        protected override void ValidateInstance(IDictionary inst, ref string clickScript)
        {
            bool   unix = false;
            string acsep, sep = ",";

            if (inst ["unix"] != null)
            {
                try {
                    unix = (bool)inst ["unix"];
                } catch {
                    unix = false;
                }
            }
            if (unix && !IsLic(2))
            {
                unix        = false;
                clickScript = "alert(\'" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", ProductPage.GetProductResource("PC_" + SchemaName + "_unix"), "Basic")) + "\');";
            }
            if (!string.IsNullOrEmpty(acsep = inst ["sep"] + string.Empty))
            {
                if (acsep == "s")
                {
                    sep = ";";
                }
                else if (acsep == "t")
                {
                    sep = "\t";
                }
            }
            else if (inst ["excel"] != null)
            {
                try {
                    if ((bool)inst ["excel"])
                    {
                        sep = ";";
                    }
                } catch {
                }
            }
            if ((sep != ",") && !IsLic(2))
            {
                sep         = ",";
                clickScript = "alert(\'" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", ProductPage.GetProductResource("PC_" + SchemaName + "_sep"), "Basic")) + "\');";
            }
            seps [inst ["id"]]   = sep;
            unixes [inst ["id"]] = unix;
        }
Пример #24
0
        /// <summary>
        /// Relative url for zoom builder
        /// </summary>
        /// <returns>The relative Url</returns>
        private static string ZoomBuilderRelativeUrl()
        {
            HttpContext current  = HttpContext.Current;
            SPWeb       web      = SPControl.GetContextWeb(current);
            string      relative = web.ServerRelativeUrl;

            if (relative == "/")
            {
                relative = "/_layouts/zoombldr.aspx";
            }
            else
            {
                relative += "/_layouts/zoombldr.aspx";
            }

            return(SPEncode.UrlEncodeAsUrl(relative));
        }
        /// <summary>
        /// Debugs the render.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="transformed">The transformated.</param>
        internal void DebugRender(HtmlTextWriter writer, string transformed)
        {
            SPSEditorPartsTools tools = new SPSEditorPartsTools(writer);

            //if (DebugSource)
            //{
            //    writer.Write("<font color=red>DEBUG XML DATA</font><br><font color=blue>");
            //    writer.Write("<pre>" + SPEncode.HtmlEncode(tools.FormatXml(XmlData)) + "</pre>");
            //    writer.Write("</font><br>");
            //}

            if (DebugTransformation)
            {
                writer.Write("<font color=red>DEBUG XML TRANSFORM</font><br><font color=blue>");
                writer.Write("<pre>" + SPEncode.HtmlEncode(tools.FormatXml(transformed)) + "</pre>");
                writer.Write("</font><br>");
            }
        }
Пример #26
0
        /// <summary>
        /// Gets the folder from query string.
        /// </summary>
        protected void GetFolderFromQueryString()
        {
            if (Page != null)
            {
                string folder = Page.Request.QueryString[RootFolderParameter];
                string view   = Page.Request.QueryString[ViewParameter];

                if (folder != null && view != null)
                {
                    if (SPHttpUtility.UrlKeyValueEncode(GetView().ID) == view)
                    {
                        CurrentFolder =
                            SPEncode.UrlDecodeAsUrl(
                                SPHttpUtility.UrlKeyValueDecode(folder));
                    }
                }
            }
        }
Пример #27
0
        public Hashtable CreateFolderInLibrary(SPUserCodeWorkflowContext context, string folderName, string libraryName, string folderPath)
        {
            char[] filenameChars = folderName.ToCharArray();
            foreach (char c in filenameChars)
            {
                if (!SPEncode.IsLegalCharInUrl(c))
                {
                    folderName = folderName.Replace(c.ToString(), "");
                }
            }
            results["result"] = string.Empty;
            try
            {
                using (SPSite site = new SPSite(context.CurrentWebUrl))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        SPList library = web.Lists[libraryName];

                        if (library != null)
                        {
                            string folderUrl = CreateFolder(library, folderName, folderPath, web);
                            results["result"]   += "Created Finished";
                            results["folderUrl"] = folderUrl;
                        }
                        else
                        {
                            results["result"]    = string.Format("Library ({0}) not found.", libraryName);
                            results["folderUrl"] = string.Empty;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                results              = new Hashtable();
                results["result"]    = e.ToString();
                results["folderUrl"] = string.Empty;
            }

            return(results);
        }
        /// <summary>
        /// Gets and ensure the field data.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="fieldName">Name of the field.</param>
        /// <returns>The field content</returns>
        private string GetFieldData(SPItem item, string fieldName)
        {
            string fieldData = string.Empty;

            if (ItemContainsFieldAndData(item, fieldName))
            {
                try
                {
                    fieldData = SPEncode.HtmlDecode(item[fieldName].ToString());
                    fieldData = ProcessFieldData(item, fieldName, fieldData);
                }
                catch (FormatException ex)
                {
                    Debug.WriteLine(fieldName);
                    Debug.WriteLine("GetFieldData " + ex);
                }
            }
            Debug.WriteLine("GetFieldData " + fieldName + "=" + fieldData);
            return(fieldData);
        }
Пример #29
0
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("http://testsp2007"))
            {
                using (SPWeb web = site.OpenWeb("/ik"))
                {
                    SPList  list  = web.GetList(web.Url + "/Lists/Departmanlar");
                    SPQuery query = new SPQuery();
                    query.RowLimit = 5000;
                    string sp2016url = "http://testsp2016/ik";
                    string saatbody = string.Empty, saatoutlookbody = string.Empty;
                    string listurl        = "_api/web/Lists?$expand=ListItemAllFields&$filter=Title eq 'Departmanlar'";
                    string encodedlisturl = SPEncode.UrlEncode(listurl);
                    string listguid       = RestHelper.GetIdOfList(sp2016url + SPEncode.UrlDecodeAsUrl(encodedlisturl),
                                                                   sp2016url + "_api/contextinfo");

                    SPListItemCollection items = list.GetItems(query);
                    foreach (SPListItem item in items)
                    {
                        try
                        {
                            if (item != null)
                            {
                                var sirket = Helper.Get_LookUp("Sirket", item, web, sp2016url, "SirketId");
                                var title  = Helper.Get_String("Title", item, web, sp2016url, "Title");
                                var mudur  = Helper.Get_Group("Mudur", item, web, sp2016url, "MudurId");
                                RestHelper.RestYap("{'__metadata': {'type': 'SP.Data.DepartmanlarListItem'}," + sirket + "," + title + "," + mudur + " }",
                                                   sp2016url + "_api/contextinfo",
                                                   listguid + "/items",
                                                   listguid,
                                                   false, false, false, false);
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                }
            }
        }
Пример #30
0
        public void MontaListaVisita(int varIDInternacao)
        {
            string varLinha = "";

            lblProntuario.Text = strProntuario.ToString();
            lblPaciente.Text   = strPaciente.ToString();

            //Acessando a lista Visita
            SPList lstVisita = web.Lists["Visitas"];

            //Construindo a Query CAML
            SPQuery oQuery = new SPQuery();

            oQuery.Query = "<Where>" +
                           "<Eq>" +
                           "<FieldRef Name='Registro_x0020_de_x0020_interna_' /><Value Type='Lookup'>" + intIDInternacao + "</Value>" +
                           "</Eq>" +
                           "</Where>";

            //Criando uma coleção de itens, utilizando a Query CAML
            SPListItemCollection collListItems = lstVisita.GetItems(oQuery);

            //Recupera o item
            foreach (SPListItem oListItem in collListItems)
            {
                //Busca Especialidade do médico da visita
                string strEspecMedico = RecuperaDadosMedico(SPEncode.HtmlEncode(oListItem["M_x00e9_dico_x0020_da_x0020_Visi"].ToString()));

                //Monta linha da grid com os resultados
                varLinha += "<tr><td valign='top' class='ms-formbody'>" + oListItem["M_x00e9_dico_x0020_da_x0020_Visi"] != null?SPEncode.HtmlEncode(oListItem["M_x00e9_dico_x0020_da_x0020_Visi"].ToString()) : "" + "</td>" +
                                "<td valign='top' class='ms-formbody'>" + SPEncode.HtmlEncode(strEspecMedico.ToString()) + "</td>" +
                                "<td valign='top' class='ms-formbody'>" + oListItem["Tipo_x0020_de_x0020_Visita"] != null?SPEncode.HtmlEncode(oListItem["Tipo_x0020_de_x0020_Visita"].ToString()) : "" + "</td>" +
                                    "<td valign='top' class='ms-formbody'>" + oListItem["Hora_x0020_de_x0020_In_x00ed_cio"] != null?SPEncode.HtmlEncode(oListItem["Hora_x0020_de_x0020_In_x00ed_cio"].ToString()) : "" + "</td>" +
                                        "<td valign='top' class='ms-formbody'>" + oListItem["Hora_x0020_de_x0020_Fim_x0020_da"] != null?SPEncode.HtmlEncode(oListItem["Hora_x0020_de_x0020_Fim_x0020_da"].ToString()) : "" + "</td>" +
                                            "<td valign='top' class='ms-formbody'>" + oListItem["Observa_x00e7__x00e3_o"] != null?SPEncode.HtmlEncode(oListItem["Observa_x00e7__x00e3_o"].ToString()) : "" + "</td></tr>";
            }

            ltrListaVisita.Text = varLinha.ToString();
        }