Beispiel #1
0
        protected void deleteFileFromPackage(object sender, EventArgs e)
        {
            TextBox filePathControl = (TextBox)((Control)sender).Parent.FindControl("packageFilePath");

            filePathControl.Text = "";

            string tmpFilePathString = "";

            foreach (RepeaterItem rItem in packageFilesRepeater.Items)
            {
                string tmpFFFF = ((TextBox)rItem.FindControl("packageFilePath")).Text;
                if (tmpFFFF.Trim() != "")
                {
                    tmpFilePathString += tmpFFFF + "�";
                }
            }

            CreatedPackage  createdPackage = CreatedPackage.GetById(int.Parse(Request.QueryString["id"]));
            PackageInstance pack           = createdPackage.Data;

            pack.Files = new List <string>(tmpFilePathString.Trim('�').Split('�'));
            pack.Files.TrimExcess();

            createdPackage.Save();

            packageFilesRepeater.DataSource = pack.Files;
            packageFilesRepeater.DataBind();
        }
Beispiel #2
0
        public async Task <HttpResponseMessage> Get()
        {
            var umbracoVersion   = UmbracoVersion.Current;
            var footprintVersion = InstalledPackage.GetAllInstalledPackages()
                                   .Select(x => x.Data)
                                   .Concat(CreatedPackage.GetAllCreatedPackages().Select(x => x.Data))
                                   .Where(x => x.Name == "Novicell Footprint")
                                   .Select(x => x.Version)
                                   .FirstOrDefault();

            if (footprintVersion == null)
            {
                LogHelper.Warn <DashboardController>("Footprint version is null.");
            }

            //Use this to return your own custom dashboard content
            //using (var http = new HttpClient())
            //{
            //    return await http.GetAsync($"http://novicell.io/Umbraco/Api/Documentation/Get?umbracoVersion={umbracoVersion}&packageVersion={footprintVersion}&cache={Random.Next()}");
            //}

            /*
             * Example structure:
             * {"umbracoVersion":"7.2.4","packageVersion":"1.4.2","content":"<div ng-controller=\"ncFootprint.Backoffice.OverviewDashboard.Controller\" class=\"ncbt-section-dashboard\">\r\n    <div class=\"span12\">\r\n        <h1>Novicell Footprint 1.4.2.1</h1>\r\n        <p>\r\n            Stay tuned on <a href=\"http://novicell.io/footprint\" target=\"_blank\" title=\"Novicell Footprint\">http://novicell.io/footprint</a> and Our for more information and documentation.\r\n        </p>\r\n\r\n        <p>\r\n        \t<b>The library provides the following methods:</b> <br /><br />\r\n        \t<code>\r\n        \tfootprint.currentVisitor.addToSegment(segmentAlias, onSuccess, onError); <br />\r\n\t\t\tfootprint.currentVisitor.isInSegment(segmentAlias, onSuccess, onError); <br />\r\n\t\t\tfootprint.currentVisitor.setId(visitorId, onSuccess, onError); <br />\r\n\t\t\tfootprint.currentVisitor.setProperties({ key1: value1, key2: value2 }, onSuccess, onError); <br />\r\n\t\t\t</code>\r\n        </p>\r\n        <br />\r\n        <p>\r\n        \t<b>Example</b><br /><br />\r\n        \t<code>\r\n        \tdocument.getElementById(\"newsletter-subscribe-form\").addEventListener(\"submit\", function (e) { <br/>\r\n\t\t\t    console.info(\"\\\"submit\\\" event listener hit.\", arguments);<br/>\r\n\t\t\t    <br/>\r\n\t\t\t    e.preventDefault();<br/>\r\n\t\t\t    <br/>\r\n\t\t\t    // TODO: Subscribe to newsletter via AJAX or somesuch.<br/>\r\n\t\t\t    <br/>\r\n\t\t\t    footprint.currentVisitor.addToSegment(\"newsletter\", function (response, xhr) {<br/>\r\n\t\t\t        console.info(\"\\\"addToSegment\\\" onSuccess.\", arguments);<br/>\r\n\t\t\t    }, function (xhr, statusText) {<br/>\r\n\t\t\t        console.info(\"\\\"addToSegment\\\" onError.\", arguments);<br/>\r\n\t\t\t    });<br/>\r\n\t\t\t});<br/>\r\n\t\t\t</code>\r\n        </p>\r\n\r\n<iframe width=\"420\" height=\"315\" src=\"https://www.youtube.com/embed/NXN0QQRWx5g?rel=0\" frameborder=\"0\" allowfullscreen></iframe>\r\n    </div>\r\n</div>"}
             *
             */
            return(null);
        }
        public override bool PerformSave()
        {
            Current.Logger.Info <CreatedPackageTasks>("Xml save started");
            int id = CreatedPackage.MakeNew(Alias).Data.Id;

            _returnUrl = string.Format("developer/packages/editPackage.aspx?id={0}", id);
            return(true);
        }
 public override bool PerformDelete()
 {
     // we need to grab the id from the alias as the new tree needs to prefix the NodeID with "package_"
     if (ParentID == 0)
     {
         ParentID = int.Parse(Alias.Substring("package_".Length));
     }
     CreatedPackage.GetById(ParentID).Delete();
     return(true);
 }
        public IHttpActionResult DeleteCreatedPackage(int packageId)
        {
            var package = CreatedPackage.GetById(packageId);

            if (package == null)
            {
                return(NotFound());
            }

            package.Delete();

            return(Ok());
        }
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            var baseUrl = Constants.Applications.Developer + "/packages/";

            var nodes = new TreeNodeCollection();

            var createdPackages = CreatedPackage.GetAllCreatedPackages();

            if (id == "created")
            {
                nodes.AddRange(
                    createdPackages
                    .OrderBy(entity => entity.Data.Name)
                    .Select(dt =>
                {
                    var node = CreateTreeNode(dt.Data.Id.ToString(), id, queryStrings, dt.Data.Name, "icon-inbox", false,
                                              string.Format("/{0}/framed/{1}",
                                                            queryStrings.GetValue <string>("application"),
                                                            Uri.EscapeDataString("developer/Packages/EditPackage.aspx?id=" + dt.Data.Id)));
                    return(node);
                }));
            }
            else
            {
                //must be root
                var node = CreateTreeNode(
                    "created",
                    id,
                    queryStrings,
                    Services.TextService.Localize("treeHeaders/createdPackages"),
                    "icon-folder",
                    createdPackages.Count > 0,
                    string.Empty);



                //TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now.
                node.AdditionalData["jsClickCallback"] = "javascript:void(0);";

                nodes.Add(node);
            }



            return(nodes);
        }
