You are here: Foswiki>Tasks Web>Item12944 (18 Nov 2016, MichaelDaum)Edit Attach

Item12944: Cannot delete, change Attachments when using NatSkin. PatternSkin works.

pencil
Priority: Urgent
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: TopicInteractionPlugin
Branches:
Reported By: WolfgangAlper
Waiting For:
Last Change By: MichaelDaum

Summary

When using NatSkin, i cannot delete or modify attachments. When swtching to PatternSkin it works.

Also, i see the Tab Attachments and it shows the number of attachments, but when i click on it, i do not see any attachment though.

When i click on Edit "Attach files and Images", i can sse the attachments, but cannot edit/modify them.

This is a fresh install on ubuntu lts using foswiki 1.1.9 from source. Plugins are installed online via configure from the foswiki repository.

Note: I put it on urgent since managing attachments quite an important when using a wiki.

Details

I can see the tooltip of the icon like: "Delete this attachment", but on click nothing happens.

  • It seems that the REST-Handler gets call from jQuery when clicking.
  • On click, there is an request and response in FireBug.
  • On click there is an request in the foswiki events.log and the apache log.
  • Error.log does not show any error when clicking.
  • Tested with Firefox, Internet Explorer and Google Chrome (all on Windows 7)

| 2014-06-20T11:25:34Z info | admin | rest | Sandbox.AttachmentTest | Safari | xxx.xxx.xxx.xxx |
| 2014-06-20T11:25:34Z info | admin | viewfile | Sandbox.AttachmentTest | igp_8a52a6ceacf12f278c3b0a5e4adcc5fc_logo-test-big.png Safari | xxx.xxx.xxx.xxx |

[20/Jun/2014:13:42:13 +0200] "GET /isc/pub/Sandbox/AttachmentTest/igp_8a52a6ceacf12f278c3b0a5e4adcc5fc_logo-test-big.png HTTP/1.1" 200 2265 "xxxxxx/isc/bin/attach/Sandbox/AttachmentTest" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
[20/Jun/2014:13:42:13 +0200] "GET /isc/bin/rest/RenderPlugin/template?name=metadata&expand=attachments%3A%3Aconfirmdelete&topic=Sandbox.AttachmentTest HTTP/1.1" 200 536 "xxxxxx/isc/bin/attach/Sandbox/AttachmentTest" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome

Installed Plugins

