Page 2 of 3

Re: Create more than one category/subcategory from frontend

Posted: 19 Jun 2009, 08:32
by era
Dirk67 wrote: I found out that the user may create only one "main category" and then many subcategories to that "main category" ? (is this true ?)
yes,it's true.
Dirk67 wrote: Is it possible to have more than one "main category" (top level) per user ?
yes, it's possible
Dirk67 wrote: where to copy the +/- images ?
/components/com_phocagallery/images
Dirk67 wrote: by the way:
there is missing an <!--[if !IE]> --> in your:
../components/com_phocagallery/views/user/tmpl/default_upload.php
--> viewtopic.php?p=21244#p21244
[/quote]
I am leaving today and will be on Sunday, I can make changes on Sunday, OK?

Re: Create more than one category/subcategory from frontend

Posted: 19 Jun 2009, 08:54
by Dirk67
era wrote:
Dirk67 wrote: Is it possible to have more than one "main category" (top level) per user ?
yes, it's possible
how ?
can not create more than one "main category" (top level) per user (with your hack).
(maybe the admin only can do this ?)




did you read this --> viewtopic.php?p=21409#p21409
regarding the (not working) multiple-java-upload (with your hack active) ?

Re: Create more than one category/subcategory from frontend

Posted: 19 Jun 2009, 12:22
by Dirk67
found out something for that problem --> viewtopic.php?p=21409#p21409
regarding the (not working) multiple-java-upload (with your hack active) ?


I changed this file:
--> ../components/com_phocagallery/views/user/tmpl/default_upload.php

I named the form in which you placed the category/subcategory selection:

Code: Select all

<form onsubmit="return OnUploadSubmit();" action="<?php echo $this->tmpl['action'] . $amp ?>task=upload&<?php echo $this->session->getName().'='.$this->session->getId(); ?>&<?php echo JUtility::getToken();?>=1&viewback=user" id="uploadForm" name="uploadForm" method="post" enctype="multipart/form-data">
(added name="uploadForm" )

Then I added a new parameter to the both java applet implementations,
added <param name="formdata" value="uploadForm" /> (2 times):

Code: Select all

			<h2><?php echo JText::_('Java Upload'); ?></h2>
            <!--[if !IE]> -->
			<object classid="java:wjhk.jupload2.JUploadApplet" type="application/x-java-applet" archive="<?php echo $archive;?>" height="<?php echo $this->tmpl['javaboxheight'] ?>" width="<?php echo $this->tmpl['javaboxwidth'] ?>" >

			<param name="archive" value="<?php echo $archive;?>" />

			<param name="postURL" value="<?php echo $action;?>"/>
			<param name="afterUploadURL" value="<?php echo $return;?>"/>
			<param name="allowedFileExtensions" value="jpg/gif/png/" />		            
			<param name="uploadPolicy" value="PictureUploadPolicy" />            
			<param name="nbFilesPerRequest" value="1" />
			<param name="maxPicHeight" value="<?php echo $this->tmpl['javaresizewidth'] ?>" />
			<param name="maxPicWidth" value="<?php echo $this->tmpl['javaresizeheight'] ?>" />
			<param name="maxFileSize" value="<?php echo $this->tmpl['uploadmaxsize']; ?>" />			
			<param name="pictureTransmitMetadata" value="true" />		
			<param name="showLogWindow" value="false" />	
			<param name="showStatusBar" value="true" />
			<param name="pictureCompressionQuality" value="1" />
			<param name="formdata" value="uploadForm" />	

				
			<!--<![endif]-->
			<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab" height="<?php echo $this->tmpl['javaboxheight'] ?>" width="<?php echo $this->tmpl['javaboxwidth'] ?>" > 
			  <param name="code" value="wjhk.jupload2.JUploadApplet" />
			  <param name="archive" value="<?php echo $archive;?>" />
			  
			<param name="postURL" value="<?php echo $action;?>"/>
			<param name="afterUploadURL" value="<?php echo $return;?>"/>
			<param name="allowedFileExtensions" value="jpg/gif/png" />		            
			<param name="uploadPolicy" value="PictureUploadPolicy" />            
			<param name="nbFilesPerRequest" value="1" />
			<param name="maxPicHeight" value="<?php echo $this->tmpl['javaresizewidth'] ?>" />
			<param name="maxPicWidth" value="<?php echo $this->tmpl['javaresizeheight'] ?>" />
			<param name="maxFileSize" value="<?php echo $this->tmpl['uploadmaxsize']; ?>" />			
			<param name="pictureTransmitMetadata" value="true" />		
			<param name="showLogWindow" value="false" />	
			<param name="showStatusBar" value="true" />
			<param name="pictureCompressionQuality" value="1" />
			<param name="formdata" value="uploadForm" />	
