views.js

来自「Hippo CMS是一个以信息为中心的开源内容管理系统。Hippo CMS目标是」· JavaScript 代码 · 共 2,427 行 · 第 1/5 页

JS
2,427
字号
    //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params);    
    //this.resourceID = params;
    this.saveRPC(params);
  }

  function showfiledetails(params) {
    //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params);    
    //this.resourceID = params;    
    this.saveRPC(params);
  }
  
  function proppatch(params) {
    if(params[0].val){
      this.refresh();
      //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, this.resourceID);    
    }
    else {
      //alert(params[1].val);
    }
  }

  function deleteResource(params) {
    if (params[0].val) {
      this.doRPC(params);
      //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params);    
    }
    else {
      //alert(params[1].val);
    }
  }
  
  function deleteCollection(params) {
    this.deleteResource(params);
  }

  function saveDocument(params) {
    //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params);
    this.doRPC(params);
  }
  
}

function PropertiesView() {
  if ( Cfx.Class.IsDefined(PropertiesView) == false ) {
    Cfx.Class.New( PropertiesView, View );
    if( Cfx.Class.IsInitializing( PropertiesView, View )) {
     
      PropertiesView.Method(showfiledetails);
      PropertiesView.Method(openfolder);
      PropertiesView.Method(do_openfolder);      
      PropertiesView.Method(load);
      PropertiesView.Method(deleteResource);
      PropertiesView.Method(deleteCollection);
      PropertiesView.Method(proppatch);
      PropertiesView.Method(workflowAction);
      PropertiesView.Method(moveDocument);
     
      return;
    }
  }
  this.InitInstance();
  return this;
  
  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");
      // TODO: forms_onload gooit een exception, welke wel netjes wordt opgevangen:
      // TODO: undefined TypeError 'forms_onloadHandlers.length' is null or not an object
      /*
      if (this.log.debugging()) {
        this.log.debug("calling cont.container.forms_onload();");
      }
      cont.container.forms_onload();
      */
    }
    catch(error) {
      this.log.error(error);
    }  
  }
  
  function openfolder(params) {
    this.log.debug("$$$$$$$$ openfolder!");
    if(this.activated || !this.paused) {
      this.resourceID = params;
      this.callWithDelay('do_openfolder()',this.longDelay,0);
      if(!this.paused)
        this.ele.innerHTML='';
    }  
  }
  
  function do_openfolder()
  {
    this.log.debug("$$$$$$$$ do_openfolder!");
    if(this.activated) {
      //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, this.resourceID);
      this.refresh();
      if(!this.paused)
        this.ele.innerHTML='';
    }
  }

  function showfiledetails(params) {
    if(this.activated || !this.paused) {
      this.resourceID = params;
      this.callWithDelay('do_openfolder()',this.shortDelay,0); // was exactly the same
      if(!this.paused)
        this.ele.innerHTML='';
    }  
  }
  
  function deleteResource(params) {
    if (params[0].val) {
      //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params);    
      //this.resourceID = params;
      this.saveRPC(params);
    }
    else {
      //alert(params[1].val);
    }
  }
  
  function deleteCollection(params) {
    this.deleteResource(params);
  }

  function proppatch(params) {
    if (!params[0].val) {
      alert(params[1].val);
      if (this.log.debugging()) {
        this.log.debug(params[1].val);
      }
    }
    else {
      //alert(params[1].val);
    }
    var cont = this.context.get("pcontainer");
    if (this.log.debugging()) {
      this.log.debug("cont.container: " + cont.container.name);
    }
    //cont.container.forms_reset();
  }

  function workflowAction(params) 
  {
    this.refresh();
  }

  function moveDocument(params) {
    if (params[0].val) {
      this.saveRPC(params);
    }
  }

}

function ReferencesView() {
  if ( Cfx.Class.IsDefined(ReferencesView) == false ) {
    Cfx.Class.New( ReferencesView, View );
    if( Cfx.Class.IsInitializing( ReferencesView, View )) {
     
      ReferencesView.Method(showreferences);
      ReferencesView.Method(showfiledetails);
      ReferencesView.Method(do_showfiledetails);
      ReferencesView.Method(openfolder);
      ReferencesView.Method(do_openfolder);      
      ReferencesView.Method(load);      
      ReferencesView.Method(deleteResource);      
      ReferencesView.Method(moveDocument);      
     
      return;
    }
  }
  this.InitInstance();
  return this;
  
  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");
    }
    catch(error) {
      this.log.error(error);
    }  
  }
  
  function showfiledetails(params)
  {
    this.log.debug("$$$$$$$$ showfiledetails!");
  
    this.resourceID = params;
    
    this.callWithDelay('do_showfiledetails()',this.shortDelay,0);
  }

  function do_showfiledetails() {
    this.log.debug("$$$$$$$$ do_showfiledetails!");
    this.refresh();
  }
  
  function openfolder() {
    var localparams = [{key:'url',val:"/no/resource/selected"}];
    
    this.resourceID = localparams;
    this.callWithDelay('do_openfolder()',this.longDelay,0);
  }

  function do_openfolder() {
    this.refresh();  
  }
  
  
  function showreferences(params) {
    this.log.debug("$$$$$$$$ showreferences!");
    this.refresh();  
  }

  function deleteResource(params) {
    if (params[0].val) {
      var localparams = [{key:'url',val:"/no/resource/selected"}];
      this.saveRPC(localparams);
    }
  }

  function moveDocument(params) {
    if (params[0].val) {
      var localparams = [{key:'url',val:"/no/resource/selected"}];
      this.saveRPC(localparams);
    }
  }
}



