Do you have some feature in mind that you'd love to see in Couch? Let us know.
12 posts Page 1 of 2
It has been more than 2 years since I have used couch and I am using it at the moment to create an investigation system.

Imagine that I have a clonable template named " Investigation Builder" which allows me with mosaic, repeatable regions and so on to define a technical investigation's input fields. This works great but at this point, I want that page to become clonable and usable on itself.

Therefore, after you create an investigation type in the clonable template, is there a way to fork that page and create it as a master page on itself that can be cloned by users and filled with investigation data?
This is what you need? viewtopic.php?f=8&t=11545#p30806
trendoman wrote: This is what you need? viewtopic.php?f=8&t=11545#p30806


Good day @trendoman.

Unfortunately I am aware of this function but this makes a copy of a cloned page and places it under the same template.

What I desire is to be able to copy a cloned page of a template and turn it into a clonable template on itself.

Image
Apologies, I must have missed a bit in the starting post. :)

Basically, you have a 'Template Constructor/Builder', where you add editable fields in AdminPanel, via UI, Vs writing them down in file.

Next, you want to take this new set of fields and make them a new template.

To do that, there should be a code that analyzes your set of fields, created in UI, and produces a real CouchCMS code that is pasted to a new .php file to become a template.

I am not aware of any such code, but it can be created if you are up to a challenge. :)

Try the following on the Builder template and see details of the fields you added -
Code: Select all
<cms:db_fields>
    <cms:dump />
</cms:db_fields>

Valid parameters taken by tag cms:db_fields being -
masterpage = ''
page_name = ''
names = '' => name(s) of fields to fetch. Can have negation
types = '' => type(s) of fields to fetch. Can have negation
skip_system = '1'
skip_deleted = '1'


It should get you started.
trendoman wrote: Apologies, I must have missed a bit in the starting post. :)

Basically, you have a 'Template Constructor/Builder', where you add editable fields in AdminPanel, via UI, Vs writing them down in file.

Next, you want to take this new set of fields and make them a new template.

To do that, there should be a code that analyzes your set of fields, created in UI, and produces a real CouchCMS code that is pasted to a new .php file to become a template.

I am not aware of any such code, but it can be created if you are up to a challenge. :)

Try the following on the Builder template and see details of the fields you added -
Code: Select all
<cms:db_fields>
    <cms:dump />
</cms:db_fields>

Valid parameters taken by tag cms:db_fields being -
masterpage = ''
page_name = ''
names = '' => name(s) of fields to fetch. Can have negation
types = '' => type(s) of fields to fetch. Can have negation
skip_system = '1'
skip_deleted = '1'


It should get you started.


I just figured out one thing that could make my life easier.

I have the main template where i am defining the first investigation type. The only thing that I need right now is to find a way to combine the copy-to-new function previously stated with one that also copies the php file and registeres is under a new name in couchCMS. After that, every time the new template is going to be used by someone, it will just create a copy of the first entry which has all the fields pre-defined and only fill out the empy one and save it.

Do you have any script like that laying around from previous projects :))

____________

Or simply just create a clone of the .php file together with the DB contents and register it under a new name to put it blantly...
How do you intend to overcome this obstacle - that only superadmin can register templates?

It would also be helpful to peak into the Investigation Builder. If possible, please attach both - 1. code for the php template and 2. a screenshot of the page 'Investigation Template 1' in admin panel. Or send those via PM, if you wish so.
trendoman wrote: How do you intend to overcome this obstacle - that only superadmin can register templates?

It would also be helpful to peak into the Investigation Builder. If possible, please attach both - 1. code for the php template and 2. a screenshot of the page 'Investigation Template 1' in admin panel. Or send those via PM, if you wish so.


Well, only the SuperAdmin should be able to register new templates, all other users can just create clones of those templates and fill in the details.

The code for the Investigatio builder is pretty simple as I am trying to keep things clean and simple in values :

Code: Select all
<cms:template title='Investigation builder' clonable='1' dynamic_folders='1' />

