svn: /web/doc-editor/trunk/ js/ui/cmp/WorkTreeGrid.js php/RepositoryManager.php
[email protected] (Yannick Torres)
| Newsgroups | php.doc.web |
|---|---|
| Message-ID | <[email protected]> |
yannick Thu, 30 Dec 2010 22:11:51 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=306884
Log:
New option for global or lang admin : delete a change
Changed paths:
U web/doc-editor/trunk/js/ui/cmp/WorkTreeGrid.js
U web/doc-editor/trunk/php/RepositoryManager.php
Modified: web/doc-editor/trunk/js/ui/cmp/WorkTreeGrid.js
===================================================================
--- web/doc-editor/trunk/js/ui/cmp/WorkTreeGrid.js 2010-12-30 22:09:31 UTC (rev 306883)
+++ web/doc-editor/trunk/js/ui/cmp/WorkTreeGrid.js 2010-12-30 22:11:51 UTC (rev 306884)
@@ -18,7 +18,7 @@
};
Ext.extend(ui.cmp._WorkTreeGrid.menu.admin, Ext.menu.Item, {
init: function(){
-
+
Ext.apply(this, {
text: _('Administrator menu'),
iconCls: 'iconAdmin',
@@ -41,6 +41,18 @@
currentOwner: this.userNode.attributes.task
});
}
+ },{
+ scope: this,
+ iconCls: 'iconPageDelete',
+ text: ((this.node.attributes.type == 'delete') ? _('Cancel this deletion') : _('Clear this change')),
+ handler: function()
+ {
+ new ui.task.ClearLocalChangeTask({
+ ftype: this.node.attributes.type,
+ fpath: this.folderNode.attributes.task,
+ fname: this.node.attributes.task
+ });
+ }
}]
})
});
@@ -58,7 +70,7 @@
};
Ext.extend(ui.cmp._WorkTreeGrid.menu.commit, Ext.menu.Item, {
init: function(){
-
+
Ext.apply(this, {
text: _('Commit...'),
iconCls: 'iconCommitFileVcs',
@@ -476,12 +488,13 @@
}
}, {
xtype: 'menuseparator',
- hidden: (FileType == 'delete' || FileType == 'new' || (owner !== PhDOE.user.login && !PhDOE.user.isGlobalAdmin) )
+ hidden: owner !== PhDOE.user.login
}, {
text: ((FileType == 'delete') ? _('Cancel this deletion') : _('Clear this change')),
iconCls: 'iconPageDelete',
- hidden: (owner !== PhDOE.user.login && !PhDOE.user.isGlobalAdmin ),
+ hidden: owner !== PhDOE.user.login,
handler: function(){
+
new ui.task.ClearLocalChangeTask({
ftype: FileType,
fpath: FilePath,
Modified: web/doc-editor/trunk/php/RepositoryManager.php
===================================================================
--- web/doc-editor/trunk/php/RepositoryManager.php 2010-12-30 22:09:31 UTC (rev 306883)
+++ web/doc-editor/trunk/php/RepositoryManager.php 2010-12-30 22:11:51 UTC (rev 306884)
@@ -1200,18 +1200,20 @@
$r = $db->query($s);
if( $r->num_rows == 0 ) {
-
+
return 'file_localchange_didnt_exist';
} else {
-
- // Rules to allow clearLocalChange or not.
$a = $r->fetch_object();
- if( $a->user != $am->vcsLogin && $a->anonymousIdent != $am->anonymousIdent ) {
- // This file isn't own by the current user
- if( ! $am->isAdmin() ) {
- return 'file_isnt_owned_by_current_user';
- }
+
+ // Rules to allow clearLocalChange or not.
+ // Either the user who made the modification, either a global admin for this project, either a lang admin
+ if( $a->user != $am->vcsLogin || ( $am->isAnonymous && ($a->anonymousIdent != $am->anonymousIdent) ) ) {
+ // This file isn't own by the current user
+ // Is the current user is a global admin or a lang admin ?
+ if( ! $am->isAdmin(true) ) {
+ return 'file_isnt_owned_by_current_user';
+ }
}
}