now it works propery with the java uploader as well :twisted:

Re: Create more than one category/subcategory from frontend

Posted: 23 Jun 2009, 10:47
by Dirk67
Hi era again,

in the meantime I like this hack very much,
everything works already on my 'live' - site and my users use it frequently

there's only one remaining thing:

if you use the normal single upload,
the chosen category always falls back on the first category
after the user has uploaded one picture.

I mean if the user uploads one picture, the page loads again to tell that the upload was successfully,
and during this reload of the page, the chosen (sub-)category switches back to the main (first) category.

How can we overcome this ?
I thought the form variable 'categoryparent' is submitted somewhere with the 'post' method (?)
(from the <form> out of 'default_upload.php' ?)

So maybe we can read it out with a JRequest::getVar('categoryparent')
and put it as a default into the drop-down list (wich is generated by the method '$model->PGSelectList') ?

I tried something like this by modifying the 'view.html.php'

original:

Code: Select all

} elseif ($tmpl['operation'] == '') {
  $tmpl['CategoryTree'] = $model->PGSelectList(0, 'categoryparent', 0);
  $tmpl['catgoriesTree'] = $model->PGShowTree($SrtRows, 0);
  $tmpl['catgoriesJS'] = $model->GetCategoriesInJS($SrtRows);
}
modified:

Code: Select all

} elseif ($tmpl['operation'] == '') {
  $default = JRequest::getVar('categoryparent', 0, 'post', 'int');
  $tmpl['CategoryTree'] = $model->PGSelectList($default, 'categoryparent', 0);
  $tmpl['catgoriesTree'] = $model->PGShowTree($SrtRows, 0);
  $tmpl['catgoriesJS'] = $model->GetCategoriesInJS($SrtRows);
}
but this didn't worked out...

Do you have any idea era ?

Re: Create more than one category/subcategory from frontend

Posted: 24 Jun 2009, 10:25
by amtoft
I like this very much too.
Just to let You know.
And it works fine for me too.

Så thank You very much.

(By the way - when You can do this, perhaps You can help on this one too: -viewtopic.php?f=1&t=1504&p=21001&hilit=username#p21001 ?)
That one I need too :|

Re: Create more than one category/subcategory from frontend

Posted: 26 Jun 2009, 01:42
by era
Hi Dirk67, for some reason did not receive notification of new messages by e-mail.

now then, for:
Dirk67 wrote: if you use the normal single upload,
the chosen category always falls back on the first category
after the user has uploaded one picture.
in file controller.php, function _uploadSingleFile was:

Code: Select all

				$return	= JRoute::_('index.php?option=com_phocagallery&view=user&tab='.$tab.'&Itemid='.$Itemid, false);

				// Get user catid, we are not in the category, so we must find the catid
//				$modelUser 		= $this->getModel('user');
//				$userCatId 		= $modelUser->getUserCategory($user->id);
				$catid = JRequest::getVar( 'categoryparent', 0, 'post', 'int' );
change to:

Code: Select all

				// Get user catid, we are not in the category, so we must find the catid
//				$modelUser 		= $this->getModel('user');
//				$userCatId 		= $modelUser->getUserCategory($user->id);
				$catid = JRequest::getVar( 'categoryparent', 0, 'post', 'int' );
				if ($catid) {
					$return	= JRoute::_('index.php?option=com_phocagallery&view=user&tab='.$tab.'&Itemid='.$Itemid.'&cat='.$catid, false);
				} else {
					$return	= JRoute::_('index.php?option=com_phocagallery&view=user&tab='.$tab.'&Itemid='.$Itemid, false);
				}
then in views/user/view.html.php change, was:

Code: Select all

		} elseif ($tmpl['operation'] == '') {
			$tmpl['CategoryTree'] = $model->PGSelectList(0, 'categoryparent', 0);
			$tmpl['catgoriesTree'] = $model->PGShowTree($SrtRows, 0);
			$tmpl['catgoriesJS'] = $model->GetCategoriesInJS($SrtRows);
		}

		
		$document->addCustomTag(PhocaGalleryHelperRender::renderDescriptionCreateCatJS((int)$tmpl['maxcreatecatchar']));
change to:

Code: Select all

		} elseif ($tmpl['operation'] == '') {
			$catid = JRequest::getVar( 'cat', 0, 'get', 'int' );
			$tmpl['CategoryTree'] = $model->PGSelectList($catid, 'categoryparent', 0);
			$tmpl['catgoriesTree'] = $model->PGShowTree($SrtRows, 0);
			$tmpl['catgoriesJS'] = $model->GetCategoriesInJS($SrtRows);
		}

		
		$document->addCustomTag(PhocaGalleryHelperRender::renderDescriptionCreateCatJS((int)$tmpl['maxcreatecatchar']));

Re: Create more than one category/subcategory from frontend

Posted: 26 Jun 2009, 07:38
by Dirk67
Thank you, it works ! :D

there's one final thing:

for example a user has created his own 5 categories in the front end...

if you go to the admin backend then and edit the categories for some reason,
then the user assignment to his 5 categories is deleted (!)
it remains only one categorie assigned to this user...

I think this is meant to be
(like it should be) in the original script of Jan, because in the original script, there's only the possibility to have one user assigned to one category as "author"

can we overcome (hack) this as well ?

(I think this user-assignment is stored in the datebase table 'jos_phocagallery_user_category' (?)...)

Re: Create more than one category/subcategory from frontend

Posted: 15 Jul 2009, 08:14
by era
a couple of days I will have time - I will make changes that would Dirk67 and overlaid changes + modified files.

Re: Create more than one category/subcategory from frontend

Posted: 16 Jul 2009, 00:34
by filiplarlibe
Hello everyone,

I wonder whether it is possible to put the photos that users come to add to the Front End, pending approval by the administrator.

Does anyone have an idea to do this?
Thank you in advance.

Sorry for my English I am french and I use the google translator.

Re: Create more than one category/subcategory from frontend

Posted: 17 Sep 2009, 10:52
by niels77
Greetings people,

I've got the phoca gallery 2.5.8 running smoothly. I bumped up to the same problem...no multiple catergory making from the front end. I want my client - as the admin of his own site - to be able to create different categories without having to explain him the back-end.

I uploaded the patch created by 'era' which gave me this error :
-------------------------------------------------------------------
Warning: require_once(/opt/www/ABCXYZ/web/www.clemenscom.be/administrator/compone ... upload.php) [function.require-once]: failed to open stream: No such file or directory in /opt/www/xsited/web/www.clemenscom.be/components/com_phocag ... roller.php on line 13

Fatal error: require_once() [function.require]: Failed opening required '/opt/www/ABCXYZ/web/www.clemenscom.be/administrator/compone ... upload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /opt/www/ABCXYZ/web/www.clemenscom.be/components/com_phocag ... roller.php on line 13
------------------------------------------------------------------

Anyone a suggestion ?