Attached a list of installed Plugins. I tried to disable most of them without breaking NatSkin, but without success.
SpreadSheetPlugin (1.1.7, v1.1.7): Add spreadsheet calculations like "$SUM($ABOVE())" to Foswiki tables and other topic text
AutoTemplatePlugin (2.01, 2.01): Automatically sets VIEW_TEMPLATE and EDIT_TEMPLATE
AutoViewTemplatePlugin (2012-12-16, v1.1.7): Automatically sets VIEW_TEMPLATE and EDIT_TEMPLATE
BreadCrumbsPlugin (2.51, 2.51): A flexible way to display breadcrumbs navigation
CommentPlugin (1.1.6, v1.1.6): Quickly post comments to a page without an edit/save cycle
CompareRevisionsAddonPlugin (1.1.11, v1.1.11):
ControlWikiWordPlugin (1.4, $Rev: 12204 (2011-07-23) $): Plugin to stop linking of WikiWords or force linking of non-standard WikiWords
DBCachePlugin (5.47, 5.47): Lightweighted frontend to the DBCacheContrib
EditChapterPlugin (4.64, 4.64): An easy sectional edit facility
EditRowPlugin (12 Nov 2013, v3.0.6): Inline edit for tables
FilterPlugin (4.01, 4.01): Substitute and extract information from content by using regular expressions
FlexFormPlugin (2.82, 2.82): Flexible way to render DataForms
FlexPaperPlugin (2.01, 2.01): flash-based document viewer component
FlexWebListPlugin (1.91, 1.91): Flexible way to display hierarchical weblists
GenPDFWebkitPlugin (1.50, 1.50): Generate PDF using Webkit
HistoryPlugin (1.11, 1.11): Shows a complete history of a topic
HomePagePlugin (1.2.0, $Rev: 15292 (2012-08-12) $): Allow User specified home pages - on login
ImageGalleryPlugin (6.11, 6.11): Displays image gallery with auto-generated thumbnails from attachments
ImagePlugin (3.33, 3.33): Image and thumbnail services to display and alignment images using an easy syntax
InterwikiPlugin (1.1.7, v1.1.7): Link ExternalSite:Page text to external sites based on aliases defined in a rules topic
JQDataTablesPlugin (2.01, 2.01): JQuery based progressive enhancement of tables
JQGridPlugin (2.21, 2.21): jQuery grid widget for Foswiki
JQueryPlugin (4.91, 4.91): jQuery JavaScript library for Foswiki
MailerContribPlugin (2.5.3, v2.5.3): Supports e-mail notification of changes
MetaCommentPlugin (2.60, 2.60): An easy to use comment system
MetaDataPlugin (4.01, 4.01): Bring custom meta data to wiki apps
MimeIconPlugin (1.20, 1.20): Icon sets for mimetypes
NatEditPlugin (07 Aug 2013, 7.10): A Wikiwyg Editor
NatSkinPlugin (3.99_007, 3.99_007): Support plugin for NatSkin
PageOptimizerPlugin (0.10, 0.10): Optimize html markup, as well as js and css
PdfPlugin (1.1.0, $Rev: 14875 (2012-05-21) $): Generate high quality PDF files from topics
PreferencesPlugin (1.1.5, v1.1.5): Allows editing of preferences using fields predefined in a form
RenderListPlugin (2.2.7, v2.2.7): Render bullet lists in a variety of formats
RenderPlugin (3.21, 3.21): Render WikiApplications asynchronously
SendEmailPlugin (1.5.4, 1.5.4): Send e-mails through an e-mail form
SlideShowPlugin (2.1.6, v2.1.6): Create web based presentations based on topics with headings
SmiliesPlugin (28 Nov 2012, v1.1.6): Render smilies like smile as icons
TablePlugin (1.142, 1.142): Control attributes of tables and sorting of table columns
TinyMCEPlugin (1.2.9, v1.2.9): Integration of the Tiny MCE WYSIWYG Editor
TopicInteractionPlugin (3.52, 3.52): Improved interaction with attachments and DataForms
TwistyPlugin (1.6.18, v1.6.18): Twisty section Javascript library to open/close content dynamically
WebLinkPlugin (1.30, 1.30): A parametrized %WEB macro
WikiAppInstallerPlugin (1.0.0, $Rev: 13199 (2011-11-23) $): Explore, install, and package wiki applications
WorkflowPlugin (1.12.8, $Rev: 14978 (2012-06-13) $): Associate a "state" with a topic and then control the work flow that the topic progresses through as content is added.
WysiwygPlugin (16 May 2013, v1.1.16): Translator framework for WYSIWYG editors

-- WolfgangAlper - 20 Jun 2014

What exactly did you do to modify/delete an attachment?

Which browser are you using?

Check that rest is removed from $Foswiki::cfg{AuthScripts}.

Watch out for javascript errors.

Try NatSkin and NatSkinPlugin from Extensions.Testing.NatSkin.

-- MichaelDaum - 23 Jun 2014

What i did

  • Created a Topic Sandbox/Jomo.AttachmentTest in Sandbox
  • Attached a file (a small graphic file)
  • Reloaded the page
    • On page load, i see the Ajax-Load-Icon for a very short time in the attachemnt area. (Seems the xhr request goes out but does not return anything useful).
    • The Attachment Tab shows "Anhänge (1)" , but does not show any attachments. When i click the tab, nothing happens.
    • When i click on "Attach Files and Images" in the footer of the topic, i see my attachment and also the user interface to add a new one.
    • When i hover over the existing attachment, three icons show up (edit, move, delete). Also their tooltips
    • When i click on delete, nothing happens (in the UI).

Browser tested

As said above, tested with Google Chrome, Firefox and Internet Explorer.

  • Google Chrome: Version 35.0.1916.153 m
  • Internet Explorer: Version 11.0.9600.17041
  • Firefox: Version 30.0

Javascript loaded

  • JQuery: jquery-1.8.3.js

