How do you get a list of visible/published items. I am doing a List.Count(), but only want to include visible items in the count. I thought about looping through the list but the items don't seem to have a visible property.
There should be an "IsPublished" property. Check out the (work in progress) new API wiki we're working on (and please contribute :) - https://github.com/2sic/2sxc/wiki/Dynamic-Entity
Now for your special case there may be a surprise: by default the logged in editor sees different items in the default stream than the not logged in user. So in the very default, if you loop (or LINQ) all the items with xyz.Count(e => e.IsPublished) the total would be different for the editor than for the end-user, because the editor would see more draft-items. So the editor would see fewer published items.
This may be counter-intuitive at first, but by default if an item exists as published and draft, the end-user will see the published, and the editor will see the draft. So the count would respect that.
I'm saying this is the default, because if you use the visual query designer, you'll see that by default, the standard cache delivers all data to a Published-Datasource, which then passes the "Default" stream to the module-data-source. This "Default" stream adapts to the current user. You could also use the "Published" or "Draft" stream and exclusively work (count) these.
Related
In our project we have a long list of Temporary schemas being created in the DB.
I have to scroll through the whole list of Temporary schemas and then reach the one on which I am working.
Deleting or removing the schema is not under my control.
I have tried the documentation where it stated in Preference -> Browser -> Display -> Show system objects? switch is set to True, the client will display system objects such as system schemas (for example, pg_temp) or system columns (for example, xmin or ctid) in the tree control.
Thus I marked it as False but still I am able to see the list of Temporary tables.
Refreshed the connection also.
Is there any other way to hide the same? Or did I missed something?
In the current version, you can look under
Preferences > Browser > Display > Show system objects ?
The documentation says:
When the Show system objects? switch is set to True, the client will
display system objects such as system schemas (for example, pg_temp)
or system columns (for example, xmin or ctid) in the tree control.
So this will hide them. However, if you want to hide only the temp schemas an nothing else, you could mess with the exposed pgAdmin object that's available in the browser as a global object.
I've created a hack implementation. Feel free to try this, but use it at your own risk, I accept no liability if you lose any data or code.
schemaQuery = window.prompt('Type a string to remove schemas containing this substring:')
function closetemp(ns){
ns.forEach(n=>{
if(n._metadata.data._type == 'coll-schema'){
n._children.forEach(s=>{
if(s._fileName.indexOf(schemaQuery)!=-1){
pgAdmin.Browser.tree.remove(s)
}
})
}
if(n._children!=null){
closetemp(n._children)
}
})
}
closetemp(pgAdmin.Browser.tree.children())
Run that in the browser console and a box will pop up. Type "_temp_" and it will remove every schema containing the string "_temp_" form the browser tree.
It crawls the tree, finds the schemas, and removes the nodes from the tree. It might cause errors I am unaware of, but if you refresh the tree from the menu the temp schemas (or whatever schemas match your string) will appear again.
You could create a bookmarklet and save it so that you don't have to open the browser console. If you save this as a bookmark and set this as the URL, it will remove temp tables when you click on it:
javascript:(()=>{function%20closetemp(ns)%7B%0A%09ns.forEach(n%3D%3E%7B%0A%20%20%20%20if(n._metadata.data._type%20%3D%3D%20'coll-schema')%7B%0A%20%20%20%20%20%20n._children.forEach(s%3D%3E%7B%0A%20%20%20%20%20%20%20%20if(s._fileName.indexOf('_temp_')!%3D-1)%7B%0A%20%20%20%20%20%20%20%20%20%20pgAdmin.Browser.tree.remove(s)%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D)%0A%20%20%20%20%7D%0A%20%20%20%20if(n._children!%3Dnull)%7B%0A%20%20%20%20%09closetemp(n._children)%0A%20%20%20%20%7D%0A%20%20%7D)%0A%7D%0Aclosetemp(pgAdmin.Browser.tree.children())})()
Using 2sxc Blogg App and when using search I get the results of the blog home page listed, which simply list the blog home and the article titles which all take the user to the blog home page, so they are pretty much useless links, then I get the actual articles with the links to the articles. So I need to suppress the blog page itself, but not its dynamic children (the articles).
/help <-- no, thanks, your links are useless.
/help/post <-- yes, please, list all.
Any idea on how I could achieve that? I got directed to CustomizeData() doc, but I have no idea what to do. The current one set on the main blog list page is as follows:
#functions{
/// <summary>
/// Populate the search - ensure that each entity has an own url/page
/// </summary>
/// <param name="searchInfos"></param>
/// <param name="moduleInfo"></param>
/// <param name="startDate"></param>
public override void CustomizeSearch(Dictionary<string, List<ToSic.SexyContent.Search.ISearchInfo>> searchInfos, DotNetNuke.Entities.Modules.ModuleInfo moduleInfo, DateTime startDate)
{
foreach (var si in searchInfos["SearchIndex"])
{
si.QueryString = "post=" + AsDynamic(si.Entity).UrlKey;
}
}
}
welcome to StackOverflow ;)
The basic DNN index asks each module for the data it has, and then builds the index on that. Since a module can have multiple items for the search, they are each an own "document" which can be configured - for example what URL to use in the search results. To enable view-developers to customize these things, 2sxc has this hook to customize the search results. So the way it's meant to work is...
the backend collects the data
then detects that the search index is being built (and not a user viewing the page)
then call the code for optional reconfiguration
then pass the items on to DNN search
So what the code should do is take each item as it was prepared by the backend, change the url to use and then let the rest of the system do its magic. If this isn't working, there are a few possibilities:
something in DNN or 2sxc is broken (I really hope that's not it)
the code caused errors and since it happens in the background, you don't see it
the data is not being passed to the code, for example because it was filtered out - for example, old data isn't updated in the index, because the indexer will ask for new data only, and therefor older data won't be updated on normal re-indexes, no matter how you update the code.
Let's try to find out what the cause is
open the app query https://azing.org/2sxc/r/T1GdqnNa and select the **Blog Posts for Home and Tags", and test-run the query to see if it gives you results. if not, something may be wrong with the query. In the json-looking test-results on the screen, do check if there is something in the set "SearchIndex" - this is the data stream that skips paging and returns all items. If this is empty, get back to us. Note: if you don't get any results, do check what Test-Parameters the query is using (box to the right), and maybe edit the ModuleId in case it's wrong
check if you see any events in the DNN event-log. if you don't, make sure you re-index the whole data in DNN and check again.
Post your results, so we can check how this can be fixed ;)
I'm primarily a UI and graphic designer and, eventhough I have some experience with Typo3, I'm completely stuck at the following problem:
I have a large page tree with single pages for items from a catalogue (one item per page), the layouts for these items are built with Armin Vieweg's beautiful "Dynamic Content Elements" extension (DCE).
Now I want to create an overview page where I reference some of those items automatically - ideally I want to check a box in each element I want to display there (I would add a field catalogueItemPreview to the item DCE which authors can check or uncheck).
Unfortunately, I have no concrete idea of how the database is structured and how I could build a query (where would I even do that? in a custom-made plugin?).
This is how I imagine it could work: On the overview page I use a plugin/an extension in a Content Element that does the following:
search Typo3 DB for content elements with a field called "catalogueItemPreview"
return fields "catalogueItemTitle", "catalogueItemShortDescription", "cataloguePreviewImage"
use a template to render previews of all those elements on the overview page
I'm happy for ANY pointers towards a solution as currently I'm completely in the dark about where even to begin ...
Schematic screenshot from the Typo3 backend
thanks for using my DCE extension :)
Well the fields you have defined and their values in content elements are stored as XML, because the current version of DCE is based on Flexforms.
This makes it very very difficult to do MySQL queries using one of the field properties in WHERE clause. You could check for a xml string in the field pi_flexform but this is not recommended.
Instead I would use another property of content elements (tt_content) to mark the items as "Show on frontpage". For example you could create a new layout or section_frame value for that. Then it is very easy to just output the elements you want, using TypoScript.
How can I view all changes delivered to a stream and/or changes delivered by a specific developer ?
I could see the activities listed for a given ClearCase UCM stream, but I don't see anything with an RTC Stream.
I've been considering using a 'Work Item Query' but this does not seem to allow this functionality ?
You can search for change sets (a bit like you would list ClearCase activities sorted by owner):
Right-click on "Source-Control" and select "Search / Change sets": you will be able to make your query there.
Another less know place o see those change sets is in the "Team Dashboard" view, section "Events log", which you can filter by "Source control changes".
You will find more illustrations on "Change set searching" in:
The RTC feature page and this YouTube video.
The article "Finding Lost Content with Rational Team Concert" proposes some alternatives to change set searches.
This thread, which confirms "You can search for files with a given name, but you cannot currently search for files containing given text."
The result doesn't seem to display files directly through: using the field "Name begins with" is a way to limit the number of files included in those change sets.
And other enhancements are in progress for that feature: see this search.
Seems like a simple question, but I can't see where this is set.
I created a custom object, Account Thing, which is related to Accounts with a Master-Detail relationship.
It has a text area field, Body.
It has a Search Results Layout, and if i search for something contained in Body, a result returns.
I created another analogous custom object, Contact Thing. It also has a text area field, Body.
It does not have a Search Results Layout. If i search for something contained in Body, nothing returns. Looking at the list of objects being searched in the results page, Account Thing is listed, but not Contact Thing (or any other custom object i have created)
I'm thinking there must be a flag or search setting that i set for Account Thing, but I can't find it now.
I looked under App Setup > Customize > Search > Search Settings,
but there is no relevant config there.
Any help is appriciated!
I did some digging and found the solution to this issue.
Apparently only Custom Objects that have their own tab are included in search results.
I had somehow created a tab for Account Thing (but removed it from view), but not for
any of the other Custom Objects. After I added a tab, Contact Things were returned in relevant searches.
One other side piece of info is that the body was a Rich Text type, not a standard Text Area. So that explains why it is searchable.
Are you sure the Body on Account think uses a text area? I didn't think those would be searchable as you can't use them in the where clause of a SOQL query so would be surprised if the system did search them. Other than that, is the object marked as 'Deployed' or 'In Development'? If the latter, it probably wouldn't appear.
Because this is a non-code question you may well get closed down here, please follow (and vote on some questions) my Salesforce Stack Exchange proposal, I'm putting it forward so that these kind of questions (which are valid Salesforce development questions) have somewhere to live on Stack Exchange network!