How do I find every page where a form is used across a Kentico instance? - kentico

I'm have a Kentico site where there are dozens of old forms produced and managed by the Forms module (formerly BizForms). Many of them have various things wrong with them which will break my instance if I try to upgrade it. I need to be able to find everywhere a form is used on the instance so I can see if it's still in use and where to drop in its fixed replacement.
I'm currently on Kentico 8.2 and trying to upgrade all the way to Kentico 11, which is where the breakages occur.

You first need to understand where a form can be added from within the Kentico UI. Second, you'd need to take into account none of this will work for any instances where there is a form name hardcoded in any custom code. This will only reference the Kentico UI updates.
Where can forms reside in the UI?
Inside a page template using a webpart
Inside page content using a widget
If you're doing a search within a template, you need to create a SQL query to run code similar to this:
select *
from CMS_PageTemplate
where (PageTemplateWebParts like '%formcodename%' -- replace "formcodename" with your form code name
and PageTemplateWebParts like '% type="BizForm" %')
If you're doing a search within the page's content, you need to create a SQL query to run code similar to this:
select DocumentContent, *
from CMS_Document
where DocumentContent like '%(name)BizForm|(BizFormName)formcodename|%' -- replace "formcodename" with your form code name
Either if these queries should get you close to what you're looking for keeping in mind there is nothing out of the box.

Related

Alfresco community 4.2.c pagination

In our old project we're using Alfresco 4.2.c community version.
There's a task page there, were you can use predefined filters to manage data you want to see.
I was able to add some extra filters there, anyway another problem stands in my way.
There's a paginator there, probably from YUI, which works by two parameters, maxCount and skipCount.
Right now it's configured to show max 400 records on one page.
I'm trying to add an option to display all records at once. Is anyone familiar enough with that system to even tell if it's possible? YUI framework is very hard to manage.
It seems like on every page or filter change it redirects you to ahref='#', a then a method reads the filter id and gives some extra parameters to the request. I can't find a way to maybe bind another button to reload the page in the same manner and just add another line to the request, which would make the paginator show all the records at one page.

Kentico 10 - Web Part content change via database

i was trying to understand in the Kentico's database model how can i change the web parts content using a database script.
So, basically i have a website based on Kentico with several articles, and internal hyperlinks in its content. But the problem is that the format of those hyperlinks are actually invalid. And i was looking for a way to build a script and do a bulk-update in order to replace some characters and update those hyperlinks to the valid format.
Any idea how can i build the query to get the content of all web parts used in all published pages.
Thank you
It depends on your web parts and how the content is rendered. There are different ways that web parts render their content:
The web part layout is used for markup
The ASCX file for the web part is used for markup
The web part makes use of a repeater that uses a Transformation to render the markup- The markup is generated in code behind
The last one can be tricky to change depending on the web part and whether you have access to all the code behind, but the others you can change either in code in your solution or within the Administration area itself.
Doing this in SQL would probably require a combination of T-SQL XML support and regular expressions to find what you're looking for. you effectively need to look in the CMS_WebPart and CMS_WebPartLayout tables to find what you're looking for.
However, reading your query, I'm not 100% sure you're talking about web parts, (my apologies if you are) as you talk about links in the article content itself. If these are set using the Editable text web part, then you need to look in the CMS_Document table at the DocumentContent field to find the links to replace. But you then need to look at how to correctly format those links going forward so that you do not need to repeat this process later.
Note:
You need to be really careful when doing this in SQL to make sure that you don't create invalid XML. Things go bad when you do that.
This won't flush your cache, so you'll need to clear your cache manually afterwards.
If you're using out-of-the-box web parts, you should really make a copy of them and use the copy if you're going to modify, this way, you're less likely to have pain in future upgrades.
Typically "content" is not set in a webpart. Webparts are configured to retrieve content from page types. There is an exception to this with specific webparts like Editable Text, Static Text, Static HTML, etc.
The configuration of a webpart is stored at the template level in the cms_pagetemplate table. The configuration for ALL webparts on that page template are stored in the PageTemplateWebParts field. So you'd have to parse through the XML and get the proper webpart and then perform an update on that field. You maybe able to do a regex to find that content and replace it as well.
Not ideal to do this via SQL simply because of version history and it can cause a lot of problems later on. I'd suggest finding out which API calls you can make to perform these updates and write a small program for it.

