From: <die...@us...> - 2010-05-24 11:57:25
|
Revision: 2539 http://openutils.svn.sourceforge.net/openutils/?rev=2539&view=rev Author: diego_schivo Date: 2010-05-24 11:57:19 +0000 (Mon, 24 May 2010) Log Message: ----------- MEDIA-144 insert media's title and description directly from their own playlist. Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/playlist/pages/PlaylistView.java trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/playlist-view.js Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/playlist/pages/PlaylistView.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/playlist/pages/PlaylistView.java 2010-05-24 10:53:06 UTC (rev 2538) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/playlist/pages/PlaylistView.java 2010-05-24 11:57:19 UTC (rev 2539) @@ -65,6 +65,8 @@ private String description; + private String mediaHandle; + private boolean success; private static final String VIEW_RESULTS_XML = "-xml"; @@ -120,6 +122,24 @@ } /** + * Returns the mediaHandle. + * @return the mediaHandle + */ + public String getMediaHandle() + { + return mediaHandle; + } + + /** + * Sets the mediaHandle. + * @param mediaHandle the mediaHandle to set + */ + public void setMediaHandle(String mediaHandle) + { + this.mediaHandle = mediaHandle; + } + + /** * Returns the success. * @return the success */ @@ -213,6 +233,30 @@ return VIEW_EXTJS; } + public String saveMedia() + { + success = false; + Content node = ContentUtil.getContent(MediaModule.REPO, mediaHandle); + if (node != null) + { + try + { + NodeDataUtil.getOrCreateAndSet(node, "title", title); + NodeDataUtil.getOrCreateAndSet(node, "description", description); + if (MediaEl.module().isSingleinstance()) + { + node.getMetaData().setActivated(); + } + node.save(); + success = true; + } + catch (RepositoryException e) + { + } + } + return VIEW_EXTJS; + } + public String xmlView() throws IOException { this.show(); Modified: trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/playlist-view.js =================================================================== --- trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/playlist-view.js 2010-05-24 10:53:06 UTC (rev 2538) +++ trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/playlist-view.js 2010-05-24 11:57:19 UTC (rev 2539) @@ -150,6 +150,60 @@ } }); + var mediaForm = new Ext.FormPanel({ + items: { + xtype: 'fieldset', + labelWidth: 90, + title: 'Selected media details', + defaults: {width: 140}, + defaultType: 'textfield', + autoHeight: true, + bodyStyle: Ext.isIE ? 'padding:0 0 5px 15px;' : 'padding:10px 15px;', + border: false, + style: { + "margin-left": "10px", + "margin-right": Ext.isIE6 ? (Ext.isStrict ? "-10px" : "-13px") : "0" + }, + items: [{ + xtype: 'hidden', + name: 'command', + value: 'saveMedia' + }, { + xtype: 'hidden', + name: 'mgnlCK', + value: (new Date()).getTime() + }, { + xtype: 'hidden', + name: 'mediaHandle', + }, { + fieldLabel: 'Title', + name: 'title', + anchor: '100% none' + }, { + xtype: 'textarea', + fieldLabel: 'Description', + name: 'description', + anchor: '100% none' + }], + buttons: [{ + text: 'Save', + handler: function(){ + if(mediaForm.getForm().isValid()){ + mediaForm.getForm().submit({ + url: contextPath + '/.magnolia/pages/playlistView.html', + success: function(){ + Ext.Msg.alert('Success', 'Media successfully saved'); + }, + failure: function(){ + Ext.Msg.alert('Failure', 'Can\'t save media'); + } + }); + } + } + }] + } + }); + playlistView = new Ext.Panel({ id: 'playlistView', frame: true, @@ -167,7 +221,14 @@ }, store: dataStore, cm: colModel, - selModel: new Ext.grid.RowSelectionModel(), + selModel: new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function(sm, row, rec) { + mediaForm.getForm().loadRecord(rec); + } + } + }), autoSizeColumns: true, enableColLock: false, tbar: tbar, @@ -176,7 +237,7 @@ } },{ columnWidth: 0.4, - items: [ playlistForm ] + items: [ playlistForm, mediaForm ] }], renderTo: Ext.getBody() }); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |