Monday 19 June 2006 2:34:33 pm
Hi, It would be very useful to add a ini setting were you could define the type of class you normally would create under a given node. Takes this structure for example:
Ez publish (2)
. . . News (61)
. . . . . . National (62)
. . . . . . Local (63)
. . . Images (83)
. . . Attachments (68)
In this case it would be natural to create an article object under News, an image object under Images, a file under Attachments and so on... This could easily be defined in <i>content.ini</i> like this using the <i>node_id</i> as the key:
[DefaultCreateHere]
#DefaultClassMap[node_id]=class_identifier
# /
DefaultClassMap[2]=menupage
# / News
DefaultClassMap[61]=article
# / Images
DefaultClassMap[83]=image
# / Attachments
DefaultClassMap[68]=file
And in the <i>design/admin/templates/children.tpl</i> [, override] we could use the <i>$node</i> var to do a "reverse dig" if the current node is not defined to check if the parent is specified in the <i>DefaultClassMap</i>.
First check if the current node is defined in the ini, if not; check if the parent node is, if not; check the parent parent node is, stop... I don't think it would be relevant for further digging.
<select name="ClassID" onchange="updateLanguageSelector(this)" title="{'Use this menu to select the type of item you wish to create and click the "Create here" button. The item will be created within the current location.'|i18n( 'design/admin/node/view/full' )|wash()}">
{def $DefaultClassMap=ezini('DefaultCreateHere','DefaultClassMap','content.ini')}
{def $prefered_class=null}
{if $DefaultClassMap[$node.node_id]}
{set $prefered_class = $DefaultClassMap[$node.node_id]}
{elseif $DefaultClassMap[$node.parent_node_id]}
{set $prefered_class = $DefaultClassMap[$node.parent_node_id]}
{elseif $DefaultClassMap[$node.parent.parent_node_id]}
{set $prefered_class = $DefaultClassMap[$node.parent.parent_node_id]}
{/if}
{section var=CanCreateClasses loop=$can_create_classes}
{if $CanCreateClasses.item.can_instantiate_languages}
<option{eq($prefered_class, $CanCreateClasses.item.identifier)|choose( '', ' selected' )} value="{$CanCreateClasses.item.id}">{$CanCreateClasses.item.name|wash()}</option>
{/if}
{/section}
</select>
It is not a timesaver per say, just luxury :) Just a suggestion, Thanks! PS! I have tested the code above, it works fine for me.
. muusle
|