[pLog-svn] r2901 - in plog/trunk: js/editor
js/prototypetemplates/admin
Mark Wu
markplace at gmail.com
Sat Feb 4 18:11:14 GMT 2006
Hi Oscar:
Would you kindly test this patch in your Mac? I hope this fix all plogeditor
problem.
Mark
> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of
> mark at devel.lifetype.net
> Sent: Sunday, February 05, 2006 1:50 AM
> To: plog-svn at devel.lifetype.net
> Subject: [pLog-svn] r2901 - in plog/trunk: js/editor
> js/prototypetemplates/admin
>
> Author: mark
> Date: 2006-02-04 17:49:57 +0000 (Sat, 04 Feb 2006) New Revision: 2901
>
> Modified:
> plog/trunk/js/editor/plogeditor.js
> plog/trunk/js/prototype/prototype.js
> plog/trunk/templates/admin/editpost.template
> plog/trunk/templates/admin/newpost.template
> Log:
> Finally, I fix the bug of pLog Editor. It is not the bug of
> template, it is the bug of javascript.
>
> 1. There are some compatibability issue between Prototype and
> pLogeditor, I just add a compatibability check to avoid the problem
>
> 2. I also implement add resource in plogeditor. So, we don't
> need that ugly add resource link any more :D
>
> 3. I only test in IE, FireFox and Opera, not in Safari... So
> .. Oscar I need your help to test it under Safari to see it
> works or not.
>
> Mark
>
> Modified: plog/trunk/js/editor/plogeditor.js
> ===================================================================
> --- plog/trunk/js/editor/plogeditor.js 2006-02-04
> 17:36:29 UTC (rev 2900)
> +++ plog/trunk/js/editor/plogeditor.js 2006-02-04
> 17:49:57 UTC (rev 2901)
> @@ -383,6 +383,39 @@
> }
>
> /**
> + * special button that only adds an resource
> + *
> + * @param id
> + * @param display
> + * @param icon
> + */
> +edButtonResource = function(id, display, icon) {
> + //
> + // strange javascript thingies used for object inheritance...
> + //
> + this.prototype = new edButton(id, display, '', '', icon, -1 );
> + this.prototype.constructor = edButton;
> + this.superclass = edButton;
> +
> + this.superclass(id, display, '', '', icon, -1 );
> +
> + /**
> + * reimplemented from edButton so that we can ask for
> an image url and a description
> + *
> + * @param txtId
> + */
> + this.execute = function( txtId, param )
> + {
> + if ( txtId == 'postText' )
> + resource_list_window(1);
> + else
> + resource_list_window(2);
> + return '';
> + }
> +}
> +
> +/**
> * implements drop-down lists
> */
> edButtonList = function( id, options )
> @@ -408,6 +441,8 @@
> {
> selectBox = '<select class="editorDropDownList"
> name=\''+this.id+'\' onChange="'+objName+'.execute(\'' +
> txtId + '\', \'' + this.id + '\', this);">';
> for( var key in this.options ) {
> + if ( prototypeCompatibabilityCheck( key ) )
> + continue;
> selectBox += '<option
> value=\''+key+'\'>'+this.options[key]+'</option>';
> }
> selectBox += '</select>';
> @@ -503,7 +538,7 @@
> // --
> // our very own toolbar
> // --
> - this.toolBar = Array();
> + this.toolBar = new Array();
> options = new Array();
> options['8'] = '8 pt';
> options['10'] = '10 pt';
> @@ -527,6 +562,7 @@
> this.toolBar['but_unordered_list'] = new edButton(
> 'but_unordered_list', 'unordered list', '<ul><li></li></ul>',
> '', 'ed_list_bullet.gif', -1 );
> this.toolBar['5_but_a'] = new edButtonLink( '5_but_a',
> 'anchor', 'ed_link.gif' );
> this.toolBar['6_but_img']= new edButtonImage( '6_but_img',
> 'image', 'ed_image.gif' );
> + this.toolBar['7_but_res']= new edButtonResource ('7_but_res',
> + 'resource', 'ed_resource.gif' );
>
> /**
> * returns whether our browser supports the features that
> we are going @@ -554,11 +590,12 @@
>
> markup = '';
>
> - this.toolBar.sort();
> document.write('<div class="textEditorToolbar"
> id="textEditorToolbar">');
> for( var buttonId in this.toolBar ) {
> - button = this.toolBar[buttonId];
> - markup += button.show(this.txtId, this.objName);
> + if ( prototypeCompatibabilityCheck( buttonId ) )
> + continue;
> + button = this.toolBar[buttonId];
> + markup += button.show(this.txtId, this.objName);
> }
> document.write(markup);
> document.write('</div>');
> @@ -729,3 +766,48 @@
> return selection;
> }
> }
> +
> +// Add this function to Prototype Lib Compatibability Check function
> +prototypeCompatibabilityCheck( str ) {
> + if ( str == '_each' ||
> + str == '_reverse' ||
> + str == 'all' ||
> + str == 'any' ||
> + str == 'clear' ||
> + str == 'collect' ||
> + str == 'compact' ||
> + str == 'detect' ||
> + str == 'each' ||
> + str == 'entries' ||
> + str == 'extend' ||
> + str == 'find' ||
> + str == 'findAll' ||
> + str == 'first' ||
> + str == 'flatten' ||
> + str == 'grep' ||
> + str == 'include' ||
> + str == 'indices' ||
> + str == 'indexOf' ||
> + str == 'inject' ||
> + str == 'inspect' ||
> + str == 'invoke' ||
> + str == 'last' ||
> + str == 'map' ||
> + str == 'max' ||
> + str == 'member' ||
> + str == 'min' ||
> + str == 'partition' ||
> + str == 'pluck' ||
> + str == 'reject' ||
> + str == 'remove' ||
> + str == 'removeItem' ||
> + str == 'select' ||
> + str == 'sortBy' ||
> + str == 'toArray' ||
> + str == 'without' ||
> + str == 'zip')
> + return true;
> + else
> + return false;
> +}
>
> Modified: plog/trunk/js/prototype/prototype.js
> ===================================================================
> --- plog/trunk/js/prototype/prototype.js 2006-02-04
> 17:36:29 UTC (rev 2900)
> +++ plog/trunk/js/prototype/prototype.js 2006-02-04
> 17:49:57 UTC (rev 2901)
> @@ -1,11 +1,7 @@
> /* Prototype JavaScript framework, version 1.4.0
> * (c) 2005 Sam Stephenson <sam at conio.net>
> *
> - * THIS FILE IS AUTOMATICALLY GENERATED. When sending
> patches, please diff
> - * against the source tree, available from the Prototype
> darcs repository.
> - *
> * Prototype is freely distributable under the terms of an
> MIT-style license.
> - *
> * For details, see the Prototype web site:
> http://prototype.conio.net/
> *
>
> /*------------------------------------------------------------
> --------------*/
>
> Modified: plog/trunk/templates/admin/editpost.template
> ===================================================================
> --- plog/trunk/templates/admin/editpost.template
> 2006-02-04 17:36:29 UTC (rev 2900)
> +++ plog/trunk/templates/admin/editpost.template
> 2006-02-04 17:49:57 UTC (rev 2901)
> @@ -52,21 +52,15 @@
> <span class="required">*</span>
> <div class="formHelp">{$locale->tr("text_help")}</div>
> {if !$htmlarea}<script type="text/javascript">var
> ed1 = new pLogEditor('postText','ed1');</script>{/if}
> - <textarea {if
> $htmlarea==1}rows="20"{else}rows="10"{/if} id="postText"
> name="postText" style="width:100%">{$postText}</textarea>
> + <textarea {if $htmlarea==1}rows="20"{else}rows="15"{/if}
> +id="postText" name="postText"
> style="width:100%">{$postText}</textarea>
> {include
> file="$admintemplatepath/validate.template" field=postText
> message=$locale->tr("error_missing_post_text")}
> - {if !$htmlarea}
> - <a
> href="javascript:resource_list_window(1);">{$locale->tr("add_r
> esource")}</a>
> - {/if}
> </div>
>
> <div class="field">
> <label
> for="postExtendedText">{$locale->tr("extended_text")}</label>
> <div
> class="formHelp">{$locale->tr("extended_text_help")}</div>
> {if !$htmlarea}<script type="text/javascript">var
> ed2 = new pLogEditor('postExtendedText','ed2');</script>{/if}
> - <textarea {if
> $htmlarea}rows="25"{else}rows="15"{/if} id="postExtendedText"
> name="postExtendedText"
> style="width:100%">{$postExtendedText}</textarea>
> - {if !$htmlarea}
> - <a
> href="javascript:resource_list_window(2);">{$locale->tr("add_r
> esource")}</a>
> - {/if}
> + <textarea {if $htmlarea}rows="25"{else}rows="20"{/if}
> +id="postExtendedText" name="postExtendedText"
> +style="width:100%">{$postExtendedText}</textarea>
> </div>
>
> <div class="field">
>
> Modified: plog/trunk/templates/admin/newpost.template
> ===================================================================
> --- plog/trunk/templates/admin/newpost.template
> 2006-02-04 17:36:29 UTC (rev 2900)
> +++ plog/trunk/templates/admin/newpost.template
> 2006-02-04 17:49:57 UTC (rev 2901)
> @@ -63,21 +63,15 @@
> <span class="required">*</span>
> <div class="formHelp">{$locale->tr("text_help")}</div>
> {if !$htmlarea}<script type="text/javascript">var
> ed1 = new pLogEditor('postText','ed1');</script>{/if}
> - <textarea {if
> $htmlarea==1}rows="20"{else}rows="10"{/if} id="postText"
> name="postText" style="width:100%">{$postText}</textarea>
> + <textarea {if $htmlarea==1}rows="20"{else}rows="15"{/if}
> +id="postText" name="postText"
> style="width:100%">{$postText}</textarea>
> {include
> file="$admintemplatepath/validate.template" field=postText
> message=$locale->tr("error_missing_post_text")}
> - {if !$htmlarea}
> - <a
> href="javascript:resource_list_window(1);">{$locale->tr("add_r
> esource")}</a>
> - {/if}
> </div>
>
> <div class="field">
> <label
> for="postExtendedText">{$locale->tr("extended_text")}</label>
> <div
> class="formHelp">{$locale->tr("extended_text_help")}</div>
> {if !$htmlarea}<script type="text/javascript">var
> ed2 = new pLogEditor('postExtendedText','ed2');</script>{/if}
> - <textarea {if
> $htmlarea}rows="25"{else}rows="15"{/if} id="postExtendedText"
> name="postExtendedText"
> style="width:100%">{$postExtendedText}</textarea>
> - {if !$htmlarea}
> - <a
> href="javascript:resource_list_window(2);">{$locale->tr("add_r
> esource")}</a>
> - {/if}
> + <textarea {if $htmlarea}rows="25"{else}rows="20"{/if}
> +id="postExtendedText" name="postExtendedText"
> +style="width:100%">{$postExtendedText}</textarea>
> </div>
>
> <div class="field">
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
More information about the pLog-svn
mailing list