by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 12 01:41

    jtkech on patch-1

    (compare)

  • Apr 12 01:39

    jtkech on patch-1

    Update ZoneShapes.cs (compare)

Jasmin Savard
@Skrypt
@remesq You can create a custom content type which would use a Liquid field to render content
It would require simply to also have the AutoroutePart attached to the CT to get a custom url generated
Damiandamian
@Damiandamian
@Skrypt Thank you;)
Robert
@remesq
Yes, ty @Skrypt.
Zoltán Lehóczky
@Piedone
image.png
Please everyone, if you use threads it won't be just a huge flat chat with everything in there!
11 replies
qadirkanore
@qadirkanore

Hello Guys,
I have installed OrchardCore CMS using its latest docker image and Postgres as a database on a ubuntu server.I m getting an error while requesting Graphql endpoint to fetch localized content.

query

query MyQuery {
newsPage(where: { localization: {culture: "en-US"}}) {
carouselTitle
mainTitle
localization {
culture
}
}
}

response

"extensions": {
"code": "POSTGRES",
"data": {
"Severity": "ERROR",
"InvariantSeverity": "ERROR",
"SqlState": "42703",
"MessageText": "column LocalizedContentItemIndex.culture does not exist",
"Hint": "Perhaps you meant to reference the column \"LocalizedContentItemIndex.Culture\".",
"Position": 344,
"File": "parse_relation.c",
"Line": "3294",
"Routine": "errorMissingColumn"
}
}
}

1 reply
alin-devnet
@alin-devnet
Hi, can I please get a bit of guidance on how to make a content item type filterable by a custom field using graphql?
Maartz
@Maartz
Hey folks, I have a question. Does Orchard support multi-databases ? I've got a SQL Server with a legacy table, but needed until we switch to LDAP. I need to perform basic CRUD on it, no fancy join etc.
36 replies
Patric Schielke
@TheShihan
When I have added a singleton like this in Startup.ConfigureServices: services.AddSingleton<IHostedService, ScheduledDataImport>(); (a job that runs in the background to import data into content types, well that is the plan). How can I get access to the ContentManager inside this singleton? I see some examples for Orchard CMS (not Core!) like this: var item = _orchardServices.ContentManager.New("Course"); - but I believe there is no longer any OrchardServices in Core. Any ideas?
Dean Marcussen
@deanmarcussen
The content manager is scoped so to resolve it from a singleton (hopefully works in a background task this way) you'll want to get it from an http context IHttpContextAccessor.Context.RequestServices.GetService<IContentManager>()
MikeKry
@MikeKry
Hi, please, how can I disable module, if it throws error after enabling? Whole site is down.
3 replies
Patric Schielke
@TheShihan
@deanmarcussen how do I access the HTTP context from my singleton? Do I need to add something like services.AddHttpContextAccessor(); services.AddTransient<IUserRepository, UserRepository>(); to my ConfigureServices (where UserRepository would be my singleton)?
Dean Marcussen
@deanmarcussen
no just inject it in the constructor of your singleton like anything else
Patric Schielke
@TheShihan
ah, you mean like ILogger, or IConfiguration and that should work?
sorry, had done too much in SharePoint the last years, and still have to dive deeper into the whole dependency injection world.
MikeKry
@MikeKry

Hi, please, how can I disable module, if it throws error after enabling? Whole site is down.

Only possibility to disable installed features that I have found is to change it in DB, but that is way too complicated

Patric Schielke
@TheShihan
@deanmarcussen maybe you can point me in the right direction, I tried it with _httpContextAccessor.HttpContext.RequestServices.GetService<IContentManager>() after injecting _httpConextAccessor in the constructor, this object is set, but the property HttpContext is null (btw, there is no Context property). I guess it is because the singleton works in the background and is not a request by the user, so there is no HttpContext. But I noticed that I already have a service provider in my singleton, inside the method I work: public override Task ProcessInScope(IServiceProvider serviceProvider) - so I tried to get the IContentManager from this service provider with var _contentManager = serviceProvider.GetService<IContentManager>(); unfortunately null is returned. Which makes me think, that either I need to setup something before that the content manager is registered as a service .. or maybe I am doing it completly wrong :-)
Patric Schielke
@TheShihan
Any more ideas of how to access ContentManager from Singleton?
tempcode
@PiemP
Hi guys, someone have create a custom version of Pager_Previous or Pager_Next ... I'm trying to get the href attribute to make my custom shapes works, but for now I doesn't understand how to get it. I found a way to do it but seems too much complicated... Thank you
1 reply
Mario Fuentes
@mario-fuentes

Hello everyone, I'm so confused with OrchardCore :(
Initially I understand that I can use some useful modules from the CMS in a MVC app (e.g. the Admin dashboard, the menu, etc.), and/or create a CMS app and reference a MVC modules.

I'm doing an extreme simple spike and isn't working how I expect:

  • Create two modules, one of each type:
    $ dotnet new ocmodulemvc -o modm
    $ dotnet new ocmodulecms -o modc
  • Create an OC MVC app and reference both modules:
    $ dotnet new ocmvc -o mvc
    $ dotnet add ocmvc referene modm modc
  • Create an OC CMS app and reference both modules
    $ dotnet new occms -o cms
    $ dotnet add ocmvc referene modm modc

  • Now, if I run the mvc project, both modules are loaded as I expect:
    $ dotnet run --project mvc/mvc.csproj
    $ curl -I https://localhost:5001/modm/Home/Index
    ... 200 OK
    $ curl -I https://localhost:5001/modc/Home/Index
    ... 200 OK

  • But, if I run the cms project, both modules apparently aren't loaded:
    $ dotnet run --project cms/cms.csproj
    $ curl -I https://localhost:5001/modm/Home/Index
    ... 404 Not Found
    $ curl -I https://localhost:5001/modc/Home/Index
    ... 404 Not Found

