New look for iTop !

SVN:trunk[3601]
This commit is contained in:
Denis Flaven
2015-06-20 15:02:24 +00:00
parent 9ba1914524
commit 19e5130441
338 changed files with 21017 additions and 1449 deletions

View File

@@ -855,7 +855,7 @@ class DisplayBlock
$oPage->add_ready_script( $oPage->add_ready_script(
<<<EOF <<<EOF
$("#dh_$sId").click( function() { $("#dh_$sId").click( function() {
$("#ds_$sId").slideToggle('normal', function() { $("#ds_$sId").parent().resize(); } ); $("#ds_$sId").slideToggle('normal', function() { $("#ds_$sId").parent().resize(); FixSearchFormsDisposition(); } );
$("#dh_$sId").toggleClass('open'); $("#dh_$sId").toggleClass('open');
}); });
EOF EOF

View File

@@ -76,15 +76,6 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$this->add_linked_script('../js/jquery.multiselect.min.js'); $this->add_linked_script('../js/jquery.multiselect.min.js');
$this->add_linked_script('../js/ajaxfileupload.js'); $this->add_linked_script('../js/ajaxfileupload.js');
$aMultiselectOptions = array(
'header' => true,
'checkAllText' => Dict::S('UI:SearchValue:CheckAll'),
'uncheckAllText' => Dict::S('UI:SearchValue:UncheckAll'),
'noneSelectedText' => Dict::S('UI:SearchValue:Any'),
'selectedText' => Dict::S('UI:SearchValue:NbSelected'),
'selectedList' => 1,
);
$sJSMultiselectOptions = json_encode($aMultiselectOptions);
$sSearchAny = addslashes(Dict::S('UI:SearchValue:Any')); $sSearchAny = addslashes(Dict::S('UI:SearchValue:Any'));
$sSearchNbSelected = addslashes(Dict::S('UI:SearchValue:NbSelected')); $sSearchNbSelected = addslashes(Dict::S('UI:SearchValue:NbSelected'));
$this->add_dict_entry('UI:FillAllMandatoryFields'); $this->add_dict_entry('UI:FillAllMandatoryFields');
@@ -228,8 +219,6 @@ EOF;
} }
}); });
$('.multiselect').multiselect($sJSMultiselectOptions);
$('.resizable').filter(':visible').resizable(); $('.resizable').filter(':visible').resizable();
} }
catch(err) catch(err)
@@ -586,6 +575,16 @@ EOF
} }
// Put here the 'ready scripts' that must be executed after all others // Put here the 'ready scripts' that must be executed after all others
$aMultiselectOptions = array(
'header' => true,
'checkAllText' => Dict::S('UI:SearchValue:CheckAll'),
'uncheckAllText' => Dict::S('UI:SearchValue:UncheckAll'),
'noneSelectedText' => Dict::S('UI:SearchValue:Any'),
'selectedText' => Dict::S('UI:SearchValue:NbSelected'),
'selectedList' => 1,
);
$sJSMultiselectOptions = json_encode($aMultiselectOptions);
$this->add_ready_script( $this->add_ready_script(
<<<EOF <<<EOF
// Since the event is only triggered when the hash changes, we need to trigger // Since the event is only triggered when the hash changes, we need to trigger
@@ -594,6 +593,11 @@ EOF
// Some table are sort-able, some are not, let's fix this // Some table are sort-able, some are not, let's fix this
$('table.listResults').each( function() { FixTableSorter($(this)); } ); $('table.listResults').each( function() { FixTableSorter($(this)); } );
$('.multiselect').multiselect($sJSMultiselectOptions);
FixSearchFormsDisposition();
EOF EOF
); );
if ($this->GetOutputFormat() == 'html') if ($this->GetOutputFormat() == 'html')

View File

@@ -94,7 +94,7 @@ class NiceWebPage extends WebPage
$("table.listResults").tableHover(); // hover tables $("table.listResults").tableHover(); // hover tables
EOF EOF
); );
$this->add_linked_stylesheet("../css/light-grey.css"); $this->add_saas("css/light-grey.scss");
$this->m_sRootUrl = $this->GetAbsoluteUrlAppRoot(); $this->m_sRootUrl = $this->GetAbsoluteUrlAppRoot();
$sAbsURLAppRoot = addslashes($this->m_sRootUrl); $sAbsURLAppRoot = addslashes($this->m_sRootUrl);

