cformsview.js
来自「Hippo CMS是一个以信息为中心的开源内容管理系统。Hippo CMS目标是」· JavaScript 代码 · 共 185 行
JS
185 行
/*
* Copyright 2001-2007 Hippo (www.hippo.nl)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function CformsView() {
if ( Cfx.Class.IsDefined(CformsView) == false ) {
Cfx.Class.New( CformsView, View );
if( Cfx.Class.IsInitializing(CformsView)) {
/*CformsView.Method(activate);
CformsView.Method(deactivate);*/
CformsView.Method(init);
CformsView.Method(editDocument);
CformsView.Method(saveDocument);
CformsView.Method(deleteResource);
CformsView.Method(publishDocument);
CformsView.Method(requestPublicationDocument);
CformsView.Method(savePreviewSource);
CformsView.Method(load);
CformsView.Method(showMyPreview);
return;
}
}
this.InitInstance();
return this;
/*
function activate() {
if (this.log.debugging()) {
this.log.debug('activating');
}
if(!this.loaded){
this.loaded = true;
}
}
function deactivate() {
}
*/
var url = "";
function showMyPreview()
{
var url2 = this.context.get("previewUrl") + this.url;
var name = 'previewWindow';
var w = 800;
var h = 600;
var options = 'scrollbars=yes,toolbar=yes,location=yes,resizable=yes';
var previewWin = window.open(url2, name,'width='+w+',height='+h+','+options);
previewWin.focus();
}
function load(str){
if (this.log.debugging()) {
this.log.debug("load: " + str + " into view: " + this.ele.id);
}
try{
this.ele.innerHTML =str;
var cont = this.context.get("pcontainer");
//cont.container.forms_onload();
}
catch(error) {
this.log.error(error);
}
}
function requestPublicationDocument(params)
{
var type = params[4].val;
var document = params[2].val;
var params1 = [{key:'url',val:'/'+type + document},{key:'type',val:type}];
this.sm.lookup("cms.workbench.rc").doCall(this.config.appUrl, this, params1);
}
function publishDocument(params)
{
var type = params[4].val;
var document = params[2].val;
var params1 = [{key:'url',val:'/'+type + document},{key:'type',val:type}];
this.sm.lookup("cms.workbench.rc").doCall(this.config.appUrl, this, params1);
}
function savePreviewSource(params)
{
var type = params[4].val;
var document = params[2].val;
var params1 = [{key:'url',val:'/'+type + document},{key:'type',val:type}];
this.sm.lookup("cms.workbench.rc").doCall(this.config.appUrl, this, params1);
this.url = document;
this.callWithDelay('showMyPreview()',5000,0);
}
function deleteResource(params) {
if (this.loaded)
{
if (params[0].val) {
var localparams = [{key:'url',val:"/resource/selected"},{key:'type',val:'/no'}];
//this.sm.lookup("cms.workbench.rc").doCall(this.config.appUrl, this, localparams);
//this.resourceID = localparams;
window.top.window.frames['topframe'].documentIsOpen = "false"
this.editDocument(localparams);
//window.parent.frames['topframe'].workbench.showMenu('documents');
}
else {
alert(params[1].val);
}
}
}
function editDocument(params)
{
if (params[0].val)
{
if(0 && window.top.window.frames['topframe'].documentIsOpen=="true")
{
// [DD] don't show annoying popup
// if(confirm('Currently there is a document open in the editing pane. Are you sure you want to edit the new document? (You might lose some changes)'))
// {
this.url = params[0].val; // remember currently opened document
var type = params[1].val;
var schema = type;
var document = params[0].val;
var cforms = "/editing/cf2/showForm";
if (this.log.debugging()) {
this.log.debug("EditingPerspective::editDocument(): " + cforms + "?schema="+schema+"&document="+document);
}
var params1 = [{key:'url',val:'/'+schema + document},{key:'type',val:type}];
this.sm.lookup("cms.workbench.rc").doCall(this.config.appUrl, this, params1);
this.resourceID = params;
/* }
else
{
return false;
}
*/
}
else if (0)
{
this.url = params[0].val; // remember currently opened document
var type = params[1].val;
var schema = type;
var document = params[0].val;
var cforms = "/editing/cf2/showForm";
if (this.log.debugging()) {
this.log.debug("EditingPerspective::editDocument(): " + cforms + "?schema="+schema+"&document="+document);
}
var params1 = [{key:'url',val:'/'+schema + document},{key:'type',val:type}];
this.sm.lookup("cms.workbench.rc").doCall(this.config.appUrl, this, params1);
this.resourceID = params;
}
}
else
{
alert(params[1].val);
}
}
function saveDocument(params)
{
this.editDocument(params);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?