Errormessages in Javascript Console

* Firefox: getPreventDefault() sollte nicht mehr verwendet werden. Verwenden Sie stattdessen defaultPrevented. - More a warning than an error * Chrome: No Error * Internet Explorer: When loading the Topic including the attachment and also when going to "Edit Files and Attachments" and Clicking on the "Delete Icon"
Query.easing["jswing"]=jQuery.easing["swing"];jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},

Das Objekt unterstützt die Eigenschaft oder Methode nicht.

easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOutQuad:function

Foswiki config:

{AuthScripts}   attach,compareauth,edit,manage,previewauth,rdiffauth,rename,restauth,save,statistics,upload,viewauth,viewfileauth, changes, compare, jsonrpc, oops, preview, rdiff, resetpasswd, search, sendemail, view, viewfile, xsendfile

Note:The Following scripts are open to unauthenticated users:
register, rest

Note: I tried it also with NO Authscripts - same result.

Natskin from testing

Works - could create and delete an attachment.

-- WolfgangAlper - 23 Jun 2014

When it works using NatSkin, then there's no action remaining to be done here, right?

-- MichaelDaum - 23 Jun 2014

This is certainly a valid position. However that does not fix the problem though, especially since this is a fresh installation on a fresh server.

Anyway - i did onother installation on the same server (so sharing i.e. the same perl modules) and just installed natskin as the only extension. Well 2 things to observe:

  • one need to click not 1 but 2 times the delete icon. (not a doubleclick but two times). Then a popup show up delete yes/no.
  • on the right side the following error message which i assume is utf8 related (the way perl treats tainted vars in utf8). See errormsg below.

So it seems that natskin has a problem with one or more extensions, or the extension with natskin since patternskin work.

Errormessage upon click:

Insecure dependency in rename while running with -T switch at /usr/share/perl/5.14/File/Copy.pm line 375.
at /usr/share/perl/5.14/File/Copy.pm line 375
File::Copy::_move('/var/www/foswiki/pub/Sandbox/AttachmentTest/Tulips.jpg', '/var/www/foswiki/pub/Trash/TrashAttachment/Tulips.jpg', 'CODE(0x2703478)') called at /usr/share/perl/5.14/File/Copy.pm line 406
File::Copy::move('/var/www/foswiki/pub/Sandbox/AttachmentTest/Tulips.jpg', '/var/www/foswiki/pub/Trash/TrashAttachment/Tulips.jpg') called at /var/www/foswiki/lib/Foswiki/Store/VC/Handler.pm line 973
Foswiki::Store::VC::Handler::moveFile('Foswiki::Store::VC::RcsWrapHandler=HASH(0x1fb1298)', '/var/www/foswiki/pub/Sandbox/AttachmentTest/Tulips.jpg', '/var/www/foswiki/pub/Trash/TrashAttachment/Tulips.jpg') called at /var/www/foswiki/lib/Foswiki/Store/VC/Handler.pm line 764
Foswiki::Store::VC::Handler::moveAttachment('Foswiki::Store::VC::RcsWrapHandler=HASH(0x1fb1298)', 'Foswiki::Store::RcsWrap=HASH(0x2695028)', 'Trash', 'TrashAttachment', 'Tulips.jpg') called at /var/www/foswiki/lib/Foswiki/Store/VC/Store.pm line 163
Foswiki::Store::VC::Store::moveAttachment('Foswiki::Store::RcsWrap=HASH(0x2695028)', 'Foswiki::Meta=HASH(0x3114260)', 'Tulips.jpg', 'Foswiki::Meta=HASH(0x3114290)', 'Tulips.jpg', 'WolfgangAlper') called at /var/www/foswiki/lib/Foswiki/Meta.pm line 2937
Foswiki::Meta::__ANON__() called at /usr/share/perl5/Error.pm line 416
eval {...} called at /usr/share/perl5/Error.pm line 408
Error::subs::try('CODE(0x1fb1778)', 'HASH(0x1fb1b98)') called at /var/www/foswiki/lib/Foswiki/Meta.pm line 2974
...

-- WolfgangAlper - 26 Jun 2014

