I'm tring to rebuild Orchard gallery according to instruction on:
http://orchardgallery.codeplex.com/SourceControl/changeset/view/6a5476676f50#Readme.txt
After getting all latest versions Gallery does not compiles because this error:
Error 4 The type or namespace name 'Routable' does not exist in the namespace 'Orchard.Core' (are you missing an assembly reference?)
...\Orchard.Gallery\Orchard\src\Orchard.Web\Modules\Orchard.Gallery\Models\PackagePart.cs 5 20 Orchard.Gallery
It seems that Routable stuff is removed from latest repository...
How can I fix this?
Thanks
Edit:
more specific:
since guidelines on gallery talks about "latest orchard", what is the "latest orchard that works with gallery"?
more general orchard question:
If one used the "Routable" objects in its module (targeting orchard 1.4) and decides later to upgrade to 1.6, how can change code so that his module will be compatible?
Starting from Orchard 1.4 the old Route part was splitted in 2 distinct parts.
You can read more on this here:
http://www.davidhayden.me/blog/whats-new-in-orchard-1.4
http://www.davidhayden.me/blog/autoroute-custom-patterns-and-route-regeneration-in-orchard-1.4
Gallery was released for 1.3 (and never updated since then)
so if you want to run on 1.4 you must change some code to get compile on 1.4 or later (I'm doing on latest at now: 1.6)
So the fix is:
Add reference to Autoroute module and remove all namespace references to Routable
Replace all RoutableParts with TitlePart (Title) or AutoroutePart (Slug)
public string Title
{
- get { return this.As<RoutePart>().Title; }
- set { this.As<RoutePart>().Title = value; }
+ get { return this.As<TitlePart>().Title; }
+ set { this.As<TitlePart>().Title = value; }
}
public string Slug
{
- get { return this.As<RoutePart>().Slug; }
- set { this.As<RoutePart>().Slug = value; }
+ get { return this.As<AutoroutePart>().DisplayAlias; }
+ set { this.As<AutoroutePart>().DisplayAlias = value; }
}
Another point is that IUserEventHandler was extended and Gallery does not implements all methods.
TaxonomyService changed some methods:
http://orchardgallery.codeplex.com/SourceControl/network/Forks/akoeplinger/ChangesInContribTaxonomies/contribution/1336
Related
I am generating API reference from C# project.
The project is part of big solution and has long name convention for assemblies and namespaces, so every namespace in project goes like [CompanyName].[System].[Area].[Module].[...] (e.g. MyBiz.CRM.Sales.Analytics.Persistence.Common and MyBiz.CRM.Sales.Analytics.Persistence.Sql).
Since all namespaces in project start with MyBiz.CRM.Sales. and I generate reference for each system and area separately, I want to exclude MyBiz.CRM.Sales. in TOC on left side and only mention it in title/header.
Is it possible in docFX or I need to write custom server side post-build event script?
Thanks in advance
I also had the same problem and solved it by writing a template. The only thing it does is overriding the preTransform hook which you need to specify in a file named toc.extension.js. There I strip the long namespace prefix. As I have a TOC in several layers, I do that recursively. You can most probably hard-code it for the level you need. My code looks as follows:
exports.preTransform = function (model) {
// replace recursively the root namespace by ""
transformItem(model, 1);
return model;
function transformItem(item, level) {
if (item.name) {
item.name = item.name.replace("Some.Very.Long.Namespace.Prefix.", '');
} else {
item.name = null;
}
if (item.items && item.items.length > 0) {
var length = item.items.length;
for (var i = 0; i < length; i++) {
transformItem(item.items[i], level + 1);
};
}
}
}
Afterwards, I simply specify the own template in addition to the default template in docfx.json which causes the hook to be called. That works as follows:
"build": {
"template": [
"default",
"/path/to/your/template/folder"
]
}
References: Docfx: How to create a custom template
I am trying to accomplish two things:
Localize the “built-in” error messages for “FieldMustBeDate” and "FieldMustBeNumeric".
Localize some of the other error messages you would encounter, for example, "PropertyValueRequired".
By using http://forums.asp.net/t/1862672.aspx/1 for problem 1 and MVC 4 ignores DefaultModelBinder.ResourceClassKey for problem 2 I have managed to get both working locally.
However as soon as I publish to a website, the “built-in” error messages defaults back to English while the other error messages stay localized.
I have read several places that using the App_GlobalResources should be avoided, however I am unable to accomplish problem 1 without using this.
I have created a .resx file with the name “WebResources.resx”, set the Build Action to “Embedded”, set the Copy to Output Directory to “Do no Copy”, set the Custom Tool to “PublicResXFileCodeGenerator” and set the Custom Tool Namespace to “Resources”.
The Project itself is set to only Publish files that are needed.
My Global.asax.cs contains the following (relevant) code:
ClientDataTypeModelValidatorProvider.ResourceClassKey = "WebResources";
DataAnnotationsModelValidatorProvider.RegisterAdapter(
typeof(RequiredAttribute),
typeof(MyRequiredAttributeAdapter));
And the class MyRequiredAttributeAdapter contains the following code:
public class MyRequiredAttributeAdapter : RequiredAttributeAdapter
{
public MyRequiredAttributeAdapter(
ModelMetadata metadata,
ControllerContext context,
RequiredAttribute attribute
)
: base(metadata, context, attribute)
{
if (attribute.ErrorMessageResourceType == null)
{
attribute.ErrorMessageResourceType = typeof(Resources.WebResources);
}
if (attribute.ErrorMessageResourceName == null)
{
attribute.ErrorMessageResourceName = "PropertyValueRequired";
}
}
}
This is working locally however does anyone have any idea on how to get the "built in" messages to work after this is published?
Thank you for your help!
Best regards,
Andreas
I figured this one out myself. If you are trying to accomplish the above you must separate the localized error messages.
Create a *.resx file for the other error messages fx "PropertyValueRequired" and set the Build Action to “Embedded”, set the Copy to Output Directory to “Do no Copy”, set the Custom Tool to “PublicResXFileCodeGenerator” and set the Custom Tool Namespace to “Resources”.
In my case I have moved "PropertyValueRequired" to a file called LocalDanish.resx (still in the App_GlobalResources folder) and changed the line in my "MyRequiredAttributeAdapter" from
attribute.ErrorMessageResourceType = typeof(Resources.WebResources);
to
attribute.ErrorMessageResourceType = typeof(Resources.LocalDanish);
In order to get the "built in" error messages to work, you must create two *.resx files. I have created WebResources.resx and WebResources.da.resx. Do NOT change anything, leave the settings on them on default (Build Action to "Content", etc.). I guess the website automatically looks for the *.da.resx files in my case because I have set the globalization in my WebConfig:
<globalization uiCulture="da-DK" culture="da-DK"/>
Hope this helps anybody.
Best regards,
Andreas
I have made some minor additions to the original post, which didn't translate all messages in my case.
(String length and invalid property values)
Follow the above steps, to create the *.resx files, set their properties, and then set the locale in web.config, as described by Andreas.
Then create a couple of adapters:
// As described in original post:
public class LocalizedRequiredAttributeAdapter : RequiredAttributeAdapter
{
public LocalizedRequiredAttributeAdapter(
ModelMetadata metadata,
ControllerContext context,
RequiredAttribute attribute
)
: base(metadata, context, attribute)
{
if (attribute.ErrorMessageResourceType == null)
attribute.ErrorMessageResourceType = typeof(Resources.Resources);
if (attribute.ErrorMessageResourceName == null)
attribute.ErrorMessageResourceName = "PropertyValueRequired";
}
}
// Addition to original post:
public class LocalizedStringLengthAttributeAdapter : StringLengthAttributeAdapter
{
public LocalizedStringLengthAttributeAdapter(
ModelMetadata metadata,
ControllerContext context,
StringLengthAttribute attribute
)
: base(metadata, context, attribute)
{
if (attribute.ErrorMessageResourceType == null)
attribute.ErrorMessageResourceType = typeof(Resources.Resources);
if (attribute.ErrorMessageResourceName == null)
attribute.ErrorMessageResourceName = "StringLengthAttribute_ValidationError";
}
}
And in Global.asax.cx:
// Addition to original post: (Used for "PropertyValueInvalid")
DefaultModelBinder.ResourceClassKey = "Resources";
// As described in original post:
ClientDataTypeModelValidatorProvider.ResourceClassKey = "Resources";
DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(RequiredAttribute), typeof(LocalizedRequiredAttributeAdapter));
DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(StringLengthAttribute), typeof(LocalizedStringLengthAttributeAdapter));
In one of our implementation of TBB we are using ItemPropertyFileNameSubFolder property of Item.We are migrating our application from 5.3 sp1 to Tridion 2011 Sp1 and the property ItemPropertyFileNameSubFolder doesnot exist in the latest version. The code snippet we are using is as below
// Handle subfolder (todo: fix this, ItemPropertyFileNameSubFolder does not exist!!
string subFolder = GetPropertyValue(item, Item.ItemPropertyFileNameSubFolder);
if (subFolder != "") {
if (subFolder.StartsWith("/")) {
// Strip of leading /
subFolder = subFolder.Substring(1);
}
if (!subFolder.EndsWith(PathSeparator)) {
// Ensure there is always a separator at the end
subFolder += PathSeparator;
}
fileName = subFolder + fileName;
}
This basically retrieve the subfolder path from the property and prefix the filename with the value. Could you please provide me any alternative or workaround for the same.
Thanks
Rajendra
This property was optional to begin with and might not even been set, which probably doesn't happen anyway otherwise you would have had an exception there.
You might as well leave it out, or (additionally) use Item.ItemPropertyFileNamePrefix when this prefix was not used already.
Have a real puzzler here. I'm using Atalasoft DotImage to allow the user to add some annotations to an image. When I add two annotations of the same type that contain text that have the same name, I get a javascript permission denied error in the Atalasoft's compressed js. The error is accessing the style member of a rule:
In the debugger (Visual Studio 2010 .Net 4.0) I can access
h._rule
but not
h._rule.style
What in javascript would cause permission denied when accessing a membere of an object?
Just wondering if anyone else has encountered this. I see several people using Atalasoft on SO and I even saw a response from someone with Atalasoft. And yes, I'm talking to them, but it never hurts to throw it out to the crowd. This only happens in IE8, not FireFox.
Thanks, Brian
Updates: Yes, using latest version: 9.0.2.43666
By same name (see comment below) I mean, I created default annotations and they are named so they can be added with javascript later.
// create a default annotation
TextData text = new TextData();
text.Name = "DefaultTextAnnotation";
text.Text = "Default Text Annotation:\n double-click to edit";
//text.Font = new AnnotationFont("Arial", 12f);
text.Font = new AnnotationFont(_strAnnotationFontName, _fltAnnotationFontSize);
text.Font.Bold = true;
text.FontBrush = new AnnotationBrush(Color.Black);
text.Fill = new AnnotationBrush(Color.Ivory);
text.Outline = new AnnotationPen(new AnnotationBrush(Color.White), 2);
WebAnnotationViewer1.Annotations.DefaultAnnotations.Add(text);
In javascript:
CreateAnnotation('TextData', 'DefaultTextAnnotation');
function CreateAnnotation(type, name) {
SetAnnotationModified(true);
WebAnnotationViewer1.DeselectAll();
var ann = WebAnnotationViewer1.CreateAnnotation(type, name);
WebThumbnailViewer1.Update();
}
There was a bug in an earlier version that allowed annotations to be saved with the same unique id's. This generally doesn't cause problems for any annotations except for TextAnnotations, since they use the unique id to create a CSS class for the text editor. CSS doesn't like having two or more classes defined by the same name, this is what causes the "Permission denied" error.
You can remove the unique id's from the annotations without it causing problems. I have provided a few code snippets below that demonstrate how this can be done. Calling ResetUniques() after you load the annotation data (on the server side) should make everything run smoothly.
-Dave C. from Atalasoft
protected void ResetUniques()
{
foreach (LayerAnnotation layerAnn in WebAnnotationViewer1.Annotations.Layers)
{
ResetLayer(layerAnn.Data as LayerData);
}
}
protected void ResetLayer(LayerData layer)
{
ResetUniqueID(layer);
foreach (AnnotationData data in layer.Items)
{
LayerData group = data as LayerData;
if (group != null)
{
ResetLayer(data as LayerData);
}
else
{
ResetUniqueID(data);
}
}
}
protected void ResetUniqueID(AnnotationData data)
{
data.SetExtraProperty("_atalaUniqueIndex", null);
}
When loading data with SubSonic (either using ActiveRecord or a collection), only records with IsDeleted set to false will load. How can I show those rows that have been deleted?
For example, deleting an Employee with:
Employee.Delete(1)
Now employee 1 is marked as deleted. Now I want the option to undo the delete and / or show a list of deleted employees, how can I do that? Either it will be undone if the user accidentally deleted the employee, or they want to go to a 'trash' list with previously deleted employees (i.e. only those with IsDeleted set to true).
Edit:
Using SubSonic 2.2
ActiveRecord doesn't have this built in. You'll need to set up additional queries for this. You didn't specify 2.2 or 3.0. This is 2.2 syntax.
public EmployeeCollection FetchAll(bool isDeleted)
{
return new SubSonic.Select().From(Employee.Schema).Where(IsDeletedColumn).IsEqualTo(isDeleted).ExecuteAsCollection<EmployeeCollection>();
}
public EmployeeCollection GetTrashList()
{
return FetchAll(true);
}
I was running into this problem yesterday with subsonic 3 and decided to alter the T4 templates to "fix" it. I added these definitions for a new function LogicalAll. As an alternative you could change the definitions of All to this but then you would have no way of getting at the deleted records.
public static IQueryable<<#=tbl.ClassName#>> LogicalAll(string connectionString, string providerName) {
<#if(tbl.HasLogicalDelete()){#>
var results = GetRepo(connectionString,providerName).GetAll();
if(results == null)
{
return new List<<#=tbl.ClassName#>>().AsQueryable();
}
return results.Where(x=> x.<#=tbl.DeleteColumn.CleanName#> == false);
<#} else {#>
return GetRepo(connectionString,providerName).GetAll();
<# } #>
}
public static IQueryable<<#=tbl.ClassName#>> LogicalAll() {
<#if(tbl.HasLogicalDelete()){#>
var results = GetRepo().GetAll();
if(results == null)
{
return new List<<#=tbl.ClassName#>>().AsQueryable();
}
return results.Where(x=> x.<#=tbl.DeleteColumn.CleanName#> == false);
<#} else {#>
return GetRepo().GetAll();
<# } #>
}
I'm running into the same issue.
I'm working in a project that's using the ActiveRecord scheme. I can retrieve logically deleted records just fine by querying for them specifically.
The problem is that the ActiveRecord generated classes do not have any properties or methods to modify the deleted status of the record.
It should be as simple as setting "IsDeleted = false" but this functionality doesn't seem to exist.
-- Nevermind on this. I regenerated my ActiveRecord class, and now my Deleted column is accessible by calling code. Must've gotten stuck somewhere.
it is easy to show these rows simply by creating a query by hand instead of using the collection loaders
ie.
ProductsCollection col = new ProductsCollection().Load();
becomes
ProductsCollection col = new Select()
.From(Tables.Products)
.ExecuteAsCollection<ProductsCollection>();
This should load everything for you. Futhermore you can set the options yourself:
ProductsCollection col = new Select()
.From(Tables.Products)
.Where(Products.Columns.IsDeleted).IsEqualTo(false)
.And(Products.Columns.IsDeleted).IsEqualTo(null)
.ExecuteAsCollection<ProductsCollection>();
This would load all the nulls (if you forgot to set your default value on your column to false) AND it will also load the falses
Hope this helps