function ActionsView() {
  if ( Cfx.Class.IsDefined(ActionsView) == false ) {
    Cfx.Class.New( ActionsView, View );
    if( Cfx.Class.IsInitializing( ActionsView, View )) {
     
      ActionsView.Method(showfiledetails);
      ActionsView.Method(do_showfiledetails);
      ActionsView.Method(openfolder);
      ActionsView.Method(do_openfolder);      
      ActionsView.Method(load);
      ActionsView.Method(newDocument);
      ActionsView.Method(makeCollection);
      ActionsView.Method(deleteResource);
      ActionsView.Method(deleteCollection);
      ActionsView.Method(workflowAction);
      ActionsView.Method(siteactionsWorkflowAction);
      ActionsView.Method(defaultAction);
      ActionsView.Method(proppatch);
      ActionsView.Method(saveDraft);
      ActionsView.Method(publishResource);
      ActionsView.Method(publish);
      ActionsView.Method(moveDocument);
      ActionsView.Method(refreshOnSave);
     
   return;
    }
  }
  this.InitInstance();
  return this;
  
  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");
      // TODO: forms_onload gooit een exception, welke wel netjes wordt opgevangen:
      // TODO: undefined TypeError 'forms_onloadHandlers.length' is null or not an object
      /*
      if (this.log.debugging()) {
        this.log.debug("calling cont.container.forms_onload();");
      }
      cont.container.forms_onload();
      */
    } 
    catch(error) {
      this.log.error(error, "error during loading of view");
    }  
  }
  
  function openfolder(params) {
    this.log.debug("$$$$$$$$ openfolder!");
    
    var localparams = [{key:'url',val:"/no/resource/selected"}];
    
    this.resourceID = localparams;
    this.callWithDelay('do_openfolder()',this.longDelay,0);
  }
  
  function do_openfolder() {
    this.log.debug("$$$$$$$$ do_openfolder!");
    //var localparams = [{key:'url',val:"/no/resource/selected"}];
    //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, this.resourceID);
    this.refresh();
    //this.resourceID = localparams;
  }

  function showfiledetails(params)
  {
    this.log.debug("$$$$$$$$ showfiledetails!");
  
    this.resourceID = params;
    
    //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, params);
    this.callWithDelay('do_showfiledetails()',this.shortDelay,0);
  }

  function do_showfiledetails() {
    this.log.debug("$$$$$$$$ do_showfiledetails!");
    //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, this.resourceID);
    this.refresh();
    //this.resourceID = params;
  }

  function makeCollection(params) {
    if(params[0].val){
      this.refresh();
      //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, this.resourceID);    
    }
    else {
      alert(params[1].val);
    }
  }

  function newDocument(params) {
    if(params[0].val){
      //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, this.resourceID);
      this.refresh();    
    }
    else {
      alert(params[1].val);
    }
  }

  function deleteResource(params) {
    if (params[0].val) {
      var localparams = [{key:'url',val:"/no/resource/selected"}];
      //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, localparams);
      //this.resourceID = localparams;
      this.saveRPC(localparams);
    }
    else {
      alert(params[1].val);
    }
  }

  function deleteCollection(params) {
    this.deleteResource(params);
  }

  function workflowAction(params) 
  {
    this.refresh();
  }

  function siteactionsWorkflowAction(params) 
  {
    this.refresh();
  }

  function defaultAction(params) 
  {
    this.doRPC(params);
  }

  function proppatch(params) {
    if(params[0].val){
      this.refresh();    
    }
    else {
      //alert(params[1].val);
    }
  }

  function saveDraft(params) {
    this.refresh();
  }

  function publishResource(params) 
  {
    this.refresh();
  }

  function publish(params) 
  {
    this.refresh();
  }

  function moveDocument(params) {
    if (params[0].val) {
      var localparams = [{key:'url',val:"/no/resource/selected"}];
      this.saveRPC(localparams);
    }
    else {
      alert(params[1].val);
    }
  }

  function refreshOnSave(params) 
  {
    this.refresh();
  }


}


function FolderActionsView() {
  if ( Cfx.Class.IsDefined( FolderActionsView) == false ) {
    Cfx.Class.New( FolderActionsView, View );
    if( Cfx.Class.IsInitializing( FolderActionsView, View )) {
      FolderActionsView.Method(openfolder);    
      FolderActionsView.Method(proppatch);
      FolderActionsView.Method(makeCollection);
      FolderActionsView.Method(newDocument);
      FolderActionsView.Method(deleteResource);
      FolderActionsView.Method(deleteCollection);
      FolderActionsView.Method(moveUpDown);
      FolderActionsView.Method(sortBy);
      FolderActionsView.Method(importDocument);
      FolderActionsView.Method(publishIndexCollection);
      return;
    }
  }
  this.InitInstance();
  return this;
  
  function openfolder(params)
  {
    this.log.debug("$$$$$$$$ openfolder!");
  
    if(this.activated && !this.paused)
      this.ele.innerHTML='';
  
    this.saveRPC(params);
  }

  function proppatch(params) {
    if(params[0].val){
      //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, this.resourceID);
      this.refresh();    
    }
    else {
      //alert(params[1].val);
    }
  }
  
  function makeCollection(params) {
    if(params[0].val){
      this.refresh();
      //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, this.resourceID);    
    }
    else {
      //alert(params[1].val);
    }
  }

  function newDocument(params) {
    if(params[0].val){
      this.refresh();
      //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, this.resourceID);    
    }
    else {
      //alert(params[1].val);
    }
  }

  function deleteResource(params) {
    if (params[0].val) {
      this.refresh();
      //this.sm.lookup("framework.rc").doCall(this.config.appUrl, this, this.resourceID);    
    }
    else {
      //alert(params[1].val);
    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?