Page 1 of 18

AdvancedContent

Posted: Sat Apr 18, 2009 2:55 pm
by NaN
Hi,

i'm trying to improve the functionality of the content type "content".
I added some more params and changed some functions in the source.
All content items will be handled like content blocks.
(there is no default content anymore)

Additionally you can define what type the content block will be.
E.g. a checkbox, dropdown, mutliple select list, image...

You can also define in what tab the content block will be displayed.
So you can add some specific options.
You can also add an own tab where you can put in all the additional content blocks.
And last not least you can create tabs inside the tabs to group the content blocks in so called "block tabs".

I tested it with cmsms 1.5.2 and 1.5.4.
Works fine.

When working on that content type i realized, that the function GetPropertyValue() returns true if the property does not exist in the database.
That means when changing the content type of an existing page from content to my content type i get the value 1 of each additional content block.

Is this a bug?

Re: improve the content type "content"

Posted: Sat Apr 18, 2009 3:23 pm
by jmcgin51
Not to throw a wet blanket on your mods (which sound very interesting, BTW), but I'm guessing the response from the dev team will be "since you've modified the source, and we have no idea what you did, we can't tell you if this is a bug or not".

Hopefully I'm wrong... :)

Re: improve the content type "content"

Posted: Sat Apr 18, 2009 3:55 pm
by alby
jmcgin51 wrote: Hopefully I'm wrong... :)
wrong  :)
I have not yet seen (for lack of time) and so I don't know if same level but calguy1000 has implemented a something like this in 1.6

Alby

Re: improve the content type "content"

Posted: Sat Apr 18, 2009 3:59 pm
by NaN
I didn't modify anything in the core.
I just created an own content type which is an adaption of the original one.

The content with my content type will be called like this:

Code: Select all

{content block="test" type="checkbox" label="klicke me" page_tab="options" ... }
So in the tab "options" an additional checkbox will be show.
By default this checkbox is not checked.
This works if the page is added.
But when you edit a page i need to use the function  GetPropertyValue() to set this checkbox checked or not.
If that page has been stored with the original content type (without that checkbox) and is now changed to my adapted content type this checkbox suddenly is checked.
Even if there is no property stored in the database.

That means  

Code: Select all

$this->GetPropertyValue('test');
will return true for that checkbox even if it has never been saved before.
I can avoid this using vars of type string "true"/"false" instead of boolean vars.
But it seems strange to me.

If someone is interested you can try the attached file.
(remove the .mpg after download and unzip it.
copy the file content2.inc.php into lib/classes/contenttypes.
copy the file function.content2.php into your plugin directory (by default "plugins") )

There is no english documentation available in the plugin help for now but i will translate it if there is interest.

Edit (07.08.2009):
I did it again for CMSms 1.6.3.
I also added a feature to select if the page is public or for frontendusers only.
In opitons tab there is a List where you can select groups of the frontendusers module that may access this content.
If a visitor is not logged in or not in the selected group the login form will be shown.
(only works if feusers is installed and the content2 plugin is used)