6
css/css-variables.scss Normal file
View File

@@ -0,0 +1,6 @@
$highlight-color: #E87C1E;
$grey-color: #555555;
$complement-color: #1c94c4;
$complement-light: #d6e8ef;
$frame-background-color: #F1F1F1;
$text-color: #000;

File diff suppressed because it is too large Load Diff

1439
css/light-grey.scss Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 B

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

1178
css/ui-lightness/jquery-ui-1.10.3.custom.css vendored Executable file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 559 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 866 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 853 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 883 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 859 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 887 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

After

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

After

Width:  |  Height:  |  Size: 74 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 881 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 779 B

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 B

View File

@@ -95,6 +95,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
me.UpdateSizes(); me.UpdateSizes();
me.UpdateButtons(); me.UpdateButtons();
me.ajax_request = null; me.ajax_request = null;
FixSearchFormsDisposition();
me.DoSearchObjects(); me.DoSearchObjects();
}, },
'html' 'html'

View File

@@ -257,6 +257,7 @@ $(function()
var c = this.value; var c = this.value;
me._onUpdateDlgButtons(c); me._onUpdateDlgButtons(c);
}); });
FixSearchFormsDisposition();
$('#SearchResultsToAdd_'+me.id).unblock(); $('#SearchResultsToAdd_'+me.id).unblock();
me._onSearchDlgUpdateSize(); me._onSearchDlgUpdateSize();
}); });

View File

@@ -134,6 +134,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH
var c = this.value; var c = this.value;
me.UpdateButtons(c); me.UpdateButtons(c);
}); });
FixSearchFormsDisposition();
$(sSearchAreaId).unblock(); $(sSearchAreaId).unblock();
}, },
'html' 'html'

View File

@@ -210,12 +210,35 @@ function ReloadSearchForm(divId, sClassName, sBaseClass, sContext)
} }
} }
} }
FixSearchFormsDisposition();
oDiv.unblock(); oDiv.unblock();
oDiv.parent().resize(); // Inform the parent that the form has just been (potentially) resized oDiv.parent().resize(); // Inform the parent that the form has just been (potentially) resized
} }
); );
} }
function FixSearchFormsDisposition()
{
// Fix search forms
$('.SearchDrawer').each(function() {
var colWidth = 0;
var labelWidth = 0;
$('label:visible', $(this)).each( function() {
var l = $(this).parent().width() - $(this).width();
colWidth = Math.max(l, colWidth);
labelWidth = Math.max($(this).width(), labelWidth);
});
$('label:visible', $(this)).each( function() {
if($(this).data('resized') != true)
{
$(this).parent().width(colWidth + labelWidth);
$(this).width(labelWidth).css({display: 'inline-block'}).data('resized', true);
}
});
});
}
/** /**
* Stores - in a persistent way - user specific preferences * Stores - in a persistent way - user specific preferences
* depends on a global variable oUserPreferences created/filled by the iTopWebPage * depends on a global variable oUserPreferences created/filled by the iTopWebPage
@@ -389,6 +412,33 @@ function ShortcutListDlg(sOQL, sDataTableId, sContext)
return false; return false;
} }
function ExportListDlg(sOQL, sDataTableId, sFormat, sDlgTitle)
{
var sDataTableName = 'datatable_'+sDataTableId;
var oColumns = $('#'+sDataTableName).datatable('option', 'oColumns');
var aFields = [];
for(var j in oColumns)
{
for(var k in oColumns[j])
{
if (oColumns[j][k].checked)
{
var sCode = oColumns[j][k].code;
if (sCode == '_key_')
{
sCode = 'id';
}
aFields.push(j+'.'+sCode);
}
}
}
$.post(GetAbsoluteUrlAppRoot()+'webservices/export-v2.php', {interactive: 1, advanced: 1, mode: 'dialog', format: sFormat, expression: sOQL, suggested_fields: aFields.join(','), dialog_title: sDlgTitle}, function(data) {
$('body').append(data);
});
return false;
}
function DisplayHistory(sSelector, sFilter, iCount, iStart) function DisplayHistory(sSelector, sFilter, iCount, iStart)
{ {
$(sSelector).block(); $(sSelector).block();

72
lib/sass/Phamlp.php Normal file
View File

@@ -0,0 +1,72 @@
<?php
/* SVN FILE: $Id: HamlException.php 61 2010-04-16 10:19:59Z chris.l.yates $ */
/**
* Phamlp.
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
*/
/**
* Phamlp class.
* Static support classes.
* @package PHamlP
*/
class Phamlp {
/**
* @var string Language used to translate messages
*/
public static $language;
/**
* @var array Messages used for translation
*/
public static $messages;
/**
* Translates a message to the specified language.
* @param string message category.
* @param string the original message
* @param array parameters to be applied to the message using <code>strtr</code>.
* @return string the translated message
*/
public static function t($category, $message, $params = array()) {
if (!empty(self::$language)) {
$message = self::translate($category, $message);
}
return $params!==array() ? strtr($message,$params) : $message;
}
/**
* Translates a message to the specified language.
* If the language or the message in the specified language is not defined the
* original message is returned.
* @param string message category
* @param string the original message
* @return string the translated message
*/
private static function translate($category, $message) {
if (empty(self::$messages[$category])) self::loadMessages($category);
return (empty(self::$messages[$category][$message]) ? $message : self::$messages[$category][$message]);
}
/**
* Loads the specified language message file for translation.
* Message files are PHP files in the "category/messages" directory and named
* "language.php", where category is either haml or sass, and language is the
* specified language.
* The message file returns an array of (source, translation) pairs; for example:
* <pre>
* return array(
* 'original message 1' => 'translated message 1',
* 'original message 2' => 'translated message 2',
* );
* </pre>
* @param string message category
*/
private static function loadMessages($category) {
$messageFile = dirname(__FILE__).DIRECTORY_SEPARATOR.$category.DIRECTORY_SEPARATOR.'messages'.DIRECTORY_SEPARATOR.self::$language.'.php';
if (file_exists($messageFile)) {
self::$messages[$category] = require_once($messageFile);
}
}
}

