Add Albums: Where is the code?

jbsmith

Joined: 2005-07-13
Posts: 7
Posted: Wed, 2005-07-13 01:37

Hey guys,
I am trying to understand how Gallery works in order to modify it to suit my needs.

If I go to the URL (I've put the vars on different lines for easy reading:
main.php?
g2_view=core:ItemAdmin&
g2_subView=core:ItemAddAlbum&
g2_itemId=7&
g2_return=http%3A%2F%2Flocalhost%2Fgallery2%2Fmain.php&
g2_returnName=album

I understand the last 3 vars and what they do. I do not understand the process that gallery goes through in order to load core:ItemAdmin and core:ItemAddAlbum

I want to know in which file the code relevent to ItemAddAlbum exists. I need to change the way in which albums are added.

As a second, and less pressing question, can someone explain the technical process that Gallery goes through from taking the g2_view=core:ItemAdmin variable to ultimately displaying the admin page. Specifically, which files are involved?

Thanks,
Jordan

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-07-13 01:54

maybe you do your changes in a modular way, i.e. how it's meant to be made in g2.
then you'd not have to reapply your changes every time you upgrade g2.
if you explain your task, i may be able to see if it can be done in a modular way.

explanations:
all G2 requests are either controller or view requests (MVC).
either you request to see a certain thing (view) or you request to change / do something (controller).
in main.php, we check if either g2_controller and / or g2_view was part of the GET/POST variables (e.g. in the url).
the controller / views are named module:controllername and module:viewname.
so if g2_view=core:ItemAdd is requested, it calls the view in modules/core/ItemAdd.inc etc.

for ItemAddAlbum see modules/core/ItemAddAlbum.inc

each page you see is the result of templates.
the corresponding template is in modules/core/templates/ItemAddAlbum.tpl

 
jbsmith

Joined: 2005-07-13
Posts: 7
Posted: Wed, 2005-07-13 02:00

That was exactly what I needed.

btw, I am actually not editing the Gallery code for the reasons you cited.

I found the .class file I needed. Disregard the comments below.
For those who may search for this at a later date, the file that contains the createAlbum function is: modules/core/classes/GalleryCoreApi.class

So... I found the line I want:
GalleryCoreApi::createAlbum(...params...)

My next question is easy for someone who knows G2:
Where is the GalleryCoreApi class? (in which file)

Thanks,
Jordan

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-07-13 02:06

modules/core/classes/GalleryCoreApi.class

still, what are you trying to do, the big picture?