<Module>
  <ModulePrefs
	title="Indexing Status"
	title_url="http://ntvmr.uni-muenster.de"
	author_email="scribe777@gmail.com"
	author="Institut für neutestamentliche Textforschung"
	description="Show Potential Indexing Candidate Document and Status"
	screenshot="http://ntvmr.uni-muenster.de/community/images/listescreenshot.png"
	thumbnail="http://ntvmr.uni-muenster.de/community/images/pageicon.gif"
	scrolling="true"
   >
  <Optional feature="pubsub-2">
  <Param name="topics">
    <![CDATA[ 
    <Topic title="Manuscript Selection" name="interedition.manuscript.selected"
            description="Select a Manuscript" type="string" subscribe="true"/>
    <Topic title="Manuscript Selection" name="interedition.image.selected"
            description="Select a Manuscript" type="string" subscribe="true"/>
    <Topic title="Manuscript Selection" name="interedition.transcription.selected"
            description="Select a Manuscript" type="string" subscribe="true"/>
    <Topic title="Manuscript Selection" name="interedition.page.selected"
            description="Select a Manuscript" type="string" subscribe="true"/>
	
    ]]>
  </Param>
</Optional>
  <Optional feature="dynamic-height"/>
  <Optional feature="views"/>
  <Optional feature="opensocial-0.8"/>
</ModulePrefs>

<UserPref name="height" datatype="enum" display_name="Gadget Height" default_value="600">
	<EnumValue value="200" display_value="Short"/>
	<EnumValue value="300" display_value="Short-Medium"/>
	<EnumValue value="400" display_value="Medium"/>
	<EnumValue value="600" display_value="Tall"/>
	<EnumValue value="-1" display_value="Dynamic"/>
</UserPref>
<UserPref name="promotion" datatype="string" display_name="Alternative promotion text" default_value="" />
<UserPref name="limitToProject" datatype="bool" display_name="Limit to Project" default_value="true" />