View File

@@ -0,0 +1,31 @@
<?php
/* SVN FILE: $Id: HamlException.php 61 2010-04-16 10:19:59Z chris.l.yates $ */
/**
* Phamlp exception.
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
*/
require_once('Phamlp.php');
/**
* Phamlp exception class.
* Base class for PHamlP::Haml and PHamlP::Sass exceptions.
* Translates exception messages.
* @package PHamlP
*/
class PhamlpException extends Exception {
/**
* Phamlp Exception.
* @param string Category (haml|sass)
* @param string Exception message
* @param array parameters to be applied to the message using <code>strtr</code>.
*/
public function __construct($category, $message, $params, $object) {
parent::__construct(Phamlp::t($category, $message, $params) .
(is_object($object) ? ": {$object->filename}::{$object->line}\nSource: {$object->source}" : '')
);
}
}

View File

@@ -0,0 +1,29 @@
<?php
/* SVN FILE: $Id: HamlException.php 61 2010-04-16 10:19:59Z chris.l.yates $ */
/**
* Haml exception.
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml
*/
require_once(dirname(__FILE__).'/../PhamlpException.php');
/**
* Haml exception class.
* @package PHamlP
* @subpackage Haml
*/
class HamlException extends PhamlpException {
/**
* Haml Exception.
* @param string Exception message
* @param array parameters to be applied to the message using <code>strtr</code>.
* @param object object with source code and meta data
*/
public function __construct($message, $params = array(), $object = null) {
parent::__construct('haml', $message, $params, $object);
}
}

View File

