Skip to content
Snippets Groups Projects
Commit 12bdb602 authored by srosse's avatar srosse
Browse files

FXOLAT-437: small enhancements for coaching project

parent d5af972e
No related branches found
No related tags found
No related merge requests found
Showing with 77 additions and 3 deletions
......@@ -486,6 +486,45 @@ public class TableController extends BasicController {
return table.getSortedRow(originalRow);
}
/**
* Return the object at the visible index (sorted or not, searched or not)
* @param index
* @return
*/
public Object getSortedObjectAt(int index) {
TableDataModel model = getTableDataModel();
for(int i=0; i<getRowCount(); i++) {
int pos = getSortedRow(i);
if(pos == index) {
return model.getObject(i);
}
}
return null;
}
/**
* Return the visible index of the object (sorted or not, searched or not)
* @param obj
* @return
*/
public int getIndexOfSortedObject(Object obj) {
int index = -1;
for(int i=getTableDataModel().getRowCount(); i-->0; ) {
if(obj.equals(getTableDataModel().getObject(i))) {
index = i;
break;
}
}
for(int i=0; i<getRowCount(); i++) {
int currentPos = getSortedRow(i);
if(currentPos == index) {
return i;
}
}
return -1;
}
/**
* @return The currently active filter object or <code>null</code> if no
* filter is applied
......
......@@ -279,6 +279,30 @@ public class RepositoryManager extends BasicManager {
if (key == null) return null;
return (RepositoryEntry)DBFactory.getInstance().findObject(RepositoryEntry.class, key);
}
/**
* Lookup repo entry by key.
* @param the repository entry key (not the olatresourceable key)
* @return Repo entry represented by key or null if no such entry or key is null.
*/
public RepositoryEntry lookupRepositoryEntry(Long key, boolean strict) {
if (key == null) return null;
if(strict) {
return lookupRepositoryEntry(key);
}
StringBuilder query = new StringBuilder();
query.append("select v from ").append(RepositoryEntry.class.getName()).append(" as v ")
.append(" inner join fetch v.olatResource as ores")
.append(" where v.key = :repoKey");
DBQuery dbQuery = DBFactory.getInstance().createQuery(query.toString());
dbQuery.setLong("repoKey", key);
List<RepositoryEntry> entries = dbQuery.list();
if(entries.isEmpty()) {
return null;
}
return entries.get(0);
}
/**
* Lookup the repository entry which references the given olat resourceable.
......
......@@ -37,6 +37,7 @@ import java.util.StringTokenizer;
import org.olat.core.commons.persistence.DBFactory;
import org.olat.core.logging.StartupException;
import org.olat.core.util.StringHelper;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
......@@ -195,7 +196,7 @@ public class UpgradeManagerImpl extends UpgradeManager {
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
if (strLine.length() > 1 && (!strLine.startsWith("--") && !strLine.startsWith("#"))) {
sb.append(strLine.trim());
sb.append(strLine.trim()).append(' ');
}
}
......@@ -203,7 +204,12 @@ public class UpgradeManagerImpl extends UpgradeManager {
String sql = null;
while (tokenizer.hasMoreTokens()) {
try {
sql = tokenizer.nextToken()+";".toLowerCase();
String token = tokenizer.nextToken();
if(!StringHelper.containsNonWhitespace(token)) {
continue;
}
sql = token + ";".toLowerCase();
if (sql.startsWith("update") || sql.startsWith("delete") || sql.startsWith("alter") || sql.startsWith("insert")) {
statement.executeUpdate(sql);
} else {
......
......@@ -258,6 +258,7 @@ div.b_iframe_wrapper iframe { width:100%; position:relative; top: 0; left:0; bor
&.o_site_groupsmanagement > div { background-image: url('../openolat/images/users_conf.png'); }
&.o_site_repository > div { background-image: url('../openolat/images/books-stack.png'); }
&.o_site_groups > div { background-image: url('../openolat/images/users.png'); }
&.o_site_coaching > div { background-image: url('../openolat/images/eye.png'); }
&.site_demo_icon > div { background-image: url('../openolat/images/information-white.png'); }
&.f_site_library > div { background-image: url('../openolat/images/library.png'); }
&.fx_members > div { background-image: url('../openolat/images/users_members.png'); }
......
......@@ -239,7 +239,11 @@ li a.b_toolbox_copy, .b_copy_icon { background-image: url('../openolat/images/do
span.o_passed { background: url(../openolat/images/tick.png) no-repeat right 50%; padding: 0 25px 0 0; color: #009900; }
span.o_notpassed { background: url(../openolat/images/cross.png) no-repeat right 50%; padding: 0 25px 0 0; color: #990000; }
.o_efficiencystatement_icon { background-image: url(../openolat/images/seal.png);}
span.o_green_led { background: url(../openolat/images/green_led.png) no-repeat right 50%; padding: 0 25px 0 0; color: #990000; }
span.o_yellow_led { background: url(../openolat/images/yellow_led.png) no-repeat right 50%; padding: 0 25px 0 0; color: #990000; }
span.o_red_led { background: url(../openolat/images/red_led.png) no-repeat right 50%; padding: 0 25px 0 0; color: #990000; }
span.o_black_led { background: url(../openolat/images/black_led.png) no-repeat right 50%; padding: 0 25px 0 0; color: #990000; }
/* --------- course building block icons ------------------- */
.o_bc_icon { background-image: url('../openolat/images/folder.png') ! important; }
......
src/main/webapp/static/themes/openolat/images/black_led.png

1.1 KiB

src/main/webapp/static/themes/openolat/images/eye.png

566 B

src/main/webapp/static/themes/openolat/images/green_led.png

610 B

src/main/webapp/static/themes/openolat/images/red_led.png

1.46 KiB

src/main/webapp/static/themes/openolat/images/yellow_led.png

1.48 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment