1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Can any one please send me the code for java scriptTelerik.Cms.Engine.Resources.TagEditor.js

Can any one please send me the code for java scriptTelerik.Cms.Engine.Resources.TagEditor.js

9 posts, 0 answered
  1. Venkat
    Venkat avatar
    105 posts
    Registered:
    20 Nov 2008
    20 Dec 2008
    Link to this post

    In my application I created a user control which is just like TagEditor.

    I implemented every thing but to complete it i need the java script function

    Telerik.Cms.Engine.Resources.TagEditor.js.

    Can any one  please send me the file .I badly need it.

    Thank you
     Venkat
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    20 Dec 2008
    Link to this post
    Hello Venkat,

    We have attached the required file to this post.

    Best wishes,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Venkat
    Venkat avatar
    105 posts
    Registered:
    20 Nov 2008
    22 Dec 2008
    Link to this post
    Hi Pepi ,

    Thank you for your reply.

    In our project we are deviding the tags into two sets  as Industries and services.

    So I created a user control which imitates the TagEditor .

    I almost succeeded , but  I am not able to show the prevoiusly selected tags for that particular content or blog post

    my custom TagEditor not able to accesss the Content ID of that content.

    I tried to know how the TagEditor using it to show the already selected tags,but I dont know  that where the content item was set.It is not set in the TagEditor but its being used by the TagEditor.

    I want to use that contentid in my custom editor too. Can you please give me some solution to solve this.

    Thank you
     Venkat
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    29 Dec 2008
    Link to this post
    Hello Venkat,

    Below is an example how to get the content items IDs

    // create new instance of ContentManager 
    ContentManager contentManager = new ContentManager(); 
    // get all content items 
    IList listOfContentItems = contentManager.GetContent(0, 10); 
    List<Guid> idList = new List<Guid>(listOfContentItems.Count); 
        { 
           foreach (IContent cnt in listOfContentItems) 
              { 
                  idList.Add(cnt.ID); 
              } 
         } 

    Let us know if you are trying to do the same. If possible send us your code implementation.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Venkat
    Venkat avatar
    105 posts
    Registered:
    20 Nov 2008
    29 Dec 2008
    Link to this post
    Hi Ivan,

    Thank you for your reply.

    I want to know the content id of the post being edited.

    Could you please tell me ,How can I know the currently opened or being modified  post content item

    Thank you
    Venkat
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    30 Dec 2008
    Link to this post
    Hi Venkat,

    When you get a content for editing you can use StagedContent as below to get the ID of the currently edited item.

    StagedContent itemToChange = contentManager.GetStagedContent(cnt.ID) as StagedContent
                ..... 
                    ...... 
                contentManager.SaveContent(itemToChange); 

    Regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Venkat
    Venkat avatar
    105 posts
    Registered:
    20 Nov 2008
    31 Dec 2008
    Link to this post
    Hi Ivan

    StagedContent itemToChange = contentManager.GetStagedContent(cnt.ID) as StagedContent

    here what is the cnt.ID.?

    from where should I get this cnt.ID.

    Here my need is, as I have no direct access to Tags of the currently being modified blog post I strucked here .here is my code.

    using System;

    using System.Data;

    using System.Configuration;

    using System.Collections;

    using System.Web;

    using System.Web.Security;

    using System.Web.UI;

    using System.Web.UI.WebControls;

    using System.Web.UI.WebControls.WebParts;

    using System.Web.UI.HtmlControls;

    using Telerik.Cms.Engine;

    using Telerik.Security;

    using Telerik.Cms.Engine.WebControls.Tags;

    using System.Collections.Generic;

    public partial class Sitefinity_Admin_ControlTemplates_Blogs_ServiceEditor : System.Web.UI.UserControl

    {

    ContentManager manager = new ContentManager("Blogs");

    List<String> tags = new List<string>();

    Guid contentId;

    string providerName = "Blogs";

    string Service_KeyWord = "SSRRVV";

    private string contentIdString;

     

    public string ContentIdString

    {

    get { return contentIdString; }

    set { contentIdString = value; }

    }

    protected void Page_Load(object sender, EventArgs e)

    {

    TagEditor tagEditor = this.Page.FindControl("tagsControl") as TagEditor;

    StagedContent itemToChange = manager.GetStagedContent(cnt.ID) as StagedContent;

    this.Page.SaveStateComplete += new EventHandler(Page_SaveStateComplete);

    //this.Page.Controls;

    if (tagEditor != null)

    this.contentId = tagEditor.ContentId;

    if (IsPostBack)

    {

    LinkButton addPostBtn = sender as LinkButton;

    if (addPostBtn != null)

    {

    SaveTags(contentId);

    }

    }

    //this.contentId = base.ContentId;

    if (this.contentId != Guid.Empty)

    {

    foreach (ITag tag in this.manager.GetTags(this.contentId))

    {

    HtmlGenericControl child = new HtmlGenericControl("li");

    child.ID = "service_" + tag.TagName;

    Label label = new Label();

    label.Text = tag.TagName + " ";

    child.Controls.Add(label);

    HyperLink link = new HyperLink();

    link.Text = "remove";

    link.NavigateUrl = "#";

    link.Attributes.Add("onclick", "alert(this.parentNode);RemoveService_(this.parentNode,'" + RemoveService_KeyWord(tag.TagName) + "');RemoveTag(ctl00_ContentPlaceHolder1_contolPanel_ctl00_ctl00_editMetaFields_ctl00_tagsControl_ctl00_ctl00_tag" + tag.TagName + ",'" + tag.TagName + "'); return false;");

    child.Controls.Add(link);

    servicesList.Controls.Add(child);

    //HiddenField selectedTags = this.container.SelectedTags;

    selectedServices.Value = selectedServices.Value + (tag.TagName + ";");

    }

    }

    selectedServices.ValueChanged += new EventHandler(this.SelectedTags_ValueChanged);

    BindMyService_s();

    BindAllService_s();

    allInServicesAutoComplete.Value.TrimEnd(new char[] { ';' });

     

     

    }

    void Page_SaveStateComplete(object sender, EventArgs e)

    {

    //throw new Exception("The method or operation is not implemented.");

    SaveTags(contentId);

    }

    public void SaveTags(Guid contentId)

    {

    //this.manager.SaveTags(contentId, this.tags);

    }

     

    private void SelectedTags_ValueChanged(object sender, EventArgs e)

    {

    this.tags = new List<string>();

    foreach (string str in selectedServices.Value.Split(new char[] { ';' }))

    {

    if (!string.IsNullOrEmpty(str))

    {

    this.tags.Add(AddService_KeyWord(str));

    }

    }

    }

    protected override void LoadControlState(object savedState)

    {

    if (savedState != null)

    {

    object[] objArray = (object[])savedState;

    this.providerName = (string)objArray[0];

    this.tags = (List<string>)objArray[1];

    this.contentId = (Guid)objArray[2];

    }

    }

    protected override void OnInit(EventArgs e)

    {

    base.OnInit(e);

    if (base.Page != null)

    {

    base.Page.RegisterRequiresControlState(this);

    }

    }

    protected override void OnPreRender(EventArgs e)

    {

    TagEditor tagEditor = this.Page.FindControl("tagsControl") as TagEditor;

    base.OnPreRender(e);

    if ((this.Page != null))

    {

    //this.Page.ClientScript.RegisterClientScriptResource(typeof(Sitefinity_Admin_ControlTemplates_Blogs_Service_Editor), "Telerik.Cms.Engine.Resources.TagEditor.js");

    //this.Page.ClientScript.RegisterClientScriptResource(typeof(TagEditor), "Telerik.Cms.Engine.Resources.TagEditor.js");

    if (!this.Page.ClientScript.IsClientScriptIncludeRegistered("Sitefinity"))

    {

    this.Page.ClientScript.RegisterClientScriptInclude("Sitefinity", this.Page.ResolveUrl("~/Sitefinity/Admin/Scripts/Library/sitefinity.js"));

    }

    if (!this.Page.ClientScript.IsClientScriptIncludeRegistered("ColorLibrary"))

    {

    this.Page.ClientScript.RegisterClientScriptInclude("ColorLibrary", this.Page.ResolveUrl("~/Sitefinity/Admin/Scripts/Library/colorLibrary.js"));

    }

    if (!this.Page.ClientScript.IsClientScriptIncludeRegistered("FadeFromYellow"))

    {

    this.Page.ClientScript.RegisterClientScriptInclude("FadeFromYellow", this.Page.ResolveUrl("~/Sitefinity/Admin/Scripts/fadeFromYellow.js"));

    }

    if (!this.Page.ClientScript.IsClientScriptIncludeRegistered("createSitefinity_Admin_ControlTemplates_Blogs_Service_Editor"))

    this.Page.ClientScript.RegisterStartupScript(typeof(Sitefinity_Admin_ControlTemplates_Blogs_ServiceEditor), "createSitefinity_Admin_ControlTemplates_Blogs_Service_Editor", string.Format("Service_Editor.Create('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}');", new object[] { this.ClientID, newService_Panel.ClientID, showNewService_Panel.ClientID, yourService_sPanel.ClientID, allService_sPanel.ClientID, Service_Name.ClientID, servicesList.ClientID, selectedServices.ClientID, yourInDustriesList.ClientID, allIndustriesList.ClientID, allInServicesAutoComplete.ClientID }), true);

    newService_Panel.Style["display"] = "none";

    yourService_sPanel.Style["display"] = "none";

    allService_sPanel.Style["display"] = "none";

    }

    }

     

     

     

     

    private void BindMyService_s()

    {

    IList list = this.manager.GetTags(SecurityManager.GetCurrentUserName(), "TagName", true);

    if (list != null)

    {

    foreach (ITag tag in list)

    {

    if (tag.TagName.Contains(Service_KeyWord))

    {

    HtmlGenericControl child = new HtmlGenericControl("li");

    HtmlGenericControl control2 = new HtmlGenericControl("span");

    child.Controls.Add(control2);

    HyperLink link = new HyperLink();

    link.Text = RemoveService_KeyWord(tag.TagName);

    link.NavigateUrl = "#";

    link.Attributes.Add("onclick", "AddService_FromList('" + RemoveService_KeyWord(tag.TagName) + "');AddTagFromList('" + AddService_KeyWord(tag.TagName) + "'); return false;");

    child.Controls.Add(link);

    yourInDustriesList.Controls.Add(child);

    }

    }

    }

    }

    private void BindAllService_s()

    {

    foreach (ITag tag in this.manager.GetTags(string.Empty, "TagName", true))

    {

    if (tag.TagName.Contains(Service_KeyWord))

    {

    HtmlGenericControl child = new HtmlGenericControl("li");

    HtmlGenericControl control2 = new HtmlGenericControl("span");

    child.Controls.Add(control2);

    HyperLink link = new HyperLink();

    link.Text = RemoveService_KeyWord(tag.TagName);

    link.NavigateUrl = "#";

    link.Attributes.Add("onclick", "AddService_FromList('" + RemoveService_KeyWord(tag.TagName) + "');AddTagFromList('" + AddService_KeyWord(tag.TagName) + "'); return false;");

    child.Controls.Add(link);

    allIndustriesList.Controls.Add(child);

    //HiddenField allInServicesAutoComplete = this.container.AllTagsAutoComplete;

    allInServicesAutoComplete.Value = allInServicesAutoComplete.Value + (RemoveService_KeyWord(tag.TagName) + ";");

    }

    }

    }

    string RemoveService_KeyWord(string service_)

    {

    return service_.Replace(Service_KeyWord, "");

    }

    string AddService_KeyWord(string service_)

    {

    return Service_KeyWord + RemoveService_KeyWord(service_);

    }

     

    #region ITagEditor Members

    public Guid ContentId

    {

    get

    {

    return contentId;

    }

    set

    {

    contentId = value;

    }

    }

    public string ProviderName

    {

    get

    {

    return "Blogs";

    }

    set

    {

    providerName = value;

    }

    }

    #endregion

    }

  8. Venkat
    Venkat avatar
    105 posts
    Registered:
    20 Nov 2008
    02 Jan 2009
    Link to this post
    Hi Ivan

    Can you please reply to my problem.

    I want to display all tags which are associated with the current blog post which is being modifed or edited in customized way.

    How can find the particular content item or blog which is being edited from the list of content items belong to the particular provider (example Blogs).

    As I need it very urgently ,again im sending you this.

    Thank you
    Venkat.
  9. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    08 Jan 2009
    Link to this post
    Hi Venkat,

    Well, I am not sure what more we can elaborate on here. The cnt object is the IContent that is currently being edited. I am not sure what your custom implementation is and how you choose what to be edited. You get your item for editing as IContent, and take the ID - this is what you should provide to the TagEditor.

    Regards,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
9 posts, 0 answered