Linking Content Parts in Orchard CMS - orchardcms

Let me preface this question with saying that I am very new to Orchard development. :-)
I am in the process of creating an eCommerce module for Orchard that, 1) on the front-end displays images of products and 2) on the back-end (admin) allows one to enter products and data (prices, quantity on hand, etc), customers, orders, etc).
For the products, I've already created ProductCategory contentpart (Name, CreatedOn, and Active). I'd like to create a ProductSubCategory contentpart that would be linked to ProductCategory (like a foreign key in a database).
How might one do that?

I happened upon your question while looking for the same answer, and I found it in the OrchardCMS GitHub documentation:
Creating 1-n and n-n relationships

Related

Rewriting a NodeJS Website using Oracle APEX

My company is upgrading our database hardware to facilitate a data process that potentially may not work (... long story) and in order to somewhat justify the purchase in case the data process does not work, the idea has been floated around of rewriting the site using Oracle APEX. I am wondering about the limitations of APEX and have been unable to find a solution to a few questions.
I currently have a fairly complex, dynamic ecommerce website written in NodeJS and ExpressJS using EJS for templating. There is a lot of logic done inside the .ejs files and the partial templates themselves are re-used in various places throughout the site. We are using ORDS calls from the Node server to retreive data from the database.
I am mainly curious about how one would go about implementing something similar to EJS partial views in APEX. I am pretty new to APEX (2-3 months working on another application) so I haven't gotten too in depth into the way templates are used, past the normal #REGION_01# substitution of simple elements.
I am assuming that most of the logic (deciding whether to show element A or element B based on a value from the database record of the product) would be done in PL/SQL or in a separate JS file.
Is something like the following possible?
A template containing a "Add To Cart" Button, MSRP, Sale Price, and a (HTML) table displaying possible discounts based on the quantity purchased
A template containing product information, like the product ID, name, manufacturer, and a small description of the product
A template combining the previous 2 options and a picture of the product into a row that can be re-used across the site
If someone has experience with this sort of thing, or could point me towards some good reference material on a similar topic, I would appreciate it.
I've been working with Oracle APEX for a while, specially in the front-end department because it does lack a bit in regards templates.
To answer your question. It depends on what you mean by template
If templates are the apex template objects
You can create and customize templates on Shared Components -> Templates. I'm almost sure you need to create new stuff or duplicate because the vanilla ones are locked.
Another option is to create plugins for you app which will function similarly and can be exported/shared with other projects and people.
If Template is just a page that you will keep changing the record displayed
Sure, you can create many things using the a blank page and adding the components. I've on teams developing ERPs, Mobile Apps, Stock Integration with Marketplaces (needed some Java, though) and several custom made Application that are not available out-of-the-box.

Programatically delete a user in Orchard

I am not an Orchard guru. I am a desktop apps guy with a lot of responsibilities that inherited a big blob of Orchard code and have been tasked with a few maintenance tools. I have tried googling the interwebs to no avail, so I am turning to Stack in a desperate attempt that someone has the easy button...
Basically (and this is an over-simplified use case) - we frequently have users that signup with a mistyped email address or forget their account information within a day or signup again but fat finger the password and then signup a third time, etc...
I have a maintenance console that allows an administrator to 'locate' data (in our own non-orchard sql tables) associated with the first or second accounts (in my example) and re-associate that data with the third 'current/correct' account.
At the conclusion of this re-mapping, I would like to programmatically clean-up (read: delete) the Orchard logins for the first two accounts which are now officially kruft.
I found some information on Stack here that talks about Orchard user accounts:
Users are content types and Orchard creates content items for each
user. When you create a new user Orchard adds records to
xxx_Orchard_Users_UserPartRecord,
xxx_Orchard_Framework_ContentItemRecord,
xxx_Orchard_Framework_ContentItemVersionRecord and
xxx_Orchard_Roles_UserRolesPartRecord if you linked any roles to the
user.
The xxx_Orchard_Framework_ContentItemVersionRecord table keeps track
of the version number and whether or not a content item is published
or not and which version of the published content item is the latest.
When you delete the user Orchard does not delete the records from the
tables, but simply creates a new version record and sets Published and
Latest columns to 0 for the new version and the old version. Because
there is no published and latest version the content item does not
show up on the list of users.
I understand this conceptually, but I can't believe to delete a user that I would be required to delete the records from each of these 'private' tables in orchard. Instead, I expect there is a class/method/technique for deleting the Content Type or Part or Record or whatever (I'm still haven't quite got Orchard object naming straight in my head).
Can anyone share an example of deleting a user in code (by Id or Username or Email)? Or point me at the relevant documentation? I'm fumbling around like a fish outta water here...
As always, thanks in advance!
So as you say, within Orchard most deletes from the UI are soft deletes, keeping all the data and setting a flag in the database to say this guy is deleted. To do this programmatically, where _contentManager is an instance of IContentManager.
var userItem = _contentManager.Get<IUser>(userId);
_contentManager.Remove(userItem);
To do a hard delete, which will delete the item record, all item version records and all content part records (titlepart, userpart etc.)
var userItem = _contentManager.Get<IUser>(userId);
_contentManager.Destroy(userItem);
This was added to orchard in version 1.9.

