Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix errors in FilesList action naming.
Browse files Browse the repository at this point in the history
userExists function: make sure to translate to integer the SQL result, can create problems with sqlite.
  • Loading branch information
cdujeu committed Oct 16, 2014
1 parent 88a323d commit c8523bf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion core/src/plugins/auth.sql/class.sqlAuthDriver.php
Expand Up @@ -147,7 +147,7 @@ public function listUsers($baseGroup="/")
public function userExists($login)
{
$res = dibi::query("SELECT COUNT(*) FROM [ajxp_users] WHERE [login]=%s", $login);
return ($res->fetchSingle() > 0);
return (intval($res->fetchSingle()) > 0);
}

public function checkPassword($login, $pass, $seed)
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/gui.ajax/res/js/ajaxplorer.js

Large diffs are not rendered by default.

38 changes: 20 additions & 18 deletions core/src/plugins/gui.ajax/res/js/ajaxplorer/class.FilesList.js
Expand Up @@ -465,8 +465,10 @@ Class.create("FilesList", SelectableElements, {
getActions : function(){
// function may be bound to another context
var oThis = this;
var oThisId = this.htmlElement.id;

var options1 = {
name:'multi_display',
name:oThisId+'-multi_display',
src:'view_icon.png',
icon_class:'icon-th-large',
text_id:150,
Expand Down Expand Up @@ -507,7 +509,7 @@ Class.create("FilesList", SelectableElements, {
selection:false,
dir:true,
actionBar:true,
actionBarGroup:oThis.htmlElement.id+'-actions',
actionBarGroup:oThisId+'-actions',
contextMenu:false,
infoPanel:false
};
Expand All @@ -522,7 +524,7 @@ Class.create("FilesList", SelectableElements, {
var multiAction = new Action(options1, context1, {}, {}, subMenuItems1);

var options2 = {
name:'thumb_size',
name:oThisId+'-thumb_size',
src:'view_icon.png',
icon_class:'icon-resize-full',
text_id:452,
Expand All @@ -539,12 +541,12 @@ Class.create("FilesList", SelectableElements, {
init:function(){
var actBar = window.ajaxplorer.actionBar;
oThis.observe('switch-display-mode', function(e){
if(oThis._displayMode != 'thumb') actBar.getActionByName("thumb_size").disable();
else actBar.getActionByName("thumb_size").enable();
if(oThis._displayMode != 'thumb') actBar.getActionByName(oThisId+'-thumb_size').disable();
else actBar.getActionByName(oThisId+'-thumb_size').enable();
});
window.setTimeout(function(){
if(oThis._displayMode != 'thumb') actBar.getActionByName("thumb_size").disable();
else actBar.getActionByName("thumb_size").enable();
if(oThis._displayMode != 'thumb') actBar.getActionByName(oThisId+'-thumb_size').disable();
else actBar.getActionByName(oThisId+'-thumb_size').enable();
}.bind(window.listenerContext), 800);
}
}
Expand All @@ -553,15 +555,15 @@ Class.create("FilesList", SelectableElements, {
selection:false,
dir:true,
actionBar:true,
actionBarGroup:oThis.htmlElement.id+'-actions',
actionBarGroup:oThisId+'-actions',
contextMenu:false,
infoPanel:false
};
// Create an action from these options!
var thumbsizeAction = new Action(options2, context2, {}, {});

var options3 = {
name:'thumbs_sortby',
name:oThisId+'-thumbs_sortby',
src:'view_icon.png',
icon_class:'icon-sort',
text_id:450,
Expand All @@ -578,12 +580,12 @@ Class.create("FilesList", SelectableElements, {
init:function(){
var actBar = window.ajaxplorer.actionBar;
oThis.observe('switch-display-mode', function(e){
if(oThis._displayMode == 'list') actBar.getActionByName(oThis.htmlElement.id+'-thumbs_sortby').disable();
else actBar.getActionByName("thumbs_sortby").enable();
if(oThis._displayMode == 'list') actBar.getActionByName(oThisId+'-thumbs_sortby').disable();
else actBar.getActionByName(oThisId+'-thumbs_sortby').enable();
});
window.setTimeout(function(){
if(oThis._displayMode == 'list') actBar.getActionByName(oThis.htmlElement.id+'-thumbs_sortby').disable();
else actBar.getActionByName("thumbs_sortby").enable();
if(oThis._displayMode == 'list') actBar.getActionByName(oThisId+'-thumbs_sortby').disable();
else actBar.getActionByName(oThisId+'-thumbs_sortby').enable();
}.bind(window.listenerContext), 800);
}
}
Expand All @@ -592,7 +594,7 @@ Class.create("FilesList", SelectableElements, {
selection:false,
dir:true,
actionBar:true,
actionBarGroup:oThis.htmlElement.id+'-actions',
actionBarGroup:oThisId+'-actions',
contextMenu:false,
infoPanel:false
};
Expand Down Expand Up @@ -626,9 +628,9 @@ Class.create("FilesList", SelectableElements, {
var thumbSortAction = new Action(options3, context3, {}, {}, submenuItems3);

var butts = $H();
butts.set(this.htmlElement.id+'-thumb_size', thumbsizeAction);
butts.set(this.htmlElement.id+'-thumb_sort', thumbSortAction);
butts.set(this.htmlElement.id+'-multi_display', multiAction);
butts.set(oThisId+'-thumb_size', thumbsizeAction);
butts.set(oThisId+'-thumb_sort', thumbSortAction);
butts.set(oThisId+'-multi_display', multiAction);
return butts;
},

Expand Down Expand Up @@ -2663,7 +2665,7 @@ Class.create("FilesList", SelectableElements, {
getItems: function () {
if(this._displayMode == "list")
{
return this._htmlElement.rows;
return this._htmlElement.rows || [];
}
else
{
Expand Down

0 comments on commit c8523bf

Please sign in to comment.