This is not related to utf-8. Have you got $Foswiki::cfg{UseLocale} enabled? If so please disable it, as you get these kind of weird tainted errors all over the place, not only in NatSkin and TopicInteractionPlugin.

-- MichaelDaum - 27 Jun 2014

Thank you very much. Disabling the locales fixes the problem. I think this can be closed. However - when i have figured out which Plugin causes the issue, i will add it here and and open a ticket for that particular plugin.

-- WolfgangAlper - 02 Jul 2014

Reopen bc i was unable to fix the base issue - that is to delete an attachment. After trying to get an idea of whats going wrong, here a summary.
  • I have setup two instances on the same server. One works the other fails.
  • The one that fails has some more plugins, but non of those are enabled. I.e the enabled plugnisn are the same on both installations.
  • The working one returns the following (http)response when clicking on delete:
<div id="foswikiAttachmentConfirmDelete" class="jqUIDialog foswikiFormSteps {modal:true, draggable:true, width:350}" title="%MAKETEXT{"Delete attachment?"}%" style="display:none">
  <form id="foswikiAttachmentConfirmDeleteForm" action="%SCRIPTURLPATH{"rest"}%/TopicInteractionPlugin/delete" method="post" onsubmit="StrikeOne.submit(this)"><input type='hidden' name='validation_key' value='?a3437b38f2ad6178871565b9d9a8753f' />
    <input type="hidden" name="id" value="delete" />
    <input type="hidden" name="filename" value="" />
    <input type="hidden" name="topic" value="%WEB%.%TOPIC%" />
    <div class="foswikiThumbnailContainer foswikiRight"></div>
    <div class="foswikiFormStep noBreakout">
      %MAKETEXT{"Are you sure that you want to delete [_1]?" args="<br /><b id='deleteAttachment'></b>"}%
      %CLEAR%
    </div>
    <a class="jqUIDialogButton jqUIDialogSubmit {icon:'ui-icon-trash'}">%MAKETEXT{"Yes, delete"}%</a> 
    <a class="jqUIDialogButton jqUIDialogClose {icon:'ui-icon-cancel'}">%MAKETEXT{"No, thanks"}%</a> 
  </form>
</div>
This is fine, bc it is the javascript code required to popup the confirmation dialog.

  • The bad installation just returns nothing - so an empty (http)response.

The response template is defined in foswiki/metadata.tmpl. Both installation have the same one. (Content is identical).

Where is it called from?

bin/rest calls lib/Foswiki/Plugins/RenderPlugin->restTemplate(). Inside restTemplate is a call to populate the template content in $tmpl.
my $tmpl = $session->templates-templP($attrs);

The problem lies here, the bad installation gets only an empty string, the working one gets the template content as outlined above.

Both installations pass the same information as $attrs
$VAR1 = bless( {
                 '_RAW' => 'attachments::confirmdelete'
               }, 'Foswiki::Attrs' );

This call is handled by lib/Foswiki/Templates->tmplP(). Inside Templates->tmplP() $template is set to attachments::confirmdelete. But the following block never executes and so an empty $var is returned.

(Sidenote: I have to admit, i see the recursion, but i do not grasp how/where $this->{VARS}->{$template} is set.)

my $val = '';
if ( exisis( $this->{VARS}->{$template} ) ) {
   ...
}

...
return $val;

I really apprecitate any hint. Since this is a more or less vanilla installation, i need to figure out what the root cause is. I could setup just another new installation, but what to do if this happens again?

Thank you in advance for any helpful statement.

-- WolfgangAlper - 06 Jul 2014

Maybe i have choosen in inappropirate State. Changed it to new, since this is the orginal unresolved issue with a lot more details provided.

-- WolfgangAlper - 09 Jul 2014

I seriously can't repro this error frown, sad smile

-- MichaelDaum - 12 Jan 2015
 

ItemTemplate edit

Summary Cannot delete, change Attachments when using NatSkin. PatternSkin works.
ReportedBy WolfgangAlper
Codebase 1.1.9
SVN Range
AppliesTo Extension
Component TopicInteractionPlugin
Priority Urgent
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release02x01Checkins
Release02x00Checkins
Release01x01Checkins
Topic revision: r15 - 18 Nov 2016, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy