OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



add new images in createIssue - modify issue

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

add new images in createIssue - modify issue

Postby cristianviza » Wed Apr 30, 2014 8:28 am

Hello community.
I try upload a new images in createIssue, buy I can't do.
attached a link : http://www.subimelafoto.com.ar/images/449example.png
and code in:
/templates/editor/issues/createIssue.tpl
code fragment
Code: Select all
<!-- TAPA -->
<!-- ------------------------------------------------------------------------ -->
        <tr valign="top">
                <td class="label" colspan="2">
                <input type="checkbox" name="showTapaPage[{$formLocale|escape}]" id="showTapaPage" value="1"
                {if $showTapaPage[$formLocale]} checked="checked"{/if}
                 />
                <label for="showTapaPage">Tapa </label>
                </td>
        </tr>

        <tr valign="top">
                <td width="20%" class="label">Imagen de Tapa</td>
                <td width="80%" class="value">
                        <input type="file" name="TapaPage" id="TapaPage" class="uploadField" />&nbsp;&nbsp;{translate key="form.saveToUpload"}<br/>
                    </td>
        </tr>
<!-- ----------------------------------------------- -->

and upload the file to modify /classes/issue/form/IssueForm.inc.php , within the function validate add:

Code: Select all
import('classes.file.PublicFileManager');
                $publicFileManager = new PublicFileManager();

 if ($publicFileManager->uploadedFileExists('TapaPage'))
{
 $publicFileManager->uploadFile("mi_archivo", $this->getJournalFilesPath($journal->getId()) . '/' . $destFileName);
        }

but I did not upload the image into the folder for the journal, in fact not upload anything in public/journals/numberFolder.(numberFolder is journal folder number)
I have a problem in the code.
Which files and modify functions recommended me to properly upload the image?

Regards Cristian
cristianviza
 
Posts: 75
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina

Re: add new images in createIssue - modify issue

Postby asmecher » Wed Apr 30, 2014 5:12 pm

Hi Christian,

At a glance, you've got inconsistencies in the name of the upload field -- you're using "[b]TapaPage[/b]" (not sure if that's a typo), "TapaPage", and "mi_archivo". These need to be consistent.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8869
Joined: Wed Aug 10, 2005 12:56 pm

Re: add new images in createIssue - modify issue

Postby cristianviza » Wed May 07, 2014 7:19 am

Hello asmecher.
Thanks very much for your help :) .
I can slove the problem upload file,but now I have two new problem
attached links source/ files I changes:
image: http://www.subimelafoto.com.ar/visualizer.php?url=574example1.png
templates\editor\issues\createIssue.tpl: https://docs.google.com/document/d/1KQTVEx5gfe6SyzpzWPyg9WFsMrazKQT_T4-i9j2Ug2Q/edit?usp=sharing
templates\editor\issues\issueData.tpl : https://docs.google.com/document/d/1qor ... sp=sharing


\classes\issue\form\IssueForm.inc.php:https://docs.google.com/document/d/1TI1frm_TY7SXdnPmqkFlcdkqxEfrdzBzA8yYu9AZBcs/edit?usp=sharing
\classes\issue\Issue.inc.php: docs.google.com/document/d/1zHeZDiTdOMmHBg7tjP-FSdG3nZ6ieGroHZWylNZEibA/edit?usp=sharing
\classes\issue\IssueDAO.inc.php: docs.google.com/document/d/1N0IKyijjOrxSZYv9IJ929uJjrTcikbpkSF-ETajtMiU/edit?usp=sharing


first:
the "tick" in the checkbox: <input type="b]checkbox[/b]" name="showTapaPage[{$formLocale|escape}]".

the problem is, when i change \classes\issue\form\IssueForm.inc.php in my source:
coverPageDescription for tapaPageDescription , the the "tick" in the checkboxis always selected after saving:
function execute($issueId = 0) {
$issue->($this->getData('tapaPageDescription'), null); // Localized
$showTapaPage = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('showTapaPage'));
foreach (array_keys($this->getData('coverPageDescription')) as $locale) {
if (!array_key_exists($locale, $showTapaPage)) {
$showTapaPage[$locale] = 0;
}
}
$issue->setShowTapaPage($showTapaPage, null); // Localized



