Orchard Content Part Issue - orchardcms

i have created content part in orchard1.6 i enabled the content part in Features in admin panel and i add that in my page type as a part of that content part, now my problem is while i am going to edit the specific page it giving the following error
" The model item passed into the dictionary is of type 'fileuploads.models.fileuploadpart', but this dictionary requires a model item of type 'orchard.contrib.fileupload.models.fileupoadviewmodel'. "
if any one knows about this issue am looking forward to know that, it would be help full.
thanks in advance.

Looks like you're passing a model object of an incorrect type to the editor shape. The type of the model object you pass to the editor in your driver (using EditorTemplate), must match the #using definition in the cshtml template file.
Hard to say more without seeing the actual code.

Looks like you should put
#model fileuploads.models.fileuploadpart
in your .cshtml
Have you tried that?
Btw, only do that on the .cshtml of the editor template. The part .cshtml itself should have a dynamic model.

Related

Automatically Migrate OrchardCMS BodyPart to LayoutPart

tl;dr
Within OrchardCMS, is there any way to automatically migrate the contents of a BodyPart into a LayoutPart? And if so, how?
Detail
I am upgrading an old Orchard instance (v1.8.x) that used the old BodyPart. The goal is to update OrchardCMS to the current release, and with it, migrate to the new Layout system added in v1.9. Enabling the Layout module will add the LayoutPart to content items such as Page, but the two parts both exist on the Content Definition, and moving content from the BodyPart to the LayoutPart seems to be a manual process. Is there any way to automatically migrate content from the BodyPart to the LayoutPart, perhaps even if it was nested within a single Grid->Row->Column(12)->HTML block? And if so, how?
I think you should be able to do this with a little bit of playing around and a little bit of find & replace in your code editor. I would take an empty new site and export two pages, one with content in the BodyPart and one with content in the LayoutPart they way you want it to look. You should be able to see how they are different, I haven't looked at how they export recently, but I think the body part html is contained in a pretty simple xml tag while the layout part includes some code to designate all the elements, with the html contained inside.
Next step is to export all the content from your site (using import/export) and use a good text editor to convert all the body parts into layout parts using find & Replace.
Finally, import the edited file back into the site.
I haven't tried any of this so obviously have a database backup handy and test this out in a dev environment first. Also, I'm guessing that if you follow the directions above you will end up with duplicate content in the body and layout, so you probably want to make sure your import has an empty body tag for each page.

Orchard Fundamentals

