/**
  * Editor k přidávání členů skupiny
  *
  * @param string $fieldName    název políčka formuláře
  * @param string $fieldCaption popisek políčka
  * @param IEcfg  $dataSource   editovaný objekt
  */
 public function __construct($fieldName, $fieldCaption, $dataSource, $members)
 {
     $iDColumn = $dataSource->keywordsInfo[$fieldName]['refdata']['idcolumn'];
     $nameColumn = $dataSource->keywordsInfo[$fieldName]['refdata']['captioncolumn'];
     $sTable = $dataSource->keywordsInfo[$fieldName]['refdata']['table'];
     if (isset($dataSource->keywordsInfo[$fieldName]['refdata']['condition'])) {
         $conditions = $dataSource->keywordsInfo[$fieldName]['refdata']['condition'];
     } else {
         $conditions = array();
     }
     if (isset($dataSource->keywordsInfo[$fieldName]['refdata']['public']) && intval($dataSource->keywordsInfo[$fieldName]['refdata']['public'])) {
         $sqlConds = " ( " . $dataSource->myDbLink->prepSelect(array_merge($conditions, array($dataSource->userColumn => EaseShared::user()->getUserID()))) . " ) OR ( " . $dataSource->myDbLink->prepSelect(array_merge($conditions, array('public' => 1))) . ")  ";
     } else {
         $sqlConds = $dataSource->myDbLink->prepSelect(array_merge($conditions, array($dataSource->userColumn => EaseShared::user()->getUserID())));
     }
     $initialContent = new EaseTWBPanel($fieldCaption);
     $initialContent->setTagCss(array('width' => '100%'));
     if (is_null($dataSource->getMyKey())) {
         $initialContent->addItem(_('Nejprve je potřeba uložit záznam'));
     } else {
         if ($sTable == $dataSource->myTable) {
             $tmpKey = $dataSource->getMyKey();
             if ($tmpKey) {
                 $members[$tmpKey] = true;
             }
         }
         if ($members && count($members)) {
             $aviavbleCond = 'AND ' . $iDColumn . ' NOT IN (' . join(',', array_keys($members)) . ') ';
         } else {
             $aviavbleCond = '';
         }
         $membersAviableArray = EaseShared::myDbLink()->queryToArray('SELECT ' . $nameColumn . ', ' . $iDColumn . ' ' . 'FROM `' . $sTable . '` ' . 'WHERE (' . $sqlConds . ') ' . $aviavbleCond . 'ORDER BY ' . $nameColumn, $iDColumn);
         if ($sTable == $dataSource->myTable) {
             unset($members[$dataSource->getMyKey()]);
         }
         $addText = _('Přiřadit');
         $delText = _('Odebrat');
         if (count($membersAviableArray)) {
             foreach ($membersAviableArray as $memberID => $memberName) {
                 $reftable = $dataSource->keywordsInfo[$fieldName]['refdata']['table'];
                 $initialContent->addItem(new EaseTWBButtonDropdown($memberName[$nameColumn], 'inverse', 'xs', array(new EaseHtmlATag($reftable . '.php?' . $reftable . '_id=' . $memberID, EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')), new EaseHtmlATag(null, EaseTWBPart::GlyphIcon('plus-sign') . ' ' . $addText, array('onClick' => "addGroupMember('" . get_class($dataSource) . "','" . $dataSource->getId() . "','" . $fieldName . "','" . $memberName[$nameColumn] . "','" . $memberID . "')", 'class' => 'handle', 'data-addtext' => $addText, 'data-deltext' => $delText))), array('id' => get_class($dataSource) . '_' . $fieldName . '_' . $memberID, 'style' => 'margin: 1px;')));
             }
         }
         if ($members && count($members)) {
             $initialContent->addItem('</br>');
             foreach ($members as $memberID => $memberName) {
                 $reftable = $dataSource->keywordsInfo[$fieldName]['refdata']['table'];
                 $initialContent->addItem(new EaseTWBButtonDropdown($memberName, 'success', 'xs', array(new EaseHtmlATag($reftable . '.php?' . $reftable . '_id=' . $memberID, EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')), new EaseHtmlATag(null, EaseTWBPart::GlyphIcon('remove') . ' ' . _('Odebrat'), array('onClick' => "delGroupMember('" . get_class($dataSource) . "','" . $dataSource->getId() . "','" . $fieldName . "','" . $memberName . "','" . $memberID . "')", 'class' => 'handle', 'data-addtext' => $addText, 'data-deltext' => $delText))), array('id' => get_class($dataSource) . '_' . $fieldName . '_' . $memberID, 'style' => 'margin: 1px;')));
             }
         }
     }
     parent::__construct($initialContent);
 }
 /**
  * Editor k přidávání členů skupiny
  *
  * @param IEServices $service
  */
 public function __construct($service)
 {
     $hostsAssigned = array();
     parent::__construct();
     $fieldName = $this->getmyKeyColumn();
     $initialContent = new EaseTWBPanel(_('Sledované hosty služby'), 'default');
     $initialContent->setTagCss(array('width' => '100%'));
     if (is_null($service->getMyKey())) {
         $initialContent->addItem(_('Nejprve je potřeba uložit záznam'));
     } else {
         $serviceName = $service->getName();
         $host = new IEHost();
         if (EaseShared::user()->getSettingValue('admin')) {
             $allHosts = $host->getAllFromMySQL(NULL, array($host->myKeyColumn, $host->nameColumn, 'platform', 'register'), null, $host->nameColumn, $host->myKeyColumn);
         } else {
             $allHosts = $host->getListing(null, true, array('platform', 'register'));
         }
         if ($service->getDataValue('host_name')) {
             foreach ($service->getDataValue('host_name') as $hostId => $hostName) {
                 if (isset($allHosts[$hostId])) {
                     $hostsAssigned[$hostId] = $allHosts[$hostId];
                 }
             }
         }
         foreach ($allHosts as $hostID => $hostInfo) {
             if ($hostInfo['register'] != 1) {
                 unset($allHosts[$hostID]);
             }
             if ($hostInfo['platform'] != 'generic' && $hostInfo['platform'] != $service->getDataValue('platform')) {
                 unset($allHosts[$hostID]);
             }
         }
         foreach ($hostsAssigned as $hostID => $hostInfo) {
             unset($allHosts[$hostID]);
         }
         if (count($allHosts)) {
             foreach ($allHosts as $hostID => $hostInfo) {
                 $initialContent->addItem(new EaseTWBButtonDropdown($hostInfo[$host->nameColumn], 'inverse', 'xs', array(new EaseHtmlATag('host.php?host_id=' . $hostID . '&amp;service_id=' . $service->getId(), EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')), new EaseHtmlATag('?addhost=' . $hostInfo[$host->nameColumn] . '&amp;host_id=' . $hostID . '&amp;' . $service->getmyKeyColumn() . '=' . $service->getMyKey() . '&amp;' . $service->nameColumn . '=' . $service->getName(), EaseTWBPart::GlyphIcon('plus') . ' ' . _('Začít sledovat')))));
             }
         }
         if (count($hostsAssigned)) {
             $initialContent->addItem('<br/>');
             foreach ($hostsAssigned as $hostID => $hostInfo) {
                 $initialContent->addItem(new EaseTWBButtonDropdown($hostInfo[$host->nameColumn], 'success', 'xs', array(new EaseHtmlATag('?delhost=' . $hostInfo[$host->nameColumn] . '&amp;host_id=' . $hostID . '&amp;' . $service->getmyKeyColumn() . '=' . $service->getMyKey() . '&amp;' . $service->nameColumn . '=' . $service->getName(), EaseTWBPart::GlyphIcon('remove') . ' ' . _('Přestat sledovat')), new EaseHtmlATag('host.php?host_id=' . $hostID . '&amp;service_id=' . $service->getId(), EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')))));
             }
         }
     }
     $this->addItem($initialContent);
 }
 /**
  * Editor k přidávání členů skupiny
  *
  * @param IEHost $host
  */
 public function __construct($host)
 {
     parent::__construct();
     $fieldName = $host->getmyKeyColumn();
     $initialContent = new EaseTWBPanel(_('rodiče hostu'));
     $addparentForm = $initialContent->addItem(new EaseTWBForm('addparent'));
     $addparentForm->addItem(new EaseTWBFormGroup(_('IP nebo Hostname'), new EaseHtmlInputTextTag('newparent')));
     $addparentForm->addItem(new EaseHtmlInputHiddenTag($fieldName, $host->getId()));
     $addparentForm->addItem(new EaseTWSubmitButton(_('Přidat rodiče'), 'success'));
     $initialContent->setTagCss(array('width' => '100%'));
     if (is_null($host->getMyKey())) {
         $initialContent->addItem(_('Nejprve je potřeba uložit záznam'));
     } else {
         $allParents = $host->getListing();
         unset($allParents[$host->getID()]);
         //Nenabízet sám sebe jako rodiče
         foreach ($allParents as $parentID => $parentInfo) {
             if ($parentInfo['register'] != 1) {
                 unset($allParents[$parentID]);
             }
         }
         $parentsAssigned = array();
         foreach ($host->getDataValue('parents') as $parentAssigned) {
             $parentID = EaseShared::myDbLink()->queryToValue('SELECT `' . $host->myKeyColumn . '` FROM ' . $host->myTable . ' WHERE `' . $host->nameColumn . '` = \'' . addSlashes($parentAssigned) . '\'');
             $parentsAssigned[$parentID][$host->nameColumn] = $parentAssigned;
             $parentsAssigned[$parentID][$host->myKeyColumn] = $parentID;
             unset($allParents[$parentID]);
         }
         if (count($allParents)) {
             foreach ($allParents as $parentID => $parentInfo) {
                 $initialContent->addItem($this->parentButton($parentInfo, 'plus', $host));
             }
         }
         if (count($parentsAssigned)) {
             $initialContent->addItem('</br>');
             foreach ($parentsAssigned as $parentID => $parentInfo) {
                 $initialContent->addItem($this->parentButton($parentInfo, 'remove', $host));
             }
         }
     }
     $this->addItem($initialContent);
 }
 /**
  * Editor k přidávání členů skupiny
  *
  * @param IEService|IEHost $holder
  */
 public function __construct($holder)
 {
     $contactsAssigned = array();
     parent::__construct();
     $fieldName = $this->getmyKeyColumn();
     $initialContent = new EaseTWBPanel(_('Cíle notifikací'));
     $initialContent->setTagCss(array('width' => '100%'));
     if (is_null($holder->getMyKey())) {
         $initialContent->addItem(_('Nejprve je potřeba uložit záznam'));
     } else {
         $serviceName = $holder->getName();
         $contact = new IEContact();
         $allContacts = $contact->getListing(null, true, array('alias', 'parent_id'));
         foreach ($holder->getDataValue('contacts') as $contactId => $contactName) {
             if (isset($allContacts[$contactId])) {
                 $contactsAssigned[$contactId] = $allContacts[$contactId];
             }
         }
         foreach ($allContacts as $contactID => $contactInfo) {
             if ($contactInfo['register'] != 1) {
                 unset($allContacts[$contactID]);
             }
             if (!$contactInfo['parent_id']) {
                 unset($allContacts[$contactID]);
             }
         }
         foreach ($contactsAssigned as $contactID => $contactInfo) {
             unset($allContacts[$contactID]);
         }
         if (count($allContacts)) {
             foreach ($allContacts as $contactID => $contactInfo) {
                 $initialContent->addItem(new EaseTWBButtonDropdown($contactInfo[$contact->nameColumn], 'inverse', 'xs', array(new EaseHtmlATag('contacttweak.php?contact_id=' . $contactInfo['parent_id'] . '&amp;service_id=' . $holder->getId(), EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')), new EaseHtmlATag('?addcontact=' . $contactInfo[$contact->nameColumn] . '&amp;contact_id=' . $contactID . '&amp;' . $holder->getmyKeyColumn() . '=' . $holder->getMyKey() . '&amp;' . $holder->nameColumn . '=' . $holder->getName(), EaseTWBPart::GlyphIcon('plus') . ' ' . _('Začít obesílat')))));
             }
         }
         if (count($contactsAssigned)) {
             $initialContent->addItem('<br/>');
             foreach ($contactsAssigned as $contactID => $contactInfo) {
                 $initialContent->addItem(new EaseTWBButtonDropdown($contactInfo[$contact->nameColumn], 'success', 'xs', array(new EaseHtmlATag('?delcontact=' . $contactInfo[$contact->nameColumn] . '&amp;contact_id=' . $contactID . '&amp;' . $holder->getmyKeyColumn() . '=' . $holder->getMyKey() . '&amp;' . $holder->nameColumn . '=' . $holder->getName(), EaseTWBPart::GlyphIcon('remove') . ' ' . _('Přestat obesílat')), new EaseHtmlATag('contacttweak.php?contact_id=' . $contactInfo['parent_id'] . '&amp;service_id=' . $holder->getId(), EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')))));
             }
         }
     }
     $this->addItem($initialContent);
 }
 /**
  * Editor k přidávání členů skupiny
  *
  * @param IEHosts $Host
  */
 public function __construct($Host)
 {
     $FieldName = 'parents';
     $InitialContent = new EaseTWBPanel(_('Potomci'));
     $InitialContent->setTagCss(array('width' => '100%'));
     if (is_null($Host->getMyKey())) {
         $InitialContent->addItem(_('Nejprve je potřeba uložit záznam'));
     } else {
         $Service = new IEService();
         $ServicesAssigned = $Service->myDbLink->queryToArray('SELECT ' . $Service->myKeyColumn . ',' . $Service->nameColumn . ' FROM ' . $Service->myTable . ' WHERE ' . $FieldName . ' LIKE \'%"' . $Host->getName() . '"%\'', $Service->myKeyColumn);
         $AllServices = $Service->getListing();
         foreach ($AllServices as $ServiceID => $ServiceInfo) {
             if ($ServiceInfo['register'] != 1) {
                 unset($AllServices[$ServiceID]);
             }
         }
         foreach ($ServicesAssigned as $ServiceID => $ServiceInfo) {
             unset($AllServices[$ServiceID]);
         }
         if (count($AllServices)) {
             foreach ($AllServices as $ServiceID => $ServiceInfo) {
                 $Jellybean = new EaseHtmlSpanTag($ServiceInfo[$Service->nameColumn], null, array('class' => 'jellybean gray'));
                 $Jellybean->addItem(new EaseHtmlATag('?addservice=' . $ServiceInfo[$Service->nameColumn] . '&amp;service_id=' . $ServiceID . '&amp;' . $Host->getmyKeyColumn() . '=' . $Host->getMyKey() . '&amp;' . $Host->nameColumn . '=' . $Host->getName(), $ServiceInfo[$Service->nameColumn]));
                 $InitialContent->addItem($Jellybean);
             }
         }
         if (count($ServicesAssigned)) {
             $InitialContent->addItem('</br>');
             foreach ($ServicesAssigned as $ServiceID => $ServiceInfo) {
                 $Jellybean = new EaseHtmlSpanTag($ServiceInfo[$Service->nameColumn], null, array('class' => 'jellybean'));
                 $Jellybean->addItem($ServiceInfo[$Service->nameColumn]);
                 $Jellybean->addItem(new EaseHtmlATag('?delservice=' . $ServiceInfo[$Service->nameColumn] . '&amp;service_id=' . $ServiceID . '&amp;' . $Host->getmyKeyColumn() . '=' . $Host->getMyKey() . '&amp;' . $Host->nameColumn . '=' . $Host->getName(), EaseTWBPart::GlyphIcon('remove')));
                 $InitialContent->addItem($Jellybean);
             }
         }
     }
     parent::__construct($InitialContent);
 }
示例#6
0
$oPage->AddJavaScript('
function get_gravatar(email, size)
{
    // MD5 (Message-Digest Algorithm) by WebToolkit
    // http://www.webtoolkit.info/javascript-md5.html
    var MD5=function (s) {function L(k,d) {return(k<<d)|(k>>>(32-d))}function K(G,k) {var I,d,F,H,x;F=(G&2147483648);H=(k&2147483648);I=(G&1073741824);d=(k&1073741824);x=(G&1073741823)+(k&1073741823);if (I&d) {return(x^2147483648^F^H)}if (I|d) {if (x&1073741824) {return(x^3221225472^F^H)} else {return(x^1073741824^F^H)}} else {return(x^F^H)}}function r(d,F,k) {return(d&F)|((~d)&k)}function q(d,F,k) {return(d&k)|(F&(~k))}function p(d,F,k) {return(d^F^k)}function n(d,F,k) {return(F^(d|(~k)))}function u(G,F,aa,Z,k,H,I) {G=K(G,K(K(r(F,aa,Z),k),I));return K(L(G,H),F)}function f(G,F,aa,Z,k,H,I) {G=K(G,K(K(q(F,aa,Z),k),I));return K(L(G,H),F)}function D(G,F,aa,Z,k,H,I) {G=K(G,K(K(p(F,aa,Z),k),I));return K(L(G,H),F)}function t(G,F,aa,Z,k,H,I) {G=K(G,K(K(n(F,aa,Z),k),I));return K(L(G,H),F)}function e(G) {var Z;var F=G.length;var x=F+8;var k=(x-(x%64))/64;var I=(k+1)*16;var aa=Array(I-1);var d=0;var H=0;while (H<F) {Z=(H-(H%4))/4;d=(H%4)*8;aa[Z]=(aa[Z]|(G.charCodeAt(H)<<d));H++}Z=(H-(H%4))/4;d=(H%4)*8;aa[Z]=aa[Z]|(128<<d);aa[I-2]=F<<3;aa[I-1]=F>>>29;return aa}function B(x) {var k="",F="",G,d;for (d=0;d<=3;d++) {G=(x>>>(d*8))&255;F="0"+G.toString(16);k=k+F.substr(F.length-2,2)}return k}function J(k) {k=k.replace(/rn/g,"n");var d="";for (var F=0;F<k.length;F++) {var x=k.charCodeAt(F);if (x<128) {d+=String.fromCharCode(x)} else {if((x>127)&&(x<2048)){d+=String.fromCharCode((x>>6)|192);d+=String.fromCharCode((x&63)|128)} else {d+=String.fromCharCode((x>>12)|224);d+=String.fromCharCode(((x>>6)&63)|128);d+=String.fromCharCode((x&63)|128)}}}return d}var C=Array();var P,h,E,v,g,Y,X,W,V;var S=7,Q=12,N=17,M=22;var A=5,z=9,y=14,w=20;var o=4,m=11,l=16,j=23;var U=6,T=10,R=15,O=21;s=J(s);C=e(s);Y=1732584193;X=4023233417;W=2562383102;V=271733878;for (P=0;P<C.length;P+=16) {h=Y;E=X;v=W;g=V;Y=u(Y,X,W,V,C[P+0],S,3614090360);V=u(V,Y,X,W,C[P+1],Q,3905402710);W=u(W,V,Y,X,C[P+2],N,606105819);X=u(X,W,V,Y,C[P+3],M,3250441966);Y=u(Y,X,W,V,C[P+4],S,4118548399);V=u(V,Y,X,W,C[P+5],Q,1200080426);W=u(W,V,Y,X,C[P+6],N,2821735955);X=u(X,W,V,Y,C[P+7],M,4249261313);Y=u(Y,X,W,V,C[P+8],S,1770035416);V=u(V,Y,X,W,C[P+9],Q,2336552879);W=u(W,V,Y,X,C[P+10],N,4294925233);X=u(X,W,V,Y,C[P+11],M,2304563134);Y=u(Y,X,W,V,C[P+12],S,1804603682);V=u(V,Y,X,W,C[P+13],Q,4254626195);W=u(W,V,Y,X,C[P+14],N,2792965006);X=u(X,W,V,Y,C[P+15],M,1236535329);Y=f(Y,X,W,V,C[P+1],A,4129170786);V=f(V,Y,X,W,C[P+6],z,3225465664);W=f(W,V,Y,X,C[P+11],y,643717713);X=f(X,W,V,Y,C[P+0],w,3921069994);Y=f(Y,X,W,V,C[P+5],A,3593408605);V=f(V,Y,X,W,C[P+10],z,38016083);W=f(W,V,Y,X,C[P+15],y,3634488961);X=f(X,W,V,Y,C[P+4],w,3889429448);Y=f(Y,X,W,V,C[P+9],A,568446438);V=f(V,Y,X,W,C[P+14],z,3275163606);W=f(W,V,Y,X,C[P+3],y,4107603335);X=f(X,W,V,Y,C[P+8],w,1163531501);Y=f(Y,X,W,V,C[P+13],A,2850285829);V=f(V,Y,X,W,C[P+2],z,4243563512);W=f(W,V,Y,X,C[P+7],y,1735328473);X=f(X,W,V,Y,C[P+12],w,2368359562);Y=D(Y,X,W,V,C[P+5],o,4294588738);V=D(V,Y,X,W,C[P+8],m,2272392833);W=D(W,V,Y,X,C[P+11],l,1839030562);X=D(X,W,V,Y,C[P+14],j,4259657740);Y=D(Y,X,W,V,C[P+1],o,2763975236);V=D(V,Y,X,W,C[P+4],m,1272893353);W=D(W,V,Y,X,C[P+7],l,4139469664);X=D(X,W,V,Y,C[P+10],j,3200236656);Y=D(Y,X,W,V,C[P+13],o,681279174);V=D(V,Y,X,W,C[P+0],m,3936430074);W=D(W,V,Y,X,C[P+3],l,3572445317);X=D(X,W,V,Y,C[P+6],j,76029189);Y=D(Y,X,W,V,C[P+9],o,3654602809);V=D(V,Y,X,W,C[P+12],m,3873151461);W=D(W,V,Y,X,C[P+15],l,530742520);X=D(X,W,V,Y,C[P+2],j,3299628645);Y=t(Y,X,W,V,C[P+0],U,4096336452);V=t(V,Y,X,W,C[P+7],T,1126891415);W=t(W,V,Y,X,C[P+14],R,2878612391);X=t(X,W,V,Y,C[P+5],O,4237533241);Y=t(Y,X,W,V,C[P+12],U,1700485571);V=t(V,Y,X,W,C[P+3],T,2399980690);W=t(W,V,Y,X,C[P+10],R,4293915773);X=t(X,W,V,Y,C[P+1],O,2240044497);Y=t(Y,X,W,V,C[P+8],U,1873313359);V=t(V,Y,X,W,C[P+15],T,4264355552);W=t(W,V,Y,X,C[P+6],R,2734768916);X=t(X,W,V,Y,C[P+13],O,1309151649);Y=t(Y,X,W,V,C[P+4],U,4149444226);V=t(V,Y,X,W,C[P+11],T,3174756917);W=t(W,V,Y,X,C[P+2],R,718787259);X=t(X,W,V,Y,C[P+9],O,3951481745);Y=K(Y,h);X=K(X,E);W=K(W,v);V=K(V,g)}var i=B(Y)+B(X)+B(W)+B(V);return i.toLowerCase()};
    var size = size || 80;

    return \'http://www.gravatar.com/avatar/\' + MD5(email) + \'.jpg?s=\' + size;
}
$(\'#UserMail\').change( function () {
      $(\'.gravatar_icon\').attr("src", get_gravatar( $(\'#UserMail\').val() , 150) );
    }
);
', NULL, TRUE);
$settingsFrame = new EaseTWBPanel(_('nastavení'));
$settingsFrame->addItem(new EaseHtmlATag('https://secure.gravatar.com/', $oUser, array('title' => 'klikni pro změnu ikony')));
$settingsFrame->addItem(new IETextInputSaver('login', $oUser->getUserLogin(), _('přihlašovací jméno')));
$settingsFrame->addItem(new EaseTWBLinkButton('changepassword.php', _('změna hesla')));
$settingsFrame->addItem(new IETextInputSaver('email', $oUser->getUserEmail(), _('emailová adresa'), array('id' => 'UserMail')));
$settingsFrame->addItem('<br>');
$oPage->columnII->addItem($settingsFrame);
if ((bool) $oUser->getSettingValue('admin')) {
    $oPage->columnIII->addItem(new EaseTWBLinkButton('?user=normal', _('Zahodit adminská oprávnění'), 'danger'));
}
//
//if (!intval($oUser->getDataValue('twitter_id'))) {
//    $oPage->columnIII->addItem(new EaseTWBLinkButton('twauth.php?authenticate=1', _('Propojit s twitterem')));
//} else {
//    $oPage->columnIII->addItem(new EaseTWBLinkButton('?action=untwittering', _('Odpojit od twiteru')));
//}
示例#7
0
        $confirmator->addItem(new EaseTWBLinkButton('?' . $script->myKeyColumn . '=' . $script->getID(), _('Ne') . ' ' . EaseTWBPart::glyphIcon('ok'), 'success'));
        $confirmator->addItem(new EaseTWBLinkButton('?delete=true&' . $script->myKeyColumn . '=' . $script->getID(), _('Ano') . ' ' . EaseTWBPart::glyphIcon('remove'), 'danger'));
        break;
    default:
        $scriptEditor = new IECfgEditor($script);
        $form = new EaseTWBForm('Script', 'script.php', 'POST', $scriptEditor, array('class' => 'form-horizontal'));
        if (!$script->getId()) {
            $form->addItem(new EaseTWSubmitButton(_('Založit'), 'success'));
        } else {
            $form->addItem(new EaseTWSubmitButton(_('Uložit'), 'success'));
        }
        break;
}
$oPage->addItem(new IEPageBottom());
$infopanel = new IEInfoBox($script);
$tools = new EaseTWBPanel(_('Nástroje'), 'warning');
if ($script->getId()) {
    $tools->addItem($script->deleteButton());
    $tools->addItem(new EaseTWBPanel(_('Transfer'), 'warning', $script->transferForm()));
    $command = new IECommand();
    $usages = $command->getColumnsFromMySQL(array($command->getMyKeyColumn(), $command->nameColumn), array('script_id' => $command->getId()), $command->nameColumn, $command->getMyKeyColumn());
    if (count($usages)) {
        $usedBy = new EaseTWBPanel(_('Používající příkazy'));
        $listing = new EaseHtmlUlTag(null, array('class' => 'list-group'));
        foreach ($usages as $usage) {
            if (!isset($usage[$command->nameColumn])) {
                $usage[$command->nameColumn] = 'n/a';
            }
            $listing->addItem(new EaseHtmlLiTag(new EaseHtmlATag('command.php?command_id=' . $usage['command_id'], $usage[$command->nameColumn]), array('class' => 'list-group-item')));
        }
        EaseContainer::addItemCustom($listing, $usedBy);
示例#8
0
 /**
  * Infopanel objektu
  *
  * @param IECfg $subject
  */
 public function __construct($subject)
 {
     parent::__construct(_('informace'), 'info', $subject->getInfoBlock());
 }
 /**
  * Přehled hostů bez potvrzeného senzoru, nebo se zastaralou konf. senzoru.
  *
  * @param array $hosts
  */
 public function __construct($hosts)
 {
     $ok = 0;
     $noSensor = array();
     $oldSensor = array();
     $noParents = array();
     $noIcon = array();
     $noContacts = array();
     EaseShared::webPage()->addItem(new EaseHtmlDivTag('preload', new IEFXPreloader(), array('class' => 'fuelux')));
     foreach ($hosts as $host_id => $host_info) {
         if (is_null($host_info['host_name']) || !strlen($host_info['host_name'])) {
             unset($hosts[$host_id]);
             continue;
         }
         if (isset($host_info['config_hash'])) {
             $host = new IEHost((int) $host_id);
             if ($host->getConfigHash() == $host_info['config_hash']) {
                 unset($hosts[$host_id]);
                 $ok++;
             } else {
                 //Zastaralá konfigurace
                 $oldSensor[$host_id] = $host_info;
             }
         } else {
             $noSensor[$host_id] = $host_info;
             //senzor neregistrován
         }
         if (!isset($host_info['parents']) || !count($host_info['parents'])) {
             $noParents[$host_id] = $host_info;
             //Host bez rodičů
         }
         if (!isset($host_info['icon_image']) || !strlen(trim($host_info['icon_image']))) {
             $noIcon[$host_id] = $host_info;
             //Host bez ikony
         }
         if (!isset($host_info['contacts']) || !count($host_info['contacts']) || (!isset($host_info['contact_groups']) || !count($host_info['contact_groups']))) {
             $noContacts[$host_id] = $host_info;
             //Host bez kontaktů
         }
     }
     $hostsTabs = new EaseTWBTabs('hostsTabs');
     if (count($oldSensor)) {
         $oldHostsTable = new EaseHtmlTableTag(null, array('class' => 'table'));
         foreach ($oldSensor as $host_id => $host_info) {
             $row = $oldHostsTable->addRowColumns(array(new EaseHtmlATag('host.php?host_id=' . $host_id, $host_info['host_name']), new EaseTWBLinkButton('sensor.php?host_id=' . $host_id, _('aktualizovat senzor'))));
             $row->setTagClass('warning');
         }
         $hostsTabs->addTab(sprintf(_('Neakt. Senzor <span class="badge">%s</span>'), count($oldSensor)), $oldHostsTable);
     }
     if (count($noSensor)) {
         $noSensorTable = new EaseHtmlTableTag(null, array('class' => 'table'));
         foreach ($noSensor as $host_id => $host_info) {
             $row = $noSensorTable->addRowColumns(array(new EaseHtmlATag('host.php?host_id=' . $host_id, $host_info['host_name']), new EaseTWBLinkButton('sensor.php?host_id=' . $host_id, _('nasadit senzor'))));
             $row->setTagClass('danger');
         }
         $hostsTabs->addTab(sprintf(_('Bez senzoru <span class="badge">%s</span>'), count($noSensor)), $noSensorTable);
     }
     if (count($noParents)) {
         $noParentsTable = new EaseHtmlTableTag(null, array('class' => 'table'));
         foreach ($noParents as $host_id => $host_info) {
             $row = $noParentsTable->addRowColumns(array(new EaseHtmlATag('host.php?host_id=' . $host_id, $host_info['host_name']), new EaseTWBLinkButton('host.php?action=parent&host_id=' . $host_id, _('přiřadit rodiče')), new EaseTWBLinkButton('watchroute.php?action=parent&host_id=' . $host_id, _('sledovat celou cestu'), 'warning', array('onClick' => "\$('#preload').css('visibility', 'visible');"))));
             $row->setTagClass('info');
         }
         $hostsTabs->addTab(sprintf(_('Bez rodičů <span class="badge">%s</span>'), count($noParents)), $noParentsTable);
     }
     if (count($noIcon)) {
         $noIconTable = new EaseHtmlTableTag(null, array('class' => 'table'));
         foreach ($noIcon as $host_id => $host_info) {
             $row = $noIconTable->addRowColumns(array(new EaseHtmlATag('host.php?host_id=' . $host_id, $host_info['host_name']), new EaseTWBLinkButton('host.php?action=icon&host_id=' . $host_id, _('přiřadit ikonu'))));
             $row->setTagClass('default');
         }
         $hostsTabs->addTab(sprintf(_('Bez ikony <span class="badge">%s</span>'), count($noIcon)), $noIconTable);
     }
     if (count($noContacts)) {
         $noContactsTable = new EaseHtmlTableTag(null, array('class' => 'table'));
         foreach ($noContacts as $host_id => $host_info) {
             $row = $noContactsTable->addRowColumns(array(new EaseHtmlATag('host.php?host_id=' . $host_id, $host_info['host_name']), new EaseTWBLinkButton('host.php?host_id=' . $host_id, _('přiřadit kontakty'))));
             $row->setTagClass('default');
         }
         $hostsTabs->addTab(sprintf(_('Bez kontaktů <span class="badge">%s</span>'), count($noContacts)), $noContactsTable);
     }
     parent::__construct(_('Hosty dle stavu konfigurace'), 'info', $hostsTabs, sprintf(_('Celkem %s hostů bez aktuální konfigurace. (%s aktuální)'), count($hosts), $ok));
 }
 /**
  * Editor k přidávání členů skupiny
  *
  * @param IEHost $host
  */
 public function __construct($host)
 {
     parent::__construct();
     $fieldName = $this->getmyKeyColumn();
     if ($host->getDataValue('platform') == 'generic') {
         $note = '<small><span class="label label-info">Tip:</span> ' . _('Další sledovatelné služby budou nabídnuty po nastavení platformy hosta a vzdáleného senzoru.') . '</small>';
     } else {
         $note = array();
     }
     $initialContent = new EaseTWBPanel(_('Sledované služby'), 'default', null, $note);
     $initialContent->setTagCss(array('width' => '100%'));
     if (is_null($host->getMyKey())) {
         $initialContent->addItem(_('Nejprve je potřeba uložit záznam'));
     } else {
         $hostName = $host->getName();
         $service = new IEService();
         $parentServUsed = array();
         $host_active = (bool) $host->getCfgValue('active_checks_enabled');
         $host_passive = (bool) $host->getCfgValue('passive_checks_enabled');
         $servicesAssigned = $service->myDbLink->queryToArray('SELECT ' . $service->myKeyColumn . ',display_name,' . $service->nameColumn . ' FROM ' . $service->myTable . ' WHERE ' . $fieldName . ' LIKE \'%"' . $host->getName() . '"%\'', $service->myKeyColumn);
         $allServices = $service->getListing(null, true, array('platform', 'parent_id', 'passive_checks_enabled', 'active_checks_enabled', 'display_name'));
         foreach ($allServices as $serviceID => $serviceInfo) {
             $servicePassive = (bool) $serviceInfo['passive_checks_enabled'];
             $serviceActive = (bool) $serviceInfo['active_checks_enabled'];
             if ($serviceInfo['register'] != 1) {
                 unset($allServices[$serviceID]);
                 continue;
             }
             if ($serviceInfo['platform'] != 'generic' && $serviceInfo['platform'] != $host->getDataValue('platform')) {
                 unset($allServices[$serviceID]);
                 continue;
             }
             if ((!$host_passive || !$servicePassive) && (!$host_active || !$serviceActive)) {
                 unset($allServices[$serviceID]);
                 continue;
             }
         }
         foreach ($servicesAssigned as $serviceID => $serviceInfo) {
             if (isset($allServices[$serviceID]) && isset($parentServUsed[$allServices[$serviceID]['parent_id']])) {
                 $parentServUsed[$allServices[$serviceID]['parent_id']] = $allServices[$serviceID]['parent_id'];
             }
             unset($allServices[$serviceID]);
         }
         if (count($allServices)) {
             foreach ($allServices as $serviceID => $serviceInfo) {
                 if (isset($parentServUsed[$serviceInfo['parent_id']])) {
                     continue;
                 }
                 $unchMenu = array();
                 if (intval($serviceInfo['parent_id'])) {
                     $unchMenu[] = new EaseHtmlATag('servicetweak.php?service_id=' . $serviceID, EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace'));
                 }
                 $unchMenu[] = new EaseHtmlATag('?addservice=' . $serviceInfo[$service->nameColumn] . '&amp;service_id=' . $serviceID . '&amp;' . $host->getmyKeyColumn() . '=' . $host->getMyKey() . '&amp;' . $host->nameColumn . '=' . $host->getName(), EaseTWBPart::GlyphIcon('plus') . ' ' . _('Začít sledovat'));
                 if (strlen($serviceInfo['display_name'])) {
                     $serviceName = $serviceInfo['display_name'];
                 } else {
                     $serviceName = $serviceInfo[$service->nameColumn];
                 }
                 $initialContent->addItem(new EaseTWBButtonDropdown($serviceName, 'inverse', 'xs', $unchMenu));
             }
         }
         if (count($servicesAssigned)) {
             $saveAsTemplateButton = new EaseTWBLinkButton('stemplate.php?action=copyhost&host_id=' . $host->getId(), _('Uložit jako předlohu'), 'success');
             $initialContent->footer($saveAsTemplateButton);
             $initialContent->addItem('</br>');
             foreach ($servicesAssigned as $serviceID => $serviceInfo) {
                 if (strlen($serviceInfo['display_name'])) {
                     $serviceName = $serviceInfo['display_name'];
                 } else {
                     $serviceName = $serviceInfo[$service->nameColumn];
                 }
                 $initialContent->addItem(new EaseTWBButtonDropdown($serviceName, 'success', 'xs', array(new EaseHtmlATag('?delservice=' . $serviceInfo[$service->nameColumn] . '&amp;service_id=' . $serviceID . '&amp;' . $host->getmyKeyColumn() . '=' . $host->getMyKey() . '&amp;' . $host->nameColumn . '=' . $host->getName(), EaseTWBPart::GlyphIcon('remove') . ' ' . _('Přestat sledovat')), new EaseHtmlATag('servicetweak.php?service_id=' . $serviceID . '&amp;host_id=' . $host->getId(), EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')))));
             }
         } else {
             $presetSelForm = new EaseTWBForm('presetSelForm');
             $presetSelForm->addItem(new EaseHtmlInputHiddenTag($host->getmyKeyColumn(), $host->getId()));
             $presetSelForm->addItem(new EaseHtmlInputHiddenTag('action', 'applystemplate'));
             $presetSelForm->addItem(new IEStemplateSelect('stemplate_id'));
             $presetSelForm->addItem(new EaseTWSubmitButton(_('Aplikovat předlohu'), 'success'));
             $presetSelForm->setTagClass('form-inline');
             $initialContent->footer($presetSelForm);
         }
     }
     $this->addItem($initialContent);
 }
示例#11
0
 /**
  * Vrací mazací tlačítko
  *
  * @param  string                     $name   jméno objektu
  * @param  string                     $urlAdd Předávaná část URL
  * @return \EaseJQConfirmedLinkButton
  */
 public function deleteButton($name = null, $urlAdd = '')
 {
     if ($this->getOwnerID() == EaseShared::user()->getUserID() || EaseShared::user()->getSettingValue('admin')) {
         if ($this->allowTemplating && $this->isTemplate()) {
             $columnsList = array($this->getmyKeyColumn(), $this->nameColumn, $this->userColumn);
             if ($this->publicRecords) {
                 $columnsList[] = 'public';
             }
             $used = $this->getColumnsFromMySQL($columnsList, array('use' => $this->getDataValue('name')), $this->nameColumn, $this->getmyKeyColumn());
             if (count($used)) {
                 $usedFrame = new EaseTWBPanel(_('je předlohou pro'), 'info', null, _('není proto možné smazat'));
                 foreach ($used as $usId => $usInfo) {
                     if ($this->publicRecords && $usInfo['public'] != true && $usInfo[$this->userColumn] != EaseShared::user()->getUserID()) {
                         $usedFrame->addItem(new EaseHtmlSpanTag(null, $usInfo[$this->nameColumn], array('class' => 'jellybean gray')));
                     } else {
                         $usedFrame->addItem(new EaseHtmlSpanTag(null, new EaseHtmlATag('?' . $this->getmyKeyColumn() . '=' . $usId . '&' . $urlAdd, $usInfo[$this->nameColumn]), array('class' => 'jellybean')));
                     }
                 }
                 return $usedFrame;
             }
         }
         EaseShared::webPage()->addItem(new IEConfirmationDialog('delete' . $this->getId(), '?' . $this->getmyKeyColumn() . '=' . $this->getID() . '&delete=true' . '&' . $urlAdd, _('Smazat') . ' ' . $name, sprintf(_('Opravdu smazat %s ?'), '<strong>' . $this->getName() . '</strong>')));
         return new EaseHtmlButtonTag(array(EaseTWBPart::GlyphIcon('remove'), _('Smazat') . ' ' . $this->keyword . ' ' . $this->getName()), array('style' => 'cursor: default', 'class' => 'btn btn-danger', 'id' => 'triggerdelete' . $this->getId(), 'data-id' => $this->getId()));
     } else {
         return '';
     }
 }
示例#12
0
    if (is_null($ContactgroupID)) {
        $oUser->addStatusMessage(_('Skupina kontaktů nebyla uložena'), 'warning');
    } else {
        $oUser->addStatusMessage(_('Skupina kontaktů byla uložena'), 'success');
    }
}
$contactgroup->saveMembers();
$delete = $oPage->getGetValue('delete', 'bool');
if ($delete == 'true') {
    $contactgroup->delete();
}
$contactgroupEdit = new IECfgEditor($contactgroup);
$form = new EaseTWBForm('Contactgroup', 'contactgroup.php', 'POST', $contactgroupEdit, array('class' => 'form-horizontal'));
$form->setTagID($form->getTagName());
if (!is_null($contactgroup->getMyKey())) {
    $form->addItem(new EaseHtmlInputHiddenTag($contactgroup->getmyKeyColumn(), $contactgroup->getMyKey()));
}
$form->addItem('<br>');
$form->addItem(new EaseTWSubmitButton(_('Uložit'), 'success'));
$oPage->addItem(new IEPageBottom());
$infopanel = new IEInfoBox($contactgroup);
$tools = new EaseTWBPanel(_('Nástroje'), 'warning');
if ($contactgroup->getId()) {
    $tools->addItem($contactgroup->deleteButton());
}
$pageRow = new EaseTWBRow();
$pageRow->addColumn(2, $infopanel);
$pageRow->addColumn(6, new EaseTWBPanel(_('Skupina kontaktů') . ' <strong>' . $contactgroup->getName() . '</strong>', 'default', $form));
$pageRow->addColumn(4, $tools);
$oPage->container->addItem($pageRow);
$oPage->draw();