@@ -0,0 +1,199 @@
<?php
/* SVN FILE: $Id: HamlHelpers.php 92 2010-05-20 17:42:59Z chris.l.yates $ */
/**
* HamlHelpers class file.
*
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml
*/
/**
* HamlHelpers class.
* Contains methods to make it easier to do various tasks.
*
* The class can be extended to provide user defined helper methods. The
* signature for user defined helper methods is ($block, $other, $arguments);
* $block is the string generated by the Haml block being operated on.
*
* Tthe path to the extended class is provided to HamlParser in the config
* array; class name == file name.
*
* HamlHelpers and any extended class are automatically included in the context
* that a Haml template is parsed in, so all the methods are at your disposal
* from within the template.
*
* @package PHamlP
* @subpackage Haml
*/
class HamlHelpers {
const XMLNS = 'http://www.w3.org/1999/xhtml';
/**
* Returns the block with string appended.
* @see succeed
* @param string Haml block
* @param string string to append
* @return string the block with string appended.
*/
public static function append($block, $string) {
return $block.$string;
}
/**
* Escapes HTML entities in text, but without escaping an ampersand that is
* already part of an escaped entity.
* @param string Haml block
* @return string the block with HTML entities escaped.
*/
public static function escape_once($block) {
return htmlentities(html_entity_decode($block));
}
/**
* Returns an array containing default assignments for the xmlns, lang, and
* xml:lang attributes of the html element.
* This helper method is for use in the html element only.
*
* Examples:<br/>
* %html(html_attrs())<br/>
* produces<br/>
* <html lang="en-us" xml:lang="en-us" xmlns="http://www.w3.org/1999/xhtml">
*
* %html(html_attrs('en-gb'))<br/>
* produces<br/>
* <html lang="en-gb" xml:lang="en-gb" xmlns="http://www.w3.org/1999/xhtml">
*
* %html(html_attrs('en-gb', false))<br/>
* produces<br/>
* <html xml:lang="en-gb" xmlns="http://www.w3.org/1999/xhtml">
*
* Although handled in HamlParser, the notes below are here for completeness.<br/>
* Other attributes are defined as normal. e.g.<br/>
* %html(xmlns:me="http://www.example.com/me" html_attrs('en-gb', false))<br/>
* produces<br/>
* <html xml:lang="en-gb" xmlns="http://www.w3.org/1999/xhtml" xmlns:me="http://www.example.com/me">
*
* PHamlP also allows for the language to be defined using PHP code that can
* be eval'd; the code must end with a semi-colon (;). e.g.<br/>
* %html(html_attrs("FW::app()->language);", false))<br/>
* produces (assuming FW::app()->language returns 'en-gb')<br/>
* <html xml:lang="en-gb" xmlns="http://www.w3.org/1999/xhtml">
*
* @param string document language. Default = en-us
* @param boolean whether the html element has the lang attribute. Default: true
* Should be set false for XHTML 1.1 or greater documents
* @return string the block with string appended.
*/
public static function html_attrs($language = 'en-us', $lang = true) {
return ($lang ?
array('xmlns'=>self::XMLNS, 'xml:lang'=>$language, 'lang'=>$language) :
array('xmlns'=>self::XMLNS, 'xml:lang'=>$language));
}
/**
* Returns a copy of text with ampersands, angle brackets and quotes escaped
* into HTML entities.
* @param string Haml block
* @return string the block with HTML entities escaped.
*/
public static function html_escape($block) {
return htmlspecialchars($block);
}
/**
* Iterates an array and using the block to generate a <li> element for each
* array element.
* Examples:<br/>
* = list_of(array('red', 'orange', ...., 'violet'), 'colour')<br/>
* = colour<br/>
* Produces:<br/>
* <li>red</li><br/>
* <li>orange</li><br/>
* |<br/>
* |<br/>
* <li>violet></li><br/>
*
* = list_of(array('Fly Fishing' => 'JR Hartley', 'Lord of the Rings' => 'JRR Tolkien'), 'title', 'author')<br/>
* %h3= title<br/>
* %p= author<br/>
* Produces:<br/>
* <li><br/>
* <h3>Fly Fishing</h3><br/>
* <p>JR Hartley</p><br/>
* </li><br/>
* <li><br/>
* <h3>Lord of the Rings</h3><br/>
* <p>JRR Tolkien</p><br/>
* </li><br/>
*
* @param string Haml block
* @param array items
* @param string string in block to replace with item key or item value
* @param string string in block to replace with item value
* @return string list items.
*/
public static function list_of($block, $items, $key, $value = null) {
$output = '';
foreach ($items as $_key=>$_value) {
$output .= '<li>' . strtr($block, (empty($value) ? array($key=>$_value) :
array($key=>$_key, $value=>$_value))) . '</li>';
} // foreach
return $output;
}
/**
* Alias for prepend.
* @see prepend
* @param string Haml block
* @param string string to prepend
* @return string the block with string prepended
*/
public static function preceed($block, $string) {
return self::prepend($block, $string);
}
/**
* Returns the block with string prepended.
* @param string Haml block
* @param string string to prepend
* @return string the block with string prepended
*/
public static function prepend($block, $string) {
return $string.$block;
}
/**
* Converts newlines in the block to HTML entities.
* @param string Haml block
* @return string the block with newlines converted to HTML entities
*/
public static function preserve($block) {
return str_replace("\n", '&#x0d;&#x0a;', $block);
}
/**
* Alias for append.
* @see append
* @param string Haml block
* @param string string to apppend
* @return string the block with string apppended
*/
public static function succeed($block, $string) {
return self::append($block, $string);
}
/**
* Surrounds a block of Haml code with strings.
* If $back is not given it defaults to $front.
* @param string Haml block
* @param string string to prepend
* @param string string to apppend
* @return string the block surrounded by the strings
*/
public static function surround($block, $front, $back=null) {
return $front.$block.(is_null($back) ? $front : $back);
}
}