I am beginner to Orchard. My purpose of starting this discussion is, to make beginners aware about Orchard Fundamentals.
I am currently Developing on web site using Orchard. But most of the times I am facing difficulty in rendering contents and how to place content on front end. As well, use of content items, content types and modules. Usually, I get confuse in using all these things. For example : I have created new content type for displaying latest post on my site, with date and user's profile picture. So for that my question is, "Is it right that I have created content type for it? or should I have to make module? and if yes than can I use my content type as a widget on my homepage? "
FYI: I went through the documentation and plural sight's video. But I was not able to clear above fundamentals.
Sorry for any inconvenience or any stupid questions, but at this time it seems bit complex for me. Can anybody please help me to clear my fundamentals of orchard?
Thank you,
Sohil Shah
I am currently Developing on web site using Orchard. But most of the times I am facing difficulty in rendering contents and how to place content on front end. As well, use of content items, content types and modules. Usually, I get confuse in using all these things. For example : I have created new content type for displaying latest post on my site, with date and user's profile picture. So for that my question is, "Is it right that I have created content type for it? or should I have to make module? and if yes than can I use my content type as a widget on my homepage? "
Is it right that I have created content type for it? or should I have to make module?
Sure, a ContentType just means that you can create instances of that specific type through the CMS.
or should I have to make module?
Do you want to re-use your contenttype across different projects? If so, then you should create code that creates the contenttype for you (in a migration script) and put that in a module.
can I use my content type as a widget on my homepage?
Yes, you need to enable your contenttype to be a widget. You can do this also with a migration script like so (add the WidgetPart and settting Widget stereotype:
ContentDefinitionManager.AlterTypeDefinition(
"MyWidget",
x => x.WithPart("WidgetPart")
.WithSetting("Stereotype", "Widget")
);

Orchard Module Override a Field Driver

Hello fellow Orcharders!
I'm not sure if what I want to do is possible, but I want to override the Driver for a single Field in the Module I'm writing.
The Field I want more control over is the Content Picker field. Basically I want the Content Picker to load the shapes for their respective content items. I've looked at Sipke's Content Picker Widget for an example on how to load shapes, however I'm unsure of the best/recommended approach to implement something similar in my module.
I have the Content Picker Field attached to my Content Part, and the default Content Picker comma list of Content Item titles appears as expected. I have tried to define an Alternate in Placement.info, but I can't load the Content Item shapes from within the Alternate view.
Presumably, as per Sipke's example, these shapes need to be built in the Driver and passed along. If this is correct thing to do, how could I do this in the most Orchard-y way with minimal "hacks". Looking into the debugger, I could "hack" my way to the Field I need in my part's Driver; but the module I'm building will be reused in the future by people unfamiliar with it, and if they start adding/deleting Fields from the Content Part, I'd like everything to behave accordingly!
Of course, if I must take the "hacky" option, I'm willing to do so, but only after I've exhausted all other options. This is my first module, and I've learnt an incredible amount along the way, and I'm really trying to learn the "right" way to build an Orchard Module as best I can.
Thanks in advance!

SharePoint 2010 Error when creating list view

I have a custom list definition created via visual studio 2010. I would like to create a calendar view of this list using the web interface. When I attempt to create the view however, I am greeted with a helpful error message of:
Error
Cannot complete this action.
Please try again.
About the problem:
When I attempt to duplicate this error while running Fiddler2, I see a response of 404 Not Found when attempting to access /_vti_bin/owssvr.dll?CS=65001 using the HTTP POST verb.
No errors are logged in the ULS logs.
If I create a new custom list and attempt to reproduce the issue by adding two date columns and creating the calendar view, everything works as expected.
The schema.xml file defining the list is fairly large, with close to 25 fields.
I am using custom templates for the new, edit, and display forms.
I have defined a new custom view showing a subset of the columns in schema.xml
Does anyone know of any "gotchas" or things to look for in my list definition that could be related to this issue at all?
Has anyone encountered this issue before, and know of a way to fix it?
Failing those, what more can I do to debug this?
To avoid overflowing this question with large code blocks, you can view my list definition here:
Elements.xml - http://pastebin.com/97ucAedZ
Schema.xml - http://pastebin.com/2brpMJgT
ListInstance Elements.xml - http://pastebin.com/gnCXVpmh
I agree with moontear. I think your Content Type ID is invalid. If you are building off a Custom List template, I would expect your Content Type ID to be:
<ContentType ID="0x0100781A2C74BF4bfd81AE710DB1EACAE745"
Name="$Resources:Item"
Group="$Resources:List_Content_Types"
Description="$Resources:ItemCTDesc"
Version="1">
To inherit from Item, you should have 0x01 then 00 followed by a Guid. You have the right number of characters, if you use 00 instead of 70.
For more information, see Content Type IDs.
In cases like this, i usually take these steps:
Create List/View manually in MOSS.
Export list as template and try to
find out what is wrong in my
template.
Start with clean template, add one field etc at a time, test, repeat until error emerges.
Your xml seems ok, so i think it will be another MOSS 'gotcha' or 'aha' moment.

Drupal views output theming

I have a views page which tracks posts created by users. Its having a field(comment_count) to show no of comments in a node. the field is working fine except its showing blank spaces in fields with no comments.
I am using the template file views-view-field--tracker--page--comment-count.tpl.php and copying the line <?php print $output;?> as suggested by views. but i have no idea how to modify the template output to ... replace the empty spaces with text such as 'no comments' or something similar. I would really appreciate if anyone can help me on this.
There are more templates involved in View processing. Go to admin/build/views/, edit your view and see Theme: Information. There you'll get currently used templates, their brief descriptions and default code.
As for field template, there are some variables available:
$view: The view object
$field: The field handler object that can process the input
$row: The raw SQL result that can be used
$output: The processed output that will normally be used.

Resources