コード例 #1
1
 /**
  * Lists all Articlecomment models.
  * @return mixed
  */
 public function actionIndex()
 {
     $list = '';
     $post = Yii::$app->request->post();
     if ($post['id']) {
         $mod = new Query();
         $comment = $mod->select(['a.id', 'a.parentId', 'a.articleId', 'a.content', 'a.createTime', 'b.username'])->from('articlecomment as a')->leftJoin('user as b', 'a.userId = b.id')->where(['commentId' => $post['id']])->orderBy(['createTime' => 'DESC', 'id' => 'DESC'])->createCommand()->queryAll();
         if ($comment) {
             foreach ($comment as $v) {
                 $content = '回复@' . Articlecomment::getCommentByParId($v['parentId']) . ':' . $v['content'];
                 $ahtml = html::a(html::tag("i", "", ["class" => "fa fa-thumbs-o-up"]) . html::tag("span", "回复"), ["/main/viewart", "id" => $v["articleId"], "parId" => $v['id']]);
                 $list .= '<div class="infos small-comment' . $post['id'] . '" style="border:1px solid;">
                         	<div class="media-body markdown-reply content-body">
                         		<p>' . $content . '</p>
                         		<span class="opts pull-right">
                         			<a class="author" >' . $v["username"] . '</a>
                         			•
                         			<addr title="' . $v["createTime"] . '">' . Html::tag("span", Yii::$app->formatter->asRelativeTime($v["createTime"])) . '</addr>
                         			' . $ahtml . '
                                 </span>
                         	</div>
                         </div>';
             }
         }
     }
     $result = array('success' => true, 'message' => $list);
     echo json_encode($result);
     die;
     return $this->renderAjax('index', ['success' => true, 'message' => '']);
 }
 /**
  * Place a link in the messageAttachments (template object) 
  * to trigger the removal of all attachments
  */
 function attachment_removelink($p)
 {
     /* // place links to remove attachment for each attachment
             $links = preg_split('/(<li[^>]*>)/', $p['content'], null, PREG_SPLIT_DELIM_CAPTURE);		
     
             for ($i = 1; $i < count($links); $i+=2) {
                 if (preg_match('/ id="attach([0-9]+)"/', $links[$i], $matches)) {
                     $remove = $this->api->output->button(array('command' => 'plugin.removeattachments.removeone', 
                                                                'prop' => $matches[1], 
                                                                'image' => $this->url(null) . $this->local_skin_path() . '/del.png', 
                                                                'title' => 'removeattachments.removeattachment',
                                                                'style' => 'vertical-align:middle'));
                     $links[$i+1] = str_replace('</li>', '&nbsp;' . $remove . '</li>', $links[$i+1]);
     			}
     		}
     
             $p['content'] = join('', $links);
             */
     // when there are multiple attachments allow delete all
     if (substr_count($p['content'], ' id="attach') > 1) {
         $link = $this->api->output->button(array('type' => 'link', 'command' => 'plugin.removeattachments.removeall', 'content' => rcube::Q($this->gettext('removeattachments.removeall')), 'title' => 'removeattachments.removeall', 'class' => 'button removeattachments'));
         switch (rcmail::get_instance()->config->get('skin')) {
             case 'classic':
                 //$p['content'] = preg_replace('/(<ul[^>]*>)/', '$1' . $link, $p['content']);
                 $p['content'] = str_replace('</ul>', html::tag('li', null, $link) . '</ul>', $p['content']);
                 break;
             default:
                 $p['content'] .= $link;
                 break;
         }
         $this->include_stylesheet($this->local_skin_path() . '/removeattachments.css');
     }
     return $p;
 }
