2012-02-03 09:15:38 +00:00
'use strict' ;
2012-11-01 14:21:44 +00:00
2011-05-25 19:42:45 +00:00
pandora . ui . mainMenu = function ( ) {
2012-03-27 07:14:59 +00:00
var isGuest = pandora . user . level == 'guest' ,
2016-11-27 18:43:28 +00:00
documentViewKey = 1 ,
2015-10-13 08:10:48 +00:00
itemViewKey = 1 ,
2015-10-22 11:22:43 +00:00
listViewKey = 1 ,
2011-09-23 10:44:54 +00:00
ui = pandora . user . ui ,
2011-11-02 02:41:24 +00:00
findState = pandora . getFindState ( ui . find ) ,
2013-08-02 16:03:23 +00:00
fromMenu = false ,
2012-11-01 14:21:44 +00:00
fullscreenState = Ox . Fullscreen . getState ( ) ,
2014-01-19 09:41:38 +00:00
lists = { } ,
2011-06-19 17:49:25 +00:00
that = Ox . MainMenu ( {
2013-08-08 13:02:24 +00:00
extras : pandora . site . menuExtras . map ( function ( menuExtra ) {
2016-09-15 15:20:24 +00:00
if ( menuExtra == 'upload' ) {
return pandora . $ui . uploadButton = pandora . ui . uploadButton ( ) ;
} else if ( menuExtra == 'user' ) {
2013-08-08 13:02:24 +00:00
return pandora . $ui . userButton = pandora . ui . userButton ( ) ;
} else if ( menuExtra == 'locale' ) {
return pandora . $ui . localeButton = pandora . ui . localeButton ( ) ;
} else if ( menuExtra == 'reload' ) {
return pandora . $ui . loadingIcon = pandora . ui . loadingIcon ( ) ;
}
} ) ,
2011-05-25 19:42:45 +00:00
id : 'mainMenu' ,
2012-05-24 08:22:56 +00:00
menus : [ ] . concat (
2011-10-14 19:25:29 +00:00
[
2012-05-24 08:22:56 +00:00
{ id : pandora . site . site . id + 'Menu' , title : pandora . site . site . name , items : [ ] . concat (
2011-10-24 15:58:10 +00:00
[
2013-05-09 10:13:58 +00:00
{ id : 'home' , title : Ox . _ ( 'Home' ) } ,
2011-10-24 15:58:10 +00:00
{ }
] ,
2013-05-09 10:13:58 +00:00
Ox . clone ( pandora . site . sitePages , true ) . map ( function ( page ) {
page . title = Ox . _ ( page . title ) ;
return page ;
} ) ,
2011-10-24 15:58:10 +00:00
[
{ } ,
2013-05-09 10:13:58 +00:00
{ id : 'software' , title : Ox . _ ( 'Software' ) }
2011-10-24 15:58:10 +00:00
]
) } ,
2013-05-09 10:13:58 +00:00
{ id : 'userMenu' , title : Ox . _ ( 'User' ) , items : [
{ id : 'username' , title : Ox . _ ( 'User: {0}' , [ isGuest ? 'not signed in' : Ox . encodeHTMLEntities ( pandora . user . username ) ] ) , disabled : true } ,
2011-09-04 21:15:53 +00:00
{ } ,
2013-05-09 10:13:58 +00:00
{ id : 'preferences' , title : Ox . _ ( 'Preferences...' ) , disabled : isGuest , keyboard : 'control ,' } ,
2016-09-15 15:20:24 +00:00
{ id : 'tasks' , title : Ox . _ ( 'Tasks...' ) , disabled : isGuest } ,
2013-05-09 10:13:58 +00:00
{ id : 'archives' , title : Ox . _ ( 'Archives...' ) , disabled : /*isGuest*/ true } ,
2011-10-14 19:25:29 +00:00
{ } ,
2013-05-09 10:13:58 +00:00
{ id : 'signup' , title : Ox . _ ( 'Sign Up...' ) , disabled : ! isGuest } ,
isGuest ? { id : 'signin' , title : Ox . _ ( 'Sign In...' ) }
: { id : 'signout' , title : Ox . _ ( 'Sign Out...' ) }
2011-10-14 19:25:29 +00:00
] } ,
getListMenu ( ) ,
2013-08-02 16:03:23 +00:00
getItemMenu ( ) ,
2019-12-02 19:09:49 +00:00
getViewMenu ( ) ,
2011-10-14 19:25:29 +00:00
getSortMenu ( ) ,
2014-02-12 12:26:33 +00:00
getFindMenu ( ) ,
2013-05-09 10:13:58 +00:00
{ id : 'dataMenu' , title : Ox . _ ( 'Data' ) , items : [
2017-02-15 17:44:59 +00:00
! Ox . isEmpty ( pandora . site . capabilities . canManageHome )
2017-02-17 18:25:20 +00:00
? [ { id : 'managehome' , title : Ox . _ ( 'Manage Home...' ) , disabled : ! pandora . hasCapability ( 'canManageHome' ) } ] : [ ] ,
2017-02-15 17:44:59 +00:00
pandora . site . entities . length
2017-02-17 18:25:20 +00:00
? [ { id : 'entities' , title : Ox . _ ( 'Manage Entities...' ) , disabled : ! pandora . site . entities . length || ! pandora . hasCapability ( 'canManageEntities' ) } ] : [ ] ,
2017-02-15 17:44:59 +00:00
( ! Ox . isEmpty ( pandora . site . capabilities . canManageHome ) || pandora . site . entities . length )
? [ { } ] : [ ] ,
2017-02-17 18:25:20 +00:00
{ id : 'titles' , title : Ox . _ ( 'Manage Titles...' ) , disabled : ! pandora . hasCapability ( 'canManageTitlesAndNames' ) } ,
{ id : 'names' , title : Ox . _ ( 'Manage Names...' ) , disabled : ! pandora . hasCapability ( 'canManageTitlesAndNames' ) } ,
2018-10-09 18:01:31 +00:00
{ id : 'translations' , title : Ox . _ ( 'Manage Translations...' ) , disabled : ! pandora . hasCapability ( 'canManageTranslations' ) } ,
2011-09-18 00:31:41 +00:00
{ } ,
2019-11-12 17:48:10 +00:00
pandora . hasView ( 'map' )
? [ { id : 'places' , title : Ox . _ ( 'Manage Places...' ) , disabled : ! pandora . hasCapability ( 'canManagePlacesAndEvents' ) } ] : [ ] ,
pandora . hasView ( 'calendar' )
? [ { id : 'events' , title : Ox . _ ( 'Manage Events...' ) , disabled : ! pandora . hasCapability ( 'canManagePlacesAndEvents' ) } ] : [ ] ,
2011-10-14 19:25:29 +00:00
{ } ,
2017-02-17 18:25:20 +00:00
{ id : 'users' , title : Ox . _ ( 'Manage Users...' ) , disabled : ! pandora . hasCapability ( 'canManageUsers' ) } ,
{ id : 'statistics' , title : Ox . _ ( 'Statistics...' ) , disabled : ! pandora . hasCapability ( 'canManageUsers' ) } ,
2014-12-15 21:16:34 +00:00
{ } ,
2017-02-17 18:25:20 +00:00
{ id : 'changelog' , title : Ox . _ ( 'Changelog...' ) , disabled : ! pandora . hasCapability ( 'canManageUsers' ) }
2011-09-17 23:24:53 +00:00
] } ,
2013-05-09 10:13:58 +00:00
{ id : 'helpMenu' , title : Ox . _ ( 'Help' ) , items : [
{ id : 'help' , title : Ox . _ ( 'Help...' ) , keyboard : 'control ?' } ,
2013-07-11 18:02:39 +00:00
{ id : 'api' , title : Ox . _ ( 'API Documentation...' ) , keyboard : 'shift control ?' }
2011-09-09 12:09:05 +00:00
] }
2011-10-14 19:25:29 +00:00
] ,
2017-02-17 18:25:20 +00:00
pandora . hasCapability ( 'canSeeDebugMenu' )
2011-10-14 19:25:29 +00:00
? [
2013-05-09 10:13:58 +00:00
{ id : 'debugMenu' , title : Ox . _ ( 'Debug' ) , items : [
{ id : 'clearcache' , title : Ox . _ ( 'Clear Cache' ) } ,
2012-06-30 11:56:04 +00:00
{ } ,
2013-08-27 14:43:17 +00:00
{ id : 'cache' , title : Ox . _ ( ( pandora . localStorage ( 'enableCache' ) !== false ? 'Disable' : 'Enable' ) + ' Cache' ) } ,
2013-05-09 10:13:58 +00:00
{ id : 'debugmode' , title : Ox . _ ( ( pandora . localStorage ( 'enableDebugMode' ) ? 'Disable' : 'Enable' ) + ' Debug Mode' ) } ,
{ id : 'eventlogging' , title : Ox . _ ( ( pandora . localStorage ( 'enableEventLogging' ) ? 'Disable' : 'Enable' ) + ' Event Logging' ) } ,
2012-06-30 11:56:04 +00:00
{ } ,
2014-12-17 14:39:38 +00:00
{ id : 'tests' , title : Ox . _ ( 'Run Tests' ) } ,
{ id : 'errorlogs' , title : Ox . _ ( 'Error Logs...' ) }
2011-10-14 19:25:29 +00:00
] }
]
: [ ]
)
2011-05-25 19:42:45 +00:00
} )
. bindEvent ( {
2011-09-17 17:40:15 +00:00
change : function ( data ) {
2011-09-18 01:52:43 +00:00
var value = data . checked [ 0 ] ? data . checked [ 0 ] . id : null ;
2011-11-07 12:12:13 +00:00
if ( data . id == 'allitems' ) {
2014-02-12 15:19:18 +00:00
if ( ui . section == 'items' ) {
if ( data . checked ) {
pandora . UI . set ( { find : { conditions : [ ] , operator : '&' } } ) ;
} else {
that . checkItem ( 'allitems' ) ;
}
2016-10-04 22:00:03 +00:00
} else if ( ui . section == 'documents' ) {
if ( data . checked ) {
pandora . UI . set ( {
findDocuments : { conditions : [ ] , operator : '&' }
} ) ;
} else {
that . checkItem ( 'allitems' ) ;
}
2011-11-07 12:12:13 +00:00
} else {
2014-02-12 15:19:18 +00:00
pandora . UI . set ( ui . section . slice ( 0 , - 1 ) , '' ) ;
2011-11-07 12:12:13 +00:00
}
2013-02-11 09:00:16 +00:00
} else if ( data . id == 'cliporder' ) {
if ( ! ui . item ) {
2013-07-15 14:20:11 +00:00
pandora . UI . set ( { listSort : [ { key : ui . listSort [ 0 ] . key , operator : value == 'ascending' ? '+' : '-' } ] } ) ;
2013-02-11 09:00:16 +00:00
} else {
2013-07-15 14:20:11 +00:00
pandora . UI . set ( { itemSort : [ { key : ui . itemSort [ 0 ] . key , operator : value == 'ascending' ? '+' : '-' } ] } ) ;
2013-02-11 09:00:16 +00:00
}
} else if ( data . id == 'clipsort' ) {
if ( ! ui . item ) {
pandora . UI . set ( { listSort : [ { key : value , operator : pandora . getSortOperator ( value ) } ] } ) ;
} else {
pandora . UI . set ( { itemSort : [ { key : value , operator : pandora . getSortOperator ( value ) } ] } ) ;
}
2016-10-04 22:00:03 +00:00
} else if ( data . id == 'documentorder' ) {
pandora . UI . set ( { collectionSort : [ { key : ui . collectionSort [ 0 ] . key , operator : value == 'ascending' ? '+' : '-' } ] } ) ;
} else if ( data . id == 'documentsort' ) {
pandora . UI . set ( { collectionSort : [ { key : value , operator : pandora . getDocumentSortOperator ( value ) } ] } ) ;
2011-11-07 12:12:13 +00:00
} else if ( data . id == 'find' ) {
2012-03-18 14:59:00 +00:00
if ( value ) {
pandora . $ui . findSelect . value ( value ) ;
2013-07-15 14:20:11 +00:00
if ( ui . _findState . key == 'advanced' ) {
2012-03-18 15:11:16 +00:00
// fixme: autocomplete function doesn't get updated
pandora . $ui . findInput . options ( { placeholder : '' } ) ;
}
2012-03-18 14:59:00 +00:00
} else {
that . checkItem ( 'findMenu_find_' + pandora . $ui . findSelect . value ( ) ) ;
}
2012-03-18 15:11:16 +00:00
pandora . $ui . findInput . focusInput ( true ) ;
2013-02-11 09:00:16 +00:00
} else if ( data . id == 'itemorder' ) {
2013-07-15 14:20:11 +00:00
pandora . UI . set ( { listSort : [ { key : ui . listSort [ 0 ] . key , operator : value == 'ascending' ? '+' : '-' } ] } ) ;
2013-02-11 09:00:16 +00:00
} else if ( data . id == 'itemsort' ) {
pandora . UI . set ( { listSort : [ { key : value , operator : pandora . getSortOperator ( value ) } ] } ) ;
2011-09-26 19:17:39 +00:00
} else if ( data . id == 'itemview' ) {
pandora . UI . set ( { itemView : value } ) ;
2019-12-02 19:09:49 +00:00
} else if ( data . id == 'collectionview' ) {
var set = { collectionView : value } ;
pandora . UI . set ( set ) ;
2012-03-18 14:59:00 +00:00
} else if ( data . id == 'listview' ) {
var set = { listView : value } ;
if (
2013-07-15 14:20:11 +00:00
! pandora . isClipView ( key , ui . item )
&& [ 'title' , 'position' ] . indexOf ( ui . listSort [ 0 ] . key ) > - 1
2012-03-18 14:59:00 +00:00
) {
set . listSort = pandora . site . user . ui . listSort ;
}
pandora . UI . set ( set ) ;
2016-11-27 18:43:28 +00:00
} else if ( data . id == 'documentview' ) {
pandora . UI . set ( { documentView : value } ) ;
2011-11-06 08:28:10 +00:00
} else if ( Ox . startsWith ( data . id , 'orderfilter' ) ) {
2013-07-15 14:20:11 +00:00
var filters = Ox . clone ( ui . filters ) ,
2011-11-06 08:28:10 +00:00
id = data . id . replace ( 'orderfilter' , '' ) ,
2012-01-04 08:10:47 +00:00
index = Ox . getIndexById ( filters , id ) ,
key = filters [ index ] . sort [ 0 ] . key ,
2011-09-17 23:24:53 +00:00
operator = value == 'ascending' ? '+' : '-' ;
2012-01-04 08:10:47 +00:00
pandora . $ui . filters [ index ] . options ( {
2011-09-17 23:24:53 +00:00
sort : [ { key : key , operator : operator } ]
} ) ;
2012-01-04 08:10:47 +00:00
filters [ index ] . sort [ 0 ] . operator = operator ;
2011-11-06 08:28:10 +00:00
pandora . UI . set ( { filters : filters } ) ;
2013-05-09 10:13:58 +00:00
} else if ( data . id == 'setlocale' ) {
2013-07-14 15:36:49 +00:00
pandora . UI . set ( { locale : value } ) ;
2013-08-08 11:02:36 +00:00
pandora . setLocale ( value , pandora . $ui . appPanel . reload ) ;
2011-09-09 12:09:05 +00:00
} else if ( data . id == 'settheme' ) {
2013-07-14 15:36:49 +00:00
pandora . UI . set ( { theme : value } ) ;
2013-08-08 11:02:36 +00:00
pandora . setTheme ( value ) ;
2012-03-20 11:51:28 +00:00
} else if ( data . id == 'showsiteposters' ) {
2013-07-14 15:36:49 +00:00
pandora . UI . set ( { showSitePosters : data . checked } ) ;
2011-11-06 08:28:10 +00:00
} else if ( Ox . startsWith ( data . id , 'sortfilter' ) ) {
var filters = Ox . clone ( ui . filters ) ,
id = data . id . replace ( 'sortfilter' , '' ) ,
2012-01-04 08:10:47 +00:00
index = Ox . getIndexById ( filters , id ) ,
2011-11-06 08:28:10 +00:00
type = Ox . getObjectById ( pandora . site . filters , id ) . type ,
2011-09-17 23:24:53 +00:00
key = value ,
2011-09-17 23:50:38 +00:00
operator = key == 'name' && type == 'string' ? '+' : '-' ;
2011-11-06 08:28:10 +00:00
pandora . $ui . mainMenu . checkItem (
'sortMenu_orderfilters_orderfilter' + id + '_'
+ ( operator == '+' ? 'ascending' : 'descending' )
) ;
2012-01-04 08:10:47 +00:00
pandora . $ui . filters [ index ] . options ( {
2011-09-17 23:24:53 +00:00
sort : [ { key : key , operator : operator } ]
} ) ;
2012-01-04 08:10:47 +00:00
filters [ index ] . sort [ 0 ] . key = key ;
2011-11-06 08:28:10 +00:00
pandora . UI . set ( { filters : filters } ) ;
2012-03-18 14:59:00 +00:00
} else if ( data . id == 'videoview' ) {
var set = { videoView : value } ;
2011-10-09 13:13:11 +00:00
if (
2012-04-17 12:05:23 +00:00
( value == 'timeline' && [ 'player' , 'editor' ] . indexOf ( ui . itemView ) > - 1 )
|| ( value == 'player' && [ 'timeline' , 'editor' ] . indexOf ( ui . itemView ) > - 1 )
|| ( value == 'editor' && [ 'timeline' , 'player' ] . indexOf ( ui . itemView ) > - 1 )
2011-10-09 13:13:11 +00:00
) {
2012-03-18 14:59:00 +00:00
set . itemView = value ;
2011-10-09 13:13:11 +00:00
}
pandora . UI . set ( set ) ;
2012-03-18 14:59:00 +00:00
} else if ( data . id == 'viewicons' ) {
pandora . UI . set ( { icons : value } ) ;
2012-05-24 09:56:52 +00:00
} else if ( data . id . slice ( 0 , 8 ) == 'viewlist' ) {
2014-02-06 07:46:15 +00:00
if ( ui . section == 'items' ) {
pandora . UI . set ( {
find : {
conditions : data . checked ? [
{ key : 'list' , value : data . id . slice ( 8 ) . replace ( /\t/g , '_' ) , operator : '==' }
] : [ ] ,
operator : '&'
}
} ) ;
2016-10-04 22:00:03 +00:00
} else if ( ui . section == 'documents' ) {
pandora . UI . set ( {
findDocuments : {
conditions : data . checked ? [
{ key : 'collection' , value : data . id . slice ( 8 ) . replace ( /\t/g , '_' ) , operator : '==' }
] : [ ] ,
operator : '&'
}
} ) ;
2014-02-06 07:46:15 +00:00
} else {
pandora . UI . set ( ui . section . slice ( 0 , - 1 ) , data . id . slice ( 8 ) . replace ( /\t/g , '_' ) ) ;
}
2014-01-17 09:55:53 +00:00
} else if ( data . id == 'viewsection' ) {
pandora . UI . set ( { section : value } ) ;
2012-03-06 21:28:27 +00:00
} else if ( data . id == 'viewtimelines' ) {
pandora . UI . set ( { videoTimeline : value } ) ;
2011-05-25 19:42:45 +00:00
}
} ,
2011-09-17 17:40:15 +00:00
click : function ( data ) {
2014-02-06 07:46:15 +00:00
if ( Ox . contains ( [
2012-06-15 14:43:05 +00:00
'home' , 'software' , 'signup' , 'signin' , 'signout' ,
2013-07-11 18:02:39 +00:00
'preferences' , 'help' , 'api'
2012-06-15 14:43:05 +00:00
] . concat (
2012-01-20 18:10:25 +00:00
pandora . site . sitePages . map ( function ( page ) {
return page . id ;
2012-06-15 14:43:05 +00:00
} )
2014-02-06 07:46:15 +00:00
) , data . id ) ) {
2011-11-09 22:32:54 +00:00
pandora . UI . set ( { page : data . id } ) ;
2016-09-15 15:20:24 +00:00
} else if ( data . id == 'tasks' ) {
pandora . ui . tasksDialog ( ) . open ( ) ;
2014-02-06 07:46:15 +00:00
} else if ( Ox . contains ( [
2011-09-29 17:25:04 +00:00
'newlist' , 'newlistfromselection' , 'newsmartlist' , 'newsmartlistfromresults'
2014-02-06 07:46:15 +00:00
] , data . id ) ) {
2013-11-08 16:13:44 +00:00
if ( ui . section == 'texts' ) {
pandora . addText ( { type : 'text' } ) ;
} else {
2014-02-07 08:07:45 +00:00
pandora . addFolderItem ( ui . section , data . id . indexOf ( 'smart' ) > - 1 , data . id . indexOf ( 'from' ) > - 1 ) ;
2013-11-08 16:13:44 +00:00
}
2014-02-06 07:46:15 +00:00
} else if ( Ox . contains ( [ 'neweditfromselection' , 'newsmarteditfromresults' ] , data . id ) ) {
2014-02-06 14:53:34 +00:00
pandora . addEdit ( data . id . indexOf ( 'smart' ) > - 1 , data . id . indexOf ( 'from' ) > - 1 ) ;
2014-02-06 07:46:15 +00:00
} else if ( data . id == 'newpdf' ) {
pandora . addText ( { type : 'pdf' } ) ;
2011-09-29 17:25:04 +00:00
} else if ( data . id == 'duplicatelist' ) {
2014-02-06 07:46:15 +00:00
pandora . addFolderItem ( ui . section , ui . section == 'items' ? ui . _list : ui . edit ) ;
2011-09-29 17:25:04 +00:00
} else if ( data . id == 'editlist' ) {
pandora . ui . listDialog ( ) . open ( ) ;
2013-02-25 10:20:04 +00:00
} else if ( data . id == 'add' ) {
2016-10-04 22:00:03 +00:00
if ( ui . section == 'documents' ) {
pandora . $ui . addDocumentDialog = pandora . ui . addDocumentDialog ( ) . open ( ) ;
} else {
pandora . $ui . addItemDialog = pandora . ui . addItemDialog ( ) . open ( ) ;
}
2016-09-15 15:20:24 +00:00
} else if ( data . id == 'edit' ) {
pandora . ui . editItemDialog ( ) . open ( ) ;
2018-09-18 21:17:32 +00:00
} else if ( data . id == 'batchedit' ) {
if ( ui . section == 'documents' ) {
pandora . ui . editDocumentsDialog ( ) . open ( ) ;
} else {
pandora . ui . editDialog ( ) . open ( ) ;
}
2011-09-29 17:25:04 +00:00
} else if ( data . id == 'deletelist' ) {
pandora . ui . deleteListDialog ( ) . open ( ) ;
2023-07-07 06:16:09 +00:00
} else if ( data . id . startsWith ( 'hidden:' ) ) {
var folderItems = {
documents : 'Collections' ,
edits : 'Edits' ,
items : 'Lists'
} [ ui . section ] ,
folderKey = folderItems . toLowerCase ( ) ,
2023-07-07 10:44:28 +00:00
name = data . id . slice ( 7 ) . replace ( /\t/g , '_' ) ,
2023-07-07 06:16:09 +00:00
set = { }
if ( ui . section == "items" ) {
set . find = {
conditions : [
2023-07-07 10:44:28 +00:00
{ key : 'list' , value : pandora . user . username + ":" + name , operator : '==' }
2023-07-07 06:16:09 +00:00
] ,
operator : '&'
}
} else if ( ui . section == "edits" ) {
2023-07-07 10:44:28 +00:00
set . edit = pandora . user . username + ":" + name ;
2023-07-07 06:16:09 +00:00
} else if ( ui . section == "documents" ) {
set . findDocuments = {
conditions : [
2023-07-07 10:44:28 +00:00
{ key : 'collection' , value : pandora . user . username + ":" + name , operator : '==' }
2023-07-07 06:16:09 +00:00
] ,
operator : '&'
}
}
2023-07-07 10:44:28 +00:00
set [ 'hidden.' + folderKey ] = ui . hidden [ folderKey ] . filter ( other => { return other != name } )
2023-07-07 06:16:09 +00:00
pandora . UI . set ( set )
Ox . Request . clearCache ( 'find' + folderItems ) ;
pandora . $ui . folderList . personal . reloadList ( )
} else if ( data . id == 'hidelist' ) {
var folderItems = {
documents : 'Collections' ,
edits : 'Edits' ,
items : 'Lists'
} [ ui . section ] ,
folderKey = folderItems . toLowerCase ( ) ,
listName = ( {
documents : ui . _collection ,
edits : ui . edit ,
items : ui . _list
2023-07-07 10:44:28 +00:00
} [ ui . section ] ) . split ( ':' ) . slice ( 1 ) . join ( ':' ) ,
2023-07-07 06:16:09 +00:00
set = { } ;
if ( ui . section == "items" ) {
set . find = {
conditions : [ ] ,
operator : '&'
}
} else if ( ui . section == "edits" ) {
set . edit = ""
} else if ( ui . section == "documents" ) {
set . findDocuments = {
conditions : [ ] ,
operator : '&'
} ;
}
2023-07-07 10:44:28 +00:00
set [ 'hidden.' + folderKey ] = Ox . sort ( Ox . unique ( [ listName ] . concat ( pandora . user . ui . hidden [ folderKey ] ) ) )
2023-07-07 06:16:09 +00:00
pandora . UI . set ( set )
Ox . Request . clearCache ( 'find' + folderItems ) ;
pandora . $ui . folderList . personal . reloadList ( )
2013-03-09 03:49:15 +00:00
} else if ( data . id == 'print' ) {
2013-07-12 10:29:58 +00:00
window . open ( document . location . href + '#print' , '_blank' ) ;
2013-07-11 18:02:39 +00:00
} else if ( data . id == 'tv' ) {
pandora . UI . set ( { 'part.tv' : ui . _list } ) ;
pandora . UI . set ( { page : 'tv' } ) ;
2013-08-02 16:03:23 +00:00
} else if ( data . id == 'selectall' ) {
2013-08-12 10:35:20 +00:00
pandora . $ui [ ui . section == 'edits' ? 'editPanel' : ! ui . item ? 'list' : 'clipList' ] . selectAll ( ) ;
2013-08-02 16:03:23 +00:00
} else if ( data . id == 'selectnone' ) {
2013-08-12 10:35:20 +00:00
ui . section == 'edits' ? pandora . $ui . editPanel . options ( { selected : [ ] } )
: ! ui . item ? pandora . UI . set ( { listSelection : [ ] } )
2013-08-02 17:53:09 +00:00
: pandora . $ui . clipList . options ( { selected : [ ] } ) ;
2013-08-02 16:03:23 +00:00
} else if ( data . id == 'invertselection' ) {
2013-08-12 10:35:20 +00:00
pandora . $ui [ ui . section == 'edits' ? 'editPanel' : ! ui . item ? 'list' : 'clipList' ] . invertSelection ( ) ;
2013-08-02 16:03:23 +00:00
} else if ( data . id == 'cut' || data . id == 'cutadd' ) {
var action = data . id == 'cut' ? 'copy' : 'add' ;
fromMenu = true ;
2014-02-12 14:55:33 +00:00
if ( ui . section == 'items' ) {
pandora . clipboard [ action ] ( ui . listSelection , 'item' ) ;
pandora . doHistory ( 'cut' , ui . listSelection , ui . _list , function ( ) {
pandora . UI . set ( { listSelection : [ ] } ) ;
pandora . reloadList ( ) ;
} ) ;
} else if ( ui . section == 'edits' ) {
var clips = pandora . $ui . editPanel . getSelectedClips ( ) ;
pandora . clipboard [ action ] ( clips , 'clip' ) ;
pandora . doHistory ( 'cut' , clips , ui . edit , function ( ) {
pandora . UI . set ( { editSelection : [ ] } ) ;
pandora . $ui . editPanel . updatePanel ( ) ;
} ) ;
}
2013-08-02 16:03:23 +00:00
} else if ( data . id == 'copy' || data . id == 'copyadd' ) {
2015-10-04 13:18:29 +00:00
var action = data . id == 'copy' ? 'copy' : 'add' ,
2015-10-06 07:05:54 +00:00
type = 'clip' , clip , clips ;
2013-08-02 16:03:23 +00:00
fromMenu = true ;
2015-10-04 13:18:29 +00:00
if ( pandora . isVideoView ( ) && ! pandora . $ui . browser . hasFocus ( ) ) {
2015-10-06 07:05:54 +00:00
clip = ui . item + '/' ;
if ( ui . videoPoints [ ui . item ] . annotation ) {
clip += ui . videoPoints [ ui . item ] . annotation ;
} else {
clip += ui . videoPoints [ ui . item ] [ 'in' ]
+ '-' + ui . videoPoints [ ui . item ] . out ;
}
clips = [ clip ] ;
2015-10-04 13:18:29 +00:00
} else if ( pandora . isClipView ( ) && ! pandora . $ui . browser . hasFocus ( ) ) {
clips = pandora . $ui . clipList . options ( 'selected' ) ;
} else if ( ui . section == 'edits' ) {
clips = pandora . $ui . editPanel . getSelectedClips ( ) ;
2017-02-21 16:41:03 +00:00
} else if ( ui . section == 'documents' ) {
clips = ui . collectionSelection ;
type = 'document' ;
2015-10-04 13:18:29 +00:00
} else {
clips = ui . listSelection ;
2017-02-21 16:41:03 +00:00
type = 'item' ;
2015-10-04 13:18:29 +00:00
}
pandora . clipboard [ action ] ( clips , type ) ;
2013-08-02 16:03:23 +00:00
} else if ( data . id == 'paste' ) {
2014-02-12 09:54:10 +00:00
fromMenu = true ;
if ( ui . section == 'items' ) {
2017-02-21 16:41:03 +00:00
if ( pandora . clipboard . type ( ) == 'document' ) {
//fixme use history
var items = pandora . clipboard . paste ( 'document' ) ;
items . length && pandora . api . addDocument ( {
item : ui . item ,
ids : items
} , function ( result ) {
Ox . Request . clearCache ( 'findDocuments' ) ;
pandora . $ui . documents . reloadList ( ) ;
} ) ;
} else {
var items = pandora . clipboard . paste ( 'item' ) ;
items . length && pandora . doHistory ( 'paste' , items , ui . _list , function ( ) {
pandora . UI . set ( { listSelection : items } ) ;
pandora . reloadList ( ) ;
} ) ;
}
2016-10-04 22:00:03 +00:00
} else if ( ui . section == 'documents' ) {
var items = pandora . clipboard . paste ( 'document' ) ;
2021-06-03 15:24:13 +00:00
/ *
2016-10-04 22:00:03 +00:00
items . length && pandora . doHistory ( 'paste' , items , ui . _collection , function ( ) {
2021-06-03 15:24:13 +00:00
pandora . UI . set ( { listSelection : items } ) ;
pandora . reloadList ( ) ;
pandora . UI . set ( { collectionSelection : items } ) ;
pandora . reloadList ( ) ;
2016-10-04 22:00:03 +00:00
} ) ;
2021-06-03 15:24:13 +00:00
* /
if ( items . length ) {
pandora . api . addCollectionItems ( {
collection : ui . _collection ,
items : items
} , function ( ) {
pandora . UI . set ( { collectionSelection : items } ) ;
pandora . reloadList ( ) ;
} ) ;
}
2015-10-04 13:18:29 +00:00
} else if ( ui . section == 'edits' ) {
var clips = pandora . clipboard . paste ( 'clip' ) ;
clips . length && pandora . doHistory ( 'paste' , clips , ui . edit , function ( result ) {
2014-02-12 09:54:10 +00:00
pandora . $ui . editPanel . updatePanel ( function ( ) {
pandora . UI . set ( { editSelection : result . data . clips . map ( function ( clip ) {
return clip . id ;
} ) } ) ;
} ) ;
} ) ;
}
2013-08-02 16:22:15 +00:00
} else if ( data . id == 'clearclipboard' ) {
2013-08-03 15:01:47 +00:00
pandora . clipboard . clear ( ) ;
2013-08-02 16:03:23 +00:00
} else if ( data . id == 'delete' ) {
2015-10-04 13:18:29 +00:00
if ( ui . section == 'items' ) {
2016-09-15 15:20:24 +00:00
if ( ui . _list ) {
pandora . doHistory ( 'delete' , ui . listSelection , ui . _list , function ( ) {
pandora . UI . set ( { listSelection : [ ] } ) ;
pandora . reloadList ( ) ;
} ) ;
} else {
pandora . api . find ( {
query : {
conditions : ui . listSelection . map ( function ( id ) {
return { key : 'id' , value : id , operator : '==' }
} ) ,
operator : '|'
} ,
keys : [ 'id' , 'title' ] ,
range : [ 0 , ui . listSelection . length ]
} , function ( result ) {
pandora . $ui . deleteItemsDialog = pandora . ui . deleteItemsDialog ( {
items : result . data . items
} ) . open ( ) ;
} ) ;
}
2016-10-04 22:00:03 +00:00
} else if ( ui . section == 'documents' ) {
2019-12-06 13:13:09 +00:00
var files , ids = [ ] ;
if ( ui . document ) {
files = [ pandora . $ui . document . info ( ) ] ;
ids = [ files [ 0 ] . id ] ;
} else {
files = pandora . $ui . list . options ( 'selected' ) . map ( function ( id ) {
ids . push ( id )
return pandora . $ui . list . value ( id ) ;
} ) ;
}
if ( ui . _collection ) {
//fixme use history
//pandora.doHistory('delete', files, ui._collection, function() {
pandora . api . removeCollectionItems ( {
collection : ui . _collection ,
items : ids
} , function ( ) {
pandora . UI . set ( { collectionSelection : [ ] } ) ;
pandora . reloadList ( ) ;
} ) ;
} else {
pandora . ui . deleteDocumentDialog (
files ,
function ( ) {
Ox . Request . clearCache ( ) ;
if ( ui . document ) {
pandora . UI . set ( { document : '' } ) ;
} else {
pandora . $ui . list . reloadList ( )
}
}
) . open ( ) ;
}
} else if ( ui . section == 'edits' ) {
var clips = pandora . $ui . editPanel . getSelectedClips ( ) ;
pandora . doHistory ( 'delete' , clips , ui . edit , function ( result ) {
pandora . $ui . editPanel . updatePanel ( function ( ) { } ) ;
} ) ;
}
} else if ( data . id == 'deletefromarchive' ) {
2020-07-21 11:12:23 +00:00
if ( ui . section == 'items' ) {
var ids ;
if ( ui . item ) {
ids = [ ui . item ]
} else {
ids = ui . listSelection
}
pandora . api . find ( {
query : {
conditions : [ {
key : 'id' ,
operator : '&' ,
value : ids
} ] ,
operator : '&'
} ,
keys : [ 'id' , 'title' ] ,
range : [ 0 , ui . listSelection . length ]
} , function ( result ) {
pandora . $ui . deleteItemsDialog = pandora . ui . deleteItemsDialog ( {
items : result . data . items
} , function ( ) {
Ox . Request . clearCache ( ) ;
if ( ui . item ) {
pandora . UI . set ( { item : '' } ) ;
} else {
pandora . $ui . list . reloadList ( )
}
} ) . open ( ) ;
} ) ;
} else if ( ui . section == 'documents' ) {
2016-10-04 22:00:03 +00:00
var files ;
if ( ui . document ) {
files = [ pandora . $ui . document . info ( ) ] ;
} else {
files = pandora . $ui . list . options ( 'selected' ) . map ( function ( id ) {
return pandora . $ui . list . value ( id ) ;
} ) ;
}
pandora . ui . deleteDocumentDialog (
files ,
function ( ) {
Ox . Request . clearCache ( ) ;
if ( ui . document ) {
pandora . UI . set ( { document : '' } ) ;
} else {
pandora . $ui . list . reloadList ( )
}
}
) . open ( ) ;
2015-10-04 13:18:29 +00:00
}
2013-08-03 14:01:36 +00:00
} else if ( data . id == 'undo' ) {
2013-08-06 19:07:46 +00:00
fromMenu = true ;
2013-08-03 14:01:36 +00:00
pandora . undoHistory ( ) ;
} else if ( data . id == 'redo' ) {
2013-08-06 19:07:46 +00:00
fromMenu = true ;
2013-08-03 14:01:36 +00:00
pandora . redoHistory ( ) ;
} else if ( data . id == 'clearhistory' ) {
2013-08-06 19:07:46 +00:00
fromMenu = true ;
2013-08-03 14:01:36 +00:00
pandora . history . clear ( ) ;
2013-08-12 10:35:20 +00:00
} else if ( data . id == 'resetfilters' ) {
2019-12-02 19:09:49 +00:00
if ( ui . section == 'documents' ) {
pandora . UI . set ( {
documentFilters : pandora . site . user . ui . documentFilters
} ) ;
pandora . $ui . documentContentPanel . replaceElement ( 0 , pandora . $ui . documentBrowser = pandora . ui . documentBrowser ( ) ) ;
} else {
pandora . UI . set ( {
filters : pandora . site . user . ui . filters
} ) ;
pandora . $ui . contentPanel . replaceElement ( 0 , pandora . $ui . browser = pandora . ui . browser ( ) ) ;
}
2011-10-13 10:12:00 +00:00
} else if ( data . id == 'showsidebar' ) {
pandora . UI . set ( { showSidebar : ! ui . showSidebar } ) ;
} else if ( data . id == 'showinfo' ) {
pandora . UI . set ( { showInfo : ! ui . showInfo } ) ;
2011-11-06 08:28:10 +00:00
} else if ( data . id == 'showfilters' ) {
pandora . UI . set ( { showFilters : ! ui . showFilters } ) ;
2011-10-13 10:12:00 +00:00
} else if ( data . id == 'showbrowser' ) {
pandora . UI . set ( { showBrowser : ! ui . showBrowser } ) ;
2014-01-06 12:34:49 +00:00
} else if ( data . id == 'showdocument' ) {
pandora . UI . set ( { showDocument : ! ui . showDocument } ) ;
2011-11-05 22:14:10 +00:00
} else if ( data . id == 'showtimeline' ) {
pandora . UI . set ( { showTimeline : ! ui . showTimeline } ) ;
2013-07-14 09:27:27 +00:00
} else if ( data . id == 'showannotations' ) {
pandora . UI . set ( { showAnnotations : ! ui . showAnnotations } ) ;
} else if ( data . id == 'showclips' ) {
pandora . UI . set ( { showClips : ! ui . showClips } ) ;
2012-11-01 15:19:46 +00:00
} else if ( data . id == 'togglefullscreen' ) {
2012-11-01 14:21:44 +00:00
Ox . Fullscreen . toggle ( ) ;
} else if ( data . id == 'entervideofullscreen' ) {
2012-03-23 12:00:04 +00:00
pandora . $ui . player . options ( { fullscreen : true } ) ;
2014-02-14 15:23:59 +00:00
} else if ( data . id == 'embed' ) {
pandora . $ui . embedDialog = pandora . ui . embedDialog ( ) . open ( ) ;
2023-07-15 06:34:04 +00:00
} else if ( data . id == 'share' ) {
pandora . $ui . shareDialog = pandora . ui . shareDialog ( ) . open ( ) ;
2011-11-11 12:28:20 +00:00
} else if ( data . id == 'advancedfind' ) {
2012-06-15 14:43:05 +00:00
pandora . $ui . filterDialog = pandora . ui . filterDialog ( ) . open ( ) ;
2014-11-16 14:13:47 +00:00
} else if ( data . id == 'clearquery' ) {
2014-11-16 14:24:54 +00:00
pandora . UI . set ( { find : { conditions : [ ] , operator : '&' } } ) ;
2014-11-16 14:13:47 +00:00
} else if ( data . id == 'clearfilters' ) {
pandora . $ui . filters . clearFilters ( ) ;
2012-06-15 14:43:05 +00:00
} else if ( data . id == 'findsimilar' ) {
2013-08-02 09:53:06 +00:00
pandora . $ui . similarClipsDialog = pandora . ui . similarClipsDialog ( ) . open ( ) ;
2014-11-19 16:05:48 +00:00
} else if ( data . id == 'entities' ) {
pandora . $ui . entitiesDialog = pandora . ui . entitiesDialog ( ) . open ( ) ;
2011-10-11 11:29:05 +00:00
} else if ( data . id == 'titles' ) {
2011-11-01 20:04:16 +00:00
( pandora . $ui . titlesDialog || (
pandora . $ui . titlesDialog = pandora . ui . titlesDialog ( )
) ) . open ( ) ;
} else if ( data . id == 'names' ) {
( pandora . $ui . namesDialog || (
pandora . $ui . namesDialog = pandora . ui . namesDialog ( )
) ) . open ( ) ;
2011-05-25 19:42:45 +00:00
} else if ( data . id == 'places' ) {
2011-11-01 20:04:16 +00:00
( pandora . $ui . placesDialog || (
pandora . $ui . placesDialog = pandora . ui . placesDialog ( )
) ) . open ( ) ;
2011-09-24 23:09:48 +00:00
} else if ( data . id == 'events' ) {
2011-11-01 20:04:16 +00:00
( pandora . $ui . eventsDialog || (
pandora . $ui . eventsDialog = pandora . ui . eventsDialog ( )
) ) . open ( ) ;
2017-01-26 18:15:00 +00:00
} else if ( data . id == 'managehome' ) {
pandora . $ui . homeDialog = pandora . ui . homeDialog ( ) . open ( ) ;
2011-09-24 23:09:48 +00:00
} else if ( data . id == 'users' ) {
2011-11-11 18:55:13 +00:00
pandora . $ui . usersDialog = pandora . ui . usersDialog ( ) . open ( ) ;
2012-03-22 20:08:51 +00:00
} else if ( data . id == 'statistics' ) {
pandora . $ui . statisticsDialog = pandora . ui . statisticsDialog ( ) . open ( ) ;
2018-08-08 09:23:05 +00:00
} else if ( data . id == 'translations' ) {
pandora . $ui . translationsDialog = pandora . ui . translationsDialog ( ) . open ( ) ;
2014-12-15 20:23:57 +00:00
} else if ( data . id == 'changelog' ) {
pandora . $ui . changelogDialog = pandora . ui . changelogDialog ( ) . open ( ) ;
2013-08-27 14:43:17 +00:00
} else if ( data . id == 'clearcache' ) {
Ox . Request . clearCache ( ) ;
2013-08-27 14:27:48 +00:00
} else if ( data . id == 'cache' ) {
var enabled = pandora . localStorage ( 'enableCache' ) === false ;
pandora . localStorage ( 'enableCache' , enabled ) ;
Ox . Request . options ( { cache : enabled } )
that . setItemTitle ( 'cache' , Ox . _ ( ( enabled ? 'Disable' : 'Enable' ) + ' Cache' ) ) ;
that [ enabled ? 'enableItem' : 'disableItem' ] ( 'clearcache' ) ;
2012-06-30 11:56:04 +00:00
} else if ( data . id == 'debugmode' ) {
if ( pandora . localStorage ( 'enableDebugMode' ) ) {
pandora . localStorage [ 'delete' ] ( 'enableDebugMode' ) ;
} else {
pandora . localStorage ( 'enableDebugMode' , true ) ;
}
2012-06-30 12:13:35 +00:00
window . location . reload ( ) ;
2012-06-30 11:56:04 +00:00
} else if ( data . id == 'eventlogging' ) {
if ( pandora . localStorage ( 'enableEventLogging' ) ) {
pandora . localStorage [ 'delete' ] ( 'enableEventLogging' ) ;
2011-10-28 18:05:17 +00:00
} else {
2012-06-30 11:56:04 +00:00
pandora . localStorage ( 'enableEventLogging' , true ) ;
2011-10-28 18:05:17 +00:00
}
2012-06-30 12:13:35 +00:00
Ox . Event [ pandora . localStorage ( 'enableEventLogging' ) ? 'bind' : 'unbind' ] ( pandora . logEvent ) ;
2013-05-09 10:13:58 +00:00
that . setItemTitle ( 'eventlogging' , Ox . _ ( ( pandora . localStorage ( 'enableEventLogging' ) ? 'Disable' : 'Enable' ) + ' Event Logging' ) ) ;
2012-05-28 21:53:56 +00:00
} else if ( data . id == 'tests' ) {
pandora . tests ( ) ;
2014-12-17 13:55:43 +00:00
} else if ( data . id == 'errorlogs' ) {
pandora . $ui . errorlogsDialog = pandora . ui . errorlogsDialog ( ) . open ( ) ;
2011-05-25 19:42:45 +00:00
}
2011-09-27 23:30:13 +00:00
} ,
2016-10-04 22:00:03 +00:00
pandora _collectionsort : function ( data ) {
that . checkItem ( 'sortMenu_sortitems_' + data . value [ 0 ] . key ) ;
that . checkItem ( 'sortMenu_orderitems_' + (
data . value [ 0 ] . operator == '+' ? 'ascending' : 'descending' )
) ;
} ,
pandora _finddocuments : function ( ) {
var action = pandora . getListData ( ) . editable ? 'enableItem' : 'disableItem' ,
list = ui . _collection ,
previousList = pandora . UI . getPrevious ( ) . _collection ;
if ( list != previousList ) {
that . uncheckItem ( previousList == '' ? 'allitems' : 'viewlist' + previousList . replace ( /_/g , Ox . char ( 9 ) ) ) ;
that . checkItem ( list == '' ? 'allitems' : 'viewlist' + list . replace ( /_/g , '\t' ) ) ;
}
2023-07-07 06:16:09 +00:00
that [ list ? 'enableItem' : 'disableItem' ] ( 'duplicatelist' ) ;
that [
list && pandora . $ui . folderList && pandora . $ui . folderList . personal . options ( 'selected' ) . length
? 'enableItem' : 'disableItem'
] ( 'hidelist' ) ;
2016-10-04 22:00:03 +00:00
that [ action ] ( 'editlist' ) ;
that [ action ] ( 'deletelist' ) ;
that [ ui . listSelection . length ? 'enableItem' : 'disableItem' ] ( 'newlistfromselection' ) ;
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
that [ ui . find . conditions . length ? 'enableItem' : 'disableItem' ] ( 'clearquery' ) ;
that [ Ox . sum ( ui . _filterState . map ( function ( filterState ) {
return filterState . selected . length ;
} ) ) > 0 ? 'enableItem' : 'disableItem' ] ( 'clearfilters' ) ;
} ,
2013-07-14 09:27:27 +00:00
pandora _edit : function ( ) {
2014-02-06 07:46:15 +00:00
var action = pandora . getListData ( ) . editable ? 'enableItem' : 'disableItem' ,
edit = ui . edit ,
previousEdit = pandora . UI . getPrevious ( ) . edit ;
if ( edit != previousEdit ) {
that . uncheckItem ( previousEdit == '' ? 'allitems' : 'viewlist' + previousEdit . replace ( /_/g , Ox . char ( 9 ) ) ) ;
that . checkItem ( edit == '' ? 'allitems' : 'viewlist' + edit . replace ( /_/g , '\t' ) ) ;
}
2014-02-07 06:41:43 +00:00
that [ ! isGuest && edit ? 'enableItem' : 'disableItem' ] ( 'duplicatelist' ) ;
2023-07-07 06:16:09 +00:00
that [
! isGuest && edit && pandora . $ui . folderList && pandora . $ui . folderList . personal . options ( 'selected' ) . length
? 'enableItem' : 'disableItem'
] ( 'hidelist' ) ;
2014-02-06 07:46:15 +00:00
that [ action ] ( 'editlist' ) ;
that [ action ] ( 'deletelist' ) ;
2014-02-07 06:41:43 +00:00
that [ ! isGuest && edit ? 'enableItem' : 'disableItem' ] ( 'newlistfromselection' ) ;
2014-02-06 07:46:15 +00:00
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
2011-11-05 22:14:10 +00:00
} ,
2014-02-12 08:09:18 +00:00
pandora _editselection : function ( ) {
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
} ,
pandora _editview : function ( ) {
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
} ,
2011-09-29 17:25:04 +00:00
pandora _find : function ( ) {
2013-08-02 16:03:23 +00:00
var action = pandora . getListData ( ) . editable ? 'enableItem' : 'disableItem' ,
list = ui . _list ,
previousList = pandora . UI . getPrevious ( ) . _list ;
2011-11-07 12:12:13 +00:00
if ( list != previousList ) {
2013-08-14 20:21:12 +00:00
that . uncheckItem ( previousList == '' ? 'allitems' : 'viewlist' + previousList . replace ( /_/g , Ox . char ( 9 ) ) ) ;
2013-08-14 23:30:15 +00:00
that . checkItem ( list == '' ? 'allitems' : 'viewlist' + list . replace ( /_/g , '\t' ) ) ;
2011-11-07 12:12:13 +00:00
}
2023-07-07 06:16:09 +00:00
that [ list ? 'enableItem' : 'disableItem' ] ( 'duplicatelist' ) ;
that [
list && pandora . $ui . folderList && pandora . $ui . folderList . personal . options ( 'selected' ) . length
? 'enableItem' : 'disableItem'
] ( 'hidelist' ) ;
2011-09-29 17:25:04 +00:00
that [ action ] ( 'editlist' ) ;
that [ action ] ( 'deletelist' ) ;
2011-10-13 10:12:00 +00:00
that [ ui . listSelection . length ? 'enableItem' : 'disableItem' ] ( 'newlistfromselection' ) ;
2013-08-02 16:03:23 +00:00
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
2014-11-16 14:13:47 +00:00
that [ ui . find . conditions . length ? 'enableItem' : 'disableItem' ] ( 'clearquery' ) ;
2013-08-12 10:35:20 +00:00
that [ Ox . sum ( ui . _filterState . map ( function ( filterState ) {
return filterState . selected . length ;
} ) ) > 0 ? 'enableItem' : 'disableItem' ] ( 'clearfilters' ) ;
2011-10-13 10:12:00 +00:00
} ,
2011-11-06 08:28:10 +00:00
pandora _filters : function ( data ) {
2011-11-05 18:22:23 +00:00
that . replaceMenu ( 'sortMenu' , getSortMenu ( ) ) ;
} ,
2011-10-13 10:12:00 +00:00
pandora _item : function ( data ) {
if ( ! ! data . value != ! ! data . previousValue ) {
2013-08-02 17:38:26 +00:00
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
2011-11-06 08:28:10 +00:00
that [ data . value ? 'disableItem' : 'enableItem' ] ( 'showfilters' ) ;
2011-10-13 10:12:00 +00:00
that [ data . value ? 'enableItem' : 'disableItem' ] ( 'showbrowser' ) ;
2011-10-31 16:45:55 +00:00
that . replaceMenu ( 'sortMenu' , getSortMenu ( ) ) ;
2011-10-13 10:12:00 +00:00
}
2011-10-13 10:19:56 +00:00
if ( ! data . value ) {
that . disableItem ( 'showannotations' ) ;
2012-03-23 12:00:04 +00:00
that . disableItem ( 'showtimeline' ) ;
2012-11-01 14:21:44 +00:00
that . disableItem ( 'entervideofullscreen' ) ;
2012-03-23 12:00:04 +00:00
} else {
2012-04-17 12:05:23 +00:00
if ( [ 'timeline' , 'player' , 'editor' ] . indexOf ( ui . itemView ) > - 1 ) {
2012-03-23 12:00:04 +00:00
that . enableItem ( 'showannotations' ) ;
}
2012-04-17 07:06:19 +00:00
if ( ui . itemView == 'player' ) {
2012-03-23 12:00:04 +00:00
that . enableItem ( 'showtimeline' ) ;
2012-11-01 14:21:44 +00:00
that . enableItem ( 'entervideofullscreen' ) ;
2012-03-23 12:00:04 +00:00
}
2011-10-13 10:19:56 +00:00
}
2011-10-13 10:12:00 +00:00
} ,
2013-02-11 09:00:16 +00:00
pandora _itemsort : function ( data ) {
that . checkItem ( 'sortMenu_sortclips_' + data . value [ 0 ] . key ) ;
that . checkItem ( 'sortMenu_orderclips_' + (
data . value [ 0 ] . operator == '+' ? 'ascending' : 'descending' )
) ;
} ,
2011-10-13 10:12:00 +00:00
pandora _itemview : function ( data ) {
2012-03-23 12:00:04 +00:00
var action ,
2013-08-02 16:03:23 +00:00
isClipView = pandora . isClipView ( ) ,
isVideoView = pandora . isVideoView ( ) ,
wasClipView = pandora . isClipView ( data . previousValue ) ,
wasVideoView = pandora . isVideoView ( data . previousValue ) ;
if ( isClipView != wasClipView || isVideoView != wasVideoView ) {
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
2013-02-11 09:00:16 +00:00
}
2013-08-02 16:03:23 +00:00
that . checkItem ( 'viewMenu_item_' + data . value ) ;
2012-03-18 14:59:00 +00:00
if ( isVideoView ) {
that . checkItem ( 'viewMenu_clips_' + data . value ) ;
}
2011-10-13 10:12:00 +00:00
if ( isVideoView != wasVideoView ) {
that [ isVideoView ? 'enableItem' : 'disableItem' ] ( 'showannotations' ) ;
}
2012-04-17 08:03:11 +00:00
if ( ( data . value == 'player' ) != ( data . previousValue == 'player' ) ) {
2012-04-17 07:06:19 +00:00
action = data . value == 'player' ? 'enableItem' : 'disableItem' ;
2012-03-23 12:00:04 +00:00
that [ action ] ( 'showtimeline' ) ;
2012-11-01 14:21:44 +00:00
that [ action ] ( 'entervideofullscreen' ) ;
2011-11-05 22:14:10 +00:00
}
2013-08-02 16:03:23 +00:00
if ( isClipView != wasClipView ) {
that . replaceMenu ( 'sortMenu' , getSortMenu ( ) ) ;
}
2012-06-15 14:43:05 +00:00
that [
pandora . getItemIdAndPosition ( ) ? 'enableItem' : 'disableItem'
] ( 'findsimilar' ) ;
2011-09-29 17:25:04 +00:00
} ,
2016-10-04 22:00:03 +00:00
pandora _collectionselection : function ( data ) {
var action = data . value . length ? 'enableItem' : 'disableItem' ;
that [ action ] ( 'newlistfromselection' ) ;
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
that [
pandora . getItemIdAndPosition ( ) ? 'enableItem' : 'disableItem'
] ( 'findsimilar' ) ;
} ,
2011-09-29 17:25:04 +00:00
pandora _listselection : function ( data ) {
2013-08-02 16:03:23 +00:00
var action = data . value . length ? 'enableItem' : 'disableItem' ;
that [ action ] ( 'newlistfromselection' ) ;
2014-02-06 14:53:34 +00:00
if ( ui . section == 'items' && pandora . isClipView ( ) ) {
2014-02-06 07:46:15 +00:00
that [ action ] ( 'neweditfromselection' ) ;
}
2013-08-02 16:03:23 +00:00
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
2012-06-15 14:43:05 +00:00
that [
pandora . getItemIdAndPosition ( ) ? 'enableItem' : 'disableItem'
] ( 'findsimilar' ) ;
2011-09-29 17:25:04 +00:00
} ,
2012-03-18 14:59:00 +00:00
pandora _listsort : function ( data ) {
2013-07-15 14:20:11 +00:00
if ( pandora . isClipView ( ui . listView , false ) ) {
2013-02-11 09:00:16 +00:00
that . checkItem ( 'sortMenu_sortclips_' + data . value [ 0 ] . key ) ;
that . checkItem ( 'sortMenu_orderclips_' + (
data . value [ 0 ] . operator == '+' ? 'ascending' : 'descending' )
) ;
} else {
that . checkItem ( 'sortMenu_sortitems_' + data . value [ 0 ] . key ) ;
that . checkItem ( 'sortMenu_orderitems_' + (
data . value [ 0 ] . operator == '+' ? 'ascending' : 'descending' )
) ;
}
2012-03-18 14:59:00 +00:00
} ,
2019-12-02 19:09:49 +00:00
pandora _collectionview : function ( data ) {
that . checkItem ( 'viewMenu_documents_' + data . value ) ;
} ,
2011-09-29 17:25:04 +00:00
pandora _listview : function ( data ) {
2014-01-18 03:43:43 +00:00
that . checkItem ( 'viewMenu_movies_' + data . value ) ;
2013-08-02 16:03:23 +00:00
if (
pandora . isClipView ( ) != pandora . isClipView ( data . previousValue )
|| pandora . isVideoView ( ) != pandora . isVideoView ( data . previousValue )
) {
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
}
2011-09-27 23:30:13 +00:00
if ( pandora . isClipView ( ) != pandora . isClipView ( data . previousValue ) ) {
that . replaceMenu ( 'sortMenu' , getSortMenu ( ) ) ;
}
2012-06-15 14:43:05 +00:00
that [
pandora . getItemIdAndPosition ( ) ? 'enableItem' : 'disableItem'
] ( 'findsimilar' ) ;
2011-10-13 10:12:00 +00:00
} ,
2014-01-17 09:55:53 +00:00
pandora _section : function ( data ) {
2014-01-19 09:41:38 +00:00
lists = { } ;
2019-12-02 19:09:49 +00:00
that . replaceMenu ( 'viewMenu' , getViewMenu ( ) ) ;
2014-01-17 09:55:53 +00:00
that . checkItem ( 'viewMenu_section_' + data . value ) ;
2013-07-15 14:20:11 +00:00
that . replaceMenu ( 'listMenu' , getListMenu ( ) ) ;
2013-08-12 10:35:20 +00:00
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
2013-07-14 10:21:50 +00:00
that . replaceMenu ( 'sortMenu' , getSortMenu ( ) ) ;
2014-02-12 12:26:33 +00:00
that . replaceMenu ( 'findMenu' , getFindMenu ( ) ) ;
2013-07-14 09:27:27 +00:00
} ,
2011-10-13 10:12:00 +00:00
pandora _showannotations : function ( data ) {
2013-05-09 10:13:58 +00:00
that . setItemTitle ( 'showannotations' , Ox . _ ( ( data . value ? 'Hide' : 'Show' ) + ' Annotations' ) ) ;
2011-10-13 10:12:00 +00:00
} ,
pandora _showbrowser : function ( data ) {
2013-05-09 10:13:58 +00:00
that . setItemTitle ( 'showbrowser' , Ox . _ ( ( data . value ? 'Hide' : 'Show' ) + ' {0} Browser' , [ Ox . _ ( pandora . site . itemName . singular ) ] ) ) ;
2011-10-13 10:12:00 +00:00
} ,
2013-07-14 09:27:27 +00:00
pandora _showclips : function ( data ) {
that . setItemTitle ( 'showclips' , Ox . _ ( ( data . value ? 'Hide' : 'Show' ) + ' Clips' ) ) ;
} ,
2014-01-06 12:34:49 +00:00
pandora _showdocument : function ( data ) {
that . setItemTitle ( 'showdocument' , Ox . _ ( ( data . value ? 'Hide' : 'Show' ) + ' Document' ) ) ;
2014-01-07 07:46:10 +00:00
} ,
2011-11-06 08:28:10 +00:00
pandora _showfilters : function ( data ) {
2013-05-09 10:13:58 +00:00
that . setItemTitle ( 'showfilters' , Ox . _ ( ( data . value ? 'Hide' : 'Show' ) + ' Filters' ) ) ;
2011-10-13 10:12:00 +00:00
} ,
pandora _showinfo : function ( data ) {
2013-05-09 10:13:58 +00:00
that . setItemTitle ( 'showinfo' , Ox . _ ( ( data . value ? 'Hide' : 'Show' ) + ' Info' ) ) ;
2011-10-13 10:12:00 +00:00
} ,
pandora _showsidebar : function ( data ) {
2013-05-09 10:13:58 +00:00
that . setItemTitle ( 'showsidebar' , Ox . _ ( ( data . value ? 'Hide' : 'Show' ) + ' Sidebar' ) ) ;
2011-11-02 06:48:45 +00:00
that [ data . value ? 'enableItem' : 'disableItem' ] ( 'showinfo' ) ;
2011-11-05 22:14:10 +00:00
} ,
pandora _showtimeline : function ( data ) {
2013-05-09 10:13:58 +00:00
that . setItemTitle ( 'showtimeline' , Ox . _ ( ( data . value ? 'Hide' : 'Show' ) + ' Timeline' ) ) ;
2012-06-15 13:20:35 +00:00
} ,
2013-08-02 16:03:23 +00:00
pandora _videopoints : function ( data ) {
2013-08-06 10:48:08 +00:00
var action ;
2013-10-07 19:55:20 +00:00
if ( data . value && data . value [ 'in' ] ) {
2013-08-06 10:48:08 +00:00
action = data . value [ 'in' ] != data . value . out ? 'enableItem' : 'disableItem' ;
that [ action ] ( 'copy' ) ;
that [ action ] ( 'copyadd' ) ;
}
2013-08-02 16:03:23 +00:00
} ,
2012-06-15 13:20:35 +00:00
pandora _videotimeline : function ( data ) {
that . checkItem ( 'viewMenu_timelines_' + data . value ) ;
2011-05-25 19:42:45 +00:00
}
} ) ;
2011-09-18 01:52:43 +00:00
2014-09-24 18:53:40 +00:00
Ox . Event . bind ( {
key _alt _control _f : function ( ) {
2014-11-16 14:31:44 +00:00
Ox . Fullscreen . toggle ( ) ;
2014-09-24 18:53:40 +00:00
} ,
key _alt _control _shift _a : function ( ) {
2014-09-23 21:57:48 +00:00
if ( ! pandora . hasDialogOrScreen ( ) && ! ui . item ) {
pandora . $ui . filters . clearFilters ( ) ;
}
2014-09-24 18:53:40 +00:00
} ,
2014-11-16 14:13:47 +00:00
key _alt _control _shift _f : function ( ) {
2014-11-16 14:20:58 +00:00
pandora . UI . set ( { find : { conditions : [ ] , operator : '&' } } ) ;
2014-11-16 14:13:47 +00:00
} ,
2014-09-24 18:53:40 +00:00
key _backtick : function ( ) {
2014-09-23 21:57:48 +00:00
changeFocus ( 1 ) ;
2014-09-24 18:53:40 +00:00
} ,
key _control _comma : function ( ) {
2014-09-23 21:57:48 +00:00
if ( ! pandora . hasDialogOrScreen ( ) ) {
pandora . UI . set ( { page : 'preferences' } ) ;
}
2014-09-24 18:53:40 +00:00
} ,
key _control _f : function ( ) {
2014-09-23 21:57:48 +00:00
if ( ! pandora . hasDialogOrScreen ( ) ) {
if ( ui . _findState . key != 'advanced' ) {
setTimeout ( function ( ) {
2023-06-27 13:59:47 +00:00
pandora . $ui . findInput && pandora . $ui . findInput . focusInput ( true ) ;
2014-09-23 21:57:48 +00:00
} , 25 ) ;
} else {
pandora . $ui . filterDialog = pandora . ui . filterDialog ( ) . open ( ) ;
}
}
2014-09-24 18:53:40 +00:00
} ,
key _control _m : function ( ) {
2014-09-23 21:57:48 +00:00
if ( ! pandora . hasDialogOrScreen ( ) && ! that . isSelected ( ) ) {
that . options ( 'menus' ) [ 0 ] . element . trigger ( 'click' ) ;
}
2014-09-24 18:53:40 +00:00
} ,
key _control _p : function ( ) {
2014-09-23 21:57:48 +00:00
window . open ( document . location . href + '#?print=true' , '_blank' ) ;
2014-09-24 18:53:40 +00:00
} ,
2018-11-16 13:41:06 +00:00
key _control _e : function ( ) {
if (
! pandora . hasDialogOrScreen ( ) &&
pandora . enableBatchEdit ( ui . section )
) {
if ( ui . section == 'documents' ) {
pandora . ui . editDocumentsDialog ( ) . open ( ) ;
} else {
pandora . ui . editDialog ( ) . open ( ) ;
}
}
} ,
2018-09-18 21:17:32 +00:00
key _control _shift _e : function ( ) {
if (
! pandora . hasDialogOrScreen ( ) &&
pandora . enableBatchEdit ( ui . section )
) {
if ( ui . section == 'documents' ) {
pandora . ui . editDocumentsDialog ( ) . open ( ) ;
} else {
pandora . ui . editDialog ( ) . open ( ) ;
}
}
} ,
2014-09-24 18:53:40 +00:00
key _control _shift _f : function ( ) {
2014-09-23 21:57:48 +00:00
if ( ! pandora . hasDialogOrScreen ( ) ) {
pandora . $ui . filterDialog = pandora . ui . filterDialog ( ) . open ( ) ;
}
2014-09-24 18:53:40 +00:00
} ,
key _control _shift _slash : function ( ) {
2014-09-23 21:57:48 +00:00
if ( ! pandora . hasDialogOrScreen ( ) ) {
pandora . UI . set ( { page : 'api' } ) ;
}
2014-09-24 18:53:40 +00:00
} ,
key _control _shift _w : function ( ) {
2014-09-23 21:57:48 +00:00
if ( ! pandora . hasDialogOrScreen ( ) ) {
if ( ui . section == 'items' ) {
if ( ui . item ) {
pandora . UI . set ( { item : '' } ) ;
} else if ( ui . _list ) {
pandora . UI . set ( { find : { conditions : [ ] , operator : '&' } } ) ;
}
} else {
pandora . UI . set ( ui . section . slice ( 0 , - 1 ) , '' ) ;
}
}
2014-09-24 18:53:40 +00:00
} ,
key _control _shift _z : function ( ) {
2014-09-23 21:57:48 +00:00
pandora . redoHistory ( ) ;
2014-09-24 18:53:40 +00:00
} ,
key _control _slash : function ( ) {
2014-09-23 21:57:48 +00:00
if ( ! pandora . hasDialogOrScreen ( ) ) {
pandora . UI . set ( { page : 'help' } ) ;
}
2014-09-24 18:53:40 +00:00
} ,
key _control _space : function ( ) {
2014-09-23 21:57:48 +00:00
if ( ! pandora . hasDialogOrScreen ( ) ) {
pandora . UI . set ( { 'part.tv' : ui . _list } ) ;
pandora . UI . set ( { page : 'tv' } ) ;
}
2014-09-24 18:53:40 +00:00
} ,
key _control _w : function ( ) {
2014-09-23 21:57:48 +00:00
if ( ! pandora . hasDialogOrScreen ( ) && ui . section == 'items' ) {
if ( ui . item ) {
pandora . UI . set ( { item : '' } ) ;
} else if ( ui . _list ) {
pandora . UI . set ( { find : { conditions : [ ] , operator : '&' } } ) ;
}
}
2014-09-24 18:53:40 +00:00
} ,
key _control _z : function ( ) {
2014-09-23 21:57:48 +00:00
pandora . undoHistory ( ) ;
2014-09-24 18:53:40 +00:00
} ,
key _shift _a : function ( ) {
2014-09-23 21:57:48 +00:00
hasAnnotations ( ) && pandora . UI . set ( { showAnnotations : ! ui . showAnnotations } ) ;
2014-09-24 18:53:40 +00:00
} ,
key _shift _b : function ( ) {
2014-09-23 21:57:48 +00:00
ui . item && pandora . UI . set ( { showBrowser : ! ui . showBrowser } ) ;
2014-09-24 18:53:40 +00:00
} ,
key _shift _backtick : function ( ) {
2014-09-23 21:57:48 +00:00
changeFocus ( - 1 ) ;
2014-09-24 18:53:40 +00:00
} ,
key _shift _c : function ( ) {
2014-09-23 21:57:48 +00:00
hasClips ( ) && pandora . UI . set ( { showClips : ! ui . showClips } ) ;
2014-09-24 18:53:40 +00:00
} ,
key _shift _d : function ( ) {
2014-09-23 21:57:48 +00:00
hasDocument ( ) && pandora . UI . set ( { showDocument : ! ui . showDocument } ) ;
2014-09-24 18:53:40 +00:00
} ,
key _shift _f : function ( ) {
2014-09-23 21:57:48 +00:00
! ui . item && pandora . UI . set ( { showFilters : ! ui . showFilters } ) ;
2014-09-24 18:53:40 +00:00
} ,
key _shift _i : function ( ) {
2014-09-23 21:57:48 +00:00
ui . showSidebar && pandora . UI . set ( { showInfo : ! ui . showInfo } ) ;
2014-09-24 18:53:40 +00:00
} ,
key _shift _s : function ( ) {
2014-09-23 21:57:48 +00:00
pandora . UI . set ( { showSidebar : ! ui . showSidebar } ) ;
2014-09-24 18:53:40 +00:00
} ,
key _shift _t : function ( ) {
2014-09-23 21:57:48 +00:00
hasTimeline ( ) && pandora . UI . set ( { showTimeline : ! ui . showTimeline } ) ;
}
} ) ;
2015-10-22 11:22:43 +00:00
Ox . range ( 10 ) . forEach ( function ( i ) {
Ox . Event . bind ( 'key_shift_' + ( i + 1 ) % 10 , function ( ) {
var view ;
2016-11-27 18:43:28 +00:00
if ( ui . section == 'items' ) {
if ( ui . item ) {
view = pandora . site . itemViews [ i ] ;
if ( view && ( view . id != 'data' && view . id != 'media' ||
2017-02-17 18:25:20 +00:00
pandora . hasCapability ( 'canSeeExtraItemViews' ) ) ) {
2016-11-27 18:43:28 +00:00
pandora . UI . set ( { itemView : view . id } ) ;
}
} else {
view = pandora . site . listViews [ i ] ;
if ( view ) {
pandora . UI . set ( { listView : view . id } ) ;
}
}
} else if ( ui . section == 'edits' ) {
if ( ui . edit && i < 3 ) {
pandora . UI . set ( { editView : [ 'list' , 'grid' , 'annotations' ] [ i ] } ) ;
2015-10-22 11:22:43 +00:00
}
2016-11-27 18:43:28 +00:00
} else if ( ui . section == 'documents' ) {
if ( ui . document && i < 2 ) {
pandora . UI . set ( { documentView : [ 'info' , 'view' ] [ i ] } ) ;
} else if ( i < 2 ) {
2021-11-15 15:20:08 +00:00
pandora . UI . set ( { collectionView : [ 'list' , 'grid' , 'pages' ] [ i ] } ) ;
2015-10-22 11:22:43 +00:00
}
}
} ) ;
2015-10-13 08:10:48 +00:00
} ) ;
2013-08-03 15:01:47 +00:00
pandora . clipboard . bindEvent ( function ( data , event ) {
2013-08-02 16:03:23 +00:00
if ( Ox . contains ( [ 'add' , 'copy' , 'clear' ] , event ) ) {
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
2013-08-06 19:56:11 +00:00
}
if ( Ox . contains ( [ 'add' , 'copy' , 'paste' ] , event ) && ! fromMenu ) {
that . highlightMenu ( 'itemMenu' ) ;
2013-08-06 19:07:46 +00:00
}
fromMenu = false ;
} ) ;
pandora . history . bindEvent ( function ( data , event ) {
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
2013-08-06 19:56:11 +00:00
if ( Ox . contains ( [ 'undo' , 'redo' ] , event ) && ! fromMenu ) {
2013-08-06 19:07:46 +00:00
that . highlightMenu ( 'itemMenu' ) ;
2013-08-02 16:03:23 +00:00
}
fromMenu = false ;
2013-07-15 09:05:17 +00:00
} ) ;
2012-11-01 14:21:44 +00:00
Ox . Fullscreen . bind ( 'change' , function ( state ) {
2013-05-09 10:13:58 +00:00
that . setItemTitle ( 'togglefullscreen' , Ox . _ ( ( state ? 'Exit' : 'Enter' ) + ' Fullscreen' ) ) ;
2012-11-01 14:21:44 +00:00
} ) ;
2012-04-24 08:37:10 +00:00
function changeFocus ( direction ) {
var elements = [ ] ,
index ,
listData = pandora . getListData ( ) ;
elements [ 0 ] = ! listData . folder ? pandora . $ui . allItems
: pandora . $ui . folderList [ listData . folder ] ;
if ( ! ui . item && ui . showFilters ) {
pandora . $ui . filters . forEach ( function ( $filter ) {
if ( $filter . options ( 'selected' ) . length ) {
elements . push ( $filter ) ;
}
} ) ;
} else if ( ui . item && ui . showBrowser ) {
elements . push ( pandora . $ui . browser ) ;
}
if ( ! ui . item ) {
if ( [ 'map' , 'calendar' ] . indexOf ( ui . listView ) > - 1 ) {
elements . push ( pandora . $ui [ ui . listView ] ) ;
if ( pandora . $ui . clipList . options ( 'selected' ) . length ) {
elements . push ( pandora . $ui . clipList ) ;
}
} else if ( pandora . $ui . list . options ( 'selected' ) . length ) {
elements . push ( pandora . $ui . list ) ;
}
} else {
if ( [ 'player' , 'editor' , 'timeline' , 'map' , 'calendar' ] . indexOf ( ui . itemView ) > - 1 ) {
elements . push ( pandora . $ui [ ui . itemView ] ) ;
}
if (
[ 'clips' , 'map' , 'calendar' ] . indexOf ( ui . itemView ) > - 1
&& pandora . $ui . clipList . options ( 'selected' ) . length
) {
elements . push ( pandora . $ui . clipList ) ;
}
if (
ui . itemView == 'data'
&& pandora . $ui . item . options ( 'selected' ) . length
) {
elements . push ( pandora . $ui . item ) ;
}
}
index = direction == 1 ? - 1 : elements . length ;
Ox . forEach ( elements , function ( element , i ) {
if ( element . hasFocus ( ) ) {
index = i ;
2012-07-04 11:40:37 +00:00
return false ;
2012-04-24 08:37:10 +00:00
}
} ) ;
elements [ Ox . mod ( ( index + direction ) , elements . length ) ] . gainFocus ( ) ;
}
2016-10-04 22:00:03 +00:00
function getDocumentMenu ( ) {
var listData = pandora . getListData ( ) ,
deleteVerb = ui . _collection ? Ox . _ ( 'Remove' ) : Ox . _ ( 'Delete' ) ,
isEditable = listData . editable && listData . type == 'static' ,
isListView = ! ui . document ,
listName = ui . _collection ? Ox . _ ( 'from List' ) : Ox . _ ( 'from Archive' ) ,
listItemsName = 'Documents' ,
selectionItems = ui . collectionSelection . length ,
selectionItemName = (
selectionItems > 1 ? Ox . formatNumber ( selectionItems ) + ' ' : ''
) + Ox . _ ( selectionItems == 1 ? 'Document' : 'Documents' ) ,
clipboardItems = pandora . clipboard . items ( 'document' ) ,
clipboardItemName = clipboardItems == 0 ? ''
: (
clipboardItems > 1 ? Ox . formatNumber ( clipboardItems ) + ' ' : ''
) + Ox . _ ( clipboardItems == 1 ? 'Document' : 'Documents' ) ,
canEdit = false , //fixme
canDelete = (
ui . document || ui . collectionSelection . length
) && (
2017-02-17 18:25:20 +00:00
pandora . hasCapability ( 'canRemoveDocuments' ) ||
2016-10-04 22:00:03 +00:00
ui . collectionSelection . every ( function ( item ) {
2017-01-20 14:50:14 +00:00
return pandora . $ui . list && pandora . $ui . list . value ( item , 'editable' ) ;
2016-10-04 22:00:03 +00:00
} )
) ,
canSelect = isListView ,
canCopy = ui . collectionSelection . length ,
canCut = canCopy && isEditable ,
canPaste = isListView && isEditable ,
canAdd = canCopy && clipboardItems > 0 ,
historyItems = pandora . history . items ( ) ,
undoText = pandora . history . undoText ( ) ,
redoText = pandora . history . redoText ( ) ;
return { id : 'itemMenu' , title : Ox . _ ( 'Item' ) , items : [
2017-02-17 18:25:20 +00:00
{ id : 'add' , title : Ox . _ ( 'Add {0}...' , [ Ox . _ ( 'Document' ) ] ) , disabled : ! pandora . hasCapability ( 'canAddItems' ) } ,
2016-10-04 22:00:03 +00:00
{ id : 'edit' , title : Ox . _ ( 'Edit {0}...' , [ Ox . _ ( 'Document' ) ] ) , disabled : true /*fixme: !canEdit */ } ,
2018-11-16 13:41:06 +00:00
{ id : 'batchedit' , title : Ox . _ ( 'Batch Edit {0}...' , [ Ox . _ ( 'Documents' ) ] ) , disabled : ! pandora . enableBatchEdit ( ui . section ) , keyboard : 'control e' } ,
2016-10-04 22:00:03 +00:00
{ } ,
{ id : 'selectall' , title : Ox . _ ( 'Select All {0}' , [ listItemsName ] ) , disabled : ! canSelect , keyboard : 'control a' } ,
{ id : 'selectnone' , title : Ox . _ ( 'Select None' ) , disabled : ! canSelect , keyboard : 'shift control a' } ,
{ id : 'invertselection' , title : Ox . _ ( 'Invert Selection' ) , disabled : ! canSelect , keyboard : 'alt control a' } ,
{ } ,
{ id : 'cut' , title : Ox . _ ( 'Cut {0}' , [ selectionItemName ] ) , disabled : ! canCut , keyboard : 'control x' } ,
{ id : 'cutadd' , title : Ox . _ ( 'Cut and Add to Clipboard' ) , disabled : ! canCut || ! canAdd , keyboard : 'shift control x' } ,
{ id : 'copy' , title : Ox . _ ( 'Copy {0}' , [ selectionItemName ] ) , disabled : ! canCopy , keyboard : 'control c' } ,
{ id : 'copyadd' , title : Ox . _ ( 'Copy and Add to Clipboard' ) , disabled : ! canCopy || ! canAdd , keyboard : 'shift control c' } ,
{ id : 'paste' , title : clipboardItems == 0 ? Ox . _ ( 'Paste' ) : Ox . _ ( 'Paste {0}' , [ clipboardItemName ] ) , disabled : ! canPaste , keyboard : 'control v' } ,
{ id : 'clearclipboard' , title : Ox . _ ( 'Clear Clipboard' ) , disabled : ! clipboardItems } ,
{ } ,
2019-12-06 13:13:09 +00:00
[
{ id : 'delete' , title : Ox . _ ( '{0} {1} {2}' , [ deleteVerb , selectionItemName , listName ] ) , disabled : ! canDelete , keyboard : 'delete' }
] . concat ( ui . _collection ? [
{ id : 'deletefromarchive' , title : Ox . _ ( '{0} {1} {2}' , [ Ox . _ ( 'Delete' ) , selectionItemName , Ox . _ ( 'from Archive' ) ] ) , disabled : ! canDelete }
] : [ ] ) ,
2016-10-04 22:00:03 +00:00
{ } ,
{ id : 'undo' , title : undoText ? Ox . _ ( 'Undo {0}' , [ undoText ] ) : Ox . _ ( 'Undo' ) , disabled : ! undoText , keyboard : 'control z' } ,
{ id : 'redo' , title : redoText ? Ox . _ ( 'Redo {0}' , [ redoText ] ) : Ox . _ ( 'Redo' ) , disabled : ! redoText , keyboard : 'shift control z' } ,
{ id : 'clearhistory' , title : Ox . _ ( 'Clear History' ) , disabled : ! historyItems }
] } ;
}
function getCollectionMenu ( ) {
var itemNamePlural = pandora . getFolderItems ( ui . section ) ,
itemNameSingular = itemNamePlural . slice ( 0 , - 1 ) ,
disableEdit = isGuest || ! ui . _collection ,
disableFromSelection = isGuest || ui . collectionSelection . length == 0 ;
return { id : 'listMenu' , title : Ox . _ ( itemNameSingular == 'Collection' ? 'File' : itemNameSingular ) , items : [ ] . concat (
{
id : 'allitems' ,
title : pandora . getAllItemsTitle ( ) ,
checked : ! ui . _collection ,
keyboard : 'shift control w'
} ,
[ 'personal' , 'favorite' , 'featured' ] . map ( function ( folder ) {
return {
id : folder + 'lists' ,
title : Ox . _ ( Ox . toTitleCase ( folder ) + ' ' + itemNamePlural ) ,
items : Ox . isUndefined ( lists [ folder ] )
? [ { id : 'loading' , title : Ox . _ ( 'Loading...' ) , disabled : true } ]
: lists [ folder ] . length == 0
? [ { id : 'nolists' , title : Ox . _ ( 'No {0} {1}' ,
[ Ox . _ ( Ox . toTitleCase ( folder ) ) , Ox . _ ( itemNamePlural ) ] ) , disabled : true } ]
: lists [ folder ] . map ( function ( list ) {
return {
id : 'viewlist' + list . id . replace ( /_/g , Ox . char ( 9 ) ) ,
title : Ox . encodeHTMLEntities ( (
folder == 'favorite' ? list . user + ': ' : ''
) + list . name ) ,
checked : list . id == ui . _collection
} ;
} )
} ;
} ) ,
2023-07-07 06:16:09 +00:00
ui . hidden [ itemNamePlural . toLowerCase ( ) ] . length ? [
{
id : 'hiddenlists' ,
title : Ox . _ ( 'Hidden ' + itemNamePlural ) ,
items : ui . hidden [ itemNamePlural . toLowerCase ( ) ] . map ( id => {
return {
id : 'hidden:' + id . replace ( /_/g , Ox . char ( 9 ) ) ,
title : id
}
} )
}
] : [ ] ,
2016-10-04 22:00:03 +00:00
[
{ } ,
{ id : 'newlist' , title : Ox . _ ( 'New ' + itemNameSingular ) , disabled : isGuest , keyboard : 'control n' } ,
{ id : 'newlistfromselection' , title : Ox . _ ( 'New ' + itemNameSingular + ' from Selection' ) , disabled : disableFromSelection , keyboard : 'shift control n' } ,
{ id : 'newsmartlist' , title : Ox . _ ( 'New Smart ' + itemNameSingular ) , disabled : isGuest , keyboard : 'alt control n' } ,
{ id : 'newsmartlistfromresults' , title : Ox . _ ( 'New Smart ' + itemNameSingular + ' from Results' ) , disabled : isGuest , keyboard : 'shift alt control n' } ,
{ } ,
{ id : 'duplicatelist' , title : Ox . _ ( 'Duplicate Selected ' + itemNameSingular ) , disabled : disableEdit , keyboard : 'control d' } ,
{ id : 'editlist' , title : Ox . _ ( 'Edit Selected ' + itemNameSingular + '...' ) , disabled : disableEdit , keyboard : 'control e' } ,
{ id : 'deletelist' , title : Ox . _ ( 'Delete Selected ' + itemNameSingular + '...' ) , disabled : disableEdit , keyboard : 'delete' } ,
{ } ,
2023-07-07 06:16:09 +00:00
{ id : 'hidelist' , title : Ox . _ ( 'Hide Selected ' + itemNameSingular + '...' ) , disabled : disableEdit || ! pandora . $ui . folderList || ! pandora . $ui . folderList . personal . options ( 'selected' ) . length } ,
{ } ,
2016-10-04 22:00:03 +00:00
{ id : 'print' , title : Ox . _ ( 'Print' ) , keyboard : 'control p' }
]
) } ;
} ;
function getEditMenu ( ) {
var itemNameSingular = 'Edit' ,
itemNamePlural = 'Edits' ,
disableEdit = isGuest || ! ui . edit ;
return { id : 'listMenu' , title : Ox . _ ( itemNameSingular ) , items : [ ] . concat (
{
id : 'allitems' ,
title : pandora . getAllItemsTitle ( ) ,
checked : ! ui . edit ,
keyboard : 'shift control w'
} ,
[ 'personal' , 'favorite' , 'featured' ] . map ( function ( folder ) {
return {
id : folder + 'lists' ,
title : Ox . _ ( Ox . toTitleCase ( folder ) + ' ' + itemNamePlural ) ,
items : Ox . isUndefined ( lists [ folder ] )
? [ { id : 'loading' , title : Ox . _ ( 'Loading...' ) , disabled : true } ]
: lists [ folder ] . length == 0
? [ { id : 'nolists' , title : Ox . _ ( 'No {0} {1}' ,
[ Ox . _ ( Ox . toTitleCase ( folder ) ) , Ox . _ ( itemNamePlural ) ] ) , disabled : true } ]
: lists [ folder ] . map ( function ( list ) {
return {
id : 'viewlist' + list . id . replace ( /_/g , Ox . char ( 9 ) ) ,
title : Ox . encodeHTMLEntities ( (
folder == 'favorite' ? list . user + ': ' : ''
) + list . name ) ,
checked : list . id == ui . edit
} ;
} )
} ;
} ) ,
2023-07-07 06:16:09 +00:00
ui . hidden [ itemNamePlural . toLowerCase ( ) ] . length ? [
{
id : 'hiddenlists' ,
title : Ox . _ ( 'Hidden ' + itemNamePlural ) ,
items : ui . hidden [ itemNamePlural . toLowerCase ( ) ] . map ( id => {
return {
id : 'hidden:' + id . replace ( /_/g , Ox . char ( 9 ) ) ,
title : id
}
} )
}
] : [ ] ,
2016-10-04 22:00:03 +00:00
[
{ } ,
{ id : 'newlist' , title : Ox . _ ( 'New ' + itemNameSingular ) , disabled : isGuest , keyboard : 'control n' } ,
{ id : 'newlistfromselection' , title : Ox . _ ( 'New ' + itemNameSingular + ' from Selection' ) , disabled : disableEdit , keyboard : 'shift control n' } ,
{ id : 'newsmartlist' , title : Ox . _ ( 'New Smart ' + itemNameSingular ) , disabled : isGuest , keyboard : 'alt control n' } ,
{ } ,
{ id : 'duplicatelist' , title : Ox . _ ( 'Duplicate Selected ' + itemNameSingular ) , disabled : disableEdit , keyboard : 'control d' } ,
{ id : 'editlist' , title : Ox . _ ( 'Edit Selected ' + itemNameSingular + '...' ) , disabled : disableEdit , keyboard : 'control e' } ,
2023-07-07 06:16:09 +00:00
{ id : 'deletelist' , title : Ox . _ ( 'Delete Selected ' + itemNameSingular + '...' ) , disabled : disableEdit , keyboard : 'delete' } ,
{ } ,
{ id : 'hidelist' , title : Ox . _ ( 'Hide Selected ' + itemNameSingular + '...' ) , disabled : disableEdit || ! pandora . $ui . folderList || ! pandora . $ui . folderList . personal . options ( 'selected' ) . length } ,
2016-10-04 22:00:03 +00:00
]
) } ;
}
2014-02-12 12:26:33 +00:00
function getFindMenu ( ) {
return { id : 'findMenu' , title : Ox . _ ( 'Find' ) , items : [
{ id : 'find' , title : Ox . _ ( 'Find' ) , items : [
{ group : 'find' , min : 0 , max : 1 , items : pandora . site . findKeys . map ( function ( key , i ) {
return {
id : key . id ,
checked : key . id == findState . key ,
title : Ox . _ ( key . title )
} ;
} ) }
] , disabled : ui . section != 'items' } ,
{ id : 'advancedfind' , title : Ox . _ ( 'Advanced Find...' ) , keyboard : 'shift control f' , disabled : ui . section != 'items' } ,
{ } ,
2014-11-16 14:13:47 +00:00
{ id : 'clearquery' , title : Ox . _ ( 'Clear Query' ) , disabled : ui . section != 'items' || ui . find . conditions . length == 0 , keyboard : 'shift alt control f' } ,
{ id : 'clearfilters' , title : Ox . _ ( 'Clear Filters' ) , disabled : ui . section != 'items' || Ox . sum ( ui . _filterState . map ( function ( filterState ) {
return filterState . selected . length ;
} ) ) == 0 , keyboard : 'shift alt control a' } ,
{ } ,
{ id : 'findsimilar' , title : Ox . _ ( 'Find Similar Clips...' ) , disabled : ! pandora . getItemIdAndPosition ( ) }
2014-02-12 12:26:33 +00:00
] } ;
}
2016-10-04 22:00:03 +00:00
function getItemListMenu ( ) {
var itemNameSingular = 'List' ,
itemNamePlural = 'Lists' ,
disableEdit = isGuest || ! ui . _list ,
disableFromSelection = isGuest || ui . listSelection . length == 0 ;
return { id : 'listMenu' , title : Ox . _ ( itemNameSingular ) , items : [ ] . concat (
{
id : 'allitems' ,
title : pandora . getAllItemsTitle ( ) ,
checked : ! ui . _list ,
keyboard : 'shift control w'
} ,
[ 'personal' , 'favorite' , 'featured' ] . map ( function ( folder ) {
return {
id : folder + 'lists' ,
title : Ox . _ ( Ox . toTitleCase ( folder ) + ' ' + itemNamePlural ) ,
items : Ox . isUndefined ( lists [ folder ] )
? [ { id : 'loading' , title : Ox . _ ( 'Loading...' ) , disabled : true } ]
: lists [ folder ] . length == 0
? [ { id : 'nolists' , title : Ox . _ ( 'No {0} {1}' ,
[ Ox . _ ( Ox . toTitleCase ( folder ) ) , Ox . _ ( itemNamePlural ) ] ) , disabled : true } ]
: lists [ folder ] . map ( function ( list ) {
return {
id : 'viewlist' + list . id . replace ( /_/g , Ox . char ( 9 ) ) ,
title : Ox . encodeHTMLEntities ( (
folder == 'favorite' ? list . user + ': ' : ''
) + list . name ) ,
checked : list . id == ui . _list
} ;
} )
} ;
} ) ,
2023-07-07 06:16:09 +00:00
ui . hidden [ itemNamePlural . toLowerCase ( ) ] . length ? [
{
id : 'hiddenlists' ,
title : Ox . _ ( 'Hidden ' + itemNamePlural ) ,
items : ui . hidden [ itemNamePlural . toLowerCase ( ) ] . map ( id => {
return {
id : 'hidden:' + id . replace ( /_/g , Ox . char ( 9 ) ) ,
title : id
}
} )
}
] : [ ] ,
2016-10-04 22:00:03 +00:00
[
{ } ,
{ id : 'newlist' , title : Ox . _ ( 'New ' + itemNameSingular ) , disabled : isGuest , keyboard : 'control n' } ,
{ id : 'newlistfromselection' , title : Ox . _ ( 'New ' + itemNameSingular + ' from Selection' ) , disabled : disableFromSelection , keyboard : 'shift control n' } ,
{ id : 'newsmartlist' , title : Ox . _ ( 'New Smart ' + itemNameSingular ) , disabled : isGuest , keyboard : 'alt control n' } ,
{ id : 'newsmartlistfromresults' , title : Ox . _ ( 'New Smart ' + itemNameSingular + ' from Results' ) , disabled : isGuest , keyboard : 'shift alt control n' } ,
{ id : 'neweditfromselection' , title : Ox . _ ( 'New Edit from Selection' ) , disabled : disableFromSelection } ,
{ id : 'newsmarteditfromresults' , title : Ox . _ ( 'New Smart Edit from Results' ) , disabled : isGuest } ,
{ } ,
{ id : 'duplicatelist' , title : Ox . _ ( 'Duplicate Selected ' + itemNameSingular ) , disabled : disableEdit , keyboard : 'control d' } ,
{ id : 'editlist' , title : Ox . _ ( 'Edit Selected ' + itemNameSingular + '...' ) , disabled : disableEdit , keyboard : 'control e' } ,
{ id : 'deletelist' , title : Ox . _ ( 'Delete Selected ' + itemNameSingular + '...' ) , disabled : disableEdit , keyboard : 'delete' } ,
{ } ,
2023-07-07 06:16:09 +00:00
{ id : 'hidelist' , title : Ox . _ ( 'Hide Selected ' + itemNameSingular + '...' ) , disabled : disableEdit || ! pandora . $ui . folderList || ! pandora . $ui . folderList . personal . options ( 'selected' ) . length } ,
{ } ,
2016-10-04 22:00:03 +00:00
{ id : 'print' , title : Ox . _ ( 'Print' ) , keyboard : 'control p' } ,
{ id : 'tv' , title : Ox . _ ( 'TV' ) , keyboard : 'control space' }
]
) } ;
} ;
2013-08-02 16:03:23 +00:00
function getItemMenu ( ) {
2016-10-04 22:00:03 +00:00
if ( ui . section == 'documents' ) {
return getDocumentMenu ( ) ;
}
2013-08-02 16:03:23 +00:00
var listData = pandora . getListData ( ) ,
2016-09-15 15:20:24 +00:00
deleteVerb = ui . _list ? Ox . _ ( 'Remove' ) : Ox . _ ( 'Delete' ) ,
2014-02-12 08:09:18 +00:00
isEditable = listData . editable && listData . type == 'static' ,
2013-08-02 16:03:23 +00:00
isClipView = pandora . isClipView ( )
&& pandora . $ui . clipList
&& pandora . $ui . clipList . hasFocus ( ) ,
isVideoView = pandora . isVideoView ( )
&& pandora . $ui [ ui . itemView ]
&& pandora . $ui [ ui . itemView ] . hasFocus ( ) ,
2014-02-12 08:09:18 +00:00
isListView = ui . section == 'items' && ! ui . item
&& ! isClipView && ! isVideoView ,
isEditView = ui . section == 'edits' && ui . edit
&& ui . editView != 'annotations' , // FIXME: focus
listName = isVideoView || isClipView ? ''
2016-09-15 15:20:24 +00:00
: ui . section == 'items' ? (
2017-06-09 13:25:14 +00:00
ui . _list ? Ox . _ ( 'from List' ) : Ox . _ ( 'from Archive' )
2016-09-15 15:20:24 +00:00
)
2014-02-17 16:09:31 +00:00
: Ox . _ ( 'from Edit' ) ,
2013-08-02 17:38:26 +00:00
listItemsName = Ox . _ (
2014-02-12 08:09:18 +00:00
ui . section == 'edits' || isVideoView || isClipView ? 'Clips'
: pandora . site . itemName . plural
2013-08-02 17:38:26 +00:00
) ,
selectionItems = isVideoView ? 1
: isClipView ? pandora . $ui . clipList . options ( 'selected' ) . length
2014-02-12 08:09:18 +00:00
: isEditView ? ui . editSelection . length
2013-08-02 17:38:26 +00:00
: ui . listSelection . length ,
2014-02-12 08:09:18 +00:00
selectionItemName = (
selectionItems > 1 ? Ox . formatNumber ( selectionItems ) + ' ' : ''
) + Ox . _ (
2013-08-02 16:03:23 +00:00
isVideoView ? 'Clip'
2013-08-12 10:35:20 +00:00
: ui . section == 'edits' || isClipView ? ( selectionItems == 1 ? 'Clip' : 'Clips' )
2013-08-02 17:38:26 +00:00
: pandora . site . itemName [ selectionItems == 1 ? 'singular' : 'plural' ]
2013-08-02 16:03:23 +00:00
) ,
2013-08-03 15:01:47 +00:00
clipboardItems = pandora . clipboard . items ( ) ,
clipboardType = pandora . clipboard . type ( ) ,
2013-08-02 17:38:26 +00:00
clipboardItemName = clipboardItems == 0 ? ''
2014-02-12 08:09:18 +00:00
: (
clipboardItems > 1 ? Ox . formatNumber ( clipboardItems ) + ' ' : ''
) + Ox . _ (
2013-08-02 17:38:26 +00:00
clipboardType == 'item' ? pandora . site . itemName [ clipboardItems == 1 ? 'singular' : 'plural' ]
: clipboardType == 'clip' ? ( clipboardItems == 1 ? 'Clip' : 'Clips' )
2017-02-21 16:41:03 +00:00
: clipboardType == 'document' ? ( clipboardItems == 1 ? 'Document' : 'Documents' )
2013-08-02 17:38:26 +00:00
: ''
) ,
2017-02-17 18:25:20 +00:00
canEdit = pandora . hasCapability ( 'canEditMedia' ) || (
2016-09-15 15:20:24 +00:00
ui . section == 'items' && (
ui . item || (
Ox . contains ( [ 'list' , 'grid' , 'clips' , 'timelines' ] , ui . listView )
&& ui . listSelection . length == 1
)
2016-11-19 11:55:29 +00:00
) && pandora . $ui . list && pandora . $ui . list . value ( ui . listSelection [ 0 ] , 'editable' )
2016-09-15 15:20:24 +00:00
) ,
2016-10-04 22:00:03 +00:00
canDelete = (
2016-09-15 15:20:24 +00:00
ui . section == 'items' && (
ui . item || (
Ox . contains ( [ 'list' , 'grid' , 'clips' , 'timelines' ] , ui . listView )
&& ui . listSelection . length
)
2016-10-04 22:00:03 +00:00
) && (
2017-02-17 18:25:20 +00:00
pandora . hasCapability ( 'canRemoveItems' ) ||
2016-10-04 22:00:03 +00:00
ui . listSelection . every ( function ( item ) {
2016-11-19 11:55:29 +00:00
return pandora . $ui . list && pandora . $ui . list . value ( item , 'editable' ) ;
2016-10-04 22:00:03 +00:00
} )
)
2016-09-15 15:20:24 +00:00
) ,
2014-02-12 08:09:18 +00:00
canSelect = isListView || isClipView || isEditView ,
canCopy = isListView ? ui . listSelection . length
2013-08-02 16:03:23 +00:00
: isClipView ? pandora . $ui . clipList . options ( 'selected' ) . length
2014-02-12 08:09:18 +00:00
: isVideoView ? ui . videoPoints [ ui . item ] [ 'in' ] != ui . videoPoints [ ui . item ] . out
: isEditView && ui . editSelection . length ,
canCut = canCopy && isEditable ,
2017-02-21 16:41:03 +00:00
canPaste = ( (
2014-02-12 08:09:18 +00:00
( isListView && clipboardType == 'item' )
2017-02-21 16:41:03 +00:00
|| ( isEditView && clipboardType == 'document' )
) && isEditable )
|| ( ui . section == 'items' && ui . itemView == 'documents' && clipboardType == 'document' ) , // fixme: also check if item is editable: && pandora.$ui.list.value(ui.listSelection[0], 'editable')),
2014-02-12 08:09:18 +00:00
canAdd = canCopy && clipboardItems > 0
&& ( ( clipboardType == 'item' ) == isListView ) ,
2013-08-03 14:01:36 +00:00
historyItems = pandora . history . items ( ) ,
undoText = pandora . history . undoText ( ) ,
redoText = pandora . history . redoText ( ) ;
2017-06-09 13:25:14 +00:00
2013-08-02 16:03:23 +00:00
return { id : 'itemMenu' , title : Ox . _ ( 'Item' ) , items : [
2017-02-17 18:25:20 +00:00
{ id : 'add' , title : Ox . _ ( 'Add {0}...' , [ Ox . _ ( pandora . site . itemName . singular ) ] ) , disabled : ! pandora . hasCapability ( 'canAddItems' ) } ,
2016-09-15 15:20:24 +00:00
{ id : 'edit' , title : Ox . _ ( 'Edit {0}...' , [ Ox . _ ( pandora . site . itemName . singular ) ] ) , disabled : true /*fixme: !canEdit */ } ,
2018-09-18 21:17:32 +00:00
{ id : 'batchedit' , title : Ox . _ ( 'Batch Edit {0}...' , [ Ox . _ ( pandora . site . itemName . plural ) ] ) , disabled : ! pandora . enableBatchEdit ( ui . section ) , keyboard : 'shift control e' } ,
2013-08-02 16:03:23 +00:00
{ } ,
2013-08-02 17:38:26 +00:00
{ id : 'selectall' , title : Ox . _ ( 'Select All {0}' , [ listItemsName ] ) , disabled : ! canSelect , keyboard : 'control a' } ,
2013-08-02 16:03:23 +00:00
{ id : 'selectnone' , title : Ox . _ ( 'Select None' ) , disabled : ! canSelect , keyboard : 'shift control a' } ,
{ id : 'invertselection' , title : Ox . _ ( 'Invert Selection' ) , disabled : ! canSelect , keyboard : 'alt control a' } ,
{ } ,
2013-08-02 17:38:26 +00:00
{ id : 'cut' , title : Ox . _ ( 'Cut {0}' , [ selectionItemName ] ) , disabled : ! canCut , keyboard : 'control x' } ,
{ id : 'cutadd' , title : Ox . _ ( 'Cut and Add to Clipboard' ) , disabled : ! canCut || ! canAdd , keyboard : 'shift control x' } ,
{ id : 'copy' , title : Ox . _ ( 'Copy {0}' , [ selectionItemName ] ) , disabled : ! canCopy , keyboard : 'control c' } ,
{ id : 'copyadd' , title : Ox . _ ( 'Copy and Add to Clipboard' ) , disabled : ! canCopy || ! canAdd , keyboard : 'shift control c' } ,
{ id : 'paste' , title : clipboardItems == 0 ? Ox . _ ( 'Paste' ) : Ox . _ ( 'Paste {0}' , [ clipboardItemName ] ) , disabled : ! canPaste , keyboard : 'control v' } ,
2013-08-02 16:22:15 +00:00
{ id : 'clearclipboard' , title : Ox . _ ( 'Clear Clipboard' ) , disabled : ! clipboardItems } ,
{ } ,
2016-09-15 15:20:24 +00:00
{ id : 'delete' , title : Ox . _ ( '{0} {1} {2}' , [ deleteVerb , selectionItemName , listName ] ) , disabled : ! canDelete , keyboard : 'delete' } ,
2020-07-21 11:12:23 +00:00
ui . _list ? [
{ id : 'deletefromarchive' , title : Ox . _ ( '{0} {1} {2}' , [ Ox . _ ( 'Delete' ) , selectionItemName , Ox . _ ( 'from Archive' ) ] ) , disabled : ! canDelete }
] : [ ] ,
2013-08-02 16:03:23 +00:00
{ } ,
2013-08-03 14:01:36 +00:00
{ id : 'undo' , title : undoText ? Ox . _ ( 'Undo {0}' , [ undoText ] ) : Ox . _ ( 'Undo' ) , disabled : ! undoText , keyboard : 'control z' } ,
{ id : 'redo' , title : redoText ? Ox . _ ( 'Redo {0}' , [ redoText ] ) : Ox . _ ( 'Redo' ) , disabled : ! redoText , keyboard : 'shift control z' } ,
{ id : 'clearhistory' , title : Ox . _ ( 'Clear History' ) , disabled : ! historyItems }
2013-08-02 16:03:23 +00:00
] } ;
}
2014-01-19 09:41:38 +00:00
function getListMenu ( ) {
2016-10-04 22:00:03 +00:00
return ( {
items : getItemListMenu ,
documents : getCollectionMenu ,
edits : getEditMenu ,
texts : getTextMenu
} [ ui . section ] ) ( ) ;
}
function getTextMenu ( ) {
var itemNameSingular = 'Text' ,
itemNamePlural = 'Texts' ;
2013-07-15 14:20:11 +00:00
return { id : 'listMenu' , title : Ox . _ ( itemNameSingular ) , items : [ ] . concat (
{
id : 'allitems' ,
title : pandora . getAllItemsTitle ( ) ,
2016-10-04 22:00:03 +00:00
checked : ! ui . text ,
2013-07-15 14:20:11 +00:00
keyboard : 'shift control w'
} ,
2011-09-27 14:14:40 +00:00
[ 'personal' , 'favorite' , 'featured' ] . map ( function ( folder ) {
return {
id : folder + 'lists' ,
2013-07-15 14:20:11 +00:00
title : Ox . _ ( Ox . toTitleCase ( folder ) + ' ' + itemNamePlural ) ,
2014-01-19 09:41:38 +00:00
items : Ox . isUndefined ( lists [ folder ] )
2013-05-09 10:13:58 +00:00
? [ { id : 'loading' , title : Ox . _ ( 'Loading...' ) , disabled : true } ]
2011-11-07 12:12:13 +00:00
: lists [ folder ] . length == 0
2014-02-14 15:23:59 +00:00
? [ { id : 'nolists' , title : Ox . _ ( 'No {0} {1}' ,
[ Ox . _ ( Ox . toTitleCase ( folder ) ) , Ox . _ ( itemNamePlural ) ] ) , disabled : true } ]
2011-11-07 12:12:13 +00:00
: lists [ folder ] . map ( function ( list ) {
2011-09-27 14:14:40 +00:00
return {
2013-08-14 20:21:12 +00:00
id : 'viewlist' + list . id . replace ( /_/g , Ox . char ( 9 ) ) ,
2012-02-22 10:14:07 +00:00
title : Ox . encodeHTMLEntities ( (
folder == 'favorite' ? list . user + ': ' : ''
) + list . name ) ,
2016-10-04 22:00:03 +00:00
checked : list . id == ui . text
2011-09-27 14:14:40 +00:00
} ;
2011-11-07 12:12:13 +00:00
} )
2011-09-27 14:14:40 +00:00
} ;
} ) ,
[
{ } ,
2013-07-15 14:20:11 +00:00
{ id : 'newlist' , title : Ox . _ ( 'New ' + itemNameSingular ) , disabled : isGuest , keyboard : 'control n' } ,
2014-02-06 07:46:15 +00:00
{ id : 'newpdf' , title : Ox . _ ( 'New PDF' ) , disabled : isGuest , keyboard : 'alt control n' } ,
2011-12-22 15:48:48 +00:00
{ } ,
2016-10-04 22:00:03 +00:00
{ id : 'editlist' , title : Ox . _ ( 'Edit Selected ' + itemNameSingular + '...' ) , disabled : isGuest , keyboard : 'control e' } ,
{ id : 'deletelist' , title : Ox . _ ( 'Delete Selected ' + itemNameSingular + '...' ) , disabled : isGuest , keyboard : 'delete' }
]
2011-09-27 14:14:40 +00:00
) } ;
2016-10-04 22:00:03 +00:00
}
function getCollectionSortMenu ( ) {
var isClipView = false ,
clipItems = [ ] . concat ( ! ui . document ? pandora . site . documentSortKeys . map ( function ( key ) {
return Ox . extend ( {
checked : ui . collectionSort [ 0 ] . key == key . id
} , key ) ;
} ) : [ ] ) ;
return { id : 'sortMenu' , title : Ox . _ ( 'Sort' ) , items : [
{ id : 'sortitems' , title : Ox . _ ( 'Sort {0} by' , [ Ox . _ ( 'Documents' ) ] ) , disabled : ui . document , items : [
{ group : 'documentsort' , min : 1 , max : 1 , items : pandora . site . documentSortKeys . map ( function ( key ) {
return Ox . extend ( {
checked : ui . collectionSort [ 0 ] . key == key . id
} , key , {
title : Ox . _ ( key . title )
} ) ;
} ) }
] } ,
{ id : 'orderitems' , title : Ox . _ ( 'Order {0}' , [ Ox . _ ( 'Documents' ) ] ) , disabled : ui . document , items : [
{ group : 'documentorder' , min : 1 , max : 1 , items : [
{ id : 'ascending' , title : Ox . _ ( 'Ascending' ) , checked : ( ui . collectionSort [ 0 ] . operator || pandora . getSortOperator ( ui . collectionSort [ 0 ] . key ) ) == '+' } ,
{ id : 'descending' , title : Ox . _ ( 'Descending' ) , checked : ( ui . collectionSort [ 0 ] . operator || pandora . getSortOperator ( ui . collectionSort [ 0 ] . key ) ) == '-' }
] }
] } ,
{ id : 'advancedsort' , title : Ox . _ ( 'Advanced Sort...' ) , keyboard : 'shift control s' , disabled : true } ,
] } ;
}
2011-09-27 14:14:40 +00:00
2019-12-02 19:09:49 +00:00
function getSectionViews ( ) {
if ( ui . section == 'documents' ) {
return [
{ id : 'documents' , title : Ox . _ ( 'View Documents' ) , items : [
{ group : 'collectionview' , min : 1 , max : 1 , items : pandora . site . listViews . filter ( function ( view ) {
2021-11-15 15:20:08 +00:00
return Ox . contains ( [ 'list' , 'grid' , 'pages' ] , view . id )
2019-12-02 19:09:49 +00:00
} ) . map ( function ( view ) {
return Ox . extend ( {
checked : ui . collectionView == view . id
} , view , {
keyboard : listViewKey <= 10
? 'shift ' + ( listViewKey ++ % 10 )
: void 0 ,
title : Ox . _ ( view . title )
} ) ;
} ) } ,
] } ,
{ id : 'filters' , title : Ox . _ ( 'Filters' ) , items : [
{ group : 'filters' , min : 5 , max : 5 , items : pandora . site . documentFilters . map ( function ( filter ) {
return Ox . extend ( {
checked : Ox . getIndexById ( ui . documentFilters , filter . id ) > - 1
} , filter , {
title : Ox . _ ( filter . title )
} ) ;
} ) } ,
{ } ,
{ id : 'resetfilters' , title : Ox . _ ( 'Reset Filters' ) }
] } ,
]
} else {
return [
{ id : 'movies' , title : Ox . _ ( 'View {0}' , [ Ox . _ ( pandora . site . itemName . plural ) ] ) , items : [
{ group : 'listview' , min : 1 , max : 1 , items : pandora . site . listViews . map ( function ( view ) {
return Ox . extend ( {
checked : ui . listView == view . id
} , view , {
keyboard : listViewKey <= 10
? 'shift ' + ( listViewKey ++ % 10 )
: void 0 ,
title : Ox . _ ( view . title )
} ) ;
} ) } ,
] } ,
{ id : 'icons' , title : Ox . _ ( 'Icons' ) , items : [ ] . concat ( [
{ group : 'viewicons' , min : 1 , max : 1 , items : [ 'posters' , 'frames' ] . map ( function ( icons ) {
return { id : icons , title : Ox . _ ( Ox . toTitleCase ( icons ) ) , checked : ui . icons == icons } ;
} ) } ,
{ } ,
] , pandora . site . media . importPosters ? [
{ id : 'showsiteposters' , title : Ox . _ ( 'Always Show {0} Poster' , [ pandora . site . site . name ] ) , checked : ui . showSitePosters } ,
{ }
] : [ ] , [
{ id : 'showreflections' , title : Ox . _ ( 'Show Reflections' ) , checked : true , disabled : true }
]
) } ,
{ id : 'timelines' , title : Ox . _ ( 'Timelines' ) , items : [
{ group : 'viewtimelines' , min : 1 , max : 1 , items : pandora . site . timelines . map ( function ( mode ) {
return { id : mode . id , title : Ox . _ ( mode . title ) , checked : ui . videoTimeline == mode . id } ;
} ) }
] } ,
{ id : 'columns' , title : Ox . _ ( 'Columns' ) , items : [
{ id : 'loadcolumns' , title : Ox . _ ( 'Load Layout...' ) , disabled : true } ,
{ id : 'savecolumns' , title : Ox . _ ( 'Save Layout...' ) , disabled : true } ,
{ } ,
{ id : 'resetcolumns' , title : Ox . _ ( 'Reset Layout' ) , disabled : true }
] } ,
{ id : 'filters' , title : Ox . _ ( 'Filters' ) , disabled : ui . section != 'items' , items : [
{ group : 'filters' , min : 5 , max : 5 , items : pandora . site . filters . map ( function ( filter ) {
return Ox . extend ( {
checked : Ox . getIndexById ( ui . filters , filter . id ) > - 1
} , filter , {
title : Ox . _ ( filter . title )
} ) ;
} ) } ,
{ } ,
{ id : 'resetfilters' , title : Ox . _ ( 'Reset Filters' ) }
] } ,
{ } ,
{ id : 'item' , title : [
Ox . _ ( 'Open {0}' , [ Ox . _ ( pandora . site . itemName . singular ) ] ) ,
Ox . _ ( 'Open {0}' , [ Ox . _ ( pandora . site . itemName . plural ) ] )
] , items : [
2023-07-08 13:43:14 +00:00
{
group : 'itemview' ,
min : 1 ,
max : 1 ,
items : [ ] . concat (
pandora . site . itemViews . filter ( function ( view ) {
return view . id != 'data' && view . id != 'media'
} ) . map ( function ( view ) {
return Ox . extend ( {
checked : ui . itemView == view . id
} , view , {
keyboard : itemViewKey <= 10
? 'shift ' + ( itemViewKey ++ % 10 )
: void 0 ,
title : Ox . _ ( view . title )
} ) ;
} ) ,
pandora . hasCapability ( 'canSeeExtraItemViews' ) ? [ { } ] : [ ] ,
pandora . hasCapability ( 'canSeeExtraItemViews' )
? pandora . site . itemViews . filter ( function ( view ) {
return view . id == 'data' || view . id == 'media'
} ) . map ( function ( view ) {
return Ox . extend ( {
checked : ui . itemView == view . id
} , view , {
keyboard : itemViewKey <= 10
? 'shift ' + ( itemViewKey ++ % 10 )
: void 0 ,
title : Ox . _ ( view . title )
} ) ;
} )
: [ ] ,
)
} ,
2019-12-02 19:09:49 +00:00
] } ,
{ id : 'clips' , title : Ox . _ ( 'Open Clips' ) , items : [
{ group : 'videoview' , min : 1 , max : 1 , items : [ 'player' , 'editor' , 'timeline' ] . map ( function ( view ) {
return { id : view , title : Ox . _ ( Ox . toTitleCase ( view ) ) , checked : ui . videoView == view } ;
} ) }
] } ,
{ id : 'documents' , title : Ox . _ ( 'Open Documents' ) , items : [
{ group : 'documentview' , min : 1 , max : 1 , items : [ 'info' , 'view' ] . map ( function ( id ) {
return {
id : id ,
checked : ui . documentView == id ,
keyboard : documentViewKey <= 10
? 'shift ' + ( documentViewKey ++ % 10 )
: void 0 ,
title : Ox . _ ( Ox . toTitleCase ( id ) )
}
} ) }
] }
]
}
}
2011-09-27 14:14:40 +00:00
function getSortMenu ( ) {
2016-10-04 22:00:03 +00:00
if ( ui . section == 'documents' ) {
return getCollectionSortMenu ( ) ;
}
//fixme split items/clips menu
2013-07-15 14:20:11 +00:00
var isClipView = pandora . isClipView ( ) ,
2013-02-11 09:00:16 +00:00
clipItems = ( isClipView ? pandora . site . clipKeys . map ( function ( key ) {
2012-03-21 09:22:31 +00:00
return Ox . extend ( Ox . clone ( key ) , {
checked : ui . listSort [ 0 ] . key == key . id ,
2013-05-09 10:13:58 +00:00
title : ( ! ui . item ? Ox . _ ( 'Clip' ) + ' ' : '' ) + Ox . _ ( key . title )
2012-03-21 09:22:31 +00:00
} ) ;
2013-02-11 09:00:16 +00:00
} ) : [ ] ) . concat ( ! ui . item ? pandora . site . sortKeys . map ( function ( key ) {
return Ox . extend ( {
checked : ui . listSort [ 0 ] . key == key . id
} , key ) ;
} ) : [ ] ) ;
2013-05-09 10:13:58 +00:00
return { id : 'sortMenu' , title : Ox . _ ( 'Sort' ) , items : [
2013-07-14 10:21:50 +00:00
{ id : 'sortitems' , title : Ox . _ ( 'Sort {0} by' , [ Ox . _ ( pandora . site . itemName . plural ) ] ) , disabled : ui . section != 'items' || ( ! ui . item && isClipView ) , items : [
2013-02-11 09:00:16 +00:00
{ group : 'itemsort' , min : 1 , max : 1 , items : pandora . site . sortKeys . map ( function ( key ) {
return Ox . extend ( {
checked : ui . listSort [ 0 ] . key == key . id
2013-05-09 10:13:58 +00:00
} , key , {
title : Ox . _ ( key . title )
} ) ;
2013-02-11 09:00:16 +00:00
} ) }
] } ,
2013-07-14 10:21:50 +00:00
{ id : 'orderitems' , title : Ox . _ ( 'Order {0}' , [ Ox . _ ( pandora . site . itemName . plural ) ] ) , disabled : ui . section != 'items' || ( ! ui . item && isClipView ) , items : [
2013-02-11 09:00:16 +00:00
{ group : 'itemorder' , min : 1 , max : 1 , items : [
2013-05-09 10:13:58 +00:00
{ id : 'ascending' , title : Ox . _ ( 'Ascending' ) , checked : ( ui . listSort [ 0 ] . operator || pandora . getSortOperator ( ui . listSort [ 0 ] . key ) ) == '+' } ,
{ id : 'descending' , title : Ox . _ ( 'Descending' ) , checked : ( ui . listSort [ 0 ] . operator || pandora . getSortOperator ( ui . listSort [ 0 ] . key ) ) == '-' }
2013-02-11 09:00:16 +00:00
] }
] } ,
2013-05-09 10:13:58 +00:00
{ id : 'sortclips' , title : Ox . _ ( 'Sort Clips by' ) , disabled : ! isClipView , items : [
2013-02-11 09:00:16 +00:00
{ group : 'clipsort' , min : 1 , max : 1 , items : clipItems }
2011-09-27 14:14:40 +00:00
] } ,
2013-05-09 10:13:58 +00:00
{ id : 'orderclips' , title : Ox . _ ( 'Order Clips' ) , disabled : ! isClipView , items : [
2013-02-11 09:00:16 +00:00
{ group : 'cliporder' , min : 1 , max : 1 , items : [
2013-05-09 10:13:58 +00:00
{
id : 'ascending' ,
title : Ox . _ ( 'Ascending' ) ,
checked : ( ui . listSort [ 0 ] . operator || pandora . getSortOperator ( ui . listSort [ 0 ] . key ) ) == '+'
} ,
2016-10-04 22:00:03 +00:00
{
2013-05-09 10:13:58 +00:00
id : 'descending' ,
title : Ox . _ ( 'Descending' ) ,
2016-10-04 22:00:03 +00:00
checked : ( ui . listSort [ 0 ] . operator || pandora . getSortOperator ( ui . listSort [ 0 ] . key ) ) == '-'
2013-05-09 10:13:58 +00:00
}
2011-09-27 14:14:40 +00:00
] }
] } ,
2013-05-09 10:13:58 +00:00
{ id : 'advancedsort' , title : Ox . _ ( 'Advanced Sort...' ) , keyboard : 'shift control s' , disabled : true } ,
2011-09-27 14:14:40 +00:00
{ } ,
2013-07-15 14:20:11 +00:00
{ id : 'sortfilters' , title : Ox . _ ( 'Sort Filters' ) , disabled : ui . section != 'items' , items : ui . filters . map ( function ( filter ) {
2011-09-27 14:14:40 +00:00
return {
2011-11-06 08:28:10 +00:00
id : 'sortfilter' + filter . id ,
2013-05-09 10:13:58 +00:00
title : Ox . _ ( 'Sort {0} Filter by' , [ Ox . _ ( Ox . getObjectById ( pandora . site . filters , filter . id ) . title ) ] ) ,
2011-09-27 14:14:40 +00:00
items : [
2011-11-06 08:28:10 +00:00
{ group : 'sortfilter' + filter . id , min : 1 , max : 1 , items : [
2013-05-09 10:13:58 +00:00
{ id : 'name' , title : Ox . _ ( 'Name' ) , checked : filter . sort [ 0 ] . key == 'name' } ,
{ id : 'items' , title : Ox . _ ( 'Items' ) , checked : filter . sort [ 0 ] . key == 'items' }
2011-09-27 14:14:40 +00:00
] }
]
}
} ) } ,
2013-07-15 14:20:11 +00:00
{ id : 'orderfilters' , title : Ox . _ ( 'Order Filters' ) , disabled : ui . section != 'items' , items : ui . filters . map ( function ( filter ) {
2011-09-27 14:14:40 +00:00
return {
2011-11-06 08:28:10 +00:00
id : 'orderfilter' + filter . id ,
2013-05-09 10:13:58 +00:00
title : Ox . _ ( 'Order {0} Filter' , [ Ox . _ ( Ox . getObjectById ( pandora . site . filters , filter . id ) . title ) ] ) ,
2011-09-27 14:14:40 +00:00
items : [
2011-11-06 08:28:10 +00:00
{ group : 'orderfilter' + filter . id , min : 1 , max : 1 , items : [
2013-05-09 10:13:58 +00:00
{ id : 'ascending' , title : Ox . _ ( 'Ascending' ) , checked : filter . sort [ 0 ] . operator == '+' } ,
{ id : 'descending' , title : Ox . _ ( 'Descending' ) , checked : filter . sort [ 0 ] . operator == '-' }
2011-09-27 14:14:40 +00:00
] }
]
}
} ) }
] } ;
}
2019-12-02 19:09:49 +00:00
function getViewMenu ( ) {
return { id : 'viewMenu' , title : Ox . _ ( 'View' ) , items : [
{ id : 'section' , title : Ox . _ ( 'Section' ) , items : [
2023-12-02 16:18:50 +00:00
{ group : 'viewsection' , min : 1 , max : 1 , items : Ox . clone ( pandora . site . sections , true ) . map ( function ( section ) {
section . title = Ox . _ ( section . title ) ;
2019-12-09 13:12:44 +00:00
section . checked = section . id == ui . section ;
return section ;
2019-12-02 19:09:49 +00:00
} ) }
] } ,
{ } ,
getSectionViews ( ) ,
{ } ,
{
id : 'showsidebar' ,
title : Ox . _ ( ( ui . showSidebar ? 'Hide' : 'Show' ) + ' Sidebar' ) ,
keyboard : 'shift s'
} ,
{
id : 'showinfo' ,
title : Ox . _ ( ( ui . showInfo ? 'Hide' : 'Show' ) + ' Info' ) ,
disabled : ! ui . showSidebar , keyboard : 'shift i'
} ,
{
id : 'showfilters' ,
title : Ox . _ ( ( ui . showFilters ? 'Hide' : 'Show' ) + ' Filters' ) ,
2020-02-13 20:35:42 +00:00
disabled : (
! Ox . contains ( [ 'items' , 'documents' ] , ui . section ) ||
( ui . section == 'items' && ! ! ui . item ) ||
( ui . section == 'documents' && ! ! ui . document )
) , keyboard : 'shift f'
2019-12-02 19:09:49 +00:00
} ,
{
id : 'showbrowser' ,
title : Ox . _ ( ( ui . showBrowser ? 'Hide' : 'Show' ) + ' {0} Browser' , [ Ox . _ ( pandora . site . itemName . singular ) ] ) ,
disabled : ! ui . item , keyboard : 'shift b'
} ,
{
id : 'showdocument' ,
title : Ox . _ ( ( ui . showDocument ? 'Hide' : 'Show' ) + ' Document' ) ,
disabled : ! hasDocument ( ) , keyboard : 'shift d'
} ,
{
id : 'showtimeline' ,
title : Ox . _ ( ( ui . showTimeline ? 'Hide' : 'Show' ) + ' Timeline' ) ,
disabled : ! hasTimeline ( ) , keyboard : 'shift t'
} ,
{
id : 'showannotations' ,
title : Ox . _ ( ( ui . showAnnotations ? 'Hide' : 'Show' ) + ' Annotations' ) ,
disabled : ! hasAnnotations ( ) , keyboard : 'shift a'
} ,
{
id : 'showclips' ,
title : Ox . _ ( ( ui . showClips ? 'Hide' : 'Show' ) + ' Clips' ) ,
disabled : ! hasClips ( ) , keyboard : 'shift c'
} ,
{ } ,
{
id : 'togglefullscreen' ,
title : Ox . _ ( ( fullscreenState ? 'Exit' : 'Enter' ) + ' Fullscreen' ) ,
disabled : fullscreenState === void 0 ,
keyboard : /^Mac/ . test ( window . navigator . platform )
? 'shift alt f'
: 'F11'
} ,
{
id : 'entervideofullscreen' ,
title : Ox . _ ( 'Enter Video Fullscreen' ) ,
disabled : ! ui . item || ui . itemView != 'player'
} ,
{ } ,
{ id : 'theme' , title : Ox . _ ( 'Theme' ) , items : [
{ group : 'settheme' , min : 1 , max : 1 , items : pandora . site . themes . map ( function ( theme ) {
return { id : theme , title : Ox . Theme . getThemeData ( theme ) . themeName , checked : ui . theme == theme }
} ) }
] } ,
{ id : 'locale' ,
title : Ox . _ ( 'Language' ) , items : [
{ group : 'setlocale' , min : 1 , max : 1 , items : pandora . site . languages . map ( function ( locale ) {
return { id : locale , title : Ox . LOCALE _NAMES [ locale ] , checked : ui . locale == locale }
} ) }
] } ,
{ } ,
2023-07-15 06:34:04 +00:00
{ id : 'embed' , title : Ox . _ ( 'Embed...' ) } ,
2023-08-04 12:28:42 +00:00
{ id : 'share' , title : Ox . _ ( 'Share...' ) , disabled : ! pandora . canShareView ( ) }
2019-12-02 19:09:49 +00:00
] }
}
2013-07-14 09:27:27 +00:00
function hasAnnotations ( ) {
2013-08-02 16:03:23 +00:00
return ui . section == 'items' && ui . item && pandora . isVideoView ( ) ;
2013-07-14 09:27:27 +00:00
}
function hasClips ( ) {
return ui . section == 'edits' && ui . edit ;
}
2014-01-06 12:34:49 +00:00
function hasDocument ( ) {
return ui . section == 'items' && ui . item && ui . itemView == 'documents' ;
}
2013-07-14 09:27:27 +00:00
function hasTimeline ( ) {
return (
ui . section == 'items' && ui . item && ui . itemView == 'player'
) || (
ui . section == 'edits' && ui . edit
) ;
}
2013-08-02 16:03:23 +00:00
that . replaceItemMenu = function ( ) {
2013-08-02 17:01:24 +00:00
that . replaceMenu ( 'itemMenu' , getItemMenu ( ) ) ;
2013-08-02 16:03:23 +00:00
return that ;
} ;
2014-01-19 09:41:38 +00:00
that . updateLists = function ( folder , items ) {
lists [ folder ] = items ;
if ( Ox . len ( lists ) == 3 ) {
pandora . $ui . mainMenu . replaceMenu ( 'listMenu' , getListMenu ( ) ) ;
}
} ;
2011-09-18 01:52:43 +00:00
2011-05-25 19:42:45 +00:00
return that ;
2011-09-27 22:12:37 +00:00
2011-05-25 19:42:45 +00:00
} ;