Merge remote-tracking branch 'origin/v7-upgrade-test' into v7-upgrade-test

Conflicts:
	OurUmbraco.Site/Assets/css/style.min.css
This commit is contained in:
Rune Hem Strand
2015-02-27 10:32:31 +01:00
49 changed files with 1050 additions and 388 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ namespace Marketplace {
var p = provider.GetListing(new Guid(projectguid));
Member mem = new Member(new Guid(userguid));
if (p.Vendor != null && p.Vendor.Member.Id == mem.Id || Utills.IsProjectContributor(mem.Id, p.Id))
if (p.Vendor != null && p.Vendor.Member.Id == mem.Id || Utils.IsProjectContributor(mem.Id, p.Id))
{
var fileProvider = (IMediaProvider)MarketplaceProviderManager.Providers["MediaProvider"];
+1 -1
View File
@@ -42,7 +42,7 @@ namespace Marketplace
public static string ShortenText(string text)
{
text = Utills.StripHTML(text).Replace(" ", "");
text = Utils.StripHTML(text).Replace(" ", "");
if (text.Length > 210)
{
+1 -1
View File
@@ -21,6 +21,6 @@
<package id="MySql.Data" version="6.6.5" targetFramework="net451" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net451" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net451" />
<package id="UmbracoCms.Core" version="7.1.6" targetFramework="net451" />
<package id="UmbracoCms.Core" version="7.2.1" targetFramework="net451" />
<package id="xmlrpcnet" version="2.5.0" targetFramework="net451" />
</packages>
@@ -119,7 +119,7 @@ namespace Marketplace.usercontrols.Deli.Package
//check security to make sure the project belongs to the vendor
if (!((_project.Vendor.Member.Id == _vendor.Member.Id) || Utills.IsProjectContributor(_vendor.Member.Id, (int)_projectId)))
if (!((_project.Vendor.Member.Id == _vendor.Member.Id) || Utils.IsProjectContributor(_vendor.Member.Id, (int)_projectId)))
{
//this project does not belong to this member so kick them back to the project list in their profile.
Response.Redirect("~/member/profile/projects/");
@@ -75,7 +75,7 @@ namespace Marketplace.usercontrols.Deli.Package.Steps
var mem = Member.GetCurrentMember();
if (f.CreatedBy == mem.Id || Utills.IsProjectContributor(mem.Id, (int)ProjectId))
if (f.CreatedBy == mem.Id || Utils.IsProjectContributor(mem.Id, (int)ProjectId))
//if the file is the default file we need to clear it out of the system to stop it showing as the default download
if (f.Id.ToString() == _defaultFile)
@@ -237,7 +237,7 @@ namespace Marketplace.usercontrols.Deli.Package.Steps
if ((project.Vendor.Member.Id == mem.Id) ||
Utills.IsProjectContributor(mem.Id, (int)ProjectId))
Utils.IsProjectContributor(mem.Id, (int)ProjectId))
{
holder.Visible = true;
RebindFiles();
@@ -205,7 +205,7 @@ namespace Marketplace.usercontrols.Deli.Package.Steps
_projectGuid = project.ProjectGuid;
if ((project.Vendor.Member.Id == mem.Id) ||
Utills.IsProjectContributor(mem.Id, (int)ProjectId))
Utils.IsProjectContributor(mem.Id, (int)ProjectId))
{
holder.Visible = true;
ReBindLicenses();
@@ -81,7 +81,7 @@ namespace Marketplace.usercontrols.Deli.Package.Steps
var mem = Member.GetCurrentMember();
if (f.CreatedBy == mem.Id || Utills.IsProjectContributor(mem.Id, (int)ProjectId))
if (f.CreatedBy == mem.Id || Utils.IsProjectContributor(mem.Id, (int)ProjectId))
fileProvider.Remove(f);
RebindFiles();
@@ -167,7 +167,7 @@ namespace Marketplace.usercontrols.Deli.Package.Steps
if ((project.Vendor.Member.Id == mem.Id) ||
Utills.IsProjectContributor(mem.Id, (int)ProjectId))
Utils.IsProjectContributor(mem.Id, (int)ProjectId))
{
holder.Visible = true;
RebindFiles();
+1
View File
@@ -0,0 +1 @@
<svg height="50" viewBox="0 0 50 50" width="50" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h50v50H0z"/><path stroke="#000" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" fill="none" d="M35.89 30.054L25 40.944l-10.89-10.89M25 9v31.445"/></svg>

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

@@ -0,0 +1 @@
<svg height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><path d="M396.6 160l19.4 20.7L256 352 96 180.7l19.3-20.7L256 310.5z"/></svg>

After

Width:  |  Height:  |  Size: 163 B

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-43 45 512 512" enable-background="new -43 45 512 512"><path fill="#94D765" d="M353.6 205l19.4 20.7L213 397 53 225.7 72.3 205 213 355.5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-281 286 36 30" enable-background="new -281 286 36 30"><path fill="#98D768" d="M-267 316l8-5v-8l14-17h-36l14 17z"/></svg>

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 170 B

@@ -1,7 +1 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="-281 286 36 30" enable-background="new -281 286 36 30" xml:space="preserve">
<polygon fill="#191919" points="-267,316 -259,311 -259,303 -245,286 -263,286 -281,286 -267,303 "/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-281 286 36 30" enable-background="new -281 286 36 30"><path fill="#191919" d="M-267 316l8-5v-8l14-17h-36l14 17z"/></svg>

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 170 B

+374 -1
View File
@@ -1 +1,374 @@
function classOnScroll(selector,className,scrollDistance){var newClassOnScroll=new classOnScrollObject(selector,className,scrollDistance);newClassOnScroll.applyClass(),newClassOnScroll.scrollContainer.scroll(function(){newClassOnScroll.applyClass()})}_.templateSettings={interpolate:/\{\{(.+?)\}\}/g},jQuery(document).ready(function(){function redirectToSearch(ev){13===ev.keyCode&&(ev.preventDefault(),window.location="/search?term="+this.value)}{var bodyVar=$("body");$(".search-all")}$(".user, .close").click(function(e){e.stopPropagation(),bodyVar.toggleClass("quickmenu")}),$(".wrapper").on("click",function(){bodyVar.removeClass("quickmenu")}),$(".project-search-input").keydown(redirectToSearch).keyup(function(){var term=$(".project-search-input").val(),defaultListing=$(".projects-default-listing"),searchListing=$(".projects-search-listing");if(0===term.length&&(defaultListing.show(),searchListing.empty()),term.length>3){var url="/umbraco/api/OurSearch/GetProjectSearchResults",template=_.template($("script.search-item-project").html());$.ajax({dataType:"json",url:url,data:{term:term},success:function(response){if(defaultListing.hide(),searchListing.empty(),0===response.items.length){var linkhtml="<p>No results found</p>";searchListing.append(linkhtml)}_.each(response.items,function(item){var image=item.Fields.image&&item.Fields.image.length>0?item.Fields.image:"<i class='icon-Box'></i>",itemData={nodeName:item.Fields.nodeName,body:_.escape(item.Fields.body.substring(0,150)),url:item.Fields.url,karma:item.Fields.karma,downloads:item.Fields.downloads,versions:item.Fields.versions,image:image};searchListing.append(template(itemData))})}})}}),$(".docs-search-input").keydown(redirectToSearch).keyup(function(ev){var term=$(".docs-search-input").val(),defaultListing=$(".docs-default-listing"),searchListing=$(".docs-search-listing");if(console.log(term),13===ev.keyCode&&(ev.preventDefault(),window.location="/search?term="+term),0===term.length&&(defaultListing.show(),searchListing.empty()),term.length>3){var url="/umbraco/api/OurSearch/GetDocsSearchResults",template=_.template($("script.search-item-docs").html());$.ajax({dataType:"json",url:url,data:{term:term},success:function(response){if(defaultListing.hide(),searchListing.empty(),0===response.items.length){var linkhtml="<li>No documentation found</li>";searchListing.append(linkhtml)}_.each(response.items,function(item){var itemData={name:item.Fields.nodeName,body:_.escape(item.Fields.body.substring(0,150)),url:item.Fields.url};searchListing.append(template(itemData))})}})}}),$(".search-input").keydown(redirectToSearch).keyup(function(ev){var term=this.value;if(0===term.length&&$(".search-all").removeClass("open"),13===ev.keyCode&&(ev.preventDefault(),window.location="/search?term="+term),term.length>3){var url="/umbraco/api/OurSearch/GetGlobalSearchResults",template=_.template($("script.search-item-template").html());$.ajax({dataType:"json",url:url,data:{term:term},success:function(response){if($(".search-all").addClass("open"),$(".search-all ul").empty(),_.each(response.items,function(item){var type=item.Fields.nodeTypeAlias,icon="icon-Chat";"documentation"===type&&(icon="icon-Book-alt"),"project"===type&&(icon="icon-Box");var itemData={icon:icon,name:item.Fields.nodeName,description:_.escape(item.Fields.body.substring(0,100)),url:item.Fields.url};$(".search-all ul").append(template(itemData))}),response.items.length>0){var linkhtml='<li class="search-view-all"><a href="/search?q='+response.term+'">View All results</a></li>';$(".search-all ul").append(linkhtml)}else $(".search-all ul").append("<li>No results</li>")}})}}),$("#toggle").click(function(e){e.preventDefault(),$(".cross").toggleClass("open"),$("nav").toggleClass("open")}),jQuery(".nuget").click(function(){$(this).focus(),$(this).select()});var ink,d,x,y;$(".button, .inked").click(function(e){0===$(this).find(".ink").length&&$(this).prepend("<div class='ink'></div>"),ink=$(this).find(".ink"),ink.removeClass("animate"),ink.height()||ink.width()||(d=Math.max($(this).outerWidth(),$(this).outerHeight()),ink.css({height:d,width:d})),x=e.pageX-$(this).offset().left-ink.width()/2,y=e.pageY-$(this).offset().top-ink.height()/2,ink.css({top:y+"px",left:x+"px"}).addClass("animate")})});var classOnScrollObject=function(selector,className,scrollDistance){this.item=$(selector),this.itemClass=className,this.scrollDistance=scrollDistance,this.classApplied=!1,this.scrollContainer=$(window),this.fromTop=this.scrollContainer.scrollTop()};classOnScrollObject.prototype.applyClass=function(){this.fromTop=this.scrollContainer.scrollTop(),this.fromTop>this.scrollDistance&&this.classApplied===!1?(this.classApplied=!0,this.item.addClass(this.itemClass)):this.fromTop<this.scrollDistance&&this.classApplied===!0&&(this.classApplied=!1,this.item.removeClass(this.itemClass))};
//underscore templating
_.templateSettings = {
interpolate: /\{\{(.+?)\}\}/g,
evaluate : /\{\[([\s\S]+?)\]\}/g
};
jQuery(document).ready(function (){
// Quick menu
var bodyVar = $('body'),
searchAll = $('.search-all');
$( ".user, .close" ).click(function(e) {
e.stopPropagation();
bodyVar.toggleClass( "quickmenu" );
});
$('.wrapper').on('click', function () {
bodyVar.removeClass('quickmenu');
});
function redirectToSearch(ev){
if(ev.keyCode === 13){
ev.preventDefault();
window.location = "/search?term="+this.value;
}
}
var projectSearch = _.debounce(function(ev) {
var term = $('.project-search-input').val();
var defaultListing = $('.projects-default-listing');
var searchListing = $('.projects-search-listing');
if(term.length === 0){
defaultListing.show();
searchListing.empty();
}
if(term.length > 3){
var url = "/umbraco/api/OurSearch/GetProjectSearchResults";
var template = _.template(
$( "script.search-item-project" ).html()
);
//get search from server
$.ajax({
dataType: "json",
url: url,
data: {term: term},
success: function(response){
//toggle and empty box
defaultListing.hide();
searchListing.empty();
if(response.items.length === 0){
var linkhtml = '<p>No results found</p>';
searchListing.append(linkhtml);
}
//iterate
_.each(response.items, function(item){
var image = (item.Fields.image && item.Fields.image.length > 0) ? item.Fields.image : "<i class='icon-Box'></i>";
var itemData = {
nodeName: item.Fields.nodeName,
body: _.escape(item.Fields.body.substring(0, 150)),
url: item.Fields.url,
karma: item.Fields.karma,
downloads: item.Fields.downloads,
versions: item.Fields.versions,
image: image
};
searchListing.append(
template( itemData )
);
});
}
});
}
}, 300);
var docsSearch = _.debounce(function(ev) {
var term = this.value;
var defaultListing = $('.docs-default-listing');
var searchListing = $('.docs-search-listing');
if(term.length === 0){
defaultListing.show();
searchListing.empty();
}
if(term.length > 3){
var url = "/umbraco/api/OurSearch/GetDocsSearchResults";
var template = _.template(
$( "script.search-item-docs" ).html()
);
//get search from server
$.ajax({
dataType: "json",
url: url,
data: {term: term},
success: function(response){
//toggle and empty box
defaultListing.hide();
searchListing.empty();
if(response.items.length === 0){
var linkhtml = '<li>No documentation found</li>';
searchListing.append(linkhtml);
}
//iterate
_.each(response.items, function(item){
var itemData = {
name: item.Fields.nodeName,
body: _.escape(item.Fields.body.substring(0, 150)),
url: item.Fields.url
};
searchListing.append(
template( itemData )
);
});
}
});
}
}, 300);
var forumSearch = _.debounce( function(ev) {
var term = this.value;
var defaultListing = $('.forum-default-listing');
var searchListing = $('.forum-search-listing');
console.log(term);
if(term.length === 0){
defaultListing.show();
searchListing.empty();
}
if(term.length > 3){
var url = "/umbraco/api/OurSearch/GetForumSearchResults";
var template = _.template(
$( "script.search-item-forum" ).html()
);
//get search from server
$.ajax({
dataType: "json",
url: url,
data: {term: term},
success: function(response){
//toggle and empty box
defaultListing.hide();
searchListing.empty();
if(response.items.length === 0){
var linkhtml = '<tr><td>No threads found</td></tr>';
searchListing.append(linkhtml);
}
//iterate
_.each(response.items, function(item){
var itemData = {
name: item.Fields.nodeName,
url: item.Fields.url,
hasAnswer: item.Fields.solved == 1,
replies: item.Fields.replies,
body: item.Fields.body.substring(0, 150),
forumUrl: item.Fields.parentId,
forumName: "Category",
updateDate: item.Fields.updateDate
};
searchListing.append(
template( itemData )
);
});
}
});
}
}, 300);
var globalSearch = _.debounce(function(ev) {
var term = this.value;
if(term.length === 0){
$('.search-all').removeClass('open');
}
if(ev.keyCode === 13){
ev.preventDefault();
window.location = "/search?term="+term;
}
if(term.length > 3){
var url = "/umbraco/api/OurSearch/GetGlobalSearchResults";
var template = _.template(
$( "script.search-item-template" ).html()
);
//get search from server
$.ajax({
dataType: "json",
url: url,
data: {term: term},
success: function(response){
//toggle and empty box
$('.search-all').addClass('open');
$('.search-all ul').empty();
//iterate
_.each(response.items, function(item){
//append as templated html
var type = item.Fields.nodeTypeAlias;
var icon = "icon-Chat";
if(type === "documentation"){
icon = "icon-Book-alt";
}
if(type === "project"){
icon = "icon-Box";
}
var itemData = {icon: icon, name: item.Fields.nodeName, description: _.escape(item.Fields.body.substring(0, 100)), url: item.Fields.url};
$('.search-all ul').append(
template( itemData )
);
});
if(response.items.length > 0){
var linkhtml = '<li class="search-view-all"><a href="/search?q=' + response.term + '">View All results</a></li>';
$('.search-all ul').append(linkhtml);
}else{
$('.search-all ul').append("<li>No results</li>");
}
}
});
}
}, 300);
//docs search form
$('.docs-search-input')
.keydown(redirectToSearch)
.keyup(docsSearch);
//forum search form
$('.forum-search-input')
.keydown(redirectToSearch)
.keyup( forumSearch );
// Frontpage search form
$('.search-input')
.keydown(redirectToSearch)
.keyup(globalSearch);
//project search form
$('.project-search-input')
.keydown(redirectToSearch)
.keyup(projectSearch);
// Mobile navigation
$("#toggle").click(function(e) {
e.preventDefault();
$(".cross").toggleClass("open");
$("nav").toggleClass("open");
});
jQuery('.nuget').click(function(){
$(this).focus();
$(this).select();
});
// Tab
$('.tabs li').click(function(){
var tab_id = $(this).attr('data-tab');
$('.tabs li').removeClass('current');
$('.tab-content').removeClass('current');
$(this).addClass('current');
$("#"+tab_id).addClass('current');
});
// temporary sidebar fuctionality
$('.level-1 li').on('click', function (e) {
e.preventDefault();
var bla = $(this).parent();
$('.sidebar-content nav li').removeClass('active');
$(this).parent('li').toggleClass('active');
$(this).parent().siblings('li').removeClass('open');
$(this).parent('li').toggleClass('open');
console.log(bla);
});
// Click effect
var ink, d, x, y;
$(".button, .inked").click(function(e){
if($(this).find(".ink").length === 0){
$(this).prepend("<div class='ink'></div>");
}
ink = $(this).find(".ink");
ink.removeClass("animate");
if(!ink.height() && !ink.width()){
d = Math.max($(this).outerWidth(), $(this).outerHeight());
ink.css({height: d, width: d});
}
x = e.pageX - $(this).offset().left - ink.width()/2;
y = e.pageY - $(this).offset().top - ink.height()/2;
ink.css({top: y+'px', left: x+'px'}).addClass("animate");
});
});
var classOnScrollObject = function (selector, className, scrollDistance) {
this.item = $(selector);
this.itemClass = className;
this.scrollDistance = scrollDistance;
this.classApplied = false;
this.scrollContainer = $(window);
this.fromTop = this.scrollContainer.scrollTop();
};
classOnScrollObject.prototype.applyClass = function() {
this.fromTop = this.scrollContainer.scrollTop();
if (this.fromTop > this.scrollDistance && this.classApplied === false) {
this.classApplied = true;
this.item.addClass(this.itemClass);
} else if (this.fromTop < this.scrollDistance && this.classApplied === true) {
this.classApplied = false;
this.item.removeClass(this.itemClass);
}
};
function classOnScroll (selector, className, scrollDistance) {
var newClassOnScroll = new classOnScrollObject(selector, className, scrollDistance);
newClassOnScroll.applyClass();
newClassOnScroll.scrollContainer.scroll(function () {
newClassOnScroll.applyClass();
});
}
+2 -2
View File
@@ -14,7 +14,7 @@
<RootNamespace>OurUmbraco.Site</RootNamespace>
<AssemblyName>OurUmbraco.Site</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<UseIISExpress>false</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
@@ -4707,7 +4707,7 @@
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>24292</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:5555</IISUrl>
<IISUrl>http://our.local</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
@@ -44,13 +44,11 @@
</thead>
<!-- FORUM LIST HEADER END -->
<!-- FORUM LIST OF THREADS START -->
<tbody>
<tbody class="forum-default-listing">
<!-- FORUM THREAD START -->
@foreach (var topic in topics.Items)
{
{
<tr class="@Umbraco.If(topic.Answer > 0, "solved")">
@@ -77,10 +75,14 @@
</tbody>
<tbody class="forum-search-listing">
</tbody>
<!-- FORUM LIST OF THREADS START -->
</table>
<!-- FORUM LIST END -->
<!-- Template for scrolling - yes these 2 should be merged together -->
<script id="forum-template" type="x-tmpl-mustache">
{{#.}}
<tr class="{{#hasAnswer}}solved{{/hasAnswer}}">
@@ -95,5 +97,16 @@
{{/.}}
</script>
<!-- Template for search -->
<script type="text/template" class="search-item-forum">
<tr class="{[if(hasAnswer === 1){]}solved{[ } ]}">
<td class="topic">
<a href="{{url}}">{{name}}</a>
<span>{{body}}</span>
</td>
<td class="category frontend"><a href="{{forumUrl}}">{{forumName}}</a></td>
<td class="posts">{{replies}}</td>
<td class="activity" title="{{updateDate}}">{{updateDate}}</td>
</tr>
</script>
+4 -4
View File
@@ -5,7 +5,7 @@
Layout = "~/Views/Layout.cshtml";
}
<div class="plain">
<!-- search OVERVIEW START -->
<section class="search-results">
<div>
@@ -33,8 +33,7 @@
<div class="search-all-results equalizer">
@foreach (var result in Model.Content.Results.SearchResults)
{
{
<a href="@result.FullUrl()">
<div class="type-icon">
<i class="@result.GetIcon()"></i>
@@ -52,4 +51,5 @@
</div>
</section>
<!-- search OVERVIEW END -->
<!-- search OVERVIEW END -->
</div>
+21 -11
View File
@@ -35,18 +35,28 @@ More information and documentation can be found on CodePlex: http://umbracoexami
<IndexUserFields>
<add Name="nodeName" />
<add Name="body" />
<add Name="Created" EnableSorting="true" Type="DateTime" />
<add Name="Exists" />
<add Name="LatestComment" />
<add Name="LatestReplyAuthor" />
<add Name="Locked" />
<add Name="MemberId" />
<add Name="ParentId" />
<add Name="Replies" />
<add Name="UrlName" />
<add Name="CommentsContent" />
<add Name="nodeTypeAlias" />
<add Name="updateDate" EnableSorting="true" Type="DateTime" />
<add Name="url" />
<add Name="createDate" EnableSorting="true" Type="DateTime" />
<add Name="latestCommentId" />
<add Name="latestReplyAuthorId" />
<add Name="latestReplyAuthorName" />
<add Name="authorId" />
<add Name="authorName" />
<add Name="parentId" />
<add Name="parentName" />
<add Name="replies" />
<add Name="locked" />
<add Name="solved" />
<add Name="version" />
</IndexUserFields>
<IncludeNodeTypes/>
<ExcludeNodeTypes />
@@ -81,7 +91,7 @@ More information and documentation can be found on CodePlex: http://umbracoexami
<add Name="url"/>
<add Name="nodeTypeAlias" />
<add Name="popularity" EnableSorting="true" Type="DateTime" />
<add Name="popularity" EnableSorting="true" Type="INT" />
<add Name="karma" EnableSorting="true" Type="INT" />
<add Name="downloads" EnableSorting="true" Type="INT" />
<add Name="image" />
@@ -32,7 +32,7 @@ More information and documentation can be found on CodePlex: http://umbracoexami
<add name="projectIndexer" type="Examine.LuceneEngine.Providers.SimpleDataIndexer, Examine"
indexSet="projectIndexSet"
dataService="our.Examine.ProjectNodeIndexDataService, our.umbraco.org"
analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
analyzer="our.Examine.ProjectAnalyzer, our.umbraco.org"
indexTypes="project"/>
</providers>
@@ -51,7 +51,7 @@ More information and documentation can be found on CodePlex: http://umbracoexami
<add name="ForumSearcher" type="Examine.LuceneEngine.Providers.LuceneSearcher, Examine" />
<add name="projectSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>
analyzer="our.Examine.ProjectAnalyzer, our.umbraco.org"/>
<add name="documentationSearcher"
type="Examine.LuceneEngine.Providers.LuceneSearcher, Examine"
@@ -123,7 +123,7 @@
public static string ShortenText(string text)
{
text = our.Utills.StripHTML(text).Replace("&nbsp;", "");
text = our.Utils.StripHTML(text).Replace("&nbsp;", "");
if (text.Length > 210)
{
@@ -308,7 +308,7 @@
public static string ShortenText(string text)
{
text = our.Utills.StripHTML(text).Replace("&nbsp;", "");
text = our.Utils.StripHTML(text).Replace("&nbsp;", "");
if (text.Length > 210)
{
+8 -4
View File
@@ -9,14 +9,18 @@
<umbraco:Macro linkToCurrent="1" Alias="Breadcrumb" runat="server"></umbraco:Macro>
<!-- FORUM BREADCRUMB END -->
<umbraco:Macro Alias="[Forum]ForumActions" runat="server"></umbraco:Macro>
<umbraco:Macro Alias="[Forum]ForumActions" runat="server"></umbraco:Macro>
</div>
<div class="clear"></div>
<!-- FORUM HEADER END -->
<!-- FORUM Search START -->
<div class="search-big">
<input type="search" class="forum-search-input" required placeholder="Search for threads">
<label for="search">Search for threads</label>
</div>
<!-- FORUM TOPICS -->
<umbraco:Macro Alias="[Forum]Forum" runat="server"></umbraco:Macro>
</div>
+232 -14
View File
@@ -1,21 +1,239 @@
<%@ Master Language="C#" MasterPageFile="~/masterpages/Master.master" AutoEventWireup="true" %>
<asp:Content ContentPlaceHolderId="Main" runat="server">
<div id="body" class="subpage">
<asp:Content ContentPlaceHolderID="Main" runat="server">
<umbraco:Macro linkToCurrent="0" Alias="Breadcrumb" runat="server"></umbraco:Macro>
<section class="search-results">
<div>
<!-- FORUM HEADER START -->
<div class="forum-archive-header">
<umbraco:Macro linkToCurrent="0" Alias="Breadcrumb" runat="server"></umbraco:Macro>
<div class="clear"></div>
</div>
<h1><umbraco:Item Field="name" runat="server" /></h1>
<section class="package-detail">
<div class="container">
<div class="row">
<div id="forum" style="width:620px; margin-left: 75px">
<div class="col-md-7">
<div class="package-detail-content">
<% if( umbraco.presentation.nodeFactory.Node.GetCurrent().Children.Count > 0 ){ %>
<h3>Package discussions</h3>
<%
}
%>
<div class="vote"><i class="icon-Hearts"></i><span>431 votes</span></div>
</div>
</div>
</asp:Content>
<div class="package-detail-description">
<h1>Umbraco Forms</h1>
<img class="hero-image" src="https://s3.amazonaws.com/f.cl.ly/items/3q1w1O3m3r0L202i1H0o/Untitled-2.gif" alt="">
<p class="hero">Everyone deserves a form creator that's as easy to use as Umbraco, so we built just that. Whether it's a simple contact form or an advanced multi-step questionaire that integrates with 3rd party services - it'll be a breeze. <a href="#">http://umbraco.com/forms</a></p>
<h3>Intuitive</h3>
<p>Creating forms is as easy as editing content in Umbraco and it's a seamlessly integrated experience. You can select from a range of well known input types, select validation rules, and even conditions - for instance "only show this field if the visitor answered 'Yes'". All through an intuitive and robust user interface.</p>
<h3>Workflows</h3>
<p>While it's nice to gather data, it's even better when it's put to use. That's why Umbraco Forms lets you setup advanced workflows that can send e-mails, update webservices, save in CRM systems, and much more.</p>
<h3>Reporting</h3>
<p>Once your visitors have filled out forms, you can easily browse and search through the data using the built-in reporting tool or download the data for more advanced processing in Microsoft Excel or Google Spreadsheets.</p>
</div>
<div class="package-detail-screenshots">
<h3>Screenshots</h3>
<div class="row">
<div class="col-xs-4 col-md-3">
<a href="#">
<img src="https://our.umbraco.org/media/wiki/22596/635520271386064649_CourierContextMenuPNG.PNG" alt="">
</a>
</div>
<div class="col-xs-4 col-md-3">
<a href="#">
<img src="https://our.umbraco.org/media/wiki/22596/635520271386064649_CourierContextMenuPNG.PNG" alt="">
</a>
</div>
<div class="col-xs-4 col-md-3">
<a href="#">
<img src="https://our.umbraco.org/media/wiki/22596/635520271386064649_CourierContextMenuPNG.PNG" alt="">
</a>
</div>
<div class="col-xs-4 col-md-3">
<a href="#">
<img src="https://our.umbraco.org/media/wiki/22596/635520271386064649_CourierContextMenuPNG.PNG" alt="">
</a>
</div>
<div class="col-xs-4 col-md-3">
<a href="#">
<img src="https://our.umbraco.org/media/wiki/22596/635520271386064649_CourierContextMenuPNG.PNG" alt="">
</a>
</div>
<div class="col-xs-4 col-md-3">
<a href="#">
<img src="https://our.umbraco.org/media/wiki/22596/635520271386064649_CourierContextMenuPNG.PNG" alt="">
</a>
</div>
<div class="col-xs-4 col-md-3">
<a href="#">
<img src="https://our.umbraco.org/media/wiki/22596/635520271386064649_CourierContextMenuPNG.PNG" alt="">
</a>
</div>
<div class="col-xs-4 col-md-3">
<a href="#">
<img src="https://our.umbraco.org/media/wiki/22596/635520271386064649_CourierContextMenuPNG.PNG" alt="">
</a>
</div>
</div>
</div>
<div class="package-misc">
<ul class="tabs">
<li>
<input type="radio" name="tabs" id="tab1" checked />
<label for="tab1">Package files</label>
<div id="tab-content1" class="tab-content">
<h3>Package files</h3>
<p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
</div>
</li>
<li>
<input type="radio" name="tabs" id="tab2" />
<label for="tab2">Upgrade files</label>
<div id="tab-content2" class="tab-content">
<h3>Upgrade files</h3>
<p>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla?</p>
</div>
</li>
<li>
<input type="radio" name="tabs" id="tab3" />
<label for="tab3">Documentation</label>
<div id="tab-content2" class="tab-content">
<h3>Documentation</h3>
<p>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla?</p>
</div>
</li>
<li>
<input type="radio" name="tabs" id="tab4" />
<label for="tab4">Resources</label>
<div id="tab-content2" class="tab-content">
<h3>Resources</h3>
<p>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla?</p>
</div>
</li>
<li>
<input type="radio" name="tabs" id="tab5" />
<label for="tab5">Archived files</label>
<div id="tab-content2" class="tab-content">
<h3>Archived files</h3>
<p>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla?</p>
</div>
</li>
</ul>
<br style="clear: both;" />
</div>
</div>
</div>
<div class="col-md-4 col-md-offset-1">
<div class="package-detail-sidebar">
<a href="" class="button green">Download package
</a>
<div class="package-creator">
<h3>Project owner</h3>
<div class="row">
<div class="col-xs-12">
<div class="package-creator-information">
<img src="https://s3.amazonaws.com/uifaces/faces/twitter/anoff/128.jpg" alt="">
<div class="text">
<h3>
<a href="#">Emmaline Von Dominica
</a>
</h3>
<small>Emmaline has godt 1 billion karma points</small>
</div>
</div>
</div>
</div>
</div>
<div class="package-compatibility">
<h3>Project Compatibility</h3>
<small>This project is compatible with the following versions as reported by community members who have downloaded this package:</small>
<div class="package-compatibility-versions">
<div class="versions">
<span class="smiley untested">7.2.x (untested)</span>
<span class="smiley happy">7.1.x (91%)</span>
<span class="smiley joyous">7.0.x (100%)</span>
<span class="smiley untested">6.2.x (untested)</span>
<span class="smiley superUnhappy">6.1.x (0%)</span>
<span class="smiley superUnhappy">6.0.x (0%)</span>
<span class="smiley superUnhappy">4.11.x (0%)</span>
<span class="smiley superUnhappy">4.10.0 (0%)</span>
<span class="smiley superUnhappy">4.9.1 (0%)</span>
<span class="smiley superUnhappy">4.9.0 (0%)</span>
</div>
<strong>.NET Version:</strong>4.0
<br>
<strong>Supports Medium Trust:</strong>No
</div>
</div>
<div class="package-compatibility-information">
<h3>Project Information</h3>
<ul>
<li>
<span>Project owner:</span> Per Ploug
</li>
<li>
<span>Contributors:</span> Tim Geyssens
</li>
<li>
<span>Created:</span> Sunday, March 21, 2010
</li>
<li>
<span>Is Stable:</span> Current version
</li>
<li>
<span>Current version</span> Current version
</li>
<li>
<span>License</span> MIT
</li>
<li>
<span>Tags</span> Contour
</li>
<li>
<span>Downloads:</span>4482
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</section>
</asp:Content>
+3 -3
View File
@@ -10,7 +10,7 @@
<nav>
<ul class="level-1">
<li class="open">
<a><h3>Projects</h3></a>
<h3>Projects</h3>
<ul class="level-2">
<li><h4><a href="?orderBy=updateDate">Newest projects</a></h4></li>
<li><h4><a href="?orderBy=popularity">Popular projects</a></h4></li>
@@ -18,7 +18,7 @@
</li>
<li>
<a href><h3>By Version</h3></a>
<h3>By Version</h3>
<ul class="level-2">
<li><h4><a href="#">Version 7</a></h4></li>
<li><h4><a href="#">Version 6</a></h4></li>
@@ -27,7 +27,7 @@
</li>
<li >
<a href><h3>By Category</h3></a>
<h3>By Category</h3>
<umbraco:Macro Alias="[Projects]ListCategories" runat="server"></umbraco:Macro>
</li>
@@ -58,80 +58,12 @@
</div>
<div class="markdown-syntax">
<h1>All Releases</h1>
<p><em>This page lists all of the available Umbraco releases. Past, present and future.</em></p>
</div><!-- #markdown-docs -->
<div class="row">
<div class="col-xs-3">
<span class="dot big icon-untitled">
<span class="line v-line"></span>
<span class="line h-line"></span>
</span>
<umbraco:Macro ID="Macro1" runat="server" Language="cshtml">
@using uRelease
@{
var properlySortedVersions = new Dictionary<System.Version, umbraco.MacroEngines.DynamicNode>();
int result = 0;
foreach(var release in Model.Children) {
if(release.ReleaseStatus == "Released" && release.RecommendedRelease == false) {
result++;
}
}
<div data-bind="template: { name: 'releases-template', foreach: currentReleases }"></div>
for (int i = 0; i < result; i += 2) {
if (i != result-2 || i != result-3) {
<span class="dot small">
<span class="line v-line"></span>
<span class="line h-line"></span>
</span>
}else{
<span class="dot small">
<span class="line h-line"></span>
</span>
}
}
}
</umbraco:Macro>
</div>
<div class="col-xs-9">
<div class="row explain">
<div class="dl-content" data-bind="template: { name: 'releases-template', foreach: currentReleases }">
</div>
<umbraco:Macro ID="Macro2" runat="server" Language="cshtml">
@{
var properlySortedVersions = new Dictionary<System.Version, umbraco.MacroEngines.DynamicNode>();
foreach(var release in Model.Children) {
if(release.ReleaseStatus == "Released" && release.RecommendedRelease == false) {
properlySortedVersions.Add(new System.Version(release.Name), release);
}
}
}
@foreach(var item in properlySortedVersions.OrderByDescending(x => x.Key)) {
umbraco.MacroEngines.DynamicNode release = item.Value;
<div class="col-xs-6">
@* Archived releases don't exist on YouTrack, so they need an alternative template *@
@if(release.GetProperty("Archived") != null && release.GetProperty("Archived").Value == "1"){
<h5><a href="/contribute/releases/@(release.Name.Replace(".", ""))/ArchivedRelease/">v @release.Name</a></h5>
<small>What is needed to run Umbraco?</small>
} else {
<h5><a href="/contribute/releases/@(release.Name.Replace(".", ""))/"> @release.Name</a></h5>
<small>What is needed to run Umbraco?</small>
}
</div>
}
</umbraco:Macro>
</div>
</div>
</div>
<umbraco:Macro Alias="[Releases]AllReleases" runat="server" />
</div>
@@ -143,12 +75,22 @@
</div>
<script type="text/html" id="releases-template">
<h1>Recommended release</h1>
<em>Want the latest stable release - we recommend this one</em>
<div class="col-xs-12">
<h4><a data-bind="text: releaseStatus() === null ? 'v' + version() : 'v' + version() + '-' + releaseStatus().toLowerCase(), attr: { href: '/contribute/releases/' + version().replace('.', '').replace('.', '').replace('.', '') }">v6.2.4</a></h5>
<small data-bind="visible: (releaseDescription().length > 0)"><span data-bind=" html: releaseDescription"></span></small>
</div>
<div class="row">
<div class="col-xs-3">
<span class="dot big icon-untitled"><span class="line h-line"></span></span>
</div>
<div class="col-xs-9">
<div class="row explain">
<div class="col-xs-12">
<h4><a data-bind="text: releaseStatus() === null ? 'v' + version() : 'v' + version() + '-' + releaseStatus().toLowerCase(), attr: { href: '/contribute/releases/' + version().replace('.', '').replace('.', '').replace('.', '') }">v6.2.4</a></h4>
<small data-bind="visible: (releaseDescription().length > 0)"><span data-bind=" html: releaseDescription"></span></small>
</div>
</div>
</div>
</div>
</script>
<script type="text/javascript">
+3 -3
View File
@@ -111,8 +111,8 @@
<!-- REMOVE FOR BETA -->
<!-- added by NH to test foreign membership providers-->
<connectionStrings>
<add name="umbracoDbDSN" connectionString="server=.\SQLExpress;database=our.umbraco.org.live;user id=sa;password=test" providerName="System.Data.SqlClient" />
<add name="Marketplace.Data.Properties.Settings.ourConnectionString" connectionString="Data Source=.\SQLExpress;Initial Catalog=our.umbraco.org.live;User ID=sa;Password=test" providerName="System.Data.SqlClient" />
<add name="umbracoDbDSN" connectionString="server=.\SQLExpress;database=our.umbraco.org.live;user id=web;password=farmer" providerName="System.Data.SqlClient" />
<add name="Marketplace.Data.Properties.Settings.ourConnectionString" connectionString="Data Source=.\SQLExpress;Initial Catalog=our.umbraco.org.live;User ID=web;Password=farmer" providerName="System.Data.SqlClient" />
<!--<add name="Elmah.SqlErrorLog" connectionString="Data Source=.\SQLExpress;Initial Catalog=our.umbraco.org.elmah.live;user id=sa;password=abc123" providerName="System.Data.SqlClient" />-->
</connectionStrings>
<MarketplaceProviders default="ListingProvider">
@@ -146,7 +146,7 @@
-->
<system.web>
<!-- <trust level="Medium" originUrl=".*" />-->
<customErrors mode="RemoteOnly" />
<customErrors mode="Off" />
<trace enabled="true" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
<globalization culture="en-US" requestEncoding="UTF-8" responseEncoding="UTF-8" uiCulture="en-US" />
<xhtmlConformance mode="Strict" />
+17
View File
@@ -0,0 +1,17 @@
MSYS-1.0.12 Build:2012-07-05 14:56
Exception: STATUS_ACCESS_VIOLATION at eip=6C61506D
eax=6C61506D ebx=685704CC ecx=0059255C edx=68577845 esi=00000000 edi=685700D4
ebp=0028FE9C esp=0028FE70 program=C:\Users\runehs\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin\mv.exe
cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame Function Args
0028FE9C 6C61506D (685700D4, 00000104, 00000003, 004244EA)
0028FEEC 0042466B (00000000, 00000000, 0028FF2C, 00413C70)
0028FF0C 00424C5F (00401E50, 00000000, 00000001, FFFFD000)
0028FF2C 00424C98 (00000000, 00000000, C26687EA, FFFFF801)
0028FF5C 00413B80 (00401E50, FFFFFFFF, 01B956A8, FFFFE000)
0028FF8C 0040103D (7FFDE000, 0028FFDC, 77E18F8B, 7FFDE000)
0028FF98 75B0A534 (7FFDE000, 06FB40CB, 00000000, 00000000)
0028FFDC 77E18F8B (FFFFFFFF, 77E0DAE9, 00000000, 00000000)
0028FFEC 77E18F61 (00401000, 7FFDE000, 00000000, 78746341)
End of stack trace
+8 -1
View File
@@ -15,7 +15,7 @@ namespace our.Api
{
public SearchResultModel GetGlobalSearchResults(string term)
{
var searcher = new OurSearcher(term);
var searcher = new OurSearcher(term, maxResults: 5);
var searchResult = searcher.Search();
return searchResult;
}
@@ -34,5 +34,12 @@ namespace our.Api
var searchResult = searcher.Search();
return searchResult;
}
public SearchResultModel GetForumSearchResults(string term)
{
var searcher = new OurSearcher(term, nodeTypeAlias: "forum");
var searchResult = searcher.Search();
return searchResult;
}
}
}
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using System.Web.Mvc;
using Examine;
using Examine.LuceneEngine.Providers;
using our.Examine;
using our.Models;
using Umbraco.Web.Models;
@@ -17,22 +18,12 @@ namespace our.Controllers
public ActionResult Search(RenderModel model, string term)
{
var multiIndexSearchProvider = (MultiIndexSearcher)ExamineManager.Instance.SearchProviderCollection["MultiIndexSearcher"];
var ourSearcher = new OurSearcher(term, maxResults: 100);
var criteria = multiIndexSearchProvider.CreateSearchCriteria();
var compiled = criteria
.GroupedOr(new[] { "Body", "bodyText", "description", "nodeName" }, term)
.Compile();
var watch = new Stopwatch();
watch.Start();
//TODO: The result.TotalSearchResults will yield a max of 100 which is incorrect, this is an issue
// in Examine, it needs to limit the results to 100 but still tell you how many in total
var result = multiIndexSearchProvider.Search(compiled, 100);
watch.Stop();
var results = ourSearcher.Search();
return View(new RenderModel<SearchResultContentModel>(
new SearchResultContentModel(model.Content, new SearchResultModel(result, watch.ElapsedMilliseconds, term, ""))));
new SearchResultContentModel(model.Content, results)));
}
}
@@ -4,6 +4,7 @@ using System.Web.Hosting;
using System.Web.Mvc;
using System.Web.Routing;
using Examine;
using Examine.LuceneEngine.Providers;
using our.Examine;
using uDocumentation.Busineslogic;
using Umbraco.Core;
@@ -40,12 +41,17 @@ namespace our.CustomHandlers
private void BindExamineEvents()
{
ExamineManager.Instance.IndexProviderCollection["projectIndexer"].GatheringNodeData += ProjectNodeIndexDataService.ProjectIndexer_GatheringNodeData;
var projectIndexer = (LuceneIndexer)ExamineManager.Instance.IndexProviderCollection["projectIndexer"];
projectIndexer.GatheringNodeData += ProjectNodeIndexDataService.ProjectIndexer_GatheringNodeData;
projectIndexer.DocumentWriting += ProjectNodeIndexDataService.ProjectIndexer_DocumentWriting;
//handle errors for non-umbraco indexers
ExamineManager.Instance.IndexProviderCollection["projectIndexer"].IndexingError += ExamineHelper.LogErrors;
ExamineManager.Instance.IndexProviderCollection["documentationIndexer"].IndexingError += ExamineHelper.LogErrors;
ExamineManager.Instance.IndexProviderCollection["ForumIndexer"].IndexingError += ExamineHelper.LogErrors;
}
/// <summary>
/// Whenever the github zip downloader completes and docs index is rebuilt
/// </summary>
@@ -43,7 +43,7 @@ namespace our.CustomHandlers {
e.ReceiverId = (int)d.getProperty("owner").Value;
e.ExtraReceivers = Utills.GetProjectContributors(d.Id);
e.ExtraReceivers = Utils.GetProjectContributors(d.Id);
}
}
}
+44 -146
View File
@@ -8,6 +8,8 @@ using uForum.Models;
using uForum.Services;
//WB Added
using uForum;
namespace our.Examine
{
@@ -20,16 +22,44 @@ namespace our.Examine
private static readonly object _locker = new object();
public static SimpleDataSet MapTopicToSimpleDataIndexItem(Topic topic, IEnumerable<Comment> comments, SimpleDataSet simpleDataSet, int id, string indexType)
{
//First generate the accumulated comment text:
string commentText = String.Empty;
#region ISimpleDataService Members
foreach (var currentComment in comments)
commentText += currentComment.Body;
/// <summary>
/// Returns a list of type SimpleDataSet based on the SampleData.xml data
/// </summary>
/// <param name="indexType"></param>
/// <returns></returns>
///
var body = umbraco.library.StripHtml(topic.Body + commentText);
simpleDataSet.NodeDefinition.NodeId = id;
simpleDataSet.NodeDefinition.Type = indexType;
simpleDataSet.RowData.Add("body", body);
simpleDataSet.RowData.Add("nodeName", topic.Title);
simpleDataSet.RowData.Add("updateDate", topic.Updated.ToString("yyyy-MM-dd HH:mm:ss"));
simpleDataSet.RowData.Add("nodeTypeAlias", "forum");
simpleDataSet.RowData.Add("url", topic.Url);
simpleDataSet.RowData.Add("createDate", topic.Created.ToString("yyyy-MM-dd HH:mm:ss"));
simpleDataSet.RowData.Add("latestCommentId", topic.LatestComment.ToString());
simpleDataSet.RowData.Add("latestReplyAuthorId", topic.LatestReplyAuthor.ToString());
simpleDataSet.RowData.Add("latestReplyAuthorName", topic.LastActiveMember().Name);
simpleDataSet.RowData.Add("authorId", topic.MemberId.ToString());
simpleDataSet.RowData.Add("authorName", topic.Author().Name);
simpleDataSet.RowData.Add("parentId", topic.ParentId.ToString());
simpleDataSet.RowData.Add("replies", topic.Replies.ToString());
simpleDataSet.RowData.Add("locked", topic.Locked.ToString());
simpleDataSet.RowData.Add("solved", topic.Answer.ToString());
simpleDataSet.RowData.Add("version", topic.Version.ToString());
return simpleDataSet;
}
public IEnumerable<SimpleDataSet> GetAllData(string indexType)
{
@@ -38,47 +68,13 @@ namespace our.Examine
using(var ts = new TopicService())
using (var cs = new CommentService())
{
foreach (var currentTopic in ts.GetAll().Take(1000))
foreach (var topic in ts.GetAll().Take(1000))
{
//First generate the accumulated comment text:
string commentText = String.Empty;
foreach (var currentComment in cs.GetComments(currentTopic.Id))
commentText += umbraco.library.StripHtml(currentComment.Body);
var body = currentTopic.Body + commentText;
var comments = cs.GetComments(topic.Id);
//Add the item to the index..
data.Add(new SimpleDataSet()
{
//Create the node definition, ensure that it is the same type as referenced in the config
NodeDefinition = new IndexedNode()
{
NodeId = currentTopic.Id,
Type = "forum"
},
//add the data to the row
RowData = new Dictionary<string, string>()
{
{ "nodeName", SanitizeXmlString(currentTopic.Title.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty))},
{ "body", SanitizeXmlString(umbraco.library.StripHtml(body.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty)))},
{ "updateDate", currentTopic.Updated.ToString("yyyy-MM-dd HH:mm:ss")},
{ "url", currentTopic.Url},
{ "nodeTypeAlias","forum"},
{ "Created", currentTopic.Created.ToString("yyyy-MM-dd HH:mm:ss")},
{ "LatestComment", currentTopic.LatestComment.ToString()},
{ "LatestReplyAuthor", currentTopic.LatestReplyAuthor.ToString()},
{ "Locked", currentTopic.Locked.ToString()},
{ "MemberId", currentTopic.MemberId.ToString()},
{ "ParentId", currentTopic.ParentId.ToString()},
{ "Replies", currentTopic.Replies.ToString()},
{ "UrlName", currentTopic.UrlName.ToString()}
}
});
//
var simpleDataSet = new SimpleDataSet { NodeDefinition = new IndexedNode(), RowData = new Dictionary<string, string>() };
data.Add(MapTopicToSimpleDataIndexItem(topic, comments, simpleDataSet, topic.Id, "forum"));
}
return data;
@@ -87,37 +83,6 @@ namespace our.Examine
}
public SimpleDataSet CreateNewDocument()
{
lock (_locker)
{
//JobDetailItem jobDetails = new JobDetailItem();
Topic forumTopic = new Topic();
//First generate the accumulated comment text:
string commentText = String.Empty;
return new SimpleDataSet()
{
NodeDefinition = new IndexedNode() { NodeId = (++_currentId), Type = "forum" },
RowData = new Dictionary<string, string>()
{
{ "Title", SanitizeXmlString(forumTopic.Title.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty))},
{ "Body", SanitizeXmlString(umbraco.library.StripHtml(forumTopic.Body.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty)))},
{ "Created", forumTopic.Created.ToString("yyyy-MM-dd HH:mm:ss")},
{ "LatestComment", forumTopic.LatestComment.ToString()},
{ "LatestReplyAuthor", forumTopic.LatestReplyAuthor.ToString()},
{ "Locked", forumTopic.Locked.ToString()},
{ "MemberId", forumTopic.MemberId.ToString()},
{ "ParentId", forumTopic.ParentId.ToString()},
{ "Replies", forumTopic.Replies.ToString()},
{ "UrlName", forumTopic.UrlName.ToString()},
{"nodeTypeAlias","forum"},
{ "updateDate", forumTopic.Updated.ToString("yyyy-MM-dd HH:mm:ss")},
{ "CommentsContent", SanitizeXmlString(commentText.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty))}
}
};
}
}
public SimpleDataSet CreateNewDocument(int id)
{
@@ -127,80 +92,13 @@ namespace our.Examine
using(var ts = new TopicService())
using (var cs = new CommentService())
{
var forumTopic = ts.GetById(id);
//First generate the accumulated comment text:
string commentText = String.Empty;
foreach (var currentComment in cs.GetComments(forumTopic.Id))
commentText += umbraco.library.StripHtml(currentComment.Body);
return new SimpleDataSet()
{
NodeDefinition = new IndexedNode() { NodeId = (id), Type = "forum" },
RowData = new Dictionary<string, string>()
{
{ "Title", SanitizeXmlString(forumTopic.Title.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty))},
{ "Body", SanitizeXmlString(umbraco.library.StripHtml(forumTopic.Body.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty)))},
{ "Created", forumTopic.Created.ToString("yyyy-MM-dd HH:mm:ss")},
{ "LatestComment", forumTopic.LatestComment.ToString()},
{ "LatestReplyAuthor", forumTopic.LatestReplyAuthor.ToString()},
{ "Locked", forumTopic.Locked.ToString()},
{ "MemberId", forumTopic.MemberId.ToString()},
{ "ParentId", forumTopic.ParentId.ToString()},
{ "Replies", forumTopic.Replies.ToString()},
{ "UrlName", forumTopic.UrlName.ToString()},
{"nodeTypeAlias","forum"},
{ "updateDate", forumTopic.Updated.ToString("yyyy-MM-dd HH:mm:ss")},
{ "CommentsContent", SanitizeXmlString(commentText.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty))}
}
};
var simpleDataSet = new SimpleDataSet { NodeDefinition = new IndexedNode(), RowData = new Dictionary<string, string>() };
return MapTopicToSimpleDataIndexItem(forumTopic, cs.GetComments(forumTopic.Id), simpleDataSet, forumTopic.Id, "forum");
}
}
}
/// <summary>
/// Remove illegal XML characters from a string.
/// </summary>
public string SanitizeXmlString(string xml)
{
if (xml == null)
{
throw new ArgumentNullException("xml");
}
StringBuilder buffer = new StringBuilder(xml.Length);
foreach (char c in xml)
{
if (IsLegalXmlChar(c))
{
buffer.Append(c);
}
}
return buffer.ToString();
}
/// <summary>
/// Whether a given character is allowed by XML 1.0.
/// </summary>
public bool IsLegalXmlChar(int character)
{
return
(
character == 0x9 /* == '\t' == 9 */ ||
character == 0xA /* == '\n' == 10 */ ||
character == 0xD /* == '\r' == 13 */ ||
(character >= 0x20 && character <= 0xD7FF) ||
(character >= 0xE000 && character <= 0xFFFD) ||
(character >= 0x10000 && character <= 0x10FFFF)
);
}
#endregion
}
+5 -3
View File
@@ -20,17 +20,20 @@ namespace our.Examine
public string Term { get; private set; }
public string NodeTypeAlias { get; set; }
public string OrderBy { get; set; }
public int MaxResults { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Object"/> class.
/// </summary>
public OurSearcher(string term, string nodeTypeAlias = null, string orderBy = null)
public OurSearcher(string term, string nodeTypeAlias = null, string orderBy = null, int maxResults = 20)
{
//if (string.IsNullOrWhiteSpace(term)) throw new ArgumentNullException("term", "term cannot be empty");
Term = term;
NodeTypeAlias = nodeTypeAlias;
OrderBy = orderBy;
MaxResults = maxResults;
}
public SearchResultModel Search()
@@ -70,8 +73,7 @@ namespace our.Examine
//TODO: The result.TotalSearchResults will yield a max of 100 which is incorrect, this is an issue
// in Examine, it needs to limit the results to 100 but still tell you how many in total
var result = multiIndexSearchProvider.Search(criteria, 100);
var result = multiIndexSearchProvider.Search(criteria, MaxResults);
watch.Stop();
@@ -0,0 +1,19 @@
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
namespace our.Examine
{
/// <summary>
/// Custom analyzer for projects so that we can have different analyzers per field
/// </summary>
public class ProjectAnalyzer : PerFieldAnalyzerWrapper
{
public ProjectAnalyzer()
: base(new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29))
{
//Add custom analyzer for versions field
AddAnalyzer("versions", new VersionAnalyzer());
}
}
}
@@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -6,6 +7,9 @@ using System.Web;
using System.Web.Hosting;
using Examine;
using Examine.LuceneEngine;
using Lucene.Net.Documents;
using Lucene.Net.Util;
using uWiki.Businesslogic;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -19,7 +23,8 @@ namespace our.Examine
/// </summary>
public class ProjectNodeIndexDataService : ISimpleDataService
{
public SimpleDataSet MapProjectToSimpleDataIndexItem(IPublishedContent project, SimpleDataSet simpleDataSet, int index, string indexType)
public SimpleDataSet MapProjectToSimpleDataIndexItem(IPublishedContent project, SimpleDataSet simpleDataSet, string indexType,
int karma, IEnumerable<WikiFile> files, int downloads)
{
simpleDataSet.NodeDefinition.NodeId = project.Id;
simpleDataSet.NodeDefinition.Type = indexType;
@@ -30,11 +35,6 @@ namespace our.Examine
simpleDataSet.RowData.Add("nodeTypeAlias", "project");
simpleDataSet.RowData.Add("url", project.Url );
var karma = our.Utills.GetProjectTotalKarma(project.Id);
var files = uWiki.Businesslogic.WikiFile.CurrentFiles(project.Id);
var downloads = our.Utills.GetProjectTotalDownloadCount(project.Id);
var image = files.FirstOrDefault(x => x.FileType == "screenshot");
var imageFile = "";
if (image != null)
@@ -54,7 +54,7 @@ namespace our.Examine
//popularity for sorting number = downloads + karma * 100;
var pop = downloads + (karma * 100);
simpleDataSet.RowData.Add("popularity", pop.ToString("D8"));
simpleDataSet.RowData.Add("popularity", pop.ToString());
simpleDataSet.RowData.Add("karma", karma.ToString());
simpleDataSet.RowData.Add("downloads", downloads.ToString());
simpleDataSet.RowData.Add("image", imageFile);
@@ -66,18 +66,26 @@ namespace our.Examine
public IEnumerable<SimpleDataSet> GetAllData(string indexType)
{
var dataSets = new List<SimpleDataSet>();
var projects = UmbracoContext.Current.ContentCache.GetByXPath("//Community/Projects//Project [projectLive='1']");
//index all projects
for (int i = 0; i < projects.Count(); i++)
var projects = UmbracoContext.Current.ContentCache.GetByXPath("//Community/Projects//Project [projectLive='1']").ToArray();
var allProjectIds = projects.Select(x => x.Id).ToArray();
var allProjectKarma = our.Utils.GetProjectTotalKarma();
var allProjectWikiFiles = uWiki.Businesslogic.WikiFile.CurrentFiles(allProjectIds);
var allProjectDownloads = our.Utils.GetProjectTotalDownload();
foreach (var project in projects)
{
var project = projects.ElementAt(i);
try
{
LogHelper.Debug(this.GetType(), "Indexing " + project.Name);
var simpleDataSet = new SimpleDataSet { NodeDefinition = new IndexedNode(), RowData = new Dictionary<string, string>() };
simpleDataSet = MapProjectToSimpleDataIndexItem(project, simpleDataSet, project.Id, indexType);
var projectDownloads = allProjectDownloads.ContainsKey(project.Id) ? allProjectDownloads[project.Id] : 0;
var projectKarma = allProjectKarma.ContainsKey(project.Id) ? allProjectKarma[project.Id] : 0;
var projectFiles = allProjectWikiFiles.ContainsKey(project.Id) ? allProjectWikiFiles[project.Id] : Enumerable.Empty<WikiFile>();
simpleDataSet = MapProjectToSimpleDataIndexItem(project, simpleDataSet, indexType, projectKarma, projectFiles, projectDownloads);
dataSets.Add(simpleDataSet);
}
catch (Exception ex)
@@ -89,6 +97,33 @@ namespace our.Examine
return dataSets;
}
/// <summary>
/// Handle custom Lucene indexing when the lucene document is writing
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public static void ProjectIndexer_DocumentWriting(object sender, DocumentWritingEventArgs e)
{
//TODO: This will be good to do but we need the bleeding edge version of examine v1.x which i haven't released yet
////If there is a versions field, we'll split it and index the same field on each version
//if (e.Fields.ContainsKey("versions"))
//{
// //split into separate versions
// var versions = e.Fields["versions"].Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
// //remove the current version field from the lucene doc
// e.Document.RemoveField("versions");
// foreach (var version in versions)
// {
// //add a 'versions' field for each version (same field name but different values)
// e.Document.Add(new Field("versions", version, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES));
// }
//}
}
/// <summary>
/// Need to ensures some custom data is added to this index
/// </summary>
@@ -0,0 +1,20 @@
using System.IO;
using Lucene.Net.Analysis;
namespace our.Examine
{
/// <summary>
/// Custom version field analyzer which uses the Version Tokenizer
/// </summary>
public class VersionAnalyzer : Analyzer
{
/// <summary>
/// Returns a VersionTokenizer
/// </summary>
public override TokenStream TokenStream(string fieldName, TextReader reader)
{
var tokenizer = new VersionTokenizer(reader);
return tokenizer;
}
}
}
@@ -0,0 +1,31 @@
using System.IO;
using Lucene.Net.Analysis;
namespace our.Examine
{
/// <summary>
/// Custom tokenizer to ensure that only version information is indexed
/// </summary>
public class VersionTokenizer : CharTokenizer
{
public VersionTokenizer(TextReader input) : base(input)
{
}
/// <summary>
/// Returns true if a character should be included in a token.
/// </summary>
/// <remarks>
/// Only accept numbers and decimal since this is what makes up a version
/// </remarks>
protected override bool IsTokenChar(char c)
{
if (char.IsNumber(c)) return true;
if (c == '.') return true;
//TODO: remove this when we start indexing versions with multiple values in the same field, see TODO in ProjectIndexer_DocumentWriting
// until then we'll also accept commas since that is what it is delimited by.
if (c == ',') return true;
return false;
}
}
}
+1 -1
View File
@@ -38,7 +38,7 @@ namespace our {
Document d = new Document( Document.GetContentFromVersion(new Guid(nodeguid)).Id );
Member mem = new Member(new Guid(userguid));
if (d.ContentType.Alias == "Project" && d.getProperty("owner") != null && (d.getProperty("owner").Value.ToString() == mem.Id.ToString() || Utills.IsProjectContributor(mem.Id,d.Id))) {
if (d.ContentType.Alias == "Project" && d.getProperty("owner") != null && (d.getProperty("owner").Value.ToString() == mem.Id.ToString() || Utils.IsProjectContributor(mem.Id,d.Id))) {
uWiki.Businesslogic.WikiFile.Create(fileName, new Guid(nodeguid), new Guid(userguid), file, fileType, v);
//the package publish handler will make sure we got the right versions info on the package node itself.
+7 -1
View File
@@ -40,7 +40,13 @@ namespace our
{
var content = umbracoHelper.TypedContent(item.Id);
var simpleDataSet = new SimpleDataSet { NodeDefinition = new IndexedNode(), RowData = new Dictionary<string, string>() };
simpleDataSet = ((ProjectNodeIndexDataService)indexer.DataService).MapProjectToSimpleDataIndexItem(content, simpleDataSet, item.Id, "project");
var karma = our.Utils.GetProjectTotalKarma(content.Id);
var files = uWiki.Businesslogic.WikiFile.CurrentFiles(content.Id);
var downloads = our.Utils.GetProjectTotalDownloadCount(content.Id);
simpleDataSet = ((ProjectNodeIndexDataService) indexer.DataService).MapProjectToSimpleDataIndexItem(content, simpleDataSet, "project", karma, files, downloads);
var xml = simpleDataSet.RowData.ToExamineXml(simpleDataSet.NodeDefinition.NodeId, simpleDataSet.NodeDefinition.Type);
indexer.ReIndexNode(xml, "project");
}
+7 -7
View File
@@ -55,10 +55,10 @@ namespace our.Rest
int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;
//Check if member is an admin (in group 'admin')
if (Utills.IsAdmin(_currentMember))
if (Utils.IsAdmin(_currentMember))
{
//Yep - it's valid, lets get that member
Member MemberToBlock = Utills.GetMember(memberId);
Member MemberToBlock = Utils.GetMember(memberId);
//Now we have the member - lets update the 'blocked' property on the member
MemberToBlock.getProperty("blocked").Value = true;
@@ -83,11 +83,11 @@ namespace our.Rest
int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;
//Check if member is an admin (in group 'admin')
if (Utills.IsAdmin(_currentMember))
if (Utils.IsAdmin(_currentMember))
{
//Yep - it's valid, lets get that member
Member MemberToBlock = Utills.GetMember(memberId);
Member MemberToBlock = Utils.GetMember(memberId);
//Now we have the member - lets update the 'blocked' property on the member
MemberToBlock.getProperty("blocked").Value = false;
@@ -110,11 +110,11 @@ namespace our.Rest
int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;
//Check if member is an admin (in group 'admin')
if (Utills.IsHq(_currentMember))
if (Utils.IsHq(_currentMember))
{
//Lets check the memberID of the member we are blocking passed into /base is a valid member..
//Yep - it's valid, lets get that member
var member = Utills.GetMember(memberId);
var member = Utils.GetMember(memberId);
Membership.DeleteUser(member.LoginName, true);
@@ -136,7 +136,7 @@ namespace our.Rest
int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;
//Check if member is an admin (in group 'admin')
if (Utills.IsHq(_currentMember))
if (Utils.IsHq(_currentMember))
{
var returnValue = string.Empty;
+22 -1
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using umbraco.cms.businesslogic.member;
@@ -8,7 +9,7 @@ using System.Xml.XPath;
namespace our {
[Umbraco.Core.Macros.XsltExtension("our.library")]
public class Utills {
public class Utils {
private static Regex _tags = new Regex("<[^>]*(>|$)", RegexOptions.Singleline | RegexOptions.ExplicitCapture | RegexOptions.Compiled);
private static Regex _whitelist = new Regex(@"
^</?(a|b(lockquote)?|code|em|h(1|2|3)|i|li|ol|p(re)?|s(ub|up|trong|trike)?|ul)>$
@@ -96,6 +97,26 @@ namespace our {
}
}
/// <summary>
/// Returns a dictionary of project id => total karma
/// </summary>
/// <returns></returns>
public static Dictionary<int, int> GetProjectTotalKarma()
{
return Umbraco.Core.ApplicationContext.Current.DatabaseContext.Database.Fetch<dynamic>("SELECT id, sum([points]) as points FROM [powersProject] GROUP BY id")
.ToDictionary(x => (int)x.id, x => (int)x.points);
}
/// <summary>
/// Returns a dictionary of project id => total downloads
/// </summary>
/// <returns></returns>
public static Dictionary<int, int> GetProjectTotalDownload()
{
return Umbraco.Core.ApplicationContext.Current.DatabaseContext.Database.Fetch<dynamic>("select projectId, count(*) as total from projectDownload GROUP BY projectId")
.ToDictionary(x => (int)x.projectId, x => (int)x.total);
}
public static int GetProjectFileDownloadCount(int fileId)
{
try
+3
View File
@@ -260,7 +260,10 @@
<Compile Include="CustomHandlers\projectVote.cs" />
<Compile Include="CustomHandlers\TopicVote.cs" />
<Compile Include="Examine\OurSearcher.cs" />
<Compile Include="Examine\ProjectAnalyzer.cs" />
<Compile Include="Examine\ProjectNodeIndexDataService.cs" />
<Compile Include="Examine\VersionAnalyzer.cs" />
<Compile Include="Examine\VersionTokenizer.cs" />
<Compile Include="Hiccup.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
@@ -82,7 +82,7 @@ namespace our.usercontrols
Document d = new Document(pId);
if ((int)d.getProperty("owner").Value == m.Id || Utills.IsProjectContributor(m.Id,d.Id))
if ((int)d.getProperty("owner").Value == m.Id || Utils.IsProjectContributor(m.Id,d.Id))
{
lt_title.Text = "Edit project";
@@ -199,7 +199,7 @@ namespace our.usercontrols
d = new Document(pId);
if ((int)d.getProperty("owner").Value == m.Id || Utills.IsProjectContributor(m.Id,d.Id))
if ((int)d.getProperty("owner").Value == m.Id || Utils.IsProjectContributor(m.Id,d.Id))
{
d.Text = tb_name.Text;
d.getProperty("version").Value = tb_version.Text;
@@ -27,7 +27,7 @@ namespace our.usercontrols {
uWiki.Businesslogic.WikiFile wf = new uWiki.Businesslogic.WikiFile( int.Parse(e.CommandArgument.ToString()) );
Member mem = Member.GetCurrentMember();
if(wf.CreatedBy == mem.Id || Utills.IsProjectContributor(mem.Id,pageId))
if(wf.CreatedBy == mem.Id || Utils.IsProjectContributor(mem.Id,pageId))
wf.Delete();
RebindFiles();
@@ -101,7 +101,7 @@ namespace our.usercontrols {
Document d = new Document(pageId);
if((d.getProperty("owner") != null && d.getProperty("owner").Value.ToString() == mem.Id.ToString()) ||
Utills.IsProjectContributor(mem.Id,pageId)){
Utils.IsProjectContributor(mem.Id,pageId)){
holder.Visible = true;
RebindFiles();
+9 -15
View File
@@ -13,23 +13,17 @@ namespace uWiki.Businesslogic {
private static string _ConnString = umbraco.GlobalSettings.DbDSN;
private static ISqlHelper _sqlHelper;
/// <summary>
/// Gets the SQL helper.
/// </summary>
/// <value>The SQL helper.</value>
public static ISqlHelper SqlHelper {
get {
if (_sqlHelper == null) {
try {
_sqlHelper = DataLayerHelper.CreateSqlHelper(_ConnString);
} catch { }
}
return _sqlHelper;
}
}
/// <summary>
/// Gets the SQL helper.
/// </summary>
/// <value>The SQL helper.</value>
public static ISqlHelper SqlHelper
{
get { return _sqlHelper ?? (_sqlHelper = DataLayerHelper.CreateSqlHelper(_ConnString)); }
}
public static XmlNode GetDataSetAsNode(string sql, string elementName) {
public static XmlNode GetDataSetAsNode(string sql, string elementName) {
try {
DataSet ds = getDataSetFromSql(_ConnString, sql, elementName);
XmlDataDocument dataDoc = new XmlDataDocument(ds);
+91 -36
View File
@@ -7,6 +7,7 @@ using umbraco.cms.businesslogic.member;
using umbraco.cms.businesslogic;
using umbraco.BusinessLogic;
using System.Xml;
using Umbraco.Core;
namespace uWiki.Businesslogic
{
@@ -37,20 +38,73 @@ namespace uWiki.Businesslogic
if (File.Exists(HttpContext.Current.Server.MapPath(Path)))
File.Delete(HttpContext.Current.Server.MapPath(Path));
Data.SqlHelper.ExecuteNonQuery("DELETE FROM wikiFiles where ID = @id", Data.SqlHelper.CreateParameter("@id", Id));
Application.SqlHelper.ExecuteNonQuery("DELETE FROM wikiFiles where ID = @id", Application.SqlHelper.CreateParameter("@id", Id));
}
/// <summary>
/// Gets all wiki files for all nodes
/// </summary>
/// <returns></returns>
public static Dictionary<int, IEnumerable<WikiFile>> CurrentFiles(IEnumerable<int> nodeIds)
{
var wikiFiles = new Dictionary<int, List<WikiFile>>();
//we can only have 2000 (actually 2100) SQL parameters used at once, so we need to group them
var nodeBatches = nodeIds.InGroupsOf(2000);
foreach (var nodeBatch in nodeBatches)
{
foreach (var result in ApplicationContext.Current.DatabaseContext.Database.Query<dynamic>("SELECT * FROM wikiFiles WHERE nodeId IN (@nodeIds)", new { nodeIds = nodeBatch }))
{
var file = new WikiFile
{
Id = result.id,
Path = result.path,
Name = result.name,
FileType = result.type,
RemovedBy = result.removedBy,
CreatedBy = result.createdBy,
NodeVersion = result.version,
NodeId = result.nodeId,
CreateDate = result.createDate,
Current = result.current,
Downloads = result.downloads,
Archived = result.archived,
Verified = result.verified,
Versions = GetVersionsFromString(result.umbracoVersion)
};
file.Version = file.Versions.Any()
? GetVersionsFromString(result.umbracoVersion)[0]
: UmbracoVersion.DefaultVersion();
if (wikiFiles.ContainsKey(result.nodeId))
{
var list = wikiFiles[result.nodeId];
list.Add(file);
}
else
{
wikiFiles.Add(result.nodeId, new List<WikiFile>(new[] {file}));
}
}
}
return wikiFiles.ToDictionary(x => x.Key, x => (IEnumerable<WikiFile>)x.Value);
}
public static List<WikiFile> CurrentFiles(int nodeId)
{
var wikiFiles = new List<WikiFile>();
var reader = Data.SqlHelper.ExecuteReader("SELECT id FROM wikiFiles WHERE nodeId = @nodeid", Data.SqlHelper.CreateParameter("@nodeId", nodeId));
using (var reader = Application.SqlHelper.ExecuteReader("SELECT id FROM wikiFiles WHERE nodeId = @nodeid", Application.SqlHelper.CreateParameter("@nodeId", nodeId)))
{
while (reader.Read())
wikiFiles.Add(new WikiFile(reader.GetInt("id")));
while (reader.Read())
wikiFiles.Add(new WikiFile(reader.GetInt("id")));
return wikiFiles;
return wikiFiles;
}
}
private readonly Events _events = new Events();
@@ -65,7 +119,7 @@ namespace uWiki.Businesslogic
if (ExtensionNotAllowed(extension))
return null;
var content = Content.GetContentFromVersion(node);
var member = new Member(memberGuid);
@@ -90,7 +144,7 @@ namespace uWiki.Businesslogic
if (Directory.Exists(HttpContext.Current.Server.MapPath(path)) == false)
Directory.CreateDirectory(HttpContext.Current.Server.MapPath(path));
path = string.Format("{0}/{1}_{2}.{3}", path, DateTime.Now.Ticks, umbraco.cms.helpers.url.FormatUrl(filename), extension);
file.SaveAs(HttpContext.Current.Server.MapPath(path));
@@ -176,23 +230,23 @@ namespace uWiki.Businesslogic
if (e.Cancel)
return;
Data.SqlHelper.ExecuteNonQuery(
Application.SqlHelper.ExecuteNonQuery(
"INSERT INTO wikiFiles (path, name, createdBy, nodeId, version, type, downloads, archived, umbracoVersion, verified) VALUES(@path, @name, @createdBy, @nodeId, @nodeVersion, @type, @downloads, @archived, @umbracoVersion, @verified)",
Data.SqlHelper.CreateParameter("@path", Path),
Data.SqlHelper.CreateParameter("@name", Name),
Data.SqlHelper.CreateParameter("@createdBy", CreatedBy),
Data.SqlHelper.CreateParameter("@nodeId", NodeId),
Data.SqlHelper.CreateParameter("@type", FileType),
Data.SqlHelper.CreateParameter("@nodeVersion", NodeVersion),
Data.SqlHelper.CreateParameter("@downloads", Downloads),
Data.SqlHelper.CreateParameter("@archived", Archived),
Data.SqlHelper.CreateParameter("@umbracoVersion", ToVersionString(Versions)),
Data.SqlHelper.CreateParameter("@verified", Verified)
Application.SqlHelper.CreateParameter("@path", Path),
Application.SqlHelper.CreateParameter("@name", Name),
Application.SqlHelper.CreateParameter("@createdBy", CreatedBy),
Application.SqlHelper.CreateParameter("@nodeId", NodeId),
Application.SqlHelper.CreateParameter("@type", FileType),
Application.SqlHelper.CreateParameter("@nodeVersion", NodeVersion),
Application.SqlHelper.CreateParameter("@downloads", Downloads),
Application.SqlHelper.CreateParameter("@archived", Archived),
Application.SqlHelper.CreateParameter("@umbracoVersion", ToVersionString(Versions)),
Application.SqlHelper.CreateParameter("@verified", Verified)
);
CreateDate = DateTime.Now;
Id = Data.SqlHelper.ExecuteScalar<int>("SELECT MAX(id) FROM wikiFiles WHERE createdBy = @createdBy", Data.SqlHelper.CreateParameter("@createdBy", CreatedBy));
Id = Application.SqlHelper.ExecuteScalar<int>("SELECT MAX(id) FROM wikiFiles WHERE createdBy = @createdBy", Application.SqlHelper.CreateParameter("@createdBy", CreatedBy));
FireAfterCreate(e);
}
@@ -204,19 +258,19 @@ namespace uWiki.Businesslogic
if (e.Cancel)
return;
Data.SqlHelper.ExecuteNonQuery(
Application.SqlHelper.ExecuteNonQuery(
"UPDATE wikiFiles SET path = @path, name = @name, type = @type, [current] = @current, removedBy = @removedBy, version = @version, downloads = @downloads, archived = @archived, umbracoVersion = @umbracoVersion, verified = @verified WHERE id = @id",
Data.SqlHelper.CreateParameter("@path", Path),
Data.SqlHelper.CreateParameter("@name", Name),
Data.SqlHelper.CreateParameter("@type", FileType),
Data.SqlHelper.CreateParameter("@current", Current),
Data.SqlHelper.CreateParameter("@removedBy", RemovedBy),
Data.SqlHelper.CreateParameter("@version", NodeVersion),
Data.SqlHelper.CreateParameter("@id", Id),
Data.SqlHelper.CreateParameter("@downloads", Downloads),
Data.SqlHelper.CreateParameter("@archived", Archived),
Data.SqlHelper.CreateParameter("@umbracoVersion", ToVersionString(Versions)),
Data.SqlHelper.CreateParameter("@verified", Verified)
Application.SqlHelper.CreateParameter("@path", Path),
Application.SqlHelper.CreateParameter("@name", Name),
Application.SqlHelper.CreateParameter("@type", FileType),
Application.SqlHelper.CreateParameter("@current", Current),
Application.SqlHelper.CreateParameter("@removedBy", RemovedBy),
Application.SqlHelper.CreateParameter("@version", NodeVersion),
Application.SqlHelper.CreateParameter("@id", Id),
Application.SqlHelper.CreateParameter("@downloads", Downloads),
Application.SqlHelper.CreateParameter("@archived", Archived),
Application.SqlHelper.CreateParameter("@umbracoVersion", ToVersionString(Versions)),
Application.SqlHelper.CreateParameter("@verified", Verified)
);
FireAfterUpdate(e);
@@ -271,7 +325,7 @@ namespace uWiki.Businesslogic
public WikiFile(int id)
{
using (var reader = Data.SqlHelper.ExecuteReader("SELECT * FROM wikiFiles WHERE id = @fileId",
using (var reader = Application.SqlHelper.ExecuteReader("SELECT * FROM wikiFiles WHERE id = @fileId",
Application.SqlHelper.CreateParameter("@fileId", id)))
{
if (reader.Read())
@@ -379,16 +433,16 @@ namespace uWiki.Businesslogic
{
packageByteArray = new byte[fileStream.Length];
fileStream.Read(packageByteArray, 0, (int) fileStream.Length);
fileStream.Read(packageByteArray, 0, (int)fileStream.Length);
}
return packageByteArray;
}
public XmlNode ToXml(XmlDocument d)
{
XmlNode toXml = d.CreateElement("wikiFile");
toXml.Attributes.Append(umbraco.xmlHelper.addAttribute(d, "id", Id.ToString()));
toXml.Attributes.Append(umbraco.xmlHelper.addAttribute(d, "name", Name));
toXml.Attributes.Append(umbraco.xmlHelper.addAttribute(d, "created", CreateDate.ToString()));
@@ -436,5 +490,6 @@ namespace uWiki.Businesslogic
AfterUpdate(this, e);
}
}
}
+1
View File
@@ -106,6 +106,7 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.2.1\lib\Microsoft.ApplicationBlocks.Data.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\UmbracoCms.Core.7.2.1\lib\Microsoft.Web.Helpers.dll</HintPath>