ГлавнаяПоддержкаБлог
Главная arrow Исходные тексты arrow default.js/CommandButton
default.js/CommandButton
function NewId(){
 if(!glob('LIdButton')){
   glob('LIdButton') = bt_user_function;
 }else{
   glob('LIdButton')++;
 }
 return(glob('LIdButton'))
}

function SetHandleForButton(cbs){
//try{
  func.SendToLog('JS - SetHandleForButton begin')
  if(cbs.accChildCount==0)
    return(1) // Error Bar

  func.SendToLog('JS - SetHandleForButton state 1')

  for(var i=1;i=cbs.controls.count;i++){
    var bt = cbs.controls.item(i);
    switch(bt.tag*1){
      case bt_new:        bt.caption=BT_NewMessage; break;
      case bt_reply:      bt.caption=BT_Reply; break;
      case bt_replyall:   bt.caption=BT_ReplyAll; break;
      case bt_forward:    bt.caption=BT_Forward; break;
      case bt_redo:       bt.caption=BT_Repost; break;
      case bt_Check:      bt.caption=BT_Check; break;
      case 0:             bt.caption=BT_AddFunction; break;
      case bt_templatedefault:    bt.caption=PROP_PAGE_EdtDefTempl; break;
      case bt_templatecurr:    bt.caption=PROP_PAGE_EdtCurTempl; break;
      case bt_prop:       bt.caption=BT_Optionsk; break;
      case bt_about:      bt.caption=BT_About; break;
      case bt_subscribe:  bt.caption=BT_Subscribe; break;
      case bt_bug:        bt.caption=BT_Bug; break;
      case bt_writelist:  bt.caption=BT_ToList; break;
      case bt_modules:    bt.caption=BT_Modules; break;
      case bt_templgallery: bt.caption=Pref_TemplMore; break;
      case bt_help:       bt.caption=BT_Help; break;
    }
    if(bt.tag>0)
      func.HandleEvent(DIID__CommandBarButtonEvents, bt, bt.tag, glob('BAR_PLACE'))
    else
      if(SetHandleForButton(bt))
        return(1); // Error Bar
  }
//}catch(e){} !!!
  func.SendToLog('JS - SetHandleForButton end')
}

function DeleteMyCommandBar(cb){
 func.SendToLog('JS - DeleteMyCommandBar')
 var cbs = GetMyCommandBar(cb);
 if(cbs){
  cbs.visible = false//Delete();
 }
}

function DeleteModuleButtons(Mbtn){
 try{
 if(Mbtn&&Mbtn.accChildCount>0){
  for(var i=Mbtn.controls.count;i>=1;i--){
   Mbtn.controls.item(i).Delete();
  }
 }
 }catch(e){}
}

function RefreshMyCommandBar(cb, PlaceObject){
 func.SendToLog('JS - RefreshMyCommandBar start')
 // PlaceObject = 0 - Explorer, 1 - Inspector
 if(RegRead(GetReestrPath()+KeyToolbarDisable, 0)==1){return;}
 var cbs = GetMyCommandBar(cb);
 if(cbs)
   if(!SetHandleForButton(cbs)){
     cbs.visible = true;
     RefreshModuleButton(FindModuleButton(cbs), PlaceObject)
     return;
   }else
     cbs.Delete();
 cb = MyCommandBar(cb);
 cb.Visible = true;

// for(var i=0;i500;i++){   AddControl(msoControlButton, cb,i,i, i+5000, msoButtonIcon); }

 AddControl(msoControlButton, cb,1757 /*322*/, BT_NewMessage, bt_new, msoButtonIconAndCaption);
 AddControl(msoControlButton, cb,354, BT_Reply, bt_reply, msoButtonIconAndCaption);
 AddControl(msoControlButton, cb,355, BT_ReplyAll, bt_replyall, msoButtonIcon);
 AddControl(msoControlButton, cb,328, BT_Forward, bt_forward, msoButtonIcon);
 AddControl(msoControlButton, cb,19, BT_Repost, bt_redo, msoButtonIcon);

 var oper = AddControl(msoControlPopup, cb,487,BT_AddFunction, 0, msoButtonIconAndCaption);
  AddControl(msoControlButton, oper,144, BT_Check, bt_Check, msoButtonIconAndCaption);

  btM = AddControl(msoControlPopup, oper,473, BT_Modules, bt_modules,msoButtonIconAndCaption);
  btM.BeginGroup = true;

  AddControl(msoControlButton, oper,224, PROP_PAGE_EdtCurTempl, bt_templatecurr,msoButtonIconAndCaption).BeginGroup = true;
  AddControl(msoControlButton, oper,224, PROP_PAGE_EdtDefTempl, bt_templatedefault,msoButtonIconAndCaption);
  AddControl(msoControlButton, oper,222, BT_Optionsk, bt_prop,msoButtonIconAndCaption);
  AddControl(msoControlButton, oper,984, BT_Help, bt_help,msoButtonIconAndCaption).BeginGroup = true;;
  AddControl(msoControlButton, oper,329, BT_Subscribe, bt_subscribe,msoButtonIconAndCaption).BeginGroup = true;
  AddControl(msoControlButton, oper,329, BT_ToList, bt_writelist,msoButtonIconAndCaption);
  AddControl(msoControlButton, oper,329, BT_Bug, bt_bug,msoButtonIconAndCaption);
  AddControl(msoControlButton, oper,1445, Pref_TemplMore, bt_templgallery,msoButtonIconAndCaption);
  AddControl(msoControlButton, oper,1445, BT_About, bt_about,msoButtonIconAndCaption);

  RefreshModuleButton(btM, PlaceObject)
//.BeginGroup = true;
 func.SendToLog('JS - RefreshMyCommandBar end')
 return(cb)
}

