1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

RM 1.1 Open external download link in new tab ?

Discussion in 'Resource Manager Support' started by Lucian Chirvase, Jul 27, 2014.

  1. Greetings,
    I have some resources that are uploaded elsewhere, so the Download via external site button is present. Problem is that when clicking the button it follows in the same tab/window. So after the download is finished, unless user clicks the back button, he is gone.
    How could I modify the behavior so that clicking the Download button opens the link in a new tab ?

    Thank you in advance and sorry for the noobish question (I realize that might not even be linked to RM behavior but maybe general web language..)

    Lucian.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    You could edit the template and add target="_blank" to the a href.
     
  3. Hate to waste your time, but could you be more specific ? As where do I look for it ? :notworthy:
    In Appearance>Styles>My_Style>Templates I have only found one attachment_upload_button and the code is:
    Code:
    <xen:if is="{$attachmentParams}">
    
        <xen:require js="js/xenforo/attachment_editor.js" />
        <xen:if is="{$xenOptions.swfUpload} AND {$visitor.enable_flash_uploader}">
            <xen:require js="js/swfupload/swfupload.min.js" />
        </xen:if>   
        <xen:require css="attachment_editor.css" />
    
        <span id="AttachmentUploader" class="buttonProxy AttachmentUploader"
            style="display: none"
            data-placeholder="#SWFUploadPlaceHolder"
            data-trigger="#ctrl_uploader"
            data-postname="upload"
            data-maxfilesize="{$attachmentConstraints.size}"
            data-maxuploads="{$attachmentConstraints.count}"
            data-extensions="{xen:helper implode, $attachmentConstraints.extensions, ','}"
            data-action="{xen:link 'full:attachments/do-upload.json', '',
                'hash={$attachmentParams.hash}',
                'content_type={$attachmentParams.content_type}',
                'key={$attachmentButtonKey}'}"
            data-uniquekey="{$attachmentButtonKey}"
            data-err-110="{xen:phrase uploaded_file_is_too_large}"
            data-err-120="{xen:phrase uploaded_file_is_empty}"
            data-err-130="{xen:phrase uploaded_file_does_not_have_an_allowed_extension}"
            data-err-unknown="{xen:phrase upload_failed}">
           
            <span id="SWFUploadPlaceHolder"></span>       
               
            <input type="button" value="{xen:if {$buttonText}, {xen:raw $buttonText}, {xen:phrase upload_file}}"
                id="ctrl_uploader" class="button OverlayTrigger DisableOnSubmit"
                data-href="{xen:link full:attachments/upload, '', '_params={$attachmentParams}', 'key={$attachmentButtonKey}'}"
                data-hider="#AttachmentUploader" />
            <span class="HiddenInput" data-name="_xfSessionId" data-value="{$sessionId}"></span>
            <xen:foreach loop="$attachmentParams.content_data" key="$dataKey" value="$dataValue"><span class="HiddenInput" data-name="content_data[{$dataKey}]" data-value="{$dataValue}"></span>
            </xen:foreach>
        </span>
    
        <noscript>
            <a href="{xen:link 'attachments/upload', '', '_params={$attachmentParams}'}" class="button" target="_blank">{xen:if {$buttonText}, {xen:raw $buttonText}, {xen:phrase upload_file}}</a>
        </noscript>
    
    </xen:if>
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    It's not the upload button you want to change, it's the download button.

    Try the resource_view_header template.
     
    Lucian Chirvase likes this.
  5. BassMan

    BassMan Well-Known Member

    I use it like you want.

    Open resource_view_header template.

    Find:
    Code:
    <a href="{xen:link resources/download, $resource, 'version={$resource.current_version_id}'}" class="inner">
    Replace:
    Code:
    <a href="{xen:link resources/download, $resource, 'version={$resource.current_version_id}'}" class="inner" target="blank">
     
    rafass and Lucian Chirvase like this.
  6. Private Noob Coder reporting back: Mission successful !

    Thank you (y)
     
    BassMan likes this.
  7. anvar

    anvar Member

    thank you i use this edited template too. (y)
     

Share This Page