Here is a list of the params:

  * (optional) block
          adds an additional content block (same like default)

            Example:
            {content2 block=\"Second Content Block\"}

    * (optional) wysiwyg (true/false)
          toggle wysiwyg editor on/of (same like default)

    * (optional) oneline (true/false)
          shows only a text input in one line (same like default)

    * (optional) value
          a predefined content

    * (optional) type (text,image,checkbox,dropdown,select_multiple)
          here you can define what type of input the added content block will be

    * (optional) page_tab
          here you can define in what tab the content block will be shown (you could add a checkbox to the options tab)

    * (optional) block_tab
          here you can create tabs inside of tabs to summarize some content blocks

    * (optional) label
          the label of the content block

    * (optional) assign
          assigns the content to a variable instead of printing it out

            Example:
            {content assign=pagecontent} {table_of_contents thepagecontent="$pagecontent"}


Params of Blocktype "checkbox":

    * (optional) checked (true/false)
          checks/unchecks the checkbox by default when editing a page

Params of Blocktype "dropdown"/"select_multiple":

    * (optional) items
          Value(s) of the field (separated by a comma)

    * (optional) selected
          preselected value(s) (separated by a comma)

Params of Blocktype "image": see content_image tag help

Re: improve the content type "content"

Posted: Sat Apr 18, 2009 4:00 pm
by NaN
alby wrote: I have not yet seen (for lack of time) and so I don't know if same level but calguy1000 has implemented a something like this in 1.6
Damn!
I'm too late again ;)

Re: improve the content type "content"

Posted: Sat Apr 18, 2009 4:16 pm
by alby
NaN wrote: I'm too late again ;)
Nan, change is a low level (all ContentType not Content only) but as I said I'm not sure why I have not looked yet.
It's better that I leave info to calguy1000 or to RonnyK because did some testing or you can enter in irc

Alby

Re: improve the content type "content"

Posted: Sat Apr 18, 2009 9:35 pm
by jmcgin51
alby wrote:
jmcgin51 wrote: Hopefully I'm wrong... :)
wrong  :)
I have not yet seen (for lack of time) and so I don't know if same level but calguy1000 has implemented a something like this in 1.6

Alby
Good!!  Thanks!! :-)

@NaN - I thought you modified the core because of this line in your post:
I added some more params and changed some functions in the source.
Will be interesting to see 1.6...

Re: improve the content type "content"

Posted: Fri Aug 07, 2009 2:59 pm
by NaN
I updated my changes to work with CMSms 1.6+ and added some features (see post #3)

Re: improve the content type "content"

Posted: Thu Oct 29, 2009 10:39 am
by maxfagotto
Very interesting!!
Did you released this improvement?
Thanks

Re: improve the content type "content"

Posted: Thu Oct 29, 2009 11:35 am
by axxe16
Is a real pity that the content does not have these default options. Whereas I do not understand why they are useful

Re: improve the content type "content"

Posted: Fri Oct 30, 2009 5:17 am
by JeremyBASS
Gosh... super super super... I wish I found this sooner... this is just about perfect... I need  to controll ove the way the inputs show up... but other wise.. damn this is great... Let me know if you wish for me to put up the changes I needed in the input display controlls....


Cheers
Jeremy

Re: improve the content type "content"

Posted: Sat Oct 31, 2009 3:41 am
by JeremyBASS
Here are the changes I needed and the files to go with it... I add to params to this...
'style'
'filter' (this is for Blocktype "image")

* (optional) style
          set an inline style to the inputs of all the block types

* (optional) filter (action:Prefix)
          exclude or include files with the set perfix


Usage is as such:

style='width:350px;font: 700 14px Arial, Helvetica, sans-serif;color: #333;'

filter="exclude:thumb_"
filter="include:thumb_"


So just some small changes but the exclude and include... well that has been long needed in the content_image tag

Cheers
Jeremy


NOTE:tested on CMSMS 1.6.6

Also I think a validtaion param would be good to add to... but I didn't need it so someone else can add it in... :D

Re: improve the content type "content"

Posted: Mon Nov 02, 2009 9:11 pm
by JeremyBASS
It should be noted that if you have any param on the {content} tag it's self there will be an error..  ;D

Re: improve the content type "content"

Posted: Tue Nov 03, 2009 11:51 pm
by NaN
What kind of error?
The default {content} plugin only clears params that belongs to the default plugin.
It passes all additional params to modules that are displayed inline.
Since if these modules are also clearing their params properly you may get a message like "warning unknown param..." for each param that does not belong to the module.
So using the default {content} plugin with the modified contenttype may be no good idea.
If you add params to the modified contenttype you also need to clear these params in the modified plugin if a module will be displayed inline.

Re: improve the content type "content"

Posted: Wed Nov 04, 2009 2:24 am
by JeremyBASS
block_tab add to the main  {content} ends in  fatal error... I'm not going to be able to replrace it to post at this time... but you can test by adding the  block_tab param... sorry I was a little vage there,,,