1249
lib/sass/haml/HamlParser.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
<?php
/* SVN FILE: $Id: HamlBaseFilter.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
* Base Filter for {@link http://haml-lang.com/ Haml} class file.
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.filters
*/
/**
* Base Filter for {@link http://haml-lang.com/ Haml} class.
* This class must be extended and the run() method overridden.
* @package PHamlP
* @subpackage Haml.filters
*/
abstract class HamlBaseFilter {
/**
* Initialise the filter.
*/
public function init() {}
/**
* Run the filter.
* This method must be overridden in child classes.
* @param string text to filter
*/
abstract public function run($text);
}

View File

@@ -0,0 +1,29 @@
<?php
/* SVN FILE: $Id: HamlCdataFilter.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
* CDATA Filter for {@link http://haml-lang.com/ Haml} class file.
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.filters
*/
/**
* CDATA Filter for {@link http://haml-lang.com/ Haml} class.
* Surrounds the filtered text with CDATA tags.
* @package PHamlP
* @subpackage Haml.filters
*/
class HamlCdataFilter extends HamlBaseFilter {
/**
* Run the filter
* @param string text to filter
* @return string filtered text
*/
public function run($text) {
return "<![CDATA[\n" .
preg_replace(HamlParser::MATCH_INTERPOLATION, '<?php echo \1; ?>', $text) .
" ]]>\n";
}
}

View File

@@ -0,0 +1,30 @@
<?php
/* SVN FILE: $Id: HamlCssFilter.php 99 2010-06-13 14:12:08Z chris.l.yates $ */
/**
* CSS Filter for {@link http://haml-lang.com/ Haml} class file.
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.filters
*/
/**
* CSS Filter for {@link http://haml-lang.com/ Haml} class.
* Surrounds the filtered text with <style> and CDATA tags.
* Useful for including inline CSS.
* @package PHamlP
* @subpackage Haml.filters
*/
class HamlCssFilter extends HamlBaseFilter {
/**
* Run the filter
* @param string text to filter
* @return string filtered text
*/
public function run($text) {
return "<style type=\"text/css\">\n/*<![CDATA[*/\n" .
preg_replace(HamlParser::MATCH_INTERPOLATION, '<?php echo \1; ?>', $text) .
"/*]]>*/\n</style>\n";
}
}

View File

@@ -0,0 +1,32 @@
<?php
/* SVN FILE: $Id: HamlEscapedFilter.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
* Escaped Filter for {@link http://haml-lang.com/ Haml} class file.
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.filters
*/
/**
* Escaped Filter for {@link http://haml-lang.com/ Haml} class.
* Escapes the text.
* Code to be interpolated can be included by wrapping it in #().
* @package PHamlP
* @subpackage Haml.filters
*/
class HamlEscapedFilter extends HamlBaseFilter {
/**
* Run the filter
* @param string text to filter
* @return string filtered text
*/
public function run($text) {
return preg_replace(
HamlParser::MATCH_INTERPOLATION,
'<?php echo htmlspecialchars($text); ?>',
htmlspecialchars($text)
) . "\n";
}
}

