diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2005-10-29 17:54:23 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2005-10-29 17:54:23 +0000 |
| commit | 300a03c554874c55d3a6861450a7c780e19c89f4 (patch) | |
| tree | 8d981b7144d6720f2b2c28b27d3c4a1b4be6cb83 | |
| parent | 820d5024847583238bfc8cbc194887156e930dfc (diff) | |
| download | liberty-300a03c554874c55d3a6861450a7c780e19c89f4.tar.gz liberty-300a03c554874c55d3a6861450a7c780e19c89f4.tar.bz2 liberty-300a03c554874c55d3a6861450a7c780e19c89f4.zip | |
merge recent changes into HEAD
| -rw-r--r-- | LibertyAttachable.php | 15 | ||||
| -rw-r--r-- | admin/schema_inc.php | 32 | ||||
| -rw-r--r-- | attachment_browser.php | 4 | ||||
| -rw-r--r-- | edit_storage_inc.php | 5 | ||||
| -rw-r--r-- | plugins/data.code.php | 6 | ||||
| -rw-r--r-- | plugins/storage.lulu.php | 4 | ||||
| -rw-r--r-- | templates/attachment_browser.tpl | 108 | ||||
| -rw-r--r-- | templates/comments.tpl | 2 | ||||
| -rw-r--r-- | templates/edit_storage.tpl | 86 | ||||
| -rw-r--r-- | templates/list_content_inc.tpl | 2 |
10 files changed, 128 insertions, 136 deletions
diff --git a/LibertyAttachable.php b/LibertyAttachable.php index 378b66d..cd1f529 100644 --- a/LibertyAttachable.php +++ b/LibertyAttachable.php @@ -3,7 +3,7 @@ * Management of Liberty Content * * @package liberty - * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyAttachable.php,v 1.6 2005/09/03 10:20:02 squareing Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyAttachable.php,v 1.7 2005/10/29 17:54:23 squareing Exp $ * @author spider <spider@steelsun.com> */ // +----------------------------------------------------------------------+ @@ -169,6 +169,8 @@ class LibertyAttachable extends LibertyContent { if( !empty( $pParamHash['upload']['size'] ) && !empty( $pParamHash['upload'] ) && is_array( $pParamHash['upload'] ) ) { $save = TRUE; +/* +Disable for now - instead fend off new uploads once quota is exceeded. Need a nice upload mechanism that can cancel uploads once the upload has begun, ala megaupload if( $gBitSystem->isPackageActive( 'quota' ) && !$gBitUser->isAdmin() ) { require_once( QUOTA_PKG_PATH.'LibertyQuota.php' ); $quota = new LibertyQuota(); @@ -180,7 +182,7 @@ class LibertyAttachable extends LibertyContent { $this->mErrors['upload'] = $pParamHash['upload']['name'].' '.tra( 'could not be stored because you do not have enough disk quota.' ).' '.round(($u + $pParamHash['upload']['size'] - $q)/1000).'KB Needed' ; } } - +*/ if( $save ) { // - TODO: get common preferences page with this as an option, but right now files are only option cuz no blobs - SPIDERR $storageGuid = $gBitSystem->getPreference( 'common_storage_plugin', PLUGIN_GUID_BIT_FILES ); @@ -261,8 +263,13 @@ class LibertyAttachable extends LibertyContent { if( !empty( $pParamHash['existing_attachment_id'] ) ) { foreach($pParamHash['existing_attachment_id'] as $existingAttachmentId) { - if( !empty($existingAttachmentId) ) { - $this->cloneAttachment($existingAttachmentId, $pParamHash['content_id']); + // allow for multiple values seperated by any non numeric character + $ids = preg_split( '/\D/', $existingAttachmentId ); + foreach( $ids as $id ) { + $id = ( int )$id; + if( !empty( $id ) ) { + $this->cloneAttachment( $id, $pParamHash['content_id'] ); + } } } } diff --git a/admin/schema_inc.php b/admin/schema_inc.php index cf1289d..ede89fa 100644 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -141,26 +141,26 @@ $gBitInstaller->registerSchemaSequences( LIBERTY_PKG_NAME, $sequences ); // ### Default Preferences $gBitInstaller->registerPreferences( LIBERTY_PKG_NAME, array( - array('liberty', 'cacheimages','n'), - array('liberty', 'cachepages','n'), - array('liberty', 'default_format','tikiwiki'), - array('liberty', 'liberty_auto_display_attachment_thumbs', 'y'), -// array('liberty', 'liberty_attachment_link_format', 'wiki') not needed anymore since we use js in the edit page now (depends on format of content) + array(LIBERTY_PKG_NAME, 'cacheimages','n'), + array(LIBERTY_PKG_NAME, 'cachepages','n'), + array(LIBERTY_PKG_NAME, 'default_format','tikiwiki'), + array(LIBERTY_PKG_NAME, 'liberty_auto_display_attachment_thumbs', 'y'), +// array(LIBERTY_PKG_NAME, 'liberty_attachment_link_format', 'wiki') not needed anymore since we use js in the edit page now (depends on format of content) ) ); // ### Default UserPermissions $gBitInstaller->registerUserPermissions( LIBERTY_PKG_NAME, array( - array('bit_p_edit_html_style', 'Can include style information in HTML', 'editors', 'liberty'), - array('bit_p_post_comments', 'Can post new comments', 'registered', 'liberty'), - array('bit_p_read_comments', 'Can read comments', 'basic', 'liberty'), - array('bit_p_remove_comments', 'Can delete comments', 'editors', 'liberty'), - array('bit_p_vote_comments', 'Can vote comments', 'registered', 'liberty'), - array('bit_p_edit_comments', 'Can edit all comments', 'editors', 'liberty'), - array('bit_p_use_content_templates', 'Can use content templates', 'registered', 'liberty'), - array('bit_p_edit_content_templates', 'Can edit content templates', 'editors', 'liberty'), - array('bit_p_content_attachments', 'Can create content attachments', 'registered', 'liberty'), - array('bit_p_detach_attachment', 'Can detach content attachments', 'registered', 'liberty'), - array('bit_p_print', 'Can print content', 'basic', 'liberty'), + array('bit_p_edit_html_style', 'Can include style information in HTML', 'editors', LIBERTY_PKG_NAME), + array('bit_p_post_comments', 'Can post new comments', 'registered', LIBERTY_PKG_NAME), + array('bit_p_read_comments', 'Can read comments', 'basic', LIBERTY_PKG_NAME), + array('bit_p_remove_comments', 'Can delete comments', 'editors', LIBERTY_PKG_NAME), + array('bit_p_vote_comments', 'Can vote comments', 'registered', LIBERTY_PKG_NAME), + array('bit_p_edit_comments', 'Can edit all comments', 'editors', LIBERTY_PKG_NAME), + array('bit_p_use_content_templates', 'Can use content templates', 'registered', LIBERTY_PKG_NAME), + array('bit_p_edit_content_templates', 'Can edit content templates', 'editors', LIBERTY_PKG_NAME), + array('bit_p_content_attachments', 'Can create content attachments', 'registered', LIBERTY_PKG_NAME), + array('bit_p_detach_attachment', 'Can detach content attachments', 'registered', LIBERTY_PKG_NAME), + array('bit_p_print', 'Can print content', 'basic', LIBERTY_PKG_NAME), ) ); ?> diff --git a/attachment_browser.php b/attachment_browser.php index 227675b..3a0836a 100644 --- a/attachment_browser.php +++ b/attachment_browser.php @@ -3,7 +3,7 @@ * attachment_browser * * @author spider <spider@steelsun.com> - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * @package liberty * @subpackage functions */ @@ -11,7 +11,7 @@ /** * bit setup */ -include("../bit_setup_inc.php"); +include_once("../bit_setup_inc.php"); $userAttachments = $gBitUser->getUserAttachments(); $gBitSmarty->assign('userAttachments', $userAttachments); diff --git a/edit_storage_inc.php b/edit_storage_inc.php index 8567bc1..22e8ffe 100644 --- a/edit_storage_inc.php +++ b/edit_storage_inc.php @@ -3,7 +3,7 @@ * edit_storage_inc * * @author spider <spider@steelsun.com> - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * @package liberty * @subpackage functions * @@ -16,6 +16,9 @@ global $gBitSmarty, $gContent, $gBitUser, $gLibertySystem; $attachmentActionBaseURL = $_SERVER['PHP_SELF'].'?'; $GETArgs = split('&',$_SERVER['QUERY_STRING']); +$userAttachments = $gBitUser->getUserAttachments(); +$gBitSmarty->assign('userAttachments', $userAttachments); + $firstArg = TRUE; foreach ($GETArgs as $arg) { $parts = split('=',$arg); diff --git a/plugins/data.code.php b/plugins/data.code.php index 6b354a1..665e041 100644 --- a/plugins/data.code.php +++ b/plugins/data.code.php @@ -1,6 +1,6 @@ <?php /** - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * @package liberty * @subpackage plugins_data */ @@ -14,10 +14,10 @@ // | -> see http://phpdocu.sourceforge.net/ // +----------------------------------------------------------------------+ // | Author (TikiWiki): Luis Argerich <lrargerich@users.sourceforge.net> -// | Reworked for Bitweaver (& Undoubtedly Screwed-Up) +// | Reworked for Bitweaver (& Undoubtedly Screwed-Up) // | by: StarRider <starrrider@users.sourceforge.net> // +----------------------------------------------------------------------+ -// $Id: data.code.php,v 1.5 2005/08/07 17:40:31 squareing Exp $ +// $Id: data.code.php,v 1.6 2005/10/29 17:54:23 squareing Exp $ /** * definitions diff --git a/plugins/storage.lulu.php b/plugins/storage.lulu.php index abd04d3..d9f3c8e 100644 --- a/plugins/storage.lulu.php +++ b/plugins/storage.lulu.php @@ -1,6 +1,6 @@ <?php /** - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * @package liberty * @subpackage plugins_storage */ @@ -62,7 +62,7 @@ $gLibertySystem->registerPlugin( PLUGIN_GUID_LULU, $pluginParams ); $ret['thumbnail_url']['medium'] = 'http://www.lulu.com/author/display_thumbnail.php?fSize=detail_&fCID='.$pRow['foreign_id']; $ret['thumbnail_url']['large'] = 'http://www.lulu.com/author/display_thumbnail.php?fSize=320_&fCID='.$pRow['foreign_id']; $ret['attachment_id'] = $pRow['attachment_id']; - $ret['wiki_plugin_link'] = "{ATTACHMENT(id=>".$ret['attachment_id'].")}{ATTACHMENT}"; + $ret['wiki_plugin_link'] = "{attachment id=".$ret['attachment_id']."}"; } return $ret; } diff --git a/templates/attachment_browser.tpl b/templates/attachment_browser.tpl index 43716ac..7dbf389 100644 --- a/templates/attachment_browser.tpl +++ b/templates/attachment_browser.tpl @@ -1,80 +1,36 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <title>{tr}Attachment Browser{/tr}</title> - - {if $gBitSystem->mStyles.styleSheet} - <link rel="stylesheet" title="{$style}" type="text/css" href="{$gBitSystem->mStyles.styleSheet}" media="all" /> - {/if} - {if $gBitSystem->mStyles.browserStyleSheet} - <link rel="stylesheet" title="{$style}" type="text/css" href="{$gBitSystem->mStyles.browserStyleSheet}" media="all" /> - {/if} - {if $gBitSystem->mStyles.customStyleSheet} - <link rel="stylesheet" title="{$style}" type="text/css" href="{$gBitSystem->mStyles.custumStyleSheet}" media="all" /> - {/if} - {foreach from=$gBitSystem->mStyles.altStyleSheets item=alt_path key=alt_name} - <link rel="alternate stylesheet" title="{$alt_name}" type="text/css" href="{$alt_path}" media="screen" /> - {/foreach} - - <script type="text/javascript" src="{$smarty.const.KERNEL_PKG_URL}bitweaver.js"></script> - - {literal} - <script type="text/javascript"><!-- - function returnAttachmentId(attachmentId) { - self.opener.document.getElementById("existing_attachment_id_input").value = attachmentId; - self.close(); - } - --></script> - {/literal} - - <!--[if gte IE 5.5000]> - <script type="text/javascript" src="{$smarty.const.THEMES_PKG_URL}js/pngfix.js"></script> - <![endif]--> - {strip} -</head> -<body> - <div id="attbrowser"> - <div class="display attbrowser"> - <div class="header"> - <h1>Attachment Browser</h1> - <h2>at some point this page should only show attachments that aren't already attached.</h2> - </div> + <noscript> + <p>Please insert {ldelim}attachment id=#{rdelim} where # is the appropriate attachment ID.</p> + </noscript> - <div class="body"> - {legend legend="Avalable attachments"} - <noscript> - <p>Since you don't seem to have javascript enabled, please hover your mouse over an attachment and use the number that appears to attach a given item to your page. - </p> - </noscript> + <table class="data"> + <caption>{tr}Available Attachements{/tr}</caption> + {counter start=-1 name="cells" print=false} + {foreach from=$userAttachments item=attachment key=foo} + {counter name="cells" assign="cells" print=false} + {if $cells % 2 eq 0} + <tr class="{cycle values="odd,even"}"> + {/if} - <table class="data"> - {counter start=-1 name="cells" print=false} - {foreach from=$userAttachments item=attachment key=foo} - {counter name="cells" assign="cells" print=false} - {if $cells % 2 eq 0} - <tr class="{cycle values="odd,even"}"> - {/if} - <td> - <a title="{tr}Attachment id: {$attachment.attachment_id}{/tr}" href="javascript:void();" style="cursor:hand;" onclick="returnAttachmentId({$attachment.attachment_id})"> - <img src="{$attachment.thumbnail_url.small}" alt="{$attachment.filename}" /> - <br /> - {$attachment.filename} - </a> - </td> - {if $cells % 2 ne 0} - </tr> - {/if} - {/foreach} - {if $cells % 2 eq 0} - <td> </td></tr> - {/if} - </table> - {formhelp note="Clicking on an item will attach the item to your wiki page."} - {/legend} - </div><!-- end .body --> - </div><!-- end .attbrowser --> - </div><!-- end #attbrowser --> -</body> -</html> + <td> + <a title="{tr}Attachment id: {$attachment.attachment_id}{/tr}" href="javascript:insertAt( 'copy', '{ldelim}attachment id={$attachment.attachment_id}{rdelim}' );"> + <img src="{$attachment.thumbnail_url.small}" alt="{$attachment.filename}" /><br /> + {$attachment.filename}<br /> + Attachment ID: {$attachment.attachment_id} + </a> + </td> + + {if $cells % 2 ne 0} + </tr> + {/if} + {foreachelse} + <tr class="norecords"><td>{tr}No Records Found{/tr}</td></tr> + {/foreach} + {if $cells % 2 eq 0} + <td> </td></tr> + {/if} + </table> + {if $userAttachments} + {formhelp note="Clicking on an item will attach the item to your wiki page."} + {/if} {/strip} diff --git a/templates/comments.tpl b/templates/comments.tpl index d7b8ee3..d8c046a 100644 --- a/templates/comments.tpl +++ b/templates/comments.tpl @@ -76,7 +76,7 @@ If cookie is not set, then use $gBitSystemPrefs.comments_display_expanded to det <div class="row"> {formlabel label="Comment" for="commentpost"} {forminput} - <textarea id="commentpost" name="comment_data" rows="10" cols="80">{$postComment.data}</textarea> + <textarea id="commentpost" name="comment_data" rows="10" cols="50">{$postComment.data}</textarea> {formhelp note="Use [http://www.foo.com] or [http://www.foo.com|description] for links.<br />HTML tags are not allowed inside comments."} {/forminput} </div> diff --git a/templates/edit_storage.tpl b/templates/edit_storage.tpl index 2dcf1ee..9dd02a6 100644 --- a/templates/edit_storage.tpl +++ b/templates/edit_storage.tpl @@ -1,8 +1,6 @@ -{php} -include (LIBERTY_PKG_PATH."edit_storage_inc.php"); -{/php} -{strip} +{php} include (LIBERTY_PKG_PATH."edit_storage_inc.php"); {/php} {if $gContent->hasUserPermission('bit_p_content_attachments')} +{strip} {foreach from=$gLibertySystem->mPlugins item=plugin key=guid} {if $plugin.is_active eq 'y' and $plugin.edit_field and $plugin.plugin_type eq 'storage'} <div class="row"> @@ -14,43 +12,69 @@ include (LIBERTY_PKG_PATH."edit_storage_inc.php"); </div> {/if} {/foreach} +{/strip} + + <h2><a href="javascript:flip( 'attbrowser' );">{tr}Attachment Browser{/tr}</a> <small>click to show / hide</small></h2> + + <script type="text/javascript">//<![CDATA[ + this.document.write( '<div class="row" style="display:none;" id="attbrowser">' ); + //]]></script> + + <div class="row"> + {formlabel label="Attach File(s)"} + {forminput} + <input type="text" name="existing_attachment_id[]" id="existing_attachment_id_input" size="20"/> + {formhelp note="Attaching an item to your page will insert a small icon representing the file. Please use the attachment IDs listed below.<br />You can attach multiple items at once by seperating them with a ',' (comma)."} + {/forminput} + </div> + + <div class="row"> + {formlabel label="Insert Attachment"} + {forminput} + <input type="text" name="dummy" id="copy" size="30" class="success" /> + <input type="button" value="{tr}Clear{/tr}" onclick="document.getElementById( 'copy' ).value = '';" /> + {formhelp note="Using this method will display the attachment within your text. See the help at the bottom of the page for more details.<br />Please copy the above to your textarea and insert where needed."} + {/forminput} + </div> - <!-- Attach existing attachment --> - <div class="row"> - {formlabel label="Existing Attachment ID"} - {forminput} - <input type="text" name="existing_attachment_id[]" id="existing_attachment_id_input" size="6"/><br /> - {jspopup href="`$smarty.const.LIBERTY_PKG_URL`attachment_browser.php" title="Attachment browser"} - {/forminput} - </div> + <div class="attbrowser" style="overflow:auto; width:auto; height:400px;"> + {include file="bitpackage:liberty/attachment_browser.tpl"} + </div> + <script type="text/javascript">//<![CDATA[ + this.document.write( '</div>' ); + //]]></script> + +{strip} {if $gContent->mStorage} <div class="row"> <table class="data" summary="List of attached files"> + <caption>{tr}Attached Items{/tr}</caption> <tr> - <th scope="col">Thumbnail</th> - <th scope="col" title="File Properties"></th> + <th scope="col" title="{tr}Thumbnail{/tr}">{tr}Thumbnail{/tr}</th> + <th scope="col" title="{tr}File Properties{/tr}">{tr}File Properties{/tr}</th> </tr> + {foreach from=$gContent->mStorage item=storage key=attachmentId} - <tr class="{cycle values="odd,even"}"> - <td style="text-align:center;"><a href="{$storage.source_url}"><img src="{$storage.thumbnail_url.small}" alt="{$storage.filename}" /></a></td> - <td> - ID: {$attachmentId} - <br /> - Filename: {$storage.filename} - <br /> - Actions: - {if $gBitUser->isAdmin() || $bit_p_detach_attachment || $storage.user_id == $gBitUser->mUserId} - <a href="{$attachmentActionBaseURL}&detachAttachment={$storage.attachment_id}">{biticon ipackage=liberty iname="detach" iexplain="detach"}</a> - {/if} - {if $gBitUser->isAdmin() || $storage.user_id == $gBitUser->mUserId} - <a href="{$attachmentActionBaseURL}&deleteAttachment={$storage.attachment_id}">{biticon ipackage=liberty iname="delete" iexplain="delete"}</a> - {/if} - </td> - </tr> + <tr class="{cycle values="odd,even"}"> + <td style="text-align:center;"><a href="{$storage.source_url}"><img src="{$storage.thumbnail_url.small}" alt="{$storage.filename}" /></a></td> + <td> + Attachment ID: {$attachmentId} + <br /> + Filename: {$storage.filename} + <br /> + Actions: + {if $gBitUser->isAdmin() || $bit_p_detach_attachment || $storage.user_id == $gBitUser->mUserId} + <a href="{$attachmentActionBaseURL}&detachAttachment={$storage.attachment_id}">{biticon ipackage=liberty iname="detach" iexplain="detach"}</a> + {/if} + {if $gBitUser->isAdmin() || $storage.user_id == $gBitUser->mUserId} + <a href="{$attachmentActionBaseURL}&deleteAttachment={$storage.attachment_id}">{biticon ipackage=liberty iname="delete" iexplain="delete"}</a> + {/if} + </td> + </tr> {/foreach} </table> </div> {/if} -{/if} {/strip} +{/if} diff --git a/templates/list_content_inc.tpl b/templates/list_content_inc.tpl index 4476e35..6c3e64c 100644 --- a/templates/list_content_inc.tpl +++ b/templates/list_content_inc.tpl @@ -30,6 +30,7 @@ <table class="data"> <caption>{tr}Available Content{/tr} <span class="total">[ {$contentCount} ]</span></caption> <tr> + <th style="width:2%;">{smartlink ititle="ID" isort=content_id page=$page user_id=$user_id content_type_guid=$contentSelect}</th> <th>{smartlink ititle="Title" isort=title page=$page user_id=$user_id idefault=1 content_type_guid=$contentSelect}</th> <th>{smartlink ititle="Content Type" isort=content_type_guid page=$page user_id=$user_id content_type_guid=$contentSelect}</th> <th>{smartlink ititle="Author" isort=$isort_author page=$page content_type_guid=$contentSelect}</th> @@ -37,6 +38,7 @@ </tr> {foreach from=$contentList item=item} <tr class="{cycle values='odd,even'}"> + <td style="text-align:right;">{$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> |
