Compare commits
351 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6cbc3367b1 | |||
| c961ffcef2 | |||
| f034fbccf9 | |||
| 65d9b3b99d | |||
| 77f0b4e093 | |||
| 59e291f961 | |||
| 50e4825066 | |||
| 4235963fce | |||
| 7d2bbb64b1 | |||
| 07ccdfb7af | |||
| 2022ca6d64 | |||
| 7372fa1705 | |||
| 9ec1d20d51 | |||
| 0e4bcc96e7 | |||
| 82c7bc45a7 | |||
| 10484a2240 | |||
| 8d41d106d0 | |||
| 8e18778bc2 | |||
| 8068641120 | |||
| 388f9e3a1e | |||
| 51b77669cb | |||
| f04335ef7d | |||
| aca0249c0f | |||
| d66e951b68 | |||
| 9c33f1b1c9 | |||
| 3520f2d1e4 | |||
| 2715d49630 | |||
| 78fe1015aa | |||
| d43d432d2f | |||
| 06ee6e3845 | |||
| 0eceb3c7fc | |||
| 5013c5f526 | |||
| d07bd58deb | |||
| d8ba0d352e | |||
| faf9800235 | |||
| e789cb8875 | |||
| f208fc65d0 | |||
| e7c1d3dd2e | |||
| 379ac8a3cb | |||
| 8202dbcc5b | |||
| 8172789537 | |||
| 08dd74322a | |||
| 8953021784 | |||
| da4e519e4b | |||
| 42a6872685 | |||
| a8cf6e8426 | |||
| fe2ff696c5 | |||
| 240c205765 | |||
| 03019e9676 | |||
| 697cc7a420 | |||
| 8961f930e3 | |||
| 2d3ef8d311 | |||
| 02afb1e774 | |||
| 6188629da6 | |||
| 2c04a02d62 | |||
| ccc8868f68 | |||
| cde7f0fa18 | |||
| 867ccaf2b1 | |||
| 3743fc1c29 | |||
| d10aec9e68 | |||
| fefe5660ef | |||
| 5d978a62fd | |||
| 49062d3ede | |||
| 7853245fe4 | |||
| fa88efbf5e | |||
| 6f6252b616 | |||
| 7947970817 | |||
| 76717eb720 | |||
| cd0c9a39f3 | |||
| 96ce2882a2 | |||
| 068ad19492 | |||
| 6fb4f8fc8b | |||
| e7fce9120e | |||
| 76c924fbaa | |||
| 93b470f15c | |||
| 1cef87ee34 | |||
| 8e7630cd9c | |||
| 8985d514ec | |||
| 3c82315782 | |||
| 58751577c6 | |||
| debe0d811c | |||
| 8d09243473 | |||
| 2b4cf7d185 | |||
| 9040b1a3cb | |||
| 9a8f71dd81 | |||
| d05819e125 | |||
| 9c65ed92f1 | |||
| 3f35eca999 | |||
| 4a86244924 | |||
| 324cd7e98f | |||
| 1a99d0e4d0 | |||
| da0fe5e5a3 | |||
| dbad0d261e | |||
| d30ec335b8 | |||
| e820d2a4aa | |||
| 5aa490cbff | |||
| f1a8da2876 | |||
| 27f6560a00 | |||
| 7a181bd281 | |||
| 4a0cd87a38 | |||
| 861e5908a7 | |||
| ae5a5bd2c0 | |||
| 395575dbe4 | |||
| 6d6be4e6a4 | |||
| fbc9c6aed6 | |||
| 386dc1a14d | |||
| 8fc33f6aea | |||
| 6c8e39876f | |||
| bfca8c555e | |||
| 9384cd0f27 | |||
| 0262b4aa76 | |||
| 96761efe4d | |||
| 75fb070825 | |||
| 8a0f32e980 | |||
| f5163ed0c2 | |||
| 694f3d71e2 | |||
| 15eb40aedb | |||
| 49251271e9 | |||
| cc3e75dc63 | |||
| eeaf17c857 | |||
| 21a8395142 | |||
| f25233ac2b | |||
| 61cd59b237 | |||
| 7d171b1e95 | |||
| d63061fade | |||
| 362261e879 | |||
| af8c00d075 | |||
| 68b440e494 | |||
| 0c328ef30e | |||
| ef47e85741 | |||
| 0c191a3ef7 | |||
| 9ac96f24aa | |||
| eca5b6e4e6 | |||
| 2dd7c5210f | |||
| 3a854688e0 | |||
| 1594adf3ed | |||
| 23fcb38d69 | |||
| 7571949ad0 | |||
| d45c3520d4 | |||
| b7c04575fa | |||
| 588f5a3789 | |||
| b535a45898 | |||
| 1b56c55300 | |||
| 29d9dcffb8 | |||
| b0f0a7afc4 | |||
| 30f8885aa9 | |||
| 94ed741dd5 | |||
| b6d5ac6a01 | |||
| 4664266b8d | |||
| c61fd65463 | |||
| 1e2598a3a3 | |||
| 5003a55aca | |||
| b5415844b8 | |||
| 19241995e8 | |||
| 828dbaedfb | |||
| 52701f0056 | |||
| c802171f38 | |||
| 81c5c66e15 | |||
| 79515cdae7 | |||
| 99ce7c0736 | |||
| d9b1598fa2 | |||
| c630e5ef8e | |||
| fe5896c85f | |||
| 28cbb0a517 | |||
| 0597b43014 | |||
| a124d77670 | |||
| 1076b882fb | |||
| 4a47c5e129 | |||
| 6d052aeeac | |||
| 5380b62504 | |||
| 354505fde3 | |||
| 9b33c8a0e2 | |||
| 07fc6753f5 | |||
| 967178cb92 | |||
| fe44494936 | |||
| 793c9470c2 | |||
| 95d40049f5 | |||
| f003c3602c | |||
| 862fdf27e4 | |||
| 8499c01eac | |||
| e25d648f44 | |||
| 7225ec29fe | |||
| cf1069e0e1 | |||
| 99ce88228c | |||
| edb62b740b | |||
| 43e32e66b6 | |||
| 11d4189c8d | |||
| 859cb6ce1a | |||
| ebbd05dc97 | |||
| bdaa70592f | |||
| 27b19a0a33 | |||
| 047a05cfb3 | |||
| e77ebc0c1c | |||
| a27ea994b7 | |||
| e019c94207 | |||
| 5b7193aa64 | |||
| f6263aad5b | |||
| 28a0e30315 | |||
| d1eb6b1aa8 | |||
| 458d023ff4 | |||
| cf871196f2 | |||
| 36d6b6a254 | |||
| 89c376f77a | |||
| 29bb86ea13 | |||
| fa171e4553 | |||
| 7c264b4da0 | |||
| 716020602d | |||
| 8c0ec489c2 | |||
| 81d380a47e | |||
| 19e5715a84 | |||
| 2e2dce170a | |||
| 59f9a64e81 | |||
| 98b7467306 | |||
| 4bb75d73dd | |||
| dd8e43d80a | |||
| c9c9e8352a | |||
| c4e5ab54d2 | |||
| 53bfec8a04 | |||
| b4a0dadee9 | |||
| 014ac98d0b | |||
| 35a79a8598 | |||
| 3c4f052a27 | |||
| 97d7e3db84 | |||
| 0d2df4de81 | |||
| b361cfebb7 | |||
| ebea5e8170 | |||
| 995f3f38a3 | |||
| 2ad79956d9 | |||
| 96c6a17d03 | |||
| e2e0dd0c73 | |||
| 1a590664e7 | |||
| 64fd6ee7c5 | |||
| 2ed5b6c1ee | |||
| 41c4e024de | |||
| b46add81f0 | |||
| ff31cd9f72 | |||
| 084af43dab | |||
| edf7038848 | |||
| bcac02861d | |||
| 79ecaecc9e | |||
| f604117c6d | |||
| dcf7f35078 | |||
| 0b63eb9430 | |||
| d7ddbfec35 | |||
| d260a9dc88 | |||
| 2aa0dfb2c5 | |||
| e4b77416a6 | |||
| 3aed889e2a | |||
| 2c6e7e46c2 | |||
| 0a71a09d21 | |||
| 0c868fb72d | |||
| a96cbce9b1 | |||
| e3e425695f | |||
| b539c6ec27 | |||
| 69f7623fb7 | |||
| 82820284f3 | |||
| 5f3090c81e | |||
| f66e239584 | |||
| a465ed415d | |||
| 5161fd0cef | |||
| eac9785c45 | |||
| 054a8b48fa | |||
| af0a03a3e0 | |||
| fb5e6c22ce | |||
| 6bc68005f4 | |||
| dfbc3c477a | |||
| 05c38db54c | |||
| 00fdace570 | |||
| 4e531976e9 | |||
| 0feb1b6cc0 | |||
| 830f460b7e | |||
| 3e2fa64820 | |||
| 7db4f841e3 | |||
| 509d27f93b | |||
| f42b122e73 | |||
| b4aad19573 | |||
| 1b6c070752 | |||
| bedce100d2 | |||
| 0e08a56ada | |||
| 03012cf54d | |||
| 7ff339e18a | |||
| 0048b9c4c8 | |||
| 47f5e6bf17 | |||
| a8908c90bc | |||
| 9e5e8b539a | |||
| 45d292e196 | |||
| 4161d244c1 | |||
| 171e0d87db | |||
| eea87e411f | |||
| 89edfe5782 | |||
| cbd5071eed | |||
| 3dbc2944aa | |||
| 709dab6afd | |||
| 8749b030cf | |||
| 62fd15d54b | |||
| 66e71db85c | |||
| 469527da0a | |||
| 304e574bbc | |||
| 723644ace5 | |||
| 2b936a6d31 | |||
| 3121635e07 | |||
| f2a3a269ba | |||
| 557fc1bcdd | |||
| 1a5fe63638 | |||
| dfb0efbc98 | |||
| d399ad6e51 | |||
| eb06e62937 | |||
| 728bf8b52d | |||
| ca74100e12 | |||
| cd63806895 | |||
| 3061dc4e6f | |||
| 5166dc08d6 | |||
| 05a9c44e9e | |||
| 8e0565e030 | |||
| ceb3ae361a | |||
| 4cee7b831a | |||
| 20216df8cf | |||
| 4a8730b925 | |||
| d94e7cd906 | |||
| dde8ba5617 | |||
| d06b7edd84 | |||
| 466de5ee0b | |||
| 976e1e8a35 | |||
| 23638702c8 | |||
| a633e45b44 | |||
| 63b58dcd09 | |||
| 52684b6189 | |||
| 76a0c6c39f | |||
| 13c675d718 | |||
| 0ee3ebd180 | |||
| 9c8c9d8a39 | |||
| 37d2203de1 | |||
| 732d3ef326 | |||
| 858156bab2 | |||
| 2ae96f3810 | |||
| 7019c9433b | |||
| a5f689385a | |||
| 1607e51270 | |||
| 044b43f6e1 | |||
| b2004057a5 | |||
| c59a226d56 | |||
| 0c25c36af0 | |||
| 6861453166 | |||
| 5f263ad851 | |||
| afc2363163 | |||
| ae110c1cae | |||
| 3f1f67e323 | |||
| f1d37a5072 | |||
| 2dc6e395a8 | |||
| eedeb90673 | |||
| 977c390a95 |
@@ -113,6 +113,7 @@ build/ApiDocs/*
|
||||
build/ApiDocs/Output/*
|
||||
src/Umbraco.Web.UI.Client/bower_components/*
|
||||
/src/Umbraco.Web.UI/Umbraco/preview
|
||||
/src/Umbraco.Web.UI/Umbraco/preview.old
|
||||
|
||||
#Ignore Rule for output of generated documentation files from Grunt docserve
|
||||
src/Umbraco.Web.UI.Client/docs/api
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
# Code of Conduct
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
A primary goal of Umbraco CMS is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof).
|
||||
|
||||
This code of conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior.
|
||||
|
||||
We invite all those who participate in Umbraco CMS to help us create safe and positive experiences for everyone.
|
||||
|
||||
## 2. Open Source Citizenship
|
||||
|
||||
A supplemental goal of this Code of Conduct is to increase open source citizenship by encouraging participants to recognize and strengthen the relationships between our actions and their effects on our community.
|
||||
|
||||
Communities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist in society.
|
||||
|
||||
If you see someone who is making an extra effort to ensure our community is welcoming, friendly, and encourages all participants to contribute to the fullest extent, we want to know.
|
||||
|
||||
## 3. Expected Behavior
|
||||
|
||||
The following behaviors are expected and requested of all community members:
|
||||
|
||||
* Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community.
|
||||
* Exercise consideration and respect in your speech and actions.
|
||||
* Attempt collaboration before conflict.
|
||||
* Refrain from demeaning, discriminatory, or harassing behavior and speech.
|
||||
* Be mindful of your surroundings and of your fellow participants. Alert community leaders if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential.
|
||||
* Remember that community event venues may be shared with members of the public; please be respectful to all patrons of these locations.
|
||||
|
||||
## 4. Unacceptable Behavior
|
||||
|
||||
The following behaviors are considered harassment and are unacceptable within our community:
|
||||
|
||||
* Violence, threats of violence or violent language directed against another person.
|
||||
* Sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory jokes and language.
|
||||
* Posting or displaying sexually explicit or violent material.
|
||||
* Posting or threatening to post other people’s personally identifying information ("doxing").
|
||||
* Personal insults, particularly those related to gender, sexual orientation, race, religion, or disability.
|
||||
* Inappropriate photography or recording.
|
||||
* Inappropriate physical contact. You should have someone’s consent before touching them.
|
||||
* Unwelcome sexual attention. This includes, sexualized comments or jokes; inappropriate touching, groping, and unwelcomed sexual advances.
|
||||
* Deliberate intimidation, stalking or following (online or in person).
|
||||
* Advocating for, or encouraging, any of the above behavior.
|
||||
* Sustained disruption of community events, including talks and presentations.
|
||||
|
||||
## 5. Consequences of Unacceptable Behavior
|
||||
|
||||
Unacceptable behavior from any community member, including sponsors and those with decision-making authority, will not be tolerated.
|
||||
|
||||
Anyone asked to stop unacceptable behavior is expected to comply immediately.
|
||||
|
||||
If a community member engages in unacceptable behavior, the community organizers may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning (and without refund in the case of a paid event).
|
||||
|
||||
## 6. Reporting Guidelines
|
||||
|
||||
If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. Please contact Sebastiaan Janssen - [sj@umbraco.dk](mailto:sj@umbraco.dk).
|
||||
|
||||
Additionally, community organizers are available to help community members engage with local law enforcement or to otherwise help those experiencing unacceptable behavior feel safe. In the context of in-person events, organizers will also provide escorts as desired by the person experiencing distress.
|
||||
|
||||
## 7. Addressing Grievances
|
||||
|
||||
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify Umbraco with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.
|
||||
|
||||
## 8. Scope
|
||||
|
||||
We expect all community participants (contributors, paid or otherwise; sponsors; and other guests) to abide by this Code of Conduct in all community venues–online and in-person–as well as in all one-on-one communications pertaining to community business.
|
||||
|
||||
This code of conduct and its related procedures also applies to unacceptable behavior occurring outside the scope of community activities when such behavior has the potential to adversely affect the safety and well-being of community members.
|
||||
|
||||
## 9. Contact info
|
||||
|
||||
Sebastiaan Janssen - [sj@umbraco.dk](mailto:sj@umbraco.dk)
|
||||
|
||||
## 10. License and attribution
|
||||
|
||||
This Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/).
|
||||
|
||||
Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy).
|
||||
|
||||
Retrieved on November 22, 2016 from [http://citizencodeofconduct.org/](http://citizencodeofconduct.org/)
|
||||
@@ -376,7 +376,7 @@ function Prepare-Packages
|
||||
Copy-Files "$src\Umbraco.Web.UI\umbraco\js" "*" "$tmp\WebApp\umbraco\js"
|
||||
Copy-Files "$src\Umbraco.Web.UI\umbraco\lib" "*" "$tmp\WebApp\umbraco\lib"
|
||||
Copy-Files "$src\Umbraco.Web.UI\umbraco\views" "*" "$tmp\WebApp\umbraco\views"
|
||||
Copy-Files "$src\Umbraco.Web.UI\umbraco\preview" "*" "$tmp\WebApp\umbraco\preview"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<!-- Markdown can not be updated due to: https://github.com/hey-red/markdownsharp/issues/71#issuecomment-233585487 -->
|
||||
<dependency id="Markdown" version="[1.14.7, 2.0.0)" />
|
||||
<dependency id="System.Threading.Tasks.Dataflow" version="[4.7.0, 5.0.0)" />
|
||||
<dependency id="System.ValueTuple" version="[4.4.0, 5.0.0)" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
*** IMPORTANT NOTICE FOR 7.7 UPGRADES ***
|
||||
*** IMPORTANT NOTICE FOR UPGRADES FROM VERSIONS BELOW 7.7.0 ***
|
||||
|
||||
Be sure to read the version specific upgrade information before proceeding:
|
||||
https://our.umbraco.org/documentation/Getting-Started/Setup/Upgrading/version-specific#version-7-7-0
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<add application="settings" alias="scripts" title="Scripts" type="Umbraco.Web.Trees.ScriptTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="4"
|
||||
xdt:Locator="Match(application,alias)"
|
||||
xdt:Transform="SetAttributes()" />
|
||||
<add application="settings" alias="dictionary" title="Dictionary" type="umbraco.loadDictionary, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="6"
|
||||
<add application="settings" alias="dictionary" title="Dictionary" type="Umbraco.Web.Trees.SettingsDictionaryTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="6"
|
||||
xdt:Locator="Match(application,alias)"
|
||||
xdt:Transform="SetAttributes()" />
|
||||
<add alias="dictionary" application="settings"
|
||||
|
||||
@@ -5,4 +5,6 @@
|
||||
</content>
|
||||
|
||||
<webservices xdt:Transform="Remove" />
|
||||
|
||||
<repositories xdt:Transform="Remove" />
|
||||
</settings>
|
||||
@@ -0,0 +1,32 @@
|
||||
# Code Of Conduct
|
||||
|
||||
Our informal code of conduct concentrates on the values we, as Umbraco HQ, have set for ourselves and for our community. We expect you to be a friend.
|
||||
Instead of listing out all the exact "do's" and "don't's" we want to challenge you to think about our values and apply them:
|
||||
|
||||
If there's a need to talk to Umbraco HQ about anything, please make sure to send a mail to [Sebastiaan Janssen - sj@umbraco.dk](mailto:sj@umbraco.dk).
|
||||
|
||||
## Be a Friend
|
||||
|
||||
We welcome and thank you for registering at Our Umbraco. Find below the values that govern Umbraco and which you accept by using Our Umbraco.
|
||||
|
||||
## Trust
|
||||
|
||||
Assume positive intent and try to understand before being understood.
|
||||
|
||||
## Respect
|
||||
|
||||
Treat others as you would like to be treated.
|
||||
|
||||
This also goes for treating the HQ with respect. For example: don’t promote products on [our.umbraco.org](https://our.umbraco.org) that directly compete with our commercial offerings which enables us to work for a sustainable Umbraco.
|
||||
|
||||
## Open
|
||||
|
||||
Be honest and straightforward. Tell it as it is. Share thoughts and knowledge and engage in collaboration.
|
||||
|
||||
## Hungry
|
||||
|
||||
Don't rest on your laurels and never accept the status quo. Contribute and give back to fellow Umbracians.
|
||||
|
||||
## Friendly
|
||||
|
||||
Don’t judge upon mistakes made but rather upon the speed and quality with which mistakes are corrected. Friendly posts and contributions generate smiles and builds long lasting relationships.
|
||||
@@ -0,0 +1,99 @@
|
||||
_Looking for Umbraco version 8? [Click here](https://github.com/umbraco/Umbraco-CMS/blob/temp8/CONTRIBUTING.md) to go to the v8 branch_
|
||||
# Contributing to Umbraco CMS
|
||||
|
||||
👍🎉 First off, thanks for taking the time to contribute! 🎉👍
|
||||
|
||||
The following is a set of guidelines for contributing to Umbraco CMS.
|
||||
|
||||
These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
|
||||
|
||||
Remember, we're a friendly bunch and are happy with whatever contribution you might provide. Below are guidelines for success that we've gathered over the years. If you choose to ignore them then we still love you 💖.
|
||||
|
||||
## Contributing code changes
|
||||
|
||||
This document gives you a quick overview on how to get started, we will link to in-depth documentation throughout if you need some more background info.
|
||||
|
||||
|
||||
## Guidelines for contributions we welcome
|
||||
|
||||
Not all changes are wanted so on occassion we might close a PR without merging it. We will give you feedback why we can't accept your changes and we'll be nice about it, thanking you for spending your valueable time.
|
||||
|
||||
We have [documented what we consider small and large changes](CONTRIBUTION_GUIDELINES.md), make sure to talk to us before making large changes.
|
||||
|
||||
Remember, if an issue is in the `Up for grabs` list or you've asked for some feedback before you sent us a PR, your PR will not be closed as unwanted.
|
||||
|
||||
## How do I begin?
|
||||
|
||||
Great question! The short version goes like this:
|
||||
|
||||
* **Fork** - create a fork of [`Umbraco-CMS` on GitHub](https://github.com/umbraco/Umbraco-CMS)
|
||||
|
||||

|
||||
|
||||
* **Clone** - when GitHub has created your fork, you can clone it in your favorite Git tool
|
||||
|
||||

|
||||
|
||||
* **Build** - build your fork of Umbraco locally as described in [building Umbraco from source code](BUILD.md)
|
||||
* **Change** - make your changes, experiment, have fun, explore and learn, and don't be afraid. We welcome all contributions and will [happily give feedback](#questions)
|
||||
* **Commit** - done? Yay! 🎉 It is recommended to create a new branch now and name it after the issue you're fixing, we usually follow the format: `temp-U4-12345`. This means it's a temporary branch for the particular issue you're working on, in this case `U4-12345`
|
||||
* **Push** - great, now you can push the changes up to your fork on GitHub
|
||||
* **Create pull request** - exciting! You're ready to show us your changes (or not quite ready, you just need some feedback to progress). GitHub has picked up on the new branch you've pushed and will offer to create a Pull Request. Click that green button and away you go.
|
||||
|
||||

|
||||
|
||||
### Further reading
|
||||
|
||||
At this point you might want to [read on about contributing in depth](CONTRIBUTING_DETAILED.md).
|
||||
|
||||
### Reviews
|
||||
|
||||
You've sent us your first contribution, congratulations! Now what?
|
||||
|
||||
The [pull request team](#the-pr-team) can now start reviewing your proposed changes and give you feedback on them. If it's not perfect, we'll either fix up what we need or we can request you to make some additional changes.
|
||||
|
||||
We have [a process in place which you can read all about](REVIEW_PROCESS.md). The very abbreviated version is:
|
||||
|
||||
- Your PR will get a reply within 48 hours
|
||||
- An in-depth reply will be added within at most 2 weeks
|
||||
- The PR will be either merged or rejected within at most 4 weeks
|
||||
- Sometimes it is difficult to meet these timelines and we'll talk to you
|
||||
|
||||
## Styleguides
|
||||
|
||||
To be honest, we don't like rules very much. We trust you have the best of intentions and we encourage you to create working code. If it doesn't look perfect then we'll happily help clean it up.
|
||||
|
||||
That said, the Umbraco development team likes to follow the hints that ReSharper gives us (no problem if you don't have this installed) and we've added a `.editorconfig` file so that Visual Studio knows what to do with whitespace, line endings, etc.
|
||||
|
||||
## The PR team
|
||||
|
||||
The pull request team consists of a member of Umbraco HQ, [Sebastiaan](https://github.com/nul800sebastiaan), who gets assistance from the following community members
|
||||
|
||||
- [Anders Bjerner](https://github.com/abjerner)
|
||||
- [Dave Woestenborghs](https://github.com/dawoe)
|
||||
- [Emma Burstow](https://github.com/emmaburstow)
|
||||
- [Kyle Weems](https://github.com/cssquirrel)
|
||||
- [Poornima Nayar](https://github.com/poornimanayar)
|
||||
|
||||
These wonderful volunteers will provide you with a first reply to your PR, review and test out your changes and might ask more questions. After that they'll let Umbraco HQ know if everything seems okay.
|
||||
|
||||
## Questions?
|
||||
|
||||
You can get in touch with [the PR team](#the-pr-team) in multiple ways, we love open conversations and we are a friendly bunch. No question you have is stupid. Any questions you have usually helps out multiple people with the same question. Ask away:
|
||||
|
||||
- If there's an existing issue on the issue tracker then that's a good place to leave questions and discuss how to start or move forward
|
||||
- Unsure where to start? Did something not work as expected? Try leaving a note in the ["Contributing to Umbraco"](https://our.umbraco.org/forum/contributing-to-umbraco-cms/) forum, the team monitors that one closely
|
||||
- We're also [active in the Gitter chatroom](https://gitter.im/umbraco/Umbraco-CMS)
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
This project and everyone participating in it is governed by the [our Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [Sebastiaan Janssen - sj@umbraco.dk](mailto:sj@umbraco.dk).
|
||||
|
||||
|
||||
## Contributing to Umbraco, in depth
|
||||
|
||||
There are other ways to contribute, and there's a few more things that you might be wondering about. We will answer the [most common questions and ways to contribute in our detailed documentation](CONTRIBUTING_DETAILED.md).
|
||||
|
||||
## Credits
|
||||
|
||||
This contribution guide borrows heavily from the excellent work on [the Atom contribution guide](https://github.com/atom/atom/blob/master/CONTRIBUTING.md). A big [#h5yr](http://h5yr.com/) to them!
|
||||
@@ -1,17 +1,11 @@
|
||||
# Contributing to Umbraco CMS
|
||||
# Contributing in detail
|
||||
|
||||
👍🎉 First off, thanks for taking the time to contribute! 🎉👍
|
||||
There's more than one way to contribute to Umbraco, there's some more suggestions below.
|
||||
|
||||
The following is a set of guidelines for contributing to Umbraco CMS.
|
||||
|
||||
These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
|
||||
|
||||
Remember, we're a friendly bunch and are happy with whatever contribution you might provide. Below are guidelines for success that we've gathered over the years. If you choose to ignore them then we still love you 💖.
|
||||
When contributing code to Umbraco there's plenty of things you'll want to know, skip down to [What should I know before I get started](#what-should-i-know-before-i-get-started) for the answers to your burning questions.
|
||||
|
||||
#### Table Of Contents
|
||||
|
||||
[Code of Conduct](#code-of-conduct)
|
||||
|
||||
[How Can I Contribute?](#how-can-i-contribute)
|
||||
* [Reporting Bugs](#reporting-bugs)
|
||||
* [Suggesting Enhancements](#suggesting-enhancements)
|
||||
@@ -24,23 +18,14 @@ Remember, we're a friendly bunch and are happy with whatever contribution you mi
|
||||
* [Working with the source code](#working-with-the-source-code)
|
||||
* [What branch should I target for my contributions?](#what-branch-should-i-target-for-my-contributions)
|
||||
* [Building Umbraco from source code](#building-umbraco-from-source-code)
|
||||
* [Keeping your Umbraco fork in sync with the main repository](#keeping-your-umbraco-fork-in-sync-with-the-main-repository)
|
||||
|
||||
[How do I even begin?](#how-do-i-even-begin)
|
||||
|
||||
[Problems?](#problems)
|
||||
|
||||
[Credits](#credits)
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
This project and everyone participating in it is governed by the [our Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [Sebastiaan Janssen - sj@umbraco.dk](mailto:sj@umbraco.dk).
|
||||
|
||||
## How Can I Contribute?
|
||||
|
||||
### Reporting Bugs
|
||||
This section guides you through submitting a bug report for Umbraco CMS. Following these guidelines helps maintainers and the community understand your report 📝, reproduce the behavior 💻 💻, and find related reports 🔎.
|
||||
|
||||
Before creating bug reports, please check [this list](#before-submitting-a-bug-report) as you might find out that you don't need to create one. When you are creating a bug report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](ISSUE_TEMPLATE.md), the information it asks for helps us resolve issues faster.
|
||||
Before creating bug reports, please check [this list](#before-submitting-a-bug-report) as you might find out that you don't need to create one. When you are creating a bug report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](http://issues.umbraco.org/issues#newissue=61-30118), the information it asks for helps us resolve issues faster.
|
||||
|
||||
> **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.
|
||||
|
||||
@@ -51,7 +36,7 @@ Before creating bug reports, please check [this list](#before-submitting-a-bug-r
|
||||
* **Use the Google**. Whatever you're experiencing, Google it plus "Umbraco" - usually you can get some pretty good hints from the search results, including open issues and further troubleshooting hints.
|
||||
* If you do find and existing issue has **and the issue is still open**, add a comment to the existing issue if you have additional information. If you have the same problem and no new info to add, just "star" the issue.
|
||||
|
||||
Explain the problem and include additional details to help maintainers reproduce the problem. The following is a long description which we've boiled down into a few very simple question in the issue tracker when you create a new issue. We're listing the following hints to indicate that the most successful reports usually have a lot of this ground covered:
|
||||
Explain the problem and include additional details to help maintainers reproduce the problem. The following is a long description which we've boiled down into a few very simple questions in the issue tracker when you create a new issue. We're listing the following hints to indicate that the most successful reports usually have a lot of this ground covered:
|
||||
|
||||
* **Use a clear and descriptive title** for the issue to identify the problem.
|
||||
* **Describe the exact steps which reproduce the problem** in as many details as possible. For example, start by explaining which steps you took in the backoffice to get to a certain undesireable result, e.g. you created a document type, inherting 3 levels deep, added a certain datatype, tried to save it and you got an error.
|
||||
@@ -73,7 +58,7 @@ Include details about your configuration and environment:
|
||||
|
||||
### Suggesting Enhancements
|
||||
|
||||
This section guides you through submitting an enhancement suggestion for Atom, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion 📝 and find related suggestions 🔎.
|
||||
This section guides you through submitting an enhancement suggestion for Umbraco, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion 📝 and find related suggestions 🔎.
|
||||
|
||||
Most of the suggestions in the [reporting bugs](#reporting-bugs) section also count for suggesting enhancements.
|
||||
|
||||
@@ -99,6 +84,10 @@ The most successful pull requests usually look a like this:
|
||||
|
||||
Again, these are guidelines, not strict requirements.
|
||||
|
||||
## Making changes after the PR was opened
|
||||
|
||||
If you make the corrections we ask for in the same branch and push them to your fork again, the pull request automatically updates with the additional commit(s) so we can review it again. If all is well, we'll merge the code and your commits are forever part of Umbraco!
|
||||
|
||||
## Styleguides
|
||||
|
||||
To be honest, we don't like rules very much. We trust you have the best of intentions and we encourage you to create working code. If it doesn't look perfect then we'll happily help clean it up.
|
||||
@@ -134,7 +123,7 @@ To find the general areas of something you're looking to fix or improve, have a
|
||||
|
||||
We like to use [Gitflow as much as possible](https://jeffkreeftmeijer.com/git-flow/), don't worry if you are not familiar with it. The most important thing you need to know is that when you fork the Umbraco repository, the default branch is set to something, usually `dev-v7`. Whatever the default is, that's where we'd like you to target your contributions.
|
||||
|
||||

|
||||

|
||||
|
||||
### Building Umbraco from source code
|
||||
|
||||
@@ -142,42 +131,29 @@ The easiest way to get started is to run `build.bat` which will build both the b
|
||||
|
||||
Alternatively, you can open `src\umbraco.sln` in Visual Studio 2017 ([the community edition is free](https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15) for you to use to contribute to Open Source projects). In Visual Studio, find the Task Runner Explorer (in the View menu under Other Windows) and run the build task under the gulpfile.
|
||||
|
||||

|
||||

|
||||
|
||||
After this build completes, you should be able to hit `F5` in Visual Studio to build and run the project. A IISExpress webserver will start and the Umbraco installer will pop up in your browser, follow the directions there to get a working Umbraco install up and running.
|
||||
|
||||
## How do I even begin?
|
||||
### Keeping your Umbraco fork in sync with the main repository
|
||||
|
||||
Great question! The short version goes like this:
|
||||
We recommend you sync with our repository before you submit your pull request. That way, you can fix any potential merge conflicts and make our lives a little bit easier.
|
||||
|
||||
* **Fork** - create a fork of [`Umbraco-CMS` on GitHub](https://github.com/umbraco/Umbraco-CMS)
|
||||
Also, if you've submitted a pull request three weeks ago and want to work on something new, you'll want to get the latest code to build against of course.
|
||||
|
||||

|
||||
To sync your fork with this original one, you'll have to add the upstream url, you only have to do this once:
|
||||
|
||||
* **Clone** - when GitHub has created your fork, you can clone it in your favorite Git tool
|
||||
|
||||

|
||||
```
|
||||
git remote add upstream https://github.com/umbraco/Umbraco-CMS.git
|
||||
```
|
||||
|
||||
* **Build** - build your fork of Umbraco locally as described in [building Umbraco from source code](#building-umbraco-from-source-code)
|
||||
* **Change** - make your changes, experiment, have fun, explore and learn, and don't be afraid. We welcome all contributions and will happily give feedback
|
||||
* **Commit** - done? Yay! 🎉 It is recommended to create a new branch now and name it after the issue you're fixing, we usually follow the format: `temp-U4-12345`. This means it's a temporary branch for the particular issue you're working on, in this case `U4-12345`
|
||||
* **Push** - great, now you can push the changes up to your fork on GitHub
|
||||
* **Create pull request** - exciting! You're ready to show us your changes (or not quite ready, you just need some feedback to progress). GitHub has picked up on the new branch you've pushed and will offer to create a Pull Request. Click that green button and away you go.
|
||||
Then when you want to get the changes from the main repository:
|
||||
|
||||

|
||||
```
|
||||
git fetch upstream
|
||||
git rebase upstream/dev-v7
|
||||
```
|
||||
|
||||
The Umbraco development team can now start reviewing your proposed changes and give you feedback on them. If it's not perfect, we'll either fix up what we need or we can request you to make some additional changes.
|
||||
In this command we're syncing with the `dev-v7` branch, but you can of course choose another one if needed.
|
||||
|
||||
If you make the corrections we ask for in the same branch and push them to your fork again, the pull request automatically updates with the additional commit(s) so we can review it again. If all is well, we'll merge the code and your commits are forever part of Umbraco!
|
||||
|
||||
Not all changes are wanted so on occassion we might close a PR without merging it. We will give you feedback why we can't accept your changes at this and we'll be nice about it, thanking you for spending your valueable time.
|
||||
|
||||
Remember, if an issue is in the `Up for grabs` list or you've asked for some feedback before you send us a PR, your PR will not be closed as unwanted.
|
||||
|
||||
## Problems?
|
||||
|
||||
Did something not work as expected? Try leaving a note in the ["Contributing to Umbraco"](https://our.umbraco.org/forum/contributing-to-umbraco-cms/) forum, the team monitors that one closely!
|
||||
|
||||
## Credits
|
||||
|
||||
This contribution guide borrows heavily from the excellent work on [the Atom contribution guide](https://github.com/atom/atom/blob/master/CONTRIBUTING.md). A big [#h5yr](http://h5yr.com/) to them!
|
||||
(More info on how this works: [http://robots.thoughtbot.com/post/5133345960/keeping-a-git-fork-updated](http://robots.thoughtbot.com/post/5133345960/keeping-a-git-fork-updated))
|
||||
@@ -0,0 +1,33 @@
|
||||
# Contributing to Umbraco CMS
|
||||
|
||||
When you’re considering creating a pull request for Umbraco CMS, we will categorize them in two different sizes, small and large.
|
||||
|
||||
The process for both sizes is very similar, as [explained in the contribution document](CONTRIBUTING.md#how-do-i-begin).
|
||||
|
||||
## Small PRs
|
||||
Bug fixes and small improvements - can be recognized by seeing a small number of changes and possibly a small number of new files.
|
||||
|
||||
We’re usually able to handle small PRs pretty quickly. A community volunteer will do the initial review and flag it for Umbraco HQ as “community tested”. If everything looks good, it will be merged pretty quickly [as per the described process](REVIEW_PROCESS.md).
|
||||
|
||||
### Up for grabs
|
||||
|
||||
Umbraco HQ will regularly mark newly created issues on the issue tracker with the `Up for grabs` tag. This means that the proposed changes are wanted in Umbraco but the HQ does not have the time to make them at this time. These issues are usually small enough to fit in the "Small PRs" category and we encourage anyone to pick them up and help out.
|
||||
|
||||
If you do start working on something, make sure leave a small comment on the issue saying something like: "I'm working on this". That way other people stumbling upon the issue know they don't need to pick it up, someone already has.
|
||||
|
||||
## Large PRs
|
||||
New features and large refactorings - can be recognized by seeing a large number of changes, plenty of new files, updates to package manager files (NuGet’s packages.config, NPM’s packages.json, etc.).
|
||||
|
||||
We would love to follow the same process for larger PRs but this is not always possible due to time limitations and priorities that need to be aligned. We don’t want to put up any barriers, but this document should set the correct expectations.
|
||||
|
||||
Please make sure to describe your idea in an issue, it helps to put in mockup screenshots or videos.
|
||||
|
||||
If the change makes sense for HQ to include in Umbraco CMS we will leave you some feedback on how we’d like to see it being implemented.
|
||||
|
||||
If a larger pull request is encouraged by Umbraco HQ, the process will be similar to what is described in the [small PRs process](#small-prs) above, we’ll get feedback to you within 14 days. Finalizing and merging the PR might take longer though as it will likely need to be picked up by the development team to make sure everything is in order. We’ll keep you posted on the progress.
|
||||
|
||||
### Pull request or package?
|
||||
|
||||
If it doesn’t fit in CMS right now, we will likely encourage you to make it into a package instead. A package is a great way to check out popularity of a feature, learn how people use it, validate good usability and to fix bugs.
|
||||
|
||||
Eventually, a package could "graduate" to be included in the CMS.
|
||||
@@ -1,47 +1,49 @@
|
||||
[](https://ci.appveyor.com/project/Umbraco/umbraco-cms-b2cri/branch/dev-v7)
|
||||
|
||||
Umbraco CMS
|
||||
===========
|
||||
The friendliest, most flexible and fastest growing ASP.NET CMS used by more than 443,000 websites worldwide: [https://umbraco.com](https://umbraco.com)
|
||||
|
||||
[](https://vimeo.com/172382998/)
|
||||
|
||||
## Umbraco CMS
|
||||
Umbraco is a free open source Content Management System built on the ASP.NET platform. Our mission is to help you deliver delightful digital experiences by making Umbraco friendly, simpler and social.
|
||||
|
||||
## Watch an introduction video
|
||||
|
||||
[](https://umbraco.tv/videos/umbraco-v7/content-editor/basics/introduction/cms-explanation/)
|
||||
|
||||
## Umbraco - The Friendly CMS
|
||||
|
||||
For the first time on the Microsoft platform, there is a free user and developer friendly CMS that makes it quick and easy to create websites - or a breeze to build complex web applications. Umbraco has award-winning integration capabilities and supports ASP.NET MVC or Web Forms, including User and Custom Controls, out of the box.
|
||||
|
||||
Umbraco is not only loved by developers, but is a content editors dream. Enjoy intuitive editing tools, media management, responsive views and approval workflows to send your content live.
|
||||
|
||||
Used by more than 443,000 active websites including Carlsberg, Segway, Amazon and Heinz and **The Official ASP.NET and IIS.NET website from Microsoft** ([https://asp.net](https://asp.net) / [https://iis.net](https://iis.net)), you can be sure that the technology is proven, stable and scales. Backed by the team at Umbraco HQ, and supported by a dedicated community of over 220,000 craftspeople globally, you can trust that Umbraco is a safe choice and is here to stay.
|
||||
|
||||
To view more examples, please visit [https://umbraco.com/why-umbraco/#caseStudies](https://umbraco.com/why-umbraco/#caseStudies)
|
||||
|
||||
## Why Open Source?
|
||||
As an Open Source platform, Umbraco is more than just a CMS. We are transparent with our roadmap for future versions, our incremental sprint planning notes are publicly accessible and community contributions and packages are available for all to use.
|
||||
|
||||
## Trying out Umbraco CMS
|
||||
|
||||
[Umbraco Cloud](https://umbraco.com) is the easiest and fastest way to use Umbraco yet with full support for all your custom .NET code and intergrations. You're up and running in less than a minute and your life will be made easier with automated upgrades and a built-in deployment engine. We offer a free 14 day trial, no credit card needed.
|
||||
|
||||
If you want to DIY you can [download Umbraco](https://our.umbraco.org/download) either as a ZIP file or via NuGet. It's the same version of Umbraco CMS that powers Umbraco Xloud, but you'll need to find a place to host yourself and handling deployments and upgrades is all down to you.
|
||||
|
||||
## Community
|
||||
|
||||
Our friendly community is available 24/7 at the community hub we call ["Our Umbraco"](https://our.umbraco.org). Our Umbraco feature forums for questions and answers, documentation, downloadable plugins for Umbraco and a rich collection of community resources.
|
||||
|
||||
## Contribute to Umbraco
|
||||
|
||||
Umbraco is contribution focused and community driven. If you want to contribute back to Umbraco please check out our [guide to contributing](CONTRIBUTING.md).
|
||||
|
||||
## Found a bug?
|
||||
|
||||
Another way you can contribute to Umbraco is by providing issue reports. For information on how to submit an issue report refer to our [online guide for reporting issues](https://our.umbraco.org/contribute/report-an-issue-or-request-a-feature).
|
||||
|
||||
To view existing issues, please visit [http://issues.umbraco.org](http://issues.umbraco.org).
|
||||
[](https://ci.appveyor.com/project/Umbraco/umbraco-cms-b2cri/branch/dev-v7)
|
||||
|
||||
_Looking for Umbraco version 8? [Click here](https://github.com/umbraco/Umbraco-CMS/tree/temp8) to go to the v8 branch_
|
||||
|
||||
Umbraco CMS
|
||||
===========
|
||||
The friendliest, most flexible and fastest growing ASP.NET CMS used by more than 443,000 websites worldwide: [https://umbraco.com](https://umbraco.com)
|
||||
|
||||
[](https://vimeo.com/172382998/)
|
||||
|
||||
## Umbraco CMS
|
||||
Umbraco is a free open source Content Management System built on the ASP.NET platform. Our mission is to help you deliver delightful digital experiences by making Umbraco friendly, simpler and social.
|
||||
|
||||
## Watch an introduction video
|
||||
|
||||
[](https://umbraco.tv/videos/umbraco-v7/content-editor/basics/introduction/cms-explanation/)
|
||||
|
||||
## Umbraco - The Friendly CMS
|
||||
|
||||
For the first time on the Microsoft platform, there is a free user and developer friendly CMS that makes it quick and easy to create websites - or a breeze to build complex web applications. Umbraco has award-winning integration capabilities and supports ASP.NET MVC or Web Forms, including User and Custom Controls, out of the box.
|
||||
|
||||
Umbraco is not only loved by developers, but is a content editors dream. Enjoy intuitive editing tools, media management, responsive views and approval workflows to send your content live.
|
||||
|
||||
Used by more than 443,000 active websites including Carlsberg, Segway, Amazon and Heinz and **The Official ASP.NET and IIS.NET website from Microsoft** ([https://asp.net](https://asp.net) / [https://iis.net](https://iis.net)), you can be sure that the technology is proven, stable and scales. Backed by the team at Umbraco HQ, and supported by a dedicated community of over 220,000 craftspeople globally, you can trust that Umbraco is a safe choice and is here to stay.
|
||||
|
||||
To view more examples, please visit [https://umbraco.com/why-umbraco/#caseStudies](https://umbraco.com/why-umbraco/#caseStudies)
|
||||
|
||||
## Why Open Source?
|
||||
As an Open Source platform, Umbraco is more than just a CMS. We are transparent with our roadmap for future versions, our incremental sprint planning notes are publicly accessible and community contributions and packages are available for all to use.
|
||||
|
||||
## Trying out Umbraco CMS
|
||||
|
||||
[Umbraco Cloud](https://umbraco.com) is the easiest and fastest way to use Umbraco yet with full support for all your custom .NET code and intergrations. You're up and running in less than a minute and your life will be made easier with automated upgrades and a built-in deployment engine. We offer a free 14 day trial, no credit card needed.
|
||||
|
||||
If you want to DIY you can [download Umbraco](https://our.umbraco.org/download) either as a ZIP file or via NuGet. It's the same version of Umbraco CMS that powers Umbraco Cloud, but you'll need to find a place to host yourself and handling deployments and upgrades is all down to you.
|
||||
|
||||
## Community
|
||||
|
||||
Our friendly community is available 24/7 at the community hub we call ["Our Umbraco"](https://our.umbraco.org). Our Umbraco feature forums for questions and answers, documentation, downloadable plugins for Umbraco and a rich collection of community resources.
|
||||
|
||||
## Contribute to Umbraco
|
||||
|
||||
Umbraco is contribution focused and community driven. If you want to contribute back to Umbraco please check out our [guide to contributing](CONTRIBUTING.md).
|
||||
|
||||
## Found a bug?
|
||||
|
||||
Another way you can contribute to Umbraco is by providing issue reports. For information on how to submit an issue report refer to our [online guide for reporting issues](https://our.umbraco.org/contribute/report-an-issue-or-request-a-feature).
|
||||
|
||||
To view existing issues, please visit [http://issues.umbraco.org](http://issues.umbraco.org).
|
||||
@@ -0,0 +1,25 @@
|
||||
# Review process
|
||||
|
||||
You're an awesome person and have sent us your contribution in the form of a pull request! It's now time to relax for a bit and wait for our response.
|
||||
|
||||
In order to set some expectations, here's what happens next.
|
||||
|
||||
## Review process
|
||||
|
||||
You will get an initial reply within 48 hours (workdays) to acknowledge that we’ve seen your PR and we’ll pick it up as soon as we can.
|
||||
|
||||
You will get feedback within at most 14 days after opening the PR. You’ll most likely get feedback sooner though. Then there are a few possible outcomes:
|
||||
|
||||
- Your proposed change is awesome! We merge it in and it will be included in the next minor release of Umbraco
|
||||
- If the change is a high priority bug fix, we will cherry-pick it into the next patch release as well so that we can release it as soon as possible
|
||||
- Your proposed change is awesome but needs a bit more work, we’ll give you feedback on the changes we’d like to see
|
||||
- Your proposed change is awesome but.. not something we’re looking to include at this point. We’ll close your PR and the related issue (we’ll be nice about it!)
|
||||
|
||||
## Are you still available?
|
||||
|
||||
We understand you have other things to do and can't just drop everything to help us out.
|
||||
So if we’re asking for your help to improve the PR we’ll wait for two weeks to give you a fair chance to make changes. We’ll ask for an update if we don’t hear back from you after that time.
|
||||
|
||||
If we don’t hear back from you for 4 weeks, we’ll close the PR so that it doesn’t just hang around forever. You’re very welcome to re-open it once you have some more time to spend on it.
|
||||
|
||||
There will be times that we really like your proposed changes and we’ll finish the final improvements we’d like to see ourselves. You still get the credits and your commits will live on in the git repository.
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
@@ -11,5 +11,5 @@ using System.Resources;
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
[assembly: AssemblyFileVersion("7.9.2")]
|
||||
[assembly: AssemblyInformationalVersion("7.9.2")]
|
||||
[assembly: AssemblyFileVersion("7.11.0")]
|
||||
[assembly: AssemblyInformationalVersion("7.11.0")]
|
||||
@@ -35,7 +35,7 @@ namespace Umbraco.Core.Configuration
|
||||
private static Version _version;
|
||||
private static readonly object Locker = new object();
|
||||
//make this volatile so that we can ensure thread safety with a double check lock
|
||||
private static volatile string _reservedUrlsCache;
|
||||
private static volatile string _reservedUrlsCache;
|
||||
private static string _reservedPathsCache;
|
||||
private static HashSet<string> _reservedList = new HashSet<string>();
|
||||
private static string _reservedPaths;
|
||||
@@ -190,7 +190,7 @@ namespace Umbraco.Core.Configuration
|
||||
/// This will return the MVC area that we will route all custom routes through like surface controllers, etc...
|
||||
/// We will use the 'Path' (default ~/umbraco) to create it but since it cannot contain '/' and people may specify a path of ~/asdf/asdf/admin
|
||||
/// we will convert the '/' to '-' and use that as the path. its a bit lame but will work.
|
||||
///
|
||||
///
|
||||
/// We also make sure that the virtual directory (SystemDirectories.Root) is stripped off first, otherwise we'd end up with something
|
||||
/// like "MyVirtualDirectory-Umbraco" instead of just "Umbraco".
|
||||
/// </remarks>
|
||||
@@ -205,7 +205,7 @@ namespace Umbraco.Core.Configuration
|
||||
var path = Path;
|
||||
if (path.StartsWith(SystemDirectories.Root)) // beware of TrimStart, see U4-2518
|
||||
path = path.Substring(SystemDirectories.Root.Length);
|
||||
return path.TrimStart('~').TrimStart('/').Replace('/', '-').Trim().ToLower();
|
||||
return path.TrimStart('~').TrimStart('/').Replace('/', '-').Trim().ToLower();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace Umbraco.Core.Configuration
|
||||
SetMembershipProvidersLegacyEncoding(UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Saves a setting into the configuration file.
|
||||
/// </summary>
|
||||
@@ -503,7 +503,7 @@ namespace Umbraco.Core.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a string value to determine if umbraco should skip version-checking.
|
||||
/// Returns the number of days that should take place between version checks.
|
||||
/// </summary>
|
||||
/// <value>The version check period in days (0 = never).</value>
|
||||
public static int VersionCheckPeriod
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
|
||||
public interface IRepositoriesSection : IUmbracoConfigurationSection
|
||||
{
|
||||
IEnumerable<IRepository> Repositories { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public interface IRepository
|
||||
{
|
||||
string Name { get; }
|
||||
Guid Id { get; }
|
||||
string RepositoryUrl { get; }
|
||||
string WebServiceUrl { get; }
|
||||
bool HasCustomWebServiceUrl { get; }
|
||||
string RestApiUrl { get; }
|
||||
}
|
||||
}
|
||||
@@ -24,9 +24,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
IScheduledTasksSection ScheduledTasks { get; }
|
||||
|
||||
IDistributedCallSection DistributedCall { get; }
|
||||
|
||||
IRepositoriesSection PackageRepositories { get; }
|
||||
|
||||
|
||||
IProvidersSection Providers { get; }
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
@@ -37,4 +35,4 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
|
||||
IScriptingSection Scripting { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class RepositoriesCollection : ConfigurationElementCollection, IEnumerable<IRepository>
|
||||
{
|
||||
internal void Add(RepositoryElement item)
|
||||
{
|
||||
BaseAdd(item);
|
||||
}
|
||||
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new RepositoryElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((RepositoryElement)element).Id;
|
||||
}
|
||||
|
||||
IEnumerator<IRepository> IEnumerable<IRepository>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as IRepository;
|
||||
}
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class RepositoriesElement : ConfigurationElement, IRepositoriesSection
|
||||
{
|
||||
|
||||
[ConfigurationCollection(typeof(RepositoriesCollection), AddItemName = "repository")]
|
||||
[ConfigurationProperty("", IsDefaultCollection = true)]
|
||||
internal RepositoriesCollection Repositories
|
||||
{
|
||||
get { return (RepositoriesCollection) base[""]; }
|
||||
set { base[""] = value; }
|
||||
}
|
||||
|
||||
IEnumerable<IRepository> IRepositoriesSection.Repositories
|
||||
{
|
||||
get { return Repositories; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public static class RepositoryConfigExtensions
|
||||
{
|
||||
//Our package repo
|
||||
private static readonly Guid RepoGuid = new Guid("65194810-1f85-11dd-bd0b-0800200c9a66");
|
||||
|
||||
public static IRepository GetDefault(this IRepositoriesSection repos)
|
||||
{
|
||||
var found = repos.Repositories.FirstOrDefault(x => x.Id == RepoGuid);
|
||||
if (found == null)
|
||||
throw new InvalidOperationException("No default package repository found with id " + RepoGuid);
|
||||
return found;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class RepositoryElement : ConfigurationElement, IRepository
|
||||
{
|
||||
[ConfigurationProperty("name", IsRequired = true)]
|
||||
public string Name
|
||||
{
|
||||
get { return (string)base["name"]; }
|
||||
set { base["name"] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("guid", IsRequired = true)]
|
||||
public Guid Id
|
||||
{
|
||||
get { return (Guid)base["guid"]; }
|
||||
set { base["guid"] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("repositoryurl", DefaultValue = "http://packages.umbraco.org")]
|
||||
public string RepositoryUrl
|
||||
{
|
||||
get { return (string)base["repositoryurl"]; }
|
||||
set { base["repositoryurl"] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("webserviceurl", DefaultValue = "/umbraco/webservices/api/repository.asmx")]
|
||||
public string WebServiceUrl
|
||||
{
|
||||
get { return (string)base["webserviceurl"]; }
|
||||
set { base["webserviceurl"] = value; }
|
||||
}
|
||||
|
||||
public bool HasCustomWebServiceUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
var prop = Properties["webserviceurl"];
|
||||
return (string) prop.DefaultValue != (string) this[prop];
|
||||
}
|
||||
}
|
||||
|
||||
[ConfigurationProperty("restapiurl", DefaultValue = "https://our.umbraco.org/webapi/packages/v1")]
|
||||
public string RestApiUrl
|
||||
{
|
||||
get { return (string)base["restapiurl"]; }
|
||||
set { base["restapiurl"] = value; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -67,50 +67,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
get { return (DistributedCallElement)this["distributedCall"]; }
|
||||
}
|
||||
|
||||
private RepositoriesElement _defaultRepositories;
|
||||
|
||||
[ConfigurationProperty("repositories")]
|
||||
internal RepositoriesElement PackageRepositories
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
if (_defaultRepositories != null)
|
||||
{
|
||||
return _defaultRepositories;
|
||||
}
|
||||
|
||||
//here we need to check if this element is defined, if it is not then we'll setup the defaults
|
||||
var prop = Properties["repositories"];
|
||||
var repos = this[prop] as ConfigurationElement;
|
||||
if (repos != null && repos.ElementInformation.IsPresent == false)
|
||||
{
|
||||
var collection = new RepositoriesCollection
|
||||
{
|
||||
new RepositoryElement() {Name = "Umbraco package Repository", Id = new Guid("65194810-1f85-11dd-bd0b-0800200c9a66")}
|
||||
};
|
||||
|
||||
|
||||
_defaultRepositories = new RepositoriesElement()
|
||||
{
|
||||
Repositories = collection
|
||||
};
|
||||
|
||||
return _defaultRepositories;
|
||||
}
|
||||
|
||||
//now we need to ensure there is *always* our umbraco repo! its hard coded in the codebase!
|
||||
var reposElement = (RepositoriesElement)base["repositories"];
|
||||
if (reposElement.Repositories.All(x => x.Id != new Guid("65194810-1f85-11dd-bd0b-0800200c9a66")))
|
||||
{
|
||||
reposElement.Repositories.Add(new RepositoryElement() { Name = "Umbraco package Repository", Id = new Guid("65194810-1f85-11dd-bd0b-0800200c9a66") });
|
||||
}
|
||||
|
||||
return reposElement;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[ConfigurationProperty("providers")]
|
||||
internal ProvidersElement Providers
|
||||
{
|
||||
@@ -185,11 +142,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
get { return DistributedCall; }
|
||||
}
|
||||
|
||||
IRepositoriesSection IUmbracoSettingsSection.PackageRepositories
|
||||
{
|
||||
get { return PackageRepositories; }
|
||||
}
|
||||
|
||||
IProvidersSection IUmbracoSettingsSection.Providers
|
||||
{
|
||||
get { return Providers; }
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
public class UmbracoVersion
|
||||
{
|
||||
private static readonly Version Version = new Version("7.9.2");
|
||||
private static readonly Version Version = new Version("7.11.0");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current version of Umbraco.
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
/// alias for the dictionary tree.
|
||||
/// </summary>
|
||||
public const string Dictionary = "dictionary";
|
||||
|
||||
|
||||
public const string Stylesheets = "stylesheets";
|
||||
|
||||
/// <summary>
|
||||
@@ -135,4 +135,4 @@
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
public static partial class Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the constants used for the Umbraco package repository
|
||||
/// </summary>
|
||||
public static class PackageRepository
|
||||
{
|
||||
public const string RestApiBaseUrl = "https://our.umbraco.org/webapi/packages/v1";
|
||||
public const string DefaultRepositoryName = "Umbraco package Repository";
|
||||
public const string DefaultRepositoryId = "65194810-1f85-11dd-bd0b-0800200c9a66";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,6 +122,11 @@ namespace Umbraco.Core
|
||||
/// Alias for the Dropdown list, publishing keys datatype.
|
||||
/// </summary>
|
||||
public const string DropdownlistPublishingKeysAlias = "Umbraco.DropdownlistPublishingKeys";
|
||||
|
||||
/// <summary>
|
||||
/// Alias for the "new" Dropdown list, that replaces the old four deprecated ones and works as other list based property editors
|
||||
/// </summary>
|
||||
public const string DropDownListFlexibleAlias = "Umbraco.DropDown.Flexible";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for the Folder browser datatype.
|
||||
@@ -452,4 +457,4 @@ namespace Umbraco.Core
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,6 +459,22 @@ namespace Umbraco.Core
|
||||
var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace);
|
||||
var connectionstrings = xml.Root.DescendantsAndSelf("connectionStrings").Single();
|
||||
|
||||
// honour configSource, if its set, change the xml file we are saving the configuration
|
||||
// to the one set in the configSource attribute
|
||||
if (connectionstrings.Attribute("configSource") != null)
|
||||
{
|
||||
var source = connectionstrings.Attribute("configSource").Value;
|
||||
var configFile = IOHelper.MapPath(string.Format("{0}/{1}", SystemDirectories.Root, source));
|
||||
LogHelper.Info<DatabaseContext>("storing ConnectionString in {0}", () => configFile);
|
||||
if (System.IO.File.Exists(configFile))
|
||||
{
|
||||
xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace);
|
||||
fileName = configFile;
|
||||
}
|
||||
|
||||
connectionstrings = xml.Root.DescendantsAndSelf("connectionStrings").Single();
|
||||
}
|
||||
|
||||
// Update connectionString if it exists, or else create a new appSetting for the given key and value
|
||||
var setting = connectionstrings.Descendants("add").FirstOrDefault(s => s.Attribute("name").Value == Constants.System.UmbracoConnectionName);
|
||||
if (setting == null)
|
||||
|
||||
@@ -203,7 +203,6 @@ namespace Umbraco.Core.IO
|
||||
{
|
||||
get
|
||||
{
|
||||
//by default the packages folder should exist in the data folder
|
||||
return IOHelper.ReturnPath("umbracoPreviewPath", Data + IOHelper.DirSepChar + "preview");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,8 +140,7 @@ namespace Umbraco.Core
|
||||
if (underlying != null)
|
||||
{
|
||||
// Special case for empty strings for bools/dates which should return null if an empty string.
|
||||
var inputString = input as string;
|
||||
if (inputString != null)
|
||||
if (input is string inputString)
|
||||
{
|
||||
//TODO: Why the check against only bool/date when a string is null/empty? In what scenario can we convert to another type when the string is null or empty other than just being null?
|
||||
if (string.IsNullOrEmpty(inputString) && (underlying == typeof(DateTime) || underlying == typeof(bool)))
|
||||
@@ -168,8 +167,7 @@ namespace Umbraco.Core
|
||||
{
|
||||
// target is not a generic type
|
||||
|
||||
var inputString = input as string;
|
||||
if (inputString != null)
|
||||
if (input is string inputString)
|
||||
{
|
||||
// Try convert from string, returns an Attempt if the string could be
|
||||
// processed (either succeeded or failed), else null if we need to try
|
||||
@@ -218,8 +216,7 @@ namespace Umbraco.Core
|
||||
}
|
||||
|
||||
// Re-check convertables since we altered the input through recursion
|
||||
var convertible2 = input as IConvertible;
|
||||
if (convertible2 != null)
|
||||
if (input is IConvertible convertible2)
|
||||
{
|
||||
return Attempt.Succeed(Convert.ChangeType(convertible2, target));
|
||||
}
|
||||
@@ -277,8 +274,7 @@ namespace Umbraco.Core
|
||||
{
|
||||
if (target == typeof(int))
|
||||
{
|
||||
int value;
|
||||
if (int.TryParse(input, out value))
|
||||
if (int.TryParse(input, out var value))
|
||||
{
|
||||
return Attempt<object>.Succeed(value);
|
||||
}
|
||||
@@ -286,30 +282,26 @@ namespace Umbraco.Core
|
||||
// Because decimal 100.01m will happily convert to integer 100, it
|
||||
// makes sense that string "100.01" *also* converts to integer 100.
|
||||
var input2 = NormalizeNumberDecimalSeparator(input);
|
||||
decimal value2;
|
||||
return Attempt<object>.SucceedIf(decimal.TryParse(input2, out value2), Convert.ToInt32(value2));
|
||||
return Attempt<object>.SucceedIf(decimal.TryParse(input2, out var value2), Convert.ToInt32(value2));
|
||||
}
|
||||
|
||||
if (target == typeof(long))
|
||||
{
|
||||
long value;
|
||||
if (long.TryParse(input, out value))
|
||||
if (long.TryParse(input, out var value))
|
||||
{
|
||||
return Attempt<object>.Succeed(value);
|
||||
}
|
||||
|
||||
// Same as int
|
||||
var input2 = NormalizeNumberDecimalSeparator(input);
|
||||
decimal value2;
|
||||
return Attempt<object>.SucceedIf(decimal.TryParse(input2, out value2), Convert.ToInt64(value2));
|
||||
return Attempt<object>.SucceedIf(decimal.TryParse(input2, out var value2), Convert.ToInt64(value2));
|
||||
}
|
||||
|
||||
// TODO: Should we do the decimal trick for short, byte, unsigned?
|
||||
|
||||
if (target == typeof(bool))
|
||||
{
|
||||
bool value;
|
||||
if (bool.TryParse(input, out value))
|
||||
if (bool.TryParse(input, out var value))
|
||||
{
|
||||
return Attempt<object>.Succeed(value);
|
||||
}
|
||||
@@ -322,53 +314,42 @@ namespace Umbraco.Core
|
||||
switch (Type.GetTypeCode(target))
|
||||
{
|
||||
case TypeCode.Int16:
|
||||
short value;
|
||||
return Attempt<object>.SucceedIf(short.TryParse(input, out value), value);
|
||||
return Attempt<object>.SucceedIf(short.TryParse(input, out var value), value);
|
||||
|
||||
case TypeCode.Double:
|
||||
var input2 = NormalizeNumberDecimalSeparator(input);
|
||||
double valueD;
|
||||
return Attempt<object>.SucceedIf(double.TryParse(input2, out valueD), valueD);
|
||||
return Attempt<object>.SucceedIf(double.TryParse(input2, out var valueD), valueD);
|
||||
|
||||
case TypeCode.Single:
|
||||
var input3 = NormalizeNumberDecimalSeparator(input);
|
||||
float valueF;
|
||||
return Attempt<object>.SucceedIf(float.TryParse(input3, out valueF), valueF);
|
||||
return Attempt<object>.SucceedIf(float.TryParse(input3, out var valueF), valueF);
|
||||
|
||||
case TypeCode.Char:
|
||||
char valueC;
|
||||
return Attempt<object>.SucceedIf(char.TryParse(input, out valueC), valueC);
|
||||
return Attempt<object>.SucceedIf(char.TryParse(input, out var valueC), valueC);
|
||||
|
||||
case TypeCode.Byte:
|
||||
byte valueB;
|
||||
return Attempt<object>.SucceedIf(byte.TryParse(input, out valueB), valueB);
|
||||
return Attempt<object>.SucceedIf(byte.TryParse(input, out var valueB), valueB);
|
||||
|
||||
case TypeCode.SByte:
|
||||
sbyte valueSb;
|
||||
return Attempt<object>.SucceedIf(sbyte.TryParse(input, out valueSb), valueSb);
|
||||
return Attempt<object>.SucceedIf(sbyte.TryParse(input, out var valueSb), valueSb);
|
||||
|
||||
case TypeCode.UInt32:
|
||||
uint valueU;
|
||||
return Attempt<object>.SucceedIf(uint.TryParse(input, out valueU), valueU);
|
||||
return Attempt<object>.SucceedIf(uint.TryParse(input, out var valueU), valueU);
|
||||
|
||||
case TypeCode.UInt16:
|
||||
ushort valueUs;
|
||||
return Attempt<object>.SucceedIf(ushort.TryParse(input, out valueUs), valueUs);
|
||||
return Attempt<object>.SucceedIf(ushort.TryParse(input, out var valueUs), valueUs);
|
||||
|
||||
case TypeCode.UInt64:
|
||||
ulong valueUl;
|
||||
return Attempt<object>.SucceedIf(ulong.TryParse(input, out valueUl), valueUl);
|
||||
return Attempt<object>.SucceedIf(ulong.TryParse(input, out var valueUl), valueUl);
|
||||
}
|
||||
}
|
||||
else if (target == typeof(Guid))
|
||||
{
|
||||
Guid value;
|
||||
return Attempt<object>.SucceedIf(Guid.TryParse(input, out value), value);
|
||||
return Attempt<object>.SucceedIf(Guid.TryParse(input, out var value), value);
|
||||
}
|
||||
else if (target == typeof(DateTime))
|
||||
{
|
||||
DateTime value;
|
||||
if (DateTime.TryParse(input, out value))
|
||||
if (DateTime.TryParse(input, out var value))
|
||||
{
|
||||
switch (value.Kind)
|
||||
{
|
||||
@@ -388,24 +369,20 @@ namespace Umbraco.Core
|
||||
}
|
||||
else if (target == typeof(DateTimeOffset))
|
||||
{
|
||||
DateTimeOffset value;
|
||||
return Attempt<object>.SucceedIf(DateTimeOffset.TryParse(input, out value), value);
|
||||
return Attempt<object>.SucceedIf(DateTimeOffset.TryParse(input, out var value), value);
|
||||
}
|
||||
else if (target == typeof(TimeSpan))
|
||||
{
|
||||
TimeSpan value;
|
||||
return Attempt<object>.SucceedIf(TimeSpan.TryParse(input, out value), value);
|
||||
return Attempt<object>.SucceedIf(TimeSpan.TryParse(input, out var value), value);
|
||||
}
|
||||
else if (target == typeof(decimal))
|
||||
{
|
||||
var input2 = NormalizeNumberDecimalSeparator(input);
|
||||
decimal value;
|
||||
return Attempt<object>.SucceedIf(decimal.TryParse(input2, out value), value);
|
||||
return Attempt<object>.SucceedIf(decimal.TryParse(input2, out var value), value);
|
||||
}
|
||||
else if (input != null && target == typeof(Version))
|
||||
{
|
||||
Version value;
|
||||
return Attempt<object>.SucceedIf(Version.TryParse(input, out value), value);
|
||||
return Attempt<object>.SucceedIf(Version.TryParse(input, out var value), value);
|
||||
}
|
||||
|
||||
// E_NOTIMPL IPAddress, BigInteger
|
||||
@@ -690,8 +667,7 @@ namespace Umbraco.Core
|
||||
{
|
||||
var key = new CompositeTypeTypeKey(source, target);
|
||||
|
||||
TypeConverter typeConverter;
|
||||
if (InputTypeConverterCache.TryGetValue(key, out typeConverter))
|
||||
if (InputTypeConverterCache.TryGetValue(key, out TypeConverter typeConverter))
|
||||
{
|
||||
return typeConverter;
|
||||
}
|
||||
@@ -711,8 +687,7 @@ namespace Umbraco.Core
|
||||
{
|
||||
var key = new CompositeTypeTypeKey(source, target);
|
||||
|
||||
TypeConverter typeConverter;
|
||||
if (DestinationTypeConverterCache.TryGetValue(key, out typeConverter))
|
||||
if (DestinationTypeConverterCache.TryGetValue(key, out TypeConverter typeConverter))
|
||||
{
|
||||
return typeConverter;
|
||||
}
|
||||
@@ -730,8 +705,7 @@ namespace Umbraco.Core
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static Type GetCachedGenericNullableType(Type type)
|
||||
{
|
||||
Type underlyingType;
|
||||
if (NullableGenericCache.TryGetValue(type, out underlyingType))
|
||||
if (NullableGenericCache.TryGetValue(type, out Type underlyingType))
|
||||
{
|
||||
return underlyingType;
|
||||
}
|
||||
@@ -750,8 +724,7 @@ namespace Umbraco.Core
|
||||
private static bool GetCachedCanAssign(object input, Type source, Type target)
|
||||
{
|
||||
var key = new CompositeTypeTypeKey(source, target);
|
||||
bool canConvert;
|
||||
if (AssignableTypeCache.TryGetValue(key, out canConvert))
|
||||
if (AssignableTypeCache.TryGetValue(key, out bool canConvert))
|
||||
{
|
||||
return canConvert;
|
||||
}
|
||||
@@ -770,8 +743,7 @@ namespace Umbraco.Core
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static bool GetCachedCanConvertToBoolean(Type type)
|
||||
{
|
||||
bool result;
|
||||
if (BoolConvertCache.TryGetValue(type, out result))
|
||||
if (BoolConvertCache.TryGetValue(type, out bool result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -166,17 +166,20 @@ namespace Umbraco.Core.Persistence.Migrations
|
||||
var targetVersionToCompare = _targetVersion.GetVersion(3);
|
||||
var currentVersionToCompare = _currentVersion.GetVersion(3);
|
||||
|
||||
if(currentVersionToCompare <= targetVersionToCompare)
|
||||
throw new ArgumentException("When downgrading, make sure that the target version is lower than the current version.");
|
||||
|
||||
var migrations = (from migration in foundMigrations
|
||||
let migrationAttributes = migration.GetType().GetCustomAttributes<MigrationAttribute>(false)
|
||||
from migrationAttribute in migrationAttributes
|
||||
where migrationAttribute != null
|
||||
where
|
||||
migrationAttribute.TargetVersion > currentVersionToCompare &&
|
||||
migrationAttribute.TargetVersion <= targetVersionToCompare &&
|
||||
migrationAttribute.TargetVersion > targetVersionToCompare &&
|
||||
migrationAttribute.TargetVersion <= currentVersionToCompare &&
|
||||
migrationAttribute.ProductName == _productName &&
|
||||
//filter if the migration specifies a minimum current version for which to execute
|
||||
(migrationAttribute.MinimumCurrentVersion == null || currentVersionToCompare >= migrationAttribute.MinimumCurrentVersion)
|
||||
orderby migrationAttribute.TargetVersion, migrationAttribute.SortOrder descending
|
||||
orderby migrationAttribute.TargetVersion descending, migrationAttribute.SortOrder descending
|
||||
select migration).Distinct();
|
||||
return migrations;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZero
|
||||
@@ -343,15 +344,24 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZe
|
||||
|
||||
if (tables.InvariantContains("umbracoUserType") && tables.InvariantContains("umbracoUser"))
|
||||
{
|
||||
if (constraints.Any(x => x.Item1.InvariantEquals("umbracoUser") && x.Item3.InvariantEquals("FK_umbracoUser_umbracoUserType_id")))
|
||||
if (Context.CurrentDatabaseProvider == DatabaseProviders.MySql)
|
||||
{
|
||||
Delete.ForeignKey("FK_umbracoUser_umbracoUserType_id").OnTable("umbracoUser");
|
||||
//In MySql, this will drop the FK according to it's special naming rules
|
||||
Delete.ForeignKey().FromTable("umbracoUser").ForeignColumn("userType").ToTable("umbracoUserType").PrimaryColumn("id");
|
||||
}
|
||||
//This is the super old constraint name of the FK for user type so check this one too
|
||||
if (constraints.Any(x => x.Item1.InvariantEquals("umbracoUser") && x.Item3.InvariantEquals("FK_user_userType")))
|
||||
else
|
||||
{
|
||||
Delete.ForeignKey("FK_user_userType").OnTable("umbracoUser");
|
||||
}
|
||||
//Delete the FK if it exists before dropping the column
|
||||
if (constraints.Any(x => x.Item1.InvariantEquals("umbracoUser") && x.Item3.InvariantEquals("FK_umbracoUser_umbracoUserType_id")))
|
||||
{
|
||||
Delete.ForeignKey("FK_umbracoUser_umbracoUserType_id").OnTable("umbracoUser");
|
||||
}
|
||||
//This is the super old constraint name of the FK for user type so check this one too
|
||||
if (constraints.Any(x => x.Item1.InvariantEquals("umbracoUser") && x.Item3.InvariantEquals("FK_user_userType")))
|
||||
{
|
||||
Delete.ForeignKey("FK_user_userType").OnTable("umbracoUser");
|
||||
}
|
||||
}
|
||||
|
||||
Delete.Column("userType").FromTable("umbracoUser");
|
||||
Delete.Table("umbracoUserType");
|
||||
@@ -361,4 +371,4 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZe
|
||||
public override void Down()
|
||||
{ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
using System.IO;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
using File = System.IO.File;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenTenZero
|
||||
{
|
||||
/// <summary>
|
||||
/// Renames the preview folder containing static html files to ensure it does not interfere with the MVC route
|
||||
/// that is now supposed to render these views dynamically. We don't want to delete as people may have made
|
||||
/// customizations to these files that would need to be migrated to the new .cshtml view files.
|
||||
/// </summary>
|
||||
[Migration("7.10.0", 1, Constants.System.UmbracoMigrationName)]
|
||||
public class RenamePreviewFolder : MigrationBase
|
||||
{
|
||||
public RenamePreviewFolder(ISqlSyntaxProvider sqlSyntax, ILogger logger)
|
||||
: base(sqlSyntax, logger)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Up()
|
||||
{
|
||||
var previewFolderPath = IOHelper.MapPath(SystemDirectories.Umbraco + "/preview");
|
||||
if (Directory.Exists(previewFolderPath))
|
||||
{
|
||||
var newPath = previewFolderPath.Replace("preview", "preview.old");
|
||||
if (Directory.Exists(newPath) == false)
|
||||
{
|
||||
Directory.Move(previewFolderPath, newPath);
|
||||
var readmeText =
|
||||
$"Static html files used for preview and canvas editing functionality no longer live in this directory.\r\n" +
|
||||
$"Instead they have been recreated as MVC views and can now be found in '~/Umbraco/Views/Preview'.\r\n" +
|
||||
$"See issue: http://issues.umbraco.org/issue/U4-11090";
|
||||
File.WriteAllText(Path.Combine(newPath, "readme.txt"), readmeText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -402,7 +402,7 @@ namespace Umbraco.Core.Persistence
|
||||
}
|
||||
|
||||
// Helper to handle named parameters from object properties
|
||||
static Regex rxParams = new Regex(@"(?<!@)@\w+", RegexOptions.Compiled);
|
||||
static readonly Regex rxParams = new Regex(@"(?<!@)@\w+", RegexOptions.Compiled);
|
||||
public static string ProcessParams(string _sql, object[] args_src, List<object> args_dest)
|
||||
{
|
||||
return rxParams.Replace(_sql, m =>
|
||||
@@ -545,7 +545,7 @@ namespace Umbraco.Core.Persistence
|
||||
}
|
||||
|
||||
// Create a command
|
||||
static Regex rxParamsPrefix = new Regex(@"(?<!@)@\w+", RegexOptions.Compiled);
|
||||
static readonly Regex rxParamsPrefix = new Regex(@"(?<!@)@\w+", RegexOptions.Compiled);
|
||||
public IDbCommand CreateCommand(IDbConnection connection, string sql, params object[] args)
|
||||
{
|
||||
// Perform named argument replacements
|
||||
@@ -666,8 +666,8 @@ namespace Umbraco.Core.Persistence
|
||||
return ExecuteScalar<T>(sql.SQL, sql.Arguments);
|
||||
}
|
||||
|
||||
Regex rxSelect = new Regex(@"\A\s*(SELECT|EXECUTE|CALL)\s", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Multiline);
|
||||
Regex rxFrom = new Regex(@"\A\s*FROM\s", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Multiline);
|
||||
static readonly Regex rxSelect = new Regex(@"\A\s*(SELECT|EXECUTE|CALL)\s", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Multiline);
|
||||
static readonly Regex rxFrom = new Regex(@"\A\s*FROM\s", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Multiline);
|
||||
string AddSelectClause<T>(string sql)
|
||||
{
|
||||
if (sql.StartsWith(";"))
|
||||
@@ -701,9 +701,9 @@ namespace Umbraco.Core.Persistence
|
||||
return Fetch<T>(sql.SQL, sql.Arguments);
|
||||
}
|
||||
|
||||
static Regex rxColumns = new Regex(@"\A\s*SELECT\s+((?:\((?>\((?<depth>)|\)(?<-depth>)|.?)*(?(depth)(?!))\)|.)*?)(?<!,\s+)\bFROM\b", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.Compiled);
|
||||
static Regex rxOrderBy = new Regex(@"\bORDER\s+BY\s+(?:\((?>\((?<depth>)|\)(?<-depth>)|.?)*(?(depth)(?!))\)|[\w\(\)\.])+(?:\s+(?:ASC|DESC))?(?:\s*,\s*(?:\((?>\((?<depth>)|\)(?<-depth>)|.?)*(?(depth)(?!))\)|[\w\(\)\.])+(?:\s+(?:ASC|DESC))?)*", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.Compiled);
|
||||
static Regex rxDistinct = new Regex(@"\ADISTINCT\s", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.Compiled);
|
||||
static readonly Regex rxColumns = new Regex(@"\A\s*SELECT\s+((?:\((?>\((?<depth>)|\)(?<-depth>)|.?)*(?(depth)(?!))\)|.)*?)(?<!,\s+)\bFROM\b", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.Compiled);
|
||||
static readonly Regex rxOrderBy = new Regex(@"\bORDER\s+BY\s+(?:\((?>\((?<depth>)|\)(?<-depth>)|.?)*(?(depth)(?!))\)|[\w\(\)\.])+(?:\s+(?:ASC|DESC))?(?:\s*,\s*(?:\((?>\((?<depth>)|\)(?<-depth>)|.?)*(?(depth)(?!))\)|[\w\(\)\.])+(?:\s+(?:ASC|DESC))?)*", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.Compiled);
|
||||
static readonly Regex rxDistinct = new Regex(@"\ADISTINCT\s", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.Compiled);
|
||||
public static bool SplitSqlForPaging(string sql, out string sqlCount, out string sqlSelectRemoved, out string sqlOrderBy)
|
||||
{
|
||||
sqlSelectRemoved = null;
|
||||
@@ -2546,5 +2546,4 @@ namespace Umbraco.Core.Persistence
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,12 +40,13 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
|
||||
|
||||
//TODO: Change all singleton access to use ctor injection in v8!!!
|
||||
//TODO: That would mean that property value converters would need to be request lifespan, hrm....
|
||||
bool isDebug = HttpContext.Current != null && HttpContext.Current.IsDebuggingEnabled;
|
||||
var gridConfig = UmbracoConfig.For.GridConfig(
|
||||
ApplicationContext.Current.ProfilingLogger.Logger,
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache,
|
||||
new DirectoryInfo(IOHelper.MapPath(SystemDirectories.AppPlugins)),
|
||||
new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Config)),
|
||||
HttpContext.Current.IsDebuggingEnabled);
|
||||
isDebug);
|
||||
|
||||
var sections = GetArray(obj, "sections");
|
||||
foreach (var section in sections.Cast<JObject>())
|
||||
@@ -112,4 +113,4 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using System;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Core.PropertyEditors.ValueConverters
|
||||
{
|
||||
@@ -14,19 +15,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
|
||||
|
||||
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
|
||||
{
|
||||
if (source == null) return 0;
|
||||
|
||||
// in XML an integer is a string
|
||||
var sourceString = source as string;
|
||||
if (sourceString != null)
|
||||
{
|
||||
int i;
|
||||
return (int.TryParse(sourceString, out i)) ? i : 0;
|
||||
}
|
||||
|
||||
// in the database an integer is an integer
|
||||
// default value is zero
|
||||
return (source is int) ? source : 0;
|
||||
return source.TryConvertTo<int>().Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Umbraco.Core.Scoping
|
||||
public NoScope(ScopeProvider scopeProvider)
|
||||
{
|
||||
_scopeProvider = scopeProvider;
|
||||
Timestamp = DateTime.Now;
|
||||
#if DEBUG_SCOPES
|
||||
_scopeProvider.RegisterScope(this);
|
||||
#endif
|
||||
@@ -28,6 +29,8 @@ namespace Umbraco.Core.Scoping
|
||||
private readonly Guid _instanceId = Guid.NewGuid();
|
||||
public Guid InstanceId { get { return _instanceId; } }
|
||||
|
||||
public DateTime Timestamp { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool CallContext { get { return false; } }
|
||||
|
||||
|
||||
@@ -374,7 +374,7 @@ namespace Umbraco.Core.Scoping
|
||||
}
|
||||
|
||||
var parent = ParentScope;
|
||||
_scopeProvider.AmbientScope = parent;
|
||||
_scopeProvider.AmbientScope = parent; // might be null = this is how scopes are removed from context objects
|
||||
|
||||
#if DEBUG_SCOPES
|
||||
_scopeProvider.Disposed(this);
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence;
|
||||
#if DEBUG_SCOPES
|
||||
using System.Linq;
|
||||
@@ -66,22 +68,38 @@ namespace Umbraco.Core.Scoping
|
||||
// tests, any other things (see https://msdn.microsoft.com/en-us/library/dn458353(v=vs.110).aspx),
|
||||
// but we don't want to make all of our objects serializable since they are *not* meant to be
|
||||
// used in cross-AppDomain scenario anyways.
|
||||
//
|
||||
// in addition, whatever goes into the logical call context is serialized back and forth any
|
||||
// time cross-AppDomain code executes, so if we put an "object" there, we'll can *another*
|
||||
// "object" instance - and so we cannot use a random object as a key.
|
||||
// time cross-AppDomain code executes, so if we put an "object" there, we'll get *another*
|
||||
// "object" instance back - and so we cannot use a random object as a key.
|
||||
//
|
||||
// so what we do is: we register a guid in the call context, and we keep a table mapping those
|
||||
// guids to the actual objects. the guid serializes back and forth without causing any issue,
|
||||
// and we can retrieve the actual objects from the table.
|
||||
// only issue: how are we supposed to clear the table? we can't, really. objects should take
|
||||
// care of de-registering themselves from context.
|
||||
// everything we use does, except the NoScope scope, which just stays there
|
||||
//
|
||||
// during tests, NoScope can to into call context... nothing much we can do about it
|
||||
// so far, the only objects that go into this table are scopes (using ScopeItemKey) and
|
||||
// scope contexts (using ContextItemKey).
|
||||
|
||||
private static readonly object StaticCallContextObjectsLock = new object();
|
||||
private static readonly Dictionary<Guid, object> StaticCallContextObjects
|
||||
= new Dictionary<Guid, object>();
|
||||
|
||||
// normal scopes and scope contexts take greate care removing themselves when disposed, so it
|
||||
// is all safe. OTOH the NoScope *CANNOT* remove itself, this is by design, it *WILL* leak and
|
||||
// there is little (nothing) we can do about it - NoScope exists for backward compatibility
|
||||
// reasons and relying on it is greatly discouraged.
|
||||
//
|
||||
// however... we can *try* at protecting the app against memory leaks, by collecting NoScope
|
||||
// instances that are too old. if anything actually *need* to retain a NoScope instance for
|
||||
// a long time, it will break. but that's probably ok. so: the constants below define how
|
||||
// long a NoScope instance can stay in the table before being removed, and how often we should
|
||||
// collect the table - and collecting happens anytime SetCallContextObject is invoked
|
||||
|
||||
private static readonly TimeSpan StaticCallContextNoScopeLifeSpan = TimeSpan.FromMinutes(30);
|
||||
private static readonly TimeSpan StaticCallContextCollectPeriod = TimeSpan.FromMinutes(4);
|
||||
private static DateTime _staticCallContextLastCollect = DateTime.MinValue;
|
||||
|
||||
|
||||
#if DEBUG_SCOPES
|
||||
public Dictionary<Guid, object> CallContextObjects
|
||||
{
|
||||
@@ -156,6 +174,7 @@ namespace Umbraco.Core.Scoping
|
||||
//Logging.LogHelper.Debug<ScopeProvider>("At:\r\n" + Head(Environment.StackTrace, 24));
|
||||
#endif
|
||||
StaticCallContextObjects.Remove(objectKey);
|
||||
CollectStaticCallContextObjectsLocked();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -171,11 +190,37 @@ namespace Umbraco.Core.Scoping
|
||||
//Logging.LogHelper.Debug<ScopeProvider>("At:\r\n" + Head(Environment.StackTrace, 24));
|
||||
#endif
|
||||
StaticCallContextObjects.Add(objectKey, value);
|
||||
CollectStaticCallContextObjectsLocked();
|
||||
}
|
||||
CallContext.LogicalSetData(key, objectKey);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CollectStaticCallContextObjectsLocked()
|
||||
{
|
||||
// is it time to collect?
|
||||
var now = DateTime.Now;
|
||||
if (now - _staticCallContextLastCollect <= StaticCallContextCollectPeriod)
|
||||
return;
|
||||
|
||||
// disable warning: this method is invoked from within a lock
|
||||
// ReSharper disable InconsistentlySynchronizedField
|
||||
var threshold = now.Add(-StaticCallContextNoScopeLifeSpan);
|
||||
var guids = StaticCallContextObjects
|
||||
.Where(x => x.Value is NoScope noScope && noScope.Timestamp < threshold)
|
||||
.Select(x => x.Key)
|
||||
.ToList();
|
||||
if (guids.Count > 0)
|
||||
{
|
||||
LogHelper.Warn<ScopeProvider>($"Collected {guids.Count} NoScope instances from StaticCallContextObjects.");
|
||||
foreach (var guid in guids)
|
||||
StaticCallContextObjects.Remove(guid);
|
||||
}
|
||||
// ReSharper restore InconsistentlySynchronizedField
|
||||
|
||||
_staticCallContextLastCollect = now;
|
||||
}
|
||||
|
||||
// this is for tests exclusively until we have a proper accessor in v8
|
||||
internal static Func<IDictionary> HttpContextItemsGetter { get; set; }
|
||||
|
||||
|
||||
@@ -37,15 +37,15 @@ namespace Umbraco.Core.Security
|
||||
var username = identity.GetUserName();
|
||||
var session = identity.FindFirstValue(Constants.Security.SessionIdClaimType);
|
||||
var securityStamp = identity.FindFirstValue(Microsoft.AspNet.Identity.Constants.DefaultSecurityStampClaimType);
|
||||
var startContentId = identity.FindFirstValue(Constants.Security.StartContentNodeIdClaimType);
|
||||
var startContentId = identity.FindFirstValue(Constants.Security.StartContentNodeIdClaimType);
|
||||
var startMediaId = identity.FindFirstValue(Constants.Security.StartMediaNodeIdClaimType);
|
||||
|
||||
var culture = identity.FindFirstValue(ClaimTypes.Locality);
|
||||
var id = identity.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var id = identity.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var realName = identity.FindFirstValue(ClaimTypes.GivenName);
|
||||
|
||||
if (username == null || startContentId == null || startMediaId == null
|
||||
|| culture == null || id == null
|
||||
if (username == null || startContentId == null || startMediaId == null
|
||||
|| culture == null || id == null
|
||||
|| realName == null || session == null)
|
||||
throw new InvalidOperationException("Cannot create a " + typeof(UmbracoBackOfficeIdentity) + " from " + typeof(ClaimsIdentity) + " since there are missing required claims");
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Umbraco.Core.Security
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new InvalidOperationException("Cannot create a " + typeof(UmbracoBackOfficeIdentity) + " from " + typeof(ClaimsIdentity) + " since the data is not formatted correctly - either content or media start Ids could not be parsed as JSON", e);
|
||||
}
|
||||
}
|
||||
|
||||
var roles = identity.FindAll(x => x.Type == DefaultRoleClaimType).Select(role => role.Value).ToList();
|
||||
var allowedApps = identity.FindAll(x => x.Type == Constants.Security.AllowedApplicationsClaimType).Select(app => app.Value).ToList();
|
||||
@@ -165,7 +165,7 @@ namespace Umbraco.Core.Security
|
||||
{
|
||||
foreach (var claim in claimsIdentity.Claims)
|
||||
{
|
||||
//In one special case we will replace a claim if it exists already and that is the
|
||||
//In one special case we will replace a claim if it exists already and that is the
|
||||
// Forms auth claim for name which automatically gets added
|
||||
TryRemoveClaim(FindFirst(x => x.Type == claim.Type && x.Issuer == "Forms"));
|
||||
|
||||
@@ -187,15 +187,15 @@ namespace Umbraco.Core.Security
|
||||
{
|
||||
ClaimTypes.NameIdentifier, //id
|
||||
ClaimTypes.Name, //username
|
||||
ClaimTypes.GivenName,
|
||||
ClaimTypes.GivenName,
|
||||
Constants.Security.StartContentNodeIdClaimType,
|
||||
Constants.Security.StartMediaNodeIdClaimType,
|
||||
ClaimTypes.Locality,
|
||||
Constants.Security.StartMediaNodeIdClaimType,
|
||||
ClaimTypes.Locality,
|
||||
Constants.Security.SessionIdClaimType,
|
||||
Microsoft.AspNet.Identity.Constants.DefaultSecurityStampClaimType
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds claims based on the UserData data
|
||||
@@ -222,23 +222,19 @@ namespace Umbraco.Core.Security
|
||||
AddClaim(new Claim(ClaimTypes.Locality, Culture, ClaimValueTypes.String, Issuer, Issuer, this));
|
||||
|
||||
if (HasClaim(x => x.Type == Constants.Security.SessionIdClaimType) == false && SessionId.IsNullOrWhiteSpace() == false)
|
||||
{
|
||||
AddClaim(new Claim(Constants.Security.SessionIdClaimType, SessionId, ClaimValueTypes.String, Issuer, Issuer, this));
|
||||
|
||||
//The security stamp claim is also required... this is because this claim type is hard coded
|
||||
// by the SecurityStampValidator, see: https://katanaproject.codeplex.com/workitem/444
|
||||
if (HasClaim(x => x.Type == Microsoft.AspNet.Identity.Constants.DefaultSecurityStampClaimType) == false)
|
||||
{
|
||||
AddClaim(new Claim(Microsoft.AspNet.Identity.Constants.DefaultSecurityStampClaimType, SecurityStamp, ClaimValueTypes.String, Issuer, Issuer, this));
|
||||
}
|
||||
}
|
||||
//The security stamp claim is also required... this is because this claim type is hard coded
|
||||
// by the SecurityStampValidator, see: https://katanaproject.codeplex.com/workitem/444
|
||||
if (HasClaim(x => x.Type == Microsoft.AspNet.Identity.Constants.DefaultSecurityStampClaimType) == false)
|
||||
AddClaim(new Claim(Microsoft.AspNet.Identity.Constants.DefaultSecurityStampClaimType, SecurityStamp, ClaimValueTypes.String, Issuer, Issuer, this));
|
||||
|
||||
//Add each app as a separate claim
|
||||
if (HasClaim(x => x.Type == Constants.Security.AllowedApplicationsClaimType) == false)
|
||||
{
|
||||
foreach (var application in AllowedApplications)
|
||||
{
|
||||
AddClaim(new Claim(Constants.Security.AllowedApplicationsClaimType, application, ClaimValueTypes.String, Issuer, Issuer, this));
|
||||
AddClaim(new Claim(Constants.Security.AllowedApplicationsClaimType, application, ClaimValueTypes.String, Issuer, Issuer, this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,8 +249,8 @@ namespace Umbraco.Core.Security
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected internal UserData UserData { get; private set; }
|
||||
@@ -332,4 +328,4 @@ namespace Umbraco.Core.Security
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1375,7 +1375,7 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
DeleteBlueprintsOfTypes(new[] {contentTypeId}, userId);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Saves a single <see cref="IContent"/> object
|
||||
/// </summary>
|
||||
|
||||
@@ -109,6 +109,23 @@ namespace Umbraco.Core.Services
|
||||
|
||||
return new ContentTypeAvailableCompositionsResults(ancestors, result);
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the list of content types the composition is used in
|
||||
/// </summary>
|
||||
/// <param name="allContentTypes"></param>
|
||||
/// <param name="ctService"></param>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
internal static IEnumerable<IContentTypeComposition> GetWhereCompositionIsUsedInContentTypes(this IContentTypeService ctService,
|
||||
IContentTypeComposition source,
|
||||
IContentTypeComposition[] allContentTypes)
|
||||
{
|
||||
|
||||
var sourceId = source != null ? source.Id : 0;
|
||||
|
||||
// find which content types are using this composition
|
||||
return allContentTypes.Where(x => x.ContentTypeComposition.Any(y => y.Id == sourceId)).ToArray();
|
||||
}
|
||||
|
||||
private static IContentTypeComposition[] GetAncestors(IContentTypeComposition ctype, IContentTypeComposition[] allContentTypes)
|
||||
{
|
||||
@@ -162,4 +179,4 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@ namespace Umbraco.Core.Services
|
||||
/// explicitly. These methods will replace the normal ones in IContentService in v8 and this will be removed.
|
||||
/// </summary>
|
||||
public interface IContentServiceOperations
|
||||
{
|
||||
//TODO: Remove this class in v8
|
||||
|
||||
//TODO: There's probably more that needs to be added like the EmptyRecycleBin, etc...
|
||||
{
|
||||
//TODO: Remove this class in v8
|
||||
|
||||
//TODO: There's probably more that needs to be added like the EmptyRecycleBin, etc...
|
||||
|
||||
/// <summary>
|
||||
/// Saves a single <see cref="IContent"/> object
|
||||
@@ -99,7 +99,7 @@ namespace Umbraco.Core.Services
|
||||
IEnumerable<IContent> GetBlueprintsForContentTypes(params int[] documentTypeIds);
|
||||
IContent GetBlueprintById(int id);
|
||||
IContent GetBlueprintById(Guid id);
|
||||
void SaveBlueprint(IContent content, int userId = 0);
|
||||
void SaveBlueprint(IContent content, int userId = 0);
|
||||
void DeleteBlueprint(IContent content, int userId = 0);
|
||||
IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = 0);
|
||||
void DeleteBlueprintsOfType(int contentTypeId, int userId = 0);
|
||||
@@ -179,7 +179,7 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="contentTypeAlias">Alias of the <see cref="IContentType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the content</param>
|
||||
/// <returns><see cref="IContent"/></returns>
|
||||
IContent CreateContent(string name, Guid parentId, string contentTypeAlias, int userId = 0);
|
||||
IContent CreateContent(string name, Guid parentId, string contentTypeAlias, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IContent"/> object using the alias of the <see cref="IContentType"/>
|
||||
@@ -644,7 +644,7 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="raiseEvents"></param>
|
||||
/// <returns>True if sorting succeeded, otherwise False</returns>
|
||||
bool Sort(IEnumerable<IContent> items, int userId = 0, bool raiseEvents = true);
|
||||
bool Sort(IEnumerable<IContent> items, int userId = 0, bool raiseEvents = true);
|
||||
|
||||
/// <summary>
|
||||
/// Sorts a collection of <see cref="IContent"/> objects by updating the SortOrder according
|
||||
@@ -704,4 +704,4 @@ namespace Umbraco.Core.Services
|
||||
/// <returns><see cref="IContent"/></returns>
|
||||
IContent CreateContentWithIdentity(string name, int parentId, string contentTypeAlias, int userId = 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Umbraco.Core.Models;
|
||||
@@ -22,13 +23,140 @@ namespace Umbraco.Core.Services
|
||||
// note - no need for uow, scope would be enough, but a pain to wire
|
||||
// note - for pure read-only we might want to *not* enforce a transaction?
|
||||
|
||||
// notes
|
||||
//
|
||||
// - this class assumes that the id/guid map is unique; that is, if an id and a guid map
|
||||
// to each other, then the id will never map to another guid, and the guid will never map
|
||||
// to another id
|
||||
//
|
||||
// - LeeK's solution in 7.7 was to look for the id/guid in the content cache "on demand" via
|
||||
// XPath, which is probably fast enough but cannot deal with media ids + it maintains a
|
||||
// separate, duplicate cache
|
||||
// see https://github.com/umbraco/Umbraco-CMS/pull/2398
|
||||
//
|
||||
// - Andy's solution in a package was to prefetch all by sql; it cannot prefecth reserved ids
|
||||
// as we don't know the corresponding object type, but that's not a big issue - but then we
|
||||
// have a full database query on startup
|
||||
// see https://github.com/AndyButland/UmbracoUdiToIdCache
|
||||
//
|
||||
// - the original IdkMap implementation that was used by services, did a database lookup on
|
||||
// each cache miss, which is fine enough for services, but would be really slow at content
|
||||
// cache level
|
||||
//
|
||||
// - cache is cleared by MediaCacheRefresher, UnpublishedPageCacheRefresher, and other
|
||||
// refreshers - because id/guid map is unique, we only clear to avoid leaking memory, 'cos
|
||||
// we don't risk caching obsolete values - and only when actually deleting
|
||||
//
|
||||
// so...
|
||||
//
|
||||
// - there's a single caching point, and it's idkMap
|
||||
// - there are no "helper methods" - the published content cache itself knows about Guids
|
||||
// - when the published content cache is instanciated, it populates the idkMap with what it knows
|
||||
// and it registers a way for the idkMap to look for id/keys in the published content cache
|
||||
// - we do NOT prefetch anything from database
|
||||
// - when a request comes in:
|
||||
// the published content cache uses the idkMap to map id/key
|
||||
// if the idkMap already knows about the map, it returns the value
|
||||
// else it tries the published cache via XPath
|
||||
// else it hits the database
|
||||
|
||||
|
||||
private readonly ConcurrentDictionary<UmbracoObjectTypes, (Func<int, Guid> id2key, Func<Guid, int> key2id)> _dictionary
|
||||
= new ConcurrentDictionary<UmbracoObjectTypes, (Func<int, Guid> id2key, Func<Guid, int> key2id)>();
|
||||
|
||||
internal void SetMapper(UmbracoObjectTypes umbracoObjectType, Func<int, Guid> id2key, Func<Guid, int> key2id)
|
||||
{
|
||||
_dictionary[umbracoObjectType] = (id2key, key2id);
|
||||
}
|
||||
|
||||
internal void Populate(IEnumerable<(int id, Guid key)> pairs, UmbracoObjectTypes umbracoObjectType)
|
||||
{
|
||||
try
|
||||
{
|
||||
_locker.EnterWriteLock();
|
||||
foreach (var pair in pairs)
|
||||
{
|
||||
|
||||
_id2Key[pair.id] = new TypedId<Guid>(pair.key, umbracoObjectType);
|
||||
_key2Id[pair.key] = new TypedId<int>(pair.id, umbracoObjectType);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (_locker.IsWriteLockHeld)
|
||||
_locker.ExitWriteLock();
|
||||
}
|
||||
}
|
||||
|
||||
#if POPULATE_FROM_DATABASE
|
||||
private void PopulateLocked()
|
||||
{
|
||||
// don't if not empty
|
||||
if (_key2Id.Count > 0) return;
|
||||
|
||||
using (var uow = _uowProvider.GetUnitOfWork())
|
||||
{
|
||||
// populate content and media items
|
||||
var types = new[] { Constants.ObjectTypes.Document, Constants.ObjectTypes.Media };
|
||||
var values = uow.Database.Query<TypedIdDto>("SELECT id, uniqueId, nodeObjectType FROM umbracoNode WHERE nodeObjectType IN @types", new { types });
|
||||
foreach (var value in values)
|
||||
{
|
||||
var umbracoObjectType = UmbracoObjectTypesExtensions.GetUmbracoObjectType(value.NodeObjectType);
|
||||
_id2Key.Add(value.Id, new TypedId<Guid>(value.UniqueId, umbracoObjectType));
|
||||
_key2Id.Add(value.UniqueId, new TypedId<int>(value.Id, umbracoObjectType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Attempt<int> PopulateAndGetIdForKey(Guid key, UmbracoObjectTypes umbracoObjectType)
|
||||
{
|
||||
try
|
||||
{
|
||||
_locker.EnterWriteLock();
|
||||
|
||||
PopulateLocked();
|
||||
|
||||
return _key2Id.TryGetValue(key, out var id) && id.UmbracoObjectType == umbracoObjectType
|
||||
? Attempt.Succeed(id.Id)
|
||||
: Attempt<int>.Fail();
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (_locker.IsReadLockHeld)
|
||||
_locker.ExitReadLock();
|
||||
}
|
||||
}
|
||||
|
||||
private Attempt<Guid> PopulateAndGetKeyForId(int id, UmbracoObjectTypes umbracoObjectType)
|
||||
{
|
||||
try
|
||||
{
|
||||
_locker.EnterWriteLock();
|
||||
|
||||
PopulateLocked();
|
||||
|
||||
return _id2Key.TryGetValue(id, out var key) && key.UmbracoObjectType == umbracoObjectType
|
||||
? Attempt.Succeed(key.Id)
|
||||
: Attempt<Guid>.Fail();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (_locker.IsReadLockHeld)
|
||||
_locker.ExitReadLock();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public Attempt<int> GetIdForKey(Guid key, UmbracoObjectTypes umbracoObjectType)
|
||||
{
|
||||
TypedId<int> id;
|
||||
bool empty;
|
||||
|
||||
try
|
||||
{
|
||||
_locker.EnterReadLock();
|
||||
if (_key2Id.TryGetValue(key, out id) && id.UmbracoObjectType == umbracoObjectType) return Attempt.Succeed(id.Id);
|
||||
if (_key2Id.TryGetValue(key, out var id) && id.UmbracoObjectType == umbracoObjectType) return Attempt.Succeed(id.Id);
|
||||
empty = _key2Id.Count == 0;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -36,20 +164,37 @@ namespace Umbraco.Core.Services
|
||||
_locker.ExitReadLock();
|
||||
}
|
||||
|
||||
int? val;
|
||||
using (var uow = _uowProvider.GetUnitOfWork())
|
||||
#if POPULATE_FROM_DATABASE
|
||||
// if cache is empty and looking for a document or a media,
|
||||
// populate the cache at once and return what we found
|
||||
if (empty && (umbracoObjectType == UmbracoObjectTypes.Document || umbracoObjectType == UmbracoObjectTypes.Media))
|
||||
return PopulateAndGetIdForKey(key, umbracoObjectType);
|
||||
#endif
|
||||
|
||||
// optimize for read speed: reading database outside a lock means that we could read
|
||||
// multiple times, but we don't lock the cache while accessing the database = better
|
||||
|
||||
int? val = null;
|
||||
|
||||
if (_dictionary.TryGetValue(umbracoObjectType, out var mappers))
|
||||
if ((val = mappers.key2id(key)) == default(int)) val = null;
|
||||
|
||||
if (val == null)
|
||||
{
|
||||
//if it's unknown don't include the nodeObjectType in the query
|
||||
if (umbracoObjectType == UmbracoObjectTypes.Unknown)
|
||||
using (var uow = _uowProvider.GetUnitOfWork())
|
||||
{
|
||||
val = uow.Database.ExecuteScalar<int?>("SELECT id FROM umbracoNode WHERE uniqueId=@id", new { id = key});
|
||||
//if it's unknown don't include the nodeObjectType in the query
|
||||
if (umbracoObjectType == UmbracoObjectTypes.Unknown)
|
||||
{
|
||||
val = uow.Database.ExecuteScalar<int?>("SELECT id FROM umbracoNode WHERE uniqueId=@id", new { id = key});
|
||||
}
|
||||
else
|
||||
{
|
||||
val = uow.Database.ExecuteScalar<int?>("SELECT id FROM umbracoNode WHERE uniqueId=@id AND (nodeObjectType=@type OR nodeObjectType=@reservation)",
|
||||
new { id = key, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservationGuid });
|
||||
}
|
||||
uow.Commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
val = uow.Database.ExecuteScalar<int?>("SELECT id FROM umbracoNode WHERE uniqueId=@id AND (nodeObjectType=@type OR nodeObjectType=@reservation)",
|
||||
new { id = key, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservationGuid });
|
||||
}
|
||||
uow.Commit();
|
||||
}
|
||||
|
||||
if (val == null) return Attempt<int>.Fail();
|
||||
@@ -83,13 +228,23 @@ namespace Umbraco.Core.Services
|
||||
return GetIdForKey(guidUdi.Guid, umbracoType);
|
||||
}
|
||||
|
||||
public Attempt<Udi> GetUdiForId(int id, UmbracoObjectTypes umbracoObjectType)
|
||||
{
|
||||
var keyAttempt = GetKeyForId(id, umbracoObjectType);
|
||||
return keyAttempt
|
||||
? Attempt.Succeed<Udi>(new GuidUdi(Constants.UdiEntityType.FromUmbracoObjectType(umbracoObjectType), keyAttempt.Result))
|
||||
: Attempt<Udi>.Fail();
|
||||
}
|
||||
|
||||
public Attempt<Guid> GetKeyForId(int id, UmbracoObjectTypes umbracoObjectType)
|
||||
{
|
||||
TypedId<Guid> key;
|
||||
bool empty;
|
||||
|
||||
try
|
||||
{
|
||||
_locker.EnterReadLock();
|
||||
if (_id2Key.TryGetValue(id, out key) && key.UmbracoObjectType == umbracoObjectType) return Attempt.Succeed(key.Id);
|
||||
if (_id2Key.TryGetValue(id, out var key) && key.UmbracoObjectType == umbracoObjectType) return Attempt.Succeed(key.Id);
|
||||
empty = _id2Key.Count == 0;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -97,20 +252,37 @@ namespace Umbraco.Core.Services
|
||||
_locker.ExitReadLock();
|
||||
}
|
||||
|
||||
Guid? val;
|
||||
using (var uow = _uowProvider.GetUnitOfWork())
|
||||
#if POPULATE_FROM_DATABASE
|
||||
// if cache is empty and looking for a document or a media,
|
||||
// populate the cache at once and return what we found
|
||||
if (empty && (umbracoObjectType == UmbracoObjectTypes.Document || umbracoObjectType == UmbracoObjectTypes.Media))
|
||||
return PopulateAndGetKeyForId(id, umbracoObjectType);
|
||||
#endif
|
||||
|
||||
// optimize for read speed: reading database outside a lock means that we could read
|
||||
// multiple times, but we don't lock the cache while accessing the database = better
|
||||
|
||||
Guid? val = null;
|
||||
|
||||
if (_dictionary.TryGetValue(umbracoObjectType, out var mappers))
|
||||
if ((val = mappers.id2key(id)) == default(Guid)) val = null;
|
||||
|
||||
if (val == null)
|
||||
{
|
||||
//if it's unknown don't include the nodeObjectType in the query
|
||||
if (umbracoObjectType == UmbracoObjectTypes.Unknown)
|
||||
using (var uow = _uowProvider.GetUnitOfWork())
|
||||
{
|
||||
val = uow.Database.ExecuteScalar<Guid?>("SELECT uniqueId FROM umbracoNode WHERE id=@id", new { id });
|
||||
//if it's unknown don't include the nodeObjectType in the query
|
||||
if (umbracoObjectType == UmbracoObjectTypes.Unknown)
|
||||
{
|
||||
val = uow.Database.ExecuteScalar<Guid?>("SELECT uniqueId FROM umbracoNode WHERE id=@id", new { id });
|
||||
}
|
||||
else
|
||||
{
|
||||
val = uow.Database.ExecuteScalar<Guid?>("SELECT uniqueId FROM umbracoNode WHERE id=@id AND (nodeObjectType=@type OR nodeObjectType=@reservation)",
|
||||
new { id, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservationGuid });
|
||||
}
|
||||
uow.Commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
val = uow.Database.ExecuteScalar<Guid?>("SELECT uniqueId FROM umbracoNode WHERE id=@id AND (nodeObjectType=@type OR nodeObjectType=@reservation)",
|
||||
new { id, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservationGuid });
|
||||
}
|
||||
uow.Commit();
|
||||
}
|
||||
|
||||
if (val == null) return Attempt<Guid>.Fail();
|
||||
@@ -142,6 +314,8 @@ namespace Umbraco.Core.Services
|
||||
return guid;
|
||||
}
|
||||
|
||||
// invoked on UnpublishedPageCacheRefresher.RefreshAll
|
||||
// anything else will use the id-specific overloads
|
||||
public void ClearCache()
|
||||
{
|
||||
try
|
||||
@@ -162,8 +336,7 @@ namespace Umbraco.Core.Services
|
||||
try
|
||||
{
|
||||
_locker.EnterWriteLock();
|
||||
TypedId<Guid> key;
|
||||
if (_id2Key.TryGetValue(id, out key) == false) return;
|
||||
if (_id2Key.TryGetValue(id, out var key) == false) return;
|
||||
_id2Key.Remove(id);
|
||||
_key2Id.Remove(key.Id);
|
||||
}
|
||||
@@ -179,8 +352,7 @@ namespace Umbraco.Core.Services
|
||||
try
|
||||
{
|
||||
_locker.EnterWriteLock();
|
||||
TypedId<int> id;
|
||||
if (_key2Id.TryGetValue(key, out id) == false) return;
|
||||
if (_key2Id.TryGetValue(key, out var id) == false) return;
|
||||
_id2Key.Remove(id.Id);
|
||||
_key2Id.Remove(key);
|
||||
}
|
||||
@@ -191,26 +363,28 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
// ReSharper disable ClassNeverInstantiated.Local
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Local
|
||||
private class TypedIdDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Guid UniqueId { get; set; }
|
||||
public Guid NodeObjectType { get; set; }
|
||||
}
|
||||
// ReSharper restore ClassNeverInstantiated.Local
|
||||
// ReSharper restore UnusedAutoPropertyAccessor.Local
|
||||
|
||||
private struct TypedId<T>
|
||||
{
|
||||
private readonly T _id;
|
||||
private readonly UmbracoObjectTypes _umbracoObjectType;
|
||||
|
||||
public T Id
|
||||
{
|
||||
get { return _id; }
|
||||
}
|
||||
|
||||
public UmbracoObjectTypes UmbracoObjectType
|
||||
{
|
||||
get { return _umbracoObjectType; }
|
||||
}
|
||||
|
||||
public TypedId(T id, UmbracoObjectTypes umbracoObjectType)
|
||||
{
|
||||
_umbracoObjectType = umbracoObjectType;
|
||||
_id = id;
|
||||
UmbracoObjectType = umbracoObjectType;
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public UmbracoObjectTypes UmbracoObjectType { get; }
|
||||
|
||||
public T Id { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,13 +89,11 @@ namespace Umbraco.Core.Services
|
||||
/// <returns></returns>
|
||||
public string FetchPackageFile(Guid packageId, Version umbracoVersion, int userId)
|
||||
{
|
||||
var packageRepo = UmbracoConfig.For.UmbracoSettings().PackageRepositories.GetDefault();
|
||||
|
||||
using (var httpClient = new HttpClient())
|
||||
using (var uow = _uowProvider.GetUnitOfWork())
|
||||
{
|
||||
//includeHidden = true because we don't care if it's hidden we want to get the file regardless
|
||||
var url = string.Format("{0}/{1}?version={2}&includeHidden=true&asFile=true", packageRepo.RestApiUrl, packageId, umbracoVersion.ToString(3));
|
||||
var url = string.Format("{0}/{1}?version={2}&includeHidden=true&asFile=true", Constants.PackageRepository.RestApiBaseUrl, packageId, umbracoVersion.ToString(3));
|
||||
byte[] bytes;
|
||||
try
|
||||
{
|
||||
@@ -124,7 +122,7 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
Audit(uow, AuditType.PackagerInstall, string.Format("Package {0} fetched from {1}", packageId, packageRepo.Id), userId, -1);
|
||||
Audit(uow, AuditType.PackagerInstall, string.Format("Package {0} fetched from {1}", packageId, Constants.PackageRepository.DefaultRepositoryId), userId, -1);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,20 +207,17 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
return repository.GetByUsername(username, includeSecurityData: true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (DbException ex)
|
||||
{
|
||||
if (ex is SqlException || ex is SqlCeException)
|
||||
//we need to handle this one specific case which is when we are upgrading to 7.7 since the user group
|
||||
//tables don't exist yet. This is the 'easiest' way to deal with this without having to create special
|
||||
//version checks in the BackOfficeSignInManager and calling into other special overloads that we'd need
|
||||
//like "GetUserById(int id, bool includeSecurityData)" which may cause confusion because the result of
|
||||
//that method would not be cached.
|
||||
if (ApplicationContext.Current.IsUpgrading)
|
||||
{
|
||||
//we need to handle this one specific case which is when we are upgrading to 7.7 since the user group
|
||||
//tables don't exist yet. This is the 'easiest' way to deal with this without having to create special
|
||||
//version checks in the BackOfficeSignInManager and calling into other special overloads that we'd need
|
||||
//like "GetUserById(int id, bool includeSecurityData)" which may cause confusion because the result of
|
||||
//that method would not be cached.
|
||||
if (ApplicationContext.Current.IsUpgrading)
|
||||
{
|
||||
//NOTE: this will not be cached
|
||||
return repository.GetByUsername(username, includeSecurityData: false);
|
||||
}
|
||||
//NOTE: this will not be cached
|
||||
return repository.GetByUsername(username, includeSecurityData: false);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
@@ -789,20 +786,17 @@ namespace Umbraco.Core.Services
|
||||
var result = repository.Get(id);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (DbException ex)
|
||||
{
|
||||
if (ex is SqlException || ex is SqlCeException)
|
||||
//we need to handle this one specific case which is when we are upgrading to 7.7 since the user group
|
||||
//tables don't exist yet. This is the 'easiest' way to deal with this without having to create special
|
||||
//version checks in the BackOfficeSignInManager and calling into other special overloads that we'd need
|
||||
//like "GetUserById(int id, bool includeSecurityData)" which may cause confusion because the result of
|
||||
//that method would not be cached.
|
||||
if (ApplicationContext.Current.IsUpgrading)
|
||||
{
|
||||
//we need to handle this one specific case which is when we are upgrading to 7.7 since the user group
|
||||
//tables don't exist yet. This is the 'easiest' way to deal with this without having to create special
|
||||
//version checks in the BackOfficeSignInManager and calling into other special overloads that we'd need
|
||||
//like "GetUserById(int id, bool includeSecurityData)" which may cause confusion because the result of
|
||||
//that method would not be cached.
|
||||
if (ApplicationContext.Current.IsUpgrading)
|
||||
{
|
||||
//NOTE: this will not be cached
|
||||
return repository.Get(id, includeSecurityData: false);
|
||||
}
|
||||
//NOTE: this will not be cached
|
||||
return repository.Get(id, includeSecurityData: false);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
|
||||
@@ -8,14 +8,12 @@ using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Configuration;
|
||||
using System.Web.Security;
|
||||
using Umbraco.Core.Strings;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.CodeAnnotations;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Strings;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
@@ -121,8 +119,8 @@ namespace Umbraco.Core
|
||||
//if the resolution was success, return it, otherwise just return the path, we've detected
|
||||
// it's a path but maybe it's relative and resolution has failed, etc... in which case we're just
|
||||
// returning what was given to us.
|
||||
return resolvedUrlResult.Success
|
||||
? resolvedUrlResult
|
||||
return resolvedUrlResult.Success
|
||||
? resolvedUrlResult
|
||||
: Attempt.Succeed(input);
|
||||
}
|
||||
}
|
||||
@@ -144,7 +142,7 @@ namespace Umbraco.Core
|
||||
}
|
||||
|
||||
internal static readonly Regex Whitespace = new Regex(@"\s+", RegexOptions.Compiled);
|
||||
internal static readonly string[] JsonEmpties = new [] { "[]", "{}" };
|
||||
internal static readonly string[] JsonEmpties = new[] { "[]", "{}" };
|
||||
internal static bool DetectIsEmptyJson(this string input)
|
||||
{
|
||||
return JsonEmpties.Contains(Whitespace.Replace(input, string.Empty));
|
||||
@@ -472,13 +470,13 @@ namespace Umbraco.Core
|
||||
return ch.ToString(CultureInfo.InvariantCulture) == ch.ToString(CultureInfo.InvariantCulture).ToUpperInvariant();
|
||||
}
|
||||
|
||||
/// <summary>Is null or white space.</summary>
|
||||
/// <param name="str">The str.</param>
|
||||
/// <returns>The is null or white space.</returns>
|
||||
public static bool IsNullOrWhiteSpace(this string str)
|
||||
{
|
||||
return (str == null) || (str.Trim().Length == 0);
|
||||
}
|
||||
/// <summary>Indicates whether a specified string is null, empty, or
|
||||
/// consists only of white-space characters.</summary>
|
||||
/// <param name="value">The value to check.</param>
|
||||
/// <returns>Returns <see langword="true"/> if the value is null,
|
||||
/// empty, or consists only of white-space characters, otherwise
|
||||
/// returns <see langword="false"/>.</returns>
|
||||
public static bool IsNullOrWhiteSpace(this string value) => string.IsNullOrWhiteSpace(value);
|
||||
|
||||
public static string IfNullOrWhiteSpace(this string str, string defaultValue)
|
||||
{
|
||||
@@ -1436,14 +1434,25 @@ namespace Umbraco.Core
|
||||
return ReplaceMany(text, regexSpecialCharacters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether a string "haystack" contains within it any of the strings in the "needles" collection and returns true if it does or false if it doesn't
|
||||
/// </summary>
|
||||
/// <param name="haystack">The string to check</param>
|
||||
/// <param name="needles">The collection of strings to check are contained within the first string</param>
|
||||
/// <param name="comparison">The type of comparision to perform - defaults to <see cref="StringComparison.CurrentCulture"/></param>
|
||||
/// <returns>True if any of the needles are contained with haystack; otherwise returns false</returns>
|
||||
/// Added fix to ensure the comparison is used - see http://issues.umbraco.org/issue/U4-11313
|
||||
public static bool ContainsAny(this string haystack, IEnumerable<string> needles, StringComparison comparison = StringComparison.CurrentCulture)
|
||||
{
|
||||
if (haystack == null) throw new ArgumentNullException("haystack");
|
||||
if (string.IsNullOrEmpty(haystack) == false || needles.Any())
|
||||
if (haystack == null)
|
||||
throw new ArgumentNullException("haystack");
|
||||
|
||||
if (string.IsNullOrEmpty(haystack) || needles == null || !needles.Any())
|
||||
{
|
||||
return needles.Any(value => haystack.IndexOf(value) >= 0);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
return needles.Any(value => haystack.IndexOf(value, comparison) >= 0);
|
||||
}
|
||||
|
||||
public static bool CsvContains(this string csv, string value)
|
||||
|
||||
@@ -115,6 +115,9 @@
|
||||
<Reference Include="System.Runtime.Caching" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
@@ -278,8 +281,6 @@
|
||||
<Compile Include="Configuration\UmbracoSettings\INotDynamicXmlDocument.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IProvidersSection.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IRazorStaticMapping.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IRepositoriesSection.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IRepository.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IRequestHandlerSection.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IScheduledTask.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IScheduledTasksSection.cs" />
|
||||
@@ -305,10 +306,6 @@
|
||||
<Compile Include="Configuration\UmbracoSettings\RazorElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RazorStaticMappingCollection.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RazorStaticMappingElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RepositoriesCollection.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RepositoriesElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RepositoryConfigExtensions.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RepositoryElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RequestHandlerElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\ScheduledTaskElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\ScheduledTasksCollection.cs" />
|
||||
@@ -603,6 +600,7 @@
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\NormalizeTemplateGuids.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\RemovePropertyDataIdIndex.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\RemoveUmbracoDeployTables.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenTenZero\RenamePreviewFolder.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeTwo\EnsureMigrationsTableIdentityIsCorrect.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenFourZero\EnsureContentTypeUniqueIdsAreConsistent.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeZero\AddExternalLoginsTable.cs" />
|
||||
@@ -1602,6 +1600,9 @@
|
||||
<Compile Include="Constants-Packaging.cs">
|
||||
<DependentUpon>Constants.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Constants-PackageRepository.cs">
|
||||
<DependentUpon>Constants.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Constants-ObjectTypes.cs">
|
||||
<DependentUpon>Constants.cs</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@@ -18,4 +18,5 @@
|
||||
<package id="Owin" version="1.0" targetFramework="net45" />
|
||||
<package id="semver" version="1.1.2" targetFramework="net45" />
|
||||
<package id="SqlServerCE" version="4.0.0.1" targetFramework="net45" />
|
||||
<package id="System.ValueTuple" version="4.4.0" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -139,8 +139,8 @@
|
||||
<Reference Include="System.Threading.Thread, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Thread.4.3.0\lib\net46\System.Threading.Thread.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
|
||||
@@ -62,6 +62,10 @@
|
||||
<assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -51,7 +51,7 @@
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.3.0" targetFramework="net46" />
|
||||
<package id="System.Threading.Tasks.Parallel" version="4.3.0" targetFramework="net46" />
|
||||
<package id="System.Threading.Thread" version="4.3.0" targetFramework="net46" />
|
||||
<package id="System.ValueTuple" version="4.3.0" targetFramework="net46" />
|
||||
<package id="System.ValueTuple" version="4.4.0" targetFramework="net46" />
|
||||
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net46" />
|
||||
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net46" />
|
||||
<package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="net46" />
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class PackageRepositoriesElementDefaultTests : PackageRepositoriesElementTests
|
||||
{
|
||||
protected override bool TestingDefaults
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
[Test]
|
||||
public override void Repositories()
|
||||
{
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.Count() == 1);
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).Id == Guid.Parse("65194810-1f85-11dd-bd0b-0800200c9a66"));
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).Name == "Umbraco package Repository");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class PackageRepositoriesElementTests : UmbracoSettingsTests
|
||||
{
|
||||
[Test]
|
||||
public virtual void Repositories()
|
||||
{
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.Count() == 2);
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).Id == Guid.Parse("65194810-1f85-11dd-bd0b-0800200c9a66"));
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).Name == "Umbraco package Repository");
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).HasCustomWebServiceUrl == false);
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).WebServiceUrl == "/umbraco/webservices/api/repository.asmx");
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).RepositoryUrl == "http://packages.umbraco.org");
|
||||
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(1).Id == Guid.Parse("163245E0-CD22-44B6-841A-1B9B9D2E955F"));
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(1).Name == "Test Repo");
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(1).HasCustomWebServiceUrl == false);
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).WebServiceUrl == "/umbraco/webservices/api/repository.asmx");
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).RepositoryUrl == "http://packages.umbraco.org");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,13 +222,6 @@
|
||||
</servers>
|
||||
</distributedCall>
|
||||
|
||||
<!-- Configuration for repositories -->
|
||||
<!-- Add or remove repositories here. You will need the repository's unique key to be able to connect to it.-->
|
||||
<repositories>
|
||||
<repository name="Umbraco package Repository" guid="65194810-1f85-11dd-bd0b-0800200c9a66" />
|
||||
<repository name="Test Repo" guid="163245E0-CD22-44B6-841A-1B9B9D2E955F" />
|
||||
</repositories>
|
||||
|
||||
<providers>
|
||||
<users>
|
||||
<!-- if you wish to use your own membershipprovider for authenticating to the umbraco back office -->
|
||||
@@ -256,4 +249,4 @@
|
||||
internalRedirectPreservesTemplate="false">
|
||||
</web.routing>
|
||||
|
||||
</settings>
|
||||
</settings>
|
||||
|
||||
@@ -60,9 +60,6 @@
|
||||
<!-- http://our.umbraco.org/documentation/using-umbraco/config-files/umbracoSettings/#DistributedCallsLoadbalancing -->
|
||||
<distributedCall/>
|
||||
|
||||
<!-- http://our.umbraco.org/documentation/using-umbraco/config-files/umbracoSettings/#Repositories -->
|
||||
<repositories/>
|
||||
|
||||
<!-- http://our.umbraco.org/documentation/using-umbraco/config-files/umbracoSettings/#Providers -->
|
||||
<providers/>
|
||||
|
||||
@@ -72,4 +69,4 @@
|
||||
<!-- http://our.umbraco.org/documentation/using-umbraco/config-files/umbracoSettings/#WebRouting -->
|
||||
<web.routing/>
|
||||
|
||||
</defaultSettings>
|
||||
</defaultSettings>
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Umbraco.Tests.Persistence.Migrations
|
||||
conn.Setup(x => x.BeginTransaction(It.IsAny<IsolationLevel>())).Returns(Mock.Of<IDbTransaction>());
|
||||
var db = new Mock<Database>(conn.Object);
|
||||
|
||||
var runner1 = new MigrationRunner(Mock.Of<IMigrationEntryService>(), Mock.Of<ILogger>(), new SemVersion(1), new SemVersion(2), "Test1",
|
||||
var runner1 = new MigrationRunner(Mock.Of<IMigrationEntryService>(), Mock.Of<ILogger>(), new SemVersion(2), new SemVersion(1), "Test1",
|
||||
new IMigration[] { Mock.Of<IMigration>() });
|
||||
var result1 = runner1.Execute(db.Object, DatabaseProviders.SqlServerCE, false);
|
||||
Assert.AreEqual(1, changed1.CountExecuted);
|
||||
@@ -52,13 +52,13 @@ namespace Umbraco.Tests.Persistence.Migrations
|
||||
conn.Setup(x => x.BeginTransaction(It.IsAny<IsolationLevel>())).Returns(Mock.Of<IDbTransaction>());
|
||||
var db = new Mock<Database>(conn.Object);
|
||||
|
||||
var runner1 = new MigrationRunner(Mock.Of<IMigrationEntryService>(), Mock.Of<ILogger>(), new SemVersion(1), new SemVersion(2), "Test1",
|
||||
var runner1 = new MigrationRunner(Mock.Of<IMigrationEntryService>(), Mock.Of<ILogger>(), new SemVersion(2), new SemVersion(1), "Test1",
|
||||
new IMigration[] { Mock.Of<IMigration>()});
|
||||
var result1 = runner1.Execute(db.Object, DatabaseProviders.SqlServerCE, false);
|
||||
Assert.AreEqual(1, changed1.CountExecuted);
|
||||
Assert.AreEqual(0, changed2.CountExecuted);
|
||||
|
||||
var runner2 = new MigrationRunner(Mock.Of<IMigrationEntryService>(), Mock.Of<ILogger>(), new SemVersion(1), new SemVersion(2), "Test2",
|
||||
var runner2 = new MigrationRunner(Mock.Of<IMigrationEntryService>(), Mock.Of<ILogger>(), new SemVersion(2), new SemVersion(1), "Test2",
|
||||
new IMigration[] { Mock.Of<IMigration>() });
|
||||
var result2 = runner2.Execute(db.Object, DatabaseProviders.SqlServerCE, false);
|
||||
Assert.AreEqual(1, changed1.CountExecuted);
|
||||
|
||||
@@ -285,8 +285,7 @@ AnotherContentFinder
|
||||
public void Resolves_Attributed_Trees()
|
||||
{
|
||||
var trees = _manager.ResolveAttributedTrees();
|
||||
// commit 6c5e35ec2cbfa31be6790d1228e0c2faf5f55bc8 brings the count down to 14
|
||||
Assert.AreEqual(6, trees.Count());
|
||||
Assert.AreEqual(5, trees.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -300,7 +299,7 @@ AnotherContentFinder
|
||||
public void Resolves_Trees()
|
||||
{
|
||||
var trees = _manager.ResolveTrees();
|
||||
Assert.AreEqual(35, trees.Count());
|
||||
Assert.AreEqual(33, trees.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using NUnit.Framework;
|
||||
@@ -11,20 +12,20 @@ namespace Umbraco.Tests.Strings
|
||||
[TestFixture]
|
||||
public class StringExtensionsTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
ShortStringHelperResolver.Reset();
|
||||
ShortStringHelperResolver.Current = new ShortStringHelperResolver(new MockShortStringHelper());
|
||||
Resolution.Freeze();
|
||||
}
|
||||
Resolution.Freeze();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
ShortStringHelperResolver.Reset();
|
||||
}
|
||||
|
||||
|
||||
[TestCase("hello", "world", false)]
|
||||
[TestCase("hello", "hello", true)]
|
||||
[TestCase("hellohellohellohellohellohellohello", "hellohellohellohellohellohellohelloo", false)]
|
||||
@@ -53,43 +54,43 @@ namespace Umbraco.Tests.Strings
|
||||
[TestCase("hello.txt", "hello")]
|
||||
[TestCase("this.is.a.Txt", "this.is.a")]
|
||||
[TestCase("this.is.not.a. Txt", "this.is.not.a. Txt")]
|
||||
[TestCase("not a file","not a file")]
|
||||
[TestCase("not a file", "not a file")]
|
||||
public void Strip_File_Extension(string input, string result)
|
||||
{
|
||||
var stripped = input.StripFileExtension();
|
||||
Assert.AreEqual(stripped, result);
|
||||
}
|
||||
|
||||
[TestCase("This is a string to encrypt")]
|
||||
[TestCase("This is a string to encrypt\nThis is a second line")]
|
||||
[TestCase(" White space is preserved ")]
|
||||
[TestCase("\nWhite space is preserved\n")]
|
||||
public void Encrypt_And_Decrypt(string input)
|
||||
{
|
||||
var encrypted = input.EncryptWithMachineKey();
|
||||
var decrypted = encrypted.DecryptWithMachineKey();
|
||||
Assert.AreNotEqual(input, encrypted);
|
||||
Assert.AreEqual(input, decrypted);
|
||||
}
|
||||
[TestCase("This is a string to encrypt")]
|
||||
[TestCase("This is a string to encrypt\nThis is a second line")]
|
||||
[TestCase(" White space is preserved ")]
|
||||
[TestCase("\nWhite space is preserved\n")]
|
||||
public void Encrypt_And_Decrypt(string input)
|
||||
{
|
||||
var encrypted = input.EncryptWithMachineKey();
|
||||
var decrypted = encrypted.DecryptWithMachineKey();
|
||||
Assert.AreNotEqual(input, encrypted);
|
||||
Assert.AreEqual(input, decrypted);
|
||||
}
|
||||
|
||||
[Test()]
|
||||
public void Encrypt_And_Decrypt_Long_Value()
|
||||
{
|
||||
// Generate a really long string
|
||||
char[] chars = { 'a', 'b', 'c', '1', '2', '3', '\n' };
|
||||
[Test()]
|
||||
public void Encrypt_And_Decrypt_Long_Value()
|
||||
{
|
||||
// Generate a really long string
|
||||
char[] chars = { 'a', 'b', 'c', '1', '2', '3', '\n' };
|
||||
|
||||
string valueToTest = string.Empty;
|
||||
string valueToTest = string.Empty;
|
||||
|
||||
// Create a string 7035 chars long
|
||||
for (int i = 0; i < 1005; i++)
|
||||
for (int j = 0; j < chars.Length; j++)
|
||||
valueToTest += chars[j].ToString();
|
||||
// Create a string 7035 chars long
|
||||
for (int i = 0; i < 1005; i++)
|
||||
for (int j = 0; j < chars.Length; j++)
|
||||
valueToTest += chars[j].ToString();
|
||||
|
||||
var encrypted = valueToTest.EncryptWithMachineKey();
|
||||
var decrypted = encrypted.DecryptWithMachineKey();
|
||||
Assert.AreNotEqual(valueToTest, encrypted);
|
||||
Assert.AreEqual(valueToTest, decrypted);
|
||||
}
|
||||
var encrypted = valueToTest.EncryptWithMachineKey();
|
||||
var decrypted = encrypted.DecryptWithMachineKey();
|
||||
Assert.AreNotEqual(valueToTest, encrypted);
|
||||
Assert.AreEqual(valueToTest, decrypted);
|
||||
}
|
||||
|
||||
[TestCase("Hello this is my string", " string", "Hello this is my")]
|
||||
[TestCase("Hello this is my string strung", " string", "Hello this is my string strung")]
|
||||
@@ -147,6 +148,42 @@ namespace Umbraco.Tests.Strings
|
||||
Assert.AreEqual(expected, output);
|
||||
}
|
||||
|
||||
[TestCase("pineapple", new string[] { "banana", "apple", "blueberry", "strawberry" }, StringComparison.CurrentCulture, true)]
|
||||
[TestCase("PINEAPPLE", new string[] { "banana", "apple", "blueberry", "strawberry" }, StringComparison.CurrentCulture, false)]
|
||||
[TestCase("pineapple", new string[] { "banana", "Apple", "blueberry", "strawberry" }, StringComparison.CurrentCulture, false)]
|
||||
[TestCase("pineapple", new string[] { "banana", "Apple", "blueberry", "strawberry" }, StringComparison.OrdinalIgnoreCase, true)]
|
||||
[TestCase("pineapple", new string[] { "banana", "blueberry", "strawberry" }, StringComparison.OrdinalIgnoreCase, false)]
|
||||
[TestCase("Strawberry unicorn pie", new string[] { "Berry" }, StringComparison.OrdinalIgnoreCase, true)]
|
||||
[TestCase("empty pie", new string[0], StringComparison.OrdinalIgnoreCase, false)]
|
||||
public void ContainsAny(string haystack, IEnumerable<string> needles, StringComparison comparison, bool expected)
|
||||
{
|
||||
bool output = haystack.ContainsAny(needles, comparison);
|
||||
Assert.AreEqual(expected, output);
|
||||
}
|
||||
|
||||
[TestCase("", true)]
|
||||
[TestCase(" ", true)]
|
||||
[TestCase("\r\n\r\n", true)]
|
||||
[TestCase("\r\n", true)]
|
||||
[TestCase(@"
|
||||
Hello
|
||||
", false)]
|
||||
[TestCase(null, true)]
|
||||
[TestCase("a", false)]
|
||||
[TestCase("abc", false)]
|
||||
[TestCase("abc ", false)]
|
||||
[TestCase(" abc", false)]
|
||||
[TestCase(" abc ", false)]
|
||||
public void IsNullOrWhiteSpace(string value, bool expected)
|
||||
{
|
||||
// Act
|
||||
bool result = value.IsNullOrWhiteSpace();
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(expected, result);
|
||||
}
|
||||
|
||||
|
||||
// FORMAT STRINGS
|
||||
|
||||
// note: here we just ensure that the proper helper gets called properly
|
||||
@@ -239,7 +276,7 @@ namespace Umbraco.Tests.Strings
|
||||
[Test]
|
||||
public void ReplaceManyByOneChar()
|
||||
{
|
||||
var output = "JUST-ANYTHING".ReplaceMany(new char[] {}, '*');
|
||||
var output = "JUST-ANYTHING".ReplaceMany(new char[] { }, '*');
|
||||
Assert.AreEqual("REPLACE-MANY-B::JUST-ANYTHING", output);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ namespace Umbraco.Tests.TestHelpers
|
||||
var logging = new Mock<ILoggingSection>();
|
||||
var tasks = new Mock<IScheduledTasksSection>();
|
||||
var distCall = new Mock<IDistributedCallSection>();
|
||||
var repos = new Mock<IRepositoriesSection>();
|
||||
var providers = new Mock<IProvidersSection>();
|
||||
|
||||
var routing = new Mock<IWebRoutingSection>();
|
||||
@@ -53,7 +52,6 @@ namespace Umbraco.Tests.TestHelpers
|
||||
settings.Setup(x => x.Logging).Returns(logging.Object);
|
||||
settings.Setup(x => x.ScheduledTasks).Returns(tasks.Object);
|
||||
settings.Setup(x => x.DistributedCall).Returns(distCall.Object);
|
||||
settings.Setup(x => x.PackageRepositories).Returns(repos.Object);
|
||||
settings.Setup(x => x.Providers).Returns(providers.Object);
|
||||
|
||||
settings.Setup(x => x.WebRouting).Returns(routing.Object);
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.UI;
|
||||
|
||||
@@ -361,8 +361,6 @@
|
||||
<Compile Include="Configurations\UmbracoSettings\DistributedCallElementTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\LoggingElementDefaultTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\LoggingElementTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\PackageRepositoriesElementDefaultTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\PackageRepositoriesElementTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\ProvidersElementDefaultTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\ProvidersElementTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\RequestHandlerElementDefaultTests.cs" />
|
||||
|
||||
@@ -429,9 +429,10 @@ Umbraco.</p>
|
||||
<CWS_NewsEventsList id="1155" parentID="1139" level="2" writerID="0" creatorID="0" nodeType="1126" template="1112" sortOrder="3" createDate="2009-02-27T09:57:30" updateDate="2010-04-22T02:18:31" nodeName="News and Events" urlName="news-and-events" writerName="Administrator" creatorName="Administrator" path="-1,1139,1155" isDoc="">
|
||||
<CWS_EventItem id="1156" parentID="1155" level="3" writerID="0" creatorID="0" nodeType="1122" template="1107" sortOrder="1" createDate="2009-02-27T10:00:53" updateDate="2010-04-22T02:18:31" nodeName="Codegarden 09" urlName="codegarden-09" writerName="Administrator" creatorName="Administrator" path="-1,1139,1155,1156" isDoc="">
|
||||
<eventDate>2009-06-22T00:00:00</eventDate>
|
||||
<bodyText><![CDATA[
|
||||
<h3>Come join the annual umbraco developer conference in Wonderful
|
||||
Copenhagen on June 22nd - 23rd. Two days for insights, eye-openers,
|
||||
<bodyText>
|
||||
<![CDATA[
|
||||
<h3>Come join the annual Umbraco developer conference in Wonderful
|
||||
Odense on May 22nd - 24th. Two days for insights, eye-openers,
|
||||
great conversations and friendly people.</h3>
|
||||
|
||||
<p>The who's who of umbraco will be gathered and share their
|
||||
@@ -441,8 +442,8 @@ huge industrial venue in central Copenhagen where we'll have one
|
||||
huge room, three rooms for breakout sessions and a Café that
|
||||
serves your taste of espresso.</p>
|
||||
|
||||
<p>Come join the annual umbraco developer conference in Wonderful
|
||||
Copenhagen on June 22nd - 23rd. Two days for insights, eye-openers,
|
||||
<p>Come join the annual Umbraco developer conference in Wonderful
|
||||
Odense on May 22nd - 24th. Two days for insights, eye-openers,
|
||||
great conversations and friendly people.</p>
|
||||
|
||||
<p>We've planned a program that fits both experienced umbraco users
|
||||
@@ -613,4 +614,4 @@ www.yourcompany.co.uk]]></emailMessageToFriend>
|
||||
<umbracoUrlAlias />
|
||||
<umbracoRedirect>0</umbracoRedirect>
|
||||
</CWS_Home>
|
||||
</root>
|
||||
</root>
|
||||
|
||||
@@ -1,605 +0,0 @@
|
||||
module.exports = function (grunt) {
|
||||
|
||||
|
||||
|
||||
// Default task.
|
||||
grunt.registerTask('default', ['jshint:dev', 'build', 'karma:unit']);
|
||||
grunt.registerTask('dev', ['jshint:dev', 'build-dev', 'webserver', 'open:dev', 'watch']);
|
||||
grunt.registerTask('docserve', ['docs:api', 'connect:docserver', 'open:docs', 'watch:docs']);
|
||||
grunt.registerTask('vs', ['jshint:dev', 'build-dev', 'watch']);
|
||||
|
||||
//TODO: Too much watching, this brings windows to it's knees when in dev mode
|
||||
//run by the watch task
|
||||
grunt.registerTask('watch-js', ['jshint:dev', 'concat', 'copy:app', 'copy:mocks', 'copy:canvasdesigner', 'copy:vs', 'karma:unit']);
|
||||
grunt.registerTask('watch-less', ['recess:build', 'recess:installer', 'recess:nonodes', 'recess:canvasdesigner', 'postcss', 'copy:canvasdesigner', 'copy:assets', 'copy:vs']);
|
||||
grunt.registerTask('watch-html', ['copy:views', 'copy:vs']);
|
||||
grunt.registerTask('watch-installer', ['concat:install', 'concat:installJs', 'copy:installer', 'copy:vs']);
|
||||
grunt.registerTask('watch-canvasdesigner', ['copy:canvasdesigner', 'concat:canvasdesignerJs', 'copy:vs']);
|
||||
grunt.registerTask('watch-test', ['jshint:dev', 'karma:unit']);
|
||||
|
||||
//triggered from grunt
|
||||
grunt.registerTask('build', ['concat', 'recess:build', 'recess:installer', 'recess:nonodes', 'recess:canvasdesigner', 'postcss', 'bower-install-simple', 'bower', 'copy', 'clean:post']);
|
||||
|
||||
//triggered from grunt dev vs or grunt vs
|
||||
grunt.registerTask('build-dev', ['clean:pre', 'concat', 'recess:build', 'recess:installer', 'recess:nonodes', 'postcss', 'bower-install-simple', 'bower', 'copy']);
|
||||
|
||||
//utillity tasks
|
||||
grunt.registerTask('docs', ['ngdocs']);
|
||||
grunt.registerTask('webserver', ['connect:devserver']);
|
||||
|
||||
|
||||
// Print a timestamp (useful for when watching)
|
||||
grunt.registerTask('timestamp', function () {
|
||||
grunt.log.subhead(Date());
|
||||
});
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
buildVersion: grunt.option('buildversion') || '7',
|
||||
connect: {
|
||||
devserver: {
|
||||
options: {
|
||||
port: 9990,
|
||||
hostname: '0.0.0.0',
|
||||
base: './build',
|
||||
middleware: function(connect, options) {
|
||||
return [
|
||||
//uncomment to enable CSP
|
||||
// util.csp(),
|
||||
//util.rewrite(),
|
||||
connect.favicon('images/favicon.ico'),
|
||||
connect.static(options.base),
|
||||
connect.directory(options.base)
|
||||
];
|
||||
}
|
||||
}
|
||||
},
|
||||
testserver: {},
|
||||
docserver: {
|
||||
options: {
|
||||
port: 8880,
|
||||
hostname: '0.0.0.0',
|
||||
base: './docs/api',
|
||||
middleware: function(connect, options) {
|
||||
return [
|
||||
//uncomment to enable CSP
|
||||
// util.csp(),
|
||||
//util.rewrite(),
|
||||
connect.static(options.base),
|
||||
connect.directory(options.base)
|
||||
];
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
open: {
|
||||
dev: {
|
||||
path: 'http://localhost:9990/belle/'
|
||||
},
|
||||
docs: {
|
||||
path: 'http://localhost:8880/index.html'
|
||||
}
|
||||
},
|
||||
|
||||
distdir: 'build/belle',
|
||||
vsdir: '../Umbraco.Web.UI/umbraco',
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
banner:
|
||||
'/*! <%= pkg.title || pkg.name %>\n' +
|
||||
'<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
|
||||
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>;\n' +
|
||||
' * Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n */\n',
|
||||
src: {
|
||||
js: ['src/**/*.js', 'src/*.js'],
|
||||
|
||||
common: ['src/common/**/*.js'],
|
||||
controllers: ['src/**/*.controller.js'],
|
||||
|
||||
specs: ['test/**/*.spec.js'],
|
||||
scenarios: ['test/**/*.scenario.js'],
|
||||
samples: ['sample files/*.js'],
|
||||
html: ['src/index.html', 'src/install.html'],
|
||||
|
||||
everything: ['src/**/*.*', 'test/**/*.*', 'docs/**/*.*'],
|
||||
|
||||
tpl: {
|
||||
app: ['src/views/**/*.html'],
|
||||
common: ['src/common/**/*.tpl.html']
|
||||
},
|
||||
less: ['src/less/belle.less'], // recess:build doesn't accept ** in its file patterns
|
||||
prod: ['<%= distdir %>/js/*.js']
|
||||
},
|
||||
|
||||
clean: {
|
||||
pre: ['<%= distdir %>/*'],
|
||||
post: ['<%= distdir %>/js/*.dev.js']
|
||||
},
|
||||
|
||||
copy: {
|
||||
assets: {
|
||||
files: [{ dest: '<%= distdir %>/assets', src: '**', expand: true, cwd: 'src/assets/' }]
|
||||
},
|
||||
|
||||
config: {
|
||||
files: [{ dest: '<%= distdir %>/../config', src: '**', expand: true, cwd: 'src/config/' }]
|
||||
},
|
||||
|
||||
installer: {
|
||||
files: [{ dest: '<%= distdir %>/views/install', src: '**/*.html', expand: true, cwd: 'src/installer/steps' }]
|
||||
},
|
||||
|
||||
canvasdesigner: {
|
||||
files: [
|
||||
{ dest: '<%= distdir %>/preview', src: '**/*.html', expand: true, cwd: 'src/canvasdesigner' },
|
||||
{ dest: '<%= distdir %>/preview/editors', src: '**/*.html', expand: true, cwd: 'src/canvasdesigner/editors' },
|
||||
{ dest: '<%= distdir %>/assets/less', src: '**/*.less', expand: true, cwd: 'src/canvasdesigner/editors' },
|
||||
{ dest: '<%= distdir %>/js', src: 'canvasdesigner.config.js', expand: true, cwd: 'src/canvasdesigner/config' },
|
||||
{ dest: '<%= distdir %>/js', src: 'canvasdesigner.palettes.js', expand: true, cwd: 'src/canvasdesigner/config' },
|
||||
{ dest: '<%= distdir %>/js', src: 'canvasdesigner.front.js', expand: true, cwd: 'src/canvasdesigner' }
|
||||
]
|
||||
},
|
||||
|
||||
vendor: {
|
||||
files: [{ dest: '<%= distdir %>/lib', src: '**', expand: true, cwd: 'lib/' }]
|
||||
},
|
||||
|
||||
views: {
|
||||
files: [{ dest: '<%= distdir %>/views', src: ['**/*.*', '!**/*.controller.js'], expand: true, cwd: 'src/views' }]
|
||||
},
|
||||
|
||||
app: {
|
||||
files: [
|
||||
{ dest: '<%= distdir %>/js', src: '*.js', expand: true, cwd: 'src/' }
|
||||
]
|
||||
},
|
||||
|
||||
mocks: {
|
||||
files: [{ dest: '<%= distdir %>/js', src: '*.js', expand: true, cwd: 'src/common/mocks/' }]
|
||||
},
|
||||
|
||||
vs: {
|
||||
files: [
|
||||
//everything except the index.html root file!
|
||||
//then we need to figure out how to not copy all the test stuff either!?
|
||||
{ dest: '<%= vsdir %>/assets', src: '**', expand: true, cwd: '<%= distdir %>/assets' },
|
||||
{ dest: '<%= vsdir %>/js', src: '**', expand: true, cwd: '<%= distdir %>/js' },
|
||||
{ dest: '<%= vsdir %>/views', src: '**', expand: true, cwd: '<%= distdir %>/views' },
|
||||
{ dest: '<%= vsdir %>/preview', src: '**', expand: true, cwd: '<%= distdir %>/preview' },
|
||||
{ dest: '<%= vsdir %>/lib', src: '**', expand: true, cwd: '<%= distdir %>/lib' }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
karma: {
|
||||
unit: { configFile: 'test/config/karma.conf.js', keepalive: true },
|
||||
e2e: { configFile: 'test/config/e2e.js', keepalive: true },
|
||||
watch: { configFile: 'test/config/unit.js', singleRun: false, autoWatch: true, keepalive: true }
|
||||
},
|
||||
|
||||
concat: {
|
||||
index: {
|
||||
src: ['src/index.html'],
|
||||
dest: '<%= distdir %>/index.html',
|
||||
options: {
|
||||
process: true
|
||||
}
|
||||
},
|
||||
install: {
|
||||
src: ['src/installer/installer.html'],
|
||||
dest: '<%= distdir %>/installer.html',
|
||||
options: {
|
||||
process: true
|
||||
}
|
||||
},
|
||||
|
||||
installJs: {
|
||||
src: ['src/installer/**/*.js'],
|
||||
dest: '<%= distdir %>/js/umbraco.installer.js',
|
||||
options: {
|
||||
banner: "<%= banner %>\n(function() { \n\n",
|
||||
footer: "\n\n})();"
|
||||
}
|
||||
},
|
||||
|
||||
canvasdesignerJs: {
|
||||
src: ['src/canvasdesigner/canvasdesigner.global.js', 'src/canvasdesigner/canvasdesigner.controller.js', 'src/canvasdesigner/editors/*.js', 'src/canvasdesigner/lib/*.js'],
|
||||
dest: '<%= distdir %>/js/canvasdesigner.panel.js'
|
||||
},
|
||||
|
||||
controllers: {
|
||||
src: ['src/controllers/**/*.controller.js', 'src/views/**/*.controller.js'],
|
||||
dest: '<%= distdir %>/js/umbraco.controllers.js',
|
||||
options: {
|
||||
banner: "<%= banner %>\n(function() { \n\n",
|
||||
footer: "\n\n})();"
|
||||
}
|
||||
},
|
||||
|
||||
services: {
|
||||
src: ['src/common/services/*.js'],
|
||||
dest: '<%= distdir %>/js/umbraco.services.js',
|
||||
options: {
|
||||
banner: "<%= banner %>\n(function() { \n\n",
|
||||
footer: "\n\n})();"
|
||||
}
|
||||
},
|
||||
|
||||
security: {
|
||||
src: ['src/common/security/*.js'],
|
||||
dest: '<%= distdir %>/js/umbraco.security.js',
|
||||
options: {
|
||||
banner: "<%= banner %>\n(function() { \n\n",
|
||||
footer: "\n\n})();"
|
||||
}
|
||||
},
|
||||
|
||||
resources: {
|
||||
src: ['src/common/resources/*.js'],
|
||||
dest: '<%= distdir %>/js/umbraco.resources.js',
|
||||
options: {
|
||||
banner: "<%= banner %>\n(function() { \n\n",
|
||||
footer: "\n\n})();"
|
||||
}
|
||||
},
|
||||
|
||||
testing: {
|
||||
src: ['src/common/mocks/*/*.js'],
|
||||
dest: '<%= distdir %>/js/umbraco.testing.js',
|
||||
options: {
|
||||
banner: "<%= banner %>\n(function() { \n\n",
|
||||
footer: "\n\n})();"
|
||||
}
|
||||
},
|
||||
|
||||
directives: {
|
||||
src: ['src/common/directives/**/*.js'],
|
||||
dest: '<%= distdir %>/js/umbraco.directives.js',
|
||||
options: {
|
||||
banner: "<%= banner %>\n(function() { \n\n",
|
||||
footer: "\n\n})();"
|
||||
}
|
||||
},
|
||||
|
||||
filters: {
|
||||
src: ['src/common/filters/*.js'],
|
||||
dest: '<%= distdir %>/js/umbraco.filters.js',
|
||||
options: {
|
||||
banner: "<%= banner %>\n(function() { \n\n",
|
||||
footer: "\n\n})();"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
uglify: {
|
||||
options: {
|
||||
mangle: true
|
||||
},
|
||||
combine: {
|
||||
files: {
|
||||
'<%= distdir %>/js/umbraco.min.js': ['<%= distdir %>/js/umbraco.*.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
recess: {
|
||||
build: {
|
||||
files: {
|
||||
'<%= distdir %>/assets/css/<%= pkg.name %>.css':
|
||||
['<%= src.less %>']
|
||||
},
|
||||
options: {
|
||||
compile: true,
|
||||
compress: true
|
||||
}
|
||||
},
|
||||
nonodes: {
|
||||
files: {
|
||||
'<%= distdir %>/assets/css/nonodes.style.min.css':
|
||||
['src/less/pages/nonodes.less']
|
||||
},
|
||||
options: {
|
||||
compile: true,
|
||||
compress: true
|
||||
}
|
||||
},
|
||||
installer: {
|
||||
files: {
|
||||
'<%= distdir %>/assets/css/installer.css':
|
||||
['src/less/installer.less']
|
||||
},
|
||||
options: {
|
||||
compile: true,
|
||||
compress: true
|
||||
}
|
||||
},
|
||||
canvasdesigner: {
|
||||
files: {
|
||||
'<%= distdir %>/assets/css/canvasdesigner.css':
|
||||
['src/less/canvas-designer.less', 'src/less/helveticons.less']
|
||||
},
|
||||
options: {
|
||||
compile: true,
|
||||
compress: true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
postcss: {
|
||||
options: {
|
||||
processors: [
|
||||
// add vendor prefixes
|
||||
require('autoprefixer-core')({
|
||||
browsers: 'last 2 versions'
|
||||
})
|
||||
]
|
||||
},
|
||||
dist: {
|
||||
src: '<%= distdir %>/assets/css/<%= pkg.name %>.css'
|
||||
}
|
||||
},
|
||||
|
||||
ngTemplateCache: {
|
||||
views: {
|
||||
files: {
|
||||
'<%= distdir %>/js/umbraco.views.js': 'src/views/**/*.html'
|
||||
},
|
||||
options: {
|
||||
trim: 'src/',
|
||||
module: 'umbraco.views'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
docs: {
|
||||
files: ['docs/src/**/*.md'],
|
||||
tasks: ['watch-docs', 'timestamp']
|
||||
},
|
||||
css: {
|
||||
files: 'src/**/*.less',
|
||||
tasks: ['watch-less', 'timestamp'],
|
||||
options: {
|
||||
livereload: true,
|
||||
},
|
||||
},
|
||||
js: {
|
||||
files: ['src/**/*.js', 'src/*.js'],
|
||||
tasks: ['watch-js', 'timestamp'],
|
||||
},
|
||||
test: {
|
||||
files: ['test/**/*.js'],
|
||||
tasks: ['watch-test', 'timestamp'],
|
||||
},
|
||||
installer: {
|
||||
files: ['src/installer/**/*.*'],
|
||||
tasks: ['watch-installer', 'timestamp'],
|
||||
},
|
||||
canvasdesigner: {
|
||||
files: ['src/canvasdesigner/**/*.*'],
|
||||
tasks: ['watch-canvasdesigner', 'timestamp'],
|
||||
},
|
||||
html: {
|
||||
files: ['src/views/**/*.html', 'src/*.html'],
|
||||
tasks: ['watch-html', 'timestamp']
|
||||
},
|
||||
options: {
|
||||
interval: 500
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
ngdocs: {
|
||||
options: {
|
||||
dest: 'docs/api',
|
||||
startPage: '/api',
|
||||
title: "Umbraco Backoffice UI API Documentation",
|
||||
html5Mode: false,
|
||||
styles: [
|
||||
'docs/umb-docs.css'
|
||||
],
|
||||
image: "https://our.umbraco.org/assets/images/logo.svg"
|
||||
},
|
||||
api: {
|
||||
src: ['src/common/**/*.js', 'docs/src/api/**/*.ngdoc'],
|
||||
title: 'API Documentation'
|
||||
},
|
||||
tutorials: {
|
||||
src: [],
|
||||
title: ''
|
||||
}
|
||||
},
|
||||
|
||||
eslint:{
|
||||
src: ['<%= src.common %>','<%= src.controllers %>'],
|
||||
options: {quiet: true}
|
||||
},
|
||||
|
||||
jshint: {
|
||||
dev: {
|
||||
files: {
|
||||
src: ['<%= src.common %>']
|
||||
},
|
||||
options: {
|
||||
curly: true,
|
||||
eqeqeq: true,
|
||||
immed: true,
|
||||
latedef: "nofunc",
|
||||
newcap: true,
|
||||
noarg: true,
|
||||
sub: true,
|
||||
boss: true,
|
||||
//NOTE: This is required so it doesn't barf on reserved words like delete when doing $http.delete
|
||||
es5: true,
|
||||
eqnull: true,
|
||||
//NOTE: we need to use eval sometimes so ignore it
|
||||
evil: true,
|
||||
//NOTE: we need to check for strings such as "javascript:" so don't throw errors regarding those
|
||||
scripturl: true,
|
||||
//NOTE: we ignore tabs vs spaces because enforcing that causes lots of errors depending on the text editor being used
|
||||
smarttabs: true,
|
||||
globals: {}
|
||||
}
|
||||
},
|
||||
build: {
|
||||
files: {
|
||||
src: ['<%= src.prod %>']
|
||||
},
|
||||
options: {
|
||||
curly: true,
|
||||
eqeqeq: true,
|
||||
immed: true,
|
||||
latedef: "nofunc",
|
||||
newcap: true,
|
||||
noarg: true,
|
||||
sub: true,
|
||||
boss: true,
|
||||
//NOTE: This is required so it doesn't barf on reserved words like delete when doing $http.delete
|
||||
es5: true,
|
||||
eqnull: true,
|
||||
//NOTE: we need to use eval sometimes so ignore it
|
||||
evil: true,
|
||||
//NOTE: we need to check for strings such as "javascript:" so don't throw errors regarding those
|
||||
scripturl: true,
|
||||
//NOTE: we ignore tabs vs spaces because enforcing that causes lots of errors depending on the text editor being used
|
||||
smarttabs: true,
|
||||
globalstrict: true,
|
||||
globals: { $: false, jQuery: false, define: false, require: false, window: false }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
bower: {
|
||||
dev: {
|
||||
dest: '<%= distdir %>/lib',
|
||||
options: {
|
||||
expand: true,
|
||||
ignorePackages: ['bootstrap'],
|
||||
packageSpecific: {
|
||||
'moment': {
|
||||
keepExpandedHierarchy: false,
|
||||
files: ['min/moment-with-locales.js']
|
||||
},
|
||||
'typeahead.js': {
|
||||
keepExpandedHierarchy: false,
|
||||
files: ['dist/typeahead.bundle.min.js']
|
||||
},
|
||||
'underscore': {
|
||||
files: ['underscore-min.js', 'underscore-min.map']
|
||||
},
|
||||
'rgrove-lazyload': {
|
||||
files: ['lazyload.js']
|
||||
},
|
||||
'bootstrap-social': {
|
||||
files: ['bootstrap-social.css']
|
||||
},
|
||||
'font-awesome': {
|
||||
files: ['css/font-awesome.min.css', 'fonts/*']
|
||||
},
|
||||
"jquery": {
|
||||
keepExpandedHierarchy: false,
|
||||
files: ['dist/jquery.min.js', 'dist/jquery.min.map']
|
||||
},
|
||||
'jquery-ui': {
|
||||
keepExpandedHierarchy: false,
|
||||
files: ['jquery-ui.min.js']
|
||||
},
|
||||
'jquery-migrate': {
|
||||
keepExpandedHierarchy: false,
|
||||
files: ['jquery-migrate.min.js']
|
||||
},
|
||||
'tinymce': {
|
||||
files: ['plugins/**', 'themes/**', 'tinymce.min.js']
|
||||
},
|
||||
'angular-dynamic-locale': {
|
||||
files: ['tmhDynamicLocale.min.js', 'tmhDynamicLocale.min.js.map']
|
||||
},
|
||||
'ng-file-upload': {
|
||||
keepExpandedHierarchy: false,
|
||||
files: ['ng-file-upload.min.js']
|
||||
},
|
||||
'angular-local-storage': {
|
||||
keepExpandedHierarchy: false,
|
||||
files: ['dist/angular-local-storage.min.js']
|
||||
},
|
||||
'codemirror': {
|
||||
files: [
|
||||
'lib/codemirror.js',
|
||||
'lib/codemirror.css',
|
||||
|
||||
'mode/css/*',
|
||||
'mode/javascript/*',
|
||||
'mode/xml/*',
|
||||
'mode/htmlmixed/*',
|
||||
|
||||
'addon/search/*',
|
||||
'addon/edit/*',
|
||||
'addon/selection/*',
|
||||
'addon/dialog/*'
|
||||
]
|
||||
},
|
||||
'ace-builds': {
|
||||
files: [
|
||||
'src-min-noconflict/ace.js',
|
||||
|
||||
'src-min-noconflict/ext-language_tools.js',
|
||||
'src-min-noconflict/ext-searchbox.js',
|
||||
'src-min-noconflict/ext-settings_menu.js',
|
||||
|
||||
'src-min-noconflict/snippets/text.js',
|
||||
'src-min-noconflict/snippets/javascript.js',
|
||||
|
||||
'src-min-noconflict/theme-chrome.js',
|
||||
|
||||
'src-min-noconflict/mode-razor.js',
|
||||
'src-min-noconflict/mode-javascript.js',
|
||||
|
||||
'src-min-noconflict/worker-javascript.js',
|
||||
]
|
||||
},
|
||||
'clipboard': {
|
||||
keepExpandedHierarchy: false,
|
||||
files: ['dist/clipboard.min.js']
|
||||
},
|
||||
'angular-moment': {
|
||||
keepExpandedHierarchy: false,
|
||||
files: ['angular-moment.min.js']
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
options: {
|
||||
expand: true
|
||||
}
|
||||
},
|
||||
|
||||
"bower-install-simple": {
|
||||
options: {
|
||||
color: true
|
||||
},
|
||||
"dev": {}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-recess');
|
||||
grunt.loadNpmTasks('grunt-postcss');
|
||||
|
||||
grunt.loadNpmTasks('grunt-karma');
|
||||
|
||||
grunt.loadNpmTasks('grunt-open');
|
||||
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||
grunt.loadNpmTasks("grunt-bower-install-simple");
|
||||
grunt.loadNpmTasks('grunt-bower');
|
||||
grunt.loadNpmTasks('grunt-ngdocs');
|
||||
|
||||
grunt.loadNpmTasks('grunt-eslint');
|
||||
grunt.loadNpmTasks('grunt-hustler');
|
||||
};
|
||||
@@ -7,6 +7,7 @@ var sort = require('gulp-sort');
|
||||
var connect = require('gulp-connect');
|
||||
var open = require('gulp-open');
|
||||
var runSequence = require('run-sequence');
|
||||
const imagemin = require('gulp-imagemin');
|
||||
|
||||
var _ = require('lodash');
|
||||
var MergeStream = require('merge-stream');
|
||||
@@ -73,7 +74,6 @@ var sources = {
|
||||
js: {
|
||||
preview: { files: ["src/canvasdesigner/**/*.js"], out: "umbraco.canvasdesigner.js" },
|
||||
installer: { files: ["src/installer/**/*.js"], out: "umbraco.installer.js" },
|
||||
|
||||
controllers: { files: ["src/{views,controllers}/**/*.controller.js"], out: "umbraco.controllers.js" },
|
||||
directives: { files: ["src/common/directives/**/*.js"], out: "umbraco.directives.js" },
|
||||
filters: { files: ["src/common/filters/**/*.js"], out: "umbraco.filters.js" },
|
||||
@@ -85,8 +85,7 @@ var sources = {
|
||||
//selectors for copying all views into the build
|
||||
//processed in the views task
|
||||
views:{
|
||||
umbraco: {files: ["src/views/**/*html"], folder: ""},
|
||||
preview: { files: ["src/canvasdesigner/**/*.html"], folder: "../preview"},
|
||||
umbraco: {files: ["src/views/**/*.html"], folder: ""},
|
||||
installer: {files: ["src/installer/steps/*.html"], folder: "install"}
|
||||
},
|
||||
|
||||
@@ -208,6 +207,17 @@ gulp.task('dependencies', function () {
|
||||
//css, fonts and image files
|
||||
stream.add(
|
||||
gulp.src(sources.globs.assets)
|
||||
.pipe(imagemin([
|
||||
imagemin.gifsicle({interlaced: true}),
|
||||
imagemin.jpegtran({progressive: true}),
|
||||
imagemin.optipng({optimizationLevel: 5}),
|
||||
imagemin.svgo({
|
||||
plugins: [
|
||||
{removeViewBox: true},
|
||||
{cleanupIDs: false}
|
||||
]
|
||||
})
|
||||
]))
|
||||
.pipe(gulp.dest(root + targets.assets))
|
||||
);
|
||||
|
||||
|
||||
@@ -84,27 +84,21 @@
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.trimStart) {
|
||||
|
||||
/** trims the start of the string*/
|
||||
String.prototype.trimStart = function (str) {
|
||||
if (this.startsWith(str)) {
|
||||
return this.substring(str.length);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.trimEnd) {
|
||||
/** trims the start of the string*/
|
||||
String.prototype.trimStart = function (str) {
|
||||
if (this.startsWith(str)) {
|
||||
return this.substring(str.length);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/** trims the end of the string*/
|
||||
String.prototype.trimEnd = function (str) {
|
||||
if (this.endsWith(str)) {
|
||||
return this.substring(0, this.length - str.length);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
}
|
||||
/** trims the end of the string*/
|
||||
String.prototype.trimEnd = function (str) {
|
||||
if (this.endsWith(str)) {
|
||||
return this.substring(0, this.length - str.length);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
if (!String.prototype.utf8Encode) {
|
||||
|
||||
@@ -332,4 +326,4 @@
|
||||
}
|
||||
|
||||
|
||||
})();
|
||||
})();
|
||||
|
||||
@@ -27,9 +27,10 @@
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-connect": "5.0.0",
|
||||
"gulp-less": "^3.1.0",
|
||||
"gulp-imagemin": "^4.1.0",
|
||||
"gulp-less": "^3.5.0",
|
||||
"gulp-ngdocs": "^0.3.0",
|
||||
"gulp-open": "^2.0.0",
|
||||
"gulp-open": "^2.1.0",
|
||||
"gulp-postcss": "^6.2.0",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-sort": "^2.0.0",
|
||||
@@ -38,11 +39,11 @@
|
||||
"gulp-wrap-js": "^0.4.1",
|
||||
"jasmine-core": "2.5.2",
|
||||
"karma": "^1.7.0",
|
||||
"karma-jasmine": "^1.1.0",
|
||||
"karma-jasmine": "^1.1.1",
|
||||
"karma-phantomjs-launcher": "^1.0.4",
|
||||
"less": "^2.6.1",
|
||||
"lodash": "^4.16.3",
|
||||
"less": "^2.7.3",
|
||||
"lodash": "^4.17.5",
|
||||
"merge-stream": "^1.0.1",
|
||||
"run-sequence": "^2.1.0"
|
||||
"run-sequence": "^2.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
@ECHO OFF
|
||||
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO This will only work when you have NPM available on the command line
|
||||
ECHO Works great with NodeJS Portable - https://gareth.flowers/nodejs-portable/
|
||||
ECHO.
|
||||
ECHO.
|
||||
set /P c=Are you sure you want to continue [Y/N]?
|
||||
if /I "%c%" EQU "Y" goto :setupgulp
|
||||
if /I "%c%" EQU "N" goto :eof
|
||||
|
||||
:setupgulp
|
||||
call npm install
|
||||
call npm -g install bower
|
||||
call npm -g install gulp
|
||||
call npm -g install gulp-cli
|
||||
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO You should now be able to run: gulp build
|
||||
ECHO.
|
||||
ECHO.
|
||||
@@ -1,3 +0,0 @@
|
||||
<div class="box-slider">
|
||||
<div colorpicker ng-model="item.values.color"></div>
|
||||
</div>
|
||||
@@ -25,6 +25,7 @@ The tour object consist of two parts - The overall tour configuration and a list
|
||||
"group": "My Custom Group" // Used to group tours in the help drawer
|
||||
"groupOrder": 200 // Control the order of tour groups
|
||||
"allowDisable": // Adds a "Don't" show this tour again"-button to the intro step
|
||||
"culture" : // From v7.11+. Specifies the culture of the tour (eg. en-US), if set the tour will only be shown to users with this culture set on their profile. If omitted or left empty the tour will be visible to all users
|
||||
"requiredSections":["content", "media", "mySection"] // Sections that the tour will access while running, if the user does not have access to the required tour sections, the tour will not load.
|
||||
"steps": [] // tour steps - see next example
|
||||
}
|
||||
|
||||
@@ -67,97 +67,97 @@ Use this directive to render an umbraco button. The directive can be used to gen
|
||||
@param {boolean=} disabled Set to <code>true</code> to disable the button.
|
||||
**/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function ButtonDirective($timeout) {
|
||||
function ButtonDirective($timeout) {
|
||||
|
||||
function link(scope, el, attr, ctrl) {
|
||||
function link(scope, el, attr, ctrl) {
|
||||
|
||||
scope.style = null;
|
||||
scope.style = null;
|
||||
scope.innerState = "init";
|
||||
|
||||
function activate() {
|
||||
function activate() {
|
||||
|
||||
scope.blockElement = false;
|
||||
scope.blockElement = false;
|
||||
|
||||
if (!scope.state) {
|
||||
scope.state = "init";
|
||||
}
|
||||
if (scope.buttonStyle) {
|
||||
|
||||
if (scope.buttonStyle) {
|
||||
// make it possible to pass in multiple styles
|
||||
if (scope.buttonStyle.startsWith("[") && scope.buttonStyle.endsWith("]")) {
|
||||
|
||||
// make it possible to pass in multiple styles
|
||||
if(scope.buttonStyle.startsWith("[") && scope.buttonStyle.endsWith("]")) {
|
||||
|
||||
// when using an attr it will always be a string so we need to remove square brackets
|
||||
// and turn it into and array
|
||||
var withoutBrackets = scope.buttonStyle.replace(/[\[\]']+/g,'');
|
||||
// split array by , + make sure to catch whitespaces
|
||||
var array = withoutBrackets.split(/\s?,\s?/g);
|
||||
|
||||
angular.forEach(array, function(item){
|
||||
scope.style = scope.style + " " + "btn-" + item;
|
||||
if(item === "block") {
|
||||
// when using an attr it will always be a string so we need to remove square brackets
|
||||
// and turn it into and array
|
||||
var withoutBrackets = scope.buttonStyle.replace(/[\[\]']+/g, '');
|
||||
// split array by , + make sure to catch whitespaces
|
||||
var array = withoutBrackets.split(/\s?,\s?/g);
|
||||
|
||||
angular.forEach(array, function (item) {
|
||||
scope.style = scope.style + " " + "btn-" + item;
|
||||
if (item === "block") {
|
||||
scope.blockElement = true;
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
scope.style = "btn-" + scope.buttonStyle;
|
||||
if (scope.buttonStyle === "block") {
|
||||
scope.blockElement = true;
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
scope.style = "btn-" + scope.buttonStyle;
|
||||
if(scope.buttonStyle === "block") {
|
||||
scope.blockElement = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
activate();
|
||||
|
||||
activate();
|
||||
var unbindStateWatcher = scope.$watch('state', function (newValue, oldValue) {
|
||||
if (newValue) {
|
||||
scope.innerState = newValue;
|
||||
}
|
||||
|
||||
var unbindStateWatcher = scope.$watch('state', function(newValue, oldValue) {
|
||||
if (newValue === 'success' || newValue === 'error') {
|
||||
$timeout(function () {
|
||||
scope.innerState = 'init';
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
if (newValue === 'success' || newValue === 'error') {
|
||||
$timeout(function() {
|
||||
scope.state = 'init';
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
scope.$on('$destroy', function () {
|
||||
unbindStateWatcher();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var directive = {
|
||||
transclude: true,
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
templateUrl: 'views/components/buttons/umb-button.html',
|
||||
link: link,
|
||||
scope: {
|
||||
action: "&?",
|
||||
href: "@?",
|
||||
type: "@",
|
||||
buttonStyle: "@?",
|
||||
state: "=?",
|
||||
shortcut: "@?",
|
||||
shortcutWhenHidden: "@",
|
||||
label: "@?",
|
||||
labelKey: "@?",
|
||||
icon: "@?",
|
||||
disabled: "=",
|
||||
size: "@?",
|
||||
alias: "@?"
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
return directive;
|
||||
|
||||
scope.$on('$destroy', function() {
|
||||
unbindStateWatcher();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var directive = {
|
||||
transclude: true,
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
templateUrl: 'views/components/buttons/umb-button.html',
|
||||
link: link,
|
||||
scope: {
|
||||
action: "&?",
|
||||
href: "@?",
|
||||
type: "@",
|
||||
buttonStyle: "@?",
|
||||
state: "=?",
|
||||
shortcut: "@?",
|
||||
shortcutWhenHidden: "@",
|
||||
label: "@?",
|
||||
labelKey: "@?",
|
||||
icon: "@?",
|
||||
disabled: "=",
|
||||
size: "@?",
|
||||
alias: "@?"
|
||||
}
|
||||
};
|
||||
|
||||
return directive;
|
||||
|
||||
}
|
||||
|
||||
angular.module('umbraco.directives').directive('umbButton', ButtonDirective);
|
||||
angular.module('umbraco.directives').directive('umbButton', ButtonDirective);
|
||||
|
||||
})();
|
||||
|
||||
@@ -77,6 +77,8 @@
|
||||
|
||||
resetLastListPageNumber($scope.content);
|
||||
|
||||
eventsService.emit("content.loaded", { content: $scope.content });
|
||||
|
||||
$scope.page.loading = false;
|
||||
|
||||
});
|
||||
@@ -130,6 +132,8 @@
|
||||
|
||||
$scope.page.buttonGroupState = "busy";
|
||||
|
||||
eventsService.emit("content.saving", { content: $scope.content, action: args.action });
|
||||
|
||||
contentEditingHelper.contentEditorPerformSave({
|
||||
statusMessage: args.statusMessage,
|
||||
saveMethod: args.saveMethod,
|
||||
@@ -144,6 +148,9 @@
|
||||
$scope.page.buttonGroupState = "success";
|
||||
|
||||
deferred.resolve(data);
|
||||
|
||||
eventsService.emit("content.saved", { content: $scope.content, action: args.action });
|
||||
|
||||
}, function (err) {
|
||||
//error
|
||||
if (err) {
|
||||
@@ -183,7 +190,9 @@
|
||||
|
||||
$scope.page.loading = false;
|
||||
|
||||
});
|
||||
eventsService.emit("content.newReady", { content: $scope.content });
|
||||
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -198,6 +207,8 @@
|
||||
|
||||
$scope.page.buttonGroupState = "busy";
|
||||
|
||||
eventsService.emit("content.unpublishing", { content: $scope.content });
|
||||
|
||||
contentResource.unPublish($scope.content.id)
|
||||
.then(function (data) {
|
||||
|
||||
@@ -215,7 +226,10 @@
|
||||
|
||||
$scope.page.buttonGroupState = "success";
|
||||
|
||||
eventsService.emit("content.unpublished", { content: $scope.content });
|
||||
|
||||
}, function(err) {
|
||||
formHelper.showNotifications(err.data);
|
||||
$scope.page.buttonGroupState = 'error';
|
||||
});
|
||||
}
|
||||
@@ -255,11 +269,9 @@
|
||||
else {
|
||||
$scope.save().then(function (data) {
|
||||
previewWindow.location.href = redirect;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$scope.restore = function (content) {
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
var evts = [];
|
||||
var isInfoTab = false;
|
||||
scope.publishStatus = {};
|
||||
|
||||
scope.disableTemplates = Umbraco.Sys.ServerVariables.features.disabledFeatures.disableTemplates;
|
||||
|
||||
function onInit() {
|
||||
|
||||
|
||||
@@ -145,6 +145,12 @@ angular.module("umbraco.directives")
|
||||
}
|
||||
}
|
||||
}
|
||||
if (val === "true") {
|
||||
tinyMceConfig.customConfig[i] = true;
|
||||
}
|
||||
if (val === "false") {
|
||||
tinyMceConfig.customConfig[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
angular.extend(baseLineConfigObj, tinyMceConfig.customConfig);
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
</pre>
|
||||
|
||||
<h1>General Options</h1>
|
||||
Lorem ipsum dolor sit amet..
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -74,7 +73,7 @@ Lorem ipsum dolor sit amet..
|
||||
<td>Set the title of the overlay.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>model.subTitle</td>
|
||||
<td>model.subtitle</td>
|
||||
<td>String</td>
|
||||
<td>Set the subtitle of the overlay.</td>
|
||||
</tr>
|
||||
@@ -496,6 +495,7 @@ Opens an overlay to show a custom YSOD. </br>
|
||||
var activeElementType = document.activeElement.tagName;
|
||||
var clickableElements = ["A", "BUTTON"];
|
||||
var submitOnEnter = document.activeElement.hasAttribute("overlay-submit-on-enter");
|
||||
var submitOnEnterValue = submitOnEnter ? document.activeElement.getAttribute("overlay-submit-on-enter") : "";
|
||||
|
||||
if(clickableElements.indexOf(activeElementType) === 0) {
|
||||
document.activeElement.click();
|
||||
@@ -503,7 +503,9 @@ Opens an overlay to show a custom YSOD. </br>
|
||||
} else if(activeElementType === "TEXTAREA" && !submitOnEnter) {
|
||||
|
||||
|
||||
} else {
|
||||
} else if (submitOnEnter && submitOnEnterValue === "false") {
|
||||
// don't do anything
|
||||
}else {
|
||||
scope.$apply(function () {
|
||||
scope.submitForm(scope.model);
|
||||
});
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
function link(scope, el, attr, ngModel) {
|
||||
|
||||
// Load in ace library
|
||||
assetsService.load(['lib/ace-builds/src-min-noconflict/ace.js', 'lib/ace-builds/src-min-noconflict/ext-language_tools.js']).then(function () {
|
||||
assetsService.load(['lib/ace-builds/src-min-noconflict/ace.js', 'lib/ace-builds/src-min-noconflict/ext-language_tools.js'], scope).then(function () {
|
||||
if (angular.isUndefined(window.ace)) {
|
||||
throw new Error('ui-ace need ace to work... (o rly?)');
|
||||
} else {
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
var clipboard;
|
||||
var target = element[0];
|
||||
|
||||
assetsService.loadJs("lib/clipboard/clipboard.min.js")
|
||||
assetsService.loadJs("lib/clipboard/clipboard.min.js", scope)
|
||||
.then(function () {
|
||||
|
||||
if(scope.umbClipboardTarget) {
|
||||
|
||||
@@ -1,12 +1,51 @@
|
||||
/**
|
||||
* @ngdoc directive
|
||||
* @name umbraco.directives.directive:umbConfirm
|
||||
* @function
|
||||
* @description
|
||||
* A confirmation dialog
|
||||
*
|
||||
* @restrict E
|
||||
*/
|
||||
@ngdoc directive
|
||||
@name umbraco.directives.directive:umbConfirm
|
||||
@restrict E
|
||||
@scope
|
||||
|
||||
@description
|
||||
A confirmation dialog
|
||||
|
||||
|
||||
<h3>Markup example</h3>
|
||||
<pre>
|
||||
<div ng-controller="My.Controller as vm">
|
||||
|
||||
<umb-confirm caption="Title" on-confirm="vm.onConfirm()" on-cancel="vm.onCancel()"></umb-confirm>
|
||||
|
||||
</div>
|
||||
</pre>
|
||||
|
||||
<h3>Controller example</h3>
|
||||
<pre>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function Controller() {
|
||||
|
||||
var vm = this;
|
||||
|
||||
vm.onConfirm = function() {
|
||||
alert('Confirm clicked');
|
||||
};
|
||||
|
||||
vm.onCancel = function() {
|
||||
alert('Cancel clicked');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller("My.Controller", Controller);
|
||||
|
||||
})();
|
||||
</pre>
|
||||
|
||||
@param {string} caption (<code>attribute</code>): The caption shown above the buttons
|
||||
@param {callback} on-confirm (<code>attribute</code>): The call back when the "OK" button is clicked. If not set the button will not be shown
|
||||
@param {callback} on-cancel (<code>atribute</code>): The call back when the "Cancel" button is clicked. If not set the button will not be shown
|
||||
**/
|
||||
function confirmDirective() {
|
||||
return {
|
||||
restrict: "E", // restrict to an element
|
||||
@@ -18,7 +57,16 @@ function confirmDirective() {
|
||||
caption: '@'
|
||||
},
|
||||
link: function (scope, element, attr, ctrl) {
|
||||
scope.showCancel = false;
|
||||
scope.showConfirm = false;
|
||||
|
||||
if (scope.onConfirm) {
|
||||
scope.showConfirm = true;
|
||||
}
|
||||
|
||||
if (scope.onCancel) {
|
||||
scope.showCancel = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -92,10 +92,10 @@ Use this directive to render a date time picker
|
||||
scope.hasTranscludedContent = element.find('.js-datePicker__transcluded-content')[0].children.length > 0;
|
||||
|
||||
// load css file for the date picker
|
||||
assetsService.loadCss('lib/datetimepicker/bootstrap-datetimepicker.min.css');
|
||||
assetsService.loadCss('lib/datetimepicker/bootstrap-datetimepicker.min.css', scope);
|
||||
|
||||
// load the js file for the date picker
|
||||
assetsService.loadJs('lib/datetimepicker/bootstrap-datetimepicker.js').then(function () {
|
||||
assetsService.loadJs('lib/datetimepicker/bootstrap-datetimepicker.js', scope).then(function () {
|
||||
// init date picker
|
||||
initDatePicker();
|
||||
});
|
||||
|
||||
@@ -348,9 +348,10 @@
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
//select which resource methods to use, eg document Type or Media Type versions
|
||||
var availableContentTypeResource = scope.contentType === "documentType" ? contentTypeResource.getAvailableCompositeContentTypes : mediaTypeResource.getAvailableCompositeContentTypes;
|
||||
var countContentTypeResource = scope.contentType === "documentType" ? contentTypeResource.getCount : mediaTypeResource.getCount;
|
||||
var whereUsedContentTypeResource = scope.contentType === "documentType" ? contentTypeResource.getWhereCompositionIsUsedInContentTypes : mediaTypeResource.getWhereCompositionIsUsedInContentTypes;
|
||||
var countContentTypeResource = scope.contentType === "documentType" ? contentTypeResource.getCount : mediaTypeResource.getCount;
|
||||
|
||||
//get the currently assigned property type aliases - ensure we pass these to the server side filer
|
||||
var propAliasesExisting = _.filter(_.flatten(_.map(scope.model.groups, function(g) {
|
||||
@@ -363,7 +364,14 @@
|
||||
$q.all([
|
||||
//get available composite types
|
||||
availableContentTypeResource(scope.model.id, [], propAliasesExisting).then(function (result) {
|
||||
setupAvailableContentTypesModel(result);
|
||||
setupAvailableContentTypesModel(result);
|
||||
}),
|
||||
//get where used document types
|
||||
whereUsedContentTypeResource(scope.model.id).then(function (whereUsed) {
|
||||
//pass to the dialog model the content type eg documentType or mediaType
|
||||
scope.compositionsDialogModel.section = scope.contentType;
|
||||
//pass the list of 'where used' document types
|
||||
scope.compositionsDialogModel.whereCompositionUsed = whereUsed;
|
||||
}),
|
||||
//get content type count
|
||||
countContentTypeResource().then(function(result) {
|
||||
|
||||
@@ -91,12 +91,16 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function NodePreviewDirective() {
|
||||
function NodePreviewDirective(userService) {
|
||||
|
||||
function link(scope, el, attr, ctrl) {
|
||||
if (!scope.editLabelKey) {
|
||||
scope.editLabelKey = "general_edit";
|
||||
}
|
||||
userService.getCurrentUser().then(function (u) {
|
||||
var isAdmin = u.userGroups.indexOf('admin') !== -1;
|
||||
scope.alias = (Umbraco.Sys.ServerVariables.isDebuggingEnabled === true || isAdmin) ? scope.alias : null;
|
||||
});
|
||||
}
|
||||
|
||||
var directive = {
|
||||
@@ -106,6 +110,7 @@
|
||||
scope: {
|
||||
icon: "=?",
|
||||
name: "=",
|
||||
alias: "=?",
|
||||
description: "=?",
|
||||
permissions: "=?",
|
||||
published: "=?",
|
||||
|
||||
@@ -57,7 +57,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
saveModel),
|
||||
'Failed to save permissions');
|
||||
},
|
||||
|
||||
|
||||
|
||||
getRecycleBin: function () {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
@@ -424,7 +424,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"contentApiBaseUrl",
|
||||
"GetEmpty",
|
||||
"GetEmpty",
|
||||
[{ blueprintId: blueprintId }, { parentId: parentId}])),
|
||||
'Failed to retrieve blueprint for id ' + blueprintId);
|
||||
},
|
||||
@@ -488,6 +488,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
getChildren: function (parentId, options) {
|
||||
|
||||
var defaults = {
|
||||
includeProperties: [],
|
||||
pageSize: 0,
|
||||
pageNumber: 0,
|
||||
filter: '',
|
||||
@@ -531,6 +532,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
"GetChildren",
|
||||
{
|
||||
id: parentId,
|
||||
includeProperties: _.pluck(options.includeProperties, 'alias').join(","),
|
||||
pageNumber: options.pageNumber,
|
||||
pageSize: options.pageSize,
|
||||
orderBy: options.orderBy,
|
||||
@@ -580,7 +582,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
"contentApiBaseUrl",
|
||||
"GetDetailedPermissions", { contentId: contentId })),
|
||||
'Failed to retrieve permissions for content item ' + contentId);
|
||||
},
|
||||
},
|
||||
|
||||
getPermissions: function (nodeIds) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
@@ -741,11 +743,11 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
|
||||
createBlueprintFromContent: function (contentId, name) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl("contentApiBaseUrl", "CreateBlueprintFromContent", {
|
||||
contentId: contentId, name: name
|
||||
})
|
||||
),
|
||||
})
|
||||
),
|
||||
"Failed to create blueprint from content with id " + contentId
|
||||
);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,37 @@ function contentTypeResource($q, $http, umbRequestHelper, umbDataFormatter) {
|
||||
query),
|
||||
'Failed to retrieve data for content type id ' + contentTypeId);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.contentTypeResource#getWhereCompositionIsUsedInContentTypes
|
||||
* @methodOf umbraco.resources.contentTypeResource
|
||||
*
|
||||
* @description
|
||||
* Returns a list of content types which use a specific composition with a given id
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* contentTypeResource.getWhereCompositionIsUsedInContentTypes(1234)
|
||||
* .then(function(contentTypeList) {
|
||||
* console.log(contentTypeList);
|
||||
* });
|
||||
* </pre>
|
||||
* @param {Int} contentTypeId id of the composition content type to retrieve the list of the content types where it has been used
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
getWhereCompositionIsUsedInContentTypes: function (contentTypeId) {
|
||||
var query = {
|
||||
contentTypeId: contentTypeId
|
||||
};
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"contentTypeApiBaseUrl",
|
||||
"GetWhereCompositionIsUsedInContentTypes"),
|
||||
query),
|
||||
'Failed to retrieve data for content type id ' + contentTypeId);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name umbraco.resources.dictionaryResource
|
||||
* @description Loads in data for dictionary items
|
||||
**/
|
||||
function dictionaryResource($q, $http, $location, umbRequestHelper, umbDataFormatter) {
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.dictionaryResource#deleteById
|
||||
* @methodOf umbraco.resources.dictionaryResource
|
||||
*
|
||||
* @description
|
||||
* Deletes a dictionary item with a given id
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* dictionaryResource.deleteById(1234)
|
||||
* .then(function() {
|
||||
* alert('its gone!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} id id of dictionary item to delete
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
**/
|
||||
function deleteById(id) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"dictionaryApiBaseUrl",
|
||||
"DeleteById",
|
||||
[{ id: id }])),
|
||||
"Failed to delete item " + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.dictionaryResource#create
|
||||
* @methodOf umbraco.resources.dictionaryResource
|
||||
*
|
||||
* @description
|
||||
* Creates a dictionary item with the gieven key and parent id
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* dictionaryResource.create(1234,"Item key")
|
||||
* .then(function() {
|
||||
* alert('its created!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} parentid the parentid of the new dictionary item
|
||||
* @param {String} key the key of the new dictionary item
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
**/
|
||||
function create(parentid, key) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"dictionaryApiBaseUrl",
|
||||
"Create",
|
||||
{ parentId: parentid, key : key })),
|
||||
"Failed to create item ");
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.dictionaryResource#deleteById
|
||||
* @methodOf umbraco.resources.dictionaryResource
|
||||
*
|
||||
* @description
|
||||
* Gets a dictionary item with a given id
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* dictionaryResource.getById(1234)
|
||||
* .then(function() {
|
||||
* alert('Found it!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} id id of dictionary item to get
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
**/
|
||||
function getById(id) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"dictionaryApiBaseUrl",
|
||||
"GetById",
|
||||
[{ id: id }])),
|
||||
"Failed to get item " + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.dictionaryResource#save
|
||||
* @methodOf umbraco.resources.dictionaryResource
|
||||
*
|
||||
* @description
|
||||
* Updates a dictionary
|
||||
*
|
||||
* @param {Object} dictionary dictionary object to update
|
||||
* @param {Bool} nameIsDirty set to true if the name has been changed
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
function save(dictionary, nameIsDirty) {
|
||||
|
||||
var saveModel = umbDataFormatter.formatDictionaryPostData(dictionary, nameIsDirty);
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(umbRequestHelper.getApiUrl("dictionaryApiBaseUrl", "PostSave"), saveModel),
|
||||
"Failed to save data for dictionary id " + dictionary.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.dictionaryResource#getList
|
||||
* @methodOf umbraco.resources.dictionaryResource
|
||||
*
|
||||
* @description
|
||||
* Gets a list of all dictionary items
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* dictionaryResource.getList()
|
||||
* .then(function() {
|
||||
* alert('Found it!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
**/
|
||||
function getList() {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"dictionaryApiBaseUrl",
|
||||
"getList")),
|
||||
"Failed to get list");
|
||||
}
|
||||
|
||||
var resource = {
|
||||
deleteById: deleteById,
|
||||
create: create,
|
||||
getById: getById,
|
||||
save: save,
|
||||
getList : getList
|
||||
};
|
||||
|
||||
return resource;
|
||||
|
||||
|
||||
}
|
||||
|
||||
angular.module("umbraco.resources").factory("dictionaryResource", dictionaryResource);
|
||||
@@ -38,7 +38,38 @@ function mediaTypeResource($q, $http, umbRequestHelper, umbDataFormatter) {
|
||||
query),
|
||||
'Failed to retrieve data for content type id ' + contentTypeId);
|
||||
},
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaTypeResource#getWhereCompositionIsUsedInContentTypes
|
||||
* @methodOf umbraco.resources.mediaTypeResource
|
||||
*
|
||||
* @description
|
||||
* Returns a list of media types which use a specific composition with a given id
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaTypeResource.getWhereCompositionIsUsedInContentTypes(1234)
|
||||
* .then(function(mediaTypeList) {
|
||||
* console.log(mediaTypeList);
|
||||
* });
|
||||
* </pre>
|
||||
* @param {Int} contentTypeId id of the composition content type to retrieve the list of the media types where it has been used
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
getWhereCompositionIsUsedInContentTypes: function (contentTypeId) {
|
||||
var query = {
|
||||
contentTypeId: contentTypeId
|
||||
};
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaTypeApiBaseUrl",
|
||||
"GetWhereCompositionIsUsedInContentTypes"),
|
||||
query),
|
||||
'Failed to retrieve data for content type id ' + contentTypeId);
|
||||
},
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaTypeResource#getAllowedTypes
|
||||
@@ -122,6 +153,18 @@ function mediaTypeResource($q, $http, umbRequestHelper, umbDataFormatter) {
|
||||
'Failed to delete content type contaier');
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaTypeResource#save
|
||||
* @methodOf umbraco.resources.mediaTypeResource
|
||||
*
|
||||
* @description
|
||||
* Saves or update a media type
|
||||
*
|
||||
* @param {Object} content data type object to create/update
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
save: function (contentType) {
|
||||
|
||||
var saveModel = umbDataFormatter.formatContentTypePostData(contentType);
|
||||
|
||||
@@ -86,8 +86,8 @@ function memberTypeResource($q, $http, umbRequestHelper, umbDataFormatter) {
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.contentTypeResource#save
|
||||
* @methodOf umbraco.resources.contentTypeResource
|
||||
* @name umbraco.resources.memberTypeResource#save
|
||||
* @methodOf umbraco.resources.memberTypeResource
|
||||
*
|
||||
* @description
|
||||
* Saves or update a member type
|
||||
|
||||
@@ -129,14 +129,12 @@ angular.module('umbraco.services')
|
||||
asset.state = "loading";
|
||||
LazyLoad.css(appendRnd(path), function () {
|
||||
if (!scope) {
|
||||
asset.state = "loaded";
|
||||
asset.deferred.resolve(true);
|
||||
} else {
|
||||
asset.state = "loaded";
|
||||
angularHelper.safeApply(scope, function () {
|
||||
asset.deferred.resolve(true);
|
||||
});
|
||||
scope = $rootScope;
|
||||
}
|
||||
asset.state = "loaded";
|
||||
angularHelper.safeApply(scope, function () {
|
||||
asset.deferred.resolve(true);
|
||||
});
|
||||
});
|
||||
} else if (asset.state === "loaded") {
|
||||
asset.deferred.resolve(true);
|
||||
@@ -171,14 +169,12 @@ angular.module('umbraco.services')
|
||||
|
||||
LazyLoad.js(appendRnd(path), function () {
|
||||
if (!scope) {
|
||||
asset.state = "loaded";
|
||||
asset.deferred.resolve(true);
|
||||
} else {
|
||||
asset.state = "loaded";
|
||||
angularHelper.safeApply(scope, function () {
|
||||
asset.deferred.resolve(true);
|
||||
});
|
||||
scope = $rootScope;
|
||||
}
|
||||
asset.state = "loaded";
|
||||
angularHelper.safeApply(scope, function () {
|
||||
asset.deferred.resolve(true);
|
||||
});
|
||||
});
|
||||
|
||||
} else if (asset.state === "loaded") {
|
||||
@@ -234,8 +230,7 @@ angular.module('umbraco.services')
|
||||
assets.push(asset);
|
||||
}
|
||||
|
||||
//we need to always push to the promises collection to monitor correct
|
||||
//execution
|
||||
//we need to always push to the promises collection to monitor correct execution
|
||||
promises.push(asset.deferred.promise);
|
||||
}
|
||||
});
|
||||
@@ -256,8 +251,7 @@ angular.module('umbraco.services')
|
||||
function assetLoaded(asset) {
|
||||
asset.state = "loaded";
|
||||
if (!scope) {
|
||||
asset.deferred.resolve(true);
|
||||
return;
|
||||
scope = $rootScope;
|
||||
}
|
||||
angularHelper.safeApply(scope,
|
||||
function () {
|
||||
@@ -280,4 +274,4 @@ angular.module('umbraco.services')
|
||||
};
|
||||
|
||||
return service;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -243,10 +243,11 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica
|
||||
}
|
||||
|
||||
|
||||
//if we are not creating, then we should add unpublish too,
|
||||
// if we are not creating, then we should add unpublish too,
|
||||
// so long as it's already published and if the user has access to publish
|
||||
// and the user has access to unpublish (may have been removed via Event)
|
||||
if (!args.create) {
|
||||
if (args.content.publishDate && _.contains(args.content.allowedActions, "U")) {
|
||||
if (args.content.publishDate && _.contains(args.content.allowedActions, "U") && _.contains(args.content.allowedActions, "Z")) {
|
||||
buttons.subButtons.push(createButtonDefinition("Z"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,13 @@ function iconHelper($q, $timeout) {
|
||||
var c = ".icon-";
|
||||
|
||||
for (var i = document.styleSheets.length - 1; i >= 0; i--) {
|
||||
var classes = document.styleSheets[i].rules || document.styleSheets[i].cssRules;
|
||||
var classes = null;
|
||||
try {
|
||||
classes = document.styleSheets[i].rules || document.styleSheets[i].cssRules;
|
||||
} catch (e) {
|
||||
console.warn("Can't read the css rules of: " + document.styleSheets[i].href, e);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (classes !== null) {
|
||||
for(var x=0;x<classes.length;x++) {
|
||||
@@ -224,4 +230,4 @@ function iconHelper($q, $timeout) {
|
||||
}
|
||||
};
|
||||
}
|
||||
angular.module('umbraco.services').factory('iconHelper', iconHelper);
|
||||
angular.module('umbraco.services').factory('iconHelper', iconHelper);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
function javascriptLibraryHelperService($q, $http, umbRequestHelper) {
|
||||
function javascriptLibraryService($q, $http, umbRequestHelper) {
|
||||
|
||||
var existingLocales = [];
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
umbRequestHelper.getApiUrl(
|
||||
"backOfficeAssetsApiBaseUrl",
|
||||
"GetSupportedMomentLocales")),
|
||||
'Failed to get cultures').then(function(locales) {
|
||||
"Failed to get cultures").then(function(locales) {
|
||||
existingLocales = locales;
|
||||
deferred.resolve(existingLocales);
|
||||
});
|
||||
@@ -30,11 +30,8 @@
|
||||
};
|
||||
|
||||
return service;
|
||||
|
||||
}
|
||||
|
||||
angular.module('umbraco.services').factory('javascriptLibraryHelperService', javascriptLibraryHelperService);
|
||||
|
||||
angular.module("umbraco.services").factory("javascriptLibraryService", javascriptLibraryService);
|
||||
|
||||
})();
|
||||
|
||||
@@ -288,9 +288,12 @@ function navigationService($rootScope, $routeParams, $log, $location, $q, $timeo
|
||||
throw "args.tree cannot be null";
|
||||
}
|
||||
|
||||
if (mainTreeEventHandler) {
|
||||
//returns a promise
|
||||
return mainTreeEventHandler.syncTree(args);
|
||||
if (mainTreeEventHandler) {
|
||||
|
||||
if (mainTreeEventHandler.syncTree) {
|
||||
//returns a promise,
|
||||
return mainTreeEventHandler.syncTree(args);
|
||||
}
|
||||
}
|
||||
|
||||
//couldn't sync
|
||||
|
||||
@@ -99,6 +99,28 @@
|
||||
return saveModel;
|
||||
},
|
||||
|
||||
/** formats the display model used to display the dictionary to the model used to save the dictionary */
|
||||
formatDictionaryPostData : function(dictionary, nameIsDirty) {
|
||||
var saveModel = {
|
||||
parentId: dictionary.parentId,
|
||||
id: dictionary.id,
|
||||
name: dictionary.name,
|
||||
nameIsDirty: nameIsDirty,
|
||||
translations: [],
|
||||
key : dictionary.key
|
||||
};
|
||||
|
||||
for(var i = 0; i < dictionary.translations.length; i++) {
|
||||
saveModel.translations.push({
|
||||
isoCode: dictionary.translations[i].isoCode,
|
||||
languageId: dictionary.translations[i].languageId,
|
||||
translation: dictionary.translations[i].translation
|
||||
});
|
||||
}
|
||||
|
||||
return saveModel;
|
||||
},
|
||||
|
||||
/** formats the display model used to display the user to the model used to save the user */
|
||||
formatUserPostData: function (displayModel) {
|
||||
|
||||
|
||||