View File

@@ -0,0 +1,31 @@
<?php
/* SVN FILE: $Id: HamlJavascriptFilter.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
* Javascript Filter for {@link http://haml-lang.com/ Haml} class file.
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.filters
*/
/**
* Javascript Filter for {@link http://haml-lang.com/ Haml} class.
* Surrounds the filtered text with <script> and CDATA tags.
* Useful for including inline Javascript.
* Code to be interpolated can be included by wrapping it in #().
* @package PHamlP
* @subpackage Haml.filters
*/
class HamlJavascriptFilter extends HamlBaseFilter {
/**
* Run the filter
* @param string text to filter
* @return string filtered text
*/
public function run($text) {
return "<script type=\"text/javascript\">\n //<![CDATA[\n" .
preg_replace(HamlParser::MATCH_INTERPOLATION, '<?php echo \1; ?>', $text) .
" //]]>\n</script>\n";
}
}

View File

@@ -0,0 +1,27 @@
<?php
/* SVN FILE: $Id: HamlPhpFilter.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
* PHP Filter for {@link http://haml-lang.com/ Haml} class file.
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.filters
*/
/**
* PHP Filter for {@link http://haml-lang.com/ Haml} class.
* The text will be parsed with the PHP interpreter.
* @package PHamlP
* @subpackage Haml.filters
*/
class HamlPhpFilter extends HamlBaseFilter {
/**
* Run the filter
* @param string text to filter
* @return string filtered text
*/
public function run($text) {
return "<?php\n$text?>\n";
}
}

View File

@@ -0,0 +1,28 @@
<?php
/* SVN FILE: $Id: HamlPlainFilter.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
* Plain Filter for {@link http://haml-lang.com/ Haml} class file.
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.filters
*/
/**
* Plain Filter for {@link http://haml-lang.com/ Haml} class.
* Does not parse the filtered text. This is useful for large blocks of text
* without HTML tags when lines are not to be parsed.
* @package PHamlP
* @subpackage Haml.filters
*/
class HamlPlainFilter extends HamlBaseFilter {
/**
* Run the filter
* @param string text to filter
* @return string filtered text
*/
public function run($text) {
return preg_replace(HamlParser::MATCH_INTERPOLATION, '<?php echo \1; ?>', $text). "\n";
}
}

View File

@@ -0,0 +1,29 @@
<?php
/* SVN FILE: $Id: HamlPreserveFilter.php 103 2010-08-06 10:15:55Z chris.l.yates@gmail.com $ */
/**
* Preserve Filter for {@link http://haml-lang.com/ Haml} class file.
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.filters
*/
/**
* Preserve Filter for {@link http://haml-lang.com/ Haml} class.
* Does not parse the filtered text and preserves line breaks.
* @package PHamlP
* @subpackage Haml.filters
*/
class HamlPreserveFilter extends HamlBaseFilter {
/**
* Run the filter
* @param string text to filter
* @return string filtered text
*/
public function run($text) {
return str_replace("\n", '&#x000a;',
preg_replace(HamlParser::MATCH_INTERPOLATION, '<?php echo \1; ?>', $text)
) . "\n";
}
}

View File

@@ -0,0 +1,37 @@
<?php
/* SVN FILE: $Id: HamlSassFilter.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
* {@link Sass http://sass-lang.com/} Filter for
* {@link http://haml-lang.com/ Haml} class file.
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.filters
*/
require_once('HamlCssFilter.php');
require_once(dirname(__FILE__).'/../../sass/SassParser.php');
/**
* {@link Sass http://sass-lang.com/} Filter for
* {@link http://haml-lang.com/ Haml} class.
* Parses the text as Sass then calls the CSS filter.
* Useful for including inline Sass.
* @package PHamlP
* @subpackage Haml.filters
*/
class HamlSassFilter extends HamlBaseFilter {
/**
* Run the filter
* @param string text to filter
* @return string filtered text
*/
public function run($text) {
$sass = new SassParser();
$css = new HamlCssFilter();
$css->init();
return $css->run($sass->toCss(preg_replace(HamlParser::MATCH_INTERPOLATION, '<?php echo \1; ?>', $text), false));
}
}

View File

@@ -0,0 +1,37 @@
<?php
/* SVN FILE: $Id: HamlSassFilter.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
* {@link Scss http://sass-lang.com/} Filter for
* {@link http://haml-lang.com/ Haml} class file.
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.filters
*/
require_once('HamlCssFilter.php');
require_once(dirname(__FILE__).'/../../sass/SassParser.php');
/**
* {@link Sass http://sass-lang.com/} Filter for
* {@link http://haml-lang.com/ Haml} class.
* Parses the text as Sass then calls the CSS filter.
* Useful for including inline Sass.
* @package PHamlP
* @subpackage Haml.filters
*/
class HamlScssFilter extends HamlBaseFilter {
/**
* Run the filter
* @param string text to filter
* @return string filtered text
*/
public function run($text) {
$sass = new SassParser(array('syntax'=>'scss'));
$css = new HamlCssFilter();
$css->init();
return $css->run($sass->toCss(preg_replace(HamlParser::MATCH_INTERPOLATION, '<?php echo \1; ?>', $text), false));
}
}

View File

@@ -0,0 +1,50 @@
<?php
/* SVN FILE: $Id: _HamlMarkdownFilter.php 51 2010-04-14 12:05:03Z chris.l.yates $ */
/**
* Markdown Filter for {@link http://haml-lang.com/ Haml} class file.
* This filter is an abstract filter that must be extended.
*
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.filters
*/
/**
* Markdown Filter for {@link http://haml-lang.com/ Haml} class.
* Parses the text with Markdown.
*
* This is an abstract class that must be extended and the init() method
* implemented to provide the vendorPath if the vendor class is not imported
* elsewhere in the application (e.g. by a framework) and vendorClass if the
* default class name is not correct.
* @package PHamlP
* @subpackage Haml.filters
*/
abstract class _HamlMarkdownFilter extends HamlBaseFilter {
/**
* @var string Path to Markdown Parser
*/
protected $vendorPath;
/**
* @var string Markdown class
* Override this value if the class name is different in your environment
*/
protected $vendorClass = 'MarkdownExtra_Parser';
/**
* Child classes must implement this method.
* Typically the child class will set $vendorPath and $vendorClass
*/
public function init() {}
/**
* Run the filter
* @param string text to filter
* @return string filtered text
*/
public function run($text) {
return '<?php '.(!empty($this->vendorPath)?'require_once "'.$this->vendorPath.'";':'').'$markdown___=new '.$this->vendorClass.'();echo $markdown___->safeTransform("'.preg_replace(HamlParser::MATCH_INTERPOLATION, '".\1."', $text).'");?>';
}
}

View File

@@ -0,0 +1,50 @@
<?php
/* SVN FILE: $Id: _HamlTextileFilter.php 51 2010-04-14 12:05:03Z chris.l.yates $ */
/**
* Textile Filter for {@link http://haml-lang.com/ Haml} class file.
* This filter is an abstract filter that must be extended.
*
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.filters
*/
/**
* Textile Filter for {@link http://haml-lang.com/ Haml} class.
* Parses the text with Textile.
*
* This is an abstract class that must be extended and the init() method
* implemented to provide the vendorPath if the vendor class is not imported
* elsewhere in the application (e.g. by a framework) and vendorClass if the
* default class name is not correct.
* @package PHamlP
* @subpackage Haml.filters
*/
abstract class _HamlTextileFilter extends HamlBaseFilter {
/**
* @var string Path to Textile Parser
*/
protected $vendorPath;
/**
* @var string Textile class
* Override this value if the class name is different in your environment
*/
protected $vendorClass = 'Textile';
/**
* Child classes must implement this method.
* Typically the child class will set $vendorPath and $vendorClass
*/
public function init() {}
/**
* Run the filter
* @param string text to filter
* @return string filtered text
*/
public function run($text) {
return '<?php '.(!empty($this->vendorPath)?'require_once "'.$this->vendorPath.'";':'').'$textile___=new '.$this->vendorClass.'();echo $textile___->TextileThis("'.preg_replace(HamlParser::MATCH_INTERPOLATION, '".\1."', $text).'");?>';
}
}

