Hello Everybody.
I want add new upload file image en create issue.
I modify the files
- classes/issue/Issue.inc.php
- classes/issue/IssueDAO.inc.php
- controllers/grid/issues/form/IssueForm.inc.php
- templates/controllers/grid/issues/form/issueForm.tpl
Add set, get functions: add new upload button in crease issue · cristiaan3003/ojs_mod@ff3df65 · GitHub
When I add in templates/controllers/grid/issues/form/issueForm.tpl form for upload a imagen
The button is not displayed. ¿The problem is in how I define the script in tpl file? In script add lines $uploaderContra: $(’#coverContraImageUploader’),
$previewContra: $(’#coverContraImagePreview’)
but the button is not shown.
<script>
$(function() {ldelim}
// Attach the form handler.
$('#issueForm').pkpHandler(
'$.pkp.controllers.form.FileUploadFormHandler',
{ldelim}
$uploader: $('#coverImageUploader'),
$preview: $('#coverImagePreview'),
$uploaderContra: $('#coverContraImageUploader'),
$previewContra: $('#coverContraImagePreview'),
uploaderOptions: {ldelim}
uploadUrl: {url|json_encode op="uploadFile" escape=false},
baseUrl: {$baseUrl|json_encode},
filters: {ldelim}
mime_types : [
{ldelim} title : "Image files", extensions : "jpg,jpeg,png,svg" {rdelim}
]
{rdelim}
{rdelim}
{rdelim}
);
{rdelim});
Regards
Cristian
Hi @cristianviza,
Check your browser’s error console to see if there’s something useful there.
Regards,
Alec Smecher
Public Knowledge Project Team
Hi @asmecher . Not view error en console browser.
The behavior is the same as if in the default code for CoverImagen I commented variables ‘coverImageUploader’ and ‘coverImagePreview’ (in script tag) in file issueForm.tpl:
//$uploader: $(’#coverImageUploader’),
//$preview: $(’#coverImagePreview’),
The result is: button is not added with
{fbvFormSection}
{include file=“controllers/fileUploadContainer.tpl” id=“coverImageUploader”}
{/fbvFormSection}
Instead the legend is shown: “The system file uploader is loading. If it doesn’t…”
When I uncomment these variables everything works ok so I think my problem is in those varibales. For my new button they are called
$uploaderContra: $(’#coverContraImageUploader’),
$previewContra: $(’#coverContraImagePreview’),
That is why the query where are defined ‘coverImageUploader’ and ‘coverImagePreview’ to replicate the same to my new variables ‘coverContraImageUploader’ and ‘coverContraImagePreview’.
Regards
Cristian
I add a more complete explanation. I want to upload a another file imagen. For Example:
<div> <label for="file">Choose file to upload</label> <input type="file" id="file" name="file" multiple> </div> <div> <button>Submit</button> </div>
but I want to do it using the framework. When I add fbvFormSection:
{fbvFormSection}
{include file=“controllers/fileUploadContainer.tpl” id=“coverContraImageUploader”}
<input type=“hidden” name=“temporaryFileId” id=“temporaryFileId” value="" /
{/fbvFormSection}
the legend “The system file uploader is loading. If it doesn’t…” is shown.
Regards