2 define( [
'remoto!stdlib:js/panes/pane.js',
3 'remoto!stdlib:js/widgets/widgetFactory.js',
5 'remoto!stdlib:js/include/objectRegistry.js',
6 'remoto!stdlib:js/include/preferences.js',
7 'remoto!stdlib:js/include/utils.js',
8 'remoto!stdlib:js/panes/panes/listing.css',
35 pane.call(
this, layout);
39 this._saveFields = {};
41 if (
"showLabels" in layout)
42 this._saveFields.showLabels =
"_showLabels";
46 this._showLabels = (
"showLabels" in layout) ? layout.showLabels :
true;
48 this._type =
"listing";
62 if (this._html)
return this._html;
66 this._formJq = $(
"<div class='listing'>").appendTo(this._content);
68 this._content.parent().css(
"background",
"var(--BG2)");
102 var k = Object.keys(diff);
103 k.sort(
function(a,b) {
104 var aa = diff[a].index || 0;
105 var bb = diff[b].index || 0;
106 if (aa > bb)
return 1;
107 if (aa < bb)
return -1;
113 for (var i=0;i<k.length;i++)
118 if (e in this._entries)
123 m = this._entries[e];
124 delete this._entries[e];
126 this._formJq.find(
"[buttonID="+e+
"]" ).remove();
130 console.warn(
"Update listing here!");
131 console.warn(
"Need to update button properties here!");
141 var b = m.createHTML().find(
"button");
142 b.find(
"img").removeAttr(
"height");
143 b.attr(
"buttonID",e);
145 this._entries[e] = m;
146 this._formJq.append( b );
152 throw "Bad Widget: "+e;
192 var e = this._entries[id2];
200 else console.warn(
"Received metadata for "+
id+
" that doesn't include an icon...");
206 if (e._options.metadata.action)
210 { console.warn(
"Received metadata for unknown path: "+
id+
" "+id2);
211 console.log(this._entries);
230 if (typeof(entry) ==
"boolean")
243 e.metadata = e.metadata || {};
248 if (!e.metadata.action)
254 value: e.value || e.name,
258 showLabel: this._showLabels,
259 icon: e.metadata.icon,
260 colorchip: e.metadata.colorchip,
291 var context =
metadata.context || {};
295 context.sourcefile =
value;
296 context.sourcepath = this._path;
315 case "openModal":
metadata.where =
"modal";
324 case "openModalForm":
metadata.where =
"modalForm";
326 this._formJq.trigger(
"openApplicationLayout", [
null,
metadata.action,
metadata ] );
329 default: console.error(
"Unknown listing action.type: "+
metadata.action.type);
345 var options =
metadata.action.options;
350 console.warn(
"listing.openFile is defunct until choosePath (and remoto!... are sorted");
353 var w =
choosePath.
getModal(options.what,
this._path+
"/"+
path+
metadata.action.base, options.allowed, options.sourceOrDestination, options.header );
355 modal.exec( w,{ accept: (
function(p) {
377 var context =
metadata.context || {};
381 context.sourcepath =
path;
385 if (
metadata.template[ layoutName ])
386 this._formJq.trigger(
"openApplicationLayout", [ context,
metadata.template[ layoutName ],
metadata ] );
388 { modal.alert(
"Cannot open missing template: "+layoutName );
403 for (var b in this._entries)
404 this._entries[b].destroy();
406 this._entries =
null;
Open a modal to select a path from the VFS.
getModal(selectWhat, previousPath, baseDirectory, allowedTypes, sourceOrDestination, header)
setter value
a setter DOCME
getter id
returns the number of milliseconds since midnight January 1, 1970 UTC
openLayout(layoutName, path, metadata)
applyMetadata(id, metadata)
clickMenuButton(variable, value, button)
createMenuButton(path, entry)
setter name
a setter DOCME
setter type
a setter DOCME
metadataPath(id, o)
Request metadata for a given path.
Create a pane which will be mounted into a paneManager layout.
getter path
a getter DOCME
Utility functions for javascript clients.
cleanPath(path)
Clean and normalize a resource path.
fileNameFromPath(p, orDirIfNeeded)
Retrieve the last part of a file path.
copyObject(source, dest)
Create a deep copy of a JSON object, extending the destination object recursively.
resolveContextValues(o, ctx)
Recursively resolve any context values in an object.