So, CMS modules need some special configuration to be activated?

Antoine Griffard
@agriffard
There is a Admin / Configuration / Features page in which you need to enable the features.
Mario Fuentes
@mario-fuentes
OMG, thanks you
Sébastien Ros
@sebastienros
@TheShihan either you pass a service provider to the method that is called in the singleton, or the content manager itself
58 replies
ahmedtabba
@ahmedtabba

Hi, when I try to delete some images from media at an online site
I get this error on console and the image didn't delete

/Admin/Media/DeleteMedia?path=Clients%2F1.jpg:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Help Plz!

1 reply
Tim Sylvester
@TimSylvester
I enabled OpenID and I'm able to get a token from /connect/token, but it isn't accepted either as "Authorization: Bearer ..." or as a cookie, producing just "DefaultAuthorizationService ... Authorization failed" in the logs. How do I use these tokens to authorize access to API controllers?
2 replies
Kévin Chalet
@kevinchalet
@TimSylvester decorate your API controller with [Authorize(AuthenticationSchemes = "Api")].
Tim Sylvester
@TimSylvester
@kevinchalet Thanks!
Jasmin Savard
@Skrypt
He gets summoned quick :smile:
Kévin Chalet
@kevinchalet
@TimSylvester did that work?
@Skrypt :sweat_smile:
Tim Sylvester
@TimSylvester
@kevinchalet Yes, though I need to enable multiple schemes, I think. Where can I find the set of available scheme options?
Kévin Chalet
@kevinchalet
@TimSylvester what are you trying to do, exactly?
Tim Sylvester
@TimSylvester
@kevinchalet Just looking to have an API method that's accessible via OpenID token auth as well as accepting a normal login cookie from a browser, for debugging/troubleshooting.
Kévin Chalet
@kevinchalet
Doesn't sound like a good idea. You'd have to add antiforgery protection to your "dual authentication" endpoints to prevent XSRF attacks with browsers that don't support same-site (and until very recently the OpenID module disabled same-site to make sure silent authentication worked).
Tim Sylvester
@TimSylvester
hm, ok
Jasmin Savard
@Skrypt
image.png
Jean-Thierry Kéchichian
@jtkech

@TheShihan we have some host level services but most of orchard services are registered when we compose a tenant container. So yes your IHostedService needs to be registered at the host level, but then you need to be in a tenant context to resolve and then use e.g. IContentManager.

We already have the infrastructure to do this bridge, see our ModularBackgroundService that is an IHostService and that creates tenant scopes to execute what we call IBackgroundTask.

So you would just have to define an IBackgroundTask with a schedule property and register it in your module startup, see e.g. IndexingBackgroundTask, or register it from the app but with one of our OrchardCoreBuilder helper.

        services.AddOrchardCms()
            .ConfigureServices(s =>
            {
                s.AddSingleton<IBackgroundTask, YourBackgroundTask>();
            });

but you can still define your own IHostedService taking example from our ModularBackgroundService.

2 replies
Duncan Hoggan
@duncanhoggan
Is there some trick to querying numeric fields in Lucene, ive tried everything
Patric Schielke
@TheShihan
grafik.png
I've deployed a ContentType "Project" with a TitlePart and a Custom ProjectPart with a Recipe to my site. How can I now in code cast my ContentItem (retrieved by the ContentManager) to this custom "ProjectPart". I can cast it (to fill e.g. the Title property) to a TitlePart, I created a class ProjectPart inheriting from ContentPart, having the properties/fields defined in the recipe but when I try to cast it to that I receive an exception CLR/System.InvalidCastException (see above). What am I doing wrong, how can I cast it so I can edit the field values?
26 replies
Tokyo1985
@Tokyo1985
Hi, does OrchardCore support only SQL Server 2017 and 2019?
3 replies
Sebastian Satzinger
@Flarescape

Hi!

I tried to create a SQL Template with liquid as described in the docs but the validator is not that happy with using liquid in the first line.

6 replies
image.png
image.png
11 replies
Please contribute to the localization on Crowdin.
Sebastian Satzinger
@Flarescape
Does someone else experience problems with the LiquidPart?
I've added it to a Content Type with the Stereotyp "Widget" to use it inside Flow Parts, but the LiquidParts only renders plain HTML and nothing from liquid except things like {{Model.ContentItem.Content}}.
andrew2241
@andrew2241

I am trying the use the GetContentItemByIdAsync() Razor helper.
I have added the @inject OrchardCore.IOrchardHelper Orchard but I am getting a message that says:
IOrchardHelper' does not contain a definition for 'GetContentItemByIdAsync' and no accessible extension method 'GetContentItemByIdAsync' accepting a first argument of type 'IOrchardHelper' could be found (are you missing a using directive or an assembly reference?)

Any help? I am sure I am missing something simple, but I am failing to see it.

Tim Sylvester
@TimSylvester
@andrew2241 GetContentItemByIdAsync() is in the OrchardCore.Contents assembly, so you may need to add the orchardcore.contents project reference or nuget package. I believe that was the issue when I ran into a similar error.