for


function execute($issueId = 0) {
$issue->($this->getData('tapaPageDescription'), null); // Localized
$showTapaPage = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('showTapaPage'));
foreach (array_keys($this->getData('tapaPageDescription')) as $locale) {
if (!array_key_exists($locale, $showTapaPage)) {
$showTapaPage[$locale] = 0;
}
}
$issue->setShowTapaPage($showTapaPage, null); // Localized


second:
uploading the file does not appear to cover me option to delete the file, as shown in "Cover Image" and only allows me to delete one, which may be the problem? java scrip?


Regards Cristian
cristianviza
 
Posts: 75
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina

Re: add new images in createIssue - modify issue

Postby asmecher » Wed May 07, 2014 7:25 am

Hi Cristian,

This is very difficult to read -- I'd suggest using patch files, which describe only the changes -- or better yet, working with github.com and providing a link to a feature branch (which is a branch that contains only the modifications you want to show).

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8869
Joined: Wed Aug 10, 2005 12:56 pm

Re: add new images in createIssue - modify issue

Postby cristianviza » Tue May 13, 2014 9:24 am

Hello asmecher.
I hope to be a little more clear in this post.

I can slove the problems of the previous post, now consultation is because when I click in "eliminar" (delete file) : http://fotos.subefotos.com/a0894e08dc479d9c9092ee4825d65c11o.png
I get the following errorhttp://fotos.subefotos.com/3d5cd40c862304c7ca46b1233910239bo.png

in issueData.tpl (line 206 I add removeIssueTapaPage) and in IssueManagementHandler.inc.php (line 282 I add removeIssueTapaPage).
I also add others required functions, example: getTapaName,setTapaName,etc (in \classes\issue\Issue.inc.php)

which could be the cause of the error, I'm bogged down in that error.

Here below attached link the my source in github:
repository: https://github.com/cristiaan3003/ojsOsiri

templates\editor\issues\issueData.tpl:github.com/cristiaan3003/ojsOsiri/blob/master/issueData.tpl

classes\issue\form\IssueForm.inc.php:github.com/cristiaan3003/ojsOsiri/blob/master/IssueForm.inc.php

\classes\issue\Issue.inc.php: github.com/cristiaan3003/ojsOsiri/blob/master/Issue.inc.php

\classes\issue\IssueDAO.inc.php: github.com/cristiaan3003/ojsOsiri/blob/master/IssueDAO.inc.php

\pages\issue\IssueHandler.inc.php:
github.com/cristiaan3003/ojsOsiri/blob/master/IssueHandler.inc.php

/pages/editor/IssueManagementHandler.inc.php: github.com/cristiaan3003/ojsOsiri/blob/master/IssueManagementHandler.inc.php


Regards Cristian
cristianviza
 
Posts: 75
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina

Re: add new images in createIssue - modify issue

Postby asmecher » Tue May 13, 2014 9:48 am

Hi Cristian,

That github repository doesn't appear to be forked from the official http://github.com/pkp/ojs repository. If you create your repo using a fork, it's easy to compare your repository against the official one and see exactly where your modifications were made; that way I can comment on the code there.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8869
Joined: Wed Aug 10, 2005 12:56 pm

Re: add new images in createIssue - modify issue

Postby cristianviza » Tue May 13, 2014 4:02 pm

Hi Asmecher.

Finally, after hours fight git :lol: I think this is your want ? : https://github.com/cristiaan3003/ojs/tree/myversion

Regards Cristian
cristianviza
 
Posts: 75
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina

Re: add new images in createIssue - modify issue

Postby asmecher » Tue May 13, 2014 4:17 pm

Hi Cristian,

Sorry, I think it's still a little garbled :(

Looking e.g. at dbscripts/xml/version.xml, it appears to be partially based on the master branch (OJS 3.0). I'd suggest starting your branch from the ojs-stable-2_4 branch, which is what we're releasing OJS 2.4.x from.

It's a steep learning curve, but git and github.com are really useful -- this won't just apply to your work with our software.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8869
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 1 guest