コード例 #3
0
 /**
  * Callback function when HTML page is rendered
  * We'll add an overlay box here.
  */
 function render_page($p)
 {
     if ($_SESSION['plugin.newuserdialog'] && $p['template'] == 'mail') {
         $this->add_texts('localization');
         $rcmail = rcmail::get_instance();
         $identity = $rcmail->user->get_identity();
         $identities_level = intval($rcmail->config->get('identities_level', 0));
         // compose user-identity dialog
         $table = new html_table(array('cols' => 2));
         $table->add('title', $this->gettext('name'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_name', 'value' => $identity['name'], 'disabled' => $identities_level == 4)));
         $table->add('title', $this->gettext('email'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_email', 'value' => rcube_utils::idn_to_utf8($identity['email']), 'disabled' => in_array($identities_level, array(1, 3, 4)))));
         $table->add('title', $this->gettext('organization'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_organization', 'value' => $identity['organization'], 'disabled' => $identities_level == 4)));
         $table->add('title', $this->gettext('signature'));
         $table->add(null, html::tag('textarea', array('name' => '_signature', 'rows' => '3'), $identity['signature']));
         // add overlay input box to html page
         $rcmail->output->add_footer(html::tag('form', array('id' => 'newuserdialog', 'action' => $rcmail->url('plugin.newusersave'), 'method' => 'post'), html::p('hint', rcube::Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => 'formbuttons'), html::tag('input', array('type' => 'submit', 'class' => 'button mainaction', 'value' => $this->gettext('save'))))));
         $title = rcube::JQ($this->gettext('identitydialogtitle'));
         $script = "\n\$('#newuserdialog').show()\n  .dialog({modal:true, resizable:false, closeOnEscape:false, width:450, title:'{$title}'})\n  .submit(function() {\n    var i, request = {}, form = \$(this).serializeArray();\n    for (i in form)\n      request[form[i].name] = form[i].value;\n\n      rcmail.http_post('plugin.newusersave', request, true);\n      return false;\n  });\n\n\$('input[name=_name]').focus();\nrcube_webmail.prototype.new_user_dialog_close = function() { \$('#newuserdialog').dialog('close'); }\n";
         // disable keyboard events for messages list (#1486726)
         $rcmail->output->add_script($script, 'docready');
         $this->include_stylesheet('newuserdialog.css');
     }
 }
コード例 #4
0
 function init()
 {
     $this->rcmail = rcmail::get_instance();
     $this->out = html::tag('div', array('style' => 'font-size: 12px; text-align: justify; position: absolute; margin-left: auto; left: 50%; margin-left: -250px; width: 500px;'), html::tag('h3', null, 'Welcome to MyRoundcube Plugins - Plugin Manager Installer') . html::tag('span', null, 'Please ' . html::tag('a', array('href' => $this->svn), 'download') . ' Plugin Manager package and upload the entire package to your Roundcube\'s plugin folder.' . html::tag('br') . html::tag('br') . ' If you are prompted to overwrite <i>"./plugins/plugin_manager"</i> please do so.') . html::tag('br') . html::tag('br') . html::tag('div', array('style' => 'display: inline; float: left'), html::tag('a', array('href' => 'javascript:void(0)', 'onclick' => 'document.location.href=\'./\''), $this->gettext('done'))));
     $this->register_handler('plugin.body', array($this, 'download'));
     $this->rcmail->output->send('plugin');
 }
コード例 #5
0
 function frame()
 {
     $rcmail = rcube::get_instance();
     $this->load_config();
     // generate SSO auth token
     if (empty($_SESSION['dokuwikiauth'])) {
         $_SESSION['dokuwikiauth'] = md5('dokuwikisso' . $_SESSION['user_id'] . microtime() . $rcmail->config->get('des_key'));
     }
     // for multidomain
     // for getting domain we simply take the part from login-name after "@":
     $domain = explode('@', $_SESSION['username'])[1];
     // first we use single configured url
     $src = $rcmail->config->get('dokuwiki_url');
     // next we check for a general dokuwiki subdomain
     if ($rcmail->config->get('dokuwiki_subdomain') != '') {
         $subdomain = $rcmail->config->get('dokuwiki_subdomain');
         $src = 'http://' . $subdomain . '.' . $domain . '/doku.php';
     }
     // use a configured url for this domain if exists
     if ($rcmail->config->get('dokuwiki_urls')[$domain] != '') {
         $src = 'http://' . $rcmail->config->get('dokuwiki_urls')[$domain] . '/doku.php';
     }
     //$src = 'http://' . $subdomain . '.' . $domain . '/doku.php';
     $src .= '?kolab_auth=' . strrev(rtrim(base64_encode(http_build_query(array('session' => session_id(), 'cname' => session_name(), 'token' => $_SESSION['dokuwikiauth']))), '='));
     return html::tag('iframe', array('id' => 'dokuwikiframe', 'src' => $src, 'width' => "100%", 'height' => "100%", 'frameborder' => 0));
 }
コード例 #6
0
 function init()
 {
     $this->register_action('plugin.markasjunk2.junk', array($this, 'mark_message'));
     $this->register_action('plugin.markasjunk2.not_junk', array($this, 'mark_message'));
     $rcmail = rcube::get_instance();
     $this->load_config();
     $this->ham_mbox = $rcmail->config->get('markasjunk2_ham_mbox', 'INBOX');
     $this->spam_mbox = $rcmail->config->get('markasjunk2_spam_mbox', $rcmail->config->get('junk_mbox', null));
     $this->toolbar = $this->_set_toolbar_display($rcmail->config->get('markasjunk2_toolbar', -1), $rcmail->action);
     // register the ham/spam flags with the core
     $this->add_hook('storage_init', array($this, 'set_flags'));
     if ($rcmail->action == '' || $rcmail->action == 'show') {
         $this->include_script('markasjunk2.js');
         $this->add_texts('localization', true);
         $this->include_stylesheet($this->local_skin_path() . '/markasjunk2.css');
         if ($this->toolbar) {
             // add the buttons to the main toolbar
             $this->add_button(array('command' => 'plugin.markasjunk2.junk', 'type' => 'link', 'class' => 'button buttonPas markasjunk2 disabled', 'classact' => 'button markasjunk2', 'classsel' => 'button markasjunk2Sel', 'title' => 'markasjunk2.buttonjunk', 'label' => 'junk'), 'toolbar');
             $this->add_button(array('command' => 'plugin.markasjunk2.not_junk', 'type' => 'link', 'class' => 'button buttonPas markasnotjunk2 disabled', 'classact' => 'button markasnotjunk2', 'classsel' => 'button markasnotjunk2Sel', 'title' => 'markasjunk2.buttonnotjunk', 'label' => 'markasjunk2.notjunk'), 'toolbar');
         } else {
             // add the buttons to the mark message menu
             $markjunk = $this->api->output->button(array('command' => 'plugin.markasjunk2.junk', 'label' => 'markasjunk2.markasjunk', 'id' => 'markasjunk2', 'class' => 'icon markasjunk2', 'classact' => 'icon markasjunk2 active', 'innerclass' => 'icon markasjunk2'));
             $marknotjunk = $this->api->output->button(array('command' => 'plugin.markasjunk2.not_junk', 'label' => 'markasjunk2.markasnotjunk', 'id' => 'markasnotjunk2', 'class' => 'icon markasnotjunk2', 'classact' => 'icon markasnotjunk2 active', 'innerclass' => 'icon markasnotjunk2'));
             $this->api->add_content(html::tag('li', array('role' => 'menuitem'), $markjunk), 'markmenu');
             $this->api->add_content(html::tag('li', array('role' => 'menuitem'), $marknotjunk), 'markmenu');
         }
         // add markasjunk2 folder settings to the env for JS
         $this->api->output->set_env('markasjunk2_ham_mailbox', $this->ham_mbox);
         $this->api->output->set_env('markasjunk2_spam_mailbox', $this->spam_mbox);
         $this->api->output->set_env('markasjunk2_move_spam', $rcmail->config->get('markasjunk2_move_spam', false));
         $this->api->output->set_env('markasjunk2_move_ham', $rcmail->config->get('markasjunk2_move_ham', false));
         // check for init method from driver
         $this->_call_driver('init');
     }
 }
コード例 #7
0
ファイル: embed.php プロジェクト: aoimedia/kosmonautensofa
 /**
  * Embeds a github gist
  *
  * @param string $url Gist url: i.e. https://gist.github.com/2924148
  * @param string $file The name of a particular file from the gist, which should displayed only.
  * @return string
  */
 public static function gist($url, $file = null)
 {
     // url for the script file
     $url = $url . '.js' . r(!is_null($file), '?file=' . $file);
     // load the gist
     return html::tag('script', '', array('src' => $url));
 }
コード例 #8
0
 /**
  * Plugin initialization.
  */
 function init()
 {
     $this->version_detect();
     $this->rc = rcube::get_instance();
     $this->rm = rcmail::get_instance();
     $this->add_hook('user_create', array($this, 'user_create'));
     $this->register_action('plugin.pks_search', array($this, 'hkp_search'));
     $this->register_action('plugin.hkp_add', array($this, 'hkp_add'));
     $this->register_action('plugin.pubkey_save', array($this, 'pubkey_save'));
     if ($this->rc->task == 'mail') {
         $this->add_hook('render_page', array($this, 'render_page'));
         // make localization available on the client
         $this->add_texts('localization/', true);
         // load js
         $this->include_script('js/openpgp.min.js');
         $this->include_script('js/rc_openpgpjs.crypto.js');
         $this->include_script('js/rc_openpgpjs.js');
         if (isset($_SESSION["rc_openpgpjs_outdated"])) {
             $this->include_script('js/outdated.js');
         }
         // load css
         $this->include_stylesheet($this->local_skin_path() . '/rc_openpgpjs.css');
         // add public key attachment related hooks
         $this->add_hook('message_compose', array($this, 'message_compose'));
         $this->add_hook('message_sent', array($this, 'unlink_pubkey'));
         if ($this->api->output->type == 'html') {
             // add key manager item to message menu
             $opts = array("command" => "open-key-manager", "label" => "rc_openpgpjs.key_manager", "type" => "link", "classact" => "icon active", "class" => "icon", "innerclass" => "icon key_manager");
             $this->api->add_content(html::tag('li', null, $this->api->output->button($opts)), "messagemenu");
             if ($this->rc->action == 'compose') {
                 // add key manager button to compose toolbar
                 $opts = array("command" => "open-key-manager", "label" => "rc_openpgpjs.key_manager", "type" => "link", "classact" => "button active key_manager", "class" => "button key_manager");
                 $this->api->add_content($this->api->output->button($opts), "toolbar");
                 // add encrypt and sign checkboxes to composeoptions
                 $encrypt_opts = array('id' => 'openpgpjs_encrypt', 'type' => 'checkbox');
                 if ($this->rc->config->get('encrypt', false)) {
                     $encrypt_opts['checked'] = 'checked';
                 }
                 $encrypt = new html_inputfield($encrypt_opts);
                 $this->api->add_content(html::span('composeoption', html::label(null, $encrypt->show() . $this->gettext('encrypt'))), "composeoptions");
                 $sign_opts = array('id' => 'openpgpjs_sign', 'type' => 'checkbox');
                 if ($this->rc->config->get('sign', false)) {
                     $sign_opts['checked'] = 'checked';
                 }
                 $sign = new html_inputfield($sign_opts);
                 $this->api->add_content(html::span('composeoption', html::label(null, $sign->show() . $this->gettext('sign'))), "composeoptions");
             }
         }
     } elseif ($this->rc->task == 'settings') {
         // load localization
         $this->add_texts('localization/', false);
         // add hooks for OpenPGP settings
         $this->add_hook('preferences_list', array($this, 'preferences_list'));
         $this->add_hook('preferences_save', array($this, 'preferences_save'));
     }
 }
コード例 #9
0
 public function addition_folder_options()
 {
     $this->add_texts('localization/');
     $li = '';
     $li .= html::tag('li', null, $this->api->output->button(array('command' => 'plugin.contextmenu.readfolder', 'type' => 'link', 'class' => 'readfolder', 'label' => 'contextmenu.markreadfolder')));
     $li .= html::tag('li', null, $this->api->output->button(array('command' => 'plugin.contextmenu.collapseall', 'type' => 'link', 'class' => 'collapseall rcmglobal', 'label' => 'contextmenu.collapseall')));
     $li .= html::tag('li', null, $this->api->output->button(array('command' => 'plugin.contextmenu.expandall', 'type' => 'link', 'class' => 'expandall rcmglobal', 'label' => 'contextmenu.expandall')));
     $li .= html::tag('li', null, $this->api->output->button(array('command' => 'plugin.contextmenu.openfolder', 'type' => 'link', 'class' => 'openfolder rcmglobal', 'label' => 'openinextwin')));
     $out = html::tag('ul', array('id' => 'rcmFolderMenu'), $li);
     $this->api->output->add_footer(html::div(array('style' => 'display: none;'), $out));
 }
コード例 #10
0
ファイル: HTMLTest.php プロジェクト: getkirby/toolkit
 public function testTag()
 {
     $expected = '<img src="myimage.jpg" width="100" height="200">';
     $this->assertEquals($expected, html::tag('img', null, array('src' => 'myimage.jpg', 'width' => 100, 'height' => 200)));
     $expected = '<a href="http://google.com" title="Google">Google</a>';
     $this->assertEquals($expected, html::tag('a', 'Google', array('href' => 'http://google.com', 'title' => 'Google')));
     $expected = '<p>Nice Paragraph</p>';
     $this->assertEquals($expected, html::tag('p', 'Nice Paragraph'));
     $expected = '<br>';
     $this->assertEquals($expected, html::tag('br'));
 }
コード例 #11
0
 public function write($contents = '')
 {
     self::reset(true);
     // load embed.css from skin folder (if exists)
     if ($embed_css = $this->get_skin_file('/embed.css')) {
         $this->include_css($embed_css);
     } else {
         // set default styles for warning blocks inside the attachment part frame
         $this->add_header(html::tag('style', array('type' => 'text/css'), ".rcmail-inline-message { font-family: sans-serif; border:2px solid #ffdf0e; background:#fef893; padding:0.6em 1em; margin-bottom:0.6em }\n" . ".rcmail-inline-buttons { margin-bottom:0 }"));
     }
     parent::write($contents);
 }
コード例 #12
0
ファイル: contextmenu.php プロジェクト: nciftci/plugins
 public function addition_addressbook_options()
 {
     $this->add_texts('localization/');
     $li = '';
     $li .= html::tag('li', array('role' => 'menuitem'), $this->api->output->button(array('command' => 'plugin.contextmenu.assigngroup', 'type' => 'link', 'class' => 'assigngroup disabled', 'classact' => 'assigngroup active', 'label' => 'contextmenu.assigngroup', 'tabindex' => '-1', 'aria-disabled' => 'true')));
     if (count(rcube::get_instance()->get_address_sources(true)) > 1) {
         // only show the move option if there are sources to move between
         $li .= html::tag('li', array('role' => 'menuitem'), $this->api->output->button(array('command' => 'move', 'type' => 'link', 'class' => 'movecontact disabled', 'classact' => 'movecontact active', 'label' => 'moveto', 'tabindex' => '-1', 'aria-disabled' => 'true')));
         $li .= html::tag('li', array('role' => 'menuitem'), $this->api->output->button(array('command' => 'copy', 'type' => 'link', 'class' => 'copycontact disabled', 'classact' => 'copycontact active', 'label' => 'copyto', 'tabindex' => '-1', 'aria-disabled' => 'true')));
     }
     $out = html::tag('ul', array('id' => 'rcmAddressBookMenu', 'role' => 'menu'), $li);
     $this->api->output->add_footer(html::div(array('style' => 'display: none;', 'aria-hidden' => 'true'), $out));
 }
コード例 #13
0
ファイル: markasjunk2.php プロジェクト: ehmedov/www
 function init()
 {
     $this->register_action('plugin.markasjunk2', array($this, 'mark_junk'));
     $this->register_action('plugin.markasnotjunk2', array($this, 'mark_notjunk'));
     $rcmail = rcmail::get_instance();
     $this->load_config();
     $this->spam_mbox = $rcmail->config->get('junk_mbox', null);
     $this->toolbar = $rcmail->config->get('markasjunk2_mb_toolbar', true);
     if ($rcmail->config->get('markasjunk2_spam_flag', false)) {
         if ($flag = array_search($rcmail->config->get('markasjunk2_spam_flag'), $GLOBALS['IMAP_FLAGS'])) {
             $this->spam_flag = $flag;
         } else {
             $GLOBALS['IMAP_FLAGS'][$this->spam_flag] = $rcmail->config->get('markasjunk2_spam_flag');
         }
     }
     if ($rcmail->config->get('markasjunk2_ham_flag', false)) {
         if ($flag = array_search($rcmail->config->get('markasjunk2_ham_flag'), $GLOBALS['IMAP_FLAGS'])) {
             $this->ham_flag = $flag;
         } else {
             $GLOBALS['IMAP_FLAGS'][$this->ham_flag] = $rcmail->config->get('markasjunk2_ham_flag');
         }
     }
     if (($rcmail->action == '' || $rcmail->action == 'show') && !empty($rcmail->user->ID)) {
         $this->include_script('markasjunk2.js');
         $this->add_texts('localization', true);
         if ($rcmail->action == 'show' && ($this->spam_mbox && $_SESSION['mbox'] != $this->spam_mbox)) {
             $this->add_button(array('command' => 'plugin.markasjunk2', 'imagepas' => $this->local_skin_path() . '/junk_pas.png', 'imageact' => $this->local_skin_path() . '/junk_act.png', 'alt' => 'markasjunk2.buttonjunk', 'title' => 'markasjunk2.buttonjunk'), 'toolbar');
         } elseif ($rcmail->action == 'show' && ($this->spam_mbox && $_SESSION['mbox'] == $this->spam_mbox)) {
             $this->add_button(array('command' => 'plugin.markasnotjunk2', 'imagepas' => $this->local_skin_path() . '/notjunk_pas.png', 'imageact' => $this->local_skin_path() . '/notjunk_act.png', 'alt' => 'markasjunk2.buttonnotjunk', 'title' => 'markasjunk2.buttonnotjunk'), 'toolbar');
         } elseif ($this->spam_mbox && $this->toolbar) {
             if ($_SESSION['mbox'] == $this->spam_mbox) {
                 $this->add_button(array('command' => 'plugin.markasjunk2', 'id' => 'markasjunk2', 'imagepas' => $this->local_skin_path() . '/junk_pas.png', 'imageact' => $this->local_skin_path() . '/junk_act.png', 'alt' => 'markasjunk2.buttonjunk', 'title' => 'markasjunk2.buttonjunk', 'style' => 'display: none;'), 'toolbar');
                 $this->add_button(array('command' => 'plugin.markasnotjunk2', 'id' => 'markasnotjunk2', 'imagepas' => $this->local_skin_path() . '/notjunk_pas.png', 'imageact' => $this->local_skin_path() . '/notjunk_act.png', 'alt' => 'markasjunk2.buttonnotjunk', 'title' => 'markasjunk2.buttonnotjunk'), 'toolbar');
             } else {
                 $this->add_button(array('command' => 'plugin.markasjunk2', 'id' => 'markasjunk2', 'imagepas' => $this->local_skin_path() . '/junk_pas.png', 'imageact' => $this->local_skin_path() . '/junk_act.png', 'alt' => 'markasjunk2.buttonjunk', 'title' => 'markasjunk2.buttonjunk'), 'toolbar');
                 $this->add_button(array('command' => 'plugin.markasnotjunk2', 'id' => 'markasnotjunk2', 'imagepas' => $this->local_skin_path() . '/notjunk_pas.png', 'imageact' => $this->local_skin_path() . '/notjunk_act.png', 'alt' => 'markasjunk2.buttonnotjunk', 'title' => 'markasjunk2.buttonnotjunk', 'style' => 'display: none;'), 'toolbar');
             }
         } elseif ($this->spam_mbox) {
             $this->include_stylesheet($this->local_skin_path() . '/markasjunk2.css');
             if ($_SESSION['mbox'] == $this->spam_mbox) {
                 $markjunk = $this->api->output->button(array('command' => 'plugin.markasjunk2', 'label' => 'markasjunk2.markasjunk', 'id' => 'markasjunk2', 'class' => 'markasjunk2', 'classact' => 'markasjunk2 active', 'style' => 'display: none;'));
                 $marknotjunk = $this->api->output->button(array('command' => 'plugin.markasnotjunk2', 'label' => 'markasjunk2.markasnotjunk', 'id' => 'markasnotjunk2', 'class' => 'markasnotjunk2', 'classact' => 'markasnotjunk2 active'));
             } else {
                 $markjunk = $this->api->output->button(array('command' => 'plugin.markasjunk2', 'label' => 'markasjunk2.markasjunk', 'id' => 'markasjunk2', 'class' => 'markasjunk2', 'classact' => 'markasjunk2 active'));
                 $marknotjunk = $this->api->output->button(array('command' => 'plugin.markasnotjunk2', 'label' => 'markasjunk2.markasnotjunk', 'id' => 'markasnotjunk2', 'class' => 'markasnotjunk2', 'classact' => 'markasnotjunk2 active', 'style' => 'display: none;'));
             }
             $this->api->add_content(html::tag('li', null, $markjunk), 'markmenu');
             $this->api->add_content(html::tag('li', null, $marknotjunk), 'markmenu');
         }
     }
 }
コード例 #14
0
 public function actionGetSessions()
 {
     $date = date('Y-m-d', strtotime(yii::$app->request->post('date')));
     $session = yii::$app->worksess->getSessions(null, $date);
     $json = [];
     if (empty($session)) {
         $json['HtmlList'] = '<ul><li>Сессии не были открыты.</li></ul>';
     } else {
         $json['HtmlList'] = Html::ul($session, ['item' => function ($item, $index) {
             return html::tag('li', Html::a(date('d.m.Y H:i:s', $item->start_timestamp) . ' ' . $item->shiftName, ['/service/report/index', 'sessionId' => $item->id]));
         }]);
     }
     die(json_encode($json));
 }
コード例 #15
0
ファイル: buttons.php プロジェクト: williampan/w
 public function __toString()
 {
     $html = '<nav class="field-buttons">';
     $html .= '<ul class="nav nav-bar">';
     foreach (static::$setup as $key => $button) {
         $icon = '<i class="icon fa fa-' . $button['icon'] . '"></i>';
         $html .= '<li class="field-button-' . $key . '">';
         $html .= html::tag('button', $icon, array('type' => 'button', 'tabindex' => '-1', 'title' => @$button['label'] . ' (' . @$button['shortcut'] . ')', 'class' => 'btn', 'data-editor-shortcut' => @$button['shortcut'], 'data-tpl' => @$button['template'], 'data-text' => @$button['text'], 'data-action' => @$button['action']));
         $html .= '</li>';
     }
     $html .= '</ul>';
     $html .= '</nav>';
     return $html;
 }
コード例 #16
0
 /**
  * Adds download options menu to the page
  */
 public function download_menu()
 {
     $this->include_script('zipdownload.js');
     $this->add_label('download');
     $rcmail = rcmail::get_instance();
     $menu = array();
     $ul_attr = array('role' => 'menu', 'aria-labelledby' => 'aria-label-zipdownloadmenu');
     if ($rcmail->config->get('skin') != 'classic') {
         $ul_attr['class'] = 'toolbarmenu';
     }
     foreach (array('eml', 'mbox', 'maildir') as $type) {
         $menu[] = html::tag('li', null, $rcmail->output->button(array('command' => "download-{$type}", 'label' => "zipdownload.download{$type}", 'classact' => 'active')));
     }
     $rcmail->output->add_footer(html::div(array('id' => 'zipdownload-menu', 'class' => 'popupmenu', 'aria-hidden' => 'true'), html::tag('h2', array('class' => 'voice', 'id' => 'aria-label-zipdownloadmenu'), "Message Download Options Menu") . html::tag('ul', $ul_attr, implode('', $menu))));
 }
コード例 #17
0
 function preferences_list($args)
 {
     if ($args['section'] == 'jabber') {
         $jabber_username = $this->rc->config->get('jabber_username');
         $jabber_domain = $this->rc->config->get('jabber_domain', 'jappix.com');
         $jabber_enc = $this->rc->config->get('jabber_enc');
         if ((!$jabber_username || !$jabber_enc || !$jabber_domain) && $this->rc->config->get('jappix_register_url')) {
             $field_id = 'rcmfd_register';
             $args['blocks']['jabber']['options']['jappix_register'] = array('title' => html::label($field_id, @$this->gettext('requirement')), 'content' => html::tag('a', array('href' => $this->rc->config->get('jappix_register_url'), 'target' => '_blank'), $this->gettext('clickhere')) . ' ' . $this->gettext('registeraccount'));
         }
         $jappix_enabled = $this->rc->config->get('jappix_enabled', 0);
         $field_id = 'rcmfd_enabled';
         $checkbox = new html_checkbox(array('name' => '_jappix_enabled', 'value' => 1, 'id' => $field_id, 'onclick' => "if(\$(this).prop('checked') == false || \$('input[name=\\'_jabber_username\\']').val() != ''){ \$('.mainaction').hide(); document.forms.form.submit(); };"));
         $args['blocks']['jabber']['options']['jappix_enabled'] = array('title' => html::label($field_id, Q($this->gettext('enabled'))), 'content' => $checkbox->show($jappix_enabled ? 1 : 0));
         $field_id_user = '******';
         $input_user = new html_inputfield(array('name' => '_jabber_username', 'id' => $field_id_user, 'size' => 25));
         if ($jabber_domain == '%d') {
             $jabber_domain = end(explode('@', $this->rc->user->data['username']));
         }
         $field_id_domain = 'rcmfd_domain';
         $input_domain = new html_inputfield(array('name' => '_jabber_domain', 'id' => $field_id_domain, 'size' => 25));
         $args['blocks']['jabber']['options']['jabber_username'] = array('title' => html::label($field_id, Q($this->gettext('jappixUsername'))), 'content' => $input_user->show($jabber_username) . '&nbsp;@&nbsp;' . $input_domain->show($jabber_domain));
         $field_id = 'rcmfd_enc';
         $input = new html_passwordfield(array('name' => '_jabber_password', 'id' => $field_id, 'size' => 25, 'placeholder' => $jabber_enc ? $this->gettext('passwordisset') : $this->gettext('pleaseenterpassword')));
         $args['blocks']['jabber']['options']['jabber_password'] = array('title' => html::label($field_id, Q($this->gettext('jappixPassword'))), 'content' => $input->show());
         $jappix_full = $this->rc->config->get('jappix_full', 1);
         $field_id = 'rcmfd_use_full';
         $checkbox = new html_checkbox(array('name' => '_jappix_full', 'value' => 1, 'id' => $field_id, 'onclick' => "if(this.checked){ parent.\$('.button-jappix4roundcube').show(); } else { parent.\$('.button-jappix4roundcube').hide(); }; \$('.mainaction').hide(); document.forms.form.submit();"));
         $args['blocks']['jabber']['options']['jappix_full'] = array('title' => html::label($field_id, Q($this->gettext('usefulljappix'))), 'content' => $checkbox->show($jappix_full ? 1 : 0));
         $jappix_mini = $this->rc->config->get('jappix_mini', 1);
         $field_id = 'rcmfd_use_mini';
         $checkbox = new html_checkbox(array('name' => '_jappix_mini', 'value' => 1, 'id' => $field_id, 'onclick' => "if(this.checked){ parent.parent.\$('.jm_position').show(); } else { parent.parent.\$('.jm_position').hide(); }; \$('.mainaction').hide(); document.forms.form.submit();"));
         $args['blocks']['jabber']['options']['jappix_mini'] = array('title' => html::label($field_id, Q($this->gettext('useminijappix'))), 'content' => $checkbox->show($jappix_mini ? 1 : 0));
         $jappix_mini_autologon = $this->rc->config->get('jappix_mini_autologon', 1);
         $field_id = 'rcmfd_use_mini_autologon';
         $checkbox = new html_checkbox(array('name' => '_jappix_mini_autologon', 'value' => 1, 'id' => $field_id, 'onclick' => "if(this.checked){ parent.parent.\$('.jm_pane').trigger('click'); } else { if(parent.parent.JappixMini) parent.parent.JappixMini.disconnect(); }; \$('.mainaction').hide(); document.forms.form.submit();"));
         $args['blocks']['jabber']['options']['jappix_mini_autologon'] = array('title' => html::label($field_id, Q($this->gettext('minijappixautologon'))), 'content' => $checkbox->show($jappix_mini_autologon ? 1 : 0));
         /*
         $field_id = 'rcmfd_use_manager';
         $args['blocks']['jabber']['options']['jabber_manager'] = array(
           'title' => html::label($field_id, Q($this->gettext('manager'))),
           'content' => '<a target=\'_blank\' href=\''.$this->rc->config->get('jappix_url').'/?m=manager\'>'.Q($this->gettext('manager')).'</a>',
         );
         */
     }
     return $args;
 }
コード例 #18
0
ファイル: markbuttons.php プロジェクト: haision/myroundcube
 function html_output($p)
 {
     if ($p['name'] == "listcontrols") {
         $rcmail = rcmail::get_instance();
         $skin = $rcmail->config->get('skin', 'larry');
         if ($skin != 'classic') {
             $rcmail->output->add_header(html::tag('script', array('type' => 'text/javascript', 'src' => 'plugins/libgpl/markbuttons/markbuttons.js')));
             $this->include_stylesheet($this->local_skin_path() . '/markbuttons.css');
         }
         $r = '<span id="markbuttons" style="margin-left: 20px">' . Q($this->gettext('markbuttons_label')) . ':&nbsp;</span>';
         $r .= $this->mark_button('read', $skin);
         $r .= $this->mark_button('unread', $skin);
         $r .= $this->mark_button('flagged', $skin);
         $r .= $this->mark_button('unflagged', $skin);
         $p['content'] = $r . $p['content'];
     }
     return $p;
 }
コード例 #19
0
 /**
  * Callback function when HTML page is rendered
  * We'll add an overlay box here.
  */
 function render_page($p)
 {
     if ($_SESSION['plugin.newuserdialog']) {
         $this->add_texts('localization');
         $rcmail = rcmail::get_instance();
         $identity = $rcmail->user->get_identity();
         $identities_level = intval($rcmail->config->get('identities_level', 0));
         // compose user-identity dialog
         $table = new html_table(array('cols' => 2));
         $table->add('title', $this->gettext('name'));
         $table->add(null, html::tag('input', array('type' => "text", 'name' => "_name", 'value' => $identity['name'])));
         $table->add('title', $this->gettext('email'));
         $table->add(null, html::tag('input', array('type' => "text", 'name' => "_email", 'value' => $identity['email'], 'disabled' => $identities_level == 1 || $identities_level == 3)));
         // add overlay input box to html page
         $rcmail->output->add_footer(html::div(array('id' => "newuseroverlay"), html::tag('form', array('action' => $rcmail->url('plugin.newusersave'), 'method' => "post"), html::tag('h3', null, Q($this->gettext('identitydialogtitle'))) . html::p('hint', Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => "formbuttons"), html::tag('input', array('type' => "submit", 'class' => "button mainaction", 'value' => $this->gettext('save')))))));
         $this->include_stylesheet('newuserdialog.css');
     }
 }
コード例 #20
0
ファイル: jqueryui.php プロジェクト: alecchisi/roundcubemail
 public static function miniColors()
 {
     if (in_array('miniColors', self::$features)) {
         return;
     }
     self::$features[] = 'miniColors';
     $ui_theme = self::$ui_theme;
     $rcube = rcube::get_instance();
     $script = 'plugins/jqueryui/js/jquery.miniColors.min.js';
     $css = "plugins/jqueryui/themes/{$ui_theme}/jquery.miniColors.css";
     if (!file_exists(INSTALL_PATH . $css)) {
         $css = "plugins/jqueryui/themes/larry/jquery.miniColors.css";
     }
     $rcube->output->include_css($css);
     $rcube->output->add_header(html::tag('script', array('type' => "text/javascript", 'src' => $script)));
     $rcube->output->add_script('$("input.colors").miniColors({colorValues: rcmail.env.mscolors})', 'docready');
     $rcube->output->set_env('mscolors', self::get_color_values());
 }
コード例 #21
0
ファイル: HTMLTest.php プロジェクト: LucasFyl/korakia
 public function testHTML()
 {
     $expected = '<img src="myimage.jpg" width="100" height="200">';
     $this->assertEquals($expected, html::tag('img', null, array('src' => 'myimage.jpg', 'width' => 100, 'height' => 200)));
     $expected = '<a href="http://google.com" title="Google">Google</a>';
     $this->assertEquals($expected, html::tag('a', 'Google', array('href' => 'http://google.com', 'title' => 'Google')));
     $expected = '<p>Nice Paragraph</p>';
     $this->assertEquals($expected, html::tag('p', 'Nice Paragraph'));
     $expected = '<br>';
     $this->assertEquals($expected, html::tag('br'));
     $expected = '<a href="http://google.com" title="Google">Google</a>';
     $this->assertEquals($expected, html::a('http://google.com', 'Google', array('title' => 'Google')));
     $expected = '<img src="myimage.jpg" alt="myimage" width="100" height="200">';
     $this->assertEquals($expected, html::img('myimage.jpg', array('width' => 100, 'height' => 200)));
     $expected = '<!--[if lt IE 9]>' . PHP_EOL;
     $expected .= '<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>' . PHP_EOL;
     $expected .= '<![endif]-->' . PHP_EOL;
     $this->assertEquals($expected, html::shiv());
 }
コード例 #22
0
 /**
  * Place a link/button after attachments listing to trigger download
  */
 public function attachment_ziplink($p)
 {
     $rcmail = rcmail::get_instance();
     // only show the link if there is more than the configured number of attachments
     if (substr_count($p['content'], '<li') > $rcmail->config->get('zipdownload_attachments', 1)) {
         $link = html::a(array('href' => rcmail_url('plugin.zipdownload.zip_attachments', array('_mbox' => $rcmail->output->env['mailbox'], '_uid' => $rcmail->output->env['uid'])), 'class' => 'button zipdownload'), Q($this->gettext('downloadall')));
         // append link to attachments list, slightly different in some skins
         switch (rcmail::get_instance()->config->get('skin')) {
             case 'classic':
                 $p['content'] = str_replace('</ul>', html::tag('li', array('class' => 'zipdownload'), $link) . '</ul>', $p['content']);
                 break;
             default:
                 $p['content'] .= $link;
                 break;
         }
         $this->include_stylesheet($this->local_skin_path() . '/zipdownload.css');
     }
     return $p;
 }
コード例 #23
0
ファイル: base.php プロジェクト: volodymyr-volynets/frontend
 /**
  * @see html::icon()
  */
 public static function icon($options = [])
 {
     // if we are rendering image
     if (isset($options['file'])) {
         return numbers_frontend_html_class_base::icon($options);
     } else {
         if (isset($options['type'])) {
             library::add('fontawesome');
             // generating class & rendering tag
             $options['class'] = array_add_token($options['class'] ?? [], 'fa fa-' . $options['type'], ' ');
             if (!empty($options['class_only'])) {
                 return implode(' ', $options['class']);
             } else {
                 $options['tag'] = $options['tag'] ?? 'i';
                 return html::tag($options);
             }
         }
     }
 }
コード例 #24
0
 function init()
 {
     $this->register_action('plugin.markasjunk2.junk', array($this, 'mark_message'));
     $this->register_action('plugin.markasjunk2.not_junk', array($this, 'mark_message'));
     $rcmail = rcube::get_instance();
     $this->load_config();
     $this->ham_mbox = $rcmail->config->get('markasjunk2_ham_mbox', 'INBOX');
     $this->spam_mbox = $rcmail->config->get('markasjunk2_spam_mbox', $rcmail->config->get('junk_mbox', null));
     $this->toolbar = $rcmail->action == 'show' ? $rcmail->config->get('markasjunk2_cp_toolbar', true) : $rcmail->config->get('markasjunk2_mb_toolbar', true);
     // register the ham/spam flags with the core
     $this->add_hook('storage_init', array($this, 'set_flags'));
     if ($rcmail->action == '' || $rcmail->action == 'show') {
         $this->include_script('markasjunk2.js');
         $this->add_texts('localization', true);
         $this->include_stylesheet($this->local_skin_path() . '/markasjunk2.css');
         // check which folder we are currently in to display the correct button
         $mb_override = $this->spam_mbox ? false : true;
         $display_junk = $display_not_junk = '';
         if ($_SESSION['mbox'] == $this->spam_mbox) {
             $display_junk = 'display: none;';
         } elseif (!$mb_override) {
             $display_not_junk = 'display: none;';
         }
         if ($this->toolbar) {
             // add the buttons to the main toolbar
             $this->add_button(array('command' => 'plugin.markasjunk2.junk', 'type' => 'link', 'class' => 'button buttonPas markasjunk2 disabled', 'classact' => 'button markasjunk2', 'classsel' => 'button markasjunk2Sel', 'title' => 'markasjunk2.buttonjunk', 'label' => 'junk', 'style' => $display_junk), 'toolbar');
             $this->add_button(array('command' => 'plugin.markasjunk2.not_junk', 'type' => 'link', 'class' => 'button buttonPas markasnotjunk2 disabled', 'classact' => 'button markasnotjunk2', 'classsel' => 'button markasnotjunk2Sel', 'title' => 'markasjunk2.buttonnotjunk', 'label' => 'markasjunk2.notjunk', 'style' => $display_not_junk), 'toolbar');
         } else {
             // add the buttons to the mark message menu
             $markjunk = $this->api->output->button(array('command' => 'plugin.markasjunk2.junk', 'label' => 'markasjunk2.markasjunk', 'id' => 'markasjunk2', 'class' => 'icon markasjunk2', 'classact' => 'icon markasjunk2 active', 'innerclass' => 'icon markasjunk2'));
             $marknotjunk = $this->api->output->button(array('command' => 'plugin.markasjunk2.not_junk', 'label' => 'markasjunk2.markasnotjunk', 'id' => 'markasnotjunk2', 'class' => 'icon markasnotjunk2', 'classact' => 'icon markasnotjunk2 active', 'innerclass' => 'icon markasnotjunk2'));
             $this->api->add_content(html::tag('li', array('style' => $display_junk, 'role' => 'menuitem'), $markjunk), 'markmenu');
             $this->api->add_content(html::tag('li', array('style' => $display_not_junk, 'role' => 'menuitem'), $marknotjunk), 'markmenu');
         }
         // add markasjunk2 folder settings to the env for JS
         $this->api->output->set_env('markasjunk2_override', $mb_override);
         $this->api->output->set_env('markasjunk2_ham_mailbox', $this->ham_mbox);
         $this->api->output->set_env('markasjunk2_spam_mailbox', $this->spam_mbox);
         $this->api->output->set_env('markasjunk2_move_spam', $rcmail->config->get('markasjunk2_move_spam', false));
         $this->api->output->set_env('markasjunk2_move_ham', $rcmail->config->get('markasjunk2_move_ham', false));
     }
 }
コード例 #25
0
ファイル: new_user_dialog.php プロジェクト: shishenkov/zpanel
 /**
  * Callback function when HTML page is rendered
  * We'll add an overlay box here.
  */
 function render_page($p)
 {
     if ($_SESSION['plugin.newuserdialog'] && $p['template'] == 'mail') {
         $this->add_texts('localization');
         $rcmail = rcmail::get_instance();
         $identity = $rcmail->user->get_identity();
         $identities_level = intval($rcmail->config->get('identities_level', 0));
         // compose user-identity dialog
         $table = new html_table(array('cols' => 2));
         $table->add('title', $this->gettext('name'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_name', 'value' => $identity['name'])));
         $table->add('title', $this->gettext('email'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_email', 'value' => idn_to_utf8($identity['email']), 'disabled' => $identities_level == 1 || $identities_level == 3)));
         // add overlay input box to html page
         $rcmail->output->add_footer(html::div(array('id' => 'newuseroverlay'), html::tag('form', array('action' => $rcmail->url('plugin.newusersave'), 'method' => 'post'), html::tag('h3', null, Q($this->gettext('identitydialogtitle'))) . html::p('hint', Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => 'formbuttons'), html::tag('input', array('type' => 'submit', 'class' => 'button mainaction', 'value' => $this->gettext('save')))))));
         // disable keyboard events for messages list (#1486726)
         $rcmail->output->add_script("\$(document).ready(function () {\n          rcmail.message_list.key_press = function(){};\n          rcmail.message_list.key_down = function(){};\n          \$('input[name=_name]').focus();\n          });", 'foot');
         $this->include_stylesheet('newuserdialog.css');
     }
 }
コード例 #26
0
ファイル: js.php プロジェクト: kgchoy/main-portfolio-website
 /**
  * Builds the html script tag for the given javascript file
  * 
  * @param string $src
  * @param boolean async
  * @return string
  */
 public function tag($src, $async = false)
 {
     if (is_array($src)) {
         $js = array();
         foreach ($src as $s) {
             $js[] = $this->tag($s, $async);
         }
         return implode(PHP_EOL, $js) . PHP_EOL;
     }
     // auto template css files
     if ($src == '@auto') {
         $file = $this->kirby->site()->page()->template() . '.js';
         $root = $this->kirby->roots()->autojs() . DS . $file;
         $src = $this->kirby->urls()->autojs() . '/' . $file;
         if (!file_exists($root)) {
             return false;
         }
     }
     return html::tag('script', '', array('src' => url($src), 'async' => $async));
 }
コード例 #27
0
ファイル: css.php プロジェクト: kgchoy/main-portfolio-website
 /**
  * Builds the html link tag for the given css file
  * 
  * @param string $url
  * @param null|string $media
  * @return string
  */
 public function tag($url, $media = null)
 {
     if (is_array($url)) {
         $css = array();
         foreach ($url as $u) {
             $css[] = $this->tag($u, $media);
         }
         return implode(PHP_EOL, $css) . PHP_EOL;
     }
     // auto template css files
     if ($url == '@auto') {
         $file = $this->kirby->site()->page()->template() . '.css';
         $root = $this->kirby->roots()->autocss() . DS . $file;
         $url = $this->kirby->urls()->autocss() . '/' . $file;
         if (!file_exists($root)) {
             return false;
         }
     }
     return html::tag('link', null, array('rel' => 'stylesheet', 'href' => url($url), 'media' => $media));
 }
コード例 #28
0
ファイル: userinfo.php プロジェクト: shishenkov/zpanel
 function infohtml()
 {
     $rcmail = rcmail::get_instance();
     $user = $rcmail->user;
     $table = new html_table(array('cols' => 2, 'cellpadding' => 3));
     $table->add('title', 'ID');
     $table->add('', Q($user->ID));
     $table->add('title', Q($this->gettext('username')));
     $table->add('', Q($user->data['username']));
     $table->add('title', Q($this->gettext('server')));
     $table->add('', Q($user->data['mail_host']));
     $table->add('title', Q($this->gettext('created')));
     $table->add('', Q($user->data['created']));
     $table->add('title', Q($this->gettext('lastlogin')));
     $table->add('', Q($user->data['last_login']));
     $identity = $user->get_identity();
     $table->add('title', Q($this->gettext('defaultidentity')));
     $table->add('', Q($identity['name'] . ' <' . $identity['email'] . '>'));
     return html::tag('h4', null, Q('Infos for ' . $user->get_username())) . $table->show();
 }
コード例 #29
0
ファイル: help.php プロジェクト: CDN-Sparks/owncloud
 function content($attrib)
 {
     $rcmail = rcmail::get_instance();
     if ($rcmail->action == 'about') {
         return @file_get_contents($this->home . '/content/about.html');
     } else {
         if ($rcmail->action == 'license') {
             return @file_get_contents($this->home . '/content/license.html');
         }
     }
     // default content: iframe
     if ($src = $rcmail->config->get('help_source')) {
         $attrib['src'] = $src;
     }
     if (empty($attrib['id'])) {
         $attrib['id'] = 'rcmailhelpcontent';
     }
     $attrib['name'] = $attrib['id'];
     return html::tag('iframe', $attrib, '', array('id', 'class', 'style', 'src', 'width', 'height', 'frameborder'));
 }
コード例 #30
0
ファイル: helpers.php プロジェクト: gBokiau/kirby
/**
 * Builds a script tag for relative or absolute links
 *
 * @param string $src
 * @param boolean $async
 * @return string
 */
function js($src, $async = false)
{
    if (is_array($src)) {
        $js = array();
        foreach ($src as $s) {
            $js[] = js($s);
        }
        return implode(PHP_EOL, $js) . PHP_EOL;
    }
    // auto template css files
    if ($src == '@auto') {
        $site = kirby::site();
        $file = $site->page()->template() . '.js';
        $root = $site->options['auto.js.root'] . DS . $file;
        $src = $site->options['auto.js.url'] . '/' . $file;
        if (!file_exists($root)) {
            return false;
        }
    }
    return html::tag('script', '', array('src' => url($src), 'async' => $async));
}