diff options
| author | wjames5 <will@tekimaki.com> | 2008-03-28 21:09:48 +0000 |
|---|---|---|
| committer | wjames5 <will@tekimaki.com> | 2008-03-28 21:09:48 +0000 |
| commit | d1c9c79cb9d443da1c2db0a49c91a7baaaa57714 (patch) | |
| tree | 5786fce1b295e4a9e51cc4fde173674e4017b9e7 | |
| parent | 99278e6d6c6ced688f86db63e7c721a9b1666777 (diff) | |
| download | liberty-d1c9c79cb9d443da1c2db0a49c91a7baaaa57714.tar.gz liberty-d1c9c79cb9d443da1c2db0a49c91a7baaaa57714.tar.bz2 liberty-d1c9c79cb9d443da1c2db0a49c91a7baaaa57714.zip | |
new getViewTemplates for asking for center templates from any content type - content classes can override to use their templates - liberty provides generic center templates by default
| -rw-r--r-- | LibertyContent.php | 19 | ||||
| -rw-r--r-- | templates/center_list_generic.php | 20 | ||||
| -rw-r--r-- | templates/center_list_generic.tpl | 83 | ||||
| -rw-r--r-- | templates/center_view_generic.php | 35 | ||||
| -rw-r--r-- | templates/center_view_generic.tpl | 13 |
5 files changed, 169 insertions, 1 deletions
diff --git a/LibertyContent.php b/LibertyContent.php index cf737a0..dacc3c1 100644 --- a/LibertyContent.php +++ b/LibertyContent.php @@ -3,7 +3,7 @@ * Management of Liberty content * * @package liberty -* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.351 2008/03/22 21:14:55 jht001 Exp $ +* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.352 2008/03/28 21:09:48 wjames5 Exp $ * @author spider <spider@steelsun.com> */ @@ -1786,6 +1786,23 @@ class LibertyContent extends LibertyBase { /** + * returns a path to the template type requested + * this is intended for package override. while not a requirement please use a naming convention of center_<action>_<content_type_guid>.tpl for new tpls + * + * @param string $pAction the type of template. common types are view and list + */ + function getViewTemplate( $pAction ){ + $ret = null; + switch ( $pAction ){ + case "view": + case "list": + $ret = "bitpackage:liberty/center_".$pAction."_generic.tpl"; + break; + } + return $ret; + } + + /** * Pure virtual function that returns the include file that should render a page of content of this type * @return the fully specified path to file to be included */ diff --git a/templates/center_list_generic.php b/templates/center_list_generic.php new file mode 100644 index 0000000..a941548 --- /dev/null +++ b/templates/center_list_generic.php @@ -0,0 +1,20 @@ +<?php +/** + * @version $Header: /cvsroot/bitweaver/_bit_liberty/templates/center_list_generic.php,v 1.1 2008/03/28 21:09:48 wjames5 Exp $ + * @package bitweaver + */ +global $gBitSmarty, $gBitSystem, $gQueryUserId, $moduleParams, $gBitUser, $gLibertySystem, $gContent; + +if( !empty( $moduleParams ) ) { + extract( $moduleParams ); +} + +$_REQUEST['output'] = "raw"; + +include_once( LIBERTY_PKG_PATH.'list_content.php' ); + +if ( isset($moduleParams['content_type_guid'] )){ + $contentType = $gLibertySystem->mContentTypes[ $moduleParams['content_type_guid'] ]['content_description']; + $gBitSmarty->assign( "contentType", $contentType ); +} +?> diff --git a/templates/center_list_generic.tpl b/templates/center_list_generic.tpl new file mode 100644 index 0000000..beed221 --- /dev/null +++ b/templates/center_list_generic.tpl @@ -0,0 +1,83 @@ +{strip} +<div class="floaticon">{bithelp}</div> + +<div class="listing {$contentType|strtolower}"> + <div class="header"> + <h1>{tr}{if $contentType}{$contentType}s{else}Content Listing{/if}{/tr}</h1> + </div> + + {formfeedback error=$errors} + + <div class="body"> + {form class="minifind" legend="find in entries"} + <input type="hidden" name="sort_mode" value="{$sort_mode}" /> + {biticon ipackage="icons" iname="edit-find" iexplain="Search"} + <label>{tr}Title{/tr}: <input size="16" type="text" name="find_title" value="{$find_title|default:$smarty.request.find_title|escape}" /></label> + <label>{tr}Author{/tr}: <input size="10" type="text" name="find_author" value="{$find_author|default:$smarty.request.find_author|escape}" /></label> + <label>{tr}Last Editor{/tr}: <input size="10" type="text" name="find_last_editor" value="{$find_last_editor|default:$smarty.request.find_last_editor|escape}" /></label> + <input type="submit" name="search" value="{tr}Find{/tr}" /> + <input type="button" onclick="location.href='{$smarty.server.PHP_SELF}{if $hidden}?{/if}{foreach from=$hidden item=value key=name}{$name}={$value}&{/foreach}'" value="{tr}Reset{/tr}" /> + {/form} + + {form id="checkform"} + <div class="navbar"> + <ul> + <li>{biticon ipackage="icons" iname="emblem-symbolic-link" iexplain="sort by"}</li> + <li>{smartlink ititle="Title" isort="title" icontrol=$listInfo}</li> + <li>{smartlink ititle="Last Modified" iorder="desc" idefault=1 isort="last_modified" icontrol=$listInfo}</li> + <li>{smartlink ititle="Author" isort="creator_user" icontrol=$listInfo}</li> + <li>{smartlink ititle="Last Editor" isort="modifier_user" icontrol=$listInfo}</li> + {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='list_sort' serviceHash=$gContent->mInfo} + </ul> + </div> + + <input type="hidden" name="offset" value="{$offset}" /> + <input type="hidden" name="sort_mode" value="{$sort_mode}" /> + + <div class="clear"></div> + + <table class="data"> + <caption>{tr}{if $contentType}{$contentType}s{else}Content{/if} Listing{/tr} <span class="total">[ {$listInfo.total_records} ]</span></caption> + <tr> + {counter name=cols start=-1 print=false} + <th style="width:2%;">{smartlink ititle="ID" isort=content_id list_page=$listInfo.current_page ihash=$listInfo.ihash}</th> + {counter name=cols assign=cols print=false} + <th>{smartlink ititle="Title" isort=title list_page=$listInfo.current_page idefault=1 ihash=$listInfo.ihash}</th> + {counter name=cols assign=cols print=false} + <th>{smartlink ititle="Content Type" isort=content_type_guid list_page=$listInfo.current_page ihash=$listInfo.ihash}</th> + {counter name=cols assign=cols print=false} + <th>{smartlink ititle="Author" isort=$isort_author list_page=$listInfo.current_page ihash=$listInfo.ihash}</th> + {counter name=cols assign=cols print=false} + <th>{smartlink ititle="Most recent editor" isort=$isort_editor list_page=$listInfo.current_page ihash=$listInfo.ihash}</th> + {counter name=cols assign=cols print=false} + <th>{smartlink ititle="Last Modified" isort=last_modified list_page=$listInfo.current_page ihash=$listInfo.ihash}</th> + {counter name=cols assign=cols print=false} + {if $gBitUser->hasPermission('p_liberty_view_all_status')} + <th>{smartlink ititle="IP" isort=ip list_page=$listInfo.current_page ihash=$listInfo.ihash}</th> + {counter name=cols assign=cols print=false} + {/if} + </tr> + {foreach from=$contentList item=item} + <tr class="{cycle values='odd,even'}"> + <td style="text-align:center;">{$item.content_id}</td> + <td>{$item.display_link}</td> + <td>{assign var=content_type_guid value=`$item.content_type_guid`}{$contentTypes.$content_type_guid}</td> + <td>{displayname real_name=$item.creator_real_name user=$item.creator_user}</td> + <td>{displayname real_name=$item.modifier_real_name user=$item.modifier_user}</td> + <td>{$item.last_modified|bit_short_date}</td> + {if $gBitUser->hasPermission('p_liberty_view_all_status')} + <td style="text-align:center;">{$item.ip}</td> + {/if} + </tr> + {foreachelse} + <tr class="norecords"><td style="text-align:center;" colspan="{$cols}"> + {tr}No records found{/tr} + </td></tr> + {/foreach} + </table> + {/form} + + {pagination} + </div><!-- end .body --> +</div><!-- end .listing --> +{/strip} diff --git a/templates/center_view_generic.php b/templates/center_view_generic.php new file mode 100644 index 0000000..d7adc19 --- /dev/null +++ b/templates/center_view_generic.php @@ -0,0 +1,35 @@ +<?php +/** + * @version $Header: /cvsroot/bitweaver/_bit_liberty/templates/center_view_generic.php,v 1.1 2008/03/28 21:09:48 wjames5 Exp $ + * @package bitweaver + */ +global $moduleParams, $gContent, $gBitSmarty; + +$gContent = NULL; + +$lookupHash['content_id'] = ( !empty( $moduleParams['content_id'] ) ? $moduleParams['content_id'] : NULL ); + +if( $gContent = LibertyBase::getLibertyObject( $lookupHash['content_id'] ) ) { + if( !$gContent->hasViewPermission() ){ + // no perm then get rid of the content object + $gContent = NULL; + }else{ + // deal with the parsing + $parseHash['format_guid'] = $gContent->mInfo['format_guid']; + $parseHash['content_id'] = $gContent->mInfo['content_id']; + $parseHash['user_id'] = $gContent->mInfo['user_id']; + $parseHash['data'] = $gContent->mInfo['data']; + $gContent->mInfo['parsed_data'] = $gContent->parseData( $parseHash ); + + if( !empty( $moduleParams['title'] )) { + $gContent->mInfo['title'] = $moduleParams['title']; + } + + if ( isset($moduleParams['content_type_guid'] )){ + $gBitSmarty->assign( "contentType", $gContent->mType['content_description'] ); + } + } +} + +$gBitSmarty->assign( "gContent", $gContent ); +?> diff --git a/templates/center_view_generic.tpl b/templates/center_view_generic.tpl new file mode 100644 index 0000000..45283fb --- /dev/null +++ b/templates/center_view_generic.tpl @@ -0,0 +1,13 @@ +{if $gContent} +{strip} +<div class="display {$contentType}"> + {if $gContent->mInfo.title} + <div class="header"><h1>{$gContent->mInfo.title|escape}</h1></div> + {/if} + + <div class="content"> + {$gContent->mInfo.parsed_data} + </div> +</div> +{/strip} +{/if} |