<cms:config_list_view>
    <cms:field 'k_selector_checkbox' />
    <cms:field 'k_actions' />
    <cms:field 'k_page_title' />
    <cms:field 'k_comments_count' />
    <cms:field 'k_page_foldertitle' />
    <cms:field 'k_page_date' />
</cms:config_list_view>
<cms:config_form_view>
    <cms:field 'k_page_name' group='_advanced_settings_' />
</cms:config_form_view>

<cms:editable type='text' name='details_title' label='Section Title'  />
<cms:editable type='nicedit' name='details' label='Section Description'  buttons='italic, bold' height='100' />

<cms:editable type='relation' name='k_page_title' masterpage='systems.php' has='one' />
       
<cms:mosaic name='fields' label='Fields'>
    <cms:tile name='field' label='Field'>
        <cms:editable
         type='text'
         name='field_title'
         label='Field Title' 
        />
      <cms:editable
           type='nicedit'
            name='field_desc'
            label='Field Description'
            buttons='italic, bold'
            height='100'
        />
        <cms:editable
         name="field_size"
         label="Field size"
         desc="Select field size"
         opt_values='Single line | Double line'
         type='radio'
        />
       
        <cms:repeatable name='input' label='Input Fields' >
            <cms:editable
               type='text'
                name='input_desc'
                label='Field Description'
            />
            <cms:editable
              name="input_type"
              label="Input Type"
              desc="Select Input Type"
              opt_values='Input | Dropdown | Checkbox'
              type='dropdown'
            />
            <cms:editable
               type='text'
                name='input_opt'
                label='Options'
                desc='Static values divided by | or...' 
            />
            <cms:editable
              name="input_required"
              label="Required?"
              opt_values='Yes | No'
              type='radio'
            />
            <cms:editable
               type='text'
                name='input_value'
                label='Value'
            />

        </cms:repeatable>
    </cms:tile>
</cms:mosaic>


</cmc:template>


And the way it is being used is like this :

demo2.PNG
demo2.PNG (39.93 KiB) Viewed 3123 times


Where the only thing the regular users will be able to fill in are the values fields, everything else would be pre-defined and copied with the copy-to-new function.
Interesting. As I expected, this reminds me of my own adventurous attempt to create a similar functionality.

I failed to complete that, it is complicated and required more time than I could afford at the moment.

Constructing a 'text input' may seem an easy task, but the number of variable parameters of cms:editable is big. I remember to have started on that around 2019. Here is a screenshot of configuration for a text input -

Screenshot_2020-05-25 Admin Panel - type text.png
Screenshot_2020-05-25 Admin Panel - type text.png (72.18 KiB) Viewed 3124 times


-

This is what commercial form builders do - they allow to build forms, then allow users to save the forms as a Collection of Inputs, tweak form's options, configure access and share such Forms with other users, so those can start filling in them immediately.

Do not try to complicate things, experiment with a single text input (a "Comment Form") and try to recreate it programmatically for users. It is a big challenge!

-

I have an old screenshot from Wordpress where a form is saved to backend with an 'id' and even can be inserted with a shortcode. Nice feature.
screenshot-1.png
screenshot-1.png (156.9 KiB) Viewed 3124 times
I wonder if the latest feature of CouchCMS - PageBuilder can be adapted to become a Constructor. Check it viewtopic.php?f=5&t=13148

An example site built with PB, has Forms https://themes.couchcms.com/tutor/block/contact/ - this is a good starting point for experiments.
@KK , do you have some sort of trick up your sleeve to achieve the following narrowed down functionality?

1.
Go to a template in Admin mode
2. Select one cloned page
3. Upon selecting a cloned page, an input field for "Template Name" and a button "Create Template" appear at the top next to "Add new"
4. Upon filling the template name and clicking the "Create Template" button, a copy of the .php file is being made, a new template is registered within couch and the default page becomes the selected cloned page from the previous template, similar to the "Copy to new" addon
12 posts Page 1 of 2
cron