How to enable User able to see a custom entity record having N:N relationship

I have a custom entity Project, which is having a many to many relationship with User entity.My requirement is when an User is added to a Project he/she only can see that project.
To do that I have tried to add a custom Plugin which will share the Project record to added User, in update message of Project entity. But plugin not firing.
Is there any other way to do that? Please help me out here.
Thanks.
You need to register the step of your plugin at Associate message (and eventually Disassociate is you want to manage also when a Project record is removed from a User) not the Update one.
When a record is linked with a 1:N or N:N relationship the record doesn't get updated.
The Associate message needs to be registered against all entities (leaving empty or set to none the Primary Entity field inside Plugin Registration Tool)
If you use the Developer Toolkit you can find a tutorial to register on Associate message here:
http://zhongchenzhou.wordpress.com/2012/05/20/create-plug-in-for-message-with-no-primary-entity-associated-using-dynamics-crm-2011-developer-toolkit/
Read also this post that explains how to check the entities that triggered the plugin:
http://orwin.ca/2011/07/05/crm-2011-plugin-triggering-off-associate-message/

How to extend the Orchard CMS to support the features of a custom portal?

I am kind of new to Orchard CMS and I need to implement some kind of a portal on this technology. Basically the system need to have a couple of blogs and some additional content types (like events, webcasts, photo galleries etc). Whenever I navigate to a blog (for example http://localhost/OrchardLocal/blog1/) I want to have a menu with the following actions:
Latests posts - which will contain the latests posts of that blog
Webcasts - which will display the entries of type Webcast from the owner of the blog
Photo Galleries - same as Webcasts but with Photo Galleries
Events - same as Webcasts but with Events
On the main page of the portal (http://localhost/OrchardLocal/) I need to somehow have all this information aggregated. So I have to be able to see the latest posts, webcasts, photo galleries and events from all the authors.
I would like to know what would be the best approach to implement this.
There is a great blog post abount finding content in Orchard which should give you enough to start with.
If you want to implement the links as a menu you might want to look at the INavigationProvider interface which has a couple of good implementations (notably Pszmyd's Advanced Menu Module as well as the core Orchard ones).

How can I programmatically determine the creator of a Domino database?

I'm using the built-in Domain Catalog database to list all the databases on a particular Domino server. I'm creating a custom view to show certain information about each database. What I'd like to have is a column that displays the creator of each database. However, if the Domain Catalog is keeping track of this information, I can't find it.
Is there a field in the Domain Catalog that provides this information that I just haven't been able to find? Is there some other way I might find this information and get it into this view? #DBlookup and related functions don't work in column formulas.
That information is not stored in the catalog, and is probably not stored in the database either (It's not shown on any of the property tabs).
You would probably need to get/write a server add-in to monitor database creation and store that data somewhere. Then you'd need to account for databases created by adminp/replication - your add-in might pick them up as having been created by a server.
This question was also asked in the R4/R5 forums in 1998 and received no answer.
Interesting question. There is no such attribute for database, but you can dig for some clues.
New databases: use NotesNoteCollection and look for some specific design element (icon, for example) and look for first element in $UpdatedBy field.
New copies/from templates: above mentioned method won't work. It will return info from original/template, not current database. In this case, try using Created property of DB and check user footprints after that date - in ACL log (he probably altered ACL immediately after copy), new design elements (probably made new view, folder, agent...) or profile documents.
What Frantisek said. Looking in the log archive (ugh!) may tell you who deployed it, but in a well run environment that won't be who developed it. A list of $UpdatedBy(0) for all design notes should give you a good idea. The catch will be that it mayl be people who left the company years ago. : )

Resources