function FindModuleButton(cbs){

  if(cbs.accChildCount==0){
   return; // Error Bar
  }

  for(var i=1;i=cbs.controls.count;i++){
   var bt = cbs.controls.item(i);
   if(bt.tag>0){
    if(bt.tag==bt_modules){
     return(bt);
    }
   }else{
    var tt = FindModuleButton(bt);
    if(tt){
     return(tt)
    }
   }
  }
}

function RefreshModuleButton(btM, PlaceObject){
 func.SendToLog('JS - RefreshModuleButton start')
 if(!btM){return}
 DeleteModuleButtons(btM)
 func.SendToLog('JS - RefreshModuleButton state 1')
 var Modules = glob('Modules'); 
 if(Modules){
   var modulename;
   for(modulename in Modules){
     var module = Modules[modulename];
     if(module.enable&&module.menu){
         PutMenu(btM, module.menu, PlaceObject)
     }
   }
 }    
 func.SendToLog('JS - RefreshModuleButton end')
}

function PutMenu(Node, Mass, PlaceObject){
 for(var i=0;iMass.length;i++){
  if(  Mass[i][0]==M_MENU_PLACE_ALL ||
      (Mass[i][0]==M_MENU_PLACE_EXPLORER&&PlaceObject==0) ||
      (Mass[i][0]==M_MENU_PLACE_INSPECTOR&&PlaceObject==1)
    ){
    if(Mass[i][4].length>0){ //ExistsChilds
      var nn = AddControl(msoControlPopup, Node, Mass[i][3], Mass[i][1], Mass[i][2], msoButtonIconAndCaption);
      PutMenu(nn, Mass[i][4], PlaceObject)
    }else{
      var bt = AddControl(msoControlButton, Node, Mass[i][3], Mass[i][1], Mass[i][2], msoButtonIconAndCaption);
      if(Mass[i][5]){
       if(bt) bt.BeginGroup = true
      }
    }  
  }
 }
}    

function AddControl(tc,cb,faceId,Caption,Cook,style){
 var Control;
 try{ Control = cb.FindControl(tc, 1, Cook); }
 catch(e){
  try{
  Control = cb.CommandBar.FindControl(tc, 1, Cook);
  }catch(e){}
 }
 if(!Control){
   try{
    Control = cb.controls.add(tc);
   }catch(e){return;}
 }
 if(tc==msoControlButton){
  Control.Style = style;
  Control.FaceID = faceId;
 }
 Control.Tag = Cook;
 Control.Caption = Caption;
 Control.Visible = true;
 func.HandleEvent(DIID__CommandBarButtonEvents, Control, Cook, glob('BAR_PLACE'));
 return(Control)
}

function GetMyCommandBar(cbs){
 for(var i=1;i=cbs.Count;i++)
 if(cbs(i).Name == MyBarsName){return(cbs(i))}
}

function MyCommandBar(cbs){
 var result = GetMyCommandBar(cbs);
 if(!result){
  result = cbs.Add(MyBarsName);
  result.position=msoBarTop;
 }
 return(result);
}


function CurrentMessage(ActionEnvironment){
  if(ActionEnvironment)
    ActionEnvironment.MultiSelect = null;

  try{
    var classWin = func.Application.ActiveWindow.CLASS;
    if(classWin == olInspector/*||func.Application.ActiveInspector win2000*/){
      var it = func.Application.ActiveInspector.CurrentItem
      if(it.Class == olMail)
        return(SafeMailItem(it))
      else
        return(it)
    }else{
      if(!func.Application.ActiveExplorer)
        return;
      var sel = func.Application.ActiveExplorer.Selection;
      if(ActionEnvironment&&sel.count>1){
        func.WaitShow(4, M_SELECT, '', 1, sel.count);
        var msel = [];
        for(var i=1;i=sel.count;i++){
          func.WaitShow(4, M_SELECT, '', i);
          func.ProcessMessages();
          it = sel.item(i);
          if(it.Class == olMail)
           msel[msel.length] = SafeMailItem(it)
          else
           msel[msel.length] = it;
        }
        func.WaitClose();
        ActionEnvironment.MultiSelect = msel;
      }
      it = sel.item(1)
      if(it.Class == olMail || it.Class == olRemote)
        return(SafeMailItem(it))
      else
        return(it);
    }
  }catch(e){}
}

 


Загрузить Potolook
 
Плагин Potolook для Microsoft Outlook
Ментальная арифметика для детей
© 2004-2012 Позитик. Все права защищены.

Microsoft®, Outlook® и эмблема Office являются охраняемыми товарными знаками корпорации Майкрософт (Microsoft Corporation) в США и/или других странах.
Копирование и использование материалов разрешается только в случае указания явной гиперссылки на сайт http://www.potolook.ru, как на источник получения информации.

Разработка сайта — "Позитик"

Рейтинг@Mail.ru