<Content type="html">
<![CDATA[
<head>

	<link rel="stylesheet" type="text/css" href="/community/js/jquery-ui/jquery-ui.css"/>

	<script type="text/javascript" src="/community/js/jquery/jquery.min.js"></script>
	<script type="text/javascript" src="/community/js/jquery.blockUI.js"></script>
	<script type="text/javascript" src="/community/js/jquery-ui/jquery-ui.min.js"></script>
	<script type="text/javascript" src="/community/js/URI.min.js"></script>
	<script type="text/javascript" src="/community/js/jquery/jquery.cookie.js"></script>
	<script type="text/javascript" src="/community/js/vmr-common.js"></script>

<style type="text/css">
<!--
table {
	border-collapse: collapse;
}

table#smallsize {
	border-collapse: collapse;
	width: 100%;
}

td, th {
	padding: 5px 4px;
	border: 1px solid #CCC;
	/*white-space: nowrap;
	overflow: hidden;*/
}


thead, tfoot {
	background-color: #CCC;
}

tr.rowodd {
	background-color: #FFF;
}

tr.roweven {
	background-color: #F2F2F2;
}

.sortcol {
	cursor: pointer;
	padding-right: 20px;
	background-repeat: no-repeat;
	background-position: right center;
}
.sortasc {
	background-color: #DDFFAC;
	background-image: url(../images/up.gif);
}
.sortdesc {
	background-color: #B9DDFF;
	background-image: url(../images/down.gif);
}
.nosort {
	cursor: default;
}

.urg1, .urg2, .urg3, .urg4, .urg5 {
	padding: 3px;
	text-align: center;
	border: 1px solid #333;
	width: 3em;
}

.urg1 {
	background-color: #FFFACD;
}
.urg2 {
	background-color: #FFD700;
}
.urg3 {
	background-color: #FFA500;
}
.urg4 {
	background-color: #E13E00;
}
.urg5 {
	background-color: Red;
}

th.resize-handle-active {
	cursor: e-resize;
}

.ui-tabs-nav {
	font-size: 85%;
}

.ui-tabs .ui-tabs-panel {
	padding: .5em .5em;
}

div.resize-handle { cursor: e-resize; width: 2px; border-right: 1px dashed #1E90FF; position:absolute; top:0; left:0; } 
	body {
		font-family: arial, sans-serif;
		font-size: 14px;
	}

span.lock-icon {
  position:absolute;
  left:80%;
  top:0%;
}

div.thumbnail {
  position:relative;
  display:block;
  float:left;
}

a img {
	text-decoration: none;
	border: 0 none;
	}
	
-->
</style>
</head>

<body style="background-color: #EEE;">
<div>
<b><i>Pending Work</i></b>
<p id="promotion" style="font-size:small;background-color: #EEE;margin-after:0px;">
</p>
</div>
<div style="background-color: white;">
	<table class="" style="width:100%;">
		<thead>
			<tr><th>Status</th><th>Indexer</th><th id="docIDCol">INTF Id</th><th id="ga_numbercol">GA</th><th id="centurycol">Date</th><th id="Leavescol">Pgs</th></tr>
		</thead>
		<tfoot>
			<tr><th>Status</th><th>Indexer</th><th>INTF Id</th><th>GA</th><th>Date</th><th>Pgs</th></tr>
		</tfoot>
		<tbody id="statusTable">
		</tbody>
	</table>
</div>
<script>

var promotion = 'The INTF NTVMR has complete Biblical Content index information for hundreds of New Testament manuscripts.  Below you will see a list of manuscripts which have not yet been fully indexed but have images available.  You can help.  Become an active member of the NTVMR community and help us build a more complete manuscript repository for NT studies.';
var limitToProject = false;


function loadStatus() {
	$.blockUI({ message: '<h3><img src="'+VMR.imagesURL+'/loading.gif" /> Computing Index Status.  Please wait...</h3>' });
	$('#statusTable').html('<tr><td colspan="6"></td></tr>');
	var postData = { };
	if (limitToProject) postData.limitToProject = VMR.projectID;
	VMR.directWebRequest(VMR.httpRoot+'/projects/ntmss/indexstatustable.jsp', postData, function(o) {
		$('#statusTable').html(o.text);
		$('.viewlink').each(function() {
			$(this).attr('href', VMR.getRelativeURL('indexing/?docID='+$(this).attr('data-docid')));
		});
		$.unblockUI();
	});
}

function claimResponsibility(docID) {
	if (confirm('Are you sure you want to claim responsibility for indexing document ' +docID + '?')) {
	
		var postData = {
			objectID      : docID,
			taskTypeID    : 2,
			assignedTo    : VMR.userName,
		};
	
		VMR.serviceRequest('projectmanagement/task/assign', postData, function(o) {
			var xml = $.parseXML(o.text);
			var error = $(xml).find('error');
			if (error && error.length) {
				alert($(error).attr('message'));
			}
			else {
				alert($(xml).find('success').attr('message'));
				$('#doc'+docID+'indexer').html(
					'<a href="/web/'+VMR.userName+'" target="_blank">'+VMR.userName+'</a>'
				 );

				// announce activity
				var params = {};  
				params[opensocial.Activity.Field.TITLE] = 'Assignment made for Indexing Manuscript: '+docID+' to '+VMR.userName;
				var activity = opensocial.newActivity(params); 
				opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH);
			}
		});
	}
}

function mss_selected(docID, focusPageId) {

	$('.docrow').css('background-color', '#FFFFFF');
	$('#doc'+docID).css('background-color', '#E2E2E2');

	VMR.publish("interedition.manuscript.selected", docID);
//	loadManuscripts(true, 'docID', docID, docID, focusPageId);
}


VMR.init(function() {
	var p = VMR.prefs.getString('promotion');
	limitToProject = VMR.prefs.getBool('limitToProject');
	if (p && p.length > 0) promotion = p;
	$('#promotion').html(promotion);
	loadStatus();

}, '../../', true);


</script>
</body>

]]>
</Content>
</Module>

