Files
alfresco-community-repo/source/web/scripts/office/navigation.js
Kevin Roast 189422edce Merged V3.2E to HEAD
17495: Changed xforms-samples name to wcm-sample
   17496: Minor fixes for day and week views when rendering new events
   17497: *RECORD ONLY* Added Enterprise logo local copy.
   17498: ETHREEOH-2933 - User can see contents of the moderated site if user is not a member of the site
          - Site containers are now private and non member's can't see content.
          - fix only applies to new moderated sites.
   17499: ETHREEOH-2322 - Office Plugin: filename overlaps the plugin UI if longer than 40 characters without spaces
   17500: Temorary build fix for site visibility
   17508: ETHREEOH-1268 - Pages and Components show varying degrees of success handling "site not found" errors.
   17509: Fix for ETHREEOH1733 - Wrong display of multi day events in Share
   17514: View In Browser action for document list and document details actions.
   17515: Merged DEV-TEMPORARY to V3.2
      17471: ETHREEOH-3193: 'capitalize' in output path pattern works differently for templates (vs. XSDs)
   17516: Missing css file from Edit Offline changes. Also "Checked out on/by" text changed to "Editing started on/by". Tags now comma separated
   17517: Merged DEV-TEMPORARY to V3.2
      17474: ETHREEOH-1211: Can't See Images in TinyMCE
   17518: Office add-in: ETHREEOH-3361 - Workflow name is visible only before symbol &, ETHREEOH-2735 - Total number of founded items is not shown
   17519: 3.2E help links
   17520: 3.2E help links, plus ETHREEOH-1536 - Incorrect "insert into current document" function work for unsupported files in MS Office Addin
   17522: Fix for ETHREEOH-3257 - Event becomes All day again after editing it to not All day
   17526: Fix for unreported issue when rendering an edited event after the view is filtered via tag component causes an script error
   17528: Fixed ETHREEOH-3364 " Admin Console - Group Search needs to show searching message and disable further requests while search is running"
          - Disabling search button & message displaying "Searching..." after 2 seconds for long searches for the following components:
             * Admin Console: Users - search user, add group
             * Admin Console: Groups - search group, add group, add user
             * Site: Members: People - search members, add people
             * Site: Members: Groups - search membergroups, add group
             * Site: Members: Pending invites - search invites
             * Site: Doclib: Assign Workflow - add users
             * People Finder 
             * Site Finder
          - All component listed above uses max search result except the following where webscript services lacks support for it:
             * Admin Console: Users - add group
             * Admin Console: Groups - search group, add group
             * Site: Members: Pending invites - search invites
          - Bugfix: When minSearchTermLength is set to 0:
             * Group Admin Console: switched to browse view
             * User Admin Console: didnt do a search
          - Bugfix: For some components minSearchTermLength & maxSearchResults were brought in as strings causing the global search's max result to be 1001 instead of 101

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18126 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2010-01-19 11:50:05 +00:00

344 lines
9.6 KiB
JavaScript

