##// END OF EJS Templates
moved loged in user propagation out of forms,...
moved loged in user propagation out of forms, update user model to get auto update last login. bugfix with redirect log fixed forms logic a little bit some other tweeks

File last commit:

r399:f5c1eec9 default
r442:d66a7fa7 default
Show More
repo_settings.html
261 lines | 11.3 KiB | text/html | HtmlLexer
Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
r320 ## -*- coding: utf-8 -*-
<%inherit file="/base/base.html"/>
<%def name="title()">
version bump to 0.8...
r362 ${_('Repositories administration')}
Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
r320 </%def>
version bump to 0.8...
r362
<%def name="breadcrumbs_links()">
${h.link_to(c.repo_info.repo_name,h.url('summary_home',repo_name=c.repo_info.repo_name))}
&raquo;
${_('Settings')}
Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
r320 </%def>
<%def name="page_nav()">
version bump to 0.8...
r362 ${self.menu('settings')}
Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
r320 </%def>
<%def name="main()">
version bump to 0.8...
r362 <div class="box">
<!-- box / title -->
<div class="title">
${self.breadcrumbs()}
</div>
${h.form(url('repo_settings_update', repo_name=c.repo_info.repo_name),method='put')}
<div class="form">
<!-- fields -->
<div class="fields">
<div class="field">
<div class="label">
fixed some html and styles, added owner into admin repo list...
r366 <label for="repo_name">${_('Name')}:</label>
version bump to 0.8...
r362 </div>
fixed some html and styles, added owner into admin repo list...
r366 <div class="input input-medium">
version bump to 0.8...
r362 ${h.text('repo_name')}
</div>
</div>
<div class="field">
<div class="label label-textarea">
fixed some html and styles, added owner into admin repo list...
r366 <label for="description">${_('Description')}:</label>
version bump to 0.8...
r362 </div>
<div class="textarea text-area editor">
${h.textarea('description',cols=23,rows=5)}
</div>
</div>
<div class="field">
<div class="label label-checkbox">
fixed some html and styles, added owner into admin repo list...
r366 <label for="private">${_('Private')}:</label>
version bump to 0.8...
r362 </div>
<div class="checkboxes">
${h.checkbox('private',value="True")}
</div>
</div>
<div class="field">
<div class="label">
fixed some html and styles, added owner into admin repo list...
r366 <label for="">${_('Permissions')}:</label>
version bump to 0.8...
r362 </div>
<div class="input">
<table id="permissions_manage">
<tr>
<td>${_('none')}</td>
<td>${_('read')}</td>
<td>${_('write')}</td>
<td>${_('admin')}</td>
<td>${_('user')}</td>
<td></td>
</tr>
rename repo2perm into repo_to_perm...
r399 %for r2p in c.repo_info.repo_to_perm:
version bump to 0.8...
r362 %if r2p.user.username =='default' and c.repo_info.private:
<tr>
fixed some html and styles, added owner into admin repo list...
r366 <td colspan="4">
version bump to 0.8...
r362 <span class="private_repo_msg">
fixed some html and styles, added owner into admin repo list...
r366 ${_('private repository')}
version bump to 0.8...
r362 </span>
</td>
fixed some html and styles, added owner into admin repo list...
r366 <td class="private_repo_msg">${r2p.user.username}</td>
version bump to 0.8...
r362 </tr>
%else:
<tr id="id${id(r2p.user.username)}">
<td>${h.radio('perm_%s' % r2p.user.username,'repository.none')}</td>
<td>${h.radio('perm_%s' % r2p.user.username,'repository.read')}</td>
<td>${h.radio('perm_%s' % r2p.user.username,'repository.write')}</td>
<td>${h.radio('perm_%s' % r2p.user.username,'repository.admin')}</td>
<td>${r2p.user.username}</td>
<td>
%if r2p.user.username !='default':
<span class="delete_icon action_button" onclick="ajaxAction(${r2p.user.user_id},'${'id%s'%id(r2p.user.username)}')">
<script type="text/javascript">
function ajaxAction(user_id,field_id){
var sUrl = "${h.url('delete_repo_user',repo_name=c.repo_name)}";
var callback = { success:function(o){
var tr = YAHOO.util.Dom.get(String(field_id));
fixed some html and styles, added owner into admin repo list...
r366 tr.parentNode.removeChild(tr);},failure:function(o){
alert("${_('Failed to remove user')}");},};
version bump to 0.8...
r362 var postData = '_method=delete&user_id='+user_id;
var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);};
</script>
</span>
%endif
</td>
</tr>
%endif
%endfor
Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
r320
version bump to 0.8...
r362
<tr id="add_perm_input">
<td>${h.radio('perm_new_user','repository.none')}</td>
<td>${h.radio('perm_new_user','repository.read')}</td>
<td>${h.radio('perm_new_user','repository.write')}</td>
<td>${h.radio('perm_new_user','repository.admin')}</td>
<td class='ac'>
<div class="perm_ac" id="perm_ac">
${h.text('perm_new_user_name',class_='yui-ac-input')}
<div id="perm_container"></div>
</div>
</td>
<td></td>
</tr>
<tr>
<td colspan="6">
<span id="add_perm" class="add_icon" style="cursor: pointer;">
${_('Add another user')}
</span>
</td>
</tr>
</table>
</div>
<div class="buttons">
${h.submit('update','update',class_="ui-button ui-widget ui-state-default ui-corner-all")}
</div>
</div>
</div>
${h.end_form()}
Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
r320 <script type="text/javascript">
version bump to 0.8...
r362 YAHOO.util.Event.onDOMReady(function(){
var D = YAHOO.util.Dom;
fixed some html and styles, added owner into admin repo list...
r366 if(!D.hasClass('perm_new_user_name','error')){
D.setStyle('add_perm_input','display','none');
}
version bump to 0.8...
r362 YAHOO.util.Event.addListener('add_perm','click',function(){
D.setStyle('add_perm_input','display','');
D.setStyle('add_perm','opacity','0.6');
D.setStyle('add_perm','cursor','default');
});
Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
r320 });
</script>
version bump to 0.8...
r362 <script type="text/javascript">
YAHOO.example.FnMultipleFields = function(){
var myContacts = ${c.users_array|n}
// Define a custom search function for the DataSource
var matchNames = function(sQuery) {
// Case insensitive matching
var query = sQuery.toLowerCase(),
contact,
i=0,
l=myContacts.length,
matches = [];
// Match against each name of each contact
for(; i<l; i++) {
contact = myContacts[i];
if((contact.fname.toLowerCase().indexOf(query) > -1) ||
(contact.lname.toLowerCase().indexOf(query) > -1) ||
(contact.nname && (contact.nname.toLowerCase().indexOf(query) > -1))) {
matches[matches.length] = contact;
}
}
return matches;
};
// Use a FunctionDataSource
var oDS = new YAHOO.util.FunctionDataSource(matchNames);
oDS.responseSchema = {
fields: ["id", "fname", "lname", "nname"]
}
// Instantiate AutoComplete for perms
var oAC_perms = new YAHOO.widget.AutoComplete("perm_new_user_name", "perm_container", oDS);
oAC_perms.useShadow = false;
oAC_perms.resultTypeList = false;
// Instantiate AutoComplete for owner
var oAC_owner = new YAHOO.widget.AutoComplete("user", "owner_container", oDS);
oAC_owner.useShadow = false;
oAC_owner.resultTypeList = false;
// Custom formatter to highlight the matching letters
var custom_formatter = function(oResultData, sQuery, sResultMatch) {
var query = sQuery.toLowerCase(),
fname = oResultData.fname,
lname = oResultData.lname,
nname = oResultData.nname || "", // Guard against null value
query = sQuery.toLowerCase(),
fnameMatchIndex = fname.toLowerCase().indexOf(query),
lnameMatchIndex = lname.toLowerCase().indexOf(query),
nnameMatchIndex = nname.toLowerCase().indexOf(query),
displayfname, displaylname, displaynname;
if(fnameMatchIndex > -1) {
displayfname = highlightMatch(fname, query, fnameMatchIndex);
}
else {
displayfname = fname;
}
if(lnameMatchIndex > -1) {
displaylname = highlightMatch(lname, query, lnameMatchIndex);
}
else {
displaylname = lname;
}
if(nnameMatchIndex > -1) {
displaynname = "(" + highlightMatch(nname, query, nnameMatchIndex) + ")";
}
else {
displaynname = nname ? "(" + nname + ")" : "";
}
return displayfname + " " + displaylname + " " + displaynname;
};
oAC_perms.formatResult = custom_formatter;
oAC_owner.formatResult = custom_formatter;
// Helper function for the formatter
var highlightMatch = function(full, snippet, matchindex) {
return full.substring(0, matchindex) +
"<span class='match'>" +
full.substr(matchindex, snippet.length) +
"</span>" +
full.substring(matchindex + snippet.length);
};
var myHandler = function(sType, aArgs) {
var myAC = aArgs[0]; // reference back to the AC instance
var elLI = aArgs[1]; // reference to the selected LI element
var oData = aArgs[2]; // object literal of selected item's result data
myAC.getInputEl().value = oData.nname;
};
Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
r320
version bump to 0.8...
r362 oAC_perms.itemSelectEvent.subscribe(myHandler);
//oAC_owner.itemSelectEvent.subscribe(myHandler);
return {
oDS: oDS,
oAC_perms: oAC_perms,
oAC_owner: oAC_owner,
};
}();
</script>
</div>
</%def>