Project Image taken from Client Image
Page: 1
Can we have the Project Image automatically taken from the default Client image?
It would save some time as it stands you add a client, add an image, and then have to add the same image for each project.
It would save some time as it stands you add a client, add an image, and then have to add the same image for each project.
caffeine_twitch
on Oct 25. 2007. 8:34 am
I agree. By default it should take the client's image, but have the option to add a different one if you so choose.
Where there's a will, there's a way.
Add these lines DIRECTLY after line 397 in /activecollab/application/modules/system/models/projects/Project.class.php (the one saying "$size = $large ? '40x40' : '16x16';" in the beginning of the getIconUrl() function)
Please note, messing with the core breaks updates! - Works here on 1.0.3, haven't updated to 1.0.4, tho I don't see why it wouldn't work there aswell. It's a dirty and very quick hack, and normal project icons won't work afterwards. But it should point you in the right direction if you really need this.
Add these lines DIRECTLY after line 397 in /activecollab/application/modules/system/models/projects/Project.class.php (the one saying "$size = $large ? '40x40' : '16x16';" in the beginning of the getIconUrl() function)
$company_id = $this->getCompanyId();
if (is_file(ENVIRONMENT_PATH . '/' . PUBLIC_FOLDER_NAME . '/logos/' . $company_id . ".$size.jpg")) {
return ROOT_URL . '/' . PUBLIC_FOLDER_NAME .'/logos/'. $company_id .".$size.jpg";
} else {
return ROOT_URL . '/' . PUBLIC_FOLDER_NAME ."/logos/default.$size.gif";
} // if
Please note, messing with the core breaks updates! - Works here on 1.0.3, haven't updated to 1.0.4, tho I don't see why it wouldn't work there aswell. It's a dirty and very quick hack, and normal project icons won't work afterwards. But it should point you in the right direction if you really need this.
Casper Valdemar
cyandesign
on Nov 4. 2007. 12:30 am
Hey Valdemar, This worked great in 1.0.4.
I had to remove the
'/' . PUBLIC_FOLDER_NAME .
Because my config file had "/public" in the URL. But other than that, it works great.
Thanks.
I had to remove the
'/' . PUBLIC_FOLDER_NAME .
Because my config file had "/public" in the URL. But other than that, it works great.
Thanks.
I have too many changes to keep track of as it is that I need to change back once I apply 1.0.4
I will just wait and hope they see the sense of implementing this in a future update not too far away.
I hope they have documented all the changes in this update so I know what not to fix.
I will just wait and hope they see the sense of implementing this in a future update not too far away.
I hope they have documented all the changes in this update so I know what not to fix.
Just added this to our current installation, to make it easier for the finance dept. to find client project among regular projects, works on 1.0.6. Replace the getIconUrl() function at around line ~397 in /activecollab/application/modules/system/models/projects/Project.class.php:
Ilija, please consider patching this in 1.1, and making it a switch in Administration, if possible.
function getIconUrl($large = false) {
$size = $large ? '40x40' : '16x16';
$company_id = $this->getCompanyId();
if(is_file($this->getIconPath($large))) {
return ROOT_URL . '/projects_icons/' . $this->getId() . ".$size.gif";
} elseif(is_file(ENVIRONMENT_PATH . '/' . PUBLIC_FOLDER_NAME . '/logos/' . $company_id . ".$size.jpg")) {
return ROOT_URL . '/' . PUBLIC_FOLDER_NAME .'/logos/'. $company_id .".$size.jpg";
} else {
return ROOT_URL . "/projects_icons/default.$size.gif";
} // if
} // getAvatarUrl
Ilija, please consider patching this in 1.1, and making it a switch in Administration, if possible.
Casper Valdemar



