views.js
来自「Hippo CMS是一个以信息为中心的开源内容管理系统。Hippo CMS目标是」· JavaScript 代码 · 共 2,427 行 · 第 1/5 页
JS
2,427 行
function create() {
//because IE waits with filling the Iframe with elements until
//init phase is over, create the div here
var pFrame = this.context.get("pcontainer");
if(this.context.get("browser") == 'IE') {
this.ele = pFrame.createView(this.config.id, this.config.style);
}
else if(this.context.get("browser") == 'MOZ') {
this.ele = pFrame.createView(this.config.id, this.config.style);
}
else if(this.context.get("browser") == 'OPR') {
this.ele = pFrame.createView(this.config.id, this.config.style);
}
}
function activate() {
if (this.log.debugging) {
this.log.debug('activating');
}
if(!this.loaded){
this.create();
//alert("Waiting for " + this.config.id);
//window.parent.queueAsBusy();
if (this.ele)
{
this.ele.innerHTML = '<div class="loading"><img class="unselectable" unselectable="on" src="/skin/images/loaders/ajax-loader-small.gif" alt="loadingclock"/> ' + this.context.get("loadingLabel") + '</div>';
var reqParams = this.config.bootRequestParams?this.config.bootRequestParams:null;
this.sm.lookup("framework.rc").doCall(this.config.appUrl + this.config.bootParam, this, reqParams);
// set initial resourceID necessary for refreshing view after an action
this.resourceID = [{key: 'url', val: this.config.bootParam}];
if (this.log.debugging()) {
this.log.debug("set resourceID to: " + this.resourceID);
}
this.loaded = true;
}
if(this.ele)
{
this.ele.view=this.log.category;
this.log.debug("set container view to "+this.log.category);
}
else
this.log.debug("no container to set view on!");
}
this.activated = true;
this.paused = false;
}
function deactivate() {
if (this.log.debugging) {
this.log.debug('deactivating');
}
xHide(this.id);
xNoDisplay(this.id);
this.activated = false;
this.paused = true;
}
function load(str){
if (this.log.debugging) {
this.log.debug("load: " + str + " into view: " + this.ele.id);
}
if(!this.paused)
this.ele.innerHTML = str;
//alert("Done " + this.ele.id);
//window.parent.unQueueAsBusy();
}
function refresh() {
this.doRPC(this.resourceID);
}
function saveRPC(params)
{
this.resourceID = params;
this.doRPC(params);
}
function doRPC(params, func)
{
// only do rpc call when we are activated and unpaused!
if(this.activated && !this.paused)
this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params, func);
}
function requirementsSatisfied(){
var i;
var res=true;
if (this.requirements != null)
for (i=0; i< this.requirements.length; i++)
res= ( res && this.requirements[i]() );
return res;
}
function getBreadcrumb(){
var arr = new Array();
if (typeof this.config.showBreadcrumb != 'undefined' && this.config.showBreadcrumb == 'true')
arr.push(this.config.label);
return arr;
}
}
function LazyView() {
if ( Cfx.Class.IsDefined( LazyView ) == false ) {
Cfx.Class.New( LazyView, View );
if( Cfx.Class.IsInitializing( LazyView, View )) {
// Initialize class methods
LazyView.Method(isActivatable);
LazyView.Method(setActivatable);
return;
}
}
this.activatable = false;
// Setup instance data.
this.InitInstance();
// Return instance.
return this;
function isActivatable() {
return this.activatable == true;
}
function setActivatable() {
this.activatable = true;
if(!this.activated)
this.activate();
}
}
//////////////////////////////////////////////////////////////////////////////
// Todo View class
// (c) 2004 - abogaart@hippo.nl
//
// @extends View
// Description:
// Show Last todo info
//
//////////////////////////////////////////////////////////////////////////////
function TodoView() {
if ( Cfx.Class.IsDefined( TodoView ) == false ) {
Cfx.Class.New( TodoView, LazyView );
if( Cfx.Class.IsInitializing( TodoView, LazyView )) {
// Initialize class methods
TodoView.Method( onClick );
// Initialize class variables.
//TextValidator.acceptChars = "\\w \\'\\.\\$\\?\\+\\-\\&\\^\\(\\)\\|\\\\!\\{\\}\\[\\]\\*\\:\\~\\#\\,%;`@";
return;
}
}
// Setup instance data.
this.InitInstance();
//this.element = Cfx.Dom.FindElementById(this.id);
// Return instance.
return this;
function onClick()
{
this.log.info("onclick");
xGetElementById(this.id+'frame').src = this.appUrl+args.path+'?'+args.options;
}
}
//////////////////////////////////////////////////////////////////////////////
// Brokenlinks View class
// (c) 2004 - abogaart@hippo.nl
//
// @extends View
// Description:
// Shows broken links
//
//////////////////////////////////////////////////////////////////////////////
function BrokenLinksView() {
if ( Cfx.Class.IsDefined( BrokenLinksView ) == false ) {
Cfx.Class.New( BrokenLinksView, LazyView );
if( Cfx.Class.IsInitializing( BrokenLinksView, LazyView )) {
return;
}
}
this.InitInstance();
return this;
}
//////////////////////////////////////////////////////////////////////////////
// Userinfo View class
// (c) 2004 - abogaart@hippo.nl
//
// @extends View
// Description:
// Displays user information
//
//////////////////////////////////////////////////////////////////////////////
function UserInfoView() {
if ( Cfx.Class.IsDefined( UserInfoView ) == false ) {
Cfx.Class.New( UserInfoView, LazyView );
if( Cfx.Class.IsInitializing( UserInfoView, LazyView )) {
return;
}
}
this.InitInstance();
return this;
}
//////////////////////////////////////////////////////////////////////////////
// New Document View class
// (c) 2004 - jreijn@hippo.nl
//
// @extends View
// Description:
// Shows new document view
//
//////////////////////////////////////////////////////////////////////////////
function NewDocumentView() {
if ( Cfx.Class.IsDefined( NewDocumentView ) == false ) {
Cfx.Class.New( NewDocumentView, LazyView );
if( Cfx.Class.IsInitializing( NewDocumentView, LazyView )) {
NewDocumentView.Method(newDocument);
return;
}
}
this.InitInstance();
return this;
function newDocument(params) {
if(params[0].val){
//alert(params[1].val);
//this.doRPC(params);
}
else {
//alert(params[1].val);
}
}
}
//////////////////////////////////////////////////////////////////////////////
// UsersView View class
//
// @extends View
//
//////////////////////////////////////////////////////////////////////////////
function UsersView() {
if ( Cfx.Class.IsDefined( UsersView ) == false ) {
Cfx.Class.New( UsersView, LazyView );
if( Cfx.Class.IsInitializing( UsersView, LazyView )) {
UsersView.Method(refresh);
UsersView.Method(setActiveUsersTab);
UsersView.Method(editUser);
return;
}
}
this.elementWithFocus = null;
this.InitInstance();
return this;
function refresh() {
var postArray = new Array();
postArray.push(this.resourceID[0]);
postArray.push({'key':'usertab','val':this.elementWithFocus});
this.doRPC(postArray);
this.sm.lookup('framework.eventmanager').fireEvent('sliderefreshall',{'key':'id','val':this.getId()});
}
function setActiveUsersTab(strID){
if(strID != null)
this.elementWithFocus = strID;
}
function editUser(params) {
this.sm.lookup("framework.rc").doCall(this.config.editUserUrl, this, params);
}
function saveUser() {
this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params);
}
function cancelEditUser() {
this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params);
}
}
//////////////////////////////////////////////////////////////////////////////
// PermissionsView View class
//
// @extends View
//
//////////////////////////////////////////////////////////////////////////////
function PermissionsView() {
if ( Cfx.Class.IsDefined( PermissionsView ) == false ) {
Cfx.Class.New( PermissionsView, LazyView );
if( Cfx.Class.IsInitializing( PermissionsView, LazyView )) {
PermissionsView.Method(slideselectitem);
PermissionsView.Method(slideopenfolder);
return;
}
}
this.InitInstance();
return this;
function slideselectitem(params) {
if (this.log.debugging()) {
this.log.debug("openfolder");
}
this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params);
this.resourceID = params;
}
function slideopenfolder(params) {
if (this.log.debugging()) {
this.log.debug("openfolder");
}
this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params);
this.resourceID = params;
}
}
//////////////////////////////////////////////////////////////////////////////
// OutdateView class
//
// @extends View
//
//////////////////////////////////////////////////////////////////////////////
function OutdatedView() {
if ( Cfx.Class.IsDefined( OutdatedView ) == false ) {
Cfx.Class.New( OutdatedView, View );
if( Cfx.Class.IsInitializing( OutdatedView, View )) {
OutdatedView.Method(outdatedCallback);
return;
}
}
this.InitInstance();
return this;
function outdatedCallback(event, params)
{
window.top.window.frames['topframe'].Application.sm.lookup('framework.eventmanager').fireEvent(event, params);
}
}
//////////////////////////////////////////////////////////////////////////////
// LocksView View class
//
// @extends View
//
//////////////////////////////////////////////////////////////////////////////
function LocksView() {
if ( Cfx.Class.IsDefined( LocksView ) == false ) {
Cfx.Class.New( LocksView, LazyView );
if( Cfx.Class.IsInitializing( LocksView, LazyView )) {
LocksView.Method(slideselectitem);
LocksView.Method(slideopenfolder);
return;
}
}
this.InitInstance();
return this;
function slideselectitem(params) {
if (this.log.debugging()) {
this.log.debug("openfolder");
}
this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params);
this.resourceID = params;
}
function slideopenfolder(params) {
if (this.log.debugging()) {
this.log.debug("openfolder");
}
this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params);
this.resourceID = params;
}
}
//////////////////////////////////////////////////////////////////////////////
// Brokenlinks View class
//
// @extends View
//
//////////////////////////////////////////////////////////////////////////////
function LogOutView() {
if ( Cfx.Class.IsDefined( LogOutView ) == false ) {
Cfx.Class.New( LogOutView, View );
if( Cfx.Class.IsInitializing( LogOutView, View )) {
return;
}
}
this.InitInstance();
return this;
}
//////////////////////////////////////////////////////////////////////////////
// ReportsView View class
//
// @extends View
//
//////////////////////////////////////////////////////////////////////////////
function ReportView() {
if ( Cfx.Class.IsDefined( ReportView ) == false ) {
Cfx.Class.New( ReportView, View );
if( Cfx.Class.IsInitializing( ReportView, View )) {
ReportView.Method(reportsearch);
ReportView.Method(doReportForm);
return;
}
}
this.InitInstance();
return this;
function reportsearch(params){
if (this.log.debugging()) {
this.log.debug("openfolder");
}
// alert(params[0]);
this.saveRPC(params);
//this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params);
// this.resourceID = params;
}
function doReportForm(form)
{
this.sm.lookup("framework.rc").doForm('searchform.html', this, '', form);
}
}
//////////////////////////////////////////////////////////////////////////////
// SubMenuView class
//
// @extends View
// Description:
// Shows submenu for the dashboard perspective. Switch between dashboard views.
//
//////////////////////////////////////////////////////////////////////////////
function SubMenuView() {
if ( Cfx.Class.IsDefined( SubMenuView ) == false ) {
Cfx.Class.New( SubMenuView, View );
if( Cfx.Class.IsInitializing( SubMenuView, View )) {
// Initialize class methods
SubMenuView.Method( onClick );
SubMenuView.Method( getLastActive );
SubMenuView.Method( setLastActive );
return;
}
}
this._lastActive = null;
// Setup instance data.
this.InitInstance();
// Return instance.
return this;
//////////////////////////////////////////////////////////////////////////////
// Properties
//////////////////////////////////////////////////////////////////////////////
function onClick()
{
this.log.info("onclick");
xGetElementById(this.id+'frame').src = this.appUrl+args.path+'?'+args.options;
}
function getLastActive() {
if(this._lastActive != null)
return this._lastActive;
else if(this.config.defaultView != null)
return this.config.defaultView;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?