Beispiel #7
0
        protected void addFileToPackage(object sender, EventArgs e)
        {
            string newPath = packageFilePathNew.Text;

            if (newPath.Trim() != "")
            {
                CreatedPackage  createdPackage = CreatedPackage.GetById(int.Parse(Request.QueryString["id"]));
                PackageInstance pack           = createdPackage.Data;

                pack.Files.Add(newPath);

                createdPackage.Save();

                packageFilePathNew.Text = "";

                packageFilesRepeater.DataSource = pack.Files;
                packageFilesRepeater.DataBind();
            }
        }
        public async Task <HttpResponseMessage> Get()
        {
            var umbracoVersion   = UmbracoVersion.Current;
            var footprintVersion = InstalledPackage.GetAllInstalledPackages()
                                   .Select(x => x.Data)
                                   .Concat(CreatedPackage.GetAllCreatedPackages().Select(x => x.Data))
                                   .Where(x => x.Name == "Novicell Footprint")
                                   .Select(x => x.Version)
                                   .FirstOrDefault();

            if (footprintVersion == null)
            {
                LogHelper.Warn <DashboardController>("Footprint version is null.");
            }

            using (var http = new HttpClient())
            {
                return(await http.GetAsync($"http://novicell.io/Umbraco/Api/Documentation/Get?umbracoVersion={umbracoVersion}&packageVersion={footprintVersion}&cache={Random.Next()}"));
            }
        }
        public override void Render(ref XmlTree tree)
        {
            _packageType = HttpContext.Current.Request.QueryString["packageType"];

            switch (_packageType)
            {
            case "installed":
                Version v;
                // Display the unique packages, ordered by the latest version number. [LK 2013-06-10]
                var uniquePackages = InstalledPackage.GetAllInstalledPackages()
                                     .OrderByDescending(x => Version.TryParse(x.Data.Version, out v) ? v : new Version())
                                     .GroupBy(x => x.Data.Name)
                                     .Select(x => x.First())
                                     .OrderBy(x => x.Data.Name);
                foreach (var p in uniquePackages)
                {
                    var xNode = XmlTreeNode.Create(this);
                    xNode.NodeID   = string.Concat(PACKAGE_TREE_PREFIX, p.Data.Id);
                    xNode.Text     = p.Data.Name;
                    xNode.Action   = string.Format("javascript:openInstalledPackage('{0}');", p.Data.Id);
                    xNode.Icon     = "icon-box";
                    xNode.OpenIcon = "icon-box";
                    xNode.NodeType = "createdPackageInstance";
                    tree.Add(xNode);
                }
                break;

            case "created":
                foreach (CreatedPackage p in CreatedPackage.GetAllCreatedPackages())
                {
                    XmlTreeNode xNode = XmlTreeNode.Create(this);
                    xNode.NodeID   = PACKAGE_TREE_PREFIX + p.Data.Id.ToString();
                    xNode.Text     = p.Data.Name;
                    xNode.Action   = "javascript:openCreatedPackage('" + p.Data.Id.ToString() + "');";
                    xNode.Icon     = "icon-box";
                    xNode.OpenIcon = "icon-box";
                    xNode.NodeType = "createdPackageInstance";
                    xNode.Menu.Add(umbraco.BusinessLogic.Actions.ActionDelete.Instance);
                    tree.Add(xNode);
                }
                break;

            case "repositories":
                List <cms.businesslogic.packager.repositories.Repository> repos = cms.businesslogic.packager.repositories.Repository.getAll();

                foreach (cms.businesslogic.packager.repositories.Repository repo in repos)
                {
                    XmlTreeNode xNode = XmlTreeNode.Create(this);
                    xNode.Text     = repo.Name;
                    xNode.Action   = "javascript:openPackageCategory('BrowseRepository.aspx?repoGuid=" + repo.Guid + "');";
                    xNode.Icon     = "icon-server-alt";
                    xNode.OpenIcon = "icon-server-alt";
                    xNode.NodeType = "packagesRepo" + repo.Guid;
                    xNode.Menu.Add(umbraco.BusinessLogic.Actions.ActionRefresh.Instance);
                    xNode.Source = "tree.aspx?app=" + this._app + "&id=" + this._id + "&treeType=packagerPackages&packageType=repository&repoGuid=" + repo.Guid + "&rnd=" + Guid.NewGuid();
                    tree.Add(xNode);
                }

                break;

            case "repository":

                _repoGuid = HttpContext.Current.Request.QueryString["repoGuid"];
                Umbraco.Web.org.umbraco.our.Repository r = new Umbraco.Web.org.umbraco.our.Repository();

                foreach (var cat in r.Categories(_repoGuid))
                {
                    XmlTreeNode xNode = XmlTreeNode.Create(this);
                    xNode.NodeID   = cat.Id.ToInvariantString();
                    xNode.Text     = cat.Text;
                    xNode.Action   = "javascript:openPackageCategory('BrowseRepository.aspx?category=" + cat.Id + "&repoGuid=" + _repoGuid + "');";
                    xNode.Icon     = "icon-folder";
                    xNode.OpenIcon = "icon-folder";
                    xNode.NodeType = "packagesCategory" + cat.Id;
                    tree.Add(xNode);
                }

                break;
            }
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] != null)
            {
                createdPackage = CreatedPackage.GetById(int.Parse(Request.QueryString["id"]));
                pack           = createdPackage.Data;

                /* CONTENT */

                cp = new ContentPicker();
                content.Controls.Add(cp);

                if (string.IsNullOrEmpty(pack.PackagePath) == false)
                {
                    packageUmbFile.Text = " &nbsp; <a href='" + Page.ResolveClientUrl(pack.PackagePath) + "'>Download</a>";
                }
                else
                {
                    packageUmbFile.Text = "<em>This package is not published</em>";
                }

                if (Page.IsPostBack == false)
                {
                    ClientTools
                    .SyncTree("-1,created," + createdPackage.Data.Id, false);

                    packageAuthorName.Text  = pack.Author;
                    packageAuthorUrl.Text   = pack.AuthorUrl;
                    packageLicenseName.Text = pack.License;
                    packageLicenseUrl.Text  = pack.LicenseUrl;
                    packageName.Text        = pack.Name;
                    packageReadme.Text      = pack.Readme;
                    packageVersion.Text     = pack.Version;
                    packageUrl.Text         = pack.Url;
                    iconUrl.Text            = pack.IconUrl;
                    umbracoVersion.Text     = pack.UmbracoVersion != null?pack.UmbracoVersion.ToString(3) : string.Empty;

                    /*ACTIONS XML*/
                    tb_actions.Text = pack.Actions;

                    cp.Value = pack.ContentNodeId.ToString();

                    //startNode.Value = pack.ContentNodeId.ToString();

                    packageContentSubdirs.Checked = pack.ContentLoadChildNodes;


                    /*TEMPLATES */
                    var nTemplates = Services.FileService.GetTemplates();
                    //Template[] umbTemplates = Template.GetAllAsList().ToArray();
                    foreach (var tmp in nTemplates)
                    {
                        ListItem li = new ListItem(tmp.Name, tmp.Id.ToString());

                        if (pack.Templates.Contains(tmp.Id.ToString()))
                        {
                            li.Selected = true;
                        }

                        templates.Items.Add(li);
                    }

                    /* DOC TYPES */
                    // fixme - media types? member types?
                    var nContentTypes = Services.ContentTypeService.GetAll();
                    //DocumentType[] docs = DocumentType.GetAllAsList().ToArray();
                    foreach (var dc in nContentTypes)
                    {
                        ListItem li = new ListItem(dc.Name, dc.Id.ToString());
                        if (pack.Documenttypes.Contains(dc.Id.ToString()))
                        {
                            li.Selected = true;
                        }

                        documentTypes.Items.Add(li);
                    }

                    /*Stylesheets */
                    var sheets = Services.FileService.GetStylesheets();
                    foreach (var st in sheets)
                    {
                        if (string.IsNullOrEmpty(st.Name) == false)
                        {
                            var li = new ListItem(st.Alias, st.Name);
                            if (pack.Stylesheets.Contains(st.Name))
                            {
                                li.Selected = true;
                            }
                            stylesheets.Items.Add(li);
                        }
                    }

                    /* MACROS */
                    var nMacros = Services.MacroService.GetAll();
                    //Macro[] umbMacros = Macro.GetAll();
                    foreach (var m in nMacros)
                    {
                        ListItem li = new ListItem(m.Name, m.Id.ToString());
                        if (pack.Macros.Contains(m.Id.ToString()))
                        {
                            li.Selected = true;
                        }

                        macros.Items.Add(li);
                    }

                    /*Langauges */
                    var nLanguages = Services.LocalizationService.GetAllLanguages();
                    //Language[] umbLanguages = Language.getAll;
                    foreach (var l in nLanguages)
                    {
                        ListItem li = new ListItem(l.CultureName, l.Id.ToString());
                        if (pack.Languages.Contains(l.Id.ToString()))
                        {
                            li.Selected = true;
                        }

                        languages.Items.Add(li);
                    }

                    /*Dictionary Items*/
                    var umbDictionary = Services.LocalizationService.GetRootDictionaryItems();
                    foreach (var d in umbDictionary)
                    {
                        string liName   = d.ItemKey;
                        var    children = Services.LocalizationService.GetDictionaryItemChildren(d.Key);
                        if (children.Any())
                        {
                            liName += " <small>(Including all child items)</small>";
                        }

                        var li = new ListItem(liName, d.Id.ToString());

                        if (pack.DictionaryItems.Contains(d.Id.ToString()))
                        {
                            li.Selected = true;
                        }

                        dictionary.Items.Add(li);
                    }

                    //TODO: Fix this with the new services and apis! and then remove since this should all be in angular

                    ///*Data types */
                    //cms.businesslogic.datatype.DataTypeDefinition[] umbDataType = cms.businesslogic.datatype.DataTypeDefinition.GetAll();

                    // sort array by name
                    //Array.Sort(umbDataType, delegate(cms.businesslogic.datatype.DataTypeDefinition umbDataType1, cms.businesslogic.datatype.DataTypeDefinition umbDataType2)
                    //{
                    //    return umbDataType1.Text.CompareTo(umbDataType2.Text);
                    //});

                    //foreach (cms.businesslogic.datatype.DataTypeDefinition umbDtd in umbDataType)
                    //{

                    //    ListItem li = new ListItem(umbDtd.Text, umbDtd.Id.ToString());

                    //    if (pack.DataTypes.Contains(umbDtd.Id.ToString()))
                    //        li.Selected = true;

                    //    cbl_datatypes.Items.Add(li);
                    //}

                    /* FILES */
                    packageFilesRepeater.DataSource = pack.Files;
                    packageFilesRepeater.DataBind();

                    packageControlPath.Text = pack.LoadControl;
                }
                else
                {
                    ClientTools
                    .SyncTree("-1,created," + createdPackage.Data.Id, true);
                }
            }
        }