Changeset 19041
- Timestamp:
- 2009-04-17T19:44:48+12:00 (15 years ago)
- Location:
- gli/trunk/src/org/greenstone/gatherer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/collection/Collection.java
r18945 r19041 182 182 public String getName() { 183 183 return file.getParentFile().getName(); 184 } 185 186 /** @return just the name of the collection group if any, else returns "" */ 187 public String getCollectionGroupName() { 188 String groupAndColName = getGroupWithName(true); 189 190 int slash = groupAndColName.indexOf('/'); 191 if(slash == -1) { 192 return ""; 193 } else { // remove the colName from the end, to get the groupName 194 return groupAndColName.substring(0, slash); 195 } 196 } 197 198 /** 199 * If the collection is part of a collection group, returns the 200 * colgroupname/colname, else returns the colname. 201 * If url = true, then returns the sub-path as a URL (containing / only), 202 * and if url = false, then the sub-path is returned in filepath form 203 * (\ or /, depending on the OS). 204 * @return collection-group-name/collection-name 205 */ 206 public String getGroupWithName(boolean url) { 207 // Subtracting collect dir's path from the current collection's path 208 209 String groupAndCol; 210 String collectDir = Gatherer.getCollectDirectoryPath(); 211 String currentCollDir = file.getParentFile().getAbsolutePath(); 212 213 if(currentCollDir.startsWith(collectDir)) { 214 groupAndCol = currentCollDir.substring(collectDir.length()); 215 } else { 216 // shouldn't happen, but in case it does, just return the collection name. 217 System.err.println("Current collection " + currentCollDir + " is not located inside collectdir " + "collectDir"); 218 groupAndCol = getName(); 219 } 220 221 if(url) { 222 groupAndCol = groupAndCol.replace('\\', '/'); 223 } 224 225 return groupAndCol; 184 226 } 185 227 -
gli/trunk/src/org/greenstone/gatherer/collection/CollectionManager.java
r18948 r19041 916 916 } 917 917 918 /** Returns the "collectionGroupName/collectionName" or just the collectionName 919 * depending on whether the collection is part of a collection group or not. 920 * If url = true, then returns the sub-path as a URL (containing / only), 921 * and if url = false, then the sub-path is returned in filepath form 922 * (\ or /, depending on the OS). 923 */ 924 static public String getLoadedColNameWithGroup(boolean url) 925 { 926 if (collection != null) { 927 return collection.getGroupWithName(url); 928 } 929 930 return null; 931 } 918 932 919 933 public CollectionTree getCollectionTree() -
gli/trunk/src/org/greenstone/gatherer/gui/PreviewButton.java
r18987 r19041 74 74 } 75 75 protected void configureHomeURL() { 76 // we could be working with standalone collections or collection groups 77 // so getting a collection-name may have a collection group prefix 78 // This means CollectionManager.getLoadedCollectionName() is no longer sufficient 79 String collGroupWithName = CollectionManager.getLoadedColNameWithGroup(true); 80 76 81 // set up the home page for the current collection 77 82 if (Gatherer.GS3 && !Configuration.fedora_info.isActive()) { // GLI for GS3 case 78 83 // don't do anything fancy here 79 preview_address = Configuration.library_url.toString() + Configuration.getServletPath() + "?a=p&sa=about&c=" + CollectionManager.getLoadedCollectionName() + "&l=" + Configuration.getLanguage(); 84 preview_address = Configuration.library_url.toString() + Configuration.getServletPath() 85 + "?a=p&sa=about&c=" + collGroupWithName + "&l=" + Configuration.getLanguage(); 80 86 return; 81 87 } … … 86 92 87 93 // FLI or GLI for GS2 case (no library_url) 88 preview_address = Configuration.library_url.toString() + "?c=" + CollectionManager.getLoadedCollectionName()+ "&l=" + Configuration.getLanguage();94 preview_address = Configuration.library_url.toString() + "?c=" + collGroupWithName + "&l=" + Configuration.getLanguage(); 89 95 90 96 String main_args = "&a=p&p=about";
Note:
See TracChangeset
for help on using the changeset viewer.