/*
* Prerequisites: mootools.v1.11.js
* office_addin.js
*/
var OfficeNavigation =
{
TOGGLE_AMOUNT: 150,
ANIM_LENGTH: 800,
CREATE_SPACE_HEIGHT: 108,
CREATE_SPACE_TEMPLATE: 16,
OVERLAY_ANIM_LENGTH: 300,
OVERLAY_OPACITY: 0.7,
documentNames: [],
init: function()
{
$('overlayPanel').setStyle('opacity', 0);
OfficeNavigation.setupToggles();
OfficeNavigation.setupCreateSpace();
OfficeNavigation.getDocumentNames();
// Did we arrive here from the "Create collaboration space" shortcut?
if (window.queryObject.cc)
{
OfficeNavigation.showCreateSpace();
}
},
setupToggles: function()
{
// Elements of interest
var panels = $$('.togglePanel'),
toggles = $$('.toggle'),
toggle;
// Animation
var fxPanel = new Fx.Elements(panels,
{
wait: false,
duration: OfficeNavigation.ANIM_LENGTH,
transition: Fx.Transitions.Back.easeInOut
});
panels.each(function(panel, i)
{
toggle = toggles[i];
panel.defaultHeight = panel.getStyle('height').toInt();
panel.isToggled = false;
toggle.addEvent('click', function(e)
{
var animPanel = {};
if (panel.isToggled)
{
panel.isToggled = false;
this.removeClass('toggled');
animPanel[i] =
{
'height': [panel.getStyle('height').toInt(), panel.defaultHeight]
};
// reset all other panels
panels.each(function(otherPanel, j)
{
if (otherPanel != panel)
{
// reset panel
otherPanel.isToggled = false;
toggles[j].removeClass('toggled');
animPanel[j] =
{
'height': [otherPanel.getStyle('height').toInt(), otherPanel.defaultHeight]
};
}
});
}
else
{
panel.isToggled = true;
this.addClass('toggled');
animPanel[i] =
{
'height': [panel.getStyle('height').toInt(), panel.defaultHeight + (OfficeNavigation.TOGGLE_AMOUNT * (panels.length - 1))]
};
// set all other panels
panels.each(function(otherPanel, j)
{
if (otherPanel != panel)
{
// set panel
otherPanel.isToggled = false;
toggles[j].removeClass('toggled');
animPanel[j] =
{
'height': [otherPanel.getStyle('height').toInt(), otherPanel.defaultHeight - OfficeNavigation.TOGGLE_AMOUNT]
};
}
});
}
fxPanel.start(animPanel);
});
});
},
setupCreateSpace: function()
{
var panel = $('createSpacePanel');
panel.defaultHeight = 0;
panel.setStyle('display', 'block');
panel.setStyle('height', panel.defaultHeight);
},
getDocumentNames: function()
{
OfficeNavigation.documentNames = [];
$$("#documentList .notVersionable").each(function(doc, i)
{
OfficeNavigation.documentNames.push(doc.getText());
});
},
showCreateSpace: function()
{
var panel = $('createSpacePanel');
// Animation
var fxPanel = new Fx.Style(panel, 'height',
{
duration: OfficeNavigation.ANIM_LENGTH,
transition: Fx.Transitions.Back.easeOut,
onComplete: function()
{
$('spaceName').focus();
}
});
if (!panel.isOpen)
{
panel.isOpen = true;
var openHeight = OfficeNavigation.CREATE_SPACE_HEIGHT;
if ($('spaceTemplate'))
{
openHeight += OfficeNavigation.CREATE_SPACE_TEMPLATE;
}
fxPanel.start(panel.getStyle('height').toInt(), openHeight);
}
else
{
OfficeNavigation.hideCreateSpace();
}
},
hideCreateSpace: function()
{
var panel = $('createSpacePanel');
// Animation
var fxPanel = new Fx.Style(panel, 'height',
{
duration: OfficeNavigation.ANIM_LENGTH,
transition: Fx.Transitions.Back.easeIn,
onComplete: function()
{
panel.isOpen = false;
}
});
fxPanel.start(panel.getStyle('height').toInt(), panel.defaultHeight);
},
submitCreateSpace: function(commandURL, nodeId)
{
var spaceName = $('spaceName').value,
spaceTitle = $('spaceTitle').value,
spaceDescription = $('spaceDescription').value;
var spaceTemplate;
if ($('spaceTemplate'))
{
spaceTemplate = $('spaceTemplate').value;
}
OfficeAddin.showStatusText("Creating space...", "ajax_anim.gif", false);
var actionURL = commandURL + "?a=newspace&p=" + nodeId;
actionURL += "&sn=" + encodeURIComponent(spaceName);
actionURL += "&st=" + encodeURIComponent(spaceTitle);
actionURL += "&sd=" + encodeURIComponent(spaceDescription);
actionURL += "&t=" + encodeURIComponent(spaceTemplate);
var myAjax = new Ajax(actionURL,
{
method: 'get',
headers:
{
'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'
},
onComplete: function(textResponse, xmlResponse)
{
// Remove any trailing hash
var href = window.location.href.replace("#", "");
// Remove any "st" and "cc" parameters
href = OfficeAddin.removeParameters(href, "st|cc");
// Optionally add a status string
if (textResponse !== "")
{
href += (href.indexOf("?") == -1) ? "?" : "&";
href += "st=" + encodeURIComponent(textResponse);
}
window.location.href = href;
}
});
myAjax.request();
},
saveToAlfresco: function(currentPath)
{
// Does the current doc have an extension? - async request
ExternalComponent.docHasExtension(function()
{
ExternalComponent.saveToAlfresco(currentPath);
}, function()
{
OfficeNavigation.showSaveFilenamePanel(currentPath);
});
},
showSaveFilenamePanel: function(currentPath)
{
this.fxOverlay = $("overlayPanel").effect('opacity',
{
duration: OfficeNavigation.OVERLAY_ANIM_LENGTH
});
var panel = $("saveDetailsPanel");
panel.setStyle("opacity", 0);
panel.setStyle("display", "inline");
var fnToggleOK = function()
{
var pattern = new RegExp(/([\"\*\\\><\?\/\:\|]+)|([\.]?[\.]+$)/),
filename = $('saveFilename').value;
if (filename.trim() === "" || pattern.test(filename))
{
$('saveFilenameOK').addClass('disabled');
}
else
{
$('saveFilenameOK').removeClass('disabled');
}
};
fnToggleOK();
var anim = new Fx.Styles(panel,
{
duration: OfficeNavigation.ANIM_LENGTH,
transition: Fx.Transitions.linear,
onComplete: function()
{
$('saveFilename').addEvent('keypress', function(event)
{
event = new Event(event);
if (event.key == 'enter')
{
OfficeNavigation.saveOK();
event.stop();
this.removeEvent('keypress');
this.removeEvent('keyup');
}
else if (event.key == 'esc')
{
OfficeNavigation.saveCancel();
event.stop();
this.removeEvent('keypress');
this.removeEvent('keyup');
}
});
$('saveFilename').addEvent('keyup', function(event)
{
fnToggleOK();
});
$('saveFilename').focus();
}
}).start({'opacity': 1});
this.fxOverlay.start(OfficeNavigation.OVERLAY_OPACITY);
if (panel !== null)
{
this.popupPanel = panel;
this.popupPanel.currentPath = currentPath;
}
},
saveOK: function()
{
// Shortcut for double-event firing issue
if (this.popupPanel === null)
{
return;
}
var filename = $('saveFilename').value.trim(),
currentPath = this.popupPanel.currentPath,
cancelSave = false;
if (filename.length > 0)
{
// Trying to save over an existing non-versionable doc?
OfficeNavigation.documentNames.each(function(doc, i)
{
if ((doc == filename) || (doc == filename + ".doc"))
{
if (!window.confirm("The document exists and is not versionable. Overwrite this file?"))
{
cancelSave = true;
}
}
});
if (!cancelSave)
{
ExternalComponent.saveToAlfrescoAs(currentPath, filename);
}
}
OfficeNavigation.saveCancel();
},
saveCancel: function()
{
if (this.popupPanel !== null)
{
this.popupPanel.setStyle("display", "none");
this.popupPanel = null;
}
if (this.fxOverlay)
{
this.fxOverlay.start(0);
}
}
};
window.addEvent('domready', OfficeNavigation.init);