Changeset 14664


Ignore:
Timestamp:
04/26/12 15:44:44 (13 months ago)
Author:
MichaelDaum
Message:

Item11435:Item9916:

  • fixed proper calculation of attachment size limit
  • fixed properly encoding url parameters
  • fixed adding the js to the head using the right ids
  • hiding image gallery settings when ImageGalleryPlugin isn't there
Location:
trunk/TopicInteractionPlugin
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/TopicInteractionPlugin/lib/Foswiki/Plugins/TopicInteractionPlugin/Core.pm

    r13578 r14664  
    2020use Foswiki::Sandbox (); 
    2121use JSON (); 
     22use Encode (); 
    2223 
    2324use constant DEBUG => 0; # toggle me 
     
    198199 
    199200  ($web, $topic) = Foswiki::Func::normalizeWebTopicName($web, $topic); 
     201  #print STDERR "topic='$topic'\n"; 
    200202  unless (Foswiki::Func::topicExists($web, $topic)) { 
    201203    printJSONRPC($response, 101, "Topic $web.$topic does not exist", $id); 
     
    240242  } 
    241243 
    242   my $queryString = $ENV{QUERY_STRING}; 
     244  my $queryString = $ENV{QUERY_STRING} || ''; 
    243245 
    244246  foreach my $item (split(/[&;]/, $queryString)) { 
     
    258260 
    259261  $value =~ s/%([\da-f]{2})/chr(hex($1))/gei; 
    260  
    261262  my $session = $Foswiki::Plugins::SESSION; 
    262263  my $downgradedValue = $session->UTF82SiteCharSet($value); 
    263264  $value = $downgradedValue if defined $downgradedValue; 
    264  
     265  
    265266  $value =~ s/^\s+//g; 
    266267  $value =~ s/\s+$//g; 
  • trunk/TopicInteractionPlugin/pub/System/TopicInteractionPlugin/jquery.uploader.uncompressed.js

    r13578 r14664  
    519519 
    520520  /************************************************************************/ 
    521   $(document).ready(function() { 
     521  $(function() { 
    522522 
    523523    var attachFileSizeLimit = foswiki.getPreference("TopicInteractionPlugin.attachFileSizeLimit") || 0; 
     524    attachFileSizeLimit *= 1024; 
    524525 
    525526    defaults = { 
  • trunk/TopicInteractionPlugin/pub/System/TopicInteractionPlugin/metadata.pattern.uncompressed.css

    r13063 r14664  
    11/* pattern skin adjustments */ 
     2.foswikiAttachments table, 
    23.foswikiLayoutTable,  
    34.foswikiNullTable { 
     
    2829} 
    2930 
     31.foswikiAttachments, .foswikiFormStep, 
    3032.foswikiMetaData .foswikiFormStep { 
    3133  padding:0px; 
    3234  border:0px; 
    3335} 
     36 
     37.foswikiAttachments .foswikiFormSteps { 
     38  padding:20px; 
     39} 
     40 
    3441#patternScreen .foswikiFormSteps h2 { 
    3542  padding-left:0px; 
     
    3744} 
    3845 
    39 .foswikiAttachments table { 
    40   width:auto; 
    41 } 
    4246 
    4347th { 
    4448  line-height:inherit;  
    4549} 
     50 
     51.foswikiMetaDataHelp { 
     52  display:none; 
     53} 
     54.patternTopicActions { 
     55  padding:12px 20px; 
     56  border-width:1px; 
     57} 
  • trunk/TopicInteractionPlugin/pub/System/TopicInteractionPlugin/metadata.uncompressed.js

    r13578 r14664  
    448448      loadDialog("#foswikiAttachmentPreviewer", "attachments::previewer"); 
    449449      $previewer = $("#foswikiAttachmentPreviewer"), 
    450       $previewer.find(".foswikiAttachmentName").text(decodeURI(attachmentOpts.filename)); 
     450      $previewer.find(".foswikiAttachmentName").text(decodeURIComponent(attachmentOpts.filename)); 
    451451      $previewer.find(".foswikiPreviewContainer").load(previewUrl, function() { 
    452452        setTimeout(function() { 
     
    484484 
    485485          $.log("METADATA: show attachment editor"); 
    486           $container.find("input[name=origfilename]").val(decodeURI(attachmentOpts.filename)); 
    487           $container.find("input[name=filename]").val(decodeURI(attachmentOpts.filename)); 
    488           $container.find("input[name=filecomment]").val(decodeURI(attachmentOpts.filecomment)); 
     486          $container.find("input[name=origfilename]").val(decodeURIComponent(attachmentOpts.filename)); 
     487          $container.find("input[name=filename]").val(decodeURIComponent(attachmentOpts.filename)); 
     488          $container.find("input[name=filecomment]").val(decodeURIComponent(attachmentOpts.filecomment)); 
    489489          $container.find(".foswikiThumbnailContainer").empty(); 
    490490 
     
    567567        }, 
    568568        onShow: function(dialog) {  
    569           dialog.container.find("#deleteAttachment").text(decodeURI(attachmentOpts.filename)); 
     569          dialog.container.find("#deleteAttachment").text(decodeURIComponent(attachmentOpts.filename)); 
    570570          dialog.container.find(".foswikiThumbnailContainer").append(thumbnail); 
    571571        }, 
    572572        onSubmit: function(dialog) { 
    573573          $.blockUI({ 
    574             message:"<h1>Deleting "+decodeURI(attachmentOpts.filename)+" ...</h1>", 
     574            message:"<h1>Deleting "+decodeURIComponent(attachmentOpts.filename)+" ...</h1>", 
    575575            fadeIn: 0, 
    576576            fadeOut: 0 
     
    616616          $container.find(".foswikiMoveOne").show(); 
    617617          $container.find(".foswikiMoveMultiple").hide(); 
    618           $container.find("input[name=filename]").val(decodeURI(attachmentOpts.filename)); 
     618          $container.find("input[name=filename]").val(decodeURIComponent(attachmentOpts.filename)); 
    619619          $container.find(".foswikiThumbnailContainer").append(thumbnail); 
    620620        }, 
  • trunk/TopicInteractionPlugin/templates/attach.topicinteraction.tmpl

    r11309 r14664  
    11%TMPL:INCLUDE{"attach"}% 
    22%TMPL:INCLUDE{"metadata"}% 
     3 
     4%TMPL:DEF{"attachments::hidden"}%%URLPARAM{"attachments_hidden" default="on"}%%TMPL:END% 
     5%TMPL:DEF{"attachments::showuploader"}%%URLPARAM{"attachments_showuploader" default="on"}%%TMPL:END% 
    36 
    47%TMPL:DEF{"content"}%<!-- content --> 
     
    1013  icon="cross" 
    1114}% 
    12 <h1> 
    13   <noautolink>%MAKETEXT{"Attachments at [_1]" args="%TMPL:P{"topictitle"}%"}%</noautolink> 
    14   <span class='foswikiAttachmentsCount foswikiSmall foswikiGrayText'>()</span> 
    15 </h1> 
    16 %CLEAR% 
    1715<div>%TMPL:P{"attachments"}%</div> 
    1816%TMPL:P{"metadata::css"}% 
  • trunk/TopicInteractionPlugin/templates/metadata.tmpl

    r13578 r14664  
    6060%IF{"context FlexPaperPluginEnabled" then="$percntFLEXPAPERINIT$percnt"}%<!-- --> 
    6161%ADDTOZONE{"script"  
    62   id="NATSKIN::METADATA::JS"  
     62  id="METADATA::JS"  
    6363  requires="JQUERYPLUGIN::LIVEQUERY, JQUERYPLUGIN::UI, JQUERYPLUGIN::UPLOAD"  
    6464  text="<script src='%PUBURLPATH%/%SYSTEMWEB%/TopicInteractionPlugin/metadata.js'></script>" 
     
    6868%TMPL:DEF{"metadata::css"}%<!-- --> 
    6969%ADDTOZONE{"head"  
    70   tag="NATSKIN::METADATA::CSS"  
     70  id="METADATA::CSS"  
    7171  requires="NATSKIN::CSS"  
    7272  text="<link rel='stylesheet' href='%PUBURLPATH%/%SYSTEMWEB%/TopicInteractionPlugin/metadata.css' media='all' />" 
    7373}%<!-- --> 
     74%TMPL:P{context="ImagePluginEnabled" then="metadata::css::imageplugin"}%<!-- --> 
     75<!-- -->%TMPL:END% 
     76 
     77%{ ################################################################################ }% 
     78%TMPL:DEF{"metadata::css::imageplugin"}%<!-- --> 
    7479%ADDTOZONE{"head" 
    75   tag="IMAGEPLUGIN" 
    76   text="<link rel='stylesheet' href='%PUBURL%/%SYSTEMWEB%/ImagePlugin/style.css' media='all' />" 
     80  id="IMAGEPLUGIN" 
     81  text="<link rel='stylesheet' href='%PUBURLPATH%/%SYSTEMWEB%/ImagePlugin/style.css' media='all' />" 
    7782}%<!-- -->%TMPL:END% 
    7883 
     
    307312        <option class="foswikiOption" value="">%MAKETEXT{"Bulk action"}%</option> 
    308313        <option class="foswikiOption" value="createlink">%MAKETEXT{"Insert links"}%</option> 
    309         <option class="foswikiOption" value="createimagegallery">%MAKETEXT{"Create image gallery"}%</option> 
     314%IF{"context ImageGalleryPluginEnabled"  
     315  then="        <option class='foswikiOption' value='createimagegallery'>%MAKETEXT{"Create image gallery"}%</option>" 
     316  else="<!-- -->" 
     317}% 
    310318        <option class="foswikiOption" value="download">%MAKETEXT{"Download"}%</option> 
    311319        <option class="foswikiOption" value="hide">%MAKETEXT{"Hide"}%</option> 
  • trunk/TopicInteractionPlugin/templates/view.topicinteraction.tmpl

    r12642 r14664  
    1111<a name="topic-actions"></a> 
    1212<div class="patternTopicActions"> 
    13   <div class="patternTopicAction"> 
    14     <span class="patternActionButtons">%TMPL:P{"topicactionbuttons"}%</span> 
    15   </div> 
     13  <span class="patternActionButtons">%TMPL:P{"topicactionbuttons"}%</span> 
    1614</div>%TMPL:END% 
Note: See TracChangeset for help on using the changeset viewer.