Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update plugin #3

Merged
merged 1 commit into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// path on domain where a symlink to share.php can be found
// example: http://mydomain.com/share.php
$downloadpath = '//'.$_SERVER['HTTP_HOST'].'/plugins/filemanager-share/share.php';
$downloadpath = '//'.$_SERVER['HTTP_HOST'].'/rutorrent/plugins/filemanager-share/share.php';


return ['limits' => $limits,
Expand Down
68 changes: 20 additions & 48 deletions init.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@

plugin.loadCSS('share');


function copyTextToClipboard(text) {
var textArea = $("#flm-share-clipboard");

textArea.show();
textArea.val(text);
textArea.focus();
textArea.select();
var successful = false;
try {
successful = document.execCommand('copy');
} catch (err) {
console.log('Oops, unable to copy');
}

textArea.hide();

return successful;
}

var table = {

addEntries: function(data) {
Expand Down Expand Up @@ -54,13 +34,12 @@ var table = {

if(table.selCount === 1) {
theContextMenu.add([theUILang['flm_popup_fsh-view'], function() {
plugin.showDialog('fsh-view', theWebUI.getTable("fsh").rowdata[id].fmtdata);
plugin.showDialog('fsh-view', table.rowdata[id].fmtdata);

}]);

theContextMenu.add(['Show in File Manager', function() {
var file = theWebUI.getTable("fsh").getValueById(id, 'file');

theContextMenu.add([theUILang['flm_popup_fsh-view-fm'], function() {
var file = table.getValueById(id, 'file');
flm.showPath(flm.utils.basedir(file));
}]);

Expand All @@ -83,9 +62,9 @@ var table = {
} );
}]);
theContextMenu.add([CMENU_SEP]);
theContextMenu.add([theUILang.FScopylink,(table.selCount !== 1) ? null : function() {
var link = theWebUI.getTable("fsh").getValueById('_fsh_'+target, 'link');
copyTextToClipboard(link);
theContextMenu.add([theUILang.FScopylink, (table.selCount !== 1) ? null : function() {
var link = table.getValueById(id, 'link');
copyToClipboard(link);
}]);

theContextMenu.show();
Expand Down Expand Up @@ -119,10 +98,11 @@ var table = {
updateColumnNames: function() {
var table = theWebUI.getTable("fsh");

table.renameColumnById('file',theUILang.FSfile);
table.renameColumnById('downloads',theUILang.FSdnumb);
table.renameColumnById('created',theUILang.FScreated);
table.renameColumnById('time',theUILang.FSexpire);
table.renameColumnById('name',theUILang.FSfile);
table.renameColumnById('link',theUILang.FSdlink);

}
};

Expand All @@ -134,10 +114,10 @@ table.create = function () {
columns:
[
{ text: '', width: "210px", id: "file", type: TYPE_STRING },
{ text: 'Downloads', width: "65px", id: "downloads", type: TYPE_NUMBER },
{ text: theUILang.Size, width: "60px", id: "size", type: TYPE_NUMBER },
{ text: 'Created', width: "120px", id: "created", type: TYPE_DATE, "align" : ALIGN_CENTER},
{ text: '', width: "120px", id: "time", type: TYPE_STRING, "align" : ALIGN_CENTER},
{ text: '', width: "65px", id: "downloads", type: TYPE_NUMBER },
{ text: theUILang.Size, width: "60px", id: "size", type: TYPE_NUMBER },
{ text: '', width: "120px", id: "created", type: TYPE_DATE, "align" : ALIGN_CENTER},
{ text: '', width: "120px", id: "time", type: TYPE_STRING, "align" : ALIGN_CENTER},
{ text: '', width: "310px", id: "link", type: TYPE_STRING }
],
container: "FileShare",
Expand All @@ -152,9 +132,6 @@ var share = {

api: null,

downlink: '',
clip: {},

add: function (file, pass, duration) {

var allownolimit = parseFloat(plugin.config.nolimit);
Expand Down Expand Up @@ -240,7 +217,7 @@ var share = {

};

plugin.setFileManagerMenuEntries = function (menu, path) {
plugin.setFileManagerMenuEntries = function(menu, path) {

var pathIsDir = flm.utils.isDir(path);

Expand All @@ -262,8 +239,8 @@ plugin.setFileManagerMenuEntries = function (menu, path) {

};

plugin.showDialog = function(what, templateData)
{
plugin.showDialog = function(what, templateData) {

var dialogs = flm.ui.getDialogs();
dialogs.forms[what].options= {
// public_endpoint: plugin.config.public_endpoint,
Expand Down Expand Up @@ -301,8 +278,7 @@ plugin.setUI = function(flmUi) {

window.flm.ui.browser.onSetEntryMenu(plugin.setFileManagerMenuEntries);


flm.views.getView(viewsPath + '/' +'table-header',{apiUrl: flm.api.endpoint},
flm.views.getView(viewsPath + 'table-header',{apiUrl: flm.api.endpoint},
function (view) {

$('#FileShare').prepend(view);
Expand All @@ -315,18 +291,14 @@ plugin.setUI = function(flmUi) {

}
);

plugin.renameTab("FileShare",theUILang.FSshow);
table.updateColumnNames()
table.updateColumnNames();
};



plugin.flmConfig = theWebUI.config;
theWebUI.config = function(data) {

table.create();
plugin.flmConfig.call(this,data);
table.create();
plugin.flmConfig.call(this,data);
};

plugin.onShow = theTabs.onShow;
Expand Down
5 changes: 5 additions & 0 deletions lang/cs.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
theUILang['flm_popup_flm-create-share'] = 'Create file share link';
theUILang['flm_popup_fsh-view'] = 'View details';
theUILang['flm_popup_fsh-view-fm'] = 'Show in File Manager';

theUILang.FSshow = 'File Share';
theUILang.FSaddnew = 'New share';
theUILang.FSdel = 'Delete link(s)';
theUILang.FSdelmsg = 'Do you really want to delete the selected items?';
theUILang.FSvdur = 'Please enter a valid duration';
theUILang.FSfile = 'File';
theUILang.FSexpire = 'Expire';
theUILang.FSpassword = 'Password';
theUILang.FScreated = 'Creation date';
theUILang.FSdlink = 'Download link';
theUILang.FSdnumb = 'Number of downloads';
theUILang.FSdhours = 'Duration (hours)';
theUILang.FSadd = 'Add';
theUILang.FSedit = 'Edit';
Expand All @@ -19,4 +23,5 @@ theUILang.FScopylink = 'Copy link';
theUILang.FSmaxdur = 'Maximum allowed duration is:';
theUILang.FSnolimit = '[No limit is allowed: 0]';
theUILang.FSnolimitoff = 'No limit is not allowed';

thePlugins.get("filemanager-share").langLoaded();
5 changes: 5 additions & 0 deletions lang/da.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
theUILang['flm_popup_flm-create-share'] = 'Create file share link';
theUILang['flm_popup_fsh-view'] = 'View details';
theUILang['flm_popup_fsh-view-fm'] = 'Show in File Manager';

theUILang.FSshow = 'File Share';
theUILang.FSaddnew = 'New share';
theUILang.FSdel = 'Delete link(s)';
theUILang.FSdelmsg = 'Do you really want to delete the selected items?';
theUILang.FSvdur = 'Please enter a valid duration';
theUILang.FSfile = 'File';
theUILang.FSexpire = 'Expire';
theUILang.FSpassword = 'Password';
theUILang.FScreated = 'Creation date';
theUILang.FSdlink = 'Download link';
theUILang.FSdnumb = 'Number of downloads';
theUILang.FSdhours = 'Duration (hours)';
theUILang.FSadd = 'Add';
theUILang.FSedit = 'Edit';
Expand All @@ -19,4 +23,5 @@ theUILang.FScopylink = 'Copy link';
theUILang.FSmaxdur = 'Maximum allowed duration is:';
theUILang.FSnolimit = '[No limit is allowed: 0]';
theUILang.FSnolimitoff = 'No limit is not allowed';

thePlugins.get("filemanager-share").langLoaded();
5 changes: 5 additions & 0 deletions lang/de.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
theUILang['flm_popup_flm-create-share'] = 'Create file share link';
theUILang['flm_popup_fsh-view'] = 'View details';
theUILang['flm_popup_fsh-view-fm'] = 'Show in File Manager';

theUILang.FSshow = 'File Share';
theUILang.FSaddnew = 'New share';
theUILang.FSdel = 'Delete link(s)';
theUILang.FSdelmsg = 'Do you really want to delete the selected items?';
theUILang.FSvdur = 'Please enter a valid duration';
theUILang.FSfile = 'File';
theUILang.FSexpire = 'Expire';
theUILang.FSpassword = 'Password';
theUILang.FScreated = 'Creation date';
theUILang.FSdlink = 'Download link';
theUILang.FSdnumb = 'Number of downloads';
theUILang.FSdhours = 'Duration (hours)';
theUILang.FSadd = 'Add';
theUILang.FSedit = 'Edit';
Expand All @@ -19,4 +23,5 @@ theUILang.FScopylink = 'Copy link';
theUILang.FSmaxdur = 'Maximum allowed duration is:';
theUILang.FSnolimit = '[No limit is allowed: 0]';
theUILang.FSnolimitoff = 'No limit is not allowed';

thePlugins.get("filemanager-share").langLoaded();
5 changes: 5 additions & 0 deletions lang/el.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
theUILang['flm_popup_flm-create-share'] = 'Create file share link';
theUILang['flm_popup_fsh-view'] = 'View details';
theUILang['flm_popup_fsh-view-fm'] = 'Show in File Manager';

theUILang.FSshow = 'File Share';
theUILang.FSaddnew = 'New share';
theUILang.FSdel = 'Delete link(s)';
theUILang.FSdelmsg = 'Do you really want to delete the selected items?';
theUILang.FSvdur = 'Please enter a valid duration';
theUILang.FSfile = 'File';
theUILang.FSexpire = 'Expire';
theUILang.FSpassword = 'Password';
theUILang.FScreated = 'Creation date';
theUILang.FSdlink = 'Download link';
theUILang.FSdnumb = 'Number of downloads';
theUILang.FSdhours = 'Duration (hours)';
theUILang.FSadd = 'Add';
theUILang.FSedit = 'Edit';
Expand All @@ -19,4 +23,5 @@ theUILang.FScopylink = 'Copy link';
theUILang.FSmaxdur = 'Maximum allowed duration is:';
theUILang.FSnolimit = '[No limit is allowed: 0]';
theUILang.FSnolimitoff = 'No limit is not allowed';

thePlugins.get("filemanager-share").langLoaded();
4 changes: 4 additions & 0 deletions lang/en.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
theUILang['flm_popup_flm-create-share'] = 'Create file share link';
theUILang['flm_popup_fsh-view'] = 'View details';
theUILang['flm_popup_fsh-view-fm'] = 'Show in File Manager';

theUILang.FSshow = 'File Share';
theUILang.FSaddnew = 'New share';
theUILang.FSdel = 'Delete link(s)';
theUILang.FSdelmsg = 'Do you really want to delete the selected items?';
theUILang.FSvdur = 'Please enter a valid duration';
theUILang.FSfile = 'File';
theUILang.FSexpire = 'Expire';
theUILang.FSpassword = 'Password';
theUILang.FScreated = 'Creation date';
theUILang.FSdlink = 'Download link';
theUILang.FSdnumb = 'Number of downloads';
theUILang.FSdhours = 'Duration (hours)';
theUILang.FSadd = 'Add';
theUILang.FSedit = 'Edit';
Expand Down
5 changes: 5 additions & 0 deletions lang/es.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
theUILang['flm_popup_flm-create-share'] = 'Create file share link';
theUILang['flm_popup_fsh-view'] = 'View details';
theUILang['flm_popup_fsh-view-fm'] = 'Show in File Manager';

theUILang.FSshow = 'File Share';
theUILang.FSaddnew = 'New share';
theUILang.FSdel = 'Delete link(s)';
theUILang.FSdelmsg = 'Do you really want to delete the selected items?';
theUILang.FSvdur = 'Please enter a valid duration';
theUILang.FSfile = 'File';
theUILang.FSexpire = 'Expire';
theUILang.FSpassword = 'Password';
theUILang.FScreated = 'Creation date';
theUILang.FSdlink = 'Download link';
theUILang.FSdnumb = 'Number of downloads';
theUILang.FSdhours = 'Duration (hours)';
theUILang.FSadd = 'Add';
theUILang.FSedit = 'Edit';
Expand All @@ -19,4 +23,5 @@ theUILang.FScopylink = 'Copy link';
theUILang.FSmaxdur = 'Maximum allowed duration is:';
theUILang.FSnolimit = '[No limit is allowed: 0]';
theUILang.FSnolimitoff = 'No limit is not allowed';

thePlugins.get("filemanager-share").langLoaded();
5 changes: 5 additions & 0 deletions lang/fi.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
theUILang['flm_popup_flm-create-share'] = 'Create file share link';
theUILang['flm_popup_fsh-view'] = 'View details';
theUILang['flm_popup_fsh-view-fm'] = 'Show in File Manager';

theUILang.FSshow = 'File Share';
theUILang.FSaddnew = 'New share';
theUILang.FSdel = 'Delete link(s)';
theUILang.FSdelmsg = 'Do you really want to delete the selected items?';
theUILang.FSvdur = 'Please enter a valid duration';
theUILang.FSfile = 'File';
theUILang.FSexpire = 'Expire';
theUILang.FSpassword = 'Password';
theUILang.FScreated = 'Creation date';
theUILang.FSdlink = 'Download link';
theUILang.FSdnumb = 'Number of downloads';
theUILang.FSdhours = 'Duration (hours)';
theUILang.FSadd = 'Add';
theUILang.FSedit = 'Edit';
Expand All @@ -19,4 +23,5 @@ theUILang.FScopylink = 'Copy link';
theUILang.FSmaxdur = 'Maximum allowed duration is:';
theUILang.FSnolimit = '[No limit is allowed: 0]';
theUILang.FSnolimitoff = 'No limit is not allowed';

thePlugins.get("filemanager-share").langLoaded();
21 changes: 13 additions & 8 deletions lang/fr.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
theUILang['flm_popup_flm-create-share'] = 'Create file share link';
theUILang['flm_popup_fsh-view'] = 'View details';
theUILang['flm_popup_flm-create-share'] = 'Créer un lien de partage';
theUILang['flm_popup_fsh-view'] = 'Voir les détails';
theUILang['flm_popup_fsh-view-fm'] = 'Voir dans le Gestionnaire de fichiers';

theUILang.FSshow = 'File Share';
theUILang.FSshow = 'Partage de fichiers';
theUILang.FSaddnew = 'Nouveau partage';
theUILang.FSdel = 'Supprimer le(s) liens(s)';
theUILang.FSdelmsg = 'Voulez-vous réellement supprimer ces éléments ?';
theUILang.FSvdur = 'Veuillez entrer une durée valide';
theUILang.FSfile = 'Fichier ';
theUILang.FSexpire = 'Expire';
theUILang.FSpassword = 'Mot de passe ';
theUILang.FSfile = 'Fichier';
theUILang.FSexpire = 'Date d\'expiration';
theUILang.FSpassword = 'Mot de passe';
theUILang.FScreated = 'Date de création';
theUILang.FSdlink = 'Lien de téléchargement';
theUILang.FSdhours = 'Durée (heure) ';
theUILang.FSdnumb = 'Nombre de téléchargements';
theUILang.FSdhours = 'Durée (heure)';
theUILang.FSadd = 'Ajouter';
theUILang.FSedit = 'Éditer';
theUILang.FSshare = 'Partager...';
theUILang.FSshare = 'Créer un lien de partage';
theUILang.FSlinkcreate = 'Lien de téléchargement créé';
theUILang.FSlinkedit = 'Lien de téléchargement édité';
theUILang.FScopylink = 'Copier le lien';
theUILang.FSmaxdur = 'Durée maxi autorisée est :';
theUILang.FSnolimit = '[Pas de limite est autorisée : 0]';
theUILang.FSnolimitoff = 'Durée illimitée n\'est pas autorisée';

thePlugins.get("filemanager-share").langLoaded();
5 changes: 5 additions & 0 deletions lang/hu.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
theUILang['flm_popup_flm-create-share'] = 'Create file share link';
theUILang['flm_popup_fsh-view'] = 'View details';
theUILang['flm_popup_fsh-view-fm'] = 'Show in File Manager';

theUILang.FSshow = 'File Share';
theUILang.FSaddnew = 'New share';
theUILang.FSdel = 'Delete link(s)';
theUILang.FSdelmsg = 'Do you really want to delete the selected items?';
theUILang.FSvdur = 'Please enter a valid duration';
theUILang.FSfile = 'File';
theUILang.FSexpire = 'Expire';
theUILang.FSpassword = 'Password';
theUILang.FScreated = 'Creation date';
theUILang.FSdlink = 'Download link';
theUILang.FSdnumb = 'Number of downloads';
theUILang.FSdhours = 'Duration (hours)';
theUILang.FSadd = 'Add';
theUILang.FSedit = 'Edit';
Expand All @@ -19,4 +23,5 @@ theUILang.FScopylink = 'Copy link';
theUILang.FSmaxdur = 'Maximum allowed duration is:';
theUILang.FSnolimit = '[No limit is allowed: 0]';
theUILang.FSnolimitoff = 'No limit is not allowed';

thePlugins.get("filemanager-share").langLoaded();
Loading