text:
Breaking Free Of the Primitive Mindset That Continues To Oppress Women and Justify Terrorism: New Age Islam's Selection 25 January 2016
New Age Islam Edit Bureau
Breaking Free Of the Primitive Mindset That Continues To Oppress Women and Justify Terrorism
By Sabina Khan
Who Wants Peace In Pakistan?
By Munir Akram
Lamentation of an American Muslim
By Saira Wasif
A Black Cloud Looms Over Nangarhar
By S Mubashir Noor
The Pakistani Diaspora in the US
By Dr Zamurrad Awan
The Afghan Connection
By Cyril Almeida
Compiled By New Age Islam Edit Bureau
Pakistan's path to becoming a developed country relies upon breaking free of the primitive mindset that continues to oppress women and justify terrorism. So far 2016, declared to be the year when terrorism shall end, is off to a torrid start with the Council of Islamic Ideology (CII) opposing the anti-child marriage bill as 'blasphemous' and a terrorist attack on a university in Charsadda. The CII is an advisory body and thus it only chimes in on select bills. When it does provide recommendations, many are not followed by the government. However, when it comes to issues like rights of women, child marriages and rape, guidance from the Council is adhered to without question. And then, as happens too often in our culture, men in our society end up using religion to keep women subservient. The National Assembly gets a free pass as women and children continue to suffer. Paedophilia is a crime in the rest of the world and should be looked upon with disgust in Pakistan as well instead of being ignored under the guise of religious/cultural norms.
Furthermore, as long as the likes of Abdul Aziz of Lal Masjid fame are allowed to roam around free, there is clearly a problem with the government's mindset. The girls' madrasa of the Lal Masjid released a video pledging allegiance to the Islamic State and its leader. Just about any other nation in the world would have arrested these students, who openly voiced support for those who engage in rape and sex slavery. No military operation can eradicate this primitive mindset. It is fuelled by an obsession with a regressive ideology and an antiquated belief that women are sub-humans. Any organisation or madrasa holding such views should ideally be disbanded. But that's not likely to happen anytime soon.
It is important to remember that the CII was established in 1962 as an advisory body. Since then, each subsequent amendment to the Constitution of Pakistan dealt a significant blow to any visions of the country blossoming into a liberal, democratic state. From Zulfiqar Ali Bhutto imposing prohibition in the 1970s to General Ziaul Haq's fanaticism, Pakistan has regressed. Each amendment further intertwined a certain interpretation of religion deep into the state's laws and wreaked havoc on the rights of minorities and women.
As is the common practice, following the Charsadda attack, a day of mourning was declared for the victims and vows were made to wipe out terrorism. People will be hanged and prayers will be offered. But none of these actions have any permanence. They don't do anything significant to tackle the extremist mindset. At the heart of the problem is the financial and ideological influence of nations that promote child marriage, trample upon women's rights and even prohibit them from driving. A far cry indeed from the Quaid-e-Azam's words: "I have always maintained that no nation can ever be worthy of its existence that cannot take its women along with men. No struggle can ever succeed without women participating side by side with men. There are two powers in the world. One is the sword and the other, the pen. However, there is a third power stronger than both, that of the women."
Source: tribune.com.pk/story/1033429/breaking-free-of-the-primitive-mindset/
IN his final State of the Union address, US President Obama predicted a decade of instability in Afghanistan and Pakistan. Af-Pak was always a bad construct for policy formulation. There are obvious security linkages between Afghanistan and Pakistan. But the circumstances and prospects of the two countries are significantly different.
Predicting continued instability in Afghanistan is an easy call. The Kabul government is beset by internal division and an insurgency that has momentum. Given the preconditions posed by Kabul, the recently created quadrilateral forum will find it difficult to get the Afghan Taliban to the table let alone secure an agreement for peace. A turbulent and fractured Afghanistan is the most likely prospect for the foreseeable future.
Pakistan is a different story. It has undertaken a massive and comprehensive counterterrorism campaign targeting the TTP, sectarian groups and political gangs. Action has now been taken also against a rogue pro-Kashmiri organisation. Terrorist and criminal violence has been dramatically reduced.
There are several external drivers of violence that need to be neutralised.
Unfortunately, as illustrated by the assault on the Charsadda university, it is premature to celebrate. To break the back of terrorism in Pakistan, the kinetic campaign will need to be continued for a considerable period and the social, economic and other components of the National Action Plan fully implemented.
However, national actions will not be sufficient to defeat terrorism. There are several external drivers of violence that need to be neutralised.
The TTP is the self-confessed culprit in the Charsadda terrorist attack. With 180,000 troops deployed on its western borders, Pakistan has crushed or chased out most of the TTP militants from most of its territory. Small groups hide 'in the open', in inaccessible valleys or in Afghan refugee camps. However, the major threat arises from the infiltration of TTP terrorists from their safe havens in Afghanistan.
While Pakistan has offered to help in promoting reconciliation between Kabul and the Afghan Taliban, there is little evidence of reciprocal action by Kabul to eliminate the TTP safe havens or to control cross-border infiltration. Kabul has refused to even revive the coordination mechanisms for border monitoring that were created with the US-Nato command.
Certain circles in Kabul, such as the National Directorate of Intelligence, are known to have collaborated with the TTP and sponsored Baloch insurgents to destabilise Pakistan. They were also responsible for scuttling the Murree talks and then blaming Pakistan for escalated insurgent attacks from Kabul to Kunduz. Now, they are asking Pakistan to attack the Afghan Taliban unless they agree to come to the negotiating table. This would bring Afghanistan's war to Pakistan.
Islamabad must reassert its demand for action against the TTP by Kabul and its international patrons. If such cooperation is not forthcoming, Pakistan will need to consider unilateral actions to eliminate the TTP safe havens in Afghanistan. Peace and security within Pakistan is also influenced by the policies and actions of several other external powers.
Historically, the US has contributed, wittingly or unwittingly, to Pakistan's destabilisation since the anti-Soviet Afghan war. The rump US-Nato force in Afghanistan is essential to prop up the tottering Kabul government. Obama is wisely averse to resuming a larger military role in Afghanistan. A Republican president, however, may be more adventurist, especially if driven by the misplaced desire to counter China's growing influence and interests in the region. In this context, it is relevant to evaluate whether the US shares China's vision that peace and prosperity can be promoted in Pakistan and the region through the implementation of the China-Pakistan Economic Corridor.
India's policies are more predictable. It has openly opposed the CPEC enterprise and is chary of China's growing role in the region. Notwithstanding the Lahore embrace and the likely resumption of the Comprehensive Dialogue, India remains the godfather of anti-Pakistan elements in Afghanistan and can be expected to continue to encourage and support them in their use of the TTP and Baloch dissidents to spread mischief and turmoil in Pakistan. Since Pakistan is now constrained from playing the 'Kashmir card', it cannot hope to neutralise India's subversive activities on the negotiating table; they will have to be defeated through direct action against the militants and muscular diplomacy with Kabul and its patrons.
Given Pakistan's denominational composition, Iran's policies will have an impact on Pakistan's internal stability. Following its nuclear agreement with the major powers and the removal of international sanctions, Iran can be expected to remain on good behaviour on issues which do not affect its core interests. Tehran's priorities are to retain its dominant influence in Syria, Iraq and the Levant; neutralise Saudi-led Sunni strategies, and maximise the economic benefits flowing from the lifting of sanctions. Iran can benefit from CPEC connectivity and closer linkages with China. However, Iran has a strategic relationship with India. A US-India-Iran axis is improbable, but not inconceivable. Pakistan needs to engage Iran and ensure that it does not try to play the sectarian card in Pakistan or attempt to forestall Pakistan's emergence as China's strategic link to the Arabian Sea and the Persian Gulf.
The GCC states have been Pakistan's closest friends and benefactors. Relations were unfortunately frayed by the clumsy manner in which Pakistan spurned the Arab coalition that has intervened in Yemen. Since then, Pakistan has mended fences with Saudi Arabia. Similar conciliation with the UAE is outstanding. Some have conjectured that the UAE would consider Gwadar's role in CPEC as a threat to Dubai's commercial pre-eminence. In further exchanges with the GCC states, Pakistan should reassure them that CPEC will add, not detract, from their prosperity. But Islamabad's first priority should be to secure an effective end to the flow of funds to sectarian and extremist groups from certain Gulf States.
It is only through such full-spectrum diplomacy, defence and deterrence that Pakistan can prove Obama wrong and achieve the peace and stability which is indispensable to implement the CPEC realise rapid growth and emerge as Asia's newest economic 'Tiger'.
Munir Akram is a former Pakistan ambassador to the UN.
Source: dawn.com/news/1234994/who-wants-peace-in-pakistan
I live in a world where my existence, my way of life and above all my religious practices are monitored and questioned on a daily basis. I am ridiculed for wearing a Hijab. I get curious looks for having a long beard. I am constantly under scrutiny if my name starts with Mohammed. My roots instantly draw verbal fire from people to and fro because I am considered a terrorist by default or sympathetic to the cause. I am a taboo to hang out with because I am a Muslim.
Who do I blame for creating a nemesis like al Qaeda, Islamic State (IS), the emerging lone wolves who are going postal or the vast number of disgruntled youth turning to violent resorts to appease their fragmented and misguided ideologies? It takes them down a path of destruction but for Pakistani expatriates and Muslim residents classification starts at colour, moves on to race and ends dramatically but definitely on religion.
The Islamic teachings I was brought up with differ greatly from the ones seen in social reflections today. Jihad/holy war was intended for the perseverance of faith and personal safety, not for the mindless killing spree by these psychos who claim to spread the word of God by forcing their agenda on young girls lured into their stronghold via popular social and volunteer networks. The projection of Islam by those possessing a violent mindset is a tragedy of errors philosophically, theologically and practically.
Back then and even now Islamic teachings were the guiding beacon that helped to keep spirituality confined between the Almighty and ourselves thereby not conforming to a boastful display of religiosity that creates an imbalance between daily lifestyle and ritualism. Muslim faith is about respecting and upholding the rights of parents, siblings, blood relations, neighbours, teachers, the orphaned, widows, the needy or even a by-stander who deserves a smile and a touch of kindness. I grew up knowing Islam as the ultimate guide to living in harmony with myself and those around me. Now, at the turn of the tide, I see a contorted rendition of Islamic ideology and its principal doctrine. Using the sacred words of the Quran to voice propaganda is what Islam has been reduced to by the modern day terrorist. Chanting Allah hu Akbar before taking a life has done irreparable damage to the fabric of Muslim communities worldwide. I see hatred pouring out for my faith on forums and blogs, and I repeatedly question my decision of leaving behind a culture to settle in a place where I had hoped for a better life. What these fanatics fail to realise is that the brunt of their selfish acts is felt by peaceful Islamic communities far and wide. The struggle for a peaceful integration in multicultural societies goes down the drain and we are thrown back to the very point from hence we started.
We are the numero uno priority for 2016 presidential candidates as well. Everyone wants to ride the censure train and folks like us who have given years of our lives working and establishing roots are thrown in the blame pit to get bullied in our work places or threatened in the middle of the day. The promises this political system wants to deliver will only make it worse for white-collar people like us. We may not be active participants in the murderous rampage but we surely will be treated and reprimanded as one.
I am not bullied because I am fat. I am not even harassed by the brown of my skin or the accent that distinguishes me from the rest; I am bullied because I am a Muslim. I am called a terrorist because I choose to remain a Muslim. I am handcuffed because I conform to a specific stereotype. I am constantly under scrutiny as I could be the next potential suicide bomber in the making. My religion and I are the latest things to show up on your television set. There may be training grounds and sleeper cells for all sorts of doctrines but the supposed biggest problem in the US that needs to be dealt with turns out to be Muslims and unless we are deported or leave the country of our own free will like that lanky kid Ahmed, the US can never get rid of all the violence that mars its streets, especially all the racial killings and police brutality (all puns intended). We are given the highest coverage available to mankind if there is one slip and there will only be fleeting mention if a young Muslim couple is gunned down over a parking spot issue. What is missing is the chant "Let us light a pyre and hang all the Muslims like the ill-famed Salem witches of ol'".
I see no end to this debacle. We are trying our best to make a life for our children, to make them a working cog of this machine. Whatever insecurities and grievances the world has against the US, there should be a better way to solve them. Are we the collateral damage to be sacrificed for the good of many? Life will never be the same in the land of opportunities; life will never be plain sailing from here onwards. Let us just hope the rolling tide does not choke the humanity out of these fine folks.
Saira Wasif is a freelance columnist
SourceZdailytimes.com.pk/opinion/25-Jan-2016/lamentation-of-an-american-muslim
More Afghan peace talks without a ceasefire is like putting the cart before the horse. How can the Quadrilateral Coordination Group (QCG), comprising Pakistan, Afghanistan, China and the US, expect a different outcome from previous tries without the Taliban halting attacks? Could it be that this multilateral confab exists for a multinational threat, meaning Islamic State (IS), and peace in Afghanistan would be a pleasant byproduct?
The QCG probably realised three things after its second meeting in Kabul on January 18. One, that the word Taliban as a collective noun no longer represents the monolithic, militant entity of Mullah Omar's heyday. Two, Pakistan only has a few Taliban factions under its thumb to nudge towards detente or use as proxies against IS. Three, the self-styled Khorasan province of IS (IS-K) is becoming a real headache in Nangarhar. Consequently, the quartet's first order of business may be to form another "coalition of the willing", terrorists and peaceniks alike, to strangle IS-K before it turns into a transnational threat for Asia.
For a long time, international actors took the ostrich approach towards IS-K because it suited the status quo to keep their heads firmly buried in the sand. It was only after the group released a gory propaganda clip titled 'Khorasan: the graveyard of the apostates' in December that alarm bells started ringing. The US State Department now classifies IS-K as a bonafide menace but, until August last year, Washington dismissed the militants as "operationally emergent" but largely inconsequential. Moreover, an unnamed US counter-terrorism official gloated to ABC News in September that IS-K and the Taliban "fighting each other makes our job easier".
Such hopes of mutually assured destruction waned quickly. As IS-K continues to wrest territory in Nangarhar, Washington warns the group is past its "initial exploratory phase" and poised to wreak substantial havoc. To prove this, IS-K struck both Pakistan's consulate and an Afghan tribal elders meeting in Jalalabad within the space of a few days in mid-January, leaving over 20 soldiers and civilians dead.
The Taliban, for their part, fret that IS-K could eclipse them as the primary antagonists in Afghanistan, thereby eroding hard-earned leverage to gain self-rule in the southern provinces. This fear propelled last year's vicious spring offensive that continues through winter without pause. Tellingly, Russian media reported that the new Taliban chief, Mullah Akhtar Mansour, met President Vladimir Putin in Tajikistan last September to solicit Moscow's aid in defeating IS-K. The former's vanishing act after an internecine gun-battle in Quetta last month, however, dents the Taliban's attempts to appear united.
Though suspicion clouds Pakistan's motives every time new Afghan peace talks surface, Islamabad now has real interest in shoring up Kabul. On December 29, Punjab Law Minister Rana Sanaullah revealed the arrest of six IS-K militants from Daska and the discovery of a jihadist training camp nearby. Up to that point, Islamabad had outright denied reports that last year's Safoora Goth massacre was IS-K's doing, emphasising "no footprint" of the Middle Eastern group existed in Pakistan.
After Sanaullah's sobering announcement, the state can dither no more on proactively culling these home-grown mutants. The last thing Pakistan needs, then, is a new jihadist nursery in Nangarhar, a stone's throw away from its perpetually restive tribal areas, and especially as the Torkham crossing point is vital for trade. Also, with ground officially broken on the Turkmenistan-Afghanistan-Pakistan-India (TAPI) gas pipeline, energy-starved Islamabad may need to nuance its 'strategic depth' doctrine to stay in lockstep with QCG partners.
Other quartet members have their own reasons for desiring a stable Afghanistan. US President Barack Obama, for example, needs IS-K liquidated to protect the sacrifices of over 2,300 US soldiers killed during Operation Enduring Freedom and to ensure that Afghan militancy does not snowball on his watch in an election year. Russia, meanwhile, admits that its interests "objectively coincide" with the Taliban on IS-K and that channels for intelligence sharing are operational. Though they make strange bedfellows, Moscow's primary concern right now is to prevent a militancy spill over into its "near abroad".
China, similarly, fears for Xinjiang's stability if the East Turkestan Islamic Movement (ETIM) fighters in IS-K ranks return home and escalate the ongoing insurgency. Beijing, of course, also has significant economic interests tied to the region. Other than high-stakes investments in Afghan minerals and fossil fuels, a stable Afghanistan is critical for China's new Silk Road ambitions.
The QCG will huddle anew on February 6 in Islamabad, again without Taliban representation. Curiously, if the group was worthy of invitation last July, what has changed? The only plausible explanation is that IS-K has leapfrogged the Taliban as a regional security nightmare. That said, the spate of suicide bombings timed around QCG talks suggests the Taliban will not take this demotion lying down. Sadly, yet another bloody year has begun.
S Mubashir Noor is a freelance columnist and audio engineer based in Islamabad
Source: dailytimes.com.pk/opinion/25-Jan-2016/a-black-cloud-looms-over-nangarhar
The recent outbursts by Donald Trump, a Republican front-runner presidential candidate, have created a stir amongst the Muslim expatriate community, including Pakistanis. Trump has called for "a total and complete shutdown of Muslims entering the US". Before this, he had suggested the registration of Muslim Americans and strict surveillance of their mosques. In the prevailing atmosphere of Islamophobia, Pakistani Americans feel not only left out from the mainstream but also have the impression that they have been singled out as a religious/ethnic minority. Trump and those who are like-minded in the Republican Party (GOP) keep tagging terrorism to Muslims and can hardly differentiate between an individual act and the entire Muslim community as such. Such a mind-set has pushed the Muslim community towards the defensive as they feel insecure, suspected and, at times discriminated against based on religion and nationality. Under the given circumstances, which ultimately will determine the comfort level of Pakistani expatriates, the complexities of their assimilation within American society need to be evaluated. According to the US Immigration and Naturalisation Service, till late 1960, there were around 2,500 Pakistanis, a number that today has increased to almost 500,000 making them one of the largest growing ethnic minorities in the country.
The majority of Pakistani immigrants in the US are from the urban-based middle-class, especially from Punjab (particularly Lahore) and Sindh (mainly Karachi). In the US, the majority of the Pakistani diaspora resides in metropolitan cities like New York, New Jersey, Houston, California, Washington D C and Dallas (Texas). Depending on how effectively a family is able to transform its values, most of the Pakistani diaspora not only shows the trend to attain higher education but is also ambitious to achieve professional excellence in their chosen fields.
Although the Pakistani diaspora is strongly linked to the cultural traditions and religious values of its native land, simultaneously, they struggle to assimilate in western culture, creating a hybrid between the host and home country. Nevertheless, the assimilation pattern of the first, second and third generation is diversified in terms of cultural adaptation and religious flexibility. The integration process of the second and third generation of this community has been comparatively smooth and quick, as compared to the first because of various reasons. Nevertheless, one fact needs to be reckoned and that is that, across generations, the Pakistani diaspora has maintained its cultural identity and has tried to operate in the middle stream, through which they are capable of integrating. For example, in family related matters, particularly regarding marriage, unlike the first and second generation, third generation Pakistani Americans prefer unarranged marriages (where the potential couple finalise the decision to marry after meeting and talking, irrespective of the family pressure) over arranged marriages. However, the acceptance of love marriage with other religious and ethnic groups is still not fully recognised.
Despite cultural assimilation, Pakistanis, through various means, strongly preserve their religious identity, which is Islam, especially when it comes to religious festivals and matrimonial matters. The religious practices of the Pakistani Muslim population had never been perceived as a threat for the security of the host country before September 11, 2001. Although not a single hijacker was a Pakistani national but the common American citizen, because of lack of information, irrespective of making a distinction between a militant and real Islam, has become suspicious about the activities of Muslim immigrants, including Pakistanis. According to the FBI's data, the hate crimes against Muslims and their mosques have increased significantly in 2015; there have been 63 recorded attacks on mosques. After November 2015's Paris attack and December 2015's San Bernardino shooting in California, within one week of December, 19 hate crimes against Muslims were recorded. This is the reinforcement of Islamphobia in American society to its greatest height, which has not only posed serious threats for the Pakistani Muslim community in the US but also presents a serious challenge for the American leadership.
The American leadership also needs to distinguish between an individual act of terrorism and community conduct as they perceived the shooting by a 23-year-old South Korean citizen on April 16, 2007, in Virginia Polytechnic Institute and State University, resulting in the loss of 32 lives, as an individual act. An encouraging aspect in this context is that the Democratic presidential candidate, Hillary Clinton, commented, "It is important that we do not listen to the voices, including those coming from Republican candidates for president, who would paint with such a broad brush, who would want us to somehow isolate, register Muslims, go after Islam. Our enemies are these criminal killers, who misuse a religion in order to recruit people, and give them the training to go out and kill more people." Similar views have been expressed by other Democratic leaders. The most articulate response came from internationally known American former professional boxer Muhammad Ali as he stated, "I am a Muslim and there is nothing Islamic about killing innocent people in Paris, San Bernardino or anywhere else in the world. True Muslims know that the ruthless violence of so-called Islamic jihadists goes against the very tenets of our religion. Stand up to those who use Islam to advance their own personal agenda."
Assessing the growing hatred against Muslims in the US, the American leadership has a serious responsibility to uphold American values, which vow for it to be a liberal society safeguarding the freedom of religion. It cannot be overlooked that Muslim Americans are a constructive part of American society as successful engineers, doctors, businessmen and philanthropists. It is generally believed that better sense will prevail amongst common Americans as there is a strong likelihood that in the coming presidential primaries, the hard liners and the Muslim haters will be rejected by the electorate.
Dr Zamurrad Awan is an assistant professor at the Forman Christian College, Lahore
dailytimes.com.pk/opinion/25-Jan-2016/the-pakistani-diaspora-in-the-us
SO, now what? Let's be realistic about the terribleness. Realistic, admittedly, as only non-victims can be.
It was Charsadda. It was a fraction of APS. And it wasn't little kids. It's a troubling assumption, but we can only assume they'd rather have hit something else.
Another APS. A proper military school. Maybe a mall. Probably a big city. But revenge was wrought on a place most of us can't locate on a map.
Who in this world really believes that Afghanistan will ever be stable? Now or possibly ever?
Yet, it's an old pattern. When they can't get to the hits they really want, they go after something else. When hard targets become difficult, they go for soft ones.
When schools become better protected, they'll hit a mall. When airbases become impossible, they'll go back to bus stands.
But Charsadda is important. Because not all terrorist attacks are the same. Know what happened in Khyber a day before? Or was it Peshawar? Quetta wasn't even a blip.
All lives may be equal, but terrorism knows the difference. A small hit on a hard target in Karachi equals a big hit on a soft target in Charsadda.
An attack that takes out a large number of soldiers equals an attack that takes out a few kids. And there's nothing — nothing — like a Fidayeen attack on children.
It is the purest form of terror. For obvious reasons. They aren't dying in a second. Not like in an explosion. They see the terror. They know what's coming. They watch their friends die.
Here's the question, though: the Taliban seem to have figured us out, but have we figured them out?
The most frightening part of Charsadda wasn't the attack — it was the response. Not the QRFs and the ISPR pressers. But where instantly it was decided the attack came from: Afghanistan. And because who was blamed: Umar Mansour.
The heart sinks when you hear Afghanistan. Not because of NDS or RAW or whatever else is fashionable to blame. For a more straightforward reason: who in this world really believes that Afghanistan will ever be stable? Now or possibly ever?
And even if Afghanistan is ever stable, just look at the border in the east. It is a border like no other. Barbed, fenced, mined, locked-down; soldiers and patrols ready to shoot anyone, no questions asked. And yet Pathankot happened.
If Pathankot can happen 68 years in, what in the hell is the possibility of thwarting a serious attack from Afghanistan — now or ever?
And then there's the guy who's been blamed: Umar Mansour. Umar who?
Not all threats from Afghanistan can't be dismantled. Back in the day, there was a Riaz Basra and an Akram Lahori.
They terrorised Punjab before decamping to Afghanistan. Khost, as legend has it. That's where our pals, the Haqqanis, were hanging out. Back when the Taliban were in charge.
(We'll come back to that.)
But they were eventually taken out and difficult to replace. A Riaz Basra is not born every day.
Umar Mansour is scary because he's a nobody. Not in a terrorist sense. He sounds like a terrible man. Scary in a replication sense.
Before Umar Mansour there was Maulana Fill-in-the-blanks X. After Umar Mansour, there'll be a Mullah Fill-in-the-blanks Y. Umar Mansour is like your eternal Al Qaeda No 3s.
There'll always be another Umar Mansour.
When wickedness is dreamt up in Afghanistan and executed by an eminently replaceable sort, what hope, really, is there for stability in Pakistan?
And here's where the unpleasant question needs to be asked. What in the hell kind of Afghanistan are we trying to recreate?
Sure, the Americans decided they wanted no part of it any longer and are willing to cut whatever deal possible. Sure, the Afghan government knows it's mired in the impossible and wants any deal it can get before state collapse.
Sure, Pakistan has been earnest and helpful in the quest for a deal. But what in God's name are we really doing? Just work through it.
Right now, the Afghan government is unable or unwilling to sort out the anti-Pakistan militants who've found sanctuary in its eastern provinces. Fine.
They — the Afghan government — want something from us just now, so that gives us leverage. That's why Raheel can ring up Kabul to demand and the Americans to complain.
They have to listen, we have to deal; it's a win-win scenario — right now. But let's imagine a deal gets made.
Afghanistan is either effectively carved up or the Taliban are given a bunch of seats in Kabul. Then what, re our enemies in Afghanistan?
The incentive for the Afghan government — the non-Taliban elements — to help us out would disappear. They'll have what they want and they'll probably tell us to go talk to the Taliban.
It would even make some kind of sense — after all, the terror threat to Pakistan from Afghan soil would mostly emanate from areas our friends, the Taliban, are either controlling or influential in.
So, over to the Taliban we'll go. Guys, help us out.
At that point, what's their incentive to help us out? They'd have outlasted two superpowers, won power a decade-and-a-half apart and need us less than ever.
And, let's not forget, we'd be asking them to crush their ideological companions. The very folk who, most recently, would have helped them fight against IS and the like.
Why would they do it? And what would be our leverage if they don't want to?
Yes, but what's the alternative, the boys here will ask. Well, have a look at Charsadda and ask yourself this:
Is faux-stability in Afghanistan worth horror in Pakistan?
Cyril Almeida is a member of staff.
Source: www.dawn.com/news/1234993/the-afghan-connection
URL: http://www.newageislam.com/pakistan-press/new-age-islam-edit-bureau/breaking-free-of-the-primitive-mindset-that-continues-to-oppress-women-and-justify-terrorism--new-age-islam-s-selection-25-january-2016/d/106107
Posted by Moderate Islamist here at 7:48 AM
Shades Of Hindutva– Examining Challenges From With...
In Pakistan, like Saudi Arabia
Armed Teachers: How Can One Expect A Teacher To Ca...
Dispossessed in the Name of 'Security'
Farahnaz Ispahani's book, bravely records near ext...
ISIS, Taliban, Al-Qaeda and Other Islamist Terrori...
Egyptian Writer Faitma Naoot Sentenced To Three Ye...
Man Dubbed 'Jihadi Jack' Urges Britons To Convert ...
Military-Mullah Nexus Strangling Pakistan
Deoband and Theological Anti-Pluralism: A Critique...
Tricolour Hoisting And Modern Education Opposed In...
Slogans Of ISIS, Terror Threats Scribbled On Mahat...
The Bacha Khan University Massacre: Why are the In...
Britain's 'Learn English or Leave' Policy Can Tear...
Breaking Free Of the Primitive Mindset That Contin...
Voice for Hazaras Laments Lost Chances in Afghanis...
Behind the Veil: The Secret Lives of Young Women W...
India Is Tolerant, I'm Proud to Be Indian — and I'...
Terrorism's Frankenstein Monster
Muslim Women Respect Britain, Britain Should Respe...
In Big Shift, India's Home-Grown Jihadis Were To T...
Saudi Kingdom and the Shia Islamic Republic
Muslim World: The Leaders Who Could Not Lead
Dealing with Hate-Mongers: New Age Islam's Selecti...
Path to Perdition: More Heads and Hands Will Be Ch...
Think like the Neighbour: What Is India's Best Opt...
Now, It Is Peshawar: Time Pakistan and the World W...
How Pakistan's 'Good Terrorist, Bad Terrorist' Gam...
Why Chess Upsets Religious Fundamentalists
Back From the Enemy Country
Terrorism in Pakistan: Shady War, Shadow Peace
To Make a Case against Islamic State's Cultural Va...
The Cruelty of the Ruling Empire Is Not Through Mi...
Several Chinese Wahhabi Extremists Seen among Mili...
Will India Open Its Temples And Mosques To Menstru...
Pakistan's 9/11: Education Is More Dangerous than ...
Parallel Standards Offer Way Out Of Violence: Ease...
Christian-Muslim Relations in West Asia: Challenge...
Muslim Disunity: A Real Cause of Decline
The Road from Pathankot
Pakistan's Terrorism Crisis Has Morphed Into an Ex...
Taliban Attack Shows Limits of Pakistan's Military...
New 'Halal' Sex Shop in UK: Why Sex Toys Can't Be ...
A Muslim Crossroads: Millions Gather Against Blasp...
Sponsoring a Syrian Refugee Is All the Rage in Can...
Doves and Demons in the Gulf: New Age Islam's Sele...
Pakistan Policy Needs both Carrot and Stick
Why ISIS Is Making Its Presence Felt In the Far Ea...
The Demon We Created: The Emergence of Masood Azha...
Madrasa Students Raze 'Un-Islamic' Alauddin Museum...
UK PM David Cameron Backs Burqa Ban in Schools and...
The Mystery of Radicalisation
Does the Qur'an Deny The Truth Of Other Religions?...
The Opening Up Of Iran Will Mean a Return to Barba...
Talk to Tehran, but Talk Tough
Battling ISIS in Indonesia
In The Aftermath of Pathankot
The Grief of Death
Week of Attacks, Scores of Civilian Deaths and a Q...
Jail to Jihad - Indonesian Prisons a Breeding Grou...
Pakistan Failure to Outlaw Child Marriage Sparks O...
ISIS Seems To Be Smelling Its Own Impending Doom: ...
Insulting the Prophet
Rainbow Tinted Lenses and Black n White Universes
ISIS Is Brainwashing Children to Murder Their Own ...
Sufism and Islamic Tradition Defeat Fundamentalism...
India, Afghans Not Enjoying Pak Cooperation – But ...
Divine Connection
Sacred Silence in Sufism and the Vedanta
Muslims and Loyalty Oaths
Women Hand Out Free Veils In Indonesia To Promote ...
Al-Qaida Chief Called For Islamic Caliphate in Eas...
Madrasas and the Rhetoric of Patriotism
India Needs Hindustaniyat, not Hindutva
Turkey Is Not In Bed With ISIL: New Age Islam's Se...
Interfaith Peace: When Pope Francis Cares Deeply A...
To Talk Or Not To Talk… : New Age Islam's Selectio...
Disguised Islamophobia At US College
Why Does Daesh Recruit Women?
The Death Of The Shareefs In Pakistan
These Are Scary Times for Muslims and Not Just Bec...
Being Labelled A Cheerleader For Islamic Zealots I...
Attacking ISIS: Fighting a Mental Virus
Fighting Islamist Terrorism: Battlefields of the m...
Stand Up For Free Speech, In Memory Of Charlie Heb...
British Muslim Charities Are Paying 'Islamic Penal...
Syrian Peace, Utopia, Humanity And Reality: New Ag...
'Bhakti Challenges Communal Religion'
A Cricketer And A Gentleman
How To Be A Happy Muslim Insha Allah
Christian-Muslim Relations: Challenges and Prospec...
Socio-Politico-Economic Justice System of Islam
Religious Division
The Message of Sufism
Expansion of Islamic State
Is Saudi Arabia Any Different From ISIS?
When Hindus wrote in Persian
An Examination Of The Nude Figure In Turkish Art A...
It is High Time to Discard the Pernicious Myth of ...


Of Flying Elephants and Funky Peacocks!
The reason we selected The Elephant Company's umbrellas for our Monsoon Story Box is because they stand defiant in their vivid greens and yellows against the monochrome greys of the monsoon skies. At My Big Red Bag, we are fans of big, bold and distinctive designs, and these umbrellas fit the bill on all three counts.
We were fortunate to hear from Aditi Dalal of The Elephant Company about the inspiration behind these quirky umbrellas, and the story behind them makes them shine even more resplendent. Read on.
Could you tell us a little bit about The Elephant Company, their history, and the kind of people who enjoy TEC's products?
The Elephant Company stands to make everyday life interesting; it is a celebration of a focus on design, and an ode to an aesthetic that is bright, slightly tongue in cheek, and lends color to one's world. My husband Asim and I have been involved with handicrafts, home products and lifestyle retail for a while, and came to the realization that there was a niche that we could specifically target. Like most ideas that are really worth it, this one came over coffee and conversation at home. We spent a lot of time nailing down our design philosophy and creating a team that was creative, hardworking and inspiring. So in essence, The Elephant Company is the realization of a dream that started in our dining room. The ideal customer is a young, urban millennial that is looking for statement pieces that tie their home together. The design team places great importance on sentiment, on nostalgia and on the premise that every product must tell a story.
Since we are including your product in our Monsoon box, we'd love to hear about some of your favourite monsoonal and rainy inspirations. How does rain inspire you to design and create?
Travel has always been a very important source of inspiration for us both. We've had some of our best memories while travelling, and some of those adventures have translated to design ideas. A great monsoon memory was in Goa, where we were caught unawares on the beach, and enjoyed getting drenched to the bone with our kids. There is a sense of uninhibited joy in dancing in the rain, and it felt like a film sequence. Drinking steaming hot chai and eating fried bhajiyas while all wrapped in fluffy towels was great.
What are some of your favorite place to visit during the Monsoons?
My husband and I went to Tuscany a few years ago, and spent a lovely evening walking through vineyards under a slight drizzle, huddled under an umbrella together. The night ended with wine and canapés in a café overlooking the lush forest, which makes for the perfect monsoon evening.
We love the Morfunk and Flying Elephants design, and have noticed that TEC creates several interesting products with these designs. Could you tell us about the inspiration behind the original designs?
What's the best way to take care for TEC Umbrellas?
After use, make sure the umbrella is dry and kept in the cover.
Apart from TEC, what are some of the other brands in the Design and Lifestyle space whose work you enjoy?
As I said, travel is a major source of inspiration, and our many trips to New York City over the past couple of years have resulted in us visiting lifestyle stores across the country that are brilliant at filling their own niche. My daughter studies in New York, and is always on the lookout for stores that are fresh, new and design oriented. We love Anthropologie, West Elm, and Jonathan Adler. They all focus on accessories that serve as accent pieces in a home. In this way, The Elephant Company draws themes from daily life in India, but those themes are fleshed out from a very international perspective.
Thanks Aditi (and team TEC, who we have to say have been one of the most co-operative bunch of people we've worked with!). If you are tired of the same old black and grey, get yourself a bright yellow Morfunk or a bright green Flying Elephant umbrella along with two other unique monsoon products now. Go ahead, don't let the rains dampen your spirit!
Your Monday Must List: Will Summer Ever End?


text:
True Nature, Causes and Sad Effects of the Rust, the Bunt...
This essay covers parasitic diseases of plants, and is considered to be the first treatise on plant pathology.
From the Introduction:
These pages, although limited to maladies of parasitic nature, constitute the first treatise on plant pathology, in the sense in which today we would speak of such publications. The clearness and the profundity with which questions of basic importance were imposed and confronted, the wisdom and the assurance with which the most difficult problems were solved, problems that tried the greatest students of the time and invited the activities of a large company of later scientists, cannot but astonish the modern reader as he recalls that this work was written in an epoch in which generally it was true that Phytopathology was obscured in a cloud of hypotheses or indeed was dominated by superstitions that had prevailed from very early times.
True Nature, Causes and Sad Effects of the Rust, the Bunt, the Smut, and other Maladies of Wheat, and of Oats in the Field
Format: 6" × 9" softcover
By Giovanni Targioni Tozzetti

redpajama_set_name: RedPajamaCommonCrawl


IDP is a global company offering student placement and English language testing services. It is based in Australia.
It has a network of over 75 student offices in 29 countries and places international students into all sectors of the Australian education system, including higher education and vocational education and training.
It is also a partner in IELTS along with the British Council.
IDP was established by Australian universities in 1969 and has nearly 40 years' experience in international education. Half of IDP's equity is owned by 38 Australian universities through their holding company IDP Education Australia Ltd. The other half is owned by SEEK Ltd, Australia's leading online employment and training company.


text:
Composer est un logiciel gestionnaire de dépendances libre écrit en PHP. Il permet à ses utilisateurs de déclarer et d'installer les bibliothèques dont le projet principal a besoin. Le développement a débuté en avril 2011 et a donné lieu à une première version sortie le  mars 2012. Développé au début par Nils Adermann et Jordi Boggiano  (qui continuent encore aujourd'hui à le maintenir), le projet est maintenant disponible sur la plateforme GitHub. Il est ainsi développé par toute une communauté.

Le logiciel Composer est à l'initiative d'un portage en PHP du logiciel Libzypp satsolver d'Open Suse.

Le logiciel Composer est fortement inspiré du logiciel npm pour Node.js et de bundler pour Ruby.

Installation
Le dépôt principal de Composer est le site web Packagist, qui permet notamment la recherche de bibliothèques et leur entreposage centralisé.

Le fichier binaire Composer est distribué sous la forme d'un lanceur, installable après un simple téléchargement.

Avec cURL
$ curl -sS https://getcomposer.org/installer | php

Avec PHP
$ php -r "readfile('https://getcomposer.org/installer');" | php

Fonctionnement

Commandes
Composer dispose de plusieurs paramètres dont :
 require : ajoute la bibliothèque en paramètre au fichier composer.json et l'installe.
 install : installe toutes les bibliothèques du composer.json. Il s'agit de la commande à lancer pour installer les dépendances d'un dépôt PHP.
 update : met à jour les bibliothèques du composer.json, selon les versions permises qui y sont mentionnées.
 remove : désinstalle une bibliothèque et la retire du composer.json.

Définition des bibliothèques
Exemple du composer.json généré par la commande :
 composer require monolog/monolog

{
    "require": {
        "monolog/monolog": "1.2.*"
    }
}

Versions
Les symboles permettant d'autoriser plusieurs versions des dépendances sont les suivants :

Références

Voir aussi

 PEAR (alternative)

Logiciel libre sous licence MIT
Gestionnaire de paquets

redpajama_set_name: RedPajamaWikipedia


text:
Q: Connection between nginx and Varnish I am using nginx as reverse proxy with varnish in the background. I have LAMP fueling varnish. The problem I am seeing on Varnish server is that the connection from nginx is getting established everytime a request is served.
We are serving more than 300 req/second and we see something like:
netstat -an|awk '/tcp/ {print $6}'|sort|uniq -c
      2 ESTABLISHED
      1 FIN_WAIT1
      7 LISTEN
      1 SYN_RECV
  43187 TIME_WAIT

This is ofcourse undesired. What would be best is that we setup a tunnel or a connection between nginx and varnish ones and all communication happen over that static connection. I am not quite sure how exactly this can be done or if there are better ways to do it.
What else can I do here?
Thanks

A: Nginx only supports HTTP/1.0 between itself and back-end servers, so no HTTP keep-alive by default :(
There are a lot of weird and wonderful third-party modules which may help, but so far I've only found keepalive support for memcache and redis, no HTTP

redpajama_set_name: RedPajamaStackExchange


Iran and the US cooperated during the 2001 Bonn conference that created the first post-Taliban government in Afghanistan. Iran brought together warlords who were at odds with each other to support the new government and even contributed what for Iran was a huge amount of $500 million to Afghan post-war reconstruction. According to James Dobbins, the US special envoy to Afghanistan at the time, Iran made positive contributions to stability in Afghanistan and facilitated the inauguration of Hamid Karzai as president. The Bush administration's decision to include Iran with Saddam Hussein's Iraq and North Korea on an "axis of evil" changed the course of US-Iran cooperation and undercut prospects for other diplomatic breakthroughs.
As the US seeks now to withdraw its 14,000 troops from Afghanistan, Iran cannot be ignored as an influential regional player. The country has broad investments in Afghanistan and a common and volatile border. Drug trafficking emanating from Afghanistan, and most importantly, an insurgency that could spill over into Iran, are all of great concern to Tehran. Iran is now openly in talks with the Taliban and says the aim is to bring the Taliban and the government of Ashraf Ghani together—the same goal enunciated by Khalilzad. Iran has notified the Afghan government before talks and has briefed the government afterwards.
Shah Hossein Mortazavi, deputy spokesperson for the Afghan president, criticized Zarif and in a Facebook post, accused Iranian officials of acting "in the role of Taliban spokesmen." Mortazavi deleted the post later but his comments resonated with many Afghans on social media.
The Taliban's goal has always been to portray itself as the only possible alternative for the country's future governance. The Taliban may have the support of some sectors of the Afghan population of the countryside they control. However, general anti-Taliban views in Afghanistan, due to their current and past brutality and violence, cannot be ignored. Afghans have sacrificed enormously to achieve their current political system and institutions, despite many shortcomings. The international community should not ignore the achievements of the last seventeen years, such as an improvement in the status of women and recognizing all ethnicities by the Afghanistan's constitution, in order to reach a peace deal with the Taliban.
It is imperative to use all available resources to bring a lasting peace to Afghanistan. Neither the US nor the Afghan government has enough leverage to deal with the Taliban alone. One of the effective players is Iran and differences with Tehran over other issues should not be a barrier to achieving a stable Afghanistan.


text:
Greatest Hits Volume Two kan avse:

Greatest Hits Vol. 2 (album av ABBA)
Greatest Hits Vol. 2 (album av Elisabeth Andreassen)


The varietal finds its beginnings being planted most famously along the Right Bank of Bordeaux. Often blended with Cabernet, it provides delicious soft, supple plum and cherry tones. With bottle age Merlot will develop a chocolaty edge.
The McLeish Estate Merlot has been a cornerstone in our portfolio for over 30 years. Produced to be a fresh medium bodied style that can be perfectly paired tomato based pasta, Chinese plum duck and light blue cheese.


text:
<?php

namespace Sonata\AdminBundle\Controller;

use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Admin\BaseFieldDescription;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\AdminBundle\Exception\LockException;
use Sonata\AdminBundle\Exception\ModelManagerException;
use Sonata\AdminBundle\Util\AdminObjectAclData;
use Sonata\AdminBundle\Util\AdminObjectAclManipulator;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Csrf\CsrfToken;

/**
 * Class CRUDController.
 *
 * @author  Thomas Rabaix <thomas.rabaix@sonata-project.org>
 */
class CRUDController extends Controller
{
    /**
     * The related Admin class.
     *
     * @var AdminInterface
     */
    protected $admin;

    /**
     * Render JSON.
     *
     * @param mixed   $data
     * @param int     $status
     * @param array   $headers
     * @param Request $request
     *
     * @return Response with json encoded data
     */
    protected function renderJson($data, $status = 200, $headers = array(), Request $request = null)
    {
        return new JsonResponse($data, $status, $headers);
    }

    /**
     * Returns true if the request is a XMLHttpRequest.
     *
     * @param Request $request
     *
     * @return bool True if the request is an XMLHttpRequest, false otherwise
     */
    protected function isXmlHttpRequest(Request $request = null)
    {
        $request = $this->resolveRequest($request);

        return $request->isXmlHttpRequest() || $request->get('_xml_http_request');
    }

    /**
     * Returns the correct RESTful verb, given either by the request itself or
     * via the "_method" parameter.
     *
     * @param Request $request
     *
     * @return string HTTP method, either
     */
    protected function getRestMethod(Request $request = null)
    {
        $request = $this->resolveRequest($request);

        if (Request::getHttpMethodParameterOverride() || !$request->request->has('_method')) {
            return $request->getMethod();
        }

        return $request->request->get('_method');
    }

    /**
     * Sets the Container associated with this Controller.
     *
     * @param ContainerInterface $container A ContainerInterface instance
     */
    public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;

        $this->configure();
    }

    /**
     * Contextualize the admin class depends on the current request.
     *
     * @throws \RuntimeException
     */
    protected function configure()
    {
        $request = $this->getRequest();

        $adminCode = $request->get('_sonata_admin');

        if (!$adminCode) {
            throw new \RuntimeException(sprintf(
                'There is no `_sonata_admin` defined for the controller `%s` and the current route `%s`',
                get_class($this),
                $request->get('_route')
            ));
        }

        $this->admin = $this->container->get('sonata.admin.pool')->getAdminByAdminCode($adminCode);

        if (!$this->admin) {
            throw new \RuntimeException(sprintf(
                'Unable to find the admin class related to the current controller (%s)',
                get_class($this)
            ));
        }

        $rootAdmin = $this->admin;

        if ($this->admin->isChild()) {
            $this->admin->setCurrentChild(true);
            $rootAdmin = $rootAdmin->getParent();
        }

        $rootAdmin->setRequest($request);

        if ($request->get('uniqid')) {
            $this->admin->setUniqid($request->get('uniqid'));
        }
    }

    /**
     * Proxy for the logger service of the container.
     * If no such service is found, a NullLogger is returned.
     *
     * @return LoggerInterface
     */
    protected function getLogger()
    {
        if ($this->container->has('logger')) {
            return $this->container->get('logger');
        } else {
            return new NullLogger();
        }
    }

    /**
     * Returns the base template name.
     *
     * @param Request $request
     *
     * @return string The template name
     */
    protected function getBaseTemplate(Request $request = null)
    {
        $request = $this->resolveRequest($request);

        if ($this->isXmlHttpRequest($request)) {
            return $this->admin->getTemplate('ajax');
        }

        return $this->admin->getTemplate('layout');
    }

    /**
     * {@inheritdoc}
     *
     * @param Request $request
     */
    public function render($view, array $parameters = array(), Response $response = null, Request $request = null)
    {
        $request = $this->resolveRequest($request);

        $parameters['admin'] = isset($parameters['admin']) ?
            $parameters['admin'] :
            $this->admin;

        $parameters['base_template'] = isset($parameters['base_template']) ?
            $parameters['base_template'] :
            $this->getBaseTemplate($request);

        $parameters['admin_pool'] = $this->get('sonata.admin.pool');

        return parent::render($view, $parameters, $response);
    }

    /**
     * @param \Exception $e
     *
     * @throws \Exception
     */
    protected function handleModelManagerException(\Exception $e)
    {
        if ($this->get('kernel')->isDebug()) {
            throw $e;
        }

        $context = array('exception' => $e);
        if ($e->getPrevious()) {
            $context['previous_exception_message'] = $e->getPrevious()->getMessage();
        }
        $this->getLogger()->error($e->getMessage(), $context);
    }

    /**
     * List action.
     *
     * @param Request $request
     *
     * @return Response
     *
     * @throws AccessDeniedException If access is not granted
     */
    public function listAction(Request $request = null)
    {
        $request = $this->resolveRequest($request);

        $this->admin->checkAccess('list');

        $preResponse = $this->preList($request);
        if ($preResponse !== null) {
            return $preResponse;
        }

        if ($listMode = $request->get('_list_mode')) {
            $this->admin->setListMode($listMode);
        }

        $datagrid = $this->admin->getDatagrid();
        $formView = $datagrid->getForm()->createView();

        // set the theme for the current Admin Form
        $this->get('twig')->getExtension('form')->renderer->setTheme($formView, $this->admin->getFilterTheme());

        return $this->render($this->admin->getTemplate('list'), array(
            'action'     => 'list',
            'form'       => $formView,
            'datagrid'   => $datagrid,
            'csrf_token' => $this->getCsrfToken('sonata.batch'),
        ), null, $request);
    }

    /**
     * Execute a batch delete.
     *
     * @param ProxyQueryInterface $query
     * @param Request             $request
     *
     * @return RedirectResponse
     *
     * @throws AccessDeniedException If access is not granted
     */
    public function batchActionDelete(ProxyQueryInterface $query, Request $request = null)
    {
        $this->admin->checkAccess('batchDelete');

        $request = $this->resolveRequest($request);

        $modelManager = $this->admin->getModelManager();
        try {
            $modelManager->batchDelete($this->admin->getClass(), $query);
            $this->addFlash('sonata_flash_success', 'flash_batch_delete_success');
        } catch (ModelManagerException $e) {
            $this->handleModelManagerException($e);
            $this->addFlash('sonata_flash_error', 'flash_batch_delete_error');
        }

        return new RedirectResponse($this->admin->generateUrl(
            'list',
            array('filter' => $this->admin->getFilterParameters())
        ));
    }

    /**
     * Delete action.
     *
     * @param int|string|null $id
     * @param Request         $request
     *
     * @return Response|RedirectResponse
     *
     * @throws NotFoundHttpException If the object does not exist
     * @throws AccessDeniedException If access is not granted
     */
    public function deleteAction($id, Request $request = null)
    {
        $request = $this->resolveRequest($request);
        $id      = $request->get($this->admin->getIdParameter());
        $object  = $this->admin->getObject($id);

        if (!$object) {
            throw $this->createNotFoundException(sprintf('unable to find the object with id : %s', $id));
        }

        $this->admin->checkAccess('delete', $object);

        $preResponse = $this->preDelete($request, $object);
        if ($preResponse !== null) {
            return $preResponse;
        }

        if ($this->getRestMethod($request) === 'DELETE') {
            // check the csrf token
            $this->validateCsrfToken('sonata.delete', $request);

            $objectName = $this->admin->toString($object);

            try {
                $this->admin->delete($object);

                if ($this->isXmlHttpRequest($request)) {
                    return $this->renderJson(array('result' => 'ok'), 200, array(), $request);
                }

                $this->addFlash(
                    'sonata_flash_success',
                    $this->admin->trans(
                        'flash_delete_success',
                        array('%name%' => $this->escapeHtml($objectName)),
                        'SonataAdminBundle'
                    )
                );
            } catch (ModelManagerException $e) {
                $this->handleModelManagerException($e);

                if ($this->isXmlHttpRequest($request)) {
                    return $this->renderJson(array('result' => 'error'), 200, array(), $request);
                }

                $this->addFlash(
                    'sonata_flash_error',
                    $this->admin->trans(
                        'flash_delete_error',
                        array('%name%' => $this->escapeHtml($objectName)),
                        'SonataAdminBundle'
                    )
                );
            }

            return $this->redirectTo($object, $request);
        }

        return $this->render($this->admin->getTemplate('delete'), array(
            'object'     => $object,
            'action'     => 'delete',
            'csrf_token' => $this->getCsrfToken('sonata.delete'),
        ), null, $request);
    }

    /**
     * Edit action.
     *
     * @param int|string|null $id
     * @param Request         $request
     *
     * @return Response|RedirectResponse
     *
     * @throws NotFoundHttpException If the object does not exist
     * @throws AccessDeniedException If access is not granted
     */
    public function editAction($id = null, Request $request = null)
    {
        $request = $this->resolveRequest($request);
        // the key used to lookup the template
        $templateKey = 'edit';

        $id     = $request->get($this->admin->getIdParameter());
        $object = $this->admin->getObject($id);

        if (!$object) {
            throw $this->createNotFoundException(sprintf('unable to find the object with id : %s', $id));
        }

        $this->admin->checkAccess('edit', $object);

        $preResponse = $this->preEdit($request, $object);
        if ($preResponse !== null) {
            return $preResponse;
        }

        $this->admin->setSubject($object);

        /** @var $form Form */
        $form = $this->admin->getForm();
        $form->setData($object);
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            //TODO: remove this check for 3.0
            if (method_exists($this->admin, 'preValidate')) {
                $this->admin->preValidate($object);
            }
            $isFormValid = $form->isValid();

            // persist if the form was valid and if in preview mode the preview was approved
            if ($isFormValid && (!$this->isInPreviewMode($request) || $this->isPreviewApproved($request))) {
                try {
                    $object = $this->admin->update($object);

                    if ($this->isXmlHttpRequest($request)) {
                        return $this->renderJson(array(
                            'result'     => 'ok',
                            'objectId'   => $this->admin->getNormalizedIdentifier($object),
                            'objectName' => $this->escapeHtml($this->admin->toString($object)),
                        ), 200, array(), $request);
                    }

                    $this->addFlash(
                        'sonata_flash_success',
                        $this->admin->trans(
                            'flash_edit_success',
                            array('%name%' => $this->escapeHtml($this->admin->toString($object))),
                            'SonataAdminBundle'
                        )
                    );

                    // redirect to edit mode
                    return $this->redirectTo($object, $request);
                } catch (ModelManagerException $e) {
                    $this->handleModelManagerException($e);

                    $isFormValid = false;
                } catch (LockException $e) {
                    $this->addFlash('sonata_flash_error', $this->admin->trans('flash_lock_error', array(
                        '%name%'       => $this->escapeHtml($this->admin->toString($object)),
                        '%link_start%' => 'admin->generateObjectUrl('edit', $object).'">',
                        '%link_end%'   => '',
                    ), 'SonataAdminBundle'));
                }
            }

            // show an error message if the form failed validation
            if (!$isFormValid) {
                if (!$this->isXmlHttpRequest($request)) {
                    $this->addFlash(
                        'sonata_flash_error',
                        $this->admin->trans(
                            'flash_edit_error',
                            array('%name%' => $this->escapeHtml($this->admin->toString($object))),
                            'SonataAdminBundle'
                        )
                    );
                }
            } elseif ($this->isPreviewRequested($request)) {
                // enable the preview template if the form was valid and preview was requested
                $templateKey = 'preview';
                $this->admin->getShow();
            }
        }

        $view = $form->createView();

        // set the theme for the current Admin Form
        $this->get('twig')->getExtension('form')->renderer->setTheme($view, $this->admin->getFormTheme());

        return $this->render($this->admin->getTemplate($templateKey), array(
            'action' => 'edit',
            'form'   => $view,
            'object' => $object,
        ), null, $request);
    }

    /**
     * Redirect the user depend on this choice.
     *
     * @param object  $object
     * @param Request $request
     *
     * @return RedirectResponse
     */
    protected function redirectTo($object, Request $request = null)
    {
        $request = $this->resolveRequest($request);

        $url = false;

        if (null !== $request->get('btn_update_and_list')) {
            $url = $this->admin->generateUrl('list');
        }
        if (null !== $request->get('btn_create_and_list')) {
            $url = $this->admin->generateUrl('list');
        }

        if (null !== $request->get('btn_create_and_create')) {
            $params = array();
            if ($this->admin->hasActiveSubClass()) {
                $params['subclass'] = $request->get('subclass');
            }
            $url = $this->admin->generateUrl('create', $params);
        }

        if ($this->getRestMethod($request) === 'DELETE') {
            $url = $this->admin->generateUrl('list');
        }

        if (!$url) {
            foreach (array('edit', 'show') as $route) {
                if ($this->admin->hasRoute($route) && $this->admin->isGranted(strtoupper($route), $object)) {
                    $url = $this->admin->generateObjectUrl($route, $object);
                    break;
                }
            }
        }

        if (!$url) {
            $url = $this->admin->generateUrl('list');
        }

        return new RedirectResponse($url);
    }

    /**
     * Batch action.
     *
     * @param Request $request
     *
     * @return Response|RedirectResponse
     *
     * @throws NotFoundHttpException If the HTTP method is not POST
     * @throws \RuntimeException     If the batch action is not defined
     */
    public function batchAction(Request $request = null)
    {
        $request    = $this->resolveRequest($request);
        $restMethod = $this->getRestMethod($request);

        if ('POST' !== $restMethod) {
            throw $this->createNotFoundException(sprintf('Invalid request type "%s", POST expected', $restMethod));
        }

        // check the csrf token
        $this->validateCsrfToken('sonata.batch', $request);

        $confirmation = $request->get('confirmation', false);

        if ($data = json_decode($request->get('data'), true)) {
            $action      = $data['action'];
            $idx         = $data['idx'];
            $allElements = $data['all_elements'];
            $request->request->replace(array_merge($request->request->all(), $data));
        } else {
            $request->request->set('idx', $request->get('idx', array()));
            $request->request->set('all_elements', $request->get('all_elements', false));

            $action      = $request->get('action');
            $idx         = $request->get('idx');
            $allElements = $request->get('all_elements');
            $data        = $request->request->all();

            unset($data['_sonata_csrf_token']);
        }

        $batchActions = $this->admin->getBatchActions();
        if (!array_key_exists($action, $batchActions)) {
            throw new \RuntimeException(sprintf('The `%s` batch action is not defined', $action));
        }

        $camelizedAction  = BaseFieldDescription::camelize($action);
        $isRelevantAction = sprintf('batchAction%sIsRelevant', ucfirst($camelizedAction));

        if (method_exists($this, $isRelevantAction)) {
            $nonRelevantMessage = call_user_func(array($this, $isRelevantAction), $idx, $allElements, $request);
        } else {
            $nonRelevantMessage = count($idx) != 0 || $allElements; // at least one item is selected
        }

        if (!$nonRelevantMessage) { // default non relevant message (if false of null)
            $nonRelevantMessage = 'flash_batch_empty';
        }

        $datagrid = $this->admin->getDatagrid();
        $datagrid->buildPager();

        if (true !== $nonRelevantMessage) {
            $this->addFlash('sonata_flash_info', $nonRelevantMessage);

            return new RedirectResponse(
                $this->admin->generateUrl(
                    'list',
                    array('filter' => $this->admin->getFilterParameters())
                )
            );
        }

        $askConfirmation = isset($batchActions[$action]['ask_confirmation']) ?
            $batchActions[$action]['ask_confirmation'] :
            true;

        if ($askConfirmation && $confirmation != 'ok') {
            $translationDomain = $batchActions[$action]['translation_domain'] ?: $this->admin->getTranslationDomain();
            $actionLabel = $this->admin->trans($batchActions[$action]['label'], array(), $translationDomain);

            $formView = $datagrid->getForm()->createView();

            return $this->render($this->admin->getTemplate('batch_confirmation'), array(
                'action'       => 'list',
                'action_label' => $actionLabel,
                'datagrid'     => $datagrid,
                'form'         => $formView,
                'data'         => $data,
                'csrf_token'   => $this->getCsrfToken('sonata.batch'),
            ), null, $request);
        }

        // execute the action, batchActionXxxxx
        $finalAction = sprintf('batchAction%s', ucfirst($camelizedAction));
        if (!is_callable(array($this, $finalAction))) {
            throw new \RuntimeException(sprintf('A `%s::%s` method must be callable', get_class($this), $finalAction));
        }

        $query = $datagrid->getQuery();

        $query->setFirstResult(null);
        $query->setMaxResults(null);

        $this->admin->preBatchAction($action, $query, $idx, $allElements);

        if (count($idx) > 0) {
            $this->admin->getModelManager()->addIdentifiersToQuery($this->admin->getClass(), $query, $idx);
        } elseif (!$allElements) {
            $query = null;
        }

        return call_user_func(array($this, $finalAction), $query, $request);
    }

    /**
     * Create action.
     *
     * @param Request $request
     *
     * @return Response
     *
     * @throws AccessDeniedException If access is not granted
     */
    public function createAction(Request $request = null)
    {
        $request = $this->resolveRequest($request);
        // the key used to lookup the template
        $templateKey = 'edit';

        $this->admin->checkAccess('create');

        $class = new \ReflectionClass($this->admin->hasActiveSubClass() ? $this->admin->getActiveSubClass() : $this->admin->getClass());

        if ($class->isAbstract()) {
            return $this->render(
                'SonataAdminBundle:CRUD:select_subclass.html.twig',
                array(
                    'base_template' => $this->getBaseTemplate(),
                    'admin'         => $this->admin,
                    'action'        => 'create',
                ),
                null,
                $request
            );
        }

        $object = $this->admin->getNewInstance();

        $preResponse = $this->preCreate($request, $object);
        if ($preResponse !== null) {
            return $preResponse;
        }

        $this->admin->setSubject($object);

        /** @var $form \Symfony\Component\Form\Form */
        $form = $this->admin->getForm();
        $form->setData($object);
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            //TODO: remove this check for 3.0
            if (method_exists($this->admin, 'preValidate')) {
                $this->admin->preValidate($object);
            }
            $isFormValid = $form->isValid();

            // persist if the form was valid and if in preview mode the preview was approved
            if ($isFormValid && (!$this->isInPreviewMode($request) || $this->isPreviewApproved($request))) {
                $this->admin->checkAccess('create', $object);

                try {
                    $object = $this->admin->create($object);

                    if ($this->isXmlHttpRequest($request)) {
                        return $this->renderJson(array(
                            'result'   => 'ok',
                            'objectId' => $this->admin->getNormalizedIdentifier($object),
                        ), 200, array(), $request);
                    }

                    $this->addFlash(
                        'sonata_flash_success',
                        $this->admin->trans(
                            'flash_create_success',
                            array('%name%' => $this->escapeHtml($this->admin->toString($object))),
                            'SonataAdminBundle'
                        )
                    );

                    // redirect to edit mode
                    return $this->redirectTo($object, $request);
                } catch (ModelManagerException $e) {
                    $this->handleModelManagerException($e);

                    $isFormValid = false;
                }
            }

            // show an error message if the form failed validation
            if (!$isFormValid) {
                if (!$this->isXmlHttpRequest($request)) {
                    $this->addFlash(
                        'sonata_flash_error',
                        $this->admin->trans(
                            'flash_create_error',
                            array('%name%' => $this->escapeHtml($this->admin->toString($object))),
                            'SonataAdminBundle'
                        )
                    );
                }
            } elseif ($this->isPreviewRequested($request)) {
                // pick the preview template if the form was valid and preview was requested
                $templateKey = 'preview';
                $this->admin->getShow();
            }
        }

        $view = $form->createView();

        // set the theme for the current Admin Form
        $this->get('twig')->getExtension('form')->renderer->setTheme($view, $this->admin->getFormTheme());

        return $this->render($this->admin->getTemplate($templateKey), array(
            'action' => 'create',
            'form'   => $view,
            'object' => $object,
        ), null, $request);
    }

    /**
     * Returns true if the preview is requested to be shown.
     *
     * @param Request $request
     *
     * @return bool
     */
    protected function isPreviewRequested(Request $request = null)
    {
        $request = $this->resolveRequest($request);

        return $request->get('btn_preview') !== null;
    }

    /**
     * Returns true if the preview has been approved.
     *
     * @param Request $request
     *
     * @return bool
     */
    protected function isPreviewApproved(Request $request = null)
    {
        $request = $this->resolveRequest($request);

        return $request->get('btn_preview_approve') !== null;
    }

    /**
     * Returns true if the request is in the preview workflow.
     *
     * That means either a preview is requested or the preview has already been shown
     * and it got approved/declined.
     *
     * @param Request $request
     *
     * @return bool
     */
    protected function isInPreviewMode(Request $request = null)
    {
        $request = $this->resolveRequest($request);

        return $this->admin->supportsPreviewMode()
        && ($this->isPreviewRequested($request)
            || $this->isPreviewApproved($request)
            || $this->isPreviewDeclined($request));
    }

    /**
     * Returns true if the preview has been declined.
     *
     * @param Request $request
     *
     * @return bool
     */
    protected function isPreviewDeclined(Request $request = null)
    {
        $request = $this->resolveRequest($request);

        return $request->get('btn_preview_decline') !== null;
    }

    /**
     * Show action.
     *
     * @param int|string|null $id
     * @param Request         $request
     *
     * @return Response
     *
     * @throws NotFoundHttpException If the object does not exist
     * @throws AccessDeniedException If access is not granted
     */
    public function showAction($id = null, Request $request = null)
    {
        $request = $this->resolveRequest($request);
        $id      = $request->get($this->admin->getIdParameter());

        $object = $this->admin->getObject($id);

        if (!$object) {
            throw $this->createNotFoundException(sprintf('unable to find the object with id : %s', $id));
        }

        $this->admin->checkAccess('show', $object);

        $preResponse = $this->preShow($request, $object);
        if ($preResponse !== null) {
            return $preResponse;
        }

        $this->admin->setSubject($object);

        return $this->render($this->admin->getTemplate('show'), array(
            'action'   => 'show',
            'object'   => $object,
            'elements' => $this->admin->getShow(),
        ), null, $request);
    }

    /**
     * Show history revisions for object.
     *
     * @param int|string|null $id
     * @param Request         $request
     *
     * @return Response
     *
     * @throws AccessDeniedException If access is not granted
     * @throws NotFoundHttpException If the object does not exist or the audit reader is not available
     */
    public function historyAction($id = null, Request $request = null)
    {
        $request = $this->resolveRequest($request);
        $id      = $request->get($this->admin->getIdParameter());

        $object = $this->admin->getObject($id);

        if (!$object) {
            throw $this->createNotFoundException(sprintf('unable to find the object with id : %s', $id));
        }

        $this->admin->checkAccess('history', $object);

        $manager = $this->get('sonata.admin.audit.manager');

        if (!$manager->hasReader($this->admin->getClass())) {
            throw $this->createNotFoundException(
                sprintf(
                    'unable to find the audit reader for class : %s',
                    $this->admin->getClass()
                )
            );
        }

        $reader = $manager->getReader($this->admin->getClass());

        $revisions = $reader->findRevisions($this->admin->getClass(), $id);

        return $this->render($this->admin->getTemplate('history'), array(
            'action'          => 'history',
            'object'          => $object,
            'revisions'       => $revisions,
            'currentRevision' => $revisions ? current($revisions) : false,
        ), null, $request);
    }

    /**
     * View history revision of object.
     *
     * @param int|string|null $id
     * @param string|null     $revision
     * @param Request         $request
     *
     * @return Response
     *
     * @throws AccessDeniedException If access is not granted
     * @throws NotFoundHttpException If the object or revision does not exist or the audit reader is not available
     */
    public function historyViewRevisionAction($id = null, $revision = null, Request $request = null)
    {
        $request = $this->resolveRequest($request);
        $id      = $request->get($this->admin->getIdParameter());

        $object = $this->admin->getObject($id);

        if (!$object) {
            throw $this->createNotFoundException(sprintf('unable to find the object with id : %s', $id));
        }

        $this->admin->checkAccess('historyViewRevision', $object);

        $manager = $this->get('sonata.admin.audit.manager');

        if (!$manager->hasReader($this->admin->getClass())) {
            throw $this->createNotFoundException(
                sprintf(
                    'unable to find the audit reader for class : %s',
                    $this->admin->getClass()
                )
            );
        }

        $reader = $manager->getReader($this->admin->getClass());

        // retrieve the revisioned object
        $object = $reader->find($this->admin->getClass(), $id, $revision);

        if (!$object) {
            throw $this->createNotFoundException(
                sprintf(
                    'unable to find the targeted object `%s` from the revision `%s` with classname : `%s`',
                    $id,
                    $revision,
                    $this->admin->getClass()
                )
            );
        }

        $this->admin->setSubject($object);

        return $this->render($this->admin->getTemplate('show'), array(
            'action'   => 'show',
            'object'   => $object,
            'elements' => $this->admin->getShow(),
        ), null, $request);
    }

    /**
     * Compare history revisions of object.
     *
     * @param int|string|null $id
     * @param int|string|null $base_revision
     * @param int|string|null $compare_revision
     * @param Request         $request
     *
     * @return Response
     *
     * @throws AccessDeniedException If access is not granted
     * @throws NotFoundHttpException If the object or revision does not exist or the audit reader is not available
     */
    public function historyCompareRevisionsAction($id = null, $base_revision = null, $compare_revision = null, Request $request = null)
    {
        $request = $this->resolveRequest($request);

        $this->admin->checkAccess('historyCompareRevisions');

        $id = $request->get($this->admin->getIdParameter());

        $object = $this->admin->getObject($id);

        if (!$object) {
            throw $this->createNotFoundException(sprintf('unable to find the object with id : %s', $id));
        }

        $manager = $this->get('sonata.admin.audit.manager');

        if (!$manager->hasReader($this->admin->getClass())) {
            throw $this->createNotFoundException(
                sprintf(
                    'unable to find the audit reader for class : %s',
                    $this->admin->getClass()
                )
            );
        }

        $reader = $manager->getReader($this->admin->getClass());

        // retrieve the base revision
        $base_object = $reader->find($this->admin->getClass(), $id, $base_revision);
        if (!$base_object) {
            throw $this->createNotFoundException(
                sprintf(
                    'unable to find the targeted object `%s` from the revision `%s` with classname : `%s`',
                    $id,
                    $base_revision,
                    $this->admin->getClass()
                )
            );
        }

        // retrieve the compare revision
        $compare_object = $reader->find($this->admin->getClass(), $id, $compare_revision);
        if (!$compare_object) {
            throw $this->createNotFoundException(
                sprintf(
                    'unable to find the targeted object `%s` from the revision `%s` with classname : `%s`',
                    $id,
                    $compare_revision,
                    $this->admin->getClass()
                )
            );
        }

        $this->admin->setSubject($base_object);

        return $this->render($this->admin->getTemplate('show_compare'), array(
            'action'         => 'show',
            'object'         => $base_object,
            'object_compare' => $compare_object,
            'elements'       => $this->admin->getShow(),
        ), null, $request);
    }

    /**
     * Export data to specified format.
     *
     * @param Request $request
     *
     * @return Response
     *
     * @throws AccessDeniedException If access is not granted
     * @throws \RuntimeException     If the export format is invalid
     */
    public function exportAction(Request $request = null)
    {
        $request = $this->resolveRequest($request);

        $this->admin->checkAccess('export');

        $format = $request->get('format');

        $allowedExportFormats = (array) $this->admin->getExportFormats();

        if (!in_array($format, $allowedExportFormats)) {
            throw new \RuntimeException(
                sprintf(
                    'Export in format `%s` is not allowed for class: `%s`. Allowed formats are: `%s`',
                    $format,
                    $this->admin->getClass(),
                    implode(', ', $allowedExportFormats)
                )
            );
        }

        $filename = sprintf(
            'export_%s_%s.%s',
            strtolower(substr($this->admin->getClass(), strripos($this->admin->getClass(), '\\') + 1)),
            date('Y_m_d_H_i_s', strtotime('now')),
            $format
        );

        return $this->get('sonata.admin.exporter')->getResponse(
            $format,
            $filename,
            $this->admin->getDataSourceIterator()
        );
    }

    /**
     * Gets ACL users.
     *
     * @return \Traversable
     */
    protected function getAclUsers()
    {
        $aclUsers = array();

        $userManagerServiceName = $this->container->getParameter('sonata.admin.security.acl_user_manager');
        if ($userManagerServiceName !== null && $this->has($userManagerServiceName)) {
            $userManager = $this->get($userManagerServiceName);

            if (method_exists($userManager, 'findUsers')) {
                $aclUsers = $userManager->findUsers();
            }
        }

        return is_array($aclUsers) ? new \ArrayIterator($aclUsers) : $aclUsers;
    }

    /**
     * Gets ACL roles.
     *
     * @return \Traversable
     */
    protected function getAclRoles()
    {
        $aclRoles      = array();
        $roleHierarchy = $this->container->getParameter('security.role_hierarchy.roles');
        $pool          = $this->container->get('sonata.admin.pool');

        foreach ($pool->getAdminServiceIds() as $id) {
            try {
                $admin = $pool->getInstance($id);
            } catch (\Exception $e) {
                continue;
            }

            $baseRole = $admin->getSecurityHandler()->getBaseRole($admin);
            foreach ($admin->getSecurityInformation() as $role => $permissions) {
                $role       = sprintf($baseRole, $role);
                $aclRoles[] = $role;
            }
        }

        foreach ($roleHierarchy as $name => $roles) {
            $aclRoles[] = $name;
            $aclRoles   = array_merge($aclRoles, $roles);
        }

        $aclRoles = array_unique($aclRoles);

        return is_array($aclRoles) ? new \ArrayIterator($aclRoles) : $aclRoles;
    }

    /**
     * Returns the Response object associated to the acl action.
     *
     * @param int|string|null $id
     * @param Request         $request
     *
     * @return Response|RedirectResponse
     *
     * @throws AccessDeniedException If access is not granted.
     * @throws NotFoundHttpException If the object does not exist or the ACL is not enabled
     */
    public function aclAction($id = null, Request $request = null)
    {
        $request = $this->resolveRequest($request);

        if (!$this->admin->isAclEnabled()) {
            throw $this->createNotFoundException('ACL are not enabled for this admin');
        }

        $id = $request->get($this->admin->getIdParameter());

        $object = $this->admin->getObject($id);

        if (!$object) {
            throw $this->createNotFoundException(sprintf('unable to find the object with id : %s', $id));
        }

        $this->admin->checkAccess('acl', $object);

        $this->admin->setSubject($object);
        $aclUsers = $this->getAclUsers();
        $aclRoles = $this->getAclRoles();

        $adminObjectAclManipulator = $this->get('sonata.admin.object.manipulator.acl.admin');
        $adminObjectAclData        = new AdminObjectAclData(
            $this->admin,
            $object,
            $aclUsers,
            $adminObjectAclManipulator->getMaskBuilderClass(),
            $aclRoles
        );

        $aclUsersForm = $adminObjectAclManipulator->createAclUsersForm($adminObjectAclData);
        $aclRolesForm = $adminObjectAclManipulator->createAclRolesForm($adminObjectAclData);

        if ($request->getMethod() === 'POST') {
            if ($request->request->has(AdminObjectAclManipulator::ACL_USERS_FORM_NAME)) {
                $form         = $aclUsersForm;
                $updateMethod = 'updateAclUsers';
            } elseif ($request->request->has(AdminObjectAclManipulator::ACL_ROLES_FORM_NAME)) {
                $form         = $aclRolesForm;
                $updateMethod = 'updateAclRoles';
            }

            if (isset($form)) {
                $form->handleRequest($request);

                if ($form->isValid()) {
                    $adminObjectAclManipulator->$updateMethod($adminObjectAclData);
                    $this->addFlash('sonata_flash_success', 'flash_acl_edit_success');

                    return new RedirectResponse($this->admin->generateObjectUrl('acl', $object));
                }
            }
        }

        return $this->render($this->admin->getTemplate('acl'), array(
            'action'       => 'acl',
            'permissions'  => $adminObjectAclData->getUserPermissions(),
            'object'       => $object,
            'users'        => $aclUsers,
            'roles'        => $aclRoles,
            'aclUsersForm' => $aclUsersForm->createView(),
            'aclRolesForm' => $aclRolesForm->createView(),
        ), null, $request);
    }

    /**
     * Adds a flash message for type.
     *
     * @param string $type
     * @param string $message
     *
     * @TODO Remove this method when bumping requirements to Symfony >= 2.6
     */
    protected function addFlash($type, $message)
    {
        if (method_exists('Symfony\Bundle\FrameworkBundle\Controller\Controller', 'addFlash')) {
            parent::addFlash($type, $message);
        } else {
            $this->get('session')
                ->getFlashBag()
                ->add($type, $message);
        }
    }

    /**
     * Validate CSRF token for action without form.
     *
     * @param string  $intention
     * @param Request $request
     *
     * @throws HttpException
     */
    protected function validateCsrfToken($intention, Request $request = null)
    {
        $request = $this->resolveRequest($request);
        $token = $request->request->get('_sonata_csrf_token', false);

        if ($this->container->has('security.csrf.token_manager')) { // SF3.0
            $valid = $this->container->get('security.csrf.token_manager')->isTokenValid(new CsrfToken($intention, $token));
        } elseif ($this->container->has('form.csrf_provider')) { // < SF3.0
            $valid = $this->container->get('form.csrf_provider')->isCsrfTokenValid($intention, $token);
        } else {
            return;
        }

        if (!$valid) {
            throw new HttpException(400, 'The csrf token is not valid, CSRF attack?');
        }
    }

    /**
     * Escape string for html output.
     *
     * @param string $s
     *
     * @return string
     */
    protected function escapeHtml($s)
    {
        return htmlspecialchars($s, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
    }

    /**
     * Get CSRF token.
     *
     * @param string $intention
     *
     * @return string|false
     */
    protected function getCsrfToken($intention)
    {
        if ($this->container->has('security.csrf.token_manager')) {
            return $this->container->get('security.csrf.token_manager')->getToken($intention)->getValue();
        }

        // TODO: Remove it when bumping requirements to SF 2.4+
        if ($this->container->has('form.csrf_provider')) {
            return $this->container->get('form.csrf_provider')->generateCsrfToken($intention);
        }

        return false;
    }

    /**
     * This method can be overloaded in your custom CRUD controller.
     * It's called from createAction.
     *
     * @param Request $request
     * @param mixed   $object
     *
     * @return Response|null
     */
    protected function preCreate(Request $request, $object)
    {
    }

    /**
     * This method can be overloaded in your custom CRUD controller.
     * It's called from editAction.
     *
     * @param Request $request
     * @param mixed   $object
     *
     * @return Response|null
     */
    protected function preEdit(Request $request, $object)
    {
    }

    /**
     * This method can be overloaded in your custom CRUD controller.
     * It's called from deleteAction.
     *
     * @param Request $request
     * @param mixed   $object
     *
     * @return Response|null
     */
    protected function preDelete(Request $request, $object)
    {
    }

    /**
     * This method can be overloaded in your custom CRUD controller.
     * It's called from showAction.
     *
     * @param Request $request
     * @param mixed   $object
     *
     * @return Response|null
     */
    protected function preShow(Request $request, $object)
    {
    }

    /**
     * This method can be overloaded in your custom CRUD controller.
     * It's called from listAction.
     *
     * @param Request $request
     *
     * @return Response|null
     */
    protected function preList(Request $request)
    {
    }

    /**
     * To keep backwards compatibility with older Sonata Admin code.
     *
     * @internal
     */
    private function resolveRequest(Request $request = null)
    {
        if (null === $request) {
            return $this->getRequest();
        }

        return $request;
    }

    /**
     * @return Request
     */
    public function getRequest()
    {
        if ($this->container->has('request_stack')) {
            return $this->container->get('request_stack')->getCurrentRequest();
        }

        return $this->container->get('request');
    }
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef GNOMEMENU_H
#define GNOMEMENU_H

#ifdef COMMUNI_HAVE_GIO

#include <QObject>
#include <QWidget>
#include <QScopedPointer>

class GnomeMenuPrivate;

class GnomeMenu : public QObject
{
    Q_OBJECT

public:
    explicit GnomeMenu(QObject* parent = 0);
    ~GnomeMenu();

    void addSimpleItem(const QByteArray& id, const QString& caption, QObject* receiver, const char* slot);
    void addToggleItem(const QByteArray& id, const QString& caption, bool isChecked, QObject* receiver, const char* slot);
    void setToggleItemState(const QByteArray& id, bool checked);
    void addSection(GnomeMenu* section);

    void setMenuToWindow(WId winId, const QByteArray& dbusPathPrefix);

private:
    QScopedPointer<GnomeMenuPrivate> d;
};

#endif // COMMUNI_HAVE_GIO

#endif // GNOMEMENU_H


Opéra National du Rhin, Strasbourg stage Amon Miyamoto's new production of Kinkakuji (Le Pavillon d'Or). Premiered at the Deutsche Oper Berlin in 1976, this French creation (a co-production with the Tokyo Nikikai Opera Foundation) is conducted by Paul Daniel with sets by Boris Kudlicka. Simon Bailey sings the key protagonist Mizoguchi and the cast also includes Dominic Große (Tsurukawa), Paul Kaufman (Kashiwagi) and Yves Saelens (La Père). Performances run from 21st March to 15th April 2018.
Further roles in 2018 for Simon include Kaspar Der Freischütz in Stuttgart, Redburn Billy Budd in Frankfurt, a return to WNO for War & Peace, a concert performance of Fujikura's Solaris in Tokyo and From the House of the Dead at the Brno Festival.