Customising Site Design
From ResourceSpace Documentation Wiki
How to create your own themes
Themes have three parts:
- A CSS file in the "css" folder with the name "Col-xxxx.css" where xxxx is the name of your theme.
- A subfolder of the "gfx" folder. You will see the whitegry and greyblu folders in there. Copy one of these to a folder with your new theme name (you will probably want to copy greyblu). You can then change the appropriate CSS and images to style the new theme. The logo is conveniently part of the theme so you can set a custom logo for each group too.
- A chip in gfx/interface/XxxxChip.gif
To make the theme available as a selection (if the theme isn't forced through userfixedtheme), modify the available_themes array in config.php.
# Theme chips available. This makes it possible to add new themes and chips using the same structure.
# To create a new theme, you need a chip in gfx/interface, a graphics folder called gfx/<themename>,
# and a css file called css/Col-<themename>.css
$available_themes=array("greyblu","black","whitegry");
although the above mechanism works, you can also create themes as plugins. A plugin with a 'style.css' file within a single CSS folder will allow you to override styles. You can also put any extra graphics required in a 'gfx' folder. See the plugins page for more information.
CSS / GIF for template change
/ResourceSpace/gfx/greyblu/interface
is where all the blue theme graphics are, which include gradients and the icons which will also need to be modified accordingly. Suggestion: Open them all up in a graphics program and adjust the hue for each of them with the same hue change for each graphic. This keeps all the color gradients and aliasing properly modified relative to one another.
The CSS files are a bit trickier, but once you find the right colors to change, you can pretty much search and replace, for example, to make all dark blues into dark browns, all light blues into light browns, etc.
Group specific themes
It's possible to create a theme that will only be used for certain user group(s). See: User_Group_Management#Group_specific_user_interfaces
Change Intro Slideshow
The default slides are in /gfx/homeanim/gfx/.
You can add your own folder in the homeanim folder, and set the path in config.php:
$homeanim_folder="gfx/homeanim/myslides";
Start with 1.jpg and add as many images (sequentially) into "myslides" as you like. It is good to do it this way, since then your custom home images won't conflict with subversion updates.
It'd be nice if they weren't fixed (i.e. selectable from actual
resources) but due to widely varying aspect ratios in typical photos
this isn't possible, at least not without building in some sort of
cropping tool. It's probably best to hand-build them anyway so you
can tune the filesize. They should ideally be less than 100k each
(closer to 50k) so they load quickly. They should be 517x350 pixels.
Customize Simple Search sidebar
The language customization file "en.php" within the folder "languages" contains some of the text fields that are used in the simple search bar. You can easily change some of the wording like "any country" to "any team".
Custom Help Sections
You can extend the Help Page by setting up extra help sections in Team Center-->System Setup-->Site Text
Click "New Site Text Entry", then in the Page field enter "help" and in the name field name your own help section name, i.e. "Help with Search Features", then enter your help text. Save it, and when you go back to your Help & Advice page, there will be a link to your new section.
Customising Home Page Panels
The link panels on the home page, to the right of the slide show, can be customised. The existing panels can be switched off and / or new panels can be added.
To switch off the existing panels: in the config.php file, or in "Config Override" if setting this on a per-group basis, enter:
$home_themeheaders=false; $home_themes=false; $home_mycollections=false; $home_helpadvice=false;
You can add as many panels as you like. They must be numbered sequentially starting from zero (0,1,2,3 etc.)
Again in config.php or in "Config Override" enter your custom panels as follows:
$custom_home_panels[0]["title"]="Custom Panel A"; $custom_home_panels[0]["text"]="Custom Panel Text A"; $custom_home_panels[0]["link"]="search.php?search=example"; $custom_home_panels[1]["title"]="Custom Panel B"; $custom_home_panels[1]["text"]="Custom Panel Text B"; $custom_home_panels[1]["link"]="search.php?search=example"; $custom_home_panels[2]["title"]="Custom Panel C"; $custom_home_panels[2]["text"]="Custom Panel Text C"; $custom_home_panels[2]["link"]="search.php?search=example";
- "title" is the large title text that will be the clickable area
- "text" is optional help text that appears under the title
- "link" is a link to the page in question. Any URL can be used (internally to ResourceSpace or externally to another site)
"title" and "text" support the multilingual format used for field names and values.
Customising Top Level Navigation
To add additional top navigation links: in the config.php file, or in "Config Override" if setting this on a per-group basis, enter:
You can add as many links as you like. They must be numbered sequentially starting from zero (0,1,2,3 etc.)
$custom_top_nav[0]["title"]="Example Link A"; $custom_top_nav[0]["link"]="search.php?search=a"; $custom_top_nav[1]["title"]="Example Link B"; $custom_top_nav[1]["link"]="search.php?search=b";
- "title" is the visible clickable text and supports the multilingual format used for field names and values.
- "link" is a link to the page in question. Any URL can be used (internally to ResourceSpace or externally to another site)
Customising Field Display in Search Views
It is now possible to add arbitrary fields to the thumbnail and list search views:
You must set $use_resource_column_data=false; to override the hardcoded displays.
$use_resource_column_data=false;
$thumbs_display_fields=array(8,3);
$list_display_fields=array(8,3);
You can also set $data_joins, to include fields into the search result for use in plugins. For example, setting:
$data_joins=array(51);
will make 'field51' available in the search result, while not including it in the list or thumbs display.
Customising Title Display
The default is:
$view_title_field=8;
This tells the system to display field 8 (Title) as the title on the view page, collections panel, related resources, and any other place where a single "title" is needed, other than thumbnail search display and list search display. For example, if you want to generally display original filenames instead, set:
$view_title_field=51;
Important: Don't forget to also add 51 to your search displays:
$thumbs_display_fields=array(51,3); $list_display_fields=array(51,3);
List of 'Joined' (cached) Fields: Understanding Display Fields
This entry pertains to database structure. It's helpful for an administrator to understand how this works.
Actual resource field data is stored in the resource_data table. However, to enable display configurability while keeping search results fast, some field data is duplicated (denormalized[[1]]) to the resource table. These "field#" columns on the resource table are only used for quick display purposes in search results where it would be too expensive to actually join arbitrary resource_data rows. The "field#" columns are just a kind of "cache", to be generated and used by the system automatically.
List of joined fields (called 'joins' because they used to be SQL joins):
$thumbs_display_fields $list_display_fields $data_joins $metadata_template_title_field $view_title_field $config_sheetlist_fields $config_sheetthumb_fields
Each unique field defined in the variables above are added as a field# column (ex. field8) to the resource table with existing data from resource_data, and are subsequently kept up to date with any field updates.
Clearing the "cache"
At any time you can refresh these columns by dropping the 'field#' columns from the resource table. They will be rebuilt automatically. Why would you want to do this? If you have removed many fields from the list of joined fields, it will help keep your resource table lean. Also, for example, if you have a field8 column, but no 8 in any of the list of joined fields, it wont' be getting updated properly while it remains undefined in the list of joined fields, and it will need to be recreated if you use field 8 as a display field the future.
Take note that $data_joins can be a way to include fields without displaying them (meaning you can use it as a safety). For example, if your $thumbs_display_fields and $list_display_fields change per group, you would probably want to set $data_joins globally and make sure all potentially used fields are defined there (so that field updates work independently of per-group display differences).
Adding Filesize sortability in list view
This is possible if using exiftool. Add a field called File Size, give it the short name "filesize", and add "filesize" to the exiftool field.
Set config options to include the new field in list view:
$use_resource_column_data=false;
$list_display_fields=array(8,3,[your filesize field ref]);
Add the file plugins/exiftool_filter_filesize.php:
<?php $value=filesize2bytes($value);
do pages/tools/update_exiftool_field.php?fieldrefs=[your filesize field ref], so that the bytes are stored in the database.
Then add the file plugins/value_filter_filesize.php:
<?php
$value=str_replace(" "," ",formatfilesize($value));
so that the human-readable value is displayed in the view.php and search.php pages.