View File

@@ -0,0 +1,32 @@
<?php
/* SVN FILE: $Id: SassRuleNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
* Message translations.
*
* This file is contains the localizable messages for Haml. You may modify this
* file by translating the messages and saving with the filename language.php
* where "language" is the language ID of the translations.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty the message is considered as not translated.
*
* NOTE: this file must be saved in UTF-8 encoding.
*
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.messages
*/
return array (
'Attribute must be "class" or "id" with array value'=>'',
'Illegal indentation level ({indentLevel}); indentation level can only increase by one'=>'',
'Invalid indentation'=>'',
'Invalid {what} ({value})'=>'',
'Invalid {what} ({value}); must be one of "{options}"'=>'',
'Mixed indentation not allowed'=>'',
'No getter function for {what}'=>'',
'No setter function for {what}'=>'',
'Unable to find {what}: {filename}'=>'',
'{what} must extend {base} class'=>'',
);

View File

@@ -0,0 +1,32 @@
<?php
/* SVN FILE: $Id: SassRuleNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
* Message translations.
*
* This file is contains the localizable messages for Haml. You may modify this
* file by translating the messages and saving with the filename language.php
* where "language" is the language ID of the translations.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty the message is considered as not translated.
*
* NOTE: this file must be saved in UTF-8 encoding.
*
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.messages
*/
return array (
'Attribute must be "class" or "id" with array value'=>'Attribute müssen "class" oder "id" mit array-wert',
'Illegal indentation level ({indentLevel}); indentation level can only increase by one'=>'Illegale einrückungsebene ({indentLevel}); einrückungsebene kann nur von einem anstieg',
'Invalid indentation'=>'Ungültige einrückung',
'Invalid {what}'=>'Ungültige {what}',
'Invalid {what} ({value}); must be one of "{options}"'=>'Ungültige {what} ({value}); muss einer der "{options}"',
'Mixed indentation not allowed'=>'Mixed einzug nicht erlaubt',
'No getter function for {what}'=>'Kein getter-funktion für {what}',
'No setter function for {what}'=>'Kein setter-funktion für {what}',
'Unable to find {what}: {filename}'=>'Kann zu finden {what}: {filename}',
'{what} must extend {base} class'=>'{what} muss {base} klasse erweitern',
);

View File

@@ -0,0 +1,32 @@
<?php
/* SVN FILE: $Id: SassRuleNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
* Message translations.
*
* This file is contains the localizable messages for Haml. You may modify this
* file by translating the messages and saving with the filename language.php
* where "language" is the language ID of the translations.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty the message is considered as not translated.
*
* NOTE: this file must be saved in UTF-8 encoding.
*
* @author Chris Yates <chris.l.yates@gmail.com>
* @copyright Copyright (c) 2010 PBM Web Development
* @license http://phamlp.googlecode.com/files/license.txt
* @package PHamlP
* @subpackage Haml.messages
*/
return array (
'Attribute must be "class" or "id" with array value'=>"D'attributs doivent être \"class\" ou \"id\" avec valeur de array",
'Illegal indentation level ({indentLevel}); indentation level can only increase by one: {file}::{line}'=>"Niveau niveau d'indentation illégale ({indentLevel}); ne peut augmenter d'un: {file}::{line}",
'Invalid indentation: {line}::{file}'=>'Indentation blancs: {line}::{file}',
'Invalid {what} ({value}): {file}::{line}'=>'Invalide {what} ({value}): {file}::{line}',
'Invalid {what} ({value}); must be one of "{options}".'=>"Invalide {what} ({value}); doit être l'un des \"{options}\"",
'Mixed indentation not allowed: {file}::{line}'=>'Indentation mixte pas autorisé: {file}::{line}',
'No getter function for {what}'=>'Pas de fonction getter pour {what}',
'No setter function for {what}'=>'Pas de fonction setter pour {what}',
'Unable to find {what}: {filename}.'=>'Impossible de trouver {what}: {filename}.',
'{what} must extend {base} class.'=>"{what} doit s'étendre classe {base}",
);

Some files were not shown because too many files have changed in this diff Show More