Drupal how to add a search filter to admin content page

I've never used Drupal before (development or managing content). I was asked to extend the admin content page to have a filter and simply don't know enough to get moving quickly.
Can anyone tell me if adding a search by text filter in the admin content area requires code or is there a CMS feature like adding a node for this task.
If code is required, is there something like a hook for this area? Not sure where to start. I will be investigating on my own but pointers to get me oriented to Drupal would help.
By default Drupal provides search mechanism ready to use. But there are also additional module which can improve search experience. You don't need any coding to use that search. You already have search form block ready to use.
Go to Structure -> Blocks and find block called "Search form". Now all you have to do is to put that block in some region and it will appear on front-end. Of course if it's not already styled by your theme it may be needed to put some extra CSS to make it look nice. There are also some template files which you can override and put some your HTML if you need.
There's also template file for search results page (which of course will work out of box also).
You may also need to create new block region if you want to place your form at some specific place, not covered by any existing region defined by your theme (easy thing to do!).
See https://drupal.stackexchange.com/q/30633/101329, the "Admin Views" module lets you configure the search form as you like.

Can I use a Kentico macro to get a partial path?

I would like to know if it is possible to use kentico macros (not necessarily coding a custom one) to access part of the rewritten URL's Path.
Example: http://www.mysite.com/Category/Subcategory/
I would like to get the last part (Subcategory) so that I may then filter content dynamically. The reason I want to use the macro is to simply not have to have 20+ different page templates only so I can have different web part properties.
Assuming you are using Portal templates, and you don't want an 'all items in all subcategories' list on the parent:
Create an Article List web part on the parent page — parent to all the sub-categories.
Set the web part Path to /{0}/{1}/{2}/% (if your path was /Home/Parent/Subcategory for example) or something similar for your environment.
Use the default setting of Inherit for the page template for all subcategory pages.
This will not show anything on the parent page, and the sub-categories will show only the documents under themselves. Note: If you want the subcategory items to have their own views when user digs down to /{0}/{1}/{2}/item, you may need to filter by changing template inheritance, or Document Types on the web part, or something like that if you don't want the whole sub-category list to also show on the item-specific pages.
You can create a custom macro or, you can also use the string operations which are allowed within macros. Please see http://devnet.kentico.com/docs/6_0/devguide/available_macro_methods.htm#string_methods (and you can e.g. use the EndsWith or TrimStrart or something similar).
However, I think the best way would be to create a custom macro which will exactly fit. There might be some combination of macros and macro functions - but I think it is faster just to code a custom one which will cover your need 100%.
Also, you can take a look on the K# if there is something that will fit - http://devnet.kentico.com/docs/6_0/devguide/ksharp_syntax.htm

Sharepoint 2007 - Finding out where a view is used

I'm a MOSS 2007 newbie and am trying to find out where a view is used.
I have a larger list and i want to have two different views into that list. I've inherited the site collection, and currently there are three views, with two of them named almost identically. Now i'd like to find out if i can safely remove one of those views.
So the question is: Is there a way to find out all references to a view?
I'll provide additional information gladly!
"First part of my problem is that i'd like to find out which view this web part is using."
"Second part is that i have a set of views made from a list, and i should find out if some web part is using some of those views"
A Web Part does not use a view directly. The current view of the web part is based upon a view, but if you change or delete the view, the web part still displays your list/library as before. Thus, if you delete your views, all web parts will still continue to function.
What you should probably do is compare your views (which fields are displayed, filtering, sorting, grouping, etc.) with each other and also with the view inside your web part. That way, you'll know which view was used before.
What could happen is that you break links to your view page. This is, if on some other page there is a direct link to your view.
What are you trying to do exactly? To get all the views of a specific list, use SPList.Views and load them in the SPViewCollection.

Resources